(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2888],{40926:function(e,t,r){"use strict";function i(){return(null===r.g||void 0===r.g?void 0:r.g.crypto)||(null===r.g||void 0===r.g?void 0:r.g.msCrypto)||{}}function n(){let e=i();return e.subtle||e.webkitSubtle}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowserCryptoAvailable=t.getSubtleCrypto=t.getBrowerCrypto=void 0,t.getBrowerCrypto=i,t.getSubtleCrypto=n,t.isBrowserCryptoAvailable=function(){return!!i()&&!!n()}},88618:function(e,t,r){"use strict";var i=r(34155);function n(){return"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product}function s(){return void 0!==i&&void 0!==i.versions&&void 0!==i.versions.node}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowser=t.isNode=t.isReactNative=void 0,t.isReactNative=n,t.isNode=s,t.isBrowser=function(){return!n()&&!s()}},1468:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=r(34308);i.__exportStar(r(40926),t),i.__exportStar(r(88618),t)},34308:function(e,t,r){"use strict";r.r(t),r.d(t,{__assign:function(){return s},__asyncDelegator:function(){return v},__asyncGenerator:function(){return w},__asyncValues:function(){return A},__await:function(){return y},__awaiter:function(){return u},__classPrivateFieldGet:function(){return I},__classPrivateFieldSet:function(){return S},__createBinding:function(){return h},__decorate:function(){return o},__exportStar:function(){return f},__extends:function(){return n},__generator:function(){return d},__importDefault:function(){return _},__importStar:function(){return C},__makeTemplateObject:function(){return E},__metadata:function(){return l},__param:function(){return c},__read:function(){return g},__rest:function(){return a},__spread:function(){return m},__spreadArrays:function(){return b},__values:function(){return p}});var i=function(e,t){return(i=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function n(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(){return(s=Object.assign||function(e){for(var t,r=1,i=arguments.length;rt.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);nt.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r}function o(e,t,r,i){var n,s=arguments.length,a=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,i);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,r,a):n(t,r))||a);return s>3&&a&&Object.defineProperty(t,r,a),a}function c(e,t){return function(r,i){t(r,i,e)}}function l(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function u(e,t,r,i){return new(r||(r=Promise))(function(n,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}c((i=i.apply(e,t||[])).next())})}function d(e,t){var r,i,n,s,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function o(s){return function(o){return function(s){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,s=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return a}function m(){for(var e=[],t=0;t1||o(e,t)})})}function o(e,t){try{var r;(r=n[e](t)).value instanceof y?Promise.resolve(r.value.v).then(c,l):u(s[0][2],r)}catch(e){u(s[0][3],e)}}function c(e){o("next",e)}function l(e){o("throw",e)}function u(e,t){e(t),s.shift(),s.length&&o(s[0][0],s[0][1])}}function v(e){var t,r;return t={},i("next"),i("throw",function(e){throw e}),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,n){t[i]=e[i]?function(t){return(r=!r)?{value:y(e[i](t)),done:"return"===i}:n?n(t):t}:n}}function A(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=p(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise(function(i,n){!function(e,t,r,i){Promise.resolve(i).then(function(t){e({value:t,done:r})},t)}(i,n,(t=e[r](t)).done,t.value)})}}}function E(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function C(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function _(e){return e&&e.__esModule?e:{default:e}}function I(e,t){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)}function S(e,t,r){if(!t.has(e))throw TypeError("attempted to set private field on non-instance");return t.set(e,r),r}},80699:function(e,t,r){var i="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==r.g&&r.g,n=function(){function e(){this.fetch=!1,this.DOMException=i.DOMException}return e.prototype=i,new e}();(function(e){var t=void 0!==n&&n||"undefined"!=typeof self&&self||void 0!==r.g&&r.g||{},i={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(i.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function o(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function c(e){return"string"!=typeof e&&(e=String(e)),e}function l(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return i.iterable&&(t[Symbol.iterator]=function(){return t}),t}function u(e){this.map={},e instanceof u?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){if(2!=e.length)throw TypeError("Headers constructor: expected name/value pair to be length 2, found"+e.length);this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function d(e){if(!e._noBody){if(e.bodyUsed)return Promise.reject(TypeError("Already read"));e.bodyUsed=!0}}function h(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function f(e){var t=new FileReader,r=h(t);return t.readAsArrayBuffer(e),r}function p(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(e){if(this.bodyUsed=this.bodyUsed,this._bodyInit=e,e){if("string"==typeof e)this._bodyText=e;else if(i.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(i.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(i.searchParams&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else{var t;i.arrayBuffer&&i.blob&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=p(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||a(e))?this._bodyArrayBuffer=p(e):this._bodyText=e=Object.prototype.toString.call(e)}}else this._noBody=!0,this._bodyText="";!this.headers.get("content-type")&&("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i.blob&&(this.blob=function(){var e=d(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(!this._bodyFormData)return Promise.resolve(new Blob([this._bodyText]));throw Error("could not read FormData body as blob")}),this.arrayBuffer=function(){if(this._bodyArrayBuffer)return d(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer));if(i.blob)return this.blob().then(f);throw Error("could not read as ArrayBuffer")},this.text=function(){var e,t,r,i,n,s=d(this);if(s)return s;if(this._bodyBlob)return e=this._bodyBlob,r=h(t=new FileReader),n=(i=/charset=([A-Za-z0-9_-]+)/.exec(e.type))?i[1]:"utf-8",t.readAsText(e,n),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=Array(t.length),i=0;i-1?n:i),this.mode=r.mode||this.mode||null,this.signal=r.signal||this.signal||function(){if("AbortController"in t)return new AbortController().signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&s)throw TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(s),("GET"===this.method||"HEAD"===this.method)&&("no-store"===r.cache||"no-cache"===r.cache)){var a=/([?&])_=[^&]*/;a.test(this.url)?this.url=this.url.replace(a,"$1_="+new Date().getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+new Date().getTime()}}function y(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(n))}}),t}function w(e,t){if(!(this instanceof w))throw TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.status<200||this.status>599)throw RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new u(t.headers),this.url=t.url||"",this._initBody(e)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},g.call(b.prototype),g.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var v=[301,302,303,307,308];w.redirect=function(e,t){if(-1===v.indexOf(t))throw RangeError("Invalid status code");return new w(null,{status:t,headers:{location:e}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function A(r,n){return new Promise(function(s,a){var l=new b(r,n);if(l.signal&&l.signal.aborted)return a(new e.DOMException("Aborted","AbortError"));var d=new XMLHttpRequest;function h(){d.abort()}if(d.onload=function(){var e,t,r={statusText:d.statusText,headers:(e=d.getAllResponseHeaders()||"",t=new u,e.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e}).forEach(function(e){var r=e.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();try{t.append(i,n)}catch(e){console.warn("Response "+e.message)}}}),t)};0===l.url.indexOf("file://")&&(d.status<200||d.status>599)?r.status=200:r.status=d.status,r.url="responseURL"in d?d.responseURL:r.headers.get("X-Request-URL");var i="response"in d?d.response:d.responseText;setTimeout(function(){s(new w(i,r))},0)},d.onerror=function(){setTimeout(function(){a(TypeError("Network request failed"))},0)},d.ontimeout=function(){setTimeout(function(){a(TypeError("Network request timed out"))},0)},d.onabort=function(){setTimeout(function(){a(new e.DOMException("Aborted","AbortError"))},0)},d.open(l.method,function(e){try{return""===e&&t.location.href?t.location.href:e}catch(t){return e}}(l.url),!0),"include"===l.credentials?d.withCredentials=!0:"omit"===l.credentials&&(d.withCredentials=!1),"responseType"in d&&(i.blob?d.responseType="blob":i.arrayBuffer&&(d.responseType="arraybuffer")),n&&"object"==typeof n.headers&&!(n.headers instanceof u||t.Headers&&n.headers instanceof t.Headers)){var f=[];Object.getOwnPropertyNames(n.headers).forEach(function(e){f.push(o(e)),d.setRequestHeader(e,c(n.headers[e]))}),l.headers.forEach(function(e,t){-1===f.indexOf(t)&&d.setRequestHeader(t,e)})}else l.headers.forEach(function(e,t){d.setRequestHeader(t,e)});l.signal&&(l.signal.addEventListener("abort",h),d.onreadystatechange=function(){4===d.readyState&&l.signal.removeEventListener("abort",h)}),d.send(void 0===l._bodyInit?null:l._bodyInit)})}A.polyfill=!0,t.fetch||(t.fetch=A,t.Headers=u,t.Request=b,t.Response=w),e.Headers=u,e.Request=b,e.Response=w,e.fetch=A,Object.defineProperty(e,"__esModule",{value:!0})})({}),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var s=i.fetch?i:n;(t=s.fetch).default=s.fetch,t.fetch=s.fetch,t.Headers=s.Headers,t.Request=s.Request,t.Response=s.Response,e.exports=t},72030:function(e){"use strict";e.exports=function(){throw Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},12044:function(e,t,r){"use strict";r.d(t,{Ep:function(){return _},Fd:function(){return C},Rt:function(){return I},gw:function(){return n.a},jI:function(){return E}});var i=r(36559),n=r.n(i),s=r(85094);let a={level:"info"},o="custom_context";class c{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 l{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){let t=new c(e);if(t.size>this.maxSizeInBytes)throw Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?this.tail&&(this.tail.next=t):this.head=t,this.tail=t,this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;let e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){let e=[],t=this.head;for(;null!==t;)e.push(t.value),t=t.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};let t=e.value;return e=e.next,{done:!1,value:t}}}}}class u{constructor(e,t=1024e3){this.level=e??"error",this.levelValue=i.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new l(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===i.levels.values.error?console.error(e):t===i.levels.values.warn?console.warn(e):t===i.levels.values.debug?console.debug(e):t===i.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append((0,s.u)({timestamp:new Date().toISOString(),log:e}));let t="string"==typeof e?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new l(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){let t=this.getLogArray();return t.push((0,s.u)({extraMetadata:e})),new Blob(t,{type:"application/json"})}}class d{constructor(e,t=1024e3){this.baseChunkLogger=new u(e,t)}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){let t=URL.createObjectURL(this.logsToBlob(e)),r=document.createElement("a");r.href=t,r.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(t)}}class h{constructor(e,t=1024e3){this.baseChunkLogger=new u(e,t)}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 f=Object.defineProperty,p=Object.defineProperties,g=Object.getOwnPropertyDescriptors,m=Object.getOwnPropertySymbols,b=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,w=(e,t,r)=>t in e?f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,v=(e,t)=>{for(var r in t||(t={}))b.call(t,r)&&w(e,r,t[r]);if(m)for(var r of m(t))y.call(t,r)&&w(e,r,t[r]);return e},A=(e,t)=>p(e,g(t));function E(e){return A(v({},e),{level:e?.level||a.level})}function C(e,t=o){return typeof e.bindings>"u"?function(e,t=o){return e[t]||""}(e,t):e.bindings().context||""}function _(e,t,r=o){let i=function(e,t,r=o){let i=C(e,r);return i.trim()?`${i}/${t}`:t}(e,t,r);return function(e,t,r=o){return e[r]=t,e}(e.child({context:i}),i,r)}function I(e){return"u">typeof e.loggerOverride&&"string"!=typeof e.loggerOverride?{logger:e.loggerOverride,chunkLoggerController:null}:"u">typeof window?function(e){var t,r;let i=new d(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:n()(A(v({},e.opts),{level:"trace",browser:A(v({},null==(r=e.opts)?void 0:r.browser),{write:e=>i.write(e)})})),chunkLoggerController:i}}(e):function(e){var t;let r=new h(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:n()(A(v({},e.opts),{level:"trace"}),r),chunkLoggerController:r}}(e)}},85094:function(e,t,r){"use strict";r.d(t,{D:function(){return s},u:function(){return a}});let i=e=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString()+"n":t),n=e=>JSON.parse(e.replace(/([\[:])?(\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,'$1"$2n"$3'),(e,t)=>"string"==typeof t&&t.match(/^\d+n$/)?BigInt(t.substring(0,t.length-1)):t);function s(e){if("string"!=typeof e)throw Error(`Cannot safe json parse value of type ${typeof e}`);try{return n(e)}catch(t){return e}}function a(e){return"string"==typeof e?e:i(e)||""}},36900:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=r(30004);i.__exportStar(r(46869),t),i.__exportStar(r(88033),t)},46869:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_THOUSAND=t.ONE_HUNDRED=void 0,t.ONE_HUNDRED=100,t.ONE_THOUSAND=1e3},88033:function(e,t){"use strict";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=5*t.ONE_MINUTE,t.TEN_MINUTES=10*t.ONE_MINUTE,t.THIRTY_MINUTES=30*t.ONE_MINUTE,t.SIXTY_MINUTES=60*t.ONE_MINUTE,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=3*t.ONE_HOUR,t.SIX_HOURS=6*t.ONE_HOUR,t.TWELVE_HOURS=12*t.ONE_HOUR,t.TWENTY_FOUR_HOURS=24*t.ONE_HOUR,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=3*t.ONE_DAY,t.FIVE_DAYS=5*t.ONE_DAY,t.SEVEN_DAYS=7*t.ONE_DAY,t.THIRTY_DAYS=30*t.ONE_DAY,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=2*t.ONE_WEEK,t.THREE_WEEKS=3*t.ONE_WEEK,t.FOUR_WEEKS=4*t.ONE_WEEK,t.ONE_YEAR=365*t.ONE_DAY},66736:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=r(30004);i.__exportStar(r(44273),t),i.__exportStar(r(47001),t),i.__exportStar(r(52939),t),i.__exportStar(r(36900),t)},52939:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(30004).__exportStar(r(88766),t)},88766:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IWatch=void 0;class r{}t.IWatch=r},83207:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromMiliseconds=t.toMiliseconds=void 0;let i=r(36900);t.toMiliseconds=function(e){return e*i.ONE_THOUSAND},t.fromMiliseconds=function(e){return Math.floor(e/i.ONE_THOUSAND)}},83873:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.delay=void 0,t.delay=function(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}},44273:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=r(30004);i.__exportStar(r(83873),t),i.__exportStar(r(83207),t)},47001:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){let t=this.get(e);if(void 0!==t.elapsed)throw Error(`Watch already stopped for label: ${e}`);let r=Date.now()-t.started;this.timestamps.set(e,{started:t.started,elapsed:r})}get(e){let t=this.timestamps.get(e);if(void 0===t)throw Error(`No timestamp found for label: ${e}`);return t}elapsed(e){let t=this.get(e);return t.elapsed||Date.now()-t.started}}t.Watch=r,t.default=r},30004:function(e,t,r){"use strict";r.r(t),r.d(t,{__assign:function(){return s},__asyncDelegator:function(){return v},__asyncGenerator:function(){return w},__asyncValues:function(){return A},__await:function(){return y},__awaiter:function(){return u},__classPrivateFieldGet:function(){return I},__classPrivateFieldSet:function(){return S},__createBinding:function(){return h},__decorate:function(){return o},__exportStar:function(){return f},__extends:function(){return n},__generator:function(){return d},__importDefault:function(){return _},__importStar:function(){return C},__makeTemplateObject:function(){return E},__metadata:function(){return l},__param:function(){return c},__read:function(){return g},__rest:function(){return a},__spread:function(){return m},__spreadArrays:function(){return b},__values:function(){return p}});var i=function(e,t){return(i=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function n(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(){return(s=Object.assign||function(e){for(var t,r=1,i=arguments.length;rt.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);nt.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r}function o(e,t,r,i){var n,s=arguments.length,a=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,i);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,r,a):n(t,r))||a);return s>3&&a&&Object.defineProperty(t,r,a),a}function c(e,t){return function(r,i){t(r,i,e)}}function l(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function u(e,t,r,i){return new(r||(r=Promise))(function(n,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}c((i=i.apply(e,t||[])).next())})}function d(e,t){var r,i,n,s,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function o(s){return function(o){return function(s){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,s=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return a}function m(){for(var e=[],t=0;t1||o(e,t)})})}function o(e,t){try{var r;(r=n[e](t)).value instanceof y?Promise.resolve(r.value.v).then(c,l):u(s[0][2],r)}catch(e){u(s[0][3],e)}}function c(e){o("next",e)}function l(e){o("throw",e)}function u(e,t){e(t),s.shift(),s.length&&o(s[0][0],s[0][1])}}function v(e){var t,r;return t={},i("next"),i("throw",function(e){throw e}),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,n){t[i]=e[i]?function(t){return(r=!r)?{value:y(e[i](t)),done:"return"===i}:n?n(t):t}:n}}function A(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=p(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise(function(i,n){!function(e,t,r,i){Promise.resolve(i).then(function(t){e({value:t,done:r})},t)}(i,n,(t=e[r](t)).done,t.value)})}}}function E(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function C(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function _(e){return e&&e.__esModule?e:{default:e}}function I(e,t){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)}function S(e,t,r){if(!t.has(e))throw TypeError("attempted to set private field on non-instance");return t.set(e,r),r}},58269:function(e,t,r){"use strict";let i;r.d(t,{Z:function(){return fK}});var n={};r.r(n),r.d(n,{identity:function(){return iX}});var s={};r.r(s),r.d(s,{base2:function(){return i0}});var a={};r.r(a),r.d(a,{base8:function(){return i1}});var o={};r.r(o),r.d(o,{base10:function(){return i2}});var c={};r.r(c),r.d(c,{base16:function(){return i3},base16upper:function(){return i8}});var l={};r.r(l),r.d(l,{base32:function(){return i5},base32hex:function(){return i7},base32hexpad:function(){return nt},base32hexpadupper:function(){return nr},base32hexupper:function(){return ne},base32pad:function(){return i4},base32padupper:function(){return i9},base32upper:function(){return i6},base32z:function(){return ni}});var u={};r.r(u),r.d(u,{base36:function(){return nn},base36upper:function(){return ns}});var d={};r.r(d),r.d(d,{base58btc:function(){return na},base58flickr:function(){return no}});var h={};r.r(h),r.d(h,{base64:function(){return nc},base64pad:function(){return nl},base64url:function(){return nu},base64urlpad:function(){return nd}});var f={};r.r(f),r.d(f,{base256emoji:function(){return ng}});var p={};r.r(p),r.d(p,{sha256:function(){return nT},sha512:function(){return nP}});var g={};r.r(g),r.d(g,{identity:function(){return nx}});var m={};r.r(m),r.d(m,{code:function(){return nR},decode:function(){return nD},encode:function(){return nk},name:function(){return nO}});var b={};r.r(b),r.d(b,{code:function(){return nB},decode:function(){return n$},encode:function(){return nj},name:function(){return nL}});var y=r(17187),w=r.n(y),v=r(66736);class A{}class E extends A{constructor(e){super()}}let C=v.FIVE_SECONDS,_="heartbeat_pulse";class I extends E{constructor(e){super(e),this.events=new y.EventEmitter,this.interval=C,this.interval=e?.interval||C}static async init(e){let t=new I(e);return await t.init(),t}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),(0,v.toMiliseconds)(this.interval))}pulse(){this.events.emit(_)}}let S=/"(?:_|\\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*:/,N=/"(?: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*:/,T=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function P(e,t){if("__proto__"===e||"constructor"===e&&t&&"object"==typeof t&&"prototype"in t){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`);return}return t}function x(e,t={}){if("string"!=typeof e)return e;let r=e.trim();if('"'===e[0]&&e.endsWith('"')&&!e.includes("\\"))return r.slice(1,-1);if(r.length<=9){let e=r.toLowerCase();if("true"===e)return!0;if("false"===e)return!1;if("undefined"===e)return;if("null"===e)return null;if("nan"===e)return Number.NaN;if("infinity"===e)return Number.POSITIVE_INFINITY;if("-infinity"===e)return Number.NEGATIVE_INFINITY}if(!T.test(e)){if(t.strict)throw SyntaxError("[destr] Invalid JSON");return e}try{if(S.test(e)||N.test(e)){if(t.strict)throw Error("[destr] Possible prototype pollution");return JSON.parse(e,P)}return JSON.parse(e)}catch(r){if(t.strict)throw r;return e}}var O=r(48764).Buffer;function R(e,...t){try{var r;return(r=e(...t))&&"function"==typeof r.then?r:Promise.resolve(r)}catch(e){return Promise.reject(e)}}function k(e){if(function(e){let t=typeof e;return null===e||"object"!==t&&"function"!==t}(e))return String(e);if(function(e){let t=Object.getPrototypeOf(e);return!t||t.isPrototypeOf(Object)}(e)||Array.isArray(e))return JSON.stringify(e);if("function"==typeof e.toJSON)return k(e.toJSON());throw Error("[unstorage] Cannot stringify value!")}let D="base64:";function M(e){return e&&e.split("?")[0]?.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,"")||""}function U(e){return(e=M(e))?e+":":""}let L=()=>{let e=new Map;return{name:"memory",getInstance:()=>e,hasItem:t=>e.has(t),getItem:t=>e.get(t)??null,getItemRaw:t=>e.get(t)??null,setItem(t,r){e.set(t,r)},setItemRaw(t,r){e.set(t,r)},removeItem(t){e.delete(t)},getKeys:()=>[...e.keys()],clear(){e.clear()},dispose(){e.clear()}}};function B(e,t,r){return e.watch?e.watch((e,i)=>t(e,r+i)):()=>{}}async function j(e){"function"==typeof e.dispose&&await R(e.dispose)}function $(e){return new Promise((t,r)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>r(e.error)})}function F(e,t){let r=indexedDB.open(e);r.onupgradeneeded=()=>r.result.createObjectStore(t);let i=$(r);return(e,r)=>i.then(i=>r(i.transaction(t,e).objectStore(t)))}function q(){return i||(i=F("keyval-store","keyval")),i}function z(e,t=q()){return t("readonly",t=>$(t.get(e)))}var H=r(85094),W=(e={})=>{let t;let r=e.base&&e.base.length>0?`${e.base}:`:"",i=e=>r+e;return e.dbName&&e.storeName&&(t=F(e.dbName,e.storeName)),{name:"idb-keyval",options:e,hasItem:async e=>!(typeof await z(i(e),t)>"u"),getItem:async e=>await z(i(e),t)??null,setItem:(e,r)=>(function(e,t,r=q()){return r("readwrite",r=>(r.put(t,e),$(r.transaction)))})(i(e),r,t),removeItem:e=>(function(e,t=q()){return t("readwrite",t=>(t.delete(e),$(t.transaction)))})(i(e),t),getKeys:()=>(function(e=q()){return e("readonly",e=>{var t;if(e.getAllKeys)return $(e.getAllKeys());let r=[];return(t=e=>r.push(e.key),e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},$(e.transaction)).then(()=>r)})})(t),clear:()=>(function(e=q()){return e("readwrite",e=>(e.clear(),$(e.transaction)))})(t)}};class V{constructor(){this.indexedDb=function(e={}){let t={mounts:{"":e.driver||L()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=e=>{for(let r of t.mountpoints)if(e.startsWith(r))return{base:r,relativeKey:e.slice(r.length),driver:t.mounts[r]};return{base:"",relativeKey:e,driver:t.mounts[""]}},i=(e,r)=>t.mountpoints.filter(t=>t.startsWith(e)||r&&e.startsWith(t)).map(r=>({relativeBase:e.length>r.length?e.slice(r.length):void 0,mountpoint:r,driver:t.mounts[r]})),n=(e,r)=>{if(t.watching)for(let i of(r=M(r),t.watchListeners))i(e,r)},s=async()=>{if(!t.watching)for(let e in t.watching=!0,t.mounts)t.unwatch[e]=await B(t.mounts[e],n,e)},a=async()=>{if(t.watching){for(let e in t.unwatch)await t.unwatch[e]();t.unwatch={},t.watching=!1}},o=(e,t,i)=>{let n=new Map,s=e=>{let t=n.get(e.base);return t||(t={driver:e.driver,base:e.base,items:[]},n.set(e.base,t)),t};for(let i of e){let e="string"==typeof i,n=M(e?i:i.key),a=e?void 0:i.value,o=e||!i.options?t:{...t,...i.options},c=r(n);s(c).items.push({key:n,value:a,relativeKey:c.relativeKey,options:o})}return Promise.all([...n.values()].map(e=>i(e))).then(e=>e.flat())},c={hasItem(e,t={}){let{relativeKey:i,driver:n}=r(e=M(e));return R(n.hasItem,i,t)},getItem(e,t={}){let{relativeKey:i,driver:n}=r(e=M(e));return R(n.getItem,i,t).then(e=>x(e))},getItems:(e,t={})=>o(e,t,e=>e.driver.getItems?R(e.driver.getItems,e.items.map(e=>({key:e.relativeKey,options:e.options})),t).then(t=>t.map(t=>({key:function(...e){return M(e.join(":"))}(e.base,t.key),value:x(t.value)}))):Promise.all(e.items.map(t=>R(e.driver.getItem,t.relativeKey,t.options).then(e=>({key:t.key,value:x(e)}))))),getItemRaw(e,t={}){let{relativeKey:i,driver:n}=r(e=M(e));return n.getItemRaw?R(n.getItemRaw,i,t):R(n.getItem,i,t).then(e=>{var t;return"string"==typeof e&&e.startsWith(D)?(t=e.slice(D.length),globalThis.Buffer?O.from(t,"base64"):Uint8Array.from(globalThis.atob(t),e=>e.codePointAt(0))):e})},async setItem(e,t,i={}){if(void 0===t)return c.removeItem(e);let{relativeKey:s,driver:a}=r(e=M(e));a.setItem&&(await R(a.setItem,s,k(t),i),a.watch||n("update",e))},async setItems(e,t){await o(e,t,async e=>{if(e.driver.setItems)return R(e.driver.setItems,e.items.map(e=>({key:e.relativeKey,value:k(e.value),options:e.options})),t);e.driver.setItem&&await Promise.all(e.items.map(t=>R(e.driver.setItem,t.relativeKey,k(t.value),t.options)))})},async setItemRaw(e,t,i={}){if(void 0===t)return c.removeItem(e,i);let{relativeKey:s,driver:a}=r(e=M(e));if(a.setItemRaw)await R(a.setItemRaw,s,t,i);else{if(!a.setItem)return;await R(a.setItem,s,"string"==typeof t?t:D+(globalThis.Buffer?O.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))),i)}a.watch||n("update",e)},async removeItem(e,t={}){"boolean"==typeof t&&(t={removeMeta:t});let{relativeKey:i,driver:s}=r(e=M(e));s.removeItem&&(await R(s.removeItem,i,t),(t.removeMeta||t.removeMata)&&await R(s.removeItem,i+"$",t),s.watch||n("remove",e))},async getMeta(e,t={}){"boolean"==typeof t&&(t={nativeOnly:t});let{relativeKey:i,driver:n}=r(e=M(e)),s=Object.create(null);if(n.getMeta&&Object.assign(s,await R(n.getMeta,i,t)),!t.nativeOnly){let e=await R(n.getItem,i+"$",t).then(e=>x(e));e&&"object"==typeof e&&("string"==typeof e.atime&&(e.atime=new Date(e.atime)),"string"==typeof e.mtime&&(e.mtime=new Date(e.mtime)),Object.assign(s,e))}return s},setMeta(e,t,r={}){return this.setItem(e+"$",t,r)},removeMeta(e,t={}){return this.removeItem(e+"$",t)},async getKeys(e,t={}){let r=i(e=U(e),!0),n=[],s=[];for(let e of r){for(let r of(await R(e.driver.getKeys,e.relativeBase,t))){let t=e.mountpoint+M(r);n.some(e=>t.startsWith(e))||s.push(t)}n=[e.mountpoint,...n.filter(t=>!t.startsWith(e.mountpoint))]}return e?s.filter(t=>t.startsWith(e)&&"$"!==t[t.length-1]):s.filter(e=>"$"!==e[e.length-1])},async clear(e,t={}){e=U(e),await Promise.all(i(e,!1).map(async e=>e.driver.clear?R(e.driver.clear,e.relativeBase,t):e.driver.removeItem?Promise.all((await e.driver.getKeys(e.relativeBase||"",t)).map(r=>e.driver.removeItem(r,t))):void 0))},async dispose(){await Promise.all(Object.values(t.mounts).map(e=>j(e)))},watch:async e=>(await s(),t.watchListeners.push(e),async()=>{t.watchListeners=t.watchListeners.filter(t=>t!==e),0===t.watchListeners.length&&await a()}),async unwatch(){t.watchListeners=[],await a()},mount(e,r){if((e=U(e))&&t.mounts[e])throw Error(`already mounted at ${e}`);return e&&(t.mountpoints.push(e),t.mountpoints.sort((e,t)=>t.length-e.length)),t.mounts[e]=r,t.watching&&Promise.resolve(B(r,n,e)).then(r=>{t.unwatch[e]=r}).catch(console.error),c},async unmount(e,r=!0){(e=U(e))&&t.mounts[e]&&(t.watching&&e in t.unwatch&&(t.unwatch[e]?.(),delete t.unwatch[e]),r&&await j(t.mounts[e]),t.mountpoints=t.mountpoints.filter(t=>t!==e),delete t.mounts[e])},getMount(e=""){let t=r(e=M(e)+":");return{driver:t.driver,base:t.base}},getMounts:(e="",t={})=>i(e=M(e),t.parents).map(e=>({driver:e.driver,base:e.mountpoint})),keys:(e,t={})=>c.getKeys(e,t),get:(e,t={})=>c.getItem(e,t),set:(e,t,r={})=>c.setItem(e,t,r),has:(e,t={})=>c.hasItem(e,t),del:(e,t={})=>c.removeItem(e,t),remove:(e,t={})=>c.removeItem(e,t)};return c}({driver:W({dbName:"WALLET_CONNECT_V2_INDEXED_DB",storeName:"keyvaluestorage"})})}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){let t=await this.indexedDb.getItem(e);if(null!==t)return t}async setItem(e,t){await this.indexedDb.setItem(e,(0,H.u)(t))}async removeItem(e){await this.indexedDb.removeItem(e)}}var G="u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof r.g?r.g:"u">typeof self?self:{},K={exports:{}};function Q(e){var t;return[e[0],(0,H.D)(null!=(t=e[1])?t:"")]}!function(){function e(){}e.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},e.prototype.setItem=function(e,t){this[e]=String(t)},e.prototype.removeItem=function(e){delete this[e]},e.prototype.clear=function(){let e=this;Object.keys(e).forEach(function(t){e[t]=void 0,delete e[t]})},e.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},e.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),"u">typeof G&&G.localStorage?K.exports=G.localStorage:"u">typeof window&&window.localStorage?K.exports=window.localStorage:K.exports=new e}();class Y{constructor(){this.localStorage=K.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Q)}async getItem(e){let t=this.localStorage.getItem(e);if(null!==t)return(0,H.D)(t)}async setItem(e,t){this.localStorage.setItem(e,(0,H.u)(t))}async removeItem(e){this.localStorage.removeItem(e)}}let Z=async(e,t,r)=>{let i="wc_storage_version",n=await t.getItem(i);if(n&&n>=1){r(t);return}let s=await e.getKeys();if(!s.length){r(t);return}let a=[];for(;s.length;){let r=s.shift();if(!r)continue;let i=r.toLowerCase();if(i.includes("wc@")||i.includes("walletconnect")||i.includes("wc_")||i.includes("wallet_connect")){let i=await e.getItem(r);await t.setItem(r,i),a.push(r)}}await t.setItem(i,1),r(t),J(e,a)},J=async(e,t)=>{t.length&&t.forEach(async t=>{await e.removeItem(t)})};class X{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};let e=new Y;this.storage=e;try{let t=new V;Z(e,t,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,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{let t=setInterval(()=>{this.initialized&&(clearInterval(t),e())},20)})}}var ee=r(12044),et=Object.defineProperty,er=(e,t,r)=>t in e?et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ei=(e,t,r)=>er(e,"symbol"!=typeof t?t+"":t,r);class en extends A{constructor(e){super(),this.opts=e,ei(this,"protocol","wc"),ei(this,"version",2)}}var es=Object.defineProperty,ea=(e,t,r)=>t in e?es(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,eo=(e,t,r)=>ea(e,"symbol"!=typeof t?t+"":t,r);class ec extends A{constructor(e,t){super(),this.core=e,this.logger=t,eo(this,"records",new Map)}}class el{constructor(e,t){this.logger=e,this.core=t}}class eu extends A{constructor(e,t){super(),this.relayer=e,this.logger=t}}class ed extends A{constructor(e){super()}}class eh{constructor(e,t,r,i){this.core=e,this.logger=t,this.name=r}}class ef extends A{constructor(e,t){super(),this.relayer=e,this.logger=t}}class ep extends A{constructor(e,t){super(),this.core=e,this.logger=t}}class eg{constructor(e,t,r){this.core=e,this.logger=t,this.store=r}}class em{constructor(e,t){this.projectId=e,this.logger=t}}class eb{constructor(e,t,r){this.core=e,this.logger=t,this.telemetryEnabled=r}}var ey=Object.defineProperty,ew=(e,t,r)=>t in e?ey(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ev=(e,t,r)=>ew(e,"symbol"!=typeof t?t+"":t,r);class eA{constructor(e){this.opts=e,ev(this,"protocol","wc"),ev(this,"version",2)}}class eE{constructor(e){this.client=e}}function eC(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function e_(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}let eI="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,eS=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);function eN(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}(e)),eC(e),e}class eT{clone(){return this._cloneInto()}}function eP(e=32){if(eI&&"function"==typeof eI.getRandomValues)return eI.getRandomValues(new Uint8Array(e));if(eI&&"function"==typeof eI.randomBytes)return eI.randomBytes(e);throw Error("crypto.getRandomValues must be defined")}class ex extends eT{constructor(e,t,r,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=eS(this.buffer)}update(e){e_(this);let{view:t,buffer:r,blockLen:i}=this,n=(e=eN(e)).length;for(let s=0;si-s&&(this.process(r,0),s=0);for(let e=s;e>n&s),o=Number(r&s),c=i?4:0,l=i?0:4;e.setUint32(t+c,a,i),e.setUint32(t+l,o,i)})(r,i-8,BigInt(8*this.length),n),this.process(r,0);let a=eS(e),o=this.outputLen;if(o%4)throw Error("_sha2: outputLen should be aligned to 32bit");let c=o/4,l=this.get();if(c>l.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e>eR&eO)}:{h:0|Number(e>>eR&eO),l:0|Number(e&eO)}}(e[n],t);[r[n],i[n]]=[s,a]}return[r,i]},shrSH:(e,t,r)=>e>>>r,shrSL:(e,t,r)=>e<<32-r|t>>>r,rotrSH:(e,t,r)=>e>>>r|t<<32-r,rotrSL:(e,t,r)=>e<<32-r|t>>>r,rotrBH:(e,t,r)=>e<<64-r|t>>>r-32,rotrBL:(e,t,r)=>e>>>r-32|t<<64-r,add:function(e,t,r,i){let n=(t>>>0)+(i>>>0);return{h:e+r+(n/4294967296|0)|0,l:0|n}},add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,i)=>t+r+i+(e/4294967296|0)|0,add4L:(e,t,r,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(i>>>0),add4H:(e,t,r,i,n)=>t+r+i+n+(e/4294967296|0)|0,add5H:(e,t,r,i,n,s)=>t+r+i+n+s+(e/4294967296|0)|0,add5L:(e,t,r,i,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(i>>>0)+(n>>>0)},[eD,eM]=ek.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(e=>BigInt(e))),eU=new Uint32Array(80),eL=new Uint32Array(80);class eB extends ex{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(){let{Ah:e,Al:t,Bh:r,Bl:i,Ch:n,Cl:s,Dh:a,Dl:o,Eh:c,El:l,Fh:u,Fl:d,Gh:h,Gl:f,Hh:p,Hl:g}=this;return[e,t,r,i,n,s,a,o,c,l,u,d,h,f,p,g]}set(e,t,r,i,n,s,a,o,c,l,u,d,h,f,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|i,this.Ch=0|n,this.Cl=0|s,this.Dh=0|a,this.Dl=0|o,this.Eh=0|c,this.El=0|l,this.Fh=0|u,this.Fl=0|d,this.Gh=0|h,this.Gl=0|f,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let r=0;r<16;r++,t+=4)eU[r]=e.getUint32(t),eL[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=0|eU[e-15],r=0|eL[e-15],i=ek.rotrSH(t,r,1)^ek.rotrSH(t,r,8)^ek.shrSH(t,r,7),n=ek.rotrSL(t,r,1)^ek.rotrSL(t,r,8)^ek.shrSL(t,r,7),s=0|eU[e-2],a=0|eL[e-2],o=ek.rotrSH(s,a,19)^ek.rotrBH(s,a,61)^ek.shrSH(s,a,6),c=ek.rotrSL(s,a,19)^ek.rotrBL(s,a,61)^ek.shrSL(s,a,6),l=ek.add4L(n,c,eL[e-7],eL[e-16]),u=ek.add4H(l,i,o,eU[e-7],eU[e-16]);eU[e]=0|u,eL[e]=0|l}let{Ah:r,Al:i,Bh:n,Bl:s,Ch:a,Cl:o,Dh:c,Dl:l,Eh:u,El:d,Fh:h,Fl:f,Gh:p,Gl:g,Hh:m,Hl:b}=this;for(let e=0;e<80;e++){let t=ek.rotrSH(u,d,14)^ek.rotrSH(u,d,18)^ek.rotrBH(u,d,41),y=ek.rotrSL(u,d,14)^ek.rotrSL(u,d,18)^ek.rotrBL(u,d,41),w=u&h^~u&p,v=d&f^~d&g,A=ek.add5L(b,y,v,eM[e],eL[e]),E=ek.add5H(A,m,t,w,eD[e],eU[e]),C=0|A,_=ek.rotrSH(r,i,28)^ek.rotrBH(r,i,34)^ek.rotrBH(r,i,39),I=ek.rotrSL(r,i,28)^ek.rotrBL(r,i,34)^ek.rotrBL(r,i,39),S=r&n^r&a^n&a,N=i&s^i&o^s&o;m=0|p,b=0|g,p=0|h,g=0|f,h=0|u,f=0|d,({h:u,l:d}=ek.add(0|c,0|l,0|E,0|C)),c=0|a,l=0|o,a=0|n,o=0|s,n=0|r,s=0|i;let T=ek.add3L(C,I,N);r=ek.add3H(T,E,_,S),i=0|T}({h:r,l:i}=ek.add(0|this.Ah,0|this.Al,0|r,0|i)),({h:n,l:s}=ek.add(0|this.Bh,0|this.Bl,0|n,0|s)),({h:a,l:o}=ek.add(0|this.Ch,0|this.Cl,0|a,0|o)),({h:c,l:l}=ek.add(0|this.Dh,0|this.Dl,0|c,0|l)),({h:u,l:d}=ek.add(0|this.Eh,0|this.El,0|u,0|d)),({h:h,l:f}=ek.add(0|this.Fh,0|this.Fl,0|h,0|f)),({h:p,l:g}=ek.add(0|this.Gh,0|this.Gl,0|p,0|g)),({h:m,l:b}=ek.add(0|this.Hh,0|this.Hl,0|m,0|b)),this.set(r,i,n,s,a,o,c,l,u,d,h,f,p,g,m,b)}roundClean(){eU.fill(0),eL.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}let ej=function(e){let t=t=>e().update(eN(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}(()=>new eB),e$=BigInt(0),eF=BigInt(1),eq=BigInt(2);function ez(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function eH(e){if(!ez(e))throw Error("Uint8Array expected")}function eW(e,t){if("boolean"!=typeof t)throw Error(e+" boolean expected, got "+t)}let eV=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function eG(e){eH(e);let t="";for(let r=0;r=eQ._0&&e<=eQ._9?e-eQ._0:e>=eQ.A&&e<=eQ.F?e-(eQ.A-10):e>=eQ.a&&e<=eQ.f?e-(eQ.a-10):void 0}function eZ(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);let t=e.length,r=t/2;if(t%2)throw Error("hex string expected, got unpadded hex of length "+t);let i=new Uint8Array(r);for(let t=0,n=0;t"bigint"==typeof e&&e$<=e;function e8(e,t,r,i){if(!(e3(t)&&e3(r)&&e3(i))||!(r<=t)||!(t(eq<"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||ez(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function e4(e,t,r={}){let i=(t,r,i)=>{let n=e6[r];if("function"!=typeof n)throw Error("invalid validator function");let s=e[t];if(!(i&&void 0===s)&&!n(s,e))throw Error("param "+String(t)+" is invalid. Expected "+r+", got "+s)};for(let[e,r]of Object.entries(t))i(e,r,!1);for(let[e,t]of Object.entries(r))i(e,t,!0);return e}function e9(e){let t=new WeakMap;return(r,...i)=>{let n=t.get(r);if(void 0!==n)return n;let s=e(r,...i);return t.set(r,s),s}}let e7=BigInt(0),te=BigInt(1),tt=BigInt(2),tr=BigInt(3),ti=BigInt(4),tn=BigInt(5),ts=BigInt(8);function ta(e,t){let r=e%t;return r>=e7?r:t+r}function to(e,t,r){let i=e;for(;t-- >e7;)i*=i,i%=r;return i}function tc(e,t){if(e===e7)throw Error("invert: expected non-zero number");if(t<=e7)throw Error("invert: expected positive modulus, got "+t);let r=ta(e,t),i=t,n=e7,s=te;for(;r!==e7;){let e=i/r,t=i%r,a=n-s*e;i=r,r=t,n=s,s=a}if(i!==te)throw Error("invert: does not exist");return ta(n,t)}let tl=(e,t)=>(ta(e,t)&te)===te,tu=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function td(e,t){let r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function th(e,t,r=!1,i={}){let n;if(e<=e7)throw Error("invalid field: expected ORDER > 0, got "+e);let{nBitLength:s,nByteLength:a}=td(e,t);if(a>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let o=Object.freeze({ORDER:e,isLE:r,BITS:s,BYTES:a,MASK:e5(s),ZERO:e7,ONE:te,create:t=>ta(t,e),isValid:t=>{if("bigint"!=typeof t)throw Error("invalid field element: expected bigint, got "+typeof t);return e7<=t&&te===e7,isOdd:e=>(e&te)===te,neg:t=>ta(-t,e),eql:(e,t)=>e===t,sqr:t=>ta(t*t,e),add:(t,r)=>ta(t+r,e),sub:(t,r)=>ta(t-r,e),mul:(t,r)=>ta(t*r,e),pow:(e,t)=>(function(e,t,r){if(re7;)r&te&&(i=e.mul(i,n)),n=e.sqr(n),r>>=te;return i})(o,e,t),div:(t,r)=>ta(t*tc(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>tc(t,e),sqrt:i.sqrt||(t=>(n||(n=function(e){if(e%ti===tr){let t=(e+te)/ti;return function(e,r){let i=e.pow(r,t);if(!e.eql(e.sqr(i),r))throw Error("Cannot find square root");return i}}if(e%ts===tn){let t=(e-tn)/ts;return function(e,r){let i=e.mul(r,tt),n=e.pow(i,t),s=e.mul(r,n),a=e.mul(e.mul(s,tt),n),o=e.mul(s,e.sub(a,e.ONE));if(!e.eql(e.sqr(o),r))throw Error("Cannot find square root");return o}}return function(e){let t,r,i;let n=(e-te)/tt;for(t=e-te,r=0;t%tt===e7;t/=tt,r++);for(i=tt;ie7;)t&te&&(i=i*e%r),e=e*e%r,t>>=te;return i}(i,n,e)!==e-te;i++)if(i>1e3)throw Error("Cannot find square root: likely non-prime P");if(1===r){let t=(e+te)/ti;return function(e,r){let i=e.pow(r,t);if(!e.eql(e.sqr(i),r))throw Error("Cannot find square root");return i}}let s=(t+te)/tt;return function(e,a){if(e.pow(a,n)===e.neg(e.ONE))throw Error("Cannot find square root");let o=r,c=e.pow(e.mul(e.ONE,i),t),l=e.pow(a,s),u=e.pow(a,t);for(;!e.eql(u,e.ONE);){if(e.eql(u,e.ZERO))return e.ZERO;let t=1;for(let r=e.sqr(u);t(function(e,t){let r=Array(t.length),i=t.reduce((t,i,n)=>e.is0(i)?t:(r[n]=t,e.mul(t,i)),e.ONE),n=e.inv(i);return t.reduceRight((t,i,n)=>e.is0(i)?t:(r[n]=e.mul(t,r[n]),e.mul(t,i)),n),r})(o,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?e0(e,a):eX(e,a),fromBytes:e=>{if(e.length!==a)throw Error("Field.fromBytes: expected "+a+" bytes, got "+e.length);return r?eJ(e):eK(eG(e))}});return Object.freeze(o)}let tf=BigInt(0),tp=BigInt(1);function tg(e,t){let r=t.negate();return e?r:t}function tm(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function tb(e,t){return tm(e,t),{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)}}let ty=new WeakMap,tw=new WeakMap;function tv(e){return tw.get(e)||1}let tA=BigInt(0),tE=BigInt(1),tC=BigInt(2),t_=BigInt(8),tI={zip215:!0};BigInt(0),BigInt(1);let tS=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),tN=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);let tT=BigInt(1),tP=BigInt(2);BigInt(3);let tx=BigInt(5),tO=BigInt(8),tR=th(tS,void 0,!0),tk=function(e){var t;let r=function(e){let t=(e4(e.Fp,tu.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),e4(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...td(e.n,e.nBitLength),...e,p:e.Fp.ORDER}));return e4(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:i,n:n,prehash:s,hash:a,randomBytes:o,nByteLength:c,h:l}=r,u=tC<{try{return{isValid:!0,value:i.sqrt(e*i.inv(t))}}catch{return{isValid:!1,value:tA}}}),p=r.adjustScalarBytes||(e=>e),g=r.domain||((e,t,r)=>{if(eW("phflag",r),t.length||r)throw Error("Contexts/pre-hash are not supported");return e});function m(e,t){e8("coordinate "+e,t,tA,u)}function b(e){if(!(e instanceof v))throw Error("ExtendedPoint expected")}let y=e9((e,t)=>{let{ex:r,ey:n,ez:s}=e,a=e.is0();null==t&&(t=a?t_:i.inv(s));let o=d(r*t),c=d(n*t),l=d(s*t);if(a)return{x:tA,y:tE};if(l!==tE)throw Error("invZ was invalid");return{x:o,y:c}}),w=e9(e=>{let{a:t,d:i}=r;if(e.is0())throw Error("bad point: ZERO");let{ex:n,ey:s,ez:a,et:o}=e,c=d(n*n),l=d(s*s),u=d(a*a),h=d(u*u),f=d(c*t);if(d(u*d(f+l))!==d(h+d(i*d(c*l))))throw Error("bad point: equation left != right (1)");if(d(n*s)!==d(a*o))throw Error("bad point: equation left != right (2)");return!0});class v{constructor(e,t,r,i){this.ex=e,this.ey=t,this.ez=r,this.et=i,m("x",e),m("y",t),m("z",r),m("t",i),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof v)throw Error("extended point not allowed");let{x:t,y:r}=e||{};return m("x",t),m("y",r),new v(t,r,tE,d(t*r))}static normalizeZ(e){let t=i.invertBatch(e.map(e=>e.ez));return e.map((e,r)=>e.toAffine(t[r])).map(v.fromAffine)}static msm(e,t){return function(e,t,r,i){if(function(e,t){if(!Array.isArray(e))throw Error("array expected");e.forEach((e,r)=>{if(!(e instanceof t))throw Error("invalid point at index "+r)})}(r,e),function(e,t){if(!Array.isArray(e))throw Error("array of scalars expected");e.forEach((e,r)=>{if(!t.isValid(e))throw Error("invalid scalar at index "+r)})}(i,t),r.length!==i.length)throw Error("arrays of points and scalars must have equal length");let n=e.ZERO,s=function(e){let t;for(t=0;e>e$;e>>=eF,t+=1);return t}(BigInt(r.length)),a=s>12?s-3:s>4?s-2:s?2:1,o=(1<=0;e-=a){c.fill(n);for(let t=0;t>BigInt(e)&BigInt(o));c[n]=c[n].add(r[t])}let t=n;for(let e=c.length-1,r=n;e>0;e--)r=r.add(c[e]),t=t.add(r);if(u=u.add(t),0!==e)for(let e=0;e1!==tv(e),unsafeLadder(e,t,r=v.ZERO){let i=e;for(;t>tf;)t&tp&&(r=r.add(i)),i=i.double(),t>>=tp;return r},precomputeWindow(e,r){let{windows:i,windowSize:n}=tb(r,t),s=[],a=e,o=a;for(let e=0;e>=u,n>s&&(n-=l,i+=tp);let d=t+Math.abs(n)-1,h=e%2!=0,f=n<0;0===n?o=o.add(tg(h,r[t])):a=a.add(tg(f,r[d]))}return{p:a,f:o}},wNAFUnsafe(e,r,i,n=v.ZERO){let{windows:s,windowSize:a}=tb(e,t),o=BigInt(2**e-1),c=2**e,l=BigInt(e);for(let e=0;e>=l,s>a&&(s-=c,i+=tp),0===s)continue;let u=r[t+Math.abs(s)-1];s<0&&(u=u.negate()),n=n.add(u)}return n},getPrecomputes(e,t,r){let i=ty.get(t);return i||(i=this.precomputeWindow(t,e),1!==e&&ty.set(t,r(i))),i},wNAFCached(e,t,r){let i=tv(e);return this.wNAF(i,this.getPrecomputes(i,e,r),t)},wNAFCachedUnsafe(e,t,r,i){let n=tv(e);return 1===n?this.unsafeLadder(e,t,i):this.wNAFUnsafe(n,this.getPrecomputes(n,e,r),t,i)},setWindowSize(e,r){tm(r,t),tw.set(e,r),ty.delete(e)}});function _(e){let t=i.BYTES;e=e1("private key",e,t);let r=e1("hashed private key",a(e),2*t),s=p(r.slice(0,t)),o=r.slice(t,2*t),c=ta(eJ(s),n),l=A.multiply(c),u=l.toRawBytes();return{head:s,prefix:o,scalar:c,point:l,pointBytes:u}}function I(e=new Uint8Array,...t){return ta(eJ(a(g(e2(...t),e1("context",e),!!s))),n)}return A._setWindowSize(8),{CURVE:r,getPublicKey:function(e){return _(e).pointBytes},sign:function(e,t,r={}){e=e1("message",e),s&&(e=s(e));let{prefix:a,scalar:o,pointBytes:c}=_(t),l=I(r.context,a,e),u=A.multiply(l).toRawBytes(),d=ta(l+I(r.context,u,c,e)*o,n);return e8("signature.s",d,tA,n),e1("result",e2(u,e0(d,i.BYTES)),2*i.BYTES)},verify:function(e,t,r,n=tI){let a,o,c;let{context:l,zip215:u}=n,d=i.BYTES;e=e1("signature",e,2*d),t=e1("message",t),r=e1("publicKey",r,d),void 0!==u&&eW("zip215",u),s&&(t=s(t));let h=eJ(e.slice(d,2*d));try{a=v.fromHex(r,u),o=v.fromHex(e.slice(0,d),u),c=A.multiplyUnsafe(h)}catch{return!1}if(!u&&a.isSmallOrder())return!1;let f=I(l,o.toRawBytes(),a.toRawBytes(),t);return o.add(a.multiplyUnsafe(f)).subtract(c).clearCofactor().equals(v.ZERO)},ExtendedPoint:v,utils:{getExtendedPublicKey:_,randomPrivateKey:()=>o(i.BYTES),precompute:(e=8,t=v.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}}({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:tR,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:tO,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:ej,randomBytes:eP,adjustScalarBytes:function(e){return e[0]&=248,e[31]&=127,e[31]|=64,e},uvRatio:function(e,t){let r=ta(t*t*t,tS),i=function(e){let t=BigInt(10),r=BigInt(20),i=BigInt(40),n=BigInt(80),s=e*e%tS*e%tS,a=to(s,tP,tS)*s%tS,o=to(a,tT,tS)*e%tS,c=to(o,tx,tS)*o%tS,l=to(c,t,tS)*c%tS,u=to(l,r,tS)*l%tS,d=to(u,i,tS)*u%tS,h=to(d,n,tS)*d%tS,f=to(h,n,tS)*d%tS,p=to(f,t,tS)*c%tS;return{pow_p_5_8:to(p,tP,tS)*e%tS,b2:s}}(e*ta(r*r*t,tS)).pow_p_5_8,n=ta(e*r*i,tS),s=ta(t*n*n,tS),a=n,o=ta(n*tN,tS),c=s===e,l=s===ta(-e,tS),u=s===ta(-e*tN,tS);return c&&(n=a),(l||u)&&(n=o),tl(n,tS)&&(n=ta(-n,tS)),{isValid:c||l,value:n}}}),tD="base64url",tM="utf8",tU="utf8",tL="base58btc";function tB(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function tj(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?tB(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function t$(e,t){t||(t=e.reduce((e,t)=>e+t.length,0));let r=tj(t),i=0;for(let t of e)r.set(t,i),i+=t.length;return tB(r)}var tF=function(e,t){if(e.length>=255)throw TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i>>0,a=new Uint8Array(s);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var d=0,h=s-1;(0!==u||d>>0,a[h]=u%256>>>0,u=u/256>>>0;if(0!==u)throw Error("Non-zero carry");n=d,t++}if(" "!==e[t]){for(var f=s-n;f!==s&&0===a[f];)f++;for(var p=new Uint8Array(i+(s-f)),g=i;f!==s;)p[g++]=a[f++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,i=0,n=0,s=t.length;n!==s&&0===t[n];)n++,r++;for(var a=(s-n)*u+1>>>0,l=new Uint8Array(a);n!==s;){for(var d=t[n],h=0,f=a-1;(0!==d||h>>0,l[f]=d%o>>>0,d=d/o>>>0;if(0!==d)throw Error("Non-zero carry");i=h,n++}for(var p=a-i;p!==a&&0===l[p];)p++;for(var g=c.repeat(r);p{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error("Unknown type, must be binary type")},tz=e=>new TextEncoder().encode(e),tH=e=>new TextDecoder().decode(e);class tW{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class tV{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return tK(this,e)}}class tG{constructor(e){this.decoders=e}or(e){return tK(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}let tK=(e,t)=>new tG({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class tQ{constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new tW(e,t,r),this.decoder=new tV(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}let tY=({name:e,prefix:t,encode:r,decode:i})=>new tQ(e,t,r,i),tZ=({prefix:e,name:t,alphabet:r})=>{let{encode:i,decode:n}=tF(r,t);return tY({prefix:e,name:t,encode:i,decode:e=>tq(n(e))})},tJ=(e,t,r,i)=>{let n={};for(let e=0;e=8&&(o-=8,a[l++]=255&c>>o)}if(o>=r||255&c<<8-o)throw SyntaxError("Unexpected end of data");return a},tX=(e,t,r)=>{let i="="===t[t.length-1],n=(1<r;)a-=r,s+=t[n&o>>a];if(a&&(s+=t[n&o<tY({prefix:t,name:e,encode:e=>tX(e,i,r),decode:t=>tJ(t,i,r,e)});var t1=Object.freeze({__proto__:null,identity:tY({prefix:"\0",name:"identity",encode:e=>tH(e),decode:e=>tz(e)})}),t2=Object.freeze({__proto__:null,base2:t0({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})}),t3=Object.freeze({__proto__:null,base8:t0({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})}),t8=Object.freeze({__proto__:null,base10:tZ({prefix:"9",name:"base10",alphabet:"0123456789"})}),t5=Object.freeze({__proto__:null,base16:t0({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper:t0({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});let t6=t0({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),t4=t0({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),t9=t0({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),t7=t0({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),re=t0({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),rt=t0({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5});var rr=Object.freeze({__proto__:null,base32:t6,base32upper:t4,base32pad:t9,base32padupper:t7,base32hex:re,base32hexupper:rt,base32hexpad:t0({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper:t0({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z:t0({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})}),ri=Object.freeze({__proto__:null,base36:tZ({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper:tZ({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})}),rn=Object.freeze({__proto__:null,base58btc:tZ({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr:tZ({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});let rs=t0({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6});var ra=Object.freeze({__proto__:null,base64:rs,base64pad:t0({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url:t0({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad:t0({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});let ro=Array.from("\uD83D\uDE80\uD83E\uDE90☄\uD83D\uDEF0\uD83C\uDF0C\uD83C\uDF11\uD83C\uDF12\uD83C\uDF13\uD83C\uDF14\uD83C\uDF15\uD83C\uDF16\uD83C\uDF17\uD83C\uDF18\uD83C\uDF0D\uD83C\uDF0F\uD83C\uDF0E\uD83D\uDC09☀\uD83D\uDCBB\uD83D\uDDA5\uD83D\uDCBE\uD83D\uDCBF\uD83D\uDE02❤\uD83D\uDE0D\uD83E\uDD23\uD83D\uDE0A\uD83D\uDE4F\uD83D\uDC95\uD83D\uDE2D\uD83D\uDE18\uD83D\uDC4D\uD83D\uDE05\uD83D\uDC4F\uD83D\uDE01\uD83D\uDD25\uD83E\uDD70\uD83D\uDC94\uD83D\uDC96\uD83D\uDC99\uD83D\uDE22\uD83E\uDD14\uD83D\uDE06\uD83D\uDE44\uD83D\uDCAA\uD83D\uDE09☺\uD83D\uDC4C\uD83E\uDD17\uD83D\uDC9C\uD83D\uDE14\uD83D\uDE0E\uD83D\uDE07\uD83C\uDF39\uD83E\uDD26\uD83C\uDF89\uD83D\uDC9E✌✨\uD83E\uDD37\uD83D\uDE31\uD83D\uDE0C\uD83C\uDF38\uD83D\uDE4C\uD83D\uDE0B\uD83D\uDC97\uD83D\uDC9A\uD83D\uDE0F\uD83D\uDC9B\uD83D\uDE42\uD83D\uDC93\uD83E\uDD29\uD83D\uDE04\uD83D\uDE00\uD83D\uDDA4\uD83D\uDE03\uD83D\uDCAF\uD83D\uDE48\uD83D\uDC47\uD83C\uDFB6\uD83D\uDE12\uD83E\uDD2D❣\uD83D\uDE1C\uD83D\uDC8B\uD83D\uDC40\uD83D\uDE2A\uD83D\uDE11\uD83D\uDCA5\uD83D\uDE4B\uD83D\uDE1E\uD83D\uDE29\uD83D\uDE21\uD83E\uDD2A\uD83D\uDC4A\uD83E\uDD73\uD83D\uDE25\uD83E\uDD24\uD83D\uDC49\uD83D\uDC83\uD83D\uDE33✋\uD83D\uDE1A\uD83D\uDE1D\uD83D\uDE34\uD83C\uDF1F\uD83D\uDE2C\uD83D\uDE43\uD83C\uDF40\uD83C\uDF37\uD83D\uDE3B\uD83D\uDE13⭐✅\uD83E\uDD7A\uD83C\uDF08\uD83D\uDE08\uD83E\uDD18\uD83D\uDCA6✔\uD83D\uDE23\uD83C\uDFC3\uD83D\uDC90☹\uD83C\uDF8A\uD83D\uDC98\uD83D\uDE20☝\uD83D\uDE15\uD83C\uDF3A\uD83C\uDF82\uD83C\uDF3B\uD83D\uDE10\uD83D\uDD95\uD83D\uDC9D\uD83D\uDE4A\uD83D\uDE39\uD83D\uDDE3\uD83D\uDCAB\uD83D\uDC80\uD83D\uDC51\uD83C\uDFB5\uD83E\uDD1E\uD83D\uDE1B\uD83D\uDD34\uD83D\uDE24\uD83C\uDF3C\uD83D\uDE2B⚽\uD83E\uDD19☕\uD83C\uDFC6\uD83E\uDD2B\uD83D\uDC48\uD83D\uDE2E\uD83D\uDE46\uD83C\uDF7B\uD83C\uDF43\uD83D\uDC36\uD83D\uDC81\uD83D\uDE32\uD83C\uDF3F\uD83E\uDDE1\uD83C\uDF81⚡\uD83C\uDF1E\uD83C\uDF88❌✊\uD83D\uDC4B\uD83D\uDE30\uD83E\uDD28\uD83D\uDE36\uD83E\uDD1D\uD83D\uDEB6\uD83D\uDCB0\uD83C\uDF53\uD83D\uDCA2\uD83E\uDD1F\uD83D\uDE41\uD83D\uDEA8\uD83D\uDCA8\uD83E\uDD2C✈\uD83C\uDF80\uD83C\uDF7A\uD83E\uDD13\uD83D\uDE19\uD83D\uDC9F\uD83C\uDF31\uD83D\uDE16\uD83D\uDC76\uD83E\uDD74▶➡❓\uD83D\uDC8E\uD83D\uDCB8⬇\uD83D\uDE28\uD83C\uDF1A\uD83E\uDD8B\uD83D\uDE37\uD83D\uDD7A⚠\uD83D\uDE45\uD83D\uDE1F\uD83D\uDE35\uD83D\uDC4E\uD83E\uDD32\uD83E\uDD20\uD83E\uDD27\uD83D\uDCCC\uD83D\uDD35\uD83D\uDC85\uD83E\uDDD0\uD83D\uDC3E\uD83C\uDF52\uD83D\uDE17\uD83E\uDD11\uD83C\uDF0A\uD83E\uDD2F\uD83D\uDC37☎\uD83D\uDCA7\uD83D\uDE2F\uD83D\uDC86\uD83D\uDC46\uD83C\uDFA4\uD83D\uDE47\uD83C\uDF51❄\uD83C\uDF34\uD83D\uDCA3\uD83D\uDC38\uD83D\uDC8C\uD83D\uDCCD\uD83E\uDD40\uD83E\uDD22\uD83D\uDC45\uD83D\uDCA1\uD83D\uDCA9\uD83D\uDC50\uD83D\uDCF8\uD83D\uDC7B\uD83E\uDD10\uD83E\uDD2E\uD83C\uDFBC\uD83E\uDD75\uD83D\uDEA9\uD83C\uDF4E\uD83C\uDF4A\uD83D\uDC7C\uD83D\uDC8D\uD83D\uDCE3\uD83E\uDD42"),rc=ro.reduce((e,t,r)=>(e[r]=t,e),[]),rl=ro.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);var ru=Object.freeze({__proto__:null,base256emoji:tY({prefix:"\uD83D\uDE80",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>e+=rc[t],"")},decode:function(e){let t=[];for(let r of e){let e=rl[r.codePointAt(0)];if(void 0===e)throw Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}})});function rd(e,t){var r,i=0,t=t||0,n=0,s=t,a=e.length;do{if(s>=a)throw rd.bytes=0,RangeError("Could not decode varint");r=e[s++],i+=n<28?(127&r)<=128);return rd.bytes=s-t,i}var rh=function e(t,r,i){r=r||[],i=i||0;for(var n=i;t>=2147483648;)r[i++]=255&t|128,t/=128;for(;-128&t;)r[i++]=255&t|128,t>>>=7;return r[i]=0|t,e.bytes=i-n+1,r};let rf=(e,t,r=0)=>(rh(e,t,r),t),rp=e=>e<128?1:e<16384?2:e<2097152?3:e<268435456?4:e<34359738368?5:e<4398046511104?6:e<562949953421312?7:e<72057594037927940?8:e<0x7fffffffffffffff?9:10,rg=(e,t)=>{let r=t.byteLength,i=rp(e),n=i+rp(r),s=new Uint8Array(n+r);return rf(e,s,0),rf(r,s,i),s.set(t,n),new rm(e,r,t,s)};class rm{constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i}}let rb=({name:e,code:t,encode:r})=>new ry(e,t,r);class ry{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?rg(this.code,t):t.then(e=>rg(this.code,e))}throw Error("Unknown type, must be binary type")}}let rw=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t));var rv=Object.freeze({__proto__:null,sha256:rb({name:"sha2-256",code:18,encode:rw("SHA-256")}),sha512:rb({name:"sha2-512",code:19,encode:rw("SHA-512")})}),rA=Object.freeze({__proto__:null,identity:{code:0,name:"identity",encode:tq,digest:e=>rg(0,tq(e))}});new TextEncoder,new TextDecoder;let rE={...t1,...t2,...t3,...t8,...t5,...rr,...ri,...rn,...ra,...ru};function rC(e,t,r,i){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:i}}}({...rv,...rA});let r_=rC("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),rI=rC("ascii","a",e=>{let t="a";for(let r=0;r{let t=tj((e=e.substring(1)).length);for(let r=0;rt?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${rG}`};class rQ extends Error{constructor(e,t={}){let r=t.cause instanceof rQ?t.cause.details:t.cause?.message?t.cause.message:t.details,i=t.cause instanceof rQ&&t.cause.docsPath||t.docsPath,n=rK.getDocsUrl?.({...t,docsPath:i});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...n?[`Docs: ${n}`]:[],...r?[`Details: ${r}`]:[],...rK.version?[`Version: ${rK.version}`]:[]].join("\n"),t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=i,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=rG}walk(e){return function e(t,r){return r?.(t)?t:t&&"object"==typeof t&&"cause"in t&&void 0!==t.cause?e(t.cause,r):r?null:t}(this,e)}}function rY(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}class rZ extends rQ{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"})}}function rJ(e,{dir:t,size:r=32}={}){return"string"==typeof e?function(e,{dir:t,size:r=32}={}){if(null===r)return e;let i=e.replace("0x","");if(i.length>2*r)throw new rZ({size:Math.ceil(i.length/2),targetSize:r,type:"hex"});return`0x${i["right"===t?"padEnd":"padStart"](2*r,"0")}`}(e,{dir:t,size:r}):function(e,{dir:t,size:r=32}={}){if(null===r)return e;if(e.length>r)throw new rZ({size:e.length,targetSize:r,type:"bytes"});let i=new Uint8Array(r);for(let n=0;nt)throw new r0({givenSize:r1(e),maxSize:t})}function r3(e,t={}){let{signed:r}=t;t.size&&r2(e,{size:t.size});let i=BigInt(e);if(!r)return i;let n=(e.length-2)/2;return i<=(1n<<8n*BigInt(n)-1n)-1n?i:i-BigInt(`0x${"f".padStart(2*n,"f")}`)-1n}let r8=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function r5(e,t={}){return"number"==typeof e||"bigint"==typeof e?r4(e,t):"string"==typeof e?function(e,t={}){return r6(r9.encode(e),t)}(e,t):"boolean"==typeof e?function(e,t={}){let r=`0x${Number(e)}`;return"number"==typeof t.size?(r2(r,{size:t.size}),rJ(r,{size:t.size})):r}(e,t):r6(e,t)}function r6(e,t={}){let r="";for(let t=0;tr||s=ie.zero&&e<=ie.nine?e-ie.zero:e>=ie.A&&e<=ie.F?e-(ie.A-10):e>=ie.a&&e<=ie.f?e-(ie.a-10):void 0}function ir(e,t={}){let r=e;t.size&&(r2(r,{size:t.size}),r=rJ(r,{dir:"right",size:t.size}));let i=r.slice(2);i.length%2&&(i=`0${i}`);let n=i.length/2,s=new Uint8Array(n);for(let e=0,t=0;ee<>>32-r,il=(e,t,r)=>t<>>32-r,iu=(e,t,r)=>t<>>64-r,id=(e,t,r)=>e<>>64-r;var ih=r(62216);let ip=[],ig=[],im=[],ib=BigInt(0),iy=BigInt(1),iw=BigInt(2),iv=BigInt(7),iA=BigInt(256),iE=BigInt(113);for(let e=0,t=iy,r=1,i=0;e<24;e++){[r,i]=[i,(2*r+3*i)%5],ip.push(2*(5*i+r)),ig.push((e+1)*(e+2)/2%64);let n=ib;for(let e=0;e<7;e++)(t=(t<>iv)*iE)%iA)&iw&&(n^=iy<<(iy<>io&ia)}:{h:0|Number(e>>io&ia),l:0|Number(e&ia)}}(e[n],t);[r[n],i[n]]=[s,a]}return[r,i]}(im,!0),iI=(e,t,r)=>r>32?iu(e,t,r):ic(e,t,r),iS=(e,t,r)=>r>32?id(e,t,r):il(e,t,r);class iN extends ih.kb{constructor(e,t,r,i=!1,n=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=i,this.rounds=n,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,is.k8)(r),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,ih.Jq)(this.state)}keccak(){ih.iA||(0,ih.l1)(this.state32),function(e,t=24){let r=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let i=(t+8)%10,n=(t+2)%10,s=r[n],a=r[n+1],o=iI(s,a,1)^r[i],c=iS(s,a,1)^r[i+1];for(let r=0;r<50;r+=10)e[t+r]^=o,e[t+r+1]^=c}let t=e[2],n=e[3];for(let r=0;r<24;r++){let i=ig[r],s=iI(t,n,i),a=iS(t,n,i),o=ip[r];t=e[o],n=e[o+1],e[o]=s,e[o+1]=a}for(let t=0;t<50;t+=10){for(let i=0;i<10;i++)r[i]=e[t+i];for(let i=0;i<10;i++)e[t+i]^=~r[(i+2)%10]&r[(i+4)%10]}e[0]^=iC[i],e[1]^=i_[i]}r.fill(0)}(this.state32,this.rounds),ih.iA||(0,ih.l1)(this.state32),this.posOut=0,this.pos=0}update(e){(0,is.$h)(this);let{blockLen:t,state:r}=this,i=(e=(0,ih.O0)(e)).length;for(let n=0;n=r&&this.keccak();let s=Math.min(r-this.posOut,n-i);e.set(t.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,is.k8)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,is.eB)(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:i,rounds:n,enableXOF:s}=this;return e||(e=new iN(t,r,i,s,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=i,e.enableXOF=s,e.destroyed=this.destroyed,e}}let iT=(0,ih.hE)(()=>new iN(136,1,32));function iP(e,t){let r=iT(rY(e,{strict:!1})?function(e,t={}){return"number"==typeof e||"bigint"==typeof e?ir(r4(e,t)):"boolean"==typeof e?function(e,t={}){let r=new Uint8Array(1);return(r[0]=Number(e),"number"==typeof t.size)?(r2(r,{size:t.size}),rJ(r,{size:t.size})):r}(e,t):rY(e)?ir(e,t):ii(e,t)}(e):e);return"bytes"===(t||"hex")?r:r5(r)}class ix extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&void 0!==t&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=this.keys().next().value;e&&this.delete(e)}return this}}let iO=new ix(8192);async function iR({hash:e,signature:t}){let i=rY(e)?e:r5(e),{secp256k1:n}=await r.e(1610).then(r.bind(r,1610)),s=(()=>{if("object"==typeof t&&"r"in t&&"s"in t){let{r:e,s:r,v:i,yParity:s}=t,a=ik(Number(s??i));return new n.Signature(r3(e),r3(r)).addRecoveryBit(a)}let e=rY(t)?t:r5(t),r=ik(function(e,t={}){return Number(r3(e,t))}(`0x${e.slice(130)}`));return n.Signature.fromCompact(e.substring(2,130)).addRecoveryBit(r)})().recoverPublicKey(i.substring(2)).toHex(!1);return`0x${s}`}function ik(e){if(0===e||1===e)return e;if(27===e)return 0;if(28===e)return 1;throw Error("Invalid yParityOrV value")}async function iD({hash:e,signature:t}){return function(e){let t=iP(`0x${e.substring(4)}`).substring(26);return function(e,t){if(iO.has(`${e}.undefined`))return iO.get(`${e}.undefined`);let r=e.substring(2).toLowerCase(),i=iP(ii(r),"bytes"),n=(t?r.substring(`${t}0x`.length):r).split("");for(let e=0;e<40;e+=2)i[e>>1]>>4>=8&&n[e]&&(n[e]=n[e].toUpperCase()),(15&i[e>>1])>=8&&n[e+1]&&(n[e+1]=n[e+1].toUpperCase());let s=`0x${n.join("")}`;return iO.set(`${e}.${t}`,s),s}(`0x${t}`)}(await iR({hash:e,signature:t}))}var iM=function(e){if(e.length>=255)throw TypeError("Alphabet too long");let t=new Uint8Array(256);for(let e=0;e>>0,l=new Uint8Array(c);for(;e[s];){let i=t[e.charCodeAt(s)];if(255===i)return;let n=0;for(let e=c-1;(0!==i||n>>0,l[e]=i%256>>>0,i=i/256>>>0;if(0!==i)throw Error("Non-zero carry");o=n,s++}let u=c-o;for(;u!==c&&0===l[u];)u++;let d=new Uint8Array(a+(c-u)),h=a;for(;u!==c;)d[h++]=l[u++];return d}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError("Expected Uint8Array");if(0===t.length)return"";let n=0,a=0,o=0,c=t.length;for(;o!==c&&0===t[o];)o++,n++;let l=(c-o)*s+1>>>0,u=new Uint8Array(l);for(;o!==c;){let e=t[o],i=0;for(let t=l-1;(0!==e||i>>0,u[t]=e%r>>>0,e=e/r>>>0;if(0!==e)throw Error("Non-zero carry");a=i,o++}let d=l-a;for(;d!==l&&0===u[d];)d++;let h=i.repeat(n);for(;de+t.length,0));let r=iU(t),i=0;for(let t of e)r.set(t,i),i+=t.length;return r}var iB=function(e,t){if(e.length>=255)throw TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i>>0,a=new Uint8Array(s);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var d=0,h=s-1;(0!==u||d>>0,a[h]=u%256>>>0,u=u/256>>>0;if(0!==u)throw Error("Non-zero carry");n=d,t++}if(" "!==e[t]){for(var f=s-n;f!==s&&0===a[f];)f++;for(var p=new Uint8Array(i+(s-f)),g=i;f!==s;)p[g++]=a[f++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,i=0,n=0,s=t.length;n!==s&&0===t[n];)n++,r++;for(var a=(s-n)*u+1>>>0,l=new Uint8Array(a);n!==s;){for(var d=t[n],h=0,f=a-1;(0!==d||h>>0,l[f]=d%o>>>0,d=d/o>>>0;if(0!==d)throw Error("Non-zero carry");i=h,n++}for(var p=a-i;p!==a&&0===l[p];)p++;for(var g=c.repeat(r);p{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error("Unknown type, must be binary type")},iF=e=>new TextEncoder().encode(e),iq=e=>new TextDecoder().decode(e);class iz{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class iH{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return iV(this,e)}}class iW{constructor(e){this.decoders=e}or(e){return iV(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}let iV=(e,t)=>new iW({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class iG{constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new iz(e,t,r),this.decoder=new iH(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}let iK=({name:e,prefix:t,encode:r,decode:i})=>new iG(e,t,r,i),iQ=({prefix:e,name:t,alphabet:r})=>{let{encode:i,decode:n}=iB(r,t);return iK({prefix:e,name:t,encode:i,decode:e=>i$(n(e))})},iY=(e,t,r,i)=>{let n={};for(let e=0;e=8&&(o-=8,a[l++]=255&c>>o)}if(o>=r||255&c<<8-o)throw SyntaxError("Unexpected end of data");return a},iZ=(e,t,r)=>{let i="="===t[t.length-1],n=(1<r;)a-=r,s+=t[n&o>>a];if(a&&(s+=t[n&o<iK({prefix:t,name:e,encode:e=>iZ(e,i,r),decode:t=>iY(t,i,r,e)}),iX=iK({prefix:"\0",name:"identity",encode:e=>iq(e),decode:e=>iF(e)}),i0=iJ({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),i1=iJ({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),i2=iQ({prefix:"9",name:"base10",alphabet:"0123456789"}),i3=iJ({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),i8=iJ({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),i5=iJ({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),i6=iJ({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),i4=iJ({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),i9=iJ({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),i7=iJ({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ne=iJ({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),nt=iJ({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),nr=iJ({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ni=iJ({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),nn=iQ({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ns=iQ({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),na=iQ({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),no=iQ({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),nc=iJ({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),nl=iJ({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),nu=iJ({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),nd=iJ({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),nh=Array.from("\uD83D\uDE80\uD83E\uDE90☄\uD83D\uDEF0\uD83C\uDF0C\uD83C\uDF11\uD83C\uDF12\uD83C\uDF13\uD83C\uDF14\uD83C\uDF15\uD83C\uDF16\uD83C\uDF17\uD83C\uDF18\uD83C\uDF0D\uD83C\uDF0F\uD83C\uDF0E\uD83D\uDC09☀\uD83D\uDCBB\uD83D\uDDA5\uD83D\uDCBE\uD83D\uDCBF\uD83D\uDE02❤\uD83D\uDE0D\uD83E\uDD23\uD83D\uDE0A\uD83D\uDE4F\uD83D\uDC95\uD83D\uDE2D\uD83D\uDE18\uD83D\uDC4D\uD83D\uDE05\uD83D\uDC4F\uD83D\uDE01\uD83D\uDD25\uD83E\uDD70\uD83D\uDC94\uD83D\uDC96\uD83D\uDC99\uD83D\uDE22\uD83E\uDD14\uD83D\uDE06\uD83D\uDE44\uD83D\uDCAA\uD83D\uDE09☺\uD83D\uDC4C\uD83E\uDD17\uD83D\uDC9C\uD83D\uDE14\uD83D\uDE0E\uD83D\uDE07\uD83C\uDF39\uD83E\uDD26\uD83C\uDF89\uD83D\uDC9E✌✨\uD83E\uDD37\uD83D\uDE31\uD83D\uDE0C\uD83C\uDF38\uD83D\uDE4C\uD83D\uDE0B\uD83D\uDC97\uD83D\uDC9A\uD83D\uDE0F\uD83D\uDC9B\uD83D\uDE42\uD83D\uDC93\uD83E\uDD29\uD83D\uDE04\uD83D\uDE00\uD83D\uDDA4\uD83D\uDE03\uD83D\uDCAF\uD83D\uDE48\uD83D\uDC47\uD83C\uDFB6\uD83D\uDE12\uD83E\uDD2D❣\uD83D\uDE1C\uD83D\uDC8B\uD83D\uDC40\uD83D\uDE2A\uD83D\uDE11\uD83D\uDCA5\uD83D\uDE4B\uD83D\uDE1E\uD83D\uDE29\uD83D\uDE21\uD83E\uDD2A\uD83D\uDC4A\uD83E\uDD73\uD83D\uDE25\uD83E\uDD24\uD83D\uDC49\uD83D\uDC83\uD83D\uDE33✋\uD83D\uDE1A\uD83D\uDE1D\uD83D\uDE34\uD83C\uDF1F\uD83D\uDE2C\uD83D\uDE43\uD83C\uDF40\uD83C\uDF37\uD83D\uDE3B\uD83D\uDE13⭐✅\uD83E\uDD7A\uD83C\uDF08\uD83D\uDE08\uD83E\uDD18\uD83D\uDCA6✔\uD83D\uDE23\uD83C\uDFC3\uD83D\uDC90☹\uD83C\uDF8A\uD83D\uDC98\uD83D\uDE20☝\uD83D\uDE15\uD83C\uDF3A\uD83C\uDF82\uD83C\uDF3B\uD83D\uDE10\uD83D\uDD95\uD83D\uDC9D\uD83D\uDE4A\uD83D\uDE39\uD83D\uDDE3\uD83D\uDCAB\uD83D\uDC80\uD83D\uDC51\uD83C\uDFB5\uD83E\uDD1E\uD83D\uDE1B\uD83D\uDD34\uD83D\uDE24\uD83C\uDF3C\uD83D\uDE2B⚽\uD83E\uDD19☕\uD83C\uDFC6\uD83E\uDD2B\uD83D\uDC48\uD83D\uDE2E\uD83D\uDE46\uD83C\uDF7B\uD83C\uDF43\uD83D\uDC36\uD83D\uDC81\uD83D\uDE32\uD83C\uDF3F\uD83E\uDDE1\uD83C\uDF81⚡\uD83C\uDF1E\uD83C\uDF88❌✊\uD83D\uDC4B\uD83D\uDE30\uD83E\uDD28\uD83D\uDE36\uD83E\uDD1D\uD83D\uDEB6\uD83D\uDCB0\uD83C\uDF53\uD83D\uDCA2\uD83E\uDD1F\uD83D\uDE41\uD83D\uDEA8\uD83D\uDCA8\uD83E\uDD2C✈\uD83C\uDF80\uD83C\uDF7A\uD83E\uDD13\uD83D\uDE19\uD83D\uDC9F\uD83C\uDF31\uD83D\uDE16\uD83D\uDC76\uD83E\uDD74▶➡❓\uD83D\uDC8E\uD83D\uDCB8⬇\uD83D\uDE28\uD83C\uDF1A\uD83E\uDD8B\uD83D\uDE37\uD83D\uDD7A⚠\uD83D\uDE45\uD83D\uDE1F\uD83D\uDE35\uD83D\uDC4E\uD83E\uDD32\uD83E\uDD20\uD83E\uDD27\uD83D\uDCCC\uD83D\uDD35\uD83D\uDC85\uD83E\uDDD0\uD83D\uDC3E\uD83C\uDF52\uD83D\uDE17\uD83E\uDD11\uD83C\uDF0A\uD83E\uDD2F\uD83D\uDC37☎\uD83D\uDCA7\uD83D\uDE2F\uD83D\uDC86\uD83D\uDC46\uD83C\uDFA4\uD83D\uDE47\uD83C\uDF51❄\uD83C\uDF34\uD83D\uDCA3\uD83D\uDC38\uD83D\uDC8C\uD83D\uDCCD\uD83E\uDD40\uD83E\uDD22\uD83D\uDC45\uD83D\uDCA1\uD83D\uDCA9\uD83D\uDC50\uD83D\uDCF8\uD83D\uDC7B\uD83E\uDD10\uD83E\uDD2E\uD83C\uDFBC\uD83E\uDD75\uD83D\uDEA9\uD83C\uDF4E\uD83C\uDF4A\uD83D\uDC7C\uD83D\uDC8D\uD83D\uDCE3\uD83E\uDD42"),nf=nh.reduce((e,t,r)=>(e[r]=t,e),[]),np=nh.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]),ng=iK({prefix:"\uD83D\uDE80",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>e+=nf[t],"")},decode:function(e){let t=[];for(let r of e){let e=np[r.codePointAt(0)];if(void 0===e)throw Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}});var nm=function e(t,r,i){r=r||[];for(var n=i=i||0;t>=2147483648;)r[i++]=255&t|128,t/=128;for(;-128&t;)r[i++]=255&t|128,t>>>=7;return r[i]=0|t,e.bytes=i-n+1,r},nb=function e(t,r){var i,n=0,r=r||0,s=0,a=r,o=t.length;do{if(a>=o)throw e.bytes=0,RangeError("Could not decode varint");i=t[a++],n+=s<28?(127&i)<=128);return e.bytes=a-r,n};let ny=(e,t=0)=>[nb(e,t),nb.bytes],nw=(e,t,r=0)=>(nm(e,t,r),t),nv=e=>e<128?1:e<16384?2:e<2097152?3:e<268435456?4:e<34359738368?5:e<4398046511104?6:e<562949953421312?7:e<72057594037927940?8:e<0x7fffffffffffffff?9:10,nA=(e,t)=>{let r=t.byteLength,i=nv(e),n=i+nv(r),s=new Uint8Array(n+r);return nw(e,s,0),nw(r,s,i),s.set(t,n),new n_(e,r,t,s)},nE=e=>{let t=i$(e),[r,i]=ny(t),[n,s]=ny(t.subarray(i)),a=t.subarray(i+s);if(a.byteLength!==n)throw Error("Incorrect length");return new n_(r,n,a,t)},nC=(e,t)=>e===t||e.code===t.code&&e.size===t.size&&ij(e.bytes,t.bytes);class n_{constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i}}let nI=({name:e,code:t,encode:r})=>new nS(e,t,r);class nS{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?nA(this.code,t):t.then(e=>nA(this.code,e))}throw Error("Unknown type, must be binary type")}}let nN=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),nT=nI({name:"sha2-256",code:18,encode:nN("SHA-256")}),nP=nI({name:"sha2-512",code:19,encode:nN("SHA-512")}),nx={code:0,name:"identity",encode:i$,digest:e=>nA(0,i$(e))},nO="raw",nR=85,nk=e=>i$(e),nD=e=>i$(e),nM=new TextEncoder,nU=new TextDecoder,nL="json",nB=512,nj=e=>nM.encode(JSON.stringify(e)),n$=e=>JSON.parse(nU.decode(e));class nF{constructor(e,t,r,i){this.code=t,this.version=e,this.multihash=r,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:nY,byteLength:nY,code:nQ,version:nQ,multihash:nQ,bytes:nQ,_baseCache:nY,asCID:nY})}toV0(){if(0===this.version)return this;{let{code:e,multihash:t}=this;if(e!==nW)throw Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==nV)throw Error("Cannot convert non sha2-256 multihash CID to CIDv0");return nF.createV0(t)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,r=nA(e,t);return nF.createV1(this.code,r)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&nC(this.multihash,e.multihash)}toString(e){let{bytes:t,version:r,_baseCache:i}=this;return 0===r?nz(t,i,e||na.encoder):nH(t,i,e||i5.encoder)}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return nZ(/^0\.0/,nJ),!!(e&&(e[nK]||e.asCID===e))}get toBaseEncodedString(){throw Error("Deprecated, use .toString()")}get codec(){throw Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw Error('"multibaseName" property is deprecated')}get prefix(){throw Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof nF)return e;if(null!=e&&e.asCID===e){let{version:t,code:r,multihash:i,bytes:n}=e;return new nF(t,r,i,n||nG(t,r,i.bytes))}if(null==e||!0!==e[nK])return null;{let{version:t,multihash:r,code:i}=e,n=nE(r);return nF.create(t,i,n)}}static create(e,t,r){if("number"!=typeof t)throw Error("String codecs are no longer supported");switch(e){case 0:if(t===nW)return new nF(e,t,r,r.bytes);throw Error(`Version 0 CID must use dag-pb (code: ${nW}) block encoding`);case 1:{let i=nG(e,t,r.bytes);return new nF(e,t,r,i)}default:throw Error("Invalid version")}}static createV0(e){return nF.create(0,nW,e)}static createV1(e,t){return nF.create(1,e,t)}static decode(e){let[t,r]=nF.decodeFirst(e);if(r.length)throw Error("Incorrect length");return t}static decodeFirst(e){let t=nF.inspectBytes(e),r=t.size-t.multihashSize,i=i$(e.subarray(r,r+t.multihashSize));if(i.byteLength!==t.multihashSize)throw Error("Incorrect length");let n=i.subarray(t.multihashSize-t.digestSize),s=new n_(t.multihashCode,t.digestSize,n,i);return[0===t.version?nF.createV0(s):nF.createV1(t.codec,s),e.subarray(t.size)]}static inspectBytes(e){let t=0,r=()=>{let[r,i]=ny(e.subarray(t));return t+=i,r},i=r(),n=nW;if(18===i?(i=0,t=0):1===i&&(n=r()),0!==i&&1!==i)throw RangeError(`Invalid CID version ${i}`);let s=t,a=r(),o=r(),c=t+o;return{version:i,codec:n,multihashCode:a,digestSize:o,multihashSize:c-s,size:c}}static parse(e,t){let[r,i]=nq(e,t),n=nF.decode(i);return n._baseCache.set(r,e),n}}let nq=(e,t)=>{switch(e[0]){case"Q":return[na.prefix,(t||na).decode(`${na.prefix}${e}`)];case na.prefix:return[na.prefix,(t||na).decode(e)];case i5.prefix:return[i5.prefix,(t||i5).decode(e)];default:if(null==t)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}},nz=(e,t,r)=>{let{prefix:i}=r;if(i!==na.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let n=t.get(i);if(null!=n)return n;{let n=r.encode(e).slice(1);return t.set(i,n),n}},nH=(e,t,r)=>{let{prefix:i}=r,n=t.get(i);if(null!=n)return n;{let n=r.encode(e);return t.set(i,n),n}},nW=112,nV=18,nG=(e,t,r)=>{let i=nv(e),n=i+nv(t),s=new Uint8Array(n+r.byteLength);return nw(e,s,0),nw(t,s,i),s.set(r,n),s},nK=Symbol.for("@ipld/js-cid/CID"),nQ={writable:!1,configurable:!1,enumerable:!0},nY={writable:!1,enumerable:!1,configurable:!1},nZ=(e,t)=>{if(e.test("0.0.0-dev"))console.warn(t);else throw Error(t)},nJ=`CID.isCID(v) is deprecated and will be removed in the next major release. Following code pattern: if (CID.isCID(value)) { doSomethingWithCID(value) } Is replaced with: const cid = CID.asCID(value) if (cid) { // Make sure to use cid instead of value doSomethingWithCID(cid) } `,nX={...n,...s,...a,...o,...c,...l,...u,...d,...h,...f};function n0(e,t,r,i){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:i}}}({...p,...g});let n1=n0("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),n2=n0("ascii","a",e=>{let t="a";for(let r=0;r{let t=iU((e=e.substring(1)).length);for(let r=0;rtypeof n9&&"u">typeof n9.versions&&"u">typeof n9.versions.node}function sn(){return!(0,rW.getDocument)()&&!!(0,rW.getNavigator)()&&"ReactNative"===navigator.product}function ss(){return!si()&&!!(0,rW.getNavigator)()&&!!(0,rW.getDocument)()}function sa(){return sn()?sr.reactNative:si()?sr.node:ss()?sr.browser:sr.unknown}function so(){var e;try{return sn()&&"u">typeof r.g&&"u">typeof(null==r.g?void 0:r.g.Application)?null==(e=r.g.Application)?void 0:e.applicationId:void 0}catch{return}}function sc(){return(0,rV.D)()||{name:"",description:"",url:"",icons:[""]}}function sl(e,t,i){let n=function(){if(sa()===sr.reactNative&&"u">typeof r.g&&"u">typeof(null==r.g?void 0:r.g.Platform)){let{OS:e,Version:t}=r.g.Platform;return[e,t].join("-")}let e="undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new rF:"undefined"!=typeof navigator?function(e){var t=""!==e&&rz.reduce(function(t,r){var i=r[0],n=r[1];if(t)return t;var s=n.exec(e);return!!s&&[i,s]},!1);if(!t)return null;var r=t[0],i=t[1];if("searchbot"===r)return new r$;var n=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);n?n.length<3&&(n=rU(rU([],n,!0),function(e){for(var t=[],r=0;rt.includes(e)).length===e.length}function sd(e){return Object.fromEntries(e.entries())}function sh(e){return new Map(Object.entries(e))}function sf(e=v.FIVE_MINUTES,t){let r,i,n,s;let a=(0,v.toMiliseconds)(e||v.FIVE_MINUTES);return{resolve:e=>{n&&r&&(clearTimeout(n),r(e),s=Promise.resolve(e))},reject:e=>{n&&i&&(clearTimeout(n),i(e))},done:()=>new Promise((e,o)=>{if(s)return e(s);n=setTimeout(()=>{let e=Error(t);s=Promise.reject(e),o(e)},a),r=e,i=o})}}function sp(e,t,r){return new Promise(async(i,n)=>{let s=setTimeout(()=>n(Error(r)),t);try{let t=await e;i(t)}catch(e){n(e)}clearTimeout(s)})}function sg(e,t){if("string"==typeof t&&t.startsWith(`${e}:`))return t;if("topic"===e.toLowerCase()){if("string"!=typeof t)throw Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}if("id"===e.toLowerCase()){if("number"!=typeof t)throw Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw Error(`Unknown expirer target type: ${e}`)}function sm(e){let[t,r]=e.split(":"),i={id:void 0,topic:void 0};if("topic"===t&&"string"==typeof r)i.topic=r;else if("id"===t&&Number.isInteger(Number(r)))i.id=Number(r);else throw Error(`Invalid target, expected id:number or topic:string, got ${t}:${r}`);return i}function sb(e,t){return(0,v.fromMiliseconds)((t||Date.now())+(0,v.toMiliseconds)(e))}function sy(e){return Date.now()>=(0,v.toMiliseconds)(e)}function sw(e,t){return`${e}${t?`:${t}`:""}`}function sv(e=[],t=[]){return[...new Set([...e,...t])]}async function sA({id:e,topic:t,wcDeepLink:i}){var n;try{if(!i)return;let s="string"==typeof i?JSON.parse(i):i,a=s?.href;if("string"!=typeof a)return;let o=function(e,t,r){let i=`requestId=${t}&sessionTopic=${r}`;e.endsWith("/")&&(e=e.slice(0,-1));let n=`${e}`;if(e.startsWith("https://t.me")){let t=e.includes("?")?"&startapp=":"?startapp=";n=`${n}${t}${function(e,t=!1){let r=n7.from(e).toString("base64");return t?r.replace(/[=]/g,""):r}(i,!0)}`}else n=`${n}/wc?${i}`;return n}(a,e,t),c=sa();if(c===sr.browser){let e;if(!(null!=(n=(0,rW.getDocument)())&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}e="_self",function(){try{return window.self!==window.top}catch{return!1}}()?e="_top":("u">typeof window&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)||o.startsWith("https://")||o.startsWith("http://"))&&(e="_blank"),window.open(o,e,"noreferrer noopener")}else c===sr.reactNative&&"u">typeof(null==r.g?void 0:r.g.Linking)&&await r.g.Linking.openURL(o)}catch(e){console.error(e)}}async function sE(e,t){let r="";try{if(ss()&&(r=localStorage.getItem(t)))return r;r=await e.getItem(t)}catch(e){console.error(e)}return r}function sC(e,t){if(!e.includes(t))return null;let r=e.split(/([&,?,=])/),i=r.indexOf(t);return r[i+2]}function s_(){return"u">typeof crypto&&null!=crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,e=>{let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function sI(){return"u">typeof n9&&"true"===n9.env.IS_VITEST}function sS(e){return n7.from(e,"base64").toString("utf-8")}function sN(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function sT(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function sP(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.wrapConstructor");sN(e.outputLen),sN(e.blockLen)}function sx(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function sO(e,t){sT(e);let r=t.outputLen;if(e.lengthe<>>32-r,sM=(e,t,r)=>t<>>32-r,sU=(e,t,r)=>t<>>64-r,sL=(e,t,r)=>e<>>64-r,sB="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function sj(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function s$(e,t){return e<<32-t|e>>>t}let sF=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];function sq(e){for(let r=0;r>>8&65280|t>>>24&255}}function sz(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}(e)),sT(e),e}class sH{clone(){return this._cloneInto()}}function sW(e){let t=t=>e().update(sz(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function sV(e=32){if(sB&&"function"==typeof sB.getRandomValues)return sB.getRandomValues(new Uint8Array(e));if(sB&&"function"==typeof sB.randomBytes)return sB.randomBytes(e);throw Error("crypto.getRandomValues must be defined")}let sG=[],sK=[],sQ=[],sY=BigInt(0),sZ=BigInt(1),sJ=BigInt(2),sX=BigInt(7),s0=BigInt(256),s1=BigInt(113);for(let e=0,t=sZ,r=1,i=0;e<24;e++){[r,i]=[i,(2*r+3*i)%5],sG.push(2*(5*i+r)),sK.push((e+1)*(e+2)/2%64);let n=sY;for(let e=0;e<7;e++)(t=(t<>sX)*s1)%s0)&sJ&&(n^=sZ<<(sZ<>sk&sR)}:{h:0|Number(e>>sk&sR),l:0|Number(e&sR)}}(e[n],t);[r[n],i[n]]=[s,a]}return[r,i]}(sQ,!0),s8=(e,t,r)=>r>32?sU(e,t,r):sD(e,t,r),s5=(e,t,r)=>r>32?sL(e,t,r):sM(e,t,r);class s6 extends sH{constructor(e,t,r,i=!1,n=24){var s;if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=i,this.rounds=n,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,sN(r),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=new Uint32Array((s=this.state).buffer,s.byteOffset,Math.floor(s.byteLength/4))}keccak(){sF||sq(this.state32),function(e,t=24){let r=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let i=(t+8)%10,n=(t+2)%10,s=r[n],a=r[n+1],o=s8(s,a,1)^r[i],c=s5(s,a,1)^r[i+1];for(let r=0;r<50;r+=10)e[t+r]^=o,e[t+r+1]^=c}let t=e[2],n=e[3];for(let r=0;r<24;r++){let i=sK[r],s=s8(t,n,i),a=s5(t,n,i),o=sG[r];t=e[o],n=e[o+1],e[o]=s,e[o+1]=a}for(let t=0;t<50;t+=10){for(let i=0;i<10;i++)r[i]=e[t+i];for(let i=0;i<10;i++)e[t+i]^=~r[(i+2)%10]&r[(i+4)%10]}e[0]^=s2[i],e[1]^=s3[i]}r.fill(0)}(this.state32,this.rounds),sF||sq(this.state32),this.posOut=0,this.pos=0}update(e){sx(this);let{blockLen:t,state:r}=this,i=(e=sz(e)).length;for(let n=0;n=r&&this.keccak();let s=Math.min(r-this.posOut,n-i);e.set(t.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return sN(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(sO(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:i,rounds:n,enableXOF:s}=this;return e||(e=new s6(t,r,i,s,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=i,e.enableXOF=s,e.destroyed=this.destroyed,e}}let s4=sW(()=>new s6(136,1,32));function s9(e){let t=`Ethereum Signed Message: ${e.length}`,r=new TextEncoder().encode(t+e);return"0x"+n7.from(s4(r)).toString("hex")}async function s7(e,t,r,i,n,s){switch(r.t){case"eip191":return await ae(e,t,r.s);case"eip1271":return await at(e,t,r.s,i,n,s);default:throw Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}async function ae(e,t,r){return(await iD({hash:s9(t),signature:r})).toLowerCase()===e.toLowerCase()}async function at(e,t,r,i,n,s){let a=se(i);if(!a.namespace||!a.reference)throw Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${i}`);try{let a="0x1626ba7e",o=r.substring(2),c=s9(t).substring(2),l=await fetch(`${s||"https://rpc.walletconnect.org/v1"}/?chainId=${i}&projectId=${n}`,{method:"POST",body:JSON.stringify({id:Date.now()+Math.floor(1e3*Math.random()),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:a+c+"00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000041"+o},"latest"]})}),{result:u}=await l.json();return!!u&&u.slice(0,a.length).toLowerCase()===a.toLowerCase()}catch(e){return console.error("isValidEip1271Signature: ",e),!1}}var ar=Object.defineProperty,ai=Object.defineProperties,an=Object.getOwnPropertyDescriptors,as=Object.getOwnPropertySymbols,aa=Object.prototype.hasOwnProperty,ao=Object.prototype.propertyIsEnumerable,ac=(e,t,r)=>t in e?ar(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,al=(e,t)=>{for(var r in t||(t={}))aa.call(t,r)&&ac(e,r,t[r]);if(as)for(var r of as(t))ao.call(t,r)&&ac(e,r,t[r]);return e},au=(e,t)=>ai(e,an(t));let ad=e=>e?.split(":"),ah=e=>{let t=e&&ad(e);if(t)return e.includes("did:pkh:")?t[3]:t[1]},af=e=>{let t=e&&ad(e);if(t)return t[2]+":"+t[3]},ap=e=>{let t=e&&ad(e);if(t)return t.pop()};async function ag(e){let{cacao:t,projectId:r}=e,{s:i,p:n}=t,s=am(n,n.iss),a=ap(n.iss);return await s7(a,s,i,af(n.iss),r)}let am=(e,t)=>{let r=`${e.domain} wants you to sign in with your Ethereum account:`,i=ap(t);if(!e.aud&&!e.uri)throw Error("Either `aud` or `uri` is required to construct the message");let n=e.statement||void 0,s=`URI: ${e.aud||e.uri}`,a=`Version: ${e.version}`,o=`Chain ID: ${ah(t)}`,c=`Nonce: ${e.nonce}`,l=`Issued At: ${e.iat}`,u=e.exp?`Expiration Time: ${e.exp}`:void 0,d=e.nbf?`Not Before: ${e.nbf}`:void 0,h=e.requestId?`Request ID: ${e.requestId}`:void 0,f=e.resources?`Resources:${e.resources.map(e=>` - ${e}`).join("")}`:void 0,p=aE(e.resources);return p&&(n=function(e="",t){ab(t);let r="I further authorize the stated URI to perform the following actions on my behalf: ";if(e.includes(r))return e;let i=[],n=0;Object.keys(t.att).forEach(e=>{let r=Object.keys(t.att[e]).map(e=>({ability:e.split("/")[0],action:e.split("/")[1]}));r.sort((e,t)=>e.action.localeCompare(t.action));let s={};r.forEach(e=>{s[e.ability]||(s[e.ability]=[]),s[e.ability].push(e.action)});let a=Object.keys(s).map(t=>(n++,`(${n}) '${t}': '${s[t].join("', '")}' for '${e}'.`));i.push(a.join(", ").replace(".,","."))});let s=i.join(" "),a=`${r}${s}`;return`${e?e+" ":""}${a}`}(n,aw(p))),[r,i,"",n,"",s,a,o,c,l,u,d,h,f].filter(e=>null!=e).join(` `)};function ab(e){if(!e)throw Error("No recap provided, value is undefined");if(!e.att)throw Error("No `att` property found");let t=Object.keys(e.att);if(!(null!=t&&t.length))throw Error("No resources found in `att` property");t.forEach(t=>{let r=e.att[t];if(Array.isArray(r)||"object"!=typeof r)throw Error(`Resource must be an object: ${t}`);if(!Object.keys(r).length)throw Error(`Resource object is empty: ${t}`);Object.keys(r).forEach(e=>{let t=r[e];if(!Array.isArray(t))throw Error(`Ability limits ${e} must be an array of objects, found: ${t}`);if(!t.length)throw Error(`Value of ${e} is empty array, must be an array with objects`);t.forEach(t=>{if("object"!=typeof t)throw Error(`Ability limits (${e}) must be an array of objects, found: ${t}`)})})})}function ay(e){return ab(e),`urn:recap:${n7.from(JSON.stringify(e)).toString("base64").replace(/=/g,"")}`}function aw(e){var t;let r=(t=e.replace("urn:recap:",""),JSON.parse(n7.from(t,"base64").toString("utf-8")));return ab(r),r}function av(e){var t;let r=aw(e);ab(r);let i=null==(t=r.att)?void 0:t.eip155;return i?Object.keys(i).map(e=>e.split("/")[1]):[]}function aA(e){let t=aw(e);ab(t);let r=[];return Object.values(t.att).forEach(e=>{Object.values(e).forEach(e=>{var t;null!=(t=e?.[0])&&t.chains&&r.push(e[0].chains)})}),[...new Set(r.flat())]}function aE(e){if(!e)return;let t=e?.[e.length-1];return t&&t.includes("urn:recap:")?t:void 0}function aC(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function a_(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function aI(e,...t){if(!a_(e))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function aS(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function aN(e){if("boolean"!=typeof e)throw Error(`boolean expected, not ${e}`)}let aT=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),aP=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw Error("Non little-endian hardware is not supported");function ax(e){if("string"==typeof e)e=function(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}(e);else if(a_(e))e=ak(e);else throw Error("Uint8Array expected, got "+typeof e);return e}function aO(e,t,r=!0){if(void 0===t)return new Uint8Array(e);if(t.length!==e)throw Error("invalid output length, expected "+e+", got: "+t.length);if(r&&t.byteOffset%4!=0)throw Error("invalid output, must be aligned");return t}function aR(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);let n=BigInt(32),s=BigInt(4294967295),a=Number(r>>n&s),o=Number(r&s),c=i?4:0,l=i?0:4;e.setUint32(t+c,a,i),e.setUint32(t+l,o,i)}function ak(e){return Uint8Array.from(e)}function aD(...e){for(let t=0;tUint8Array.from(e.split("").map(e=>e.charCodeAt(0))),aU=aM("expand 16-byte k"),aL=aM("expand 32-byte k"),aB=aT(aU),aj=aT(aL);function a$(e,t){return e<>>32-t}function aF(e){return e.byteOffset%4==0}let aq=4294967296-1,az=new Uint32Array,aH=(e,t)=>255&e[t++]|(255&e[t++])<<8;class aW{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,aI(e=ax(e),32);let t=aH(e,0),r=aH(e,2),i=aH(e,4),n=aH(e,6),s=aH(e,8),a=aH(e,10),o=aH(e,12),c=aH(e,14);this.r[0]=8191&t,this.r[1]=(t>>>13|r<<3)&8191,this.r[2]=(r>>>10|i<<6)&7939,this.r[3]=(i>>>7|n<<9)&8191,this.r[4]=(n>>>4|s<<12)&255,this.r[5]=s>>>1&8190,this.r[6]=(s>>>14|a<<2)&8191,this.r[7]=(a>>>11|o<<5)&8065,this.r[8]=(o>>>8|c<<8)&8191,this.r[9]=c>>>5&127;for(let t=0;t<8;t++)this.pad[t]=aH(e,16+2*t)}process(e,t,r=!1){let{h:i,r:n}=this,s=n[0],a=n[1],o=n[2],c=n[3],l=n[4],u=n[5],d=n[6],h=n[7],f=n[8],p=n[9],g=aH(e,t+0),m=aH(e,t+2),b=aH(e,t+4),y=aH(e,t+6),w=aH(e,t+8),v=aH(e,t+10),A=aH(e,t+12),E=aH(e,t+14),C=i[0]+(8191&g),_=i[1]+((g>>>13|m<<3)&8191),I=i[2]+((m>>>10|b<<6)&8191),S=i[3]+((b>>>7|y<<9)&8191),N=i[4]+((y>>>4|w<<12)&8191),T=i[5]+(w>>>1&8191),P=i[6]+((w>>>14|v<<2)&8191),x=i[7]+((v>>>11|A<<5)&8191),O=i[8]+((A>>>8|E<<8)&8191),R=i[9]+(E>>>5|(r?0:2048)),k=0,D=0+C*s+5*p*_+5*f*I+5*h*S+5*d*N;k=D>>>13,D&=8191,D+=5*u*T+5*l*P+5*c*x+5*o*O+5*a*R,k+=D>>>13,D&=8191;let M=k+C*a+_*s+5*p*I+5*f*S+5*h*N;k=M>>>13,M&=8191,M+=5*d*T+5*u*P+5*l*x+5*c*O+5*o*R,k+=M>>>13,M&=8191;let U=k+C*o+_*a+I*s+5*p*S+5*f*N;k=U>>>13,U&=8191,U+=5*h*T+5*d*P+5*u*x+5*l*O+5*c*R,k+=U>>>13,U&=8191;let L=k+C*c+_*o+I*a+S*s+5*p*N;k=L>>>13,L&=8191,L+=5*f*T+5*h*P+5*d*x+5*u*O+5*l*R,k+=L>>>13,L&=8191;let B=k+C*l+_*c+I*o+S*a+N*s;k=B>>>13,B&=8191,B+=5*p*T+5*f*P+5*h*x+5*d*O+5*u*R,k+=B>>>13,B&=8191;let j=k+C*u+_*l+I*c+S*o+N*a;k=j>>>13,j&=8191,j+=T*s+5*p*P+5*f*x+5*h*O+5*d*R,k+=j>>>13,j&=8191;let $=k+C*d+_*u+I*l+S*c+N*o;k=$>>>13,$&=8191,$+=T*a+P*s+5*p*x+5*f*O+5*h*R,k+=$>>>13,$&=8191;let F=k+C*h+_*d+I*u+S*l+N*c;k=F>>>13,F&=8191,F+=T*o+P*a+x*s+5*p*O+5*f*R,k+=F>>>13,F&=8191;let q=k+C*f+_*h+I*d+S*u+N*l;k=q>>>13,q&=8191,q+=T*c+P*o+x*a+O*s+5*p*R,k+=q>>>13,q&=8191;let z=k+C*p+_*f+I*h+S*d+N*u;k=z>>>13,z&=8191,z+=T*l+P*c+x*o+O*a+R*s,k+=z>>>13,z&=8191,D=8191&(k=(k=(k<<2)+k|0)+D|0),k>>>=13,M+=k,i[0]=D,i[1]=M,i[2]=U,i[3]=L,i[4]=B,i[5]=j,i[6]=$,i[7]=F,i[8]=q,i[9]=z}finalize(){let{h:e,pad:t}=this,r=new Uint16Array(10),i=e[1]>>>13;e[1]&=8191;for(let t=2;t<10;t++)e[t]+=i,i=e[t]>>>13,e[t]&=8191;e[0]+=5*i,i=e[0]>>>13,e[0]&=8191,e[1]+=i,i=e[1]>>>13,e[1]&=8191,e[2]+=i,r[0]=e[0]+5,i=r[0]>>>13,r[0]&=8191;for(let t=1;t<10;t++)r[t]=e[t]+i,i=r[t]>>>13,r[t]&=8191;r[9]-=8192;let n=(1^i)-1;for(let e=0;e<10;e++)r[e]&=n;n=~n;for(let t=0;t<10;t++)e[t]=e[t]&n|r[t];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let s=e[0]+t[0];e[0]=65535&s;for(let r=1;r<8;r++)s=(e[r]+t[r]|0)+(s>>>16)|0,e[r]=65535&s;aD(r)}update(e){aS(this);let{buffer:t,blockLen:r}=this,i=(e=ax(e)).length;for(let n=0;n>>0,e[n++]=r[t]>>>8;return e}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}}let aV=function(e){let t=(t,r)=>e(r).update(ax(t)).digest(),r=e(new Uint8Array(32));return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}(e=>new aW(e)),aG=function(e,t){let{allowShortKeys:r,extendNonceFn:i,counterLength:n,counterRight:s,rounds:a}=function(e,t){if(null==t||"object"!=typeof t)throw Error("options must be defined");return Object.assign(e,t)}({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if("function"!=typeof e)throw Error("core must be a function");return aC(n),aC(a),aN(s),aN(r),(t,o,c,l,u=0)=>{aI(t),aI(o),aI(c);let d=c.length;if(void 0===l&&(l=new Uint8Array(d)),aI(l),aC(u),u<0||u>=aq)throw Error("arx: counter overflow");if(l.length=aq)throw Error("arx: counter overflow");let g=Math.min(64,c-p);if(d&&64===g){let e=p/4;if(p%4!=0)throw Error("arx: invalid block position");for(let t=0,r;t<16;t++)f[r=e+t]=h[r]^u[t];p+=64;continue}for(let e=0,t;e{e.update(t);let r=t.length%16;r&&e.update(aK.subarray(r))},aY=new Uint8Array(32);function aZ(e,t,r,i,n){let s=e(t,r,aY),a=aV.create(s);n&&aQ(a,n),aQ(a,i);let o=new Uint8Array(16),c=aP(o);aR(c,0,BigInt(n?n.length:0),!0),aR(c,8,BigInt(i.length),!0),a.update(o);let l=a.digest();return aD(s,o),l}let aJ=((e,t)=>{function r(i,...n){if(aI(i),void 0!==e.nonceLength){let t=n[0];if(!t)throw Error("nonce / iv required");e.varSizeNonce?aI(t):aI(t,e.nonceLength)}let s=e.tagLength;s&&void 0!==n[1]&&aI(n[1]);let a=t(i,...n),o=(e,t)=>{if(void 0!==t){if(2!==e)throw Error("cipher output not supported");aI(t)}},c=!1;return{encrypt(e,t){if(c)throw Error("cannot encrypt() twice with same key + nonce");return c=!0,aI(e),o(a.encrypt.length,t),a.encrypt(e,t)},decrypt(e,t){if(aI(e),s&&e.lengthi?e.create().update(r).digest():r);for(let e=0;enew aX(e,t).update(r).digest();a0.create=(e,t)=>new aX(e,t);let a1=new Uint8Array([0]),a2=new Uint8Array,a3=(e,t,r,i,n)=>{var s;return function(e,t,r,i=32){if(sP(e),sN(i),i>255*e.outputLen)throw Error("Length should be <= 255*HashLen");let n=Math.ceil(i/e.outputLen);void 0===r&&(r=a2);let s=new Uint8Array(n*e.outputLen),a=a0.create(e,t),o=a._cloneInto(),c=new Uint8Array(a.outputLen);for(let t=0;ti-s&&(this.process(r,0),s=0);for(let e=s;e>n&s),o=Number(r&s),c=i?4:0,l=i?0:4;e.setUint32(t+c,a,i),e.setUint32(t+l,o,i)})(r,i-8,BigInt(8*this.length),n),this.process(r,0);let a=sj(e),o=this.outputLen;if(o%4)throw Error("_sha2: outputLen should be aligned to 32bit");let c=o/4,l=this.get();if(c>l.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e>>3,n=s$(r,17)^s$(r,19)^r>>>10;a4[e]=n+a4[e-7]+i+a4[e-16]|0}let{A:r,B:i,C:n,D:s,E:a,F:o,G:c,H:l}=this;for(let e=0;e<64;e++){var u,d,h,f;let t=l+(s$(a,6)^s$(a,11)^s$(a,25))+((u=a)&o^~u&c)+a5[e]+a4[e]|0,p=(s$(r,2)^s$(r,13)^s$(r,22))+((d=r)&(h=i)^d&(f=n)^h&f)|0;l=c,c=o,o=a,a=s+t|0,s=n,n=i,i=r,r=t+p|0}r=r+this.A|0,i=i+this.B|0,n=n+this.C|0,s=s+this.D|0,a=a+this.E|0,o=o+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(r,i,n,s,a,o,c,l)}roundClean(){a4.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}let a7=sW(()=>new a9),oe=BigInt(0);function ot(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function or(e){if(!ot(e))throw Error("Uint8Array expected")}let oi=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),on={_0:48,_9:57,A:65,F:70,a:97,f:102};function os(e){return e>=on._0&&e<=on._9?e-on._0:e>=on.A&&e<=on.F?e-(on.A-10):e>=on.a&&e<=on.f?e-(on.a-10):void 0}function oa(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);let t=e.length,r=t/2;if(t%2)throw Error("hex string expected, got unpadded hex of length "+t);let i=new Uint8Array(r);for(let t=0,n=0;t"bigint"==typeof e&&oe<=e;function ou(e,t,r,i){if(!(ol(t)&&ol(r)&&ol(i))||!(r<=t)||!(t"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||ot(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)},oh=BigInt(0),of=BigInt(1);function op(e,t){let r=e%t;return r>=oh?r:t+r}function og(e,t,r){let i=e;for(;t-- >oh;)i*=i,i%=r;return i}BigInt(0),BigInt(1),BigInt(0),BigInt(1),BigInt(2),BigInt(8);let om=BigInt(0),ob=BigInt(1),oy=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");BigInt(0);let ow=BigInt(1),ov=BigInt(2),oA=BigInt(3),oE=BigInt(5);BigInt(8);let oC=function(e){let t=(function(e,t,r={}){let i=(t,r,i)=>{let n=od[r];if("function"!=typeof n)throw Error("invalid validator function");let s=e[t];if(!(i&&void 0===s)&&!n(s,e))throw Error("param "+String(t)+" is invalid. Expected "+r+", got "+s)};for(let[e,r]of Object.entries(t))i(e,r,!1);for(let[e,t]of Object.entries(r))i(e,t,!0)}(e,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...e})),{P:r}=t,i=e=>op(e,r),n=t.montgomeryBits,s=Math.ceil(n/8),a=t.nByteLength,o=t.adjustScalarBytes||(e=>e),c=t.powPminus2||(e=>(function(e,t,r){if(toh;)t&of&&(i=i*e%r),e=e*e%r,t>>=of;return i})(e,r-BigInt(2),r));function l(e,t,r){let n=i(e*(t-r));return[t=i(t-n),r=i(r+n)]}let u=(t.a-BigInt(2))/BigInt(4);function d(e){var t;return oa(i(e).toString(16).padStart(2*s,"0")).reverse()}function h(e,t){let h=function(e,t){ou("u",e,om,r),ou("scalar",t,om,r);let s=ob,a=om,o=e,d=ob,h=om,f;for(let r=BigInt(n-1);r>=om;r--){let n=t>>r&ob;h^=n,s=(f=l(h,s,o))[0],o=f[1],a=(f=l(h,a,d))[0],d=f[1],h=n;let c=s+a,p=i(c*c),g=s-a,m=i(g*g),b=p-m,y=o+d,w=i((o-d)*c),v=i(y*g),A=w+v,E=w-v;o=i(A*A),d=i(e*i(E*E)),s=i(p*m),a=i(b*(p+i(u*b)))}return s=(f=l(h,s,o))[0],o=f[1],a=(f=l(h,a,d))[0],d=f[1],i(s*c(a))}(function(e){let t=oc("u coordinate",e,s);return 32===a&&(t[31]&=127),oo(t)}(t),function(e){let t=oc("scalar",e),r=t.length;if(r!==s&&r!==a)throw Error("invalid scalar, expected "+s+" or "+a+" bytes, got "+r);return oo(o(t))}(e));if(h===om)throw Error("invalid private or public key received");return d(h)}let f=d(t.Gu);function p(e){return h(e,f)}return{scalarMult:h,scalarMultBase:p,getSharedSecret:(e,t)=>h(e,t),getPublicKey:e=>p(e),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:f}}({P:oy,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{let{pow_p_5_8:t,b2:r}=function(e){let t=BigInt(10),r=BigInt(20),i=BigInt(40),n=BigInt(80),s=e*e%oy*e%oy,a=og(s,ov,oy)*s%oy,o=og(a,ow,oy)*e%oy,c=og(o,oE,oy)*o%oy,l=og(c,t,oy)*c%oy,u=og(l,r,oy)*l%oy,d=og(u,i,oy)*u%oy,h=og(d,n,oy)*d%oy,f=og(h,n,oy)*d%oy,p=og(f,t,oy)*c%oy;return{pow_p_5_8:og(p,ov,oy)*e%oy,b2:s}}(e);return op(og(t,oA,oy)*r,oy)},adjustScalarBytes:function(e){return e[0]&=248,e[31]&=127,e[31]|=64,e},randomBytes:sV}),o_="base10",oI="base16",oS="base64pad",oN="base64url",oT="utf8";function oP(){return n5(sV(32),oI)}function ox(e){return n5(a7(n8(e,oI)),oI)}function oO(e){return n5(a7(n8(e,oT)),oI)}function oR(e){return Number(n5(e,o_))}function ok(e){let{encoding:t=oS}=e;if(2===oR(e.type))return n5(iL([e.type,e.sealed]),t);if(1===oR(e.type)){if(typeof e.senderPublicKey>"u")throw Error("Missing sender public key for type 1 envelope");return n5(iL([e.type,e.senderPublicKey,e.iv,e.sealed]),t)}return n5(iL([e.type,e.iv,e.sealed]),t)}function oD(e){let{encoded:t,encoding:r=oS}=e,i=n8(t,r),n=i.slice(0,1);if(1===oR(n)){let e=i.slice(1,33),t=i.slice(33,45);return{type:n,sealed:i.slice(45),iv:t,senderPublicKey:e}}if(2===oR(n))return{type:n,sealed:i.slice(1),iv:sV(12)};let s=i.slice(1,13);return{type:n,sealed:i.slice(13),iv:s}}function oM(e){let t=e?.type||0;if(1===t){if(typeof e?.senderPublicKey>"u")throw Error("missing sender public key");if(typeof e?.receiverPublicKey>"u")throw Error("missing receiver public key")}return{type:t,senderPublicKey:e?.senderPublicKey,receiverPublicKey:e?.receiverPublicKey}}function oU(e){return 1===e.type&&"string"==typeof e.senderPublicKey&&"string"==typeof e.receiverPublicKey}function oL(e){return e?.relay||{protocol:"irn"}}function oB(e){let t=n4[e];if(typeof t>"u")throw Error(`Relay Protocol not supported: ${e}`);return t}function oj(e){var t;if(!e.includes("wc:")){let t=sS(e);null!=t&&t.includes("wc:")&&(e=t)}let r=(e=(e=e.includes("wc://")?e.replace("wc://",""):e).includes("wc:")?e.replace("wc:",""):e).indexOf(":"),i=-1!==e.indexOf("?")?e.indexOf("?"):void 0,n=e.substring(0,r),s=e.substring(r+1,i).split("@"),a=new URLSearchParams("u">typeof i?e.substring(i):""),o={};a.forEach((e,t)=>{o[t]=e});let c="string"==typeof o.methods?o.methods.split(","):void 0;return{protocol:n,topic:(t=s[0]).startsWith("//")?t.substring(2):t,version:parseInt(s[1],10),symKey:o.symKey,relay:function(e,t="-"){let r={},i="relay"+t;return Object.keys(e).forEach(t=>{if(t.startsWith(i)){let n=t.replace(i,""),s=e[t];r[n]=s}}),r}(o),methods:c,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function o$(e){let t=new URLSearchParams,r=function(e,t="-"){let r={};return Object.keys(e).forEach(i=>{e[i]&&(r["relay"+t+i]=e[i])}),r}(e.relay);Object.keys(r).sort().forEach(e=>{t.set(e,r[e])}),t.set("symKey",e.symKey),e.expiryTimestamp&&t.set("expiryTimestamp",e.expiryTimestamp.toString()),e.methods&&t.set("methods",e.methods.join(","));let i=t.toString();return`${e.protocol}:${e.topic}@${e.version}?${i}`}function oF(e,t,r){return`${e}?wc_ev=${r}&topic=${t}`}function oq(e){let t=[];return e.forEach(e=>{let[r,i]=e.split(":");t.push(`${r}:${i}`)}),t}function oz(e){return e.includes(":")}function oH(e){return oz(e)?e.split(":")[0]:e}function oW(e,t){let r=function(e){let t={};return e?.forEach(e=>{var r;let[i,n]=e.split(":");t[i]||(t[i]={accounts:[],chains:[],events:[],methods:[]}),t[i].accounts.push(e),null==(r=t[i].chains)||r.push(`${i}:${n}`)}),t}(t=t.map(e=>e.replace("did:pkh:","")));for(let[t,i]of Object.entries(r))i.methods?i.methods=sv(i.methods,e):i.methods=e,i.events=["chainChanged","accountsChanged"];return r}Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;let oV={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},oG={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function oK(e,t){let{message:r,code:i}=oG[e];return{message:t?`${r} ${t}`:r,code:i}}function oQ(e,t){let{message:r,code:i}=oV[e];return{message:t?`${r} ${t}`:r,code:i}}function oY(e,t){return!!Array.isArray(e)&&(!("u">typeof t)||!e.length||e.every(t))}function oZ(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function oJ(e){return typeof e>"u"}function oX(e,t){return!!(t&&oJ(e))||"string"==typeof e&&!!e.trim().length}function o0(e,t){return!!(t&&oJ(e))||"number"==typeof e&&!isNaN(e)}function o1(e){return!!(oX(e,!1)&&e.includes(":"))&&2===e.split(":").length}function o2(e){let t=!0;return oY(e)?e.length&&(t=e.every(e=>oX(e,!1))):t=!1,t}function o3(e,t){let r=null;return Object.values(e).forEach(e=>{var i;let n;if(r)return;let s=(i=`${t}, namespace`,n=null,o2(e?.methods)?o2(e?.events)||(n=oQ("UNSUPPORTED_EVENTS",`${i}, events should be an array of strings or empty array for no events`)):n=oQ("UNSUPPORTED_METHODS",`${i}, methods should be an array of strings or empty array for no methods`),n);s&&(r=s)}),r}function o8(e,t){let r=null;if(e&&oZ(e)){let i;let n=o3(e,t);n&&(r=n);let s=(i=null,Object.values(e).forEach(e=>{var r,n;let s;if(i)return;let a=(r=e?.accounts,n=`${t} namespace`,s=null,oY(r)?r.forEach(e=>{s||function(e){if(oX(e,!1)&&e.includes(":")){let t=e.split(":");if(3===t.length){let e=t[0]+":"+t[1];return!!t[2]&&o1(e)}}return!1}(e)||(s=oQ("UNSUPPORTED_ACCOUNTS",`${n}, account ${e} should be a string and conform to "namespace:chainId:address" format`))}):s=oQ("UNSUPPORTED_ACCOUNTS",`${n}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),s);a&&(i=a)}),i);s&&(r=s)}else r=oK("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return r}function o5(e){return oX(e.protocol,!0)}function o6(e){return"u">typeof e}function o4(e,t){return!(!o1(t)||!(function(e){let t=[];return Object.values(e).forEach(e=>{t.push(...oq(e.accounts))}),t})(e).includes(t))}function o9(e,t,r){let i=null,n=function(e){let t={};return Object.keys(e).forEach(r=>{var i;r.includes(":")?t[r]=e[r]:null==(i=e[r].chains)||i.forEach(i=>{t[i]={methods:e[r].methods,events:e[r].events}})}),t}(e),s=function(e){let t={};return Object.keys(e).forEach(r=>{if(r.includes(":"))t[r]=e[r];else{let i=oq(e[r].accounts);i?.forEach(i=>{t[i]={accounts:e[r].accounts.filter(e=>e.includes(`${i}:`)),methods:e[r].methods,events:e[r].events}})}}),t}(t),a=Object.keys(n),o=Object.keys(s),c=o7(Object.keys(e)),l=o7(Object.keys(t)),u=c.filter(e=>!l.includes(e));return u.length&&(i=oK("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${u.toString()} Received: ${Object.keys(t).toString()}`)),su(a,o)||(i=oK("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. Required: ${a.toString()} Approved: ${o.toString()}`)),Object.keys(t).forEach(e=>{if(!e.includes(":")||i)return;let n=oq(t[e].accounts);n.includes(e)||(i=oK("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${e} Required: ${e} Approved: ${n.toString()}`))}),a.forEach(e=>{i||(su(n[e].methods,s[e].methods)?su(n[e].events,s[e].events)||(i=oK("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${e}`)):i=oK("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${e}`))}),i}function o7(e){return[...new Set(e.map(e=>e.includes(":")?e.split(":")[0]:e))]}function ce(){let e=sa();return new Promise(t=>{switch(e){case sr.browser:t(ss()&&navigator?.onLine);break;case sr.reactNative:t(ct());break;case sr.node:default:t(!0)}})}async function ct(){if(sn()&&"u">typeof r.g&&null!=r.g&&r.g.NetInfo){let e=await (null==r.g?void 0:r.g.NetInfo.fetch());return e?.isConnected}return!0}let cr={};class ci{static get(e){return cr[e]}static set(e,t){cr[e]=t}static delete(e){delete cr[e]}}let cn="INTERNAL_ERROR",cs="SERVER_ERROR",ca=[-32700,-32600,-32601,-32602,-32603],co={PARSE_ERROR:{code:-32700,message:"Parse error"},INVALID_REQUEST:{code:-32600,message:"Invalid Request"},METHOD_NOT_FOUND:{code:-32601,message:"Method not found"},INVALID_PARAMS:{code:-32602,message:"Invalid params"},[cn]:{code:-32603,message:"Internal error"},[cs]:{code:-32e3,message:"Server error"}};function cc(e){return Object.keys(co).includes(e)?co[e]:co[cs]}function cl(e,t,r){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?Error(`Unavailable ${r} RPC url at ${t}`):e}var cu=r(1468);function cd(e=3){return Date.now()*Math.pow(10,e)+Math.floor(Math.random()*Math.pow(10,e))}function ch(e=6){return BigInt(cd(e))}function cf(e,t,r){return{id:r||cd(),jsonrpc:"2.0",method:e,params:t}}function cp(e,t){return{id:e,jsonrpc:"2.0",result:t}}function cg(e,t,r){var i,n,s;return{id:e,jsonrpc:"2.0",error:void 0===(i=t)?cc(cn):("string"==typeof i&&(i=Object.assign(Object.assign({},cc(cs)),{message:i})),void 0!==r&&(i.data=r),n=i.code,ca.includes(n)&&(s=i.code,i=Object.values(co).find(e=>e.code===s)||co[cs]),i)}}class cm{}class cb extends cm{constructor(){super()}}class cy extends cb{constructor(e){super()}}function cw(e,t){let r=function(e){let t=e.match(RegExp(/^\w+:/,"gi"));if(t&&t.length)return t[0]}(e);return void 0!==r&&new RegExp(t).test(r)}function cv(e){return cw(e,"^https?:")}function cA(e){return cw(e,"^wss?:")}function cE(e){return"object"==typeof e&&"id"in e&&"jsonrpc"in e&&"2.0"===e.jsonrpc}function cC(e){return cE(e)&&"method"in e}function c_(e){return cE(e)&&(cI(e)||cS(e))}function cI(e){return"result"in e}function cS(e){return"error"in e}class cN extends cy{constructor(e){super(e),this.events=new y.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(cf(e.method,e.params||[],e.id||ch().toString()),t)}async requestStrict(e,t){return new Promise(async(r,i)=>{if(!this.connection.connected)try{await this.open()}catch(e){i(e)}this.events.on(`${e.id}`,e=>{cS(e)?i(e.error):r(e.result)});try{await this.connection.send(e,t)}catch(e){i(e)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),c_(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&3e3===e.code&&this.events.emit("error",Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),"string"==typeof e&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}}let cT=()=>"u">typeof WebSocket||"u">typeof r.g&&"u">typeof r.g.WebSocket||"u">typeof window&&"u">typeof window.WebSocket||"u">typeof self&&"u">typeof self.WebSocket,cP=e=>e.split("?")[0],cx="u">typeof WebSocket?WebSocket:"u">typeof r.g&&"u">typeof r.g.WebSocket?r.g.WebSocket:"u">typeof window&&"u">typeof window.WebSocket?window.WebSocket:"u">typeof self&&"u">typeof self.WebSocket?self.WebSocket:r(72030);class cO{constructor(e){if(this.url=e,this.events=new y.EventEmitter,this.registering=!1,!cA(e))throw Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return"u">typeof this.socket}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>{if(typeof this.socket>"u"){t(Error("Connection already closed"));return}this.socket.onclose=t=>{this.onClose(t),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send((0,H.u)(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!cA(e))throw Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise((e,t)=>{this.events.once("register_error",e=>{this.resetMaxListeners(),t(e)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return t(Error("WebSocket connection is missing or invalid"));e(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,r)=>{let i=(0,cu.isReactNative)()?void 0:{rejectUnauthorized:!RegExp("wss?://localhost(:d{2,5})?").test(e)},n=new cx(e,[],i);cT()?n.onerror=e=>{r(this.emitError(e.error))}:n.on("error",e=>{r(this.emitError(e))}),n.onopen=()=>{this.onOpen(n),t(n)}})}onOpen(e){e.onmessage=e=>this.onPayload(e),e.onclose=e=>this.onClose(e),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;let t="string"==typeof e.data?(0,H.D)(e.data):e.data;this.events.emit("payload",t)}onError(e,t){let r=this.parseError(t),i=cg(e,r.message||r.toString());this.events.emit("payload",i)}parseError(e,t=this.url){return cl(e,cP(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}emitError(e){let t=this.parseError(Error(e?.message||`WebSocket connection failed for host: ${cP(this.url)}`));return this.events.emit("register_error",t),t}}var cR=r(48764).Buffer;let ck="core",cD=`wc@2:${ck}:`,cM={logger:"error"},cU={database:":memory:"},cL="client_ed25519_seed",cB=v.ONE_DAY,cj=v.SIX_HOURS,c$="wss://relay.walletconnect.org",cF={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",publish:"relayer_publish"},cq={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},cz="2.19.1",cH={link_mode:"link_mode",relay:"relay"},cW={inbound:"inbound",outbound:"outbound"},cV="WALLETCONNECT_LINK_MODE_APPS",cG={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},cK=(v.FIVE_SECONDS,{wc_pairingDelete:{req:{ttl:v.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:v.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:v.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:v.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:v.ONE_DAY,prompt:!1,tag:0},res:{ttl:v.ONE_DAY,prompt:!1,tag:0}}}),cQ={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},cY={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},cZ={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},cJ="https://verify.walletconnect.org",cX=`${cJ}/v3`,c0=["https://verify.walletconnect.com",cJ],c1={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"},c2={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_listener_not_found:"proposal_listener_not_found"},c3={session_approve_started:"session_approve_started",session_namespaces_validation_success:"session_namespaces_validation_success",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"},c8={no_internet_connection:"no_internet_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"},c5={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},c6={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"};var c4=function(e,t){if(e.length>=255)throw TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i>>0,a=new Uint8Array(s);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var d=0,h=s-1;(0!==u||d>>0,a[h]=u%256>>>0,u=u/256>>>0;if(0!==u)throw Error("Non-zero carry");n=d,t++}if(" "!==e[t]){for(var f=s-n;f!==s&&0===a[f];)f++;for(var p=new Uint8Array(i+(s-f)),g=i;f!==s;)p[g++]=a[f++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,i=0,n=0,s=t.length;n!==s&&0===t[n];)n++,r++;for(var a=(s-n)*u+1>>>0,l=new Uint8Array(a);n!==s;){for(var d=t[n],h=0,f=a-1;(0!==d||h>>0,l[f]=d%o>>>0,d=d/o>>>0;if(0!==d)throw Error("Non-zero carry");i=h,n++}for(var p=a-i;p!==a&&0===l[p];)p++;for(var g=c.repeat(r);p{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error("Unknown type, must be binary type")},c7=e=>new TextEncoder().encode(e),le=e=>new TextDecoder().decode(e);class lt{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class lr{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return ln(this,e)}}class li{constructor(e){this.decoders=e}or(e){return ln(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}let ln=(e,t)=>new li({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class ls{constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new lt(e,t,r),this.decoder=new lr(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}let la=({name:e,prefix:t,encode:r,decode:i})=>new ls(e,t,r,i),lo=({prefix:e,name:t,alphabet:r})=>{let{encode:i,decode:n}=c4(r,t);return la({prefix:e,name:t,encode:i,decode:e=>c9(n(e))})},lc=(e,t,r,i)=>{let n={};for(let e=0;e=8&&(o-=8,a[l++]=255&c>>o)}if(o>=r||255&c<<8-o)throw SyntaxError("Unexpected end of data");return a},ll=(e,t,r)=>{let i="="===t[t.length-1],n=(1<r;)a-=r,s+=t[n&o>>a];if(a&&(s+=t[n&o<la({prefix:t,name:e,encode:e=>ll(e,i,r),decode:t=>lc(t,i,r,e)});var ld=Object.freeze({__proto__:null,identity:la({prefix:"\0",name:"identity",encode:e=>le(e),decode:e=>c7(e)})}),lh=Object.freeze({__proto__:null,base2:lu({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})}),lf=Object.freeze({__proto__:null,base8:lu({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})}),lp=Object.freeze({__proto__:null,base10:lo({prefix:"9",name:"base10",alphabet:"0123456789"})}),lg=Object.freeze({__proto__:null,base16:lu({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper:lu({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});let lm=lu({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),lb=lu({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ly=lu({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),lw=lu({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),lv=lu({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),lA=lu({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5});var lE=Object.freeze({__proto__:null,base32:lm,base32upper:lb,base32pad:ly,base32padupper:lw,base32hex:lv,base32hexupper:lA,base32hexpad:lu({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper:lu({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z:lu({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})}),lC=Object.freeze({__proto__:null,base36:lo({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper:lo({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})}),l_=Object.freeze({__proto__:null,base58btc:lo({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr:lo({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});let lI=lu({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6});var lS=Object.freeze({__proto__:null,base64:lI,base64pad:lu({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url:lu({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad:lu({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});let lN=Array.from("\uD83D\uDE80\uD83E\uDE90☄\uD83D\uDEF0\uD83C\uDF0C\uD83C\uDF11\uD83C\uDF12\uD83C\uDF13\uD83C\uDF14\uD83C\uDF15\uD83C\uDF16\uD83C\uDF17\uD83C\uDF18\uD83C\uDF0D\uD83C\uDF0F\uD83C\uDF0E\uD83D\uDC09☀\uD83D\uDCBB\uD83D\uDDA5\uD83D\uDCBE\uD83D\uDCBF\uD83D\uDE02❤\uD83D\uDE0D\uD83E\uDD23\uD83D\uDE0A\uD83D\uDE4F\uD83D\uDC95\uD83D\uDE2D\uD83D\uDE18\uD83D\uDC4D\uD83D\uDE05\uD83D\uDC4F\uD83D\uDE01\uD83D\uDD25\uD83E\uDD70\uD83D\uDC94\uD83D\uDC96\uD83D\uDC99\uD83D\uDE22\uD83E\uDD14\uD83D\uDE06\uD83D\uDE44\uD83D\uDCAA\uD83D\uDE09☺\uD83D\uDC4C\uD83E\uDD17\uD83D\uDC9C\uD83D\uDE14\uD83D\uDE0E\uD83D\uDE07\uD83C\uDF39\uD83E\uDD26\uD83C\uDF89\uD83D\uDC9E✌✨\uD83E\uDD37\uD83D\uDE31\uD83D\uDE0C\uD83C\uDF38\uD83D\uDE4C\uD83D\uDE0B\uD83D\uDC97\uD83D\uDC9A\uD83D\uDE0F\uD83D\uDC9B\uD83D\uDE42\uD83D\uDC93\uD83E\uDD29\uD83D\uDE04\uD83D\uDE00\uD83D\uDDA4\uD83D\uDE03\uD83D\uDCAF\uD83D\uDE48\uD83D\uDC47\uD83C\uDFB6\uD83D\uDE12\uD83E\uDD2D❣\uD83D\uDE1C\uD83D\uDC8B\uD83D\uDC40\uD83D\uDE2A\uD83D\uDE11\uD83D\uDCA5\uD83D\uDE4B\uD83D\uDE1E\uD83D\uDE29\uD83D\uDE21\uD83E\uDD2A\uD83D\uDC4A\uD83E\uDD73\uD83D\uDE25\uD83E\uDD24\uD83D\uDC49\uD83D\uDC83\uD83D\uDE33✋\uD83D\uDE1A\uD83D\uDE1D\uD83D\uDE34\uD83C\uDF1F\uD83D\uDE2C\uD83D\uDE43\uD83C\uDF40\uD83C\uDF37\uD83D\uDE3B\uD83D\uDE13⭐✅\uD83E\uDD7A\uD83C\uDF08\uD83D\uDE08\uD83E\uDD18\uD83D\uDCA6✔\uD83D\uDE23\uD83C\uDFC3\uD83D\uDC90☹\uD83C\uDF8A\uD83D\uDC98\uD83D\uDE20☝\uD83D\uDE15\uD83C\uDF3A\uD83C\uDF82\uD83C\uDF3B\uD83D\uDE10\uD83D\uDD95\uD83D\uDC9D\uD83D\uDE4A\uD83D\uDE39\uD83D\uDDE3\uD83D\uDCAB\uD83D\uDC80\uD83D\uDC51\uD83C\uDFB5\uD83E\uDD1E\uD83D\uDE1B\uD83D\uDD34\uD83D\uDE24\uD83C\uDF3C\uD83D\uDE2B⚽\uD83E\uDD19☕\uD83C\uDFC6\uD83E\uDD2B\uD83D\uDC48\uD83D\uDE2E\uD83D\uDE46\uD83C\uDF7B\uD83C\uDF43\uD83D\uDC36\uD83D\uDC81\uD83D\uDE32\uD83C\uDF3F\uD83E\uDDE1\uD83C\uDF81⚡\uD83C\uDF1E\uD83C\uDF88❌✊\uD83D\uDC4B\uD83D\uDE30\uD83E\uDD28\uD83D\uDE36\uD83E\uDD1D\uD83D\uDEB6\uD83D\uDCB0\uD83C\uDF53\uD83D\uDCA2\uD83E\uDD1F\uD83D\uDE41\uD83D\uDEA8\uD83D\uDCA8\uD83E\uDD2C✈\uD83C\uDF80\uD83C\uDF7A\uD83E\uDD13\uD83D\uDE19\uD83D\uDC9F\uD83C\uDF31\uD83D\uDE16\uD83D\uDC76\uD83E\uDD74▶➡❓\uD83D\uDC8E\uD83D\uDCB8⬇\uD83D\uDE28\uD83C\uDF1A\uD83E\uDD8B\uD83D\uDE37\uD83D\uDD7A⚠\uD83D\uDE45\uD83D\uDE1F\uD83D\uDE35\uD83D\uDC4E\uD83E\uDD32\uD83E\uDD20\uD83E\uDD27\uD83D\uDCCC\uD83D\uDD35\uD83D\uDC85\uD83E\uDDD0\uD83D\uDC3E\uD83C\uDF52\uD83D\uDE17\uD83E\uDD11\uD83C\uDF0A\uD83E\uDD2F\uD83D\uDC37☎\uD83D\uDCA7\uD83D\uDE2F\uD83D\uDC86\uD83D\uDC46\uD83C\uDFA4\uD83D\uDE47\uD83C\uDF51❄\uD83C\uDF34\uD83D\uDCA3\uD83D\uDC38\uD83D\uDC8C\uD83D\uDCCD\uD83E\uDD40\uD83E\uDD22\uD83D\uDC45\uD83D\uDCA1\uD83D\uDCA9\uD83D\uDC50\uD83D\uDCF8\uD83D\uDC7B\uD83E\uDD10\uD83E\uDD2E\uD83C\uDFBC\uD83E\uDD75\uD83D\uDEA9\uD83C\uDF4E\uD83C\uDF4A\uD83D\uDC7C\uD83D\uDC8D\uD83D\uDCE3\uD83E\uDD42"),lT=lN.reduce((e,t,r)=>(e[r]=t,e),[]),lP=lN.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);var lx=Object.freeze({__proto__:null,base256emoji:la({prefix:"\uD83D\uDE80",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>e+=lT[t],"")},decode:function(e){let t=[];for(let r of e){let e=lP[r.codePointAt(0)];if(void 0===e)throw Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}})});function lO(e,t){var r,i=0,t=t||0,n=0,s=t,a=e.length;do{if(s>=a)throw lO.bytes=0,RangeError("Could not decode varint");r=e[s++],i+=n<28?(127&r)<=128);return lO.bytes=s-t,i}var lR=function e(t,r,i){r=r||[],i=i||0;for(var n=i;t>=2147483648;)r[i++]=255&t|128,t/=128;for(;-128&t;)r[i++]=255&t|128,t>>>=7;return r[i]=0|t,e.bytes=i-n+1,r};let lk=(e,t,r=0)=>(lR(e,t,r),t),lD=e=>e<128?1:e<16384?2:e<2097152?3:e<268435456?4:e<34359738368?5:e<4398046511104?6:e<562949953421312?7:e<72057594037927940?8:e<0x7fffffffffffffff?9:10,lM=(e,t)=>{let r=t.byteLength,i=lD(e),n=i+lD(r),s=new Uint8Array(n+r);return lk(e,s,0),lk(r,s,i),s.set(t,n),new lU(e,r,t,s)};class lU{constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i}}let lL=({name:e,code:t,encode:r})=>new lB(e,t,r);class lB{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?lM(this.code,t):t.then(e=>lM(this.code,e))}throw Error("Unknown type, must be binary type")}}let lj=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t));var l$=Object.freeze({__proto__:null,sha256:lL({name:"sha2-256",code:18,encode:lj("SHA-256")}),sha512:lL({name:"sha2-512",code:19,encode:lj("SHA-512")})}),lF=Object.freeze({__proto__:null,identity:{code:0,name:"identity",encode:c9,digest:e=>lM(0,c9(e))}});new TextEncoder,new TextDecoder;let lq={...ld,...lh,...lf,...lp,...lg,...lE,...lC,...l_,...lS,...lx};function lz(e,t,r,i){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:i}}}({...l$,...lF});let lH=lz("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),lW=lz("ascii","a",e=>{let t="a";for(let r=0;r{let t=function(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}((e=e.substring(1)).length);for(let r=0;rt in e?lG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lQ=(e,t,r)=>lK(e,"symbol"!=typeof t?t+"":t,r);class lY{constructor(e,t){this.core=e,this.logger=t,lQ(this,"keychain",new Map),lQ(this,"name","keychain"),lQ(this,"version","0.3"),lQ(this,"initialized",!1),lQ(this,"storagePrefix",cD),lQ(this,"init",async()=>{if(!this.initialized){let e=await this.getKeyChain();"u">typeof e&&(this.keychain=e),this.initialized=!0}}),lQ(this,"has",e=>(this.isInitialized(),this.keychain.has(e))),lQ(this,"set",async(e,t)=>{this.isInitialized(),this.keychain.set(e,t),await this.persist()}),lQ(this,"get",e=>{this.isInitialized();let t=this.keychain.get(e);if(typeof t>"u"){let{message:t}=oK("NO_MATCHING_KEY",`${this.name}: ${e}`);throw Error(t)}return t}),lQ(this,"del",async e=>{this.isInitialized(),this.keychain.delete(e),await this.persist()}),this.core=e,this.logger=(0,ee.Ep)(t,this.name)}get context(){return(0,ee.Fd)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,sd(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return"u">typeof e?sh(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=oK("NOT_INITIALIZED",this.name);throw Error(e)}}}var lZ=Object.defineProperty,lJ=(e,t,r)=>t in e?lZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lX=(e,t,r)=>lJ(e,"symbol"!=typeof t?t+"":t,r);class l0{constructor(e,t,r){this.core=e,this.logger=t,lX(this,"name","crypto"),lX(this,"keychain"),lX(this,"randomSessionIdentifier",oP()),lX(this,"initialized",!1),lX(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),lX(this,"hasKeys",e=>(this.isInitialized(),this.keychain.has(e))),lX(this,"getClientId",async()=>(this.isInitialized(),rO(rk(await this.getClientSeed()).publicKey))),lX(this,"generateKeyPair",()=>{this.isInitialized();let e=function(){let e=oC.utils.randomPrivateKey(),t=oC.getPublicKey(e);return{privateKey:n5(e,oI),publicKey:n5(t,oI)}}();return this.setPrivateKey(e.publicKey,e.privateKey)}),lX(this,"signJWT",async e=>{this.isInitialized();let t=rk(await this.getClientSeed()),r=this.randomSessionIdentifier;return await rD(r,e,cB,t)}),lX(this,"generateSharedKey",(e,t,r)=>{var i;this.isInitialized();let n=(i=this.getPrivateKey(e),n5(a3(a7,oC.getSharedSecret(n8(i,oI),n8(t,oI)),void 0,void 0,32),oI));return this.setSymKey(n,r)}),lX(this,"setSymKey",async(e,t)=>{this.isInitialized();let r=t||ox(e);return await this.keychain.set(r,e),r}),lX(this,"deleteKeyPair",async e=>{this.isInitialized(),await this.keychain.del(e)}),lX(this,"deleteSymKey",async e=>{this.isInitialized(),await this.keychain.del(e)}),lX(this,"encode",async(e,t,r)=>{this.isInitialized();let i=oM(r),n=(0,H.u)(t);if(2===i.type)return function(e,t){let r=n8("2",o_),i=sV(12);return ok({type:r,sealed:n8(e,oT),iv:i,encoding:t})}(n,r?.encoding);if(oU(i)){let t=i.senderPublicKey,r=i.receiverPublicKey;e=await this.generateSharedKey(t,r)}let s=this.getSymKey(e),{type:a,senderPublicKey:o}=i;return function(e){var t;let r=(t="u">typeof e.type?e.type:0,n8(`${t}`,o_));if(1===oR(r)&&typeof e.senderPublicKey>"u")throw Error("Missing sender public key for type 1 envelope");let i="u">typeof e.senderPublicKey?n8(e.senderPublicKey,oI):void 0,n="u">typeof e.iv?n8(e.iv,oI):sV(12);return ok({type:r,sealed:aJ(n8(e.symKey,oI),n).encrypt(n8(e.message,oT)),iv:n,senderPublicKey:i,encoding:e.encoding})}({type:a,symKey:s,message:n,senderPublicKey:o,encoding:r?.encoding})}),lX(this,"decode",async(e,t,r)=>{this.isInitialized();let i=function(e,t){let r=oD({encoded:e,encoding:t?.encoding});return oM({type:oR(r.type),senderPublicKey:"u">typeof r.senderPublicKey?n5(r.senderPublicKey,oI):void 0,receiverPublicKey:t?.receiverPublicKey})}(t,r);if(2===i.type){let e=function(e,t){let{sealed:r}=oD({encoded:e,encoding:t});return n5(r,oT)}(t,r?.encoding);return(0,H.D)(e)}if(oU(i)){let t=i.receiverPublicKey,r=i.senderPublicKey;e=await this.generateSharedKey(t,r)}try{let i=this.getSymKey(e),n=function(e){let t=n8(e.symKey,oI),{sealed:r,iv:i}=oD(e),n=aJ(t,i).decrypt(r);if(null===n)throw Error("Failed to decrypt");return n5(n,oT)}({symKey:i,encoded:t,encoding:r?.encoding});return(0,H.D)(n)}catch(t){this.logger.error(`Failed to decode message from topic: '${e}', clientId: '${await this.getClientId()}'`),this.logger.error(t)}}),lX(this,"getPayloadType",(e,t=oS)=>oR(oD({encoded:e,encoding:t}).type)),lX(this,"getPayloadSenderPublicKey",(e,t=oS)=>{let r=oD({encoded:e,encoding:t});return r.senderPublicKey?n5(r.senderPublicKey,oI):void 0}),this.core=e,this.logger=(0,ee.Ep)(t,this.name),this.keychain=r||new lY(this.core,this.logger)}get context(){return(0,ee.Fd)(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(cL)}catch{e=oP(),await this.keychain.set(cL,e)}return function(e,t="utf8"){let r=lV[t];if(!r)throw Error(`Unsupported encoding "${t}"`);return("utf8"===t||"utf-8"===t)&&null!=globalThis.Buffer&&null!=globalThis.Buffer.from?globalThis.Buffer.from(e,"utf8"):r.decoder.decode(`${r.prefix}${e}`)}(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=oK("NOT_INITIALIZED",this.name);throw Error(e)}}}var l1=Object.defineProperty,l2=Object.defineProperties,l3=Object.getOwnPropertyDescriptors,l8=Object.getOwnPropertySymbols,l5=Object.prototype.hasOwnProperty,l6=Object.prototype.propertyIsEnumerable,l4=(e,t,r)=>t in e?l1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,l9=(e,t)=>{for(var r in t||(t={}))l5.call(t,r)&&l4(e,r,t[r]);if(l8)for(var r of l8(t))l6.call(t,r)&&l4(e,r,t[r]);return e},l7=(e,t)=>l2(e,l3(t)),ue=(e,t,r)=>l4(e,"symbol"!=typeof t?t+"":t,r);class ut extends el{constructor(e,t){super(e,t),this.logger=e,this.core=t,ue(this,"messages",new Map),ue(this,"messagesWithoutClientAck",new Map),ue(this,"name","messages"),ue(this,"version","0.3"),ue(this,"initialized",!1),ue(this,"storagePrefix",cD),ue(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let e=await this.getRelayerMessages();"u">typeof e&&(this.messages=e);let t=await this.getRelayerMessagesWithoutClientAck();"u">typeof t&&(this.messagesWithoutClientAck=t),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}finally{this.initialized=!0}}}),ue(this,"set",async(e,t,r)=>{this.isInitialized();let i=oO(t),n=this.messages.get(e);if(typeof n>"u"&&(n={}),"u">typeof n[i])return i;if(n[i]=t,this.messages.set(e,n),r===cW.inbound){let r=this.messagesWithoutClientAck.get(e)||{};this.messagesWithoutClientAck.set(e,l7(l9({},r),{[i]:t}))}return await this.persist(),i}),ue(this,"get",e=>{this.isInitialized();let t=this.messages.get(e);return typeof t>"u"&&(t={}),t}),ue(this,"getWithoutAck",e=>{this.isInitialized();let t={};for(let r of e){let e=this.messagesWithoutClientAck.get(r)||{};t[r]=Object.values(e)}return t}),ue(this,"has",(e,t)=>(this.isInitialized(),"u">typeof this.get(e)[oO(t)])),ue(this,"ack",async(e,t)=>{this.isInitialized();let r=this.messagesWithoutClientAck.get(e);if(typeof r>"u")return;let i=oO(t);delete r[i],0===Object.keys(r).length?this.messagesWithoutClientAck.delete(e):this.messagesWithoutClientAck.set(e,r),await this.persist()}),ue(this,"del",async e=>{this.isInitialized(),this.messages.delete(e),this.messagesWithoutClientAck.delete(e),await this.persist()}),this.logger=(0,ee.Ep)(e,this.name),this.core=t}get context(){return(0,ee.Fd)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get storageKeyWithoutClientAck(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name+"_withoutClientAck"}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,sd(e))}async setRelayerMessagesWithoutClientAck(e){await this.core.storage.setItem(this.storageKeyWithoutClientAck,sd(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return"u">typeof e?sh(e):void 0}async getRelayerMessagesWithoutClientAck(){let e=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return"u">typeof e?sh(e):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){let{message:e}=oK("NOT_INITIALIZED",this.name);throw Error(e)}}}var ur=Object.defineProperty,ui=Object.defineProperties,un=Object.getOwnPropertyDescriptors,us=Object.getOwnPropertySymbols,ua=Object.prototype.hasOwnProperty,uo=Object.prototype.propertyIsEnumerable,uc=(e,t,r)=>t in e?ur(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ul=(e,t)=>{for(var r in t||(t={}))ua.call(t,r)&&uc(e,r,t[r]);if(us)for(var r of us(t))uo.call(t,r)&&uc(e,r,t[r]);return e},uu=(e,t)=>ui(e,un(t)),ud=(e,t,r)=>uc(e,"symbol"!=typeof t?t+"":t,r);class uh extends eu{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,ud(this,"events",new y.EventEmitter),ud(this,"name","publisher"),ud(this,"queue",new Map),ud(this,"publishTimeout",(0,v.toMiliseconds)(v.ONE_MINUTE)),ud(this,"initialPublishTimeout",(0,v.toMiliseconds)(15*v.ONE_SECOND)),ud(this,"needsTransportRestart",!1),ud(this,"publish",async(e,t,r)=>{var i;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:r}});let n=r?.ttl||cj,s=oL(r),a=r?.prompt||!1,o=r?.tag||0,c=r?.id||ch().toString(),l={topic:e,message:t,opts:{ttl:n,relay:s,prompt:a,tag:o,id:c,attestation:r?.attestation,tvf:r?.tvf}},u=`Failed to publish payload, please try again. id:${c} tag:${o}`;try{let i=new Promise(async i=>{let s=({id:e})=>{l.opts.id===e&&(this.removeRequestFromQueue(e),this.relayer.events.removeListener(cF.publish,s),i(l))};this.relayer.events.on(cF.publish,s);let u=sp(new Promise((i,s)=>{this.rpcPublish({topic:e,message:t,ttl:n,prompt:a,tag:o,id:c,attestation:r?.attestation,tvf:r?.tvf}).then(i).catch(e=>{this.logger.warn(e,e?.message),s(e)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${c} tag:${o}`);try{await u,this.events.removeListener(cF.publish,s)}catch(e){this.queue.set(c,uu(ul({},l),{attempt:1})),this.logger.warn(e,e?.message)}});this.logger.trace({type:"method",method:"publish",params:{id:c,topic:e,message:t,opts:r}}),await sp(i,this.publishTimeout,u)}catch(e){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(e),null!=(i=r?.internal)&&i.throwOnFailedPublish)throw e}finally{this.queue.delete(c)}}),ud(this,"on",(e,t)=>{this.events.on(e,t)}),ud(this,"once",(e,t)=>{this.events.once(e,t)}),ud(this,"off",(e,t)=>{this.events.off(e,t)}),ud(this,"removeListener",(e,t)=>{this.events.removeListener(e,t)}),this.relayer=e,this.logger=(0,ee.Ep)(t,this.name),this.registerEventListeners()}get context(){return(0,ee.Fd)(this.logger)}async rpcPublish(e){var t,r,i,n;let{topic:s,message:a,ttl:o=cj,prompt:c,tag:l,id:u,attestation:d,tvf:h}=e,f={method:oB(oL().protocol).publish,params:ul({topic:s,message:a,ttl:o,prompt:c,tag:l,attestation:d},h),id:u};oJ(null==(t=f.params)?void 0:t.prompt)&&(null==(r=f.params)||delete r.prompt),oJ(null==(i=f.params)?void 0:i.tag)&&(null==(n=f.params)||delete n.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:f});let p=await this.relayer.request(f);return this.relayer.events.emit(cF.publish,e),this.logger.debug("Successfully Published Payload"),p}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async(e,t)=>{let r=e.attempt+1;this.queue.set(t,uu(ul({},e),{attempt:r}));let{topic:i,message:n,opts:s,attestation:a}=e;this.logger.warn({},`Publisher: queue->publishing: ${e.opts.id}, tag: ${e.opts.tag}, attempt: ${r}`),await this.rpcPublish(uu(ul({},e),{topic:i,message:n,ttl:s.ttl,prompt:s.prompt,tag:s.tag,id:s.id,attestation:a,tvf:s.tvf})),this.logger.warn({},`Publisher: queue->published: ${e.opts.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(_,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(cF.connection_stalled);return}this.checkQueue()}),this.relayer.on(cF.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}var uf=Object.defineProperty,up=(e,t,r)=>t in e?uf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ug=(e,t,r)=>up(e,"symbol"!=typeof t?t+"":t,r);class um{constructor(){ug(this,"map",new Map),ug(this,"set",(e,t)=>{let r=this.get(e);this.exists(e,t)||this.map.set(e,[...r,t])}),ug(this,"get",e=>this.map.get(e)||[]),ug(this,"exists",(e,t)=>this.get(e).includes(t)),ug(this,"delete",(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;let r=this.get(e);if(!this.exists(e,t))return;let i=r.filter(e=>e!==t);if(!i.length){this.map.delete(e);return}this.map.set(e,i)}),ug(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var ub=Object.defineProperty,uy=Object.defineProperties,uw=Object.getOwnPropertyDescriptors,uv=Object.getOwnPropertySymbols,uA=Object.prototype.hasOwnProperty,uE=Object.prototype.propertyIsEnumerable,uC=(e,t,r)=>t in e?ub(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,u_=(e,t)=>{for(var r in t||(t={}))uA.call(t,r)&&uC(e,r,t[r]);if(uv)for(var r of uv(t))uE.call(t,r)&&uC(e,r,t[r]);return e},uI=(e,t)=>uy(e,uw(t)),uS=(e,t,r)=>uC(e,"symbol"!=typeof t?t+"":t,r);class uN extends ef{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,uS(this,"subscriptions",new Map),uS(this,"topicMap",new um),uS(this,"events",new y.EventEmitter),uS(this,"name","subscription"),uS(this,"version","0.3"),uS(this,"pending",new Map),uS(this,"cached",[]),uS(this,"initialized",!1),uS(this,"storagePrefix",cD),uS(this,"subscribeTimeout",(0,v.toMiliseconds)(v.ONE_MINUTE)),uS(this,"initialSubscribeTimeout",(0,v.toMiliseconds)(15*v.ONE_SECOND)),uS(this,"clientId"),uS(this,"batchSubscribeTopicsLimit",500),uS(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),uS(this,"subscribe",async(e,t)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}});try{let r=oL(t),i={topic:e,relay:r,transportType:t?.transportType};this.pending.set(e,i);let n=await this.rpcSubscribe(e,r,t);return"string"==typeof n&&(this.onSubscribe(n,i),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}})),n}catch(e){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(e),e}}),uS(this,"unsubscribe",async(e,t)=>{this.isInitialized(),"u">typeof t?.id?await this.unsubscribeById(e,t.id,t):await this.unsubscribeByTopic(e,t)}),uS(this,"isSubscribed",e=>new Promise(t=>{t(this.topicMap.topics.includes(e))})),uS(this,"isKnownTopic",e=>new Promise(t=>{t(this.topicMap.topics.includes(e)||this.pending.has(e)||this.cached.some(t=>t.topic===e))})),uS(this,"on",(e,t)=>{this.events.on(e,t)}),uS(this,"once",(e,t)=>{this.events.once(e,t)}),uS(this,"off",(e,t)=>{this.events.off(e,t)}),uS(this,"removeListener",(e,t)=>{this.events.removeListener(e,t)}),uS(this,"start",async()=>{await this.onConnect()}),uS(this,"stop",async()=>{await this.onDisconnect()}),uS(this,"restart",async()=>{await this.restore(),await this.onRestart()}),uS(this,"checkPending",async()=>{if(0===this.pending.size&&(!this.initialized||!this.relayer.connected))return;let e=[];this.pending.forEach(t=>{e.push(t)}),await this.batchSubscribe(e)}),uS(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(_,async()=>{await this.checkPending()}),this.events.on(cG.created,async e=>{let t=cG.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(cG.deleted,async e=>{let t=cG.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}),this.relayer=e,this.logger=(0,ee.Ep)(t,this.name),this.clientId=""}get context(){return(0,ee.Fd)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(e,t){let r=!1;try{r=this.getSubscription(e).topic===t}catch{}return r}reset(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){let r=this.topicMap.get(e);await Promise.all(r.map(async r=>await this.unsubscribeById(e,r,t)))}async unsubscribeById(e,t,r){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:r}});try{let i=oL(r);await this.restartToComplete({topic:e,id:t,relay:i}),await this.rpcUnsubscribe(e,t,i);let n=oQ("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,n),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:r}})}catch(e){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(e),e}}async rpcSubscribe(e,t,r){var i;r&&r?.transportType!==cH.relay||await this.restartToComplete({topic:e,id:e,relay:t});let n={method:oB(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let s=null==(i=r?.internal)?void 0:i.throwOnFailedPublish;try{let t=await this.getSubscriptionId(e);if(r?.transportType===cH.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(n).catch(e=>this.logger.warn(e))},(0,v.toMiliseconds)(v.ONE_SECOND)),t;let i=new Promise(async t=>{let r=i=>{i.topic===e&&(this.events.removeListener(cG.created,r),t(i.id))};this.events.on(cG.created,r);try{let i=await sp(new Promise((e,t)=>{this.relayer.request(n).catch(e=>{this.logger.warn(e,e?.message),t(e)}).then(e)}),this.initialSubscribeTimeout,`Subscribing to ${e} failed, please try again`);this.events.removeListener(cG.created,r),t(i)}catch{}}),a=await sp(i,this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!a&&s)throw Error(`Subscribing to ${e} failed, please try again`);return a?t:null}catch(e){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(cF.connection_stalled),s)throw e}return null}async rpcBatchSubscribe(e){if(!e.length)return;let t={method:oB(e[0].relay.protocol).batchSubscribe,params:{topics:e.map(e=>e.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:t});try{await await sp(new Promise(e=>{this.relayer.request(t).catch(e=>this.logger.warn(e)).then(e)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(cF.connection_stalled)}}async rpcBatchFetchMessages(e){let t;if(!e.length)return;let r={method:oB(e[0].relay.protocol).batchFetchMessages,params:{topics:e.map(e=>e.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});try{t=await await sp(new Promise((e,t)=>{this.relayer.request(r).catch(e=>{this.logger.warn(e),t(e)}).then(e)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(cF.connection_stalled)}return t}rpcUnsubscribe(e,t,r){let i={method:oB(r.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,t){this.setSubscription(e,uI(u_({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(e=>{this.setSubscription(e.id,u_({},e)),this.pending.delete(e.topic)})}async onUnsubscribe(e,t,r){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,r),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,u_({},t)),this.topicMap.set(t.topic,e),this.events.emit(cG.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let t=this.subscriptions.get(e);if(!t){let{message:t}=oK("NO_MATCHING_KEY",`${this.name}: ${e}`);throw Error(t)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});let r=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(r.topic,e),this.events.emit(cG.deleted,uI(u_({},r),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(cG.sync)}async onRestart(){if(this.cached.length){let e=[...this.cached],t=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){let{message:e}=oK("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){e.length&&(await this.rpcBatchSubscribe(e),this.onBatchSubscribe(await Promise.all(e.map(async e=>uI(u_({},e),{id:await this.getSubscriptionId(e.topic)})))))}async batchFetchMessages(e){var t;if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);let r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(await (t=(0,v.toMiliseconds)(v.ONE_SECOND),new Promise(e=>setTimeout(e,t))),await this.relayer.handleBatchMessageEvents(r.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){let{message:e}=oK("NOT_INITIALIZED",this.name);throw Error(e)}}async restartToComplete(e){this.relayer.connected||this.relayer.connecting||(this.cached.push(e),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(e){return oO(e+await this.getClientId())}}var uT=Object.defineProperty,uP=Object.getOwnPropertySymbols,ux=Object.prototype.hasOwnProperty,uO=Object.prototype.propertyIsEnumerable,uR=(e,t,r)=>t in e?uT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uk=(e,t)=>{for(var r in t||(t={}))ux.call(t,r)&&uR(e,r,t[r]);if(uP)for(var r of uP(t))uO.call(t,r)&&uR(e,r,t[r]);return e},uD=(e,t,r)=>uR(e,"symbol"!=typeof t?t+"":t,r);class uM extends ed{constructor(e){super(e),uD(this,"protocol","wc"),uD(this,"version",2),uD(this,"core"),uD(this,"logger"),uD(this,"events",new y.EventEmitter),uD(this,"provider"),uD(this,"messages"),uD(this,"subscriber"),uD(this,"publisher"),uD(this,"name","relayer"),uD(this,"transportExplicitlyClosed",!1),uD(this,"initialized",!1),uD(this,"connectionAttemptInProgress",!1),uD(this,"relayUrl"),uD(this,"projectId"),uD(this,"packageName"),uD(this,"bundleId"),uD(this,"hasExperiencedNetworkDisruption",!1),uD(this,"pingTimeout"),uD(this,"heartBeatTimeout",(0,v.toMiliseconds)(v.THIRTY_SECONDS+v.FIVE_SECONDS)),uD(this,"reconnectTimeout"),uD(this,"connectPromise"),uD(this,"reconnectInProgress",!1),uD(this,"requestsInFlight",[]),uD(this,"connectTimeout",(0,v.toMiliseconds)(15*v.ONE_SECOND)),uD(this,"request",async e=>{var t,r;this.logger.debug("Publishing Request Payload");let i=e.id||ch().toString();await this.toEstablishConnection();try{this.logger.trace({id:i,method:e.method,topic:null==(t=e.params)?void 0:t.topic},"relayer.request - publishing...");let n=`${i}:${(null==(r=e.params)?void 0:r.tag)||""}`;this.requestsInFlight.push(n);let s=await this.provider.request(e);return this.requestsInFlight=this.requestsInFlight.filter(e=>e!==n),s}catch(e){throw this.logger.debug(`Failed to Publish Request: ${i}`),e}}),uD(this,"resetPingTimeout",()=>{si()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var e,t,r,i;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),null==(i=null==(r=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:r.terminate)||i.call(r)}catch(e){this.logger.warn(e,e?.message)}},this.heartBeatTimeout))}),uD(this,"onPayloadHandler",e=>{this.onProviderPayload(e),this.resetPingTimeout()}),uD(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected \uD83D\uDEDC"),this.startPingTimeout(),this.events.emit(cF.connect)}),uD(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected \uD83D\uDED1"),this.requestsInFlight=[],this.onProviderDisconnect()}),uD(this,"onProviderErrorHandler",e=>{this.logger.fatal(`Fatal socket error: ${e.message}`),this.events.emit(cF.error,e),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),uD(this,"registerProviderListeners",()=>{this.provider.on(cq.payload,this.onPayloadHandler),this.provider.on(cq.connect,this.onConnectHandler),this.provider.on(cq.disconnect,this.onDisconnectHandler),this.provider.on(cq.error,this.onProviderErrorHandler)}),this.core=e.core,this.logger="u">typeof e.logger&&"string"!=typeof e.logger?(0,ee.Ep)(e.logger,this.name):(0,ee.gw)((0,ee.jI)({level:e.logger||"error"})),this.messages=new ut(this.logger,e.core),this.subscriber=new uN(this,this.logger),this.publisher=new uh(this,this.logger),this.relayUrl=e?.relayUrl||c$,this.projectId=e.projectId,sn()&&"u">typeof r.g&&"u">typeof(null==r.g?void 0:r.g.Platform)&&(null==r.g?void 0:r.g.Platform.OS)==="android"?this.packageName=so():sn()&&"u">typeof r.g&&"u">typeof(null==r.g?void 0:r.g.Platform)&&(null==r.g?void 0:r.g.Platform.OS)==="ios"&&(this.bundleId=so()),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.hasAnyTopics)try{await this.transportOpen()}catch(e){this.logger.warn(e,e?.message)}}get context(){return(0,ee.Fd)(this.logger)}get connected(){var e,t,r;return(null==(r=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:r.readyState)===1}get connecting(){var e,t,r;return(null==(r=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:r.readyState)===0||void 0!==this.connectPromise}async publish(e,t,r){this.isInitialized(),await this.publisher.publish(e,t,r),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now(),transportType:cH.relay},cW.outbound)}async subscribe(e,t){var r,i,n;this.isInitialized(),null!=t&&t.transportType&&t?.transportType!=="relay"||await this.toEstablishConnection();let s=typeof(null==(r=t?.internal)?void 0:r.throwOnFailedPublish)>"u"||(null==(i=t?.internal)?void 0:i.throwOnFailedPublish),a=(null==(n=this.subscriber.topicMap.get(e))?void 0:n[0])||"",o,c=t=>{t.topic===e&&(this.subscriber.off(cG.created,c),o())};return await Promise.all([new Promise(e=>{o=e,this.subscriber.on(cG.created,c)}),new Promise(async(r,i)=>{a=await this.subscriber.subscribe(e,uk({internal:{throwOnFailedPublish:s}},t)).catch(e=>{s&&i(e)})||a,r()})]),a}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await sp(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){if(!this.subscriber.hasAnyTopics){this.logger.warn("Starting WS connection skipped because the client has no topics to work with.");return}if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(t,r)=>{await this.connect(e).then(t).catch(r).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(e){this.logger.debug({},"Restarting transport..."),this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await ce())throw Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(e?.length===0){this.logger.trace("Batch message events is empty. Ignoring...");return}let t=e.sort((e,t)=>e.publishedAt-t.publishedAt);for(let e of(this.logger.debug(`Batch of ${t.length} message events sorted`),t))try{await this.onMessageEvent(e)}catch(e){this.logger.warn(e,"Error while processing batch message event: "+e?.message)}this.logger.trace(`Batch of ${t.length} message events processed`)}async onLinkMessageEvent(e,t){let{topic:r}=e;if(!t.sessionExists){let e=sb(v.FIVE_MINUTES);await this.core.pairing.pairings.set(r,{topic:r,expiry:e,relay:{protocol:"irn"},active:!1})}this.events.emit(cF.message,e),await this.recordMessageEvent(e,cW.inbound)}async connect(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let t=1;for(;t<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${t}...`),await this.createProvider(),await new Promise(async(e,t)=>{let r=()=>{t(Error("Connection interrupted while trying to subscribe"))};this.provider.once(cq.disconnect,r),await sp(new Promise((e,t)=>{this.provider.connect().then(e).catch(t)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(e=>{t(e)}).finally(()=>{this.provider.off(cq.disconnect,r),clearTimeout(this.reconnectTimeout)}),await new Promise(async(e,t)=>{let r=()=>{t(Error("Connection interrupted while trying to subscribe"))};this.provider.once(cq.disconnect,r),await this.subscriber.start().then(e).catch(t).finally(()=>{this.provider.off(cq.disconnect,r)})}),this.hasExperiencedNetworkDisruption=!1,e()})}catch(e){await this.subscriber.stop(),this.logger.warn({},e.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${t}`);break}await new Promise(e=>setTimeout(e,(0,v.toMiliseconds)(1*t))),t++}}startPingTimeout(){var e,t,r,i,n;if(si())try{null!=(t=null==(e=this.provider)?void 0:e.connection)&&t.socket&&(null==(n=null==(i=null==(r=this.provider)?void 0:r.connection)?void 0:i.socket)||n.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(e){this.logger.warn(e,e?.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new cN(new cO(function({protocol:e,version:t,relayUrl:r,sdkVersion:i,auth:n,projectId:s,useOnCloseEvent:a,bundleId:o,packageName:c}){let l=r.split("?"),u=sl(e,t,i),d=function(e,t){let r=new URLSearchParams(e);for(let e of Object.keys(t).sort())if(t.hasOwnProperty(e)){let i=t[e];void 0!==i&&r.set(e,i)}return r.toString()}(l[1]||"",{auth:n,ua:u,projectId:s,useOnCloseEvent:a||void 0,packageName:c||void 0,bundleId:o||void 0});return l[0]+"?"+d}({sdkVersion:cz,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(e,t){let{topic:r,message:i}=e;await this.messages.set(r,i,t)}async shouldIgnoreMessageEvent(e){let{topic:t,message:r}=e;if(!r||0===r.length)return this.logger.warn(`Ignoring invalid/empty message: ${r}`),!0;if(!await this.subscriber.isKnownTopic(t))return this.logger.warn(`Ignoring message for unknown topic ${t}`),!0;let i=this.messages.has(t,r);return i&&this.logger.warn(`Ignoring duplicate message: ${r}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),cC(e)){if(!e.method.endsWith("_subscription"))return;let t=e.params,{topic:r,message:i,publishedAt:n,attestation:s}=t.data,a={topic:r,message:i,publishedAt:n,transportType:cH.relay,attestation:s};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(uk({type:"event",event:t.id},a)),this.events.emit(t.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else c_(e)&&this.events.emit(cF.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(await this.recordMessageEvent(e,cW.inbound),this.events.emit(cF.message,e))}async acknowledgePayload(e){let t=cp(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(cq.payload,this.onPayloadHandler),this.provider.off(cq.connect,this.onConnectHandler),this.provider.off(cq.disconnect,this.onDisconnectHandler),this.provider.off(cq.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await ce();!function(e){switch(sa()){case sr.browser:!sn()&&ss()&&(window.addEventListener("online",()=>e(!0)),window.addEventListener("offline",()=>e(!1)));break;case sr.reactNative:sn()&&"u">typeof r.g&&null!=r.g&&r.g.NetInfo&&r.g?.NetInfo.addEventListener(t=>e(t?.isConnected));case sr.node:}}(async t=>{e!==t&&(e=t,t?await this.transportOpen().catch(e=>this.logger.error(e,e?.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(cF.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e,e?.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},(0,v.toMiliseconds)(.1)))))}isInitialized(){if(!this.initialized){let{message:e}=oK("NOT_INITIALIZED",this.name);throw Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),this.connected||await this.connect()}}function uU(){}function uL(e){if(!e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&"[object Object]"===Object.prototype.toString.call(e)}function uB(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function uj(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}let u$="[object Arguments]",uF="[object Object]";var uq=Object.defineProperty,uz=Object.getOwnPropertySymbols,uH=Object.prototype.hasOwnProperty,uW=Object.prototype.propertyIsEnumerable,uV=(e,t,r)=>t in e?uq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uG=(e,t)=>{for(var r in t||(t={}))uH.call(t,r)&&uV(e,r,t[r]);if(uz)for(var r of uz(t))uW.call(t,r)&&uV(e,r,t[r]);return e},uK=(e,t,r)=>uV(e,"symbol"!=typeof t?t+"":t,r);class uQ extends eh{constructor(e,t,r,i=cD,n){super(e,t,r,i),this.core=e,this.logger=t,this.name=r,uK(this,"map",new Map),uK(this,"version","0.3"),uK(this,"cached",[]),uK(this,"initialized",!1),uK(this,"getKey"),uK(this,"storagePrefix",cD),uK(this,"recentlyDeleted",[]),uK(this,"recentlyDeletedLimit",200),uK(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(e=>{var t;this.getKey&&null!==e&&!oJ(e)?this.map.set(this.getKey(e),e):(null==(t=e?.proposer)?void 0:t.publicKey)?this.map.set(e.id,e):e?.topic&&this.map.set(e.topic,e)}),this.cached=[],this.initialized=!0)}),uK(this,"set",async(e,t)=>{this.isInitialized(),this.map.has(e)?await this.update(e,t):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:e,value:t}),this.map.set(e,t),await this.persist())}),uK(this,"get",e=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:e}),this.getData(e))),uK(this,"getAll",e=>(this.isInitialized(),e?this.values.filter(t=>Object.keys(e).every(r=>(function e(t,r,i,n,s,a,o){let c=o(t,r,i,n,s,a);if(void 0!==c)return c;if(typeof t==typeof r)switch(typeof t){case"bigint":case"string":case"boolean":case"symbol":case"undefined":case"function":return t===r;case"number":return t===r||Object.is(t,r)}return function t(r,i,n,s){if(Object.is(r,i))return!0;let a=uj(r),o=uj(i);if(a===u$&&(a=uF),o===u$&&(o=uF),a!==o)return!1;switch(a){case"[object String]":return r.toString()===i.toString();case"[object Number]":{let e=r.valueOf(),t=i.valueOf();return e===t||Number.isNaN(e)&&Number.isNaN(t)}case"[object Boolean]":case"[object Date]":case"[object Symbol]":return Object.is(r.valueOf(),i.valueOf());case"[object RegExp]":return r.source===i.source&&r.flags===i.flags;case"[object Function]":return r===i}let c=(n=n??new Map).get(r),l=n.get(i);if(null!=c&&null!=l)return c===i;n.set(r,i),n.set(i,r);try{switch(a){case"[object Map]":if(r.size!==i.size)return!1;for(let[t,a]of r.entries())if(!i.has(t)||!e(a,i.get(t),t,r,i,n,s))return!1;return!0;case"[object Set]":{if(r.size!==i.size)return!1;let t=Array.from(r.values()),a=Array.from(i.values());for(let o=0;oe(c,t,void 0,r,i,n,s));if(-1===l)return!1;a.splice(l,1)}return!0}case"[object Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":case"[object BigUint64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object BigInt64Array]":case"[object Float32Array]":case"[object Float64Array]":if("u">typeof cR&&cR.isBuffer(r)!==cR.isBuffer(i)||r.length!==i.length)return!1;for(let t=0;t{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:e,update:t});let r=uG(uG({},this.getData(e)),t);this.map.set(e,r),await this.persist()}),uK(this,"delete",async(e,t)=>{this.isInitialized(),this.map.has(e)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:e,reason:t}),this.map.delete(e),this.addToRecentlyDeleted(e),await this.persist())}),this.logger=(0,ee.Ep)(t,this.name),this.storagePrefix=i,this.getKey=n}get context(){return(0,ee.Fd)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){let{message:t}=oK("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(t),Error(t)}let{message:t}=oK("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(t),Error(t)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{let e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){let{message:e}=oK("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=oK("NOT_INITIALIZED",this.name);throw Error(e)}}}var uY=Object.defineProperty,uZ=(e,t,r)=>t in e?uY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uJ=(e,t,r)=>uZ(e,"symbol"!=typeof t?t+"":t,r);class uX{constructor(e,t){this.core=e,this.logger=t,uJ(this,"name","pairing"),uJ(this,"version","0.3"),uJ(this,"events",new(w())),uJ(this,"pairings"),uJ(this,"initialized",!1),uJ(this,"storagePrefix",cD),uJ(this,"ignoredPayloadTypes",[1]),uJ(this,"registeredMethods",[]),uJ(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),uJ(this,"register",({methods:e})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...e])]}),uJ(this,"create",async e=>{this.isInitialized();let t=oP(),r=await this.core.crypto.setSymKey(t),i=sb(v.FIVE_MINUTES),n={protocol:"irn"},s={topic:r,expiry:i,relay:n,active:!1,methods:e?.methods},a=o$({protocol:this.core.protocol,version:this.core.version,topic:r,symKey:t,relay:n,expiryTimestamp:i,methods:e?.methods});return this.events.emit(cQ.create,s),this.core.expirer.set(r,i),await this.pairings.set(r,s),await this.core.relayer.subscribe(r,{transportType:e?.transportType}),{topic:r,uri:a}}),uJ(this,"pair",async e=>{let t;this.isInitialized();let r=this.core.eventClient.createEvent({properties:{topic:e?.uri,trace:[c1.pairing_started]}});this.isValidPair(e,r);let{topic:i,symKey:n,relay:s,expiryTimestamp:a,methods:o}=oj(e.uri);if(r.props.properties.topic=i,r.addTrace(c1.pairing_uri_validation_success),r.addTrace(c1.pairing_uri_not_expired),this.pairings.keys.includes(i)){if(t=this.pairings.get(i),r.addTrace(c1.existing_pairing),t.active)throw r.setError(c2.active_pairing_already_exists),Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);r.addTrace(c1.pairing_not_expired)}let c=a||sb(v.FIVE_MINUTES),l={topic:i,relay:s,expiry:c,active:!1,methods:o};this.core.expirer.set(i,c),await this.pairings.set(i,l),r.addTrace(c1.store_new_pairing),e.activatePairing&&await this.activate({topic:i}),this.events.emit(cQ.create,l),r.addTrace(c1.emit_inactive_pairing),this.core.crypto.keychain.has(i)||await this.core.crypto.setSymKey(n,i),r.addTrace(c1.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{r.setError(c2.no_internet_connection)}try{await this.core.relayer.subscribe(i,{relay:s})}catch(e){throw r.setError(c2.subscribe_pairing_topic_failure),e}return r.addTrace(c1.subscribe_pairing_topic_success),l}),uJ(this,"activate",async({topic:e})=>{this.isInitialized();let t=sb(v.FIVE_MINUTES);this.core.expirer.set(e,t),await this.pairings.update(e,{active:!0,expiry:t})}),uJ(this,"ping",async e=>{this.isInitialized(),await this.isValidPing(e),this.logger.warn("ping() is deprecated and will be removed in the next major release.");let{topic:t}=e;if(this.pairings.keys.includes(t)){let e=await this.sendRequest(t,"wc_pairingPing",{}),{done:r,resolve:i,reject:n}=sf();this.events.once(sw("pairing_ping",e),({error:e})=>{e?n(e):i()}),await r()}}),uJ(this,"updateExpiry",async({topic:e,expiry:t})=>{this.isInitialized(),await this.pairings.update(e,{expiry:t})}),uJ(this,"updateMetadata",async({topic:e,metadata:t})=>{this.isInitialized(),await this.pairings.update(e,{peerMetadata:t})}),uJ(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),uJ(this,"disconnect",async e=>{this.isInitialized(),await this.isValidDisconnect(e);let{topic:t}=e;this.pairings.keys.includes(t)&&(await this.sendRequest(t,"wc_pairingDelete",oQ("USER_DISCONNECTED")),await this.deletePairing(t))}),uJ(this,"formatUriFromPairing",e=>{this.isInitialized();let{topic:t,relay:r,expiry:i,methods:n}=e,s=this.core.crypto.keychain.get(t);return o$({protocol:this.core.protocol,version:this.core.version,topic:t,symKey:s,relay:r,expiryTimestamp:i,methods:n})}),uJ(this,"sendRequest",async(e,t,r)=>{let i=cf(t,r),n=await this.core.crypto.encode(e,i),s=cK[t].req;return this.core.history.set(e,i),this.core.relayer.publish(e,n,s),i.id}),uJ(this,"sendResult",async(e,t,r)=>{let i=cp(e,r),n=await this.core.crypto.encode(t,i),s=cK[(await this.core.history.get(t,e)).request.method].res;await this.core.relayer.publish(t,n,s),await this.core.history.resolve(i)}),uJ(this,"sendError",async(e,t,r)=>{let i=cg(e,r),n=await this.core.crypto.encode(t,i),s=(await this.core.history.get(t,e)).request.method,a=cK[s]?cK[s].res:cK.unregistered_method.res;await this.core.relayer.publish(t,n,a),await this.core.history.resolve(i)}),uJ(this,"deletePairing",async(e,t)=>{await this.core.relayer.unsubscribe(e),await Promise.all([this.pairings.delete(e,oQ("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(e),t?Promise.resolve():this.core.expirer.del(e)])}),uJ(this,"cleanup",async()=>{let e=this.pairings.getAll().filter(e=>sy(e.expiry));await Promise.all(e.map(e=>this.deletePairing(e.topic)))}),uJ(this,"onRelayEventRequest",async e=>{let{topic:t,payload:r}=e;switch(r.method){case"wc_pairingPing":return await this.onPairingPingRequest(t,r);case"wc_pairingDelete":return await this.onPairingDeleteRequest(t,r);default:return await this.onUnknownRpcMethodRequest(t,r)}}),uJ(this,"onRelayEventResponse",async e=>{let{topic:t,payload:r}=e,i=(await this.core.history.get(t,r.id)).request.method;return"wc_pairingPing"===i?this.onPairingPingResponse(t,r):this.onUnknownRpcMethodResponse(i)}),uJ(this,"onPairingPingRequest",async(e,t)=>{let{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult(r,e,!0),this.events.emit(cQ.ping,{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.logger.error(t)}}),uJ(this,"onPairingPingResponse",(e,t)=>{let{id:r}=t;setTimeout(()=>{cI(t)?this.events.emit(sw("pairing_ping",r),{}):cS(t)&&this.events.emit(sw("pairing_ping",r),{error:t.error})},500)}),uJ(this,"onPairingDeleteRequest",async(e,t)=>{let{id:r}=t;try{this.isValidDisconnect({topic:e}),await this.deletePairing(e),this.events.emit(cQ.delete,{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.logger.error(t)}}),uJ(this,"onUnknownRpcMethodRequest",async(e,t)=>{let{id:r,method:i}=t;try{if(this.registeredMethods.includes(i))return;let t=oQ("WC_METHOD_UNSUPPORTED",i);await this.sendError(r,e,t),this.logger.error(t)}catch(t){await this.sendError(r,e,t),this.logger.error(t)}}),uJ(this,"onUnknownRpcMethodResponse",e=>{this.registeredMethods.includes(e)||this.logger.error(oQ("WC_METHOD_UNSUPPORTED",e))}),uJ(this,"isValidPair",(e,t)=>{var r;if(!o6(e)){let{message:r}=oK("MISSING_OR_INVALID",`pair() params: ${e}`);throw t.setError(c2.malformed_pairing_uri),Error(r)}if(!function(e){function t(e){try{return"u">typeof new URL(e)}catch{return!1}}try{if(oX(e,!1)){if(t(e))return!0;let r=sS(e);return t(r)}}catch{}return!1}(e.uri)){let{message:r}=oK("MISSING_OR_INVALID",`pair() uri: ${e.uri}`);throw t.setError(c2.malformed_pairing_uri),Error(r)}let i=oj(e?.uri);if(!(null!=(r=i?.relay)&&r.protocol)){let{message:e}=oK("MISSING_OR_INVALID","pair() uri#relay-protocol");throw t.setError(c2.malformed_pairing_uri),Error(e)}if(!(null!=i&&i.symKey)){let{message:e}=oK("MISSING_OR_INVALID","pair() uri#symKey");throw t.setError(c2.malformed_pairing_uri),Error(e)}if(null!=i&&i.expiryTimestamp&&(0,v.toMiliseconds)(i?.expiryTimestamp){if(!o6(e)){let{message:t}=oK("MISSING_OR_INVALID",`ping() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidPairingTopic(t)}),uJ(this,"isValidDisconnect",async e=>{if(!o6(e)){let{message:t}=oK("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidPairingTopic(t)}),uJ(this,"isValidPairingTopic",async e=>{if(!oX(e,!1)){let{message:t}=oK("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw Error(t)}if(!this.pairings.keys.includes(e)){let{message:t}=oK("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw Error(t)}if(sy(this.pairings.get(e).expiry)){await this.deletePairing(e);let{message:t}=oK("EXPIRED",`pairing topic: ${e}`);throw Error(t)}}),this.core=e,this.logger=(0,ee.Ep)(t,this.name),this.pairings=new uQ(this.core,this.logger,this.name,this.storagePrefix)}get context(){return(0,ee.Fd)(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=oK("NOT_INITIALIZED",this.name);throw Error(e)}}registerRelayerEvents(){this.core.relayer.on(cF.message,async e=>{let{topic:t,message:r,transportType:i}=e;if(this.pairings.keys.includes(t)&&i!==cH.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))try{let e=await this.core.crypto.decode(t,r);cC(e)?(this.core.history.set(t,e),await this.onRelayEventRequest({topic:t,payload:e})):c_(e)&&(await this.core.history.resolve(e),await this.onRelayEventResponse({topic:t,payload:e}),this.core.history.delete(t,e.id)),await this.core.relayer.messages.ack(t,r)}catch(e){this.logger.error(e)}})}registerExpirerEvents(){this.core.expirer.on(cZ.expired,async e=>{let{topic:t}=sm(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(cQ.expire,{topic:t}))})}}var u0=Object.defineProperty,u1=(e,t,r)=>t in e?u0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,u2=(e,t,r)=>u1(e,"symbol"!=typeof t?t+"":t,r);class u3 extends ec{constructor(e,t){super(e,t),this.core=e,this.logger=t,u2(this,"records",new Map),u2(this,"events",new y.EventEmitter),u2(this,"name","history"),u2(this,"version","0.3"),u2(this,"cached",[]),u2(this,"initialized",!1),u2(this,"storagePrefix",cD),u2(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(e=>this.records.set(e.id,e)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),u2(this,"set",(e,t,r)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:e,request:t,chainId:r}),this.records.has(t.id))return;let i={id:t.id,topic:e,request:{method:t.method,params:t.params||null},chainId:r,expiry:sb(v.THIRTY_DAYS)};this.records.set(i.id,i),this.persist(),this.events.emit(cY.created,i)}),u2(this,"resolve",async e=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:e}),!this.records.has(e.id))return;let t=await this.getRecord(e.id);typeof t.response>"u"&&(t.response=cS(e)?{error:e.error}:{result:e.result},this.records.set(t.id,t),this.persist(),this.events.emit(cY.updated,t))}),u2(this,"get",async(e,t)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:e,id:t}),await this.getRecord(t))),u2(this,"delete",(e,t)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:t}),this.values.forEach(r=>{r.topic!==e||"u">typeof t&&r.id!==t||(this.records.delete(r.id),this.events.emit(cY.deleted,r))}),this.persist()}),u2(this,"exists",async(e,t)=>(this.isInitialized(),!!this.records.has(t)&&(await this.getRecord(t)).topic===e)),u2(this,"on",(e,t)=>{this.events.on(e,t)}),u2(this,"once",(e,t)=>{this.events.once(e,t)}),u2(this,"off",(e,t)=>{this.events.off(e,t)}),u2(this,"removeListener",(e,t)=>{this.events.removeListener(e,t)}),this.logger=(0,ee.Ep)(t,this.name)}get context(){return(0,ee.Fd)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(t=>{if("u">typeof t.response)return;let r={topic:t.topic,request:cf(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(r)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let t=this.records.get(e);if(!t){let{message:t}=oK("NO_MATCHING_KEY",`${this.name}: ${e}`);throw Error(t)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(cY.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:e}=oK("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(cY.created,e=>{let t=cY.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(cY.updated,e=>{let t=cY.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(cY.deleted,e=>{let t=cY.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.core.heartbeat.on(_,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(t=>{(0,v.toMiliseconds)(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(cY.deleted,t,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){let{message:e}=oK("NOT_INITIALIZED",this.name);throw Error(e)}}}var u8=Object.defineProperty,u5=(e,t,r)=>t in e?u8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,u6=(e,t,r)=>u5(e,"symbol"!=typeof t?t+"":t,r);class u4 extends ep{constructor(e,t){super(e,t),this.core=e,this.logger=t,u6(this,"expirations",new Map),u6(this,"events",new y.EventEmitter),u6(this,"name","expirer"),u6(this,"version","0.3"),u6(this,"cached",[]),u6(this,"initialized",!1),u6(this,"storagePrefix",cD),u6(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(e=>this.expirations.set(e.target,e)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),u6(this,"has",e=>{try{let t=this.formatTarget(e);return"u">typeof this.getExpiration(t)}catch{return!1}}),u6(this,"set",(e,t)=>{this.isInitialized();let r=this.formatTarget(e),i={target:r,expiry:t};this.expirations.set(r,i),this.checkExpiry(r,i),this.events.emit(cZ.created,{target:r,expiration:i})}),u6(this,"get",e=>{this.isInitialized();let t=this.formatTarget(e);return this.getExpiration(t)}),u6(this,"del",e=>{if(this.isInitialized(),this.has(e)){let t=this.formatTarget(e),r=this.getExpiration(t);this.expirations.delete(t),this.events.emit(cZ.deleted,{target:t,expiration:r})}}),u6(this,"on",(e,t)=>{this.events.on(e,t)}),u6(this,"once",(e,t)=>{this.events.once(e,t)}),u6(this,"off",(e,t)=>{this.events.off(e,t)}),u6(this,"removeListener",(e,t)=>{this.events.removeListener(e,t)}),this.logger=(0,ee.Ep)(t,this.name)}get context(){return(0,ee.Fd)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if("string"==typeof e)return sg("topic",e);if("number"==typeof e)return sg("id",e);let{message:t}=oK("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(cZ.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:e}=oK("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let t=this.expirations.get(e);if(!t){let{message:t}=oK("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(t),Error(t)}return t}checkExpiry(e,t){let{expiry:r}=t;(0,v.toMiliseconds)(r)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(cZ.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(_,()=>this.checkExpirations()),this.events.on(cZ.created,e=>{let t=cZ.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(cZ.expired,e=>{let t=cZ.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(cZ.deleted,e=>{let t=cZ.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=oK("NOT_INITIALIZED",this.name);throw Error(e)}}}var u9=Object.defineProperty,u7=(e,t,r)=>t in e?u9(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,de=(e,t,r)=>u7(e,"symbol"!=typeof t?t+"":t,r);class dt extends eg{constructor(e,t,r){super(e,t,r),this.core=e,this.logger=t,this.store=r,de(this,"name","verify-api"),de(this,"abortController"),de(this,"isDevEnv"),de(this,"verifyUrlV3",cX),de(this,"storagePrefix",cD),de(this,"version",2),de(this,"publicKey"),de(this,"fetchPromise"),de(this,"init",async()=>{var e;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&(0,v.toMiliseconds)(null==(e=this.publicKey)?void 0:e.expiresAt){if(!ss()||this.isDevEnv)return;let t=window.location.origin,{id:r,decryptedId:i}=e,n=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${t}&id=${r}&decryptedId=${i}`;try{let e=(0,rW.getDocument)(),t=this.startAbortTimer(5*v.ONE_SECOND),i=await new Promise((i,s)=>{let a=()=>{window.removeEventListener("message",c),e.body.removeChild(o),s("attestation aborted")};this.abortController.signal.addEventListener("abort",a);let o=e.createElement("iframe");o.src=n,o.style.display="none",o.addEventListener("error",a,{signal:this.abortController.signal});let c=n=>{if(n.data&&"string"==typeof n.data)try{let s=JSON.parse(n.data);if("verify_attestation"===s.type){if(rR(s.attestation).payload.id!==r)return;clearInterval(t),e.body.removeChild(o),this.abortController.signal.removeEventListener("abort",a),window.removeEventListener("message",c),i(null===s.attestation?"":s.attestation)}}catch(e){this.logger.warn(e)}};e.body.appendChild(o),window.addEventListener("message",c,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",i),i}catch(e){this.logger.warn(e)}return""}),de(this,"resolve",async e=>{if(this.isDevEnv)return"";let{attestationId:t,hash:r,encryptedId:i}=e;if(""===t){this.logger.debug("resolve: attestationId is empty, skipping");return}if(t){if(rR(t).payload.id!==i)return;let e=await this.isValidJwtAttestation(t);if(e){if(!e.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return e}}if(!r)return;let n=this.getVerifyUrl(e?.verifyUrl);return this.fetchAttestation(r,n)}),de(this,"fetchAttestation",async(e,t)=>{this.logger.debug(`resolving attestation: ${e} from url: ${t}`);let r=this.startAbortTimer(5*v.ONE_SECOND),i=await fetch(`${t}/attestation/${e}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(r),200===i.status?await i.json():void 0}),de(this,"getVerifyUrl",e=>{let t=e||cJ;return c0.includes(t)||(this.logger.info(`verify url: ${t}, not included in trusted list, assigning default: ${cJ}`),t=cJ),t}),de(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);let e=this.startAbortTimer(v.FIVE_SECONDS),t=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(e),await t.json()}catch(e){this.logger.warn(e)}}),de(this,"persistPublicKey",async e=>{this.logger.debug("persisting public key to local storage",e),await this.store.setItem(this.storeKey,e),this.publicKey=e}),de(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),de(this,"isValidJwtAttestation",async e=>{let t=await this.getPublicKey();try{if(t)return this.validateAttestation(e,t)}catch(e){this.logger.error(e),this.logger.warn("error validating attestation")}let r=await this.fetchAndPersistPublicKey();try{if(r)return this.validateAttestation(e,r)}catch(e){this.logger.error(e),this.logger.warn("error validating attestation")}}),de(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),de(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async e=>{let t=await this.fetchPublicKey();t&&(await this.persistPublicKey(t),e(t))});let e=await this.fetchPromise;return this.fetchPromise=void 0,e}),de(this,"validateAttestation",(e,t)=>{let r=function(e,t){let[r,i,n]=e.split("."),s=n7.from(function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4;return r>0&&(t+="=".repeat(4-r)),t}(n),"base64");if(64!==s.length)throw Error("Invalid signature length");let a=s.slice(0,32).toString("hex"),o=s.slice(32,64).toString("hex"),c=a7(`${r}.${i}`),l=new n6.ec("p256").keyFromPublic({x:n7.from(t.x,"base64").toString("hex"),y:n7.from(t.y,"base64").toString("hex")},"hex"),u=n5(c,oI);if(!l.verify(u,{r:a,s:o}))throw Error("Invalid signature");return rR(e).payload}(e,t.publicKey),i={hasExpired:(0,v.toMiliseconds)(r.exp)this.abortController.abort(),(0,v.toMiliseconds)(e))}}var dr=Object.defineProperty,di=(e,t,r)=>t in e?dr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,dn=(e,t,r)=>di(e,"symbol"!=typeof t?t+"":t,r);class ds extends em{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,dn(this,"context","echo"),dn(this,"registerDeviceToken",async e=>{let{clientId:t,token:r,notificationType:i,enableEncrypted:n=!1}=e,s=`https://echo.walletconnect.com/${this.projectId}/clients`;await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:t,type:i,token:r,always_raw:n})})}),this.logger=(0,ee.Ep)(t,this.context)}}var da=Object.defineProperty,dc=Object.getOwnPropertySymbols,dl=Object.prototype.hasOwnProperty,du=Object.prototype.propertyIsEnumerable,dd=(e,t,r)=>t in e?da(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,dh=(e,t)=>{for(var r in t||(t={}))dl.call(t,r)&&dd(e,r,t[r]);if(dc)for(var r of dc(t))du.call(t,r)&&dd(e,r,t[r]);return e},df=(e,t,r)=>dd(e,"symbol"!=typeof t?t+"":t,r);class dp extends eb{constructor(e,t,r=!0){super(e,t,r),this.core=e,this.logger=t,df(this,"context","event-client"),df(this,"storagePrefix",cD),df(this,"storageVersion",.1),df(this,"events",new Map),df(this,"shouldPersist",!1),df(this,"init",async()=>{if(!sI())try{let e={eventId:s_(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:sl(this.core.relayer.protocol,this.core.relayer.version,cz)}}};await this.sendEvent([e])}catch(e){this.logger.warn(e)}}),df(this,"createEvent",e=>{let{event:t="ERROR",type:r="",properties:{topic:i,trace:n}}=e,s=s_(),a=this.core.projectId||"",o=dh({eventId:s,timestamp:Date.now(),props:{event:t,type:r,properties:{topic:i,trace:n}},bundleId:a,domain:this.getAppDomain()},this.setMethods(s));return this.telemetryEnabled&&(this.events.set(s,o),this.shouldPersist=!0),o}),df(this,"getEvent",e=>{let{eventId:t,topic:r}=e;if(t)return this.events.get(t);let i=Array.from(this.events.values()).find(e=>e.props.properties.topic===r);if(i)return dh(dh({},i),this.setMethods(i.eventId))}),df(this,"deleteEvent",e=>{let{eventId:t}=e;this.events.delete(t),this.shouldPersist=!0}),df(this,"setEventListeners",()=>{this.core.heartbeat.on(_,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(e=>{(0,v.fromMiliseconds)(Date.now())-(0,v.fromMiliseconds)(e.timestamp)>86400&&(this.events.delete(e.eventId),this.shouldPersist=!0)})})}),df(this,"setMethods",e=>({addTrace:t=>this.addTrace(e,t),setError:t=>this.setError(e,t)})),df(this,"addTrace",(e,t)=>{let r=this.events.get(e);r&&(r.props.properties.trace.push(t),this.events.set(e,r),this.shouldPersist=!0)}),df(this,"setError",(e,t)=>{let r=this.events.get(e);r&&(r.props.type=t,r.timestamp=Date.now(),this.events.set(e,r),this.shouldPersist=!0)}),df(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),df(this,"restore",async()=>{try{let e=await this.core.storage.getItem(this.storageKey)||[];if(!e.length)return;e.forEach(e=>{this.events.set(e.eventId,dh(dh({},e),this.setMethods(e.eventId)))})}catch(e){this.logger.warn(e)}}),df(this,"submit",async()=>{if(!this.telemetryEnabled||0===this.events.size)return;let e=[];for(let[t,r]of this.events)r.props.type&&e.push(r);if(0!==e.length)try{if((await this.sendEvent(e)).ok)for(let t of e)this.events.delete(t.eventId),this.shouldPersist=!0}catch(e){this.logger.warn(e)}}),df(this,"sendEvent",async e=>{let t=this.getAppDomain()?"":"&sp=desktop";return await fetch(`https://pulse.walletconnect.org/batch?projectId=${this.core.projectId}&st=events_sdk&sv=js-${cz}${t}`,{method:"POST",body:JSON.stringify(e)})}),df(this,"getAppDomain",()=>sc().url),this.logger=(0,ee.Ep)(t,this.context),this.telemetryEnabled=r,r?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var dg=Object.defineProperty,dm=Object.getOwnPropertySymbols,db=Object.prototype.hasOwnProperty,dy=Object.prototype.propertyIsEnumerable,dw=(e,t,r)=>t in e?dg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,dv=(e,t)=>{for(var r in t||(t={}))db.call(t,r)&&dw(e,r,t[r]);if(dm)for(var r of dm(t))dy.call(t,r)&&dw(e,r,t[r]);return e},dA=(e,t,r)=>dw(e,"symbol"!=typeof t?t+"":t,r);class dE extends en{constructor(e){var t;super(e),dA(this,"protocol","wc"),dA(this,"version",2),dA(this,"name",ck),dA(this,"relayUrl"),dA(this,"projectId"),dA(this,"customStoragePrefix"),dA(this,"events",new y.EventEmitter),dA(this,"logger"),dA(this,"heartbeat"),dA(this,"relayer"),dA(this,"crypto"),dA(this,"storage"),dA(this,"history"),dA(this,"expirer"),dA(this,"pairing"),dA(this,"verify"),dA(this,"echoClient"),dA(this,"linkModeSupportedApps"),dA(this,"eventClient"),dA(this,"initialized",!1),dA(this,"logChunkController"),dA(this,"on",(e,t)=>this.events.on(e,t)),dA(this,"once",(e,t)=>this.events.once(e,t)),dA(this,"off",(e,t)=>this.events.off(e,t)),dA(this,"removeListener",(e,t)=>this.events.removeListener(e,t)),dA(this,"dispatchEnvelope",({topic:e,message:t,sessionExists:r})=>{if(!e||!t)return;let i={topic:e,message:t,publishedAt:Date.now(),transportType:cH.link_mode};this.relayer.onLinkMessageEvent(i,{sessionExists:r})}),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||c$,this.customStoragePrefix=null!=e&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";let r=(0,ee.jI)({level:"string"==typeof e?.logger&&e.logger?e.logger:cM.logger,name:ck}),{logger:i,chunkLoggerController:n}=(0,ee.Rt)({opts:r,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=n,null!=(t=this.logChunkController)&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var e,t;null!=(e=this.logChunkController)&&e.downloadLogsBlobInBrowser&&(null==(t=this.logChunkController)||t.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=(0,ee.Ep)(i,this.name),this.heartbeat=new I,this.crypto=new l0(this,this.logger,e?.keychain),this.history=new u3(this,this.logger),this.expirer=new u4(this,this.logger),this.storage=null!=e&&e.storage?e.storage:new X(dv(dv({},cU),e?.storageOptions)),this.relayer=new uM({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new uX(this,this.logger),this.verify=new dt(this,this.logger,this.storage),this.echoClient=new ds(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new dp(this,this.logger,e?.telemetryEnabled)}static async init(e){let t=new dE(e);await t.initialize();let r=await t.crypto.getClientId();return await t.storage.setItem("WALLETCONNECT_CLIENT_ID",r),t}get context(){return(0,ee.Fd)(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return null==(e=this.logChunkController)?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(cV,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(cV)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}let dC="client",d_=`wc@2:${dC}:`,dI={name:dC,logger:"error"},dS="WALLETCONNECT_DEEPLINK_CHOICE",dN="Proposal expired",dT=v.SEVEN_DAYS,dP={wc_sessionPropose:{req:{ttl:v.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:v.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:v.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:v.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:v.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:v.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:v.ONE_DAY,prompt:!1,tag:1104},res:{ttl:v.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:v.ONE_DAY,prompt:!1,tag:1106},res:{ttl:v.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:v.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:v.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:v.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:v.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:v.ONE_DAY,prompt:!1,tag:1112},res:{ttl:v.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:v.ONE_DAY,prompt:!1,tag:1114},res:{ttl:v.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:v.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:v.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:v.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:v.FIVE_MINUTES,prompt:!1,tag:1119}}},dx={min:v.FIVE_MINUTES,max:v.SEVEN_DAYS},dO={idle:"IDLE",active:"ACTIVE"},dR={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"}},dk=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],dD="wc@1.5:auth:",dM=`${dD}:PUB_KEY`;var dU=Object.defineProperty,dL=Object.defineProperties,dB=Object.getOwnPropertyDescriptors,dj=Object.getOwnPropertySymbols,d$=Object.prototype.hasOwnProperty,dF=Object.prototype.propertyIsEnumerable,dq=(e,t,r)=>t in e?dU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,dz=(e,t)=>{for(var r in t||(t={}))d$.call(t,r)&&dq(e,r,t[r]);if(dj)for(var r of dj(t))dF.call(t,r)&&dq(e,r,t[r]);return e},dH=(e,t)=>dL(e,dB(t)),dW=(e,t,r)=>dq(e,"symbol"!=typeof t?t+"":t,r);class dV extends eE{constructor(e){super(e),dW(this,"name","engine"),dW(this,"events",new(w())),dW(this,"initialized",!1),dW(this,"requestQueue",{state:dO.idle,queue:[]}),dW(this,"sessionRequestQueue",{state:dO.idle,queue:[]}),dW(this,"requestQueueDelay",v.ONE_SECOND),dW(this,"expectedPairingMethodMap",new Map),dW(this,"recentlyDeletedMap",new Map),dW(this,"recentlyDeletedLimit",200),dW(this,"relayMessageCache",[]),dW(this,"pendingSessions",new Map),dW(this,"init",async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(dP)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},(0,v.toMiliseconds)(this.requestQueueDelay)))}),dW(this,"connect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();let t=dH(dz({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(t);let{pairingTopic:r,requiredNamespaces:i,optionalNamespaces:n,sessionProperties:s,scopedProperties:a,relays:o}=t,c=r,l,u=!1;try{if(c){let e=this.client.core.pairing.pairings.get(c);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),u=e.active}}catch(e){throw this.client.logger.error(`connect() -> pairing.get(${c}) failed`),e}if(!c||!u){let{topic:e,uri:t}=await this.client.core.pairing.create();c=e,l=t}if(!c){let{message:e}=oK("NO_MATCHING_KEY",`connect() pairing topic: ${c}`);throw Error(e)}let d=await this.client.core.crypto.generateKeyPair(),h=dP.wc_sessionPropose.req.ttl||v.FIVE_MINUTES,f=sb(h),p=dH(dz(dz({requiredNamespaces:i,optionalNamespaces:n,relays:o??[{protocol:"irn"}],proposer:{publicKey:d,metadata:this.client.metadata},expiryTimestamp:f,pairingTopic:c},s&&{sessionProperties:s}),a&&{scopedProperties:a}),{id:cd()}),g=sw("session_connect",p.id),{reject:m,resolve:b,done:y}=sf(h,dN),w=({id:e})=>{e===p.id&&(this.client.events.off("proposal_expire",w),this.pendingSessions.delete(p.id),this.events.emit(g,{error:{message:dN,code:0}}))};return this.client.events.on("proposal_expire",w),this.events.once(g,({error:e,session:t})=>{this.client.events.off("proposal_expire",w),e?m(e):t&&b(t)}),await this.sendRequest({topic:c,method:"wc_sessionPropose",params:p,throwOnFailedPublish:!0,clientRpcId:p.id}),await this.setProposal(p.id,p),{uri:l,approval:y}}),dW(this,"pair",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(e){throw this.client.logger.error("pair() failed"),e}}),dW(this,"approve",async e=>{var t,r,i;let n=this.client.core.eventClient.createEvent({properties:{topic:null==(t=e?.id)?void 0:t.toString(),trace:[c3.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(e){throw n.setError(c8.no_internet_connection),e}try{await this.isValidProposalId(e?.id)}catch(t){throw this.client.logger.error(`approve() -> proposal.get(${e?.id}) failed`),n.setError(c8.proposal_not_found),t}try{await this.isValidApprove(e)}catch(e){throw this.client.logger.error("approve() -> isValidApprove() failed"),n.setError(c8.session_approve_namespace_validation_failure),e}let{id:s,relayProtocol:a,namespaces:o,sessionProperties:c,scopedProperties:l,sessionConfig:u}=e,d=this.client.proposal.get(s);this.client.core.eventClient.deleteEvent({eventId:n.eventId});let{pairingTopic:h,proposer:f,requiredNamespaces:p,optionalNamespaces:g}=d,m=null==(r=this.client.core.eventClient)?void 0:r.getEvent({topic:h});m||(m=null==(i=this.client.core.eventClient)?void 0:i.createEvent({type:c3.session_approve_started,properties:{topic:h,trace:[c3.session_approve_started,c3.session_namespaces_validation_success]}}));let b=await this.client.core.crypto.generateKeyPair(),y=f.publicKey,w=await this.client.core.crypto.generateSharedKey(b,y),v=dz(dz(dz({relay:{protocol:a??"irn"},namespaces:o,controller:{publicKey:b,metadata:this.client.metadata},expiry:sb(dT)},c&&{sessionProperties:c}),l&&{scopedProperties:l}),u&&{sessionConfig:u}),A=cH.relay;m.addTrace(c3.subscribing_session_topic);try{await this.client.core.relayer.subscribe(w,{transportType:A})}catch(e){throw m.setError(c8.subscribe_session_topic_failure),e}m.addTrace(c3.subscribe_session_topic_success);let E=dH(dz({},v),{topic:w,requiredNamespaces:p,optionalNamespaces:g,pairingTopic:h,acknowledged:!1,self:v.controller,peer:{publicKey:f.publicKey,metadata:f.metadata},controller:b,transportType:cH.relay});await this.client.session.set(w,E),m.addTrace(c3.store_session);try{m.addTrace(c3.publishing_session_settle),await this.sendRequest({topic:w,method:"wc_sessionSettle",params:v,throwOnFailedPublish:!0}).catch(e=>{throw m?.setError(c8.session_settle_publish_failure),e}),m.addTrace(c3.session_settle_publish_success),m.addTrace(c3.publishing_session_approve),await this.sendResult({id:s,topic:h,result:{relay:{protocol:a??"irn"},responderPublicKey:b},throwOnFailedPublish:!0}).catch(e=>{throw m?.setError(c8.session_approve_publish_failure),e}),m.addTrace(c3.session_approve_publish_success)}catch(e){throw this.client.logger.error(e),this.client.session.delete(w,oQ("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(w),e}return this.client.core.eventClient.deleteEvent({eventId:m.eventId}),await this.client.core.pairing.updateMetadata({topic:h,metadata:f.metadata}),await this.client.proposal.delete(s,oQ("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:h}),await this.setExpiry(w,sb(dT)),{topic:w,acknowledged:()=>Promise.resolve(this.client.session.get(w))}}),dW(this,"reject",async e=>{let t;this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(e)}catch(e){throw this.client.logger.error("reject() -> isValidReject() failed"),e}let{id:r,reason:i}=e;try{t=this.client.proposal.get(r).pairingTopic}catch(e){throw this.client.logger.error(`reject() -> proposal.get(${r}) failed`),e}t&&(await this.sendError({id:r,topic:t,error:i,rpcOpts:dP.wc_sessionPropose.reject}),await this.client.proposal.delete(r,oQ("USER_DISCONNECTED")))}),dW(this,"update",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(e){throw this.client.logger.error("update() -> isValidUpdate() failed"),e}let{topic:t,namespaces:r}=e,{done:i,resolve:n,reject:s}=sf(),a=cd(),o=ch().toString(),c=this.client.session.get(t).namespaces;return this.events.once(sw("session_update",a),({error:e})=>{e?s(e):n()}),await this.client.session.update(t,{namespaces:r}),await this.sendRequest({topic:t,method:"wc_sessionUpdate",params:{namespaces:r},throwOnFailedPublish:!0,clientRpcId:a,relayRpcId:o}).catch(e=>{this.client.logger.error(e),this.client.session.update(t,{namespaces:c}),s(e)}),{acknowledged:i}}),dW(this,"extend",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(e)}catch(e){throw this.client.logger.error("extend() -> isValidExtend() failed"),e}let{topic:t}=e,r=cd(),{done:i,resolve:n,reject:s}=sf();return this.events.once(sw("session_extend",r),({error:e})=>{e?s(e):n()}),await this.setExpiry(t,sb(dT)),this.sendRequest({topic:t,method:"wc_sessionExtend",params:{},clientRpcId:r,throwOnFailedPublish:!0}).catch(e=>{s(e)}),{acknowledged:i}}),dW(this,"request",async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(e){throw this.client.logger.error("request() -> isValidRequest() failed"),e}let{chainId:t,request:r,topic:i,expiry:n=dP.wc_sessionRequest.req.ttl}=e,s=this.client.session.get(i);s?.transportType===cH.relay&&await this.confirmOnlineStateOrThrow();let a=cd(),o=ch().toString(),{done:c,resolve:l,reject:u}=sf(n,"Request expired. Please try again.");this.events.once(sw("session_request",a),({error:e,result:t})=>{e?u(e):l(t)});let d="wc_sessionRequest",h=this.getAppLinkIfEnabled(s.peer.metadata,s.transportType);if(h)return await this.sendRequest({clientRpcId:a,relayRpcId:o,topic:i,method:d,params:{request:dH(dz({},r),{expiryTimestamp:sb(n)}),chainId:t},expiry:n,throwOnFailedPublish:!0,appLink:h}).catch(e=>u(e)),this.client.events.emit("session_request_sent",{topic:i,request:r,chainId:t,id:a}),await c();let f={request:dH(dz({},r),{expiryTimestamp:sb(n)}),chainId:t},p=this.shouldSetTVF(d,f);return await Promise.all([new Promise(async e=>{await this.sendRequest(dz({clientRpcId:a,relayRpcId:o,topic:i,method:d,params:f,expiry:n,throwOnFailedPublish:!0},p&&{tvf:this.getTVFParams(a,f)})).catch(e=>u(e)),this.client.events.emit("session_request_sent",{topic:i,request:r,chainId:t,id:a}),e()}),new Promise(async e=>{var t;if(!(null!=(t=s.sessionConfig)&&t.disableDeepLink)){let e=await sE(this.client.core.storage,dS);await sA({id:a,topic:i,wcDeepLink:e})}e()}),c()]).then(e=>e[2])}),dW(this,"respond",async e=>{this.isInitialized(),await this.isValidRespond(e);let{topic:t,response:r}=e,{id:i}=r,n=this.client.session.get(t);n.transportType===cH.relay&&await this.confirmOnlineStateOrThrow();let s=this.getAppLinkIfEnabled(n.peer.metadata,n.transportType);cI(r)?await this.sendResult({id:i,topic:t,result:r.result,throwOnFailedPublish:!0,appLink:s}):cS(r)&&await this.sendError({id:i,topic:t,error:r.error,appLink:s}),this.cleanupAfterResponse(e)}),dW(this,"ping",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(e){throw this.client.logger.error("ping() -> isValidPing() failed"),e}let{topic:t}=e;if(this.client.session.keys.includes(t)){let e=cd(),r=ch().toString(),{done:i,resolve:n,reject:s}=sf();this.events.once(sw("session_ping",e),({error:e})=>{e?s(e):n()}),await Promise.all([this.sendRequest({topic:t,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:e,relayRpcId:r}),i()])}else this.client.core.pairing.pairings.keys.includes(t)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:t}))}),dW(this,"emit",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);let{topic:t,event:r,chainId:i}=e,n=ch().toString(),s=cd();await this.sendRequest({topic:t,method:"wc_sessionEvent",params:{event:r,chainId:i},throwOnFailedPublish:!0,relayRpcId:n,clientRpcId:s})}),dW(this,"disconnect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);let{topic:t}=e;if(this.client.session.keys.includes(t))await this.sendRequest({topic:t,method:"wc_sessionDelete",params:oQ("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:t,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(t))await this.client.core.pairing.disconnect({topic:t});else{let{message:e}=oK("MISMATCHED_TOPIC",`Session or pairing topic not found: ${t}`);throw Error(e)}}),dW(this,"find",e=>(this.isInitialized(),this.client.session.getAll().filter(t=>(function(e,t){let{requiredNamespaces:r}=t,i=Object.keys(e.namespaces),n=Object.keys(r),s=!0;return!!su(n,i)&&(i.forEach(t=>{let{accounts:i,methods:n,events:a}=e.namespaces[t],o=oq(i),c=r[t];su(st(t,c),o)&&su(c.methods,n)&&su(c.events,a)||(s=!1)}),s)})(t,e)))),dW(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),dW(this,"authenticate",async(e,t)=>{var r,i,n;let s;this.isInitialized(),this.isValidAuthenticate(e);let a=t&&this.client.core.linkModeSupportedApps.includes(t)&&(null==(r=this.client.metadata.redirect)?void 0:r.linkMode),o=a?cH.link_mode:cH.relay;o===cH.relay&&await this.confirmOnlineStateOrThrow();let{chains:c,statement:l="",uri:u,domain:d,nonce:h,type:f,exp:p,nbf:g,methods:m=[],expiry:b}=e,y=[...e.resources||[]],{topic:w,uri:v}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:w,uri:v}});let A=await this.client.core.crypto.generateKeyPair(),E=ox(A);if(await Promise.all([this.client.auth.authKeys.set(dM,{responseTopic:E,publicKey:A}),this.client.auth.pairingTopics.set(E,{topic:E,pairingTopic:w})]),await this.client.core.relayer.subscribe(E,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${w}`),m.length>0){let{namespace:e}=se(c[0]),t=ay(function(e,t,r,i={}){return r?.sort((e,t)=>e.localeCompare(t)),{att:{[e]:function(e,t,r={}){return Object.assign({},...(t=t?.sort((e,t)=>e.localeCompare(t))).map(t=>({[`${e}/${t}`]:[r]})))}(t,r,i)}}}(e,"request",m));aE(y)&&(i=t,n=y.pop(),t=ay(function(e,t){ab(e),ab(t);let r=Object.keys(e.att).concat(Object.keys(t.att)).sort((e,t)=>e.localeCompare(t)),i={att:{}};return r.forEach(r=>{var n,s;Object.keys((null==(n=e.att)?void 0:n[r])||{}).concat(Object.keys((null==(s=t.att)?void 0:s[r])||{})).sort((e,t)=>e.localeCompare(t)).forEach(n=>{var s,a;i.att[r]=au(al({},i.att[r]),{[n]:(null==(s=e.att[r])?void 0:s[n])||(null==(a=t.att[r])?void 0:a[n])})})}),i}(aw(i),aw(n)))),y.push(t)}let C=b&&b>dP.wc_sessionAuthenticate.req.ttl?b:dP.wc_sessionAuthenticate.req.ttl,_={authPayload:{type:f??"caip122",chains:c,statement:l,aud:u,domain:d,version:"1",nonce:h,iat:new Date().toISOString(),exp:p,nbf:g,resources:y},requester:{publicKey:A,metadata:this.client.metadata},expiryTimestamp:sb(C)},I={requiredNamespaces:{},optionalNamespaces:{eip155:{chains:c,methods:[...new Set(["personal_sign",...m])],events:["chainChanged","accountsChanged"]}},relays:[{protocol:"irn"}],pairingTopic:w,proposer:{publicKey:A,metadata:this.client.metadata},expiryTimestamp:sb(dP.wc_sessionPropose.req.ttl),id:cd()},{done:S,resolve:N,reject:T}=sf(C,"Request expired"),P=cd(),x=sw("session_connect",I.id),O=sw("session_request",P),R=async({error:e,session:t})=>{this.events.off(O,k),e?T(e):t&&N({session:t})},k=async e=>{var r,i,n;let s;if(await this.deletePendingAuthRequest(P,{message:"fulfilled",code:0}),e.error){let t=oQ("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return e.error.code===t.code?void 0:(this.events.off(x,R),T(e.error.message))}await this.deleteProposal(I.id),this.events.off(x,R);let{cacaos:a,responder:c}=e.result,l=[],u=[];for(let e of a){await ag({cacao:e,projectId:this.client.core.projectId})||(this.client.logger.error(e,"Signature verification failed"),T(oQ("SESSION_SETTLEMENT_FAILED","Signature verification failed")));let{p:t}=e,r=aE(t.resources),i=[af(t.iss)],n=ap(t.iss);if(r){let e=av(r),t=aA(r);l.push(...e),i.push(...t)}for(let e of i)u.push(`${e}:${n}`)}let d=await this.client.core.crypto.generateSharedKey(A,c.publicKey);l.length>0&&(s={topic:d,acknowledged:!0,self:{publicKey:A,metadata:this.client.metadata},peer:c,controller:c.publicKey,expiry:sb(dT),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:w,namespaces:oW([...new Set(l)],[...new Set(u)]),transportType:o},await this.client.core.relayer.subscribe(d,{transportType:o}),await this.client.session.set(d,s),w&&await this.client.core.pairing.updateMetadata({topic:w,metadata:c.metadata}),s=this.client.session.get(d)),null!=(r=this.client.metadata.redirect)&&r.linkMode&&null!=(i=c.metadata.redirect)&&i.linkMode&&null!=(n=c.metadata.redirect)&&n.universal&&t&&(this.client.core.addLinkModeSupportedApp(c.metadata.redirect.universal),this.client.session.update(d,{transportType:cH.link_mode})),N({auths:a,session:s})};this.events.once(x,R),this.events.once(O,k);try{if(a){let e=cf("wc_sessionAuthenticate",_,P);this.client.core.history.set(w,e);let r=await this.client.core.crypto.encode("",e,{type:2,encoding:oN});s=oF(t,w,r)}else await Promise.all([this.sendRequest({topic:w,method:"wc_sessionAuthenticate",params:_,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:P}),this.sendRequest({topic:w,method:"wc_sessionPropose",params:I,expiry:dP.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:I.id})])}catch(e){throw this.events.off(x,R),this.events.off(O,k),e}return await this.setProposal(I.id,I),await this.setAuthRequest(P,{request:dH(dz({},_),{verifyContext:{}}),pairingTopic:w,transportType:o}),{uri:s??v,response:S}}),dW(this,"approveSessionAuthenticate",async e=>{let t;let{id:r,auths:i}=e,n=this.client.core.eventClient.createEvent({properties:{topic:r.toString(),trace:[c5.authenticated_session_approve_started]}});try{this.isInitialized()}catch(e){throw n.setError(c6.no_internet_connection),e}let s=this.getPendingAuthRequest(r);if(!s)throw n.setError(c6.authenticated_session_pending_request_not_found),Error(`Could not find pending auth request with id ${r}`);let a=s.transportType||cH.relay;a===cH.relay&&await this.confirmOnlineStateOrThrow();let o=s.requester.publicKey,c=await this.client.core.crypto.generateKeyPair(),l=ox(o),u={type:1,receiverPublicKey:o,senderPublicKey:c},d=[],h=[];for(let e of i){if(!await ag({cacao:e,projectId:this.client.core.projectId})){n.setError(c6.invalid_cacao);let e=oQ("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:r,topic:l,error:e,encodeOpts:u}),Error(e.message)}n.addTrace(c5.cacaos_verified);let{p:t}=e,i=aE(t.resources),s=[af(t.iss)],a=ap(t.iss);if(i){let e=av(i),t=aA(i);d.push(...e),s.push(...t)}for(let e of s)h.push(`${e}:${a}`)}let f=await this.client.core.crypto.generateSharedKey(c,o);if(n.addTrace(c5.create_authenticated_session_topic),d?.length>0){t={topic:f,acknowledged:!0,self:{publicKey:c,metadata:this.client.metadata},peer:{publicKey:o,metadata:s.requester.metadata},controller:o,expiry:sb(dT),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:s.pairingTopic,namespaces:oW([...new Set(d)],[...new Set(h)]),transportType:a},n.addTrace(c5.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(f,{transportType:a})}catch(e){throw n.setError(c6.subscribe_authenticated_session_topic_failure),e}n.addTrace(c5.subscribe_authenticated_session_topic_success),await this.client.session.set(f,t),n.addTrace(c5.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:s.pairingTopic,metadata:s.requester.metadata})}n.addTrace(c5.publishing_authenticated_session_approve);try{await this.sendResult({topic:l,id:r,result:{cacaos:i,responder:{publicKey:c,metadata:this.client.metadata}},encodeOpts:u,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(s.requester.metadata,a)})}catch(e){throw n.setError(c6.authenticated_session_approve_publish_failure),e}return await this.client.auth.requests.delete(r,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:s.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:n.eventId}),{session:t}}),dW(this,"rejectSessionAuthenticate",async e=>{this.isInitialized();let{id:t,reason:r}=e,i=this.getPendingAuthRequest(t);if(!i)throw Error(`Could not find pending auth request with id ${t}`);i.transportType===cH.relay&&await this.confirmOnlineStateOrThrow();let n=i.requester.publicKey,s=await this.client.core.crypto.generateKeyPair(),a=ox(n);await this.sendError({id:t,topic:a,error:r,encodeOpts:{type:1,receiverPublicKey:n,senderPublicKey:s},rpcOpts:dP.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(i.requester.metadata,i.transportType)}),await this.client.auth.requests.delete(t,{message:"rejected",code:0}),await this.client.proposal.delete(t,oQ("USER_DISCONNECTED"))}),dW(this,"formatAuthMessage",e=>{this.isInitialized();let{request:t,iss:r}=e;return am(t,r)}),dW(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(0!==this.relayMessageCache.length)for(;this.relayMessageCache.length>0;)try{let e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(e){this.client.logger.error(e)}},50)}),dW(this,"cleanupDuplicatePairings",async e=>{if(e.pairingTopic)try{let t=this.client.core.pairing.pairings.get(e.pairingTopic),r=this.client.core.pairing.pairings.getAll().filter(r=>{var i,n;return(null==(i=r.peerMetadata)?void 0:i.url)&&(null==(n=r.peerMetadata)?void 0:n.url)===e.peer.metadata.url&&r.topic&&r.topic!==t.topic});if(0===r.length)return;this.client.logger.info(`Cleaning up ${r.length} duplicate pairing(s)`),await Promise.all(r.map(e=>this.client.core.pairing.disconnect({topic:e.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(e){this.client.logger.error(e)}}),dW(this,"deleteSession",async e=>{var t;let{topic:r,expirerHasDeleted:i=!1,emitEvent:n=!0,id:s=0}=e,{self:a}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await this.client.session.delete(r,oQ("USER_DISCONNECTED")),this.addToRecentlyDeleted(r,"session"),this.client.core.crypto.keychain.has(a.publicKey)&&await this.client.core.crypto.deleteKeyPair(a.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),i||this.client.core.expirer.del(r),this.client.core.storage.removeItem(dS).catch(e=>this.client.logger.warn(e)),this.getPendingSessionRequests().forEach(e=>{e.topic===r&&this.deletePendingSessionRequest(e.id,oQ("USER_DISCONNECTED"))}),r===(null==(t=this.sessionRequestQueue.queue[0])?void 0:t.topic)&&(this.sessionRequestQueue.state=dO.idle),n&&this.client.events.emit("session_delete",{id:s,topic:r})}),dW(this,"deleteProposal",async(e,t)=>{if(t)try{let t=this.client.proposal.get(e),r=this.client.core.eventClient.getEvent({topic:t.pairingTopic});r?.setError(c8.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(e,oQ("USER_DISCONNECTED")),t?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")}),dW(this,"deletePendingSessionRequest",async(e,t,r=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,t),r?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(t=>t.id!==e),r&&(this.sessionRequestQueue.state=dO.idle,this.client.events.emit("session_request_expire",{id:e}))}),dW(this,"deletePendingAuthRequest",async(e,t,r=!1)=>{await Promise.all([this.client.auth.requests.delete(e,t),r?Promise.resolve():this.client.core.expirer.del(e)])}),dW(this,"setExpiry",async(e,t)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,t),await this.client.session.update(e,{expiry:t}))}),dW(this,"setProposal",async(e,t)=>{this.client.core.expirer.set(e,sb(dP.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,t)}),dW(this,"setAuthRequest",async(e,t)=>{let{request:r,pairingTopic:i,transportType:n=cH.relay}=t;this.client.core.expirer.set(e,r.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:r.authPayload,requester:r.requester,expiryTimestamp:r.expiryTimestamp,id:e,pairingTopic:i,verifyContext:r.verifyContext,transportType:n})}),dW(this,"setPendingSessionRequest",async e=>{let{id:t,topic:r,params:i,verifyContext:n}=e,s=i.request.expiryTimestamp||sb(dP.wc_sessionRequest.req.ttl);this.client.core.expirer.set(t,s),await this.client.pendingRequest.set(t,{id:t,topic:r,params:i,verifyContext:n})}),dW(this,"sendRequest",async e=>{let t,i;let{topic:n,method:s,params:a,expiry:o,relayRpcId:c,clientRpcId:l,throwOnFailedPublish:u,appLink:d,tvf:h}=e,f=cf(s,a,l),p=!!d;try{let e=p?oN:oS;t=await this.client.core.crypto.encode(n,f,{encoding:e})}catch(e){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),e}if(dk.includes(s)){let e=oO(JSON.stringify(f)),r=oO(t);i=await this.client.core.verify.register({id:r,decryptedId:e})}let g=dP[s].req;if(g.attestation=i,o&&(g.ttl=o),c&&(g.id=c),this.client.core.history.set(n,f),p){let e=oF(d,n,t);await r.g.Linking.openURL(e,this.client.name)}else{let e=dP[s].req;o&&(e.ttl=o),c&&(e.id=c),e.tvf=dH(dz({},h),{correlationId:f.id}),u?(e.internal=dH(dz({},e.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,t,e)):this.client.core.relayer.publish(n,t,e).catch(e=>this.client.logger.error(e))}return f.id}),dW(this,"sendResult",async e=>{let t,i,n;let{id:s,topic:a,result:o,throwOnFailedPublish:c,encodeOpts:l,appLink:u}=e,d=cp(s,o),h=u&&"u">typeof(null==r.g?void 0:r.g.Linking);try{let e=h?oN:oS;t=await this.client.core.crypto.encode(a,d,dH(dz({},l||{}),{encoding:e}))}catch(e){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${a} failed`),e}try{let e=(i=await this.client.core.history.get(a,s)).request;try{this.shouldSetTVF(e.method,e.params)&&(n=this.getTVFParams(s,e.params,o))}catch(e){this.client.logger.warn("sendResult() -> getTVFParams() failed",e)}}catch(e){throw this.client.logger.error(`sendResult() -> history.get(${a}, ${s}) failed`),e}if(h){let e=oF(u,a,t);await r.g.Linking.openURL(e,this.client.name)}else{let e=dP[i.request.method].res;e.tvf=dH(dz({},n),{correlationId:s}),c?(e.internal=dH(dz({},e.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(a,t,e)):this.client.core.relayer.publish(a,t,e).catch(e=>this.client.logger.error(e))}await this.client.core.history.resolve(d)}),dW(this,"sendError",async e=>{let t,i;let{id:n,topic:s,error:a,encodeOpts:o,rpcOpts:c,appLink:l}=e,u=cg(n,a),d=l&&"u">typeof(null==r.g?void 0:r.g.Linking);try{let e=d?oN:oS;t=await this.client.core.crypto.encode(s,u,dH(dz({},o||{}),{encoding:e}))}catch(e){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${s} failed`),e}try{i=await this.client.core.history.get(s,n)}catch(e){throw this.client.logger.error(`sendError() -> history.get(${s}, ${n}) failed`),e}if(d){let e=oF(l,s,t);await r.g.Linking.openURL(e,this.client.name)}else{let e=i.request.method,r=c||dP[e].res;this.client.core.relayer.publish(s,t,r)}await this.client.core.history.resolve(u)}),dW(this,"cleanup",async()=>{let e=[],t=[];this.client.session.getAll().forEach(t=>{let r=!1;sy(t.expiry)&&(r=!0),this.client.core.crypto.keychain.has(t.topic)||(r=!0),r&&e.push(t.topic)}),this.client.proposal.getAll().forEach(e=>{sy(e.expiryTimestamp)&&t.push(e.id)}),await Promise.all([...e.map(e=>this.deleteSession({topic:e})),...t.map(e=>this.deleteProposal(e))])}),dW(this,"onProviderMessageEvent",async e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):await this.onRelayMessage(e)}),dW(this,"onRelayEventRequest",async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()}),dW(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===dO.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=dO.active;let e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(e){this.client.logger.warn(e)}}this.requestQueue.state=dO.idle}),dW(this,"processRequest",async e=>{let{topic:t,payload:r,attestation:i,transportType:n,encryptedId:s}=e,a=r.method;if(!this.shouldIgnorePairingRequest({topic:t,requestMethod:a}))switch(a){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:t,payload:r,attestation:i,encryptedId:s});case"wc_sessionSettle":return await this.onSessionSettleRequest(t,r);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(t,r);case"wc_sessionExtend":return await this.onSessionExtendRequest(t,r);case"wc_sessionPing":return await this.onSessionPingRequest(t,r);case"wc_sessionDelete":return await this.onSessionDeleteRequest(t,r);case"wc_sessionRequest":return await this.onSessionRequest({topic:t,payload:r,attestation:i,encryptedId:s,transportType:n});case"wc_sessionEvent":return await this.onSessionEventRequest(t,r);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:t,payload:r,attestation:i,encryptedId:s,transportType:n});default:return this.client.logger.info(`Unsupported request method ${a}`)}}),dW(this,"onRelayEventResponse",async e=>{let{topic:t,payload:r,transportType:i}=e,n=(await this.client.core.history.get(t,r.id)).request.method;switch(n){case"wc_sessionPropose":return this.onSessionProposeResponse(t,r,i);case"wc_sessionSettle":return this.onSessionSettleResponse(t,r);case"wc_sessionUpdate":return this.onSessionUpdateResponse(t,r);case"wc_sessionExtend":return this.onSessionExtendResponse(t,r);case"wc_sessionPing":return this.onSessionPingResponse(t,r);case"wc_sessionRequest":return this.onSessionRequestResponse(t,r);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(t,r);default:return this.client.logger.info(`Unsupported response method ${n}`)}}),dW(this,"onRelayEventUnknownPayload",e=>{let{topic:t}=e,{message:r}=oK("MISSING_OR_INVALID",`Decoded payload on topic ${t} is not identifiable as a JSON-RPC request or a response.`);throw Error(r)}),dW(this,"shouldIgnorePairingRequest",e=>{let{topic:t,requestMethod:r}=e,i=this.expectedPairingMethodMap.get(t);return!(!i||i.includes(r))&&!!(i.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),dW(this,"onSessionProposeRequest",async e=>{let{topic:t,payload:r,attestation:i,encryptedId:n}=e,{params:s,id:a}=r;try{let e=this.client.core.eventClient.getEvent({topic:t});0===this.client.events.listenerCount("session_proposal")&&(console.warn("No listener for session_proposal event"),e?.setError(c2.proposal_listener_not_found)),this.isValidConnect(dz({},r.params));let o=s.expiryTimestamp||sb(dP.wc_sessionPropose.req.ttl),c=dz({id:a,pairingTopic:t,expiryTimestamp:o},s);await this.setProposal(a,c);let l=await this.getVerifyContext({attestationId:i,hash:oO(JSON.stringify(r)),encryptedId:n,metadata:c.proposer.metadata});e?.addTrace(c1.emit_session_proposal),this.client.events.emit("session_proposal",{id:a,params:c,verifyContext:l})}catch(e){await this.sendError({id:a,topic:t,error:e,rpcOpts:dP.wc_sessionPropose.autoReject}),this.client.logger.error(e)}}),dW(this,"onSessionProposeResponse",async(e,t,r)=>{let{id:i}=t;if(cI(t)){let{result:n}=t;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:n});let s=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:s});let a=s.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:a});let o=n.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:o});let c=await this.client.core.crypto.generateSharedKey(a,o);this.pendingSessions.set(i,{sessionTopic:c,pairingTopic:e,proposalId:i,publicKey:a});let l=await this.client.core.relayer.subscribe(c,{transportType:r});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:l}),await this.client.core.pairing.activate({topic:e})}else if(cS(t)){await this.client.proposal.delete(i,oQ("USER_DISCONNECTED"));let e=sw("session_connect",i);if(0===this.events.listenerCount(e))throw Error(`emitting ${e} without any listeners, 954`);this.events.emit(e,{error:t.error})}}),dW(this,"onSessionSettleRequest",async(e,t)=>{let{id:r,params:i}=t;try{this.isValidSessionSettleRequest(i);let{relay:r,controller:n,expiry:s,namespaces:a,sessionProperties:o,scopedProperties:c,sessionConfig:l}=t.params,u=[...this.pendingSessions.values()].find(t=>t.sessionTopic===e);if(!u)return this.client.logger.error(`Pending session not found for topic ${e}`);let d=this.client.proposal.get(u.proposalId),h=dH(dz(dz(dz({topic:e,relay:r,expiry:s,namespaces:a,acknowledged:!0,pairingTopic:u.pairingTopic,requiredNamespaces:d.requiredNamespaces,optionalNamespaces:d.optionalNamespaces,controller:n.publicKey,self:{publicKey:u.publicKey,metadata:this.client.metadata},peer:{publicKey:n.publicKey,metadata:n.metadata}},o&&{sessionProperties:o}),c&&{scopedProperties:c}),l&&{sessionConfig:l}),{transportType:cH.relay});await this.client.session.set(h.topic,h),await this.setExpiry(h.topic,h.expiry),await this.client.core.pairing.updateMetadata({topic:u.pairingTopic,metadata:h.peer.metadata}),this.client.events.emit("session_connect",{session:h}),this.events.emit(sw("session_connect",u.proposalId),{session:h}),this.pendingSessions.delete(u.proposalId),this.deleteProposal(u.proposalId,!1),this.cleanupDuplicatePairings(h),await this.sendResult({id:t.id,topic:e,result:!0,throwOnFailedPublish:!0})}catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}}),dW(this,"onSessionSettleResponse",async(e,t)=>{let{id:r}=t;cI(t)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(sw("session_approve",r),{})):cS(t)&&(await this.client.session.delete(e,oQ("USER_DISCONNECTED")),this.events.emit(sw("session_approve",r),{error:t.error}))}),dW(this,"onSessionUpdateRequest",async(e,t)=>{let{params:r,id:i}=t;try{let t=`${e}_session_update`,n=ci.get(t);if(n&&this.isRequestOutOfSync(n,i)){this.client.logger.warn(`Discarding out of sync request - ${i}`),this.sendError({id:i,topic:e,error:oQ("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(dz({topic:e},r));try{ci.set(t,i),await this.client.session.update(e,{namespaces:r.namespaces}),await this.sendResult({id:i,topic:e,result:!0,throwOnFailedPublish:!0})}catch(e){throw ci.delete(t),e}this.client.events.emit("session_update",{id:i,topic:e,params:r})}catch(t){await this.sendError({id:i,topic:e,error:t}),this.client.logger.error(t)}}),dW(this,"isRequestOutOfSync",(e,t)=>t.toString().slice(0,-3){let{id:r}=t,i=sw("session_update",r);if(0===this.events.listenerCount(i))throw Error(`emitting ${i} without any listeners`);cI(t)?this.events.emit(sw("session_update",r),{}):cS(t)&&this.events.emit(sw("session_update",r),{error:t.error})}),dW(this,"onSessionExtendRequest",async(e,t)=>{let{id:r}=t;try{this.isValidExtend({topic:e}),await this.setExpiry(e,sb(dT)),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:r,topic:e})}catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}}),dW(this,"onSessionExtendResponse",(e,t)=>{let{id:r}=t,i=sw("session_extend",r);if(0===this.events.listenerCount(i))throw Error(`emitting ${i} without any listeners`);cI(t)?this.events.emit(sw("session_extend",r),{}):cS(t)&&this.events.emit(sw("session_extend",r),{error:t.error})}),dW(this,"onSessionPingRequest",async(e,t)=>{let{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:r,topic:e})}catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}}),dW(this,"onSessionPingResponse",(e,t)=>{let{id:r}=t,i=sw("session_ping",r);setTimeout(()=>{if(0===this.events.listenerCount(i))throw Error(`emitting ${i} without any listeners 2176`);cI(t)?this.events.emit(sw("session_ping",r),{}):cS(t)&&this.events.emit(sw("session_ping",r),{error:t.error})},500)}),dW(this,"onSessionDeleteRequest",async(e,t)=>{let{id:r}=t;try{this.isValidDisconnect({topic:e,reason:t.params}),Promise.all([new Promise(t=>{this.client.core.relayer.once(cF.publish,async()=>{t(await this.deleteSession({topic:e,id:r}))})}),this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:oQ("USER_DISCONNECTED")})]).catch(e=>this.client.logger.error(e))}catch(e){this.client.logger.error(e)}}),dW(this,"onSessionRequest",async e=>{var t,r,i;let{topic:n,payload:s,attestation:a,encryptedId:o,transportType:c}=e,{id:l,params:u}=s;try{await this.isValidRequest(dz({topic:n},u));let e=this.client.session.get(n),s=await this.getVerifyContext({attestationId:a,hash:oO(JSON.stringify(cf("wc_sessionRequest",u,l))),encryptedId:o,metadata:e.peer.metadata,transportType:c}),d={id:l,topic:n,params:u,verifyContext:s};await this.setPendingSessionRequest(d),c===cH.link_mode&&null!=(t=e.peer.metadata.redirect)&&t.universal&&this.client.core.addLinkModeSupportedApp(null==(r=e.peer.metadata.redirect)?void 0:r.universal),null!=(i=this.client.signConfig)&&i.disableRequestQueue?this.emitSessionRequest(d):(this.addSessionRequestToSessionRequestQueue(d),this.processSessionRequestQueue())}catch(e){await this.sendError({id:l,topic:n,error:e}),this.client.logger.error(e)}}),dW(this,"onSessionRequestResponse",(e,t)=>{let{id:r}=t,i=sw("session_request",r);if(0===this.events.listenerCount(i))throw Error(`emitting ${i} without any listeners`);cI(t)?this.events.emit(sw("session_request",r),{result:t.result}):cS(t)&&this.events.emit(sw("session_request",r),{error:t.error})}),dW(this,"onSessionEventRequest",async(e,t)=>{let{id:r,params:i}=t;try{let t=`${e}_session_event_${i.event.name}`,n=ci.get(t);if(n&&this.isRequestOutOfSync(n,r)){this.client.logger.info(`Discarding out of sync request - ${r}`);return}this.isValidEmit(dz({topic:e},i)),this.client.events.emit("session_event",{id:r,topic:e,params:i}),ci.set(t,r)}catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}}),dW(this,"onSessionAuthenticateResponse",(e,t)=>{let{id:r}=t;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:t}),cI(t)?this.events.emit(sw("session_request",r),{result:t.result}):cS(t)&&this.events.emit(sw("session_request",r),{error:t.error})}),dW(this,"onSessionAuthenticateRequest",async e=>{var t;let{topic:r,payload:i,attestation:n,encryptedId:s,transportType:a}=e;try{let{requester:e,authPayload:o,expiryTimestamp:c}=i.params,l=await this.getVerifyContext({attestationId:n,hash:oO(JSON.stringify(i)),encryptedId:s,metadata:e.metadata,transportType:a}),u={requester:e,pairingTopic:r,id:i.id,authPayload:o,verifyContext:l,expiryTimestamp:c};await this.setAuthRequest(i.id,{request:u,pairingTopic:r,transportType:a}),a===cH.link_mode&&null!=(t=e.metadata.redirect)&&t.universal&&this.client.core.addLinkModeSupportedApp(e.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:r,params:i.params,id:i.id,verifyContext:l})}catch(s){this.client.logger.error(s);let e=i.params.requester.publicKey,t=await this.client.core.crypto.generateKeyPair(),n=this.getAppLinkIfEnabled(i.params.requester.metadata,a);await this.sendError({id:i.id,topic:r,error:s,encodeOpts:{type:1,receiverPublicKey:e,senderPublicKey:t},rpcOpts:dP.wc_sessionAuthenticate.autoReject,appLink:n})}}),dW(this,"addSessionRequestToSessionRequestQueue",e=>{this.sessionRequestQueue.queue.push(e)}),dW(this,"cleanupAfterResponse",e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=dO.idle,this.processSessionRequestQueue()},(0,v.toMiliseconds)(this.requestQueueDelay))}),dW(this,"cleanupPendingSentRequestsForTopic",({topic:e,error:t})=>{let r=this.client.core.history.pending;r.length>0&&r.filter(t=>t.topic===e&&"wc_sessionRequest"===t.request.method).forEach(e=>{let r=sw("session_request",e.request.id);if(0===this.events.listenerCount(r))throw Error(`emitting ${r} without any listeners`);this.events.emit(sw("session_request",e.request.id),{error:t})})}),dW(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===dO.active){this.client.logger.info("session request queue is already active.");return}let e=this.sessionRequestQueue.queue[0];if(!e){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=dO.active,this.emitSessionRequest(e)}catch(e){this.client.logger.error(e)}}),dW(this,"emitSessionRequest",e=>{this.client.events.emit("session_request",e)}),dW(this,"onPairingCreated",e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;let t=this.client.proposal.getAll().find(t=>t.pairingTopic===e.topic);t&&this.onSessionProposeRequest({topic:e.topic,payload:cf("wc_sessionPropose",dH(dz({},t),{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces,relays:t.relays,proposer:t.proposer,sessionProperties:t.sessionProperties,scopedProperties:t.scopedProperties}),t.id)})}),dW(this,"isValidConnect",async e=>{let t;if(!o6(e)){let{message:t}=oK("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw Error(t)}let{pairingTopic:r,requiredNamespaces:i,optionalNamespaces:n,sessionProperties:s,scopedProperties:a,relays:o}=e;if(oJ(r)||await this.isValidPairingTopic(r),t=!1,o?o&&oY(o)&&o.length&&o.forEach(e=>{t=o5(e)}):t=!0,!t){let{message:e}=oK("MISSING_OR_INVALID",`connect() relays: ${o}`);throw Error(e)}if(oJ(i)||0===oZ(i)||this.validateNamespaces(i,"requiredNamespaces"),oJ(n)||0===oZ(n)||this.validateNamespaces(n,"optionalNamespaces"),oJ(s)||this.validateSessionProps(s,"sessionProperties"),!oJ(a)){this.validateSessionProps(a,"scopedProperties");let e=Object.keys(i||{}).concat(Object.keys(n||{}));if(!Object.keys(a).every(t=>e.includes(t)))throw Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(a)}, required/optional namespaces: ${JSON.stringify(e)}`)}}),dW(this,"validateNamespaces",(e,t)=>{let r=function(e,t,r){let i=null;if(e&&oZ(e)){let n;let s=o3(e,t);s&&(i=s);let a=(n=null,Object.entries(e).forEach(([e,i])=>{var s,a;let o;if(n)return;let c=(s=st(e,i),a=`${t} ${r}`,o=null,oY(s)&&s.length?s.forEach(e=>{o||o1(e)||(o=oQ("UNSUPPORTED_CHAINS",`${a}, chain ${e} should be a string and conform to "namespace:chainId" format`))}):o1(e)||(o=oQ("UNSUPPORTED_CHAINS",`${a}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),o);c&&(n=c)}),n);a&&(i=a)}else i=oK("MISSING_OR_INVALID",`${t}, ${r} should be an object with data`);return i}(e,"connect()",t);if(r)throw Error(r.message)}),dW(this,"isValidApprove",async e=>{if(!o6(e))throw Error(oK("MISSING_OR_INVALID",`approve() params: ${e}`).message);let{id:t,namespaces:r,relayProtocol:i,sessionProperties:n,scopedProperties:s}=e;this.checkRecentlyDeleted(t),await this.isValidProposalId(t);let a=this.client.proposal.get(t),o=o8(r,"approve()");if(o)throw Error(o.message);let c=o9(a.requiredNamespaces,r,"approve()");if(c)throw Error(c.message);if(!oX(i,!0)){let{message:e}=oK("MISSING_OR_INVALID",`approve() relayProtocol: ${i}`);throw Error(e)}if(oJ(n)||this.validateSessionProps(n,"sessionProperties"),!oJ(s)){this.validateSessionProps(s,"scopedProperties");let e=new Set(Object.keys(r));if(!Object.keys(s).every(t=>e.has(t)))throw Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(s)}, approved namespaces: ${Array.from(e).join(", ")}`)}}),dW(this,"isValidReject",async e=>{if(!o6(e)){let{message:t}=oK("MISSING_OR_INVALID",`reject() params: ${e}`);throw Error(t)}let{id:t,reason:r}=e;if(this.checkRecentlyDeleted(t),await this.isValidProposalId(t),!r||"object"!=typeof r||!r.code||!o0(r.code,!1)||!r.message||!oX(r.message,!1)){let{message:e}=oK("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(r)}`);throw Error(e)}}),dW(this,"isValidSessionSettleRequest",e=>{let t;if(!o6(e)){let{message:t}=oK("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw Error(t)}let{relay:r,controller:i,namespaces:n,expiry:s}=e;if(!o5(r)){let{message:e}=oK("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw Error(e)}let a=(t=null,oX(i?.publicKey,!1)||(t=oK("MISSING_OR_INVALID","onSessionSettleRequest() controller public key should be a string")),t);if(a)throw Error(a.message);let o=o8(n,"onSessionSettleRequest()");if(o)throw Error(o.message);if(sy(s)){let{message:e}=oK("EXPIRED","onSessionSettleRequest()");throw Error(e)}}),dW(this,"isValidUpdate",async e=>{if(!o6(e)){let{message:t}=oK("MISSING_OR_INVALID",`update() params: ${e}`);throw Error(t)}let{topic:t,namespaces:r}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);let i=this.client.session.get(t),n=o8(r,"update()");if(n)throw Error(n.message);let s=o9(i.requiredNamespaces,r,"update()");if(s)throw Error(s.message)}),dW(this,"isValidExtend",async e=>{if(!o6(e)){let{message:t}=oK("MISSING_OR_INVALID",`extend() params: ${e}`);throw Error(t)}let{topic:t}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t)}),dW(this,"isValidRequest",async e=>{var t;if(!o6(e)){let{message:t}=oK("MISSING_OR_INVALID",`request() params: ${e}`);throw Error(t)}let{topic:r,request:i,chainId:n,expiry:s}=e;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);let{namespaces:a}=this.client.session.get(r);if(!o4(a,n)){let{message:e}=oK("MISSING_OR_INVALID",`request() chainId: ${n}`);throw Error(e)}if(oJ(i)||!oX(i.method,!1)){let{message:e}=oK("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw Error(e)}if(!(oX(t=i.method,!1)&&(function(e,t){let r=[];return Object.values(e).forEach(e=>{oq(e.accounts).includes(t)&&r.push(...e.methods)}),r})(a,n).includes(t))){let{message:e}=oK("MISSING_OR_INVALID",`request() method: ${i.method}`);throw Error(e)}if(s&&(!o0(s,!1)||!(s<=dx.max)||!(s>=dx.min))){let{message:e}=oK("MISSING_OR_INVALID",`request() expiry: ${s}. Expiry must be a number (in seconds) between ${dx.min} and ${dx.max}`);throw Error(e)}}),dW(this,"isValidRespond",async e=>{var t;if(!o6(e)){let{message:t}=oK("MISSING_OR_INVALID",`respond() params: ${e}`);throw Error(t)}let{topic:r,response:i}=e;try{await this.isValidSessionTopic(r)}catch(r){throw null!=(t=e?.response)&&t.id&&this.cleanupAfterResponse(e),r}if(oJ(i)||oJ(i.result)&&oJ(i.error)||!o0(i.id,!1)||!oX(i.jsonrpc,!1)){let{message:e}=oK("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw Error(e)}}),dW(this,"isValidPing",async e=>{if(!o6(e)){let{message:t}=oK("MISSING_OR_INVALID",`ping() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidSessionOrPairingTopic(t)}),dW(this,"isValidEmit",async e=>{var t;if(!o6(e)){let{message:t}=oK("MISSING_OR_INVALID",`emit() params: ${e}`);throw Error(t)}let{topic:r,event:i,chainId:n}=e;await this.isValidSessionTopic(r);let{namespaces:s}=this.client.session.get(r);if(!o4(s,n)){let{message:e}=oK("MISSING_OR_INVALID",`emit() chainId: ${n}`);throw Error(e)}if(oJ(i)||!oX(i.name,!1)){let{message:e}=oK("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw Error(e)}if(!(oX(t=i.name,!1)&&(function(e,t){let r=[];return Object.values(e).forEach(e=>{oq(e.accounts).includes(t)&&r.push(...e.events)}),r})(s,n).includes(t))){let{message:e}=oK("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw Error(e)}}),dW(this,"isValidDisconnect",async e=>{if(!o6(e)){let{message:t}=oK("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidSessionOrPairingTopic(t)}),dW(this,"isValidAuthenticate",e=>{let{chains:t,uri:r,domain:i,nonce:n}=e;if(!Array.isArray(t)||0===t.length)throw Error("chains is required and must be a non-empty array");if(!oX(r,!1))throw Error("uri is required parameter");if(!oX(i,!1))throw Error("domain is required parameter");if(!oX(n,!1))throw Error("nonce is required parameter");if([...new Set(t.map(e=>se(e).namespace))].length>1)throw Error("Multi-namespace requests are not supported. Please request single namespace only.");let{namespace:s}=se(t[0]);if("eip155"!==s)throw Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),dW(this,"getVerifyContext",async e=>{let{attestationId:t,hash:r,encryptedId:i,metadata:n,transportType:s}=e,a={verified:{verifyUrl:n.verifyUrl||cJ,validation:"UNKNOWN",origin:n.url||""}};try{if(s===cH.link_mode){let e=this.getAppLinkIfEnabled(n,s);return a.verified.validation=e&&new URL(e).origin===new URL(n.url).origin?"VALID":"INVALID",a}let e=await this.client.core.verify.resolve({attestationId:t,hash:r,encryptedId:i,verifyUrl:n.verifyUrl});e&&(a.verified.origin=e.origin,a.verified.isScam=e.isScam,a.verified.validation=e.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(e){this.client.logger.warn(e)}return this.client.logger.debug(`Verify context: ${JSON.stringify(a)}`),a}),dW(this,"validateSessionProps",(e,t)=>{Object.values(e).forEach((r,i)=>{if(null==r){let{message:n}=oK("MISSING_OR_INVALID",`${t} must contain an existing value for each key. Received: ${r} for key ${Object.keys(e)[i]}`);throw Error(n)}})}),dW(this,"getPendingAuthRequest",e=>{let t=this.client.auth.requests.get(e);return"object"==typeof t?t:void 0}),dW(this,"addToRecentlyDeleted",(e,t)=>{if(this.recentlyDeletedMap.set(e,t),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let e=0,t=this.recentlyDeletedLimit/2;for(let r of this.recentlyDeletedMap.keys()){if(e++>=t)break;this.recentlyDeletedMap.delete(r)}}}),dW(this,"checkRecentlyDeleted",e=>{let t=this.recentlyDeletedMap.get(e);if(t){let{message:r}=oK("MISSING_OR_INVALID",`Record was recently deleted - ${t}: ${e}`);throw Error(r)}}),dW(this,"isLinkModeEnabled",(e,t)=>{var i,n,s,a,o,c,l,u,d;return!!e&&t===cH.link_mode&&(null==(n=null==(i=this.client.metadata)?void 0:i.redirect)?void 0:n.linkMode)===!0&&(null==(a=null==(s=this.client.metadata)?void 0:s.redirect)?void 0:a.universal)!==void 0&&(null==(c=null==(o=this.client.metadata)?void 0:o.redirect)?void 0:c.universal)!==""&&(null==(l=e?.redirect)?void 0:l.universal)!==void 0&&(null==(u=e?.redirect)?void 0:u.universal)!==""&&(null==(d=e?.redirect)?void 0:d.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&"u">typeof(null==r.g?void 0:r.g.Linking)}),dW(this,"getAppLinkIfEnabled",(e,t)=>{var r;return this.isLinkModeEnabled(e,t)?null==(r=e?.redirect)?void 0:r.universal:void 0}),dW(this,"handleLinkModeMessage",({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;let t=sC(e,"topic")||"",r=decodeURIComponent(sC(e,"wc_ev")||""),i=this.client.session.keys.includes(t);i&&this.client.session.update(t,{transportType:cH.link_mode}),this.client.core.dispatchEnvelope({topic:t,message:r,sessionExists:i})}),dW(this,"registerLinkModeListeners",async()=>{var e;if(sI()||sn()&&null!=(e=this.client.metadata.redirect)&&e.linkMode){let e=null==r.g?void 0:r.g.Linking;if("u">typeof e){e.addEventListener("url",this.handleLinkModeMessage,this.client.name);let t=await e.getInitialURL();t&&setTimeout(()=>{this.handleLinkModeMessage({url:t})},50)}}}),dW(this,"shouldSetTVF",(e,t)=>{if(!t||"wc_sessionRequest"!==e)return!1;let{request:r}=t;return Object.keys(dR).includes(r.method)}),dW(this,"getTVFParams",(e,t,r)=>{var i,n;try{let s=t.request.method,a=this.extractTxHashesFromResult(s,r);return dH(dz({correlationId:e,rpcMethods:[s],chainId:t.chainId},this.isValidContractData(t.request.params)&&{contractAddresses:[null==(n=null==(i=t.request.params)?void 0:i[0])?void 0:n.to]}),{txHashes:a})}catch(e){this.client.logger.warn("Error getting TVF params",e)}return{}}),dW(this,"isValidContractData",e=>{var t;if(!e)return!1;try{let r=e?.data||(null==(t=e?.[0])?void 0:t.data);if(!r.startsWith("0x"))return!1;let i=r.slice(2);return!!/^[0-9a-fA-F]*$/.test(i)&&i.length%2==0}catch{}return!1}),dW(this,"extractTxHashesFromResult",(e,t)=>{try{let r=dR[e];if("string"==typeof t)return[t];let i=t[r.key];if(oY(i))return"solana_signAllTransactions"===e?i.map(e=>(function(e){let t=atob(e),r=new Uint8Array(t.length);for(let e=0;e{this.onProviderMessageEvent(e)})}async onRelayMessage(e){let{topic:t,message:r,attestation:i,transportType:n}=e,{publicKey:s}=this.client.auth.authKeys.keys.includes(dM)?this.client.auth.authKeys.get(dM):{responseTopic:void 0,publicKey:void 0};try{let e=await this.client.core.crypto.decode(t,r,{receiverPublicKey:s,encoding:n===cH.link_mode?oN:oS});cC(e)?(this.client.core.history.set(t,e),await this.onRelayEventRequest({topic:t,payload:e,attestation:i,transportType:n,encryptedId:oO(r)})):c_(e)?(await this.client.core.history.resolve(e),await this.onRelayEventResponse({topic:t,payload:e,transportType:n}),this.client.core.history.delete(t,e.id)):await this.onRelayEventUnknownPayload({topic:t,payload:e,transportType:n}),await this.client.core.relayer.messages.ack(t,r)}catch(e){this.client.logger.error(e)}}registerExpirerEvents(){this.client.core.expirer.on(cZ.expired,async e=>{let{topic:t,id:r}=sm(e.target);return r&&this.client.pendingRequest.keys.includes(r)?await this.deletePendingSessionRequest(r,oK("EXPIRED"),!0):r&&this.client.auth.requests.keys.includes(r)?await this.deletePendingAuthRequest(r,oK("EXPIRED"),!0):void(t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r})))})}registerPairingEvents(){this.client.core.pairing.events.on(cQ.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(cQ.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!oX(e,!1)){let{message:t}=oK("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:t}=oK("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw Error(t)}if(sy(this.client.core.pairing.pairings.get(e).expiry)){let{message:t}=oK("EXPIRED",`pairing topic: ${e}`);throw Error(t)}}async isValidSessionTopic(e){if(!oX(e,!1)){let{message:t}=oK("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){let{message:t}=oK("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw Error(t)}if(sy(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});let{message:t}=oK("EXPIRED",`session topic: ${e}`);throw Error(t)}if(!this.client.core.crypto.keychain.has(e)){let{message:t}=oK("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(oX(e,!1)){let{message:t}=oK("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw Error(t)}else{let{message:t}=oK("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw Error(t)}}async isValidProposalId(e){if("number"!=typeof e){let{message:t}=oK("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw Error(t)}if(!this.client.proposal.keys.includes(e)){let{message:t}=oK("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw Error(t)}if(sy(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);let{message:t}=oK("EXPIRED",`proposal id: ${e}`);throw Error(t)}}}class dG extends uQ{constructor(e,t){super(e,t,"proposal",d_),this.core=e,this.logger=t}}class dK extends uQ{constructor(e,t){super(e,t,"session",d_),this.core=e,this.logger=t}}class dQ extends uQ{constructor(e,t){super(e,t,"request",d_,e=>e.id),this.core=e,this.logger=t}}class dY extends uQ{constructor(e,t){super(e,t,"authKeys",dD,()=>dM),this.core=e,this.logger=t}}class dZ extends uQ{constructor(e,t){super(e,t,"pairingTopics",dD),this.core=e,this.logger=t}}class dJ extends uQ{constructor(e,t){super(e,t,"requests",dD,e=>e.id),this.core=e,this.logger=t}}var dX=Object.defineProperty,d0=(e,t,r)=>t in e?dX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,d1=(e,t,r)=>d0(e,"symbol"!=typeof t?t+"":t,r);class d2{constructor(e,t){this.core=e,this.logger=t,d1(this,"authKeys"),d1(this,"pairingTopics"),d1(this,"requests"),this.authKeys=new dY(this.core,this.logger),this.pairingTopics=new dZ(this.core,this.logger),this.requests=new dJ(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var d3=Object.defineProperty,d8=(e,t,r)=>t in e?d3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,d5=(e,t,r)=>d8(e,"symbol"!=typeof t?t+"":t,r);class d6 extends eA{constructor(e){super(e),d5(this,"protocol","wc"),d5(this,"version",2),d5(this,"name",dI.name),d5(this,"metadata"),d5(this,"core"),d5(this,"logger"),d5(this,"events",new y.EventEmitter),d5(this,"engine"),d5(this,"session"),d5(this,"proposal"),d5(this,"pendingRequest"),d5(this,"auth"),d5(this,"signConfig"),d5(this,"on",(e,t)=>this.events.on(e,t)),d5(this,"once",(e,t)=>this.events.once(e,t)),d5(this,"off",(e,t)=>this.events.off(e,t)),d5(this,"removeListener",(e,t)=>this.events.removeListener(e,t)),d5(this,"removeAllListeners",e=>this.events.removeAllListeners(e)),d5(this,"connect",async e=>{try{return await this.engine.connect(e)}catch(e){throw this.logger.error(e.message),e}}),d5(this,"pair",async e=>{try{return await this.engine.pair(e)}catch(e){throw this.logger.error(e.message),e}}),d5(this,"approve",async e=>{try{return await this.engine.approve(e)}catch(e){throw this.logger.error(e.message),e}}),d5(this,"reject",async e=>{try{return await this.engine.reject(e)}catch(e){throw this.logger.error(e.message),e}}),d5(this,"update",async e=>{try{return await this.engine.update(e)}catch(e){throw this.logger.error(e.message),e}}),d5(this,"extend",async e=>{try{return await this.engine.extend(e)}catch(e){throw this.logger.error(e.message),e}}),d5(this,"request",async e=>{try{return await this.engine.request(e)}catch(e){throw this.logger.error(e.message),e}}),d5(this,"respond",async e=>{try{return await this.engine.respond(e)}catch(e){throw this.logger.error(e.message),e}}),d5(this,"ping",async e=>{try{return await this.engine.ping(e)}catch(e){throw this.logger.error(e.message),e}}),d5(this,"emit",async e=>{try{return await this.engine.emit(e)}catch(e){throw this.logger.error(e.message),e}}),d5(this,"disconnect",async e=>{try{return await this.engine.disconnect(e)}catch(e){throw this.logger.error(e.message),e}}),d5(this,"find",e=>{try{return this.engine.find(e)}catch(e){throw this.logger.error(e.message),e}}),d5(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(e){throw this.logger.error(e.message),e}}),d5(this,"authenticate",async(e,t)=>{try{return await this.engine.authenticate(e,t)}catch(e){throw this.logger.error(e.message),e}}),d5(this,"formatAuthMessage",e=>{try{return this.engine.formatAuthMessage(e)}catch(e){throw this.logger.error(e.message),e}}),d5(this,"approveSessionAuthenticate",async e=>{try{return await this.engine.approveSessionAuthenticate(e)}catch(e){throw this.logger.error(e.message),e}}),d5(this,"rejectSessionAuthenticate",async e=>{try{return await this.engine.rejectSessionAuthenticate(e)}catch(e){throw this.logger.error(e.message),e}}),this.name=e?.name||dI.name,this.metadata=e?.metadata||sc(),this.signConfig=e?.signConfig;let t="u">typeof e?.logger&&"string"!=typeof e?.logger?e.logger:(0,ee.gw)((0,ee.jI)({level:e?.logger||dI.logger}));this.core=e?.core||new dE(e),this.logger=(0,ee.Ep)(t,this.name),this.session=new dK(this.core,this.logger),this.proposal=new dG(this.core,this.logger),this.pendingRequest=new dQ(this.core,this.logger),this.engine=new dV(this),this.auth=new d2(this.core,this.logger)}static async init(e){let t=new d6(e);return await t.initialize(),t}get context(){return(0,ee.Fd)(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),setTimeout(()=>{this.engine.processRelayMessageCache()},(0,v.toMiliseconds)(v.ONE_SECOND))}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var d4=r(80699),d9=r.n(d4),d7=Object.defineProperty,he=Object.defineProperties,ht=Object.getOwnPropertyDescriptors,hr=Object.getOwnPropertySymbols,hi=Object.prototype.hasOwnProperty,hn=Object.prototype.propertyIsEnumerable,hs=(e,t,r)=>t in e?d7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ha=(e,t)=>{for(var r in t||(t={}))hi.call(t,r)&&hs(e,r,t[r]);if(hr)for(var r of hr(t))hn.call(t,r)&&hs(e,r,t[r]);return e},ho=(e,t)=>he(e,ht(t));let hc={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"};class hl{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new y.EventEmitter,this.isAvailable=!1,this.registering=!1,!cv(e))throw Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{let t=(0,H.u)(e),r=await (await d9()(this.url,ho(ha({},hc),{body:t}))).json();this.onPayload({data:r})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!cv(e))throw Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){let e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise((e,t)=>{this.events.once("register_error",e=>{this.resetMaxListeners(),t(e)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return t(Error("HTTP connection is missing or invalid"));e()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){let t=(0,H.u)({id:1,jsonrpc:"2.0",method:"test",params:[]});await d9()(e,ho(ha({},hc),{body:t}))}this.onOpen()}catch(t){let e=this.parseError(t);throw this.events.emit("register_error",e),this.onClose(),e}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;let t="string"==typeof e.data?(0,H.D)(e.data):e.data;this.events.emit("payload",t)}onError(e,t){let r=this.parseError(t),i=cg(e,r.message||r.toString());this.events.emit("payload",i)}parseError(e,t=this.url){return cl(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}}var hu=r(48764).Buffer;let hd="error",hh="wc@2:universal_provider:",hf="https://rpc.walletconnect.org/v1/",hp="generic",hg=`${hf}bundler`,hm="default_chain_changed";function hb(){}function hy(e){return null==e||"object"!=typeof e&&"function"!=typeof e}function hw(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function hv(e){return"object"==typeof e&&null!==e}function hA(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function hE(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}let hC="[object String]",h_="[object Number]",hI="[object Boolean]",hS="[object Arguments]";function hN(e,t,r,i=new Map,n){let s=n?.(e,t,r,i);if(null!=s)return s;if(hy(e))return e;if(i.has(e))return i.get(e);if(Array.isArray(e)){let t=Array(e.length);i.set(e,t);for(let s=0;stypeof hu&&hu.isBuffer(e))return e.subarray();if(hw(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);i.set(e,t);for(let s=0;stypeof SharedArrayBuffer&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let t=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return i.set(e,t),hT(t,e,r,i,n),t}if("u">typeof File&&e instanceof File){let t=new File([e],e.name,{type:e.type});return i.set(e,t),hT(t,e,r,i,n),t}if(e instanceof Blob){let t=new Blob([e],{type:e.type});return i.set(e,t),hT(t,e,r,i,n),t}if(e instanceof Error){let t=new e.constructor;return i.set(e,t),t.message=e.message,t.name=e.name,t.stack=e.stack,t.cause=e.cause,hT(t,e,r,i,n),t}if("object"==typeof e&&function(e){switch(hE(e)){case hS:case"[object Array]":case"[object ArrayBuffer]":case"[object DataView]":case hI:case"[object Date]":case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Map]":case h_:case"[object Object]":case"[object RegExp]":case"[object Set]":case hC:case"[object Symbol]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return!0;default:return!1}}(e)){let t=Object.create(Object.getPrototypeOf(e));return i.set(e,t),hT(t,e,r,i,n),t}return e}function hT(e,t,r=e,i,n){let s=[...Object.keys(t),...hA(t)];for(let a=0;a{let s=void 0;if(null!=s)return s;if("object"==typeof e)switch(Object.prototype.toString.call(e)){case h_:case hC:case hI:{let t=new e.constructor(e?.valueOf());return hT(t,e),t}case hS:{let t={};return hT(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}},hN(e,void 0,e,new Map,t)}function hx(e){return null!==e&&"object"==typeof e&&"[object Arguments]"===hE(e)}var hO=Object.defineProperty,hR=Object.defineProperties,hk=Object.getOwnPropertyDescriptors,hD=Object.getOwnPropertySymbols,hM=Object.prototype.hasOwnProperty,hU=Object.prototype.propertyIsEnumerable,hL=(e,t,r)=>t in e?hO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,hB=(e,t)=>{for(var r in t||(t={}))hM.call(t,r)&&hL(e,r,t[r]);if(hD)for(var r of hD(t))hU.call(t,r)&&hL(e,r,t[r]);return e},hj=(e,t)=>hR(e,hk(t));function h$(e,t,r){var i;let n=se(e);return(null==(i=t.rpcMap)?void 0:i[n.reference])||`${hf}?chainId=${n.namespace}:${n.reference}&projectId=${r}`}function hF(e){return e.includes(":")?e.split(":")[1]:e}function hq(e){return e.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function hz(e={},t={}){return function(e,...t){return function(e,...t){let r=t.slice(0,-1),i=t[t.length-1],n=e;for(let e=0;etypeof SharedArrayBuffer&&e instanceof SharedArrayBuffer)return e.slice(0);let t=Object.getPrototypeOf(e),r=t.constructor;if(e instanceof Date||e instanceof Map||e instanceof Set)return new r(e);if(e instanceof RegExp){let t=new r(e);return t.lastIndex=e.lastIndex,t}if(e instanceof DataView)return new r(e.buffer.slice(0));if(e instanceof Error){let t=new r(e.message);return t.stack=e.stack,t.name=e.name,t.cause=e.cause,t}return"u">typeof File&&e instanceof File?new r([e],e.name,{type:e.type,lastModified:e.lastModified}):"object"==typeof e?Object.assign(Object.create(t),e):e}(n.get(r));if(n.set(r,t),Array.isArray(r)){r=r.slice();for(let e=0;etypeof hu&&hu.isBuffer(c)&&(c=hP(c)),Array.isArray(c)){if("object"==typeof l&&null!=l){let e=[],t=Reflect.ownKeys(l);for(let r=0;rhK[e],hY=(e,t)=>{hK[e]=t};var hZ=Object.defineProperty,hJ=(e,t,r)=>t in e?hZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,hX=(e,t,r)=>hJ(e,"symbol"!=typeof t?t+"":t,r);class h0{constructor(e){hX(this,"name","polkadot"),hX(this,"client"),hX(this,"httpProviders"),hX(this,"events"),hX(this,"namespace"),hX(this,"chainId"),this.namespace=e.namespace,this.events=hQ("events"),this.client=hQ("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(hm,`${this.name}:${e}`)}getAccounts(){let e=this.namespace.accounts;return e&&e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=hF(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||h$(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new cN(new hl(r,hQ("disableProviderPing")))}}var h1=Object.defineProperty,h2=Object.defineProperties,h3=Object.getOwnPropertyDescriptors,h8=Object.getOwnPropertySymbols,h5=Object.prototype.hasOwnProperty,h6=Object.prototype.propertyIsEnumerable,h4=(e,t,r)=>t in e?h1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,h9=(e,t)=>{for(var r in t||(t={}))h5.call(t,r)&&h4(e,r,t[r]);if(h8)for(var r of h8(t))h6.call(t,r)&&h4(e,r,t[r]);return e},h7=(e,t)=>h2(e,h3(t)),fe=(e,t,r)=>h4(e,"symbol"!=typeof t?t+"":t,r);class ft{constructor(e){fe(this,"name","eip155"),fe(this,"client"),fe(this,"chainId"),fe(this,"namespace"),fe(this,"httpProviders"),fe(this,"events"),this.namespace=e.namespace,this.events=hQ("events"),this.client=hQ("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(hm,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){let r=t||h$(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new cN(new hl(r,hQ("disableProviderPing")))}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=parseInt(hF(t));e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}getHttpProvider(){let e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,r;let i=e.request.params?null==(t=e.request.params[0])?void 0:t.chainId:"0x0",n=parseInt(i=i.startsWith("0x")?i:`0x${i}`,16);if(this.isChainApproved(n))this.setDefaultChain(`${n}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:null==(r=this.namespace.chains)?void 0:r[0]}),this.setDefaultChain(`${n}`);else throw Error(`Failed to switch to chain 'eip155:${n}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,r,i;let n=null==(r=null==(t=e.request)?void 0:t.params)?void 0:r[0];if(!n)throw Error("Missing address parameter in `wallet_getCapabilities` request");let s=this.client.session.get(e.topic),a=(null==(i=s?.sessionProperties)?void 0:i.capabilities)||{};if(null!=a&&a[n])return a?.[n];let o=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:h7(h9({},s.sessionProperties||{}),{capabilities:h7(h9({},a||{}),{[n]:o})})})}catch(e){console.warn("Failed to update session with capabilities",e)}return o}async getCallStatus(e){var t,r;let i=this.client.session.get(e.topic),n=null==(t=i.sessionProperties)?void 0:t.bundler_name;if(n){let t=this.getBundlerUrl(e.chainId,n);try{return await this.getUserOperationReceipt(t,e)}catch(e){console.warn("Failed to fetch call status from bundler",e,t)}}let s=null==(r=i.sessionProperties)?void 0:r.bundler_url;if(s)try{return await this.getUserOperationReceipt(s,e)}catch(e){console.warn("Failed to fetch call status from custom bundler",e,s)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var r;let i=new URL(e),n=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(cf("eth_getUserOperationReceipt",[null==(r=t.request.params)?void 0:r[0]]))});if(!n.ok)throw Error(`Failed to fetch user operation receipt - ${n.status}`);return await n.json()}getBundlerUrl(e,t){return`${hg}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}var fr=Object.defineProperty,fi=(e,t,r)=>t in e?fr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fn=(e,t,r)=>fi(e,"symbol"!=typeof t?t+"":t,r);class fs{constructor(e){fn(this,"name","solana"),fn(this,"client"),fn(this,"httpProviders"),fn(this,"events"),fn(this,"namespace"),fn(this,"chainId"),this.namespace=e.namespace,this.events=hQ("events"),this.client=hQ("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(hm,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=hF(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||h$(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new cN(new hl(r,hQ("disableProviderPing")))}}var fa=Object.defineProperty,fo=(e,t,r)=>t in e?fa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fc=(e,t,r)=>fo(e,"symbol"!=typeof t?t+"":t,r);class fl{constructor(e){fc(this,"name","cosmos"),fc(this,"client"),fc(this,"httpProviders"),fc(this,"events"),fc(this,"namespace"),fc(this,"chainId"),this.namespace=e.namespace,this.events=hQ("events"),this.client=hQ("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(hm,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=hF(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||h$(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new cN(new hl(r,hQ("disableProviderPing")))}}var fu=Object.defineProperty,fd=(e,t,r)=>t in e?fu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fh=(e,t,r)=>fd(e,"symbol"!=typeof t?t+"":t,r);class ff{constructor(e){fh(this,"name","algorand"),fh(this,"client"),fh(this,"httpProviders"),fh(this,"events"),fh(this,"namespace"),fh(this,"chainId"),this.namespace=e.namespace,this.events=hQ("events"),this.client=hQ("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){let r=t||h$(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.chainId=e,this.events.emit(hm,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;e[t]=this.createHttpProvider(t,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||h$(e,this.namespace,this.client.core.projectId);return typeof r>"u"?void 0:new cN(new hl(r,hQ("disableProviderPing")))}}var fp=Object.defineProperty,fg=(e,t,r)=>t in e?fp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fm=(e,t,r)=>fg(e,"symbol"!=typeof t?t+"":t,r);class fb{constructor(e){fm(this,"name","cip34"),fm(this,"client"),fm(this,"httpProviders"),fm(this,"events"),fm(this,"namespace"),fm(this,"chainId"),this.namespace=e.namespace,this.events=hQ("events"),this.client=hQ("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(hm,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{let r=this.getCardanoRPCUrl(t),i=hF(t);e[i]=this.createHttpProvider(i,r)}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){let t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||this.getCardanoRPCUrl(e);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new cN(new hl(r,hQ("disableProviderPing")))}}var fy=Object.defineProperty,fw=(e,t,r)=>t in e?fy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fv=(e,t,r)=>fw(e,"symbol"!=typeof t?t+"":t,r);class fA{constructor(e){fv(this,"name","elrond"),fv(this,"client"),fv(this,"httpProviders"),fv(this,"events"),fv(this,"namespace"),fv(this,"chainId"),this.namespace=e.namespace,this.events=hQ("events"),this.client=hQ("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(hm,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=hF(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||h$(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new cN(new hl(r,hQ("disableProviderPing")))}}var fE=Object.defineProperty,fC=(e,t,r)=>t in e?fE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,f_=(e,t,r)=>fC(e,"symbol"!=typeof t?t+"":t,r);class fI{constructor(e){f_(this,"name","multiversx"),f_(this,"client"),f_(this,"httpProviders"),f_(this,"events"),f_(this,"namespace"),f_(this,"chainId"),this.namespace=e.namespace,this.events=hQ("events"),this.client=hQ("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(hm,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=hF(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||h$(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new cN(new hl(r,hQ("disableProviderPing")))}}var fS=Object.defineProperty,fN=(e,t,r)=>t in e?fS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fT=(e,t,r)=>fN(e,"symbol"!=typeof t?t+"":t,r);class fP{constructor(e){fT(this,"name","near"),fT(this,"client"),fT(this,"httpProviders"),fT(this,"events"),fT(this,"namespace"),fT(this,"chainId"),this.namespace=e.namespace,this.events=hQ("events"),this.client=hQ("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){let r=t||h$(`${this.name}:${e}`,this.namespace);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.events.emit(hm,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e&&e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;e[t]=this.createHttpProvider(t,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||h$(e,this.namespace);return typeof r>"u"?void 0:new cN(new hl(r,hQ("disableProviderPing")))}}var fx=Object.defineProperty,fO=(e,t,r)=>t in e?fx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fR=(e,t,r)=>fO(e,"symbol"!=typeof t?t+"":t,r);class fk{constructor(e){fR(this,"name","tezos"),fR(this,"client"),fR(this,"httpProviders"),fR(this,"events"),fR(this,"namespace"),fR(this,"chainId"),this.namespace=e.namespace,this.events=hQ("events"),this.client=hQ("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){let r=t||h$(`${this.name}:${e}`,this.namespace);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.events.emit(hm,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e&&e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{e[t]=this.createHttpProvider(t)}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||h$(e,this.namespace);return typeof r>"u"?void 0:new cN(new hl(r))}}var fD=Object.defineProperty,fM=(e,t,r)=>t in e?fD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fU=(e,t,r)=>fM(e,"symbol"!=typeof t?t+"":t,r);class fL{constructor(e){fU(this,"name",hp),fU(this,"client"),fU(this,"httpProviders"),fU(this,"events"),fU(this,"namespace"),fU(this,"chainId"),this.namespace=e.namespace,this.events=hQ("events"),this.client=hQ("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(hm,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){var e,t;let r={};return null==(t=null==(e=this.namespace)?void 0:e.accounts)||t.forEach(e=>{let t=se(e);r[`${t.namespace}:${t.reference}`]=this.createHttpProvider(e)}),r}getHttpProvider(e){let t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||h$(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new cN(new hl(r,hQ("disableProviderPing")))}}var fB=Object.defineProperty,fj=Object.defineProperties,f$=Object.getOwnPropertyDescriptors,fF=Object.getOwnPropertySymbols,fq=Object.prototype.hasOwnProperty,fz=Object.prototype.propertyIsEnumerable,fH=(e,t,r)=>t in e?fB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fW=(e,t)=>{for(var r in t||(t={}))fq.call(t,r)&&fH(e,r,t[r]);if(fF)for(var r of fF(t))fz.call(t,r)&&fH(e,r,t[r]);return e},fV=(e,t)=>fj(e,f$(t)),fG=(e,t,r)=>fH(e,"symbol"!=typeof t?t+"":t,r);class fK{constructor(e){fG(this,"client"),fG(this,"namespaces"),fG(this,"optionalNamespaces"),fG(this,"sessionProperties"),fG(this,"scopedProperties"),fG(this,"events",new(w())),fG(this,"rpcProviders",{}),fG(this,"session"),fG(this,"providerOpts"),fG(this,"logger"),fG(this,"uri"),fG(this,"disableProviderPing",!1),this.providerOpts=e,this.logger="u">typeof e?.logger&&"string"!=typeof e?.logger?e.logger:(0,ee.gw)((0,ee.jI)({level:e?.logger||hd})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){let t=new fK(e);return await t.initialize(),t}async request(e,t,r){let[i,n]=this.validateChain(t);if(!this.session)throw Error("Please call connect() before request()");return await this.getProvider(i).request({request:fW({},e),chainId:`${i}:${n}`,topic:this.session.topic,expiry:r})}sendAsync(e,t,r,i){let n=new Date().getTime();this.request(e,r,i).then(e=>t(null,cp(n,e))).catch(e=>t(e,void 0))}async enable(){if(!this.client)throw Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw Error("Please call connect() before enable()");await this.client.disconnect({topic:null==(e=this.session)?void 0:e.topic,reason:oQ("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();let{uri:r,response:i}=await this.client.authenticate(e,t);r&&(this.uri=r,this.events.emit("display_uri",r));let n=await i();if(this.session=n.session,this.session){let e=hV(this.session.namespaces);this.namespaces=hz(this.namespaces,e),await this.persist("namespaces",this.namespaces),this.onConnect()}return n}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){let{uri:t,approval:r}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties});t&&(this.uri=t,this.events.emit("display_uri",t));let i=await r();this.session=i;let n=hV(i.namespaces);return this.namespaces=hz(this.namespaces,n),await this.persist("namespaces",this.namespaces),await this.persist("optionalNamespaces",this.optionalNamespaces),this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;let[r,i]=this.validateChain(e),n=this.getProvider(r);n.name===hp?n.setDefaultChain(`${r}:${i}`,t):n.setDefaultChain(i,t)}catch(e){if(!/Please call connect/.test(e.message))throw e}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");let t=this.client.pairing.getAll();if(oY(t)){for(let r of t)e.deletePairings?this.client.core.expirer.set(r.topic,0):await this.client.core.relayer.subscriber.unsubscribe(r.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}async checkStorage(){this.namespaces=await this.getFromStore("namespaces")||{},this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.session&&this.createProviders()}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){var e,t;if(this.client=this.providerOpts.client||await d6.init({core:this.providerOpts.core,logger:this.providerOpts.logger||hd,relayUrl:this.providerOpts.relayUrl||"wss://relay.walletconnect.org",projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.providerOpts.session)try{this.session=this.client.session.get(this.providerOpts.session.topic)}catch(r){throw this.logger.error("Failed to get session",r),Error(`The provided session: ${null==(t=null==(e=this.providerOpts)?void 0:e.session)?void 0:t.topic} doesn't exist in the Sign client`)}else{let e=this.client.session.getAll();this.session=e[0]}this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw Error("Sign Client not initialized");if(!this.session)throw Error("Session not initialized. Please call connect() before enable()");let e=[...new Set(Object.keys(this.session.namespaces).map(e=>oH(e)))];hY("client",this.client),hY("events",this.events),hY("disableProviderPing",this.disableProviderPing),e.forEach(e=>{if(!this.session)return;let t=function(e,t){let r=Object.keys(t.namespaces).filter(t=>t.includes(e));if(!r.length)return[];let i=[];return r.forEach(e=>{let r=t.namespaces[e].accounts;i.push(...r)}),i}(e,this.session),r=hq(t),i=fV(fW({},hz(this.namespaces,this.optionalNamespaces)[e]),{accounts:t,chains:r});switch(e){case"eip155":this.rpcProviders[e]=new ft({namespace:i});break;case"algorand":this.rpcProviders[e]=new ff({namespace:i});break;case"solana":this.rpcProviders[e]=new fs({namespace:i});break;case"cosmos":this.rpcProviders[e]=new fl({namespace:i});break;case"polkadot":this.rpcProviders[e]=new h0({namespace:i});break;case"cip34":this.rpcProviders[e]=new fb({namespace:i});break;case"elrond":this.rpcProviders[e]=new fA({namespace:i});break;case"multiversx":this.rpcProviders[e]=new fI({namespace:i});break;case"near":this.rpcProviders[e]=new fP({namespace:i});break;case"tezos":this.rpcProviders[e]=new fk({namespace:i});break;default:this.rpcProviders[hp]?this.rpcProviders[hp].updateNamespace(i):this.rpcProviders[hp]=new fL({namespace:i})}})}registerEventListeners(){if(typeof this.client>"u")throw Error("Sign Client is not initialized");this.client.on("session_ping",e=>{var t;let{topic:r}=e;r===(null==(t=this.session)?void 0:t.topic)&&this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{var t;let{params:r,topic:i}=e;if(i!==(null==(t=this.session)?void 0:t.topic))return;let{event:n}=r;if("accountsChanged"===n.name){let e=n.data;e&&oY(e)&&this.events.emit("accountsChanged",e.map(hW))}else if("chainChanged"===n.name){let e=r.chainId,t=r.event.data,i=oH(e),n=hG(e)!==hG(t)?`${i}:${hG(t)}`:e;this.onChainChanged(n)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var r,i;if(e!==(null==(r=this.session)?void 0:r.topic))return;let{namespaces:n}=t,s=null==(i=this.client)?void 0:i.session.get(e);this.session=fV(fW({},s),{namespaces:n}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{var t;e.topic===(null==(t=this.session)?void 0:t.topic)&&(await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",fV(fW({},oQ("USER_DISCONNECTED")),{data:e.topic})))}),this.on(hm,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[hp]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace(null==(t=this.session)?void 0:t.namespaces[e])})}setNamespaces(e){let{namespaces:t,optionalNamespaces:r,sessionProperties:i,scopedProperties:n}=e;t&&Object.keys(t).length&&(this.namespaces=t),r&&Object.keys(r).length&&(this.optionalNamespaces=r),this.sessionProperties=i,this.scopedProperties=n}validateChain(e){let[t,r]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,r];if(t&&!Object.keys(this.namespaces||{}).map(e=>oH(e)).includes(t))throw Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&r)return[t,r];let i=oH(Object.keys(this.namespaces)[0]),n=this.rpcProviders[i].getDefaultChain();return[i,n]}async requestAccounts(){let[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}async onChainChanged(e,t=!1){if(!this.namespaces)return;let[r,i]=this.validateChain(e);i&&(t||this.getProvider(r).setDefaultChain(i),this.namespaces[r]?this.namespaces[r].defaultChain=i:this.namespaces[`${r}:${i}`]?this.namespaces[`${r}:${i}`].defaultChain=i:this.namespaces[`${r}:${i}`]={defaultChain:i},this.events.emit("chainChanged",i),await this.persist("namespaces",this.namespaces))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,await this.deleteFromStore("namespaces"),await this.deleteFromStore("optionalNamespaces"),await this.deleteFromStore("sessionProperties"),this.session=void 0,await this.cleanupPendingPairings({deletePairings:!0}),await this.cleanupStorage()}async persist(e,t){var r;let i=(null==(r=this.session)?void 0:r.topic)||"";await this.client.core.storage.setItem(`${hh}/${e}${i}`,t)}async getFromStore(e){var t;let r=(null==(t=this.session)?void 0:t.topic)||"";return await this.client.core.storage.getItem(`${hh}/${e}${r}`)}async deleteFromStore(e){var t;let r=(null==(t=this.session)?void 0:t.topic)||"";await this.client.core.storage.removeItem(`${hh}/${e}${r}`)}async cleanupStorage(){var e;try{if((null==(e=this.client)?void 0:e.session.length)>0)return;for(let e of(await this.client.core.storage.getKeys()))e.startsWith(hh)&&await this.client.core.storage.removeItem(e)}catch(e){this.logger.warn("Failed to cleanup storage",e)}}}},62873:function(e,t){"use strict";function r(e){let t;return"undefined"!=typeof window&&void 0!==window[e]&&(t=window[e]),t}function i(e){let t=r(e);if(!t)throw Error(`${e} is not defined in Window`);return t}Object.defineProperty(t,"__esModule",{value:!0}),t.getLocalStorage=t.getLocalStorageOrThrow=t.getCrypto=t.getCryptoOrThrow=t.getLocation=t.getLocationOrThrow=t.getNavigator=t.getNavigatorOrThrow=t.getDocument=t.getDocumentOrThrow=t.getFromWindowOrThrow=t.getFromWindow=void 0,t.getFromWindow=r,t.getFromWindowOrThrow=i,t.getDocumentOrThrow=function(){return i("document")},t.getDocument=function(){return r("document")},t.getNavigatorOrThrow=function(){return i("navigator")},t.getNavigator=function(){return r("navigator")},t.getLocationOrThrow=function(){return i("location")},t.getLocation=function(){return r("location")},t.getCryptoOrThrow=function(){return i("crypto")},t.getCrypto=function(){return r("crypto")},t.getLocalStorageOrThrow=function(){return i("localStorage")},t.getLocalStorage=function(){return r("localStorage")}},65755:function(e,t,r){"use strict";t.D=void 0;let i=r(62873);t.D=function(){let e,t,r;try{e=i.getDocumentOrThrow(),t=i.getLocationOrThrow()}catch(e){return null}function n(...t){let r=e.getElementsByTagName("meta");for(let e=0;ei.getAttribute(e)).filter(e=>!!e&&t.includes(e));if(n.length&&n){let e=i.getAttribute("content");if(e)return e}}return""}let s=((r=n("name","og:site_name","og:title","twitter:title"))||(r=e.title),r),a=n("description","og:description","twitter:description","keywords");return{description:a,url:t.origin,icons:function(){let r=e.getElementsByTagName("link"),i=[];for(let e=0;e-1){let e=n.getAttribute("href");if(e){if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let r=t.protocol+"//"+t.host;if(0===e.indexOf("/"))r+=e;else{let i=t.pathname.split("/");i.pop(),r+=i.join("/")+"/"+e}i.push(r)}else if(0===e.indexOf("//")){let r=t.protocol+e;i.push(r)}else i.push(e)}}}return i}(),name:s}}},79742:function(e,t){"use strict";t.byteLength=function(e){var t=c(e),r=t[0],i=t[1];return(r+i)*3/4-i},t.toByteArray=function(e){var t,r,s=c(e),a=s[0],o=s[1],l=new n((a+o)*3/4-o),u=0,d=o>0?a-4:a;for(r=0;r>16&255,l[u++]=t>>8&255,l[u++]=255&t;return 2===o&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,l[u++]=255&t),1===o&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,l[u++]=t>>8&255,l[u++]=255&t),l},t.fromByteArray=function(e){for(var t,i=e.length,n=i%3,s=[],a=0,o=i-n;a>18&63]+r[n>>12&63]+r[n>>6&63]+r[63&n]);return s.join("")}(e,a,a+16383>o?o:a+16383));return 1===n?s.push(r[(t=e[i-1])>>2]+r[t<<4&63]+"=="):2===n&&s.push(r[(t=(e[i-2]<<8)+e[i-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),s.join("")};for(var r=[],i=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=s.length;a0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var i=r===t?0:4-r%4;return[r,i]}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},29931:function(e,t,r){var i;function n(e){this.rand=e}if(e.exports=function(e){return i||(i=new n(null)),i.generate(e)},e.exports.Rand=n,n.prototype.generate=function(e){return this._rand(e)},n.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r2147483647)throw RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return u(e)}return c(e,t,r)}function c(e,t,r){if("string"==typeof e)return function(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!o.isEncoding(t))throw TypeError("Unknown encoding: "+t);let r=0|p(e,t),i=a(r),n=i.write(e,t);return n!==r&&(i=i.slice(0,n)),i}(e,t);if(ArrayBuffer.isView(e))return function(e){if(L(e,Uint8Array)){let t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return d(e)}(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(L(e,ArrayBuffer)||e&&L(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(L(e,SharedArrayBuffer)||e&&L(e.buffer,SharedArrayBuffer)))return h(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');let i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return o.from(i,t,r);let n=function(e){var t;if(o.isBuffer(e)){let t=0|f(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||(t=e.length)!=t?a(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function u(e){return l(e),a(e<0?0:0|f(e))}function d(e){let t=e.length<0?0:0|f(e.length),r=a(t);for(let i=0;i=2147483647)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||L(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return D(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return M(e).length;default:if(n)return i?-1:D(e).length;t=(""+t).toLowerCase(),n=!0}}function g(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){let i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);let n="";for(let i=t;i2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),(s=r=+r)!=s&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return -1;r=e.length-1}else if(r<0){if(!n)return -1;r=0}if("string"==typeof t&&(t=o.from(t,i)),o.isBuffer(t))return 0===t.length?-1:y(e,t,r,i,n);if("number"==typeof t)return(t&=255,"function"==typeof Uint8Array.prototype.indexOf)?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,i,n);throw TypeError("val must be string, number or Buffer")}function y(e,t,r,i,n){let s,a=1,o=e.length,c=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return -1;a=2,o/=2,c/=2,r/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(n){let i=-1;for(s=r;so&&(r=o-c),s=r;s>=0;s--){let r=!0;for(let i=0;i239?4:t>223?3:t>191?2:1;if(n+a<=r){let r,i,o,c;switch(a){case 1:t<128&&(s=t);break;case 2:(192&(r=e[n+1]))==128&&(c=(31&t)<<6|63&r)>127&&(s=c);break;case 3:r=e[n+1],i=e[n+2],(192&r)==128&&(192&i)==128&&(c=(15&t)<<12|(63&r)<<6|63&i)>2047&&(c<55296||c>57343)&&(s=c);break;case 4:r=e[n+1],i=e[n+2],o=e[n+3],(192&r)==128&&(192&i)==128&&(192&o)==128&&(c=(15&t)<<18|(63&r)<<12|(63&i)<<6|63&o)>65535&&c<1114112&&(s=c)}}null===s?(s=65533,a=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),n+=a}return function(e){let t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);let r="",i=0;for(;ir)throw RangeError("Trying to access beyond buffer length")}function A(e,t,r,i,n,s){if(!o.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw RangeError("Index out of range")}function E(e,t,r,i,n){x(t,i,n,e,r,7);let s=Number(t&BigInt(4294967295));e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,r}function C(e,t,r,i,n){x(t,i,n,e,r,7);let s=Number(t&BigInt(4294967295));e[r+7]=s,s>>=8,e[r+6]=s,s>>=8,e[r+5]=s,s>>=8,e[r+4]=s;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=a,a>>=8,e[r+2]=a,a>>=8,e[r+1]=a,a>>=8,e[r]=a,r+8}function _(e,t,r,i,n,s){if(r+i>e.length||r<0)throw RangeError("Index out of range")}function I(e,t,r,i,s){return t=+t,r>>>=0,s||_(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}function S(e,t,r,i,s){return t=+t,r>>>=0,s||_(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}t.Buffer=o,t.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=2147483647,o.TYPED_ARRAY_SUPPORT=function(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,r){return c(e,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,r){return(l(e),e<=0)?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)},o.allocUnsafe=function(e){return u(e)},o.allocUnsafeSlow=function(e){return u(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(L(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),L(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,i=t.length;for(let n=0,s=Math.min(r,i);ni.length?(o.isBuffer(t)||(t=o.from(t)),t.copy(i,n)):Uint8Array.prototype.set.call(i,t,n);else if(o.isBuffer(t))t.copy(i,n);else throw TypeError('"list" argument must be an Array of Buffers');n+=t.length}return i},o.byteLength=p,o.prototype._isBuffer=!0,o.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tr&&(e+=" ... "),""},s&&(o.prototype[s]=o.prototype.inspect),o.prototype.compare=function(e,t,r,i,n){if(L(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,i>>>=0,n>>>=0,this===e)return 0;let s=n-i,a=r-t,c=Math.min(s,a),l=this.slice(i,n),u=e.slice(t,r);for(let e=0;e>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let h=this.length-t;if((void 0===r||r>h)&&(r=h),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let f=!1;for(;;)switch(i){case"hex":return function(e,t,r,i){let n;r=Number(r)||0;let s=e.length-r;i?(i=Number(i))>s&&(i=s):i=s;let a=t.length;for(i>a/2&&(i=a/2),n=0;n>8,n.push(r%256),n.push(i);return n}(e,this.length-u),this,u,d);default:if(f)throw TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),f=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},o.prototype.slice=function(e,t){let r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||v(e,t,this.length);let i=this[e],n=1,s=0;for(;++s>>=0,t>>>=0,r||v(e,t,this.length);let i=this[e+--t],n=1;for(;t>0&&(n*=256);)i+=this[e+--t]*n;return i},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e>>>=0,t||v(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=j(function(e){O(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&R(e,this.length-8);let i=t+256*this[++e]+65536*this[++e]+16777216*this[++e],n=this[++e]+256*this[++e]+65536*this[++e]+16777216*r;return BigInt(i)+(BigInt(n)<>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&R(e,this.length-8);let i=16777216*t+65536*this[++e]+256*this[++e]+this[++e],n=16777216*this[++e]+65536*this[++e]+256*this[++e]+r;return(BigInt(i)<>>=0,t>>>=0,r||v(e,t,this.length);let i=this[e],n=1,s=0;for(;++s=(n*=128)&&(i-=Math.pow(2,8*t)),i},o.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);let i=t,n=1,s=this[e+--i];for(;i>0&&(n*=256);)s+=this[e+--i]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*t)),s},o.prototype.readInt8=function(e,t){return(e>>>=0,t||v(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||v(e,2,this.length);let r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(e,t){e>>>=0,t||v(e,2,this.length);let r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=j(function(e){O(e>>>=0,"offset");let t=this[e],r=this[e+7];return(void 0===t||void 0===r)&&R(e,this.length-8),(BigInt(this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24))<>>=0,"offset");let t=this[e],r=this[e+7];return(void 0===t||void 0===r)&&R(e,this.length-8),(BigInt((t<<24)+65536*this[++e]+256*this[++e]+this[++e])<>>=0,t||v(e,4,this.length),n.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||v(e,4,this.length),n.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||v(e,8,this.length),n.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||v(e,8,this.length),n.read(this,e,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,r,i){if(e=+e,t>>>=0,r>>>=0,!i){let i=Math.pow(2,8*r)-1;A(this,e,t,r,i,0)}let n=1,s=0;for(this[t]=255&e;++s>>=0,r>>>=0,!i){let i=Math.pow(2,8*r)-1;A(this,e,t,r,i,0)}let n=r-1,s=1;for(this[t+n]=255&e;--n>=0&&(s*=256);)this[t+n]=e/s&255;return t+r},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigUInt64LE=j(function(e,t=0){return E(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=j(function(e,t=0){return C(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t>>>=0,!i){let i=Math.pow(2,8*r-1);A(this,e,t,r,i-1,-i)}let n=0,s=1,a=0;for(this[t]=255&e;++n>0)-a&255;return t+r},o.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t>>>=0,!i){let i=Math.pow(2,8*r-1);A(this,e,t,r,i-1,-i)}let n=r-1,s=1,a=0;for(this[t+n]=255&e;--n>=0&&(s*=256);)e<0&&0===a&&0!==this[t+n+1]&&(a=1),this[t+n]=(e/s>>0)-a&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigInt64LE=j(function(e,t=0){return E(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=j(function(e,t=0){return C(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeFloatLE=function(e,t,r){return I(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return I(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return S(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return S(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,i){if(!o.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i=this.length)throw RangeError("Index out of range");if(i<0)throw RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(n=t;n=i+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function x(e,t,r,i,n,s){if(e>r||e3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${(s+1)*8}${n}`:`>= -(2${n} ** ${(s+1)*8-1}${n}) and < 2 ** ${(s+1)*8-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new N.ERR_OUT_OF_RANGE("value",i,e)}O(n,"offset"),(void 0===i[n]||void 0===i[n+s])&&R(n,i.length-(s+1))}function O(e,t){if("number"!=typeof e)throw new N.ERR_INVALID_ARG_TYPE(t,"number",e)}function R(e,t,r){if(Math.floor(e)!==e)throw O(e,r),new N.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new N.ERR_BUFFER_OUT_OF_BOUNDS;throw new N.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}T("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),T("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),T("ERR_OUT_OF_RANGE",function(e,t,r){let i=`The value of "${e}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>4294967296?n=P(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=P(n)),n+="n"),i+=` It must be ${t}. Received ${n}`},RangeError);let k=/[^+/0-9A-Za-z-_]/g;function D(e,t){let r;t=t||1/0;let i=e.length,n=null,s=[];for(let a=0;a55295&&r<57344){if(!n){if(r>56319||a+1===i){(t-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(t-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return s}function M(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(k,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function U(e,t,r,i){let n;for(n=0;n=t.length)&&!(n>=e.length);++n)t[n+r]=e[n];return n}function L(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}let B=function(){let e="0123456789abcdef",t=Array(256);for(let r=0;r<16;++r){let i=16*r;for(let n=0;n<16;++n)t[i+n]=e[r]+e[n]}return t}();function j(e){return"undefined"==typeof BigInt?$:e}function $(){throw Error("BigInt not supported")}},27484:function(e){var t;t=function(){"use strict";var e="millisecond",t="second",r="minute",i="hour",n="week",s="month",a="quarter",o="year",c="date",l="Invalid Date",u=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,d=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,h=function(e,t,r){var i=String(e);return!i||i.length>=t?e:""+Array(t+1-i.length).join(r)+e},f="en",p={};p[f]={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],r=e%100;return"["+e+(t[(r-20)%10]||t[r]||"th")+"]"}};var g="$isDayjsObject",m=function(e){return e instanceof v||!(!e||!e[g])},b=function e(t,r,i){var n;if(!t)return f;if("string"==typeof t){var s=t.toLowerCase();p[s]&&(n=s),r&&(p[s]=r,n=s);var a=t.split("-");if(!n&&a.length>1)return e(a[0])}else{var o=t.name;p[o]=t,n=o}return!i&&n&&(f=n),n||!i&&f},y=function(e,t){if(m(e))return e.clone();var r="object"==typeof t?t:{};return r.date=e,r.args=arguments,new v(r)},w={s:h,z:function(e){var t=-e.utcOffset(),r=Math.abs(t);return(t<=0?"+":"-")+h(Math.floor(r/60),2,"0")+":"+h(r%60,2,"0")},m:function e(t,r){if(t.date()0,m<=g.r||!g.r){m<=1&&p>0&&(g=h[p-1]);var b=d[g.l];o&&(m=o(""+m)),l="string"==typeof b?b.replace("%d",m):b(m,i,g.l,u);break}}if(i)return l;var y=u?d.future:d.past;return"function"==typeof y?y(l):y.replace("%s",l)},i.to=function(e,t){return s(e,t,this,!0)},i.from=function(e,t){return s(e,t,this)};var a=function(e){return e.$u?r.utc():r()};i.toNow=function(e){return this.to(a(this),e)},i.fromNow=function(e){return this.from(a(this),e)}}},e.exports=t()},70660:function(e){var t;t=function(){return function(e,t,r){r.updateLocale=function(e,t){var i=r.Ls[e];if(i)return(t?Object.keys(t):[]).forEach(function(e){i[e]=t[e]}),i}}},e.exports=t()},86266:function(e,t,r){"use strict";t.version=r(18597).i8,t.utils=r(80953),t.rand=r(29931),t.curve=r(88254),t.curves=r(45427),t.ec=r(57954),t.eddsa=r(65980)},4918:function(e,t,r){"use strict";var i=r(73785),n=r(80953),s=n.getNAF,a=n.getJSF,o=n.assert;function c(e,t){this.type=e,this.p=new i(t.p,16),this.red=t.prime?i.red(t.prime):i.mont(this.p),this.zero=new i(0).toRed(this.red),this.one=new i(1).toRed(this.red),this.two=new i(2).toRed(this.red),this.n=t.n&&new i(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,],this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function l(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=c,c.prototype.point=function(){throw Error("Not implemented")},c.prototype.validate=function(){throw Error("Not implemented")},c.prototype._fixedNafMul=function(e,t){o(e.precomputed);var r,i,n=e._getDoubles(),a=s(t,1,this._bitLength),c=(1<=r;u--)i=(i<<1)+a[u];l.push(i)}for(var d=this.jpoint(null,null,null),h=this.jpoint(null,null,null),f=c;f>0;f--){for(r=0;r=0;l--){for(var u=0;l>=0&&0===a[l];l--)u++;if(l>=0&&u++,c=c.dblp(u),l<0)break;var d=a[l];o(0!==d),c="affine"===e.type?d>0?c.mixedAdd(n[d-1>>1]):c.mixedAdd(n[-d-1>>1].neg()):d>0?c.add(n[d-1>>1]):c.add(n[-d-1>>1].neg())}return"affine"===e.type?c.toP():c},c.prototype._wnafMulAdd=function(e,t,r,i,n){var o,c,l,u=this._wnafT1,d=this._wnafT2,h=this._wnafT3,f=0;for(o=0;o=1;o-=2){var g=o-1,m=o;if(1!==u[g]||1!==u[m]){h[g]=s(r[g],u[g],this._bitLength),h[m]=s(r[m],u[m],this._bitLength),f=Math.max(h[g].length,f),f=Math.max(h[m].length,f);continue}var b=[t[g],null,null,t[m]];0===t[g].y.cmp(t[m].y)?(b[1]=t[g].add(t[m]),b[2]=t[g].toJ().mixedAdd(t[m].neg())):0===t[g].y.cmp(t[m].y.redNeg())?(b[1]=t[g].toJ().mixedAdd(t[m]),b[2]=t[g].add(t[m].neg())):(b[1]=t[g].toJ().mixedAdd(t[m]),b[2]=t[g].toJ().mixedAdd(t[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],w=a(r[g],r[m]);for(c=0,f=Math.max(w[0].length,f),h[g]=Array(f),h[m]=Array(f);c=0;o--){for(var _=0;o>=0;){var I=!0;for(c=0;c=0&&_++,E=E.dblp(_),o<0)break;for(c=0;c0?l=d[c][S-1>>1]:S<0&&(l=d[c][-S-1>>1].neg()),E="affine"===l.type?E.mixedAdd(l):E.add(l))}}for(o=0;o=Math.ceil((e.bitLength()+1)/t.step)},l.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n":""},l.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},l.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(e),n=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),s=i.redAdd(t),a=s.redSub(r),o=i.redSub(t),c=n.redMul(a),l=s.redMul(o),u=n.redMul(o),d=a.redMul(s);return this.curve.point(c,l,d,u)},l.prototype._projDbl=function(){var e,t,r,i,n,s,a=this.x.redAdd(this.y).redSqr(),o=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var l=(i=this.curve._mulA(o)).redAdd(c);this.zOne?(e=a.redSub(o).redSub(c).redMul(l.redSub(this.curve.two)),t=l.redMul(i.redSub(c)),r=l.redSqr().redSub(l).redSub(l)):(n=this.z.redSqr(),s=l.redSub(n).redISub(n),e=a.redSub(o).redISub(c).redMul(s),t=l.redMul(i.redSub(c)),r=l.redMul(s))}else i=o.redAdd(c),n=this.curve._mulC(this.z).redSqr(),s=i.redSub(n).redSub(n),e=this.curve._mulC(a.redISub(i)).redMul(s),t=this.curve._mulC(i).redMul(o.redISub(c)),r=i.redMul(s);return this.curve.point(e,t,r)},l.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},l.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),n=this.z.redMul(e.z.redAdd(e.z)),s=r.redSub(t),a=n.redSub(i),o=n.redAdd(i),c=r.redAdd(t),l=s.redMul(a),u=o.redMul(c),d=s.redMul(c),h=a.redMul(o);return this.curve.point(l,u,h,d)},l.prototype._projAdd=function(e){var t,r,i=this.z.redMul(e.z),n=i.redSqr(),s=this.x.redMul(e.x),a=this.y.redMul(e.y),o=this.curve.d.redMul(s).redMul(a),c=n.redSub(o),l=n.redAdd(o),u=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(s).redISub(a),d=i.redMul(c).redMul(u);return this.curve.twisted?(t=i.redMul(l).redMul(a.redSub(this.curve._mulA(s))),r=c.redMul(l)):(t=i.redMul(l).redMul(a.redSub(s)),r=this.curve._mulC(c).redMul(l)),this.curve.point(d,t,r)},l.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},l.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},l.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},l.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},l.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},l.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},l.prototype.getX=function(){return this.normalize(),this.x.fromRed()},l.prototype.getY=function(){return this.normalize(),this.y.fromRed()},l.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},l.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(i),0===this.x.cmp(t))return!0}},l.prototype.toP=l.prototype.normalize,l.prototype.mixedAdd=l.prototype.add},88254:function(e,t,r){"use strict";t.base=r(4918),t.short=r(6673),t.mont=r(22881),t.edwards=r(31138)},22881:function(e,t,r){"use strict";var i=r(73785),n=r(35717),s=r(4918),a=r(80953);function o(e){s.call(this,"mont",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(e,t,r){s.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(t,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}n(o,s),e.exports=o,o.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),i=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===i.redSqrt().redSqr().cmp(i)},n(c,s.BasePoint),o.prototype.decodePoint=function(e,t){return this.point(a.toArray(e,t),1)},o.prototype.point=function(e,t){return new c(this,e,t)},o.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(e,t){return new c(e,t[0],t[1]||e.one)},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),i=e.redMul(t),n=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},c.prototype.add=function(){throw Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=e.x.redAdd(e.z),s=e.x.redSub(e.z).redMul(r),a=n.redMul(i),o=t.z.redMul(s.redAdd(a).redSqr()),c=t.x.redMul(s.redISub(a).redSqr());return this.curve.point(o,c)},c.prototype.mul=function(e){for(var t=e.clone(),r=this,i=this.curve.point(null,null),n=[];0!==t.cmpn(0);t.iushrn(1))n.push(t.andln(1));for(var s=n.length-1;s>=0;s--)0===n[s]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},c.prototype.mulAdd=function(){throw Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw Error("Not supported on Montgomery curve")},c.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},6673:function(e,t,r){"use strict";var i=r(80953),n=r(73785),s=r(35717),a=r(4918),o=i.assert;function c(e){a.call(this,"short",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}function l(e,t,r,i){a.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new n(t,16),this.y=new n(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function u(e,t,r,i){a.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new n(0)):(this.x=new n(t,16),this.y=new n(r,16),this.z=new n(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}s(c,a),e.exports=c,c.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){if(e.beta)t=new n(e.beta,16).toRed(this.red);else{var t,r,i,s=this._getEndoRoots(this.p);t=(t=0>s[0].cmp(s[1])?s[0]:s[1]).toRed(this.red)}if(e.lambda)r=new n(e.lambda,16);else{var a=this._getEndoRoots(this.n);0===this.g.mul(a[0]).x.cmp(this.g.x.redMul(t))?r=a[0]:(r=a[1],o(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return i=e.basis?e.basis.map(function(e){return{a:new n(e.a,16),b:new n(e.b,16)}}):this._getEndoBasis(r),{beta:t,lambda:r,basis:i}}},c.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:n.mont(e),r=new n(2).toRed(t).redInvm(),i=r.redNeg(),s=new n(3).toRed(t).redNeg().redSqrt().redMul(r);return[i.redAdd(s).fromRed(),i.redSub(s).fromRed()]},c.prototype._getEndoBasis=function(e){for(var t,r,i,s,a,o,c,l,u,d=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=e,f=this.n.clone(),p=new n(1),g=new n(0),m=new n(0),b=new n(1),y=0;0!==h.cmpn(0);){var w=f.div(h);l=f.sub(w.mul(h)),u=m.sub(w.mul(p));var v=b.sub(w.mul(g));if(!i&&0>l.cmp(d))t=c.neg(),r=p,i=l.neg(),s=u;else if(i&&2==++y)break;c=l,f=h,h=l,m=p,p=u,b=g,g=v}a=l.neg(),o=u;var A=i.sqr().add(s.sqr());return a.sqr().add(o.sqr()).cmp(A)>=0&&(a=t,o=r),i.negative&&(i=i.neg(),s=s.neg()),a.negative&&(a=a.neg(),o=o.neg()),[{a:i,b:s},{a:a,b:o}]},c.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],i=t[1],n=i.b.mul(e).divRound(this.n),s=r.b.neg().mul(e).divRound(this.n),a=n.mul(r.a),o=s.mul(i.a),c=n.mul(r.b),l=s.mul(i.b);return{k1:e.sub(a).sub(o),k2:c.add(l).neg()}},c.prototype.pointFromX=function(e,t){(e=new n(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw Error("invalid point");var s=i.fromRed().isOdd();return(t&&!s||!t&&s)&&(i=i.redNeg()),this.point(e,i)},c.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,i=this.a.redMul(t),n=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},c.prototype._endoWnafMulAdd=function(e,t,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,s=0;s":""},l.prototype.isInfinity=function(){return this.inf},l.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e)||0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},l.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),i=e.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(i),s=n.redSqr().redISub(this.x.redAdd(this.x)),a=n.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,a)},l.prototype.getX=function(){return this.x.fromRed()},l.prototype.getY=function(){return this.y.fromRed()},l.prototype.mul=function(e){return(e=new n(e,16),this.isInfinity())?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},l.prototype.mulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},l.prototype.jmulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},l.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},l.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,i=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return t},l.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},s(u,a.BasePoint),c.prototype.jpoint=function(e,t,r){return new u(this,e,t,r)},u.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(r,i)},u.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},u.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(t),n=e.x.redMul(r),s=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),o=i.redSub(n),c=s.redSub(a);if(0===o.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=o.redSqr(),u=l.redMul(o),d=i.redMul(l),h=c.redSqr().redIAdd(u).redISub(d).redISub(d),f=c.redMul(d.redISub(h)).redISub(s.redMul(u)),p=this.z.redMul(e.z).redMul(o);return this.curve.jpoint(h,f,p)},u.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,i=e.x.redMul(t),n=this.y,s=e.y.redMul(t).redMul(this.z),a=r.redSub(i),o=n.redSub(s);if(0===a.cmpn(0))return 0!==o.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),l=c.redMul(a),u=r.redMul(c),d=o.redSqr().redIAdd(l).redISub(u).redISub(u),h=o.redMul(u.redISub(d)).redISub(n.redMul(l)),f=this.z.redMul(a);return this.curve.jpoint(d,h,f)},u.prototype.dblp=function(e){if(0===e||this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){var t,r=this;for(t=0;t=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},45427:function(e,t,r){"use strict";var i,n=r(33715),s=r(88254),a=r(80953).assert;function o(e){"short"===e.type?this.curve=new s.short(e):"edwards"===e.type?this.curve=new s.edwards(e):this.curve=new s.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(e,r){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get:function(){var i=new o(r);return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:i}),i}})}t.PresetCurve=o,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:n.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:n.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:n.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:n.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),c("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:n.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:n.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:n.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{i=r(91037)}catch(e){i=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:n.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",i]})},57954:function(e,t,r){"use strict";var i=r(73785),n=r(2156),s=r(80953),a=r(45427),o=r(29931),c=s.assert,l=r(31251),u=r(90611);function d(e){if(!(this instanceof d))return new d(e);"string"==typeof e&&(c(Object.prototype.hasOwnProperty.call(a,e),"Unknown curve "+e),e=a[e]),e instanceof a.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=d,d.prototype.keyPair=function(e){return new l(this,e)},d.prototype.keyFromPrivate=function(e,t){return l.fromPrivate(this,e,t)},d.prototype.keyFromPublic=function(e,t){return l.fromPublic(this,e,t)},d.prototype.genKeyPair=function(e){e||(e={});for(var t=new n({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||o(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),s=this.n.sub(new i(2));;){var a=new i(t.generate(r));if(!(a.cmp(s)>0))return a.iaddn(1),this.keyFromPrivate(a)}},d.prototype._truncateToN=function(e,t,r){if(i.isBN(e)||"number"==typeof e)n=(e=new i(e,16)).byteLength();else if("object"==typeof e)n=e.length,e=new i(e,16);else{var n,s=e.toString();n=s.length+1>>>1,e=new i(s,16)}"number"!=typeof r&&(r=8*n);var a=r-this.n.bitLength();return(a>0&&(e=e.ushrn(a)),!t&&e.cmp(this.n)>=0)?e.sub(this.n):e},d.prototype.sign=function(e,t,r,s){if("object"==typeof r&&(s=r,r=null),s||(s={}),"string"!=typeof e&&"number"!=typeof e&&!i.isBN(e)){c("object"==typeof e&&e&&"number"==typeof e.length,"Expected message to be an array-like, a hex string, or a BN instance"),c(e.length>>>0===e.length);for(var a=0;a=(g=this._truncateToN(g,!0)).cmpn(1)||g.cmp(f)>=0)){var m=this.g.mul(g);if(!m.isInfinity()){var b=m.getX(),y=b.umod(this.n);if(0!==y.cmpn(0)){var w=g.invm(this.n).mul(y.mul(t.getPrivate()).iadd(e));if(0!==(w=w.umod(this.n)).cmpn(0)){var v=(m.getY().isOdd()?1:0)|(0!==b.cmp(y)?2:0);return s.canonical&&w.cmp(this.nh)>0&&(w=this.n.sub(w),v^=1),new u({r:y,s:w,recoveryParam:v})}}}}}},d.prototype.verify=function(e,t,r,i,n){n||(n={}),e=this._truncateToN(e,!1,n.msgBitLength),r=this.keyFromPublic(r,i);var s,a=(t=new u(t,"hex")).r,o=t.s;if(0>a.cmpn(1)||a.cmp(this.n)>=0||0>o.cmpn(1)||o.cmp(this.n)>=0)return!1;var c=o.invm(this.n),l=c.mul(e).umod(this.n),d=c.mul(a).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(l,r.getPublic(),d)).isInfinity()&&s.eqXToP(a):!(s=this.g.mulAdd(l,r.getPublic(),d)).isInfinity()&&0===s.getX().umod(this.n).cmp(a)},d.prototype.recoverPubKey=function(e,t,r,n){c((3&r)===r,"The recovery param is more than two bits"),t=new u(t,n);var s=this.n,a=new i(e),o=t.r,l=t.s,d=1&r,h=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw Error("Unable to find sencond key candinate");o=h?this.curve.pointFromX(o.add(this.curve.n),d):this.curve.pointFromX(o,d);var f=t.r.invm(s),p=s.sub(a).mul(f).umod(s),g=l.mul(f).umod(s);return this.g.mulAdd(p,o,g)},d.prototype.getKeyRecoveryParam=function(e,t,r,i){if(null!==(t=new u(t,i)).recoveryParam)return t.recoveryParam;for(var n,s=0;s<4;s++){try{n=this.recoverPubKey(e,t,s)}catch(e){continue}if(n.eq(r))return s}throw Error("Unable to find valid recovery factor")}},31251:function(e,t,r){"use strict";var i=r(73785),n=r(80953).assert;function s(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=s,s.fromPublic=function(e,t,r){return t instanceof s?t:new s(e,{pub:t,pubEnc:r})},s.fromPrivate=function(e,t,r){return t instanceof s?t:new s(e,{priv:t,privEnc:r})},s.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},s.prototype.getPublic=function(e,t){return("string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t)?this.pub.encode(t,e):this.pub},s.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},s.prototype._importPrivate=function(e,t){this.priv=new i(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},s.prototype._importPublic=function(e,t){if(e.x||e.y){"mont"===this.ec.curve.type?n(e.x,"Need x coordinate"):("short"===this.ec.curve.type||"edwards"===this.ec.curve.type)&&n(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},s.prototype.derive=function(e){return e.validate()||n(e.validate(),"public point not validated"),e.mul(this.priv).getX()},s.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},s.prototype.verify=function(e,t,r){return this.ec.verify(e,t,this,void 0,r)},s.prototype.inspect=function(){return""}},90611:function(e,t,r){"use strict";var i=r(73785),n=r(80953),s=n.assert;function a(e,t){if(e instanceof a)return e;this._importDER(e,t)||(s(e.r&&e.s,"Signature without r or s"),this.r=new i(e.r,16),this.s=new i(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function o(){this.place=0}function c(e,t){var r=e[t.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4||0===e[t.place])return!1;for(var n=0,s=0,a=t.place;s>>=0;return!(n<=127)&&(t.place=a,n)}function l(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}e.exports=a,a.prototype._importDER=function(e,t){e=n.toArray(e,t);var r=new o;if(48!==e[r.place++])return!1;var s=c(e,r);if(!1===s||s+r.place!==e.length||2!==e[r.place++])return!1;var a=c(e,r);if(!1===a||(128&e[r.place])!=0)return!1;var l=e.slice(r.place,a+r.place);if(r.place+=a,2!==e[r.place++])return!1;var u=c(e,r);if(!1===u||e.length!==u+r.place||(128&e[r.place])!=0)return!1;var d=e.slice(r.place,u+r.place);if(0===l[0]){if(!(128&l[1]))return!1;l=l.slice(1)}if(0===d[0]){if(!(128&d[1]))return!1;d=d.slice(1)}return this.r=new i(l),this.s=new i(d),this.recoveryParam=null,!0},a.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=l(t),r=l(r);!r[0]&&!(128&r[1]);)r=r.slice(1);var i=[2];u(i,t.length),(i=i.concat(t)).push(2),u(i,r.length);var s=i.concat(r),a=[48];return u(a,s.length),a=a.concat(s),n.encode(a,e)}},65980:function(e,t,r){"use strict";var i=r(33715),n=r(45427),s=r(80953),a=s.assert,o=s.parseBytes,c=r(79087),l=r(23622);function u(e){if(a("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof u))return new u(e);e=n[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=i.sha512}e.exports=u,u.prototype.sign=function(e,t){e=o(e);var r=this.keyFromSecret(t),i=this.hashInt(r.messagePrefix(),e),n=this.g.mul(i),s=this.encodePoint(n),a=this.hashInt(s,r.pubBytes(),e).mul(r.priv()),c=i.add(a).umod(this.curve.n);return this.makeSignature({R:n,S:c,Rencoded:s})},u.prototype.verify=function(e,t,r){if(e=o(e),(t=this.makeSignature(t)).S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var i=this.keyFromPublic(r),n=this.hashInt(t.Rencoded(),i.pubBytes(),e),s=this.g.mul(t.S());return t.R().add(i.pub().mul(n)).eq(s)},u.prototype.hashInt=function(){for(var e=this.hash(),t=0;t(n>>1)-1?(n>>1)-c:c,s.isubn(o)):o=0,i[a]=o,s.iushrn(1)}return i},t.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var i=0,n=0;e.cmpn(-i)>0||t.cmpn(-n)>0;){var s,a,o,c=e.andln(3)+i&3,l=t.andln(3)+n&3;3===c&&(c=-1),3===l&&(l=-1),a=(1&c)==0?0:(3==(s=e.andln(7)+i&7)||5===s)&&2===l?-c:c,r[0].push(a),o=(1&l)==0?0:(3==(s=t.andln(7)+n&7)||5===s)&&2===c?-l:l,r[1].push(o),2*i===a+1&&(i=1-i),2*n===o+1&&(n=1-n),e.iushrn(1),t.iushrn(1)}return r},t.cachedProperty=function(e,t,r){var i="_"+t;e.prototype[t]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},t.parseBytes=function(e){return"string"==typeof e?t.toArray(e,"hex"):e},t.intFromLE=function(e){return new i(e,"hex","le")}},73785:function(e,t,r){!function(e,t){"use strict";function i(e,t){if(!e)throw Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function s(e,t,r){if(s.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&(("le"===t||"be"===t)&&(r=t,t=10),this._init(e||0,t||10,r||"be"))}"object"==typeof e?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;try{l="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(85568).Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function o(e,t,r){var i=a(e,r);return r-1>=t&&(i|=a(e,r-1)<<4),i}function c(e,t,r,i){for(var n=0,s=Math.min(e.length,r),a=t;a=49?n+=o-49+10:o>=17?n+=o-17+10:n+=o}return n}s.isBN=function(e){return e instanceof s||null!==e&&"object"==typeof e&&e.constructor.wordSize===s.wordSize&&Array.isArray(e.words)},s.max=function(e,t){return e.cmp(t)>0?e:t},s.min=function(e,t){return 0>e.cmp(t)?e:t},s.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;a-=3)s=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=s<>>26-o&67108863,(o+=24)>=26&&(o-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-o&67108863,(o+=24)>=26&&(o-=26,n++);return this.strip()},s.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var i,n=0;n=t;n-=2)i=o(e,t,n)<=18?(s-=18,a+=1,this.words[a]|=i>>>26):s+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(s-=18,a+=1,this.words[a]|=i>>>26):s+=8;this.strip()},s.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var s=e.length-r,a=s%i,o=Math.min(s,s-a)+r,l=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var l,u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],s=0|t.words[0],a=n*s,o=67108863&a,c=a/67108864|0;r.words[0]=o;for(var l=1;l>>26,d=67108863&c,h=Math.min(l,t.length-1),f=Math.max(0,l-e.length+1);f<=h;f++){var p=l-f|0;u+=(a=(n=0|e.words[p])*(s=0|t.words[f])+d)/67108864|0,d=67108863&a}r.words[l]=0|d,c=0|u}return 0!==c?r.words[l]=0|c:r.length--,r.strip()}s.prototype.toString=function(e,t){if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var r,n=0,s=0,a=0;a>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),r=0!==s||a!==this.length-1?u[6-c.length]+c+r:c+r}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=d[e],f=h[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(f).toString(e);r=(p=p.idivn(f)).isZero()?g+r:u[l-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(e,t){return i(void 0!==l),this.toArrayLike(l,e,t)},s.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},s.prototype.toArrayLike=function(e,t,r){var n,s,a=this.byteLength(),o=r||Math.max(1,a);i(a<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0"),this.strip();var c=new e(o),l=this.clone();if("le"===t){for(s=0;!l.isZero();s++)n=l.andln(255),l.iushrn(8),c[s]=n;for(;s=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},s.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return(8191&t)==0&&(r+=13,t>>>=13),(127&t)==0&&(r+=7,t>>>=7),(15&t)==0&&(r+=4,t>>>=4),(3&t)==0&&(r+=2,t>>>=2),(1&t)==0&&r++,r},s.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return(this.length-1)*26+t},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},s.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},s.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},s.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},s.prototype.iuxor=function(e){this.length>e.length?(t=this,r=e):(t=e,r=this);for(var t,r,i=0;ie.length?this.clone().ixor(e):e.clone().ixor(this)},s.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},s.prototype.inotn=function(e){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},s.prototype.notn=function(e){return this.clone().inotn(e)},s.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),t?this.words[r]=this.words[r]|1<e.length?(r=this,i=e):(r=e,i=this);for(var t,r,i,n=0,s=0;s>>26;for(;0!==n&&s>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;se.length?this.clone().iadd(e):e.clone().iadd(this)},s.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t,r,i=this.iadd(e);return e.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(t=this,r=e):(t=e,r=this);for(var s=0,a=0;a>26,this.words[a]=67108863&i;for(;0!==s&&a>26,this.words[a]=67108863&i;if(0===s&&a>>13,f=0|a[1],p=8191&f,g=f>>>13,m=0|a[2],b=8191&m,y=m>>>13,w=0|a[3],v=8191&w,A=w>>>13,E=0|a[4],C=8191&E,_=E>>>13,I=0|a[5],S=8191&I,N=I>>>13,T=0|a[6],P=8191&T,x=T>>>13,O=0|a[7],R=8191&O,k=O>>>13,D=0|a[8],M=8191&D,U=D>>>13,L=0|a[9],B=8191&L,j=L>>>13,$=0|o[0],F=8191&$,q=$>>>13,z=0|o[1],H=8191&z,W=z>>>13,V=0|o[2],G=8191&V,K=V>>>13,Q=0|o[3],Y=8191&Q,Z=Q>>>13,J=0|o[4],X=8191&J,ee=J>>>13,et=0|o[5],er=8191&et,ei=et>>>13,en=0|o[6],es=8191&en,ea=en>>>13,eo=0|o[7],ec=8191&eo,el=eo>>>13,eu=0|o[8],ed=8191&eu,eh=eu>>>13,ef=0|o[9],ep=8191&ef,eg=ef>>>13;r.negative=e.negative^t.negative,r.length=19;var em=(l+(i=Math.imul(d,F))|0)+((8191&(n=(n=Math.imul(d,q))+Math.imul(h,F)|0))<<13)|0;l=((s=Math.imul(h,q))+(n>>>13)|0)+(em>>>26)|0,em&=67108863,i=Math.imul(p,F),n=(n=Math.imul(p,q))+Math.imul(g,F)|0,s=Math.imul(g,q);var eb=(l+(i=i+Math.imul(d,H)|0)|0)+((8191&(n=(n=n+Math.imul(d,W)|0)+Math.imul(h,H)|0))<<13)|0;l=((s=s+Math.imul(h,W)|0)+(n>>>13)|0)+(eb>>>26)|0,eb&=67108863,i=Math.imul(b,F),n=(n=Math.imul(b,q))+Math.imul(y,F)|0,s=Math.imul(y,q),i=i+Math.imul(p,H)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(g,H)|0,s=s+Math.imul(g,W)|0;var ey=(l+(i=i+Math.imul(d,G)|0)|0)+((8191&(n=(n=n+Math.imul(d,K)|0)+Math.imul(h,G)|0))<<13)|0;l=((s=s+Math.imul(h,K)|0)+(n>>>13)|0)+(ey>>>26)|0,ey&=67108863,i=Math.imul(v,F),n=(n=Math.imul(v,q))+Math.imul(A,F)|0,s=Math.imul(A,q),i=i+Math.imul(b,H)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(y,H)|0,s=s+Math.imul(y,W)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,K)|0)+Math.imul(g,G)|0,s=s+Math.imul(g,K)|0;var ew=(l+(i=i+Math.imul(d,Y)|0)|0)+((8191&(n=(n=n+Math.imul(d,Z)|0)+Math.imul(h,Y)|0))<<13)|0;l=((s=s+Math.imul(h,Z)|0)+(n>>>13)|0)+(ew>>>26)|0,ew&=67108863,i=Math.imul(C,F),n=(n=Math.imul(C,q))+Math.imul(_,F)|0,s=Math.imul(_,q),i=i+Math.imul(v,H)|0,n=(n=n+Math.imul(v,W)|0)+Math.imul(A,H)|0,s=s+Math.imul(A,W)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(y,G)|0,s=s+Math.imul(y,K)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(g,Y)|0,s=s+Math.imul(g,Z)|0;var ev=(l+(i=i+Math.imul(d,X)|0)|0)+((8191&(n=(n=n+Math.imul(d,ee)|0)+Math.imul(h,X)|0))<<13)|0;l=((s=s+Math.imul(h,ee)|0)+(n>>>13)|0)+(ev>>>26)|0,ev&=67108863,i=Math.imul(S,F),n=(n=Math.imul(S,q))+Math.imul(N,F)|0,s=Math.imul(N,q),i=i+Math.imul(C,H)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(_,H)|0,s=s+Math.imul(_,W)|0,i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,K)|0)+Math.imul(A,G)|0,s=s+Math.imul(A,K)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,Z)|0)+Math.imul(y,Y)|0,s=s+Math.imul(y,Z)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,ee)|0)+Math.imul(g,X)|0,s=s+Math.imul(g,ee)|0;var eA=(l+(i=i+Math.imul(d,er)|0)|0)+((8191&(n=(n=n+Math.imul(d,ei)|0)+Math.imul(h,er)|0))<<13)|0;l=((s=s+Math.imul(h,ei)|0)+(n>>>13)|0)+(eA>>>26)|0,eA&=67108863,i=Math.imul(P,F),n=(n=Math.imul(P,q))+Math.imul(x,F)|0,s=Math.imul(x,q),i=i+Math.imul(S,H)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(N,H)|0,s=s+Math.imul(N,W)|0,i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(_,G)|0,s=s+Math.imul(_,K)|0,i=i+Math.imul(v,Y)|0,n=(n=n+Math.imul(v,Z)|0)+Math.imul(A,Y)|0,s=s+Math.imul(A,Z)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,ee)|0)+Math.imul(y,X)|0,s=s+Math.imul(y,ee)|0,i=i+Math.imul(p,er)|0,n=(n=n+Math.imul(p,ei)|0)+Math.imul(g,er)|0,s=s+Math.imul(g,ei)|0;var eE=(l+(i=i+Math.imul(d,es)|0)|0)+((8191&(n=(n=n+Math.imul(d,ea)|0)+Math.imul(h,es)|0))<<13)|0;l=((s=s+Math.imul(h,ea)|0)+(n>>>13)|0)+(eE>>>26)|0,eE&=67108863,i=Math.imul(R,F),n=(n=Math.imul(R,q))+Math.imul(k,F)|0,s=Math.imul(k,q),i=i+Math.imul(P,H)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(x,H)|0,s=s+Math.imul(x,W)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,K)|0)+Math.imul(N,G)|0,s=s+Math.imul(N,K)|0,i=i+Math.imul(C,Y)|0,n=(n=n+Math.imul(C,Z)|0)+Math.imul(_,Y)|0,s=s+Math.imul(_,Z)|0,i=i+Math.imul(v,X)|0,n=(n=n+Math.imul(v,ee)|0)+Math.imul(A,X)|0,s=s+Math.imul(A,ee)|0,i=i+Math.imul(b,er)|0,n=(n=n+Math.imul(b,ei)|0)+Math.imul(y,er)|0,s=s+Math.imul(y,ei)|0,i=i+Math.imul(p,es)|0,n=(n=n+Math.imul(p,ea)|0)+Math.imul(g,es)|0,s=s+Math.imul(g,ea)|0;var eC=(l+(i=i+Math.imul(d,ec)|0)|0)+((8191&(n=(n=n+Math.imul(d,el)|0)+Math.imul(h,ec)|0))<<13)|0;l=((s=s+Math.imul(h,el)|0)+(n>>>13)|0)+(eC>>>26)|0,eC&=67108863,i=Math.imul(M,F),n=(n=Math.imul(M,q))+Math.imul(U,F)|0,s=Math.imul(U,q),i=i+Math.imul(R,H)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(k,H)|0,s=s+Math.imul(k,W)|0,i=i+Math.imul(P,G)|0,n=(n=n+Math.imul(P,K)|0)+Math.imul(x,G)|0,s=s+Math.imul(x,K)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(N,Y)|0,s=s+Math.imul(N,Z)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(_,X)|0,s=s+Math.imul(_,ee)|0,i=i+Math.imul(v,er)|0,n=(n=n+Math.imul(v,ei)|0)+Math.imul(A,er)|0,s=s+Math.imul(A,ei)|0,i=i+Math.imul(b,es)|0,n=(n=n+Math.imul(b,ea)|0)+Math.imul(y,es)|0,s=s+Math.imul(y,ea)|0,i=i+Math.imul(p,ec)|0,n=(n=n+Math.imul(p,el)|0)+Math.imul(g,ec)|0,s=s+Math.imul(g,el)|0;var e_=(l+(i=i+Math.imul(d,ed)|0)|0)+((8191&(n=(n=n+Math.imul(d,eh)|0)+Math.imul(h,ed)|0))<<13)|0;l=((s=s+Math.imul(h,eh)|0)+(n>>>13)|0)+(e_>>>26)|0,e_&=67108863,i=Math.imul(B,F),n=(n=Math.imul(B,q))+Math.imul(j,F)|0,s=Math.imul(j,q),i=i+Math.imul(M,H)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(U,H)|0,s=s+Math.imul(U,W)|0,i=i+Math.imul(R,G)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(k,G)|0,s=s+Math.imul(k,K)|0,i=i+Math.imul(P,Y)|0,n=(n=n+Math.imul(P,Z)|0)+Math.imul(x,Y)|0,s=s+Math.imul(x,Z)|0,i=i+Math.imul(S,X)|0,n=(n=n+Math.imul(S,ee)|0)+Math.imul(N,X)|0,s=s+Math.imul(N,ee)|0,i=i+Math.imul(C,er)|0,n=(n=n+Math.imul(C,ei)|0)+Math.imul(_,er)|0,s=s+Math.imul(_,ei)|0,i=i+Math.imul(v,es)|0,n=(n=n+Math.imul(v,ea)|0)+Math.imul(A,es)|0,s=s+Math.imul(A,ea)|0,i=i+Math.imul(b,ec)|0,n=(n=n+Math.imul(b,el)|0)+Math.imul(y,ec)|0,s=s+Math.imul(y,el)|0,i=i+Math.imul(p,ed)|0,n=(n=n+Math.imul(p,eh)|0)+Math.imul(g,ed)|0,s=s+Math.imul(g,eh)|0;var eI=(l+(i=i+Math.imul(d,ep)|0)|0)+((8191&(n=(n=n+Math.imul(d,eg)|0)+Math.imul(h,ep)|0))<<13)|0;l=((s=s+Math.imul(h,eg)|0)+(n>>>13)|0)+(eI>>>26)|0,eI&=67108863,i=Math.imul(B,H),n=(n=Math.imul(B,W))+Math.imul(j,H)|0,s=Math.imul(j,W),i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,K)|0)+Math.imul(U,G)|0,s=s+Math.imul(U,K)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(k,Y)|0,s=s+Math.imul(k,Z)|0,i=i+Math.imul(P,X)|0,n=(n=n+Math.imul(P,ee)|0)+Math.imul(x,X)|0,s=s+Math.imul(x,ee)|0,i=i+Math.imul(S,er)|0,n=(n=n+Math.imul(S,ei)|0)+Math.imul(N,er)|0,s=s+Math.imul(N,ei)|0,i=i+Math.imul(C,es)|0,n=(n=n+Math.imul(C,ea)|0)+Math.imul(_,es)|0,s=s+Math.imul(_,ea)|0,i=i+Math.imul(v,ec)|0,n=(n=n+Math.imul(v,el)|0)+Math.imul(A,ec)|0,s=s+Math.imul(A,el)|0,i=i+Math.imul(b,ed)|0,n=(n=n+Math.imul(b,eh)|0)+Math.imul(y,ed)|0,s=s+Math.imul(y,eh)|0;var eS=(l+(i=i+Math.imul(p,ep)|0)|0)+((8191&(n=(n=n+Math.imul(p,eg)|0)+Math.imul(g,ep)|0))<<13)|0;l=((s=s+Math.imul(g,eg)|0)+(n>>>13)|0)+(eS>>>26)|0,eS&=67108863,i=Math.imul(B,G),n=(n=Math.imul(B,K))+Math.imul(j,G)|0,s=Math.imul(j,K),i=i+Math.imul(M,Y)|0,n=(n=n+Math.imul(M,Z)|0)+Math.imul(U,Y)|0,s=s+Math.imul(U,Z)|0,i=i+Math.imul(R,X)|0,n=(n=n+Math.imul(R,ee)|0)+Math.imul(k,X)|0,s=s+Math.imul(k,ee)|0,i=i+Math.imul(P,er)|0,n=(n=n+Math.imul(P,ei)|0)+Math.imul(x,er)|0,s=s+Math.imul(x,ei)|0,i=i+Math.imul(S,es)|0,n=(n=n+Math.imul(S,ea)|0)+Math.imul(N,es)|0,s=s+Math.imul(N,ea)|0,i=i+Math.imul(C,ec)|0,n=(n=n+Math.imul(C,el)|0)+Math.imul(_,ec)|0,s=s+Math.imul(_,el)|0,i=i+Math.imul(v,ed)|0,n=(n=n+Math.imul(v,eh)|0)+Math.imul(A,ed)|0,s=s+Math.imul(A,eh)|0;var eN=(l+(i=i+Math.imul(b,ep)|0)|0)+((8191&(n=(n=n+Math.imul(b,eg)|0)+Math.imul(y,ep)|0))<<13)|0;l=((s=s+Math.imul(y,eg)|0)+(n>>>13)|0)+(eN>>>26)|0,eN&=67108863,i=Math.imul(B,Y),n=(n=Math.imul(B,Z))+Math.imul(j,Y)|0,s=Math.imul(j,Z),i=i+Math.imul(M,X)|0,n=(n=n+Math.imul(M,ee)|0)+Math.imul(U,X)|0,s=s+Math.imul(U,ee)|0,i=i+Math.imul(R,er)|0,n=(n=n+Math.imul(R,ei)|0)+Math.imul(k,er)|0,s=s+Math.imul(k,ei)|0,i=i+Math.imul(P,es)|0,n=(n=n+Math.imul(P,ea)|0)+Math.imul(x,es)|0,s=s+Math.imul(x,ea)|0,i=i+Math.imul(S,ec)|0,n=(n=n+Math.imul(S,el)|0)+Math.imul(N,ec)|0,s=s+Math.imul(N,el)|0,i=i+Math.imul(C,ed)|0,n=(n=n+Math.imul(C,eh)|0)+Math.imul(_,ed)|0,s=s+Math.imul(_,eh)|0;var eT=(l+(i=i+Math.imul(v,ep)|0)|0)+((8191&(n=(n=n+Math.imul(v,eg)|0)+Math.imul(A,ep)|0))<<13)|0;l=((s=s+Math.imul(A,eg)|0)+(n>>>13)|0)+(eT>>>26)|0,eT&=67108863,i=Math.imul(B,X),n=(n=Math.imul(B,ee))+Math.imul(j,X)|0,s=Math.imul(j,ee),i=i+Math.imul(M,er)|0,n=(n=n+Math.imul(M,ei)|0)+Math.imul(U,er)|0,s=s+Math.imul(U,ei)|0,i=i+Math.imul(R,es)|0,n=(n=n+Math.imul(R,ea)|0)+Math.imul(k,es)|0,s=s+Math.imul(k,ea)|0,i=i+Math.imul(P,ec)|0,n=(n=n+Math.imul(P,el)|0)+Math.imul(x,ec)|0,s=s+Math.imul(x,el)|0,i=i+Math.imul(S,ed)|0,n=(n=n+Math.imul(S,eh)|0)+Math.imul(N,ed)|0,s=s+Math.imul(N,eh)|0;var eP=(l+(i=i+Math.imul(C,ep)|0)|0)+((8191&(n=(n=n+Math.imul(C,eg)|0)+Math.imul(_,ep)|0))<<13)|0;l=((s=s+Math.imul(_,eg)|0)+(n>>>13)|0)+(eP>>>26)|0,eP&=67108863,i=Math.imul(B,er),n=(n=Math.imul(B,ei))+Math.imul(j,er)|0,s=Math.imul(j,ei),i=i+Math.imul(M,es)|0,n=(n=n+Math.imul(M,ea)|0)+Math.imul(U,es)|0,s=s+Math.imul(U,ea)|0,i=i+Math.imul(R,ec)|0,n=(n=n+Math.imul(R,el)|0)+Math.imul(k,ec)|0,s=s+Math.imul(k,el)|0,i=i+Math.imul(P,ed)|0,n=(n=n+Math.imul(P,eh)|0)+Math.imul(x,ed)|0,s=s+Math.imul(x,eh)|0;var ex=(l+(i=i+Math.imul(S,ep)|0)|0)+((8191&(n=(n=n+Math.imul(S,eg)|0)+Math.imul(N,ep)|0))<<13)|0;l=((s=s+Math.imul(N,eg)|0)+(n>>>13)|0)+(ex>>>26)|0,ex&=67108863,i=Math.imul(B,es),n=(n=Math.imul(B,ea))+Math.imul(j,es)|0,s=Math.imul(j,ea),i=i+Math.imul(M,ec)|0,n=(n=n+Math.imul(M,el)|0)+Math.imul(U,ec)|0,s=s+Math.imul(U,el)|0,i=i+Math.imul(R,ed)|0,n=(n=n+Math.imul(R,eh)|0)+Math.imul(k,ed)|0,s=s+Math.imul(k,eh)|0;var eO=(l+(i=i+Math.imul(P,ep)|0)|0)+((8191&(n=(n=n+Math.imul(P,eg)|0)+Math.imul(x,ep)|0))<<13)|0;l=((s=s+Math.imul(x,eg)|0)+(n>>>13)|0)+(eO>>>26)|0,eO&=67108863,i=Math.imul(B,ec),n=(n=Math.imul(B,el))+Math.imul(j,ec)|0,s=Math.imul(j,el),i=i+Math.imul(M,ed)|0,n=(n=n+Math.imul(M,eh)|0)+Math.imul(U,ed)|0,s=s+Math.imul(U,eh)|0;var eR=(l+(i=i+Math.imul(R,ep)|0)|0)+((8191&(n=(n=n+Math.imul(R,eg)|0)+Math.imul(k,ep)|0))<<13)|0;l=((s=s+Math.imul(k,eg)|0)+(n>>>13)|0)+(eR>>>26)|0,eR&=67108863,i=Math.imul(B,ed),n=(n=Math.imul(B,eh))+Math.imul(j,ed)|0,s=Math.imul(j,eh);var ek=(l+(i=i+Math.imul(M,ep)|0)|0)+((8191&(n=(n=n+Math.imul(M,eg)|0)+Math.imul(U,ep)|0))<<13)|0;l=((s=s+Math.imul(U,eg)|0)+(n>>>13)|0)+(ek>>>26)|0,ek&=67108863;var eD=(l+(i=Math.imul(B,ep))|0)+((8191&(n=(n=Math.imul(B,eg))+Math.imul(j,ep)|0))<<13)|0;return l=((s=Math.imul(j,eg))+(n>>>13)|0)+(eD>>>26)|0,eD&=67108863,c[0]=em,c[1]=eb,c[2]=ey,c[3]=ew,c[4]=ev,c[5]=eA,c[6]=eE,c[7]=eC,c[8]=e_,c[9]=eI,c[10]=eS,c[11]=eN,c[12]=eT,c[13]=eP,c[14]=ex,c[15]=eO,c[16]=eR,c[17]=ek,c[18]=eD,0!==l&&(c[19]=l,r.length++),r};function g(e,t,r){return new m().mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(p=f),s.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?p(this,e,t):r<63?f(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,s=0;s>>26)|0)>>>26,a&=67108863}r.words[s]=o,i=a,a=n}return 0!==i?r.words[s]=i:r.length--,r.strip()}(this,e,t):g(this,e,t)},m.prototype.makeRBT=function(e){for(var t=Array(e),r=s.prototype._countBits(e)-1,i=0;i>=1;return i},m.prototype.permute=function(e,t,r,i,n,s){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*a+1]=8191&s,s>>>=13;for(a=2*t;a>=26,t+=(n/67108864|0)+(s>>>26),this.words[r]=67108863&s}return 0!==t&&(this.words[r]=t,this.length++),this},s.prototype.muln=function(e){return this.clone().imuln(e)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(e){var t=function(e){for(var t=Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new s(1);for(var r=this,i=0;i=0);var t,r=e%26,n=(e-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t=0),n=t?(t-t%26)/26:0;var n,s=e%26,a=Math.min((e-s)/26,this.length),o=67108863^67108863>>>s<a)for(this.length-=a,c=0;c=0&&(0!==l||c>=n);c--){var u=0|this.words[c];this.words[c]=l<<26-s|u>>>s,l=u&o}return r&&0!==l&&(r.words[r.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(e,t,r){return i(0===this.negative),this.iushrn(e,t,r)},s.prototype.shln=function(e){return this.clone().ishln(e)},s.prototype.ushln=function(e){return this.clone().iushln(e)},s.prototype.shrn=function(e){return this.clone().ishrn(e)},s.prototype.ushrn=function(e){return this.clone().iushrn(e)},s.prototype.testn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;return!(this.length<=r)&&!!(this.words[r]&1<=0);var t=e%26,r=(e-t)/26;return(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)?this:(0!==t&&r++,this.length=Math.min(r,this.length),0!==t&&(this.words[this.length-1]&=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},s.prototype.isubn=function(e){if(i("number"==typeof e),i(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[n+r]=67108863&s}for(;n>26,this.words[n+r]=67108863&s;if(0===o)return this.strip();for(i(-1===o),o=0,n=0;n>26,this.words[n]=67108863&s;return this.negative=1,this.strip()},s.prototype._wordDiv=function(e,t){var r,i=this.length-e.length,n=this.clone(),a=e,o=0|a.words[a.length-1];0!=(i=26-this._countBits(o))&&(a=a.ushln(i),n.iushln(i),o=0|a.words[a.length-1]);var c=n.length-a.length;if("mod"!==t){(r=new s(null)).length=c+1,r.words=Array(r.length);for(var l=0;l=0;d--){var h=(0|n.words[a.length+d])*67108864+(0|n.words[a.length+d-1]);for(h=Math.min(h/o|0,67108863),n._ishlnsubmul(a,h,d);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(a,1,d),n.isZero()||(n.negative^=1);r&&(r.words[d]=h)}return r&&r.strip(),n.strip(),"div"!==t&&0!==i&&n.iushrn(i),{div:r||null,mod:n}},s.prototype.divmod=function(e,t,r){var n,a,o;return(i(!e.isZero()),this.isZero())?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(n=o.div.neg()),"div"!==t&&(a=o.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:n,mod:a}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(n=o.div.neg()),{div:n,mod:o.mod}):(this.negative&e.negative)!=0?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(a=o.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:o.div,mod:a}):e.length>this.length||0>this.cmp(e)?{div:new s(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new s(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new s(this.modn(e.words[0]))}:this._wordDiv(e,t)},s.prototype.div=function(e){return this.divmod(e,"div",!1).div},s.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},s.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},s.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),s=r.cmp(i);return s<0||1===n&&0===s?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},s.prototype.modn=function(e){i(e<=67108863);for(var t=67108864%e,r=0,n=this.length-1;n>=0;n--)r=(t*r+(0|this.words[n]))%e;return r},s.prototype.idivn=function(e){i(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*t;this.words[r]=n/e|0,t=n%e}return this.strip()},s.prototype.divn=function(e){return this.clone().idivn(e)},s.prototype.egcd=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new s(1),a=new s(0),o=new s(0),c=new s(1),l=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++l;for(var u=r.clone(),d=t.clone();!t.isZero();){for(var h=0,f=1;(t.words[0]&f)==0&&h<26;++h,f<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(n.isOdd()||a.isOdd())&&(n.iadd(u),a.isub(d)),n.iushrn(1),a.iushrn(1);for(var p=0,g=1;(r.words[0]&g)==0&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(u),c.isub(d)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o),a.isub(c)):(r.isub(t),o.isub(n),c.isub(a))}return{a:o,b:c,gcd:r.iushln(l)}},s.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t,r=this,n=e.clone();r=0!==r.negative?r.umod(e):r.clone();for(var a=new s(1),o=new s(0),c=n.clone();r.cmpn(1)>0&&n.cmpn(1)>0;){for(var l=0,u=1;(r.words[0]&u)==0&&l<26;++l,u<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,h=1;(n.words[0]&h)==0&&d<26;++d,h<<=1);if(d>0)for(n.iushrn(d);d-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);r.cmp(n)>=0?(r.isub(n),a.isub(o)):(n.isub(r),o.isub(a))}return 0>(t=0===r.cmpn(1)?a:o).cmpn(0)&&t.iadd(e),t},s.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var s=t;t=r,r=s}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(i)},s.prototype.invm=function(e){return this.egcd(e).a.umod(e)},s.prototype.isEven=function(){return(1&this.words[0])==0},s.prototype.isOdd=function(){return(1&this.words[0])==1},s.prototype.andln=function(e){return this.words[0]&e},s.prototype.bincn=function(e){i("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<>>26,o&=67108863,this.words[a]=o}return 0!==s&&(this.words[a]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return -1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),i(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:ne.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){in&&(t=1);break}}return t},s.prototype.gtn=function(e){return 1===this.cmpn(e)},s.prototype.gt=function(e){return 1===this.cmp(e)},s.prototype.gten=function(e){return this.cmpn(e)>=0},s.prototype.gte=function(e){return this.cmp(e)>=0},s.prototype.ltn=function(e){return -1===this.cmpn(e)},s.prototype.lt=function(e){return -1===this.cmp(e)},s.prototype.lten=function(e){return 0>=this.cmpn(e)},s.prototype.lte=function(e){return 0>=this.cmp(e)},s.prototype.eqn=function(e){return 0===this.cmpn(e)},s.prototype.eq=function(e){return 0===this.cmp(e)},s.red=function(e){return new C(e)},s.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(e){return this.red=e,this},s.prototype.forceRed=function(e){return i(!this.red,"Already a number in reduction context"),this._forceRed(e)},s.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},s.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},s.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},s.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},s.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},s.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},s.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var b={k256:null,p224:null,p192:null,p25519:null};function y(e,t){this.name=e,this.p=new s(t,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function C(e){if("string"==typeof e){var t=s._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function _(e){C.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var e=new s(null);return e.words=Array(Math.ceil(this.n/13)),e},y.prototype.ireduce=function(e){var t,r=e;do this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength();while(t>this.n);var i=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(e,t){e.iushrn(this.n,0,t)},y.prototype.imulK=function(e){return e.imul(this.k)},n(w,y),w.prototype.split=function(e,t){for(var r=Math.min(e.length,9),i=0;i>>22,n=s}n>>>=22,e.words[i-10]=n,0===n&&e.length>10?e.length-=10:e.length-=9},w.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},s._prime=function(e){var t;if(b[e])return b[e];if("k256"===e)t=new w;else if("p224"===e)t=new v;else if("p192"===e)t=new A;else if("p25519"===e)t=new E;else throw Error("Unknown prime "+e);return b[e]=t,t},C.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},C.prototype._verify2=function(e,t){i((e.negative|t.negative)==0,"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},C.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},C.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},C.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},C.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},C.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},C.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r},C.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},C.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},C.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},C.prototype.isqr=function(e){return this.imul(e,e.clone())},C.prototype.sqr=function(e){return this.mul(e,e)},C.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var r=this.m.add(new s(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),a=0;!n.isZero()&&0===n.andln(1);)a++,n.iushrn(1);i(!n.isZero());var o=new s(1).toRed(this),c=o.redNeg(),l=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new s(2*u*u).toRed(this);0!==this.pow(u,l).cmp(c);)u.redIAdd(c);for(var d=this.pow(u,n),h=this.pow(e,n.addn(1).iushrn(1)),f=this.pow(e,n),p=a;0!==f.cmp(o);){for(var g=f,m=0;0!==g.cmp(o);m++)g=g.redSqr();i(m=0;i--){for(var l=t.words[i],u=c-1;u>=0;u--){var d=l>>u&1;if(n!==r[0]&&(n=this.sqr(n)),0===d&&0===a){o=0;continue}a<<=1,a|=d,(4==++o||0===i&&0===u)&&(n=this.mul(n,r[a]),o=0,a=0)}c=26}return n},C.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},C.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},s.mont=function(e){return new _(e)},n(_,C),_.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},_.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},_.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):0>n.cmpn(0)&&(s=n.iadd(this.m)),s._forceRed(this)},_.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new s(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):0>n.cmpn(0)&&(a=n.iadd(this.m)),a._forceRed(this)},_.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},26729:function(e){"use strict";var t=Object.prototype.hasOwnProperty,r="~";function i(){}function n(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function s(e,t,i,s,a){if("function"!=typeof i)throw TypeError("The listener must be a function");var o=new n(i,s||e,a),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],o]:e._events[c].push(o):(e._events[c]=o,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function o(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1)),o.prototype.eventNames=function(){var e,i,n=[];if(0===this._eventsCount)return n;for(i in e=this._events)t.call(e,i)&&n.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},o.prototype.listeners=function(e){var t=r?r+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,s=i.length,a=Array(s);n0&&a.length>n&&!a.warned){a.warned=!0;var n,s,a,l=Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,console&&console.warn&&console.warn(l)}return e}function u(){if(!this.fired)return(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0==arguments.length)?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=u.bind(i);return n.listener=r,i.wrapFn=n,n}function h(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=Array(e.length),r=0;r0&&(a=t[0]),a instanceof Error)throw a;var a,o=Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var c=s[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else for(var l=c.length,u=p(c,l),r=0;r=0;s--)if(r[s]===t||r[s].listener===t){a=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1=0;i--)this.removeListener(e,t[i]);return this},s.prototype.listeners=function(e){return h(this,e,!0)},s.prototype.rawListeners=function(e){return h(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},s.prototype.listenerCount=f,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},33715:function(e,t,r){t.utils=r(26436),t.common=r(95772),t.sha=r(89041),t.ripemd=r(12949),t.hmac=r(52344),t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160},95772:function(e,t,r){"use strict";var i=r(26436),n=r(79746);function s(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=s,s.prototype.update=function(e,t){if(e=i.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=i.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,i[n++]=e>>>16&255,i[n++]=e>>>8&255,i[n++]=255&e}else for(s=8,i[n++]=255&e,i[n++]=e>>>8&255,i[n++]=e>>>16&255,i[n++]=e>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0;sthis.blockSize&&(e=new this.Hash().update(e).digest()),n(e.length<=this.blockSize);for(var t=e.length;t>>3},t.g1_256=function(e){return i(e,17)^i(e,19)^e>>>10}},26436:function(e,t,r){"use strict";var i=r(79746),n=r(35717);function s(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function a(e){return 1===e.length?"0"+e:e}function o(e){if(7===e.length)return"0"+e;if(6===e.length)return"00"+e;if(5===e.length)return"000"+e;if(4===e.length)return"0000"+e;if(3===e.length)return"00000"+e;if(2===e.length)return"000000"+e;if(1===e.length)return"0000000"+e;else return e}t.inherits=n,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e){if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/ig,"")).length%2!=0&&(e="0"+e),n=0;n>6|192:((s=e,a=n,(64512&s.charCodeAt(a))!=55296||a<0||a+1>=s.length?1:(64512&s.charCodeAt(a+1))!=56320)?r[i++]=o>>12|224:(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++n)),r[i++]=o>>18|240,r[i++]=o>>12&63|128),r[i++]=o>>6&63|128),r[i++]=63&o|128)}}else for(n=0;n>>0;return o},t.split32=function(e,t){for(var r=Array(4*e.length),i=0,n=0;i>>24,r[n+1]=s>>>16&255,r[n+2]=s>>>8&255,r[n+3]=255&s):(r[n+3]=s>>>24,r[n+2]=s>>>16&255,r[n+1]=s>>>8&255,r[n]=255&s)}return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,i){return e+t+r+i>>>0},t.sum32_5=function(e,t,r,i,n){return e+t+r+i+n>>>0},t.sum64=function(e,t,r,i){var n=e[t],s=i+e[t+1]>>>0;e[t]=(s>>0,e[t+1]=s},t.sum64_hi=function(e,t,r,i){return(t+i>>>0>>0},t.sum64_lo=function(e,t,r,i){return t+i>>>0},t.sum64_4_hi=function(e,t,r,i,n,s,a,o){var c,l=t;return e+r+n+a+(0+((l=l+i>>>0)>>0)>>0)>>0},t.sum64_4_lo=function(e,t,r,i,n,s,a,o){return t+i+s+o>>>0},t.sum64_5_hi=function(e,t,r,i,n,s,a,o,c,l){var u,d=t;return e+r+n+a+c+(0+((d=d+i>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function(e,t,r,i,n,s,a,o,c,l){return t+i+s+o+l>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},2156:function(e,t,r){"use strict";var i=r(33715),n=r(34504),s=r(79746);function a(e){if(!(this instanceof a))return new a(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=n.toArray(e.entropy,e.entropyEnc||"hex"),r=n.toArray(e.nonce,e.nonceEnc||"hex"),i=n.toArray(e.pers,e.persEnc||"hex");s(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,i)}e.exports=a,a.prototype._init=function(e,t,r){var i=e.concat(t).concat(r);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var n=0;n=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},a.prototype.generate=function(e,t,r,i){if(this._reseed>this.reseedInterval)throw Error("Reseed is required");"string"!=typeof t&&(i=r,r=t,t=null),r&&(r=n.toArray(r,i||"hex"),this._update(r));for(var s=[];s.length>1,u=-7,d=r?n-1:0,h=r?-1:1,f=e[t+d];for(d+=h,s=f&(1<<-u)-1,f>>=-u,u+=o;u>0;s=256*s+e[t+d],d+=h,u-=8);for(a=s&(1<<-u)-1,s>>=-u,u+=i;u>0;a=256*a+e[t+d],d+=h,u-=8);if(0===s)s=1-l;else{if(s===c)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,i),s-=l}return(f?-1:1)*a*Math.pow(2,s-i)},t.write=function(e,t,r,i,n,s){var a,o,c,l=8*s-n-1,u=(1<>1,h=23===n?5960464477539062e-23:0,f=i?0:s-1,p=i?1:-1,g=t<0||0===t&&1/t<0?1:0;for(isNaN(t=Math.abs(t))||t===1/0?(o=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+d>=1?t+=h/c:t+=h*Math.pow(2,1-d),t*c>=2&&(a++,c/=2),a+d>=u?(o=0,a=u):a+d>=1?(o=(t*c-1)*Math.pow(2,n),a+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,n),a=0));n>=8;e[r+f]=255&o,f+=p,o/=256,n-=8);for(a=a<0;e[r+f]=255&a,f+=p,a/=256,l-=8);e[r+f-p]|=128*g}},35717:function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},79746:function(e){function t(e,t){if(!e)throw Error(t||"Assertion failed")}e.exports=t,t.equal=function(e,t,r){if(e!=t)throw Error(r||"Assertion failed: "+e+" != "+t)}},34504:function(e,t){"use strict";function r(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",i=0;i>8,a=255&n;s?r.push(s,a):r.push(a)}return r},t.zero2=r,t.toHex=i,t.encode=function(e,t){return"hex"===t?i(e):e}},6840:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/_app",function(){return r(85126)}])},83525:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"actionAsyncStorage",{enumerable:!0,get:function(){return i}});let i=(0,r(14001).createAsyncLocalStorage)();("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},76361:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"actionAsyncStorage",{enumerable:!0,get:function(){return i.actionAsyncStorage}});let i=r(83525);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},14001:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createAsyncLocalStorage",{enumerable:!0,get:function(){return s}});let r=Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available");class i{disable(){throw r}getStore(){}run(){throw r}exit(){throw r}enterWith(){throw r}}let n=globalThis.AsyncLocalStorage;function s(){return n?new n:new i}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},8199:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{ReadonlyURLSearchParams:function(){return c.ReadonlyURLSearchParams},RedirectType:function(){return c.RedirectType},ServerInsertedHTMLContext:function(){return l.ServerInsertedHTMLContext},notFound:function(){return c.notFound},permanentRedirect:function(){return c.permanentRedirect},redirect:function(){return c.redirect},useParams:function(){return f},usePathname:function(){return d},useRouter:function(){return h},useSearchParams:function(){return u},useSelectedLayoutSegment:function(){return g},useSelectedLayoutSegments:function(){return p},useServerInsertedHTML:function(){return l.useServerInsertedHTML}});let i=r(67294),n=r(60257),s=r(22608),a=r(11288),o=r(66406),c=r(72717),l=r(65988);function u(){let e=(0,i.useContext)(s.SearchParamsContext);return(0,i.useMemo)(()=>e?new c.ReadonlyURLSearchParams(e):null,[e])}function d(){return(0,i.useContext)(s.PathnameContext)}function h(){let e=(0,i.useContext)(n.AppRouterContext);if(null===e)throw Error("invariant expected app router to be mounted");return e}function f(){return(0,i.useContext)(s.PathParamsContext)}function p(e){void 0===e&&(e="children");let t=(0,i.useContext)(n.LayoutRouterContext);return t?function e(t,r,i,n){let s;if(void 0===i&&(i=!0),void 0===n&&(n=[]),i)s=t[1][r];else{var c;let e=t[1];s=null!=(c=e.children)?c:Object.values(e)[0]}if(!s)return n;let l=s[0],u=(0,a.getSegmentValue)(l);return!u||u.startsWith(o.PAGE_SEGMENT_KEY)?n:(n.push(u),e(s,r,!1,n))}(t.tree,e):null}function g(e){void 0===e&&(e="children");let t=p(e);if(!t||0===t.length)return null;let r="children"===e?t[0]:t[t.length-1];return r===o.DEFAULT_SEGMENT_KEY?null:r}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},72717:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{ReadonlyURLSearchParams:function(){return a},RedirectType:function(){return i.RedirectType},notFound:function(){return n.notFound},permanentRedirect:function(){return i.permanentRedirect},redirect:function(){return i.redirect}});let i=r(7511),n=r(73394);class s extends Error{constructor(){super("Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams")}}class a extends URLSearchParams{append(){throw new s}delete(){throw new s}set(){throw new s}sort(){throw new s}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},73394:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{isNotFoundError:function(){return n},notFound:function(){return i}});let r="NEXT_NOT_FOUND";function i(){let e=Error(r);throw e.digest=r,e}function n(e){return"object"==typeof e&&null!==e&&"digest"in e&&e.digest===r}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},44234:function(e,t){"use strict";var r,i;Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"RedirectStatusCode",{enumerable:!0,get:function(){return r}}),(i=r||(r={}))[i.SeeOther=303]="SeeOther",i[i.TemporaryRedirect=307]="TemporaryRedirect",i[i.PermanentRedirect=308]="PermanentRedirect",("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},7511:function(e,t,r){"use strict";var i,n;Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{RedirectType:function(){return i},getRedirectError:function(){return l},getRedirectStatusCodeFromError:function(){return g},getRedirectTypeFromError:function(){return p},getURLFromRedirectError:function(){return f},isRedirectError:function(){return h},permanentRedirect:function(){return d},redirect:function(){return u}});let s=r(82595),a=r(76361),o=r(44234),c="NEXT_REDIRECT";function l(e,t,r){void 0===r&&(r=o.RedirectStatusCode.TemporaryRedirect);let i=Error(c);i.digest=c+";"+t+";"+e+";"+r+";";let n=s.requestAsyncStorage.getStore();return n&&(i.mutableCookies=n.mutableCookies),i}function u(e,t){void 0===t&&(t="replace");let r=a.actionAsyncStorage.getStore();throw l(e,t,(null==r?void 0:r.isAction)?o.RedirectStatusCode.SeeOther:o.RedirectStatusCode.TemporaryRedirect)}function d(e,t){void 0===t&&(t="replace");let r=a.actionAsyncStorage.getStore();throw l(e,t,(null==r?void 0:r.isAction)?o.RedirectStatusCode.SeeOther:o.RedirectStatusCode.PermanentRedirect)}function h(e){if("object"!=typeof e||null===e||!("digest"in e)||"string"!=typeof e.digest)return!1;let[t,r,i,n]=e.digest.split(";",4),s=Number(n);return t===c&&("replace"===r||"push"===r)&&"string"==typeof i&&!isNaN(s)&&s in o.RedirectStatusCode}function f(e){return h(e)?e.digest.split(";",3)[2]:null}function p(e){if(!h(e))throw Error("Not a redirect error");return e.digest.split(";",2)[1]}function g(e){if(!h(e))throw Error("Not a redirect error");return Number(e.digest.split(";",4)[3])}(n=i||(i={})).push="push",n.replace="replace",("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},25329:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"requestAsyncStorage",{enumerable:!0,get:function(){return i}});let i=(0,r(14001).createAsyncLocalStorage)();("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},82595:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{getExpectedRequestStore:function(){return n},requestAsyncStorage:function(){return i.requestAsyncStorage}});let i=r(25329);function n(e){let t=i.requestAsyncStorage.getStore();if(t)return t;throw Error("`"+e+"` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context")}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},11288:function(e,t){"use strict";function r(e){return Array.isArray(e)?e[1]:e}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getSegmentValue",{enumerable:!0,get:function(){return r}}),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},65988:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{ServerInsertedHTMLContext:function(){return n},useServerInsertedHTML:function(){return s}});let i=r(77697)._(r(67294)),n=i.default.createContext(null);function s(e){let t=(0,i.useContext)(n);t&&t(e)}},80419:function(e,t,r){"use strict";r.d(t,{p:function(){return o},r:function(){return a}});var i=r(1958),n=r(49321);let s="referral_code";function a(e){let t=o();if(console.log("existing code:",t),t===i.DR&&e){let t=e.startsWith("0x")?e:"0x"+e;if(!(0,n.U)(t,{strict:!1})){console.error("Invalid referral code:",t);return}console.log("Setting referral code to:",t),sessionStorage.setItem(s,t)}else console.log("Referral code already set or invalid:",t,e)}function o(){let e=sessionStorage.getItem(s);return e&&(0,n.U)(e,{strict:!1})?e:i.DR}},10198:function(e,t,r){"use strict";let i,n,s,a,o,c,l,u,d,h,f,p,g,m,b,y;function w(e){let t=e.state.current,r=e.state.connections.get(t),i=r?.accounts,n=i?.[0],s=e.chains.find(e=>e.id===r?.chainId),a=e.state.status;switch(a){case"connected":return{address:n,addresses:i,chain:s,chainId:r?.chainId,connector:r?.connector,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:a};case"reconnecting":return{address:n,addresses:i,chain:s,chainId:r?.chainId,connector:r?.connector,isConnected:!!n,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:a};case"connecting":return{address:n,addresses:i,chain:s,chainId:r?.chainId,connector:r?.connector,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:a};case"disconnected":return{address:void 0,addresses:void 0,chain:void 0,chainId:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:a}}}r.d(t,{Q:function(){return rw},H:function(){return rv}});var v=r(94898);let A=e=>(t,r,i)=>{let n=i.subscribe;return i.subscribe=(e,t,r)=>{let s=e;if(t){let n=(null==r?void 0:r.equalityFn)||Object.is,a=e(i.getState());s=r=>{let i=e(r);if(!n(a,i)){let e=a;t(a=i,e)}},(null==r?void 0:r.fireImmediately)&&t(a,a)}return n(s)},e(t,r,i)},E=e=>t=>{try{let r=e(t);if(r instanceof Promise)return r;return{then:e=>E(e)(r),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>E(t)(e)}}},C=(e,t)=>(r,i,n)=>{let s,a={storage:function(e,t){let r;try{r=e()}catch(e){return}return{getItem:e=>{var t;let i=e=>null===e?null:JSON.parse(e,void 0),n=null!=(t=r.getItem(e))?t:null;return n instanceof Promise?n.then(i):i(n)},setItem:(e,t)=>r.setItem(e,JSON.stringify(t,void 0)),removeItem:e=>r.removeItem(e)}}(()=>localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,c=new Set,l=new Set,u=a.storage;if(!u)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),r(...e)},i,n);let d=()=>{let e=a.partialize({...i()});return u.setItem(a.name,{state:e,version:a.version})},h=n.setState;n.setState=(e,t)=>{h(e,t),d()};let f=e((...e)=>{r(...e),d()},i,n);n.getInitialState=()=>f;let p=()=>{var e,t;if(!u)return;o=!1,c.forEach(e=>{var t;return e(null!=(t=i())?t:f)});let n=(null==(t=a.onRehydrateStorage)?void 0:t.call(a,null!=(e=i())?e:f))||void 0;return E(u.getItem.bind(u))(a.name).then(e=>{if(e){if("number"!=typeof e.version||e.version===a.version)return[!1,e.state];if(a.migrate)return[!0,a.migrate(e.state,e.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var t;let[n,o]=e;if(r(s=a.merge(o,null!=(t=i())?t:f),!0),n)return d()}).then(()=>{null==n||n(s,void 0),s=i(),o=!0,l.forEach(e=>e(s))}).catch(e=>{null==n||n(void 0,e)})};return n.persist={setOptions:e=>{a={...a,...e},e.storage&&(u=e.storage)},clearStorage:()=>{null==u||u.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>p(),hasHydrated:()=>o,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(l.add(e),()=>{l.delete(e)})},a.skipHydration||p(),s||f},_=e=>{let t;let r=new Set,i=(e,i)=>{let n="function"==typeof e?e(t):e;if(!Object.is(n,t)){let e=t;t=(null!=i?i:"object"!=typeof n||null===n)?n:Object.assign({},t,n),r.forEach(r=>r(t,e))}},n=()=>t,s={setState:i,getState:n,getInitialState:()=>a,subscribe:e=>(r.add(e),()=>r.delete(e))},a=t=e(i,n,s);return s},I=e=>e?_(e):_;var S=r(45775),N=r(39028),T=r(60229),P=r(7760),x=r(92106),O=r(87675),R=r(7066);class k extends R.G{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}class D extends R.G{constructor({connector:e}){super(`"${e.name}" does not support programmatic chain switching.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainNotSupportedError"})}}var M=r(27319);function U(e={}){let t,r,i,n;let{shimDisconnect:s=!0,unstable_shimAsyncInject:a}=e;function o(){let t=e.target;if("function"==typeof t){let e=t();if(e)return e}return"object"==typeof t?t:"string"==typeof t?{...L[t]??{id:t,name:`${t[0].toUpperCase()}${t.slice(1)}`,provider:`is${t[0].toUpperCase()}${t.slice(1)}`}}:{id:"injected",name:"Injected",provider:e=>e?.ethereum}}return(0,M.K)(c=>({get icon(){return o().icon},get id(){return o().id},get name(){return o().name},get supportsSimulation(){return!0},type:U.type,async setup(){let r=await this.getProvider();r?.on&&e.target&&(i||(i=this.onConnect.bind(this),r.on("connect",i)),t||(t=this.onAccountsChanged.bind(this),r.on("accountsChanged",t)))},async connect({chainId:a,isReconnecting:o}={}){let l=await this.getProvider();if(!l)throw new k;let u=[];if(o)u=await this.getAccounts().catch(()=>[]);else if(s)try{let e=await l.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});(u=e[0]?.caveats?.[0]?.value?.map(e=>S.K(e))).length>0&&(u=await this.getAccounts())}catch(e){if(e.code===N.ab.code)throw new N.ab(e);if(e.code===N.pT.code)throw e}try{u?.length||o||(u=(await l.request({method:"eth_requestAccounts"})).map(e=>(0,S.K)(e))),i&&(l.removeListener("connect",i),i=void 0),t||(t=this.onAccountsChanged.bind(this),l.on("accountsChanged",t)),r||(r=this.onChainChanged.bind(this),l.on("chainChanged",r)),n||(n=this.onDisconnect.bind(this),l.on("disconnect",n));let d=await this.getChainId();if(a&&d!==a){let e=await this.switchChain({chainId:a}).catch(e=>{if(e.code===N.ab.code)throw e;return{id:d}});d=e?.id??d}return s&&await c.storage?.removeItem(`${this.id}.disconnected`),e.target||await c.storage?.setItem("injected.connected",!0),{accounts:u,chainId:d}}catch(e){if(e.code===N.ab.code)throw new N.ab(e);if(e.code===N.pT.code)throw new N.pT(e);throw e}},async disconnect(){let t=await this.getProvider();if(!t)throw new k;r&&(t.removeListener("chainChanged",r),r=void 0),n&&(t.removeListener("disconnect",n),n=void 0),i||(i=this.onConnect.bind(this),t.on("connect",i));try{await (0,T.F)(()=>t.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}s&&await c.storage?.setItem(`${this.id}.disconnected`,!0),e.target||await c.storage?.removeItem("injected.connected")},async getAccounts(){let e=await this.getProvider();if(!e)throw new k;return(await e.request({method:"eth_accounts"})).map(e=>(0,S.K)(e))},async getChainId(){let e=await this.getProvider();if(!e)throw new k;return Number(await e.request({method:"eth_chainId"}))},async getProvider(){let e;if("undefined"==typeof window)return;let t=o();return(e="function"==typeof t.provider?t.provider(window):"string"==typeof t.provider?B(window,t.provider):t.provider)&&!e.removeListener&&("off"in e&&"function"==typeof e.off?e.removeListener=e.off:e.removeListener=()=>{}),e},async isAuthorized(){try{if(s&&await c.storage?.getItem(`${this.id}.disconnected`)||!e.target&&!await c.storage?.getItem("injected.connected"))return!1;if(!await this.getProvider()){if(void 0!==a&&!1!==a){let e=async()=>("undefined"!=typeof window&&window.removeEventListener("ethereum#initialized",e),!!await this.getProvider()),t="number"==typeof a?a:1e3;if(await Promise.race([..."undefined"!=typeof window?[new Promise(t=>window.addEventListener("ethereum#initialized",()=>t(e()),{once:!0}))]:[],new Promise(r=>setTimeout(()=>r(e()),t))]))return!0}throw new k}return!!(await (0,P.J)(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:e,chainId:t}){let r=await this.getProvider();if(!r)throw new k;let i=c.chains.find(e=>e.id===t);if(!i)throw new N.x3(new O.X4);let n=new Promise(e=>{let r=i=>{"chainId"in i&&i.chainId===t&&(c.emitter.off("change",r),e())};c.emitter.on("change",r)});try{return await Promise.all([r.request({method:"wallet_switchEthereumChain",params:[{chainId:(0,x.eC)(t)}]}).then(async()=>{await this.getChainId()===t&&c.emitter.emit("change",{chainId:t})}),n]),i}catch(s){if(4902===s.code||s?.data?.originalError?.code===4902)try{let s,a;let{default:o,...l}=i.blockExplorers??{};e?.blockExplorerUrls?s=e.blockExplorerUrls:o&&(s=[o.url,...Object.values(l).map(e=>e.url)]),a=e?.rpcUrls?.length?e.rpcUrls:[i.rpcUrls.default?.http[0]??""];let u={blockExplorerUrls:s,chainId:(0,x.eC)(t),chainName:e?.chainName??i.name,iconUrls:e?.iconUrls,nativeCurrency:e?.nativeCurrency??i.nativeCurrency,rpcUrls:a};return await Promise.all([r.request({method:"wallet_addEthereumChain",params:[u]}).then(async()=>{if(await this.getChainId()===t)c.emitter.emit("change",{chainId:t});else throw new N.ab(Error("User rejected switch after adding network."))}),n]),i}catch(e){throw new N.ab(e)}if(s.code===N.ab.code)throw new N.ab(s);throw new N.x3(s)}},async onAccountsChanged(e){if(0===e.length)this.onDisconnect();else if(c.emitter.listenerCount("connect")){let e=(await this.getChainId()).toString();this.onConnect({chainId:e}),s&&await c.storage?.removeItem(`${this.id}.disconnected`)}else c.emitter.emit("change",{accounts:e.map(e=>(0,S.K)(e))})},onChainChanged(e){let t=Number(e);c.emitter.emit("change",{chainId:t})},async onConnect(e){let s=await this.getAccounts();if(0===s.length)return;let a=Number(e.chainId);c.emitter.emit("connect",{accounts:s,chainId:a});let o=await this.getProvider();o&&(i&&(o.removeListener("connect",i),i=void 0),t||(t=this.onAccountsChanged.bind(this),o.on("accountsChanged",t)),r||(r=this.onChainChanged.bind(this),o.on("chainChanged",r)),n||(n=this.onDisconnect.bind(this),o.on("disconnect",n)))},async onDisconnect(e){let t=await this.getProvider();e&&1013===e.code&&t&&(await this.getAccounts()).length||(c.emitter.emit("disconnect"),t&&(r&&(t.removeListener("chainChanged",r),r=void 0),n&&(t.removeListener("disconnect",n),n=void 0),i||(i=this.onConnect.bind(this),t.on("connect",i))))}}))}U.type="injected";let L={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider:e=>e?.coinbaseWalletExtension?e.coinbaseWalletExtension:B(e,"isCoinbaseWallet")},metaMask:{id:"metaMask",name:"MetaMask",provider:e=>B(e,e=>{if(!e.isMetaMask||e.isBraveWallet&&!e._events&&!e._state)return!1;for(let t of["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPhantom","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"])if(e[t])return!1;return!0})},phantom:{id:"phantom",name:"Phantom",provider:e=>e?.phantom?.ethereum?e.phantom?.ethereum:B(e,"isPhantom")}};function B(e,t){function r(e){return"function"==typeof t?t(e):"string"!=typeof t||e[t]}let i=e.ethereum;return i?.providers?i.providers.find(e=>r(e)):i&&r(i)?i:void 0}var j=r(54146);class ${constructor(e){Object.defineProperty(this,"uid",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:new j.v})}on(e,t){this._emitter.on(e,t)}once(e,t){this._emitter.once(e,t)}off(e,t){this._emitter.off(e,t)}emit(e,...t){let r=t[0];this._emitter.emit(e,{uid:this.uid,...r})}listenerCount(e){return this._emitter.listenerCount(e)}}var F=r(1381);function q(e,t){return e.slice(0,t).join(".")||"."}function z(e,t){let{length:r}=e;for(let i=0;i{let i=r;return"bigint"==typeof i&&(i={__type:"bigint",value:r.toString()}),i instanceof Map&&(i={__type:"Map",value:Array.from(r.entries())}),t?.(e,i)??i},i),r??void 0)}function W(e){let{deserialize:t=F.v,key:r="wagmi",serialize:i=H,storage:n=V}=e;function s(e){return e instanceof Promise?e.then(e=>e).catch(()=>null):e}return{...n,key:r,async getItem(e,i){let a=n.getItem(`${r}.${e}`),o=await s(a);return o?t(o)??null:i??null},async setItem(e,t){let a=`${r}.${e}`;null===t?await s(n.removeItem(a)):await s(n.setItem(a,i(t)))},async removeItem(e){await s(n.removeItem(`${r}.${e}`))}}}let V={getItem:()=>null,setItem:()=>{},removeItem:()=>{}},G=256;var K=r(79983),Q=r(93714);let Y=new Map,Z=new Map,J=0;function X(e,t,r){let i=++J,n=()=>Y.get(e)||[],s=()=>{let t=n();Y.set(e,t.filter(e=>e.id!==i))},a=()=>{let t=n();if(!t.some(e=>e.id===i))return;let r=Z.get(e);1===t.length&&r&&r(),s()},o=n();if(Y.set(e,[...o,{id:i,fns:t}]),o&&o.length>0)return a;let c={};for(let e in t)c[e]=(...t)=>{let r=n();if(0!==r.length)for(let i of r)i.fns[e]?.(...t)};let l=r(c);return"function"==typeof l&&Z.set(e,l),a}var ee=r(62914);function et(e,{emitOnBegin:t,initialWaitTime:r,interval:i}){let n=!0,s=()=>n=!1;return(async()=>{let a;t&&(a=await e({unpoll:s}));let o=await r?.(a)??i;await (0,ee.D)(o);let c=async()=>{n&&(await e({unpoll:s}),await (0,ee.D)(i),c())};c()})(),s}var er=r(96070);async function ei(e){let t=function(e,{method:t}){let r={};return"fallback"===e.transport.type&&e.transport.onResponse?.(({method:e,response:i,status:n,transport:s})=>{"success"===n&&t===e&&(r[i]=s.request)}),t=>r[t]||e.request}(e,{method:"eth_newPendingTransactionFilter"}),r=await e.request({method:"eth_newPendingTransactionFilter"});return{id:r,request:t(r),type:"transaction"}}var en=r(57412),es=r(61228),ea=r(11187),eo=r(91734),ec=r(96005),el=r(39135),eu=r(66238),ed=r(78398),eh=r(80522);let ef="/docs/contract/decodeEventLog";function ep(e,{args:t,eventName:r}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...r?{args:t,eventName:r}:{}}}async function eg(e,{filter:t}){let r="strict"in t&&t.strict,i=await t.request({method:"eth_getFilterChanges",params:[t.id]});if("string"==typeof i[0])return i;let n=i.map(e=>ep(e));return"abi"in t&&t.abi?function(e){let{abi:t,args:r,logs:i,strict:n=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})();return i.map(e=>{try{let i=t.find(t=>"event"===t.type&&e.topics[0]===(0,ec.n)(t));if(!i)return null;let a=function(e){let{abi:t,data:r,strict:i,topics:n}=e,s=i??!0,[a,...o]=n;if(!a)throw new en.FM({docsPath:ef});let c=1===t.length?t[0]:t.find(e=>"event"===e.type&&a===(0,ec.n)((0,eh.t)(e)));if(!(c&&"name"in c)||"event"!==c.type)throw new en.lC(a,{docsPath:ef});let{name:l,inputs:u}=c,d=u?.some(e=>!("name"in e&&e.name)),h=d?[]:{},f=u.filter(e=>"indexed"in e&&e.indexed);for(let e=0;e!("indexed"in e&&e.indexed));if(p.length>0){if(r&&"0x"!==r)try{let e=(0,ed.r)(p,r);if(e){if(d)h=[...h,...e];else for(let t=0;t0?h:void 0}}({...e,abi:[i],strict:n});if(s&&!s.includes(a.eventName)||!function(e){let{args:t,inputs:r,matchArgs:i}=e;if(!i)return!0;if(!t)return!1;function n(e,t,r){try{if("address"===e.type)return(0,es.E)(t,r);if("string"===e.type||"bytes"===e.type)return(0,eo.w)((0,ea.O0)(t))===r;return t===r}catch{return!1}}return Array.isArray(t)&&Array.isArray(i)?i.every((e,i)=>{if(null==e)return!0;let s=r[i];return!!s&&(Array.isArray(e)?e:[e]).some(e=>n(s,e,t[i]))}):!("object"!=typeof t||Array.isArray(t)||"object"!=typeof i||Array.isArray(i))&&Object.entries(i).every(([e,i])=>{if(null==i)return!0;let s=r.find(t=>t.name===e);return!!s&&(Array.isArray(i)?i:[i]).some(r=>n(s,r,t[e]))})}({args:a.args,inputs:i.inputs,matchArgs:r}))return null;return{...a,...e}}catch(i){let t,r;if(i instanceof en.lC)return null;if(i instanceof en.SM||i instanceof en.Gy){if(n)return null;t=i.abiItem.name,r=i.abiItem.inputs?.some(e=>!("name"in e&&e.name))}return{...e,args:r?[]:{},eventName:t}}}).filter(Boolean)}({abi:t.abi,logs:n,strict:r}):n}async function em(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function eb(e,{batch:t=!0,onError:r,onTransactions:i,poll:n,pollingInterval:s=e.pollingInterval}){let a,o;return(void 0!==n?n:"webSocket"!==e.transport.type)?X((0,er.P)(["watchPendingTransactions",e.uid,t,s]),{onTransactions:i,onError:r},r=>{let i;let n=et(async()=>{try{if(!i)try{i=await (0,Q.s)(e,ei,"createPendingTransactionFilter")({});return}catch(e){throw n(),e}let s=await (0,Q.s)(e,eg,"getFilterChanges")({filter:i});if(0===s.length)return;if(t)r.onTransactions(s);else for(let e of s)r.onTransactions([e])}catch(e){r.onError?.(e)}},{emitOnBegin:!0,interval:s});return async()=>{i&&await (0,Q.s)(e,em,"uninstallFilter")({filter:i}),n()}}):(a=!0,o=()=>a=!1,(async()=>{try{let{unsubscribe:t}=await e.transport.subscribe({params:["newPendingTransactions"],onData(e){if(!a)return;let t=e.result;i([t])},onError(e){r?.(e)}});o=t,a||o()}catch(e){r?.(e)}})(),()=>o())}var ey=r(81946);function ew(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){let r,i;if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)&&Array.isArray(t)){if((r=e.length)!==t.length)return!1;for(i=r;0!=i--;)if(!ew(e[i],t[i]))return!1;return!0}if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();let n=Object.keys(e);if((r=n.length)!==Object.keys(t).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(t,n[i]))return!1;for(i=r;0!=i--;){let r=n[i];if(r&&!ew(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}var ev=r(14503),eA=r(8998);async function eE(e,{account:t=e.account,message:r}){if(!t)throw new eA.o({docsPath:"/docs/actions/wallet/signMessage"});let i=(0,ev.T)(t);if(i.signMessage)return i.signMessage({message:r});let n="string"==typeof r?(0,x.$G)(r):r.raw instanceof Uint8Array?(0,x.NC)(r.raw):r.raw;return e.request({method:"personal_sign",params:[n,i.address]},{retryCount:0})}var eC=r(75230);async function e_(e,t){let r;let{account:i,connector:n,...s}=t;return r="object"==typeof i&&"local"===i.type?e.getClient():await (0,eC.e)(e,{account:i,connector:n}),(0,ey.s)(r,eE,"signMessage")({...s,...i?{account:i}:{}})}var eI=r(41342);async function eS(e,t){let{account:r,chainId:i,...n}=t,s=r??w(e).address,a=e.getClient({chainId:i});return(0,ey.s)(a,eI.ZE,"prepareTransactionRequest")({...n,...s?{account:s}:{}})}var eN=r(33310);async function eT(e,t){let r;let{account:i,chainId:n,connector:s,...a}=t;r="object"==typeof i&&i?.type==="local"?e.getClient({chainId:n}):await (0,eC.e)(e,{account:i??void 0,chainId:n,connector:s});let o=(0,ey.s)(r,eN.T,"sendTransaction");return await o({...a,...i?{account:i}:{},chain:n?{id:n}:null,gas:a.gas??void 0})}var eP=r(95946),ex=r(79814),eO=r(33639),eR=r(15116),ek=r(68240),eD=r(6073);async function eM(e,{blockHash:t,blockNumber:r,blockTag:i,hash:n,index:s}){let a=i||"latest",o=void 0!==r?(0,x.eC)(r):void 0,c=null;if(n?c=await e.request({method:"eth_getTransactionByHash",params:[n]},{dedupe:!0}):t?c=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,(0,x.eC)(s)]},{dedupe:!0}):(o||a)&&(c=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[o||a,(0,x.eC)(s)]},{dedupe:!!o})),!c)throw new eO.Bh({blockHash:t,blockNumber:r,blockTag:a,hash:n,index:s});return(e.chain?.formatters?.transaction?.format||eD.Tr)(c)}let eU={"0x0":"reverted","0x1":"success"};async function eL(e,{hash:t}){let r=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!r)throw new eO.Yb({hash:t});return(e.chain?.formatters?.transactionReceipt?.format||function(e){let t={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(e=>ep(e)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?(0,eP.ly)(e.transactionIndex):null,status:e.status?eU[e.status]:null,type:e.type?eD.c8[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t})(r)}let eB=new Map,ej=new Map;async function e$(e,{cacheKey:t,cacheTime:r=Number.POSITIVE_INFINITY}){let i=function(e){let t=(e,t)=>({clear:()=>t.delete(e),get:()=>t.get(e),set:r=>t.set(e,r)}),r=t(e,eB),i=t(e,ej);return{clear:()=>{r.clear(),i.clear()},promise:r,response:i}}(t),n=i.response.get();if(n&&r>0&&new Date().getTime()-n.created.getTime()`blockNumber.${e}`;async function eq(e,{cacheTime:t=e.cacheTime}={}){return BigInt(await e$(()=>e.request({method:"eth_blockNumber"}),{cacheKey:eF(e.uid),cacheTime:t}))}function ez(e,{emitOnBegin:t=!1,emitMissed:r=!1,onBlockNumber:i,onError:n,poll:s,pollingInterval:a=e.pollingInterval}){let o;return(void 0!==s?s:"webSocket"!==e.transport.type&&("fallback"!==e.transport.type||"webSocket"!==e.transport.transports[0].config.type))?X((0,er.P)(["watchBlockNumber",e.uid,t,r,a]),{onBlockNumber:i,onError:n},i=>et(async()=>{try{let t=await (0,Q.s)(e,eq,"getBlockNumber")({cacheTime:0});if(o){if(t===o)return;if(t-o>1&&r)for(let e=o+1n;eo)&&(i.onBlockNumber(t,o),o=t)}catch(e){i.onError?.(e)}},{emitOnBegin:t,interval:a})):X((0,er.P)(["watchBlockNumber",e.uid,t,r]),{onBlockNumber:i,onError:n},t=>{let r=!0,i=()=>r=!1;return(async()=>{try{let n=(()=>{if("fallback"===e.transport.type){let t=e.transport.transports.find(e=>"webSocket"===e.config.type);return t?t.value:e.transport}return e.transport})(),{unsubscribe:s}=await n.subscribe({params:["newHeads"],onData(e){if(!r)return;let i=(0,eP.y_)(e.result?.number);t.onBlockNumber(i,o),o=i},onError(e){t.onError?.(e)}});i=s,r||i()}catch(e){n?.(e)}})(),()=>i()})}async function eH(e,{confirmations:t=1,hash:r,onReplaced:i,pollingInterval:n=e.pollingInterval,retryCount:s=6,retryDelay:a=({count:e})=>200*~~(1<g(new eO.mc({hash:r})),o):void 0,b=X(d,{onReplaced:i,resolve:p,reject:g},i=>{let o=(0,Q.s)(e,ez,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:n,async onBlockNumber(n){let d=e=>{clearTimeout(m),o(),e(),b()},f=n;if(!h)try{if(u){if(t>1&&(!u.blockNumber||f-u.blockNumber+1ni.resolve(u));return}if(c||(h=!0,await (0,P.J)(async()=>{(c=await (0,Q.s)(e,eM,"getTransaction")({hash:r})).blockNumber&&(f=c.blockNumber)},{delay:a,retryCount:s}),h=!1),u=await (0,Q.s)(e,eL,"getTransactionReceipt")({hash:r}),t>1&&(!u.blockNumber||f-u.blockNumber+1ni.resolve(u))}catch(r){if(r instanceof eO.Bh||r instanceof eO.Yb){if(!c){h=!1;return}try{l=c,h=!0;let r=await (0,P.J)(()=>(0,Q.s)(e,ek.Q,"getBlock")({blockNumber:f,includeTransactions:!0}),{delay:a,retryCount:s,shouldRetry:({error:e})=>e instanceof ex.f});h=!1;let n=r.transactions.find(({from:e,nonce:t})=>e===l.from&&t===l.nonce);if(!n||(u=await (0,Q.s)(e,eL,"getTransactionReceipt")({hash:n.hash}),t>1&&(!u.blockNumber||f-u.blockNumber+1n{i.onReplaced?.({reason:o,replacedTransaction:l,transaction:n,transactionReceipt:u}),i.resolve(u)})}catch(e){d(()=>i.reject(e))}}else d(()=>i.reject(r))}}})});return f}var eW=r(47607);async function eV(e,t){let{chainId:r,timeout:i=0,...n}=t,s=e.getClient({chainId:r}),a=(0,ey.s)(s,eH,"waitForTransactionReceipt"),o=await a({...n,timeout:i});if("reverted"===o.status){let e=(0,ey.s)(s,eM,"getTransaction"),t=await e({hash:o.transactionHash}),r=(0,ey.s)(s,eW.R,"call"),i=await r({...t,data:t.input,gasPrice:"eip1559"!==t.type?t.gasPrice:void 0,maxFeePerGas:"eip1559"===t.type?t.maxFeePerGas:void 0,maxPriorityFeePerGas:"eip1559"===t.type?t.maxPriorityFeePerGas:void 0});throw Error(i?.data?(0,eP.rR)(`0x${i.data.substring(138)}`):"unknown reason")}return{...o,chainId:s.chain.id}}var eG=r(82693),eK=r(16693),eQ=r(7210),eY=r(55629),eZ=r(47864),eJ=r(61836),eX=r(21746),e0=r(36117),e1=r(97405);function e2(e,t){if(!(e instanceof e0.G))return!1;let r=e.walk(e=>e instanceof e1.Lu);return r instanceof e1.Lu&&(!!(r.data?.errorName==="ResolverNotFound"||r.data?.errorName==="ResolverWildcardNotSupported"||r.data?.errorName==="ResolverNotContract"||r.data?.errorName==="ResolverError"||r.data?.errorName==="HttpError"||r.reason?.includes("Wildcard on non-extended resolvers is not supported"))||"reverse"===t&&r.reason===eX.$[50])}var e3=r(57040),e8=r(15102);function e5(e){if(66!==e.length||0!==e.indexOf("[")||65!==e.indexOf("]"))return null;let t=`0x${e.slice(1,65)}`;return(0,e8.v)(t)?t:null}function e6(e){let t=new Uint8Array(32).fill(0);if(!e)return(0,x.ci)(t);let r=e.split(".");for(let e=r.length-1;e>=0;e-=1){let i=e5(r[e]),n=i?(0,ea.O0)(i):(0,eo.w)((0,ea.qX)(r[e]),"bytes");t=(0,eo.w)((0,e3.zo)([t,n]),"bytes")}return(0,x.ci)(t)}function e4(e){let t=e.replace(/^\.|\.$/gm,"");if(0===t.length)return new Uint8Array(1);let r=new Uint8Array((0,ea.qX)(t).byteLength+2),i=0,n=t.split(".");for(let e=0;e255){var s;t=(0,ea.qX)((s=function(e){let t=new Uint8Array(32).fill(0);return e?e5(e)||(0,eo.w)((0,ea.qX)(e)):(0,x.ci)(t)}(n[e]),`[${s.slice(2)}]`))}r[i]=t.length,r.set(t,i+1),i+=t.length+1}return r.byteLength!==i+1?r.slice(0,i+1):r}var e9=r(88819);async function e7(e,{blockNumber:t,blockTag:r,coinType:i,name:n,gatewayUrls:s,strict:a,universalResolverAddress:o}){let c=o;if(!c){if(!e.chain)throw Error("client chain not configured. universalResolverAddress is required.");c=(0,eZ.L)({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}try{let a=(0,eY.R)({abi:eK.X$,functionName:"addr",...null!=i?{args:[e6(n),BigInt(i)]}:{args:[e6(n)]}}),o={address:c,abi:eK.k3,functionName:"resolve",args:[(0,x.NC)(e4(n)),a],blockNumber:t,blockTag:r},l=(0,Q.s)(e,e9.L,"readContract"),u=s?await l({...o,args:[...o.args,s]}):await l(o);if("0x"===u[0])return null;let d=(0,eQ.k)({abi:eK.X$,args:null!=i?[e6(n),BigInt(i)]:void 0,functionName:"addr",data:u[0]});if("0x"===d||"0x00"===(0,eJ.f)(d))return null;return d}catch(e){if(a)throw e;if(e2(e,"resolve"))return null;throw e}}var te=r(81841);async function tt(e,t){let r;let{chainId:i,connector:n,...s}=t;r=t.account?t.account:(await (0,eC.e)(e,{account:t.account,chainId:i,connector:n})).account;let a=e.getClient({chainId:i});return(0,ey.s)(a,te.Q,"estimateGas")({...s,account:r})}let tr=[];function ti(e){let t=[...e.state.connections.values()];return"reconnecting"===e.state.status||ew(tr,t)?tr:(tr=t,t)}async function tn(e,t){let r;if((r="function"==typeof t.connector?e._internal.connectors.setup(t.connector):t.connector).uid===e.state.current)throw new O.wi;try{e.setState(e=>({...e,status:"connecting"})),r.emitter.emit("message",{type:"connecting"});let{connector:i,...n}=t,s=await r.connect(n),a=s.accounts;return r.emitter.off("connect",e._internal.events.connect),r.emitter.on("change",e._internal.events.change),r.emitter.on("disconnect",e._internal.events.disconnect),await e.storage?.setItem("recentConnectorId",r.id),e.setState(e=>({...e,connections:new Map(e.connections).set(r.uid,{accounts:a,chainId:s.chainId,connector:r}),current:r.uid,status:"connected"})),{accounts:a,chainId:s.chainId}}catch(t){throw e.setState(e=>({...e,status:e.current?"connected":"disconnected"})),t}}var ts=r(51785),ta=r(88972);async function to(e,{address:t,blockNumber:r,blockTag:i,gatewayUrls:n,strict:s,universalResolverAddress:a}){let o=a;if(!o){if(!e.chain)throw Error("client chain not configured. universalResolverAddress is required.");o=(0,eZ.L)({blockNumber:r,chain:e.chain,contract:"ensUniversalResolver"})}let c=`${t.toLowerCase().substring(2)}.addr.reverse`;try{let s={address:o,abi:eK.du,functionName:"reverse",args:[(0,x.NC)(e4(c))],blockNumber:r,blockTag:i},a=(0,Q.s)(e,e9.L,"readContract"),[l,u]=n?await a({...s,args:[...s.args,n]}):await a(s);if(t.toLowerCase()!==u.toLowerCase())return null;return l}catch(e){if(s)throw e;if(e2(e,"reverse"))return null;throw e}}class tc extends e0.G{constructor({data:e}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(e)}`],name:"EnsAvatarInvalidMetadataError"})}}class tl extends e0.G{constructor({reason:e}){super(`ENS NFT avatar URI is invalid. ${e}`,{name:"EnsAvatarInvalidNftUriError"})}}class tu extends e0.G{constructor({uri:e}){super(`Unable to resolve ENS avatar URI "${e}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class td extends e0.G{constructor({namespace:e}){super(`ENS NFT avatar namespace "${e}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}let th=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,tf=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?[\w\-.]+))?(?\/.*)?$/,tp=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,tg=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function tm(e){try{let t=await fetch(e,{method:"HEAD"});if(200===t.status){let e=t.headers.get("content-type");return e?.startsWith("image/")}return!1}catch(t){if("object"==typeof t&&void 0!==t.response||!globalThis.hasOwnProperty("Image"))return!1;return new Promise(t=>{let r=new Image;r.onload=()=>{t(!0)},r.onerror=()=>{t(!1)},r.src=e})}}function tb(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function ty({uri:e,gatewayUrls:t}){let r=tp.test(e);if(r)return{uri:e,isOnChain:!0,isEncoded:r};let i=tb(t?.ipfs,"https://ipfs.io"),n=tb(t?.arweave,"https://arweave.net"),s=e.match(th),{protocol:a,subpath:o,target:c,subtarget:l=""}=s?.groups||{},u="ipns:/"===a||"ipns/"===o,d="ipfs:/"===a||"ipfs/"===o||tf.test(e);if(e.startsWith("http")&&!u&&!d){let r=e;return t?.arweave&&(r=e.replace(/https:\/\/arweave.net/g,t?.arweave)),{uri:r,isOnChain:!1,isEncoded:!1}}if((u||d)&&c)return{uri:`${i}/${u?"ipns":"ipfs"}/${c}${l}`,isOnChain:!1,isEncoded:!1};if("ar:/"===a&&c)return{uri:`${n}/${c}${l||""}`,isOnChain:!1,isEncoded:!1};let h=e.replace(tg,"");if(h.startsWith("e.json());return await tA({gatewayUrls:e,uri:tw(r)})}catch{throw new tu({uri:t})}}async function tA({gatewayUrls:e,uri:t}){let{uri:r,isOnChain:i}=ty({uri:t,gatewayUrls:e});if(i||await tm(r))return r;throw new tu({uri:t})}async function tE(e,{nft:t}){if("erc721"===t.namespace)return(0,e9.L)(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if("erc1155"===t.namespace)return(0,e9.L)(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new td({namespace:t.namespace})}async function tC(e,{gatewayUrls:t,record:r}){return/eip155:/i.test(r)?t_(e,{gatewayUrls:t,record:r}):tA({uri:r,gatewayUrls:t})}async function t_(e,{gatewayUrls:t,record:r}){let i=function(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));let[r,i,n]=t.split("/"),[s,a]=r.split(":"),[o,c]=i.split(":");if(!s||"eip155"!==s.toLowerCase())throw new tl({reason:"Only EIP-155 supported"});if(!a)throw new tl({reason:"Chain ID not found"});if(!c)throw new tl({reason:"Contract address not found"});if(!n)throw new tl({reason:"Token ID not found"});if(!o)throw new tl({reason:"ERC namespace not found"});return{chainID:Number.parseInt(a),namespace:o.toLowerCase(),contractAddress:c,tokenID:n}}(r),{uri:n,isOnChain:s,isEncoded:a}=ty({uri:await tE(e,{nft:i}),gatewayUrls:t});if(s&&(n.includes("data:application/json;base64,")||n.startsWith("{")))return tA({uri:tw(JSON.parse(a?atob(n.replace("data:application/json;base64,","")):n)),gatewayUrls:t});let o=i.tokenID;return"erc1155"===i.namespace&&(o=o.replace("0x","").padStart(64,"0")),tv({gatewayUrls:t,uri:n.replace(/(?:0x)?{id}/,o)})}async function tI(e,{blockNumber:t,blockTag:r,name:i,key:n,gatewayUrls:s,strict:a,universalResolverAddress:o}){let c=o;if(!c){if(!e.chain)throw Error("client chain not configured. universalResolverAddress is required.");c=(0,eZ.L)({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}try{let a={address:c,abi:eK.k3,functionName:"resolve",args:[(0,x.NC)(e4(i)),(0,eY.R)({abi:eK.nZ,functionName:"text",args:[e6(i),n]})],blockNumber:t,blockTag:r},o=(0,Q.s)(e,e9.L,"readContract"),l=s?await o({...a,args:[...a.args,s]}):await o(a);if("0x"===l[0])return null;let u=(0,eQ.k)({abi:eK.nZ,functionName:"text",data:l[0]});return""===u?null:u}catch(e){if(a)throw e;if(e2(e,"resolve"))return null;throw e}}async function tS(e,{blockNumber:t,blockTag:r,assetGatewayUrls:i,name:n,gatewayUrls:s,strict:a,universalResolverAddress:o}){let c=await (0,Q.s)(e,tI,"getEnsText")({blockNumber:t,blockTag:r,key:"avatar",name:n,universalResolverAddress:o,gatewayUrls:s,strict:a});if(!c)return null;try{return await tC(e,{record:c,gatewayUrls:i})}catch{return null}}async function tN(e,t={}){let r;if(t.connector)r=t.connector;else{let{connections:t,current:i}=e.state,n=t.get(i);r=n?.connector}let i=e.state.connections;r&&(await r.disconnect(),r.emitter.off("change",e._internal.events.change),r.emitter.off("disconnect",e._internal.events.disconnect),r.emitter.on("connect",e._internal.events.connect),i.delete(r.uid)),e.setState(e=>{if(0===i.size)return{...e,connections:new Map,current:null,status:"disconnected"};let t=i.values().next().value;return{...e,connections:new Map(i),current:t.connector.uid}});{let t=e.state.current;if(!t)return;let r=e.state.connections.get(t)?.connector;if(!r)return;await e.storage?.setItem("recentConnectorId",r.id)}}async function tT(e,t){let{addEthereumChainParameter:r,chainId:i}=t,n=e.state.connections.get(t.connector?.uid??e.state.current);if(n){let e=n.connector;if(!e.switchChain)throw new D({connector:e});return await e.switchChain({addEthereumChainParameter:r,chainId:i})}let s=e.chains.find(e=>e.id===i);if(!s)throw new O.X4;return e.setState(e=>({...e,chainId:i})),s}var tP=r(48120),tx=r(15229);let tO=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]);function tR(e){var t;let r;return t=function(e){let t=0;function r(){return e[t++]<<8|e[t++]}let i=r(),n=1,s=[0,1];for(let e=1;e>--c&1}let d=2147483648-1,h=0;for(let e=0;e<31;e++)h=h<<1|u();let f=[],p=0,g=2147483648;for(;;){let e=Math.floor(((h-p+1)*n-1)/g),t=0,r=i;for(;r-t>1;){let i=t+r>>>1;e>>1|u(),a=a<<1^1073741824,o=(1073741824^o)<<1|1073741825;p=a,g=1+o-a}let m=i-4;return f.map(t=>{switch(t-m){case 3:return m+65792+(e[o++]<<16|e[o++]<<8|e[o++]);case 2:return m+256+(e[o++]<<8|e[o++]);case 1:return m+e[o++];default:return t-1}})}(function(e){let t=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((e,r)=>t[e.charCodeAt(0)]=r);let r=e.length,i=new Uint8Array(6*r>>3);for(let n=0,s=0,a=0,o=0;n=8&&(i[s++]=o>>(a-=8));return i}(e)),r=0,()=>t[r++]}function tk(e,t=0){let r=[];for(;;){let i=e(),n=e();if(!n)break;t+=i;for(let e=0;e{let t=tk(e);if(t.length)return t})}function tM(e){let t=[];for(;;){let r=e();if(0==r)break;t.push(function(e,t){let r=1+t(),i=t(),n=tU(t);return tL(n.length,1+e,t).flatMap((e,t)=>{let[s,...a]=e;return Array(n[t]).fill().map((e,t)=>{let n=t*i;return[s+t*r,a.map(e=>e+n)]})})}(r,e))}for(;;){let r=e()-1;if(r<0)break;t.push(tL(1+e(),1+r,e).map(e=>[e[0],e.slice(1)]))}return t.flat()}function tU(e){let t=[];for(;;){let r=e(t.length);if(!r)break;t.push(r)}return t}function tL(e,t,r){let i=Array(e).fill().map(()=>[]);for(let n=0;n>1:i>>1}return r})(e,r).forEach((e,t)=>i[t].push(e));return i}function tB(e){return`{${e.toString(16).toUpperCase().padStart(2,"0")}}`}function tj(e){let t=e.length;if(t<4096)return String.fromCodePoint(...e);let r=[];for(let i=0;i>24&255}function tq(e){return 16777215&e}function tz(e){return e>=44032&&e<55204}function tH(e){n||function(){let e=tR("AEUDVgHLCGMATwDUADIAdAAhADQAFAAtABQAIQAPACcADQASAAoAGAAJABIACQARAAUACwAFAAwABQAQAAMABwAEAAoABQAJAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACwANAA0AAwAKAAkABAAdAAYAZwDTAeYDMwCxCl8B8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgPi89uj00MsvBXxEPAGPCDwBnQKoEbwRwBHEEcgRzBHQEdQR2BHcEeAR6BHsEfAR+BIAEgfndBQoBYgULAWIFDAFiBNcE2ATZBRAFEQUvBdALFAsVDPcNBw13DYcOMA4xDjMB4BllHI0B2grbAMDpHLkQ7QHVAPRNQQFnGRUEg0yEB2uaJF8AJpIBpob5AERSMAKNoAXqaQLUBMCzEiC+AZ4EWRJJFbEu7QDQLARtEbgECxDwAb/RyAk1AV4nD2cEQQKTAzsAGpobWgAahAGPCrysdy0OAKwAfFIcBAQFUmoA/PtZADkBIadVj2UMUgx5Il4ANQC9vAITAdQZWxDzALN9AhsZVwIcGSkCBAgXOhG7AqMZ4M7+1M0UAPDNAWsC+mcJDe8AAQA99zkEXLICyQozAo6lAobcP5JvjQLFzwKD9gU/OD8FEQCtEQL6bW+nAKUEvzjDHsuRyUvOFHcacUz5AqIFRSE2kzsBEQCuaQL5DQTlcgO6twSpTiUgCwIFCAUXBHQEqQV6swAVxUlmTmsCwjqsP/wKJQmXb793UgZBEBsnpRD3DDMBtQE7De1L2ATxBjsEyR99GRkPzZWcCKUt3QztJuMuoYBaI/UqgwXtS/Q83QtNUWgPWQtlCeM6Y4FOAyEBDSKLCt0NOQhtEPMKyWsN5RFFBzkD1UmaAKUHAQsRHTUVtSYQYqwLCTl3Bvsa9guPJq8TKXr8BdMaIQZNASka/wDPLueFsFoxXBxPXwYDCyUjxxSoUCANJUC3eEgaGwcVJakCkUNwSodRNh6TIfY8PQ1mLhNRfAf1PAUZTwuBPJ5Gq0UOEdI+jT1IIklMLAQ1fywvJ4sJzw+FDLl8cgFZCSEJsQxxEzERFzfFCDkHGS2XJCcVCCFGlWCaBPefA/MT0QMLBT8JQQcTA7UcLRMuFSkFDYEk1wLzNtUuswKPVoABFwXLDyUf3xBQR+AO6QibAmUDgyXrAC0VIQAXIpsIQ2MAX4/YUwUuywjHamwjdANnFOdhEXMHkQ5XB6ccMxW/HOFwyF4Lhggoo68JWwF1CZkBXwTjCAk1W4ygIEFnU4tYGJsgYUE/XfwCMQxlFZ9EvYd4AosPaxIbATUBcwc5DQECdxHtEWsQlQjrhgQ1tTP4OiUETyGDIBEKJwNPbM4LJyb5DPhpAaMSYgMMND137merYLYkF/0HGTLFQWAh8QuST80MnBrBGEJULhnkB78D8xrzJ+pBVwX/A6MDEzpNM+4EvQtpCIsJPwBJDqMXB9cYagpxjNABMYsBt5kDV5GDAm+PBjcHCwBnC4cFeeUAHQKnCKMABQDPA1cAOQKtB50AGQCFQQE9AycvASHlAo8DkwgxywGVLwHzKQQbwwwVAPc3bkoCw7ECgGpmogXdWAKOAkk1AU0lBAVOR1EDr3HhANsASwYT30cBFatKyxrjQwHfbysAxwD7AAU1BwVBAc0B820AtwFfCzEJorO1AU3pKQCDABVrAdcCiQDdADUAf/EBUwBNBVn5BdMCT0kBETEYK1dhAbsDHwEzAQ0AeQbLjaXJBx8EbQfTAhAbFeEC7y4HtQEDIt8TzULFAr3eVaFgAmSBAmJCW02vWzcgAqH3AmiYAmYJAp+EOBsLAmY7AmYmBG4EfwN/EwN+kjkGOXcXOYI6IyMCbB0CMjY4CgJtxwJtru+KM2dFKwFnAN4A4QBKBQeYDI0A/gvCAA21AncvAnaiPwJ5S0MCeLodXNtFrkbXAnw/AnrIAn0JAnzwBVkFIEgASH1jJAKBbQKAAAKABQJ/rklYSlsVF0rMAtEBAtDMSycDiE8Dh+ZExZEyAvKhXQMDA65LzkwtJQPPTUxNrwKLPwKK2MEbBx1DZwW3Ao43Ao5cQJeBAo7ZAo5ceFG0UzUKUtRUhQKT+wKTDADpABxVHlWvVdAGLBsplYYy4XhmRTs5ApefAu+yWCGoAFklApaPApZ8nACpWaxaCYFNADsClrUClk5cRFzRApnLAplkXMpdBxkCnJs5wjqdApwWAp+bAp64igAdDzEqDwKd8QKekgC1PWE0Ye8CntMCoG4BqQKenx8Cnk6lY8hkJyUrAievAiZ+AqD7AqBMAqLdAqHEAqYvAqXOAqf/AH0Cp/JofGixAANJahxq0QKs4wKsrgKtZwKtAgJXHQJV3AKx4dcDH05slwKyvQ0CsugXbOBtY21IXwMlzQK2XDs/bpADKUUCuF4CuUcVArkqd3A2cOECvRkCu9pwlgMyEQK+iHICAzNxAr4acyJzTwLDywLDBHOCdEs1RXTgAzynAzyaAz2/AsV8AsZHAsYQiQLIaVECyEQCyU8CyS4CZJ0C3dJ4eWF4rnklS9ADGKNnAgJh9BnzlSR7C16SXrsRAs9rAs9sL0tT0vMTnwDGrQLPcwEp6gNOEn5LBQLcJwLbigLSTwNSXANTXwEBA1WMgIk/AMsW7WBFghyC04LOg40C2scC2d6EEIRJpzwDhqUALwNkDoZxWfkAVQLfZQLeuHN3AuIv7RQB8zAnAfSbAfLShwLr8wLpcHkC6vkC6uQA+UcBuQLuiQLrnJaqlwMC7j8DheCYeXDgcaEC8wMAaQOOFpmTAvcTA5FuA5KHAveYAvnZAvhmmhyaq7s3mx4DnYMC/voBGwA5nxyfswMFjQOmagOm2QDRxQMGaqGIogUJAwxJAtQAPwMA4UEXUwER8wNrB5dnBQCTLSu3r73bAYmZFH8RBDkB+ykFIQ6dCZ8Akv0TtRQrxQL3LScApQC3BbmOkRc/xqdtQS4UJo0uAUMBgPwBtSYAdQMOBG0ALAIWDKEAAAoCPQJqA90DfgSRASBFBSF8CgAFAEQAEwA2EgJ3AQAF1QNr7wrFAgD3Cp8nv7G35QGRIUFCAekUfxE0wIkABAAbAFoCRQKEiwAGOlM6lI1tALg6jzrQAI04wTrcAKUA6ADLATqBOjs5/Dn5O3aJOls7nok6bzkYAVYBMwFsBS81XTWeNa01ZjV1NbY1xTWCNZE10jXhNZ41rTXuNf01sjXBNgI2ETXGNdU2FjYnNd417TYuNj02LjUtITY6Nj02PDbJNwgEkDxXNjg23TcgNw82yiA3iTcwCgSwPGc2JDcZN2w6jTchQtRDB0LgQwscDw8JmyhtKFFVBgDpfwDpsAD+mxQ91wLpNSMArQC9BbeOkRdLxptzBL8MDAMMAQgDAAkKCwsLCQoGBAVVBI/DvwDz9b29kaUCb0QtsRTNLt4eGBcSHAMZFhYZEhYEARAEBUEcQRxBHEEcQRxBHEEaQRxBHEFCSTxBPElISUhBNkM2QTYbNklISVmBVIgELgEaJZkC7aMAoQCjBcGOmxdNxrsBvwGJAaQcEZ0ePCklMAAhMvAIMAL54gC7Bm8EescjzQMpARQpKgDUHqSvAj5Gqwr7YrMUACT9AN3rlr3JG9m8w9lIAXltp/v8kfWaIaaR9OwpAES/I3ZVamDXSgB/UsOgAG6D0tq+5CIqE15FiAhV3yA2VhCQ7tj+m6xXaF53FIfGi/IAZIskMGAi2MU7MDVJNCbMzERyHZi+osdPtnFVbvq653O8rwaCy4IAf9OOok65AqJUtUriUfYsGPPVbe6jm0s9lbKlPCUKjdkHsFsEhvX4kT39ZCtAAbwQdn/h4TpO5hTByWAmr5n+Wuwhdegv6bmvX4LyOes3z2+cuHv2JFYwVMNuq2gzn8YHTjlUQd39osyWei4NKl3LAdfxlO876hh5ENp/cOvpuI9bF55guEthLLPOXjD4dktTH04P5TvZrWTM0e4+BHJxj7MLApXIFOs0sWKhNkG8iwuM5wR83my6V3wW06abhDzTXYfOr/ZpFXgXzmv4d12FFyP00/dPGbIVGV5ao8UufGzUwp/IHx6v/wDWJr9iaoCulhWwlZ7A8q/NMoD12+mBdNRgJYnThRLtMx1Bgwttn8/4Qn2CDfOSup9GVXEvA21ILgp0owHYxNOkpwLWz0G7K+WREIDjIzUzSn8I99CuJSmSpPyH0Ke6/NERYiNx+3dncSebPnOUnnWD61AhJ1n/tSLZmU5wYO5GfgzyAYJm6VL91LxZ8hL1lfximQxIDMRhIecQZBmeE5R0XlrpvwplVrJwpa8BBCdp93GPP9lyBeZ2zkRr920CR3cYbKpKHfogvm0nV7XdDz6EbjzlxADCMjSLXuXpIpyuizy39yY+I+H9rmpoIF3YwEjlH9MgGgWcCNTjHEWMqAbprn2Ox7rOHupaVE3lNyg3nt5XaZID6Y+uml5Ja+aOPu+BI+DZbiJVfaspUadakWUX6TA4dETkIqdJJHYnU4Z4yKpt5y8rVIahoMUf8A8kWtAQNCTbjp71gx3/zVdqNz1Sutkw0gFIMVm2BF4Xdv/0olw+NaDIR9Bb3DPweZA2K/cw+/b+AwyWl9ZOP67A9nexmeTNjfdzPGf9J6E6BMPKa5lJh+qNsdUz3HBUevU71eQFCqOcxiIYhacAhh/8PX0J5DdSViZ6WazDDx7cukJNpMfEkYLJ5Ao4vLoVd3d25Pg4qaVa2p2D2L3WvYPJ5Yf/A/MSxptjlgXL/KJtP2U0cRv2I09ATAiWCJYuRwiapeKFsqmi18yMMulDp3HdcIldq+7jkwsJUOHLHCzzzBw5XFvL0CAmo1ub456z7zb7shk3KPGCLZzr47oT1k/j06XNnJvG3Udv6XrP+wsqTBlZ5MaNPt9FOs/4Bt/ja/vbVhTNpBFl9Gq7MqINvGlWKOAwQzwOZy+EzSdjAqKJVV2YcskTuM94aIK+kc/AZaXiZLPREUDpkXIV947IFfj+85TrqPqLfkGcxgboMQjosf+az+odLNXdyp1mDNGsqSdK/pJ2Ca04mt/4d6s1X+lncOEYaGBBeW4pApGcjf7/XJCFbj3N3mFb+BtlIcw8ZiDKoClFX9Rf0bxCqtLpicObKJzBVVHr/6u4siH2hK75RNv7w9GfTbhJOQBYiFUZAByY4rn37tZBHT//kqKsNi3ryL9AqXJRzqiMIJMhILjoi/i8LVEsbu+Ih9bsyW16sgQqjYLO0qda6KaCPKj3DQcu6CfV5lKtjS3ZCdqLAZkOey9MR+QutJBGiz/r15GVD6rCVwJR4UUKC4GNJkfDf00OMW8aQtLSAGLXV8MIi9mbbl/qQEpxCm2L5hutFX4ekeLH4QgBWUFKs/2VVMKy46WtFE6AbwgmYm/Z0yHk5veDIrcl2HpVqb/rSE0PC9EbDzJEWqeaPhh7vF369Umq2kSiB3s5rBI6c/7N9bkRu4h2n+/h5nSwy+7n+/I+6oXQVANo2Jb5zDwtiBPf1ySCzHdT6yJShMzqSRZfnykX49CaFaxhoVF4PBhEuECJ1PrFYSpmHuyYsl14DTAV9ZxRms1XiR/kBrjhZjidOt0UNe+GSml7XNgpVw8YsUTmZXLTK+6iYnyW/wYR1W4UXwOi14xpFROHb6HcZzksgF5DbL2AFXzKNwHU2adjdAY+KCyM/cwRTBkkq/a227NI0q6DR2MkMCRu620t79bGcYUmACtqN3mk/0uNwd3JSXHqE1kzf6Yyj0W2083JNDRnIXDlgBxJ6uf58NN1f6FQiRCWB4egF8QDx74AixV8oTyw7PluIjr3/rj/WzgwPSq4xPojaF7V0xqG2u5ti2L1h6yYHv73Isrukr0kURDIEjClBsBx7kdcXUxaYMS0syT3ymLzDzslNDWQOT1Tao1YNmJHARUenhCkmV9tqCPGI5GqZaRpkiPxyjoncWjyOHYGqvbvRX+Bn1pn7EhRNXa1lqJPmoeN5VqdqIDPhEVhFsyG0d4iQEIYX0wZUbY2XbZWYlpZ/l66IrDDY0q1C1YzBDpHC4h05YqHQLqS9anyl22JQ6lEvjvdBwMHfE7z0luCXD34/rFeDa2TmSeEAykSpYO5j1G/nsgpR3qn0qaQEmLjnnLfcz+veoYqPnRqmRGwCJ6FJ3Gm/Z1/aVX5PSb03MMnjAf41ww54sD5k8FrkfBP+K0b1MrYpapWjtpZfve2HVf4ickX3LKSOhu7qI1Vd4c1kNrn2ajy1t4y93JhV4fnWCKq7OmFpcr7FjdJCXPTql0Drr14Ho3Z87+GPQ4Z/DcTiGqtvZxlRYi8cNuhXABveZIwNl/BX1huhVLaFax5OqypUrQRyb9OE3SSkPlDdy5uo5XGg2EIGEjLY1MO5cr1ibfiFWV7zspcTgkBKkwo5jPyAin04LqizZXb2tDRgwKJjGx4cVk3ngAQixwcxjYAg2Q7vmUR/hpwInMdw7OhC2qyf41vTPkudQAORS0DdLtOGQxb4fH2VYGsvJCkeWPeUwtf1/tuIhzXEThoCZzzSJqqjUtbaPI3ntHm3T5uf849hGUA0zU8ni5W+EEn3/0Y6oUhQFw9z0aGjkljBbAlFXc0y82G2wkd7VdgWa5KTgJJNjNwZMfmdnUIUn1JU5LiWX5UZEZbVlKSN76mlmjUR2ku+fucTNlO4IAAahnLjBhlvQNR9pe9swGBgq0YR7P3VCyI/seYwQ4QBzy9X+HPePgoF8WfKaJ4MBOhLCGHae6Z8xkNXwni9QAKvTNtVA56x8YJflZ/VvONRSlsSLmiSyNMnTjTaE1ko81zkzGEnVwEhjCzlwIqpxmpDAqwsEmtpdr3xpc7i/ZX3f2TzT3M0FdxIEQvO1jgmmiN+D1YpMduAzEhBtj2OBkMN/rv6p7Th4pSH6f5aH3aTvwFTl7EOSgGASI7ttyMehzpm4AVyK+bFEaFg9gnZsSUPpsbAe/0RFhrH+EXZ12Z7thf4dzN1+Sn+G8QrDA1VKaN4IFxD1rQz9Xq9Coii9S9/hPbTGjyBwFH3H1UdQuz5KsgPDEHua4/kPg2Gp/IIItsaLWBqiT9XH45MiQxSosGJ56H/0F2cjcCFd72l1665RNHURdC3lspI77esfJsl+rXXabkAy7vxDXG/XGGcKpwiKDPFfvMEgjkAHil4Za1F36RnyxxvdIAzvgfH8knukYDck07tc++DP4TdWeI7HXuq5Yl6VVFrUQtf64/dkXewlKZSHQo6YvCSpREB0GDrz+Ys2GfO8nw2SwrYwaf88AifzlPvP17bf1mI3AuccJvAjZIpBmqvharKFAebEjVKfGAwpQjWoXlm9LROsq9bCk1UeQ3CJxJqprzssS/Q04JeS1ReCCubL3J7sx86spkP4eNpp95UF+8K748icIs8vdILFklk9skQqi1So6cx3X906pvy1vz+KipTJ8fiVJxsV5MmT0XwA");for(let[t,r]of(n=new Map(tD(e).flatMap((e,t)=>e.map(e=>[e,t+1<<24]))),s=new Set(tk(e)),a=new Map,o=new Map,tM(e))){if(!s.has(t)&&2==r.length){let[e,i]=r,n=o.get(e);n||(n=new Map,o.set(e,n)),n.set(i,t)}a.set(t,r.reverse())}}();let t=[],r=[],i=!1;function c(e){let r=n.get(e);r&&(i=!0,e|=r),t.push(e)}for(let i of e)for(;;){if(i<128)t.push(i);else if(tz(i)){let e=i-44032,t=e/588|0,r=e%588/28|0,n=e%28;c(4352+t),c(4449+r),n>0&&c(4519+n)}else{let e=a.get(i);e?r.push(...e):c(i)}if(!r.length)break;i=r.pop()}if(i&&t.length>1){let e=tF(t[0]);for(let r=1;r0&&n>=e)0==e?(t.push(i,...r),r.length=0,i=a):r.push(a),n=e;else{let s=function(e,t){if(e>=4352&&e<4371&&t>=4449&&t<4470)return 44032+(e-4352)*588+(t-4449)*28;if(tz(e)&&t>4519&&t<4547&&(e-44032)%28==0)return e+(t-4519);{let r=o.get(e);return r&&(r=r.get(t))?r:-1}}(i,a);s>=0?i=s:0==n&&0==e?(t.push(i),i=a):(r.push(a),n=e)}}return i>=0&&t.push(i,...r),t}(tH(e))}let tV=e=>Array.from(e);function tG(e,t){return e.P.has(t)||e.Q.has(t)}class tK extends Array{get is_emoji(){return!0}}function tQ(){let e,t;if(c)return;let r=tR("AEkU4AngDVgB0QKRAQYBOwDqATEAnwDbAIUApABsAOAAbwCRAEYAiQBPAHYAPgA+ACsANwAlAGMAHwAvACsAJQAWAC8AGwAiACIALwAUACsAEQAiAAsAGwARABcAGAA6ACkALAAsADUAFgAsABEAHQAhAA8AGwAdABUAFgAZAA0ADQAXABAAGQAUABIEqgYJAR4UFjfDBdMAsQCuPwFnAKUBA10jAK5/Ly8vLwE/pwUJ6/0HPwbkMQVXBVgAPSs5APa2EQbIwQuUCkEDyJ4zAsUKLwKOoQKG2D+Ob4kCxcsCg/IBH98JAPKtAUECLY0KP48A4wDiChUAF9S5yAwLPZ0EG3cA/QI5GL0P6wkGKekFBIFnDRsHLQCrAGmR76WcfwBbBpMjBukAGwA7DJMAWxVbqfu75wzbIM8IuykDsRQ7APcta6MAoX0YABcEJdcWAR0AuRnNBPoJIEw3CZcJiB4bVllM44NCABMADAAVAA5rVAAhAA4AR+4V2D3zOVjKleYuChAdX01YPewAEwAMABUADmsgXECXAMPrABsAOQzFABsVW6n7Adq4HB0FWwXiAtCfAsSwCkwcpGUUcxptTPUAuw1nAuEACy00iRfJkQKBewETGwC9DWcC4QALLQFIUCWRTAoDLfsFMgnXaRetAddDAEkrEncCMRYhAusnuTdrADnhAfUlAMcOy7UBG2OBALEFAAUAitNJBRvDHwcXAKgn0QGhKy0DmwBnAQoZPu03dAQYFwCqAccCIQDTKxJzOvNQsAWQOncnNUgF+icFWQVYr7gFaTtdQhI6WEGXe5NmX6H4CxMDxQcl8XcjBKNLAlNTAnUbqycBj6OlNVsDRRcEg2EJANEGqz8vIwcpAjldAGsBYR9xAIMdGQCVAUm3ACdpFwGvxQM3LSFDUwFvWQZlAmUA8UkXAykBBQBJQQCrAF0AcwArtQYH8+8ZjX8ACSEAKQCzG0cB0QHbBwsxl3iB6AAKABEANAA9ADgzd3nTwBBfEFwBTQlMbDoVCwKsD6YL5REVDNEqy9PYADSpB+sDUwfrA1MDUwfrB+sDUwfrA1MDUwNTA1McCvAa08AQXw9IBG0FjgWLBNYIgyZJEYEHKAjSVA10HhxHA0UA/CMlSRw7kzMLJUJMDE0DB/w2QmynfTgDRzGrVPWQogPLMk85bAEecRKgACoPcxw1tU5+ekdxoApLT661f0liTmcCvjqoP/gKIQmTb7t3TgY9EBcnoRDzDC8BsQE3DelL1ATtBjcExR95GRUPyZWYCKEt2QzpJt8unYBWI/EqfwXpS/A82QtJUWQPVQthCd86X4FKAx0BCSKHCtkNNQhpEO8KxWcN4RFBBzUD0UmWAKEG/QsNHTEVsSYMYqgLBTlzBvca8guLJqsTJXr4Bc8aHQZJASUa+wDLLuOFrFotXBhPWwX/CyEjwxSkUBwNIUCzeEQaFwcRJaUCjUNsSoNRMh6PIfI8OQ1iLg9ReAfxPAEZSwt9PJpGp0UKEc4+iT1EIkVMKAQxeywrJ4cJyw+BDLV8bgFVCR0JrQxtEy0REzfBCDUHFSmXICcRCB1GkWCWBPObA+8TzQMHBTsJPQcPA7EcKRMqFSUFCYEg0wLvNtEurwKLVnwBEwXHDyEf2xBMR9wO5QiXAmEDfyXnACkVHQATIpcIP18AW4/UUwEuxwjDamgjcANjFONdEW8HjQ5TB6McLxW7HN1wxF4HhgQon6sJVwFxCZUBWwTfCAU1V4ycID1nT4tUGJcgXUE7XfgCLQxhFZtEuYd0AocPZxIXATEBbwc1DP0CcxHpEWcQkQjnhgA1sTP0OiEESyF/IA0KIwNLbMoLIyb1DPRlAZ8SXgMINDl36menYLIgF/kHFTLBQVwh7QuOT8kMmBq9GD5UKhngB7sD7xrvJ+ZBUwX7A58POkkz6gS5C2UIhwk7AEUOnxMH0xhmCm2MzAEthwGzlQNTjX8Ca4sGMwcHAGMHgwV14QAZAqMInwABAMsDUwA1AqkHmQAVAIE9ATkDIysBHeECiwOPCC3HAZErAe8lBBe/DBEA8zNuRgLDrQKAZmaeBdlUAooCRTEBSSEEAUpDTQOrbd0A1wBHBg/bQwERp0bHFt8/AdtrJwDDAPcAATEHAT0ByQHvaQCzAVsLLQmer7EBSeUlAH8AEWcB0wKFANkAMQB77QFPAEkFVfUFzwJLRQENLRQnU10BtwMbAS8BCQB1BseJocUDGwRpB88CEBcV3QLvKgexAyLbE8lCwQK92lEAMhIKNAq1CrQfX/NcLwItbj1MAAofpD7DP0oFTTtPO1Q7TztUO087VDtPO1Q7TztUA5O73rveCmhfQWHnDKIN0ETEOkUT12BNYC4TxC2zFL0VyiVSGTkauCcBJeBVBQ8ALc9mLAgoNHEXuAA7KWSDPWOCHiwKRxzjU41U9C0XAK1LnjOrDagbEUQ8BUN16WImFgoKHgJkfQJiPldJq1c3HAKh8wJolAJmBQKfgDgXBwJmNwJmIgRqBHsDfw8Dfo45AjlzEzl+Oh8fAmwZAjIyOAYCbcMCbarrhi9jQScBYwDaAN0ARgEHlAyJAPoHvgAJsQJ3KwJ2njsCeUc/Ani2GVjXRapG0wJ8OwJ6xAJ9BQJ87AVVBRxH/Eh5XyAAJxFJVEpXERNKyALQ/QLQyEsjA4hLA4fiRMGRLgLynVz/AwOqS8pMKSHLTUhNqwKLOwKK1L0XAxk/YwGzAo4zAo5YPJN9Ao7VAo5YdFGwUzEGUtBUgQKT9wKTCADlABhVGlWrVcwCLBcpkYIy3XhiRTc1ApebAu+uWB2kAFUhApaLApZ4mAClWahaBX1JADcClrEClkpcQFzNApnHAplgXMZdAxUCnJc5vjqZApwSAp+XAp60hgAZCy0mCwKd7QKejgCxOWEwYesCns8CoGoBpQKemxsCnkqhY8RkIyEnAierAiZ6AqD3AqBIAqLZAqHAAqYrAqXKAqf7AHkCp+5oeGit/0VqGGrNAqzfAqyqAq1jAqz+AlcZAlXYArHd0wMfSmyTArK5CQKy5BNs3G1fbURbAyXJArZYNztujAMpQQK4WgK5QxECuSZzcDJw3QK9FQK71nCSAzINAr6Ecf4DM20CvhZzHnNLAsPHAsMAc350RzFBdNwDPKMDPJYDPbsCxXgCxkMCxgyFAshlTQLIQALJSwLJKgJkmQLdznh1XXiqeSFLzAMYn2b+AmHwGe+VIHsHXo5etw0Cz2cCz2grR0/O7w+bAMKpAs9vASXmA04OfkcBAtwjAtuGAtJLA1JYA1NbAP0DVYiAhTvHEulcQYIYgs+CyoOJAtrDAtnahAyERac4A4ahACsDZAqGbVX1AFEC32EC3rRvcwLiK+0QAfMsIwH0lwHyzoMC6+8C6Wx1Aur1AurgAPVDAbUC7oUC65iWppb/Au47A4XcmHVw3HGdAvL/AGUDjhKZjwL3DwORagOSgwL3lAL51QL4YpoYmqe3M5saA51/Av72ARcANZ8Yn68DBYkDpmYDptUAzcEDBmahhKIBBQMMRQELARsHaQZdtWMBALcEZ7sNhx6vCQATcTUAHwMvEkkDhXsBXyMdAIzrAB0A5p8Dm40IswYbn8EApwURu+kdPT4WeAVoNz5AK0IhQrRfcRFfvACWxQUyAJBMGZu5OyZgMhG6zw4vGMYYicn2BVcFWAVXBVgFYwVYBVcFWAVXBVgFVwVYBVcFWEYVCNeFZwICAgpkXukrBMkDsQYvu7sAuwSnuwDnQCkWsgVGPmk+cEI/QrZfdTdf6ABYETOrAIz+zGvL/KbnRno9JiMEKxYnNjV+bd9qwfEZwixpAWvXbjAXBV8FasnBybgIz0lbAAAACnxefYu+ADM/gQADFtEG5a0jBQCMwwsDAQ0A5WUdPSQfSkKxQrxBOCNfJ2A2JzgjCcE9CkQ/Qz54PoE+cD5xAolCvElCO1/LTk9qTQosa1QvagtuH1/gMzobCWebCmIjKzwdJkKrQrwrzAHL/F/JDh8uCQgJIn6d32o6LUoXyavJrAllwcvMCmBBXw/lEKMRAJONHUVCJRupbTnOOAozP0M+cEI/HAcKHUxHbFssLVrhvBIKfe0dK0I/HF0ISgkOM1RDQjcEO0OcLAqBGy1CPxv1CFMiIxgwMQAFj2HwXgpxZMlgC2AtI25DYBk5AhseYLMGAmsQZU5gTREBZOdgFWCVYH1gs2BLYJFoFhcGtQ7cVam8WgtDFqsBuyvNwQIfFQAcAx4BeQJsLzCVUoABigq4RxoA5CN0jgrKDaZN6gGbAoecTwVAXwD39wkANBZXDAulDCQfuq9HAE8MNAAVE58rggh6AtILS2URGwDYTgZ1BAoeWgAxALa4AZonCxZvqyQ4nxkBWwGGCfwD2e0PBqoGSga5AB3LValaCbthE4kLLT8OuwG7ASICR1ooKCggHh8hLBImBiEMjQBUAm5XkEmVAW4fD3FHAdN1D85RIBmpsE3qBxEFTF8A9/cKAHoGJGwKKwulODAtx69WDQsAX7wLAGNAlQh6AOpN7yIbvwAxALa4AZonLTsOzgKQGHtQu1jIdHKO16WbDvWZFT0b7AEpEFwSBg8bAccJOhCTBRArDDYLABEAs84BAgCkAOEAmIIABWtXLwAUAFsbxi5sdioNwRACOyQz0+EcHgsbfQJ7Ls6hHATBCqrxbAA3OS0Opge7CQAQOi7OERkAfavaHA+7GkcczaF3HgE9Kl8cAuugCAHCAULz5B9lAb4Jtwz6CDwKPgAFwAs9AksNuwi8DTwKvC7OoSoJPA67BZgBG2sKD4sa4QHDARELuxY7AKALOxC7BBige9wAO2sMPAACpgm8BRvQ9QUBvgH6bsoGewAHuwG7D00RErwBAQDqAQAAdBVbBhbLFPxvF7sYOwAuuwLrDlaouwAeuwJVICp/AAG7AALjAAg7FTwVuwAbuwG9KOClWw6/xAD0AGj7L7ZtvgNIo7vIqDsDAbuVJ0sAAlsACrsEAOfdGbsIGnsIoQUK/3AA37unuxjbGruji3lyBvupm4MAErsGGwsBvAAAhgBtuwYAC7unOwEaO7oIoZzKAbsL7QfAqTsA4XsBvwAA5QAVuwAG+wAJuwBpiwAauwAOuwIYu45pFfsAAVsADmsALkseAAa7ABe7CCEADUoBwgC3ryYBwAAAtAAOmwG+J+QAsloAHBsBv/7hCqEABcYLFRXbAAebAEK7AQIAabsAC3sAHbsACLsJoQAFygBunxnVAJEIIQAFygABOwAH2wAdmwghAAaaAAl7ABsrAG0bAOa7gAAIWwAUuwkhAAbKAOOLAAk7C6EOxPtfAAc7AG6cQEgARwADOwAJrQM3AAcbABl7Abv/Aab7AAobAAo7AAn7p+sGuwAJGwADCwAQOwAAFDsAEWsAD4sADesADbsAGQsGFhsAFTsAbpsWswG7ALoAEzsDAGkrCgDhSwACOwAEUgAXewUbAAbQABi7AAv7AF+7AGv7AOSLAbsAF3YBvAABcguhAAVKHgF7KFIAOUUA/gcNDHIAKCpwAaQFCF4BvF4jDAkHb0tsXyqJHzwUYi02A6EKtAHYABYC0QNuAXZyR1IUIQNPAhU+ASwGA3NGvHtSekAAKQAxAfsAUwrbAHuQLAErAHblDREyRgFKAFcFAAFQAQeKzAB4OwQgpQBaANYVAJVoNx+LAM1rsQDP1BYIwnVzGxhWHQnRAYiQqyJTU01IEjzCifkAfxw3QCkr4BGXTwByASksMClCGQ8DMFUE98XuAEtl3ABqAnECPxF6Osd4LjXVBgUAEBsdCggMKgQfHSlOU04IuboAChLNACYAARoAhgCJAI41AO4AtADgAJ08ALsAqwCmAKEA8gCfANMAnADrAQwBBwDAAHkAWgDLAM0BBwDXAOsAiACiATUA4wDYANUDAQcqM9TU1NS2wNzN0M5DMhcBTQFXL0cBVQFkAWMBVgFHS0NFaA0BThUHCAMyNgwHACINJCYpLDg6Oj09PT4/DkAeUVFRUVNTUlMpVFVXVlYcXWFhYGJhI2ZocG9ycnJycnJ0dHR0dHR0dHR0dHZ2d3Z1WwBA7ABFAJYAdAAuAGLyAIoAUwBTADMCc+kAh//y8gBgAI/sAJsASwBeAGD5+aoAgQCBAGUAUgCtAB4AsgB/AjwCPwD4AOMA+gD6AOQA+wDlAOUA5ADiACkCdwFNATwBOgFQAToBOgE6ATUBNAE0ATQBGAFUDwArCAAATRcKFgMVFg4AigCSAKIASwBkGAItAHAAaQCRAxIDJCoDHkE+RykAiwJLAMMCUwKgALoCkgKSApICkgKSApIChwKSApICkgKSApICkgKRApEClAKcApMCkgKSApACkAKQApACjgKRAnEB0AKTApsCkgKSApEWeQsA+gUDpwJdAjYXAVAQNQLeEQorEwFKNxNNkQF3pDwBZVkA/wM9RwEAAJMpHhiPagApYABpAC4AiQOUzIvwroRaBborDsIRAZ3VdCoLBCMxbAEzWmwBsgDdfoB/foB+gYKCfoOGhH6FiIaAh4KIgol+in6LfoyKjX6Ofo+CkH6RfpJ+k36Ug5WIloKXftoC2WzhAtdsAIJsJGygAINsbARCBD8EQQREBEIESARFBEAERgRIBEcEQwRFBEgAlmZsAKMDh2wAtGYBBWwAyVFsbADPbAIMbAD2WmwA9gEZAPYA9AD0APUA9AN8XmzUhCNlvwD2APQA9AD1APQcbGwAiVpsAPYAiQEZAPYAiQLsAPYAiQN8XmzUhCNlvxxsAPdabAEZAPYA9gD0APQA9QD0APcA9AD0APUA9AN8XmzUhCNlvxxsbACJWmwBGQD2AIkA9gCJAuwA9gCJA3xebNSEI2W/HGwCQwE2bAJKATlsAkvBbGwCV2xsA54C7AOeA54DnwOfA58DnwN8XmzUhCNlvxxsbACJWmwBGQOeAIkDngCJAuwDngCJA3xebNSEI2W/HGwEN2wAiQQ4AIkGjTFtIC9s1m4DJmwA/QDGWgJsbABVWv4UMgJsbACJAmwAVAEAuV5sAmxebGwAiV5sAmxebD3YAEls1gJsbEZFNiJ9FGVAe8xvEZKvxVfKZszAVTBzYBH2d1iyUXEHH7twNw7eZF5JJRHI5EgaRr5D20/3dfONrFLSq5qSrrgd2CEUq722WBQ/LzpA+bx1oREI5xy4BDSZNun0ZWORUJqInZSyMaioyvfSI0l5uFDzbWaQ28/zdB0hwR4OQZ0/jn9ALSLNikjFYGfqR389qtFlhD3a6KdIh97rhZYpywuLc7o8ql5/X8KCbPU3L/QlmCowhRXhsGDvg6wUNprA9bM/49uxlAj7ZVy3ouEY/BgFXBNyK0TLrSjZWeJm/T4nz6QGLT3cJNtWRZVZTvIdtaxMMJRHgig9+S11LjBh7Inr06ykoch1U097Rw0hvgmOrydQyaWcEQDg0RavuMuT0zYabUZl1e33HNSK1oNUCS03eh+9C2EvF3fq9h+XBaAMFuoWeZf+mfZgL4HzyiKDIUtfNU4oFu0aE9qt3VA3U4D3fOSrAcYVnjG3cSkp1vhXZnp3JQm4JknKdBitO2NVnGCYQwU3YMWHWB87NEd+4AHuOKI8BSIH92reW0pfs+kWCTJxDCbRjFv8Cfc4/DSBYJScJYTeAEgg9wTEvcwd/QuHRHqGzAQ4fXf5FUI1lPrO+fvEcPl4JInM1z9AtBT2bL4QYEREe7KiSnnxTwtmAFjn8lqT3mND8qTktX2F16Ae9cakqJ6/pEQsHURqyqWlRMCzKXRKfCHT7sYHWx9/T/ugYTFY6iVN3Btm58ATJR5alYZybKMWojwOw3HbFn23NFyeLl7+Er82RchyYuBoGQ3j7SAWNxiYvp5U+Fq/DEzB9cG5DlJWsqkosRze92OVlCtQEYo1S1lF72Z8xWc4ld/+fFcfTEDTFb9d8tJGQ75dpJEvcWyGmGBiTbiWDdGOcw93Dmxq5ISUrmasygONfHLvhgo83HQZenbdBtSzBkvYrCEQ/xEDMhMZsN6gqplx5jGG9mSQLhM81UEdEeJ59sdNJDAFy/gPyJoKlwPZgB/MkC/kICLiCB8va+nCdO2ry4aDfkmPFpF/H/SGQ3LJ6aAv9dtJ8DniHtLOckZix0BVb0iR5V3LAp521LBSIi6AtV7r2ZB/hQEvAw54EFNOQcFnl1xGUIc67tqK1INNwD2n/RbwgzO9h45LM6VMuN8V1ZNIQ6t+Xy3lTqyVCD5kqLy/t3/b8MLbgDg8JIWDkSZ+LrGhhr+gYpH+pr1TnCUnZPjpUdw6bSL6MWVXoDDciQDWECwU2e6VEpfrcOBbrSOijqGkEIoJPbpmeJLkcwbvA0yWIixQVjo0HnYh7fji+Dfdq1mtV1lG2Zz9R7eFMHS+FK7nybutu2fwzDpFldO2pZBshsHJWaltn3PWOoGJpCT2jE8EHOuC6FkejNWcfsWCqNqMLP9xTwcWArj2EiiI7D+EaDi7/2cqHL1gPiF6C/J7aUo7RQqogPZ11WqbyP97nsoMxPOC78wZMF7B1Y0g7JNXJV/nN1m4xx8hbqWz07KSaqr5hE4icB326DMR/vUKX9LoNjle/ZWtbUhrTAcsdgrLlG5Ne8aiR0bS/2ZhpNOVVxavWIZsEM/rd68EB4vjbbD13NkMK1qvMk74vGbSkL7ULO0sZ9R6APSCo6KH+Xn98wEdw1bCPAnDTaBsD6sidAGN58uiH4a3ovG1KyZAu2XtyGgF/vgWKGxw9R1lfAVcfuYE71DHuxtTzfGZnHaDpDGWmfEq0N4GawE7yIkaoz8jcmVmzJe1ydM8q0p08YIxFcY1YcqQc1djWBEoNETDFcgk5waRftEJasPREkrV++N/TOKkERF1fCLrXS8DFGYGRBeECMQRNEs0ES3FzUtXCcNxpYEM3Uei6XodZruXUIRnn+UXf2b/r7n1vQutoi6WoIbW7svDNWBbUWcDUc7F9SJK3bvSy9KIqhgyJHoW2Kpvv0J4ob14HFXGWWVsYXJzjwxS+SADShTgCRjhoDgjAYRGxwJ1Vonw+cpnCKhz8NQPrb0SFxHIRbmG95Q2hlC4mDxvPBRbkFa60cvWakd7f0kVBxxktzZ9agPJEWyA63RSHYVqt8cPrs2uFJ3rS3k9ETGKn5+A6F9IOrdZHfT1biEyUJKEvwzuscwshGCBJvd16TrefW03xVnJf4xvs72PdxrMidjJO8EiWyN/VWyB3fv9kc34YIuZTFtXGo9DuG3H1Uka5FgBMwDPEvRcSabi3WakNQkXFecJlFk6buLVk5YHpuKWTw6oF632FPPSVIVl5hgUAeHhj0t/sw/PEEvThLQDDFE34eCg/rLOyXT3r+L98oRKrlTO0MdALYQ3rRQqC7d822dJPGxF1K4J2TtfPSMFaCAg0n0NGk9yiaKKOJD1v2aBX9HUOIawjjfvwCmjHZJTR62R9c9x33JnBjWrN4QYEOmehy0oZMP9XM9Zyi6TYoe07PaLceRXcCWZiY/imRUWW6+mci7+wMxSdwMdbXckXtvhJH8sc4iQcTwm7yp+3f7CaesTTQB2qkgeXh+wFiSMXfMlH7Yil0OoZ2QTtRLTip2O0cLZ4SstqWHZ6H+8A2kZXhpm0kPbL9dUanTOvziqIUh6Ambwa3WrCb2eWbuCN3L1hgWUmjRC3JoL3dBhR3imSQI8xuCMfsszlji7cSShNSYdqCXPxEVwbqO9i5B6hf93YI7aeyI8jxgcVXK0I/klbvhSXjkjOIwZgPdVwmsFW7HGPLUAvDRuKm+itybRg7c8+Yqqjg824Qf+/NxsBSUNAK9KCoJpauFqK0XQULrWYj4FnxeKDuvr54iokpi+D57e6Y1zxRJJdsHnDR3JyraCUufHBRTKODWBVzthjm4k3/Hv+Q990XDVR+KW+TcJX045LW86EKhz/97aqj89A8ZvTk1//tczosU90loIPVaHuWegJU3wP//7XHcO7c0yQM2jM/IhQKrf8hiObHWiWDZManF8Uf/HzbmDfC2wT//aiZ4hGTv/xzgKwdb1sD6cGEkceow0s3b89/zg+3plyRm0HlZi886j5wUwFhdHiDTaBidZRo5cx/tMeLyguOATbzq17ydhzbrpxunuHx6lbFGiO97gsd4dk//7iCIo+Ew+hG2so5kvv+ITG4c1fzHPtu1Xn5QfUnqY3/uByVmB7gmnE/E+5zdm+6nDmoews5fr+NzThdSHzK4bBQOL9c4O8OI0xLSqjJ4lbniLJg1aFpQRLwaSMZmpkC9e/j6FOVrTQ6a/a4alGgfrl2ZL1sbHUQ3DOI7ntq9diHFfm3t1mul3rdJEJCHnlW/hlQntipMrpeMs7fUr6wK370D7VbXH0DUHzdYfRg/6Z11Ult1sffJS+heHbco15Sxy3+rDnPesqH1lajk0yu02hPUvEUqvcUXWXL7Ad0wNGMx5gOle4XJxq/r/YY0xdco2wRSEGwcT7YADlBrHc9ZbvzOL0QwyWCWWChB9Obg800v7tyBWaNvdwz+fL7Ph9i2irEeJkRgOzeEDw+JiD/V93vH9FgMEoFIJMoIuogmicZohf94SBuPn6hXaV9jP4VVVA/bu+Wg8S88GLtmEPSNRLdtlXx2XL/nuM8nKkhnlnjaropiKKLIH94pLIASci0pDBfj9Hi5BfaTSXQg5+PMjQX91Ktk4MOqK1K99l4BRPv5+vNovGZ3IxQv8ICvjV4/diThpoaM8uvd3D9d/DE477w3yAbW3IDm2i73pZ9aEj38JqS6h/s8/xgmUIVcuq2JTgefAyuoafzQxAuRASeg3NtG3ach/JEkyuX+JDt2PnDZTShUhyHHG3ttBg/6lhAchGjLJBtopj4e01MlCp2yqQRTr4sBBXru+lKaoanwYX8y2aWCJiR3KnhCOkYVFSvsO0oDRujUFOEptiNDTYrJoUbvOyvl4AhC9h3wORiTXK1MrpMfnvdnndnR/HRVSusMBgIxwrLdn3vq1VcncPiD0SquTx/kNmxeFyCT4uXVUd9AL+rSGmuq7OOCzDKeVPjiNWVaoP5KOFqYq5Xcuf/xW9S+u9eIq9GAtZWtQlgkRecjRtvG1NR4WXXpn+pwsTBTIy079Ikg8rSef1aVapIFcXCd6C2wHVjLXR+N0tw4Taw6x6H90BFRgNrtlq2up6hHKuV3inM5RJaQWZHd84e6RsKkk9po3dk9by54tpPw7cBkFas/G+GbHwuG+AwP55BZyXILTHCIVrPpXHEaUPYfL6nphJP1Rc10xG4UaCeY4IHCwuur8xmSQDgY4aVwhzWhjbtSHG8JO6P2i2nC9/0Bfx0zk6dYQq3aw7k5vIObD7SEKrxhz0fQ0+YTOfHW23CBNeZci1qNsUDhoeqmfyP6PvjoEjHk8QbrFyQVZPHVWijnb8YCM65iYNoEbvnchStZ/9cKg5Vd45j8KnB6UjzXl/bkyZx7VoD47ocUUi117WwgySSb4rXgLJ52Mv5XJbp3I+uBP81BUvOjy4Cacgi+GWWlC/8dwgqwiojjUBDnEOxyRyowwLQfytFra1OZS4XvRYr4uoamAfG3I/p2bA7G90yqKThH8Ke00Tqd+3l3dmJpaCZelBMYjGqNLVa3SM4+LQeL56gY6Bymy2LQPVOxjWfj5tq4o74swcxhyGJPynkS5xAjOXZP1/FAYcBT3u6qLoIkEfErwo4gozmyI1YCvM0oyI3ghjGPQSsof2sKUhq91WsKy9cYWN+4A2v4pG/Mxpdc6w6kI/HX7Xb0TuihmsiOy2wQIsrZbUmr3OBSUo6oDJNgQp+YqYkgTgYcWZDgawJw3DFfdzT//PhVUidgB2qa8uw/j9ToHBAS33iT8YLhhAfyXG0bQUFp7QmH7oQ3i6Flf4OTZLvJdh8pfuflmWu2ohm5pTiSg1pl3vq9uluTJwqXfh1hqy8e2iHoD+Y35gCIViTo6VOtK5dD8HYClucJucXASzwe2kPj4S4eYQtmkYHagXhAzp/F541xE8YFYqSPszDuz3soWzHy0p3E2jwZNQaIcGU9FNQwQxeDw0ZlK9dxXrj9IUHGUPTOyib8CqXmbZ7Ex54bn1rLx3qqAavu/gh6XjV0GmN1p+yyMK9HN5uYEvxgbAk43tsheREhyI+Q5WLIneKTGPmYiM/lxOp8fvqHy8YgXK0TlMiX0tliLI2JtfmWZP8eVV732sdYm+pcWzDzEmKLJZyeelyaZKkjPnnUO9keDwtgiLnmd5+t+Sr5y8brRnlvxcWEWfCqIALQYHvaXx6jTg4dAlye469uGwwOZVZCILLfGjaMg4LUCNMTtMSp1aC2y/3wR2t1v3w/iNBRQ+bNbtDqL2NAr7K4rUcyqbSpNrXZgAWXvjxBBtfYLK1uRYt3q2pfXJOAL0HtWcEwJLddOSJKV1SwvcvEuzg/4MPnA8MIUJOLqm3qI6wFyN99Ck6zYaV/zGSAzF/PGsaNa4vPLe5QnyuqVUnVQ6xELA6gbe53aGgeke+R/ycb2LJVyc7BhuzI90zA+c6wUDTb7NH//gdDSl2u/aW7lRJm8m1fLtPxcNuEM5JbkOCZKPM88HUsLRoC1pmKKlvWyeAXuxILbu0snpSxf8N+RgtLUSe5n2gdjOjoSTaN7mMZ7bF+cWk/MS8mFD4pcyl5UN7CbpFZH2a+Pm1VAnUTVfbw8qrmz1G9m5aKmRzY1SMhhPrlCn2t4uNUXNA3IFe6NOjSC1DEaAFZAfDlEkQCsbNhsZPj6NQPDSB3tLiTo0ZYoEbIeEIaKtU3Wk60rEszawTFuyHVd365LA/c/uarABN5M5rGq/dqTG3Ilye/5EKiYisisuzqNaZjmWv0z9TORc0CKbaTea214oNM9u2sXUZub/eqM3Pi/PjRSyQiOSwPWif2asTgu6hS6fb5UGosCWxdedMqdViIUUSSdIJx+qQ4KShfTT39VAWZbi+mB+iKICNwpt6cflY57Rcbs6d1kA26Iru73cuxYVlSvuJdcR5VfDYZRk8X0AXePROyw3Le6LaUdmTLzYsoNhhgQpd67xVNiHgk3pakmndeIAtTC4DCXy9oS6eU4CWxDdVmY53pKNbdAKmQsP37lrJZC6iDXMELGKcHjNuuZgcDyY8W/yv6ha3DX7OWm/35fpvhw55oitf4V+GULlcPWYyGGuVBdro19c8u0RDddDun40W7G5cSIzHLh/qZxb59R+EPY+wZ2XerkUim92hhXpKyW6WtAh6zQS97DrPyjCvKi3pCw96LeKynOpyjtsMQc2RmI/20zFOZcSa2AK++PoRcT6zeJyxlBZ7kk5mhqXGkLlM2hFKc+/T544xXP0Ua38Q6xdPTLTeG1PHnLMaOvksUQMrEFTB/lizCirmFQL8zYVU+OTeYQEFaITsBSMMYexS9HkajO2gGIf2micvntCZJsZQEwIH3/4JGJQGflBuH5rNXmnRRYXDQs3ZoEQoMtYDr1kFKUS/siiQSUxcTH9XYeBZiKDDFQoExREO9dddKQLO3BwMHvymCSTFyY+vxn3D27NDx6OlU092D5EDUwilttqVHpjJQDUceJYCLsK2swfXeNUVrBJT/w/sk+7si8rPtiMFis+oxvGdGQxirMBID700T39mULuNHzOyN+xBfcFACZcyngF1aSpv0JPkNUrAZTqfplv509cGXFUiEEm5dZb+OsP/blizqdK45/dSsIrufYTrCPY2lgJD6k6QljTfXVlHfYKSq+MsagyUcaMintyr95bD8kdTAeYNLNsMmo/Wdd8a2nStBP49ARIjqqpUHWY4q4mvO5Cq/CgCP+4/B+5zutGwX5pssgVLr1+fIM7WWLfiUQDk4c6ZdHZOWv5hG3g2dgQ5NXnpIY+BWwJpaouf25bXnjDzbHnQNofH/c6m+dEAS9Gs2h7pFRPKOBDnqswZ8KZjhId1ytHUTs533KwBoSiImoxKQUgZ7z6pA9QB3sZ8Cq0vwutJTTkfbX8AzCpm2cFXx/P22niUMHauU8IGc+78R6TsutoonoqFuoNA3l80t387YHMoL5KGAT1JO4zmx+vJ0LbLHlicHraSVYvJjnO9p++qnWgKw9OwFVVUagvZuf9qfiuum+hIicxP1q4zDnzkHsCNriLxBpxY9N+UOmqzdY1MunLMDgkMyi3uvnN3UBXJeZ8YLs5xr8QrOhimYoKuGBebZHAiBIkViv3DG8k2oNpp5OIgX6ulqaRN8V62QUPjn5tl1kPXhT9bcd8qIm8gi4or/FGbvQ6pgGSHmnayrugmf5E0upGxPRf/3xOtitGMaHLKJVm5zhglmVfI91o0yxhJZVS/5wQ8zfxK8Ylw0WmHXoGfRkoBRx9Hsnl/6sgTjAVwpmNuSeZtBwlX4qB8Bh8lxjqBDIuFGJ4I1wxN0XRlAAslzqMKwQfyA7OkuivCXfv+i+3XmhcBFM2n4jdT+NyUmBnQJPV3F2sZfKvJhUlXzSosFR4VevVVcOkFnnjdiRWc0TeSYxj41sJGYMbZTeLI3GvyZ8/gAAudQ1+4oFX+enX5V49MczGCYVBuoC4kHjp7ZVxj+clBwPr9k+v05SsezQK3enxLs1Nt/N7c7AImVUysjGou4iOohHo83Zs9/MI/OWB+OyXzOBD93NbApGHXrv8CVRHp2bwH+xB55cfNrdqFD35HSMx4iVmtzYAmSCIV8kXsHoq3DIb93riTWbubnjxbBW5zConVtbxLRStXHkIyAByaozME952Gc9aAdAbBpZSVCH88Uwb/4bPTVOVl+WoMYD7JIvK8VcMrJ8zHV4bbG0Dg7Kx17A4ej/ZcZ2Z5pVuVLUH1E/AccUTKm81SE+LQ6STTUDscUk0x2OWIbEORhg69tdoTGNkA1RfkGIRZHr5mCXOpLC55WWzCZoGPFUVtZRHwh0nq039CDdjEPo+JyaxSQAvDgR6Iqvxy0frrtEG1A385N81l05SSzN+IDm9bypF9m92EUqblnauZ5sjc37wRykOdl7w4o8WMgQsjii3EE/aJYDfHs1cH6DNBEujjcCc8qAefYFyIAURDcDnzun5UmkbBQsU4eu/W8I9nBE0qJKTdg2hwjq0+XV7a3TJ7R+alvJZCRia9lJ+grNB9dbrOmWEvUotMjvDhq4wV/kq4fvIBkzUGpDeYH74rne8uU3dgoNZdR9pUL6q9YDNRfOiF6Dyk+SYXQIghTjm9qR4tBHh0gnmF/9q3Qv22EzaLhSvDlDOxMrrCNRmLCl1jApzLrBCPn2mjn5zqK7OYK7VxOfQ5GfBfoPdyQwqFEgCVHkJ9oTnagRM3R0+rsuN5jQv9icCav/p1WqiEXSzCdLd/WEA6z6dDP7tPqPbeDYKAkVcz1lLGbFOC9b7cBd3MV0Ve8dZ89oR7OnxGS7uVpSry8banVZwpJg+nkH1jRBYa2BvBMY2xITH9ERXCjHzdZxs+ipdXP2DY7X+eWiBhtT2L0RRGTLPeazn5tpl4tu8iE2rWig731iuJDRbCHHy+g/Mb9+miAyVqfIpXT/iZeOxOxODO0hEpLM78I1+G2Z45yi3lS1K3m4WMQ559Lp4UML5vZUjYGJuxl+OPpUH5klpyBujkjprhei0TmUik10gjvNUp8mDkWlNKikmYspaVTqewbnOzJrmz8FLIpsT67EJLHIIfeDcWEfiP+DJrZ1jfxpoAb2abeMqLx+9RuZGzQoYtYVGgAWwEM9Kek2vPIeBNAKD6ao7nw6sgvfeLZPoXkbYO/tStHJdKzk+WFSFEU2NcALJAEP6S8pcnqqBBt57dwTrzQNCIdk2SocK4dLRbD/pu/VryKnm65ZYXiJCfHJk3mx9MRSl+nSK6OqEBSoGjz0/LADddwF/HqcfK3K3O+6YUGQcmj8pZL4PhZ6KrGkb8B38FmDvvLd3XQXbvS/FQmrXFTvJNkaN/FGo83KuS43BK1UfVnIqigGkCoP5fBda2MwAGTGNKX9K9t4Bx83pMFc5KSORmWKv+8VoVggWxoaBz3/9IBh6RwLd1tebwy89xvE5z6EEpXpDfrXWfRsMs6+ekUHH6idVosno55+xQ8Zqzelh0bxtJTgCcH3Z3/Cxlx9eNIS4JIFKOAVrDqbrXRszmY55a5+niJGHtkO3b6mnIDxLa1WXc7BAe33mt2KyM4Fbc3R6/WVTQN8QhlqAtave2WsQTqzWeSlKuGUVIJRqtObpv294rS0kDN1RKzdstZTXJebR2HlzsQ4P3NbMHUqFZMZw+/IKXnh4t+lY8qocp/B1oMszR03EFs3bPeND8QkItMvllObeCz3SZAjqZrobmLcrpFyQV7mwBjg3C3C8/bc5goQhv8j/IXMLGnt4mF7tybRDG5G0polxoUScQkPvmnga2/K+aapKeqSL0BTmo1Cm5g+booNOtdyKva2KoefRURaBk7113QKo3y+WTuFKtgETIK8HRluYS9DvlcciCDvnG8UaJRfZE2siZsiTHvRmN80xkUIInHeRZl5Re/+ATL6VhKFi8CZ/n/jbFV6T5pZ+Uoppvsi3qjacVFOJgWWfdlwVHKPW/TJO3na9hRM9bS2yo2rEsC6IBzRReVO6IesJU7PItzOamr+ROFfwGZmZ7ue8HNxAgLJKb7P3p8dMqk6Be5PJaT/5Rdc1deYVihWH9cjVKc9uz5EnfHqxLUkOO8iJUENBNVf5LyNy8zjLu/78k5WNTywiPfYeX3CPk7yc6CI3lum/CEZwfUaNpcI3KsPqfn2lmz3kd/acQjKA1ebkJaiuLD+epQ/Fc1llHXXMzofWzz/Kd29SNmOhcjMWw1jq1g3YfrXZ9rzXDYW4ZttfgfMi6oCUtBs0PkMVuxmq5lxEoCaSXPSqCJJ7MlKdRDidVt0AFlxk5cTdX++sBF2+E35mjwfm8ERVxH0FvuAQtsfA4V2G0TKTUxeyRGVjd/u6F1SvuAiU2/WaQjcNCU4Ep7VunXCYSbZj3U3wzu/LWM5MPlYuyQ3FOOCD/zt7K295hY2JhwF+ODDIZ676vGQFKveEQYkWj7lkK7rVmD7MhU0Y/tF8EcTTpo4/yqOufbd/zWIpMajnbDuWK2vn6OPPtz2rc9MIBNlPd8tt+yf+7SC4wqEPbozKMCwY5Bygx4JmoIEDsixWRDcdHd6S3/dZMHXOJAAv7+NIstl00crgSqHZKAEe4g3G4dzIV51EeZB01r7p8GNlfUnG/GjZgNGsqXZdYMBVtAtFNv3hJWPve4GvqZ2XxuiNkHTz5kxWgr0PjQdJlVywJ9Zf2ZvqeeTbolKtvK54re2Lq5BoyzfsRtvDfyao3kmyFzDQ88nM+qx83w74RDlkngtYiArI05Epre3GgBeSlMig0pE6RGQaFznKkGeb0SozLCyiOtxh7hgwZlbKbClzUUfC8ntMiHUOZE375RhTy9c4DA+oMLkUDkztSybZbdmP1xpaIbjUpPAHBq3cIq+CBFzbMlMMCCkUQ6d9LGV6GYCsYiEWZIy3nBnuxOYXeU4YTGDSin9e4/pCjPtQSHlg5LMEvIlF0ElthqrF129iK2RPBEWd3XWOl3SWV5uz5VUyZYp5kEFmz7QfP/B1W1BBzQ2iTGbSVT79lUHzcGXz3PJceSgz4uknETUwo0xffpr2KUvZF0i/r2sL3IFIClYx8CbIZE6Qt7MDJbOPB3xMScwaOcWG66IJfCnDkb0D2Mb+PHzX+oiCbxeTIogtyN+s2NJirNACk/OACSOTtV6vscwbzW4M168xqaI+RzR47S1nlV/rOoZnid87n/Ima2XYa3un3BuGAisNjb8eLMT9OnMtazQROFCuO1HiZXaOc0oUDbNC4eKLToOx8DzVhMgGA8XIAQ2x3b6I0uEyLssQjJX3QphcUMx4KsMgJ+72km4N2aqkBF2coKmUEt1eqIMGn+5txMT4kYVGd3ALO+y9Z4PP3d3l48JQK8s9ZZ/Qx/+NBKgBEJFlQ32psoJiihGO7FSYM5L81q72kaAYcilEFMG+ZK1BcMqELkflyCV7v8JEXLO4Rf/oZYNZHZVjJhfL6fnpP9Tio3Euue5uS7FMkfGOeRCTrBZ06Caev7tgufeTrX34Ur/Vvc+b8ksiIShNJtuF9WmYxOZ4xg8y6zTdy3KAB2y5kYkcRnXsptWwAFyKZ2I/QGySNeoQLkINUMloC+5L3WuMMx297Q1xUYLKqZ9XHavaobo6QQv4auMm+i84IhxRpPt9nUmcav9NcjCcP+TcMmxsQZ/F3mgeoA0fQgwvTsyXuuTaM3Sqtv2jaaajmaFQpK9W6uIbeqwvSDo34ZrY6elDUHwSCjHRRmlwmyy+eOra64Ssq0XSXYljMHtKY+FShcMkHsEUY/4Bw63dJ6KpwDaxmthlDdbdE+TvYF3v33cGSKqO+1H1pKYhJMvZD5ckQcHyNF8zrtiR5b0ko6NPGoRexUZTYP6VbUdn3zzxGBOi8Z0OqHjGqYxRXwN3mYi0GYEEZYq+Q3QvdKcEHILLLj8S+VFepSfErtmfZCdvxbfIifFSpEzKi+7VJsLMT+zEFeyp1OdwRC1VZrfTLIyR7xTPUcZFYPD9qI7D70uTb4hdpqPXsJIRNYbZtNwch1OI3trh3u2ScoQyM9POnInsUa+OovcwkUP1UfIzPb95n4BaF2ev57NHAej0+BVMF9/Cj9663HN2/JN3SQgslL914bKfiTTDFAz9PlQEL/dSv1H8xl3mtWxh1McFO9EJXlRDaKQDsyKO4vOJW90NFE6yw2tjbc2GeF95sbs0I9enAa6QwQVf/kJQhAD2BzUDKggOyjy1TEhED6sfk+418lQy3c/uj8aw8UEzZ6hIMCd8RohAkumMtIj9m73l2yPWoGHVTPaywkC7Yj9tBM1NxMgcrDwRtk4RO2WHT7Ql5kQCKdJj6kNuOTeyEBYBjLMhGz+O5/YGa84HEiTYEpZ6fFzy26GG2hWtTyteuYrhSyG56BjsT/wQeLRytpTY3D7sIMqZnJ9z1FDrfyjFlGl2TNw9BQysbaxOuwYYZs/7I6BANgkqCknWZC7/BBXvaeKwAmC959I+G39BUE9bExkNlbRoFRyEtNzv+NJ91FuisG3JCS6uYBeRnfv8AkAfKTeg9EYamqnsGfAV7d0f9DghHEQ5IsPGDIUhgoSj7obM4Bu5uhQ3/CYEDTHc92AsFvDK4XGrwUeGBWBHPlS+f4x+CxmmHz2sAGmSFNt65kwZC64mnaoWlu2310laYn8r62AqsR5dfjyK18MEdurdagldzfJtjFXlZs7St4QhdPiye6TPh2/ZAQLU/Fip5s7TDEM16KtRWrK9hmxnQ7bmfa/+7pa10Z8WDPK3NuJ+NN/RAbQ5vHx2uX0Lm7/w7cAEH/hvZA+mt7J7zGw7YtQYwnNN6dpgwkGjjrS3yQoeoYt1EnczmtmJfQZWzUlP3Hlg9Wzlr9IH23q3thGth+QNEANFettxKfskkGOlLk8AqoKJwDqOxAa6UzAx07plSSyNBJSGco9zjnC5gGbDoKvsMDuBR6bGRlGzJ+hFsGa/Izt78aI+WZ6dJlZKp4pGISuv9rV0sAS0MWEwCmfauO7oQZMiakHU35LBxiyJoOMddhUWgcZuC8r4Ksvn75TTcQXLJ7kWtYhGuGqPd9dZuFjBWQHNwosXY5snbHFQq72CvHXhIg+shQxycuLOuWYErwCLZeF24b7F78pO7xw4X6lIAR02hUOf5087Rl0nOaeb6CK4i/KA/EZv76ftOWZtjwxslNr0E/u8rWUmnf3amfg6UZmBAluuoj3Dd7UV+9IAJ6iYcDfSJlgmIImohjfIUMJ27z+opj50Ak9af2LCNrWrBJvMovA1OeNO+MF/MwZvnaCxTgG7Cw4QfSPF6AYCGFt21M8PySZFeV3t2Rqqs5JMzMYzGRgq4o+UaKRgBf9GHi/9X9HXA3wxkCsd/UhnHSh2zUVDiraio/6nP4y3XJqs8ABfALAtCYU7DHPMPRjgcM6Ad/HiSXDAbOdSMkvGZPAkHs8wuQTy6X2Ov/JFvcPuKfV3/r9Q28"),i=()=>tk(r),n=()=>new Set(i()),s=(e,t)=>t.forEach(t=>e.add(t));c=new Map(tM(r)),l=n(),u=i(),d=new Set(i().map(e=>u[e])),u=new Set(u),h=n(),n();let a=tD(r),o=r(),w=()=>{let e=new Set;return i().forEach(t=>s(e,a[t])),s(e,i()),e};f=tU(e=>{let t=tU(r).map(e=>e+96);if(t.length){let i=e>=o;return t[0]-=32,t=tj(t),i&&(t=`Restricted[${t}]`),{N:t,P:w(),Q:w(),M:!r(),R:i}}}),p=n(),g=new Map;let v=i().concat(tV(p)).sort((e,t)=>e-t);for(let{V:e,M:t}of(v.forEach((e,t)=>{let i=r(),n=v[t]=i?v[t-i]:{V:[],M:new Map};n.V.push(e),p.has(e)||g.set(e,n)}),new Set(g.values()))){let r=[];for(let t of e){let e=f.filter(e=>tG(e,t)),i=r.find(({G:t})=>e.some(e=>t.has(e)));i||(i={G:new Set,V:[]},r.push(i)),i.V.push(t),s(i.G,e)}let i=r.flatMap(e=>tV(e.G));for(let{G:e,V:n}of r){let r=new Set(i.filter(t=>!e.has(t)));for(let e of n)t.set(e,r)}}m=new Set;let A=new Set,E=e=>m.has(e)?A.add(e):m.add(e);for(let e of f){for(let t of e.P)E(t);for(let t of e.Q)E(t)}for(let e of m)g.has(e)||A.has(e)||g.set(e,1);for(let i of(s(m,tH(m).map(tq)),b=(e=[],t=tk(r),function t({S:r,B:i},n,s){if(!(4&r)||s!==n[n.length-1])for(let a of(2&r&&(s=n[n.length-1]),1&r&&e.push(n),i))for(let e of a.Q)t(a,[...n,e],s)}(function e(i){return{S:r(),B:tU(()=>{let i=tk(r).map(e=>t[e]);if(i.length)return e(i)}),Q:i}}([]),[]),e).map(e=>tK.from(e)).sort(t$),y=new Map,b)){let e=[y];for(let t of i){let r=e.map(e=>{let r=e.get(t);return r||(r=new Map,e.set(t,r)),r});65039===t?e.push(...r):e=r}for(let t of e)t.V=i}}function tY(e){return(tX(e)?"":`${tZ(tJ([e]))} `)+tB(e)}function tZ(e){return`"${e}"\u200E`}function tJ(e,t=1/0,r=tB){var i;let n=[];i=e[0],tQ(),u.has(i)&&n.push("◌"),e.length>t&&(t>>=1,e=[...e.slice(0,t),8230,...e.slice(-t)]);let s=0,a=e.length;for(let t=0;te.P.has(t));return i&&(r=`${i.N} ${r}`),Error(`illegal mixture: ${e.N} + ${r}`)}function t2(e){return Error(`illegal placement: ${e}`)}function t3(e){return e.filter(e=>65039!=e)}r(65145);var t8=r(52814),t5=r(68314),t6=r(27777),t4=r(83241),t9=r(64125),t7=r(47205),re=r(26149),rt=r(72551),rr=r(79284),ri=r(72731),rn=r(77500),rs=r(56008),ra=r(9681),ro=r(58518);function rc(e,t,r){let i,n,s,a,o,c,l;let u=e.isNewChainsStale??!0;return(0,M.K)(e=>({id:"walletConnect",name:"WalletConnect",type:rc.type,async setup(){let e=await this.getProvider().catch(()=>null);e&&(a||(a=this.onConnect.bind(this),e.on("connect",a)),c||(c=this.onSessionDelete.bind(this),e.on("session_delete",c)))},async connect({...e}={}){try{let t=await this.getProvider();if(!t)throw new k;o||(o=this.onDisplayUri,t.on("display_uri",o));let i=await this.isChainsStale();if(t.session&&i&&await t.disconnect(),!t.session||i){let i=t8.s.createNamespaces(r);await t.connect({optionalNamespaces:i,..."pairingTopic"in e?{pairingTopic:e.pairingTopic}:{}}),this.setRequestedChainsIds(r.map(e=>Number(e.id)))}let u=await this.getAccounts(),d=await this.getChainId();return o&&(t.removeListener("display_uri",o),o=void 0),a&&(t.removeListener("connect",a),a=void 0),n||(n=this.onAccountsChanged.bind(this),t.on("accountsChanged",n)),s||(s=this.onChainChanged.bind(this),t.on("chainChanged",s)),l||(l=this.onDisconnect.bind(this),t.on("disconnect",l)),c||(c=this.onSessionDelete.bind(this),t.on("session_delete",c)),t.setDefaultChain(`eip155:${d}`),{accounts:u,chainId:d}}catch(e){if(/(user rejected|connection request reset)/i.test(e?.message))throw new N.ab(e);throw e}},async disconnect(){let e=await this.getProvider();try{await e?.disconnect()}catch(e){if(!/No matching key/i.test(e.message))throw e}finally{s&&(e?.removeListener("chainChanged",s),s=void 0),l&&(e?.removeListener("disconnect",l),l=void 0),a||(a=this.onConnect.bind(this),e?.on("connect",a)),n&&(e?.removeListener("accountsChanged",n),n=void 0),c&&(e?.removeListener("session_delete",c),c=void 0),this.setRequestedChainsIds([])}},async getAccounts(){let e=await this.getProvider();if(!e?.session?.namespaces)return[];let t=e?.session?.namespaces[t5.b.CHAIN.EVM]?.accounts;return t?.map(e=>e.split(":")[2])??[]},async getProvider({chainId:e}={}){i||(i=await t.getUniversalProvider(),i?.events.setMaxListeners(Number.POSITIVE_INFINITY));let r=t9.M.getActiveNamespace(),n=t.getCaipNetwork()?.id;if(e&&n!==e&&r){let e=t9.M.getStoredActiveCaipNetworkId(),i=t?.getCaipNetworks(r),n=i?.find(t=>t.id===e);n&&n.chainNamespace===t5.b.CHAIN.EVM&&await this.switchChain?.({chainId:Number(n.id)})}return i},async getChainId(){let e=t.getCaipNetwork(t5.b.CHAIN.EVM)?.id;if(e)return e;let i=await this.getProvider(),n=i.session?.namespaces[t5.b.CHAIN.EVM]?.chains?.[0],s=r.find(e=>e.id===n);return s?.id},async isAuthorized(){try{let[e,t]=await Promise.all([this.getAccounts(),this.getProvider()]);if(!e.length)return!1;if(await this.isChainsStale()&&t.session)return await t.disconnect().catch(()=>{}),!1;return!0}catch{return!1}},async switchChain({addEthereumChainParameter:t,chainId:i}){let n=await this.getProvider();if(!n)throw new k;let s=r.find(e=>e.id===i);if(!s)throw new N.x3(new O.X4);try{await n.request({method:"wallet_switchEthereumChain",params:[{chainId:(0,x.eC)(i)}]}),s?.caipNetworkId&&n.setDefaultChain(s?.caipNetworkId),e.emitter.emit("change",{chainId:Number(i)});let t=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...t,i]),{...s,id:s.id}}catch(e){if(/(?:user rejected)/iu.test(e.message))throw new N.ab(e);try{let e;e=t?.blockExplorerUrls?t.blockExplorerUrls:s.blockExplorers?.default.url?[s.blockExplorers?.default.url]:[];let r=s.rpcUrls?.chainDefault?.http||[],a={blockExplorerUrls:e,chainId:(0,x.eC)(i),chainName:s.name,iconUrls:t?.iconUrls,nativeCurrency:s.nativeCurrency,rpcUrls:r};await n.request({method:"wallet_addEthereumChain",params:[a]});let o=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...o,i]),{...s,id:s.id}}catch(e){throw new N.ab(e)}}},onAccountsChanged(t){0===t.length?this.onDisconnect():e.emitter.emit("change",{accounts:t.map(e=>(0,S.K)(e))})},onChainChanged(t){let r=Number(t);e.emitter.emit("change",{chainId:r})},onConnect(e){this.setRequestedChainsIds(r.map(e=>Number(e.id)))},async onDisconnect(t){this.setRequestedChainsIds([]),e.emitter.emit("disconnect");let r=await this.getProvider();n&&(r.removeListener("accountsChanged",n),n=void 0),s&&(r.removeListener("chainChanged",s),s=void 0),l&&(r.removeListener("disconnect",l),l=void 0),c&&(r.removeListener("session_delete",c),c=void 0),a||(a=this.onConnect.bind(this),r.on("connect",a))},onDisplayUri(t){e.emitter.emit("message",{type:"display_uri",data:t})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){if(!i?.session?.namespaces)return[];let e=i?.session?.namespaces[t5.b.CHAIN.EVM]?.accounts;return e?.map(e=>Number.parseInt(e.split(":")[1]??""))??[]},async getRequestedChainsIds(){return[...new Set(await e.storage?.getItem(this.requestedChainsStorageKey)??[])]},async isChainsStale(){if(!u)return!1;let t=e.chains.map(e=>e.id),r=this.getNamespaceChainsIds();if(r.length&&!r.some(e=>t.includes(e)))return!1;let i=await this.getRequestedChainsIds();return!t.every(e=>i.includes(Number(e)))},async setRequestedChainsIds(t){await e.storage?.setItem(this.requestedChainsStorageKey,t)},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}}))}r(58269),rc.type="walletConnect";var rl=r(86949),ru=r(73932);let rd=(0,rl.sj)({pendingTransactions:0}),rh={state:rd,subscribeKey:(e,t)=>(0,ru.VW)(rd,e,t),increase(e){rd[e]+=1},decrease(e){rd[e]-=1},reset(e){rd[e]=0}},rf={enable:!1,pollingInterval:3e4};class rp extends rr.q{constructor(e){let t=re.f.extendCaipNetworks(e.networks,{projectId:e.projectId,customNetworkImageUrls:{},customRpcUrls:e.customRpcUrls});super({projectId:e.projectId,networks:t}),this.adapterType="wagmi",this.balancePromises={},this.pendingTransactionsFilter={...rf,...e.pendingTransactionsFilter??{}},this.namespace=t5.b.CHAIN.EVM,this.createConfig({...e,networks:t}),this.setupWatchers()}async getAccounts(e){let t=this.getWagmiConnector(e.id);if(!t)return{accounts:[]};if(t.id===t5.b.CONNECTOR_ID.AUTH){let e=t.provider,{address:r,accounts:i}=await e.connect();return Promise.resolve({accounts:(i||[{address:r,type:"eoa"}]).map(e=>t4.j.createAccount("eip155",e.address,e.type))})}let{addresses:r,address:i}=w(this.wagmiConfig);return Promise.resolve({accounts:(r||[i])?.map(e=>t4.j.createAccount("eip155",e||"","eoa"))})}getWagmiConnector(e){return this.wagmiConfig.connectors.find(t=>t.id===e)}createConfig(e){this.caipNetworks=e.networks,this.wagmiChains=this.caipNetworks.filter(e=>e.chainNamespace===t5.b.CHAIN.EVM);let t={},r=[...e.connectors??[]];this.wagmiChains.forEach(r=>{let i=e.transports?.[r.id],n=re.f.getCaipNetworkId(r);i?t[r.id]=re.f.extendWagmiTransports(r,e.projectId,i):t[r.id]=re.f.getViemTransport(r,e.projectId,e.customRpcUrls?.[n])}),this.wagmiConfig=function(e){let t;let{multiInjectedProviderDiscovery:r=!0,storage:n=W({storage:function(){let e="undefined"!=typeof window&&window.localStorage?window.localStorage:V;return{getItem:t=>e.getItem(t),removeItem(t){e.removeItem(t)},setItem(t,r){try{e.setItem(t,r)}catch{}}}}()}),syncConnectedChain:s=!0,ssr:a=!1,...o}=e,c="undefined"!=typeof window&&r?function(){let e=new Set,t=[],r=()=>(function(e){if("undefined"==typeof window)return;let t=t=>e(t.detail);return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)})(r=>{t.some(({info:e})=>e.uuid===r.info.uuid)||(t=[...t,r],e.forEach(e=>e(t,{added:[r]})))}),i=r();return{_listeners:()=>e,clear(){e.forEach(e=>e([],{removed:[...t]})),t=[]},destroy(){this.clear(),e.clear(),i?.()},findProvider:({rdns:e})=>t.find(t=>t.info.rdns===e),getProviders:()=>t,reset(){this.clear(),i?.(),i=r()},subscribe:(r,{emitImmediately:i}={})=>(e.add(r),i&&r(t,{added:t}),()=>e.delete(r))}}():void 0,l=I(()=>o.chains),u=I(()=>{let e=[],t=new Set;for(let r of o.connectors??[]){let i=d(r);if(e.push(i),!a&&i.rdns)for(let e of"string"==typeof i.rdns?[i.rdns]:i.rdns)t.add(e)}if(!a&&c)for(let r of c.getProviders())t.has(r.info.rdns)||e.push(d(h(r)));return e});function d(e){let t=new $(function(e=11){if(!i||G+e>512){i="",G=0;for(let e=0;e<256;e++)i+=(256+256*Math.random()|0).toString(16).substring(1)}return i.substring(G,G+++e)}()),r={...e({emitter:t,chains:l.getState(),storage:n,transports:o.transports}),emitter:t,uid:t.uid};return t.on("connect",w),r.setup?.(),r}function h(e){let{info:t}=e,r=e.provider;return U({target:{...t,id:t.rdns,provider:r}})}let f=new Map;function p(){return{chainId:l.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let g="0.0.0-canary-";t=K.i.startsWith(g)?Number.parseInt(K.i.replace(g,"")):Number.parseInt(K.i.split(".")[0]??"0");let m=I(A(n?C(p,{migrate(e,r){if(r===t)return e;let i=p(),n=b(e,i.chainId);return{...i,chainId:n}},name:"store",partialize:e=>({connections:{__type:"Map",value:Array.from(e.connections.entries()).map(([e,t])=>{let{id:r,name:i,type:n,uid:s}=t.connector;return[e,{...t,connector:{id:r,name:i,type:n,uid:s}}]})},chainId:e.chainId,current:e.current}),merge(e,t){"object"==typeof e&&e&&"status"in e&&delete e.status;let r=b(e,t.chainId);return{...t,...e,chainId:r}},skipHydration:a,storage:n,version:t}):p));function b(e,t){return e&&"object"==typeof e&&"chainId"in e&&"number"==typeof e.chainId&&l.getState().some(t=>t.id===e.chainId)?e.chainId:t}function y(e){m.setState(t=>{let r=t.connections.get(e.uid);return r?{...t,connections:new Map(t.connections).set(e.uid,{accounts:e.accounts??r.accounts,chainId:e.chainId??r.chainId,connector:r.connector})}:t})}function w(e){"connecting"!==m.getState().status&&"reconnecting"!==m.getState().status&&m.setState(t=>{let r=u.getState().find(t=>t.uid===e.uid);return r?(r.emitter.listenerCount("connect")&&r.emitter.off("connect",y),r.emitter.listenerCount("change")||r.emitter.on("change",y),r.emitter.listenerCount("disconnect")||r.emitter.on("disconnect",E),{...t,connections:new Map(t.connections).set(e.uid,{accounts:e.accounts,chainId:e.chainId,connector:r}),current:e.uid,status:"connected"}):t})}function E(e){m.setState(t=>{let r=t.connections.get(e.uid);if(r){let e=r.connector;e.emitter.listenerCount("change")&&r.connector.emitter.off("change",y),e.emitter.listenerCount("disconnect")&&r.connector.emitter.off("disconnect",E),e.emitter.listenerCount("connect")||r.connector.emitter.on("connect",w)}if(t.connections.delete(e.uid),0===t.connections.size)return{...t,connections:new Map,current:null,status:"disconnected"};let i=t.connections.values().next().value;return{...t,connections:new Map(t.connections),current:i.connector.uid}})}return m.setState(p()),s&&m.subscribe(({connections:e,current:t})=>t?e.get(t)?.chainId:void 0,e=>{if(l.getState().some(t=>t.id===e))return m.setState(t=>({...t,chainId:e??t.chainId}))}),c?.subscribe(e=>{let t=new Set,r=new Set;for(let e of u.getState())if(t.add(e.id),e.rdns)for(let t of"string"==typeof e.rdns?[e.rdns]:e.rdns)r.add(t);let i=[];for(let n of e){if(r.has(n.info.rdns))continue;let e=d(h(n));t.has(e.id)||i.push(e)}(!n||m.persist.hasHydrated())&&u.setState(e=>[...e,...i],!0)}),{get chains(){return l.getState()},get connectors(){return u.getState()},storage:n,getClient:function(e={}){let t;let r=e.chainId??m.getState().chainId,i=l.getState().find(e=>e.id===r);if(e.chainId&&!i)throw new O.X4;{let e=f.get(m.getState().chainId);if(e&&!i)return e;if(!i)throw new O.X4}{let e=f.get(r);if(e)return e}if(o.client)t=o.client({chain:i});else{let e=i.id,r=l.getState().map(e=>e.id),n={};for(let[t,i]of Object.entries(o))if("chains"!==t&&"client"!==t&&"connectors"!==t&&"transports"!==t){if("object"==typeof i){if(e in i)n[t]=i[e];else{if(r.some(e=>e in i))continue;n[t]=i}}else n[t]=i}t=(0,v.e)({...n,chain:i,batch:n.batch??{multicall:!0},transport:t=>o.transports[e]({...t,connectors:u})})}return f.set(r,t),t},get state(){return m.getState()},setState(e){let t;t="function"==typeof e?e(m.getState()):e;let r=p();"object"!=typeof t&&(t=r),Object.keys(r).some(e=>!(e in t))&&(t=r),m.setState(t,!0)},subscribe:(e,t,r)=>m.subscribe(e,t,r?{...r,fireImmediately:r.emitImmediately}:void 0),_internal:{mipd:c,store:m,ssr:!!a,syncConnectedChain:s,transports:o.transports,chains:{setState(e){let t="function"==typeof e?e(l.getState()):e;if(0!==t.length)return l.setState(t,!0)},subscribe:e=>l.subscribe(e)},connectors:{providerDetailToConnector:h,setup:d,setState:e=>u.setState("function"==typeof e?e(u.getState()):e,!0),subscribe:e=>u.subscribe(e)},events:{change:y,connect:w,disconnect:E}}}}({...e,chains:this.wagmiChains,connectors:r,transports:t})}setupWatchPendingTransactions(){if(!this.pendingTransactionsFilter.enable||this.unwatchPendingTransactions)return;this.unwatchPendingTransactions=function(e,t){let r,i;let{syncConnectedChain:n=e._internal.syncConnectedChain,...s}=t,a=t=>{r&&r();let i=e.getClient({chainId:t});return r=(0,ey.s)(i,eb,"watchPendingTransactions")(s)},o=a(t.chainId);return n&&!t.chainId&&(i=e.subscribe(({chainId:e})=>e,async e=>a(e))),()=>{o?.(),i?.()}}(this.wagmiConfig,{pollingInterval:this.pendingTransactionsFilter.pollingInterval,onError:()=>{},onTransactions:()=>{this.emit("pendingTransactions"),rh.increase("pendingTransactions")}});let e=rh.subscribeKey("pendingTransactions",t=>{t>=t5.b.LIMITS.PENDING_TRANSACTIONS&&(this.unwatchPendingTransactions?.(),e())})}setupWatchers(){!function(e,t){let{onChange:r}=t;e.subscribe(()=>w(e),r,{equalityFn(e,t){let{connector:r,...i}=e,{connector:n,...s}=t;return ew(i,s)&&r?.id===n?.id&&r?.uid===n?.uid}})}(this.wagmiConfig,{onChange:(e,t)=>{"disconnected"===e.status&&t.address&&this.emit("disconnect"),"connected"===e.status&&((e.address!==t?.address||"connected"!==t.status)&&(this.setupWatchPendingTransactions(),this.emit("accountChanged",{address:e.address,chainId:e.chainId})),e.chainId!==t?.chainId&&this.emit("switchNetwork",{address:e.address,chainId:e.chainId}))}})}async addThirdPartyConnectors(e){let t=[];if(!1!==e.enableCoinbase)try{let{coinbaseWallet:i}=await r.e(9011).then(r.bind(r,99011));i&&t.push(i({version:"4",appName:e.metadata?.name??"Unknown",appLogoUrl:e.metadata?.icons[0]??"Unknown",preference:e.coinbasePreference??"all"}))}catch(e){console.error("Failed to import Coinbase Wallet SDK:",e)}t.forEach(e=>{let t=this.wagmiConfig._internal.connectors.setup(e);this.wagmiConfig._internal.connectors.setState(e=>[...e,t])})}addWagmiConnectors(e,t){let r=[];!1!==e.enableWalletConnect&&r.push(rc(e,t,this.caipNetworks)),!1!==e.enableInjected&&r.push(U({shimDisconnect:!0}));let i=e.features?.email===void 0?t7.bq.DEFAULT_FEATURES.email:e.features?.email,n=e.features?.socials?e.features?.socials?.length>0:t7.bq.DEFAULT_FEATURES.socials;(i||n)&&r.push(function(e){let t=[];function r(e){return t6.p.parseEvmChainId(e)||1}return(0,M.K)(i=>({id:t5.b.CONNECTOR_ID.AUTH,name:t5.b.CONNECTOR_NAMES.AUTH,type:"AUTH",chain:t5.b.CHAIN.EVM,async connect(i={}){let n=await this.getProvider(),s=i.chainId;if(i.isReconnecting){let t=t6.p.parseEvmChainId(n.getLastUsedChainId()||""),r=e.chains?.[0].id;if(!(s=t||r))throw Error("ChainId not found in provider")}let{address:a,chainId:o,accounts:c}=await n.connect({chainId:s,preferredAccountType:rn.OptionsController.state.defaultAccountTypes.eip155});t=c?.map(e=>e.address)||[a],await n.getSmartAccountEnabledNetworks();let l=r(o);return{accounts:t,account:a,chainId:l,chain:{id:l,unsuported:!1}}},async disconnect(){let e=await this.getProvider();await e.disconnect()},getAccounts:()=>t?.length?(i.emitter.emit("change",{accounts:t}),Promise.resolve(t)):Promise.resolve([]),async getProvider(){return this.provider||(this.provider=ro.D.getInstance({projectId:e.options.projectId,enableLogger:e.options.enableAuthLogger,onTimeout:()=>{rs.AlertController.open(ra.j.ALERT_ERRORS.SOCIALS_TIMEOUT,"error")}})),Promise.resolve(this.provider)},async getChainId(){let e=await this.getProvider(),{chainId:t}=await e.getChainId();return r(t)},async isAuthorized(){return Promise.resolve((await this.getProvider()).getLoginEmailUsed())},async switchChain({chainId:e}){try{let r=i.chains.find(t=>t.id===e);if(!r)throw new N.x3(Error("chain not found on connector."));let n=await this.getProvider(),s=await n.connect({chainId:e,preferredAccountType:rn.OptionsController.state.defaultAccountTypes.eip155});return t=s?.accounts?.map(e=>e.address)||[s.address],i.emitter.emit("change",{chainId:Number(e),accounts:t}),r}catch(e){if(e instanceof Error)throw new N.x3(e);throw e}},onAccountsChanged(e){0===e.length?this.onDisconnect():i.emitter.emit("change",{accounts:e.map(S.K)})},onChainChanged(e){let t=Number(e);i.emitter.emit("change",{chainId:t})},async onDisconnect(e){let t=await this.getProvider();await t.disconnect()}}))}({chains:this.wagmiChains,options:{projectId:e.projectId,enableAuthLogger:e.enableAuthLogger}})),r.forEach(e=>{let t=this.wagmiConfig._internal.connectors.setup(e);this.wagmiConfig._internal.connectors.setState(e=>[...e,t])})}async signMessage(e){try{return{signature:await e_(this.wagmiConfig,{message:e.message,account:e.address})}}catch(e){throw Error("WagmiAdapter:signMessage - Sign message failed")}}async sendTransaction(e){let{chainId:t}=w(this.wagmiConfig),r={account:e.address,to:e.to,value:e.value,gas:e.gas,gasPrice:e.gasPrice,data:e.data,chainId:t,type:"legacy"};await eS(this.wagmiConfig,r);let i=await eT(this.wagmiConfig,r);return await eV(this.wagmiConfig,{hash:i,timeout:25e3}),{hash:i}}async writeContract(e){let{caipNetwork:t,...r}=e,i=Number(t6.p.caipNetworkIdToNumber(t.caipNetworkId));return{hash:await (0,eG.n)(this.wagmiConfig,{chain:this.wagmiChains?.[i],chainId:i,address:r.tokenAddress,account:r.fromAddress,abi:r.abi,functionName:r.method,args:r.args,__mode:"prepared"})}}async getEnsAddress(e){let{name:t,caipNetwork:r}=e;try{if(!this.wagmiConfig)throw Error("networkControllerClient:getApprovedCaipNetworksData - wagmiConfig is undefined");let e=!1,n=!1;if((t?.endsWith(t5.b.WC_NAME_SUFFIX_LEGACY)||t?.endsWith(t5.b.WC_NAME_SUFFIX))&&(n=await t8.s.resolveReownName(t)||!1),1===r.id){var i;e=await function(e,t){let{chainId:r,...i}=t,n=e.getClient({chainId:r});return(0,ey.s)(n,e7,"getEnsAddress")(i)}(this.wagmiConfig,{name:(i=function(e,t,r){if(!e)return[];tQ();let i=0;return e.split(".").map(e=>{let n=function(e){let t=[];for(let r=0,i=e.length;r0;)if(95!==e[--t])throw Error("underscore allowed only at start")}(o),!(s.emoji=a>1||i[0].is_emoji)&&o.every(e=>e<128))(function(e){if(e.length>=4&&45==e[2]&&45==e[3])throw Error(`invalid label extension: "${tj(e.slice(0,4))}"`)})(o),e="ASCII";else{let t=i.flatMap(e=>e.is_emoji?[]:e);if(t.length){if(u.has(o[0]))throw t2("leading combining mark");for(let e=1;etG(e,r));if(!e.length){if(f.some(e=>tG(e,r)))throw t1(t[0],r);throw t0(r)}if(t=e,1==e.length)break}return t}(r);(function(e,t){for(let r of t)if(!tG(e,r))throw t1(e,r);if(e.M){let e=tH(t).map(tq);for(let t=1,r=e.length;t4)throw Error(`excessive non-spacing marks: ${tZ(tJ(e.slice(t-1,i)))} (${i-t}/4)`);t=i}}})(n,t),function(e,t){let r;let i=[];for(let e of t){let t=g.get(e);if(1===t)return;if(t){let i=t.M.get(e);if(!(r=r?r.filter(e=>i.has(e)):tV(i)).length)return}else i.push(e)}if(r){for(let t of r)if(i.every(e=>tG(t,e)))throw Error(`whole-script confusable: ${e.N}/${t.N}`)}}(n,r),e=n.N}else e="Emoji"}s.type=e}catch(e){s.error=e}return s})}(t,tW,t3)).map(({input:e,error:t,output:r})=>{if(t){let r=t.message;throw Error(1==i.length?r:`Invalid label ${tZ(tJ(e,63))}: ${r}`)}return tj(r)}).join("."),chainId:r.id})}return{address:e||n||!1}}catch{return{address:!1}}}async estimateGas(e){try{return{gas:await tt(this.wagmiConfig,{account:e.address,to:e.to,data:e.data,type:"legacy"})}}catch(e){throw Error("WagmiAdapter:estimateGas - error estimating gas")}}parseUnits(e){return(0,tP.v)(e.value,e.decimals)}formatUnits(e){return(0,tx.b)(e.value,e.decimals)}async addWagmiConnector(e,t){if(e.id===t5.b.CONNECTOR_ID.AUTH||e.id===t5.b.CONNECTOR_ID.WALLET_CONNECT)return;let r=await e.getProvider().catch(()=>void 0);this.addConnector({id:e.id,explorerId:rt.C.ConnectorExplorerIds[e.id],imageUrl:t?.connectorImages?.[e.id]??e.icon,name:rt.C.ConnectorNamesMap[e.id]??e.name,imageId:rt.C.ConnectorImageIds[e.id],type:rt.C.ConnectorTypesMap[e.type]??"EXTERNAL",info:e.id===t5.b.CONNECTOR_ID.INJECTED?void 0:{rdns:e.id},provider:r,chain:this.namespace,chains:[]})}async syncConnectors(e,t){!function(e,t){let{onChange:r}=t;e._internal.connectors.subscribe((e,t)=>{r(Object.values(e),t)})}(this.wagmiConfig,{onChange:t=>t.forEach(t=>this.addWagmiConnector(t,e))}),await Promise.all(this.wagmiConfig.connectors.map(t=>this.addWagmiConnector(t,e))),this.addWagmiConnectors(e,t),await this.addThirdPartyConnectors(e)}async syncConnection(e){let{id:t}=e,r=ti(this.wagmiConfig).find(e=>e.connector.id===t),i=this.getWagmiConnector(t),n=await i?.getProvider();return{chainId:Number(r?.chainId),address:r?.accounts[0],provider:n,type:r?.connector.type,id:r?.connector.id}}async connectWalletConnect(e){let t=this.getWalletConnectConnector();await t.authenticate();let r=this.getWagmiConnector("walletConnect");if(!r)throw Error("UniversalAdapter:connectWalletConnect - connector not found");return await tn(this.wagmiConfig,{connector:r,chainId:e?Number(e):void 0}),{clientId:await t.provider.client.core.crypto.getClientId()}}async connect(e){let{id:t,provider:r,type:i,info:n,chainId:s}=e,a=this.getWagmiConnector(t);if(!a)throw Error("connectionControllerClient:connectExternal - connector is undefined");r&&n&&a.id===t5.b.CONNECTOR_ID.EIP6963&&a.setEip6963Wallet?.({provider:r,info:n});let o=await tn(this.wagmiConfig,{connector:a,chainId:s?Number(s):void 0});return{address:o.accounts[0],chainId:o.chainId,provider:r,type:i,id:t}}async reconnect(e){let{id:t}=e,r=this.getWagmiConnector(t);if(!r)throw Error("connectionControllerClient:connectExternal - connector is undefined");await (0,ts.G)(this.wagmiConfig,{connectors:[r]})}async getBalance(e){let t=e.address,r=this.caipNetworks?.find(t=>t.id===e.chainId);if(!t)return Promise.resolve({balance:"0.00",symbol:"ETH"});if(r&&this.wagmiConfig){let t=`${r.caipNetworkId}:${e.address}`,i=this.balancePromises[t];if(i)return i;let n=t9.M.getNativeBalanceCacheForCaipAddress(t);return n?{balance:n.balance,symbol:n.symbol}:(this.balancePromises[t]=new Promise(async i=>{let n=Number(e.chainId),s=await (0,ta.s)(this.wagmiConfig,{address:e.address,chainId:n,token:e.tokens?.[r.caipNetworkId]?.address});t9.M.updateNativeBalanceCache({caipAddress:t,balance:s.formatted,symbol:s.symbol,timestamp:Date.now()}),i({balance:s.formatted,symbol:s.symbol})}).finally(()=>{delete this.balancePromises[t]}),this.balancePromises[t]||{balance:"0.00",symbol:"ETH"})}return{balance:"",symbol:""}}async getProfile(e){let t=e.chainId,r=await function(e,t){let{chainId:r,...i}=t,n=e.getClient({chainId:r});return(0,ey.s)(n,to,"getEnsName")(i)}(this.wagmiConfig,{address:e.address,chainId:t});if(r){let e=await function(e,t){let{chainId:r,...i}=t,n=e.getClient({chainId:r});return(0,ey.s)(n,tS,"getEnsAvatar")(i)}(this.wagmiConfig,{name:r,chainId:t});return{profileName:r,profileImage:e??void 0}}return{profileName:void 0,profileImage:void 0}}getWalletConnectProvider(){return this.getWagmiConnector("walletConnect")?.provider}async disconnect(){let e=ti(this.wagmiConfig);await Promise.all(e.map(async e=>{let t=this.getWagmiConnector(e.connector.id);t&&await tN(this.wagmiConfig,{connector:t})}))}async switchNetwork(e){await tT(this.wagmiConfig,{chainId:e.caipNetwork.id}),await super.switchNetwork(e)}async getCapabilities(e){if(!this.wagmiConfig)throw Error("connectionControllerClient:getCapabilities - wagmiConfig is undefined");let t=ti(this.wagmiConfig)[0],r=t?this.getWagmiConnector(t.connector.id):null;if(!r)throw Error("connectionControllerClient:getCapabilities - connector is undefined");let i=await r.getProvider();if(!i)throw Error("connectionControllerClient:getCapabilities - provider is undefined");let n=i.session?.sessionProperties?.capabilities;if(n){let t=function(e){try{return JSON.parse(e)}catch(e){throw Error("Error parsing wallet capabilities")}}(n)[e];if(t)return t}return await i.request({method:"wallet_getCapabilities",params:[e]})}async grantPermissions(e){if(!this.wagmiConfig)throw Error("connectionControllerClient:grantPermissions - wagmiConfig is undefined");let t=ti(this.wagmiConfig)[0],r=t?this.getWagmiConnector(t.connector.id):null;if(!r)throw Error("connectionControllerClient:grantPermissions - connector is undefined");let i=await r.getProvider();if(!i)throw Error("connectionControllerClient:grantPermissions - provider is undefined");return i.request({method:"wallet_grantPermissions",params:e})}async revokePermissions(e){if(!this.wagmiConfig)throw Error("connectionControllerClient:revokePermissions - wagmiConfig is undefined");let t=ti(this.wagmiConfig)[0],r=t?this.getWagmiConnector(t.connector.id):null;if(!r)throw Error("connectionControllerClient:revokePermissions - connector is undefined");let i=await r.getProvider();if(!i)throw Error("connectionControllerClient:revokePermissions - provider is undefined");return i.request({method:"wallet_revokePermissions",params:e})}async walletGetAssets(e){if(!this.wagmiConfig)throw Error("connectionControllerClient:walletGetAssets - wagmiConfig is undefined");let t=ti(this.wagmiConfig)[0],r=t?this.getWagmiConnector(t.connector.id):null;if(!r)throw Error("connectionControllerClient:walletGetAssets - connector is undefined");let i=await r.getProvider();if(!i)throw Error("connectionControllerClient:walletGetAssets - provider is undefined");return i.request({method:"wallet_getAssets",params:[e]})}setUniversalProvider(e){this.addConnector(new ri.z({provider:e,caipNetworks:this.caipNetworks||[],namespace:"eip155"}))}}var rg=r(82433),rm=r(68597),rb=r(98200);let ry="df097becc0fd2ca8ae0252a1c659b40b";if(!ry)throw Error("Project ID is not defined");let rw=[rb.eGR,rb.pLm],rv=new rp({connectors:[U()],storage:W({storage:rg.Dr}),transports:{[rb.eGR.id]:(0,rm.d)("https://bnb-mainnet.g.alchemy.com/v2/9n9o547BVMuviF7PFSIYoxSt35dJtdCD"),[rb.pLm.id]:(0,rm.d)(rb.pLm.rpcUrls.default.http[0])},projectId:ry,ssr:!0,networks:rw})},85126:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return Z}});var i=r(85893);r(80876);var n=r(55678);r(11426);var s=r(67294),[a,o]=function(e={}){let{strict:t=!0,errorMessage:r="useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",name:i}=e,n=s.createContext(void 0);return n.displayName=i,[n.Provider,function e(){var i;let a=s.useContext(n);if(!a&&t){let t=Error(r);throw t.name="ContextError",null==(i=Error.captureStackTrace)||i.call(Error,t,e),t}return a},n]}({name:"ProviderContext",strict:!1});let c=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),l=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function u(e){if(Intl.Locale){let t=new Intl.Locale(e).maximize(),r="function"==typeof t.getTextInfo?t.getTextInfo():t.textInfo;if(r)return"rtl"===r.direction;if(t.script)return c.has(t.script)}let t=e.split("-")[0];return l.has(t)}let d={prefix:String(Math.round(1e10*Math.random())),current:0},h=(s.createContext(d),s.createContext(!1));function f(){return!1}function p(){return!0}function g(e){return()=>{}}"undefined"!=typeof window&&window.document&&window.document.createElement,new WeakMap,s.useId;let m=Symbol.for("react-aria.i18n.locale");function b(){let e="undefined"!=typeof window&&window[m]||"undefined"!=typeof navigator&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e="en-US"}return{locale:e,direction:u(e)?"rtl":"ltr"}}let y=b(),w=new Set;function v(){for(let e of(y=b(),w))e(y)}let A=s.createContext(null);function E(e){let{locale:t,children:r}=e,i=function(){let e="function"==typeof s.useSyncExternalStore?s.useSyncExternalStore(g,f,p):(0,s.useContext)(h),[t,r]=(0,s.useState)(y);return((0,s.useEffect)(()=>(0===w.size&&window.addEventListener("languagechange",v),w.add(r),()=>{w.delete(r),0===w.size&&window.removeEventListener("languagechange",v)}),[]),e)?{locale:"en-US",direction:"ltr"}:t}(),n=s.useMemo(()=>t?{locale:t,direction:u(t)?"rtl":"ltr"}:i,[i,t]);return s.createElement(A.Provider,{value:n},r)}let C=null;function _(e){var t;return"undefined"!=typeof window&&null!=window.navigator&&((null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.brands.some(t=>e.test(t.brand)))||e.test(window.navigator.userAgent))}function I(e){var t;return"undefined"!=typeof window&&null!=window.navigator&&e.test((null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.platform)||window.navigator.platform)}function S(e){let t=null;return()=>(null==t&&(t=e()),t)}let N=S(function(){return I(/^Mac/i)}),T=S(function(){return I(/^iPhone/i)}),P=S(function(){return I(/^iPad/i)||N()&&navigator.maxTouchPoints>1}),x=S(function(){return T()||P()});S(function(){return N()||x()});let O=S(function(){return _(/AppleWebKit/i)&&!R()}),R=S(function(){return _(/Chrome/i)});S(function(){return _(/Android/i)});let k=S(function(){return _(/Firefox/i)}),D=(0,s.createContext)({isNative:!0,open:function(e,t){L(e,e=>U(e,t))},useHref:e=>e});function M(e){let{children:t,navigate:r,useHref:i}=e,n=(0,s.useMemo)(()=>({isNative:!1,open:(e,t,i,n)=>{L(e,e=>{let s;(s=e.getAttribute("target"))&&"_self"!==s||e.origin!==location.origin||e.hasAttribute("download")||t.metaKey||t.ctrlKey||t.altKey||t.shiftKey?U(e,t):r(i,n)})},useHref:i||(e=>e)}),[r,i]);return s.createElement(D.Provider,{value:n},t)}function U(e,t,r=!0){var i,n;let{metaKey:s,ctrlKey:a,altKey:o,shiftKey:c}=t;k()&&(null===(n=window.event)||void 0===n?void 0:null===(i=n.type)||void 0===i?void 0:i.startsWith("key"))&&"_blank"===e.target&&(N()?s=!0:a=!0);let l=O()&&N()&&!P()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:s,ctrlKey:a,altKey:o,shiftKey:c}):new MouseEvent("click",{metaKey:s,ctrlKey:a,altKey:o,shiftKey:c,bubbles:!0,cancelable:!0});U.isOpening=r,function(e){if(function(){if(null==C){C=!1;try{document.createElement("div").focus({get preventScroll(){return C=!0,!0}})}catch{}}return C}())e.focus({preventScroll:!0});else{let t=function(e){let t=e.parentNode,r=[],i=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==i;)(t.offsetHeight({parent:r,modalCount:i,addModal(){n(e=>e+1),r&&r.addModal()},removeModal(){n(e=>e-1),r&&r.removeModal()}}),[r,i]);return s.createElement(B.Provider,{value:a},t)}function $(e){let t;let{modalProviderProps:r}={modalProviderProps:{"aria-hidden":!!(t=(0,s.useContext)(B))&&t.modalCount>0||void 0}};return s.createElement("div",{"data-overlay-container":!0,...e,...r})}function F(e){return s.createElement(j,null,s.createElement($,e))}var q=r(22081),z=r(16014),H=r(91492),W=r(96681);function V({children:e,isValidProp:t,...r}){t&&(0,H.K)(t),(r={...(0,s.useContext)(z._),...r}).isStatic=(0,W.h)(()=>r.isStatic);let n=(0,s.useMemo)(()=>r,[JSON.stringify(r.transition),r.transformPagePoint,r.reducedMotion]);return(0,i.jsx)(z._.Provider,{value:n,children:e})}var G=({children:e,navigate:t,disableAnimation:r,useHref:n,disableRipple:o=!1,skipFramerMotionAnimations:c=r,reducedMotion:l="never",validationBehavior:u,locale:d="en-US",defaultDates:h,createCalendar:f,...p})=>{let g=e;t&&(g=(0,i.jsx)(M,{navigate:t,useHref:n,children:g}));let m=(0,s.useMemo)(()=>(r&&c&&(q.c.skipAnimations=!0),{createCalendar:f,defaultDates:h,disableAnimation:r,disableRipple:o,validationBehavior:u}),[f,null==h?void 0:h.maxDate,null==h?void 0:h.minDate,r,o,u]);return(0,i.jsx)(a,{value:m,children:(0,i.jsx)(E,{locale:d,children:(0,i.jsx)(V,{reducedMotion:l,children:(0,i.jsx)(F,{...p,children:g})})})})};let K=(0,s.createContext)(void 0),Q=e=>{let{children:t}=e,[r,n]=(0,s.useState)("Solana"),a=s.useMemo(()=>({activeChain:r,setActiveChain:n}),[r,n]);return(0,i.jsx)(K.Provider,{value:a,children:t})};var Y=r(29714);function Z(e){let{Component:t,pageProps:r}=e;return(0,i.jsx)(Y.default,{children:(0,i.jsxs)(G,{children:[(0,i.jsx)(Q,{children:(0,i.jsx)(t,{...r})}),(0,i.jsx)(n.Ix,{autoClose:3e3})]})})}},29714:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return N},modal:function(){return S},queryClient:function(){return _}});var i=r(85893),n=r(67294),s=r(24139),a=r(56888),o=r(27037),c=r(7506),l=class extends c.l{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,r){let i=t.queryKey,n=t.queryHash??(0,s.Rm)(i,t),o=this.get(n);return o||(o=new a.A({client:e,queryKey:i,queryHash:n,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){o.Vr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,s._x)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,s._x)(e,t)):t}notify(e){o.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){o.Vr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){o.Vr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},u=r(59289),d=class extends c.l{constructor(e={}){super(),this.config=e,this.#t=new Set,this.#r=new Map,this.#i=0}#t;#r;#i;build(e,t,r){let i=new u.m({mutationCache:this,mutationId:++this.#i,options:e.defaultMutationOptions(t),state:r});return this.add(i),i}add(e){this.#t.add(e);let t=h(e);if("string"==typeof t){let r=this.#r.get(t);r?r.push(e):this.#r.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#t.delete(e)){let t=h(e);if("string"==typeof t){let r=this.#r.get(t);if(r){if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#r.delete(t)}}}this.notify({type:"removed",mutation:e})}canRun(e){let t=h(e);if("string"!=typeof t)return!0;{let r=this.#r.get(t),i=r?.find(e=>"pending"===e.state.status);return!i||i===e}}runNext(e){let t=h(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#r.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){o.Vr.batch(()=>{this.#t.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#t.clear(),this.#r.clear()})}getAll(){return Array.from(this.#t)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,s.X7)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,s.X7)(e,t))}notify(e){o.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return o.Vr.batch(()=>Promise.all(e.map(e=>e.continue().catch(s.ZT))))}};function h(e){return e.options.scope?.id}var f=r(66474),p=r(14304);function g(e){return{onFetch:(t,r)=>{let i=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],c={pages:[],pageParams:[]},l=0,u=async()=>{let r=!1,u=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?r=!0:t.signal.addEventListener("abort",()=>{r=!0}),t.signal)})},d=(0,s.cG)(t.options,t.fetchOptions),h=async(e,i,n)=>{if(r)return Promise.reject();if(null==i&&e.pages.length)return Promise.resolve(e);let a={client:t.client,queryKey:t.queryKey,pageParam:i,direction:n?"backward":"forward",meta:t.options.meta};u(a);let o=await d(a),{maxPages:c}=t.options,l=n?s.Ht:s.VX;return{pages:l(e.pages,o,c),pageParams:l(e.pageParams,i,c)}};if(n&&a.length){let e="backward"===n,t={pages:a,pageParams:o},r=(e?function(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}:m)(i,t);c=await h(t,r,e)}else{let t=e??a.length;do{let e=0===l?o[0]??i.initialPageParam:m(i,c);if(l>0&&null==e)break;c=await h(c,e),l++}while(lt.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u}}}function m(e,{pages:t,pageParams:r}){let i=t.length-1;return t.length>0?e.getNextPageParam(t[i],t,r[i],r):void 0}var b=class{#n;#s;#a;#o;#c;#l;#u;#d;constructor(e={}){this.#n=e.queryCache||new l,this.#s=e.mutationCache||new d,this.#a=e.defaultOptions||{},this.#o=new Map,this.#c=new Map,this.#l=0}mount(){this.#l++,1===this.#l&&(this.#u=f.j.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#n.onFocus())}),this.#d=p.N.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#n.onOnline())}))}unmount(){this.#l--,0===this.#l&&(this.#u?.(),this.#u=void 0,this.#d?.(),this.#d=void 0)}isFetching(e){return this.#n.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#s.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#n.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#n.build(this,t),i=r.state.data;return void 0===i?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime((0,s.KC)(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(i))}getQueriesData(e){return this.#n.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let i=this.defaultQueryOptions({queryKey:e}),n=this.#n.get(i.queryHash),a=n?.state.data,o=(0,s.SE)(t,a);if(void 0!==o)return this.#n.build(this,i).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return o.Vr.batch(()=>this.#n.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#n.get(t.queryHash)?.state}removeQueries(e){let t=this.#n;o.Vr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#n;return o.Vr.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:!0,...t};return Promise.all(o.Vr.batch(()=>this.#n.findAll(e).map(e=>e.cancel(r)))).then(s.ZT).catch(s.ZT)}invalidateQueries(e,t={}){return o.Vr.batch(()=>(this.#n.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(o.Vr.batch(()=>this.#n.findAll(e).filter(e=>!e.isDisabled()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(s.ZT)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(s.ZT)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#n.build(this,t);return r.isStaleByTime((0,s.KC)(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(s.ZT).catch(s.ZT)}fetchInfiniteQuery(e){return e.behavior=g(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(s.ZT).catch(s.ZT)}ensureInfiniteQueryData(e){return e.behavior=g(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return p.N.isOnline()?this.#s.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#n}getMutationCache(){return this.#s}getDefaultOptions(){return this.#a}setDefaultOptions(e){this.#a=e}setQueryDefaults(e,t){this.#o.set((0,s.Ym)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#o.values()],r={};return t.forEach(t=>{(0,s.to)(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#c.set((0,s.Ym)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#c.values()],r={};return t.forEach(t=>{(0,s.to)(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#a.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,s.Rm)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===s.CN&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#a.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#n.clear(),this.#s.clear()}},y=r(30202),w=r(82020),v=r(82433),A=r(49739),E=r(10198),C=r(17323);let _=new b,I="df097becc0fd2ca8ae0252a1c659b40b";if(!I)throw Error("Project ID is not defined");let S=(0,w.cz)({adapters:[E.H],projectId:I,networks:E.Q,metadata:{name:"LFG Ecosystem",description:"Buy, Stake, and Earn with LFG",url:"https://lfg.eco",icons:["https://lfg.eco/icons/logo.png"]},themeMode:"dark",features:{swaps:!0,send:!0,receive:!0,onramp:!0,connectMethodsOrder:["wallet"],analytics:!0},themeVariables:{"--w3m-accent":"#228C22","--w3m-color-mix":"#080807","--w3m-border-radius-master":"10px","--w3m-color-mix-strength":10,"--w3m-font-size-master":"10px"}});var N=e=>{let{children:t}=e,r=(0,v.jx)(E.H.wagmiConfig,null),[s,a]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{a(!0)},[]),(0,i.jsx)(i.Fragment,{children:s&&(0,i.jsx)(A.F,{config:E.H.wagmiConfig,initialState:r,reconnectOnMount:!1,children:(0,i.jsxs)(y.aH,{client:_,children:[(0,i.jsx)(C.default,{}),t]})})})}},17323:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return o}});var i=r(67294),n=r(39332),s=r(80419),a=r(49321);function o(){let e=(0,n.useSearchParams)();return(0,i.useEffect)(()=>{let t=e.get("ref");t?(console.log("ReferralListener detected ref:",t),(0,a.U)(t,{strict:!1})&&(0,s.r)(t)):console.log("No referral code in URL")},[e]),null}},11426:function(){},80876:function(){},39332:function(e,t,r){e.exports=r(8199)},34155:function(e){var t,r,i,n=e.exports={};function s(){throw Error("setTimeout has not been defined")}function a(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var c=[],l=!1,u=-1;function d(){l&&i&&(l=!1,i.length?c=i.concat(c):u=-1,c.length&&h())}function h(){if(!l){var e=o(d);l=!0;for(var t=c.length;t;){for(i=c,c=[];++u1)for(var r=1;rnew Proxy(e,t),a=Object.getPrototypeOf,o=new WeakMap,c=e=>e&&(o.has(e)?o.get(e):a(e)===Object.prototype||a(e)===Array.prototype),l=e=>"object"==typeof e&&null!==e,u=e=>{if(Array.isArray(e))return Array.from(e);let t=Object.getOwnPropertyDescriptors(e);return Object.values(t).forEach(e=>{e.configurable=!0}),Object.create(a(e),t)},d=e=>e[n]||e,h=(e,t,r,a)=>{if(!c(e))return e;let o=a&&a.get(e);if(!o){let t=d(e);o=Object.values(Object.getOwnPropertyDescriptors(t)).some(e=>!e.configurable&&!e.writable)?[t,u(t)]:[t],null==a||a.set(e,o)}let[l,f]=o,p=r&&r.get(l);return p&&!!f===p[1].f||((p=((e,t)=>{let r={f:t},s=!1,a=(t,i)=>{if(!s){let n=r.a.get(e);if(n||(n={},r.a.set(e,n)),"w"===t)n.w=!0;else{let e=n[t];e||(e=new Set,n[t]=e),e.add(i)}}},o={get:(t,i)=>i===n?e:(a("k",i),h(Reflect.get(t,i),r.a,r.c,r.t)),has:(t,n)=>n===i?(s=!0,r.a.delete(e),!0):(a("h",n),Reflect.has(t,n)),getOwnPropertyDescriptor:(e,t)=>(a("o",t),Reflect.getOwnPropertyDescriptor(e,t)),ownKeys:e=>(a("w"),Reflect.ownKeys(e))};return t&&(o.set=o.deleteProperty=()=>!1),[o,r]})(l,!!f))[1].p=s(f||l,p[0]),r&&r.set(l,p)),p[1].a=t,p[1].c=r,p[1].t=a,p[1].p},f=(e,t,r,i,n=Object.is)=>{if(n(e,t))return!1;if(!l(e)||!l(t))return!0;let s=r.get(d(e));if(!s)return!0;if(i){let r=i.get(e);if(r&&r.n===t)return r.g;i.set(e,{n:t,g:!1})}let a=null;try{for(let r of s.h||[])if(a=Reflect.has(e,r)!==Reflect.has(t,r))return a;if(!0===s.w){if(a=((e,t)=>{let r=Reflect.ownKeys(e),i=Reflect.ownKeys(t);return r.length!==i.length||r.some((e,t)=>e!==i[t])})(e,t))return a}else for(let r of s.o||[])if(a=!!Reflect.getOwnPropertyDescriptor(e,r)!=!!Reflect.getOwnPropertyDescriptor(t,r))return a;for(let o of s.k||[])if(a=f(e[o],t[o],r,i,n))return a;return null===a&&(a=!0),a}finally{i&&i.set(e,{n:t,g:a})}},p=e=>c(e)&&e[n]||null,g=(e,t=!0)=>{o.set(e,t)},m=(e,t,r)=>{let i=[],n=new WeakSet,s=(e,a)=>{if(n.has(e))return;l(e)&&n.add(e);let o=l(e)&&t.get(d(e));if(o){var c,u,h;if(null==(c=o.h)||c.forEach(e=>{let t=`:has(${String(e)})`;i.push(a?[...a,t]:[t])}),!0===o.w){let e=":ownKeys";i.push(a?[...a,e]:[e])}else null==(h=o.o)||h.forEach(e=>{let t=`:hasOwn(${String(e)})`;i.push(a?[...a,t]:[t])});null==(u=o.k)||u.forEach(t=>{(!r||"value"in(Object.getOwnPropertyDescriptor(e,t)||{}))&&s(e[t],a?[...a,t]:[t])})}else a&&i.push(a)};return s(e),i}},85346:function(e){"use strict";function t(e){try{return JSON.stringify(e)}catch(e){return'"[Circular]"'}}e.exports=function(e,r,i){var n=i&&i.stringify||t;if("object"==typeof e&&null!==e){var s=r.length+1;if(1===s)return e;var a=Array(s);a[0]=n(e);for(var o=1;o-1?d:0,e.charCodeAt(f+1)){case 100:case 102:if(u>=c||null==r[u])break;d=c||null==r[u])break;d=c||void 0===r[u])break;d",d=f+2,f++;break}l+=n(r[u]),d=f+2,f++;break;case 115:if(u>=c)break;d-1&&(m=!1),"function"==typeof u&&(u.error=u.fatal=u.warn=u.info=u.debug=u.trace=u),!1===e.enabled&&(e.level="silent");let b=e.level||"info",y=Object.create(u);y.log||(y.log=h),Object.defineProperty(y,"levelVal",{get:function(){return"silent"===this.level?1/0:this.levels.values[this.level]}}),Object.defineProperty(y,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,a(w,y,"error","log"),a(w,y,"fatal","error"),a(w,y,"warn","error"),a(w,y,"info","log"),a(w,y,"debug","log"),a(w,y,"trace","log")}});let w={transmit:i,serialize:g,asObject:e.browser.asObject,levels:["error","fatal","warn","info","debug","trace"],timestamp:"function"==typeof(r=e).timestamp?r.timestamp:!1===r.timestamp?f:p};return y.levels=s.levels,y.level=b,y.setMaxListeners=y.getMaxListeners=y.emit=y.addListener=y.on=y.prependListener=y.once=y.prependOnceListener=y.removeListener=y.removeAllListeners=y.listeners=y.listenerCount=y.eventNames=y.write=y.flush=h,y.serializers=d,y._serialize=g,y._stdErrSerialize=m,y.child=function(t,r){if(!t)throw Error("missing bindings for child Pino");r=r||{},g&&t.serializers&&(r.serializers=t.serializers);let n=r.serializers;if(g&&n){var s=Object.assign({},d,n),a=!0===e.browser.serialize?Object.keys(s):g;delete t.serializers,o([t],a,s,this._stdErrSerialize)}function u(e){this._childLevel=(0|e._childLevel)+1,this.error=c(e,t,"error"),this.fatal=c(e,t,"fatal"),this.warn=c(e,t,"warn"),this.info=c(e,t,"info"),this.debug=c(e,t,"debug"),this.trace=c(e,t,"trace"),s&&(this.serializers=s,this._serialize=a),i&&(this._logEvent=l([].concat(e._logEvent.bindings,t)))}return u.prototype=this,new u(this)},i&&(y._logEvent=l()),y}function a(e,t,r,a){let c=Object.getPrototypeOf(t);t[r]=t.levelVal>t.levels.values[r]?h:c[r]?c[r]:n[r]||n[a]||h,function(e,t,r){if(e.transmit||t[r]!==h){var a;t[r]=(a=t[r],function(){let c=e.timestamp(),u=Array(arguments.length),d=Object.getPrototypeOf&&Object.getPrototypeOf(this)===n?n:this;for(var h=0;h-1&&i in r&&(e[n][i]=r[i](e[n][i]))}function c(e,t,r){return function(){let i=Array(1+arguments.length);i[0]=t;for(var n=1;nc[e],getYear:(e=new Date().toISOString())=>i(e).year(),getRelativeDateFromNow:e=>i(e).locale("en-web3-modal").fromNow(!0),formatDate:(e,t="DD MMM")=>i(e).format(t)}},27777:function(e,t,r){"use strict";r.d(t,{p:function(){return i}});let i={caipNetworkIdToNumber:e=>e?Number(e.split(":")[1]):void 0,parseEvmChainId(e){return"string"==typeof e?this.caipNetworkIdToNumber(e):e},getNetworksByNamespace:(e,t)=>e?.filter(e=>e.chainNamespace===t)||[],getFirstNetworkByNamespace(e,t){return this.getNetworksByNamespace(e,t)[0]}}},62411:function(e,t,r){"use strict";r.d(t,{C:function(){return p}});var i="[big.js] ",n=i+"Invalid ",s=n+"decimal places",a=n+"rounding mode",o=i+"Division by zero",c={},l=void 0,u=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function d(e,t,r,i){var n=e.c;if(r===l&&(r=e.constructor.RM),0!==r&&1!==r&&2!==r&&3!==r)throw Error(a);if(t<1)i=3===r&&(i||!!n[0])||0===t&&(1===r&&n[0]>=5||2===r&&(n[0]>5||5===n[0]&&(i||n[1]!==l))),n.length=1,i?(e.e=e.e-t+1,n[0]=1):n[0]=e.e=0;else if(t=5||2===r&&(n[t]>5||5===n[t]&&(i||n[t+1]!==l||1&n[t-1]))||3===r&&(i||!!n[0]),n.length=t,i){for(;++n[--t]>9;)if(n[t]=0,0===t){++e.e,n.unshift(1);break}}for(t=n.length;!n[--t];)n.pop()}return e}function h(e,t,r){var i=e.e,n=e.c.join(""),s=n.length;if(t)n=n.charAt(0)+(s>1?"."+n.slice(1):"")+(i<0?"e":"e+")+i;else if(i<0){for(;++i;)n="0"+n;n="0."+n}else if(i>0){if(++i>s)for(i-=s;i--;)n+="0";else i1&&(n=n.charAt(0)+"."+n.slice(1));return e.s<0&&r?"-"+n:n}c.abs=function(){var e=new this.constructor(this);return e.s=1,e},c.cmp=function(e){var t,r=this.c,i=(e=new this.constructor(e)).c,n=this.s,s=e.s,a=this.e,o=e.e;if(!r[0]||!i[0])return r[0]?n:i[0]?-s:0;if(n!=s)return n;if(t=n<0,a!=o)return a>o^t?1:-1;for(n=-1,s=(a=r.length)<(o=i.length)?a:o;++ni[n]^t?1:-1;return a==o?0:a>o^t?1:-1},c.div=function(e){var t=this.constructor,r=this.c,i=(e=new t(e)).c,n=this.s==e.s?1:-1,a=t.DP;if(a!==~~a||a<0||a>1e6)throw Error(s);if(!i[0])throw Error(o);if(!r[0])return e.s=n,e.c=[e.e=0],e;var c,u,h,f,p,g=i.slice(),m=c=i.length,b=r.length,y=r.slice(0,c),w=y.length,v=e,A=v.c=[],E=0,C=a+(v.e=this.e-e.e)+1;for(v.s=n,n=C<0?0:C,g.unshift(0);w++w?1:-1;else for(p=-1,f=0;++py[p]?1:-1;break}if(f<0){for(u=w==c?i:g;w;){if(y[--w]C&&d(v,C,t.RM,y[0]!==l),v},c.eq=function(e){return 0===this.cmp(e)},c.gt=function(e){return this.cmp(e)>0},c.gte=function(e){return this.cmp(e)>-1},c.lt=function(e){return 0>this.cmp(e)},c.lte=function(e){return 1>this.cmp(e)},c.minus=c.sub=function(e){var t,r,i,n,s=this.constructor,a=this.s,o=(e=new s(e)).s;if(a!=o)return e.s=-o,this.plus(e);var c=this.c.slice(),l=this.e,u=e.c,d=e.e;if(!c[0]||!u[0])return u[0]?e.s=-o:c[0]?e=new s(this):e.s=1,e;if(a=l-d){for((n=a<0)?(a=-a,i=c):(d=l,i=u),i.reverse(),o=a;o--;)i.push(0);i.reverse()}else for(r=((n=c.length0)for(;o--;)c[t++]=0;for(o=t;r>a;){if(c[--r]0?(o=s,i=c):(t=-t,i=a),i.reverse();t--;)i.push(0);i.reverse()}for(a.length-c.length<0&&(i=c,c=a,a=i),t=c.length,r=0;t;a[t]%=10)r=(a[--t]=a[t]+c[t]+r)/10|0;for(r&&(a.unshift(r),++o),t=a.length;0===a[--t];)a.pop();return e.c=a,e.e=o,e},c.pow=function(e){var t=this,r=new t.constructor("1"),i=r,s=e<0;if(e!==~~e||e<-1e6||e>1e6)throw Error(n+"exponent");for(s&&(e=-e);1&e&&(i=i.times(t)),e>>=1;)t=t.times(t);return s?r.div(i):i},c.prec=function(e,t){if(e!==~~e||e<1||e>1e6)throw Error(n+"precision");return d(new this.constructor(this),e,t)},c.round=function(e,t){if(e===l)e=0;else if(e!==~~e||e<-1e6||e>1e6)throw Error(s);return d(new this.constructor(this),e+this.e+1,t)},c.sqrt=function(){var e,t,r,n=this.constructor,s=this.s,a=this.e,o=new n("0.5");if(!this.c[0])return new n(this);if(s<0)throw Error(i+"No square root");0===(s=Math.sqrt(+h(this,!0,!0)))||s===1/0?((t=this.c.join("")).length+a&1||(t+="0"),a=((a+1)/2|0)-(a<0||1&a),e=new n(((s=Math.sqrt(t))==1/0?"5e":(s=s.toExponential()).slice(0,s.indexOf("e")+1))+a)):e=new n(s+""),a=e.e+(n.DP+=4);do r=e,e=o.times(r.plus(this.div(r)));while(r.c.slice(0,a).join("")!==e.c.slice(0,a).join(""));return d(e,(n.DP-=4)+e.e+1,n.RM)},c.times=c.mul=function(e){var t,r=this.constructor,i=this.c,n=(e=new r(e)).c,s=i.length,a=n.length,o=this.e,c=e.e;if(e.s=this.s==e.s?1:-1,!i[0]||!n[0])return e.c=[e.e=0],e;for(e.e=o+c,so;)a=t[c]+n[o]*i[c-o-1]+a,t[c--]=a%10,a=a/10|0;t[c]=a}for(a?++e.e:t.shift(),o=t.length;!t[--o];)t.pop();return e.c=t,e},c.toExponential=function(e,t){var r=this,i=r.c[0];if(e!==l){if(e!==~~e||e<0||e>1e6)throw Error(s);for(r=d(new r.constructor(r),++e,t);r.c.length1e6)throw Error(s);for(r=d(new r.constructor(r),e+r.e+1,t),e=e+r.e+1;r.c.length=e.PE,!!this.c[0])},c.toNumber=function(){var e=+h(this,!0,!0);if(!0===this.constructor.strict&&!this.eq(e.toString()))throw Error(i+"Imprecise conversion");return e},c.toPrecision=function(e,t){var r=this,i=r.constructor,s=r.c[0];if(e!==l){if(e!==~~e||e<1||e>1e6)throw Error(n+"precision");for(r=d(new i(r),e,t);r.c.length=i.PE,!!s)},c.valueOf=function(){var e=this.constructor;if(!0===e.strict)throw Error(i+"valueOf disallowed");return h(this,this.e<=e.NE||this.e>=e.PE,!0)};var f=function e(){function t(r){if(!(this instanceof t))return r===l?e():new t(r);if(r instanceof t)this.s=r.s,this.e=r.e,this.c=r.c.slice();else{if("string"!=typeof r){if(!0===t.strict&&"bigint"!=typeof r)throw TypeError(n+"value");r=0===r&&1/r<0?"-0":String(r)}!function(e,t){var r,i,s;if(!u.test(t))throw Error(n+"number");for(e.s="-"==t.charAt(0)?(t=t.slice(1),-1):1,(r=t.indexOf("."))>-1&&(t=t.replace(".","")),(i=t.search(/e/i))>0?(r<0&&(r=i),r+=+t.slice(i+1),t=t.substring(0,i)):r<0&&(r=t.length),s=t.length,i=0;i0&&"0"==t.charAt(--s););for(e.e=r-i-1,e.c=[],r=0;i<=s;)e.c[r++]=+t.charAt(i++)}}(this,r)}this.constructor=t}return t.prototype=c,t.DP=20,t.RM=1,t.NE=-7,t.PE=21,t.strict=!1,t.roundDown=0,t.roundHalfUp=1,t.roundHalfEven=2,t.roundUp=3,t}();let p={bigNumber:e=>new f(e||0),multiply(e,t){if(void 0===e||void 0===t)return new f(0);let r=new f(e),i=new f(t);return r.times(i)},formatNumberToLocalString:(e,t=2)=>void 0===e?"0.00":"number"==typeof e?e.toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t}):parseFloat(e).toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t}),parseLocalStringToNumber:e=>void 0===e?0:parseFloat(e.replace(/,/gu,""))}},35855:function(e,t,r){"use strict";r.d(t,{$U:function(){return a},Vk:function(){return n},mr:function(){return s},uJ:function(){return i}});let i={WALLET_ID:"@appkit/wallet_id",WALLET_NAME:"@appkit/wallet_name",SOLANA_WALLET:"@appkit/solana_wallet",SOLANA_CAIP_CHAIN:"@appkit/solana_caip_chain",ACTIVE_CAIP_NETWORK_ID:"@appkit/active_caip_network_id",CONNECTED_SOCIAL:"@appkit/connected_social",CONNECTED_SOCIAL_USERNAME:"@appkit-wallet/SOCIAL_USERNAME",RECENT_WALLETS:"@appkit/recent_wallets",DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",ACTIVE_NAMESPACE:"@appkit/active_namespace",CONNECTED_NAMESPACES:"@appkit/connected_namespaces",CONNECTION_STATUS:"@appkit/connection_status",SIWX_AUTH_TOKEN:"@appkit/siwx-auth-token",SIWX_NONCE_TOKEN:"@appkit/siwx-nonce-token",TELEGRAM_SOCIAL_PROVIDER:"@appkit/social_provider",NATIVE_BALANCE_CACHE:"@appkit/native_balance_cache",PORTFOLIO_CACHE:"@appkit/portfolio_cache",ENS_CACHE:"@appkit/ens_cache",IDENTITY_CACHE:"@appkit/identity_cache"};function n(e){if(!e)throw Error("Namespace is required for CONNECTED_CONNECTOR_ID");return`@appkit/${e}:connected_connector_id`}let s={setItem(e,t){a()&&void 0!==t&&localStorage.setItem(e,t)},getItem(e){if(a())return localStorage.getItem(e)||void 0},removeItem(e){a()&&localStorage.removeItem(e)},clear(){a()&&localStorage.clear()}};function a(){return"undefined"!=typeof window&&"undefined"!=typeof localStorage}},45374:function(e,t,r){"use strict";function i(e,t){return"light"===t?{"--w3m-accent":e?.["--w3m-accent"]||"hsla(231, 100%, 70%, 1)","--w3m-background":"#fff"}:{"--w3m-accent":e?.["--w3m-accent"]||"hsla(230, 100%, 67%, 1)","--w3m-background":"#121313"}}r.d(t,{t:function(){return i}})},83966:function(e,t,r){"use strict";r.d(t,{AccountController:function(){return h}});var i=r(86949),n=r(47205),s=r(83241),a=r(2446),o=r(66691),c=r(46313),l=r(82879),u=r(74741);let d=(0,i.sj)({currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,allAccounts:[]}),h={state:d,replaceState(e){e&&Object.assign(d,(0,i.iH)(e))},subscribe:e=>c.R.subscribeChainProp("accountState",t=>{if(t)return e(t)}),subscribeKey(e,t,r){let i;return c.R.subscribeChainProp("accountState",r=>{if(r){let n=r[e];i!==n&&(i=n,t(n))}},r)},setStatus(e,t){c.R.setAccountProp("status",e,t)},getCaipAddress:e=>c.R.getAccountProp("caipAddress",e),setCaipAddress(e,t){let r=e?s.j.getPlainAddress(e):void 0;t===c.R.state.activeChain&&(c.R.state.activeCaipAddress=e),c.R.setAccountProp("caipAddress",e,t),c.R.setAccountProp("address",r,t)},setBalance(e,t,r){c.R.setAccountProp("balance",e,r),c.R.setAccountProp("balanceSymbol",t,r)},setProfileName(e,t){c.R.setAccountProp("profileName",e,t)},setProfileImage(e,t){c.R.setAccountProp("profileImage",e,t)},setUser(e,t){c.R.setAccountProp("user",e,t)},setAddressExplorerUrl(e,t){c.R.setAccountProp("addressExplorerUrl",e,t)},setSmartAccountDeployed(e,t){c.R.setAccountProp("smartAccountDeployed",e,t)},setCurrentTab(e){c.R.setAccountProp("currentTab",e,c.R.state.activeChain)},setTokenBalance(e,t){e&&c.R.setAccountProp("tokenBalance",e,t)},setShouldUpdateToAddress(e,t){c.R.setAccountProp("shouldUpdateToAddress",e,t)},setAllAccounts(e,t){c.R.setAccountProp("allAccounts",e,t)},addAddressLabel(e,t,r){let i=c.R.getAccountProp("addressLabels",r)||new Map;i.set(e,t),c.R.setAccountProp("addressLabels",i,r)},removeAddressLabel(e,t){let r=c.R.getAccountProp("addressLabels",t)||new Map;r.delete(e),c.R.setAccountProp("addressLabels",r,t)},setConnectedWalletInfo(e,t){c.R.setAccountProp("connectedWalletInfo",e,t,!1)},setPreferredAccountType(e,t){c.R.setAccountProp("preferredAccountType",e,t)},setSocialProvider(e,t){e&&c.R.setAccountProp("socialProvider",e,t)},setSocialWindow(e,t){c.R.setAccountProp("socialWindow",e?(0,i.iH)(e):void 0,t)},setFarcasterUrl(e,t){c.R.setAccountProp("farcasterUrl",e,t)},async fetchTokenBalance(e){d.balanceLoading=!0;let t=c.R.state.activeCaipNetwork?.caipNetworkId,r=c.R.state.activeCaipNetwork?.chainNamespace,i=c.R.state.activeCaipAddress,h=i?s.j.getPlainAddress(i):void 0;if(d.lastRetry&&!s.j.isAllowedRetry(d.lastRetry,30*n.bq.ONE_SEC_MS))return d.balanceLoading=!1,[];try{if(h&&t&&r){let e=await o.L.getBalance(h,t),i=e.balances.filter(e=>"0"!==e.quantity.decimals);return this.setTokenBalance(i,r),u.nY.setBalances(a.n.mapBalancesToSwapTokens(e.balances)),d.lastRetry=void 0,d.balanceLoading=!1,i}}catch(t){d.lastRetry=Date.now(),e?.(t),l.SnackController.showError("Token Balance Unavailable")}finally{d.balanceLoading=!1}return[]},resetAccount(e){c.R.resetAccount(e)}}},56008:function(e,t,r){"use strict";r.d(t,{AlertController:function(){return o}});var i=r(86949),n=r(73932),s=r(77500);let a=(0,i.sj)({message:"",variant:"info",open:!1}),o={state:a,subscribeKey:(e,t)=>(0,n.VW)(a,e,t),open(e,t){let{debug:r}=s.OptionsController.state,{shortMessage:i,longMessage:n}=e;r&&(a.message=i,a.variant=t,a.open=!0),n&&console.error("function"==typeof n?n():n)},close(){a.open=!1,a.message="",a.variant="info"}}},48113:function(e,t,r){"use strict";r.d(t,{ApiController:function(){return b}});var i=r(86949),n=r(73932),s=r(44639),a=r(83241),o=r(28356),c=r(64125),l=r(87374),u=r(46313),d=r(33734),h=r(51440),f=r(77500);let p=a.j.getApiUrl(),g=new o.V({baseUrl:p,clientId:null}),m=(0,i.sj)({promises:{},page:1,count:0,featured:[],allFeatured:[],recommended:[],allRecommended:[],wallets:[],search:[],isAnalyticsEnabled:!1,excludedRDNS:[],isFetchingRecommendedWallets:!1}),b={state:m,subscribeKey:(e,t)=>(0,n.VW)(m,e,t),_getSdkProperties(){let{projectId:e,sdkType:t,sdkVersion:r}=f.OptionsController.state;return{projectId:e,st:t||"appkit",sv:r||"html-wagmi-4.2.2"}},_filterOutExtensions:e=>f.OptionsController.state.isUniversalProvider?e.filter(e=>!!(e.mobile_link||e.desktop_link||e.webapp_link)):e,async _fetchWalletImage(e){let t=`${g.baseUrl}/getWalletImage/${e}`,r=await g.getBlob({path:t,params:b._getSdkProperties()});l.W.setWalletImage(e,URL.createObjectURL(r))},async _fetchNetworkImage(e){let t=`${g.baseUrl}/public/getAssetImage/${e}`,r=await g.getBlob({path:t,params:b._getSdkProperties()});l.W.setNetworkImage(e,URL.createObjectURL(r))},async _fetchConnectorImage(e){let t=`${g.baseUrl}/public/getAssetImage/${e}`,r=await g.getBlob({path:t,params:b._getSdkProperties()});l.W.setConnectorImage(e,URL.createObjectURL(r))},async _fetchCurrencyImage(e){let t=`${g.baseUrl}/public/getCurrencyImage/${e}`,r=await g.getBlob({path:t,params:b._getSdkProperties()});l.W.setCurrencyImage(e,URL.createObjectURL(r))},async _fetchTokenImage(e){let t=`${g.baseUrl}/public/getTokenImage/${e}`,r=await g.getBlob({path:t,params:b._getSdkProperties()});l.W.setTokenImage(e,URL.createObjectURL(r))},async fetchNetworkImages(){let e=u.R.getAllRequestedCaipNetworks(),t=e?.map(({assets:e})=>e?.imageId).filter(Boolean).filter(e=>!s.f.getNetworkImageById(e));t&&await Promise.allSettled(t.map(e=>b._fetchNetworkImage(e)))},async fetchConnectorImages(){let{connectors:e}=d.ConnectorController.state,t=e.map(({imageId:e})=>e).filter(Boolean);await Promise.allSettled(t.map(e=>b._fetchConnectorImage(e)))},async fetchCurrencyImages(e=[]){await Promise.allSettled(e.map(e=>b._fetchCurrencyImage(e)))},async fetchTokenImages(e=[]){await Promise.allSettled(e.map(e=>b._fetchTokenImage(e)))},async fetchFeaturedWallets(){let{featuredWalletIds:e}=f.OptionsController.state;if(e?.length){let{data:t}=await g.get({path:"/getWallets",params:{...b._getSdkProperties(),page:"1",entries:e?.length?String(e.length):"4",include:e?.join(",")}});t.sort((t,r)=>e.indexOf(t.id)-e.indexOf(r.id));let r=t.map(e=>e.image_id).filter(Boolean);await Promise.allSettled(r.map(e=>b._fetchWalletImage(e))),m.featured=t,m.allFeatured=t}},async fetchRecommendedWallets(){try{m.isFetchingRecommendedWallets=!0;let{includeWalletIds:e,excludeWalletIds:t,featuredWalletIds:r}=f.OptionsController.state,i=[...t??[],...r??[]].filter(Boolean),n=u.R.getRequestedCaipNetworkIds().join(","),{data:s,count:a}=await g.get({path:"/getWallets",params:{...b._getSdkProperties(),page:"1",chains:n,entries:"4",include:e?.join(","),exclude:i?.join(",")}}),o=c.M.getRecentWallets(),l=s.map(e=>e.image_id).filter(Boolean),d=o.map(e=>e.image_id).filter(Boolean);await Promise.allSettled([...l,...d].map(e=>b._fetchWalletImage(e))),m.recommended=s,m.allRecommended=s,m.count=a??0}catch{}finally{m.isFetchingRecommendedWallets=!1}},async fetchWallets({page:e}){let{includeWalletIds:t,excludeWalletIds:r,featuredWalletIds:i}=f.OptionsController.state,n=u.R.getRequestedCaipNetworkIds().join(","),s=[...m.recommended.map(({id:e})=>e),...r??[],...i??[]].filter(Boolean),{data:o,count:c}=await g.get({path:"/getWallets",params:{...b._getSdkProperties(),page:String(e),entries:"40",chains:n,include:t?.join(","),exclude:s.join(",")}}),l=o.slice(0,20).map(e=>e.image_id).filter(Boolean);await Promise.allSettled(l.map(e=>b._fetchWalletImage(e))),m.wallets=a.j.uniqueBy([...m.wallets,...b._filterOutExtensions(o)],"id"),m.count=c>m.count?c:m.count,m.page=e},async initializeExcludedWalletRdns({ids:e}){let t=u.R.getRequestedCaipNetworkIds().join(","),{data:r}=await g.get({path:"/getWallets",params:{...b._getSdkProperties(),page:"1",entries:String(e.length),chains:t,include:e?.join(",")}});r&&r.forEach(e=>{e?.rdns&&m.excludedRDNS.push(e.rdns)})},async searchWallet({search:e,badge:t}){let{includeWalletIds:r,excludeWalletIds:i}=f.OptionsController.state;m.search=[];let n=u.R.getRequestedCaipNetworkIds().join(","),{data:s}=await g.get({path:"/getWallets",params:{...b._getSdkProperties(),page:"1",entries:"100",search:e?.trim(),badge_type:t,chains:n,include:r?.join(","),exclude:i?.join(",")}});h.X.sendEvent({type:"track",event:"SEARCH_WALLET",properties:{badge:t??"",search:e??""}});let o=s.map(e=>e.image_id).filter(Boolean);await Promise.allSettled([...o.map(e=>b._fetchWalletImage(e)),a.j.wait(300)]),m.search=b._filterOutExtensions(s)},initPromise:(e,t)=>m.promises[e]||(m.promises[e]=t()),prefetch:({fetchConnectorImages:e=!0,fetchFeaturedWallets:t=!0,fetchRecommendedWallets:r=!0,fetchNetworkImages:i=!0}={})=>Promise.allSettled([e&&b.initPromise("connectorImages",b.fetchConnectorImages),t&&b.initPromise("featuredWallets",b.fetchFeaturedWallets),r&&b.initPromise("recommendedWallets",b.fetchRecommendedWallets),i&&b.initPromise("networkImages",b.fetchNetworkImages)].filter(Boolean)),prefetchAnalyticsConfig(){f.OptionsController.state.features?.analytics&&b.fetchAnalyticsConfig()},async fetchAnalyticsConfig(){try{let{isAnalyticsEnabled:e}=await g.get({path:"/getAnalyticsConfig",params:b._getSdkProperties()});f.OptionsController.setFeatures({analytics:e})}catch(e){f.OptionsController.setFeatures({analytics:!1})}},setFilterByNamespace(e){if(!e){m.featured=m.allFeatured,m.recommended=m.allRecommended;return}let t=u.R.getRequestedCaipNetworkIds().join(",");m.featured=m.allFeatured.filter(e=>e.chains?.some(e=>t.includes(e))),m.recommended=m.allRecommended.filter(e=>e.chains?.some(e=>t.includes(e)))}}},87374:function(e,t,r){"use strict";r.d(t,{W:function(){return a}});var i=r(86949),n=r(73932);let s=(0,i.sj)({walletImages:{},networkImages:{},chainImages:{},connectorImages:{},tokenImages:{},currencyImages:{}}),a={state:s,subscribeNetworkImages:e=>(0,i.Ld)(s.networkImages,()=>e(s.networkImages)),subscribeKey:(e,t)=>(0,n.VW)(s,e,t),subscribe:e=>(0,i.Ld)(s,()=>e(s)),setWalletImage(e,t){s.walletImages[e]=t},setNetworkImage(e,t){s.networkImages[e]=t},setChainImage(e,t){s.chainImages[e]=t},setConnectorImage(e,t){s.connectorImages={...s.connectorImages,[e]:t}},setTokenImage(e,t){s.tokenImages[e]=t},setCurrencyImage(e,t){s.currencyImages[e]=t}}},66691:function(e,t,r){"use strict";r.d(t,{L:function(){return g}});var i=r(86949),n=r(47205),s=r(83241),a=r(28356),o=r(64125),c=r(83966),l=r(46313),u=r(77500),d=r(82879);let h={purchaseCurrencies:[{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"Ether",symbol:"ETH",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]}],paymentCurrencies:[{id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},{id:"EUR",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]}]},f=s.j.getBlockchainApiUrl(),p=(0,i.sj)({clientId:null,api:new a.V({baseUrl:f,clientId:null}),supportedChains:{http:[],ws:[]}}),g={state:p,async get(e){let{st:t,sv:r}=g.getSdkProperties(),i=u.OptionsController.state.projectId,n={...e.params||{},st:t,sv:r,projectId:i};return p.api.get({...e,params:n})},getSdkProperties(){let{sdkType:e,sdkVersion:t}=u.OptionsController.state;return{st:e||"unknown",sv:t||"unknown"}},async isNetworkSupported(e){if(!e)return!1;try{p.supportedChains.http.length||await g.getSupportedNetworks()}catch(e){return!1}return p.supportedChains.http.includes(e)},async getSupportedNetworks(){let e=await g.get({path:"v1/supported-chains"});return p.supportedChains=e,e},async fetchIdentity({address:e,caipNetworkId:t}){if(!await g.isNetworkSupported(t))return{avatar:"",name:""};let r=o.M.getIdentityFromCacheForAddress(e);if(r)return r;let i=await g.get({path:`/v1/identity/${e}`,params:{sender:l.R.state.activeCaipAddress?s.j.getPlainAddress(l.R.state.activeCaipAddress):void 0}});return o.M.updateIdentityCache({address:e,identity:i,timestamp:Date.now()}),i},fetchTransactions:async({account:e,cursor:t,onramp:r,signal:i,cache:n,chainId:s})=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?g.get({path:`/v1/account/${e}/history`,params:{cursor:t,onramp:r,chainId:s},signal:i,cache:n}):{data:[],next:void 0},fetchSwapQuote:async({amount:e,userAddress:t,from:r,to:i,gasPrice:n})=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?g.get({path:"/v1/convert/quotes",headers:{"Content-Type":"application/json"},params:{amount:e,userAddress:t,from:r,to:i,gasPrice:n}}):{quotes:[]},fetchSwapTokens:async({chainId:e})=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?g.get({path:"/v1/convert/tokens",params:{chainId:e}}):{tokens:[]},fetchTokenPrice:async({addresses:e})=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?p.api.post({path:"/v1/fungible/price",body:{currency:"usd",addresses:e,projectId:u.OptionsController.state.projectId},headers:{"Content-Type":"application/json"}}):{fungibles:[]},fetchSwapAllowance:async({tokenAddress:e,userAddress:t})=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?g.get({path:"/v1/convert/allowance",params:{tokenAddress:e,userAddress:t},headers:{"Content-Type":"application/json"}}):{allowance:"0"},async fetchGasPrice({chainId:e}){let{st:t,sv:r}=g.getSdkProperties();if(!await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId))throw Error("Network not supported for Gas Price");return g.get({path:"/v1/convert/gas-price",headers:{"Content-Type":"application/json"},params:{chainId:e,st:t,sv:r}})},async generateSwapCalldata({amount:e,from:t,to:r,userAddress:i}){if(!await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId))throw Error("Network not supported for Swaps");return p.api.post({path:"/v1/convert/build-transaction",headers:{"Content-Type":"application/json"},body:{amount:e,eip155:{slippage:n.bq.CONVERT_SLIPPAGE_TOLERANCE},projectId:u.OptionsController.state.projectId,from:t,to:r,userAddress:i}})},async generateApproveCalldata({from:e,to:t,userAddress:r}){let{st:i,sv:n}=g.getSdkProperties();if(!await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId))throw Error("Network not supported for Swaps");return g.get({path:"/v1/convert/build-approve",headers:{"Content-Type":"application/json"},params:{userAddress:r,from:e,to:t,st:i,sv:n}})},async getBalance(e,t,r){let{st:i,sv:n}=g.getSdkProperties();if(!await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId))return d.SnackController.showError("Token Balance Unavailable"),{balances:[]};let s=`${t}:${e}`,a=o.M.getBalanceCacheForCaipAddress(s);if(a)return a;let c=await g.get({path:`/v1/account/${e}/balance`,params:{currency:"usd",chainId:t,forceUpdate:r,st:i,sv:n}});return o.M.updateBalanceCache({caipAddress:s,balance:c,timestamp:Date.now()}),c},lookupEnsName:async e=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?g.get({path:`/v1/profile/account/${e}`,params:{apiVersion:"2"}}):{addresses:{},attributes:[]},reverseLookupEnsName:async({address:e})=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?g.get({path:`/v1/profile/reverse/${e}`,params:{sender:c.AccountController.state.address,apiVersion:"2"}}):[],getEnsNameSuggestions:async e=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?g.get({path:`/v1/profile/suggestions/${e}`,params:{zone:"reown.id"}}):{suggestions:[]},registerEnsName:async({coinType:e,address:t,message:r,signature:i})=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?p.api.post({path:"/v1/profile/account",body:{coin_type:e,address:t,message:r,signature:i},headers:{"Content-Type":"application/json"}}):{success:!1},generateOnRampURL:async({destinationWallets:e,partnerUserId:t,defaultNetwork:r,purchaseAmount:i,paymentAmount:n})=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?(await p.api.post({path:"/v1/generators/onrampurl",params:{projectId:u.OptionsController.state.projectId},body:{destinationWallets:e,defaultNetwork:r,partnerUserId:t,defaultExperience:"buy",presetCryptoAmount:i,presetFiatAmount:n}})).url:"",async getOnrampOptions(){if(!await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId))return{paymentCurrencies:[],purchaseCurrencies:[]};try{return await g.get({path:"/v1/onramp/options"})}catch(e){return h}},async getOnrampQuote({purchaseCurrency:e,paymentCurrency:t,amount:r,network:i}){try{if(!await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId))return null;return await p.api.post({path:"/v1/onramp/quote",params:{projectId:u.OptionsController.state.projectId},body:{purchaseCurrency:e,paymentCurrency:t,amount:r,network:i}})}catch(e){return{coinbaseFee:{amount:r,currency:t.id},networkFee:{amount:r,currency:t.id},paymentSubtotal:{amount:r,currency:t.id},paymentTotal:{amount:r,currency:t.id},purchaseAmount:{amount:r,currency:t.id},quoteId:"mocked-quote-id"}}},getSmartSessions:async e=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?g.get({path:`/v1/sessions/${e}`}):[],revokeSmartSession:async(e,t,r)=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?p.api.post({path:`/v1/sessions/${e}/revoke`,params:{projectId:u.OptionsController.state.projectId},body:{pci:t,signature:r}}):{success:!1},setClientId(e){p.clientId=e,p.api=new a.V({baseUrl:f,clientId:e})}}},46313:function(e,t,r){"use strict";r.d(t,{R:function(){return C}});var i=r(86949),n=r(73932),s=r(27777),a=r(68314),o=r(33734);function c(e,t){return o.ConnectorController.getConnectorId(e)===t}var l=r(47205),u=r(83241),d=r(64125),h=r(83966),f=r(6307),p=r(51440),g=r(83662),m=r(77500),b=r(51090),y=r(4511),w=r(24610);let v={currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,allAccounts:[],user:void 0},A={caipNetwork:void 0,supportsAllNetworks:!0,smartAccountEnabledNetworks:[]},E=(0,i.sj)({chains:(0,n.Yr)(),activeCaipAddress:void 0,activeChain:void 0,activeCaipNetwork:void 0,noAdapters:!1,universalAdapter:{networkControllerClient:void 0,connectionControllerClient:void 0},isSwitchingNamespace:!1}),C={state:E,subscribe:e=>(0,i.Ld)(E,()=>{e(E)}),subscribeKey:(e,t)=>(0,n.VW)(E,e,t),subscribeChainProp(e,t,r){let n;return(0,i.Ld)(E.chains,()=>{let i=r||E.activeChain;if(i){let r=E.chains.get(i)?.[e];n!==r&&(n=r,t(r))}})},initialize(e,t,r){let{chainId:n,namespace:s}=d.M.getActiveNetworkProps(),a=t?.find(e=>e.id.toString()===n?.toString()),o=e.find(e=>e?.namespace===s)||e?.[0],c=new Set([...t?.map(e=>e.chainNamespace)??[]]);e?.length!==0&&o||(E.noAdapters=!0),!E.noAdapters&&(E.activeChain=o?.namespace,E.activeCaipNetwork=a,this.setChainNetworkData(o?.namespace,{caipNetwork:a}),E.activeChain&&b.I.set({activeChain:o?.namespace})),c.forEach(e=>{let n=t?.filter(t=>t.chainNamespace===e);C.state.chains.set(e,{namespace:e,networkState:(0,i.sj)({...A,caipNetwork:n?.[0]}),accountState:(0,i.sj)(v),caipNetworks:n??[],...r}),this.setRequestedCaipNetworks(n??[],e)})},removeAdapter(e){if(E.activeChain===e){let t=Array.from(E.chains.entries()).find(([t])=>t!==e);if(t){let e=t[1]?.caipNetworks?.[0];e&&this.setActiveCaipNetwork(e)}}E.chains.delete(e)},addAdapter(e,{networkControllerClient:t,connectionControllerClient:r},i){E.chains.set(e.namespace,{namespace:e.namespace,networkState:{...A,caipNetwork:i[0]},accountState:v,caipNetworks:i,connectionControllerClient:r,networkControllerClient:t}),this.setRequestedCaipNetworks(i?.filter(t=>t.chainNamespace===e.namespace)??[],e.namespace)},addNetwork(e){let t=E.chains.get(e.chainNamespace);if(t){let r=[...t.caipNetworks||[]];t.caipNetworks?.find(t=>t.id===e.id)||r.push(e),E.chains.set(e.chainNamespace,{...t,caipNetworks:r}),this.setRequestedCaipNetworks(r,e.chainNamespace)}},removeNetwork(e,t){let r=E.chains.get(e);if(r){let i=E.activeCaipNetwork?.id===t,n=[...r.caipNetworks?.filter(e=>e.id!==t)||[]];i&&r?.caipNetworks?.[0]&&this.setActiveCaipNetwork(r.caipNetworks[0]),E.chains.set(e,{...r,caipNetworks:n}),this.setRequestedCaipNetworks(n||[],e)}},setAdapterNetworkState(e,t){let r=E.chains.get(e);r&&(r.networkState={...r.networkState||A,...t},E.chains.set(e,r))},setChainAccountData(e,t,r=!0){if(!e)throw Error("Chain is required to update chain account data");let i=E.chains.get(e);if(i){let r={...i.accountState||v,...t};E.chains.set(e,{...i,accountState:r}),(1===E.chains.size||E.activeChain===e)&&(t.caipAddress&&(E.activeCaipAddress=t.caipAddress),h.AccountController.replaceState(r))}},setChainNetworkData(e,t){if(!e)return;let r=E.chains.get(e);if(r){let i={...r.networkState||A,...t};E.chains.set(e,{...r,networkState:i})}},setAccountProp(e,t,r,i=!0){this.setChainAccountData(r,{[e]:t},i),"status"===e&&"disconnected"===t&&r&&o.ConnectorController.removeConnectorId(r)},setActiveNamespace(e){E.activeChain=e;let t=e?E.chains.get(e):void 0,r=t?.networkState?.caipNetwork;r?.id&&e&&(E.activeCaipAddress=t?.accountState?.caipAddress,E.activeCaipNetwork=r,this.setChainNetworkData(e,{caipNetwork:r}),d.M.setActiveCaipNetworkId(r?.caipNetworkId),b.I.set({activeChain:e,selectedNetworkId:r?.caipNetworkId}))},setActiveCaipNetwork(e){if(!e)return;E.activeChain!==e.chainNamespace&&this.setIsSwitchingNamespace(!0);let t=E.chains.get(e.chainNamespace);E.activeChain=e.chainNamespace,E.activeCaipNetwork=e,this.setChainNetworkData(e.chainNamespace,{caipNetwork:e}),t?.accountState?.address?E.activeCaipAddress=`${e.chainNamespace}:${e.id}:${t?.accountState?.address}`:E.activeCaipAddress=void 0,this.setAccountProp("caipAddress",E.activeCaipAddress,e.chainNamespace),t&&h.AccountController.replaceState(t.accountState),w.S.resetSend(),b.I.set({activeChain:E.activeChain,selectedNetworkId:E.activeCaipNetwork?.caipNetworkId}),d.M.setActiveCaipNetworkId(e.caipNetworkId),this.checkIfSupportedNetwork(e.chainNamespace)||m.OptionsController.state.allowUnsupportedChain||f.ConnectionController.state.wcBasic||this.showUnsupportedChainUI()},addCaipNetwork(e){if(!e)return;let t=E.chains.get(e.chainNamespace);t&&t?.caipNetworks?.push(e)},async switchActiveNamespace(e){if(!e)return;let t=e!==C.state.activeChain,r=C.getNetworkData(e)?.caipNetwork,i=C.getCaipNetworkByNamespace(e,r?.id);t&&i&&await C.switchActiveNetwork(i)},async switchActiveNetwork(e){let t=C.state.chains.get(C.state.activeChain);t?.caipNetworks?.some(e=>e.id===E.activeCaipNetwork?.id)||y.RouterController.goBack();let r=this.getNetworkControllerClient(e.chainNamespace);r&&(await r.switchCaipNetwork(e),p.X.sendEvent({type:"track",event:"SWITCH_NETWORK",properties:{network:e.caipNetworkId}}))},getNetworkControllerClient(e){let t=e||E.activeChain,r=E.chains.get(t);if(!r)throw Error("Chain adapter not found");if(!r.networkControllerClient)throw Error("NetworkController client not set");return r.networkControllerClient},getConnectionControllerClient(e){let t=e||E.activeChain;if(!t)throw Error("Chain is required to get connection controller client");let r=E.chains.get(t);if(!r?.connectionControllerClient)throw Error("ConnectionController client not set");return r.connectionControllerClient},getAccountProp(e,t){let r=E.activeChain;if(t&&(r=t),!r)return;let i=E.chains.get(r)?.accountState;if(i)return i[e]},getNetworkProp(e,t){let r=E.chains.get(t)?.networkState;if(r)return r[e]},getRequestedCaipNetworks(e){let t=E.chains.get(e),{approvedCaipNetworkIds:r=[],requestedCaipNetworks:i=[]}=t?.networkState||{};return u.j.sortRequestedNetworks(r,i)},getAllRequestedCaipNetworks(){let e=[];return E.chains.forEach(t=>{let r=this.getRequestedCaipNetworks(t.namespace);e.push(...r)}),e},setRequestedCaipNetworks(e,t){this.setAdapterNetworkState(t,{requestedCaipNetworks:e})},getAllApprovedCaipNetworkIds(){let e=[];return E.chains.forEach(t=>{let r=this.getApprovedCaipNetworkIds(t.namespace);e.push(...r)}),e},getActiveCaipNetwork:()=>E.activeCaipNetwork,getActiveCaipAddress:()=>E.activeCaipAddress,getApprovedCaipNetworkIds(e){let t=E.chains.get(e);return t?.networkState?.approvedCaipNetworkIds||[]},async setApprovedCaipNetworksData(e){let t=this.getNetworkControllerClient(),r=await t?.getApprovedCaipNetworksData();this.setAdapterNetworkState(e,{approvedCaipNetworkIds:r?.approvedCaipNetworkIds,supportsAllNetworks:r?.supportsAllNetworks})},checkIfSupportedNetwork(e,t){let r=t||E.activeCaipNetwork,i=this.getRequestedCaipNetworks(e);return!i.length||i?.some(e=>e.id===r?.id)},checkIfSupportedChainId(e){if(!E.activeChain)return!0;let t=this.getRequestedCaipNetworks(E.activeChain);return t?.some(t=>t.id===e)},setSmartAccountEnabledNetworks(e,t){this.setAdapterNetworkState(t,{smartAccountEnabledNetworks:e})},checkIfSmartAccountEnabled(){let e=s.p.caipNetworkIdToNumber(E.activeCaipNetwork?.caipNetworkId),t=E.activeChain;if(!t||!e)return!1;let r=this.getNetworkProp("smartAccountEnabledNetworks",t);return!!r?.includes(Number(e))},getActiveNetworkTokenAddress(){let e=E.activeCaipNetwork?.chainNamespace||"eip155",t=E.activeCaipNetwork?.id||1,r=l.bq.NATIVE_TOKEN_ADDRESS[e];return`${e}:${t}:${r}`},showUnsupportedChainUI(){g.I.open({view:"UnsupportedChain"})},checkIfNamesSupported(){let e=E.activeCaipNetwork;return!!(e?.chainNamespace&&l.bq.NAMES_SUPPORTED_CHAIN_NAMESPACES.includes(e.chainNamespace))},resetNetwork(e){this.setAdapterNetworkState(e,{approvedCaipNetworkIds:void 0,supportsAllNetworks:!0,smartAccountEnabledNetworks:[]})},resetAccount(e){if(!e)throw Error("Chain is required to set account prop");E.activeCaipAddress=void 0,this.setChainAccountData(e,{smartAccountDeployed:!1,currentTab:0,caipAddress:void 0,address:void 0,balance:void 0,balanceSymbol:void 0,profileName:void 0,profileImage:void 0,addressExplorerUrl:void 0,tokenBalance:[],connectedWalletInfo:void 0,preferredAccountType:void 0,socialProvider:void 0,socialWindow:void 0,farcasterUrl:void 0,allAccounts:[],user:void 0,status:"disconnected"}),o.ConnectorController.removeConnectorId(e)},async disconnect(e){let t=function(e){let t=Array.from(C.state.chains.keys()),r=[];return e?(r.push([e,C.state.chains.get(e)]),c(e,a.b.CONNECTOR_ID.WALLET_CONNECT)?t.forEach(t=>{t!==e&&c(t,a.b.CONNECTOR_ID.WALLET_CONNECT)&&r.push([t,C.state.chains.get(t)])}):c(e,a.b.CONNECTOR_ID.AUTH)&&t.forEach(t=>{t!==e&&c(t,a.b.CONNECTOR_ID.AUTH)&&r.push([t,C.state.chains.get(t)])})):r=Array.from(C.state.chains.entries()),r}(e);try{w.S.resetSend();let r=await Promise.allSettled(t.map(async([e,t])=>{try{let{caipAddress:r}=this.getAccountData(e)||{};r&&t.connectionControllerClient?.disconnect&&await t.connectionControllerClient.disconnect(e),this.resetAccount(e),this.resetNetwork(e)}catch(t){throw Error(`Failed to disconnect chain ${e}: ${t.message}`)}}));f.ConnectionController.resetWcConnection();let i=r.filter(e=>"rejected"===e.status);if(i.length>0)throw Error(i.map(e=>e.reason.message).join(", "));d.M.deleteConnectedSocialProvider(),e?o.ConnectorController.removeConnectorId(e):o.ConnectorController.resetConnectorIds(),p.X.sendEvent({type:"track",event:"DISCONNECT_SUCCESS",properties:{namespace:e||"all"}})}catch(e){console.error(e.message||"Failed to disconnect chains"),p.X.sendEvent({type:"track",event:"DISCONNECT_ERROR",properties:{message:e.message||"Failed to disconnect chains"}})}},setIsSwitchingNamespace(e){E.isSwitchingNamespace=e},getFirstCaipNetworkSupportsAuthConnector(){let e=[];if(E.chains.forEach(t=>{a.b.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(e=>e===t.namespace)&&t.namespace&&e.push(t.namespace)}),e.length>0){let t=e[0];return t?E.chains.get(t)?.caipNetworks?.[0]:void 0}},getAccountData:e=>e?C.state.chains.get(e)?.accountState:h.AccountController.state,getNetworkData(e){let t=e||E.activeChain;if(t)return C.state.chains.get(t)?.networkState},getCaipNetworkByNamespace(e,t){if(!e)return;let r=C.state.chains.get(e);return r?.caipNetworks?.find(e=>e.id===t)||r?.networkState?.caipNetwork||r?.caipNetworks?.[0]},getRequestedCaipNetworkIds(){let e=o.ConnectorController.state.filterByNamespace;return(e?[E.chains.get(e)]:Array.from(E.chains.values())).flatMap(e=>e?.caipNetworks||[]).map(e=>e.caipNetworkId)}}},6307:function(e,t,r){"use strict";let i;r.d(t,{ConnectionController:function(){return m}});var n=r(86949),s=r(73932),a=r(83241),o=r(72579),c=r(64125),l=r(46313),u=r(33734),d=r(51440),h=r(83662),f=r(4511),p=r(85340);let g=(0,n.sj)({wcError:!1,buffering:!1,status:"disconnected"}),m={state:g,subscribeKey:(e,t)=>(0,s.VW)(g,e,t),_getClient:()=>g._client,setClient(e){g._client=(0,n.iH)(e)},async connectWalletConnect(){if(a.j.isTelegram()||a.j.isSafari()&&a.j.isIos()){if(i){await i,i=void 0;return}if(!a.j.isPairingExpired(g?.wcPairingExpiry)){let e=g.wcUri;g.wcUri=e;return}i=this._getClient()?.connectWalletConnect?.().catch(()=>void 0),this.state.status="connecting",await i,i=void 0,g.wcPairingExpiry=void 0,this.state.status="connected"}else await this._getClient()?.connectWalletConnect?.()},async connectExternal(e,t,r=!0){await this._getClient()?.connectExternal?.(e),r&&l.R.setActiveNamespace(t)},async reconnectExternal(e){await this._getClient()?.reconnectExternal?.(e);let t=e.chain||l.R.state.activeChain;t&&u.ConnectorController.setConnectorId(e.id,t)},async setPreferredAccountType(e){h.I.setLoading(!0,l.R.state.activeChain);let t=u.ConnectorController.getAuthConnector();t&&(await t?.provider.setPreferredAccount(e),await this.reconnectExternal(t),h.I.setLoading(!1,l.R.state.activeChain),d.X.sendEvent({type:"track",event:"SET_PREFERRED_ACCOUNT_TYPE",properties:{accountType:e,network:l.R.state.activeCaipNetwork?.caipNetworkId||""}}))},async signMessage(e){return this._getClient()?.signMessage(e)},parseUnits(e,t){return this._getClient()?.parseUnits(e,t)},formatUnits(e,t){return this._getClient()?.formatUnits(e,t)},async sendTransaction(e){return this._getClient()?.sendTransaction(e)},async getCapabilities(e){return this._getClient()?.getCapabilities(e)},async grantPermissions(e){return this._getClient()?.grantPermissions(e)},async walletGetAssets(e){return this._getClient()?.walletGetAssets(e)??{}},async estimateGas(e){return this._getClient()?.estimateGas(e)},async writeContract(e){return this._getClient()?.writeContract(e)},async getEnsAddress(e){return this._getClient()?.getEnsAddress(e)},async getEnsAvatar(e){return this._getClient()?.getEnsAvatar(e)},checkInstalled(e){return this._getClient()?.checkInstalled?.(e)||!1},resetWcConnection(){g.wcUri=void 0,g.wcPairingExpiry=void 0,g.wcLinking=void 0,g.recentWallet=void 0,g.status="disconnected",p.s.resetTransactions(),c.M.deleteWalletConnectDeepLink()},resetUri(){g.wcUri=void 0,g.wcPairingExpiry=void 0},finalizeWcConnection(){let{wcLinking:e,recentWallet:t}=m.state;e&&c.M.setWalletConnectDeepLink(e),t&&c.M.setAppKitRecent(t),d.X.sendEvent({type:"track",event:"CONNECT_SUCCESS",properties:{method:e?"mobile":"qrcode",name:f.RouterController.state.data?.wallet?.name||"Unknown"}})},setWcBasic(e){g.wcBasic=e},setUri(e){g.wcUri=e,g.wcPairingExpiry=a.j.getPairingExpiry()},setWcLinking(e){g.wcLinking=e},setWcError(e){g.wcError=e,g.buffering=!1},setRecentWallet(e){g.recentWallet=e},setBuffering(e){g.buffering=e},setStatus(e){g.status=e},async disconnect(e){try{h.I.setLoading(!0,e),await o.w.clearSessions(),await l.R.disconnect(e),h.I.setLoading(!1,e),u.ConnectorController.setFilterByNamespace(void 0)}catch(e){throw Error("Failed to disconnect")}}}},33734:function(e,t,r){"use strict";r.d(t,{ConnectorController:function(){return m}});var i=r(86949),n=r(73932),s=r(68314),a=r(45374),o=r(46313);let c={handleSolanaDeeplinkRedirect(e){if(o.R.state.activeChain===s.b.CHAIN.SOLANA){let t=window.location.href,r=encodeURIComponent(t);if("Phantom"===e&&!("phantom"in window)){let e=t.startsWith("https")?"https":"http",i=t.split("/")[2],n=encodeURIComponent(`${e}://${i}`);window.location.href=`https://phantom.app/ul/browse/${r}?ref=${n}`}"Coinbase Wallet"!==e||"coinbaseSolana"in window||(window.location.href=`https://go.cb-w.com/dapp?cb_url=${r}`)}}};var l=r(64125),u=r(48113),d=r(77500),h=r(4511),f=r(12858);let p={eip155:void 0,solana:void 0,polkadot:void 0,bip122:void 0},g=(0,i.sj)({allConnectors:[],connectors:[],activeConnector:void 0,filterByNamespace:void 0,activeConnectorIds:{...p}}),m={state:g,subscribe:e=>(0,i.Ld)(g,()=>{e(g)}),subscribeKey:(e,t)=>(0,n.VW)(g,e,t),initialize(e){e.forEach(e=>{let t=l.M.getConnectedConnectorId(e);t&&this.setConnectorId(t,e)})},setActiveConnector(e){e&&(g.activeConnector=(0,i.iH)(e))},setConnectors(e){e.filter(e=>!g.allConnectors.some(t=>t.id===e.id&&this.getConnectorName(t.name)===this.getConnectorName(e.name)&&t.chain===e.chain)).forEach(e=>{"MULTI_CHAIN"!==e.type&&g.allConnectors.push((0,i.iH)(e))}),g.connectors=this.mergeMultiChainConnectors(g.allConnectors)},removeAdapter(e){g.allConnectors=g.allConnectors.filter(t=>t.chain!==e),g.connectors=this.mergeMultiChainConnectors(g.allConnectors)},mergeMultiChainConnectors(e){let t=this.generateConnectorMapByName(e),r=[];return t.forEach(e=>{let t=e[0],i=t?.id===s.b.CONNECTOR_ID.AUTH;e.length>1&&t?r.push({name:t.name,imageUrl:t.imageUrl,imageId:t.imageId,connectors:[...e],type:i?"AUTH":"MULTI_CHAIN",chain:"eip155",id:t?.id||""}):t&&r.push(t)}),r},generateConnectorMapByName(e){let t=new Map;return e.forEach(e=>{let{name:r}=e,i=this.getConnectorName(r);if(!i)return;let n=t.get(i)||[];n.find(t=>t.chain===e.chain)||n.push(e),t.set(i,n)}),t},getConnectorName:e=>e&&({"Trust Wallet":"Trust"})[e]||e,getUniqueConnectorsByName(e){let t=[];return e.forEach(e=>{t.find(t=>t.chain===e.chain)||t.push(e)}),t},addConnector(e){if(e.id===s.b.CONNECTOR_ID.AUTH){let t=(0,i.CO)(d.OptionsController.state),r=f.ThemeController.getSnapshot().themeMode,n=f.ThemeController.getSnapshot().themeVariables;e?.provider?.syncDappData?.({metadata:t.metadata,sdkVersion:t.sdkVersion,projectId:t.projectId,sdkType:t.sdkType}),e?.provider?.syncTheme({themeMode:r,themeVariables:n,w3mThemeVariables:a.t(n,r)}),this.setConnectors([e])}else this.setConnectors([e])},getAuthConnector(e){let t=e||o.R.state.activeChain,r=g.connectors.find(e=>e.id===s.b.CONNECTOR_ID.AUTH);return r?r?.connectors?.length?r.connectors.find(e=>e.chain===t):r:void 0},getAnnouncedConnectorRdns:()=>g.connectors.filter(e=>"ANNOUNCED"===e.type).map(e=>e.info?.rdns),getConnectorById:e=>g.allConnectors.find(t=>t.id===e),getConnector:(e,t)=>g.allConnectors.filter(e=>e.chain===o.R.state.activeChain).find(r=>r.explorerId===e||r.info?.rdns===t),syncIfAuthConnector(e){if("ID_AUTH"!==e.id)return;let t=(0,i.CO)(d.OptionsController.state),r=f.ThemeController.getSnapshot().themeMode,n=f.ThemeController.getSnapshot().themeVariables;e?.provider?.syncDappData?.({metadata:t.metadata,sdkVersion:t.sdkVersion,sdkType:t.sdkType,projectId:t.projectId}),e.provider.syncTheme({themeMode:r,themeVariables:n,w3mThemeVariables:(0,a.t)(n,r)})},getConnectorsByNamespace(e){let t=g.allConnectors.filter(t=>t.chain===e);return this.mergeMultiChainConnectors(t)},selectWalletConnector(e){let t=m.getConnector(e.id,e.rdns);o.R.state.activeChain===s.b.CHAIN.SOLANA&&c.handleSolanaDeeplinkRedirect(t?.name||e.name||""),t?h.RouterController.push("ConnectingExternal",{connector:t}):h.RouterController.push("ConnectingWalletConnect",{wallet:e})},getConnectors(e){return e?this.getConnectorsByNamespace(e):this.mergeMultiChainConnectors(g.allConnectors)},setFilterByNamespace(e){g.filterByNamespace=e,g.connectors=this.getConnectors(e),u.ApiController.setFilterByNamespace(e)},setConnectorId(e,t){e&&(g.activeConnectorIds={...g.activeConnectorIds,[t]:e},l.M.setConnectedConnectorId(t,e))},removeConnectorId(e){g.activeConnectorIds={...g.activeConnectorIds,[e]:void 0},l.M.deleteConnectedConnectorId(e)},getConnectorId(e){if(e)return g.activeConnectorIds[e]},isConnected:e=>e?!!g.activeConnectorIds[e]:Object.values(g.activeConnectorIds).some(e=>!!e),resetConnectorIds(){g.activeConnectorIds={...p}}}},26258:function(e,t,r){"use strict";r.d(t,{a:function(){return p}});var i=r(86949),n=r(73932);let s={convertEVMChainIdToCoinType(e){if(e>=2147483648)throw Error("Invalid chainId");return(2147483648|e)>>>0}};var a=r(64125),o=r(83966),c=r(66691),l=r(46313),u=r(6307),d=r(33734),h=r(4511);let f=(0,i.sj)({suggestions:[],loading:!1}),p={state:f,subscribe:e=>(0,i.Ld)(f,()=>e(f)),subscribeKey:(e,t)=>(0,n.VW)(f,e,t),async resolveName(e){try{return await c.L.lookupEnsName(e)}catch(e){throw Error(e?.reasons?.[0]?.description||"Error resolving name")}},async isNameRegistered(e){try{return await c.L.lookupEnsName(e),!0}catch{return!1}},async getSuggestions(e){try{f.loading=!0,f.suggestions=[];let t=await c.L.getEnsNameSuggestions(e);return f.suggestions=t.suggestions.map(e=>({...e,name:e.name}))||[],f.suggestions}catch(e){throw Error(this.parseEnsApiError(e,"Error fetching name suggestions"))}finally{f.loading=!1}},async getNamesForAddress(e){try{if(!l.R.state.activeCaipNetwork)return[];let t=a.M.getEnsFromCacheForAddress(e);if(t)return t;let r=await c.L.reverseLookupEnsName({address:e});return a.M.updateEnsCache({address:e,ens:r,timestamp:Date.now()}),r}catch(e){throw Error(this.parseEnsApiError(e,"Error fetching names for address"))}},async registerName(e){let t=l.R.state.activeCaipNetwork;if(!t)throw Error("Network not found");let r=o.AccountController.state.address,i=d.ConnectorController.getAuthConnector();if(!r||!i)throw Error("Address or auth connector not found");f.loading=!0;try{let i=JSON.stringify({name:e,attributes:{},timestamp:Math.floor(Date.now()/1e3)});h.RouterController.pushTransactionStack({view:"RegisterAccountNameSuccess",goBack:!1,replace:!0,onCancel(){f.loading=!1}});let n=await u.ConnectionController.signMessage(i),a=t.id;if(!a)throw Error("Network not found");let l=s.convertEVMChainIdToCoinType(Number(a));await c.L.registerEnsName({coinType:l,address:r,signature:n,message:i}),o.AccountController.setProfileName(e,t.chainNamespace),h.RouterController.replace("RegisterAccountNameSuccess")}catch(r){let t=this.parseEnsApiError(r,`Error registering name ${e}`);throw h.RouterController.replace("RegisterAccountName"),Error(t)}finally{f.loading=!1}},validateName:e=>/^[a-zA-Z0-9-]{4,}$/u.test(e),parseEnsApiError:(e,t)=>e?.reasons?.[0]?.description||t}},51440:function(e,t,r){"use strict";r.d(t,{X:function(){return g}});var i=r(86949),n=r(68314),s=r(35855),a=r(83241),o=r(28356),c=r(83966),l=r(56008),u=r(77500);let d=a.j.getAnalyticsUrl(),h=new o.V({baseUrl:d,clientId:null}),f=["MODAL_CREATED"],p=(0,i.sj)({timestamp:Date.now(),reportedErrors:{},data:{type:"track",event:"MODAL_CREATED"}}),g={state:p,subscribe:e=>(0,i.Ld)(p,()=>e(p)),getSdkProperties(){let{projectId:e,sdkType:t,sdkVersion:r}=u.OptionsController.state;return{projectId:e,st:t,sv:r||"html-wagmi-4.2.2"}},async _sendAnalyticsEvent(e){try{let t=c.AccountController.state.address;if(f.includes(e.data.event)||"undefined"==typeof window)return;await h.post({path:"/e",params:g.getSdkProperties(),body:{eventId:a.j.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:e.timestamp,props:{...e.data,address:t}}}),p.reportedErrors.FORBIDDEN=!1}catch(e){e instanceof Error&&e.cause instanceof Response&&e.cause.status===n.b.HTTP_STATUS_CODES.FORBIDDEN&&!p.reportedErrors.FORBIDDEN&&(l.AlertController.open({shortMessage:"Invalid App Configuration",longMessage:`Origin ${(0,s.$U)()?window.origin:"uknown"} not found on Allowlist - update configuration on cloud.reown.com`},"error"),p.reportedErrors.FORBIDDEN=!0)}},sendEvent(e){p.timestamp=Date.now(),p.data=e,u.OptionsController.state.features?.analytics&&g._sendAnalyticsEvent(p)}}},83662:function(e,t,r){"use strict";r.d(t,{I:function(){return m}});var i=r(86949),n=r(73932),s=r(83241),a=r(83966),o=r(48113),c=r(46313),l=r(6307),u=r(33734),d=r(51440),h=r(77500),f=r(51090),p=r(4511);let g=(0,i.sj)({loading:!1,loadingNamespaceMap:new Map,open:!1,shake:!1,namespace:void 0}),m={state:g,subscribe:e=>(0,i.Ld)(g,()=>e(g)),subscribeKey:(e,t)=>(0,n.VW)(g,e,t),async open(e){let t="connected"===a.AccountController.state.status;l.ConnectionController.state.wcBasic?o.ApiController.prefetch({fetchNetworkImages:!1,fetchConnectorImages:!1}):await o.ApiController.prefetch({fetchConnectorImages:!t,fetchFeaturedWallets:!t,fetchRecommendedWallets:!t}),e?.namespace?(await c.R.switchActiveNamespace(e.namespace),m.setLoading(!0,e.namespace)):m.setLoading(!0),u.ConnectorController.setFilterByNamespace(e?.namespace);let r=c.R.getAccountData(e?.namespace)?.caipAddress;c.R.state.noAdapters&&!r?s.j.isMobile()?p.RouterController.reset("AllWallets"):p.RouterController.reset("ConnectingWalletConnectBasic"):e?.view?p.RouterController.reset(e.view):r?p.RouterController.reset("Account"):p.RouterController.reset("Connect"),g.open=!0,f.I.set({open:!0}),d.X.sendEvent({type:"track",event:"MODAL_OPEN",properties:{connected:!!r}})},close(){let e=h.OptionsController.state.enableEmbedded,t=!!c.R.state.activeCaipAddress;g.open&&d.X.sendEvent({type:"track",event:"MODAL_CLOSE",properties:{connected:t}}),g.open=!1,m.clearLoading(),e?t?p.RouterController.replace("Account"):p.RouterController.push("Connect"):f.I.set({open:!1}),l.ConnectionController.resetUri()},setLoading(e,t){t&&g.loadingNamespaceMap.set(t,e),g.loading=e,f.I.set({loading:e})},clearLoading(){g.loadingNamespaceMap.clear(),g.loading=!1},shake(){g.shake||(g.shake=!0,setTimeout(()=>{g.shake=!1},500))}}},77500:function(e,t,r){"use strict";r.d(t,{OptionsController:function(){return l}});var i=r(86949),n=r(73932),s=r(47205),a=r(83241);let o={getFeatureValue(e,t){let r=t?.[e];return void 0===r?s.bq.DEFAULT_FEATURES[e]:r},filterSocialsByPlatform(e){if(!e||!e.length)return e;if(a.j.isTelegram()){if(a.j.isIos())return e.filter(e=>"google"!==e);if(a.j.isMac())return e.filter(e=>"x"!==e);if(a.j.isAndroid())return e.filter(e=>!["facebook","x"].includes(e))}return e}},c=(0,i.sj)({features:s.bq.DEFAULT_FEATURES,projectId:"",sdkType:"appkit",sdkVersion:"html-wagmi-undefined",defaultAccountTypes:s.bq.DEFAULT_ACCOUNT_TYPES}),l={state:c,subscribeKey:(e,t)=>(0,n.VW)(c,e,t),setOptions(e){Object.assign(c,e)},setFeatures(e){if(!e)return;c.features||(c.features=s.bq.DEFAULT_FEATURES);let t={...c.features,...e};c.features=t,c.features.socials&&(c.features.socials=o.filterSocialsByPlatform(c.features.socials))},setProjectId(e){c.projectId=e},setCustomRpcUrls(e){c.customRpcUrls=e},setAllWallets(e){c.allWallets=e},setIncludeWalletIds(e){c.includeWalletIds=e},setExcludeWalletIds(e){c.excludeWalletIds=e},setFeaturedWalletIds(e){c.featuredWalletIds=e},setTokens(e){c.tokens=e},setTermsConditionsUrl(e){c.termsConditionsUrl=e},setPrivacyPolicyUrl(e){c.privacyPolicyUrl=e},setCustomWallets(e){c.customWallets=e},setIsSiweEnabled(e){c.isSiweEnabled=e},setIsUniversalProvider(e){c.isUniversalProvider=e},setSdkVersion(e){c.sdkVersion=e},setMetadata(e){c.metadata=e},setDisableAppend(e){c.disableAppend=e},setEIP6963Enabled(e){c.enableEIP6963=e},setDebug(e){c.debug=e},setEnableWalletConnect(e){c.enableWalletConnect=e},setEnableWalletGuide(e){c.enableWalletGuide=e},setEnableAuthLogger(e){c.enableAuthLogger=e},setEnableWallets(e){c.enableWallets=e},setHasMultipleAddresses(e){c.hasMultipleAddresses=e},setSIWX(e){c.siwx=e},setConnectMethodsOrder(e){c.features={...c.features,connectMethodsOrder:e}},setWalletFeaturesOrder(e){c.features={...c.features,walletFeaturesOrder:e}},setSocialsOrder(e){c.features={...c.features,socials:e}},setCollapseWallets(e){c.features={...c.features,collapseWallets:e}},setEnableEmbedded(e){c.enableEmbedded=e},setAllowUnsupportedChain(e){c.allowUnsupportedChain=e},setManualWCControl(e){c.manualWCControl=e},setDefaultAccountTypes(e={}){Object.entries(e).forEach(([e,t])=>{t&&(c.defaultAccountTypes[e]=t)})},getSnapshot:()=>(0,i.CO)(c)}},51090:function(e,t,r){"use strict";r.d(t,{I:function(){return s}});var i=r(86949);let n=(0,i.sj)({loading:!1,open:!1,selectedNetworkId:void 0,activeChain:void 0,initialized:!1}),s={state:n,subscribe:e=>(0,i.Ld)(n,()=>e(n)),set(e){Object.assign(n,{...n,...e})}}},4511:function(e,t,r){"use strict";r.d(t,{RouterController:function(){return d}});var i=r(86949),n=r(73932),s=r(83966),a=r(46313),o=r(33734),c=r(83662),l=r(77500);let u=(0,i.sj)({view:"Connect",history:["Connect"],transactionStack:[]}),d={state:u,subscribeKey:(e,t)=>(0,n.VW)(u,e,t),pushTransactionStack(e){u.transactionStack.push(e)},popTransactionStack(e){let t=u.transactionStack.pop();if(t){if(e)this.goBack(),t?.onCancel?.();else{if(t.goBack)this.goBack();else if(t.replace){let e=u.history.indexOf("ConnectingSiwe");e>0?this.goBackToIndex(e-1):(c.I.close(),u.history=[])}else t.view&&this.reset(t.view);t?.onSuccess?.()}}},push(e,t){e!==u.view&&(u.view=e,u.history.push(e),u.data=t)},reset(e,t){u.view=e,u.history=[e],u.data=t},replace(e,t){u.history.at(-1)!==e&&(u.view=e,u.history[u.history.length-1]=e,u.data=t)},goBack(){let e=!a.R.state.activeCaipAddress&&"ConnectingFarcaster"===this.state.view;if(u.history.length>1&&!u.history.includes("UnsupportedChain")){u.history.pop();let[e]=u.history.slice(-1);e&&(u.view=e)}else c.I.close();u.data?.wallet&&(u.data.wallet=void 0),setTimeout(()=>{if(e){s.AccountController.setFarcasterUrl(void 0,a.R.state.activeChain);let e=o.ConnectorController.getAuthConnector();e?.provider?.reload();let t=(0,i.CO)(l.OptionsController.state);e?.provider?.syncDappData?.({metadata:t.metadata,sdkVersion:t.sdkVersion,projectId:t.projectId,sdkType:t.sdkType})}},100)},goBackToIndex(e){if(u.history.length>1){u.history=u.history.slice(0,e+1);let[t]=u.history.slice(-1);t&&(u.view=t)}}}},24610:function(e,t,r){"use strict";r.d(t,{S:function(){return _}});var i=r(86949),n=r(73932),s=r(62411);let a=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],o=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}];var c=r(68314);let l={getERC20Abi:e=>c.b.USDT_CONTRACT_ADDRESSES.includes(e)?o:a};var u=r(22192),d=r(47205),h=r(83241),f=r(83966),p=r(66691),g=r(46313),m=r(6307),b=r(15229);let y={createBalance(e,t){let r={name:e.metadata.name||"",symbol:e.metadata.symbol||"",decimals:e.metadata.decimals||0,value:e.metadata.value||0,price:e.metadata.price||0,iconUrl:e.metadata.iconUrl||""};return{name:r.name,symbol:r.symbol,chainId:t,address:"native"===e.address?void 0:this.convertAddressToCAIP10Address(e.address,t),value:r.value,price:r.price,quantity:{decimals:r.decimals.toString(),numeric:this.convertHexToBalance({hex:e.balance,decimals:r.decimals})},iconUrl:r.iconUrl}},convertHexToBalance:({hex:e,decimals:t})=>(0,b.b)(BigInt(e),t),convertAddressToCAIP10Address:(e,t)=>`${t}:${e}`,createCAIP2ChainId:(e,t)=>`${t}:${parseInt(e,16)}`,getChainIdHexFromCAIP2ChainId(e){let t=e.split(":");if(t.length<2||!t[1])return"0x0";let r=parseInt(t[1],10);return isNaN(r)?"0x0":`0x${r.toString(16)}`},isWalletGetAssetsResponse(e){return"object"==typeof e&&null!==e&&Object.values(e).every(e=>Array.isArray(e)&&e.every(e=>this.isValidAsset(e)))},isValidAsset:e=>"object"==typeof e&&null!==e&&"string"==typeof e.address&&"string"==typeof e.balance&&("ERC20"===e.type||"NATIVE"===e.type)&&"object"==typeof e.metadata&&null!==e.metadata&&"string"==typeof e.metadata.name&&"string"==typeof e.metadata.symbol&&"number"==typeof e.metadata.decimals&&"number"==typeof e.metadata.price&&"string"==typeof e.metadata.iconUrl},w={async getMyTokensWithBalance(e){let t=f.AccountController.state.address,r=g.R.state.activeCaipNetwork;if(!t||!r)return[];if("eip155"===r.chainNamespace){let e=await this.getEIP155Balances(t,r);if(e)return this.filterLowQualityTokens(e)}let i=await p.L.getBalance(t,r.caipNetworkId,e);return this.filterLowQualityTokens(i.balances)},async getEIP155Balances(e,t){try{let r=y.getChainIdHexFromCAIP2ChainId(t.caipNetworkId),i=await m.ConnectionController.getCapabilities(e);if(!i?.[r]?.assetDiscovery?.supported)return null;let n=await m.ConnectionController.walletGetAssets({account:e,chainFilter:[r]});if(!y.isWalletGetAssetsResponse(n))return null;return(n[r]||[]).map(e=>y.createBalance(e,t.caipNetworkId))}catch(e){return null}},filterLowQualityTokens:e=>e.filter(e=>"0"!==e.quantity.decimals),mapBalancesToSwapTokens:e=>e?.map(e=>({...e,address:e?.address?e.address:g.R.getActiveNetworkTokenAddress(),decimals:parseInt(e.quantity.decimals,10),logoUri:e.iconUrl,eip2612:!1}))||[]};var v=r(51440),A=r(4511),E=r(82879);let C=(0,i.sj)({tokenBalances:[],loading:!1}),_={state:C,subscribe:e=>(0,i.Ld)(C,()=>e(C)),subscribeKey:(e,t)=>(0,n.VW)(C,e,t),setToken(e){e&&(C.token=(0,i.iH)(e))},setTokenAmount(e){C.sendTokenAmount=e},setReceiverAddress(e){C.receiverAddress=e},setReceiverProfileImageUrl(e){C.receiverProfileImageUrl=e},setReceiverProfileName(e){C.receiverProfileName=e},setGasPrice(e){C.gasPrice=e},setGasPriceInUsd(e){C.gasPriceInUSD=e},setNetworkBalanceInUsd(e){C.networkBalanceInUSD=e},setLoading(e){C.loading=e},sendToken(){switch(g.R.state.activeCaipNetwork?.chainNamespace){case"eip155":this.sendEvmToken();return;case"solana":this.sendSolanaToken();return;default:throw Error("Unsupported chain")}},sendEvmToken(){this.state.token?.address&&this.state.sendTokenAmount&&this.state.receiverAddress?(v.X.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:f.AccountController.state.preferredAccountType===u.y_.ACCOUNT_TYPES.SMART_ACCOUNT,token:this.state.token.address,amount:this.state.sendTokenAmount,network:g.R.state.activeCaipNetwork?.caipNetworkId||""}}),this.sendERC20Token({receiverAddress:this.state.receiverAddress,tokenAddress:this.state.token.address,sendTokenAmount:this.state.sendTokenAmount,decimals:this.state.token.quantity.decimals})):this.state.receiverAddress&&this.state.sendTokenAmount&&this.state.gasPrice&&this.state.token?.quantity.decimals&&(v.X.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:f.AccountController.state.preferredAccountType===u.y_.ACCOUNT_TYPES.SMART_ACCOUNT,token:this.state.token?.symbol,amount:this.state.sendTokenAmount,network:g.R.state.activeCaipNetwork?.caipNetworkId||""}}),this.sendNativeToken({receiverAddress:this.state.receiverAddress,sendTokenAmount:this.state.sendTokenAmount,gasPrice:this.state.gasPrice,decimals:this.state.token.quantity.decimals}))},async fetchTokenBalance(e){C.loading=!0;let t=g.R.state.activeCaipNetwork?.caipNetworkId,r=g.R.state.activeCaipNetwork?.chainNamespace,i=g.R.state.activeCaipAddress,n=i?h.j.getPlainAddress(i):void 0;if(C.lastRetry&&!h.j.isAllowedRetry(C.lastRetry,30*d.bq.ONE_SEC_MS))return C.loading=!1,[];try{if(n&&t&&r){let e=await w.getMyTokensWithBalance();return C.tokenBalances=e,C.lastRetry=void 0,e}}catch(t){C.lastRetry=Date.now(),e?.(t),E.SnackController.showError("Token Balance Unavailable")}finally{C.loading=!1}return[]},fetchNetworkBalance(){if(0===C.tokenBalances.length)return;let e=w.mapBalancesToSwapTokens(C.tokenBalances);if(!e)return;let t=e.find(e=>e.address===g.R.getActiveNetworkTokenAddress());t&&(C.networkBalanceInUSD=t?s.C.multiply(t.quantity.numeric,t.price).toString():"0")},isInsufficientNetworkTokenForGas:(e,t)=>!!s.C.bigNumber(e).eq(0)||s.C.bigNumber(s.C.bigNumber(t||"0")).gt(e),hasInsufficientGasFunds(){let e=!0;return f.AccountController.state.preferredAccountType===u.y_.ACCOUNT_TYPES.SMART_ACCOUNT?e=!1:C.networkBalanceInUSD&&(e=this.isInsufficientNetworkTokenForGas(C.networkBalanceInUSD,C.gasPriceInUSD)),e},async sendNativeToken(e){A.RouterController.pushTransactionStack({view:"Account",goBack:!1});let t=e.receiverAddress,r=f.AccountController.state.address,i=m.ConnectionController.parseUnits(e.sendTokenAmount.toString(),Number(e.decimals));try{await m.ConnectionController.sendTransaction({chainNamespace:"eip155",to:t,address:r,data:"0x",value:i??BigInt(0),gasPrice:e.gasPrice}),E.SnackController.showSuccess("Transaction started"),v.X.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:f.AccountController.state.preferredAccountType===u.y_.ACCOUNT_TYPES.SMART_ACCOUNT,token:this.state.token?.symbol||"",amount:e.sendTokenAmount,network:g.R.state.activeCaipNetwork?.caipNetworkId||""}}),this.resetSend()}catch(r){console.error("SendController:sendERC20Token - failed to send native token",r);let t=r instanceof Error?r.message:"Unknown error";v.X.sendEvent({type:"track",event:"SEND_ERROR",properties:{message:t,isSmartAccount:f.AccountController.state.preferredAccountType===u.y_.ACCOUNT_TYPES.SMART_ACCOUNT,token:this.state.token?.symbol||"",amount:e.sendTokenAmount,network:g.R.state.activeCaipNetwork?.caipNetworkId||""}}),E.SnackController.showError("Something went wrong")}},async sendERC20Token(e){A.RouterController.pushTransactionStack({view:"Account",goBack:!1});let t=m.ConnectionController.parseUnits(e.sendTokenAmount.toString(),Number(e.decimals));try{if(f.AccountController.state.address&&e.sendTokenAmount&&e.receiverAddress&&e.tokenAddress){let r=h.j.getPlainAddress(e.tokenAddress);await m.ConnectionController.writeContract({fromAddress:f.AccountController.state.address,tokenAddress:r,args:[e.receiverAddress,t??BigInt(0)],method:"transfer",abi:l.getERC20Abi(r),chainNamespace:"eip155"}),E.SnackController.showSuccess("Transaction started"),this.resetSend()}}catch(r){console.error("SendController:sendERC20Token - failed to send erc20 token",r);let t=r instanceof Error?r.message:"Unknown error";v.X.sendEvent({type:"track",event:"SEND_ERROR",properties:{message:t,isSmartAccount:f.AccountController.state.preferredAccountType===u.y_.ACCOUNT_TYPES.SMART_ACCOUNT,token:this.state.token?.symbol||"",amount:e.sendTokenAmount,network:g.R.state.activeCaipNetwork?.caipNetworkId||""}}),E.SnackController.showError("Something went wrong")}},sendSolanaToken(){if(!this.state.sendTokenAmount||!this.state.receiverAddress){E.SnackController.showError("Please enter a valid amount and receiver address");return}A.RouterController.pushTransactionStack({view:"Account",goBack:!1}),m.ConnectionController.sendTransaction({chainNamespace:"solana",to:this.state.receiverAddress,value:this.state.sendTokenAmount}).then(()=>{this.resetSend(),f.AccountController.fetchTokenBalance()}).catch(e=>{E.SnackController.showError("Failed to send transaction. Please try again."),console.error("SendController:sendToken - failed to send solana transaction",e)})},resetSend(){C.token=void 0,C.sendTokenAmount=void 0,C.receiverAddress=void 0,C.receiverProfileImageUrl=void 0,C.receiverProfileName=void 0,C.loading=!1,C.tokenBalances=[]}}},82879:function(e,t,r){"use strict";r.d(t,{SnackController:function(){return c}});var i=r(86949),n=r(73932),s=r(83241);let a=Object.freeze({message:"",variant:"success",svg:void 0,open:!1,autoClose:!0}),o=(0,i.sj)({...a}),c={state:o,subscribeKey:(e,t)=>(0,n.VW)(o,e,t),showLoading(e,t={}){this._showMessage({message:e,variant:"loading",...t})},showSuccess(e){this._showMessage({message:e,variant:"success"})},showSvg(e,t){this._showMessage({message:e,svg:t})},showError(e){let t=s.j.parseError(e);this._showMessage({message:t,variant:"error"})},hide(){o.message=a.message,o.variant=a.variant,o.svg=a.svg,o.open=a.open,o.autoClose=a.autoClose},_showMessage({message:e,svg:t,variant:r="success",autoClose:i=a.autoClose}){o.open?(o.open=!1,setTimeout(()=>{o.message=e,o.variant=r,o.svg=t,o.open=!0,o.autoClose=i},150)):(o.message=e,o.variant=r,o.svg=t,o.open=!0,o.autoClose=i)}}},74741:function(e,t,r){"use strict";r.d(t,{nY:function(){return C}});var i=r(86949),n=r(73932),s=r(62411),a=r(68314),o=r(22192),c=r(47205),l=r(83241),u=r(2446);let d={getGasPriceInEther:(e,t)=>Number(t*e)/1e18,getGasPriceInUSD(e,t,r){let i=d.getGasPriceInEther(t,r);return s.C.bigNumber(e).times(i).toNumber()},getPriceImpact({sourceTokenAmount:e,sourceTokenPriceInUSD:t,toTokenPriceInUSD:r,toTokenAmount:i}){let n=s.C.bigNumber(e).times(t),a=s.C.bigNumber(i).times(r);return n.minus(a).div(n).times(100).toNumber()},getMaxSlippage(e,t){let r=s.C.bigNumber(e).div(100);return s.C.multiply(t,r).toNumber()},getProviderFee:(e,t=.0085)=>s.C.bigNumber(e).times(t).toString(),isInsufficientNetworkTokenForGas:(e,t)=>!!s.C.bigNumber(e).eq(0)||s.C.bigNumber(s.C.bigNumber(t||"0")).gt(e),isInsufficientSourceTokenForSwap(e,t,r){let i=r?.find(e=>e.address===t)?.quantity?.numeric;return s.C.bigNumber(i||"0").lt(e)},getToTokenAmount({sourceToken:e,toToken:t,sourceTokenPrice:r,toTokenPrice:i,sourceTokenAmount:n}){if("0"===n||!e||!t)return"0";let a=e.decimals,o=t.decimals;if(i<=0)return"0";let c=s.C.bigNumber(n).times(.0085),l=s.C.bigNumber(n).minus(c).times(s.C.bigNumber(10).pow(a)),u=s.C.bigNumber(r).div(i),d=a-o;return l.times(u).div(s.C.bigNumber(10).pow(d)).div(s.C.bigNumber(10).pow(o)).toFixed(o).toString()}};var h=r(83966),f=r(56008),p=r(66691),g=r(46313),m=r(6307),b=r(33734),y=r(51440),w=r(4511),v=r(82879);let A={initializing:!1,initialized:!1,loadingPrices:!1,loadingQuote:!1,loadingApprovalTransaction:!1,loadingBuildTransaction:!1,loadingTransaction:!1,fetchError:!1,approvalTransaction:void 0,swapTransaction:void 0,transactionError:void 0,sourceToken:void 0,sourceTokenAmount:"",sourceTokenPriceInUSD:0,toToken:void 0,toTokenAmount:"",toTokenPriceInUSD:0,networkPrice:"0",networkBalanceInUSD:"0",networkTokenSymbol:"",inputError:void 0,slippage:c.bq.CONVERT_SLIPPAGE_TOLERANCE,tokens:void 0,popularTokens:void 0,suggestedTokens:void 0,foundTokens:void 0,myTokensWithBalance:void 0,tokensPriceMap:{},gasFee:"0",gasPriceInUSD:0,priceImpact:void 0,maxSlippage:void 0,providerFee:void 0},E=(0,i.sj)(A),C={state:E,subscribe:e=>(0,i.Ld)(E,()=>e(E)),subscribeKey:(e,t)=>(0,n.VW)(E,e,t),getParams(){let e=g.R.state.activeCaipAddress,t=g.R.state.activeChain,r=l.j.getPlainAddress(e),i=g.R.getActiveNetworkTokenAddress(),n=b.ConnectorController.getConnectorId(t);if(!r)throw Error("No address found to swap the tokens from.");let o=!E.toToken?.address||!E.toToken?.decimals,c=!E.sourceToken?.address||!E.sourceToken?.decimals||!s.C.bigNumber(E.sourceTokenAmount).gt(0),u=!E.sourceTokenAmount;return{networkAddress:i,fromAddress:r,fromCaipAddress:e,sourceTokenAddress:E.sourceToken?.address,toTokenAddress:E.toToken?.address,toTokenAmount:E.toTokenAmount,toTokenDecimals:E.toToken?.decimals,sourceTokenAmount:E.sourceTokenAmount,sourceTokenDecimals:E.sourceToken?.decimals,invalidToToken:o,invalidSourceToken:c,invalidSourceTokenAmount:u,availableToSwap:e&&!o&&!c&&!u,isAuthConnector:n===a.b.CONNECTOR_ID.AUTH}},setSourceToken(e){if(!e){E.sourceToken=e,E.sourceTokenAmount="",E.sourceTokenPriceInUSD=0;return}E.sourceToken=e,this.setTokenPrice(e.address,"sourceToken")},setSourceTokenAmount(e){E.sourceTokenAmount=e},setToToken(e){if(!e){E.toToken=e,E.toTokenAmount="",E.toTokenPriceInUSD=0;return}E.toToken=e,this.setTokenPrice(e.address,"toToken")},setToTokenAmount(e){E.toTokenAmount=e?s.C.formatNumberToLocalString(e,6):""},async setTokenPrice(e,t){let r=E.tokensPriceMap[e]||0;r||(E.loadingPrices=!0,r=await this.getAddressPrice(e)),"sourceToken"===t?E.sourceTokenPriceInUSD=r:"toToken"===t&&(E.toTokenPriceInUSD=r),E.loadingPrices&&(E.loadingPrices=!1),this.getParams().availableToSwap&&this.swapTokens()},switchTokens(){if(E.initializing||!E.initialized)return;let e=E.toToken?{...E.toToken}:void 0,t=E.sourceToken?{...E.sourceToken}:void 0,r=e&&""===E.toTokenAmount?"1":E.toTokenAmount;this.setSourceToken(e),this.setToToken(t),this.setSourceTokenAmount(r),this.setToTokenAmount(""),this.swapTokens()},resetState(){E.myTokensWithBalance=A.myTokensWithBalance,E.tokensPriceMap=A.tokensPriceMap,E.initialized=A.initialized,E.sourceToken=A.sourceToken,E.sourceTokenAmount=A.sourceTokenAmount,E.sourceTokenPriceInUSD=A.sourceTokenPriceInUSD,E.toToken=A.toToken,E.toTokenAmount=A.toTokenAmount,E.toTokenPriceInUSD=A.toTokenPriceInUSD,E.networkPrice=A.networkPrice,E.networkTokenSymbol=A.networkTokenSymbol,E.networkBalanceInUSD=A.networkBalanceInUSD,E.inputError=A.inputError},resetValues(){let{networkAddress:e}=this.getParams(),t=E.tokens?.find(t=>t.address===e);this.setSourceToken(t),this.setToToken(void 0)},getApprovalLoadingState:()=>E.loadingApprovalTransaction,clearError(){E.transactionError=void 0},async initializeState(){if(!E.initializing){if(E.initializing=!0,!E.initialized)try{await this.fetchTokens(),E.initialized=!0}catch(e){E.initialized=!1,v.SnackController.showError("Failed to initialize swap"),w.RouterController.goBack()}E.initializing=!1}},async fetchTokens(){let{networkAddress:e}=this.getParams();await this.getTokenList(),await this.getNetworkTokenPrice(),await this.getMyTokensWithBalance();let t=E.tokens?.find(t=>t.address===e);t&&(E.networkTokenSymbol=t.symbol,this.setSourceToken(t),this.setSourceTokenAmount("1"))},async getTokenList(){let e=await u.n.getTokenList();E.tokens=e,E.popularTokens=e.sort((e,t)=>e.symbolt.symbol?1:0),E.suggestedTokens=e.filter(e=>!!c.bq.SWAP_SUGGESTED_TOKENS.includes(e.symbol),{})},async getAddressPrice(e){let t=E.tokensPriceMap[e];if(t)return t;let r=await p.L.fetchTokenPrice({addresses:[e]}),i=r?.fungibles||[],n=[...E.tokens||[],...E.myTokensWithBalance||[]],s=n?.find(t=>t.address===e)?.symbol,a=parseFloat((i.find(e=>e.symbol.toLowerCase()===s?.toLowerCase())?.price||0).toString());return E.tokensPriceMap[e]=a,a},async getNetworkTokenPrice(){let{networkAddress:e}=this.getParams(),t=await p.L.fetchTokenPrice({addresses:[e]}).catch(()=>(v.SnackController.showError("Failed to fetch network token price"),{fungibles:[]})),r=t.fungibles?.[0],i=r?.price.toString()||"0";E.tokensPriceMap[e]=parseFloat(i),E.networkTokenSymbol=r?.symbol||"",E.networkPrice=i},async getMyTokensWithBalance(e){let t=await u.n.getMyTokensWithBalance(e);t&&(await this.getInitialGasPrice(),this.setBalances(t))},setBalances(e){let{networkAddress:t}=this.getParams(),r=g.R.state.activeCaipNetwork;if(!r)return;let i=e.find(e=>e.address===t);e.forEach(e=>{E.tokensPriceMap[e.address]=e.price||0}),E.myTokensWithBalance=e.filter(e=>e.address.startsWith(r.caipNetworkId)),E.networkBalanceInUSD=i?s.C.multiply(i.quantity.numeric,i.price).toString():"0"},async getInitialGasPrice(){let e=await u.n.fetchGasPrice();if(!e)return{gasPrice:null,gasPriceInUSD:null};if(g.R.state?.activeCaipNetwork?.chainNamespace==="solana")return E.gasFee=e.standard??"0",E.gasPriceInUSD=s.C.multiply(e.standard,E.networkPrice).div(1e9).toNumber(),{gasPrice:BigInt(E.gasFee),gasPriceInUSD:Number(E.gasPriceInUSD)};{let t=e.standard??"0",r=BigInt(t),i=BigInt(15e4),n=d.getGasPriceInUSD(E.networkPrice,i,r);return E.gasFee=t,E.gasPriceInUSD=n,{gasPrice:r,gasPriceInUSD:n}}},async swapTokens(){let e=h.AccountController.state.address,t=E.sourceToken,r=E.toToken,i=s.C.bigNumber(E.sourceTokenAmount).gt(0);if(i||this.setToTokenAmount(""),!r||!t||E.loadingPrices||!i)return;E.loadingQuote=!0;let n=s.C.bigNumber(E.sourceTokenAmount).times(10**t.decimals).round(0);try{let i=await p.L.fetchSwapQuote({userAddress:e,from:t.address,to:r.address,gasPrice:E.gasFee,amount:n.toString()});E.loadingQuote=!1;let a=i?.quotes?.[0]?.toAmount;if(!a){f.AlertController.open({shortMessage:"Incorrect amount",longMessage:"Please enter a valid amount"},"error");return}let o=s.C.bigNumber(a).div(10**r.decimals).toString();this.setToTokenAmount(o),this.hasInsufficientToken(E.sourceTokenAmount,t.address)?E.inputError="Insufficient balance":(E.inputError=void 0,this.setTransactionDetails())}catch(e){E.loadingQuote=!1,E.inputError="Insufficient balance"}},async getTransaction(){let{fromCaipAddress:e,availableToSwap:t}=this.getParams(),r=E.sourceToken,i=E.toToken;if(e&&t&&r&&i&&!E.loadingQuote)try{let t;return E.loadingBuildTransaction=!0,t=await u.n.fetchSwapAllowance({userAddress:e,tokenAddress:r.address,sourceTokenAmount:E.sourceTokenAmount,sourceTokenDecimals:r.decimals})?await this.createSwapTransaction():await this.createAllowanceTransaction(),E.loadingBuildTransaction=!1,E.fetchError=!1,t}catch(e){w.RouterController.goBack(),v.SnackController.showError("Failed to check allowance"),E.loadingBuildTransaction=!1,E.approvalTransaction=void 0,E.swapTransaction=void 0,E.fetchError=!0;return}},async createAllowanceTransaction(){let{fromCaipAddress:e,fromAddress:t,sourceTokenAddress:r,toTokenAddress:i}=this.getParams();if(e&&i){if(!r)throw Error("createAllowanceTransaction - No source token address found.");try{let n=await p.L.generateApproveCalldata({from:r,to:i,userAddress:e}),s=await m.ConnectionController.estimateGas({chainNamespace:a.b.CHAIN.EVM,address:t,to:l.j.getPlainAddress(n.tx.to),data:n.tx.data}),o={data:n.tx.data,to:l.j.getPlainAddress(n.tx.from),gas:s,gasPrice:BigInt(n.tx.eip155.gasPrice),value:BigInt(n.tx.value),toAmount:E.toTokenAmount};return E.swapTransaction=void 0,E.approvalTransaction={data:o.data,to:o.to,gas:o.gas??BigInt(0),gasPrice:o.gasPrice,value:o.value,toAmount:o.toAmount},{data:o.data,to:o.to,gas:o.gas??BigInt(0),gasPrice:o.gasPrice,value:o.value,toAmount:o.toAmount}}catch(e){w.RouterController.goBack(),v.SnackController.showError("Failed to create approval transaction"),E.approvalTransaction=void 0,E.swapTransaction=void 0,E.fetchError=!0;return}}},async createSwapTransaction(){let{networkAddress:e,fromCaipAddress:t,sourceTokenAmount:r}=this.getParams(),i=E.sourceToken,n=E.toToken;if(!t||!r||!i||!n)return;let s=m.ConnectionController.parseUnits(r,i.decimals)?.toString();try{let r=await p.L.generateSwapCalldata({userAddress:t,from:i.address,to:n.address,amount:s}),a=i.address===e,o=BigInt(r.tx.eip155.gas),c=BigInt(r.tx.eip155.gasPrice),u={data:r.tx.data,to:l.j.getPlainAddress(r.tx.to),gas:o,gasPrice:c,value:a?BigInt(s??"0"):BigInt("0"),toAmount:E.toTokenAmount};return E.gasPriceInUSD=d.getGasPriceInUSD(E.networkPrice,o,c),E.approvalTransaction=void 0,E.swapTransaction=u,u}catch(e){w.RouterController.goBack(),v.SnackController.showError("Failed to create transaction"),E.approvalTransaction=void 0,E.swapTransaction=void 0,E.fetchError=!0;return}},async sendTransactionForApproval(e){let{fromAddress:t,isAuthConnector:r}=this.getParams();E.loadingApprovalTransaction=!0;let i="Approve limit increase in your wallet";r?w.RouterController.pushTransactionStack({view:null,goBack:!0,onSuccess(){v.SnackController.showLoading(i)}}):v.SnackController.showLoading(i);try{await m.ConnectionController.sendTransaction({address:t,to:e.to,data:e.data,gas:e.gas,gasPrice:BigInt(e.gasPrice),value:e.value,chainNamespace:"eip155"}),await this.swapTokens(),await this.getTransaction(),E.approvalTransaction=void 0,E.loadingApprovalTransaction=!1}catch(e){E.transactionError=e?.shortMessage,E.loadingApprovalTransaction=!1,v.SnackController.showError(e?.shortMessage||"Transaction error"),y.X.sendEvent({type:"track",event:"SWAP_APPROVAL_ERROR",properties:{message:e?.shortMessage||e?.message||"Unknown",network:g.R.state.activeCaipNetwork?.caipNetworkId||"",swapFromToken:this.state.sourceToken?.symbol||"",swapToToken:this.state.toToken?.symbol||"",swapFromAmount:this.state.sourceTokenAmount||"",swapToAmount:this.state.toTokenAmount||"",isSmartAccount:h.AccountController.state.preferredAccountType===o.y_.ACCOUNT_TYPES.SMART_ACCOUNT}})}},async sendTransactionForSwap(e){if(!e)return;let{fromAddress:t,toTokenAmount:r,isAuthConnector:i}=this.getParams();E.loadingTransaction=!0;let n=`Swapping ${E.sourceToken?.symbol} to ${s.C.formatNumberToLocalString(r,3)} ${E.toToken?.symbol}`,a=`Swapped ${E.sourceToken?.symbol} to ${s.C.formatNumberToLocalString(r,3)} ${E.toToken?.symbol}`;i?w.RouterController.pushTransactionStack({view:"Account",goBack:!1,onSuccess(){v.SnackController.showLoading(n),C.resetState()}}):v.SnackController.showLoading("Confirm transaction in your wallet");try{let r=[E.sourceToken?.address,E.toToken?.address].join(","),n=await m.ConnectionController.sendTransaction({address:t,to:e.to,data:e.data,gas:e.gas,gasPrice:BigInt(e.gasPrice),value:e.value,chainNamespace:"eip155"});return E.loadingTransaction=!1,v.SnackController.showSuccess(a),y.X.sendEvent({type:"track",event:"SWAP_SUCCESS",properties:{network:g.R.state.activeCaipNetwork?.caipNetworkId||"",swapFromToken:this.state.sourceToken?.symbol||"",swapToToken:this.state.toToken?.symbol||"",swapFromAmount:this.state.sourceTokenAmount||"",swapToAmount:this.state.toTokenAmount||"",isSmartAccount:h.AccountController.state.preferredAccountType===o.y_.ACCOUNT_TYPES.SMART_ACCOUNT}}),C.resetState(),i||w.RouterController.replace("Account"),C.getMyTokensWithBalance(r),n}catch(e){E.transactionError=e?.shortMessage,E.loadingTransaction=!1,v.SnackController.showError(e?.shortMessage||"Transaction error"),y.X.sendEvent({type:"track",event:"SWAP_ERROR",properties:{message:e?.shortMessage||e?.message||"Unknown",network:g.R.state.activeCaipNetwork?.caipNetworkId||"",swapFromToken:this.state.sourceToken?.symbol||"",swapToToken:this.state.toToken?.symbol||"",swapFromAmount:this.state.sourceTokenAmount||"",swapToAmount:this.state.toTokenAmount||"",isSmartAccount:h.AccountController.state.preferredAccountType===o.y_.ACCOUNT_TYPES.SMART_ACCOUNT}});return}},hasInsufficientToken(e,t){let r=d.isInsufficientSourceTokenForSwap(e,t,E.myTokensWithBalance);return h.AccountController.state.preferredAccountType!==o.y_.ACCOUNT_TYPES.SMART_ACCOUNT&&d.isInsufficientNetworkTokenForGas(E.networkBalanceInUSD,E.gasPriceInUSD)||r},setTransactionDetails(){let{toTokenAddress:e,toTokenDecimals:t}=this.getParams();e&&t&&(E.gasPriceInUSD=d.getGasPriceInUSD(E.networkPrice,BigInt(E.gasFee),BigInt(15e4)),E.priceImpact=d.getPriceImpact({sourceTokenAmount:E.sourceTokenAmount,sourceTokenPriceInUSD:E.sourceTokenPriceInUSD,toTokenPriceInUSD:E.toTokenPriceInUSD,toTokenAmount:E.toTokenAmount}),E.maxSlippage=d.getMaxSlippage(E.slippage,E.toTokenAmount),E.providerFee=d.getProviderFee(E.sourceTokenAmount))}}},12858:function(e,t,r){"use strict";r.d(t,{ThemeController:function(){return o}});var i=r(86949),n=r(45374),s=r(33734);let a=(0,i.sj)({themeMode:"dark",themeVariables:{},w3mThemeVariables:void 0}),o={state:a,subscribe:e=>(0,i.Ld)(a,()=>e(a)),setThemeMode(e){a.themeMode=e;try{let t=s.ConnectorController.getAuthConnector();if(t){let r=o.getSnapshot().themeVariables;t.provider.syncTheme({themeMode:e,themeVariables:r,w3mThemeVariables:(0,n.t)(r,e)})}}catch{console.info("Unable to sync theme to auth connector")}},setThemeVariables(e){a.themeVariables={...a.themeVariables,...e};try{let e=s.ConnectorController.getAuthConnector();if(e){let t=o.getSnapshot().themeVariables;e.provider.syncTheme({themeVariables:t,w3mThemeVariables:(0,n.t)(a.themeVariables,a.themeMode)})}}catch{console.info("Unable to sync theme to auth connector")}},getSnapshot:()=>(0,i.CO)(a)}},85340:function(e,t,r){"use strict";r.d(t,{s:function(){return h}});var i=r(86949),n=r(22192),s=r(83966),a=r(66691),o=r(46313),c=r(51440),l=r(77500),u=r(82879);let d=(0,i.sj)({transactions:[],coinbaseTransactions:{},transactionsByYear:{},lastNetworkInView:void 0,loading:!1,empty:!1,next:void 0}),h={state:d,subscribe:e=>(0,i.Ld)(d,()=>e(d)),setLastNetworkInView(e){d.lastNetworkInView=e},async fetchTransactions(e,t){if(!e)throw Error("Transactions can't be fetched without an accountAddress");d.loading=!0;try{let r=await a.L.fetchTransactions({account:e,cursor:d.next,onramp:t,cache:"coinbase"===t?"no-cache":void 0,chainId:o.R.state.activeCaipNetwork?.caipNetworkId}),i=this.filterSpamTransactions(r.data),n=this.filterByConnectedChain(i),s=[...d.transactions,...n];d.loading=!1,"coinbase"===t?d.coinbaseTransactions=this.groupTransactionsByYearAndMonth(d.coinbaseTransactions,r.data):(d.transactions=s,d.transactionsByYear=this.groupTransactionsByYearAndMonth(d.transactionsByYear,n)),d.empty=0===s.length,d.next=r.next?r.next:void 0}catch(t){c.X.sendEvent({type:"track",event:"ERROR_FETCH_TRANSACTIONS",properties:{address:e,projectId:l.OptionsController.state.projectId,cursor:d.next,isSmartAccount:s.AccountController.state.preferredAccountType===n.y_.ACCOUNT_TYPES.SMART_ACCOUNT}}),u.SnackController.showError("Failed to fetch transactions"),d.loading=!1,d.empty=!0,d.next=void 0}},groupTransactionsByYearAndMonth:(e={},t=[])=>(t.forEach(t=>{let r=new Date(t.metadata.minedAt).getFullYear(),i=new Date(t.metadata.minedAt).getMonth(),n=e[r]??{},s=(n[i]??[]).filter(e=>e.id!==t.id);e[r]={...n,[i]:[...s,t].sort((e,t)=>new Date(t.metadata.minedAt).getTime()-new Date(e.metadata.minedAt).getTime())}}),e),filterSpamTransactions:e=>e.filter(e=>!e.transfers.every(e=>e.nft_info?.flags.is_spam===!0)),filterByConnectedChain(e){let t=o.R.state.activeCaipNetwork?.caipNetworkId;return e.filter(e=>e.metadata.chain===t)},clearCursor(){d.next=void 0},resetTransactions(){d.transactions=[],d.transactionsByYear={},d.lastNetworkInView=void 0,d.loading=!1,d.empty=!1,d.next=void 0}}},44639:function(e,t,r){"use strict";r.d(t,{f:function(){return c}});var i=r(86949),n=r(48113),s=r(87374);let a={eip155:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",solana:"a1b58899-f671-4276-6a5e-56ca5bd59700",polkadot:"",bip122:"0b4838db-0161-4ffe-022d-532bf03dba00"},o=(0,i.sj)({networkImagePromises:{}}),c={async fetchWalletImage(e){if(e)return await n.ApiController._fetchWalletImage(e),this.getWalletImageById(e)},async fetchNetworkImage(e){if(e)return this.getNetworkImageById(e)||(o.networkImagePromises[e]||(o.networkImagePromises[e]=n.ApiController._fetchNetworkImage(e)),await o.networkImagePromises[e],this.getNetworkImageById(e))},getWalletImageById(e){if(e)return s.W.state.walletImages[e]},getWalletImage:e=>e?.image_url?e?.image_url:e?.image_id?s.W.state.walletImages[e.image_id]:void 0,getNetworkImage:e=>e?.assets?.imageUrl?e?.assets?.imageUrl:e?.assets?.imageId?s.W.state.networkImages[e.assets.imageId]:void 0,getNetworkImageById(e){if(e)return s.W.state.networkImages[e]},getConnectorImage:e=>e?.imageUrl?e.imageUrl:e?.imageId?s.W.state.connectorImages[e.imageId]:void 0,getChainImage:e=>s.W.state.networkImages[a[e]]}},47205:function(e,t,r){"use strict";r.d(t,{a$:function(){return a},bq:function(){return o},gy:function(){return s}});var i=r(34155);let n=(void 0!==i&&void 0!==i.env?i.env.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",s=[{label:"Coinbase",name:"coinbase",feeRange:"1-2%",url:"",supportedChains:["eip155"]},{label:"Meld.io",name:"meld",feeRange:"1-2%",url:"https://meldcrypto.com",supportedChains:["eip155","solana"]}],a="WXETMuFUQmqqybHuRkSgxv:25B8LJHSfpG6LVjR2ytU5Cwh7Z4Sch2ocoU",o={FOUR_MINUTES_MS:24e4,TEN_SEC_MS:1e4,FIVE_SEC_MS:5e3,THREE_SEC_MS:3e3,ONE_SEC_MS:1e3,SECURE_SITE:n,SECURE_SITE_DASHBOARD:`${n}/dashboard`,SECURE_SITE_FAVICON:`${n}/images/favicon.png`,RESTRICTED_TIMEZONES:["ASIA/SHANGHAI","ASIA/URUMQI","ASIA/CHONGQING","ASIA/HARBIN","ASIA/KASHGAR","ASIA/MACAU","ASIA/HONG_KONG","ASIA/MACAO","ASIA/BEIJING","ASIA/HARBIN"],WC_COINBASE_PAY_SDK_CHAINS:["ethereum","arbitrum","polygon","berachain","avalanche-c-chain","optimism","celo","base"],WC_COINBASE_PAY_SDK_FALLBACK_CHAIN:"ethereum",WC_COINBASE_PAY_SDK_CHAIN_NAME_MAP:{Ethereum:"ethereum","Arbitrum One":"arbitrum",Polygon:"polygon",Berachain:"berachain",Avalanche:"avalanche-c-chain","OP Mainnet":"optimism",Celo:"celo",Base:"base"},WC_COINBASE_ONRAMP_APP_ID:"bf18c88d-495a-463b-b249-0b9d3656cf5e",SWAP_SUGGESTED_TOKENS:["ETH","UNI","1INCH","AAVE","SOL","ADA","AVAX","DOT","LINK","NITRO","GAIA","MILK","TRX","NEAR","GNO","WBTC","DAI","WETH","USDC","USDT","ARB","BAL","BICO","CRV","ENS","MATIC","OP"],SWAP_POPULAR_TOKENS:["ETH","UNI","1INCH","AAVE","SOL","ADA","AVAX","DOT","LINK","NITRO","GAIA","MILK","TRX","NEAR","GNO","WBTC","DAI","WETH","USDC","USDT","ARB","BAL","BICO","CRV","ENS","MATIC","OP","METAL","DAI","CHAMP","WOLF","SALE","BAL","BUSD","MUST","BTCpx","ROUTE","HEX","WELT","amDAI","VSQ","VISION","AURUM","pSP","SNX","VC","LINK","CHP","amUSDT","SPHERE","FOX","GIDDY","GFC","OMEN","OX_OLD","DE","WNT"],BALANCE_SUPPORTED_CHAINS:["eip155","solana"],SWAP_SUPPORTED_NETWORKS:["eip155:1","eip155:42161","eip155:10","eip155:324","eip155:8453","eip155:56","eip155:137","eip155:100","eip155:43114","eip155:250","eip155:8217","eip155:1313161554"],NAMES_SUPPORTED_CHAIN_NAMESPACES:["eip155"],ONRAMP_SUPPORTED_CHAIN_NAMESPACES:["eip155","solana"],ACTIVITY_ENABLED_CHAIN_NAMESPACES:["eip155","solana"],NATIVE_TOKEN_ADDRESS:{eip155:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",solana:"So11111111111111111111111111111111111111111",polkadot:"0x",bip122:"0x"},CONVERT_SLIPPAGE_TOLERANCE:1,CONNECT_LABELS:{MOBILE:"Open and continue in a new browser tab"},DEFAULT_FEATURES:{swaps:!0,onramp:!0,receive:!0,send:!0,email:!0,emailShowWallets:!0,socials:["google","x","discord","farcaster","github","apple","facebook"],connectorTypeOrder:["walletConnect","recent","injected","featured","custom","external","recommended"],history:!0,analytics:!0,allWallets:!0,legalCheckbox:!1,smartSessions:!1,collapseWallets:!1,walletFeaturesOrder:["onramp","swaps","receive","send"],connectMethodsOrder:void 0},DEFAULT_ACCOUNT_TYPES:{bip122:"payment",eip155:"smartAccount",polkadot:"eoa",solana:"eoa"},ADAPTER_TYPES:{UNIVERSAL:"universal",SOLANA:"solana",WAGMI:"wagmi",ETHERS:"ethers",ETHERS5:"ethers5",BITCOIN:"bitcoin"}}},83241:function(e,t,r){"use strict";r.d(t,{j:function(){return a}});var i=r(68314),n=r(47205),s=r(64125);let a={isMobile(){return!!this.isClient()&&!!(window?.matchMedia("(pointer:coarse)")?.matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent))},checkCaipNetwork:(e,t="")=>e?.caipNetworkId.toLocaleLowerCase().includes(t.toLowerCase()),isAndroid(){if(!this.isMobile())return!1;let e=window?.navigator.userAgent.toLowerCase();return a.isMobile()&&e.includes("android")},isIos(){if(!this.isMobile())return!1;let e=window?.navigator.userAgent.toLowerCase();return e.includes("iphone")||e.includes("ipad")},isSafari(){return!!this.isClient()&&(window?.navigator.userAgent.toLowerCase()).includes("safari")},isClient:()=>"undefined"!=typeof window,isPairingExpired:e=>!e||e-Date.now()<=n.bq.TEN_SEC_MS,isAllowedRetry:(e,t=n.bq.ONE_SEC_MS)=>Date.now()-e>=t,copyToClopboard(e){navigator.clipboard.writeText(e)},isIframe(){try{return window?.self!==window?.top}catch(e){return!1}},getPairingExpiry:()=>Date.now()+n.bq.FOUR_MINUTES_MS,getNetworkId:e=>e?.split(":")[1],getPlainAddress:e=>e?.split(":")[2],wait:async e=>new Promise(t=>{setTimeout(t,e)}),debounce(e,t=500){let r;return(...i)=>{r&&clearTimeout(r),r=setTimeout(function(){e(...i)},t)}},isHttpUrl:e=>e.startsWith("http://")||e.startsWith("https://"),formatNativeUrl(e,t){if(a.isHttpUrl(e))return this.formatUniversalUrl(e,t);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.isTelegram()&&this.isAndroid()&&(t=encodeURIComponent(t));let i=encodeURIComponent(t);return{redirect:`${r}wc?uri=${i}`,href:r}},formatUniversalUrl(e,t){if(!a.isHttpUrl(e))return this.formatNativeUrl(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let i=encodeURIComponent(t);return{redirect:`${r}wc?uri=${i}`,href:r}},getOpenTargetForPlatform(e){return"popupWindow"===e?e:this.isTelegram()?s.M.getTelegramSocialProvider()?"_top":"_blank":e},openHref(e,t,r){window?.open(e,this.getOpenTargetForPlatform(t),r||"noreferrer noopener")},returnOpenHref(e,t,r){return window?.open(e,this.getOpenTargetForPlatform(t),r||"noreferrer noopener")},isTelegram:()=>"undefined"!=typeof window&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto),preloadImage:async e=>Promise.race([new Promise((t,r)=>{let i=new Image;i.onload=t,i.onerror=r,i.crossOrigin="anonymous",i.src=e}),a.wait(2e3)]),formatBalance(e,t){let r="0.000";if("string"==typeof e){let t=Number(e);if(t){let e=Math.floor(1e3*t)/1e3;e&&(r=e.toString())}}return`${r}${t?` ${t}`:""}`},formatBalance2(e,t){let r;if("0"===e)r="0";else if("string"==typeof e){let t=Number(e);t&&(r=t.toString().match(/^-?\d+(?:\.\d{0,3})?/u)?.[0])}return{value:r??"0",rest:"0"===r?"000":"",symbol:t}},getApiUrl:()=>i.b.W3M_API_URL,getBlockchainApiUrl:()=>i.b.BLOCKCHAIN_API_RPC_URL,getAnalyticsUrl:()=>i.b.PULSE_API_URL,getUUID:()=>crypto?.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,e=>{let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}),parseError:e=>"string"==typeof e?e:"string"==typeof e?.issues?.[0]?.message?e.issues[0].message:e instanceof Error?e.message:"Unknown error",sortRequestedNetworks(e,t=[]){let r={};return t&&e&&(e.forEach((e,t)=>{r[e]=t}),t.sort((e,t)=>{let i=r[e.id],n=r[t.id];return void 0!==i&&void 0!==n?i-n:void 0!==i?-1:void 0!==n?1:0})),t},calculateBalance(e){let t=0;for(let r of e)t+=r.value??0;return t},formatTokenBalance(e){let[t,r]=e.toFixed(2).split(".");return{dollars:t,pennies:r}},isAddress(e,t="eip155"){switch(t){case"eip155":if(/^(?:0x)?[0-9a-f]{40}$/iu.test(e)&&(/^(?:0x)?[0-9a-f]{40}$/iu.test(e)||/^(?:0x)?[0-9A-F]{40}$/iu.test(e)))return!0;return!1;case"solana":return/[1-9A-HJ-NP-Za-km-z]{32,44}$/iu.test(e);default:return!1}},uniqueBy(e,t){let r=new Set;return e.filter(e=>{let i=e[t];return!r.has(i)&&(r.add(i),!0)})},generateSdkVersion(e,t,r){let i=0===e.length?n.bq.ADAPTER_TYPES.UNIVERSAL:e.map(e=>e.adapterType).join(",");return`${t}-${i}-${r}`},createAccount:(e,t,r,i,n)=>({namespace:e,address:t,type:r,publicKey:i,path:n}),isCaipAddress(e){if("string"!=typeof e)return!1;let t=e.split(":"),r=t[0];return 3===t.filter(Boolean).length&&r in i.b.CHAIN_NAME_MAP},isMac(){let e=window?.navigator.userAgent.toLowerCase();return e.includes("macintosh")&&!e.includes("safari")},formatTelegramSocialLoginUrl(e){let t=`--${encodeURIComponent(window?.location.href)}`,r="state=";if("auth.magic.link"===new URL(e).host){let i="provider_authorization_url=",n=e.substring(e.indexOf(i)+i.length),s=this.injectIntoUrl(decodeURIComponent(n),r,t);return e.replace(n,encodeURIComponent(s))}return this.injectIntoUrl(e,r,t)},injectIntoUrl(e,t,r){let i=e.indexOf(t);if(-1===i)throw Error(`${t} parameter not found in the URL: ${e}`);let n=e.indexOf("&",i),s=t.length,a=-1!==n?n:e.length,o=e.substring(0,i+s);return o+(e.substring(i+s,a)+r)+e.substring(n)}}},28356:function(e,t,r){"use strict";async function i(...e){let t=await fetch(...e);if(!t.ok)throw Error(`HTTP status code: ${t.status}`,{cause:t});return t}r.d(t,{V:function(){return n}});class n{constructor({baseUrl:e,clientId:t}){this.baseUrl=e,this.clientId=t}async get({headers:e,signal:t,cache:r,...n}){let s=this.createUrl(n);return(await i(s,{method:"GET",headers:e,signal:t,cache:r})).json()}async getBlob({headers:e,signal:t,...r}){let n=this.createUrl(r);return(await i(n,{method:"GET",headers:e,signal:t})).blob()}async post({body:e,headers:t,signal:r,...n}){let s=this.createUrl(n);return(await i(s,{method:"POST",headers:t,body:e?JSON.stringify(e):void 0,signal:r})).json()}async put({body:e,headers:t,signal:r,...n}){let s=this.createUrl(n);return(await i(s,{method:"PUT",headers:t,body:e?JSON.stringify(e):void 0,signal:r})).json()}async delete({body:e,headers:t,signal:r,...n}){let s=this.createUrl(n);return(await i(s,{method:"DELETE",headers:t,body:e?JSON.stringify(e):void 0,signal:r})).json()}createUrl({path:e,params:t}){let r=new URL(e,this.baseUrl);return t&&Object.entries(t).forEach(([e,t])=>{t&&r.searchParams.append(e,t)}),this.clientId&&r.searchParams.append("clientId",this.clientId),r}}},72579:function(e,t,r){"use strict";r.d(t,{w:function(){return g}}),r(58269);var i=r(68314),n=r(22192),s=r(83966),a=r(46313),o=r(6307),c=r(33734),l=r(51440),u=r(83662),d=r(77500),h=r(4511),f=r(82879),p=r(83241);let g={getSIWX:()=>d.OptionsController.state.siwx,async initializeIfEnabled(){let e=d.OptionsController.state.siwx,t=a.R.getActiveCaipAddress();if(!(e&&t))return;let[r,i,n]=t.split(":");if(a.R.checkIfSupportedNetwork(r))try{if((await e.getSessions(`${r}:${i}`,n)).length)return;await u.I.open({view:"SIWXSignMessage"})}catch(e){console.error("SIWXUtil:initializeIfEnabled",e),l.X.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:this.getSIWXEventProperties()}),await o.ConnectionController._getClient()?.disconnect().catch(console.error),h.RouterController.reset("Connect"),f.SnackController.showError("A problem occurred while trying initialize authentication")}},async requestSignMessage(){let e=d.OptionsController.state.siwx,t=p.j.getPlainAddress(a.R.getActiveCaipAddress()),r=a.R.getActiveCaipNetwork(),n=o.ConnectionController._getClient();if(!e)throw Error("SIWX is not enabled");if(!t)throw Error("No ActiveCaipAddress found");if(!r)throw Error("No ActiveCaipNetwork or client found");if(!n)throw Error("No ConnectionController client found");try{let s=await e.createMessage({chainId:r.caipNetworkId,accountAddress:t}),a=s.toString();c.ConnectorController.getConnectorId(r.chainNamespace)===i.b.CONNECTOR_ID.AUTH&&h.RouterController.pushTransactionStack({view:null,goBack:!1,replace:!0});let o=await n.signMessage(a);await e.addSession({data:s,message:a,signature:o}),u.I.close(),l.X.sendEvent({type:"track",event:"SIWX_AUTH_SUCCESS",properties:this.getSIWXEventProperties()})}catch(t){let e=this.getSIWXEventProperties();u.I.state.open&&"ApproveTransaction"!==h.RouterController.state.view||await u.I.open({view:"SIWXSignMessage"}),e.isSmartAccount?f.SnackController.showError("This application might not support Smart Accounts"):f.SnackController.showError("Signature declined"),l.X.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:e}),console.error("SWIXUtil:requestSignMessage",t)}},async cancelSignMessage(){try{let e=this.getSIWX();e?.getRequired?.()?await o.ConnectionController.disconnect():u.I.close(),h.RouterController.reset("Connect"),l.X.sendEvent({event:"CLICK_CANCEL_SIWX",type:"track",properties:this.getSIWXEventProperties()})}catch(e){console.error("SIWXUtil:cancelSignMessage",e)}},async getSessions(){let e=d.OptionsController.state.siwx,t=p.j.getPlainAddress(a.R.getActiveCaipAddress()),r=a.R.getActiveCaipNetwork();return e&&t&&r?e.getSessions(r.caipNetworkId,t):[]},async isSIWXCloseDisabled(){let e=this.getSIWX();if(e){let t="ApproveTransaction"===h.RouterController.state.view,r="SIWXSignMessage"===h.RouterController.state.view;if(t||r)return e.getRequired?.()&&0===(await this.getSessions()).length}return!1},async universalProviderAuthenticate({universalProvider:e,chains:t,methods:r}){let i=g.getSIWX(),n=new Set(t.map(e=>e.split(":")[0]));if(!i||1!==n.size||!n.has("eip155"))return!1;let o=await i.createMessage({chainId:a.R.getActiveCaipNetwork()?.caipNetworkId||"",accountAddress:""}),c=await e.authenticate({nonce:o.nonce,domain:o.domain,uri:o.uri,exp:o.expirationTime,iat:o.issuedAt,nbf:o.notBefore,requestId:o.requestId,version:o.version,resources:o.resources,statement:o.statement,chainId:o.chainId,methods:r,chains:[o.chainId,...t.filter(e=>e!==o.chainId)]});if(f.SnackController.showLoading("Authenticating...",{autoClose:!1}),s.AccountController.setConnectedWalletInfo({...c.session.peer.metadata,name:c.session.peer.metadata.name,icon:c.session.peer.metadata.icons?.[0],type:"WALLET_CONNECT"},Array.from(n)[0]),c?.auths?.length){let t=c.auths.map(t=>{let r=e.client.formatAuthMessage({request:t.p,iss:t.p.iss});return{data:{...t.p,accountAddress:t.p.iss.split(":").slice(-1).join(""),chainId:t.p.iss.split(":").slice(2,4).join(":"),uri:t.p.aud,version:t.p.version||o.version,expirationTime:t.p.exp,issuedAt:t.p.iat,notBefore:t.p.nbf},message:r,signature:t.s.s,cacao:t}});try{await i.setSessions(t),l.X.sendEvent({type:"track",event:"SIWX_AUTH_SUCCESS",properties:g.getSIWXEventProperties()})}catch(t){throw console.error("SIWX:universalProviderAuth - failed to set sessions",t),l.X.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:g.getSIWXEventProperties()}),await e.disconnect().catch(console.error),t}finally{f.SnackController.hide()}}return!0},getSIWXEventProperties:()=>({network:a.R.state.activeCaipNetwork?.caipNetworkId||"",isSmartAccount:s.AccountController.state.preferredAccountType===n.y_.ACCOUNT_TYPES.SMART_ACCOUNT}),async clearSessions(){let e=this.getSIWX();e&&await e.setSessions([])}}},64125:function(e,t,r){"use strict";r.d(t,{M:function(){return n}});var i=r(35855);let n={cacheExpiry:{portfolio:3e4,nativeBalance:3e4,ens:3e5,identity:3e5},isCacheExpired:(e,t)=>Date.now()-e>t,getActiveNetworkProps(){let e=n.getActiveNamespace(),t=n.getActiveCaipNetworkId(),r=t?t.split(":")[1]:void 0;return{namespace:e,caipNetworkId:t,chainId:r?isNaN(Number(r))?r:Number(r):void 0}},setWalletConnectDeepLink({name:e,href:t}){try{i.mr.setItem(i.uJ.DEEPLINK_CHOICE,JSON.stringify({href:t,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},getWalletConnectDeepLink(){try{let e=i.mr.getItem(i.uJ.DEEPLINK_CHOICE);if(e)return JSON.parse(e)}catch{console.info("Unable to get WalletConnect deep link")}},deleteWalletConnectDeepLink(){try{i.mr.removeItem(i.uJ.DEEPLINK_CHOICE)}catch{console.info("Unable to delete WalletConnect deep link")}},setActiveNamespace(e){try{i.mr.setItem(i.uJ.ACTIVE_NAMESPACE,e)}catch{console.info("Unable to set active namespace")}},setActiveCaipNetworkId(e){try{i.mr.setItem(i.uJ.ACTIVE_CAIP_NETWORK_ID,e),n.setActiveNamespace(e.split(":")[0])}catch{console.info("Unable to set active caip network id")}},getActiveCaipNetworkId(){try{return i.mr.getItem(i.uJ.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to get active caip network id");return}},deleteActiveCaipNetworkId(){try{i.mr.removeItem(i.uJ.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to delete active caip network id")}},deleteConnectedConnectorId(e){try{let t=(0,i.Vk)(e);i.mr.removeItem(t)}catch{console.info("Unable to delete connected connector id")}},setAppKitRecent(e){try{let t=n.getRecentWallets();t.find(t=>t.id===e.id)||(t.unshift(e),t.length>2&&t.pop(),i.mr.setItem(i.uJ.RECENT_WALLETS,JSON.stringify(t)))}catch{console.info("Unable to set AppKit recent")}},getRecentWallets(){try{let e=i.mr.getItem(i.uJ.RECENT_WALLETS);return e?JSON.parse(e):[]}catch{console.info("Unable to get AppKit recent")}return[]},setConnectedConnectorId(e,t){try{let r=(0,i.Vk)(e);i.mr.setItem(r,t)}catch{console.info("Unable to set Connected Connector Id")}},getActiveNamespace(){try{return i.mr.getItem(i.uJ.ACTIVE_NAMESPACE)}catch{console.info("Unable to get active namespace")}},getConnectedConnectorId(e){if(e)try{let t=(0,i.Vk)(e);return i.mr.getItem(t)}catch(t){console.info("Unable to get connected connector id in namespace ",e)}},setConnectedSocialProvider(e){try{i.mr.setItem(i.uJ.CONNECTED_SOCIAL,e)}catch{console.info("Unable to set connected social provider")}},getConnectedSocialProvider(){try{return i.mr.getItem(i.uJ.CONNECTED_SOCIAL)}catch{console.info("Unable to get connected social provider")}},deleteConnectedSocialProvider(){try{i.mr.removeItem(i.uJ.CONNECTED_SOCIAL)}catch{console.info("Unable to delete connected social provider")}},getConnectedSocialUsername(){try{return i.mr.getItem(i.uJ.CONNECTED_SOCIAL_USERNAME)}catch{console.info("Unable to get connected social username")}},getStoredActiveCaipNetworkId(){let e=i.mr.getItem(i.uJ.ACTIVE_CAIP_NETWORK_ID);return e?.split(":")?.[1]},setConnectionStatus(e){try{i.mr.setItem(i.uJ.CONNECTION_STATUS,e)}catch{console.info("Unable to set connection status")}},getConnectionStatus(){try{return i.mr.getItem(i.uJ.CONNECTION_STATUS)}catch{return}},getConnectedNamespaces(){try{let e=i.mr.getItem(i.uJ.CONNECTED_NAMESPACES);if(!e?.length)return[];return e.split(",")}catch{return[]}},setConnectedNamespaces(e){try{let t=Array.from(new Set(e));i.mr.setItem(i.uJ.CONNECTED_NAMESPACES,t.join(","))}catch{console.info("Unable to set namespaces in storage")}},addConnectedNamespace(e){try{let t=n.getConnectedNamespaces();t.includes(e)||(t.push(e),n.setConnectedNamespaces(t))}catch{console.info("Unable to add connected namespace")}},removeConnectedNamespace(e){try{let t=n.getConnectedNamespaces(),r=t.indexOf(e);r>-1&&(t.splice(r,1),n.setConnectedNamespaces(t))}catch{console.info("Unable to remove connected namespace")}},getTelegramSocialProvider(){try{return i.mr.getItem(i.uJ.TELEGRAM_SOCIAL_PROVIDER)}catch{return console.info("Unable to get telegram social provider"),null}},setTelegramSocialProvider(e){try{i.mr.setItem(i.uJ.TELEGRAM_SOCIAL_PROVIDER,e)}catch{console.info("Unable to set telegram social provider")}},removeTelegramSocialProvider(){try{i.mr.removeItem(i.uJ.TELEGRAM_SOCIAL_PROVIDER)}catch{console.info("Unable to remove telegram social provider")}},getBalanceCache(){let e={};try{let t=i.mr.getItem(i.uJ.PORTFOLIO_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get balance cache")}return e},removeAddressFromBalanceCache(e){try{let t=n.getBalanceCache();i.mr.setItem(i.uJ.PORTFOLIO_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove address from balance cache",e)}},getBalanceCacheForCaipAddress(e){try{let t=n.getBalanceCache()[e];if(t&&!this.isCacheExpired(t.timestamp,this.cacheExpiry.portfolio))return t.balance;n.removeAddressFromBalanceCache(e)}catch{console.info("Unable to get balance cache for address",e)}},updateBalanceCache(e){try{let t=n.getBalanceCache();t[e.caipAddress]=e,i.mr.setItem(i.uJ.PORTFOLIO_CACHE,JSON.stringify(t))}catch{console.info("Unable to update balance cache",e)}},getNativeBalanceCache(){let e={};try{let t=i.mr.getItem(i.uJ.NATIVE_BALANCE_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get balance cache")}return e},removeAddressFromNativeBalanceCache(e){try{let t=n.getBalanceCache();i.mr.setItem(i.uJ.NATIVE_BALANCE_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove address from balance cache",e)}},getNativeBalanceCacheForCaipAddress(e){try{let t=n.getNativeBalanceCache()[e];if(t&&!this.isCacheExpired(t.timestamp,this.cacheExpiry.nativeBalance))return t;console.info("Discarding cache for address",e),n.removeAddressFromBalanceCache(e)}catch{console.info("Unable to get balance cache for address",e)}},updateNativeBalanceCache(e){try{let t=n.getNativeBalanceCache();t[e.caipAddress]=e,i.mr.setItem(i.uJ.NATIVE_BALANCE_CACHE,JSON.stringify(t))}catch{console.info("Unable to update balance cache",e)}},getEnsCache(){let e={};try{let t=i.mr.getItem(i.uJ.ENS_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get ens name cache")}return e},getEnsFromCacheForAddress(e){try{let t=n.getEnsCache()[e];if(t&&!this.isCacheExpired(t.timestamp,this.cacheExpiry.ens))return t.ens;n.removeEnsFromCache(e)}catch{console.info("Unable to get ens name from cache",e)}},updateEnsCache(e){try{let t=n.getEnsCache();t[e.address]=e,i.mr.setItem(i.uJ.ENS_CACHE,JSON.stringify(t))}catch{console.info("Unable to update ens name cache",e)}},removeEnsFromCache(e){try{let t=n.getEnsCache();i.mr.setItem(i.uJ.ENS_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove ens name from cache",e)}},getIdentityCache(){let e={};try{let t=i.mr.getItem(i.uJ.IDENTITY_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get identity cache")}return e},getIdentityFromCacheForAddress(e){try{let t=n.getIdentityCache()[e];if(t&&!this.isCacheExpired(t.timestamp,this.cacheExpiry.identity))return t.identity;n.removeIdentityFromCache(e)}catch{console.info("Unable to get identity from cache",e)}},updateIdentityCache(e){try{let t=n.getIdentityCache();t[e.address]={identity:e.identity,timestamp:e.timestamp},i.mr.setItem(i.uJ.IDENTITY_CACHE,JSON.stringify(t))}catch{console.info("Unable to update identity cache",e)}},removeIdentityFromCache(e){try{let t=n.getIdentityCache();i.mr.setItem(i.uJ.IDENTITY_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove identity from cache",e)}},clearAddressCache(){try{i.mr.removeItem(i.uJ.PORTFOLIO_CACHE),i.mr.removeItem(i.uJ.NATIVE_BALANCE_CACHE),i.mr.removeItem(i.uJ.ENS_CACHE),i.mr.removeItem(i.uJ.IDENTITY_CACHE)}catch{console.info("Unable to clear address cache")}}}},2446:function(e,t,r){"use strict";r.d(t,{n:function(){return o}});var i=r(83966),n=r(66691),s=r(46313),a=r(6307);let o={async getTokenList(){let e=s.R.state.activeCaipNetwork,t=await n.L.fetchSwapTokens({chainId:e?.caipNetworkId});return t?.tokens?.map(e=>({...e,eip2612:!1,quantity:{decimals:"0",numeric:"0"},price:0,value:0}))||[]},async fetchGasPrice(){let e=s.R.state.activeCaipNetwork;if(!e)return null;try{if("solana"===e.chainNamespace){let e=(await a.ConnectionController?.estimateGas({chainNamespace:"solana"}))?.toString();return{standard:e,fast:e,instant:e}}return await n.L.fetchGasPrice({chainId:e.caipNetworkId})}catch{return null}},async fetchSwapAllowance({tokenAddress:e,userAddress:t,sourceTokenAmount:r,sourceTokenDecimals:i}){let s=await n.L.fetchSwapAllowance({tokenAddress:e,userAddress:t});if(s?.allowance&&r&&i){let e=a.ConnectionController.parseUnits(r,i)||0;return BigInt(s.allowance)>=e}return!1},async getMyTokensWithBalance(e){let t=i.AccountController.state.address,r=s.R.state.activeCaipNetwork;if(!t||!r)return[];let a=(await n.L.getBalance(t,r.caipNetworkId,e)).balances.filter(e=>"0"!==e.quantity.decimals);return i.AccountController.setTokenBalance(a,s.R.state.activeChain),this.mapBalancesToSwapTokens(a)},mapBalancesToSwapTokens:e=>e?.map(e=>({...e,address:e?.address?e.address:s.R.getActiveNetworkTokenAddress(),decimals:parseInt(e.quantity.decimals,10),logoUri:e.iconUrl,eip2612:!1}))||[]}},11697:function(e,t,r){"use strict";r.d(t,{C:function(){return h}});var i=r(68314),n=r(77500),s=r(64125),a=r(83241),o=r(6307),c=r(48113),l=r(46313),u=r(33734),d=r(32786);let h={getConnectorsByType(e,t,r){let{customWallets:i}=n.OptionsController.state,a=s.M.getRecentWallets(),o=d.J.filterOutDuplicateWallets(t),c=d.J.filterOutDuplicateWallets(r),l=e.filter(e=>"MULTI_CHAIN"===e.type),u=e.filter(e=>"ANNOUNCED"===e.type),h=e.filter(e=>"INJECTED"===e.type);return{custom:i,recent:a,external:e.filter(e=>"EXTERNAL"===e.type),multiChain:l,announced:u,injected:h,recommended:o,featured:c}},showConnector(e){if("INJECTED"===e.type){if(!a.j.isMobile()&&"Browser Wallet"===e.name)return!1;let t=e.info?.rdns;if(!t&&!o.ConnectionController.checkInstalled()||t&&c.ApiController.state.excludedRDNS&&c.ApiController.state.excludedRDNS.includes(t))return!1}if("ANNOUNCED"===e.type){let t=e.info?.rdns;if(t&&c.ApiController.state.excludedRDNS.includes(t))return!1}return!0},getIsConnectedWithWC:()=>Array.from(l.R.state.chains.values()).some(e=>u.ConnectorController.getConnectorId(e.namespace)===i.b.CONNECTOR_ID.WALLET_CONNECT),getConnectorTypeOrder({recommended:e,featured:t,custom:r,recent:i,announced:s,injected:a,multiChain:o,external:c,overriddenConnectors:l=n.OptionsController.state.features?.connectorTypeOrder??[]}){let u=h.getIsConnectedWithWC(),d=[{type:"walletConnect",isEnabled:n.OptionsController.state.enableWalletConnect&&!u},{type:"recent",isEnabled:i.length>0},{type:"injected",isEnabled:[...a,...s,...o].length>0},{type:"featured",isEnabled:t.length>0},{type:"custom",isEnabled:r&&r.length>0},{type:"external",isEnabled:c.length>0},{type:"recommended",isEnabled:e.length>0}].filter(e=>e.isEnabled),f=new Set(d.map(e=>e.type)),p=l.filter(e=>f.has(e)).map(e=>({type:e,isEnabled:!0})),g=d.filter(({type:e})=>!p.some(({type:t})=>t===e));return Array.from(new Set([...p,...g].map(({type:e})=>e)))}}},72134:function(e,t,r){"use strict";r.d(t,{b:function(){return n}});var i=r(34155);let n={ACCOUNT_TABS:[{label:"Tokens"},{label:"NFTs"},{label:"Activity"}],SECURE_SITE_ORIGIN:(void 0!==i&&void 0!==i.env?i.env.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",VIEW_DIRECTION:{Next:"next",Prev:"prev"},DEFAULT_CONNECT_METHOD_ORDER:["email","social","wallet"],ANIMATION_DURATIONS:{HeaderText:120,ModalHeight:150,ViewTransition:150}}},32786:function(e,t,r){"use strict";r.d(t,{J:function(){return u}});var i=r(77500),n=r(33734),s=r(64125),a=r(83241),o=r(48113),c=r(11697),l=r(72134);let u={filterOutDuplicatesByRDNS(e){let t=i.OptionsController.state.enableEIP6963?n.ConnectorController.state.connectors:[],r=s.M.getRecentWallets(),o=t.map(e=>e.info?.rdns).filter(Boolean),c=r.map(e=>e.rdns).filter(Boolean),l=o.concat(c);if(l.includes("io.metamask.mobile")&&a.j.isMobile()){let e=l.indexOf("io.metamask.mobile");l[e]="io.metamask"}return e.filter(e=>!l.includes(String(e?.rdns)))},filterOutDuplicatesByIds(e){let t=n.ConnectorController.state.connectors.filter(e=>"ANNOUNCED"===e.type||"INJECTED"===e.type),r=s.M.getRecentWallets(),i=t.map(e=>e.explorerId),a=r.map(e=>e.id),o=i.concat(a);return e.filter(e=>!o.includes(e?.id))},filterOutDuplicateWallets(e){let t=this.filterOutDuplicatesByRDNS(e);return this.filterOutDuplicatesByIds(t)},markWalletsAsInstalled(e){let{connectors:t}=n.ConnectorController.state,r=t.filter(e=>"ANNOUNCED"===e.type).reduce((e,t)=>(t.info?.rdns&&(e[t.info.rdns]=!0),e),{});return e.map(e=>({...e,installed:!!e.rdns&&!!r[e.rdns??""]})).sort((e,t)=>Number(t.installed)-Number(e.installed))},getConnectOrderMethod(e,t){let r=e?.connectMethodsOrder||i.OptionsController.state.features?.connectMethodsOrder,s=t||n.ConnectorController.state.connectors;if(r)return r;let{injected:a,announced:u}=c.C.getConnectorsByType(s,o.ApiController.state.recommended,o.ApiController.state.featured),d=a.filter(c.C.showConnector),h=u.filter(c.C.showConnector);return d.length||h.length?["wallet","email","social"]:l.b.DEFAULT_CONNECT_METHOD_ORDER}}},28740:function(e,t,r){"use strict";r.d(t,{kj:function(){return i},AI:function(){return l},Hg:function(){return s.H},Mo:function(){return u.M},n:function(){return n.n},Hs:function(){return n.Hs},R:function(){return n.R}});let i={interpolate(e,t,r){if(2!==e.length||2!==t.length)throw Error("inputRange and outputRange must be an array of length 2");let i=e[0]||0,n=e[1]||0,s=t[0]||0,a=t[1]||0;return rn?a:(a-s)/(n-i)*(r-i)+s}};var n=r(24134),s=r(1512),a=r(1631);let o=["receive","deposit","borrow","claim"],c=["withdraw","repay","burn"],l={getTransactionGroupTitle(e,t){let r=a.E.getYear(),i=a.E.getMonthNameByIndex(t);return e===r?i:`${i} ${e}`},getTransactionImages(e){let[t,r]=e,i=!!t&&e?.every(e=>!!e.nft_info),n=e?.length>1;return e?.length!==2||i?n?e.map(e=>this.getTransactionImage(e)):[this.getTransactionImage(t)]:[this.getTransactionImage(t),this.getTransactionImage(r)]},getTransactionImage:e=>({type:l.getTransactionTransferTokenType(e),url:l.getTransactionImageURL(e)}),getTransactionImageURL(e){let t;let r=!!e?.nft_info,i=!!e?.fungible_info;return e&&r?t=e?.nft_info?.content?.preview?.url:e&&i&&(t=e?.fungible_info?.icon?.url),t},getTransactionTransferTokenType:e=>e?.fungible_info?"FUNGIBLE":e?.nft_info?"NFT":void 0,getTransactionDescriptions(e){let t=e?.metadata?.operationType,r=e?.transfers,i=e?.transfers?.length>0,n=e?.transfers?.length>1,a=i&&r?.every(e=>!!e?.fungible_info),[l,u]=r,d=this.getTransferDescription(l);if(this.getTransferDescription(u),!i)return("send"===t||"receive"===t)&&a?[d=s.H.getTruncateString({string:e?.metadata.sentFrom,charsStart:4,charsEnd:6,truncate:"middle"}),s.H.getTruncateString({string:e?.metadata.sentTo,charsStart:4,charsEnd:6,truncate:"middle"})]:[e.metadata.status];if(n)return r.map(e=>this.getTransferDescription(e));let h="";return o.includes(t)?h="+":c.includes(t)&&(h="-"),[d=h.concat(d)]},getTransferDescription(e){let t="";return e&&(e?.nft_info?t=e?.nft_info?.name||"-":e?.fungible_info&&(t=this.getFungibleTransferDescription(e)||"-")),t},getFungibleTransferDescription(e){return e?[this.getQuantityFixedValue(e?.quantity.numeric),e?.fungible_info?.symbol].join(" ").trim():null},getQuantityFixedValue:e=>e?parseFloat(e).toFixed(3):null};var u=r(25729)},24134:function(e,t,r){"use strict";let i,n,s;r.d(t,{Bp:function(){return p},ET:function(){return h},Hs:function(){return l},R:function(){return u},ZM:function(){return f},n:function(){return c}});var a=r(77996),o=r(45374);function c(e,t){i=document.createElement("style"),n=document.createElement("style"),s=document.createElement("style"),i.textContent=d(e).core.cssText,n.textContent=d(e).dark.cssText,s.textContent=d(e).light.cssText,document.head.appendChild(i),document.head.appendChild(n),document.head.appendChild(s),l(t)}function l(e){n&&s&&("light"===e?(n.removeAttribute("media"),s.media="enabled"):(s.removeAttribute("media"),n.media="enabled"))}function u(e){i&&n&&s&&(i.textContent=d(e).core.cssText,n.textContent=d(e).dark.cssText,s.textContent=d(e).light.cssText)}function d(e){return{core:(0,a.iv)` @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap'); @keyframes w3m-shake { 0% { transform: scale(1) rotate(0deg); } 20% { transform: scale(1) rotate(-1deg); } 40% { transform: scale(1) rotate(1.5deg); } 60% { transform: scale(1) rotate(-1.5deg); } 80% { transform: scale(1) rotate(1deg); } 100% { transform: scale(1) rotate(0deg); } } @keyframes w3m-iframe-fade-out { 0% { opacity: 1; } 100% { opacity: 0; } } @keyframes w3m-iframe-zoom-in { 0% { transform: translateY(50px); opacity: 0; } 100% { transform: translateY(0px); opacity: 1; } } @keyframes w3m-iframe-zoom-in-mobile { 0% { transform: scale(0.95); opacity: 0; } 100% { transform: scale(1); opacity: 1; } } :root { --w3m-modal-width: 360px; --w3m-color-mix-strength: ${(0,a.$m)(e?.["--w3m-color-mix-strength"]?`${e["--w3m-color-mix-strength"]}%`:"0%")}; --w3m-font-family: ${(0,a.$m)(e?.["--w3m-font-family"]||"Inter, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;")}; --w3m-font-size-master: ${(0,a.$m)(e?.["--w3m-font-size-master"]||"10px")}; --w3m-border-radius-master: ${(0,a.$m)(e?.["--w3m-border-radius-master"]||"4px")}; --w3m-z-index: ${(0,a.$m)(e?.["--w3m-z-index"]||999)}; --wui-font-family: var(--w3m-font-family); --wui-font-size-mini: calc(var(--w3m-font-size-master) * 0.8); --wui-font-size-micro: var(--w3m-font-size-master); --wui-font-size-tiny: calc(var(--w3m-font-size-master) * 1.2); --wui-font-size-small: calc(var(--w3m-font-size-master) * 1.4); --wui-font-size-paragraph: calc(var(--w3m-font-size-master) * 1.6); --wui-font-size-medium: calc(var(--w3m-font-size-master) * 1.8); --wui-font-size-large: calc(var(--w3m-font-size-master) * 2); --wui-font-size-title-6: calc(var(--w3m-font-size-master) * 2.2); --wui-font-size-medium-title: calc(var(--w3m-font-size-master) * 2.4); --wui-font-size-2xl: calc(var(--w3m-font-size-master) * 4); --wui-border-radius-5xs: var(--w3m-border-radius-master); --wui-border-radius-4xs: calc(var(--w3m-border-radius-master) * 1.5); --wui-border-radius-3xs: calc(var(--w3m-border-radius-master) * 2); --wui-border-radius-xxs: calc(var(--w3m-border-radius-master) * 3); --wui-border-radius-xs: calc(var(--w3m-border-radius-master) * 4); --wui-border-radius-s: calc(var(--w3m-border-radius-master) * 5); --wui-border-radius-m: calc(var(--w3m-border-radius-master) * 7); --wui-border-radius-l: calc(var(--w3m-border-radius-master) * 9); --wui-border-radius-3xl: calc(var(--w3m-border-radius-master) * 20); --wui-font-weight-light: 400; --wui-font-weight-regular: 500; --wui-font-weight-medium: 600; --wui-font-weight-bold: 700; --wui-letter-spacing-2xl: -1.6px; --wui-letter-spacing-medium-title: -0.96px; --wui-letter-spacing-title-6: -0.88px; --wui-letter-spacing-large: -0.8px; --wui-letter-spacing-medium: -0.72px; --wui-letter-spacing-paragraph: -0.64px; --wui-letter-spacing-small: -0.56px; --wui-letter-spacing-tiny: -0.48px; --wui-letter-spacing-micro: -0.2px; --wui-letter-spacing-mini: -0.16px; --wui-spacing-0: 0px; --wui-spacing-4xs: 2px; --wui-spacing-3xs: 4px; --wui-spacing-xxs: 6px; --wui-spacing-2xs: 7px; --wui-spacing-xs: 8px; --wui-spacing-1xs: 10px; --wui-spacing-s: 12px; --wui-spacing-m: 14px; --wui-spacing-l: 16px; --wui-spacing-2l: 18px; --wui-spacing-xl: 20px; --wui-spacing-xxl: 24px; --wui-spacing-2xl: 32px; --wui-spacing-3xl: 40px; --wui-spacing-4xl: 90px; --wui-spacing-5xl: 95px; --wui-icon-box-size-xxs: 14px; --wui-icon-box-size-xs: 20px; --wui-icon-box-size-sm: 24px; --wui-icon-box-size-md: 32px; --wui-icon-box-size-mdl: 36px; --wui-icon-box-size-lg: 40px; --wui-icon-box-size-2lg: 48px; --wui-icon-box-size-xl: 64px; --wui-icon-size-inherit: inherit; --wui-icon-size-xxs: 10px; --wui-icon-size-xs: 12px; --wui-icon-size-sm: 14px; --wui-icon-size-md: 16px; --wui-icon-size-mdl: 18px; --wui-icon-size-lg: 20px; --wui-icon-size-xl: 24px; --wui-icon-size-xxl: 28px; --wui-wallet-image-size-inherit: inherit; --wui-wallet-image-size-sm: 40px; --wui-wallet-image-size-md: 56px; --wui-wallet-image-size-lg: 80px; --wui-visual-size-size-inherit: inherit; --wui-visual-size-sm: 40px; --wui-visual-size-md: 55px; --wui-visual-size-lg: 80px; --wui-box-size-md: 100px; --wui-box-size-lg: 120px; --wui-ease-out-power-2: cubic-bezier(0, 0, 0.22, 1); --wui-ease-out-power-1: cubic-bezier(0, 0, 0.55, 1); --wui-ease-in-power-3: cubic-bezier(0.66, 0, 1, 1); --wui-ease-in-power-2: cubic-bezier(0.45, 0, 1, 1); --wui-ease-in-power-1: cubic-bezier(0.3, 0, 1, 1); --wui-ease-inout-power-1: cubic-bezier(0.45, 0, 0.55, 1); --wui-duration-lg: 200ms; --wui-duration-md: 125ms; --wui-duration-sm: 75ms; --wui-path-network-sm: path( 'M15.4 2.1a5.21 5.21 0 0 1 5.2 0l11.61 6.7a5.21 5.21 0 0 1 2.61 4.52v13.4c0 1.87-1 3.59-2.6 4.52l-11.61 6.7c-1.62.93-3.6.93-5.22 0l-11.6-6.7a5.21 5.21 0 0 1-2.61-4.51v-13.4c0-1.87 1-3.6 2.6-4.52L15.4 2.1Z' ); --wui-path-network-md: path( 'M43.4605 10.7248L28.0485 1.61089C25.5438 0.129705 22.4562 0.129705 19.9515 1.61088L4.53951 10.7248C2.03626 12.2051 0.5 14.9365 0.5 17.886V36.1139C0.5 39.0635 2.03626 41.7949 4.53951 43.2752L19.9515 52.3891C22.4562 53.8703 25.5438 53.8703 28.0485 52.3891L43.4605 43.2752C45.9637 41.7949 47.5 39.0635 47.5 36.114V17.8861C47.5 14.9365 45.9637 12.2051 43.4605 10.7248Z' ); --wui-path-network-lg: path( 'M78.3244 18.926L50.1808 2.45078C45.7376 -0.150261 40.2624 -0.150262 35.8192 2.45078L7.6756 18.926C3.23322 21.5266 0.5 26.3301 0.5 31.5248V64.4752C0.5 69.6699 3.23322 74.4734 7.6756 77.074L35.8192 93.5492C40.2624 96.1503 45.7376 96.1503 50.1808 93.5492L78.3244 77.074C82.7668 74.4734 85.5 69.6699 85.5 64.4752V31.5248C85.5 26.3301 82.7668 21.5266 78.3244 18.926Z' ); --wui-width-network-sm: 36px; --wui-width-network-md: 48px; --wui-width-network-lg: 86px; --wui-height-network-sm: 40px; --wui-height-network-md: 54px; --wui-height-network-lg: 96px; --wui-icon-size-network-xs: 12px; --wui-icon-size-network-sm: 16px; --wui-icon-size-network-md: 24px; --wui-icon-size-network-lg: 42px; --wui-color-inherit: inherit; --wui-color-inverse-100: #fff; --wui-color-inverse-000: #000; --wui-cover: rgba(20, 20, 20, 0.8); --wui-color-modal-bg: var(--wui-color-modal-bg-base); --wui-color-accent-100: var(--wui-color-accent-base-100); --wui-color-accent-090: var(--wui-color-accent-base-090); --wui-color-accent-080: var(--wui-color-accent-base-080); --wui-color-success-100: var(--wui-color-success-base-100); --wui-color-success-125: var(--wui-color-success-base-125); --wui-color-warning-100: var(--wui-color-warning-base-100); --wui-color-error-100: var(--wui-color-error-base-100); --wui-color-error-125: var(--wui-color-error-base-125); --wui-color-blue-100: var(--wui-color-blue-base-100); --wui-color-blue-90: var(--wui-color-blue-base-90); --wui-icon-box-bg-error-100: var(--wui-icon-box-bg-error-base-100); --wui-icon-box-bg-blue-100: var(--wui-icon-box-bg-blue-base-100); --wui-icon-box-bg-success-100: var(--wui-icon-box-bg-success-base-100); --wui-icon-box-bg-inverse-100: var(--wui-icon-box-bg-inverse-base-100); --wui-all-wallets-bg-100: var(--wui-all-wallets-bg-100); --wui-avatar-border: var(--wui-avatar-border-base); --wui-thumbnail-border: var(--wui-thumbnail-border-base); --wui-wallet-button-bg: var(--wui-wallet-button-bg-base); --wui-box-shadow-blue: var(--wui-color-accent-glass-020); } @supports (background: color-mix(in srgb, white 50%, black)) { :root { --wui-color-modal-bg: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-modal-bg-base) ); --wui-box-shadow-blue: color-mix(in srgb, var(--wui-color-accent-100) 20%, transparent); --wui-color-accent-100: color-mix( in srgb, var(--wui-color-accent-base-100) 100%, transparent ); --wui-color-accent-090: color-mix( in srgb, var(--wui-color-accent-base-100) 90%, transparent ); --wui-color-accent-080: color-mix( in srgb, var(--wui-color-accent-base-100) 80%, transparent ); --wui-color-accent-glass-090: color-mix( in srgb, var(--wui-color-accent-base-100) 90%, transparent ); --wui-color-accent-glass-080: color-mix( in srgb, var(--wui-color-accent-base-100) 80%, transparent ); --wui-color-accent-glass-020: color-mix( in srgb, var(--wui-color-accent-base-100) 20%, transparent ); --wui-color-accent-glass-015: color-mix( in srgb, var(--wui-color-accent-base-100) 15%, transparent ); --wui-color-accent-glass-010: color-mix( in srgb, var(--wui-color-accent-base-100) 10%, transparent ); --wui-color-accent-glass-005: color-mix( in srgb, var(--wui-color-accent-base-100) 5%, transparent ); --wui-color-accent-002: color-mix( in srgb, var(--wui-color-accent-base-100) 2%, transparent ); --wui-color-fg-100: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-fg-100) ); --wui-color-fg-125: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-fg-125) ); --wui-color-fg-150: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-fg-150) ); --wui-color-fg-175: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-fg-175) ); --wui-color-fg-200: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-fg-200) ); --wui-color-fg-225: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-fg-225) ); --wui-color-fg-250: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-fg-250) ); --wui-color-fg-275: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-fg-275) ); --wui-color-fg-300: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-fg-300) ); --wui-color-fg-325: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-fg-325) ); --wui-color-fg-350: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-fg-350) ); --wui-color-bg-100: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-bg-100) ); --wui-color-bg-125: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-bg-125) ); --wui-color-bg-150: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-bg-150) ); --wui-color-bg-175: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-bg-175) ); --wui-color-bg-200: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-bg-200) ); --wui-color-bg-225: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-bg-225) ); --wui-color-bg-250: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-bg-250) ); --wui-color-bg-275: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-bg-275) ); --wui-color-bg-300: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-bg-300) ); --wui-color-bg-325: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-bg-325) ); --wui-color-bg-350: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-bg-350) ); --wui-color-success-100: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-success-base-100) ); --wui-color-success-125: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-success-base-125) ); --wui-color-warning-100: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-warning-base-100) ); --wui-color-error-100: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-error-base-100) ); --wui-color-blue-100: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-blue-base-100) ); --wui-color-blue-90: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-blue-base-90) ); --wui-color-error-125: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-color-error-base-125) ); --wui-icon-box-bg-error-100: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-icon-box-bg-error-base-100) ); --wui-icon-box-bg-accent-100: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-icon-box-bg-blue-base-100) ); --wui-icon-box-bg-success-100: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-icon-box-bg-success-base-100) ); --wui-icon-box-bg-inverse-100: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-icon-box-bg-inverse-base-100) ); --wui-all-wallets-bg-100: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-all-wallets-bg-100) ); --wui-avatar-border: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-avatar-border-base) ); --wui-thumbnail-border: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-thumbnail-border-base) ); --wui-wallet-button-bg: color-mix( in srgb, var(--w3m-color-mix) var(--w3m-color-mix-strength), var(--wui-wallet-button-bg-base) ); } } `,light:(0,a.iv)` :root { --w3m-color-mix: ${(0,a.$m)(e?.["--w3m-color-mix"]||"#fff")}; --w3m-accent: ${(0,a.$m)((0,o.t)(e,"dark")["--w3m-accent"])}; --w3m-default: #fff; --wui-color-modal-bg-base: ${(0,a.$m)((0,o.t)(e,"dark")["--w3m-background"])}; --wui-color-accent-base-100: var(--w3m-accent); --wui-color-blueberry-100: hsla(230, 100%, 67%, 1); --wui-color-blueberry-090: hsla(231, 76%, 61%, 1); --wui-color-blueberry-080: hsla(230, 59%, 55%, 1); --wui-color-blueberry-050: hsla(231, 100%, 70%, 0.1); --wui-color-fg-100: #e4e7e7; --wui-color-fg-125: #d0d5d5; --wui-color-fg-150: #a8b1b1; --wui-color-fg-175: #a8b0b0; --wui-color-fg-200: #949e9e; --wui-color-fg-225: #868f8f; --wui-color-fg-250: #788080; --wui-color-fg-275: #788181; --wui-color-fg-300: #6e7777; --wui-color-fg-325: #9a9a9a; --wui-color-fg-350: #363636; --wui-color-bg-100: #141414; --wui-color-bg-125: #191a1a; --wui-color-bg-150: #1e1f1f; --wui-color-bg-175: #222525; --wui-color-bg-200: #272a2a; --wui-color-bg-225: #2c3030; --wui-color-bg-250: #313535; --wui-color-bg-275: #363b3b; --wui-color-bg-300: #3b4040; --wui-color-bg-325: #252525; --wui-color-bg-350: #ffffff; --wui-color-success-base-100: #26d962; --wui-color-success-base-125: #30a46b; --wui-color-warning-base-100: #f3a13f; --wui-color-error-base-100: #f25a67; --wui-color-error-base-125: #df4a34; --wui-color-blue-base-100: rgba(102, 125, 255, 1); --wui-color-blue-base-90: rgba(102, 125, 255, 0.9); --wui-color-success-glass-001: rgba(38, 217, 98, 0.01); --wui-color-success-glass-002: rgba(38, 217, 98, 0.02); --wui-color-success-glass-005: rgba(38, 217, 98, 0.05); --wui-color-success-glass-010: rgba(38, 217, 98, 0.1); --wui-color-success-glass-015: rgba(38, 217, 98, 0.15); --wui-color-success-glass-020: rgba(38, 217, 98, 0.2); --wui-color-success-glass-025: rgba(38, 217, 98, 0.25); --wui-color-success-glass-030: rgba(38, 217, 98, 0.3); --wui-color-success-glass-060: rgba(38, 217, 98, 0.6); --wui-color-success-glass-080: rgba(38, 217, 98, 0.8); --wui-color-success-glass-reown-020: rgba(48, 164, 107, 0.2); --wui-color-warning-glass-reown-020: rgba(243, 161, 63, 0.2); --wui-color-error-glass-001: rgba(242, 90, 103, 0.01); --wui-color-error-glass-002: rgba(242, 90, 103, 0.02); --wui-color-error-glass-005: rgba(242, 90, 103, 0.05); --wui-color-error-glass-010: rgba(242, 90, 103, 0.1); --wui-color-error-glass-015: rgba(242, 90, 103, 0.15); --wui-color-error-glass-020: rgba(242, 90, 103, 0.2); --wui-color-error-glass-025: rgba(242, 90, 103, 0.25); --wui-color-error-glass-030: rgba(242, 90, 103, 0.3); --wui-color-error-glass-060: rgba(242, 90, 103, 0.6); --wui-color-error-glass-080: rgba(242, 90, 103, 0.8); --wui-color-error-glass-reown-020: rgba(223, 74, 52, 0.2); --wui-color-gray-glass-001: rgba(255, 255, 255, 0.01); --wui-color-gray-glass-002: rgba(255, 255, 255, 0.02); --wui-color-gray-glass-005: rgba(255, 255, 255, 0.05); --wui-color-gray-glass-010: rgba(255, 255, 255, 0.1); --wui-color-gray-glass-015: rgba(255, 255, 255, 0.15); --wui-color-gray-glass-020: rgba(255, 255, 255, 0.2); --wui-color-gray-glass-025: rgba(255, 255, 255, 0.25); --wui-color-gray-glass-030: rgba(255, 255, 255, 0.3); --wui-color-gray-glass-060: rgba(255, 255, 255, 0.6); --wui-color-gray-glass-080: rgba(255, 255, 255, 0.8); --wui-color-gray-glass-090: rgba(255, 255, 255, 0.9); --wui-color-dark-glass-100: rgba(42, 42, 42, 1); --wui-icon-box-bg-error-base-100: #3c2426; --wui-icon-box-bg-blue-base-100: #20303f; --wui-icon-box-bg-success-base-100: #1f3a28; --wui-icon-box-bg-inverse-base-100: #243240; --wui-all-wallets-bg-100: #222b35; --wui-avatar-border-base: #252525; --wui-thumbnail-border-base: #252525; --wui-wallet-button-bg-base: var(--wui-color-bg-125); --w3m-card-embedded-shadow-color: rgb(17 17 18 / 25%); } `,dark:(0,a.iv)` :root { --w3m-color-mix: ${(0,a.$m)(e?.["--w3m-color-mix"]||"#000")}; --w3m-accent: ${(0,a.$m)((0,o.t)(e,"light")["--w3m-accent"])}; --w3m-default: #000; --wui-color-modal-bg-base: ${(0,a.$m)((0,o.t)(e,"light")["--w3m-background"])}; --wui-color-accent-base-100: var(--w3m-accent); --wui-color-blueberry-100: hsla(231, 100%, 70%, 1); --wui-color-blueberry-090: hsla(231, 97%, 72%, 1); --wui-color-blueberry-080: hsla(231, 92%, 74%, 1); --wui-color-fg-100: #141414; --wui-color-fg-125: #2d3131; --wui-color-fg-150: #474d4d; --wui-color-fg-175: #636d6d; --wui-color-fg-200: #798686; --wui-color-fg-225: #828f8f; --wui-color-fg-250: #8b9797; --wui-color-fg-275: #95a0a0; --wui-color-fg-300: #9ea9a9; --wui-color-fg-325: #9a9a9a; --wui-color-fg-350: #d0d0d0; --wui-color-bg-100: #ffffff; --wui-color-bg-125: #f5fafa; --wui-color-bg-150: #f3f8f8; --wui-color-bg-175: #eef4f4; --wui-color-bg-200: #eaf1f1; --wui-color-bg-225: #e5eded; --wui-color-bg-250: #e1e9e9; --wui-color-bg-275: #dce7e7; --wui-color-bg-300: #d8e3e3; --wui-color-bg-325: #f3f3f3; --wui-color-bg-350: #202020; --wui-color-success-base-100: #26b562; --wui-color-success-base-125: #30a46b; --wui-color-warning-base-100: #f3a13f; --wui-color-error-base-100: #f05142; --wui-color-error-base-125: #df4a34; --wui-color-blue-base-100: rgba(102, 125, 255, 1); --wui-color-blue-base-90: rgba(102, 125, 255, 0.9); --wui-color-success-glass-001: rgba(38, 181, 98, 0.01); --wui-color-success-glass-002: rgba(38, 181, 98, 0.02); --wui-color-success-glass-005: rgba(38, 181, 98, 0.05); --wui-color-success-glass-010: rgba(38, 181, 98, 0.1); --wui-color-success-glass-015: rgba(38, 181, 98, 0.15); --wui-color-success-glass-020: rgba(38, 181, 98, 0.2); --wui-color-success-glass-025: rgba(38, 181, 98, 0.25); --wui-color-success-glass-030: rgba(38, 181, 98, 0.3); --wui-color-success-glass-060: rgba(38, 181, 98, 0.6); --wui-color-success-glass-080: rgba(38, 181, 98, 0.8); --wui-color-success-glass-reown-020: rgba(48, 164, 107, 0.2); --wui-color-warning-glass-reown-020: rgba(243, 161, 63, 0.2); --wui-color-error-glass-001: rgba(240, 81, 66, 0.01); --wui-color-error-glass-002: rgba(240, 81, 66, 0.02); --wui-color-error-glass-005: rgba(240, 81, 66, 0.05); --wui-color-error-glass-010: rgba(240, 81, 66, 0.1); --wui-color-error-glass-015: rgba(240, 81, 66, 0.15); --wui-color-error-glass-020: rgba(240, 81, 66, 0.2); --wui-color-error-glass-025: rgba(240, 81, 66, 0.25); --wui-color-error-glass-030: rgba(240, 81, 66, 0.3); --wui-color-error-glass-060: rgba(240, 81, 66, 0.6); --wui-color-error-glass-080: rgba(240, 81, 66, 0.8); --wui-color-error-glass-reown-020: rgba(223, 74, 52, 0.2); --wui-icon-box-bg-error-base-100: #f4dfdd; --wui-icon-box-bg-blue-base-100: #d9ecfb; --wui-icon-box-bg-success-base-100: #daf0e4; --wui-icon-box-bg-inverse-base-100: #dcecfc; --wui-all-wallets-bg-100: #e8f1fa; --wui-avatar-border-base: #f3f4f4; --wui-thumbnail-border-base: #eaefef; --wui-wallet-button-bg-base: var(--wui-color-bg-125); --wui-color-gray-glass-001: rgba(0, 0, 0, 0.01); --wui-color-gray-glass-002: rgba(0, 0, 0, 0.02); --wui-color-gray-glass-005: rgba(0, 0, 0, 0.05); --wui-color-gray-glass-010: rgba(0, 0, 0, 0.1); --wui-color-gray-glass-015: rgba(0, 0, 0, 0.15); --wui-color-gray-glass-020: rgba(0, 0, 0, 0.2); --wui-color-gray-glass-025: rgba(0, 0, 0, 0.25); --wui-color-gray-glass-030: rgba(0, 0, 0, 0.3); --wui-color-gray-glass-060: rgba(0, 0, 0, 0.6); --wui-color-gray-glass-080: rgba(0, 0, 0, 0.8); --wui-color-gray-glass-090: rgba(0, 0, 0, 0.9); --wui-color-dark-glass-100: rgba(233, 233, 233, 1); --w3m-card-embedded-shadow-color: rgb(224 225 233 / 25%); } `}}let h=(0,a.iv)` *, *::after, *::before, :host { margin: 0; padding: 0; box-sizing: border-box; font-style: normal; text-rendering: optimizeSpeed; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-tap-highlight-color: transparent; font-family: var(--wui-font-family); backface-visibility: hidden; } `,f=(0,a.iv)` button, a { cursor: pointer; display: flex; justify-content: center; align-items: center; position: relative; transition: color var(--wui-duration-lg) var(--wui-ease-out-power-1), background-color var(--wui-duration-lg) var(--wui-ease-out-power-1), border var(--wui-duration-lg) var(--wui-ease-out-power-1), border-radius var(--wui-duration-lg) var(--wui-ease-out-power-1), box-shadow var(--wui-duration-lg) var(--wui-ease-out-power-1); will-change: background-color, color, border, box-shadow, border-radius; outline: none; border: none; column-gap: var(--wui-spacing-3xs); background-color: transparent; text-decoration: none; } wui-flex { transition: border-radius var(--wui-duration-lg) var(--wui-ease-out-power-1); will-change: border-radius; } button:disabled > wui-wallet-image, button:disabled > wui-all-wallets-image, button:disabled > wui-network-image, button:disabled > wui-image, button:disabled > wui-transaction-visual, button:disabled > wui-logo { filter: grayscale(1); } @media (hover: hover) and (pointer: fine) { button:hover:enabled { background-color: var(--wui-color-gray-glass-005); } button:active:enabled { background-color: var(--wui-color-gray-glass-010); } } button:disabled > wui-icon-box { opacity: 0.5; } input { border: none; outline: none; appearance: none; } `,p=(0,a.iv)` .wui-color-inherit { color: var(--wui-color-inherit); } .wui-color-accent-100 { color: var(--wui-color-accent-100); } .wui-color-error-100 { color: var(--wui-color-error-100); } .wui-color-blue-100 { color: var(--wui-color-blue-100); } .wui-color-blue-90 { color: var(--wui-color-blue-90); } .wui-color-error-125 { color: var(--wui-color-error-125); } .wui-color-success-100 { color: var(--wui-color-success-100); } .wui-color-success-125 { color: var(--wui-color-success-125); } .wui-color-inverse-100 { color: var(--wui-color-inverse-100); } .wui-color-inverse-000 { color: var(--wui-color-inverse-000); } .wui-color-fg-100 { color: var(--wui-color-fg-100); } .wui-color-fg-200 { color: var(--wui-color-fg-200); } .wui-color-fg-300 { color: var(--wui-color-fg-300); } .wui-color-fg-325 { color: var(--wui-color-fg-325); } .wui-color-fg-350 { color: var(--wui-color-fg-350); } .wui-bg-color-inherit { background-color: var(--wui-color-inherit); } .wui-bg-color-blue-100 { background-color: var(--wui-color-accent-100); } .wui-bg-color-error-100 { background-color: var(--wui-color-error-100); } .wui-bg-color-error-125 { background-color: var(--wui-color-error-125); } .wui-bg-color-success-100 { background-color: var(--wui-color-success-100); } .wui-bg-color-success-125 { background-color: var(--wui-color-success-100); } .wui-bg-color-inverse-100 { background-color: var(--wui-color-inverse-100); } .wui-bg-color-inverse-000 { background-color: var(--wui-color-inverse-000); } .wui-bg-color-fg-100 { background-color: var(--wui-color-fg-100); } .wui-bg-color-fg-200 { background-color: var(--wui-color-fg-200); } .wui-bg-color-fg-300 { background-color: var(--wui-color-fg-300); } .wui-color-fg-325 { background-color: var(--wui-color-fg-325); } .wui-color-fg-350 { background-color: var(--wui-color-fg-350); } `},1512:function(e,t,r){"use strict";r.d(t,{H:function(){return i}});let i={getSpacingStyles:(e,t)=>Array.isArray(e)?e[t]?`var(--wui-spacing-${e[t]})`:void 0:"string"==typeof e?`var(--wui-spacing-${e})`:void 0,getFormattedDate:e=>new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric"}).format(e),getHostName(e){try{return new URL(e).hostname}catch(e){return""}},getTruncateString:({string:e,charsStart:t,charsEnd:r,truncate:i})=>e.length<=t+r?e:"end"===i?`${e.substring(0,t)}...`:"start"===i?`...${e.substring(e.length-r)}`:`${e.substring(0,Math.floor(t))}...${e.substring(e.length-Math.floor(r))}`,generateAvatarColors(e){let t=e.toLowerCase().replace(/^0x/iu,"").replace(/[^a-f0-9]/gu,"").substring(0,6).padEnd(6,"0"),r=this.hexToRgb(t),i=getComputedStyle(document.documentElement).getPropertyValue("--w3m-border-radius-master"),n=100-3*Number(i?.replace("px","")),s=`${n}% ${n}% at 65% 40%`,a=[];for(let e=0;e<5;e+=1){let t=this.tintColor(r,.15*e);a.push(`rgb(${t[0]}, ${t[1]}, ${t[2]})`)}return` --local-color-1: ${a[0]}; --local-color-2: ${a[1]}; --local-color-3: ${a[2]}; --local-color-4: ${a[3]}; --local-color-5: ${a[4]}; --local-radial-circle: ${s} `},hexToRgb(e){let t=parseInt(e,16);return[t>>16&255,t>>8&255,255&t]},tintColor(e,t){let[r,i,n]=e;return[Math.round(r+(255-r)*t),Math.round(i+(255-i)*t),Math.round(n+(255-n)*t)]},isNumber:e=>/^[0-9]+$/u.test(e),getColorTheme:e=>e||("undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)")?.matches?"dark":"light":"dark"),splitBalance(e){let t=e.split(".");return 2===t.length?[t[0],t[1]]:["0","00"]},roundNumber:(e,t,r)=>e.toString().length>=t?Number(e).toFixed(r):e,formatNumberToLocalString:(e,t=2)=>void 0===e?"0.00":"number"==typeof e?e.toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t}):parseFloat(e).toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t})}},25729:function(e,t,r){"use strict";function i(e){return function(t){return"function"==typeof t?(customElements.get(e)||customElements.define(e,t),t):function(e,t){let{kind:r,elements:i}=t;return{kind:r,elements:i,finisher(t){customElements.get(e)||customElements.define(e,t)}}}(e,t)}}r.d(t,{M:function(){return i}})},26149:function(e,t,r){"use strict";r.d(t,{f:function(){return f}});var i=r(68597),n=r(26445),s=r(39028),a=r(62914),o=r(22319);function c(e,t={}){let{key:r="fallback",name:i="Fallback",rank:n=!1,shouldThrow:s=l,retryCount:c,retryDelay:u}=t;return({chain:t,pollingInterval:l=4e3,timeout:d,...h})=>{let f=e,p=()=>{},g=(0,o.q)({key:r,name:i,async request({method:e,params:r}){let i;let n=async(a=0)=>{let o=f[a]({...h,chain:t,retryCount:0,timeout:d});try{let t=await o.request({method:e,params:r});return p({method:e,params:r,response:t,transport:o,status:"success"}),t}catch(c){if(p({error:c,method:e,params:r,transport:o,status:"error"}),s(c)||a===f.length-1||!(i??=f.slice(a+1).some(r=>{let{include:i,exclude:n}=r({chain:t}).config.methods||{};return i?i.includes(e):!n||!n.includes(e)})))throw c;return n(a+1)}};return n()},retryCount:c,retryDelay:u,type:"fallback"},{onResponse:e=>p=e,transports:f.map(e=>e({chain:t,retryCount:0}))});if(n){let e="object"==typeof n?n:{};!function({chain:e,interval:t=4e3,onTransports:r,ping:i,sampleCount:n=10,timeout:s=1e3,transports:o,weights:c={}}){let{stability:l=.7,latency:u=.3}=c,d=[],h=async()=>{let c=await Promise.all(o.map(async t=>{let r,n;let a=t({chain:e,retryCount:0,timeout:s}),o=Date.now();try{await (i?i({transport:a}):a.request({method:"net_listening"})),n=1}catch{n=0}finally{r=Date.now()}return{latency:r-o,success:n}}));d.push(c),d.length>n&&d.shift();let f=Math.max(...d.map(e=>Math.max(...e.map(({latency:e})=>e))));r(o.map((e,t)=>{let r=d.map(e=>e[t].latency),i=r.reduce((e,t)=>e+t,0)/r.length,n=d.map(e=>e[t].success),s=n.reduce((e,t)=>e+t,0)/n.length;return 0===s?[0,t]:[u*(1-i/f)+l*s,t]}).sort((e,t)=>t[0]-e[0]).map(([,e])=>o[e])),await (0,a.D)(t),h()};h()}({chain:t,interval:e.interval??l,onTransports:e=>f=e,ping:e.ping,sampleCount:e.sampleCount,timeout:e.timeout,transports:f,weights:e.weights})}return g}}function l(e){return!!("code"in e&&"number"==typeof e.code&&(e.code===s.KB.code||e.code===s.ab.code||n.M_.nodeMessage.test(e.message)||5e3===e.code))}var u=r(68314),d=r(72551);let h=["near:mainnet","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","eip155:1101","eip155:56","eip155:42161","eip155:7777777","eip155:59144","eip155:324","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1","eip155:5000","solana:4sgjmw1sunhzsxgspuhpqldx6wiyjntz","eip155:80084","eip155:5003","eip155:100","eip155:8453","eip155:42220","eip155:1313161555","eip155:17000","eip155:1","eip155:300","eip155:1313161554","eip155:1329","eip155:84532","eip155:421614","eip155:11155111","eip155:8217","eip155:43114","solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","eip155:999999999","eip155:11155420","eip155:80002","eip155:97","eip155:43113","eip155:137","eip155:10","eip155:1301","bip122:000000000019d6689c085ae165831e93","bip122:000000000933ea01ad0ee984209779ba"],f={extendRpcUrlWithProjectId(e,t){let r=!1;try{r="rpc.walletconnect.org"===new URL(e).host}catch(e){r=!1}if(r){let r=new URL(e);return r.searchParams.has("projectId")||r.searchParams.set("projectId",t),r.toString()}return e},isCaipNetwork:e=>"chainNamespace"in e&&"caipNetworkId"in e,getChainNamespace(e){return this.isCaipNetwork(e)?e.chainNamespace:u.b.CHAIN.EVM},getCaipNetworkId(e){return this.isCaipNetwork(e)?e.caipNetworkId:`${u.b.CHAIN.EVM}:${e.id}`},getDefaultRpcUrl(e,t,r){let i=e.rpcUrls?.default?.http?.[0];return h.includes(t)?function(e,t){let r=new URL("https://rpc.walletconnect.org/v1/");return r.searchParams.set("chainId",e),r.searchParams.set("projectId",t),r.toString()}(t,r):i||""},extendCaipNetwork(e,{customNetworkImageUrls:t,projectId:r,customRpcUrls:i}){let n=this.getChainNamespace(e),s=this.getCaipNetworkId(e),a=e.rpcUrls.default.http?.[0],o=this.getDefaultRpcUrl(e,s,r),c=e?.rpcUrls?.chainDefault?.http?.[0]||a,l=i?.[s]?.map(e=>e.url)||[],u=[...l,o],h=[...l];return c&&!h.includes(c)&&h.push(c),{...e,chainNamespace:n,caipNetworkId:s,assets:{imageId:d.C.NetworkImageIds[e.id],imageUrl:t?.[e.id]},rpcUrls:{...e.rpcUrls,default:{http:u},chainDefault:{http:h}}}},extendCaipNetworks:(e,{customNetworkImageUrls:t,projectId:r,customRpcUrls:i})=>e.map(e=>f.extendCaipNetwork(e,{customNetworkImageUrls:t,customRpcUrls:i,projectId:r})),getViemTransport(e,t,r){let n=[];if(r?.forEach(e=>{n.push(i.d(e.url,e.config))}),h.includes(e.caipNetworkId)){let r=this.getDefaultRpcUrl(e,e.caipNetworkId,t);n.push((0,i.d)(r,{fetchOptions:{headers:{"Content-Type":"text/plain"}}}))}return c(n)},extendWagmiTransports(e,t,r){if(h.includes(e.caipNetworkId)){let n=this.getDefaultRpcUrl(e,e.caipNetworkId,t);return c([r,(0,i.d)(n)])}return r}}},99013:function(e,t,r){"use strict";r.d(t,{b:function(){return i}});let i={METMASK_CONNECTOR_NAME:"MetaMask",TRUST_CONNECTOR_NAME:"Trust Wallet",SOLFLARE_CONNECTOR_NAME:"Solflare",PHANTOM_CONNECTOR_NAME:"Phantom",COIN98_CONNECTOR_NAME:"Coin98",MAGIC_EDEN_CONNECTOR_NAME:"Magic Eden",BACKPACK_CONNECTOR_NAME:"Backpack",BITGET_CONNECTOR_NAME:"Bitget Wallet",FRONTIER_CONNECTOR_NAME:"Frontier",XVERSE_CONNECTOR_NAME:"Xverse Wallet",LEATHER_CONNECTOR_NAME:"Leather",EIP155:"eip155",ADD_CHAIN_METHOD:"wallet_addEthereumChain",EIP6963_ANNOUNCE_EVENT:"eip6963:announceProvider",EIP6963_REQUEST_EVENT:"eip6963:requestProvider",CONNECTOR_RDNS_MAP:{coinbaseWallet:"com.coinbase.wallet",coinbaseWalletSDK:"com.coinbase.wallet"},CONNECTOR_TYPE_EXTERNAL:"EXTERNAL",CONNECTOR_TYPE_WALLET_CONNECT:"WALLET_CONNECT",CONNECTOR_TYPE_INJECTED:"INJECTED",CONNECTOR_TYPE_ANNOUNCED:"ANNOUNCED",CONNECTOR_TYPE_AUTH:"AUTH",CONNECTOR_TYPE_MULTI_CHAIN:"MULTI_CHAIN",CONNECTOR_TYPE_W3M_AUTH:"ID_AUTH"}},9681:function(e,t,r){"use strict";r.d(t,{j:function(){return i}});let i={UniversalProviderErrors:{UNAUTHORIZED_DOMAIN_NOT_ALLOWED:{message:"Unauthorized: origin not allowed",alertErrorKey:"INVALID_APP_CONFIGURATION"},JWT_VALIDATION_ERROR:{message:"JWT validation error: JWT Token is not yet valid",alertErrorKey:"JWT_TOKEN_NOT_VALID"},INVALID_KEY:{message:"Unauthorized: invalid key",alertErrorKey:"INVALID_PROJECT_ID"}},ALERT_ERRORS:{SWITCH_NETWORK_NOT_FOUND:{shortMessage:"Network Not Found",longMessage:"Network not found - please make sure it is included in 'networks' array in createAppKit function"},INVALID_APP_CONFIGURATION:{shortMessage:"Invalid App Configuration",longMessage:()=>`Origin ${"undefined"!=typeof window?window.origin:"unknown"} not found on Allowlist - update configuration on cloud.reown.com`},SOCIALS_TIMEOUT:{shortMessage:"Invalid App Configuration",longMessage:()=>"There was an issue loading the embedded wallet. Please verify that your domain is allowed at cloud.reown.com"},JWT_TOKEN_NOT_VALID:{shortMessage:"Session Expired",longMessage:"Invalid session found on UniversalProvider - please check your time settings and connect again"},INVALID_PROJECT_ID:{shortMessage:"Invalid App Configuration",longMessage:"Invalid Project ID - update configuration"},PROJECT_ID_NOT_CONFIGURED:{shortMessage:"Project ID Not Configured",longMessage:"Project ID Not Configured - update configuration on cloud.reown.com"}}}},72551:function(e,t,r){"use strict";r.d(t,{C:function(){return s}});var i=r(68314),n=r(99013);let s={ConnectorExplorerIds:{[i.b.CONNECTOR_ID.COINBASE]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[i.b.CONNECTOR_ID.COINBASE_SDK]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[i.b.CONNECTOR_ID.SAFE]:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",[i.b.CONNECTOR_ID.LEDGER]:"19177a98252e07ddfc9af2083ba8e07ef627cb6103467ffebb3f8f4205fd7927",[i.b.CONNECTOR_ID.OKX]:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",[n.b.METMASK_CONNECTOR_NAME]:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",[n.b.TRUST_CONNECTOR_NAME]:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",[n.b.SOLFLARE_CONNECTOR_NAME]:"1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79",[n.b.PHANTOM_CONNECTOR_NAME]:"a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393",[n.b.COIN98_CONNECTOR_NAME]:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",[n.b.MAGIC_EDEN_CONNECTOR_NAME]:"8b830a2b724a9c3fbab63af6f55ed29c9dfa8a55e732dc88c80a196a2ba136c6",[n.b.BACKPACK_CONNECTOR_NAME]:"2bd8c14e035c2d48f184aaa168559e86b0e3433228d3c4075900a221785019b0",[n.b.BITGET_CONNECTOR_NAME]:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",[n.b.FRONTIER_CONNECTOR_NAME]:"85db431492aa2e8672e93f4ea7acf10c88b97b867b0d373107af63dc4880f041",[n.b.XVERSE_CONNECTOR_NAME]:"2a87d74ae02e10bdd1f51f7ce6c4e1cc53cd5f2c0b6b5ad0d7b3007d2b13de7b",[n.b.LEATHER_CONNECTOR_NAME]:"483afe1df1df63daf313109971ff3ef8356ddf1cc4e45877d205eee0b7893a13"},NetworkImageIds:{1:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",42161:"3bff954d-5cb0-47a0-9a23-d20192e74600",43114:"30c46e53-e989-45fb-4549-be3bd4eb3b00",56:"93564157-2e8e-4ce7-81df-b264dbee9b00",250:"06b26297-fe0c-4733-5d6b-ffa5498aac00",10:"ab9c186a-c52f-464b-2906-ca59d760a400",137:"41d04d42-da3b-4453-8506-668cc0727900",5e3:"e86fae9b-b770-4eea-e520-150e12c81100",295:"6a97d510-cac8-4e58-c7ce-e8681b044c00",11155111:"e909ea0a-f92a-4512-c8fc-748044ea6800",84532:"a18a7ecd-e307-4360-4746-283182228e00",1301:"4eeea7ef-0014-4649-5d1d-07271a80f600",130:"2257980a-3463-48c6-cbac-a42d2a956e00",10143:"0a728e83-bacb-46db-7844-948f05434900",100:"02b53f6a-e3d4-479e-1cb4-21178987d100",9001:"f926ff41-260d-4028-635e-91913fc28e00",324:"b310f07f-4ef7-49f3-7073-2a0a39685800",314:"5a73b3dd-af74-424e-cae0-0de859ee9400",4689:"34e68754-e536-40da-c153-6ef2e7188a00",1088:"3897a66d-40b9-4833-162f-a2c90531c900",1284:"161038da-44ae-4ec7-1208-0ea569454b00",1285:"f1d73bb6-5450-4e18-38f7-fb6484264a00",7777777:"845c60df-d429-4991-e687-91ae45791600",42220:"ab781bbc-ccc6-418d-d32d-789b15da1f00",8453:"7289c336-3981-4081-c5f4-efc26ac64a00",1313161554:"3ff73439-a619-4894-9262-4470c773a100",2020:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00",2021:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00",80094:"e329c2c9-59b0-4a02-83e4-212ff3779900","5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":"a1b58899-f671-4276-6a5e-56ca5bd59700","4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z":"a1b58899-f671-4276-6a5e-56ca5bd59700",EtWTRABZaYq6iMfeYKouRu166VU2xqa1:"a1b58899-f671-4276-6a5e-56ca5bd59700","000000000019d6689c085ae165831e93":"0b4838db-0161-4ffe-022d-532bf03dba00","000000000933ea01ad0ee984209779ba":"39354064-d79b-420b-065d-f980c4b78200"},ConnectorImageIds:{[i.b.CONNECTOR_ID.COINBASE]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[i.b.CONNECTOR_ID.COINBASE_SDK]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[i.b.CONNECTOR_ID.SAFE]:"461db637-8616-43ce-035a-d89b8a1d5800",[i.b.CONNECTOR_ID.LEDGER]:"54a1aa77-d202-4f8d-0fb2-5d2bb6db0300",[i.b.CONNECTOR_ID.WALLET_CONNECT]:"ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400",[i.b.CONNECTOR_ID.INJECTED]:"07ba87ed-43aa-4adf-4540-9e6a2b9cae00"},ConnectorNamesMap:{[i.b.CONNECTOR_ID.INJECTED]:"Browser Wallet",[i.b.CONNECTOR_ID.WALLET_CONNECT]:"WalletConnect",[i.b.CONNECTOR_ID.COINBASE]:"Coinbase",[i.b.CONNECTOR_ID.COINBASE_SDK]:"Coinbase",[i.b.CONNECTOR_ID.LEDGER]:"Ledger",[i.b.CONNECTOR_ID.SAFE]:"Safe"},ConnectorTypesMap:{[i.b.CONNECTOR_ID.INJECTED]:"INJECTED",[i.b.CONNECTOR_ID.WALLET_CONNECT]:"WALLET_CONNECT",[i.b.CONNECTOR_ID.EIP6963]:"ANNOUNCED",[i.b.CONNECTOR_ID.AUTH]:"AUTH"},WalletConnectRpcChainIds:[1,5,11155111,10,420,42161,421613,137,80001,42220,1313161554,1313161555,56,97,43114,43113,100,8453,84531,7777777,999,324,280]}},22192:function(e,t,r){"use strict";r.d(t,{$0:function(){return o},Dr:function(){return n},jd:function(){return s},y_:function(){return c},zN:function(){return a}});var i=r(34155);let n=(void 0!==i&&void 0!==i.env?i.env.NEXT_PUBLIC_SECURE_SITE_SDK_URL:void 0)||"https://secure.walletconnect.org/sdk",s=(void 0!==i&&void 0!==i.env?i.env.NEXT_PUBLIC_DEFAULT_LOG_LEVEL:void 0)||"error",a=(void 0!==i&&void 0!==i.env?i.env.NEXT_PUBLIC_SECURE_SITE_SDK_VERSION:void 0)||"4",o={APP_EVENT_KEY:"@w3m-app/",FRAME_EVENT_KEY:"@w3m-frame/",RPC_METHOD_KEY:"RPC_",STORAGE_KEY:"@appkit-wallet/",SESSION_TOKEN_KEY:"SESSION_TOKEN_KEY",EMAIL_LOGIN_USED_KEY:"EMAIL_LOGIN_USED_KEY",LAST_USED_CHAIN_KEY:"LAST_USED_CHAIN_KEY",LAST_EMAIL_LOGIN_TIME:"LAST_EMAIL_LOGIN_TIME",EMAIL:"EMAIL",PREFERRED_ACCOUNT_TYPE:"PREFERRED_ACCOUNT_TYPE",SMART_ACCOUNT_ENABLED:"SMART_ACCOUNT_ENABLED",SMART_ACCOUNT_ENABLED_NETWORKS:"SMART_ACCOUNT_ENABLED_NETWORKS",SOCIAL_USERNAME:"SOCIAL_USERNAME",APP_SWITCH_NETWORK:"@w3m-app/SWITCH_NETWORK",APP_CONNECT_EMAIL:"@w3m-app/CONNECT_EMAIL",APP_CONNECT_DEVICE:"@w3m-app/CONNECT_DEVICE",APP_CONNECT_OTP:"@w3m-app/CONNECT_OTP",APP_CONNECT_SOCIAL:"@w3m-app/CONNECT_SOCIAL",APP_GET_SOCIAL_REDIRECT_URI:"@w3m-app/GET_SOCIAL_REDIRECT_URI",APP_GET_USER:"@w3m-app/GET_USER",APP_SIGN_OUT:"@w3m-app/SIGN_OUT",APP_IS_CONNECTED:"@w3m-app/IS_CONNECTED",APP_GET_CHAIN_ID:"@w3m-app/GET_CHAIN_ID",APP_RPC_REQUEST:"@w3m-app/RPC_REQUEST",APP_UPDATE_EMAIL:"@w3m-app/UPDATE_EMAIL",APP_UPDATE_EMAIL_PRIMARY_OTP:"@w3m-app/UPDATE_EMAIL_PRIMARY_OTP",APP_UPDATE_EMAIL_SECONDARY_OTP:"@w3m-app/UPDATE_EMAIL_SECONDARY_OTP",APP_AWAIT_UPDATE_EMAIL:"@w3m-app/AWAIT_UPDATE_EMAIL",APP_SYNC_THEME:"@w3m-app/SYNC_THEME",APP_SYNC_DAPP_DATA:"@w3m-app/SYNC_DAPP_DATA",APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS:"@w3m-app/GET_SMART_ACCOUNT_ENABLED_NETWORKS",APP_INIT_SMART_ACCOUNT:"@w3m-app/INIT_SMART_ACCOUNT",APP_SET_PREFERRED_ACCOUNT:"@w3m-app/SET_PREFERRED_ACCOUNT",APP_CONNECT_FARCASTER:"@w3m-app/CONNECT_FARCASTER",APP_GET_FARCASTER_URI:"@w3m-app/GET_FARCASTER_URI",APP_RELOAD:"@w3m-app/RELOAD",FRAME_SWITCH_NETWORK_ERROR:"@w3m-frame/SWITCH_NETWORK_ERROR",FRAME_SWITCH_NETWORK_SUCCESS:"@w3m-frame/SWITCH_NETWORK_SUCCESS",FRAME_CONNECT_EMAIL_ERROR:"@w3m-frame/CONNECT_EMAIL_ERROR",FRAME_CONNECT_EMAIL_SUCCESS:"@w3m-frame/CONNECT_EMAIL_SUCCESS",FRAME_CONNECT_DEVICE_ERROR:"@w3m-frame/CONNECT_DEVICE_ERROR",FRAME_CONNECT_DEVICE_SUCCESS:"@w3m-frame/CONNECT_DEVICE_SUCCESS",FRAME_CONNECT_OTP_SUCCESS:"@w3m-frame/CONNECT_OTP_SUCCESS",FRAME_CONNECT_OTP_ERROR:"@w3m-frame/CONNECT_OTP_ERROR",FRAME_CONNECT_SOCIAL_SUCCESS:"@w3m-frame/CONNECT_SOCIAL_SUCCESS",FRAME_CONNECT_SOCIAL_ERROR:"@w3m-frame/CONNECT_SOCIAL_ERROR",FRAME_CONNECT_FARCASTER_SUCCESS:"@w3m-frame/CONNECT_FARCASTER_SUCCESS",FRAME_CONNECT_FARCASTER_ERROR:"@w3m-frame/CONNECT_FARCASTER_ERROR",FRAME_GET_FARCASTER_URI_SUCCESS:"@w3m-frame/GET_FARCASTER_URI_SUCCESS",FRAME_GET_FARCASTER_URI_ERROR:"@w3m-frame/GET_FARCASTER_URI_ERROR",FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS:"@w3m-frame/GET_SOCIAL_REDIRECT_URI_SUCCESS",FRAME_GET_SOCIAL_REDIRECT_URI_ERROR:"@w3m-frame/GET_SOCIAL_REDIRECT_URI_ERROR",FRAME_GET_USER_SUCCESS:"@w3m-frame/GET_USER_SUCCESS",FRAME_GET_USER_ERROR:"@w3m-frame/GET_USER_ERROR",FRAME_SIGN_OUT_SUCCESS:"@w3m-frame/SIGN_OUT_SUCCESS",FRAME_SIGN_OUT_ERROR:"@w3m-frame/SIGN_OUT_ERROR",FRAME_IS_CONNECTED_SUCCESS:"@w3m-frame/IS_CONNECTED_SUCCESS",FRAME_IS_CONNECTED_ERROR:"@w3m-frame/IS_CONNECTED_ERROR",FRAME_GET_CHAIN_ID_SUCCESS:"@w3m-frame/GET_CHAIN_ID_SUCCESS",FRAME_GET_CHAIN_ID_ERROR:"@w3m-frame/GET_CHAIN_ID_ERROR",FRAME_RPC_REQUEST_SUCCESS:"@w3m-frame/RPC_REQUEST_SUCCESS",FRAME_RPC_REQUEST_ERROR:"@w3m-frame/RPC_REQUEST_ERROR",FRAME_SESSION_UPDATE:"@w3m-frame/SESSION_UPDATE",FRAME_UPDATE_EMAIL_SUCCESS:"@w3m-frame/UPDATE_EMAIL_SUCCESS",FRAME_UPDATE_EMAIL_ERROR:"@w3m-frame/UPDATE_EMAIL_ERROR",FRAME_UPDATE_EMAIL_PRIMARY_OTP_SUCCESS:"@w3m-frame/UPDATE_EMAIL_PRIMARY_OTP_SUCCESS",FRAME_UPDATE_EMAIL_PRIMARY_OTP_ERROR:"@w3m-frame/UPDATE_EMAIL_PRIMARY_OTP_ERROR",FRAME_UPDATE_EMAIL_SECONDARY_OTP_SUCCESS:"@w3m-frame/UPDATE_EMAIL_SECONDARY_OTP_SUCCESS",FRAME_UPDATE_EMAIL_SECONDARY_OTP_ERROR:"@w3m-frame/UPDATE_EMAIL_SECONDARY_OTP_ERROR",FRAME_SYNC_THEME_SUCCESS:"@w3m-frame/SYNC_THEME_SUCCESS",FRAME_SYNC_THEME_ERROR:"@w3m-frame/SYNC_THEME_ERROR",FRAME_SYNC_DAPP_DATA_SUCCESS:"@w3m-frame/SYNC_DAPP_DATA_SUCCESS",FRAME_SYNC_DAPP_DATA_ERROR:"@w3m-frame/SYNC_DAPP_DATA_ERROR",FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS:"@w3m-frame/GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS",FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR:"@w3m-frame/GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR",FRAME_INIT_SMART_ACCOUNT_SUCCESS:"@w3m-frame/INIT_SMART_ACCOUNT_SUCCESS",FRAME_INIT_SMART_ACCOUNT_ERROR:"@w3m-frame/INIT_SMART_ACCOUNT_ERROR",FRAME_SET_PREFERRED_ACCOUNT_SUCCESS:"@w3m-frame/SET_PREFERRED_ACCOUNT_SUCCESS",FRAME_SET_PREFERRED_ACCOUNT_ERROR:"@w3m-frame/SET_PREFERRED_ACCOUNT_ERROR",FRAME_READY:"@w3m-frame/READY",FRAME_RELOAD_SUCCESS:"@w3m-frame/RELOAD_SUCCESS",FRAME_RELOAD_ERROR:"@w3m-frame/RELOAD_ERROR",RPC_RESPONSE_TYPE_ERROR:"RPC_RESPONSE_ERROR",RPC_RESPONSE_TYPE_TX:"RPC_RESPONSE_TRANSACTION_HASH",RPC_RESPONSE_TYPE_OBJECT:"RPC_RESPONSE_OBJECT"},c={SAFE_RPC_METHODS:["eth_accounts","eth_blockNumber","eth_call","eth_chainId","eth_estimateGas","eth_feeHistory","eth_gasPrice","eth_getAccount","eth_getBalance","eth_getBlockByHash","eth_getBlockByNumber","eth_getBlockReceipts","eth_getBlockTransactionCountByHash","eth_getBlockTransactionCountByNumber","eth_getCode","eth_getFilterChanges","eth_getFilterLogs","eth_getLogs","eth_getProof","eth_getStorageAt","eth_getTransactionByBlockHashAndIndex","eth_getTransactionByBlockNumberAndIndex","eth_getTransactionByHash","eth_getTransactionCount","eth_getTransactionReceipt","eth_getUncleCountByBlockHash","eth_getUncleCountByBlockNumber","eth_maxPriorityFeePerGas","eth_newBlockFilter","eth_newFilter","eth_newPendingTransactionFilter","eth_sendRawTransaction","eth_syncing","eth_uninstallFilter","wallet_getCapabilities","wallet_getCallsStatus","eth_getUserOperationReceipt","eth_estimateUserOperationGas","eth_getUserOperationByHash","eth_supportedEntryPoints","wallet_getAssets"],NOT_SAFE_RPC_METHODS:["personal_sign","eth_signTypedData_v4","eth_sendTransaction","solana_signMessage","solana_signTransaction","solana_signAllTransactions","solana_signAndSendTransaction","wallet_sendCalls","wallet_grantPermissions","wallet_revokePermissions","eth_sendUserOperation"],GET_CHAIN_ID:"eth_chainId",RPC_METHOD_NOT_ALLOWED_MESSAGE:"Requested RPC call is not allowed",RPC_METHOD_NOT_ALLOWED_UI_MESSAGE:"Action not allowed",ACCOUNT_TYPES:{EOA:"eoa",SMART_ACCOUNT:"smartAccount"}}},19445:function(e,t,r){"use strict";r.d(t,{$:function(){return a}});let i={transactionHash:/^0x(?:[A-Fa-f0-9]{64})$/u,signedMessage:/^0x(?:[a-fA-F0-9]{62,})$/u};var n=r(22192),s=r(97363);let a={checkIfAllowedToTriggerEmail(){let e=s.e.get(n.$0.LAST_EMAIL_LOGIN_TIME);if(e){let t=Date.now()-Number(e);if(t<3e4)throw Error(`Please try again after ${Math.ceil((3e4-t)/1e3)} seconds`)}},getTimeToNextEmailLogin(){let e=s.e.get(n.$0.LAST_EMAIL_LOGIN_TIME);if(e){let t=Date.now()-Number(e);if(t<3e4)return Math.ceil((3e4-t)/1e3)}return 0},checkIfRequestExists:e=>n.y_.NOT_SAFE_RPC_METHODS.includes(e.method)||n.y_.SAFE_RPC_METHODS.includes(e.method),getResponseType:e=>"string"==typeof e&&(e?.match(i.transactionHash)||e?.match(i.signedMessage))?n.$0.RPC_RESPONSE_TYPE_TX:n.$0.RPC_RESPONSE_TYPE_OBJECT,checkIfRequestIsSafe:e=>n.y_.SAFE_RPC_METHODS.includes(e.method),isClient:"undefined"!=typeof window}},97363:function(e,t,r){"use strict";r.d(t,{e:function(){return s}});var i=r(22192),n=r(19445);let s={set(e,t){n.$.isClient&&localStorage.setItem(`${i.$0.STORAGE_KEY}${e}`,t)},get:e=>n.$.isClient?localStorage.getItem(`${i.$0.STORAGE_KEY}${e}`):null,delete(e,t){n.$.isClient&&(t?localStorage.removeItem(e):localStorage.removeItem(`${i.$0.STORAGE_KEY}${e}`))}}},82020:function(e,t,r){"use strict";let i;r.d(t,{cz:function(){return y},Tj:function(){return m},U_:function(){return w}});var n=r(83241),s=r(67294),a=r(72478),o=r(61688),c=r(86949);let{use:l}=s,{useSyncExternalStore:u}=o,d=(e,t)=>{let r=(0,s.useRef)();(0,s.useEffect)(()=>{r.current=(0,a.h8)(e,t,!0)}),(0,s.useDebugValue)(r.current)},h=new WeakMap;function f(e,t){let r=null==t?void 0:t.sync,i=(0,s.useRef)(),n=(0,s.useRef)(),o=!0,f=u((0,s.useCallback)(t=>{let i=(0,c.Ld)(e,t,r);return t(),i},[e,r]),()=>{let t=(0,c.CO)(e,l);try{if(!o&&i.current&&n.current&&!(0,a.ln)(i.current,t,n.current,new WeakMap))return i.current}catch(e){}return t},()=>(0,c.CO)(e,l));o=!1;let p=new WeakMap;(0,s.useEffect)(()=>{i.current=f,n.current=p}),d(f,p);let g=(0,s.useMemo)(()=>new WeakMap,[]);return(0,a.DM)(f,p,g,h)}var p=r(46313),g=r(33734);function m(e){let t=f(p.R.state),r=e?.namespace||t.activeChain;if(!r)return{allAccounts:[],address:void 0,caipAddress:void 0,status:void 0,isConnected:!1,embeddedWalletInfo:void 0};let i=t.chains.get(r)?.accountState,s=g.ConnectorController.getAuthConnector(r);return{allAccounts:i?.allAccounts||[],caipAddress:i?.caipAddress,address:n.j.getPlainAddress(i?.caipAddress),isConnected:!!i?.caipAddress,status:i?.status,embeddedWalletInfo:s?{user:i?.user,authProvider:i?.socialProvider||"email",accountType:i?.preferredAccountType,isSmartAccountDeployed:!!i?.smartAccountDeployed}:void 0}}var b=r(65145);function y(e){return i||(i=new b.b({...e,sdkVersion:n.j.generateSdkVersion(e.adapters??[],"react","1.7.1")})),i}function w(){let{caipNetwork:e,caipNetworkId:t,chainId:r}=function(){let{activeCaipNetwork:e}=f(p.R.state);return{caipNetwork:e,chainId:e?.id,caipNetworkId:e?.caipNetworkId}}();return{caipNetwork:e,caipNetworkId:t,chainId:r,switchNetwork:function(e){i?.switchNetwork(e)}}}r(52814)},79284:function(e,t,r){"use strict";r.d(t,{q:function(){return c}}),r(58269);var i=r(68314),n=r(83966),s=r(77500),a=r(72551),o=r(72731);class c{constructor(e){this.availableConnectors=[],this.eventListeners=new Map,e&&this.construct(e)}construct(e){this.caipNetworks=e.networks,this.projectId=e.projectId,this.namespace=e.namespace}get connectors(){return this.availableConnectors}get networks(){return this.caipNetworks||[]}setAuthProvider(e){this.addConnector({id:i.b.CONNECTOR_ID.AUTH,type:"AUTH",name:i.b.CONNECTOR_NAMES.AUTH,provider:e,imageId:a.C.ConnectorImageIds[i.b.CONNECTOR_ID.AUTH],chain:this.namespace,chains:[]})}addConnector(...e){let t=new Set;this.availableConnectors=[...e,...this.availableConnectors].filter(e=>!t.has(e.id)&&(t.add(e.id),!0)),this.emit("connectors",this.availableConnectors)}setStatus(e,t){n.AccountController.setStatus(e,t)}on(e,t){this.eventListeners.has(e)||this.eventListeners.set(e,new Set),this.eventListeners.get(e)?.add(t)}off(e,t){let r=this.eventListeners.get(e);r&&r.delete(t)}removeAllEventListeners(){this.eventListeners.forEach(e=>{e.clear()})}emit(e,t){let r=this.eventListeners.get(e);r&&r.forEach(e=>e(t))}async connectWalletConnect(e){let t=this.getWalletConnectConnector();return{clientId:(await t.connectWalletConnect()).clientId}}async switchNetwork(e){let{caipNetwork:t,providerType:r}=e;if(!e.provider)return;let i="provider"in e.provider?e.provider.provider:e.provider;if("WALLET_CONNECT"===r){i.setDefaultChain(t.caipNetworkId);return}if(i&&"AUTH"===r){await i.switchNetwork(t.caipNetworkId);let e=await i.getUser({chainId:t.caipNetworkId,preferredAccountType:s.OptionsController.state.defaultAccountTypes[t.chainNamespace]});this.emit("switchNetwork",e)}}getWalletConnectConnector(){let e=this.connectors.find(e=>e instanceof o.z);if(!e)throw Error("WalletConnectConnector not found");return e}}},58518:function(e,t,r){"use strict";let i;r.d(t,{D:function(){return rE}});var n,s,a,o,c,l,u,d=r(68314),h=r(22192),f=r(19445);(n=o||(o={})).assertEqual=e=>e,n.assertIs=function(e){},n.assertNever=function(e){throw Error()},n.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},n.getValidEnumValues=e=>{let t=n.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let i of t)r[i]=e[i];return n.objectValues(r)},n.objectValues=e=>n.objectKeys(e).map(function(t){return e[t]}),n.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},n.find=(e,t)=>{for(let r of e)if(t(r))return r},n.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,n.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},n.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(c||(c={})).mergeShapes=(e,t)=>({...e,...t});let p=o.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),g=e=>{switch(typeof e){case"undefined":return p.undefined;case"string":return p.string;case"number":return isNaN(e)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":if(Array.isArray(e))return p.array;if(null===e)return p.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return p.promise;if("undefined"!=typeof Map&&e instanceof Map)return p.map;if("undefined"!=typeof Set&&e instanceof Set)return p.set;if("undefined"!=typeof Date&&e instanceof Date)return p.date;return p.object;default:return p.unknown}},m=o.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class b extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(e){return e.message},r={_errors:[]},i=e=>{for(let n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(i);else if("invalid_return_type"===n.code)i(n.returnTypeError);else if("invalid_arguments"===n.code)i(n.argumentsError);else if(0===n.path.length)r._errors.push(t(n));else{let e=r,i=0;for(;ie.message){let t={},r=[];for(let i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}b.create=e=>new b(e);let y=(e,t)=>{let r;switch(e.code){case m.invalid_type:r=e.received===p.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case m.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,o.jsonStringifyReplacer)}`;break;case m.unrecognized_keys:r=`Unrecognized key(s) in object: ${o.joinValues(e.keys,", ")}`;break;case m.invalid_union:r="Invalid input";break;case m.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${o.joinValues(e.options)}`;break;case m.invalid_enum_value:r=`Invalid enum value. Expected ${o.joinValues(e.options)}, received '${e.received}'`;break;case m.invalid_arguments:r="Invalid function arguments";break;case m.invalid_return_type:r="Invalid function return type";break;case m.invalid_date:r="Invalid date";break;case m.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:o.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case m.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case m.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case m.custom:r="Invalid input";break;case m.invalid_intersection_types:r="Intersection results could not be merged";break;case m.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case m.not_finite:r="Number must be finite";break;default:r=t.defaultError,o.assertNever(e)}return{message:r}},w=y;function v(){return w}let A=e=>{let{data:t,path:r,errorMaps:i,issueData:n}=e,s=[...r,...n.path||[]],a={...n,path:s},o="";for(let e of i.filter(e=>!!e).slice().reverse())o=e(a,{data:t,defaultError:o}).message;return{...n,path:s,message:n.message||o}};function E(e,t){let r=A({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,v(),y].filter(e=>!!e)});e.common.issues.push(r)}class C{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let i of t){if("aborted"===i.status)return _;"dirty"===i.status&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t)r.push({key:await e.key,value:await e.value});return C.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let i of t){let{key:t,value:n}=i;if("aborted"===t.status||"aborted"===n.status)return _;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==n.value||i.alwaysSet)&&(r[t.value]=n.value)}return{status:e.value,value:r}}}let _=Object.freeze({status:"aborted"}),I=e=>({status:"dirty",value:e}),S=e=>({status:"valid",value:e}),N=e=>"aborted"===e.status,T=e=>"dirty"===e.status,P=e=>"valid"===e.status,x=e=>"undefined"!=typeof Promise&&e instanceof Promise;(s=l||(l={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},s.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class O{constructor(e,t,r,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let R=(e,t)=>{if(P(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new b(e.common.issues);return this._error=t,this._error}}};function k(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:i,description:n}=e;if(t&&(r||i))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:n}:{errorMap:(e,t)=>"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=i?i:t.defaultError}:{message:null!=r?r:t.defaultError},description:n}}class D{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return g(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:g(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new C,ctx:{common:e.parent.common,data:e.data,parsedType:g(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(x(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;let i={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:g(e)},n=this._parseSync({data:e,path:i.path,parent:i});return R(i,n)}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:g(e)},i=this._parse({data:e,path:r.path,parent:r});return R(r,await (x(i)?i:Promise.resolve(i)))}refine(e,t){let r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,i)=>{let n=e(t),s=()=>i.addIssue({code:m.custom,...r(t)});return"undefined"!=typeof Promise&&n instanceof Promise?n.then(e=>!!e||(s(),!1)):!!n||(s(),!1)})}refinement(e,t){return this._refinement((r,i)=>!!e(r)||(i.addIssue("function"==typeof t?t(r,i):t),!1))}_refinement(e){return new ey({schema:this,typeName:u.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ew.create(this,this._def)}nullable(){return ev.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return et.create(this,this._def)}promise(){return eb.create(this,this._def)}or(e){return ei.create([this,e],this._def)}and(e){return ea.create(this,e,this._def)}transform(e){return new ey({...k(this._def),schema:this,typeName:u.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new eA({...k(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:u.ZodDefault})}brand(){return new eI({typeName:u.ZodBranded,type:this,...k(this._def)})}catch(e){return new eE({...k(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:u.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return eS.create(this,e)}readonly(){return eN.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let M=/^c[^\s-]{8,}$/i,U=/^[a-z][a-z0-9]*$/,L=/^[0-9A-HJKMNP-TV-Z]{26}$/,B=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,j=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,$=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,F=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,q=e=>e.precision?e.offset?RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):0===e.precision?e.offset?RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");class z extends D{_parse(e){let t;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){let t=this._getOrReturnCtx(e);return E(t,{code:m.invalid_type,expected:p.string,received:t.parsedType}),_}let r=new C;for(let a of this._def.checks)if("min"===a.kind)e.data.lengtha.value&&(E(t=this._getOrReturnCtx(e,t),{code:m.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if("length"===a.kind){let i=e.data.length>a.value,n=e.data.lengthe.test(t),{validation:t,code:m.invalid_string,...l.errToObj(r)})}_addCheck(e){return new z({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...l.errToObj(e)})}url(e){return this._addCheck({kind:"url",...l.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...l.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...l.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...l.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...l.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...l.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...l.errToObj(e)})}datetime(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,...l.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...l.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...l.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...l.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...l.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...l.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...l.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...l.errToObj(t)})}nonempty(e){return this.min(1,l.errToObj(e))}trim(){return new z({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new z({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new z({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new z({checks:[],typeName:u.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...k(e)})};class H extends D{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==p.number){let t=this._getOrReturnCtx(e);return E(t,{code:m.invalid_type,expected:p.number,received:t.parsedType}),_}let r=new C;for(let i of this._def.checks)"int"===i.kind?o.isInteger(e.data)||(E(t=this._getOrReturnCtx(e,t),{code:m.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):"min"===i.kind?(i.inclusive?e.datai.value:e.data>=i.value)&&(E(t=this._getOrReturnCtx(e,t),{code:m.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):"multipleOf"===i.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,n=r>i?r:i;return parseInt(e.toFixed(n).replace(".",""))%parseInt(t.toFixed(n).replace(".",""))/Math.pow(10,n)}(e.data,i.value)&&(E(t=this._getOrReturnCtx(e,t),{code:m.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):"finite"===i.kind?Number.isFinite(e.data)||(E(t=this._getOrReturnCtx(e,t),{code:m.not_finite,message:i.message}),r.dirty()):o.assertNever(i);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,r,i){return new H({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:l.toString(i)}]})}_addCheck(e){return new H({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:l.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:l.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:l.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:l.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===e.kind||"multipleOf"===e.kind&&o.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.valuenew H({checks:[],typeName:u.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...k(e)});class W extends D{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==p.bigint){let t=this._getOrReturnCtx(e);return E(t,{code:m.invalid_type,expected:p.bigint,received:t.parsedType}),_}let r=new C;for(let i of this._def.checks)"min"===i.kind?(i.inclusive?e.datai.value:e.data>=i.value)&&(E(t=this._getOrReturnCtx(e,t),{code:m.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):"multipleOf"===i.kind?e.data%i.value!==BigInt(0)&&(E(t=this._getOrReturnCtx(e,t),{code:m.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):o.assertNever(i);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,r,i){return new W({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:l.toString(i)}]})}_addCheck(e){return new W({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new W({checks:[],typeName:u.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...k(e)})};class V extends D{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){let t=this._getOrReturnCtx(e);return E(t,{code:m.invalid_type,expected:p.boolean,received:t.parsedType}),_}return S(e.data)}}V.create=e=>new V({typeName:u.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...k(e)});class G extends D{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){let t=this._getOrReturnCtx(e);return E(t,{code:m.invalid_type,expected:p.date,received:t.parsedType}),_}if(isNaN(e.data.getTime()))return E(this._getOrReturnCtx(e),{code:m.invalid_date}),_;let r=new C;for(let i of this._def.checks)"min"===i.kind?e.data.getTime()i.value&&(E(t=this._getOrReturnCtx(e,t),{code:m.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):o.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new G({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:l.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:l.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew G({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:u.ZodDate,...k(e)});class K extends D{_parse(e){if(this._getType(e)!==p.symbol){let t=this._getOrReturnCtx(e);return E(t,{code:m.invalid_type,expected:p.symbol,received:t.parsedType}),_}return S(e.data)}}K.create=e=>new K({typeName:u.ZodSymbol,...k(e)});class Q extends D{_parse(e){if(this._getType(e)!==p.undefined){let t=this._getOrReturnCtx(e);return E(t,{code:m.invalid_type,expected:p.undefined,received:t.parsedType}),_}return S(e.data)}}Q.create=e=>new Q({typeName:u.ZodUndefined,...k(e)});class Y extends D{_parse(e){if(this._getType(e)!==p.null){let t=this._getOrReturnCtx(e);return E(t,{code:m.invalid_type,expected:p.null,received:t.parsedType}),_}return S(e.data)}}Y.create=e=>new Y({typeName:u.ZodNull,...k(e)});class Z extends D{constructor(){super(...arguments),this._any=!0}_parse(e){return S(e.data)}}Z.create=e=>new Z({typeName:u.ZodAny,...k(e)});class J extends D{constructor(){super(...arguments),this._unknown=!0}_parse(e){return S(e.data)}}J.create=e=>new J({typeName:u.ZodUnknown,...k(e)});class X extends D{_parse(e){let t=this._getOrReturnCtx(e);return E(t,{code:m.invalid_type,expected:p.never,received:t.parsedType}),_}}X.create=e=>new X({typeName:u.ZodNever,...k(e)});class ee extends D{_parse(e){if(this._getType(e)!==p.undefined){let t=this._getOrReturnCtx(e);return E(t,{code:m.invalid_type,expected:p.void,received:t.parsedType}),_}return S(e.data)}}ee.create=e=>new ee({typeName:u.ZodVoid,...k(e)});class et extends D{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),i=this._def;if(t.parsedType!==p.array)return E(t,{code:m.invalid_type,expected:p.array,received:t.parsedType}),_;if(null!==i.exactLength){let e=t.data.length>i.exactLength.value,n=t.data.lengthi.maxLength.value&&(E(t,{code:m.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>i.type._parseAsync(new O(t,e,t.path,r)))).then(e=>C.mergeArray(r,e));let n=[...t.data].map((e,r)=>i.type._parseSync(new O(t,e,t.path,r)));return C.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new et({...this._def,minLength:{value:e,message:l.toString(t)}})}max(e,t){return new et({...this._def,maxLength:{value:e,message:l.toString(t)}})}length(e,t){return new et({...this._def,exactLength:{value:e,message:l.toString(t)}})}nonempty(e){return this.min(1,e)}}et.create=(e,t)=>new et({type:e,minLength:null,maxLength:null,exactLength:null,typeName:u.ZodArray,...k(t)});class er extends D{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=o.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==p.object){let t=this._getOrReturnCtx(e);return E(t,{code:m.invalid_type,expected:p.object,received:t.parsedType}),_}let{status:t,ctx:r}=this._processInputParams(e),{shape:i,keys:n}=this._getCached(),s=[];if(!(this._def.catchall instanceof X&&"strip"===this._def.unknownKeys))for(let e in r.data)n.includes(e)||s.push(e);let a=[];for(let e of n){let t=i[e],n=r.data[e];a.push({key:{status:"valid",value:e},value:t._parse(new O(r,n,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof X){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of s)a.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)s.length>0&&(E(r,{code:m.unrecognized_keys,keys:s}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of s){let i=r.data[t];a.push({key:{status:"valid",value:t},value:e._parse(new O(r,i,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of a){let r=await t.key;e.push({key:r,value:await t.value,alwaysSet:t.alwaysSet})}return e}).then(e=>C.mergeObjectSync(t,e)):C.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return l.errToObj,new er({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var i,n,s,a;let o=null!==(s=null===(n=(i=this._def).errorMap)||void 0===n?void 0:n.call(i,t,r).message)&&void 0!==s?s:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(a=l.errToObj(e).message)&&void 0!==a?a:o}:{message:o}}}:{}})}strip(){return new er({...this._def,unknownKeys:"strip"})}passthrough(){return new er({...this._def,unknownKeys:"passthrough"})}extend(e){return new er({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new er({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:u.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new er({...this._def,catchall:e})}pick(e){let t={};return o.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new er({...this._def,shape:()=>t})}omit(e){let t={};return o.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new er({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof er){let r={};for(let i in t.shape){let n=t.shape[i];r[i]=ew.create(e(n))}return new er({...t._def,shape:()=>r})}return t instanceof et?new et({...t._def,type:e(t.element)}):t instanceof ew?ew.create(e(t.unwrap())):t instanceof ev?ev.create(e(t.unwrap())):t instanceof eo?eo.create(t.items.map(t=>e(t))):t}(this)}partial(e){let t={};return o.objectKeys(this.shape).forEach(r=>{let i=this.shape[r];e&&!e[r]?t[r]=i:t[r]=i.optional()}),new er({...this._def,shape:()=>t})}required(e){let t={};return o.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof ew;)e=e._def.innerType;t[r]=e}}),new er({...this._def,shape:()=>t})}keyof(){return ep(o.objectKeys(this.shape))}}er.create=(e,t)=>new er({shape:()=>e,unknownKeys:"strip",catchall:X.create(),typeName:u.ZodObject,...k(t)}),er.strictCreate=(e,t)=>new er({shape:()=>e,unknownKeys:"strict",catchall:X.create(),typeName:u.ZodObject,...k(t)}),er.lazycreate=(e,t)=>new er({shape:e,unknownKeys:"strip",catchall:X.create(),typeName:u.ZodObject,...k(t)});class ei extends D{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new b(e.ctx.common.issues));return E(t,{code:m.invalid_union,unionErrors:r}),_});{let e;let i=[];for(let n of r){let r={...t,common:{...t.common,issues:[]},parent:null},s=n._parseSync({data:t.data,path:t.path,parent:r});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:r}),r.common.issues.length&&i.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let n=i.map(e=>new b(e));return E(t,{code:m.invalid_union,unionErrors:n}),_}}get options(){return this._def.options}}ei.create=(e,t)=>new ei({options:e,typeName:u.ZodUnion,...k(t)});let en=e=>{if(e instanceof eh)return en(e.schema);if(e instanceof ey)return en(e.innerType());if(e instanceof ef)return[e.value];if(e instanceof eg)return e.options;if(e instanceof em)return Object.keys(e.enum);if(e instanceof eA)return en(e._def.innerType);if(e instanceof Q)return[void 0];else if(e instanceof Y)return[null];else return null};class es extends D{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.object)return E(t,{code:m.invalid_type,expected:p.object,received:t.parsedType}),_;let r=this.discriminator,i=t.data[r],n=this.optionsMap.get(i);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(E(t,{code:m.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),_)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let i=new Map;for(let r of t){let t=en(r.shape[e]);if(!t)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let n of t){if(i.has(n))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);i.set(n,r)}}return new es({typeName:u.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...k(r)})}}class ea extends D{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=(e,i)=>{if(N(e)||N(i))return _;let n=function e(t,r){let i=g(t),n=g(r);if(t===r)return{valid:!0,data:t};if(i===p.object&&n===p.object){let i=o.objectKeys(r),n=o.objectKeys(t).filter(e=>-1!==i.indexOf(e)),s={...t,...r};for(let i of n){let n=e(t[i],r[i]);if(!n.valid)return{valid:!1};s[i]=n.data}return{valid:!0,data:s}}if(i===p.array&&n===p.array){if(t.length!==r.length)return{valid:!1};let i=[];for(let n=0;ni(e,t)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ea.create=(e,t,r)=>new ea({left:e,right:t,typeName:u.ZodIntersection,...k(r)});class eo extends D{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.array)return E(r,{code:m.invalid_type,expected:p.array,received:r.parsedType}),_;if(r.data.lengththis._def.items.length&&(E(r,{code:m.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=[...r.data].map((e,t)=>{let i=this._def.items[t]||this._def.rest;return i?i._parse(new O(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(i).then(e=>C.mergeArray(t,e)):C.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new eo({...this._def,rest:e})}}eo.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new eo({items:e,typeName:u.ZodTuple,rest:null,...k(t)})};class ec extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.object)return E(r,{code:m.invalid_type,expected:p.object,received:r.parsedType}),_;let i=[],n=this._def.keyType,s=this._def.valueType;for(let e in r.data)i.push({key:n._parse(new O(r,e,r.path,e)),value:s._parse(new O(r,r.data[e],r.path,e))});return r.common.async?C.mergeObjectAsync(t,i):C.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,r){return new ec(t instanceof D?{keyType:e,valueType:t,typeName:u.ZodRecord,...k(r)}:{keyType:z.create(),valueType:e,typeName:u.ZodRecord,...k(t)})}}class el extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.map)return E(r,{code:m.invalid_type,expected:p.map,received:r.parsedType}),_;let i=this._def.keyType,n=this._def.valueType,s=[...r.data.entries()].map(([e,t],s)=>({key:i._parse(new O(r,e,r.path,[s,"key"])),value:n._parse(new O(r,t,r.path,[s,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of s){let i=await r.key,n=await r.value;if("aborted"===i.status||"aborted"===n.status)return _;("dirty"===i.status||"dirty"===n.status)&&t.dirty(),e.set(i.value,n.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of s){let i=r.key,n=r.value;if("aborted"===i.status||"aborted"===n.status)return _;("dirty"===i.status||"dirty"===n.status)&&t.dirty(),e.set(i.value,n.value)}return{status:t.value,value:e}}}}el.create=(e,t,r)=>new el({valueType:t,keyType:e,typeName:u.ZodMap,...k(r)});class eu extends D{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.set)return E(r,{code:m.invalid_type,expected:p.set,received:r.parsedType}),_;let i=this._def;null!==i.minSize&&r.data.sizei.maxSize.value&&(E(r,{code:m.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());let n=this._def.valueType;function s(e){let r=new Set;for(let i of e){if("aborted"===i.status)return _;"dirty"===i.status&&t.dirty(),r.add(i.value)}return{status:t.value,value:r}}let a=[...r.data.values()].map((e,t)=>n._parse(new O(r,e,r.path,t)));return r.common.async?Promise.all(a).then(e=>s(e)):s(a)}min(e,t){return new eu({...this._def,minSize:{value:e,message:l.toString(t)}})}max(e,t){return new eu({...this._def,maxSize:{value:e,message:l.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}eu.create=(e,t)=>new eu({valueType:e,minSize:null,maxSize:null,typeName:u.ZodSet,...k(t)});class ed extends D{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.function)return E(t,{code:m.invalid_type,expected:p.function,received:t.parsedType}),_;function r(e,r){return A({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,v(),y].filter(e=>!!e),issueData:{code:m.invalid_arguments,argumentsError:r}})}function i(e,r){return A({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,v(),y].filter(e=>!!e),issueData:{code:m.invalid_return_type,returnTypeError:r}})}let n={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof eb){let e=this;return S(async function(...t){let a=new b([]),o=await e._def.args.parseAsync(t,n).catch(e=>{throw a.addIssue(r(t,e)),a}),c=await Reflect.apply(s,this,o);return await e._def.returns._def.type.parseAsync(c,n).catch(e=>{throw a.addIssue(i(c,e)),a})})}{let e=this;return S(function(...t){let a=e._def.args.safeParse(t,n);if(!a.success)throw new b([r(t,a.error)]);let o=Reflect.apply(s,this,a.data),c=e._def.returns.safeParse(o,n);if(!c.success)throw new b([i(o,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ed({...this._def,args:eo.create(e).rest(J.create())})}returns(e){return new ed({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new ed({args:e||eo.create([]).rest(J.create()),returns:t||J.create(),typeName:u.ZodFunction,...k(r)})}}class eh extends D{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}eh.create=(e,t)=>new eh({getter:e,typeName:u.ZodLazy,...k(t)});class ef extends D{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return E(t,{received:t.data,code:m.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:e.data}}get value(){return this._def.value}}function ep(e,t){return new eg({values:e,typeName:u.ZodEnum,...k(t)})}ef.create=(e,t)=>new ef({value:e,typeName:u.ZodLiteral,...k(t)});class eg extends D{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return E(t,{expected:o.joinValues(r),received:t.parsedType,code:m.invalid_type}),_}if(-1===this._def.values.indexOf(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return E(t,{received:t.data,code:m.invalid_enum_value,options:r}),_}return S(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e){return eg.create(e)}exclude(e){return eg.create(this.options.filter(t=>!e.includes(t)))}}eg.create=ep;class em extends D{_parse(e){let t=o.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==p.string&&r.parsedType!==p.number){let e=o.objectValues(t);return E(r,{expected:o.joinValues(e),received:r.parsedType,code:m.invalid_type}),_}if(-1===t.indexOf(e.data)){let e=o.objectValues(t);return E(r,{received:r.data,code:m.invalid_enum_value,options:e}),_}return S(e.data)}get enum(){return this._def.values}}em.create=(e,t)=>new em({values:e,typeName:u.ZodNativeEnum,...k(t)});class eb extends D{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==p.promise&&!1===t.common.async?(E(t,{code:m.invalid_type,expected:p.promise,received:t.parsedType}),_):S((t.parsedType===p.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}eb.create=(e,t)=>new eb({type:e,typeName:u.ZodPromise,...k(t)});class ey extends D{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===u.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=this._def.effect||null,n={addIssue:e=>{E(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===i.type){let e=i.transform(r.data,n);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(e).then(e=>this._def.schema._parseAsync({data:e,path:r.path,parent:r})):this._def.schema._parseSync({data:e,path:r.path,parent:r})}if("refinement"===i.type){let e=e=>{let t=i.refinement(e,n);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?_:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===i.status?_:("dirty"===i.status&&t.dirty(),e(i.value),{status:t.value,value:i.value})}}if("transform"===i.type){if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>P(e)?Promise.resolve(i.transform(e.value,n)).then(e=>({status:t.value,value:e})):e);{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!P(e))return e;let s=i.transform(e.value,n);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}}o.assertNever(i)}}ey.create=(e,t,r)=>new ey({schema:e,typeName:u.ZodEffects,effect:t,...k(r)}),ey.createWithPreprocess=(e,t,r)=>new ey({schema:t,effect:{type:"preprocess",transform:e},typeName:u.ZodEffects,...k(r)});class ew extends D{_parse(e){return this._getType(e)===p.undefined?S(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ew.create=(e,t)=>new ew({innerType:e,typeName:u.ZodOptional,...k(t)});class ev extends D{_parse(e){return this._getType(e)===p.null?S(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ev.create=(e,t)=>new ev({innerType:e,typeName:u.ZodNullable,...k(t)});class eA extends D{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===p.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}eA.create=(e,t)=>new eA({innerType:e,typeName:u.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...k(t)});class eE extends D{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return x(i)?i.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new b(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===i.status?i.value:this._def.catchValue({get error(){return new b(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}eE.create=(e,t)=>new eE({innerType:e,typeName:u.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...k(t)});class eC extends D{_parse(e){if(this._getType(e)!==p.nan){let t=this._getOrReturnCtx(e);return E(t,{code:m.invalid_type,expected:p.nan,received:t.parsedType}),_}return{status:"valid",value:e.data}}}eC.create=e=>new eC({typeName:u.ZodNaN,...k(e)});let e_=Symbol("zod_brand");class eI extends D{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class eS extends D{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?_:"dirty"===e.status?(t.dirty(),I(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?_:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new eS({in:e,out:t,typeName:u.ZodPipeline})}}class eN extends D{_parse(e){let t=this._def.innerType._parse(e);return P(t)&&(t.value=Object.freeze(t.value)),t}}eN.create=(e,t)=>new eN({innerType:e,typeName:u.ZodReadonly,...k(t)});let eT=(e,t={},r)=>e?Z.create().superRefine((i,n)=>{var s,a;if(!e(i)){let e="function"==typeof t?t(i):"string"==typeof t?{message:t}:t,o=null===(a=null!==(s=e.fatal)&&void 0!==s?s:r)||void 0===a||a;n.addIssue({code:"custom",..."string"==typeof e?{message:e}:e,fatal:o})}}):Z.create(),eP={object:er.lazycreate};(a=u||(u={})).ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly";let ex=z.create,eO=H.create,eR=eC.create,ek=W.create,eD=V.create,eM=G.create,eU=K.create,eL=Q.create,eB=Y.create,ej=Z.create,e$=J.create,eF=X.create,eq=ee.create,ez=et.create,eH=er.create,eW=er.strictCreate,eV=ei.create,eG=es.create,eK=ea.create,eQ=eo.create,eY=ec.create,eZ=el.create,eJ=eu.create,eX=ed.create,e0=eh.create,e1=ef.create,e2=eg.create,e3=em.create,e8=eb.create,e5=ey.create,e6=ew.create,e4=ev.create,e9=ey.createWithPreprocess,e7=eS.create;var te=Object.freeze({__proto__:null,defaultErrorMap:y,setErrorMap:function(e){w=e},getErrorMap:v,makeIssue:A,EMPTY_PATH:[],addIssueToContext:E,ParseStatus:C,INVALID:_,DIRTY:I,OK:S,isAborted:N,isDirty:T,isValid:P,isAsync:x,get util(){return o},get objectUtil(){return c},ZodParsedType:p,getParsedType:g,ZodType:D,ZodString:z,ZodNumber:H,ZodBigInt:W,ZodBoolean:V,ZodDate:G,ZodSymbol:K,ZodUndefined:Q,ZodNull:Y,ZodAny:Z,ZodUnknown:J,ZodNever:X,ZodVoid:ee,ZodArray:et,ZodObject:er,ZodUnion:ei,ZodDiscriminatedUnion:es,ZodIntersection:ea,ZodTuple:eo,ZodRecord:ec,ZodMap:el,ZodSet:eu,ZodFunction:ed,ZodLazy:eh,ZodLiteral:ef,ZodEnum:eg,ZodNativeEnum:em,ZodPromise:eb,ZodEffects:ey,ZodTransformer:ey,ZodOptional:ew,ZodNullable:ev,ZodDefault:eA,ZodCatch:eE,ZodNaN:eC,BRAND:e_,ZodBranded:eI,ZodPipeline:eS,ZodReadonly:eN,custom:eT,Schema:D,ZodSchema:D,late:eP,get ZodFirstPartyTypeKind(){return u},coerce:{string:e=>z.create({...e,coerce:!0}),number:e=>H.create({...e,coerce:!0}),boolean:e=>V.create({...e,coerce:!0}),bigint:e=>W.create({...e,coerce:!0}),date:e=>G.create({...e,coerce:!0})},any:ej,array:ez,bigint:ek,boolean:eD,date:eM,discriminatedUnion:eG,effect:e5,enum:e2,function:eX,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>eT(t=>t instanceof e,t),intersection:eK,lazy:e0,literal:e1,map:eZ,nan:eR,nativeEnum:e3,never:eF,null:eB,nullable:e4,number:eO,object:eH,oboolean:()=>eD().optional(),onumber:()=>eO().optional(),optional:e6,ostring:()=>ex().optional(),pipeline:e7,preprocess:e9,promise:e8,record:eY,set:eJ,strictObject:eW,string:ex,symbol:eU,transformer:e5,tuple:eQ,undefined:eL,union:eV,unknown:e$,void:eq,NEVER:_,ZodIssueCode:m,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:b});let tt=te.object({message:te.string()});function tr(e){return te.literal(h.$0[e])}te.object({accessList:te.array(te.string()),blockHash:te.string().nullable(),blockNumber:te.string().nullable(),chainId:te.string().or(te.number()),from:te.string(),gas:te.string(),hash:te.string(),input:te.string().nullable(),maxFeePerGas:te.string(),maxPriorityFeePerGas:te.string(),nonce:te.string(),r:te.string(),s:te.string(),to:te.string(),transactionIndex:te.string().nullable(),type:te.string(),v:te.string(),value:te.string()});let ti=te.object({chainId:te.string().or(te.number())}),tn=te.object({email:te.string().email()}),ts=te.object({otp:te.string()}),ta=te.object({uri:te.string()}),to=te.object({chainId:te.optional(te.string().or(te.number())),preferredAccountType:te.optional(te.string())}),tc=te.object({provider:te.enum(["google","github","apple","facebook","x","discord"])}),tl=te.object({email:te.string().email()}),tu=te.object({otp:te.string()}),td=te.object({otp:te.string()}),th=te.object({themeMode:te.optional(te.enum(["light","dark"])),themeVariables:te.optional(te.record(te.string(),te.string().or(te.number()))),w3mThemeVariables:te.optional(te.record(te.string(),te.string()))}),tf=te.object({metadata:te.object({name:te.string(),description:te.string(),url:te.string(),icons:te.array(te.string())}).optional(),sdkVersion:te.string().optional(),sdkType:te.string().optional(),projectId:te.string()}),tp=te.object({type:te.string()}),tg=te.object({action:te.enum(["VERIFY_DEVICE","VERIFY_OTP","CONNECT"])}),tm=te.object({url:te.string()}),tb=te.object({userName:te.string()}),ty=te.object({email:te.string().optional().nullable(),address:te.string(),chainId:te.string().or(te.number()),accounts:te.array(te.object({address:te.string(),type:te.enum([h.y_.ACCOUNT_TYPES.EOA,h.y_.ACCOUNT_TYPES.SMART_ACCOUNT])})).optional(),userName:te.string().optional().nullable()}),tw=te.object({action:te.enum(["VERIFY_PRIMARY_OTP","VERIFY_SECONDARY_OTP"])}),tv=te.object({email:te.string().email().optional().nullable(),address:te.string(),chainId:te.string().or(te.number()),smartAccountDeployed:te.optional(te.boolean()),accounts:te.array(te.object({address:te.string(),type:te.enum([h.y_.ACCOUNT_TYPES.EOA,h.y_.ACCOUNT_TYPES.SMART_ACCOUNT])})).optional(),preferredAccountType:te.optional(te.string())}),tA=te.object({uri:te.string()}),tE=te.object({isConnected:te.boolean()}),tC=te.object({chainId:te.string().or(te.number())}),t_=te.object({chainId:te.string().or(te.number())}),tI=te.object({newEmail:te.string().email()}),tS=te.object({smartAccountEnabledNetworks:te.array(te.number())});te.object({address:te.string(),isDeployed:te.boolean()});let tN=te.object({version:te.string().optional()}),tT=te.object({type:te.string(),address:te.string()}),tP=te.any(),tx=te.object({method:te.literal("eth_accounts")}),tO=te.object({method:te.literal("eth_blockNumber")}),tR=te.object({method:te.literal("eth_call"),params:te.array(te.any())}),tk=te.object({method:te.literal("eth_chainId")}),tD=te.object({method:te.literal("eth_estimateGas"),params:te.array(te.any())}),tM=te.object({method:te.literal("eth_feeHistory"),params:te.array(te.any())}),tU=te.object({method:te.literal("eth_gasPrice")}),tL=te.object({method:te.literal("eth_getAccount"),params:te.array(te.any())}),tB=te.object({method:te.literal("eth_getBalance"),params:te.array(te.any())}),tj=te.object({method:te.literal("eth_getBlockByHash"),params:te.array(te.any())}),t$=te.object({method:te.literal("eth_getBlockByNumber"),params:te.array(te.any())}),tF=te.object({method:te.literal("eth_getBlockReceipts"),params:te.array(te.any())}),tq=te.object({method:te.literal("eth_getBlockTransactionCountByHash"),params:te.array(te.any())}),tz=te.object({method:te.literal("eth_getBlockTransactionCountByNumber"),params:te.array(te.any())}),tH=te.object({method:te.literal("eth_getCode"),params:te.array(te.any())}),tW=te.object({method:te.literal("eth_getFilterChanges"),params:te.array(te.any())}),tV=te.object({method:te.literal("eth_getFilterLogs"),params:te.array(te.any())}),tG=te.object({method:te.literal("eth_getLogs"),params:te.array(te.any())}),tK=te.object({method:te.literal("eth_getProof"),params:te.array(te.any())}),tQ=te.object({method:te.literal("eth_getStorageAt"),params:te.array(te.any())}),tY=te.object({method:te.literal("eth_getTransactionByBlockHashAndIndex"),params:te.array(te.any())}),tZ=te.object({method:te.literal("eth_getTransactionByBlockNumberAndIndex"),params:te.array(te.any())}),tJ=te.object({method:te.literal("eth_getTransactionByHash"),params:te.array(te.any())}),tX=te.object({method:te.literal("eth_getTransactionCount"),params:te.array(te.any())}),t0=te.object({method:te.literal("eth_getTransactionReceipt"),params:te.array(te.any())}),t1=te.object({method:te.literal("eth_getUncleCountByBlockHash"),params:te.array(te.any())}),t2=te.object({method:te.literal("eth_getUncleCountByBlockNumber"),params:te.array(te.any())}),t3=te.object({method:te.literal("eth_maxPriorityFeePerGas")}),t8=te.object({method:te.literal("eth_newBlockFilter")}),t5=te.object({method:te.literal("eth_newFilter"),params:te.array(te.any())}),t6=te.object({method:te.literal("eth_newPendingTransactionFilter")}),t4=te.object({method:te.literal("eth_sendRawTransaction"),params:te.array(te.any())}),t9=te.object({method:te.literal("eth_syncing"),params:te.array(te.any())}),t7=te.object({method:te.literal("eth_uninstallFilter"),params:te.array(te.any())}),re=te.object({method:te.literal("personal_sign"),params:te.array(te.any())}),rt=te.object({method:te.literal("eth_signTypedData_v4"),params:te.array(te.any())}),rr=te.object({method:te.literal("eth_sendTransaction"),params:te.array(te.any())}),ri=te.object({method:te.literal("solana_signMessage"),params:te.object({message:te.string(),pubkey:te.string()})}),rn=te.object({method:te.literal("solana_signTransaction"),params:te.object({transaction:te.string()})}),rs=te.object({method:te.literal("solana_signAllTransactions"),params:te.object({transactions:te.array(te.string())})}),ra=te.object({method:te.literal("solana_signAndSendTransaction"),params:te.object({transaction:te.string(),options:te.object({skipPreflight:te.boolean().optional(),preflightCommitment:te.enum(["processed","confirmed","finalized","recent","single","singleGossip","root","max"]).optional(),maxRetries:te.number().optional(),minContextSlot:te.number().optional()}).optional()})}),ro=te.object({method:te.literal("wallet_sendCalls"),params:te.array(te.object({chainId:te.string().or(te.number()).optional(),from:te.string().optional(),version:te.string().optional(),capabilities:te.any().optional(),calls:te.array(te.object({to:te.string().startsWith("0x"),data:te.string().startsWith("0x").optional(),value:te.string().optional()}))}))}),rc=te.object({method:te.literal("wallet_getCallsStatus"),params:te.array(te.string())}),rl=te.object({method:te.literal("wallet_getCapabilities")}),ru=te.object({method:te.literal("wallet_grantPermissions"),params:te.array(te.any())}),rd=te.object({method:te.literal("wallet_revokePermissions"),params:te.any()}),rh=te.object({method:te.literal("wallet_getAssets"),params:te.any()}),rf=te.object({token:te.string()}),rp=te.object({id:te.string().optional()}),rg={appEvent:rp.extend({type:tr("APP_SWITCH_NETWORK"),payload:ti}).or(rp.extend({type:tr("APP_CONNECT_EMAIL"),payload:tn})).or(rp.extend({type:tr("APP_CONNECT_DEVICE")})).or(rp.extend({type:tr("APP_CONNECT_OTP"),payload:ts})).or(rp.extend({type:tr("APP_CONNECT_SOCIAL"),payload:ta})).or(rp.extend({type:tr("APP_GET_FARCASTER_URI")})).or(rp.extend({type:tr("APP_CONNECT_FARCASTER")})).or(rp.extend({type:tr("APP_GET_USER"),payload:te.optional(to)})).or(rp.extend({type:tr("APP_GET_SOCIAL_REDIRECT_URI"),payload:tc})).or(rp.extend({type:tr("APP_SIGN_OUT")})).or(rp.extend({type:tr("APP_IS_CONNECTED"),payload:te.optional(rf)})).or(rp.extend({type:tr("APP_GET_CHAIN_ID")})).or(rp.extend({type:tr("APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS")})).or(rp.extend({type:tr("APP_INIT_SMART_ACCOUNT")})).or(rp.extend({type:tr("APP_SET_PREFERRED_ACCOUNT"),payload:tp})).or(rp.extend({type:tr("APP_RPC_REQUEST"),payload:re.or(rh).or(tx).or(tO).or(tR).or(tk).or(tD).or(tM).or(tU).or(tL).or(tB).or(tj).or(t$).or(tF).or(tq).or(tz).or(tH).or(tW).or(tV).or(tG).or(tK).or(tQ).or(tY).or(tZ).or(tJ).or(tX).or(t0).or(t1).or(t2).or(t3).or(t8).or(t5).or(t6).or(t4).or(t9).or(t7).or(re).or(rt).or(rr).or(ri).or(rn).or(rs).or(ra).or(rc).or(ro).or(rl).or(ru).or(rd)})).or(rp.extend({type:tr("APP_UPDATE_EMAIL"),payload:tl})).or(rp.extend({type:tr("APP_UPDATE_EMAIL_PRIMARY_OTP"),payload:tu})).or(rp.extend({type:tr("APP_UPDATE_EMAIL_SECONDARY_OTP"),payload:td})).or(rp.extend({type:tr("APP_SYNC_THEME"),payload:th})).or(rp.extend({type:tr("APP_SYNC_DAPP_DATA"),payload:tf})).or(rp.extend({type:tr("APP_RELOAD")})),frameEvent:rp.extend({type:tr("FRAME_SWITCH_NETWORK_ERROR"),payload:tt}).or(rp.extend({type:tr("FRAME_SWITCH_NETWORK_SUCCESS"),payload:t_})).or(rp.extend({type:tr("FRAME_CONNECT_EMAIL_SUCCESS"),payload:tg})).or(rp.extend({type:tr("FRAME_CONNECT_EMAIL_ERROR"),payload:tt})).or(rp.extend({type:tr("FRAME_GET_FARCASTER_URI_SUCCESS"),payload:tm})).or(rp.extend({type:tr("FRAME_GET_FARCASTER_URI_ERROR"),payload:tt})).or(rp.extend({type:tr("FRAME_CONNECT_FARCASTER_SUCCESS"),payload:tb})).or(rp.extend({type:tr("FRAME_CONNECT_FARCASTER_ERROR"),payload:tt})).or(rp.extend({type:tr("FRAME_CONNECT_OTP_ERROR"),payload:tt})).or(rp.extend({type:tr("FRAME_CONNECT_OTP_SUCCESS")})).or(rp.extend({type:tr("FRAME_CONNECT_DEVICE_ERROR"),payload:tt})).or(rp.extend({type:tr("FRAME_CONNECT_DEVICE_SUCCESS")})).or(rp.extend({type:tr("FRAME_CONNECT_SOCIAL_SUCCESS"),payload:ty})).or(rp.extend({type:tr("FRAME_CONNECT_SOCIAL_ERROR"),payload:tt})).or(rp.extend({type:tr("FRAME_GET_USER_ERROR"),payload:tt})).or(rp.extend({type:tr("FRAME_GET_USER_SUCCESS"),payload:tv})).or(rp.extend({type:tr("FRAME_GET_SOCIAL_REDIRECT_URI_ERROR"),payload:tt})).or(rp.extend({type:tr("FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS"),payload:tA})).or(rp.extend({type:tr("FRAME_SIGN_OUT_ERROR"),payload:tt})).or(rp.extend({type:tr("FRAME_SIGN_OUT_SUCCESS")})).or(rp.extend({type:tr("FRAME_IS_CONNECTED_ERROR"),payload:tt})).or(rp.extend({type:tr("FRAME_IS_CONNECTED_SUCCESS"),payload:tE})).or(rp.extend({type:tr("FRAME_GET_CHAIN_ID_ERROR"),payload:tt})).or(rp.extend({type:tr("FRAME_GET_CHAIN_ID_SUCCESS"),payload:tC})).or(rp.extend({type:tr("FRAME_RPC_REQUEST_ERROR"),payload:tt})).or(rp.extend({type:tr("FRAME_RPC_REQUEST_SUCCESS"),payload:tP})).or(rp.extend({type:tr("FRAME_SESSION_UPDATE"),payload:rf})).or(rp.extend({type:tr("FRAME_UPDATE_EMAIL_ERROR"),payload:tt})).or(rp.extend({type:tr("FRAME_UPDATE_EMAIL_SUCCESS"),payload:tw})).or(rp.extend({type:tr("FRAME_UPDATE_EMAIL_PRIMARY_OTP_ERROR"),payload:tt})).or(rp.extend({type:tr("FRAME_UPDATE_EMAIL_PRIMARY_OTP_SUCCESS")})).or(rp.extend({type:tr("FRAME_UPDATE_EMAIL_SECONDARY_OTP_ERROR"),payload:tt})).or(rp.extend({type:tr("FRAME_UPDATE_EMAIL_SECONDARY_OTP_SUCCESS"),payload:tI})).or(rp.extend({type:tr("FRAME_SYNC_THEME_ERROR"),payload:tt})).or(rp.extend({type:tr("FRAME_SYNC_THEME_SUCCESS")})).or(rp.extend({type:tr("FRAME_SYNC_DAPP_DATA_ERROR"),payload:tt})).or(rp.extend({type:tr("FRAME_SYNC_DAPP_DATA_SUCCESS")})).or(rp.extend({type:tr("FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS"),payload:tS})).or(rp.extend({type:tr("FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR"),payload:tt})).or(rp.extend({type:tr("FRAME_INIT_SMART_ACCOUNT_ERROR"),payload:tt})).or(rp.extend({type:tr("FRAME_SET_PREFERRED_ACCOUNT_SUCCESS"),payload:tT})).or(rp.extend({type:tr("FRAME_SET_PREFERRED_ACCOUNT_ERROR"),payload:tt})).or(rp.extend({type:tr("FRAME_READY"),payload:tN})).or(rp.extend({type:tr("FRAME_RELOAD_ERROR"),payload:tt})).or(rp.extend({type:tr("FRAME_RELOAD_SUCCESS")}))};function rm(e,t={}){return"string"==typeof t?.type&&t?.type?.includes(e)}class rb{constructor({projectId:e,isAppClient:t=!1,chainId:r="eip155:1",enableLogger:i=!0}){if(this.iframe=null,this.rpcUrl=d.b.BLOCKCHAIN_API_RPC_URL,this.initFrame=()=>{let e=document.getElementById("w3m-iframe");this.iframe&&!e&&document.body.appendChild(this.iframe)},this.events={registerFrameEventHandler:(e,t,r)=>{function i({data:r}){if(!rm(h.$0.FRAME_EVENT_KEY,r))return;let n=rg.frameEvent.parse(r);n.id===e&&(t(n),window.removeEventListener("message",i))}f.$.isClient&&(window.addEventListener("message",i),r.addEventListener("abort",()=>{window.removeEventListener("message",i)}))},onFrameEvent:e=>{f.$.isClient&&window.addEventListener("message",({data:t})=>{rm(h.$0.FRAME_EVENT_KEY,t)&&e(rg.frameEvent.parse(t))})},onAppEvent:e=>{f.$.isClient&&window.addEventListener("message",({data:t})=>{rm(h.$0.APP_EVENT_KEY,t)&&e(rg.appEvent.parse(t))})},postAppEvent:e=>{if(f.$.isClient){if(!this.iframe?.contentWindow)throw Error("W3mFrame: iframe is not set");rg.appEvent.parse(e),this.iframe.contentWindow.postMessage(e,"*")}},postFrameEvent:e=>{if(f.$.isClient){if(!parent)throw Error("W3mFrame: parent is not set");rg.frameEvent.parse(e),parent.postMessage(e,"*")}}},this.projectId=e,this.frameLoadPromise=new Promise((e,t)=>{this.frameLoadPromiseResolver={resolve:e,reject:t}}),t&&(this.frameLoadPromise=new Promise((e,t)=>{this.frameLoadPromiseResolver={resolve:e,reject:t}}),f.$.isClient)){let t=document.createElement("iframe");t.id="w3m-iframe",t.src=`${h.Dr}?projectId=${e}&chainId=${r}&version=${h.zN}&enableLogger=${i}`,t.name="w3m-secure-iframe",t.style.position="fixed",t.style.zIndex="999999",t.style.display="none",t.style.animationDelay="0s, 50ms",t.style.borderBottomLeftRadius="clamp(0px, var(--wui-border-radius-l), 44px)",t.style.borderBottomRightRadius="clamp(0px, var(--wui-border-radius-l), 44px)",this.iframe=t,this.iframe.onerror=()=>{this.frameLoadPromiseResolver?.reject("Unable to load email login dependency")},this.events.onFrameEvent(e=>{"@w3m-frame/READY"===e.type&&this.frameLoadPromiseResolver?.resolve(void 0)})}}get networks(){return Object.assign({},...["eip155:1","eip155:5","eip155:11155111","eip155:10","eip155:420","eip155:42161","eip155:421613","eip155:137","eip155:80001","eip155:42220","eip155:1313161554","eip155:1313161555","eip155:56","eip155:97","eip155:43114","eip155:43113","eip155:324","eip155:280","eip155:100","eip155:8453","eip155:84531","eip155:84532","eip155:7777777","eip155:999","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"].map(e=>({[e]:{rpcUrl:`${this.rpcUrl}/v1/?chainId=${e}&projectId=${this.projectId}`,chainId:e}})))}}var ry=r(12044);class rw{constructor(e){let t=(0,ry.jI)({level:h.jd}),{logger:r,chunkLoggerController:i}=(0,ry.Rt)({opts:t});this.logger=(0,ry.Ep)(r,this.constructor.name),this.chunkLoggerController=i,"undefined"!=typeof window&&this.chunkLoggerController?.downloadLogsBlobInBrowser&&(window.downloadAppKitLogsBlob||(window.downloadAppKitLogsBlob={}),window.downloadAppKitLogsBlob.sdk=()=>{this.chunkLoggerController?.downloadLogsBlobInBrowser&&this.chunkLoggerController.downloadLogsBlobInBrowser({projectId:e})})}}var rv=r(97363);class rA{constructor({projectId:e,chainId:t,enableLogger:r=!0,onTimeout:i}){this.openRpcRequests=[],r&&(this.w3mLogger=new rw(e)),this.w3mFrame=new rb({projectId:e,isAppClient:!0,chainId:t,enableLogger:r}),this.onTimeout=i,this.getLoginEmailUsed()&&this.w3mFrame.initFrame(),this.initPromise=new Promise(e=>{this.w3mFrame.events.onFrameEvent(t=>{t.type===h.$0.FRAME_READY&&(this.initPromise=void 0,e())})})}async init(){this.w3mFrame.initFrame(),this.initPromise&&await this.initPromise}getLoginEmailUsed(){return!!rv.e.get(h.$0.EMAIL_LOGIN_USED_KEY)}getEmail(){return rv.e.get(h.$0.EMAIL)}getUsername(){return rv.e.get(h.$0.SOCIAL_USERNAME)}async reload(){try{this.w3mFrame.initFrame(),await this.appEvent({type:h.$0.APP_RELOAD})}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error reloading iframe"),e}}async connectEmail(e){try{f.$.checkIfAllowedToTriggerEmail(),this.w3mFrame.initFrame();let t=await this.appEvent({type:h.$0.APP_CONNECT_EMAIL,payload:e});return this.setNewLastEmailLoginTime(),t}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error connecting email"),e}}async connectDevice(){try{return this.appEvent({type:h.$0.APP_CONNECT_DEVICE})}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error connecting device"),e}}async connectOtp(e){try{return this.appEvent({type:h.$0.APP_CONNECT_OTP,payload:e})}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error connecting otp"),e}}async isConnected(){try{if(!this.getLoginEmailUsed())return{isConnected:!1};let e=await this.appEvent({type:h.$0.APP_IS_CONNECTED});return e.isConnected||this.deleteAuthLoginCache(),e}catch(e){throw this.deleteAuthLoginCache(),this.w3mLogger?.logger.error({error:e},"Error checking connection"),e}}async getChainId(){try{let e=await this.appEvent({type:h.$0.APP_GET_CHAIN_ID});return this.setLastUsedChainId(e.chainId),e}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error getting chain id"),e}}async getSocialRedirectUri(e){try{return this.w3mFrame.initFrame(),this.appEvent({type:h.$0.APP_GET_SOCIAL_REDIRECT_URI,payload:e})}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error getting social redirect uri"),e}}async updateEmail(e){try{let t=await this.appEvent({type:h.$0.APP_UPDATE_EMAIL,payload:e});return this.setNewLastEmailLoginTime(),t}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error updating email"),e}}async updateEmailPrimaryOtp(e){try{return this.appEvent({type:h.$0.APP_UPDATE_EMAIL_PRIMARY_OTP,payload:e})}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error updating email primary otp"),e}}async updateEmailSecondaryOtp(e){try{let t=await this.appEvent({type:h.$0.APP_UPDATE_EMAIL_SECONDARY_OTP,payload:e});return this.setLoginSuccess(t.newEmail),t}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error updating email secondary otp"),e}}async syncTheme(e){try{return this.appEvent({type:h.$0.APP_SYNC_THEME,payload:e})}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error syncing theme"),e}}async syncDappData(e){try{return this.appEvent({type:h.$0.APP_SYNC_DAPP_DATA,payload:e})}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error syncing dapp data"),e}}async getSmartAccountEnabledNetworks(){try{let e=await this.appEvent({type:h.$0.APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS});return this.persistSmartAccountEnabledNetworks(e.smartAccountEnabledNetworks),e}catch(e){throw this.persistSmartAccountEnabledNetworks([]),this.w3mLogger?.logger.error({error:e},"Error getting smart account enabled networks"),e}}async setPreferredAccount(e){try{return this.appEvent({type:h.$0.APP_SET_PREFERRED_ACCOUNT,payload:{type:e}})}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error setting preferred account"),e}}async connect(e){try{let t=e?.chainId||this.getLastUsedChainId()||1,r=await this.appEvent({type:h.$0.APP_GET_USER,payload:{...e,chainId:t}});return this.setLoginSuccess(r.email),this.setLastUsedChainId(r.chainId),this.user=r,r}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error connecting"),e}}async getUser(e){try{let t=e?.chainId||this.getLastUsedChainId()||1,r=await this.appEvent({type:h.$0.APP_GET_USER,payload:{...e,chainId:t}});return this.user=r,r}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error connecting"),e}}async connectSocial(e){try{this.w3mFrame.initFrame();let t=await this.appEvent({type:h.$0.APP_CONNECT_SOCIAL,payload:{uri:e}});return t.userName&&this.setSocialLoginSuccess(t.userName),t}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error connecting social"),e}}async getFarcasterUri(){try{return this.w3mFrame.initFrame(),await this.appEvent({type:h.$0.APP_GET_FARCASTER_URI})}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error getting farcaster uri"),e}}async connectFarcaster(){try{let e=await this.appEvent({type:h.$0.APP_CONNECT_FARCASTER});return e.userName&&this.setSocialLoginSuccess(e.userName),e}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error connecting farcaster"),e}}async switchNetwork(e){try{let t=await this.appEvent({type:h.$0.APP_SWITCH_NETWORK,payload:{chainId:e}});return this.setLastUsedChainId(t.chainId),t}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error switching network"),e}}async disconnect(){try{let e=await this.appEvent({type:h.$0.APP_SIGN_OUT});return this.deleteAuthLoginCache(),e}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error disconnecting"),e}}async request(e){try{if(h.y_.GET_CHAIN_ID===e.method)return this.getLastUsedChainId();this.rpcRequestHandler?.(e);let t=await this.appEvent({type:h.$0.APP_RPC_REQUEST,payload:e});return this.rpcSuccessHandler?.(t,e),t}catch(t){throw this.rpcErrorHandler?.(t,e),this.w3mLogger?.logger.error({error:t},"Error requesting"),t}}onRpcRequest(e){this.rpcRequestHandler=e}onRpcSuccess(e){this.rpcSuccessHandler=e}onRpcError(e){this.rpcErrorHandler=e}onIsConnected(e){this.w3mFrame.events.onFrameEvent(t=>{t.type===h.$0.FRAME_IS_CONNECTED_SUCCESS&&t.payload.isConnected&&e()})}onNotConnected(e){this.w3mFrame.events.onFrameEvent(t=>{t.type===h.$0.FRAME_IS_CONNECTED_ERROR&&e(),t.type!==h.$0.FRAME_IS_CONNECTED_SUCCESS||t.payload.isConnected||e()})}onConnect(e){this.w3mFrame.events.onFrameEvent(t=>{t.type===h.$0.FRAME_GET_USER_SUCCESS&&e(t.payload)})}onSocialConnected(e){this.w3mFrame.events.onFrameEvent(t=>{t.type===h.$0.FRAME_CONNECT_SOCIAL_SUCCESS&&e(t.payload)})}async getCapabilities(){try{return await this.request({method:"wallet_getCapabilities"})||{}}catch{return{}}}onSetPreferredAccount(e){this.w3mFrame.events.onFrameEvent(t=>{t.type===h.$0.FRAME_SET_PREFERRED_ACCOUNT_SUCCESS?e(t.payload):t.type===h.$0.FRAME_SET_PREFERRED_ACCOUNT_ERROR&&e({type:h.y_.ACCOUNT_TYPES.EOA})})}onGetSmartAccountEnabledNetworks(e){this.w3mFrame.events.onFrameEvent(t=>{t.type===h.$0.FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS?e(t.payload.smartAccountEnabledNetworks):t.type===h.$0.FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR&&e([])})}getAvailableChainIds(){return Object.keys(this.w3mFrame.networks)}rejectRpcRequests(){try{this.openRpcRequests.forEach(({abortController:e,method:t})=>{h.y_.SAFE_RPC_METHODS.includes(t)||e.abort()}),this.openRpcRequests=[]}catch(e){this.w3mLogger?.logger.error({error:e},"Error aborting RPC request")}}async appEvent(e){let t;function r(e){return e.replace("@w3m-app/","")}await this.w3mFrame.frameLoadPromise;let i=new AbortController,n=r(e.type);return[h.$0.APP_CONNECT_EMAIL,h.$0.APP_CONNECT_DEVICE,h.$0.APP_CONNECT_OTP,h.$0.APP_CONNECT_SOCIAL,h.$0.APP_GET_SOCIAL_REDIRECT_URI].map(r).includes(n)&&(t=setTimeout(()=>{this.onTimeout?.(),i.abort()},3e4)),new Promise((r,s)=>{let a=Math.random().toString(36).substring(7);this.w3mLogger?.logger.info?.({event:e,id:a},"Sending app event"),this.w3mFrame.events.postAppEvent({...e,id:a}),"RPC_REQUEST"===n&&(this.openRpcRequests=[...this.openRpcRequests,{...e.payload,abortController:i}]),i.signal.addEventListener("abort",()=>{"RPC_REQUEST"===n?s(Error("Request was aborted")):"GET_FARCASTER_URI"!==n&&s(Error("Something went wrong"))}),this.w3mFrame.events.registerFrameEventHandler(a,e=>{var i;return i=this.w3mLogger,void(e.id===a&&(i?.logger.info?.({framEvent:e,id:a},"Received frame response"),e.type===`@w3m-frame/${n}_SUCCESS`?(t&&clearTimeout(t),"payload"in e&&r(e.payload),r(void 0)):e.type===`@w3m-frame/${n}_ERROR`&&(t&&clearTimeout(t),"payload"in e&&s(Error(e.payload?.message||"An error occurred")),s(Error("An error occurred")))))},i.signal)})}setNewLastEmailLoginTime(){rv.e.set(h.$0.LAST_EMAIL_LOGIN_TIME,Date.now().toString())}setSocialLoginSuccess(e){rv.e.set(h.$0.SOCIAL_USERNAME,e)}setLoginSuccess(e){e&&rv.e.set(h.$0.EMAIL,e),rv.e.set(h.$0.EMAIL_LOGIN_USED_KEY,"true"),rv.e.delete(h.$0.LAST_EMAIL_LOGIN_TIME)}deleteAuthLoginCache(){rv.e.delete(h.$0.EMAIL_LOGIN_USED_KEY),rv.e.delete(h.$0.EMAIL),rv.e.delete(h.$0.LAST_USED_CHAIN_KEY),rv.e.delete(h.$0.SOCIAL_USERNAME)}setLastUsedChainId(e){e&&rv.e.set(h.$0.LAST_USED_CHAIN_KEY,String(e))}getLastUsedChainId(){let e=rv.e.get(h.$0.LAST_USED_CHAIN_KEY)??void 0,t=Number(e);return isNaN(t)?e:t}persistSmartAccountEnabledNetworks(e){rv.e.set(h.$0.SMART_ACCOUNT_ENABLED_NETWORKS,e.join(","))}}class rE{constructor(){}static getInstance({projectId:e,chainId:t,enableLogger:r,onTimeout:i}){return rE.instance||(rE.instance=new rA({projectId:e,chainId:t,enableLogger:r,onTimeout:i})),rE.instance}}},65145:function(e,t,r){"use strict";r.d(t,{b:function(){return J}});var i=r(68314),n=r(45374),s=r(33734),a=r(6307),o=r(51440),c=r(47205),l=r(48113),u=r(83966),d=r(46313),h=r(77500),f=r(83241),p=r(12858),g=r(64125),m=r(56008),b=r(99013);let y={getCaipTokens(e){if(!e)return;let t={};return Object.entries(e).forEach(([e,r])=>{t[`${b.b.EIP155}:${e}`]=r}),t},isLowerCaseMatch:(e,t)=>e?.toLowerCase()===t?.toLowerCase()};var w=r(9681),v=r(86949),A=r(73932);let E={eip155:void 0,solana:void 0,polkadot:void 0,bip122:void 0},C=(0,v.sj)({providers:{...E},providerIds:{...E}}),_={state:C,subscribeKey:(e,t)=>(0,A.VW)(C,e,t),subscribeProviders:e=>(0,v.Ld)(C.providers,()=>e(C.providers)),setProvider(e,t){t&&(C.providers[e]=(0,v.iH)(t))},getProvider:e=>C.providers[e],setProviderId(e,t){t&&(C.providerIds[e]=t)},getProviderId(e){if(e)return C.providerIds[e]},reset(){C.providers={...E},C.providerIds={...E}},resetChain(e){C.providers[e]=void 0,C.providerIds[e]=void 0}};var I=r(19445),S=r(22192),N=r(58518),T=r(58269);let P={validateCaipAddress(e){if(e.split(":")?.length!==3)throw Error("Invalid CAIP Address");return e},parseCaipAddress(e){let t=e.split(":");if(3!==t.length)throw Error(`Invalid CAIP-10 address: ${e}`);let[r,i,n]=t;if(!r||!i||!n)throw Error(`Invalid CAIP-10 address: ${e}`);return{chainNamespace:r,chainId:i,address:n}},parseCaipNetworkId(e){let t=e.split(":");if(2!==t.length)throw Error(`Invalid CAIP-2 network id: ${e}`);let[r,i]=t;if(!r||!i)throw Error(`Invalid CAIP-2 network id: ${e}`);return{chainNamespace:r,chainId:i}}};var x=r(27777),O=r(66691),R=r(83662),k=r(26258),D=r(44639),M=r(51090),U=r(82879),L=r(4511);r(11697),r(72134);var B=r(32786),j=r(28740),$=r(26149),F=r(12044);let q={createLogger(e,t="error"){let r=(0,F.jI)({level:t}),{logger:i}=(0,F.Rt)({opts:r});return i.error=(...t)=>{for(let r of t)if(r instanceof Error){e(r,...t);return}e(void 0,...t)},i}};var z=function(e){if(e.length>=255)throw TypeError("Alphabet too long");let t=new Uint8Array(256);for(let e=0;e>>0,l=new Uint8Array(c);for(;e[s];){let i=t[e.charCodeAt(s)];if(255===i)return;let n=0;for(let e=c-1;(0!==i||n>>0,l[e]=i%256>>>0,i=i/256>>>0;if(0!==i)throw Error("Non-zero carry");o=n,s++}let u=c-o;for(;u!==c&&0===l[u];)u++;let d=new Uint8Array(a+(c-u)),h=a;for(;u!==c;)d[h++]=l[u++];return d}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError("Expected Uint8Array");if(0===t.length)return"";let n=0,a=0,o=0,c=t.length;for(;o!==c&&0===t[o];)o++,n++;let l=(c-o)*s+1>>>0,u=new Uint8Array(l);for(;o!==c;){let e=t[o],i=0;for(let t=l-1;(0!==e||i>>0,u[t]=e%r>>>0,e=e/r>>>0;if(0!==e)throw Error("Non-zero carry");a=i,o++}let d=l-a;for(;d!==l&&0===u[d];)d++;let h=i.repeat(n);for(;d{let[,,t]=e.split(":");return t}).filter((e,t,r)=>r.indexOf(e)===t)||[]).map(t=>f.j.createAccount(e,t,"bip122"===e?"payment":"eoa"))})}async syncConnectors(){return Promise.resolve()}async getBalance(e){if(!(e.caipNetwork&&c.bq.BALANCE_SUPPORTED_CHAINS.includes(e.caipNetwork?.chainNamespace))||e.caipNetwork?.testnet)return{balance:"0.00",symbol:e.caipNetwork?.nativeCurrency.symbol||""};if(u.AccountController.state.balanceLoading&&e.chainId===d.R.state.activeCaipNetwork?.id)return{balance:u.AccountController.state.balance||"0.00",symbol:u.AccountController.state.balanceSymbol||""};let t=(await u.AccountController.fetchTokenBalance()).find(t=>t.chainId===`${e.caipNetwork?.chainNamespace}:${e.chainId}`&&t.symbol===e.caipNetwork?.nativeCurrency.symbol);return{balance:t?.quantity.numeric||"0.00",symbol:t?.symbol||e.caipNetwork?.nativeCurrency.symbol||""}}async signMessage(e){let{provider:t,message:r,address:n}=e;if(!t)throw Error("UniversalAdapter:signMessage - provider is undefined");return{signature:d.R.state.activeCaipNetwork?.chainNamespace===i.b.CHAIN.SOLANA?(await t.request({method:"solana_signMessage",params:{message:z.encode(new TextEncoder().encode(r)),pubkey:n}},d.R.state.activeCaipNetwork?.caipNetworkId)).signature:await t.request({method:"personal_sign",params:[r,n]},d.R.state.activeCaipNetwork?.caipNetworkId)}}async estimateGas(){return Promise.resolve({gas:BigInt(0)})}async getProfile(){return Promise.resolve({profileImage:"",profileName:""})}async sendTransaction(){return Promise.resolve({hash:""})}walletGetAssets(e){return Promise.resolve({})}async writeContract(){return Promise.resolve({hash:""})}async getEnsAddress(){return Promise.resolve({address:!1})}parseUnits(){return 0n}formatUnits(){return"0"}async getCapabilities(){return Promise.resolve({})}async grantPermissions(){return Promise.resolve({})}async revokePermissions(){return Promise.resolve("0x")}async syncConnection(){return Promise.resolve({id:"WALLET_CONNECT",type:"WALLET_CONNECT",chainId:1,provider:this.provider,address:""})}async switchNetwork(e){let{caipNetwork:t}=e,r=this.getWalletConnectConnector();if(t.chainNamespace===i.b.CHAIN.EVM)try{await r.provider?.request({method:"wallet_switchEthereumChain",params:[{chainId:H.NC(t.id)}]})}catch(e){if(e.code===G.T.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||e.code===G.T.ERROR_INVALID_CHAIN_ID||e.code===G.T.ERROR_CODE_DEFAULT||e?.data?.originalError?.code===G.T.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)try{await r.provider?.request({method:"wallet_addEthereumChain",params:[{chainId:H.NC(t.id),rpcUrls:[t?.rpcUrls.chainDefault?.http],chainName:t.name,nativeCurrency:t.nativeCurrency,blockExplorerUrls:[t.blockExplorers?.default.url]}]})}catch(e){throw Error("Chain is not supported")}}r.provider.setDefaultChain(t.caipNetworkId)}getWalletConnectProvider(){let e=this.connectors.find(e=>"WALLET_CONNECT"===e.type);return e?.provider}}var Q=r(52814);class Y{constructor(e){this.chainNamespaces=[],this.reportedAlertErrors={},this.getCaipNetwork=e=>e?d.R.getNetworkData(e)?.caipNetwork||d.R.getRequestedCaipNetworks(e).filter(t=>t.chainNamespace===e)?.[0]:d.R.state.activeCaipNetwork||this.defaultCaipNetwork,this.getCaipNetworkId=()=>{let e=this.getCaipNetwork();if(e)return e.id},this.getCaipNetworks=e=>d.R.getRequestedCaipNetworks(e),this.getActiveChainNamespace=()=>d.R.state.activeChain,this.setRequestedCaipNetworks=(e,t)=>{d.R.setRequestedCaipNetworks(e,t)},this.getApprovedCaipNetworkIds=()=>d.R.getAllApprovedCaipNetworkIds(),this.getCaipAddress=e=>d.R.state.activeChain!==e&&e?d.R.getAccountProp("caipAddress",e):d.R.state.activeCaipAddress,this.setClientId=e=>{O.L.setClientId(e)},this.getProvider=e=>_.getProvider(e),this.getProviderType=e=>_.getProviderId(e),this.getPreferredAccountType=()=>u.AccountController.state.preferredAccountType,this.setCaipAddress=(e,t)=>{u.AccountController.setCaipAddress(e,t)},this.setBalance=(e,t,r)=>{u.AccountController.setBalance(e,t,r)},this.setProfileName=(e,t)=>{u.AccountController.setProfileName(e,t)},this.setProfileImage=(e,t)=>{u.AccountController.setProfileImage(e,t)},this.setUser=(e,t)=>{u.AccountController.setUser(e,t),h.OptionsController.state.enableEmbedded&&R.I.close()},this.resetAccount=e=>{u.AccountController.resetAccount(e)},this.setCaipNetwork=e=>{d.R.setActiveCaipNetwork(e)},this.setCaipNetworkOfNamespace=(e,t)=>{d.R.setChainNetworkData(t,{caipNetwork:e})},this.setAllAccounts=(e,t)=>{u.AccountController.setAllAccounts(e,t),h.OptionsController.setHasMultipleAddresses(e?.length>1)},this.setStatus=(e,t)=>{u.AccountController.setStatus(e,t),s.ConnectorController.isConnected()?g.M.setConnectionStatus("connected"):g.M.setConnectionStatus("disconnected")},this.getAddressByChainNamespace=e=>d.R.getAccountProp("address",e),this.setConnectors=e=>{let t=[...s.ConnectorController.getConnectors(),...e];s.ConnectorController.setConnectors(t)},this.fetchIdentity=e=>O.L.fetchIdentity(e),this.getReownName=e=>k.a.getNamesForAddress(e),this.getConnectors=()=>s.ConnectorController.getConnectors(),this.getConnectorImage=e=>D.f.getConnectorImage(e),this.setConnectedWalletInfo=(e,t)=>{let r=_.getProviderId(t),i=e?{...e,type:r}:void 0;u.AccountController.setConnectedWalletInfo(i,t)},this.getIsConnectedState=()=>!!d.R.state.activeCaipAddress,this.addAddressLabel=(e,t,r)=>{u.AccountController.addAddressLabel(e,t,r)},this.removeAddressLabel=(e,t)=>{u.AccountController.removeAddressLabel(e,t)},this.getAddress=e=>d.R.state.activeChain!==e&&e?d.R.getAccountProp("address",e):u.AccountController.state.address,this.setApprovedCaipNetworksData=e=>d.R.setApprovedCaipNetworksData(e),this.resetNetwork=e=>{d.R.resetNetwork(e)},this.addConnector=e=>{s.ConnectorController.addConnector(e)},this.resetWcConnection=()=>{a.ConnectionController.resetWcConnection()},this.setAddressExplorerUrl=(e,t)=>{u.AccountController.setAddressExplorerUrl(e,t)},this.setSmartAccountDeployed=(e,t)=>{u.AccountController.setSmartAccountDeployed(e,t)},this.setSmartAccountEnabledNetworks=(e,t)=>{d.R.setSmartAccountEnabledNetworks(e,t)},this.setPreferredAccountType=(e,t)=>{u.AccountController.setPreferredAccountType(e,t)},this.setEIP6963Enabled=e=>{h.OptionsController.setEIP6963Enabled(e)},this.handleUnsafeRPCRequest=()=>{this.isOpen()?this.isTransactionStackEmpty()||this.redirect("ApproveTransaction"):this.open({view:"ApproveTransaction"})},this.options=e,this.version=e.sdkVersion,this.caipNetworks=this.extendCaipNetworks(e),this.chainNamespaces=[...new Set(this.caipNetworks?.map(e=>e.chainNamespace))],this.defaultCaipNetwork=this.extendDefaultCaipNetwork(e),this.chainAdapters=this.createAdapters(e.adapters),this.initialize(e),this.sendInitializeEvent(e)}async initialize(e){this.initControllers(e),await this.initChainAdapters(),await this.injectModalUi(),await this.syncExistingConnection(),M.I.set({initialized:!0})}sendInitializeEvent(e){let{...t}=e;delete t.adapters,o.X.sendEvent({type:"track",event:"INITIALIZE",properties:{...t,networks:e.networks.map(e=>e.id),siweConfig:{options:e.siweConfig?.options||{}}}})}initControllers(e){this.initializeOptionsController(e),this.initializeChainController(e),this.initializeThemeController(e),this.initializeConnectionController(e),this.initializeConnectorController()}initializeThemeController(e){e.themeMode&&p.ThemeController.setThemeMode(e.themeMode),e.themeVariables&&p.ThemeController.setThemeVariables(e.themeVariables)}initializeChainController(e){if(!this.connectionControllerClient||!this.networkControllerClient)throw Error("ConnectionControllerClient and NetworkControllerClient must be set");d.R.initialize(e.adapters??[],this.caipNetworks,{connectionControllerClient:this.connectionControllerClient,networkControllerClient:this.networkControllerClient});let t=this.getDefaultNetwork();t&&d.R.setActiveCaipNetwork(t)}initializeConnectionController(e){a.ConnectionController.setWcBasic(e.basic??!1)}initializeConnectorController(){s.ConnectorController.initialize(this.chainNamespaces)}initializeOptionsController(e){h.OptionsController.setDebug(!1!==e.debug),h.OptionsController.setEnableWalletConnect(!1!==e.enableWalletConnect),h.OptionsController.setEnableWalletGuide(!1!==e.enableWalletGuide),h.OptionsController.setEnableWallets(!1!==e.enableWallets),h.OptionsController.setEIP6963Enabled(!1!==e.enableEIP6963),h.OptionsController.setEnableAuthLogger(!1!==e.enableAuthLogger),h.OptionsController.setCustomRpcUrls(e.customRpcUrls),h.OptionsController.setSdkVersion(e.sdkVersion),h.OptionsController.setProjectId(e.projectId),h.OptionsController.setEnableEmbedded(e.enableEmbedded),h.OptionsController.setAllWallets(e.allWallets),h.OptionsController.setIncludeWalletIds(e.includeWalletIds),h.OptionsController.setExcludeWalletIds(e.excludeWalletIds),h.OptionsController.setFeaturedWalletIds(e.featuredWalletIds),h.OptionsController.setTokens(e.tokens),h.OptionsController.setTermsConditionsUrl(e.termsConditionsUrl),h.OptionsController.setPrivacyPolicyUrl(e.privacyPolicyUrl),h.OptionsController.setCustomWallets(e.customWallets),h.OptionsController.setFeatures(e.features),h.OptionsController.setAllowUnsupportedChain(e.allowUnsupportedChain),h.OptionsController.setDefaultAccountTypes(e.defaultAccountTypes);let t=this.getDefaultMetaData();if(!e.metadata&&t&&(e.metadata=t),h.OptionsController.setMetadata(e.metadata),h.OptionsController.setDisableAppend(e.disableAppend),h.OptionsController.setEnableEmbedded(e.enableEmbedded),h.OptionsController.setSIWX(e.siwx),!e.projectId){m.AlertController.open(w.j.ALERT_ERRORS.PROJECT_ID_NOT_CONFIGURED,"error");return}if(e.adapters?.find(e=>e.namespace===i.b.CHAIN.EVM)&&e.siweConfig){if(e.siwx)throw Error("Cannot set both `siweConfig` and `siwx` options");h.OptionsController.setSIWX(e.siweConfig.mapToSIWX())}}getDefaultMetaData(){return"undefined"!=typeof window&&"undefined"!=typeof document?{name:document.getElementsByTagName("title")?.[0]?.textContent||"",description:document.querySelector('meta[property="og:description"]')?.content||"",url:window.location.origin,icons:[document.querySelector('link[rel~="icon"]')?.href||""]}:null}getUnsupportedNetwork(e){return{id:e.split(":")[1],caipNetworkId:e,name:i.b.UNSUPPORTED_NETWORK_NAME,chainNamespace:e.split(":")[0],nativeCurrency:{name:"",decimals:0,symbol:""},rpcUrls:{default:{http:[]}}}}setUnsupportedNetwork(e){let t=this.getActiveChainNamespace();if(t){let r=this.getUnsupportedNetwork(`${t}:${e}`);d.R.setActiveCaipNetwork(r)}}getDefaultNetwork(){let e=g.M.getActiveCaipNetworkId();return e?this.caipNetworks?.find(t=>t.caipNetworkId===e)||(this.defaultCaipNetwork?this.defaultCaipNetwork:this.getUnsupportedNetwork(e)):this.defaultCaipNetwork?this.defaultCaipNetwork:this.caipNetworks?.[0]}extendCaipNetwork(e,t){return $.f.extendCaipNetwork(e,{customNetworkImageUrls:t.chainImages,projectId:t.projectId})}extendCaipNetworks(e){return $.f.extendCaipNetworks(e.networks,{customNetworkImageUrls:e.chainImages,customRpcUrls:e.customRpcUrls,projectId:e.projectId})}extendDefaultCaipNetwork(e){let t=e.networks.find(t=>t.id===e.defaultNetwork?.id);return t?$.f.extendCaipNetwork(t,{customNetworkImageUrls:e.chainImages,customRpcUrls:e.customRpcUrls,projectId:e.projectId}):void 0}createClients(){this.connectionControllerClient={connectWalletConnect:async()=>{let e=d.R.state.activeChain,t=this.getAdapter(e),r=this.getCaipNetwork(e)?.id;if(!t)throw Error("Adapter not found");let i=await t.connectWalletConnect(r);this.close(),this.setClientId(i?.clientId||null),g.M.setConnectedNamespaces([...d.R.state.chains.keys()]),this.chainNamespaces.forEach(e=>{s.ConnectorController.setConnectorId(b.b.CONNECTOR_TYPE_WALLET_CONNECT,e)}),await this.syncWalletConnectAccount()},connectExternal:async({id:e,info:t,type:r,provider:i,chain:n,caipNetwork:s})=>{let a=d.R.state.activeChain,o=n||a,c=this.getAdapter(o);if(n&&n!==a&&!s){let e=this.caipNetworks?.find(e=>e.chainNamespace===n);e&&this.setCaipNetwork(e)}if(!c)throw Error("Adapter not found");let l=this.getCaipNetwork(o),u=await c.connect({id:e,info:t,type:r,provider:i,chainId:s?.id||l?.id,rpcUrl:s?.rpcUrls?.default?.http?.[0]||l?.rpcUrls?.default?.http?.[0]});if(!u)return;g.M.addConnectedNamespace(o),this.syncProvider({...u,chainNamespace:o}),await this.syncAccount({...u,chainNamespace:o});let{accounts:h}=await c.getAccounts({namespace:o,id:e});this.setAllAccounts(h,o)},reconnectExternal:async({id:e,info:t,type:r,provider:i})=>{let n=d.R.state.activeChain,s=this.getAdapter(n);s?.reconnect&&(await s?.reconnect({id:e,info:t,type:r,provider:i,chainId:this.getCaipNetwork()?.id}),g.M.addConnectedNamespace(n))},disconnect:async e=>{let t=e||d.R.state.activeChain,r=this.getAdapter(t),i=_.getProvider(t),n=_.getProviderId(t);await r?.disconnect({provider:i,providerType:n}),g.M.removeConnectedNamespace(t),_.resetChain(t),this.setUser(void 0,t),this.setStatus("disconnected",t)},checkInstalled:e=>e?e.some(e=>!!window.ethereum?.[String(e)]):!!window.ethereum,signMessage:async e=>{let t=this.getAdapter(d.R.state.activeChain),r=await t?.signMessage({message:e,address:u.AccountController.state.address,provider:_.getProvider(d.R.state.activeChain)});return r?.signature||""},sendTransaction:async e=>{if(e.chainNamespace===i.b.CHAIN.EVM){let t=this.getAdapter(d.R.state.activeChain),r=_.getProvider(d.R.state.activeChain),i=await t?.sendTransaction({...e,provider:r});return i?.hash||""}return""},estimateGas:async e=>{if(e.chainNamespace===i.b.CHAIN.EVM){let t=this.getAdapter(d.R.state.activeChain),r=_.getProvider(d.R.state.activeChain),i=this.getCaipNetwork();if(!i)throw Error("CaipNetwork is undefined");let n=await t?.estimateGas({...e,provider:r,caipNetwork:i});return n?.gas||0n}return 0n},getEnsAvatar:async()=>{let e=this.getAdapter(d.R.state.activeChain),t=await e?.getProfile({address:u.AccountController.state.address,chainId:Number(this.getCaipNetwork()?.id)});return t?.profileImage||!1},getEnsAddress:async e=>{let t=this.getAdapter(d.R.state.activeChain),r=this.getCaipNetwork();if(!r)return!1;let i=await t?.getEnsAddress({name:e,caipNetwork:r});return i?.address||!1},writeContract:async e=>{let t=this.getAdapter(d.R.state.activeChain),r=this.getCaipNetwork(),i=this.getCaipAddress(),n=_.getProvider(d.R.state.activeChain);if(!r||!i)throw Error("CaipNetwork or CaipAddress is undefined");let s=await t?.writeContract({...e,caipNetwork:r,provider:n,caipAddress:i});return s?.hash},parseUnits:(e,t)=>{let r=this.getAdapter(d.R.state.activeChain);return r?.parseUnits({value:e,decimals:t})??0n},formatUnits:(e,t)=>{let r=this.getAdapter(d.R.state.activeChain);return r?.formatUnits({value:e,decimals:t})??"0"},getCapabilities:async e=>{let t=this.getAdapter(d.R.state.activeChain);return await t?.getCapabilities(e)},grantPermissions:async e=>{let t=this.getAdapter(d.R.state.activeChain);return await t?.grantPermissions(e)},revokePermissions:async e=>{let t=this.getAdapter(d.R.state.activeChain);return t?.revokePermissions?await t.revokePermissions(e):"0x"},walletGetAssets:async e=>{let t=this.getAdapter(d.R.state.activeChain);return await t?.walletGetAssets(e)??{}}},this.networkControllerClient={switchCaipNetwork:async e=>await this.switchCaipNetwork(e),getApprovedCaipNetworksData:async()=>this.getApprovedCaipNetworksData()},a.ConnectionController.setClient(this.connectionControllerClient)}getApprovedCaipNetworksData(){if(_.getProviderId(d.R.state.activeChain)===b.b.CONNECTOR_TYPE_WALLET_CONNECT){let e=this.universalProvider?.session?.namespaces;return{supportsAllNetworks:this.universalProvider?.session?.peer?.metadata.name==="MetaMask Wallet",approvedCaipNetworkIds:this.getChainsFromNamespaces(e)}}return{supportsAllNetworks:!0,approvedCaipNetworkIds:[]}}async switchCaipNetwork(e){if(!e)return;let t=e.chainNamespace;if(this.getAddressByChainNamespace(e.chainNamespace)){let r=_.getProvider(t),i=_.getProviderId(t);if(e.chainNamespace===d.R.state.activeChain){let n=this.getAdapter(t);await n?.switchNetwork({caipNetwork:e,provider:r,providerType:i})}else if(this.setCaipNetwork(e),i===b.b.CONNECTOR_TYPE_WALLET_CONNECT)this.syncWalletConnectAccount();else{let r=this.getAddressByChainNamespace(t);r&&this.syncAccount({address:r,chainId:e.id,chainNamespace:t})}}else this.setCaipNetwork(e)}getChainsFromNamespaces(e={}){return Object.values(e).flatMap(e=>Array.from(new Set([...e.chains||[],...e.accounts.map(e=>{let{chainId:t,chainNamespace:r}=P.parseCaipAddress(e);return`${r}:${t}`})])))}createAdapters(e){return this.createClients(),this.chainNamespaces.reduce((t,r)=>{let i=e?.find(e=>e.namespace===r);return i?(t[r]=i,t[r].namespace=r,t[r].construct({namespace:r,projectId:this.options?.projectId,networks:this.caipNetworks})):t[r]=new K({namespace:r,networks:this.caipNetworks}),t},{})}async initChainAdapter(e){this.onConnectors(e),this.listenAdapter(e),this.chainAdapters?.[e].syncConnectors(this.options,this),await this.createUniversalProviderForAdapter(e)}async initChainAdapters(){await Promise.all(this.chainNamespaces.map(async e=>{await this.initChainAdapter(e)}))}onConnectors(e){let t=this.getAdapter(e);t?.on("connectors",this.setConnectors.bind(this))}listenAdapter(e){let t=this.getAdapter(e);if(!t)return;let r=g.M.getConnectionStatus();"connected"===r?this.setStatus("connecting",e):("disconnected"===r&&g.M.clearAddressCache(),this.setStatus(r,e)),t.on("switchNetwork",({address:t,chainId:r})=>{let i=this.caipNetworks?.find(e=>e.id===r||e.caipNetworkId===r),n=d.R.state.activeChain===e,s=d.R.getAccountProp("address",e);if(i){let i=n&&t?t:s;i&&this.syncAccount({address:i,chainId:r,chainNamespace:e})}else this.setUnsupportedNetwork(r)}),t.on("disconnect",this.disconnect.bind(this,e)),t.on("pendingTransactions",()=>{let e=u.AccountController.state.address,t=d.R.state.activeCaipNetwork;e&&t?.id&&this.updateNativeBalance(e,t.id,t.chainNamespace)}),t.on("accountChanged",({address:t,chainId:r})=>{let i=d.R.state.activeChain===e;i&&r?this.syncAccount({address:t,chainId:r,chainNamespace:e}):i&&d.R.state.activeCaipNetwork?.id?this.syncAccount({address:t,chainId:d.R.state.activeCaipNetwork?.id,chainNamespace:e}):this.syncAccountInfo(t,r,e)})}async createUniversalProviderForAdapter(e){await this.getUniversalProvider(),this.universalProvider&&this.chainAdapters?.[e]?.setUniversalProvider?.(this.universalProvider)}async syncExistingConnection(){await Promise.allSettled(this.chainNamespaces.map(e=>this.syncNamespaceConnection(e)))}async syncNamespaceConnection(e){try{let t=s.ConnectorController.getConnectorId(e);switch(this.setStatus("connecting",e),t){case i.b.CONNECTOR_ID.WALLET_CONNECT:await this.syncWalletConnectAccount();break;case i.b.CONNECTOR_ID.AUTH:break;default:await this.syncAdapterConnection(e)}}catch(t){console.warn("AppKit couldn't sync existing connection",t),this.setStatus("disconnected",e)}}async syncAdapterConnection(e){let t=this.getAdapter(e),r=s.ConnectorController.getConnectorId(e),i=this.getCaipNetwork(e),n=s.ConnectorController.getConnectors(e).find(e=>e.id===r);try{if(!t||!n)throw Error(`Adapter or connector not found for namespace ${e}`);if(!i?.id)throw Error("CaipNetwork not found");let r=await t?.syncConnection({namespace:e,id:n.id,chainId:i.id,rpcUrl:i?.rpcUrls?.default?.http?.[0]});if(r){let i=await t?.getAccounts({namespace:e,id:n.id});i&&i.accounts.length>0?this.setAllAccounts(i.accounts,e):this.setAllAccounts([f.j.createAccount(e,r.address,"eoa")],e),this.syncProvider({...r,chainNamespace:e}),await this.syncAccount({...r,chainNamespace:e}),this.setStatus("connected",e)}else this.setStatus("disconnected",e)}catch(t){this.setStatus("disconnected",e)}}async syncWalletConnectAccount(){let e=this.chainNamespaces.map(async e=>{let t=this.getAdapter(e),r=this.universalProvider?.session?.namespaces?.[e]?.accounts||[],n=d.R.state.activeCaipNetwork?.id,a=r.find(e=>{let{chainId:t}=P.parseCaipAddress(e);return t===n?.toString()})||r[0];if(a){let r=P.validateCaipAddress(a),{chainId:n,address:o}=P.parseCaipAddress(r);if(_.setProviderId(e,b.b.CONNECTOR_TYPE_WALLET_CONNECT),this.caipNetworks&&d.R.state.activeCaipNetwork&&t?.namespace!==i.b.CHAIN.EVM){let r=t?.getWalletConnectProvider({caipNetworks:this.caipNetworks,provider:this.universalProvider,activeCaipNetwork:d.R.state.activeCaipNetwork});_.setProvider(e,r)}else _.setProvider(e,this.universalProvider);s.ConnectorController.setConnectorId(i.b.CONNECTOR_ID.WALLET_CONNECT,e),g.M.addConnectedNamespace(e),this.syncWalletConnectAccounts(e),await this.syncAccount({address:o,chainId:n,chainNamespace:e})}else this.setStatus("disconnected",e);await d.R.setApprovedCaipNetworksData(e)});await Promise.all(e)}syncWalletConnectAccounts(e){let t=this.universalProvider?.session?.namespaces?.[e]?.accounts?.map(e=>{let{address:t}=P.parseCaipAddress(e);return t}).filter((e,t,r)=>r.indexOf(e)===t);t&&this.setAllAccounts(t.map(t=>f.j.createAccount(e,t,"bip122"===e?"payment":"eoa")),e)}syncProvider({type:e,provider:t,id:r,chainNamespace:i}){_.setProviderId(i,e),_.setProvider(i,t),s.ConnectorController.setConnectorId(r,i)}async syncAccount(e){let t=e.chainNamespace===d.R.state.activeChain,r=d.R.getCaipNetworkByNamespace(e.chainNamespace,e.chainId),{address:n,chainId:s,chainNamespace:a}=e,{chainId:o}=g.M.getActiveNetworkProps(),c=s||o,l=d.R.state.activeCaipNetwork?.name===i.b.UNSUPPORTED_NETWORK_NAME,f=d.R.getNetworkProp("supportsAllNetworks",a);if(this.setStatus("connected",a),(!l||f)&&c){let e=this.caipNetworks?.find(e=>e.id.toString()===c.toString()),s=this.caipNetworks?.find(e=>e.chainNamespace===a);if(!f&&!e&&!s){let t=this.getApprovedCaipNetworkIds()||[],r=t.find(e=>P.parseCaipNetworkId(e)?.chainId===c.toString()),i=t.find(e=>P.parseCaipNetworkId(e)?.chainNamespace===a);e=this.caipNetworks?.find(e=>e.caipNetworkId===r),s=this.caipNetworks?.find(e=>e.caipNetworkId===i||"deprecatedCaipNetworkId"in e&&e.deprecatedCaipNetworkId===i)}let o=e||s;o?.chainNamespace===d.R.state.activeChain?h.OptionsController.state.allowUnsupportedChain||d.R.state.activeCaipNetwork?.name!==i.b.UNSUPPORTED_NETWORK_NAME?this.setCaipNetwork(o):d.R.showUnsupportedChainUI():!t&&r&&this.setCaipNetworkOfNamespace(r,a),this.syncConnectedWalletInfo(a),y.isLowerCaseMatch(n,u.AccountController.state.address)||this.syncAccountInfo(n,o?.id,a),t?await this.syncBalance({address:n,chainId:o?.id,chainNamespace:a}):await this.syncBalance({address:n,chainId:r?.id,chainNamespace:a})}}async syncAccountInfo(e,t,r){let i=this.getCaipAddress(r),n=t||i?.split(":")[1];if(!n)return;let s=`${r}:${n}:${e}`;this.setCaipAddress(s,r),await this.syncIdentity({address:e,chainId:n,chainNamespace:r})}async syncReownName(e,t){try{let r=await this.getReownName(e);if(r[0]){let e=r[0];this.setProfileName(e.name,t)}else this.setProfileName(null,t)}catch{this.setProfileName(null,t)}}syncConnectedWalletInfo(e){let t=s.ConnectorController.getConnectorId(e),r=_.getProviderId(e);if(r===b.b.CONNECTOR_TYPE_ANNOUNCED||r===b.b.CONNECTOR_TYPE_INJECTED){if(t){let r=this.getConnectors().find(e=>e.id===t);if(r){let{info:t,name:i,imageUrl:n}=r,s=n||this.getConnectorImage(r);this.setConnectedWalletInfo({name:i,icon:s,...t},e)}}}else if(r===b.b.CONNECTOR_TYPE_WALLET_CONNECT){let t=_.getProvider(e);t?.session&&this.setConnectedWalletInfo({...t.session.peer.metadata,name:t.session.peer.metadata.name,icon:t.session.peer.metadata.icons?.[0]},e)}else if(t){if(t===i.b.CONNECTOR_ID.COINBASE){let t=this.getConnectors().find(e=>e.id===i.b.CONNECTOR_ID.COINBASE);this.setConnectedWalletInfo({name:"Coinbase Wallet",icon:this.getConnectorImage(t)},e)}else this.setConnectedWalletInfo({name:t},e)}}async syncBalance(e){x.p.getNetworksByNamespace(this.caipNetworks,e.chainNamespace).find(t=>t.id.toString()===e.chainId?.toString())&&e.chainId&&await this.updateNativeBalance(e.address,e.chainId,e.chainNamespace)}async updateNativeBalance(e,t,r){let i=this.getAdapter(r);if(i){let n=await i.getBalance({address:e,chainId:t,caipNetwork:this.getCaipNetwork(r),tokens:this.options.tokens});this.setBalance(n.balance,n.symbol,r)}}async initializeUniversalAdapter(){let e=q.createLogger((e,...t)=>{e&&this.handleAlertError(e),console.error(...t)}),t={projectId:this.options?.projectId,metadata:{name:this.options?.metadata?this.options?.metadata.name:"",description:this.options?.metadata?this.options?.metadata.description:"",url:this.options?.metadata?this.options?.metadata.url:"",icons:this.options?.metadata?this.options?.metadata.icons:[""]},logger:e};h.OptionsController.setManualWCControl(!!this.options?.manualWCControl),this.universalProvider=this.options.universalProvider??await T.Z.init(t),this.listenWalletConnect()}listenWalletConnect(){this.universalProvider&&(this.universalProvider.on("display_uri",e=>{a.ConnectionController.setUri(e)}),this.universalProvider.on("connect",a.ConnectionController.finalizeWcConnection),this.universalProvider.on("disconnect",()=>{this.chainNamespaces.forEach(e=>{this.resetAccount(e)}),a.ConnectionController.resetWcConnection()}),this.universalProvider.on("chainChanged",e=>{let t=this.caipNetworks?.find(t=>t.id==e),r=this.getCaipNetwork();if(!t){this.setUnsupportedNetwork(e);return}r?.id!==t?.id&&this.setCaipNetwork(t)}),this.universalProvider.on("session_event",e=>{if(Q.s.isSessionEventData(e)){let{name:t,data:r}=e.params.event;"accountsChanged"===t&&Array.isArray(r)&&f.j.isCaipAddress(r[0])&&this.syncAccount(P.parseCaipAddress(r[0]))}}))}createUniversalProvider(){return!this.universalProviderInitPromise&&f.j.isClient()&&this.options?.projectId&&(this.universalProviderInitPromise=this.initializeUniversalAdapter()),this.universalProviderInitPromise}async getUniversalProvider(){if(!this.universalProvider)try{await this.createUniversalProvider()}catch(e){throw Error("AppKit:getUniversalProvider - Cannot create provider")}return this.universalProvider}handleAlertError(e){let[t,r]=Object.entries(w.j.UniversalProviderErrors).find(([,{message:t}])=>e.message.includes(t))??[],{message:i,alertErrorKey:n}=r??{};if(t&&i&&!this.reportedAlertErrors[t]){let e=w.j.ALERT_ERRORS[n];e&&(m.AlertController.open(e,"error"),this.reportedAlertErrors[t]=!0)}}getAdapter(e){if(e)return this.chainAdapters?.[e]}createAdapter(e){if(!e)return;let t=e.namespace;t&&(this.createClients(),e.namespace=t,e.construct({namespace:t,projectId:this.options?.projectId,networks:this.caipNetworks}),this.chainNamespaces.includes(t)||this.chainNamespaces.push(t),this.chainAdapters&&(this.chainAdapters[t]=e))}async open(e){await this.injectModalUi(),e?.uri&&a.ConnectionController.setUri(e.uri),await R.I.open(e)}async close(){await this.injectModalUi(),R.I.close()}setLoading(e,t){R.I.setLoading(e,t)}async disconnect(e){await a.ConnectionController.disconnect(e)}getError(){return""}getChainId(){return d.R.state.activeCaipNetwork?.id}async switchNetwork(e){let t=this.caipNetworks?.find(t=>t.id===e.id);if(!t){m.AlertController.open(w.j.ALERT_ERRORS.SWITCH_NETWORK_NOT_FOUND,"error");return}await d.R.switchActiveNetwork(t)}getWalletProvider(){return d.R.state.activeChain?_.state.providers[d.R.state.activeChain]:null}getWalletProviderType(){return _.getProviderId(d.R.state.activeChain)}subscribeProviders(e){return _.subscribeProviders(e)}getThemeMode(){return p.ThemeController.state.themeMode}getThemeVariables(){return p.ThemeController.state.themeVariables}setThemeMode(e){p.ThemeController.setThemeMode(e),(0,j.Hs)(p.ThemeController.state.themeMode)}setTermsConditionsUrl(e){h.OptionsController.setTermsConditionsUrl(e)}setPrivacyPolicyUrl(e){h.OptionsController.setPrivacyPolicyUrl(e)}setThemeVariables(e){p.ThemeController.setThemeVariables(e),(0,j.R)(p.ThemeController.state.themeVariables)}subscribeTheme(e){return p.ThemeController.subscribe(e)}getWalletInfo(){return u.AccountController.state.connectedWalletInfo}getAccount(e){let t=s.ConnectorController.getAuthConnector(e),r=d.R.getAccountData(e);if(r)return{allAccounts:r.allAccounts,caipAddress:r.caipAddress,address:f.j.getPlainAddress(r.caipAddress),isConnected:!!r.caipAddress,status:r.status,embeddedWalletInfo:t?{user:r.user,authProvider:r.socialProvider||"email",accountType:r.preferredAccountType,isSmartAccountDeployed:!!r.smartAccountDeployed}:void 0}}subscribeAccount(e,t){let r=()=>{let r=this.getAccount(t);r&&e(r)};t?d.R.subscribeChainProp("accountState",r,t):d.R.subscribe(r),s.ConnectorController.subscribe(r)}subscribeNetwork(e){return d.R.subscribe(({activeCaipNetwork:t})=>{e({caipNetwork:t,chainId:t?.id,caipNetworkId:t?.caipNetworkId})})}subscribeWalletInfo(e){return u.AccountController.subscribeKey("connectedWalletInfo",e)}subscribeShouldUpdateToAddress(e){u.AccountController.subscribeKey("shouldUpdateToAddress",e)}subscribeCaipNetworkChange(e){d.R.subscribeKey("activeCaipNetwork",e)}getState(){return M.I.state}subscribeState(e){return M.I.subscribe(e)}showErrorMessage(e){U.SnackController.showError(e)}showSuccessMessage(e){U.SnackController.showSuccess(e)}getEvent(){return{...o.X.state}}subscribeEvents(e){return o.X.subscribe(e)}replace(e){L.RouterController.replace(e)}redirect(e){L.RouterController.push(e)}popTransactionStack(e){L.RouterController.popTransactionStack(e)}isOpen(){return R.I.state.open}isTransactionStackEmpty(){return 0===L.RouterController.state.transactionStack.length}isTransactionShouldReplaceView(){return L.RouterController.state.transactionStack[L.RouterController.state.transactionStack.length-1]?.replace}static getInstance(){return this.instance}updateFeatures(e){h.OptionsController.setFeatures(e)}updateOptions(e){let t={...h.OptionsController.state||{},...e};h.OptionsController.setOptions(t)}setConnectMethodsOrder(e){h.OptionsController.setConnectMethodsOrder(e)}setWalletFeaturesOrder(e){h.OptionsController.setWalletFeaturesOrder(e)}setCollapseWallets(e){h.OptionsController.setCollapseWallets(e)}setSocialsOrder(e){h.OptionsController.setSocialsOrder(e)}getConnectMethodsOrder(){return B.J.getConnectOrderMethod(h.OptionsController.state.features,s.ConnectorController.getConnectors())}removeAdapter(e){let t=this.getIsConnectedState(),r=this.getAdapter(e);if(!r||!this.chainAdapters||t)return;let i=this.caipNetworks?.filter(t=>t.chainNamespace!==e);d.R.removeAdapter(e),s.ConnectorController.removeAdapter(e),this.chainNamespaces=this.chainNamespaces.filter(t=>t!==e),this.caipNetworks=i,r.removeAllEventListeners(),Reflect.deleteProperty(this.chainAdapters,e)}addAdapter(e,t){let r=e.namespace;if(!this.connectionControllerClient||!this.networkControllerClient||!this.chainAdapters||!r)return;let i=this.extendCaipNetworks({...this.options,networks:t});this.caipNetworks=[...this.caipNetworks||[],...i],this.createAdapter(e),this.initChainAdapter(r),d.R.addAdapter(e,{connectionControllerClient:this.connectionControllerClient,networkControllerClient:this.networkControllerClient},i)}addNetwork(e,t){if(this.chainAdapters&&!this.chainAdapters[e])throw Error(`Adapter for namespace ${e} doesn't exist`);let r=this.extendCaipNetwork(t,this.options);d.R.addNetwork(r),this.caipNetworks&&!this.caipNetworks?.find(e=>e.id===r.id)&&this.caipNetworks.push(r)}removeNetwork(e,t){if(this.chainAdapters&&!this.chainAdapters[e])throw Error(`Adapter for namespace ${e} doesn't exist`);if(!this.caipNetworks?.find(e=>e.id===t))throw Error(`Network with ID ${t} not found`);if(!this.caipNetworks)return;let r=this.caipNetworks.filter(r=>r.chainNamespace===e&&r.id!==t);if(!r?.length)throw Error("Cannot remove last network for a namespace");d.R.removeNetwork(e,t),this.caipNetworks=[...r]}}let Z=!1;class J extends Y{setupAuthConnectorListeners(e){e.onRpcRequest(t=>{I.$.checkIfRequestExists(t)?I.$.checkIfRequestIsSafe(t)||this.handleUnsafeRPCRequest():(this.open(),console.error(S.y_.RPC_METHOD_NOT_ALLOWED_MESSAGE,{method:t.method}),setTimeout(()=>{this.showErrorMessage(S.y_.RPC_METHOD_NOT_ALLOWED_UI_MESSAGE)},300),e.rejectRpcRequests())}),e.onRpcError(()=>{this.isOpen()&&(this.isTransactionStackEmpty()?this.close():this.popTransactionStack(!0))}),e.onRpcSuccess((e,t)=>{let r=I.$.checkIfRequestIsSafe(t),i=u.AccountController.state.address,n=d.R.state.activeCaipNetwork;!r&&(this.isTransactionStackEmpty()?this.close():this.popTransactionStack(),i&&n?.id&&this.updateNativeBalance(i,n.id,n.chainNamespace))}),e.onNotConnected(()=>{let e=d.R.state.activeChain;s.ConnectorController.getConnectorId(e)===i.b.CONNECTOR_ID.AUTH&&(this.setCaipAddress(void 0,e),this.setLoading(!1,e))}),e.onConnect(async t=>{let r=d.R.state.activeChain,n=r===i.b.CHAIN.EVM?`eip155:${t.chainId}:${t.address}`:`${t.chainId}:${t.address}`;this.setSmartAccountDeployed(!!t.smartAccountDeployed,r),y.isLowerCaseMatch(t.address,u.AccountController.state.address)||this.syncIdentity({address:t.address,chainId:t.chainId,chainNamespace:r}),this.setCaipAddress(n,r),this.setUser({...u.AccountController.state.user||{},email:t.email},r);let s=t.preferredAccountType||h.OptionsController.state.defaultAccountTypes[r];this.setPreferredAccountType(s,r);let a=t.accounts?.map(e=>f.j.createAccount(r,e.address,e.type||h.OptionsController.state.defaultAccountTypes[r]));this.setAllAccounts(a||[f.j.createAccount(r,t.address,s)],r),await e.getSmartAccountEnabledNetworks(),this.setLoading(!1,r)}),e.onSocialConnected(({userName:e})=>{this.setUser({...u.AccountController.state.user||{},username:e},d.R.state.activeChain)}),e.onGetSmartAccountEnabledNetworks(e=>{this.setSmartAccountEnabledNetworks(e,d.R.state.activeChain)}),e.onSetPreferredAccount(({address:e,type:t})=>{e&&this.setPreferredAccountType(t,d.R.state.activeChain)})}async syncAuthConnector(e,t){let r=i.b.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(t);if(!r)return;this.setLoading(!0,t);let a=e.getLoginEmailUsed();this.setLoading(a,t),a&&this.setStatus("connecting",t);let o=e.getEmail(),c=e.getUsername();this.setUser({...u.AccountController.state?.user||{},username:c,email:o},d.R.state.activeChain),this.setupAuthConnectorListeners(e);let{isConnected:l}=await e.isConnected(),f=p.ThemeController.getSnapshot(),m=h.OptionsController.getSnapshot();e.syncDappData({metadata:m.metadata,sdkVersion:m.sdkVersion,projectId:m.projectId,sdkType:m.sdkType}),e.syncTheme({themeMode:f.themeMode,themeVariables:f.themeVariables,w3mThemeVariables:(0,n.t)(f.themeVariables,f.themeMode)}),t&&r&&(l&&this.connectionControllerClient?.connectExternal?(await this.connectionControllerClient?.connectExternal({id:i.b.CONNECTOR_ID.AUTH,info:{name:i.b.CONNECTOR_ID.AUTH},type:b.b.CONNECTOR_TYPE_AUTH,provider:e,chainId:d.R.state.activeCaipNetwork?.id,chain:t}),this.setStatus("connected",t)):s.ConnectorController.getConnectorId(t)===i.b.CONNECTOR_ID.AUTH&&(this.setStatus("disconnected",t),g.M.removeConnectedNamespace(t))),this.setLoading(!1,t)}async checkExistingTelegramSocialConnection(e){try{if(!f.j.isTelegram())return;let t=g.M.getTelegramSocialProvider();if(!t||"undefined"==typeof window||"undefined"==typeof document)return;let r=new URL(window.location.href).searchParams.get("result_uri");if(!r)return;u.AccountController.setSocialProvider(t,e),await this.authProvider?.init();let i=s.ConnectorController.getAuthConnector();t&&i&&(this.setLoading(!0,e),await i.provider.connectSocial(r),await a.ConnectionController.connectExternal(i,i.chain),g.M.setConnectedSocialProvider(t),g.M.removeTelegramSocialProvider(),o.X.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",properties:{provider:t}}))}catch(t){this.setLoading(!1,e),console.error("checkExistingSTelegramocialConnection error",t)}try{let e=new URL(window.location.href);e.searchParams.delete("result_uri"),window.history.replaceState({},document.title,e.toString())}catch(e){console.error("tma social login failed",e)}}createAuthProvider(e){if(!i.b.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(e))return;let t=this.options?.features?.email===void 0?c.bq.DEFAULT_FEATURES.email:this.options?.features?.email,r=this.options?.features?.socials?this.options?.features?.socials?.length>0:c.bq.DEFAULT_FEATURES.socials;!this.authProvider&&this.options?.projectId&&(t||r)&&(this.authProvider=N.D.getInstance({projectId:this.options.projectId,enableLogger:this.options.enableAuthLogger,chainId:this.getCaipNetwork(e)?.caipNetworkId,onTimeout:()=>{m.AlertController.open(w.j.ALERT_ERRORS.SOCIALS_TIMEOUT,"error")}}),this.subscribeState(e=>{e.open||this.authProvider?.rejectRpcRequests()}),this.syncAuthConnector(this.authProvider,e),this.checkExistingTelegramSocialConnection(e))}createAuthProviderForAdapter(e){this.createAuthProvider(e),this.authProvider&&this.chainAdapters?.[e]?.setAuthProvider?.(this.authProvider)}initControllers(e){super.initControllers(e),this.options.excludeWalletIds&&l.ApiController.initializeExcludedWalletRdns({ids:this.options.excludeWalletIds})}async switchCaipNetwork(e){if(!e)return;let t=d.R.state.activeChain,r=e.chainNamespace,n=this.getAddressByChainNamespace(e.chainNamespace);if(e.chainNamespace===d.R.state.activeChain&&n){let t=this.getAdapter(r),i=_.getProvider(r),n=_.getProviderId(r);await t?.switchNetwork({caipNetwork:e,provider:i,providerType:n}),this.setCaipNetwork(e)}else{let s=_.getProviderId(t)===b.b.CONNECTOR_TYPE_AUTH,a=_.getProviderId(r),o=a===b.b.CONNECTOR_TYPE_AUTH,c=i.b.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(r);if((s||o)&&c)try{d.R.state.activeChain=e.chainNamespace,await this.connectionControllerClient?.connectExternal?.({id:i.b.CONNECTOR_ID.AUTH,provider:this.authProvider,chain:r,chainId:e.id,type:b.b.CONNECTOR_TYPE_AUTH,caipNetwork:e}),this.setCaipNetwork(e)}catch(i){let t=this.getAdapter(r);await t?.switchNetwork({caipNetwork:e,provider:this.authProvider,providerType:a})}else a===b.b.CONNECTOR_TYPE_WALLET_CONNECT?(this.setCaipNetwork(e),this.syncWalletConnectAccount()):(this.setCaipNetwork(e),n&&this.syncAccount({address:n,chainId:e.id,chainNamespace:r}))}}async initChainAdapter(e){await super.initChainAdapter(e),this.createAuthProviderForAdapter(e)}async syncIdentity({address:e,chainId:t,chainNamespace:r}){let n=`${r}:${t}`,s=this.caipNetworks?.find(e=>e.caipNetworkId===n);if(r!==i.b.CHAIN.EVM||s?.testnet){this.setProfileName(null,r),this.setProfileImage(null,r);return}try{let{name:i,avatar:s}=await this.fetchIdentity({address:e,caipNetworkId:n});if(this.setProfileName(i,r),this.setProfileImage(s,r),!i){let i=this.getAdapter(r),n=await i?.getProfile({address:e,chainId:Number(t)});n?.profileName?(this.setProfileName(n.profileName,r),n.profileImage&&this.setProfileImage(n.profileImage,r)):(await this.syncReownName(e,r),this.setProfileImage(null,r))}}catch{await this.syncReownName(e,r),1!==t&&this.setProfileImage(null,r)}}syncConnectedWalletInfo(e){let t=_.getProviderId(e);if(t===b.b.CONNECTOR_TYPE_AUTH){let r=this.authProvider;if(r){let i=g.M.getConnectedSocialProvider()??"email",n=r.getEmail()??r.getUsername();this.setConnectedWalletInfo({name:t,identifier:n,social:i},e)}}else super.syncConnectedWalletInfo(e)}async injectModalUi(){if(!Z&&f.j.isClient()){let e={...c.bq.DEFAULT_FEATURES,...this.options.features},t=[];if(e&&((e.email||e.socials&&e.socials.length)&&t.push(Promise.all([r.e(4129),r.e(1219),r.e(8131)]).then(r.bind(r,68131))),e.email&&t.push(Promise.all([r.e(4129),r.e(1219),r.e(519)]).then(r.bind(r,10519))),e.socials&&t.push(Promise.all([r.e(4129),r.e(8370),r.e(615)]).then(r.bind(r,20615))),e.swaps&&t.push(Promise.all([r.e(4129),r.e(1219),r.e(8430)]).then(r.bind(r,58430))),e.send&&t.push(Promise.all([r.e(4129),r.e(1219),r.e(4421)]).then(r.bind(r,14421))),e.receive&&t.push(Promise.all([r.e(4129),r.e(8370),r.e(1828)]).then(r.bind(r,61828))),e.onramp&&t.push(Promise.all([r.e(4129),r.e(1219),r.e(2196),r.e(5522)]).then(r.bind(r,65522))),e.history&&t.push(Promise.all([r.e(4129),r.e(3583),r.e(3333)]).then(r.bind(r,92200)))),await Promise.all([...t,Promise.all([r.e(4129),r.e(1219),r.e(8370),r.e(2196),r.e(3583),r.e(9566),r.e(6879)]).then(r.bind(r,96879)),Promise.all([r.e(4129),r.e(9566),r.e(8898)]).then(r.bind(r,64137))]),!document.querySelector("w3m-modal")){let e=document.createElement("w3m-modal");h.OptionsController.state.disableAppend||h.OptionsController.state.enableEmbedded||document.body.insertAdjacentElement("beforeend",e)}Z=!0}}}},72731:function(e,t,r){"use strict";r.d(t,{z:function(){return o}}),r(58269);var i=r(68314),n=r(72579),s=r(72551),a=r(52814);class o{constructor({provider:e,caipNetworks:t,namespace:r}){this.id=i.b.CONNECTOR_ID.WALLET_CONNECT,this.name=s.C.ConnectorNamesMap[i.b.CONNECTOR_ID.WALLET_CONNECT],this.type="WALLET_CONNECT",this.imageId=s.C.ConnectorImageIds[i.b.CONNECTOR_ID.WALLET_CONNECT],this.caipNetworks=t,this.provider=e,this.chain=r}get chains(){return this.caipNetworks}async connectWalletConnect(){return await this.authenticate()||await this.provider.connect({optionalNamespaces:a.s.createNamespaces(this.caipNetworks)}),{clientId:await this.provider.client.core.crypto.getClientId(),session:this.provider.session}}async disconnect(){await this.provider.disconnect()}async authenticate(){let e=this.chains.map(e=>e.caipNetworkId);return n.w.universalProviderAuthenticate({universalProvider:this.provider,chains:e,methods:c})}}let c=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_getCallsStatus","wallet_sendCalls","wallet_getCapabilities","wallet_grantPermissions","wallet_revokePermissions","wallet_getAssets"]},98200:function(e,t,r){"use strict";r.d(t,{pLm:function(){return i.p},eGR:function(){return n},Zjg:function(){return a},ol5:function(){return o}});var i=r(56334);let n=(0,r(86164).a)({id:56,name:"BNB Smart Chain",nativeCurrency:{decimals:18,name:"BNB",symbol:"BNB"},rpcUrls:{default:{http:["https://56.rpc.thirdweb.com"]}},blockExplorers:{default:{name:"BscScan",url:"https://bscscan.com",apiUrl:"https://api.bscscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:15921452}}});function s(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}let a=s({id:"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",name:"Solana",network:"solana-mainnet",nativeCurrency:{name:"Solana",symbol:"SOL",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Solscan",url:"https://solscan.io"}},testnet:!1,chainNamespace:"solana",caipNetworkId:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",deprecatedCaipNetworkId:"solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ"}),o=s({id:"EtWTRABZaYq6iMfeYKouRu166VU2xqa1",name:"Solana Devnet",network:"solana-devnet",nativeCurrency:{name:"Solana",symbol:"SOL",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Solscan",url:"https://solscan.io"}},testnet:!0,chainNamespace:"solana",caipNetworkId:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",deprecatedCaipNetworkId:"solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K"});s({id:"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",name:"Solana Testnet",network:"solana-testnet",nativeCurrency:{name:"Solana",symbol:"SOL",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Solscan",url:"https://solscan.io"}},testnet:!0,chainNamespace:"solana",caipNetworkId:"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"}),s({id:"000000000019d6689c085ae165831e93",caipNetworkId:"bip122:000000000019d6689c085ae165831e93",chainNamespace:"bip122",name:"Bitcoin",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:8},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}}}),s({id:"000000000933ea01ad0ee984209779ba",caipNetworkId:"bip122:000000000933ea01ad0ee984209779ba",chainNamespace:"bip122",name:"Bitcoin Testnet",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:8},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},testnet:!0})},18181:function(e,t,r){"use strict";r.d(t,{T:function(){return i}});let i={ERROR_CODE_UNRECOGNIZED_CHAIN_ID:4902,ERROR_CODE_DEFAULT:5e3,ERROR_INVALID_CHAIN_ID:32603}},52814:function(e,t,r){"use strict";r.d(t,{s:function(){return s}}),r(18181);var i=r(26258),n=r(98200);let s={getMethodsByChainNamespace(e){switch(e){case"solana":return["solana_signMessage","solana_signTransaction","solana_requestAccounts","solana_getAccounts","solana_signAllTransactions","solana_signAndSendTransaction"];case"eip155":return["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_getCallsStatus","wallet_showCallsStatus","wallet_sendCalls","wallet_getCapabilities","wallet_grantPermissions","wallet_revokePermissions","wallet_getAssets"];case"bip122":return["sendTransfer","signMessage","signPsbt","getAccountAddresses"];default:return[]}},createNamespaces(e){return e.reduce((e,t)=>{let{id:r,chainNamespace:i,rpcUrls:s}=t,a=s.default.http[0],o=this.getMethodsByChainNamespace(i);e[i]||(e[i]={methods:o,events:["accountsChanged","chainChanged"],chains:[],rpcMap:{}});let c=`${i}:${r}`,l=e[i];switch(l.chains.push(c),c){case n.Zjg.caipNetworkId:l.chains.push(n.Zjg.deprecatedCaipNetworkId);break;case n.ol5.caipNetworkId:l.chains.push(n.ol5.deprecatedCaipNetworkId)}return l?.rpcMap&&a&&(l.rpcMap[r]=a),e},{})},resolveReownName:async e=>{let t=await i.a.resolveName(e),r=Object.values(t?.addresses)||[];return r[0]?.address||!1},getChainsFromNamespaces:(e={})=>Object.values(e).flatMap(e=>Array.from(new Set([...e.chains||[],...e.accounts.map(e=>{let[t,r]=e.split(":");return`${t}:${r}`})]))),isSessionEventData:e=>"object"==typeof e&&null!==e&&"id"in e&&"topic"in e&&"params"in e&&"object"==typeof e.params&&null!==e.params&&"chainId"in e.params&&"event"in e.params&&"object"==typeof e.params.event&&null!==e.params.event}},66474:function(e,t,r){"use strict";r.d(t,{j:function(){return s}});var i=r(7506),n=r(24139),s=new class extends i.l{#h;#f;#p;constructor(){super(),this.#p=e=>{if(!n.sk&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#f||this.setEventListener(this.#p)}onUnsubscribe(){this.hasListeners()||(this.#f?.(),this.#f=void 0)}setEventListener(e){this.#p=e,this.#f?.(),this.#f=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#h!==e&&(this.#h=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#h?this.#h:globalThis.document?.visibilityState!=="hidden"}}},59289:function(e,t,r){"use strict";r.d(t,{R:function(){return o},m:function(){return a}});var i=r(27037),n=r(48907),s=r(72008),a=class extends n.F{#g;#s;#m;constructor(e){super(),this.mutationId=e.mutationId,this.#s=e.mutationCache,this.#g=[],this.state=e.state||o(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#g.includes(e)||(this.#g.push(e),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#g=this.#g.filter(t=>t!==e),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#g.length||("pending"===this.state.status?this.scheduleGc():this.#s.remove(this))}continue(){return this.#m?.continue()??this.execute(this.state.variables)}async execute(e){this.#m=(0,s.Mz)({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#b({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#b({type:"pause"})},onContinue:()=>{this.#b({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#s.canRun(this)});let t="pending"===this.state.status,r=!this.#m.canStart();try{if(!t){this.#b({type:"pending",variables:e,isPaused:r}),await this.#s.config.onMutate?.(e,this);let t=await this.options.onMutate?.(e);t!==this.state.context&&this.#b({type:"pending",context:t,variables:e,isPaused:r})}let i=await this.#m.start();return await this.#s.config.onSuccess?.(i,e,this.state.context,this),await this.options.onSuccess?.(i,e,this.state.context),await this.#s.config.onSettled?.(i,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(i,null,e,this.state.context),this.#b({type:"success",data:i}),i}catch(t){try{throw await this.#s.config.onError?.(t,e,this.state.context,this),await this.options.onError?.(t,e,this.state.context),await this.#s.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,t,e,this.state.context),t}finally{this.#b({type:"error",error:t})}}finally{this.#s.runNext(this)}}#b(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),i.Vr.batch(()=>{this.#g.forEach(t=>{t.onMutationUpdate(e)}),this.#s.notify({mutation:this,type:"updated",action:e})})}};function o(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},27037:function(e,t,r){"use strict";r.d(t,{Vr:function(){return n}});var i=e=>setTimeout(e,0),n=function(){let e=[],t=0,r=e=>{e()},n=e=>{e()},s=i,a=i=>{t?e.push(i):s(()=>{r(i)})},o=()=>{let t=e;e=[],t.length&&s(()=>{n(()=>{t.forEach(e=>{r(e)})})})};return{batch:e=>{let r;t++;try{r=e()}finally{--t||o()}return r},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{r=e},setBatchNotifyFunction:e=>{n=e},setScheduler:e=>{s=e}}}()},14304:function(e,t,r){"use strict";r.d(t,{N:function(){return s}});var i=r(7506),n=r(24139),s=new class extends i.l{#y=!0;#f;#p;constructor(){super(),this.#p=e=>{if(!n.sk&&window.addEventListener){let t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#f||this.setEventListener(this.#p)}onUnsubscribe(){this.hasListeners()||(this.#f?.(),this.#f=void 0)}setEventListener(e){this.#p=e,this.#f?.(),this.#f=e(this.setOnline.bind(this))}setOnline(e){this.#y!==e&&(this.#y=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#y}}},56888:function(e,t,r){"use strict";r.d(t,{A:function(){return o},z:function(){return c}});var i=r(24139),n=r(27037),s=r(72008),a=r(48907),o=class extends a.F{#w;#v;#A;#E;#m;#a;#C;constructor(e){super(),this.#C=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#E=e.client,this.#A=this.#E.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#w=function(e){let t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==t,i=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}(this.options),this.state=e.state??this.#w,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#m?.promise}setOptions(e){this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#A.remove(this)}setData(e,t){let r=(0,i.oE)(this.state.data,e,this.options);return this.#b({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#b({type:"setState",state:e,setStateOptions:t})}cancel(e){let t=this.#m?.promise;return this.#m?.cancel(e),t?t.then(i.ZT).catch(i.ZT):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#w)}isActive(){return this.observers.some(e=>!1!==(0,i.Nc)(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===i.CN||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return!!this.state.isInvalidated||(this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data)}isStaleByTime(e=0){return this.state.isInvalidated||void 0===this.state.data||!(0,i.Kp)(this.state.dataUpdatedAt,e)}onFocus(){let e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#m?.continue()}onOnline(){let e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#m?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#A.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#m&&(this.#C?this.#m.cancel({revert:!0}):this.#m.cancelRetry()),this.scheduleGc()),this.#A.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#b({type:"invalidate"})}fetch(e,t){if("idle"!==this.state.fetchStatus){if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#m)return this.#m.continueRetry(),this.#m.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let r=new AbortController,n=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#C=!0,r.signal)})},a={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#E,state:this.state,fetchFn:()=>{let e=(0,i.cG)(this.options,t),r={client:this.#E,queryKey:this.queryKey,meta:this.meta};return(n(r),this.#C=!1,this.options.persister)?this.options.persister(e,r,this):e(r)}};n(a),this.options.behavior?.onFetch(a,this),this.#v=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#b({type:"fetch",meta:a.fetchOptions?.meta});let o=e=>{(0,s.DV)(e)&&e.silent||this.#b({type:"error",error:e}),(0,s.DV)(e)||(this.#A.config.onError?.(e,this),this.#A.config.onSettled?.(this.state.data,e,this)),this.scheduleGc()};return this.#m=(0,s.Mz)({initialPromise:t?.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:e=>{if(void 0===e){o(Error(`${this.queryHash} data is undefined`));return}try{this.setData(e)}catch(e){o(e);return}this.#A.config.onSuccess?.(e,this),this.#A.config.onSettled?.(e,this.state.error,this),this.scheduleGc()},onError:o,onFail:(e,t)=>{this.#b({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#b({type:"pause"})},onContinue:()=>{this.#b({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}),this.#m.start()}#b(e){this.state=(t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...c(t.data,this.options),fetchMeta:e.meta??null};case"success":return{...t,data:e.data,dataUpdateCount:t.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":let r=e.error;if((0,s.DV)(r)&&r.revert&&this.#v)return{...this.#v,fetchStatus:"idle"};return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),n.Vr.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#A.notify({query:this,type:"updated",action:e})})}};function c(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:(0,s.Kw)(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}},48907:function(e,t,r){"use strict";r.d(t,{F:function(){return n}});var i=r(24139),n=class{#_;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),(0,i.PN)(this.gcTime)&&(this.#_=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(i.sk?1/0:3e5))}clearGcTimeout(){this.#_&&(clearTimeout(this.#_),this.#_=void 0)}}},72008:function(e,t,r){"use strict";r.d(t,{DV:function(){return u},Kw:function(){return c},Mz:function(){return d}});var i=r(66474),n=r(14304),s=r(13820),a=r(24139);function o(e){return Math.min(1e3*2**e,3e4)}function c(e){return(e??"online")!=="online"||n.N.isOnline()}var l=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function u(e){return e instanceof l}function d(e){let t,r=!1,u=0,d=!1,h=(0,s.O)(),f=()=>i.j.isFocused()&&("always"===e.networkMode||n.N.isOnline())&&e.canRun(),p=()=>c(e.networkMode)&&e.canRun(),g=r=>{d||(d=!0,e.onSuccess?.(r),t?.(),h.resolve(r))},m=r=>{d||(d=!0,e.onError?.(r),t?.(),h.reject(r))},b=()=>new Promise(r=>{t=e=>{(d||f())&&r(e)},e.onPause?.()}).then(()=>{t=void 0,d||e.onContinue?.()}),y=()=>{let t;if(d)return;let i=0===u?e.initialPromise:void 0;try{t=i??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(g).catch(t=>{if(d)return;let i=e.retry??(a.sk?0:3),n=e.retryDelay??o,s="function"==typeof n?n(u,t):n,c=!0===i||"number"==typeof i&&uf()?void 0:b()).then(()=>{r?m(t):y()})})};return{promise:h,cancel:t=>{d||(m(new l(t)),e.abort?.())},continue:()=>(t?.(),h),cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:p,start:()=>(p()?y():b().then(y),h)}}},7506:function(e,t,r){"use strict";r.d(t,{l:function(){return i}});var i=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}}},13820:function(e,t,r){"use strict";function i(){let e,t;let r=new Promise((r,i)=>{e=r,t=i});function i(e){Object.assign(r,e),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=t=>{i({status:"fulfilled",value:t}),e(t)},r.reject=e=>{i({status:"rejected",reason:e}),t(e)},r}r.d(t,{O:function(){return i}})},24139:function(e,t,r){"use strict";r.d(t,{CN:function(){return _},Ht:function(){return C},KC:function(){return c},Kp:function(){return o},Nc:function(){return l},PN:function(){return a},Q$:function(){return g},Rm:function(){return h},SE:function(){return s},VS:function(){return m},VX:function(){return E},X7:function(){return d},Ym:function(){return f},ZT:function(){return n},_v:function(){return v},_x:function(){return u},cG:function(){return I},oE:function(){return A},sk:function(){return i},to:function(){return p}});var i="undefined"==typeof window||"Deno"in globalThis;function n(){}function s(e,t){return"function"==typeof e?e(t):e}function a(e){return"number"==typeof e&&e>=0&&e!==1/0}function o(e,t){return Math.max(e+(t||0)-Date.now(),0)}function c(e,t){return"function"==typeof e?e(t):e}function l(e,t){return"function"==typeof e?e(t):e}function u(e,t){let{type:r="all",exact:i,fetchStatus:n,predicate:s,queryKey:a,stale:o}=e;if(a){if(i){if(t.queryHash!==h(a,t.options))return!1}else if(!p(t.queryKey,a))return!1}if("all"!==r){let e=t.isActive();if("active"===r&&!e||"inactive"===r&&e)return!1}return("boolean"!=typeof o||t.isStale()===o)&&(!n||n===t.state.fetchStatus)&&(!s||!!s(t))}function d(e,t){let{exact:r,status:i,predicate:n,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(r){if(f(t.options.mutationKey)!==f(s))return!1}else if(!p(t.options.mutationKey,s))return!1}return(!i||t.state.status===i)&&(!n||!!n(t))}function h(e,t){return(t?.queryKeyHashFn||f)(e)}function f(e){return JSON.stringify(e,(e,t)=>y(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function p(e,t){return e===t||typeof e==typeof t&&!!e&&!!t&&"object"==typeof e&&"object"==typeof t&&!Object.keys(t).some(r=>!p(e[r],t[r]))}function g(e,t){if(e===t)return e;let r=b(e)&&b(t);if(r||y(e)&&y(t)){let i=r?e:Object.keys(e),n=i.length,s=r?t:Object.keys(t),a=s.length,o=r?[]:{},c=0;for(let n=0;n{setTimeout(t,e)})}function A(e,t,r){return"function"==typeof r.structuralSharing?r.structuralSharing(e,t):!1!==r.structuralSharing?g(e,t):t}function E(e,t,r=0){let i=[...e,t];return r&&i.length>r?i.slice(1):i}function C(e,t,r=0){let i=[t,...e];return r&&i.length>r?i.slice(0,-1):i}var _=Symbol();function I(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==_?e.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`))}},30202:function(e,t,r){"use strict";r.d(t,{NL:function(){return a},aH:function(){return o}});var i=r(67294),n=r(85893),s=i.createContext(void 0),a=e=>{let t=i.useContext(s);if(e)return e;if(!t)throw Error("No QueryClient set, use QueryClientProvider to set one");return t},o=({client:e,children:t})=>(i.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,n.jsx)(s.Provider,{value:e,children:t}))},88972:function(e,t,r){"use strict";r.d(t,{s:function(){return _}});var i=r(95946),n=r(61836),s=r(15229),a=r(88930),o=r(81946),c=r(84192);function l(e){return"number"==typeof e?e:"wei"===e?0:Math.abs(c.Bd[e])}var u=r(97405),d=r(16693),h=r(57412),f=r(36117),p=r(7210),g=r(55629),m=r(47864),b=r(72365),y=r(93714),w=r(88819);async function v(e,t){let{allowFailure:r=!0,batchSize:i,blockNumber:n,blockTag:s,multicallAddress:a,stateOverride:o}=t,c=t.contracts,l=i??("object"==typeof e.batch?.multicall&&e.batch.multicall.batchSize||1024),v=a;if(!v){if(!e.chain)throw Error("client chain not configured. multicallAddress is required.");v=(0,m.L)({blockNumber:n,chain:e.chain,contract:"multicall3"})}let A=[[]],E=0,C=0;for(let e=0;e0&&C>l&&A[E].length>0&&(E++,C=(e.length-2)/2,A[E]=[]),A[E]=[...A[E],{allowFailure:!0,callData:e,target:i}]}catch(a){let e=(0,b.S)(a,{abi:t,address:i,args:n,docsPath:"/docs/contract/multicall",functionName:s});if(!r)throw e;A[E]=[...A[E],{allowFailure:!0,callData:"0x",target:i}]}}let _=await Promise.allSettled(A.map(t=>(0,y.s)(e,w.L,"readContract")({abi:d.F8,address:v,args:[t],blockNumber:n,blockTag:s,functionName:"aggregate3",stateOverride:o}))),I=[];for(let e=0;e<_.length;e++){let t=_[e];if("rejected"===t.status){if(!r)throw t.reason;for(let r=0;rA(e,{...s,allowFailure:r,blockNumber:i,blockTag:n,chainId:Number.parseInt(t),contracts:a.map(({contract:e})=>e)})))).flat(),c=Object.values(t).flatMap(e=>e.map(({index:e})=>e));return o.reduce((e,t,r)=>(e&&(e[c[r]]=t),e),[])}catch(s){if(s instanceof u.uq)throw s;let t=()=>a.map(t=>(0,E.L)(e,{...t,blockNumber:i,blockTag:n}));if(r)return(await Promise.allSettled(t())).map(e=>"fulfilled"===e.status?{result:e.value,status:"success"}:{error:e.reason,result:void 0,status:"failure"});return await Promise.all(t())}}async function _(e,t){let{address:r,blockNumber:c,blockTag:u,chainId:d,token:h,unit:f="ether"}=t;if(h)try{return await I(e,{balanceAddress:r,chainId:d,symbolType:"string",tokenAddress:h})}catch(t){if("ContractFunctionExecutionError"===t.name){let t=await I(e,{balanceAddress:r,chainId:d,symbolType:"bytes32",tokenAddress:h}),s=(0,i.rR)((0,n.f)(t.symbol,{dir:"right"}));return{...t,symbol:s}}throw t}let p=e.getClient({chainId:d}),g=(0,o.s)(p,a.s,"getBalance"),m=await g(c?{address:r,blockNumber:c}:{address:r,blockTag:u}),b=e.chains.find(e=>e.id===d)??p.chain;return{decimals:b.nativeCurrency.decimals,formatted:(0,s.b)(m,l(f)),symbol:b.nativeCurrency.symbol,value:m}}async function I(e,t){let{balanceAddress:r,chainId:i,symbolType:n,tokenAddress:a,unit:o}=t,c={abi:[{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:n}]}],address:a},[u,d,h]=await C(e,{allowFailure:!1,contracts:[{...c,functionName:"balanceOf",args:[r],chainId:i},{...c,functionName:"decimals",chainId:i},{...c,functionName:"symbol",chainId:i}]}),f=(0,s.b)(u??"0",l(o??d));return{decimals:d,formatted:f,symbol:h,value:u}}},75230:function(e,t,r){"use strict";r.d(t,{e:function(){return c}});var i=r(94898),n=r(22319),s=r(14503),a=r(45775),o=r(87675);async function c(e,t={}){let r;if(t.connector){let{connector:i}=t;if("reconnecting"===e.state.status&&!i.getAccounts&&!i.getChainId)throw new o.$S({connector:i});let[n,s]=await Promise.all([i.getAccounts().catch(e=>{if(null===t.account)return[];throw e}),i.getChainId()]);r={accounts:n,chainId:s,connector:i}}else r=e.state.connections.get(e.state.current);if(!r)throw new o.aH;let c=t.chainId??r.chainId,l=await r.connector.getChainId();if(l!==r.chainId)throw new o.XZ({connectionChainId:r.chainId,connectorChainId:l});let u=r.connector;if(u.getClient)return u.getClient({chainId:c});let d=(0,s.T)(t.account??r.accounts[0]);if(d&&(d.address=(0,a.K)(d.address)),t.account&&!r.accounts.some(e=>e.toLowerCase()===d.address.toLowerCase()))throw new o.JK({address:d.address,connector:u});let h=e.chains.find(e=>e.id===c),f=await r.connector.getProvider({chainId:c});return(0,i.e)({account:d,chain:h,name:"Connector Client",transport:e=>(function(e,t={}){let{key:r="custom",methods:i,name:s="Custom Provider",retryDelay:a}=t;return({retryCount:o})=>(0,n.q)({key:r,methods:i,name:s,request:e.request.bind(e),retryCount:t.retryCount??o,retryDelay:a,type:"custom"})})(f)({...e,retryCount:0})})}},37003:function(e,t,r){"use strict";r.d(t,{L:function(){return s}});var i=r(88819),n=r(81946);function s(e,t){let{chainId:r,...s}=t,a=e.getClient({chainId:r});return(0,n.s)(a,i.L,"readContract")(s)}},51785:function(e,t,r){"use strict";r.d(t,{G:function(){return n}});let i=!1;async function n(e,t={}){let r;if(i)return[];i=!0,e.setState(e=>({...e,status:e.current?"reconnecting":"connecting"}));let n=[];if(t.connectors?.length)for(let r of t.connectors){let t;t="function"==typeof r?e._internal.connectors.setup(r):r,n.push(t)}else n.push(...e.connectors);try{r=await e.storage?.getItem("recentConnectorId")}catch{}let s={};for(let[,t]of e.state.connections)s[t.connector.id]=1;r&&(s[r]=0);let a=Object.keys(s).length>0?[...n].sort((e,t)=>(s[e.id]??10)-(s[t.id]??10)):n,o=!1,c=[],l=[];for(let t of a){let r=await t.getProvider().catch(()=>void 0);if(!r||l.some(e=>e===r)||!await t.isAuthorized())continue;let i=await t.connect({isReconnecting:!0}).catch(()=>null);i&&(t.emitter.off("connect",e._internal.events.connect),t.emitter.on("change",e._internal.events.change),t.emitter.on("disconnect",e._internal.events.disconnect),e.setState(e=>{let r=new Map(o?e.connections:new Map).set(t.uid,{accounts:i.accounts,chainId:i.chainId,connector:t});return{...e,current:o?e.current:t.uid,connections:r}}),c.push({accounts:i.accounts,chainId:i.chainId,connector:t}),l.push(r),o=!0)}return("reconnecting"===e.state.status||"connecting"===e.state.status)&&(o?e.setState(e=>({...e,status:"connected"})):e.setState(e=>({...e,connections:new Map,current:null,status:"disconnected"}))),i=!1,c}},82693:function(e,t,r){"use strict";r.d(t,{n:function(){return h}});var i=r(14503),n=r(8998),s=r(55629),a=r(72365),o=r(93714),c=r(33310);async function l(e,t){let{abi:r,account:l=e.account,address:u,args:d,dataSuffix:h,functionName:f,...p}=t;if(void 0===l)throw new n.o({docsPath:"/docs/contract/writeContract"});let g=l?(0,i.T)(l):null,m=(0,s.R)({abi:r,args:d,functionName:f});try{return await (0,o.s)(e,c.T,"sendTransaction")({data:`${m}${h?h.replace("0x",""):""}`,to:u,account:g,...p})}catch(e){throw(0,a.S)(e,{abi:r,address:u,args:d,docsPath:"/docs/contract/writeContract",functionName:f,sender:g?.address})}}var u=r(81946),d=r(75230);async function h(e,t){let r;let{account:i,chainId:n,connector:s,...a}=t;r="object"==typeof i&&i?.type==="local"?e.getClient({chainId:n}):await (0,d.e)(e,{account:i??void 0,chainId:n,connector:s});let o=(0,u.s)(r,l,"writeContract");return await o({...a,...i?{account:i}:{},chain:n?{id:n}:null})}},27319:function(e,t,r){"use strict";function i(e){return e}r.d(t,{K:function(){return i}})},7066:function(e,t,r){"use strict";r.d(t,{G:function(){return c}});var i,n,s=r(79983);let a=()=>`@wagmi/core@${s.i}`;var o=function(e,t,r,i){if("a"===r&&!i)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)};class c extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return a()}constructor(e,t={}){super(),i.add(this),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiCoreError"});let r=t.cause instanceof c?t.cause.details:t.cause?.message?t.cause.message:t.details,n=t.cause instanceof c&&t.cause.docsPath||t.docsPath;this.message=[e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...n?[`Docs: ${this.docsBaseUrl}${n}.html${t.docsSlug?`#${t.docsSlug}`:""}`]:[],...r?[`Details: ${r}`]:[],`Version: ${this.version}`].join("\n"),t.cause&&(this.cause=t.cause),this.details=r,this.docsPath=n,this.metaMessages=t.metaMessages,this.shortMessage=e}walk(e){return o(this,i,"m",n).call(this,this,e)}}i=new WeakSet,n=function e(t,r){return r?.(t)?t:t.cause?o(this,i,"m",e).call(this,t.cause,r):t}},87675:function(e,t,r){"use strict";r.d(t,{$S:function(){return l},JK:function(){return o},X4:function(){return n},XZ:function(){return c},aH:function(){return a},wi:function(){return s}});var i=r(7066);class n extends i.G{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class s extends i.G{constructor(){super("Connector already connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAlreadyConnectedError"})}}class a extends i.G{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class o extends i.G{constructor({address:e,connector:t}){super(`Account "${e}" not found for connector "${t.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class c extends i.G{constructor({connectionChainId:e,connectorChainId:t}){super(`The current chain of the connector (id: ${t}) does not match the connection's chain (id: ${e}).`,{metaMessages:[`Current Chain ID: ${t}`,`Expected Chain ID: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class l extends i.G{constructor({connector:e}){super(`Connector "${e.name}" unavailable while reconnecting.`,{details:"During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uid`. All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored. This error commonly occurs for connectors that asynchronously inject after reconnection has already started."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorUnavailableReconnectingError"})}}},82433:function(e,t,r){"use strict";r.d(t,{Dr:function(){return n},jx:function(){return s}});var i=r(1381);let n={getItem:e=>"undefined"==typeof window?null:a(document.cookie,e)??null,setItem(e,t){"undefined"!=typeof window&&(document.cookie=`${e}=${t};path=/;samesite=Lax`)},removeItem(e){"undefined"!=typeof window&&(document.cookie=`${e}=;max-age=-1;path=/`)}};function s(e,t){if(!t)return;let r=a(t,`${e.storage?.key}.store`);if(r)return(0,i.v)(r).state}function a(e,t){let r=e.split("; ").find(e=>e.startsWith(`${t}=`));if(r)return r.substring(t.length+1)}},1381:function(e,t,r){"use strict";function i(e,t){return JSON.parse(e,(e,r)=>{let i=r;return i?.__type==="bigint"&&(i=BigInt(i.value)),i?.__type==="Map"&&(i=new Map(i.value)),t?.(e,i)??i})}r.d(t,{v:function(){return i}})},81946:function(e,t,r){"use strict";function i(e,t,r){let i=e[t.name];if("function"==typeof i)return i;let n=e[r];return"function"==typeof n?n:r=>t(e,r)}r.d(t,{s:function(){return i}})},79983:function(e,t,r){"use strict";r.d(t,{i:function(){return i}});let i="2.16.7"},47305:function(e,t,r){"use strict";function i(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function n(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function s(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.wrapConstructor");i(e.outputLen),i(e.blockLen)}function a(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function o(e,t){n(e);let r=t.outputLen;if(e.length>>t}let c=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];function l(e){for(let r=0;r>>8&65280|t>>>24&255}}function u(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}(e)),(0,n.gk)(e),e}function d(...e){let t=0;for(let r=0;re().update(u(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function p(e=32){if(i&&"function"==typeof i.getRandomValues)return i.getRandomValues(new Uint8Array(e));if(i&&"function"==typeof i.randomBytes)return i.randomBytes(e);throw Error("crypto.getRandomValues must be defined")}},84917:function(e,t,r){"use strict";function i(e,t){let r=e.exec(t);return r?.groups}r.d(t,{Zw:function(){return i},cN:function(){return a},eL:function(){return n},lh:function(){return s}});let n=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,s=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,a=/^\(.+?\).*?$/},90512:function(e,t,r){"use strict";function i(){for(var e,t,r=0,i="",n=arguments.length;re,isStatic:!1,reducedMotion:"never"})},91492:function(e,t,r){"use strict";r.d(t,{L:function(){return o},K:function(){return a}});let i=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function n(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||i.has(e)}let s=e=>!n(e);function a(e){e&&(s=t=>t.startsWith("on")?!n(t):e(t))}try{a(require("@emotion/is-prop-valid").default)}catch(e){}function o(e,t,r){let i={};for(let a in e)("values"!==a||"object"!=typeof e.values)&&(s(a)||!0===r&&n(a)||!t&&!n(a)||e.draggable&&a.startsWith("onDrag"))&&(i[a]=e[a]);return i}},22081:function(e,t,r){"use strict";r.d(t,{c:function(){return i}});let i={skipAnimations:!1,useManualTiming:!1}},96681:function(e,t,r){"use strict";r.d(t,{h:function(){return n}});var i=r(67294);function n(e){let t=(0,i.useRef)(null);return null===t.current&&(t.current=e()),t.current}},77996:function(e,t,r){"use strict";r.d(t,{oi:function(){return ef},iv:function(){return l},dy:function(){return K},YP:function(){return Q},$m:function(){return c}}),r(97286),r(69699);let i=globalThis,n=i.ShadowRoot&&(void 0===i.ShadyCSS||i.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),a=new WeakMap;class o{constructor(e,t,r){if(this._$cssResult$=!0,r!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(n&&void 0===e){let r=void 0!==t&&1===t.length;r&&(e=a.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&a.set(t,e))}return e}toString(){return this.cssText}}let c=e=>new o("string"==typeof e?e:e+"",void 0,s),l=(e,...t)=>new o(1===e.length?e[0]:t.reduce((t,r,i)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+e[i+1],e[0]),e,s),u=(e,t)=>{if(n)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let r of t){let t=document.createElement("style"),n=i.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=r.cssText,e.appendChild(t)}},d=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return c(t)})(e):e,{is:h,defineProperty:f,getOwnPropertyDescriptor:p,getOwnPropertyNames:g,getOwnPropertySymbols:m,getPrototypeOf:b}=Object,y=globalThis,w=y.trustedTypes,v=w?w.emptyScript:"",A=y.reactiveElementPolyfillSupport,E=(e,t)=>e,C={toAttribute(e,t){switch(t){case Boolean:e=e?v:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch(e){r=null}}return r}},_=(e,t)=>!h(e,t),I={attribute:!0,type:String,converter:C,reflect:!1,hasChanged:_};Symbol.metadata??=Symbol("metadata"),y.litPropertyMetadata??=new WeakMap;class S extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=I){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);void 0!==i&&f(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:n}=p(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return i?.call(this)},set(t){let s=i?.call(this);n.call(this,t),this.requestUpdate(e,s,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??I}static _$Ei(){if(this.hasOwnProperty(E("elementProperties")))return;let e=b(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(E("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(E("properties"))){let e=this.properties;for(let t of[...g(e),...m(e)])this.createProperty(t,e[t])}let e=this[Symbol.metadata];if(null!==e){let t=litPropertyMetadata.get(e);if(void 0!==t)for(let[e,r]of t)this.elementProperties.set(e,r)}for(let[e,t]of(this._$Eh=new Map,this.elementProperties)){let r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e))for(let r of new Set(e.flat(1/0).reverse()))t.unshift(d(r));else void 0!==e&&t.push(d(e));return t}static _$Eu(e,t){let r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map;for(let t of this.constructor.elementProperties.keys())this.hasOwnProperty(t)&&(e.set(t,this[t]),delete this[t]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return u(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){let r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(void 0!==i&&!0===r.reflect){let n=(void 0!==r.converter?.toAttribute?r.converter:C).toAttribute(t,r.type);this._$Em=e,null==n?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(e,t){let r=this.constructor,i=r._$Eh.get(e);if(void 0!==i&&this._$Em!==i){let e=r.getPropertyOptions(i),n="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:C;this._$Em=i,this[i]=n.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,r){if(void 0!==e){if(!((r??=this.constructor.getPropertyOptions(e)).hasChanged??_)(this[e],t))return;this.P(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),!0===r.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,r]of e)!0!==r.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],r)}let e=!1,t=this._$AL;try{(e=this.shouldUpdate(t))?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach(e=>this._$EC(e,this[e])),this._$EU()}updated(e){}firstUpdated(e){}}S.elementStyles=[],S.shadowRootOptions={mode:"open"},S[E("elementProperties")]=new Map,S[E("finalized")]=new Map,A?.({ReactiveElement:S}),(y.reactiveElementVersions??=[]).push("2.0.4");let N=globalThis,T=N.trustedTypes,P=T?T.createPolicy("lit-html",{createHTML:e=>e}):void 0,x="$lit$",O=`lit$${Math.random().toFixed(9).slice(2)}$`,R="?"+O,k=`<${R}>`,D=document,M=()=>D.createComment(""),U=e=>null===e||"object"!=typeof e&&"function"!=typeof e,L=Array.isArray,B=e=>L(e)||"function"==typeof e?.[Symbol.iterator],j="[ \n\f\r]",$=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,F=/-->/g,q=/>/g,z=RegExp(`>|${j}(?:([^\\s"'>=/]+)(${j}*=${j}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),H=/'/g,W=/"/g,V=/^(?:script|style|textarea|title)$/i,G=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),K=G(1),Q=G(2),Y=(G(3),Symbol.for("lit-noChange")),Z=Symbol.for("lit-nothing"),J=new WeakMap,X=D.createTreeWalker(D,129);function ee(e,t){if(!L(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==P?P.createHTML(t):t}let et=(e,t)=>{let r=e.length-1,i=[],n,s=2===t?"":3===t?"":"",a=$;for(let t=0;t"===c[0]?(a=n??$,l=-1):void 0===c[1]?l=-2:(l=a.lastIndex-c[2].length,o=c[1],a=void 0===c[3]?z:'"'===c[3]?W:H):a===W||a===H?a=z:a===F||a===q?a=$:(a=z,n=void 0);let d=a===z&&e[t+1].startsWith("/>")?" ":"";s+=a===$?r+k:l>=0?(i.push(o),r.slice(0,l)+x+r.slice(l)+O+d):r+O+(-2===l?t:d)}return[ee(e,s+(e[r]||"")+(2===t?"":3===t?"":"")),i]};class er{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let n=0,s=0,a=e.length-1,o=this.parts,[c,l]=et(e,t);if(this.el=er.createElement(c,r),X.currentNode=this.el.content,2===t||3===t){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=X.nextNode())&&o.length0){i.textContent=T?T.emptyScript:"";for(let r=0;r2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=Z}_$AI(e,t=this,r,i){let n=this.strings,s=!1;if(void 0===n)(s=!U(e=ei(this,e,t,0))||e!==this._$AH&&e!==Y)&&(this._$AH=e);else{let i,a;let o=e;for(e=n[0],i=0;i{let i=r?.renderBefore??t,n=i._$litPart$;if(void 0===n){let e=r?.renderBefore??null;i._$litPart$=n=new es(t.insertBefore(M(),e),e,void 0,r??{})}return n._$AI(e),n};class ef extends S{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=eh(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Y}}ef._$litElement$=!0,ef.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:ef});let ep=globalThis.litElementPolyfillSupport;ep?.({LitElement:ef}),(globalThis.litElementVersions??=[]).push("4.1.1")},97286:function(e,t,r){"use strict";r.d(t,{Ts:function(){return E},Qu:function(){return C}});let i=globalThis,n=i.ShadowRoot&&(void 0===i.ShadyCSS||i.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),a=new WeakMap;class o{constructor(e,t,r){if(this._$cssResult$=!0,r!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(n&&void 0===e){let r=void 0!==t&&1===t.length;r&&(e=a.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&a.set(t,e))}return e}toString(){return this.cssText}}let c=e=>new o("string"==typeof e?e:e+"",void 0,s),l=(e,t)=>{if(n)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let r of t){let t=document.createElement("style"),n=i.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=r.cssText,e.appendChild(t)}},u=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return c(t)})(e):e,{is:d,defineProperty:h,getOwnPropertyDescriptor:f,getOwnPropertyNames:p,getOwnPropertySymbols:g,getPrototypeOf:m}=Object,b=globalThis,y=b.trustedTypes,w=y?y.emptyScript:"",v=b.reactiveElementPolyfillSupport,A=(e,t)=>e,E={toAttribute(e,t){switch(t){case Boolean:e=e?w:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch(e){r=null}}return r}},C=(e,t)=>!d(e,t),_={attribute:!0,type:String,converter:E,reflect:!1,hasChanged:C};Symbol.metadata??=Symbol("metadata"),b.litPropertyMetadata??=new WeakMap;class I extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=_){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);void 0!==i&&h(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:n}=f(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return i?.call(this)},set(t){let s=i?.call(this);n.call(this,t),this.requestUpdate(e,s,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??_}static _$Ei(){if(this.hasOwnProperty(A("elementProperties")))return;let e=m(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(A("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(A("properties"))){let e=this.properties;for(let t of[...p(e),...g(e)])this.createProperty(t,e[t])}let e=this[Symbol.metadata];if(null!==e){let t=litPropertyMetadata.get(e);if(void 0!==t)for(let[e,r]of t)this.elementProperties.set(e,r)}for(let[e,t]of(this._$Eh=new Map,this.elementProperties)){let r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e))for(let r of new Set(e.flat(1/0).reverse()))t.unshift(u(r));else void 0!==e&&t.push(u(e));return t}static _$Eu(e,t){let r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map;for(let t of this.constructor.elementProperties.keys())this.hasOwnProperty(t)&&(e.set(t,this[t]),delete this[t]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return l(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){let r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(void 0!==i&&!0===r.reflect){let n=(void 0!==r.converter?.toAttribute?r.converter:E).toAttribute(t,r.type);this._$Em=e,null==n?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(e,t){let r=this.constructor,i=r._$Eh.get(e);if(void 0!==i&&this._$Em!==i){let e=r.getPropertyOptions(i),n="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:E;this._$Em=i,this[i]=n.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,r){if(void 0!==e){if(!((r??=this.constructor.getPropertyOptions(e)).hasChanged??C)(this[e],t))return;this.P(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),!0===r.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,r]of e)!0!==r.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],r)}let e=!1,t=this._$AL;try{(e=this.shouldUpdate(t))?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach(e=>this._$EC(e,this[e])),this._$EU()}updated(e){}firstUpdated(e){}}I.elementStyles=[],I.shadowRootOptions={mode:"open"},I[A("elementProperties")]=new Map,I[A("finalized")]=new Map,v?.({ReactiveElement:I}),(b.reactiveElementVersions??=[]).push("2.0.4")},69699:function(e,t,r){"use strict";r.d(t,{Jb:function(){return _},Ld:function(){return I},_$LH:function(){return j}});let i=globalThis,n=i.trustedTypes,s=n?n.createPolicy("lit-html",{createHTML:e=>e}):void 0,a="$lit$",o=`lit$${Math.random().toFixed(9).slice(2)}$`,c="?"+o,l=`<${c}>`,u=document,d=()=>u.createComment(""),h=e=>null===e||"object"!=typeof e&&"function"!=typeof e,f=Array.isArray,p=e=>f(e)||"function"==typeof e?.[Symbol.iterator],g="[ \n\f\r]",m=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,b=/-->/g,y=/>/g,w=RegExp(`>|${g}(?:([^\\s"'>=/]+)(${g}*=${g}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),v=/'/g,A=/"/g,E=/^(?:script|style|textarea|title)$/i,C=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),_=(C(1),C(2),C(3),Symbol.for("lit-noChange")),I=Symbol.for("lit-nothing"),S=new WeakMap,N=u.createTreeWalker(u,129);function T(e,t){if(!f(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s?s.createHTML(t):t}let P=(e,t)=>{let r=e.length-1,i=[],n,s=2===t?"":3===t?"":"",c=m;for(let t=0;t"===d[0]?(c=n??m,h=-1):void 0===d[1]?h=-2:(h=c.lastIndex-d[2].length,u=d[1],c=void 0===d[3]?w:'"'===d[3]?A:v):c===A||c===v?c=w:c===b||c===y?c=m:(c=w,n=void 0);let p=c===w&&e[t+1].startsWith("/>")?" ":"";s+=c===m?r+l:h>=0?(i.push(u),r.slice(0,h)+a+r.slice(h)+o+p):r+o+(-2===h?t:p)}return[T(e,s+(e[r]||"")+(2===t?"":3===t?"":"")),i]};class x{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let s=0,l=0,u=e.length-1,h=this.parts,[f,p]=P(e,t);if(this.el=x.createElement(f,r),N.currentNode=this.el.content,2===t||3===t){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=N.nextNode())&&h.length0){i.textContent=n?n.emptyScript:"";for(let r=0;r2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=I}_$AI(e,t=this,r,i){let n=this.strings,s=!1;if(void 0===n)(s=!h(e=O(this,e,t,0))||e!==this._$AH&&e!==_)&&(this._$AH=e);else{let i,a;let o=e;for(e=n[0],i=0;i"number"==typeof e&&!isNaN(e),a=e=>"string"==typeof e,o=e=>"function"==typeof e,c=e=>a(e)||o(e)?e:null,l=e=>(0,i.isValidElement)(e)||a(e)||o(e)||s(e);function u(e){let{enter:t,exit:r,appendPosition:n=!1,collapse:s=!0,collapseDuration:a=300}=e;return function(e){let{children:o,position:c,preventExitTransition:l,done:u,nodeRef:d,isIn:h,playToast:f}=e,p=n?`${t}--${c}`:t,g=n?`${r}--${c}`:r,m=(0,i.useRef)(0);return(0,i.useLayoutEffect)(()=>{let e=d.current,t=p.split(" "),r=i=>{i.target===d.current&&(f(),e.removeEventListener("animationend",r),e.removeEventListener("animationcancel",r),0===m.current&&"animationcancel"!==i.type&&e.classList.remove(...t))};e.classList.add(...t),e.addEventListener("animationend",r),e.addEventListener("animationcancel",r)},[]),(0,i.useEffect)(()=>{let e=d.current,t=()=>{e.removeEventListener("animationend",t),s?function(e,t,r){void 0===r&&(r=300);let{scrollHeight:i,style:n}=e;requestAnimationFrame(()=>{n.minHeight="initial",n.height=i+"px",n.transition=`all ${r}ms`,requestAnimationFrame(()=>{n.height="0",n.padding="0",n.margin="0",setTimeout(t,r)})})}(e,u,a):u()};h||(l?t():(m.current=1,e.className+=` ${g}`,e.addEventListener("animationend",t)))},[h]),i.createElement(i.Fragment,null,o)}}function d(e,t){return null!=e?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:t}:{}}let h=new Map,f=[],p=new Set,g=e=>p.forEach(t=>t(e)),m=()=>h.size>0;function b(e,t){var r;if(t)return!(null==(r=h.get(t))||!r.isToastActive(e));let i=!1;return h.forEach(t=>{t.isToastActive(e)&&(i=!0)}),i}function y(e,t){l(e)&&(m()||f.push({content:e,options:t}),h.forEach(r=>{r.buildToast(e,t)}))}function w(e,t){h.forEach(r=>{null!=t&&null!=t&&t.containerId?(null==t?void 0:t.containerId)===r.id&&r.toggle(e,null==t?void 0:t.id):r.toggle(e,null==t?void 0:t.id)})}function v(e){let{delay:t,isRunning:r,closeToast:s,type:a="default",hide:c,className:l,style:u,controlledProgress:d,progress:h,rtl:f,isIn:p,theme:g}=e,m=c||d&&0===h,b={...u,animationDuration:`${t}ms`,animationPlayState:r?"running":"paused"};d&&(b.transform=`scaleX(${h})`);let y=(0,n.Z)("Toastify__progress-bar",d?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${g}`,`Toastify__progress-bar--${a}`,{"Toastify__progress-bar--rtl":f}),w=o(l)?l({rtl:f,type:a,defaultClassName:y}):(0,n.Z)(y,l);return i.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":m},i.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${g} Toastify__progress-bar--${a}`}),i.createElement("div",{role:"progressbar","aria-hidden":m?"true":"false","aria-label":"notification timer",className:w,style:b,[d&&h>=1?"onTransitionEnd":"onAnimationEnd"]:d&&h<1?null:()=>{p&&s()}}))}let A=1,E=()=>""+A++;function C(e,t){return y(e,t),t.toastId}function _(e,t){return{...t,type:t&&t.type||e,toastId:t&&(a(t.toastId)||s(t.toastId))?t.toastId:E()}}function I(e){return(t,r)=>C(t,_(e,r))}function S(e,t){return C(e,_("default",t))}S.loading=(e,t)=>C(e,_("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),S.promise=function(e,t,r){let i,{pending:n,error:s,success:c}=t;n&&(i=a(n)?S.loading(n,r):S.loading(n.render,{...r,...n}));let l={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},u=(e,t,n)=>{if(null==t)return void S.dismiss(i);let s={type:e,...l,...r,data:n},o=a(t)?{render:t}:t;return i?S.update(i,{...s,...o}):S(o.render,{...s,...o}),n},d=o(e)?e():e;return d.then(e=>u("success",c,e)).catch(e=>u("error",s,e)),d},S.success=I("success"),S.info=I("info"),S.error=I("error"),S.warning=I("warning"),S.warn=S.warning,S.dark=(e,t)=>C(e,_("default",{theme:"dark",...t})),S.dismiss=function(e){!function(e){var t;if(m()){if(null==e||a(t=e)||s(t))h.forEach(t=>{t.removeToast(e)});else if(e&&("containerId"in e||"id"in e)){let t=h.get(e.containerId);t?t.removeToast(e.id):h.forEach(t=>{t.removeToast(e.id)})}}else f=f.filter(t=>null!=e&&t.options.toastId!==e)}(e)},S.clearWaitingQueue=function(e){void 0===e&&(e={}),h.forEach(t=>{!t.props.limit||e.containerId&&t.id!==e.containerId||t.clearQueue()})},S.isActive=b,S.update=function(e,t){void 0===t&&(t={});let r=((e,t)=>{var r;let{containerId:i}=t;return null==(r=h.get(i||1))?void 0:r.toasts.get(e)})(e,t);if(r){let{props:i,content:n}=r,s={delay:100,...i,...t,toastId:t.toastId||e,updateId:E()};s.toastId!==e&&(s.staleId=e);let a=s.render||n;delete s.render,C(a,s)}},S.done=e=>{S.update(e,{progress:1})},S.onChange=function(e){return p.add(e),()=>{p.delete(e)}},S.play=e=>w(!0,e),S.pause=e=>w(!1,e);let N="undefined"!=typeof window?i.useLayoutEffect:i.useEffect,T=e=>{let{theme:t,type:r,isLoading:n,...s}=e;return i.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"colored"===t?"currentColor":`var(--toastify-icon-color-${r})`,...s})},P={info:function(e){return i.createElement(T,{...e},i.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(e){return i.createElement(T,{...e},i.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(e){return i.createElement(T,{...e},i.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(e){return i.createElement(T,{...e},i.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return i.createElement("div",{className:"Toastify__spinner"})}},x=e=>{let{isRunning:t,preventExitTransition:r,toastRef:s,eventHandlers:a,playToast:c}=function(e){var t,r;let[n,s]=(0,i.useState)(!1),[a,o]=(0,i.useState)(!1),c=(0,i.useRef)(null),l=(0,i.useRef)({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:u,pauseOnHover:d,closeToast:f,onClick:p,closeOnClick:g}=e;function m(){s(!0)}function b(){s(!1)}function y(t){let r=c.current;l.canDrag&&r&&(l.didMove=!0,n&&b(),l.delta="x"===e.draggableDirection?t.clientX-l.start:t.clientY-l.start,l.start!==t.clientX&&(l.canCloseOnClick=!1),r.style.transform=`translate3d(${"x"===e.draggableDirection?`${l.delta}px, var(--y)`:`0, calc(${l.delta}px + var(--y))`},0)`,r.style.opacity=""+(1-Math.abs(l.delta/l.removalDistance)))}function w(){document.removeEventListener("pointermove",y),document.removeEventListener("pointerup",w);let t=c.current;if(l.canDrag&&l.didMove&&t){if(l.canDrag=!1,Math.abs(l.delta)>l.removalDistance)return o(!0),e.closeToast(),void e.collapseAll();t.style.transition="transform 0.2s, opacity 0.2s",t.style.removeProperty("transform"),t.style.removeProperty("opacity")}}null==(r=h.get((t={id:e.toastId,containerId:e.containerId,fn:s}).containerId||1))||r.setToggle(t.id,t.fn),(0,i.useEffect)(()=>{if(e.pauseOnFocusLoss)return document.hasFocus()||b(),window.addEventListener("focus",m),window.addEventListener("blur",b),()=>{window.removeEventListener("focus",m),window.removeEventListener("blur",b)}},[e.pauseOnFocusLoss]);let v={onPointerDown:function(t){if(!0===e.draggable||e.draggable===t.pointerType){l.didMove=!1,document.addEventListener("pointermove",y),document.addEventListener("pointerup",w);let r=c.current;l.canCloseOnClick=!0,l.canDrag=!0,r.style.transition="none","x"===e.draggableDirection?(l.start=t.clientX,l.removalDistance=r.offsetWidth*(e.draggablePercent/100)):(l.start=t.clientY,l.removalDistance=r.offsetHeight*(80===e.draggablePercent?1.5*e.draggablePercent:e.draggablePercent)/100)}},onPointerUp:function(t){let{top:r,bottom:i,left:n,right:s}=c.current.getBoundingClientRect();"touchend"!==t.nativeEvent.type&&e.pauseOnHover&&t.clientX>=n&&t.clientX<=s&&t.clientY>=r&&t.clientY<=i?b():m()}};return u&&d&&(v.onMouseEnter=b,e.stacked||(v.onMouseLeave=m)),g&&(v.onClick=e=>{p&&p(e),l.canCloseOnClick&&f()}),{playToast:m,pauseToast:b,isRunning:n,preventExitTransition:a,toastRef:c,eventHandlers:v}}(e),{closeButton:l,children:u,autoClose:d,onClick:f,type:p,hideProgressBar:g,closeToast:m,transition:b,position:y,className:w,style:A,bodyClassName:E,bodyStyle:C,progressClassName:_,progressStyle:I,updateId:S,role:N,progress:T,rtl:x,toastId:O,deleteToast:R,isIn:k,isLoading:D,closeOnClick:M,theme:U}=e,L=(0,n.Z)("Toastify__toast",`Toastify__toast-theme--${U}`,`Toastify__toast--${p}`,{"Toastify__toast--rtl":x},{"Toastify__toast--close-on-click":M}),B=o(w)?w({rtl:x,position:y,type:p,defaultClassName:L}):(0,n.Z)(L,w),j=function(e){let{theme:t,type:r,isLoading:n,icon:s}=e,a=null,c={theme:t,type:r};return!1===s||(o(s)?a=s({...c,isLoading:n}):(0,i.isValidElement)(s)?a=(0,i.cloneElement)(s,c):n?a=P.spinner():r in P&&(a=P[r](c))),a}(e),$=!!T||!d,F={closeToast:m,type:p,theme:U},q=null;return!1===l||(q=o(l)?l(F):(0,i.isValidElement)(l)?(0,i.cloneElement)(l,F):function(e){let{closeToast:t,theme:r,ariaLabel:n="close"}=e;return i.createElement("button",{className:`Toastify__close-button Toastify__close-button--${r}`,type:"button",onClick:e=>{e.stopPropagation(),t(e)},"aria-label":n},i.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},i.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}(F)),i.createElement(b,{isIn:k,done:R,position:y,preventExitTransition:r,nodeRef:s,playToast:c},i.createElement("div",{id:O,onClick:f,"data-in":k,className:B,...a,style:A,ref:s},i.createElement("div",{...k&&{role:N},className:o(E)?E({type:p}):(0,n.Z)("Toastify__toast-body",E),style:C},null!=j&&i.createElement("div",{className:(0,n.Z)("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!D})},j),i.createElement("div",null,u)),q,i.createElement(v,{...S&&!$?{key:`pb-${S}`}:{},rtl:x,theme:U,delay:d,isRunning:t,isIn:k,closeToast:m,hide:g,type:p,style:I,className:_,controlledProgress:$,progress:T||0})))},O=function(e,t){return void 0===t&&(t=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}},R=u(O("bounce",!0)),k=(u(O("slide",!0)),u(O("zoom")),u(O("flip")),{position:"top-right",transition:R,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"});function D(e){let t={...k,...e},r=e.stacked,[u,p]=(0,i.useState)(!0),m=(0,i.useRef)(null),{getToastToRender:w,isToastActive:v,count:A}=function(e){let{subscribe:t,getSnapshot:r,setProps:n}=(0,i.useRef)(function(e){let t=e.containerId||1;return{subscribe(r){let n=function(e,t,r){let n=1,u=0,h=[],f=[],p=[],g=t,m=new Map,b=new Set,y=()=>{p=Array.from(m.values()),b.forEach(e=>e())},w=e=>{f=null==e?[]:f.filter(t=>t!==e),y()},v=e=>{let{toastId:t,onOpen:n,updateId:s,children:a}=e.props,c=null==s;e.staleId&&m.delete(e.staleId),m.set(t,e),f=[...f,e.props.toastId].filter(t=>t!==e.staleId),y(),r(d(e,c?"added":"updated")),c&&o(n)&&n((0,i.isValidElement)(a)&&a.props)};return{id:e,props:g,observe:e=>(b.add(e),()=>b.delete(e)),toggle:(e,t)=>{m.forEach(r=>{null!=t&&t!==r.props.toastId||o(r.toggle)&&r.toggle(e)})},removeToast:w,toasts:m,clearQueue:()=>{u-=h.length,h=[]},buildToast:(t,f)=>{var p,b;if((t=>{let{containerId:r,toastId:i,updateId:n}=t,s=m.has(i)&&null==n;return(r?r!==e:1!==e)||s})(f))return;let{toastId:A,updateId:E,data:C,staleId:_,delay:I}=f,S=()=>{w(A)},N=null==E;N&&u++;let T={...g,style:g.toastStyle,key:n++,...Object.fromEntries(Object.entries(f).filter(e=>{let[t,r]=e;return null!=r})),toastId:A,updateId:E,data:C,closeToast:S,isIn:!1,className:c(f.className||g.toastClassName),bodyClassName:c(f.bodyClassName||g.bodyClassName),progressClassName:c(f.progressClassName||g.progressClassName),autoClose:!f.isLoading&&(p=f.autoClose,b=g.autoClose,!1===p||s(p)&&p>0?p:b),deleteToast(){let e=m.get(A),{onClose:t,children:n}=e.props;o(t)&&t((0,i.isValidElement)(n)&&n.props),r(d(e,"removed")),m.delete(A),--u<0&&(u=0),h.length>0?v(h.shift()):y()}};T.closeButton=g.closeButton,!1===f.closeButton||l(f.closeButton)?T.closeButton=f.closeButton:!0===f.closeButton&&(T.closeButton=!l(g.closeButton)||g.closeButton);let P=t;(0,i.isValidElement)(t)&&!a(t.type)?P=(0,i.cloneElement)(t,{closeToast:S,toastProps:T,data:C}):o(t)&&(P=t({closeToast:S,toastProps:T,data:C}));let x={content:P,props:T,staleId:_};g.limit&&g.limit>0&&u>g.limit&&N?h.push(x):s(I)?setTimeout(()=>{v(x)},I):v(x)},setProps(e){g=e},setToggle:(e,t)=>{m.get(e).toggle=t},isToastActive:e=>f.some(t=>t===e),getSnapshot:()=>p}}(t,e,g);h.set(t,n);let u=n.observe(r);return f.forEach(e=>y(e.content,e.options)),f=[],()=>{u(),h.delete(t)}},setProps(e){var r;null==(r=h.get(t))||r.setProps(e)},getSnapshot(){var e;return null==(e=h.get(t))?void 0:e.getSnapshot()}}}(e)).current;n(e);let u=(0,i.useSyncExternalStore)(t,r,r);return{getToastToRender:function(t){if(!u)return[];let r=new Map;return e.newestOnTop&&u.reverse(),u.forEach(e=>{let{position:t}=e.props;r.has(t)||r.set(t,[]),r.get(t).push(e)}),Array.from(r,e=>t(e[0],e[1]))},isToastActive:b,count:null==u?void 0:u.length}}(t),{className:E,style:C,rtl:_,containerId:I}=t;function T(){r&&(p(!0),S.play())}return N(()=>{if(r){var e;let r=m.current.querySelectorAll('[data-in="true"]'),i=null==(e=t.position)?void 0:e.includes("top"),n=0,s=0;Array.from(r).reverse().forEach((e,t)=>{e.classList.add("Toastify__toast--stacked"),t>0&&(e.dataset.collapsed=`${u}`),e.dataset.pos||(e.dataset.pos=i?"top":"bot");let r=n*(u?.2:1)+(u?0:12*t);e.style.setProperty("--y",`${i?r:-1*r}px`),e.style.setProperty("--g","12"),e.style.setProperty("--s",""+(1-(u?s:0))),n+=e.offsetHeight,s+=.025})}},[u,A,r]),i.createElement("div",{ref:m,className:"Toastify",id:I,onMouseEnter:()=>{r&&(p(!1),S.pause())},onMouseLeave:T},w((e,t)=>{let s=t.length?{...C}:{...C,pointerEvents:"none"};return i.createElement("div",{className:function(e){let t=(0,n.Z)("Toastify__toast-container",`Toastify__toast-container--${e}`,{"Toastify__toast-container--rtl":_});return o(E)?E({position:e,rtl:_,defaultClassName:t}):(0,n.Z)(t,c(E))}(e),style:s,key:`container-${e}`},t.map(e=>{let{content:t,props:n}=e;return i.createElement(x,{...n,stacked:r,collapseAll:T,isIn:v(n.toastId,n.containerId),style:n.style,key:`toast-${n.key}`},t)}))}))}},86949:function(e,t,r){"use strict";r.d(t,{CO:function(){return u},Ld:function(){return l},iH:function(){return d},sj:function(){return c}});var i=r(72478);let n=e=>"object"==typeof e&&null!==e,s=new WeakMap,a=new WeakSet,[o]=((e=Object.is,t=(e,t)=>new Proxy(e,t),r=e=>n(e)&&!a.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer),o=e=>{switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e}},c=new WeakMap,l=(e,t,r=o)=>{let n=c.get(e);if((null==n?void 0:n[0])===t)return n[1];let u=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));return(0,i.jc)(u,!0),c.set(e,[t,u]),Reflect.ownKeys(e).forEach(t=>{if(Object.getOwnPropertyDescriptor(u,t))return;let n=Reflect.get(e,t),{enumerable:o}=Reflect.getOwnPropertyDescriptor(e,t),c={value:n,enumerable:o,configurable:!0};if(a.has(n))(0,i.jc)(n,!1);else if(n instanceof Promise)delete c.value,c.get=()=>r(n);else if(s.has(n)){let[e,t]=s.get(n);c.value=l(e,t(),r)}Object.defineProperty(u,t,c)}),Object.preventExtensions(u)},u=new WeakMap,d=[1,1],h=o=>{if(!n(o))throw Error("object required");let c=u.get(o);if(c)return c;let f=d[0],p=new Set,g=(e,t=++d[0])=>{f!==t&&(f=t,p.forEach(r=>r(e,t)))},m=d[1],b=(e=++d[1])=>(m===e||p.size||(m=e,w.forEach(([t])=>{let r=t[1](e);r>f&&(f=r)})),f),y=e=>(t,r)=>{let i=[...t];i[1]=[e,...i[1]],g(i,r)},w=new Map,v=(e,t)=>{if(w.has(e))throw Error("prop listener already exists");if(p.size){let r=t[3](y(e));w.set(e,[t,r])}else w.set(e,[t])},A=e=>{var t;let r=w.get(e);r&&(w.delete(e),null==(t=r[1])||t.call(r))},E=e=>{p.add(e),1===p.size&&w.forEach(([e,t],r)=>{if(t)throw Error("remove already exists");let i=e[3](y(r));w.set(r,[e,i])});let t=()=>{p.delete(e),0===p.size&&w.forEach(([e,t],r)=>{t&&(t(),w.set(r,[e]))})};return t},C=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),_={deleteProperty(e,t){let r=Reflect.get(e,t);A(t);let i=Reflect.deleteProperty(e,t);return i&&g(["delete",[t],r]),i},set(t,o,c,l){let d=Reflect.has(t,o),f=Reflect.get(t,o,l);if(d&&(e(f,c)||u.has(c)&&e(f,u.get(c))))return!0;A(o),n(c)&&(c=(0,i.o5)(c)||c);let p=c;if(c instanceof Promise)c.then(e=>{c.status="fulfilled",c.value=e,g(["resolve",[o],e])}).catch(e=>{c.status="rejected",c.reason=e,g(["reject",[o],e])});else{!s.has(c)&&r(c)&&(p=h(c));let e=!a.has(p)&&s.get(p);e&&v(o,e)}return Reflect.set(t,o,p,l),g(["set",[o],c,f]),!0}},I=t(C,_);u.set(o,I);let S=[C,b,l,E];return s.set(I,S),Reflect.ownKeys(o).forEach(e=>{let t=Object.getOwnPropertyDescriptor(o,e);"value"in t&&(I[e]=o[e],delete t.value,delete t.writable),Object.defineProperty(C,e,t)}),I})=>[h,s,a,e,t,r,o,c,l,u,d])();function c(e={}){return o(e)}function l(e,t,r){let i;let n=s.get(e);n||console.warn("Please use proxy object");let a=[],o=n[3],c=!1,l=o(e=>{if(a.push(e),r){t(a.splice(0));return}i||(i=Promise.resolve().then(()=>{i=void 0,c&&t(a.splice(0))}))});return c=!0,()=>{c=!1,l()}}function u(e,t){let r=s.get(e);r||console.warn("Please use proxy object");let[i,n,a]=r;return a(i,n(),t)}function d(e){return a.add(e),e}},73932:function(e,t,r){"use strict";r.d(t,{VW:function(){return n},Yr:function(){return s}});var i=r(86949);function n(e,t,r,n){let s=e[t];return(0,i.Ld)(e,()=>{let i=e[t];Object.is(s,i)||r(s=i)},n)}function s(e){let t=(0,i.sj)({data:Array.from(e||[]),has(e){return this.data.some(t=>t[0]===e)},set(e,t){let r=this.data.find(t=>t[0]===e);return r?r[1]=t:this.data.push([e,t]),this},get(e){var t;return null==(t=this.data.find(t=>t[0]===e))?void 0:t[1]},delete(e){let t=this.data.findIndex(t=>t[0]===e);return -1!==t&&(this.data.splice(t,1),!0)},clear(){this.data.splice(0)},get size(){return this.data.length},toJSON(){return new Map(this.data)},forEach(e){this.data.forEach(t=>{e(t[1],t[0],this)})},keys(){return this.data.map(e=>e[0]).values()},values(){return this.data.map(e=>e[1]).values()},entries(){return new Map(this.data).entries()},get[Symbol.toStringTag](){return"Map"},[Symbol.iterator](){return this.entries()}});return Object.defineProperties(t,{data:{enumerable:!1},size:{enumerable:!1},toJSON:{enumerable:!1}}),Object.seal(t),t}Symbol()},14503:function(e,t,r){"use strict";function i(e){return"string"==typeof e?{address:e,type:"json-rpc"}:e}r.d(t,{T:function(){return i}})},47607:function(e,t,r){"use strict";r.d(t,{R:function(){return ei}});var i=r(84917);let n=/^error (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/,s=/^event (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/,a=/^function (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)(?: (?external|public{1}))?(?: (?pure|view|nonpayable|payable{1}))?(?: returns\s?\((?.*?)\))?$/,o=/^struct (?[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?.*?)\}$/,c=/^constructor\((?.*?)\)(?:\s(?payable{1}))?$/,l=/^fallback\(\) external(?:\s(?payable{1}))?$/,u=/^receive\(\) external payable$/,d=new Set(["indexed"]),h=new Set(["calldata","memory","storage"]);class f extends Error{constructor(e,t={}){let r=t.cause instanceof f?t.cause.details:t.cause?.message?t.cause.message:t.details,i=t.cause instanceof f&&t.cause.docsPath||t.docsPath;super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...i?[`Docs: https://abitype.dev${i}`]:[],...r?[`Details: ${r}`]:[],"Version: abitype@1.0.8"].join("\n")),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),t.cause&&(this.cause=t.cause),this.details=r,this.docsPath=i,this.metaMessages=t.metaMessages,this.shortMessage=e}}class p extends f{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class g extends f{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class m extends f{constructor({param:e}){super("Invalid ABI parameter.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class b extends f{constructor({param:e,name:t}){super("Invalid ABI parameter.",{details:e,metaMessages:[`"${t}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class y extends f{constructor({param:e,type:t,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${t?` in "${t}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class w extends f{constructor({param:e,type:t,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${t?` in "${t}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class v extends f{constructor({abiParameter:e}){super("Invalid ABI parameter.",{details:JSON.stringify(e,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class A extends f{constructor({signature:e,type:t}){super(`Invalid ${t} signature.`,{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class E extends f{constructor({signature:e}){super("Unknown signature.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class C extends f{constructor({signature:e}){super("Invalid struct signature.",{details:e,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class _ extends f{constructor({type:e}){super("Circular reference detected.",{metaMessages:[`Struct "${e}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class I extends f{constructor({current:e,depth:t}){super("Unbalanced parentheses.",{metaMessages:[`"${e.trim()}" has too many ${t>0?"opening":"closing"} parentheses.`],details:`Depth "${t}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}let S=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]),N=/^(?[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,T=/^\((?.+?)\)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,P=/^u?int$/;function x(e,t){var r,n;let s;let a=function(e,t,r){let i="";if(r)for(let e of Object.entries(r)){if(!e)continue;let t="";for(let r of e[1])t+=`[${r.type}${r.name?`:${r.name}`:""}]`;i+=`(${e[0]}{${t}})`}return t?`${t}:${e}${i}`:e}(e,t?.type,t?.structs);if(S.has(a))return S.get(a);let o=i.cN.test(e),c=(0,i.Zw)(o?T:N,e);if(!c)throw new m({param:e});if(c.name&&("address"===(r=c.name)||"bool"===r||"function"===r||"string"===r||"tuple"===r||i.eL.test(r)||i.lh.test(r)||k.test(r)))throw new b({param:e,name:c.name});let l=c.name?{name:c.name}:{},u="indexed"===c.modifier?{indexed:!0}:{},d=t?.structs??{},f={};if(o){s="tuple";let e=O(c.type),t=[],r=e.length;for(let i=0;i[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?$/;function M(e){let t=function(e){let t={},r=e.length;for(let n=0;n"type"in e&&"constructor"===e.type);if(!n)throw new q.fM({docsPath:W});if(!("inputs"in n)||!n.inputs||0===n.inputs.length)throw new q.cO({docsPath:W});let s=(0,H.E)(n.inputs,r);return(0,z.SM)([i,s])}var G=r(55629),K=r(47864),Q=r(92106),Y=r(26445),Z=r(87469),J=r(61163),X=r(74688),ee=r(32357),et=r(50150),er=r(47531);async function ei(e,t){let{account:i=e.account,batch:n=!!e.batch?.multicall,blockNumber:s,blockTag:a="latest",accessList:o,blobs:c,code:l,data:u,factory:d,factoryData:h,gas:f,gasPrice:p,maxFeePerBlobGas:g,maxFeePerGas:m,maxPriorityFeePerGas:b,nonce:y,to:w,value:v,stateOverride:A,...E}=t,C=i?(0,U.T)(i):void 0;if(l&&(d||h))throw new B.G("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(l&&w)throw new B.G("Cannot provide both `code` & `to` as parameters.");let _=l&&u,I=d&&h&&w&&u,S=_||I,N=_?function(e){let{code:t,data:r}=e;return V({abi:M(["constructor(bytes, bytes)"]),bytecode:"0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",args:[t,r]})}({code:l,data:u}):I?function(e){let{data:t,factory:r,factoryData:i,to:n}=e;return V({abi:M(["constructor(address, bytes, address, bytes)"]),bytecode:"0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",args:[n,t,r,i]})}({data:u,factory:d,factoryData:h,to:w}):u;try{(0,er.F)(t);let r=(s?(0,Q.eC)(s):void 0)||a,i=(0,et.mF)(A),l=e.chain?.formatters?.transactionRequest?.format,u=(l||X.tG)({...(0,J.K)(E,{format:l}),from:C?.address,accessList:o,blobs:c,data:N,gas:f,gasPrice:p,maxFeePerBlobGas:g,maxFeePerGas:m,maxPriorityFeePerGas:b,nonce:y,to:S?void 0:w,value:v});if(n&&function({request:e}){let{data:t,to:r,...i}=e;return!(!t||t.startsWith("0x82ad56cb"))&&!!r&&!(Object.values(i).filter(e=>void 0!==e).length>0)}({request:u})&&!i)try{return await en(e,{...u,blockNumber:s,blockTag:a})}catch(e){if(!(e instanceof j.pZ)&&!(e instanceof j.mm))throw e}let d=await e.request({method:"eth_call",params:i?[u,r,i]:[u,r]});if("0x"===d)return{data:void 0};return{data:d}}catch(a){let i=function(e){if(!(e instanceof B.G))return;let t=e.walk();return"object"==typeof t?.data?t.data?.data:t.data}(a),{offchainLookup:n,offchainLookupSignature:s}=await r.e(1785).then(r.bind(r,21785));if(!1!==e.ccipRead&&i?.slice(0,10)===s&&w)return{data:await n(e,{data:i,to:w})};if(S&&i?.slice(0,10)==="0x101bb98d")throw new $.Mo({factory:d});throw function(e,{docsPath:t,...r}){let i=(()=>{let t=(0,Z.k)(e,r);return t instanceof Y.cj?e:t})();return new $.cg(i,{docsPath:t,...r})}(a,{...t,account:C,chain:e.chain})}}async function en(e,t){let{batchSize:r=1024,wait:i=0}="object"==typeof e.batch?.multicall?e.batch.multicall:{},{blockNumber:n,blockTag:s="latest",data:a,multicallAddress:o,to:c}=t,l=o;if(!l){if(!e.chain)throw new j.pZ;l=(0,K.L)({blockNumber:n,chain:e.chain,contract:"multicall3"})}let u=(n?(0,Q.eC)(n):void 0)||s,{schedule:d}=(0,ee.S)({id:`${e.uid}.${u}`,wait:i,shouldSplitBatch:e=>e.reduce((e,{data:t})=>e+(t.length-2),0)>2*r,fn:async t=>{let r=t.map(e=>({allowFailure:!0,callData:e.data,target:e.to})),i=(0,G.R)({abi:L.F8,args:[r],functionName:"aggregate3"}),n=await e.request({method:"eth_call",params:[{data:i,to:l},u]});return(0,F.k)({abi:L.F8,args:[r],functionName:"aggregate3",data:n||"0x"})}}),[{returnData:h,success:f}]=await d({data:a,to:c});if(!f)throw new $.VQ({data:h});return"0x"===h?{data:void 0}:{data:h}}},81841:function(e,t,r){"use strict";r.d(t,{Q:function(){return w}});var i=r(14503),n=r(36117),s=r(46257),a=r(92106),o=r(39625),c=r(67795),l=r(33639);class u extends n.G{constructor(e,{account:t,docsPath:r,chain:i,data:n,gas:s,gasPrice:a,maxFeePerGas:u,maxPriorityFeePerGas:d,nonce:h,to:f,value:p}){super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",(0,l.xr)({from:t?.address,to:f,value:void 0!==p&&`${(0,o.d)(p)} ${i?.nativeCurrency?.symbol||"ETH"}`,data:n,gas:s,gasPrice:void 0!==a&&`${(0,c.o)(a)} gwei`,maxFeePerGas:void 0!==u&&`${(0,c.o)(u)} gwei`,maxPriorityFeePerGas:void 0!==d&&`${(0,c.o)(d)} gwei`,nonce:h})].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}var d=r(26445),h=r(87469),f=r(61163),p=r(74688),g=r(50150),m=r(47531),b=r(41342),y=r(88930);async function w(e,t){let{account:r=e.account}=t,o=r?(0,i.T)(r):void 0;try{let{accessList:r,authorizationList:i,blobs:l,blobVersionedHashes:u,blockNumber:d,blockTag:h,data:w,gas:v,gasPrice:A,maxFeePerBlobGas:E,maxFeePerGas:C,maxPriorityFeePerGas:_,nonce:I,value:S,stateOverride:N,...T}=await (0,b.ZE)(e,{...t,parameters:o?.type==="local"?void 0:["blobVersionedHashes"]}),P=(d?(0,a.eC)(d):void 0)||h,x=(0,g.mF)(N),O=await (async()=>T.to?T.to:i&&i.length>0?await (0,s.z)({authorization:i[0]}).catch(()=>{throw new n.G("`to` is required. Could not infer from `authorizationList`")}):void 0)();(0,m.F)(t);let R=e.chain?.formatters?.transactionRequest?.format,k=(R||p.tG)({...(0,f.K)(T,{format:R}),from:o?.address,accessList:r,authorizationList:i,blobs:l,blobVersionedHashes:u,data:w,gas:v,gasPrice:A,maxFeePerBlobGas:E,maxFeePerGas:C,maxPriorityFeePerGas:_,nonce:I,to:O,value:S});function c(t){let{block:r,request:i,rpcStateOverride:n}=t;return e.request({method:"eth_estimateGas",params:n?[i,r??"latest",n]:r?[i,r]:[i]})}let D=BigInt(await c({block:P,request:k,rpcStateOverride:x}));if(i){let t=await (0,y.s)(e,{address:k.from}),r=await Promise.all(i.map(async e=>{let{address:r}=e,i=await c({block:P,request:{authorizationList:void 0,data:w,from:o?.address,to:r,value:(0,a.eC)(t)},rpcStateOverride:x}).catch(()=>100000n);return 2n*BigInt(i)}));D+=r.reduce((e,t)=>e+t,0n)}return D}catch(r){throw function(e,{docsPath:t,...r}){return new u((()=>{let t=(0,h.k)(e,r);return t instanceof d.cj?e:t})(),{docsPath:t,...r})}(r,{...t,account:o,chain:e.chain})}}},88930:function(e,t,r){"use strict";r.d(t,{s:function(){return n}});var i=r(92106);async function n(e,{address:t,blockNumber:r,blockTag:n="latest"}){let s=r?(0,i.eC)(r):void 0;return BigInt(await e.request({method:"eth_getBalance",params:[t,s||n]}))}},68240:function(e,t,r){"use strict";r.d(t,{Q:function(){return a}});var i=r(79814),n=r(92106),s=r(6073);async function a(e,{blockHash:t,blockNumber:r,blockTag:a,includeTransactions:o}={}){let c=o??!1,l=void 0!==r?(0,n.eC)(r):void 0,u=null;if(!(u=t?await e.request({method:"eth_getBlockByHash",params:[t,c]},{dedupe:!0}):await e.request({method:"eth_getBlockByNumber",params:[l||(a??"latest"),c]},{dedupe:!!l})))throw new i.f({blockHash:t,blockNumber:r});return(e.chain?.formatters?.block?.format||function(e){let t=(e.transactions??[]).map(e=>"string"==typeof e?e:(0,s.Tr)(e));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:t,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}})(u)}},79524:function(e,t,r){"use strict";r.d(t,{L:function(){return n}});var i=r(95946);async function n(e){let t=await e.request({method:"eth_chainId"},{dedupe:!0});return(0,i.ly)(t)}},88819:function(e,t,r){"use strict";r.d(t,{L:function(){return c}});var i=r(7210),n=r(55629),s=r(72365),a=r(93714),o=r(47607);async function c(e,t){let{abi:r,address:c,args:l,functionName:u,...d}=t,h=(0,n.R)({abi:r,args:l,functionName:u});try{let{data:t}=await (0,a.s)(e,o.R,"call")({...d,data:h,to:c});return(0,i.k)({abi:r,args:l,functionName:u,data:t||"0x"})}catch(e){throw(0,s.S)(e,{abi:r,address:c,args:l,docsPath:"/docs/contract/readContract",functionName:u})}}},41342:function(e,t,r){"use strict";r.d(t,{QZ:function(){return x},ZE:function(){return R}});var i=r(14503),n=r(67795),s=r(36117);class a extends s.G{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class o extends s.G{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class c extends s.G{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${(0,n.o)(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}var l=r(93714),u=r(95946),d=r(68240);async function h(e){return BigInt(await e.request({method:"eth_gasPrice"}))}async function f(e,t){let{block:r,chain:i=e.chain,request:n}=t||{};try{let t=i?.fees?.maxPriorityFeePerGas??i?.fees?.defaultPriorityFee;if("function"==typeof t){let i=r||await (0,l.s)(e,d.Q,"getBlock")({}),s=await t({block:i,client:e,request:n});if(null===s)throw Error();return s}if(void 0!==t)return t;let s=await e.request({method:"eth_maxPriorityFeePerGas"});return(0,u.y_)(s)}catch{let[t,i]=await Promise.all([r?Promise.resolve(r):(0,l.s)(e,d.Q,"getBlock")({}),(0,l.s)(e,h,"getGasPrice")({})]);if("bigint"!=typeof t.baseFeePerGas)throw new o;let n=i-t.baseFeePerGas;if(n<0n)return 0n;return n}}async function p(e,t){let{block:r,chain:i=e.chain,request:n,type:s="eip1559"}=t||{},c=await (async()=>"function"==typeof i?.fees?.baseFeeMultiplier?i.fees.baseFeeMultiplier({block:r,client:e,request:n}):i?.fees?.baseFeeMultiplier??1.2)();if(c<1)throw new a;let u=10**(c.toString().split(".")[1]?.length??0),p=e=>e*BigInt(Math.ceil(c*u))/BigInt(u),g=r||await (0,l.s)(e,d.Q,"getBlock")({});if("function"==typeof i?.fees?.estimateFeesPerGas){let t=await i.fees.estimateFeesPerGas({block:r,client:e,multiply:p,request:n,type:s});if(null!==t)return t}if("eip1559"===s){if("bigint"!=typeof g.baseFeePerGas)throw new o;let t="bigint"==typeof n?.maxPriorityFeePerGas?n.maxPriorityFeePerGas:await f(e,{block:g,chain:i,request:n}),r=p(g.baseFeePerGas);return{maxFeePerGas:n?.maxFeePerGas??r+t,maxPriorityFeePerGas:t}}return{gasPrice:n?.gasPrice??p(await (0,l.s)(e,h,"getGasPrice")({}))}}var g=r(81841),m=r(92106);async function b(e,{address:t,blockTag:r="latest",blockNumber:i}){let n=await e.request({method:"eth_getTransactionCount",params:[t,i?(0,m.eC)(i):r]},{dedupe:!!i});return(0,u.ly)(n)}var y=r(11187);function w(e){let{kzg:t}=e,r=e.to??("string"==typeof e.blobs[0]?"hex":"bytes"),i="string"==typeof e.blobs[0]?e.blobs.map(e=>(0,y.nr)(e)):e.blobs,n=[];for(let e of i)n.push(Uint8Array.from(t.blobToKzgCommitment(e)));return"bytes"===r?n:n.map(e=>(0,m.ci)(e))}function v(e){let{kzg:t}=e,r=e.to??("string"==typeof e.blobs[0]?"hex":"bytes"),i="string"==typeof e.blobs[0]?e.blobs.map(e=>(0,y.nr)(e)):e.blobs,n="string"==typeof e.commitments[0]?e.commitments.map(e=>(0,y.nr)(e)):e.commitments,s=[];for(let e=0;e(0,m.ci)(e))}var A=r(3868),E=r(15102);class C extends s.G{constructor({maxSize:e,size:t}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${t} bytes`],name:"BlobSizeTooLargeError"})}}class _ extends s.G{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}var I=r(11221),S=r(39135),N=r(47531),T=r(33639),P=r(79524);let x=["blobVersionedHashes","chainId","fees","gas","nonce","type"],O=new Map;async function R(e,t){let r,n;let{account:s=e.account,blobs:a,chain:u,gas:h,kzg:f,nonce:R,nonceManager:k,parameters:D=x,type:M}=t,U=s?(0,i.T)(s):s,L={...t,...U?{from:U?.address}:{}};async function B(){return r||(r=await (0,l.s)(e,d.Q,"getBlock")({blockTag:"latest"}))}async function j(){return n||(u?u.id:void 0!==t.chainId?t.chainId:n=await (0,l.s)(e,P.L,"getChainId")({}))}if(D.includes("nonce")&&void 0===R&&U){if(k){let t=await j();L.nonce=await k.consume({address:U.address,chainId:t,client:e})}else L.nonce=await (0,l.s)(e,b,"getTransactionCount")({address:U.address,blockTag:"pending"})}if((D.includes("blobVersionedHashes")||D.includes("sidecars"))&&a&&f){let e=w({blobs:a,kzg:f});if(D.includes("blobVersionedHashes")){let t=function(e){let{commitments:t,version:r}=e,i=e.to??("string"==typeof t[0]?"hex":"bytes"),n=[];for(let e of t)n.push(function(e){let{commitment:t,version:r=1}=e,i=e.to??("string"==typeof t?"hex":"bytes"),n=function(e,t){let r=(0,A.JQ)((0,E.v)(e,{strict:!1})?(0,y.O0)(e):e);return"bytes"===(t||"hex")?r:(0,m.NC)(r)}(t,"bytes");return n.set([r],0),"bytes"===i?n:(0,m.ci)(n)}({commitment:e,to:i,version:r}));return n}({commitments:e,to:"hex"});L.blobVersionedHashes=t}if(D.includes("sidecars")){let t=v({blobs:a,commitments:e,kzg:f}),r=function(e){let{data:t,kzg:r,to:i}=e,n=e.blobs??function(e){let t=e.to??("string"==typeof e.data?"hex":"bytes"),r="string"==typeof e.data?(0,y.nr)(e.data):e.data,i=(0,S.d)(r);if(!i)throw new _;if(i>761855)throw new C({maxSize:761855,size:i});let n=[],s=!0,a=0;for(;s;){let e=(0,I.q)(new Uint8Array(131072)),t=0;for(;t<4096;){let i=r.slice(a,a+31);if(e.pushByte(0),e.pushBytes(i),i.length<31){e.pushByte(128),s=!1;break}t++,a+=31}n.push(e)}return"bytes"===t?n.map(e=>e.bytes):n.map(e=>(0,m.ci)(e.bytes))}({data:t,to:i}),s=e.commitments??w({blobs:n,kzg:r,to:i}),a=e.proofs??v({blobs:n,commitments:s,kzg:r,to:i}),o=[];for(let e=0;et.to?t.to:null!==t.to&&A&&A.length>0?await (0,a.z)({authorization:A[0]}).catch(()=>{throw new s.G("`to` is required. Could not infer from `authorizationList`.")}):void 0)();if(R?.type==="json-rpc"||null===R){let t;null!==p&&(t=await (0,f.s)(e,m.L,"getChainId")({}),function({chain:e,currentChainId:t}){if(!e)throw new o.Bk;if(t!==e.id)throw new o.Yl({chain:e,currentChainId:t})}({currentChainId:t,chain:p}));let i=e.chain?.formatters?.transactionRequest?.format,n=(i||h.tG)({...(0,d.K)(O,{format:i}),accessList:v,authorizationList:A,blobs:E,chainId:t,data:C,from:R?.address,gas:_,gasPrice:I,maxFeePerBlobGas:S,maxFeePerGas:N,maxPriorityFeePerGas:T,nonce:P,to:r,value:x}),s=w.get(e.uid);try{return await e.request({method:s?"wallet_sendTransaction":"eth_sendTransaction",params:[n]},{retryCount:0})}catch(t){if(!1===s)throw t;if("InvalidInputRpcError"===t.name||"InvalidParamsRpcError"===t.name||"MethodNotFoundRpcError"===t.name||"MethodNotSupportedRpcError"===t.name)return await e.request({method:"wallet_sendTransaction",params:[n]},{retryCount:0}).then(t=>(w.set(e.uid,!0),t)).catch(r=>{if("MethodNotFoundRpcError"===r.name||"MethodNotSupportedRpcError"===r.name)throw w.set(e.uid,!1),t;throw r});throw t}}if(R?.type==="local"){let t=await (0,f.s)(e,b.ZE,"prepareTransactionRequest")({account:R,accessList:v,authorizationList:A,blobs:E,chain:p,data:C,gas:_,gasPrice:I,maxFeePerBlobGas:S,maxFeePerGas:N,maxPriorityFeePerGas:T,nonce:P,nonceManager:R.nonceManager,parameters:[...b.QZ,"sidecars"],value:x,...O,to:r}),i=p?.serializers?.transaction,n=await R.signTransaction(t,{serializer:i});return await (0,f.s)(e,y,"sendRawTransaction")({serializedTransaction:n})}if(R?.type==="smart")throw new n.Y({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"});throw new n.Y({docsPath:"/docs/actions/wallet/sendTransaction",type:R?.type})}catch(e){if(e instanceof n.Y)throw e;throw function(e,{docsPath:t,...r}){let i=(()=>{let t=(0,u.k)(e,r);return t instanceof c.cj?e:t})();return new l.mk(i,{docsPath:t,...r})}(e,{...t,account:R,chain:t.chain||void 0})}}},56334:function(e,t,r){"use strict";r.d(t,{p:function(){return i}});let i=(0,r(86164).a)({id:43114,name:"Avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{default:{name:"SnowTrace",url:"https://snowtrace.io",apiUrl:"https://api.snowtrace.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:11907934}}})},94898:function(e,t,r){"use strict";r.d(t,{e:function(){return s}});var i=r(14503),n=r(75632);function s(e){let{batch:t,cacheTime:r=e.pollingInterval??4e3,ccipRead:s,key:a="base",name:o="Base Client",pollingInterval:c=4e3,type:l="base"}=e,u=e.chain,d=e.account?(0,i.T)(e.account):void 0,{config:h,request:f,value:p}=e.transport({chain:u,pollingInterval:c}),g={account:d,batch:t,cacheTime:r,ccipRead:s,chain:u,key:a,name:o,pollingInterval:c,request:f,transport:{...h,...p},type:l,uid:(0,n.h)()};return Object.assign(g,{extend:function e(t){return r=>{let i=r(t);for(let e in g)delete i[e];let n={...t,...i};return Object.assign(n,{extend:e(n)})}}(g)})}},22319:function(e,t,r){"use strict";r.d(t,{q:function(){return d}});var i=r(36117),n=r(78863),s=r(39028),a=r(92106);let o=new(r(79773)).k(8192);var c=r(7760),l=r(96070),u=r(75632);function d({key:e,methods:t,name:r,request:d,retryCount:h=3,retryDelay:f=150,timeout:p,type:g},m){return{config:{key:e,methods:t,name:r,request:d,retryCount:h,retryDelay:f,timeout:p,type:g},request:function(e,t={}){return async(r,u={})=>{let{dedupe:d=!1,methods:h,retryDelay:f=150,retryCount:p=3,uid:g}={...t,...u},{method:m}=r;if(h?.exclude?.includes(m)||h?.include&&!h.include.includes(m))throw new s.gS(Error("method not supported"),{method:m});let b=d?(0,a.$G)(`${g}.${(0,l.P)(r)}`):void 0;return function(e,{enabled:t=!0,id:r}){if(!t||!r)return e();if(o.get(r))return o.get(r);let i=e().finally(()=>o.delete(r));return o.set(r,i),i}(()=>(0,c.J)(async()=>{try{return await e(r)}catch(e){switch(e.code){case s.s7.code:throw new s.s7(e);case s.B.code:throw new s.B(e);case s.LX.code:throw new s.LX(e,{method:r.method});case s.nY.code:throw new s.nY(e);case s.XS.code:throw new s.XS(e);case s.yR.code:throw new s.yR(e);case s.Og.code:throw new s.Og(e);case s.pT.code:throw new s.pT(e);case s.KB.code:throw new s.KB(e);case s.gS.code:throw new s.gS(e,{method:r.method});case s.Pv.code:throw new s.Pv(e);case s.GD.code:throw new s.GD(e);case s.ab.code:throw new s.ab(e);case s.PE.code:throw new s.PE(e);case s.Ts.code:throw new s.Ts(e);case s.u5.code:throw new s.u5(e);case s.I0.code:throw new s.I0(e);case s.x3.code:throw new s.x3(e);case 5e3:throw new s.ab(e);default:if(e instanceof i.G)throw e;throw new s.ir(e)}}},{delay:({count:e,error:t})=>{if(t&&t instanceof n.Gg){let e=t?.headers?.get("Retry-After");if(e?.match(/\d/))return 1e3*Number.parseInt(e)}return~~(1<"code"in e&&"number"==typeof e.code?-1===e.code||e.code===s.Pv.code||e.code===s.XS.code:!(e instanceof n.Gg)||!e.status||403===e.status||408===e.status||413===e.status||429===e.status||500===e.status||502===e.status||503===e.status||504===e.status}),{enabled:d,id:b})}}(d,{methods:t,retryCount:h,retryDelay:f,uid:(0,u.h)()}),value:m}}},68597:function(e,t,r){"use strict";r.d(t,{d:function(){return d}});var i=r(78863),n=r(36117);class s extends n.G{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}var a=r(32357),o=r(60229),c=r(96070);let l={current:0,take(){return this.current++},reset(){this.current=0}};var u=r(22319);function d(e,t={}){let{batch:r,fetchOptions:n,key:d="http",methods:h,name:f="HTTP JSON-RPC",onFetchRequest:p,onFetchResponse:g,retryDelay:m,raw:b}=t;return({chain:y,retryCount:w,timeout:v})=>{let{batchSize:A=1e3,wait:E=0}="object"==typeof r?r:{},C=t.retryCount??w,_=v??t.timeout??1e4,I=e||y?.rpcUrls.default.http[0];if(!I)throw new s;let S=function(e,t={}){return{async request(r){let{body:n,onRequest:s=t.onRequest,onResponse:a=t.onResponse,timeout:u=t.timeout??1e4}=r,d={...t.fetchOptions??{},...r.fetchOptions??{}},{headers:h,method:f,signal:p}=d;try{let t;let r=await (0,o.F)(async({signal:t})=>{let r={...d,body:Array.isArray(n)?(0,c.P)(n.map(e=>({jsonrpc:"2.0",id:e.id??l.take(),...e}))):(0,c.P)({jsonrpc:"2.0",id:n.id??l.take(),...n}),headers:{"Content-Type":"application/json",...h},method:f||"POST",signal:p||(u>0?t:null)},i=new Request(e,r),a=await s?.(i,r)??{...r,url:e};return await fetch(a.url??e,a)},{errorInstance:new i.W5({body:n,url:e}),timeout:u,signal:!0});if(a&&await a(r),r.headers.get("Content-Type")?.startsWith("application/json"))t=await r.json();else{t=await r.text();try{t=JSON.parse(t||"{}")}catch(e){if(r.ok)throw e;t={error:t}}}if(!r.ok)throw new i.Gg({body:n,details:(0,c.P)(t.error)||r.statusText,headers:r.headers,status:r.status,url:e});return t}catch(t){if(t instanceof i.Gg||t instanceof i.W5)throw t;throw new i.Gg({body:n,cause:t,url:e})}}}}(I,{fetchOptions:n,onRequest:p,onResponse:g,timeout:_});return(0,u.q)({key:d,methods:h,name:f,async request({method:e,params:t}){let n={method:e,params:t},{schedule:s}=(0,a.S)({id:I,wait:E,shouldSplitBatch:e=>e.length>A,fn:e=>S.request({body:e}),sort:(e,t)=>e.id-t.id}),o=async e=>r?s(e):[await S.request({body:e})],[{error:c,result:l}]=await o(n);if(b)return{error:c,result:l};if(c)throw new i.bs({body:n,error:c,url:I});return l},retryCount:C,retryDelay:m,timeout:_,type:"http"},{fetchOptions:n,url:I})}}},16693:function(e,t,r){"use strict";r.d(t,{F8:function(){return i},Wo:function(){return l},X$:function(){return c},du:function(){return a},k3:function(){return s},nZ:function(){return o}});let i=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],n=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],s=[...n,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],a=[...n,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],o=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],c=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],l=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}]},1958:function(e,t,r){"use strict";r.d(t,{DR:function(){return i}});let i="0x0000000000000000000000000000000000000000"},50676:function(e,t,r){"use strict";r.d(t,{zL:function(){return i}});let i=2n**256n-1n},21746:function(e,t,r){"use strict";r.d(t,{$:function(){return i},Up:function(){return n},hZ:function(){return s}});let i={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},n={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},s={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"}},84192:function(e,t,r){"use strict";r.d(t,{Bd:function(){return s},Zn:function(){return n},ez:function(){return i}});let i={gwei:9,wei:18},n={ether:-9,wei:9},s={ether:-18,gwei:-9}},57412:function(e,t,r){"use strict";r.d(t,{CI:function(){return E},FM:function(){return p},Gy:function(){return v},M4:function(){return d},MX:function(){return b},S4:function(){return y},SM:function(){return w},cO:function(){return o},dh:function(){return A},fM:function(){return a},fs:function(){return h},gr:function(){return u},hn:function(){return C},lC:function(){return g},wM:function(){return _},wb:function(){return l},xB:function(){return c},xL:function(){return m},yP:function(){return f}});var i=r(80522),n=r(39135),s=r(36117);class a extends s.G{constructor({docsPath:e}){super("A constructor was not found on the ABI.\nMake sure you are using the correct ABI and that the constructor exists on it.",{docsPath:e,name:"AbiConstructorNotFoundError"})}}class o extends s.G{constructor({docsPath:e}){super("Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.\nMake sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists.",{docsPath:e,name:"AbiConstructorParamsNotFoundError"})}}class c extends s.G{constructor({data:e,params:t,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${(0,i.h)(t,{includeName:!0})})`,`Data: ${e} (${r} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=t,this.size=r}}class l extends s.G{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class u extends s.G{constructor({expectedLength:e,givenLength:t,type:r}){super(`ABI encoding array length mismatch for type ${r}. Expected length: ${e} Given length: ${t}`,{name:"AbiEncodingArrayLengthMismatchError"})}}class d extends s.G{constructor({expectedSize:e,value:t}){super(`Size of bytes "${t}" (bytes${(0,n.d)(t)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class h extends s.G{constructor({expectedLength:e,givenLength:t}){super(`ABI encoding params/values length mismatch. Expected length (params): ${e} Given length (values): ${t}`,{name:"AbiEncodingLengthMismatchError"})}}class f extends s.G{constructor(e,{docsPath:t}){super(`Encoded error signature "${e}" not found on ABI. Make sure you are using the correct ABI and that the error exists on it. You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`,{docsPath:t,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class p extends s.G{constructor({docsPath:e}){super("Cannot extract event signature from empty topics.",{docsPath:e,name:"AbiEventSignatureEmptyTopicsError"})}}class g extends s.G{constructor(e,{docsPath:t}){super(`Encoded event signature "${e}" not found on ABI. Make sure you are using the correct ABI and that the event exists on it. You can look up the signature here: https://openchain.xyz/signatures?query=${e}.`,{docsPath:t,name:"AbiEventSignatureNotFoundError"})}}class m extends s.G{constructor(e,{docsPath:t}={}){super(`Function ${e?`"${e}" `:""}not found on ABI. Make sure you are using the correct ABI and that the function exists on it.`,{docsPath:t,name:"AbiFunctionNotFoundError"})}}class b extends s.G{constructor(e,{docsPath:t}){super(`Function "${e}" does not contain any \`outputs\` on ABI. Cannot decode function result without knowing what the parameter types are. Make sure you are using the correct ABI and that the function exists on it.`,{docsPath:t,name:"AbiFunctionOutputsNotFoundError"})}}class y extends s.G{constructor(e,t){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${(0,i.t)(e.abiItem)}\`, and`,`\`${t.type}\` in \`${(0,i.t)(t.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class w extends s.G{constructor({abiItem:e,data:t,params:r,size:n}){super(`Data size of ${n} bytes is too small for non-indexed event parameters.`,{metaMessages:[`Params: (${(0,i.h)(r,{includeName:!0})})`,`Data: ${t} (${n} bytes)`],name:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e,this.data=t,this.params=r,this.size=n}}class v extends s.G{constructor({abiItem:e,param:t}){super(`Expected a topic for indexed event parameter${t.name?` "${t.name}"`:""} on event "${(0,i.t)(e,{includeName:!0})}".`,{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e}}class A extends s.G{constructor(e,{docsPath:t}){super(`Type "${e}" is not a valid encoding type. Please provide a valid ABI type.`,{docsPath:t,name:"InvalidAbiEncodingType"})}}class E extends s.G{constructor(e,{docsPath:t}){super(`Type "${e}" is not a valid decoding type. Please provide a valid ABI type.`,{docsPath:t,name:"InvalidAbiDecodingType"})}}class C extends s.G{constructor(e){super(`Value "${e}" is not a valid array.`,{name:"InvalidArrayError"})}}class _ extends s.G{constructor(e){super(`"${e}" is not a valid definition type. Valid types: "function", "event", "error"`,{name:"InvalidDefinitionTypeError"})}}},8998:function(e,t,r){"use strict";r.d(t,{Y:function(){return s},o:function(){return n}});var i=r(36117);class n extends i.G{constructor({docsPath:e}={}){super("Could not find an Account to execute with this Action.\nPlease provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client.",{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class s extends i.G{constructor({docsPath:e,metaMessages:t,type:r}){super(`Account type "${r}" is not supported.`,{docsPath:e,metaMessages:t,name:"AccountTypeNotSupportedError"})}}},26087:function(e,t,r){"use strict";r.d(t,{b:function(){return n}});var i=r(36117);class n extends i.G{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}},36117:function(e,t,r){"use strict";r.d(t,{G:function(){return s}});let i="2.24.3",n={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${i}`};class s extends Error{constructor(e,t={}){let r=t.cause instanceof s?t.cause.details:t.cause?.message?t.cause.message:t.details,a=t.cause instanceof s&&t.cause.docsPath||t.docsPath,o=n.getDocsUrl?.({...t,docsPath:a});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...o?[`Docs: ${o}`]:[],...r?[`Details: ${r}`]:[],...n.version?[`Version: ${n.version}`]:[]].join("\n"),t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=a,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=i}walk(e){return function e(t,r){return r?.(t)?t:t&&"object"==typeof t&&"cause"in t&&void 0!==t.cause?e(t.cause,r):r?null:t}(this,e)}}},79814:function(e,t,r){"use strict";r.d(t,{f:function(){return n}});var i=r(36117);class n extends i.G{constructor({blockHash:e,blockNumber:t}){let r="Block";e&&(r=`Block at hash "${e}"`),t&&(r=`Block at number "${t}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}}},80377:function(e,t,r){"use strict";r.d(t,{Bk:function(){return a},Yl:function(){return s},mm:function(){return n},pZ:function(){return o}});var i=r(36117);class n extends i.G{constructor({blockNumber:e,chain:t,contract:r}){super(`Chain "${t.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...e&&r.blockCreated&&r.blockCreated>e?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${e}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class s extends i.G{constructor({chain:e,currentChainId:t}){super(`The current chain of the wallet (id: ${t}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${t}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class a extends i.G{constructor(){super("No chain was provided to the request.\nPlease provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient.",{name:"ChainNotFoundError"})}}class o extends i.G{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}},97405:function(e,t,r){"use strict";r.d(t,{cg:function(){return b},uq:function(){return y},Lu:function(){return w},Dk:function(){return v},Mo:function(){return A},VQ:function(){return E}});var i=r(14503),n=r(21746),s=r(86899),a=r(80522),o=r(96070);function c({abiItem:e,args:t,includeFunctionName:r=!0,includeName:i=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${r?e.name:""}(${e.inputs.map((e,r)=>`${i&&e.name?`${e.name}: `:""}${"object"==typeof t[r]?(0,o.P)(t[r]):t[r]}`).join(", ")})`}var l=r(40840),u=r(39625),d=r(67795),h=r(57412),f=r(36117),p=r(20443),g=r(33639),m=r(29008);class b extends f.G{constructor(e,{account:t,docsPath:r,chain:n,data:s,gas:a,gasPrice:o,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:h,to:f,value:m,stateOverride:b}){let y=t?(0,i.T)(t):void 0,w=(0,g.xr)({from:y?.address,to:f,value:void 0!==m&&`${(0,u.d)(m)} ${n?.nativeCurrency?.symbol||"ETH"}`,data:s,gas:a,gasPrice:void 0!==o&&`${(0,d.o)(o)} gwei`,maxFeePerGas:void 0!==c&&`${(0,d.o)(c)} gwei`,maxPriorityFeePerGas:void 0!==l&&`${(0,d.o)(l)} gwei`,nonce:h});b&&(w+=` ${(0,p.Bj)(b)}`),super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Raw Call Arguments:",w].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class y extends f.G{constructor(e,{abi:t,args:r,contractAddress:i,docsPath:n,functionName:s,sender:o}){let u=(0,l.mE)({abi:t,args:r,name:s}),d=u?c({abiItem:u,args:r,includeFunctionName:!1,includeName:!1}):void 0,h=u?(0,a.t)(u,{includeName:!0}):void 0,f=(0,g.xr)({address:i&&(0,m.C)(i),function:h,args:d&&"()"!==d&&`${[...Array(s?.length??0).keys()].map(()=>" ").join("")}${d}`,sender:o});super(e.shortMessage||`An unknown error occurred while executing the contract function "${s}".`,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],f&&"Contract Call:",f].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=t,this.args=r,this.cause=e,this.contractAddress=i,this.functionName=s,this.sender=o}}class w extends f.G{constructor({abi:e,data:t,functionName:r,message:i}){let o,l,u,d,f;if(t&&"0x"!==t)try{let{abiItem:r,errorName:i,args:o}=f=(0,s.p)({abi:e,data:t});if("Error"===i)u=o[0];else if("Panic"===i){let[e]=o;u=n.$[e]}else{let e=r?(0,a.t)(r,{includeName:!0}):void 0,t=r&&o?c({abiItem:r,args:o,includeFunctionName:!1,includeName:!1}):void 0;l=[e?`Error: ${e}`:"",t&&"()"!==t?` ${[...Array(i?.length??0).keys()].map(()=>" ").join("")}${t}`:""]}}catch(e){o=e}else i&&(u=i);o instanceof h.yP&&(d=o.signature,l=[`Unable to decode signature "${d}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${d}.`]),super(u&&"execution reverted"!==u||d?[`The contract function "${r}" reverted with the following ${d?"signature":"reason"}:`,u||d].join("\n"):`The contract function "${r}" reverted.`,{cause:o,metaMessages:l,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=f,this.raw=t,this.reason=u,this.signature=d}}class v extends f.G{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class A extends f.G{constructor({factory:e}){super(`Deployment for counterfactual contract call failed${e?` for factory "${e}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class E extends f.G{constructor({data:e,message:t}){super(t||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}},66238:function(e,t,r){"use strict";r.d(t,{KD:function(){return a},T_:function(){return n},lQ:function(){return s}});var i=r(36117);class n extends i.G{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class s extends i.G{constructor({length:e,position:t}){super(`Position \`${t}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class a extends i.G{constructor({count:e,limit:t}){super(`Recursive read limit of \`${t}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}},69760:function(e,t,r){"use strict";r.d(t,{$s:function(){return s},W_:function(){return a},mV:function(){return n}});var i=r(36117);class n extends i.G{constructor({offset:e,position:t,size:r}){super(`Slice ${"start"===t?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}}class s extends i.G{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"})}}class a extends i.G{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${t} ${r} long, but is ${e} ${r} long.`,{name:"InvalidBytesLengthError"})}}},87788:function(e,t,r){"use strict";r.d(t,{J5:function(){return n},M6:function(){return a},yr:function(){return s}});var i=r(36117);class n extends i.G{constructor({max:e,min:t,signed:r,size:i,value:n}){super(`Number "${n}" is not in safe ${i?`${8*i}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"})}}class s extends i.G{constructor(e){super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}class a extends i.G{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}},26445:function(e,t,r){"use strict";r.d(t,{C_:function(){return d},G$:function(){return o},Hh:function(){return a},M_:function(){return s},WF:function(){return h},ZI:function(){return c},cj:function(){return m},cs:function(){return g},dR:function(){return f},pZ:function(){return p},se:function(){return u},vU:function(){return l}});var i=r(67795),n=r(36117);class s extends n.G{constructor({cause:e,message:t}={}){let r=t?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(s,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(s,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class a extends n.G{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${(0,i.o)(t)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(a,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class o extends n.G{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${(0,i.o)(t)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(o,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class c extends n.G{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(c,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class l extends n.G{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}is lower than the current nonce of the account. Try increasing the nonce or find the latest nonce with \`getTransactionCount\`.`,{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(l,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class u extends n.G{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(u,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class d extends n.G{constructor({cause:e}={}){super("The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account.",{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(d,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class h extends n.G{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(h,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class f extends n.G{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(f,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class p extends n.G{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(p,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class g extends n.G{constructor({cause:e,maxPriorityFeePerGas:t,maxFeePerGas:r}={}){super(`The provided tip (\`maxPriorityFeePerGas\`${t?` = ${(0,i.o)(t)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${(0,i.o)(r)} gwei`:""}).`,{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(g,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class m extends n.G{constructor({cause:e}){super(`An error occurred while executing: ${e?.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}},78863:function(e,t,r){"use strict";r.d(t,{Gg:function(){return a},W5:function(){return c},bs:function(){return o}});var i=r(96070),n=r(36117),s=r(29008);class a extends n.G{constructor({body:e,cause:t,details:r,headers:n,status:a,url:o}){super("HTTP request failed.",{cause:t,details:r,metaMessages:[a&&`Status: ${a}`,`URL: ${(0,s.G)(o)}`,e&&`Request body: ${(0,i.P)(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=n,this.status=a,this.url=o}}class o extends n.G{constructor({body:e,error:t,url:r}){super("RPC Request failed.",{cause:t,details:t.message,metaMessages:[`URL: ${(0,s.G)(r)}`,`Request body: ${(0,i.P)(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t.code,this.data=t.data}}class c extends n.G{constructor({body:e,url:t}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${(0,s.G)(t)}`,`Request body: ${(0,i.P)(e)}`],name:"TimeoutError"})}}},39028:function(e,t,r){"use strict";r.d(t,{B:function(){return c},GD:function(){return y},I0:function(){return C},KB:function(){return g},LX:function(){return l},Og:function(){return f},PE:function(){return v},Pv:function(){return b},Ts:function(){return A},XS:function(){return d},ab:function(){return w},gS:function(){return m},ir:function(){return I},nY:function(){return u},pT:function(){return p},s7:function(){return o},u5:function(){return E},x3:function(){return _},yR:function(){return h}});var i=r(36117),n=r(78863);class s extends i.G{constructor(e,{code:t,docsPath:r,metaMessages:i,name:s,shortMessage:a}){super(a,{cause:e,docsPath:r,metaMessages:i||e?.metaMessages,name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||e.name,this.code=e instanceof n.bs?e.code:t??-1}}class a extends s{constructor(e,t){super(e,t),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t.data}}class o extends s{constructor(e){super(e,{code:o.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(o,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class c extends s{constructor(e){super(e,{code:c.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(c,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class l extends s{constructor(e,{method:t}={}){super(e,{code:l.code,name:"MethodNotFoundRpcError",shortMessage:`The method${t?` "${t}"`:""} does not exist / is not available.`})}}Object.defineProperty(l,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class u extends s{constructor(e){super(e,{code:u.code,name:"InvalidParamsRpcError",shortMessage:"Invalid parameters were provided to the RPC method.\nDouble check you have provided the correct parameters."})}}Object.defineProperty(u,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class d extends s{constructor(e){super(e,{code:d.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(d,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class h extends s{constructor(e){super(e,{code:h.code,name:"InvalidInputRpcError",shortMessage:"Missing or invalid parameters.\nDouble check you have provided the correct parameters."})}}Object.defineProperty(h,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class f extends s{constructor(e){super(e,{code:f.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(f,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class p extends s{constructor(e){super(e,{code:p.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(p,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class g extends s{constructor(e){super(e,{code:g.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(g,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class m extends s{constructor(e,{method:t}={}){super(e,{code:m.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${t?` "${t}"`:""} is not supported.`})}}Object.defineProperty(m,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class b extends s{constructor(e){super(e,{code:b.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(b,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class y extends s{constructor(e){super(e,{code:y.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(y,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class w extends a{constructor(e){super(e,{code:w.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(w,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class v extends a{constructor(e){super(e,{code:v.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(v,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class A extends a{constructor(e,{method:t}={}){super(e,{code:A.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${t?` " ${t}"`:""}.`})}}Object.defineProperty(A,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class E extends a{constructor(e){super(e,{code:E.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(E,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class C extends a{constructor(e){super(e,{code:C.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(C,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class _ extends a{constructor(e){super(e,{code:_.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(_,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class I extends s{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}},20443:function(e,t,r){"use strict";r.d(t,{Bj:function(){return o},Nc:function(){return n},Z8:function(){return s}});var i=r(36117);class n extends i.G{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class s extends i.G{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function a(e){return e.reduce((e,{slot:t,value:r})=>`${e} ${t}: ${r} `,"")}function o(e){return e.reduce((e,{address:t,...r})=>{let i=`${e} ${t}: `;return r.nonce&&(i+=` nonce: ${r.nonce} `),r.balance&&(i+=` balance: ${r.balance} `),r.code&&(i+=` code: ${r.code} `),r.state&&(i+=" state:\n"+a(r.state)),r.stateDiff&&(i+=" stateDiff:\n"+a(r.stateDiff)),i}," State Override:\n").slice(0,-1)}},33639:function(e,t,r){"use strict";r.d(t,{Bh:function(){return u},Yb:function(){return d},j3:function(){return c},mc:function(){return h},mk:function(){return l},xY:function(){return o},xr:function(){return a}});var i=r(39625),n=r(67795),s=r(36117);function a(e){let t=Object.entries(e).map(([e,t])=>void 0===t||!1===t?null:[e,t]).filter(Boolean),r=t.reduce((e,[t])=>Math.max(e,t.length),0);return t.map(([e,t])=>` ${`${e}:`.padEnd(r+1)} ${t}`).join("\n")}class o extends s.G{constructor(){super("Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.\nUse `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others.",{name:"FeeConflictError"})}}class c extends s.G{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",a(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class l extends s.G{constructor(e,{account:t,docsPath:r,chain:s,data:o,gas:c,gasPrice:l,maxFeePerGas:u,maxPriorityFeePerGas:d,nonce:h,to:f,value:p}){super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",a({chain:s&&`${s?.name} (id: ${s?.id})`,from:t?.address,to:f,value:void 0!==p&&`${(0,i.d)(p)} ${s?.nativeCurrency?.symbol||"ETH"}`,data:o,gas:c,gasPrice:void 0!==l&&`${(0,n.o)(l)} gwei`,maxFeePerGas:void 0!==u&&`${(0,n.o)(u)} gwei`,maxPriorityFeePerGas:void 0!==d&&`${(0,n.o)(d)} gwei`,nonce:h})].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class u extends s.G{constructor({blockHash:e,blockNumber:t,blockTag:r,hash:i,index:n}){let s="Transaction";r&&void 0!==n&&(s=`Transaction at block time "${r}" at index "${n}"`),e&&void 0!==n&&(s=`Transaction at block hash "${e}" at index "${n}"`),t&&void 0!==n&&(s=`Transaction at block number "${t}" at index "${n}"`),i&&(s=`Transaction with hash "${i}"`),super(`${s} could not be found.`,{name:"TransactionNotFoundError"})}}class d extends s.G{constructor({hash:e}){super(`Transaction receipt with hash "${e}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class h extends s.G{constructor({hash:e}){super(`Timed out while waiting for transaction with hash "${e}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}},29008:function(e,t,r){"use strict";r.d(t,{C:function(){return i},G:function(){return n}});let i=e=>e,n=e=>e},78398:function(e,t,r){"use strict";r.d(t,{r:function(){return g}});var i=r(57412),n=r(45775),s=r(11221),a=r(39135),o=r(3972),c=r(61836),l=r(87788),u=r(95946),d=r(92106);function h(e,t={}){void 0!==t.size&&(0,u.Yf)(e,{size:t.size});let r=(0,d.ci)(e,t);return(0,u.ly)(r,t)}var f=r(11187),p=r(22310);function g(e,t){let r="string"==typeof t?(0,f.nr)(t):t,g=(0,s.q)(r);if(0===(0,a.d)(r)&&e.length>0)throw new i.wb;if((0,a.d)(t)&&32>(0,a.d)(t))throw new i.xB({data:"string"==typeof t?t:(0,d.ci)(t),params:e,size:(0,a.d)(t)});let b=0,y=[];for(let t=0;t!e),s=n?[]:{},a=0;if(m(r)){let o=i+h(t.readBytes(32));for(let i=0;i1||r[0]>1)throw new l.yr(r);return!!r[0]}(t.readBytes(32),{size:32}),32];if(r.type.startsWith("bytes"))return function(e,t,{staticPosition:r}){let[i,n]=t.type.split("bytes");if(!n){let t=h(e.readBytes(32));e.setPosition(r+t);let i=h(e.readBytes(32));if(0===i)return e.setPosition(r+32),["0x",32];let n=e.readBytes(i);return e.setPosition(r+32),[(0,d.ci)(n),32]}return[(0,d.ci)(e.readBytes(Number.parseInt(n),32)),32]}(t,r,{staticPosition:s});if(r.type.startsWith("uint")||r.type.startsWith("int"))return function(e,t){let r=t.type.startsWith("int"),i=Number.parseInt(t.type.split("int")[1]||"256"),n=e.readBytes(32);return[i>48?function(e,t={}){void 0!==t.size&&(0,u.Yf)(e,{size:t.size});let r=(0,d.ci)(e,t);return(0,u.y_)(r,t)}(n,{signed:r}):h(n,{signed:r}),32]}(t,r);if("string"===r.type)return function(e,{staticPosition:t}){let r=h(e.readBytes(32));e.setPosition(t+r);let i=h(e.readBytes(32));if(0===i)return e.setPosition(t+32),["",32];let n=e.readBytes(i,32),s=function(e,t={}){let r=e;return void 0!==t.size&&((0,u.Yf)(r,{size:t.size}),r=(0,c.f)(r,{dir:"right"})),new TextDecoder().decode(r)}((0,c.f)(n));return e.setPosition(t+32),[s,32]}(t,{staticPosition:s});throw new i.CI(r.type,{docsPath:"/docs/contract/decodeAbiParameters"})}(g,r,{staticPosition:0});b+=a,y.push(s)}return y}function m(e){let{type:t}=e;if("string"===t||"bytes"===t||t.endsWith("[]"))return!0;if("tuple"===t)return e.components?.some(m);let r=(0,p.S)(e.type);return!!(r&&m({...e,type:r[1]}))}},86899:function(e,t,r){"use strict";r.d(t,{p:function(){return l}});var i=r(21746),n=r(57412),s=r(3972),a=r(58034),o=r(78398),c=r(80522);function l(e){let{abi:t,data:r}=e,l=(0,s.tP)(r,0,4);if("0x"===l)throw new n.wb;let u=[...t||[],i.Up,i.hZ].find(e=>"error"===e.type&&l===(0,a.C)((0,c.t)(e)));if(!u)throw new n.yP(l,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:u,args:"inputs"in u&&u.inputs&&u.inputs.length>0?(0,o.r)(u.inputs,(0,s.tP)(r,4)):void 0,errorName:u.name}}},7210:function(e,t,r){"use strict";r.d(t,{k:function(){return o}});var i=r(57412),n=r(78398),s=r(40840);let a="/docs/contract/decodeFunctionResult";function o(e){let{abi:t,args:r,functionName:o,data:c}=e,l=t[0];if(o){let e=(0,s.mE)({abi:t,args:r,name:o});if(!e)throw new i.xL(o,{docsPath:a});l=e}if("function"!==l.type)throw new i.xL(void 0,{docsPath:a});if(!l.outputs)throw new i.MX(l.name,{docsPath:a});let u=(0,n.r)(l.outputs,c);return u&&u.length>1?u:u&&1===u.length?u[0]:void 0}},22310:function(e,t,r){"use strict";r.d(t,{E:function(){return p},S:function(){return m}});var i=r(57412),n=r(26087),s=r(36117),a=r(87788),o=r(49321),c=r(57040),l=r(61769),u=r(39135),d=r(3972),h=r(92106);let f=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function p(e,t){if(e.length!==t.length)throw new i.fs({expectedLength:e.length,givenLength:t.length});let r=g(function({params:e,values:t}){let r=[];for(let p=0;p0?(0,c.zo)([t,e]):t}}if(a)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:(0,c.zo)(o.map(({encoded:e})=>e))}}(r,{length:n,param:{...t,type:s}})}if("tuple"===t.type)return function(t,{param:r}){let i=!1,n=[];for(let s=0;se))}}(r,{param:t});if("address"===t.type)return function(e){if(!(0,o.U)(e))throw new n.b({address:e});return{dynamic:!1,encoded:(0,l.gc)(e.toLowerCase())}}(r);if("bool"===t.type)return function(e){if("boolean"!=typeof e)throw new s.G(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:(0,l.gc)((0,h.C4)(e))}}(r);if(t.type.startsWith("uint")||t.type.startsWith("int")){let e=t.type.startsWith("int"),[,,i="256"]=f.exec(t.type)??[];return function(e,{signed:t,size:r=256}){if("number"==typeof r){let i=2n**(BigInt(r)-(t?1n:0n))-1n,n=t?-i-1n:0n;if(e>i||e(function(e,{includeName:t}){return e.type.startsWith("tuple")?`(${s(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")})(e,{includeName:t})).join(t?", ":","):""}},40840:function(e,t,r){"use strict";r.d(t,{mE:function(){return c}});var i=r(57412),n=r(15102),s=r(49321),a=r(96005),o=r(58034);function c(e){let t;let{abi:r,args:c=[],name:l}=e,u=(0,n.v)(l,{strict:!1}),d=r.filter(e=>u?"function"===e.type?(0,o.C)(e)===l:"event"===e.type&&(0,a.n)(e)===l:"name"in e&&e.name===l);if(0!==d.length){if(1===d.length)return d[0];for(let e of d)if("inputs"in e){if(!c||0===c.length){if(!e.inputs||0===e.inputs.length)return e;continue}if(e.inputs&&0!==e.inputs.length&&e.inputs.length===c.length&&c.every((t,r)=>{let i="inputs"in e&&e.inputs[r];return!!i&&function e(t,r){let i=typeof t,n=r.type;switch(n){case"address":return(0,s.U)(t,{strict:!1});case"bool":return"boolean"===i;case"function":case"string":return"string"===i;default:if("tuple"===n&&"components"in r)return Object.values(r.components).every((r,i)=>e(Object.values(t)[i],r));if(/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n))return"number"===i||"bigint"===i;if(/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n))return"string"===i||t instanceof Uint8Array;if(/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n))return Array.isArray(t)&&t.every(t=>e(t,{...r,type:n.replace(/(\[[0-9]{0,}\])$/,"")}));return!1}}(t,i)})){if(t&&"inputs"in t&&t.inputs){let r=function e(t,r,i){for(let n in t){let a=t[n],o=r[n];if("tuple"===a.type&&"tuple"===o.type&&"components"in a&&"components"in o)return e(a.components,o.components,i[n]);let c=[a.type,o.type];if(c.includes("address")&&c.includes("bytes20")||(c.includes("address")&&c.includes("string")||c.includes("address")&&c.includes("bytes"))&&(0,s.U)(i[n],{strict:!1}))return c}}(e.inputs,t.inputs,c);if(r)throw new i.S4({abiItem:e,type:r[0]},{abiItem:t,type:r[1]})}t=e}}return t||d[0]}}},45775:function(e,t,r){"use strict";r.d(t,{K:function(){return u},x:function(){return l}});var i=r(26087),n=r(11187),s=r(91734),a=r(79773),o=r(49321);let c=new a.k(8192);function l(e,t){if(c.has(`${e}.${t}`))return c.get(`${e}.${t}`);let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),i=(0,s.w)((0,n.qX)(r),"bytes"),a=(t?r.substring(`${t}0x`.length):r).split("");for(let e=0;e<40;e+=2)i[e>>1]>>4>=8&&a[e]&&(a[e]=a[e].toUpperCase()),(15&i[e>>1])>=8&&a[e+1]&&(a[e+1]=a[e+1].toUpperCase());let o=`0x${a.join("")}`;return c.set(`${e}.${t}`,o),o}function u(e,t){if(!(0,o.U)(e,{strict:!1}))throw new i.b({address:e});return l(e,t)}},49321:function(e,t,r){"use strict";r.d(t,{U:function(){return o}});var i=r(79773),n=r(45775);let s=/^0x[a-fA-F0-9]{40}$/,a=new i.k(8192);function o(e,t){let{strict:r=!0}=t??{},i=`${e}.${r}`;if(a.has(i))return a.get(i);let o=!!s.test(e)&&(e.toLowerCase()===e||!r||(0,n.x)(e)===e);return a.set(i,o),o}},61228:function(e,t,r){"use strict";r.d(t,{E:function(){return s}});var i=r(26087),n=r(49321);function s(e,t){if(!(0,n.U)(e,{strict:!1}))throw new i.b({address:e});if(!(0,n.U)(t,{strict:!1}))throw new i.b({address:t});return e.toLowerCase()===t.toLowerCase()}},46257:function(e,t,r){"use strict";r.d(t,{z:function(){return m}});var i=r(45775),n=r(91734),s=r(15102),a=r(95946),o=r(92106);async function c({hash:e,signature:t}){let i=(0,s.v)(e)?e:(0,o.NC)(e),{secp256k1:n}=await r.e(9970).then(r.bind(r,19970)),c=(()=>{if("object"==typeof t&&"r"in t&&"s"in t){let{r:e,s:r,v:i,yParity:s}=t,o=l(Number(s??i));return new n.Signature((0,a.y_)(e),(0,a.y_)(r)).addRecoveryBit(o)}let e=(0,s.v)(t)?t:(0,o.NC)(t),r=l((0,a.ly)(`0x${e.slice(130)}`));return n.Signature.fromCompact(e.substring(2,130)).addRecoveryBit(r)})().recoverPublicKey(i.substring(2)).toHex(!1);return`0x${c}`}function l(e){if(0===e||1===e)return e;if(27===e)return 0;if(28===e)return 1;throw Error("Invalid yParityOrV value")}async function u({hash:e,signature:t}){return function(e){let t=(0,n.w)(`0x${e.substring(4)}`).substring(26);return(0,i.x)(`0x${t}`)}(await c({hash:e,signature:t}))}var d=r(57040),h=r(11187),f=r(36117),p=r(11221);function g(e){if(e<256)return 1;if(e<65536)return 2;if(e<16777216)return 3;if(e<4294967296)return 4;throw new f.G("Length is too large.")}async function m(e){let{authorization:t,signature:r}=e;return u({hash:function(e){let{chainId:t,nonce:r,to:i}=e,s=e.contractAddress??e.address,a=(0,n.w)((0,d.SM)(["0x05",function(e,t="hex"){let r=function e(t){return Array.isArray(t)?function(e){let t=e.reduce((e,t)=>e+t.length,0),r=g(t);return{length:t<=55?1+t:1+r+t,encode(i){for(let{encode:n}of(t<=55?i.pushByte(192+t):(i.pushByte(247+r),1===r?i.pushUint8(t):2===r?i.pushUint16(t):3===r?i.pushUint24(t):i.pushUint32(t)),e))n(i)}}}(t.map(t=>e(t))):function(e){let t="string"==typeof e?(0,h.nr)(e):e,r=g(t.length);return{length:1===t.length&&t[0]<128?1:t.length<=55?1+t.length:1+r+t.length,encode(e){1===t.length&&t[0]<128||(t.length<=55?e.pushByte(128+t.length):(e.pushByte(183+r),1===r?e.pushUint8(t.length):2===r?e.pushUint16(t.length):3===r?e.pushUint24(t.length):e.pushUint32(t.length))),e.pushBytes(t)}}}(t)}(e),i=(0,p.q)(new Uint8Array(r.length));return(r.encode(i),"hex"===t)?(0,o.ci)(i.bytes):i.bytes}([t?(0,o.eC)(t):"0x",s,r?(0,o.eC)(r):"0x"])]));return"bytes"===i?(0,h.nr)(a):a}(t),signature:r??t})}},86164:function(e,t,r){"use strict";function i(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}r.d(t,{a:function(){return i}})},47864:function(e,t,r){"use strict";r.d(t,{L:function(){return n}});var i=r(80377);function n({blockNumber:e,chain:t,contract:r}){let n=t?.contracts?.[r];if(!n)throw new i.mm({chain:t,contract:{name:r}});if(e&&n.blockCreated&&n.blockCreated>e)throw new i.mm({blockNumber:e,chain:t,contract:{name:r,blockCreated:n.blockCreated}});return n.address}},11221:function(e,t,r){"use strict";r.d(t,{q:function(){return s}});var i=r(66238);let n={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new i.KD({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new i.lQ({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new i.T_({offset:e});let t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new i.T_({offset:e});let t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){let t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){let r=t??this.position;return this.assertPosition(r+e-1),this.bytes.subarray(r,r+e)},inspectUint8(e){let t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){let t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){let t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){let t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,255&e),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();let e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();let r=this.inspectBytes(e);return this.position+=t??e,r},readUint8(){this.assertReadLimit(),this._touch();let e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();let e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();let e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();let e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){let t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;let e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function s(e,{recursiveReadLimit:t=8192}={}){let r=Object.create(n);return r.bytes=e,r.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=t,r}},57040:function(e,t,r){"use strict";function i(e){return"string"==typeof e[0]?n(e):function(e){let t=0;for(let r of e)t+=r.length;let r=new Uint8Array(t),i=0;for(let t of e)r.set(t,i),i+=t.length;return r}(e)}function n(e){return`0x${e.reduce((e,t)=>e+t.replace("0x",""),"")}`}r.d(t,{SM:function(){return n},zo:function(){return i}})},15102:function(e,t,r){"use strict";function i(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}r.d(t,{v:function(){return i}})},61769:function(e,t,r){"use strict";r.d(t,{gc:function(){return s},vk:function(){return n}});var i=r(69760);function n(e,{dir:t,size:r=32}={}){return"string"==typeof e?s(e,{dir:t,size:r}):function(e,{dir:t,size:r=32}={}){if(null===r)return e;if(e.length>r)throw new i.$s({size:e.length,targetSize:r,type:"bytes"});let n=new Uint8Array(r);for(let i=0;i2*r)throw new i.$s({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n["right"===t?"padEnd":"padStart"](2*r,"0")}`}},39135:function(e,t,r){"use strict";r.d(t,{d:function(){return n}});var i=r(15102);function n(e){return(0,i.v)(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}},3972:function(e,t,r){"use strict";r.d(t,{T4:function(){return l},tP:function(){return a}});var i=r(69760),n=r(15102),s=r(39135);function a(e,t,r,{strict:i}={}){return(0,n.v)(e,{strict:!1})?function(e,t,r,{strict:i}={}){o(e,t);let n=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return i&&c(n,t,r),n}(e,t,r,{strict:i}):l(e,t,r,{strict:i})}function o(e,t){if("number"==typeof t&&t>0&&t>(0,s.d)(e)-1)throw new i.mV({offset:t,position:"start",size:(0,s.d)(e)})}function c(e,t,r){if("number"==typeof t&&"number"==typeof r&&(0,s.d)(e)!==r-t)throw new i.mV({offset:r,position:"end",size:(0,s.d)(e)})}function l(e,t,r,{strict:i}={}){o(e,t);let n=e.slice(t,r);return i&&c(n,t,r),n}},61836:function(e,t,r){"use strict";function i(e,{dir:t="left"}={}){let r="string"==typeof e?e.replace("0x",""):e,i=0;for(let e=0;et)throw new i.M6({givenSize:(0,n.d)(e),maxSize:t})}function c(e,t={}){let{signed:r}=t;t.size&&o(e,{size:t.size});let i=BigInt(e);if(!r)return i;let n=(e.length-2)/2;return i<=(1n<<8n*BigInt(n)-1n)-1n?i:i-BigInt(`0x${"f".padStart(2*n,"f")}`)-1n}function l(e,t={}){return Number(c(e,t))}function u(e,t={}){let r=(0,a.nr)(e);return t.size&&(o(r,{size:t.size}),r=(0,s.f)(r,{dir:"right"})),new TextDecoder().decode(r)}},11187:function(e,t,r){"use strict";r.d(t,{O0:function(){return l},nr:function(){return h},qX:function(){return f}});var i=r(36117),n=r(15102),s=r(61769),a=r(95946),o=r(92106);let c=new TextEncoder;function l(e,t={}){return"number"==typeof e||"bigint"==typeof e?h((0,o.eC)(e,t)):"boolean"==typeof e?function(e,t={}){let r=new Uint8Array(1);return(r[0]=Number(e),"number"==typeof t.size)?((0,a.Yf)(r,{size:t.size}),(0,s.vk)(r,{size:t.size})):r}(e,t):(0,n.v)(e)?h(e,t):f(e,t)}let u={zero:48,nine:57,A:65,F:70,a:97,f:102};function d(e){return e>=u.zero&&e<=u.nine?e-u.zero:e>=u.A&&e<=u.F?e-(u.A-10):e>=u.a&&e<=u.f?e-(u.a-10):void 0}function h(e,t={}){let r=e;t.size&&((0,a.Yf)(r,{size:t.size}),r=(0,s.vk)(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);let o=n.length/2,c=new Uint8Array(o);for(let e=0,t=0;et.toString(16).padStart(2,"0"));function o(e,t={}){return"number"==typeof e||"bigint"==typeof e?u(e,t):"string"==typeof e?h(e,t):"boolean"==typeof e?c(e,t):l(e,t)}function c(e,t={}){let r=`0x${Number(e)}`;return"number"==typeof t.size?((0,s.Yf)(r,{size:t.size}),(0,n.vk)(r,{size:t.size})):r}function l(e,t={}){let r="";for(let t=0;tr||o"data"in e)||e.walk():{},{code:f,data:p,details:g,message:m,shortMessage:b}=h,y=e instanceof i.wb?new s.Dk({functionName:u}):[3,o.XS.code].includes(f)&&(p||g||m||b)?new s.Lu({abi:t,data:"object"==typeof p?p.data:p,functionName:u,message:h instanceof a.bs?g:b??m}):e;return new s.uq(y,{abi:t,args:c,contractAddress:r,docsPath:l,functionName:u,sender:d})}},87469:function(e,t,r){"use strict";r.d(t,{k:function(){return s}});var i=r(36117),n=r(26445);function s(e,t){let r=(e.details||"").toLowerCase(),s=e instanceof i.G?e.walk(e=>e?.code===n.M_.code):e;return s instanceof i.G?new n.M_({cause:e,message:s.details}):n.M_.nodeMessage.test(r)?new n.M_({cause:e,message:e.details}):n.Hh.nodeMessage.test(r)?new n.Hh({cause:e,maxFeePerGas:t?.maxFeePerGas}):n.G$.nodeMessage.test(r)?new n.G$({cause:e,maxFeePerGas:t?.maxFeePerGas}):n.ZI.nodeMessage.test(r)?new n.ZI({cause:e,nonce:t?.nonce}):n.vU.nodeMessage.test(r)?new n.vU({cause:e,nonce:t?.nonce}):n.se.nodeMessage.test(r)?new n.se({cause:e,nonce:t?.nonce}):n.C_.nodeMessage.test(r)?new n.C_({cause:e}):n.WF.nodeMessage.test(r)?new n.WF({cause:e,gas:t?.gas}):n.dR.nodeMessage.test(r)?new n.dR({cause:e,gas:t?.gas}):n.pZ.nodeMessage.test(r)?new n.pZ({cause:e}):n.cs.nodeMessage.test(r)?new n.cs({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new n.cj({cause:e})}},61163:function(e,t,r){"use strict";function i(e,{format:t}){if(!t)return{};let r={};return!function t(i){for(let n of Object.keys(i))n in e&&(r[n]=e[n]),i[n]&&"object"==typeof i[n]&&!Array.isArray(i[n])&&t(i[n])}(t(e||{})),r}r.d(t,{K:function(){return i}})},6073:function(e,t,r){"use strict";r.d(t,{Tr:function(){return s},c8:function(){return n}});var i=r(95946);let n={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function s(e){let t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?(0,i.ly)(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?(0,i.ly)(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?n[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(t.authorizationList=e.authorizationList.map(e=>({address:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))),t.yParity=(()=>{if(e.yParity)return Number(e.yParity);if("bigint"==typeof t.v){if(0n===t.v||27n===t.v)return 0;if(1n===t.v||28n===t.v)return 1;if(t.v>=35n)return t.v%2n===0n?1:0}})(),"legacy"===t.type&&(delete t.accessList,delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas,delete t.yParity),"eip2930"===t.type&&(delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas),"eip1559"===t.type&&delete t.maxFeePerBlobGas,t}},74688:function(e,t,r){"use strict";r.d(t,{tG:function(){return s}});var i=r(92106);let n={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function s(e){let t={};return void 0!==e.authorizationList&&(t.authorizationList=e.authorizationList.map(e=>({address:e.address,r:e.r?(0,i.eC)(BigInt(e.r)):e.r,s:e.s?(0,i.eC)(BigInt(e.s)):e.s,chainId:(0,i.eC)(e.chainId),nonce:(0,i.eC)(e.nonce),...void 0!==e.yParity?{yParity:(0,i.eC)(e.yParity)}:{},...void 0!==e.v&&void 0===e.yParity?{v:(0,i.eC)(e.v)}:{}}))),void 0!==e.accessList&&(t.accessList=e.accessList),void 0!==e.blobVersionedHashes&&(t.blobVersionedHashes=e.blobVersionedHashes),void 0!==e.blobs&&("string"!=typeof e.blobs[0]?t.blobs=e.blobs.map(e=>(0,i.ci)(e)):t.blobs=e.blobs),void 0!==e.data&&(t.data=e.data),void 0!==e.from&&(t.from=e.from),void 0!==e.gas&&(t.gas=(0,i.eC)(e.gas)),void 0!==e.gasPrice&&(t.gasPrice=(0,i.eC)(e.gasPrice)),void 0!==e.maxFeePerBlobGas&&(t.maxFeePerBlobGas=(0,i.eC)(e.maxFeePerBlobGas)),void 0!==e.maxFeePerGas&&(t.maxFeePerGas=(0,i.eC)(e.maxFeePerGas)),void 0!==e.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=(0,i.eC)(e.maxPriorityFeePerGas)),void 0!==e.nonce&&(t.nonce=(0,i.eC)(e.nonce)),void 0!==e.to&&(t.to=e.to),void 0!==e.type&&(t.type=n[e.type]),void 0!==e.value&&(t.value=(0,i.eC)(e.value)),t}},93714:function(e,t,r){"use strict";function i(e,t,r){let i=e[t.name];if("function"==typeof i)return i;let n=e[r];return"function"==typeof n?n:r=>t(e,r)}r.d(t,{s:function(){return i}})},91734:function(e,t,r){"use strict";r.d(t,{w:function(){return P}});var i=r(41656);let n=BigInt(4294967296-1),s=BigInt(32),a=(e,t,r)=>e<>>32-r,o=(e,t,r)=>t<>>32-r,c=(e,t,r)=>t<>>64-r,l=(e,t,r)=>e<>>64-r;var u=r(15448);let d=[],h=[],f=[],p=BigInt(0),g=BigInt(1),m=BigInt(2),b=BigInt(7),y=BigInt(256),w=BigInt(113);for(let e=0,t=g,r=1,i=0;e<24;e++){[r,i]=[i,(2*r+3*i)%5],d.push(2*(5*i+r)),h.push((e+1)*(e+2)/2%64);let n=p;for(let e=0;e<7;e++)(t=(t<>b)*w)%y)&m&&(n^=g<<(g<>s&n)}:{h:0|Number(e>>s&n),l:0|Number(e&n)}}(e[a],t);[r[a],i[a]]=[o,c]}return[r,i]}(f,!0),E=(e,t,r)=>r>32?c(e,t,r):a(e,t,r),C=(e,t,r)=>r>32?l(e,t,r):o(e,t,r);class _ extends u.kb{constructor(e,t,r,n=!1,s=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,i.k8)(r),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,u.Jq)(this.state)}keccak(){u.iA||(0,u.l1)(this.state32),function(e,t=24){let r=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let i=(t+8)%10,n=(t+2)%10,s=r[n],a=r[n+1],o=E(s,a,1)^r[i],c=C(s,a,1)^r[i+1];for(let r=0;r<50;r+=10)e[t+r]^=o,e[t+r+1]^=c}let t=e[2],n=e[3];for(let r=0;r<24;r++){let i=h[r],s=E(t,n,i),a=C(t,n,i),o=d[r];t=e[o],n=e[o+1],e[o]=s,e[o+1]=a}for(let t=0;t<50;t+=10){for(let i=0;i<10;i++)r[i]=e[t+i];for(let i=0;i<10;i++)e[t+i]^=~r[(i+2)%10]&r[(i+4)%10]}e[0]^=v[i],e[1]^=A[i]}r.fill(0)}(this.state32,this.rounds),u.iA||(0,u.l1)(this.state32),this.posOut=0,this.pos=0}update(e){(0,i.$h)(this);let{blockLen:t,state:r}=this,n=(e=(0,u.O0)(e)).length;for(let i=0;i=r&&this.keccak();let s=Math.min(r-this.posOut,n-i);e.set(t.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,i.k8)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,i.eB)(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:i,rounds:n,enableXOF:s}=this;return e||(e=new _(t,r,i,s,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=i,e.enableXOF=s,e.destroyed=this.destroyed,e}}let I=(0,u.hE)(()=>new _(136,1,32));var S=r(15102),N=r(11187),T=r(92106);function P(e,t){let r=I((0,S.v)(e,{strict:!1})?(0,N.O0)(e):e);return"bytes"===(t||"hex")?r:(0,T.NC)(r)}},96005:function(e,t,r){"use strict";r.d(t,{n:function(){return i}});let i=r(65526).r},58034:function(e,t,r){"use strict";r.d(t,{C:function(){return s}});var i=r(3972),n=r(65526);let s=e=>(0,i.tP)((0,n.r)(e),0,4)},65526:function(e,t,r){"use strict";r.d(t,{r:function(){return d}});var i=r(11187),n=r(91734);let s=e=>(0,n.w)((0,i.O0)(e));var a=r(84917);let o=/^tuple(?(\[(\d*)\])*)$/;function c(e){let t="",r=e.length;for(let i=0;i(function(e){let t=!0,r="",i=0,n="",s=!1;for(let a=0;athis.maxSize){let e=this.keys().next().value;e&&this.delete(e)}return this}}},32357:function(e,t,r){"use strict";r.d(t,{S:function(){return s}});var i=r(15116);let n=new Map;function s({fn:e,id:t,shouldSplitBatch:r,wait:s=0,sort:a}){let o=async()=>{let t=u();c();let r=t.map(({args:e})=>e);0!==r.length&&e(r).then(e=>{a&&Array.isArray(e)&&e.sort(a);for(let r=0;r{for(let r=0;rn.delete(t),l=()=>u().map(({args:e})=>e),u=()=>n.get(t)||[],d=e=>n.set(t,[...u(),e]);return{flush:c,async schedule(e){let{promise:t,resolve:n,reject:a}=(0,i.n)();return(r?.([...l(),e])&&o(),u().length>0)?d({args:e,resolve:n,reject:a}):(d({args:e,resolve:n,reject:a}),setTimeout(o,s)),t}}}},15116:function(e,t,r){"use strict";function i(){let e=()=>void 0,t=()=>void 0;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}r.d(t,{n:function(){return i}})},7760:function(e,t,r){"use strict";r.d(t,{J:function(){return n}});var i=r(62914);function n(e,{delay:t=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((s,a)=>{let o=async({count:c=0}={})=>{let l=async({error:e})=>{let r="function"==typeof t?t({count:c,error:e}):t;r&&await (0,i.D)(r),o({count:c+1})};try{let t=await e();s(t)}catch(e){if(c{(async()=>{let a;try{let o=new AbortController;r>0&&(a=setTimeout(()=>{i?o.abort():s(t)},r)),n(await e({signal:o?.signal||null}))}catch(e){e?.name==="AbortError"&&s(t),s(e)}finally{clearTimeout(a)}})()})}r.d(t,{F:function(){return i}})},50150:function(e,t,r){"use strict";r.d(t,{mF:function(){return l}});var i=r(26087),n=r(69760),s=r(20443),a=r(49321),o=r(92106);function c(e){if(e&&0!==e.length)return e.reduce((e,{slot:t,value:r})=>{if(66!==t.length)throw new n.W_({size:t.length,targetSize:66,type:"hex"});if(66!==r.length)throw new n.W_({size:r.length,targetSize:66,type:"hex"});return e[t]=r,e},{})}function l(e){if(!e)return;let t={};for(let{address:r,...n}of e){if(!(0,a.U)(r,{strict:!1}))throw new i.b({address:r});if(t[r])throw new s.Nc({address:r});t[r]=function(e){let{balance:t,nonce:r,state:i,stateDiff:n,code:a}=e,l={};if(void 0!==a&&(l.code=a),void 0!==t&&(l.balance=(0,o.eC)(t)),void 0!==r&&(l.nonce=(0,o.eC)(r)),void 0!==i&&(l.state=c(i)),void 0!==n){if(l.state)throw new s.Z8;l.stateDiff=c(n)}return l}(n)}return t}},96070:function(e,t,r){"use strict";r.d(t,{P:function(){return i}});let i=(e,t,r)=>JSON.stringify(e,(e,r)=>{let i="bigint"==typeof r?r.toString():r;return"function"==typeof t?t(e,i):i},r)},47531:function(e,t,r){"use strict";r.d(t,{F:function(){return l}});var i=r(14503),n=r(50676),s=r(26087),a=r(26445),o=r(33639),c=r(49321);function l(e){let{account:t,gasPrice:r,maxFeePerGas:l,maxPriorityFeePerGas:u,to:d}=e,h=t?(0,i.T)(t):void 0;if(h&&!(0,c.U)(h.address))throw new s.b({address:h.address});if(d&&!(0,c.U)(d))throw new s.b({address:d});if(void 0!==r&&(void 0!==l||void 0!==u))throw new o.xY;if(l&&l>n.zL)throw new a.Hh({maxFeePerGas:l});if(u&&l&&u>l)throw new a.cs({maxFeePerGas:l,maxPriorityFeePerGas:u})}},75632:function(e,t,r){"use strict";let i;r.d(t,{h:function(){return s}});let n=256;function s(e=11){if(!i||n+e>512){i="",n=0;for(let e=0;e<256;e++)i+=(256+256*Math.random()|0).toString(16).substring(1)}return i.substring(n,n+++e)}},39625:function(e,t,r){"use strict";r.d(t,{d:function(){return s}});var i=r(84192),n=r(15229);function s(e,t="wei"){return(0,n.b)(e,i.ez[t])}},67795:function(e,t,r){"use strict";r.d(t,{o:function(){return s}});var i=r(84192),n=r(15229);function s(e,t="wei"){return(0,n.b)(e,i.Zn[t])}},15229:function(e,t,r){"use strict";function i(e,t){let r=e.toString(),i=r.startsWith("-");i&&(r=r.slice(1));let[n,s]=[(r=r.padStart(t,"0")).slice(0,r.length-t),r.slice(r.length-t)];return s=s.replace(/(0+)$/,""),`${i?"-":""}${n||"0"}${s?`.${s}`:""}`}r.d(t,{b:function(){return i}})},48120:function(e,t,r){"use strict";r.d(t,{v:function(){return s}});var i=r(36117);class n extends i.G{constructor({value:e}){super(`Number \`${e}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function s(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new n({value:e});let[r,i="0"]=e.split("."),s=r.startsWith("-");if(s&&(r=r.slice(1)),i=i.replace(/(0+)$/,""),0===t)1===Math.round(Number(`.${i}`))&&(r=`${BigInt(r)+1n}`),i="";else if(i.length>t){let[e,n,s]=[i.slice(0,t-1),i.slice(t-1,t),i.slice(t)],a=Math.round(Number(`${n}.${s}`));(i=a>9?`${BigInt(e)+BigInt(1)}0`.padStart(e.length+1,"0"):`${e}${a}`).length>t&&(i=i.slice(1),r=`${BigInt(r)+1n}`),i=i.slice(0,t)}else i=i.padEnd(t,"0");return BigInt(`${s?"-":""}${r}${i}`)}},62914:function(e,t,r){"use strict";async function i(e){return new Promise(t=>setTimeout(t,e))}r.d(t,{D:function(){return i}})},41656:function(e,t,r){"use strict";function i(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function n(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function s(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.wrapConstructor");i(e.outputLen),i(e.blockLen)}function a(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function o(e,t){n(e);let r=t.outputLen;if(e.lengths-o&&(this.process(r,0),o=0);for(let e=o;e>n&s),o=Number(r&s),c=i?4:0,l=i?0:4;e.setUint32(t+c,a,i),e.setUint32(t+l,o,i)}(r,s-8,BigInt(8*this.length),a),this.process(r,0);let c=(0,n.GL)(e),l=this.outputLen;if(l%4)throw Error("_sha2: outputLen should be aligned to 32bit");let u=l/4,d=this.get();if(u>d.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e>>3,s=(0,n.np)(r,17)^(0,n.np)(r,19)^r>>>10;c[e]=s+c[e-7]+i+c[e-16]|0}let{A:r,B:i,C:s,D:o,E:l,F:u,G:d,H:h}=this;for(let e=0;e<64;e++){var f,p,g,m;let t=h+((0,n.np)(l,6)^(0,n.np)(l,11)^(0,n.np)(l,25))+((f=l)&u^~f&d)+a[e]+c[e]|0,b=((0,n.np)(r,2)^(0,n.np)(r,13)^(0,n.np)(r,22))+((p=r)&(g=i)^p&(m=s)^g&m)|0;h=d,d=u,u=l,l=o+t|0,o=s,s=i,i=r,r=t+b|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,l=l+this.E|0,u=u+this.F|0,d=d+this.G|0,h=h+this.H|0,this.set(r,i,s,o,l,u,d,h)}roundClean(){c.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}let u=(0,n.hE)(()=>new l)},15448:function(e,t,r){"use strict";r.d(t,{kb:function(){return h},l1:function(){return l},eV:function(){return d},GL:function(){return a},iA:function(){return c},O6:function(){return p},np:function(){return o},O0:function(){return u},Jq:function(){return s},hE:function(){return f}});let i="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;var n=r(41656);function s(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function a(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function o(e,t){return e<<32-t|e>>>t}let c=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];function l(e){for(let r=0;r>>8&65280|t>>>24&255}}function u(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}(e)),(0,n.gk)(e),e}function d(...e){let t=0;for(let r=0;re().update(u(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function p(e=32){if(i&&"function"==typeof i.getRandomValues)return i.getRandomValues(new Uint8Array(e));if(i&&"function"==typeof i.randomBytes)return i.randomBytes(e);throw Error("crypto.getRandomValues must be defined")}},49739:function(e,t,r){"use strict";r.d(t,{V:function(){return a},F:function(){return o}});var i=r(67294),n=r(51785);function s(e){let{children:t,config:r,initialState:s,reconnectOnMount:a=!0}=e,{onMount:o}=function(e,t){let{initialState:r,reconnectOnMount:i}=t;return r&&!e._internal.store.persist.hasHydrated()&&e.setState({...r,chainId:e.chains.some(e=>e.id===r.chainId)?r.chainId:e.chains[0].id,connections:i?r.connections:new Map,status:i?"reconnecting":"disconnected"}),{async onMount(){e._internal.ssr&&(await e._internal.store.persist.rehydrate(),e._internal.mipd&&e._internal.connectors.setState(t=>{let r=new Set;for(let e of t??[])if(e.rdns)for(let t of Array.isArray(e.rdns)?e.rdns:[e.rdns])r.add(t);let i=[];for(let t of e._internal.mipd?.getProviders()??[]){if(r.has(t.info.rdns))continue;let n=e._internal.connectors.providerDetailToConnector(t),s=e._internal.connectors.setup(n);i.push(s)}return[...t,...i]})),i?(0,n.G)(e):e.storage&&e.setState(e=>({...e,connections:new Map}))}}}(r,{initialState:s,reconnectOnMount:a});r._internal.ssr||o();let c=(0,i.useRef)(!0);return(0,i.useEffect)(()=>{if(c.current&&r._internal.ssr)return o(),()=>{c.current=!1}},[]),t}let a=(0,i.createContext)(void 0);function o(e){let{children:t,config:r}=e;return(0,i.createElement)(s,e,(0,i.createElement)(a.Provider,{value:r},t))}},18597:function(e){"use strict";e.exports={i8:"6.6.1"}}},function(e){var t=function(t){return e(e.s=t)};e.O(0,[9774,179],function(){return t(6840),t(43079)}),_N_E=e.O()}]);