UNPKG

@walletconnect/universal-provider

Version:
14 lines (12 loc) 523 kB
(function(Yr,Ze){typeof exports=="object"&&typeof module<"u"?Ze(exports):typeof define=="function"&&define.amd?define(["exports"],Ze):(Yr=typeof globalThis<"u"?globalThis:Yr||self,Ze(Yr["@walletconnect/universal-provider"]={}))})(this,function(Yr){"use strict";var Ze=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $y(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Xu(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:{}},_i=typeof Reflect=="object"?Reflect:null,Qu=_i&&typeof _i.apply=="function"?_i.apply:function(e,r,i){return Function.prototype.apply.call(e,r,i)},bs;_i&&typeof _i.ownKeys=="function"?bs=_i.ownKeys:Object.getOwnPropertySymbols?bs=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:bs=function(e){return Object.getOwnPropertyNames(e)};function Oy(t){console&&console.warn&&console.warn(t)}var eh=Number.isNaN||function(e){return e!==e};function ae(){ae.init.call(this)}Ue.exports=ae,Ue.exports.once=Cy,ae.EventEmitter=ae,ae.prototype._events=void 0,ae.prototype._eventsCount=0,ae.prototype._maxListeners=void 0;var th=10;function vs(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 th},set:function(t){if(typeof t!="number"||t<0||eh(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");th=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||eh(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 rh(t){return t._maxListeners===void 0?ae.defaultMaxListeners:t._maxListeners}ae.prototype.getMaxListeners=function(){return rh(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")Qu(c,this,r);else for(var u=c.length,h=ah(c,u),i=0;i<u;++i)Qu(h[i],this,r);return!0};function ih(t,e,r,i){var n,s,o;if(vs(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=rh(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,Oy(a)}return t}ae.prototype.addListener=function(e,r){return ih(this,e,r,!1)},ae.prototype.on=ae.prototype.addListener,ae.prototype.prependListener=function(e,r){return ih(this,e,r,!0)};function Dy(){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 nh(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=Dy.bind(i);return n.listener=r,i.wrapFn=n,n}ae.prototype.once=function(e,r){return vs(r),this.on(e,nh(this,e,r)),this},ae.prototype.prependOnceListener=function(e,r){return vs(r),this.prependListener(e,nh(this,e,r)),this},ae.prototype.removeListener=function(e,r){var i,n,s,o,a;if(vs(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():Py(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 sh(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?By(n):ah(n,n.length)}ae.prototype.listeners=function(e){return sh(this,e,!0)},ae.prototype.rawListeners=function(e){return sh(this,e,!1)},ae.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):oh.call(t,e)},ae.prototype.listenerCount=oh;function oh(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?bs(this._events):[]};function ah(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function Py(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function By(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Cy(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))}ch(t,e,s,{once:!0}),e!=="error"&&Ty(t,n,{once:!0})})}function Ty(t,e,r){typeof t.on=="function"&&ch(t,"error",e,r)}function ch(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 M={};/*! ***************************************************************************** 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 Wo=function(t,e){return Wo=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])},Wo(t,e)};function Ny(t,e){Wo(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Go=function(){return Go=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},Go.apply(this,arguments)};function Ry(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 Uy(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 Fy(t,e){return function(r,i){e(r,i,t)}}function Ly(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function ky(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 jy(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 My(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}function qy(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Yo(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 uh(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 zy(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(uh(arguments[e]));return t}function Hy(){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 un(t){return this instanceof un?(this.v=t,this):new un(t)}function Vy(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 un?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 Ky(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:un(t[n](o)),done:n==="return"}:s?s(o):o}:s}}function Wy(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 Yo=="function"?Yo(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 Gy(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Yy(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 Zy(t){return t&&t.__esModule?t:{default:t}}function Jy(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Xy(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 Qy=Object.freeze({__proto__:null,__extends:Ny,get __assign(){return Go},__rest:Ry,__decorate:Uy,__param:Fy,__metadata:Ly,__awaiter:ky,__generator:jy,__createBinding:My,__exportStar:qy,__values:Yo,__read:uh,__spread:zy,__spreadArrays:Hy,__await:un,__asyncGenerator:Vy,__asyncDelegator:Ky,__asyncValues:Wy,__makeTemplateObject:Gy,__importStar:Yy,__importDefault:Zy,__classPrivateFieldGet:Jy,__classPrivateFieldSet:Xy}),Es=Xu(Qy),Zo={},hn={},hh;function ew(){if(hh)return hn;hh=1,Object.defineProperty(hn,"__esModule",{value:!0}),hn.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return hn.delay=t,hn}var Zr={},Jo={},Jr={},lh;function tw(){return lh||(lh=1,Object.defineProperty(Jr,"__esModule",{value:!0}),Jr.ONE_THOUSAND=Jr.ONE_HUNDRED=void 0,Jr.ONE_HUNDRED=100,Jr.ONE_THOUSAND=1e3),Jr}var Xo={},fh;function rw(){return fh||(fh=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}(Xo)),Xo}var dh;function ph(){return dh||(dh=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Es;e.__exportStar(tw(),t),e.__exportStar(rw(),t)}(Jo)),Jo}var gh;function iw(){if(gh)return Zr;gh=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.fromMiliseconds=Zr.toMiliseconds=void 0;const t=ph();function e(i){return i*t.ONE_THOUSAND}Zr.toMiliseconds=e;function r(i){return Math.floor(i/t.ONE_THOUSAND)}return Zr.fromMiliseconds=r,Zr}var yh;function nw(){return yh||(yh=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Es;e.__exportStar(ew(),t),e.__exportStar(iw(),t)}(Zo)),Zo}var Ii={},wh;function sw(){if(wh)return Ii;wh=1,Object.defineProperty(Ii,"__esModule",{value:!0}),Ii.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 Ii.Watch=t,Ii.default=t,Ii}var Qo={},ln={},mh;function ow(){if(mh)return ln;mh=1,Object.defineProperty(ln,"__esModule",{value:!0}),ln.IWatch=void 0;class t{}return ln.IWatch=t,ln}var bh;function aw(){return bh||(bh=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Es.__exportStar(ow(),t)}(Qo)),Qo}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Es;e.__exportStar(nw(),t),e.__exportStar(sw(),t),e.__exportStar(aw(),t),e.__exportStar(ph(),t)})(M);class Xr{}class cw extends Xr{constructor(e){super()}}const vh=M.FIVE_SECONDS,Qr={pulse:"heartbeat_pulse"};class ea extends cw{constructor(e){super(e),this.events=new Ue.exports.EventEmitter,this.interval=vh,this.interval=e?.interval||vh}static async init(e){const r=new ea(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(Qr.pulse)}}const uw=/"(?:_|\\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*:/,hw=/"(?: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*:/,lw=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function fw(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){dw(t);return}return e}function dw(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function xs(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(!lw.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(uw.test(t)||hw.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,fw)}return JSON.parse(t)}catch(i){if(e.strict)throw i;return t}}function pw(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function _e(t,...e){try{return pw(t(...e))}catch(r){return Promise.reject(r)}}function gw(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function yw(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function _s(t){if(gw(t))return String(t);if(yw(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return _s(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const ta="base64:";function ww(t){return typeof t=="string"?t:ta+vw(t)}function mw(t){return typeof t!="string"||!t.startsWith(ta)?t:bw(t.slice(ta.length))}function bw(t){return globalThis.Buffer?Buffer.from(t,"base64"):Uint8Array.from(globalThis.atob(t),e=>e.codePointAt(0))}function vw(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 Ew(...t){return Je(t.join(":"))}function Is(t){return t=Je(t),t?t+":":""}function xw(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 _w(t,e){return e?t.startsWith(e)&&t[t.length-1]!=="$":t[t.length-1]!=="$"}function J5(t){return t}const Iw="memory",Sw=()=>{const t=new Map;return{name:Iw,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 Aw(t={}){const e={mounts:{"":t.driver||Sw()},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 Eh(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,O=g||!p.options?h:{...h,...p.options},v=r(m);d(v).items.push({key:m,value:I,relativeKey:v.relativeKey,options:O})}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=>xs(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:Ew(l.base,d.key),value:xs(d.value)}))):Promise.all(l.items.map(f=>_e(l.driver.getItem,f.relativeKey,f.options).then(d=>({key:f.key,value:xs(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=>mw(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,_s(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:_s(f.value),options:f.options})),h);l.driver.setItem&&await Promise.all(l.items.map(f=>_e(l.driver.setItem,f.relativeKey,_s(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,ww(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=>xs(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=Is(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 O of I){const v=m.mountpoint+Je(O);f.some(E=>v.startsWith(E))||d.push(v)}f=[m.mountpoint,...f.filter(O=>!O.startsWith(m.mountpoint))]}const g=h.maxDepth!==void 0&&!p;return d.filter(m=>(!g||xw(m,h.maxDepth))&&_w(m,u))},async clear(u,h={}){u=Is(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=>xh(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=Is(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(Eh(h,n,u)).then(l=>{e.unwatch[u]=l}).catch(console.error),c},async unmount(u,h=!0){u=Is(u),!(!u||!e.mounts[u])&&(e.watching&&u in e.unwatch&&(e.unwatch[u]?.(),delete e.unwatch[u]),h&&await xh(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 Eh(t,e,r){return t.watch?t.watch((i,n)=>e(i,r+n)):()=>{}}async function xh(t){typeof t.dispose=="function"&&await _e(t.dispose)}function ei(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function _h(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const i=ei(r);return(n,s)=>i.then(o=>s(o.transaction(e,n).objectStore(e)))}let ra;function fn(){return ra||(ra=_h("keyval-store","keyval")),ra}function Ih(t,e=fn()){return e("readonly",r=>ei(r.get(t)))}function $w(t,e,r=fn()){return r("readwrite",i=>(i.put(e,t),ei(i.transaction)))}function Ow(t,e=fn()){return e("readwrite",r=>(r.delete(t),ei(r.transaction)))}function Dw(t=fn()){return t("readwrite",e=>(e.clear(),ei(e.transaction)))}function Pw(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},ei(t.transaction)}function Bw(t=fn()){return t("readonly",e=>{if(e.getAllKeys)return ei(e.getAllKeys());const r=[];return Pw(e,i=>r.push(i.key)).then(()=>r)})}const Cw=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),Tw=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 ti(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return Tw(t)}catch{return t}}function sr(t){return typeof t=="string"?t:Cw(t)||""}const Nw="idb-keyval";var Rw=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=n=>e+n;let i;return t.dbName&&t.storeName&&(i=_h(t.dbName,t.storeName)),{name:Nw,options:t,async hasItem(n){return!(typeof await Ih(r(n),i)>"u")},async getItem(n){return await Ih(r(n),i)??null},setItem(n,s){return $w(r(n),s,i)},removeItem(n){return Ow(r(n),i)},getKeys(){return Bw(i)},clear(){return Dw(i)}}};const Uw="WALLET_CONNECT_V2_INDEXED_DB",Fw="keyvaluestorage";class Lw{constructor(){this.indexedDb=Aw({driver:Rw({dbName:Uw,storeName:Fw})})}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,sr(r))}async removeItem(e){await this.indexedDb.removeItem(e)}}var ia=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ss={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 ia<"u"&&ia.localStorage?Ss.exports=ia.localStorage:typeof window<"u"&&window.localStorage?Ss.exports=window.localStorage:Ss.exports=new e})();function kw(t){var e;return[t[0],ti((e=t[1])!=null?e:"")]}class jw{constructor(){this.localStorage=Ss.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(kw)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return ti(r)}async setItem(e,r){this.localStorage.setItem(e,sr(r))}async removeItem(e){this.localStorage.removeItem(e)}}const Mw="wc_storage_version",Sh=1,qw=async(t,e,r)=>{const i=Mw,n=await e.getItem(i);if(n&&n>=Sh){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,Sh),r(e),zw(t,o)},zw=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};class Hw{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new jw;this.storage=e;try{const r=new Lw;qw(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 Vw(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var Kw=Ww;function Ww(t,e,r){var i=r&&r.stringify||Vw,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 Ah=Kw;var qt=zt;const dn=im().console||{},Gw={mapHttpRequest:$s,mapHttpResponse:$s,wrapRequestSerializer:sa,wrapResponseSerializer:sa,wrapErrorSerializer:sa,req:$s,res:$s,err:Qw};function Yw(t,e){return Array.isArray(t)?t.filter(function(i){return i!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function zt(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||dn;t.browser.write&&(t.browser.asObject=!0);const i=t.serializers||{},n=Yw(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=pn),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:em(t)};c.levels=zt.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=pn,c.serializers=i,c._serialize=n,c._stdErrSerialize=s,c.child=d,e&&(c._logEvent=na());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,Si(u,c,"error","log"),Si(u,c,"fatal","error"),Si(u,c,"warn","error"),Si(u,c,"info","log"),Si(u,c,"debug","log"),Si(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),O=t.browser.serialize===!0?Object.keys(I):n;delete p.serializers,As([p],O,I,this._stdErrSerialize)}function v(E){this._childLevel=(E._childLevel|0)+1,this.error=Ai(E,p,"error"),this.fatal=Ai(E,p,"fatal"),this.warn=Ai(E,p,"warn"),this.info=Ai(E,p,"info"),this.debug=Ai(E,p,"debug"),this.trace=Ai(E,p,"trace"),I&&(this.serializers=I,this._serialize=O),e&&(this._logEvent=na([].concat(E._logEvent.bindings,p)))}return v.prototype=this,new v(this)}return c}zt.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"}},zt.stdSerializers=Gw,zt.stdTimeFunctions=Object.assign({},{nullTime:$h,epochTime:Oh,unixTime:tm,isoTime:rm});function Si(t,e,r,i){const n=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?pn:n[r]?n[r]:dn[r]||dn[i]||pn,Zw(t,e,r)}function Zw(t,e,r){!t.transmit&&e[r]===pn||(e[r]=function(i){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===dn?dn:this;for(var c=0;c<o.length;c++)o[c]=arguments[c];if(t.serialize&&!t.asObject&&As(o,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?i.call(a,Jw(this,r,o,s)):i.apply(a,o),t.transmit){const u=t.transmit.level||e.level,h=zt.levels.values[u],l=zt.levels.values[r];if(l<h)return;Xw(this,{ts:s,methodLevel:r,methodValue:l,transmitLevel:u,transmitValue:zt.levels.values[t.transmit.level||e.level],send:t.transmit.send,val:e.levelVal},o)}}}(e[r]))}function Jw(t,e,r,i){t._serialize&&As(r,t._serialize,t.serializers,t._stdErrSerialize);const n=r.slice();let s=n[0];const o={};i&&(o.time=i),o.level=zt.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?Ah(n.shift(),n):void 0}else typeof s=="string"&&(s=Ah(n.shift(),n));return s!==void 0&&(o.msg=s),o}function As(t,e,r,i){for(const n in t)if(i&&t[n]instanceof Error)t[n]=zt.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 Ai(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 Xw(t,e,r){const i=e.send,n=e.ts,s=e.methodLevel,o=e.methodValue,a=e.val,c=t._logEvent.bindings;As(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=na(c)}function na(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function Qw(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 em(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?$h:Oh}function $s(){return{}}function sa(t){return t}function pn(){}function $h(){return!1}function Oh(){return Date.now()}function tm(){return Math.round(Date.now()/1e3)}function rm(){return new Date(Date.now()).toISOString()}function im(){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 nm={level:"info"},gn="custom_context",oa=1e3*1024;class sm{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 Dh{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const r=new sm(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 Ph{constructor(e,r=oa){this.level=e??"error",this.levelValue=qt.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new Dh(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===qt.levels.values.error?console.error(e):r===qt.levels.values.warn?console.warn(e):r===qt.levels.values.debug?console.debug(e):r===qt.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(sr({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 Dh(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(sr({extraMetadata:e})),new Blob(r,{type:"application/json"})}}class om{constructor(e,r=oa){this.baseChunkLogger=new Ph(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 am{constructor(e,r=oa){this.baseChunkLogger=new Ph(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 cm=Object.defineProperty,um=Object.defineProperties,hm=Object.getOwnPropertyDescriptors,Bh=Object.getOwnPropertySymbols,lm=Object.prototype.hasOwnProperty,fm=Object.prototype.propertyIsEnumerable,Ch=(t,e,r)=>e in t?cm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Os=(t,e)=>{for(var r in e||(e={}))lm.call(e,r)&&Ch(t,r,e[r]);if(Bh)for(var r of Bh(e))fm.call(e,r)&&Ch(t,r,e[r]);return t},Ds=(t,e)=>um(t,hm(e));function Ps(t){return Ds(Os({},t),{level:t?.level||nm.level})}function dm(t,e=gn){return t[e]||""}function pm(t,e,r=gn){return t[r]=e,t}function Xe(t,e=gn){let r="";return typeof t.bindings>"u"?r=dm(t,e):r=t.bindings().context||"",r}function gm(t,e,r=gn){const i=Xe(t,r);return i.trim()?`${i}/${e}`:e}function He(t,e,r=gn){const i=gm(t,e,r),n=t.child({context:i});return pm(n,i,r)}function ym(t){var e,r;const i=new om((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:qt(Ds(Os({},t.opts),{level:"trace",browser:Ds(Os({},(r=t.opts)==null?void 0:r.browser),{write:n=>i.write(n)})})),chunkLoggerController:i}}function wm(t){var e;const r=new am((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:qt(Ds(Os({},t.opts),{level:"trace"})),chunkLoggerController:r}}function mm(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?ym(t):wm(t)}var bm=Object.defineProperty,vm=(t,e,r)=>e in t?bm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Th=(t,e,r)=>vm(t,typeof e!="symbol"?e+"":e,r);class Em extends Xr{constructor(e){super(),this.opts=e,Th(this,"protocol","wc"),Th(this,"version",2)}}var xm=Object.defineProperty,_m=(t,e,r)=>e in t?xm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Im=(t,e,r)=>_m(t,typeof e!="symbol"?e+"":e,r);class Sm extends Xr{constructor(e,r){super(),this.core=e,this.logger=r,Im(this,"records",new Map)}}class Am{constructor(e,r){this.logger=e,this.core=r}}class $m extends Xr{constructor(e,r){super(),this.relayer=e,this.logger=r}}class Om extends Xr{constructor(e){super()}}class Dm{constructor(e,r,i,n){this.core=e,this.logger=r,this.name=i}}class Pm extends Xr{constructor(e,r){super(),this.relayer=e,this.logger=r}}class Bm extends Xr{constructor(e,r){super(),this.core=e,this.logger=r}}class Cm{constructor(e,r,i){this.core=e,this.logger=r,this.store=i}}class Tm{constructor(e,r){this.projectId=e,this.logger=r}}class Nm{constructor(e,r,i){this.core=e,this.logger=r,this.telemetryEnabled=i}}var Rm=Object.defineProperty,Um=(t,e,r)=>e in t?Rm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Nh=(t,e,r)=>Um(t,typeof e!="symbol"?e+"":e,r);class Fm{constructor(e){this.opts=e,Nh(this,"protocol","wc"),Nh(this,"version",2)}}class Lm{constructor(e){this.client=e}}function km(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function Rh(t,...e){if(!km(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 Uh(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 jm(t,e){Rh(t);const r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}const $i=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const aa=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);function Mm(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function Fh(t){return typeof t=="string"&&(t=Mm(t)),Rh(t),t}class qm{clone(){return this._cloneInto()}}function zm(t){const e=i=>t().update(Fh(i)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function Lh(t=32){if($i&&typeof $i.getRandomValues=="function")return $i.getRandomValues(new Uint8Array(t));if($i&&typeof $i.randomBytes=="function")return $i.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}function Hm(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 Vm extends qm{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=aa(this.buffer)}update(e){Uh(this);const{view:r,buffer:i,blockLen:n}=this;e=Fh(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=aa(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){Uh(this),jm(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;Hm(i,n-8,BigInt(this.length*8),s),this.process(i,0);const a=aa(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 Bs=BigInt(2**32-1),ca=BigInt(32);function kh(t,e=!1){return e?{h:Number(t&Bs),l:Number(t>>ca&Bs)}:{h:Number(t>>ca&Bs)|0,l:Number(t&Bs)|0}}function Km(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}=kh(t[n],e);[r[n],i[n]]=[s,o]}return[r,i]}const Wm=(t,e)=>BigInt(t>>>0)<<ca|BigInt(e>>>0),Gm=(t,e,r)=>t>>>r,Ym=(t,e,r)=>t<<32-r|e>>>r,Zm=(t,e,r)=>t>>>r|e<<32-r,Jm=(t,e,r)=>t<<32-r|e>>>r,Xm=(t,e,r)=>t<<64-r|e>>>r-32,Qm=(t,e,r)=>t>>>r-32|e<<64-r,e1=(t,e)=>e,t1=(t,e)=>t,r1=(t,e,r)=>t<<r|e>>>32-r,i1=(t,e,r)=>e<<r|t>>>32-r,n1=(t,e,r)=>e<<r-32|t>>>64-r,s1=(t,e,r)=>t<<r-32|e>>>64-r;function o1(t,e,r,i){const n=(e>>>0)+(i>>>0);return{h:t+r+(n/2**32|0)|0,l:n|0}}const a1=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),c1=(t,e,r,i)=>e+r+i+(t/2**32|0)|0,u1=(t,e,r,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(i>>>0),h1=(t,e,r,i,n)=>e+r+i+n+(t/2**32|0)|0,l1=(t,e,r,i,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(i>>>0)+(n>>>0),f1=(t,e,r,i,n,s)=>e+r+i+n+s+(t/2**32|0)|0,Y={fromBig:kh,split:Km,toBig:Wm,shrSH:Gm,shrSL:Ym,rotrSH:Zm,rotrSL:Jm,rotrBH:Xm,rotrBL:Qm,rotr32H:e1,rotr32L:t1,rotlSH:r1,rotlSL:i1,rotlBH:n1,rotlBL:s1,add:o1,add3L:a1,add3H:c1,add4L:u1,add4H:h1,add5H:f1,add5L:l1},[d1,p1]=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))),Er=new Uint32Array(80),xr=new Uint32Array(80);class g1 extends Vm{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)Er[v]=e.getUint32(r),xr[v]=e.getUint32(r+=4);for(let v=16;v<80;v++){const E=Er[v-15]|0,_=xr[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=Er[v-2]|0,b=xr[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),D=Y.add4L(R,$,xr[v-7],xr[v-16]),T=Y.add4H(D,B,C,Er[v-7],Er[v-1