@walletconnect/universal-provider
Version:
Universal Provider for WalletConnect Protocol
14 lines (12 loc) • 515 kB
JavaScript
(function(Wr,Ye){typeof exports=="object"&&typeof module<"u"?Ye(exports):typeof define=="function"&&define.amd?define(["exports"],Ye):(Wr=typeof globalThis<"u"?globalThis:Wr||self,Ye(Wr["@walletconnect/universal-provider"]={}))})(this,function(Wr){"use strict";var Ye=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function gy(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)},ws;xi&&typeof xi.ownKeys=="function"?ws=xi.ownKeys:Object.getOwnPropertySymbols?ws=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:ws=function(e){return Object.getOwnPropertyNames(e)};function yy(t){console&&console.warn&&console.warn(t)}var Yu=Number.isNaN||function(e){return e!==e};function oe(){oe.init.call(this)}Ue.exports=oe,Ue.exports.once=vy,oe.EventEmitter=oe,oe.prototype._events=void 0,oe.prototype._eventsCount=0,oe.prototype._maxListeners=void 0;var Zu=10;function ms(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(oe,"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}}),oe.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},oe.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?oe.defaultMaxListeners:t._maxListeners}oe.prototype.getMaxListeners=function(){return Ju(this)},oe.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(ms(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,yy(a)}return t}oe.prototype.addListener=function(e,r){return Xu(this,e,r,!1)},oe.prototype.on=oe.prototype.addListener,oe.prototype.prependListener=function(e,r){return Xu(this,e,r,!0)};function wy(){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=wy.bind(i);return n.listener=r,i.wrapFn=n,n}oe.prototype.once=function(e,r){return ms(r),this.on(e,Qu(this,e,r)),this},oe.prototype.prependOnceListener=function(e,r){return ms(r),this.prependListener(e,Qu(this,e,r)),this},oe.prototype.removeListener=function(e,r){var i,n,s,o,a;if(ms(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():my(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},oe.prototype.off=oe.prototype.removeListener,oe.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?by(n):rh(n,n.length)}oe.prototype.listeners=function(e){return eh(this,e,!0)},oe.prototype.rawListeners=function(e){return eh(this,e,!1)},oe.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):th.call(t,e)},oe.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}oe.prototype.eventNames=function(){return this._eventsCount>0?ws(this._events):[]};function rh(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function my(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 vy(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"&&Ey(t,n,{once:!0})})}function Ey(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 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 xy(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 _y(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 Iy(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 Sy(t,e){return function(r,i){e(r,i,t)}}function Ay(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Dy(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 $y(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 Oy(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}function Py(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 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 By(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(nh(arguments[e]));return t}function Cy(){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 Ty(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 Ry(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 Ny(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 Uy(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Fy(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 Ly(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 My(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 jy=Object.freeze({__proto__:null,__extends:xy,get __assign(){return Go},__rest:_y,__decorate:Iy,__param:Sy,__metadata:Ay,__awaiter:Dy,__generator:$y,__createBinding:Oy,__exportStar:Py,__values:Yo,__read:nh,__spread:By,__spreadArrays:Cy,__await:cn,__asyncGenerator:Ty,__asyncDelegator:Ry,__asyncValues:Ny,__makeTemplateObject:Uy,__importStar:Fy,__importDefault:Ly,__classPrivateFieldGet:ky,__classPrivateFieldSet:My}),bs=Wu(jy),Zo={},un={},sh;function qy(){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 Gr={},Jo={},Yr={},oh;function zy(){return oh||(oh=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.ONE_THOUSAND=Yr.ONE_HUNDRED=void 0,Yr.ONE_HUNDRED=100,Yr.ONE_THOUSAND=1e3),Yr}var Xo={},ah;function Hy(){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}(Xo)),Xo}var ch;function uh(){return ch||(ch=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=bs;e.__exportStar(zy(),t),e.__exportStar(Hy(),t)}(Jo)),Jo}var hh;function Vy(){if(hh)return Gr;hh=1,Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.fromMiliseconds=Gr.toMiliseconds=void 0;const t=uh();function e(i){return i*t.ONE_THOUSAND}Gr.toMiliseconds=e;function r(i){return Math.floor(i/t.ONE_THOUSAND)}return Gr.fromMiliseconds=r,Gr}var lh;function Ky(){return lh||(lh=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=bs;e.__exportStar(qy(),t),e.__exportStar(Vy(),t)}(Zo)),Zo}var _i={},fh;function Wy(){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 Qo={},hn={},dh;function Gy(){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 Yy(){return ph||(ph=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),bs.__exportStar(Gy(),t)}(Qo)),Qo}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=bs;e.__exportStar(Ky(),t),e.__exportStar(Wy(),t),e.__exportStar(Yy(),t),e.__exportStar(uh(),t)})(j);class Zr{}class Zy extends Zr{constructor(e){super()}}const gh=j.FIVE_SECONDS,Jr={pulse:"heartbeat_pulse"};class ea extends Zy{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 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(),j.toMiliseconds(this.interval))}pulse(){this.events.emit(Jr.pulse)}}const Jy=/"(?:_|\\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*:/,Xy=/"(?: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*:/,Qy=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function ew(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){tw(t);return}return e}function tw(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function vs(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(!Qy.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(Jy.test(t)||Xy.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,ew)}return JSON.parse(t)}catch(i){if(e.strict)throw i;return t}}function rw(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Ee(t,...e){try{return rw(t(...e))}catch(r){return Promise.reject(r)}}function iw(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function nw(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Es(t){if(iw(t))return String(t);if(nw(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Es(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const ta="base64:";function sw(t){return typeof t=="string"?t:ta+cw(t)}function ow(t){return typeof t!="string"||!t.startsWith(ta)?t:aw(t.slice(ta.length))}function aw(t){return globalThis.Buffer?Buffer.from(t,"base64"):Uint8Array.from(globalThis.atob(t),e=>e.codePointAt(0))}function cw(t){return globalThis.Buffer?Buffer.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))}function Ze(t){return t&&t.split("?")[0]?.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,"")||""}function uw(...t){return Ze(t.join(":"))}function xs(t){return t=Ze(t),t?t+":":""}function hw(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 lw(t,e){return e?t.startsWith(e)&&t[t.length-1]!=="$":t[t.length-1]!=="$"}function d5(t){return t}const fw="memory",dw=()=>{const t=new Map;return{name:fw,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 pw(t={}){const e={mounts:{"":t.driver||dw()},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=Ze(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=Ze(g?p:p.key),I=g?void 0:p.value,A=g||!p.options?h:{...h,...p.options},E=r(m);d(E).items.push({key:m,value:I,relativeKey:E.relativeKey,options:A})}return Promise.all([...f.values()].map(p=>l(p))).then(p=>p.flat())},c={hasItem(u,h={}){u=Ze(u);const{relativeKey:l,driver:f}=r(u);return Ee(f.hasItem,l,h)},getItem(u,h={}){u=Ze(u);const{relativeKey:l,driver:f}=r(u);return Ee(f.getItem,l,h).then(d=>vs(d))},getItems(u,h={}){return a(u,h,l=>l.driver.getItems?Ee(l.driver.getItems,l.items.map(f=>({key:f.relativeKey,options:f.options})),h).then(f=>f.map(d=>({key:uw(l.base,d.key),value:vs(d.value)}))):Promise.all(l.items.map(f=>Ee(l.driver.getItem,f.relativeKey,f.options).then(d=>({key:f.key,value:vs(d)})))))},getItemRaw(u,h={}){u=Ze(u);const{relativeKey:l,driver:f}=r(u);return f.getItemRaw?Ee(f.getItemRaw,l,h):Ee(f.getItem,l,h).then(d=>ow(d))},async setItem(u,h,l={}){if(h===void 0)return c.removeItem(u);u=Ze(u);const{relativeKey:f,driver:d}=r(u);d.setItem&&(await Ee(d.setItem,f,Es(h),l),d.watch||n("update",u))},async setItems(u,h){await a(u,h,async l=>{if(l.driver.setItems)return Ee(l.driver.setItems,l.items.map(f=>({key:f.relativeKey,value:Es(f.value),options:f.options})),h);l.driver.setItem&&await Promise.all(l.items.map(f=>Ee(l.driver.setItem,f.relativeKey,Es(f.value),f.options)))})},async setItemRaw(u,h,l={}){if(h===void 0)return c.removeItem(u,l);u=Ze(u);const{relativeKey:f,driver:d}=r(u);if(d.setItemRaw)await Ee(d.setItemRaw,f,h,l);else if(d.setItem)await Ee(d.setItem,f,sw(h),l);else return;d.watch||n("update",u)},async removeItem(u,h={}){typeof h=="boolean"&&(h={removeMeta:h}),u=Ze(u);const{relativeKey:l,driver:f}=r(u);f.removeItem&&(await Ee(f.removeItem,l,h),(h.removeMeta||h.removeMata)&&await Ee(f.removeItem,l+"$",h),f.watch||n("remove",u))},async getMeta(u,h={}){typeof h=="boolean"&&(h={nativeOnly:h}),u=Ze(u);const{relativeKey:l,driver:f}=r(u),d=Object.create(null);if(f.getMeta&&Object.assign(d,await Ee(f.getMeta,l,h)),!h.nativeOnly){const p=await Ee(f.getItem,l+"$",h).then(g=>vs(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=xs(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 Ee(m.driver.getKeys,m.relativeBase,h);for(const A of I){const E=m.mountpoint+Ze(A);f.some(x=>E.startsWith(x))||d.push(E)}f=[m.mountpoint,...f.filter(A=>!A.startsWith(m.mountpoint))]}const g=h.maxDepth!==void 0&&!p;return d.filter(m=>(!g||hw(m,h.maxDepth))&&lw(m,u))},async clear(u,h={}){u=xs(u),await Promise.all(i(u,!1).map(async l=>{if(l.driver.clear)return Ee(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=xs(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=xs(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=Ze(u)+":";const h=r(u);return{driver:h.driver,base:h.base}},getMounts(u="",h={}){return u=Ze(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 Ee(t.dispose)}function Xr(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=Xr(r);return(n,s)=>i.then(o=>s(o.transaction(e,n).objectStore(e)))}let ra;function ln(){return ra||(ra=mh("keyval-store","keyval")),ra}function bh(t,e=ln()){return e("readonly",r=>Xr(r.get(t)))}function gw(t,e,r=ln()){return r("readwrite",i=>(i.put(e,t),Xr(i.transaction)))}function yw(t,e=ln()){return e("readwrite",r=>(r.delete(t),Xr(r.transaction)))}function ww(t=ln()){return t("readwrite",e=>(e.clear(),Xr(e.transaction)))}function mw(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Xr(t.transaction)}function bw(t=ln()){return t("readonly",e=>{if(e.getAllKeys)return Xr(e.getAllKeys());const r=[];return mw(e,i=>r.push(i.key)).then(()=>r)})}const vw=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),Ew=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 Qr(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return Ew(t)}catch{return t}}function rr(t){return typeof t=="string"?t:vw(t)||""}const xw="idb-keyval";var _w=(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:xw,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 gw(r(n),s,i)},removeItem(n){return yw(r(n),i)},getKeys(){return bw(i)},clear(){return ww(i)}}};const Iw="WALLET_CONNECT_V2_INDEXED_DB",Sw="keyvaluestorage";class Aw{constructor(){this.indexedDb=pw({driver:_w({dbName:Iw,storeName:Sw})})}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,rr(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:{},_s={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?_s.exports=ia.localStorage:typeof window<"u"&&window.localStorage?_s.exports=window.localStorage:_s.exports=new e})();function Dw(t){var e;return[t[0],Qr((e=t[1])!=null?e:"")]}class $w{constructor(){this.localStorage=_s.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Dw)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Qr(r)}async setItem(e,r){this.localStorage.setItem(e,rr(r))}async removeItem(e){this.localStorage.removeItem(e)}}const Ow="wc_storage_version",vh=1,Pw=async(t,e,r)=>{const i=Ow,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),Bw(t,o)},Bw=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};class Cw{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new $w;this.storage=e;try{const r=new Aw;Pw(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 Tw(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var Rw=Nw;function Nw(t,e,r){var i=r&&r.stringify||Tw,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=Rw;var jt=qt;const fn=Vw().console||{},Uw={mapHttpRequest:Ss,mapHttpResponse:Ss,wrapRequestSerializer:sa,wrapResponseSerializer:sa,wrapErrorSerializer:sa,req:Ss,res:Ss,err:jw};function Fw(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=Fw(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:qw(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=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,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),A=t.browser.serialize===!0?Object.keys(I):n;delete p.serializers,Is([p],A,I,this._stdErrSerialize)}function E(x){this._childLevel=(x._childLevel|0)+1,this.error=Si(x,p,"error"),this.fatal=Si(x,p,"fatal"),this.warn=Si(x,p,"warn"),this.info=Si(x,p,"info"),this.debug=Si(x,p,"debug"),this.trace=Si(x,p,"trace"),I&&(this.serializers=I,this._serialize=A),e&&(this._logEvent=na([].concat(x._logEvent.bindings,p)))}return E.prototype=this,new E(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=Uw,qt.stdTimeFunctions=Object.assign({},{nullTime:xh,epochTime:_h,unixTime:zw,isoTime:Hw});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,Lw(t,e,r)}function Lw(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&&Is(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;Mw(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&&Is(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 Is(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 Mw(t,e,r){const i=e.send,n=e.ts,s=e.methodLevel,o=e.methodValue,a=e.val,c=t._logEvent.bindings;Is(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 jw(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 qw(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?xh:_h}function Ss(){return{}}function sa(t){return t}function dn(){}function xh(){return!1}function _h(){return Date.now()}function zw(){return Math.round(Date.now()/1e3)}function Hw(){return new Date(Date.now()).toISOString()}function Vw(){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 Kw={level:"info"},pn="custom_context",oa=1e3*1024;class Ww{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 Ww(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=oa){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(rr({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(rr({extraMetadata:e})),new Blob(r,{type:"application/json"})}}class Gw{constructor(e,r=oa){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 Yw{constructor(e,r=oa){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 Zw=Object.defineProperty,Jw=Object.defineProperties,Xw=Object.getOwnPropertyDescriptors,Ah=Object.getOwnPropertySymbols,Qw=Object.prototype.hasOwnProperty,em=Object.prototype.propertyIsEnumerable,Dh=(t,e,r)=>e in t?Zw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,As=(t,e)=>{for(var r in e||(e={}))Qw.call(e,r)&&Dh(t,r,e[r]);if(Ah)for(var r of Ah(e))em.call(e,r)&&Dh(t,r,e[r]);return t},Ds=(t,e)=>Jw(t,Xw(e));function $s(t){return Ds(As({},t),{level:t?.level||Kw.level})}function tm(t,e=pn){return t[e]||""}function rm(t,e,r=pn){return t[r]=e,t}function Je(t,e=pn){let r="";return typeof t.bindings>"u"?r=tm(t,e):r=t.bindings().context||"",r}function im(t,e,r=pn){const i=Je(t,r);return i.trim()?`${i}/${e}`:e}function ze(t,e,r=pn){const i=im(t,e,r),n=t.child({context:i});return rm(n,i,r)}function nm(t){var e,r;const i=new Gw((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:jt(Ds(As({},t.opts),{level:"trace",browser:Ds(As({},(r=t.opts)==null?void 0:r.browser),{write:n=>i.write(n)})})),chunkLoggerController:i}}function sm(t){var e;const r=new Yw((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:jt(Ds(As({},t.opts),{level:"trace"})),chunkLoggerController:r}}function om(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?nm(t):sm(t)}var am=Object.defineProperty,cm=(t,e,r)=>e in t?am(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$h=(t,e,r)=>cm(t,typeof e!="symbol"?e+"":e,r);class um extends Zr{constructor(e){super(),this.opts=e,$h(this,"protocol","wc"),$h(this,"version",2)}}var hm=Object.defineProperty,lm=(t,e,r)=>e in t?hm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fm=(t,e,r)=>lm(t,typeof e!="symbol"?e+"":e,r);class dm extends Zr{constructor(e,r){super(),this.core=e,this.logger=r,fm(this,"records",new Map)}}class pm{constructor(e,r){this.logger=e,this.core=r}}class gm extends Zr{constructor(e,r){super(),this.relayer=e,this.logger=r}}class ym extends Zr{constructor(e){super()}}class wm{constructor(e,r,i,n){this.core=e,this.logger=r,this.name=i}}class mm extends Zr{constructor(e,r){super(),this.relayer=e,this.logger=r}}class bm extends Zr{constructor(e,r){super(),this.core=e,this.logger=r}}class vm{constructor(e,r,i){this.core=e,this.logger=r,this.store=i}}class Em{constructor(e,r){this.projectId=e,this.logger=r}}class xm{constructor(e,r,i){this.core=e,this.logger=r,this.telemetryEnabled=i}}var _m=Object.defineProperty,Im=(t,e,r)=>e in t?_m(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Oh=(t,e,r)=>Im(t,typeof e!="symbol"?e+"":e,r);class Sm{constructor(e){this.opts=e,Oh(this,"protocol","wc"),Oh(this,"version",2)}}class Am{constructor(e){this.client=e}}function Dm(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function Ph(t,...e){if(!Dm(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 $m(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 aa=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);function Om(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=Om(t)),Ph(t),t}class Pm{clone(){return this._cloneInto()}}function Bm(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 Cm(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 Tm extends Pm{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){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=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){Bh(this),$m(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;Cm(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 Os=BigInt(2**32-1),ca=BigInt(32);function Rh(t,e=!1){return e?{h:Number(t&Os),l:Number(t>>ca&Os)}:{h:Number(t>>ca&Os)|0,l:Number(t&Os)|0}}function Rm(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}=Rh(t[n],e);[r[n],i[n]]=[s,o]}return[r,i]}const Nm=(t,e)=>BigInt(t>>>0)<<ca|BigInt(e>>>0),Um=(t,e,r)=>t>>>r,Fm=(t,e,r)=>t<<32-r|e>>>r,Lm=(t,e,r)=>t>>>r|e<<32-r,km=(t,e,r)=>t<<32-r|e>>>r,Mm=(t,e,r)=>t<<64-r|e>>>r-32,jm=(t,e,r)=>t>>>r-32|e<<64-r,qm=(t,e)=>e,zm=(t,e)=>t,Hm=(t,e,r)=>t<<r|e>>>32-r,Vm=(t,e,r)=>e<<r|t>>>32-r,Km=(t,e,r)=>e<<r-32|t>>>64-r,Wm=(t,e,r)=>t<<r-32|e>>>64-r;function Gm(t,e,r,i){const n=(e>>>0)+(i>>>0);return{h:t+r+(n/2**32|0)|0,l:n|0}}const Ym=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),Zm=(t,e,r,i)=>e+r+i+(t/2**32|0)|0,Jm=(t,e,r,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(i>>>0),Xm=(t,e,r,i,n)=>e+r+i+n+(t/2**32|0)|0,Qm=(t,e,r,i,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(i>>>0)+(n>>>0),e1=(t,e,r,i,n,s)=>e+r+i+n+s+(t/2**32|0)|0,Y={fromBig:Rh,split:Rm,toBig:Nm,shrSH:Um,shrSL:Fm,rotrSH:Lm,rotrSL:km,rotrBH:Mm,rotrBL:jm,rotr32H:qm,rotr32L:zm,rotlSH:Hm,rotlSL:Vm,rotlBH:Km,rotlBL:Wm,add:Gm,add3L:Ym,add3H:Zm,add4L:Jm,add4H:Xm,add5H:e1,add5L:Qm},[t1,r1]=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))),mr=new Uint32Array(80),br=new Uint32Array(80);class i1 extends Tm{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 E=0;E<16;E++,r+=4)mr[E]=e.getUint32(r),br[E]=e.getUint32(r+=4);for(let E=16;E<80;E++){const x=mr[E-15]|0,_=br[E-15]|0,T=Y.rotrSH(x,_,1)^Y.rotrSH(x,_,8)^Y.shrSH(x,_,7),N=Y.rotrSL(x,_,1)^Y.rotrSL(x,_,8)^Y.shrSL(x,_,7),R=mr[E-2]|0,b=br[E-2]|0,C=Y.rotrSH(R,b,19)^Y.rotrBH(R,b,61)^Y.shrSH(R,b,6),$=Y.rotrSL(R,b,19)^Y.rotrBL(R,b,61)^Y.shrSL(R,b,6),O=Y.add4L(N,$,br[E-7],br[E-16]),B=Y.add4H(O,T,C,mr[E-7],mr[E-1