UNPKG

@walletconnect/universal-provider

Version:
14 lines (12 loc) 520 kB
(function(Gr,Ze){typeof exports=="object"&&typeof module<"u"?Ze(exports):typeof define=="function"&&define.amd?define(["exports"],Ze):(Gr=typeof globalThis<"u"?globalThis:Gr||self,Ze(Gr["@walletconnect/universal-provider"]={}))})(this,function(Gr){"use strict";var Ze=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Wu(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(r,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}),r}var Ue={exports:{}},xi=typeof Reflect=="object"?Reflect:null,Gu=xi&&typeof xi.apply=="function"?xi.apply:function(e,r,i){return Function.prototype.apply.call(e,r,i)},ms;xi&&typeof xi.ownKeys=="function"?ms=xi.ownKeys:Object.getOwnPropertySymbols?ms=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:ms=function(e){return Object.getOwnPropertyNames(e)};function _y(t){console&&console.warn&&console.warn(t)}var Yu=Number.isNaN||function(e){return e!==e};function ae(){ae.init.call(this)}Ue.exports=ae,Ue.exports.once=$y,ae.EventEmitter=ae,ae.prototype._events=void 0,ae.prototype._eventsCount=0,ae.prototype._maxListeners=void 0;var Zu=10;function bs(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ae,"defaultMaxListeners",{enumerable:!0,get:function(){return Zu},set:function(t){if(typeof t!="number"||t<0||Yu(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Zu=t}}),ae.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},ae.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Yu(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Ju(t){return t._maxListeners===void 0?ae.defaultMaxListeners:t._maxListeners}ae.prototype.getMaxListeners=function(){return Ju(this)},ae.prototype.emit=function(e){for(var r=[],i=1;i<arguments.length;i++)r.push(arguments[i]);var n=e==="error",s=this._events;if(s!==void 0)n=n&&s.error===void 0;else if(!n)return!1;if(n){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(c===void 0)return!1;if(typeof c=="function")Gu(c,this,r);else for(var u=c.length,h=rh(c,u),i=0;i<u;++i)Gu(h[i],this,r);return!0};function Xu(t,e,r,i){var n,s,o;if(bs(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),n=Ju(t),n>0&&o.length>n&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,_y(a)}return t}ae.prototype.addListener=function(e,r){return Xu(this,e,r,!1)},ae.prototype.on=ae.prototype.addListener,ae.prototype.prependListener=function(e,r){return Xu(this,e,r,!0)};function Iy(){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 Qu(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=Iy.bind(i);return n.listener=r,i.wrapFn=n,n}ae.prototype.once=function(e,r){return bs(r),this.on(e,Qu(this,e,r)),this},ae.prototype.prependOnceListener=function(e,r){return bs(r),this.prependListener(e,Qu(this,e,r)),this},ae.prototype.removeListener=function(e,r){var i,n,s,o,a;if(bs(r),n=this._events,n===void 0)return this;if(i=n[e],i===void 0)return this;if(i===r||i.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||r));else if(typeof i!="function"){for(s=-1,o=i.length-1;o>=0;o--)if(i[o]===r||i[o].listener===r){a=i[o].listener,s=o;break}if(s<0)return this;s===0?i.shift():Sy(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},ae.prototype.off=ae.prototype.removeListener,ae.prototype.removeAllListeners=function(e){var r,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),o;for(n=0;n<s.length;++n)o=s[n],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=i[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(n=r.length-1;n>=0;n--)this.removeListener(e,r[n]);return this};function eh(t,e,r){var i=t._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?r?[n.listener||n]:[n]:r?Ay(n):rh(n,n.length)}ae.prototype.listeners=function(e){return eh(this,e,!0)},ae.prototype.rawListeners=function(e){return eh(this,e,!1)},ae.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):th.call(t,e)},ae.prototype.listenerCount=th;function th(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}ae.prototype.eventNames=function(){return this._eventsCount>0?ms(this._events):[]};function rh(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function Sy(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Ay(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function $y(t,e){return new Promise(function(r,i){function n(o){t.removeListener(e,s),i(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",n),r([].slice.call(arguments))}ih(t,e,s,{once:!0}),e!=="error"&&Dy(t,n,{once:!0})})}function Dy(t,e,r){typeof t.on=="function"&&ih(t,"error",e,r)}function ih(t,e,r,i){if(typeof t.on=="function")i.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function n(s){i.once&&t.removeEventListener(e,n),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var j={};/*! ***************************************************************************** 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 Ko=function(t,e){return Ko=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},Ko(t,e)};function Oy(t,e){Ko(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Wo=function(){return Wo=Object.assign||function(e){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Wo.apply(this,arguments)};function Py(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r}function By(t,e,r,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(n<3?o(s):n>3?o(e,r,s):o(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s}function Cy(t,e){return function(r,i){e(r,i,t)}}function Ty(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Ny(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(h){try{u(i.next(h))}catch(l){o(l)}}function c(h){try{u(i.throw(h))}catch(l){o(l)}}function u(h){h.done?s(h.value):n(h.value).then(a,c)}u((i=i.apply(t,e||[])).next())})}function Ry(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,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(h){return c([u,h])}}function c(u){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(s=u[0]&2?n.return:u[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,u[1])).done)return s;switch(n=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=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(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){r.label=u[1];break}if(u[0]===6&&r.label<s[1]){r.label=s[1],s=u;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(u);break}s[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(h){u=[6,h],n=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Uy(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}function Fy(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Go(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function nh(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),n,s=[],o;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(a){o={error:a}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function Ly(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(nh(arguments[e]));return t}function ky(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,n++)i[n]=s[o];return i}function cn(t){return this instanceof cn?(this.v=t,this):new cn(t)}function My(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(f){i[f]&&(n[f]=function(d){return new Promise(function(p,g){s.push([f,d,p,g])>1||a(f,d)})})}function a(f,d){try{c(i[f](d))}catch(p){l(s[0][3],p)}}function c(f){f.value instanceof cn?Promise.resolve(f.value.v).then(u,h):l(s[0][2],f)}function u(f){a("next",f)}function h(f){a("throw",f)}function l(f,d){f(d),s.shift(),s.length&&a(s[0][0],s[0][1])}}function jy(t){var e,r;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=t[n]?function(o){return(r=!r)?{value:cn(t[n](o)),done:n==="return"}:s?s(o):o}:s}}function qy(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 Go=="function"?Go(t):t[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(s){r[s]=t[s]&&function(o){return new Promise(function(a,c){o=t[s](o),n(a,c,o.done,o.value)})}}function n(s,o,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},o)}}function zy(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Hy(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 Vy(t){return t&&t.__esModule?t:{default:t}}function Ky(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Wy(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 Gy=Object.freeze({__proto__:null,__extends:Oy,get __assign(){return Wo},__rest:Py,__decorate:By,__param:Cy,__metadata:Ty,__awaiter:Ny,__generator:Ry,__createBinding:Uy,__exportStar:Fy,__values:Go,__read:nh,__spread:Ly,__spreadArrays:ky,__await:cn,__asyncGenerator:My,__asyncDelegator:jy,__asyncValues:qy,__makeTemplateObject:zy,__importStar:Hy,__importDefault:Vy,__classPrivateFieldGet:Ky,__classPrivateFieldSet:Wy}),vs=Wu(Gy),Yo={},un={},sh;function Yy(){if(sh)return un;sh=1,Object.defineProperty(un,"__esModule",{value:!0}),un.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return un.delay=t,un}var Yr={},Zo={},Zr={},oh;function Zy(){return oh||(oh=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.ONE_THOUSAND=Zr.ONE_HUNDRED=void 0,Zr.ONE_HUNDRED=100,Zr.ONE_THOUSAND=1e3),Zr}var Jo={},ah;function Jy(){return ah||(ah=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}(Jo)),Jo}var ch;function uh(){return ch||(ch=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=vs;e.__exportStar(Zy(),t),e.__exportStar(Jy(),t)}(Zo)),Zo}var hh;function Xy(){if(hh)return Yr;hh=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.fromMiliseconds=Yr.toMiliseconds=void 0;const t=uh();function e(i){return i*t.ONE_THOUSAND}Yr.toMiliseconds=e;function r(i){return Math.floor(i/t.ONE_THOUSAND)}return Yr.fromMiliseconds=r,Yr}var lh;function Qy(){return lh||(lh=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=vs;e.__exportStar(Yy(),t),e.__exportStar(Xy(),t)}(Yo)),Yo}var _i={},fh;function ew(){if(fh)return _i;fh=1,Object.defineProperty(_i,"__esModule",{value:!0}),_i.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 i=this.get(r);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const n=Date.now()-i.started;this.timestamps.set(r,{started:i.started,elapsed:n})}get(r){const i=this.timestamps.get(r);if(typeof i>"u")throw new Error(`No timestamp found for label: ${r}`);return i}elapsed(r){const i=this.get(r);return i.elapsed||Date.now()-i.started}}return _i.Watch=t,_i.default=t,_i}var Xo={},hn={},dh;function tw(){if(dh)return hn;dh=1,Object.defineProperty(hn,"__esModule",{value:!0}),hn.IWatch=void 0;class t{}return hn.IWatch=t,hn}var ph;function rw(){return ph||(ph=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),vs.__exportStar(tw(),t)}(Xo)),Xo}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=vs;e.__exportStar(Qy(),t),e.__exportStar(ew(),t),e.__exportStar(rw(),t),e.__exportStar(uh(),t)})(j);class Jr{}class iw extends Jr{constructor(e){super()}}const gh=j.FIVE_SECONDS,Xr={pulse:"heartbeat_pulse"};class Qo extends iw{constructor(e){super(e),this.events=new Ue.exports.EventEmitter,this.interval=gh,this.interval=e?.interval||gh}static async init(e){const r=new Qo(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(),j.toMiliseconds(this.interval))}pulse(){this.events.emit(Xr.pulse)}}const nw=/"(?:_|\\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*:/,sw=/"(?: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*:/,ow=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function aw(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){cw(t);return}return e}function cw(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Es(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(!ow.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(nw.test(t)||sw.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,aw)}return JSON.parse(t)}catch(i){if(e.strict)throw i;return t}}function uw(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function _e(t,...e){try{return uw(t(...e))}catch(r){return Promise.reject(r)}}function hw(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function lw(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function xs(t){if(hw(t))return String(t);if(lw(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return xs(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const ea="base64:";function fw(t){return typeof t=="string"?t:ea+gw(t)}function dw(t){return typeof t!="string"||!t.startsWith(ea)?t:pw(t.slice(ea.length))}function pw(t){return globalThis.Buffer?Buffer.from(t,"base64"):Uint8Array.from(globalThis.atob(t),e=>e.codePointAt(0))}function gw(t){return globalThis.Buffer?Buffer.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))}function Je(t){return t&&t.split("?")[0]?.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,"")||""}function yw(...t){return Je(t.join(":"))}function _s(t){return t=Je(t),t?t+":":""}function ww(t,e){if(e===void 0)return!0;let r=0,i=t.indexOf(":");for(;i>-1;)r++,i=t.indexOf(":",i+1);return r<=e}function mw(t,e){return e?t.startsWith(e)&&t[t.length-1]!=="$":t[t.length-1]!=="$"}function D5(t){return t}const bw="memory",vw=()=>{const t=new Map;return{name:bw,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 Ew(t={}){const e={mounts:{"":t.driver||vw()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=u=>{for(const h of e.mountpoints)if(u.startsWith(h))return{base:h,relativeKey:u.slice(h.length),driver:e.mounts[h]};return{base:"",relativeKey:u,driver:e.mounts[""]}},i=(u,h)=>e.mountpoints.filter(l=>l.startsWith(u)||h&&u.startsWith(l)).map(l=>({relativeBase:u.length>l.length?u.slice(l.length):void 0,mountpoint:l,driver:e.mounts[l]})),n=(u,h)=>{if(e.watching){h=Je(h);for(const l of e.watchListeners)l(u,h)}},s=async()=>{if(!e.watching){e.watching=!0;for(const u in e.mounts)e.unwatch[u]=await yh(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,h,l)=>{const f=new Map,d=p=>{let g=f.get(p.base);return g||(g={driver:p.driver,base:p.base,items:[]},f.set(p.base,g)),g};for(const p of u){const g=typeof p=="string",m=Je(g?p:p.key),I=g?void 0:p.value,D=g||!p.options?h:{...h,...p.options},v=r(m);d(v).items.push({key:m,value:I,relativeKey:v.relativeKey,options:D})}return Promise.all([...f.values()].map(p=>l(p))).then(p=>p.flat())},c={hasItem(u,h={}){u=Je(u);const{relativeKey:l,driver:f}=r(u);return _e(f.hasItem,l,h)},getItem(u,h={}){u=Je(u);const{relativeKey:l,driver:f}=r(u);return _e(f.getItem,l,h).then(d=>Es(d))},getItems(u,h={}){return a(u,h,l=>l.driver.getItems?_e(l.driver.getItems,l.items.map(f=>({key:f.relativeKey,options:f.options})),h).then(f=>f.map(d=>({key:yw(l.base,d.key),value:Es(d.value)}))):Promise.all(l.items.map(f=>_e(l.driver.getItem,f.relativeKey,f.options).then(d=>({key:f.key,value:Es(d)})))))},getItemRaw(u,h={}){u=Je(u);const{relativeKey:l,driver:f}=r(u);return f.getItemRaw?_e(f.getItemRaw,l,h):_e(f.getItem,l,h).then(d=>dw(d))},async setItem(u,h,l={}){if(h===void 0)return c.removeItem(u);u=Je(u);const{relativeKey:f,driver:d}=r(u);d.setItem&&(await _e(d.setItem,f,xs(h),l),d.watch||n("update",u))},async setItems(u,h){await a(u,h,async l=>{if(l.driver.setItems)return _e(l.driver.setItems,l.items.map(f=>({key:f.relativeKey,value:xs(f.value),options:f.options})),h);l.driver.setItem&&await Promise.all(l.items.map(f=>_e(l.driver.setItem,f.relativeKey,xs(f.value),f.options)))})},async setItemRaw(u,h,l={}){if(h===void 0)return c.removeItem(u,l);u=Je(u);const{relativeKey:f,driver:d}=r(u);if(d.setItemRaw)await _e(d.setItemRaw,f,h,l);else if(d.setItem)await _e(d.setItem,f,fw(h),l);else return;d.watch||n("update",u)},async removeItem(u,h={}){typeof h=="boolean"&&(h={removeMeta:h}),u=Je(u);const{relativeKey:l,driver:f}=r(u);f.removeItem&&(await _e(f.removeItem,l,h),(h.removeMeta||h.removeMata)&&await _e(f.removeItem,l+"$",h),f.watch||n("remove",u))},async getMeta(u,h={}){typeof h=="boolean"&&(h={nativeOnly:h}),u=Je(u);const{relativeKey:l,driver:f}=r(u),d=Object.create(null);if(f.getMeta&&Object.assign(d,await _e(f.getMeta,l,h)),!h.nativeOnly){const p=await _e(f.getItem,l+"$",h).then(g=>Es(g));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(d,p))}return d},setMeta(u,h,l={}){return this.setItem(u+"$",h,l)},removeMeta(u,h={}){return this.removeItem(u+"$",h)},async getKeys(u,h={}){u=_s(u);const l=i(u,!0);let f=[];const d=[];let p=!0;for(const m of l){m.driver.flags?.maxDepth||(p=!1);const I=await _e(m.driver.getKeys,m.relativeBase,h);for(const D of I){const v=m.mountpoint+Je(D);f.some(E=>v.startsWith(E))||d.push(v)}f=[m.mountpoint,...f.filter(D=>!D.startsWith(m.mountpoint))]}const g=h.maxDepth!==void 0&&!p;return d.filter(m=>(!g||ww(m,h.maxDepth))&&mw(m,u))},async clear(u,h={}){u=_s(u),await Promise.all(i(u,!1).map(async l=>{if(l.driver.clear)return _e(l.driver.clear,l.relativeBase,h);if(l.driver.removeItem){const f=await l.driver.getKeys(l.relativeBase||"",h);return Promise.all(f.map(d=>l.driver.removeItem(d,h)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(u=>wh(u)))},async watch(u){return await s(),e.watchListeners.push(u),async()=>{e.watchListeners=e.watchListeners.filter(h=>h!==u),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(u,h){if(u=_s(u),u&&e.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(e.mountpoints.push(u),e.mountpoints.sort((l,f)=>f.length-l.length)),e.mounts[u]=h,e.watching&&Promise.resolve(yh(h,n,u)).then(l=>{e.unwatch[u]=l}).catch(console.error),c},async unmount(u,h=!0){u=_s(u),!(!u||!e.mounts[u])&&(e.watching&&u in e.unwatch&&(e.unwatch[u]?.(),delete e.unwatch[u]),h&&await wh(e.mounts[u]),e.mountpoints=e.mountpoints.filter(l=>l!==u),delete e.mounts[u])},getMount(u=""){u=Je(u)+":";const h=r(u);return{driver:h.driver,base:h.base}},getMounts(u="",h={}){return u=Je(u),i(u,h.parents).map(f=>({driver:f.driver,base:f.mountpoint}))},keys:(u,h={})=>c.getKeys(u,h),get:(u,h={})=>c.getItem(u,h),set:(u,h,l={})=>c.setItem(u,h,l),has:(u,h={})=>c.hasItem(u,h),del:(u,h={})=>c.removeItem(u,h),remove:(u,h={})=>c.removeItem(u,h)};return c}function yh(t,e,r){return t.watch?t.watch((i,n)=>e(i,r+n)):()=>{}}async function wh(t){typeof t.dispose=="function"&&await _e(t.dispose)}function Qr(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function mh(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const i=Qr(r);return(n,s)=>i.then(o=>s(o.transaction(e,n).objectStore(e)))}let ta;function ln(){return ta||(ta=mh("keyval-store","keyval")),ta}function bh(t,e=ln()){return e("readonly",r=>Qr(r.get(t)))}function xw(t,e,r=ln()){return r("readwrite",i=>(i.put(e,t),Qr(i.transaction)))}function _w(t,e=ln()){return e("readwrite",r=>(r.delete(t),Qr(r.transaction)))}function Iw(t=ln()){return t("readwrite",e=>(e.clear(),Qr(e.transaction)))}function Sw(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Qr(t.transaction)}function Aw(t=ln()){return t("readonly",e=>{if(e.getAllKeys)return Qr(e.getAllKeys());const r=[];return Sw(e,i=>r.push(i.key)).then(()=>r)})}const $w=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),Dw=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,(i,n)=>typeof n=="string"&&n.match(/^\d+n$/)?BigInt(n.substring(0,n.length-1)):n)};function ei(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return Dw(t)}catch{return t}}function nr(t){return typeof t=="string"?t:$w(t)||""}const Ow="idb-keyval";var Pw=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=n=>e+n;let i;return t.dbName&&t.storeName&&(i=mh(t.dbName,t.storeName)),{name:Ow,options:t,async hasItem(n){return!(typeof await bh(r(n),i)>"u")},async getItem(n){return await bh(r(n),i)??null},setItem(n,s){return xw(r(n),s,i)},removeItem(n){return _w(r(n),i)},getKeys(){return Aw(i)},clear(){return Iw(i)}}};const Bw="WALLET_CONNECT_V2_INDEXED_DB",Cw="keyvaluestorage";class Tw{constructor(){this.indexedDb=Ew({driver:Pw({dbName:Bw,storeName:Cw})})}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,nr(r))}async removeItem(e){await this.indexedDb.removeItem(e)}}var ra=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Is={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,i){this[r]=String(i)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(i){r[i]=void 0,delete r[i]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof ra<"u"&&ra.localStorage?Is.exports=ra.localStorage:typeof window<"u"&&window.localStorage?Is.exports=window.localStorage:Is.exports=new e})();function Nw(t){var e;return[t[0],ei((e=t[1])!=null?e:"")]}class Rw{constructor(){this.localStorage=Is.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Nw)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return ei(r)}async setItem(e,r){this.localStorage.setItem(e,nr(r))}async removeItem(e){this.localStorage.removeItem(e)}}const Uw="wc_storage_version",vh=1,Fw=async(t,e,r)=>{const i=Uw,n=await e.getItem(i);if(n&&n>=vh){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.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(i,vh),r(e),Lw(t,o)},Lw=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};class kw{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new Rw;this.storage=e;try{const r=new Tw;Fw(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)})}}function Mw(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var jw=qw;function qw(t,e,r){var i=r&&r.stringify||Mw,n=1;if(typeof t=="object"&&t!==null){var s=e.length+n;if(s===1)return t;var o=new Array(s);o[0]=i(t);for(var a=1;a<s;a++)o[a]=i(e[a]);return o.join(" ")}if(typeof t!="string")return t;var c=e.length;if(c===0)return t;for(var u="",h=1-n,l=-1,f=t&&t.length||0,d=0;d<f;){if(t.charCodeAt(d)===37&&d+1<f){switch(l=l>-1?l:0,t.charCodeAt(d+1)){case 100:case 102:if(h>=c||e[h]==null)break;l<d&&(u+=t.slice(l,d)),u+=Number(e[h]),l=d+2,d++;break;case 105:if(h>=c||e[h]==null)break;l<d&&(u+=t.slice(l,d)),u+=Math.floor(Number(e[h])),l=d+2,d++;break;case 79:case 111:case 106:if(h>=c||e[h]===void 0)break;l<d&&(u+=t.slice(l,d));var p=typeof e[h];if(p==="string"){u+="'"+e[h]+"'",l=d+2,d++;break}if(p==="function"){u+=e[h].name||"<anonymous>",l=d+2,d++;break}u+=i(e[h]),l=d+2,d++;break;case 115:if(h>=c)break;l<d&&(u+=t.slice(l,d)),u+=String(e[h]),l=d+2,d++;break;case 37:l<d&&(u+=t.slice(l,d)),u+="%",l=d+2,d++,h--;break}++h}++d}return l===-1?t:(l<f&&(u+=t.slice(l)),u)}const Eh=jw;var jt=qt;const fn=Xw().console||{},zw={mapHttpRequest:As,mapHttpResponse:As,wrapRequestSerializer:na,wrapResponseSerializer:na,wrapErrorSerializer:na,req:As,res:As,err:Gw};function Hw(t,e){return Array.isArray(t)?t.filter(function(i){return i!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function qt(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||fn;t.browser.write&&(t.browser.asObject=!0);const i=t.serializers||{},n=Hw(t.browser.serialize,i);let s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",c=Object.create(r);c.log||(c.log=dn),Object.defineProperty(c,"levelVal",{get:h}),Object.defineProperty(c,"level",{get:l,set:f});const u={transmit:e,serialize:n,asObject:t.browser.asObject,levels:o,timestamp:Yw(t)};c.levels=qt.levels,c.level=a,c.setMaxListeners=c.getMaxListeners=c.emit=c.addListener=c.on=c.prependListener=c.once=c.prependOnceListener=c.removeListener=c.removeAllListeners=c.listeners=c.listenerCount=c.eventNames=c.write=c.flush=dn,c.serializers=i,c._serialize=n,c._stdErrSerialize=s,c.child=d,e&&(c._logEvent=ia());function h(){return this.level==="silent"?1/0:this.levels.values[this.level]}function l(){return this._level}function f(p){if(p!=="silent"&&!this.levels.values[p])throw Error("unknown level "+p);this._level=p,Ii(u,c,"error","log"),Ii(u,c,"fatal","error"),Ii(u,c,"warn","error"),Ii(u,c,"info","log"),Ii(u,c,"debug","log"),Ii(u,c,"trace","log")}function d(p,g){if(!p)throw new Error("missing bindings for child Pino");g=g||{},n&&p.serializers&&(g.serializers=p.serializers);const m=g.serializers;if(n&&m){var I=Object.assign({},i,m),D=t.browser.serialize===!0?Object.keys(I):n;delete p.serializers,Ss([p],D,I,this._stdErrSerialize)}function v(E){this._childLevel=(E._childLevel|0)+1,this.error=Si(E,p,"error"),this.fatal=Si(E,p,"fatal"),this.warn=Si(E,p,"warn"),this.info=Si(E,p,"info"),this.debug=Si(E,p,"debug"),this.trace=Si(E,p,"trace"),I&&(this.serializers=I,this._serialize=D),e&&(this._logEvent=ia([].concat(E._logEvent.bindings,p)))}return v.prototype=this,new v(this)}return c}qt.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"}},qt.stdSerializers=zw,qt.stdTimeFunctions=Object.assign({},{nullTime:xh,epochTime:_h,unixTime:Zw,isoTime:Jw});function Ii(t,e,r,i){const n=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?dn:n[r]?n[r]:fn[r]||fn[i]||dn,Vw(t,e,r)}function Vw(t,e,r){!t.transmit&&e[r]===dn||(e[r]=function(i){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===fn?fn:this;for(var c=0;c<o.length;c++)o[c]=arguments[c];if(t.serialize&&!t.asObject&&Ss(o,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?i.call(a,Kw(this,r,o,s)):i.apply(a,o),t.transmit){const u=t.transmit.level||e.level,h=qt.levels.values[u],l=qt.levels.values[r];if(l<h)return;Ww(this,{ts:s,methodLevel:r,methodValue:l,transmitLevel:u,transmitValue:qt.levels.values[t.transmit.level||e.level],send:t.transmit.send,val:e.levelVal},o)}}}(e[r]))}function Kw(t,e,r,i){t._serialize&&Ss(r,t._serialize,t.serializers,t._stdErrSerialize);const n=r.slice();let s=n[0];const o={};i&&(o.time=i),o.level=qt.levels.values[e];let a=(t._childLevel|0)+1;if(a<1&&(a=1),s!==null&&typeof s=="object"){for(;a--&&typeof n[0]=="object";)Object.assign(o,n.shift());s=n.length?Eh(n.shift(),n):void 0}else typeof s=="string"&&(s=Eh(n.shift(),n));return s!==void 0&&(o.msg=s),o}function Ss(t,e,r,i){for(const n in t)if(i&&t[n]instanceof Error)t[n]=qt.stdSerializers.err(t[n]);else if(typeof t[n]=="object"&&!Array.isArray(t[n]))for(const s in t[n])e&&e.indexOf(s)>-1&&s in r&&(t[n][s]=r[s](t[n][s]))}function Si(t,e,r){return function(){const i=new Array(1+arguments.length);i[0]=e;for(var n=1;n<i.length;n++)i[n]=arguments[n-1];return t[r].apply(this,i)}}function Ww(t,e,r){const i=e.send,n=e.ts,s=e.methodLevel,o=e.methodValue,a=e.val,c=t._logEvent.bindings;Ss(r,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=n,t._logEvent.messages=r.filter(function(u){return c.indexOf(u)===-1}),t._logEvent.level.label=s,t._logEvent.level.value=o,i(s,t._logEvent,a),t._logEvent=ia(c)}function ia(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function Gw(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 Yw(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?xh:_h}function As(){return{}}function na(t){return t}function dn(){}function xh(){return!1}function _h(){return Date.now()}function Zw(){return Math.round(Date.now()/1e3)}function Jw(){return new Date(Date.now()).toISOString()}function Xw(){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)||{}}}const Qw={level:"info"},pn="custom_context",sa=1e3*1024;class em{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class Ih{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const r=new em(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}}}}}class Sh{constructor(e,r=sa){this.level=e??"error",this.levelValue=jt.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new Ih(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===jt.levels.values.error?console.error(e):r===jt.levels.values.warn?console.warn(e):r===jt.levels.values.debug?console.debug(e):r===jt.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(nr({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 Ih(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(nr({extraMetadata:e})),new Blob(r,{type:"application/json"})}}class tm{constructor(e,r=sa){this.baseChunkLogger=new Sh(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)),i=document.createElement("a");i.href=r,i.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}}class rm{constructor(e,r=sa){this.baseChunkLogger=new Sh(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 im=Object.defineProperty,nm=Object.defineProperties,sm=Object.getOwnPropertyDescriptors,Ah=Object.getOwnPropertySymbols,om=Object.prototype.hasOwnProperty,am=Object.prototype.propertyIsEnumerable,$h=(t,e,r)=>e in t?im(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$s=(t,e)=>{for(var r in e||(e={}))om.call(e,r)&&$h(t,r,e[r]);if(Ah)for(var r of Ah(e))am.call(e,r)&&$h(t,r,e[r]);return t},Ds=(t,e)=>nm(t,sm(e));function Os(t){return Ds($s({},t),{level:t?.level||Qw.level})}function cm(t,e=pn){return t[e]||""}function um(t,e,r=pn){return t[r]=e,t}function Xe(t,e=pn){let r="";return typeof t.bindings>"u"?r=cm(t,e):r=t.bindings().context||"",r}function hm(t,e,r=pn){const i=Xe(t,r);return i.trim()?`${i}/${e}`:e}function He(t,e,r=pn){const i=hm(t,e,r),n=t.child({context:i});return um(n,i,r)}function lm(t){var e,r;const i=new tm((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:jt(Ds($s({},t.opts),{level:"trace",browser:Ds($s({},(r=t.opts)==null?void 0:r.browser),{write:n=>i.write(n)})})),chunkLoggerController:i}}function fm(t){var e;const r=new rm((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:jt(Ds($s({},t.opts),{level:"trace"})),chunkLoggerController:r}}function dm(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?lm(t):fm(t)}var pm=Object.defineProperty,gm=(t,e,r)=>e in t?pm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dh=(t,e,r)=>gm(t,typeof e!="symbol"?e+"":e,r);class ym extends Jr{constructor(e){super(),this.opts=e,Dh(this,"protocol","wc"),Dh(this,"version",2)}}var wm=Object.defineProperty,mm=(t,e,r)=>e in t?wm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,bm=(t,e,r)=>mm(t,typeof e!="symbol"?e+"":e,r);class vm extends Jr{constructor(e,r){super(),this.core=e,this.logger=r,bm(this,"records",new Map)}}class Em{constructor(e,r){this.logger=e,this.core=r}}class xm extends Jr{constructor(e,r){super(),this.relayer=e,this.logger=r}}class _m extends Jr{constructor(e){super()}}class Im{constructor(e,r,i,n){this.core=e,this.logger=r,this.name=i}}class Sm extends Jr{constructor(e,r){super(),this.relayer=e,this.logger=r}}class Am extends Jr{constructor(e,r){super(),this.core=e,this.logger=r}}class $m{constructor(e,r,i){this.core=e,this.logger=r,this.store=i}}class Dm{constructor(e,r){this.projectId=e,this.logger=r}}class Om{constructor(e,r,i){this.core=e,this.logger=r,this.telemetryEnabled=i}}var Pm=Object.defineProperty,Bm=(t,e,r)=>e in t?Pm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Oh=(t,e,r)=>Bm(t,typeof e!="symbol"?e+"":e,r);class Cm{constructor(e){this.opts=e,Oh(this,"protocol","wc"),Oh(this,"version",2)}}class Tm{constructor(e){this.client=e}}function Nm(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function Ph(t,...e){if(!Nm(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 Bh(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 Rm(t,e){Ph(t);const r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}const Ai=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const oa=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);function Um(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function Ch(t){return typeof t=="string"&&(t=Um(t)),Ph(t),t}class Fm{clone(){return this._cloneInto()}}function Lm(t){const e=i=>t().update(Ch(i)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function Th(t=32){if(Ai&&typeof Ai.getRandomValues=="function")return Ai.getRandomValues(new Uint8Array(t));if(Ai&&typeof Ai.randomBytes=="function")return Ai.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}function km(t,e,r,i){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,i);const n=BigInt(32),s=BigInt(4294967295),o=Number(r>>n&s),a=Number(r&s),c=i?4:0,u=i?0:4;t.setUint32(e+c,o,i),t.setUint32(e+u,a,i)}class Mm extends Fm{constructor(e,r,i,n){super(),this.blockLen=e,this.outputLen=r,this.padOffset=i,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=oa(this.buffer)}update(e){Bh(this);const{view:r,buffer:i,blockLen:n}=this;e=Ch(e);const s=e.length;for(let o=0;o<s;){const a=Math.min(n-this.pos,s-o);if(a===n){const c=oa(e);for(;n<=s-o;o+=n)this.process(c,o);continue}i.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){Bh(this),Rm(e,this),this.finished=!0;const{buffer:r,view:i,blockLen:n,isLE:s}=this;let{pos:o}=this;r[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(i,0),o=0);for(let l=o;l<n;l++)r[l]=0;km(i,n-8,BigInt(this.length*8),s),this.process(i,0);const a=oa(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,h=this.get();if(u>h.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<u;l++)a.setUint32(4*l,h[l],s)}digest(){const{buffer:e,outputLen:r}=this;this.digestInto(e);const i=e.slice(0,r);return this.destroy(),i}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:r,buffer:i,length:n,finished:s,destroyed:o,pos:a}=this;return e.length=n,e.pos=a,e.finished=s,e.destroyed=o,n%r&&e.buffer.set(i),e}}const Ps=BigInt(2**32-1),aa=BigInt(32);function Nh(t,e=!1){return e?{h:Number(t&Ps),l:Number(t>>aa&Ps)}:{h:Number(t>>aa&Ps)|0,l:Number(t&Ps)|0}}function jm(t,e=!1){let r=new Uint32Array(t.length),i=new Uint32Array(t.length);for(let n=0;n<t.length;n++){const{h:s,l:o}=Nh(t[n],e);[r[n],i[n]]=[s,o]}return[r,i]}const qm=(t,e)=>BigInt(t>>>0)<<aa|BigInt(e>>>0),zm=(t,e,r)=>t>>>r,Hm=(t,e,r)=>t<<32-r|e>>>r,Vm=(t,e,r)=>t>>>r|e<<32-r,Km=(t,e,r)=>t<<32-r|e>>>r,Wm=(t,e,r)=>t<<64-r|e>>>r-32,Gm=(t,e,r)=>t>>>r-32|e<<64-r,Ym=(t,e)=>e,Zm=(t,e)=>t,Jm=(t,e,r)=>t<<r|e>>>32-r,Xm=(t,e,r)=>e<<r|t>>>32-r,Qm=(t,e,r)=>e<<r-32|t>>>64-r,e1=(t,e,r)=>t<<r-32|e>>>64-r;function t1(t,e,r,i){const n=(e>>>0)+(i>>>0);return{h:t+r+(n/2**32|0)|0,l:n|0}}const r1=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),i1=(t,e,r,i)=>e+r+i+(t/2**32|0)|0,n1=(t,e,r,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(i>>>0),s1=(t,e,r,i,n)=>e+r+i+n+(t/2**32|0)|0,o1=(t,e,r,i,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(i>>>0)+(n>>>0),a1=(t,e,r,i,n,s)=>e+r+i+n+s+(t/2**32|0)|0,Y={fromBig:Nh,split:jm,toBig:qm,shrSH:zm,shrSL:Hm,rotrSH:Vm,rotrSL:Km,rotrBH:Wm,rotrBL:Gm,rotr32H:Ym,rotr32L:Zm,rotlSH:Jm,rotlSL:Xm,rotlBH:Qm,rotlBL:e1,add:t1,add3L:r1,add3H:i1,add4L:n1,add4H:s1,add5H:a1,add5L:o1},[c1,u1]=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","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),vr=new Uint32Array(80),Er=new Uint32Array(80);class h1 extends Mm{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:r,Bh:i,Bl:n,Ch:s,Cl:o,Dh:a,Dl:c,Eh:u,El:h,Fh:l,Fl:f,Gh:d,Gl:p,Hh:g,Hl:m}=this;return[e,r,i,n,s,o,a,c,u,h,l,f,d,p,g,m]}set(e,r,i,n,s,o,a,c,u,h,l,f,d,p,g,m){this.Ah=e|0,this.Al=r|0,this.Bh=i|0,this.Bl=n|0,this.Ch=s|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=u|0,this.El=h|0,this.Fh=l|0,this.Fl=f|0,this.Gh=d|0,this.Gl=p|0,this.Hh=g|0,this.Hl=m|0}process(e,r){for(let v=0;v<16;v++,r+=4)vr[v]=e.getUint32(r),Er[v]=e.getUint32(r+=4);for(let v=16;v<80;v++){const E=vr[v-15]|0,_=Er[v-15]|0,B=Y.rotrSH(E,_,1)^Y.rotrSH(E,_,8)^Y.shrSH(E,_,7),R=Y.rotrSL(E,_,1)^Y.rotrSL(E,_,8)^Y.shrSL(E,_,7),N=vr[v-2]|0,b=Er[v-2]|0,C=Y.rotrSH(N,b,19)^Y.rotrBH(N,b,61)^Y.shrSH(N,b,6),$=Y.rotrSL(N,b,19)^Y.rotrBL(N,b,61)^Y.shrSL(N,b,6),O=Y.add4L(R,$,Er[v-7],Er[v-16]),T=Y.add4H(O,B,C,vr[v-7],vr[v-1