diff --git a/Makefile b/Makefile index 38f67cb158..41b384c2e3 100644 --- a/Makefile +++ b/Makefile @@ -186,7 +186,7 @@ ifneq ($(detected_OS),Windows) endif DOTHERSIDE_LIBFILE := vendor/DOtherSide/build/lib/libDOtherSideStatic.a # order matters here, due to "-Wl,-as-needed" - NIM_PARAMS += --passL:"$(DOTHERSIDE_LIBFILE)" --passL:"$(shell PKG_CONFIG_PATH="$(QT5_PCFILEDIR)" pkg-config --libs Qt5Core Qt5Qml Qt5Gui Qt5Quick Qt5QuickControls2 Qt5Widgets Qt5Svg Qt5Multimedia Qt5WebView)" + NIM_PARAMS += --passL:"$(DOTHERSIDE_LIBFILE)" --passL:"$(shell PKG_CONFIG_PATH="$(QT5_PCFILEDIR)" pkg-config --libs Qt5Core Qt5Qml Qt5Gui Qt5Quick Qt5QuickControls2 Qt5Widgets Qt5Svg Qt5Multimedia Qt5WebView Qt5WebChannel)" else NIM_EXTRA_PARAMS := --passL:"-lsetupapi -lhid" endif diff --git a/ui/app/AppLayouts/Wallet/views/walletconnect/WalletConnect.qml b/ui/app/AppLayouts/Wallet/views/walletconnect/WalletConnect.qml index 6d061acf38..c0591f03e3 100644 --- a/ui/app/AppLayouts/Wallet/views/walletconnect/WalletConnect.qml +++ b/ui/app/AppLayouts/Wallet/views/walletconnect/WalletConnect.qml @@ -17,11 +17,6 @@ Item { property bool sdkReady: state === d.sdkReadyState - function setUriAndPair(wcUri) { - pairLinkInput.text = wcUri - d.sdkView.pair(wcUri) - } - // wallet_connect.Controller \see wallet_section/wallet_connect/controller.nim required property var controller @@ -205,7 +200,6 @@ Item { component SdkViewComponent: WalletConnectSDK { projectId: controller.projectId - backgroundColor: root.backgroundColor onSdkInit: function(success, info) { d.setDetailsText(info) @@ -270,14 +264,13 @@ Item { root.state = d.waitingUserResponseToSessionRequest } - onResponseTimeout: { + onPairSessionProposalExpired: { d.setStatusText(`Timeout waiting for response. Reusing URI?`, "red") } onStatusChanged: function(message) { statusText.text = message } - } QtObject { @@ -326,10 +319,6 @@ Item { root.state = d.waitingPairState } - } - - Connections { - target: root.controller function onRespondSessionRequest(sessionRequestJson, signedJson, error) { console.log("@dd respondSessionRequest", sessionRequestJson, signedJson, error) diff --git a/ui/app/AppLayouts/Wallet/views/walletconnect/WalletConnectSDK.qml b/ui/app/AppLayouts/Wallet/views/walletconnect/WalletConnectSDK.qml index 890ad188aa..f8a41f7981 100644 --- a/ui/app/AppLayouts/Wallet/views/walletconnect/WalletConnectSDK.qml +++ b/ui/app/AppLayouts/Wallet/views/walletconnect/WalletConnectSDK.qml @@ -1,326 +1,338 @@ import QtQuick 2.15 -import QtWebView 1.15 -// TODO #12434: remove debugging WebEngineView code -// import QtWebEngine 1.10 +import QtWebEngine 1.10 +import QtWebChannel 1.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 import StatusQ.Core.Utils 0.1 as SQUtils -// Control used to instantiate and run the the WalletConnect web SDK -// The view is not used to draw anything, but has to be visible to be able to run JS code -// Use the \c backgroundColor property to blend in with the background -// \warning A too smaller height might cause rendering errors -// TODO #12434: remove debugging WebEngineView code -WebView { -//WebEngineView { +Item { id: root + required property string projectId + readonly property alias sdkReady: d.sdkReady + readonly property alias pairingsModel: d.pairingsModel + implicitWidth: 1 implicitHeight: 1 - required property string projectId - required property color backgroundColor - - readonly property alias sdkReady: d.sdkReady - readonly property alias pairingsModel: d.pairingsModel - + signal statusChanged(string message) signal sdkInit(bool success, var result) signal pairSessionProposal(bool success, var sessionProposal) + signal pairSessionProposalExpired() signal pairAcceptedResult(bool success, var sessionType) signal pairRejectedResult(bool success, var result) signal sessionRequestEvent(var sessionRequest) signal sessionRequestUserAnswerResult(bool accept, string error) - signal responseTimeout() - // TODO: proper report - signal statusChanged(string message) - - function pair(pairLink) { - let callStr = d.generateSdkCall("pair", `"${pairLink}"`, RequestCodes.PairSuccess, RequestCodes.PairError) - d.requestSdkAsync(callStr) + function pair(pairLink) + { + wcCalls.pair(pairLink) } - function approvePairSession(sessionProposal, supportedNamespaces) { - let callStr = d.generateSdkCall("approvePairSession", `${JSON.stringify(sessionProposal)}, ${JSON.stringify(supportedNamespaces)}`, RequestCodes.ApprovePairSuccess, RequestCodes.ApprovePairSuccess) - - d.requestSdkAsync(callStr) + function approvePairSession(sessionProposal, supportedNamespaces) + { + wcCalls.approvePairSession(sessionProposal, supportedNamespaces) } - function rejectPairSession(id) { - let callStr = d.generateSdkCall("rejectPairSession", id, RequestCodes.RejectPairSuccess, RequestCodes.RejectPairError) - - d.requestSdkAsync(callStr) + function rejectPairSession(id) + { + wcCalls.rejectPairSession(id) } function acceptSessionRequest(topic, id, signature) { - let callStr = d.generateSdkCall("respondSessionRequest", `"${topic}", ${id}, "${signature}"`, RequestCodes.AcceptSessionSuccess, RequestCodes.AcceptSessionError) - - d.requestSdkAsync(callStr) + wcCalls.acceptSessionRequest(topic, id, signature) } function rejectSessionRequest(topic, id, error) { - let callStr = d.generateSdkCall("rejectSessionRequest", `"${topic}", ${id}, ${error}`, RequestCodes.RejectSessionSuccess, RequestCodes.RejectSessionError) - - d.requestSdkAsync(callStr) - } - - // TODO #12434: remove debugging WebEngineView code - onLoadingChanged: function(loadRequest) { - console.debug(`@dd WalletConnectSDK.onLoadingChanged; status: ${loadRequest.status}; error: ${loadRequest.errorString}`) - switch(loadRequest.status) { - case WebView.LoadSucceededStatus: - // case WebEngineView.LoadSucceededStatus: - d.init(root.projectId) - break - case WebView.LoadFailedStatus: - // case WebEngineView.LoadFailedStatus: - root.statusChanged(`Failed loading SDK JS code; error: "${loadRequest.errorString}"`) - break - case WebView.LoadStartedStatus: - // case WebEngineView.LoadStartedStatus: - root.statusChanged(`Loading SDK JS code`) - break - } - } - - Component.onCompleted: { - console.debug(`@dd WalletConnectSDK onCompleted`) - var scriptSrc = SQUtils.StringUtils.readTextFile(":/app/AppLayouts/Wallet/views/walletconnect/sdk/generated/bundle.js") - // Load bundle from disk if not found in resources (Storybook) - if (scriptSrc === "") { - scriptSrc = SQUtils.StringUtils.readTextFile("./AppLayouts/Wallet/views/walletconnect/sdk/generated/bundle.js") - if (scriptSrc === "") { - console.error("Failed to read WalletConnect SDK bundle") - return - } - } - - let htmlSrc = `` - - console.debug(`@dd WalletConnectSDK.loadHtml; htmlSrc len: ${htmlSrc.length}`) - root.loadHtml(htmlSrc, "https://status.app") - } - - Timer { - id: timer - - interval: 100 - repeat: true - running: false - triggeredOnStart: true - - property int errorCount: 0 - - onTriggered: { - root.runJavaScript( - "wcResult", - function(wcResult) { - if (!wcResult) { - return - } - - let done = false - if (wcResult.error) { - console.debug(`WC JS error response - ${JSON.stringify(wcResult)}`) - done = true - if (!d.sdkReady) { - root.statusChanged(`[${timer.errorCount++}] Failed SDK init; error: ${wcResult.error}`) - } else { - root.statusChanged(`[${timer.errorCount++}] Operation error: ${wcResult.error}`) - } - } - - if (wcResult.state !== undefined) { - switch (wcResult.state) { - case RequestCodes.SdkInitSuccess: - d.sdkReady = true - root.sdkInit(true, "") - d.startListeningForEvents() - break - case RequestCodes.SdkInitError: - d.sdkReady = false - root.sdkInit(false, wcResult.error) - break - case RequestCodes.PairSuccess: - root.pairSessionProposal(true, wcResult.result) - d.getPairings() - break - case RequestCodes.PairError: - root.pairSessionProposal(false, wcResult.error) - break - case RequestCodes.ApprovePairSuccess: - root.pairAcceptedResult(true, "") - d.getPairings() - break - case RequestCodes.ApprovePairError: - root.pairAcceptedResult(false, wcResult.error) - d.getPairings() - break - case RequestCodes.RejectPairSuccess: - root.pairRejectedResult(true, "") - break - case RequestCodes.RejectPairError: - root.pairRejectedResult(false, wcResult.error) - break - case RequestCodes.AcceptSessionSuccess: - root.sessionRequestUserAnswerResult(true, "") - break - case RequestCodes.AcceptSessionError: - root.sessionRequestUserAnswerResult(true, wcResult.error) - break - case RequestCodes.RejectSessionSuccess: - root.sessionRequestUserAnswerResult(false, "") - break - case RequestCodes.RejectSessionError: - root.sessionRequestUserAnswerResult(false, wcResult.error) - break - case RequestCodes.GetPairings: - d.populatePairingsModel(wcResult.result) - break - case RequestCodes.GetPairingsError: - console.error(`WalletConnectSDK - getPairings error: ${wcResult.error}`) - break - default: { - root.statusChanged(`[${timer.errorCount++}] Unknown state: ${wcResult.state}`) - } - } - - done = true - } - - if (done) { - timer.stop() - } - } - ) - } - } - - Timer { - id: responseTimeoutTimer - - interval: 10000 - repeat: false - running: timer.running - - onTriggered: { - timer.stop() - root.responseTimeout() - } - } - - Timer { - id: eventsTimer - - interval: 100 - repeat: true - running: false - - onTriggered: { - root.runJavaScript("window.wcEventResult ? window.wcEventResult.shift() : null", function(event) { - if (event) { - switch(event.name) { - case "session_request": - root.sessionRequestEvent(event.payload) - break - default: - console.error("WC unknown event type: ", event.type) - break - } - } - }) - } + wcCalls.rejectSessionRequest(topic, id, error) } QtObject { id: d - property var sessionProposal: null - property var sessionType: null property bool sdkReady: false - property ListModel pairingsModel: pairings onSdkReadyChanged: { - if (sdkReady) { - d.getPairings() + if (sdkReady) + { + d.resetPairingsModel() } } - function populatePairingsModel(pairList) { + function resetPairingsModel() + { pairings.clear(); - for (let i = 0; i < pairList.length; i++) { - pairings.append({ - active: pairList[i].active, - topic: pairList[i].topic, - expiry: pairList[i].expiry - }); + + wcCalls.getPairings((pairList) => { + for (let i = 0; i < pairList.length; i++) { + pairings.append({ + active: pairList[i].active, + topic: pairList[i].topic, + expiry: pairList[i].expiry + }); + } + }) + } + + function getPairingTopicFromPairingUrl(url) + { + if (!url.startsWith("wc:")) + { + return null; } + const atIndex = url.indexOf("@"); + if (atIndex < 0) + { + return null; + } + return url.slice(3, atIndex); } + } + QtObject { + id: wcCalls - function isWaitingForSdk() { - return timer.running - } + function init() { + console.debug(`@dd WalletConnectSDK.wcCall.init; root.projectId: ${root.projectId}`) - function generateSdkCall(methodName, paramsStr, successState, errorState) { - return "wcResult = {}; try { wc." + methodName + "(" + paramsStr + ").then((callRes) => { wcResult = {state: " + successState + ", error: null, result: callRes}; }).catch((error) => { wcResult = {state: " + errorState + ", error: error}; }); } catch (e) { wcResult = {state: " + errorState + ", error: \"Exception: \" + e.message}; }; wcResult" - } - function requestSdkAsync(jsCode) { - root.runJavaScript(jsCode, - function(result) { - timer.restart() + webEngineView.runJavaScript(`wc.init("${root.projectId}")`, function(result) { + + console.debug(`@dd WalletConnectSDK.wcCall.init; response: ${JSON.stringify(result, null, 2)}`) + + if (result && !!result.error) + { + console.error("init: ", result.error) } - ) + }) } - function requestSdk(methodName, paramsStr, successState, errorState) { - const jsCode = "wcResult = {}; try { const callRes = wc." + methodName + "(" + (paramsStr ? (paramsStr) : "") + "); wcResult = {state: " + successState + ", error: null, result: callRes}; } catch (e) { wcResult = {state: " + errorState + ", error: \"Exception: \" + e.message}; }; wcResult" - root.runJavaScript(jsCode, - function(result) { - timer.restart() - } - ) - } + function getPairings(callback) { + console.debug(`@dd WalletConnectSDK.wcCall.getPairings;`) - function startListeningForEvents() { - const jsCode = " - try { - function processWCEvents() { - window.wcEventResult = []; - window.wcEventError = null - window.wc.registerForSessionRequest((event) => { - window.wcEventResult.push({name: 'session_request', payload: event}); - }); - } - processWCEvents(); - } catch (e) { - window.wcEventError = e - } - window.wcEventError" + webEngineView.runJavaScript(`wc.getPairings()`, function(result) { - root.runJavaScript(jsCode, - function(result) { - if (result) { - console.error("startListeningForEvents: processWCEvents error", result) + console.debug(`@dd WalletConnectSDK.wcCall.getPairings; response: ${JSON.stringify(result, null, 2)}`) + + if (result) + { + if (!!result.error) { + console.error("getPairings: ", result.error) return } + + callback(result.result) + return } - ) - eventsTimer.start() + }) } - function init(projectId) { - d.requestSdkAsync(generateSdkCall("init", `"${projectId}"`, RequestCodes.SdkInitSuccess, RequestCodes.SdkInitError)) + function pair(pairLink) { + console.debug(`@dd WalletConnectSDK.wcCall.pair; pairLink: ${pairLink}`) + + wcCalls.getPairings((allPairings) => { + + console.debug(`@dd WalletConnectSDK.wcCall.pair; response: ${JSON.stringify(allPairings, null, 2)}`) + + let pairingTopic = d.getPairingTopicFromPairingUrl(pairLink); + + // Find pairing by topic + const pairing = allPairings.find((p) => p.topic === pairingTopic); + if (pairing) + { + if (pairing.active) { + console.warn("pair: already paired") + return + } + } + + webEngineView.runJavaScript(`wc.pair("${pairLink}")`, function(result) { + if (result && !!result.error) + { + console.error("pair: ", result.error) + } + }) + } + ) } - function getPairings(projectId) { - d.requestSdk("getPairings", `null`, RequestCodes.GetPairings, RequestCodes.GetPairingsError) + function approvePairSession(sessionProposal, supportedNamespaces) { + console.debug(`@dd WalletConnectSDK.wcCall.approvePairSession; sessionProposal: ${JSON.stringify(sessionProposal)}, supportedNamespaces: ${JSON.stringify(supportedNamespaces)}`) + + webEngineView.runJavaScript(`wc.approvePairSession(${JSON.stringify(sessionProposal)}, ${JSON.stringify(supportedNamespaces)})`, function(result) { + + console.debug(`@dd WalletConnectSDK.wcCall.approvePairSession; response: ${JSON.stringify(result, null, 2)}`) + + if (result) { + if (!!result.error) + { + console.error("approvePairSession: ", result.error) + root.pairAcceptedResult(false, result.error) + return + } + root.pairAcceptedResult(true, result.error) + } + d.resetPairingsModel() + }) + } + + function rejectPairSession(id) { + console.debug(`@dd WalletConnectSDK.wcCall.rejectPairSession; id: ${id}`) + + webEngineView.runJavaScript(`wc.rejectPairSession(${id})`, function(result) { + + console.debug(`@dd WalletConnectSDK.wcCall.rejectPairSession; response: ${JSON.stringify(result, null, 2)}`) + + if (result) { + if (!!result.error) + { + console.error("rejectPairSession: ", result.error) + root.pairRejectedResult(false, result.error) + return + } + root.pairRejectedResult(true, result.error) + } + d.resetPairingsModel() + }) + } + + function acceptSessionRequest(topic, id, signature) { + console.debug(`@dd WalletConnectSDK.wcCall.acceptSessionRequest; topic: "${topic}", id: ${id}, signature: "${signature}"`) + + webEngineView.runJavaScript(`wc.respondSessionRequest("${topic}", ${id}, "${signature}")`, function(result) { + + console.debug(`@dd WalletConnectSDK.wcCall.acceptSessionRequest; response: ${JSON.stringify(allPairings, null, 2)}`) + + if (result) { + if (!!result.error) + { + console.error("respondSessionRequest: ", result.error) + root.sessionRequestUserAnswerResult(true, result.error) + return + } + root.sessionRequestUserAnswerResult(true, result.error) + } + d.resetPairingsModel() + }) + } + + function rejectSessionRequest(topic, id, error) { + console.debug(`@dd WalletConnectSDK.wcCall.rejectSessionRequest; topic: "${topic}", id: ${id}, error: "${error}"`) + + webEngineView.runJavaScript(`wc.rejectSessionRequest("${topic}", ${id}, "${error}")`, function(result) { + + console.debug(`@dd WalletConnectSDK.wcCall.rejectSessionRequest; response: ${JSON.stringify(result, null, 2)}`) + + if (result) { + if (!!result.error) + { + console.error("rejectSessionRequest: ", result.error) + root.sessionRequestUserAnswerResult(false, result.error) + return + } + root.sessionRequestUserAnswerResult(false, result.error) + } + d.resetPairingsModel() + }) + } + } + + QtObject { + id: statusObject + + WebChannel.id: "statusObject" + + function sdkInitialized(error) + { + d.sdkReady = !error + root.sdkInit(d.sdkReady, error) + } + + function onSessionProposal(details) + { + console.debug(`@dd WalletConnectSDK.onSessionProposal; details: ${JSON.stringify(details, null, 2)}`) + root.pairSessionProposal(true, details) + } + + function onSessionUpdate(details) + { + console.debug(`@dd TODO WalletConnectSDK.onSessionUpdate; details: ${JSON.stringify(details, null, 2)}`) + } + + function onSessionExtend(details) + { + console.debug(`@dd TODO WalletConnectSDK.onSessionExtend; details: ${JSON.stringify(details, null, 2)}`) + } + + function onSessionPing(details) + { + console.debug(`@dd TODO WalletConnectSDK.onSessionPing; details: ${JSON.stringify(details, null, 2)}`) + } + + function onSessionDelete(details) + { + console.debug(`@dd TODO WalletConnectSDK.onSessionDelete; details: ${JSON.stringify(details, null, 2)}`) + } + + function onSessionExpire(details) + { + console.debug(`@dd TODO WalletConnectSDK.onSessionExpire; details: ${JSON.stringify(details, null, 2)}`) + } + + function onSessionRequest(details) + { + console.debug(`@dd WalletConnectSDK.onSessionRequest; details: ${JSON.stringify(details, null, 2)}`) + root.sessionRequestEvent(details) + } + + function onSessionRequestSent(details) + { + console.debug(`@dd TODO WalletConnectSDK.onSessionRequestSent; details: ${JSON.stringify(details, null, 2)}`) + } + + function onSessionEvent(details) + { + console.debug(`@dd TODO WalletConnectSDK.onSessionEvent; details: ${JSON.stringify(details, null, 2)}`) + } + + function onProposalExpire(details) + { + console.debug(`@dd WalletConnectSDK.onProposalExpire; details: ${JSON.stringify(details, null, 2)}`) + root.pairSessionProposalExpired() } } ListModel { id: pairings } -} \ No newline at end of file + + WebChannel { + id: statusChannel + registeredObjects: [statusObject] + } + + WebEngineView { + id: webEngineView + + anchors.fill: parent + + url: "qrc:/app/AppLayouts/Wallet/views/walletconnect/sdk/src/index.html" + webChannel: statusChannel + + onLoadingChanged: function(loadRequest) { + console.debug(`@dd WalletConnectSDK.onLoadingChanged; status: ${loadRequest.status}; error: ${loadRequest.errorString}`) + switch(loadRequest.status) { + case WebEngineView.LoadSucceededStatus: + wcCalls.init() + break + case WebEngineView.LoadFailedStatus: + root.statusChanged(`Failed loading SDK JS code; error: "${loadRequest.errorString}"`) + break + case WebEngineView.LoadStartedStatus: + root.statusChanged(`Loading SDK JS code`) + break + } + } + } +} diff --git a/ui/app/AppLayouts/Wallet/views/walletconnect/sdk/generated/bundle.js b/ui/app/AppLayouts/Wallet/views/walletconnect/sdk/generated/bundle.js index 599812663d..aaf61e8874 100644 --- a/ui/app/AppLayouts/Wallet/views/walletconnect/sdk/generated/bundle.js +++ b/ui/app/AppLayouts/Wallet/views/walletconnect/sdk/generated/bundle.js @@ -1,1873 +1,2 @@ -/* - * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). - * This devtool is neither made for production nor for readable output files. - * It uses "eval()" calls to create a separate source file in the browser devtools. - * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) - * or disable the default devtool with "devtool: false". - * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). - */ -/******/ var __webpack_modules__ = ({ - -/***/ "./node_modules/@ethersproject/address/lib.esm/_version.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@ethersproject/address/lib.esm/_version.js ***! - \*****************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ version: () => (/* binding */ version)\n/* harmony export */ });\nconst version = \"address/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@ethersproject/address/lib.esm/_version.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/address/lib.esm/index.js": -/*!**************************************************************!*\ - !*** ./node_modules/@ethersproject/address/lib.esm/index.js ***! - \**************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getAddress: () => (/* binding */ getAddress),\n/* harmony export */ getContractAddress: () => (/* binding */ getContractAddress),\n/* harmony export */ getCreate2Address: () => (/* binding */ getCreate2Address),\n/* harmony export */ getIcapAddress: () => (/* binding */ getIcapAddress),\n/* harmony export */ isAddress: () => (/* binding */ isAddress)\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/bignumber */ \"./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js\");\n/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/keccak256 */ \"./node_modules/@ethersproject/keccak256/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/rlp */ \"./node_modules/@ethersproject/rlp/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/address/lib.esm/_version.js\");\n\n\n\n\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\nfunction getChecksumAddress(address) {\n if (!(0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.isHexString)(address, 20)) {\n logger.throwArgumentError(\"invalid address\", \"address\", address);\n }\n address = address.toLowerCase();\n const chars = address.substring(2).split(\"\");\n const expanded = new Uint8Array(40);\n for (let i = 0; i < 40; i++) {\n expanded[i] = chars[i].charCodeAt(0);\n }\n const hashed = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)((0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__.keccak256)(expanded));\n for (let i = 0; i < 40; i += 2) {\n if ((hashed[i >> 1] >> 4) >= 8) {\n chars[i] = chars[i].toUpperCase();\n }\n if ((hashed[i >> 1] & 0x0f) >= 8) {\n chars[i + 1] = chars[i + 1].toUpperCase();\n }\n }\n return \"0x\" + chars.join(\"\");\n}\n// Shims for environments that are missing some required constants and functions\nconst MAX_SAFE_INTEGER = 0x1fffffffffffff;\nfunction log10(x) {\n if (Math.log10) {\n return Math.log10(x);\n }\n return Math.log(x) / Math.LN10;\n}\n// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number\n// Create lookup table\nconst ibanLookup = {};\nfor (let i = 0; i < 10; i++) {\n ibanLookup[String(i)] = String(i);\n}\nfor (let i = 0; i < 26; i++) {\n ibanLookup[String.fromCharCode(65 + i)] = String(10 + i);\n}\n// How many decimal digits can we process? (for 64-bit float, this is 15)\nconst safeDigits = Math.floor(log10(MAX_SAFE_INTEGER));\nfunction ibanChecksum(address) {\n address = address.toUpperCase();\n address = address.substring(4) + address.substring(0, 2) + \"00\";\n let expanded = address.split(\"\").map((c) => { return ibanLookup[c]; }).join(\"\");\n // Javascript can handle integers safely up to 15 (decimal) digits\n while (expanded.length >= safeDigits) {\n let block = expanded.substring(0, safeDigits);\n expanded = parseInt(block, 10) % 97 + expanded.substring(block.length);\n }\n let checksum = String(98 - (parseInt(expanded, 10) % 97));\n while (checksum.length < 2) {\n checksum = \"0\" + checksum;\n }\n return checksum;\n}\n;\nfunction getAddress(address) {\n let result = null;\n if (typeof (address) !== \"string\") {\n logger.throwArgumentError(\"invalid address\", \"address\", address);\n }\n if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {\n // Missing the 0x prefix\n if (address.substring(0, 2) !== \"0x\") {\n address = \"0x\" + address;\n }\n result = getChecksumAddress(address);\n // It is a checksummed address with a bad checksum\n if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) {\n logger.throwArgumentError(\"bad address checksum\", \"address\", address);\n }\n // Maybe ICAP? (we only support direct mode)\n }\n else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {\n // It is an ICAP address with a bad checksum\n if (address.substring(2, 4) !== ibanChecksum(address)) {\n logger.throwArgumentError(\"bad icap checksum\", \"address\", address);\n }\n result = (0,_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__._base36To16)(address.substring(4));\n while (result.length < 40) {\n result = \"0\" + result;\n }\n result = getChecksumAddress(\"0x\" + result);\n }\n else {\n logger.throwArgumentError(\"invalid address\", \"address\", address);\n }\n return result;\n}\nfunction isAddress(address) {\n try {\n getAddress(address);\n return true;\n }\n catch (error) { }\n return false;\n}\nfunction getIcapAddress(address) {\n let base36 = (0,_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__._base16To36)(getAddress(address).substring(2)).toUpperCase();\n while (base36.length < 30) {\n base36 = \"0\" + base36;\n }\n return \"XE\" + ibanChecksum(\"XE00\" + base36) + base36;\n}\n// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed\nfunction getContractAddress(transaction) {\n let from = null;\n try {\n from = getAddress(transaction.from);\n }\n catch (error) {\n logger.throwArgumentError(\"missing from address\", \"transaction\", transaction);\n }\n const nonce = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.stripZeros)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__.BigNumber.from(transaction.nonce).toHexString()));\n return getAddress((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexDataSlice)((0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__.keccak256)((0,_ethersproject_rlp__WEBPACK_IMPORTED_MODULE_5__.encode)([from, nonce])), 12));\n}\nfunction getCreate2Address(from, salt, initCodeHash) {\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexDataLength)(salt) !== 32) {\n logger.throwArgumentError(\"salt must be 32 bytes\", \"salt\", salt);\n }\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexDataLength)(initCodeHash) !== 32) {\n logger.throwArgumentError(\"initCodeHash must be 32 bytes\", \"initCodeHash\", initCodeHash);\n }\n return getAddress((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexDataSlice)((0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__.keccak256)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.concat)([\"0xff\", getAddress(from), salt, initCodeHash])), 12));\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@ethersproject/address/lib.esm/index.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/bignumber/lib.esm/_version.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@ethersproject/bignumber/lib.esm/_version.js ***! - \*******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ version: () => (/* binding */ version)\n/* harmony export */ });\nconst version = \"bignumber/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@ethersproject/bignumber/lib.esm/_version.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js": -/*!********************************************************************!*\ - !*** ./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js ***! - \********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BigNumber: () => (/* binding */ BigNumber),\n/* harmony export */ _base16To36: () => (/* binding */ _base16To36),\n/* harmony export */ _base36To16: () => (/* binding */ _base36To16),\n/* harmony export */ isBigNumberish: () => (/* binding */ isBigNumberish)\n/* harmony export */ });\n/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\");\n/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(bn_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/bignumber/lib.esm/_version.js\");\n\n/**\n * BigNumber\n *\n * A wrapper around the BN.js object. We use the BN.js library\n * because it is used by elliptic, so it is required regardless.\n *\n */\n\nvar BN = (bn_js__WEBPACK_IMPORTED_MODULE_0___default().BN);\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger(_version__WEBPACK_IMPORTED_MODULE_2__.version);\nconst _constructorGuard = {};\nconst MAX_SAFE = 0x1fffffffffffff;\nfunction isBigNumberish(value) {\n return (value != null) && (BigNumber.isBigNumber(value) ||\n (typeof (value) === \"number\" && (value % 1) === 0) ||\n (typeof (value) === \"string\" && !!value.match(/^-?[0-9]+$/)) ||\n (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(value) ||\n (typeof (value) === \"bigint\") ||\n (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isBytes)(value));\n}\n// Only warn about passing 10 into radix once\nlet _warnedToStringRadix = false;\nclass BigNumber {\n constructor(constructorGuard, hex) {\n if (constructorGuard !== _constructorGuard) {\n logger.throwError(\"cannot call constructor directly; use BigNumber.from\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"new (BigNumber)\"\n });\n }\n this._hex = hex;\n this._isBigNumber = true;\n Object.freeze(this);\n }\n fromTwos(value) {\n return toBigNumber(toBN(this).fromTwos(value));\n }\n toTwos(value) {\n return toBigNumber(toBN(this).toTwos(value));\n }\n abs() {\n if (this._hex[0] === \"-\") {\n return BigNumber.from(this._hex.substring(1));\n }\n return this;\n }\n add(other) {\n return toBigNumber(toBN(this).add(toBN(other)));\n }\n sub(other) {\n return toBigNumber(toBN(this).sub(toBN(other)));\n }\n div(other) {\n const o = BigNumber.from(other);\n if (o.isZero()) {\n throwFault(\"division-by-zero\", \"div\");\n }\n return toBigNumber(toBN(this).div(toBN(other)));\n }\n mul(other) {\n return toBigNumber(toBN(this).mul(toBN(other)));\n }\n mod(other) {\n const value = toBN(other);\n if (value.isNeg()) {\n throwFault(\"division-by-zero\", \"mod\");\n }\n return toBigNumber(toBN(this).umod(value));\n }\n pow(other) {\n const value = toBN(other);\n if (value.isNeg()) {\n throwFault(\"negative-power\", \"pow\");\n }\n return toBigNumber(toBN(this).pow(value));\n }\n and(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"unbound-bitwise-result\", \"and\");\n }\n return toBigNumber(toBN(this).and(value));\n }\n or(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"unbound-bitwise-result\", \"or\");\n }\n return toBigNumber(toBN(this).or(value));\n }\n xor(other) {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"unbound-bitwise-result\", \"xor\");\n }\n return toBigNumber(toBN(this).xor(value));\n }\n mask(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"negative-width\", \"mask\");\n }\n return toBigNumber(toBN(this).maskn(value));\n }\n shl(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"negative-width\", \"shl\");\n }\n return toBigNumber(toBN(this).shln(value));\n }\n shr(value) {\n if (this.isNegative() || value < 0) {\n throwFault(\"negative-width\", \"shr\");\n }\n return toBigNumber(toBN(this).shrn(value));\n }\n eq(other) {\n return toBN(this).eq(toBN(other));\n }\n lt(other) {\n return toBN(this).lt(toBN(other));\n }\n lte(other) {\n return toBN(this).lte(toBN(other));\n }\n gt(other) {\n return toBN(this).gt(toBN(other));\n }\n gte(other) {\n return toBN(this).gte(toBN(other));\n }\n isNegative() {\n return (this._hex[0] === \"-\");\n }\n isZero() {\n return toBN(this).isZero();\n }\n toNumber() {\n try {\n return toBN(this).toNumber();\n }\n catch (error) {\n throwFault(\"overflow\", \"toNumber\", this.toString());\n }\n return null;\n }\n toBigInt() {\n try {\n return BigInt(this.toString());\n }\n catch (e) { }\n return logger.throwError(\"this platform does not support BigInt\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, {\n value: this.toString()\n });\n }\n toString() {\n // Lots of people expect this, which we do not support, so check (See: #889)\n if (arguments.length > 0) {\n if (arguments[0] === 10) {\n if (!_warnedToStringRadix) {\n _warnedToStringRadix = true;\n logger.warn(\"BigNumber.toString does not accept any parameters; base-10 is assumed\");\n }\n }\n else if (arguments[0] === 16) {\n logger.throwError(\"BigNumber.toString does not accept any parameters; use bigNumber.toHexString()\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNEXPECTED_ARGUMENT, {});\n }\n else {\n logger.throwError(\"BigNumber.toString does not accept parameters\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNEXPECTED_ARGUMENT, {});\n }\n }\n return toBN(this).toString(10);\n }\n toHexString() {\n return this._hex;\n }\n toJSON(key) {\n return { type: \"BigNumber\", hex: this.toHexString() };\n }\n static from(value) {\n if (value instanceof BigNumber) {\n return value;\n }\n if (typeof (value) === \"string\") {\n if (value.match(/^-?0x[0-9a-f]+$/i)) {\n return new BigNumber(_constructorGuard, toHex(value));\n }\n if (value.match(/^-?[0-9]+$/)) {\n return new BigNumber(_constructorGuard, toHex(new BN(value)));\n }\n return logger.throwArgumentError(\"invalid BigNumber string\", \"value\", value);\n }\n if (typeof (value) === \"number\") {\n if (value % 1) {\n throwFault(\"underflow\", \"BigNumber.from\", value);\n }\n if (value >= MAX_SAFE || value <= -MAX_SAFE) {\n throwFault(\"overflow\", \"BigNumber.from\", value);\n }\n return BigNumber.from(String(value));\n }\n const anyValue = value;\n if (typeof (anyValue) === \"bigint\") {\n return BigNumber.from(anyValue.toString());\n }\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isBytes)(anyValue)) {\n return BigNumber.from((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexlify)(anyValue));\n }\n if (anyValue) {\n // Hexable interface (takes priority)\n if (anyValue.toHexString) {\n const hex = anyValue.toHexString();\n if (typeof (hex) === \"string\") {\n return BigNumber.from(hex);\n }\n }\n else {\n // For now, handle legacy JSON-ified values (goes away in v6)\n let hex = anyValue._hex;\n // New-form JSON\n if (hex == null && anyValue.type === \"BigNumber\") {\n hex = anyValue.hex;\n }\n if (typeof (hex) === \"string\") {\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(hex) || (hex[0] === \"-\" && (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(hex.substring(1)))) {\n return BigNumber.from(hex);\n }\n }\n }\n }\n return logger.throwArgumentError(\"invalid BigNumber value\", \"value\", value);\n }\n static isBigNumber(value) {\n return !!(value && value._isBigNumber);\n }\n}\n// Normalize the hex string\nfunction toHex(value) {\n // For BN, call on the hex string\n if (typeof (value) !== \"string\") {\n return toHex(value.toString(16));\n }\n // If negative, prepend the negative sign to the normalized positive value\n if (value[0] === \"-\") {\n // Strip off the negative sign\n value = value.substring(1);\n // Cannot have multiple negative signs (e.g. \"--0x04\")\n if (value[0] === \"-\") {\n logger.throwArgumentError(\"invalid hex\", \"value\", value);\n }\n // Call toHex on the positive component\n value = toHex(value);\n // Do not allow \"-0x00\"\n if (value === \"0x00\") {\n return value;\n }\n // Negate the value\n return \"-\" + value;\n }\n // Add a \"0x\" prefix if missing\n if (value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n // Normalize zero\n if (value === \"0x\") {\n return \"0x00\";\n }\n // Make the string even length\n if (value.length % 2) {\n value = \"0x0\" + value.substring(2);\n }\n // Trim to smallest even-length string\n while (value.length > 4 && value.substring(0, 4) === \"0x00\") {\n value = \"0x\" + value.substring(4);\n }\n return value;\n}\nfunction toBigNumber(value) {\n return BigNumber.from(toHex(value));\n}\nfunction toBN(value) {\n const hex = BigNumber.from(value).toHexString();\n if (hex[0] === \"-\") {\n return (new BN(\"-\" + hex.substring(3), 16));\n }\n return new BN(hex.substring(2), 16);\n}\nfunction throwFault(fault, operation, value) {\n const params = { fault: fault, operation: operation };\n if (value != null) {\n params.value = value;\n }\n return logger.throwError(fault, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.NUMERIC_FAULT, params);\n}\n// value should have no prefix\nfunction _base36To16(value) {\n return (new BN(value, 36)).toString(16);\n}\n// value should have no prefix\nfunction _base16To36(value) {\n return (new BN(value, 16)).toString(36);\n}\n//# sourceMappingURL=bignumber.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/bytes/lib.esm/_version.js": -/*!***************************************************************!*\ - !*** ./node_modules/@ethersproject/bytes/lib.esm/_version.js ***! - \***************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ version: () => (/* binding */ version)\n/* harmony export */ });\nconst version = \"bytes/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@ethersproject/bytes/lib.esm/_version.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/bytes/lib.esm/index.js": -/*!************************************************************!*\ - !*** ./node_modules/@ethersproject/bytes/lib.esm/index.js ***! - \************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ arrayify: () => (/* binding */ arrayify),\n/* harmony export */ concat: () => (/* binding */ concat),\n/* harmony export */ hexConcat: () => (/* binding */ hexConcat),\n/* harmony export */ hexDataLength: () => (/* binding */ hexDataLength),\n/* harmony export */ hexDataSlice: () => (/* binding */ hexDataSlice),\n/* harmony export */ hexStripZeros: () => (/* binding */ hexStripZeros),\n/* harmony export */ hexValue: () => (/* binding */ hexValue),\n/* harmony export */ hexZeroPad: () => (/* binding */ hexZeroPad),\n/* harmony export */ hexlify: () => (/* binding */ hexlify),\n/* harmony export */ isBytes: () => (/* binding */ isBytes),\n/* harmony export */ isBytesLike: () => (/* binding */ isBytesLike),\n/* harmony export */ isHexString: () => (/* binding */ isHexString),\n/* harmony export */ joinSignature: () => (/* binding */ joinSignature),\n/* harmony export */ splitSignature: () => (/* binding */ splitSignature),\n/* harmony export */ stripZeros: () => (/* binding */ stripZeros),\n/* harmony export */ zeroPad: () => (/* binding */ zeroPad)\n/* harmony export */ });\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/bytes/lib.esm/_version.js\");\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\n///////////////////////////////\nfunction isHexable(value) {\n return !!(value.toHexString);\n}\nfunction addSlice(array) {\n if (array.slice) {\n return array;\n }\n array.slice = function () {\n const args = Array.prototype.slice.call(arguments);\n return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));\n };\n return array;\n}\nfunction isBytesLike(value) {\n return ((isHexString(value) && !(value.length % 2)) || isBytes(value));\n}\nfunction isInteger(value) {\n return (typeof (value) === \"number\" && value == value && (value % 1) === 0);\n}\nfunction isBytes(value) {\n if (value == null) {\n return false;\n }\n if (value.constructor === Uint8Array) {\n return true;\n }\n if (typeof (value) === \"string\") {\n return false;\n }\n if (!isInteger(value.length) || value.length < 0) {\n return false;\n }\n for (let i = 0; i < value.length; i++) {\n const v = value[i];\n if (!isInteger(v) || v < 0 || v >= 256) {\n return false;\n }\n }\n return true;\n}\nfunction arrayify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid arrayify value\");\n const result = [];\n while (value) {\n result.unshift(value & 0xff);\n value = parseInt(String(value / 256));\n }\n if (result.length === 0) {\n result.push(0);\n }\n return addSlice(new Uint8Array(result));\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n value = value.toHexString();\n }\n if (isHexString(value)) {\n let hex = value.substring(2);\n if (hex.length % 2) {\n if (options.hexPad === \"left\") {\n hex = \"0\" + hex;\n }\n else if (options.hexPad === \"right\") {\n hex += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n const result = [];\n for (let i = 0; i < hex.length; i += 2) {\n result.push(parseInt(hex.substring(i, i + 2), 16));\n }\n return addSlice(new Uint8Array(result));\n }\n if (isBytes(value)) {\n return addSlice(new Uint8Array(value));\n }\n return logger.throwArgumentError(\"invalid arrayify value\", \"value\", value);\n}\nfunction concat(items) {\n const objects = items.map(item => arrayify(item));\n const length = objects.reduce((accum, item) => (accum + item.length), 0);\n const result = new Uint8Array(length);\n objects.reduce((offset, object) => {\n result.set(object, offset);\n return offset + object.length;\n }, 0);\n return addSlice(result);\n}\nfunction stripZeros(value) {\n let result = arrayify(value);\n if (result.length === 0) {\n return result;\n }\n // Find the first non-zero entry\n let start = 0;\n while (start < result.length && result[start] === 0) {\n start++;\n }\n // If we started with zeros, strip them\n if (start) {\n result = result.slice(start);\n }\n return result;\n}\nfunction zeroPad(value, length) {\n value = arrayify(value);\n if (value.length > length) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[0]);\n }\n const result = new Uint8Array(length);\n result.set(value, length - value.length);\n return addSlice(result);\n}\nfunction isHexString(value, length) {\n if (typeof (value) !== \"string\" || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false;\n }\n if (length && value.length !== 2 + 2 * length) {\n return false;\n }\n return true;\n}\nconst HexCharacters = \"0123456789abcdef\";\nfunction hexlify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid hexlify value\");\n let hex = \"\";\n while (value) {\n hex = HexCharacters[value & 0xf] + hex;\n value = Math.floor(value / 16);\n }\n if (hex.length) {\n if (hex.length % 2) {\n hex = \"0\" + hex;\n }\n return \"0x\" + hex;\n }\n return \"0x00\";\n }\n if (typeof (value) === \"bigint\") {\n value = value.toString(16);\n if (value.length % 2) {\n return (\"0x0\" + value);\n }\n return \"0x\" + value;\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n return value.toHexString();\n }\n if (isHexString(value)) {\n if (value.length % 2) {\n if (options.hexPad === \"left\") {\n value = \"0x0\" + value.substring(2);\n }\n else if (options.hexPad === \"right\") {\n value += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n return value.toLowerCase();\n }\n if (isBytes(value)) {\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n let v = value[i];\n result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];\n }\n return result;\n }\n return logger.throwArgumentError(\"invalid hexlify value\", \"value\", value);\n}\n/*\nfunction unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number {\n if (typeof(value) === \"string\" && value.length % 2 && value.substring(0, 2) === \"0x\") {\n return \"0x0\" + value.substring(2);\n }\n return value;\n}\n*/\nfunction hexDataLength(data) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n return null;\n }\n return (data.length - 2) / 2;\n}\nfunction hexDataSlice(data, offset, endOffset) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n logger.throwArgumentError(\"invalid hexData\", \"value\", data);\n }\n offset = 2 + 2 * offset;\n if (endOffset != null) {\n return \"0x\" + data.substring(offset, 2 + 2 * endOffset);\n }\n return \"0x\" + data.substring(offset);\n}\nfunction hexConcat(items) {\n let result = \"0x\";\n items.forEach((item) => {\n result += hexlify(item).substring(2);\n });\n return result;\n}\nfunction hexValue(value) {\n const trimmed = hexStripZeros(hexlify(value, { hexPad: \"left\" }));\n if (trimmed === \"0x\") {\n return \"0x0\";\n }\n return trimmed;\n}\nfunction hexStripZeros(value) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n value = value.substring(2);\n let offset = 0;\n while (offset < value.length && value[offset] === \"0\") {\n offset++;\n }\n return \"0x\" + value.substring(offset);\n}\nfunction hexZeroPad(value, length) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n else if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n if (value.length > 2 * length + 2) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[1]);\n }\n while (value.length < 2 * length + 2) {\n value = \"0x0\" + value.substring(2);\n }\n return value;\n}\nfunction splitSignature(signature) {\n const result = {\n r: \"0x\",\n s: \"0x\",\n _vs: \"0x\",\n recoveryParam: 0,\n v: 0,\n yParityAndS: \"0x\",\n compact: \"0x\"\n };\n if (isBytesLike(signature)) {\n let bytes = arrayify(signature);\n // Get the r, s and v\n if (bytes.length === 64) {\n // EIP-2098; pull the v from the top bit of s and clear it\n result.v = 27 + (bytes[32] >> 7);\n bytes[32] &= 0x7f;\n result.r = hexlify(bytes.slice(0, 32));\n result.s = hexlify(bytes.slice(32, 64));\n }\n else if (bytes.length === 65) {\n result.r = hexlify(bytes.slice(0, 32));\n result.s = hexlify(bytes.slice(32, 64));\n result.v = bytes[64];\n }\n else {\n logger.throwArgumentError(\"invalid signature string\", \"signature\", signature);\n }\n // Allow a recid to be used as the v\n if (result.v < 27) {\n if (result.v === 0 || result.v === 1) {\n result.v += 27;\n }\n else {\n logger.throwArgumentError(\"signature invalid v byte\", \"signature\", signature);\n }\n }\n // Compute recoveryParam from v\n result.recoveryParam = 1 - (result.v % 2);\n // Compute _vs from recoveryParam and s\n if (result.recoveryParam) {\n bytes[32] |= 0x80;\n }\n result._vs = hexlify(bytes.slice(32, 64));\n }\n else {\n result.r = signature.r;\n result.s = signature.s;\n result.v = signature.v;\n result.recoveryParam = signature.recoveryParam;\n result._vs = signature._vs;\n // If the _vs is available, use it to populate missing s, v and recoveryParam\n // and verify non-missing s, v and recoveryParam\n if (result._vs != null) {\n const vs = zeroPad(arrayify(result._vs), 32);\n result._vs = hexlify(vs);\n // Set or check the recid\n const recoveryParam = ((vs[0] >= 128) ? 1 : 0);\n if (result.recoveryParam == null) {\n result.recoveryParam = recoveryParam;\n }\n else if (result.recoveryParam !== recoveryParam) {\n logger.throwArgumentError(\"signature recoveryParam mismatch _vs\", \"signature\", signature);\n }\n // Set or check the s\n vs[0] &= 0x7f;\n const s = hexlify(vs);\n if (result.s == null) {\n result.s = s;\n }\n else if (result.s !== s) {\n logger.throwArgumentError(\"signature v mismatch _vs\", \"signature\", signature);\n }\n }\n // Use recid and v to populate each other\n if (result.recoveryParam == null) {\n if (result.v == null) {\n logger.throwArgumentError(\"signature missing v and recoveryParam\", \"signature\", signature);\n }\n else if (result.v === 0 || result.v === 1) {\n result.recoveryParam = result.v;\n }\n else {\n result.recoveryParam = 1 - (result.v % 2);\n }\n }\n else {\n if (result.v == null) {\n result.v = 27 + result.recoveryParam;\n }\n else {\n const recId = (result.v === 0 || result.v === 1) ? result.v : (1 - (result.v % 2));\n if (result.recoveryParam !== recId) {\n logger.throwArgumentError(\"signature recoveryParam mismatch v\", \"signature\", signature);\n }\n }\n }\n if (result.r == null || !isHexString(result.r)) {\n logger.throwArgumentError(\"signature missing or invalid r\", \"signature\", signature);\n }\n else {\n result.r = hexZeroPad(result.r, 32);\n }\n if (result.s == null || !isHexString(result.s)) {\n logger.throwArgumentError(\"signature missing or invalid s\", \"signature\", signature);\n }\n else {\n result.s = hexZeroPad(result.s, 32);\n }\n const vs = arrayify(result.s);\n if (vs[0] >= 128) {\n logger.throwArgumentError(\"signature s out of range\", \"signature\", signature);\n }\n if (result.recoveryParam) {\n vs[0] |= 0x80;\n }\n const _vs = hexlify(vs);\n if (result._vs) {\n if (!isHexString(result._vs)) {\n logger.throwArgumentError(\"signature invalid _vs\", \"signature\", signature);\n }\n result._vs = hexZeroPad(result._vs, 32);\n }\n // Set or check the _vs\n if (result._vs == null) {\n result._vs = _vs;\n }\n else if (result._vs !== _vs) {\n logger.throwArgumentError(\"signature _vs mismatch v and s\", \"signature\", signature);\n }\n }\n result.yParityAndS = result._vs;\n result.compact = result.r + result.yParityAndS.substring(2);\n return result;\n}\nfunction joinSignature(signature) {\n signature = splitSignature(signature);\n return hexlify(concat([\n signature.r,\n signature.s,\n (signature.recoveryParam ? \"0x1c\" : \"0x1b\")\n ]));\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@ethersproject/bytes/lib.esm/index.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/constants/lib.esm/bignumbers.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@ethersproject/constants/lib.esm/bignumbers.js ***! - \*********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MaxInt256: () => (/* binding */ MaxInt256),\n/* harmony export */ MaxUint256: () => (/* binding */ MaxUint256),\n/* harmony export */ MinInt256: () => (/* binding */ MinInt256),\n/* harmony export */ NegativeOne: () => (/* binding */ NegativeOne),\n/* harmony export */ One: () => (/* binding */ One),\n/* harmony export */ Two: () => (/* binding */ Two),\n/* harmony export */ WeiPerEther: () => (/* binding */ WeiPerEther),\n/* harmony export */ Zero: () => (/* binding */ Zero)\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bignumber */ \"./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js\");\n\nconst NegativeOne = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(-1));\nconst Zero = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(0));\nconst One = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(1));\nconst Two = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(2));\nconst WeiPerEther = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(\"1000000000000000000\"));\nconst MaxUint256 = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\"));\nconst MinInt256 = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(\"-0x8000000000000000000000000000000000000000000000000000000000000000\"));\nconst MaxInt256 = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__.BigNumber.from(\"0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\"));\n\n//# sourceMappingURL=bignumbers.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@ethersproject/constants/lib.esm/bignumbers.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/hash/lib.esm/message.js": -/*!*************************************************************!*\ - !*** ./node_modules/@ethersproject/hash/lib.esm/message.js ***! - \*************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hashMessage: () => (/* binding */ hashMessage),\n/* harmony export */ messagePrefix: () => (/* binding */ messagePrefix)\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/keccak256 */ \"./node_modules/@ethersproject/keccak256/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/strings */ \"./node_modules/@ethersproject/strings/lib.esm/utf8.js\");\n\n\n\nconst messagePrefix = \"\\x19Ethereum Signed Message:\\n\";\nfunction hashMessage(message) {\n if (typeof (message) === \"string\") {\n message = (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_0__.toUtf8Bytes)(message);\n }\n return (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_1__.keccak256)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.concat)([\n (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_0__.toUtf8Bytes)(messagePrefix),\n (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_0__.toUtf8Bytes)(String(message.length)),\n message\n ]));\n}\n//# sourceMappingURL=message.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@ethersproject/hash/lib.esm/message.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/keccak256/lib.esm/index.js": -/*!****************************************************************!*\ - !*** ./node_modules/@ethersproject/keccak256/lib.esm/index.js ***! - \****************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ keccak256: () => (/* binding */ keccak256)\n/* harmony export */ });\n/* harmony import */ var js_sha3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! js-sha3 */ \"./node_modules/js-sha3/src/sha3.js\");\n/* harmony import */ var js_sha3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(js_sha3__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n\n\n\nfunction keccak256(data) {\n return '0x' + js_sha3__WEBPACK_IMPORTED_MODULE_0___default().keccak_256((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__.arrayify)(data));\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@ethersproject/keccak256/lib.esm/index.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/logger/lib.esm/_version.js": -/*!****************************************************************!*\ - !*** ./node_modules/@ethersproject/logger/lib.esm/_version.js ***! - \****************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ version: () => (/* binding */ version)\n/* harmony export */ });\nconst version = \"logger/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@ethersproject/logger/lib.esm/_version.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/logger/lib.esm/index.js": -/*!*************************************************************!*\ - !*** ./node_modules/@ethersproject/logger/lib.esm/index.js ***! - \*************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ErrorCode: () => (/* binding */ ErrorCode),\n/* harmony export */ LogLevel: () => (/* binding */ LogLevel),\n/* harmony export */ Logger: () => (/* binding */ Logger)\n/* harmony export */ });\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/logger/lib.esm/_version.js\");\n\nlet _permanentCensorErrors = false;\nlet _censorErrors = false;\nconst LogLevels = { debug: 1, \"default\": 2, info: 2, warning: 3, error: 4, off: 5 };\nlet _logLevel = LogLevels[\"default\"];\n\nlet _globalLogger = null;\nfunction _checkNormalize() {\n try {\n const missing = [];\n // Make sure all forms of normalization are supported\n [\"NFD\", \"NFC\", \"NFKD\", \"NFKC\"].forEach((form) => {\n try {\n if (\"test\".normalize(form) !== \"test\") {\n throw new Error(\"bad normalize\");\n }\n ;\n }\n catch (error) {\n missing.push(form);\n }\n });\n if (missing.length) {\n throw new Error(\"missing \" + missing.join(\", \"));\n }\n if (String.fromCharCode(0xe9).normalize(\"NFD\") !== String.fromCharCode(0x65, 0x0301)) {\n throw new Error(\"broken implementation\");\n }\n }\n catch (error) {\n return error.message;\n }\n return null;\n}\nconst _normalizeError = _checkNormalize();\nvar LogLevel;\n(function (LogLevel) {\n LogLevel[\"DEBUG\"] = \"DEBUG\";\n LogLevel[\"INFO\"] = \"INFO\";\n LogLevel[\"WARNING\"] = \"WARNING\";\n LogLevel[\"ERROR\"] = \"ERROR\";\n LogLevel[\"OFF\"] = \"OFF\";\n})(LogLevel || (LogLevel = {}));\nvar ErrorCode;\n(function (ErrorCode) {\n ///////////////////\n // Generic Errors\n // Unknown Error\n ErrorCode[\"UNKNOWN_ERROR\"] = \"UNKNOWN_ERROR\";\n // Not Implemented\n ErrorCode[\"NOT_IMPLEMENTED\"] = \"NOT_IMPLEMENTED\";\n // Unsupported Operation\n // - operation\n ErrorCode[\"UNSUPPORTED_OPERATION\"] = \"UNSUPPORTED_OPERATION\";\n // Network Error (i.e. Ethereum Network, such as an invalid chain ID)\n // - event (\"noNetwork\" is not re-thrown in provider.ready; otherwise thrown)\n ErrorCode[\"NETWORK_ERROR\"] = \"NETWORK_ERROR\";\n // Some sort of bad response from the server\n ErrorCode[\"SERVER_ERROR\"] = \"SERVER_ERROR\";\n // Timeout\n ErrorCode[\"TIMEOUT\"] = \"TIMEOUT\";\n ///////////////////\n // Operational Errors\n // Buffer Overrun\n ErrorCode[\"BUFFER_OVERRUN\"] = \"BUFFER_OVERRUN\";\n // Numeric Fault\n // - operation: the operation being executed\n // - fault: the reason this faulted\n ErrorCode[\"NUMERIC_FAULT\"] = \"NUMERIC_FAULT\";\n ///////////////////\n // Argument Errors\n // Missing new operator to an object\n // - name: The name of the class\n ErrorCode[\"MISSING_NEW\"] = \"MISSING_NEW\";\n // Invalid argument (e.g. value is incompatible with type) to a function:\n // - argument: The argument name that was invalid\n // - value: The value of the argument\n ErrorCode[\"INVALID_ARGUMENT\"] = \"INVALID_ARGUMENT\";\n // Missing argument to a function:\n // - count: The number of arguments received\n // - expectedCount: The number of arguments expected\n ErrorCode[\"MISSING_ARGUMENT\"] = \"MISSING_ARGUMENT\";\n // Too many arguments\n // - count: The number of arguments received\n // - expectedCount: The number of arguments expected\n ErrorCode[\"UNEXPECTED_ARGUMENT\"] = \"UNEXPECTED_ARGUMENT\";\n ///////////////////\n // Blockchain Errors\n // Call exception\n // - transaction: the transaction\n // - address?: the contract address\n // - args?: The arguments passed into the function\n // - method?: The Solidity method signature\n // - errorSignature?: The EIP848 error signature\n // - errorArgs?: The EIP848 error parameters\n // - reason: The reason (only for EIP848 \"Error(string)\")\n ErrorCode[\"CALL_EXCEPTION\"] = \"CALL_EXCEPTION\";\n // Insufficient funds (< value + gasLimit * gasPrice)\n // - transaction: the transaction attempted\n ErrorCode[\"INSUFFICIENT_FUNDS\"] = \"INSUFFICIENT_FUNDS\";\n // Nonce has already been used\n // - transaction: the transaction attempted\n ErrorCode[\"NONCE_EXPIRED\"] = \"NONCE_EXPIRED\";\n // The replacement fee for the transaction is too low\n // - transaction: the transaction attempted\n ErrorCode[\"REPLACEMENT_UNDERPRICED\"] = \"REPLACEMENT_UNDERPRICED\";\n // The gas limit could not be estimated\n // - transaction: the transaction passed to estimateGas\n ErrorCode[\"UNPREDICTABLE_GAS_LIMIT\"] = \"UNPREDICTABLE_GAS_LIMIT\";\n // The transaction was replaced by one with a higher gas price\n // - reason: \"cancelled\", \"replaced\" or \"repriced\"\n // - cancelled: true if reason == \"cancelled\" or reason == \"replaced\")\n // - hash: original transaction hash\n // - replacement: the full TransactionsResponse for the replacement\n // - receipt: the receipt of the replacement\n ErrorCode[\"TRANSACTION_REPLACED\"] = \"TRANSACTION_REPLACED\";\n ///////////////////\n // Interaction Errors\n // The user rejected the action, such as signing a message or sending\n // a transaction\n ErrorCode[\"ACTION_REJECTED\"] = \"ACTION_REJECTED\";\n})(ErrorCode || (ErrorCode = {}));\n;\nconst HEX = \"0123456789abcdef\";\nclass Logger {\n constructor(version) {\n Object.defineProperty(this, \"version\", {\n enumerable: true,\n value: version,\n writable: false\n });\n }\n _log(logLevel, args) {\n const level = logLevel.toLowerCase();\n if (LogLevels[level] == null) {\n this.throwArgumentError(\"invalid log level name\", \"logLevel\", logLevel);\n }\n if (_logLevel > LogLevels[level]) {\n return;\n }\n console.log.apply(console, args);\n }\n debug(...args) {\n this._log(Logger.levels.DEBUG, args);\n }\n info(...args) {\n this._log(Logger.levels.INFO, args);\n }\n warn(...args) {\n this._log(Logger.levels.WARNING, args);\n }\n makeError(message, code, params) {\n // Errors are being censored\n if (_censorErrors) {\n return this.makeError(\"censored error\", code, {});\n }\n if (!code) {\n code = Logger.errors.UNKNOWN_ERROR;\n }\n if (!params) {\n params = {};\n }\n const messageDetails = [];\n Object.keys(params).forEach((key) => {\n const value = params[key];\n try {\n if (value instanceof Uint8Array) {\n let hex = \"\";\n for (let i = 0; i < value.length; i++) {\n hex += HEX[value[i] >> 4];\n hex += HEX[value[i] & 0x0f];\n }\n messageDetails.push(key + \"=Uint8Array(0x\" + hex + \")\");\n }\n else {\n messageDetails.push(key + \"=\" + JSON.stringify(value));\n }\n }\n catch (error) {\n messageDetails.push(key + \"=\" + JSON.stringify(params[key].toString()));\n }\n });\n messageDetails.push(`code=${code}`);\n messageDetails.push(`version=${this.version}`);\n const reason = message;\n let url = \"\";\n switch (code) {\n case ErrorCode.NUMERIC_FAULT: {\n url = \"NUMERIC_FAULT\";\n const fault = message;\n switch (fault) {\n case \"overflow\":\n case \"underflow\":\n case \"division-by-zero\":\n url += \"-\" + fault;\n break;\n case \"negative-power\":\n case \"negative-width\":\n url += \"-unsupported\";\n break;\n case \"unbound-bitwise-result\":\n url += \"-unbound-result\";\n break;\n }\n break;\n }\n case ErrorCode.CALL_EXCEPTION:\n case ErrorCode.INSUFFICIENT_FUNDS:\n case ErrorCode.MISSING_NEW:\n case ErrorCode.NONCE_EXPIRED:\n case ErrorCode.REPLACEMENT_UNDERPRICED:\n case ErrorCode.TRANSACTION_REPLACED:\n case ErrorCode.UNPREDICTABLE_GAS_LIMIT:\n url = code;\n break;\n }\n if (url) {\n message += \" [ See: https:/\\/links.ethers.org/v5-errors-\" + url + \" ]\";\n }\n if (messageDetails.length) {\n message += \" (\" + messageDetails.join(\", \") + \")\";\n }\n // @TODO: Any??\n const error = new Error(message);\n error.reason = reason;\n error.code = code;\n Object.keys(params).forEach(function (key) {\n error[key] = params[key];\n });\n return error;\n }\n throwError(message, code, params) {\n throw this.makeError(message, code, params);\n }\n throwArgumentError(message, name, value) {\n return this.throwError(message, Logger.errors.INVALID_ARGUMENT, {\n argument: name,\n value: value\n });\n }\n assert(condition, message, code, params) {\n if (!!condition) {\n return;\n }\n this.throwError(message, code, params);\n }\n assertArgument(condition, message, name, value) {\n if (!!condition) {\n return;\n }\n this.throwArgumentError(message, name, value);\n }\n checkNormalize(message) {\n if (message == null) {\n message = \"platform missing String.prototype.normalize\";\n }\n if (_normalizeError) {\n this.throwError(\"platform missing String.prototype.normalize\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"String.prototype.normalize\", form: _normalizeError\n });\n }\n }\n checkSafeUint53(value, message) {\n if (typeof (value) !== \"number\") {\n return;\n }\n if (message == null) {\n message = \"value not safe\";\n }\n if (value < 0 || value >= 0x1fffffffffffff) {\n this.throwError(message, Logger.errors.NUMERIC_FAULT, {\n operation: \"checkSafeInteger\",\n fault: \"out-of-safe-range\",\n value: value\n });\n }\n if (value % 1) {\n this.throwError(message, Logger.errors.NUMERIC_FAULT, {\n operation: \"checkSafeInteger\",\n fault: \"non-integer\",\n value: value\n });\n }\n }\n checkArgumentCount(count, expectedCount, message) {\n if (message) {\n message = \": \" + message;\n }\n else {\n message = \"\";\n }\n if (count < expectedCount) {\n this.throwError(\"missing argument\" + message, Logger.errors.MISSING_ARGUMENT, {\n count: count,\n expectedCount: expectedCount\n });\n }\n if (count > expectedCount) {\n this.throwError(\"too many arguments\" + message, Logger.errors.UNEXPECTED_ARGUMENT, {\n count: count,\n expectedCount: expectedCount\n });\n }\n }\n checkNew(target, kind) {\n if (target === Object || target == null) {\n this.throwError(\"missing new\", Logger.errors.MISSING_NEW, { name: kind.name });\n }\n }\n checkAbstract(target, kind) {\n if (target === kind) {\n this.throwError(\"cannot instantiate abstract class \" + JSON.stringify(kind.name) + \" directly; use a sub-class\", Logger.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: \"new\" });\n }\n else if (target === Object || target == null) {\n this.throwError(\"missing new\", Logger.errors.MISSING_NEW, { name: kind.name });\n }\n }\n static globalLogger() {\n if (!_globalLogger) {\n _globalLogger = new Logger(_version__WEBPACK_IMPORTED_MODULE_0__.version);\n }\n return _globalLogger;\n }\n static setCensorship(censorship, permanent) {\n if (!censorship && permanent) {\n this.globalLogger().throwError(\"cannot permanently disable censorship\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"setCensorship\"\n });\n }\n if (_permanentCensorErrors) {\n if (!censorship) {\n return;\n }\n this.globalLogger().throwError(\"error censorship permanent\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"setCensorship\"\n });\n }\n _censorErrors = !!censorship;\n _permanentCensorErrors = !!permanent;\n }\n static setLogLevel(logLevel) {\n const level = LogLevels[logLevel.toLowerCase()];\n if (level == null) {\n Logger.globalLogger().warn(\"invalid log level - \" + logLevel);\n return;\n }\n _logLevel = level;\n }\n static from(version) {\n return new Logger(version);\n }\n}\nLogger.errors = ErrorCode;\nLogger.levels = LogLevel;\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@ethersproject/logger/lib.esm/index.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/properties/lib.esm/_version.js": -/*!********************************************************************!*\ - !*** ./node_modules/@ethersproject/properties/lib.esm/_version.js ***! - \********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ version: () => (/* binding */ version)\n/* harmony export */ });\nconst version = \"properties/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@ethersproject/properties/lib.esm/_version.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/properties/lib.esm/index.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@ethersproject/properties/lib.esm/index.js ***! - \*****************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Description: () => (/* binding */ Description),\n/* harmony export */ checkProperties: () => (/* binding */ checkProperties),\n/* harmony export */ deepCopy: () => (/* binding */ deepCopy),\n/* harmony export */ defineReadOnly: () => (/* binding */ defineReadOnly),\n/* harmony export */ getStatic: () => (/* binding */ getStatic),\n/* harmony export */ resolveProperties: () => (/* binding */ resolveProperties),\n/* harmony export */ shallowCopy: () => (/* binding */ shallowCopy)\n/* harmony export */ });\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/properties/lib.esm/_version.js\");\n\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\nfunction defineReadOnly(object, name, value) {\n Object.defineProperty(object, name, {\n enumerable: true,\n value: value,\n writable: false,\n });\n}\n// Crawl up the constructor chain to find a static method\nfunction getStatic(ctor, key) {\n for (let i = 0; i < 32; i++) {\n if (ctor[key]) {\n return ctor[key];\n }\n if (!ctor.prototype || typeof (ctor.prototype) !== \"object\") {\n break;\n }\n ctor = Object.getPrototypeOf(ctor.prototype).constructor;\n }\n return null;\n}\nfunction resolveProperties(object) {\n return __awaiter(this, void 0, void 0, function* () {\n const promises = Object.keys(object).map((key) => {\n const value = object[key];\n return Promise.resolve(value).then((v) => ({ key: key, value: v }));\n });\n const results = yield Promise.all(promises);\n return results.reduce((accum, result) => {\n accum[(result.key)] = result.value;\n return accum;\n }, {});\n });\n}\nfunction checkProperties(object, properties) {\n if (!object || typeof (object) !== \"object\") {\n logger.throwArgumentError(\"invalid object\", \"object\", object);\n }\n Object.keys(object).forEach((key) => {\n if (!properties[key]) {\n logger.throwArgumentError(\"invalid object key - \" + key, \"transaction:\" + key, object);\n }\n });\n}\nfunction shallowCopy(object) {\n const result = {};\n for (const key in object) {\n result[key] = object[key];\n }\n return result;\n}\nconst opaque = { bigint: true, boolean: true, \"function\": true, number: true, string: true };\nfunction _isFrozen(object) {\n // Opaque objects are not mutable, so safe to copy by assignment\n if (object === undefined || object === null || opaque[typeof (object)]) {\n return true;\n }\n if (Array.isArray(object) || typeof (object) === \"object\") {\n if (!Object.isFrozen(object)) {\n return false;\n }\n const keys = Object.keys(object);\n for (let i = 0; i < keys.length; i++) {\n let value = null;\n try {\n value = object[keys[i]];\n }\n catch (error) {\n // If accessing a value triggers an error, it is a getter\n // designed to do so (e.g. Result) and is therefore \"frozen\"\n continue;\n }\n if (!_isFrozen(value)) {\n return false;\n }\n }\n return true;\n }\n return logger.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, \"object\", object);\n}\n// Returns a new copy of object, such that no properties may be replaced.\n// New properties may be added only to objects.\nfunction _deepCopy(object) {\n if (_isFrozen(object)) {\n return object;\n }\n // Arrays are mutable, so we need to create a copy\n if (Array.isArray(object)) {\n return Object.freeze(object.map((item) => deepCopy(item)));\n }\n if (typeof (object) === \"object\") {\n const result = {};\n for (const key in object) {\n const value = object[key];\n if (value === undefined) {\n continue;\n }\n defineReadOnly(result, key, deepCopy(value));\n }\n return result;\n }\n return logger.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, \"object\", object);\n}\nfunction deepCopy(object) {\n return _deepCopy(object);\n}\nclass Description {\n constructor(info) {\n for (const key in info) {\n this[key] = deepCopy(info[key]);\n }\n }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@ethersproject/properties/lib.esm/index.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/rlp/lib.esm/_version.js": -/*!*************************************************************!*\ - !*** ./node_modules/@ethersproject/rlp/lib.esm/_version.js ***! - \*************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ version: () => (/* binding */ version)\n/* harmony export */ });\nconst version = \"rlp/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@ethersproject/rlp/lib.esm/_version.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/rlp/lib.esm/index.js": -/*!**********************************************************!*\ - !*** ./node_modules/@ethersproject/rlp/lib.esm/index.js ***! - \**********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encode: () => (/* binding */ encode)\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/rlp/lib.esm/_version.js\");\n\n//See: https://github.com/ethereum/wiki/wiki/RLP\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\nfunction arrayifyInteger(value) {\n const result = [];\n while (value) {\n result.unshift(value & 0xff);\n value >>= 8;\n }\n return result;\n}\nfunction unarrayifyInteger(data, offset, length) {\n let result = 0;\n for (let i = 0; i < length; i++) {\n result = (result * 256) + data[offset + i];\n }\n return result;\n}\nfunction _encode(object) {\n if (Array.isArray(object)) {\n let payload = [];\n object.forEach(function (child) {\n payload = payload.concat(_encode(child));\n });\n if (payload.length <= 55) {\n payload.unshift(0xc0 + payload.length);\n return payload;\n }\n const length = arrayifyInteger(payload.length);\n length.unshift(0xf7 + length.length);\n return length.concat(payload);\n }\n if (!(0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.isBytesLike)(object)) {\n logger.throwArgumentError(\"RLP object must be BytesLike\", \"object\", object);\n }\n const data = Array.prototype.slice.call((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(object));\n if (data.length === 1 && data[0] <= 0x7f) {\n return data;\n }\n else if (data.length <= 55) {\n data.unshift(0x80 + data.length);\n return data;\n }\n const length = arrayifyInteger(data.length);\n length.unshift(0xb7 + length.length);\n return length.concat(data);\n}\nfunction encode(object) {\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(_encode(object));\n}\nfunction _decodeChildren(data, offset, childOffset, length) {\n const result = [];\n while (childOffset < offset + 1 + length) {\n const decoded = _decode(data, childOffset);\n result.push(decoded.result);\n childOffset += decoded.consumed;\n if (childOffset > offset + 1 + length) {\n logger.throwError(\"child data too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n }\n return { consumed: (1 + length), result: result };\n}\n// returns { consumed: number, result: Object }\nfunction _decode(data, offset) {\n if (data.length === 0) {\n logger.throwError(\"data too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n // Array with extra length prefix\n if (data[offset] >= 0xf8) {\n const lengthLength = data[offset] - 0xf7;\n if (offset + 1 + lengthLength > data.length) {\n logger.throwError(\"data short segment too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n if (offset + 1 + lengthLength + length > data.length) {\n logger.throwError(\"data long segment too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length);\n }\n else if (data[offset] >= 0xc0) {\n const length = data[offset] - 0xc0;\n if (offset + 1 + length > data.length) {\n logger.throwError(\"data array too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n return _decodeChildren(data, offset, offset + 1, length);\n }\n else if (data[offset] >= 0xb8) {\n const lengthLength = data[offset] - 0xb7;\n if (offset + 1 + lengthLength > data.length) {\n logger.throwError(\"data array too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n if (offset + 1 + lengthLength + length > data.length) {\n logger.throwError(\"data array too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n const result = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length));\n return { consumed: (1 + lengthLength + length), result: result };\n }\n else if (data[offset] >= 0x80) {\n const length = data[offset] - 0x80;\n if (offset + 1 + length > data.length) {\n logger.throwError(\"data too short\", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, {});\n }\n const result = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(data.slice(offset + 1, offset + 1 + length));\n return { consumed: (1 + length), result: result };\n }\n return { consumed: 1, result: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(data[offset]) };\n}\nfunction decode(data) {\n const bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(data);\n const decoded = _decode(bytes, 0);\n if (decoded.consumed !== bytes.length) {\n logger.throwArgumentError(\"invalid rlp data\", \"data\", data);\n }\n return decoded.result;\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@ethersproject/rlp/lib.esm/index.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/signing-key/lib.esm/_version.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@ethersproject/signing-key/lib.esm/_version.js ***! - \*********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ version: () => (/* binding */ version)\n/* harmony export */ });\nconst version = \"signing-key/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@ethersproject/signing-key/lib.esm/_version.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/signing-key/lib.esm/elliptic.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@ethersproject/signing-key/lib.esm/elliptic.js ***! - \*********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EC: () => (/* binding */ EC$1)\n/* harmony export */ });\n/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bn.js */ \"./node_modules/bn.js/lib/bn.js\");\n/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(bn_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var hash_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! hash.js */ \"./node_modules/hash.js/lib/hash.js\");\n/* harmony import */ var hash_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(hash_js__WEBPACK_IMPORTED_MODULE_1__);\n\n\n\nvar commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {};\n\nfunction getDefaultExportFromCjs (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;\n}\n\nfunction createCommonjsModule(fn, basedir, module) {\n\treturn module = {\n\t\tpath: basedir,\n\t\texports: {},\n\t\trequire: function (path, base) {\n\t\t\treturn commonjsRequire(path, (base === undefined || base === null) ? module.path : base);\n\t\t}\n\t}, fn(module, module.exports), module.exports;\n}\n\nfunction getDefaultExportFromNamespaceIfPresent (n) {\n\treturn n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n;\n}\n\nfunction getDefaultExportFromNamespaceIfNotNamed (n) {\n\treturn n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n;\n}\n\nfunction getAugmentedNamespace(n) {\n\tif (n.__esModule) return n;\n\tvar a = Object.defineProperty({}, '__esModule', {value: true});\n\tObject.keys(n).forEach(function (k) {\n\t\tvar d = Object.getOwnPropertyDescriptor(n, k);\n\t\tObject.defineProperty(a, k, d.get ? d : {\n\t\t\tenumerable: true,\n\t\t\tget: function () {\n\t\t\t\treturn n[k];\n\t\t\t}\n\t\t});\n\t});\n\treturn a;\n}\n\nfunction commonjsRequire () {\n\tthrow new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');\n}\n\nvar minimalisticAssert = assert;\n\nfunction assert(val, msg) {\n if (!val)\n throw new Error(msg || 'Assertion failed');\n}\n\nassert.equal = function assertEqual(l, r, msg) {\n if (l != r)\n throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));\n};\n\nvar utils_1 = createCommonjsModule(function (module, exports) {\n'use strict';\n\nvar utils = exports;\n\nfunction toArray(msg, enc) {\n if (Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg !== 'string') {\n for (var i = 0; i < msg.length; i++)\n res[i] = msg[i] | 0;\n return res;\n }\n if (enc === 'hex') {\n msg = msg.replace(/[^a-z0-9]+/ig, '');\n if (msg.length % 2 !== 0)\n msg = '0' + msg;\n for (var i = 0; i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n } else {\n for (var i = 0; i < msg.length; i++) {\n var c = msg.charCodeAt(i);\n var hi = c >> 8;\n var lo = c & 0xff;\n if (hi)\n res.push(hi, lo);\n else\n res.push(lo);\n }\n }\n return res;\n}\nutils.toArray = toArray;\n\nfunction zero2(word) {\n if (word.length === 1)\n return '0' + word;\n else\n return word;\n}\nutils.zero2 = zero2;\n\nfunction toHex(msg) {\n var res = '';\n for (var i = 0; i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n}\nutils.toHex = toHex;\n\nutils.encode = function encode(arr, enc) {\n if (enc === 'hex')\n return toHex(arr);\n else\n return arr;\n};\n});\n\nvar utils_1$1 = createCommonjsModule(function (module, exports) {\n'use strict';\n\nvar utils = exports;\n\n\n\n\nutils.assert = minimalisticAssert;\nutils.toArray = utils_1.toArray;\nutils.zero2 = utils_1.zero2;\nutils.toHex = utils_1.toHex;\nutils.encode = utils_1.encode;\n\n// Represent num in a w-NAF form\nfunction getNAF(num, w, bits) {\n var naf = new Array(Math.max(num.bitLength(), bits) + 1);\n naf.fill(0);\n\n var ws = 1 << (w + 1);\n var k = num.clone();\n\n for (var i = 0; i < naf.length; i++) {\n var z;\n var mod = k.andln(ws - 1);\n if (k.isOdd()) {\n if (mod > (ws >> 1) - 1)\n z = (ws >> 1) - mod;\n else\n z = mod;\n k.isubn(z);\n } else {\n z = 0;\n }\n\n naf[i] = z;\n k.iushrn(1);\n }\n\n return naf;\n}\nutils.getNAF = getNAF;\n\n// Represent k1, k2 in a Joint Sparse Form\nfunction getJSF(k1, k2) {\n var jsf = [\n [],\n [],\n ];\n\n k1 = k1.clone();\n k2 = k2.clone();\n var d1 = 0;\n var d2 = 0;\n var m8;\n while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) {\n // First phase\n var m14 = (k1.andln(3) + d1) & 3;\n var m24 = (k2.andln(3) + d2) & 3;\n if (m14 === 3)\n m14 = -1;\n if (m24 === 3)\n m24 = -1;\n var u1;\n if ((m14 & 1) === 0) {\n u1 = 0;\n } else {\n m8 = (k1.andln(7) + d1) & 7;\n if ((m8 === 3 || m8 === 5) && m24 === 2)\n u1 = -m14;\n else\n u1 = m14;\n }\n jsf[0].push(u1);\n\n var u2;\n if ((m24 & 1) === 0) {\n u2 = 0;\n } else {\n m8 = (k2.andln(7) + d2) & 7;\n if ((m8 === 3 || m8 === 5) && m14 === 2)\n u2 = -m24;\n else\n u2 = m24;\n }\n jsf[1].push(u2);\n\n // Second phase\n if (2 * d1 === u1 + 1)\n d1 = 1 - d1;\n if (2 * d2 === u2 + 1)\n d2 = 1 - d2;\n k1.iushrn(1);\n k2.iushrn(1);\n }\n\n return jsf;\n}\nutils.getJSF = getJSF;\n\nfunction cachedProperty(obj, name, computer) {\n var key = '_' + name;\n obj.prototype[name] = function cachedProperty() {\n return this[key] !== undefined ? this[key] :\n this[key] = computer.call(this);\n };\n}\nutils.cachedProperty = cachedProperty;\n\nfunction parseBytes(bytes) {\n return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') :\n bytes;\n}\nutils.parseBytes = parseBytes;\n\nfunction intFromLE(bytes) {\n return new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(bytes, 'hex', 'le');\n}\nutils.intFromLE = intFromLE;\n});\n\n'use strict';\n\n\n\nvar getNAF = utils_1$1.getNAF;\nvar getJSF = utils_1$1.getJSF;\nvar assert$1 = utils_1$1.assert;\n\nfunction BaseCurve(type, conf) {\n this.type = type;\n this.p = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(conf.p, 16);\n\n // Use Montgomery, when there is no fast reduction for the prime\n this.red = conf.prime ? bn_js__WEBPACK_IMPORTED_MODULE_0___default().red(conf.prime) : bn_js__WEBPACK_IMPORTED_MODULE_0___default().mont(this.p);\n\n // Useful for many curves\n this.zero = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(0).toRed(this.red);\n this.one = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(1).toRed(this.red);\n this.two = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(2).toRed(this.red);\n\n // Curve configuration, optional\n this.n = conf.n && new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(conf.n, 16);\n this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed);\n\n // Temporary arrays\n this._wnafT1 = new Array(4);\n this._wnafT2 = new Array(4);\n this._wnafT3 = new Array(4);\n this._wnafT4 = new Array(4);\n\n this._bitLength = this.n ? this.n.bitLength() : 0;\n\n // Generalized Greg Maxwell's trick\n var adjustCount = this.n && this.p.div(this.n);\n if (!adjustCount || adjustCount.cmpn(100) > 0) {\n this.redN = null;\n } else {\n this._maxwellTrick = true;\n this.redN = this.n.toRed(this.red);\n }\n}\nvar base = BaseCurve;\n\nBaseCurve.prototype.point = function point() {\n throw new Error('Not implemented');\n};\n\nBaseCurve.prototype.validate = function validate() {\n throw new Error('Not implemented');\n};\n\nBaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {\n assert$1(p.precomputed);\n var doubles = p._getDoubles();\n\n var naf = getNAF(k, 1, this._bitLength);\n var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1);\n I /= 3;\n\n // Translate into more windowed form\n var repr = [];\n var j;\n var nafW;\n for (j = 0; j < naf.length; j += doubles.step) {\n nafW = 0;\n for (var l = j + doubles.step - 1; l >= j; l--)\n nafW = (nafW << 1) + naf[l];\n repr.push(nafW);\n }\n\n var a = this.jpoint(null, null, null);\n var b = this.jpoint(null, null, null);\n for (var i = I; i > 0; i--) {\n for (j = 0; j < repr.length; j++) {\n nafW = repr[j];\n if (nafW === i)\n b = b.mixedAdd(doubles.points[j]);\n else if (nafW === -i)\n b = b.mixedAdd(doubles.points[j].neg());\n }\n a = a.add(b);\n }\n return a.toP();\n};\n\nBaseCurve.prototype._wnafMul = function _wnafMul(p, k) {\n var w = 4;\n\n // Precompute window\n var nafPoints = p._getNAFPoints(w);\n w = nafPoints.wnd;\n var wnd = nafPoints.points;\n\n // Get NAF form\n var naf = getNAF(k, w, this._bitLength);\n\n // Add `this`*(N+1) for every w-NAF index\n var acc = this.jpoint(null, null, null);\n for (var i = naf.length - 1; i >= 0; i--) {\n // Count zeroes\n for (var l = 0; i >= 0 && naf[i] === 0; i--)\n l++;\n if (i >= 0)\n l++;\n acc = acc.dblp(l);\n\n if (i < 0)\n break;\n var z = naf[i];\n assert$1(z !== 0);\n if (p.type === 'affine') {\n // J +- P\n if (z > 0)\n acc = acc.mixedAdd(wnd[(z - 1) >> 1]);\n else\n acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg());\n } else {\n // J +- J\n if (z > 0)\n acc = acc.add(wnd[(z - 1) >> 1]);\n else\n acc = acc.add(wnd[(-z - 1) >> 1].neg());\n }\n }\n return p.type === 'affine' ? acc.toP() : acc;\n};\n\nBaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,\n points,\n coeffs,\n len,\n jacobianResult) {\n var wndWidth = this._wnafT1;\n var wnd = this._wnafT2;\n var naf = this._wnafT3;\n\n // Fill all arrays\n var max = 0;\n var i;\n var j;\n var p;\n for (i = 0; i < len; i++) {\n p = points[i];\n var nafPoints = p._getNAFPoints(defW);\n wndWidth[i] = nafPoints.wnd;\n wnd[i] = nafPoints.points;\n }\n\n // Comb small window NAFs\n for (i = len - 1; i >= 1; i -= 2) {\n var a = i - 1;\n var b = i;\n if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {\n naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength);\n naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength);\n max = Math.max(naf[a].length, max);\n max = Math.max(naf[b].length, max);\n continue;\n }\n\n var comb = [\n points[a], /* 1 */\n null, /* 3 */\n null, /* 5 */\n points[b], /* 7 */\n ];\n\n // Try to avoid Projective points, if possible\n if (points[a].y.cmp(points[b].y) === 0) {\n comb[1] = points[a].add(points[b]);\n comb[2] = points[a].toJ().mixedAdd(points[b].neg());\n } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) {\n comb[1] = points[a].toJ().mixedAdd(points[b]);\n comb[2] = points[a].add(points[b].neg());\n } else {\n comb[1] = points[a].toJ().mixedAdd(points[b]);\n comb[2] = points[a].toJ().mixedAdd(points[b].neg());\n }\n\n var index = [\n -3, /* -1 -1 */\n -1, /* -1 0 */\n -5, /* -1 1 */\n -7, /* 0 -1 */\n 0, /* 0 0 */\n 7, /* 0 1 */\n 5, /* 1 -1 */\n 1, /* 1 0 */\n 3, /* 1 1 */\n ];\n\n var jsf = getJSF(coeffs[a], coeffs[b]);\n max = Math.max(jsf[0].length, max);\n naf[a] = new Array(max);\n naf[b] = new Array(max);\n for (j = 0; j < max; j++) {\n var ja = jsf[0][j] | 0;\n var jb = jsf[1][j] | 0;\n\n naf[a][j] = index[(ja + 1) * 3 + (jb + 1)];\n naf[b][j] = 0;\n wnd[a] = comb;\n }\n }\n\n var acc = this.jpoint(null, null, null);\n var tmp = this._wnafT4;\n for (i = max; i >= 0; i--) {\n var k = 0;\n\n while (i >= 0) {\n var zero = true;\n for (j = 0; j < len; j++) {\n tmp[j] = naf[j][i] | 0;\n if (tmp[j] !== 0)\n zero = false;\n }\n if (!zero)\n break;\n k++;\n i--;\n }\n if (i >= 0)\n k++;\n acc = acc.dblp(k);\n if (i < 0)\n break;\n\n for (j = 0; j < len; j++) {\n var z = tmp[j];\n p;\n if (z === 0)\n continue;\n else if (z > 0)\n p = wnd[j][(z - 1) >> 1];\n else if (z < 0)\n p = wnd[j][(-z - 1) >> 1].neg();\n\n if (p.type === 'affine')\n acc = acc.mixedAdd(p);\n else\n acc = acc.add(p);\n }\n }\n // Zeroify references\n for (i = 0; i < len; i++)\n wnd[i] = null;\n\n if (jacobianResult)\n return acc;\n else\n return acc.toP();\n};\n\nfunction BasePoint(curve, type) {\n this.curve = curve;\n this.type = type;\n this.precomputed = null;\n}\nBaseCurve.BasePoint = BasePoint;\n\nBasePoint.prototype.eq = function eq(/*other*/) {\n throw new Error('Not implemented');\n};\n\nBasePoint.prototype.validate = function validate() {\n return this.curve.validate(this);\n};\n\nBaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {\n bytes = utils_1$1.toArray(bytes, enc);\n\n var len = this.p.byteLength();\n\n // uncompressed, hybrid-odd, hybrid-even\n if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) &&\n bytes.length - 1 === 2 * len) {\n if (bytes[0] === 0x06)\n assert$1(bytes[bytes.length - 1] % 2 === 0);\n else if (bytes[0] === 0x07)\n assert$1(bytes[bytes.length - 1] % 2 === 1);\n\n var res = this.point(bytes.slice(1, 1 + len),\n bytes.slice(1 + len, 1 + 2 * len));\n\n return res;\n } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) &&\n bytes.length - 1 === len) {\n return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03);\n }\n throw new Error('Unknown point format');\n};\n\nBasePoint.prototype.encodeCompressed = function encodeCompressed(enc) {\n return this.encode(enc, true);\n};\n\nBasePoint.prototype._encode = function _encode(compact) {\n var len = this.curve.p.byteLength();\n var x = this.getX().toArray('be', len);\n\n if (compact)\n return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x);\n\n return [ 0x04 ].concat(x, this.getY().toArray('be', len));\n};\n\nBasePoint.prototype.encode = function encode(enc, compact) {\n return utils_1$1.encode(this._encode(compact), enc);\n};\n\nBasePoint.prototype.precompute = function precompute(power) {\n if (this.precomputed)\n return this;\n\n var precomputed = {\n doubles: null,\n naf: null,\n beta: null,\n };\n precomputed.naf = this._getNAFPoints(8);\n precomputed.doubles = this._getDoubles(4, power);\n precomputed.beta = this._getBeta();\n this.precomputed = precomputed;\n\n return this;\n};\n\nBasePoint.prototype._hasDoubles = function _hasDoubles(k) {\n if (!this.precomputed)\n return false;\n\n var doubles = this.precomputed.doubles;\n if (!doubles)\n return false;\n\n return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step);\n};\n\nBasePoint.prototype._getDoubles = function _getDoubles(step, power) {\n if (this.precomputed && this.precomputed.doubles)\n return this.precomputed.doubles;\n\n var doubles = [ this ];\n var acc = this;\n for (var i = 0; i < power; i += step) {\n for (var j = 0; j < step; j++)\n acc = acc.dbl();\n doubles.push(acc);\n }\n return {\n step: step,\n points: doubles,\n };\n};\n\nBasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {\n if (this.precomputed && this.precomputed.naf)\n return this.precomputed.naf;\n\n var res = [ this ];\n var max = (1 << wnd) - 1;\n var dbl = max === 1 ? null : this.dbl();\n for (var i = 1; i < max; i++)\n res[i] = res[i - 1].add(dbl);\n return {\n wnd: wnd,\n points: res,\n };\n};\n\nBasePoint.prototype._getBeta = function _getBeta() {\n return null;\n};\n\nBasePoint.prototype.dblp = function dblp(k) {\n var r = this;\n for (var i = 0; i < k; i++)\n r = r.dbl();\n return r;\n};\n\nvar inherits_browser = createCommonjsModule(function (module) {\nif (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor;\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n }\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n };\n}\n});\n\n'use strict';\n\n\n\n\n\n\nvar assert$2 = utils_1$1.assert;\n\nfunction ShortCurve(conf) {\n base.call(this, 'short', conf);\n\n this.a = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(conf.a, 16).toRed(this.red);\n this.b = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(conf.b, 16).toRed(this.red);\n this.tinv = this.two.redInvm();\n\n this.zeroA = this.a.fromRed().cmpn(0) === 0;\n this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0;\n\n // If the curve is endomorphic, precalculate beta and lambda\n this.endo = this._getEndomorphism(conf);\n this._endoWnafT1 = new Array(4);\n this._endoWnafT2 = new Array(4);\n}\ninherits_browser(ShortCurve, base);\nvar short_1 = ShortCurve;\n\nShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {\n // No efficient endomorphism\n if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)\n return;\n\n // Compute beta and lambda, that lambda * P = (beta * Px; Py)\n var beta;\n var lambda;\n if (conf.beta) {\n beta = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(conf.beta, 16).toRed(this.red);\n } else {\n var betas = this._getEndoRoots(this.p);\n // Choose the smallest beta\n beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1];\n beta = beta.toRed(this.red);\n }\n if (conf.lambda) {\n lambda = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(conf.lambda, 16);\n } else {\n // Choose the lambda that is matching selected beta\n var lambdas = this._getEndoRoots(this.n);\n if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) {\n lambda = lambdas[0];\n } else {\n lambda = lambdas[1];\n assert$2(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);\n }\n }\n\n // Get basis vectors, used for balanced length-two representation\n var basis;\n if (conf.basis) {\n basis = conf.basis.map(function(vec) {\n return {\n a: new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(vec.a, 16),\n b: new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(vec.b, 16),\n };\n });\n } else {\n basis = this._getEndoBasis(lambda);\n }\n\n return {\n beta: beta,\n lambda: lambda,\n basis: basis,\n };\n};\n\nShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) {\n // Find roots of for x^2 + x + 1 in F\n // Root = (-1 +- Sqrt(-3)) / 2\n //\n var red = num === this.p ? this.red : bn_js__WEBPACK_IMPORTED_MODULE_0___default().mont(num);\n var tinv = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(2).toRed(red).redInvm();\n var ntinv = tinv.redNeg();\n\n var s = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(3).toRed(red).redNeg().redSqrt().redMul(tinv);\n\n var l1 = ntinv.redAdd(s).fromRed();\n var l2 = ntinv.redSub(s).fromRed();\n return [ l1, l2 ];\n};\n\nShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) {\n // aprxSqrt >= sqrt(this.n)\n var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2));\n\n // 3.74\n // Run EGCD, until r(L + 1) < aprxSqrt\n var u = lambda;\n var v = this.n.clone();\n var x1 = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(1);\n var y1 = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(0);\n var x2 = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(0);\n var y2 = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(1);\n\n // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n)\n var a0;\n var b0;\n // First vector\n var a1;\n var b1;\n // Second vector\n var a2;\n var b2;\n\n var prevR;\n var i = 0;\n var r;\n var x;\n while (u.cmpn(0) !== 0) {\n var q = v.div(u);\n r = v.sub(q.mul(u));\n x = x2.sub(q.mul(x1));\n var y = y2.sub(q.mul(y1));\n\n if (!a1 && r.cmp(aprxSqrt) < 0) {\n a0 = prevR.neg();\n b0 = x1;\n a1 = r.neg();\n b1 = x;\n } else if (a1 && ++i === 2) {\n break;\n }\n prevR = r;\n\n v = u;\n u = r;\n x2 = x1;\n x1 = x;\n y2 = y1;\n y1 = y;\n }\n a2 = r.neg();\n b2 = x;\n\n var len1 = a1.sqr().add(b1.sqr());\n var len2 = a2.sqr().add(b2.sqr());\n if (len2.cmp(len1) >= 0) {\n a2 = a0;\n b2 = b0;\n }\n\n // Normalize signs\n if (a1.negative) {\n a1 = a1.neg();\n b1 = b1.neg();\n }\n if (a2.negative) {\n a2 = a2.neg();\n b2 = b2.neg();\n }\n\n return [\n { a: a1, b: b1 },\n { a: a2, b: b2 },\n ];\n};\n\nShortCurve.prototype._endoSplit = function _endoSplit(k) {\n var basis = this.endo.basis;\n var v1 = basis[0];\n var v2 = basis[1];\n\n var c1 = v2.b.mul(k).divRound(this.n);\n var c2 = v1.b.neg().mul(k).divRound(this.n);\n\n var p1 = c1.mul(v1.a);\n var p2 = c2.mul(v2.a);\n var q1 = c1.mul(v1.b);\n var q2 = c2.mul(v2.b);\n\n // Calculate answer\n var k1 = k.sub(p1).sub(p2);\n var k2 = q1.add(q2).neg();\n return { k1: k1, k2: k2 };\n};\n\nShortCurve.prototype.pointFromX = function pointFromX(x, odd) {\n x = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(x, 16);\n if (!x.red)\n x = x.toRed(this.red);\n\n var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);\n var y = y2.redSqrt();\n if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)\n throw new Error('invalid point');\n\n // XXX Is there any way to tell if the number is odd without converting it\n // to non-red form?\n var isOdd = y.fromRed().isOdd();\n if (odd && !isOdd || !odd && isOdd)\n y = y.redNeg();\n\n return this.point(x, y);\n};\n\nShortCurve.prototype.validate = function validate(point) {\n if (point.inf)\n return true;\n\n var x = point.x;\n var y = point.y;\n\n var ax = this.a.redMul(x);\n var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);\n return y.redSqr().redISub(rhs).cmpn(0) === 0;\n};\n\nShortCurve.prototype._endoWnafMulAdd =\n function _endoWnafMulAdd(points, coeffs, jacobianResult) {\n var npoints = this._endoWnafT1;\n var ncoeffs = this._endoWnafT2;\n for (var i = 0; i < points.length; i++) {\n var split = this._endoSplit(coeffs[i]);\n var p = points[i];\n var beta = p._getBeta();\n\n if (split.k1.negative) {\n split.k1.ineg();\n p = p.neg(true);\n }\n if (split.k2.negative) {\n split.k2.ineg();\n beta = beta.neg(true);\n }\n\n npoints[i * 2] = p;\n npoints[i * 2 + 1] = beta;\n ncoeffs[i * 2] = split.k1;\n ncoeffs[i * 2 + 1] = split.k2;\n }\n var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult);\n\n // Clean-up references to points and coefficients\n for (var j = 0; j < i * 2; j++) {\n npoints[j] = null;\n ncoeffs[j] = null;\n }\n return res;\n };\n\nfunction Point(curve, x, y, isRed) {\n base.BasePoint.call(this, curve, 'affine');\n if (x === null && y === null) {\n this.x = null;\n this.y = null;\n this.inf = true;\n } else {\n this.x = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(x, 16);\n this.y = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(y, 16);\n // Force redgomery representation when loading from JSON\n if (isRed) {\n this.x.forceRed(this.curve.red);\n this.y.forceRed(this.curve.red);\n }\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.y.red)\n this.y = this.y.toRed(this.curve.red);\n this.inf = false;\n }\n}\ninherits_browser(Point, base.BasePoint);\n\nShortCurve.prototype.point = function point(x, y, isRed) {\n return new Point(this, x, y, isRed);\n};\n\nShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) {\n return Point.fromJSON(this, obj, red);\n};\n\nPoint.prototype._getBeta = function _getBeta() {\n if (!this.curve.endo)\n return;\n\n var pre = this.precomputed;\n if (pre && pre.beta)\n return pre.beta;\n\n var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);\n if (pre) {\n var curve = this.curve;\n var endoMul = function(p) {\n return curve.point(p.x.redMul(curve.endo.beta), p.y);\n };\n pre.beta = beta;\n beta.precomputed = {\n beta: null,\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(endoMul),\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(endoMul),\n },\n };\n }\n return beta;\n};\n\nPoint.prototype.toJSON = function toJSON() {\n if (!this.precomputed)\n return [ this.x, this.y ];\n\n return [ this.x, this.y, this.precomputed && {\n doubles: this.precomputed.doubles && {\n step: this.precomputed.doubles.step,\n points: this.precomputed.doubles.points.slice(1),\n },\n naf: this.precomputed.naf && {\n wnd: this.precomputed.naf.wnd,\n points: this.precomputed.naf.points.slice(1),\n },\n } ];\n};\n\nPoint.fromJSON = function fromJSON(curve, obj, red) {\n if (typeof obj === 'string')\n obj = JSON.parse(obj);\n var res = curve.point(obj[0], obj[1], red);\n if (!obj[2])\n return res;\n\n function obj2point(obj) {\n return curve.point(obj[0], obj[1], red);\n }\n\n var pre = obj[2];\n res.precomputed = {\n beta: null,\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: [ res ].concat(pre.doubles.points.map(obj2point)),\n },\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: [ res ].concat(pre.naf.points.map(obj2point)),\n },\n };\n return res;\n};\n\nPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nPoint.prototype.isInfinity = function isInfinity() {\n return this.inf;\n};\n\nPoint.prototype.add = function add(p) {\n // O + P = P\n if (this.inf)\n return p;\n\n // P + O = P\n if (p.inf)\n return this;\n\n // P + P = 2P\n if (this.eq(p))\n return this.dbl();\n\n // P + (-P) = O\n if (this.neg().eq(p))\n return this.curve.point(null, null);\n\n // P + Q = O\n if (this.x.cmp(p.x) === 0)\n return this.curve.point(null, null);\n\n var c = this.y.redSub(p.y);\n if (c.cmpn(0) !== 0)\n c = c.redMul(this.x.redSub(p.x).redInvm());\n var nx = c.redSqr().redISub(this.x).redISub(p.x);\n var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n};\n\nPoint.prototype.dbl = function dbl() {\n if (this.inf)\n return this;\n\n // 2P = O\n var ys1 = this.y.redAdd(this.y);\n if (ys1.cmpn(0) === 0)\n return this.curve.point(null, null);\n\n var a = this.curve.a;\n\n var x2 = this.x.redSqr();\n var dyinv = ys1.redInvm();\n var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);\n\n var nx = c.redSqr().redISub(this.x.redAdd(this.x));\n var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n};\n\nPoint.prototype.getX = function getX() {\n return this.x.fromRed();\n};\n\nPoint.prototype.getY = function getY() {\n return this.y.fromRed();\n};\n\nPoint.prototype.mul = function mul(k) {\n k = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(k, 16);\n if (this.isInfinity())\n return this;\n else if (this._hasDoubles(k))\n return this.curve._fixedNafMul(this, k);\n else if (this.curve.endo)\n return this.curve._endoWnafMulAdd([ this ], [ k ]);\n else\n return this.curve._wnafMul(this, k);\n};\n\nPoint.prototype.mulAdd = function mulAdd(k1, p2, k2) {\n var points = [ this, p2 ];\n var coeffs = [ k1, k2 ];\n if (this.curve.endo)\n return this.curve._endoWnafMulAdd(points, coeffs);\n else\n return this.curve._wnafMulAdd(1, points, coeffs, 2);\n};\n\nPoint.prototype.jmulAdd = function jmulAdd(k1, p2, k2) {\n var points = [ this, p2 ];\n var coeffs = [ k1, k2 ];\n if (this.curve.endo)\n return this.curve._endoWnafMulAdd(points, coeffs, true);\n else\n return this.curve._wnafMulAdd(1, points, coeffs, 2, true);\n};\n\nPoint.prototype.eq = function eq(p) {\n return this === p ||\n this.inf === p.inf &&\n (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);\n};\n\nPoint.prototype.neg = function neg(_precompute) {\n if (this.inf)\n return this;\n\n var res = this.curve.point(this.x, this.y.redNeg());\n if (_precompute && this.precomputed) {\n var pre = this.precomputed;\n var negate = function(p) {\n return p.neg();\n };\n res.precomputed = {\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(negate),\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(negate),\n },\n };\n }\n return res;\n};\n\nPoint.prototype.toJ = function toJ() {\n if (this.inf)\n return this.curve.jpoint(null, null, null);\n\n var res = this.curve.jpoint(this.x, this.y, this.curve.one);\n return res;\n};\n\nfunction JPoint(curve, x, y, z) {\n base.BasePoint.call(this, curve, 'jacobian');\n if (x === null && y === null && z === null) {\n this.x = this.curve.one;\n this.y = this.curve.one;\n this.z = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(0);\n } else {\n this.x = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(x, 16);\n this.y = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(y, 16);\n this.z = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(z, 16);\n }\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.y.red)\n this.y = this.y.toRed(this.curve.red);\n if (!this.z.red)\n this.z = this.z.toRed(this.curve.red);\n\n this.zOne = this.z === this.curve.one;\n}\ninherits_browser(JPoint, base.BasePoint);\n\nShortCurve.prototype.jpoint = function jpoint(x, y, z) {\n return new JPoint(this, x, y, z);\n};\n\nJPoint.prototype.toP = function toP() {\n if (this.isInfinity())\n return this.curve.point(null, null);\n\n var zinv = this.z.redInvm();\n var zinv2 = zinv.redSqr();\n var ax = this.x.redMul(zinv2);\n var ay = this.y.redMul(zinv2).redMul(zinv);\n\n return this.curve.point(ax, ay);\n};\n\nJPoint.prototype.neg = function neg() {\n return this.curve.jpoint(this.x, this.y.redNeg(), this.z);\n};\n\nJPoint.prototype.add = function add(p) {\n // O + P = P\n if (this.isInfinity())\n return p;\n\n // P + O = P\n if (p.isInfinity())\n return this;\n\n // 12M + 4S + 7A\n var pz2 = p.z.redSqr();\n var z2 = this.z.redSqr();\n var u1 = this.x.redMul(pz2);\n var u2 = p.x.redMul(z2);\n var s1 = this.y.redMul(pz2.redMul(p.z));\n var s2 = p.y.redMul(z2.redMul(this.z));\n\n var h = u1.redSub(u2);\n var r = s1.redSub(s2);\n if (h.cmpn(0) === 0) {\n if (r.cmpn(0) !== 0)\n return this.curve.jpoint(null, null, null);\n else\n return this.dbl();\n }\n\n var h2 = h.redSqr();\n var h3 = h2.redMul(h);\n var v = u1.redMul(h2);\n\n var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);\n var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));\n var nz = this.z.redMul(p.z).redMul(h);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.mixedAdd = function mixedAdd(p) {\n // O + P = P\n if (this.isInfinity())\n return p.toJ();\n\n // P + O = P\n if (p.isInfinity())\n return this;\n\n // 8M + 3S + 7A\n var z2 = this.z.redSqr();\n var u1 = this.x;\n var u2 = p.x.redMul(z2);\n var s1 = this.y;\n var s2 = p.y.redMul(z2).redMul(this.z);\n\n var h = u1.redSub(u2);\n var r = s1.redSub(s2);\n if (h.cmpn(0) === 0) {\n if (r.cmpn(0) !== 0)\n return this.curve.jpoint(null, null, null);\n else\n return this.dbl();\n }\n\n var h2 = h.redSqr();\n var h3 = h2.redMul(h);\n var v = u1.redMul(h2);\n\n var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);\n var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));\n var nz = this.z.redMul(h);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.dblp = function dblp(pow) {\n if (pow === 0)\n return this;\n if (this.isInfinity())\n return this;\n if (!pow)\n return this.dbl();\n\n var i;\n if (this.curve.zeroA || this.curve.threeA) {\n var r = this;\n for (i = 0; i < pow; i++)\n r = r.dbl();\n return r;\n }\n\n // 1M + 2S + 1A + N * (4S + 5M + 8A)\n // N = 1 => 6M + 6S + 9A\n var a = this.curve.a;\n var tinv = this.curve.tinv;\n\n var jx = this.x;\n var jy = this.y;\n var jz = this.z;\n var jz4 = jz.redSqr().redSqr();\n\n // Reuse results\n var jyd = jy.redAdd(jy);\n for (i = 0; i < pow; i++) {\n var jx2 = jx.redSqr();\n var jyd2 = jyd.redSqr();\n var jyd4 = jyd2.redSqr();\n var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));\n\n var t1 = jx.redMul(jyd2);\n var nx = c.redSqr().redISub(t1.redAdd(t1));\n var t2 = t1.redISub(nx);\n var dny = c.redMul(t2);\n dny = dny.redIAdd(dny).redISub(jyd4);\n var nz = jyd.redMul(jz);\n if (i + 1 < pow)\n jz4 = jz4.redMul(jyd4);\n\n jx = nx;\n jz = nz;\n jyd = dny;\n }\n\n return this.curve.jpoint(jx, jyd.redMul(tinv), jz);\n};\n\nJPoint.prototype.dbl = function dbl() {\n if (this.isInfinity())\n return this;\n\n if (this.curve.zeroA)\n return this._zeroDbl();\n else if (this.curve.threeA)\n return this._threeDbl();\n else\n return this._dbl();\n};\n\nJPoint.prototype._zeroDbl = function _zeroDbl() {\n var nx;\n var ny;\n var nz;\n // Z = 1\n if (this.zOne) {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html\n // #doubling-mdbl-2007-bl\n // 1M + 5S + 14A\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // S = 2 * ((X1 + YY)^2 - XX - YYYY)\n var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s);\n // M = 3 * XX + a; a = 0\n var m = xx.redAdd(xx).redIAdd(xx);\n // T = M ^ 2 - 2*S\n var t = m.redSqr().redISub(s).redISub(s);\n\n // 8 * YYYY\n var yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n\n // X3 = T\n nx = t;\n // Y3 = M * (S - T) - 8 * YYYY\n ny = m.redMul(s.redISub(t)).redISub(yyyy8);\n // Z3 = 2*Y1\n nz = this.y.redAdd(this.y);\n } else {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html\n // #doubling-dbl-2009-l\n // 2M + 5S + 13A\n\n // A = X1^2\n var a = this.x.redSqr();\n // B = Y1^2\n var b = this.y.redSqr();\n // C = B^2\n var c = b.redSqr();\n // D = 2 * ((X1 + B)^2 - A - C)\n var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);\n d = d.redIAdd(d);\n // E = 3 * A\n var e = a.redAdd(a).redIAdd(a);\n // F = E^2\n var f = e.redSqr();\n\n // 8 * C\n var c8 = c.redIAdd(c);\n c8 = c8.redIAdd(c8);\n c8 = c8.redIAdd(c8);\n\n // X3 = F - 2 * D\n nx = f.redISub(d).redISub(d);\n // Y3 = E * (D - X3) - 8 * C\n ny = e.redMul(d.redISub(nx)).redISub(c8);\n // Z3 = 2 * Y1 * Z1\n nz = this.y.redMul(this.z);\n nz = nz.redIAdd(nz);\n }\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype._threeDbl = function _threeDbl() {\n var nx;\n var ny;\n var nz;\n // Z = 1\n if (this.zOne) {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html\n // #doubling-mdbl-2007-bl\n // 1M + 5S + 15A\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // S = 2 * ((X1 + YY)^2 - XX - YYYY)\n var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s);\n // M = 3 * XX + a\n var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a);\n // T = M^2 - 2 * S\n var t = m.redSqr().redISub(s).redISub(s);\n // X3 = T\n nx = t;\n // Y3 = M * (S - T) - 8 * YYYY\n var yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n ny = m.redMul(s.redISub(t)).redISub(yyyy8);\n // Z3 = 2 * Y1\n nz = this.y.redAdd(this.y);\n } else {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b\n // 3M + 5S\n\n // delta = Z1^2\n var delta = this.z.redSqr();\n // gamma = Y1^2\n var gamma = this.y.redSqr();\n // beta = X1 * gamma\n var beta = this.x.redMul(gamma);\n // alpha = 3 * (X1 - delta) * (X1 + delta)\n var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));\n alpha = alpha.redAdd(alpha).redIAdd(alpha);\n // X3 = alpha^2 - 8 * beta\n var beta4 = beta.redIAdd(beta);\n beta4 = beta4.redIAdd(beta4);\n var beta8 = beta4.redAdd(beta4);\n nx = alpha.redSqr().redISub(beta8);\n // Z3 = (Y1 + Z1)^2 - gamma - delta\n nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);\n // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2\n var ggamma8 = gamma.redSqr();\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);\n }\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype._dbl = function _dbl() {\n var a = this.curve.a;\n\n // 4M + 6S + 10A\n var jx = this.x;\n var jy = this.y;\n var jz = this.z;\n var jz4 = jz.redSqr().redSqr();\n\n var jx2 = jx.redSqr();\n var jy2 = jy.redSqr();\n\n var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));\n\n var jxd4 = jx.redAdd(jx);\n jxd4 = jxd4.redIAdd(jxd4);\n var t1 = jxd4.redMul(jy2);\n var nx = c.redSqr().redISub(t1.redAdd(t1));\n var t2 = t1.redISub(nx);\n\n var jyd8 = jy2.redSqr();\n jyd8 = jyd8.redIAdd(jyd8);\n jyd8 = jyd8.redIAdd(jyd8);\n jyd8 = jyd8.redIAdd(jyd8);\n var ny = c.redMul(t2).redISub(jyd8);\n var nz = jy.redAdd(jy).redMul(jz);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.trpl = function trpl() {\n if (!this.curve.zeroA)\n return this.dbl().add(this);\n\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl\n // 5M + 10S + ...\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // ZZ = Z1^2\n var zz = this.z.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // M = 3 * XX + a * ZZ2; a = 0\n var m = xx.redAdd(xx).redIAdd(xx);\n // MM = M^2\n var mm = m.redSqr();\n // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM\n var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n e = e.redIAdd(e);\n e = e.redAdd(e).redIAdd(e);\n e = e.redISub(mm);\n // EE = E^2\n var ee = e.redSqr();\n // T = 16*YYYY\n var t = yyyy.redIAdd(yyyy);\n t = t.redIAdd(t);\n t = t.redIAdd(t);\n t = t.redIAdd(t);\n // U = (M + E)^2 - MM - EE - T\n var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t);\n // X3 = 4 * (X1 * EE - 4 * YY * U)\n var yyu4 = yy.redMul(u);\n yyu4 = yyu4.redIAdd(yyu4);\n yyu4 = yyu4.redIAdd(yyu4);\n var nx = this.x.redMul(ee).redISub(yyu4);\n nx = nx.redIAdd(nx);\n nx = nx.redIAdd(nx);\n // Y3 = 8 * Y1 * (U * (T - U) - E * EE)\n var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));\n ny = ny.redIAdd(ny);\n ny = ny.redIAdd(ny);\n ny = ny.redIAdd(ny);\n // Z3 = (Z1 + E)^2 - ZZ - EE\n var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.mul = function mul(k, kbase) {\n k = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(k, kbase);\n\n return this.curve._wnafMul(this, k);\n};\n\nJPoint.prototype.eq = function eq(p) {\n if (p.type === 'affine')\n return this.eq(p.toJ());\n\n if (this === p)\n return true;\n\n // x1 * z2^2 == x2 * z1^2\n var z2 = this.z.redSqr();\n var pz2 = p.z.redSqr();\n if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0)\n return false;\n\n // y1 * z2^3 == y2 * z1^3\n var z3 = z2.redMul(this.z);\n var pz3 = pz2.redMul(p.z);\n return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;\n};\n\nJPoint.prototype.eqXToP = function eqXToP(x) {\n var zs = this.z.redSqr();\n var rx = x.toRed(this.curve.red).redMul(zs);\n if (this.x.cmp(rx) === 0)\n return true;\n\n var xc = x.clone();\n var t = this.curve.redN.redMul(zs);\n for (;;) {\n xc.iadd(this.curve.n);\n if (xc.cmp(this.curve.p) >= 0)\n return false;\n\n rx.redIAdd(t);\n if (this.x.cmp(rx) === 0)\n return true;\n }\n};\n\nJPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nJPoint.prototype.isInfinity = function isInfinity() {\n // XXX This code assumes that zero is always zero in red\n return this.z.cmpn(0) === 0;\n};\n\nvar curve_1 = createCommonjsModule(function (module, exports) {\n'use strict';\n\nvar curve = exports;\n\ncurve.base = base;\ncurve.short = short_1;\ncurve.mont = /*RicMoo:ethers:require(./mont)*/(null);\ncurve.edwards = /*RicMoo:ethers:require(./edwards)*/(null);\n});\n\nvar curves_1 = createCommonjsModule(function (module, exports) {\n'use strict';\n\nvar curves = exports;\n\n\n\n\n\nvar assert = utils_1$1.assert;\n\nfunction PresetCurve(options) {\n if (options.type === 'short')\n this.curve = new curve_1.short(options);\n else if (options.type === 'edwards')\n this.curve = new curve_1.edwards(options);\n else\n this.curve = new curve_1.mont(options);\n this.g = this.curve.g;\n this.n = this.curve.n;\n this.hash = options.hash;\n\n assert(this.g.validate(), 'Invalid curve');\n assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');\n}\ncurves.PresetCurve = PresetCurve;\n\nfunction defineCurve(name, options) {\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n get: function() {\n var curve = new PresetCurve(options);\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n value: curve,\n });\n return curve;\n },\n });\n}\n\ndefineCurve('p192', {\n type: 'short',\n prime: 'p192',\n p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',\n b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',\n n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',\n hash: (hash_js__WEBPACK_IMPORTED_MODULE_1___default().sha256),\n gRed: false,\n g: [\n '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012',\n '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811',\n ],\n});\n\ndefineCurve('p224', {\n type: 'short',\n prime: 'p224',\n p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',\n b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',\n n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',\n hash: (hash_js__WEBPACK_IMPORTED_MODULE_1___default().sha256),\n gRed: false,\n g: [\n 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21',\n 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34',\n ],\n});\n\ndefineCurve('p256', {\n type: 'short',\n prime: null,\n p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',\n a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',\n b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',\n n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',\n hash: (hash_js__WEBPACK_IMPORTED_MODULE_1___default().sha256),\n gRed: false,\n g: [\n '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296',\n '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5',\n ],\n});\n\ndefineCurve('p384', {\n type: 'short',\n prime: null,\n p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'fffffffe ffffffff 00000000 00000000 ffffffff',\n a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'fffffffe ffffffff 00000000 00000000 fffffffc',\n b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' +\n '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',\n n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' +\n 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',\n hash: (hash_js__WEBPACK_IMPORTED_MODULE_1___default().sha384),\n gRed: false,\n g: [\n 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' +\n '5502f25d bf55296c 3a545e38 72760ab7',\n '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' +\n '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f',\n ],\n});\n\ndefineCurve('p521', {\n type: 'short',\n prime: null,\n p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff',\n a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff fffffffc',\n b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' +\n '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' +\n '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',\n n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' +\n 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',\n hash: (hash_js__WEBPACK_IMPORTED_MODULE_1___default().sha512),\n gRed: false,\n g: [\n '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' +\n '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' +\n 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66',\n '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' +\n '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' +\n '3fad0761 353c7086 a272c240 88be9476 9fd16650',\n ],\n});\n\ndefineCurve('curve25519', {\n type: 'mont',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '76d06',\n b: '1',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: (hash_js__WEBPACK_IMPORTED_MODULE_1___default().sha256),\n gRed: false,\n g: [\n '9',\n ],\n});\n\ndefineCurve('ed25519', {\n type: 'edwards',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '-1',\n c: '1',\n // -121665 * (121666^(-1)) (mod P)\n d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: (hash_js__WEBPACK_IMPORTED_MODULE_1___default().sha256),\n gRed: false,\n g: [\n '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a',\n\n // 4/5\n '6666666666666666666666666666666666666666666666666666666666666658',\n ],\n});\n\nvar pre;\ntry {\n pre = /*RicMoo:ethers:require(./precomputed/secp256k1)*/(null).crash();\n} catch (e) {\n pre = undefined;\n}\n\ndefineCurve('secp256k1', {\n type: 'short',\n prime: 'k256',\n p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',\n a: '0',\n b: '7',\n n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',\n h: '1',\n hash: (hash_js__WEBPACK_IMPORTED_MODULE_1___default().sha256),\n\n // Precomputed endomorphism\n beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',\n lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',\n basis: [\n {\n a: '3086d221a7d46bcde86c90e49284eb15',\n b: '-e4437ed6010e88286f547fa90abfe4c3',\n },\n {\n a: '114ca50f7a8e2f3f657c1108d9d44cfd8',\n b: '3086d221a7d46bcde86c90e49284eb15',\n },\n ],\n\n gRed: false,\n g: [\n '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',\n '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',\n pre,\n ],\n});\n});\n\n'use strict';\n\n\n\n\n\nfunction HmacDRBG(options) {\n if (!(this instanceof HmacDRBG))\n return new HmacDRBG(options);\n this.hash = options.hash;\n this.predResist = !!options.predResist;\n\n this.outLen = this.hash.outSize;\n this.minEntropy = options.minEntropy || this.hash.hmacStrength;\n\n this._reseed = null;\n this.reseedInterval = null;\n this.K = null;\n this.V = null;\n\n var entropy = utils_1.toArray(options.entropy, options.entropyEnc || 'hex');\n var nonce = utils_1.toArray(options.nonce, options.nonceEnc || 'hex');\n var pers = utils_1.toArray(options.pers, options.persEnc || 'hex');\n minimalisticAssert(entropy.length >= (this.minEntropy / 8),\n 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');\n this._init(entropy, nonce, pers);\n}\nvar hmacDrbg = HmacDRBG;\n\nHmacDRBG.prototype._init = function init(entropy, nonce, pers) {\n var seed = entropy.concat(nonce).concat(pers);\n\n this.K = new Array(this.outLen / 8);\n this.V = new Array(this.outLen / 8);\n for (var i = 0; i < this.V.length; i++) {\n this.K[i] = 0x00;\n this.V[i] = 0x01;\n }\n\n this._update(seed);\n this._reseed = 1;\n this.reseedInterval = 0x1000000000000; // 2^48\n};\n\nHmacDRBG.prototype._hmac = function hmac() {\n return new (hash_js__WEBPACK_IMPORTED_MODULE_1___default().hmac)(this.hash, this.K);\n};\n\nHmacDRBG.prototype._update = function update(seed) {\n var kmac = this._hmac()\n .update(this.V)\n .update([ 0x00 ]);\n if (seed)\n kmac = kmac.update(seed);\n this.K = kmac.digest();\n this.V = this._hmac().update(this.V).digest();\n if (!seed)\n return;\n\n this.K = this._hmac()\n .update(this.V)\n .update([ 0x01 ])\n .update(seed)\n .digest();\n this.V = this._hmac().update(this.V).digest();\n};\n\nHmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) {\n // Optional entropy enc\n if (typeof entropyEnc !== 'string') {\n addEnc = add;\n add = entropyEnc;\n entropyEnc = null;\n }\n\n entropy = utils_1.toArray(entropy, entropyEnc);\n add = utils_1.toArray(add, addEnc);\n\n minimalisticAssert(entropy.length >= (this.minEntropy / 8),\n 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');\n\n this._update(entropy.concat(add || []));\n this._reseed = 1;\n};\n\nHmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) {\n if (this._reseed > this.reseedInterval)\n throw new Error('Reseed is required');\n\n // Optional encoding\n if (typeof enc !== 'string') {\n addEnc = add;\n add = enc;\n enc = null;\n }\n\n // Optional additional data\n if (add) {\n add = utils_1.toArray(add, addEnc || 'hex');\n this._update(add);\n }\n\n var temp = [];\n while (temp.length < len) {\n this.V = this._hmac().update(this.V).digest();\n temp = temp.concat(this.V);\n }\n\n var res = temp.slice(0, len);\n this._update(add);\n this._reseed++;\n return utils_1.encode(res, enc);\n};\n\n'use strict';\n\n\n\nvar assert$3 = utils_1$1.assert;\n\nfunction KeyPair(ec, options) {\n this.ec = ec;\n this.priv = null;\n this.pub = null;\n\n // KeyPair(ec, { priv: ..., pub: ... })\n if (options.priv)\n this._importPrivate(options.priv, options.privEnc);\n if (options.pub)\n this._importPublic(options.pub, options.pubEnc);\n}\nvar key = KeyPair;\n\nKeyPair.fromPublic = function fromPublic(ec, pub, enc) {\n if (pub instanceof KeyPair)\n return pub;\n\n return new KeyPair(ec, {\n pub: pub,\n pubEnc: enc,\n });\n};\n\nKeyPair.fromPrivate = function fromPrivate(ec, priv, enc) {\n if (priv instanceof KeyPair)\n return priv;\n\n return new KeyPair(ec, {\n priv: priv,\n privEnc: enc,\n });\n};\n\nKeyPair.prototype.validate = function validate() {\n var pub = this.getPublic();\n\n if (pub.isInfinity())\n return { result: false, reason: 'Invalid public key' };\n if (!pub.validate())\n return { result: false, reason: 'Public key is not a point' };\n if (!pub.mul(this.ec.curve.n).isInfinity())\n return { result: false, reason: 'Public key * N != O' };\n\n return { result: true, reason: null };\n};\n\nKeyPair.prototype.getPublic = function getPublic(compact, enc) {\n // compact is optional argument\n if (typeof compact === 'string') {\n enc = compact;\n compact = null;\n }\n\n if (!this.pub)\n this.pub = this.ec.g.mul(this.priv);\n\n if (!enc)\n return this.pub;\n\n return this.pub.encode(enc, compact);\n};\n\nKeyPair.prototype.getPrivate = function getPrivate(enc) {\n if (enc === 'hex')\n return this.priv.toString(16, 2);\n else\n return this.priv;\n};\n\nKeyPair.prototype._importPrivate = function _importPrivate(key, enc) {\n this.priv = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(key, enc || 16);\n\n // Ensure that the priv won't be bigger than n, otherwise we may fail\n // in fixed multiplication method\n this.priv = this.priv.umod(this.ec.curve.n);\n};\n\nKeyPair.prototype._importPublic = function _importPublic(key, enc) {\n if (key.x || key.y) {\n // Montgomery points only have an `x` coordinate.\n // Weierstrass/Edwards points on the other hand have both `x` and\n // `y` coordinates.\n if (this.ec.curve.type === 'mont') {\n assert$3(key.x, 'Need x coordinate');\n } else if (this.ec.curve.type === 'short' ||\n this.ec.curve.type === 'edwards') {\n assert$3(key.x && key.y, 'Need both x and y coordinate');\n }\n this.pub = this.ec.curve.point(key.x, key.y);\n return;\n }\n this.pub = this.ec.curve.decodePoint(key, enc);\n};\n\n// ECDH\nKeyPair.prototype.derive = function derive(pub) {\n if(!pub.validate()) {\n assert$3(pub.validate(), 'public point not validated');\n }\n return pub.mul(this.priv).getX();\n};\n\n// ECDSA\nKeyPair.prototype.sign = function sign(msg, enc, options) {\n return this.ec.sign(msg, this, enc, options);\n};\n\nKeyPair.prototype.verify = function verify(msg, signature) {\n return this.ec.verify(msg, signature, this);\n};\n\nKeyPair.prototype.inspect = function inspect() {\n return '';\n};\n\n'use strict';\n\n\n\n\nvar assert$4 = utils_1$1.assert;\n\nfunction Signature(options, enc) {\n if (options instanceof Signature)\n return options;\n\n if (this._importDER(options, enc))\n return;\n\n assert$4(options.r && options.s, 'Signature without r or s');\n this.r = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(options.r, 16);\n this.s = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(options.s, 16);\n if (options.recoveryParam === undefined)\n this.recoveryParam = null;\n else\n this.recoveryParam = options.recoveryParam;\n}\nvar signature = Signature;\n\nfunction Position() {\n this.place = 0;\n}\n\nfunction getLength(buf, p) {\n var initial = buf[p.place++];\n if (!(initial & 0x80)) {\n return initial;\n }\n var octetLen = initial & 0xf;\n\n // Indefinite length or overflow\n if (octetLen === 0 || octetLen > 4) {\n return false;\n }\n\n var val = 0;\n for (var i = 0, off = p.place; i < octetLen; i++, off++) {\n val <<= 8;\n val |= buf[off];\n val >>>= 0;\n }\n\n // Leading zeroes\n if (val <= 0x7f) {\n return false;\n }\n\n p.place = off;\n return val;\n}\n\nfunction rmPadding(buf) {\n var i = 0;\n var len = buf.length - 1;\n while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) {\n i++;\n }\n if (i === 0) {\n return buf;\n }\n return buf.slice(i);\n}\n\nSignature.prototype._importDER = function _importDER(data, enc) {\n data = utils_1$1.toArray(data, enc);\n var p = new Position();\n if (data[p.place++] !== 0x30) {\n return false;\n }\n var len = getLength(data, p);\n if (len === false) {\n return false;\n }\n if ((len + p.place) !== data.length) {\n return false;\n }\n if (data[p.place++] !== 0x02) {\n return false;\n }\n var rlen = getLength(data, p);\n if (rlen === false) {\n return false;\n }\n var r = data.slice(p.place, rlen + p.place);\n p.place += rlen;\n if (data[p.place++] !== 0x02) {\n return false;\n }\n var slen = getLength(data, p);\n if (slen === false) {\n return false;\n }\n if (data.length !== slen + p.place) {\n return false;\n }\n var s = data.slice(p.place, slen + p.place);\n if (r[0] === 0) {\n if (r[1] & 0x80) {\n r = r.slice(1);\n } else {\n // Leading zeroes\n return false;\n }\n }\n if (s[0] === 0) {\n if (s[1] & 0x80) {\n s = s.slice(1);\n } else {\n // Leading zeroes\n return false;\n }\n }\n\n this.r = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(r);\n this.s = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(s);\n this.recoveryParam = null;\n\n return true;\n};\n\nfunction constructLength(arr, len) {\n if (len < 0x80) {\n arr.push(len);\n return;\n }\n var octets = 1 + (Math.log(len) / Math.LN2 >>> 3);\n arr.push(octets | 0x80);\n while (--octets) {\n arr.push((len >>> (octets << 3)) & 0xff);\n }\n arr.push(len);\n}\n\nSignature.prototype.toDER = function toDER(enc) {\n var r = this.r.toArray();\n var s = this.s.toArray();\n\n // Pad values\n if (r[0] & 0x80)\n r = [ 0 ].concat(r);\n // Pad values\n if (s[0] & 0x80)\n s = [ 0 ].concat(s);\n\n r = rmPadding(r);\n s = rmPadding(s);\n\n while (!s[0] && !(s[1] & 0x80)) {\n s = s.slice(1);\n }\n var arr = [ 0x02 ];\n constructLength(arr, r.length);\n arr = arr.concat(r);\n arr.push(0x02);\n constructLength(arr, s.length);\n var backHalf = arr.concat(s);\n var res = [ 0x30 ];\n constructLength(res, backHalf.length);\n res = res.concat(backHalf);\n return utils_1$1.encode(res, enc);\n};\n\n'use strict';\n\n\n\n\n\nvar rand = /*RicMoo:ethers:require(brorand)*/(function() { throw new Error('unsupported'); });\nvar assert$5 = utils_1$1.assert;\n\n\n\n\nfunction EC(options) {\n if (!(this instanceof EC))\n return new EC(options);\n\n // Shortcut `elliptic.ec(curve-name)`\n if (typeof options === 'string') {\n assert$5(Object.prototype.hasOwnProperty.call(curves_1, options),\n 'Unknown curve ' + options);\n\n options = curves_1[options];\n }\n\n // Shortcut for `elliptic.ec(elliptic.curves.curveName)`\n if (options instanceof curves_1.PresetCurve)\n options = { curve: options };\n\n this.curve = options.curve.curve;\n this.n = this.curve.n;\n this.nh = this.n.ushrn(1);\n this.g = this.curve.g;\n\n // Point on curve\n this.g = options.curve.g;\n this.g.precompute(options.curve.n.bitLength() + 1);\n\n // Hash for function for DRBG\n this.hash = options.hash || options.curve.hash;\n}\nvar ec = EC;\n\nEC.prototype.keyPair = function keyPair(options) {\n return new key(this, options);\n};\n\nEC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) {\n return key.fromPrivate(this, priv, enc);\n};\n\nEC.prototype.keyFromPublic = function keyFromPublic(pub, enc) {\n return key.fromPublic(this, pub, enc);\n};\n\nEC.prototype.genKeyPair = function genKeyPair(options) {\n if (!options)\n options = {};\n\n // Instantiate Hmac_DRBG\n var drbg = new hmacDrbg({\n hash: this.hash,\n pers: options.pers,\n persEnc: options.persEnc || 'utf8',\n entropy: options.entropy || rand(this.hash.hmacStrength),\n entropyEnc: options.entropy && options.entropyEnc || 'utf8',\n nonce: this.n.toArray(),\n });\n\n var bytes = this.n.byteLength();\n var ns2 = this.n.sub(new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(2));\n for (;;) {\n var priv = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(drbg.generate(bytes));\n if (priv.cmp(ns2) > 0)\n continue;\n\n priv.iaddn(1);\n return this.keyFromPrivate(priv);\n }\n};\n\nEC.prototype._truncateToN = function _truncateToN(msg, truncOnly) {\n var delta = msg.byteLength() * 8 - this.n.bitLength();\n if (delta > 0)\n msg = msg.ushrn(delta);\n if (!truncOnly && msg.cmp(this.n) >= 0)\n return msg.sub(this.n);\n else\n return msg;\n};\n\nEC.prototype.sign = function sign(msg, key, enc, options) {\n if (typeof enc === 'object') {\n options = enc;\n enc = null;\n }\n if (!options)\n options = {};\n\n key = this.keyFromPrivate(key, enc);\n msg = this._truncateToN(new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(msg, 16));\n\n // Zero-extend key to provide enough entropy\n var bytes = this.n.byteLength();\n var bkey = key.getPrivate().toArray('be', bytes);\n\n // Zero-extend nonce to have the same byte size as N\n var nonce = msg.toArray('be', bytes);\n\n // Instantiate Hmac_DRBG\n var drbg = new hmacDrbg({\n hash: this.hash,\n entropy: bkey,\n nonce: nonce,\n pers: options.pers,\n persEnc: options.persEnc || 'utf8',\n });\n\n // Number of bytes to generate\n var ns1 = this.n.sub(new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(1));\n\n for (var iter = 0; ; iter++) {\n var k = options.k ?\n options.k(iter) :\n new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(drbg.generate(this.n.byteLength()));\n k = this._truncateToN(k, true);\n if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0)\n continue;\n\n var kp = this.g.mul(k);\n if (kp.isInfinity())\n continue;\n\n var kpX = kp.getX();\n var r = kpX.umod(this.n);\n if (r.cmpn(0) === 0)\n continue;\n\n var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));\n s = s.umod(this.n);\n if (s.cmpn(0) === 0)\n continue;\n\n var recoveryParam = (kp.getY().isOdd() ? 1 : 0) |\n (kpX.cmp(r) !== 0 ? 2 : 0);\n\n // Use complement of `s`, if it is > `n / 2`\n if (options.canonical && s.cmp(this.nh) > 0) {\n s = this.n.sub(s);\n recoveryParam ^= 1;\n }\n\n return new signature({ r: r, s: s, recoveryParam: recoveryParam });\n }\n};\n\nEC.prototype.verify = function verify(msg, signature$1, key, enc) {\n msg = this._truncateToN(new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(msg, 16));\n key = this.keyFromPublic(key, enc);\n signature$1 = new signature(signature$1, 'hex');\n\n // Perform primitive values validation\n var r = signature$1.r;\n var s = signature$1.s;\n if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0)\n return false;\n if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0)\n return false;\n\n // Validate signature\n var sinv = s.invm(this.n);\n var u1 = sinv.mul(msg).umod(this.n);\n var u2 = sinv.mul(r).umod(this.n);\n var p;\n\n if (!this.curve._maxwellTrick) {\n p = this.g.mulAdd(u1, key.getPublic(), u2);\n if (p.isInfinity())\n return false;\n\n return p.getX().umod(this.n).cmp(r) === 0;\n }\n\n // NOTE: Greg Maxwell's trick, inspired by:\n // https://git.io/vad3K\n\n p = this.g.jmulAdd(u1, key.getPublic(), u2);\n if (p.isInfinity())\n return false;\n\n // Compare `p.x` of Jacobian point with `r`,\n // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the\n // inverse of `p.z^2`\n return p.eqXToP(r);\n};\n\nEC.prototype.recoverPubKey = function(msg, signature$1, j, enc) {\n assert$5((3 & j) === j, 'The recovery param is more than two bits');\n signature$1 = new signature(signature$1, enc);\n\n var n = this.n;\n var e = new (bn_js__WEBPACK_IMPORTED_MODULE_0___default())(msg);\n var r = signature$1.r;\n var s = signature$1.s;\n\n // A set LSB signifies that the y-coordinate is odd\n var isYOdd = j & 1;\n var isSecondKey = j >> 1;\n if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey)\n throw new Error('Unable to find sencond key candinate');\n\n // 1.1. Let x = r + jn.\n if (isSecondKey)\n r = this.curve.pointFromX(r.add(this.curve.n), isYOdd);\n else\n r = this.curve.pointFromX(r, isYOdd);\n\n var rInv = signature$1.r.invm(n);\n var s1 = n.sub(e).mul(rInv).umod(n);\n var s2 = s.mul(rInv).umod(n);\n\n // 1.6.1 Compute Q = r^-1 (sR - eG)\n // Q = r^-1 (sR + -eG)\n return this.g.mulAdd(s1, r, s2);\n};\n\nEC.prototype.getKeyRecoveryParam = function(e, signature$1, Q, enc) {\n signature$1 = new signature(signature$1, enc);\n if (signature$1.recoveryParam !== null)\n return signature$1.recoveryParam;\n\n for (var i = 0; i < 4; i++) {\n var Qprime;\n try {\n Qprime = this.recoverPubKey(e, signature$1, i);\n } catch (e) {\n continue;\n }\n\n if (Qprime.eq(Q))\n return i;\n }\n throw new Error('Unable to find valid recovery factor');\n};\n\nvar elliptic_1 = createCommonjsModule(function (module, exports) {\n'use strict';\n\nvar elliptic = exports;\n\nelliptic.version = /*RicMoo:ethers*/{ version: \"6.5.4\" }.version;\nelliptic.utils = utils_1$1;\nelliptic.rand = /*RicMoo:ethers:require(brorand)*/(function() { throw new Error('unsupported'); });\nelliptic.curve = curve_1;\nelliptic.curves = curves_1;\n\n// Protocols\nelliptic.ec = ec;\nelliptic.eddsa = /*RicMoo:ethers:require(./elliptic/eddsa)*/(null);\n});\n\nvar EC$1 = elliptic_1.ec;\n\n\n//# sourceMappingURL=elliptic.js.map\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@ethersproject/signing-key/lib.esm/elliptic.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/signing-key/lib.esm/index.js": -/*!******************************************************************!*\ - !*** ./node_modules/@ethersproject/signing-key/lib.esm/index.js ***! - \******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SigningKey: () => (/* binding */ SigningKey),\n/* harmony export */ computePublicKey: () => (/* binding */ computePublicKey),\n/* harmony export */ recoverPublicKey: () => (/* binding */ recoverPublicKey)\n/* harmony export */ });\n/* harmony import */ var _elliptic__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./elliptic */ \"./node_modules/@ethersproject/signing-key/lib.esm/elliptic.js\");\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/properties */ \"./node_modules/@ethersproject/properties/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/signing-key/lib.esm/_version.js\");\n\n\n\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\nlet _curve = null;\nfunction getCurve() {\n if (!_curve) {\n _curve = new _elliptic__WEBPACK_IMPORTED_MODULE_2__.EC(\"secp256k1\");\n }\n return _curve;\n}\nclass SigningKey {\n constructor(privateKey) {\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"curve\", \"secp256k1\");\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"privateKey\", (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexlify)(privateKey));\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexDataLength)(this.privateKey) !== 32) {\n logger.throwArgumentError(\"invalid private key\", \"privateKey\", \"[[ REDACTED ]]\");\n }\n const keyPair = getCurve().keyFromPrivate((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(this.privateKey));\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"publicKey\", \"0x\" + keyPair.getPublic(false, \"hex\"));\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"compressedPublicKey\", \"0x\" + keyPair.getPublic(true, \"hex\"));\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, \"_isSigningKey\", true);\n }\n _addPoint(other) {\n const p0 = getCurve().keyFromPublic((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(this.publicKey));\n const p1 = getCurve().keyFromPublic((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(other));\n return \"0x\" + p0.pub.add(p1.pub).encodeCompressed(\"hex\");\n }\n signDigest(digest) {\n const keyPair = getCurve().keyFromPrivate((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(this.privateKey));\n const digestBytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(digest);\n if (digestBytes.length !== 32) {\n logger.throwArgumentError(\"bad digest length\", \"digest\", digest);\n }\n const signature = keyPair.sign(digestBytes, { canonical: true });\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.splitSignature)({\n recoveryParam: signature.recoveryParam,\n r: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexZeroPad)(\"0x\" + signature.r.toString(16), 32),\n s: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexZeroPad)(\"0x\" + signature.s.toString(16), 32),\n });\n }\n computeSharedSecret(otherKey) {\n const keyPair = getCurve().keyFromPrivate((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(this.privateKey));\n const otherKeyPair = getCurve().keyFromPublic((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(computePublicKey(otherKey)));\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexZeroPad)(\"0x\" + keyPair.derive(otherKeyPair.getPublic()).toString(16), 32);\n }\n static isSigningKey(value) {\n return !!(value && value._isSigningKey);\n }\n}\nfunction recoverPublicKey(digest, signature) {\n const sig = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.splitSignature)(signature);\n const rs = { r: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(sig.r), s: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(sig.s) };\n return \"0x\" + getCurve().recoverPubKey((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(digest), rs, sig.recoveryParam).encode(\"hex\", false);\n}\nfunction computePublicKey(key, compressed) {\n const bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.arrayify)(key);\n if (bytes.length === 32) {\n const signingKey = new SigningKey(bytes);\n if (compressed) {\n return \"0x\" + getCurve().keyFromPrivate(bytes).getPublic(true, \"hex\");\n }\n return signingKey.publicKey;\n }\n else if (bytes.length === 33) {\n if (compressed) {\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexlify)(bytes);\n }\n return \"0x\" + getCurve().keyFromPublic(bytes).getPublic(false, \"hex\");\n }\n else if (bytes.length === 65) {\n if (!compressed) {\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__.hexlify)(bytes);\n }\n return \"0x\" + getCurve().keyFromPublic(bytes).getPublic(true, \"hex\");\n }\n return logger.throwArgumentError(\"invalid public or private key\", \"key\", \"[REDACTED]\");\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@ethersproject/signing-key/lib.esm/index.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/strings/lib.esm/_version.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@ethersproject/strings/lib.esm/_version.js ***! - \*****************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ version: () => (/* binding */ version)\n/* harmony export */ });\nconst version = \"strings/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@ethersproject/strings/lib.esm/_version.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/strings/lib.esm/utf8.js": -/*!*************************************************************!*\ - !*** ./node_modules/@ethersproject/strings/lib.esm/utf8.js ***! - \*************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ UnicodeNormalizationForm: () => (/* binding */ UnicodeNormalizationForm),\n/* harmony export */ Utf8ErrorFuncs: () => (/* binding */ Utf8ErrorFuncs),\n/* harmony export */ Utf8ErrorReason: () => (/* binding */ Utf8ErrorReason),\n/* harmony export */ _toEscapedUtf8String: () => (/* binding */ _toEscapedUtf8String),\n/* harmony export */ _toUtf8String: () => (/* binding */ _toUtf8String),\n/* harmony export */ toUtf8Bytes: () => (/* binding */ toUtf8Bytes),\n/* harmony export */ toUtf8CodePoints: () => (/* binding */ toUtf8CodePoints),\n/* harmony export */ toUtf8String: () => (/* binding */ toUtf8String)\n/* harmony export */ });\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/strings/lib.esm/_version.js\");\n\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\n///////////////////////////////\nvar UnicodeNormalizationForm;\n(function (UnicodeNormalizationForm) {\n UnicodeNormalizationForm[\"current\"] = \"\";\n UnicodeNormalizationForm[\"NFC\"] = \"NFC\";\n UnicodeNormalizationForm[\"NFD\"] = \"NFD\";\n UnicodeNormalizationForm[\"NFKC\"] = \"NFKC\";\n UnicodeNormalizationForm[\"NFKD\"] = \"NFKD\";\n})(UnicodeNormalizationForm || (UnicodeNormalizationForm = {}));\n;\nvar Utf8ErrorReason;\n(function (Utf8ErrorReason) {\n // A continuation byte was present where there was nothing to continue\n // - offset = the index the codepoint began in\n Utf8ErrorReason[\"UNEXPECTED_CONTINUE\"] = \"unexpected continuation byte\";\n // An invalid (non-continuation) byte to start a UTF-8 codepoint was found\n // - offset = the index the codepoint began in\n Utf8ErrorReason[\"BAD_PREFIX\"] = \"bad codepoint prefix\";\n // The string is too short to process the expected codepoint\n // - offset = the index the codepoint began in\n Utf8ErrorReason[\"OVERRUN\"] = \"string overrun\";\n // A missing continuation byte was expected but not found\n // - offset = the index the continuation byte was expected at\n Utf8ErrorReason[\"MISSING_CONTINUE\"] = \"missing continuation byte\";\n // The computed code point is outside the range for UTF-8\n // - offset = start of this codepoint\n // - badCodepoint = the computed codepoint; outside the UTF-8 range\n Utf8ErrorReason[\"OUT_OF_RANGE\"] = \"out of UTF-8 range\";\n // UTF-8 strings may not contain UTF-16 surrogate pairs\n // - offset = start of this codepoint\n // - badCodepoint = the computed codepoint; inside the UTF-16 surrogate range\n Utf8ErrorReason[\"UTF16_SURROGATE\"] = \"UTF-16 surrogate\";\n // The string is an overlong representation\n // - offset = start of this codepoint\n // - badCodepoint = the computed codepoint; already bounds checked\n Utf8ErrorReason[\"OVERLONG\"] = \"overlong representation\";\n})(Utf8ErrorReason || (Utf8ErrorReason = {}));\n;\nfunction errorFunc(reason, offset, bytes, output, badCodepoint) {\n return logger.throwArgumentError(`invalid codepoint at offset ${offset}; ${reason}`, \"bytes\", bytes);\n}\nfunction ignoreFunc(reason, offset, bytes, output, badCodepoint) {\n // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes\n if (reason === Utf8ErrorReason.BAD_PREFIX || reason === Utf8ErrorReason.UNEXPECTED_CONTINUE) {\n let i = 0;\n for (let o = offset + 1; o < bytes.length; o++) {\n if (bytes[o] >> 6 !== 0x02) {\n break;\n }\n i++;\n }\n return i;\n }\n // This byte runs us past the end of the string, so just jump to the end\n // (but the first byte was read already read and therefore skipped)\n if (reason === Utf8ErrorReason.OVERRUN) {\n return bytes.length - offset - 1;\n }\n // Nothing to skip\n return 0;\n}\nfunction replaceFunc(reason, offset, bytes, output, badCodepoint) {\n // Overlong representations are otherwise \"valid\" code points; just non-deistingtished\n if (reason === Utf8ErrorReason.OVERLONG) {\n output.push(badCodepoint);\n return 0;\n }\n // Put the replacement character into the output\n output.push(0xfffd);\n // Otherwise, process as if ignoring errors\n return ignoreFunc(reason, offset, bytes, output, badCodepoint);\n}\n// Common error handing strategies\nconst Utf8ErrorFuncs = Object.freeze({\n error: errorFunc,\n ignore: ignoreFunc,\n replace: replaceFunc\n});\n// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499\nfunction getUtf8CodePoints(bytes, onError) {\n if (onError == null) {\n onError = Utf8ErrorFuncs.error;\n }\n bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(bytes);\n const result = [];\n let i = 0;\n // Invalid bytes are ignored\n while (i < bytes.length) {\n const c = bytes[i++];\n // 0xxx xxxx\n if (c >> 7 === 0) {\n result.push(c);\n continue;\n }\n // Multibyte; how many bytes left for this character?\n let extraLength = null;\n let overlongMask = null;\n // 110x xxxx 10xx xxxx\n if ((c & 0xe0) === 0xc0) {\n extraLength = 1;\n overlongMask = 0x7f;\n // 1110 xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf0) === 0xe0) {\n extraLength = 2;\n overlongMask = 0x7ff;\n // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf8) === 0xf0) {\n extraLength = 3;\n overlongMask = 0xffff;\n }\n else {\n if ((c & 0xc0) === 0x80) {\n i += onError(Utf8ErrorReason.UNEXPECTED_CONTINUE, i - 1, bytes, result);\n }\n else {\n i += onError(Utf8ErrorReason.BAD_PREFIX, i - 1, bytes, result);\n }\n continue;\n }\n // Do we have enough bytes in our data?\n if (i - 1 + extraLength >= bytes.length) {\n i += onError(Utf8ErrorReason.OVERRUN, i - 1, bytes, result);\n continue;\n }\n // Remove the length prefix from the char\n let res = c & ((1 << (8 - extraLength - 1)) - 1);\n for (let j = 0; j < extraLength; j++) {\n let nextChar = bytes[i];\n // Invalid continuation byte\n if ((nextChar & 0xc0) != 0x80) {\n i += onError(Utf8ErrorReason.MISSING_CONTINUE, i, bytes, result);\n res = null;\n break;\n }\n ;\n res = (res << 6) | (nextChar & 0x3f);\n i++;\n }\n // See above loop for invalid continuation byte\n if (res === null) {\n continue;\n }\n // Maximum code point\n if (res > 0x10ffff) {\n i += onError(Utf8ErrorReason.OUT_OF_RANGE, i - 1 - extraLength, bytes, result, res);\n continue;\n }\n // Reserved for UTF-16 surrogate halves\n if (res >= 0xd800 && res <= 0xdfff) {\n i += onError(Utf8ErrorReason.UTF16_SURROGATE, i - 1 - extraLength, bytes, result, res);\n continue;\n }\n // Check for overlong sequences (more bytes than needed)\n if (res <= overlongMask) {\n i += onError(Utf8ErrorReason.OVERLONG, i - 1 - extraLength, bytes, result, res);\n continue;\n }\n result.push(res);\n }\n return result;\n}\n// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array\nfunction toUtf8Bytes(str, form = UnicodeNormalizationForm.current) {\n if (form != UnicodeNormalizationForm.current) {\n logger.checkNormalize();\n str = str.normalize(form);\n }\n let result = [];\n for (let i = 0; i < str.length; i++) {\n const c = str.charCodeAt(i);\n if (c < 0x80) {\n result.push(c);\n }\n else if (c < 0x800) {\n result.push((c >> 6) | 0xc0);\n result.push((c & 0x3f) | 0x80);\n }\n else if ((c & 0xfc00) == 0xd800) {\n i++;\n const c2 = str.charCodeAt(i);\n if (i >= str.length || (c2 & 0xfc00) !== 0xdc00) {\n throw new Error(\"invalid utf-8 string\");\n }\n // Surrogate Pair\n const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff);\n result.push((pair >> 18) | 0xf0);\n result.push(((pair >> 12) & 0x3f) | 0x80);\n result.push(((pair >> 6) & 0x3f) | 0x80);\n result.push((pair & 0x3f) | 0x80);\n }\n else {\n result.push((c >> 12) | 0xe0);\n result.push(((c >> 6) & 0x3f) | 0x80);\n result.push((c & 0x3f) | 0x80);\n }\n }\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.arrayify)(result);\n}\n;\nfunction escapeChar(value) {\n const hex = (\"0000\" + value.toString(16));\n return \"\\\\u\" + hex.substring(hex.length - 4);\n}\nfunction _toEscapedUtf8String(bytes, onError) {\n return '\"' + getUtf8CodePoints(bytes, onError).map((codePoint) => {\n if (codePoint < 256) {\n switch (codePoint) {\n case 8: return \"\\\\b\";\n case 9: return \"\\\\t\";\n case 10: return \"\\\\n\";\n case 13: return \"\\\\r\";\n case 34: return \"\\\\\\\"\";\n case 92: return \"\\\\\\\\\";\n }\n if (codePoint >= 32 && codePoint < 127) {\n return String.fromCharCode(codePoint);\n }\n }\n if (codePoint <= 0xffff) {\n return escapeChar(codePoint);\n }\n codePoint -= 0x10000;\n return escapeChar(((codePoint >> 10) & 0x3ff) + 0xd800) + escapeChar((codePoint & 0x3ff) + 0xdc00);\n }).join(\"\") + '\"';\n}\nfunction _toUtf8String(codePoints) {\n return codePoints.map((codePoint) => {\n if (codePoint <= 0xffff) {\n return String.fromCharCode(codePoint);\n }\n codePoint -= 0x10000;\n return String.fromCharCode((((codePoint >> 10) & 0x3ff) + 0xd800), ((codePoint & 0x3ff) + 0xdc00));\n }).join(\"\");\n}\nfunction toUtf8String(bytes, onError) {\n return _toUtf8String(getUtf8CodePoints(bytes, onError));\n}\nfunction toUtf8CodePoints(str, form = UnicodeNormalizationForm.current) {\n return getUtf8CodePoints(toUtf8Bytes(str, form));\n}\n//# sourceMappingURL=utf8.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@ethersproject/strings/lib.esm/utf8.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/transactions/lib.esm/_version.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@ethersproject/transactions/lib.esm/_version.js ***! - \**********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ version: () => (/* binding */ version)\n/* harmony export */ });\nconst version = \"transactions/5.7.0\";\n//# sourceMappingURL=_version.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@ethersproject/transactions/lib.esm/_version.js?"); - -/***/ }), - -/***/ "./node_modules/@ethersproject/transactions/lib.esm/index.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@ethersproject/transactions/lib.esm/index.js ***! - \*******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TransactionTypes: () => (/* binding */ TransactionTypes),\n/* harmony export */ accessListify: () => (/* binding */ accessListify),\n/* harmony export */ computeAddress: () => (/* binding */ computeAddress),\n/* harmony export */ parse: () => (/* binding */ parse),\n/* harmony export */ recoverAddress: () => (/* binding */ recoverAddress),\n/* harmony export */ serialize: () => (/* binding */ serialize)\n/* harmony export */ });\n/* harmony import */ var _ethersproject_address__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/address */ \"./node_modules/@ethersproject/address/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/bignumber */ \"./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js\");\n/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @ethersproject/bytes */ \"./node_modules/@ethersproject/bytes/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/constants */ \"./node_modules/@ethersproject/constants/lib.esm/bignumbers.js\");\n/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @ethersproject/keccak256 */ \"./node_modules/@ethersproject/keccak256/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @ethersproject/properties */ \"./node_modules/@ethersproject/properties/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @ethersproject/rlp */ \"./node_modules/@ethersproject/rlp/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_signing_key__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/signing-key */ \"./node_modules/@ethersproject/signing-key/lib.esm/index.js\");\n/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ \"./node_modules/@ethersproject/logger/lib.esm/index.js\");\n/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ \"./node_modules/@ethersproject/transactions/lib.esm/_version.js\");\n\n\n\n\n\n\n\n\n\n\n\nconst logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__.version);\nvar TransactionTypes;\n(function (TransactionTypes) {\n TransactionTypes[TransactionTypes[\"legacy\"] = 0] = \"legacy\";\n TransactionTypes[TransactionTypes[\"eip2930\"] = 1] = \"eip2930\";\n TransactionTypes[TransactionTypes[\"eip1559\"] = 2] = \"eip1559\";\n})(TransactionTypes || (TransactionTypes = {}));\n;\n///////////////////////////////\nfunction handleAddress(value) {\n if (value === \"0x\") {\n return null;\n }\n return (0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_2__.getAddress)(value);\n}\nfunction handleNumber(value) {\n if (value === \"0x\") {\n return _ethersproject_constants__WEBPACK_IMPORTED_MODULE_3__.Zero;\n }\n return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__.BigNumber.from(value);\n}\n// Legacy Transaction Fields\nconst transactionFields = [\n { name: \"nonce\", maxLength: 32, numeric: true },\n { name: \"gasPrice\", maxLength: 32, numeric: true },\n { name: \"gasLimit\", maxLength: 32, numeric: true },\n { name: \"to\", length: 20 },\n { name: \"value\", maxLength: 32, numeric: true },\n { name: \"data\" },\n];\nconst allowedTransactionKeys = {\n chainId: true, data: true, gasLimit: true, gasPrice: true, nonce: true, to: true, type: true, value: true\n};\nfunction computeAddress(key) {\n const publicKey = (0,_ethersproject_signing_key__WEBPACK_IMPORTED_MODULE_5__.computePublicKey)(key);\n return (0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_2__.getAddress)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexDataSlice)((0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_7__.keccak256)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexDataSlice)(publicKey, 1)), 12));\n}\nfunction recoverAddress(digest, signature) {\n return computeAddress((0,_ethersproject_signing_key__WEBPACK_IMPORTED_MODULE_5__.recoverPublicKey)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(digest), signature));\n}\nfunction formatNumber(value, name) {\n const result = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.stripZeros)(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__.BigNumber.from(value).toHexString());\n if (result.length > 32) {\n logger.throwArgumentError(\"invalid length for \" + name, (\"transaction:\" + name), value);\n }\n return result;\n}\nfunction accessSetify(addr, storageKeys) {\n return {\n address: (0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_2__.getAddress)(addr),\n storageKeys: (storageKeys || []).map((storageKey, index) => {\n if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexDataLength)(storageKey) !== 32) {\n logger.throwArgumentError(\"invalid access list storageKey\", `accessList[${addr}:${index}]`, storageKey);\n }\n return storageKey.toLowerCase();\n })\n };\n}\nfunction accessListify(value) {\n if (Array.isArray(value)) {\n return value.map((set, index) => {\n if (Array.isArray(set)) {\n if (set.length > 2) {\n logger.throwArgumentError(\"access list expected to be [ address, storageKeys[] ]\", `value[${index}]`, set);\n }\n return accessSetify(set[0], set[1]);\n }\n return accessSetify(set.address, set.storageKeys);\n });\n }\n const result = Object.keys(value).map((addr) => {\n const storageKeys = value[addr].reduce((accum, storageKey) => {\n accum[storageKey] = true;\n return accum;\n }, {});\n return accessSetify(addr, Object.keys(storageKeys).sort());\n });\n result.sort((a, b) => (a.address.localeCompare(b.address)));\n return result;\n}\nfunction formatAccessList(value) {\n return accessListify(value).map((set) => [set.address, set.storageKeys]);\n}\nfunction _serializeEip1559(transaction, signature) {\n // If there is an explicit gasPrice, make sure it matches the\n // EIP-1559 fees; otherwise they may not understand what they\n // think they are setting in terms of fee.\n if (transaction.gasPrice != null) {\n const gasPrice = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__.BigNumber.from(transaction.gasPrice);\n const maxFeePerGas = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__.BigNumber.from(transaction.maxFeePerGas || 0);\n if (!gasPrice.eq(maxFeePerGas)) {\n logger.throwArgumentError(\"mismatch EIP-1559 gasPrice != maxFeePerGas\", \"tx\", {\n gasPrice, maxFeePerGas\n });\n }\n }\n const fields = [\n formatNumber(transaction.chainId || 0, \"chainId\"),\n formatNumber(transaction.nonce || 0, \"nonce\"),\n formatNumber(transaction.maxPriorityFeePerGas || 0, \"maxPriorityFeePerGas\"),\n formatNumber(transaction.maxFeePerGas || 0, \"maxFeePerGas\"),\n formatNumber(transaction.gasLimit || 0, \"gasLimit\"),\n ((transaction.to != null) ? (0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_2__.getAddress)(transaction.to) : \"0x\"),\n formatNumber(transaction.value || 0, \"value\"),\n (transaction.data || \"0x\"),\n (formatAccessList(transaction.accessList || []))\n ];\n if (signature) {\n const sig = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.splitSignature)(signature);\n fields.push(formatNumber(sig.recoveryParam, \"recoveryParam\"));\n fields.push((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.stripZeros)(sig.r));\n fields.push((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.stripZeros)(sig.s));\n }\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexConcat)([\"0x02\", _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_8__.encode(fields)]);\n}\nfunction _serializeEip2930(transaction, signature) {\n const fields = [\n formatNumber(transaction.chainId || 0, \"chainId\"),\n formatNumber(transaction.nonce || 0, \"nonce\"),\n formatNumber(transaction.gasPrice || 0, \"gasPrice\"),\n formatNumber(transaction.gasLimit || 0, \"gasLimit\"),\n ((transaction.to != null) ? (0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_2__.getAddress)(transaction.to) : \"0x\"),\n formatNumber(transaction.value || 0, \"value\"),\n (transaction.data || \"0x\"),\n (formatAccessList(transaction.accessList || []))\n ];\n if (signature) {\n const sig = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.splitSignature)(signature);\n fields.push(formatNumber(sig.recoveryParam, \"recoveryParam\"));\n fields.push((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.stripZeros)(sig.r));\n fields.push((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.stripZeros)(sig.s));\n }\n return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexConcat)([\"0x01\", _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_8__.encode(fields)]);\n}\n// Legacy Transactions and EIP-155\nfunction _serialize(transaction, signature) {\n (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_9__.checkProperties)(transaction, allowedTransactionKeys);\n const raw = [];\n transactionFields.forEach(function (fieldInfo) {\n let value = transaction[fieldInfo.name] || ([]);\n const options = {};\n if (fieldInfo.numeric) {\n options.hexPad = \"left\";\n }\n value = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(value, options));\n // Fixed-width field\n if (fieldInfo.length && value.length !== fieldInfo.length && value.length > 0) {\n logger.throwArgumentError(\"invalid length for \" + fieldInfo.name, (\"transaction:\" + fieldInfo.name), value);\n }\n // Variable-width (with a maximum)\n if (fieldInfo.maxLength) {\n value = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.stripZeros)(value);\n if (value.length > fieldInfo.maxLength) {\n logger.throwArgumentError(\"invalid length for \" + fieldInfo.name, (\"transaction:\" + fieldInfo.name), value);\n }\n }\n raw.push((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(value));\n });\n let chainId = 0;\n if (transaction.chainId != null) {\n // A chainId was provided; if non-zero we'll use EIP-155\n chainId = transaction.chainId;\n if (typeof (chainId) !== \"number\") {\n logger.throwArgumentError(\"invalid transaction.chainId\", \"transaction\", transaction);\n }\n }\n else if (signature && !(0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.isBytesLike)(signature) && signature.v > 28) {\n // No chainId provided, but the signature is signing with EIP-155; derive chainId\n chainId = Math.floor((signature.v - 35) / 2);\n }\n // We have an EIP-155 transaction (chainId was specified and non-zero)\n if (chainId !== 0) {\n raw.push((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(chainId)); // @TODO: hexValue?\n raw.push(\"0x\");\n raw.push(\"0x\");\n }\n // Requesting an unsigned transaction\n if (!signature) {\n return _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_8__.encode(raw);\n }\n // The splitSignature will ensure the transaction has a recoveryParam in the\n // case that the signTransaction function only adds a v.\n const sig = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.splitSignature)(signature);\n // We pushed a chainId and null r, s on for hashing only; remove those\n let v = 27 + sig.recoveryParam;\n if (chainId !== 0) {\n raw.pop();\n raw.pop();\n raw.pop();\n v += chainId * 2 + 8;\n // If an EIP-155 v (directly or indirectly; maybe _vs) was provided, check it!\n if (sig.v > 28 && sig.v !== v) {\n logger.throwArgumentError(\"transaction.chainId/signature.v mismatch\", \"signature\", signature);\n }\n }\n else if (sig.v !== v) {\n logger.throwArgumentError(\"transaction.chainId/signature.v mismatch\", \"signature\", signature);\n }\n raw.push((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(v));\n raw.push((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.stripZeros)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(sig.r)));\n raw.push((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.stripZeros)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(sig.s)));\n return _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_8__.encode(raw);\n}\nfunction serialize(transaction, signature) {\n // Legacy and EIP-155 Transactions\n if (transaction.type == null || transaction.type === 0) {\n if (transaction.accessList != null) {\n logger.throwArgumentError(\"untyped transactions do not support accessList; include type: 1\", \"transaction\", transaction);\n }\n return _serialize(transaction, signature);\n }\n // Typed Transactions (EIP-2718)\n switch (transaction.type) {\n case 1:\n return _serializeEip2930(transaction, signature);\n case 2:\n return _serializeEip1559(transaction, signature);\n default:\n break;\n }\n return logger.throwError(`unsupported transaction type: ${transaction.type}`, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"serializeTransaction\",\n transactionType: transaction.type\n });\n}\nfunction _parseEipSignature(tx, fields, serialize) {\n try {\n const recid = handleNumber(fields[0]).toNumber();\n if (recid !== 0 && recid !== 1) {\n throw new Error(\"bad recid\");\n }\n tx.v = recid;\n }\n catch (error) {\n logger.throwArgumentError(\"invalid v for transaction type: 1\", \"v\", fields[0]);\n }\n tx.r = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexZeroPad)(fields[1], 32);\n tx.s = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexZeroPad)(fields[2], 32);\n try {\n const digest = (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_7__.keccak256)(serialize(tx));\n tx.from = recoverAddress(digest, { r: tx.r, s: tx.s, recoveryParam: tx.v });\n }\n catch (error) { }\n}\nfunction _parseEip1559(payload) {\n const transaction = _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_8__.decode(payload.slice(1));\n if (transaction.length !== 9 && transaction.length !== 12) {\n logger.throwArgumentError(\"invalid component count for transaction type: 2\", \"payload\", (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(payload));\n }\n const maxPriorityFeePerGas = handleNumber(transaction[2]);\n const maxFeePerGas = handleNumber(transaction[3]);\n const tx = {\n type: 2,\n chainId: handleNumber(transaction[0]).toNumber(),\n nonce: handleNumber(transaction[1]).toNumber(),\n maxPriorityFeePerGas: maxPriorityFeePerGas,\n maxFeePerGas: maxFeePerGas,\n gasPrice: null,\n gasLimit: handleNumber(transaction[4]),\n to: handleAddress(transaction[5]),\n value: handleNumber(transaction[6]),\n data: transaction[7],\n accessList: accessListify(transaction[8]),\n };\n // Unsigned EIP-1559 Transaction\n if (transaction.length === 9) {\n return tx;\n }\n tx.hash = (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_7__.keccak256)(payload);\n _parseEipSignature(tx, transaction.slice(9), _serializeEip1559);\n return tx;\n}\nfunction _parseEip2930(payload) {\n const transaction = _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_8__.decode(payload.slice(1));\n if (transaction.length !== 8 && transaction.length !== 11) {\n logger.throwArgumentError(\"invalid component count for transaction type: 1\", \"payload\", (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(payload));\n }\n const tx = {\n type: 1,\n chainId: handleNumber(transaction[0]).toNumber(),\n nonce: handleNumber(transaction[1]).toNumber(),\n gasPrice: handleNumber(transaction[2]),\n gasLimit: handleNumber(transaction[3]),\n to: handleAddress(transaction[4]),\n value: handleNumber(transaction[5]),\n data: transaction[6],\n accessList: accessListify(transaction[7])\n };\n // Unsigned EIP-2930 Transaction\n if (transaction.length === 8) {\n return tx;\n }\n tx.hash = (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_7__.keccak256)(payload);\n _parseEipSignature(tx, transaction.slice(8), _serializeEip2930);\n return tx;\n}\n// Legacy Transactions and EIP-155\nfunction _parse(rawTransaction) {\n const transaction = _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_8__.decode(rawTransaction);\n if (transaction.length !== 9 && transaction.length !== 6) {\n logger.throwArgumentError(\"invalid raw transaction\", \"rawTransaction\", rawTransaction);\n }\n const tx = {\n nonce: handleNumber(transaction[0]).toNumber(),\n gasPrice: handleNumber(transaction[1]),\n gasLimit: handleNumber(transaction[2]),\n to: handleAddress(transaction[3]),\n value: handleNumber(transaction[4]),\n data: transaction[5],\n chainId: 0\n };\n // Legacy unsigned transaction\n if (transaction.length === 6) {\n return tx;\n }\n try {\n tx.v = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__.BigNumber.from(transaction[6]).toNumber();\n }\n catch (error) {\n // @TODO: What makes snese to do? The v is too big\n return tx;\n }\n tx.r = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexZeroPad)(transaction[7], 32);\n tx.s = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexZeroPad)(transaction[8], 32);\n if (_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__.BigNumber.from(tx.r).isZero() && _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__.BigNumber.from(tx.s).isZero()) {\n // EIP-155 unsigned transaction\n tx.chainId = tx.v;\n tx.v = 0;\n }\n else {\n // Signed Transaction\n tx.chainId = Math.floor((tx.v - 35) / 2);\n if (tx.chainId < 0) {\n tx.chainId = 0;\n }\n let recoveryParam = tx.v - 27;\n const raw = transaction.slice(0, 6);\n if (tx.chainId !== 0) {\n raw.push((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(tx.chainId));\n raw.push(\"0x\");\n raw.push(\"0x\");\n recoveryParam -= tx.chainId * 2 + 8;\n }\n const digest = (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_7__.keccak256)(_ethersproject_rlp__WEBPACK_IMPORTED_MODULE_8__.encode(raw));\n try {\n tx.from = recoverAddress(digest, { r: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(tx.r), s: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(tx.s), recoveryParam: recoveryParam });\n }\n catch (error) { }\n tx.hash = (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_7__.keccak256)(rawTransaction);\n }\n tx.type = null;\n return tx;\n}\nfunction parse(rawTransaction) {\n const payload = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(rawTransaction);\n // Legacy and EIP-155 Transactions\n if (payload[0] > 0x7f) {\n return _parse(payload);\n }\n // Typed Transaction (EIP-2718)\n switch (payload[0]) {\n case 1:\n return _parseEip2930(payload);\n case 2:\n return _parseEip1559(payload);\n default:\n break;\n }\n return logger.throwError(`unsupported transaction type: ${payload[0]}`, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"parseTransaction\",\n transactionType: payload[0]\n });\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@ethersproject/transactions/lib.esm/index.js?"); - -/***/ }), - -/***/ "./node_modules/@stablelib/binary/lib/binary.js": -/*!******************************************************!*\ - !*** ./node_modules/@stablelib/binary/lib/binary.js ***! - \******************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n/**\n * Package binary provides functions for encoding and decoding numbers in byte arrays.\n */\nvar int_1 = __webpack_require__(/*! @stablelib/int */ \"./node_modules/@stablelib/int/lib/int.js\");\n// TODO(dchest): add asserts for correct value ranges and array offsets.\n/**\n * Reads 2 bytes from array starting at offset as big-endian\n * signed 16-bit integer and returns it.\n */\nfunction readInt16BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return (((array[offset + 0] << 8) | array[offset + 1]) << 16) >> 16;\n}\nexports.readInt16BE = readInt16BE;\n/**\n * Reads 2 bytes from array starting at offset as big-endian\n * unsigned 16-bit integer and returns it.\n */\nfunction readUint16BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return ((array[offset + 0] << 8) | array[offset + 1]) >>> 0;\n}\nexports.readUint16BE = readUint16BE;\n/**\n * Reads 2 bytes from array starting at offset as little-endian\n * signed 16-bit integer and returns it.\n */\nfunction readInt16LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return (((array[offset + 1] << 8) | array[offset]) << 16) >> 16;\n}\nexports.readInt16LE = readInt16LE;\n/**\n * Reads 2 bytes from array starting at offset as little-endian\n * unsigned 16-bit integer and returns it.\n */\nfunction readUint16LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return ((array[offset + 1] << 8) | array[offset]) >>> 0;\n}\nexports.readUint16LE = readUint16LE;\n/**\n * Writes 2-byte big-endian representation of 16-bit unsigned\n * value to byte array starting at offset.\n *\n * If byte array is not given, creates a new 2-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeUint16BE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(2); }\n if (offset === void 0) { offset = 0; }\n out[offset + 0] = value >>> 8;\n out[offset + 1] = value >>> 0;\n return out;\n}\nexports.writeUint16BE = writeUint16BE;\nexports.writeInt16BE = writeUint16BE;\n/**\n * Writes 2-byte little-endian representation of 16-bit unsigned\n * value to array starting at offset.\n *\n * If byte array is not given, creates a new 2-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeUint16LE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(2); }\n if (offset === void 0) { offset = 0; }\n out[offset + 0] = value >>> 0;\n out[offset + 1] = value >>> 8;\n return out;\n}\nexports.writeUint16LE = writeUint16LE;\nexports.writeInt16LE = writeUint16LE;\n/**\n * Reads 4 bytes from array starting at offset as big-endian\n * signed 32-bit integer and returns it.\n */\nfunction readInt32BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return (array[offset] << 24) |\n (array[offset + 1] << 16) |\n (array[offset + 2] << 8) |\n array[offset + 3];\n}\nexports.readInt32BE = readInt32BE;\n/**\n * Reads 4 bytes from array starting at offset as big-endian\n * unsigned 32-bit integer and returns it.\n */\nfunction readUint32BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return ((array[offset] << 24) |\n (array[offset + 1] << 16) |\n (array[offset + 2] << 8) |\n array[offset + 3]) >>> 0;\n}\nexports.readUint32BE = readUint32BE;\n/**\n * Reads 4 bytes from array starting at offset as little-endian\n * signed 32-bit integer and returns it.\n */\nfunction readInt32LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return (array[offset + 3] << 24) |\n (array[offset + 2] << 16) |\n (array[offset + 1] << 8) |\n array[offset];\n}\nexports.readInt32LE = readInt32LE;\n/**\n * Reads 4 bytes from array starting at offset as little-endian\n * unsigned 32-bit integer and returns it.\n */\nfunction readUint32LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n return ((array[offset + 3] << 24) |\n (array[offset + 2] << 16) |\n (array[offset + 1] << 8) |\n array[offset]) >>> 0;\n}\nexports.readUint32LE = readUint32LE;\n/**\n * Writes 4-byte big-endian representation of 32-bit unsigned\n * value to byte array starting at offset.\n *\n * If byte array is not given, creates a new 4-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeUint32BE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(4); }\n if (offset === void 0) { offset = 0; }\n out[offset + 0] = value >>> 24;\n out[offset + 1] = value >>> 16;\n out[offset + 2] = value >>> 8;\n out[offset + 3] = value >>> 0;\n return out;\n}\nexports.writeUint32BE = writeUint32BE;\nexports.writeInt32BE = writeUint32BE;\n/**\n * Writes 4-byte little-endian representation of 32-bit unsigned\n * value to array starting at offset.\n *\n * If byte array is not given, creates a new 4-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeUint32LE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(4); }\n if (offset === void 0) { offset = 0; }\n out[offset + 0] = value >>> 0;\n out[offset + 1] = value >>> 8;\n out[offset + 2] = value >>> 16;\n out[offset + 3] = value >>> 24;\n return out;\n}\nexports.writeUint32LE = writeUint32LE;\nexports.writeInt32LE = writeUint32LE;\n/**\n * Reads 8 bytes from array starting at offset as big-endian\n * signed 64-bit integer and returns it.\n *\n * IMPORTANT: due to JavaScript limitation, supports exact\n * numbers in range -9007199254740991 to 9007199254740991.\n * If the number stored in the byte array is outside this range,\n * the result is not exact.\n */\nfunction readInt64BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var hi = readInt32BE(array, offset);\n var lo = readInt32BE(array, offset + 4);\n return hi * 0x100000000 + lo - ((lo >> 31) * 0x100000000);\n}\nexports.readInt64BE = readInt64BE;\n/**\n * Reads 8 bytes from array starting at offset as big-endian\n * unsigned 64-bit integer and returns it.\n *\n * IMPORTANT: due to JavaScript limitation, supports values up to 2^53-1.\n */\nfunction readUint64BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var hi = readUint32BE(array, offset);\n var lo = readUint32BE(array, offset + 4);\n return hi * 0x100000000 + lo;\n}\nexports.readUint64BE = readUint64BE;\n/**\n * Reads 8 bytes from array starting at offset as little-endian\n * signed 64-bit integer and returns it.\n *\n * IMPORTANT: due to JavaScript limitation, supports exact\n * numbers in range -9007199254740991 to 9007199254740991.\n * If the number stored in the byte array is outside this range,\n * the result is not exact.\n */\nfunction readInt64LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var lo = readInt32LE(array, offset);\n var hi = readInt32LE(array, offset + 4);\n return hi * 0x100000000 + lo - ((lo >> 31) * 0x100000000);\n}\nexports.readInt64LE = readInt64LE;\n/**\n * Reads 8 bytes from array starting at offset as little-endian\n * unsigned 64-bit integer and returns it.\n *\n * IMPORTANT: due to JavaScript limitation, supports values up to 2^53-1.\n */\nfunction readUint64LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var lo = readUint32LE(array, offset);\n var hi = readUint32LE(array, offset + 4);\n return hi * 0x100000000 + lo;\n}\nexports.readUint64LE = readUint64LE;\n/**\n * Writes 8-byte big-endian representation of 64-bit unsigned\n * value to byte array starting at offset.\n *\n * Due to JavaScript limitation, supports values up to 2^53-1.\n *\n * If byte array is not given, creates a new 8-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeUint64BE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(8); }\n if (offset === void 0) { offset = 0; }\n writeUint32BE(value / 0x100000000 >>> 0, out, offset);\n writeUint32BE(value >>> 0, out, offset + 4);\n return out;\n}\nexports.writeUint64BE = writeUint64BE;\nexports.writeInt64BE = writeUint64BE;\n/**\n * Writes 8-byte little-endian representation of 64-bit unsigned\n * value to byte array starting at offset.\n *\n * Due to JavaScript limitation, supports values up to 2^53-1.\n *\n * If byte array is not given, creates a new 8-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeUint64LE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(8); }\n if (offset === void 0) { offset = 0; }\n writeUint32LE(value >>> 0, out, offset);\n writeUint32LE(value / 0x100000000 >>> 0, out, offset + 4);\n return out;\n}\nexports.writeUint64LE = writeUint64LE;\nexports.writeInt64LE = writeUint64LE;\n/**\n * Reads bytes from array starting at offset as big-endian\n * unsigned bitLen-bit integer and returns it.\n *\n * Supports bit lengths divisible by 8, up to 48.\n */\nfunction readUintBE(bitLength, array, offset) {\n if (offset === void 0) { offset = 0; }\n // TODO(dchest): implement support for bitLengths non-divisible by 8\n if (bitLength % 8 !== 0) {\n throw new Error(\"readUintBE supports only bitLengths divisible by 8\");\n }\n if (bitLength / 8 > array.length - offset) {\n throw new Error(\"readUintBE: array is too short for the given bitLength\");\n }\n var result = 0;\n var mul = 1;\n for (var i = bitLength / 8 + offset - 1; i >= offset; i--) {\n result += array[i] * mul;\n mul *= 256;\n }\n return result;\n}\nexports.readUintBE = readUintBE;\n/**\n * Reads bytes from array starting at offset as little-endian\n * unsigned bitLen-bit integer and returns it.\n *\n * Supports bit lengths divisible by 8, up to 48.\n */\nfunction readUintLE(bitLength, array, offset) {\n if (offset === void 0) { offset = 0; }\n // TODO(dchest): implement support for bitLengths non-divisible by 8\n if (bitLength % 8 !== 0) {\n throw new Error(\"readUintLE supports only bitLengths divisible by 8\");\n }\n if (bitLength / 8 > array.length - offset) {\n throw new Error(\"readUintLE: array is too short for the given bitLength\");\n }\n var result = 0;\n var mul = 1;\n for (var i = offset; i < offset + bitLength / 8; i++) {\n result += array[i] * mul;\n mul *= 256;\n }\n return result;\n}\nexports.readUintLE = readUintLE;\n/**\n * Writes a big-endian representation of bitLen-bit unsigned\n * value to array starting at offset.\n *\n * Supports bit lengths divisible by 8, up to 48.\n *\n * If byte array is not given, creates a new one.\n *\n * Returns the output byte array.\n */\nfunction writeUintBE(bitLength, value, out, offset) {\n if (out === void 0) { out = new Uint8Array(bitLength / 8); }\n if (offset === void 0) { offset = 0; }\n // TODO(dchest): implement support for bitLengths non-divisible by 8\n if (bitLength % 8 !== 0) {\n throw new Error(\"writeUintBE supports only bitLengths divisible by 8\");\n }\n if (!int_1.isSafeInteger(value)) {\n throw new Error(\"writeUintBE value must be an integer\");\n }\n var div = 1;\n for (var i = bitLength / 8 + offset - 1; i >= offset; i--) {\n out[i] = (value / div) & 0xff;\n div *= 256;\n }\n return out;\n}\nexports.writeUintBE = writeUintBE;\n/**\n * Writes a little-endian representation of bitLen-bit unsigned\n * value to array starting at offset.\n *\n * Supports bit lengths divisible by 8, up to 48.\n *\n * If byte array is not given, creates a new one.\n *\n * Returns the output byte array.\n */\nfunction writeUintLE(bitLength, value, out, offset) {\n if (out === void 0) { out = new Uint8Array(bitLength / 8); }\n if (offset === void 0) { offset = 0; }\n // TODO(dchest): implement support for bitLengths non-divisible by 8\n if (bitLength % 8 !== 0) {\n throw new Error(\"writeUintLE supports only bitLengths divisible by 8\");\n }\n if (!int_1.isSafeInteger(value)) {\n throw new Error(\"writeUintLE value must be an integer\");\n }\n var div = 1;\n for (var i = offset; i < offset + bitLength / 8; i++) {\n out[i] = (value / div) & 0xff;\n div *= 256;\n }\n return out;\n}\nexports.writeUintLE = writeUintLE;\n/**\n * Reads 4 bytes from array starting at offset as big-endian\n * 32-bit floating-point number and returns it.\n */\nfunction readFloat32BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var view = new DataView(array.buffer, array.byteOffset, array.byteLength);\n return view.getFloat32(offset);\n}\nexports.readFloat32BE = readFloat32BE;\n/**\n * Reads 4 bytes from array starting at offset as little-endian\n * 32-bit floating-point number and returns it.\n */\nfunction readFloat32LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var view = new DataView(array.buffer, array.byteOffset, array.byteLength);\n return view.getFloat32(offset, true);\n}\nexports.readFloat32LE = readFloat32LE;\n/**\n * Reads 8 bytes from array starting at offset as big-endian\n * 64-bit floating-point number (\"double\") and returns it.\n */\nfunction readFloat64BE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var view = new DataView(array.buffer, array.byteOffset, array.byteLength);\n return view.getFloat64(offset);\n}\nexports.readFloat64BE = readFloat64BE;\n/**\n * Reads 8 bytes from array starting at offset as little-endian\n * 64-bit floating-point number (\"double\") and returns it.\n */\nfunction readFloat64LE(array, offset) {\n if (offset === void 0) { offset = 0; }\n var view = new DataView(array.buffer, array.byteOffset, array.byteLength);\n return view.getFloat64(offset, true);\n}\nexports.readFloat64LE = readFloat64LE;\n/**\n * Writes 4-byte big-endian floating-point representation of value\n * to byte array starting at offset.\n *\n * If byte array is not given, creates a new 4-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeFloat32BE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(4); }\n if (offset === void 0) { offset = 0; }\n var view = new DataView(out.buffer, out.byteOffset, out.byteLength);\n view.setFloat32(offset, value);\n return out;\n}\nexports.writeFloat32BE = writeFloat32BE;\n/**\n * Writes 4-byte little-endian floating-point representation of value\n * to byte array starting at offset.\n *\n * If byte array is not given, creates a new 4-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeFloat32LE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(4); }\n if (offset === void 0) { offset = 0; }\n var view = new DataView(out.buffer, out.byteOffset, out.byteLength);\n view.setFloat32(offset, value, true);\n return out;\n}\nexports.writeFloat32LE = writeFloat32LE;\n/**\n * Writes 8-byte big-endian floating-point representation of value\n * to byte array starting at offset.\n *\n * If byte array is not given, creates a new 8-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeFloat64BE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(8); }\n if (offset === void 0) { offset = 0; }\n var view = new DataView(out.buffer, out.byteOffset, out.byteLength);\n view.setFloat64(offset, value);\n return out;\n}\nexports.writeFloat64BE = writeFloat64BE;\n/**\n * Writes 8-byte little-endian floating-point representation of value\n * to byte array starting at offset.\n *\n * If byte array is not given, creates a new 8-byte one.\n *\n * Returns the output byte array.\n */\nfunction writeFloat64LE(value, out, offset) {\n if (out === void 0) { out = new Uint8Array(8); }\n if (offset === void 0) { offset = 0; }\n var view = new DataView(out.buffer, out.byteOffset, out.byteLength);\n view.setFloat64(offset, value, true);\n return out;\n}\nexports.writeFloat64LE = writeFloat64LE;\n//# sourceMappingURL=binary.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@stablelib/binary/lib/binary.js?"); - -/***/ }), - -/***/ "./node_modules/@stablelib/chacha/lib/chacha.js": -/*!******************************************************!*\ - !*** ./node_modules/@stablelib/chacha/lib/chacha.js ***! - \******************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n/**\n * Package chacha implements ChaCha stream cipher.\n */\nvar binary_1 = __webpack_require__(/*! @stablelib/binary */ \"./node_modules/@stablelib/binary/lib/binary.js\");\nvar wipe_1 = __webpack_require__(/*! @stablelib/wipe */ \"./node_modules/@stablelib/wipe/lib/wipe.js\");\n// Number of ChaCha rounds (ChaCha20).\nvar ROUNDS = 20;\n// Applies the ChaCha core function to 16-byte input,\n// 32-byte key key, and puts the result into 64-byte array out.\nfunction core(out, input, key) {\n var j0 = 0x61707865; // \"expa\" -- ChaCha's \"sigma\" constant\n var j1 = 0x3320646E; // \"nd 3\" for 32-byte keys\n var j2 = 0x79622D32; // \"2-by\"\n var j3 = 0x6B206574; // \"te k\"\n var j4 = (key[3] << 24) | (key[2] << 16) | (key[1] << 8) | key[0];\n var j5 = (key[7] << 24) | (key[6] << 16) | (key[5] << 8) | key[4];\n var j6 = (key[11] << 24) | (key[10] << 16) | (key[9] << 8) | key[8];\n var j7 = (key[15] << 24) | (key[14] << 16) | (key[13] << 8) | key[12];\n var j8 = (key[19] << 24) | (key[18] << 16) | (key[17] << 8) | key[16];\n var j9 = (key[23] << 24) | (key[22] << 16) | (key[21] << 8) | key[20];\n var j10 = (key[27] << 24) | (key[26] << 16) | (key[25] << 8) | key[24];\n var j11 = (key[31] << 24) | (key[30] << 16) | (key[29] << 8) | key[28];\n var j12 = (input[3] << 24) | (input[2] << 16) | (input[1] << 8) | input[0];\n var j13 = (input[7] << 24) | (input[6] << 16) | (input[5] << 8) | input[4];\n var j14 = (input[11] << 24) | (input[10] << 16) | (input[9] << 8) | input[8];\n var j15 = (input[15] << 24) | (input[14] << 16) | (input[13] << 8) | input[12];\n var x0 = j0;\n var x1 = j1;\n var x2 = j2;\n var x3 = j3;\n var x4 = j4;\n var x5 = j5;\n var x6 = j6;\n var x7 = j7;\n var x8 = j8;\n var x9 = j9;\n var x10 = j10;\n var x11 = j11;\n var x12 = j12;\n var x13 = j13;\n var x14 = j14;\n var x15 = j15;\n for (var i = 0; i < ROUNDS; i += 2) {\n x0 = x0 + x4 | 0;\n x12 ^= x0;\n x12 = x12 >>> (32 - 16) | x12 << 16;\n x8 = x8 + x12 | 0;\n x4 ^= x8;\n x4 = x4 >>> (32 - 12) | x4 << 12;\n x1 = x1 + x5 | 0;\n x13 ^= x1;\n x13 = x13 >>> (32 - 16) | x13 << 16;\n x9 = x9 + x13 | 0;\n x5 ^= x9;\n x5 = x5 >>> (32 - 12) | x5 << 12;\n x2 = x2 + x6 | 0;\n x14 ^= x2;\n x14 = x14 >>> (32 - 16) | x14 << 16;\n x10 = x10 + x14 | 0;\n x6 ^= x10;\n x6 = x6 >>> (32 - 12) | x6 << 12;\n x3 = x3 + x7 | 0;\n x15 ^= x3;\n x15 = x15 >>> (32 - 16) | x15 << 16;\n x11 = x11 + x15 | 0;\n x7 ^= x11;\n x7 = x7 >>> (32 - 12) | x7 << 12;\n x2 = x2 + x6 | 0;\n x14 ^= x2;\n x14 = x14 >>> (32 - 8) | x14 << 8;\n x10 = x10 + x14 | 0;\n x6 ^= x10;\n x6 = x6 >>> (32 - 7) | x6 << 7;\n x3 = x3 + x7 | 0;\n x15 ^= x3;\n x15 = x15 >>> (32 - 8) | x15 << 8;\n x11 = x11 + x15 | 0;\n x7 ^= x11;\n x7 = x7 >>> (32 - 7) | x7 << 7;\n x1 = x1 + x5 | 0;\n x13 ^= x1;\n x13 = x13 >>> (32 - 8) | x13 << 8;\n x9 = x9 + x13 | 0;\n x5 ^= x9;\n x5 = x5 >>> (32 - 7) | x5 << 7;\n x0 = x0 + x4 | 0;\n x12 ^= x0;\n x12 = x12 >>> (32 - 8) | x12 << 8;\n x8 = x8 + x12 | 0;\n x4 ^= x8;\n x4 = x4 >>> (32 - 7) | x4 << 7;\n x0 = x0 + x5 | 0;\n x15 ^= x0;\n x15 = x15 >>> (32 - 16) | x15 << 16;\n x10 = x10 + x15 | 0;\n x5 ^= x10;\n x5 = x5 >>> (32 - 12) | x5 << 12;\n x1 = x1 + x6 | 0;\n x12 ^= x1;\n x12 = x12 >>> (32 - 16) | x12 << 16;\n x11 = x11 + x12 | 0;\n x6 ^= x11;\n x6 = x6 >>> (32 - 12) | x6 << 12;\n x2 = x2 + x7 | 0;\n x13 ^= x2;\n x13 = x13 >>> (32 - 16) | x13 << 16;\n x8 = x8 + x13 | 0;\n x7 ^= x8;\n x7 = x7 >>> (32 - 12) | x7 << 12;\n x3 = x3 + x4 | 0;\n x14 ^= x3;\n x14 = x14 >>> (32 - 16) | x14 << 16;\n x9 = x9 + x14 | 0;\n x4 ^= x9;\n x4 = x4 >>> (32 - 12) | x4 << 12;\n x2 = x2 + x7 | 0;\n x13 ^= x2;\n x13 = x13 >>> (32 - 8) | x13 << 8;\n x8 = x8 + x13 | 0;\n x7 ^= x8;\n x7 = x7 >>> (32 - 7) | x7 << 7;\n x3 = x3 + x4 | 0;\n x14 ^= x3;\n x14 = x14 >>> (32 - 8) | x14 << 8;\n x9 = x9 + x14 | 0;\n x4 ^= x9;\n x4 = x4 >>> (32 - 7) | x4 << 7;\n x1 = x1 + x6 | 0;\n x12 ^= x1;\n x12 = x12 >>> (32 - 8) | x12 << 8;\n x11 = x11 + x12 | 0;\n x6 ^= x11;\n x6 = x6 >>> (32 - 7) | x6 << 7;\n x0 = x0 + x5 | 0;\n x15 ^= x0;\n x15 = x15 >>> (32 - 8) | x15 << 8;\n x10 = x10 + x15 | 0;\n x5 ^= x10;\n x5 = x5 >>> (32 - 7) | x5 << 7;\n }\n binary_1.writeUint32LE(x0 + j0 | 0, out, 0);\n binary_1.writeUint32LE(x1 + j1 | 0, out, 4);\n binary_1.writeUint32LE(x2 + j2 | 0, out, 8);\n binary_1.writeUint32LE(x3 + j3 | 0, out, 12);\n binary_1.writeUint32LE(x4 + j4 | 0, out, 16);\n binary_1.writeUint32LE(x5 + j5 | 0, out, 20);\n binary_1.writeUint32LE(x6 + j6 | 0, out, 24);\n binary_1.writeUint32LE(x7 + j7 | 0, out, 28);\n binary_1.writeUint32LE(x8 + j8 | 0, out, 32);\n binary_1.writeUint32LE(x9 + j9 | 0, out, 36);\n binary_1.writeUint32LE(x10 + j10 | 0, out, 40);\n binary_1.writeUint32LE(x11 + j11 | 0, out, 44);\n binary_1.writeUint32LE(x12 + j12 | 0, out, 48);\n binary_1.writeUint32LE(x13 + j13 | 0, out, 52);\n binary_1.writeUint32LE(x14 + j14 | 0, out, 56);\n binary_1.writeUint32LE(x15 + j15 | 0, out, 60);\n}\n/**\n * Encrypt src with ChaCha20 stream generated for the given 32-byte key and\n * 8-byte (as in original implementation) or 12-byte (as in RFC7539) nonce and\n * write the result into dst and return it.\n *\n * dst and src may be the same, but otherwise must not overlap.\n *\n * If nonce is 12 bytes, users should not encrypt more than 256 GiB with the\n * same key and nonce, otherwise the stream will repeat. The function will\n * throw error if counter overflows to prevent this.\n *\n * If nonce is 8 bytes, the output is practically unlimited (2^70 bytes, which\n * is more than a million petabytes). However, it is not recommended to\n * generate 8-byte nonces randomly, as the chance of collision is high.\n *\n * Never use the same key and nonce to encrypt more than one message.\n *\n * If nonceInplaceCounterLength is not 0, the nonce is assumed to be a 16-byte\n * array with stream counter in first nonceInplaceCounterLength bytes and nonce\n * in the last remaining bytes. The counter will be incremented inplace for\n * each ChaCha block. This is useful if you need to encrypt one stream of data\n * in chunks.\n */\nfunction streamXOR(key, nonce, src, dst, nonceInplaceCounterLength) {\n if (nonceInplaceCounterLength === void 0) { nonceInplaceCounterLength = 0; }\n // We only support 256-bit keys.\n if (key.length !== 32) {\n throw new Error(\"ChaCha: key size must be 32 bytes\");\n }\n if (dst.length < src.length) {\n throw new Error(\"ChaCha: destination is shorter than source\");\n }\n var nc;\n var counterLength;\n if (nonceInplaceCounterLength === 0) {\n if (nonce.length !== 8 && nonce.length !== 12) {\n throw new Error(\"ChaCha nonce must be 8 or 12 bytes\");\n }\n nc = new Uint8Array(16);\n // First counterLength bytes of nc are counter, starting with zero.\n counterLength = nc.length - nonce.length;\n // Last bytes of nc after counterLength are nonce, set them.\n nc.set(nonce, counterLength);\n }\n else {\n if (nonce.length !== 16) {\n throw new Error(\"ChaCha nonce with counter must be 16 bytes\");\n }\n // This will update passed nonce with counter inplace.\n nc = nonce;\n counterLength = nonceInplaceCounterLength;\n }\n // Allocate temporary space for ChaCha block.\n var block = new Uint8Array(64);\n for (var i = 0; i < src.length; i += 64) {\n // Generate a block.\n core(block, nc, key);\n // XOR block bytes with src into dst.\n for (var j = i; j < i + 64 && j < src.length; j++) {\n dst[j] = src[j] ^ block[j - i];\n }\n // Increment counter.\n incrementCounter(nc, 0, counterLength);\n }\n // Cleanup temporary space.\n wipe_1.wipe(block);\n if (nonceInplaceCounterLength === 0) {\n // Cleanup counter.\n wipe_1.wipe(nc);\n }\n return dst;\n}\nexports.streamXOR = streamXOR;\n/**\n * Generate ChaCha20 stream for the given 32-byte key and 8-byte or 12-byte\n * nonce and write it into dst and return it.\n *\n * Never use the same key and nonce to generate more than one stream.\n *\n * If nonceInplaceCounterLength is not 0, it behaves the same with respect to\n * the nonce as described in the streamXOR documentation.\n *\n * stream is like streamXOR with all-zero src.\n */\nfunction stream(key, nonce, dst, nonceInplaceCounterLength) {\n if (nonceInplaceCounterLength === void 0) { nonceInplaceCounterLength = 0; }\n wipe_1.wipe(dst);\n return streamXOR(key, nonce, dst, dst, nonceInplaceCounterLength);\n}\nexports.stream = stream;\nfunction incrementCounter(counter, pos, len) {\n var carry = 1;\n while (len--) {\n carry = carry + (counter[pos] & 0xff) | 0;\n counter[pos] = carry & 0xff;\n carry >>>= 8;\n pos++;\n }\n if (carry > 0) {\n throw new Error(\"ChaCha: counter overflow\");\n }\n}\n//# sourceMappingURL=chacha.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@stablelib/chacha/lib/chacha.js?"); - -/***/ }), - -/***/ "./node_modules/@stablelib/chacha20poly1305/lib/chacha20poly1305.js": -/*!**************************************************************************!*\ - !*** ./node_modules/@stablelib/chacha20poly1305/lib/chacha20poly1305.js ***! - \**************************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nvar chacha_1 = __webpack_require__(/*! @stablelib/chacha */ \"./node_modules/@stablelib/chacha/lib/chacha.js\");\nvar poly1305_1 = __webpack_require__(/*! @stablelib/poly1305 */ \"./node_modules/@stablelib/poly1305/lib/poly1305.js\");\nvar wipe_1 = __webpack_require__(/*! @stablelib/wipe */ \"./node_modules/@stablelib/wipe/lib/wipe.js\");\nvar binary_1 = __webpack_require__(/*! @stablelib/binary */ \"./node_modules/@stablelib/binary/lib/binary.js\");\nvar constant_time_1 = __webpack_require__(/*! @stablelib/constant-time */ \"./node_modules/@stablelib/constant-time/lib/constant-time.js\");\nexports.KEY_LENGTH = 32;\nexports.NONCE_LENGTH = 12;\nexports.TAG_LENGTH = 16;\nvar ZEROS = new Uint8Array(16);\n/**\n * ChaCha20-Poly1305 Authenticated Encryption with Associated Data.\n *\n * Defined in RFC7539.\n */\nvar ChaCha20Poly1305 = /** @class */ (function () {\n /**\n * Creates a new instance with the given 32-byte key.\n */\n function ChaCha20Poly1305(key) {\n this.nonceLength = exports.NONCE_LENGTH;\n this.tagLength = exports.TAG_LENGTH;\n if (key.length !== exports.KEY_LENGTH) {\n throw new Error(\"ChaCha20Poly1305 needs 32-byte key\");\n }\n // Copy key.\n this._key = new Uint8Array(key);\n }\n /**\n * Encrypts and authenticates plaintext, authenticates associated data,\n * and returns sealed ciphertext, which includes authentication tag.\n *\n * RFC7539 specifies 12 bytes for nonce. It may be this 12-byte nonce\n * (\"IV\"), or full 16-byte counter (called \"32-bit fixed-common part\")\n * and nonce.\n *\n * If dst is given (it must be the size of plaintext + the size of tag\n * length) the result will be put into it. Dst and plaintext must not\n * overlap.\n */\n ChaCha20Poly1305.prototype.seal = function (nonce, plaintext, associatedData, dst) {\n if (nonce.length > 16) {\n throw new Error(\"ChaCha20Poly1305: incorrect nonce length\");\n }\n // Allocate space for counter, and set nonce as last bytes of it.\n var counter = new Uint8Array(16);\n counter.set(nonce, counter.length - nonce.length);\n // Generate authentication key by taking first 32-bytes of stream.\n // We pass full counter, which has 12-byte nonce and 4-byte block counter,\n // and it will get incremented after generating the block, which is\n // exactly what we need: we only use the first 32 bytes of 64-byte\n // ChaCha block and discard the next 32 bytes.\n var authKey = new Uint8Array(32);\n chacha_1.stream(this._key, counter, authKey, 4);\n // Allocate space for sealed ciphertext.\n var resultLength = plaintext.length + this.tagLength;\n var result;\n if (dst) {\n if (dst.length !== resultLength) {\n throw new Error(\"ChaCha20Poly1305: incorrect destination length\");\n }\n result = dst;\n }\n else {\n result = new Uint8Array(resultLength);\n }\n // Encrypt plaintext.\n chacha_1.streamXOR(this._key, counter, plaintext, result, 4);\n // Authenticate.\n // XXX: can \"simplify\" here: pass full result (which is already padded\n // due to zeroes prepared for tag), and ciphertext length instead of\n // subarray of result.\n this._authenticate(result.subarray(result.length - this.tagLength, result.length), authKey, result.subarray(0, result.length - this.tagLength), associatedData);\n // Cleanup.\n wipe_1.wipe(counter);\n return result;\n };\n /**\n * Authenticates sealed ciphertext (which includes authentication tag) and\n * associated data, decrypts ciphertext and returns decrypted plaintext.\n *\n * RFC7539 specifies 12 bytes for nonce. It may be this 12-byte nonce\n * (\"IV\"), or full 16-byte counter (called \"32-bit fixed-common part\")\n * and nonce.\n *\n * If authentication fails, it returns null.\n *\n * If dst is given (it must be of ciphertext length minus tag length),\n * the result will be put into it. Dst and plaintext must not overlap.\n */\n ChaCha20Poly1305.prototype.open = function (nonce, sealed, associatedData, dst) {\n if (nonce.length > 16) {\n throw new Error(\"ChaCha20Poly1305: incorrect nonce length\");\n }\n // Sealed ciphertext should at least contain tag.\n if (sealed.length < this.tagLength) {\n // TODO(dchest): should we throw here instead?\n return null;\n }\n // Allocate space for counter, and set nonce as last bytes of it.\n var counter = new Uint8Array(16);\n counter.set(nonce, counter.length - nonce.length);\n // Generate authentication key by taking first 32-bytes of stream.\n var authKey = new Uint8Array(32);\n chacha_1.stream(this._key, counter, authKey, 4);\n // Authenticate.\n // XXX: can simplify and avoid allocation: since authenticate()\n // already allocates tag (from Poly1305.digest(), it can return)\n // it instead of copying to calculatedTag. But then in seal()\n // we'll need to copy it.\n var calculatedTag = new Uint8Array(this.tagLength);\n this._authenticate(calculatedTag, authKey, sealed.subarray(0, sealed.length - this.tagLength), associatedData);\n // Constant-time compare tags and return null if they differ.\n if (!constant_time_1.equal(calculatedTag, sealed.subarray(sealed.length - this.tagLength, sealed.length))) {\n return null;\n }\n // Allocate space for decrypted plaintext.\n var resultLength = sealed.length - this.tagLength;\n var result;\n if (dst) {\n if (dst.length !== resultLength) {\n throw new Error(\"ChaCha20Poly1305: incorrect destination length\");\n }\n result = dst;\n }\n else {\n result = new Uint8Array(resultLength);\n }\n // Decrypt.\n chacha_1.streamXOR(this._key, counter, sealed.subarray(0, sealed.length - this.tagLength), result, 4);\n // Cleanup.\n wipe_1.wipe(counter);\n return result;\n };\n ChaCha20Poly1305.prototype.clean = function () {\n wipe_1.wipe(this._key);\n return this;\n };\n ChaCha20Poly1305.prototype._authenticate = function (tagOut, authKey, ciphertext, associatedData) {\n // Initialize Poly1305 with authKey.\n var h = new poly1305_1.Poly1305(authKey);\n // Authenticate padded associated data.\n if (associatedData) {\n h.update(associatedData);\n if (associatedData.length % 16 > 0) {\n h.update(ZEROS.subarray(associatedData.length % 16));\n }\n }\n // Authenticate padded ciphertext.\n h.update(ciphertext);\n if (ciphertext.length % 16 > 0) {\n h.update(ZEROS.subarray(ciphertext.length % 16));\n }\n // Authenticate length of associated data.\n // XXX: can avoid allocation here?\n var length = new Uint8Array(8);\n if (associatedData) {\n binary_1.writeUint64LE(associatedData.length, length);\n }\n h.update(length);\n // Authenticate length of ciphertext.\n binary_1.writeUint64LE(ciphertext.length, length);\n h.update(length);\n // Get tag and copy it into tagOut.\n var tag = h.digest();\n for (var i = 0; i < tag.length; i++) {\n tagOut[i] = tag[i];\n }\n // Cleanup.\n h.clean();\n wipe_1.wipe(tag);\n wipe_1.wipe(length);\n };\n return ChaCha20Poly1305;\n}());\nexports.ChaCha20Poly1305 = ChaCha20Poly1305;\n//# sourceMappingURL=chacha20poly1305.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@stablelib/chacha20poly1305/lib/chacha20poly1305.js?"); - -/***/ }), - -/***/ "./node_modules/@stablelib/constant-time/lib/constant-time.js": -/*!********************************************************************!*\ - !*** ./node_modules/@stablelib/constant-time/lib/constant-time.js ***! - \********************************************************************/ -/***/ ((__unused_webpack_module, exports) => { - -eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n/**\n * Package constant-time provides functions for performing algorithmically constant-time operations.\n */\n/**\n * NOTE! Due to the inability to guarantee real constant time evaluation of\n * anything in JavaScript VM, this is module is the best effort.\n */\n/**\n * Returns resultIfOne if subject is 1, or resultIfZero if subject is 0.\n *\n * Supports only 32-bit integers, so resultIfOne or resultIfZero are not\n * integers, they'll be converted to them with bitwise operations.\n */\nfunction select(subject, resultIfOne, resultIfZero) {\n return (~(subject - 1) & resultIfOne) | ((subject - 1) & resultIfZero);\n}\nexports.select = select;\n/**\n * Returns 1 if a <= b, or 0 if not.\n * Arguments must be positive 32-bit integers less than or equal to 2^31 - 1.\n */\nfunction lessOrEqual(a, b) {\n return (((a | 0) - (b | 0) - 1) >>> 31) & 1;\n}\nexports.lessOrEqual = lessOrEqual;\n/**\n * Returns 1 if a and b are of equal length and their contents\n * are equal, or 0 otherwise.\n *\n * Note that unlike in equal(), zero-length inputs are considered\n * the same, so this function will return 1.\n */\nfunction compare(a, b) {\n if (a.length !== b.length) {\n return 0;\n }\n var result = 0;\n for (var i = 0; i < a.length; i++) {\n result |= a[i] ^ b[i];\n }\n return (1 & ((result - 1) >>> 8));\n}\nexports.compare = compare;\n/**\n * Returns true if a and b are of equal non-zero length,\n * and their contents are equal, or false otherwise.\n *\n * Note that unlike in compare() zero-length inputs are considered\n * _not_ equal, so this function will return false.\n */\nfunction equal(a, b) {\n if (a.length === 0 || b.length === 0) {\n return false;\n }\n return compare(a, b) !== 0;\n}\nexports.equal = equal;\n//# sourceMappingURL=constant-time.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@stablelib/constant-time/lib/constant-time.js?"); - -/***/ }), - -/***/ "./node_modules/@stablelib/ed25519/lib/ed25519.js": -/*!********************************************************!*\ - !*** ./node_modules/@stablelib/ed25519/lib/ed25519.js ***! - \********************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.convertSecretKeyToX25519 = exports.convertPublicKeyToX25519 = exports.verify = exports.sign = exports.extractPublicKeyFromSecretKey = exports.generateKeyPair = exports.generateKeyPairFromSeed = exports.SEED_LENGTH = exports.SECRET_KEY_LENGTH = exports.PUBLIC_KEY_LENGTH = exports.SIGNATURE_LENGTH = void 0;\n/**\n * Package ed25519 implements Ed25519 public-key signature algorithm.\n */\nconst random_1 = __webpack_require__(/*! @stablelib/random */ \"./node_modules/@stablelib/random/lib/random.js\");\nconst sha512_1 = __webpack_require__(/*! @stablelib/sha512 */ \"./node_modules/@stablelib/sha512/lib/sha512.js\");\nconst wipe_1 = __webpack_require__(/*! @stablelib/wipe */ \"./node_modules/@stablelib/wipe/lib/wipe.js\");\nexports.SIGNATURE_LENGTH = 64;\nexports.PUBLIC_KEY_LENGTH = 32;\nexports.SECRET_KEY_LENGTH = 64;\nexports.SEED_LENGTH = 32;\n// Returns new zero-filled 16-element GF (Float64Array).\n// If passed an array of numbers, prefills the returned\n// array with them.\n//\n// We use Float64Array, because we need 48-bit numbers\n// for this implementation.\nfunction gf(init) {\n const r = new Float64Array(16);\n if (init) {\n for (let i = 0; i < init.length; i++) {\n r[i] = init[i];\n }\n }\n return r;\n}\n// Base point.\nconst _9 = new Uint8Array(32);\n_9[0] = 9;\nconst gf0 = gf();\nconst gf1 = gf([1]);\nconst D = gf([\n 0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070,\n 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203\n]);\nconst D2 = gf([\n 0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0,\n 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406\n]);\nconst X = gf([\n 0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c,\n 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169\n]);\nconst Y = gf([\n 0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666,\n 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666\n]);\nconst I = gf([\n 0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43,\n 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83\n]);\nfunction set25519(r, a) {\n for (let i = 0; i < 16; i++) {\n r[i] = a[i] | 0;\n }\n}\nfunction car25519(o) {\n let c = 1;\n for (let i = 0; i < 16; i++) {\n let v = o[i] + c + 65535;\n c = Math.floor(v / 65536);\n o[i] = v - c * 65536;\n }\n o[0] += c - 1 + 37 * (c - 1);\n}\nfunction sel25519(p, q, b) {\n const c = ~(b - 1);\n for (let i = 0; i < 16; i++) {\n const t = c & (p[i] ^ q[i]);\n p[i] ^= t;\n q[i] ^= t;\n }\n}\nfunction pack25519(o, n) {\n const m = gf();\n const t = gf();\n for (let i = 0; i < 16; i++) {\n t[i] = n[i];\n }\n car25519(t);\n car25519(t);\n car25519(t);\n for (let j = 0; j < 2; j++) {\n m[0] = t[0] - 0xffed;\n for (let i = 1; i < 15; i++) {\n m[i] = t[i] - 0xffff - ((m[i - 1] >> 16) & 1);\n m[i - 1] &= 0xffff;\n }\n m[15] = t[15] - 0x7fff - ((m[14] >> 16) & 1);\n const b = (m[15] >> 16) & 1;\n m[14] &= 0xffff;\n sel25519(t, m, 1 - b);\n }\n for (let i = 0; i < 16; i++) {\n o[2 * i] = t[i] & 0xff;\n o[2 * i + 1] = t[i] >> 8;\n }\n}\nfunction verify32(x, y) {\n let d = 0;\n for (let i = 0; i < 32; i++) {\n d |= x[i] ^ y[i];\n }\n return (1 & ((d - 1) >>> 8)) - 1;\n}\nfunction neq25519(a, b) {\n const c = new Uint8Array(32);\n const d = new Uint8Array(32);\n pack25519(c, a);\n pack25519(d, b);\n return verify32(c, d);\n}\nfunction par25519(a) {\n const d = new Uint8Array(32);\n pack25519(d, a);\n return d[0] & 1;\n}\nfunction unpack25519(o, n) {\n for (let i = 0; i < 16; i++) {\n o[i] = n[2 * i] + (n[2 * i + 1] << 8);\n }\n o[15] &= 0x7fff;\n}\nfunction add(o, a, b) {\n for (let i = 0; i < 16; i++) {\n o[i] = a[i] + b[i];\n }\n}\nfunction sub(o, a, b) {\n for (let i = 0; i < 16; i++) {\n o[i] = a[i] - b[i];\n }\n}\nfunction mul(o, a, b) {\n let v, c, t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0, t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0, t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0, b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5], b6 = b[6], b7 = b[7], b8 = b[8], b9 = b[9], b10 = b[10], b11 = b[11], b12 = b[12], b13 = b[13], b14 = b[14], b15 = b[15];\n v = a[0];\n t0 += v * b0;\n t1 += v * b1;\n t2 += v * b2;\n t3 += v * b3;\n t4 += v * b4;\n t5 += v * b5;\n t6 += v * b6;\n t7 += v * b7;\n t8 += v * b8;\n t9 += v * b9;\n t10 += v * b10;\n t11 += v * b11;\n t12 += v * b12;\n t13 += v * b13;\n t14 += v * b14;\n t15 += v * b15;\n v = a[1];\n t1 += v * b0;\n t2 += v * b1;\n t3 += v * b2;\n t4 += v * b3;\n t5 += v * b4;\n t6 += v * b5;\n t7 += v * b6;\n t8 += v * b7;\n t9 += v * b8;\n t10 += v * b9;\n t11 += v * b10;\n t12 += v * b11;\n t13 += v * b12;\n t14 += v * b13;\n t15 += v * b14;\n t16 += v * b15;\n v = a[2];\n t2 += v * b0;\n t3 += v * b1;\n t4 += v * b2;\n t5 += v * b3;\n t6 += v * b4;\n t7 += v * b5;\n t8 += v * b6;\n t9 += v * b7;\n t10 += v * b8;\n t11 += v * b9;\n t12 += v * b10;\n t13 += v * b11;\n t14 += v * b12;\n t15 += v * b13;\n t16 += v * b14;\n t17 += v * b15;\n v = a[3];\n t3 += v * b0;\n t4 += v * b1;\n t5 += v * b2;\n t6 += v * b3;\n t7 += v * b4;\n t8 += v * b5;\n t9 += v * b6;\n t10 += v * b7;\n t11 += v * b8;\n t12 += v * b9;\n t13 += v * b10;\n t14 += v * b11;\n t15 += v * b12;\n t16 += v * b13;\n t17 += v * b14;\n t18 += v * b15;\n v = a[4];\n t4 += v * b0;\n t5 += v * b1;\n t6 += v * b2;\n t7 += v * b3;\n t8 += v * b4;\n t9 += v * b5;\n t10 += v * b6;\n t11 += v * b7;\n t12 += v * b8;\n t13 += v * b9;\n t14 += v * b10;\n t15 += v * b11;\n t16 += v * b12;\n t17 += v * b13;\n t18 += v * b14;\n t19 += v * b15;\n v = a[5];\n t5 += v * b0;\n t6 += v * b1;\n t7 += v * b2;\n t8 += v * b3;\n t9 += v * b4;\n t10 += v * b5;\n t11 += v * b6;\n t12 += v * b7;\n t13 += v * b8;\n t14 += v * b9;\n t15 += v * b10;\n t16 += v * b11;\n t17 += v * b12;\n t18 += v * b13;\n t19 += v * b14;\n t20 += v * b15;\n v = a[6];\n t6 += v * b0;\n t7 += v * b1;\n t8 += v * b2;\n t9 += v * b3;\n t10 += v * b4;\n t11 += v * b5;\n t12 += v * b6;\n t13 += v * b7;\n t14 += v * b8;\n t15 += v * b9;\n t16 += v * b10;\n t17 += v * b11;\n t18 += v * b12;\n t19 += v * b13;\n t20 += v * b14;\n t21 += v * b15;\n v = a[7];\n t7 += v * b0;\n t8 += v * b1;\n t9 += v * b2;\n t10 += v * b3;\n t11 += v * b4;\n t12 += v * b5;\n t13 += v * b6;\n t14 += v * b7;\n t15 += v * b8;\n t16 += v * b9;\n t17 += v * b10;\n t18 += v * b11;\n t19 += v * b12;\n t20 += v * b13;\n t21 += v * b14;\n t22 += v * b15;\n v = a[8];\n t8 += v * b0;\n t9 += v * b1;\n t10 += v * b2;\n t11 += v * b3;\n t12 += v * b4;\n t13 += v * b5;\n t14 += v * b6;\n t15 += v * b7;\n t16 += v * b8;\n t17 += v * b9;\n t18 += v * b10;\n t19 += v * b11;\n t20 += v * b12;\n t21 += v * b13;\n t22 += v * b14;\n t23 += v * b15;\n v = a[9];\n t9 += v * b0;\n t10 += v * b1;\n t11 += v * b2;\n t12 += v * b3;\n t13 += v * b4;\n t14 += v * b5;\n t15 += v * b6;\n t16 += v * b7;\n t17 += v * b8;\n t18 += v * b9;\n t19 += v * b10;\n t20 += v * b11;\n t21 += v * b12;\n t22 += v * b13;\n t23 += v * b14;\n t24 += v * b15;\n v = a[10];\n t10 += v * b0;\n t11 += v * b1;\n t12 += v * b2;\n t13 += v * b3;\n t14 += v * b4;\n t15 += v * b5;\n t16 += v * b6;\n t17 += v * b7;\n t18 += v * b8;\n t19 += v * b9;\n t20 += v * b10;\n t21 += v * b11;\n t22 += v * b12;\n t23 += v * b13;\n t24 += v * b14;\n t25 += v * b15;\n v = a[11];\n t11 += v * b0;\n t12 += v * b1;\n t13 += v * b2;\n t14 += v * b3;\n t15 += v * b4;\n t16 += v * b5;\n t17 += v * b6;\n t18 += v * b7;\n t19 += v * b8;\n t20 += v * b9;\n t21 += v * b10;\n t22 += v * b11;\n t23 += v * b12;\n t24 += v * b13;\n t25 += v * b14;\n t26 += v * b15;\n v = a[12];\n t12 += v * b0;\n t13 += v * b1;\n t14 += v * b2;\n t15 += v * b3;\n t16 += v * b4;\n t17 += v * b5;\n t18 += v * b6;\n t19 += v * b7;\n t20 += v * b8;\n t21 += v * b9;\n t22 += v * b10;\n t23 += v * b11;\n t24 += v * b12;\n t25 += v * b13;\n t26 += v * b14;\n t27 += v * b15;\n v = a[13];\n t13 += v * b0;\n t14 += v * b1;\n t15 += v * b2;\n t16 += v * b3;\n t17 += v * b4;\n t18 += v * b5;\n t19 += v * b6;\n t20 += v * b7;\n t21 += v * b8;\n t22 += v * b9;\n t23 += v * b10;\n t24 += v * b11;\n t25 += v * b12;\n t26 += v * b13;\n t27 += v * b14;\n t28 += v * b15;\n v = a[14];\n t14 += v * b0;\n t15 += v * b1;\n t16 += v * b2;\n t17 += v * b3;\n t18 += v * b4;\n t19 += v * b5;\n t20 += v * b6;\n t21 += v * b7;\n t22 += v * b8;\n t23 += v * b9;\n t24 += v * b10;\n t25 += v * b11;\n t26 += v * b12;\n t27 += v * b13;\n t28 += v * b14;\n t29 += v * b15;\n v = a[15];\n t15 += v * b0;\n t16 += v * b1;\n t17 += v * b2;\n t18 += v * b3;\n t19 += v * b4;\n t20 += v * b5;\n t21 += v * b6;\n t22 += v * b7;\n t23 += v * b8;\n t24 += v * b9;\n t25 += v * b10;\n t26 += v * b11;\n t27 += v * b12;\n t28 += v * b13;\n t29 += v * b14;\n t30 += v * b15;\n t0 += 38 * t16;\n t1 += 38 * t17;\n t2 += 38 * t18;\n t3 += 38 * t19;\n t4 += 38 * t20;\n t5 += 38 * t21;\n t6 += 38 * t22;\n t7 += 38 * t23;\n t8 += 38 * t24;\n t9 += 38 * t25;\n t10 += 38 * t26;\n t11 += 38 * t27;\n t12 += 38 * t28;\n t13 += 38 * t29;\n t14 += 38 * t30;\n // t15 left as is\n // first car\n c = 1;\n v = t0 + c + 65535;\n c = Math.floor(v / 65536);\n t0 = v - c * 65536;\n v = t1 + c + 65535;\n c = Math.floor(v / 65536);\n t1 = v - c * 65536;\n v = t2 + c + 65535;\n c = Math.floor(v / 65536);\n t2 = v - c * 65536;\n v = t3 + c + 65535;\n c = Math.floor(v / 65536);\n t3 = v - c * 65536;\n v = t4 + c + 65535;\n c = Math.floor(v / 65536);\n t4 = v - c * 65536;\n v = t5 + c + 65535;\n c = Math.floor(v / 65536);\n t5 = v - c * 65536;\n v = t6 + c + 65535;\n c = Math.floor(v / 65536);\n t6 = v - c * 65536;\n v = t7 + c + 65535;\n c = Math.floor(v / 65536);\n t7 = v - c * 65536;\n v = t8 + c + 65535;\n c = Math.floor(v / 65536);\n t8 = v - c * 65536;\n v = t9 + c + 65535;\n c = Math.floor(v / 65536);\n t9 = v - c * 65536;\n v = t10 + c + 65535;\n c = Math.floor(v / 65536);\n t10 = v - c * 65536;\n v = t11 + c + 65535;\n c = Math.floor(v / 65536);\n t11 = v - c * 65536;\n v = t12 + c + 65535;\n c = Math.floor(v / 65536);\n t12 = v - c * 65536;\n v = t13 + c + 65535;\n c = Math.floor(v / 65536);\n t13 = v - c * 65536;\n v = t14 + c + 65535;\n c = Math.floor(v / 65536);\n t14 = v - c * 65536;\n v = t15 + c + 65535;\n c = Math.floor(v / 65536);\n t15 = v - c * 65536;\n t0 += c - 1 + 37 * (c - 1);\n // second car\n c = 1;\n v = t0 + c + 65535;\n c = Math.floor(v / 65536);\n t0 = v - c * 65536;\n v = t1 + c + 65535;\n c = Math.floor(v / 65536);\n t1 = v - c * 65536;\n v = t2 + c + 65535;\n c = Math.floor(v / 65536);\n t2 = v - c * 65536;\n v = t3 + c + 65535;\n c = Math.floor(v / 65536);\n t3 = v - c * 65536;\n v = t4 + c + 65535;\n c = Math.floor(v / 65536);\n t4 = v - c * 65536;\n v = t5 + c + 65535;\n c = Math.floor(v / 65536);\n t5 = v - c * 65536;\n v = t6 + c + 65535;\n c = Math.floor(v / 65536);\n t6 = v - c * 65536;\n v = t7 + c + 65535;\n c = Math.floor(v / 65536);\n t7 = v - c * 65536;\n v = t8 + c + 65535;\n c = Math.floor(v / 65536);\n t8 = v - c * 65536;\n v = t9 + c + 65535;\n c = Math.floor(v / 65536);\n t9 = v - c * 65536;\n v = t10 + c + 65535;\n c = Math.floor(v / 65536);\n t10 = v - c * 65536;\n v = t11 + c + 65535;\n c = Math.floor(v / 65536);\n t11 = v - c * 65536;\n v = t12 + c + 65535;\n c = Math.floor(v / 65536);\n t12 = v - c * 65536;\n v = t13 + c + 65535;\n c = Math.floor(v / 65536);\n t13 = v - c * 65536;\n v = t14 + c + 65535;\n c = Math.floor(v / 65536);\n t14 = v - c * 65536;\n v = t15 + c + 65535;\n c = Math.floor(v / 65536);\n t15 = v - c * 65536;\n t0 += c - 1 + 37 * (c - 1);\n o[0] = t0;\n o[1] = t1;\n o[2] = t2;\n o[3] = t3;\n o[4] = t4;\n o[5] = t5;\n o[6] = t6;\n o[7] = t7;\n o[8] = t8;\n o[9] = t9;\n o[10] = t10;\n o[11] = t11;\n o[12] = t12;\n o[13] = t13;\n o[14] = t14;\n o[15] = t15;\n}\nfunction square(o, a) {\n mul(o, a, a);\n}\nfunction inv25519(o, i) {\n const c = gf();\n let a;\n for (a = 0; a < 16; a++) {\n c[a] = i[a];\n }\n for (a = 253; a >= 0; a--) {\n square(c, c);\n if (a !== 2 && a !== 4) {\n mul(c, c, i);\n }\n }\n for (a = 0; a < 16; a++) {\n o[a] = c[a];\n }\n}\nfunction pow2523(o, i) {\n const c = gf();\n let a;\n for (a = 0; a < 16; a++) {\n c[a] = i[a];\n }\n for (a = 250; a >= 0; a--) {\n square(c, c);\n if (a !== 1) {\n mul(c, c, i);\n }\n }\n for (a = 0; a < 16; a++) {\n o[a] = c[a];\n }\n}\nfunction edadd(p, q) {\n const a = gf(), b = gf(), c = gf(), d = gf(), e = gf(), f = gf(), g = gf(), h = gf(), t = gf();\n sub(a, p[1], p[0]);\n sub(t, q[1], q[0]);\n mul(a, a, t);\n add(b, p[0], p[1]);\n add(t, q[0], q[1]);\n mul(b, b, t);\n mul(c, p[3], q[3]);\n mul(c, c, D2);\n mul(d, p[2], q[2]);\n add(d, d, d);\n sub(e, b, a);\n sub(f, d, c);\n add(g, d, c);\n add(h, b, a);\n mul(p[0], e, f);\n mul(p[1], h, g);\n mul(p[2], g, f);\n mul(p[3], e, h);\n}\nfunction cswap(p, q, b) {\n for (let i = 0; i < 4; i++) {\n sel25519(p[i], q[i], b);\n }\n}\nfunction pack(r, p) {\n const tx = gf(), ty = gf(), zi = gf();\n inv25519(zi, p[2]);\n mul(tx, p[0], zi);\n mul(ty, p[1], zi);\n pack25519(r, ty);\n r[31] ^= par25519(tx) << 7;\n}\nfunction scalarmult(p, q, s) {\n set25519(p[0], gf0);\n set25519(p[1], gf1);\n set25519(p[2], gf1);\n set25519(p[3], gf0);\n for (let i = 255; i >= 0; --i) {\n const b = (s[(i / 8) | 0] >> (i & 7)) & 1;\n cswap(p, q, b);\n edadd(q, p);\n edadd(p, p);\n cswap(p, q, b);\n }\n}\nfunction scalarbase(p, s) {\n const q = [gf(), gf(), gf(), gf()];\n set25519(q[0], X);\n set25519(q[1], Y);\n set25519(q[2], gf1);\n mul(q[3], X, Y);\n scalarmult(p, q, s);\n}\n// Generates key pair from secret 32-byte seed.\nfunction generateKeyPairFromSeed(seed) {\n if (seed.length !== exports.SEED_LENGTH) {\n throw new Error(`ed25519: seed must be ${exports.SEED_LENGTH} bytes`);\n }\n const d = (0, sha512_1.hash)(seed);\n d[0] &= 248;\n d[31] &= 127;\n d[31] |= 64;\n const publicKey = new Uint8Array(32);\n const p = [gf(), gf(), gf(), gf()];\n scalarbase(p, d);\n pack(publicKey, p);\n const secretKey = new Uint8Array(64);\n secretKey.set(seed);\n secretKey.set(publicKey, 32);\n return {\n publicKey,\n secretKey\n };\n}\nexports.generateKeyPairFromSeed = generateKeyPairFromSeed;\nfunction generateKeyPair(prng) {\n const seed = (0, random_1.randomBytes)(32, prng);\n const result = generateKeyPairFromSeed(seed);\n (0, wipe_1.wipe)(seed);\n return result;\n}\nexports.generateKeyPair = generateKeyPair;\nfunction extractPublicKeyFromSecretKey(secretKey) {\n if (secretKey.length !== exports.SECRET_KEY_LENGTH) {\n throw new Error(`ed25519: secret key must be ${exports.SECRET_KEY_LENGTH} bytes`);\n }\n return new Uint8Array(secretKey.subarray(32));\n}\nexports.extractPublicKeyFromSecretKey = extractPublicKeyFromSecretKey;\nconst L = new Float64Array([\n 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2,\n 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10\n]);\nfunction modL(r, x) {\n let carry;\n let i;\n let j;\n let k;\n for (i = 63; i >= 32; --i) {\n carry = 0;\n for (j = i - 32, k = i - 12; j < k; ++j) {\n x[j] += carry - 16 * x[i] * L[j - (i - 32)];\n carry = Math.floor((x[j] + 128) / 256);\n x[j] -= carry * 256;\n }\n x[j] += carry;\n x[i] = 0;\n }\n carry = 0;\n for (j = 0; j < 32; j++) {\n x[j] += carry - (x[31] >> 4) * L[j];\n carry = x[j] >> 8;\n x[j] &= 255;\n }\n for (j = 0; j < 32; j++) {\n x[j] -= carry * L[j];\n }\n for (i = 0; i < 32; i++) {\n x[i + 1] += x[i] >> 8;\n r[i] = x[i] & 255;\n }\n}\nfunction reduce(r) {\n const x = new Float64Array(64);\n for (let i = 0; i < 64; i++) {\n x[i] = r[i];\n }\n for (let i = 0; i < 64; i++) {\n r[i] = 0;\n }\n modL(r, x);\n}\n// Returns 64-byte signature of the message under the 64-byte secret key.\nfunction sign(secretKey, message) {\n const x = new Float64Array(64);\n const p = [gf(), gf(), gf(), gf()];\n const d = (0, sha512_1.hash)(secretKey.subarray(0, 32));\n d[0] &= 248;\n d[31] &= 127;\n d[31] |= 64;\n const signature = new Uint8Array(64);\n signature.set(d.subarray(32), 32);\n const hs = new sha512_1.SHA512();\n hs.update(signature.subarray(32));\n hs.update(message);\n const r = hs.digest();\n hs.clean();\n reduce(r);\n scalarbase(p, r);\n pack(signature, p);\n hs.reset();\n hs.update(signature.subarray(0, 32));\n hs.update(secretKey.subarray(32));\n hs.update(message);\n const h = hs.digest();\n reduce(h);\n for (let i = 0; i < 32; i++) {\n x[i] = r[i];\n }\n for (let i = 0; i < 32; i++) {\n for (let j = 0; j < 32; j++) {\n x[i + j] += h[i] * d[j];\n }\n }\n modL(signature.subarray(32), x);\n return signature;\n}\nexports.sign = sign;\nfunction unpackneg(r, p) {\n const t = gf(), chk = gf(), num = gf(), den = gf(), den2 = gf(), den4 = gf(), den6 = gf();\n set25519(r[2], gf1);\n unpack25519(r[1], p);\n square(num, r[1]);\n mul(den, num, D);\n sub(num, num, r[2]);\n add(den, r[2], den);\n square(den2, den);\n square(den4, den2);\n mul(den6, den4, den2);\n mul(t, den6, num);\n mul(t, t, den);\n pow2523(t, t);\n mul(t, t, num);\n mul(t, t, den);\n mul(t, t, den);\n mul(r[0], t, den);\n square(chk, r[0]);\n mul(chk, chk, den);\n if (neq25519(chk, num)) {\n mul(r[0], r[0], I);\n }\n square(chk, r[0]);\n mul(chk, chk, den);\n if (neq25519(chk, num)) {\n return -1;\n }\n if (par25519(r[0]) === (p[31] >> 7)) {\n sub(r[0], gf0, r[0]);\n }\n mul(r[3], r[0], r[1]);\n return 0;\n}\nfunction verify(publicKey, message, signature) {\n const t = new Uint8Array(32);\n const p = [gf(), gf(), gf(), gf()];\n const q = [gf(), gf(), gf(), gf()];\n if (signature.length !== exports.SIGNATURE_LENGTH) {\n throw new Error(`ed25519: signature must be ${exports.SIGNATURE_LENGTH} bytes`);\n }\n if (unpackneg(q, publicKey)) {\n return false;\n }\n const hs = new sha512_1.SHA512();\n hs.update(signature.subarray(0, 32));\n hs.update(publicKey);\n hs.update(message);\n const h = hs.digest();\n reduce(h);\n scalarmult(p, q, h);\n scalarbase(q, signature.subarray(32));\n edadd(p, q);\n pack(t, p);\n if (verify32(signature, t)) {\n return false;\n }\n return true;\n}\nexports.verify = verify;\n/**\n * Convert Ed25519 public key to X25519 public key.\n *\n * Throws if given an invalid public key.\n */\nfunction convertPublicKeyToX25519(publicKey) {\n let q = [gf(), gf(), gf(), gf()];\n if (unpackneg(q, publicKey)) {\n throw new Error(\"Ed25519: invalid public key\");\n }\n // Formula: montgomeryX = (edwardsY + 1)*inverse(1 - edwardsY) mod p\n let a = gf();\n let b = gf();\n let y = q[1];\n add(a, gf1, y);\n sub(b, gf1, y);\n inv25519(b, b);\n mul(a, a, b);\n let z = new Uint8Array(32);\n pack25519(z, a);\n return z;\n}\nexports.convertPublicKeyToX25519 = convertPublicKeyToX25519;\n/**\n * Convert Ed25519 secret (private) key to X25519 secret key.\n */\nfunction convertSecretKeyToX25519(secretKey) {\n const d = (0, sha512_1.hash)(secretKey.subarray(0, 32));\n d[0] &= 248;\n d[31] &= 127;\n d[31] |= 64;\n const o = new Uint8Array(d.subarray(0, 32));\n (0, wipe_1.wipe)(d);\n return o;\n}\nexports.convertSecretKeyToX25519 = convertSecretKeyToX25519;\n//# sourceMappingURL=ed25519.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@stablelib/ed25519/lib/ed25519.js?"); - -/***/ }), - -/***/ "./node_modules/@stablelib/hash/lib/hash.js": -/*!**************************************************!*\ - !*** ./node_modules/@stablelib/hash/lib/hash.js ***! - \**************************************************/ -/***/ ((__unused_webpack_module, exports) => { - -eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nfunction isSerializableHash(h) {\n return (typeof h.saveState !== \"undefined\" &&\n typeof h.restoreState !== \"undefined\" &&\n typeof h.cleanSavedState !== \"undefined\");\n}\nexports.isSerializableHash = isSerializableHash;\n// TODO(dchest): figure out the standardized interface for XOF such as\n// SHAKE and BLAKE2X.\n//# sourceMappingURL=hash.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@stablelib/hash/lib/hash.js?"); - -/***/ }), - -/***/ "./node_modules/@stablelib/hkdf/lib/hkdf.js": -/*!**************************************************!*\ - !*** ./node_modules/@stablelib/hkdf/lib/hkdf.js ***! - \**************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nvar hmac_1 = __webpack_require__(/*! @stablelib/hmac */ \"./node_modules/@stablelib/hmac/lib/hmac.js\");\nvar wipe_1 = __webpack_require__(/*! @stablelib/wipe */ \"./node_modules/@stablelib/wipe/lib/wipe.js\");\n/**\n * HMAC-based Extract-and-Expand Key Derivation Function.\n *\n * Implements HKDF from RFC5869.\n *\n * Expands the given master key with salt and info into\n * a limited stream of key material.\n */\nvar HKDF = /** @class */ (function () {\n /**\n * Create a new HKDF instance for the given hash function\n * with the master key, optional salt, and info.\n *\n * - Master key is a high-entropy secret key (not a password).\n * - Salt is a non-secret random value.\n * - Info is application- and/or context-specific information.\n */\n function HKDF(hash, key, salt, info) {\n if (salt === void 0) { salt = new Uint8Array(0); }\n this._counter = new Uint8Array(1); // starts with zero\n this._hash = hash;\n this._info = info;\n // HKDF-Extract uses salt as HMAC key, and key as data.\n var okm = hmac_1.hmac(this._hash, salt, key);\n // Initialize HMAC for expanding with extracted key.\n this._hmac = new hmac_1.HMAC(hash, okm);\n // Allocate buffer.\n this._buffer = new Uint8Array(this._hmac.digestLength);\n this._bufpos = this._buffer.length;\n }\n // Fill buffer with new block of HKDF-Extract output.\n HKDF.prototype._fillBuffer = function () {\n // Increment counter.\n this._counter[0]++;\n var ctr = this._counter[0];\n // Check if counter overflowed.\n if (ctr === 0) {\n throw new Error(\"hkdf: cannot expand more\");\n }\n // Prepare HMAC instance for new data with old key.\n this._hmac.reset();\n // Hash in previous output if it was generated\n // (i.e. counter is greater than 1).\n if (ctr > 1) {\n this._hmac.update(this._buffer);\n }\n // Hash in info if it exists.\n if (this._info) {\n this._hmac.update(this._info);\n }\n // Hash in the counter.\n this._hmac.update(this._counter);\n // Output result to buffer and clean HMAC instance.\n this._hmac.finish(this._buffer);\n // Reset buffer position.\n this._bufpos = 0;\n };\n /**\n * Expand returns next key material of the given length.\n *\n * It throws if expansion limit is reached (which is\n * 254 digests of the underlying HMAC function).\n */\n HKDF.prototype.expand = function (length) {\n var out = new Uint8Array(length);\n for (var i = 0; i < out.length; i++) {\n if (this._bufpos === this._buffer.length) {\n this._fillBuffer();\n }\n out[i] = this._buffer[this._bufpos++];\n }\n return out;\n };\n HKDF.prototype.clean = function () {\n this._hmac.clean();\n wipe_1.wipe(this._buffer);\n wipe_1.wipe(this._counter);\n this._bufpos = 0;\n };\n return HKDF;\n}());\nexports.HKDF = HKDF;\n// TODO(dchest): maybe implement deriveKey?\n//# sourceMappingURL=hkdf.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@stablelib/hkdf/lib/hkdf.js?"); - -/***/ }), - -/***/ "./node_modules/@stablelib/hmac/lib/hmac.js": -/*!**************************************************!*\ - !*** ./node_modules/@stablelib/hmac/lib/hmac.js ***! - \**************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n/**\n * Package hmac implements HMAC algorithm.\n */\nvar hash_1 = __webpack_require__(/*! @stablelib/hash */ \"./node_modules/@stablelib/hash/lib/hash.js\");\nvar constant_time_1 = __webpack_require__(/*! @stablelib/constant-time */ \"./node_modules/@stablelib/constant-time/lib/constant-time.js\");\nvar wipe_1 = __webpack_require__(/*! @stablelib/wipe */ \"./node_modules/@stablelib/wipe/lib/wipe.js\");\n/**\n * HMAC implements hash-based message authentication algorithm.\n */\nvar HMAC = /** @class */ (function () {\n /**\n * Constructs a new HMAC with the given Hash and secret key.\n */\n function HMAC(hash, key) {\n this._finished = false; // true if HMAC was finalized\n // Initialize inner and outer hashes.\n this._inner = new hash();\n this._outer = new hash();\n // Set block and digest sizes for this HMAC\n // instance to values from the hash.\n this.blockSize = this._outer.blockSize;\n this.digestLength = this._outer.digestLength;\n // Pad temporary stores a key (or its hash) padded with zeroes.\n var pad = new Uint8Array(this.blockSize);\n if (key.length > this.blockSize) {\n // If key is bigger than hash block size, it must be\n // hashed and this hash is used as a key instead.\n this._inner.update(key).finish(pad).clean();\n }\n else {\n // Otherwise, copy the key into pad.\n pad.set(key);\n }\n // Now two different keys are derived from padded key\n // by xoring a different byte value to each.\n // To make inner hash key, xor byte 0x36 into pad.\n for (var i = 0; i < pad.length; i++) {\n pad[i] ^= 0x36;\n }\n // Update inner hash with the result.\n this._inner.update(pad);\n // To make outer hash key, xor byte 0x5c into pad.\n // But since we already xored 0x36 there, we must\n // first undo this by xoring it again.\n for (var i = 0; i < pad.length; i++) {\n pad[i] ^= 0x36 ^ 0x5c;\n }\n // Update outer hash with the result.\n this._outer.update(pad);\n // Save states of both hashes, so that we can quickly restore\n // them later in reset() without the need to remember the actual\n // key and perform this initialization again.\n if (hash_1.isSerializableHash(this._inner) && hash_1.isSerializableHash(this._outer)) {\n this._innerKeyedState = this._inner.saveState();\n this._outerKeyedState = this._outer.saveState();\n }\n // Clean pad.\n wipe_1.wipe(pad);\n }\n /**\n * Returns HMAC state to the state initialized with key\n * to make it possible to run HMAC over the other data with the same\n * key without creating a new instance.\n */\n HMAC.prototype.reset = function () {\n if (!hash_1.isSerializableHash(this._inner) || !hash_1.isSerializableHash(this._outer)) {\n throw new Error(\"hmac: can't reset() because hash doesn't implement restoreState()\");\n }\n // Restore keyed states of inner and outer hashes.\n this._inner.restoreState(this._innerKeyedState);\n this._outer.restoreState(this._outerKeyedState);\n this._finished = false;\n return this;\n };\n /**\n * Cleans HMAC state.\n */\n HMAC.prototype.clean = function () {\n if (hash_1.isSerializableHash(this._inner)) {\n this._inner.cleanSavedState(this._innerKeyedState);\n }\n if (hash_1.isSerializableHash(this._outer)) {\n this._outer.cleanSavedState(this._outerKeyedState);\n }\n this._inner.clean();\n this._outer.clean();\n };\n /**\n * Updates state with provided data.\n */\n HMAC.prototype.update = function (data) {\n this._inner.update(data);\n return this;\n };\n /**\n * Finalizes HMAC and puts the result in out.\n */\n HMAC.prototype.finish = function (out) {\n if (this._finished) {\n // If HMAC was finalized, outer hash is also finalized,\n // so it produces the same digest it produced when it\n // was finalized.\n this._outer.finish(out);\n return this;\n }\n // Finalize inner hash and store the result temporarily.\n this._inner.finish(out);\n // Update outer hash with digest of inner hash and and finalize it.\n this._outer.update(out.subarray(0, this.digestLength)).finish(out);\n this._finished = true;\n return this;\n };\n /**\n * Returns the computed message authentication code.\n */\n HMAC.prototype.digest = function () {\n var out = new Uint8Array(this.digestLength);\n this.finish(out);\n return out;\n };\n /**\n * Saves HMAC state.\n * This function is needed for PBKDF2 optimization.\n */\n HMAC.prototype.saveState = function () {\n if (!hash_1.isSerializableHash(this._inner)) {\n throw new Error(\"hmac: can't saveState() because hash doesn't implement it\");\n }\n return this._inner.saveState();\n };\n HMAC.prototype.restoreState = function (savedState) {\n if (!hash_1.isSerializableHash(this._inner) || !hash_1.isSerializableHash(this._outer)) {\n throw new Error(\"hmac: can't restoreState() because hash doesn't implement it\");\n }\n this._inner.restoreState(savedState);\n this._outer.restoreState(this._outerKeyedState);\n this._finished = false;\n return this;\n };\n HMAC.prototype.cleanSavedState = function (savedState) {\n if (!hash_1.isSerializableHash(this._inner)) {\n throw new Error(\"hmac: can't cleanSavedState() because hash doesn't implement it\");\n }\n this._inner.cleanSavedState(savedState);\n };\n return HMAC;\n}());\nexports.HMAC = HMAC;\n/**\n * Returns HMAC using the given hash constructor for the key over data.\n */\nfunction hmac(hash, key, data) {\n var h = new HMAC(hash, key);\n h.update(data);\n var digest = h.digest();\n h.clean();\n return digest;\n}\nexports.hmac = hmac;\n/**\n * Returns true if two HMAC digests are equal.\n * Uses constant-time comparison to avoid leaking timing information.\n *\n * Example:\n *\n * const receivedDigest = ...\n * const realDigest = hmac(SHA256, key, data);\n * if (!equal(receivedDigest, realDigest)) {\n * throw new Error(\"Authentication error\");\n * }\n */\nexports.equal = constant_time_1.equal;\n//# sourceMappingURL=hmac.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@stablelib/hmac/lib/hmac.js?"); - -/***/ }), - -/***/ "./node_modules/@stablelib/int/lib/int.js": -/*!************************************************!*\ - !*** ./node_modules/@stablelib/int/lib/int.js ***! - \************************************************/ -/***/ ((__unused_webpack_module, exports) => { - -eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n/**\n * Package int provides helper functions for integerss.\n */\n// Shim using 16-bit pieces.\nfunction imulShim(a, b) {\n var ah = (a >>> 16) & 0xffff, al = a & 0xffff;\n var bh = (b >>> 16) & 0xffff, bl = b & 0xffff;\n return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0) | 0);\n}\n/** 32-bit integer multiplication. */\n// Use system Math.imul if available, otherwise use our shim.\nexports.mul = Math.imul || imulShim;\n/** 32-bit integer addition. */\nfunction add(a, b) {\n return (a + b) | 0;\n}\nexports.add = add;\n/** 32-bit integer subtraction. */\nfunction sub(a, b) {\n return (a - b) | 0;\n}\nexports.sub = sub;\n/** 32-bit integer left rotation */\nfunction rotl(x, n) {\n return x << n | x >>> (32 - n);\n}\nexports.rotl = rotl;\n/** 32-bit integer left rotation */\nfunction rotr(x, n) {\n return x << (32 - n) | x >>> n;\n}\nexports.rotr = rotr;\nfunction isIntegerShim(n) {\n return typeof n === \"number\" && isFinite(n) && Math.floor(n) === n;\n}\n/**\n * Returns true if the argument is an integer number.\n *\n * In ES2015, Number.isInteger.\n */\nexports.isInteger = Number.isInteger || isIntegerShim;\n/**\n * Math.pow(2, 53) - 1\n *\n * In ES2015 Number.MAX_SAFE_INTEGER.\n */\nexports.MAX_SAFE_INTEGER = 9007199254740991;\n/**\n * Returns true if the argument is a safe integer number\n * (-MIN_SAFE_INTEGER < number <= MAX_SAFE_INTEGER)\n *\n * In ES2015, Number.isSafeInteger.\n */\nexports.isSafeInteger = function (n) {\n return exports.isInteger(n) && (n >= -exports.MAX_SAFE_INTEGER && n <= exports.MAX_SAFE_INTEGER);\n};\n//# sourceMappingURL=int.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@stablelib/int/lib/int.js?"); - -/***/ }), - -/***/ "./node_modules/@stablelib/poly1305/lib/poly1305.js": -/*!**********************************************************!*\ - !*** ./node_modules/@stablelib/poly1305/lib/poly1305.js ***! - \**********************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n/**\n * Package poly1305 implements Poly1305 one-time message authentication algorithm.\n */\nvar constant_time_1 = __webpack_require__(/*! @stablelib/constant-time */ \"./node_modules/@stablelib/constant-time/lib/constant-time.js\");\nvar wipe_1 = __webpack_require__(/*! @stablelib/wipe */ \"./node_modules/@stablelib/wipe/lib/wipe.js\");\nexports.DIGEST_LENGTH = 16;\n// Port of Andrew Moon's Poly1305-donna-16. Public domain.\n// https://github.com/floodyberry/poly1305-donna\n/**\n * Poly1305 computes 16-byte authenticator of message using\n * a one-time 32-byte key.\n *\n * Important: key should be used for only one message,\n * it should never repeat.\n */\nvar Poly1305 = /** @class */ (function () {\n function Poly1305(key) {\n this.digestLength = exports.DIGEST_LENGTH;\n this._buffer = new Uint8Array(16);\n this._r = new Uint16Array(10);\n this._h = new Uint16Array(10);\n this._pad = new Uint16Array(8);\n this._leftover = 0;\n this._fin = 0;\n this._finished = false;\n var t0 = key[0] | key[1] << 8;\n this._r[0] = (t0) & 0x1fff;\n var t1 = key[2] | key[3] << 8;\n this._r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;\n var t2 = key[4] | key[5] << 8;\n this._r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;\n var t3 = key[6] | key[7] << 8;\n this._r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;\n var t4 = key[8] | key[9] << 8;\n this._r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;\n this._r[5] = ((t4 >>> 1)) & 0x1ffe;\n var t5 = key[10] | key[11] << 8;\n this._r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;\n var t6 = key[12] | key[13] << 8;\n this._r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;\n var t7 = key[14] | key[15] << 8;\n this._r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;\n this._r[9] = ((t7 >>> 5)) & 0x007f;\n this._pad[0] = key[16] | key[17] << 8;\n this._pad[1] = key[18] | key[19] << 8;\n this._pad[2] = key[20] | key[21] << 8;\n this._pad[3] = key[22] | key[23] << 8;\n this._pad[4] = key[24] | key[25] << 8;\n this._pad[5] = key[26] | key[27] << 8;\n this._pad[6] = key[28] | key[29] << 8;\n this._pad[7] = key[30] | key[31] << 8;\n }\n Poly1305.prototype._blocks = function (m, mpos, bytes) {\n var hibit = this._fin ? 0 : 1 << 11;\n var h0 = this._h[0], h1 = this._h[1], h2 = this._h[2], h3 = this._h[3], h4 = this._h[4], h5 = this._h[5], h6 = this._h[6], h7 = this._h[7], h8 = this._h[8], h9 = this._h[9];\n var r0 = this._r[0], r1 = this._r[1], r2 = this._r[2], r3 = this._r[3], r4 = this._r[4], r5 = this._r[5], r6 = this._r[6], r7 = this._r[7], r8 = this._r[8], r9 = this._r[9];\n while (bytes >= 16) {\n var t0 = m[mpos + 0] | m[mpos + 1] << 8;\n h0 += (t0) & 0x1fff;\n var t1 = m[mpos + 2] | m[mpos + 3] << 8;\n h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;\n var t2 = m[mpos + 4] | m[mpos + 5] << 8;\n h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;\n var t3 = m[mpos + 6] | m[mpos + 7] << 8;\n h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;\n var t4 = m[mpos + 8] | m[mpos + 9] << 8;\n h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;\n h5 += ((t4 >>> 1)) & 0x1fff;\n var t5 = m[mpos + 10] | m[mpos + 11] << 8;\n h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;\n var t6 = m[mpos + 12] | m[mpos + 13] << 8;\n h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;\n var t7 = m[mpos + 14] | m[mpos + 15] << 8;\n h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;\n h9 += ((t7 >>> 5)) | hibit;\n var c = 0;\n var d0 = c;\n d0 += h0 * r0;\n d0 += h1 * (5 * r9);\n d0 += h2 * (5 * r8);\n d0 += h3 * (5 * r7);\n d0 += h4 * (5 * r6);\n c = (d0 >>> 13);\n d0 &= 0x1fff;\n d0 += h5 * (5 * r5);\n d0 += h6 * (5 * r4);\n d0 += h7 * (5 * r3);\n d0 += h8 * (5 * r2);\n d0 += h9 * (5 * r1);\n c += (d0 >>> 13);\n d0 &= 0x1fff;\n var d1 = c;\n d1 += h0 * r1;\n d1 += h1 * r0;\n d1 += h2 * (5 * r9);\n d1 += h3 * (5 * r8);\n d1 += h4 * (5 * r7);\n c = (d1 >>> 13);\n d1 &= 0x1fff;\n d1 += h5 * (5 * r6);\n d1 += h6 * (5 * r5);\n d1 += h7 * (5 * r4);\n d1 += h8 * (5 * r3);\n d1 += h9 * (5 * r2);\n c += (d1 >>> 13);\n d1 &= 0x1fff;\n var d2 = c;\n d2 += h0 * r2;\n d2 += h1 * r1;\n d2 += h2 * r0;\n d2 += h3 * (5 * r9);\n d2 += h4 * (5 * r8);\n c = (d2 >>> 13);\n d2 &= 0x1fff;\n d2 += h5 * (5 * r7);\n d2 += h6 * (5 * r6);\n d2 += h7 * (5 * r5);\n d2 += h8 * (5 * r4);\n d2 += h9 * (5 * r3);\n c += (d2 >>> 13);\n d2 &= 0x1fff;\n var d3 = c;\n d3 += h0 * r3;\n d3 += h1 * r2;\n d3 += h2 * r1;\n d3 += h3 * r0;\n d3 += h4 * (5 * r9);\n c = (d3 >>> 13);\n d3 &= 0x1fff;\n d3 += h5 * (5 * r8);\n d3 += h6 * (5 * r7);\n d3 += h7 * (5 * r6);\n d3 += h8 * (5 * r5);\n d3 += h9 * (5 * r4);\n c += (d3 >>> 13);\n d3 &= 0x1fff;\n var d4 = c;\n d4 += h0 * r4;\n d4 += h1 * r3;\n d4 += h2 * r2;\n d4 += h3 * r1;\n d4 += h4 * r0;\n c = (d4 >>> 13);\n d4 &= 0x1fff;\n d4 += h5 * (5 * r9);\n d4 += h6 * (5 * r8);\n d4 += h7 * (5 * r7);\n d4 += h8 * (5 * r6);\n d4 += h9 * (5 * r5);\n c += (d4 >>> 13);\n d4 &= 0x1fff;\n var d5 = c;\n d5 += h0 * r5;\n d5 += h1 * r4;\n d5 += h2 * r3;\n d5 += h3 * r2;\n d5 += h4 * r1;\n c = (d5 >>> 13);\n d5 &= 0x1fff;\n d5 += h5 * r0;\n d5 += h6 * (5 * r9);\n d5 += h7 * (5 * r8);\n d5 += h8 * (5 * r7);\n d5 += h9 * (5 * r6);\n c += (d5 >>> 13);\n d5 &= 0x1fff;\n var d6 = c;\n d6 += h0 * r6;\n d6 += h1 * r5;\n d6 += h2 * r4;\n d6 += h3 * r3;\n d6 += h4 * r2;\n c = (d6 >>> 13);\n d6 &= 0x1fff;\n d6 += h5 * r1;\n d6 += h6 * r0;\n d6 += h7 * (5 * r9);\n d6 += h8 * (5 * r8);\n d6 += h9 * (5 * r7);\n c += (d6 >>> 13);\n d6 &= 0x1fff;\n var d7 = c;\n d7 += h0 * r7;\n d7 += h1 * r6;\n d7 += h2 * r5;\n d7 += h3 * r4;\n d7 += h4 * r3;\n c = (d7 >>> 13);\n d7 &= 0x1fff;\n d7 += h5 * r2;\n d7 += h6 * r1;\n d7 += h7 * r0;\n d7 += h8 * (5 * r9);\n d7 += h9 * (5 * r8);\n c += (d7 >>> 13);\n d7 &= 0x1fff;\n var d8 = c;\n d8 += h0 * r8;\n d8 += h1 * r7;\n d8 += h2 * r6;\n d8 += h3 * r5;\n d8 += h4 * r4;\n c = (d8 >>> 13);\n d8 &= 0x1fff;\n d8 += h5 * r3;\n d8 += h6 * r2;\n d8 += h7 * r1;\n d8 += h8 * r0;\n d8 += h9 * (5 * r9);\n c += (d8 >>> 13);\n d8 &= 0x1fff;\n var d9 = c;\n d9 += h0 * r9;\n d9 += h1 * r8;\n d9 += h2 * r7;\n d9 += h3 * r6;\n d9 += h4 * r5;\n c = (d9 >>> 13);\n d9 &= 0x1fff;\n d9 += h5 * r4;\n d9 += h6 * r3;\n d9 += h7 * r2;\n d9 += h8 * r1;\n d9 += h9 * r0;\n c += (d9 >>> 13);\n d9 &= 0x1fff;\n c = (((c << 2) + c)) | 0;\n c = (c + d0) | 0;\n d0 = c & 0x1fff;\n c = (c >>> 13);\n d1 += c;\n h0 = d0;\n h1 = d1;\n h2 = d2;\n h3 = d3;\n h4 = d4;\n h5 = d5;\n h6 = d6;\n h7 = d7;\n h8 = d8;\n h9 = d9;\n mpos += 16;\n bytes -= 16;\n }\n this._h[0] = h0;\n this._h[1] = h1;\n this._h[2] = h2;\n this._h[3] = h3;\n this._h[4] = h4;\n this._h[5] = h5;\n this._h[6] = h6;\n this._h[7] = h7;\n this._h[8] = h8;\n this._h[9] = h9;\n };\n Poly1305.prototype.finish = function (mac, macpos) {\n if (macpos === void 0) { macpos = 0; }\n var g = new Uint16Array(10);\n var c;\n var mask;\n var f;\n var i;\n if (this._leftover) {\n i = this._leftover;\n this._buffer[i++] = 1;\n for (; i < 16; i++) {\n this._buffer[i] = 0;\n }\n this._fin = 1;\n this._blocks(this._buffer, 0, 16);\n }\n c = this._h[1] >>> 13;\n this._h[1] &= 0x1fff;\n for (i = 2; i < 10; i++) {\n this._h[i] += c;\n c = this._h[i] >>> 13;\n this._h[i] &= 0x1fff;\n }\n this._h[0] += (c * 5);\n c = this._h[0] >>> 13;\n this._h[0] &= 0x1fff;\n this._h[1] += c;\n c = this._h[1] >>> 13;\n this._h[1] &= 0x1fff;\n this._h[2] += c;\n g[0] = this._h[0] + 5;\n c = g[0] >>> 13;\n g[0] &= 0x1fff;\n for (i = 1; i < 10; i++) {\n g[i] = this._h[i] + c;\n c = g[i] >>> 13;\n g[i] &= 0x1fff;\n }\n g[9] -= (1 << 13);\n mask = (c ^ 1) - 1;\n for (i = 0; i < 10; i++) {\n g[i] &= mask;\n }\n mask = ~mask;\n for (i = 0; i < 10; i++) {\n this._h[i] = (this._h[i] & mask) | g[i];\n }\n this._h[0] = ((this._h[0]) | (this._h[1] << 13)) & 0xffff;\n this._h[1] = ((this._h[1] >>> 3) | (this._h[2] << 10)) & 0xffff;\n this._h[2] = ((this._h[2] >>> 6) | (this._h[3] << 7)) & 0xffff;\n this._h[3] = ((this._h[3] >>> 9) | (this._h[4] << 4)) & 0xffff;\n this._h[4] = ((this._h[4] >>> 12) | (this._h[5] << 1) | (this._h[6] << 14)) & 0xffff;\n this._h[5] = ((this._h[6] >>> 2) | (this._h[7] << 11)) & 0xffff;\n this._h[6] = ((this._h[7] >>> 5) | (this._h[8] << 8)) & 0xffff;\n this._h[7] = ((this._h[8] >>> 8) | (this._h[9] << 5)) & 0xffff;\n f = this._h[0] + this._pad[0];\n this._h[0] = f & 0xffff;\n for (i = 1; i < 8; i++) {\n f = (((this._h[i] + this._pad[i]) | 0) + (f >>> 16)) | 0;\n this._h[i] = f & 0xffff;\n }\n mac[macpos + 0] = this._h[0] >>> 0;\n mac[macpos + 1] = this._h[0] >>> 8;\n mac[macpos + 2] = this._h[1] >>> 0;\n mac[macpos + 3] = this._h[1] >>> 8;\n mac[macpos + 4] = this._h[2] >>> 0;\n mac[macpos + 5] = this._h[2] >>> 8;\n mac[macpos + 6] = this._h[3] >>> 0;\n mac[macpos + 7] = this._h[3] >>> 8;\n mac[macpos + 8] = this._h[4] >>> 0;\n mac[macpos + 9] = this._h[4] >>> 8;\n mac[macpos + 10] = this._h[5] >>> 0;\n mac[macpos + 11] = this._h[5] >>> 8;\n mac[macpos + 12] = this._h[6] >>> 0;\n mac[macpos + 13] = this._h[6] >>> 8;\n mac[macpos + 14] = this._h[7] >>> 0;\n mac[macpos + 15] = this._h[7] >>> 8;\n this._finished = true;\n return this;\n };\n Poly1305.prototype.update = function (m) {\n var mpos = 0;\n var bytes = m.length;\n var want;\n if (this._leftover) {\n want = (16 - this._leftover);\n if (want > bytes) {\n want = bytes;\n }\n for (var i = 0; i < want; i++) {\n this._buffer[this._leftover + i] = m[mpos + i];\n }\n bytes -= want;\n mpos += want;\n this._leftover += want;\n if (this._leftover < 16) {\n return this;\n }\n this._blocks(this._buffer, 0, 16);\n this._leftover = 0;\n }\n if (bytes >= 16) {\n want = bytes - (bytes % 16);\n this._blocks(m, mpos, want);\n mpos += want;\n bytes -= want;\n }\n if (bytes) {\n for (var i = 0; i < bytes; i++) {\n this._buffer[this._leftover + i] = m[mpos + i];\n }\n this._leftover += bytes;\n }\n return this;\n };\n Poly1305.prototype.digest = function () {\n // TODO(dchest): it behaves differently than other hashes/HMAC,\n // because it throws when finished — others just return saved result.\n if (this._finished) {\n throw new Error(\"Poly1305 was finished\");\n }\n var mac = new Uint8Array(16);\n this.finish(mac);\n return mac;\n };\n Poly1305.prototype.clean = function () {\n wipe_1.wipe(this._buffer);\n wipe_1.wipe(this._r);\n wipe_1.wipe(this._h);\n wipe_1.wipe(this._pad);\n this._leftover = 0;\n this._fin = 0;\n this._finished = true; // mark as finished even if not\n return this;\n };\n return Poly1305;\n}());\nexports.Poly1305 = Poly1305;\n/**\n * Returns 16-byte authenticator of data using a one-time 32-byte key.\n *\n * Important: key should be used for only one message, it should never repeat.\n */\nfunction oneTimeAuth(key, data) {\n var h = new Poly1305(key);\n h.update(data);\n var digest = h.digest();\n h.clean();\n return digest;\n}\nexports.oneTimeAuth = oneTimeAuth;\n/**\n * Returns true if two authenticators are 16-byte long and equal.\n * Uses contant-time comparison to avoid leaking timing information.\n */\nfunction equal(a, b) {\n if (a.length !== exports.DIGEST_LENGTH || b.length !== exports.DIGEST_LENGTH) {\n return false;\n }\n return constant_time_1.equal(a, b);\n}\nexports.equal = equal;\n//# sourceMappingURL=poly1305.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@stablelib/poly1305/lib/poly1305.js?"); - -/***/ }), - -/***/ "./node_modules/@stablelib/random/lib/random.js": -/*!******************************************************!*\ - !*** ./node_modules/@stablelib/random/lib/random.js ***! - \******************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.randomStringForEntropy = exports.randomString = exports.randomUint32 = exports.randomBytes = exports.defaultRandomSource = void 0;\nconst system_1 = __webpack_require__(/*! ./source/system */ \"./node_modules/@stablelib/random/lib/source/system.js\");\nconst binary_1 = __webpack_require__(/*! @stablelib/binary */ \"./node_modules/@stablelib/binary/lib/binary.js\");\nconst wipe_1 = __webpack_require__(/*! @stablelib/wipe */ \"./node_modules/@stablelib/wipe/lib/wipe.js\");\nexports.defaultRandomSource = new system_1.SystemRandomSource();\nfunction randomBytes(length, prng = exports.defaultRandomSource) {\n return prng.randomBytes(length);\n}\nexports.randomBytes = randomBytes;\n/**\n * Returns a uniformly random unsigned 32-bit integer.\n */\nfunction randomUint32(prng = exports.defaultRandomSource) {\n // Generate 4-byte random buffer.\n const buf = randomBytes(4, prng);\n // Convert bytes from buffer into a 32-bit integer.\n // It's not important which byte order to use, since\n // the result is random.\n const result = (0, binary_1.readUint32LE)(buf);\n // Clean the buffer.\n (0, wipe_1.wipe)(buf);\n return result;\n}\nexports.randomUint32 = randomUint32;\n/** 62 alphanumeric characters for default charset of randomString() */\nconst ALPHANUMERIC = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\";\n/**\n * Returns a uniform random string of the given length\n * with characters from the given charset.\n *\n * Charset must not have more than 256 characters.\n *\n * Default charset generates case-sensitive alphanumeric\n * strings (0-9, A-Z, a-z).\n */\nfunction randomString(length, charset = ALPHANUMERIC, prng = exports.defaultRandomSource) {\n if (charset.length < 2) {\n throw new Error(\"randomString charset is too short\");\n }\n if (charset.length > 256) {\n throw new Error(\"randomString charset is too long\");\n }\n let out = '';\n const charsLen = charset.length;\n const maxByte = 256 - (256 % charsLen);\n while (length > 0) {\n const buf = randomBytes(Math.ceil(length * 256 / maxByte), prng);\n for (let i = 0; i < buf.length && length > 0; i++) {\n const randomByte = buf[i];\n if (randomByte < maxByte) {\n out += charset.charAt(randomByte % charsLen);\n length--;\n }\n }\n (0, wipe_1.wipe)(buf);\n }\n return out;\n}\nexports.randomString = randomString;\n/**\n * Returns uniform random string containing at least the given\n * number of bits of entropy.\n *\n * For example, randomStringForEntropy(128) will return a 22-character\n * alphanumeric string, while randomStringForEntropy(128, \"0123456789\")\n * will return a 39-character numeric string, both will contain at\n * least 128 bits of entropy.\n *\n * Default charset generates case-sensitive alphanumeric\n * strings (0-9, A-Z, a-z).\n */\nfunction randomStringForEntropy(bits, charset = ALPHANUMERIC, prng = exports.defaultRandomSource) {\n const length = Math.ceil(bits / (Math.log(charset.length) / Math.LN2));\n return randomString(length, charset, prng);\n}\nexports.randomStringForEntropy = randomStringForEntropy;\n//# sourceMappingURL=random.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@stablelib/random/lib/random.js?"); - -/***/ }), - -/***/ "./node_modules/@stablelib/random/lib/source/browser.js": -/*!**************************************************************!*\ - !*** ./node_modules/@stablelib/random/lib/source/browser.js ***! - \**************************************************************/ -/***/ ((__unused_webpack_module, exports) => { - -eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.BrowserRandomSource = void 0;\nconst QUOTA = 65536;\nclass BrowserRandomSource {\n constructor() {\n this.isAvailable = false;\n this.isInstantiated = false;\n const browserCrypto = typeof self !== 'undefined'\n ? (self.crypto || self.msCrypto) // IE11 has msCrypto\n : null;\n if (browserCrypto && browserCrypto.getRandomValues !== undefined) {\n this._crypto = browserCrypto;\n this.isAvailable = true;\n this.isInstantiated = true;\n }\n }\n randomBytes(length) {\n if (!this.isAvailable || !this._crypto) {\n throw new Error(\"Browser random byte generator is not available.\");\n }\n const out = new Uint8Array(length);\n for (let i = 0; i < out.length; i += QUOTA) {\n this._crypto.getRandomValues(out.subarray(i, i + Math.min(out.length - i, QUOTA)));\n }\n return out;\n }\n}\nexports.BrowserRandomSource = BrowserRandomSource;\n//# sourceMappingURL=browser.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@stablelib/random/lib/source/browser.js?"); - -/***/ }), - -/***/ "./node_modules/@stablelib/random/lib/source/node.js": -/*!***********************************************************!*\ - !*** ./node_modules/@stablelib/random/lib/source/node.js ***! - \***********************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.NodeRandomSource = void 0;\nconst wipe_1 = __webpack_require__(/*! @stablelib/wipe */ \"./node_modules/@stablelib/wipe/lib/wipe.js\");\nclass NodeRandomSource {\n constructor() {\n this.isAvailable = false;\n this.isInstantiated = false;\n if (true) {\n const nodeCrypto = __webpack_require__(/*! crypto */ \"?25ed\");\n if (nodeCrypto && nodeCrypto.randomBytes) {\n this._crypto = nodeCrypto;\n this.isAvailable = true;\n this.isInstantiated = true;\n }\n }\n }\n randomBytes(length) {\n if (!this.isAvailable || !this._crypto) {\n throw new Error(\"Node.js random byte generator is not available.\");\n }\n // Get random bytes (result is Buffer).\n let buffer = this._crypto.randomBytes(length);\n // Make sure we got the length that we requested.\n if (buffer.length !== length) {\n throw new Error(\"NodeRandomSource: got fewer bytes than requested\");\n }\n // Allocate output array.\n const out = new Uint8Array(length);\n // Copy bytes from buffer to output.\n for (let i = 0; i < out.length; i++) {\n out[i] = buffer[i];\n }\n // Cleanup.\n (0, wipe_1.wipe)(buffer);\n return out;\n }\n}\nexports.NodeRandomSource = NodeRandomSource;\n//# sourceMappingURL=node.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@stablelib/random/lib/source/node.js?"); - -/***/ }), - -/***/ "./node_modules/@stablelib/random/lib/source/system.js": -/*!*************************************************************!*\ - !*** ./node_modules/@stablelib/random/lib/source/system.js ***! - \*************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.SystemRandomSource = void 0;\nconst browser_1 = __webpack_require__(/*! ./browser */ \"./node_modules/@stablelib/random/lib/source/browser.js\");\nconst node_1 = __webpack_require__(/*! ./node */ \"./node_modules/@stablelib/random/lib/source/node.js\");\nclass SystemRandomSource {\n constructor() {\n this.isAvailable = false;\n this.name = \"\";\n // Try browser.\n this._source = new browser_1.BrowserRandomSource();\n if (this._source.isAvailable) {\n this.isAvailable = true;\n this.name = \"Browser\";\n return;\n }\n // If no browser source, try Node.\n this._source = new node_1.NodeRandomSource();\n if (this._source.isAvailable) {\n this.isAvailable = true;\n this.name = \"Node\";\n return;\n }\n // No sources, we're out of options.\n }\n randomBytes(length) {\n if (!this.isAvailable) {\n throw new Error(\"System random byte generator is not available.\");\n }\n return this._source.randomBytes(length);\n }\n}\nexports.SystemRandomSource = SystemRandomSource;\n//# sourceMappingURL=system.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@stablelib/random/lib/source/system.js?"); - -/***/ }), - -/***/ "./node_modules/@stablelib/sha256/lib/sha256.js": -/*!******************************************************!*\ - !*** ./node_modules/@stablelib/sha256/lib/sha256.js ***! - \******************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nvar binary_1 = __webpack_require__(/*! @stablelib/binary */ \"./node_modules/@stablelib/binary/lib/binary.js\");\nvar wipe_1 = __webpack_require__(/*! @stablelib/wipe */ \"./node_modules/@stablelib/wipe/lib/wipe.js\");\nexports.DIGEST_LENGTH = 32;\nexports.BLOCK_SIZE = 64;\n/**\n * SHA2-256 cryptographic hash algorithm.\n */\nvar SHA256 = /** @class */ (function () {\n function SHA256() {\n /** Length of hash output */\n this.digestLength = exports.DIGEST_LENGTH;\n /** Block size */\n this.blockSize = exports.BLOCK_SIZE;\n // Note: Int32Array is used instead of Uint32Array for performance reasons.\n this._state = new Int32Array(8); // hash state\n this._temp = new Int32Array(64); // temporary state\n this._buffer = new Uint8Array(128); // buffer for data to hash\n this._bufferLength = 0; // number of bytes in buffer\n this._bytesHashed = 0; // number of total bytes hashed\n this._finished = false; // indicates whether the hash was finalized\n this.reset();\n }\n SHA256.prototype._initState = function () {\n this._state[0] = 0x6a09e667;\n this._state[1] = 0xbb67ae85;\n this._state[2] = 0x3c6ef372;\n this._state[3] = 0xa54ff53a;\n this._state[4] = 0x510e527f;\n this._state[5] = 0x9b05688c;\n this._state[6] = 0x1f83d9ab;\n this._state[7] = 0x5be0cd19;\n };\n /**\n * Resets hash state making it possible\n * to re-use this instance to hash other data.\n */\n SHA256.prototype.reset = function () {\n this._initState();\n this._bufferLength = 0;\n this._bytesHashed = 0;\n this._finished = false;\n return this;\n };\n /**\n * Cleans internal buffers and resets hash state.\n */\n SHA256.prototype.clean = function () {\n wipe_1.wipe(this._buffer);\n wipe_1.wipe(this._temp);\n this.reset();\n };\n /**\n * Updates hash state with the given data.\n *\n * Throws error when trying to update already finalized hash:\n * instance must be reset to update it again.\n */\n SHA256.prototype.update = function (data, dataLength) {\n if (dataLength === void 0) { dataLength = data.length; }\n if (this._finished) {\n throw new Error(\"SHA256: can't update because hash was finished.\");\n }\n var dataPos = 0;\n this._bytesHashed += dataLength;\n if (this._bufferLength > 0) {\n while (this._bufferLength < this.blockSize && dataLength > 0) {\n this._buffer[this._bufferLength++] = data[dataPos++];\n dataLength--;\n }\n if (this._bufferLength === this.blockSize) {\n hashBlocks(this._temp, this._state, this._buffer, 0, this.blockSize);\n this._bufferLength = 0;\n }\n }\n if (dataLength >= this.blockSize) {\n dataPos = hashBlocks(this._temp, this._state, data, dataPos, dataLength);\n dataLength %= this.blockSize;\n }\n while (dataLength > 0) {\n this._buffer[this._bufferLength++] = data[dataPos++];\n dataLength--;\n }\n return this;\n };\n /**\n * Finalizes hash state and puts hash into out.\n * If hash was already finalized, puts the same value.\n */\n SHA256.prototype.finish = function (out) {\n if (!this._finished) {\n var bytesHashed = this._bytesHashed;\n var left = this._bufferLength;\n var bitLenHi = (bytesHashed / 0x20000000) | 0;\n var bitLenLo = bytesHashed << 3;\n var padLength = (bytesHashed % 64 < 56) ? 64 : 128;\n this._buffer[left] = 0x80;\n for (var i = left + 1; i < padLength - 8; i++) {\n this._buffer[i] = 0;\n }\n binary_1.writeUint32BE(bitLenHi, this._buffer, padLength - 8);\n binary_1.writeUint32BE(bitLenLo, this._buffer, padLength - 4);\n hashBlocks(this._temp, this._state, this._buffer, 0, padLength);\n this._finished = true;\n }\n for (var i = 0; i < this.digestLength / 4; i++) {\n binary_1.writeUint32BE(this._state[i], out, i * 4);\n }\n return this;\n };\n /**\n * Returns the final hash digest.\n */\n SHA256.prototype.digest = function () {\n var out = new Uint8Array(this.digestLength);\n this.finish(out);\n return out;\n };\n /**\n * Function useful for HMAC/PBKDF2 optimization.\n * Returns hash state to be used with restoreState().\n * Only chain value is saved, not buffers or other\n * state variables.\n */\n SHA256.prototype.saveState = function () {\n if (this._finished) {\n throw new Error(\"SHA256: cannot save finished state\");\n }\n return {\n state: new Int32Array(this._state),\n buffer: this._bufferLength > 0 ? new Uint8Array(this._buffer) : undefined,\n bufferLength: this._bufferLength,\n bytesHashed: this._bytesHashed\n };\n };\n /**\n * Function useful for HMAC/PBKDF2 optimization.\n * Restores state saved by saveState() and sets bytesHashed\n * to the given value.\n */\n SHA256.prototype.restoreState = function (savedState) {\n this._state.set(savedState.state);\n this._bufferLength = savedState.bufferLength;\n if (savedState.buffer) {\n this._buffer.set(savedState.buffer);\n }\n this._bytesHashed = savedState.bytesHashed;\n this._finished = false;\n return this;\n };\n /**\n * Cleans state returned by saveState().\n */\n SHA256.prototype.cleanSavedState = function (savedState) {\n wipe_1.wipe(savedState.state);\n if (savedState.buffer) {\n wipe_1.wipe(savedState.buffer);\n }\n savedState.bufferLength = 0;\n savedState.bytesHashed = 0;\n };\n return SHA256;\n}());\nexports.SHA256 = SHA256;\n// Constants\nvar K = new Int32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b,\n 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01,\n 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7,\n 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,\n 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152,\n 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,\n 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc,\n 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819,\n 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08,\n 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f,\n 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n]);\nfunction hashBlocks(w, v, p, pos, len) {\n while (len >= 64) {\n var a = v[0];\n var b = v[1];\n var c = v[2];\n var d = v[3];\n var e = v[4];\n var f = v[5];\n var g = v[6];\n var h = v[7];\n for (var i = 0; i < 16; i++) {\n var j = pos + i * 4;\n w[i] = binary_1.readUint32BE(p, j);\n }\n for (var i = 16; i < 64; i++) {\n var u = w[i - 2];\n var t1 = (u >>> 17 | u << (32 - 17)) ^ (u >>> 19 | u << (32 - 19)) ^ (u >>> 10);\n u = w[i - 15];\n var t2 = (u >>> 7 | u << (32 - 7)) ^ (u >>> 18 | u << (32 - 18)) ^ (u >>> 3);\n w[i] = (t1 + w[i - 7] | 0) + (t2 + w[i - 16] | 0);\n }\n for (var i = 0; i < 64; i++) {\n var t1 = (((((e >>> 6 | e << (32 - 6)) ^ (e >>> 11 | e << (32 - 11)) ^\n (e >>> 25 | e << (32 - 25))) + ((e & f) ^ (~e & g))) | 0) +\n ((h + ((K[i] + w[i]) | 0)) | 0)) | 0;\n var t2 = (((a >>> 2 | a << (32 - 2)) ^ (a >>> 13 | a << (32 - 13)) ^\n (a >>> 22 | a << (32 - 22))) + ((a & b) ^ (a & c) ^ (b & c))) | 0;\n h = g;\n g = f;\n f = e;\n e = (d + t1) | 0;\n d = c;\n c = b;\n b = a;\n a = (t1 + t2) | 0;\n }\n v[0] += a;\n v[1] += b;\n v[2] += c;\n v[3] += d;\n v[4] += e;\n v[5] += f;\n v[6] += g;\n v[7] += h;\n pos += 64;\n len -= 64;\n }\n return pos;\n}\nfunction hash(data) {\n var h = new SHA256();\n h.update(data);\n var digest = h.digest();\n h.clean();\n return digest;\n}\nexports.hash = hash;\n//# sourceMappingURL=sha256.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@stablelib/sha256/lib/sha256.js?"); - -/***/ }), - -/***/ "./node_modules/@stablelib/sha512/lib/sha512.js": -/*!******************************************************!*\ - !*** ./node_modules/@stablelib/sha512/lib/sha512.js ***! - \******************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nvar binary_1 = __webpack_require__(/*! @stablelib/binary */ \"./node_modules/@stablelib/binary/lib/binary.js\");\nvar wipe_1 = __webpack_require__(/*! @stablelib/wipe */ \"./node_modules/@stablelib/wipe/lib/wipe.js\");\nexports.DIGEST_LENGTH = 64;\nexports.BLOCK_SIZE = 128;\n/**\n * SHA-2-512 cryptographic hash algorithm.\n */\nvar SHA512 = /** @class */ (function () {\n function SHA512() {\n /** Length of hash output */\n this.digestLength = exports.DIGEST_LENGTH;\n /** Block size */\n this.blockSize = exports.BLOCK_SIZE;\n // Note: Int32Array is used instead of Uint32Array for performance reasons.\n this._stateHi = new Int32Array(8); // hash state, high bytes\n this._stateLo = new Int32Array(8); // hash state, low bytes\n this._tempHi = new Int32Array(16); // temporary state, high bytes\n this._tempLo = new Int32Array(16); // temporary state, low bytes\n this._buffer = new Uint8Array(256); // buffer for data to hash\n this._bufferLength = 0; // number of bytes in buffer\n this._bytesHashed = 0; // number of total bytes hashed\n this._finished = false; // indicates whether the hash was finalized\n this.reset();\n }\n SHA512.prototype._initState = function () {\n this._stateHi[0] = 0x6a09e667;\n this._stateHi[1] = 0xbb67ae85;\n this._stateHi[2] = 0x3c6ef372;\n this._stateHi[3] = 0xa54ff53a;\n this._stateHi[4] = 0x510e527f;\n this._stateHi[5] = 0x9b05688c;\n this._stateHi[6] = 0x1f83d9ab;\n this._stateHi[7] = 0x5be0cd19;\n this._stateLo[0] = 0xf3bcc908;\n this._stateLo[1] = 0x84caa73b;\n this._stateLo[2] = 0xfe94f82b;\n this._stateLo[3] = 0x5f1d36f1;\n this._stateLo[4] = 0xade682d1;\n this._stateLo[5] = 0x2b3e6c1f;\n this._stateLo[6] = 0xfb41bd6b;\n this._stateLo[7] = 0x137e2179;\n };\n /**\n * Resets hash state making it possible\n * to re-use this instance to hash other data.\n */\n SHA512.prototype.reset = function () {\n this._initState();\n this._bufferLength = 0;\n this._bytesHashed = 0;\n this._finished = false;\n return this;\n };\n /**\n * Cleans internal buffers and resets hash state.\n */\n SHA512.prototype.clean = function () {\n wipe_1.wipe(this._buffer);\n wipe_1.wipe(this._tempHi);\n wipe_1.wipe(this._tempLo);\n this.reset();\n };\n /**\n * Updates hash state with the given data.\n *\n * Throws error when trying to update already finalized hash:\n * instance must be reset to update it again.\n */\n SHA512.prototype.update = function (data, dataLength) {\n if (dataLength === void 0) { dataLength = data.length; }\n if (this._finished) {\n throw new Error(\"SHA512: can't update because hash was finished.\");\n }\n var dataPos = 0;\n this._bytesHashed += dataLength;\n if (this._bufferLength > 0) {\n while (this._bufferLength < exports.BLOCK_SIZE && dataLength > 0) {\n this._buffer[this._bufferLength++] = data[dataPos++];\n dataLength--;\n }\n if (this._bufferLength === this.blockSize) {\n hashBlocks(this._tempHi, this._tempLo, this._stateHi, this._stateLo, this._buffer, 0, this.blockSize);\n this._bufferLength = 0;\n }\n }\n if (dataLength >= this.blockSize) {\n dataPos = hashBlocks(this._tempHi, this._tempLo, this._stateHi, this._stateLo, data, dataPos, dataLength);\n dataLength %= this.blockSize;\n }\n while (dataLength > 0) {\n this._buffer[this._bufferLength++] = data[dataPos++];\n dataLength--;\n }\n return this;\n };\n /**\n * Finalizes hash state and puts hash into out.\n * If hash was already finalized, puts the same value.\n */\n SHA512.prototype.finish = function (out) {\n if (!this._finished) {\n var bytesHashed = this._bytesHashed;\n var left = this._bufferLength;\n var bitLenHi = (bytesHashed / 0x20000000) | 0;\n var bitLenLo = bytesHashed << 3;\n var padLength = (bytesHashed % 128 < 112) ? 128 : 256;\n this._buffer[left] = 0x80;\n for (var i = left + 1; i < padLength - 8; i++) {\n this._buffer[i] = 0;\n }\n binary_1.writeUint32BE(bitLenHi, this._buffer, padLength - 8);\n binary_1.writeUint32BE(bitLenLo, this._buffer, padLength - 4);\n hashBlocks(this._tempHi, this._tempLo, this._stateHi, this._stateLo, this._buffer, 0, padLength);\n this._finished = true;\n }\n for (var i = 0; i < this.digestLength / 8; i++) {\n binary_1.writeUint32BE(this._stateHi[i], out, i * 8);\n binary_1.writeUint32BE(this._stateLo[i], out, i * 8 + 4);\n }\n return this;\n };\n /**\n * Returns the final hash digest.\n */\n SHA512.prototype.digest = function () {\n var out = new Uint8Array(this.digestLength);\n this.finish(out);\n return out;\n };\n /**\n * Function useful for HMAC/PBKDF2 optimization. Returns hash state to be\n * used with restoreState(). Only chain value is saved, not buffers or\n * other state variables.\n */\n SHA512.prototype.saveState = function () {\n if (this._finished) {\n throw new Error(\"SHA256: cannot save finished state\");\n }\n return {\n stateHi: new Int32Array(this._stateHi),\n stateLo: new Int32Array(this._stateLo),\n buffer: this._bufferLength > 0 ? new Uint8Array(this._buffer) : undefined,\n bufferLength: this._bufferLength,\n bytesHashed: this._bytesHashed\n };\n };\n /**\n * Function useful for HMAC/PBKDF2 optimization. Restores state saved by\n * saveState() and sets bytesHashed to the given value.\n */\n SHA512.prototype.restoreState = function (savedState) {\n this._stateHi.set(savedState.stateHi);\n this._stateLo.set(savedState.stateLo);\n this._bufferLength = savedState.bufferLength;\n if (savedState.buffer) {\n this._buffer.set(savedState.buffer);\n }\n this._bytesHashed = savedState.bytesHashed;\n this._finished = false;\n return this;\n };\n /**\n * Cleans state returned by saveState().\n */\n SHA512.prototype.cleanSavedState = function (savedState) {\n wipe_1.wipe(savedState.stateHi);\n wipe_1.wipe(savedState.stateLo);\n if (savedState.buffer) {\n wipe_1.wipe(savedState.buffer);\n }\n savedState.bufferLength = 0;\n savedState.bytesHashed = 0;\n };\n return SHA512;\n}());\nexports.SHA512 = SHA512;\n// Constants\nvar K = new Int32Array([\n 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,\n 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,\n 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,\n 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,\n 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,\n 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,\n 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,\n 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,\n 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,\n 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,\n 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,\n 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,\n 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,\n 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,\n 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,\n 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,\n 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,\n 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,\n 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,\n 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,\n 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,\n 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,\n 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,\n 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,\n 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,\n 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,\n 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,\n 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,\n 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,\n 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,\n 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,\n 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,\n 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,\n 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,\n 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,\n 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,\n 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,\n 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,\n 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,\n 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817\n]);\nfunction hashBlocks(wh, wl, hh, hl, m, pos, len) {\n var ah0 = hh[0], ah1 = hh[1], ah2 = hh[2], ah3 = hh[3], ah4 = hh[4], ah5 = hh[5], ah6 = hh[6], ah7 = hh[7], al0 = hl[0], al1 = hl[1], al2 = hl[2], al3 = hl[3], al4 = hl[4], al5 = hl[5], al6 = hl[6], al7 = hl[7];\n var h, l;\n var th, tl;\n var a, b, c, d;\n while (len >= 128) {\n for (var i = 0; i < 16; i++) {\n var j = 8 * i + pos;\n wh[i] = binary_1.readUint32BE(m, j);\n wl[i] = binary_1.readUint32BE(m, j + 4);\n }\n for (var i = 0; i < 80; i++) {\n var bh0 = ah0;\n var bh1 = ah1;\n var bh2 = ah2;\n var bh3 = ah3;\n var bh4 = ah4;\n var bh5 = ah5;\n var bh6 = ah6;\n var bh7 = ah7;\n var bl0 = al0;\n var bl1 = al1;\n var bl2 = al2;\n var bl3 = al3;\n var bl4 = al4;\n var bl5 = al5;\n var bl6 = al6;\n var bl7 = al7;\n // add\n h = ah7;\n l = al7;\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n // Sigma1\n h = ((ah4 >>> 14) | (al4 << (32 - 14))) ^ ((ah4 >>> 18) |\n (al4 << (32 - 18))) ^ ((al4 >>> (41 - 32)) | (ah4 << (32 - (41 - 32))));\n l = ((al4 >>> 14) | (ah4 << (32 - 14))) ^ ((al4 >>> 18) |\n (ah4 << (32 - 18))) ^ ((ah4 >>> (41 - 32)) | (al4 << (32 - (41 - 32))));\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n // Ch\n h = (ah4 & ah5) ^ (~ah4 & ah6);\n l = (al4 & al5) ^ (~al4 & al6);\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n // K\n h = K[i * 2];\n l = K[i * 2 + 1];\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n // w\n h = wh[i % 16];\n l = wl[i % 16];\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n th = c & 0xffff | d << 16;\n tl = a & 0xffff | b << 16;\n // add\n h = th;\n l = tl;\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n // Sigma0\n h = ((ah0 >>> 28) | (al0 << (32 - 28))) ^ ((al0 >>> (34 - 32)) |\n (ah0 << (32 - (34 - 32)))) ^ ((al0 >>> (39 - 32)) | (ah0 << (32 - (39 - 32))));\n l = ((al0 >>> 28) | (ah0 << (32 - 28))) ^ ((ah0 >>> (34 - 32)) |\n (al0 << (32 - (34 - 32)))) ^ ((ah0 >>> (39 - 32)) | (al0 << (32 - (39 - 32))));\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n // Maj\n h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);\n l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n bh7 = (c & 0xffff) | (d << 16);\n bl7 = (a & 0xffff) | (b << 16);\n // add\n h = bh3;\n l = bl3;\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n h = th;\n l = tl;\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n bh3 = (c & 0xffff) | (d << 16);\n bl3 = (a & 0xffff) | (b << 16);\n ah1 = bh0;\n ah2 = bh1;\n ah3 = bh2;\n ah4 = bh3;\n ah5 = bh4;\n ah6 = bh5;\n ah7 = bh6;\n ah0 = bh7;\n al1 = bl0;\n al2 = bl1;\n al3 = bl2;\n al4 = bl3;\n al5 = bl4;\n al6 = bl5;\n al7 = bl6;\n al0 = bl7;\n if (i % 16 === 15) {\n for (var j = 0; j < 16; j++) {\n // add\n h = wh[j];\n l = wl[j];\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n h = wh[(j + 9) % 16];\n l = wl[(j + 9) % 16];\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n // sigma0\n th = wh[(j + 1) % 16];\n tl = wl[(j + 1) % 16];\n h = ((th >>> 1) | (tl << (32 - 1))) ^ ((th >>> 8) |\n (tl << (32 - 8))) ^ (th >>> 7);\n l = ((tl >>> 1) | (th << (32 - 1))) ^ ((tl >>> 8) |\n (th << (32 - 8))) ^ ((tl >>> 7) | (th << (32 - 7)));\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n // sigma1\n th = wh[(j + 14) % 16];\n tl = wl[(j + 14) % 16];\n h = ((th >>> 19) | (tl << (32 - 19))) ^ ((tl >>> (61 - 32)) |\n (th << (32 - (61 - 32)))) ^ (th >>> 6);\n l = ((tl >>> 19) | (th << (32 - 19))) ^ ((th >>> (61 - 32)) |\n (tl << (32 - (61 - 32)))) ^ ((tl >>> 6) | (th << (32 - 6)));\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n wh[j] = (c & 0xffff) | (d << 16);\n wl[j] = (a & 0xffff) | (b << 16);\n }\n }\n }\n // add\n h = ah0;\n l = al0;\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n h = hh[0];\n l = hl[0];\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n hh[0] = ah0 = (c & 0xffff) | (d << 16);\n hl[0] = al0 = (a & 0xffff) | (b << 16);\n h = ah1;\n l = al1;\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n h = hh[1];\n l = hl[1];\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n hh[1] = ah1 = (c & 0xffff) | (d << 16);\n hl[1] = al1 = (a & 0xffff) | (b << 16);\n h = ah2;\n l = al2;\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n h = hh[2];\n l = hl[2];\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n hh[2] = ah2 = (c & 0xffff) | (d << 16);\n hl[2] = al2 = (a & 0xffff) | (b << 16);\n h = ah3;\n l = al3;\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n h = hh[3];\n l = hl[3];\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n hh[3] = ah3 = (c & 0xffff) | (d << 16);\n hl[3] = al3 = (a & 0xffff) | (b << 16);\n h = ah4;\n l = al4;\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n h = hh[4];\n l = hl[4];\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n hh[4] = ah4 = (c & 0xffff) | (d << 16);\n hl[4] = al4 = (a & 0xffff) | (b << 16);\n h = ah5;\n l = al5;\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n h = hh[5];\n l = hl[5];\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n hh[5] = ah5 = (c & 0xffff) | (d << 16);\n hl[5] = al5 = (a & 0xffff) | (b << 16);\n h = ah6;\n l = al6;\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n h = hh[6];\n l = hl[6];\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n hh[6] = ah6 = (c & 0xffff) | (d << 16);\n hl[6] = al6 = (a & 0xffff) | (b << 16);\n h = ah7;\n l = al7;\n a = l & 0xffff;\n b = l >>> 16;\n c = h & 0xffff;\n d = h >>> 16;\n h = hh[7];\n l = hl[7];\n a += l & 0xffff;\n b += l >>> 16;\n c += h & 0xffff;\n d += h >>> 16;\n b += a >>> 16;\n c += b >>> 16;\n d += c >>> 16;\n hh[7] = ah7 = (c & 0xffff) | (d << 16);\n hl[7] = al7 = (a & 0xffff) | (b << 16);\n pos += 128;\n len -= 128;\n }\n return pos;\n}\nfunction hash(data) {\n var h = new SHA512();\n h.update(data);\n var digest = h.digest();\n h.clean();\n return digest;\n}\nexports.hash = hash;\n//# sourceMappingURL=sha512.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@stablelib/sha512/lib/sha512.js?"); - -/***/ }), - -/***/ "./node_modules/@stablelib/wipe/lib/wipe.js": -/*!**************************************************!*\ - !*** ./node_modules/@stablelib/wipe/lib/wipe.js ***! - \**************************************************/ -/***/ ((__unused_webpack_module, exports) => { - -eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n/**\n * Sets all values in the given array to zero and returns it.\n *\n * The fact that it sets bytes to zero can be relied on.\n *\n * There is no guarantee that this function makes data disappear from memory,\n * as runtime implementation can, for example, have copying garbage collector\n * that will make copies of sensitive data before we wipe it. Or that an\n * operating system will write our data to swap or sleep image. Another thing\n * is that an optimizing compiler can remove calls to this function or make it\n * no-op. There's nothing we can do with it, so we just do our best and hope\n * that everything will be okay and good will triumph over evil.\n */\nfunction wipe(array) {\n // Right now it's similar to array.fill(0). If it turns\n // out that runtimes optimize this call away, maybe\n // we can try something else.\n for (var i = 0; i < array.length; i++) {\n array[i] = 0;\n }\n return array;\n}\nexports.wipe = wipe;\n//# sourceMappingURL=wipe.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@stablelib/wipe/lib/wipe.js?"); - -/***/ }), - -/***/ "./node_modules/@stablelib/x25519/lib/x25519.js": -/*!******************************************************!*\ - !*** ./node_modules/@stablelib/x25519/lib/x25519.js ***! - \******************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\n// Copyright (C) 2016 Dmitry Chestnykh\n// MIT License. See LICENSE file for details.\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.sharedKey = exports.generateKeyPair = exports.generateKeyPairFromSeed = exports.scalarMultBase = exports.scalarMult = exports.SHARED_KEY_LENGTH = exports.SECRET_KEY_LENGTH = exports.PUBLIC_KEY_LENGTH = void 0;\n/**\n * Package x25519 implements X25519 key agreement.\n */\nconst random_1 = __webpack_require__(/*! @stablelib/random */ \"./node_modules/@stablelib/random/lib/random.js\");\nconst wipe_1 = __webpack_require__(/*! @stablelib/wipe */ \"./node_modules/@stablelib/wipe/lib/wipe.js\");\nexports.PUBLIC_KEY_LENGTH = 32;\nexports.SECRET_KEY_LENGTH = 32;\nexports.SHARED_KEY_LENGTH = 32;\n// Returns new zero-filled 16-element GF (Float64Array).\n// If passed an array of numbers, prefills the returned\n// array with them.\n//\n// We use Float64Array, because we need 48-bit numbers\n// for this implementation.\nfunction gf(init) {\n const r = new Float64Array(16);\n if (init) {\n for (let i = 0; i < init.length; i++) {\n r[i] = init[i];\n }\n }\n return r;\n}\n// Base point.\nconst _9 = new Uint8Array(32);\n_9[0] = 9;\nconst _121665 = gf([0xdb41, 1]);\nfunction car25519(o) {\n let c = 1;\n for (let i = 0; i < 16; i++) {\n let v = o[i] + c + 65535;\n c = Math.floor(v / 65536);\n o[i] = v - c * 65536;\n }\n o[0] += c - 1 + 37 * (c - 1);\n}\nfunction sel25519(p, q, b) {\n const c = ~(b - 1);\n for (let i = 0; i < 16; i++) {\n const t = c & (p[i] ^ q[i]);\n p[i] ^= t;\n q[i] ^= t;\n }\n}\nfunction pack25519(o, n) {\n const m = gf();\n const t = gf();\n for (let i = 0; i < 16; i++) {\n t[i] = n[i];\n }\n car25519(t);\n car25519(t);\n car25519(t);\n for (let j = 0; j < 2; j++) {\n m[0] = t[0] - 0xffed;\n for (let i = 1; i < 15; i++) {\n m[i] = t[i] - 0xffff - ((m[i - 1] >> 16) & 1);\n m[i - 1] &= 0xffff;\n }\n m[15] = t[15] - 0x7fff - ((m[14] >> 16) & 1);\n const b = (m[15] >> 16) & 1;\n m[14] &= 0xffff;\n sel25519(t, m, 1 - b);\n }\n for (let i = 0; i < 16; i++) {\n o[2 * i] = t[i] & 0xff;\n o[2 * i + 1] = t[i] >> 8;\n }\n}\nfunction unpack25519(o, n) {\n for (let i = 0; i < 16; i++) {\n o[i] = n[2 * i] + (n[2 * i + 1] << 8);\n }\n o[15] &= 0x7fff;\n}\nfunction add(o, a, b) {\n for (let i = 0; i < 16; i++) {\n o[i] = a[i] + b[i];\n }\n}\nfunction sub(o, a, b) {\n for (let i = 0; i < 16; i++) {\n o[i] = a[i] - b[i];\n }\n}\nfunction mul(o, a, b) {\n let v, c, t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0, t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0, t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0, b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5], b6 = b[6], b7 = b[7], b8 = b[8], b9 = b[9], b10 = b[10], b11 = b[11], b12 = b[12], b13 = b[13], b14 = b[14], b15 = b[15];\n v = a[0];\n t0 += v * b0;\n t1 += v * b1;\n t2 += v * b2;\n t3 += v * b3;\n t4 += v * b4;\n t5 += v * b5;\n t6 += v * b6;\n t7 += v * b7;\n t8 += v * b8;\n t9 += v * b9;\n t10 += v * b10;\n t11 += v * b11;\n t12 += v * b12;\n t13 += v * b13;\n t14 += v * b14;\n t15 += v * b15;\n v = a[1];\n t1 += v * b0;\n t2 += v * b1;\n t3 += v * b2;\n t4 += v * b3;\n t5 += v * b4;\n t6 += v * b5;\n t7 += v * b6;\n t8 += v * b7;\n t9 += v * b8;\n t10 += v * b9;\n t11 += v * b10;\n t12 += v * b11;\n t13 += v * b12;\n t14 += v * b13;\n t15 += v * b14;\n t16 += v * b15;\n v = a[2];\n t2 += v * b0;\n t3 += v * b1;\n t4 += v * b2;\n t5 += v * b3;\n t6 += v * b4;\n t7 += v * b5;\n t8 += v * b6;\n t9 += v * b7;\n t10 += v * b8;\n t11 += v * b9;\n t12 += v * b10;\n t13 += v * b11;\n t14 += v * b12;\n t15 += v * b13;\n t16 += v * b14;\n t17 += v * b15;\n v = a[3];\n t3 += v * b0;\n t4 += v * b1;\n t5 += v * b2;\n t6 += v * b3;\n t7 += v * b4;\n t8 += v * b5;\n t9 += v * b6;\n t10 += v * b7;\n t11 += v * b8;\n t12 += v * b9;\n t13 += v * b10;\n t14 += v * b11;\n t15 += v * b12;\n t16 += v * b13;\n t17 += v * b14;\n t18 += v * b15;\n v = a[4];\n t4 += v * b0;\n t5 += v * b1;\n t6 += v * b2;\n t7 += v * b3;\n t8 += v * b4;\n t9 += v * b5;\n t10 += v * b6;\n t11 += v * b7;\n t12 += v * b8;\n t13 += v * b9;\n t14 += v * b10;\n t15 += v * b11;\n t16 += v * b12;\n t17 += v * b13;\n t18 += v * b14;\n t19 += v * b15;\n v = a[5];\n t5 += v * b0;\n t6 += v * b1;\n t7 += v * b2;\n t8 += v * b3;\n t9 += v * b4;\n t10 += v * b5;\n t11 += v * b6;\n t12 += v * b7;\n t13 += v * b8;\n t14 += v * b9;\n t15 += v * b10;\n t16 += v * b11;\n t17 += v * b12;\n t18 += v * b13;\n t19 += v * b14;\n t20 += v * b15;\n v = a[6];\n t6 += v * b0;\n t7 += v * b1;\n t8 += v * b2;\n t9 += v * b3;\n t10 += v * b4;\n t11 += v * b5;\n t12 += v * b6;\n t13 += v * b7;\n t14 += v * b8;\n t15 += v * b9;\n t16 += v * b10;\n t17 += v * b11;\n t18 += v * b12;\n t19 += v * b13;\n t20 += v * b14;\n t21 += v * b15;\n v = a[7];\n t7 += v * b0;\n t8 += v * b1;\n t9 += v * b2;\n t10 += v * b3;\n t11 += v * b4;\n t12 += v * b5;\n t13 += v * b6;\n t14 += v * b7;\n t15 += v * b8;\n t16 += v * b9;\n t17 += v * b10;\n t18 += v * b11;\n t19 += v * b12;\n t20 += v * b13;\n t21 += v * b14;\n t22 += v * b15;\n v = a[8];\n t8 += v * b0;\n t9 += v * b1;\n t10 += v * b2;\n t11 += v * b3;\n t12 += v * b4;\n t13 += v * b5;\n t14 += v * b6;\n t15 += v * b7;\n t16 += v * b8;\n t17 += v * b9;\n t18 += v * b10;\n t19 += v * b11;\n t20 += v * b12;\n t21 += v * b13;\n t22 += v * b14;\n t23 += v * b15;\n v = a[9];\n t9 += v * b0;\n t10 += v * b1;\n t11 += v * b2;\n t12 += v * b3;\n t13 += v * b4;\n t14 += v * b5;\n t15 += v * b6;\n t16 += v * b7;\n t17 += v * b8;\n t18 += v * b9;\n t19 += v * b10;\n t20 += v * b11;\n t21 += v * b12;\n t22 += v * b13;\n t23 += v * b14;\n t24 += v * b15;\n v = a[10];\n t10 += v * b0;\n t11 += v * b1;\n t12 += v * b2;\n t13 += v * b3;\n t14 += v * b4;\n t15 += v * b5;\n t16 += v * b6;\n t17 += v * b7;\n t18 += v * b8;\n t19 += v * b9;\n t20 += v * b10;\n t21 += v * b11;\n t22 += v * b12;\n t23 += v * b13;\n t24 += v * b14;\n t25 += v * b15;\n v = a[11];\n t11 += v * b0;\n t12 += v * b1;\n t13 += v * b2;\n t14 += v * b3;\n t15 += v * b4;\n t16 += v * b5;\n t17 += v * b6;\n t18 += v * b7;\n t19 += v * b8;\n t20 += v * b9;\n t21 += v * b10;\n t22 += v * b11;\n t23 += v * b12;\n t24 += v * b13;\n t25 += v * b14;\n t26 += v * b15;\n v = a[12];\n t12 += v * b0;\n t13 += v * b1;\n t14 += v * b2;\n t15 += v * b3;\n t16 += v * b4;\n t17 += v * b5;\n t18 += v * b6;\n t19 += v * b7;\n t20 += v * b8;\n t21 += v * b9;\n t22 += v * b10;\n t23 += v * b11;\n t24 += v * b12;\n t25 += v * b13;\n t26 += v * b14;\n t27 += v * b15;\n v = a[13];\n t13 += v * b0;\n t14 += v * b1;\n t15 += v * b2;\n t16 += v * b3;\n t17 += v * b4;\n t18 += v * b5;\n t19 += v * b6;\n t20 += v * b7;\n t21 += v * b8;\n t22 += v * b9;\n t23 += v * b10;\n t24 += v * b11;\n t25 += v * b12;\n t26 += v * b13;\n t27 += v * b14;\n t28 += v * b15;\n v = a[14];\n t14 += v * b0;\n t15 += v * b1;\n t16 += v * b2;\n t17 += v * b3;\n t18 += v * b4;\n t19 += v * b5;\n t20 += v * b6;\n t21 += v * b7;\n t22 += v * b8;\n t23 += v * b9;\n t24 += v * b10;\n t25 += v * b11;\n t26 += v * b12;\n t27 += v * b13;\n t28 += v * b14;\n t29 += v * b15;\n v = a[15];\n t15 += v * b0;\n t16 += v * b1;\n t17 += v * b2;\n t18 += v * b3;\n t19 += v * b4;\n t20 += v * b5;\n t21 += v * b6;\n t22 += v * b7;\n t23 += v * b8;\n t24 += v * b9;\n t25 += v * b10;\n t26 += v * b11;\n t27 += v * b12;\n t28 += v * b13;\n t29 += v * b14;\n t30 += v * b15;\n t0 += 38 * t16;\n t1 += 38 * t17;\n t2 += 38 * t18;\n t3 += 38 * t19;\n t4 += 38 * t20;\n t5 += 38 * t21;\n t6 += 38 * t22;\n t7 += 38 * t23;\n t8 += 38 * t24;\n t9 += 38 * t25;\n t10 += 38 * t26;\n t11 += 38 * t27;\n t12 += 38 * t28;\n t13 += 38 * t29;\n t14 += 38 * t30;\n // t15 left as is\n // first car\n c = 1;\n v = t0 + c + 65535;\n c = Math.floor(v / 65536);\n t0 = v - c * 65536;\n v = t1 + c + 65535;\n c = Math.floor(v / 65536);\n t1 = v - c * 65536;\n v = t2 + c + 65535;\n c = Math.floor(v / 65536);\n t2 = v - c * 65536;\n v = t3 + c + 65535;\n c = Math.floor(v / 65536);\n t3 = v - c * 65536;\n v = t4 + c + 65535;\n c = Math.floor(v / 65536);\n t4 = v - c * 65536;\n v = t5 + c + 65535;\n c = Math.floor(v / 65536);\n t5 = v - c * 65536;\n v = t6 + c + 65535;\n c = Math.floor(v / 65536);\n t6 = v - c * 65536;\n v = t7 + c + 65535;\n c = Math.floor(v / 65536);\n t7 = v - c * 65536;\n v = t8 + c + 65535;\n c = Math.floor(v / 65536);\n t8 = v - c * 65536;\n v = t9 + c + 65535;\n c = Math.floor(v / 65536);\n t9 = v - c * 65536;\n v = t10 + c + 65535;\n c = Math.floor(v / 65536);\n t10 = v - c * 65536;\n v = t11 + c + 65535;\n c = Math.floor(v / 65536);\n t11 = v - c * 65536;\n v = t12 + c + 65535;\n c = Math.floor(v / 65536);\n t12 = v - c * 65536;\n v = t13 + c + 65535;\n c = Math.floor(v / 65536);\n t13 = v - c * 65536;\n v = t14 + c + 65535;\n c = Math.floor(v / 65536);\n t14 = v - c * 65536;\n v = t15 + c + 65535;\n c = Math.floor(v / 65536);\n t15 = v - c * 65536;\n t0 += c - 1 + 37 * (c - 1);\n // second car\n c = 1;\n v = t0 + c + 65535;\n c = Math.floor(v / 65536);\n t0 = v - c * 65536;\n v = t1 + c + 65535;\n c = Math.floor(v / 65536);\n t1 = v - c * 65536;\n v = t2 + c + 65535;\n c = Math.floor(v / 65536);\n t2 = v - c * 65536;\n v = t3 + c + 65535;\n c = Math.floor(v / 65536);\n t3 = v - c * 65536;\n v = t4 + c + 65535;\n c = Math.floor(v / 65536);\n t4 = v - c * 65536;\n v = t5 + c + 65535;\n c = Math.floor(v / 65536);\n t5 = v - c * 65536;\n v = t6 + c + 65535;\n c = Math.floor(v / 65536);\n t6 = v - c * 65536;\n v = t7 + c + 65535;\n c = Math.floor(v / 65536);\n t7 = v - c * 65536;\n v = t8 + c + 65535;\n c = Math.floor(v / 65536);\n t8 = v - c * 65536;\n v = t9 + c + 65535;\n c = Math.floor(v / 65536);\n t9 = v - c * 65536;\n v = t10 + c + 65535;\n c = Math.floor(v / 65536);\n t10 = v - c * 65536;\n v = t11 + c + 65535;\n c = Math.floor(v / 65536);\n t11 = v - c * 65536;\n v = t12 + c + 65535;\n c = Math.floor(v / 65536);\n t12 = v - c * 65536;\n v = t13 + c + 65535;\n c = Math.floor(v / 65536);\n t13 = v - c * 65536;\n v = t14 + c + 65535;\n c = Math.floor(v / 65536);\n t14 = v - c * 65536;\n v = t15 + c + 65535;\n c = Math.floor(v / 65536);\n t15 = v - c * 65536;\n t0 += c - 1 + 37 * (c - 1);\n o[0] = t0;\n o[1] = t1;\n o[2] = t2;\n o[3] = t3;\n o[4] = t4;\n o[5] = t5;\n o[6] = t6;\n o[7] = t7;\n o[8] = t8;\n o[9] = t9;\n o[10] = t10;\n o[11] = t11;\n o[12] = t12;\n o[13] = t13;\n o[14] = t14;\n o[15] = t15;\n}\nfunction square(o, a) {\n mul(o, a, a);\n}\nfunction inv25519(o, inp) {\n const c = gf();\n for (let i = 0; i < 16; i++) {\n c[i] = inp[i];\n }\n for (let i = 253; i >= 0; i--) {\n square(c, c);\n if (i !== 2 && i !== 4) {\n mul(c, c, inp);\n }\n }\n for (let i = 0; i < 16; i++) {\n o[i] = c[i];\n }\n}\nfunction scalarMult(n, p) {\n const z = new Uint8Array(32);\n const x = new Float64Array(80);\n const a = gf(), b = gf(), c = gf(), d = gf(), e = gf(), f = gf();\n for (let i = 0; i < 31; i++) {\n z[i] = n[i];\n }\n z[31] = (n[31] & 127) | 64;\n z[0] &= 248;\n unpack25519(x, p);\n for (let i = 0; i < 16; i++) {\n b[i] = x[i];\n }\n a[0] = d[0] = 1;\n for (let i = 254; i >= 0; --i) {\n const r = (z[i >>> 3] >>> (i & 7)) & 1;\n sel25519(a, b, r);\n sel25519(c, d, r);\n add(e, a, c);\n sub(a, a, c);\n add(c, b, d);\n sub(b, b, d);\n square(d, e);\n square(f, a);\n mul(a, c, a);\n mul(c, b, e);\n add(e, a, c);\n sub(a, a, c);\n square(b, a);\n sub(c, d, f);\n mul(a, c, _121665);\n add(a, a, d);\n mul(c, c, a);\n mul(a, d, f);\n mul(d, b, x);\n square(b, e);\n sel25519(a, b, r);\n sel25519(c, d, r);\n }\n for (let i = 0; i < 16; i++) {\n x[i + 16] = a[i];\n x[i + 32] = c[i];\n x[i + 48] = b[i];\n x[i + 64] = d[i];\n }\n const x32 = x.subarray(32);\n const x16 = x.subarray(16);\n inv25519(x32, x32);\n mul(x16, x16, x32);\n const q = new Uint8Array(32);\n pack25519(q, x16);\n return q;\n}\nexports.scalarMult = scalarMult;\nfunction scalarMultBase(n) {\n return scalarMult(n, _9);\n}\nexports.scalarMultBase = scalarMultBase;\nfunction generateKeyPairFromSeed(seed) {\n if (seed.length !== exports.SECRET_KEY_LENGTH) {\n throw new Error(`x25519: seed must be ${exports.SECRET_KEY_LENGTH} bytes`);\n }\n const secretKey = new Uint8Array(seed);\n const publicKey = scalarMultBase(secretKey);\n return {\n publicKey,\n secretKey\n };\n}\nexports.generateKeyPairFromSeed = generateKeyPairFromSeed;\nfunction generateKeyPair(prng) {\n const seed = (0, random_1.randomBytes)(32, prng);\n const result = generateKeyPairFromSeed(seed);\n (0, wipe_1.wipe)(seed);\n return result;\n}\nexports.generateKeyPair = generateKeyPair;\n/**\n * Returns a shared key between our secret key and a peer's public key.\n *\n * Throws an error if the given keys are of wrong length.\n *\n * If rejectZero is true throws if the calculated shared key is all-zero.\n * From RFC 7748:\n *\n * > Protocol designers using Diffie-Hellman over the curves defined in\n * > this document must not assume \"contributory behavior\". Specially,\n * > contributory behavior means that both parties' private keys\n * > contribute to the resulting shared key. Since curve25519 and\n * > curve448 have cofactors of 8 and 4 (respectively), an input point of\n * > small order will eliminate any contribution from the other party's\n * > private key. This situation can be detected by checking for the all-\n * > zero output, which implementations MAY do, as specified in Section 6.\n * > However, a large number of existing implementations do not do this.\n *\n * IMPORTANT: the returned key is a raw result of scalar multiplication.\n * To use it as a key material, hash it with a cryptographic hash function.\n */\nfunction sharedKey(mySecretKey, theirPublicKey, rejectZero = false) {\n if (mySecretKey.length !== exports.PUBLIC_KEY_LENGTH) {\n throw new Error(\"X25519: incorrect secret key length\");\n }\n if (theirPublicKey.length !== exports.PUBLIC_KEY_LENGTH) {\n throw new Error(\"X25519: incorrect public key length\");\n }\n const result = scalarMult(mySecretKey, theirPublicKey);\n if (rejectZero) {\n let zeros = 0;\n for (let i = 0; i < result.length; i++) {\n zeros |= result[i];\n }\n if (zeros === 0) {\n throw new Error(\"X25519: invalid shared key\");\n }\n }\n return result;\n}\nexports.sharedKey = sharedKey;\n//# sourceMappingURL=x25519.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@stablelib/x25519/lib/x25519.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/auth-client/dist/index.es.js": -/*!******************************************************************!*\ - !*** ./node_modules/@walletconnect/auth-client/dist/index.es.js ***! - \******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AUTH_CLIENT_CONTEXT: () => (/* binding */ Z),\n/* harmony export */ AUTH_CLIENT_DEFAULT_NAME: () => (/* binding */ B),\n/* harmony export */ AUTH_CLIENT_PROTOCOL: () => (/* binding */ $),\n/* harmony export */ AUTH_CLIENT_PUBLIC_KEY_NAME: () => (/* binding */ x),\n/* harmony export */ AUTH_CLIENT_STORAGE_PREFIX: () => (/* binding */ F),\n/* harmony export */ AUTH_CLIENT_VERSION: () => (/* binding */ Q),\n/* harmony export */ AUTH_REQUEST_EXPIRY_BOUNDARIES: () => (/* binding */ U),\n/* harmony export */ AuthClient: () => (/* binding */ zr),\n/* harmony export */ BASE10: () => (/* binding */ Ir),\n/* harmony export */ BASE16: () => (/* binding */ ye),\n/* harmony export */ BASE64: () => (/* binding */ qr),\n/* harmony export */ DEFAULT_RPC_URL: () => (/* binding */ Y),\n/* harmony export */ ENGINE_RPC_OPTS: () => (/* binding */ R),\n/* harmony export */ EXPIRER_CONTEXT: () => (/* binding */ Ge),\n/* harmony export */ EXPIRER_DEFAULT_TTL: () => (/* binding */ Qe),\n/* harmony export */ EXPIRER_EVENTS: () => (/* binding */ He),\n/* harmony export */ EXPIRER_STORAGE_VERSION: () => (/* binding */ Ye),\n/* harmony export */ IAuthClient: () => (/* binding */ H),\n/* harmony export */ IAuthEngine: () => (/* binding */ G),\n/* harmony export */ UTF8: () => (/* binding */ we),\n/* harmony export */ \"default\": () => (/* binding */ S),\n/* harmony export */ generateNonce: () => (/* binding */ Ur),\n/* harmony export */ hashMessage: () => (/* binding */ K)\n/* harmony export */ });\n/* harmony import */ var _walletconnect_core__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @walletconnect/core */ \"./node_modules/@walletconnect/core/dist/index.es.js\");\n/* harmony import */ var _walletconnect_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/logger */ \"./node_modules/@walletconnect/logger/dist/cjs/index.js\");\n/* harmony import */ var _walletconnect_logger__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_walletconnect_logger__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\n/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(events__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @walletconnect/jsonrpc-utils */ \"./node_modules/@walletconnect/jsonrpc-utils/dist/esm/index.js\");\n/* harmony import */ var _walletconnect_utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @walletconnect/utils */ \"./node_modules/@walletconnect/utils/dist/index.es.js\");\n/* harmony import */ var _walletconnect_time__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @walletconnect/time */ \"./node_modules/@walletconnect/time/dist/cjs/index.js\");\n/* harmony import */ var _walletconnect_time__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_walletconnect_time__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _ethersproject_hash__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @ethersproject/hash */ \"./node_modules/@ethersproject/hash/lib.esm/message.js\");\n/* harmony import */ var _ethersproject_transactions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @ethersproject/transactions */ \"./node_modules/@ethersproject/transactions/lib.esm/index.js\");\n/* harmony import */ var isomorphic_unfetch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! isomorphic-unfetch */ \"./node_modules/isomorphic-unfetch/browser.js\");\n/* harmony import */ var isomorphic_unfetch__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(isomorphic_unfetch__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _stablelib_random__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @stablelib/random */ \"./node_modules/@stablelib/random/lib/random.js\");\n/* harmony import */ var _stablelib_sha256__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @stablelib/sha256 */ \"./node_modules/@stablelib/sha256/lib/sha256.js\");\nclass G{constructor(t){this.client=t}}class H{constructor(t){this.opts=t}}const Y=\"https://rpc.walletconnect.com/v1\",R={wc_authRequest:{req:{ttl:_walletconnect_time__WEBPACK_IMPORTED_MODULE_3__.ONE_DAY,prompt:!0,tag:3e3},res:{ttl:_walletconnect_time__WEBPACK_IMPORTED_MODULE_3__.ONE_DAY,prompt:!1,tag:3001}}},U={min:_walletconnect_time__WEBPACK_IMPORTED_MODULE_3__.FIVE_MINUTES,max:_walletconnect_time__WEBPACK_IMPORTED_MODULE_3__.SEVEN_DAYS},$=\"wc\",Q=1,Z=\"auth\",B=\"authClient\",F=`${$}@${1}:${Z}:`,x=`${F}:PUB_KEY`,Ge=\"expirer\",He={created:\"expirer_created\",deleted:\"expirer_deleted\",expired:\"expirer_expired\",sync:\"expirer_sync\"},Ye=\"0.3\",Qe=_walletconnect_time__WEBPACK_IMPORTED_MODULE_3__.ONE_DAY;function z(r){return r?.split(\":\")}function Ze(r){const t=r&&z(r);if(t)return t[3]}function We(r){const t=r&&z(r);if(t)return t[2]+\":\"+t[3]}function W(r){const t=r&&z(r);if(t)return t.pop()}async function et(r,t,e,i,n){switch(e.t){case\"eip191\":return tt(r,t,e.s);case\"eip1271\":return await rt(r,t,e.s,i,n);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${e.t}`)}}function tt(r,t,e){return (0,_ethersproject_transactions__WEBPACK_IMPORTED_MODULE_7__.recoverAddress)((0,_ethersproject_hash__WEBPACK_IMPORTED_MODULE_8__.hashMessage)(t),e).toLowerCase()===r.toLowerCase()}async function rt(r,t,e,i,n){try{const s=\"0x1626ba7e\",o=\"0000000000000000000000000000000000000000000000000000000000000040\",u=\"0000000000000000000000000000000000000000000000000000000000000041\",a=e.substring(2),c=(0,_ethersproject_hash__WEBPACK_IMPORTED_MODULE_8__.hashMessage)(t).substring(2),h=s+c+o+u+a,f=await isomorphic_unfetch__WEBPACK_IMPORTED_MODULE_4___default()(`${Y}/?chainId=${i}&projectId=${n}`,{method:\"POST\",body:JSON.stringify({id:it(),jsonrpc:\"2.0\",method:\"eth_call\",params:[{to:r,data:h},\"latest\"]})}),{result:p}=await f.json();return p?p.slice(0,s.length).toLowerCase()===s.toLowerCase():!1}catch(s){return console.error(\"isValidEip1271Signature: \",s),!1}}function it(){return Date.now()+Math.floor(Math.random()*1e3)}function ee(r){return r.getAll().filter(t=>\"requester\"in t)}function te(r,t){return ee(r).find(e=>e.id===t)}function nt(r){const t=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_9__.isValidUrl)(r.aud),e=new RegExp(`${r.domain}`).test(r.aud),i=!!r.nonce,n=r.type?r.type===\"eip4361\":!0,s=r.expiry;if(s&&!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_9__.isValidRequestExpiry)(s,U)){const{message:o}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_9__.getInternalError)(\"MISSING_OR_INVALID\",`request() expiry: ${s}. Expiry must be a number (in seconds) between ${U.min} and ${U.max}`);throw new Error(o)}return!!(t&&e&&i&&n)}function st(r,t){return!!te(t,r.id)}function ot(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function ut(r,t){if(r.length>=255)throw new TypeError(\"Alphabet too long\");for(var e=new Uint8Array(256),i=0;i>>0,g=new Uint8Array(w);E!==y;){for(var C=D[E],_=0,b=w-1;(C!==0||_>>0,g[b]=C%u>>>0,C=C/u>>>0;if(C!==0)throw new Error(\"Non-zero carry\");m=_,E++}for(var v=w-m;v!==w&&g[v]===0;)v++;for(var q=a.repeat(l);v>>0,w=new Uint8Array(y);D[l];){var g=e[D.charCodeAt(l)];if(g===255)return;for(var C=0,_=y-1;(g!==0||C>>0,w[_]=g%256>>>0,g=g/256>>>0;if(g!==0)throw new Error(\"Non-zero carry\");E=C,l++}if(D[l]!==\" \"){for(var b=y-E;b!==y&&w[b]===0;)b++;for(var v=new Uint8Array(m+(y-b)),q=m;b!==y;)v[q++]=w[b++];return v}}}function A(D){var l=p(D);if(l)return l;throw new Error(`Non-${t} character`)}return{encode:f,decodeUnsafe:p,decode:A}}var at=ut,Dt=at;const re=r=>{if(r instanceof Uint8Array&&r.constructor.name===\"Uint8Array\")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error(\"Unknown type, must be binary type\")},ct=r=>new TextEncoder().encode(r),ht=r=>new TextDecoder().decode(r);class lt{constructor(t,e,i){this.name=t,this.prefix=e,this.baseEncode=i}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error(\"Unknown type, must be binary type\")}}class dt{constructor(t,e,i){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error(\"Invalid prefix character\");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=i}decode(t){if(typeof t==\"string\"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error(\"Can only multibase decode strings\")}or(t){return ie(this,t)}}class pt{constructor(t){this.decoders=t}or(t){return ie(this,t)}decode(t){const e=t[0],i=this.decoders[e];if(i)return i.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const ie=(r,t)=>new pt({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}});class ft{constructor(t,e,i,n){this.name=t,this.prefix=e,this.baseEncode=i,this.baseDecode=n,this.encoder=new lt(t,e,i),this.decoder=new dt(t,e,n)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const O=({name:r,prefix:t,encode:e,decode:i})=>new ft(r,t,e,i),T=({prefix:r,name:t,alphabet:e})=>{const{encode:i,decode:n}=Dt(e,t);return O({prefix:r,name:t,encode:i,decode:s=>re(n(s))})},gt=(r,t,e,i)=>{const n={};for(let h=0;h=8&&(u-=8,o[c++]=255&a>>u)}if(u>=e||255&a<<8-u)throw new SyntaxError(\"Unexpected end of data\");return o},Et=(r,t,e)=>{const i=t[t.length-1]===\"=\",n=(1<e;)o-=e,s+=t[n&u>>o];if(o&&(s+=t[n&u<O({prefix:t,name:r,encode(n){return Et(n,i,e)},decode(n){return gt(n,i,e,r)}}),bt=O({prefix:\"\\0\",name:\"identity\",encode:r=>ht(r),decode:r=>ct(r)});var yt=Object.freeze({__proto__:null,identity:bt});const wt=d({prefix:\"0\",name:\"base2\",alphabet:\"01\",bitsPerChar:1});var Ct=Object.freeze({__proto__:null,base2:wt});const mt=d({prefix:\"7\",name:\"base8\",alphabet:\"01234567\",bitsPerChar:3});var vt=Object.freeze({__proto__:null,base8:mt});const At=T({prefix:\"9\",name:\"base10\",alphabet:\"0123456789\"});var _t=Object.freeze({__proto__:null,base10:At});const xt=d({prefix:\"f\",name:\"base16\",alphabet:\"0123456789abcdef\",bitsPerChar:4}),Rt=d({prefix:\"F\",name:\"base16upper\",alphabet:\"0123456789ABCDEF\",bitsPerChar:4});var Ft=Object.freeze({__proto__:null,base16:xt,base16upper:Rt});const Tt=d({prefix:\"b\",name:\"base32\",alphabet:\"abcdefghijklmnopqrstuvwxyz234567\",bitsPerChar:5}),It=d({prefix:\"B\",name:\"base32upper\",alphabet:\"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\",bitsPerChar:5}),qt=d({prefix:\"c\",name:\"base32pad\",alphabet:\"abcdefghijklmnopqrstuvwxyz234567=\",bitsPerChar:5}),Ut=d({prefix:\"C\",name:\"base32padupper\",alphabet:\"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=\",bitsPerChar:5}),Ot=d({prefix:\"v\",name:\"base32hex\",alphabet:\"0123456789abcdefghijklmnopqrstuv\",bitsPerChar:5}),St=d({prefix:\"V\",name:\"base32hexupper\",alphabet:\"0123456789ABCDEFGHIJKLMNOPQRSTUV\",bitsPerChar:5}),Pt=d({prefix:\"t\",name:\"base32hexpad\",alphabet:\"0123456789abcdefghijklmnopqrstuv=\",bitsPerChar:5}),Nt=d({prefix:\"T\",name:\"base32hexpadupper\",alphabet:\"0123456789ABCDEFGHIJKLMNOPQRSTUV=\",bitsPerChar:5}),$t=d({prefix:\"h\",name:\"base32z\",alphabet:\"ybndrfg8ejkmcpqxot1uwisza345h769\",bitsPerChar:5});var Bt=Object.freeze({__proto__:null,base32:Tt,base32upper:It,base32pad:qt,base32padupper:Ut,base32hex:Ot,base32hexupper:St,base32hexpad:Pt,base32hexpadupper:Nt,base32z:$t});const zt=T({prefix:\"k\",name:\"base36\",alphabet:\"0123456789abcdefghijklmnopqrstuvwxyz\"}),jt=T({prefix:\"K\",name:\"base36upper\",alphabet:\"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\"});var Mt=Object.freeze({__proto__:null,base36:zt,base36upper:jt});const Lt=T({name:\"base58btc\",prefix:\"z\",alphabet:\"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\"}),Kt=T({name:\"base58flickr\",prefix:\"Z\",alphabet:\"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ\"});var Vt=Object.freeze({__proto__:null,base58btc:Lt,base58flickr:Kt});const kt=d({prefix:\"m\",name:\"base64\",alphabet:\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",bitsPerChar:6}),Jt=d({prefix:\"M\",name:\"base64pad\",alphabet:\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\",bitsPerChar:6}),Xt=d({prefix:\"u\",name:\"base64url\",alphabet:\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_\",bitsPerChar:6}),Gt=d({prefix:\"U\",name:\"base64urlpad\",alphabet:\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=\",bitsPerChar:6});var Ht=Object.freeze({__proto__:null,base64:kt,base64pad:Jt,base64url:Xt,base64urlpad:Gt});const ne=Array.from(\"\\u{1F680}\\u{1FA90}\\u2604\\u{1F6F0}\\u{1F30C}\\u{1F311}\\u{1F312}\\u{1F313}\\u{1F314}\\u{1F315}\\u{1F316}\\u{1F317}\\u{1F318}\\u{1F30D}\\u{1F30F}\\u{1F30E}\\u{1F409}\\u2600\\u{1F4BB}\\u{1F5A5}\\u{1F4BE}\\u{1F4BF}\\u{1F602}\\u2764\\u{1F60D}\\u{1F923}\\u{1F60A}\\u{1F64F}\\u{1F495}\\u{1F62D}\\u{1F618}\\u{1F44D}\\u{1F605}\\u{1F44F}\\u{1F601}\\u{1F525}\\u{1F970}\\u{1F494}\\u{1F496}\\u{1F499}\\u{1F622}\\u{1F914}\\u{1F606}\\u{1F644}\\u{1F4AA}\\u{1F609}\\u263A\\u{1F44C}\\u{1F917}\\u{1F49C}\\u{1F614}\\u{1F60E}\\u{1F607}\\u{1F339}\\u{1F926}\\u{1F389}\\u{1F49E}\\u270C\\u2728\\u{1F937}\\u{1F631}\\u{1F60C}\\u{1F338}\\u{1F64C}\\u{1F60B}\\u{1F497}\\u{1F49A}\\u{1F60F}\\u{1F49B}\\u{1F642}\\u{1F493}\\u{1F929}\\u{1F604}\\u{1F600}\\u{1F5A4}\\u{1F603}\\u{1F4AF}\\u{1F648}\\u{1F447}\\u{1F3B6}\\u{1F612}\\u{1F92D}\\u2763\\u{1F61C}\\u{1F48B}\\u{1F440}\\u{1F62A}\\u{1F611}\\u{1F4A5}\\u{1F64B}\\u{1F61E}\\u{1F629}\\u{1F621}\\u{1F92A}\\u{1F44A}\\u{1F973}\\u{1F625}\\u{1F924}\\u{1F449}\\u{1F483}\\u{1F633}\\u270B\\u{1F61A}\\u{1F61D}\\u{1F634}\\u{1F31F}\\u{1F62C}\\u{1F643}\\u{1F340}\\u{1F337}\\u{1F63B}\\u{1F613}\\u2B50\\u2705\\u{1F97A}\\u{1F308}\\u{1F608}\\u{1F918}\\u{1F4A6}\\u2714\\u{1F623}\\u{1F3C3}\\u{1F490}\\u2639\\u{1F38A}\\u{1F498}\\u{1F620}\\u261D\\u{1F615}\\u{1F33A}\\u{1F382}\\u{1F33B}\\u{1F610}\\u{1F595}\\u{1F49D}\\u{1F64A}\\u{1F639}\\u{1F5E3}\\u{1F4AB}\\u{1F480}\\u{1F451}\\u{1F3B5}\\u{1F91E}\\u{1F61B}\\u{1F534}\\u{1F624}\\u{1F33C}\\u{1F62B}\\u26BD\\u{1F919}\\u2615\\u{1F3C6}\\u{1F92B}\\u{1F448}\\u{1F62E}\\u{1F646}\\u{1F37B}\\u{1F343}\\u{1F436}\\u{1F481}\\u{1F632}\\u{1F33F}\\u{1F9E1}\\u{1F381}\\u26A1\\u{1F31E}\\u{1F388}\\u274C\\u270A\\u{1F44B}\\u{1F630}\\u{1F928}\\u{1F636}\\u{1F91D}\\u{1F6B6}\\u{1F4B0}\\u{1F353}\\u{1F4A2}\\u{1F91F}\\u{1F641}\\u{1F6A8}\\u{1F4A8}\\u{1F92C}\\u2708\\u{1F380}\\u{1F37A}\\u{1F913}\\u{1F619}\\u{1F49F}\\u{1F331}\\u{1F616}\\u{1F476}\\u{1F974}\\u25B6\\u27A1\\u2753\\u{1F48E}\\u{1F4B8}\\u2B07\\u{1F628}\\u{1F31A}\\u{1F98B}\\u{1F637}\\u{1F57A}\\u26A0\\u{1F645}\\u{1F61F}\\u{1F635}\\u{1F44E}\\u{1F932}\\u{1F920}\\u{1F927}\\u{1F4CC}\\u{1F535}\\u{1F485}\\u{1F9D0}\\u{1F43E}\\u{1F352}\\u{1F617}\\u{1F911}\\u{1F30A}\\u{1F92F}\\u{1F437}\\u260E\\u{1F4A7}\\u{1F62F}\\u{1F486}\\u{1F446}\\u{1F3A4}\\u{1F647}\\u{1F351}\\u2744\\u{1F334}\\u{1F4A3}\\u{1F438}\\u{1F48C}\\u{1F4CD}\\u{1F940}\\u{1F922}\\u{1F445}\\u{1F4A1}\\u{1F4A9}\\u{1F450}\\u{1F4F8}\\u{1F47B}\\u{1F910}\\u{1F92E}\\u{1F3BC}\\u{1F975}\\u{1F6A9}\\u{1F34E}\\u{1F34A}\\u{1F47C}\\u{1F48D}\\u{1F4E3}\\u{1F942}\"),Yt=ne.reduce((r,t,e)=>(r[e]=t,r),[]),Qt=ne.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function Zt(r){return r.reduce((t,e)=>(t+=Yt[e],t),\"\")}function Wt(r){const t=[];for(const e of r){const i=Qt[e.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(i)}return new Uint8Array(t)}const er=O({prefix:\"\\u{1F680}\",name:\"base256emoji\",encode:Zt,decode:Wt});var tr=Object.freeze({__proto__:null,base256emoji:er}),rr=oe,se=128,ir=127,nr=~ir,sr=Math.pow(2,31);function oe(r,t,e){t=t||[],e=e||0;for(var i=e;r>=sr;)t[e++]=r&255|se,r/=128;for(;r&nr;)t[e++]=r&255|se,r>>>=7;return t[e]=r|0,oe.bytes=e-i+1,t}var or=j,ur=128,ue=127;function j(r,i){var e=0,i=i||0,n=0,s=i,o,u=r.length;do{if(s>=u)throw j.bytes=0,new RangeError(\"Could not decode varint\");o=r[s++],e+=n<28?(o&ue)<=ur);return j.bytes=s-i,e}var ar=Math.pow(2,7),Dr=Math.pow(2,14),cr=Math.pow(2,21),hr=Math.pow(2,28),lr=Math.pow(2,35),dr=Math.pow(2,42),pr=Math.pow(2,49),fr=Math.pow(2,56),gr=Math.pow(2,63),Er=function(r){return r(ae.encode(r,t,e),t),ce=r=>ae.encodingLength(r),M=(r,t)=>{const e=t.byteLength,i=ce(r),n=i+ce(e),s=new Uint8Array(n+e);return De(r,s,0),De(e,s,i),s.set(t,n),new yr(r,e,t,s)};class yr{constructor(t,e,i,n){this.code=t,this.size=e,this.digest=i,this.bytes=n}}const he=({name:r,code:t,encode:e})=>new wr(r,t,e);class wr{constructor(t,e,i){this.name=t,this.code=e,this.encode=i}digest(t){if(t instanceof Uint8Array){const e=this.encode(t);return e instanceof Uint8Array?M(this.code,e):e.then(i=>M(this.code,i))}else throw Error(\"Unknown type, must be binary type\")}}const le=r=>async t=>new Uint8Array(await crypto.subtle.digest(r,t)),Cr=he({name:\"sha2-256\",code:18,encode:le(\"SHA-256\")}),mr=he({name:\"sha2-512\",code:19,encode:le(\"SHA-512\")});var vr=Object.freeze({__proto__:null,sha256:Cr,sha512:mr});const de=0,Ar=\"identity\",pe=re,_r=r=>M(de,pe(r)),xr={code:de,name:Ar,encode:pe,digest:_r};var Rr=Object.freeze({__proto__:null,identity:xr});new TextEncoder,new TextDecoder;const fe={...yt,...Ct,...vt,..._t,...Ft,...Bt,...Mt,...Vt,...Ht,...tr};({...vr,...Rr});function ge(r,t,e,i){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:i}}}const Ee=ge(\"utf8\",\"u\",r=>\"u\"+new TextDecoder(\"utf8\").decode(r),r=>new TextEncoder().encode(r.substring(1))),L=ge(\"ascii\",\"a\",r=>{let t=\"a\";for(let e=0;e{r=r.substring(1);const t=ot(r.length);for(let e=0;et in r?Or(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,I=(r,t)=>{for(var e in t||(t={}))Nr.call(t,e)&&me(r,e,t[e]);if(Ce)for(var e of Ce(t))$r.call(t,e)&&me(r,e,t[e]);return r},V=(r,t)=>Sr(r,Pr(t));class Br extends G{constructor(t){super(t),this.initialized=!1,this.name=\"authEngine\",this.init=()=>{this.initialized||(this.registerRelayerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(R)}),this.initialized=!0)},this.request=async(e,i)=>{if(this.isInitialized(),!nt(e))throw new Error(\"Invalid request\");if(i!=null&&i.topic)return await this.requestOnKnownPairing(i.topic,e);const{chainId:n,statement:s,aud:o,domain:u,nonce:a,type:c,exp:h,nbf:f}=e,{topic:p,uri:A}=await this.client.core.pairing.create();this.client.logger.info({message:\"Generated new pairing\",pairing:{topic:p,uri:A}});const D=await this.client.core.crypto.generateKeyPair(),l=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_9__.hashKey)(D);await this.client.authKeys.set(x,{responseTopic:l,publicKey:D}),await this.client.pairingTopics.set(l,{topic:l,pairingTopic:p}),await this.client.core.relayer.subscribe(l),this.client.logger.info(`sending request to new pairing topic: ${p}`);const m=await this.sendRequest(p,\"wc_authRequest\",{payloadParams:{type:c??\"eip4361\",chainId:n,statement:s,aud:o,domain:u,version:\"1\",nonce:a,iat:new Date().toISOString(),exp:h,nbf:f},requester:{publicKey:D,metadata:this.client.metadata}},{},e.expiry);return this.client.logger.info(`sent request to new pairing topic: ${p}`),{uri:A,id:m}},this.respond=async(e,i)=>{if(this.isInitialized(),!st(e,this.client.requests))throw new Error(\"Invalid response\");const n=te(this.client.requests,e.id);if(!n)throw new Error(`Could not find pending auth request with id ${e.id}`);const s=n.requester.publicKey,o=await this.client.core.crypto.generateKeyPair(),u=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_9__.hashKey)(s),a={type:_walletconnect_utils__WEBPACK_IMPORTED_MODULE_9__.TYPE_1,receiverPublicKey:s,senderPublicKey:o};if(\"error\"in e){await this.sendError(n.id,u,e,a);return}const c={h:{t:\"eip4361\"},p:V(I({},n.cacaoPayload),{iss:i}),s:e.signature};await this.sendResult(n.id,u,c,a),await this.client.core.pairing.activate({topic:n.pairingTopic}),await this.client.requests.update(n.id,I({},c))},this.getPendingRequests=()=>ee(this.client.requests),this.formatMessage=(e,i)=>{this.client.logger.debug(`formatMessage, cacao is: ${JSON.stringify(e)}`);const n=`${e.domain} wants you to sign in with your Ethereum account:`,s=W(i),o=e.statement,u=`URI: ${e.aud}`,a=`Version: ${e.version}`,c=`Chain ID: ${Ze(i)}`,h=`Nonce: ${e.nonce}`,f=`Issued At: ${e.iat}`,p=e.exp?`Expiry: ${e.exp}`:void 0,A=e.resources&&e.resources.length>0?`Resources:\n${e.resources.map(D=>`- ${D}`).join(`\n`)}`:void 0;return[n,s,\"\",o,\"\",u,a,c,h,f,p,A].filter(D=>D!=null).join(`\n`)},this.setExpiry=async(e,i)=>{this.client.core.pairing.pairings.keys.includes(e)&&await this.client.core.pairing.updateExpiry({topic:e,expiry:i}),this.client.core.expirer.set(e,i)},this.sendRequest=async(e,i,n,s,o)=>{const u=(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_2__.formatJsonRpcRequest)(i,n),a=await this.client.core.crypto.encode(e,u,s),c=R[i].req;if(o&&(c.ttl=o),this.client.core.history.set(e,u),(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_9__.isBrowser)()){const h=K(JSON.stringify(u));this.client.core.verify.register({attestationId:h})}return await this.client.core.relayer.publish(e,a,V(I({},c),{internal:{throwOnFailedPublish:!0}})),u.id},this.sendResult=async(e,i,n,s)=>{const o=(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_2__.formatJsonRpcResult)(e,n),u=await this.client.core.crypto.encode(i,o,s),a=await this.client.core.history.get(i,e),c=R[a.request.method].res;return await this.client.core.relayer.publish(i,u,V(I({},c),{internal:{throwOnFailedPublish:!0}})),await this.client.core.history.resolve(o),o.id},this.sendError=async(e,i,n,s)=>{const o=(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_2__.formatJsonRpcError)(e,n.error),u=await this.client.core.crypto.encode(i,o,s),a=await this.client.core.history.get(i,e),c=R[a.request.method].res;return await this.client.core.relayer.publish(i,u,c),await this.client.core.history.resolve(o),o.id},this.requestOnKnownPairing=async(e,i)=>{const n=this.client.core.pairing.pairings.getAll({active:!0}).find(A=>A.topic===e);if(!n)throw new Error(`Could not find pairing for provided topic ${e}`);const{publicKey:s}=this.client.authKeys.get(x),{chainId:o,statement:u,aud:a,domain:c,nonce:h,type:f}=i,p=await this.sendRequest(n.topic,\"wc_authRequest\",{payloadParams:{type:f??\"eip4361\",chainId:o,statement:u,aud:a,domain:c,version:\"1\",nonce:h,iat:new Date().toISOString()},requester:{publicKey:s,metadata:this.client.metadata}},{},i.expiry);return this.client.logger.info(`sent request to known pairing topic: ${n.topic}`),{id:p}},this.onPairingCreated=e=>{const i=this.getPendingRequests();if(i){const n=Object.values(i).find(s=>s.pairingTopic===e.topic);n&&this.handleAuthRequest(n)}},this.onRelayEventRequest=e=>{const{topic:i,payload:n}=e,s=n.method;switch(s){case\"wc_authRequest\":return this.onAuthRequest(i,n);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async e=>{const{topic:i,payload:n}=e,s=(await this.client.core.history.get(i,n.id)).request.method;switch(s){case\"wc_authRequest\":return this.onAuthResponse(i,n);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onAuthRequest=async(e,i)=>{const{requester:n,payloadParams:s}=i.params;this.client.logger.info({type:\"onAuthRequest\",topic:e,payload:i});const o=K(JSON.stringify(i)),u=await this.getVerifyContext(o,this.client.metadata),a={requester:n,pairingTopic:e,id:i.id,cacaoPayload:s,verifyContext:u};await this.client.requests.set(i.id,a),this.handleAuthRequest(a)},this.handleAuthRequest=async e=>{const{id:i,pairingTopic:n,requester:s,cacaoPayload:o,verifyContext:u}=e;try{this.client.emit(\"auth_request\",{id:i,topic:n,params:{requester:s,cacaoPayload:o},verifyContext:u})}catch(a){await this.sendError(e.id,e.pairingTopic,a),this.client.logger.error(a)}},this.onAuthResponse=async(e,i)=>{const{id:n}=i;if(this.client.logger.info({type:\"onAuthResponse\",topic:e,response:i}),(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_2__.isJsonRpcResult)(i)){const{pairingTopic:s}=this.client.pairingTopics.get(e);await this.client.core.pairing.activate({topic:s});const{s:o,p:u}=i.result;await this.client.requests.set(n,I({id:n,pairingTopic:s},i.result));const a=this.formatMessage(u,u.iss);this.client.logger.debug(`reconstructed message:\n`,JSON.stringify(a)),this.client.logger.debug(\"payload.iss:\",u.iss),this.client.logger.debug(\"signature:\",o);const c=W(u.iss),h=We(u.iss);if(!c)throw new Error(\"Could not derive address from `payload.iss`\");if(!h)throw new Error(\"Could not derive chainId from `payload.iss`\");this.client.logger.debug(\"walletAddress extracted from `payload.iss`:\",c),await et(c,a,o,h,this.client.projectId)?this.client.emit(\"auth_response\",{id:n,topic:e,params:i}):this.client.emit(\"auth_response\",{id:n,topic:e,params:{message:\"Invalid signature\",code:-1}})}else (0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_2__.isJsonRpcError)(i)&&this.client.emit(\"auth_response\",{id:n,topic:e,params:i})},this.getVerifyContext=async(e,i)=>{const n={verified:{verifyUrl:i.verifyUrl||\"\",validation:\"UNKNOWN\",origin:i.url||\"\"}};try{const s=await this.client.core.verify.resolve({attestationId:e,verifyUrl:i.verifyUrl});s&&(n.verified.origin=s.origin,n.verified.isScam=s.isScam,n.verified.validation=origin===new URL(i.url).origin?\"VALID\":\"INVALID\")}catch(s){this.client.logger.error(s)}return this.client.logger.info(`Verify context: ${JSON.stringify(n)}`),n}}isInitialized(){if(!this.initialized){const{message:t}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_9__.getInternalError)(\"NOT_INITIALIZED\",this.name);throw new Error(t)}}registerRelayerEvents(){this.client.core.relayer.on(_walletconnect_core__WEBPACK_IMPORTED_MODULE_10__.RELAYER_EVENTS.message,async t=>{const{topic:e,message:i}=t,{responseTopic:n,publicKey:s}=this.client.authKeys.keys.includes(x)?this.client.authKeys.get(x):{responseTopic:void 0,publicKey:void 0};if(n&&e!==n){this.client.logger.debug(\"[Auth] Ignoring message from unknown topic\",e);return}const o=await this.client.core.crypto.decode(e,i,{receiverPublicKey:s});(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_2__.isJsonRpcRequest)(o)?(this.client.core.history.set(e,o),this.onRelayEventRequest({topic:e,payload:o})):(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_2__.isJsonRpcResponse)(o)&&(await this.client.core.history.resolve(o),this.onRelayEventResponse({topic:e,payload:o}))})}registerPairingEvents(){this.client.core.pairing.events.on(_walletconnect_core__WEBPACK_IMPORTED_MODULE_10__.PAIRING_EVENTS.create,t=>this.onPairingCreated(t))}}class S extends H{constructor(t){super(t),this.protocol=$,this.version=Q,this.name=B,this.events=new events__WEBPACK_IMPORTED_MODULE_1__.EventEmitter,this.emit=(i,n)=>this.events.emit(i,n),this.on=(i,n)=>this.events.on(i,n),this.once=(i,n)=>this.events.once(i,n),this.off=(i,n)=>this.events.off(i,n),this.removeListener=(i,n)=>this.events.removeListener(i,n),this.request=async(i,n)=>{try{return await this.engine.request(i,n)}catch(s){throw this.logger.error(s.message),s}},this.respond=async(i,n)=>{try{return await this.engine.respond(i,n)}catch(s){throw this.logger.error(s.message),s}},this.getPendingRequests=()=>{try{return this.engine.getPendingRequests()}catch(i){throw this.logger.error(i.message),i}},this.formatMessage=(i,n)=>{try{return this.engine.formatMessage(i,n)}catch(s){throw this.logger.error(s.message),s}};const e=typeof t.logger<\"u\"&&typeof t.logger!=\"string\"?t.logger:(0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_0__.pino)((0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_0__.getDefaultLoggerOptions)({level:t.logger||\"error\"}));this.name=t?.name||B,this.metadata=t.metadata,this.projectId=t.projectId,this.core=t.core||new _walletconnect_core__WEBPACK_IMPORTED_MODULE_10__.Core(t),this.logger=(0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_0__.generateChildLogger)(e,this.name),this.authKeys=new _walletconnect_core__WEBPACK_IMPORTED_MODULE_10__.Store(this.core,this.logger,\"authKeys\",F,()=>x),this.pairingTopics=new _walletconnect_core__WEBPACK_IMPORTED_MODULE_10__.Store(this.core,this.logger,\"pairingTopics\",F),this.requests=new _walletconnect_core__WEBPACK_IMPORTED_MODULE_10__.Store(this.core,this.logger,\"requests\",F,i=>i.id),this.engine=new Br(this)}static async init(t){const e=new S(t);return await e.initialize(),e}get context(){return (0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_0__.getLoggerContext)(this.logger)}async initialize(){this.logger.trace(\"Initialized\");try{await this.core.start(),await this.authKeys.init(),await this.requests.init(),await this.pairingTopics.init(),await this.engine.init(),this.logger.info(\"AuthClient Initialization Success\"),this.logger.info({authClient:this})}catch(t){throw this.logger.info(\"AuthClient Initialization Failure\"),this.logger.error(t.message),t}}}const zr=S;\n//# sourceMappingURL=index.es.js.map\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/auth-client/dist/index.es.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/core/dist/index.es.js": -/*!***********************************************************!*\ - !*** ./node_modules/@walletconnect/core/dist/index.es.js ***! - \***********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CORE_CONTEXT: () => (/* binding */ X),\n/* harmony export */ CORE_DEFAULT: () => (/* binding */ Xe),\n/* harmony export */ CORE_PROTOCOL: () => (/* binding */ ue),\n/* harmony export */ CORE_STORAGE_OPTIONS: () => (/* binding */ Qe),\n/* harmony export */ CORE_STORAGE_PREFIX: () => (/* binding */ O),\n/* harmony export */ CORE_VERSION: () => (/* binding */ We),\n/* harmony export */ CRYPTO_CLIENT_SEED: () => (/* binding */ le),\n/* harmony export */ CRYPTO_CONTEXT: () => (/* binding */ Ze),\n/* harmony export */ CRYPTO_JWT_TTL: () => (/* binding */ et),\n/* harmony export */ Core: () => (/* binding */ Ar),\n/* harmony export */ Crypto: () => (/* binding */ _t),\n/* harmony export */ EXPIRER_CONTEXT: () => (/* binding */ It),\n/* harmony export */ EXPIRER_DEFAULT_TTL: () => (/* binding */ pr),\n/* harmony export */ EXPIRER_EVENTS: () => (/* binding */ v),\n/* harmony export */ EXPIRER_STORAGE_VERSION: () => (/* binding */ Ct),\n/* harmony export */ Expirer: () => (/* binding */ kt),\n/* harmony export */ HISTORY_CONTEXT: () => (/* binding */ wt),\n/* harmony export */ HISTORY_EVENTS: () => (/* binding */ R),\n/* harmony export */ HISTORY_STORAGE_VERSION: () => (/* binding */ vt),\n/* harmony export */ JsonRpcHistory: () => (/* binding */ Mt),\n/* harmony export */ KEYCHAIN_CONTEXT: () => (/* binding */ tt),\n/* harmony export */ KEYCHAIN_STORAGE_VERSION: () => (/* binding */ it),\n/* harmony export */ KeyChain: () => (/* binding */ Rt),\n/* harmony export */ MESSAGES_CONTEXT: () => (/* binding */ st),\n/* harmony export */ MESSAGES_STORAGE_VERSION: () => (/* binding */ rt),\n/* harmony export */ MessageTracker: () => (/* binding */ St),\n/* harmony export */ PAIRING_CONTEXT: () => (/* binding */ ft),\n/* harmony export */ PAIRING_DEFAULT_TTL: () => (/* binding */ gr),\n/* harmony export */ PAIRING_EVENTS: () => (/* binding */ B),\n/* harmony export */ PAIRING_RPC_OPTS: () => (/* binding */ F),\n/* harmony export */ PAIRING_STORAGE_VERSION: () => (/* binding */ Et),\n/* harmony export */ PENDING_SUB_RESOLUTION_TIMEOUT: () => (/* binding */ bt),\n/* harmony export */ PUBLISHER_CONTEXT: () => (/* binding */ at),\n/* harmony export */ PUBLISHER_DEFAULT_TTL: () => (/* binding */ nt),\n/* harmony export */ Pairing: () => (/* binding */ $t),\n/* harmony export */ RELAYER_CONTEXT: () => (/* binding */ ct),\n/* harmony export */ RELAYER_DEFAULT_LOGGER: () => (/* binding */ ht),\n/* harmony export */ RELAYER_DEFAULT_PROTOCOL: () => (/* binding */ ot),\n/* harmony export */ RELAYER_DEFAULT_RELAY_URL: () => (/* binding */ de),\n/* harmony export */ RELAYER_EVENTS: () => (/* binding */ D),\n/* harmony export */ RELAYER_FAILOVER_RELAY_URL: () => (/* binding */ ge),\n/* harmony export */ RELAYER_PROVIDER_EVENTS: () => (/* binding */ T),\n/* harmony export */ RELAYER_RECONNECT_TIMEOUT: () => (/* binding */ lt),\n/* harmony export */ RELAYER_SDK_VERSION: () => (/* binding */ dt),\n/* harmony export */ RELAYER_STORAGE_OPTIONS: () => (/* binding */ lr),\n/* harmony export */ RELAYER_SUBSCRIBER_SUFFIX: () => (/* binding */ ut),\n/* harmony export */ RELAYER_TRANSPORT_CUTOFF: () => (/* binding */ gt),\n/* harmony export */ Relayer: () => (/* binding */ zt),\n/* harmony export */ STORE_STORAGE_VERSION: () => (/* binding */ pt),\n/* harmony export */ SUBSCRIBER_CONTEXT: () => (/* binding */ yt),\n/* harmony export */ SUBSCRIBER_DEFAULT_TTL: () => (/* binding */ dr),\n/* harmony export */ SUBSCRIBER_EVENTS: () => (/* binding */ w),\n/* harmony export */ SUBSCRIBER_STORAGE_VERSION: () => (/* binding */ mt),\n/* harmony export */ Store: () => (/* binding */ Ft),\n/* harmony export */ Subscriber: () => (/* binding */ xt),\n/* harmony export */ VERIFY_CONTEXT: () => (/* binding */ Q),\n/* harmony export */ VERIFY_FALLBACK_SERVER: () => (/* binding */ pe),\n/* harmony export */ VERIFY_SERVER: () => (/* binding */ Z),\n/* harmony export */ Verify: () => (/* binding */ Kt),\n/* harmony export */ WALLETCONNECT_CLIENT_ID: () => (/* binding */ Dt),\n/* harmony export */ \"default\": () => (/* binding */ ee)\n/* harmony export */ });\n/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\n/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(events__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _walletconnect_keyvaluestorage__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @walletconnect/keyvaluestorage */ \"./node_modules/@walletconnect/keyvaluestorage/dist/cjs/browser/index.js\");\n/* harmony import */ var _walletconnect_heartbeat__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @walletconnect/heartbeat */ \"./node_modules/@walletconnect/heartbeat/dist/cjs/index.js\");\n/* harmony import */ var _walletconnect_heartbeat__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_walletconnect_heartbeat__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @walletconnect/logger */ \"./node_modules/@walletconnect/logger/dist/cjs/index.js\");\n/* harmony import */ var _walletconnect_logger__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _walletconnect_types__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @walletconnect/types */ \"./node_modules/@walletconnect/types/dist/index.es.js\");\n/* harmony import */ var _walletconnect_safe_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @walletconnect/safe-json */ \"./node_modules/@walletconnect/safe-json/dist/esm/index.js\");\n/* harmony import */ var _walletconnect_relay_auth__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @walletconnect/relay-auth */ \"./node_modules/@walletconnect/relay-auth/dist/esm/index.js\");\n/* harmony import */ var _walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @walletconnect/utils */ \"./node_modules/@walletconnect/utils/dist/index.es.js\");\n/* harmony import */ var uint8arrays__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! uint8arrays */ \"./node_modules/uint8arrays/esm/src/index.js\");\n/* harmony import */ var _walletconnect_time__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @walletconnect/time */ \"./node_modules/@walletconnect/time/dist/cjs/index.js\");\n/* harmony import */ var _walletconnect_time__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_walletconnect_time__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var _walletconnect_jsonrpc_provider__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @walletconnect/jsonrpc-provider */ \"./node_modules/@walletconnect/jsonrpc-provider/dist/esm/index.js\");\n/* harmony import */ var _walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @walletconnect/jsonrpc-utils */ \"./node_modules/@walletconnect/jsonrpc-utils/dist/esm/index.js\");\n/* harmony import */ var _walletconnect_jsonrpc_ws_connection__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @walletconnect/jsonrpc-ws-connection */ \"./node_modules/@walletconnect/jsonrpc-ws-connection/dist/esm/index.js\");\n/* harmony import */ var lodash_isequal__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! lodash.isequal */ \"./node_modules/lodash.isequal/index.js\");\n/* harmony import */ var lodash_isequal__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(lodash_isequal__WEBPACK_IMPORTED_MODULE_11__);\nfunction Ki(r,e){if(r.length>=255)throw new TypeError(\"Alphabet too long\");for(var t=new Uint8Array(256),i=0;i>>0,b=new Uint8Array(S);I!==_;){for(var P=c[I],A=0,C=S-1;(P!==0||A>>0,b[C]=P%o>>>0,P=P/o>>>0;if(P!==0)throw new Error(\"Non-zero carry\");z=A,I++}for(var x=S-z;x!==S&&b[x]===0;)x++;for(var q=h.repeat(m);x>>0,S=new Uint8Array(_);c[m];){var b=t[c.charCodeAt(m)];if(b===255)return;for(var P=0,A=_-1;(b!==0||P>>0,S[A]=b%256>>>0,b=b/256>>>0;if(b!==0)throw new Error(\"Non-zero carry\");I=P,m++}if(c[m]!==\" \"){for(var C=_-I;C!==_&&S[C]===0;)C++;for(var x=new Uint8Array(z+(_-C)),q=z;C!==_;)x[q++]=S[C++];return x}}}function $(c){var m=y(c);if(m)return m;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:y,decode:$}}var Bi=Ki,Vi=Bi;const ze=r=>{if(r instanceof Uint8Array&&r.constructor.name===\"Uint8Array\")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error(\"Unknown type, must be binary type\")},qi=r=>new TextEncoder().encode(r),ji=r=>new TextDecoder().decode(r);class Yi{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error(\"Unknown type, must be binary type\")}}class Gi{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error(\"Invalid prefix character\");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e==\"string\"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error(\"Can only multibase decode strings\")}or(e){return Ne(this,e)}}class Hi{constructor(e){this.decoders=e}or(e){return Ne(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Ne=(r,e)=>new Hi({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});class Ji{constructor(e,t,i,s){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=s,this.encoder=new Yi(e,t,i),this.decoder=new Gi(e,t,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const W=({name:r,prefix:e,encode:t,decode:i})=>new Ji(r,e,t,i),K=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:s}=Vi(t,e);return W({prefix:r,name:e,encode:i,decode:n=>ze(s(n))})},Wi=(r,e,t,i)=>{const s={};for(let d=0;d=8&&(o-=8,a[u++]=255&h>>o)}if(o>=t||255&h<<8-o)throw new SyntaxError(\"Unexpected end of data\");return a},Xi=(r,e,t)=>{const i=e[e.length-1]===\"=\",s=(1<t;)a-=t,n+=e[s&o>>a];if(a&&(n+=e[s&o<W({prefix:e,name:r,encode(s){return Xi(s,i,t)},decode(s){return Wi(s,i,t,r)}}),Qi=W({prefix:\"\\0\",name:\"identity\",encode:r=>ji(r),decode:r=>qi(r)});var Zi=Object.freeze({__proto__:null,identity:Qi});const es=g({prefix:\"0\",name:\"base2\",alphabet:\"01\",bitsPerChar:1});var ts=Object.freeze({__proto__:null,base2:es});const is=g({prefix:\"7\",name:\"base8\",alphabet:\"01234567\",bitsPerChar:3});var ss=Object.freeze({__proto__:null,base8:is});const rs=K({prefix:\"9\",name:\"base10\",alphabet:\"0123456789\"});var ns=Object.freeze({__proto__:null,base10:rs});const as=g({prefix:\"f\",name:\"base16\",alphabet:\"0123456789abcdef\",bitsPerChar:4}),os=g({prefix:\"F\",name:\"base16upper\",alphabet:\"0123456789ABCDEF\",bitsPerChar:4});var hs=Object.freeze({__proto__:null,base16:as,base16upper:os});const cs=g({prefix:\"b\",name:\"base32\",alphabet:\"abcdefghijklmnopqrstuvwxyz234567\",bitsPerChar:5}),us=g({prefix:\"B\",name:\"base32upper\",alphabet:\"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\",bitsPerChar:5}),ls=g({prefix:\"c\",name:\"base32pad\",alphabet:\"abcdefghijklmnopqrstuvwxyz234567=\",bitsPerChar:5}),ds=g({prefix:\"C\",name:\"base32padupper\",alphabet:\"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=\",bitsPerChar:5}),gs=g({prefix:\"v\",name:\"base32hex\",alphabet:\"0123456789abcdefghijklmnopqrstuv\",bitsPerChar:5}),ps=g({prefix:\"V\",name:\"base32hexupper\",alphabet:\"0123456789ABCDEFGHIJKLMNOPQRSTUV\",bitsPerChar:5}),Ds=g({prefix:\"t\",name:\"base32hexpad\",alphabet:\"0123456789abcdefghijklmnopqrstuv=\",bitsPerChar:5}),ys=g({prefix:\"T\",name:\"base32hexpadupper\",alphabet:\"0123456789ABCDEFGHIJKLMNOPQRSTUV=\",bitsPerChar:5}),ms=g({prefix:\"h\",name:\"base32z\",alphabet:\"ybndrfg8ejkmcpqxot1uwisza345h769\",bitsPerChar:5});var bs=Object.freeze({__proto__:null,base32:cs,base32upper:us,base32pad:ls,base32padupper:ds,base32hex:gs,base32hexupper:ps,base32hexpad:Ds,base32hexpadupper:ys,base32z:ms});const fs=K({prefix:\"k\",name:\"base36\",alphabet:\"0123456789abcdefghijklmnopqrstuvwxyz\"}),Es=K({prefix:\"K\",name:\"base36upper\",alphabet:\"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\"});var ws=Object.freeze({__proto__:null,base36:fs,base36upper:Es});const vs=K({name:\"base58btc\",prefix:\"z\",alphabet:\"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\"}),Is=K({name:\"base58flickr\",prefix:\"Z\",alphabet:\"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ\"});var Cs=Object.freeze({__proto__:null,base58btc:vs,base58flickr:Is});const Rs=g({prefix:\"m\",name:\"base64\",alphabet:\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",bitsPerChar:6}),_s=g({prefix:\"M\",name:\"base64pad\",alphabet:\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\",bitsPerChar:6}),Ss=g({prefix:\"u\",name:\"base64url\",alphabet:\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_\",bitsPerChar:6}),Ps=g({prefix:\"U\",name:\"base64urlpad\",alphabet:\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=\",bitsPerChar:6});var Ts=Object.freeze({__proto__:null,base64:Rs,base64pad:_s,base64url:Ss,base64urlpad:Ps});const Le=Array.from(\"\\u{1F680}\\u{1FA90}\\u2604\\u{1F6F0}\\u{1F30C}\\u{1F311}\\u{1F312}\\u{1F313}\\u{1F314}\\u{1F315}\\u{1F316}\\u{1F317}\\u{1F318}\\u{1F30D}\\u{1F30F}\\u{1F30E}\\u{1F409}\\u2600\\u{1F4BB}\\u{1F5A5}\\u{1F4BE}\\u{1F4BF}\\u{1F602}\\u2764\\u{1F60D}\\u{1F923}\\u{1F60A}\\u{1F64F}\\u{1F495}\\u{1F62D}\\u{1F618}\\u{1F44D}\\u{1F605}\\u{1F44F}\\u{1F601}\\u{1F525}\\u{1F970}\\u{1F494}\\u{1F496}\\u{1F499}\\u{1F622}\\u{1F914}\\u{1F606}\\u{1F644}\\u{1F4AA}\\u{1F609}\\u263A\\u{1F44C}\\u{1F917}\\u{1F49C}\\u{1F614}\\u{1F60E}\\u{1F607}\\u{1F339}\\u{1F926}\\u{1F389}\\u{1F49E}\\u270C\\u2728\\u{1F937}\\u{1F631}\\u{1F60C}\\u{1F338}\\u{1F64C}\\u{1F60B}\\u{1F497}\\u{1F49A}\\u{1F60F}\\u{1F49B}\\u{1F642}\\u{1F493}\\u{1F929}\\u{1F604}\\u{1F600}\\u{1F5A4}\\u{1F603}\\u{1F4AF}\\u{1F648}\\u{1F447}\\u{1F3B6}\\u{1F612}\\u{1F92D}\\u2763\\u{1F61C}\\u{1F48B}\\u{1F440}\\u{1F62A}\\u{1F611}\\u{1F4A5}\\u{1F64B}\\u{1F61E}\\u{1F629}\\u{1F621}\\u{1F92A}\\u{1F44A}\\u{1F973}\\u{1F625}\\u{1F924}\\u{1F449}\\u{1F483}\\u{1F633}\\u270B\\u{1F61A}\\u{1F61D}\\u{1F634}\\u{1F31F}\\u{1F62C}\\u{1F643}\\u{1F340}\\u{1F337}\\u{1F63B}\\u{1F613}\\u2B50\\u2705\\u{1F97A}\\u{1F308}\\u{1F608}\\u{1F918}\\u{1F4A6}\\u2714\\u{1F623}\\u{1F3C3}\\u{1F490}\\u2639\\u{1F38A}\\u{1F498}\\u{1F620}\\u261D\\u{1F615}\\u{1F33A}\\u{1F382}\\u{1F33B}\\u{1F610}\\u{1F595}\\u{1F49D}\\u{1F64A}\\u{1F639}\\u{1F5E3}\\u{1F4AB}\\u{1F480}\\u{1F451}\\u{1F3B5}\\u{1F91E}\\u{1F61B}\\u{1F534}\\u{1F624}\\u{1F33C}\\u{1F62B}\\u26BD\\u{1F919}\\u2615\\u{1F3C6}\\u{1F92B}\\u{1F448}\\u{1F62E}\\u{1F646}\\u{1F37B}\\u{1F343}\\u{1F436}\\u{1F481}\\u{1F632}\\u{1F33F}\\u{1F9E1}\\u{1F381}\\u26A1\\u{1F31E}\\u{1F388}\\u274C\\u270A\\u{1F44B}\\u{1F630}\\u{1F928}\\u{1F636}\\u{1F91D}\\u{1F6B6}\\u{1F4B0}\\u{1F353}\\u{1F4A2}\\u{1F91F}\\u{1F641}\\u{1F6A8}\\u{1F4A8}\\u{1F92C}\\u2708\\u{1F380}\\u{1F37A}\\u{1F913}\\u{1F619}\\u{1F49F}\\u{1F331}\\u{1F616}\\u{1F476}\\u{1F974}\\u25B6\\u27A1\\u2753\\u{1F48E}\\u{1F4B8}\\u2B07\\u{1F628}\\u{1F31A}\\u{1F98B}\\u{1F637}\\u{1F57A}\\u26A0\\u{1F645}\\u{1F61F}\\u{1F635}\\u{1F44E}\\u{1F932}\\u{1F920}\\u{1F927}\\u{1F4CC}\\u{1F535}\\u{1F485}\\u{1F9D0}\\u{1F43E}\\u{1F352}\\u{1F617}\\u{1F911}\\u{1F30A}\\u{1F92F}\\u{1F437}\\u260E\\u{1F4A7}\\u{1F62F}\\u{1F486}\\u{1F446}\\u{1F3A4}\\u{1F647}\\u{1F351}\\u2744\\u{1F334}\\u{1F4A3}\\u{1F438}\\u{1F48C}\\u{1F4CD}\\u{1F940}\\u{1F922}\\u{1F445}\\u{1F4A1}\\u{1F4A9}\\u{1F450}\\u{1F4F8}\\u{1F47B}\\u{1F910}\\u{1F92E}\\u{1F3BC}\\u{1F975}\\u{1F6A9}\\u{1F34E}\\u{1F34A}\\u{1F47C}\\u{1F48D}\\u{1F4E3}\\u{1F942}\"),xs=Le.reduce((r,e,t)=>(r[t]=e,r),[]),Os=Le.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function As(r){return r.reduce((e,t)=>(e+=xs[t],e),\"\")}function zs(r){const e=[];for(const t of r){const i=Os[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const Ns=W({prefix:\"\\u{1F680}\",name:\"base256emoji\",encode:As,decode:zs});var Ls=Object.freeze({__proto__:null,base256emoji:Ns}),Us=Fe,Ue=128,Fs=127,$s=~Fs,Ms=Math.pow(2,31);function Fe(r,e,t){e=e||[],t=t||0;for(var i=t;r>=Ms;)e[t++]=r&255|Ue,r/=128;for(;r&$s;)e[t++]=r&255|Ue,r>>>=7;return e[t]=r|0,Fe.bytes=t-i+1,e}var ks=oe,Ks=128,$e=127;function oe(r,i){var t=0,i=i||0,s=0,n=i,a,o=r.length;do{if(n>=o)throw oe.bytes=0,new RangeError(\"Could not decode varint\");a=r[n++],t+=s<28?(a&$e)<=Ks);return oe.bytes=n-i,t}var Bs=Math.pow(2,7),Vs=Math.pow(2,14),qs=Math.pow(2,21),js=Math.pow(2,28),Ys=Math.pow(2,35),Gs=Math.pow(2,42),Hs=Math.pow(2,49),Js=Math.pow(2,56),Ws=Math.pow(2,63),Xs=function(r){return r(Me.encode(r,e,t),e),Ke=r=>Me.encodingLength(r),he=(r,e)=>{const t=e.byteLength,i=Ke(r),s=i+Ke(t),n=new Uint8Array(s+t);return ke(r,n,0),ke(t,n,i),n.set(e,s),new Zs(r,t,e,n)};class Zs{constructor(e,t,i,s){this.code=e,this.size=t,this.digest=i,this.bytes=s}}const Be=({name:r,code:e,encode:t})=>new er(r,e,t);class er{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?he(this.code,t):t.then(i=>he(this.code,i))}else throw Error(\"Unknown type, must be binary type\")}}const Ve=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),tr=Be({name:\"sha2-256\",code:18,encode:Ve(\"SHA-256\")}),ir=Be({name:\"sha2-512\",code:19,encode:Ve(\"SHA-512\")});var sr=Object.freeze({__proto__:null,sha256:tr,sha512:ir});const qe=0,rr=\"identity\",je=ze,nr=r=>he(qe,je(r)),ar={code:qe,name:rr,encode:je,digest:nr};var or=Object.freeze({__proto__:null,identity:ar});new TextEncoder,new TextDecoder;const Ye={...Zi,...ts,...ss,...ns,...hs,...bs,...ws,...Cs,...Ts,...Ls};({...sr,...or});function Ge(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function hr(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Ge(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function He(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const Je=He(\"utf8\",\"u\",r=>\"u\"+new TextDecoder(\"utf8\").decode(r),r=>new TextEncoder().encode(r.substring(1))),ce=He(\"ascii\",\"a\",r=>{let e=\"a\";for(let t=0;t{r=r.substring(1);const e=hr(r.length);for(let t=0;t{if(!this.initialized){const i=await this.getKeyChain();typeof i<\"u\"&&(this.keychain=i),this.initialized=!0}},this.has=i=>(this.isInitialized(),this.keychain.has(i)),this.set=async(i,s)=>{this.isInitialized(),this.keychain.set(i,s),await this.persist()},this.get=i=>{this.isInitialized();const s=this.keychain.get(i);if(typeof s>\"u\"){const{message:n}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"NO_MATCHING_KEY\",`${this.name}: ${i}`);throw new Error(n)}return s},this.del=async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()},this.core=e,this.logger=(0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.generateChildLogger)(t,this.name)}get context(){return (0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+\"//\"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.mapToObj)(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<\"u\"?(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.objToMap)(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"NOT_INITIALIZED\",this.name);throw new Error(e)}}}class _t{constructor(e,t,i){this.core=e,this.logger=t,this.name=Ze,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=s=>(this.isInitialized(),this.keychain.has(s)),this.getClientId=async()=>{this.isInitialized();const s=await this.getClientSeed(),n=_walletconnect_relay_auth__WEBPACK_IMPORTED_MODULE_5__.generateKeyPair(s);return _walletconnect_relay_auth__WEBPACK_IMPORTED_MODULE_5__.encodeIss(n.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const s=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.generateKeyPair)();return this.setPrivateKey(s.publicKey,s.privateKey)},this.signJWT=async s=>{this.isInitialized();const n=await this.getClientSeed(),a=_walletconnect_relay_auth__WEBPACK_IMPORTED_MODULE_5__.generateKeyPair(n),o=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.generateRandomBytes32)(),h=et;return await _walletconnect_relay_auth__WEBPACK_IMPORTED_MODULE_5__.signJWT(o,s,h,a)},this.generateSharedKey=(s,n,a)=>{this.isInitialized();const o=this.getPrivateKey(s),h=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.deriveSymKey)(o,n);return this.setSymKey(h,a)},this.setSymKey=async(s,n)=>{this.isInitialized();const a=n||(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.hashKey)(s);return await this.keychain.set(a,s),a},this.deleteKeyPair=async s=>{this.isInitialized(),await this.keychain.del(s)},this.deleteSymKey=async s=>{this.isInitialized(),await this.keychain.del(s)},this.encode=async(s,n,a)=>{this.isInitialized();const o=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.validateEncoding)(a),h=(0,_walletconnect_safe_json__WEBPACK_IMPORTED_MODULE_4__.safeJsonStringify)(n);if((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.isTypeOneEnvelope)(o)){const y=o.senderPublicKey,$=o.receiverPublicKey;s=await this.generateSharedKey(y,$)}const u=this.getSymKey(s),{type:d,senderPublicKey:p}=o;return (0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.encrypt)({type:d,symKey:u,message:h,senderPublicKey:p})},this.decode=async(s,n,a)=>{this.isInitialized();const o=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.validateDecoding)(n,a);if((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.isTypeOneEnvelope)(o)){const h=o.receiverPublicKey,u=o.senderPublicKey;s=await this.generateSharedKey(h,u)}try{const h=this.getSymKey(s),u=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.decrypt)({symKey:h,encoded:n});return (0,_walletconnect_safe_json__WEBPACK_IMPORTED_MODULE_4__.safeJsonParse)(u)}catch(h){this.logger.error(`Failed to decode message from topic: '${s}', clientId: '${await this.getClientId()}'`),this.logger.error(h)}},this.getPayloadType=s=>{const n=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.deserialize)(s);return (0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.decodeTypeByte)(n.type)},this.getPayloadSenderPublicKey=s=>{const n=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.deserialize)(s);return n.senderPublicKey?(0,uint8arrays__WEBPACK_IMPORTED_MODULE_6__.toString)(n.senderPublicKey,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.BASE16):void 0},this.core=e,this.logger=(0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.generateChildLogger)(t,this.name),this.keychain=i||new Rt(this.core,this.logger)}get context(){return (0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.getLoggerContext)(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e=\"\";try{e=this.keychain.get(le)}catch{e=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.generateRandomBytes32)(),await this.keychain.set(le,e)}return ur(e,\"base16\")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"NOT_INITIALIZED\",this.name);throw new Error(e)}}}class St extends _walletconnect_types__WEBPACK_IMPORTED_MODULE_13__.IMessageTracker{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=st,this.version=rt,this.initialized=!1,this.storagePrefix=O,this.init=async()=>{if(!this.initialized){this.logger.trace(\"Initialized\");try{const i=await this.getRelayerMessages();typeof i<\"u\"&&(this.messages=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:\"method\",method:\"restore\",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}},this.set=async(i,s)=>{this.isInitialized();const n=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.hashMessage)(s);let a=this.messages.get(i);return typeof a>\"u\"&&(a={}),typeof a[n]<\"u\"||(a[n]=s,this.messages.set(i,a),await this.persist()),n},this.get=i=>{this.isInitialized();let s=this.messages.get(i);return typeof s>\"u\"&&(s={}),s},this.has=(i,s)=>{this.isInitialized();const n=this.get(i),a=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.hashMessage)(s);return typeof n[a]<\"u\"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist()},this.logger=(0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.generateChildLogger)(e,this.name),this.core=t}get context(){return (0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+\"//\"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.mapToObj)(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<\"u\"?(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.objToMap)(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"NOT_INITIALIZED\",this.name);throw new Error(e)}}}class Dr extends _walletconnect_types__WEBPACK_IMPORTED_MODULE_13__.IPublisher{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new events__WEBPACK_IMPORTED_MODULE_0__.EventEmitter,this.name=at,this.queue=new Map,this.publishTimeout=(0,_walletconnect_time__WEBPACK_IMPORTED_MODULE_7__.toMiliseconds)(_walletconnect_time__WEBPACK_IMPORTED_MODULE_7__.TEN_SECONDS),this.needsTransportRestart=!1,this.publish=async(i,s,n)=>{var a;this.logger.debug(\"Publishing Payload\"),this.logger.trace({type:\"method\",method:\"publish\",params:{topic:i,message:s,opts:n}});try{const o=n?.ttl||nt,h=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getRelayProtocolName)(n),u=n?.prompt||!1,d=n?.tag||0,p=n?.id||(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_9__.getBigIntRpcId)().toString(),y={topic:i,message:s,opts:{ttl:o,relay:h,prompt:u,tag:d,id:p}},$=setTimeout(()=>this.queue.set(p,y),this.publishTimeout);try{await await (0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.createExpiringPromise)(this.rpcPublish(i,s,o,h,u,d,p),this.publishTimeout,\"Failed to publish payload, please try again.\"),this.removeRequestFromQueue(p),this.relayer.events.emit(D.publish,y)}catch(c){if(this.logger.debug(\"Publishing Payload stalled\"),this.needsTransportRestart=!0,(a=n?.internal)!=null&&a.throwOnFailedPublish)throw this.removeRequestFromQueue(p),c;return}finally{clearTimeout($)}this.logger.debug(\"Successfully Published Payload\"),this.logger.trace({type:\"method\",method:\"publish\",params:{topic:i,message:s,opts:n}})}catch(o){throw this.logger.debug(\"Failed to Publish Payload\"),this.logger.error(o),o}},this.on=(i,s)=>{this.events.on(i,s)},this.once=(i,s)=>{this.events.once(i,s)},this.off=(i,s)=>{this.events.off(i,s)},this.removeListener=(i,s)=>{this.events.removeListener(i,s)},this.relayer=e,this.logger=(0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.generateChildLogger)(t,this.name),this.registerEventListeners()}get context(){return (0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.getLoggerContext)(this.logger)}rpcPublish(e,t,i,s,n,a,o){var h,u,d,p;const y={method:(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getRelayProtocolApi)(s.protocol).publish,params:{topic:e,message:t,ttl:i,prompt:n,tag:a},id:o};return (0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.isUndefined)((h=y.params)==null?void 0:h.prompt)&&((u=y.params)==null||delete u.prompt),(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.isUndefined)((d=y.params)==null?void 0:d.tag)&&((p=y.params)==null||delete p.tag),this.logger.debug(\"Outgoing Relay Payload\"),this.logger.trace({type:\"message\",direction:\"outgoing\",request:y}),this.relayer.request(y)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:t,message:i,opts:s}=e;await this.publish(t,i,s)})}registerEventListeners(){this.relayer.core.heartbeat.on(_walletconnect_heartbeat__WEBPACK_IMPORTED_MODULE_2__.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(D.connection_stalled);return}this.checkQueue()}),this.relayer.on(D.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class yr{constructor(){this.map=new Map,this.set=(e,t)=>{const i=this.get(e);this.exists(e,t)||this.map.set(e,[...i,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>\"u\"){this.map.delete(e);return}if(!this.map.has(e))return;const i=this.get(e);if(!this.exists(e,t))return;const s=i.filter(n=>n!==t);if(!s.length){this.map.delete(e);return}this.map.set(e,s)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var mr=Object.defineProperty,br=Object.defineProperties,fr=Object.getOwnPropertyDescriptors,Pt=Object.getOwnPropertySymbols,Er=Object.prototype.hasOwnProperty,wr=Object.prototype.propertyIsEnumerable,Tt=(r,e,t)=>e in r?mr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,V=(r,e)=>{for(var t in e||(e={}))Er.call(e,t)&&Tt(r,t,e[t]);if(Pt)for(var t of Pt(e))wr.call(e,t)&&Tt(r,t,e[t]);return r},De=(r,e)=>br(r,fr(e));class xt extends _walletconnect_types__WEBPACK_IMPORTED_MODULE_13__.ISubscriber{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new yr,this.events=new events__WEBPACK_IMPORTED_MODULE_0__.EventEmitter,this.name=yt,this.version=mt,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel=\"pending_sub_watch_label\",this.pollingInterval=20,this.storagePrefix=O,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace(\"Initialized\"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(i,s)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug(\"Subscribing Topic\"),this.logger.trace({type:\"method\",method:\"subscribe\",params:{topic:i,opts:s}});try{const n=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getRelayProtocolName)(s),a={topic:i,relay:n};this.pending.set(i,a);const o=await this.rpcSubscribe(i,n);return this.onSubscribe(o,a),this.logger.debug(\"Successfully Subscribed Topic\"),this.logger.trace({type:\"method\",method:\"subscribe\",params:{topic:i,opts:s}}),o}catch(n){throw this.logger.debug(\"Failed to Subscribe Topic\"),this.logger.error(n),n}},this.unsubscribe=async(i,s)=>{await this.restartToComplete(),this.isInitialized(),typeof s?.id<\"u\"?await this.unsubscribeById(i,s.id,s):await this.unsubscribeByTopic(i,s)},this.isSubscribed=async i=>this.topics.includes(i)?!0:await new Promise((s,n)=>{const a=new _walletconnect_time__WEBPACK_IMPORTED_MODULE_7__.Watch;a.start(this.pendingSubscriptionWatchLabel);const o=setInterval(()=>{!this.pending.has(i)&&this.topics.includes(i)&&(clearInterval(o),a.stop(this.pendingSubscriptionWatchLabel),s(!0)),a.elapsed(this.pendingSubscriptionWatchLabel)>=bt&&(clearInterval(o),a.stop(this.pendingSubscriptionWatchLabel),n(new Error(\"Subscription resolution timeout\")))},this.pollingInterval)}).catch(()=>!1),this.on=(i,s)=>{this.events.on(i,s)},this.once=(i,s)=>{this.events.once(i,s)},this.off=(i,s)=>{this.events.off(i,s)},this.removeListener=(i,s)=>{this.events.removeListener(i,s)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=(0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.generateChildLogger)(t,this.name),this.clientId=\"\"}get context(){return (0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+\"//\"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let i=!1;try{i=this.getSubscription(e).topic===t}catch{}return i}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const i=this.topicMap.get(e);await Promise.all(i.map(async s=>await this.unsubscribeById(e,s,t)))}async unsubscribeById(e,t,i){this.logger.debug(\"Unsubscribing Topic\"),this.logger.trace({type:\"method\",method:\"unsubscribe\",params:{topic:e,id:t,opts:i}});try{const s=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getRelayProtocolName)(i);await this.rpcUnsubscribe(e,t,s);const n=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getSdkError)(\"USER_DISCONNECTED\",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,n),this.logger.debug(\"Successfully Unsubscribed Topic\"),this.logger.trace({type:\"method\",method:\"unsubscribe\",params:{topic:e,id:t,opts:i}})}catch(s){throw this.logger.debug(\"Failed to Unsubscribe Topic\"),this.logger.error(s),s}}async rpcSubscribe(e,t){const i={method:(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getRelayProtocolApi)(t.protocol).subscribe,params:{topic:e}};this.logger.debug(\"Outgoing Relay Payload\"),this.logger.trace({type:\"payload\",direction:\"outgoing\",request:i});try{await await (0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.createExpiringPromise)(this.relayer.request(i),this.subscribeTimeout)}catch{this.logger.debug(\"Outgoing Relay Subscribe Payload stalled\"),this.relayer.events.emit(D.connection_stalled)}return (0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.hashMessage)(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;const t=e[0].relay,i={method:(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getRelayProtocolApi)(t.protocol).batchSubscribe,params:{topics:e.map(s=>s.topic)}};this.logger.debug(\"Outgoing Relay Payload\"),this.logger.trace({type:\"payload\",direction:\"outgoing\",request:i});try{return await await (0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.createExpiringPromise)(this.relayer.request(i),this.subscribeTimeout)}catch{this.logger.debug(\"Outgoing Relay Payload stalled\"),this.relayer.events.emit(D.connection_stalled)}}rpcUnsubscribe(e,t,i){const s={method:(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getRelayProtocolApi)(i.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug(\"Outgoing Relay Payload\"),this.logger.trace({type:\"payload\",direction:\"outgoing\",request:s}),this.relayer.request(s)}onSubscribe(e,t){this.setSubscription(e,De(V({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(t=>{this.setSubscription(t.id,V({},t)),this.pending.delete(t.topic)})}async onUnsubscribe(e,t,i){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,i),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.subscriptions.has(e)||(this.logger.debug(\"Setting subscription\"),this.logger.trace({type:\"method\",method:\"setSubscription\",id:e,subscription:t}),this.addSubscription(e,t))}addSubscription(e,t){this.subscriptions.set(e,V({},t)),this.topicMap.set(t.topic,e),this.events.emit(w.created,t)}getSubscription(e){this.logger.debug(\"Getting subscription\"),this.logger.trace({type:\"method\",method:\"getSubscription\",id:e});const t=this.subscriptions.get(e);if(!t){const{message:i}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"NO_MATCHING_KEY\",`${this.name}: ${e}`);throw new Error(i)}return t}deleteSubscription(e,t){this.logger.debug(\"Deleting subscription\"),this.logger.trace({type:\"method\",method:\"deleteSubscription\",id:e,reason:t});const i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(w.deleted,De(V({},i),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(w.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t\"u\"||!e.length)return;if(this.subscriptions.size){const{message:t}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"RESTORE_WILL_OVERRIDE\",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:\"method\",method:\"restore\",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const t=await this.rpcBatchSubscribe(e);(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.isValidArray)(t)&&this.onBatchSubscribe(t.map((i,s)=>De(V({},e[s]),{id:i})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;const e=[];this.pending.forEach(t=>{e.push(t)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(_walletconnect_heartbeat__WEBPACK_IMPORTED_MODULE_2__.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(D.connect,async()=>{await this.onConnect()}),this.relayer.on(D.disconnect,()=>{this.onDisconnect()}),this.events.on(w.created,async e=>{const t=w.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:\"event\",event:t,data:e}),await this.persist()}),this.events.on(w.deleted,async e=>{const t=w.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:\"event\",event:t,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"NOT_INITIALIZED\",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.restartInProgress||(clearInterval(t),e())},this.pollingInterval)})}}var vr=Object.defineProperty,Ot=Object.getOwnPropertySymbols,Ir=Object.prototype.hasOwnProperty,Cr=Object.prototype.propertyIsEnumerable,At=(r,e,t)=>e in r?vr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Rr=(r,e)=>{for(var t in e||(e={}))Ir.call(e,t)&&At(r,t,e[t]);if(Ot)for(var t of Ot(e))Cr.call(e,t)&&At(r,t,e[t]);return r};class zt extends _walletconnect_types__WEBPACK_IMPORTED_MODULE_13__.IRelayer{constructor(e){super(e),this.protocol=\"wc\",this.version=2,this.events=new events__WEBPACK_IMPORTED_MODULE_0__.EventEmitter,this.name=ct,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=[\"socket hang up\",\"socket stalled\"],this.hasExperiencedNetworkDisruption=!1,this.request=async t=>{this.logger.debug(\"Publishing Request Payload\");try{return await this.toEstablishConnection(),await this.provider.request(t)}catch(i){throw this.logger.debug(\"Failed to Publish Request\"),this.logger.error(i),i}},this.onPayloadHandler=t=>{this.onProviderPayload(t)},this.onConnectHandler=()=>{this.events.emit(D.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=t=>{this.logger.error(t),this.events.emit(D.error,t),this.logger.info(\"Fatal socket error received, closing transport\"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(T.payload,this.onPayloadHandler),this.provider.on(T.connect,this.onConnectHandler),this.provider.on(T.disconnect,this.onDisconnectHandler),this.provider.on(T.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<\"u\"&&typeof e.logger!=\"string\"?(0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.generateChildLogger)(e.logger,this.name):(0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.pino)((0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.getDefaultLoggerOptions)({level:e.logger||ht})),this.messages=new St(this.logger,e.core),this.subscriber=new xt(this,this.logger),this.publisher=new Dr(this,this.logger),this.relayUrl=e?.relayUrl||de,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace(\"Initialized\"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${ge}...`),await this.restartTransport(ge)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&(this.logger.info(\"No topics subscribed to after init, closing transport\"),await this.transportClose(),this.transportExplicitlyClosed=!1)},gt)}get context(){return (0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.getLoggerContext)(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,t,i){this.isInitialized(),await this.publisher.publish(e,t,i),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now()})}async subscribe(e,t){var i;this.isInitialized();let s=((i=this.subscriber.topicMap.get(e))==null?void 0:i[0])||\"\";if(s)return s;let n;const a=o=>{o.topic===e&&(this.subscriber.off(w.created,a),n())};return await Promise.all([new Promise(o=>{n=o,this.subscriber.on(w.created,a)}),new Promise(async o=>{s=await this.subscriber.subscribe(e,t),o()})]),s}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportClose(){this.transportExplicitlyClosed=!0,this.hasExperiencedNetworkDisruption&&this.connected?await (0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.createExpiringPromise)(this.provider.disconnect(),1e3,\"provider.disconnect()\").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(e){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(t=>{if(!this.initialized)return t();this.subscriber.once(w.resubscribed,()=>{t()})}),new Promise(async(t,i)=>{try{await (0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.createExpiringPromise)(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(s){i(s);return}t()})])}catch(t){this.logger.error(t);const i=t;if(!this.isConnectionStalled(i.message))throw t;this.provider.events.emit(T.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(e){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await (0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.isOnline)())throw new Error(\"No internet connection detected. Please restart your network and try again.\")}isConnectionStalled(e){return this.staleConnectionErrors.some(t=>e.includes(t))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new _walletconnect_jsonrpc_provider__WEBPACK_IMPORTED_MODULE_8__.JsonRpcProvider(new _walletconnect_jsonrpc_ws_connection__WEBPACK_IMPORTED_MODULE_10__[\"default\"]((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.formatRelayRpcUrl)({sdkVersion:dt,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:i}=e;await this.messages.set(t,i)}async shouldIgnoreMessageEvent(e){const{topic:t,message:i}=e;if(!i||i.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${i}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const s=this.messages.has(t,i);return s&&this.logger.debug(`Ignoring duplicate message: ${i}`),s}async onProviderPayload(e){if(this.logger.debug(\"Incoming Relay Payload\"),this.logger.trace({type:\"payload\",direction:\"incoming\",payload:e}),(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_9__.isJsonRpcRequest)(e)){if(!e.method.endsWith(ut))return;const t=e.params,{topic:i,message:s,publishedAt:n}=t.data,a={topic:i,message:s,publishedAt:n};this.logger.debug(\"Emitting Relayer Payload\"),this.logger.trace(Rr({type:\"event\",event:t.id},a)),this.events.emit(t.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else (0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_9__.isJsonRpcResponse)(e)&&this.events.emit(D.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(D.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_9__.formatJsonRpcResult)(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(T.payload,this.onPayloadHandler),this.provider.off(T.connect,this.onConnectHandler),this.provider.off(T.disconnect,this.onDisconnectHandler),this.provider.off(T.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(D.connection_stalled,()=>{this.restartTransport().catch(t=>this.logger.error(t))});let e=await (0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.isOnline)();(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.subscribeToNetworkChange)(async t=>{this.initialized&&e!==t&&(e=t,t?await this.restartTransport().catch(i=>this.logger.error(i)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(i=>this.logger.error(i))))})}onProviderDisconnect(){this.events.emit(D.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info(\"attemptToReconnect called. Connecting...\"),setTimeout(async()=>{await this.restartTransport().catch(e=>this.logger.error(e))},(0,_walletconnect_time__WEBPACK_IMPORTED_MODULE_7__.toMiliseconds)(lt)))}isInitialized(){if(!this.initialized){const{message:e}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"NOT_INITIALIZED\",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(e=>{const t=setInterval(()=>{this.connected&&(clearInterval(t),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}}var _r=Object.defineProperty,Nt=Object.getOwnPropertySymbols,Sr=Object.prototype.hasOwnProperty,Pr=Object.prototype.propertyIsEnumerable,Lt=(r,e,t)=>e in r?_r(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ut=(r,e)=>{for(var t in e||(e={}))Sr.call(e,t)&&Lt(r,t,e[t]);if(Nt)for(var t of Nt(e))Pr.call(e,t)&&Lt(r,t,e[t]);return r};class Ft extends _walletconnect_types__WEBPACK_IMPORTED_MODULE_13__.IStore{constructor(e,t,i,s=O,n=void 0){super(e,t,i,s),this.core=e,this.logger=t,this.name=i,this.map=new Map,this.version=pt,this.cached=[],this.initialized=!1,this.storagePrefix=O,this.init=async()=>{this.initialized||(this.logger.trace(\"Initialized\"),await this.restore(),this.cached.forEach(a=>{this.getKey&&a!==null&&!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.isUndefined)(a)?this.map.set(this.getKey(a),a):(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.isProposalStruct)(a)?this.map.set(a.id,a):(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.isSessionStruct)(a)&&this.map.set(a.topic,a)}),this.cached=[],this.initialized=!0)},this.set=async(a,o)=>{this.isInitialized(),this.map.has(a)?await this.update(a,o):(this.logger.debug(\"Setting value\"),this.logger.trace({type:\"method\",method:\"set\",key:a,value:o}),this.map.set(a,o),await this.persist())},this.get=a=>(this.isInitialized(),this.logger.debug(\"Getting value\"),this.logger.trace({type:\"method\",method:\"get\",key:a}),this.getData(a)),this.getAll=a=>(this.isInitialized(),a?this.values.filter(o=>Object.keys(a).every(h=>lodash_isequal__WEBPACK_IMPORTED_MODULE_11___default()(o[h],a[h]))):this.values),this.update=async(a,o)=>{this.isInitialized(),this.logger.debug(\"Updating value\"),this.logger.trace({type:\"method\",method:\"update\",key:a,update:o});const h=Ut(Ut({},this.getData(a)),o);this.map.set(a,h),await this.persist()},this.delete=async(a,o)=>{this.isInitialized(),this.map.has(a)&&(this.logger.debug(\"Deleting value\"),this.logger.trace({type:\"method\",method:\"delete\",key:a,reason:o}),this.map.delete(a),await this.persist())},this.logger=(0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.generateChildLogger)(t,this.name),this.storagePrefix=s,this.getKey=n}get context(){return (0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+\"//\"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){const{message:i}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"NO_MATCHING_KEY\",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>\"u\"||!e.length)return;if(this.map.size){const{message:t}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"RESTORE_WILL_OVERRIDE\",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:\"method\",method:\"restore\",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"NOT_INITIALIZED\",this.name);throw new Error(e)}}}class $t{constructor(e,t){this.core=e,this.logger=t,this.name=ft,this.version=Et,this.events=new (events__WEBPACK_IMPORTED_MODULE_0___default()),this.initialized=!1,this.storagePrefix=O,this.ignoredPayloadTypes=[_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.TYPE_1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace(\"Initialized\"))},this.register=({methods:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]},this.create=async()=>{this.isInitialized();const i=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.generateRandomBytes32)(),s=await this.core.crypto.setSymKey(i),n=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.calcExpiry)(_walletconnect_time__WEBPACK_IMPORTED_MODULE_7__.FIVE_MINUTES),a={protocol:ot},o={topic:s,expiry:n,relay:a,active:!1},h=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.formatUri)({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a});return await this.pairings.set(s,o),await this.core.relayer.subscribe(s),this.core.expirer.set(s,n),{topic:s,uri:h}},this.pair=async i=>{this.isInitialized(),this.isValidPair(i);const{topic:s,symKey:n,relay:a}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.parseUri)(i.uri);let o;if(this.pairings.keys.includes(s)&&(o=this.pairings.get(s),o.active))throw new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);this.core.crypto.keychain.has(s)||(await this.core.crypto.setSymKey(n,s),await this.core.relayer.subscribe(s,{relay:a}));const h=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.calcExpiry)(_walletconnect_time__WEBPACK_IMPORTED_MODULE_7__.FIVE_MINUTES),u={topic:s,relay:a,expiry:h,active:!1};return await this.pairings.set(s,u),this.core.expirer.set(s,h),i.activatePairing&&await this.activate({topic:s}),this.events.emit(B.create,u),u},this.activate=async({topic:i})=>{this.isInitialized();const s=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.calcExpiry)(_walletconnect_time__WEBPACK_IMPORTED_MODULE_7__.THIRTY_DAYS);await this.pairings.update(i,{active:!0,expiry:s}),this.core.expirer.set(i,s)},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);const{topic:s}=i;if(this.pairings.keys.includes(s)){const n=await this.sendRequest(s,\"wc_pairingPing\",{}),{done:a,resolve:o,reject:h}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.createDelayedPromise)();this.events.once((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.engineEvent)(\"pairing_ping\",n),({error:u})=>{u?h(u):o()}),await a()}},this.updateExpiry=async({topic:i,expiry:s})=>{this.isInitialized(),await this.pairings.update(i,{expiry:s})},this.updateMetadata=async({topic:i,metadata:s})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:s})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);const{topic:s}=i;this.pairings.keys.includes(s)&&(await this.sendRequest(s,\"wc_pairingDelete\",(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getSdkError)(\"USER_DISCONNECTED\")),await this.deletePairing(s))},this.sendRequest=async(i,s,n)=>{const a=(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_9__.formatJsonRpcRequest)(s,n),o=await this.core.crypto.encode(i,a),h=F[s].req;return this.core.history.set(i,a),this.core.relayer.publish(i,o,h),a.id},this.sendResult=async(i,s,n)=>{const a=(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_9__.formatJsonRpcResult)(i,n),o=await this.core.crypto.encode(s,a),h=await this.core.history.get(s,i),u=F[h.request.method].res;await this.core.relayer.publish(s,o,u),await this.core.history.resolve(a)},this.sendError=async(i,s,n)=>{const a=(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_9__.formatJsonRpcError)(i,n),o=await this.core.crypto.encode(s,a),h=await this.core.history.get(s,i),u=F[h.request.method]?F[h.request.method].res:F.unregistered_method.res;await this.core.relayer.publish(s,o,u),await this.core.history.resolve(a)},this.deletePairing=async(i,s)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getSdkError)(\"USER_DISCONNECTED\")),this.core.crypto.deleteSymKey(i),s?Promise.resolve():this.core.expirer.del(i)])},this.cleanup=async()=>{const i=this.pairings.getAll().filter(s=>(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.isExpired)(s.expiry));await Promise.all(i.map(s=>this.deletePairing(s.topic)))},this.onRelayEventRequest=i=>{const{topic:s,payload:n}=i;switch(n.method){case\"wc_pairingPing\":return this.onPairingPingRequest(s,n);case\"wc_pairingDelete\":return this.onPairingDeleteRequest(s,n);default:return this.onUnknownRpcMethodRequest(s,n)}},this.onRelayEventResponse=async i=>{const{topic:s,payload:n}=i,a=(await this.core.history.get(s,n.id)).request.method;switch(a){case\"wc_pairingPing\":return this.onPairingPingResponse(s,n);default:return this.onUnknownRpcMethodResponse(a)}},this.onPairingPingRequest=async(i,s)=>{const{id:n}=s;try{this.isValidPing({topic:i}),await this.sendResult(n,i,!0),this.events.emit(B.ping,{id:n,topic:i})}catch(a){await this.sendError(n,i,a),this.logger.error(a)}},this.onPairingPingResponse=(i,s)=>{const{id:n}=s;setTimeout(()=>{(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_9__.isJsonRpcResult)(s)?this.events.emit((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.engineEvent)(\"pairing_ping\",n),{}):(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_9__.isJsonRpcError)(s)&&this.events.emit((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.engineEvent)(\"pairing_ping\",n),{error:s.error})},500)},this.onPairingDeleteRequest=async(i,s)=>{const{id:n}=s;try{this.isValidDisconnect({topic:i}),await this.deletePairing(i),this.events.emit(B.delete,{id:n,topic:i})}catch(a){await this.sendError(n,i,a),this.logger.error(a)}},this.onUnknownRpcMethodRequest=async(i,s)=>{const{id:n,method:a}=s;try{if(this.registeredMethods.includes(a))return;const o=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getSdkError)(\"WC_METHOD_UNSUPPORTED\",a);await this.sendError(n,i,o),this.logger.error(o)}catch(o){await this.sendError(n,i,o),this.logger.error(o)}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getSdkError)(\"WC_METHOD_UNSUPPORTED\",i))},this.isValidPair=i=>{if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.isValidParams)(i)){const{message:s}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"MISSING_OR_INVALID\",`pair() params: ${i}`);throw new Error(s)}if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.isValidUrl)(i.uri)){const{message:s}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"MISSING_OR_INVALID\",`pair() uri: ${i.uri}`);throw new Error(s)}},this.isValidPing=async i=>{if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.isValidParams)(i)){const{message:n}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"MISSING_OR_INVALID\",`ping() params: ${i}`);throw new Error(n)}const{topic:s}=i;await this.isValidPairingTopic(s)},this.isValidDisconnect=async i=>{if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.isValidParams)(i)){const{message:n}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"MISSING_OR_INVALID\",`disconnect() params: ${i}`);throw new Error(n)}const{topic:s}=i;await this.isValidPairingTopic(s)},this.isValidPairingTopic=async i=>{if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.isValidString)(i,!1)){const{message:s}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"MISSING_OR_INVALID\",`pairing topic should be a string: ${i}`);throw new Error(s)}if(!this.pairings.keys.includes(i)){const{message:s}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"NO_MATCHING_KEY\",`pairing topic doesn't exist: ${i}`);throw new Error(s)}if((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.isExpired)(this.pairings.get(i).expiry)){await this.deletePairing(i);const{message:s}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"EXPIRED\",`pairing topic: ${i}`);throw new Error(s)}},this.core=e,this.logger=(0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.generateChildLogger)(t,this.name),this.pairings=new Ft(this.core,this.logger,this.name,this.storagePrefix)}get context(){return (0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.getLoggerContext)(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"NOT_INITIALIZED\",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(D.message,async e=>{const{topic:t,message:i}=e;if(!this.pairings.keys.includes(t)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;const s=await this.core.crypto.decode(t,i);try{(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_9__.isJsonRpcRequest)(s)?(this.core.history.set(t,s),this.onRelayEventRequest({topic:t,payload:s})):(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_9__.isJsonRpcResponse)(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:t,payload:s}),this.core.history.delete(t,s.id))}catch(n){this.logger.error(n)}})}registerExpirerEvents(){this.core.expirer.on(v.expired,async e=>{const{topic:t}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.parseExpirerTarget)(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(B.expire,{topic:t}))})}}class Mt extends _walletconnect_types__WEBPACK_IMPORTED_MODULE_13__.IJsonRpcHistory{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new events__WEBPACK_IMPORTED_MODULE_0__.EventEmitter,this.name=wt,this.version=vt,this.cached=[],this.initialized=!1,this.storagePrefix=O,this.init=async()=>{this.initialized||(this.logger.trace(\"Initialized\"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(i,s,n)=>{if(this.isInitialized(),this.logger.debug(\"Setting JSON-RPC request history record\"),this.logger.trace({type:\"method\",method:\"set\",topic:i,request:s,chainId:n}),this.records.has(s.id))return;const a={id:s.id,topic:i,request:{method:s.method,params:s.params||null},chainId:n,expiry:(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.calcExpiry)(_walletconnect_time__WEBPACK_IMPORTED_MODULE_7__.THIRTY_DAYS)};this.records.set(a.id,a),this.events.emit(R.created,a)},this.resolve=async i=>{if(this.isInitialized(),this.logger.debug(\"Updating JSON-RPC response history record\"),this.logger.trace({type:\"method\",method:\"update\",response:i}),!this.records.has(i.id))return;const s=await this.getRecord(i.id);typeof s.response>\"u\"&&(s.response=(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_9__.isJsonRpcError)(i)?{error:i.error}:{result:i.result},this.records.set(s.id,s),this.events.emit(R.updated,s))},this.get=async(i,s)=>(this.isInitialized(),this.logger.debug(\"Getting record\"),this.logger.trace({type:\"method\",method:\"get\",topic:i,id:s}),await this.getRecord(s)),this.delete=(i,s)=>{this.isInitialized(),this.logger.debug(\"Deleting record\"),this.logger.trace({type:\"method\",method:\"delete\",id:s}),this.values.forEach(n=>{if(n.topic===i){if(typeof s<\"u\"&&n.id!==s)return;this.records.delete(n.id),this.events.emit(R.deleted,n)}})},this.exists=async(i,s)=>(this.isInitialized(),this.records.has(s)?(await this.getRecord(s)).topic===i:!1),this.on=(i,s)=>{this.events.on(i,s)},this.once=(i,s)=>{this.events.once(i,s)},this.off=(i,s)=>{this.events.off(i,s)},this.removeListener=(i,s)=>{this.events.removeListener(i,s)},this.logger=(0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.generateChildLogger)(t,this.name)}get context(){return (0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+\"//\"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(t=>{if(typeof t.response<\"u\")return;const i={topic:t.topic,request:(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_9__.formatJsonRpcRequest)(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(i)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:i}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"NO_MATCHING_KEY\",`${this.name}: ${e}`);throw new Error(i)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(R.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>\"u\"||!e.length)return;if(this.records.size){const{message:t}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"RESTORE_WILL_OVERRIDE\",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:\"method\",method:\"restore\",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(R.created,e=>{const t=R.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:\"event\",event:t,record:e}),this.persist()}),this.events.on(R.updated,e=>{const t=R.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:\"event\",event:t,record:e}),this.persist()}),this.events.on(R.deleted,e=>{const t=R.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:\"event\",event:t,record:e}),this.persist()}),this.core.heartbeat.on(_walletconnect_heartbeat__WEBPACK_IMPORTED_MODULE_2__.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(e=>{(0,_walletconnect_time__WEBPACK_IMPORTED_MODULE_7__.toMiliseconds)(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.delete(e.topic,e.id))})}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"NOT_INITIALIZED\",this.name);throw new Error(e)}}}class kt extends _walletconnect_types__WEBPACK_IMPORTED_MODULE_13__.IExpirer{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new events__WEBPACK_IMPORTED_MODULE_0__.EventEmitter,this.name=It,this.version=Ct,this.cached=[],this.initialized=!1,this.storagePrefix=O,this.init=async()=>{this.initialized||(this.logger.trace(\"Initialized\"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=i=>{try{const s=this.formatTarget(i);return typeof this.getExpiration(s)<\"u\"}catch{return!1}},this.set=(i,s)=>{this.isInitialized();const n=this.formatTarget(i),a={target:n,expiry:s};this.expirations.set(n,a),this.checkExpiry(n,a),this.events.emit(v.created,{target:n,expiration:a})},this.get=i=>{this.isInitialized();const s=this.formatTarget(i);return this.getExpiration(s)},this.del=i=>{if(this.isInitialized(),this.has(i)){const s=this.formatTarget(i),n=this.getExpiration(s);this.expirations.delete(s),this.events.emit(v.deleted,{target:s,expiration:n})}},this.on=(i,s)=>{this.events.on(i,s)},this.once=(i,s)=>{this.events.once(i,s)},this.off=(i,s)=>{this.events.off(i,s)},this.removeListener=(i,s)=>{this.events.removeListener(i,s)},this.logger=(0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.generateChildLogger)(t,this.name)}get context(){return (0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+\"//\"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e==\"string\")return (0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.formatTopicTarget)(e);if(typeof e==\"number\")return (0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.formatIdTarget)(e);const{message:t}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"UNKNOWN_TYPE\",`Target type: ${typeof e}`);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(v.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>\"u\"||!e.length)return;if(this.expirations.size){const{message:t}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"RESTORE_WILL_OVERRIDE\",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:\"method\",method:\"restore\",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:i}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"NO_MATCHING_KEY\",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}checkExpiry(e,t){const{expiry:i}=t;(0,_walletconnect_time__WEBPACK_IMPORTED_MODULE_7__.toMiliseconds)(i)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(v.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(_walletconnect_heartbeat__WEBPACK_IMPORTED_MODULE_2__.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(v.created,e=>{const t=v.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:\"event\",event:t,data:e}),this.persist()}),this.events.on(v.expired,e=>{const t=v.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:\"event\",event:t,data:e}),this.persist()}),this.events.on(v.deleted,e=>{const t=v.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:\"event\",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.getInternalError)(\"NOT_INITIALIZED\",this.name);throw new Error(e)}}}class Kt extends _walletconnect_types__WEBPACK_IMPORTED_MODULE_13__.IVerify{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.name=Q,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async()=>{if(this.verifyDisabled||(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.isReactNative)()||!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.isBrowser)())return;const i=Z;this.verifyUrl!==i&&this.removeIframe(),this.verifyUrl=i;try{await this.createIframe()}catch(s){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(s)}if(!this.initialized){this.removeIframe(),this.verifyUrl=pe;try{await this.createIframe()}catch(s){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(s),this.verifyDisabled=!0}}},this.register=async i=>{this.initialized?this.sendPost(i.attestationId):(this.addToQueue(i.attestationId),await this.init())},this.resolve=async i=>{if(this.isDevEnv)return\"\";const s=i?.verifyUrl||Z;let n;try{n=await this.fetchAttestation(i.attestationId,s)}catch(a){this.logger.info(`failed to resolve attestation: ${i.attestationId} from url: ${s}`),this.logger.info(a),n=await this.fetchAttestation(i.attestationId,pe)}return n},this.fetchAttestation=async(i,s)=>{this.logger.info(`resolving attestation: ${i} from url: ${s}`);const n=this.startAbortTimer(_walletconnect_time__WEBPACK_IMPORTED_MODULE_7__.ONE_SECOND*2),a=await fetch(`${s}/attestation/${i}`,{signal:this.abortController.signal});return clearTimeout(n),a.status===200?await a.json():void 0},this.addToQueue=i=>{this.queue.push(i)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(i=>this.sendPost(i)),this.queue=[])},this.sendPost=i=>{var s;try{if(!this.iframe)return;(s=this.iframe.contentWindow)==null||s.postMessage(i,\"*\"),this.logger.info(`postMessage sent: ${i} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let i;const s=n=>{n.data===\"verify_ready\"&&(this.initialized=!0,this.processQueue(),window.removeEventListener(\"message\",s),i())};await Promise.race([new Promise(n=>{if(document.getElementById(Q))return n();window.addEventListener(\"message\",s);const a=document.createElement(\"iframe\");a.id=Q,a.src=`${this.verifyUrl}/${this.projectId}`,a.style.display=\"none\",document.body.append(a),this.iframe=a,i=n}),new Promise((n,a)=>setTimeout(()=>{window.removeEventListener(\"message\",s),a(\"verify iframe load timeout\")},(0,_walletconnect_time__WEBPACK_IMPORTED_MODULE_7__.toMiliseconds)(_walletconnect_time__WEBPACK_IMPORTED_MODULE_7__.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.logger=(0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.generateChildLogger)(t,this.name),this.verifyUrl=Z,this.abortController=new AbortController,this.isDevEnv=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_12__.isNode)()&&process.env.IS_VITEST}get context(){return (0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.getLoggerContext)(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),(0,_walletconnect_time__WEBPACK_IMPORTED_MODULE_7__.toMiliseconds)(e))}}var Tr=Object.defineProperty,Bt=Object.getOwnPropertySymbols,xr=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable,Vt=(r,e,t)=>e in r?Tr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,qt=(r,e)=>{for(var t in e||(e={}))xr.call(e,t)&&Vt(r,t,e[t]);if(Bt)for(var t of Bt(e))Or.call(e,t)&&Vt(r,t,e[t]);return r};class ee extends _walletconnect_types__WEBPACK_IMPORTED_MODULE_13__.ICore{constructor(e){super(e),this.protocol=ue,this.version=We,this.name=X,this.events=new events__WEBPACK_IMPORTED_MODULE_0__.EventEmitter,this.initialized=!1,this.on=(i,s)=>this.events.on(i,s),this.once=(i,s)=>this.events.once(i,s),this.off=(i,s)=>this.events.off(i,s),this.removeListener=(i,s)=>this.events.removeListener(i,s),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||de,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:\"\";const t=typeof e?.logger<\"u\"&&typeof e?.logger!=\"string\"?e.logger:(0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.pino)((0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.getDefaultLoggerOptions)({level:e?.logger||Xe.logger}));this.logger=(0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.generateChildLogger)(t,this.name),this.heartbeat=new _walletconnect_heartbeat__WEBPACK_IMPORTED_MODULE_2__.HeartBeat,this.crypto=new _t(this,this.logger,e?.keychain),this.history=new Mt(this,this.logger),this.expirer=new kt(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new _walletconnect_keyvaluestorage__WEBPACK_IMPORTED_MODULE_1__[\"default\"](qt(qt({},Qe),e?.storageOptions)),this.relayer=new zt({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new $t(this,this.logger),this.verify=new Kt(this.projectId||\"\",this.logger)}static async init(e){const t=new ee(e);await t.initialize();const i=await t.crypto.getClientId();return await t.storage.setItem(Dt,i),t}get context(){return (0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_3__.getLoggerContext)(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace(\"Initialized\");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info(\"Core Initialization Success\")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const Ar=ee;\n//# sourceMappingURL=index.es.js.map\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/core/dist/index.es.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/environment/dist/cjs/crypto.js": -/*!********************************************************************!*\ - !*** ./node_modules/@walletconnect/environment/dist/cjs/crypto.js ***! - \********************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.isBrowserCryptoAvailable = exports.getSubtleCrypto = exports.getBrowerCrypto = void 0;\nfunction getBrowerCrypto() {\n return (__webpack_require__.g === null || __webpack_require__.g === void 0 ? void 0 : __webpack_require__.g.crypto) || (__webpack_require__.g === null || __webpack_require__.g === void 0 ? void 0 : __webpack_require__.g.msCrypto) || {};\n}\nexports.getBrowerCrypto = getBrowerCrypto;\nfunction getSubtleCrypto() {\n const browserCrypto = getBrowerCrypto();\n return browserCrypto.subtle || browserCrypto.webkitSubtle;\n}\nexports.getSubtleCrypto = getSubtleCrypto;\nfunction isBrowserCryptoAvailable() {\n return !!getBrowerCrypto() && !!getSubtleCrypto();\n}\nexports.isBrowserCryptoAvailable = isBrowserCryptoAvailable;\n//# sourceMappingURL=crypto.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/environment/dist/cjs/crypto.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/environment/dist/cjs/env.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@walletconnect/environment/dist/cjs/env.js ***! - \*****************************************************************/ -/***/ ((__unused_webpack_module, exports) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.isBrowser = exports.isNode = exports.isReactNative = void 0;\nfunction isReactNative() {\n return (typeof document === \"undefined\" &&\n typeof navigator !== \"undefined\" &&\n navigator.product === \"ReactNative\");\n}\nexports.isReactNative = isReactNative;\nfunction isNode() {\n return (typeof process !== \"undefined\" &&\n typeof process.versions !== \"undefined\" &&\n typeof process.versions.node !== \"undefined\");\n}\nexports.isNode = isNode;\nfunction isBrowser() {\n return !isReactNative() && !isNode();\n}\nexports.isBrowser = isBrowser;\n//# sourceMappingURL=env.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/environment/dist/cjs/env.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/environment/dist/cjs/index.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@walletconnect/environment/dist/cjs/index.js ***! - \*******************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.js\");\ntslib_1.__exportStar(__webpack_require__(/*! ./crypto */ \"./node_modules/@walletconnect/environment/dist/cjs/crypto.js\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./env */ \"./node_modules/@walletconnect/environment/dist/cjs/env.js\"), exports);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/environment/dist/cjs/index.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/events/dist/esm/events.js": -/*!***************************************************************!*\ - !*** ./node_modules/@walletconnect/events/dist/esm/events.js ***! - \***************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ IEvents: () => (/* binding */ IEvents)\n/* harmony export */ });\nclass IEvents {\n}\n//# sourceMappingURL=events.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/events/dist/esm/events.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/events/dist/esm/index.js": -/*!**************************************************************!*\ - !*** ./node_modules/@walletconnect/events/dist/esm/index.js ***! - \**************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ IEvents: () => (/* reexport safe */ _events__WEBPACK_IMPORTED_MODULE_0__.IEvents)\n/* harmony export */ });\n/* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./events */ \"./node_modules/@walletconnect/events/dist/esm/events.js\");\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/events/dist/esm/index.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/heartbeat/dist/cjs/constants/heartbeat.js": -/*!*******************************************************************************!*\ - !*** ./node_modules/@walletconnect/heartbeat/dist/cjs/constants/heartbeat.js ***! - \*******************************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.HEARTBEAT_EVENTS = exports.HEARTBEAT_INTERVAL = void 0;\nconst time_1 = __webpack_require__(/*! @walletconnect/time */ \"./node_modules/@walletconnect/time/dist/cjs/index.js\");\nexports.HEARTBEAT_INTERVAL = time_1.FIVE_SECONDS;\nexports.HEARTBEAT_EVENTS = {\n pulse: \"heartbeat_pulse\",\n};\n//# sourceMappingURL=heartbeat.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/heartbeat/dist/cjs/constants/heartbeat.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/heartbeat/dist/cjs/constants/index.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@walletconnect/heartbeat/dist/cjs/constants/index.js ***! - \***************************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.js\");\ntslib_1.__exportStar(__webpack_require__(/*! ./heartbeat */ \"./node_modules/@walletconnect/heartbeat/dist/cjs/constants/heartbeat.js\"), exports);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/heartbeat/dist/cjs/constants/index.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/heartbeat/dist/cjs/heartbeat.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@walletconnect/heartbeat/dist/cjs/heartbeat.js ***! - \*********************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.HeartBeat = void 0;\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.js\");\nconst events_1 = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\nconst time_1 = __webpack_require__(/*! @walletconnect/time */ \"./node_modules/@walletconnect/time/dist/cjs/index.js\");\nconst types_1 = __webpack_require__(/*! ./types */ \"./node_modules/@walletconnect/heartbeat/dist/cjs/types/index.js\");\nconst constants_1 = __webpack_require__(/*! ./constants */ \"./node_modules/@walletconnect/heartbeat/dist/cjs/constants/index.js\");\nclass HeartBeat extends types_1.IHeartBeat {\n constructor(opts) {\n super(opts);\n this.events = new events_1.EventEmitter();\n this.interval = constants_1.HEARTBEAT_INTERVAL;\n this.interval = (opts === null || opts === void 0 ? void 0 : opts.interval) || constants_1.HEARTBEAT_INTERVAL;\n }\n static init(opts) {\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\n const heartbeat = new HeartBeat(opts);\n yield heartbeat.init();\n return heartbeat;\n });\n }\n init() {\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\n yield this.initialize();\n });\n }\n stop() {\n clearInterval(this.intervalRef);\n }\n on(event, listener) {\n this.events.on(event, listener);\n }\n once(event, listener) {\n this.events.once(event, listener);\n }\n off(event, listener) {\n this.events.off(event, listener);\n }\n removeListener(event, listener) {\n this.events.removeListener(event, listener);\n }\n initialize() {\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\n this.intervalRef = setInterval(() => this.pulse(), time_1.toMiliseconds(this.interval));\n });\n }\n pulse() {\n this.events.emit(constants_1.HEARTBEAT_EVENTS.pulse);\n }\n}\nexports.HeartBeat = HeartBeat;\n//# sourceMappingURL=heartbeat.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/heartbeat/dist/cjs/heartbeat.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/heartbeat/dist/cjs/index.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@walletconnect/heartbeat/dist/cjs/index.js ***! - \*****************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.js\");\ntslib_1.__exportStar(__webpack_require__(/*! ./heartbeat */ \"./node_modules/@walletconnect/heartbeat/dist/cjs/heartbeat.js\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./types */ \"./node_modules/@walletconnect/heartbeat/dist/cjs/types/index.js\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./constants */ \"./node_modules/@walletconnect/heartbeat/dist/cjs/constants/index.js\"), exports);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/heartbeat/dist/cjs/index.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/heartbeat/dist/cjs/types/heartbeat.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@walletconnect/heartbeat/dist/cjs/types/heartbeat.js ***! - \***************************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.IHeartBeat = void 0;\nconst events_1 = __webpack_require__(/*! @walletconnect/events */ \"./node_modules/@walletconnect/events/dist/esm/index.js\");\nclass IHeartBeat extends events_1.IEvents {\n constructor(opts) {\n super();\n }\n}\nexports.IHeartBeat = IHeartBeat;\n//# sourceMappingURL=heartbeat.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/heartbeat/dist/cjs/types/heartbeat.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/heartbeat/dist/cjs/types/index.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@walletconnect/heartbeat/dist/cjs/types/index.js ***! - \***********************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.js\");\ntslib_1.__exportStar(__webpack_require__(/*! ./heartbeat */ \"./node_modules/@walletconnect/heartbeat/dist/cjs/types/heartbeat.js\"), exports);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/heartbeat/dist/cjs/types/index.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/jsonrpc-provider/dist/esm/index.js": -/*!************************************************************************!*\ - !*** ./node_modules/@walletconnect/jsonrpc-provider/dist/esm/index.js ***! - \************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ JsonRpcProvider: () => (/* reexport safe */ _provider__WEBPACK_IMPORTED_MODULE_0__.JsonRpcProvider),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _provider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./provider */ \"./node_modules/@walletconnect/jsonrpc-provider/dist/esm/provider.js\");\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_provider__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/jsonrpc-provider/dist/esm/index.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/jsonrpc-provider/dist/esm/provider.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@walletconnect/jsonrpc-provider/dist/esm/provider.js ***! - \***************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ JsonRpcProvider: () => (/* binding */ JsonRpcProvider),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\n/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(events__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @walletconnect/jsonrpc-utils */ \"./node_modules/@walletconnect/jsonrpc-utils/dist/esm/index.js\");\n\n\nclass JsonRpcProvider extends _walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_1__.IJsonRpcProvider {\n constructor(connection) {\n super(connection);\n this.events = new events__WEBPACK_IMPORTED_MODULE_0__.EventEmitter();\n this.hasRegisteredEventListeners = false;\n this.connection = this.setConnection(connection);\n if (this.connection.connected) {\n this.registerEventListeners();\n }\n }\n async connect(connection = this.connection) {\n await this.open(connection);\n }\n async disconnect() {\n await this.close();\n }\n on(event, listener) {\n this.events.on(event, listener);\n }\n once(event, listener) {\n this.events.once(event, listener);\n }\n off(event, listener) {\n this.events.off(event, listener);\n }\n removeListener(event, listener) {\n this.events.removeListener(event, listener);\n }\n async request(request, context) {\n return this.requestStrict((0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_1__.formatJsonRpcRequest)(request.method, request.params || [], request.id || (0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_1__.getBigIntRpcId)().toString()), context);\n }\n async requestStrict(request, context) {\n return new Promise(async (resolve, reject) => {\n if (!this.connection.connected) {\n try {\n await this.open();\n }\n catch (e) {\n reject(e);\n }\n }\n this.events.on(`${request.id}`, response => {\n if ((0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_1__.isJsonRpcError)(response)) {\n reject(response.error);\n }\n else {\n resolve(response.result);\n }\n });\n try {\n await this.connection.send(request, context);\n }\n catch (e) {\n reject(e);\n }\n });\n }\n setConnection(connection = this.connection) {\n return connection;\n }\n onPayload(payload) {\n this.events.emit(\"payload\", payload);\n if ((0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_1__.isJsonRpcResponse)(payload)) {\n this.events.emit(`${payload.id}`, payload);\n }\n else {\n this.events.emit(\"message\", {\n type: payload.method,\n data: payload.params,\n });\n }\n }\n onClose(event) {\n if (event && event.code === 3000) {\n this.events.emit(\"error\", new Error(`WebSocket connection closed abnormally with code: ${event.code} ${event.reason ? `(${event.reason})` : \"\"}`));\n }\n this.events.emit(\"disconnect\");\n }\n async open(connection = this.connection) {\n if (this.connection === connection && this.connection.connected)\n return;\n if (this.connection.connected)\n this.close();\n if (typeof connection === \"string\") {\n await this.connection.open(connection);\n connection = this.connection;\n }\n this.connection = this.setConnection(connection);\n await this.connection.open();\n this.registerEventListeners();\n this.events.emit(\"connect\");\n }\n async close() {\n await this.connection.close();\n }\n registerEventListeners() {\n if (this.hasRegisteredEventListeners)\n return;\n this.connection.on(\"payload\", (payload) => this.onPayload(payload));\n this.connection.on(\"close\", (event) => this.onClose(event));\n this.connection.on(\"error\", (error) => this.events.emit(\"error\", error));\n this.connection.on(\"register_error\", (error) => this.onClose());\n this.hasRegisteredEventListeners = true;\n }\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (JsonRpcProvider);\n//# sourceMappingURL=provider.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/jsonrpc-provider/dist/esm/provider.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/jsonrpc-types/dist/esm/index.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@walletconnect/jsonrpc-types/dist/esm/index.js ***! - \*********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ IBaseJsonRpcProvider: () => (/* reexport safe */ _provider__WEBPACK_IMPORTED_MODULE_2__.IBaseJsonRpcProvider),\n/* harmony export */ IEvents: () => (/* reexport safe */ _misc__WEBPACK_IMPORTED_MODULE_1__.IEvents),\n/* harmony export */ IJsonRpcConnection: () => (/* reexport safe */ _provider__WEBPACK_IMPORTED_MODULE_2__.IJsonRpcConnection),\n/* harmony export */ IJsonRpcProvider: () => (/* reexport safe */ _provider__WEBPACK_IMPORTED_MODULE_2__.IJsonRpcProvider)\n/* harmony export */ });\n/* harmony import */ var _jsonrpc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonrpc */ \"./node_modules/@walletconnect/jsonrpc-types/dist/esm/jsonrpc.js\");\n/* harmony import */ var _misc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./misc */ \"./node_modules/@walletconnect/jsonrpc-types/dist/esm/misc.js\");\n/* harmony import */ var _provider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./provider */ \"./node_modules/@walletconnect/jsonrpc-types/dist/esm/provider.js\");\n/* harmony import */ var _validator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./validator */ \"./node_modules/@walletconnect/jsonrpc-types/dist/esm/validator.js\");\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/jsonrpc-types/dist/esm/index.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/jsonrpc-types/dist/esm/jsonrpc.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@walletconnect/jsonrpc-types/dist/esm/jsonrpc.js ***! - \***********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=jsonrpc.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/jsonrpc-types/dist/esm/jsonrpc.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/jsonrpc-types/dist/esm/misc.js": -/*!********************************************************************!*\ - !*** ./node_modules/@walletconnect/jsonrpc-types/dist/esm/misc.js ***! - \********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ IEvents: () => (/* binding */ IEvents)\n/* harmony export */ });\nclass IEvents {\n}\n//# sourceMappingURL=misc.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/jsonrpc-types/dist/esm/misc.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/jsonrpc-types/dist/esm/provider.js": -/*!************************************************************************!*\ - !*** ./node_modules/@walletconnect/jsonrpc-types/dist/esm/provider.js ***! - \************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ IBaseJsonRpcProvider: () => (/* binding */ IBaseJsonRpcProvider),\n/* harmony export */ IJsonRpcConnection: () => (/* binding */ IJsonRpcConnection),\n/* harmony export */ IJsonRpcProvider: () => (/* binding */ IJsonRpcProvider)\n/* harmony export */ });\n/* harmony import */ var _misc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./misc */ \"./node_modules/@walletconnect/jsonrpc-types/dist/esm/misc.js\");\n\nclass IJsonRpcConnection extends _misc__WEBPACK_IMPORTED_MODULE_0__.IEvents {\n constructor(opts) {\n super();\n }\n}\nclass IBaseJsonRpcProvider extends _misc__WEBPACK_IMPORTED_MODULE_0__.IEvents {\n constructor() {\n super();\n }\n}\nclass IJsonRpcProvider extends IBaseJsonRpcProvider {\n constructor(connection) {\n super();\n }\n}\n//# sourceMappingURL=provider.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/jsonrpc-types/dist/esm/provider.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/jsonrpc-types/dist/esm/validator.js": -/*!*************************************************************************!*\ - !*** ./node_modules/@walletconnect/jsonrpc-types/dist/esm/validator.js ***! - \*************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=validator.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/jsonrpc-types/dist/esm/validator.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/constants.js": -/*!*************************************************************************!*\ - !*** ./node_modules/@walletconnect/jsonrpc-utils/dist/esm/constants.js ***! - \*************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_ERROR: () => (/* binding */ DEFAULT_ERROR),\n/* harmony export */ INTERNAL_ERROR: () => (/* binding */ INTERNAL_ERROR),\n/* harmony export */ INVALID_PARAMS: () => (/* binding */ INVALID_PARAMS),\n/* harmony export */ INVALID_REQUEST: () => (/* binding */ INVALID_REQUEST),\n/* harmony export */ METHOD_NOT_FOUND: () => (/* binding */ METHOD_NOT_FOUND),\n/* harmony export */ PARSE_ERROR: () => (/* binding */ PARSE_ERROR),\n/* harmony export */ RESERVED_ERROR_CODES: () => (/* binding */ RESERVED_ERROR_CODES),\n/* harmony export */ SERVER_ERROR: () => (/* binding */ SERVER_ERROR),\n/* harmony export */ SERVER_ERROR_CODE_RANGE: () => (/* binding */ SERVER_ERROR_CODE_RANGE),\n/* harmony export */ STANDARD_ERROR_MAP: () => (/* binding */ STANDARD_ERROR_MAP)\n/* harmony export */ });\nconst PARSE_ERROR = \"PARSE_ERROR\";\nconst INVALID_REQUEST = \"INVALID_REQUEST\";\nconst METHOD_NOT_FOUND = \"METHOD_NOT_FOUND\";\nconst INVALID_PARAMS = \"INVALID_PARAMS\";\nconst INTERNAL_ERROR = \"INTERNAL_ERROR\";\nconst SERVER_ERROR = \"SERVER_ERROR\";\nconst RESERVED_ERROR_CODES = [-32700, -32600, -32601, -32602, -32603];\nconst SERVER_ERROR_CODE_RANGE = [-32000, -32099];\nconst STANDARD_ERROR_MAP = {\n [PARSE_ERROR]: { code: -32700, message: \"Parse error\" },\n [INVALID_REQUEST]: { code: -32600, message: \"Invalid Request\" },\n [METHOD_NOT_FOUND]: { code: -32601, message: \"Method not found\" },\n [INVALID_PARAMS]: { code: -32602, message: \"Invalid params\" },\n [INTERNAL_ERROR]: { code: -32603, message: \"Internal error\" },\n [SERVER_ERROR]: { code: -32000, message: \"Server error\" },\n};\nconst DEFAULT_ERROR = SERVER_ERROR;\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/jsonrpc-utils/dist/esm/constants.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/env.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@walletconnect/jsonrpc-utils/dist/esm/env.js ***! - \*******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isNodeJs: () => (/* binding */ isNodeJs)\n/* harmony export */ });\n/* harmony import */ var _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/environment */ \"./node_modules/@walletconnect/environment/dist/cjs/index.js\");\n/* harmony import */ var _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};\n/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__) if([\"default\",\"isNodeJs\"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__]\n/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);\n\nconst isNodeJs = _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__.isNode;\n\n//# sourceMappingURL=env.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/jsonrpc-utils/dist/esm/env.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/error.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@walletconnect/jsonrpc-utils/dist/esm/error.js ***! - \*********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getError: () => (/* binding */ getError),\n/* harmony export */ getErrorByCode: () => (/* binding */ getErrorByCode),\n/* harmony export */ isReservedErrorCode: () => (/* binding */ isReservedErrorCode),\n/* harmony export */ isServerErrorCode: () => (/* binding */ isServerErrorCode),\n/* harmony export */ isValidErrorCode: () => (/* binding */ isValidErrorCode),\n/* harmony export */ parseConnectionError: () => (/* binding */ parseConnectionError),\n/* harmony export */ validateJsonRpcError: () => (/* binding */ validateJsonRpcError)\n/* harmony export */ });\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants */ \"./node_modules/@walletconnect/jsonrpc-utils/dist/esm/constants.js\");\n\nfunction isServerErrorCode(code) {\n return code <= _constants__WEBPACK_IMPORTED_MODULE_0__.SERVER_ERROR_CODE_RANGE[0] && code >= _constants__WEBPACK_IMPORTED_MODULE_0__.SERVER_ERROR_CODE_RANGE[1];\n}\nfunction isReservedErrorCode(code) {\n return _constants__WEBPACK_IMPORTED_MODULE_0__.RESERVED_ERROR_CODES.includes(code);\n}\nfunction isValidErrorCode(code) {\n return typeof code === \"number\";\n}\nfunction getError(type) {\n if (!Object.keys(_constants__WEBPACK_IMPORTED_MODULE_0__.STANDARD_ERROR_MAP).includes(type)) {\n return _constants__WEBPACK_IMPORTED_MODULE_0__.STANDARD_ERROR_MAP[_constants__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_ERROR];\n }\n return _constants__WEBPACK_IMPORTED_MODULE_0__.STANDARD_ERROR_MAP[type];\n}\nfunction getErrorByCode(code) {\n const match = Object.values(_constants__WEBPACK_IMPORTED_MODULE_0__.STANDARD_ERROR_MAP).find(e => e.code === code);\n if (!match) {\n return _constants__WEBPACK_IMPORTED_MODULE_0__.STANDARD_ERROR_MAP[_constants__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_ERROR];\n }\n return match;\n}\nfunction validateJsonRpcError(response) {\n if (typeof response.error.code === \"undefined\") {\n return { valid: false, error: \"Missing code for JSON-RPC error\" };\n }\n if (typeof response.error.message === \"undefined\") {\n return { valid: false, error: \"Missing message for JSON-RPC error\" };\n }\n if (!isValidErrorCode(response.error.code)) {\n return {\n valid: false,\n error: `Invalid error code type for JSON-RPC: ${response.error.code}`,\n };\n }\n if (isReservedErrorCode(response.error.code)) {\n const error = getErrorByCode(response.error.code);\n if (error.message !== _constants__WEBPACK_IMPORTED_MODULE_0__.STANDARD_ERROR_MAP[_constants__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_ERROR].message &&\n response.error.message === error.message) {\n return {\n valid: false,\n error: `Invalid error code message for JSON-RPC: ${response.error.code}`,\n };\n }\n }\n return { valid: true };\n}\nfunction parseConnectionError(e, url, type) {\n return e.message.includes(\"getaddrinfo ENOTFOUND\") || e.message.includes(\"connect ECONNREFUSED\")\n ? new Error(`Unavailable ${type} RPC url at ${url}`)\n : e;\n}\n//# sourceMappingURL=error.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/jsonrpc-utils/dist/esm/error.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/format.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@walletconnect/jsonrpc-utils/dist/esm/format.js ***! - \**********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ formatErrorMessage: () => (/* binding */ formatErrorMessage),\n/* harmony export */ formatJsonRpcError: () => (/* binding */ formatJsonRpcError),\n/* harmony export */ formatJsonRpcRequest: () => (/* binding */ formatJsonRpcRequest),\n/* harmony export */ formatJsonRpcResult: () => (/* binding */ formatJsonRpcResult),\n/* harmony export */ getBigIntRpcId: () => (/* binding */ getBigIntRpcId),\n/* harmony export */ payloadId: () => (/* binding */ payloadId)\n/* harmony export */ });\n/* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./error */ \"./node_modules/@walletconnect/jsonrpc-utils/dist/esm/error.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants */ \"./node_modules/@walletconnect/jsonrpc-utils/dist/esm/constants.js\");\n\n\nfunction payloadId(entropy = 3) {\n const date = Date.now() * Math.pow(10, entropy);\n const extra = Math.floor(Math.random() * Math.pow(10, entropy));\n return date + extra;\n}\nfunction getBigIntRpcId(entropy = 6) {\n return BigInt(payloadId(entropy));\n}\nfunction formatJsonRpcRequest(method, params, id) {\n return {\n id: id || payloadId(),\n jsonrpc: \"2.0\",\n method,\n params,\n };\n}\nfunction formatJsonRpcResult(id, result) {\n return {\n id,\n jsonrpc: \"2.0\",\n result,\n };\n}\nfunction formatJsonRpcError(id, error, data) {\n return {\n id,\n jsonrpc: \"2.0\",\n error: formatErrorMessage(error, data),\n };\n}\nfunction formatErrorMessage(error, data) {\n if (typeof error === \"undefined\") {\n return (0,_error__WEBPACK_IMPORTED_MODULE_0__.getError)(_constants__WEBPACK_IMPORTED_MODULE_1__.INTERNAL_ERROR);\n }\n if (typeof error === \"string\") {\n error = Object.assign(Object.assign({}, (0,_error__WEBPACK_IMPORTED_MODULE_0__.getError)(_constants__WEBPACK_IMPORTED_MODULE_1__.SERVER_ERROR)), { message: error });\n }\n if (typeof data !== \"undefined\") {\n error.data = data;\n }\n if ((0,_error__WEBPACK_IMPORTED_MODULE_0__.isReservedErrorCode)(error.code)) {\n error = (0,_error__WEBPACK_IMPORTED_MODULE_0__.getErrorByCode)(error.code);\n }\n return error;\n}\n//# sourceMappingURL=format.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/jsonrpc-utils/dist/esm/format.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/index.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@walletconnect/jsonrpc-utils/dist/esm/index.js ***! - \*********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_ERROR: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_ERROR),\n/* harmony export */ IBaseJsonRpcProvider: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_5__.IBaseJsonRpcProvider),\n/* harmony export */ IEvents: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_5__.IEvents),\n/* harmony export */ IJsonRpcConnection: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_5__.IJsonRpcConnection),\n/* harmony export */ IJsonRpcProvider: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_5__.IJsonRpcProvider),\n/* harmony export */ INTERNAL_ERROR: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.INTERNAL_ERROR),\n/* harmony export */ INVALID_PARAMS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.INVALID_PARAMS),\n/* harmony export */ INVALID_REQUEST: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.INVALID_REQUEST),\n/* harmony export */ METHOD_NOT_FOUND: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.METHOD_NOT_FOUND),\n/* harmony export */ PARSE_ERROR: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.PARSE_ERROR),\n/* harmony export */ RESERVED_ERROR_CODES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.RESERVED_ERROR_CODES),\n/* harmony export */ SERVER_ERROR: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.SERVER_ERROR),\n/* harmony export */ SERVER_ERROR_CODE_RANGE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.SERVER_ERROR_CODE_RANGE),\n/* harmony export */ STANDARD_ERROR_MAP: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.STANDARD_ERROR_MAP),\n/* harmony export */ formatErrorMessage: () => (/* reexport safe */ _format__WEBPACK_IMPORTED_MODULE_3__.formatErrorMessage),\n/* harmony export */ formatJsonRpcError: () => (/* reexport safe */ _format__WEBPACK_IMPORTED_MODULE_3__.formatJsonRpcError),\n/* harmony export */ formatJsonRpcRequest: () => (/* reexport safe */ _format__WEBPACK_IMPORTED_MODULE_3__.formatJsonRpcRequest),\n/* harmony export */ formatJsonRpcResult: () => (/* reexport safe */ _format__WEBPACK_IMPORTED_MODULE_3__.formatJsonRpcResult),\n/* harmony export */ getBigIntRpcId: () => (/* reexport safe */ _format__WEBPACK_IMPORTED_MODULE_3__.getBigIntRpcId),\n/* harmony export */ getError: () => (/* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_1__.getError),\n/* harmony export */ getErrorByCode: () => (/* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_1__.getErrorByCode),\n/* harmony export */ isHttpUrl: () => (/* reexport safe */ _url__WEBPACK_IMPORTED_MODULE_6__.isHttpUrl),\n/* harmony export */ isJsonRpcError: () => (/* reexport safe */ _validators__WEBPACK_IMPORTED_MODULE_7__.isJsonRpcError),\n/* harmony export */ isJsonRpcPayload: () => (/* reexport safe */ _validators__WEBPACK_IMPORTED_MODULE_7__.isJsonRpcPayload),\n/* harmony export */ isJsonRpcRequest: () => (/* reexport safe */ _validators__WEBPACK_IMPORTED_MODULE_7__.isJsonRpcRequest),\n/* harmony export */ isJsonRpcResponse: () => (/* reexport safe */ _validators__WEBPACK_IMPORTED_MODULE_7__.isJsonRpcResponse),\n/* harmony export */ isJsonRpcResult: () => (/* reexport safe */ _validators__WEBPACK_IMPORTED_MODULE_7__.isJsonRpcResult),\n/* harmony export */ isJsonRpcValidationInvalid: () => (/* reexport safe */ _validators__WEBPACK_IMPORTED_MODULE_7__.isJsonRpcValidationInvalid),\n/* harmony export */ isLocalhostUrl: () => (/* reexport safe */ _url__WEBPACK_IMPORTED_MODULE_6__.isLocalhostUrl),\n/* harmony export */ isReservedErrorCode: () => (/* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_1__.isReservedErrorCode),\n/* harmony export */ isServerErrorCode: () => (/* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_1__.isServerErrorCode),\n/* harmony export */ isValidDefaultRoute: () => (/* reexport safe */ _routing__WEBPACK_IMPORTED_MODULE_4__.isValidDefaultRoute),\n/* harmony export */ isValidErrorCode: () => (/* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_1__.isValidErrorCode),\n/* harmony export */ isValidLeadingWildcardRoute: () => (/* reexport safe */ _routing__WEBPACK_IMPORTED_MODULE_4__.isValidLeadingWildcardRoute),\n/* harmony export */ isValidRoute: () => (/* reexport safe */ _routing__WEBPACK_IMPORTED_MODULE_4__.isValidRoute),\n/* harmony export */ isValidTrailingWildcardRoute: () => (/* reexport safe */ _routing__WEBPACK_IMPORTED_MODULE_4__.isValidTrailingWildcardRoute),\n/* harmony export */ isValidWildcardRoute: () => (/* reexport safe */ _routing__WEBPACK_IMPORTED_MODULE_4__.isValidWildcardRoute),\n/* harmony export */ isWsUrl: () => (/* reexport safe */ _url__WEBPACK_IMPORTED_MODULE_6__.isWsUrl),\n/* harmony export */ parseConnectionError: () => (/* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_1__.parseConnectionError),\n/* harmony export */ payloadId: () => (/* reexport safe */ _format__WEBPACK_IMPORTED_MODULE_3__.payloadId),\n/* harmony export */ validateJsonRpcError: () => (/* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_1__.validateJsonRpcError)\n/* harmony export */ });\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants */ \"./node_modules/@walletconnect/jsonrpc-utils/dist/esm/constants.js\");\n/* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./error */ \"./node_modules/@walletconnect/jsonrpc-utils/dist/esm/error.js\");\n/* harmony import */ var _env__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./env */ \"./node_modules/@walletconnect/jsonrpc-utils/dist/esm/env.js\");\n/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};\n/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _env__WEBPACK_IMPORTED_MODULE_2__) if([\"default\",\"DEFAULT_ERROR\",\"INTERNAL_ERROR\",\"INVALID_PARAMS\",\"INVALID_REQUEST\",\"METHOD_NOT_FOUND\",\"PARSE_ERROR\",\"RESERVED_ERROR_CODES\",\"SERVER_ERROR\",\"SERVER_ERROR_CODE_RANGE\",\"STANDARD_ERROR_MAP\",\"getError\",\"getErrorByCode\",\"isReservedErrorCode\",\"isServerErrorCode\",\"isValidErrorCode\",\"parseConnectionError\",\"validateJsonRpcError\"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _env__WEBPACK_IMPORTED_MODULE_2__[__WEBPACK_IMPORT_KEY__]\n/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);\n/* harmony import */ var _format__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./format */ \"./node_modules/@walletconnect/jsonrpc-utils/dist/esm/format.js\");\n/* harmony import */ var _routing__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./routing */ \"./node_modules/@walletconnect/jsonrpc-utils/dist/esm/routing.js\");\n/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./types */ \"./node_modules/@walletconnect/jsonrpc-utils/dist/esm/types.js\");\n/* harmony import */ var _url__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./url */ \"./node_modules/@walletconnect/jsonrpc-utils/dist/esm/url.js\");\n/* harmony import */ var _validators__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./validators */ \"./node_modules/@walletconnect/jsonrpc-utils/dist/esm/validators.js\");\n\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/jsonrpc-utils/dist/esm/index.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/routing.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@walletconnect/jsonrpc-utils/dist/esm/routing.js ***! - \***********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isValidDefaultRoute: () => (/* binding */ isValidDefaultRoute),\n/* harmony export */ isValidLeadingWildcardRoute: () => (/* binding */ isValidLeadingWildcardRoute),\n/* harmony export */ isValidRoute: () => (/* binding */ isValidRoute),\n/* harmony export */ isValidTrailingWildcardRoute: () => (/* binding */ isValidTrailingWildcardRoute),\n/* harmony export */ isValidWildcardRoute: () => (/* binding */ isValidWildcardRoute)\n/* harmony export */ });\nfunction isValidRoute(route) {\n if (route.includes(\"*\")) {\n return isValidWildcardRoute(route);\n }\n if (/\\W/g.test(route)) {\n return false;\n }\n return true;\n}\nfunction isValidDefaultRoute(route) {\n return route === \"*\";\n}\nfunction isValidWildcardRoute(route) {\n if (isValidDefaultRoute(route)) {\n return true;\n }\n if (!route.includes(\"*\")) {\n return false;\n }\n if (route.split(\"*\").length !== 2) {\n return false;\n }\n if (route.split(\"*\").filter(x => x.trim() === \"\").length !== 1) {\n return false;\n }\n return true;\n}\nfunction isValidLeadingWildcardRoute(route) {\n return !isValidDefaultRoute(route) && isValidWildcardRoute(route) && !route.split(\"*\")[0].trim();\n}\nfunction isValidTrailingWildcardRoute(route) {\n return !isValidDefaultRoute(route) && isValidWildcardRoute(route) && !route.split(\"*\")[1].trim();\n}\n//# sourceMappingURL=routing.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/jsonrpc-utils/dist/esm/routing.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/types.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@walletconnect/jsonrpc-utils/dist/esm/types.js ***! - \*********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ IBaseJsonRpcProvider: () => (/* reexport safe */ _walletconnect_jsonrpc_types__WEBPACK_IMPORTED_MODULE_0__.IBaseJsonRpcProvider),\n/* harmony export */ IEvents: () => (/* reexport safe */ _walletconnect_jsonrpc_types__WEBPACK_IMPORTED_MODULE_0__.IEvents),\n/* harmony export */ IJsonRpcConnection: () => (/* reexport safe */ _walletconnect_jsonrpc_types__WEBPACK_IMPORTED_MODULE_0__.IJsonRpcConnection),\n/* harmony export */ IJsonRpcProvider: () => (/* reexport safe */ _walletconnect_jsonrpc_types__WEBPACK_IMPORTED_MODULE_0__.IJsonRpcProvider)\n/* harmony export */ });\n/* harmony import */ var _walletconnect_jsonrpc_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/jsonrpc-types */ \"./node_modules/@walletconnect/jsonrpc-types/dist/esm/index.js\");\n\n//# sourceMappingURL=types.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/jsonrpc-utils/dist/esm/types.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/url.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@walletconnect/jsonrpc-utils/dist/esm/url.js ***! - \*******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isHttpUrl: () => (/* binding */ isHttpUrl),\n/* harmony export */ isLocalhostUrl: () => (/* binding */ isLocalhostUrl),\n/* harmony export */ isWsUrl: () => (/* binding */ isWsUrl)\n/* harmony export */ });\nconst HTTP_REGEX = \"^https?:\";\nconst WS_REGEX = \"^wss?:\";\nfunction getUrlProtocol(url) {\n const matches = url.match(new RegExp(/^\\w+:/, \"gi\"));\n if (!matches || !matches.length)\n return;\n return matches[0];\n}\nfunction matchRegexProtocol(url, regex) {\n const protocol = getUrlProtocol(url);\n if (typeof protocol === \"undefined\")\n return false;\n return new RegExp(regex).test(protocol);\n}\nfunction isHttpUrl(url) {\n return matchRegexProtocol(url, HTTP_REGEX);\n}\nfunction isWsUrl(url) {\n return matchRegexProtocol(url, WS_REGEX);\n}\nfunction isLocalhostUrl(url) {\n return new RegExp(\"wss?://localhost(:d{2,5})?\").test(url);\n}\n//# sourceMappingURL=url.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/jsonrpc-utils/dist/esm/url.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/validators.js": -/*!**************************************************************************!*\ - !*** ./node_modules/@walletconnect/jsonrpc-utils/dist/esm/validators.js ***! - \**************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isJsonRpcError: () => (/* binding */ isJsonRpcError),\n/* harmony export */ isJsonRpcPayload: () => (/* binding */ isJsonRpcPayload),\n/* harmony export */ isJsonRpcRequest: () => (/* binding */ isJsonRpcRequest),\n/* harmony export */ isJsonRpcResponse: () => (/* binding */ isJsonRpcResponse),\n/* harmony export */ isJsonRpcResult: () => (/* binding */ isJsonRpcResult),\n/* harmony export */ isJsonRpcValidationInvalid: () => (/* binding */ isJsonRpcValidationInvalid)\n/* harmony export */ });\nfunction isJsonRpcPayload(payload) {\n return (typeof payload === \"object\" &&\n \"id\" in payload &&\n \"jsonrpc\" in payload &&\n payload.jsonrpc === \"2.0\");\n}\nfunction isJsonRpcRequest(payload) {\n return isJsonRpcPayload(payload) && \"method\" in payload;\n}\nfunction isJsonRpcResponse(payload) {\n return isJsonRpcPayload(payload) && (isJsonRpcResult(payload) || isJsonRpcError(payload));\n}\nfunction isJsonRpcResult(payload) {\n return \"result\" in payload;\n}\nfunction isJsonRpcError(payload) {\n return \"error\" in payload;\n}\nfunction isJsonRpcValidationInvalid(validation) {\n return \"error\" in validation && validation.valid === false;\n}\n//# sourceMappingURL=validators.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/jsonrpc-utils/dist/esm/validators.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/jsonrpc-ws-connection/dist/esm/index.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/@walletconnect/jsonrpc-ws-connection/dist/esm/index.js ***! - \*****************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ WsConnection: () => (/* reexport safe */ _ws__WEBPACK_IMPORTED_MODULE_0__.WsConnection),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _ws__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ws */ \"./node_modules/@walletconnect/jsonrpc-ws-connection/dist/esm/ws.js\");\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_ws__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/jsonrpc-ws-connection/dist/esm/index.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/jsonrpc-ws-connection/dist/esm/utils.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/@walletconnect/jsonrpc-ws-connection/dist/esm/utils.js ***! - \*****************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hasBuiltInWebSocket: () => (/* binding */ hasBuiltInWebSocket),\n/* harmony export */ isBrowser: () => (/* binding */ isBrowser),\n/* harmony export */ resolveWebSocketImplementation: () => (/* binding */ resolveWebSocketImplementation),\n/* harmony export */ truncateQuery: () => (/* binding */ truncateQuery)\n/* harmony export */ });\nconst resolveWebSocketImplementation = () => {\n if (typeof WebSocket !== \"undefined\") {\n return WebSocket;\n }\n else if (typeof __webpack_require__.g !== \"undefined\" && typeof __webpack_require__.g.WebSocket !== \"undefined\") {\n return __webpack_require__.g.WebSocket;\n }\n else if (typeof window !== \"undefined\" && typeof window.WebSocket !== \"undefined\") {\n return window.WebSocket;\n }\n else if (typeof self !== \"undefined\" && typeof self.WebSocket !== \"undefined\") {\n return self.WebSocket;\n }\n return __webpack_require__(/*! ws */ \"./node_modules/@walletconnect/jsonrpc-ws-connection/node_modules/ws/browser.js\");\n};\nconst hasBuiltInWebSocket = () => typeof WebSocket !== \"undefined\" ||\n (typeof __webpack_require__.g !== \"undefined\" && typeof __webpack_require__.g.WebSocket !== \"undefined\") ||\n (typeof window !== \"undefined\" && typeof window.WebSocket !== \"undefined\") ||\n (typeof self !== \"undefined\" && typeof self.WebSocket !== \"undefined\");\nconst isBrowser = () => typeof window !== \"undefined\";\nconst truncateQuery = (wssUrl) => wssUrl.split(\"?\")[0];\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/jsonrpc-ws-connection/dist/esm/utils.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/jsonrpc-ws-connection/dist/esm/ws.js": -/*!**************************************************************************!*\ - !*** ./node_modules/@walletconnect/jsonrpc-ws-connection/dist/esm/ws.js ***! - \**************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ WsConnection: () => (/* binding */ WsConnection),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\n/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(events__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _walletconnect_safe_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @walletconnect/safe-json */ \"./node_modules/@walletconnect/safe-json/dist/esm/index.js\");\n/* harmony import */ var _walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @walletconnect/jsonrpc-utils */ \"./node_modules/@walletconnect/jsonrpc-utils/dist/esm/index.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ \"./node_modules/@walletconnect/jsonrpc-ws-connection/dist/esm/utils.js\");\n\n\n\n\nconst EVENT_EMITTER_MAX_LISTENERS_DEFAULT = 10;\nconst WS = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.resolveWebSocketImplementation)();\nclass WsConnection {\n constructor(url) {\n this.url = url;\n this.events = new events__WEBPACK_IMPORTED_MODULE_0__.EventEmitter();\n this.registering = false;\n if (!(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_2__.isWsUrl)(url)) {\n throw new Error(`Provided URL is not compatible with WebSocket connection: ${url}`);\n }\n this.url = url;\n }\n get connected() {\n return typeof this.socket !== \"undefined\";\n }\n get connecting() {\n return this.registering;\n }\n on(event, listener) {\n this.events.on(event, listener);\n }\n once(event, listener) {\n this.events.once(event, listener);\n }\n off(event, listener) {\n this.events.off(event, listener);\n }\n removeListener(event, listener) {\n this.events.removeListener(event, listener);\n }\n async open(url = this.url) {\n await this.register(url);\n }\n async close() {\n return new Promise((resolve, reject) => {\n if (typeof this.socket === \"undefined\") {\n reject(new Error(\"Connection already closed\"));\n return;\n }\n this.socket.onclose = event => {\n this.onClose(event);\n resolve();\n };\n this.socket.close();\n });\n }\n async send(payload, context) {\n if (typeof this.socket === \"undefined\") {\n this.socket = await this.register();\n }\n try {\n this.socket.send((0,_walletconnect_safe_json__WEBPACK_IMPORTED_MODULE_1__.safeJsonStringify)(payload));\n }\n catch (e) {\n this.onError(payload.id, e);\n }\n }\n register(url = this.url) {\n if (!(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_2__.isWsUrl)(url)) {\n throw new Error(`Provided URL is not compatible with WebSocket connection: ${url}`);\n }\n if (this.registering) {\n const currentMaxListeners = this.events.getMaxListeners();\n if (this.events.listenerCount(\"register_error\") >= currentMaxListeners ||\n this.events.listenerCount(\"open\") >= currentMaxListeners) {\n this.events.setMaxListeners(currentMaxListeners + 1);\n }\n return new Promise((resolve, reject) => {\n this.events.once(\"register_error\", error => {\n this.resetMaxListeners();\n reject(error);\n });\n this.events.once(\"open\", () => {\n this.resetMaxListeners();\n if (typeof this.socket === \"undefined\") {\n return reject(new Error(\"WebSocket connection is missing or invalid\"));\n }\n resolve(this.socket);\n });\n });\n }\n this.url = url;\n this.registering = true;\n return new Promise((resolve, reject) => {\n const opts = !(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_2__.isReactNative)() ? { rejectUnauthorized: !(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_2__.isLocalhostUrl)(url) } : undefined;\n const socket = new WS(url, [], opts);\n if ((0,_utils__WEBPACK_IMPORTED_MODULE_3__.hasBuiltInWebSocket)()) {\n socket.onerror = (event) => {\n const errorEvent = event;\n reject(this.emitError(errorEvent.error));\n };\n }\n else {\n socket.on(\"error\", (errorEvent) => {\n reject(this.emitError(errorEvent));\n });\n }\n socket.onopen = () => {\n this.onOpen(socket);\n resolve(socket);\n };\n });\n }\n onOpen(socket) {\n socket.onmessage = (event) => this.onPayload(event);\n socket.onclose = event => this.onClose(event);\n this.socket = socket;\n this.registering = false;\n this.events.emit(\"open\");\n }\n onClose(event) {\n this.socket = undefined;\n this.registering = false;\n this.events.emit(\"close\", event);\n }\n onPayload(e) {\n if (typeof e.data === \"undefined\")\n return;\n const payload = typeof e.data === \"string\" ? (0,_walletconnect_safe_json__WEBPACK_IMPORTED_MODULE_1__.safeJsonParse)(e.data) : e.data;\n this.events.emit(\"payload\", payload);\n }\n onError(id, e) {\n const error = this.parseError(e);\n const message = error.message || error.toString();\n const payload = (0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_2__.formatJsonRpcError)(id, message);\n this.events.emit(\"payload\", payload);\n }\n parseError(e, url = this.url) {\n return (0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_2__.parseConnectionError)(e, (0,_utils__WEBPACK_IMPORTED_MODULE_3__.truncateQuery)(url), \"WS\");\n }\n resetMaxListeners() {\n if (this.events.getMaxListeners() > EVENT_EMITTER_MAX_LISTENERS_DEFAULT) {\n this.events.setMaxListeners(EVENT_EMITTER_MAX_LISTENERS_DEFAULT);\n }\n }\n emitError(errorEvent) {\n const error = this.parseError(new Error((errorEvent === null || errorEvent === void 0 ? void 0 : errorEvent.message) || `WebSocket connection failed for host: ${(0,_utils__WEBPACK_IMPORTED_MODULE_3__.truncateQuery)(this.url)}`));\n this.events.emit(\"register_error\", error);\n return error;\n }\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (WsConnection);\n//# sourceMappingURL=ws.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/jsonrpc-ws-connection/dist/esm/ws.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/jsonrpc-ws-connection/node_modules/ws/browser.js": -/*!**************************************************************************************!*\ - !*** ./node_modules/@walletconnect/jsonrpc-ws-connection/node_modules/ws/browser.js ***! - \**************************************************************************************/ -/***/ ((module) => { - -eval("\n\nmodule.exports = function () {\n throw new Error(\n 'ws does not work in the browser. Browser clients must use the native ' +\n 'WebSocket object'\n );\n};\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/jsonrpc-ws-connection/node_modules/ws/browser.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/keyvaluestorage/dist/cjs/browser/index.js": -/*!*******************************************************************************!*\ - !*** ./node_modules/@walletconnect/keyvaluestorage/dist/cjs/browser/index.js ***! - \*******************************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.KeyValueStorage = void 0;\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.js\");\nconst safe_json_utils_1 = __webpack_require__(/*! safe-json-utils */ \"./node_modules/safe-json-utils/dist/cjs/index.js\");\nconst localStorage_1 = tslib_1.__importDefault(__webpack_require__(/*! ./lib/localStorage */ \"./node_modules/@walletconnect/keyvaluestorage/dist/cjs/browser/lib/localStorage.js\"));\nconst shared_1 = __webpack_require__(/*! ../shared */ \"./node_modules/@walletconnect/keyvaluestorage/dist/cjs/shared/index.js\");\nclass KeyValueStorage {\n constructor() {\n this.localStorage = localStorage_1.default;\n }\n getKeys() {\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\n return Object.keys(this.localStorage);\n });\n }\n getEntries() {\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\n return Object.entries(this.localStorage).map(shared_1.parseEntry);\n });\n }\n getItem(key) {\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\n const item = this.localStorage.getItem(key);\n if (item === null) {\n return undefined;\n }\n return safe_json_utils_1.safeJsonParse(item);\n });\n }\n setItem(key, value) {\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\n this.localStorage.setItem(key, safe_json_utils_1.safeJsonStringify(value));\n });\n }\n removeItem(key) {\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\n this.localStorage.removeItem(key);\n });\n }\n}\nexports.KeyValueStorage = KeyValueStorage;\nexports[\"default\"] = KeyValueStorage;\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/keyvaluestorage/dist/cjs/browser/index.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/keyvaluestorage/dist/cjs/browser/lib/localStorage.js": -/*!******************************************************************************************!*\ - !*** ./node_modules/@walletconnect/keyvaluestorage/dist/cjs/browser/lib/localStorage.js ***! - \******************************************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -eval("\n(function () {\n \"use strict\";\n let db;\n function LocalStorage() { }\n db = LocalStorage;\n db.prototype.getItem = function (key) {\n if (this.hasOwnProperty(key)) {\n return String(this[key]);\n }\n return null;\n };\n db.prototype.setItem = function (key, val) {\n this[key] = String(val);\n };\n db.prototype.removeItem = function (key) {\n delete this[key];\n };\n db.prototype.clear = function () {\n const self = this;\n Object.keys(self).forEach(function (key) {\n self[key] = undefined;\n delete self[key];\n });\n };\n db.prototype.key = function (i) {\n i = i || 0;\n return Object.keys(this)[i];\n };\n db.prototype.__defineGetter__(\"length\", function () {\n return Object.keys(this).length;\n });\n if (typeof __webpack_require__.g !== \"undefined\" && __webpack_require__.g.localStorage) {\n module.exports = __webpack_require__.g.localStorage;\n }\n else if (typeof window !== \"undefined\" && window.localStorage) {\n module.exports = window.localStorage;\n }\n else {\n module.exports = new LocalStorage();\n }\n})();\n//# sourceMappingURL=localStorage.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/keyvaluestorage/dist/cjs/browser/lib/localStorage.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/keyvaluestorage/dist/cjs/shared/index.js": -/*!******************************************************************************!*\ - !*** ./node_modules/@walletconnect/keyvaluestorage/dist/cjs/shared/index.js ***! - \******************************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.js\");\ntslib_1.__exportStar(__webpack_require__(/*! ./types */ \"./node_modules/@walletconnect/keyvaluestorage/dist/cjs/shared/types.js\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./utils */ \"./node_modules/@walletconnect/keyvaluestorage/dist/cjs/shared/utils.js\"), exports);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/keyvaluestorage/dist/cjs/shared/index.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/keyvaluestorage/dist/cjs/shared/types.js": -/*!******************************************************************************!*\ - !*** ./node_modules/@walletconnect/keyvaluestorage/dist/cjs/shared/types.js ***! - \******************************************************************************/ -/***/ ((__unused_webpack_module, exports) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.IKeyValueStorage = void 0;\nclass IKeyValueStorage {\n}\nexports.IKeyValueStorage = IKeyValueStorage;\n//# sourceMappingURL=types.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/keyvaluestorage/dist/cjs/shared/types.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/keyvaluestorage/dist/cjs/shared/utils.js": -/*!******************************************************************************!*\ - !*** ./node_modules/@walletconnect/keyvaluestorage/dist/cjs/shared/utils.js ***! - \******************************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.parseEntry = void 0;\nconst safe_json_utils_1 = __webpack_require__(/*! safe-json-utils */ \"./node_modules/safe-json-utils/dist/cjs/index.js\");\nfunction parseEntry(entry) {\n var _a;\n return [entry[0], safe_json_utils_1.safeJsonParse((_a = entry[1]) !== null && _a !== void 0 ? _a : \"\")];\n}\nexports.parseEntry = parseEntry;\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/keyvaluestorage/dist/cjs/shared/utils.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/logger/dist/cjs/constants.js": -/*!******************************************************************!*\ - !*** ./node_modules/@walletconnect/logger/dist/cjs/constants.js ***! - \******************************************************************/ -/***/ ((__unused_webpack_module, exports) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.PINO_CUSTOM_CONTEXT_KEY = exports.PINO_LOGGER_DEFAULTS = void 0;\nexports.PINO_LOGGER_DEFAULTS = {\n level: \"info\",\n};\nexports.PINO_CUSTOM_CONTEXT_KEY = \"custom_context\";\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/logger/dist/cjs/constants.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/logger/dist/cjs/index.js": -/*!**************************************************************!*\ - !*** ./node_modules/@walletconnect/logger/dist/cjs/index.js ***! - \**************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.pino = void 0;\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.js\");\nconst pino_1 = tslib_1.__importDefault(__webpack_require__(/*! pino */ \"./node_modules/pino/browser.js\"));\nObject.defineProperty(exports, \"pino\", ({ enumerable: true, get: function () { return pino_1.default; } }));\ntslib_1.__exportStar(__webpack_require__(/*! ./constants */ \"./node_modules/@walletconnect/logger/dist/cjs/constants.js\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./utils */ \"./node_modules/@walletconnect/logger/dist/cjs/utils.js\"), exports);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/logger/dist/cjs/index.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/logger/dist/cjs/utils.js": -/*!**************************************************************!*\ - !*** ./node_modules/@walletconnect/logger/dist/cjs/utils.js ***! - \**************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.generateChildLogger = exports.formatChildLoggerContext = exports.getLoggerContext = exports.setBrowserLoggerContext = exports.getBrowserLoggerContext = exports.getDefaultLoggerOptions = void 0;\nconst constants_1 = __webpack_require__(/*! ./constants */ \"./node_modules/@walletconnect/logger/dist/cjs/constants.js\");\nfunction getDefaultLoggerOptions(opts) {\n return Object.assign(Object.assign({}, opts), { level: (opts === null || opts === void 0 ? void 0 : opts.level) || constants_1.PINO_LOGGER_DEFAULTS.level });\n}\nexports.getDefaultLoggerOptions = getDefaultLoggerOptions;\nfunction getBrowserLoggerContext(logger, customContextKey = constants_1.PINO_CUSTOM_CONTEXT_KEY) {\n return logger[customContextKey] || \"\";\n}\nexports.getBrowserLoggerContext = getBrowserLoggerContext;\nfunction setBrowserLoggerContext(logger, context, customContextKey = constants_1.PINO_CUSTOM_CONTEXT_KEY) {\n logger[customContextKey] = context;\n return logger;\n}\nexports.setBrowserLoggerContext = setBrowserLoggerContext;\nfunction getLoggerContext(logger, customContextKey = constants_1.PINO_CUSTOM_CONTEXT_KEY) {\n let context = \"\";\n if (typeof logger.bindings === \"undefined\") {\n context = getBrowserLoggerContext(logger, customContextKey);\n }\n else {\n context = logger.bindings().context || \"\";\n }\n return context;\n}\nexports.getLoggerContext = getLoggerContext;\nfunction formatChildLoggerContext(logger, childContext, customContextKey = constants_1.PINO_CUSTOM_CONTEXT_KEY) {\n const parentContext = getLoggerContext(logger, customContextKey);\n const context = parentContext.trim()\n ? `${parentContext}/${childContext}`\n : childContext;\n return context;\n}\nexports.formatChildLoggerContext = formatChildLoggerContext;\nfunction generateChildLogger(logger, childContext, customContextKey = constants_1.PINO_CUSTOM_CONTEXT_KEY) {\n const context = formatChildLoggerContext(logger, childContext, customContextKey);\n const child = logger.child({ context });\n return setBrowserLoggerContext(child, context, customContextKey);\n}\nexports.generateChildLogger = generateChildLogger;\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/logger/dist/cjs/utils.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/relay-api/dist/esm/index.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@walletconnect/relay-api/dist/esm/index.js ***! - \*****************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RELAY_JSONRPC: () => (/* reexport safe */ _jsonrpc__WEBPACK_IMPORTED_MODULE_2__.RELAY_JSONRPC),\n/* harmony export */ isPublishMethod: () => (/* reexport safe */ _validators__WEBPACK_IMPORTED_MODULE_3__.isPublishMethod),\n/* harmony export */ isPublishParams: () => (/* reexport safe */ _validators__WEBPACK_IMPORTED_MODULE_3__.isPublishParams),\n/* harmony export */ isPublishRequest: () => (/* reexport safe */ _validators__WEBPACK_IMPORTED_MODULE_3__.isPublishRequest),\n/* harmony export */ isSubscribeMethod: () => (/* reexport safe */ _validators__WEBPACK_IMPORTED_MODULE_3__.isSubscribeMethod),\n/* harmony export */ isSubscribeParams: () => (/* reexport safe */ _validators__WEBPACK_IMPORTED_MODULE_3__.isSubscribeParams),\n/* harmony export */ isSubscribeRequest: () => (/* reexport safe */ _validators__WEBPACK_IMPORTED_MODULE_3__.isSubscribeRequest),\n/* harmony export */ isSubscriptionMethod: () => (/* reexport safe */ _validators__WEBPACK_IMPORTED_MODULE_3__.isSubscriptionMethod),\n/* harmony export */ isSubscriptionParams: () => (/* reexport safe */ _validators__WEBPACK_IMPORTED_MODULE_3__.isSubscriptionParams),\n/* harmony export */ isSubscriptionRequest: () => (/* reexport safe */ _validators__WEBPACK_IMPORTED_MODULE_3__.isSubscriptionRequest),\n/* harmony export */ isUnsubscribeMethod: () => (/* reexport safe */ _validators__WEBPACK_IMPORTED_MODULE_3__.isUnsubscribeMethod),\n/* harmony export */ isUnsubscribeParams: () => (/* reexport safe */ _validators__WEBPACK_IMPORTED_MODULE_3__.isUnsubscribeParams),\n/* harmony export */ isUnsubscribeRequest: () => (/* reexport safe */ _validators__WEBPACK_IMPORTED_MODULE_3__.isUnsubscribeRequest),\n/* harmony export */ parsePublishRequest: () => (/* reexport safe */ _parsers__WEBPACK_IMPORTED_MODULE_1__.parsePublishRequest),\n/* harmony export */ parseSubscribeRequest: () => (/* reexport safe */ _parsers__WEBPACK_IMPORTED_MODULE_1__.parseSubscribeRequest),\n/* harmony export */ parseSubscriptionRequest: () => (/* reexport safe */ _parsers__WEBPACK_IMPORTED_MODULE_1__.parseSubscriptionRequest),\n/* harmony export */ parseUnsubscribeRequest: () => (/* reexport safe */ _parsers__WEBPACK_IMPORTED_MODULE_1__.parseUnsubscribeRequest)\n/* harmony export */ });\n/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ \"./node_modules/@walletconnect/relay-api/dist/esm/types.js\");\n/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_types__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};\n/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _types__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== \"default\") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _types__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__]\n/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);\n/* harmony import */ var _parsers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./parsers */ \"./node_modules/@walletconnect/relay-api/dist/esm/parsers.js\");\n/* harmony import */ var _jsonrpc__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./jsonrpc */ \"./node_modules/@walletconnect/relay-api/dist/esm/jsonrpc.js\");\n/* harmony import */ var _validators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./validators */ \"./node_modules/@walletconnect/relay-api/dist/esm/validators.js\");\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/relay-api/dist/esm/index.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/relay-api/dist/esm/jsonrpc.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@walletconnect/relay-api/dist/esm/jsonrpc.js ***! - \*******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RELAY_JSONRPC: () => (/* binding */ RELAY_JSONRPC)\n/* harmony export */ });\nconst RELAY_JSONRPC = {\n waku: {\n publish: \"waku_publish\",\n batchPublish: \"waku_batchPublish\",\n subscribe: \"waku_subscribe\",\n batchSubscribe: \"waku_batchSubscribe\",\n subscription: \"waku_subscription\",\n unsubscribe: \"waku_unsubscribe\",\n batchUnsubscribe: \"waku_batchUnsubscribe\",\n },\n irn: {\n publish: \"irn_publish\",\n batchPublish: \"irn_batchPublish\",\n subscribe: \"irn_subscribe\",\n batchSubscribe: \"irn_batchSubscribe\",\n subscription: \"irn_subscription\",\n unsubscribe: \"irn_unsubscribe\",\n batchUnsubscribe: \"irn_batchUnsubscribe\",\n },\n iridium: {\n publish: \"iridium_publish\",\n batchPublish: \"iridium_batchPublish\",\n subscribe: \"iridium_subscribe\",\n batchSubscribe: \"iridium_batchSubscribe\",\n subscription: \"iridium_subscription\",\n unsubscribe: \"iridium_unsubscribe\",\n batchUnsubscribe: \"iridium_batchUnsubscribe\",\n },\n};\n//# sourceMappingURL=jsonrpc.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/relay-api/dist/esm/jsonrpc.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/relay-api/dist/esm/misc.js": -/*!****************************************************************!*\ - !*** ./node_modules/@walletconnect/relay-api/dist/esm/misc.js ***! - \****************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ assertType: () => (/* binding */ assertType),\n/* harmony export */ checkParams: () => (/* binding */ checkParams),\n/* harmony export */ hasExactParamsLength: () => (/* binding */ hasExactParamsLength),\n/* harmony export */ hasRequiredParams: () => (/* binding */ hasRequiredParams),\n/* harmony export */ hasRequiredParamsLength: () => (/* binding */ hasRequiredParamsLength),\n/* harmony export */ methodEndsWith: () => (/* binding */ methodEndsWith)\n/* harmony export */ });\nfunction assertType(obj, key, type = \"string\") {\n if (!obj[key] || typeof obj[key] !== type) {\n throw new Error(`Missing or invalid \"${key}\" param`);\n }\n}\nfunction hasRequiredParams(params, required) {\n let matches = true;\n required.forEach(key => {\n const exists = key in params;\n if (!exists) {\n matches = false;\n }\n });\n return matches;\n}\nfunction hasExactParamsLength(params, length) {\n return Array.isArray(params)\n ? params.length === length\n : Object.keys(params).length === length;\n}\nfunction hasRequiredParamsLength(params, minLength) {\n return Array.isArray(params)\n ? params.length >= minLength\n : Object.keys(params).length >= minLength;\n}\nfunction checkParams(params, required, optional) {\n const exact = !optional.length;\n const matchesLength = exact\n ? hasExactParamsLength(params, required.length)\n : hasRequiredParamsLength(params, required.length);\n if (!matchesLength)\n return false;\n return hasRequiredParams(params, required);\n}\nfunction methodEndsWith(method, expected, separator = \"_\") {\n const split = method.split(separator);\n return (split[split.length - 1].trim().toLowerCase() ===\n expected.trim().toLowerCase());\n}\n//# sourceMappingURL=misc.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/relay-api/dist/esm/misc.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/relay-api/dist/esm/parsers.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@walletconnect/relay-api/dist/esm/parsers.js ***! - \*******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ parsePublishRequest: () => (/* binding */ parsePublishRequest),\n/* harmony export */ parseSubscribeRequest: () => (/* binding */ parseSubscribeRequest),\n/* harmony export */ parseSubscriptionRequest: () => (/* binding */ parseSubscriptionRequest),\n/* harmony export */ parseUnsubscribeRequest: () => (/* binding */ parseUnsubscribeRequest)\n/* harmony export */ });\n/* harmony import */ var _misc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./misc */ \"./node_modules/@walletconnect/relay-api/dist/esm/misc.js\");\n/* harmony import */ var _validators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validators */ \"./node_modules/@walletconnect/relay-api/dist/esm/validators.js\");\n\n\nfunction parseSubscribeRequest(request) {\n if (!(0,_validators__WEBPACK_IMPORTED_MODULE_1__.isSubscribeMethod)(request.method)) {\n throw new Error(\"JSON-RPC Request has invalid subscribe method\");\n }\n if (!(0,_validators__WEBPACK_IMPORTED_MODULE_1__.isSubscribeParams)(request.params)) {\n throw new Error(\"JSON-RPC Request has invalid subscribe params\");\n }\n const params = request.params;\n (0,_misc__WEBPACK_IMPORTED_MODULE_0__.assertType)(params, \"topic\");\n return params;\n}\nfunction parsePublishRequest(request) {\n if (!(0,_validators__WEBPACK_IMPORTED_MODULE_1__.isPublishMethod)(request.method)) {\n throw new Error(\"JSON-RPC Request has invalid publish method\");\n }\n if (!(0,_validators__WEBPACK_IMPORTED_MODULE_1__.isPublishParams)(request.params)) {\n throw new Error(\"JSON-RPC Request has invalid publish params\");\n }\n const params = request.params;\n (0,_misc__WEBPACK_IMPORTED_MODULE_0__.assertType)(params, \"topic\");\n (0,_misc__WEBPACK_IMPORTED_MODULE_0__.assertType)(params, \"message\");\n (0,_misc__WEBPACK_IMPORTED_MODULE_0__.assertType)(params, \"ttl\", \"number\");\n return params;\n}\nfunction parseUnsubscribeRequest(request) {\n if (!(0,_validators__WEBPACK_IMPORTED_MODULE_1__.isUnsubscribeMethod)(request.method)) {\n throw new Error(\"JSON-RPC Request has invalid unsubscribe method\");\n }\n if (!(0,_validators__WEBPACK_IMPORTED_MODULE_1__.isUnsubscribeParams)(request.params)) {\n throw new Error(\"JSON-RPC Request has invalid unsubscribe params\");\n }\n const params = request.params;\n (0,_misc__WEBPACK_IMPORTED_MODULE_0__.assertType)(params, \"id\");\n return params;\n}\nfunction parseSubscriptionRequest(request) {\n if (!(0,_validators__WEBPACK_IMPORTED_MODULE_1__.isSubscriptionMethod)(request.method)) {\n throw new Error(\"JSON-RPC Request has invalid subscription method\");\n }\n if (!(0,_validators__WEBPACK_IMPORTED_MODULE_1__.isSubscriptionParams)(request.params)) {\n throw new Error(\"JSON-RPC Request has invalid subscription params\");\n }\n const params = request.params;\n (0,_misc__WEBPACK_IMPORTED_MODULE_0__.assertType)(params, \"id\");\n (0,_misc__WEBPACK_IMPORTED_MODULE_0__.assertType)(params, \"data\");\n return params;\n}\n//# sourceMappingURL=parsers.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/relay-api/dist/esm/parsers.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/relay-api/dist/esm/types.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@walletconnect/relay-api/dist/esm/types.js ***! - \*****************************************************************/ -/***/ (() => { - -eval("//# sourceMappingURL=types.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/relay-api/dist/esm/types.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/relay-api/dist/esm/validators.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@walletconnect/relay-api/dist/esm/validators.js ***! - \**********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isPublishMethod: () => (/* binding */ isPublishMethod),\n/* harmony export */ isPublishParams: () => (/* binding */ isPublishParams),\n/* harmony export */ isPublishRequest: () => (/* binding */ isPublishRequest),\n/* harmony export */ isSubscribeMethod: () => (/* binding */ isSubscribeMethod),\n/* harmony export */ isSubscribeParams: () => (/* binding */ isSubscribeParams),\n/* harmony export */ isSubscribeRequest: () => (/* binding */ isSubscribeRequest),\n/* harmony export */ isSubscriptionMethod: () => (/* binding */ isSubscriptionMethod),\n/* harmony export */ isSubscriptionParams: () => (/* binding */ isSubscriptionParams),\n/* harmony export */ isSubscriptionRequest: () => (/* binding */ isSubscriptionRequest),\n/* harmony export */ isUnsubscribeMethod: () => (/* binding */ isUnsubscribeMethod),\n/* harmony export */ isUnsubscribeParams: () => (/* binding */ isUnsubscribeParams),\n/* harmony export */ isUnsubscribeRequest: () => (/* binding */ isUnsubscribeRequest)\n/* harmony export */ });\n/* harmony import */ var _misc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./misc */ \"./node_modules/@walletconnect/relay-api/dist/esm/misc.js\");\n\nfunction isSubscribeRequest(request) {\n return isSubscribeMethod(request.method) && isSubscribeParams(request.params);\n}\nfunction isSubscribeMethod(method) {\n return (0,_misc__WEBPACK_IMPORTED_MODULE_0__.methodEndsWith)(method, \"subscribe\");\n}\nfunction isSubscribeParams(params) {\n const required = [\"topic\"];\n const optional = [];\n return (0,_misc__WEBPACK_IMPORTED_MODULE_0__.checkParams)(params, required, optional);\n}\nfunction isPublishRequest(request) {\n return isPublishMethod(request.method) && isPublishParams(request.params);\n}\nfunction isPublishMethod(method) {\n return (0,_misc__WEBPACK_IMPORTED_MODULE_0__.methodEndsWith)(method, \"publish\");\n}\nfunction isPublishParams(params) {\n const required = [\"message\", \"topic\", \"ttl\"];\n const optional = [\"prompt\", \"tag\"];\n return (0,_misc__WEBPACK_IMPORTED_MODULE_0__.checkParams)(params, required, optional);\n}\nfunction isUnsubscribeRequest(request) {\n return (isUnsubscribeMethod(request.method) && isUnsubscribeParams(request.params));\n}\nfunction isUnsubscribeMethod(method) {\n return (0,_misc__WEBPACK_IMPORTED_MODULE_0__.methodEndsWith)(method, \"unsubscribe\");\n}\nfunction isUnsubscribeParams(params) {\n const required = [\"id\", \"topic\"];\n const optional = [];\n return (0,_misc__WEBPACK_IMPORTED_MODULE_0__.checkParams)(params, required, optional);\n}\nfunction isSubscriptionRequest(request) {\n return (isSubscriptionMethod(request.method) && isSubscriptionParams(request.params));\n}\nfunction isSubscriptionMethod(method) {\n return (0,_misc__WEBPACK_IMPORTED_MODULE_0__.methodEndsWith)(method, \"subscription\");\n}\nfunction isSubscriptionParams(params) {\n const required = [\"id\", \"data\"];\n const optional = [];\n return (0,_misc__WEBPACK_IMPORTED_MODULE_0__.checkParams)(params, required, optional);\n}\n//# sourceMappingURL=validators.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/relay-api/dist/esm/validators.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/relay-auth/dist/esm/api.js": -/*!****************************************************************!*\ - !*** ./node_modules/@walletconnect/relay-auth/dist/esm/api.js ***! - \****************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ generateKeyPair: () => (/* binding */ generateKeyPair),\n/* harmony export */ signJWT: () => (/* binding */ signJWT),\n/* harmony export */ verifyJWT: () => (/* binding */ verifyJWT)\n/* harmony export */ });\n/* harmony import */ var _stablelib_ed25519__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @stablelib/ed25519 */ \"./node_modules/@stablelib/ed25519/lib/ed25519.js\");\n/* harmony import */ var _stablelib_random__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @stablelib/random */ \"./node_modules/@stablelib/random/lib/random.js\");\n/* harmony import */ var _walletconnect_time__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @walletconnect/time */ \"./node_modules/@walletconnect/time/dist/cjs/index.js\");\n/* harmony import */ var _walletconnect_time__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants */ \"./node_modules/@walletconnect/relay-auth/dist/esm/constants.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils */ \"./node_modules/@walletconnect/relay-auth/dist/esm/utils.js\");\n\n\n\n\n\nfunction generateKeyPair(seed = (0,_stablelib_random__WEBPACK_IMPORTED_MODULE_1__.randomBytes)(_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_PAIR_SEED_LENGTH)) {\n return _stablelib_ed25519__WEBPACK_IMPORTED_MODULE_0__.generateKeyPairFromSeed(seed);\n}\nasync function signJWT(sub, aud, ttl, keyPair, iat = (0,_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.fromMiliseconds)(Date.now())) {\n const header = { alg: _constants__WEBPACK_IMPORTED_MODULE_3__.JWT_IRIDIUM_ALG, typ: _constants__WEBPACK_IMPORTED_MODULE_3__.JWT_IRIDIUM_TYP };\n const iss = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.encodeIss)(keyPair.publicKey);\n const exp = iat + ttl;\n const payload = { iss, sub, aud, iat, exp };\n const data = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.encodeData)({ header, payload });\n const signature = _stablelib_ed25519__WEBPACK_IMPORTED_MODULE_0__.sign(keyPair.secretKey, data);\n return (0,_utils__WEBPACK_IMPORTED_MODULE_4__.encodeJWT)({ header, payload, signature });\n}\nasync function verifyJWT(jwt) {\n const { header, payload, data, signature } = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.decodeJWT)(jwt);\n if (header.alg !== _constants__WEBPACK_IMPORTED_MODULE_3__.JWT_IRIDIUM_ALG || header.typ !== _constants__WEBPACK_IMPORTED_MODULE_3__.JWT_IRIDIUM_TYP) {\n throw new Error(\"JWT must use EdDSA algorithm\");\n }\n const publicKey = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.decodeIss)(payload.iss);\n return _stablelib_ed25519__WEBPACK_IMPORTED_MODULE_0__.verify(publicKey, data, signature);\n}\n//# sourceMappingURL=api.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/relay-auth/dist/esm/api.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/relay-auth/dist/esm/constants.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@walletconnect/relay-auth/dist/esm/constants.js ***! - \**********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DATA_ENCODING: () => (/* binding */ DATA_ENCODING),\n/* harmony export */ DID_DELIMITER: () => (/* binding */ DID_DELIMITER),\n/* harmony export */ DID_METHOD: () => (/* binding */ DID_METHOD),\n/* harmony export */ DID_PREFIX: () => (/* binding */ DID_PREFIX),\n/* harmony export */ JSON_ENCODING: () => (/* binding */ JSON_ENCODING),\n/* harmony export */ JWT_DELIMITER: () => (/* binding */ JWT_DELIMITER),\n/* harmony export */ JWT_ENCODING: () => (/* binding */ JWT_ENCODING),\n/* harmony export */ JWT_IRIDIUM_ALG: () => (/* binding */ JWT_IRIDIUM_ALG),\n/* harmony export */ JWT_IRIDIUM_TYP: () => (/* binding */ JWT_IRIDIUM_TYP),\n/* harmony export */ KEY_PAIR_SEED_LENGTH: () => (/* binding */ KEY_PAIR_SEED_LENGTH),\n/* harmony export */ MULTICODEC_ED25519_BASE: () => (/* binding */ MULTICODEC_ED25519_BASE),\n/* harmony export */ MULTICODEC_ED25519_ENCODING: () => (/* binding */ MULTICODEC_ED25519_ENCODING),\n/* harmony export */ MULTICODEC_ED25519_HEADER: () => (/* binding */ MULTICODEC_ED25519_HEADER),\n/* harmony export */ MULTICODEC_ED25519_LENGTH: () => (/* binding */ MULTICODEC_ED25519_LENGTH)\n/* harmony export */ });\nconst JWT_IRIDIUM_ALG = \"EdDSA\";\nconst JWT_IRIDIUM_TYP = \"JWT\";\nconst JWT_DELIMITER = \".\";\nconst JWT_ENCODING = \"base64url\";\nconst JSON_ENCODING = \"utf8\";\nconst DATA_ENCODING = \"utf8\";\nconst DID_DELIMITER = \":\";\nconst DID_PREFIX = \"did\";\nconst DID_METHOD = \"key\";\nconst MULTICODEC_ED25519_ENCODING = \"base58btc\";\nconst MULTICODEC_ED25519_BASE = \"z\";\nconst MULTICODEC_ED25519_HEADER = \"K36\";\nconst MULTICODEC_ED25519_LENGTH = 32;\nconst KEY_PAIR_SEED_LENGTH = 32;\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/relay-auth/dist/esm/constants.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/relay-auth/dist/esm/index.js": -/*!******************************************************************!*\ - !*** ./node_modules/@walletconnect/relay-auth/dist/esm/index.js ***! - \******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DATA_ENCODING: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_1__.DATA_ENCODING),\n/* harmony export */ DID_DELIMITER: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_1__.DID_DELIMITER),\n/* harmony export */ DID_METHOD: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_1__.DID_METHOD),\n/* harmony export */ DID_PREFIX: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_1__.DID_PREFIX),\n/* harmony export */ JSON_ENCODING: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_1__.JSON_ENCODING),\n/* harmony export */ JWT_DELIMITER: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_1__.JWT_DELIMITER),\n/* harmony export */ JWT_ENCODING: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_1__.JWT_ENCODING),\n/* harmony export */ JWT_IRIDIUM_ALG: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_1__.JWT_IRIDIUM_ALG),\n/* harmony export */ JWT_IRIDIUM_TYP: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_1__.JWT_IRIDIUM_TYP),\n/* harmony export */ KEY_PAIR_SEED_LENGTH: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_1__.KEY_PAIR_SEED_LENGTH),\n/* harmony export */ MULTICODEC_ED25519_BASE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_1__.MULTICODEC_ED25519_BASE),\n/* harmony export */ MULTICODEC_ED25519_ENCODING: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_1__.MULTICODEC_ED25519_ENCODING),\n/* harmony export */ MULTICODEC_ED25519_HEADER: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_1__.MULTICODEC_ED25519_HEADER),\n/* harmony export */ MULTICODEC_ED25519_LENGTH: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_1__.MULTICODEC_ED25519_LENGTH),\n/* harmony export */ decodeData: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_3__.decodeData),\n/* harmony export */ decodeIss: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_3__.decodeIss),\n/* harmony export */ decodeJSON: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_3__.decodeJSON),\n/* harmony export */ decodeJWT: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_3__.decodeJWT),\n/* harmony export */ decodeSig: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_3__.decodeSig),\n/* harmony export */ encodeData: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_3__.encodeData),\n/* harmony export */ encodeIss: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_3__.encodeIss),\n/* harmony export */ encodeJSON: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_3__.encodeJSON),\n/* harmony export */ encodeJWT: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_3__.encodeJWT),\n/* harmony export */ encodeSig: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_3__.encodeSig),\n/* harmony export */ generateKeyPair: () => (/* reexport safe */ _api__WEBPACK_IMPORTED_MODULE_0__.generateKeyPair),\n/* harmony export */ signJWT: () => (/* reexport safe */ _api__WEBPACK_IMPORTED_MODULE_0__.signJWT),\n/* harmony export */ verifyJWT: () => (/* reexport safe */ _api__WEBPACK_IMPORTED_MODULE_0__.verifyJWT)\n/* harmony export */ });\n/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./api */ \"./node_modules/@walletconnect/relay-auth/dist/esm/api.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants */ \"./node_modules/@walletconnect/relay-auth/dist/esm/constants.js\");\n/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./types */ \"./node_modules/@walletconnect/relay-auth/dist/esm/types.js\");\n/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_types__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};\n/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _types__WEBPACK_IMPORTED_MODULE_2__) if([\"default\",\"generateKeyPair\",\"signJWT\",\"verifyJWT\",\"DATA_ENCODING\",\"DID_DELIMITER\",\"DID_METHOD\",\"DID_PREFIX\",\"JSON_ENCODING\",\"JWT_DELIMITER\",\"JWT_ENCODING\",\"JWT_IRIDIUM_ALG\",\"JWT_IRIDIUM_TYP\",\"KEY_PAIR_SEED_LENGTH\",\"MULTICODEC_ED25519_BASE\",\"MULTICODEC_ED25519_ENCODING\",\"MULTICODEC_ED25519_HEADER\",\"MULTICODEC_ED25519_LENGTH\"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _types__WEBPACK_IMPORTED_MODULE_2__[__WEBPACK_IMPORT_KEY__]\n/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ \"./node_modules/@walletconnect/relay-auth/dist/esm/utils.js\");\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/relay-auth/dist/esm/index.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/relay-auth/dist/esm/types.js": -/*!******************************************************************!*\ - !*** ./node_modules/@walletconnect/relay-auth/dist/esm/types.js ***! - \******************************************************************/ -/***/ (() => { - -eval("//# sourceMappingURL=types.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/relay-auth/dist/esm/types.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/relay-auth/dist/esm/utils.js": -/*!******************************************************************!*\ - !*** ./node_modules/@walletconnect/relay-auth/dist/esm/utils.js ***! - \******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decodeData: () => (/* binding */ decodeData),\n/* harmony export */ decodeIss: () => (/* binding */ decodeIss),\n/* harmony export */ decodeJSON: () => (/* binding */ decodeJSON),\n/* harmony export */ decodeJWT: () => (/* binding */ decodeJWT),\n/* harmony export */ decodeSig: () => (/* binding */ decodeSig),\n/* harmony export */ encodeData: () => (/* binding */ encodeData),\n/* harmony export */ encodeIss: () => (/* binding */ encodeIss),\n/* harmony export */ encodeJSON: () => (/* binding */ encodeJSON),\n/* harmony export */ encodeJWT: () => (/* binding */ encodeJWT),\n/* harmony export */ encodeSig: () => (/* binding */ encodeSig)\n/* harmony export */ });\n/* harmony import */ var uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uint8arrays/concat */ \"./node_modules/uint8arrays/esm/src/concat.js\");\n/* harmony import */ var uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uint8arrays/to-string */ \"./node_modules/uint8arrays/esm/src/to-string.js\");\n/* harmony import */ var uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uint8arrays/from-string */ \"./node_modules/uint8arrays/esm/src/from-string.js\");\n/* harmony import */ var _walletconnect_safe_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @walletconnect/safe-json */ \"./node_modules/@walletconnect/safe-json/dist/esm/index.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./constants */ \"./node_modules/@walletconnect/relay-auth/dist/esm/constants.js\");\n\n\n\n\n\nfunction decodeJSON(str) {\n return (0,_walletconnect_safe_json__WEBPACK_IMPORTED_MODULE_3__.safeJsonParse)((0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)((0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__.fromString)(str, _constants__WEBPACK_IMPORTED_MODULE_4__.JWT_ENCODING), _constants__WEBPACK_IMPORTED_MODULE_4__.JSON_ENCODING));\n}\nfunction encodeJSON(val) {\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)((0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__.fromString)((0,_walletconnect_safe_json__WEBPACK_IMPORTED_MODULE_3__.safeJsonStringify)(val), _constants__WEBPACK_IMPORTED_MODULE_4__.JSON_ENCODING), _constants__WEBPACK_IMPORTED_MODULE_4__.JWT_ENCODING);\n}\nfunction encodeIss(publicKey) {\n const header = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__.fromString)(_constants__WEBPACK_IMPORTED_MODULE_4__.MULTICODEC_ED25519_HEADER, _constants__WEBPACK_IMPORTED_MODULE_4__.MULTICODEC_ED25519_ENCODING);\n const multicodec = _constants__WEBPACK_IMPORTED_MODULE_4__.MULTICODEC_ED25519_BASE +\n (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)((0,uint8arrays_concat__WEBPACK_IMPORTED_MODULE_0__.concat)([header, publicKey]), _constants__WEBPACK_IMPORTED_MODULE_4__.MULTICODEC_ED25519_ENCODING);\n return [_constants__WEBPACK_IMPORTED_MODULE_4__.DID_PREFIX, _constants__WEBPACK_IMPORTED_MODULE_4__.DID_METHOD, multicodec].join(_constants__WEBPACK_IMPORTED_MODULE_4__.DID_DELIMITER);\n}\nfunction decodeIss(issuer) {\n const [prefix, method, multicodec] = issuer.split(_constants__WEBPACK_IMPORTED_MODULE_4__.DID_DELIMITER);\n if (prefix !== _constants__WEBPACK_IMPORTED_MODULE_4__.DID_PREFIX || method !== _constants__WEBPACK_IMPORTED_MODULE_4__.DID_METHOD) {\n throw new Error(`Issuer must be a DID with method \"key\"`);\n }\n const base = multicodec.slice(0, 1);\n if (base !== _constants__WEBPACK_IMPORTED_MODULE_4__.MULTICODEC_ED25519_BASE) {\n throw new Error(`Issuer must be a key in mulicodec format`);\n }\n const bytes = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__.fromString)(multicodec.slice(1), _constants__WEBPACK_IMPORTED_MODULE_4__.MULTICODEC_ED25519_ENCODING);\n const type = (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(bytes.slice(0, 2), _constants__WEBPACK_IMPORTED_MODULE_4__.MULTICODEC_ED25519_ENCODING);\n if (type !== _constants__WEBPACK_IMPORTED_MODULE_4__.MULTICODEC_ED25519_HEADER) {\n throw new Error(`Issuer must be a public key with type \"Ed25519\"`);\n }\n const publicKey = bytes.slice(2);\n if (publicKey.length !== _constants__WEBPACK_IMPORTED_MODULE_4__.MULTICODEC_ED25519_LENGTH) {\n throw new Error(`Issuer must be a public key with length 32 bytes`);\n }\n return publicKey;\n}\nfunction encodeSig(bytes) {\n return (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(bytes, _constants__WEBPACK_IMPORTED_MODULE_4__.JWT_ENCODING);\n}\nfunction decodeSig(encoded) {\n return (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__.fromString)(encoded, _constants__WEBPACK_IMPORTED_MODULE_4__.JWT_ENCODING);\n}\nfunction encodeData(params) {\n return (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__.fromString)([encodeJSON(params.header), encodeJSON(params.payload)].join(_constants__WEBPACK_IMPORTED_MODULE_4__.JWT_DELIMITER), _constants__WEBPACK_IMPORTED_MODULE_4__.DATA_ENCODING);\n}\nfunction decodeData(data) {\n const params = (0,uint8arrays_to_string__WEBPACK_IMPORTED_MODULE_1__.toString)(data, _constants__WEBPACK_IMPORTED_MODULE_4__.DATA_ENCODING).split(_constants__WEBPACK_IMPORTED_MODULE_4__.JWT_DELIMITER);\n const header = decodeJSON(params[0]);\n const payload = decodeJSON(params[1]);\n return { header, payload };\n}\nfunction encodeJWT(params) {\n return [\n encodeJSON(params.header),\n encodeJSON(params.payload),\n encodeSig(params.signature),\n ].join(_constants__WEBPACK_IMPORTED_MODULE_4__.JWT_DELIMITER);\n}\nfunction decodeJWT(jwt) {\n const params = jwt.split(_constants__WEBPACK_IMPORTED_MODULE_4__.JWT_DELIMITER);\n const header = decodeJSON(params[0]);\n const payload = decodeJSON(params[1]);\n const signature = decodeSig(params[2]);\n const data = (0,uint8arrays_from_string__WEBPACK_IMPORTED_MODULE_2__.fromString)(params.slice(0, 2).join(_constants__WEBPACK_IMPORTED_MODULE_4__.JWT_DELIMITER), _constants__WEBPACK_IMPORTED_MODULE_4__.DATA_ENCODING);\n return { header, payload, signature, data };\n}\n//# sourceMappingURL=utils.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/relay-auth/dist/esm/utils.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/safe-json/dist/esm/index.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@walletconnect/safe-json/dist/esm/index.js ***! - \*****************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ safeJsonParse: () => (/* binding */ safeJsonParse),\n/* harmony export */ safeJsonStringify: () => (/* binding */ safeJsonStringify)\n/* harmony export */ });\nconst JSONStringify = data => JSON.stringify(data, (_, value) => typeof value === \"bigint\" ? value.toString() + \"n\" : value);\nconst JSONParse = json => {\n const numbersBiggerThanMaxInt = /([\\[:])?(\\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\\}\\]])/g;\n const serializedData = json.replace(numbersBiggerThanMaxInt, \"$1\\\"$2n\\\"$3\");\n return JSON.parse(serializedData, (_, value) => {\n const isCustomFormatBigInt = typeof value === \"string\" && value.match(/^\\d+n$/);\n if (isCustomFormatBigInt)\n return BigInt(value.substring(0, value.length - 1));\n return value;\n });\n};\nfunction safeJsonParse(value) {\n if (typeof value !== \"string\") {\n throw new Error(`Cannot safe json parse value of type ${typeof value}`);\n }\n try {\n return JSONParse(value);\n }\n catch (_a) {\n return value;\n }\n}\nfunction safeJsonStringify(value) {\n return typeof value === \"string\" ? value : JSONStringify(value) || \"\";\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/safe-json/dist/esm/index.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/sign-client/dist/index.es.js": -/*!******************************************************************!*\ - !*** ./node_modules/@walletconnect/sign-client/dist/index.es.js ***! - \******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ENGINE_CONTEXT: () => (/* binding */ ce),\n/* harmony export */ ENGINE_QUEUE_STATES: () => (/* binding */ I),\n/* harmony export */ ENGINE_RPC_OPTS: () => (/* binding */ V),\n/* harmony export */ HISTORY_CONTEXT: () => (/* binding */ ts),\n/* harmony export */ HISTORY_EVENTS: () => (/* binding */ ss),\n/* harmony export */ HISTORY_STORAGE_VERSION: () => (/* binding */ is),\n/* harmony export */ METHODS_TO_VERIFY: () => (/* binding */ pe),\n/* harmony export */ PROPOSAL_CONTEXT: () => (/* binding */ ne),\n/* harmony export */ PROPOSAL_EXPIRY: () => (/* binding */ rs),\n/* harmony export */ PROPOSAL_EXPIRY_MESSAGE: () => (/* binding */ oe),\n/* harmony export */ REQUEST_CONTEXT: () => (/* binding */ le),\n/* harmony export */ SESSION_CONTEXT: () => (/* binding */ ae),\n/* harmony export */ SESSION_EXPIRY: () => (/* binding */ A),\n/* harmony export */ SESSION_REQUEST_EXPIRY_BOUNDARIES: () => (/* binding */ U),\n/* harmony export */ SIGN_CLIENT_CONTEXT: () => (/* binding */ H),\n/* harmony export */ SIGN_CLIENT_DEFAULT: () => (/* binding */ M),\n/* harmony export */ SIGN_CLIENT_EVENTS: () => (/* binding */ Ze),\n/* harmony export */ SIGN_CLIENT_PROTOCOL: () => (/* binding */ X),\n/* harmony export */ SIGN_CLIENT_STORAGE_OPTIONS: () => (/* binding */ es),\n/* harmony export */ SIGN_CLIENT_STORAGE_PREFIX: () => (/* binding */ G),\n/* harmony export */ SIGN_CLIENT_VERSION: () => (/* binding */ F),\n/* harmony export */ SignClient: () => (/* binding */ gs),\n/* harmony export */ WALLETCONNECT_DEEPLINK_CHOICE: () => (/* binding */ W),\n/* harmony export */ \"default\": () => (/* binding */ Q)\n/* harmony export */ });\n/* harmony import */ var _walletconnect_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @walletconnect/core */ \"./node_modules/@walletconnect/core/dist/index.es.js\");\n/* harmony import */ var _walletconnect_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/logger */ \"./node_modules/@walletconnect/logger/dist/cjs/index.js\");\n/* harmony import */ var _walletconnect_logger__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_walletconnect_logger__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _walletconnect_types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @walletconnect/types */ \"./node_modules/@walletconnect/types/dist/index.es.js\");\n/* harmony import */ var _walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @walletconnect/utils */ \"./node_modules/@walletconnect/utils/dist/index.es.js\");\n/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\n/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(events__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _walletconnect_time__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @walletconnect/time */ \"./node_modules/@walletconnect/time/dist/cjs/index.js\");\n/* harmony import */ var _walletconnect_time__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @walletconnect/jsonrpc-utils */ \"./node_modules/@walletconnect/jsonrpc-utils/dist/esm/index.js\");\nconst X=\"wc\",F=2,H=\"client\",G=`${X}@${F}:${H}:`,M={name:H,logger:\"error\",controller:!1,relayUrl:\"wss://relay.walletconnect.com\"},Ze={session_proposal:\"session_proposal\",session_update:\"session_update\",session_extend:\"session_extend\",session_ping:\"session_ping\",session_delete:\"session_delete\",session_expire:\"session_expire\",session_request:\"session_request\",session_request_sent:\"session_request_sent\",session_event:\"session_event\",proposal_expire:\"proposal_expire\"},es={database:\":memory:\"},W=\"WALLETCONNECT_DEEPLINK_CHOICE\",ss={created:\"history_created\",updated:\"history_updated\",deleted:\"history_deleted\",sync:\"history_sync\"},ts=\"history\",is=\"0.3\",ne=\"proposal\",rs=_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.THIRTY_DAYS,oe=\"Proposal expired\",ae=\"session\",A=_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.SEVEN_DAYS,ce=\"engine\",V={wc_sessionPropose:{req:{ttl:_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.ONE_DAY,prompt:!1,tag:1104},res:{ttl:_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.ONE_DAY,prompt:!1,tag:1106},res:{ttl:_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.ONE_DAY,prompt:!1,tag:1112},res:{ttl:_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.THIRTY_SECONDS,prompt:!1,tag:1115}}},U={min:_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.FIVE_MINUTES,max:_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.SEVEN_DAYS},I={idle:\"IDLE\",active:\"ACTIVE\"},le=\"request\",pe=[\"wc_sessionPropose\",\"wc_sessionRequest\",\"wc_authRequest\"];var ns=Object.defineProperty,os=Object.defineProperties,as=Object.getOwnPropertyDescriptors,he=Object.getOwnPropertySymbols,cs=Object.prototype.hasOwnProperty,ls=Object.prototype.propertyIsEnumerable,de=(m,r,e)=>r in m?ns(m,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):m[r]=e,g=(m,r)=>{for(var e in r||(r={}))cs.call(r,e)&&de(m,e,r[e]);if(he)for(var e of he(r))ls.call(r,e)&&de(m,e,r[e]);return m},b=(m,r)=>os(m,as(r));class ps extends _walletconnect_types__WEBPACK_IMPORTED_MODULE_4__.IEngine{constructor(r){super(r),this.name=ce,this.events=new (events__WEBPACK_IMPORTED_MODULE_1___default()),this.initialized=!1,this.ignoredPayloadTypes=[_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.TYPE_1],this.requestQueue={state:I.idle,queue:[]},this.sessionRequestQueue={state:I.idle,queue:[]},this.requestQueueDelay=_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(V)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},(0,_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.toMiliseconds)(this.requestQueueDelay)))},this.connect=async e=>{await this.isInitialized();const s=b(g({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(s);const{pairingTopic:t,requiredNamespaces:i,optionalNamespaces:n,sessionProperties:o,relays:a}=s;let c=t,p,d=!1;if(c&&(d=this.client.core.pairing.pairings.get(c).active),!c||!d){const{topic:v,uri:S}=await this.client.core.pairing.create();c=v,p=S}const h=await this.client.core.crypto.generateKeyPair(),R=g({requiredNamespaces:i,optionalNamespaces:n,relays:a??[{protocol:_walletconnect_core__WEBPACK_IMPORTED_MODULE_6__.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:h,metadata:this.client.metadata}},o&&{sessionProperties:o}),{reject:w,resolve:T,done:K}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.createDelayedPromise)(_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.FIVE_MINUTES,oe);if(this.events.once((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.engineEvent)(\"session_connect\"),async({error:v,session:S})=>{if(v)w(v);else if(S){S.self.publicKey=h;const B=b(g({},S),{requiredNamespaces:S.requiredNamespaces,optionalNamespaces:S.optionalNamespaces});await this.client.session.set(S.topic,B),await this.setExpiry(S.topic,S.expiry),c&&await this.client.core.pairing.updateMetadata({topic:c,metadata:S.peer.metadata}),T(B)}}),!c){const{message:v}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"NO_MATCHING_KEY\",`connect() pairing topic: ${c}`);throw new Error(v)}const L=await this.sendRequest({topic:c,method:\"wc_sessionPropose\",params:R}),ue=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.calcExpiry)(_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.FIVE_MINUTES);return await this.setProposal(L,g({id:L,expiry:ue},R)),{uri:p,approval:K}},this.pair=async e=>(await this.isInitialized(),await this.client.core.pairing.pair(e)),this.approve=async e=>{await this.isInitialized(),await this.isValidApprove(e);const{id:s,relayProtocol:t,namespaces:i,sessionProperties:n}=e,o=this.client.proposal.get(s);let{pairingTopic:a,proposer:c,requiredNamespaces:p,optionalNamespaces:d}=o;a=a||\"\",(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidObject)(p)||(p=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getRequiredNamespacesFromNamespaces)(i,\"approve()\"));const h=await this.client.core.crypto.generateKeyPair(),R=c.publicKey,w=await this.client.core.crypto.generateSharedKey(h,R);a&&s&&(await this.client.core.pairing.updateMetadata({topic:a,metadata:c.metadata}),await this.sendResult({id:s,topic:a,result:{relay:{protocol:t??\"irn\"},responderPublicKey:h}}),await this.client.proposal.delete(s,(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getSdkError)(\"USER_DISCONNECTED\")),await this.client.core.pairing.activate({topic:a}));const T=g({relay:{protocol:t??\"irn\"},namespaces:i,requiredNamespaces:p,optionalNamespaces:d,pairingTopic:a,controller:{publicKey:h,metadata:this.client.metadata},expiry:(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.calcExpiry)(A)},n&&{sessionProperties:n});await this.client.core.relayer.subscribe(w),await this.sendRequest({topic:w,method:\"wc_sessionSettle\",params:T,throwOnFailedPublish:!0});const K=b(g({},T),{topic:w,pairingTopic:a,acknowledged:!1,self:T.controller,peer:{publicKey:c.publicKey,metadata:c.metadata},controller:h});return await this.client.session.set(w,K),await this.setExpiry(w,(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.calcExpiry)(A)),{topic:w,acknowledged:()=>new Promise(L=>setTimeout(()=>L(this.client.session.get(w)),500))}},this.reject=async e=>{await this.isInitialized(),await this.isValidReject(e);const{id:s,reason:t}=e,{pairingTopic:i}=this.client.proposal.get(s);i&&(await this.sendError(s,i,t),await this.client.proposal.delete(s,(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getSdkError)(\"USER_DISCONNECTED\")))},this.update=async e=>{await this.isInitialized(),await this.isValidUpdate(e);const{topic:s,namespaces:t}=e,i=await this.sendRequest({topic:s,method:\"wc_sessionUpdate\",params:{namespaces:t}}),{done:n,resolve:o,reject:a}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.createDelayedPromise)();return this.events.once((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.engineEvent)(\"session_update\",i),({error:c})=>{c?a(c):o()}),await this.client.session.update(s,{namespaces:t}),{acknowledged:n}},this.extend=async e=>{await this.isInitialized(),await this.isValidExtend(e);const{topic:s}=e,t=await this.sendRequest({topic:s,method:\"wc_sessionExtend\",params:{}}),{done:i,resolve:n,reject:o}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.createDelayedPromise)();return this.events.once((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.engineEvent)(\"session_extend\",t),({error:a})=>{a?o(a):n()}),await this.setExpiry(s,(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.calcExpiry)(A)),{acknowledged:i}},this.request=async e=>{await this.isInitialized(),await this.isValidRequest(e);const{chainId:s,request:t,topic:i,expiry:n}=e,o=(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__.payloadId)(),{done:a,resolve:c,reject:p}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.createDelayedPromise)(n,\"Request expired. Please try again.\");return this.events.once((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.engineEvent)(\"session_request\",o),({error:d,result:h})=>{d?p(d):c(h)}),await Promise.all([new Promise(async d=>{await this.sendRequest({clientRpcId:o,topic:i,method:\"wc_sessionRequest\",params:{request:t,chainId:s},expiry:n,throwOnFailedPublish:!0}).catch(h=>p(h)),this.client.events.emit(\"session_request_sent\",{topic:i,request:t,chainId:s,id:o}),d()}),new Promise(async d=>{const h=await this.client.core.storage.getItem(W);(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.handleDeeplinkRedirect)({id:o,topic:i,wcDeepLink:h}),d()}),a()]).then(d=>d[2])},this.respond=async e=>{await this.isInitialized(),await this.isValidRespond(e);const{topic:s,response:t}=e,{id:i}=t;(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__.isJsonRpcResult)(t)?await this.sendResult({id:i,topic:s,result:t.result,throwOnFailedPublish:!0}):(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__.isJsonRpcError)(t)&&await this.sendError(i,s,t.error),this.cleanupAfterResponse(e)},this.ping=async e=>{await this.isInitialized(),await this.isValidPing(e);const{topic:s}=e;if(this.client.session.keys.includes(s)){const t=await this.sendRequest({topic:s,method:\"wc_sessionPing\",params:{}}),{done:i,resolve:n,reject:o}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.createDelayedPromise)();this.events.once((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.engineEvent)(\"session_ping\",t),({error:a})=>{a?o(a):n()}),await i()}else this.client.core.pairing.pairings.keys.includes(s)&&await this.client.core.pairing.ping({topic:s})},this.emit=async e=>{await this.isInitialized(),await this.isValidEmit(e);const{topic:s,event:t,chainId:i}=e;await this.sendRequest({topic:s,method:\"wc_sessionEvent\",params:{event:t,chainId:i}})},this.disconnect=async e=>{await this.isInitialized(),await this.isValidDisconnect(e);const{topic:s}=e;this.client.session.keys.includes(s)?(await this.sendRequest({topic:s,method:\"wc_sessionDelete\",params:(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getSdkError)(\"USER_DISCONNECTED\"),throwOnFailedPublish:!0}),await this.deleteSession(s)):await this.client.core.pairing.disconnect({topic:s})},this.find=e=>(this.isInitialized(),this.client.session.getAll().filter(s=>(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isSessionCompatible)(s,e))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.cleanupDuplicatePairings=async e=>{if(e.pairingTopic)try{const s=this.client.core.pairing.pairings.get(e.pairingTopic),t=this.client.core.pairing.pairings.getAll().filter(i=>{var n,o;return((n=i.peerMetadata)==null?void 0:n.url)&&((o=i.peerMetadata)==null?void 0:o.url)===e.peer.metadata.url&&i.topic&&i.topic!==s.topic});if(t.length===0)return;this.client.logger.info(`Cleaning up ${t.length} duplicate pairing(s)`),await Promise.all(t.map(i=>this.client.core.pairing.disconnect({topic:i.topic}))),this.client.logger.info(\"Duplicate pairings clean up finished\")}catch(s){this.client.logger.error(s)}},this.deleteSession=async(e,s)=>{const{self:t}=this.client.session.get(e);await this.client.core.relayer.unsubscribe(e),this.client.session.delete(e,(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getSdkError)(\"USER_DISCONNECTED\")),this.client.core.crypto.keychain.has(t.publicKey)&&await this.client.core.crypto.deleteKeyPair(t.publicKey),this.client.core.crypto.keychain.has(e)&&await this.client.core.crypto.deleteSymKey(e),s||this.client.core.expirer.del(e),this.client.core.storage.removeItem(W).catch(i=>this.client.logger.warn(i))},this.deleteProposal=async(e,s)=>{await Promise.all([this.client.proposal.delete(e,(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getSdkError)(\"USER_DISCONNECTED\")),s?Promise.resolve():this.client.core.expirer.del(e)])},this.deletePendingSessionRequest=async(e,s,t=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,s),t?Promise.resolve():this.client.core.expirer.del(e)]),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(i=>i.id!==e),t&&(this.sessionRequestQueue.state=I.idle)},this.setExpiry=async(e,s)=>{this.client.session.keys.includes(e)&&await this.client.session.update(e,{expiry:s}),this.client.core.expirer.set(e,s)},this.setProposal=async(e,s)=>{await this.client.proposal.set(e,s),this.client.core.expirer.set(e,s.expiry)},this.setPendingSessionRequest=async e=>{const s=V.wc_sessionRequest.req.ttl,{id:t,topic:i,params:n,verifyContext:o}=e;await this.client.pendingRequest.set(t,{id:t,topic:i,params:n,verifyContext:o}),s&&this.client.core.expirer.set(t,(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.calcExpiry)(s))},this.sendRequest=async e=>{const{topic:s,method:t,params:i,expiry:n,relayRpcId:o,clientRpcId:a,throwOnFailedPublish:c}=e,p=(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__.formatJsonRpcRequest)(t,i,a);if((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isBrowser)()&&pe.includes(t)){const R=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.hashMessage)(JSON.stringify(p));this.client.core.verify.register({attestationId:R})}const d=await this.client.core.crypto.encode(s,p),h=V[t].req;return n&&(h.ttl=n),o&&(h.id=o),this.client.core.history.set(s,p),c?(h.internal=b(g({},h.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(s,d,h)):this.client.core.relayer.publish(s,d,h).catch(R=>this.client.logger.error(R)),p.id},this.sendResult=async e=>{const{id:s,topic:t,result:i,throwOnFailedPublish:n}=e,o=(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__.formatJsonRpcResult)(s,i),a=await this.client.core.crypto.encode(t,o),c=await this.client.core.history.get(t,s),p=V[c.request.method].res;n?(p.internal=b(g({},p.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(t,a,p)):this.client.core.relayer.publish(t,a,p).catch(d=>this.client.logger.error(d)),await this.client.core.history.resolve(o)},this.sendError=async(e,s,t)=>{const i=(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__.formatJsonRpcError)(e,t),n=await this.client.core.crypto.encode(s,i),o=await this.client.core.history.get(s,e),a=V[o.request.method].res;this.client.core.relayer.publish(s,n,a),await this.client.core.history.resolve(i)},this.cleanup=async()=>{const e=[],s=[];this.client.session.getAll().forEach(t=>{(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isExpired)(t.expiry)&&e.push(t.topic)}),this.client.proposal.getAll().forEach(t=>{(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isExpired)(t.expiry)&&s.push(t.id)}),await Promise.all([...e.map(t=>this.deleteSession(t)),...s.map(t=>this.deleteProposal(t))])},this.onRelayEventRequest=async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===I.active){this.client.logger.info(\"Request queue already active, skipping...\");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=I.active;const e=this.requestQueue.queue.shift();if(e)try{this.processRequest(e),await new Promise(s=>setTimeout(s,300))}catch(s){this.client.logger.warn(s)}}this.requestQueue.state=I.idle},this.processRequest=e=>{const{topic:s,payload:t}=e,i=t.method;switch(i){case\"wc_sessionPropose\":return this.onSessionProposeRequest(s,t);case\"wc_sessionSettle\":return this.onSessionSettleRequest(s,t);case\"wc_sessionUpdate\":return this.onSessionUpdateRequest(s,t);case\"wc_sessionExtend\":return this.onSessionExtendRequest(s,t);case\"wc_sessionPing\":return this.onSessionPingRequest(s,t);case\"wc_sessionDelete\":return this.onSessionDeleteRequest(s,t);case\"wc_sessionRequest\":return this.onSessionRequest(s,t);case\"wc_sessionEvent\":return this.onSessionEventRequest(s,t);default:return this.client.logger.info(`Unsupported request method ${i}`)}},this.onRelayEventResponse=async e=>{const{topic:s,payload:t}=e,i=(await this.client.core.history.get(s,t.id)).request.method;switch(i){case\"wc_sessionPropose\":return this.onSessionProposeResponse(s,t);case\"wc_sessionSettle\":return this.onSessionSettleResponse(s,t);case\"wc_sessionUpdate\":return this.onSessionUpdateResponse(s,t);case\"wc_sessionExtend\":return this.onSessionExtendResponse(s,t);case\"wc_sessionPing\":return this.onSessionPingResponse(s,t);case\"wc_sessionRequest\":return this.onSessionRequestResponse(s,t);default:return this.client.logger.info(`Unsupported response method ${i}`)}},this.onRelayEventUnknownPayload=e=>{const{topic:s}=e,{message:t}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`Decoded payload on topic ${s} is not identifiable as a JSON-RPC request or a response.`);throw new Error(t)},this.onSessionProposeRequest=async(e,s)=>{const{params:t,id:i}=s;try{this.isValidConnect(g({},s.params));const n=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.calcExpiry)(_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.FIVE_MINUTES),o=g({id:i,pairingTopic:e,expiry:n},t);await this.setProposal(i,o);const a=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.hashMessage)(JSON.stringify(s)),c=await this.getVerifyContext(a,o.proposer.metadata);this.client.events.emit(\"session_proposal\",{id:i,params:o,verifyContext:c})}catch(n){await this.sendError(i,e,n),this.client.logger.error(n)}},this.onSessionProposeResponse=async(e,s)=>{const{id:t}=s;if((0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__.isJsonRpcResult)(s)){const{result:i}=s;this.client.logger.trace({type:\"method\",method:\"onSessionProposeResponse\",result:i});const n=this.client.proposal.get(t);this.client.logger.trace({type:\"method\",method:\"onSessionProposeResponse\",proposal:n});const o=n.proposer.publicKey;this.client.logger.trace({type:\"method\",method:\"onSessionProposeResponse\",selfPublicKey:o});const a=i.responderPublicKey;this.client.logger.trace({type:\"method\",method:\"onSessionProposeResponse\",peerPublicKey:a});const c=await this.client.core.crypto.generateSharedKey(o,a);this.client.logger.trace({type:\"method\",method:\"onSessionProposeResponse\",sessionTopic:c});const p=await this.client.core.relayer.subscribe(c);this.client.logger.trace({type:\"method\",method:\"onSessionProposeResponse\",subscriptionId:p}),await this.client.core.pairing.activate({topic:e})}else (0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__.isJsonRpcError)(s)&&(await this.client.proposal.delete(t,(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getSdkError)(\"USER_DISCONNECTED\")),this.events.emit((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.engineEvent)(\"session_connect\"),{error:s.error}))},this.onSessionSettleRequest=async(e,s)=>{const{id:t,params:i}=s;try{this.isValidSessionSettleRequest(i);const{relay:n,controller:o,expiry:a,namespaces:c,requiredNamespaces:p,optionalNamespaces:d,sessionProperties:h,pairingTopic:R}=s.params,w=g({topic:e,relay:n,expiry:a,namespaces:c,acknowledged:!0,pairingTopic:R,requiredNamespaces:p,optionalNamespaces:d,controller:o.publicKey,self:{publicKey:\"\",metadata:this.client.metadata},peer:{publicKey:o.publicKey,metadata:o.metadata}},h&&{sessionProperties:h});await this.sendResult({id:s.id,topic:e,result:!0}),this.events.emit((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.engineEvent)(\"session_connect\"),{session:w}),this.cleanupDuplicatePairings(w)}catch(n){await this.sendError(t,e,n),this.client.logger.error(n)}},this.onSessionSettleResponse=async(e,s)=>{const{id:t}=s;(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__.isJsonRpcResult)(s)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.engineEvent)(\"session_approve\",t),{})):(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__.isJsonRpcError)(s)&&(await this.client.session.delete(e,(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getSdkError)(\"USER_DISCONNECTED\")),this.events.emit((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.engineEvent)(\"session_approve\",t),{error:s.error}))},this.onSessionUpdateRequest=async(e,s)=>{const{params:t,id:i}=s;try{const n=`${e}_session_update`,o=_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.MemoryStore.get(n);if(o&&this.isRequestOutOfSync(o,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidUpdate(g({topic:e},t)),await this.client.session.update(e,{namespaces:t.namespaces}),await this.sendResult({id:i,topic:e,result:!0}),this.client.events.emit(\"session_update\",{id:i,topic:e,params:t}),_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.MemoryStore.set(n,i)}catch(n){await this.sendError(i,e,n),this.client.logger.error(n)}},this.isRequestOutOfSync=(e,s)=>parseInt(s.toString().slice(0,-3))<=parseInt(e.toString().slice(0,-3)),this.onSessionUpdateResponse=(e,s)=>{const{id:t}=s;(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__.isJsonRpcResult)(s)?this.events.emit((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.engineEvent)(\"session_update\",t),{}):(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__.isJsonRpcError)(s)&&this.events.emit((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.engineEvent)(\"session_update\",t),{error:s.error})},this.onSessionExtendRequest=async(e,s)=>{const{id:t}=s;try{this.isValidExtend({topic:e}),await this.setExpiry(e,(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.calcExpiry)(A)),await this.sendResult({id:t,topic:e,result:!0}),this.client.events.emit(\"session_extend\",{id:t,topic:e})}catch(i){await this.sendError(t,e,i),this.client.logger.error(i)}},this.onSessionExtendResponse=(e,s)=>{const{id:t}=s;(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__.isJsonRpcResult)(s)?this.events.emit((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.engineEvent)(\"session_extend\",t),{}):(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__.isJsonRpcError)(s)&&this.events.emit((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.engineEvent)(\"session_extend\",t),{error:s.error})},this.onSessionPingRequest=async(e,s)=>{const{id:t}=s;try{this.isValidPing({topic:e}),await this.sendResult({id:t,topic:e,result:!0}),this.client.events.emit(\"session_ping\",{id:t,topic:e})}catch(i){await this.sendError(t,e,i),this.client.logger.error(i)}},this.onSessionPingResponse=(e,s)=>{const{id:t}=s;setTimeout(()=>{(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__.isJsonRpcResult)(s)?this.events.emit((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.engineEvent)(\"session_ping\",t),{}):(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__.isJsonRpcError)(s)&&this.events.emit((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.engineEvent)(\"session_ping\",t),{error:s.error})},500)},this.onSessionDeleteRequest=async(e,s)=>{const{id:t}=s;try{this.isValidDisconnect({topic:e,reason:s.params}),await Promise.all([new Promise(i=>{this.client.core.relayer.once(_walletconnect_core__WEBPACK_IMPORTED_MODULE_6__.RELAYER_EVENTS.publish,async()=>{i(await this.deleteSession(e))})}),this.sendResult({id:t,topic:e,result:!0})]),this.client.events.emit(\"session_delete\",{id:t,topic:e})}catch(i){this.client.logger.error(i)}},this.onSessionRequest=async(e,s)=>{const{id:t,params:i}=s;try{this.isValidRequest(g({topic:e},i));const n=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.hashMessage)(JSON.stringify((0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__.formatJsonRpcRequest)(\"wc_sessionRequest\",i,t))),o=this.client.session.get(e),a=await this.getVerifyContext(n,o.peer.metadata),c={id:t,topic:e,params:i,verifyContext:a};await this.setPendingSessionRequest(c),this.addSessionRequestToSessionRequestQueue(c),this.processSessionRequestQueue()}catch(n){await this.sendError(t,e,n),this.client.logger.error(n)}},this.onSessionRequestResponse=(e,s)=>{const{id:t}=s;(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__.isJsonRpcResult)(s)?this.events.emit((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.engineEvent)(\"session_request\",t),{result:s.result}):(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__.isJsonRpcError)(s)&&this.events.emit((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.engineEvent)(\"session_request\",t),{error:s.error})},this.onSessionEventRequest=async(e,s)=>{const{id:t,params:i}=s;try{const n=`${e}_session_event_${i.event.name}`,o=_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.MemoryStore.get(n);if(o&&this.isRequestOutOfSync(o,t)){this.client.logger.info(`Discarding out of sync request - ${t}`);return}this.isValidEmit(g({topic:e},i)),this.client.events.emit(\"session_event\",{id:t,topic:e,params:i}),_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.MemoryStore.set(n,t)}catch(n){await this.sendError(t,e,n),this.client.logger.error(n)}},this.addSessionRequestToSessionRequestQueue=e=>{this.sessionRequestQueue.queue.push(e)},this.cleanupAfterResponse=e=>{this.deletePendingSessionRequest(e.response.id,{message:\"fulfilled\",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=I.idle,this.processSessionRequestQueue()},(0,_walletconnect_time__WEBPACK_IMPORTED_MODULE_2__.toMiliseconds)(this.requestQueueDelay))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===I.active){this.client.logger.info(\"session request queue is already active.\");return}const e=this.sessionRequestQueue.queue[0];if(!e){this.client.logger.info(\"session request queue is empty.\");return}try{this.sessionRequestQueue.state=I.active,this.client.events.emit(\"session_request\",e)}catch(s){this.client.logger.error(s)}},this.onPairingCreated=e=>{if(e.active)return;const s=this.client.proposal.getAll().find(t=>t.pairingTopic===e.topic);s&&this.onSessionProposeRequest(e.topic,(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__.formatJsonRpcRequest)(\"wc_sessionPropose\",{requiredNamespaces:s.requiredNamespaces,optionalNamespaces:s.optionalNamespaces,relays:s.relays,proposer:s.proposer},s.id))},this.isValidConnect=async e=>{if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidParams)(e)){const{message:a}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`connect() params: ${JSON.stringify(e)}`);throw new Error(a)}const{pairingTopic:s,requiredNamespaces:t,optionalNamespaces:i,sessionProperties:n,relays:o}=e;if((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isUndefined)(s)||await this.isValidPairingTopic(s),!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidRelays)(o,!0)){const{message:a}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`connect() relays: ${o}`);throw new Error(a)}!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isUndefined)(t)&&(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidObject)(t)!==0&&this.validateNamespaces(t,\"requiredNamespaces\"),!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isUndefined)(i)&&(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidObject)(i)!==0&&this.validateNamespaces(i,\"optionalNamespaces\"),(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isUndefined)(n)||this.validateSessionProps(n,\"sessionProperties\")},this.validateNamespaces=(e,s)=>{const t=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidRequiredNamespaces)(e,\"connect()\",s);if(t)throw new Error(t.message)},this.isValidApprove=async e=>{if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidParams)(e))throw new Error((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`approve() params: ${e}`).message);const{id:s,namespaces:t,relayProtocol:i,sessionProperties:n}=e;await this.isValidProposalId(s);const o=this.client.proposal.get(s),a=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidNamespaces)(t,\"approve()\");if(a)throw new Error(a.message);const c=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isConformingNamespaces)(o.requiredNamespaces,t,\"approve()\");if(c)throw new Error(c.message);if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidString)(i,!0)){const{message:p}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`approve() relayProtocol: ${i}`);throw new Error(p)}(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isUndefined)(n)||this.validateSessionProps(n,\"sessionProperties\")},this.isValidReject=async e=>{if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidParams)(e)){const{message:i}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`reject() params: ${e}`);throw new Error(i)}const{id:s,reason:t}=e;if(await this.isValidProposalId(s),!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidErrorReason)(t)){const{message:i}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`reject() reason: ${JSON.stringify(t)}`);throw new Error(i)}},this.isValidSessionSettleRequest=e=>{if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidParams)(e)){const{message:c}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`onSessionSettleRequest() params: ${e}`);throw new Error(c)}const{relay:s,controller:t,namespaces:i,expiry:n}=e;if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidRelay)(s)){const{message:c}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",\"onSessionSettleRequest() relay protocol should be a string\");throw new Error(c)}const o=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidController)(t,\"onSessionSettleRequest()\");if(o)throw new Error(o.message);const a=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidNamespaces)(i,\"onSessionSettleRequest()\");if(a)throw new Error(a.message);if((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isExpired)(n)){const{message:c}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"EXPIRED\",\"onSessionSettleRequest()\");throw new Error(c)}},this.isValidUpdate=async e=>{if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidParams)(e)){const{message:a}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`update() params: ${e}`);throw new Error(a)}const{topic:s,namespaces:t}=e;await this.isValidSessionTopic(s);const i=this.client.session.get(s),n=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidNamespaces)(t,\"update()\");if(n)throw new Error(n.message);const o=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isConformingNamespaces)(i.requiredNamespaces,t,\"update()\");if(o)throw new Error(o.message)},this.isValidExtend=async e=>{if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidParams)(e)){const{message:t}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`extend() params: ${e}`);throw new Error(t)}const{topic:s}=e;await this.isValidSessionTopic(s)},this.isValidRequest=async e=>{if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidParams)(e)){const{message:a}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`request() params: ${e}`);throw new Error(a)}const{topic:s,request:t,chainId:i,expiry:n}=e;await this.isValidSessionTopic(s);const{namespaces:o}=this.client.session.get(s);if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidNamespacesChainId)(o,i)){const{message:a}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`request() chainId: ${i}`);throw new Error(a)}if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidRequest)(t)){const{message:a}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`request() ${JSON.stringify(t)}`);throw new Error(a)}if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidNamespacesRequest)(o,i,t.method)){const{message:a}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`request() method: ${t.method}`);throw new Error(a)}if(n&&!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidRequestExpiry)(n,U)){const{message:a}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`request() expiry: ${n}. Expiry must be a number (in seconds) between ${U.min} and ${U.max}`);throw new Error(a)}},this.isValidRespond=async e=>{if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidParams)(e)){const{message:i}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`respond() params: ${e}`);throw new Error(i)}const{topic:s,response:t}=e;if(await this.isValidSessionTopic(s),!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidResponse)(t)){const{message:i}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`respond() response: ${JSON.stringify(t)}`);throw new Error(i)}},this.isValidPing=async e=>{if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidParams)(e)){const{message:t}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`ping() params: ${e}`);throw new Error(t)}const{topic:s}=e;await this.isValidSessionOrPairingTopic(s)},this.isValidEmit=async e=>{if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidParams)(e)){const{message:o}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`emit() params: ${e}`);throw new Error(o)}const{topic:s,event:t,chainId:i}=e;await this.isValidSessionTopic(s);const{namespaces:n}=this.client.session.get(s);if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidNamespacesChainId)(n,i)){const{message:o}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`emit() chainId: ${i}`);throw new Error(o)}if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidEvent)(t)){const{message:o}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`emit() event: ${JSON.stringify(t)}`);throw new Error(o)}if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidNamespacesEvent)(n,i,t.name)){const{message:o}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`emit() event: ${JSON.stringify(t)}`);throw new Error(o)}},this.isValidDisconnect=async e=>{if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidParams)(e)){const{message:t}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`disconnect() params: ${e}`);throw new Error(t)}const{topic:s}=e;await this.isValidSessionOrPairingTopic(s)},this.getVerifyContext=async(e,s)=>{const t={verified:{verifyUrl:s.verifyUrl||_walletconnect_core__WEBPACK_IMPORTED_MODULE_6__.VERIFY_SERVER,validation:\"UNKNOWN\",origin:s.url||\"\"}};try{const i=await this.client.core.verify.resolve({attestationId:e,verifyUrl:s.verifyUrl});i&&(t.verified.origin=i.origin,t.verified.isScam=i.isScam,t.verified.validation=i.origin===new URL(s.url).origin?\"VALID\":\"INVALID\")}catch(i){this.client.logger.info(i)}return this.client.logger.info(`Verify context: ${JSON.stringify(t)}`),t},this.validateSessionProps=(e,s)=>{Object.values(e).forEach(t=>{if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidString)(t,!1)){const{message:i}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`${s} must be in Record format. Received: ${JSON.stringify(t)}`);throw new Error(i)}})}}async isInitialized(){if(!this.initialized){const{message:r}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"NOT_INITIALIZED\",this.name);throw new Error(r)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(_walletconnect_core__WEBPACK_IMPORTED_MODULE_6__.RELAYER_EVENTS.message,async r=>{const{topic:e,message:s}=r;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(s)))return;const t=await this.client.core.crypto.decode(e,s);try{(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__.isJsonRpcRequest)(t)?(this.client.core.history.set(e,t),this.onRelayEventRequest({topic:e,payload:t})):(0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__.isJsonRpcResponse)(t)?(await this.client.core.history.resolve(t),await this.onRelayEventResponse({topic:e,payload:t}),this.client.core.history.delete(e,t.id)):this.onRelayEventUnknownPayload({topic:e,payload:t})}catch(i){this.client.logger.error(i)}})}registerExpirerEvents(){this.client.core.expirer.on(_walletconnect_core__WEBPACK_IMPORTED_MODULE_6__.EXPIRER_EVENTS.expired,async r=>{const{topic:e,id:s}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.parseExpirerTarget)(r.target);if(s&&this.client.pendingRequest.keys.includes(s))return await this.deletePendingSessionRequest(s,(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"EXPIRED\"),!0);e?this.client.session.keys.includes(e)&&(await this.deleteSession(e,!0),this.client.events.emit(\"session_expire\",{topic:e})):s&&(await this.deleteProposal(s,!0),this.client.events.emit(\"proposal_expire\",{id:s}))})}registerPairingEvents(){this.client.core.pairing.events.on(_walletconnect_core__WEBPACK_IMPORTED_MODULE_6__.PAIRING_EVENTS.create,r=>this.onPairingCreated(r))}isValidPairingTopic(r){if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidString)(r,!1)){const{message:e}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`pairing topic should be a string: ${r}`);throw new Error(e)}if(!this.client.core.pairing.pairings.keys.includes(r)){const{message:e}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"NO_MATCHING_KEY\",`pairing topic doesn't exist: ${r}`);throw new Error(e)}if((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isExpired)(this.client.core.pairing.pairings.get(r).expiry)){const{message:e}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"EXPIRED\",`pairing topic: ${r}`);throw new Error(e)}}async isValidSessionTopic(r){if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidString)(r,!1)){const{message:e}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`session topic should be a string: ${r}`);throw new Error(e)}if(!this.client.session.keys.includes(r)){const{message:e}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"NO_MATCHING_KEY\",`session topic doesn't exist: ${r}`);throw new Error(e)}if((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isExpired)(this.client.session.get(r).expiry)){await this.deleteSession(r);const{message:e}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"EXPIRED\",`session topic: ${r}`);throw new Error(e)}}async isValidSessionOrPairingTopic(r){if(this.client.session.keys.includes(r))await this.isValidSessionTopic(r);else if(this.client.core.pairing.pairings.keys.includes(r))this.isValidPairingTopic(r);else if((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidString)(r,!1)){const{message:e}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"NO_MATCHING_KEY\",`session or pairing topic doesn't exist: ${r}`);throw new Error(e)}else{const{message:e}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`session or pairing topic should be a string: ${r}`);throw new Error(e)}}async isValidProposalId(r){if(!(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isValidId)(r)){const{message:e}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"MISSING_OR_INVALID\",`proposal id should be a number: ${r}`);throw new Error(e)}if(!this.client.proposal.keys.includes(r)){const{message:e}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"NO_MATCHING_KEY\",`proposal id doesn't exist: ${r}`);throw new Error(e)}if((0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.isExpired)(this.client.proposal.get(r).expiry)){await this.deleteProposal(r);const{message:e}=(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getInternalError)(\"EXPIRED\",`proposal id: ${r}`);throw new Error(e)}}}class hs extends _walletconnect_core__WEBPACK_IMPORTED_MODULE_6__.Store{constructor(r,e){super(r,e,ne,G),this.core=r,this.logger=e}}class ds extends _walletconnect_core__WEBPACK_IMPORTED_MODULE_6__.Store{constructor(r,e){super(r,e,ae,G),this.core=r,this.logger=e}}class us extends _walletconnect_core__WEBPACK_IMPORTED_MODULE_6__.Store{constructor(r,e){super(r,e,le,G,s=>s.id),this.core=r,this.logger=e}}class Q extends _walletconnect_types__WEBPACK_IMPORTED_MODULE_4__.ISignClient{constructor(r){super(r),this.protocol=X,this.version=F,this.name=M.name,this.events=new events__WEBPACK_IMPORTED_MODULE_1__.EventEmitter,this.on=(s,t)=>this.events.on(s,t),this.once=(s,t)=>this.events.once(s,t),this.off=(s,t)=>this.events.off(s,t),this.removeListener=(s,t)=>this.events.removeListener(s,t),this.removeAllListeners=s=>this.events.removeAllListeners(s),this.connect=async s=>{try{return await this.engine.connect(s)}catch(t){throw this.logger.error(t.message),t}},this.pair=async s=>{try{return await this.engine.pair(s)}catch(t){throw this.logger.error(t.message),t}},this.approve=async s=>{try{return await this.engine.approve(s)}catch(t){throw this.logger.error(t.message),t}},this.reject=async s=>{try{return await this.engine.reject(s)}catch(t){throw this.logger.error(t.message),t}},this.update=async s=>{try{return await this.engine.update(s)}catch(t){throw this.logger.error(t.message),t}},this.extend=async s=>{try{return await this.engine.extend(s)}catch(t){throw this.logger.error(t.message),t}},this.request=async s=>{try{return await this.engine.request(s)}catch(t){throw this.logger.error(t.message),t}},this.respond=async s=>{try{return await this.engine.respond(s)}catch(t){throw this.logger.error(t.message),t}},this.ping=async s=>{try{return await this.engine.ping(s)}catch(t){throw this.logger.error(t.message),t}},this.emit=async s=>{try{return await this.engine.emit(s)}catch(t){throw this.logger.error(t.message),t}},this.disconnect=async s=>{try{return await this.engine.disconnect(s)}catch(t){throw this.logger.error(t.message),t}},this.find=s=>{try{return this.engine.find(s)}catch(t){throw this.logger.error(t.message),t}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(s){throw this.logger.error(s.message),s}},this.name=r?.name||M.name,this.metadata=r?.metadata||(0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_5__.getAppMetadata)();const e=typeof r?.logger<\"u\"&&typeof r?.logger!=\"string\"?r.logger:(0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_0__.pino)((0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_0__.getDefaultLoggerOptions)({level:r?.logger||M.logger}));this.core=r?.core||new _walletconnect_core__WEBPACK_IMPORTED_MODULE_6__.Core(r),this.logger=(0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_0__.generateChildLogger)(e,this.name),this.session=new ds(this.core,this.logger),this.proposal=new hs(this.core,this.logger),this.pendingRequest=new us(this.core,this.logger),this.engine=new ps(this)}static async init(r){const e=new Q(r);return await e.initialize(),e}get context(){return (0,_walletconnect_logger__WEBPACK_IMPORTED_MODULE_0__.getLoggerContext)(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace(\"Initialized\");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info(\"SignClient Initialization Success\")}catch(r){throw this.logger.info(\"SignClient Initialization Failure\"),this.logger.error(r.message),r}}}const gs=Q;\n//# sourceMappingURL=index.es.js.map\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/sign-client/dist/index.es.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/time/dist/cjs/constants/index.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@walletconnect/time/dist/cjs/constants/index.js ***! - \**********************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.js\");\ntslib_1.__exportStar(__webpack_require__(/*! ./misc */ \"./node_modules/@walletconnect/time/dist/cjs/constants/misc.js\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./time */ \"./node_modules/@walletconnect/time/dist/cjs/constants/time.js\"), exports);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/time/dist/cjs/constants/index.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/time/dist/cjs/constants/misc.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@walletconnect/time/dist/cjs/constants/misc.js ***! - \*********************************************************************/ -/***/ ((__unused_webpack_module, exports) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.ONE_THOUSAND = exports.ONE_HUNDRED = void 0;\nexports.ONE_HUNDRED = 100;\nexports.ONE_THOUSAND = 1000;\n//# sourceMappingURL=misc.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/time/dist/cjs/constants/misc.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/time/dist/cjs/constants/time.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@walletconnect/time/dist/cjs/constants/time.js ***! - \*********************************************************************/ -/***/ ((__unused_webpack_module, exports) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.ONE_YEAR = exports.FOUR_WEEKS = exports.THREE_WEEKS = exports.TWO_WEEKS = exports.ONE_WEEK = exports.THIRTY_DAYS = exports.SEVEN_DAYS = exports.FIVE_DAYS = exports.THREE_DAYS = exports.ONE_DAY = exports.TWENTY_FOUR_HOURS = exports.TWELVE_HOURS = exports.SIX_HOURS = exports.THREE_HOURS = exports.ONE_HOUR = exports.SIXTY_MINUTES = exports.THIRTY_MINUTES = exports.TEN_MINUTES = exports.FIVE_MINUTES = exports.ONE_MINUTE = exports.SIXTY_SECONDS = exports.THIRTY_SECONDS = exports.TEN_SECONDS = exports.FIVE_SECONDS = exports.ONE_SECOND = void 0;\nexports.ONE_SECOND = 1;\nexports.FIVE_SECONDS = 5;\nexports.TEN_SECONDS = 10;\nexports.THIRTY_SECONDS = 30;\nexports.SIXTY_SECONDS = 60;\nexports.ONE_MINUTE = exports.SIXTY_SECONDS;\nexports.FIVE_MINUTES = exports.ONE_MINUTE * 5;\nexports.TEN_MINUTES = exports.ONE_MINUTE * 10;\nexports.THIRTY_MINUTES = exports.ONE_MINUTE * 30;\nexports.SIXTY_MINUTES = exports.ONE_MINUTE * 60;\nexports.ONE_HOUR = exports.SIXTY_MINUTES;\nexports.THREE_HOURS = exports.ONE_HOUR * 3;\nexports.SIX_HOURS = exports.ONE_HOUR * 6;\nexports.TWELVE_HOURS = exports.ONE_HOUR * 12;\nexports.TWENTY_FOUR_HOURS = exports.ONE_HOUR * 24;\nexports.ONE_DAY = exports.TWENTY_FOUR_HOURS;\nexports.THREE_DAYS = exports.ONE_DAY * 3;\nexports.FIVE_DAYS = exports.ONE_DAY * 5;\nexports.SEVEN_DAYS = exports.ONE_DAY * 7;\nexports.THIRTY_DAYS = exports.ONE_DAY * 30;\nexports.ONE_WEEK = exports.SEVEN_DAYS;\nexports.TWO_WEEKS = exports.ONE_WEEK * 2;\nexports.THREE_WEEKS = exports.ONE_WEEK * 3;\nexports.FOUR_WEEKS = exports.ONE_WEEK * 4;\nexports.ONE_YEAR = exports.ONE_DAY * 365;\n//# sourceMappingURL=time.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/time/dist/cjs/constants/time.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/time/dist/cjs/index.js": -/*!************************************************************!*\ - !*** ./node_modules/@walletconnect/time/dist/cjs/index.js ***! - \************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.js\");\ntslib_1.__exportStar(__webpack_require__(/*! ./utils */ \"./node_modules/@walletconnect/time/dist/cjs/utils/index.js\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./watch */ \"./node_modules/@walletconnect/time/dist/cjs/watch.js\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./types */ \"./node_modules/@walletconnect/time/dist/cjs/types/index.js\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./constants */ \"./node_modules/@walletconnect/time/dist/cjs/constants/index.js\"), exports);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/time/dist/cjs/index.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/time/dist/cjs/types/index.js": -/*!******************************************************************!*\ - !*** ./node_modules/@walletconnect/time/dist/cjs/types/index.js ***! - \******************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.js\");\ntslib_1.__exportStar(__webpack_require__(/*! ./watch */ \"./node_modules/@walletconnect/time/dist/cjs/types/watch.js\"), exports);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/time/dist/cjs/types/index.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/time/dist/cjs/types/watch.js": -/*!******************************************************************!*\ - !*** ./node_modules/@walletconnect/time/dist/cjs/types/watch.js ***! - \******************************************************************/ -/***/ ((__unused_webpack_module, exports) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.IWatch = void 0;\nclass IWatch {\n}\nexports.IWatch = IWatch;\n//# sourceMappingURL=watch.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/time/dist/cjs/types/watch.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/time/dist/cjs/utils/convert.js": -/*!********************************************************************!*\ - !*** ./node_modules/@walletconnect/time/dist/cjs/utils/convert.js ***! - \********************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.fromMiliseconds = exports.toMiliseconds = void 0;\nconst constants_1 = __webpack_require__(/*! ../constants */ \"./node_modules/@walletconnect/time/dist/cjs/constants/index.js\");\nfunction toMiliseconds(seconds) {\n return seconds * constants_1.ONE_THOUSAND;\n}\nexports.toMiliseconds = toMiliseconds;\nfunction fromMiliseconds(miliseconds) {\n return Math.floor(miliseconds / constants_1.ONE_THOUSAND);\n}\nexports.fromMiliseconds = fromMiliseconds;\n//# sourceMappingURL=convert.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/time/dist/cjs/utils/convert.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/time/dist/cjs/utils/delay.js": -/*!******************************************************************!*\ - !*** ./node_modules/@walletconnect/time/dist/cjs/utils/delay.js ***! - \******************************************************************/ -/***/ ((__unused_webpack_module, exports) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.delay = void 0;\nfunction delay(timeout) {\n return new Promise(resolve => {\n setTimeout(() => {\n resolve(true);\n }, timeout);\n });\n}\nexports.delay = delay;\n//# sourceMappingURL=delay.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/time/dist/cjs/utils/delay.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/time/dist/cjs/utils/index.js": -/*!******************************************************************!*\ - !*** ./node_modules/@walletconnect/time/dist/cjs/utils/index.js ***! - \******************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst tslib_1 = __webpack_require__(/*! tslib */ \"./node_modules/tslib/tslib.es6.js\");\ntslib_1.__exportStar(__webpack_require__(/*! ./delay */ \"./node_modules/@walletconnect/time/dist/cjs/utils/delay.js\"), exports);\ntslib_1.__exportStar(__webpack_require__(/*! ./convert */ \"./node_modules/@walletconnect/time/dist/cjs/utils/convert.js\"), exports);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/time/dist/cjs/utils/index.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/time/dist/cjs/watch.js": -/*!************************************************************!*\ - !*** ./node_modules/@walletconnect/time/dist/cjs/watch.js ***! - \************************************************************/ -/***/ ((__unused_webpack_module, exports) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Watch = void 0;\nclass Watch {\n constructor() {\n this.timestamps = new Map();\n }\n start(label) {\n if (this.timestamps.has(label)) {\n throw new Error(`Watch already started for label: ${label}`);\n }\n this.timestamps.set(label, { started: Date.now() });\n }\n stop(label) {\n const timestamp = this.get(label);\n if (typeof timestamp.elapsed !== \"undefined\") {\n throw new Error(`Watch already stopped for label: ${label}`);\n }\n const elapsed = Date.now() - timestamp.started;\n this.timestamps.set(label, { started: timestamp.started, elapsed });\n }\n get(label) {\n const timestamp = this.timestamps.get(label);\n if (typeof timestamp === \"undefined\") {\n throw new Error(`No timestamp found for label: ${label}`);\n }\n return timestamp;\n }\n elapsed(label) {\n const timestamp = this.get(label);\n const elapsed = timestamp.elapsed || Date.now() - timestamp.started;\n return elapsed;\n }\n}\nexports.Watch = Watch;\nexports[\"default\"] = Watch;\n//# sourceMappingURL=watch.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/time/dist/cjs/watch.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/types/dist/index.es.js": -/*!************************************************************!*\ - !*** ./node_modules/@walletconnect/types/dist/index.es.js ***! - \************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ICore: () => (/* binding */ n),\n/* harmony export */ ICrypto: () => (/* binding */ l),\n/* harmony export */ IEngine: () => (/* binding */ S),\n/* harmony export */ IEngineEvents: () => (/* binding */ C),\n/* harmony export */ IExpirer: () => (/* binding */ E),\n/* harmony export */ IJsonRpcHistory: () => (/* binding */ h),\n/* harmony export */ IKeyChain: () => (/* binding */ x),\n/* harmony export */ IMessageTracker: () => (/* binding */ a),\n/* harmony export */ IPairing: () => (/* binding */ m),\n/* harmony export */ IPublisher: () => (/* binding */ u),\n/* harmony export */ IRelayer: () => (/* binding */ g),\n/* harmony export */ ISignClient: () => (/* binding */ b),\n/* harmony export */ ISignClientEvents: () => (/* binding */ v),\n/* harmony export */ IStore: () => (/* binding */ p),\n/* harmony export */ ISubscriber: () => (/* binding */ d),\n/* harmony export */ ISubscriberTopicMap: () => (/* binding */ I),\n/* harmony export */ IVerify: () => (/* binding */ y)\n/* harmony export */ });\n/* harmony import */ var _walletconnect_events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/events */ \"./node_modules/@walletconnect/events/dist/esm/index.js\");\n/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\n/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(events__WEBPACK_IMPORTED_MODULE_1__);\nclass n extends _walletconnect_events__WEBPACK_IMPORTED_MODULE_0__.IEvents{constructor(s){super(),this.opts=s,this.protocol=\"wc\",this.version=2}}class l{constructor(s,t,o){this.core=s,this.logger=t}}class h extends _walletconnect_events__WEBPACK_IMPORTED_MODULE_0__.IEvents{constructor(s,t){super(),this.core=s,this.logger=t,this.records=new Map}}class a{constructor(s,t){this.logger=s,this.core=t}}class u extends _walletconnect_events__WEBPACK_IMPORTED_MODULE_0__.IEvents{constructor(s,t){super(),this.relayer=s,this.logger=t}}class g extends _walletconnect_events__WEBPACK_IMPORTED_MODULE_0__.IEvents{constructor(s){super()}}class p{constructor(s,t,o,w){this.core=s,this.logger=t,this.name=o}}class I{constructor(){this.map=new Map}}class d extends _walletconnect_events__WEBPACK_IMPORTED_MODULE_0__.IEvents{constructor(s,t){super(),this.relayer=s,this.logger=t}}class x{constructor(s,t){this.core=s,this.logger=t}}class E extends _walletconnect_events__WEBPACK_IMPORTED_MODULE_0__.IEvents{constructor(s,t){super(),this.core=s,this.logger=t}}class m{constructor(s,t){this.logger=s,this.core=t}}class y{constructor(s,t){this.projectId=s,this.logger=t}}class v extends (events__WEBPACK_IMPORTED_MODULE_1___default()){constructor(){super()}}class b{constructor(s){this.opts=s,this.protocol=\"wc\",this.version=2}}class C extends events__WEBPACK_IMPORTED_MODULE_1__.EventEmitter{constructor(){super()}}class S{constructor(s){this.client=s}}\n//# sourceMappingURL=index.es.js.map\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/types/dist/index.es.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/utils/dist/index.es.js": -/*!************************************************************!*\ - !*** ./node_modules/@walletconnect/utils/dist/index.es.js ***! - \************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BASE10: () => (/* binding */ J),\n/* harmony export */ BASE16: () => (/* binding */ p),\n/* harmony export */ BASE64: () => (/* binding */ x),\n/* harmony export */ COLON: () => (/* binding */ Gn),\n/* harmony export */ DEFAULT_DEPTH: () => (/* binding */ ne),\n/* harmony export */ EMPTY_SPACE: () => (/* binding */ H),\n/* harmony export */ ENV_MAP: () => (/* binding */ m),\n/* harmony export */ MemoryStore: () => (/* binding */ er),\n/* harmony export */ ONE_THOUSAND: () => (/* binding */ Wn),\n/* harmony export */ REACT_NATIVE_PRODUCT: () => (/* binding */ Ce),\n/* harmony export */ RELAYER_DEFAULT_PROTOCOL: () => (/* binding */ Fe),\n/* harmony export */ SDK_TYPE: () => (/* binding */ je),\n/* harmony export */ SLASH: () => (/* binding */ $e),\n/* harmony export */ TYPE_0: () => (/* binding */ Q),\n/* harmony export */ TYPE_1: () => (/* binding */ _),\n/* harmony export */ UTF8: () => (/* binding */ F),\n/* harmony export */ appendToQueryString: () => (/* binding */ De),\n/* harmony export */ assertType: () => (/* binding */ Zn),\n/* harmony export */ buildApprovedNamespaces: () => (/* binding */ Ut),\n/* harmony export */ calcExpiry: () => (/* binding */ lt),\n/* harmony export */ capitalize: () => (/* binding */ ot),\n/* harmony export */ capitalizeWord: () => (/* binding */ xe),\n/* harmony export */ createDelayedPromise: () => (/* binding */ st),\n/* harmony export */ createExpiringPromise: () => (/* binding */ it),\n/* harmony export */ decodeTypeByte: () => (/* binding */ $),\n/* harmony export */ decrypt: () => (/* binding */ Ln),\n/* harmony export */ deriveSymKey: () => (/* binding */ kn),\n/* harmony export */ deserialize: () => (/* binding */ ee),\n/* harmony export */ encodeTypeByte: () => (/* binding */ Pe),\n/* harmony export */ encrypt: () => (/* binding */ Kn),\n/* harmony export */ engineEvent: () => (/* binding */ ft),\n/* harmony export */ enumify: () => (/* binding */ rt),\n/* harmony export */ formatAccountId: () => (/* binding */ Ee),\n/* harmony export */ formatAccountWithChain: () => (/* binding */ Pn),\n/* harmony export */ formatChainId: () => (/* binding */ ge),\n/* harmony export */ formatExpirerTarget: () => (/* binding */ re),\n/* harmony export */ formatIdTarget: () => (/* binding */ at),\n/* harmony export */ formatMessage: () => (/* binding */ Cn),\n/* harmony export */ formatMessageContext: () => (/* binding */ Xn),\n/* harmony export */ formatRelayParams: () => (/* binding */ We),\n/* harmony export */ formatRelayRpcUrl: () => (/* binding */ Jn),\n/* harmony export */ formatTopicTarget: () => (/* binding */ ct),\n/* harmony export */ formatUA: () => (/* binding */ Me),\n/* harmony export */ formatUri: () => (/* binding */ Nt),\n/* harmony export */ generateKeyPair: () => (/* binding */ jn),\n/* harmony export */ generateRandomBytes32: () => (/* binding */ Dn),\n/* harmony export */ getAccountsChains: () => (/* binding */ A),\n/* harmony export */ getAccountsFromNamespaces: () => (/* binding */ Rn),\n/* harmony export */ getAddressFromAccount: () => (/* binding */ be),\n/* harmony export */ getAddressesFromAccounts: () => (/* binding */ Tn),\n/* harmony export */ getAppMetadata: () => (/* binding */ zn),\n/* harmony export */ getBrowserOnlineStatus: () => (/* binding */ dn),\n/* harmony export */ getChainFromAccount: () => (/* binding */ Ne),\n/* harmony export */ getChainsFromAccounts: () => (/* binding */ Oe),\n/* harmony export */ getChainsFromNamespace: () => (/* binding */ K),\n/* harmony export */ getChainsFromNamespaces: () => (/* binding */ An),\n/* harmony export */ getChainsFromRequiredNamespaces: () => (/* binding */ Un),\n/* harmony export */ getDidAddress: () => (/* binding */ we),\n/* harmony export */ getDidAddressSegments: () => (/* binding */ L),\n/* harmony export */ getDidChainId: () => (/* binding */ Se),\n/* harmony export */ getEnvironment: () => (/* binding */ R),\n/* harmony export */ getHttpUrl: () => (/* binding */ Qn),\n/* harmony export */ getInternalError: () => (/* binding */ N),\n/* harmony export */ getJavascriptID: () => (/* binding */ Ve),\n/* harmony export */ getJavascriptOS: () => (/* binding */ ke),\n/* harmony export */ getLastItems: () => (/* binding */ Le),\n/* harmony export */ getNamespacedDidChainId: () => (/* binding */ _n),\n/* harmony export */ getNamespacesChains: () => (/* binding */ Je),\n/* harmony export */ getNamespacesEventsForChainId: () => (/* binding */ Ze),\n/* harmony export */ getNamespacesMethodsForChainId: () => (/* binding */ Qe),\n/* harmony export */ getNodeOnlineStatus: () => (/* binding */ pn),\n/* harmony export */ getReactNativeOnlineStatus: () => (/* binding */ fn),\n/* harmony export */ getRelayClientMetadata: () => (/* binding */ Yn),\n/* harmony export */ getRelayProtocolApi: () => (/* binding */ yt),\n/* harmony export */ getRelayProtocolName: () => (/* binding */ mt),\n/* harmony export */ getRequiredNamespacesFromNamespaces: () => (/* binding */ At),\n/* harmony export */ getSdkError: () => (/* binding */ U),\n/* harmony export */ getUniqueValues: () => (/* binding */ Y),\n/* harmony export */ handleDeeplinkRedirect: () => (/* binding */ pt),\n/* harmony export */ hasOverlap: () => (/* binding */ O),\n/* harmony export */ hashKey: () => (/* binding */ Vn),\n/* harmony export */ hashMessage: () => (/* binding */ Mn),\n/* harmony export */ isBrowser: () => (/* binding */ q),\n/* harmony export */ isCaipNamespace: () => (/* binding */ oe),\n/* harmony export */ isConformingNamespaces: () => (/* binding */ un),\n/* harmony export */ isExpired: () => (/* binding */ dt),\n/* harmony export */ isNode: () => (/* binding */ te),\n/* harmony export */ isOnline: () => (/* binding */ Zt),\n/* harmony export */ isProposalStruct: () => (/* binding */ Dt),\n/* harmony export */ isReactNative: () => (/* binding */ j),\n/* harmony export */ isSessionCompatible: () => (/* binding */ $t),\n/* harmony export */ isSessionStruct: () => (/* binding */ kt),\n/* harmony export */ isTypeOneEnvelope: () => (/* binding */ Fn),\n/* harmony export */ isUndefined: () => (/* binding */ w),\n/* harmony export */ isValidAccountId: () => (/* binding */ en),\n/* harmony export */ isValidAccounts: () => (/* binding */ rn),\n/* harmony export */ isValidActions: () => (/* binding */ sn),\n/* harmony export */ isValidArray: () => (/* binding */ D),\n/* harmony export */ isValidChainId: () => (/* binding */ k),\n/* harmony export */ isValidChains: () => (/* binding */ nn),\n/* harmony export */ isValidController: () => (/* binding */ Vt),\n/* harmony export */ isValidErrorReason: () => (/* binding */ Ft),\n/* harmony export */ isValidEvent: () => (/* binding */ Bt),\n/* harmony export */ isValidId: () => (/* binding */ Lt),\n/* harmony export */ isValidNamespaceAccounts: () => (/* binding */ on),\n/* harmony export */ isValidNamespaceActions: () => (/* binding */ ce),\n/* harmony export */ isValidNamespaceChains: () => (/* binding */ tn),\n/* harmony export */ isValidNamespaceMethodsOrEvents: () => (/* binding */ ie),\n/* harmony export */ isValidNamespaces: () => (/* binding */ cn),\n/* harmony export */ isValidNamespacesChainId: () => (/* binding */ Gt),\n/* harmony export */ isValidNamespacesEvent: () => (/* binding */ zt),\n/* harmony export */ isValidNamespacesRequest: () => (/* binding */ Wt),\n/* harmony export */ isValidNumber: () => (/* binding */ G),\n/* harmony export */ isValidObject: () => (/* binding */ B),\n/* harmony export */ isValidParams: () => (/* binding */ xt),\n/* harmony export */ isValidRelay: () => (/* binding */ an),\n/* harmony export */ isValidRelays: () => (/* binding */ Kt),\n/* harmony export */ isValidRequest: () => (/* binding */ Ht),\n/* harmony export */ isValidRequestExpiry: () => (/* binding */ Qt),\n/* harmony export */ isValidRequiredNamespaces: () => (/* binding */ Mt),\n/* harmony export */ isValidResponse: () => (/* binding */ qt),\n/* harmony export */ isValidString: () => (/* binding */ h),\n/* harmony export */ isValidUrl: () => (/* binding */ jt),\n/* harmony export */ mapEntries: () => (/* binding */ tt),\n/* harmony export */ mapToObj: () => (/* binding */ et),\n/* harmony export */ mergeArrays: () => (/* binding */ S),\n/* harmony export */ normalizeNamespaces: () => (/* binding */ se),\n/* harmony export */ objToMap: () => (/* binding */ nt),\n/* harmony export */ parseAccountId: () => (/* binding */ z),\n/* harmony export */ parseChainId: () => (/* binding */ ve),\n/* harmony export */ parseContextNames: () => (/* binding */ Ke),\n/* harmony export */ parseExpirerTarget: () => (/* binding */ ut),\n/* harmony export */ parseNamespaceKey: () => (/* binding */ Xe),\n/* harmony export */ parseRelayParams: () => (/* binding */ Be),\n/* harmony export */ parseTopic: () => (/* binding */ Ge),\n/* harmony export */ parseUri: () => (/* binding */ bt),\n/* harmony export */ serialize: () => (/* binding */ Te),\n/* harmony export */ subscribeToBrowserNetworkChange: () => (/* binding */ mn),\n/* harmony export */ subscribeToNetworkChange: () => (/* binding */ Xt),\n/* harmony export */ subscribeToReactNativeNetworkChange: () => (/* binding */ yn),\n/* harmony export */ validateDecoding: () => (/* binding */ xn),\n/* harmony export */ validateEncoding: () => (/* binding */ Re)\n/* harmony export */ });\n/* harmony import */ var _stablelib_chacha20poly1305__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @stablelib/chacha20poly1305 */ \"./node_modules/@stablelib/chacha20poly1305/lib/chacha20poly1305.js\");\n/* harmony import */ var _stablelib_hkdf__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @stablelib/hkdf */ \"./node_modules/@stablelib/hkdf/lib/hkdf.js\");\n/* harmony import */ var _stablelib_random__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @stablelib/random */ \"./node_modules/@stablelib/random/lib/random.js\");\n/* harmony import */ var _stablelib_sha256__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @stablelib/sha256 */ \"./node_modules/@stablelib/sha256/lib/sha256.js\");\n/* harmony import */ var _stablelib_x25519__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @stablelib/x25519 */ \"./node_modules/@stablelib/x25519/lib/x25519.js\");\n/* harmony import */ var uint8arrays__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! uint8arrays */ \"./node_modules/uint8arrays/esm/src/index.js\");\n/* harmony import */ var detect_browser__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! detect-browser */ \"./node_modules/detect-browser/es/index.js\");\n/* harmony import */ var _walletconnect_time__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @walletconnect/time */ \"./node_modules/@walletconnect/time/dist/cjs/index.js\");\n/* harmony import */ var _walletconnect_time__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_walletconnect_time__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _walletconnect_window_getters__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @walletconnect/window-getters */ \"./node_modules/@walletconnect/window-getters/dist/cjs/index.js\");\n/* harmony import */ var _walletconnect_window_metadata__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @walletconnect/window-metadata */ \"./node_modules/@walletconnect/window-metadata/dist/cjs/index.js\");\n/* harmony import */ var query_string__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! query-string */ \"./node_modules/query-string/index.js\");\n/* harmony import */ var _walletconnect_relay_api__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @walletconnect/relay-api */ \"./node_modules/@walletconnect/relay-api/dist/esm/index.js\");\nconst M=\":\";function ve(e){const[n,t]=e.split(M);return{namespace:n,reference:t}}function ge(e){const{namespace:n,reference:t}=e;return[n,t].join(M)}function z(e){const[n,t,r]=e.split(M);return{namespace:n,reference:t,address:r}}function Ee(e){const{namespace:n,reference:t,address:r}=e;return[n,t,r].join(M)}function Y(e,n){const t=[];return e.forEach(r=>{const o=n(r);t.includes(o)||t.push(o)}),t}function be(e){const{address:n}=z(e);return n}function Ne(e){const{namespace:n,reference:t}=z(e);return ge({namespace:n,reference:t})}function Pn(e,n){const{namespace:t,reference:r}=ve(n);return Ee({namespace:t,reference:r,address:e})}function Tn(e){return Y(e,be)}function Oe(e){return Y(e,Ne)}function Rn(e,n=[]){const t=[];return Object.keys(e).forEach(r=>{if(n.length&&!n.includes(r))return;const o=e[r];t.push(...o.accounts)}),t}function An(e,n=[]){const t=[];return Object.keys(e).forEach(r=>{if(n.length&&!n.includes(r))return;const o=e[r];t.push(...Oe(o.accounts))}),t}function Un(e,n=[]){const t=[];return Object.keys(e).forEach(r=>{if(n.length&&!n.includes(r))return;const o=e[r];t.push(...K(r,o))}),t}function K(e,n){return e.includes(\":\")?[e]:n.chains||[]}const L=e=>e?.split(\":\"),Se=e=>{const n=e&&L(e);if(n)return n[3]},_n=e=>{const n=e&&L(e);if(n)return n[2]+\":\"+n[3]},we=e=>{const n=e&&L(e);if(n)return n.pop()},Cn=(e,n)=>{const t=`${e.domain} wants you to sign in with your Ethereum account:`,r=we(n),o=e.statement,s=`URI: ${e.aud}`,i=`Version: ${e.version}`,l=`Chain ID: ${Se(n)}`,d=`Nonce: ${e.nonce}`,c=`Issued At: ${e.iat}`,u=e.resources&&e.resources.length>0?`Resources:\n${e.resources.map(a=>`- ${a}`).join(`\n`)}`:void 0;return[t,r,\"\",o,\"\",s,i,l,d,c,u].filter(a=>a!=null).join(`\n`)},J=\"base10\",p=\"base16\",x=\"base64pad\",F=\"utf8\",Q=0,_=1,$n=0,Ie=1,Z=12,X=32;function jn(){const e=_stablelib_x25519__WEBPACK_IMPORTED_MODULE_4__.generateKeyPair();return{privateKey:(0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.toString)(e.secretKey,p),publicKey:(0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.toString)(e.publicKey,p)}}function Dn(){const e=(0,_stablelib_random__WEBPACK_IMPORTED_MODULE_2__.randomBytes)(X);return (0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.toString)(e,p)}function kn(e,n){const t=_stablelib_x25519__WEBPACK_IMPORTED_MODULE_4__.sharedKey((0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.fromString)(e,p),(0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.fromString)(n,p),!0),r=new _stablelib_hkdf__WEBPACK_IMPORTED_MODULE_1__.HKDF(_stablelib_sha256__WEBPACK_IMPORTED_MODULE_3__.SHA256,t).expand(X);return (0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.toString)(r,p)}function Vn(e){const n=(0,_stablelib_sha256__WEBPACK_IMPORTED_MODULE_3__.hash)((0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.fromString)(e,p));return (0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.toString)(n,p)}function Mn(e){const n=(0,_stablelib_sha256__WEBPACK_IMPORTED_MODULE_3__.hash)((0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.fromString)(e,F));return (0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.toString)(n,p)}function Pe(e){return (0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.fromString)(`${e}`,J)}function $(e){return Number((0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.toString)(e,J))}function Kn(e){const n=Pe(typeof e.type<\"u\"?e.type:Q);if($(n)===_&&typeof e.senderPublicKey>\"u\")throw new Error(\"Missing sender public key for type 1 envelope\");const t=typeof e.senderPublicKey<\"u\"?(0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.fromString)(e.senderPublicKey,p):void 0,r=typeof e.iv<\"u\"?(0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.fromString)(e.iv,p):(0,_stablelib_random__WEBPACK_IMPORTED_MODULE_2__.randomBytes)(Z),o=new _stablelib_chacha20poly1305__WEBPACK_IMPORTED_MODULE_0__.ChaCha20Poly1305((0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.fromString)(e.symKey,p)).seal(r,(0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.fromString)(e.message,F));return Te({type:n,sealed:o,iv:r,senderPublicKey:t})}function Ln(e){const n=new _stablelib_chacha20poly1305__WEBPACK_IMPORTED_MODULE_0__.ChaCha20Poly1305((0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.fromString)(e.symKey,p)),{sealed:t,iv:r}=ee(e.encoded),o=n.open(r,t);if(o===null)throw new Error(\"Failed to decrypt\");return (0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.toString)(o,F)}function Te(e){if($(e.type)===_){if(typeof e.senderPublicKey>\"u\")throw new Error(\"Missing sender public key for type 1 envelope\");return (0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.toString)((0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.concat)([e.type,e.senderPublicKey,e.iv,e.sealed]),x)}return (0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.toString)((0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.concat)([e.type,e.iv,e.sealed]),x)}function ee(e){const n=(0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.fromString)(e,x),t=n.slice($n,Ie),r=Ie;if($(t)===_){const l=r+X,d=l+Z,c=n.slice(r,l),u=n.slice(l,d),a=n.slice(d);return{type:t,sealed:a,iv:u,senderPublicKey:c}}const o=r+Z,s=n.slice(r,o),i=n.slice(o);return{type:t,sealed:i,iv:s}}function xn(e,n){const t=ee(e);return Re({type:$(t.type),senderPublicKey:typeof t.senderPublicKey<\"u\"?(0,uint8arrays__WEBPACK_IMPORTED_MODULE_5__.toString)(t.senderPublicKey,p):void 0,receiverPublicKey:n?.receiverPublicKey})}function Re(e){const n=e?.type||Q;if(n===_){if(typeof e?.senderPublicKey>\"u\")throw new Error(\"missing sender public key\");if(typeof e?.receiverPublicKey>\"u\")throw new Error(\"missing receiver public key\")}return{type:n,senderPublicKey:e?.senderPublicKey,receiverPublicKey:e?.receiverPublicKey}}function Fn(e){return e.type===_&&typeof e.senderPublicKey==\"string\"&&typeof e.receiverPublicKey==\"string\"}var Hn=Object.defineProperty,Ae=Object.getOwnPropertySymbols,qn=Object.prototype.hasOwnProperty,Bn=Object.prototype.propertyIsEnumerable,Ue=(e,n,t)=>n in e?Hn(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,_e=(e,n)=>{for(var t in n||(n={}))qn.call(n,t)&&Ue(e,t,n[t]);if(Ae)for(var t of Ae(n))Bn.call(n,t)&&Ue(e,t,n[t]);return e};const Ce=\"ReactNative\",m={reactNative:\"react-native\",node:\"node\",browser:\"browser\",unknown:\"unknown\"},H=\" \",Gn=\":\",$e=\"/\",ne=2,Wn=1e3,je=\"js\";function te(){return typeof process<\"u\"&&typeof process.versions<\"u\"&&typeof process.versions.node<\"u\"}function j(){return!(0,_walletconnect_window_getters__WEBPACK_IMPORTED_MODULE_7__.getDocument)()&&!!(0,_walletconnect_window_getters__WEBPACK_IMPORTED_MODULE_7__.getNavigator)()&&navigator.product===Ce}function q(){return!te()&&!!(0,_walletconnect_window_getters__WEBPACK_IMPORTED_MODULE_7__.getNavigator)()}function R(){return j()?m.reactNative:te()?m.node:q()?m.browser:m.unknown}function De(e,n){let t=query_string__WEBPACK_IMPORTED_MODULE_9__.parse(e);return t=_e(_e({},t),n),e=query_string__WEBPACK_IMPORTED_MODULE_9__.stringify(t),e}function zn(){return (0,_walletconnect_window_metadata__WEBPACK_IMPORTED_MODULE_8__.getWindowMetadata)()||{name:\"\",description:\"\",url:\"\",icons:[\"\"]}}function Yn(e,n){var t;const r=R(),o={protocol:e,version:n,env:r};return r===\"browser\"&&(o.host=((t=(0,_walletconnect_window_getters__WEBPACK_IMPORTED_MODULE_7__.getLocation)())==null?void 0:t.host)||\"unknown\"),o}function ke(){if(R()===m.reactNative&&typeof __webpack_require__.g<\"u\"&&typeof(__webpack_require__.g==null?void 0:__webpack_require__.g.Platform)<\"u\"){const{OS:t,Version:r}=__webpack_require__.g.Platform;return[t,r].join(\"-\")}const e=(0,detect_browser__WEBPACK_IMPORTED_MODULE_11__.detect)();if(e===null)return\"unknown\";const n=e.os?e.os.replace(\" \",\"\").toLowerCase():\"unknown\";return e.type===\"browser\"?[n,e.name,e.version].join(\"-\"):[n,e.version].join(\"-\")}function Ve(){var e;const n=R();return n===m.browser?[n,((e=(0,_walletconnect_window_getters__WEBPACK_IMPORTED_MODULE_7__.getLocation)())==null?void 0:e.host)||\"unknown\"].join(\":\"):n}function Me(e,n,t){const r=ke(),o=Ve();return[[e,n].join(\"-\"),[je,t].join(\"-\"),r,o].join(\"/\")}function Jn({protocol:e,version:n,relayUrl:t,sdkVersion:r,auth:o,projectId:s,useOnCloseEvent:i}){const l=t.split(\"?\"),d=Me(e,n,r),c={auth:o,ua:d,projectId:s,useOnCloseEvent:i||void 0},u=De(l[1]||\"\",c);return l[0]+\"?\"+u}function Qn(e){let n=(e.match(/^[^:]+(?=:\\/\\/)/gi)||[])[0];const t=typeof n<\"u\"?e.split(\"://\")[1]:e;return n=n===\"wss\"?\"https\":\"http\",[n,t].join(\"://\")}function Zn(e,n,t){if(!e[n]||typeof e[n]!==t)throw new Error(`Missing or invalid \"${n}\" param`)}function Ke(e,n=ne){return Le(e.split($e),n)}function Xn(e){return Ke(e).join(H)}function O(e,n){return e.filter(t=>n.includes(t)).length===e.length}function Le(e,n=ne){return e.slice(Math.max(e.length-n,0))}function et(e){return Object.fromEntries(e.entries())}function nt(e){return new Map(Object.entries(e))}function tt(e,n){const t={};return Object.keys(e).forEach(r=>{t[r]=n(e[r])}),t}const rt=e=>e;function xe(e){return e.trim().replace(/^\\w/,n=>n.toUpperCase())}function ot(e){return e.split(H).map(n=>xe(n)).join(H)}function st(e=_walletconnect_time__WEBPACK_IMPORTED_MODULE_6__.FIVE_MINUTES,n){const t=(0,_walletconnect_time__WEBPACK_IMPORTED_MODULE_6__.toMiliseconds)(e||_walletconnect_time__WEBPACK_IMPORTED_MODULE_6__.FIVE_MINUTES);let r,o,s;return{resolve:i=>{s&&r&&(clearTimeout(s),r(i))},reject:i=>{s&&o&&(clearTimeout(s),o(i))},done:()=>new Promise((i,l)=>{s=setTimeout(()=>{l(new Error(n))},t),r=i,o=l})}}function it(e,n,t){return new Promise(async(r,o)=>{const s=setTimeout(()=>o(new Error(t)),n);try{const i=await e;r(i)}catch(i){o(i)}clearTimeout(s)})}function re(e,n){if(typeof n==\"string\"&&n.startsWith(`${e}:`))return n;if(e.toLowerCase()===\"topic\"){if(typeof n!=\"string\")throw new Error('Value must be \"string\" for expirer target type: topic');return`topic:${n}`}else if(e.toLowerCase()===\"id\"){if(typeof n!=\"number\")throw new Error('Value must be \"number\" for expirer target type: id');return`id:${n}`}throw new Error(`Unknown expirer target type: ${e}`)}function ct(e){return re(\"topic\",e)}function at(e){return re(\"id\",e)}function ut(e){const[n,t]=e.split(\":\"),r={id:void 0,topic:void 0};if(n===\"topic\"&&typeof t==\"string\")r.topic=t;else if(n===\"id\"&&Number.isInteger(Number(t)))r.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${n}:${t}`);return r}function lt(e,n){return (0,_walletconnect_time__WEBPACK_IMPORTED_MODULE_6__.fromMiliseconds)((n||Date.now())+(0,_walletconnect_time__WEBPACK_IMPORTED_MODULE_6__.toMiliseconds)(e))}function dt(e){return Date.now()>=(0,_walletconnect_time__WEBPACK_IMPORTED_MODULE_6__.toMiliseconds)(e)}function ft(e,n){return`${e}${n?`:${n}`:\"\"}`}function S(e=[],n=[]){return[...new Set([...e,...n])]}async function pt({id:e,topic:n,wcDeepLink:t}){try{if(!t)return;const r=typeof t==\"string\"?JSON.parse(t):t;let o=r?.href;if(typeof o!=\"string\")return;o.endsWith(\"/\")&&(o=o.slice(0,-1));const s=`${o}/wc?requestId=${e}&sessionTopic=${n}`,i=R();i===m.browser?s.startsWith(\"https://\")?window.open(s,\"_blank\",\"noreferrer noopener\"):window.open(s,\"_self\",\"noreferrer noopener\"):i===m.reactNative&&typeof(__webpack_require__.g==null?void 0:__webpack_require__.g.Linking)<\"u\"&&await __webpack_require__.g.Linking.openURL(s)}catch(r){console.error(r)}}const Fe=\"irn\";function mt(e){return e?.relay||{protocol:Fe}}function yt(e){const n=_walletconnect_relay_api__WEBPACK_IMPORTED_MODULE_10__.RELAY_JSONRPC[e];if(typeof n>\"u\")throw new Error(`Relay Protocol not supported: ${e}`);return n}var ht=Object.defineProperty,He=Object.getOwnPropertySymbols,vt=Object.prototype.hasOwnProperty,gt=Object.prototype.propertyIsEnumerable,qe=(e,n,t)=>n in e?ht(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,Et=(e,n)=>{for(var t in n||(n={}))vt.call(n,t)&&qe(e,t,n[t]);if(He)for(var t of He(n))gt.call(n,t)&&qe(e,t,n[t]);return e};function Be(e,n=\"-\"){const t={},r=\"relay\"+n;return Object.keys(e).forEach(o=>{if(o.startsWith(r)){const s=o.replace(r,\"\"),i=e[o];t[s]=i}}),t}function bt(e){const n=e.indexOf(\":\"),t=e.indexOf(\"?\")!==-1?e.indexOf(\"?\"):void 0,r=e.substring(0,n),o=e.substring(n+1,t).split(\"@\"),s=typeof t<\"u\"?e.substring(t):\"\",i=query_string__WEBPACK_IMPORTED_MODULE_9__.parse(s);return{protocol:r,topic:Ge(o[0]),version:parseInt(o[1],10),symKey:i.symKey,relay:Be(i)}}function Ge(e){return e.startsWith(\"//\")?e.substring(2):e}function We(e,n=\"-\"){const t=\"relay\",r={};return Object.keys(e).forEach(o=>{const s=t+n+o;e[o]&&(r[s]=e[o])}),r}function Nt(e){return`${e.protocol}:${e.topic}@${e.version}?`+query_string__WEBPACK_IMPORTED_MODULE_9__.stringify(Et({symKey:e.symKey},We(e.relay)))}var Ot=Object.defineProperty,St=Object.defineProperties,wt=Object.getOwnPropertyDescriptors,ze=Object.getOwnPropertySymbols,It=Object.prototype.hasOwnProperty,Pt=Object.prototype.propertyIsEnumerable,Ye=(e,n,t)=>n in e?Ot(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,Tt=(e,n)=>{for(var t in n||(n={}))It.call(n,t)&&Ye(e,t,n[t]);if(ze)for(var t of ze(n))Pt.call(n,t)&&Ye(e,t,n[t]);return e},Rt=(e,n)=>St(e,wt(n));function A(e){const n=[];return e.forEach(t=>{const[r,o]=t.split(\":\");n.push(`${r}:${o}`)}),n}function Je(e){const n=[];return Object.values(e).forEach(t=>{n.push(...A(t.accounts))}),n}function Qe(e,n){const t=[];return Object.values(e).forEach(r=>{A(r.accounts).includes(n)&&t.push(...r.methods)}),t}function Ze(e,n){const t=[];return Object.values(e).forEach(r=>{A(r.accounts).includes(n)&&t.push(...r.events)}),t}function At(e,n){const t=cn(e,n);if(t)throw new Error(t.message);const r={};for(const[o,s]of Object.entries(e))r[o]={methods:s.methods,events:s.events,chains:s.accounts.map(i=>`${i.split(\":\")[0]}:${i.split(\":\")[1]}`)};return r}function Ut(e){const{proposal:{requiredNamespaces:n,optionalNamespaces:t={}},supportedNamespaces:r}=e,o=se(n),s=se(t),i={};Object.keys(r).forEach(c=>{const u=r[c].chains,a=r[c].methods,b=r[c].events,I=r[c].accounts;u.forEach(y=>{if(!I.some(f=>f.includes(y)))throw new Error(`No accounts provided for chain ${y} in namespace ${c}`)}),i[c]={chains:u,methods:a,events:b,accounts:I}});const l=un(n,i,\"approve()\");if(l)throw new Error(l.message);const d={};return!Object.keys(n).length&&!Object.keys(t).length?i:(Object.keys(o).forEach(c=>{const u=r[c].chains.filter(y=>{var f,v;return(v=(f=o[c])==null?void 0:f.chains)==null?void 0:v.includes(y)}),a=r[c].methods.filter(y=>{var f,v;return(v=(f=o[c])==null?void 0:f.methods)==null?void 0:v.includes(y)}),b=r[c].events.filter(y=>{var f,v;return(v=(f=o[c])==null?void 0:f.events)==null?void 0:v.includes(y)}),I=u.map(y=>r[c].accounts.filter(f=>f.includes(`${y}:`))).flat();d[c]={chains:u,methods:a,events:b,accounts:I}}),Object.keys(s).forEach(c=>{var u,a,b,I,y,f;if(!r[c])return;const v=(a=(u=s[c])==null?void 0:u.chains)==null?void 0:a.filter(P=>r[c].chains.includes(P)),hn=r[c].methods.filter(P=>{var T,C;return(C=(T=s[c])==null?void 0:T.methods)==null?void 0:C.includes(P)}),vn=r[c].events.filter(P=>{var T,C;return(C=(T=s[c])==null?void 0:T.events)==null?void 0:C.includes(P)}),gn=v?.map(P=>r[c].accounts.filter(T=>T.includes(`${P}:`))).flat();d[c]={chains:S((b=d[c])==null?void 0:b.chains,v),methods:S((I=d[c])==null?void 0:I.methods,hn),events:S((y=d[c])==null?void 0:y.events,vn),accounts:S((f=d[c])==null?void 0:f.accounts,gn)}}),d)}function oe(e){return e.includes(\":\")}function Xe(e){return oe(e)?e.split(\":\")[0]:e}function se(e){var n,t,r;const o={};if(!B(e))return o;for(const[s,i]of Object.entries(e)){const l=oe(s)?[s]:i.chains,d=i.methods||[],c=i.events||[],u=Xe(s);o[u]=Rt(Tt({},o[u]),{chains:S(l,(n=o[u])==null?void 0:n.chains),methods:S(d,(t=o[u])==null?void 0:t.methods),events:S(c,(r=o[u])==null?void 0:r.events)})}return o}const _t={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}},Ct={NOT_INITIALIZED:{message:\"Not initialized.\",code:1},NO_MATCHING_KEY:{message:\"No matching key.\",code:2},RESTORE_WILL_OVERRIDE:{message:\"Restore will override.\",code:3},RESUBSCRIBED:{message:\"Resubscribed.\",code:4},MISSING_OR_INVALID:{message:\"Missing or invalid.\",code:5},EXPIRED:{message:\"Expired.\",code:6},UNKNOWN_TYPE:{message:\"Unknown type.\",code:7},MISMATCHED_TOPIC:{message:\"Mismatched topic.\",code:8},NON_CONFORMING_NAMESPACES:{message:\"Non conforming namespaces.\",code:9}};function N(e,n){const{message:t,code:r}=Ct[e];return{message:n?`${t} ${n}`:t,code:r}}function U(e,n){const{message:t,code:r}=_t[e];return{message:n?`${t} ${n}`:t,code:r}}function D(e,n){return Array.isArray(e)?typeof n<\"u\"&&e.length?e.every(n):!0:!1}function B(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function w(e){return typeof e>\"u\"}function h(e,n){return n&&w(e)?!0:typeof e==\"string\"&&!!e.trim().length}function G(e,n){return n&&w(e)?!0:typeof e==\"number\"&&!isNaN(e)}function $t(e,n){const{requiredNamespaces:t}=n,r=Object.keys(e.namespaces),o=Object.keys(t);let s=!0;return O(o,r)?(r.forEach(i=>{const{accounts:l,methods:d,events:c}=e.namespaces[i],u=A(l),a=t[i];(!O(K(i,a),u)||!O(a.methods,d)||!O(a.events,c))&&(s=!1)}),s):!1}function k(e){return h(e,!1)&&e.includes(\":\")?e.split(\":\").length===2:!1}function en(e){if(h(e,!1)&&e.includes(\":\")){const n=e.split(\":\");if(n.length===3){const t=n[0]+\":\"+n[1];return!!n[2]&&k(t)}}return!1}function jt(e){if(h(e,!1))try{return typeof new URL(e)<\"u\"}catch{return!1}return!1}function Dt(e){var n;return(n=e?.proposer)==null?void 0:n.publicKey}function kt(e){return e?.topic}function Vt(e,n){let t=null;return h(e?.publicKey,!1)||(t=N(\"MISSING_OR_INVALID\",`${n} controller public key should be a string`)),t}function ie(e){let n=!0;return D(e)?e.length&&(n=e.every(t=>h(t,!1))):n=!1,n}function nn(e,n,t){let r=null;return D(n)&&n.length?n.forEach(o=>{r||k(o)||(r=U(\"UNSUPPORTED_CHAINS\",`${t}, chain ${o} should be a string and conform to \"namespace:chainId\" format`))}):k(e)||(r=U(\"UNSUPPORTED_CHAINS\",`${t}, chains must be defined as \"namespace:chainId\" e.g. \"eip155:1\": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: [\"eip155:1\", \"eip155:5\"] }`)),r}function tn(e,n,t){let r=null;return Object.entries(e).forEach(([o,s])=>{if(r)return;const i=nn(o,K(o,s),`${n} ${t}`);i&&(r=i)}),r}function rn(e,n){let t=null;return D(e)?e.forEach(r=>{t||en(r)||(t=U(\"UNSUPPORTED_ACCOUNTS\",`${n}, account ${r} should be a string and conform to \"namespace:chainId:address\" format`))}):t=U(\"UNSUPPORTED_ACCOUNTS\",`${n}, accounts should be an array of strings conforming to \"namespace:chainId:address\" format`),t}function on(e,n){let t=null;return Object.values(e).forEach(r=>{if(t)return;const o=rn(r?.accounts,`${n} namespace`);o&&(t=o)}),t}function sn(e,n){let t=null;return ie(e?.methods)?ie(e?.events)||(t=U(\"UNSUPPORTED_EVENTS\",`${n}, events should be an array of strings or empty array for no events`)):t=U(\"UNSUPPORTED_METHODS\",`${n}, methods should be an array of strings or empty array for no methods`),t}function ce(e,n){let t=null;return Object.values(e).forEach(r=>{if(t)return;const o=sn(r,`${n}, namespace`);o&&(t=o)}),t}function Mt(e,n,t){let r=null;if(e&&B(e)){const o=ce(e,n);o&&(r=o);const s=tn(e,n,t);s&&(r=s)}else r=N(\"MISSING_OR_INVALID\",`${n}, ${t} should be an object with data`);return r}function cn(e,n){let t=null;if(e&&B(e)){const r=ce(e,n);r&&(t=r);const o=on(e,n);o&&(t=o)}else t=N(\"MISSING_OR_INVALID\",`${n}, namespaces should be an object with data`);return t}function an(e){return h(e.protocol,!0)}function Kt(e,n){let t=!1;return n&&!e?t=!0:e&&D(e)&&e.length&&e.forEach(r=>{t=an(r)}),t}function Lt(e){return typeof e==\"number\"}function xt(e){return typeof e<\"u\"&&typeof e!==null}function Ft(e){return!(!e||typeof e!=\"object\"||!e.code||!G(e.code,!1)||!e.message||!h(e.message,!1))}function Ht(e){return!(w(e)||!h(e.method,!1))}function qt(e){return!(w(e)||w(e.result)&&w(e.error)||!G(e.id,!1)||!h(e.jsonrpc,!1))}function Bt(e){return!(w(e)||!h(e.name,!1))}function Gt(e,n){return!(!k(n)||!Je(e).includes(n))}function Wt(e,n,t){return h(t,!1)?Qe(e,n).includes(t):!1}function zt(e,n,t){return h(t,!1)?Ze(e,n).includes(t):!1}function un(e,n,t){let r=null;const o=Yt(e),s=Jt(n),i=Object.keys(o),l=Object.keys(s),d=ln(Object.keys(e)),c=ln(Object.keys(n)),u=d.filter(a=>!c.includes(a));return u.length&&(r=N(\"NON_CONFORMING_NAMESPACES\",`${t} namespaces keys don't satisfy requiredNamespaces.\n Required: ${u.toString()}\n Received: ${Object.keys(n).toString()}`)),O(i,l)||(r=N(\"NON_CONFORMING_NAMESPACES\",`${t} namespaces chains don't satisfy required namespaces.\n Required: ${i.toString()}\n Approved: ${l.toString()}`)),Object.keys(n).forEach(a=>{if(!a.includes(\":\")||r)return;const b=A(n[a].accounts);b.includes(a)||(r=N(\"NON_CONFORMING_NAMESPACES\",`${t} namespaces accounts don't satisfy namespace accounts for ${a}\n Required: ${a}\n Approved: ${b.toString()}`))}),i.forEach(a=>{r||(O(o[a].methods,s[a].methods)?O(o[a].events,s[a].events)||(r=N(\"NON_CONFORMING_NAMESPACES\",`${t} namespaces events don't satisfy namespace events for ${a}`)):r=N(\"NON_CONFORMING_NAMESPACES\",`${t} namespaces methods don't satisfy namespace methods for ${a}`))}),r}function Yt(e){const n={};return Object.keys(e).forEach(t=>{var r;t.includes(\":\")?n[t]=e[t]:(r=e[t].chains)==null||r.forEach(o=>{n[o]={methods:e[t].methods,events:e[t].events}})}),n}function ln(e){return[...new Set(e.map(n=>n.includes(\":\")?n.split(\":\")[0]:n))]}function Jt(e){const n={};return Object.keys(e).forEach(t=>{if(t.includes(\":\"))n[t]=e[t];else{const r=A(e[t].accounts);r?.forEach(o=>{n[o]={accounts:e[t].accounts.filter(s=>s.includes(`${o}:`)),methods:e[t].methods,events:e[t].events}})}}),n}function Qt(e,n){return G(e,!1)&&e<=n.max&&e>=n.min}function Zt(){const e=R();return new Promise(n=>{switch(e){case m.browser:n(dn());break;case m.reactNative:n(fn());break;case m.node:n(pn());break;default:n(!0)}})}function dn(){return q()&&navigator?.onLine}async function fn(){if(j()&&typeof __webpack_require__.g<\"u\"&&__webpack_require__.g!=null&&__webpack_require__.g.NetInfo){const e=await(__webpack_require__.g==null?void 0:__webpack_require__.g.NetInfo.fetch());return e?.isConnected}return!0}function pn(){return!0}function Xt(e){switch(R()){case m.browser:mn(e);break;case m.reactNative:yn(e);break;case m.node:break}}function mn(e){!j()&&q()&&(window.addEventListener(\"online\",()=>e(!0)),window.addEventListener(\"offline\",()=>e(!1)))}function yn(e){j()&&typeof __webpack_require__.g<\"u\"&&__webpack_require__.g!=null&&__webpack_require__.g.NetInfo&&__webpack_require__.g?.NetInfo.addEventListener(n=>e(n?.isConnected))}const ae={};class er{static get(n){return ae[n]}static set(n,t){ae[n]=t}static delete(n){delete ae[n]}}\n//# sourceMappingURL=index.es.js.map\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/utils/dist/index.es.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/web3wallet/dist/index.es.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@walletconnect/web3wallet/dist/index.es.js ***! - \*****************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CLIENT_CONTEXT: () => (/* binding */ d),\n/* harmony export */ CLIENT_STORAGE_OPTIONS: () => (/* binding */ k),\n/* harmony export */ CLIENT_STORAGE_PREFIX: () => (/* binding */ K),\n/* harmony export */ IWeb3Wallet: () => (/* binding */ x),\n/* harmony export */ IWeb3WalletEngine: () => (/* binding */ P),\n/* harmony export */ IWeb3WalletEvents: () => (/* binding */ X),\n/* harmony export */ PROTOCOL: () => (/* binding */ O),\n/* harmony export */ PROTOCOL_VERSION: () => (/* binding */ F),\n/* harmony export */ REQUEST_CONTEXT: () => (/* binding */ U),\n/* harmony export */ Web3Wallet: () => (/* binding */ G),\n/* harmony export */ \"default\": () => (/* binding */ p)\n/* harmony export */ });\n/* harmony import */ var _walletconnect_auth_client__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/auth-client */ \"./node_modules/@walletconnect/auth-client/dist/index.es.js\");\n/* harmony import */ var _walletconnect_sign_client__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @walletconnect/sign-client */ \"./node_modules/@walletconnect/sign-client/dist/index.es.js\");\nvar l={exports:{}},u=typeof Reflect==\"object\"?Reflect:null,m=u&&typeof u.apply==\"function\"?u.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)},f;u&&typeof u.ownKeys==\"function\"?f=u.ownKeys:Object.getOwnPropertySymbols?f=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:f=function(t){return Object.getOwnPropertyNames(t)};function T(s){console&&console.warn&&console.warn(s)}var y=Number.isNaN||function(t){return t!==t};function o(){o.init.call(this)}l.exports=o,l.exports.once=M,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var w=10;function g(s){if(typeof s!=\"function\")throw new TypeError('The \"listener\" argument must be of type Function. Received type '+typeof s)}Object.defineProperty(o,\"defaultMaxListeners\",{enumerable:!0,get:function(){return w},set:function(s){if(typeof s!=\"number\"||s<0||y(s))throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received '+s+\".\");w=s}}),o.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(t){if(typeof t!=\"number\"||t<0||y(t))throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received '+t+\".\");return this._maxListeners=t,this};function L(s){return s._maxListeners===void 0?o.defaultMaxListeners:s._maxListeners}o.prototype.getMaxListeners=function(){return L(this)},o.prototype.emit=function(t){for(var e=[],n=1;n0&&(r=e[0]),r instanceof Error)throw r;var h=new Error(\"Unhandled error.\"+(r?\" (\"+r.message+\")\":\"\"));throw h.context=r,h}var c=a[t];if(c===void 0)return!1;if(typeof c==\"function\")m(c,this,e);else for(var v=c.length,A=b(c,v),n=0;n0&&r.length>i&&!r.warned){r.warned=!0;var h=new Error(\"Possible EventEmitter memory leak detected. \"+r.length+\" \"+String(t)+\" listeners added. Use emitter.setMaxListeners() to increase limit\");h.name=\"MaxListenersExceededWarning\",h.emitter=s,h.type=t,h.count=r.length,T(h)}return s}o.prototype.addListener=function(t,e){return _(this,t,e,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(t,e){return _(this,t,e,!0)};function j(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function S(s,t,e){var n={fired:!1,wrapFn:void 0,target:s,type:t,listener:e},i=j.bind(n);return i.listener=e,n.wrapFn=i,i}o.prototype.once=function(t,e){return g(e),this.on(t,S(this,t,e)),this},o.prototype.prependOnceListener=function(t,e){return g(e),this.prependListener(t,S(this,t,e)),this},o.prototype.removeListener=function(t,e){var n,i,a,r,h;if(g(e),i=this._events,i===void 0)return this;if(n=i[t],n===void 0)return this;if(n===e||n.listener===e)--this._eventsCount===0?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit(\"removeListener\",t,n.listener||e));else if(typeof n!=\"function\"){for(a=-1,r=n.length-1;r>=0;r--)if(n[r]===e||n[r].listener===e){h=n[r].listener,a=r;break}if(a<0)return this;a===0?n.shift():I(n,a),n.length===1&&(i[t]=n[0]),i.removeListener!==void 0&&this.emit(\"removeListener\",t,h||e)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(t){var e,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[t]),this;if(arguments.length===0){var a=Object.keys(n),r;for(i=0;i=0;i--)this.removeListener(t,e[i]);return this};function C(s,t,e){var n=s._events;if(n===void 0)return[];var i=n[t];return i===void 0?[]:typeof i==\"function\"?e?[i.listener||i]:[i]:e?W(i):b(i,i.length)}o.prototype.listeners=function(t){return C(this,t,!0)},o.prototype.rawListeners=function(t){return C(this,t,!1)},o.listenerCount=function(s,t){return typeof s.listenerCount==\"function\"?s.listenerCount(t):E.call(s,t)},o.prototype.listenerCount=E;function E(s){var t=this._events;if(t!==void 0){var e=t[s];if(typeof e==\"function\")return 1;if(e!==void 0)return e.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?f(this._events):[]};function b(s,t){for(var e=new Array(t),n=0;n{this.signClient=await _walletconnect_sign_client__WEBPACK_IMPORTED_MODULE_1__.SignClient.init({core:this.client.core,metadata:this.client.metadata}),this.authClient=await _walletconnect_auth_client__WEBPACK_IMPORTED_MODULE_0__.AuthClient.init({core:this.client.core,projectId:\"\",metadata:this.client.metadata}),this.initializeEventListeners()},this.pair=async e=>{await this.client.core.pairing.pair(e)},this.approveSession=async e=>{const{topic:n,acknowledged:i}=await this.signClient.approve({id:e.id,namespaces:e.namespaces});return await i(),this.signClient.session.get(n)},this.rejectSession=async e=>await this.signClient.reject(e),this.updateSession=async e=>await(await this.signClient.update(e)).acknowledged(),this.extendSession=async e=>await(await this.signClient.extend(e)).acknowledged(),this.respondSessionRequest=async e=>await this.signClient.respond(e),this.disconnectSession=async e=>await this.signClient.disconnect(e),this.emitSessionEvent=async e=>await this.signClient.emit(e),this.getActiveSessions=()=>this.signClient.session.getAll().reduce((e,n)=>(e[n.topic]=n,e),{}),this.getPendingSessionProposals=()=>this.signClient.proposal.getAll(),this.getPendingSessionRequests=()=>this.signClient.getPendingSessionRequests(),this.respondAuthRequest=async(e,n)=>await this.authClient.respond(e,n),this.getPendingAuthRequests=()=>this.authClient.requests.getAll().filter(e=>\"requester\"in e),this.formatMessage=(e,n)=>this.authClient.formatMessage(e,n),this.onSessionRequest=e=>{this.client.events.emit(\"session_request\",e)},this.onSessionProposal=e=>{this.client.events.emit(\"session_proposal\",e)},this.onSessionDelete=e=>{this.client.events.emit(\"session_delete\",e)},this.onAuthRequest=e=>{this.client.events.emit(\"auth_request\",e)},this.initializeEventListeners=()=>{this.signClient.events.on(\"session_proposal\",this.onSessionProposal),this.signClient.events.on(\"session_request\",this.onSessionRequest),this.signClient.events.on(\"session_delete\",this.onSessionDelete),this.authClient.on(\"auth_request\",this.onAuthRequest)},this.signClient={},this.authClient={}}}class p extends x{constructor(t){super(t),this.events=new l.exports,this.on=(e,n)=>this.events.on(e,n),this.once=(e,n)=>this.events.once(e,n),this.off=(e,n)=>this.events.off(e,n),this.removeListener=(e,n)=>this.events.removeListener(e,n),this.pair=async e=>{try{return await this.engine.pair(e)}catch(n){throw this.logger.error(n.message),n}},this.approveSession=async e=>{try{return await this.engine.approveSession(e)}catch(n){throw this.logger.error(n.message),n}},this.rejectSession=async e=>{try{return await this.engine.rejectSession(e)}catch(n){throw this.logger.error(n.message),n}},this.updateSession=async e=>{try{return await this.engine.updateSession(e)}catch(n){throw this.logger.error(n.message),n}},this.extendSession=async e=>{try{return await this.engine.extendSession(e)}catch(n){throw this.logger.error(n.message),n}},this.respondSessionRequest=async e=>{try{return await this.engine.respondSessionRequest(e)}catch(n){throw this.logger.error(n.message),n}},this.disconnectSession=async e=>{try{return await this.engine.disconnectSession(e)}catch(n){throw this.logger.error(n.message),n}},this.emitSessionEvent=async e=>{try{return await this.engine.emitSessionEvent(e)}catch(n){throw this.logger.error(n.message),n}},this.getActiveSessions=()=>{try{return this.engine.getActiveSessions()}catch(e){throw this.logger.error(e.message),e}},this.getPendingSessionProposals=()=>{try{return this.engine.getPendingSessionProposals()}catch(e){throw this.logger.error(e.message),e}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(e){throw this.logger.error(e.message),e}},this.respondAuthRequest=async(e,n)=>{try{return await this.engine.respondAuthRequest(e,n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingAuthRequests=()=>{try{return this.engine.getPendingAuthRequests()}catch(e){throw this.logger.error(e.message),e}},this.formatMessage=(e,n)=>{try{return this.engine.formatMessage(e,n)}catch(i){throw this.logger.error(i.message),i}},this.metadata=t.metadata,this.name=t.name||d,this.core=t.core,this.logger=this.core.logger,this.engine=new D(this)}static async init(t){const e=new p(t);return await e.initialize(),e}async initialize(){this.logger.trace(\"Initialized\");try{await this.engine.init(),this.logger.info(\"Web3Wallet Initialization Success\")}catch(t){throw this.logger.info(\"Web3Wallet Initialization Failure\"),this.logger.error(t.message),t}}}const G=p;\n//# sourceMappingURL=index.es.js.map\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/web3wallet/dist/index.es.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/window-getters/dist/cjs/index.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@walletconnect/window-getters/dist/cjs/index.js ***! - \**********************************************************************/ -/***/ ((__unused_webpack_module, exports) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.getLocalStorage = exports.getLocalStorageOrThrow = exports.getCrypto = exports.getCryptoOrThrow = exports.getLocation = exports.getLocationOrThrow = exports.getNavigator = exports.getNavigatorOrThrow = exports.getDocument = exports.getDocumentOrThrow = exports.getFromWindowOrThrow = exports.getFromWindow = void 0;\nfunction getFromWindow(name) {\n let res = undefined;\n if (typeof window !== \"undefined\" && typeof window[name] !== \"undefined\") {\n res = window[name];\n }\n return res;\n}\nexports.getFromWindow = getFromWindow;\nfunction getFromWindowOrThrow(name) {\n const res = getFromWindow(name);\n if (!res) {\n throw new Error(`${name} is not defined in Window`);\n }\n return res;\n}\nexports.getFromWindowOrThrow = getFromWindowOrThrow;\nfunction getDocumentOrThrow() {\n return getFromWindowOrThrow(\"document\");\n}\nexports.getDocumentOrThrow = getDocumentOrThrow;\nfunction getDocument() {\n return getFromWindow(\"document\");\n}\nexports.getDocument = getDocument;\nfunction getNavigatorOrThrow() {\n return getFromWindowOrThrow(\"navigator\");\n}\nexports.getNavigatorOrThrow = getNavigatorOrThrow;\nfunction getNavigator() {\n return getFromWindow(\"navigator\");\n}\nexports.getNavigator = getNavigator;\nfunction getLocationOrThrow() {\n return getFromWindowOrThrow(\"location\");\n}\nexports.getLocationOrThrow = getLocationOrThrow;\nfunction getLocation() {\n return getFromWindow(\"location\");\n}\nexports.getLocation = getLocation;\nfunction getCryptoOrThrow() {\n return getFromWindowOrThrow(\"crypto\");\n}\nexports.getCryptoOrThrow = getCryptoOrThrow;\nfunction getCrypto() {\n return getFromWindow(\"crypto\");\n}\nexports.getCrypto = getCrypto;\nfunction getLocalStorageOrThrow() {\n return getFromWindowOrThrow(\"localStorage\");\n}\nexports.getLocalStorageOrThrow = getLocalStorageOrThrow;\nfunction getLocalStorage() {\n return getFromWindow(\"localStorage\");\n}\nexports.getLocalStorage = getLocalStorage;\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/window-getters/dist/cjs/index.js?"); - -/***/ }), - -/***/ "./node_modules/@walletconnect/window-metadata/dist/cjs/index.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@walletconnect/window-metadata/dist/cjs/index.js ***! - \***********************************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.getWindowMetadata = void 0;\nconst window_getters_1 = __webpack_require__(/*! @walletconnect/window-getters */ \"./node_modules/@walletconnect/window-getters/dist/cjs/index.js\");\nfunction getWindowMetadata() {\n let doc;\n let loc;\n try {\n doc = window_getters_1.getDocumentOrThrow();\n loc = window_getters_1.getLocationOrThrow();\n }\n catch (e) {\n return null;\n }\n function getIcons() {\n const links = doc.getElementsByTagName(\"link\");\n const icons = [];\n for (let i = 0; i < links.length; i++) {\n const link = links[i];\n const rel = link.getAttribute(\"rel\");\n if (rel) {\n if (rel.toLowerCase().indexOf(\"icon\") > -1) {\n const href = link.getAttribute(\"href\");\n if (href) {\n if (href.toLowerCase().indexOf(\"https:\") === -1 &&\n href.toLowerCase().indexOf(\"http:\") === -1 &&\n href.indexOf(\"//\") !== 0) {\n let absoluteHref = loc.protocol + \"//\" + loc.host;\n if (href.indexOf(\"/\") === 0) {\n absoluteHref += href;\n }\n else {\n const path = loc.pathname.split(\"/\");\n path.pop();\n const finalPath = path.join(\"/\");\n absoluteHref += finalPath + \"/\" + href;\n }\n icons.push(absoluteHref);\n }\n else if (href.indexOf(\"//\") === 0) {\n const absoluteUrl = loc.protocol + href;\n icons.push(absoluteUrl);\n }\n else {\n icons.push(href);\n }\n }\n }\n }\n }\n return icons;\n }\n function getWindowMetadataOfAny(...args) {\n const metaTags = doc.getElementsByTagName(\"meta\");\n for (let i = 0; i < metaTags.length; i++) {\n const tag = metaTags[i];\n const attributes = [\"itemprop\", \"property\", \"name\"]\n .map((target) => tag.getAttribute(target))\n .filter((attr) => {\n if (attr) {\n return args.includes(attr);\n }\n return false;\n });\n if (attributes.length && attributes) {\n const content = tag.getAttribute(\"content\");\n if (content) {\n return content;\n }\n }\n }\n return \"\";\n }\n function getName() {\n let name = getWindowMetadataOfAny(\"name\", \"og:site_name\", \"og:title\", \"twitter:title\");\n if (!name) {\n name = doc.title;\n }\n return name;\n }\n function getDescription() {\n const description = getWindowMetadataOfAny(\"description\", \"og:description\", \"twitter:description\", \"keywords\");\n return description;\n }\n const name = getName();\n const description = getDescription();\n const url = loc.origin;\n const icons = getIcons();\n const meta = {\n description,\n url,\n icons,\n name,\n };\n return meta;\n}\nexports.getWindowMetadata = getWindowMetadata;\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/@walletconnect/window-metadata/dist/cjs/index.js?"); - -/***/ }), - -/***/ "./node_modules/bn.js/lib/bn.js": -/*!**************************************!*\ - !*** ./node_modules/bn.js/lib/bn.js ***! - \**************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -eval("/* module decorator */ module = __webpack_require__.nmd(module);\n(function (module, exports) {\n 'use strict';\n\n // Utils\n function assert (val, msg) {\n if (!val) throw new Error(msg || 'Assertion failed');\n }\n\n // Could use `inherits` module, but don't want to move from single file\n // architecture yet.\n function inherits (ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n\n // BN\n\n function BN (number, base, endian) {\n if (BN.isBN(number)) {\n return number;\n }\n\n this.negative = 0;\n this.words = null;\n this.length = 0;\n\n // Reduction context\n this.red = null;\n\n if (number !== null) {\n if (base === 'le' || base === 'be') {\n endian = base;\n base = 10;\n }\n\n this._init(number || 0, base || 10, endian || 'be');\n }\n }\n if (typeof module === 'object') {\n module.exports = BN;\n } else {\n exports.BN = BN;\n }\n\n BN.BN = BN;\n BN.wordSize = 26;\n\n var Buffer;\n try {\n if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {\n Buffer = window.Buffer;\n } else {\n Buffer = (__webpack_require__(/*! buffer */ \"?8131\").Buffer);\n }\n } catch (e) {\n }\n\n BN.isBN = function isBN (num) {\n if (num instanceof BN) {\n return true;\n }\n\n return num !== null && typeof num === 'object' &&\n num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);\n };\n\n BN.max = function max (left, right) {\n if (left.cmp(right) > 0) return left;\n return right;\n };\n\n BN.min = function min (left, right) {\n if (left.cmp(right) < 0) return left;\n return right;\n };\n\n BN.prototype._init = function init (number, base, endian) {\n if (typeof number === 'number') {\n return this._initNumber(number, base, endian);\n }\n\n if (typeof number === 'object') {\n return this._initArray(number, base, endian);\n }\n\n if (base === 'hex') {\n base = 16;\n }\n assert(base === (base | 0) && base >= 2 && base <= 36);\n\n number = number.toString().replace(/\\s+/g, '');\n var start = 0;\n if (number[0] === '-') {\n start++;\n this.negative = 1;\n }\n\n if (start < number.length) {\n if (base === 16) {\n this._parseHex(number, start, endian);\n } else {\n this._parseBase(number, base, start);\n if (endian === 'le') {\n this._initArray(this.toArray(), base, endian);\n }\n }\n }\n };\n\n BN.prototype._initNumber = function _initNumber (number, base, endian) {\n if (number < 0) {\n this.negative = 1;\n number = -number;\n }\n if (number < 0x4000000) {\n this.words = [number & 0x3ffffff];\n this.length = 1;\n } else if (number < 0x10000000000000) {\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff\n ];\n this.length = 2;\n } else {\n assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff,\n 1\n ];\n this.length = 3;\n }\n\n if (endian !== 'le') return;\n\n // Reverse the bytes\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initArray = function _initArray (number, base, endian) {\n // Perhaps a Uint8Array\n assert(typeof number.length === 'number');\n if (number.length <= 0) {\n this.words = [0];\n this.length = 1;\n return this;\n }\n\n this.length = Math.ceil(number.length / 3);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w;\n var off = 0;\n if (endian === 'be') {\n for (i = number.length - 1, j = 0; i >= 0; i -= 3) {\n w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n } else if (endian === 'le') {\n for (i = 0, j = 0; i < number.length; i += 3) {\n w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n }\n return this._strip();\n };\n\n function parseHex4Bits (string, index) {\n var c = string.charCodeAt(index);\n // '0' - '9'\n if (c >= 48 && c <= 57) {\n return c - 48;\n // 'A' - 'F'\n } else if (c >= 65 && c <= 70) {\n return c - 55;\n // 'a' - 'f'\n } else if (c >= 97 && c <= 102) {\n return c - 87;\n } else {\n assert(false, 'Invalid character in ' + string);\n }\n }\n\n function parseHexByte (string, lowerBound, index) {\n var r = parseHex4Bits(string, index);\n if (index - 1 >= lowerBound) {\n r |= parseHex4Bits(string, index - 1) << 4;\n }\n return r;\n }\n\n BN.prototype._parseHex = function _parseHex (number, start, endian) {\n // Create possibly bigger array to ensure that it fits the number\n this.length = Math.ceil((number.length - start) / 6);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n // 24-bits chunks\n var off = 0;\n var j = 0;\n\n var w;\n if (endian === 'be') {\n for (i = number.length - 1; i >= start; i -= 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n } else {\n var parseLength = number.length - start;\n for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n }\n\n this._strip();\n };\n\n function parseBase (str, start, end, mul) {\n var r = 0;\n var b = 0;\n var len = Math.min(str.length, end);\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n\n r *= mul;\n\n // 'a'\n if (c >= 49) {\n b = c - 49 + 0xa;\n\n // 'A'\n } else if (c >= 17) {\n b = c - 17 + 0xa;\n\n // '0' - '9'\n } else {\n b = c;\n }\n assert(c >= 0 && b < mul, 'Invalid character');\n r += b;\n }\n return r;\n }\n\n BN.prototype._parseBase = function _parseBase (number, base, start) {\n // Initialize as zero\n this.words = [0];\n this.length = 1;\n\n // Find length of limb in base\n for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {\n limbLen++;\n }\n limbLen--;\n limbPow = (limbPow / base) | 0;\n\n var total = number.length - start;\n var mod = total % limbLen;\n var end = Math.min(total, total - mod) + start;\n\n var word = 0;\n for (var i = start; i < end; i += limbLen) {\n word = parseBase(number, i, i + limbLen, base);\n\n this.imuln(limbPow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n if (mod !== 0) {\n var pow = 1;\n word = parseBase(number, i, number.length, base);\n\n for (i = 0; i < mod; i++) {\n pow *= base;\n }\n\n this.imuln(pow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n this._strip();\n };\n\n BN.prototype.copy = function copy (dest) {\n dest.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n dest.words[i] = this.words[i];\n }\n dest.length = this.length;\n dest.negative = this.negative;\n dest.red = this.red;\n };\n\n function move (dest, src) {\n dest.words = src.words;\n dest.length = src.length;\n dest.negative = src.negative;\n dest.red = src.red;\n }\n\n BN.prototype._move = function _move (dest) {\n move(dest, this);\n };\n\n BN.prototype.clone = function clone () {\n var r = new BN(null);\n this.copy(r);\n return r;\n };\n\n BN.prototype._expand = function _expand (size) {\n while (this.length < size) {\n this.words[this.length++] = 0;\n }\n return this;\n };\n\n // Remove leading `0` from `this`\n BN.prototype._strip = function strip () {\n while (this.length > 1 && this.words[this.length - 1] === 0) {\n this.length--;\n }\n return this._normSign();\n };\n\n BN.prototype._normSign = function _normSign () {\n // -0 = 0\n if (this.length === 1 && this.words[0] === 0) {\n this.negative = 0;\n }\n return this;\n };\n\n // Check Symbol.for because not everywhere where Symbol defined\n // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility\n if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') {\n try {\n BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect;\n } catch (e) {\n BN.prototype.inspect = inspect;\n }\n } else {\n BN.prototype.inspect = inspect;\n }\n\n function inspect () {\n return (this.red ? '';\n }\n\n /*\n\n var zeros = [];\n var groupSizes = [];\n var groupBases = [];\n\n var s = '';\n var i = -1;\n while (++i < BN.wordSize) {\n zeros[i] = s;\n s += '0';\n }\n groupSizes[0] = 0;\n groupSizes[1] = 0;\n groupBases[0] = 0;\n groupBases[1] = 0;\n var base = 2 - 1;\n while (++base < 36 + 1) {\n var groupSize = 0;\n var groupBase = 1;\n while (groupBase < (1 << BN.wordSize) / base) {\n groupBase *= base;\n groupSize += 1;\n }\n groupSizes[base] = groupSize;\n groupBases[base] = groupBase;\n }\n\n */\n\n var zeros = [\n '',\n '0',\n '00',\n '000',\n '0000',\n '00000',\n '000000',\n '0000000',\n '00000000',\n '000000000',\n '0000000000',\n '00000000000',\n '000000000000',\n '0000000000000',\n '00000000000000',\n '000000000000000',\n '0000000000000000',\n '00000000000000000',\n '000000000000000000',\n '0000000000000000000',\n '00000000000000000000',\n '000000000000000000000',\n '0000000000000000000000',\n '00000000000000000000000',\n '000000000000000000000000',\n '0000000000000000000000000'\n ];\n\n var groupSizes = [\n 0, 0,\n 25, 16, 12, 11, 10, 9, 8,\n 8, 7, 7, 7, 7, 6, 6,\n 6, 6, 6, 6, 6, 5, 5,\n 5, 5, 5, 5, 5, 5, 5,\n 5, 5, 5, 5, 5, 5, 5\n ];\n\n var groupBases = [\n 0, 0,\n 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,\n 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,\n 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,\n 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,\n 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176\n ];\n\n BN.prototype.toString = function toString (base, padding) {\n base = base || 10;\n padding = padding | 0 || 1;\n\n var out;\n if (base === 16 || base === 'hex') {\n out = '';\n var off = 0;\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i];\n var word = (((w << off) | carry) & 0xffffff).toString(16);\n carry = (w >>> (24 - off)) & 0xffffff;\n off += 2;\n if (off >= 26) {\n off -= 26;\n i--;\n }\n if (carry !== 0 || i !== this.length - 1) {\n out = zeros[6 - word.length] + word + out;\n } else {\n out = word + out;\n }\n }\n if (carry !== 0) {\n out = carry.toString(16) + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n if (base === (base | 0) && base >= 2 && base <= 36) {\n // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));\n var groupSize = groupSizes[base];\n // var groupBase = Math.pow(base, groupSize);\n var groupBase = groupBases[base];\n out = '';\n var c = this.clone();\n c.negative = 0;\n while (!c.isZero()) {\n var r = c.modrn(groupBase).toString(base);\n c = c.idivn(groupBase);\n\n if (!c.isZero()) {\n out = zeros[groupSize - r.length] + r + out;\n } else {\n out = r + out;\n }\n }\n if (this.isZero()) {\n out = '0' + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n assert(false, 'Base should be between 2 and 36');\n };\n\n BN.prototype.toNumber = function toNumber () {\n var ret = this.words[0];\n if (this.length === 2) {\n ret += this.words[1] * 0x4000000;\n } else if (this.length === 3 && this.words[2] === 0x01) {\n // NOTE: at this stage it is known that the top bit is set\n ret += 0x10000000000000 + (this.words[1] * 0x4000000);\n } else if (this.length > 2) {\n assert(false, 'Number can only safely store up to 53 bits');\n }\n return (this.negative !== 0) ? -ret : ret;\n };\n\n BN.prototype.toJSON = function toJSON () {\n return this.toString(16, 2);\n };\n\n if (Buffer) {\n BN.prototype.toBuffer = function toBuffer (endian, length) {\n return this.toArrayLike(Buffer, endian, length);\n };\n }\n\n BN.prototype.toArray = function toArray (endian, length) {\n return this.toArrayLike(Array, endian, length);\n };\n\n var allocate = function allocate (ArrayType, size) {\n if (ArrayType.allocUnsafe) {\n return ArrayType.allocUnsafe(size);\n }\n return new ArrayType(size);\n };\n\n BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {\n this._strip();\n\n var byteLength = this.byteLength();\n var reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, 'byte array longer than desired length');\n assert(reqLength > 0, 'Requested array length <= 0');\n\n var res = allocate(ArrayType, reqLength);\n var postfix = endian === 'le' ? 'LE' : 'BE';\n this['_toArrayLike' + postfix](res, byteLength);\n return res;\n };\n\n BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) {\n var position = 0;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = (this.words[i] << shift) | carry;\n\n res[position++] = word & 0xff;\n if (position < res.length) {\n res[position++] = (word >> 8) & 0xff;\n }\n if (position < res.length) {\n res[position++] = (word >> 16) & 0xff;\n }\n\n if (shift === 6) {\n if (position < res.length) {\n res[position++] = (word >> 24) & 0xff;\n }\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position < res.length) {\n res[position++] = carry;\n\n while (position < res.length) {\n res[position++] = 0;\n }\n }\n };\n\n BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) {\n var position = res.length - 1;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = (this.words[i] << shift) | carry;\n\n res[position--] = word & 0xff;\n if (position >= 0) {\n res[position--] = (word >> 8) & 0xff;\n }\n if (position >= 0) {\n res[position--] = (word >> 16) & 0xff;\n }\n\n if (shift === 6) {\n if (position >= 0) {\n res[position--] = (word >> 24) & 0xff;\n }\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position >= 0) {\n res[position--] = carry;\n\n while (position >= 0) {\n res[position--] = 0;\n }\n }\n };\n\n if (Math.clz32) {\n BN.prototype._countBits = function _countBits (w) {\n return 32 - Math.clz32(w);\n };\n } else {\n BN.prototype._countBits = function _countBits (w) {\n var t = w;\n var r = 0;\n if (t >= 0x1000) {\n r += 13;\n t >>>= 13;\n }\n if (t >= 0x40) {\n r += 7;\n t >>>= 7;\n }\n if (t >= 0x8) {\n r += 4;\n t >>>= 4;\n }\n if (t >= 0x02) {\n r += 2;\n t >>>= 2;\n }\n return r + t;\n };\n }\n\n BN.prototype._zeroBits = function _zeroBits (w) {\n // Short-cut\n if (w === 0) return 26;\n\n var t = w;\n var r = 0;\n if ((t & 0x1fff) === 0) {\n r += 13;\n t >>>= 13;\n }\n if ((t & 0x7f) === 0) {\n r += 7;\n t >>>= 7;\n }\n if ((t & 0xf) === 0) {\n r += 4;\n t >>>= 4;\n }\n if ((t & 0x3) === 0) {\n r += 2;\n t >>>= 2;\n }\n if ((t & 0x1) === 0) {\n r++;\n }\n return r;\n };\n\n // Return number of used bits in a BN\n BN.prototype.bitLength = function bitLength () {\n var w = this.words[this.length - 1];\n var hi = this._countBits(w);\n return (this.length - 1) * 26 + hi;\n };\n\n function toBitArray (num) {\n var w = new Array(num.bitLength());\n\n for (var bit = 0; bit < w.length; bit++) {\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n w[bit] = (num.words[off] >>> wbit) & 0x01;\n }\n\n return w;\n }\n\n // Number of trailing zero bits\n BN.prototype.zeroBits = function zeroBits () {\n if (this.isZero()) return 0;\n\n var r = 0;\n for (var i = 0; i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n r += b;\n if (b !== 26) break;\n }\n return r;\n };\n\n BN.prototype.byteLength = function byteLength () {\n return Math.ceil(this.bitLength() / 8);\n };\n\n BN.prototype.toTwos = function toTwos (width) {\n if (this.negative !== 0) {\n return this.abs().inotn(width).iaddn(1);\n }\n return this.clone();\n };\n\n BN.prototype.fromTwos = function fromTwos (width) {\n if (this.testn(width - 1)) {\n return this.notn(width).iaddn(1).ineg();\n }\n return this.clone();\n };\n\n BN.prototype.isNeg = function isNeg () {\n return this.negative !== 0;\n };\n\n // Return negative clone of `this`\n BN.prototype.neg = function neg () {\n return this.clone().ineg();\n };\n\n BN.prototype.ineg = function ineg () {\n if (!this.isZero()) {\n this.negative ^= 1;\n }\n\n return this;\n };\n\n // Or `num` with `this` in-place\n BN.prototype.iuor = function iuor (num) {\n while (this.length < num.length) {\n this.words[this.length++] = 0;\n }\n\n for (var i = 0; i < num.length; i++) {\n this.words[i] = this.words[i] | num.words[i];\n }\n\n return this._strip();\n };\n\n BN.prototype.ior = function ior (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuor(num);\n };\n\n // Or `num` with `this`\n BN.prototype.or = function or (num) {\n if (this.length > num.length) return this.clone().ior(num);\n return num.clone().ior(this);\n };\n\n BN.prototype.uor = function uor (num) {\n if (this.length > num.length) return this.clone().iuor(num);\n return num.clone().iuor(this);\n };\n\n // And `num` with `this` in-place\n BN.prototype.iuand = function iuand (num) {\n // b = min-length(num, this)\n var b;\n if (this.length > num.length) {\n b = num;\n } else {\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = this.words[i] & num.words[i];\n }\n\n this.length = b.length;\n\n return this._strip();\n };\n\n BN.prototype.iand = function iand (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuand(num);\n };\n\n // And `num` with `this`\n BN.prototype.and = function and (num) {\n if (this.length > num.length) return this.clone().iand(num);\n return num.clone().iand(this);\n };\n\n BN.prototype.uand = function uand (num) {\n if (this.length > num.length) return this.clone().iuand(num);\n return num.clone().iuand(this);\n };\n\n // Xor `num` with `this` in-place\n BN.prototype.iuxor = function iuxor (num) {\n // a.length > b.length\n var a;\n var b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = a.words[i] ^ b.words[i];\n }\n\n if (this !== a) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = a.length;\n\n return this._strip();\n };\n\n BN.prototype.ixor = function ixor (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuxor(num);\n };\n\n // Xor `num` with `this`\n BN.prototype.xor = function xor (num) {\n if (this.length > num.length) return this.clone().ixor(num);\n return num.clone().ixor(this);\n };\n\n BN.prototype.uxor = function uxor (num) {\n if (this.length > num.length) return this.clone().iuxor(num);\n return num.clone().iuxor(this);\n };\n\n // Not ``this`` with ``width`` bitwidth\n BN.prototype.inotn = function inotn (width) {\n assert(typeof width === 'number' && width >= 0);\n\n var bytesNeeded = Math.ceil(width / 26) | 0;\n var bitsLeft = width % 26;\n\n // Extend the buffer with leading zeroes\n this._expand(bytesNeeded);\n\n if (bitsLeft > 0) {\n bytesNeeded--;\n }\n\n // Handle complete words\n for (var i = 0; i < bytesNeeded; i++) {\n this.words[i] = ~this.words[i] & 0x3ffffff;\n }\n\n // Handle the residue\n if (bitsLeft > 0) {\n this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));\n }\n\n // And remove leading zeroes\n return this._strip();\n };\n\n BN.prototype.notn = function notn (width) {\n return this.clone().inotn(width);\n };\n\n // Set `bit` of `this`\n BN.prototype.setn = function setn (bit, val) {\n assert(typeof bit === 'number' && bit >= 0);\n\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n this._expand(off + 1);\n\n if (val) {\n this.words[off] = this.words[off] | (1 << wbit);\n } else {\n this.words[off] = this.words[off] & ~(1 << wbit);\n }\n\n return this._strip();\n };\n\n // Add `num` to `this` in-place\n BN.prototype.iadd = function iadd (num) {\n var r;\n\n // negative + positive\n if (this.negative !== 0 && num.negative === 0) {\n this.negative = 0;\n r = this.isub(num);\n this.negative ^= 1;\n return this._normSign();\n\n // positive + negative\n } else if (this.negative === 0 && num.negative !== 0) {\n num.negative = 0;\n r = this.isub(num);\n num.negative = 1;\n return r._normSign();\n }\n\n // a.length > b.length\n var a, b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n this.length = a.length;\n if (carry !== 0) {\n this.words[this.length] = carry;\n this.length++;\n // Copy the rest of the words\n } else if (a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n return this;\n };\n\n // Add `num` to `this`\n BN.prototype.add = function add (num) {\n var res;\n if (num.negative !== 0 && this.negative === 0) {\n num.negative = 0;\n res = this.sub(num);\n num.negative ^= 1;\n return res;\n } else if (num.negative === 0 && this.negative !== 0) {\n this.negative = 0;\n res = num.sub(this);\n this.negative = 1;\n return res;\n }\n\n if (this.length > num.length) return this.clone().iadd(num);\n\n return num.clone().iadd(this);\n };\n\n // Subtract `num` from `this` in-place\n BN.prototype.isub = function isub (num) {\n // this - (-num) = this + num\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n num.negative = 1;\n return r._normSign();\n\n // -this - num = -(this + num)\n } else if (this.negative !== 0) {\n this.negative = 0;\n this.iadd(num);\n this.negative = 1;\n return this._normSign();\n }\n\n // At this point both numbers are positive\n var cmp = this.cmp(num);\n\n // Optimization - zeroify\n if (cmp === 0) {\n this.negative = 0;\n this.length = 1;\n this.words[0] = 0;\n return this;\n }\n\n // a > b\n var a, b;\n if (cmp > 0) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n\n // Copy rest of the words\n if (carry === 0 && i < a.length && a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = Math.max(this.length, i);\n\n if (a !== this) {\n this.negative = 1;\n }\n\n return this._strip();\n };\n\n // Subtract `num` from `this`\n BN.prototype.sub = function sub (num) {\n return this.clone().isub(num);\n };\n\n function smallMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n var len = (self.length + num.length) | 0;\n out.length = len;\n len = (len - 1) | 0;\n\n // Peel one iteration (compiler can't do it, because of code complexity)\n var a = self.words[0] | 0;\n var b = num.words[0] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n var carry = (r / 0x4000000) | 0;\n out.words[0] = lo;\n\n for (var k = 1; k < len; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = carry >>> 26;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = (k - j) | 0;\n a = self.words[i] | 0;\n b = num.words[j] | 0;\n r = a * b + rword;\n ncarry += (r / 0x4000000) | 0;\n rword = r & 0x3ffffff;\n }\n out.words[k] = rword | 0;\n carry = ncarry | 0;\n }\n if (carry !== 0) {\n out.words[k] = carry | 0;\n } else {\n out.length--;\n }\n\n return out._strip();\n }\n\n // TODO(indutny): it may be reasonable to omit it for users who don't need\n // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit\n // multiplication (like elliptic secp256k1).\n var comb10MulTo = function comb10MulTo (self, num, out) {\n var a = self.words;\n var b = num.words;\n var o = out.words;\n var c = 0;\n var lo;\n var mid;\n var hi;\n var a0 = a[0] | 0;\n var al0 = a0 & 0x1fff;\n var ah0 = a0 >>> 13;\n var a1 = a[1] | 0;\n var al1 = a1 & 0x1fff;\n var ah1 = a1 >>> 13;\n var a2 = a[2] | 0;\n var al2 = a2 & 0x1fff;\n var ah2 = a2 >>> 13;\n var a3 = a[3] | 0;\n var al3 = a3 & 0x1fff;\n var ah3 = a3 >>> 13;\n var a4 = a[4] | 0;\n var al4 = a4 & 0x1fff;\n var ah4 = a4 >>> 13;\n var a5 = a[5] | 0;\n var al5 = a5 & 0x1fff;\n var ah5 = a5 >>> 13;\n var a6 = a[6] | 0;\n var al6 = a6 & 0x1fff;\n var ah6 = a6 >>> 13;\n var a7 = a[7] | 0;\n var al7 = a7 & 0x1fff;\n var ah7 = a7 >>> 13;\n var a8 = a[8] | 0;\n var al8 = a8 & 0x1fff;\n var ah8 = a8 >>> 13;\n var a9 = a[9] | 0;\n var al9 = a9 & 0x1fff;\n var ah9 = a9 >>> 13;\n var b0 = b[0] | 0;\n var bl0 = b0 & 0x1fff;\n var bh0 = b0 >>> 13;\n var b1 = b[1] | 0;\n var bl1 = b1 & 0x1fff;\n var bh1 = b1 >>> 13;\n var b2 = b[2] | 0;\n var bl2 = b2 & 0x1fff;\n var bh2 = b2 >>> 13;\n var b3 = b[3] | 0;\n var bl3 = b3 & 0x1fff;\n var bh3 = b3 >>> 13;\n var b4 = b[4] | 0;\n var bl4 = b4 & 0x1fff;\n var bh4 = b4 >>> 13;\n var b5 = b[5] | 0;\n var bl5 = b5 & 0x1fff;\n var bh5 = b5 >>> 13;\n var b6 = b[6] | 0;\n var bl6 = b6 & 0x1fff;\n var bh6 = b6 >>> 13;\n var b7 = b[7] | 0;\n var bl7 = b7 & 0x1fff;\n var bh7 = b7 >>> 13;\n var b8 = b[8] | 0;\n var bl8 = b8 & 0x1fff;\n var bh8 = b8 >>> 13;\n var b9 = b[9] | 0;\n var bl9 = b9 & 0x1fff;\n var bh9 = b9 >>> 13;\n\n out.negative = self.negative ^ num.negative;\n out.length = 19;\n /* k = 0 */\n lo = Math.imul(al0, bl0);\n mid = Math.imul(al0, bh0);\n mid = (mid + Math.imul(ah0, bl0)) | 0;\n hi = Math.imul(ah0, bh0);\n var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;\n w0 &= 0x3ffffff;\n /* k = 1 */\n lo = Math.imul(al1, bl0);\n mid = Math.imul(al1, bh0);\n mid = (mid + Math.imul(ah1, bl0)) | 0;\n hi = Math.imul(ah1, bh0);\n lo = (lo + Math.imul(al0, bl1)) | 0;\n mid = (mid + Math.imul(al0, bh1)) | 0;\n mid = (mid + Math.imul(ah0, bl1)) | 0;\n hi = (hi + Math.imul(ah0, bh1)) | 0;\n var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;\n w1 &= 0x3ffffff;\n /* k = 2 */\n lo = Math.imul(al2, bl0);\n mid = Math.imul(al2, bh0);\n mid = (mid + Math.imul(ah2, bl0)) | 0;\n hi = Math.imul(ah2, bh0);\n lo = (lo + Math.imul(al1, bl1)) | 0;\n mid = (mid + Math.imul(al1, bh1)) | 0;\n mid = (mid + Math.imul(ah1, bl1)) | 0;\n hi = (hi + Math.imul(ah1, bh1)) | 0;\n lo = (lo + Math.imul(al0, bl2)) | 0;\n mid = (mid + Math.imul(al0, bh2)) | 0;\n mid = (mid + Math.imul(ah0, bl2)) | 0;\n hi = (hi + Math.imul(ah0, bh2)) | 0;\n var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;\n w2 &= 0x3ffffff;\n /* k = 3 */\n lo = Math.imul(al3, bl0);\n mid = Math.imul(al3, bh0);\n mid = (mid + Math.imul(ah3, bl0)) | 0;\n hi = Math.imul(ah3, bh0);\n lo = (lo + Math.imul(al2, bl1)) | 0;\n mid = (mid + Math.imul(al2, bh1)) | 0;\n mid = (mid + Math.imul(ah2, bl1)) | 0;\n hi = (hi + Math.imul(ah2, bh1)) | 0;\n lo = (lo + Math.imul(al1, bl2)) | 0;\n mid = (mid + Math.imul(al1, bh2)) | 0;\n mid = (mid + Math.imul(ah1, bl2)) | 0;\n hi = (hi + Math.imul(ah1, bh2)) | 0;\n lo = (lo + Math.imul(al0, bl3)) | 0;\n mid = (mid + Math.imul(al0, bh3)) | 0;\n mid = (mid + Math.imul(ah0, bl3)) | 0;\n hi = (hi + Math.imul(ah0, bh3)) | 0;\n var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;\n w3 &= 0x3ffffff;\n /* k = 4 */\n lo = Math.imul(al4, bl0);\n mid = Math.imul(al4, bh0);\n mid = (mid + Math.imul(ah4, bl0)) | 0;\n hi = Math.imul(ah4, bh0);\n lo = (lo + Math.imul(al3, bl1)) | 0;\n mid = (mid + Math.imul(al3, bh1)) | 0;\n mid = (mid + Math.imul(ah3, bl1)) | 0;\n hi = (hi + Math.imul(ah3, bh1)) | 0;\n lo = (lo + Math.imul(al2, bl2)) | 0;\n mid = (mid + Math.imul(al2, bh2)) | 0;\n mid = (mid + Math.imul(ah2, bl2)) | 0;\n hi = (hi + Math.imul(ah2, bh2)) | 0;\n lo = (lo + Math.imul(al1, bl3)) | 0;\n mid = (mid + Math.imul(al1, bh3)) | 0;\n mid = (mid + Math.imul(ah1, bl3)) | 0;\n hi = (hi + Math.imul(ah1, bh3)) | 0;\n lo = (lo + Math.imul(al0, bl4)) | 0;\n mid = (mid + Math.imul(al0, bh4)) | 0;\n mid = (mid + Math.imul(ah0, bl4)) | 0;\n hi = (hi + Math.imul(ah0, bh4)) | 0;\n var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;\n w4 &= 0x3ffffff;\n /* k = 5 */\n lo = Math.imul(al5, bl0);\n mid = Math.imul(al5, bh0);\n mid = (mid + Math.imul(ah5, bl0)) | 0;\n hi = Math.imul(ah5, bh0);\n lo = (lo + Math.imul(al4, bl1)) | 0;\n mid = (mid + Math.imul(al4, bh1)) | 0;\n mid = (mid + Math.imul(ah4, bl1)) | 0;\n hi = (hi + Math.imul(ah4, bh1)) | 0;\n lo = (lo + Math.imul(al3, bl2)) | 0;\n mid = (mid + Math.imul(al3, bh2)) | 0;\n mid = (mid + Math.imul(ah3, bl2)) | 0;\n hi = (hi + Math.imul(ah3, bh2)) | 0;\n lo = (lo + Math.imul(al2, bl3)) | 0;\n mid = (mid + Math.imul(al2, bh3)) | 0;\n mid = (mid + Math.imul(ah2, bl3)) | 0;\n hi = (hi + Math.imul(ah2, bh3)) | 0;\n lo = (lo + Math.imul(al1, bl4)) | 0;\n mid = (mid + Math.imul(al1, bh4)) | 0;\n mid = (mid + Math.imul(ah1, bl4)) | 0;\n hi = (hi + Math.imul(ah1, bh4)) | 0;\n lo = (lo + Math.imul(al0, bl5)) | 0;\n mid = (mid + Math.imul(al0, bh5)) | 0;\n mid = (mid + Math.imul(ah0, bl5)) | 0;\n hi = (hi + Math.imul(ah0, bh5)) | 0;\n var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;\n w5 &= 0x3ffffff;\n /* k = 6 */\n lo = Math.imul(al6, bl0);\n mid = Math.imul(al6, bh0);\n mid = (mid + Math.imul(ah6, bl0)) | 0;\n hi = Math.imul(ah6, bh0);\n lo = (lo + Math.imul(al5, bl1)) | 0;\n mid = (mid + Math.imul(al5, bh1)) | 0;\n mid = (mid + Math.imul(ah5, bl1)) | 0;\n hi = (hi + Math.imul(ah5, bh1)) | 0;\n lo = (lo + Math.imul(al4, bl2)) | 0;\n mid = (mid + Math.imul(al4, bh2)) | 0;\n mid = (mid + Math.imul(ah4, bl2)) | 0;\n hi = (hi + Math.imul(ah4, bh2)) | 0;\n lo = (lo + Math.imul(al3, bl3)) | 0;\n mid = (mid + Math.imul(al3, bh3)) | 0;\n mid = (mid + Math.imul(ah3, bl3)) | 0;\n hi = (hi + Math.imul(ah3, bh3)) | 0;\n lo = (lo + Math.imul(al2, bl4)) | 0;\n mid = (mid + Math.imul(al2, bh4)) | 0;\n mid = (mid + Math.imul(ah2, bl4)) | 0;\n hi = (hi + Math.imul(ah2, bh4)) | 0;\n lo = (lo + Math.imul(al1, bl5)) | 0;\n mid = (mid + Math.imul(al1, bh5)) | 0;\n mid = (mid + Math.imul(ah1, bl5)) | 0;\n hi = (hi + Math.imul(ah1, bh5)) | 0;\n lo = (lo + Math.imul(al0, bl6)) | 0;\n mid = (mid + Math.imul(al0, bh6)) | 0;\n mid = (mid + Math.imul(ah0, bl6)) | 0;\n hi = (hi + Math.imul(ah0, bh6)) | 0;\n var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;\n w6 &= 0x3ffffff;\n /* k = 7 */\n lo = Math.imul(al7, bl0);\n mid = Math.imul(al7, bh0);\n mid = (mid + Math.imul(ah7, bl0)) | 0;\n hi = Math.imul(ah7, bh0);\n lo = (lo + Math.imul(al6, bl1)) | 0;\n mid = (mid + Math.imul(al6, bh1)) | 0;\n mid = (mid + Math.imul(ah6, bl1)) | 0;\n hi = (hi + Math.imul(ah6, bh1)) | 0;\n lo = (lo + Math.imul(al5, bl2)) | 0;\n mid = (mid + Math.imul(al5, bh2)) | 0;\n mid = (mid + Math.imul(ah5, bl2)) | 0;\n hi = (hi + Math.imul(ah5, bh2)) | 0;\n lo = (lo + Math.imul(al4, bl3)) | 0;\n mid = (mid + Math.imul(al4, bh3)) | 0;\n mid = (mid + Math.imul(ah4, bl3)) | 0;\n hi = (hi + Math.imul(ah4, bh3)) | 0;\n lo = (lo + Math.imul(al3, bl4)) | 0;\n mid = (mid + Math.imul(al3, bh4)) | 0;\n mid = (mid + Math.imul(ah3, bl4)) | 0;\n hi = (hi + Math.imul(ah3, bh4)) | 0;\n lo = (lo + Math.imul(al2, bl5)) | 0;\n mid = (mid + Math.imul(al2, bh5)) | 0;\n mid = (mid + Math.imul(ah2, bl5)) | 0;\n hi = (hi + Math.imul(ah2, bh5)) | 0;\n lo = (lo + Math.imul(al1, bl6)) | 0;\n mid = (mid + Math.imul(al1, bh6)) | 0;\n mid = (mid + Math.imul(ah1, bl6)) | 0;\n hi = (hi + Math.imul(ah1, bh6)) | 0;\n lo = (lo + Math.imul(al0, bl7)) | 0;\n mid = (mid + Math.imul(al0, bh7)) | 0;\n mid = (mid + Math.imul(ah0, bl7)) | 0;\n hi = (hi + Math.imul(ah0, bh7)) | 0;\n var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;\n w7 &= 0x3ffffff;\n /* k = 8 */\n lo = Math.imul(al8, bl0);\n mid = Math.imul(al8, bh0);\n mid = (mid + Math.imul(ah8, bl0)) | 0;\n hi = Math.imul(ah8, bh0);\n lo = (lo + Math.imul(al7, bl1)) | 0;\n mid = (mid + Math.imul(al7, bh1)) | 0;\n mid = (mid + Math.imul(ah7, bl1)) | 0;\n hi = (hi + Math.imul(ah7, bh1)) | 0;\n lo = (lo + Math.imul(al6, bl2)) | 0;\n mid = (mid + Math.imul(al6, bh2)) | 0;\n mid = (mid + Math.imul(ah6, bl2)) | 0;\n hi = (hi + Math.imul(ah6, bh2)) | 0;\n lo = (lo + Math.imul(al5, bl3)) | 0;\n mid = (mid + Math.imul(al5, bh3)) | 0;\n mid = (mid + Math.imul(ah5, bl3)) | 0;\n hi = (hi + Math.imul(ah5, bh3)) | 0;\n lo = (lo + Math.imul(al4, bl4)) | 0;\n mid = (mid + Math.imul(al4, bh4)) | 0;\n mid = (mid + Math.imul(ah4, bl4)) | 0;\n hi = (hi + Math.imul(ah4, bh4)) | 0;\n lo = (lo + Math.imul(al3, bl5)) | 0;\n mid = (mid + Math.imul(al3, bh5)) | 0;\n mid = (mid + Math.imul(ah3, bl5)) | 0;\n hi = (hi + Math.imul(ah3, bh5)) | 0;\n lo = (lo + Math.imul(al2, bl6)) | 0;\n mid = (mid + Math.imul(al2, bh6)) | 0;\n mid = (mid + Math.imul(ah2, bl6)) | 0;\n hi = (hi + Math.imul(ah2, bh6)) | 0;\n lo = (lo + Math.imul(al1, bl7)) | 0;\n mid = (mid + Math.imul(al1, bh7)) | 0;\n mid = (mid + Math.imul(ah1, bl7)) | 0;\n hi = (hi + Math.imul(ah1, bh7)) | 0;\n lo = (lo + Math.imul(al0, bl8)) | 0;\n mid = (mid + Math.imul(al0, bh8)) | 0;\n mid = (mid + Math.imul(ah0, bl8)) | 0;\n hi = (hi + Math.imul(ah0, bh8)) | 0;\n var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;\n w8 &= 0x3ffffff;\n /* k = 9 */\n lo = Math.imul(al9, bl0);\n mid = Math.imul(al9, bh0);\n mid = (mid + Math.imul(ah9, bl0)) | 0;\n hi = Math.imul(ah9, bh0);\n lo = (lo + Math.imul(al8, bl1)) | 0;\n mid = (mid + Math.imul(al8, bh1)) | 0;\n mid = (mid + Math.imul(ah8, bl1)) | 0;\n hi = (hi + Math.imul(ah8, bh1)) | 0;\n lo = (lo + Math.imul(al7, bl2)) | 0;\n mid = (mid + Math.imul(al7, bh2)) | 0;\n mid = (mid + Math.imul(ah7, bl2)) | 0;\n hi = (hi + Math.imul(ah7, bh2)) | 0;\n lo = (lo + Math.imul(al6, bl3)) | 0;\n mid = (mid + Math.imul(al6, bh3)) | 0;\n mid = (mid + Math.imul(ah6, bl3)) | 0;\n hi = (hi + Math.imul(ah6, bh3)) | 0;\n lo = (lo + Math.imul(al5, bl4)) | 0;\n mid = (mid + Math.imul(al5, bh4)) | 0;\n mid = (mid + Math.imul(ah5, bl4)) | 0;\n hi = (hi + Math.imul(ah5, bh4)) | 0;\n lo = (lo + Math.imul(al4, bl5)) | 0;\n mid = (mid + Math.imul(al4, bh5)) | 0;\n mid = (mid + Math.imul(ah4, bl5)) | 0;\n hi = (hi + Math.imul(ah4, bh5)) | 0;\n lo = (lo + Math.imul(al3, bl6)) | 0;\n mid = (mid + Math.imul(al3, bh6)) | 0;\n mid = (mid + Math.imul(ah3, bl6)) | 0;\n hi = (hi + Math.imul(ah3, bh6)) | 0;\n lo = (lo + Math.imul(al2, bl7)) | 0;\n mid = (mid + Math.imul(al2, bh7)) | 0;\n mid = (mid + Math.imul(ah2, bl7)) | 0;\n hi = (hi + Math.imul(ah2, bh7)) | 0;\n lo = (lo + Math.imul(al1, bl8)) | 0;\n mid = (mid + Math.imul(al1, bh8)) | 0;\n mid = (mid + Math.imul(ah1, bl8)) | 0;\n hi = (hi + Math.imul(ah1, bh8)) | 0;\n lo = (lo + Math.imul(al0, bl9)) | 0;\n mid = (mid + Math.imul(al0, bh9)) | 0;\n mid = (mid + Math.imul(ah0, bl9)) | 0;\n hi = (hi + Math.imul(ah0, bh9)) | 0;\n var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;\n w9 &= 0x3ffffff;\n /* k = 10 */\n lo = Math.imul(al9, bl1);\n mid = Math.imul(al9, bh1);\n mid = (mid + Math.imul(ah9, bl1)) | 0;\n hi = Math.imul(ah9, bh1);\n lo = (lo + Math.imul(al8, bl2)) | 0;\n mid = (mid + Math.imul(al8, bh2)) | 0;\n mid = (mid + Math.imul(ah8, bl2)) | 0;\n hi = (hi + Math.imul(ah8, bh2)) | 0;\n lo = (lo + Math.imul(al7, bl3)) | 0;\n mid = (mid + Math.imul(al7, bh3)) | 0;\n mid = (mid + Math.imul(ah7, bl3)) | 0;\n hi = (hi + Math.imul(ah7, bh3)) | 0;\n lo = (lo + Math.imul(al6, bl4)) | 0;\n mid = (mid + Math.imul(al6, bh4)) | 0;\n mid = (mid + Math.imul(ah6, bl4)) | 0;\n hi = (hi + Math.imul(ah6, bh4)) | 0;\n lo = (lo + Math.imul(al5, bl5)) | 0;\n mid = (mid + Math.imul(al5, bh5)) | 0;\n mid = (mid + Math.imul(ah5, bl5)) | 0;\n hi = (hi + Math.imul(ah5, bh5)) | 0;\n lo = (lo + Math.imul(al4, bl6)) | 0;\n mid = (mid + Math.imul(al4, bh6)) | 0;\n mid = (mid + Math.imul(ah4, bl6)) | 0;\n hi = (hi + Math.imul(ah4, bh6)) | 0;\n lo = (lo + Math.imul(al3, bl7)) | 0;\n mid = (mid + Math.imul(al3, bh7)) | 0;\n mid = (mid + Math.imul(ah3, bl7)) | 0;\n hi = (hi + Math.imul(ah3, bh7)) | 0;\n lo = (lo + Math.imul(al2, bl8)) | 0;\n mid = (mid + Math.imul(al2, bh8)) | 0;\n mid = (mid + Math.imul(ah2, bl8)) | 0;\n hi = (hi + Math.imul(ah2, bh8)) | 0;\n lo = (lo + Math.imul(al1, bl9)) | 0;\n mid = (mid + Math.imul(al1, bh9)) | 0;\n mid = (mid + Math.imul(ah1, bl9)) | 0;\n hi = (hi + Math.imul(ah1, bh9)) | 0;\n var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;\n w10 &= 0x3ffffff;\n /* k = 11 */\n lo = Math.imul(al9, bl2);\n mid = Math.imul(al9, bh2);\n mid = (mid + Math.imul(ah9, bl2)) | 0;\n hi = Math.imul(ah9, bh2);\n lo = (lo + Math.imul(al8, bl3)) | 0;\n mid = (mid + Math.imul(al8, bh3)) | 0;\n mid = (mid + Math.imul(ah8, bl3)) | 0;\n hi = (hi + Math.imul(ah8, bh3)) | 0;\n lo = (lo + Math.imul(al7, bl4)) | 0;\n mid = (mid + Math.imul(al7, bh4)) | 0;\n mid = (mid + Math.imul(ah7, bl4)) | 0;\n hi = (hi + Math.imul(ah7, bh4)) | 0;\n lo = (lo + Math.imul(al6, bl5)) | 0;\n mid = (mid + Math.imul(al6, bh5)) | 0;\n mid = (mid + Math.imul(ah6, bl5)) | 0;\n hi = (hi + Math.imul(ah6, bh5)) | 0;\n lo = (lo + Math.imul(al5, bl6)) | 0;\n mid = (mid + Math.imul(al5, bh6)) | 0;\n mid = (mid + Math.imul(ah5, bl6)) | 0;\n hi = (hi + Math.imul(ah5, bh6)) | 0;\n lo = (lo + Math.imul(al4, bl7)) | 0;\n mid = (mid + Math.imul(al4, bh7)) | 0;\n mid = (mid + Math.imul(ah4, bl7)) | 0;\n hi = (hi + Math.imul(ah4, bh7)) | 0;\n lo = (lo + Math.imul(al3, bl8)) | 0;\n mid = (mid + Math.imul(al3, bh8)) | 0;\n mid = (mid + Math.imul(ah3, bl8)) | 0;\n hi = (hi + Math.imul(ah3, bh8)) | 0;\n lo = (lo + Math.imul(al2, bl9)) | 0;\n mid = (mid + Math.imul(al2, bh9)) | 0;\n mid = (mid + Math.imul(ah2, bl9)) | 0;\n hi = (hi + Math.imul(ah2, bh9)) | 0;\n var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;\n w11 &= 0x3ffffff;\n /* k = 12 */\n lo = Math.imul(al9, bl3);\n mid = Math.imul(al9, bh3);\n mid = (mid + Math.imul(ah9, bl3)) | 0;\n hi = Math.imul(ah9, bh3);\n lo = (lo + Math.imul(al8, bl4)) | 0;\n mid = (mid + Math.imul(al8, bh4)) | 0;\n mid = (mid + Math.imul(ah8, bl4)) | 0;\n hi = (hi + Math.imul(ah8, bh4)) | 0;\n lo = (lo + Math.imul(al7, bl5)) | 0;\n mid = (mid + Math.imul(al7, bh5)) | 0;\n mid = (mid + Math.imul(ah7, bl5)) | 0;\n hi = (hi + Math.imul(ah7, bh5)) | 0;\n lo = (lo + Math.imul(al6, bl6)) | 0;\n mid = (mid + Math.imul(al6, bh6)) | 0;\n mid = (mid + Math.imul(ah6, bl6)) | 0;\n hi = (hi + Math.imul(ah6, bh6)) | 0;\n lo = (lo + Math.imul(al5, bl7)) | 0;\n mid = (mid + Math.imul(al5, bh7)) | 0;\n mid = (mid + Math.imul(ah5, bl7)) | 0;\n hi = (hi + Math.imul(ah5, bh7)) | 0;\n lo = (lo + Math.imul(al4, bl8)) | 0;\n mid = (mid + Math.imul(al4, bh8)) | 0;\n mid = (mid + Math.imul(ah4, bl8)) | 0;\n hi = (hi + Math.imul(ah4, bh8)) | 0;\n lo = (lo + Math.imul(al3, bl9)) | 0;\n mid = (mid + Math.imul(al3, bh9)) | 0;\n mid = (mid + Math.imul(ah3, bl9)) | 0;\n hi = (hi + Math.imul(ah3, bh9)) | 0;\n var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;\n w12 &= 0x3ffffff;\n /* k = 13 */\n lo = Math.imul(al9, bl4);\n mid = Math.imul(al9, bh4);\n mid = (mid + Math.imul(ah9, bl4)) | 0;\n hi = Math.imul(ah9, bh4);\n lo = (lo + Math.imul(al8, bl5)) | 0;\n mid = (mid + Math.imul(al8, bh5)) | 0;\n mid = (mid + Math.imul(ah8, bl5)) | 0;\n hi = (hi + Math.imul(ah8, bh5)) | 0;\n lo = (lo + Math.imul(al7, bl6)) | 0;\n mid = (mid + Math.imul(al7, bh6)) | 0;\n mid = (mid + Math.imul(ah7, bl6)) | 0;\n hi = (hi + Math.imul(ah7, bh6)) | 0;\n lo = (lo + Math.imul(al6, bl7)) | 0;\n mid = (mid + Math.imul(al6, bh7)) | 0;\n mid = (mid + Math.imul(ah6, bl7)) | 0;\n hi = (hi + Math.imul(ah6, bh7)) | 0;\n lo = (lo + Math.imul(al5, bl8)) | 0;\n mid = (mid + Math.imul(al5, bh8)) | 0;\n mid = (mid + Math.imul(ah5, bl8)) | 0;\n hi = (hi + Math.imul(ah5, bh8)) | 0;\n lo = (lo + Math.imul(al4, bl9)) | 0;\n mid = (mid + Math.imul(al4, bh9)) | 0;\n mid = (mid + Math.imul(ah4, bl9)) | 0;\n hi = (hi + Math.imul(ah4, bh9)) | 0;\n var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;\n w13 &= 0x3ffffff;\n /* k = 14 */\n lo = Math.imul(al9, bl5);\n mid = Math.imul(al9, bh5);\n mid = (mid + Math.imul(ah9, bl5)) | 0;\n hi = Math.imul(ah9, bh5);\n lo = (lo + Math.imul(al8, bl6)) | 0;\n mid = (mid + Math.imul(al8, bh6)) | 0;\n mid = (mid + Math.imul(ah8, bl6)) | 0;\n hi = (hi + Math.imul(ah8, bh6)) | 0;\n lo = (lo + Math.imul(al7, bl7)) | 0;\n mid = (mid + Math.imul(al7, bh7)) | 0;\n mid = (mid + Math.imul(ah7, bl7)) | 0;\n hi = (hi + Math.imul(ah7, bh7)) | 0;\n lo = (lo + Math.imul(al6, bl8)) | 0;\n mid = (mid + Math.imul(al6, bh8)) | 0;\n mid = (mid + Math.imul(ah6, bl8)) | 0;\n hi = (hi + Math.imul(ah6, bh8)) | 0;\n lo = (lo + Math.imul(al5, bl9)) | 0;\n mid = (mid + Math.imul(al5, bh9)) | 0;\n mid = (mid + Math.imul(ah5, bl9)) | 0;\n hi = (hi + Math.imul(ah5, bh9)) | 0;\n var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;\n w14 &= 0x3ffffff;\n /* k = 15 */\n lo = Math.imul(al9, bl6);\n mid = Math.imul(al9, bh6);\n mid = (mid + Math.imul(ah9, bl6)) | 0;\n hi = Math.imul(ah9, bh6);\n lo = (lo + Math.imul(al8, bl7)) | 0;\n mid = (mid + Math.imul(al8, bh7)) | 0;\n mid = (mid + Math.imul(ah8, bl7)) | 0;\n hi = (hi + Math.imul(ah8, bh7)) | 0;\n lo = (lo + Math.imul(al7, bl8)) | 0;\n mid = (mid + Math.imul(al7, bh8)) | 0;\n mid = (mid + Math.imul(ah7, bl8)) | 0;\n hi = (hi + Math.imul(ah7, bh8)) | 0;\n lo = (lo + Math.imul(al6, bl9)) | 0;\n mid = (mid + Math.imul(al6, bh9)) | 0;\n mid = (mid + Math.imul(ah6, bl9)) | 0;\n hi = (hi + Math.imul(ah6, bh9)) | 0;\n var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;\n w15 &= 0x3ffffff;\n /* k = 16 */\n lo = Math.imul(al9, bl7);\n mid = Math.imul(al9, bh7);\n mid = (mid + Math.imul(ah9, bl7)) | 0;\n hi = Math.imul(ah9, bh7);\n lo = (lo + Math.imul(al8, bl8)) | 0;\n mid = (mid + Math.imul(al8, bh8)) | 0;\n mid = (mid + Math.imul(ah8, bl8)) | 0;\n hi = (hi + Math.imul(ah8, bh8)) | 0;\n lo = (lo + Math.imul(al7, bl9)) | 0;\n mid = (mid + Math.imul(al7, bh9)) | 0;\n mid = (mid + Math.imul(ah7, bl9)) | 0;\n hi = (hi + Math.imul(ah7, bh9)) | 0;\n var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;\n w16 &= 0x3ffffff;\n /* k = 17 */\n lo = Math.imul(al9, bl8);\n mid = Math.imul(al9, bh8);\n mid = (mid + Math.imul(ah9, bl8)) | 0;\n hi = Math.imul(ah9, bh8);\n lo = (lo + Math.imul(al8, bl9)) | 0;\n mid = (mid + Math.imul(al8, bh9)) | 0;\n mid = (mid + Math.imul(ah8, bl9)) | 0;\n hi = (hi + Math.imul(ah8, bh9)) | 0;\n var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;\n w17 &= 0x3ffffff;\n /* k = 18 */\n lo = Math.imul(al9, bl9);\n mid = Math.imul(al9, bh9);\n mid = (mid + Math.imul(ah9, bl9)) | 0;\n hi = Math.imul(ah9, bh9);\n var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;\n w18 &= 0x3ffffff;\n o[0] = w0;\n o[1] = w1;\n o[2] = w2;\n o[3] = w3;\n o[4] = w4;\n o[5] = w5;\n o[6] = w6;\n o[7] = w7;\n o[8] = w8;\n o[9] = w9;\n o[10] = w10;\n o[11] = w11;\n o[12] = w12;\n o[13] = w13;\n o[14] = w14;\n o[15] = w15;\n o[16] = w16;\n o[17] = w17;\n o[18] = w18;\n if (c !== 0) {\n o[19] = c;\n out.length++;\n }\n return out;\n };\n\n // Polyfill comb\n if (!Math.imul) {\n comb10MulTo = smallMulTo;\n }\n\n function bigMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n out.length = self.length + num.length;\n\n var carry = 0;\n var hncarry = 0;\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = hncarry;\n hncarry = 0;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = self.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;\n lo = (lo + rword) | 0;\n rword = lo & 0x3ffffff;\n ncarry = (ncarry + (lo >>> 26)) | 0;\n\n hncarry += ncarry >>> 26;\n ncarry &= 0x3ffffff;\n }\n out.words[k] = rword;\n carry = ncarry;\n ncarry = hncarry;\n }\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out._strip();\n }\n\n function jumboMulTo (self, num, out) {\n // Temporary disable, see https://github.com/indutny/bn.js/issues/211\n // var fftm = new FFTM();\n // return fftm.mulp(self, num, out);\n return bigMulTo(self, num, out);\n }\n\n BN.prototype.mulTo = function mulTo (num, out) {\n var res;\n var len = this.length + num.length;\n if (this.length === 10 && num.length === 10) {\n res = comb10MulTo(this, num, out);\n } else if (len < 63) {\n res = smallMulTo(this, num, out);\n } else if (len < 1024) {\n res = bigMulTo(this, num, out);\n } else {\n res = jumboMulTo(this, num, out);\n }\n\n return res;\n };\n\n // Cooley-Tukey algorithm for FFT\n // slightly revisited to rely on looping instead of recursion\n\n function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }\n\n FFTM.prototype.makeRBT = function makeRBT (N) {\n var t = new Array(N);\n var l = BN.prototype._countBits(N) - 1;\n for (var i = 0; i < N; i++) {\n t[i] = this.revBin(i, l, N);\n }\n\n return t;\n };\n\n // Returns binary-reversed representation of `x`\n FFTM.prototype.revBin = function revBin (x, l, N) {\n if (x === 0 || x === N - 1) return x;\n\n var rb = 0;\n for (var i = 0; i < l; i++) {\n rb |= (x & 1) << (l - i - 1);\n x >>= 1;\n }\n\n return rb;\n };\n\n // Performs \"tweedling\" phase, therefore 'emulating'\n // behaviour of the recursive algorithm\n FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {\n for (var i = 0; i < N; i++) {\n rtws[i] = rws[rbt[i]];\n itws[i] = iws[rbt[i]];\n }\n };\n\n FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n\n for (var s = 1; s < N; s <<= 1) {\n var l = s << 1;\n\n var rtwdf = Math.cos(2 * Math.PI / l);\n var itwdf = Math.sin(2 * Math.PI / l);\n\n for (var p = 0; p < N; p += l) {\n var rtwdf_ = rtwdf;\n var itwdf_ = itwdf;\n\n for (var j = 0; j < s; j++) {\n var re = rtws[p + j];\n var ie = itws[p + j];\n\n var ro = rtws[p + j + s];\n var io = itws[p + j + s];\n\n var rx = rtwdf_ * ro - itwdf_ * io;\n\n io = rtwdf_ * io + itwdf_ * ro;\n ro = rx;\n\n rtws[p + j] = re + ro;\n itws[p + j] = ie + io;\n\n rtws[p + j + s] = re - ro;\n itws[p + j + s] = ie - io;\n\n /* jshint maxdepth : false */\n if (j !== l) {\n rx = rtwdf * rtwdf_ - itwdf * itwdf_;\n\n itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;\n rtwdf_ = rx;\n }\n }\n }\n }\n };\n\n FFTM.prototype.guessLen13b = function guessLen13b (n, m) {\n var N = Math.max(m, n) | 1;\n var odd = N & 1;\n var i = 0;\n for (N = N / 2 | 0; N; N = N >>> 1) {\n i++;\n }\n\n return 1 << i + 1 + odd;\n };\n\n FFTM.prototype.conjugate = function conjugate (rws, iws, N) {\n if (N <= 1) return;\n\n for (var i = 0; i < N / 2; i++) {\n var t = rws[i];\n\n rws[i] = rws[N - i - 1];\n rws[N - i - 1] = t;\n\n t = iws[i];\n\n iws[i] = -iws[N - i - 1];\n iws[N - i - 1] = -t;\n }\n };\n\n FFTM.prototype.normalize13b = function normalize13b (ws, N) {\n var carry = 0;\n for (var i = 0; i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +\n Math.round(ws[2 * i] / N) +\n carry;\n\n ws[i] = w & 0x3ffffff;\n\n if (w < 0x4000000) {\n carry = 0;\n } else {\n carry = w / 0x4000000 | 0;\n }\n }\n\n return ws;\n };\n\n FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {\n var carry = 0;\n for (var i = 0; i < len; i++) {\n carry = carry + (ws[i] | 0);\n\n rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;\n rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;\n }\n\n // Pad with zeroes\n for (i = 2 * len; i < N; ++i) {\n rws[i] = 0;\n }\n\n assert(carry === 0);\n assert((carry & ~0x1fff) === 0);\n };\n\n FFTM.prototype.stub = function stub (N) {\n var ph = new Array(N);\n for (var i = 0; i < N; i++) {\n ph[i] = 0;\n }\n\n return ph;\n };\n\n FFTM.prototype.mulp = function mulp (x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length);\n\n var rbt = this.makeRBT(N);\n\n var _ = this.stub(N);\n\n var rws = new Array(N);\n var rwst = new Array(N);\n var iwst = new Array(N);\n\n var nrws = new Array(N);\n var nrwst = new Array(N);\n var niwst = new Array(N);\n\n var rmws = out.words;\n rmws.length = N;\n\n this.convert13b(x.words, x.length, rws, N);\n this.convert13b(y.words, y.length, nrws, N);\n\n this.transform(rws, _, rwst, iwst, N, rbt);\n this.transform(nrws, _, nrwst, niwst, N, rbt);\n\n for (var i = 0; i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];\n rwst[i] = rx;\n }\n\n this.conjugate(rwst, iwst, N);\n this.transform(rwst, iwst, rmws, _, N, rbt);\n this.conjugate(rmws, _, N);\n this.normalize13b(rmws, N);\n\n out.negative = x.negative ^ y.negative;\n out.length = x.length + y.length;\n return out._strip();\n };\n\n // Multiply `this` by `num`\n BN.prototype.mul = function mul (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return this.mulTo(num, out);\n };\n\n // Multiply employing FFT\n BN.prototype.mulf = function mulf (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return jumboMulTo(this, num, out);\n };\n\n // In-place Multiplication\n BN.prototype.imul = function imul (num) {\n return this.clone().mulTo(num, this);\n };\n\n BN.prototype.imuln = function imuln (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n\n // Carry\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = (this.words[i] | 0) * num;\n var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);\n carry >>= 26;\n carry += (w / 0x4000000) | 0;\n // NOTE: lo is 27bit maximum\n carry += lo >>> 26;\n this.words[i] = lo & 0x3ffffff;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.muln = function muln (num) {\n return this.clone().imuln(num);\n };\n\n // `this` * `this`\n BN.prototype.sqr = function sqr () {\n return this.mul(this);\n };\n\n // `this` * `this` in-place\n BN.prototype.isqr = function isqr () {\n return this.imul(this.clone());\n };\n\n // Math.pow(`this`, `num`)\n BN.prototype.pow = function pow (num) {\n var w = toBitArray(num);\n if (w.length === 0) return new BN(1);\n\n // Skip leading zeroes\n var res = this;\n for (var i = 0; i < w.length; i++, res = res.sqr()) {\n if (w[i] !== 0) break;\n }\n\n if (++i < w.length) {\n for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {\n if (w[i] === 0) continue;\n\n res = res.mul(q);\n }\n }\n\n return res;\n };\n\n // Shift-left in-place\n BN.prototype.iushln = function iushln (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);\n var i;\n\n if (r !== 0) {\n var carry = 0;\n\n for (i = 0; i < this.length; i++) {\n var newCarry = this.words[i] & carryMask;\n var c = ((this.words[i] | 0) - newCarry) << r;\n this.words[i] = c | carry;\n carry = newCarry >>> (26 - r);\n }\n\n if (carry) {\n this.words[i] = carry;\n this.length++;\n }\n }\n\n if (s !== 0) {\n for (i = this.length - 1; i >= 0; i--) {\n this.words[i + s] = this.words[i];\n }\n\n for (i = 0; i < s; i++) {\n this.words[i] = 0;\n }\n\n this.length += s;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishln = function ishln (bits) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushln(bits);\n };\n\n // Shift-right in-place\n // NOTE: `hint` is a lowest bit before trailing zeroes\n // NOTE: if `extended` is present - it will be filled with destroyed bits\n BN.prototype.iushrn = function iushrn (bits, hint, extended) {\n assert(typeof bits === 'number' && bits >= 0);\n var h;\n if (hint) {\n h = (hint - (hint % 26)) / 26;\n } else {\n h = 0;\n }\n\n var r = bits % 26;\n var s = Math.min((bits - r) / 26, this.length);\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n var maskedWords = extended;\n\n h -= s;\n h = Math.max(0, h);\n\n // Extended mode, copy masked part\n if (maskedWords) {\n for (var i = 0; i < s; i++) {\n maskedWords.words[i] = this.words[i];\n }\n maskedWords.length = s;\n }\n\n if (s === 0) {\n // No-op, we should not move anything at all\n } else if (this.length > s) {\n this.length -= s;\n for (i = 0; i < this.length; i++) {\n this.words[i] = this.words[i + s];\n }\n } else {\n this.words[0] = 0;\n this.length = 1;\n }\n\n var carry = 0;\n for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = (carry << (26 - r)) | (word >>> r);\n carry = word & mask;\n }\n\n // Push carried bits as a mask\n if (maskedWords && carry !== 0) {\n maskedWords.words[maskedWords.length++] = carry;\n }\n\n if (this.length === 0) {\n this.words[0] = 0;\n this.length = 1;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishrn = function ishrn (bits, hint, extended) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushrn(bits, hint, extended);\n };\n\n // Shift-left\n BN.prototype.shln = function shln (bits) {\n return this.clone().ishln(bits);\n };\n\n BN.prototype.ushln = function ushln (bits) {\n return this.clone().iushln(bits);\n };\n\n // Shift-right\n BN.prototype.shrn = function shrn (bits) {\n return this.clone().ishrn(bits);\n };\n\n BN.prototype.ushrn = function ushrn (bits) {\n return this.clone().iushrn(bits);\n };\n\n // Test if n bit is set\n BN.prototype.testn = function testn (bit) {\n assert(typeof bit === 'number' && bit >= 0);\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) return false;\n\n // Check bit and return\n var w = this.words[s];\n\n return !!(w & q);\n };\n\n // Return only lowers bits of number (in-place)\n BN.prototype.imaskn = function imaskn (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n\n assert(this.negative === 0, 'imaskn works only with positive numbers');\n\n if (this.length <= s) {\n return this;\n }\n\n if (r !== 0) {\n s++;\n }\n this.length = Math.min(s, this.length);\n\n if (r !== 0) {\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n this.words[this.length - 1] &= mask;\n }\n\n return this._strip();\n };\n\n // Return only lowers bits of number\n BN.prototype.maskn = function maskn (bits) {\n return this.clone().imaskn(bits);\n };\n\n // Add plain number `num` to `this`\n BN.prototype.iaddn = function iaddn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.isubn(-num);\n\n // Possible sign change\n if (this.negative !== 0) {\n if (this.length === 1 && (this.words[0] | 0) <= num) {\n this.words[0] = num - (this.words[0] | 0);\n this.negative = 0;\n return this;\n }\n\n this.negative = 0;\n this.isubn(num);\n this.negative = 1;\n return this;\n }\n\n // Add without checks\n return this._iaddn(num);\n };\n\n BN.prototype._iaddn = function _iaddn (num) {\n this.words[0] += num;\n\n // Carry\n for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {\n this.words[i] -= 0x4000000;\n if (i === this.length - 1) {\n this.words[i + 1] = 1;\n } else {\n this.words[i + 1]++;\n }\n }\n this.length = Math.max(this.length, i + 1);\n\n return this;\n };\n\n // Subtract plain number `num` from `this`\n BN.prototype.isubn = function isubn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.iaddn(-num);\n\n if (this.negative !== 0) {\n this.negative = 0;\n this.iaddn(num);\n this.negative = 1;\n return this;\n }\n\n this.words[0] -= num;\n\n if (this.length === 1 && this.words[0] < 0) {\n this.words[0] = -this.words[0];\n this.negative = 1;\n } else {\n // Carry\n for (var i = 0; i < this.length && this.words[i] < 0; i++) {\n this.words[i] += 0x4000000;\n this.words[i + 1] -= 1;\n }\n }\n\n return this._strip();\n };\n\n BN.prototype.addn = function addn (num) {\n return this.clone().iaddn(num);\n };\n\n BN.prototype.subn = function subn (num) {\n return this.clone().isubn(num);\n };\n\n BN.prototype.iabs = function iabs () {\n this.negative = 0;\n\n return this;\n };\n\n BN.prototype.abs = function abs () {\n return this.clone().iabs();\n };\n\n BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {\n var len = num.length + shift;\n var i;\n\n this._expand(len);\n\n var w;\n var carry = 0;\n for (i = 0; i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 0x3ffffff;\n carry = (w >> 26) - ((right / 0x4000000) | 0);\n this.words[i + shift] = w & 0x3ffffff;\n }\n for (; i < this.length - shift; i++) {\n w = (this.words[i + shift] | 0) + carry;\n carry = w >> 26;\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n if (carry === 0) return this._strip();\n\n // Subtraction overflow\n assert(carry === -1);\n carry = 0;\n for (i = 0; i < this.length; i++) {\n w = -(this.words[i] | 0) + carry;\n carry = w >> 26;\n this.words[i] = w & 0x3ffffff;\n }\n this.negative = 1;\n\n return this._strip();\n };\n\n BN.prototype._wordDiv = function _wordDiv (num, mode) {\n var shift = this.length - num.length;\n\n var a = this.clone();\n var b = num;\n\n // Normalize\n var bhi = b.words[b.length - 1] | 0;\n var bhiBits = this._countBits(bhi);\n shift = 26 - bhiBits;\n if (shift !== 0) {\n b = b.ushln(shift);\n a.iushln(shift);\n bhi = b.words[b.length - 1] | 0;\n }\n\n // Initialize quotient\n var m = a.length - b.length;\n var q;\n\n if (mode !== 'mod') {\n q = new BN(null);\n q.length = m + 1;\n q.words = new Array(q.length);\n for (var i = 0; i < q.length; i++) {\n q.words[i] = 0;\n }\n }\n\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n if (diff.negative === 0) {\n a = diff;\n if (q) {\n q.words[m] = 1;\n }\n }\n\n for (var j = m - 1; j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 0x4000000 +\n (a.words[b.length + j - 1] | 0);\n\n // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max\n // (0x7ffffff)\n qj = Math.min((qj / bhi) | 0, 0x3ffffff);\n\n a._ishlnsubmul(b, qj, j);\n while (a.negative !== 0) {\n qj--;\n a.negative = 0;\n a._ishlnsubmul(b, 1, j);\n if (!a.isZero()) {\n a.negative ^= 1;\n }\n }\n if (q) {\n q.words[j] = qj;\n }\n }\n if (q) {\n q._strip();\n }\n a._strip();\n\n // Denormalize\n if (mode !== 'div' && shift !== 0) {\n a.iushrn(shift);\n }\n\n return {\n div: q || null,\n mod: a\n };\n };\n\n // NOTE: 1) `mode` can be set to `mod` to request mod only,\n // to `div` to request div only, or be absent to\n // request both div & mod\n // 2) `positive` is true if unsigned mod is requested\n BN.prototype.divmod = function divmod (num, mode, positive) {\n assert(!num.isZero());\n\n if (this.isZero()) {\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n }\n\n var div, mod, res;\n if (this.negative !== 0 && num.negative === 0) {\n res = this.neg().divmod(num, mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.iadd(num);\n }\n }\n\n return {\n div: div,\n mod: mod\n };\n }\n\n if (this.negative === 0 && num.negative !== 0) {\n res = this.divmod(num.neg(), mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n return {\n div: div,\n mod: res.mod\n };\n }\n\n if ((this.negative & num.negative) !== 0) {\n res = this.neg().divmod(num.neg(), mode);\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.isub(num);\n }\n }\n\n return {\n div: res.div,\n mod: mod\n };\n }\n\n // Both numbers are positive at this point\n\n // Strip both numbers to approximate shift value\n if (num.length > this.length || this.cmp(num) < 0) {\n return {\n div: new BN(0),\n mod: this\n };\n }\n\n // Very short reduction\n if (num.length === 1) {\n if (mode === 'div') {\n return {\n div: this.divn(num.words[0]),\n mod: null\n };\n }\n\n if (mode === 'mod') {\n return {\n div: null,\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return {\n div: this.divn(num.words[0]),\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return this._wordDiv(num, mode);\n };\n\n // Find `this` / `num`\n BN.prototype.div = function div (num) {\n return this.divmod(num, 'div', false).div;\n };\n\n // Find `this` % `num`\n BN.prototype.mod = function mod (num) {\n return this.divmod(num, 'mod', false).mod;\n };\n\n BN.prototype.umod = function umod (num) {\n return this.divmod(num, 'mod', true).mod;\n };\n\n // Find Round(`this` / `num`)\n BN.prototype.divRound = function divRound (num) {\n var dm = this.divmod(num);\n\n // Fast case - exact division\n if (dm.mod.isZero()) return dm.div;\n\n var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;\n\n var half = num.ushrn(1);\n var r2 = num.andln(1);\n var cmp = mod.cmp(half);\n\n // Round down\n if (cmp < 0 || (r2 === 1 && cmp === 0)) return dm.div;\n\n // Round up\n return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);\n };\n\n BN.prototype.modrn = function modrn (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(num <= 0x3ffffff);\n var p = (1 << 26) % num;\n\n var acc = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n acc = (p * acc + (this.words[i] | 0)) % num;\n }\n\n return isNegNum ? -acc : acc;\n };\n\n // WARNING: DEPRECATED\n BN.prototype.modn = function modn (num) {\n return this.modrn(num);\n };\n\n // In-place division by number\n BN.prototype.idivn = function idivn (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(num <= 0x3ffffff);\n\n var carry = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 0x4000000;\n this.words[i] = (w / num) | 0;\n carry = w % num;\n }\n\n this._strip();\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.divn = function divn (num) {\n return this.clone().idivn(num);\n };\n\n BN.prototype.egcd = function egcd (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var x = this;\n var y = p.clone();\n\n if (x.negative !== 0) {\n x = x.umod(p);\n } else {\n x = x.clone();\n }\n\n // A * x + B * y = x\n var A = new BN(1);\n var B = new BN(0);\n\n // C * x + D * y = y\n var C = new BN(0);\n var D = new BN(1);\n\n var g = 0;\n\n while (x.isEven() && y.isEven()) {\n x.iushrn(1);\n y.iushrn(1);\n ++g;\n }\n\n var yp = y.clone();\n var xp = x.clone();\n\n while (!x.isZero()) {\n for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n x.iushrn(i);\n while (i-- > 0) {\n if (A.isOdd() || B.isOdd()) {\n A.iadd(yp);\n B.isub(xp);\n }\n\n A.iushrn(1);\n B.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n y.iushrn(j);\n while (j-- > 0) {\n if (C.isOdd() || D.isOdd()) {\n C.iadd(yp);\n D.isub(xp);\n }\n\n C.iushrn(1);\n D.iushrn(1);\n }\n }\n\n if (x.cmp(y) >= 0) {\n x.isub(y);\n A.isub(C);\n B.isub(D);\n } else {\n y.isub(x);\n C.isub(A);\n D.isub(B);\n }\n }\n\n return {\n a: C,\n b: D,\n gcd: y.iushln(g)\n };\n };\n\n // This is reduced incarnation of the binary EEA\n // above, designated to invert members of the\n // _prime_ fields F(p) at a maximal speed\n BN.prototype._invmp = function _invmp (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var a = this;\n var b = p.clone();\n\n if (a.negative !== 0) {\n a = a.umod(p);\n } else {\n a = a.clone();\n }\n\n var x1 = new BN(1);\n var x2 = new BN(0);\n\n var delta = b.clone();\n\n while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {\n for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n a.iushrn(i);\n while (i-- > 0) {\n if (x1.isOdd()) {\n x1.iadd(delta);\n }\n\n x1.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n b.iushrn(j);\n while (j-- > 0) {\n if (x2.isOdd()) {\n x2.iadd(delta);\n }\n\n x2.iushrn(1);\n }\n }\n\n if (a.cmp(b) >= 0) {\n a.isub(b);\n x1.isub(x2);\n } else {\n b.isub(a);\n x2.isub(x1);\n }\n }\n\n var res;\n if (a.cmpn(1) === 0) {\n res = x1;\n } else {\n res = x2;\n }\n\n if (res.cmpn(0) < 0) {\n res.iadd(p);\n }\n\n return res;\n };\n\n BN.prototype.gcd = function gcd (num) {\n if (this.isZero()) return num.abs();\n if (num.isZero()) return this.abs();\n\n var a = this.clone();\n var b = num.clone();\n a.negative = 0;\n b.negative = 0;\n\n // Remove common factor of two\n for (var shift = 0; a.isEven() && b.isEven(); shift++) {\n a.iushrn(1);\n b.iushrn(1);\n }\n\n do {\n while (a.isEven()) {\n a.iushrn(1);\n }\n while (b.isEven()) {\n b.iushrn(1);\n }\n\n var r = a.cmp(b);\n if (r < 0) {\n // Swap `a` and `b` to make `a` always bigger than `b`\n var t = a;\n a = b;\n b = t;\n } else if (r === 0 || b.cmpn(1) === 0) {\n break;\n }\n\n a.isub(b);\n } while (true);\n\n return b.iushln(shift);\n };\n\n // Invert number in the field F(num)\n BN.prototype.invm = function invm (num) {\n return this.egcd(num).a.umod(num);\n };\n\n BN.prototype.isEven = function isEven () {\n return (this.words[0] & 1) === 0;\n };\n\n BN.prototype.isOdd = function isOdd () {\n return (this.words[0] & 1) === 1;\n };\n\n // And first word and num\n BN.prototype.andln = function andln (num) {\n return this.words[0] & num;\n };\n\n // Increment at the bit position in-line\n BN.prototype.bincn = function bincn (bit) {\n assert(typeof bit === 'number');\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) {\n this._expand(s + 1);\n this.words[s] |= q;\n return this;\n }\n\n // Add bit and propagate, if needed\n var carry = q;\n for (var i = s; carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry;\n carry = w >>> 26;\n w &= 0x3ffffff;\n this.words[i] = w;\n }\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n return this;\n };\n\n BN.prototype.isZero = function isZero () {\n return this.length === 1 && this.words[0] === 0;\n };\n\n BN.prototype.cmpn = function cmpn (num) {\n var negative = num < 0;\n\n if (this.negative !== 0 && !negative) return -1;\n if (this.negative === 0 && negative) return 1;\n\n this._strip();\n\n var res;\n if (this.length > 1) {\n res = 1;\n } else {\n if (negative) {\n num = -num;\n }\n\n assert(num <= 0x3ffffff, 'Number is too big');\n\n var w = this.words[0] | 0;\n res = w === num ? 0 : w < num ? -1 : 1;\n }\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Compare two numbers and return:\n // 1 - if `this` > `num`\n // 0 - if `this` == `num`\n // -1 - if `this` < `num`\n BN.prototype.cmp = function cmp (num) {\n if (this.negative !== 0 && num.negative === 0) return -1;\n if (this.negative === 0 && num.negative !== 0) return 1;\n\n var res = this.ucmp(num);\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Unsigned comparison\n BN.prototype.ucmp = function ucmp (num) {\n // At this point both numbers have the same sign\n if (this.length > num.length) return 1;\n if (this.length < num.length) return -1;\n\n var res = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var a = this.words[i] | 0;\n var b = num.words[i] | 0;\n\n if (a === b) continue;\n if (a < b) {\n res = -1;\n } else if (a > b) {\n res = 1;\n }\n break;\n }\n return res;\n };\n\n BN.prototype.gtn = function gtn (num) {\n return this.cmpn(num) === 1;\n };\n\n BN.prototype.gt = function gt (num) {\n return this.cmp(num) === 1;\n };\n\n BN.prototype.gten = function gten (num) {\n return this.cmpn(num) >= 0;\n };\n\n BN.prototype.gte = function gte (num) {\n return this.cmp(num) >= 0;\n };\n\n BN.prototype.ltn = function ltn (num) {\n return this.cmpn(num) === -1;\n };\n\n BN.prototype.lt = function lt (num) {\n return this.cmp(num) === -1;\n };\n\n BN.prototype.lten = function lten (num) {\n return this.cmpn(num) <= 0;\n };\n\n BN.prototype.lte = function lte (num) {\n return this.cmp(num) <= 0;\n };\n\n BN.prototype.eqn = function eqn (num) {\n return this.cmpn(num) === 0;\n };\n\n BN.prototype.eq = function eq (num) {\n return this.cmp(num) === 0;\n };\n\n //\n // A reduce context, could be using montgomery or something better, depending\n // on the `m` itself.\n //\n BN.red = function red (num) {\n return new Red(num);\n };\n\n BN.prototype.toRed = function toRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n assert(this.negative === 0, 'red works only with positives');\n return ctx.convertTo(this)._forceRed(ctx);\n };\n\n BN.prototype.fromRed = function fromRed () {\n assert(this.red, 'fromRed works only with numbers in reduction context');\n return this.red.convertFrom(this);\n };\n\n BN.prototype._forceRed = function _forceRed (ctx) {\n this.red = ctx;\n return this;\n };\n\n BN.prototype.forceRed = function forceRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n return this._forceRed(ctx);\n };\n\n BN.prototype.redAdd = function redAdd (num) {\n assert(this.red, 'redAdd works only with red numbers');\n return this.red.add(this, num);\n };\n\n BN.prototype.redIAdd = function redIAdd (num) {\n assert(this.red, 'redIAdd works only with red numbers');\n return this.red.iadd(this, num);\n };\n\n BN.prototype.redSub = function redSub (num) {\n assert(this.red, 'redSub works only with red numbers');\n return this.red.sub(this, num);\n };\n\n BN.prototype.redISub = function redISub (num) {\n assert(this.red, 'redISub works only with red numbers');\n return this.red.isub(this, num);\n };\n\n BN.prototype.redShl = function redShl (num) {\n assert(this.red, 'redShl works only with red numbers');\n return this.red.shl(this, num);\n };\n\n BN.prototype.redMul = function redMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.mul(this, num);\n };\n\n BN.prototype.redIMul = function redIMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.imul(this, num);\n };\n\n BN.prototype.redSqr = function redSqr () {\n assert(this.red, 'redSqr works only with red numbers');\n this.red._verify1(this);\n return this.red.sqr(this);\n };\n\n BN.prototype.redISqr = function redISqr () {\n assert(this.red, 'redISqr works only with red numbers');\n this.red._verify1(this);\n return this.red.isqr(this);\n };\n\n // Square root over p\n BN.prototype.redSqrt = function redSqrt () {\n assert(this.red, 'redSqrt works only with red numbers');\n this.red._verify1(this);\n return this.red.sqrt(this);\n };\n\n BN.prototype.redInvm = function redInvm () {\n assert(this.red, 'redInvm works only with red numbers');\n this.red._verify1(this);\n return this.red.invm(this);\n };\n\n // Return negative clone of `this` % `red modulo`\n BN.prototype.redNeg = function redNeg () {\n assert(this.red, 'redNeg works only with red numbers');\n this.red._verify1(this);\n return this.red.neg(this);\n };\n\n BN.prototype.redPow = function redPow (num) {\n assert(this.red && !num.red, 'redPow(normalNum)');\n this.red._verify1(this);\n return this.red.pow(this, num);\n };\n\n // Prime numbers with efficient reduction\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n };\n\n // Pseudo-Mersenne prime\n function MPrime (name, p) {\n // P = 2 ^ N - K\n this.name = name;\n this.p = new BN(p, 16);\n this.n = this.p.bitLength();\n this.k = new BN(1).iushln(this.n).isub(this.p);\n\n this.tmp = this._tmp();\n }\n\n MPrime.prototype._tmp = function _tmp () {\n var tmp = new BN(null);\n tmp.words = new Array(Math.ceil(this.n / 13));\n return tmp;\n };\n\n MPrime.prototype.ireduce = function ireduce (num) {\n // Assumes that `num` is less than `P^2`\n // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)\n var r = num;\n var rlen;\n\n do {\n this.split(r, this.tmp);\n r = this.imulK(r);\n r = r.iadd(this.tmp);\n rlen = r.bitLength();\n } while (rlen > this.n);\n\n var cmp = rlen < this.n ? -1 : r.ucmp(this.p);\n if (cmp === 0) {\n r.words[0] = 0;\n r.length = 1;\n } else if (cmp > 0) {\n r.isub(this.p);\n } else {\n if (r.strip !== undefined) {\n // r is a BN v4 instance\n r.strip();\n } else {\n // r is a BN v5 instance\n r._strip();\n }\n }\n\n return r;\n };\n\n MPrime.prototype.split = function split (input, out) {\n input.iushrn(this.n, 0, out);\n };\n\n MPrime.prototype.imulK = function imulK (num) {\n return num.imul(this.k);\n };\n\n function K256 () {\n MPrime.call(\n this,\n 'k256',\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');\n }\n inherits(K256, MPrime);\n\n K256.prototype.split = function split (input, output) {\n // 256 = 9 * 26 + 22\n var mask = 0x3fffff;\n\n var outLen = Math.min(input.length, 9);\n for (var i = 0; i < outLen; i++) {\n output.words[i] = input.words[i];\n }\n output.length = outLen;\n\n if (input.length <= 9) {\n input.words[0] = 0;\n input.length = 1;\n return;\n }\n\n // Shift by 9 limbs\n var prev = input.words[9];\n output.words[output.length++] = prev & mask;\n\n for (i = 10; i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);\n prev = next;\n }\n prev >>>= 22;\n input.words[i - 10] = prev;\n if (prev === 0 && input.length > 10) {\n input.length -= 10;\n } else {\n input.length -= 9;\n }\n };\n\n K256.prototype.imulK = function imulK (num) {\n // K = 0x1000003d1 = [ 0x40, 0x3d1 ]\n num.words[num.length] = 0;\n num.words[num.length + 1] = 0;\n num.length += 2;\n\n // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390\n var lo = 0;\n for (var i = 0; i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 0x3d1;\n num.words[i] = lo & 0x3ffffff;\n lo = w * 0x40 + ((lo / 0x4000000) | 0);\n }\n\n // Fast length reduction\n if (num.words[num.length - 1] === 0) {\n num.length--;\n if (num.words[num.length - 1] === 0) {\n num.length--;\n }\n }\n return num;\n };\n\n function P224 () {\n MPrime.call(\n this,\n 'p224',\n 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');\n }\n inherits(P224, MPrime);\n\n function P192 () {\n MPrime.call(\n this,\n 'p192',\n 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');\n }\n inherits(P192, MPrime);\n\n function P25519 () {\n // 2 ^ 255 - 19\n MPrime.call(\n this,\n '25519',\n '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');\n }\n inherits(P25519, MPrime);\n\n P25519.prototype.imulK = function imulK (num) {\n // K = 0x13\n var carry = 0;\n for (var i = 0; i < num.length; i++) {\n var hi = (num.words[i] | 0) * 0x13 + carry;\n var lo = hi & 0x3ffffff;\n hi >>>= 26;\n\n num.words[i] = lo;\n carry = hi;\n }\n if (carry !== 0) {\n num.words[num.length++] = carry;\n }\n return num;\n };\n\n // Exported mostly for testing purposes, use plain name instead\n BN._prime = function prime (name) {\n // Cached version of prime\n if (primes[name]) return primes[name];\n\n var prime;\n if (name === 'k256') {\n prime = new K256();\n } else if (name === 'p224') {\n prime = new P224();\n } else if (name === 'p192') {\n prime = new P192();\n } else if (name === 'p25519') {\n prime = new P25519();\n } else {\n throw new Error('Unknown prime ' + name);\n }\n primes[name] = prime;\n\n return prime;\n };\n\n //\n // Base reduction engine\n //\n function Red (m) {\n if (typeof m === 'string') {\n var prime = BN._prime(m);\n this.m = prime.p;\n this.prime = prime;\n } else {\n assert(m.gtn(1), 'modulus must be greater than 1');\n this.m = m;\n this.prime = null;\n }\n }\n\n Red.prototype._verify1 = function _verify1 (a) {\n assert(a.negative === 0, 'red works only with positives');\n assert(a.red, 'red works only with red numbers');\n };\n\n Red.prototype._verify2 = function _verify2 (a, b) {\n assert((a.negative | b.negative) === 0, 'red works only with positives');\n assert(a.red && a.red === b.red,\n 'red works only with red numbers');\n };\n\n Red.prototype.imod = function imod (a) {\n if (this.prime) return this.prime.ireduce(a)._forceRed(this);\n\n move(a, a.umod(this.m)._forceRed(this));\n return a;\n };\n\n Red.prototype.neg = function neg (a) {\n if (a.isZero()) {\n return a.clone();\n }\n\n return this.m.sub(a)._forceRed(this);\n };\n\n Red.prototype.add = function add (a, b) {\n this._verify2(a, b);\n\n var res = a.add(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.iadd = function iadd (a, b) {\n this._verify2(a, b);\n\n var res = a.iadd(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res;\n };\n\n Red.prototype.sub = function sub (a, b) {\n this._verify2(a, b);\n\n var res = a.sub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.isub = function isub (a, b) {\n this._verify2(a, b);\n\n var res = a.isub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res;\n };\n\n Red.prototype.shl = function shl (a, num) {\n this._verify1(a);\n return this.imod(a.ushln(num));\n };\n\n Red.prototype.imul = function imul (a, b) {\n this._verify2(a, b);\n return this.imod(a.imul(b));\n };\n\n Red.prototype.mul = function mul (a, b) {\n this._verify2(a, b);\n return this.imod(a.mul(b));\n };\n\n Red.prototype.isqr = function isqr (a) {\n return this.imul(a, a.clone());\n };\n\n Red.prototype.sqr = function sqr (a) {\n return this.mul(a, a);\n };\n\n Red.prototype.sqrt = function sqrt (a) {\n if (a.isZero()) return a.clone();\n\n var mod3 = this.m.andln(3);\n assert(mod3 % 2 === 1);\n\n // Fast case\n if (mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n }\n\n // Tonelli-Shanks algorithm (Totally unoptimized and slow)\n //\n // Find Q and S, that Q * 2 ^ S = (P - 1)\n var q = this.m.subn(1);\n var s = 0;\n while (!q.isZero() && q.andln(1) === 0) {\n s++;\n q.iushrn(1);\n }\n assert(!q.isZero());\n\n var one = new BN(1).toRed(this);\n var nOne = one.redNeg();\n\n // Find quadratic non-residue\n // NOTE: Max is such because of generalized Riemann hypothesis.\n var lpow = this.m.subn(1).iushrn(1);\n var z = this.m.bitLength();\n z = new BN(2 * z * z).toRed(this);\n\n while (this.pow(z, lpow).cmp(nOne) !== 0) {\n z.redIAdd(nOne);\n }\n\n var c = this.pow(z, q);\n var r = this.pow(a, q.addn(1).iushrn(1));\n var t = this.pow(a, q);\n var m = s;\n while (t.cmp(one) !== 0) {\n var tmp = t;\n for (var i = 0; tmp.cmp(one) !== 0; i++) {\n tmp = tmp.redSqr();\n }\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n\n r = r.redMul(b);\n c = b.redSqr();\n t = t.redMul(c);\n m = i;\n }\n\n return r;\n };\n\n Red.prototype.invm = function invm (a) {\n var inv = a._invmp(this.m);\n if (inv.negative !== 0) {\n inv.negative = 0;\n return this.imod(inv).redNeg();\n } else {\n return this.imod(inv);\n }\n };\n\n Red.prototype.pow = function pow (a, num) {\n if (num.isZero()) return new BN(1).toRed(this);\n if (num.cmpn(1) === 0) return a.clone();\n\n var windowSize = 4;\n var wnd = new Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this);\n wnd[1] = a;\n for (var i = 2; i < wnd.length; i++) {\n wnd[i] = this.mul(wnd[i - 1], a);\n }\n\n var res = wnd[0];\n var current = 0;\n var currentLen = 0;\n var start = num.bitLength() % 26;\n if (start === 0) {\n start = 26;\n }\n\n for (i = num.length - 1; i >= 0; i--) {\n var word = num.words[i];\n for (var j = start - 1; j >= 0; j--) {\n var bit = (word >> j) & 1;\n if (res !== wnd[0]) {\n res = this.sqr(res);\n }\n\n if (bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n\n current <<= 1;\n current |= bit;\n currentLen++;\n if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;\n\n res = this.mul(res, wnd[current]);\n currentLen = 0;\n current = 0;\n }\n start = 26;\n }\n\n return res;\n };\n\n Red.prototype.convertTo = function convertTo (num) {\n var r = num.umod(this.m);\n\n return r === num ? r.clone() : r;\n };\n\n Red.prototype.convertFrom = function convertFrom (num) {\n var res = num.clone();\n res.red = null;\n return res;\n };\n\n //\n // Montgomery method engine\n //\n\n BN.mont = function mont (num) {\n return new Mont(num);\n };\n\n function Mont (m) {\n Red.call(this, m);\n\n this.shift = this.m.bitLength();\n if (this.shift % 26 !== 0) {\n this.shift += 26 - (this.shift % 26);\n }\n\n this.r = new BN(1).iushln(this.shift);\n this.r2 = this.imod(this.r.sqr());\n this.rinv = this.r._invmp(this.m);\n\n this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);\n this.minv = this.minv.umod(this.r);\n this.minv = this.r.sub(this.minv);\n }\n inherits(Mont, Red);\n\n Mont.prototype.convertTo = function convertTo (num) {\n return this.imod(num.ushln(this.shift));\n };\n\n Mont.prototype.convertFrom = function convertFrom (num) {\n var r = this.imod(num.mul(this.rinv));\n r.red = null;\n return r;\n };\n\n Mont.prototype.imul = function imul (a, b) {\n if (a.isZero() || b.isZero()) {\n a.words[0] = 0;\n a.length = 1;\n return a;\n }\n\n var t = a.imul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.mul = function mul (a, b) {\n if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);\n\n var t = a.mul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.invm = function invm (a) {\n // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n})( false || module, this);\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/bn.js/lib/bn.js?"); - -/***/ }), - -/***/ "./node_modules/decode-uri-component/index.js": -/*!****************************************************!*\ - !*** ./node_modules/decode-uri-component/index.js ***! - \****************************************************/ -/***/ ((module) => { - -eval("\nvar token = '%[a-f0-9]{2}';\nvar singleMatcher = new RegExp('(' + token + ')|([^%]+?)', 'gi');\nvar multiMatcher = new RegExp('(' + token + ')+', 'gi');\n\nfunction decodeComponents(components, split) {\n\ttry {\n\t\t// Try to decode the entire string first\n\t\treturn [decodeURIComponent(components.join(''))];\n\t} catch (err) {\n\t\t// Do nothing\n\t}\n\n\tif (components.length === 1) {\n\t\treturn components;\n\t}\n\n\tsplit = split || 1;\n\n\t// Split the array in 2 parts\n\tvar left = components.slice(0, split);\n\tvar right = components.slice(split);\n\n\treturn Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));\n}\n\nfunction decode(input) {\n\ttry {\n\t\treturn decodeURIComponent(input);\n\t} catch (err) {\n\t\tvar tokens = input.match(singleMatcher) || [];\n\n\t\tfor (var i = 1; i < tokens.length; i++) {\n\t\t\tinput = decodeComponents(tokens, i).join('');\n\n\t\t\ttokens = input.match(singleMatcher) || [];\n\t\t}\n\n\t\treturn input;\n\t}\n}\n\nfunction customDecodeURIComponent(input) {\n\t// Keep track of all the replacements and prefill the map with the `BOM`\n\tvar replaceMap = {\n\t\t'%FE%FF': '\\uFFFD\\uFFFD',\n\t\t'%FF%FE': '\\uFFFD\\uFFFD'\n\t};\n\n\tvar match = multiMatcher.exec(input);\n\twhile (match) {\n\t\ttry {\n\t\t\t// Decode as big chunks as possible\n\t\t\treplaceMap[match[0]] = decodeURIComponent(match[0]);\n\t\t} catch (err) {\n\t\t\tvar result = decode(match[0]);\n\n\t\t\tif (result !== match[0]) {\n\t\t\t\treplaceMap[match[0]] = result;\n\t\t\t}\n\t\t}\n\n\t\tmatch = multiMatcher.exec(input);\n\t}\n\n\t// Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else\n\treplaceMap['%C2'] = '\\uFFFD';\n\n\tvar entries = Object.keys(replaceMap);\n\n\tfor (var i = 0; i < entries.length; i++) {\n\t\t// Replace all decoded components\n\t\tvar key = entries[i];\n\t\tinput = input.replace(new RegExp(key, 'g'), replaceMap[key]);\n\t}\n\n\treturn input;\n}\n\nmodule.exports = function (encodedURI) {\n\tif (typeof encodedURI !== 'string') {\n\t\tthrow new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`');\n\t}\n\n\ttry {\n\t\tencodedURI = encodedURI.replace(/\\+/g, ' ');\n\n\t\t// Try the built in decoder first\n\t\treturn decodeURIComponent(encodedURI);\n\t} catch (err) {\n\t\t// Fallback to a more advanced decoder\n\t\treturn customDecodeURIComponent(encodedURI);\n\t}\n};\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/decode-uri-component/index.js?"); - -/***/ }), - -/***/ "./node_modules/detect-browser/es/index.js": -/*!*************************************************!*\ - !*** ./node_modules/detect-browser/es/index.js ***! - \*************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BotInfo: () => (/* binding */ BotInfo),\n/* harmony export */ BrowserInfo: () => (/* binding */ BrowserInfo),\n/* harmony export */ NodeInfo: () => (/* binding */ NodeInfo),\n/* harmony export */ ReactNativeInfo: () => (/* binding */ ReactNativeInfo),\n/* harmony export */ SearchBotDeviceInfo: () => (/* binding */ SearchBotDeviceInfo),\n/* harmony export */ browserName: () => (/* binding */ browserName),\n/* harmony export */ detect: () => (/* binding */ detect),\n/* harmony export */ detectOS: () => (/* binding */ detectOS),\n/* harmony export */ getNodeVersion: () => (/* binding */ getNodeVersion),\n/* harmony export */ parseUserAgent: () => (/* binding */ parseUserAgent)\n/* harmony export */ });\nvar __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nvar BrowserInfo = /** @class */ (function () {\n function BrowserInfo(name, version, os) {\n this.name = name;\n this.version = version;\n this.os = os;\n this.type = 'browser';\n }\n return BrowserInfo;\n}());\n\nvar NodeInfo = /** @class */ (function () {\n function NodeInfo(version) {\n this.version = version;\n this.type = 'node';\n this.name = 'node';\n this.os = process.platform;\n }\n return NodeInfo;\n}());\n\nvar SearchBotDeviceInfo = /** @class */ (function () {\n function SearchBotDeviceInfo(name, version, os, bot) {\n this.name = name;\n this.version = version;\n this.os = os;\n this.bot = bot;\n this.type = 'bot-device';\n }\n return SearchBotDeviceInfo;\n}());\n\nvar BotInfo = /** @class */ (function () {\n function BotInfo() {\n this.type = 'bot';\n this.bot = true; // NOTE: deprecated test name instead\n this.name = 'bot';\n this.version = null;\n this.os = null;\n }\n return BotInfo;\n}());\n\nvar ReactNativeInfo = /** @class */ (function () {\n function ReactNativeInfo() {\n this.type = 'react-native';\n this.name = 'react-native';\n this.version = null;\n this.os = null;\n }\n return ReactNativeInfo;\n}());\n\n// tslint:disable-next-line:max-line-length\nvar SEARCHBOX_UA_REGEX = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/;\nvar SEARCHBOT_OS_REGEX = /(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\\ Jeeves\\/Teoma|ia_archiver)/;\nvar REQUIRED_VERSION_PARTS = 3;\nvar userAgentRules = [\n ['aol', /AOLShield\\/([0-9\\._]+)/],\n ['edge', /Edge\\/([0-9\\._]+)/],\n ['edge-ios', /EdgiOS\\/([0-9\\._]+)/],\n ['yandexbrowser', /YaBrowser\\/([0-9\\._]+)/],\n ['kakaotalk', /KAKAOTALK\\s([0-9\\.]+)/],\n ['samsung', /SamsungBrowser\\/([0-9\\.]+)/],\n ['silk', /\\bSilk\\/([0-9._-]+)\\b/],\n ['miui', /MiuiBrowser\\/([0-9\\.]+)$/],\n ['beaker', /BeakerBrowser\\/([0-9\\.]+)/],\n ['edge-chromium', /EdgA?\\/([0-9\\.]+)/],\n [\n 'chromium-webview',\n /(?!Chrom.*OPR)wv\\).*Chrom(?:e|ium)\\/([0-9\\.]+)(:?\\s|$)/,\n ],\n ['chrome', /(?!Chrom.*OPR)Chrom(?:e|ium)\\/([0-9\\.]+)(:?\\s|$)/],\n ['phantomjs', /PhantomJS\\/([0-9\\.]+)(:?\\s|$)/],\n ['crios', /CriOS\\/([0-9\\.]+)(:?\\s|$)/],\n ['firefox', /Firefox\\/([0-9\\.]+)(?:\\s|$)/],\n ['fxios', /FxiOS\\/([0-9\\.]+)/],\n ['opera-mini', /Opera Mini.*Version\\/([0-9\\.]+)/],\n ['opera', /Opera\\/([0-9\\.]+)(?:\\s|$)/],\n ['opera', /OPR\\/([0-9\\.]+)(:?\\s|$)/],\n ['pie', /^Microsoft Pocket Internet Explorer\\/(\\d+\\.\\d+)$/],\n ['pie', /^Mozilla\\/\\d\\.\\d+\\s\\(compatible;\\s(?:MSP?IE|MSInternet Explorer) (\\d+\\.\\d+);.*Windows CE.*\\)$/],\n ['netfront', /^Mozilla\\/\\d\\.\\d+.*NetFront\\/(\\d.\\d)/],\n ['ie', /Trident\\/7\\.0.*rv\\:([0-9\\.]+).*\\).*Gecko$/],\n ['ie', /MSIE\\s([0-9\\.]+);.*Trident\\/[4-7].0/],\n ['ie', /MSIE\\s(7\\.0)/],\n ['bb10', /BB10;\\sTouch.*Version\\/([0-9\\.]+)/],\n ['android', /Android\\s([0-9\\.]+)/],\n ['ios', /Version\\/([0-9\\._]+).*Mobile.*Safari.*/],\n ['safari', /Version\\/([0-9\\._]+).*Safari/],\n ['facebook', /FB[AS]V\\/([0-9\\.]+)/],\n ['instagram', /Instagram\\s([0-9\\.]+)/],\n ['ios-webview', /AppleWebKit\\/([0-9\\.]+).*Mobile/],\n ['ios-webview', /AppleWebKit\\/([0-9\\.]+).*Gecko\\)$/],\n ['curl', /^curl\\/([0-9\\.]+)$/],\n ['searchbot', SEARCHBOX_UA_REGEX],\n];\nvar operatingSystemRules = [\n ['iOS', /iP(hone|od|ad)/],\n ['Android OS', /Android/],\n ['BlackBerry OS', /BlackBerry|BB10/],\n ['Windows Mobile', /IEMobile/],\n ['Amazon OS', /Kindle/],\n ['Windows 3.11', /Win16/],\n ['Windows 95', /(Windows 95)|(Win95)|(Windows_95)/],\n ['Windows 98', /(Windows 98)|(Win98)/],\n ['Windows 2000', /(Windows NT 5.0)|(Windows 2000)/],\n ['Windows XP', /(Windows NT 5.1)|(Windows XP)/],\n ['Windows Server 2003', /(Windows NT 5.2)/],\n ['Windows Vista', /(Windows NT 6.0)/],\n ['Windows 7', /(Windows NT 6.1)/],\n ['Windows 8', /(Windows NT 6.2)/],\n ['Windows 8.1', /(Windows NT 6.3)/],\n ['Windows 10', /(Windows NT 10.0)/],\n ['Windows ME', /Windows ME/],\n ['Windows CE', /Windows CE|WinCE|Microsoft Pocket Internet Explorer/],\n ['Open BSD', /OpenBSD/],\n ['Sun OS', /SunOS/],\n ['Chrome OS', /CrOS/],\n ['Linux', /(Linux)|(X11)/],\n ['Mac OS', /(Mac_PowerPC)|(Macintosh)/],\n ['QNX', /QNX/],\n ['BeOS', /BeOS/],\n ['OS/2', /OS\\/2/],\n];\nfunction detect(userAgent) {\n if (!!userAgent) {\n return parseUserAgent(userAgent);\n }\n if (typeof document === 'undefined' &&\n typeof navigator !== 'undefined' &&\n navigator.product === 'ReactNative') {\n return new ReactNativeInfo();\n }\n if (typeof navigator !== 'undefined') {\n return parseUserAgent(navigator.userAgent);\n }\n return getNodeVersion();\n}\nfunction matchUserAgent(ua) {\n // opted for using reduce here rather than Array#first with a regex.test call\n // this is primarily because using the reduce we only perform the regex\n // execution once rather than once for the test and for the exec again below\n // probably something that needs to be benchmarked though\n return (ua !== '' &&\n userAgentRules.reduce(function (matched, _a) {\n var browser = _a[0], regex = _a[1];\n if (matched) {\n return matched;\n }\n var uaMatch = regex.exec(ua);\n return !!uaMatch && [browser, uaMatch];\n }, false));\n}\nfunction browserName(ua) {\n var data = matchUserAgent(ua);\n return data ? data[0] : null;\n}\nfunction parseUserAgent(ua) {\n var matchedRule = matchUserAgent(ua);\n if (!matchedRule) {\n return null;\n }\n var name = matchedRule[0], match = matchedRule[1];\n if (name === 'searchbot') {\n return new BotInfo();\n }\n // Do not use RegExp for split operation as some browser do not support it (See: http://blog.stevenlevithan.com/archives/cross-browser-split)\n var versionParts = match[1] && match[1].split('.').join('_').split('_').slice(0, 3);\n if (versionParts) {\n if (versionParts.length < REQUIRED_VERSION_PARTS) {\n versionParts = __spreadArray(__spreadArray([], versionParts, true), createVersionParts(REQUIRED_VERSION_PARTS - versionParts.length), true);\n }\n }\n else {\n versionParts = [];\n }\n var version = versionParts.join('.');\n var os = detectOS(ua);\n var searchBotMatch = SEARCHBOT_OS_REGEX.exec(ua);\n if (searchBotMatch && searchBotMatch[1]) {\n return new SearchBotDeviceInfo(name, version, os, searchBotMatch[1]);\n }\n return new BrowserInfo(name, version, os);\n}\nfunction detectOS(ua) {\n for (var ii = 0, count = operatingSystemRules.length; ii < count; ii++) {\n var _a = operatingSystemRules[ii], os = _a[0], regex = _a[1];\n var match = regex.exec(ua);\n if (match) {\n return os;\n }\n }\n return null;\n}\nfunction getNodeVersion() {\n var isNode = typeof process !== 'undefined' && process.version;\n return isNode ? new NodeInfo(process.version.slice(1)) : null;\n}\nfunction createVersionParts(count) {\n var output = [];\n for (var ii = 0; ii < count; ii++) {\n output.push('0');\n }\n return output;\n}\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/detect-browser/es/index.js?"); - -/***/ }), - -/***/ "./node_modules/events/events.js": -/*!***************************************!*\ - !*** ./node_modules/events/events.js ***! - \***************************************/ -/***/ ((module) => { - -eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\nvar R = typeof Reflect === 'object' ? Reflect : null\nvar ReflectApply = R && typeof R.apply === 'function'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n }\n\nvar ReflectOwnKeys\nif (R && typeof R.ownKeys === 'function') {\n ReflectOwnKeys = R.ownKeys\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n}\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\nmodule.exports.once = once;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nfunction checkListener(listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n}\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + '.');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + '.');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction _getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === 'error');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n checkListener(listener);\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' ' + String(type) + ' listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n checkListener(listener);\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\nfunction once(emitter, name) {\n return new Promise(function (resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n\n function resolver() {\n if (typeof emitter.removeListener === 'function') {\n emitter.removeListener('error', errorListener);\n }\n resolve([].slice.call(arguments));\n };\n\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== 'error') {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n}\n\nfunction addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === 'function') {\n eventTargetAgnosticAddListener(emitter, 'error', handler, flags);\n }\n}\n\nfunction eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === 'function') {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === 'function') {\n // EventTarget does not have `error` event semantics like Node\n // EventEmitters, we do not listen for `error` events here.\n emitter.addEventListener(name, function wrapListener(arg) {\n // IE does not have builtin `{ once: true }` support so we\n // have to do it manually.\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError('The \"emitter\" argument must be of type EventEmitter. Received type ' + typeof emitter);\n }\n}\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/events/events.js?"); - -/***/ }), - -/***/ "./node_modules/filter-obj/index.js": -/*!******************************************!*\ - !*** ./node_modules/filter-obj/index.js ***! - \******************************************/ -/***/ ((module) => { - -eval("\nmodule.exports = function (obj, predicate) {\n\tvar ret = {};\n\tvar keys = Object.keys(obj);\n\tvar isArr = Array.isArray(predicate);\n\n\tfor (var i = 0; i < keys.length; i++) {\n\t\tvar key = keys[i];\n\t\tvar val = obj[key];\n\n\t\tif (isArr ? predicate.indexOf(key) !== -1 : predicate(key, val, obj)) {\n\t\t\tret[key] = val;\n\t\t}\n\t}\n\n\treturn ret;\n};\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/filter-obj/index.js?"); - -/***/ }), - -/***/ "./node_modules/hash.js/lib/hash.js": -/*!******************************************!*\ - !*** ./node_modules/hash.js/lib/hash.js ***! - \******************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("var hash = exports;\n\nhash.utils = __webpack_require__(/*! ./hash/utils */ \"./node_modules/hash.js/lib/hash/utils.js\");\nhash.common = __webpack_require__(/*! ./hash/common */ \"./node_modules/hash.js/lib/hash/common.js\");\nhash.sha = __webpack_require__(/*! ./hash/sha */ \"./node_modules/hash.js/lib/hash/sha.js\");\nhash.ripemd = __webpack_require__(/*! ./hash/ripemd */ \"./node_modules/hash.js/lib/hash/ripemd.js\");\nhash.hmac = __webpack_require__(/*! ./hash/hmac */ \"./node_modules/hash.js/lib/hash/hmac.js\");\n\n// Proxy hash functions to the main object\nhash.sha1 = hash.sha.sha1;\nhash.sha256 = hash.sha.sha256;\nhash.sha224 = hash.sha.sha224;\nhash.sha384 = hash.sha.sha384;\nhash.sha512 = hash.sha.sha512;\nhash.ripemd160 = hash.ripemd.ripemd160;\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/hash.js/lib/hash.js?"); - -/***/ }), - -/***/ "./node_modules/hash.js/lib/hash/common.js": -/*!*************************************************!*\ - !*** ./node_modules/hash.js/lib/hash/common.js ***! - \*************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\n\nvar utils = __webpack_require__(/*! ./utils */ \"./node_modules/hash.js/lib/hash/utils.js\");\nvar assert = __webpack_require__(/*! minimalistic-assert */ \"./node_modules/minimalistic-assert/index.js\");\n\nfunction BlockHash() {\n this.pending = null;\n this.pendingTotal = 0;\n this.blockSize = this.constructor.blockSize;\n this.outSize = this.constructor.outSize;\n this.hmacStrength = this.constructor.hmacStrength;\n this.padLength = this.constructor.padLength / 8;\n this.endian = 'big';\n\n this._delta8 = this.blockSize / 8;\n this._delta32 = this.blockSize / 32;\n}\nexports.BlockHash = BlockHash;\n\nBlockHash.prototype.update = function update(msg, enc) {\n // Convert message to array, pad it, and join into 32bit blocks\n msg = utils.toArray(msg, enc);\n if (!this.pending)\n this.pending = msg;\n else\n this.pending = this.pending.concat(msg);\n this.pendingTotal += msg.length;\n\n // Enough data, try updating\n if (this.pending.length >= this._delta8) {\n msg = this.pending;\n\n // Process pending data in blocks\n var r = msg.length % this._delta8;\n this.pending = msg.slice(msg.length - r, msg.length);\n if (this.pending.length === 0)\n this.pending = null;\n\n msg = utils.join32(msg, 0, msg.length - r, this.endian);\n for (var i = 0; i < msg.length; i += this._delta32)\n this._update(msg, i, i + this._delta32);\n }\n\n return this;\n};\n\nBlockHash.prototype.digest = function digest(enc) {\n this.update(this._pad());\n assert(this.pending === null);\n\n return this._digest(enc);\n};\n\nBlockHash.prototype._pad = function pad() {\n var len = this.pendingTotal;\n var bytes = this._delta8;\n var k = bytes - ((len + this.padLength) % bytes);\n var res = new Array(k + this.padLength);\n res[0] = 0x80;\n for (var i = 1; i < k; i++)\n res[i] = 0;\n\n // Append length\n len <<= 3;\n if (this.endian === 'big') {\n for (var t = 8; t < this.padLength; t++)\n res[i++] = 0;\n\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = (len >>> 24) & 0xff;\n res[i++] = (len >>> 16) & 0xff;\n res[i++] = (len >>> 8) & 0xff;\n res[i++] = len & 0xff;\n } else {\n res[i++] = len & 0xff;\n res[i++] = (len >>> 8) & 0xff;\n res[i++] = (len >>> 16) & 0xff;\n res[i++] = (len >>> 24) & 0xff;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n\n for (t = 8; t < this.padLength; t++)\n res[i++] = 0;\n }\n\n return res;\n};\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/hash.js/lib/hash/common.js?"); - -/***/ }), - -/***/ "./node_modules/hash.js/lib/hash/hmac.js": -/*!***********************************************!*\ - !*** ./node_modules/hash.js/lib/hash/hmac.js ***! - \***********************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -eval("\n\nvar utils = __webpack_require__(/*! ./utils */ \"./node_modules/hash.js/lib/hash/utils.js\");\nvar assert = __webpack_require__(/*! minimalistic-assert */ \"./node_modules/minimalistic-assert/index.js\");\n\nfunction Hmac(hash, key, enc) {\n if (!(this instanceof Hmac))\n return new Hmac(hash, key, enc);\n this.Hash = hash;\n this.blockSize = hash.blockSize / 8;\n this.outSize = hash.outSize / 8;\n this.inner = null;\n this.outer = null;\n\n this._init(utils.toArray(key, enc));\n}\nmodule.exports = Hmac;\n\nHmac.prototype._init = function init(key) {\n // Shorten key, if needed\n if (key.length > this.blockSize)\n key = new this.Hash().update(key).digest();\n assert(key.length <= this.blockSize);\n\n // Add padding to key\n for (var i = key.length; i < this.blockSize; i++)\n key.push(0);\n\n for (i = 0; i < key.length; i++)\n key[i] ^= 0x36;\n this.inner = new this.Hash().update(key);\n\n // 0x36 ^ 0x5c = 0x6a\n for (i = 0; i < key.length; i++)\n key[i] ^= 0x6a;\n this.outer = new this.Hash().update(key);\n};\n\nHmac.prototype.update = function update(msg, enc) {\n this.inner.update(msg, enc);\n return this;\n};\n\nHmac.prototype.digest = function digest(enc) {\n this.outer.update(this.inner.digest());\n return this.outer.digest(enc);\n};\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/hash.js/lib/hash/hmac.js?"); - -/***/ }), - -/***/ "./node_modules/hash.js/lib/hash/ripemd.js": -/*!*************************************************!*\ - !*** ./node_modules/hash.js/lib/hash/ripemd.js ***! - \*************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\n\nvar utils = __webpack_require__(/*! ./utils */ \"./node_modules/hash.js/lib/hash/utils.js\");\nvar common = __webpack_require__(/*! ./common */ \"./node_modules/hash.js/lib/hash/common.js\");\n\nvar rotl32 = utils.rotl32;\nvar sum32 = utils.sum32;\nvar sum32_3 = utils.sum32_3;\nvar sum32_4 = utils.sum32_4;\nvar BlockHash = common.BlockHash;\n\nfunction RIPEMD160() {\n if (!(this instanceof RIPEMD160))\n return new RIPEMD160();\n\n BlockHash.call(this);\n\n this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ];\n this.endian = 'little';\n}\nutils.inherits(RIPEMD160, BlockHash);\nexports.ripemd160 = RIPEMD160;\n\nRIPEMD160.blockSize = 512;\nRIPEMD160.outSize = 160;\nRIPEMD160.hmacStrength = 192;\nRIPEMD160.padLength = 64;\n\nRIPEMD160.prototype._update = function update(msg, start) {\n var A = this.h[0];\n var B = this.h[1];\n var C = this.h[2];\n var D = this.h[3];\n var E = this.h[4];\n var Ah = A;\n var Bh = B;\n var Ch = C;\n var Dh = D;\n var Eh = E;\n for (var j = 0; j < 80; j++) {\n var T = sum32(\n rotl32(\n sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)),\n s[j]),\n E);\n A = E;\n E = D;\n D = rotl32(C, 10);\n C = B;\n B = T;\n T = sum32(\n rotl32(\n sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)),\n sh[j]),\n Eh);\n Ah = Eh;\n Eh = Dh;\n Dh = rotl32(Ch, 10);\n Ch = Bh;\n Bh = T;\n }\n T = sum32_3(this.h[1], C, Dh);\n this.h[1] = sum32_3(this.h[2], D, Eh);\n this.h[2] = sum32_3(this.h[3], E, Ah);\n this.h[3] = sum32_3(this.h[4], A, Bh);\n this.h[4] = sum32_3(this.h[0], B, Ch);\n this.h[0] = T;\n};\n\nRIPEMD160.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'little');\n else\n return utils.split32(this.h, 'little');\n};\n\nfunction f(j, x, y, z) {\n if (j <= 15)\n return x ^ y ^ z;\n else if (j <= 31)\n return (x & y) | ((~x) & z);\n else if (j <= 47)\n return (x | (~y)) ^ z;\n else if (j <= 63)\n return (x & z) | (y & (~z));\n else\n return x ^ (y | (~z));\n}\n\nfunction K(j) {\n if (j <= 15)\n return 0x00000000;\n else if (j <= 31)\n return 0x5a827999;\n else if (j <= 47)\n return 0x6ed9eba1;\n else if (j <= 63)\n return 0x8f1bbcdc;\n else\n return 0xa953fd4e;\n}\n\nfunction Kh(j) {\n if (j <= 15)\n return 0x50a28be6;\n else if (j <= 31)\n return 0x5c4dd124;\n else if (j <= 47)\n return 0x6d703ef3;\n else if (j <= 63)\n return 0x7a6d76e9;\n else\n return 0x00000000;\n}\n\nvar r = [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,\n 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,\n 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,\n 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13\n];\n\nvar rh = [\n 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,\n 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,\n 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,\n 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,\n 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11\n];\n\nvar s = [\n 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,\n 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,\n 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,\n 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,\n 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6\n];\n\nvar sh = [\n 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,\n 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,\n 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,\n 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,\n 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11\n];\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/hash.js/lib/hash/ripemd.js?"); - -/***/ }), - -/***/ "./node_modules/hash.js/lib/hash/sha.js": -/*!**********************************************!*\ - !*** ./node_modules/hash.js/lib/hash/sha.js ***! - \**********************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\n\nexports.sha1 = __webpack_require__(/*! ./sha/1 */ \"./node_modules/hash.js/lib/hash/sha/1.js\");\nexports.sha224 = __webpack_require__(/*! ./sha/224 */ \"./node_modules/hash.js/lib/hash/sha/224.js\");\nexports.sha256 = __webpack_require__(/*! ./sha/256 */ \"./node_modules/hash.js/lib/hash/sha/256.js\");\nexports.sha384 = __webpack_require__(/*! ./sha/384 */ \"./node_modules/hash.js/lib/hash/sha/384.js\");\nexports.sha512 = __webpack_require__(/*! ./sha/512 */ \"./node_modules/hash.js/lib/hash/sha/512.js\");\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/hash.js/lib/hash/sha.js?"); - -/***/ }), - -/***/ "./node_modules/hash.js/lib/hash/sha/1.js": -/*!************************************************!*\ - !*** ./node_modules/hash.js/lib/hash/sha/1.js ***! - \************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -eval("\n\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/hash.js/lib/hash/utils.js\");\nvar common = __webpack_require__(/*! ../common */ \"./node_modules/hash.js/lib/hash/common.js\");\nvar shaCommon = __webpack_require__(/*! ./common */ \"./node_modules/hash.js/lib/hash/sha/common.js\");\n\nvar rotl32 = utils.rotl32;\nvar sum32 = utils.sum32;\nvar sum32_5 = utils.sum32_5;\nvar ft_1 = shaCommon.ft_1;\nvar BlockHash = common.BlockHash;\n\nvar sha1_K = [\n 0x5A827999, 0x6ED9EBA1,\n 0x8F1BBCDC, 0xCA62C1D6\n];\n\nfunction SHA1() {\n if (!(this instanceof SHA1))\n return new SHA1();\n\n BlockHash.call(this);\n this.h = [\n 0x67452301, 0xefcdab89, 0x98badcfe,\n 0x10325476, 0xc3d2e1f0 ];\n this.W = new Array(80);\n}\n\nutils.inherits(SHA1, BlockHash);\nmodule.exports = SHA1;\n\nSHA1.blockSize = 512;\nSHA1.outSize = 160;\nSHA1.hmacStrength = 80;\nSHA1.padLength = 64;\n\nSHA1.prototype._update = function _update(msg, start) {\n var W = this.W;\n\n for (var i = 0; i < 16; i++)\n W[i] = msg[start + i];\n\n for(; i < W.length; i++)\n W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);\n\n var a = this.h[0];\n var b = this.h[1];\n var c = this.h[2];\n var d = this.h[3];\n var e = this.h[4];\n\n for (i = 0; i < W.length; i++) {\n var s = ~~(i / 20);\n var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);\n e = d;\n d = c;\n c = rotl32(b, 30);\n b = a;\n a = t;\n }\n\n this.h[0] = sum32(this.h[0], a);\n this.h[1] = sum32(this.h[1], b);\n this.h[2] = sum32(this.h[2], c);\n this.h[3] = sum32(this.h[3], d);\n this.h[4] = sum32(this.h[4], e);\n};\n\nSHA1.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'big');\n else\n return utils.split32(this.h, 'big');\n};\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/hash.js/lib/hash/sha/1.js?"); - -/***/ }), - -/***/ "./node_modules/hash.js/lib/hash/sha/224.js": -/*!**************************************************!*\ - !*** ./node_modules/hash.js/lib/hash/sha/224.js ***! - \**************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -eval("\n\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/hash.js/lib/hash/utils.js\");\nvar SHA256 = __webpack_require__(/*! ./256 */ \"./node_modules/hash.js/lib/hash/sha/256.js\");\n\nfunction SHA224() {\n if (!(this instanceof SHA224))\n return new SHA224();\n\n SHA256.call(this);\n this.h = [\n 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,\n 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ];\n}\nutils.inherits(SHA224, SHA256);\nmodule.exports = SHA224;\n\nSHA224.blockSize = 512;\nSHA224.outSize = 224;\nSHA224.hmacStrength = 192;\nSHA224.padLength = 64;\n\nSHA224.prototype._digest = function digest(enc) {\n // Just truncate output\n if (enc === 'hex')\n return utils.toHex32(this.h.slice(0, 7), 'big');\n else\n return utils.split32(this.h.slice(0, 7), 'big');\n};\n\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/hash.js/lib/hash/sha/224.js?"); - -/***/ }), - -/***/ "./node_modules/hash.js/lib/hash/sha/256.js": -/*!**************************************************!*\ - !*** ./node_modules/hash.js/lib/hash/sha/256.js ***! - \**************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -eval("\n\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/hash.js/lib/hash/utils.js\");\nvar common = __webpack_require__(/*! ../common */ \"./node_modules/hash.js/lib/hash/common.js\");\nvar shaCommon = __webpack_require__(/*! ./common */ \"./node_modules/hash.js/lib/hash/sha/common.js\");\nvar assert = __webpack_require__(/*! minimalistic-assert */ \"./node_modules/minimalistic-assert/index.js\");\n\nvar sum32 = utils.sum32;\nvar sum32_4 = utils.sum32_4;\nvar sum32_5 = utils.sum32_5;\nvar ch32 = shaCommon.ch32;\nvar maj32 = shaCommon.maj32;\nvar s0_256 = shaCommon.s0_256;\nvar s1_256 = shaCommon.s1_256;\nvar g0_256 = shaCommon.g0_256;\nvar g1_256 = shaCommon.g1_256;\n\nvar BlockHash = common.BlockHash;\n\nvar sha256_K = [\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,\n 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,\n 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,\n 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,\n 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,\n 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,\n 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n];\n\nfunction SHA256() {\n if (!(this instanceof SHA256))\n return new SHA256();\n\n BlockHash.call(this);\n this.h = [\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,\n 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19\n ];\n this.k = sha256_K;\n this.W = new Array(64);\n}\nutils.inherits(SHA256, BlockHash);\nmodule.exports = SHA256;\n\nSHA256.blockSize = 512;\nSHA256.outSize = 256;\nSHA256.hmacStrength = 192;\nSHA256.padLength = 64;\n\nSHA256.prototype._update = function _update(msg, start) {\n var W = this.W;\n\n for (var i = 0; i < 16; i++)\n W[i] = msg[start + i];\n for (; i < W.length; i++)\n W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);\n\n var a = this.h[0];\n var b = this.h[1];\n var c = this.h[2];\n var d = this.h[3];\n var e = this.h[4];\n var f = this.h[5];\n var g = this.h[6];\n var h = this.h[7];\n\n assert(this.k.length === W.length);\n for (i = 0; i < W.length; i++) {\n var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);\n var T2 = sum32(s0_256(a), maj32(a, b, c));\n h = g;\n g = f;\n f = e;\n e = sum32(d, T1);\n d = c;\n c = b;\n b = a;\n a = sum32(T1, T2);\n }\n\n this.h[0] = sum32(this.h[0], a);\n this.h[1] = sum32(this.h[1], b);\n this.h[2] = sum32(this.h[2], c);\n this.h[3] = sum32(this.h[3], d);\n this.h[4] = sum32(this.h[4], e);\n this.h[5] = sum32(this.h[5], f);\n this.h[6] = sum32(this.h[6], g);\n this.h[7] = sum32(this.h[7], h);\n};\n\nSHA256.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'big');\n else\n return utils.split32(this.h, 'big');\n};\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/hash.js/lib/hash/sha/256.js?"); - -/***/ }), - -/***/ "./node_modules/hash.js/lib/hash/sha/384.js": -/*!**************************************************!*\ - !*** ./node_modules/hash.js/lib/hash/sha/384.js ***! - \**************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -eval("\n\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/hash.js/lib/hash/utils.js\");\n\nvar SHA512 = __webpack_require__(/*! ./512 */ \"./node_modules/hash.js/lib/hash/sha/512.js\");\n\nfunction SHA384() {\n if (!(this instanceof SHA384))\n return new SHA384();\n\n SHA512.call(this);\n this.h = [\n 0xcbbb9d5d, 0xc1059ed8,\n 0x629a292a, 0x367cd507,\n 0x9159015a, 0x3070dd17,\n 0x152fecd8, 0xf70e5939,\n 0x67332667, 0xffc00b31,\n 0x8eb44a87, 0x68581511,\n 0xdb0c2e0d, 0x64f98fa7,\n 0x47b5481d, 0xbefa4fa4 ];\n}\nutils.inherits(SHA384, SHA512);\nmodule.exports = SHA384;\n\nSHA384.blockSize = 1024;\nSHA384.outSize = 384;\nSHA384.hmacStrength = 192;\nSHA384.padLength = 128;\n\nSHA384.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h.slice(0, 12), 'big');\n else\n return utils.split32(this.h.slice(0, 12), 'big');\n};\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/hash.js/lib/hash/sha/384.js?"); - -/***/ }), - -/***/ "./node_modules/hash.js/lib/hash/sha/512.js": -/*!**************************************************!*\ - !*** ./node_modules/hash.js/lib/hash/sha/512.js ***! - \**************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -eval("\n\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/hash.js/lib/hash/utils.js\");\nvar common = __webpack_require__(/*! ../common */ \"./node_modules/hash.js/lib/hash/common.js\");\nvar assert = __webpack_require__(/*! minimalistic-assert */ \"./node_modules/minimalistic-assert/index.js\");\n\nvar rotr64_hi = utils.rotr64_hi;\nvar rotr64_lo = utils.rotr64_lo;\nvar shr64_hi = utils.shr64_hi;\nvar shr64_lo = utils.shr64_lo;\nvar sum64 = utils.sum64;\nvar sum64_hi = utils.sum64_hi;\nvar sum64_lo = utils.sum64_lo;\nvar sum64_4_hi = utils.sum64_4_hi;\nvar sum64_4_lo = utils.sum64_4_lo;\nvar sum64_5_hi = utils.sum64_5_hi;\nvar sum64_5_lo = utils.sum64_5_lo;\n\nvar BlockHash = common.BlockHash;\n\nvar sha512_K = [\n 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,\n 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,\n 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,\n 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,\n 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,\n 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,\n 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,\n 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,\n 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,\n 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,\n 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,\n 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,\n 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,\n 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,\n 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,\n 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,\n 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,\n 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,\n 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,\n 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,\n 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,\n 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,\n 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,\n 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,\n 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,\n 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,\n 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,\n 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,\n 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,\n 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,\n 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,\n 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,\n 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,\n 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,\n 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,\n 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,\n 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,\n 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,\n 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,\n 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817\n];\n\nfunction SHA512() {\n if (!(this instanceof SHA512))\n return new SHA512();\n\n BlockHash.call(this);\n this.h = [\n 0x6a09e667, 0xf3bcc908,\n 0xbb67ae85, 0x84caa73b,\n 0x3c6ef372, 0xfe94f82b,\n 0xa54ff53a, 0x5f1d36f1,\n 0x510e527f, 0xade682d1,\n 0x9b05688c, 0x2b3e6c1f,\n 0x1f83d9ab, 0xfb41bd6b,\n 0x5be0cd19, 0x137e2179 ];\n this.k = sha512_K;\n this.W = new Array(160);\n}\nutils.inherits(SHA512, BlockHash);\nmodule.exports = SHA512;\n\nSHA512.blockSize = 1024;\nSHA512.outSize = 512;\nSHA512.hmacStrength = 192;\nSHA512.padLength = 128;\n\nSHA512.prototype._prepareBlock = function _prepareBlock(msg, start) {\n var W = this.W;\n\n // 32 x 32bit words\n for (var i = 0; i < 32; i++)\n W[i] = msg[start + i];\n for (; i < W.length; i += 2) {\n var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2\n var c0_lo = g1_512_lo(W[i - 4], W[i - 3]);\n var c1_hi = W[i - 14]; // i - 7\n var c1_lo = W[i - 13];\n var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15\n var c2_lo = g0_512_lo(W[i - 30], W[i - 29]);\n var c3_hi = W[i - 32]; // i - 16\n var c3_lo = W[i - 31];\n\n W[i] = sum64_4_hi(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo);\n W[i + 1] = sum64_4_lo(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo);\n }\n};\n\nSHA512.prototype._update = function _update(msg, start) {\n this._prepareBlock(msg, start);\n\n var W = this.W;\n\n var ah = this.h[0];\n var al = this.h[1];\n var bh = this.h[2];\n var bl = this.h[3];\n var ch = this.h[4];\n var cl = this.h[5];\n var dh = this.h[6];\n var dl = this.h[7];\n var eh = this.h[8];\n var el = this.h[9];\n var fh = this.h[10];\n var fl = this.h[11];\n var gh = this.h[12];\n var gl = this.h[13];\n var hh = this.h[14];\n var hl = this.h[15];\n\n assert(this.k.length === W.length);\n for (var i = 0; i < W.length; i += 2) {\n var c0_hi = hh;\n var c0_lo = hl;\n var c1_hi = s1_512_hi(eh, el);\n var c1_lo = s1_512_lo(eh, el);\n var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl);\n var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);\n var c3_hi = this.k[i];\n var c3_lo = this.k[i + 1];\n var c4_hi = W[i];\n var c4_lo = W[i + 1];\n\n var T1_hi = sum64_5_hi(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo,\n c4_hi, c4_lo);\n var T1_lo = sum64_5_lo(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo,\n c4_hi, c4_lo);\n\n c0_hi = s0_512_hi(ah, al);\n c0_lo = s0_512_lo(ah, al);\n c1_hi = maj64_hi(ah, al, bh, bl, ch, cl);\n c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);\n\n var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);\n var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);\n\n hh = gh;\n hl = gl;\n\n gh = fh;\n gl = fl;\n\n fh = eh;\n fl = el;\n\n eh = sum64_hi(dh, dl, T1_hi, T1_lo);\n el = sum64_lo(dl, dl, T1_hi, T1_lo);\n\n dh = ch;\n dl = cl;\n\n ch = bh;\n cl = bl;\n\n bh = ah;\n bl = al;\n\n ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo);\n al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);\n }\n\n sum64(this.h, 0, ah, al);\n sum64(this.h, 2, bh, bl);\n sum64(this.h, 4, ch, cl);\n sum64(this.h, 6, dh, dl);\n sum64(this.h, 8, eh, el);\n sum64(this.h, 10, fh, fl);\n sum64(this.h, 12, gh, gl);\n sum64(this.h, 14, hh, hl);\n};\n\nSHA512.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'big');\n else\n return utils.split32(this.h, 'big');\n};\n\nfunction ch64_hi(xh, xl, yh, yl, zh) {\n var r = (xh & yh) ^ ((~xh) & zh);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction ch64_lo(xh, xl, yh, yl, zh, zl) {\n var r = (xl & yl) ^ ((~xl) & zl);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction maj64_hi(xh, xl, yh, yl, zh) {\n var r = (xh & yh) ^ (xh & zh) ^ (yh & zh);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction maj64_lo(xh, xl, yh, yl, zh, zl) {\n var r = (xl & yl) ^ (xl & zl) ^ (yl & zl);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 28);\n var c1_hi = rotr64_hi(xl, xh, 2); // 34\n var c2_hi = rotr64_hi(xl, xh, 7); // 39\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 28);\n var c1_lo = rotr64_lo(xl, xh, 2); // 34\n var c2_lo = rotr64_lo(xl, xh, 7); // 39\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 14);\n var c1_hi = rotr64_hi(xh, xl, 18);\n var c2_hi = rotr64_hi(xl, xh, 9); // 41\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 14);\n var c1_lo = rotr64_lo(xh, xl, 18);\n var c2_lo = rotr64_lo(xl, xh, 9); // 41\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 1);\n var c1_hi = rotr64_hi(xh, xl, 8);\n var c2_hi = shr64_hi(xh, xl, 7);\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 1);\n var c1_lo = rotr64_lo(xh, xl, 8);\n var c2_lo = shr64_lo(xh, xl, 7);\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 19);\n var c1_hi = rotr64_hi(xl, xh, 29); // 61\n var c2_hi = shr64_hi(xh, xl, 6);\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 19);\n var c1_lo = rotr64_lo(xl, xh, 29); // 61\n var c2_lo = shr64_lo(xh, xl, 6);\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/hash.js/lib/hash/sha/512.js?"); - -/***/ }), - -/***/ "./node_modules/hash.js/lib/hash/sha/common.js": -/*!*****************************************************!*\ - !*** ./node_modules/hash.js/lib/hash/sha/common.js ***! - \*****************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\n\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/hash.js/lib/hash/utils.js\");\nvar rotr32 = utils.rotr32;\n\nfunction ft_1(s, x, y, z) {\n if (s === 0)\n return ch32(x, y, z);\n if (s === 1 || s === 3)\n return p32(x, y, z);\n if (s === 2)\n return maj32(x, y, z);\n}\nexports.ft_1 = ft_1;\n\nfunction ch32(x, y, z) {\n return (x & y) ^ ((~x) & z);\n}\nexports.ch32 = ch32;\n\nfunction maj32(x, y, z) {\n return (x & y) ^ (x & z) ^ (y & z);\n}\nexports.maj32 = maj32;\n\nfunction p32(x, y, z) {\n return x ^ y ^ z;\n}\nexports.p32 = p32;\n\nfunction s0_256(x) {\n return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);\n}\nexports.s0_256 = s0_256;\n\nfunction s1_256(x) {\n return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);\n}\nexports.s1_256 = s1_256;\n\nfunction g0_256(x) {\n return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3);\n}\nexports.g0_256 = g0_256;\n\nfunction g1_256(x) {\n return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10);\n}\nexports.g1_256 = g1_256;\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/hash.js/lib/hash/sha/common.js?"); - -/***/ }), - -/***/ "./node_modules/hash.js/lib/hash/utils.js": -/*!************************************************!*\ - !*** ./node_modules/hash.js/lib/hash/utils.js ***! - \************************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\n\nvar assert = __webpack_require__(/*! minimalistic-assert */ \"./node_modules/minimalistic-assert/index.js\");\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n\nexports.inherits = inherits;\n\nfunction isSurrogatePair(msg, i) {\n if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) {\n return false;\n }\n if (i < 0 || i + 1 >= msg.length) {\n return false;\n }\n return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00;\n}\n\nfunction toArray(msg, enc) {\n if (Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg === 'string') {\n if (!enc) {\n // Inspired by stringToUtf8ByteArray() in closure-library by Google\n // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143\n // Apache License 2.0\n // https://github.com/google/closure-library/blob/master/LICENSE\n var p = 0;\n for (var i = 0; i < msg.length; i++) {\n var c = msg.charCodeAt(i);\n if (c < 128) {\n res[p++] = c;\n } else if (c < 2048) {\n res[p++] = (c >> 6) | 192;\n res[p++] = (c & 63) | 128;\n } else if (isSurrogatePair(msg, i)) {\n c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF);\n res[p++] = (c >> 18) | 240;\n res[p++] = ((c >> 12) & 63) | 128;\n res[p++] = ((c >> 6) & 63) | 128;\n res[p++] = (c & 63) | 128;\n } else {\n res[p++] = (c >> 12) | 224;\n res[p++] = ((c >> 6) & 63) | 128;\n res[p++] = (c & 63) | 128;\n }\n }\n } else if (enc === 'hex') {\n msg = msg.replace(/[^a-z0-9]+/ig, '');\n if (msg.length % 2 !== 0)\n msg = '0' + msg;\n for (i = 0; i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n }\n } else {\n for (i = 0; i < msg.length; i++)\n res[i] = msg[i] | 0;\n }\n return res;\n}\nexports.toArray = toArray;\n\nfunction toHex(msg) {\n var res = '';\n for (var i = 0; i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n}\nexports.toHex = toHex;\n\nfunction htonl(w) {\n var res = (w >>> 24) |\n ((w >>> 8) & 0xff00) |\n ((w << 8) & 0xff0000) |\n ((w & 0xff) << 24);\n return res >>> 0;\n}\nexports.htonl = htonl;\n\nfunction toHex32(msg, endian) {\n var res = '';\n for (var i = 0; i < msg.length; i++) {\n var w = msg[i];\n if (endian === 'little')\n w = htonl(w);\n res += zero8(w.toString(16));\n }\n return res;\n}\nexports.toHex32 = toHex32;\n\nfunction zero2(word) {\n if (word.length === 1)\n return '0' + word;\n else\n return word;\n}\nexports.zero2 = zero2;\n\nfunction zero8(word) {\n if (word.length === 7)\n return '0' + word;\n else if (word.length === 6)\n return '00' + word;\n else if (word.length === 5)\n return '000' + word;\n else if (word.length === 4)\n return '0000' + word;\n else if (word.length === 3)\n return '00000' + word;\n else if (word.length === 2)\n return '000000' + word;\n else if (word.length === 1)\n return '0000000' + word;\n else\n return word;\n}\nexports.zero8 = zero8;\n\nfunction join32(msg, start, end, endian) {\n var len = end - start;\n assert(len % 4 === 0);\n var res = new Array(len / 4);\n for (var i = 0, k = start; i < res.length; i++, k += 4) {\n var w;\n if (endian === 'big')\n w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3];\n else\n w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k];\n res[i] = w >>> 0;\n }\n return res;\n}\nexports.join32 = join32;\n\nfunction split32(msg, endian) {\n var res = new Array(msg.length * 4);\n for (var i = 0, k = 0; i < msg.length; i++, k += 4) {\n var m = msg[i];\n if (endian === 'big') {\n res[k] = m >>> 24;\n res[k + 1] = (m >>> 16) & 0xff;\n res[k + 2] = (m >>> 8) & 0xff;\n res[k + 3] = m & 0xff;\n } else {\n res[k + 3] = m >>> 24;\n res[k + 2] = (m >>> 16) & 0xff;\n res[k + 1] = (m >>> 8) & 0xff;\n res[k] = m & 0xff;\n }\n }\n return res;\n}\nexports.split32 = split32;\n\nfunction rotr32(w, b) {\n return (w >>> b) | (w << (32 - b));\n}\nexports.rotr32 = rotr32;\n\nfunction rotl32(w, b) {\n return (w << b) | (w >>> (32 - b));\n}\nexports.rotl32 = rotl32;\n\nfunction sum32(a, b) {\n return (a + b) >>> 0;\n}\nexports.sum32 = sum32;\n\nfunction sum32_3(a, b, c) {\n return (a + b + c) >>> 0;\n}\nexports.sum32_3 = sum32_3;\n\nfunction sum32_4(a, b, c, d) {\n return (a + b + c + d) >>> 0;\n}\nexports.sum32_4 = sum32_4;\n\nfunction sum32_5(a, b, c, d, e) {\n return (a + b + c + d + e) >>> 0;\n}\nexports.sum32_5 = sum32_5;\n\nfunction sum64(buf, pos, ah, al) {\n var bh = buf[pos];\n var bl = buf[pos + 1];\n\n var lo = (al + bl) >>> 0;\n var hi = (lo < al ? 1 : 0) + ah + bh;\n buf[pos] = hi >>> 0;\n buf[pos + 1] = lo;\n}\nexports.sum64 = sum64;\n\nfunction sum64_hi(ah, al, bh, bl) {\n var lo = (al + bl) >>> 0;\n var hi = (lo < al ? 1 : 0) + ah + bh;\n return hi >>> 0;\n}\nexports.sum64_hi = sum64_hi;\n\nfunction sum64_lo(ah, al, bh, bl) {\n var lo = al + bl;\n return lo >>> 0;\n}\nexports.sum64_lo = sum64_lo;\n\nfunction sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {\n var carry = 0;\n var lo = al;\n lo = (lo + bl) >>> 0;\n carry += lo < al ? 1 : 0;\n lo = (lo + cl) >>> 0;\n carry += lo < cl ? 1 : 0;\n lo = (lo + dl) >>> 0;\n carry += lo < dl ? 1 : 0;\n\n var hi = ah + bh + ch + dh + carry;\n return hi >>> 0;\n}\nexports.sum64_4_hi = sum64_4_hi;\n\nfunction sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {\n var lo = al + bl + cl + dl;\n return lo >>> 0;\n}\nexports.sum64_4_lo = sum64_4_lo;\n\nfunction sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {\n var carry = 0;\n var lo = al;\n lo = (lo + bl) >>> 0;\n carry += lo < al ? 1 : 0;\n lo = (lo + cl) >>> 0;\n carry += lo < cl ? 1 : 0;\n lo = (lo + dl) >>> 0;\n carry += lo < dl ? 1 : 0;\n lo = (lo + el) >>> 0;\n carry += lo < el ? 1 : 0;\n\n var hi = ah + bh + ch + dh + eh + carry;\n return hi >>> 0;\n}\nexports.sum64_5_hi = sum64_5_hi;\n\nfunction sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {\n var lo = al + bl + cl + dl + el;\n\n return lo >>> 0;\n}\nexports.sum64_5_lo = sum64_5_lo;\n\nfunction rotr64_hi(ah, al, num) {\n var r = (al << (32 - num)) | (ah >>> num);\n return r >>> 0;\n}\nexports.rotr64_hi = rotr64_hi;\n\nfunction rotr64_lo(ah, al, num) {\n var r = (ah << (32 - num)) | (al >>> num);\n return r >>> 0;\n}\nexports.rotr64_lo = rotr64_lo;\n\nfunction shr64_hi(ah, al, num) {\n return ah >>> num;\n}\nexports.shr64_hi = shr64_hi;\n\nfunction shr64_lo(ah, al, num) {\n var r = (ah << (32 - num)) | (al >>> num);\n return r >>> 0;\n}\nexports.shr64_lo = shr64_lo;\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/hash.js/lib/hash/utils.js?"); - -/***/ }), - -/***/ "./node_modules/inherits/inherits_browser.js": -/*!***************************************************!*\ - !*** ./node_modules/inherits/inherits_browser.js ***! - \***************************************************/ -/***/ ((module) => { - -eval("if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n })\n }\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n }\n}\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/inherits/inherits_browser.js?"); - -/***/ }), - -/***/ "./node_modules/isomorphic-unfetch/browser.js": -/*!****************************************************!*\ - !*** ./node_modules/isomorphic-unfetch/browser.js ***! - \****************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -eval("module.exports = self.fetch || (self.fetch = (__webpack_require__(/*! unfetch */ \"./node_modules/unfetch/dist/unfetch.module.js\")[\"default\"]) || __webpack_require__(/*! unfetch */ \"./node_modules/unfetch/dist/unfetch.module.js\"));\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/isomorphic-unfetch/browser.js?"); - -/***/ }), - -/***/ "./node_modules/js-sha3/src/sha3.js": -/*!******************************************!*\ - !*** ./node_modules/js-sha3/src/sha3.js ***! - \******************************************/ -/***/ ((module, exports, __webpack_require__) => { - -eval("var __WEBPACK_AMD_DEFINE_RESULT__;/**\n * [js-sha3]{@link https://github.com/emn178/js-sha3}\n *\n * @version 0.8.0\n * @author Chen, Yi-Cyuan [emn178@gmail.com]\n * @copyright Chen, Yi-Cyuan 2015-2018\n * @license MIT\n */\n/*jslint bitwise: true */\n(function () {\n 'use strict';\n\n var INPUT_ERROR = 'input is invalid type';\n var FINALIZE_ERROR = 'finalize already called';\n var WINDOW = typeof window === 'object';\n var root = WINDOW ? window : {};\n if (root.JS_SHA3_NO_WINDOW) {\n WINDOW = false;\n }\n var WEB_WORKER = !WINDOW && typeof self === 'object';\n var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;\n if (NODE_JS) {\n root = __webpack_require__.g;\n } else if (WEB_WORKER) {\n root = self;\n }\n var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && \"object\" === 'object' && module.exports;\n var AMD = true && __webpack_require__.amdO;\n var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';\n var HEX_CHARS = '0123456789abcdef'.split('');\n var SHAKE_PADDING = [31, 7936, 2031616, 520093696];\n var CSHAKE_PADDING = [4, 1024, 262144, 67108864];\n var KECCAK_PADDING = [1, 256, 65536, 16777216];\n var PADDING = [6, 1536, 393216, 100663296];\n var SHIFT = [0, 8, 16, 24];\n var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649,\n 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0,\n 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771,\n 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648,\n 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648];\n var BITS = [224, 256, 384, 512];\n var SHAKE_BITS = [128, 256];\n var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest'];\n var CSHAKE_BYTEPAD = {\n '128': 168,\n '256': 136\n };\n\n if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) {\n Array.isArray = function (obj) {\n return Object.prototype.toString.call(obj) === '[object Array]';\n };\n }\n\n if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) {\n ArrayBuffer.isView = function (obj) {\n return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;\n };\n }\n\n var createOutputMethod = function (bits, padding, outputType) {\n return function (message) {\n return new Keccak(bits, padding, bits).update(message)[outputType]();\n };\n };\n\n var createShakeOutputMethod = function (bits, padding, outputType) {\n return function (message, outputBits) {\n return new Keccak(bits, padding, outputBits).update(message)[outputType]();\n };\n };\n\n var createCshakeOutputMethod = function (bits, padding, outputType) {\n return function (message, outputBits, n, s) {\n return methods['cshake' + bits].update(message, outputBits, n, s)[outputType]();\n };\n };\n\n var createKmacOutputMethod = function (bits, padding, outputType) {\n return function (key, message, outputBits, s) {\n return methods['kmac' + bits].update(key, message, outputBits, s)[outputType]();\n };\n };\n\n var createOutputMethods = function (method, createMethod, bits, padding) {\n for (var i = 0; i < OUTPUT_TYPES.length; ++i) {\n var type = OUTPUT_TYPES[i];\n method[type] = createMethod(bits, padding, type);\n }\n return method;\n };\n\n var createMethod = function (bits, padding) {\n var method = createOutputMethod(bits, padding, 'hex');\n method.create = function () {\n return new Keccak(bits, padding, bits);\n };\n method.update = function (message) {\n return method.create().update(message);\n };\n return createOutputMethods(method, createOutputMethod, bits, padding);\n };\n\n var createShakeMethod = function (bits, padding) {\n var method = createShakeOutputMethod(bits, padding, 'hex');\n method.create = function (outputBits) {\n return new Keccak(bits, padding, outputBits);\n };\n method.update = function (message, outputBits) {\n return method.create(outputBits).update(message);\n };\n return createOutputMethods(method, createShakeOutputMethod, bits, padding);\n };\n\n var createCshakeMethod = function (bits, padding) {\n var w = CSHAKE_BYTEPAD[bits];\n var method = createCshakeOutputMethod(bits, padding, 'hex');\n method.create = function (outputBits, n, s) {\n if (!n && !s) {\n return methods['shake' + bits].create(outputBits);\n } else {\n return new Keccak(bits, padding, outputBits).bytepad([n, s], w);\n }\n };\n method.update = function (message, outputBits, n, s) {\n return method.create(outputBits, n, s).update(message);\n };\n return createOutputMethods(method, createCshakeOutputMethod, bits, padding);\n };\n\n var createKmacMethod = function (bits, padding) {\n var w = CSHAKE_BYTEPAD[bits];\n var method = createKmacOutputMethod(bits, padding, 'hex');\n method.create = function (key, outputBits, s) {\n return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w);\n };\n method.update = function (key, message, outputBits, s) {\n return method.create(key, outputBits, s).update(message);\n };\n return createOutputMethods(method, createKmacOutputMethod, bits, padding);\n };\n\n var algorithms = [\n { name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod },\n { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod },\n { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod },\n { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod },\n { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod }\n ];\n\n var methods = {}, methodNames = [];\n\n for (var i = 0; i < algorithms.length; ++i) {\n var algorithm = algorithms[i];\n var bits = algorithm.bits;\n for (var j = 0; j < bits.length; ++j) {\n var methodName = algorithm.name + '_' + bits[j];\n methodNames.push(methodName);\n methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding);\n if (algorithm.name !== 'sha3') {\n var newMethodName = algorithm.name + bits[j];\n methodNames.push(newMethodName);\n methods[newMethodName] = methods[methodName];\n }\n }\n }\n\n function Keccak(bits, padding, outputBits) {\n this.blocks = [];\n this.s = [];\n this.padding = padding;\n this.outputBits = outputBits;\n this.reset = true;\n this.finalized = false;\n this.block = 0;\n this.start = 0;\n this.blockCount = (1600 - (bits << 1)) >> 5;\n this.byteCount = this.blockCount << 2;\n this.outputBlocks = outputBits >> 5;\n this.extraBytes = (outputBits & 31) >> 3;\n\n for (var i = 0; i < 50; ++i) {\n this.s[i] = 0;\n }\n }\n\n Keccak.prototype.update = function (message) {\n if (this.finalized) {\n throw new Error(FINALIZE_ERROR);\n }\n var notString, type = typeof message;\n if (type !== 'string') {\n if (type === 'object') {\n if (message === null) {\n throw new Error(INPUT_ERROR);\n } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {\n message = new Uint8Array(message);\n } else if (!Array.isArray(message)) {\n if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {\n throw new Error(INPUT_ERROR);\n }\n }\n } else {\n throw new Error(INPUT_ERROR);\n }\n notString = true;\n }\n var blocks = this.blocks, byteCount = this.byteCount, length = message.length,\n blockCount = this.blockCount, index = 0, s = this.s, i, code;\n\n while (index < length) {\n if (this.reset) {\n this.reset = false;\n blocks[0] = this.block;\n for (i = 1; i < blockCount + 1; ++i) {\n blocks[i] = 0;\n }\n }\n if (notString) {\n for (i = this.start; index < length && i < byteCount; ++index) {\n blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];\n }\n } else {\n for (i = this.start; index < length && i < byteCount; ++index) {\n code = message.charCodeAt(index);\n if (code < 0x80) {\n blocks[i >> 2] |= code << SHIFT[i++ & 3];\n } else if (code < 0x800) {\n blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n } else if (code < 0xd800 || code >= 0xe000) {\n blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n } else {\n code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));\n blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n }\n }\n }\n this.lastByteIndex = i;\n if (i >= byteCount) {\n this.start = i - byteCount;\n this.block = blocks[blockCount];\n for (i = 0; i < blockCount; ++i) {\n s[i] ^= blocks[i];\n }\n f(s);\n this.reset = true;\n } else {\n this.start = i;\n }\n }\n return this;\n };\n\n Keccak.prototype.encode = function (x, right) {\n var o = x & 255, n = 1;\n var bytes = [o];\n x = x >> 8;\n o = x & 255;\n while (o > 0) {\n bytes.unshift(o);\n x = x >> 8;\n o = x & 255;\n ++n;\n }\n if (right) {\n bytes.push(n);\n } else {\n bytes.unshift(n);\n }\n this.update(bytes);\n return bytes.length;\n };\n\n Keccak.prototype.encodeString = function (str) {\n var notString, type = typeof str;\n if (type !== 'string') {\n if (type === 'object') {\n if (str === null) {\n throw new Error(INPUT_ERROR);\n } else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) {\n str = new Uint8Array(str);\n } else if (!Array.isArray(str)) {\n if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) {\n throw new Error(INPUT_ERROR);\n }\n }\n } else {\n throw new Error(INPUT_ERROR);\n }\n notString = true;\n }\n var bytes = 0, length = str.length;\n if (notString) {\n bytes = length;\n } else {\n for (var i = 0; i < str.length; ++i) {\n var code = str.charCodeAt(i);\n if (code < 0x80) {\n bytes += 1;\n } else if (code < 0x800) {\n bytes += 2;\n } else if (code < 0xd800 || code >= 0xe000) {\n bytes += 3;\n } else {\n code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff));\n bytes += 4;\n }\n }\n }\n bytes += this.encode(bytes * 8);\n this.update(str);\n return bytes;\n };\n\n Keccak.prototype.bytepad = function (strs, w) {\n var bytes = this.encode(w);\n for (var i = 0; i < strs.length; ++i) {\n bytes += this.encodeString(strs[i]);\n }\n var paddingBytes = w - bytes % w;\n var zeros = [];\n zeros.length = paddingBytes;\n this.update(zeros);\n return this;\n };\n\n Keccak.prototype.finalize = function () {\n if (this.finalized) {\n return;\n }\n this.finalized = true;\n var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s;\n blocks[i >> 2] |= this.padding[i & 3];\n if (this.lastByteIndex === this.byteCount) {\n blocks[0] = blocks[blockCount];\n for (i = 1; i < blockCount + 1; ++i) {\n blocks[i] = 0;\n }\n }\n blocks[blockCount - 1] |= 0x80000000;\n for (i = 0; i < blockCount; ++i) {\n s[i] ^= blocks[i];\n }\n f(s);\n };\n\n Keccak.prototype.toString = Keccak.prototype.hex = function () {\n this.finalize();\n\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\n extraBytes = this.extraBytes, i = 0, j = 0;\n var hex = '', block;\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n block = s[i];\n hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] +\n HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] +\n HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] +\n HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F];\n }\n if (j % blockCount === 0) {\n f(s);\n i = 0;\n }\n }\n if (extraBytes) {\n block = s[i];\n hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F];\n if (extraBytes > 1) {\n hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F];\n }\n if (extraBytes > 2) {\n hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F];\n }\n }\n return hex;\n };\n\n Keccak.prototype.arrayBuffer = function () {\n this.finalize();\n\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\n extraBytes = this.extraBytes, i = 0, j = 0;\n var bytes = this.outputBits >> 3;\n var buffer;\n if (extraBytes) {\n buffer = new ArrayBuffer((outputBlocks + 1) << 2);\n } else {\n buffer = new ArrayBuffer(bytes);\n }\n var array = new Uint32Array(buffer);\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n array[j] = s[i];\n }\n if (j % blockCount === 0) {\n f(s);\n }\n }\n if (extraBytes) {\n array[i] = s[i];\n buffer = buffer.slice(0, bytes);\n }\n return buffer;\n };\n\n Keccak.prototype.buffer = Keccak.prototype.arrayBuffer;\n\n Keccak.prototype.digest = Keccak.prototype.array = function () {\n this.finalize();\n\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\n extraBytes = this.extraBytes, i = 0, j = 0;\n var array = [], offset, block;\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n offset = j << 2;\n block = s[i];\n array[offset] = block & 0xFF;\n array[offset + 1] = (block >> 8) & 0xFF;\n array[offset + 2] = (block >> 16) & 0xFF;\n array[offset + 3] = (block >> 24) & 0xFF;\n }\n if (j % blockCount === 0) {\n f(s);\n }\n }\n if (extraBytes) {\n offset = j << 2;\n block = s[i];\n array[offset] = block & 0xFF;\n if (extraBytes > 1) {\n array[offset + 1] = (block >> 8) & 0xFF;\n }\n if (extraBytes > 2) {\n array[offset + 2] = (block >> 16) & 0xFF;\n }\n }\n return array;\n };\n\n function Kmac(bits, padding, outputBits) {\n Keccak.call(this, bits, padding, outputBits);\n }\n\n Kmac.prototype = new Keccak();\n\n Kmac.prototype.finalize = function () {\n this.encode(this.outputBits, true);\n return Keccak.prototype.finalize.call(this);\n };\n\n var f = function (s) {\n var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9,\n b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17,\n b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33,\n b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49;\n for (n = 0; n < 48; n += 2) {\n c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40];\n c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41];\n c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42];\n c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43];\n c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44];\n c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45];\n c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46];\n c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47];\n c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48];\n c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49];\n\n h = c8 ^ ((c2 << 1) | (c3 >>> 31));\n l = c9 ^ ((c3 << 1) | (c2 >>> 31));\n s[0] ^= h;\n s[1] ^= l;\n s[10] ^= h;\n s[11] ^= l;\n s[20] ^= h;\n s[21] ^= l;\n s[30] ^= h;\n s[31] ^= l;\n s[40] ^= h;\n s[41] ^= l;\n h = c0 ^ ((c4 << 1) | (c5 >>> 31));\n l = c1 ^ ((c5 << 1) | (c4 >>> 31));\n s[2] ^= h;\n s[3] ^= l;\n s[12] ^= h;\n s[13] ^= l;\n s[22] ^= h;\n s[23] ^= l;\n s[32] ^= h;\n s[33] ^= l;\n s[42] ^= h;\n s[43] ^= l;\n h = c2 ^ ((c6 << 1) | (c7 >>> 31));\n l = c3 ^ ((c7 << 1) | (c6 >>> 31));\n s[4] ^= h;\n s[5] ^= l;\n s[14] ^= h;\n s[15] ^= l;\n s[24] ^= h;\n s[25] ^= l;\n s[34] ^= h;\n s[35] ^= l;\n s[44] ^= h;\n s[45] ^= l;\n h = c4 ^ ((c8 << 1) | (c9 >>> 31));\n l = c5 ^ ((c9 << 1) | (c8 >>> 31));\n s[6] ^= h;\n s[7] ^= l;\n s[16] ^= h;\n s[17] ^= l;\n s[26] ^= h;\n s[27] ^= l;\n s[36] ^= h;\n s[37] ^= l;\n s[46] ^= h;\n s[47] ^= l;\n h = c6 ^ ((c0 << 1) | (c1 >>> 31));\n l = c7 ^ ((c1 << 1) | (c0 >>> 31));\n s[8] ^= h;\n s[9] ^= l;\n s[18] ^= h;\n s[19] ^= l;\n s[28] ^= h;\n s[29] ^= l;\n s[38] ^= h;\n s[39] ^= l;\n s[48] ^= h;\n s[49] ^= l;\n\n b0 = s[0];\n b1 = s[1];\n b32 = (s[11] << 4) | (s[10] >>> 28);\n b33 = (s[10] << 4) | (s[11] >>> 28);\n b14 = (s[20] << 3) | (s[21] >>> 29);\n b15 = (s[21] << 3) | (s[20] >>> 29);\n b46 = (s[31] << 9) | (s[30] >>> 23);\n b47 = (s[30] << 9) | (s[31] >>> 23);\n b28 = (s[40] << 18) | (s[41] >>> 14);\n b29 = (s[41] << 18) | (s[40] >>> 14);\n b20 = (s[2] << 1) | (s[3] >>> 31);\n b21 = (s[3] << 1) | (s[2] >>> 31);\n b2 = (s[13] << 12) | (s[12] >>> 20);\n b3 = (s[12] << 12) | (s[13] >>> 20);\n b34 = (s[22] << 10) | (s[23] >>> 22);\n b35 = (s[23] << 10) | (s[22] >>> 22);\n b16 = (s[33] << 13) | (s[32] >>> 19);\n b17 = (s[32] << 13) | (s[33] >>> 19);\n b48 = (s[42] << 2) | (s[43] >>> 30);\n b49 = (s[43] << 2) | (s[42] >>> 30);\n b40 = (s[5] << 30) | (s[4] >>> 2);\n b41 = (s[4] << 30) | (s[5] >>> 2);\n b22 = (s[14] << 6) | (s[15] >>> 26);\n b23 = (s[15] << 6) | (s[14] >>> 26);\n b4 = (s[25] << 11) | (s[24] >>> 21);\n b5 = (s[24] << 11) | (s[25] >>> 21);\n b36 = (s[34] << 15) | (s[35] >>> 17);\n b37 = (s[35] << 15) | (s[34] >>> 17);\n b18 = (s[45] << 29) | (s[44] >>> 3);\n b19 = (s[44] << 29) | (s[45] >>> 3);\n b10 = (s[6] << 28) | (s[7] >>> 4);\n b11 = (s[7] << 28) | (s[6] >>> 4);\n b42 = (s[17] << 23) | (s[16] >>> 9);\n b43 = (s[16] << 23) | (s[17] >>> 9);\n b24 = (s[26] << 25) | (s[27] >>> 7);\n b25 = (s[27] << 25) | (s[26] >>> 7);\n b6 = (s[36] << 21) | (s[37] >>> 11);\n b7 = (s[37] << 21) | (s[36] >>> 11);\n b38 = (s[47] << 24) | (s[46] >>> 8);\n b39 = (s[46] << 24) | (s[47] >>> 8);\n b30 = (s[8] << 27) | (s[9] >>> 5);\n b31 = (s[9] << 27) | (s[8] >>> 5);\n b12 = (s[18] << 20) | (s[19] >>> 12);\n b13 = (s[19] << 20) | (s[18] >>> 12);\n b44 = (s[29] << 7) | (s[28] >>> 25);\n b45 = (s[28] << 7) | (s[29] >>> 25);\n b26 = (s[38] << 8) | (s[39] >>> 24);\n b27 = (s[39] << 8) | (s[38] >>> 24);\n b8 = (s[48] << 14) | (s[49] >>> 18);\n b9 = (s[49] << 14) | (s[48] >>> 18);\n\n s[0] = b0 ^ (~b2 & b4);\n s[1] = b1 ^ (~b3 & b5);\n s[10] = b10 ^ (~b12 & b14);\n s[11] = b11 ^ (~b13 & b15);\n s[20] = b20 ^ (~b22 & b24);\n s[21] = b21 ^ (~b23 & b25);\n s[30] = b30 ^ (~b32 & b34);\n s[31] = b31 ^ (~b33 & b35);\n s[40] = b40 ^ (~b42 & b44);\n s[41] = b41 ^ (~b43 & b45);\n s[2] = b2 ^ (~b4 & b6);\n s[3] = b3 ^ (~b5 & b7);\n s[12] = b12 ^ (~b14 & b16);\n s[13] = b13 ^ (~b15 & b17);\n s[22] = b22 ^ (~b24 & b26);\n s[23] = b23 ^ (~b25 & b27);\n s[32] = b32 ^ (~b34 & b36);\n s[33] = b33 ^ (~b35 & b37);\n s[42] = b42 ^ (~b44 & b46);\n s[43] = b43 ^ (~b45 & b47);\n s[4] = b4 ^ (~b6 & b8);\n s[5] = b5 ^ (~b7 & b9);\n s[14] = b14 ^ (~b16 & b18);\n s[15] = b15 ^ (~b17 & b19);\n s[24] = b24 ^ (~b26 & b28);\n s[25] = b25 ^ (~b27 & b29);\n s[34] = b34 ^ (~b36 & b38);\n s[35] = b35 ^ (~b37 & b39);\n s[44] = b44 ^ (~b46 & b48);\n s[45] = b45 ^ (~b47 & b49);\n s[6] = b6 ^ (~b8 & b0);\n s[7] = b7 ^ (~b9 & b1);\n s[16] = b16 ^ (~b18 & b10);\n s[17] = b17 ^ (~b19 & b11);\n s[26] = b26 ^ (~b28 & b20);\n s[27] = b27 ^ (~b29 & b21);\n s[36] = b36 ^ (~b38 & b30);\n s[37] = b37 ^ (~b39 & b31);\n s[46] = b46 ^ (~b48 & b40);\n s[47] = b47 ^ (~b49 & b41);\n s[8] = b8 ^ (~b0 & b2);\n s[9] = b9 ^ (~b1 & b3);\n s[18] = b18 ^ (~b10 & b12);\n s[19] = b19 ^ (~b11 & b13);\n s[28] = b28 ^ (~b20 & b22);\n s[29] = b29 ^ (~b21 & b23);\n s[38] = b38 ^ (~b30 & b32);\n s[39] = b39 ^ (~b31 & b33);\n s[48] = b48 ^ (~b40 & b42);\n s[49] = b49 ^ (~b41 & b43);\n\n s[0] ^= RC[n];\n s[1] ^= RC[n + 1];\n }\n };\n\n if (COMMON_JS) {\n module.exports = methods;\n } else {\n for (i = 0; i < methodNames.length; ++i) {\n root[methodNames[i]] = methods[methodNames[i]];\n }\n if (AMD) {\n !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {\n return methods;\n }).call(exports, __webpack_require__, exports, module),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n }\n }\n})();\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/js-sha3/src/sha3.js?"); - -/***/ }), - -/***/ "./node_modules/lodash.isequal/index.js": -/*!**********************************************!*\ - !*** ./node_modules/lodash.isequal/index.js ***! - \**********************************************/ -/***/ ((module, exports, __webpack_require__) => { - -eval("/* module decorator */ module = __webpack_require__.nmd(module);\n/**\n * Lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright JS Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n asyncTag = '[object AsyncFunction]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n nullTag = '[object Null]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n proxyTag = '[object Proxy]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n undefinedTag = '[object Undefined]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Detect free variable `exports`. */\nvar freeExports = true && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && \"object\" == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\n/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\n/**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\n/**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction cacheHas(cache, key) {\n return cache.has(key);\n}\n\n/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\n/**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\nfunction mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\nfunction setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n}\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n Symbol = root.Symbol,\n Uint8Array = root.Uint8Array,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n splice = arrayProto.splice,\n symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols,\n nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,\n nativeKeys = overArg(Object.keys, Object);\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView'),\n Map = getNative(root, 'Map'),\n Promise = getNative(root, 'Promise'),\n Set = getNative(root, 'Set'),\n WeakMap = getNative(root, 'WeakMap'),\n nativeCreate = getNative(Object, 'create');\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\n/**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\nfunction SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length;\n\n this.__data__ = new MapCache;\n while (++index < length) {\n this.add(values[index]);\n }\n}\n\n/**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\nfunction setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED);\n return this;\n}\n\n/**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\nfunction setCacheHas(value) {\n return this.__data__.has(value);\n}\n\n// Add methods to `SetCache`.\nSetCache.prototype.add = SetCache.prototype.push = setCacheAdd;\nSetCache.prototype.has = setCacheHas;\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\n/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\n/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\n/**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\nfunction baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);\n}\n\n/**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = objIsArr ? arrayTag : getTag(object),\n othTag = othIsArr ? arrayTag : getTag(other);\n\n objTag = objTag == argsTag ? objectTag : objTag;\n othTag = othTag == argsTag ? objectTag : othTag;\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && isBuffer(object)) {\n if (!isBuffer(other)) {\n return false;\n }\n objIsArr = true;\n objIsObj = false;\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack);\n return (objIsArr || isTypedArray(object))\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG)) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other;\n\n stack || (stack = new Stack);\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);\n }\n }\n if (!isSameTag) {\n return false;\n }\n stack || (stack = new Stack);\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack);\n}\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\nfunction equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(array);\n if (stacked && stack.get(other)) {\n return stacked == other;\n }\n var index = -1,\n result = true,\n seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;\n\n stack.set(array, other);\n stack.set(other, array);\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack);\n }\n if (compared !== undefined) {\n if (compared) {\n continue;\n }\n result = false;\n break;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (!arraySome(other, function(othValue, othIndex) {\n if (!cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n return seen.push(othIndex);\n }\n })) {\n result = false;\n break;\n }\n } else if (!(\n arrValue === othValue ||\n equalFunc(arrValue, othValue, bitmask, customizer, stack)\n )) {\n result = false;\n break;\n }\n }\n stack['delete'](array);\n stack['delete'](other);\n return result;\n}\n\n/**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if ((object.byteLength != other.byteLength) ||\n (object.byteOffset != other.byteOffset)) {\n return false;\n }\n object = object.buffer;\n other = other.buffer;\n\n case arrayBufferTag:\n if ((object.byteLength != other.byteLength) ||\n !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\n return false;\n }\n return true;\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other);\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == (other + '');\n\n case mapTag:\n var convert = mapToArray;\n\n case setTag:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG;\n convert || (convert = setToArray);\n\n if (object.size != other.size && !isPartial) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked) {\n return stacked == other;\n }\n bitmask |= COMPARE_UNORDERED_FLAG;\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other);\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);\n stack['delete'](object);\n return result;\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other);\n }\n }\n return false;\n}\n\n/**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isPartial) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked && stack.get(other)) {\n return stacked == other;\n }\n var result = true;\n stack.set(object, other);\n stack.set(other, object);\n\n var skipCtor = isPartial;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack);\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (!(compared === undefined\n ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))\n : compared\n )) {\n result = false;\n break;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n result = false;\n }\n }\n stack['delete'](object);\n stack['delete'](other);\n return result;\n}\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\n/**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n length = length == null ? MAX_SAFE_INTEGER : length;\n return !!length &&\n (typeof value == 'number' || reIsUint.test(value)) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\n/**\n * Performs a deep comparison between two values to determine if they are\n * equivalent.\n *\n * **Note:** This method supports comparing arrays, array buffers, booleans,\n * date objects, error objects, maps, numbers, `Object` objects, regexes,\n * sets, strings, symbols, and typed arrays. `Object` objects are compared\n * by their own, not inherited, enumerable properties. Functions and DOM\n * nodes are compared by strict equality, i.e. `===`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.isEqual(object, other);\n * // => true\n *\n * object === other;\n * // => false\n */\nfunction isEqual(value, other) {\n return baseIsEqual(value, other);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\n/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\n/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = isEqual;\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/lodash.isequal/index.js?"); - -/***/ }), - -/***/ "./node_modules/minimalistic-assert/index.js": -/*!***************************************************!*\ - !*** ./node_modules/minimalistic-assert/index.js ***! - \***************************************************/ -/***/ ((module) => { - -eval("module.exports = assert;\n\nfunction assert(val, msg) {\n if (!val)\n throw new Error(msg || 'Assertion failed');\n}\n\nassert.equal = function assertEqual(l, r, msg) {\n if (l != r)\n throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));\n};\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/minimalistic-assert/index.js?"); - -/***/ }), - -/***/ "./node_modules/query-string/index.js": -/*!********************************************!*\ - !*** ./node_modules/query-string/index.js ***! - \********************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -eval("\nconst strictUriEncode = __webpack_require__(/*! strict-uri-encode */ \"./node_modules/strict-uri-encode/index.js\");\nconst decodeComponent = __webpack_require__(/*! decode-uri-component */ \"./node_modules/decode-uri-component/index.js\");\nconst splitOnFirst = __webpack_require__(/*! split-on-first */ \"./node_modules/split-on-first/index.js\");\nconst filterObject = __webpack_require__(/*! filter-obj */ \"./node_modules/filter-obj/index.js\");\n\nconst isNullOrUndefined = value => value === null || value === undefined;\n\nconst encodeFragmentIdentifier = Symbol('encodeFragmentIdentifier');\n\nfunction encoderForArrayFormat(options) {\n\tswitch (options.arrayFormat) {\n\t\tcase 'index':\n\t\t\treturn key => (result, value) => {\n\t\t\t\tconst index = result.length;\n\n\t\t\t\tif (\n\t\t\t\t\tvalue === undefined ||\n\t\t\t\t\t(options.skipNull && value === null) ||\n\t\t\t\t\t(options.skipEmptyString && value === '')\n\t\t\t\t) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tif (value === null) {\n\t\t\t\t\treturn [...result, [encode(key, options), '[', index, ']'].join('')];\n\t\t\t\t}\n\n\t\t\t\treturn [\n\t\t\t\t\t...result,\n\t\t\t\t\t[encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join('')\n\t\t\t\t];\n\t\t\t};\n\n\t\tcase 'bracket':\n\t\t\treturn key => (result, value) => {\n\t\t\t\tif (\n\t\t\t\t\tvalue === undefined ||\n\t\t\t\t\t(options.skipNull && value === null) ||\n\t\t\t\t\t(options.skipEmptyString && value === '')\n\t\t\t\t) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tif (value === null) {\n\t\t\t\t\treturn [...result, [encode(key, options), '[]'].join('')];\n\t\t\t\t}\n\n\t\t\t\treturn [...result, [encode(key, options), '[]=', encode(value, options)].join('')];\n\t\t\t};\n\n\t\tcase 'colon-list-separator':\n\t\t\treturn key => (result, value) => {\n\t\t\t\tif (\n\t\t\t\t\tvalue === undefined ||\n\t\t\t\t\t(options.skipNull && value === null) ||\n\t\t\t\t\t(options.skipEmptyString && value === '')\n\t\t\t\t) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tif (value === null) {\n\t\t\t\t\treturn [...result, [encode(key, options), ':list='].join('')];\n\t\t\t\t}\n\n\t\t\t\treturn [...result, [encode(key, options), ':list=', encode(value, options)].join('')];\n\t\t\t};\n\n\t\tcase 'comma':\n\t\tcase 'separator':\n\t\tcase 'bracket-separator': {\n\t\t\tconst keyValueSep = options.arrayFormat === 'bracket-separator' ?\n\t\t\t\t'[]=' :\n\t\t\t\t'=';\n\n\t\t\treturn key => (result, value) => {\n\t\t\t\tif (\n\t\t\t\t\tvalue === undefined ||\n\t\t\t\t\t(options.skipNull && value === null) ||\n\t\t\t\t\t(options.skipEmptyString && value === '')\n\t\t\t\t) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\t// Translate null to an empty string so that it doesn't serialize as 'null'\n\t\t\t\tvalue = value === null ? '' : value;\n\n\t\t\t\tif (result.length === 0) {\n\t\t\t\t\treturn [[encode(key, options), keyValueSep, encode(value, options)].join('')];\n\t\t\t\t}\n\n\t\t\t\treturn [[result, encode(value, options)].join(options.arrayFormatSeparator)];\n\t\t\t};\n\t\t}\n\n\t\tdefault:\n\t\t\treturn key => (result, value) => {\n\t\t\t\tif (\n\t\t\t\t\tvalue === undefined ||\n\t\t\t\t\t(options.skipNull && value === null) ||\n\t\t\t\t\t(options.skipEmptyString && value === '')\n\t\t\t\t) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tif (value === null) {\n\t\t\t\t\treturn [...result, encode(key, options)];\n\t\t\t\t}\n\n\t\t\t\treturn [...result, [encode(key, options), '=', encode(value, options)].join('')];\n\t\t\t};\n\t}\n}\n\nfunction parserForArrayFormat(options) {\n\tlet result;\n\n\tswitch (options.arrayFormat) {\n\t\tcase 'index':\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tresult = /\\[(\\d*)\\]$/.exec(key);\n\n\t\t\t\tkey = key.replace(/\\[\\d*\\]$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = {};\n\t\t\t\t}\n\n\t\t\t\taccumulator[key][result[1]] = value;\n\t\t\t};\n\n\t\tcase 'bracket':\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tresult = /(\\[\\])$/.exec(key);\n\t\t\t\tkey = key.replace(/\\[\\]$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = [value];\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [].concat(accumulator[key], value);\n\t\t\t};\n\n\t\tcase 'colon-list-separator':\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tresult = /(:list)$/.exec(key);\n\t\t\t\tkey = key.replace(/:list$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = [value];\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [].concat(accumulator[key], value);\n\t\t\t};\n\n\t\tcase 'comma':\n\t\tcase 'separator':\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tconst isArray = typeof value === 'string' && value.includes(options.arrayFormatSeparator);\n\t\t\t\tconst isEncodedArray = (typeof value === 'string' && !isArray && decode(value, options).includes(options.arrayFormatSeparator));\n\t\t\t\tvalue = isEncodedArray ? decode(value, options) : value;\n\t\t\t\tconst newValue = isArray || isEncodedArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : value === null ? value : decode(value, options);\n\t\t\t\taccumulator[key] = newValue;\n\t\t\t};\n\n\t\tcase 'bracket-separator':\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tconst isArray = /(\\[\\])$/.test(key);\n\t\t\t\tkey = key.replace(/\\[\\]$/, '');\n\n\t\t\t\tif (!isArray) {\n\t\t\t\t\taccumulator[key] = value ? decode(value, options) : value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst arrayValue = value === null ?\n\t\t\t\t\t[] :\n\t\t\t\t\tvalue.split(options.arrayFormatSeparator).map(item => decode(item, options));\n\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = arrayValue;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [].concat(accumulator[key], arrayValue);\n\t\t\t};\n\n\t\tdefault:\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [].concat(accumulator[key], value);\n\t\t\t};\n\t}\n}\n\nfunction validateArrayFormatSeparator(value) {\n\tif (typeof value !== 'string' || value.length !== 1) {\n\t\tthrow new TypeError('arrayFormatSeparator must be single character string');\n\t}\n}\n\nfunction encode(value, options) {\n\tif (options.encode) {\n\t\treturn options.strict ? strictUriEncode(value) : encodeURIComponent(value);\n\t}\n\n\treturn value;\n}\n\nfunction decode(value, options) {\n\tif (options.decode) {\n\t\treturn decodeComponent(value);\n\t}\n\n\treturn value;\n}\n\nfunction keysSorter(input) {\n\tif (Array.isArray(input)) {\n\t\treturn input.sort();\n\t}\n\n\tif (typeof input === 'object') {\n\t\treturn keysSorter(Object.keys(input))\n\t\t\t.sort((a, b) => Number(a) - Number(b))\n\t\t\t.map(key => input[key]);\n\t}\n\n\treturn input;\n}\n\nfunction removeHash(input) {\n\tconst hashStart = input.indexOf('#');\n\tif (hashStart !== -1) {\n\t\tinput = input.slice(0, hashStart);\n\t}\n\n\treturn input;\n}\n\nfunction getHash(url) {\n\tlet hash = '';\n\tconst hashStart = url.indexOf('#');\n\tif (hashStart !== -1) {\n\t\thash = url.slice(hashStart);\n\t}\n\n\treturn hash;\n}\n\nfunction extract(input) {\n\tinput = removeHash(input);\n\tconst queryStart = input.indexOf('?');\n\tif (queryStart === -1) {\n\t\treturn '';\n\t}\n\n\treturn input.slice(queryStart + 1);\n}\n\nfunction parseValue(value, options) {\n\tif (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) {\n\t\tvalue = Number(value);\n\t} else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) {\n\t\tvalue = value.toLowerCase() === 'true';\n\t}\n\n\treturn value;\n}\n\nfunction parse(query, options) {\n\toptions = Object.assign({\n\t\tdecode: true,\n\t\tsort: true,\n\t\tarrayFormat: 'none',\n\t\tarrayFormatSeparator: ',',\n\t\tparseNumbers: false,\n\t\tparseBooleans: false\n\t}, options);\n\n\tvalidateArrayFormatSeparator(options.arrayFormatSeparator);\n\n\tconst formatter = parserForArrayFormat(options);\n\n\t// Create an object with no prototype\n\tconst ret = Object.create(null);\n\n\tif (typeof query !== 'string') {\n\t\treturn ret;\n\t}\n\n\tquery = query.trim().replace(/^[?#&]/, '');\n\n\tif (!query) {\n\t\treturn ret;\n\t}\n\n\tfor (const param of query.split('&')) {\n\t\tif (param === '') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet [key, value] = splitOnFirst(options.decode ? param.replace(/\\+/g, ' ') : param, '=');\n\n\t\t// Missing `=` should be `null`:\n\t\t// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters\n\t\tvalue = value === undefined ? null : ['comma', 'separator', 'bracket-separator'].includes(options.arrayFormat) ? value : decode(value, options);\n\t\tformatter(decode(key, options), value, ret);\n\t}\n\n\tfor (const key of Object.keys(ret)) {\n\t\tconst value = ret[key];\n\t\tif (typeof value === 'object' && value !== null) {\n\t\t\tfor (const k of Object.keys(value)) {\n\t\t\t\tvalue[k] = parseValue(value[k], options);\n\t\t\t}\n\t\t} else {\n\t\t\tret[key] = parseValue(value, options);\n\t\t}\n\t}\n\n\tif (options.sort === false) {\n\t\treturn ret;\n\t}\n\n\treturn (options.sort === true ? Object.keys(ret).sort() : Object.keys(ret).sort(options.sort)).reduce((result, key) => {\n\t\tconst value = ret[key];\n\t\tif (Boolean(value) && typeof value === 'object' && !Array.isArray(value)) {\n\t\t\t// Sort object keys, not values\n\t\t\tresult[key] = keysSorter(value);\n\t\t} else {\n\t\t\tresult[key] = value;\n\t\t}\n\n\t\treturn result;\n\t}, Object.create(null));\n}\n\nexports.extract = extract;\nexports.parse = parse;\n\nexports.stringify = (object, options) => {\n\tif (!object) {\n\t\treturn '';\n\t}\n\n\toptions = Object.assign({\n\t\tencode: true,\n\t\tstrict: true,\n\t\tarrayFormat: 'none',\n\t\tarrayFormatSeparator: ','\n\t}, options);\n\n\tvalidateArrayFormatSeparator(options.arrayFormatSeparator);\n\n\tconst shouldFilter = key => (\n\t\t(options.skipNull && isNullOrUndefined(object[key])) ||\n\t\t(options.skipEmptyString && object[key] === '')\n\t);\n\n\tconst formatter = encoderForArrayFormat(options);\n\n\tconst objectCopy = {};\n\n\tfor (const key of Object.keys(object)) {\n\t\tif (!shouldFilter(key)) {\n\t\t\tobjectCopy[key] = object[key];\n\t\t}\n\t}\n\n\tconst keys = Object.keys(objectCopy);\n\n\tif (options.sort !== false) {\n\t\tkeys.sort(options.sort);\n\t}\n\n\treturn keys.map(key => {\n\t\tconst value = object[key];\n\n\t\tif (value === undefined) {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (value === null) {\n\t\t\treturn encode(key, options);\n\t\t}\n\n\t\tif (Array.isArray(value)) {\n\t\t\tif (value.length === 0 && options.arrayFormat === 'bracket-separator') {\n\t\t\t\treturn encode(key, options) + '[]';\n\t\t\t}\n\n\t\t\treturn value\n\t\t\t\t.reduce(formatter(key), [])\n\t\t\t\t.join('&');\n\t\t}\n\n\t\treturn encode(key, options) + '=' + encode(value, options);\n\t}).filter(x => x.length > 0).join('&');\n};\n\nexports.parseUrl = (url, options) => {\n\toptions = Object.assign({\n\t\tdecode: true\n\t}, options);\n\n\tconst [url_, hash] = splitOnFirst(url, '#');\n\n\treturn Object.assign(\n\t\t{\n\t\t\turl: url_.split('?')[0] || '',\n\t\t\tquery: parse(extract(url), options)\n\t\t},\n\t\toptions && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {}\n\t);\n};\n\nexports.stringifyUrl = (object, options) => {\n\toptions = Object.assign({\n\t\tencode: true,\n\t\tstrict: true,\n\t\t[encodeFragmentIdentifier]: true\n\t}, options);\n\n\tconst url = removeHash(object.url).split('?')[0] || '';\n\tconst queryFromUrl = exports.extract(object.url);\n\tconst parsedQueryFromUrl = exports.parse(queryFromUrl, {sort: false});\n\n\tconst query = Object.assign(parsedQueryFromUrl, object.query);\n\tlet queryString = exports.stringify(query, options);\n\tif (queryString) {\n\t\tqueryString = `?${queryString}`;\n\t}\n\n\tlet hash = getHash(object.url);\n\tif (object.fragmentIdentifier) {\n\t\thash = `#${options[encodeFragmentIdentifier] ? encode(object.fragmentIdentifier, options) : object.fragmentIdentifier}`;\n\t}\n\n\treturn `${url}${queryString}${hash}`;\n};\n\nexports.pick = (input, filter, options) => {\n\toptions = Object.assign({\n\t\tparseFragmentIdentifier: true,\n\t\t[encodeFragmentIdentifier]: false\n\t}, options);\n\n\tconst {url, query, fragmentIdentifier} = exports.parseUrl(input, options);\n\treturn exports.stringifyUrl({\n\t\turl,\n\t\tquery: filterObject(query, filter),\n\t\tfragmentIdentifier\n\t}, options);\n};\n\nexports.exclude = (input, filter, options) => {\n\tconst exclusionFilter = Array.isArray(filter) ? key => !filter.includes(key) : (key, value) => !filter(key, value);\n\n\treturn exports.pick(input, exclusionFilter, options);\n};\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/query-string/index.js?"); - -/***/ }), - -/***/ "./node_modules/quick-format-unescaped/index.js": -/*!******************************************************!*\ - !*** ./node_modules/quick-format-unescaped/index.js ***! - \******************************************************/ -/***/ ((module) => { - -eval("\nfunction tryStringify (o) {\n try { return JSON.stringify(o) } catch(e) { return '\"[Circular]\"' }\n}\n\nmodule.exports = format\n\nfunction format(f, args, opts) {\n var ss = (opts && opts.stringify) || tryStringify\n var offset = 1\n if (typeof f === 'object' && f !== null) {\n var len = args.length + offset\n if (len === 1) return f\n var objects = new Array(len)\n objects[0] = ss(f)\n for (var index = 1; index < len; index++) {\n objects[index] = ss(args[index])\n }\n return objects.join(' ')\n }\n if (typeof f !== 'string') {\n return f\n }\n var argLen = args.length\n if (argLen === 0) return f\n var str = ''\n var a = 1 - offset\n var lastPos = -1\n var flen = (f && f.length) || 0\n for (var i = 0; i < flen;) {\n if (f.charCodeAt(i) === 37 && i + 1 < flen) {\n lastPos = lastPos > -1 ? lastPos : 0\n switch (f.charCodeAt(i + 1)) {\n case 100: // 'd'\n case 102: // 'f'\n if (a >= argLen)\n break\n if (args[a] == null) break\n if (lastPos < i)\n str += f.slice(lastPos, i)\n str += Number(args[a])\n lastPos = i + 2\n i++\n break\n case 105: // 'i'\n if (a >= argLen)\n break\n if (args[a] == null) break\n if (lastPos < i)\n str += f.slice(lastPos, i)\n str += Math.floor(Number(args[a]))\n lastPos = i + 2\n i++\n break\n case 79: // 'O'\n case 111: // 'o'\n case 106: // 'j'\n if (a >= argLen)\n break\n if (args[a] === undefined) break\n if (lastPos < i)\n str += f.slice(lastPos, i)\n var type = typeof args[a]\n if (type === 'string') {\n str += '\\'' + args[a] + '\\''\n lastPos = i + 2\n i++\n break\n }\n if (type === 'function') {\n str += args[a].name || ''\n lastPos = i + 2\n i++\n break\n }\n str += ss(args[a])\n lastPos = i + 2\n i++\n break\n case 115: // 's'\n if (a >= argLen)\n break\n if (lastPos < i)\n str += f.slice(lastPos, i)\n str += String(args[a])\n lastPos = i + 2\n i++\n break\n case 37: // '%'\n if (lastPos < i)\n str += f.slice(lastPos, i)\n str += '%'\n lastPos = i + 2\n i++\n a--\n break\n }\n ++a\n }\n ++i\n }\n if (lastPos === -1)\n return f\n else if (lastPos < flen) {\n str += f.slice(lastPos)\n }\n\n return str\n}\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/quick-format-unescaped/index.js?"); - -/***/ }), - -/***/ "./node_modules/safe-json-utils/dist/cjs/index.js": -/*!********************************************************!*\ - !*** ./node_modules/safe-json-utils/dist/cjs/index.js ***! - \********************************************************/ -/***/ ((__unused_webpack_module, exports) => { - -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nfunction safeJsonParse(value) {\n if (typeof value !== 'string') {\n throw new Error(`Cannot safe json parse value of type ${typeof value}`);\n }\n try {\n return JSON.parse(value);\n }\n catch (_a) {\n return value;\n }\n}\nexports.safeJsonParse = safeJsonParse;\nfunction safeJsonStringify(value) {\n return typeof value === 'string'\n ? value\n : JSON.stringify(value, (key, value) => typeof value === 'undefined' ? null : value);\n}\nexports.safeJsonStringify = safeJsonStringify;\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/safe-json-utils/dist/cjs/index.js?"); - -/***/ }), - -/***/ "./node_modules/split-on-first/index.js": -/*!**********************************************!*\ - !*** ./node_modules/split-on-first/index.js ***! - \**********************************************/ -/***/ ((module) => { - -eval("\n\nmodule.exports = (string, separator) => {\n\tif (!(typeof string === 'string' && typeof separator === 'string')) {\n\t\tthrow new TypeError('Expected the arguments to be of type `string`');\n\t}\n\n\tif (separator === '') {\n\t\treturn [string];\n\t}\n\n\tconst separatorIndex = string.indexOf(separator);\n\n\tif (separatorIndex === -1) {\n\t\treturn [string];\n\t}\n\n\treturn [\n\t\tstring.slice(0, separatorIndex),\n\t\tstring.slice(separatorIndex + separator.length)\n\t];\n};\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/split-on-first/index.js?"); - -/***/ }), - -/***/ "./node_modules/strict-uri-encode/index.js": -/*!*************************************************!*\ - !*** ./node_modules/strict-uri-encode/index.js ***! - \*************************************************/ -/***/ ((module) => { - -eval("\nmodule.exports = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`);\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/strict-uri-encode/index.js?"); - -/***/ }), - -/***/ "./node_modules/tslib/tslib.es6.js": -/*!*****************************************!*\ - !*** ./node_modules/tslib/tslib.es6.js ***! - \*****************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ __assign: () => (/* binding */ __assign),\n/* harmony export */ __asyncDelegator: () => (/* binding */ __asyncDelegator),\n/* harmony export */ __asyncGenerator: () => (/* binding */ __asyncGenerator),\n/* harmony export */ __asyncValues: () => (/* binding */ __asyncValues),\n/* harmony export */ __await: () => (/* binding */ __await),\n/* harmony export */ __awaiter: () => (/* binding */ __awaiter),\n/* harmony export */ __classPrivateFieldGet: () => (/* binding */ __classPrivateFieldGet),\n/* harmony export */ __classPrivateFieldSet: () => (/* binding */ __classPrivateFieldSet),\n/* harmony export */ __createBinding: () => (/* binding */ __createBinding),\n/* harmony export */ __decorate: () => (/* binding */ __decorate),\n/* harmony export */ __exportStar: () => (/* binding */ __exportStar),\n/* harmony export */ __extends: () => (/* binding */ __extends),\n/* harmony export */ __generator: () => (/* binding */ __generator),\n/* harmony export */ __importDefault: () => (/* binding */ __importDefault),\n/* harmony export */ __importStar: () => (/* binding */ __importStar),\n/* harmony export */ __makeTemplateObject: () => (/* binding */ __makeTemplateObject),\n/* harmony export */ __metadata: () => (/* binding */ __metadata),\n/* harmony export */ __param: () => (/* binding */ __param),\n/* harmony export */ __read: () => (/* binding */ __read),\n/* harmony export */ __rest: () => (/* binding */ __rest),\n/* harmony export */ __spread: () => (/* binding */ __spread),\n/* harmony export */ __spreadArrays: () => (/* binding */ __spreadArrays),\n/* harmony export */ __values: () => (/* binding */ __values)\n/* harmony export */ });\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nvar __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nfunction __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nfunction __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nfunction __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nfunction __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nfunction __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nfunction __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nfunction __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nfunction __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nfunction __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nfunction __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nfunction __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nfunction __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nfunction __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nfunction __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nfunction __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nfunction __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nfunction __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nfunction __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nfunction __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nfunction __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nfunction __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/tslib/tslib.es6.js?"); - -/***/ }), - -/***/ "./node_modules/unfetch/dist/unfetch.module.js": -/*!*****************************************************!*\ - !*** ./node_modules/unfetch/dist/unfetch.module.js ***! - \*****************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(e,n){return n=n||{},new Promise(function(t,r){var s=new XMLHttpRequest,o=[],u=[],i={},a=function(){return{ok:2==(s.status/100|0),statusText:s.statusText,status:s.status,url:s.responseURL,text:function(){return Promise.resolve(s.responseText)},json:function(){return Promise.resolve(s.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([s.response]))},clone:a,headers:{keys:function(){return o},entries:function(){return u},get:function(e){return i[e.toLowerCase()]},has:function(e){return e.toLowerCase()in i}}}};for(var l in s.open(n.method||\"get\",e,!0),s.onload=function(){s.getAllResponseHeaders().replace(/^(.*?):[^\\S\\n]*([\\s\\S]*?)$/gm,function(e,n,t){o.push(n=n.toLowerCase()),u.push([n,t]),i[n]=i[n]?i[n]+\",\"+t:t}),t(a())},s.onerror=r,s.withCredentials=\"include\"==n.credentials,n.headers)s.setRequestHeader(l,n.headers[l]);s.send(n.body||null)})}\n//# sourceMappingURL=unfetch.module.js.map\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/unfetch/dist/unfetch.module.js?"); - -/***/ }), - -/***/ "./src/index.js": -/*!**********************!*\ - !*** ./src/index.js ***! - \**********************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _walletconnect_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @walletconnect/core */ \"./node_modules/@walletconnect/core/dist/index.es.js\");\n/* harmony import */ var _walletconnect_web3wallet__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @walletconnect/web3wallet */ \"./node_modules/@walletconnect/web3wallet/dist/index.es.js\");\n/* harmony import */ var _walletconnect_auth_client__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/auth-client */ \"./node_modules/@walletconnect/auth-client/dist/index.es.js\");\n/* harmony import */ var _walletconnect_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @walletconnect/utils */ \"./node_modules/@walletconnect/utils/dist/index.es.js\");\n/* harmony import */ var _walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @walletconnect/jsonrpc-utils */ \"./node_modules/@walletconnect/jsonrpc-utils/dist/esm/index.js\");\n\n\n\n\n\n// import the builder util\n\n\n\n// \"Export\" API to window\n// Workaround, tried using export via output.module: true in webpack.config.js, but it didn't work\nwindow.wc = {\n core: null,\n web3wallet: null,\n authClient: null,\n\n init: function (projectId) {\n return new Promise(async (resolve) => {\n window.wc.core = new _walletconnect_core__WEBPACK_IMPORTED_MODULE_2__.Core({\n projectId: projectId,\n });\n\n window.wc.web3wallet = await _walletconnect_web3wallet__WEBPACK_IMPORTED_MODULE_3__.Web3Wallet.init({\n core: window.wc.core, // <- pass the shared `core` instance\n metadata: {\n name: \"Status\",\n description: \"Status Wallet\",\n url: \"http://localhost\",\n icons: ['https://status.im/img/status-footer-logo.svg'],\n },\n });\n\n window.wc.authClient = await _walletconnect_auth_client__WEBPACK_IMPORTED_MODULE_0__[\"default\"].init({\n projectId: projectId,\n metadata: window.wc.web3wallet.metadata,\n })\n\n resolve()\n })\n },\n\n alreadyPaired: new Error(\"Already paired\"),\n waitingForApproval: new Error(\"Waiting for approval\"),\n // TODO: there is a corner case when attempting to pair with a link that is already paired or was rejected won't trigger any event back\n pair: function (uri) {\n let pairingTopic = getPairingTopicFromPairingUrl(uri);\n\n const pairings = window.wc.core.pairing.getPairings();\n // Find pairing by topic\n const pairing = pairings.find((p) => p.topic === pairingTopic);\n if (pairing) {\n if (pairing.active) {\n return new Promise((_, reject) => {\n reject(window.wc.alreadyPaired);\n });\n }\n }\n\n let pairPromise = window.wc.web3wallet\n .pair({ uri: uri })\n\n return new Promise((resolve, reject) => {\n pairPromise\n .then(() => {\n window.wc.web3wallet.on(\"session_proposal\", async (sessionProposal) => {\n resolve(sessionProposal);\n });\n })\n .catch((error) => {\n reject(error);\n });\n });\n },\n\n getPairings: function () {\n return window.wc.core.pairing.getPairings();\n },\n\n disconnect: function (topic) {\n return window.wc.core.pairing.disconnect({ topic: topic});\n },\n\n registerForSessionRequest: function (callback) {\n window.wc.web3wallet.on(\"session_request\", callback);\n },\n\n registerForSessionDelete: function (callback) {\n window.wc.web3wallet.on(\"session_delete\", callback);\n },\n\n approvePairSession: function (sessionProposal, supportedNamespaces) {\n const { id, params } = sessionProposal;\n\n const approvedNamespaces = (0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_4__.buildApprovedNamespaces)({\n proposal: params,\n supportedNamespaces: supportedNamespaces,\n });\n\n return window.wc.web3wallet.approveSession({\n id,\n namespaces: approvedNamespaces,\n });\n },\n rejectPairSession: function (id) {\n return window.wc.web3wallet.rejectSession({\n id: id,\n reason: (0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_4__.getSdkError)(\"USER_REJECTED\"), // TODO USER_REJECTED_METHODS, USER_REJECTED_CHAINS, USER_REJECTED_EVENTS\n });\n },\n\n auth: function (uri) {\n let pairingTopic = getPairingTopicFromPairingUrl(uri);\n\n const pairings = window.wc.core.pairing.getPairings();\n // Find pairing by topic\n const pairing = pairings.find((p) => p.topic === pairingTopic);\n if (pairing) {\n if (pairing.active) {\n return new Promise((_, reject) => {\n reject(window.wc.alreadyPaired);\n });\n }\n }\n\n let pairPromise = window.wc.authClient.core.pairing\n .pair({ uri })\n\n return new Promise((resolve, reject) => {\n pairPromise\n .then(() => {\n // TODO: check if we can separate using the URI info\n window.wc.authClient.on(\"auth_request\", async (authProposal) => {\n resolve(authProposal);\n });\n })\n .catch((error) => {\n reject(error);\n });\n });\n },\n\n approveAuth: function (authProposal) {\n const { id, params } = authProposal;\n\n // TODO: source user’s address\n const iss = `did:pkh:eip155:1:${\"0x0123456789\"}`;\n\n // format the cacao payload with the user’s address\n const message = window.wc.authClient.formatMessage(params.cacaoPayload, iss);\n\n // TODO: signature\n const signature = \"0x123456789\"\n\n return window.wc.authClient.respond(\n {\n id: id,\n signature: {\n s: signature,\n t: \"eip191\",\n },\n },\n iss\n );\n },\n rejectAuth: function (id) {\n return window.wc.authClient.reject(id);\n },\n\n respondSessionRequest: function (topic, id, signature) {\n const response = (0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_1__.formatJsonRpcResult)(id, signature)\n return window.wc.web3wallet.respondSessionRequest({ topic, response });\n },\n\n rejectSessionRequest: function (topic, id, error = false) {\n const errorType = error ? \"SESSION_SETTLEMENT_FAILED\" : \"USER_REJECTED\";\n return window.wc.web3wallet.respondSessionRequest({\n topic: topic,\n response: (0,_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_1__.formatJsonRpcError)(id, (0,_walletconnect_utils__WEBPACK_IMPORTED_MODULE_4__.getSdkError)(errorType)),\n });\n },\n\n\n disconnectAll: function () {\n const pairings = window.wc.core.pairing.getPairings();\n pairings.forEach((p) => {\n window.wc.core.pairing.disconnect({ topic: p.topic });\n });\n },\n};\n\n// Returns null if not a pairing url\nfunction getPairingTopicFromPairingUrl(url) {\n if (!url.startsWith(\"wc:\")) {\n return null;\n }\n const atIndex = url.indexOf(\"@\");\n if (atIndex < 0) {\n return null;\n }\n return url.slice(3, atIndex);\n}\n\n\n//# sourceURL=webpack://wallet_connect_integration/./src/index.js?"); - -/***/ }), - -/***/ "?25ed": -/*!************************!*\ - !*** crypto (ignored) ***! - \************************/ -/***/ (() => { - -eval("/* (ignored) */\n\n//# sourceURL=webpack://wallet_connect_integration/crypto_(ignored)?"); - -/***/ }), - -/***/ "?8131": -/*!************************!*\ - !*** buffer (ignored) ***! - \************************/ -/***/ (() => { - -eval("/* (ignored) */\n\n//# sourceURL=webpack://wallet_connect_integration/buffer_(ignored)?"); - -/***/ }), - -/***/ "./node_modules/pino/browser.js": -/*!**************************************!*\ - !*** ./node_modules/pino/browser.js ***! - \**************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -eval("\n\nconst format = __webpack_require__(/*! quick-format-unescaped */ \"./node_modules/quick-format-unescaped/index.js\")\n\nmodule.exports = pino\n\nconst _console = pfGlobalThisOrFallback().console || {}\nconst stdSerializers = {\n mapHttpRequest: mock,\n mapHttpResponse: mock,\n wrapRequestSerializer: passthrough,\n wrapResponseSerializer: passthrough,\n wrapErrorSerializer: passthrough,\n req: mock,\n res: mock,\n err: asErrValue\n}\n\nfunction shouldSerialize (serialize, serializers) {\n if (Array.isArray(serialize)) {\n const hasToFilter = serialize.filter(function (k) {\n return k !== '!stdSerializers.err'\n })\n return hasToFilter\n } else if (serialize === true) {\n return Object.keys(serializers)\n }\n\n return false\n}\n\nfunction pino (opts) {\n opts = opts || {}\n opts.browser = opts.browser || {}\n\n const transmit = opts.browser.transmit\n if (transmit && typeof transmit.send !== 'function') { throw Error('pino: transmit option must have a send function') }\n\n const proto = opts.browser.write || _console\n if (opts.browser.write) opts.browser.asObject = true\n const serializers = opts.serializers || {}\n const serialize = shouldSerialize(opts.browser.serialize, serializers)\n let stdErrSerialize = opts.browser.serialize\n\n if (\n Array.isArray(opts.browser.serialize) &&\n opts.browser.serialize.indexOf('!stdSerializers.err') > -1\n ) stdErrSerialize = false\n\n const levels = ['error', 'fatal', 'warn', 'info', 'debug', 'trace']\n\n if (typeof proto === 'function') {\n proto.error = proto.fatal = proto.warn =\n proto.info = proto.debug = proto.trace = proto\n }\n if (opts.enabled === false) opts.level = 'silent'\n const level = opts.level || 'info'\n const logger = Object.create(proto)\n if (!logger.log) logger.log = noop\n\n Object.defineProperty(logger, 'levelVal', {\n get: getLevelVal\n })\n Object.defineProperty(logger, 'level', {\n get: getLevel,\n set: setLevel\n })\n\n const setOpts = {\n transmit,\n serialize,\n asObject: opts.browser.asObject,\n levels,\n timestamp: getTimeFunction(opts)\n }\n logger.levels = pino.levels\n logger.level = level\n\n logger.setMaxListeners = logger.getMaxListeners =\n logger.emit = logger.addListener = logger.on =\n logger.prependListener = logger.once =\n logger.prependOnceListener = logger.removeListener =\n logger.removeAllListeners = logger.listeners =\n logger.listenerCount = logger.eventNames =\n logger.write = logger.flush = noop\n logger.serializers = serializers\n logger._serialize = serialize\n logger._stdErrSerialize = stdErrSerialize\n logger.child = child\n\n if (transmit) logger._logEvent = createLogEventShape()\n\n function getLevelVal () {\n return this.level === 'silent'\n ? Infinity\n : this.levels.values[this.level]\n }\n\n function getLevel () {\n return this._level\n }\n function setLevel (level) {\n if (level !== 'silent' && !this.levels.values[level]) {\n throw Error('unknown level ' + level)\n }\n this._level = level\n\n set(setOpts, logger, 'error', 'log') // <-- must stay first\n set(setOpts, logger, 'fatal', 'error')\n set(setOpts, logger, 'warn', 'error')\n set(setOpts, logger, 'info', 'log')\n set(setOpts, logger, 'debug', 'log')\n set(setOpts, logger, 'trace', 'log')\n }\n\n function child (bindings, childOptions) {\n if (!bindings) {\n throw new Error('missing bindings for child Pino')\n }\n childOptions = childOptions || {}\n if (serialize && bindings.serializers) {\n childOptions.serializers = bindings.serializers\n }\n const childOptionsSerializers = childOptions.serializers\n if (serialize && childOptionsSerializers) {\n var childSerializers = Object.assign({}, serializers, childOptionsSerializers)\n var childSerialize = opts.browser.serialize === true\n ? Object.keys(childSerializers)\n : serialize\n delete bindings.serializers\n applySerializers([bindings], childSerialize, childSerializers, this._stdErrSerialize)\n }\n function Child (parent) {\n this._childLevel = (parent._childLevel | 0) + 1\n this.error = bind(parent, bindings, 'error')\n this.fatal = bind(parent, bindings, 'fatal')\n this.warn = bind(parent, bindings, 'warn')\n this.info = bind(parent, bindings, 'info')\n this.debug = bind(parent, bindings, 'debug')\n this.trace = bind(parent, bindings, 'trace')\n if (childSerializers) {\n this.serializers = childSerializers\n this._serialize = childSerialize\n }\n if (transmit) {\n this._logEvent = createLogEventShape(\n [].concat(parent._logEvent.bindings, bindings)\n )\n }\n }\n Child.prototype = this\n return new Child(this)\n }\n return logger\n}\n\npino.levels = {\n values: {\n fatal: 60,\n error: 50,\n warn: 40,\n info: 30,\n debug: 20,\n trace: 10\n },\n labels: {\n 10: 'trace',\n 20: 'debug',\n 30: 'info',\n 40: 'warn',\n 50: 'error',\n 60: 'fatal'\n }\n}\n\npino.stdSerializers = stdSerializers\npino.stdTimeFunctions = Object.assign({}, { nullTime, epochTime, unixTime, isoTime })\n\nfunction set (opts, logger, level, fallback) {\n const proto = Object.getPrototypeOf(logger)\n logger[level] = logger.levelVal > logger.levels.values[level]\n ? noop\n : (proto[level] ? proto[level] : (_console[level] || _console[fallback] || noop))\n\n wrap(opts, logger, level)\n}\n\nfunction wrap (opts, logger, level) {\n if (!opts.transmit && logger[level] === noop) return\n\n logger[level] = (function (write) {\n return function LOG () {\n const ts = opts.timestamp()\n const args = new Array(arguments.length)\n const proto = (Object.getPrototypeOf && Object.getPrototypeOf(this) === _console) ? _console : this\n for (var i = 0; i < args.length; i++) args[i] = arguments[i]\n\n if (opts.serialize && !opts.asObject) {\n applySerializers(args, this._serialize, this.serializers, this._stdErrSerialize)\n }\n if (opts.asObject) write.call(proto, asObject(this, level, args, ts))\n else write.apply(proto, args)\n\n if (opts.transmit) {\n const transmitLevel = opts.transmit.level || logger.level\n const transmitValue = pino.levels.values[transmitLevel]\n const methodValue = pino.levels.values[level]\n if (methodValue < transmitValue) return\n transmit(this, {\n ts,\n methodLevel: level,\n methodValue,\n transmitLevel,\n transmitValue: pino.levels.values[opts.transmit.level || logger.level],\n send: opts.transmit.send,\n val: logger.levelVal\n }, args)\n }\n }\n })(logger[level])\n}\n\nfunction asObject (logger, level, args, ts) {\n if (logger._serialize) applySerializers(args, logger._serialize, logger.serializers, logger._stdErrSerialize)\n const argsCloned = args.slice()\n let msg = argsCloned[0]\n const o = {}\n if (ts) {\n o.time = ts\n }\n o.level = pino.levels.values[level]\n let lvl = (logger._childLevel | 0) + 1\n if (lvl < 1) lvl = 1\n // deliberate, catching objects, arrays\n if (msg !== null && typeof msg === 'object') {\n while (lvl-- && typeof argsCloned[0] === 'object') {\n Object.assign(o, argsCloned.shift())\n }\n msg = argsCloned.length ? format(argsCloned.shift(), argsCloned) : undefined\n } else if (typeof msg === 'string') msg = format(argsCloned.shift(), argsCloned)\n if (msg !== undefined) o.msg = msg\n return o\n}\n\nfunction applySerializers (args, serialize, serializers, stdErrSerialize) {\n for (const i in args) {\n if (stdErrSerialize && args[i] instanceof Error) {\n args[i] = pino.stdSerializers.err(args[i])\n } else if (typeof args[i] === 'object' && !Array.isArray(args[i])) {\n for (const k in args[i]) {\n if (serialize && serialize.indexOf(k) > -1 && k in serializers) {\n args[i][k] = serializers[k](args[i][k])\n }\n }\n }\n }\n}\n\nfunction bind (parent, bindings, level) {\n return function () {\n const args = new Array(1 + arguments.length)\n args[0] = bindings\n for (var i = 1; i < args.length; i++) {\n args[i] = arguments[i - 1]\n }\n return parent[level].apply(this, args)\n }\n}\n\nfunction transmit (logger, opts, args) {\n const send = opts.send\n const ts = opts.ts\n const methodLevel = opts.methodLevel\n const methodValue = opts.methodValue\n const val = opts.val\n const bindings = logger._logEvent.bindings\n\n applySerializers(\n args,\n logger._serialize || Object.keys(logger.serializers),\n logger.serializers,\n logger._stdErrSerialize === undefined ? true : logger._stdErrSerialize\n )\n logger._logEvent.ts = ts\n logger._logEvent.messages = args.filter(function (arg) {\n // bindings can only be objects, so reference equality check via indexOf is fine\n return bindings.indexOf(arg) === -1\n })\n\n logger._logEvent.level.label = methodLevel\n logger._logEvent.level.value = methodValue\n\n send(methodLevel, logger._logEvent, val)\n\n logger._logEvent = createLogEventShape(bindings)\n}\n\nfunction createLogEventShape (bindings) {\n return {\n ts: 0,\n messages: [],\n bindings: bindings || [],\n level: { label: '', value: 0 }\n }\n}\n\nfunction asErrValue (err) {\n const obj = {\n type: err.constructor.name,\n msg: err.message,\n stack: err.stack\n }\n for (const key in err) {\n if (obj[key] === undefined) {\n obj[key] = err[key]\n }\n }\n return obj\n}\n\nfunction getTimeFunction (opts) {\n if (typeof opts.timestamp === 'function') {\n return opts.timestamp\n }\n if (opts.timestamp === false) {\n return nullTime\n }\n return epochTime\n}\n\nfunction mock () { return {} }\nfunction passthrough (a) { return a }\nfunction noop () {}\n\nfunction nullTime () { return false }\nfunction epochTime () { return Date.now() }\nfunction unixTime () { return Math.round(Date.now() / 1000.0) }\nfunction isoTime () { return new Date(Date.now()).toISOString() } // using Date.now() for testability\n\n/* eslint-disable */\n/* istanbul ignore next */\nfunction pfGlobalThisOrFallback () {\n function defd (o) { return typeof o !== 'undefined' && o }\n try {\n if (typeof globalThis !== 'undefined') return globalThis\n Object.defineProperty(Object.prototype, 'globalThis', {\n get: function () {\n delete Object.prototype.globalThis\n return (this.globalThis = this)\n },\n configurable: true\n })\n return globalThis\n } catch (e) {\n return defd(self) || defd(window) || defd(this) || {}\n }\n}\n/* eslint-enable */\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/pino/browser.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/src/bases/base.js": -/*!*********************************************************!*\ - !*** ./node_modules/multiformats/esm/src/bases/base.js ***! - \*********************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Codec: () => (/* binding */ Codec),\n/* harmony export */ baseX: () => (/* binding */ baseX),\n/* harmony export */ from: () => (/* binding */ from),\n/* harmony export */ or: () => (/* binding */ or),\n/* harmony export */ rfc4648: () => (/* binding */ rfc4648)\n/* harmony export */ });\n/* harmony import */ var _vendor_base_x_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../vendor/base-x.js */ \"./node_modules/multiformats/esm/vendor/base-x.js\");\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/multiformats/esm/src/bytes.js\");\n\n\nclass Encoder {\n constructor(name, prefix, baseEncode) {\n this.name = name;\n this.prefix = prefix;\n this.baseEncode = baseEncode;\n }\n encode(bytes) {\n if (bytes instanceof Uint8Array) {\n return `${ this.prefix }${ this.baseEncode(bytes) }`;\n } else {\n throw Error('Unknown type, must be binary type');\n }\n }\n}\nclass Decoder {\n constructor(name, prefix, baseDecode) {\n this.name = name;\n this.prefix = prefix;\n if (prefix.codePointAt(0) === undefined) {\n throw new Error('Invalid prefix character');\n }\n this.prefixCodePoint = prefix.codePointAt(0);\n this.baseDecode = baseDecode;\n }\n decode(text) {\n if (typeof text === 'string') {\n if (text.codePointAt(0) !== this.prefixCodePoint) {\n throw Error(`Unable to decode multibase string ${ JSON.stringify(text) }, ${ this.name } decoder only supports inputs prefixed with ${ this.prefix }`);\n }\n return this.baseDecode(text.slice(this.prefix.length));\n } else {\n throw Error('Can only multibase decode strings');\n }\n }\n or(decoder) {\n return or(this, decoder);\n }\n}\nclass ComposedDecoder {\n constructor(decoders) {\n this.decoders = decoders;\n }\n or(decoder) {\n return or(this, decoder);\n }\n decode(input) {\n const prefix = input[0];\n const decoder = this.decoders[prefix];\n if (decoder) {\n return decoder.decode(input);\n } else {\n throw RangeError(`Unable to decode multibase string ${ JSON.stringify(input) }, only inputs prefixed with ${ Object.keys(this.decoders) } are supported`);\n }\n }\n}\nconst or = (left, right) => new ComposedDecoder({\n ...left.decoders || { [left.prefix]: left },\n ...right.decoders || { [right.prefix]: right }\n});\nclass Codec {\n constructor(name, prefix, baseEncode, baseDecode) {\n this.name = name;\n this.prefix = prefix;\n this.baseEncode = baseEncode;\n this.baseDecode = baseDecode;\n this.encoder = new Encoder(name, prefix, baseEncode);\n this.decoder = new Decoder(name, prefix, baseDecode);\n }\n encode(input) {\n return this.encoder.encode(input);\n }\n decode(input) {\n return this.decoder.decode(input);\n }\n}\nconst from = ({name, prefix, encode, decode}) => new Codec(name, prefix, encode, decode);\nconst baseX = ({prefix, name, alphabet}) => {\n const {encode, decode} = (0,_vendor_base_x_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(alphabet, name);\n return from({\n prefix,\n name,\n encode,\n decode: text => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_1__.coerce)(decode(text))\n });\n};\nconst decode = (string, alphabet, bitsPerChar, name) => {\n const codes = {};\n for (let i = 0; i < alphabet.length; ++i) {\n codes[alphabet[i]] = i;\n }\n let end = string.length;\n while (string[end - 1] === '=') {\n --end;\n }\n const out = new Uint8Array(end * bitsPerChar / 8 | 0);\n let bits = 0;\n let buffer = 0;\n let written = 0;\n for (let i = 0; i < end; ++i) {\n const value = codes[string[i]];\n if (value === undefined) {\n throw new SyntaxError(`Non-${ name } character`);\n }\n buffer = buffer << bitsPerChar | value;\n bits += bitsPerChar;\n if (bits >= 8) {\n bits -= 8;\n out[written++] = 255 & buffer >> bits;\n }\n }\n if (bits >= bitsPerChar || 255 & buffer << 8 - bits) {\n throw new SyntaxError('Unexpected end of data');\n }\n return out;\n};\nconst encode = (data, alphabet, bitsPerChar) => {\n const pad = alphabet[alphabet.length - 1] === '=';\n const mask = (1 << bitsPerChar) - 1;\n let out = '';\n let bits = 0;\n let buffer = 0;\n for (let i = 0; i < data.length; ++i) {\n buffer = buffer << 8 | data[i];\n bits += 8;\n while (bits > bitsPerChar) {\n bits -= bitsPerChar;\n out += alphabet[mask & buffer >> bits];\n }\n }\n if (bits) {\n out += alphabet[mask & buffer << bitsPerChar - bits];\n }\n if (pad) {\n while (out.length * bitsPerChar & 7) {\n out += '=';\n }\n }\n return out;\n};\nconst rfc4648 = ({name, prefix, bitsPerChar, alphabet}) => {\n return from({\n prefix,\n name,\n encode(input) {\n return encode(input, alphabet, bitsPerChar);\n },\n decode(input) {\n return decode(input, alphabet, bitsPerChar, name);\n }\n });\n};\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/src/bases/base.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/src/bases/base10.js": -/*!***********************************************************!*\ - !*** ./node_modules/multiformats/esm/src/bases/base10.js ***! - \***********************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base10: () => (/* binding */ base10)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/esm/src/bases/base.js\");\n\nconst base10 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n prefix: '9',\n name: 'base10',\n alphabet: '0123456789'\n});\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/src/bases/base10.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/src/bases/base16.js": -/*!***********************************************************!*\ - !*** ./node_modules/multiformats/esm/src/bases/base16.js ***! - \***********************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base16: () => (/* binding */ base16),\n/* harmony export */ base16upper: () => (/* binding */ base16upper)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/esm/src/bases/base.js\");\n\nconst base16 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'f',\n name: 'base16',\n alphabet: '0123456789abcdef',\n bitsPerChar: 4\n});\nconst base16upper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'F',\n name: 'base16upper',\n alphabet: '0123456789ABCDEF',\n bitsPerChar: 4\n});\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/src/bases/base16.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/src/bases/base2.js": -/*!**********************************************************!*\ - !*** ./node_modules/multiformats/esm/src/bases/base2.js ***! - \**********************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base2: () => (/* binding */ base2)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/esm/src/bases/base.js\");\n\nconst base2 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: '0',\n name: 'base2',\n alphabet: '01',\n bitsPerChar: 1\n});\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/src/bases/base2.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/src/bases/base256emoji.js": -/*!*****************************************************************!*\ - !*** ./node_modules/multiformats/esm/src/bases/base256emoji.js ***! - \*****************************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base256emoji: () => (/* binding */ base256emoji)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/esm/src/bases/base.js\");\n\nconst alphabet = Array.from('\\uD83D\\uDE80\\uD83E\\uDE90\\u2604\\uD83D\\uDEF0\\uD83C\\uDF0C\\uD83C\\uDF11\\uD83C\\uDF12\\uD83C\\uDF13\\uD83C\\uDF14\\uD83C\\uDF15\\uD83C\\uDF16\\uD83C\\uDF17\\uD83C\\uDF18\\uD83C\\uDF0D\\uD83C\\uDF0F\\uD83C\\uDF0E\\uD83D\\uDC09\\u2600\\uD83D\\uDCBB\\uD83D\\uDDA5\\uD83D\\uDCBE\\uD83D\\uDCBF\\uD83D\\uDE02\\u2764\\uD83D\\uDE0D\\uD83E\\uDD23\\uD83D\\uDE0A\\uD83D\\uDE4F\\uD83D\\uDC95\\uD83D\\uDE2D\\uD83D\\uDE18\\uD83D\\uDC4D\\uD83D\\uDE05\\uD83D\\uDC4F\\uD83D\\uDE01\\uD83D\\uDD25\\uD83E\\uDD70\\uD83D\\uDC94\\uD83D\\uDC96\\uD83D\\uDC99\\uD83D\\uDE22\\uD83E\\uDD14\\uD83D\\uDE06\\uD83D\\uDE44\\uD83D\\uDCAA\\uD83D\\uDE09\\u263A\\uD83D\\uDC4C\\uD83E\\uDD17\\uD83D\\uDC9C\\uD83D\\uDE14\\uD83D\\uDE0E\\uD83D\\uDE07\\uD83C\\uDF39\\uD83E\\uDD26\\uD83C\\uDF89\\uD83D\\uDC9E\\u270C\\u2728\\uD83E\\uDD37\\uD83D\\uDE31\\uD83D\\uDE0C\\uD83C\\uDF38\\uD83D\\uDE4C\\uD83D\\uDE0B\\uD83D\\uDC97\\uD83D\\uDC9A\\uD83D\\uDE0F\\uD83D\\uDC9B\\uD83D\\uDE42\\uD83D\\uDC93\\uD83E\\uDD29\\uD83D\\uDE04\\uD83D\\uDE00\\uD83D\\uDDA4\\uD83D\\uDE03\\uD83D\\uDCAF\\uD83D\\uDE48\\uD83D\\uDC47\\uD83C\\uDFB6\\uD83D\\uDE12\\uD83E\\uDD2D\\u2763\\uD83D\\uDE1C\\uD83D\\uDC8B\\uD83D\\uDC40\\uD83D\\uDE2A\\uD83D\\uDE11\\uD83D\\uDCA5\\uD83D\\uDE4B\\uD83D\\uDE1E\\uD83D\\uDE29\\uD83D\\uDE21\\uD83E\\uDD2A\\uD83D\\uDC4A\\uD83E\\uDD73\\uD83D\\uDE25\\uD83E\\uDD24\\uD83D\\uDC49\\uD83D\\uDC83\\uD83D\\uDE33\\u270B\\uD83D\\uDE1A\\uD83D\\uDE1D\\uD83D\\uDE34\\uD83C\\uDF1F\\uD83D\\uDE2C\\uD83D\\uDE43\\uD83C\\uDF40\\uD83C\\uDF37\\uD83D\\uDE3B\\uD83D\\uDE13\\u2B50\\u2705\\uD83E\\uDD7A\\uD83C\\uDF08\\uD83D\\uDE08\\uD83E\\uDD18\\uD83D\\uDCA6\\u2714\\uD83D\\uDE23\\uD83C\\uDFC3\\uD83D\\uDC90\\u2639\\uD83C\\uDF8A\\uD83D\\uDC98\\uD83D\\uDE20\\u261D\\uD83D\\uDE15\\uD83C\\uDF3A\\uD83C\\uDF82\\uD83C\\uDF3B\\uD83D\\uDE10\\uD83D\\uDD95\\uD83D\\uDC9D\\uD83D\\uDE4A\\uD83D\\uDE39\\uD83D\\uDDE3\\uD83D\\uDCAB\\uD83D\\uDC80\\uD83D\\uDC51\\uD83C\\uDFB5\\uD83E\\uDD1E\\uD83D\\uDE1B\\uD83D\\uDD34\\uD83D\\uDE24\\uD83C\\uDF3C\\uD83D\\uDE2B\\u26BD\\uD83E\\uDD19\\u2615\\uD83C\\uDFC6\\uD83E\\uDD2B\\uD83D\\uDC48\\uD83D\\uDE2E\\uD83D\\uDE46\\uD83C\\uDF7B\\uD83C\\uDF43\\uD83D\\uDC36\\uD83D\\uDC81\\uD83D\\uDE32\\uD83C\\uDF3F\\uD83E\\uDDE1\\uD83C\\uDF81\\u26A1\\uD83C\\uDF1E\\uD83C\\uDF88\\u274C\\u270A\\uD83D\\uDC4B\\uD83D\\uDE30\\uD83E\\uDD28\\uD83D\\uDE36\\uD83E\\uDD1D\\uD83D\\uDEB6\\uD83D\\uDCB0\\uD83C\\uDF53\\uD83D\\uDCA2\\uD83E\\uDD1F\\uD83D\\uDE41\\uD83D\\uDEA8\\uD83D\\uDCA8\\uD83E\\uDD2C\\u2708\\uD83C\\uDF80\\uD83C\\uDF7A\\uD83E\\uDD13\\uD83D\\uDE19\\uD83D\\uDC9F\\uD83C\\uDF31\\uD83D\\uDE16\\uD83D\\uDC76\\uD83E\\uDD74\\u25B6\\u27A1\\u2753\\uD83D\\uDC8E\\uD83D\\uDCB8\\u2B07\\uD83D\\uDE28\\uD83C\\uDF1A\\uD83E\\uDD8B\\uD83D\\uDE37\\uD83D\\uDD7A\\u26A0\\uD83D\\uDE45\\uD83D\\uDE1F\\uD83D\\uDE35\\uD83D\\uDC4E\\uD83E\\uDD32\\uD83E\\uDD20\\uD83E\\uDD27\\uD83D\\uDCCC\\uD83D\\uDD35\\uD83D\\uDC85\\uD83E\\uDDD0\\uD83D\\uDC3E\\uD83C\\uDF52\\uD83D\\uDE17\\uD83E\\uDD11\\uD83C\\uDF0A\\uD83E\\uDD2F\\uD83D\\uDC37\\u260E\\uD83D\\uDCA7\\uD83D\\uDE2F\\uD83D\\uDC86\\uD83D\\uDC46\\uD83C\\uDFA4\\uD83D\\uDE47\\uD83C\\uDF51\\u2744\\uD83C\\uDF34\\uD83D\\uDCA3\\uD83D\\uDC38\\uD83D\\uDC8C\\uD83D\\uDCCD\\uD83E\\uDD40\\uD83E\\uDD22\\uD83D\\uDC45\\uD83D\\uDCA1\\uD83D\\uDCA9\\uD83D\\uDC50\\uD83D\\uDCF8\\uD83D\\uDC7B\\uD83E\\uDD10\\uD83E\\uDD2E\\uD83C\\uDFBC\\uD83E\\uDD75\\uD83D\\uDEA9\\uD83C\\uDF4E\\uD83C\\uDF4A\\uD83D\\uDC7C\\uD83D\\uDC8D\\uD83D\\uDCE3\\uD83E\\uDD42');\nconst alphabetBytesToChars = alphabet.reduce((p, c, i) => {\n p[i] = c;\n return p;\n}, []);\nconst alphabetCharsToBytes = alphabet.reduce((p, c, i) => {\n p[c.codePointAt(0)] = i;\n return p;\n}, []);\nfunction encode(data) {\n return data.reduce((p, c) => {\n p += alphabetBytesToChars[c];\n return p;\n }, '');\n}\nfunction decode(str) {\n const byts = [];\n for (const char of str) {\n const byt = alphabetCharsToBytes[char.codePointAt(0)];\n if (byt === undefined) {\n throw new Error(`Non-base256emoji character: ${ char }`);\n }\n byts.push(byt);\n }\n return new Uint8Array(byts);\n}\nconst base256emoji = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.from)({\n prefix: '\\uD83D\\uDE80',\n name: 'base256emoji',\n encode,\n decode\n});\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/src/bases/base256emoji.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/src/bases/base32.js": -/*!***********************************************************!*\ - !*** ./node_modules/multiformats/esm/src/bases/base32.js ***! - \***********************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base32: () => (/* binding */ base32),\n/* harmony export */ base32hex: () => (/* binding */ base32hex),\n/* harmony export */ base32hexpad: () => (/* binding */ base32hexpad),\n/* harmony export */ base32hexpadupper: () => (/* binding */ base32hexpadupper),\n/* harmony export */ base32hexupper: () => (/* binding */ base32hexupper),\n/* harmony export */ base32pad: () => (/* binding */ base32pad),\n/* harmony export */ base32padupper: () => (/* binding */ base32padupper),\n/* harmony export */ base32upper: () => (/* binding */ base32upper),\n/* harmony export */ base32z: () => (/* binding */ base32z)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/esm/src/bases/base.js\");\n\nconst base32 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'b',\n name: 'base32',\n alphabet: 'abcdefghijklmnopqrstuvwxyz234567',\n bitsPerChar: 5\n});\nconst base32upper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'B',\n name: 'base32upper',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567',\n bitsPerChar: 5\n});\nconst base32pad = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'c',\n name: 'base32pad',\n alphabet: 'abcdefghijklmnopqrstuvwxyz234567=',\n bitsPerChar: 5\n});\nconst base32padupper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'C',\n name: 'base32padupper',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=',\n bitsPerChar: 5\n});\nconst base32hex = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'v',\n name: 'base32hex',\n alphabet: '0123456789abcdefghijklmnopqrstuv',\n bitsPerChar: 5\n});\nconst base32hexupper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'V',\n name: 'base32hexupper',\n alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUV',\n bitsPerChar: 5\n});\nconst base32hexpad = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 't',\n name: 'base32hexpad',\n alphabet: '0123456789abcdefghijklmnopqrstuv=',\n bitsPerChar: 5\n});\nconst base32hexpadupper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'T',\n name: 'base32hexpadupper',\n alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUV=',\n bitsPerChar: 5\n});\nconst base32z = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'h',\n name: 'base32z',\n alphabet: 'ybndrfg8ejkmcpqxot1uwisza345h769',\n bitsPerChar: 5\n});\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/src/bases/base32.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/src/bases/base36.js": -/*!***********************************************************!*\ - !*** ./node_modules/multiformats/esm/src/bases/base36.js ***! - \***********************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base36: () => (/* binding */ base36),\n/* harmony export */ base36upper: () => (/* binding */ base36upper)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/esm/src/bases/base.js\");\n\nconst base36 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n prefix: 'k',\n name: 'base36',\n alphabet: '0123456789abcdefghijklmnopqrstuvwxyz'\n});\nconst base36upper = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n prefix: 'K',\n name: 'base36upper',\n alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n});\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/src/bases/base36.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/src/bases/base58.js": -/*!***********************************************************!*\ - !*** ./node_modules/multiformats/esm/src/bases/base58.js ***! - \***********************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base58btc: () => (/* binding */ base58btc),\n/* harmony export */ base58flickr: () => (/* binding */ base58flickr)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/esm/src/bases/base.js\");\n\nconst base58btc = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n name: 'base58btc',\n prefix: 'z',\n alphabet: '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'\n});\nconst base58flickr = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.baseX)({\n name: 'base58flickr',\n prefix: 'Z',\n alphabet: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'\n});\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/src/bases/base58.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/src/bases/base64.js": -/*!***********************************************************!*\ - !*** ./node_modules/multiformats/esm/src/bases/base64.js ***! - \***********************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base64: () => (/* binding */ base64),\n/* harmony export */ base64pad: () => (/* binding */ base64pad),\n/* harmony export */ base64url: () => (/* binding */ base64url),\n/* harmony export */ base64urlpad: () => (/* binding */ base64urlpad)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/esm/src/bases/base.js\");\n\nconst base64 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'm',\n name: 'base64',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',\n bitsPerChar: 6\n});\nconst base64pad = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'M',\n name: 'base64pad',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',\n bitsPerChar: 6\n});\nconst base64url = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'u',\n name: 'base64url',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_',\n bitsPerChar: 6\n});\nconst base64urlpad = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: 'U',\n name: 'base64urlpad',\n alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=',\n bitsPerChar: 6\n});\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/src/bases/base64.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/src/bases/base8.js": -/*!**********************************************************!*\ - !*** ./node_modules/multiformats/esm/src/bases/base8.js ***! - \**********************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ base8: () => (/* binding */ base8)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/esm/src/bases/base.js\");\n\nconst base8 = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.rfc4648)({\n prefix: '7',\n name: 'base8',\n alphabet: '01234567',\n bitsPerChar: 3\n});\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/src/bases/base8.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/src/bases/identity.js": -/*!*************************************************************!*\ - !*** ./node_modules/multiformats/esm/src/bases/identity.js ***! - \*************************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ identity: () => (/* binding */ identity)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/multiformats/esm/src/bases/base.js\");\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/multiformats/esm/src/bytes.js\");\n\n\nconst identity = (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.from)({\n prefix: '\\0',\n name: 'identity',\n encode: buf => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_1__.toString)(buf),\n decode: str => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_1__.fromString)(str)\n});\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/src/bases/identity.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/src/basics.js": -/*!*****************************************************!*\ - !*** ./node_modules/multiformats/esm/src/basics.js ***! - \*****************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CID: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.CID),\n/* harmony export */ bases: () => (/* binding */ bases),\n/* harmony export */ bytes: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.bytes),\n/* harmony export */ codecs: () => (/* binding */ codecs),\n/* harmony export */ digest: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.digest),\n/* harmony export */ hasher: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.hasher),\n/* harmony export */ hashes: () => (/* binding */ hashes),\n/* harmony export */ varint: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_14__.varint)\n/* harmony export */ });\n/* harmony import */ var _bases_identity_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bases/identity.js */ \"./node_modules/multiformats/esm/src/bases/identity.js\");\n/* harmony import */ var _bases_base2_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bases/base2.js */ \"./node_modules/multiformats/esm/src/bases/base2.js\");\n/* harmony import */ var _bases_base8_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bases/base8.js */ \"./node_modules/multiformats/esm/src/bases/base8.js\");\n/* harmony import */ var _bases_base10_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./bases/base10.js */ \"./node_modules/multiformats/esm/src/bases/base10.js\");\n/* harmony import */ var _bases_base16_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./bases/base16.js */ \"./node_modules/multiformats/esm/src/bases/base16.js\");\n/* harmony import */ var _bases_base32_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./bases/base32.js */ \"./node_modules/multiformats/esm/src/bases/base32.js\");\n/* harmony import */ var _bases_base36_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./bases/base36.js */ \"./node_modules/multiformats/esm/src/bases/base36.js\");\n/* harmony import */ var _bases_base58_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./bases/base58.js */ \"./node_modules/multiformats/esm/src/bases/base58.js\");\n/* harmony import */ var _bases_base64_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./bases/base64.js */ \"./node_modules/multiformats/esm/src/bases/base64.js\");\n/* harmony import */ var _bases_base256emoji_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./bases/base256emoji.js */ \"./node_modules/multiformats/esm/src/bases/base256emoji.js\");\n/* harmony import */ var _hashes_sha2_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./hashes/sha2.js */ \"./node_modules/multiformats/esm/src/hashes/sha2-browser.js\");\n/* harmony import */ var _hashes_identity_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./hashes/identity.js */ \"./node_modules/multiformats/esm/src/hashes/identity.js\");\n/* harmony import */ var _codecs_raw_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./codecs/raw.js */ \"./node_modules/multiformats/esm/src/codecs/raw.js\");\n/* harmony import */ var _codecs_json_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./codecs/json.js */ \"./node_modules/multiformats/esm/src/codecs/json.js\");\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./index.js */ \"./node_modules/multiformats/esm/src/index.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst bases = {\n ..._bases_identity_js__WEBPACK_IMPORTED_MODULE_0__,\n ..._bases_base2_js__WEBPACK_IMPORTED_MODULE_1__,\n ..._bases_base8_js__WEBPACK_IMPORTED_MODULE_2__,\n ..._bases_base10_js__WEBPACK_IMPORTED_MODULE_3__,\n ..._bases_base16_js__WEBPACK_IMPORTED_MODULE_4__,\n ..._bases_base32_js__WEBPACK_IMPORTED_MODULE_5__,\n ..._bases_base36_js__WEBPACK_IMPORTED_MODULE_6__,\n ..._bases_base58_js__WEBPACK_IMPORTED_MODULE_7__,\n ..._bases_base64_js__WEBPACK_IMPORTED_MODULE_8__,\n ..._bases_base256emoji_js__WEBPACK_IMPORTED_MODULE_9__\n};\nconst hashes = {\n ..._hashes_sha2_js__WEBPACK_IMPORTED_MODULE_10__,\n ..._hashes_identity_js__WEBPACK_IMPORTED_MODULE_11__\n};\nconst codecs = {\n raw: _codecs_raw_js__WEBPACK_IMPORTED_MODULE_12__,\n json: _codecs_json_js__WEBPACK_IMPORTED_MODULE_13__\n};\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/src/basics.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/src/bytes.js": -/*!****************************************************!*\ - !*** ./node_modules/multiformats/esm/src/bytes.js ***! - \****************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ coerce: () => (/* binding */ coerce),\n/* harmony export */ empty: () => (/* binding */ empty),\n/* harmony export */ equals: () => (/* binding */ equals),\n/* harmony export */ fromHex: () => (/* binding */ fromHex),\n/* harmony export */ fromString: () => (/* binding */ fromString),\n/* harmony export */ isBinary: () => (/* binding */ isBinary),\n/* harmony export */ toHex: () => (/* binding */ toHex),\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\nconst empty = new Uint8Array(0);\nconst toHex = d => d.reduce((hex, byte) => hex + byte.toString(16).padStart(2, '0'), '');\nconst fromHex = hex => {\n const hexes = hex.match(/../g);\n return hexes ? new Uint8Array(hexes.map(b => parseInt(b, 16))) : empty;\n};\nconst equals = (aa, bb) => {\n if (aa === bb)\n return true;\n if (aa.byteLength !== bb.byteLength) {\n return false;\n }\n for (let ii = 0; ii < aa.byteLength; ii++) {\n if (aa[ii] !== bb[ii]) {\n return false;\n }\n }\n return true;\n};\nconst coerce = o => {\n if (o instanceof Uint8Array && o.constructor.name === 'Uint8Array')\n return o;\n if (o instanceof ArrayBuffer)\n return new Uint8Array(o);\n if (ArrayBuffer.isView(o)) {\n return new Uint8Array(o.buffer, o.byteOffset, o.byteLength);\n }\n throw new Error('Unknown type, must be binary type');\n};\nconst isBinary = o => o instanceof ArrayBuffer || ArrayBuffer.isView(o);\nconst fromString = str => new TextEncoder().encode(str);\nconst toString = b => new TextDecoder().decode(b);\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/src/bytes.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/src/cid.js": -/*!**************************************************!*\ - !*** ./node_modules/multiformats/esm/src/cid.js ***! - \**************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CID: () => (/* binding */ CID)\n/* harmony export */ });\n/* harmony import */ var _varint_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./varint.js */ \"./node_modules/multiformats/esm/src/varint.js\");\n/* harmony import */ var _hashes_digest_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hashes/digest.js */ \"./node_modules/multiformats/esm/src/hashes/digest.js\");\n/* harmony import */ var _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bases/base58.js */ \"./node_modules/multiformats/esm/src/bases/base58.js\");\n/* harmony import */ var _bases_base32_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./bases/base32.js */ \"./node_modules/multiformats/esm/src/bases/base32.js\");\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./bytes.js */ \"./node_modules/multiformats/esm/src/bytes.js\");\n\n\n\n\n\nclass CID {\n constructor(version, code, multihash, bytes) {\n this.code = code;\n this.version = version;\n this.multihash = multihash;\n this.bytes = bytes;\n this.byteOffset = bytes.byteOffset;\n this.byteLength = bytes.byteLength;\n this.asCID = this;\n this._baseCache = new Map();\n Object.defineProperties(this, {\n byteOffset: hidden,\n byteLength: hidden,\n code: readonly,\n version: readonly,\n multihash: readonly,\n bytes: readonly,\n _baseCache: hidden,\n asCID: hidden\n });\n }\n toV0() {\n switch (this.version) {\n case 0: {\n return this;\n }\n default: {\n const {code, multihash} = this;\n if (code !== DAG_PB_CODE) {\n throw new Error('Cannot convert a non dag-pb CID to CIDv0');\n }\n if (multihash.code !== SHA_256_CODE) {\n throw new Error('Cannot convert non sha2-256 multihash CID to CIDv0');\n }\n return CID.createV0(multihash);\n }\n }\n }\n toV1() {\n switch (this.version) {\n case 0: {\n const {code, digest} = this.multihash;\n const multihash = _hashes_digest_js__WEBPACK_IMPORTED_MODULE_1__.create(code, digest);\n return CID.createV1(this.code, multihash);\n }\n case 1: {\n return this;\n }\n default: {\n throw Error(`Can not convert CID version ${ this.version } to version 0. This is a bug please report`);\n }\n }\n }\n equals(other) {\n return other && this.code === other.code && this.version === other.version && _hashes_digest_js__WEBPACK_IMPORTED_MODULE_1__.equals(this.multihash, other.multihash);\n }\n toString(base) {\n const {bytes, version, _baseCache} = this;\n switch (version) {\n case 0:\n return toStringV0(bytes, _baseCache, base || _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc.encoder);\n default:\n return toStringV1(bytes, _baseCache, base || _bases_base32_js__WEBPACK_IMPORTED_MODULE_3__.base32.encoder);\n }\n }\n toJSON() {\n return {\n code: this.code,\n version: this.version,\n hash: this.multihash.bytes\n };\n }\n get [Symbol.toStringTag]() {\n return 'CID';\n }\n [Symbol.for('nodejs.util.inspect.custom')]() {\n return 'CID(' + this.toString() + ')';\n }\n static isCID(value) {\n deprecate(/^0\\.0/, IS_CID_DEPRECATION);\n return !!(value && (value[cidSymbol] || value.asCID === value));\n }\n get toBaseEncodedString() {\n throw new Error('Deprecated, use .toString()');\n }\n get codec() {\n throw new Error('\"codec\" property is deprecated, use integer \"code\" property instead');\n }\n get buffer() {\n throw new Error('Deprecated .buffer property, use .bytes to get Uint8Array instead');\n }\n get multibaseName() {\n throw new Error('\"multibaseName\" property is deprecated');\n }\n get prefix() {\n throw new Error('\"prefix\" property is deprecated');\n }\n static asCID(value) {\n if (value instanceof CID) {\n return value;\n } else if (value != null && value.asCID === value) {\n const {version, code, multihash, bytes} = value;\n return new CID(version, code, multihash, bytes || encodeCID(version, code, multihash.bytes));\n } else if (value != null && value[cidSymbol] === true) {\n const {version, multihash, code} = value;\n const digest = _hashes_digest_js__WEBPACK_IMPORTED_MODULE_1__.decode(multihash);\n return CID.create(version, code, digest);\n } else {\n return null;\n }\n }\n static create(version, code, digest) {\n if (typeof code !== 'number') {\n throw new Error('String codecs are no longer supported');\n }\n switch (version) {\n case 0: {\n if (code !== DAG_PB_CODE) {\n throw new Error(`Version 0 CID must use dag-pb (code: ${ DAG_PB_CODE }) block encoding`);\n } else {\n return new CID(version, code, digest, digest.bytes);\n }\n }\n case 1: {\n const bytes = encodeCID(version, code, digest.bytes);\n return new CID(version, code, digest, bytes);\n }\n default: {\n throw new Error('Invalid version');\n }\n }\n }\n static createV0(digest) {\n return CID.create(0, DAG_PB_CODE, digest);\n }\n static createV1(code, digest) {\n return CID.create(1, code, digest);\n }\n static decode(bytes) {\n const [cid, remainder] = CID.decodeFirst(bytes);\n if (remainder.length) {\n throw new Error('Incorrect length');\n }\n return cid;\n }\n static decodeFirst(bytes) {\n const specs = CID.inspectBytes(bytes);\n const prefixSize = specs.size - specs.multihashSize;\n const multihashBytes = (0,_bytes_js__WEBPACK_IMPORTED_MODULE_4__.coerce)(bytes.subarray(prefixSize, prefixSize + specs.multihashSize));\n if (multihashBytes.byteLength !== specs.multihashSize) {\n throw new Error('Incorrect length');\n }\n const digestBytes = multihashBytes.subarray(specs.multihashSize - specs.digestSize);\n const digest = new _hashes_digest_js__WEBPACK_IMPORTED_MODULE_1__.Digest(specs.multihashCode, specs.digestSize, digestBytes, multihashBytes);\n const cid = specs.version === 0 ? CID.createV0(digest) : CID.createV1(specs.codec, digest);\n return [\n cid,\n bytes.subarray(specs.size)\n ];\n }\n static inspectBytes(initialBytes) {\n let offset = 0;\n const next = () => {\n const [i, length] = _varint_js__WEBPACK_IMPORTED_MODULE_0__.decode(initialBytes.subarray(offset));\n offset += length;\n return i;\n };\n let version = next();\n let codec = DAG_PB_CODE;\n if (version === 18) {\n version = 0;\n offset = 0;\n } else if (version === 1) {\n codec = next();\n }\n if (version !== 0 && version !== 1) {\n throw new RangeError(`Invalid CID version ${ version }`);\n }\n const prefixSize = offset;\n const multihashCode = next();\n const digestSize = next();\n const size = offset + digestSize;\n const multihashSize = size - prefixSize;\n return {\n version,\n codec,\n multihashCode,\n digestSize,\n multihashSize,\n size\n };\n }\n static parse(source, base) {\n const [prefix, bytes] = parseCIDtoBytes(source, base);\n const cid = CID.decode(bytes);\n cid._baseCache.set(prefix, source);\n return cid;\n }\n}\nconst parseCIDtoBytes = (source, base) => {\n switch (source[0]) {\n case 'Q': {\n const decoder = base || _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc;\n return [\n _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc.prefix,\n decoder.decode(`${ _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc.prefix }${ source }`)\n ];\n }\n case _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc.prefix: {\n const decoder = base || _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc;\n return [\n _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc.prefix,\n decoder.decode(source)\n ];\n }\n case _bases_base32_js__WEBPACK_IMPORTED_MODULE_3__.base32.prefix: {\n const decoder = base || _bases_base32_js__WEBPACK_IMPORTED_MODULE_3__.base32;\n return [\n _bases_base32_js__WEBPACK_IMPORTED_MODULE_3__.base32.prefix,\n decoder.decode(source)\n ];\n }\n default: {\n if (base == null) {\n throw Error('To parse non base32 or base58btc encoded CID multibase decoder must be provided');\n }\n return [\n source[0],\n base.decode(source)\n ];\n }\n }\n};\nconst toStringV0 = (bytes, cache, base) => {\n const {prefix} = base;\n if (prefix !== _bases_base58_js__WEBPACK_IMPORTED_MODULE_2__.base58btc.prefix) {\n throw Error(`Cannot string encode V0 in ${ base.name } encoding`);\n }\n const cid = cache.get(prefix);\n if (cid == null) {\n const cid = base.encode(bytes).slice(1);\n cache.set(prefix, cid);\n return cid;\n } else {\n return cid;\n }\n};\nconst toStringV1 = (bytes, cache, base) => {\n const {prefix} = base;\n const cid = cache.get(prefix);\n if (cid == null) {\n const cid = base.encode(bytes);\n cache.set(prefix, cid);\n return cid;\n } else {\n return cid;\n }\n};\nconst DAG_PB_CODE = 112;\nconst SHA_256_CODE = 18;\nconst encodeCID = (version, code, multihash) => {\n const codeOffset = _varint_js__WEBPACK_IMPORTED_MODULE_0__.encodingLength(version);\n const hashOffset = codeOffset + _varint_js__WEBPACK_IMPORTED_MODULE_0__.encodingLength(code);\n const bytes = new Uint8Array(hashOffset + multihash.byteLength);\n _varint_js__WEBPACK_IMPORTED_MODULE_0__.encodeTo(version, bytes, 0);\n _varint_js__WEBPACK_IMPORTED_MODULE_0__.encodeTo(code, bytes, codeOffset);\n bytes.set(multihash, hashOffset);\n return bytes;\n};\nconst cidSymbol = Symbol.for('@ipld/js-cid/CID');\nconst readonly = {\n writable: false,\n configurable: false,\n enumerable: true\n};\nconst hidden = {\n writable: false,\n enumerable: false,\n configurable: false\n};\nconst version = '0.0.0-dev';\nconst deprecate = (range, message) => {\n if (range.test(version)) {\n console.warn(message);\n } else {\n throw new Error(message);\n }\n};\nconst IS_CID_DEPRECATION = `CID.isCID(v) is deprecated and will be removed in the next major release.\nFollowing code pattern:\n\nif (CID.isCID(value)) {\n doSomethingWithCID(value)\n}\n\nIs replaced with:\n\nconst cid = CID.asCID(value)\nif (cid) {\n // Make sure to use cid instead of value\n doSomethingWithCID(cid)\n}\n`;\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/src/cid.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/src/codecs/json.js": -/*!**********************************************************!*\ - !*** ./node_modules/multiformats/esm/src/codecs/json.js ***! - \**********************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ code: () => (/* binding */ code),\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encode: () => (/* binding */ encode),\n/* harmony export */ name: () => (/* binding */ name)\n/* harmony export */ });\nconst textEncoder = new TextEncoder();\nconst textDecoder = new TextDecoder();\nconst name = 'json';\nconst code = 512;\nconst encode = node => textEncoder.encode(JSON.stringify(node));\nconst decode = data => JSON.parse(textDecoder.decode(data));\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/src/codecs/json.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/src/codecs/raw.js": -/*!*********************************************************!*\ - !*** ./node_modules/multiformats/esm/src/codecs/raw.js ***! - \*********************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ code: () => (/* binding */ code),\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encode: () => (/* binding */ encode),\n/* harmony export */ name: () => (/* binding */ name)\n/* harmony export */ });\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/multiformats/esm/src/bytes.js\");\n\nconst name = 'raw';\nconst code = 85;\nconst encode = node => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.coerce)(node);\nconst decode = data => (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.coerce)(data);\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/src/codecs/raw.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/src/hashes/digest.js": -/*!************************************************************!*\ - !*** ./node_modules/multiformats/esm/src/hashes/digest.js ***! - \************************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Digest: () => (/* binding */ Digest),\n/* harmony export */ create: () => (/* binding */ create),\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ equals: () => (/* binding */ equals)\n/* harmony export */ });\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/multiformats/esm/src/bytes.js\");\n/* harmony import */ var _varint_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../varint.js */ \"./node_modules/multiformats/esm/src/varint.js\");\n\n\nconst create = (code, digest) => {\n const size = digest.byteLength;\n const sizeOffset = _varint_js__WEBPACK_IMPORTED_MODULE_1__.encodingLength(code);\n const digestOffset = sizeOffset + _varint_js__WEBPACK_IMPORTED_MODULE_1__.encodingLength(size);\n const bytes = new Uint8Array(digestOffset + size);\n _varint_js__WEBPACK_IMPORTED_MODULE_1__.encodeTo(code, bytes, 0);\n _varint_js__WEBPACK_IMPORTED_MODULE_1__.encodeTo(size, bytes, sizeOffset);\n bytes.set(digest, digestOffset);\n return new Digest(code, size, digest, bytes);\n};\nconst decode = multihash => {\n const bytes = (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.coerce)(multihash);\n const [code, sizeOffset] = _varint_js__WEBPACK_IMPORTED_MODULE_1__.decode(bytes);\n const [size, digestOffset] = _varint_js__WEBPACK_IMPORTED_MODULE_1__.decode(bytes.subarray(sizeOffset));\n const digest = bytes.subarray(sizeOffset + digestOffset);\n if (digest.byteLength !== size) {\n throw new Error('Incorrect length');\n }\n return new Digest(code, size, digest, bytes);\n};\nconst equals = (a, b) => {\n if (a === b) {\n return true;\n } else {\n return a.code === b.code && a.size === b.size && (0,_bytes_js__WEBPACK_IMPORTED_MODULE_0__.equals)(a.bytes, b.bytes);\n }\n};\nclass Digest {\n constructor(code, size, digest, bytes) {\n this.code = code;\n this.size = size;\n this.digest = digest;\n this.bytes = bytes;\n }\n}\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/src/hashes/digest.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/src/hashes/hasher.js": -/*!************************************************************!*\ - !*** ./node_modules/multiformats/esm/src/hashes/hasher.js ***! - \************************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Hasher: () => (/* binding */ Hasher),\n/* harmony export */ from: () => (/* binding */ from)\n/* harmony export */ });\n/* harmony import */ var _digest_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./digest.js */ \"./node_modules/multiformats/esm/src/hashes/digest.js\");\n\nconst from = ({name, code, encode}) => new Hasher(name, code, encode);\nclass Hasher {\n constructor(name, code, encode) {\n this.name = name;\n this.code = code;\n this.encode = encode;\n }\n digest(input) {\n if (input instanceof Uint8Array) {\n const result = this.encode(input);\n return result instanceof Uint8Array ? _digest_js__WEBPACK_IMPORTED_MODULE_0__.create(this.code, result) : result.then(digest => _digest_js__WEBPACK_IMPORTED_MODULE_0__.create(this.code, digest));\n } else {\n throw Error('Unknown type, must be binary type');\n }\n }\n}\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/src/hashes/hasher.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/src/hashes/identity.js": -/*!**************************************************************!*\ - !*** ./node_modules/multiformats/esm/src/hashes/identity.js ***! - \**************************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ identity: () => (/* binding */ identity)\n/* harmony export */ });\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes.js */ \"./node_modules/multiformats/esm/src/bytes.js\");\n/* harmony import */ var _digest_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./digest.js */ \"./node_modules/multiformats/esm/src/hashes/digest.js\");\n\n\nconst code = 0;\nconst name = 'identity';\nconst encode = _bytes_js__WEBPACK_IMPORTED_MODULE_0__.coerce;\nconst digest = input => _digest_js__WEBPACK_IMPORTED_MODULE_1__.create(code, encode(input));\nconst identity = {\n code,\n name,\n encode,\n digest\n};\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/src/hashes/identity.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/src/hashes/sha2-browser.js": -/*!******************************************************************!*\ - !*** ./node_modules/multiformats/esm/src/hashes/sha2-browser.js ***! - \******************************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ sha256: () => (/* binding */ sha256),\n/* harmony export */ sha512: () => (/* binding */ sha512)\n/* harmony export */ });\n/* harmony import */ var _hasher_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hasher.js */ \"./node_modules/multiformats/esm/src/hashes/hasher.js\");\n\nconst sha = name => async data => new Uint8Array(await crypto.subtle.digest(name, data));\nconst sha256 = (0,_hasher_js__WEBPACK_IMPORTED_MODULE_0__.from)({\n name: 'sha2-256',\n code: 18,\n encode: sha('SHA-256')\n});\nconst sha512 = (0,_hasher_js__WEBPACK_IMPORTED_MODULE_0__.from)({\n name: 'sha2-512',\n code: 19,\n encode: sha('SHA-512')\n});\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/src/hashes/sha2-browser.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/src/index.js": -/*!****************************************************!*\ - !*** ./node_modules/multiformats/esm/src/index.js ***! - \****************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CID: () => (/* reexport safe */ _cid_js__WEBPACK_IMPORTED_MODULE_0__.CID),\n/* harmony export */ bytes: () => (/* reexport module object */ _bytes_js__WEBPACK_IMPORTED_MODULE_2__),\n/* harmony export */ digest: () => (/* reexport module object */ _hashes_digest_js__WEBPACK_IMPORTED_MODULE_4__),\n/* harmony export */ hasher: () => (/* reexport module object */ _hashes_hasher_js__WEBPACK_IMPORTED_MODULE_3__),\n/* harmony export */ varint: () => (/* reexport module object */ _varint_js__WEBPACK_IMPORTED_MODULE_1__)\n/* harmony export */ });\n/* harmony import */ var _cid_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cid.js */ \"./node_modules/multiformats/esm/src/cid.js\");\n/* harmony import */ var _varint_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./varint.js */ \"./node_modules/multiformats/esm/src/varint.js\");\n/* harmony import */ var _bytes_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bytes.js */ \"./node_modules/multiformats/esm/src/bytes.js\");\n/* harmony import */ var _hashes_hasher_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hashes/hasher.js */ \"./node_modules/multiformats/esm/src/hashes/hasher.js\");\n/* harmony import */ var _hashes_digest_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./hashes/digest.js */ \"./node_modules/multiformats/esm/src/hashes/digest.js\");\n\n\n\n\n\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/src/index.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/src/varint.js": -/*!*****************************************************!*\ - !*** ./node_modules/multiformats/esm/src/varint.js ***! - \*****************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encodeTo: () => (/* binding */ encodeTo),\n/* harmony export */ encodingLength: () => (/* binding */ encodingLength)\n/* harmony export */ });\n/* harmony import */ var _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../vendor/varint.js */ \"./node_modules/multiformats/esm/vendor/varint.js\");\n\nconst decode = (data, offset = 0) => {\n const code = _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].decode(data, offset);\n return [\n code,\n _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].decode.bytes\n ];\n};\nconst encodeTo = (int, target, offset = 0) => {\n _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].encode(int, target, offset);\n return target;\n};\nconst encodingLength = int => {\n return _vendor_varint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].encodingLength(int);\n};\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/src/varint.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/vendor/base-x.js": -/*!********************************************************!*\ - !*** ./node_modules/multiformats/esm/vendor/base-x.js ***! - \********************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nfunction base(ALPHABET, name) {\n if (ALPHABET.length >= 255) {\n throw new TypeError('Alphabet too long');\n }\n var BASE_MAP = new Uint8Array(256);\n for (var j = 0; j < BASE_MAP.length; j++) {\n BASE_MAP[j] = 255;\n }\n for (var i = 0; i < ALPHABET.length; i++) {\n var x = ALPHABET.charAt(i);\n var xc = x.charCodeAt(0);\n if (BASE_MAP[xc] !== 255) {\n throw new TypeError(x + ' is ambiguous');\n }\n BASE_MAP[xc] = i;\n }\n var BASE = ALPHABET.length;\n var LEADER = ALPHABET.charAt(0);\n var FACTOR = Math.log(BASE) / Math.log(256);\n var iFACTOR = Math.log(256) / Math.log(BASE);\n function encode(source) {\n if (source instanceof Uint8Array);\n else if (ArrayBuffer.isView(source)) {\n source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);\n } else if (Array.isArray(source)) {\n source = Uint8Array.from(source);\n }\n if (!(source instanceof Uint8Array)) {\n throw new TypeError('Expected Uint8Array');\n }\n if (source.length === 0) {\n return '';\n }\n var zeroes = 0;\n var length = 0;\n var pbegin = 0;\n var pend = source.length;\n while (pbegin !== pend && source[pbegin] === 0) {\n pbegin++;\n zeroes++;\n }\n var size = (pend - pbegin) * iFACTOR + 1 >>> 0;\n var b58 = new Uint8Array(size);\n while (pbegin !== pend) {\n var carry = source[pbegin];\n var i = 0;\n for (var it1 = size - 1; (carry !== 0 || i < length) && it1 !== -1; it1--, i++) {\n carry += 256 * b58[it1] >>> 0;\n b58[it1] = carry % BASE >>> 0;\n carry = carry / BASE >>> 0;\n }\n if (carry !== 0) {\n throw new Error('Non-zero carry');\n }\n length = i;\n pbegin++;\n }\n var it2 = size - length;\n while (it2 !== size && b58[it2] === 0) {\n it2++;\n }\n var str = LEADER.repeat(zeroes);\n for (; it2 < size; ++it2) {\n str += ALPHABET.charAt(b58[it2]);\n }\n return str;\n }\n function decodeUnsafe(source) {\n if (typeof source !== 'string') {\n throw new TypeError('Expected String');\n }\n if (source.length === 0) {\n return new Uint8Array();\n }\n var psz = 0;\n if (source[psz] === ' ') {\n return;\n }\n var zeroes = 0;\n var length = 0;\n while (source[psz] === LEADER) {\n zeroes++;\n psz++;\n }\n var size = (source.length - psz) * FACTOR + 1 >>> 0;\n var b256 = new Uint8Array(size);\n while (source[psz]) {\n var carry = BASE_MAP[source.charCodeAt(psz)];\n if (carry === 255) {\n return;\n }\n var i = 0;\n for (var it3 = size - 1; (carry !== 0 || i < length) && it3 !== -1; it3--, i++) {\n carry += BASE * b256[it3] >>> 0;\n b256[it3] = carry % 256 >>> 0;\n carry = carry / 256 >>> 0;\n }\n if (carry !== 0) {\n throw new Error('Non-zero carry');\n }\n length = i;\n psz++;\n }\n if (source[psz] === ' ') {\n return;\n }\n var it4 = size - length;\n while (it4 !== size && b256[it4] === 0) {\n it4++;\n }\n var vch = new Uint8Array(zeroes + (size - it4));\n var j = zeroes;\n while (it4 !== size) {\n vch[j++] = b256[it4++];\n }\n return vch;\n }\n function decode(string) {\n var buffer = decodeUnsafe(string);\n if (buffer) {\n return buffer;\n }\n throw new Error(`Non-${ name } character`);\n }\n return {\n encode: encode,\n decodeUnsafe: decodeUnsafe,\n decode: decode\n };\n}\nvar src = base;\nvar _brrp__multiformats_scope_baseX = src;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_brrp__multiformats_scope_baseX);\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/vendor/base-x.js?"); - -/***/ }), - -/***/ "./node_modules/multiformats/esm/vendor/varint.js": -/*!********************************************************!*\ - !*** ./node_modules/multiformats/esm/vendor/varint.js ***! - \********************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nvar encode_1 = encode;\nvar MSB = 128, REST = 127, MSBALL = ~REST, INT = Math.pow(2, 31);\nfunction encode(num, out, offset) {\n out = out || [];\n offset = offset || 0;\n var oldOffset = offset;\n while (num >= INT) {\n out[offset++] = num & 255 | MSB;\n num /= 128;\n }\n while (num & MSBALL) {\n out[offset++] = num & 255 | MSB;\n num >>>= 7;\n }\n out[offset] = num | 0;\n encode.bytes = offset - oldOffset + 1;\n return out;\n}\nvar decode = read;\nvar MSB$1 = 128, REST$1 = 127;\nfunction read(buf, offset) {\n var res = 0, offset = offset || 0, shift = 0, counter = offset, b, l = buf.length;\n do {\n if (counter >= l) {\n read.bytes = 0;\n throw new RangeError('Could not decode varint');\n }\n b = buf[counter++];\n res += shift < 28 ? (b & REST$1) << shift : (b & REST$1) * Math.pow(2, shift);\n shift += 7;\n } while (b >= MSB$1);\n read.bytes = counter - offset;\n return res;\n}\nvar N1 = Math.pow(2, 7);\nvar N2 = Math.pow(2, 14);\nvar N3 = Math.pow(2, 21);\nvar N4 = Math.pow(2, 28);\nvar N5 = Math.pow(2, 35);\nvar N6 = Math.pow(2, 42);\nvar N7 = Math.pow(2, 49);\nvar N8 = Math.pow(2, 56);\nvar N9 = Math.pow(2, 63);\nvar length = function (value) {\n return value < N1 ? 1 : value < N2 ? 2 : value < N3 ? 3 : value < N4 ? 4 : value < N5 ? 5 : value < N6 ? 6 : value < N7 ? 7 : value < N8 ? 8 : value < N9 ? 9 : 10;\n};\nvar varint = {\n encode: encode_1,\n decode: decode,\n encodingLength: length\n};\nvar _brrp_varint = varint;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_brrp_varint);\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/multiformats/esm/vendor/varint.js?"); - -/***/ }), - -/***/ "./node_modules/uint8arrays/esm/src/alloc.js": -/*!***************************************************!*\ - !*** ./node_modules/uint8arrays/esm/src/alloc.js ***! - \***************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ allocUnsafe: () => (/* binding */ allocUnsafe)\n/* harmony export */ });\n/* harmony import */ var _util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/as-uint8array.js */ \"./node_modules/uint8arrays/esm/src/util/as-uint8array.js\");\n\nfunction alloc(size = 0) {\n if (globalThis.Buffer != null && globalThis.Buffer.alloc != null) {\n return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_0__.asUint8Array)(globalThis.Buffer.alloc(size));\n }\n return new Uint8Array(size);\n}\nfunction allocUnsafe(size = 0) {\n if (globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null) {\n return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_0__.asUint8Array)(globalThis.Buffer.allocUnsafe(size));\n }\n return new Uint8Array(size);\n}\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/uint8arrays/esm/src/alloc.js?"); - -/***/ }), - -/***/ "./node_modules/uint8arrays/esm/src/compare.js": -/*!*****************************************************!*\ - !*** ./node_modules/uint8arrays/esm/src/compare.js ***! - \*****************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ compare: () => (/* binding */ compare)\n/* harmony export */ });\nfunction compare(a, b) {\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] < b[i]) {\n return -1;\n }\n if (a[i] > b[i]) {\n return 1;\n }\n }\n if (a.byteLength > b.byteLength) {\n return 1;\n }\n if (a.byteLength < b.byteLength) {\n return -1;\n }\n return 0;\n}\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/uint8arrays/esm/src/compare.js?"); - -/***/ }), - -/***/ "./node_modules/uint8arrays/esm/src/concat.js": -/*!****************************************************!*\ - !*** ./node_modules/uint8arrays/esm/src/concat.js ***! - \****************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ concat: () => (/* binding */ concat)\n/* harmony export */ });\n/* harmony import */ var _alloc_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./alloc.js */ \"./node_modules/uint8arrays/esm/src/alloc.js\");\n/* harmony import */ var _util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util/as-uint8array.js */ \"./node_modules/uint8arrays/esm/src/util/as-uint8array.js\");\n\n\nfunction concat(arrays, length) {\n if (!length) {\n length = arrays.reduce((acc, curr) => acc + curr.length, 0);\n }\n const output = (0,_alloc_js__WEBPACK_IMPORTED_MODULE_0__.allocUnsafe)(length);\n let offset = 0;\n for (const arr of arrays) {\n output.set(arr, offset);\n offset += arr.length;\n }\n return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__.asUint8Array)(output);\n}\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/uint8arrays/esm/src/concat.js?"); - -/***/ }), - -/***/ "./node_modules/uint8arrays/esm/src/equals.js": -/*!****************************************************!*\ - !*** ./node_modules/uint8arrays/esm/src/equals.js ***! - \****************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ equals: () => (/* binding */ equals)\n/* harmony export */ });\nfunction equals(a, b) {\n if (a === b) {\n return true;\n }\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/uint8arrays/esm/src/equals.js?"); - -/***/ }), - -/***/ "./node_modules/uint8arrays/esm/src/from-string.js": -/*!*********************************************************!*\ - !*** ./node_modules/uint8arrays/esm/src/from-string.js ***! - \*********************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fromString: () => (/* binding */ fromString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/uint8arrays/esm/src/util/bases.js\");\n/* harmony import */ var _util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util/as-uint8array.js */ \"./node_modules/uint8arrays/esm/src/util/as-uint8array.js\");\n\n\nfunction fromString(string, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (!base) {\n throw new Error(`Unsupported encoding \"${ encoding }\"`);\n }\n if ((encoding === 'utf8' || encoding === 'utf-8') && globalThis.Buffer != null && globalThis.Buffer.from != null) {\n return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__.asUint8Array)(globalThis.Buffer.from(string, 'utf-8'));\n }\n return base.decoder.decode(`${ base.prefix }${ string }`);\n}\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/uint8arrays/esm/src/from-string.js?"); - -/***/ }), - -/***/ "./node_modules/uint8arrays/esm/src/index.js": -/*!***************************************************!*\ - !*** ./node_modules/uint8arrays/esm/src/index.js ***! - \***************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ compare: () => (/* reexport safe */ _compare_js__WEBPACK_IMPORTED_MODULE_0__.compare),\n/* harmony export */ concat: () => (/* reexport safe */ _concat_js__WEBPACK_IMPORTED_MODULE_1__.concat),\n/* harmony export */ equals: () => (/* reexport safe */ _equals_js__WEBPACK_IMPORTED_MODULE_2__.equals),\n/* harmony export */ fromString: () => (/* reexport safe */ _from_string_js__WEBPACK_IMPORTED_MODULE_3__.fromString),\n/* harmony export */ toString: () => (/* reexport safe */ _to_string_js__WEBPACK_IMPORTED_MODULE_4__.toString),\n/* harmony export */ xor: () => (/* reexport safe */ _xor_js__WEBPACK_IMPORTED_MODULE_5__.xor)\n/* harmony export */ });\n/* harmony import */ var _compare_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./compare.js */ \"./node_modules/uint8arrays/esm/src/compare.js\");\n/* harmony import */ var _concat_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./concat.js */ \"./node_modules/uint8arrays/esm/src/concat.js\");\n/* harmony import */ var _equals_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./equals.js */ \"./node_modules/uint8arrays/esm/src/equals.js\");\n/* harmony import */ var _from_string_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./from-string.js */ \"./node_modules/uint8arrays/esm/src/from-string.js\");\n/* harmony import */ var _to_string_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./to-string.js */ \"./node_modules/uint8arrays/esm/src/to-string.js\");\n/* harmony import */ var _xor_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./xor.js */ \"./node_modules/uint8arrays/esm/src/xor.js\");\n\n\n\n\n\n\n\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/uint8arrays/esm/src/index.js?"); - -/***/ }), - -/***/ "./node_modules/uint8arrays/esm/src/to-string.js": -/*!*******************************************************!*\ - !*** ./node_modules/uint8arrays/esm/src/to-string.js ***! - \*******************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/* harmony import */ var _util_bases_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/bases.js */ \"./node_modules/uint8arrays/esm/src/util/bases.js\");\n\nfunction toString(array, encoding = 'utf8') {\n const base = _util_bases_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"][encoding];\n if (!base) {\n throw new Error(`Unsupported encoding \"${ encoding }\"`);\n }\n if ((encoding === 'utf8' || encoding === 'utf-8') && globalThis.Buffer != null && globalThis.Buffer.from != null) {\n return globalThis.Buffer.from(array.buffer, array.byteOffset, array.byteLength).toString('utf8');\n }\n return base.encoder.encode(array).substring(1);\n}\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/uint8arrays/esm/src/to-string.js?"); - -/***/ }), - -/***/ "./node_modules/uint8arrays/esm/src/util/as-uint8array.js": -/*!****************************************************************!*\ - !*** ./node_modules/uint8arrays/esm/src/util/as-uint8array.js ***! - \****************************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ asUint8Array: () => (/* binding */ asUint8Array)\n/* harmony export */ });\nfunction asUint8Array(buf) {\n if (globalThis.Buffer != null) {\n return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);\n }\n return buf;\n}\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/uint8arrays/esm/src/util/as-uint8array.js?"); - -/***/ }), - -/***/ "./node_modules/uint8arrays/esm/src/util/bases.js": -/*!********************************************************!*\ - !*** ./node_modules/uint8arrays/esm/src/util/bases.js ***! - \********************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var multiformats_basics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! multiformats/basics */ \"./node_modules/multiformats/esm/src/basics.js\");\n/* harmony import */ var _alloc_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../alloc.js */ \"./node_modules/uint8arrays/esm/src/alloc.js\");\n\n\nfunction createCodec(name, prefix, encode, decode) {\n return {\n name,\n prefix,\n encoder: {\n name,\n prefix,\n encode\n },\n decoder: { decode }\n };\n}\nconst string = createCodec('utf8', 'u', buf => {\n const decoder = new TextDecoder('utf8');\n return 'u' + decoder.decode(buf);\n}, str => {\n const encoder = new TextEncoder();\n return encoder.encode(str.substring(1));\n});\nconst ascii = createCodec('ascii', 'a', buf => {\n let string = 'a';\n for (let i = 0; i < buf.length; i++) {\n string += String.fromCharCode(buf[i]);\n }\n return string;\n}, str => {\n str = str.substring(1);\n const buf = (0,_alloc_js__WEBPACK_IMPORTED_MODULE_1__.allocUnsafe)(str.length);\n for (let i = 0; i < str.length; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n});\nconst BASES = {\n utf8: string,\n 'utf-8': string,\n hex: multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases.base16,\n latin1: ascii,\n ascii: ascii,\n binary: ascii,\n ...multiformats_basics__WEBPACK_IMPORTED_MODULE_0__.bases\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BASES);\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/uint8arrays/esm/src/util/bases.js?"); - -/***/ }), - -/***/ "./node_modules/uint8arrays/esm/src/xor.js": -/*!*************************************************!*\ - !*** ./node_modules/uint8arrays/esm/src/xor.js ***! - \*************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ xor: () => (/* binding */ xor)\n/* harmony export */ });\n/* harmony import */ var _alloc_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./alloc.js */ \"./node_modules/uint8arrays/esm/src/alloc.js\");\n/* harmony import */ var _util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util/as-uint8array.js */ \"./node_modules/uint8arrays/esm/src/util/as-uint8array.js\");\n\n\nfunction xor(a, b) {\n if (a.length !== b.length) {\n throw new Error('Inputs should have the same length');\n }\n const result = (0,_alloc_js__WEBPACK_IMPORTED_MODULE_0__.allocUnsafe)(a.length);\n for (let i = 0; i < a.length; i++) {\n result[i] = a[i] ^ b[i];\n }\n return (0,_util_as_uint8array_js__WEBPACK_IMPORTED_MODULE_1__.asUint8Array)(result);\n}\n\n//# sourceURL=webpack://wallet_connect_integration/./node_modules/uint8arrays/esm/src/xor.js?"); - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ id: moduleId, -/******/ loaded: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.loaded = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/amd options */ -/******/ (() => { -/******/ __webpack_require__.amdO = {}; -/******/ })(); -/******/ -/******/ /* webpack/runtime/compat get default export */ -/******/ (() => { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = (module) => { -/******/ var getter = module && module.__esModule ? -/******/ () => (module['default']) : -/******/ () => (module); -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/global */ -/******/ (() => { -/******/ __webpack_require__.g = (function() { -/******/ if (typeof globalThis === 'object') return globalThis; -/******/ try { -/******/ return this || new Function('return this')(); -/******/ } catch (e) { -/******/ if (typeof window === 'object') return window; -/******/ } -/******/ })(); -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/node module decorator */ -/******/ (() => { -/******/ __webpack_require__.nmd = (module) => { -/******/ module.paths = []; -/******/ if (!module.children) module.children = []; -/******/ return module; -/******/ }; -/******/ })(); -/******/ -/************************************************************************/ -/******/ -/******/ // startup -/******/ // Load entry module and return exports -/******/ // This entry module can't be inlined because the eval devtool is used. -/******/ var __webpack_exports__ = __webpack_require__("./src/index.js"); -/******/ +/*! For license information please see bundle.js.LICENSE.txt */ +var e={8099:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var i=r(7117);function n(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>8,t[r+1]=e>>>0,t}function s(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t}function o(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function a(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function h(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function c(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function u(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>24,t[r+1]=e>>>16,t[r+2]=e>>>8,t[r+3]=e>>>0,t}function l(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,t}function f(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),u(e/4294967296>>>0,t,r),u(e>>>0,t,r+4),t}function d(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),l(e>>>0,t,r),l(e/4294967296>>>0,t,r+4),t}t.readInt16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16},t.readUint16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0},t.readInt16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16},t.readUint16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0},t.writeUint16BE=n,t.writeInt16BE=n,t.writeUint16LE=s,t.writeInt16LE=s,t.readInt32BE=o,t.readUint32BE=a,t.readInt32LE=h,t.readUint32LE=c,t.writeUint32BE=u,t.writeInt32BE=u,t.writeUint32LE=l,t.writeInt32LE=l,t.readInt64BE=function(e,t){void 0===t&&(t=0);var r=o(e,t),i=o(e,t+4);return 4294967296*r+i-4294967296*(i>>31)},t.readUint64BE=function(e,t){return void 0===t&&(t=0),4294967296*a(e,t)+a(e,t+4)},t.readInt64LE=function(e,t){void 0===t&&(t=0);var r=h(e,t);return 4294967296*h(e,t+4)+r-4294967296*(r>>31)},t.readUint64LE=function(e,t){void 0===t&&(t=0);var r=c(e,t);return 4294967296*c(e,t+4)+r},t.writeUint64BE=f,t.writeInt64BE=f,t.writeUint64LE=d,t.writeInt64LE=d,t.readUintBE=function(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,n=1,s=e/8+r-1;s>=r;s--)i+=t[s]*n,n*=256;return i},t.readUintLE=function(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,n=1,s=r;s=n;o--)r[o]=t/s&255,s*=256;return r},t.writeUintLE=function(e,t,r,n){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===n&&(n=0),e%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!i.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var s=1,o=n;o{Object.defineProperty(t,"__esModule",{value:!0});var i=r(8099),n=r(7309),s=20;function o(e,t,r){for(var n=1634760805,o=857760878,a=2036477234,h=1797285236,c=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],f=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],p=r[23]<<24|r[22]<<16|r[21]<<8|r[20],g=r[27]<<24|r[26]<<16|r[25]<<8|r[24],y=r[31]<<24|r[30]<<16|r[29]<<8|r[28],m=t[3]<<24|t[2]<<16|t[1]<<8|t[0],v=t[7]<<24|t[6]<<16|t[5]<<8|t[4],w=t[11]<<24|t[10]<<16|t[9]<<8|t[8],b=t[15]<<24|t[14]<<16|t[13]<<8|t[12],_=n,E=o,S=a,I=h,M=c,A=u,O=l,x=f,P=d,N=p,R=g,T=y,L=m,C=v,U=w,j=b,k=0;k>>16|L<<16)|0)>>>20|M<<12,A=(A^=N=N+(C=(C^=E=E+A|0)>>>16|C<<16)|0)>>>20|A<<12,O=(O^=R=R+(U=(U^=S=S+O|0)>>>16|U<<16)|0)>>>20|O<<12,x=(x^=T=T+(j=(j^=I=I+x|0)>>>16|j<<16)|0)>>>20|x<<12,O=(O^=R=R+(U=(U^=S=S+O|0)>>>24|U<<8)|0)>>>25|O<<7,x=(x^=T=T+(j=(j^=I=I+x|0)>>>24|j<<8)|0)>>>25|x<<7,A=(A^=N=N+(C=(C^=E=E+A|0)>>>24|C<<8)|0)>>>25|A<<7,M=(M^=P=P+(L=(L^=_=_+M|0)>>>24|L<<8)|0)>>>25|M<<7,A=(A^=R=R+(j=(j^=_=_+A|0)>>>16|j<<16)|0)>>>20|A<<12,O=(O^=T=T+(L=(L^=E=E+O|0)>>>16|L<<16)|0)>>>20|O<<12,x=(x^=P=P+(C=(C^=S=S+x|0)>>>16|C<<16)|0)>>>20|x<<12,M=(M^=N=N+(U=(U^=I=I+M|0)>>>16|U<<16)|0)>>>20|M<<12,x=(x^=P=P+(C=(C^=S=S+x|0)>>>24|C<<8)|0)>>>25|x<<7,M=(M^=N=N+(U=(U^=I=I+M|0)>>>24|U<<8)|0)>>>25|M<<7,O=(O^=T=T+(L=(L^=E=E+O|0)>>>24|L<<8)|0)>>>25|O<<7,A=(A^=R=R+(j=(j^=_=_+A|0)>>>24|j<<8)|0)>>>25|A<<7;i.writeUint32LE(_+n|0,e,0),i.writeUint32LE(E+o|0,e,4),i.writeUint32LE(S+a|0,e,8),i.writeUint32LE(I+h|0,e,12),i.writeUint32LE(M+c|0,e,16),i.writeUint32LE(A+u|0,e,20),i.writeUint32LE(O+l|0,e,24),i.writeUint32LE(x+f|0,e,28),i.writeUint32LE(P+d|0,e,32),i.writeUint32LE(N+p|0,e,36),i.writeUint32LE(R+g|0,e,40),i.writeUint32LE(T+y|0,e,44),i.writeUint32LE(L+m|0,e,48),i.writeUint32LE(C+v|0,e,52),i.writeUint32LE(U+w|0,e,56),i.writeUint32LE(j+b|0,e,60)}function a(e,t,r,i,s){if(void 0===s&&(s=0),32!==e.length)throw new Error("ChaCha: key size must be 32 bytes");if(i.length>>=8,t++;if(i>0)throw new Error("ChaCha: counter overflow")}t.streamXOR=a,t.stream=function(e,t,r,i){return void 0===i&&(i=0),n.wipe(r),a(e,t,r,r,i)}},5501:(e,t,r)=>{var i=r(5439),n=r(3027),s=r(7309),o=r(8099),a=r(4153);t.Cv=32,t.WH=12,t.pg=16;var h=new Uint8Array(16),c=function(){function e(e){if(this.nonceLength=t.WH,this.tagLength=t.pg,e.length!==t.Cv)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return e.prototype.seal=function(e,t,r,n){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var o=new Uint8Array(16);o.set(e,o.length-e.length);var a=new Uint8Array(32);i.stream(this._key,o,a,4);var h,c=t.length+this.tagLength;if(n){if(n.length!==c)throw new Error("ChaCha20Poly1305: incorrect destination length");h=n}else h=new Uint8Array(c);return i.streamXOR(this._key,o,t,h,4),this._authenticate(h.subarray(h.length-this.tagLength,h.length),a,h.subarray(0,h.length-this.tagLength),r),s.wipe(o),h},e.prototype.open=function(e,t,r,n){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length0&&a.update(h.subarray(i.length%16))),a.update(r),r.length%16>0&&a.update(h.subarray(r.length%16));var c=new Uint8Array(8);i&&o.writeUint64LE(i.length,c),a.update(c),o.writeUint64LE(r.length,c),a.update(c);for(var u=a.digest(),l=0;l{function r(e,t){if(e.length!==t.length)return 0;for(var r=0,i=0;i>>8}Object.defineProperty(t,"__esModule",{value:!0}),t.select=function(e,t,r){return~(e-1)&t|e-1&r},t.lessOrEqual=function(e,t){return(0|e)-(0|t)-1>>>31&1},t.compare=r,t.equal=function(e,t){return 0!==e.length&&0!==t.length&&0!==r(e,t)}},1050:(e,t,r)=>{t.Xx=t._w=t.aP=t.KS=t.jQ=void 0;r(1416);const i=r(3350);r(7309);function n(e){const t=new Float64Array(16);if(e)for(let r=0;r>16&1),r[e-1]&=65535;r[15]=i[15]-32767-(r[14]>>16&1);const e=r[15]>>16&1;r[14]&=65535,f(i,r,1-e)}for(let t=0;t<16;t++)e[2*t]=255&i[t],e[2*t+1]=i[t]>>8}function p(e){const t=new Uint8Array(32);return d(t,e),1&t[0]}function g(e,t,r){for(let i=0;i<16;i++)e[i]=t[i]+r[i]}function y(e,t,r){for(let i=0;i<16;i++)e[i]=t[i]-r[i]}function m(e,t,r){let i,n,s=0,o=0,a=0,h=0,c=0,u=0,l=0,f=0,d=0,p=0,g=0,y=0,m=0,v=0,w=0,b=0,_=0,E=0,S=0,I=0,M=0,A=0,O=0,x=0,P=0,N=0,R=0,T=0,L=0,C=0,U=0,j=r[0],k=r[1],q=r[2],D=r[3],z=r[4],$=r[5],B=r[6],K=r[7],F=r[8],V=r[9],H=r[10],W=r[11],G=r[12],J=r[13],Y=r[14],X=r[15];i=t[0],s+=i*j,o+=i*k,a+=i*q,h+=i*D,c+=i*z,u+=i*$,l+=i*B,f+=i*K,d+=i*F,p+=i*V,g+=i*H,y+=i*W,m+=i*G,v+=i*J,w+=i*Y,b+=i*X,i=t[1],o+=i*j,a+=i*k,h+=i*q,c+=i*D,u+=i*z,l+=i*$,f+=i*B,d+=i*K,p+=i*F,g+=i*V,y+=i*H,m+=i*W,v+=i*G,w+=i*J,b+=i*Y,_+=i*X,i=t[2],a+=i*j,h+=i*k,c+=i*q,u+=i*D,l+=i*z,f+=i*$,d+=i*B,p+=i*K,g+=i*F,y+=i*V,m+=i*H,v+=i*W,w+=i*G,b+=i*J,_+=i*Y,E+=i*X,i=t[3],h+=i*j,c+=i*k,u+=i*q,l+=i*D,f+=i*z,d+=i*$,p+=i*B,g+=i*K,y+=i*F,m+=i*V,v+=i*H,w+=i*W,b+=i*G,_+=i*J,E+=i*Y,S+=i*X,i=t[4],c+=i*j,u+=i*k,l+=i*q,f+=i*D,d+=i*z,p+=i*$,g+=i*B,y+=i*K,m+=i*F,v+=i*V,w+=i*H,b+=i*W,_+=i*G,E+=i*J,S+=i*Y,I+=i*X,i=t[5],u+=i*j,l+=i*k,f+=i*q,d+=i*D,p+=i*z,g+=i*$,y+=i*B,m+=i*K,v+=i*F,w+=i*V,b+=i*H,_+=i*W,E+=i*G,S+=i*J,I+=i*Y,M+=i*X,i=t[6],l+=i*j,f+=i*k,d+=i*q,p+=i*D,g+=i*z,y+=i*$,m+=i*B,v+=i*K,w+=i*F,b+=i*V,_+=i*H,E+=i*W,S+=i*G,I+=i*J,M+=i*Y,A+=i*X,i=t[7],f+=i*j,d+=i*k,p+=i*q,g+=i*D,y+=i*z,m+=i*$,v+=i*B,w+=i*K,b+=i*F,_+=i*V,E+=i*H,S+=i*W,I+=i*G,M+=i*J,A+=i*Y,O+=i*X,i=t[8],d+=i*j,p+=i*k,g+=i*q,y+=i*D,m+=i*z,v+=i*$,w+=i*B,b+=i*K,_+=i*F,E+=i*V,S+=i*H,I+=i*W,M+=i*G,A+=i*J,O+=i*Y,x+=i*X,i=t[9],p+=i*j,g+=i*k,y+=i*q,m+=i*D,v+=i*z,w+=i*$,b+=i*B,_+=i*K,E+=i*F,S+=i*V,I+=i*H,M+=i*W,A+=i*G,O+=i*J,x+=i*Y,P+=i*X,i=t[10],g+=i*j,y+=i*k,m+=i*q,v+=i*D,w+=i*z,b+=i*$,_+=i*B,E+=i*K,S+=i*F,I+=i*V,M+=i*H,A+=i*W,O+=i*G,x+=i*J,P+=i*Y,N+=i*X,i=t[11],y+=i*j,m+=i*k,v+=i*q,w+=i*D,b+=i*z,_+=i*$,E+=i*B,S+=i*K,I+=i*F,M+=i*V,A+=i*H,O+=i*W,x+=i*G,P+=i*J,N+=i*Y,R+=i*X,i=t[12],m+=i*j,v+=i*k,w+=i*q,b+=i*D,_+=i*z,E+=i*$,S+=i*B,I+=i*K,M+=i*F,A+=i*V,O+=i*H,x+=i*W,P+=i*G,N+=i*J,R+=i*Y,T+=i*X,i=t[13],v+=i*j,w+=i*k,b+=i*q,_+=i*D,E+=i*z,S+=i*$,I+=i*B,M+=i*K,A+=i*F,O+=i*V,x+=i*H,P+=i*W,N+=i*G,R+=i*J,T+=i*Y,L+=i*X,i=t[14],w+=i*j,b+=i*k,_+=i*q,E+=i*D,S+=i*z,I+=i*$,M+=i*B,A+=i*K,O+=i*F,x+=i*V,P+=i*H,N+=i*W,R+=i*G,T+=i*J,L+=i*Y,C+=i*X,i=t[15],b+=i*j,_+=i*k,E+=i*q,S+=i*D,I+=i*z,M+=i*$,A+=i*B,O+=i*K,x+=i*F,P+=i*V,N+=i*H,R+=i*W,T+=i*G,L+=i*J,C+=i*Y,U+=i*X,s+=38*_,o+=38*E,a+=38*S,h+=38*I,c+=38*M,u+=38*A,l+=38*O,f+=38*x,d+=38*P,p+=38*N,g+=38*R,y+=38*T,m+=38*L,v+=38*C,w+=38*U,n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-65536*n,i=o+n+65535,n=Math.floor(i/65536),o=i-65536*n,i=a+n+65535,n=Math.floor(i/65536),a=i-65536*n,i=h+n+65535,n=Math.floor(i/65536),h=i-65536*n,i=c+n+65535,n=Math.floor(i/65536),c=i-65536*n,i=u+n+65535,n=Math.floor(i/65536),u=i-65536*n,i=l+n+65535,n=Math.floor(i/65536),l=i-65536*n,i=f+n+65535,n=Math.floor(i/65536),f=i-65536*n,i=d+n+65535,n=Math.floor(i/65536),d=i-65536*n,i=p+n+65535,n=Math.floor(i/65536),p=i-65536*n,i=g+n+65535,n=Math.floor(i/65536),g=i-65536*n,i=y+n+65535,n=Math.floor(i/65536),y=i-65536*n,i=m+n+65535,n=Math.floor(i/65536),m=i-65536*n,i=v+n+65535,n=Math.floor(i/65536),v=i-65536*n,i=w+n+65535,n=Math.floor(i/65536),w=i-65536*n,i=b+n+65535,n=Math.floor(i/65536),b=i-65536*n,s+=n-1+37*(n-1),n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-65536*n,i=o+n+65535,n=Math.floor(i/65536),o=i-65536*n,i=a+n+65535,n=Math.floor(i/65536),a=i-65536*n,i=h+n+65535,n=Math.floor(i/65536),h=i-65536*n,i=c+n+65535,n=Math.floor(i/65536),c=i-65536*n,i=u+n+65535,n=Math.floor(i/65536),u=i-65536*n,i=l+n+65535,n=Math.floor(i/65536),l=i-65536*n,i=f+n+65535,n=Math.floor(i/65536),f=i-65536*n,i=d+n+65535,n=Math.floor(i/65536),d=i-65536*n,i=p+n+65535,n=Math.floor(i/65536),p=i-65536*n,i=g+n+65535,n=Math.floor(i/65536),g=i-65536*n,i=y+n+65535,n=Math.floor(i/65536),y=i-65536*n,i=m+n+65535,n=Math.floor(i/65536),m=i-65536*n,i=v+n+65535,n=Math.floor(i/65536),v=i-65536*n,i=w+n+65535,n=Math.floor(i/65536),w=i-65536*n,i=b+n+65535,n=Math.floor(i/65536),b=i-65536*n,s+=n-1+37*(n-1),e[0]=s,e[1]=o,e[2]=a,e[3]=h,e[4]=c,e[5]=u,e[6]=l,e[7]=f,e[8]=d,e[9]=p,e[10]=g,e[11]=y,e[12]=m,e[13]=v,e[14]=w,e[15]=b}function v(e,t){m(e,t,t)}function w(e,t){const r=n(),i=n(),s=n(),o=n(),h=n(),c=n(),u=n(),l=n(),f=n();y(r,e[1],e[0]),y(f,t[1],t[0]),m(r,r,f),g(i,e[0],e[1]),g(f,t[0],t[1]),m(i,i,f),m(s,e[3],t[3]),m(s,s,a),m(o,e[2],t[2]),g(o,o,o),y(h,i,r),y(c,o,s),g(u,o,s),g(l,i,r),m(e[0],h,c),m(e[1],l,u),m(e[2],u,c),m(e[3],h,l)}function b(e,t,r){for(let i=0;i<4;i++)f(e[i],t[i],r)}function _(e,t){const r=n(),i=n(),s=n();(function(e,t){const r=n();let i;for(i=0;i<16;i++)r[i]=t[i];for(i=253;i>=0;i--)v(r,r),2!==i&&4!==i&&m(r,r,t);for(i=0;i<16;i++)e[i]=r[i]})(s,t[2]),m(r,t[0],s),m(i,t[1],s),d(e,i),e[31]^=p(r)<<7}function E(e,t){const r=[n(),n(),n(),n()];u(r[0],h),u(r[1],c),u(r[2],o),m(r[3],h,c),function(e,t,r){u(e[0],s),u(e[1],o),u(e[2],o),u(e[3],s);for(let i=255;i>=0;--i){const n=r[i/8|0]>>(7&i)&1;b(e,t,n),w(t,e),w(e,e),b(e,t,n)}}(e,r,t)}t._w=function(e){if(e.length!==t.aP)throw new Error(`ed25519: seed must be ${t.aP} bytes`);const r=(0,i.hash)(e);r[0]&=248,r[31]&=127,r[31]|=64;const s=new Uint8Array(32),o=[n(),n(),n(),n()];E(o,r),_(s,o);const a=new Uint8Array(64);return a.set(e),a.set(s,32),{publicKey:s,secretKey:a}};const S=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function I(e,t){let r,i,n,s;for(i=63;i>=32;--i){for(r=0,n=i-32,s=i-12;n>4)*S[n],r=t[n]>>8,t[n]&=255;for(n=0;n<32;n++)t[n]-=r*S[n];for(i=0;i<32;i++)t[i+1]+=t[i]>>8,e[i]=255&t[i]}function M(e){const t=new Float64Array(64);for(let r=0;r<64;r++)t[r]=e[r];for(let t=0;t<64;t++)e[t]=0;I(e,t)}t.Xx=function(e,t){const r=new Float64Array(64),s=[n(),n(),n(),n()],o=(0,i.hash)(e.subarray(0,32));o[0]&=248,o[31]&=127,o[31]|=64;const a=new Uint8Array(64);a.set(o.subarray(32),32);const h=new i.SHA512;h.update(a.subarray(32)),h.update(t);const c=h.digest();h.clean(),M(c),E(s,c),_(a,s),h.reset(),h.update(a.subarray(0,32)),h.update(e.subarray(32)),h.update(t);const u=h.digest();M(u);for(let e=0;e<32;e++)r[e]=c[e];for(let e=0;e<32;e++)for(let t=0;t<32;t++)r[e+t]+=u[e]*o[t];return I(a.subarray(32),r),a}},9984:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isSerializableHash=function(e){return void 0!==e.saveState&&void 0!==e.restoreState&&void 0!==e.cleanSavedState}},512:(e,t,r)=>{var i=r(5629),n=r(7309),s=function(){function e(e,t,r,n){void 0===r&&(r=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=n;var s=i.hmac(this._hash,r,t);this._hmac=new i.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(0===e)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(e){for(var t=new Uint8Array(e),r=0;r{Object.defineProperty(t,"__esModule",{value:!0});var i=r(9984),n=r(4153),s=r(7309),o=function(){function e(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var r=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(r).clean():r.set(t);for(var n=0;n{Object.defineProperty(t,"__esModule",{value:!0}),t.mul=Math.imul||function(e,t){var r=65535&e,i=65535&t;return r*i+((e>>>16&65535)*i+r*(t>>>16&65535)<<16>>>0)|0},t.add=function(e,t){return e+t|0},t.sub=function(e,t){return e-t|0},t.rotl=function(e,t){return e<>>32-t},t.rotr=function(e,t){return e<<32-t|e>>>t},t.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(e){return t.isInteger(e)&&e>=-t.MAX_SAFE_INTEGER&&e<=t.MAX_SAFE_INTEGER}},3027:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var i=r(4153),n=r(7309);t.DIGEST_LENGTH=16;var s=function(){function e(e){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=8191&r;var i=e[2]|e[3]<<8;this._r[1]=8191&(r>>>13|i<<3);var n=e[4]|e[5]<<8;this._r[2]=7939&(i>>>10|n<<6);var s=e[6]|e[7]<<8;this._r[3]=8191&(n>>>7|s<<9);var o=e[8]|e[9]<<8;this._r[4]=255&(s>>>4|o<<12),this._r[5]=o>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=8191&(o>>>14|a<<2);var h=e[12]|e[13]<<8;this._r[7]=8065&(a>>>11|h<<5);var c=e[14]|e[15]<<8;this._r[8]=8191&(h>>>8|c<<8),this._r[9]=c>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return e.prototype._blocks=function(e,t,r){for(var i=this._fin?0:2048,n=this._h[0],s=this._h[1],o=this._h[2],a=this._h[3],h=this._h[4],c=this._h[5],u=this._h[6],l=this._h[7],f=this._h[8],d=this._h[9],p=this._r[0],g=this._r[1],y=this._r[2],m=this._r[3],v=this._r[4],w=this._r[5],b=this._r[6],_=this._r[7],E=this._r[8],S=this._r[9];r>=16;){var I=e[t+0]|e[t+1]<<8;n+=8191&I;var M=e[t+2]|e[t+3]<<8;s+=8191&(I>>>13|M<<3);var A=e[t+4]|e[t+5]<<8;o+=8191&(M>>>10|A<<6);var O=e[t+6]|e[t+7]<<8;a+=8191&(A>>>7|O<<9);var x=e[t+8]|e[t+9]<<8;h+=8191&(O>>>4|x<<12),c+=x>>>1&8191;var P=e[t+10]|e[t+11]<<8;u+=8191&(x>>>14|P<<2);var N=e[t+12]|e[t+13]<<8;l+=8191&(P>>>11|N<<5);var R=e[t+14]|e[t+15]<<8,T=0,L=T;L+=n*p,L+=s*(5*S),L+=o*(5*E),L+=a*(5*_),T=(L+=h*(5*b))>>>13,L&=8191,L+=c*(5*w),L+=u*(5*v),L+=l*(5*m),L+=(f+=8191&(N>>>8|R<<8))*(5*y);var C=T+=(L+=(d+=R>>>5|i)*(5*g))>>>13;C+=n*g,C+=s*p,C+=o*(5*S),C+=a*(5*E),T=(C+=h*(5*_))>>>13,C&=8191,C+=c*(5*b),C+=u*(5*w),C+=l*(5*v),C+=f*(5*m),T+=(C+=d*(5*y))>>>13,C&=8191;var U=T;U+=n*y,U+=s*g,U+=o*p,U+=a*(5*S),T=(U+=h*(5*E))>>>13,U&=8191,U+=c*(5*_),U+=u*(5*b),U+=l*(5*w),U+=f*(5*v);var j=T+=(U+=d*(5*m))>>>13;j+=n*m,j+=s*y,j+=o*g,j+=a*p,T=(j+=h*(5*S))>>>13,j&=8191,j+=c*(5*E),j+=u*(5*_),j+=l*(5*b),j+=f*(5*w);var k=T+=(j+=d*(5*v))>>>13;k+=n*v,k+=s*m,k+=o*y,k+=a*g,T=(k+=h*p)>>>13,k&=8191,k+=c*(5*S),k+=u*(5*E),k+=l*(5*_),k+=f*(5*b);var q=T+=(k+=d*(5*w))>>>13;q+=n*w,q+=s*v,q+=o*m,q+=a*y,T=(q+=h*g)>>>13,q&=8191,q+=c*p,q+=u*(5*S),q+=l*(5*E),q+=f*(5*_);var D=T+=(q+=d*(5*b))>>>13;D+=n*b,D+=s*w,D+=o*v,D+=a*m,T=(D+=h*y)>>>13,D&=8191,D+=c*g,D+=u*p,D+=l*(5*S),D+=f*(5*E);var z=T+=(D+=d*(5*_))>>>13;z+=n*_,z+=s*b,z+=o*w,z+=a*v,T=(z+=h*m)>>>13,z&=8191,z+=c*y,z+=u*g,z+=l*p,z+=f*(5*S);var $=T+=(z+=d*(5*E))>>>13;$+=n*E,$+=s*_,$+=o*b,$+=a*w,T=($+=h*v)>>>13,$&=8191,$+=c*m,$+=u*y,$+=l*g,$+=f*p;var B=T+=($+=d*(5*S))>>>13;B+=n*S,B+=s*E,B+=o*_,B+=a*b,T=(B+=h*w)>>>13,B&=8191,B+=c*v,B+=u*m,B+=l*y,B+=f*g,n=L=8191&(T=(T=((T+=(B+=d*p)>>>13)<<2)+T|0)+(L&=8191)|0),s=C+=T>>>=13,o=U&=8191,a=j&=8191,h=k&=8191,c=q&=8191,u=D&=8191,l=z&=8191,f=$&=8191,d=B&=8191,t+=16,r-=16}this._h[0]=n,this._h[1]=s,this._h[2]=o,this._h[3]=a,this._h[4]=h,this._h[5]=c,this._h[6]=u,this._h[7]=l,this._h[8]=f,this._h[9]=d},e.prototype.finish=function(e,t){void 0===t&&(t=0);var r,i,n,s,o=new Uint16Array(10);if(this._leftover){for(s=this._leftover,this._buffer[s++]=1;s<16;s++)this._buffer[s]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(r=this._h[1]>>>13,this._h[1]&=8191,s=2;s<10;s++)this._h[s]+=r,r=this._h[s]>>>13,this._h[s]&=8191;for(this._h[0]+=5*r,r=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=r,r=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=r,o[0]=this._h[0]+5,r=o[0]>>>13,o[0]&=8191,s=1;s<10;s++)o[s]=this._h[s]+r,r=o[s]>>>13,o[s]&=8191;for(o[9]-=8192,i=(1^r)-1,s=0;s<10;s++)o[s]&=i;for(i=~i,s=0;s<10;s++)this._h[s]=this._h[s]&i|o[s];for(this._h[0]=65535&(this._h[0]|this._h[1]<<13),this._h[1]=65535&(this._h[1]>>>3|this._h[2]<<10),this._h[2]=65535&(this._h[2]>>>6|this._h[3]<<7),this._h[3]=65535&(this._h[3]>>>9|this._h[4]<<4),this._h[4]=65535&(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14),this._h[5]=65535&(this._h[6]>>>2|this._h[7]<<11),this._h[6]=65535&(this._h[7]>>>5|this._h[8]<<8),this._h[7]=65535&(this._h[8]>>>8|this._h[9]<<5),n=this._h[0]+this._pad[0],this._h[0]=65535&n,s=1;s<8;s++)n=(this._h[s]+this._pad[s]|0)+(n>>>16)|0,this._h[s]=65535&n;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},e.prototype.update=function(e){var t,r=0,i=e.length;if(this._leftover){(t=16-this._leftover)>i&&(t=i);for(var n=0;n=16&&(t=i-i%16,this._blocks(e,r,t),r+=t,i-=t),i){for(n=0;n{Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const i=r(6008),n=r(8099),s=r(7309);function o(e,r=t.defaultRandomSource){return r.randomBytes(e)}t.defaultRandomSource=new i.SystemRandomSource,t.randomBytes=o,t.randomUint32=function(e=t.defaultRandomSource){const r=o(4,e),i=(0,n.readUint32LE)(r);return(0,s.wipe)(r),i};const a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function h(e,r=a,i=t.defaultRandomSource){if(r.length<2)throw new Error("randomString charset is too short");if(r.length>256)throw new Error("randomString charset is too long");let n="";const h=r.length,c=256-256%h;for(;e>0;){const t=o(Math.ceil(256*e/c),i);for(let i=0;i0;i++){const s=t[i];s{Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserRandomSource=void 0,t.BrowserRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e="undefined"!=typeof self?self.crypto||self.msCrypto:null;e&&void 0!==e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let e=0;e{Object.defineProperty(t,"__esModule",{value:!0}),t.NodeRandomSource=void 0;const i=r(7309);t.NodeRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;{const e=r(5883);e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const r=new Uint8Array(e);for(let e=0;e{Object.defineProperty(t,"__esModule",{value:!0}),t.SystemRandomSource=void 0;const i=r(5455),n=r(8871);t.SystemRandomSource=class{constructor(){return this.isAvailable=!1,this.name="",this._source=new i.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new n.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}},3294:(e,t,r)=>{var i=r(8099),n=r(7309);t.k=32,t.cn=64;var s=function(){function e(){this.digestLength=t.k,this.blockSize=t.cn,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return e.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},e.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},e.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._temp),this.reset()},e.prototype.update=function(e,t){if(void 0===t&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var r=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[r++],t--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(r=a(this._temp,this._state,e,r,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[r++],t--;return this},e.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,r=this._bufferLength,n=t/536870912|0,s=t<<3,o=t%64<56?64:128;this._buffer[r]=128;for(var h=r+1;h0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},e.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},e.prototype.cleanSavedState=function(e){n.wipe(e.state),e.buffer&&n.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},e}();t.mE=s;var o=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function a(e,t,r,n,s){for(;s>=64;){for(var a=t[0],h=t[1],c=t[2],u=t[3],l=t[4],f=t[5],d=t[6],p=t[7],g=0;g<16;g++){var y=n+4*g;e[g]=i.readUint32BE(r,y)}for(g=16;g<64;g++){var m=e[g-2],v=(m>>>17|m<<15)^(m>>>19|m<<13)^m>>>10,w=((m=e[g-15])>>>7|m<<25)^(m>>>18|m<<14)^m>>>3;e[g]=(v+e[g-7]|0)+(w+e[g-16]|0)}for(g=0;g<64;g++)v=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&f^~l&d)|0)+(p+(o[g]+e[g]|0)|0)|0,w=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&h^a&c^h&c)|0,p=d,d=f,f=l,l=u+v|0,u=c,c=h,h=a,a=v+w|0;t[0]+=a,t[1]+=h,t[2]+=c,t[3]+=u,t[4]+=l,t[5]+=f,t[6]+=d,t[7]+=p,n+=64,s-=64}return n}t.vp=function(e){var t=new s;t.update(e);var r=t.digest();return t.clean(),r}},3350:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var i=r(8099),n=r(7309);t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var s=function(){function e(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return e.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},e.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},e.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._tempHi),n.wipe(this._tempLo),this.reset()},e.prototype.update=function(e,r){if(void 0===r&&(r=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var i=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[i++],r--;this._bufferLength===this.blockSize&&(a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(i=a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,i,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[i++],r--;return this},e.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,r=this._bufferLength,n=t/536870912|0,s=t<<3,o=t%128<112?128:256;this._buffer[r]=128;for(var h=r+1;h0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},e.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},e.prototype.cleanSavedState=function(e){n.wipe(e.stateHi),n.wipe(e.stateLo),e.buffer&&n.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},e}();t.SHA512=s;var o=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function a(e,t,r,n,s,a,h){for(var c,u,l,f,d,p,g,y,m=r[0],v=r[1],w=r[2],b=r[3],_=r[4],E=r[5],S=r[6],I=r[7],M=n[0],A=n[1],O=n[2],x=n[3],P=n[4],N=n[5],R=n[6],T=n[7];h>=128;){for(var L=0;L<16;L++){var C=8*L+a;e[L]=i.readUint32BE(s,C),t[L]=i.readUint32BE(s,C+4)}for(L=0;L<80;L++){var U,j,k=m,q=v,D=w,z=b,$=_,B=E,K=S,F=M,V=A,H=O,W=x,G=P,J=N,Y=R;if(d=65535&(u=T),p=u>>>16,g=65535&(c=I),y=c>>>16,d+=65535&(u=(P>>>14|_<<18)^(P>>>18|_<<14)^(_>>>9|P<<23)),p+=u>>>16,g+=65535&(c=(_>>>14|P<<18)^(_>>>18|P<<14)^(P>>>9|_<<23)),y+=c>>>16,d+=65535&(u=P&N^~P&R),p+=u>>>16,g+=65535&(c=_&E^~_&S),y+=c>>>16,c=o[2*L],d+=65535&(u=o[2*L+1]),p+=u>>>16,g+=65535&c,y+=c>>>16,c=e[L%16],p+=(u=t[L%16])>>>16,g+=65535&c,y+=c>>>16,g+=(p+=(d+=65535&u)>>>16)>>>16,d=65535&(u=f=65535&d|p<<16),p=u>>>16,g=65535&(c=l=65535&g|(y+=g>>>16)<<16),y=c>>>16,d+=65535&(u=(M>>>28|m<<4)^(m>>>2|M<<30)^(m>>>7|M<<25)),p+=u>>>16,g+=65535&(c=(m>>>28|M<<4)^(M>>>2|m<<30)^(M>>>7|m<<25)),y+=c>>>16,p+=(u=M&A^M&O^A&O)>>>16,g+=65535&(c=m&v^m&w^v&w),y+=c>>>16,U=65535&(g+=(p+=(d+=65535&u)>>>16)>>>16)|(y+=g>>>16)<<16,j=65535&d|p<<16,d=65535&(u=W),p=u>>>16,g=65535&(c=z),y=c>>>16,p+=(u=f)>>>16,g+=65535&(c=l),y+=c>>>16,v=k,w=q,b=D,_=z=65535&(g+=(p+=(d+=65535&u)>>>16)>>>16)|(y+=g>>>16)<<16,E=$,S=B,I=K,m=U,A=F,O=V,x=H,P=W=65535&d|p<<16,N=G,R=J,T=Y,M=j,L%16==15)for(C=0;C<16;C++)c=e[C],d=65535&(u=t[C]),p=u>>>16,g=65535&c,y=c>>>16,c=e[(C+9)%16],d+=65535&(u=t[(C+9)%16]),p+=u>>>16,g+=65535&c,y+=c>>>16,l=e[(C+1)%16],d+=65535&(u=((f=t[(C+1)%16])>>>1|l<<31)^(f>>>8|l<<24)^(f>>>7|l<<25)),p+=u>>>16,g+=65535&(c=(l>>>1|f<<31)^(l>>>8|f<<24)^l>>>7),y+=c>>>16,l=e[(C+14)%16],p+=(u=((f=t[(C+14)%16])>>>19|l<<13)^(l>>>29|f<<3)^(f>>>6|l<<26))>>>16,g+=65535&(c=(l>>>19|f<<13)^(f>>>29|l<<3)^l>>>6),y+=c>>>16,y+=(g+=(p+=(d+=65535&u)>>>16)>>>16)>>>16,e[C]=65535&g|y<<16,t[C]=65535&d|p<<16}d=65535&(u=M),p=u>>>16,g=65535&(c=m),y=c>>>16,c=r[0],p+=(u=n[0])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&u)>>>16)>>>16)>>>16,r[0]=m=65535&g|y<<16,n[0]=M=65535&d|p<<16,d=65535&(u=A),p=u>>>16,g=65535&(c=v),y=c>>>16,c=r[1],p+=(u=n[1])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&u)>>>16)>>>16)>>>16,r[1]=v=65535&g|y<<16,n[1]=A=65535&d|p<<16,d=65535&(u=O),p=u>>>16,g=65535&(c=w),y=c>>>16,c=r[2],p+=(u=n[2])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&u)>>>16)>>>16)>>>16,r[2]=w=65535&g|y<<16,n[2]=O=65535&d|p<<16,d=65535&(u=x),p=u>>>16,g=65535&(c=b),y=c>>>16,c=r[3],p+=(u=n[3])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&u)>>>16)>>>16)>>>16,r[3]=b=65535&g|y<<16,n[3]=x=65535&d|p<<16,d=65535&(u=P),p=u>>>16,g=65535&(c=_),y=c>>>16,c=r[4],p+=(u=n[4])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&u)>>>16)>>>16)>>>16,r[4]=_=65535&g|y<<16,n[4]=P=65535&d|p<<16,d=65535&(u=N),p=u>>>16,g=65535&(c=E),y=c>>>16,c=r[5],p+=(u=n[5])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&u)>>>16)>>>16)>>>16,r[5]=E=65535&g|y<<16,n[5]=N=65535&d|p<<16,d=65535&(u=R),p=u>>>16,g=65535&(c=S),y=c>>>16,c=r[6],p+=(u=n[6])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&u)>>>16)>>>16)>>>16,r[6]=S=65535&g|y<<16,n[6]=R=65535&d|p<<16,d=65535&(u=T),p=u>>>16,g=65535&(c=I),y=c>>>16,c=r[7],p+=(u=n[7])>>>16,g+=65535&c,y+=c>>>16,y+=(g+=(p+=(d+=65535&u)>>>16)>>>16)>>>16,r[7]=I=65535&g|y<<16,n[7]=T=65535&d|p<<16,a+=128,h-=128}return a}t.hash=function(e){var t=new s;t.update(e);var r=t.digest();return t.clean(),r}},7309:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.wipe=function(e){for(var t=0;t{t.gi=t.Au=t.KS=t.kz=void 0;const i=r(1416),n=r(7309);function s(e){const t=new Float64Array(16);if(e)for(let r=0;r=0;--e){const t=r[e>>>3]>>>(7&e)&1;c(n,o,t),c(p,g,t),u(y,n,p),l(n,n,p),u(p,o,g),l(o,o,g),d(g,y),d(m,n),f(n,p,n),f(p,o,y),u(y,n,p),l(n,n,p),d(o,n),l(p,g,m),f(n,p,a),u(n,n,g),f(p,p,n),f(n,g,m),f(g,o,i),d(o,y),c(n,o,t),c(p,g,t)}for(let e=0;e<16;e++)i[e+16]=n[e],i[e+32]=p[e],i[e+48]=o[e],i[e+64]=g[e];const v=i.subarray(32),w=i.subarray(16);!function(e,t){const r=s();for(let e=0;e<16;e++)r[e]=t[e];for(let e=253;e>=0;e--)d(r,r),2!==e&&4!==e&&f(r,r,t);for(let t=0;t<16;t++)e[t]=r[t]}(v,v),f(w,w,v);const b=new Uint8Array(32);return function(e,t){const r=s(),i=s();for(let e=0;e<16;e++)i[e]=t[e];h(i),h(i),h(i);for(let e=0;e<2;e++){r[0]=i[0]-65517;for(let e=1;e<15;e++)r[e]=i[e]-65535-(r[e-1]>>16&1),r[e-1]&=65535;r[15]=i[15]-32767-(r[14]>>16&1);const e=r[15]>>16&1;r[14]&=65535,c(i,r,1-e)}for(let t=0;t<16;t++)e[2*t]=255&i[t],e[2*t+1]=i[t]>>8}(b,w),b}t.Au=function(e){const r=(0,i.randomBytes)(32,e),s=function(e){if(e.length!==t.KS)throw new Error(`x25519: seed must be ${t.KS} bytes`);const r=new Uint8Array(e);return{publicKey:(i=r,p(i,o)),secretKey:r};var i}(r);return(0,n.wipe)(r),s},t.gi=function(e,r,i=!1){if(e.length!==t.kz)throw new Error("X25519: incorrect secret key length");if(r.length!==t.kz)throw new Error("X25519: incorrect public key length");const n=p(e,r);if(i){let e=0;for(let t=0;t{function i(){return(null===r.g||void 0===r.g?void 0:r.g.crypto)||(null===r.g||void 0===r.g?void 0:r.g.msCrypto)||{}}function n(){const e=i();return e.subtle||e.webkitSubtle}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowserCryptoAvailable=t.getSubtleCrypto=t.getBrowerCrypto=void 0,t.getBrowerCrypto=i,t.getSubtleCrypto=n,t.isBrowserCryptoAvailable=function(){return!!i()&&!!n()}},8618:(e,t)=>{function r(){return"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product}function i(){return"undefined"!=typeof process&&void 0!==process.versions&&void 0!==process.versions.node}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowser=t.isNode=t.isReactNative=void 0,t.isReactNative=r,t.isNode=i,t.isBrowser=function(){return!r()&&!i()}},1468:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const i=r(655);i.__exportStar(r(926),t),i.__exportStar(r(8618),t)},8200:(e,t,r)=>{r.d(t,{q:()=>i});class i{}},997:(e,t,r)=>{r.r(t),r.d(t,{IEvents:()=>i.q});var i=r(8200)},2568:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.HEARTBEAT_EVENTS=t.HEARTBEAT_INTERVAL=void 0;const i=r(6736);t.HEARTBEAT_INTERVAL=i.FIVE_SECONDS,t.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}},3401:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),r(655).__exportStar(r(2568),t)},8969:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.HeartBeat=void 0;const i=r(655),n=r(7187),s=r(6736),o=r(1614),a=r(3401);class h extends o.IHeartBeat{constructor(e){super(e),this.events=new n.EventEmitter,this.interval=a.HEARTBEAT_INTERVAL,this.interval=(null==e?void 0:e.interval)||a.HEARTBEAT_INTERVAL}static init(e){return i.__awaiter(this,void 0,void 0,(function*(){const t=new h(e);return yield t.init(),t}))}init(){return i.__awaiter(this,void 0,void 0,(function*(){yield this.initialize()}))}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}initialize(){return i.__awaiter(this,void 0,void 0,(function*(){this.intervalRef=setInterval((()=>this.pulse()),s.toMiliseconds(this.interval))}))}pulse(){this.events.emit(a.HEARTBEAT_EVENTS.pulse)}}t.HeartBeat=h},159:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const i=r(655);i.__exportStar(r(8969),t),i.__exportStar(r(1614),t),i.__exportStar(r(3401),t)},4174:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IHeartBeat=void 0;const i=r(997);class n extends i.IEvents{constructor(e){super()}}t.IHeartBeat=n},1614:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),r(655).__exportStar(r(4174),t)},2030:e=>{e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},5150:(e,t,r)=>{const i=r(655),n=r(3954),s=i.__importDefault(r(653)),o=r(9728);t.ZP=class{constructor(){this.localStorage=s.default}getKeys(){return i.__awaiter(this,void 0,void 0,(function*(){return Object.keys(this.localStorage)}))}getEntries(){return i.__awaiter(this,void 0,void 0,(function*(){return Object.entries(this.localStorage).map(o.parseEntry)}))}getItem(e){return i.__awaiter(this,void 0,void 0,(function*(){const t=this.localStorage.getItem(e);if(null!==t)return n.safeJsonParse(t)}))}setItem(e,t){return i.__awaiter(this,void 0,void 0,(function*(){this.localStorage.setItem(e,n.safeJsonStringify(t))}))}removeItem(e){return i.__awaiter(this,void 0,void 0,(function*(){this.localStorage.removeItem(e)}))}}},653:(e,t,r)=>{!function(){let t;function i(){}t=i,t.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},t.prototype.setItem=function(e,t){this[e]=String(t)},t.prototype.removeItem=function(e){delete this[e]},t.prototype.clear=function(){const e=this;Object.keys(e).forEach((function(t){e[t]=void 0,delete e[t]}))},t.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},t.prototype.__defineGetter__("length",(function(){return Object.keys(this).length})),void 0!==r.g&&r.g.localStorage?e.exports=r.g.localStorage:"undefined"!=typeof window&&window.localStorage?e.exports=window.localStorage:e.exports=new i}()},9728:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const i=r(655);i.__exportStar(r(9076),t),i.__exportStar(r(496),t)},9076:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IKeyValueStorage=void 0,t.IKeyValueStorage=class{}},496:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseEntry=void 0;const i=r(3954);t.parseEntry=function(e){var t;return[e[0],i.safeJsonParse(null!==(t=e[1])&&void 0!==t?t:"")]}},5727:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PINO_CUSTOM_CONTEXT_KEY=t.PINO_LOGGER_DEFAULTS=void 0,t.PINO_LOGGER_DEFAULTS={level:"info"},t.PINO_CUSTOM_CONTEXT_KEY="custom_context"},9107:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.pino=void 0;const i=r(655),n=i.__importDefault(r(6559));Object.defineProperty(t,"pino",{enumerable:!0,get:function(){return n.default}}),i.__exportStar(r(5727),t),i.__exportStar(r(8048),t)},8048:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.generateChildLogger=t.formatChildLoggerContext=t.getLoggerContext=t.setBrowserLoggerContext=t.getBrowserLoggerContext=t.getDefaultLoggerOptions=void 0;const i=r(5727);function n(e,t=i.PINO_CUSTOM_CONTEXT_KEY){return e[t]||""}function s(e,t,r=i.PINO_CUSTOM_CONTEXT_KEY){return e[r]=t,e}function o(e,t=i.PINO_CUSTOM_CONTEXT_KEY){let r="";return r=void 0===e.bindings?n(e,t):e.bindings().context||"",r}function a(e,t,r=i.PINO_CUSTOM_CONTEXT_KEY){const n=o(e,r);return n.trim()?`${n}/${t}`:t}t.getDefaultLoggerOptions=function(e){return Object.assign(Object.assign({},e),{level:(null==e?void 0:e.level)||i.PINO_LOGGER_DEFAULTS.level})},t.getBrowserLoggerContext=n,t.setBrowserLoggerContext=s,t.getLoggerContext=o,t.formatChildLoggerContext=a,t.generateChildLogger=function(e,t,r=i.PINO_CUSTOM_CONTEXT_KEY){const n=a(e,t,r);return s(e.child({context:n}),n,r)}},1882:()=>{},3014:()=>{},6900:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const i=r(655);i.__exportStar(r(6869),t),i.__exportStar(r(8033),t)},6869:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_THOUSAND=t.ONE_HUNDRED=void 0,t.ONE_HUNDRED=100,t.ONE_THOUSAND=1e3},8033:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=5*t.ONE_MINUTE,t.TEN_MINUTES=10*t.ONE_MINUTE,t.THIRTY_MINUTES=30*t.ONE_MINUTE,t.SIXTY_MINUTES=60*t.ONE_MINUTE,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=3*t.ONE_HOUR,t.SIX_HOURS=6*t.ONE_HOUR,t.TWELVE_HOURS=12*t.ONE_HOUR,t.TWENTY_FOUR_HOURS=24*t.ONE_HOUR,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=3*t.ONE_DAY,t.FIVE_DAYS=5*t.ONE_DAY,t.SEVEN_DAYS=7*t.ONE_DAY,t.THIRTY_DAYS=30*t.ONE_DAY,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=2*t.ONE_WEEK,t.THREE_WEEKS=3*t.ONE_WEEK,t.FOUR_WEEKS=4*t.ONE_WEEK,t.ONE_YEAR=365*t.ONE_DAY},6736:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const i=r(655);i.__exportStar(r(4273),t),i.__exportStar(r(7001),t),i.__exportStar(r(2939),t),i.__exportStar(r(6900),t)},2939:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),r(655).__exportStar(r(8766),t)},8766:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IWatch=void 0,t.IWatch=class{}},3207:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fromMiliseconds=t.toMiliseconds=void 0;const i=r(6900);t.toMiliseconds=function(e){return e*i.ONE_THOUSAND},t.fromMiliseconds=function(e){return Math.floor(e/i.ONE_THOUSAND)}},3873:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.delay=void 0,t.delay=function(e){return new Promise((t=>{setTimeout((()=>{t(!0)}),e)}))}},4273:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const i=r(655);i.__exportStar(r(3873),t),i.__exportStar(r(3207),t)},7001:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){const t=this.get(e);if(void 0!==t.elapsed)throw new Error(`Watch already stopped for label: ${e}`);const r=Date.now()-t.started;this.timestamps.set(e,{started:t.started,elapsed:r})}get(e){const t=this.timestamps.get(e);if(void 0===t)throw new Error(`No timestamp found for label: ${e}`);return t}elapsed(e){const t=this.get(e);return t.elapsed||Date.now()-t.started}}t.Watch=r,t.default=r},2873:(e,t)=>{function r(e){let t;return"undefined"!=typeof window&&void 0!==window[e]&&(t=window[e]),t}function i(e){const t=r(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}Object.defineProperty(t,"__esModule",{value:!0}),t.getLocalStorage=t.getLocalStorageOrThrow=t.getCrypto=t.getCryptoOrThrow=t.getLocation=t.getLocationOrThrow=t.getNavigator=t.getNavigatorOrThrow=t.getDocument=t.getDocumentOrThrow=t.getFromWindowOrThrow=t.getFromWindow=void 0,t.getFromWindow=r,t.getFromWindowOrThrow=i,t.getDocumentOrThrow=function(){return i("document")},t.getDocument=function(){return r("document")},t.getNavigatorOrThrow=function(){return i("navigator")},t.getNavigator=function(){return r("navigator")},t.getLocationOrThrow=function(){return i("location")},t.getLocation=function(){return r("location")},t.getCryptoOrThrow=function(){return i("crypto")},t.getCrypto=function(){return r("crypto")},t.getLocalStorageOrThrow=function(){return i("localStorage")},t.getLocalStorage=function(){return r("localStorage")}},5755:(e,t,r)=>{t.D=void 0;const i=r(2873);t.D=function(){let e,t;try{e=i.getDocumentOrThrow(),t=i.getLocationOrThrow()}catch(e){return null}function r(...t){const r=e.getElementsByTagName("meta");for(let e=0;ei.getAttribute(e))).filter((e=>!!e&&t.includes(e)));if(n.length&&n){const e=i.getAttribute("content");if(e)return e}}return""}const n=function(){let t=r("name","og:site_name","og:title","twitter:title");return t||(t=e.title),t}();return{description:r("description","og:description","twitter:description","keywords"),url:t.origin,icons:function(){const r=e.getElementsByTagName("link"),i=[];for(let e=0;e-1){const e=n.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let r=t.protocol+"//"+t.host;if(0===e.indexOf("/"))r+=e;else{const i=t.pathname.split("/");i.pop(),r+=i.join("/")+"/"+e}i.push(r)}else if(0===e.indexOf("//")){const r=t.protocol+e;i.push(r)}else i.push(e)}}return i}(),name:n}}},3550:function(e,t,r){!function(e,t){function i(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function s(e,t,r){if(s.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"==typeof e?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(6601).Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void i(!1,"Invalid character in "+e)}function h(e,t,r){var i=a(e,r);return r-1>=t&&(i|=a(e,r-1)<<4),i}function c(e,t,r,n){for(var s=0,o=0,a=Math.min(e.length,r),h=t;h=49?c-49+10:c>=17?c-17+10:c,i(c>=0&&o0?e:t},s.min=function(e,t){return e.cmp(t)<0?e:t},s.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)o=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[s]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if("le"===r)for(n=0,s=0;n>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this._strip()},s.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i=t;i-=2)n=h(e,t,i)<=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;else for(i=(e.length-t)%2==0?t+1:t;i=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;this._strip()},s.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var s=e.length-r,o=s%i,a=Math.min(s,s-o)+r,h=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(e){s.prototype.inspect=l}else s.prototype.inspect=l;function l(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function g(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],s=0|t.words[0],o=n*s,a=67108863&o,h=o/67108864|0;r.words[0]=a;for(var c=1;c>>26,l=67108863&h,f=Math.min(c,t.length-1),d=Math.max(0,c-e.length+1);d<=f;d++){var p=c-d|0;u+=(o=(n=0|e.words[p])*(s=0|t.words[d])+l)/67108864|0,l=67108863&o}r.words[c]=0|l,h=0|u}return 0!==h?r.words[c]=0|h:r.length--,r._strip()}s.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,s=0,o=0;o>>24-n&16777215,(n+=2)>=26&&(n-=26,o--),r=0!==s||o!==this.length-1?f[6-h.length]+h+r:h+r}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var c=d[e],u=p[e];r="";var l=this.clone();for(l.negative=0;!l.isZero();){var g=l.modrn(u).toString(e);r=(l=l.idivn(u)).isZero()?g+r:f[c-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),s.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},s.prototype.toArrayLike=function(e,t,r){this._strip();var n=this.byteLength(),s=r||Math.max(1,n);i(n<=s,"byte array longer than desired length"),i(s>0,"Requested array length <= 0");var o=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,s);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,n),o},s.prototype._toArrayLikeLE=function(e,t){for(var r=0,i=0,n=0,s=0;n>8&255),r>16&255),6===s?(r>24&255),i=0,s=0):(i=o>>>24,s+=2)}if(r=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===s?(r>=0&&(e[r--]=o>>24&255),i=0,s=0):(i=o>>>24,s+=2)}if(r>=0)for(e[r--]=i;r>=0;)e[r--]=0},Math.clz32?s.prototype._countBits=function(e){return 32-Math.clz32(e)}:s.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},s.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},s.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},s.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},s.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},s.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},s.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var i=0;ie.length?this.clone().ixor(e):e.clone().ixor(this)},s.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},s.prototype.inotn=function(e){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},s.prototype.notn=function(e){return this.clone().inotn(e)},s.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,i=e):(r=e,i=this);for(var n=0,s=0;s>>26;for(;0!==n&&s>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;se.length?this.clone().iadd(e):e.clone().iadd(this)},s.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,i,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=e):(r=e,i=this);for(var s=0,o=0;o>26,this.words[o]=67108863&t;for(;0!==s&&o>26,this.words[o]=67108863&t;if(0===s&&o>>13,d=0|o[1],p=8191&d,g=d>>>13,y=0|o[2],m=8191&y,v=y>>>13,w=0|o[3],b=8191&w,_=w>>>13,E=0|o[4],S=8191&E,I=E>>>13,M=0|o[5],A=8191&M,O=M>>>13,x=0|o[6],P=8191&x,N=x>>>13,R=0|o[7],T=8191&R,L=R>>>13,C=0|o[8],U=8191&C,j=C>>>13,k=0|o[9],q=8191&k,D=k>>>13,z=0|a[0],$=8191&z,B=z>>>13,K=0|a[1],F=8191&K,V=K>>>13,H=0|a[2],W=8191&H,G=H>>>13,J=0|a[3],Y=8191&J,X=J>>>13,Q=0|a[4],Z=8191&Q,ee=Q>>>13,te=0|a[5],re=8191&te,ie=te>>>13,ne=0|a[6],se=8191&ne,oe=ne>>>13,ae=0|a[7],he=8191&ae,ce=ae>>>13,ue=0|a[8],le=8191&ue,fe=ue>>>13,de=0|a[9],pe=8191&de,ge=de>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(c+(i=Math.imul(l,$))|0)+((8191&(n=(n=Math.imul(l,B))+Math.imul(f,$)|0))<<13)|0;c=((s=Math.imul(f,B))+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,i=Math.imul(p,$),n=(n=Math.imul(p,B))+Math.imul(g,$)|0,s=Math.imul(g,B);var me=(c+(i=i+Math.imul(l,F)|0)|0)+((8191&(n=(n=n+Math.imul(l,V)|0)+Math.imul(f,F)|0))<<13)|0;c=((s=s+Math.imul(f,V)|0)+(n>>>13)|0)+(me>>>26)|0,me&=67108863,i=Math.imul(m,$),n=(n=Math.imul(m,B))+Math.imul(v,$)|0,s=Math.imul(v,B),i=i+Math.imul(p,F)|0,n=(n=n+Math.imul(p,V)|0)+Math.imul(g,F)|0,s=s+Math.imul(g,V)|0;var ve=(c+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,G)|0)+Math.imul(f,W)|0))<<13)|0;c=((s=s+Math.imul(f,G)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,i=Math.imul(b,$),n=(n=Math.imul(b,B))+Math.imul(_,$)|0,s=Math.imul(_,B),i=i+Math.imul(m,F)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(v,F)|0,s=s+Math.imul(v,V)|0,i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,G)|0)+Math.imul(g,W)|0,s=s+Math.imul(g,G)|0;var we=(c+(i=i+Math.imul(l,Y)|0)|0)+((8191&(n=(n=n+Math.imul(l,X)|0)+Math.imul(f,Y)|0))<<13)|0;c=((s=s+Math.imul(f,X)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,i=Math.imul(S,$),n=(n=Math.imul(S,B))+Math.imul(I,$)|0,s=Math.imul(I,B),i=i+Math.imul(b,F)|0,n=(n=n+Math.imul(b,V)|0)+Math.imul(_,F)|0,s=s+Math.imul(_,V)|0,i=i+Math.imul(m,W)|0,n=(n=n+Math.imul(m,G)|0)+Math.imul(v,W)|0,s=s+Math.imul(v,G)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(g,Y)|0,s=s+Math.imul(g,X)|0;var be=(c+(i=i+Math.imul(l,Z)|0)|0)+((8191&(n=(n=n+Math.imul(l,ee)|0)+Math.imul(f,Z)|0))<<13)|0;c=((s=s+Math.imul(f,ee)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,i=Math.imul(A,$),n=(n=Math.imul(A,B))+Math.imul(O,$)|0,s=Math.imul(O,B),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(I,F)|0,s=s+Math.imul(I,V)|0,i=i+Math.imul(b,W)|0,n=(n=n+Math.imul(b,G)|0)+Math.imul(_,W)|0,s=s+Math.imul(_,G)|0,i=i+Math.imul(m,Y)|0,n=(n=n+Math.imul(m,X)|0)+Math.imul(v,Y)|0,s=s+Math.imul(v,X)|0,i=i+Math.imul(p,Z)|0,n=(n=n+Math.imul(p,ee)|0)+Math.imul(g,Z)|0,s=s+Math.imul(g,ee)|0;var _e=(c+(i=i+Math.imul(l,re)|0)|0)+((8191&(n=(n=n+Math.imul(l,ie)|0)+Math.imul(f,re)|0))<<13)|0;c=((s=s+Math.imul(f,ie)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,i=Math.imul(P,$),n=(n=Math.imul(P,B))+Math.imul(N,$)|0,s=Math.imul(N,B),i=i+Math.imul(A,F)|0,n=(n=n+Math.imul(A,V)|0)+Math.imul(O,F)|0,s=s+Math.imul(O,V)|0,i=i+Math.imul(S,W)|0,n=(n=n+Math.imul(S,G)|0)+Math.imul(I,W)|0,s=s+Math.imul(I,G)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,X)|0)+Math.imul(_,Y)|0,s=s+Math.imul(_,X)|0,i=i+Math.imul(m,Z)|0,n=(n=n+Math.imul(m,ee)|0)+Math.imul(v,Z)|0,s=s+Math.imul(v,ee)|0,i=i+Math.imul(p,re)|0,n=(n=n+Math.imul(p,ie)|0)+Math.imul(g,re)|0,s=s+Math.imul(g,ie)|0;var Ee=(c+(i=i+Math.imul(l,se)|0)|0)+((8191&(n=(n=n+Math.imul(l,oe)|0)+Math.imul(f,se)|0))<<13)|0;c=((s=s+Math.imul(f,oe)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,i=Math.imul(T,$),n=(n=Math.imul(T,B))+Math.imul(L,$)|0,s=Math.imul(L,B),i=i+Math.imul(P,F)|0,n=(n=n+Math.imul(P,V)|0)+Math.imul(N,F)|0,s=s+Math.imul(N,V)|0,i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,G)|0)+Math.imul(O,W)|0,s=s+Math.imul(O,G)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(I,Y)|0,s=s+Math.imul(I,X)|0,i=i+Math.imul(b,Z)|0,n=(n=n+Math.imul(b,ee)|0)+Math.imul(_,Z)|0,s=s+Math.imul(_,ee)|0,i=i+Math.imul(m,re)|0,n=(n=n+Math.imul(m,ie)|0)+Math.imul(v,re)|0,s=s+Math.imul(v,ie)|0,i=i+Math.imul(p,se)|0,n=(n=n+Math.imul(p,oe)|0)+Math.imul(g,se)|0,s=s+Math.imul(g,oe)|0;var Se=(c+(i=i+Math.imul(l,he)|0)|0)+((8191&(n=(n=n+Math.imul(l,ce)|0)+Math.imul(f,he)|0))<<13)|0;c=((s=s+Math.imul(f,ce)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,i=Math.imul(U,$),n=(n=Math.imul(U,B))+Math.imul(j,$)|0,s=Math.imul(j,B),i=i+Math.imul(T,F)|0,n=(n=n+Math.imul(T,V)|0)+Math.imul(L,F)|0,s=s+Math.imul(L,V)|0,i=i+Math.imul(P,W)|0,n=(n=n+Math.imul(P,G)|0)+Math.imul(N,W)|0,s=s+Math.imul(N,G)|0,i=i+Math.imul(A,Y)|0,n=(n=n+Math.imul(A,X)|0)+Math.imul(O,Y)|0,s=s+Math.imul(O,X)|0,i=i+Math.imul(S,Z)|0,n=(n=n+Math.imul(S,ee)|0)+Math.imul(I,Z)|0,s=s+Math.imul(I,ee)|0,i=i+Math.imul(b,re)|0,n=(n=n+Math.imul(b,ie)|0)+Math.imul(_,re)|0,s=s+Math.imul(_,ie)|0,i=i+Math.imul(m,se)|0,n=(n=n+Math.imul(m,oe)|0)+Math.imul(v,se)|0,s=s+Math.imul(v,oe)|0,i=i+Math.imul(p,he)|0,n=(n=n+Math.imul(p,ce)|0)+Math.imul(g,he)|0,s=s+Math.imul(g,ce)|0;var Ie=(c+(i=i+Math.imul(l,le)|0)|0)+((8191&(n=(n=n+Math.imul(l,fe)|0)+Math.imul(f,le)|0))<<13)|0;c=((s=s+Math.imul(f,fe)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,i=Math.imul(q,$),n=(n=Math.imul(q,B))+Math.imul(D,$)|0,s=Math.imul(D,B),i=i+Math.imul(U,F)|0,n=(n=n+Math.imul(U,V)|0)+Math.imul(j,F)|0,s=s+Math.imul(j,V)|0,i=i+Math.imul(T,W)|0,n=(n=n+Math.imul(T,G)|0)+Math.imul(L,W)|0,s=s+Math.imul(L,G)|0,i=i+Math.imul(P,Y)|0,n=(n=n+Math.imul(P,X)|0)+Math.imul(N,Y)|0,s=s+Math.imul(N,X)|0,i=i+Math.imul(A,Z)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(O,Z)|0,s=s+Math.imul(O,ee)|0,i=i+Math.imul(S,re)|0,n=(n=n+Math.imul(S,ie)|0)+Math.imul(I,re)|0,s=s+Math.imul(I,ie)|0,i=i+Math.imul(b,se)|0,n=(n=n+Math.imul(b,oe)|0)+Math.imul(_,se)|0,s=s+Math.imul(_,oe)|0,i=i+Math.imul(m,he)|0,n=(n=n+Math.imul(m,ce)|0)+Math.imul(v,he)|0,s=s+Math.imul(v,ce)|0,i=i+Math.imul(p,le)|0,n=(n=n+Math.imul(p,fe)|0)+Math.imul(g,le)|0,s=s+Math.imul(g,fe)|0;var Me=(c+(i=i+Math.imul(l,pe)|0)|0)+((8191&(n=(n=n+Math.imul(l,ge)|0)+Math.imul(f,pe)|0))<<13)|0;c=((s=s+Math.imul(f,ge)|0)+(n>>>13)|0)+(Me>>>26)|0,Me&=67108863,i=Math.imul(q,F),n=(n=Math.imul(q,V))+Math.imul(D,F)|0,s=Math.imul(D,V),i=i+Math.imul(U,W)|0,n=(n=n+Math.imul(U,G)|0)+Math.imul(j,W)|0,s=s+Math.imul(j,G)|0,i=i+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,X)|0)+Math.imul(L,Y)|0,s=s+Math.imul(L,X)|0,i=i+Math.imul(P,Z)|0,n=(n=n+Math.imul(P,ee)|0)+Math.imul(N,Z)|0,s=s+Math.imul(N,ee)|0,i=i+Math.imul(A,re)|0,n=(n=n+Math.imul(A,ie)|0)+Math.imul(O,re)|0,s=s+Math.imul(O,ie)|0,i=i+Math.imul(S,se)|0,n=(n=n+Math.imul(S,oe)|0)+Math.imul(I,se)|0,s=s+Math.imul(I,oe)|0,i=i+Math.imul(b,he)|0,n=(n=n+Math.imul(b,ce)|0)+Math.imul(_,he)|0,s=s+Math.imul(_,ce)|0,i=i+Math.imul(m,le)|0,n=(n=n+Math.imul(m,fe)|0)+Math.imul(v,le)|0,s=s+Math.imul(v,fe)|0;var Ae=(c+(i=i+Math.imul(p,pe)|0)|0)+((8191&(n=(n=n+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;c=((s=s+Math.imul(g,ge)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,i=Math.imul(q,W),n=(n=Math.imul(q,G))+Math.imul(D,W)|0,s=Math.imul(D,G),i=i+Math.imul(U,Y)|0,n=(n=n+Math.imul(U,X)|0)+Math.imul(j,Y)|0,s=s+Math.imul(j,X)|0,i=i+Math.imul(T,Z)|0,n=(n=n+Math.imul(T,ee)|0)+Math.imul(L,Z)|0,s=s+Math.imul(L,ee)|0,i=i+Math.imul(P,re)|0,n=(n=n+Math.imul(P,ie)|0)+Math.imul(N,re)|0,s=s+Math.imul(N,ie)|0,i=i+Math.imul(A,se)|0,n=(n=n+Math.imul(A,oe)|0)+Math.imul(O,se)|0,s=s+Math.imul(O,oe)|0,i=i+Math.imul(S,he)|0,n=(n=n+Math.imul(S,ce)|0)+Math.imul(I,he)|0,s=s+Math.imul(I,ce)|0,i=i+Math.imul(b,le)|0,n=(n=n+Math.imul(b,fe)|0)+Math.imul(_,le)|0,s=s+Math.imul(_,fe)|0;var Oe=(c+(i=i+Math.imul(m,pe)|0)|0)+((8191&(n=(n=n+Math.imul(m,ge)|0)+Math.imul(v,pe)|0))<<13)|0;c=((s=s+Math.imul(v,ge)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,i=Math.imul(q,Y),n=(n=Math.imul(q,X))+Math.imul(D,Y)|0,s=Math.imul(D,X),i=i+Math.imul(U,Z)|0,n=(n=n+Math.imul(U,ee)|0)+Math.imul(j,Z)|0,s=s+Math.imul(j,ee)|0,i=i+Math.imul(T,re)|0,n=(n=n+Math.imul(T,ie)|0)+Math.imul(L,re)|0,s=s+Math.imul(L,ie)|0,i=i+Math.imul(P,se)|0,n=(n=n+Math.imul(P,oe)|0)+Math.imul(N,se)|0,s=s+Math.imul(N,oe)|0,i=i+Math.imul(A,he)|0,n=(n=n+Math.imul(A,ce)|0)+Math.imul(O,he)|0,s=s+Math.imul(O,ce)|0,i=i+Math.imul(S,le)|0,n=(n=n+Math.imul(S,fe)|0)+Math.imul(I,le)|0,s=s+Math.imul(I,fe)|0;var xe=(c+(i=i+Math.imul(b,pe)|0)|0)+((8191&(n=(n=n+Math.imul(b,ge)|0)+Math.imul(_,pe)|0))<<13)|0;c=((s=s+Math.imul(_,ge)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,i=Math.imul(q,Z),n=(n=Math.imul(q,ee))+Math.imul(D,Z)|0,s=Math.imul(D,ee),i=i+Math.imul(U,re)|0,n=(n=n+Math.imul(U,ie)|0)+Math.imul(j,re)|0,s=s+Math.imul(j,ie)|0,i=i+Math.imul(T,se)|0,n=(n=n+Math.imul(T,oe)|0)+Math.imul(L,se)|0,s=s+Math.imul(L,oe)|0,i=i+Math.imul(P,he)|0,n=(n=n+Math.imul(P,ce)|0)+Math.imul(N,he)|0,s=s+Math.imul(N,ce)|0,i=i+Math.imul(A,le)|0,n=(n=n+Math.imul(A,fe)|0)+Math.imul(O,le)|0,s=s+Math.imul(O,fe)|0;var Pe=(c+(i=i+Math.imul(S,pe)|0)|0)+((8191&(n=(n=n+Math.imul(S,ge)|0)+Math.imul(I,pe)|0))<<13)|0;c=((s=s+Math.imul(I,ge)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,i=Math.imul(q,re),n=(n=Math.imul(q,ie))+Math.imul(D,re)|0,s=Math.imul(D,ie),i=i+Math.imul(U,se)|0,n=(n=n+Math.imul(U,oe)|0)+Math.imul(j,se)|0,s=s+Math.imul(j,oe)|0,i=i+Math.imul(T,he)|0,n=(n=n+Math.imul(T,ce)|0)+Math.imul(L,he)|0,s=s+Math.imul(L,ce)|0,i=i+Math.imul(P,le)|0,n=(n=n+Math.imul(P,fe)|0)+Math.imul(N,le)|0,s=s+Math.imul(N,fe)|0;var Ne=(c+(i=i+Math.imul(A,pe)|0)|0)+((8191&(n=(n=n+Math.imul(A,ge)|0)+Math.imul(O,pe)|0))<<13)|0;c=((s=s+Math.imul(O,ge)|0)+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,i=Math.imul(q,se),n=(n=Math.imul(q,oe))+Math.imul(D,se)|0,s=Math.imul(D,oe),i=i+Math.imul(U,he)|0,n=(n=n+Math.imul(U,ce)|0)+Math.imul(j,he)|0,s=s+Math.imul(j,ce)|0,i=i+Math.imul(T,le)|0,n=(n=n+Math.imul(T,fe)|0)+Math.imul(L,le)|0,s=s+Math.imul(L,fe)|0;var Re=(c+(i=i+Math.imul(P,pe)|0)|0)+((8191&(n=(n=n+Math.imul(P,ge)|0)+Math.imul(N,pe)|0))<<13)|0;c=((s=s+Math.imul(N,ge)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,i=Math.imul(q,he),n=(n=Math.imul(q,ce))+Math.imul(D,he)|0,s=Math.imul(D,ce),i=i+Math.imul(U,le)|0,n=(n=n+Math.imul(U,fe)|0)+Math.imul(j,le)|0,s=s+Math.imul(j,fe)|0;var Te=(c+(i=i+Math.imul(T,pe)|0)|0)+((8191&(n=(n=n+Math.imul(T,ge)|0)+Math.imul(L,pe)|0))<<13)|0;c=((s=s+Math.imul(L,ge)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,i=Math.imul(q,le),n=(n=Math.imul(q,fe))+Math.imul(D,le)|0,s=Math.imul(D,fe);var Le=(c+(i=i+Math.imul(U,pe)|0)|0)+((8191&(n=(n=n+Math.imul(U,ge)|0)+Math.imul(j,pe)|0))<<13)|0;c=((s=s+Math.imul(j,ge)|0)+(n>>>13)|0)+(Le>>>26)|0,Le&=67108863;var Ce=(c+(i=Math.imul(q,pe))|0)+((8191&(n=(n=Math.imul(q,ge))+Math.imul(D,pe)|0))<<13)|0;return c=((s=Math.imul(D,ge))+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,h[0]=ye,h[1]=me,h[2]=ve,h[3]=we,h[4]=be,h[5]=_e,h[6]=Ee,h[7]=Se,h[8]=Ie,h[9]=Me,h[10]=Ae,h[11]=Oe,h[12]=xe,h[13]=Pe,h[14]=Ne,h[15]=Re,h[16]=Te,h[17]=Le,h[18]=Ce,0!==c&&(h[19]=c,r.length++),r};function m(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,s=0;s>>26)|0)>>>26,o&=67108863}r.words[s]=a,i=o,o=n}return 0!==i?r.words[s]=i:r.length--,r._strip()}function v(e,t,r){return m(e,t,r)}function w(e,t){this.x=e,this.y=t}Math.imul||(y=g),s.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?y(this,e,t):r<63?g(this,e,t):r<1024?m(this,e,t):v(this,e,t)},w.prototype.makeRBT=function(e){for(var t=new Array(e),r=s.prototype._countBits(e)-1,i=0;i>=1;return i},w.prototype.permute=function(e,t,r,i,n,s){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*t;o>=26,r+=s/67108864|0,r+=o>>>26,this.words[n]=67108863&o}return 0!==r&&(this.words[n]=r,this.length++),t?this.ineg():this},s.prototype.muln=function(e){return this.clone().imuln(e)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>n&1}return t}(e);if(0===t.length)return new s(1);for(var r=this,i=0;i=0);var t,r=e%26,n=(e-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t=0),n=t?(t-t%26)/26:0;var s=e%26,o=Math.min((e-s)/26,this.length),a=67108863^67108863>>>s<o)for(this.length-=o,c=0;c=0&&(0!==u||c>=n);c--){var l=0|this.words[c];this.words[c]=u<<26-s|l>>>s,u=l&a}return h&&0!==u&&(h.words[h.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(e,t,r){return i(0===this.negative),this.iushrn(e,t,r)},s.prototype.shln=function(e){return this.clone().ishln(e)},s.prototype.ushln=function(e){return this.clone().iushln(e)},s.prototype.shrn=function(e){return this.clone().ishrn(e)},s.prototype.ushrn=function(e){return this.clone().iushrn(e)},s.prototype.testn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<=0);var t=e%26,r=(e-t)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var n=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},s.prototype.isubn=function(e){if(i("number"==typeof e),i(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(h/67108864|0),this.words[n+r]=67108863&s}for(;n>26,this.words[n+r]=67108863&s;if(0===a)return this._strip();for(i(-1===a),a=0,n=0;n>26,this.words[n]=67108863&s;return this.negative=1,this._strip()},s.prototype._wordDiv=function(e,t){var r=(this.length,e.length),i=this.clone(),n=e,o=0|n.words[n.length-1];0!=(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var a,h=i.length-n.length;if("mod"!==t){(a=new s(null)).length=h+1,a.words=new Array(a.length);for(var c=0;c=0;l--){var f=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(f=Math.min(f/o|0,67108863),i._ishlnsubmul(n,f,l);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);a&&(a.words[l]=f)}return a&&a._strip(),i._strip(),"div"!==t&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},s.prototype.divmod=function(e,t,r){return i(!e.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(n=a.div.neg()),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(e)),{div:n,mod:o}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(n=a.div.neg()),{div:n,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(e)),{div:a.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new s(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new s(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new s(this.modrn(e.words[0]))}:this._wordDiv(e,t);var n,o,a},s.prototype.div=function(e){return this.divmod(e,"div",!1).div},s.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},s.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},s.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),s=r.cmp(i);return s<0||1===n&&0===s?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},s.prototype.modrn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var r=(1<<26)%e,n=0,s=this.length-1;s>=0;s--)n=(r*n+(0|this.words[s]))%e;return t?-n:n},s.prototype.modn=function(e){return this.modrn(e)},s.prototype.idivn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var s=(0|this.words[n])+67108864*r;this.words[n]=s/e|0,r=s%e}return this._strip(),t?this.ineg():this},s.prototype.divn=function(e){return this.clone().idivn(e)},s.prototype.egcd=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new s(1),o=new s(0),a=new s(0),h=new s(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var u=r.clone(),l=t.clone();!t.isZero();){for(var f=0,d=1;0==(t.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(u),o.isub(l)),n.iushrn(1),o.iushrn(1);for(var p=0,g=1;0==(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(u),h.isub(l)),a.iushrn(1),h.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(a),o.isub(h)):(r.isub(t),a.isub(n),h.isub(o))}return{a,b:h,gcd:r.iushln(c)}},s.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,o=new s(1),a=new s(0),h=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,u=1;0==(t.words[0]&u)&&c<26;++c,u<<=1);if(c>0)for(t.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(h),o.iushrn(1);for(var l=0,f=1;0==(r.words[0]&f)&&l<26;++l,f<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(a)):(r.isub(t),a.isub(o))}return(n=0===t.cmpn(1)?o:a).cmpn(0)<0&&n.iadd(e),n},s.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var s=t;t=r,r=s}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(i)},s.prototype.invm=function(e){return this.egcd(e).a.umod(e)},s.prototype.isEven=function(){return 0==(1&this.words[0])},s.prototype.isOdd=function(){return 1==(1&this.words[0])},s.prototype.andln=function(e){return this.words[0]&e},s.prototype.bincn=function(e){i("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),i(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:ne.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){in&&(t=1);break}}return t},s.prototype.gtn=function(e){return 1===this.cmpn(e)},s.prototype.gt=function(e){return 1===this.cmp(e)},s.prototype.gten=function(e){return this.cmpn(e)>=0},s.prototype.gte=function(e){return this.cmp(e)>=0},s.prototype.ltn=function(e){return-1===this.cmpn(e)},s.prototype.lt=function(e){return-1===this.cmp(e)},s.prototype.lten=function(e){return this.cmpn(e)<=0},s.prototype.lte=function(e){return this.cmp(e)<=0},s.prototype.eqn=function(e){return 0===this.cmpn(e)},s.prototype.eq=function(e){return 0===this.cmp(e)},s.red=function(e){return new A(e)},s.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(e){return this.red=e,this},s.prototype.forceRed=function(e){return i(!this.red,"Already a number in reduction context"),this._forceRed(e)},s.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},s.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},s.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},s.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},s.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},s.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},s.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var b={k256:null,p224:null,p192:null,p25519:null};function _(e,t){this.name=e,this.p=new s(t,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function E(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function I(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(e){if("string"==typeof e){var t=s._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function O(e){A.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}_.prototype._tmp=function(){var e=new s(null);return e.words=new Array(Math.ceil(this.n/13)),e},_.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var i=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},_.prototype.split=function(e,t){e.iushrn(this.n,0,t)},_.prototype.imulK=function(e){return e.imul(this.k)},n(E,_),E.prototype.split=function(e,t){for(var r=4194303,i=Math.min(e.length,9),n=0;n>>22,s=o}s>>>=22,e.words[n-10]=s,0===s&&e.length>10?e.length-=10:e.length-=9},E.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},s._prime=function(e){if(b[e])return b[e];var t;if("k256"===e)t=new E;else if("p224"===e)t=new S;else if("p192"===e)t=new I;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new M}return b[e]=t,t},A.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},A.prototype._verify2=function(e,t){i(0==(e.negative|t.negative),"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},A.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},A.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},A.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},A.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},A.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},A.prototype.isqr=function(e){return this.imul(e,e.clone())},A.prototype.sqr=function(e){return this.mul(e,e)},A.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var r=this.m.add(new s(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var a=new s(1).toRed(this),h=a.redNeg(),c=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new s(2*u*u).toRed(this);0!==this.pow(u,c).cmp(h);)u.redIAdd(h);for(var l=this.pow(u,n),f=this.pow(e,n.addn(1).iushrn(1)),d=this.pow(e,n),p=o;0!==d.cmp(a);){for(var g=d,y=0;0!==g.cmp(a);y++)g=g.redSqr();i(y=0;i--){for(var c=t.words[i],u=h-1;u>=0;u--){var l=c>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==o?(o<<=1,o|=l,(4==++a||0===i&&0===u)&&(n=this.mul(n,r[o]),a=0,o=0)):a=0}h=26}return n},A.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},A.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},s.mont=function(e){return new O(e)},n(O,A),O.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},O.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},O.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},O.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new s(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},O.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},4020:e=>{var t="%[a-f0-9]{2}",r=new RegExp("("+t+")|([^%]+?)","gi"),i=new RegExp("("+t+")+","gi");function n(e,t){try{return[decodeURIComponent(e.join(""))]}catch(e){}if(1===e.length)return e;t=t||1;var r=e.slice(0,t),i=e.slice(t);return Array.prototype.concat.call([],n(r),n(i))}function s(e){try{return decodeURIComponent(e)}catch(s){for(var t=e.match(r)||[],i=1;i{var t,r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var n=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(r,i){function n(r){e.removeListener(t,s),i(r)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments))}g(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&g(e,"error",t,{once:!0})}(e,n)}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function h(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function c(e,t,r,i){var n,s,o,c;if(a(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"==typeof o?o=s[t]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=h(e))>0&&o.length>n&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,c=u,console&&console.warn&&console.warn(c)}return e}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=u.bind(i);return n.listener=r,i.wrapFn=n,n}function f(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=s[e];if(void 0===h)return!1;if("function"==typeof h)i(h,this,t);else{var c=h.length,u=p(h,c);for(r=0;r=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1=0;i--)this.removeListener(e,t[i]);return this},s.prototype.listeners=function(e){return f(this,e,!0)},s.prototype.rawListeners=function(e){return f(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},s.prototype.listenerCount=d,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},2806:e=>{e.exports=function(e,t){for(var r={},i=Object.keys(e),n=Array.isArray(t),s=0;s{var i=t;i.utils=r(6436),i.common=r(5772),i.sha=r(9041),i.ripemd=r(2949),i.hmac=r(2344),i.sha1=i.sha.sha1,i.sha256=i.sha.sha256,i.sha224=i.sha.sha224,i.sha384=i.sha.sha384,i.sha512=i.sha.sha512,i.ripemd160=i.ripemd.ripemd160},5772:(e,t,r)=>{var i=r(6436),n=r(9746);function s(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=s,s.prototype.update=function(e,t){if(e=i.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=i.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,i[n++]=e>>>16&255,i[n++]=e>>>8&255,i[n++]=255&e}else for(i[n++]=255&e,i[n++]=e>>>8&255,i[n++]=e>>>16&255,i[n++]=e>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,s=8;s{var i=r(6436),n=r(9746);function s(e,t,r){if(!(this instanceof s))return new s(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(i.toArray(t,r))}e.exports=s,s.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),n(e.length<=this.blockSize);for(var t=e.length;t{var i=r(6436),n=r(5772),s=i.rotl32,o=i.sum32,a=i.sum32_3,h=i.sum32_4,c=n.BlockHash;function u(){if(!(this instanceof u))return new u;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function l(e,t,r,i){return e<=15?t^r^i:e<=31?t&r|~t&i:e<=47?(t|~r)^i:e<=63?t&i|r&~i:t^(r|~i)}function f(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function d(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}i.inherits(u,c),t.ripemd160=u,u.blockSize=512,u.outSize=160,u.hmacStrength=192,u.padLength=64,u.prototype._update=function(e,t){for(var r=this.h[0],i=this.h[1],n=this.h[2],c=this.h[3],u=this.h[4],v=r,w=i,b=n,_=c,E=u,S=0;S<80;S++){var I=o(s(h(r,l(S,i,n,c),e[p[S]+t],f(S)),y[S]),u);r=u,u=c,c=s(n,10),n=i,i=I,I=o(s(h(v,l(79-S,w,b,_),e[g[S]+t],d(S)),m[S]),E),v=E,E=_,_=s(b,10),b=w,w=I}I=a(this.h[1],n,_),this.h[1]=a(this.h[2],c,E),this.h[2]=a(this.h[3],u,v),this.h[3]=a(this.h[4],r,w),this.h[4]=a(this.h[0],i,b),this.h[0]=I},u.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"little"):i.split32(this.h,"little")};var p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],g=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],y=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],m=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},9041:(e,t,r)=>{t.sha1=r(4761),t.sha224=r(799),t.sha256=r(9344),t.sha384=r(772),t.sha512=r(5900)},4761:(e,t,r)=>{var i=r(6436),n=r(5772),s=r(7038),o=i.rotl32,a=i.sum32,h=i.sum32_5,c=s.ft_1,u=n.BlockHash,l=[1518500249,1859775393,2400959708,3395469782];function f(){if(!(this instanceof f))return new f;u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}i.inherits(f,u),e.exports=f,f.blockSize=512,f.outSize=160,f.hmacStrength=80,f.padLength=64,f.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;i{var i=r(6436),n=r(9344);function s(){if(!(this instanceof s))return new s;n.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}i.inherits(s,n),e.exports=s,s.blockSize=512,s.outSize=224,s.hmacStrength=192,s.padLength=64,s.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h.slice(0,7),"big"):i.split32(this.h.slice(0,7),"big")}},9344:(e,t,r)=>{var i=r(6436),n=r(5772),s=r(7038),o=r(9746),a=i.sum32,h=i.sum32_4,c=i.sum32_5,u=s.ch32,l=s.maj32,f=s.s0_256,d=s.s1_256,p=s.g0_256,g=s.g1_256,y=n.BlockHash,m=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function v(){if(!(this instanceof v))return new v;y.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=m,this.W=new Array(64)}i.inherits(v,y),e.exports=v,v.blockSize=512,v.outSize=256,v.hmacStrength=192,v.padLength=64,v.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;i{var i=r(6436),n=r(5900);function s(){if(!(this instanceof s))return new s;n.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}i.inherits(s,n),e.exports=s,s.blockSize=1024,s.outSize=384,s.hmacStrength=192,s.padLength=128,s.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h.slice(0,12),"big"):i.split32(this.h.slice(0,12),"big")}},5900:(e,t,r)=>{var i=r(6436),n=r(5772),s=r(9746),o=i.rotr64_hi,a=i.rotr64_lo,h=i.shr64_hi,c=i.shr64_lo,u=i.sum64,l=i.sum64_hi,f=i.sum64_lo,d=i.sum64_4_hi,p=i.sum64_4_lo,g=i.sum64_5_hi,y=i.sum64_5_lo,m=n.BlockHash,v=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function w(){if(!(this instanceof w))return new w;m.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=v,this.W=new Array(160)}function b(e,t,r,i,n){var s=e&r^~e&n;return s<0&&(s+=4294967296),s}function _(e,t,r,i,n,s){var o=t&i^~t&s;return o<0&&(o+=4294967296),o}function E(e,t,r,i,n){var s=e&r^e&n^r&n;return s<0&&(s+=4294967296),s}function S(e,t,r,i,n,s){var o=t&i^t&s^i&s;return o<0&&(o+=4294967296),o}function I(e,t){var r=o(e,t,28)^o(t,e,2)^o(t,e,7);return r<0&&(r+=4294967296),r}function M(e,t){var r=a(e,t,28)^a(t,e,2)^a(t,e,7);return r<0&&(r+=4294967296),r}function A(e,t){var r=a(e,t,14)^a(e,t,18)^a(t,e,9);return r<0&&(r+=4294967296),r}function O(e,t){var r=o(e,t,1)^o(e,t,8)^h(e,t,7);return r<0&&(r+=4294967296),r}function x(e,t){var r=a(e,t,1)^a(e,t,8)^c(e,t,7);return r<0&&(r+=4294967296),r}function P(e,t){var r=a(e,t,19)^a(t,e,29)^c(e,t,6);return r<0&&(r+=4294967296),r}i.inherits(w,m),e.exports=w,w.blockSize=1024,w.outSize=512,w.hmacStrength=192,w.padLength=128,w.prototype._prepareBlock=function(e,t){for(var r=this.W,i=0;i<32;i++)r[i]=e[t+i];for(;i{var i=r(6436).rotr32;function n(e,t,r){return e&t^~e&r}function s(e,t,r){return e&t^e&r^t&r}function o(e,t,r){return e^t^r}t.ft_1=function(e,t,r,i){return 0===e?n(t,r,i):1===e||3===e?o(t,r,i):2===e?s(t,r,i):void 0},t.ch32=n,t.maj32=s,t.p32=o,t.s0_256=function(e){return i(e,2)^i(e,13)^i(e,22)},t.s1_256=function(e){return i(e,6)^i(e,11)^i(e,25)},t.g0_256=function(e){return i(e,7)^i(e,18)^e>>>3},t.g1_256=function(e){return i(e,17)^i(e,19)^e>>>10}},6436:(e,t,r)=>{var i=r(9746),n=r(5717);function s(e,t){return 55296==(64512&e.charCodeAt(t))&&!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1))}function o(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function a(e){return 1===e.length?"0"+e:e}function h(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=n,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n>6|192,r[i++]=63&o|128):s(e,n)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++n)),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=63&o|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=63&o|128)}else for(n=0;n>>0}return o},t.split32=function(e,t){for(var r=new Array(4*e.length),i=0,n=0;i>>24,r[n+1]=s>>>16&255,r[n+2]=s>>>8&255,r[n+3]=255&s):(r[n+3]=s>>>24,r[n+2]=s>>>16&255,r[n+1]=s>>>8&255,r[n]=255&s)}return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,i){return e+t+r+i>>>0},t.sum32_5=function(e,t,r,i,n){return e+t+r+i+n>>>0},t.sum64=function(e,t,r,i){var n=e[t],s=i+e[t+1]>>>0,o=(s>>0,e[t+1]=s},t.sum64_hi=function(e,t,r,i){return(t+i>>>0>>0},t.sum64_lo=function(e,t,r,i){return t+i>>>0},t.sum64_4_hi=function(e,t,r,i,n,s,o,a){var h=0,c=t;return h+=(c=c+i>>>0)>>0)>>0)>>0},t.sum64_4_lo=function(e,t,r,i,n,s,o,a){return t+i+s+a>>>0},t.sum64_5_hi=function(e,t,r,i,n,s,o,a,h,c){var u=0,l=t;return u+=(l=l+i>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function(e,t,r,i,n,s,o,a,h,c){return t+i+s+a+c>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},5717:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},204:(e,t,r)=>{e.exports=self.fetch||(self.fetch=r(5869).default||r(5869))},1094:(e,t,r)=>{var i;!function(){var n="input is invalid type",s="object"==typeof window,o=s?window:{};o.JS_SHA3_NO_WINDOW&&(s=!1);var a=!s&&"object"==typeof self;!o.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?o=r.g:a&&(o=self);var h=!o.JS_SHA3_NO_COMMON_JS&&e.exports,c=r.amdO,u=!o.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,l="0123456789abcdef".split(""),f=[4,1024,262144,67108864],d=[0,8,16,24],p=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],g=[224,256,384,512],y=[128,256],m=["hex","buffer","arrayBuffer","array","digest"],v={128:168,256:136};!o.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!u||!o.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var w=function(e,t,r){return function(i){return new C(e,t,e).update(i)[r]()}},b=function(e,t,r){return function(i,n){return new C(e,t,n).update(i)[r]()}},_=function(e,t,r){return function(t,i,n,s){return A["cshake"+e].update(t,i,n,s)[r]()}},E=function(e,t,r){return function(t,i,n,s){return A["kmac"+e].update(t,i,n,s)[r]()}},S=function(e,t,r,i){for(var n=0;n>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var i=0;i<50;++i)this.s[i]=0}function U(e,t,r){C.call(this,e,t,r)}C.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(n);if(null===e)throw new Error(n);if(u&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||u&&ArrayBuffer.isView(e)))throw new Error(n);t=!0}for(var i,s,o=this.blocks,a=this.byteCount,h=e.length,c=this.blockCount,l=0,f=this.s;l>2]|=e[l]<>2]|=s<>2]|=(192|s>>6)<>2]|=(128|63&s)<=57344?(o[i>>2]|=(224|s>>12)<>2]|=(128|s>>6&63)<>2]|=(128|63&s)<>2]|=(240|s>>18)<>2]|=(128|s>>12&63)<>2]|=(128|s>>6&63)<>2]|=(128|63&s)<=a){for(this.start=i-a,this.block=o[c],i=0;i>=8);r>0;)n.unshift(r),r=255&(e>>=8),++i;return t?n.push(i):n.unshift(i),this.update(n),n.length},C.prototype.encodeString=function(e){var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(n);if(null===e)throw new Error(n);if(u&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||u&&ArrayBuffer.isView(e)))throw new Error(n);t=!0}var i=0,s=e.length;if(t)i=s;else for(var o=0;o=57344?i+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++o)),i+=4)}return i+=this.encode(8*i),this.update(e),i},C.prototype.bytepad=function(e,t){for(var r=this.encode(t),i=0;i>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t>4&15]+l[15&e]+l[e>>12&15]+l[e>>8&15]+l[e>>20&15]+l[e>>16&15]+l[e>>28&15]+l[e>>24&15];o%t==0&&(j(r),s=0)}return n&&(e=r[s],a+=l[e>>4&15]+l[15&e],n>1&&(a+=l[e>>12&15]+l[e>>8&15]),n>2&&(a+=l[e>>20&15]+l[e>>16&15])),a},C.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,i=this.outputBlocks,n=this.extraBytes,s=0,o=0,a=this.outputBits>>3;e=n?new ArrayBuffer(i+1<<2):new ArrayBuffer(a);for(var h=new Uint32Array(e);o>8&255,h[e+2]=t>>16&255,h[e+3]=t>>24&255;a%r==0&&j(i)}return s&&(e=a<<2,t=i[o],h[e]=255&t,s>1&&(h[e+1]=t>>8&255),s>2&&(h[e+2]=t>>16&255)),h},U.prototype=new C,U.prototype.finalize=function(){return this.encode(this.outputBits,!0),C.prototype.finalize.call(this)};var j=function(e){var t,r,i,n,s,o,a,h,c,u,l,f,d,g,y,m,v,w,b,_,E,S,I,M,A,O,x,P,N,R,T,L,C,U,j,k,q,D,z,$,B,K,F,V,H,W,G,J,Y,X,Q,Z,ee,te,re,ie,ne,se,oe,ae,he,ce,ue;for(i=0;i<48;i+=2)n=e[0]^e[10]^e[20]^e[30]^e[40],s=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],h=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],u=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],t=(f=e[8]^e[18]^e[28]^e[38]^e[48])^(o<<1|a>>>31),r=(d=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|o>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=n^(h<<1|c>>>31),r=s^(c<<1|h>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=o^(u<<1|l>>>31),r=a^(l<<1|u>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=h^(f<<1|d>>>31),r=c^(d<<1|f>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=u^(n<<1|s>>>31),r=l^(s<<1|n>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,g=e[0],y=e[1],W=e[11]<<4|e[10]>>>28,G=e[10]<<4|e[11]>>>28,P=e[20]<<3|e[21]>>>29,N=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,he=e[30]<<9|e[31]>>>23,K=e[40]<<18|e[41]>>>14,F=e[41]<<18|e[40]>>>14,U=e[2]<<1|e[3]>>>31,j=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,v=e[12]<<12|e[13]>>>20,J=e[22]<<10|e[23]>>>22,Y=e[23]<<10|e[22]>>>22,R=e[33]<<13|e[32]>>>19,T=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,ue=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,k=e[14]<<6|e[15]>>>26,q=e[15]<<6|e[14]>>>26,w=e[25]<<11|e[24]>>>21,b=e[24]<<11|e[25]>>>21,X=e[34]<<15|e[35]>>>17,Q=e[35]<<15|e[34]>>>17,L=e[45]<<29|e[44]>>>3,C=e[44]<<29|e[45]>>>3,M=e[6]<<28|e[7]>>>4,A=e[7]<<28|e[6]>>>4,ie=e[17]<<23|e[16]>>>9,ne=e[16]<<23|e[17]>>>9,D=e[26]<<25|e[27]>>>7,z=e[27]<<25|e[26]>>>7,_=e[36]<<21|e[37]>>>11,E=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,V=e[8]<<27|e[9]>>>5,H=e[9]<<27|e[8]>>>5,O=e[18]<<20|e[19]>>>12,x=e[19]<<20|e[18]>>>12,se=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,$=e[38]<<8|e[39]>>>24,B=e[39]<<8|e[38]>>>24,S=e[48]<<14|e[49]>>>18,I=e[49]<<14|e[48]>>>18,e[0]=g^~m&w,e[1]=y^~v&b,e[10]=M^~O&P,e[11]=A^~x&N,e[20]=U^~k&D,e[21]=j^~q&z,e[30]=V^~W&J,e[31]=H^~G&Y,e[40]=te^~ie&se,e[41]=re^~ne&oe,e[2]=m^~w&_,e[3]=v^~b&E,e[12]=O^~P&R,e[13]=x^~N&T,e[22]=k^~D&$,e[23]=q^~z&B,e[32]=W^~J&X,e[33]=G^~Y&Q,e[42]=ie^~se&ae,e[43]=ne^~oe&he,e[4]=w^~_&S,e[5]=b^~E&I,e[14]=P^~R&L,e[15]=N^~T&C,e[24]=D^~$&K,e[25]=z^~B&F,e[34]=J^~X&Z,e[35]=Y^~Q&ee,e[44]=se^~ae&ce,e[45]=oe^~he&ue,e[6]=_^~S&g,e[7]=E^~I&y,e[16]=R^~L&M,e[17]=T^~C&A,e[26]=$^~K&U,e[27]=B^~F&j,e[36]=X^~Z&V,e[37]=Q^~ee&H,e[46]=ae^~ce&te,e[47]=he^~ue&re,e[8]=S^~g&m,e[9]=I^~y&v,e[18]=L^~M&O,e[19]=C^~A&x,e[28]=K^~U&k,e[29]=F^~j&q,e[38]=Z^~V&W,e[39]=ee^~H&G,e[48]=ce^~te&ie,e[49]=ue^~re&ne,e[0]^=p[i],e[1]^=p[i+1]};if(h)e.exports=A;else{for(x=0;x{e=r.nmd(e);var i="__lodash_hash_undefined__",n=1,s=2,o=9007199254740991,a="[object Arguments]",h="[object Array]",c="[object AsyncFunction]",u="[object Boolean]",l="[object Date]",f="[object Error]",d="[object Function]",p="[object GeneratorFunction]",g="[object Map]",y="[object Number]",m="[object Null]",v="[object Object]",w="[object Promise]",b="[object Proxy]",_="[object RegExp]",E="[object Set]",S="[object String]",I="[object Undefined]",M="[object WeakMap]",A="[object ArrayBuffer]",O="[object DataView]",x=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,N={};N["[object Float32Array]"]=N["[object Float64Array]"]=N["[object Int8Array]"]=N["[object Int16Array]"]=N["[object Int32Array]"]=N["[object Uint8Array]"]=N["[object Uint8ClampedArray]"]=N["[object Uint16Array]"]=N["[object Uint32Array]"]=!0,N[a]=N[h]=N[A]=N[u]=N[O]=N[l]=N[f]=N[d]=N[g]=N[y]=N[v]=N[_]=N[E]=N[S]=N[M]=!1;var R="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,T="object"==typeof self&&self&&self.Object===Object&&self,L=R||T||Function("return this")(),C=t&&!t.nodeType&&t,U=C&&e&&!e.nodeType&&e,j=U&&U.exports===C,k=j&&R.process,q=function(){try{return k&&k.binding&&k.binding("util")}catch(e){}}(),D=q&&q.isTypedArray;function z(e,t){for(var r=-1,i=null==e?0:e.length;++rc))return!1;var l=a.get(e);if(l&&a.get(t))return l==t;var f=-1,d=!0,p=r&s?new Ae:void 0;for(a.set(e,t),a.set(t,e);++f-1},Ie.prototype.set=function(e,t){var r=this.__data__,i=xe(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this},Me.prototype.clear=function(){this.size=0,this.__data__={hash:new Se,map:new(le||Ie),string:new Se}},Me.prototype.delete=function(e){var t=Ce(this,e).delete(e);return this.size-=t?1:0,t},Me.prototype.get=function(e){return Ce(this,e).get(e)},Me.prototype.has=function(e){return Ce(this,e).has(e)},Me.prototype.set=function(e,t){var r=Ce(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this},Ae.prototype.add=Ae.prototype.push=function(e){return this.__data__.set(e,i),this},Ae.prototype.has=function(e){return this.__data__.has(e)},Oe.prototype.clear=function(){this.__data__=new Ie,this.size=0},Oe.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Oe.prototype.get=function(e){return this.__data__.get(e)},Oe.prototype.has=function(e){return this.__data__.has(e)},Oe.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Ie){var i=r.__data__;if(!le||i.length<199)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new Me(i)}return r.set(e,t),this.size=r.size,this};var je=ae?function(e){return null==e?[]:(e=Object(e),function(t,r){for(var i=-1,n=null==t?0:t.length,s=0,o=[];++i-1&&e%1==0&&e-1&&e%1==0&&e<=o}function He(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function We(e){return null!=e&&"object"==typeof e}var Ge=D?function(e){return function(t){return e(t)}}(D):function(e){return We(e)&&Ve(e.length)&&!!N[Pe(e)]};function Je(e){return null!=(t=e)&&Ve(t.length)&&!Fe(t)?function(e,t){var r=Be(e),i=!r&&$e(e),n=!r&&!i&&Ke(e),s=!r&&!i&&!n&&Ge(e),o=r||i||n||s,a=o?function(e,t){for(var r=-1,i=Array(e);++r{function t(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=t,t.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},7563:(e,t,r)=>{const i=r(610),n=r(4020),s=r(500),o=r(2806),a=Symbol("encodeFragmentIdentifier");function h(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function c(e,t){return t.encode?t.strict?i(e):encodeURIComponent(e):e}function u(e,t){return t.decode?n(e):e}function l(e){return Array.isArray(e)?e.sort():"object"==typeof e?l(Object.keys(e)).sort(((e,t)=>Number(e)-Number(t))).map((t=>e[t])):e}function f(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function d(e){const t=(e=f(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function p(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function g(e,t){h((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,i)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===i[e]&&(i[e]={}),i[e][t[1]]=r):i[e]=r};case"bracket":return(e,r,i)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==i[e]?i[e]=[].concat(i[e],r):i[e]=[r]:i[e]=r};case"colon-list-separator":return(e,r,i)=>{t=/(:list)$/.exec(e),e=e.replace(/:list$/,""),t?void 0!==i[e]?i[e]=[].concat(i[e],r):i[e]=[r]:i[e]=r};case"comma":case"separator":return(t,r,i)=>{const n="string"==typeof r&&r.includes(e.arrayFormatSeparator),s="string"==typeof r&&!n&&u(r,e).includes(e.arrayFormatSeparator);r=s?u(r,e):r;const o=n||s?r.split(e.arrayFormatSeparator).map((t=>u(t,e))):null===r?r:u(r,e);i[t]=o};case"bracket-separator":return(t,r,i)=>{const n=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!n)return void(i[t]=r?u(r,e):r);const s=null===r?[]:r.split(e.arrayFormatSeparator).map((t=>u(t,e)));void 0!==i[t]?i[t]=[].concat(i[t],s):i[t]=s};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),i=Object.create(null);if("string"!=typeof e)return i;if(!(e=e.trim().replace(/^[?#&]/,"")))return i;for(const n of e.split("&")){if(""===n)continue;let[e,o]=s(t.decode?n.replace(/\+/g," "):n,"=");o=void 0===o?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?o:u(o,t),r(u(e,t),o,i)}for(const e of Object.keys(i)){const r=i[e];if("object"==typeof r&&null!==r)for(const e of Object.keys(r))r[e]=p(r[e],t);else i[e]=p(r,t)}return!1===t.sort?i:(!0===t.sort?Object.keys(i).sort():Object.keys(i).sort(t.sort)).reduce(((e,t)=>{const r=i[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?e[t]=l(r):e[t]=r,e}),Object.create(null))}t.extract=d,t.parse=g,t.stringify=(e,t)=>{if(!e)return"";h((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],i=function(e){switch(e.arrayFormat){case"index":return t=>(r,i)=>{const n=r.length;return void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?r:null===i?[...r,[c(t,e),"[",n,"]"].join("")]:[...r,[c(t,e),"[",c(n,e),"]=",c(i,e)].join("")]};case"bracket":return t=>(r,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?r:null===i?[...r,[c(t,e),"[]"].join("")]:[...r,[c(t,e),"[]=",c(i,e)].join("")];case"colon-list-separator":return t=>(r,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?r:null===i?[...r,[c(t,e),":list="].join("")]:[...r,[c(t,e),":list=",c(i,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t="bracket-separator"===e.arrayFormat?"[]=":"=";return r=>(i,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?i:(n=null===n?"":n,0===i.length?[[c(r,e),t,c(n,e)].join("")]:[[i,c(n,e)].join(e.arrayFormatSeparator)])}default:return t=>(r,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?r:null===i?[...r,c(t,e)]:[...r,[c(t,e),"=",c(i,e)].join("")]}}(t),n={};for(const t of Object.keys(e))r(t)||(n[t]=e[t]);const s=Object.keys(n);return!1!==t.sort&&s.sort(t.sort),s.map((r=>{const n=e[r];return void 0===n?"":null===n?c(r,t):Array.isArray(n)?0===n.length&&"bracket-separator"===t.arrayFormat?c(r,t)+"[]":n.reduce(i(r),[]).join("&"):c(r,t)+"="+c(n,t)})).filter((e=>e.length>0)).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,i]=s(e,"#");return Object.assign({url:r.split("?")[0]||"",query:g(d(e),t)},t&&t.parseFragmentIdentifier&&i?{fragmentIdentifier:u(i,t)}:{})},t.stringifyUrl=(e,r)=>{r=Object.assign({encode:!0,strict:!0,[a]:!0},r);const i=f(e.url).split("?")[0]||"",n=t.extract(e.url),s=t.parse(n,{sort:!1}),o=Object.assign(s,e.query);let h=t.stringify(o,r);h&&(h=`?${h}`);let u=function(e){let t="";const r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(e.url);return e.fragmentIdentifier&&(u=`#${r[a]?c(e.fragmentIdentifier,r):e.fragmentIdentifier}`),`${i}${h}${u}`},t.pick=(e,r,i)=>{i=Object.assign({parseFragmentIdentifier:!0,[a]:!1},i);const{url:n,query:s,fragmentIdentifier:h}=t.parseUrl(e,i);return t.stringifyUrl({url:n,query:o(s,r),fragmentIdentifier:h},i)},t.exclude=(e,r,i)=>{const n=Array.isArray(r)?e=>!r.includes(e):(e,t)=>!r(e,t);return t.pick(e,n,i)}},5346:e=>{function t(e){try{return JSON.stringify(e)}catch(e){return'"[Circular]"'}}e.exports=function(e,r,i){var n=i&&i.stringify||t;if("object"==typeof e&&null!==e){var s=r.length+1;if(1===s)return e;var o=new Array(s);o[0]=n(e);for(var a=1;a-1?l:0,e.charCodeAt(d+1)){case 100:case 102:if(u>=h)break;if(null==r[u])break;l=h)break;if(null==r[u])break;l=h)break;if(void 0===r[u])break;l",l=d+2,d++;break}c+=n(r[u]),l=d+2,d++;break;case 115:if(u>=h)break;l{Object.defineProperty(t,"__esModule",{value:!0}),t.safeJsonParse=function(e){if("string"!=typeof e)throw new Error("Cannot safe json parse value of type "+typeof e);try{return JSON.parse(e)}catch(t){return e}},t.safeJsonStringify=function(e){return"string"==typeof e?e:JSON.stringify(e,((e,t)=>void 0===t?null:t))}},500:e=>{e.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const r=e.indexOf(t);return-1===r?[e]:[e.slice(0,r),e.slice(r+t.length)]}},610:e=>{e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`))},655:(e,t,r)=>{r.r(t),r.d(t,{__assign:()=>s,__asyncDelegator:()=>b,__asyncGenerator:()=>w,__asyncValues:()=>_,__await:()=>v,__awaiter:()=>u,__classPrivateFieldGet:()=>M,__classPrivateFieldSet:()=>A,__createBinding:()=>f,__decorate:()=>a,__exportStar:()=>d,__extends:()=>n,__generator:()=>l,__importDefault:()=>I,__importStar:()=>S,__makeTemplateObject:()=>E,__metadata:()=>c,__param:()=>h,__read:()=>g,__rest:()=>o,__spread:()=>y,__spreadArrays:()=>m,__values:()=>p});var i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},i(e,t)};function n(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(){return s=Object.assign||function(e){for(var t,r=1,i=arguments.length;r=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}function h(e,t){return function(r,i){t(r,i,e)}}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function u(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{h(i.next(e))}catch(e){s(e)}}function a(e){try{h(i.throw(e))}catch(e){s(e)}}function h(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}h((i=i.apply(e,t||[])).next())}))}function l(e,t){var r,i,n,s,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((n=(n=o.trys).length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return o}function y(){for(var e=[],t=0;t1||a(e,t)}))})}function a(e,t){try{(r=n[e](t)).value instanceof v?Promise.resolve(r.value.v).then(h,c):u(s[0][2],r)}catch(e){u(s[0][3],e)}var r}function h(e){a("next",e)}function c(e){a("throw",e)}function u(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function b(e){var t,r;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,n){t[i]=e[i]?function(t){return(r=!r)?{value:v(e[i](t)),done:"return"===i}:n?n(t):t}:n}}function _(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=p(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise((function(i,n){!function(e,t,r,i){Promise.resolve(i).then((function(t){e({value:t,done:r})}),t)}(i,n,(t=e[r](t)).done,t.value)}))}}}function E(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function S(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function I(e){return e&&e.__esModule?e:{default:e}}function M(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function A(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r}},5869:(e,t,r)=>{function i(e,t){return t=t||{},new Promise((function(r,i){var n=new XMLHttpRequest,s=[],o=[],a={},h=function(){return{ok:2==(n.status/100|0),statusText:n.statusText,status:n.status,url:n.responseURL,text:function(){return Promise.resolve(n.responseText)},json:function(){return Promise.resolve(n.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([n.response]))},clone:h,headers:{keys:function(){return s},entries:function(){return o},get:function(e){return a[e.toLowerCase()]},has:function(e){return e.toLowerCase()in a}}}};for(var c in n.open(t.method||"get",e,!0),n.onload=function(){n.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,r){s.push(t=t.toLowerCase()),o.push([t,r]),a[t]=a[t]?a[t]+","+r:r})),r(h())},n.onerror=i,n.withCredentials="include"==t.credentials,t.headers)n.setRequestHeader(c,t.headers[c]);n.send(t.body||null)}))}r.r(t),r.d(t,{default:()=>i})},4429:e=>{function t(e,r,i){this.__id__=e,i.objects[e]=this,this.__objectSignals__={},this.__propertyCache__={};var n=this;function s(e,t){var r=e[0],s=e[1];n[r]={connect:function(e){"function"==typeof e?(n.__objectSignals__[s]=n.__objectSignals__[s]||[],n.__objectSignals__[s].push(e),t||"destroyed"!==r&&"destroyed()"!==r&&"destroyed(QObject*)"!==r&&1==n.__objectSignals__[s].length&&i.exec({type:7,object:n.__id__,signal:s})):console.error("Bad callback given to connect to signal "+r)},disconnect:function(e){if("function"==typeof e){n.__objectSignals__[s]=n.__objectSignals__[s]||[];var o=n.__objectSignals__[s].indexOf(e);-1!==o?(n.__objectSignals__[s].splice(o,1),t||0!==n.__objectSignals__[s].length||i.exec({type:8,object:n.__id__,signal:s})):console.error("Cannot find connection of signal "+r+" to "+e.name)}else console.error("Bad callback given to disconnect from signal "+r)}}}function o(e,t){var r=n.__objectSignals__[e];r&&r.forEach((function(e){e.apply(e,t)}))}this.unwrapQObject=function(e){if(e instanceof Array)return e.map((e=>n.unwrapQObject(e)));if(!(e instanceof Object))return e;if(!e["__QObject*__"]||void 0===e.id){var r={};for(const t of Object.keys(e))r[t]=n.unwrapQObject(e[t]);return r}var s=e.id;if(i.objects[s])return i.objects[s];if(e.data){var o=new t(s,e.data,i);return o.destroyed.connect((function(){i.objects[s]===o&&(delete i.objects[s],Object.keys(o).forEach((e=>delete o[e])))})),o.unwrapProperties(),o}console.error("Cannot unwrap unknown QObject "+s+" without data.")},this.unwrapProperties=function(){for(const e of Object.keys(n.__propertyCache__))n.__propertyCache__[e]=n.unwrapQObject(n.__propertyCache__[e])},this.propertyUpdate=function(e,t){for(const e of Object.keys(t)){var r=t[e];n.__propertyCache__[e]=this.unwrapQObject(r)}for(const t of Object.keys(e))o(t,e[t])},this.signalEmitted=function(e,t){o(e,this.unwrapQObject(t))},r.methods.forEach((function(e){var r=e[0],s=e[1],o=")"===r[r.length-1]?s:r;n[r]=function(){for(var e,r,s,a=[],h=0;h{var t=i.objects[e.object];t?t.propertyUpdate(e.signals,e.properties):console.warn("Unhandled property update: "+e.object+"::"+e.signal)})),i.exec({type:4})},this.debug=function(e){i.send({type:5,data:e})},i.exec({type:3},(function(e){for(const r of Object.keys(e))new t(r,e[r],i);for(const e of Object.keys(i.objects))i.objects[e].unwrapProperties();r&&r(i),i.exec({type:4})}))}else console.error("The QWebChannel expects a transport object with a send function and onmessage callback property. Given is: transport: "+typeof e+", transport.send: "+typeof e.send)}}},5883:()=>{},6601:()=>{},6559:(e,t,r)=>{const i=r(5346);e.exports=o;const n=function(){function e(e){return void 0!==e&&e}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(t){return e(self)||e(window)||e(this)||{}}}().console||{},s={mapHttpRequest:f,mapHttpResponse:f,wrapRequestSerializer:d,wrapResponseSerializer:d,wrapErrorSerializer:d,req:f,res:f,err:function(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const r in e)void 0===t[r]&&(t[r]=e[r]);return t}};function o(e){(e=e||{}).browser=e.browser||{};const t=e.browser.transmit;if(t&&"function"!=typeof t.send)throw Error("pino: transmit option must have a send function");const r=e.browser.write||n;e.browser.write&&(e.browser.asObject=!0);const i=e.serializers||{},s=function(e,t){return Array.isArray(e)?e.filter((function(e){return"!stdSerializers.err"!==e})):!0===e&&Object.keys(t)}(e.browser.serialize,i);let f=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(f=!1),"function"==typeof r&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),!1===e.enabled&&(e.level="silent");const d=e.level||"info",g=Object.create(r);g.log||(g.log=p),Object.defineProperty(g,"levelVal",{get:function(){return"silent"===this.level?1/0:this.levels.values[this.level]}}),Object.defineProperty(g,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,a(y,g,"error","log"),a(y,g,"fatal","error"),a(y,g,"warn","error"),a(y,g,"info","log"),a(y,g,"debug","log"),a(y,g,"trace","log")}});const y={transmit:t,serialize:s,asObject:e.browser.asObject,levels:["error","fatal","warn","info","debug","trace"],timestamp:l(e)};return g.levels=o.levels,g.level=d,g.setMaxListeners=g.getMaxListeners=g.emit=g.addListener=g.on=g.prependListener=g.once=g.prependOnceListener=g.removeListener=g.removeAllListeners=g.listeners=g.listenerCount=g.eventNames=g.write=g.flush=p,g.serializers=i,g._serialize=s,g._stdErrSerialize=f,g.child=function(r,n){if(!r)throw new Error("missing bindings for child Pino");n=n||{},s&&r.serializers&&(n.serializers=r.serializers);const o=n.serializers;if(s&&o){var a=Object.assign({},i,o),l=!0===e.browser.serialize?Object.keys(a):s;delete r.serializers,h([r],l,a,this._stdErrSerialize)}function f(e){this._childLevel=1+(0|e._childLevel),this.error=c(e,r,"error"),this.fatal=c(e,r,"fatal"),this.warn=c(e,r,"warn"),this.info=c(e,r,"info"),this.debug=c(e,r,"debug"),this.trace=c(e,r,"trace"),a&&(this.serializers=a,this._serialize=l),t&&(this._logEvent=u([].concat(e._logEvent.bindings,r)))}return f.prototype=this,new f(this)},t&&(g._logEvent=u()),g}function a(e,t,r,s){const a=Object.getPrototypeOf(t);t[r]=t.levelVal>t.levels.values[r]?p:a[r]?a[r]:n[r]||n[s]||p,function(e,t,r){var s;(e.transmit||t[r]!==p)&&(t[r]=(s=t[r],function(){const a=e.timestamp(),c=new Array(arguments.length),l=Object.getPrototypeOf&&Object.getPrototypeOf(this)===n?n:this;for(var f=0;f-1&&i in r&&(e[n][i]=r[i](e[n][i]))}function c(e,t,r){return function(){const i=new Array(1+arguments.length);i[0]=t;for(var n=1;n{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e={};r.r(e),r.d(e,{identity:()=>se});var t={};r.r(t),r.d(t,{base2:()=>oe});var i={};r.r(i),r.d(i,{base8:()=>ae});var n={};r.r(n),r.d(n,{base10:()=>he});var s={};r.r(s),r.d(s,{base16:()=>ce,base16upper:()=>ue});var o={};r.r(o),r.d(o,{base32:()=>le,base32hex:()=>ge,base32hexpad:()=>me,base32hexpadupper:()=>ve,base32hexupper:()=>ye,base32pad:()=>de,base32padupper:()=>pe,base32upper:()=>fe,base32z:()=>we});var a={};r.r(a),r.d(a,{base36:()=>be,base36upper:()=>_e});var h={};r.r(h),r.d(h,{base58btc:()=>Ee,base58flickr:()=>Se});var c={};r.r(c),r.d(c,{base64:()=>Ie,base64pad:()=>Me,base64url:()=>Ae,base64urlpad:()=>Oe});var u={};r.r(u),r.d(u,{base256emoji:()=>Re});var l={};r.r(l),r.d(l,{sha256:()=>Ze,sha512:()=>et});var f={};r.r(f),r.d(f,{identity:()=>rt});var d={};r.r(d),r.d(d,{code:()=>nt,decode:()=>ot,encode:()=>st,name:()=>it});var p={};r.r(p),r.d(p,{code:()=>ut,decode:()=>ft,encode:()=>lt,name:()=>ct});var g=r(7187),y=r.n(g),m=r(5150),v=r(159),w=r(9107),b=r(8200);class _ extends b.q{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class E extends b.q{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}}class S{constructor(e,t){this.logger=e,this.core=t}}class I extends b.q{constructor(e,t){super(),this.relayer=e,this.logger=t}}class M extends b.q{constructor(e){super()}}class A{constructor(e,t,r,i){this.core=e,this.logger=t,this.name=r}}class O extends b.q{constructor(e,t){super(),this.relayer=e,this.logger=t}}class x extends b.q{constructor(e,t){super(),this.core=e,this.logger=t}}class P{constructor(e,t){this.projectId=e,this.logger=t}}class N{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class R{constructor(e){this.client=e}}const T=e=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString()+"n":t));function L(e){if("string"!=typeof e)throw new Error("Cannot safe json parse value of type "+typeof e);try{return(e=>{const t=e.replace(/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,'$1"$2n"$3');return JSON.parse(t,((e,t)=>"string"==typeof t&&t.match(/^\d+n$/)?BigInt(t.substring(0,t.length-1)):t))})(e)}catch(t){return e}}function C(e){return"string"==typeof e?e:T(e)||""}var U=r(1050),j=r(1416),k=r(6736);const q="base64url",D="utf8",z=":",$="did",B="key",K="base58btc",F="z",V="K36";function H(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function W(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?H(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function G(e,t){t||(t=e.reduce(((e,t)=>e+t.length),0));const r=W(t);let i=0;for(const t of e)r.set(t,i),i+=t.length;return H(r)}const J=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i>>0,o=new Uint8Array(s);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var l=0,f=s-1;(0!==u||l>>0,o[f]=u%256>>>0,u=u/256>>>0;if(0!==u)throw new Error("Non-zero carry");n=l,t++}if(" "!==e[t]){for(var d=s-n;d!==s&&0===o[d];)d++;for(var p=new Uint8Array(i+(s-d)),g=i;d!==s;)p[g++]=o[d++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,i=0,n=0,s=t.length;n!==s&&0===t[n];)n++,r++;for(var o=(s-n)*u+1>>>0,c=new Uint8Array(o);n!==s;){for(var l=t[n],f=0,d=o-1;(0!==l||f>>0,c[d]=l%a>>>0,l=l/a>>>0;if(0!==l)throw new Error("Non-zero carry");i=f,n++}for(var p=o-i;p!==o&&0===c[p];)p++;for(var g=h.repeat(r);p{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")});class X{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Q{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return ee(this,e)}}class Z{constructor(e){this.decoders=e}or(e){return ee(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const ee=(e,t)=>new Z({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class te{constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new X(e,t,r),this.decoder=new Q(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const re=({name:e,prefix:t,encode:r,decode:i})=>new te(e,t,r,i),ie=({prefix:e,name:t,alphabet:r})=>{const{encode:i,decode:n}=J(r,t);return re({prefix:e,name:t,encode:i,decode:e=>Y(n(e))})},ne=({name:e,prefix:t,bitsPerChar:r,alphabet:i})=>re({prefix:t,name:e,encode:e=>((e,t,r)=>{const i="="===t[t.length-1],n=(1<r;)o-=r,s+=t[n&a>>o];if(o&&(s+=t[n&a<((e,t,r,i)=>{const n={};for(let e=0;e=8&&(a-=8,o[c++]=255&h>>a)}if(a>=r||255&h<<8-a)throw new SyntaxError("Unexpected end of data");return o})(t,i,r,e)}),se=re({prefix:"\0",name:"identity",encode:e=>(e=>(new TextDecoder).decode(e))(e),decode:e=>(e=>(new TextEncoder).encode(e))(e)}),oe=ne({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),ae=ne({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),he=ie({prefix:"9",name:"base10",alphabet:"0123456789"}),ce=ne({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ue=ne({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),le=ne({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),fe=ne({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),de=ne({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),pe=ne({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ge=ne({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ye=ne({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),me=ne({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ve=ne({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),we=ne({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),be=ie({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),_e=ie({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Ee=ie({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Se=ie({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Ie=ne({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Me=ne({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Ae=ne({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Oe=ne({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),xe=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Pe=xe.reduce(((e,t,r)=>(e[r]=t,e)),[]),Ne=xe.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]),Re=re({prefix:"🚀",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+Pe[t]),"")},decode:function(e){const t=[];for(const r of e){const e=Ne[r.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}});var Te=128,Le=-128,Ce=Math.pow(2,31),Ue=Math.pow(2,7),je=Math.pow(2,14),ke=Math.pow(2,21),qe=Math.pow(2,28),De=Math.pow(2,35),ze=Math.pow(2,42),$e=Math.pow(2,49),Be=Math.pow(2,56),Ke=Math.pow(2,63);const Fe=function e(t,r,i){r=r||[];for(var n=i=i||0;t>=Ce;)r[i++]=255&t|Te,t/=128;for(;t&Le;)r[i++]=255&t|Te,t>>>=7;return r[i]=0|t,e.bytes=i-n+1,r},Ve=function(e){return e(Fe(e,t,r),t),We=e=>Ve(e),Ge=(e,t)=>{const r=t.byteLength,i=We(e),n=i+We(r),s=new Uint8Array(n+r);return He(e,s,0),He(r,s,i),s.set(t,n),new Je(e,r,t,s)};class Je{constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i}}const Ye=({name:e,code:t,encode:r})=>new Xe(e,t,r);class Xe{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Ge(this.code,t):t.then((e=>Ge(this.code,e)))}throw Error("Unknown type, must be binary type")}}const Qe=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),Ze=Ye({name:"sha2-256",code:18,encode:Qe("SHA-256")}),et=Ye({name:"sha2-512",code:19,encode:Qe("SHA-512")}),tt=Y,rt={code:0,name:"identity",encode:tt,digest:e=>Ge(0,tt(e))},it="raw",nt=85,st=e=>Y(e),ot=e=>Y(e),at=new TextEncoder,ht=new TextDecoder,ct="json",ut=512,lt=e=>at.encode(JSON.stringify(e)),ft=e=>JSON.parse(ht.decode(e));Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom"),Symbol.for("@ipld/js-cid/CID");const dt={...e,...t,...i,...n,...s,...o,...a,...h,...c,...u};function pt(e,t,r,i){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:i}}}const gt=pt("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),yt=pt("ascii","a",(e=>{let t="a";for(let r=0;r{const t=W((e=e.substring(1)).length);for(let r=0;r"u")throw new Error("missing sender public key");if(typeof e?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:e?.senderPublicKey,receiverPublicKey:e?.receiverPublicKey}}function er(e){return 1===e.type&&"string"==typeof e.senderPublicKey&&"string"==typeof e.receiverPublicKey}var tr=Object.defineProperty,rr=Object.getOwnPropertySymbols,ir=Object.prototype.hasOwnProperty,nr=Object.prototype.propertyIsEnumerable,sr=(e,t,r)=>t in e?tr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,or=(e,t)=>{for(var r in t||(t={}))ir.call(t,r)&&sr(e,r,t[r]);if(rr)for(var r of rr(t))nr.call(t,r)&&sr(e,r,t[r]);return e};const ar="ReactNative",hr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},cr="js";function ur(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function lr(){return!(0,Dt.getDocument)()&&!!(0,Dt.getNavigator)()&&navigator.product===ar}function fr(){return!ur()&&!!(0,Dt.getNavigator)()}function dr(){return lr()?hr.reactNative:ur()?hr.node:fr()?hr.browser:hr.unknown}function pr(e,t,i){const n=function(){if(dr()===hr.reactNative&&typeof r.g<"u"&&typeof(null==r.g?void 0:r.g.Platform)<"u"){const{OS:e,Version:t}=r.g.Platform;return[e,t].join("-")}const e=t?kt(t):"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new Tt:"undefined"!=typeof navigator?kt(navigator.userAgent):"undefined"!=typeof process&&process.version?new Pt(process.version.slice(1)):null;var t;if(null===e)return"unknown";const i=e.os?e.os.replace(" ","").toLowerCase():"unknown";return"browser"===e.type?[i,e.name,e.version].join("-"):[i,e.version].join("-")}(),s=function(){var e;const t=dr();return t===hr.browser?[t,(null==(e=(0,Dt.getLocation)())?void 0:e.host)||"unknown"].join(":"):t}();return[[e,t].join("-"),[cr,i].join("-"),n,s].join("/")}function gr(e,t){return e.filter((e=>t.includes(e))).length===e.length}function yr(e){return Object.fromEntries(e.entries())}function mr(e){return new Map(Object.entries(e))}function vr(e=k.FIVE_MINUTES,t){const r=(0,k.toMiliseconds)(e||k.FIVE_MINUTES);let i,n,s;return{resolve:e=>{s&&i&&(clearTimeout(s),i(e))},reject:e=>{s&&n&&(clearTimeout(s),n(e))},done:()=>new Promise(((e,o)=>{s=setTimeout((()=>{o(new Error(t))}),r),i=e,n=o}))}}function wr(e,t,r){return new Promise((async(i,n)=>{const s=setTimeout((()=>n(new Error(r))),t);try{i(await e)}catch(e){n(e)}clearTimeout(s)}))}function br(e,t){if("string"==typeof t&&t.startsWith(`${e}:`))return t;if("topic"===e.toLowerCase()){if("string"!=typeof t)throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}if("id"===e.toLowerCase()){if("number"!=typeof t)throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${e}`)}function _r(e){const[t,r]=e.split(":"),i={id:void 0,topic:void 0};if("topic"===t&&"string"==typeof r)i.topic=r;else{if("id"!==t||!Number.isInteger(Number(r)))throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${r}`);i.id=Number(r)}return i}function Er(e,t){return(0,k.fromMiliseconds)((t||Date.now())+(0,k.toMiliseconds)(e))}function Sr(e){return Date.now()>=(0,k.toMiliseconds)(e)}function Ir(e,t){return`${e}${t?`:${t}`:""}`}function Mr(e=[],t=[]){return[...new Set([...e,...t])]}function Ar(e){return e?.relay||{protocol:"irn"}}function Or(e){const t=Bt[e];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${e}`);return t}var xr=Object.defineProperty,Pr=Object.getOwnPropertySymbols,Nr=Object.prototype.hasOwnProperty,Rr=Object.prototype.propertyIsEnumerable,Tr=(e,t,r)=>t in e?xr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;function Lr(e,t="-"){const r={},i="relay"+t;return Object.keys(e).forEach((t=>{if(t.startsWith(i)){const n=t.replace(i,""),s=e[t];r[n]=s}})),r}function Cr(e){return e.startsWith("//")?e.substring(2):e}var Ur=Object.defineProperty,jr=Object.defineProperties,kr=Object.getOwnPropertyDescriptors,qr=Object.getOwnPropertySymbols,Dr=Object.prototype.hasOwnProperty,zr=Object.prototype.propertyIsEnumerable,$r=(e,t,r)=>t in e?Ur(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Br=(e,t)=>{for(var r in t||(t={}))Dr.call(t,r)&&$r(e,r,t[r]);if(qr)for(var r of qr(t))zr.call(t,r)&&$r(e,r,t[r]);return e},Kr=(e,t)=>jr(e,kr(t));function Fr(e){const t=[];return e.forEach((e=>{const[r,i]=e.split(":");t.push(`${r}:${i}`)})),t}function Vr(e){return e.includes(":")}function Hr(e){return Vr(e)?e.split(":")[0]:e}function Wr(e){var t,r,i;const n={};if(!Zr(e))return n;for(const[s,o]of Object.entries(e)){const e=Vr(s)?[s]:o.chains,a=o.methods||[],h=o.events||[],c=Hr(s);n[c]=Kr(Br({},n[c]),{chains:Mr(e,null==(t=n[c])?void 0:t.chains),methods:Mr(a,null==(r=n[c])?void 0:r.methods),events:Mr(h,null==(i=n[c])?void 0:i.events)})}return n}const Gr={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}},Jr={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function Yr(e,t){const{message:r,code:i}=Jr[e];return{message:t?`${r} ${t}`:r,code:i}}function Xr(e,t){const{message:r,code:i}=Gr[e];return{message:t?`${r} ${t}`:r,code:i}}function Qr(e,t){return!!Array.isArray(e)&&(!(typeof t<"u"&&e.length)||e.every(t))}function Zr(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function ei(e){return typeof e>"u"}function ti(e,t){return!(!t||!ei(e))||"string"==typeof e&&!!e.trim().length}function ri(e,t){return!(!t||!ei(e))||"number"==typeof e&&!isNaN(e)}function ii(e){return!(!ti(e,!1)||!e.includes(":"))&&2===e.split(":").length}function ni(e){if(ti(e,!1))try{return typeof new URL(e)<"u"}catch{return!1}return!1}function si(e){let t=!0;return Qr(e)?e.length&&(t=e.every((e=>ti(e,!1)))):t=!1,t}function oi(e,t){let r=null;return Object.values(e).forEach((e=>{if(r)return;const i=function(e,t){let r=null;return si(e?.methods)?si(e?.events)||(r=Xr("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):r=Xr("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),r}(e,`${t}, namespace`);i&&(r=i)})),r}function ai(e,t){let r=null;if(e&&Zr(e)){const i=oi(e,t);i&&(r=i);const n=function(e,t){let r=null;return Object.values(e).forEach((e=>{if(r)return;const i=function(e,t){let r=null;return Qr(e)?e.forEach((e=>{r||function(e){if(ti(e,!1)&&e.includes(":")){const t=e.split(":");if(3===t.length){const e=t[0]+":"+t[1];return!!t[2]&&ii(e)}}return!1}(e)||(r=Xr("UNSUPPORTED_ACCOUNTS",`${t}, account ${e} should be a string and conform to "namespace:chainId:address" format`))})):r=Xr("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}(e?.accounts,`${t} namespace`);i&&(r=i)})),r}(e,t);n&&(r=n)}else r=Yr("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return r}function hi(e){return ti(e.protocol,!0)}function ci(e){return typeof e<"u"&&null!==typeof e}function ui(e,t){return!(!ii(t)||!function(e){const t=[];return Object.values(e).forEach((e=>{t.push(...Fr(e.accounts))})),t}(e).includes(t))}function li(e,t,r){let i=null;const n=function(e){const t={};return Object.keys(e).forEach((r=>{var i;r.includes(":")?t[r]=e[r]:null==(i=e[r].chains)||i.forEach((i=>{t[i]={methods:e[r].methods,events:e[r].events}}))})),t}(e),s=function(e){const t={};return Object.keys(e).forEach((r=>{if(r.includes(":"))t[r]=e[r];else{const i=Fr(e[r].accounts);i?.forEach((i=>{t[i]={accounts:e[r].accounts.filter((e=>e.includes(`${i}:`))),methods:e[r].methods,events:e[r].events}}))}})),t}(t),o=Object.keys(n),a=Object.keys(s),h=fi(Object.keys(e)),c=fi(Object.keys(t)),u=h.filter((e=>!c.includes(e)));return u.length&&(i=Yr("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces.\n Required: ${u.toString()}\n Received: ${Object.keys(t).toString()}`)),gr(o,a)||(i=Yr("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces.\n Required: ${o.toString()}\n Approved: ${a.toString()}`)),Object.keys(t).forEach((e=>{if(!e.includes(":")||i)return;const n=Fr(t[e].accounts);n.includes(e)||(i=Yr("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${e}\n Required: ${e}\n Approved: ${n.toString()}`))})),o.forEach((e=>{i||(gr(n[e].methods,s[e].methods)?gr(n[e].events,s[e].events)||(i=Yr("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${e}`)):i=Yr("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${e}`))})),i}function fi(e){return[...new Set(e.map((e=>e.includes(":")?e.split(":")[0]:e)))]}function di(e,t){return ri(e,!1)&&e<=t.max&&e>=t.min}function pi(){const e=dr();return new Promise((t=>{switch(e){case hr.browser:t(fr()&&navigator?.onLine);break;case hr.reactNative:t(async function(){if(lr()&&typeof r.g<"u"&&null!=r.g&&r.g.NetInfo){const e=await(null==r.g?void 0:r.g.NetInfo.fetch());return e?.isConnected}return!0}());break;case hr.node:default:t(!0)}}))}const gi={};class yi{static get(e){return gi[e]}static set(e,t){gi[e]=t}static delete(e){delete gi[e]}}const mi="INTERNAL_ERROR",vi="SERVER_ERROR",wi=[-32700,-32600,-32601,-32602,-32603],bi={PARSE_ERROR:{code:-32700,message:"Parse error"},INVALID_REQUEST:{code:-32600,message:"Invalid Request"},METHOD_NOT_FOUND:{code:-32601,message:"Method not found"},INVALID_PARAMS:{code:-32602,message:"Invalid params"},[mi]:{code:-32603,message:"Internal error"},[vi]:{code:-32e3,message:"Server error"}},_i=vi;function Ei(e){return Object.keys(bi).includes(e)?bi[e]:bi[_i]}var Si=r(1468);function Ii(e=3){return Date.now()*Math.pow(10,e)+Math.floor(Math.random()*Math.pow(10,e))}function Mi(e=6){return BigInt(Ii(e))}function Ai(e,t,r){return{id:r||Ii(),jsonrpc:"2.0",method:e,params:t}}function Oi(e,t){return{id:e,jsonrpc:"2.0",result:t}}function xi(e,t,r){return{id:e,jsonrpc:"2.0",error:Pi(t,r)}}function Pi(e,t){return void 0===e?Ei(mi):("string"==typeof e&&(e=Object.assign(Object.assign({},Ei(vi)),{message:e})),void 0!==t&&(e.data=t),r=e.code,wi.includes(r)&&(e=function(e){return Object.values(bi).find((t=>t.code===e))||bi[_i]}(e.code)),e);var r}class Ni{}class Ri extends Ni{constructor(){super()}}class Ti extends Ri{constructor(e){super()}}function Li(e){return function(e,t){const r=function(e){const t=e.match(new RegExp(/^\w+:/,"gi"));if(t&&t.length)return t[0]}(e);return void 0!==r&&new RegExp(t).test(r)}(e,"^wss?:")}function Ci(e){return new RegExp("wss?://localhost(:d{2,5})?").test(e)}function Ui(e){return"object"==typeof e&&"id"in e&&"jsonrpc"in e&&"2.0"===e.jsonrpc}function ji(e){return Ui(e)&&"method"in e}function ki(e){return Ui(e)&&(qi(e)||Di(e))}function qi(e){return"result"in e}function Di(e){return"error"in e}class zi extends Ti{constructor(e){super(e),this.events=new g.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,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(Ai(e.method,e.params||[],e.id||Mi().toString()),t)}async requestStrict(e,t){return new Promise((async(r,i)=>{if(!this.connection.connected)try{await this.open()}catch(e){i(e)}this.events.on(`${e.id}`,(e=>{Di(e)?i(e.error):r(e.result)}));try{await this.connection.send(e,t)}catch(e){i(e)}}))}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),ki(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&3e3===e.code&&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(),"string"==typeof e&&(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)}}const $i=e=>e.split("?")[0],Bi="undefined"!=typeof WebSocket?WebSocket:void 0!==r.g&&void 0!==r.g.WebSocket?r.g.WebSocket:"undefined"!=typeof window&&void 0!==window.WebSocket?window.WebSocket:"undefined"!=typeof self&&void 0!==self.WebSocket?self.WebSocket:r(2030),Ki=class{constructor(e){if(this.url=e,this.events=new g.EventEmitter,this.registering=!1,!Li(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return void 0!==this.socket}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise(((e,t)=>{void 0!==this.socket?(this.socket.onclose=t=>{this.onClose(t),e()},this.socket.close()):t(new Error("Connection already closed"))}))}async send(e,t){void 0===this.socket&&(this.socket=await this.register());try{this.socket.send(C(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!Li(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise(((e,t)=>{this.events.once("register_error",(e=>{this.resetMaxListeners(),t(e)})),this.events.once("open",(()=>{if(this.resetMaxListeners(),void 0===this.socket)return t(new Error("WebSocket connection is missing or invalid"));e(this.socket)}))}))}return this.url=e,this.registering=!0,new Promise(((t,i)=>{const n=(0,Si.isReactNative)()?void 0:{rejectUnauthorized:!Ci(e)},s=new Bi(e,[],n);"undefined"!=typeof WebSocket||void 0!==r.g&&void 0!==r.g.WebSocket||"undefined"!=typeof window&&void 0!==window.WebSocket||"undefined"!=typeof self&&void 0!==self.WebSocket?s.onerror=e=>{const t=e;i(this.emitError(t.error))}:s.on("error",(e=>{i(this.emitError(e))})),s.onopen=()=>{this.onOpen(s),t(s)}}))}onOpen(e){e.onmessage=e=>this.onPayload(e),e.onclose=e=>this.onClose(e),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(void 0===e.data)return;const t="string"==typeof e.data?L(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const r=this.parseError(t),i=xi(e,r.message||r.toString());this.events.emit("payload",i)}parseError(e,t=this.url){return function(e,t,r){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?new Error(`Unavailable WS RPC url at ${t}`):e}(e,$i(t))}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}emitError(e){const t=this.parseError(new Error((null==e?void 0:e.message)||`WebSocket connection failed for host: ${$i(this.url)}`));return this.events.emit("register_error",t),t}};var Fi=r(2307),Vi=r.n(Fi),Hi=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i>>0,o=new Uint8Array(s);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var l=0,f=s-1;(0!==u||l>>0,o[f]=u%256>>>0,u=u/256>>>0;if(0!==u)throw new Error("Non-zero carry");n=l,t++}if(" "!==e[t]){for(var d=s-n;d!==s&&0===o[d];)d++;for(var p=new Uint8Array(i+(s-d)),g=i;d!==s;)p[g++]=o[d++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,i=0,n=0,s=t.length;n!==s&&0===t[n];)n++,r++;for(var o=(s-n)*u+1>>>0,c=new Uint8Array(o);n!==s;){for(var l=t[n],f=0,d=o-1;(0!==l||f>>0,c[d]=l%a>>>0,l=l/a>>>0;if(0!==l)throw new Error("Non-zero carry");i=f,n++}for(var p=o-i;p!==o&&0===c[p];)p++;for(var g=h.repeat(r);p{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")};class Gi{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Ji{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return Xi(this,e)}}class Yi{constructor(e){this.decoders=e}or(e){return Xi(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Xi=(e,t)=>new Yi({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class Qi{constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new Gi(e,t,r),this.decoder=new Ji(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Zi=({name:e,prefix:t,encode:r,decode:i})=>new Qi(e,t,r,i),en=({prefix:e,name:t,alphabet:r})=>{const{encode:i,decode:n}=Hi(r,t);return Zi({prefix:e,name:t,encode:i,decode:e=>Wi(n(e))})},tn=({name:e,prefix:t,bitsPerChar:r,alphabet:i})=>Zi({prefix:t,name:e,encode:e=>((e,t,r)=>{const i="="===t[t.length-1],n=(1<r;)o-=r,s+=t[n&a>>o];if(o&&(s+=t[n&a<((e,t,r,i)=>{const n={};for(let e=0;e=8&&(a-=8,o[c++]=255&h>>a)}if(a>=r||255&h<<8-a)throw new SyntaxError("Unexpected end of data");return o})(t,i,r,e)}),rn=Zi({prefix:"\0",name:"identity",encode:e=>(e=>(new TextDecoder).decode(e))(e),decode:e=>(e=>(new TextEncoder).encode(e))(e)});var nn=Object.freeze({__proto__:null,identity:rn});const sn=tn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var on=Object.freeze({__proto__:null,base2:sn});const an=tn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var hn=Object.freeze({__proto__:null,base8:an});const cn=en({prefix:"9",name:"base10",alphabet:"0123456789"});var un=Object.freeze({__proto__:null,base10:cn});const ln=tn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),fn=tn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var dn=Object.freeze({__proto__:null,base16:ln,base16upper:fn});const pn=tn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),gn=tn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),yn=tn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),mn=tn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),vn=tn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),wn=tn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),bn=tn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),_n=tn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),En=tn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Sn=Object.freeze({__proto__:null,base32:pn,base32upper:gn,base32pad:yn,base32padupper:mn,base32hex:vn,base32hexupper:wn,base32hexpad:bn,base32hexpadupper:_n,base32z:En});const In=en({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Mn=en({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var An=Object.freeze({__proto__:null,base36:In,base36upper:Mn});const On=en({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),xn=en({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Pn=Object.freeze({__proto__:null,base58btc:On,base58flickr:xn});const Nn=tn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Rn=tn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Tn=tn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Ln=tn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Cn=Object.freeze({__proto__:null,base64:Nn,base64pad:Rn,base64url:Tn,base64urlpad:Ln});const Un=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),jn=Un.reduce(((e,t,r)=>(e[r]=t,e)),[]),kn=Un.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]),qn=Zi({prefix:"🚀",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+jn[t]),"")},decode:function(e){const t=[];for(const r of e){const e=kn[r.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}});var Dn=Object.freeze({__proto__:null,base256emoji:qn}),zn=128,$n=-128,Bn=Math.pow(2,31),Kn=Math.pow(2,7),Fn=Math.pow(2,14),Vn=Math.pow(2,21),Hn=Math.pow(2,28),Wn=Math.pow(2,35),Gn=Math.pow(2,42),Jn=Math.pow(2,49),Yn=Math.pow(2,56),Xn=Math.pow(2,63),Qn=function e(t,r,i){r=r||[];for(var n=i=i||0;t>=Bn;)r[i++]=255&t|zn,t/=128;for(;t&$n;)r[i++]=255&t|zn,t>>>=7;return r[i]=0|t,e.bytes=i-n+1,r},Zn=function(e){return e(Qn(e,t,r),t),ts=e=>Zn(e),rs=(e,t)=>{const r=t.byteLength,i=ts(e),n=i+ts(r),s=new Uint8Array(n+r);return es(e,s,0),es(r,s,i),s.set(t,n),new is(e,r,t,s)};class is{constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i}}const ns=({name:e,code:t,encode:r})=>new ss(e,t,r);class ss{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?rs(this.code,t):t.then((e=>rs(this.code,e)))}throw Error("Unknown type, must be binary type")}}const os=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),as=ns({name:"sha2-256",code:18,encode:os("SHA-256")}),hs=ns({name:"sha2-512",code:19,encode:os("SHA-512")});Object.freeze({__proto__:null,sha256:as,sha512:hs});const cs=Wi,us={code:0,name:"identity",encode:cs,digest:e=>rs(0,cs(e))};Object.freeze({__proto__:null,identity:us}),new TextEncoder,new TextDecoder;const ls={...nn,...on,...hn,...un,...dn,...Sn,...An,...Pn,...Cn,...Dn};function fs(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function ds(e,t,r,i){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:i}}}const ps=ds("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),gs=ds("ascii","a",(e=>{let t="a";for(let r=0;r{const t=function(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?fs(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}((e=e.substring(1)).length);for(let r=0;r{if(!this.initialized){const e=await this.getKeyChain();typeof e<"u"&&(this.keychain=e),this.initialized=!0}},this.has=e=>(this.isInitialized(),this.keychain.has(e)),this.set=async(e,t)=>{this.isInitialized(),this.keychain.set(e,t),await this.persist()},this.get=e=>{this.isInitialized();const t=this.keychain.get(e);if(typeof t>"u"){const{message:t}=Yr("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t},this.del=async e=>{this.isInitialized(),this.keychain.delete(e),await this.persist()},this.core=e,this.logger=(0,w.generateChildLogger)(t,this.name)}get context(){return(0,w.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,yr(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?mr(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=Yr("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Zs{constructor(e,t,r){this.core=e,this.logger=t,this.name="crypto",this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=e=>(this.isInitialized(),this.keychain.has(e)),this.getClientId=async()=>(this.isInitialized(),_t(Et(await this.getClientSeed()).publicKey)),this.generateKeyPair=()=>{this.isInitialized();const e=function(){const e=At.Au();return{privateKey:vt(e.secretKey,Vt),publicKey:vt(e.publicKey,Vt)}}();return this.setPrivateKey(e.publicKey,e.privateKey)},this.signJWT=async e=>{this.isInitialized();const t=Et(await this.getClientSeed()),r=Gt(),i=_s;return await async function(e,t,r,i,n=(0,k.fromMiliseconds)(Date.now())){const s={alg:"EdDSA",typ:"JWT"},o={iss:_t(i.publicKey),sub:e,aud:t,iat:n,exp:n+r},a=wt([bt((h={header:s,payload:o}).header),bt(h.payload)].join("."),"utf8");var h;return function(e){return[bt(e.header),bt(e.payload),(t=e.signature,vt(t,q))].join(".");var t}({header:s,payload:o,signature:U.Xx(i.secretKey,a)})}(r,e,i,t)},this.generateSharedKey=(e,t,r)=>{this.isInitialized();const i=function(e,t){const r=At.gi(wt(e,Vt),wt(t,Vt),!0);return vt(new It.t(Mt.mE,r).expand(32),Vt)}(this.getPrivateKey(e),t);return this.setSymKey(i,r)},this.setSymKey=async(e,t)=>{this.isInitialized();const r=t||Jt(e);return await this.keychain.set(r,e),r},this.deleteKeyPair=async e=>{this.isInitialized(),await this.keychain.del(e)},this.deleteSymKey=async e=>{this.isInitialized(),await this.keychain.del(e)},this.encode=async(e,t,r)=>{this.isInitialized();const i=Zt(r),n=C(t);if(er(i)){const t=i.senderPublicKey,r=i.receiverPublicKey;e=await this.generateSharedKey(t,r)}const s=this.getSymKey(e),{type:o,senderPublicKey:a}=i;return function(e){const t=function(e){return wt(`${e}`,Ft)}(typeof e.type<"u"?e.type:0);if(1===Xt(t)&&typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof e.senderPublicKey<"u"?wt(e.senderPublicKey,Vt):void 0,i=typeof e.iv<"u"?wt(e.iv,Vt):(0,j.randomBytes)(12);return function(e){if(1===Xt(e.type)){if(typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return vt(G([e.type,e.senderPublicKey,e.iv,e.sealed]),Ht)}return vt(G([e.type,e.iv,e.sealed]),Ht)}({type:t,sealed:new St.OK(wt(e.symKey,Vt)).seal(i,wt(e.message,Wt)),iv:i,senderPublicKey:r})}({type:o,symKey:s,message:n,senderPublicKey:a})},this.decode=async(e,t,r)=>{this.isInitialized();const i=function(e,t){const r=Qt(e);return Zt({type:Xt(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?vt(r.senderPublicKey,Vt):void 0,receiverPublicKey:t?.receiverPublicKey})}(t,r);if(er(i)){const t=i.receiverPublicKey,r=i.senderPublicKey;e=await this.generateSharedKey(t,r)}try{const r=function(e){const t=new St.OK(wt(e.symKey,Vt)),{sealed:r,iv:i}=Qt(e.encoded),n=t.open(i,r);if(null===n)throw new Error("Failed to decrypt");return vt(n,Wt)}({symKey:this.getSymKey(e),encoded:t});return L(r)}catch(t){this.logger.error(`Failed to decode message from topic: '${e}', clientId: '${await this.getClientId()}'`),this.logger.error(t)}},this.getPayloadType=e=>Xt(Qt(e).type),this.getPayloadSenderPublicKey=e=>{const t=Qt(e);return t.senderPublicKey?vt(t.senderPublicKey,Vt):void 0},this.core=e,this.logger=(0,w.generateChildLogger)(t,this.name),this.keychain=r||new Qs(this.core,this.logger)}get context(){return(0,w.getLoggerContext)(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(bs)}catch{e=Gt(),await this.keychain.set(bs,e)}return function(e,t="utf8"){const r=ys[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.decoder.decode(`${r.prefix}${e}`):fs(globalThis.Buffer.from(e,"utf-8"))}(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=Yr("NOT_INITIALIZED",this.name);throw new Error(e)}}}class eo extends S{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name="messages",this.version="0.3",this.initialized=!1,this.storagePrefix=vs,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const e=await this.getRelayerMessages();typeof e<"u"&&(this.messages=e),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}finally{this.initialized=!0}}},this.set=async(e,t)=>{this.isInitialized();const r=Yt(t);let i=this.messages.get(e);return typeof i>"u"&&(i={}),typeof i[r]<"u"||(i[r]=t,this.messages.set(e,i),await this.persist()),r},this.get=e=>{this.isInitialized();let t=this.messages.get(e);return typeof t>"u"&&(t={}),t},this.has=(e,t)=>(this.isInitialized(),typeof this.get(e)[Yt(t)]<"u"),this.del=async e=>{this.isInitialized(),this.messages.delete(e),await this.persist()},this.logger=(0,w.generateChildLogger)(e,this.name),this.core=t}get context(){return(0,w.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,yr(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?mr(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=Yr("NOT_INITIALIZED",this.name);throw new Error(e)}}}class to extends I{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new g.EventEmitter,this.name="publisher",this.queue=new Map,this.publishTimeout=(0,k.toMiliseconds)(k.TEN_SECONDS),this.needsTransportRestart=!1,this.publish=async(e,t,r)=>{var i;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:r}});try{const n=r?.ttl||Es,s=Ar(r),o=r?.prompt||!1,a=r?.tag||0,h=r?.id||Mi().toString(),c={topic:e,message:t,opts:{ttl:n,relay:s,prompt:o,tag:a,id:h}},u=setTimeout((()=>this.queue.set(h,c)),this.publishTimeout);try{await await wr(this.rpcPublish(e,t,n,s,o,a,h),this.publishTimeout,"Failed to publish payload, please try again."),this.removeRequestFromQueue(h),this.relayer.events.emit(Ns,c)}catch(e){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,null!=(i=r?.internal)&&i.throwOnFailedPublish)throw this.removeRequestFromQueue(h),e;return}finally{clearTimeout(u)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:r}})}catch(e){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(e),e}},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.relayer=e,this.logger=(0,w.generateChildLogger)(t,this.name),this.registerEventListeners()}get context(){return(0,w.getLoggerContext)(this.logger)}rpcPublish(e,t,r,i,n,s,o){var a,h,c,u;const l={method:Or(i.protocol).publish,params:{topic:e,message:t,ttl:r,prompt:n,tag:s},id:o};return ei(null==(a=l.params)?void 0:a.prompt)&&(null==(h=l.params)||delete h.prompt),ei(null==(c=l.params)?void 0:c.tag)&&(null==(u=l.params)||delete u.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:l}),this.relayer.request(l)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach((async e=>{const{topic:t,message:r,opts:i}=e;await this.publish(t,r,i)}))}registerEventListeners(){this.relayer.core.heartbeat.on(v.HEARTBEAT_EVENTS.pulse,(()=>{if(this.needsTransportRestart)return this.needsTransportRestart=!1,void this.relayer.events.emit(Ps);this.checkQueue()})),this.relayer.on(As,(e=>{this.removeRequestFromQueue(e.id.toString())}))}}class ro{constructor(){this.map=new Map,this.set=(e,t)=>{const r=this.get(e);this.exists(e,t)||this.map.set(e,[...r,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u")return void this.map.delete(e);if(!this.map.has(e))return;const r=this.get(e);if(!this.exists(e,t))return;const i=r.filter((e=>e!==t));i.length?this.map.set(e,i):this.map.delete(e)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var io=Object.defineProperty,no=Object.defineProperties,so=Object.getOwnPropertyDescriptors,oo=Object.getOwnPropertySymbols,ao=Object.prototype.hasOwnProperty,ho=Object.prototype.propertyIsEnumerable,co=(e,t,r)=>t in e?io(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uo=(e,t)=>{for(var r in t||(t={}))ao.call(t,r)&&co(e,r,t[r]);if(oo)for(var r of oo(t))ho.call(t,r)&&co(e,r,t[r]);return e},lo=(e,t)=>no(e,so(t));class fo extends O{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new ro,this.events=new g.EventEmitter,this.name="subscription",this.version="0.3",this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=vs,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(e,t)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}});try{const r=Ar(t),i={topic:e,relay:r};this.pending.set(e,i);const n=await this.rpcSubscribe(e,r);return this.onSubscribe(n,i),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}}),n}catch(e){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(e),e}},this.unsubscribe=async(e,t)=>{await this.restartToComplete(),this.isInitialized(),typeof t?.id<"u"?await this.unsubscribeById(e,t.id,t):await this.unsubscribeByTopic(e,t)},this.isSubscribed=async e=>!!this.topics.includes(e)||await new Promise(((t,r)=>{const i=new k.Watch;i.start(this.pendingSubscriptionWatchLabel);const n=setInterval((()=>{!this.pending.has(e)&&this.topics.includes(e)&&(clearInterval(n),i.stop(this.pendingSubscriptionWatchLabel),t(!0)),i.elapsed(this.pendingSubscriptionWatchLabel)>=Ds&&(clearInterval(n),i.stop(this.pendingSubscriptionWatchLabel),r(new Error("Subscription resolution timeout")))}),this.pollingInterval)})).catch((()=>!1)),this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=(0,w.generateChildLogger)(t,this.name),this.clientId=""}get context(){return(0,w.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let r=!1;try{r=this.getSubscription(e).topic===t}catch{}return r}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const r=this.topicMap.get(e);await Promise.all(r.map((async r=>await this.unsubscribeById(e,r,t))))}async unsubscribeById(e,t,r){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:r}});try{const i=Ar(r);await this.rpcUnsubscribe(e,t,i);const n=Xr("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,n),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:r}})}catch(e){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(e),e}}async rpcSubscribe(e,t){const r={method:Or(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});try{await await wr(this.relayer.request(r),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Ps)}return Yt(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;const t={method:Or(e[0].relay.protocol).batchSubscribe,params:{topics:e.map((e=>e.topic))}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:t});try{return await await wr(this.relayer.request(t),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(Ps)}}rpcUnsubscribe(e,t,r){const i={method:Or(r.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,t){this.setSubscription(e,lo(uo({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach((e=>{this.setSubscription(e.id,uo({},e)),this.pending.delete(e.topic)}))}async onUnsubscribe(e,t,r){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,r),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t))}addSubscription(e,t){this.subscriptions.set(e,uo({},t)),this.topicMap.set(t.topic,e),this.events.emit(js,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:t}=Yr("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const r=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(r.topic,e),this.events.emit(ks,lo(uo({},r),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit("subscription_sync")}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t"u"||!e.length)return;if(this.subscriptions.size){const{message:e}=Yr("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const t=await this.rpcBatchSubscribe(e);Qr(t)&&this.onBatchSubscribe(t.map(((t,r)=>lo(uo({},e[r]),{id:t}))))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;const e=[];this.pending.forEach((t=>{e.push(t)})),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(v.HEARTBEAT_EVENTS.pulse,(async()=>{await this.checkPending()})),this.relayer.on(Os,(async()=>{await this.onConnect()})),this.relayer.on(xs,(()=>{this.onDisconnect()})),this.events.on(js,(async e=>{const t=js;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})),this.events.on(ks,(async e=>{const t=ks;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}))}isInitialized(){if(!this.initialized){const{message:e}=Yr("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise((e=>{const t=setInterval((()=>{this.restartInProgress||(clearInterval(t),e())}),this.pollingInterval)}))}}var po=Object.defineProperty,go=Object.getOwnPropertySymbols,yo=Object.prototype.hasOwnProperty,mo=Object.prototype.propertyIsEnumerable,vo=(e,t,r)=>t in e?po(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;class wo extends M{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new g.EventEmitter,this.name="relayer",this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,this.request=async e=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(e)}catch(e){throw this.logger.debug("Failed to Publish Request"),this.logger.error(e),e}},this.onPayloadHandler=e=>{this.onProviderPayload(e)},this.onConnectHandler=()=>{this.events.emit(Os)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=e=>{this.logger.error(e),this.events.emit("relayer_error",e),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Rs,this.onPayloadHandler),this.provider.on(Ts,this.onConnectHandler),this.provider.on(Ls,this.onDisconnectHandler),this.provider.on(Cs,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&"string"!=typeof e.logger?(0,w.generateChildLogger)(e.logger,this.name):(0,w.pino)((0,w.getDefaultLoggerOptions)({level:e.logger||"error"})),this.messages=new eo(this.logger,e.core),this.subscriber=new fo(this,this.logger),this.publisher=new to(this,this.logger),this.relayUrl=e?.relayUrl||Ss,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${Is}...`),await this.restartTransport(Is)}this.initialized=!0,setTimeout((async()=>{0===this.subscriber.topics.length&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)}),1e4)}get context(){return(0,w.getLoggerContext)(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,t,r){this.isInitialized(),await this.publisher.publish(e,t,r),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now()})}async subscribe(e,t){var r;this.isInitialized();let i,n=(null==(r=this.subscriber.topicMap.get(e))?void 0:r[0])||"";if(n)return n;const s=t=>{t.topic===e&&(this.subscriber.off(js,s),i())};return await Promise.all([new Promise((e=>{i=e,this.subscriber.on(js,s)})),new Promise((async r=>{n=await this.subscriber.subscribe(e,t),r()}))]),n}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportClose(){this.transportExplicitlyClosed=!0,this.hasExperiencedNetworkDisruption&&this.connected?await wr(this.provider.disconnect(),1e3,"provider.disconnect()").catch((()=>this.onProviderDisconnect())):this.connected&&await this.provider.disconnect()}async transportOpen(e){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise((e=>{if(!this.initialized)return e();this.subscriber.once(qs,(()=>{e()}))})),new Promise((async(e,t)=>{try{await wr(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(e){return void t(e)}e()}))])}catch(e){this.logger.error(e);const t=e;if(!this.isConnectionStalled(t.message))throw e;this.provider.events.emit(Ls)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(e){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await pi())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(e){return this.staleConnectionErrors.some((t=>e.includes(t)))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new zi(new Ki(function({protocol:e,version:t,relayUrl:r,sdkVersion:i,auth:n,projectId:s,useOnCloseEvent:o}){const a=r.split("?"),h={auth:n,ua:pr(e,t,i),projectId:s,useOnCloseEvent:o||void 0},c=function(e,t){let r=$t.parse(e);return r=or(or({},r),t),$t.stringify(r)}(a[1]||"",h);return a[0]+"?"+c}({sdkVersion:"2.10.3",protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:r}=e;await this.messages.set(t,r)}async shouldIgnoreMessageEvent(e){const{topic:t,message:r}=e;if(!r||0===r.length)return this.logger.debug(`Ignoring invalid/empty message: ${r}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const i=this.messages.has(t,r);return i&&this.logger.debug(`Ignoring duplicate message: ${r}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),ji(e)){if(!e.method.endsWith("_subscription"))return;const t=e.params,{topic:r,message:i,publishedAt:n}=t.data,s={topic:r,message:i,publishedAt:n};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(((e,t)=>{for(var r in t||(t={}))yo.call(t,r)&&vo(e,r,t[r]);if(go)for(var r of go(t))mo.call(t,r)&&vo(e,r,t[r]);return e})({type:"event",event:t.id},s)),this.events.emit(t.id,s),await this.acknowledgePayload(e),await this.onMessageEvent(s)}else ki(e)&&this.events.emit(As,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Ms,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=Oi(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(Rs,this.onPayloadHandler),this.provider.off(Ts,this.onConnectHandler),this.provider.off(Ls,this.onDisconnectHandler),this.provider.off(Cs,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(Ps,(()=>{this.restartTransport().catch((e=>this.logger.error(e)))}));let e=await pi();!function(e){switch(dr()){case hr.browser:!function(e){!lr()&&fr()&&(window.addEventListener("online",(()=>e(!0))),window.addEventListener("offline",(()=>e(!1))))}(e);break;case hr.reactNative:!function(e){lr()&&typeof r.g<"u"&&null!=r.g&&r.g.NetInfo&&r.g?.NetInfo.addEventListener((t=>e(t?.isConnected)))}(e);case hr.node:}}((async t=>{this.initialized&&e!==t&&(e=t,t?await this.restartTransport().catch((e=>this.logger.error(e))):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch((e=>this.logger.error(e)))))}))}onProviderDisconnect(){this.events.emit(xs),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout((async()=>{await this.restartTransport().catch((e=>this.logger.error(e)))}),(0,k.toMiliseconds)(Us)))}isInitialized(){if(!this.initialized){const{message:e}=Yr("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise((e=>{const t=setInterval((()=>{this.connected&&(clearInterval(t),e())}),this.connectionStatusPollingInterval)}));await this.restartTransport()}}}var bo=Object.defineProperty,_o=Object.getOwnPropertySymbols,Eo=Object.prototype.hasOwnProperty,So=Object.prototype.propertyIsEnumerable,Io=(e,t,r)=>t in e?bo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Mo=(e,t)=>{for(var r in t||(t={}))Eo.call(t,r)&&Io(e,r,t[r]);if(_o)for(var r of _o(t))So.call(t,r)&&Io(e,r,t[r]);return e};class Ao extends A{constructor(e,t,r,i=vs,n=void 0){super(e,t,r,i),this.core=e,this.logger=t,this.name=r,this.map=new Map,this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=vs,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>{this.getKey&&null!==e&&!ei(e)?this.map.set(this.getKey(e),e):function(e){var t;return null==(t=e?.proposer)?void 0:t.publicKey}(e)?this.map.set(e.id,e):function(e){return e?.topic}(e)&&this.map.set(e.topic,e)})),this.cached=[],this.initialized=!0)},this.set=async(e,t)=>{this.isInitialized(),this.map.has(e)?await this.update(e,t):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:e,value:t}),this.map.set(e,t),await this.persist())},this.get=e=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:e}),this.getData(e)),this.getAll=e=>(this.isInitialized(),e?this.values.filter((t=>Object.keys(e).every((r=>Vi()(t[r],e[r]))))):this.values),this.update=async(e,t)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:e,update:t});const r=Mo(Mo({},this.getData(e)),t);this.map.set(e,r),await this.persist()},this.delete=async(e,t)=>{this.isInitialized(),this.map.has(e)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:e,reason:t}),this.map.delete(e),await this.persist())},this.logger=(0,w.generateChildLogger)(t,this.name),this.storagePrefix=i,this.getKey=n}get context(){return(0,w.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){const{message:t}=Yr("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(t),new Error(t)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:e}=Yr("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=Yr("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Oo{constructor(e,t){this.core=e,this.logger=t,this.name="pairing",this.version="0.3",this.events=new(y()),this.initialized=!1,this.storagePrefix=vs,this.ignoredPayloadTypes=[1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:e})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...e])]},this.create=async()=>{this.isInitialized();const e=Gt(),t=await this.core.crypto.setSymKey(e),r=Er(k.FIVE_MINUTES),i={protocol:"irn"},n={topic:t,expiry:r,relay:i,active:!1},s=function(e){return`${e.protocol}:${e.topic}@${e.version}?`+$t.stringify(((e,t)=>{for(var r in t||(t={}))Nr.call(t,r)&&Tr(e,r,t[r]);if(Pr)for(var r of Pr(t))Rr.call(t,r)&&Tr(e,r,t[r]);return e})({symKey:e.symKey},function(e,t="-"){const r={};return Object.keys(e).forEach((i=>{const n="relay"+t+i;e[i]&&(r[n]=e[i])})),r}(e.relay)))}({protocol:this.core.protocol,version:this.core.version,topic:t,symKey:e,relay:i});return await this.pairings.set(t,n),await this.core.relayer.subscribe(t),this.core.expirer.set(t,r),{topic:t,uri:s}},this.pair=async e=>{this.isInitialized(),this.isValidPair(e);const{topic:t,symKey:r,relay:i}=function(e){const t=(e=(e=e.includes("wc://")?e.replace("wc://",""):e).includes("wc:")?e.replace("wc:",""):e).indexOf(":"),r=-1!==e.indexOf("?")?e.indexOf("?"):void 0,i=e.substring(0,t),n=e.substring(t+1,r).split("@"),s=typeof r<"u"?e.substring(r):"",o=$t.parse(s);return{protocol:i,topic:Cr(n[0]),version:parseInt(n[1],10),symKey:o.symKey,relay:Lr(o)}}(e.uri);let n;if(this.pairings.keys.includes(t)&&(n=this.pairings.get(t),n.active))throw new Error(`Pairing already exists: ${t}. Please try again with a new connection URI.`);this.core.crypto.keychain.has(t)||(await this.core.crypto.setSymKey(r,t),await this.core.relayer.subscribe(t,{relay:i}));const s=Er(k.FIVE_MINUTES),o={topic:t,relay:i,expiry:s,active:!1};return await this.pairings.set(t,o),this.core.expirer.set(t,s),e.activatePairing&&await this.activate({topic:t}),this.events.emit($s,o),o},this.activate=async({topic:e})=>{this.isInitialized();const t=Er(k.THIRTY_DAYS);await this.pairings.update(e,{active:!0,expiry:t}),this.core.expirer.set(e,t)},this.ping=async e=>{this.isInitialized(),await this.isValidPing(e);const{topic:t}=e;if(this.pairings.keys.includes(t)){const e=await this.sendRequest(t,"wc_pairingPing",{}),{done:r,resolve:i,reject:n}=vr();this.events.once(Ir("pairing_ping",e),(({error:e})=>{e?n(e):i()})),await r()}},this.updateExpiry=async({topic:e,expiry:t})=>{this.isInitialized(),await this.pairings.update(e,{expiry:t})},this.updateMetadata=async({topic:e,metadata:t})=>{this.isInitialized(),await this.pairings.update(e,{peerMetadata:t})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async e=>{this.isInitialized(),await this.isValidDisconnect(e);const{topic:t}=e;this.pairings.keys.includes(t)&&(await this.sendRequest(t,"wc_pairingDelete",Xr("USER_DISCONNECTED")),await this.deletePairing(t))},this.sendRequest=async(e,t,r)=>{const i=Ai(t,r),n=await this.core.crypto.encode(e,i),s=zs[t].req;return this.core.history.set(e,i),this.core.relayer.publish(e,n,s),i.id},this.sendResult=async(e,t,r)=>{const i=Oi(e,r),n=await this.core.crypto.encode(t,i),s=await this.core.history.get(t,e),o=zs[s.request.method].res;await this.core.relayer.publish(t,n,o),await this.core.history.resolve(i)},this.sendError=async(e,t,r)=>{const i=xi(e,r),n=await this.core.crypto.encode(t,i),s=await this.core.history.get(t,e),o=zs[s.request.method]?zs[s.request.method].res:zs.unregistered_method.res;await this.core.relayer.publish(t,n,o),await this.core.history.resolve(i)},this.deletePairing=async(e,t)=>{await this.core.relayer.unsubscribe(e),await Promise.all([this.pairings.delete(e,Xr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(e),t?Promise.resolve():this.core.expirer.del(e)])},this.cleanup=async()=>{const e=this.pairings.getAll().filter((e=>Sr(e.expiry)));await Promise.all(e.map((e=>this.deletePairing(e.topic))))},this.onRelayEventRequest=e=>{const{topic:t,payload:r}=e;switch(r.method){case"wc_pairingPing":return this.onPairingPingRequest(t,r);case"wc_pairingDelete":return this.onPairingDeleteRequest(t,r);default:return this.onUnknownRpcMethodRequest(t,r)}},this.onRelayEventResponse=async e=>{const{topic:t,payload:r}=e,i=(await this.core.history.get(t,r.id)).request.method;return"wc_pairingPing"===i?this.onPairingPingResponse(t,r):this.onUnknownRpcMethodResponse(i)},this.onPairingPingRequest=async(e,t)=>{const{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult(r,e,!0),this.events.emit("pairing_ping",{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.logger.error(t)}},this.onPairingPingResponse=(e,t)=>{const{id:r}=t;setTimeout((()=>{qi(t)?this.events.emit(Ir("pairing_ping",r),{}):Di(t)&&this.events.emit(Ir("pairing_ping",r),{error:t.error})}),500)},this.onPairingDeleteRequest=async(e,t)=>{const{id:r}=t;try{this.isValidDisconnect({topic:e}),await this.deletePairing(e),this.events.emit("pairing_delete",{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.logger.error(t)}},this.onUnknownRpcMethodRequest=async(e,t)=>{const{id:r,method:i}=t;try{if(this.registeredMethods.includes(i))return;const t=Xr("WC_METHOD_UNSUPPORTED",i);await this.sendError(r,e,t),this.logger.error(t)}catch(t){await this.sendError(r,e,t),this.logger.error(t)}},this.onUnknownRpcMethodResponse=e=>{this.registeredMethods.includes(e)||this.logger.error(Xr("WC_METHOD_UNSUPPORTED",e))},this.isValidPair=e=>{if(!ci(e)){const{message:t}=Yr("MISSING_OR_INVALID",`pair() params: ${e}`);throw new Error(t)}if(!ni(e.uri)){const{message:t}=Yr("MISSING_OR_INVALID",`pair() uri: ${e.uri}`);throw new Error(t)}},this.isValidPing=async e=>{if(!ci(e)){const{message:t}=Yr("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidPairingTopic(t)},this.isValidDisconnect=async e=>{if(!ci(e)){const{message:t}=Yr("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidPairingTopic(t)},this.isValidPairingTopic=async e=>{if(!ti(e,!1)){const{message:t}=Yr("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.pairings.keys.includes(e)){const{message:t}=Yr("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(Sr(this.pairings.get(e).expiry)){await this.deletePairing(e);const{message:t}=Yr("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}},this.core=e,this.logger=(0,w.generateChildLogger)(t,this.name),this.pairings=new Ao(this.core,this.logger,this.name,this.storagePrefix)}get context(){return(0,w.getLoggerContext)(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=Yr("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Ms,(async e=>{const{topic:t,message:r}=e;if(!this.pairings.keys.includes(t)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))return;const i=await this.core.crypto.decode(t,r);try{ji(i)?(this.core.history.set(t,i),this.onRelayEventRequest({topic:t,payload:i})):ki(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:t,payload:i}),this.core.history.delete(t,i.id))}catch(e){this.logger.error(e)}}))}registerExpirerEvents(){this.core.expirer.on(Ws,(async e=>{const{topic:t}=_r(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit("pairing_expire",{topic:t}))}))}}class xo extends E{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new g.EventEmitter,this.name="history",this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=vs,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>this.records.set(e.id,e))),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(e,t,r)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:e,request:t,chainId:r}),this.records.has(t.id))return;const i={id:t.id,topic:e,request:{method:t.method,params:t.params||null},chainId:r,expiry:Er(k.THIRTY_DAYS)};this.records.set(i.id,i),this.events.emit(Bs,i)},this.resolve=async e=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:e}),!this.records.has(e.id))return;const t=await this.getRecord(e.id);typeof t.response>"u"&&(t.response=Di(e)?{error:e.error}:{result:e.result},this.records.set(t.id,t),this.events.emit(Ks,t))},this.get=async(e,t)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:e,id:t}),await this.getRecord(t)),this.delete=(e,t)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:t}),this.values.forEach((r=>{if(r.topic===e){if(typeof t<"u"&&r.id!==t)return;this.records.delete(r.id),this.events.emit(Fs,r)}}))},this.exists=async(e,t)=>(this.isInitialized(),!!this.records.has(t)&&(await this.getRecord(t)).topic===e),this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.logger=(0,w.generateChildLogger)(t,this.name)}get context(){return(0,w.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach((t=>{if(typeof t.response<"u")return;const r={topic:t.topic,request:Ai(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(r)})),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:t}=Yr("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit("history_sync")}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:e}=Yr("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Bs,(e=>{const t=Bs;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()})),this.events.on(Ks,(e=>{const t=Ks;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()})),this.events.on(Fs,(e=>{const t=Fs;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()})),this.core.heartbeat.on(v.HEARTBEAT_EVENTS.pulse,(()=>{this.cleanup()}))}cleanup(){try{this.records.forEach((e=>{(0,k.toMiliseconds)(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.delete(e.topic,e.id))}))}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=Yr("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Po extends x{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new g.EventEmitter,this.name="expirer",this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=vs,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>this.expirations.set(e.target,e))),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=e=>{try{const t=this.formatTarget(e);return typeof this.getExpiration(t)<"u"}catch{return!1}},this.set=(e,t)=>{this.isInitialized();const r=this.formatTarget(e),i={target:r,expiry:t};this.expirations.set(r,i),this.checkExpiry(r,i),this.events.emit(Vs,{target:r,expiration:i})},this.get=e=>{this.isInitialized();const t=this.formatTarget(e);return this.getExpiration(t)},this.del=e=>{if(this.isInitialized(),this.has(e)){const t=this.formatTarget(e),r=this.getExpiration(t);this.expirations.delete(t),this.events.emit(Hs,{target:t,expiration:r})}},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.logger=(0,w.generateChildLogger)(t,this.name)}get context(){return(0,w.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if("string"==typeof e)return function(e){return br("topic",e)}(e);if("number"==typeof e)return function(e){return br("id",e)}(e);const{message:t}=Yr("UNKNOWN_TYPE","Target type: "+typeof e);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit("expirer_sync")}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:e}=Yr("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:t}=Yr("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(t),new Error(t)}return t}checkExpiry(e,t){const{expiry:r}=t;(0,k.toMiliseconds)(r)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(Ws,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach(((e,t)=>this.checkExpiry(t,e)))}registerEventListeners(){this.core.heartbeat.on(v.HEARTBEAT_EVENTS.pulse,(()=>this.checkExpirations())),this.events.on(Vs,(e=>{const t=Vs;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})),this.events.on(Ws,(e=>{const t=Ws;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})),this.events.on(Hs,(e=>{const t=Hs;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}))}isInitialized(){if(!this.initialized){const{message:e}=Yr("NOT_INITIALIZED",this.name);throw new Error(e)}}}class No extends P{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.name=Gs,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async e=>{if(this.verifyDisabled||lr()||!fr())return;const t=this.getVerifyUrl(e?.verifyUrl);this.verifyUrl!==t&&this.removeIframe(),this.verifyUrl=t;try{await this.createIframe()}catch(e){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(e)}if(!this.initialized){this.removeIframe(),this.verifyUrl=Ys;try{await this.createIframe()}catch(e){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(e),this.verifyDisabled=!0}}},this.register=async e=>{this.initialized?this.sendPost(e.attestationId):(this.addToQueue(e.attestationId),await this.init())},this.resolve=async e=>{if(this.isDevEnv)return"";const t=this.getVerifyUrl(e?.verifyUrl);let r;try{r=await this.fetchAttestation(e.attestationId,t)}catch(i){this.logger.info(`failed to resolve attestation: ${e.attestationId} from url: ${t}`),this.logger.info(i),r=await this.fetchAttestation(e.attestationId,Ys)}return r},this.fetchAttestation=async(e,t)=>{this.logger.info(`resolving attestation: ${e} from url: ${t}`);const r=this.startAbortTimer(2*k.ONE_SECOND),i=await fetch(`${t}/attestation/${e}`,{signal:this.abortController.signal});return clearTimeout(r),200===i.status?await i.json():void 0},this.addToQueue=e=>{this.queue.push(e)},this.processQueue=()=>{0!==this.queue.length&&(this.queue.forEach((e=>this.sendPost(e))),this.queue=[])},this.sendPost=e=>{var t;try{if(!this.iframe)return;null==(t=this.iframe.contentWindow)||t.postMessage(e,"*"),this.logger.info(`postMessage sent: ${e} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let e;const t=r=>{"verify_ready"===r.data&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",t),e())};await Promise.race([new Promise((r=>{if(document.getElementById(Gs))return r();window.addEventListener("message",t);const i=document.createElement("iframe");i.id=Gs,i.src=`${this.verifyUrl}/${this.projectId}`,i.style.display="none",document.body.append(i),this.iframe=i,e=r})),new Promise(((e,r)=>setTimeout((()=>{window.removeEventListener("message",t),r("verify iframe load timeout")}),(0,k.toMiliseconds)(k.FIVE_SECONDS))))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=e=>{let t=e||Js;return Xs.includes(t)||(this.logger.info(`verify url: ${t}, not included in trusted list, assigning default: ${Js}`),t=Js),t},this.logger=(0,w.generateChildLogger)(t,this.name),this.verifyUrl=Js,this.abortController=new AbortController,this.isDevEnv=ur()&&process.env.IS_VITEST}get context(){return(0,w.getLoggerContext)(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout((()=>this.abortController.abort()),(0,k.toMiliseconds)(e))}}var Ro=Object.defineProperty,To=Object.getOwnPropertySymbols,Lo=Object.prototype.hasOwnProperty,Co=Object.prototype.propertyIsEnumerable,Uo=(e,t,r)=>t in e?Ro(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,jo=(e,t)=>{for(var r in t||(t={}))Lo.call(t,r)&&Uo(e,r,t[r]);if(To)for(var r of To(t))Co.call(t,r)&&Uo(e,r,t[r]);return e};class ko extends _{constructor(e){super(e),this.protocol="wc",this.version=2,this.name=ms,this.events=new g.EventEmitter,this.initialized=!1,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||Ss,this.customStoragePrefix=null!=e&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const t=typeof e?.logger<"u"&&"string"!=typeof e?.logger?e.logger:(0,w.pino)((0,w.getDefaultLoggerOptions)({level:e?.logger||"error"}));this.logger=(0,w.generateChildLogger)(t,this.name),this.heartbeat=new v.HeartBeat,this.crypto=new Zs(this,this.logger,e?.keychain),this.history=new xo(this,this.logger),this.expirer=new Po(this,this.logger),this.storage=null!=e&&e.storage?e.storage:new m.ZP(jo(jo({},ws),e?.storageOptions)),this.relayer=new wo({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Oo(this,this.logger),this.verify=new No(this.projectId||"",this.logger)}static async init(e){const t=new ko(e);await t.initialize();const r=await t.crypto.getClientId();return await t.storage.setItem("WALLETCONNECT_CLIENT_ID",r),t}get context(){return(0,w.getLoggerContext)(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const qo=ko;let Do=!1,zo=!1;const $o={debug:1,default:2,info:2,warning:3,error:4,off:5};let Bo=$o.default,Ko=null;const Fo=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var Vo,Ho;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(Vo||(Vo={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(Ho||(Ho={}));const Wo="0123456789abcdef";class Go{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==$o[r]&&this.throwArgumentError("invalid log level name","logLevel",e),Bo>$o[r]||console.log.apply(console,t)}debug(...e){this._log(Go.levels.DEBUG,e)}info(...e){this._log(Go.levels.INFO,e)}warn(...e){this._log(Go.levels.WARNING,e)}makeError(e,t,r){if(zo)return this.makeError("censored error",t,{});t||(t=Go.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach((e=>{const t=r[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e>4],r+=Wo[15&t[e]];i.push(e+"=Uint8Array(0x"+r+")")}else i.push(e+"="+JSON.stringify(t))}catch(t){i.push(e+"="+JSON.stringify(r[e].toString()))}})),i.push(`code=${t}`),i.push(`version=${this.version}`);const n=e;let s="";switch(t){case Ho.NUMERIC_FAULT:{s="NUMERIC_FAULT";const t=e;switch(t){case"overflow":case"underflow":case"division-by-zero":s+="-"+t;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case Ho.CALL_EXCEPTION:case Ho.INSUFFICIENT_FUNDS:case Ho.MISSING_NEW:case Ho.NONCE_EXPIRED:case Ho.REPLACEMENT_UNDERPRICED:case Ho.TRANSACTION_REPLACED:case Ho.UNPREDICTABLE_GAS_LIMIT:s=t}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const o=new Error(e);return o.reason=n,o.code=t,Object.keys(r).forEach((function(e){o[e]=r[e]})),o}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,Go.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,i){e||this.throwError(t,r,i)}assertArgument(e,t,r,i){e||this.throwArgumentError(t,r,i)}checkNormalize(e){null==e&&(e="platform missing String.prototype.normalize"),Fo&&this.throwError("platform missing String.prototype.normalize",Go.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Fo})}checkSafeUint53(e,t){"number"==typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,Go.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,Go.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r=r?": "+r:"",et&&this.throwError("too many arguments"+r,Go.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",Go.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",Go.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",Go.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return Ko||(Ko=new Go("logger/5.7.0")),Ko}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",Go.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Do){if(!e)return;this.globalLogger().throwError("error censorship permanent",Go.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}zo=!!e,Do=!!t}static setLogLevel(e){const t=$o[e.toLowerCase()];null!=t?Bo=t:Go.globalLogger().warn("invalid log level - "+e)}static from(e){return new Go(e)}}Go.errors=Ho,Go.levels=Vo;const Jo=new Go("bytes/5.7.0");function Yo(e){return!!e.toHexString}function Xo(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return Xo(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function Qo(e){return"number"==typeof e&&e==e&&e%1==0}function Zo(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!Qo(e.length)||e.length<0)return!1;for(let t=0;t=256)return!1}return!0}function ea(e,t){if(t||(t={}),"number"==typeof e){Jo.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),Xo(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Yo(e)&&(e=e.toHexString()),ta(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":Jo.throwArgumentError("hex data is odd-length","value",e));const i=[];for(let e=0;e>4]+ra[15&i]}return t}return Jo.throwArgumentError("invalid hexlify value","value",e)}function na(e,t,r){return"string"!=typeof e?e=ia(e):(!ta(e)||e.length%2)&&Jo.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function sa(e,t){for("string"!=typeof e?e=ia(e):ta(e)||Jo.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&Jo.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function oa(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(ta(r=e)&&!(r.length%2)||Zo(r)){let r=ea(e);64===r.length?(t.v=27+(r[32]>>7),r[32]&=127,t.r=ia(r.slice(0,32)),t.s=ia(r.slice(32,64))):65===r.length?(t.r=ia(r.slice(0,32)),t.s=ia(r.slice(32,64)),t.v=r[64]):Jo.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:Jo.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=ia(r.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){const r=function(e,t){(e=ea(e)).length>t&&Jo.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),Xo(r)}(ea(t._vs),32);t._vs=ia(r);const i=r[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=i:t.recoveryParam!==i&&Jo.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),r[0]&=127;const n=ia(r);null==t.s?t.s=n:t.s!==n&&Jo.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?Jo.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{const r=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==r&&Jo.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&ta(t.r)?t.r=sa(t.r,32):Jo.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&ta(t.s)?t.s=sa(t.s,32):Jo.throwArgumentError("signature missing or invalid s","signature",e);const r=ea(t.s);r[0]>=128&&Jo.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const i=ia(r);t._vs&&(ta(t._vs)||Jo.throwArgumentError("signature invalid _vs","signature",e),t._vs=sa(t._vs,32)),null==t._vs?t._vs=i:t._vs!==i&&Jo.throwArgumentError("signature _vs mismatch v and s","signature",e)}var r;return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}var aa=r(1094),ha=r.n(aa);function ca(e){return"0x"+ha().keccak_256(ea(e))}const ua=new Go("strings/5.7.0");var la,fa;function da(e,t,r,i,n){if(e===fa.BAD_PREFIX||e===fa.UNEXPECTED_CONTINUE){let e=0;for(let i=t+1;i>6==2;i++)e++;return e}return e===fa.OVERRUN?r.length-t-1:0}function pa(e,t=la.current){t!=la.current&&(ua.checkNormalize(),e=e.normalize(t));let r=[];for(let t=0;t>6|192),r.push(63&i|128);else if(55296==(64512&i)){t++;const n=e.charCodeAt(t);if(t>=e.length||56320!=(64512&n))throw new Error("invalid utf-8 string");const s=65536+((1023&i)<<10)+(1023&n);r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(63&s|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(63&i|128)}return ea(r)}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(la||(la={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(fa||(fa={})),Object.freeze({error:function(e,t,r,i,n){return ua.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",r)},ignore:da,replace:function(e,t,r,i,n){return e===fa.OVERLONG?(i.push(n),0):(i.push(65533),da(e,t,r))}});const ga="Ethereum Signed Message:\n";function ya(e){return"string"==typeof e&&(e=pa(e)),ca(function(e){const t=e.map((e=>ea(e))),r=t.reduce(((e,t)=>e+t.length),0),i=new Uint8Array(r);return t.reduce(((e,t)=>(i.set(t,e),e+t.length)),0),Xo(i)}([pa(ga),pa(String(e.length)),e]))}var ma=r(3550),va=r.n(ma),wa=va().BN;new Go("bignumber/5.7.0");const ba=new Go("address/5.7.0");function _a(e){ta(e,20)||ba.throwArgumentError("invalid address","address",e);const t=(e=e.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let e=0;e<40;e++)r[e]=t[e].charCodeAt(0);const i=ea(ca(r));for(let e=0;e<40;e+=2)i[e>>1]>>4>=8&&(t[e]=t[e].toUpperCase()),(15&i[e>>1])>=8&&(t[e+1]=t[e+1].toUpperCase());return"0x"+t.join("")}const Ea={};for(let e=0;e<10;e++)Ea[String(e)]=String(e);for(let e=0;e<26;e++)Ea[String.fromCharCode(65+e)]=String(10+e);const Sa=Math.floor((Ia=9007199254740991,Math.log10?Math.log10(Ia):Math.log(Ia)/Math.LN10));var Ia;function Ma(e){let t=null;if("string"!=typeof e&&ba.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=_a(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&ba.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==function(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((e=>Ea[e])).join("");for(;t.length>=Sa;){let e=t.substring(0,Sa);t=parseInt(e,10)%97+t.substring(e.length)}let r=String(98-parseInt(t,10)%97);for(;r.length<2;)r="0"+r;return r}(e)&&ba.throwArgumentError("bad icap checksum","address",e),r=e.substring(4),t=new wa(r,36).toString(16);t.length<40;)t="0"+t;t=_a("0x"+t)}else ba.throwArgumentError("invalid address","address",e);var r;return t}var Aa=r(3715),Oa=r.n(Aa);function xa(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self&&self;var Pa=Na;function Na(e,t){if(!e)throw new Error(t||"Assertion failed")}Na.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var Ra=xa((function(e,t){var r=t;function i(e){return 1===e.length?"0"+e:e}function n(e){for(var t="",r=0;r>8,o=255&n;s?r.push(s,o):r.push(o)}return r},r.zero2=i,r.toHex=n,r.encode=function(e,t){return"hex"===t?n(e):e}})),Ta=xa((function(e,t){var r=t;r.assert=Pa,r.toArray=Ra.toArray,r.zero2=Ra.zero2,r.toHex=Ra.toHex,r.encode=Ra.encode,r.getNAF=function(e,t,r){var i=new Array(Math.max(e.bitLength(),r)+1);i.fill(0);for(var n=1<(n>>1)-1?(n>>1)-h:h,s.isubn(a)):a=0,i[o]=a,s.iushrn(1)}return i},r.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var i,n=0,s=0;e.cmpn(-n)>0||t.cmpn(-s)>0;){var o,a,h=e.andln(3)+n&3,c=t.andln(3)+s&3;3===h&&(h=-1),3===c&&(c=-1),o=0==(1&h)?0:3!=(i=e.andln(7)+n&7)&&5!==i||2!==c?h:-h,r[0].push(o),a=0==(1&c)?0:3!=(i=t.andln(7)+s&7)&&5!==i||2!==h?c:-c,r[1].push(a),2*n===o+1&&(n=1-n),2*s===a+1&&(s=1-s),e.iushrn(1),t.iushrn(1)}return r},r.cachedProperty=function(e,t,r){var i="_"+t;e.prototype[t]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},r.parseBytes=function(e){return"string"==typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new(va())(e,"hex","le")}})),La=Ta.getNAF,Ca=Ta.getJSF,Ua=Ta.assert;function ja(e,t){this.type=e,this.p=new(va())(t.p,16),this.red=t.prime?va().red(t.prime):va().mont(this.p),this.zero=new(va())(0).toRed(this.red),this.one=new(va())(1).toRed(this.red),this.two=new(va())(2).toRed(this.red),this.n=t.n&&new(va())(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var ka=ja;function qa(e,t){this.curve=e,this.type=t,this.precomputed=null}ja.prototype.point=function(){throw new Error("Not implemented")},ja.prototype.validate=function(){throw new Error("Not implemented")},ja.prototype._fixedNafMul=function(e,t){Ua(e.precomputed);var r=e._getDoubles(),i=La(t,1,this._bitLength),n=(1<=s;h--)o=(o<<1)+i[h];a.push(o)}for(var c=this.jpoint(null,null,null),u=this.jpoint(null,null,null),l=n;l>0;l--){for(s=0;s=0;a--){for(var h=0;a>=0&&0===s[a];a--)h++;if(a>=0&&h++,o=o.dblp(h),a<0)break;var c=s[a];Ua(0!==c),o="affine"===e.type?c>0?o.mixedAdd(n[c-1>>1]):o.mixedAdd(n[-c-1>>1].neg()):c>0?o.add(n[c-1>>1]):o.add(n[-c-1>>1].neg())}return"affine"===e.type?o.toP():o},ja.prototype._wnafMulAdd=function(e,t,r,i,n){var s,o,a,h=this._wnafT1,c=this._wnafT2,u=this._wnafT3,l=0;for(s=0;s=1;s-=2){var d=s-1,p=s;if(1===h[d]&&1===h[p]){var g=[t[d],null,null,t[p]];0===t[d].y.cmp(t[p].y)?(g[1]=t[d].add(t[p]),g[2]=t[d].toJ().mixedAdd(t[p].neg())):0===t[d].y.cmp(t[p].y.redNeg())?(g[1]=t[d].toJ().mixedAdd(t[p]),g[2]=t[d].add(t[p].neg())):(g[1]=t[d].toJ().mixedAdd(t[p]),g[2]=t[d].toJ().mixedAdd(t[p].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],m=Ca(r[d],r[p]);for(l=Math.max(m[0].length,l),u[d]=new Array(l),u[p]=new Array(l),o=0;o=0;s--){for(var E=0;s>=0;){var S=!0;for(o=0;o=0&&E++,b=b.dblp(E),s<0)break;for(o=0;o0?a=c[o][I-1>>1]:I<0&&(a=c[o][-I-1>>1].neg()),b="affine"===a.type?b.mixedAdd(a):b.add(a))}}for(s=0;s=Math.ceil((e.bitLength()+1)/t.step)},qa.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n=0&&(s=t,o=r),i.negative&&(i=i.neg(),n=n.neg()),s.negative&&(s=s.neg(),o=o.neg()),[{a:i,b:n},{a:s,b:o}]},$a.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],i=t[1],n=i.b.mul(e).divRound(this.n),s=r.b.neg().mul(e).divRound(this.n),o=n.mul(r.a),a=s.mul(i.a),h=n.mul(r.b),c=s.mul(i.b);return{k1:e.sub(o).sub(a),k2:h.add(c).neg()}},$a.prototype.pointFromX=function(e,t){(e=new(va())(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var n=i.fromRed().isOdd();return(t&&!n||!t&&n)&&(i=i.redNeg()),this.point(e,i)},$a.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,i=this.a.redMul(t),n=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},$a.prototype._endoWnafMulAdd=function(e,t,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,s=0;s":""},Ka.prototype.isInfinity=function(){return this.inf},Ka.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},Ka.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),i=e.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(i),s=n.redSqr().redISub(this.x.redAdd(this.x)),o=n.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},Ka.prototype.getX=function(){return this.x.fromRed()},Ka.prototype.getY=function(){return this.y.fromRed()},Ka.prototype.mul=function(e){return e=new(va())(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Ka.prototype.mulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},Ka.prototype.jmulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},Ka.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},Ka.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,i=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return t},Ka.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Da(Fa,ka.BasePoint),$a.prototype.jpoint=function(e,t,r){return new Fa(this,e,t,r)},Fa.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(r,i)},Fa.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Fa.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(t),n=e.x.redMul(r),s=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),a=i.redSub(n),h=s.redSub(o);if(0===a.cmpn(0))return 0!==h.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),l=i.redMul(c),f=h.redSqr().redIAdd(u).redISub(l).redISub(l),d=h.redMul(l.redISub(f)).redISub(s.redMul(u)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(f,d,p)},Fa.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,i=e.x.redMul(t),n=this.y,s=e.y.redMul(t).redMul(this.z),o=r.redSub(i),a=n.redSub(s);if(0===o.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=o.redSqr(),c=h.redMul(o),u=r.redMul(h),l=a.redSqr().redIAdd(c).redISub(u).redISub(u),f=a.redMul(u.redISub(l)).redISub(n.redMul(c)),d=this.z.redMul(o);return this.curve.jpoint(l,f,d)},Fa.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},Fa.prototype.inspect=function(){return this.isInfinity()?"":""},Fa.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var Va=xa((function(e,t){var r=t;r.base=ka,r.short=Ba,r.mont=null,r.edwards=null})),Ha=xa((function(e,t){var r,i=t,n=Ta.assert;function s(e){"short"===e.type?this.curve=new Va.short(e):"edwards"===e.type?this.curve=new Va.edwards(e):this.curve=new Va.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function o(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var r=new s(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=s,o("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Oa().sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Oa().sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Oa().sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Oa().sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),o("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Oa().sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Oa().sha256,gRed:!1,g:["9"]}),o("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Oa().sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(e){r=void 0}o("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Oa().sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function Wa(e){if(!(this instanceof Wa))return new Wa(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=Ra.toArray(e.entropy,e.entropyEnc||"hex"),r=Ra.toArray(e.nonce,e.nonceEnc||"hex"),i=Ra.toArray(e.pers,e.persEnc||"hex");Pa(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,i)}var Ga=Wa;Wa.prototype._init=function(e,t,r){var i=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},Wa.prototype.generate=function(e,t,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(i=r,r=t,t=null),r&&(r=Ra.toArray(r,i||"hex"),this._update(r));for(var n=[];n.length"};var Qa=Ta.assert;function Za(e,t){if(e instanceof Za)return e;this._importDER(e,t)||(Qa(e.r&&e.s,"Signature without r or s"),this.r=new(va())(e.r,16),this.s=new(va())(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var eh=Za;function th(){this.place=0}function rh(e,t){var r=e[t.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;for(var n=0,s=0,o=t.place;s>>=0;return!(n<=127)&&(t.place=o,n)}function ih(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}Za.prototype._importDER=function(e,t){e=Ta.toArray(e,t);var r=new th;if(48!==e[r.place++])return!1;var i=rh(e,r);if(!1===i)return!1;if(i+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var n=rh(e,r);if(!1===n)return!1;var s=e.slice(r.place,n+r.place);if(r.place+=n,2!==e[r.place++])return!1;var o=rh(e,r);if(!1===o)return!1;if(e.length!==o+r.place)return!1;var a=e.slice(r.place,o+r.place);if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new(va())(s),this.s=new(va())(a),this.recoveryParam=null,!0},Za.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=ih(t),r=ih(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];nh(i,t.length),(i=i.concat(t)).push(2),nh(i,r.length);var n=i.concat(r),s=[48];return nh(s,n.length),s=s.concat(n),Ta.encode(s,e)};var sh=function(){throw new Error("unsupported")},oh=Ta.assert;function ah(e){if(!(this instanceof ah))return new ah(e);"string"==typeof e&&(oh(Object.prototype.hasOwnProperty.call(Ha,e),"Unknown curve "+e),e=Ha[e]),e instanceof Ha.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var hh=ah;ah.prototype.keyPair=function(e){return new Xa(this,e)},ah.prototype.keyFromPrivate=function(e,t){return Xa.fromPrivate(this,e,t)},ah.prototype.keyFromPublic=function(e,t){return Xa.fromPublic(this,e,t)},ah.prototype.genKeyPair=function(e){e||(e={});for(var t=new Ga({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||sh(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new(va())(2));;){var n=new(va())(t.generate(r));if(!(n.cmp(i)>0))return n.iaddn(1),this.keyFromPrivate(n)}},ah.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},ah.prototype.sign=function(e,t,r,i){"object"==typeof r&&(i=r,r=null),i||(i={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new(va())(e,16));for(var n=this.n.byteLength(),s=t.getPrivate().toArray("be",n),o=e.toArray("be",n),a=new Ga({hash:this.hash,entropy:s,nonce:o,pers:i.pers,persEnc:i.persEnc||"utf8"}),h=this.n.sub(new(va())(1)),c=0;;c++){var u=i.k?i.k(c):new(va())(a.generate(this.n.byteLength()));if(!((u=this._truncateToN(u,!0)).cmpn(1)<=0||u.cmp(h)>=0)){var l=this.g.mul(u);if(!l.isInfinity()){var f=l.getX(),d=f.umod(this.n);if(0!==d.cmpn(0)){var p=u.invm(this.n).mul(d.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var g=(l.getY().isOdd()?1:0)|(0!==f.cmp(d)?2:0);return i.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),g^=1),new eh({r:d,s:p,recoveryParam:g})}}}}}},ah.prototype.verify=function(e,t,r,i){e=this._truncateToN(new(va())(e,16)),r=this.keyFromPublic(r,i);var n=(t=new eh(t,"hex")).r,s=t.s;if(n.cmpn(1)<0||n.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var o,a=s.invm(this.n),h=a.mul(e).umod(this.n),c=a.mul(n).umod(this.n);return this.curve._maxwellTrick?!(o=this.g.jmulAdd(h,r.getPublic(),c)).isInfinity()&&o.eqXToP(n):!(o=this.g.mulAdd(h,r.getPublic(),c)).isInfinity()&&0===o.getX().umod(this.n).cmp(n)},ah.prototype.recoverPubKey=function(e,t,r,i){oh((3&r)===r,"The recovery param is more than two bits"),t=new eh(t,i);var n=this.n,s=new(va())(e),o=t.r,a=t.s,h=1&r,c=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");o=c?this.curve.pointFromX(o.add(this.curve.n),h):this.curve.pointFromX(o,h);var u=t.r.invm(n),l=n.sub(s).mul(u).umod(n),f=a.mul(u).umod(n);return this.g.mulAdd(l,o,f)},ah.prototype.getKeyRecoveryParam=function(e,t,r,i){if(null!==(t=new eh(t,i)).recoveryParam)return t.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(e,t,n)}catch(e){continue}if(s.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var ch=xa((function(e,t){var r=t;r.version="6.5.4",r.utils=Ta,r.rand=function(){throw new Error("unsupported")},r.curve=Va,r.curves=Ha,r.ec=hh,r.eddsa=null})).ec;function uh(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}new Go("properties/5.7.0");const lh=new Go("signing-key/5.7.0");let fh=null;function dh(){return fh||(fh=new ch("secp256k1")),fh}class ph{constructor(e){uh(this,"curve","secp256k1"),uh(this,"privateKey",ia(e)),32!==function(e){if("string"!=typeof e)e=ia(e);else if(!ta(e)||e.length%2)return null;return(e.length-2)/2}(this.privateKey)&&lh.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=dh().keyFromPrivate(ea(this.privateKey));uh(this,"publicKey","0x"+t.getPublic(!1,"hex")),uh(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),uh(this,"_isSigningKey",!0)}_addPoint(e){const t=dh().keyFromPublic(ea(this.publicKey)),r=dh().keyFromPublic(ea(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=dh().keyFromPrivate(ea(this.privateKey)),r=ea(e);32!==r.length&&lh.throwArgumentError("bad digest length","digest",e);const i=t.sign(r,{canonical:!0});return oa({recoveryParam:i.recoveryParam,r:sa("0x"+i.r.toString(16),32),s:sa("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const t=dh().keyFromPrivate(ea(this.privateKey)),r=dh().keyFromPublic(ea(gh(e)));return sa("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!(!e||!e._isSigningKey)}}function gh(e,t){const r=ea(e);if(32===r.length){const e=new ph(r);return t?"0x"+dh().keyFromPrivate(r).getPublic(!0,"hex"):e.publicKey}return 33===r.length?t?ia(r):"0x"+dh().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?t?"0x"+dh().keyFromPublic(r).getPublic(!0,"hex"):ia(r):lh.throwArgumentError("invalid public or private key","key","[REDACTED]")}var yh;new Go("transactions/5.7.0"),function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(yh||(yh={}));var mh=r(204),vh=r.n(mh);class wh{constructor(e){this.client=e}}class bh{constructor(e){this.opts=e}}const _h={wc_authRequest:{req:{ttl:k.ONE_DAY,prompt:!0,tag:3e3},res:{ttl:k.ONE_DAY,prompt:!1,tag:3001}}},Eh={min:k.FIVE_MINUTES,max:k.SEVEN_DAYS},Sh="authClient",Ih="wc@1:auth:",Mh=`${Ih}:PUB_KEY`;function Ah(e){return e?.split(":")}function Oh(e){const t=e&&Ah(e);if(t)return t.pop()}async function xh(e,t,r,i,n){switch(r.t){case"eip191":return function(e,t,r){return function(e,t){return function(e){return Ma(na(ca(na(gh(e),1)),12))}(function(e,t){const r=oa(t),i={r:ea(r.r),s:ea(r.s)};return"0x"+dh().recoverPubKey(ea(e),i,r.recoveryParam).encode("hex",!1)}(ea(e),t))}(ya(t),r).toLowerCase()===e.toLowerCase()}(e,t,r.s);case"eip1271":return await async function(e,t,r,i,n){try{const s="0x1626ba7e",o="0000000000000000000000000000000000000000000000000000000000000040",a="0000000000000000000000000000000000000000000000000000000000000041",h=r.substring(2),c=s+ya(t).substring(2)+o+a+h,u=await vh()(`https://rpc.walletconnect.com/v1/?chainId=${i}&projectId=${n}`,{method:"POST",body:JSON.stringify({id:Date.now()+Math.floor(1e3*Math.random()),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:c},"latest"]})}),{result:l}=await u.json();return!!l&&l.slice(0,s.length).toLowerCase()===s.toLowerCase()}catch(e){return console.error("isValidEip1271Signature: ",e),!1}}(e,t,r.s,i,n);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function Ph(e){return e.getAll().filter((e=>"requester"in e))}function Nh(e,t){return Ph(e).find((e=>e.id===t))}var Rh=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i>>0,o=new Uint8Array(s);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var l=0,f=s-1;(0!==u||l>>0,o[f]=u%256>>>0,u=u/256>>>0;if(0!==u)throw new Error("Non-zero carry");n=l,t++}if(" "!==e[t]){for(var d=s-n;d!==s&&0===o[d];)d++;for(var p=new Uint8Array(i+(s-d)),g=i;d!==s;)p[g++]=o[d++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,i=0,n=0,s=t.length;n!==s&&0===t[n];)n++,r++;for(var o=(s-n)*u+1>>>0,c=new Uint8Array(o);n!==s;){for(var l=t[n],f=0,d=o-1;(0!==l||f>>0,c[d]=l%a>>>0,l=l/a>>>0;if(0!==l)throw new Error("Non-zero carry");i=f,n++}for(var p=o-i;p!==o&&0===c[p];)p++;for(var g=h.repeat(r);p{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")};class Lh{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Ch{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return jh(this,e)}}class Uh{constructor(e){this.decoders=e}or(e){return jh(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const jh=(e,t)=>new Uh({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class kh{constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new Lh(e,t,r),this.decoder=new Ch(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const qh=({name:e,prefix:t,encode:r,decode:i})=>new kh(e,t,r,i),Dh=({prefix:e,name:t,alphabet:r})=>{const{encode:i,decode:n}=Rh(r,t);return qh({prefix:e,name:t,encode:i,decode:e=>Th(n(e))})},zh=({name:e,prefix:t,bitsPerChar:r,alphabet:i})=>qh({prefix:t,name:e,encode:e=>((e,t,r)=>{const i="="===t[t.length-1],n=(1<r;)o-=r,s+=t[n&a>>o];if(o&&(s+=t[n&a<((e,t,r,i)=>{const n={};for(let e=0;e=8&&(a-=8,o[c++]=255&h>>a)}if(a>=r||255&h<<8-a)throw new SyntaxError("Unexpected end of data");return o})(t,i,r,e)}),$h=qh({prefix:"\0",name:"identity",encode:e=>(e=>(new TextDecoder).decode(e))(e),decode:e=>(e=>(new TextEncoder).encode(e))(e)});var Bh=Object.freeze({__proto__:null,identity:$h});const Kh=zh({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Fh=Object.freeze({__proto__:null,base2:Kh});const Vh=zh({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Hh=Object.freeze({__proto__:null,base8:Vh});const Wh=Dh({prefix:"9",name:"base10",alphabet:"0123456789"});var Gh=Object.freeze({__proto__:null,base10:Wh});const Jh=zh({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Yh=zh({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Xh=Object.freeze({__proto__:null,base16:Jh,base16upper:Yh});const Qh=zh({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Zh=zh({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ec=zh({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),tc=zh({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),rc=zh({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ic=zh({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),nc=zh({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),sc=zh({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),oc=zh({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ac=Object.freeze({__proto__:null,base32:Qh,base32upper:Zh,base32pad:ec,base32padupper:tc,base32hex:rc,base32hexupper:ic,base32hexpad:nc,base32hexpadupper:sc,base32z:oc});const hc=Dh({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),cc=Dh({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var uc=Object.freeze({__proto__:null,base36:hc,base36upper:cc});const lc=Dh({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),fc=Dh({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var dc=Object.freeze({__proto__:null,base58btc:lc,base58flickr:fc});const pc=zh({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),gc=zh({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),yc=zh({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),mc=zh({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var vc=Object.freeze({__proto__:null,base64:pc,base64pad:gc,base64url:yc,base64urlpad:mc});const bc=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),_c=bc.reduce(((e,t,r)=>(e[r]=t,e)),[]),Ec=bc.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]),Sc=qh({prefix:"🚀",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+_c[t]),"")},decode:function(e){const t=[];for(const r of e){const e=Ec[r.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}});var Ic=Object.freeze({__proto__:null,base256emoji:Sc}),Mc=128,Ac=-128,Oc=Math.pow(2,31),xc=Math.pow(2,7),Pc=Math.pow(2,14),Nc=Math.pow(2,21),Rc=Math.pow(2,28),Tc=Math.pow(2,35),Lc=Math.pow(2,42),Cc=Math.pow(2,49),Uc=Math.pow(2,56),jc=Math.pow(2,63),kc=function e(t,r,i){r=r||[];for(var n=i=i||0;t>=Oc;)r[i++]=255&t|Mc,t/=128;for(;t&Ac;)r[i++]=255&t|Mc,t>>>=7;return r[i]=0|t,e.bytes=i-n+1,r},qc=function(e){return e(kc(e,t,r),t),zc=e=>qc(e),$c=(e,t)=>{const r=t.byteLength,i=zc(e),n=i+zc(r),s=new Uint8Array(n+r);return Dc(e,s,0),Dc(r,s,i),s.set(t,n),new Bc(e,r,t,s)};class Bc{constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i}}const Kc=({name:e,code:t,encode:r})=>new Fc(e,t,r);class Fc{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?$c(this.code,t):t.then((e=>$c(this.code,e)))}throw Error("Unknown type, must be binary type")}}const Vc=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),Hc=Kc({name:"sha2-256",code:18,encode:Vc("SHA-256")}),Wc=Kc({name:"sha2-512",code:19,encode:Vc("SHA-512")});Object.freeze({__proto__:null,sha256:Hc,sha512:Wc});const Gc=Th,Jc={code:0,name:"identity",encode:Gc,digest:e=>$c(0,Gc(e))};Object.freeze({__proto__:null,identity:Jc}),new TextEncoder,new TextDecoder;const Yc={...Bh,...Fh,...Hh,...Gh,...Xh,...ac,...uc,...dc,...vc,...Ic};function Xc(e,t,r,i){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:i}}}const Qc=Xc("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),Zc=Xc("ascii","a",(e=>{let t="a";for(let r=0;r{const t=function(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}((e=e.substring(1)).length);for(let r=0;rt in e?ru(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,cu=(e,t)=>{for(var r in t||(t={}))ou.call(t,r)&&hu(e,r,t[r]);if(su)for(var r of su(t))au.call(t,r)&&hu(e,r,t[r]);return e},uu=(e,t)=>iu(e,nu(t));class lu extends wh{constructor(e){super(e),this.initialized=!1,this.name="authEngine",this.init=()=>{this.initialized||(this.registerRelayerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(_h)}),this.initialized=!0)},this.request=async(e,t)=>{if(this.isInitialized(),!function(e){const t=ni(e.aud),r=new RegExp(`${e.domain}`).test(e.aud),i=!!e.nonce,n=!e.type||"eip4361"===e.type,s=e.expiry;if(s&&!di(s,Eh)){const{message:e}=Yr("MISSING_OR_INVALID",`request() expiry: ${s}. Expiry must be a number (in seconds) between ${Eh.min} and ${Eh.max}`);throw new Error(e)}return!!(t&&r&&i&&n)}(e))throw new Error("Invalid request");if(null!=t&&t.topic)return await this.requestOnKnownPairing(t.topic,e);const{chainId:r,statement:i,aud:n,domain:s,nonce:o,type:a,exp:h,nbf:c}=e,{topic:u,uri:l}=await this.client.core.pairing.create();this.client.logger.info({message:"Generated new pairing",pairing:{topic:u,uri:l}});const f=await this.client.core.crypto.generateKeyPair(),d=Jt(f);await this.client.authKeys.set(Mh,{responseTopic:d,publicKey:f}),await this.client.pairingTopics.set(d,{topic:d,pairingTopic:u}),await this.client.core.relayer.subscribe(d),this.client.logger.info(`sending request to new pairing topic: ${u}`);const p=await this.sendRequest(u,"wc_authRequest",{payloadParams:{type:a??"eip4361",chainId:r,statement:i,aud:n,domain:s,version:"1",nonce:o,iat:(new Date).toISOString(),exp:h,nbf:c},requester:{publicKey:f,metadata:this.client.metadata}},{},e.expiry);return this.client.logger.info(`sent request to new pairing topic: ${u}`),{uri:l,id:p}},this.respond=async(e,t)=>{if(this.isInitialized(),!function(e,t){return!!Nh(t,e.id)}(e,this.client.requests))throw new Error("Invalid response");const r=Nh(this.client.requests,e.id);if(!r)throw new Error(`Could not find pending auth request with id ${e.id}`);const i=r.requester.publicKey,n=await this.client.core.crypto.generateKeyPair(),s=Jt(i),o={type:1,receiverPublicKey:i,senderPublicKey:n};if("error"in e)return void await this.sendError(r.id,s,e,o);const a={h:{t:"eip4361"},p:uu(cu({},r.cacaoPayload),{iss:t}),s:e.signature};await this.sendResult(r.id,s,a,o),await this.client.core.pairing.activate({topic:r.pairingTopic}),await this.client.requests.update(r.id,cu({},a))},this.getPendingRequests=()=>Ph(this.client.requests),this.formatMessage=(e,t)=>{this.client.logger.debug(`formatMessage, cacao is: ${JSON.stringify(e)}`);const r=`${e.domain} wants you to sign in with your Ethereum account:`,i=Oh(t),n=e.statement,s=`URI: ${e.aud}`,o=`Version: ${e.version}`,a=`Chain ID: ${function(e){const t=e&&Ah(e);if(t)return t[3]}(t)}`,h=`Nonce: ${e.nonce}`,c=`Issued At: ${e.iat}`,u=e.exp?`Expiry: ${e.exp}`:void 0,l=e.resources&&e.resources.length>0?`Resources:\n${e.resources.map((e=>`- ${e}`)).join("\n")}`:void 0;return[r,i,"",n,"",s,o,a,h,c,u,l].filter((e=>null!=e)).join("\n")},this.setExpiry=async(e,t)=>{this.client.core.pairing.pairings.keys.includes(e)&&await this.client.core.pairing.updateExpiry({topic:e,expiry:t}),this.client.core.expirer.set(e,t)},this.sendRequest=async(e,t,r,i,n)=>{const s=Ai(t,r),o=await this.client.core.crypto.encode(e,s,i),a=_h[t].req;if(n&&(a.ttl=n),this.client.core.history.set(e,s),fr()){const e=tu(JSON.stringify(s));this.client.core.verify.register({attestationId:e})}return await this.client.core.relayer.publish(e,o,uu(cu({},a),{internal:{throwOnFailedPublish:!0}})),s.id},this.sendResult=async(e,t,r,i)=>{const n=Oi(e,r),s=await this.client.core.crypto.encode(t,n,i),o=await this.client.core.history.get(t,e),a=_h[o.request.method].res;return await this.client.core.relayer.publish(t,s,uu(cu({},a),{internal:{throwOnFailedPublish:!0}})),await this.client.core.history.resolve(n),n.id},this.sendError=async(e,t,r,i)=>{const n=xi(e,r.error),s=await this.client.core.crypto.encode(t,n,i),o=await this.client.core.history.get(t,e),a=_h[o.request.method].res;return await this.client.core.relayer.publish(t,s,a),await this.client.core.history.resolve(n),n.id},this.requestOnKnownPairing=async(e,t)=>{const r=this.client.core.pairing.pairings.getAll({active:!0}).find((t=>t.topic===e));if(!r)throw new Error(`Could not find pairing for provided topic ${e}`);const{publicKey:i}=this.client.authKeys.get(Mh),{chainId:n,statement:s,aud:o,domain:a,nonce:h,type:c}=t,u=await this.sendRequest(r.topic,"wc_authRequest",{payloadParams:{type:c??"eip4361",chainId:n,statement:s,aud:o,domain:a,version:"1",nonce:h,iat:(new Date).toISOString()},requester:{publicKey:i,metadata:this.client.metadata}},{},t.expiry);return this.client.logger.info(`sent request to known pairing topic: ${r.topic}`),{id:u}},this.onPairingCreated=e=>{const t=this.getPendingRequests();if(t){const r=Object.values(t).find((t=>t.pairingTopic===e.topic));r&&this.handleAuthRequest(r)}},this.onRelayEventRequest=e=>{const{topic:t,payload:r}=e,i=r.method;return"wc_authRequest"===i?this.onAuthRequest(t,r):this.client.logger.info(`Unsupported request method ${i}`)},this.onRelayEventResponse=async e=>{const{topic:t,payload:r}=e,i=(await this.client.core.history.get(t,r.id)).request.method;return"wc_authRequest"===i?this.onAuthResponse(t,r):this.client.logger.info(`Unsupported response method ${i}`)},this.onAuthRequest=async(e,t)=>{const{requester:r,payloadParams:i}=t.params;this.client.logger.info({type:"onAuthRequest",topic:e,payload:t});const n=tu(JSON.stringify(t)),s=await this.getVerifyContext(n,this.client.metadata),o={requester:r,pairingTopic:e,id:t.id,cacaoPayload:i,verifyContext:s};await this.client.requests.set(t.id,o),this.handleAuthRequest(o)},this.handleAuthRequest=async e=>{const{id:t,pairingTopic:r,requester:i,cacaoPayload:n,verifyContext:s}=e;try{this.client.emit("auth_request",{id:t,topic:r,params:{requester:i,cacaoPayload:n},verifyContext:s})}catch(t){await this.sendError(e.id,e.pairingTopic,t),this.client.logger.error(t)}},this.onAuthResponse=async(e,t)=>{const{id:r}=t;if(this.client.logger.info({type:"onAuthResponse",topic:e,response:t}),qi(t)){const{pairingTopic:i}=this.client.pairingTopics.get(e);await this.client.core.pairing.activate({topic:i});const{s:n,p:s}=t.result;await this.client.requests.set(r,cu({id:r,pairingTopic:i},t.result));const o=this.formatMessage(s,s.iss);this.client.logger.debug("reconstructed message:\n",JSON.stringify(o)),this.client.logger.debug("payload.iss:",s.iss),this.client.logger.debug("signature:",n);const a=Oh(s.iss),h=function(e){const t=e&&Ah(e);if(t)return t[2]+":"+t[3]}(s.iss);if(!a)throw new Error("Could not derive address from `payload.iss`");if(!h)throw new Error("Could not derive chainId from `payload.iss`");this.client.logger.debug("walletAddress extracted from `payload.iss`:",a),await xh(a,o,n,h,this.client.projectId)?this.client.emit("auth_response",{id:r,topic:e,params:t}):this.client.emit("auth_response",{id:r,topic:e,params:{message:"Invalid signature",code:-1}})}else Di(t)&&this.client.emit("auth_response",{id:r,topic:e,params:t})},this.getVerifyContext=async(e,t)=>{const r={verified:{verifyUrl:t.verifyUrl||"",validation:"UNKNOWN",origin:t.url||""}};try{const i=await this.client.core.verify.resolve({attestationId:e,verifyUrl:t.verifyUrl});i&&(r.verified.origin=i.origin,r.verified.isScam=i.isScam,r.verified.validation=origin===new URL(t.url).origin?"VALID":"INVALID")}catch(e){this.client.logger.error(e)}return this.client.logger.info(`Verify context: ${JSON.stringify(r)}`),r}}isInitialized(){if(!this.initialized){const{message:e}=Yr("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.client.core.relayer.on(Ms,(async e=>{const{topic:t,message:r}=e,{responseTopic:i,publicKey:n}=this.client.authKeys.keys.includes(Mh)?this.client.authKeys.get(Mh):{responseTopic:void 0,publicKey:void 0};if(i&&t!==i)return void this.client.logger.debug("[Auth] Ignoring message from unknown topic",t);const s=await this.client.core.crypto.decode(t,r,{receiverPublicKey:n});ji(s)?(this.client.core.history.set(t,s),this.onRelayEventRequest({topic:t,payload:s})):ki(s)&&(await this.client.core.history.resolve(s),this.onRelayEventResponse({topic:t,payload:s}))}))}registerPairingEvents(){this.client.core.pairing.events.on($s,(e=>this.onPairingCreated(e)))}}class fu extends bh{constructor(e){super(e),this.protocol="wc",this.version=1,this.name=Sh,this.events=new g.EventEmitter,this.emit=(e,t)=>this.events.emit(e,t),this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.request=async(e,t)=>{try{return await this.engine.request(e,t)}catch(e){throw this.logger.error(e.message),e}},this.respond=async(e,t)=>{try{return await this.engine.respond(e,t)}catch(e){throw this.logger.error(e.message),e}},this.getPendingRequests=()=>{try{return this.engine.getPendingRequests()}catch(e){throw this.logger.error(e.message),e}},this.formatMessage=(e,t)=>{try{return this.engine.formatMessage(e,t)}catch(e){throw this.logger.error(e.message),e}};const t=typeof e.logger<"u"&&"string"!=typeof e.logger?e.logger:(0,w.pino)((0,w.getDefaultLoggerOptions)({level:e.logger||"error"}));this.name=e?.name||Sh,this.metadata=e.metadata,this.projectId=e.projectId,this.core=e.core||new qo(e),this.logger=(0,w.generateChildLogger)(t,this.name),this.authKeys=new Ao(this.core,this.logger,"authKeys",Ih,(()=>Mh)),this.pairingTopics=new Ao(this.core,this.logger,"pairingTopics",Ih),this.requests=new Ao(this.core,this.logger,"requests",Ih,(e=>e.id)),this.engine=new lu(this)}static async init(e){const t=new fu(e);return await t.initialize(),t}get context(){return(0,w.getLoggerContext)(this.logger)}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.authKeys.init(),await this.requests.init(),await this.pairingTopics.init(),await this.engine.init(),this.logger.info("AuthClient Initialization Success"),this.logger.info({authClient:this})}catch(e){throw this.logger.info("AuthClient Initialization Failure"),this.logger.error(e.message),e}}}const du=fu,pu="client",gu=`wc@2:${pu}:`,yu=pu,mu="WALLETCONNECT_DEEPLINK_CHOICE",vu=k.SEVEN_DAYS,wu={wc_sessionPropose:{req:{ttl:k.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:k.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:k.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:k.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:k.ONE_DAY,prompt:!1,tag:1104},res:{ttl:k.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:k.ONE_DAY,prompt:!1,tag:1106},res:{ttl:k.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:k.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:k.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:k.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:k.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:k.ONE_DAY,prompt:!1,tag:1112},res:{ttl:k.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:k.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:k.THIRTY_SECONDS,prompt:!1,tag:1115}}},bu={min:k.FIVE_MINUTES,max:k.SEVEN_DAYS},_u="IDLE",Eu="ACTIVE",Su=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"];var Iu=Object.defineProperty,Mu=Object.defineProperties,Au=Object.getOwnPropertyDescriptors,Ou=Object.getOwnPropertySymbols,xu=Object.prototype.hasOwnProperty,Pu=Object.prototype.propertyIsEnumerable,Nu=(e,t,r)=>t in e?Iu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ru=(e,t)=>{for(var r in t||(t={}))xu.call(t,r)&&Nu(e,r,t[r]);if(Ou)for(var r of Ou(t))Pu.call(t,r)&&Nu(e,r,t[r]);return e},Tu=(e,t)=>Mu(e,Au(t));class Lu extends R{constructor(e){super(e),this.name="engine",this.events=new(y()),this.initialized=!1,this.ignoredPayloadTypes=[1],this.requestQueue={state:_u,queue:[]},this.sessionRequestQueue={state:_u,queue:[]},this.requestQueueDelay=k.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(wu)}),this.initialized=!0,setTimeout((()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()}),(0,k.toMiliseconds)(this.requestQueueDelay)))},this.connect=async e=>{await this.isInitialized();const t=Tu(Ru({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(t);const{pairingTopic:r,requiredNamespaces:i,optionalNamespaces:n,sessionProperties:s,relays:o}=t;let a,h=r,c=!1;if(h&&(c=this.client.core.pairing.pairings.get(h).active),!h||!c){const{topic:e,uri:t}=await this.client.core.pairing.create();h=e,a=t}const u=await this.client.core.crypto.generateKeyPair(),l=Ru({requiredNamespaces:i,optionalNamespaces:n,relays:o??[{protocol:"irn"}],proposer:{publicKey:u,metadata:this.client.metadata}},s&&{sessionProperties:s}),{reject:f,resolve:d,done:p}=vr(k.FIVE_MINUTES,"Proposal expired");if(this.events.once(Ir("session_connect"),(async({error:e,session:t})=>{if(e)f(e);else if(t){t.self.publicKey=u;const e=Tu(Ru({},t),{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces});await this.client.session.set(t.topic,e),await this.setExpiry(t.topic,t.expiry),h&&await this.client.core.pairing.updateMetadata({topic:h,metadata:t.peer.metadata}),d(e)}})),!h){const{message:e}=Yr("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error(e)}const g=await this.sendRequest({topic:h,method:"wc_sessionPropose",params:l}),y=Er(k.FIVE_MINUTES);return await this.setProposal(g,Ru({id:g,expiry:y},l)),{uri:a,approval:p}},this.pair=async e=>(await this.isInitialized(),await this.client.core.pairing.pair(e)),this.approve=async e=>{await this.isInitialized(),await this.isValidApprove(e);const{id:t,relayProtocol:r,namespaces:i,sessionProperties:n}=e,s=this.client.proposal.get(t);let{pairingTopic:o,proposer:a,requiredNamespaces:h,optionalNamespaces:c}=s;o=o||"",Zr(h)||(h=function(e,t){const r=ai(e,"approve()");if(r)throw new Error(r.message);const i={};for(const[t,r]of Object.entries(e))i[t]={methods:r.methods,events:r.events,chains:r.accounts.map((e=>`${e.split(":")[0]}:${e.split(":")[1]}`))};return i}(i));const u=await this.client.core.crypto.generateKeyPair(),l=a.publicKey,f=await this.client.core.crypto.generateSharedKey(u,l);o&&t&&(await this.client.core.pairing.updateMetadata({topic:o,metadata:a.metadata}),await this.sendResult({id:t,topic:o,result:{relay:{protocol:r??"irn"},responderPublicKey:u}}),await this.client.proposal.delete(t,Xr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:o}));const d=Ru({relay:{protocol:r??"irn"},namespaces:i,requiredNamespaces:h,optionalNamespaces:c,pairingTopic:o,controller:{publicKey:u,metadata:this.client.metadata},expiry:Er(vu)},n&&{sessionProperties:n});await this.client.core.relayer.subscribe(f),await this.sendRequest({topic:f,method:"wc_sessionSettle",params:d,throwOnFailedPublish:!0});const p=Tu(Ru({},d),{topic:f,pairingTopic:o,acknowledged:!1,self:d.controller,peer:{publicKey:a.publicKey,metadata:a.metadata},controller:u});return await this.client.session.set(f,p),await this.setExpiry(f,Er(vu)),{topic:f,acknowledged:()=>new Promise((e=>setTimeout((()=>e(this.client.session.get(f))),500)))}},this.reject=async e=>{await this.isInitialized(),await this.isValidReject(e);const{id:t,reason:r}=e,{pairingTopic:i}=this.client.proposal.get(t);i&&(await this.sendError(t,i,r),await this.client.proposal.delete(t,Xr("USER_DISCONNECTED")))},this.update=async e=>{await this.isInitialized(),await this.isValidUpdate(e);const{topic:t,namespaces:r}=e,i=await this.sendRequest({topic:t,method:"wc_sessionUpdate",params:{namespaces:r}}),{done:n,resolve:s,reject:o}=vr();return this.events.once(Ir("session_update",i),(({error:e})=>{e?o(e):s()})),await this.client.session.update(t,{namespaces:r}),{acknowledged:n}},this.extend=async e=>{await this.isInitialized(),await this.isValidExtend(e);const{topic:t}=e,r=await this.sendRequest({topic:t,method:"wc_sessionExtend",params:{}}),{done:i,resolve:n,reject:s}=vr();return this.events.once(Ir("session_extend",r),(({error:e})=>{e?s(e):n()})),await this.setExpiry(t,Er(vu)),{acknowledged:i}},this.request=async e=>{await this.isInitialized(),await this.isValidRequest(e);const{chainId:t,request:i,topic:n,expiry:s}=e,o=Ii(),{done:a,resolve:h,reject:c}=vr(s,"Request expired. Please try again.");return this.events.once(Ir("session_request",o),(({error:e,result:t})=>{e?c(e):h(t)})),await Promise.all([new Promise((async e=>{await this.sendRequest({clientRpcId:o,topic:n,method:"wc_sessionRequest",params:{request:i,chainId:t},expiry:s,throwOnFailedPublish:!0}).catch((e=>c(e))),this.client.events.emit("session_request_sent",{topic:n,request:i,chainId:t,id:o}),e()})),new Promise((async e=>{const t=await this.client.core.storage.getItem(mu);(async function({id:e,topic:t,wcDeepLink:i}){try{if(!i)return;const n="string"==typeof i?JSON.parse(i):i;let s=n?.href;if("string"!=typeof s)return;s.endsWith("/")&&(s=s.slice(0,-1));const o=`${s}/wc?requestId=${e}&sessionTopic=${t}`,a=dr();a===hr.browser?o.startsWith("https://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,"_self","noreferrer noopener"):a===hr.reactNative&&typeof(null==r.g?void 0:r.g.Linking)<"u"&&await r.g.Linking.openURL(o)}catch(e){console.error(e)}})({id:o,topic:n,wcDeepLink:t}),e()})),a()]).then((e=>e[2]))},this.respond=async e=>{await this.isInitialized(),await this.isValidRespond(e);const{topic:t,response:r}=e,{id:i}=r;qi(r)?await this.sendResult({id:i,topic:t,result:r.result,throwOnFailedPublish:!0}):Di(r)&&await this.sendError(i,t,r.error),this.cleanupAfterResponse(e)},this.ping=async e=>{await this.isInitialized(),await this.isValidPing(e);const{topic:t}=e;if(this.client.session.keys.includes(t)){const e=await this.sendRequest({topic:t,method:"wc_sessionPing",params:{}}),{done:r,resolve:i,reject:n}=vr();this.events.once(Ir("session_ping",e),(({error:e})=>{e?n(e):i()})),await r()}else this.client.core.pairing.pairings.keys.includes(t)&&await this.client.core.pairing.ping({topic:t})},this.emit=async e=>{await this.isInitialized(),await this.isValidEmit(e);const{topic:t,event:r,chainId:i}=e;await this.sendRequest({topic:t,method:"wc_sessionEvent",params:{event:r,chainId:i}})},this.disconnect=async e=>{await this.isInitialized(),await this.isValidDisconnect(e);const{topic:t}=e;this.client.session.keys.includes(t)?(await this.sendRequest({topic:t,method:"wc_sessionDelete",params:Xr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession(t)):await this.client.core.pairing.disconnect({topic:t})},this.find=e=>(this.isInitialized(),this.client.session.getAll().filter((t=>function(e,t){const{requiredNamespaces:r}=t,i=Object.keys(e.namespaces),n=Object.keys(r);let s=!0;return!!gr(n,i)&&(i.forEach((t=>{const{accounts:i,methods:n,events:o}=e.namespaces[t],a=Fr(i),h=r[t];gr(Kt(t,h),a)&&gr(h.methods,n)&&gr(h.events,o)||(s=!1)})),s)}(t,e)))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.cleanupDuplicatePairings=async e=>{if(e.pairingTopic)try{const t=this.client.core.pairing.pairings.get(e.pairingTopic),r=this.client.core.pairing.pairings.getAll().filter((r=>{var i,n;return(null==(i=r.peerMetadata)?void 0:i.url)&&(null==(n=r.peerMetadata)?void 0:n.url)===e.peer.metadata.url&&r.topic&&r.topic!==t.topic}));if(0===r.length)return;this.client.logger.info(`Cleaning up ${r.length} duplicate pairing(s)`),await Promise.all(r.map((e=>this.client.core.pairing.disconnect({topic:e.topic})))),this.client.logger.info("Duplicate pairings clean up finished")}catch(e){this.client.logger.error(e)}},this.deleteSession=async(e,t)=>{const{self:r}=this.client.session.get(e);await this.client.core.relayer.unsubscribe(e),this.client.session.delete(e,Xr("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(r.publicKey)&&await this.client.core.crypto.deleteKeyPair(r.publicKey),this.client.core.crypto.keychain.has(e)&&await this.client.core.crypto.deleteSymKey(e),t||this.client.core.expirer.del(e),this.client.core.storage.removeItem(mu).catch((e=>this.client.logger.warn(e)))},this.deleteProposal=async(e,t)=>{await Promise.all([this.client.proposal.delete(e,Xr("USER_DISCONNECTED")),t?Promise.resolve():this.client.core.expirer.del(e)])},this.deletePendingSessionRequest=async(e,t,r=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,t),r?Promise.resolve():this.client.core.expirer.del(e)]),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter((t=>t.id!==e)),r&&(this.sessionRequestQueue.state=_u)},this.setExpiry=async(e,t)=>{this.client.session.keys.includes(e)&&await this.client.session.update(e,{expiry:t}),this.client.core.expirer.set(e,t)},this.setProposal=async(e,t)=>{await this.client.proposal.set(e,t),this.client.core.expirer.set(e,t.expiry)},this.setPendingSessionRequest=async e=>{const t=wu.wc_sessionRequest.req.ttl,{id:r,topic:i,params:n,verifyContext:s}=e;await this.client.pendingRequest.set(r,{id:r,topic:i,params:n,verifyContext:s}),t&&this.client.core.expirer.set(r,Er(t))},this.sendRequest=async e=>{const{topic:t,method:r,params:i,expiry:n,relayRpcId:s,clientRpcId:o,throwOnFailedPublish:a}=e,h=Ai(r,i,o);if(fr()&&Su.includes(r)){const e=Yt(JSON.stringify(h));this.client.core.verify.register({attestationId:e})}const c=await this.client.core.crypto.encode(t,h),u=wu[r].req;return n&&(u.ttl=n),s&&(u.id=s),this.client.core.history.set(t,h),a?(u.internal=Tu(Ru({},u.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(t,c,u)):this.client.core.relayer.publish(t,c,u).catch((e=>this.client.logger.error(e))),h.id},this.sendResult=async e=>{const{id:t,topic:r,result:i,throwOnFailedPublish:n}=e,s=Oi(t,i),o=await this.client.core.crypto.encode(r,s),a=await this.client.core.history.get(r,t),h=wu[a.request.method].res;n?(h.internal=Tu(Ru({},h.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(r,o,h)):this.client.core.relayer.publish(r,o,h).catch((e=>this.client.logger.error(e))),await this.client.core.history.resolve(s)},this.sendError=async(e,t,r)=>{const i=xi(e,r),n=await this.client.core.crypto.encode(t,i),s=await this.client.core.history.get(t,e),o=wu[s.request.method].res;this.client.core.relayer.publish(t,n,o),await this.client.core.history.resolve(i)},this.cleanup=async()=>{const e=[],t=[];this.client.session.getAll().forEach((t=>{Sr(t.expiry)&&e.push(t.topic)})),this.client.proposal.getAll().forEach((e=>{Sr(e.expiry)&&t.push(e.id)})),await Promise.all([...e.map((e=>this.deleteSession(e))),...t.map((e=>this.deleteProposal(e)))])},this.onRelayEventRequest=async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state!==Eu){for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Eu;const e=this.requestQueue.queue.shift();if(e)try{this.processRequest(e),await new Promise((e=>setTimeout(e,300)))}catch(e){this.client.logger.warn(e)}}this.requestQueue.state=_u}else this.client.logger.info("Request queue already active, skipping...")},this.processRequest=e=>{const{topic:t,payload:r}=e,i=r.method;switch(i){case"wc_sessionPropose":return this.onSessionProposeRequest(t,r);case"wc_sessionSettle":return this.onSessionSettleRequest(t,r);case"wc_sessionUpdate":return this.onSessionUpdateRequest(t,r);case"wc_sessionExtend":return this.onSessionExtendRequest(t,r);case"wc_sessionPing":return this.onSessionPingRequest(t,r);case"wc_sessionDelete":return this.onSessionDeleteRequest(t,r);case"wc_sessionRequest":return this.onSessionRequest(t,r);case"wc_sessionEvent":return this.onSessionEventRequest(t,r);default:return this.client.logger.info(`Unsupported request method ${i}`)}},this.onRelayEventResponse=async e=>{const{topic:t,payload:r}=e,i=(await this.client.core.history.get(t,r.id)).request.method;switch(i){case"wc_sessionPropose":return this.onSessionProposeResponse(t,r);case"wc_sessionSettle":return this.onSessionSettleResponse(t,r);case"wc_sessionUpdate":return this.onSessionUpdateResponse(t,r);case"wc_sessionExtend":return this.onSessionExtendResponse(t,r);case"wc_sessionPing":return this.onSessionPingResponse(t,r);case"wc_sessionRequest":return this.onSessionRequestResponse(t,r);default:return this.client.logger.info(`Unsupported response method ${i}`)}},this.onRelayEventUnknownPayload=e=>{const{topic:t}=e,{message:r}=Yr("MISSING_OR_INVALID",`Decoded payload on topic ${t} is not identifiable as a JSON-RPC request or a response.`);throw new Error(r)},this.onSessionProposeRequest=async(e,t)=>{const{params:r,id:i}=t;try{this.isValidConnect(Ru({},t.params));const n=Er(k.FIVE_MINUTES),s=Ru({id:i,pairingTopic:e,expiry:n},r);await this.setProposal(i,s);const o=Yt(JSON.stringify(t)),a=await this.getVerifyContext(o,s.proposer.metadata);this.client.events.emit("session_proposal",{id:i,params:s,verifyContext:a})}catch(t){await this.sendError(i,e,t),this.client.logger.error(t)}},this.onSessionProposeResponse=async(e,t)=>{const{id:r}=t;if(qi(t)){const{result:i}=t;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:i});const n=this.client.proposal.get(r);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:n});const s=n.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:s});const o=i.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:o});const a=await this.client.core.crypto.generateSharedKey(s,o);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:a});const h=await this.client.core.relayer.subscribe(a);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:h}),await this.client.core.pairing.activate({topic:e})}else Di(t)&&(await this.client.proposal.delete(r,Xr("USER_DISCONNECTED")),this.events.emit(Ir("session_connect"),{error:t.error}))},this.onSessionSettleRequest=async(e,t)=>{const{id:r,params:i}=t;try{this.isValidSessionSettleRequest(i);const{relay:r,controller:n,expiry:s,namespaces:o,requiredNamespaces:a,optionalNamespaces:h,sessionProperties:c,pairingTopic:u}=t.params,l=Ru({topic:e,relay:r,expiry:s,namespaces:o,acknowledged:!0,pairingTopic:u,requiredNamespaces:a,optionalNamespaces:h,controller:n.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:n.publicKey,metadata:n.metadata}},c&&{sessionProperties:c});await this.sendResult({id:t.id,topic:e,result:!0}),this.events.emit(Ir("session_connect"),{session:l}),this.cleanupDuplicatePairings(l)}catch(t){await this.sendError(r,e,t),this.client.logger.error(t)}},this.onSessionSettleResponse=async(e,t)=>{const{id:r}=t;qi(t)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(Ir("session_approve",r),{})):Di(t)&&(await this.client.session.delete(e,Xr("USER_DISCONNECTED")),this.events.emit(Ir("session_approve",r),{error:t.error}))},this.onSessionUpdateRequest=async(e,t)=>{const{params:r,id:i}=t;try{const t=`${e}_session_update`,n=yi.get(t);if(n&&this.isRequestOutOfSync(n,i))return void this.client.logger.info(`Discarding out of sync request - ${i}`);this.isValidUpdate(Ru({topic:e},r)),await this.client.session.update(e,{namespaces:r.namespaces}),await this.sendResult({id:i,topic:e,result:!0}),this.client.events.emit("session_update",{id:i,topic:e,params:r}),yi.set(t,i)}catch(t){await this.sendError(i,e,t),this.client.logger.error(t)}},this.isRequestOutOfSync=(e,t)=>parseInt(t.toString().slice(0,-3))<=parseInt(e.toString().slice(0,-3)),this.onSessionUpdateResponse=(e,t)=>{const{id:r}=t;qi(t)?this.events.emit(Ir("session_update",r),{}):Di(t)&&this.events.emit(Ir("session_update",r),{error:t.error})},this.onSessionExtendRequest=async(e,t)=>{const{id:r}=t;try{this.isValidExtend({topic:e}),await this.setExpiry(e,Er(vu)),await this.sendResult({id:r,topic:e,result:!0}),this.client.events.emit("session_extend",{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.client.logger.error(t)}},this.onSessionExtendResponse=(e,t)=>{const{id:r}=t;qi(t)?this.events.emit(Ir("session_extend",r),{}):Di(t)&&this.events.emit(Ir("session_extend",r),{error:t.error})},this.onSessionPingRequest=async(e,t)=>{const{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult({id:r,topic:e,result:!0}),this.client.events.emit("session_ping",{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.client.logger.error(t)}},this.onSessionPingResponse=(e,t)=>{const{id:r}=t;setTimeout((()=>{qi(t)?this.events.emit(Ir("session_ping",r),{}):Di(t)&&this.events.emit(Ir("session_ping",r),{error:t.error})}),500)},this.onSessionDeleteRequest=async(e,t)=>{const{id:r}=t;try{this.isValidDisconnect({topic:e,reason:t.params}),await Promise.all([new Promise((t=>{this.client.core.relayer.once(Ns,(async()=>{t(await this.deleteSession(e))}))})),this.sendResult({id:r,topic:e,result:!0})]),this.client.events.emit("session_delete",{id:r,topic:e})}catch(e){this.client.logger.error(e)}},this.onSessionRequest=async(e,t)=>{const{id:r,params:i}=t;try{this.isValidRequest(Ru({topic:e},i));const t=Yt(JSON.stringify(Ai("wc_sessionRequest",i,r))),n=this.client.session.get(e),s={id:r,topic:e,params:i,verifyContext:await this.getVerifyContext(t,n.peer.metadata)};await this.setPendingSessionRequest(s),this.addSessionRequestToSessionRequestQueue(s),this.processSessionRequestQueue()}catch(t){await this.sendError(r,e,t),this.client.logger.error(t)}},this.onSessionRequestResponse=(e,t)=>{const{id:r}=t;qi(t)?this.events.emit(Ir("session_request",r),{result:t.result}):Di(t)&&this.events.emit(Ir("session_request",r),{error:t.error})},this.onSessionEventRequest=async(e,t)=>{const{id:r,params:i}=t;try{const t=`${e}_session_event_${i.event.name}`,n=yi.get(t);if(n&&this.isRequestOutOfSync(n,r))return void this.client.logger.info(`Discarding out of sync request - ${r}`);this.isValidEmit(Ru({topic:e},i)),this.client.events.emit("session_event",{id:r,topic:e,params:i}),yi.set(t,r)}catch(t){await this.sendError(r,e,t),this.client.logger.error(t)}},this.addSessionRequestToSessionRequestQueue=e=>{this.sessionRequestQueue.queue.push(e)},this.cleanupAfterResponse=e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout((()=>{this.sessionRequestQueue.state=_u,this.processSessionRequestQueue()}),(0,k.toMiliseconds)(this.requestQueueDelay))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Eu)return void this.client.logger.info("session request queue is already active.");const e=this.sessionRequestQueue.queue[0];if(e)try{this.sessionRequestQueue.state=Eu,this.client.events.emit("session_request",e)}catch(e){this.client.logger.error(e)}else this.client.logger.info("session request queue is empty.")},this.onPairingCreated=e=>{if(e.active)return;const t=this.client.proposal.getAll().find((t=>t.pairingTopic===e.topic));t&&this.onSessionProposeRequest(e.topic,Ai("wc_sessionPropose",{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces,relays:t.relays,proposer:t.proposer},t.id))},this.isValidConnect=async e=>{if(!ci(e)){const{message:t}=Yr("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(t)}const{pairingTopic:t,requiredNamespaces:r,optionalNamespaces:i,sessionProperties:n,relays:s}=e;if(ei(t)||await this.isValidPairingTopic(t),!function(e,t){let r=!1;return e?e&&Qr(e)&&e.length&&e.forEach((e=>{r=hi(e)})):r=!0,r}(s)){const{message:e}=Yr("MISSING_OR_INVALID",`connect() relays: ${s}`);throw new Error(e)}!ei(r)&&0!==Zr(r)&&this.validateNamespaces(r,"requiredNamespaces"),!ei(i)&&0!==Zr(i)&&this.validateNamespaces(i,"optionalNamespaces"),ei(n)||this.validateSessionProps(n,"sessionProperties")},this.validateNamespaces=(e,t)=>{const r=function(e,t,r){let i=null;if(e&&Zr(e)){const n=oi(e,t);n&&(i=n);const s=function(e,t,r){let i=null;return Object.entries(e).forEach((([e,n])=>{if(i)return;const s=function(e,t,r){let i=null;return Qr(t)&&t.length?t.forEach((e=>{i||ii(e)||(i=Xr("UNSUPPORTED_CHAINS",`${r}, chain ${e} should be a string and conform to "namespace:chainId" format`))})):ii(e)||(i=Xr("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),i}(e,Kt(e,n),`${t} ${r}`);s&&(i=s)})),i}(e,t,r);s&&(i=s)}else i=Yr("MISSING_OR_INVALID",`${t}, ${r} should be an object with data`);return i}(e,"connect()",t);if(r)throw new Error(r.message)},this.isValidApprove=async e=>{if(!ci(e))throw new Error(Yr("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:t,namespaces:r,relayProtocol:i,sessionProperties:n}=e;await this.isValidProposalId(t);const s=this.client.proposal.get(t),o=ai(r,"approve()");if(o)throw new Error(o.message);const a=li(s.requiredNamespaces,r,"approve()");if(a)throw new Error(a.message);if(!ti(i,!0)){const{message:e}=Yr("MISSING_OR_INVALID",`approve() relayProtocol: ${i}`);throw new Error(e)}ei(n)||this.validateSessionProps(n,"sessionProperties")},this.isValidReject=async e=>{if(!ci(e)){const{message:t}=Yr("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(t)}const{id:t,reason:r}=e;if(await this.isValidProposalId(t),!function(e){return!!(e&&"object"==typeof e&&e.code&&ri(e.code,!1)&&e.message&&ti(e.message,!1))}(r)){const{message:e}=Yr("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(r)}`);throw new Error(e)}},this.isValidSessionSettleRequest=e=>{if(!ci(e)){const{message:t}=Yr("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(t)}const{relay:t,controller:r,namespaces:i,expiry:n}=e;if(!hi(t)){const{message:e}=Yr("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(e)}const s=function(e,t){let r=null;return ti(e?.publicKey,!1)||(r=Yr("MISSING_OR_INVALID","onSessionSettleRequest() controller public key should be a string")),r}(r);if(s)throw new Error(s.message);const o=ai(i,"onSessionSettleRequest()");if(o)throw new Error(o.message);if(Sr(n)){const{message:e}=Yr("EXPIRED","onSessionSettleRequest()");throw new Error(e)}},this.isValidUpdate=async e=>{if(!ci(e)){const{message:t}=Yr("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(t)}const{topic:t,namespaces:r}=e;await this.isValidSessionTopic(t);const i=this.client.session.get(t),n=ai(r,"update()");if(n)throw new Error(n.message);const s=li(i.requiredNamespaces,r,"update()");if(s)throw new Error(s.message)},this.isValidExtend=async e=>{if(!ci(e)){const{message:t}=Yr("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionTopic(t)},this.isValidRequest=async e=>{if(!ci(e)){const{message:t}=Yr("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(t)}const{topic:t,request:r,chainId:i,expiry:n}=e;await this.isValidSessionTopic(t);const{namespaces:s}=this.client.session.get(t);if(!ui(s,i)){const{message:e}=Yr("MISSING_OR_INVALID",`request() chainId: ${i}`);throw new Error(e)}if(!function(e){return!(ei(e)||!ti(e.method,!1))}(r)){const{message:e}=Yr("MISSING_OR_INVALID",`request() ${JSON.stringify(r)}`);throw new Error(e)}if(!function(e,t,r){return!!ti(r,!1)&&function(e,t){const r=[];return Object.values(e).forEach((e=>{Fr(e.accounts).includes(t)&&r.push(...e.methods)})),r}(e,t).includes(r)}(s,i,r.method)){const{message:e}=Yr("MISSING_OR_INVALID",`request() method: ${r.method}`);throw new Error(e)}if(n&&!di(n,bu)){const{message:e}=Yr("MISSING_OR_INVALID",`request() expiry: ${n}. Expiry must be a number (in seconds) between ${bu.min} and ${bu.max}`);throw new Error(e)}},this.isValidRespond=async e=>{if(!ci(e)){const{message:t}=Yr("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(t)}const{topic:t,response:r}=e;if(await this.isValidSessionTopic(t),!function(e){return!(ei(e)||ei(e.result)&&ei(e.error)||!ri(e.id,!1)||!ti(e.jsonrpc,!1))}(r)){const{message:e}=Yr("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(r)}`);throw new Error(e)}},this.isValidPing=async e=>{if(!ci(e)){const{message:t}=Yr("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.isValidEmit=async e=>{if(!ci(e)){const{message:t}=Yr("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(t)}const{topic:t,event:r,chainId:i}=e;await this.isValidSessionTopic(t);const{namespaces:n}=this.client.session.get(t);if(!ui(n,i)){const{message:e}=Yr("MISSING_OR_INVALID",`emit() chainId: ${i}`);throw new Error(e)}if(!function(e){return!(ei(e)||!ti(e.name,!1))}(r)){const{message:e}=Yr("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw new Error(e)}if(!function(e,t,r){return!!ti(r,!1)&&function(e,t){const r=[];return Object.values(e).forEach((e=>{Fr(e.accounts).includes(t)&&r.push(...e.events)})),r}(e,t).includes(r)}(n,i,r.name)){const{message:e}=Yr("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw new Error(e)}},this.isValidDisconnect=async e=>{if(!ci(e)){const{message:t}=Yr("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.getVerifyContext=async(e,t)=>{const r={verified:{verifyUrl:t.verifyUrl||Js,validation:"UNKNOWN",origin:t.url||""}};try{const i=await this.client.core.verify.resolve({attestationId:e,verifyUrl:t.verifyUrl});i&&(r.verified.origin=i.origin,r.verified.isScam=i.isScam,r.verified.validation=i.origin===new URL(t.url).origin?"VALID":"INVALID")}catch(e){this.client.logger.info(e)}return this.client.logger.info(`Verify context: ${JSON.stringify(r)}`),r},this.validateSessionProps=(e,t)=>{Object.values(e).forEach((e=>{if(!ti(e,!1)){const{message:r}=Yr("MISSING_OR_INVALID",`${t} must be in Record format. Received: ${JSON.stringify(e)}`);throw new Error(r)}}))}}async isInitialized(){if(!this.initialized){const{message:e}=Yr("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Ms,(async e=>{const{topic:t,message:r}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(r)))return;const i=await this.client.core.crypto.decode(t,r);try{ji(i)?(this.client.core.history.set(t,i),this.onRelayEventRequest({topic:t,payload:i})):ki(i)?(await this.client.core.history.resolve(i),await this.onRelayEventResponse({topic:t,payload:i}),this.client.core.history.delete(t,i.id)):this.onRelayEventUnknownPayload({topic:t,payload:i})}catch(e){this.client.logger.error(e)}}))}registerExpirerEvents(){this.client.core.expirer.on(Ws,(async e=>{const{topic:t,id:r}=_r(e.target);if(r&&this.client.pendingRequest.keys.includes(r))return await this.deletePendingSessionRequest(r,Yr("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession(t,!0),this.client.events.emit("session_expire",{topic:t})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r}))}))}registerPairingEvents(){this.client.core.pairing.events.on($s,(e=>this.onPairingCreated(e)))}isValidPairingTopic(e){if(!ti(e,!1)){const{message:t}=Yr("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=Yr("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(Sr(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=Yr("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!ti(e,!1)){const{message:t}=Yr("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(!this.client.session.keys.includes(e)){const{message:t}=Yr("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(Sr(this.client.session.get(e).expiry)){await this.deleteSession(e);const{message:t}=Yr("EXPIRED",`session topic: ${e}`);throw new Error(t)}}async isValidSessionOrPairingTopic(e){if(this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else{if(!this.client.core.pairing.pairings.keys.includes(e)){if(ti(e,!1)){const{message:t}=Yr("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}{const{message:t}=Yr("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}this.isValidPairingTopic(e)}}async isValidProposalId(e){if("number"!=typeof e){const{message:t}=Yr("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=Yr("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(Sr(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);const{message:t}=Yr("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class Cu extends Ao{constructor(e,t){super(e,t,"proposal",gu),this.core=e,this.logger=t}}class Uu extends Ao{constructor(e,t){super(e,t,"session",gu),this.core=e,this.logger=t}}class ju extends Ao{constructor(e,t){super(e,t,"request",gu,(e=>e.id)),this.core=e,this.logger=t}}class ku extends N{constructor(e){super(e),this.protocol="wc",this.version=2,this.name=yu,this.events=new g.EventEmitter,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.removeAllListeners=e=>this.events.removeAllListeners(e),this.connect=async e=>{try{return await this.engine.connect(e)}catch(e){throw this.logger.error(e.message),e}},this.pair=async e=>{try{return await this.engine.pair(e)}catch(e){throw this.logger.error(e.message),e}},this.approve=async e=>{try{return await this.engine.approve(e)}catch(e){throw this.logger.error(e.message),e}},this.reject=async e=>{try{return await this.engine.reject(e)}catch(e){throw this.logger.error(e.message),e}},this.update=async e=>{try{return await this.engine.update(e)}catch(e){throw this.logger.error(e.message),e}},this.extend=async e=>{try{return await this.engine.extend(e)}catch(e){throw this.logger.error(e.message),e}},this.request=async e=>{try{return await this.engine.request(e)}catch(e){throw this.logger.error(e.message),e}},this.respond=async e=>{try{return await this.engine.respond(e)}catch(e){throw this.logger.error(e.message),e}},this.ping=async e=>{try{return await this.engine.ping(e)}catch(e){throw this.logger.error(e.message),e}},this.emit=async e=>{try{return await this.engine.emit(e)}catch(e){throw this.logger.error(e.message),e}},this.disconnect=async e=>{try{return await this.engine.disconnect(e)}catch(e){throw this.logger.error(e.message),e}},this.find=e=>{try{return this.engine.find(e)}catch(e){throw this.logger.error(e.message),e}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(e){throw this.logger.error(e.message),e}},this.name=e?.name||yu,this.metadata=e?.metadata||(0,zt.D)()||{name:"",description:"",url:"",icons:[""]};const t=typeof e?.logger<"u"&&"string"!=typeof e?.logger?e.logger:(0,w.pino)((0,w.getDefaultLoggerOptions)({level:e?.logger||"error"}));this.core=e?.core||new qo(e),this.logger=(0,w.generateChildLogger)(t,this.name),this.session=new Uu(this.core,this.logger),this.proposal=new Cu(this.core,this.logger),this.pendingRequest=new ju(this.core,this.logger),this.engine=new Lu(this)}static async init(e){const t=new ku(e);return await t.initialize(),t}get context(){return(0,w.getLoggerContext)(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}const qu=ku;var Du,zu={exports:{}},$u="object"==typeof Reflect?Reflect:null,Bu=$u&&"function"==typeof $u.apply?$u.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};Du=$u&&"function"==typeof $u.ownKeys?$u.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var Ku=Number.isNaN||function(e){return e!=e};function Fu(){Fu.init.call(this)}zu.exports=Fu,zu.exports.once=function(e,t){return new Promise((function(r,i){function n(r){e.removeListener(t,s),i(r)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments))}el(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&el(e,"error",t,{once:!0})}(e,n)}))},Fu.EventEmitter=Fu,Fu.prototype._events=void 0,Fu.prototype._eventsCount=0,Fu.prototype._maxListeners=void 0;var Vu=10;function Hu(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function Wu(e){return void 0===e._maxListeners?Fu.defaultMaxListeners:e._maxListeners}function Gu(e,t,r,i){var n,s,o;if(Hu(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"==typeof o?o=s[t]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=Wu(e))>0&&o.length>n&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=o.length,function(e){console&&console.warn&&console.warn(e)}(a)}return e}function Ju(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Yu(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=Ju.bind(i);return n.listener=r,i.wrapFn=n,n}function Xu(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var a=n[e];if(void 0===a)return!1;if("function"==typeof a)Bu(a,this,t);else{var h=a.length,c=Zu(a,h);for(r=0;r=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1=0;i--)this.removeListener(e,t[i]);return this},Fu.prototype.listeners=function(e){return Xu(this,e,!0)},Fu.prototype.rawListeners=function(e){return Xu(this,e,!1)},Fu.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Qu.call(e,t)},Fu.prototype.listenerCount=Qu,Fu.prototype.eventNames=function(){return this._eventsCount>0?Du(this._events):[]};zu.exports;class tl{constructor(e){this.opts=e}}class rl{constructor(e){this.client=e}}class il extends rl{constructor(e){super(e),this.init=async()=>{this.signClient=await qu.init({core:this.client.core,metadata:this.client.metadata}),this.authClient=await du.init({core:this.client.core,projectId:"",metadata:this.client.metadata}),this.initializeEventListeners()},this.pair=async e=>{await this.client.core.pairing.pair(e)},this.approveSession=async e=>{const{topic:t,acknowledged:r}=await this.signClient.approve({id:e.id,namespaces:e.namespaces});return await r(),this.signClient.session.get(t)},this.rejectSession=async e=>await this.signClient.reject(e),this.updateSession=async e=>await(await this.signClient.update(e)).acknowledged(),this.extendSession=async e=>await(await this.signClient.extend(e)).acknowledged(),this.respondSessionRequest=async e=>await this.signClient.respond(e),this.disconnectSession=async e=>await this.signClient.disconnect(e),this.emitSessionEvent=async e=>await this.signClient.emit(e),this.getActiveSessions=()=>this.signClient.session.getAll().reduce(((e,t)=>(e[t.topic]=t,e)),{}),this.getPendingSessionProposals=()=>this.signClient.proposal.getAll(),this.getPendingSessionRequests=()=>this.signClient.getPendingSessionRequests(),this.respondAuthRequest=async(e,t)=>await this.authClient.respond(e,t),this.getPendingAuthRequests=()=>this.authClient.requests.getAll().filter((e=>"requester"in e)),this.formatMessage=(e,t)=>this.authClient.formatMessage(e,t),this.onSessionRequest=e=>{this.client.events.emit("session_request",e)},this.onSessionProposal=e=>{this.client.events.emit("session_proposal",e)},this.onSessionDelete=e=>{this.client.events.emit("session_delete",e)},this.onAuthRequest=e=>{this.client.events.emit("auth_request",e)},this.initializeEventListeners=()=>{this.signClient.events.on("session_proposal",this.onSessionProposal),this.signClient.events.on("session_request",this.onSessionRequest),this.signClient.events.on("session_delete",this.onSessionDelete),this.authClient.on("auth_request",this.onAuthRequest)},this.signClient={},this.authClient={}}}class nl extends tl{constructor(e){super(e),this.events=new zu.exports,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.pair=async e=>{try{return await this.engine.pair(e)}catch(e){throw this.logger.error(e.message),e}},this.approveSession=async e=>{try{return await this.engine.approveSession(e)}catch(e){throw this.logger.error(e.message),e}},this.rejectSession=async e=>{try{return await this.engine.rejectSession(e)}catch(e){throw this.logger.error(e.message),e}},this.updateSession=async e=>{try{return await this.engine.updateSession(e)}catch(e){throw this.logger.error(e.message),e}},this.extendSession=async e=>{try{return await this.engine.extendSession(e)}catch(e){throw this.logger.error(e.message),e}},this.respondSessionRequest=async e=>{try{return await this.engine.respondSessionRequest(e)}catch(e){throw this.logger.error(e.message),e}},this.disconnectSession=async e=>{try{return await this.engine.disconnectSession(e)}catch(e){throw this.logger.error(e.message),e}},this.emitSessionEvent=async e=>{try{return await this.engine.emitSessionEvent(e)}catch(e){throw this.logger.error(e.message),e}},this.getActiveSessions=()=>{try{return this.engine.getActiveSessions()}catch(e){throw this.logger.error(e.message),e}},this.getPendingSessionProposals=()=>{try{return this.engine.getPendingSessionProposals()}catch(e){throw this.logger.error(e.message),e}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(e){throw this.logger.error(e.message),e}},this.respondAuthRequest=async(e,t)=>{try{return await this.engine.respondAuthRequest(e,t)}catch(e){throw this.logger.error(e.message),e}},this.getPendingAuthRequests=()=>{try{return this.engine.getPendingAuthRequests()}catch(e){throw this.logger.error(e.message),e}},this.formatMessage=(e,t)=>{try{return this.engine.formatMessage(e,t)}catch(e){throw this.logger.error(e.message),e}},this.metadata=e.metadata,this.name=e.name||"Web3Wallet",this.core=e.core,this.logger=this.core.logger,this.engine=new il(this)}static async init(e){const t=new nl(e);return await t.initialize(),t}async initialize(){this.logger.trace("Initialized");try{await this.engine.init(),this.logger.info("Web3Wallet Initialization Success")}catch(e){throw this.logger.info("Web3Wallet Initialization Failure"),this.logger.error(e.message),e}}}const sl=nl;var ol=r(4429);window.wc={core:null,web3wallet:null,authClient:null,statusObject:null,init:function(e){return(async()=>{try{await new Promise(((e,t)=>{window.wc.channel=new ol.QWebChannel(qt.webChannelTransport,(function(r){let i=r.objects.statusObject;i?(window.wc.statusObject=i,e()):t(new Error("Unable to resolve statusObject"))}))}))}catch(e){return void wc.statusObject.sdkInitialized(e)}window.wc.core=new qo({projectId:e}),window.wc.web3wallet=await sl.init({core:window.wc.core,metadata:{name:"Status",description:"Status Wallet",url:"http://localhost",icons:["https://status.im/img/status-footer-logo.svg"]}}),window.wc.authClient=await fu.init({projectId:e,metadata:window.wc.web3wallet.metadata}),window.wc.web3wallet.on("session_proposal",(async e=>{wc.statusObject.onSessionProposal(e)})),window.wc.web3wallet.on("session_update",(async e=>{wc.statusObject.onSessionUpdate(e)})),window.wc.web3wallet.on("session_extend",(async e=>{wc.statusObject.onSessionExtend(e)})),window.wc.web3wallet.on("session_ping",(async e=>{wc.statusObject.onSessionPing(e)})),window.wc.web3wallet.on("session_delete",(async e=>{wc.statusObject.onSessionDelete(e)})),window.wc.web3wallet.on("session_expire",(async e=>{wc.statusObject.onSessionExpire(e)})),window.wc.web3wallet.on("session_request",(async e=>{wc.statusObject.onSessionRequest(e)})),window.wc.web3wallet.on("session_request_sent",(async e=>{wc.statusObject.onSessionRequestSent(e)})),window.wc.web3wallet.on("session_event",(async e=>{wc.statusObject.onSessionEvent(e)})),window.wc.web3wallet.on("proposal_expire",(async e=>{wc.statusObject.onProposalExpire(e)})),wc.statusObject.sdkInitialized("")})(),{result:"ok",error:""}},pair:function(e){return{result:window.wc.web3wallet.pair({uri:e}),error:""}},getPairings:function(){return{result:window.wc.core.pairing.getPairings(),error:""}},disconnect:function(e){return{result:window.wc.core.pairing.disconnect({topic:e}),error:""}},approvePairSession:function(e,t){const{id:r,params:i}=e,n=function(e){const{proposal:{requiredNamespaces:t,optionalNamespaces:r={}},supportedNamespaces:i}=e,n=Wr(t),s=Wr(r),o={};Object.keys(i).forEach((e=>{const t=i[e].chains,r=i[e].methods,n=i[e].events,s=i[e].accounts;t.forEach((t=>{if(!s.some((e=>e.includes(t))))throw new Error(`No accounts provided for chain ${t} in namespace ${e}`)})),o[e]={chains:t,methods:r,events:n,accounts:s}}));const a=li(t,o,"approve()");if(a)throw new Error(a.message);const h={};return Object.keys(t).length||Object.keys(r).length?(Object.keys(n).forEach((e=>{const t=i[e].chains.filter((t=>{var r,i;return null==(i=null==(r=n[e])?void 0:r.chains)?void 0:i.includes(t)})),r=i[e].methods.filter((t=>{var r,i;return null==(i=null==(r=n[e])?void 0:r.methods)?void 0:i.includes(t)})),s=i[e].events.filter((t=>{var r,i;return null==(i=null==(r=n[e])?void 0:r.events)?void 0:i.includes(t)})),o=t.map((t=>i[e].accounts.filter((e=>e.includes(`${t}:`))))).flat();h[e]={chains:t,methods:r,events:s,accounts:o}})),Object.keys(s).forEach((e=>{var t,r,n,o,a,c;if(!i[e])return;const u=null==(r=null==(t=s[e])?void 0:t.chains)?void 0:r.filter((t=>i[e].chains.includes(t))),l=i[e].methods.filter((t=>{var r,i;return null==(i=null==(r=s[e])?void 0:r.methods)?void 0:i.includes(t)})),f=i[e].events.filter((t=>{var r,i;return null==(i=null==(r=s[e])?void 0:r.events)?void 0:i.includes(t)})),d=u?.map((t=>i[e].accounts.filter((e=>e.includes(`${t}:`))))).flat();h[e]={chains:Mr(null==(n=h[e])?void 0:n.chains,u),methods:Mr(null==(o=h[e])?void 0:o.methods,l),events:Mr(null==(a=h[e])?void 0:a.events,f),accounts:Mr(null==(c=h[e])?void 0:c.accounts,d)}})),h):o}({proposal:i,supportedNamespaces:t});return{result:window.wc.web3wallet.approveSession({id:r,namespaces:n}),error:""}},rejectPairSession:function(e){return{result:window.wc.web3wallet.rejectSession({id:e,reason:Xr("USER_REJECTED")}),error:""}},auth:function(e){return{result:window.wc.authClient.core.pairing.pair({uri:e}),error:""}},approveAuth:function(e){const{id:t,params:r}=e,i="did:pkh:eip155:1:0x0123456789";return window.wc.authClient.formatMessage(r.cacaoPayload,i),{result:window.wc.authClient.respond({id:t,signature:{s:"0x123456789",t:"eip191"}},i),error:""}},rejectAuth:function(e){return{result:window.wc.authClient.reject(e),error:""}},respondSessionRequest:function(e,t,r){const i=Oi(t,r);return{result:window.wc.web3wallet.respondSessionRequest({topic:e,response:i}),error:""}},rejectSessionRequest:function(e,t,r=!1){const i=r?"SESSION_SETTLEMENT_FAILED":"USER_REJECTED";return{result:window.wc.web3wallet.respondSessionRequest({topic:e,response:xi(t,Xr(i))}),error:""}}}})(); \ No newline at end of file diff --git a/ui/app/AppLayouts/Wallet/views/walletconnect/sdk/src/index.html b/ui/app/AppLayouts/Wallet/views/walletconnect/sdk/src/index.html new file mode 100644 index 0000000000..9890b6d155 --- /dev/null +++ b/ui/app/AppLayouts/Wallet/views/walletconnect/sdk/src/index.html @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/ui/app/AppLayouts/Wallet/views/walletconnect/sdk/src/index.js b/ui/app/AppLayouts/Wallet/views/walletconnect/sdk/src/index.js index 1cb996434d..b1324b97b1 100644 --- a/ui/app/AppLayouts/Wallet/views/walletconnect/sdk/src/index.js +++ b/ui/app/AppLayouts/Wallet/views/walletconnect/sdk/src/index.js @@ -3,19 +3,27 @@ import { Web3Wallet } from "@walletconnect/web3wallet"; import AuthClient from '@walletconnect/auth-client' +import { QWebChannel } from './qwebchannel'; + // import the builder util import { buildApprovedNamespaces, getSdkError } from "@walletconnect/utils"; import { formatJsonRpcResult, formatJsonRpcError } from "@walletconnect/jsonrpc-utils"; -// "Export" API to window -// Workaround, tried using export via output.module: true in webpack.config.js, but it didn't work window.wc = { core: null, web3wallet: null, authClient: null, + statusObject: null, init: function (projectId) { - return new Promise(async (resolve) => { + (async () => { + try { + await createWebChannel(); + } catch (error) { + wc.statusObject.sdkInitialized(error); + return + } + window.wc.core = new Core({ projectId: projectId, }); @@ -33,59 +41,75 @@ window.wc = { window.wc.authClient = await AuthClient.init({ projectId: projectId, metadata: window.wc.web3wallet.metadata, - }) + }); - resolve() - }) + // connect session responses https://specs.walletconnect.com/2.0/specs/clients/sign/session-events#events + window.wc.web3wallet.on("session_proposal", async (details) => { + wc.statusObject.onSessionProposal(details) + }); + + window.wc.web3wallet.on("session_update", async (details) => { + wc.statusObject.onSessionUpdate(details) + }); + + window.wc.web3wallet.on("session_extend", async (details) => { + wc.statusObject.onSessionExtend(details) + }); + + window.wc.web3wallet.on("session_ping", async (details) => { + wc.statusObject.onSessionPing(details) + }); + + window.wc.web3wallet.on("session_delete", async (details) => { + wc.statusObject.onSessionDelete(details) + }); + + window.wc.web3wallet.on("session_expire", async (details) => { + wc.statusObject.onSessionExpire(details) + }); + + window.wc.web3wallet.on("session_request", async (details) => { + wc.statusObject.onSessionRequest(details) + }); + + window.wc.web3wallet.on("session_request_sent", async (details) => { + wc.statusObject.onSessionRequestSent(details) + }); + + window.wc.web3wallet.on("session_event", async (details) => { + wc.statusObject.onSessionEvent(details) + }); + + window.wc.web3wallet.on("proposal_expire", async (details) => { + wc.statusObject.onProposalExpire(details) + }); + + wc.statusObject.sdkInitialized(""); + })(); + + return { result: "ok", error: "" }; }, - alreadyPaired: new Error("Already paired"), - waitingForApproval: new Error("Waiting for approval"), // TODO: there is a corner case when attempting to pair with a link that is already paired or was rejected won't trigger any event back pair: function (uri) { - let pairingTopic = getPairingTopicFromPairingUrl(uri); - - const pairings = window.wc.core.pairing.getPairings(); - // Find pairing by topic - const pairing = pairings.find((p) => p.topic === pairingTopic); - if (pairing) { - if (pairing.active) { - return new Promise((_, reject) => { - reject(window.wc.alreadyPaired); - }); - } - } - - let pairPromise = window.wc.web3wallet - .pair({ uri: uri }) - - return new Promise((resolve, reject) => { - pairPromise - .then(() => { - window.wc.web3wallet.on("session_proposal", async (sessionProposal) => { - resolve(sessionProposal); - }); - }) - .catch((error) => { - reject(error); - }); - }); + return { + result: window.wc.web3wallet.pair({ uri }), + error: "" + }; }, getPairings: function () { - return window.wc.core.pairing.getPairings(); + return { + result: window.wc.core.pairing.getPairings(), + error: "" + }; }, disconnect: function (topic) { - return window.wc.core.pairing.disconnect({ topic: topic}); - }, - - registerForSessionRequest: function (callback) { - window.wc.web3wallet.on("session_request", callback); - }, - - registerForSessionDelete: function (callback) { - window.wc.web3wallet.on("session_delete", callback); + return { + result: window.wc.core.pairing.disconnect({ topic: topic }), + error: "" + }; }, approvePairSession: function (sessionProposal, supportedNamespaces) { @@ -96,47 +120,29 @@ window.wc = { supportedNamespaces: supportedNamespaces, }); - return window.wc.web3wallet.approveSession({ - id, - namespaces: approvedNamespaces, - }); + return { + result: window.wc.web3wallet.approveSession({ + id, + namespaces: approvedNamespaces, + }), + error: "" + }; }, rejectPairSession: function (id) { - return window.wc.web3wallet.rejectSession({ - id: id, - reason: getSdkError("USER_REJECTED"), // TODO USER_REJECTED_METHODS, USER_REJECTED_CHAINS, USER_REJECTED_EVENTS - }); + return { + result: window.wc.web3wallet.rejectSession({ + id: id, + reason: getSdkError("USER_REJECTED"), // TODO USER_REJECTED_METHODS, USER_REJECTED_CHAINS, USER_REJECTED_EVENTS + }), + error: "" + }; }, auth: function (uri) { - let pairingTopic = getPairingTopicFromPairingUrl(uri); - - const pairings = window.wc.core.pairing.getPairings(); - // Find pairing by topic - const pairing = pairings.find((p) => p.topic === pairingTopic); - if (pairing) { - if (pairing.active) { - return new Promise((_, reject) => { - reject(window.wc.alreadyPaired); - }); - } - } - - let pairPromise = window.wc.authClient.core.pairing - .pair({ uri }) - - return new Promise((resolve, reject) => { - pairPromise - .then(() => { - // TODO: check if we can separate using the URI info - window.wc.authClient.on("auth_request", async (authProposal) => { - resolve(authProposal); - }); - }) - .catch((error) => { - reject(error); - }); - }); + return { + result: window.wc.authClient.core.pairing.pair({ uri }), + error: "" + }; }, approveAuth: function (authProposal) { @@ -151,7 +157,8 @@ window.wc = { // TODO: signature const signature = "0x123456789" - return window.wc.authClient.respond( + return { + result: window.wc.authClient.respond( { id: id, signature: { @@ -159,43 +166,49 @@ window.wc = { t: "eip191", }, }, - iss - ); + iss), + error: "" + }; }, + rejectAuth: function (id) { - return window.wc.authClient.reject(id); + return { + result: window.wc.authClient.reject(id), + error: "" + }; }, respondSessionRequest: function (topic, id, signature) { const response = formatJsonRpcResult(id, signature) - return window.wc.web3wallet.respondSessionRequest({ topic, response }); + return { + result: window.wc.web3wallet.respondSessionRequest({ topic, response }), + error: "" + }; }, rejectSessionRequest: function (topic, id, error = false) { const errorType = error ? "SESSION_SETTLEMENT_FAILED" : "USER_REJECTED"; - return window.wc.web3wallet.respondSessionRequest({ - topic: topic, - response: formatJsonRpcError(id, getSdkError(errorType)), - }); - }, - - - disconnectAll: function () { - const pairings = window.wc.core.pairing.getPairings(); - pairings.forEach((p) => { - window.wc.core.pairing.disconnect({ topic: p.topic }); - }); + return { + result: window.wc.web3wallet.respondSessionRequest({ + topic: topic, + response: formatJsonRpcError(id, getSdkError(errorType)), + }), + error: "" + }; }, }; -// Returns null if not a pairing url -function getPairingTopicFromPairingUrl(url) { - if (!url.startsWith("wc:")) { - return null; - } - const atIndex = url.indexOf("@"); - if (atIndex < 0) { - return null; - } - return url.slice(3, atIndex); +function createWebChannel(projectId) { + return new Promise((resolve, reject) => { + window.wc.channel = new QWebChannel(qt.webChannelTransport, function (channel) { + let statusObject = channel.objects.statusObject; + + if (!statusObject) { + reject(new Error("Unable to resolve statusObject")); + } else { + window.wc.statusObject = statusObject; + resolve(); + } + }); + }); } diff --git a/ui/app/AppLayouts/Wallet/views/walletconnect/sdk/src/qwebchannel.js b/ui/app/AppLayouts/Wallet/views/walletconnect/sdk/src/qwebchannel.js new file mode 100644 index 0000000000..ee4c5793ac --- /dev/null +++ b/ui/app/AppLayouts/Wallet/views/walletconnect/sdk/src/qwebchannel.js @@ -0,0 +1,448 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Milian Wolff +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWebChannel module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +"use strict"; + +var QWebChannelMessageTypes = { + signal: 1, + propertyUpdate: 2, + init: 3, + idle: 4, + debug: 5, + invokeMethod: 6, + connectToSignal: 7, + disconnectFromSignal: 8, + setProperty: 9, + response: 10, +}; + +var QWebChannel = function(transport, initCallback) +{ + if (typeof transport !== "object" || typeof transport.send !== "function") { + console.error("The QWebChannel expects a transport object with a send function and onmessage callback property." + + " Given is: transport: " + typeof(transport) + ", transport.send: " + typeof(transport.send)); + return; + } + + var channel = this; + this.transport = transport; + + this.send = function(data) + { + if (typeof(data) !== "string") { + data = JSON.stringify(data); + } + channel.transport.send(data); + } + + this.transport.onmessage = function(message) + { + var data = message.data; + if (typeof data === "string") { + data = JSON.parse(data); + } + switch (data.type) { + case QWebChannelMessageTypes.signal: + channel.handleSignal(data); + break; + case QWebChannelMessageTypes.response: + channel.handleResponse(data); + break; + case QWebChannelMessageTypes.propertyUpdate: + channel.handlePropertyUpdate(data); + break; + default: + console.error("invalid message received:", message.data); + break; + } + } + + this.execCallbacks = {}; + this.execId = 0; + this.exec = function(data, callback) + { + if (!callback) { + // if no callback is given, send directly + channel.send(data); + return; + } + if (channel.execId === Number.MAX_VALUE) { + // wrap + channel.execId = Number.MIN_VALUE; + } + if (data.hasOwnProperty("id")) { + console.error("Cannot exec message with property id: " + JSON.stringify(data)); + return; + } + data.id = channel.execId++; + channel.execCallbacks[data.id] = callback; + channel.send(data); + }; + + this.objects = {}; + + this.handleSignal = function(message) + { + var object = channel.objects[message.object]; + if (object) { + object.signalEmitted(message.signal, message.args); + } else { + console.warn("Unhandled signal: " + message.object + "::" + message.signal); + } + } + + this.handleResponse = function(message) + { + if (!message.hasOwnProperty("id")) { + console.error("Invalid response message received: ", JSON.stringify(message)); + return; + } + channel.execCallbacks[message.id](message.data); + delete channel.execCallbacks[message.id]; + } + + this.handlePropertyUpdate = function(message) + { + message.data.forEach(data => { + var object = channel.objects[data.object]; + if (object) { + object.propertyUpdate(data.signals, data.properties); + } else { + console.warn("Unhandled property update: " + data.object + "::" + data.signal); + } + }); + channel.exec({type: QWebChannelMessageTypes.idle}); + } + + this.debug = function(message) + { + channel.send({type: QWebChannelMessageTypes.debug, data: message}); + }; + + channel.exec({type: QWebChannelMessageTypes.init}, function(data) { + for (const objectName of Object.keys(data)) { + new QObject(objectName, data[objectName], channel); + } + + // now unwrap properties, which might reference other registered objects + for (const objectName of Object.keys(channel.objects)) { + channel.objects[objectName].unwrapProperties(); + } + + if (initCallback) { + initCallback(channel); + } + channel.exec({type: QWebChannelMessageTypes.idle}); + }); +}; + +function QObject(name, data, webChannel) +{ + this.__id__ = name; + webChannel.objects[name] = this; + + // List of callbacks that get invoked upon signal emission + this.__objectSignals__ = {}; + + // Cache of all properties, updated when a notify signal is emitted + this.__propertyCache__ = {}; + + var object = this; + + // ---------------------------------------------------------------------- + + this.unwrapQObject = function(response) + { + if (response instanceof Array) { + // support list of objects + return response.map(qobj => object.unwrapQObject(qobj)) + } + if (!(response instanceof Object)) + return response; + + if (!response["__QObject*__"] || response.id === undefined) { + var jObj = {}; + for (const propName of Object.keys(response)) { + jObj[propName] = object.unwrapQObject(response[propName]); + } + return jObj; + } + + var objectId = response.id; + if (webChannel.objects[objectId]) + return webChannel.objects[objectId]; + + if (!response.data) { + console.error("Cannot unwrap unknown QObject " + objectId + " without data."); + return; + } + + var qObject = new QObject( objectId, response.data, webChannel ); + qObject.destroyed.connect(function() { + if (webChannel.objects[objectId] === qObject) { + delete webChannel.objects[objectId]; + // reset the now deleted QObject to an empty {} object + // just assigning {} though would not have the desired effect, but the + // below also ensures all external references will see the empty map + // NOTE: this detour is necessary to workaround QTBUG-40021 + Object.keys(qObject).forEach(name => delete qObject[name]); + } + }); + // here we are already initialized, and thus must directly unwrap the properties + qObject.unwrapProperties(); + return qObject; + } + + this.unwrapProperties = function() + { + for (const propertyIdx of Object.keys(object.__propertyCache__)) { + object.__propertyCache__[propertyIdx] = object.unwrapQObject(object.__propertyCache__[propertyIdx]); + } + } + + function addSignal(signalData, isPropertyNotifySignal) + { + var signalName = signalData[0]; + var signalIndex = signalData[1]; + object[signalName] = { + connect: function(callback) { + if (typeof(callback) !== "function") { + console.error("Bad callback given to connect to signal " + signalName); + return; + } + + object.__objectSignals__[signalIndex] = object.__objectSignals__[signalIndex] || []; + object.__objectSignals__[signalIndex].push(callback); + + // only required for "pure" signals, handled separately for properties in propertyUpdate + if (isPropertyNotifySignal) + return; + + // also note that we always get notified about the destroyed signal + if (signalName === "destroyed" || signalName === "destroyed()" || signalName === "destroyed(QObject*)") + return; + + // and otherwise we only need to be connected only once + if (object.__objectSignals__[signalIndex].length == 1) { + webChannel.exec({ + type: QWebChannelMessageTypes.connectToSignal, + object: object.__id__, + signal: signalIndex + }); + } + }, + disconnect: function(callback) { + if (typeof(callback) !== "function") { + console.error("Bad callback given to disconnect from signal " + signalName); + return; + } + object.__objectSignals__[signalIndex] = object.__objectSignals__[signalIndex] || []; + var idx = object.__objectSignals__[signalIndex].indexOf(callback); + if (idx === -1) { + console.error("Cannot find connection of signal " + signalName + " to " + callback.name); + return; + } + object.__objectSignals__[signalIndex].splice(idx, 1); + if (!isPropertyNotifySignal && object.__objectSignals__[signalIndex].length === 0) { + // only required for "pure" signals, handled separately for properties in propertyUpdate + webChannel.exec({ + type: QWebChannelMessageTypes.disconnectFromSignal, + object: object.__id__, + signal: signalIndex + }); + } + } + }; + } + + /** + * Invokes all callbacks for the given signalname. Also works for property notify callbacks. + */ + function invokeSignalCallbacks(signalName, signalArgs) + { + var connections = object.__objectSignals__[signalName]; + if (connections) { + connections.forEach(function(callback) { + callback.apply(callback, signalArgs); + }); + } + } + + this.propertyUpdate = function(signals, propertyMap) + { + // update property cache + for (const propertyIndex of Object.keys(propertyMap)) { + var propertyValue = propertyMap[propertyIndex]; + object.__propertyCache__[propertyIndex] = this.unwrapQObject(propertyValue); + } + + for (const signalName of Object.keys(signals)) { + // Invoke all callbacks, as signalEmitted() does not. This ensures the + // property cache is updated before the callbacks are invoked. + invokeSignalCallbacks(signalName, signals[signalName]); + } + } + + this.signalEmitted = function(signalName, signalArgs) + { + invokeSignalCallbacks(signalName, this.unwrapQObject(signalArgs)); + } + + function addMethod(methodData) + { + var methodName = methodData[0]; + var methodIdx = methodData[1]; + + // Fully specified methods are invoked by id, others by name for host-side overload resolution + var invokedMethod = methodName[methodName.length - 1] === ')' ? methodIdx : methodName + + object[methodName] = function() { + var args = []; + var callback; + var errCallback; + for (var i = 0; i < arguments.length; ++i) { + var argument = arguments[i]; + if (typeof argument === "function") + callback = argument; + else if (argument instanceof QObject && webChannel.objects[argument.__id__] !== undefined) + args.push({ + "id": argument.__id__ + }); + else + args.push(argument); + } + + var result; + // during test, webChannel.exec synchronously calls the callback + // therefore, the promise must be constucted before calling + // webChannel.exec to ensure the callback is set up + if (!callback && (typeof(Promise) === 'function')) { + result = new Promise(function(resolve, reject) { + callback = resolve; + errCallback = reject; + }); + } + + webChannel.exec({ + "type": QWebChannelMessageTypes.invokeMethod, + "object": object.__id__, + "method": invokedMethod, + "args": args + }, function(response) { + if (response !== undefined) { + var result = object.unwrapQObject(response); + if (callback) { + (callback)(result); + } + } else if (errCallback) { + (errCallback)(); + } + }); + + return result; + }; + } + + function bindGetterSetter(propertyInfo) + { + var propertyIndex = propertyInfo[0]; + var propertyName = propertyInfo[1]; + var notifySignalData = propertyInfo[2]; + // initialize property cache with current value + // NOTE: if this is an object, it is not directly unwrapped as it might + // reference other QObject that we do not know yet + object.__propertyCache__[propertyIndex] = propertyInfo[3]; + + if (notifySignalData) { + if (notifySignalData[0] === 1) { + // signal name is optimized away, reconstruct the actual name + notifySignalData[0] = propertyName + "Changed"; + } + addSignal(notifySignalData, true); + } + + Object.defineProperty(object, propertyName, { + configurable: true, + get: function () { + var propertyValue = object.__propertyCache__[propertyIndex]; + if (propertyValue === undefined) { + // This shouldn't happen + console.warn("Undefined value in property cache for property \"" + propertyName + "\" in object " + object.__id__); + } + + return propertyValue; + }, + set: function(value) { + if (value === undefined) { + console.warn("Property setter for " + propertyName + " called with undefined value!"); + return; + } + object.__propertyCache__[propertyIndex] = value; + var valueToSend = value; + if (valueToSend instanceof QObject && webChannel.objects[valueToSend.__id__] !== undefined) + valueToSend = { "id": valueToSend.__id__ }; + webChannel.exec({ + "type": QWebChannelMessageTypes.setProperty, + "object": object.__id__, + "property": propertyIndex, + "value": valueToSend + }); + } + }); + + } + + // ---------------------------------------------------------------------- + + data.methods.forEach(addMethod); + + data.properties.forEach(bindGetterSetter); + + data.signals.forEach(function(signal) { addSignal(signal, false); }); + + Object.assign(object, data.enums); +} + +//required for use with nodejs +if (typeof module === 'object') { + module.exports = { + QWebChannel: QWebChannel + }; +} diff --git a/ui/generate-rcc.go b/ui/generate-rcc.go index daf7f22d74..553334ac90 100644 --- a/ui/generate-rcc.go +++ b/ui/generate-rcc.go @@ -26,6 +26,7 @@ var qrcExtensions = map[string]bool{ ".gif": true, ".json": true, ".mdwn": true, + ".html": true, } func main() {