@walletconnect/universal-provider
Version:
Universal Provider for WalletConnect Protocol
14 lines (12 loc) • 463 kB
JavaScript
(function(fr,Be){typeof exports=="object"&&typeof module<"u"?Be(exports):typeof define=="function"&&define.amd?define(["exports"],Be):(fr=typeof globalThis<"u"?globalThis:fr||self,Be(fr["@walletconnect/universal-provider"]={}))})(this,function(fr){"use strict";var Be=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ma(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function za(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var r=function s(){var n=!1;try{n=this instanceof s}catch{}return n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(s){var n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(r,s,n.get?n:{enumerable:!0,get:function(){return t[s]}})}),r}var Ws={exports:{}},ja;function Xd(){if(ja)return Ws.exports;ja=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(x,D,B){return Function.prototype.apply.call(x,D,B)},r;t&&typeof t.ownKeys=="function"?r=t.ownKeys:Object.getOwnPropertySymbols?r=function(x){return Object.getOwnPropertyNames(x).concat(Object.getOwnPropertySymbols(x))}:r=function(x){return Object.getOwnPropertyNames(x)};function s(v){console&&console.warn&&console.warn(v)}var n=Number.isNaN||function(x){return x!==x};function i(){i.init.call(this)}Ws.exports=i,Ws.exports.once=E,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var o=10;function a(v){if(typeof v!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof v)}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(v){if(typeof v!="number"||v<0||n(v))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+v+".");o=v}}),i.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},i.prototype.setMaxListeners=function(x){if(typeof x!="number"||x<0||n(x))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+x+".");return this._maxListeners=x,this};function c(v){return v._maxListeners===void 0?i.defaultMaxListeners:v._maxListeners}i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(x){for(var D=[],B=1;B<arguments.length;B++)D.push(arguments[B]);var T=x==="error",$=this._events;if($!==void 0)T=T&&$.error===void 0;else if(!T)return!1;if(T){var U;if(D.length>0&&(U=D[0]),U instanceof Error)throw U;var L=new Error("Unhandled error."+(U?" ("+U.message+")":""));throw L.context=U,L}var C=$[x];if(C===void 0)return!1;if(typeof C=="function")e(C,this,D);else for(var A=C.length,R=p(C,A),B=0;B<A;++B)e(R[B],this,D);return!0};function u(v,x,D,B){var T,$,U;if(a(D),$=v._events,$===void 0?($=v._events=Object.create(null),v._eventsCount=0):($.newListener!==void 0&&(v.emit("newListener",x,D.listener?D.listener:D),$=v._events),U=$[x]),U===void 0)U=$[x]=D,++v._eventsCount;else if(typeof U=="function"?U=$[x]=B?[D,U]:[U,D]:B?U.unshift(D):U.push(D),T=c(v),T>0&&U.length>T&&!U.warned){U.warned=!0;var L=new Error("Possible EventEmitter memory leak detected. "+U.length+" "+String(x)+" listeners added. Use emitter.setMaxListeners() to increase limit");L.name="MaxListenersExceededWarning",L.emitter=v,L.type=x,L.count=U.length,s(L)}return v}i.prototype.addListener=function(x,D){return u(this,x,D,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(x,D){return u(this,x,D,!0)};function l(){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 h(v,x,D){var B={fired:!1,wrapFn:void 0,target:v,type:x,listener:D},T=l.bind(B);return T.listener=D,B.wrapFn=T,T}i.prototype.once=function(x,D){return a(D),this.on(x,h(this,x,D)),this},i.prototype.prependOnceListener=function(x,D){return a(D),this.prependListener(x,h(this,x,D)),this},i.prototype.removeListener=function(x,D){var B,T,$,U,L;if(a(D),T=this._events,T===void 0)return this;if(B=T[x],B===void 0)return this;if(B===D||B.listener===D)--this._eventsCount===0?this._events=Object.create(null):(delete T[x],T.removeListener&&this.emit("removeListener",x,B.listener||D));else if(typeof B!="function"){for($=-1,U=B.length-1;U>=0;U--)if(B[U]===D||B[U].listener===D){L=B[U].listener,$=U;break}if($<0)return this;$===0?B.shift():y(B,$),B.length===1&&(T[x]=B[0]),T.removeListener!==void 0&&this.emit("removeListener",x,L||D)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(x){var D,B,T;if(B=this._events,B===void 0)return this;if(B.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):B[x]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete B[x]),this;if(arguments.length===0){var $=Object.keys(B),U;for(T=0;T<$.length;++T)U=$[T],U!=="removeListener"&&this.removeAllListeners(U);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(D=B[x],typeof D=="function")this.removeListener(x,D);else if(D!==void 0)for(T=D.length-1;T>=0;T--)this.removeListener(x,D[T]);return this};function f(v,x,D){var B=v._events;if(B===void 0)return[];var T=B[x];return T===void 0?[]:typeof T=="function"?D?[T.listener||T]:[T]:D?m(T):p(T,T.length)}i.prototype.listeners=function(x){return f(this,x,!0)},i.prototype.rawListeners=function(x){return f(this,x,!1)},i.listenerCount=function(v,x){return typeof v.listenerCount=="function"?v.listenerCount(x):g.call(v,x)},i.prototype.listenerCount=g;function g(v){var x=this._events;if(x!==void 0){var D=x[v];if(typeof D=="function")return 1;if(D!==void 0)return D.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function p(v,x){for(var D=new Array(x),B=0;B<x;++B)D[B]=v[B];return D}function y(v,x){for(;x+1<v.length;x++)v[x]=v[x+1];v.pop()}function m(v){for(var x=new Array(v.length),D=0;D<x.length;++D)x[D]=v[D].listener||v[D];return x}function E(v,x){return new Promise(function(D,B){function T(U){v.removeListener(x,$),B(U)}function $(){typeof v.removeListener=="function"&&v.removeListener("error",T),D([].slice.call(arguments))}b(v,x,$,{once:!0}),x!=="error"&&P(v,T,{once:!0})})}function P(v,x,D){typeof v.on=="function"&&b(v,"error",x,D)}function b(v,x,D,B){if(typeof v.on=="function")B.once?v.once(x,D):v.on(x,D);else if(typeof v.addEventListener=="function")v.addEventListener(x,function T($){B.once&&v.removeEventListener(x,T),D($)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof v)}return Ws.exports}var He=Xd(),ui=Ma(He),li={};/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var hi=function(t,e){return hi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var n in s)s.hasOwnProperty(n)&&(r[n]=s[n])},hi(t,e)};function Jd(t,e){hi(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var fi=function(){return fi=Object.assign||function(e){for(var r,s=1,n=arguments.length;s<n;s++){r=arguments[s];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},fi.apply(this,arguments)};function Qd(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(r[s[n]]=t[s[n]]);return r}function ep(t,e,r,s){var n=arguments.length,i=n<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,r):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(n<3?o(i):n>3?o(e,r,i):o(e,r))||i);return n>3&&i&&Object.defineProperty(e,r,i),i}function tp(t,e){return function(r,s){e(r,s,t)}}function rp(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function sp(t,e,r,s){function n(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(l){try{u(s.next(l))}catch(h){o(h)}}function c(l){try{u(s.throw(l))}catch(h){o(h)}}function u(l){l.done?i(l.value):n(l.value).then(a,c)}u((s=s.apply(t,e||[])).next())})}function np(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},s,n,i,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(l){return c([u,l])}}function c(u){if(s)throw new TypeError("Generator is already executing.");for(;r;)try{if(s=1,n&&(i=u[0]&2?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,n=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(l){u=[6,l],n=0}finally{s=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function ip(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}function op(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function di(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],s=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ha(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var s=r.call(t),n,i=[],o;try{for(;(e===void 0||e-- >0)&&!(n=s.next()).done;)i.push(n.value)}catch(a){o={error:a}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i}function ap(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Ha(arguments[e]));return t}function cp(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var s=Array(t),n=0,e=0;e<r;e++)for(var i=arguments[e],o=0,a=i.length;o<a;o++,n++)s[n]=i[o];return s}function ss(t){return this instanceof ss?(this.v=t,this):new ss(t)}function up(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=r.apply(t,e||[]),n,i=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(f){s[f]&&(n[f]=function(g){return new Promise(function(p,y){i.push([f,g,p,y])>1||a(f,g)})})}function a(f,g){try{c(s[f](g))}catch(p){h(i[0][3],p)}}function c(f){f.value instanceof ss?Promise.resolve(f.value.v).then(u,l):h(i[0][2],f)}function u(f){a("next",f)}function l(f){a("throw",f)}function h(f,g){f(g),i.shift(),i.length&&a(i[0][0],i[0][1])}}function lp(t){var e,r;return e={},s("next"),s("throw",function(n){throw n}),s("return"),e[Symbol.iterator]=function(){return this},e;function s(n,i){e[n]=t[n]?function(o){return(r=!r)?{value:ss(t[n](o)),done:n==="return"}:i?i(o):o}:i}}function hp(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof di=="function"?di(t):t[Symbol.iterator](),r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r);function s(i){r[i]=t[i]&&function(o){return new Promise(function(a,c){o=t[i](o),n(a,c,o.done,o.value)})}}function n(i,o,a,c){Promise.resolve(c).then(function(u){i({value:u,done:a})},o)}}function fp(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function dp(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function pp(t){return t&&t.__esModule?t:{default:t}}function gp(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function yp(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var wp=Object.freeze({__proto__:null,get __assign(){return fi},__asyncDelegator:lp,__asyncGenerator:up,__asyncValues:hp,__await:ss,__awaiter:sp,__classPrivateFieldGet:gp,__classPrivateFieldSet:yp,__createBinding:ip,__decorate:ep,__exportStar:op,__extends:Jd,__generator:np,__importDefault:pp,__importStar:dp,__makeTemplateObject:fp,__metadata:rp,__param:tp,__read:Ha,__rest:Qd,__spread:ap,__spreadArrays:cp,__values:di}),Gs=za(wp),pi={},ns={},Ka;function mp(){if(Ka)return ns;Ka=1,Object.defineProperty(ns,"__esModule",{value:!0}),ns.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return ns.delay=t,ns}var dr={},gi={},pr={},Va;function bp(){return Va||(Va=1,Object.defineProperty(pr,"__esModule",{value:!0}),pr.ONE_THOUSAND=pr.ONE_HUNDRED=void 0,pr.ONE_HUNDRED=100,pr.ONE_THOUSAND=1e3),pr}var yi={},Wa;function vp(){return Wa||(Wa=1,function(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=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(yi)),yi}var Ga;function Ya(){return Ga||(Ga=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Gs;e.__exportStar(bp(),t),e.__exportStar(vp(),t)}(gi)),gi}var Za;function Ep(){if(Za)return dr;Za=1,Object.defineProperty(dr,"__esModule",{value:!0}),dr.fromMiliseconds=dr.toMiliseconds=void 0;const t=Ya();function e(s){return s*t.ONE_THOUSAND}dr.toMiliseconds=e;function r(s){return Math.floor(s/t.ONE_THOUSAND)}return dr.fromMiliseconds=r,dr}var Xa;function xp(){return Xa||(Xa=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Gs;e.__exportStar(mp(),t),e.__exportStar(Ep(),t)}(pi)),pi}var Ur={},Ja;function _p(){if(Ja)return Ur;Ja=1,Object.defineProperty(Ur,"__esModule",{value:!0}),Ur.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const s=this.get(r);if(typeof s.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const n=Date.now()-s.started;this.timestamps.set(r,{started:s.started,elapsed:n})}get(r){const s=this.timestamps.get(r);if(typeof s>"u")throw new Error(`No timestamp found for label: ${r}`);return s}elapsed(r){const s=this.get(r);return s.elapsed||Date.now()-s.started}}return Ur.Watch=t,Ur.default=t,Ur}var wi={},is={},Qa;function Sp(){if(Qa)return is;Qa=1,Object.defineProperty(is,"__esModule",{value:!0}),is.IWatch=void 0;class t{}return is.IWatch=t,is}var ec;function Ip(){return ec||(ec=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Gs.__exportStar(Sp(),t)}(wi)),wi}var tc;function Dp(){return tc||(tc=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Gs;e.__exportStar(xp(),t),e.__exportStar(_p(),t),e.__exportStar(Ip(),t),e.__exportStar(Ya(),t)}(li)),li}var M=Dp();class gr{}let Ap=class extends gr{constructor(e){super()}};const rc=M.FIVE_SECONDS,yr={pulse:"heartbeat_pulse"};class mi extends Ap{constructor(e){super(e),this.events=new He.EventEmitter,this.interval=rc,this.interval=e?.interval||rc}static async init(e){const r=new mi(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),M.toMiliseconds(this.interval))}pulse(){this.events.emit(yr.pulse)}}const Op=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,Pp=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,Bp=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function $p(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){Tp(t);return}return e}function Tp(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Ys(t,e={}){if(typeof t!="string")return t;if(t[0]==='"'&&t[t.length-1]==='"'&&t.indexOf("\\")===-1)return t.slice(1,-1);const r=t.trim();if(r.length<=9)switch(r.toLowerCase()){case"true":return!0;case"false":return!1;case"undefined":return;case"null":return null;case"nan":return Number.NaN;case"infinity":return Number.POSITIVE_INFINITY;case"-infinity":return Number.NEGATIVE_INFINITY}if(!Bp.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(Op.test(t)||Pp.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,$p)}return JSON.parse(t)}catch(s){if(e.strict)throw s;return t}}function Rp(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function he(t,...e){try{return Rp(t(...e))}catch(r){return Promise.reject(r)}}function Cp(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function Np(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Zs(t){if(Cp(t))return String(t);if(Np(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Zs(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const bi="base64:";function Up(t){return typeof t=="string"?t:bi+qp(t)}function Lp(t){return typeof t!="string"||!t.startsWith(bi)?t:kp(t.slice(bi.length))}function kp(t){return globalThis.Buffer?Buffer.from(t,"base64"):Uint8Array.from(globalThis.atob(t),e=>e.codePointAt(0))}function qp(t){return globalThis.Buffer?Buffer.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))}function $e(t){return t&&t.split("?")[0]?.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,"")||""}function Fp(...t){return $e(t.join(":"))}function Xs(t){return t=$e(t),t?t+":":""}function Mp(t,e){if(e===void 0)return!0;let r=0,s=t.indexOf(":");for(;s>-1;)r++,s=t.indexOf(":",s+1);return r<=e}function zp(t,e){return e?t.startsWith(e)&&t[t.length-1]!=="$":t[t.length-1]!=="$"}function gI(t){return t}const jp="memory",Hp=()=>{const t=new Map;return{name:jp,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function Kp(t={}){const e={mounts:{"":t.driver||Hp()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=u=>{for(const l of e.mountpoints)if(u.startsWith(l))return{base:l,relativeKey:u.slice(l.length),driver:e.mounts[l]};return{base:"",relativeKey:u,driver:e.mounts[""]}},s=(u,l)=>e.mountpoints.filter(h=>h.startsWith(u)||l&&u.startsWith(h)).map(h=>({relativeBase:u.length>h.length?u.slice(h.length):void 0,mountpoint:h,driver:e.mounts[h]})),n=(u,l)=>{if(e.watching){l=$e(l);for(const h of e.watchListeners)h(u,l)}},i=async()=>{if(!e.watching){e.watching=!0;for(const u in e.mounts)e.unwatch[u]=await sc(e.mounts[u],n,u)}},o=async()=>{if(e.watching){for(const u in e.unwatch)await e.unwatch[u]();e.unwatch={},e.watching=!1}},a=(u,l,h)=>{const f=new Map,g=p=>{let y=f.get(p.base);return y||(y={driver:p.driver,base:p.base,items:[]},f.set(p.base,y)),y};for(const p of u){const y=typeof p=="string",m=$e(y?p:p.key),E=y?void 0:p.value,P=y||!p.options?l:{...l,...p.options},b=r(m);g(b).items.push({key:m,value:E,relativeKey:b.relativeKey,options:P})}return Promise.all([...f.values()].map(p=>h(p))).then(p=>p.flat())},c={hasItem(u,l={}){u=$e(u);const{relativeKey:h,driver:f}=r(u);return he(f.hasItem,h,l)},getItem(u,l={}){u=$e(u);const{relativeKey:h,driver:f}=r(u);return he(f.getItem,h,l).then(g=>Ys(g))},getItems(u,l={}){return a(u,l,h=>h.driver.getItems?he(h.driver.getItems,h.items.map(f=>({key:f.relativeKey,options:f.options})),l).then(f=>f.map(g=>({key:Fp(h.base,g.key),value:Ys(g.value)}))):Promise.all(h.items.map(f=>he(h.driver.getItem,f.relativeKey,f.options).then(g=>({key:f.key,value:Ys(g)})))))},getItemRaw(u,l={}){u=$e(u);const{relativeKey:h,driver:f}=r(u);return f.getItemRaw?he(f.getItemRaw,h,l):he(f.getItem,h,l).then(g=>Lp(g))},async setItem(u,l,h={}){if(l===void 0)return c.removeItem(u);u=$e(u);const{relativeKey:f,driver:g}=r(u);g.setItem&&(await he(g.setItem,f,Zs(l),h),g.watch||n("update",u))},async setItems(u,l){await a(u,l,async h=>{if(h.driver.setItems)return he(h.driver.setItems,h.items.map(f=>({key:f.relativeKey,value:Zs(f.value),options:f.options})),l);h.driver.setItem&&await Promise.all(h.items.map(f=>he(h.driver.setItem,f.relativeKey,Zs(f.value),f.options)))})},async setItemRaw(u,l,h={}){if(l===void 0)return c.removeItem(u,h);u=$e(u);const{relativeKey:f,driver:g}=r(u);if(g.setItemRaw)await he(g.setItemRaw,f,l,h);else if(g.setItem)await he(g.setItem,f,Up(l),h);else return;g.watch||n("update",u)},async removeItem(u,l={}){typeof l=="boolean"&&(l={removeMeta:l}),u=$e(u);const{relativeKey:h,driver:f}=r(u);f.removeItem&&(await he(f.removeItem,h,l),(l.removeMeta||l.removeMata)&&await he(f.removeItem,h+"$",l),f.watch||n("remove",u))},async getMeta(u,l={}){typeof l=="boolean"&&(l={nativeOnly:l}),u=$e(u);const{relativeKey:h,driver:f}=r(u),g=Object.create(null);if(f.getMeta&&Object.assign(g,await he(f.getMeta,h,l)),!l.nativeOnly){const p=await he(f.getItem,h+"$",l).then(y=>Ys(y));p&&typeof p=="object"&&(typeof p.atime=="string"&&(p.atime=new Date(p.atime)),typeof p.mtime=="string"&&(p.mtime=new Date(p.mtime)),Object.assign(g,p))}return g},setMeta(u,l,h={}){return this.setItem(u+"$",l,h)},removeMeta(u,l={}){return this.removeItem(u+"$",l)},async getKeys(u,l={}){u=Xs(u);const h=s(u,!0);let f=[];const g=[];let p=!0;for(const m of h){m.driver.flags?.maxDepth||(p=!1);const E=await he(m.driver.getKeys,m.relativeBase,l);for(const P of E){const b=m.mountpoint+$e(P);f.some(v=>b.startsWith(v))||g.push(b)}f=[m.mountpoint,...f.filter(P=>!P.startsWith(m.mountpoint))]}const y=l.maxDepth!==void 0&&!p;return g.filter(m=>(!y||Mp(m,l.maxDepth))&&zp(m,u))},async clear(u,l={}){u=Xs(u),await Promise.all(s(u,!1).map(async h=>{if(h.driver.clear)return he(h.driver.clear,h.relativeBase,l);if(h.driver.removeItem){const f=await h.driver.getKeys(h.relativeBase||"",l);return Promise.all(f.map(g=>h.driver.removeItem(g,l)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(u=>nc(u)))},async watch(u){return await i(),e.watchListeners.push(u),async()=>{e.watchListeners=e.watchListeners.filter(l=>l!==u),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(u,l){if(u=Xs(u),u&&e.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(e.mountpoints.push(u),e.mountpoints.sort((h,f)=>f.length-h.length)),e.mounts[u]=l,e.watching&&Promise.resolve(sc(l,n,u)).then(h=>{e.unwatch[u]=h}).catch(console.error),c},async unmount(u,l=!0){u=Xs(u),!(!u||!e.mounts[u])&&(e.watching&&u in e.unwatch&&(e.unwatch[u]?.(),delete e.unwatch[u]),l&&await nc(e.mounts[u]),e.mountpoints=e.mountpoints.filter(h=>h!==u),delete e.mounts[u])},getMount(u=""){u=$e(u)+":";const l=r(u);return{driver:l.driver,base:l.base}},getMounts(u="",l={}){return u=$e(u),s(u,l.parents).map(f=>({driver:f.driver,base:f.mountpoint}))},keys:(u,l={})=>c.getKeys(u,l),get:(u,l={})=>c.getItem(u,l),set:(u,l,h={})=>c.setItem(u,l,h),has:(u,l={})=>c.hasItem(u,l),del:(u,l={})=>c.removeItem(u,l),remove:(u,l={})=>c.removeItem(u,l)};return c}function sc(t,e,r){return t.watch?t.watch((s,n)=>e(s,r+n)):()=>{}}async function nc(t){typeof t.dispose=="function"&&await he(t.dispose)}function wr(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function ic(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const s=wr(r);return(n,i)=>s.then(o=>i(o.transaction(e,n).objectStore(e)))}let vi;function os(){return vi||(vi=ic("keyval-store","keyval")),vi}function oc(t,e=os()){return e("readonly",r=>wr(r.get(t)))}function Vp(t,e,r=os()){return r("readwrite",s=>(s.put(e,t),wr(s.transaction)))}function Wp(t,e=os()){return e("readwrite",r=>(r.delete(t),wr(r.transaction)))}function Gp(t=os()){return t("readwrite",e=>(e.clear(),wr(e.transaction)))}function Yp(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},wr(t.transaction)}function Zp(t=os()){return t("readonly",e=>{if(e.getAllKeys)return wr(e.getAllKeys());const r=[];return Yp(e,s=>r.push(s.key)).then(()=>r)})}const Xp=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),Jp=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(s,n)=>typeof n=="string"&&n.match(/^\d+n$/)?BigInt(n.substring(0,n.length-1)):n)};function mr(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return Jp(t)}catch{return t}}function br(t){return typeof t=="string"?t:Xp(t)||""}const Qp="idb-keyval";var eg=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=n=>e+n;let s;return t.dbName&&t.storeName&&(s=ic(t.dbName,t.storeName)),{name:Qp,options:t,async hasItem(n){return!(typeof await oc(r(n),s)>"u")},async getItem(n){return await oc(r(n),s)??null},setItem(n,i){return Vp(r(n),i,s)},removeItem(n){return Wp(r(n),s)},getKeys(){return Zp(s)},clear(){return Gp(s)}}};const tg="WALLET_CONNECT_V2_INDEXED_DB",rg="keyvaluestorage";let sg=class{constructor(){this.indexedDb=Kp({driver:eg({dbName:tg,storeName:rg})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,br(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var Ei=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Js={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,s){this[r]=String(s)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(s){r[s]=void 0,delete r[s]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Ei<"u"&&Ei.localStorage?Js.exports=Ei.localStorage:typeof window<"u"&&window.localStorage?Js.exports=window.localStorage:Js.exports=new e})();function ng(t){var e;return[t[0],mr((e=t[1])!=null?e:"")]}let ig=class{constructor(){this.localStorage=Js.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(ng)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return mr(r)}async setItem(e,r){this.localStorage.setItem(e,br(r))}async removeItem(e){this.localStorage.removeItem(e)}};const og="wc_storage_version",ac=1,ag=async(t,e,r)=>{const s=og,n=await e.getItem(s);if(n&&n>=ac){r(e);return}const i=await t.getKeys();if(!i.length){r(e);return}const o=[];for(;i.length;){const a=i.shift();if(!a)continue;const c=a.toLowerCase();if(c.includes("wc@")||c.includes("walletconnect")||c.includes("wc_")||c.includes("wallet_connect")){const u=await t.getItem(a);await e.setItem(a,u),o.push(a)}}await e.setItem(s,ac),r(e),cg(t,o)},cg=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let ug=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new ig;this.storage=e;try{const r=new sg;ag(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};var lt={exports:{}};function lg(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var hg=fg;function fg(t,e,r){var s=r&&r.stringify||lg,n=1;if(typeof t=="object"&&t!==null){var i=e.length+n;if(i===1)return t;var o=new Array(i);o[0]=s(t);for(var a=1;a<i;a++)o[a]=s(e[a]);return o.join(" ")}if(typeof t!="string")return t;var c=e.length;if(c===0)return t;for(var u="",l=1-n,h=-1,f=t&&t.length||0,g=0;g<f;){if(t.charCodeAt(g)===37&&g+1<f){switch(h=h>-1?h:0,t.charCodeAt(g+1)){case 100:case 102:if(l>=c||e[l]==null)break;h<g&&(u+=t.slice(h,g)),u+=Number(e[l]),h=g+2,g++;break;case 105:if(l>=c||e[l]==null)break;h<g&&(u+=t.slice(h,g)),u+=Math.floor(Number(e[l])),h=g+2,g++;break;case 79:case 111:case 106:if(l>=c||e[l]===void 0)break;h<g&&(u+=t.slice(h,g));var p=typeof e[l];if(p==="string"){u+="'"+e[l]+"'",h=g+2,g++;break}if(p==="function"){u+=e[l].name||"<anonymous>",h=g+2,g++;break}u+=s(e[l]),h=g+2,g++;break;case 115:if(l>=c)break;h<g&&(u+=t.slice(h,g)),u+=String(e[l]),h=g+2,g++;break;case 37:h<g&&(u+=t.slice(h,g)),u+="%",h=g+2,g++,l--;break}++l}++g}return h===-1?t:(h<f&&(u+=t.slice(h)),u)}const cc=hg;lt.exports=xt;const as=Ag().console||{},dg={mapHttpRequest:Qs,mapHttpResponse:Qs,wrapRequestSerializer:Di,wrapResponseSerializer:Di,wrapErrorSerializer:Di,req:Qs,res:Qs,err:lc,errWithCause:lc};function zt(t,e){return t==="silent"?1/0:e.levels.values[t]}const xi=Symbol("pino.logFuncs"),_i=Symbol("pino.hierarchy"),pg={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function uc(t,e){const r={logger:e,parent:t[_i]};e[_i]=r}function gg(t,e,r){const s={};e.forEach(n=>{s[n]=r[n]?r[n]:as[n]||as[pg[n]||"log"]||Lr}),t[xi]=s}function yg(t,e){return Array.isArray(t)?t.filter(function(r){return r!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function xt(t){t=t||{},t.browser=t.browser||{};const e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");const r=t.browser.write||as;t.browser.write&&(t.browser.asObject=!0);const s=t.serializers||{},n=yg(t.browser.serialize,s);let i=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(i=!1);const o=Object.keys(t.customLevels||{}),a=["error","fatal","warn","info","debug","trace"].concat(o);typeof r=="function"&&a.forEach(function(y){r[y]=r}),(t.enabled===!1||t.browser.disabled)&&(t.level="silent");const c=t.level||"info",u=Object.create(r);u.log||(u.log=Lr),gg(u,a,r),uc({},u),Object.defineProperty(u,"levelVal",{get:h}),Object.defineProperty(u,"level",{get:f,set:g});const l={transmit:e,serialize:n,asObject:t.browser.asObject,asObjectBindingsOnly:t.browser.asObjectBindingsOnly,formatters:t.browser.formatters,levels:a,timestamp:Sg(t),messageKey:t.messageKey||"msg",onChild:t.onChild||Lr};u.levels=wg(t),u.level=c,u.isLevelEnabled=function(y){return this.levels.values[y]?this.levels.values[y]>=this.levels.values[this.level]:!1},u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Lr,u.serializers=s,u._serialize=n,u._stdErrSerialize=i,u.child=function(...y){return p.call(this,l,...y)},e&&(u._logEvent=Ii());function h(){return zt(this.level,this)}function f(){return this._level}function g(y){if(y!=="silent"&&!this.levels.values[y])throw Error("unknown level "+y);this._level=y,vr(this,l,u,"error"),vr(this,l,u,"fatal"),vr(this,l,u,"warn"),vr(this,l,u,"info"),vr(this,l,u,"debug"),vr(this,l,u,"trace"),o.forEach(m=>{vr(this,l,u,m)})}function p(y,m,E){if(!m)throw new Error("missing bindings for child Pino");E=E||{},n&&m.serializers&&(E.serializers=m.serializers);const P=E.serializers;if(n&&P){var b=Object.assign({},s,P),v=t.browser.serialize===!0?Object.keys(b):n;delete m.serializers,Si([m],v,b,this._stdErrSerialize)}function x(B){this._childLevel=(B._childLevel|0)+1,this.bindings=m,b&&(this.serializers=b,this._serialize=v),e&&(this._logEvent=Ii([].concat(B._logEvent.bindings,m)))}x.prototype=this;const D=new x(this);return uc(this,D),D.child=function(...B){return p.call(this,y,...B)},D.level=E.level||this.level,y.onChild(D),D}return u}function wg(t){const e=t.customLevels||{},r=Object.assign({},xt.levels.values,e),s=Object.assign({},xt.levels.labels,mg(e));return{values:r,labels:s}}function mg(t){const e={};return Object.keys(t).forEach(function(r){e[t[r]]=r}),e}xt.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},xt.stdSerializers=dg,xt.stdTimeFunctions=Object.assign({},{nullTime:hc,epochTime:fc,unixTime:Ig,isoTime:Dg});function bg(t){const e=[];t.bindings&&e.push(t.bindings);let r=t[_i];for(;r.parent;)r=r.parent,r.logger.bindings&&e.push(r.logger.bindings);return e.reverse()}function vr(t,e,r,s){if(Object.defineProperty(t,s,{value:zt(t.level,r)>zt(s,r)?Lr:r[xi][s],writable:!0,enumerable:!0,configurable:!0}),t[s]===Lr){if(!e.transmit)return;const i=e.transmit.level||t.level,o=zt(i,r);if(zt(s,r)<o)return}t[s]=Eg(t,e,r,s);const n=bg(t);n.length!==0&&(t[s]=vg(n,t[s]))}function vg(t,e){return function(){return e.apply(this,[...t,...arguments])}}function Eg(t,e,r,s){return function(n){return function(){const i=e.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===as?as:this;for(var c=0;c<o.length;c++)o[c]=arguments[c];var u=!1;if(e.serialize&&(Si(o,this._serialize,this.serializers,this._stdErrSerialize),u=!0),e.asObject||e.formatters?n.call(a,...xg(this,s,o,i,e)):n.apply(a,o),e.transmit){const l=e.transmit.level||t._level,h=zt(l,r),f=zt(s,r);if(f<h)return;_g(this,{ts:i,methodLevel:s,methodValue:f,transmitValue:r.levels.values[e.transmit.level||t._level],send:e.transmit.send,val:zt(t._level,r)},o,u)}}}(t[xi][s])}function xg(t,e,r,s,n){const{level:i,log:o=h=>h}=n.formatters||{},a=r.slice();let c=a[0];const u={};let l=(t._childLevel|0)+1;if(l<1&&(l=1),s&&(u.time=s),i){const h=i(e,t.levels.values[e]);Object.assign(u,h)}else u.level=t.levels.values[e];if(n.asObjectBindingsOnly){if(c!==null&&typeof c=="object")for(;l--&&typeof a[0]=="object";)Object.assign(u,a.shift());return[o(u),...a]}else{if(c!==null&&typeof c=="object"){for(;l--&&typeof a[0]=="object";)Object.assign(u,a.shift());c=a.length?cc(a.shift(),a):void 0}else typeof c=="string"&&(c=cc(a.shift(),a));return c!==void 0&&(u[n.messageKey]=c),[o(u)]}}function Si(t,e,r,s){for(const n in t)if(s&&t[n]instanceof Error)t[n]=xt.stdSerializers.err(t[n]);else if(typeof t[n]=="object"&&!Array.isArray(t[n])&&e)for(const i in t[n])e.indexOf(i)>-1&&i in r&&(t[n][i]=r[i](t[n][i]))}function _g(t,e,r,s=!1){const n=e.send,i=e.ts,o=e.methodLevel,a=e.methodValue,c=e.val,u=t._logEvent.bindings;s||Si(r,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=i,t._logEvent.messages=r.filter(function(l){return u.indexOf(l)===-1}),t._logEvent.level.label=o,t._logEvent.level.value=a,n(o,t._logEvent,c),t._logEvent=Ii(u)}function Ii(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function lc(t){const e={type:t.constructor.name,msg:t.message,stack:t.stack};for(const r in t)e[r]===void 0&&(e[r]=t[r]);return e}function Sg(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?hc:fc}function Qs(){return{}}function Di(t){return t}function Lr(){}function hc(){return!1}function fc(){return Date.now()}function Ig(){return Math.round(Date.now()/1e3)}function Dg(){return new Date(Date.now()).toISOString()}function Ag(){function t(e){return typeof e<"u"&&e}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return t(self)||t(window)||t(this)||{}}}lt.exports.default=xt,lt.exports.pino=xt;const Og={level:"info"},en="custom_context",Ai=1e3*1024;var Pg=Object.defineProperty,Bg=(t,e,r)=>e in t?Pg(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jt=(t,e,r)=>Bg(t,typeof e!="symbol"?e+"":e,r);let $g=class{constructor(e){jt(this,"nodeValue"),jt(this,"sizeInBytes"),jt(this,"next"),this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},dc=class{constructor(e){jt(this,"lengthInNodes"),jt(this,"sizeInBytes"),jt(this,"head"),jt(this,"tail"),jt(this,"maxSizeInBytes"),this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const r=new $g(e);if(r.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}};const Tg=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r);function pc(t){return typeof t=="string"?t:Tg(t)||""}var Rg=Object.defineProperty,Cg=(t,e,r)=>e in t?Rg(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e,r)=>Cg(t,typeof e!="symbol"?e+"":e,r);let gc=class{constructor(e,r=Ai){tn(this,"logs"),tn(this,"level"),tn(this,"levelValue"),tn(this,"MAX_LOG_SIZE_IN_BYTES"),this.level=e??"error",this.levelValue=lt.exports.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new dc(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===lt.exports.levels.values.error?console.error(e):r===lt.exports.levels.values.warn?console.warn(e):r===lt.exports.levels.values.debug?console.debug(e):r===lt.exports.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(pc({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new dc(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(pc({extraMetadata:e})),new Blob(r,{type:"application/json"})}};var Ng=Object.defineProperty,Ug=(t,e,r)=>e in t?Ng(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Lg=(t,e,r)=>Ug(t,e+"",r);let kg=class{constructor(e,r=Ai){Lg(this,"baseChunkLogger"),this.baseChunkLogger=new gc(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),s=document.createElement("a");s.href=r,s.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r)}};var qg=Object.defineProperty,Fg=(t,e,r)=>e in t?qg(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Mg=(t,e,r)=>Fg(t,e+"",r);let zg=class{constructor(e,r=Ai){Mg(this,"baseChunkLogger"),this.baseChunkLogger=new gc(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var jg=Object.defineProperty,Hg=Object.defineProperties,Kg=Object.getOwnPropertyDescriptors,yc=Object.getOwnPropertySymbols,Vg=Object.prototype.hasOwnProperty,Wg=Object.prototype.propertyIsEnumerable,wc=(t,e,r)=>e in t?jg(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ht=(t,e)=>{for(var r in e||(e={}))Vg.call(e,r)&&wc(t,r,e[r]);if(yc)for(var r of yc(e))Wg.call(e,r)&&wc(t,r,e[r]);return t},Kt=(t,e)=>Hg(t,Kg(e));function Gg(t){return Kt(Ht({},t),{level:t?.level||Og.level})}function Yg(t,e,r=en){return t[r]=e,t}function Te(t,e=en){return t[e]||""}function Zg(t,e,r=en){const s=Te(t,r);return s.trim()?`${s}/${e}`:e}function qe(t,e,r=en){const s=Zg(t,e,r),n=t.child({context:s});return Yg(n,s,r)}function Xg(t){var e,r;const s=new kg((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:lt.exports(Kt(Ht({},t.opts),{level:"trace",browser:Kt(Ht({},(r=t.opts)==null?void 0:r.browser),{write:n=>s.write(n)})})),chunkLoggerController:s}}function Jg(t){var e,r;const s=new zg((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:lt.exports(Kt(Ht({},t.opts),{level:"trace",browser:Kt(Ht({},(r=t.opts)==null?void 0:r.browser),{write:n=>s.write(n)})}),s),chunkLoggerController:s}}function mc(t){var e;if(typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string")return{logger:t.loggerOverride,chunkLoggerController:null};const r=Kt(Ht({},t.opts),{level:typeof t.loggerOverride=="string"?t.loggerOverride:(e=t.opts)==null?void 0:e.level});return typeof window<"u"?Xg(Kt(Ht({},t),{opts:r})):Jg(Kt(Ht({},t),{opts:r}))}class Qg extends gr{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}let ey=class extends gr{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},ty=class{constructor(e,r){this.logger=e,this.core=r}},ry=class extends gr{constructor(e,r){super(),this.relayer=e,this.logger=r}};class sy extends gr{constructor(e){super()}}let ny=class{constructor(e,r,s,n){this.core=e,this.logger=r,this.name=s}},iy=class extends gr{constructor(e,r){super(),this.relayer=e,this.logger=r}},oy=class extends gr{constructor(e,r){super(),this.core=e,this.logger=r}},ay=class{constructor(e,r,s){this.core=e,this.logger=r,this.store=s}},cy=class{constructor(e,r){this.projectId=e,this.logger=r}},uy=class{constructor(e,r,s){this.core=e,this.logger=r,this.telemetryEnabled=s}},ly=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},hy=class{constructor(e){this.client=e}};function fy(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function bc(t,...e){if(!fy(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function vc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function dy(t,e){bc(t);const r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}const kr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Oi=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);function py(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function Ec(t){return typeof t=="string"&&(t=py(t)),bc(t),t}let gy=class{clone(){return this._cloneInto()}};function yy(t){const e=s=>t().update(Ec(s)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function xc(t=32){if(kr&&typeof kr.getRandomValues=="function")return kr.getRandomValues(new Uint8Array(t));if(kr&&typeof kr.randomBytes=="function")return kr.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}function wy(t,e,r,s){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,s);const n=BigInt(32),i=BigInt(4294967295),o=Number(r>>n&i),a=Number(r&i),c=s?4:0,u=s?0:4;t.setUint32(e+c,o,s),t.setUint32(e+u,a,s)}let my=class extends gy{constructor(e,r,s,n){super(),this.blockLen=e,this.outputLen=r,this.padOffset=s,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Oi(this.buffer)}update(e){vc(this);const{view:r,buffer:s,blockLen:n}=this;e=Ec(e);const i=e.length;for(let o=0;o<i;){const a=Math.min(n-this.pos,i-o);if(a===n){const c=Oi(e);for(;n<=i-o;o+=n)this.process(c,o);continue}s.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===n&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){vc(this),dy(e,this),this.finished=!0;const{buffer:r,view:s,blockLen:n,isLE:i}=this;let{pos:o}=this;r[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(s,0),o=0);for(let h=o;h<n;h++)r[h]=0;wy(s,n-8,BigInt(this.length*8),i),this.process(s,0);const a=Oi(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<u;h++)a.setUint32(4*h,l[h],i)}digest(){const{buffer:e,outputLen:r}=this;this.digestInto(e);const s=e.slice(0,r);return this.destroy(),s}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:r,buffer:s,length:n,finished:i,destroyed:o,pos:a}=this;return e.length=n,e.pos=a,e.finished=i,e.destroyed=o,n%r&&e.buffer.set(s),e}};const rn=BigInt(2**32-1),Pi=BigInt(32);function _c(t,e=!1){return e?{h:Number(t&rn),l:Number(t>>Pi&rn)}:{h:Number(t>>Pi&rn)|0,l:Number(t&rn)|0}}function by(t,e=!1){let r=new Uint32Array(t.length),s=new Uint32Array(t.length);for(let n=0;n<t.length;n++){const{h:i,l:o}=_c(t[n],e);[r[n],s[n]]=[i,o]}return[r,s]}const vy=(t,e)=>BigInt(t>>>0)<<Pi|BigInt(e>>>0),Ey=(t,e,r)=>t>>>r,xy=(t,e,r)=>t<<32-r|e>>>r,_y=(t,e,r)=>t>>>r|e<<32-r,Sy=(t,e,r)=>t<<32-r|e>>>r,Iy=(t,e,r)=>t<<64-r|e>>>r-32,Dy=(t,e,r)=>t>>>r-32|e<<64-r,Ay=(t,e)=>e,Oy=(t,e)=>t,Py=(t,e,r)=>t<<r|e>>>32-r,By=(t,e,r)=>e<<r|t>>>32-r,$y=(t,e,r)=>e<<r-32|t>>>64-r,Ty=(t,e,r)=>t<<r-32|e>>>64-r;function Ry(t,e,r,s){const n=(e>>>0)+(s>>>0);return{h:t+r+(n/2**32|0)|0,l:n|0}}const Cy=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),Ny=(t,e,r,s)=>e+r+s+(t/2**32|0)|0,Uy=(t,e,r,s)=>(t>>>0)+(e>>>0)+(r>>>0)+(s>>>0),Ly=(t,e,r,s,n)=>e+r+s+n+(t/2**32|0)|0,ky=(t,e,r,s,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(s>>>0)+(n>>>0),qy=(t,e,r,s,n,i)=>e+r+s+n+i+(t/2**32|0)|0,Y={fromBig:_c,split:by,toBig:vy,shrSH:Ey,shrSL:xy,rotrSH:_y,rotrSL:Sy,rotrBH:Iy,rotrBL:Dy,rotr32H:Ay,rotr32L:Oy,rotlSH:Py,rotlSL:By,rotlBH:$y,rotlBL:Ty,add:Ry,add3L:Cy,add3H:Ny,add4L:Uy,add4H:Ly,add5H:qy,add5L:ky},[Fy,My]=Y.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da