UNPKG

@walletconnect/core

Version:
14 lines (12 loc) 412 kB
(function(K,Tt){typeof exports=="object"&&typeof module<"u"?Tt(exports):typeof define=="function"&&define.amd?define(["exports"],Tt):(K=typeof globalThis<"u"?globalThis:K||self,Tt(K["@walletconnect/core"]={}))})(this,function(K){"use strict";var Tt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function rf(e){var t=e.default;if(typeof t=="function"){var r=function(){return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var lt={exports:{}},cn=typeof Reflect=="object"?Reflect:null,nf=cn&&typeof cn.apply=="function"?cn.apply:function(t,r,n){return Function.prototype.apply.call(t,r,n)},ji;cn&&typeof cn.ownKeys=="function"?ji=cn.ownKeys:Object.getOwnPropertySymbols?ji=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:ji=function(t){return Object.getOwnPropertyNames(t)};function yp(e){console&&console.warn&&console.warn(e)}var sf=Number.isNaN||function(t){return t!==t};function ae(){ae.init.call(this)}lt.exports=ae,lt.exports.once=vp,ae.EventEmitter=ae,ae.prototype._events=void 0,ae.prototype._eventsCount=0,ae.prototype._maxListeners=void 0;var of=10;function Mi(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(ae,"defaultMaxListeners",{enumerable:!0,get:function(){return of},set:function(e){if(typeof e!="number"||e<0||sf(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");of=e}}),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(t){if(typeof t!="number"||t<0||sf(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function af(e){return e._maxListeners===void 0?ae.defaultMaxListeners:e._maxListeners}ae.prototype.getMaxListeners=function(){return af(this)},ae.prototype.emit=function(t){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=t==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){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[t];if(c===void 0)return!1;if(typeof c=="function")nf(c,this,r);else for(var f=c.length,u=hf(c,f),n=0;n<f;++n)nf(u[n],this,r);return!0};function cf(e,t,r,n){var i,s,o;if(Mi(r),s=e._events,s===void 0?(s=e._events=Object.create(null),e._eventsCount=0):(s.newListener!==void 0&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),o===void 0)o=s[t]=r,++e._eventsCount;else if(typeof o=="function"?o=s[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=af(e),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=o.length,yp(a)}return e}ae.prototype.addListener=function(t,r){return cf(this,t,r,!1)},ae.prototype.on=ae.prototype.addListener,ae.prototype.prependListener=function(t,r){return cf(this,t,r,!0)};function mp(){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 ff(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=mp.bind(n);return i.listener=r,n.wrapFn=i,i}ae.prototype.once=function(t,r){return Mi(r),this.on(t,ff(this,t,r)),this},ae.prototype.prependOnceListener=function(t,r){return Mi(r),this.prependListener(t,ff(this,t,r)),this},ae.prototype.removeListener=function(t,r){var n,i,s,o,a;if(Mi(r),i=this._events,i===void 0)return this;if(n=i[t],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():wp(n,s),n.length===1&&(i[t]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",t,a||r)}return this},ae.prototype.off=ae.prototype.removeListener,ae.prototype.removeAllListeners=function(t){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[t]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[t],typeof r=="function")this.removeListener(t,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(t,r[i]);return this};function uf(e,t,r){var n=e._events;if(n===void 0)return[];var i=n[t];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?Ep(i):hf(i,i.length)}ae.prototype.listeners=function(t){return uf(this,t,!0)},ae.prototype.rawListeners=function(t){return uf(this,t,!1)},ae.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):lf.call(e,t)},ae.prototype.listenerCount=lf;function lf(e){var t=this._events;if(t!==void 0){var r=t[e];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}ae.prototype.eventNames=function(){return this._eventsCount>0?ji(this._events):[]};function hf(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function wp(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function Ep(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function vp(e,t){return new Promise(function(r,n){function i(o){e.removeListener(t,s),n(o)}function s(){typeof e.removeListener=="function"&&e.removeListener("error",i),r([].slice.call(arguments))}df(e,t,s,{once:!0}),t!=="error"&&_p(e,i,{once:!0})})}function _p(e,t,r){typeof e.on=="function"&&df(e,"error",t,r)}function df(e,t,r,n){if(typeof e.on=="function")n.once?e.once(t,r):e.on(t,r);else if(typeof e.addEventListener=="function")e.addEventListener(t,function i(s){n.once&&e.removeEventListener(t,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}var W={};/*! ***************************************************************************** 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 fo=function(e,t){return fo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},fo(e,t)};function xp(e,t){fo(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var uo=function(){return uo=Object.assign||function(t){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},uo.apply(this,arguments)};function Sp(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function Ip(e,t,r,n){var i=arguments.length,s=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s}function Op(e,t){return function(r,n){t(r,n,e)}}function Bp(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function Dp(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(u){try{f(n.next(u))}catch(d){o(d)}}function c(u){try{f(n.throw(u))}catch(d){o(d)}}function f(u){u.done?s(u.value):i(u.value).then(a,c)}f((n=n.apply(e,t||[])).next())})}function Ap(e,t){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,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(f){return function(u){return c([f,u])}}function c(f){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=f[0]&2?i.return:f[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,f[1])).done)return s;switch(i=0,s&&(f=[f[0]&2,s.value]),f[0]){case 0:case 1:s=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,i=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){r.label=f[1];break}if(f[0]===6&&r.label<s[1]){r.label=s[1],s=f;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(f);break}s[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(u){f=[6,u],i=0}finally{n=s=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function Tp(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}function Rp(e,t){for(var r in e)r!=="default"&&!t.hasOwnProperty(r)&&(t[r]=e[r])}function lo(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function gf(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,s=[],o;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function Np(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(gf(arguments[t]));return e}function Cp(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),i=0,t=0;t<r;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function Vn(e){return this instanceof Vn?(this.v=e,this):new Vn(e)}function Pp(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(h){n[h]&&(i[h]=function(l){return new Promise(function(b,m){s.push([h,l,b,m])>1||a(h,l)})})}function a(h,l){try{c(n[h](l))}catch(b){d(s[0][3],b)}}function c(h){h.value instanceof Vn?Promise.resolve(h.value.v).then(f,u):d(s[0][2],h)}function f(h){a("next",h)}function u(h){a("throw",h)}function d(h,l){h(l),s.shift(),s.length&&a(s[0][0],s[0][1])}}function $p(e){var t,r;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,s){t[i]=e[i]?function(o){return(r=!r)?{value:Vn(e[i](o)),done:i==="return"}:s?s(o):o}:s}}function Lp(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof lo=="function"?lo(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=e[s]&&function(o){return new Promise(function(a,c){o=e[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(f){s({value:f,done:a})},o)}}function Up(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function Fp(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function jp(e){return e&&e.__esModule?e:{default:e}}function Mp(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function kp(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r}var zp=Object.freeze({__proto__:null,__extends:xp,get __assign(){return uo},__rest:Sp,__decorate:Ip,__param:Op,__metadata:Bp,__awaiter:Dp,__generator:Ap,__createBinding:Tp,__exportStar:Rp,__values:lo,__read:gf,__spread:Np,__spreadArrays:Cp,__await:Vn,__asyncGenerator:Pp,__asyncDelegator:$p,__asyncValues:Lp,__makeTemplateObject:Up,__importStar:Fp,__importDefault:jp,__classPrivateFieldGet:Mp,__classPrivateFieldSet:kp}),ki=rf(zp),ho={},Gn={},pf;function qp(){if(pf)return Gn;pf=1,Object.defineProperty(Gn,"__esModule",{value:!0}),Gn.delay=void 0;function e(t){return new Promise(r=>{setTimeout(()=>{r(!0)},t)})}return Gn.delay=e,Gn}var Fr={},go={},jr={},bf;function Hp(){return bf||(bf=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 po={},yf;function Kp(){return yf||(yf=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ONE_YEAR=e.FOUR_WEEKS=e.THREE_WEEKS=e.TWO_WEEKS=e.ONE_WEEK=e.THIRTY_DAYS=e.SEVEN_DAYS=e.FIVE_DAYS=e.THREE_DAYS=e.ONE_DAY=e.TWENTY_FOUR_HOURS=e.TWELVE_HOURS=e.SIX_HOURS=e.THREE_HOURS=e.ONE_HOUR=e.SIXTY_MINUTES=e.THIRTY_MINUTES=e.TEN_MINUTES=e.FIVE_MINUTES=e.ONE_MINUTE=e.SIXTY_SECONDS=e.THIRTY_SECONDS=e.TEN_SECONDS=e.FIVE_SECONDS=e.ONE_SECOND=void 0,e.ONE_SECOND=1,e.FIVE_SECONDS=5,e.TEN_SECONDS=10,e.THIRTY_SECONDS=30,e.SIXTY_SECONDS=60,e.ONE_MINUTE=e.SIXTY_SECONDS,e.FIVE_MINUTES=e.ONE_MINUTE*5,e.TEN_MINUTES=e.ONE_MINUTE*10,e.THIRTY_MINUTES=e.ONE_MINUTE*30,e.SIXTY_MINUTES=e.ONE_MINUTE*60,e.ONE_HOUR=e.SIXTY_MINUTES,e.THREE_HOURS=e.ONE_HOUR*3,e.SIX_HOURS=e.ONE_HOUR*6,e.TWELVE_HOURS=e.ONE_HOUR*12,e.TWENTY_FOUR_HOURS=e.ONE_HOUR*24,e.ONE_DAY=e.TWENTY_FOUR_HOURS,e.THREE_DAYS=e.ONE_DAY*3,e.FIVE_DAYS=e.ONE_DAY*5,e.SEVEN_DAYS=e.ONE_DAY*7,e.THIRTY_DAYS=e.ONE_DAY*30,e.ONE_WEEK=e.SEVEN_DAYS,e.TWO_WEEKS=e.ONE_WEEK*2,e.THREE_WEEKS=e.ONE_WEEK*3,e.FOUR_WEEKS=e.ONE_WEEK*4,e.ONE_YEAR=e.ONE_DAY*365}(po)),po}var mf;function wf(){return mf||(mf=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=ki;t.__exportStar(Hp(),e),t.__exportStar(Kp(),e)}(go)),go}var Ef;function Vp(){if(Ef)return Fr;Ef=1,Object.defineProperty(Fr,"__esModule",{value:!0}),Fr.fromMiliseconds=Fr.toMiliseconds=void 0;const e=wf();function t(n){return n*e.ONE_THOUSAND}Fr.toMiliseconds=t;function r(n){return Math.floor(n/e.ONE_THOUSAND)}return Fr.fromMiliseconds=r,Fr}var vf;function Gp(){return vf||(vf=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=ki;t.__exportStar(qp(),e),t.__exportStar(Vp(),e)}(ho)),ho}var fn={},_f;function Zp(){if(_f)return fn;_f=1,Object.defineProperty(fn,"__esModule",{value:!0}),fn.Watch=void 0;class e{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 n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return fn.Watch=e,fn.default=e,fn}var bo={},Zn={},xf;function Yp(){if(xf)return Zn;xf=1,Object.defineProperty(Zn,"__esModule",{value:!0}),Zn.IWatch=void 0;class e{}return Zn.IWatch=e,Zn}var Sf;function Wp(){return Sf||(Sf=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),ki.__exportStar(Yp(),e)}(bo)),bo}(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=ki;t.__exportStar(Gp(),e),t.__exportStar(Zp(),e),t.__exportStar(Wp(),e),t.__exportStar(wf(),e)})(W);class Mr{}class Xp extends Mr{constructor(t){super()}}const If=W.FIVE_SECONDS,kr={pulse:"heartbeat_pulse"};class yo extends Xp{constructor(t){super(t),this.events=new lt.exports.EventEmitter,this.interval=If,this.interval=t?.interval||If}static async init(t){const r=new yo(t);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}off(t,r){this.events.off(t,r)}removeListener(t,r){this.events.removeListener(t,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),W.toMiliseconds(this.interval))}pulse(){this.events.emit(kr.pulse)}}const Jp=/"(?:_|\\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*:/,Qp=/"(?: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*:/,e1=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function t1(e,t){if(e==="__proto__"||e==="constructor"&&t&&typeof t=="object"&&"prototype"in t){r1(e);return}return t}function r1(e){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`)}function zi(e,t={}){if(typeof e!="string")return e;if(e[0]==='"'&&e[e.length-1]==='"'&&e.indexOf("\\")===-1)return e.slice(1,-1);const r=e.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(!e1.test(e)){if(t.strict)throw new SyntaxError("[destr] Invalid JSON");return e}try{if(Jp.test(e)||Qp.test(e)){if(t.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(e,t1)}return JSON.parse(e)}catch(n){if(t.strict)throw n;return e}}function n1(e){return!e||typeof e.then!="function"?Promise.resolve(e):e}function ve(e,...t){try{return n1(e(...t))}catch(r){return Promise.reject(r)}}function i1(e){const t=typeof e;return e===null||t!=="object"&&t!=="function"}function s1(e){const t=Object.getPrototypeOf(e);return!t||t.isPrototypeOf(Object)}function qi(e){if(i1(e))return String(e);if(s1(e)||Array.isArray(e))return JSON.stringify(e);if(typeof e.toJSON=="function")return qi(e.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const mo="base64:";function o1(e){return typeof e=="string"?e:mo+f1(e)}function a1(e){return typeof e!="string"||!e.startsWith(mo)?e:c1(e.slice(mo.length))}function c1(e){return globalThis.Buffer?Buffer.from(e,"base64"):Uint8Array.from(globalThis.atob(e),t=>t.codePointAt(0))}function f1(e){return globalThis.Buffer?Buffer.from(e).toString("base64"):globalThis.btoa(String.fromCodePoint(...e))}function Ve(e){return e&&e.split("?")[0]?.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,"")||""}function u1(...e){return Ve(e.join(":"))}function Hi(e){return e=Ve(e),e?e+":":""}function l1(e,t){if(t===void 0)return!0;let r=0,n=e.indexOf(":");for(;n>-1;)r++,n=e.indexOf(":",n+1);return r<=t}function h1(e,t){return t?e.startsWith(t)&&e[e.length-1]!=="$":e[e.length-1]!=="$"}function Fx(e){return e}const d1="memory",g1=()=>{const e=new Map;return{name:d1,getInstance:()=>e,hasItem(t){return e.has(t)},getItem(t){return e.get(t)??null},getItemRaw(t){return e.get(t)??null},setItem(t,r){e.set(t,r)},setItemRaw(t,r){e.set(t,r)},removeItem(t){e.delete(t)},getKeys(){return[...e.keys()]},clear(){e.clear()},dispose(){e.clear()}}};function p1(e={}){const t={mounts:{"":e.driver||g1()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=f=>{for(const u of t.mountpoints)if(f.startsWith(u))return{base:u,relativeKey:f.slice(u.length),driver:t.mounts[u]};return{base:"",relativeKey:f,driver:t.mounts[""]}},n=(f,u)=>t.mountpoints.filter(d=>d.startsWith(f)||u&&f.startsWith(d)).map(d=>({relativeBase:f.length>d.length?f.slice(d.length):void 0,mountpoint:d,driver:t.mounts[d]})),i=(f,u)=>{if(t.watching){u=Ve(u);for(const d of t.watchListeners)d(f,u)}},s=async()=>{if(!t.watching){t.watching=!0;for(const f in t.mounts)t.unwatch[f]=await Of(t.mounts[f],i,f)}},o=async()=>{if(t.watching){for(const f in t.unwatch)await t.unwatch[f]();t.unwatch={},t.watching=!1}},a=(f,u,d)=>{const h=new Map,l=b=>{let m=h.get(b.base);return m||(m={driver:b.driver,base:b.base,items:[]},h.set(b.base,m)),m};for(const b of f){const m=typeof b=="string",v=Ve(m?b:b.key),D=m?void 0:b.value,P=m||!b.options?u:{...u,...b.options},S=r(v);l(S).items.push({key:v,value:D,relativeKey:S.relativeKey,options:P})}return Promise.all([...h.values()].map(b=>d(b))).then(b=>b.flat())},c={hasItem(f,u={}){f=Ve(f);const{relativeKey:d,driver:h}=r(f);return ve(h.hasItem,d,u)},getItem(f,u={}){f=Ve(f);const{relativeKey:d,driver:h}=r(f);return ve(h.getItem,d,u).then(l=>zi(l))},getItems(f,u={}){return a(f,u,d=>d.driver.getItems?ve(d.driver.getItems,d.items.map(h=>({key:h.relativeKey,options:h.options})),u).then(h=>h.map(l=>({key:u1(d.base,l.key),value:zi(l.value)}))):Promise.all(d.items.map(h=>ve(d.driver.getItem,h.relativeKey,h.options).then(l=>({key:h.key,value:zi(l)})))))},getItemRaw(f,u={}){f=Ve(f);const{relativeKey:d,driver:h}=r(f);return h.getItemRaw?ve(h.getItemRaw,d,u):ve(h.getItem,d,u).then(l=>a1(l))},async setItem(f,u,d={}){if(u===void 0)return c.removeItem(f);f=Ve(f);const{relativeKey:h,driver:l}=r(f);l.setItem&&(await ve(l.setItem,h,qi(u),d),l.watch||i("update",f))},async setItems(f,u){await a(f,u,async d=>{if(d.driver.setItems)return ve(d.driver.setItems,d.items.map(h=>({key:h.relativeKey,value:qi(h.value),options:h.options})),u);d.driver.setItem&&await Promise.all(d.items.map(h=>ve(d.driver.setItem,h.relativeKey,qi(h.value),h.options)))})},async setItemRaw(f,u,d={}){if(u===void 0)return c.removeItem(f,d);f=Ve(f);const{relativeKey:h,driver:l}=r(f);if(l.setItemRaw)await ve(l.setItemRaw,h,u,d);else if(l.setItem)await ve(l.setItem,h,o1(u),d);else return;l.watch||i("update",f)},async removeItem(f,u={}){typeof u=="boolean"&&(u={removeMeta:u}),f=Ve(f);const{relativeKey:d,driver:h}=r(f);h.removeItem&&(await ve(h.removeItem,d,u),(u.removeMeta||u.removeMata)&&await ve(h.removeItem,d+"$",u),h.watch||i("remove",f))},async getMeta(f,u={}){typeof u=="boolean"&&(u={nativeOnly:u}),f=Ve(f);const{relativeKey:d,driver:h}=r(f),l=Object.create(null);if(h.getMeta&&Object.assign(l,await ve(h.getMeta,d,u)),!u.nativeOnly){const b=await ve(h.getItem,d+"$",u).then(m=>zi(m));b&&typeof b=="object"&&(typeof b.atime=="string"&&(b.atime=new Date(b.atime)),typeof b.mtime=="string"&&(b.mtime=new Date(b.mtime)),Object.assign(l,b))}return l},setMeta(f,u,d={}){return this.setItem(f+"$",u,d)},removeMeta(f,u={}){return this.removeItem(f+"$",u)},async getKeys(f,u={}){f=Hi(f);const d=n(f,!0);let h=[];const l=[];let b=!0;for(const v of d){v.driver.flags?.maxDepth||(b=!1);const D=await ve(v.driver.getKeys,v.relativeBase,u);for(const P of D){const S=v.mountpoint+Ve(P);h.some(_=>S.startsWith(_))||l.push(S)}h=[v.mountpoint,...h.filter(P=>!P.startsWith(v.mountpoint))]}const m=u.maxDepth!==void 0&&!b;return l.filter(v=>(!m||l1(v,u.maxDepth))&&h1(v,f))},async clear(f,u={}){f=Hi(f),await Promise.all(n(f,!1).map(async d=>{if(d.driver.clear)return ve(d.driver.clear,d.relativeBase,u);if(d.driver.removeItem){const h=await d.driver.getKeys(d.relativeBase||"",u);return Promise.all(h.map(l=>d.driver.removeItem(l,u)))}}))},async dispose(){await Promise.all(Object.values(t.mounts).map(f=>Bf(f)))},async watch(f){return await s(),t.watchListeners.push(f),async()=>{t.watchListeners=t.watchListeners.filter(u=>u!==f),t.watchListeners.length===0&&await o()}},async unwatch(){t.watchListeners=[],await o()},mount(f,u){if(f=Hi(f),f&&t.mounts[f])throw new Error(`already mounted at ${f}`);return f&&(t.mountpoints.push(f),t.mountpoints.sort((d,h)=>h.length-d.length)),t.mounts[f]=u,t.watching&&Promise.resolve(Of(u,i,f)).then(d=>{t.unwatch[f]=d}).catch(console.error),c},async unmount(f,u=!0){f=Hi(f),!(!f||!t.mounts[f])&&(t.watching&&f in t.unwatch&&(t.unwatch[f]?.(),delete t.unwatch[f]),u&&await Bf(t.mounts[f]),t.mountpoints=t.mountpoints.filter(d=>d!==f),delete t.mounts[f])},getMount(f=""){f=Ve(f)+":";const u=r(f);return{driver:u.driver,base:u.base}},getMounts(f="",u={}){return f=Ve(f),n(f,u.parents).map(h=>({driver:h.driver,base:h.mountpoint}))},keys:(f,u={})=>c.getKeys(f,u),get:(f,u={})=>c.getItem(f,u),set:(f,u,d={})=>c.setItem(f,u,d),has:(f,u={})=>c.hasItem(f,u),del:(f,u={})=>c.removeItem(f,u),remove:(f,u={})=>c.removeItem(f,u)};return c}function Of(e,t,r){return e.watch?e.watch((n,i)=>t(n,r+i)):()=>{}}async function Bf(e){typeof e.dispose=="function"&&await ve(e.dispose)}function zr(e){return new Promise((t,r)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>r(e.error)})}function Df(e,t){const r=indexedDB.open(e);r.onupgradeneeded=()=>r.result.createObjectStore(t);const n=zr(r);return(i,s)=>n.then(o=>s(o.transaction(t,i).objectStore(t)))}let wo;function Yn(){return wo||(wo=Df("keyval-store","keyval")),wo}function Af(e,t=Yn()){return t("readonly",r=>zr(r.get(e)))}function b1(e,t,r=Yn()){return r("readwrite",n=>(n.put(t,e),zr(n.transaction)))}function y1(e,t=Yn()){return t("readwrite",r=>(r.delete(e),zr(r.transaction)))}function m1(e=Yn()){return e("readwrite",t=>(t.clear(),zr(t.transaction)))}function w1(e,t){return e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},zr(e.transaction)}function E1(e=Yn()){return e("readonly",t=>{if(t.getAllKeys)return zr(t.getAllKeys());const r=[];return w1(t,n=>r.push(n.key)).then(()=>r)})}const v1=e=>JSON.stringify(e,(t,r)=>typeof r=="bigint"?r.toString()+"n":r),_1=e=>{const t=/([\[:])?(\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=e.replace(t,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function un(e){if(typeof e!="string")throw new Error(`Cannot safe json parse value of type ${typeof e}`);try{return _1(e)}catch{return e}}function Wn(e){return typeof e=="string"?e:v1(e)||""}const x1="idb-keyval";var S1=(e={})=>{const t=e.base&&e.base.length>0?`${e.base}:`:"",r=i=>t+i;let n;return e.dbName&&e.storeName&&(n=Df(e.dbName,e.storeName)),{name:x1,options:e,async hasItem(i){return!(typeof await Af(r(i),n)>"u")},async getItem(i){return await Af(r(i),n)??null},setItem(i,s){return b1(r(i),s,n)},removeItem(i){return y1(r(i),n)},getKeys(){return E1(n)},clear(){return m1(n)}}};const I1="WALLET_CONNECT_V2_INDEXED_DB",O1="keyvaluestorage";class B1{constructor(){this.indexedDb=p1({driver:S1({dbName:I1,storeName:O1})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(t=>[t.key,t.value])}async getItem(t){const r=await this.indexedDb.getItem(t);if(r!==null)return r}async setItem(t,r){await this.indexedDb.setItem(t,Wn(r))}async removeItem(t){await this.indexedDb.removeItem(t)}}var Eo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ki={exports:{}};(function(){let e;function t(){}e=t,e.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},e.prototype.setItem=function(r,n){this[r]=String(n)},e.prototype.removeItem=function(r){delete this[r]},e.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},e.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},e.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Eo<"u"&&Eo.localStorage?Ki.exports=Eo.localStorage:typeof window<"u"&&window.localStorage?Ki.exports=window.localStorage:Ki.exports=new t})();function D1(e){var t;return[e[0],un((t=e[1])!=null?t:"")]}class A1{constructor(){this.localStorage=Ki.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(D1)}async getItem(t){const r=this.localStorage.getItem(t);if(r!==null)return un(r)}async setItem(t,r){this.localStorage.setItem(t,Wn(r))}async removeItem(t){this.localStorage.removeItem(t)}}const T1="wc_storage_version",Tf=1,R1=async(e,t,r)=>{const n=T1,i=await t.getItem(n);if(i&&i>=Tf){r(t);return}const s=await e.getKeys();if(!s.length){r(t);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 f=await e.getItem(a);await t.setItem(a,f),o.push(a)}}await t.setItem(n,Tf),r(t),N1(e,o)},N1=async(e,t)=>{t.length&&t.forEach(async r=>{await e.removeItem(r)})};class C1{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const t=new A1;this.storage=t;try{const r=new B1;R1(t,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(t){return await this.initialize(),this.storage.getItem(t)}async setItem(t,r){return await this.initialize(),this.storage.setItem(t,r)}async removeItem(t){return await this.initialize(),this.storage.removeItem(t)}async initialize(){this.initialized||await new Promise(t=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),t())},20)})}}var Rt={exports:{}};function P1(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}var $1=L1;function L1(e,t,r){var n=r&&r.stringify||P1,i=1;if(typeof e=="object"&&e!==null){var s=t.length+i;if(s===1)return e;var o=new Array(s);o[0]=n(e);for(var a=1;a<s;a++)o[a]=n(t[a]);return o.join(" ")}if(typeof e!="string")return e;var c=t.length;if(c===0)return e;for(var f="",u=1-i,d=-1,h=e&&e.length||0,l=0;l<h;){if(e.charCodeAt(l)===37&&l+1<h){switch(d=d>-1?d:0,e.charCodeAt(l+1)){case 100:case 102:if(u>=c||t[u]==null)break;d<l&&(f+=e.slice(d,l)),f+=Number(t[u]),d=l+2,l++;break;case 105:if(u>=c||t[u]==null)break;d<l&&(f+=e.slice(d,l)),f+=Math.floor(Number(t[u])),d=l+2,l++;break;case 79:case 111:case 106:if(u>=c||t[u]===void 0)break;d<l&&(f+=e.slice(d,l));var b=typeof t[u];if(b==="string"){f+="'"+t[u]+"'",d=l+2,l++;break}if(b==="function"){f+=t[u].name||"<anonymous>",d=l+2,l++;break}f+=n(t[u]),d=l+2,l++;break;case 115:if(u>=c)break;d<l&&(f+=e.slice(d,l)),f+=String(t[u]),d=l+2,l++;break;case 37:d<l&&(f+=e.slice(d,l)),f+="%",d=l+2,l++,u--;break}++u}++l}return d===-1?e:(d<h&&(f+=e.slice(d)),f)}const Rf=$1;Rt.exports=jt;const Xn=X1().console||{},U1={mapHttpRequest:Vi,mapHttpResponse:Vi,wrapRequestSerializer:Io,wrapResponseSerializer:Io,wrapErrorSerializer:Io,req:Vi,res:Vi,err:Cf,errWithCause:Cf};function fr(e,t){return e==="silent"?1/0:t.levels.values[e]}const vo=Symbol("pino.logFuncs"),_o=Symbol("pino.hierarchy"),F1={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function Nf(e,t){const r={logger:t,parent:e[_o]};t[_o]=r}function j1(e,t,r){const n={};t.forEach(i=>{n[i]=r[i]?r[i]:Xn[i]||Xn[F1[i]||"log"]||ln}),e[vo]=n}function M1(e,t){return Array.isArray(e)?e.filter(function(r){return r!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function jt(e){e=e||{},e.browser=e.browser||{};const t=e.browser.transmit;if(t&&typeof t.send!="function")throw Error("pino: transmit option must have a send function");const r=e.browser.write||Xn;e.browser.write&&(e.browser.asObject=!0);const n=e.serializers||{},i=M1(e.browser.serialize,n);let s=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const o=Object.keys(e.customLevels||{}),a=["error","fatal","warn","info","debug","trace"].concat(o);typeof r=="function"&&a.forEach(function(m){r[m]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");const c=e.level||"info",f=Object.create(r);f.log||(f.log=ln),j1(f,a,r),Nf({},f),Object.defineProperty(f,"levelVal",{get:d}),Object.defineProperty(f,"level",{get:h,set:l});const u={transmit:t,serialize:i,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:a,timestamp:Z1(e),messageKey:e.messageKey||"msg",onChild:e.onChild||ln};f.levels=k1(e),f.level=c,f.isLevelEnabled=function(m){return this.levels.values[m]?this.levels.values[m]>=this.levels.values[this.level]:!1},f.setMaxListeners=f.getMaxListeners=f.emit=f.addListener=f.on=f.prependListener=f.once=f.prependOnceListener=f.removeListener=f.removeAllListeners=f.listeners=f.listenerCount=f.eventNames=f.write=f.flush=ln,f.serializers=n,f._serialize=i,f._stdErrSerialize=s,f.child=function(...m){return b.call(this,u,...m)},t&&(f._logEvent=So());function d(){return fr(this.level,this)}function h(){return this._level}function l(m){if(m!=="silent"&&!this.levels.values[m])throw Error("unknown level "+m);this._level=m,qr(this,u,f,"error"),qr(this,u,f,"fatal"),qr(this,u,f,"warn"),qr(this,u,f,"info"),qr(this,u,f,"debug"),qr(this,u,f,"trace"),o.forEach(v=>{qr(this,u,f,v)})}function b(m,v,D){if(!v)throw new Error("missing bindings for child Pino");D=D||{},i&&v.serializers&&(D.serializers=v.serializers);const P=D.serializers;if(i&&P){var S=Object.assign({},n,P),_=e.browser.serialize===!0?Object.keys(S):i;delete v.serializers,xo([v],_,S,this._stdErrSerialize)}function N(F){this._childLevel=(F._childLevel|0)+1,this.bindings=v,S&&(this.serializers=S,this._serialize=_),t&&(this._logEvent=So([].concat(F._logEvent.bindings,v)))}N.prototype=this;const $=new N(this);return Nf(this,$),$.child=function(...F){return b.call(this,m,...F)},$.level=D.level||this.level,m.onChild($),$}return f}function k1(e){const t=e.customLevels||{},r=Object.assign({},jt.levels.values,t),n=Object.assign({},jt.levels.labels,z1(t));return{values:r,labels:n}}function z1(e){const t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}jt.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"}},jt.stdSerializers=U1,jt.stdTimeFunctions=Object.assign({},{nullTime:Pf,epochTime:$f,unixTime:Y1,isoTime:W1});function q1(e){const t=[];e.bindings&&t.push(e.bindings);let r=e[_o];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function qr(e,t,r,n){if(Object.defineProperty(e,n,{value:fr(e.level,r)>fr(n,r)?ln:r[vo][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===ln){if(!t.transmit)return;const s=t.transmit.level||e.level,o=fr(s,r);if(fr(n,r)<o)return}e[n]=K1(e,t,r,n);const i=q1(e);i.length!==0&&(e[n]=H1(i,e[n]))}function H1(e,t){return function(){return t.apply(this,[...e,...arguments])}}function K1(e,t,r,n){return function(i){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Xn?Xn:this;for(var c=0;c<o.length;c++)o[c]=arguments[c];var f=!1;if(t.serialize&&(xo(o,this._serialize,this.serializers,this._stdErrSerialize),f=!0),t.asObject||t.formatters?i.call(a,...V1(this,n,o,s,t)):i.apply(a,o),t.transmit){const u=t.transmit.level||e._level,d=fr(u,r),h=fr(n,r);if(h<d)return;G1(this,{ts:s,methodLevel:n,methodValue:h,transmitLevel:u,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:fr(e._level,r)},o,f)}}}(e[vo][n])}function V1(e,t,r,n,i){const{level:s,log:o=d=>d}=i.formatters||{},a=r.slice();let c=a[0];const f={};let u=(e._childLevel|0)+1;if(u<1&&(u=1),n&&(f.time=n),s){const d=s(t,e.levels.values[t]);Object.assign(f,d)}else f.level=e.levels.values[t];if(i.asObjectBindingsOnly){if(c!==null&&typeof c=="object")for(;u--&&typeof a[0]=="object";)Object.assign(f,a.shift());return[o(f),...a]}else{if(c!==null&&typeof c=="object"){for(;u--&&typeof a[0]=="object";)Object.assign(f,a.shift());c=a.length?Rf(a.shift(),a):void 0}else typeof c=="string"&&(c=Rf(a.shift(),a));return c!==void 0&&(f[i.messageKey]=c),[o(f)]}}function xo(e,t,r,n){for(const i in e)if(n&&e[i]instanceof Error)e[i]=jt.stdSerializers.err(e[i]);else if(typeof e[i]=="object"&&!Array.isArray(e[i])&&t)for(const s in e[i])t.indexOf(s)>-1&&s in r&&(e[i][s]=r[s](e[i][s]))}function G1(e,t,r,n=!1){const i=t.send,s=t.ts,o=t.methodLevel,a=t.methodValue,c=t.val,f=e._logEvent.bindings;n||xo(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=s,e._logEvent.messages=r.filter(function(u){return f.indexOf(u)===-1}),e._logEvent.level.label=o,e._logEvent.level.value=a,i(o,e._logEvent,c),e._logEvent=So(f)}function So(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function Cf(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const r in e)t[r]===void 0&&(t[r]=e[r]);return t}function Z1(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?Pf:$f}function Vi(){return{}}function Io(e){return e}function ln(){}function Pf(){return!1}function $f(){return Date.now()}function Y1(){return Math.round(Date.now()/1e3)}function W1(){return new Date(Date.now()).toISOString()}function X1(){function e(t){return typeof t<"u"&&t}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 e(self)||e(window)||e(this)||{}}}Rt.exports.default=jt,Rt.exports.pino=jt;const J1={level:"info"},Gi="custom_context",Oo=1e3*1024;var Q1=Object.defineProperty,eb=(e,t,r)=>t in e?Q1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ur=(e,t,r)=>eb(e,typeof t!="symbol"?t+"":t,r);class tb{constructor(t){ur(this,"nodeValue"),ur(this,"sizeInBytes"),ur(this,"next"),this.nodeValue=t,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class Lf{constructor(t){ur(this,"lengthInNodes"),ur(this,"sizeInBytes"),ur(this,"head"),ur(this,"tail"),ur(this,"maxSizeInBytes"),this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=t,this.sizeInBytes=0}append(t){const r=new tb(t);if(r.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${t} 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 t=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=t.size}toArray(){const t=[];let r=this.head;for(;r!==null;)t.push(r.value),r=r.next;return t}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let t=this.head;return{next:()=>{if(!t)return{done:!0,value:null};const r=t.value;return t=t.next,{done:!1,value:r}}}}}const rb=e=>JSON.stringify(e,(t,r)=>typeof r=="bigint"?r.toString()+"n":r);function Uf(e){return typeof e=="string"?e:rb(e)||""}var nb=Object.defineProperty,ib=(e,t,r)=>t in e?nb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Zi=(e,t,r)=>ib(e,typeof t!="symbol"?t+"":t,r);class Ff{constructor(t,r=Oo){Zi(this,"logs"),Zi(this,"level"),Zi(this,"levelValue"),Zi(this,"MAX_LOG_SIZE_IN_BYTES"),this.level=t??"error",this.levelValue=Rt.exports.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new Lf(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(t,r){r===Rt.exports.levels.values.error?console.error(t):r===Rt.exports.levels.values.warn?console.warn(t):r===Rt.exports.levels.values.debug?console.debug(t):r===Rt.exports.levels.values.trace?console.trace(t):console.log(t)}appendToLogs(t){this.logs.append(Uf({timestamp:new Date().toISOString(),log:t}));const r=typeof t=="string"?JSON.parse(t).level:t.level;r>=this.levelValue&&this.forwardToConsole(t,r)}getLogs(){return this.logs}clearLogs(){this.logs=new Lf(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(t){const r=this.getLogArray();return r.push(Uf({extraMetadata:t})),new Blob(r,{type:"application/json"})}}var sb=Object.defineProperty,ob=(e,t,r)=>t in e?sb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ab=(e,t,r)=>ob(e,typeof t!="symbol"?t+"":t,r);class cb{constructor(t,r=Oo){ab(this,"baseChunkLogger"),this.baseChunkLogger=new Ff(t,r)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}downloadLogsBlobInBrowser(t){const r=URL.createObjectURL(this.logsToBlob(t)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}}var fb=Object.defineProperty,ub=(e,t,r)=>t in e?fb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lb=(e,t,r)=>ub(e,typeof t!="symbol"?t+"":t,r);class hb{constructor(t,r=Oo){lb(this,"baseChunkLogger"),this.baseChunkLogger=new Ff(t,r)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}}var db=Object.defineProperty,gb=Object.defineProperties,pb=Object.getOwnPropertyDescriptors,jf=Object.getOwnPropertySymbols,bb=Object.prototype.hasOwnProperty,yb=Object.prototype.propertyIsEnumerable,Mf=(e,t,r)=>t in e?db(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lr=(e,t)=>{for(var r in t||(t={}))bb.call(t,r)&&Mf(e,r,t[r]);if(jf)for(var r of jf(t))yb.call(t,r)&&Mf(e,r,t[r]);return e},hr=(e,t)=>gb(e,pb(t));function mb(e){return hr(lr({},e),{level:e?.level||J1.level})}function wb(e,t,r=Gi){return e[r]=t,e}function nt(e,t=Gi){return e[t]||""}function Eb(e,t,r=Gi){const n=nt(e,r);return n.trim()?`${n}/${t}`:t}function it(e,t,r=Gi){const n=Eb(e,t,r),i=e.child({context:n});return wb(i,n,r)}function vb(e){var t,r;const n=new cb((t=e.opts)==null?void 0:t.level,e.maxSizeInBytes);return{logger:Rt.exports(hr(lr({},e.opts),{level:"trace",browser:hr(lr({},(r=e.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function _b(e){var t,r;const n=new hb((t=e.opts)==null?void 0:t.level,e.maxSizeInBytes);return{logger:Rt.exports(hr(lr({},e.opts),{level:"trace",browser:hr(lr({},(r=e.opts)==null?void 0:r.browser),{write:i=>n.write(i)})}),n),chunkLoggerController:n}}function kf(e){var t;if(typeof e.loggerOverride<"u"&&typeof e.loggerOverride!="string")return{logger:e.loggerOverride,chunkLoggerController:null};const r=hr(lr({},e.opts),{level:typeof e.loggerOverride=="string"?e.loggerOverride:(t=e.opts)==null?void 0:t.level});return typeof window<"u"?vb(hr(lr({},e),{opts:r})):_b(hr(lr({},e),{opts:r}))}var xb=Object.defineProperty,Sb=(e,t,r)=>t in e?xb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,zf=(e,t,r)=>Sb(e,typeof t!="symbol"?t+"":t,r);class Ib extends Mr{constructor(t){super(),this.opts=t,zf(this,"protocol","wc"),zf(this,"version",2)}}var Ob=Object.defineProperty,Bb=(e,t,r)=>t in e?Ob(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Db=(e,t,r)=>Bb(e,typeof t!="symbol"?t+"":t,r);class Ab extends Mr{constructor(t,r){super(),this.core=t,this.logger=r,Db(this,"records",new Map)}}class Tb{constructor(t,r){this.logger=t,this.core=r}}class Rb extends Mr{constructor(t,r){super(),this.relayer=t,this.logger=r}}class Nb extends Mr{constructor(t){super()}}class Cb{constructor(t,r,n,i){this.core=t,this.logger=r,this.name=n}}class Pb extends Mr{constructor(t,r){super(),this.relayer=t,this.logger=r}}class $b extends Mr{constructor(t,r){super(),this.core=t,this.logger=r}}class Lb{constructor(t,r,n){this.core=t,this.logger=r,this.store=n}}class Ub{constructor(t,r){this.projectId=t,this.logger=r}}class Fb{constructor(t,r,n){this.core=t,this.logger=r,this.telemetryEnabled=n}}const Bo="wc",Do=2,Jn="core",Et=`${Bo}@2:${Jn}:`,qf={name:Jn,logger:"error"},Hf={database:":memory:"},Kf="crypto",Ao="client_ed25519_seed",Vf=W.ONE_DAY,Gf="keychain",Zf="0.3",Yf="messages",Wf="0.3",Xf=W.SIX_HOURS,Jf="publisher",Qf="irn",eu="error",To="wss://relay.walletconnect.org",tu="relayer",ge={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},ru="_subscription",st={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},nu=.1,jb={database:":memory:"},Yi="2.23.5",Mb=1e4,Hr={link_mode:"link_mode",relay:"relay"},Qn={inbound:"inbound",outbound:"outbound"},iu="0.3",su="WALLETCONNECT_CLIENT_ID",Ro="WALLETCONNECT_LINK_MODE_APPS",Ge={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},kb=W.THIRTY_DAYS,ou="subscription",au="0.3",zb=W.FIVE_SECONDS*1e3,cu="pairing",fu="0.3",qb=W.THIRTY_DAYS,hn={wc_pairingDelete:{req:{ttl:W.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:W.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:W.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:W.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:W.ONE_DAY,prompt:!1,tag:0},res:{ttl:W.ONE_DAY,prompt:!1,tag:0}}},dn={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},ht={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},uu="history",lu="0.3",hu="expirer",dt={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},du="0.3",Hb=W.ONE_DAY,gu="verify-api",Kb="https://verify.walletconnect.com",pu="https://verify.walletconnect.org",ei=pu,bu=`${ei}/v3`,yu=[Kb,pu],mu="echo",wu="https://echo.walletconnect.com",Vb="event-client",Nt={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},Mt={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},Gb={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success",session_request_response_started:"session_request_response_started",session_request_response_validation_success:"session_request_response_validation_success",session_request_response_publish_started:"session_request_response_publish_started"},Zb={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found",session_request_response_validation_failure:"session_request_response_validation_failure",session_request_response_publish_failure:"session_request_response_publish_failure"},Yb={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscri