g(x,c))a[d]=x,a[n]=c,d=n;else break a}}return b}\nfunction g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if(\"object\"===typeof performance&&\"function\"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q}}var r=[],t=[],u=1,v=null,y=3,z=!1,A=!1,B=!1,D=\"function\"===typeof setTimeout?setTimeout:null,E=\"function\"===typeof clearTimeout?clearTimeout:null,F=\"undefined\"!==typeof setImmediate?setImmediate:null;\n\"undefined\"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(a){for(var b=h(t);null!==b;){if(null===b.callback)k(t);else if(b.startTime<=a)k(t),b.sortIndex=b.expirationTime,f(r,b);else break;b=h(t)}}function H(a){B=!1;G(a);if(!A)if(null!==h(r))A=!0,I(J);else{var b=h(t);null!==b&&K(H,b.startTime-a)}}\nfunction J(a,b){A=!1;B&&(B=!1,E(L),L=-1);z=!0;var c=y;try{G(b);for(v=h(r);null!==v&&(!(v.expirationTime>b)||a&&!M());){var d=v.callback;if(\"function\"===typeof d){v.callback=null;y=v.priorityLevel;var e=d(v.expirationTime<=b);b=exports.unstable_now();\"function\"===typeof e?v.callback=e:v===h(r)&&k(r);G(b)}else k(r);v=h(r)}if(null!==v)var w=!0;else{var m=h(t);null!==m&&K(H,m.startTime-b);w=!1}return w}finally{v=null,y=c,z=!1}}var N=!1,O=null,L=-1,P=5,Q=-1;\nfunction M(){return exports.unstable_now()-Qa||125d?(a.sortIndex=c,f(t,a),null===h(r)&&a===h(t)&&(B?(E(L),L=-1):B=!0,K(H,c-d))):(a.sortIndex=e,f(r,a),A||z||(A=!0,I(J)));return a};\nexports.unstable_shouldYield=M;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c}}};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/scheduler.production.min.js');\n} else {\n module.exports = require('./cjs/scheduler.development.js');\n}\n","import {Backoff} from \"./backoff\";\n\n/**\n * ConstantBackoff always returns the same value.\n */\nexport class ConstantBackoff implements Backoff {\n private readonly backoff: number;\n\n constructor(backoff: number) {\n this.backoff = backoff;\n }\n\n next(): number {\n return this.backoff;\n }\n\n reset = () => {\n // no-op\n }\n}\n","import {Backoff} from \"./backoff\";\n\n/**\n * ExponentialBackoff doubles the backoff with every step until a maximum\n * is reached. This is modelled after the binary exponential-backoff algo-\n * rithm used in computer-networking.\n *\n * The calculation-specification is:\n * backoff = k * 2^s with s in [1, expMax].\n *\n * Example: for initial=100, expMax=7 the ExponentialBackoff will pro-\n * duce the backoff-series [100, 200, 400, 800, 1600, 3200, 6400].\n */\nexport class ExponentialBackoff implements Backoff {\n private readonly initial: number;\n private readonly expMax: number;\n private expCurrent: number;\n private current: number;\n\n constructor(initial: number, expMax: number) {\n this.initial = initial;\n this.expMax = expMax;\n this.expCurrent = 1;\n this.current = this.initial;\n }\n\n next(): number {\n const backoff = this.current;\n if (this.expMax > this.expCurrent++)\n this.current = this.current * 2;\n return backoff;\n }\n\n reset() {\n this.expCurrent = 1;\n this.current = this.initial;\n }\n}","import {Backoff} from \"./backoff\";\n\n/**\n * LinearBackoff increases the backoff-time by a constant number with\n * every step. An optional maximum can be provided as an upper bound\n * to the returned backoff.\n *\n * Example: for initial=0, increment=2000, maximum=8000 the Linear-\n * Backoff will produce the series [0, 2000, 4000, 6000, 8000].\n */\nexport class LinearBackoff implements Backoff {\n private readonly initial: number;\n private readonly increment: number;\n private readonly maximum?: number;\n private current: number;\n\n constructor(initial: number, increment: number, maximum?: number) {\n this.initial = initial;\n this.increment = increment;\n this.maximum = maximum;\n this.current = this.initial;\n }\n\n next() {\n const backoff = this.current;\n const next = this.current + this.increment;\n if (this.maximum === undefined)\n this.current = next;\n else if (next <= this.maximum)\n this.current = next;\n return backoff;\n }\n\n reset() {\n this.current = this.initial;\n }\n}\n","import {Buffer} from \"./buffer\";\n\n/**\n * LRUBuffer is a buffer that keeps the last n elements. When it is\n * full and written to, the oldest element in the buffer will be\n * replaced. When reading from the LRUBuffer, elements are returned\n * in FIFO-order (queue).\n *\n * LRUBuffer has linear space- and time-requirements. Internally\n * an array is used as a circular-buffer. All memory is allocated\n * on initialization.\n */\nexport class LRUBuffer implements Buffer {\n private readonly buffer: E[];\n private writePtr: number = 0;\n private wrapped: boolean = false;\n\n constructor(len: number) {\n this.buffer = Array(len);\n }\n\n len(): number {\n return this.wrapped ? this.buffer.length : this.writePtr;\n }\n\n cap(): number {\n return this.buffer.length;\n }\n\n read(es: E[]): number {\n if (es === null || es === undefined || es.length === 0 || this.buffer.length === 0)\n return 0;\n if (this.writePtr === 0 && !this.wrapped)\n return 0;\n const first = this.wrapped ? this.writePtr : 0;\n const last = (first - 1) < 0 ?\n this.buffer.length - 1 :\n first - 1;\n for (let i = 0; i < es.length; i++) {\n let r = (first + i) % this.buffer.length;\n es[i] = this.buffer[r];\n if (r === last)\n return i + 1;\n }\n return es.length;\n }\n\n write(es: E[]): number {\n if (es === null || es === undefined || es.length === 0 || this.buffer.length === 0)\n return 0;\n const start = es.length > this.buffer.length ? es.length - this.buffer.length : 0;\n for (let i = 0; i < es.length - start; i++) {\n this.buffer[this.writePtr] = es[start + i];\n this.writePtr = (this.writePtr + 1) % this.buffer.length;\n if (this.writePtr === 0)\n this.wrapped = true;\n }\n return es.length;\n }\n\n forEach(fn: (e: E) => any): number {\n if (this.writePtr === 0 && !this.wrapped)\n return 0;\n let cur = this.wrapped ? this.writePtr : 0;\n const last = this.wrapped ? (cur - 1) < 0 ? this.buffer.length - 1 : cur - 1 : this.writePtr - 1;\n const len = this.len();\n while (true) {\n fn(this.buffer[cur]);\n if (cur === last)\n break;\n cur = (cur + 1) % this.buffer.length;\n }\n return len;\n }\n\n clear(): void {\n this.writePtr = 0;\n this.wrapped = false;\n }\n}","import {Buffer} from \"./buffer\";\n\n/**\n * TimeBuffer keeps the elements that were written to the buffer\n * within maxAge milliseconds. For example, to keep items in the\n * buffer that are less than a minute old, create the buffer with\n * maxAge equal to 60.000.\n *\n * When reading from the TimeBuffer, elements will be returned\n * in FIFO-order (queue).\n */\nexport class TimeBuffer implements Buffer {\n private readonly maxAge: number;\n private tail?: elementWithTimestamp;\n private head?: elementWithTimestamp;\n\n constructor(maxAge: number) {\n this.maxAge = maxAge;\n }\n\n cap(): number {\n return Number.POSITIVE_INFINITY;\n }\n\n len(): number {\n this.forwardTail();\n let cur = this.tail;\n let i = 0;\n while (cur !== undefined) {\n i++;\n cur = cur.n;\n }\n return i;\n }\n\n read(es: E[]): number {\n this.forwardTail();\n if (es.length === 0)\n return 0;\n let cur = this.tail;\n let i = 0;\n while (cur !== undefined) {\n es[i++] = cur.e;\n if (i === es.length)\n break;\n cur = cur.n;\n }\n return i;\n }\n\n write(es: E[]): number {\n for (let i = 0; i < es.length; i++)\n this.putElement(es[i]);\n return es.length;\n }\n\n forEach(fn: (e: E) => any): number {\n this.forwardTail();\n let cur = this.tail;\n let i = 0;\n while (cur !== undefined) {\n fn(cur.e);\n i++;\n cur = cur.n;\n }\n return i;\n }\n\n private putElement(e: E) {\n const newElement = {e, t: Date.now(), n: undefined} as elementWithTimestamp;\n if (this.tail === undefined)\n this.tail = newElement;\n if (this.head === undefined)\n this.head = newElement\n else {\n this.head.n = newElement;\n this.head = newElement;\n }\n }\n\n private forwardTail() {\n if (this.tail === undefined)\n return;\n const d = Date.now();\n while (d - this.tail.t > this.maxAge) {\n if (this.tail === this.head) {\n this.tail = undefined;\n this.head = undefined;\n } else\n this.tail = this.tail.n;\n if (this.tail === undefined)\n break;\n }\n }\n\n clear(): void {\n // TODO\n }\n}\n\ntype elementWithTimestamp = {\n e: E,\n t: number,\n n?: elementWithTimestamp\n}","export * from './backoff/backoff';\nexport * from './backoff/constantbackoff'\nexport * from './backoff/exponentialbackoff'\nexport * from './backoff/linearbackoff'\nexport * from './buffer/buffer';\nexport * from './buffer/lrubuffer'\nexport * from './buffer/timebuffer'\nexport * from './websocket';\nexport * from './websocketBuilder';\n","import {Backoff} from \"./backoff/backoff\";\nimport {Buffer} from \"./buffer/buffer\";\n\ntype eventListener = {\n readonly listener: (instance: Websocket, ev: WebsocketEventMap[K]) => any;\n readonly options?: boolean | EventListenerOptions;\n}\n\nexport enum WebsocketEvents {\n open = 'open', // Connection is opened or re-opened\n close = 'close', // Connection is closed\n error = 'error', // An error occurred\n message = 'message', // A message was received\n retry = 'retry' // A try to re-connect is made\n}\n\ninterface WebsocketEventMap {\n close: CloseEvent;\n error: Event;\n message: MessageEvent;\n open: Event;\n retry: CustomEvent;\n}\n\nexport interface RetryEventDetails {\n readonly retries: number;\n readonly backoff: number\n}\n\ntype WebsocketEventListeners = {\n open: eventListener[];\n close: eventListener[];\n error: eventListener[];\n message: eventListener[];\n retry: eventListener[];\n}\n\ntype WebsocketBuffer = Buffer;\n\nexport class Websocket {\n private readonly url: string;\n private readonly protocols?: string | string[];\n private readonly buffer?: WebsocketBuffer;\n private readonly backoff?: Backoff;\n private readonly eventListeners: WebsocketEventListeners = {open: [], close: [], error: [], message: [], retry: []};\n private closedByUser: boolean = false;\n private websocket?: WebSocket;\n private retries: number = 0;\n\n constructor(url: string, protocols?: string | string[], buffer?: WebsocketBuffer, backoff?: Backoff) {\n this.url = url;\n this.protocols = protocols;\n this.buffer = buffer;\n this.backoff = backoff;\n this.tryConnect();\n }\n\n get underlyingWebsocket(): WebSocket | undefined {\n return this.websocket;\n }\n\n public send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void {\n if (this.closedByUser)\n return;\n if (this.websocket === undefined || this.websocket.readyState !== this.websocket.OPEN)\n this.buffer?.write([data]);\n else\n this.websocket.send(data);\n }\n\n public close(code?: number, reason?: string): void {\n this.closedByUser = true;\n this.websocket?.close(code, reason);\n }\n\n public addEventListener(\n type: K,\n listener: (instance: Websocket, ev: WebsocketEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions): void {\n const eventListener = {listener, options} as eventListener;\n const eventListeners = this.eventListeners[type] as eventListener[];\n eventListeners.push(eventListener);\n }\n\n public removeEventListener(\n type: K,\n listener: (instance: Websocket, ev: WebsocketEventMap[K]) => any,\n options?: boolean | EventListenerOptions): void {\n (this.eventListeners[type] as eventListener[]) =\n (this.eventListeners[type] as eventListener[])\n .filter(l => {\n return l.listener !== listener && (l.options === undefined || l.options !== options);\n });\n }\n\n private dispatchEvent(type: K, ev: WebsocketEventMap[K]) {\n const listeners = this.eventListeners[type] as eventListener[];\n const onceListeners = [] as eventListener[];\n listeners.forEach(l => {\n l.listener(this, ev); // call listener\n if (l.options !== undefined && (l.options as AddEventListenerOptions).once)\n onceListeners.push(l);\n });\n onceListeners.forEach(l => this.removeEventListener(type, l.listener, l.options)); // remove 'once'-listeners\n }\n\n private tryConnect(): void {\n if (this.websocket !== undefined) { // remove all event-listeners from broken socket\n this.websocket.removeEventListener(WebsocketEvents.open, this.handleOpenEvent);\n this.websocket.removeEventListener(WebsocketEvents.close, this.handleCloseEvent);\n this.websocket.removeEventListener(WebsocketEvents.error, this.handleErrorEvent);\n this.websocket.removeEventListener(WebsocketEvents.message, this.handleMessageEvent);\n this.websocket.close();\n }\n this.websocket = new WebSocket(this.url, this.protocols); // create new socket and attach handlers\n this.websocket.addEventListener(WebsocketEvents.open, this.handleOpenEvent);\n this.websocket.addEventListener(WebsocketEvents.close, this.handleCloseEvent);\n this.websocket.addEventListener(WebsocketEvents.error, this.handleErrorEvent);\n this.websocket.addEventListener(WebsocketEvents.message, this.handleMessageEvent);\n }\n\n private handleOpenEvent = (ev: Event) => this.handleEvent(WebsocketEvents.open, ev);\n\n private handleCloseEvent = (ev: CloseEvent) => this.handleEvent(WebsocketEvents.close, ev);\n\n private handleErrorEvent = (ev: Event) => this.handleEvent(WebsocketEvents.error, ev);\n\n private handleMessageEvent = (ev: MessageEvent) => this.handleEvent(WebsocketEvents.message, ev);\n\n private handleEvent(type: K, ev: WebsocketEventMap[K]) {\n switch (type) {\n case WebsocketEvents.close:\n if (!this.closedByUser) // failed to connect or connection lost, try to reconnect\n this.reconnect();\n break;\n case WebsocketEvents.open:\n this.retries = 0;\n this.backoff?.reset(); // reset backoff\n this.buffer?.forEach(this.send.bind(this)); // send all buffered messages\n this.buffer?.clear();\n break;\n }\n this.dispatchEvent(type, ev); // forward to all listeners\n }\n\n private reconnect() {\n if (this.backoff === undefined) // no backoff, we're done\n return;\n const backoff = this.backoff.next();\n setTimeout(() => { // retry connection after waiting out the backoff-interval\n this.dispatchEvent(WebsocketEvents.retry, new CustomEvent(WebsocketEvents.retry,\n {\n detail: {\n retries: ++this.retries,\n backoff: backoff\n }\n })\n );\n this.tryConnect();\n }, backoff);\n }\n}","import {Backoff} from \"./backoff/backoff\";\nimport {Buffer} from \"./buffer/buffer\";\nimport {RetryEventDetails, Websocket, WebsocketEvents} from \"./websocket\";\n\n/**\n * Used to build Websocket-instances.\n */\nexport class WebsocketBuilder {\n private readonly url: string;\n private ws: Websocket | null = null;\n private protocols?: string | string[];\n private backoff?: Backoff;\n private buffer?: Buffer;\n private onOpenListeners: ({\n listener: (instance: Websocket, ev: Event) => any,\n options?: boolean | EventListenerOptions\n })[] = [];\n private onCloseListeners: ({\n listener: (instance: Websocket, ev: CloseEvent) => any,\n options?: boolean | EventListenerOptions\n })[] = [];\n private onErrorListeners: ({\n listener: (instance: Websocket, ev: Event) => any,\n options?: boolean | EventListenerOptions\n })[] = [];\n private onMessageListeners: ({\n listener: (instance: Websocket, ev: MessageEvent) => any,\n options?: boolean | EventListenerOptions\n })[] = [];\n private onRetryListeners: ({\n listener: (instance: Websocket, ev: CustomEvent) => any,\n options?: boolean | EventListenerOptions\n })[] = [];\n\n constructor(url: string) {\n this.url = url;\n }\n\n public withProtocols(p: string | string[]): WebsocketBuilder {\n this.protocols = p;\n return this;\n }\n\n public withBackoff(backoff: Backoff): WebsocketBuilder {\n this.backoff = backoff;\n return this;\n }\n\n public withBuffer(buffer: Buffer): WebsocketBuilder {\n this.buffer = buffer;\n return this;\n }\n\n public onOpen(listener: (instance: Websocket, ev: Event) => any,\n options?: boolean | EventListenerOptions): WebsocketBuilder {\n this.onOpenListeners.push({listener, options});\n return this;\n }\n\n public onClose(listener: (instance: Websocket, ev: CloseEvent) => any,\n options?: boolean | EventListenerOptions): WebsocketBuilder {\n this.onCloseListeners.push({listener, options});\n return this;\n }\n\n public onError(listener: (instance: Websocket, ev: Event) => any,\n options?: boolean | EventListenerOptions): WebsocketBuilder {\n this.onErrorListeners.push({listener, options});\n return this;\n }\n\n public onMessage(listener: (instance: Websocket, ev: MessageEvent) => any,\n options?: boolean | EventListenerOptions): WebsocketBuilder {\n this.onMessageListeners.push({listener, options});\n return this;\n }\n\n public onRetry(listener: (instance: Websocket, ev: CustomEvent) => any,\n options?: boolean | EventListenerOptions): WebsocketBuilder {\n this.onRetryListeners.push({listener, options});\n return this;\n }\n\n /**\n * Multiple calls to build() will always return the same websocket-instance.\n */\n public build(): Websocket {\n if (this.ws !== null)\n return this.ws;\n this.ws = new Websocket(this.url, this.protocols, this.buffer, this.backoff);\n this.onOpenListeners.forEach(h => this.ws?.addEventListener(WebsocketEvents.open, h.listener, h.options));\n this.onCloseListeners.forEach(h => this.ws?.addEventListener(WebsocketEvents.close, h.listener, h.options));\n this.onErrorListeners.forEach(h => this.ws?.addEventListener(WebsocketEvents.error, h.listener, h.options));\n this.onMessageListeners.forEach(h => this.ws?.addEventListener(WebsocketEvents.message, h.listener, h.options));\n this.onRetryListeners.forEach(h => this.ws?.addEventListener(WebsocketEvents.retry, h.listener, h.options));\n return this.ws;\n }\n}","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}","import _typeof from \"./typeof.js\";\nexport default function _regeneratorRuntime() {\n \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */\n _regeneratorRuntime = function _regeneratorRuntime() {\n return exports;\n };\n var exports = {},\n Op = Object.prototype,\n hasOwn = Op.hasOwnProperty,\n defineProperty = Object.defineProperty || function (obj, key, desc) {\n obj[key] = desc.value;\n },\n $Symbol = \"function\" == typeof Symbol ? Symbol : {},\n iteratorSymbol = $Symbol.iterator || \"@@iterator\",\n asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\",\n toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n function define(obj, key, value) {\n return Object.defineProperty(obj, key, {\n value: value,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }), obj[key];\n }\n try {\n define({}, \"\");\n } catch (err) {\n define = function define(obj, key, value) {\n return obj[key] = value;\n };\n }\n function wrap(innerFn, outerFn, self, tryLocsList) {\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,\n generator = Object.create(protoGenerator.prototype),\n context = new Context(tryLocsList || []);\n return defineProperty(generator, \"_invoke\", {\n value: makeInvokeMethod(innerFn, self, context)\n }), generator;\n }\n function tryCatch(fn, obj, arg) {\n try {\n return {\n type: \"normal\",\n arg: fn.call(obj, arg)\n };\n } catch (err) {\n return {\n type: \"throw\",\n arg: err\n };\n }\n }\n exports.wrap = wrap;\n var ContinueSentinel = {};\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n var getProto = Object.getPrototypeOf,\n NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);\n var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function (method) {\n define(prototype, method, function (arg) {\n return this._invoke(method, arg);\n });\n });\n }\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (\"throw\" !== record.type) {\n var result = record.arg,\n value = result.value;\n return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) {\n invoke(\"next\", value, resolve, reject);\n }, function (err) {\n invoke(\"throw\", err, resolve, reject);\n }) : PromiseImpl.resolve(value).then(function (unwrapped) {\n result.value = unwrapped, resolve(result);\n }, function (error) {\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n reject(record.arg);\n }\n var previousPromise;\n defineProperty(this, \"_invoke\", {\n value: function value(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function (resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();\n }\n });\n }\n function makeInvokeMethod(innerFn, self, context) {\n var state = \"suspendedStart\";\n return function (method, arg) {\n if (\"executing\" === state) throw new Error(\"Generator is already running\");\n if (\"completed\" === state) {\n if (\"throw\" === method) throw arg;\n return doneResult();\n }\n for (context.method = method, context.arg = arg;;) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) {\n if (\"suspendedStart\" === state) throw state = \"completed\", context.arg;\n context.dispatchException(context.arg);\n } else \"return\" === context.method && context.abrupt(\"return\", context.arg);\n state = \"executing\";\n var record = tryCatch(innerFn, self, context);\n if (\"normal\" === record.type) {\n if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue;\n return {\n value: record.arg,\n done: context.done\n };\n }\n \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg);\n }\n };\n }\n function maybeInvokeDelegate(delegate, context) {\n var methodName = context.method,\n method = delegate.iterator[methodName];\n if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), ContinueSentinel;\n var record = tryCatch(method, delegate.iterator, context.arg);\n if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel;\n var info = record.arg;\n return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel);\n }\n function pushTryEntry(locs) {\n var entry = {\n tryLoc: locs[0]\n };\n 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);\n }\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\", delete record.arg, entry.completion = record;\n }\n function Context(tryLocsList) {\n this.tryEntries = [{\n tryLoc: \"root\"\n }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);\n }\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) return iteratorMethod.call(iterable);\n if (\"function\" == typeof iterable.next) return iterable;\n if (!isNaN(iterable.length)) {\n var i = -1,\n next = function next() {\n for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;\n return next.value = undefined, next.done = !0, next;\n };\n return next.next = next;\n }\n }\n return {\n next: doneResult\n };\n }\n function doneResult() {\n return {\n value: undefined,\n done: !0\n };\n }\n return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", {\n value: GeneratorFunctionPrototype,\n configurable: !0\n }), defineProperty(GeneratorFunctionPrototype, \"constructor\", {\n value: GeneratorFunction,\n configurable: !0\n }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) {\n var ctor = \"function\" == typeof genFun && genFun.constructor;\n return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name));\n }, exports.mark = function (genFun) {\n return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun;\n }, exports.awrap = function (arg) {\n return {\n __await: arg\n };\n }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n void 0 === PromiseImpl && (PromiseImpl = Promise);\n var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);\n return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {\n return result.done ? result.value : iter.next();\n });\n }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () {\n return this;\n }), define(Gp, \"toString\", function () {\n return \"[object Generator]\";\n }), exports.keys = function (val) {\n var object = Object(val),\n keys = [];\n for (var key in object) keys.push(key);\n return keys.reverse(), function next() {\n for (; keys.length;) {\n var key = keys.pop();\n if (key in object) return next.value = key, next.done = !1, next;\n }\n return next.done = !0, next;\n };\n }, exports.values = values, Context.prototype = {\n constructor: Context,\n reset: function reset(skipTempReset) {\n if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);\n },\n stop: function stop() {\n this.done = !0;\n var rootRecord = this.tryEntries[0].completion;\n if (\"throw\" === rootRecord.type) throw rootRecord.arg;\n return this.rval;\n },\n dispatchException: function dispatchException(exception) {\n if (this.done) throw exception;\n var context = this;\n function handle(loc, caught) {\n return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught;\n }\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i],\n record = entry.completion;\n if (\"root\" === entry.tryLoc) return handle(\"end\");\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\"),\n hasFinally = hasOwn.call(entry, \"finallyLoc\");\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);\n if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);\n } else {\n if (!hasFinally) throw new Error(\"try statement without catch or finally\");\n if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);\n }\n }\n }\n },\n abrupt: function abrupt(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);\n var record = finallyEntry ? finallyEntry.completion : {};\n return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);\n },\n complete: function complete(record, afterLoc) {\n if (\"throw\" === record.type) throw record.arg;\n return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;\n },\n finish: function finish(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;\n }\n },\n \"catch\": function _catch(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (\"throw\" === record.type) {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n throw new Error(\"illegal catch attempt\");\n },\n delegateYield: function delegateYield(iterable, resultName, nextLoc) {\n return this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel;\n }\n }, exports;\n}","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n _next(undefined);\n });\n };\n}","export default function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n return arr2;\n}","import arrayLikeToArray from \"./arrayLikeToArray.js\";\nexport default function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}","import arrayWithHoles from \"./arrayWithHoles.js\";\nimport iterableToArrayLimit from \"./iterableToArrayLimit.js\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nimport nonIterableRest from \"./nonIterableRest.js\";\nexport default function _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}","export default function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}","export default function _iterableToArrayLimit(arr, i) {\n var _i = null == arr ? null : \"undefined\" != typeof Symbol && arr[Symbol.iterator] || arr[\"@@iterator\"];\n if (null != _i) {\n var _s,\n _e,\n _x,\n _r,\n _arr = [],\n _n = !0,\n _d = !1;\n try {\n if (_x = (_i = _i.call(arr)).next, 0 === i) {\n if (Object(_i) !== _i) return;\n _n = !1;\n } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);\n } catch (err) {\n _d = !0, _e = err;\n } finally {\n try {\n if (!_n && null != _i[\"return\"] && (_r = _i[\"return\"](), Object(_r) !== _r)) return;\n } finally {\n if (_d) throw _e;\n }\n }\n return _arr;\n }\n}","export default function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function _toPropertyKey(arg) {\n var key = toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}","import _typeof from \"./typeof.js\";\nexport default function _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}","import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);\n }\n}\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","export default function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n return self;\n}","import getPrototypeOf from \"./getPrototypeOf.js\";\nimport isNativeReflectConstruct from \"./isNativeReflectConstruct.js\";\nimport possibleConstructorReturn from \"./possibleConstructorReturn.js\";\nexport default function _createSuper(Derived) {\n var hasNativeReflectConstruct = isNativeReflectConstruct();\n return function _createSuperInternal() {\n var Super = getPrototypeOf(Derived),\n result;\n if (hasNativeReflectConstruct) {\n var NewTarget = getPrototypeOf(this).constructor;\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n return possibleConstructorReturn(this, result);\n };\n}","import _typeof from \"./typeof.js\";\nimport assertThisInitialized from \"./assertThisInitialized.js\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n return assertThisInitialized(self);\n}","import unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nexport default function _createForOfIteratorHelper(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (!it) {\n if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n var F = function F() {};\n return {\n s: F,\n n: function n() {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n },\n e: function e(_e) {\n throw _e;\n },\n f: F\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n var normalCompletion = true,\n didErr = false,\n err;\n return {\n s: function s() {\n it = it.call(o);\n },\n n: function n() {\n var step = it.next();\n normalCompletion = step.done;\n return step;\n },\n e: function e(_e2) {\n didErr = true;\n err = _e2;\n },\n f: function f() {\n try {\n if (!normalCompletion && it[\"return\"] != null) it[\"return\"]();\n } finally {\n if (didErr) throw err;\n }\n }\n };\n}","import superPropBase from \"./superPropBase.js\";\nexport default function _get() {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n _get = Reflect.get.bind();\n } else {\n _get = function _get(target, property, receiver) {\n var base = superPropBase(target, property);\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n if (desc.get) {\n return desc.get.call(arguments.length < 3 ? target : receiver);\n }\n return desc.value;\n };\n }\n return _get.apply(this, arguments);\n}","import getPrototypeOf from \"./getPrototypeOf.js\";\nexport default function _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = getPrototypeOf(object);\n if (object === null) break;\n }\n return object;\n}","import arrayWithoutHoles from \"./arrayWithoutHoles.js\";\nimport iterableToArray from \"./iterableToArray.js\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nimport nonIterableSpread from \"./nonIterableSpread.js\";\nexport default function _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}","import arrayLikeToArray from \"./arrayLikeToArray.js\";\nexport default function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}","export default function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter);\n}","export default function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import toPropertyKey from \"./toPropertyKey.js\";\nexport default function _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nimport isNativeReflectConstruct from \"./isNativeReflectConstruct.js\";\nexport default function _construct(Parent, args, Class) {\n if (isNativeReflectConstruct()) {\n _construct = Reflect.construct.bind();\n } else {\n _construct = function _construct(Parent, args, Class) {\n var a = [null];\n a.push.apply(a, args);\n var Constructor = Function.bind.apply(Parent, a);\n var instance = new Constructor();\n if (Class) setPrototypeOf(instance, Class.prototype);\n return instance;\n };\n }\n return _construct.apply(null, arguments);\n}","import getPrototypeOf from \"./getPrototypeOf.js\";\nimport setPrototypeOf from \"./setPrototypeOf.js\";\nimport isNativeFunction from \"./isNativeFunction.js\";\nimport construct from \"./construct.js\";\nexport default function _wrapNativeSuper(Class) {\n var _cache = typeof Map === \"function\" ? new Map() : undefined;\n _wrapNativeSuper = function _wrapNativeSuper(Class) {\n if (Class === null || !isNativeFunction(Class)) return Class;\n if (typeof Class !== \"function\") {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n if (typeof _cache !== \"undefined\") {\n if (_cache.has(Class)) return _cache.get(Class);\n _cache.set(Class, Wrapper);\n }\n function Wrapper() {\n return construct(Class, arguments, getPrototypeOf(this).constructor);\n }\n Wrapper.prototype = Object.create(Class.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n return setPrototypeOf(Wrapper, Class);\n };\n return _wrapNativeSuper(Class);\n}","export default function _isNativeFunction(fn) {\n return Function.toString.call(fn).indexOf(\"[native code]\") !== -1;\n}","export enum SDKErrorCode {\n MissingApiKey = 'MISSING_API_KEY',\n ModalNotReady = 'MODAL_NOT_READY',\n MalformedResponse = 'MALFORMED_RESPONSE',\n InvalidArgument = 'INVALID_ARGUMENT',\n ExtensionNotInitialized = 'EXTENSION_NOT_INITIALIZED',\n IncompatibleExtensions = 'INCOMPATIBLE_EXTENSIONS',\n}\n\nexport enum SDKWarningCode {\n SyncWeb3Method = 'SYNC_WEB3_METHOD',\n DuplicateIframe = 'DUPLICATE_IFRAME',\n ReactNativeEndpointConfiguration = 'REACT_NATIVE_ENDPOINT_CONFIGURATION',\n DeprecationNotice = 'DEPRECATION_NOTICE',\n}\n\nexport enum RPCErrorCode {\n // Standard JSON RPC 2.0 Error Codes\n ParseError = -32700,\n InvalidRequest = -32600,\n MethodNotFound = -32601,\n InvalidParams = -32602,\n InternalError = -32603,\n\n // Custom RPC Error Codes\n MagicLinkFailedVerification = -10000,\n MagicLinkExpired = -10001,\n MagicLinkRateLimited = -10002,\n MagicLinkInvalidRedirectURL = -10006,\n UserAlreadyLoggedIn = -10003,\n UpdateEmailFailed = -10004,\n UserRequestEditEmail = -10005,\n InactiveRecipient = -10010,\n AccessDeniedToUser = -10011,\n}\n\nexport type ErrorCode = SDKErrorCode | RPCErrorCode;\nexport type WarningCode = SDKWarningCode;\n","import { RPCErrorCode } from './exception-types';\n\n// --- Request interfaces\n\nexport interface JsonRpcRequestPayload {\n jsonrpc: string;\n id: string | number | null;\n method: string;\n params?: TParams;\n}\n\nexport interface JsonRpcRequestCallback {\n /** Callback executed upon JSON RPC response. */\n (err: JsonRpcError | null, result?: JsonRpcResponsePayload | null): void;\n}\n\nexport interface JsonRpcBatchRequestCallback {\n /** Callback executed upon JSON RPC response. */\n (err: JsonRpcError | null, result?: (JsonRpcResponsePayload | null)[] | null): void;\n}\n\n// --- Response interfaces\n\nexport interface JsonRpcError {\n message: string;\n code: RPCErrorCode;\n data?: any;\n}\n\nexport interface JsonRpcResponsePayload {\n jsonrpc: string;\n id: string | number | null;\n result?: ResultType | null;\n error?: JsonRpcError | null;\n}\n\nexport interface UserInfo {\n email?: string;\n}\n\nexport interface WalletInfo {\n walletType: 'magic' | 'metamask' | 'coinbase_wallet' | 'wallet_connect';\n}\n\nexport interface RequestUserInfoScope {\n scope?: {\n email?: 'required' | 'optional';\n };\n}\n\nexport interface NFTPurchaseRequest {\n nft: {\n name: string;\n price: number;\n currencyCode: string;\n contractAddress: string;\n collection?: string;\n imageUrl?: string;\n };\n identityPrefill: {\n firstName: string;\n lastName: string;\n dateOfBirth: string; // YYYY-MM-DD\n emailAddress: string;\n phone: string;\n address: {\n street1: string;\n street2: string;\n city: string;\n regionCode: string;\n postalCode: string;\n countryCode: string;\n };\n };\n}\n\nexport type NFTPurchaseStatus = 'processed' | 'declined' | 'expired';\n\nexport interface NFTPurchaseResponse {\n status: NFTPurchaseStatus;\n}\n\n// --- Payload methods\n\n/**\n * Enum of JSON RPC methods for interacting with the Magic SDK authentication\n * relayer.\n */\nexport enum MagicPayloadMethod {\n LoginWithSms = 'magic_auth_login_with_sms',\n LoginWithEmailOTP = 'magic_auth_login_with_email_otp',\n LoginWithMagicLink = 'magic_auth_login_with_magic_link',\n LoginWithCredential = 'magic_auth_login_with_credential',\n GetIdToken = 'magic_auth_get_id_token',\n GenerateIdToken = 'magic_auth_generate_id_token',\n GetMetadata = 'magic_auth_get_metadata',\n IsLoggedIn = 'magic_auth_is_logged_in',\n Logout = 'magic_auth_logout',\n UpdateEmail = 'magic_auth_update_email',\n UserSettings = 'magic_auth_settings',\n UserSettingsTestMode = 'magic_auth_settings_testing_mode',\n LoginWithSmsTestMode = 'magic_auth_login_with_sms_testing_mode',\n LoginWithEmailOTPTestMode = 'magic_auth_login_with_email_otp_testing_mode',\n LoginWithMagicLinkTestMode = 'magic_login_with_magic_link_testing_mode',\n LoginWithCredentialTestMode = 'magic_auth_login_with_credential_testing_mode',\n GetIdTokenTestMode = 'magic_auth_get_id_token_testing_mode',\n GenerateIdTokenTestMode = 'magic_auth_generate_id_token_testing_mode',\n GetMetadataTestMode = 'magic_auth_get_metadata_testing_mode',\n IsLoggedInTestMode = 'magic_auth_is_logged_in_testing_mode',\n LogoutTestMode = 'magic_auth_logout_testing_mode',\n UpdateEmailTestMode = 'magic_auth_update_email_testing_mode',\n IntermediaryEvent = 'magic_intermediary_event',\n RequestAccounts = 'eth_requestAccounts',\n GetInfo = 'mc_get_wallet_info',\n ShowUI = 'mc_wallet',\n NFTPurchase = 'magic_nft_purchase',\n RequestUserInfoWithUI = 'mc_request_user_info',\n Disconnect = 'mc_disconnect',\n UpdatePhoneNumber = 'magic_auth_update_phone_number',\n UpdatePhoneNumberTestMode = 'magic_auth_update_phone_number_testing_mode',\n RecoverAccount = 'magic_auth_recover_account',\n RecoverAccountTestMode = 'magic_auth_recover_account_testing_mode',\n}\n","import { JsonRpcResponsePayload, JsonRpcError, JsonRpcRequestPayload } from './json-rpc-types';\n\nexport enum MagicIncomingWindowMessage {\n MAGIC_HANDLE_RESPONSE = 'MAGIC_HANDLE_RESPONSE',\n MAGIC_OVERLAY_READY = 'MAGIC_OVERLAY_READY',\n MAGIC_SHOW_OVERLAY = 'MAGIC_SHOW_OVERLAY',\n MAGIC_HIDE_OVERLAY = 'MAGIC_HIDE_OVERLAY',\n MAGIC_HANDLE_EVENT = 'MAGIC_HANDLE_EVENT',\n}\n\nexport enum MagicOutgoingWindowMessage {\n MAGIC_HANDLE_REQUEST = 'MAGIC_HANDLE_REQUEST',\n}\n\n/** The shape of responding window message datas from the Magic iframe context. */\nexport interface MagicMessageRequest {\n msgType: string;\n payload: JsonRpcRequestPayload | JsonRpcRequestPayload[];\n rt?: string;\n jwt?: string;\n}\n\n/** The shape of responding window message datas from the Magic iframe context. */\nexport interface MagicMessageResponse {\n msgType: string;\n response: Partial & Partial>;\n rt?: string;\n}\n\n/** The expected message event returned by the Magic iframe context. */\nexport interface MagicMessageEvent extends Partial {\n data: MagicMessageResponse;\n}\n","export type EthNetworkName = 'mainnet' | 'goerli';\n\nexport enum EthChainType {\n Harmony = 'HARMONY',\n}\n\nexport interface CustomNodeConfiguration {\n rpcUrl: string;\n chainId?: number;\n chainType?: EthChainType;\n}\n\nexport type EthNetworkConfiguration = EthNetworkName | CustomNodeConfiguration;\n","function* createIntGenerator(): Generator {\n let index = 0;\n\n while (true) {\n /* istanbul ignore next */\n if (index < Number.MAX_SAFE_INTEGER) yield ++index;\n else index = 0;\n }\n}\n\nconst intGenerator = createIntGenerator();\n\n/**\n * Get an integer ID for attaching to a JSON RPC request payload.\n */\nexport function getPayloadId(): number {\n return intGenerator.next().value;\n}\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","/* eslint-disable */\n/* istanbul ignore file */\n\n// DO NOT CHANGE THIS FILE.\n//\n// We have to bundle `semver` ourselves due to a long-standing cyclic dependency\n// which causes Rollup to break the `satisfies` function.\n//\n// See:\n// - https://github.com/magiclabs/magic-js/issues/198\n// - https://github.com/rollup/plugins/issues/879\n// - https://github.com/npm/node-semver/issues/318\n// - https://github.com/npm/node-semver/issues/381\n\nfunction createCommonjsModule(e){const r={exports:{}};return e(r,r.exports),r.exports}const SEMVER_SPEC_VERSION=\"2.0.0\",MAX_LENGTH$2=256,MAX_SAFE_INTEGER$1=Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH=16,constants={SEMVER_SPEC_VERSION:\"2.0.0\",MAX_LENGTH:256,MAX_SAFE_INTEGER:MAX_SAFE_INTEGER$1,MAX_SAFE_COMPONENT_LENGTH:16},debug=\"object\"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\\bsemver\\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(\"SEMVER\",...e):()=>{},debug_1=debug,re_1=createCommonjsModule(function(e,r){const{MAX_SAFE_COMPONENT_LENGTH:t}=constants,s=(r=e.exports={}).re=[],i=r.src=[],o=r.t={};let a=0;const n=(e,r,t)=>{const n=a++;debug_1(n,r),o[e]=n,i[n]=r,s[n]=new RegExp(r,t?\"g\":void 0)};n(\"NUMERICIDENTIFIER\",\"0|[1-9]\\\\d*\"),n(\"NUMERICIDENTIFIERLOOSE\",\"[0-9]+\"),n(\"NONNUMERICIDENTIFIER\",\"\\\\d*[a-zA-Z-][a-zA-Z0-9-]*\"),n(\"MAINVERSION\",`(${i[o.NUMERICIDENTIFIER]})\\\\.`+`(${i[o.NUMERICIDENTIFIER]})\\\\.`+`(${i[o.NUMERICIDENTIFIER]})`),n(\"MAINVERSIONLOOSE\",`(${i[o.NUMERICIDENTIFIERLOOSE]})\\\\.`+`(${i[o.NUMERICIDENTIFIERLOOSE]})\\\\.`+`(${i[o.NUMERICIDENTIFIERLOOSE]})`),n(\"PRERELEASEIDENTIFIER\",`(?:${i[o.NUMERICIDENTIFIER]}|${i[o.NONNUMERICIDENTIFIER]})`),n(\"PRERELEASEIDENTIFIERLOOSE\",`(?:${i[o.NUMERICIDENTIFIERLOOSE]}|${i[o.NONNUMERICIDENTIFIER]})`),n(\"PRERELEASE\",`(?:-(${i[o.PRERELEASEIDENTIFIER]}(?:\\\\.${i[o.PRERELEASEIDENTIFIER]})*))`),n(\"PRERELEASELOOSE\",`(?:-?(${i[o.PRERELEASEIDENTIFIERLOOSE]}(?:\\\\.${i[o.PRERELEASEIDENTIFIERLOOSE]})*))`),n(\"BUILDIDENTIFIER\",\"[0-9A-Za-z-]+\"),n(\"BUILD\",`(?:\\\\+(${i[o.BUILDIDENTIFIER]}(?:\\\\.${i[o.BUILDIDENTIFIER]})*))`),n(\"FULLPLAIN\",`v?${i[o.MAINVERSION]}${i[o.PRERELEASE]}?${i[o.BUILD]}?`),n(\"FULL\",`^${i[o.FULLPLAIN]}$`),n(\"LOOSEPLAIN\",`[v=\\\\s]*${i[o.MAINVERSIONLOOSE]}${i[o.PRERELEASELOOSE]}?${i[o.BUILD]}?`),n(\"LOOSE\",`^${i[o.LOOSEPLAIN]}$`),n(\"GTLT\",\"((?:<|>)?=?)\"),n(\"XRANGEIDENTIFIERLOOSE\",`${i[o.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`),n(\"XRANGEIDENTIFIER\",`${i[o.NUMERICIDENTIFIER]}|x|X|\\\\*`),n(\"XRANGEPLAIN\",`[v=\\\\s]*(${i[o.XRANGEIDENTIFIER]})`+`(?:\\\\.(${i[o.XRANGEIDENTIFIER]})`+`(?:\\\\.(${i[o.XRANGEIDENTIFIER]})`+`(?:${i[o.PRERELEASE]})?${i[o.BUILD]}?`+\")?)?\"),n(\"XRANGEPLAINLOOSE\",`[v=\\\\s]*(${i[o.XRANGEIDENTIFIERLOOSE]})`+`(?:\\\\.(${i[o.XRANGEIDENTIFIERLOOSE]})`+`(?:\\\\.(${i[o.XRANGEIDENTIFIERLOOSE]})`+`(?:${i[o.PRERELEASELOOSE]})?${i[o.BUILD]}?`+\")?)?\"),n(\"XRANGE\",`^${i[o.GTLT]}\\\\s*${i[o.XRANGEPLAIN]}$`),n(\"XRANGELOOSE\",`^${i[o.GTLT]}\\\\s*${i[o.XRANGEPLAINLOOSE]}$`),n(\"COERCE\",`(^|[^\\\\d])(\\\\d{1,${t}})`+`(?:\\\\.(\\\\d{1,${t}}))?`+`(?:\\\\.(\\\\d{1,${t}}))?`+\"(?:$|[^\\\\d])\"),n(\"COERCERTL\",i[o.COERCE],!0),n(\"LONETILDE\",\"(?:~>?)\"),n(\"TILDETRIM\",`(\\\\s*)${i[o.LONETILDE]}\\\\s+`,!0),r.tildeTrimReplace=\"$1~\",n(\"TILDE\",`^${i[o.LONETILDE]}${i[o.XRANGEPLAIN]}$`),n(\"TILDELOOSE\",`^${i[o.LONETILDE]}${i[o.XRANGEPLAINLOOSE]}$`),n(\"LONECARET\",\"(?:\\\\^)\"),n(\"CARETTRIM\",`(\\\\s*)${i[o.LONECARET]}\\\\s+`,!0),r.caretTrimReplace=\"$1^\",n(\"CARET\",`^${i[o.LONECARET]}${i[o.XRANGEPLAIN]}$`),n(\"CARETLOOSE\",`^${i[o.LONECARET]}${i[o.XRANGEPLAINLOOSE]}$`),n(\"COMPARATORLOOSE\",`^${i[o.GTLT]}\\\\s*(${i[o.LOOSEPLAIN]})$|^$`),n(\"COMPARATOR\",`^${i[o.GTLT]}\\\\s*(${i[o.FULLPLAIN]})$|^$`),n(\"COMPARATORTRIM\",`(\\\\s*)${i[o.GTLT]}\\\\s*(${i[o.LOOSEPLAIN]}|${i[o.XRANGEPLAIN]})`,!0),r.comparatorTrimReplace=\"$1$2$3\",n(\"HYPHENRANGE\",`^\\\\s*(${i[o.XRANGEPLAIN]})`+\"\\\\s+-\\\\s+\"+`(${i[o.XRANGEPLAIN]})`+\"\\\\s*$\"),n(\"HYPHENRANGELOOSE\",`^\\\\s*(${i[o.XRANGEPLAINLOOSE]})`+\"\\\\s+-\\\\s+\"+`(${i[o.XRANGEPLAINLOOSE]})`+\"\\\\s*$\"),n(\"STAR\",\"(<|>)?=?\\\\s*\\\\*\"),n(\"GTE0\",\"^\\\\s*>=\\\\s*0.0.0\\\\s*$\"),n(\"GTE0PRE\",\"^\\\\s*>=\\\\s*0.0.0-0\\\\s*$\")}),numeric=/^[0-9]+$/,compareIdentifiers$1=(e,r)=>{const t=numeric.test(e),s=numeric.test(r);return t&&s&&(e=+e,r=+r),e===r?0:t&&!s?-1:s&&!t?1:ecompareIdentifiers$1(r,e),identifiers={compareIdentifiers:compareIdentifiers$1,rcompareIdentifiers:rcompareIdentifiers},{MAX_LENGTH:MAX_LENGTH$1,MAX_SAFE_INTEGER:MAX_SAFE_INTEGER}=constants,{re:re$4,t:t$4}=re_1,{compareIdentifiers:compareIdentifiers}=identifiers;class SemVer{constructor(e,r){if(r&&\"object\"==typeof r||(r={loose:!!r,includePrerelease:!1}),e instanceof SemVer){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(\"string\"!=typeof e)throw new TypeError(`Invalid Version: ${e}`);if(e.length>MAX_LENGTH$1)throw new TypeError(`version is longer than ${MAX_LENGTH$1} characters`);debug_1(\"SemVer\",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const t=e.trim().match(r.loose?re$4[t$4.LOOSE]:re$4[t$4.FULL]);if(!t)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+t[1],this.minor=+t[2],this.patch=+t[3],this.major>MAX_SAFE_INTEGER||this.major<0)throw new TypeError(\"Invalid major version\");if(this.minor>MAX_SAFE_INTEGER||this.minor<0)throw new TypeError(\"Invalid minor version\");if(this.patch>MAX_SAFE_INTEGER||this.patch<0)throw new TypeError(\"Invalid patch version\");t[4]?this.prerelease=t[4].split(\".\").map(e=>{if(/^[0-9]+$/.test(e)){const r=+e;if(r>=0&&r=0;)\"number\"==typeof this.prerelease[e]&&(this.prerelease[e]++,e=-2);-1===e&&this.prerelease.push(0)}r&&(this.prerelease[0]===r?isNaN(this.prerelease[1])&&(this.prerelease=[r,0]):this.prerelease=[r,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}}const compare=(e,r,t)=>new SemVer(e,t).compare(new SemVer(r,t)),compare_1=compare,eq=(e,r,t)=>0===compare_1(e,r,t),eq_1=eq,neq=(e,r,t)=>0!==compare_1(e,r,t),neq_1=neq,gt=(e,r,t)=>compare_1(e,r,t)>0,gt_1=gt,gte=(e,r,t)=>compare_1(e,r,t)>=0,gte_1=gte,lt=(e,r,t)=>compare_1(e,r,t)<0,lt_1=lt,lte=(e,r,t)=>compare_1(e,r,t)<=0,lte_1=lte,cmp=(e,r,t,s)=>{switch(r){case\"===\":return\"object\"==typeof e&&(e=e.version),\"object\"==typeof t&&(t=t.version),e===t;case\"!==\":return\"object\"==typeof e&&(e=e.version),\"object\"==typeof t&&(t=t.version),e!==t;case\"\":case\"=\":case\"==\":return eq_1(e,t,s);case\"!=\":return neq_1(e,t,s);case\">\":return gt_1(e,t,s);case\">=\":return gte_1(e,t,s);case\"<\":return lt_1(e,t,s);case\"<=\":return lte_1(e,t,s);default:throw new TypeError(`Invalid operator: ${r}`)}},cmp_1=cmp,ANY=Symbol(\"SemVer ANY\");class Comparator{static get ANY(){return ANY}constructor(e,r){if(r&&\"object\"==typeof r||(r={loose:!!r,includePrerelease:!1}),e instanceof Comparator){if(e.loose===!!r.loose)return e;e=e.value}debug_1(\"comparator\",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===ANY?this.value=\"\":this.value=this.operator+this.semver.version,debug_1(\"comp\",this)}parse(e){const r=this.options.loose?re$3[t$3.COMPARATORLOOSE]:re$3[t$3.COMPARATOR],t=e.match(r);if(!t)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==t[1]?t[1]:\"\",\"=\"===this.operator&&(this.operator=\"\"),t[2]?this.semver=new SemVer(t[2],this.options.loose):this.semver=ANY}toString(){return this.value}test(e){if(debug_1(\"Comparator.test\",e,this.options.loose),this.semver===ANY||e===ANY)return!0;if(\"string\"==typeof e)try{e=new SemVer(e,this.options)}catch(e){return!1}return cmp_1(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof Comparator))throw new TypeError(\"a Comparator is required\");if(r&&\"object\"==typeof r||(r={loose:!!r,includePrerelease:!1}),\"\"===this.operator)return\"\"===this.value||new Range(e.value,r).test(this.value);if(\"\"===e.operator)return\"\"===e.value||new Range(this.value,r).test(e.semver);const t=!(\">=\"!==this.operator&&\">\"!==this.operator||\">=\"!==e.operator&&\">\"!==e.operator),s=!(\"<=\"!==this.operator&&\"<\"!==this.operator||\"<=\"!==e.operator&&\"<\"!==e.operator),i=this.semver.version===e.semver.version,o=!(\">=\"!==this.operator&&\"<=\"!==this.operator||\">=\"!==e.operator&&\"<=\"!==e.operator),a=cmp_1(this.semver,\"<\",e.semver,r)&&(\">=\"===this.operator||\">\"===this.operator)&&(\"<=\"===e.operator||\"<\"===e.operator),n=cmp_1(this.semver,\">\",e.semver,r)&&(\"<=\"===this.operator||\"<\"===this.operator)&&(\">=\"===e.operator||\">\"===e.operator);return t||s||i&&o||a||n}}const{re:re$3,t:t$3}=re_1;class Range{constructor(e,r){if(r&&\"object\"==typeof r||(r={loose:!!r,includePrerelease:!1}),e instanceof Range)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new Range(e.raw,r);if(e instanceof Comparator)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e,this.set=e.split(/\\s*\\|\\|\\s*/).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);this.format()}format(){return this.range=this.set.map(e=>e.join(\" \").trim()).join(\"||\").trim(),this.range}toString(){return this.range}parseRange(e){const{loose:r}=this.options;e=e.trim();const t=r?re$2[t$2.HYPHENRANGELOOSE]:re$2[t$2.HYPHENRANGE];e=e.replace(t,hyphenReplace(this.options.includePrerelease)),debug_1(\"hyphen replace\",e),e=e.replace(re$2[t$2.COMPARATORTRIM],comparatorTrimReplace),debug_1(\"comparator trim\",e,re$2[t$2.COMPARATORTRIM]),e=(e=(e=e.replace(re$2[t$2.TILDETRIM],tildeTrimReplace)).replace(re$2[t$2.CARETTRIM],caretTrimReplace)).split(/\\s+/).join(\" \");const s=r?re$2[t$2.COMPARATORLOOSE]:re$2[t$2.COMPARATOR];return e.split(\" \").map(e=>parseComparator(e,this.options)).join(\" \").split(/\\s+/).map(e=>replaceGTE0(e,this.options)).filter(this.options.loose?e=>!!e.match(s):()=>!0).map(e=>new Comparator(e,this.options))}intersects(e,r){if(!(e instanceof Range))throw new TypeError(\"a Range is required\");return this.set.some(t=>isSatisfiable(t,r)&&e.set.some(e=>isSatisfiable(e,r)&&t.every(t=>e.every(e=>t.intersects(e,r)))))}test(e){if(!e)return!1;if(\"string\"==typeof e)try{e=new SemVer(e,this.options)}catch(e){return!1}for(let r=0;r{let t=!0;const s=e.slice();let i=s.pop();for(;t&&s.length;)t=s.every(e=>i.intersects(e,r)),i=s.pop();return t},parseComparator=(e,r)=>(debug_1(\"comp\",e,r),e=replaceCarets(e,r),debug_1(\"caret\",e),e=replaceTildes(e,r),debug_1(\"tildes\",e),e=replaceXRanges(e,r),debug_1(\"xrange\",e),e=replaceStars(e,r),debug_1(\"stars\",e),e),isX=e=>!e||\"x\"===e.toLowerCase()||\"*\"===e,replaceTildes=(e,r)=>e.trim().split(/\\s+/).map(e=>replaceTilde(e,r)).join(\" \"),replaceTilde=(e,r)=>{const t=r.loose?re$2[t$2.TILDELOOSE]:re$2[t$2.TILDE];return e.replace(t,(r,t,s,i,o)=>{let a;return debug_1(\"tilde\",e,r,t,s,i,o),isX(t)?a=\"\":isX(s)?a=`>=${t}.0.0 <${+t+1}.0.0-0`:isX(i)?a=`>=${t}.${s}.0 <${t}.${+s+1}.0-0`:o?(debug_1(\"replaceTilde pr\",o),a=`>=${t}.${s}.${i}-${o} <${t}.${+s+1}.0-0`):a=`>=${t}.${s}.${i} <${t}.${+s+1}.0-0`,debug_1(\"tilde return\",a),a})},replaceCarets=(e,r)=>e.trim().split(/\\s+/).map(e=>replaceCaret(e,r)).join(\" \"),replaceCaret=(e,r)=>{debug_1(\"caret\",e,r);const t=r.loose?re$2[t$2.CARETLOOSE]:re$2[t$2.CARET],s=r.includePrerelease?\"-0\":\"\";return e.replace(t,(r,t,i,o,a)=>{let n;return debug_1(\"caret\",e,r,t,i,o,a),isX(t)?n=\"\":isX(i)?n=`>=${t}.0.0${s} <${+t+1}.0.0-0`:isX(o)?n=\"0\"===t?`>=${t}.${i}.0${s} <${t}.${+i+1}.0-0`:`>=${t}.${i}.0${s} <${+t+1}.0.0-0`:a?(debug_1(\"replaceCaret pr\",a),n=\"0\"===t?\"0\"===i?`>=${t}.${i}.${o}-${a} <${t}.${i}.${+o+1}-0`:`>=${t}.${i}.${o}-${a} <${t}.${+i+1}.0-0`:`>=${t}.${i}.${o}-${a} <${+t+1}.0.0-0`):(debug_1(\"no pr\"),n=\"0\"===t?\"0\"===i?`>=${t}.${i}.${o}${s} <${t}.${i}.${+o+1}-0`:`>=${t}.${i}.${o}${s} <${t}.${+i+1}.0-0`:`>=${t}.${i}.${o} <${+t+1}.0.0-0`),debug_1(\"caret return\",n),n})},replaceXRanges=(e,r)=>(debug_1(\"replaceXRanges\",e,r),e.split(/\\s+/).map(e=>replaceXRange(e,r)).join(\" \")),replaceXRange=(e,r)=>{e=e.trim();const t=r.loose?re$2[t$2.XRANGELOOSE]:re$2[t$2.XRANGE];return e.replace(t,(t,s,i,o,a,n)=>{debug_1(\"xRange\",e,t,s,i,o,a,n);const E=isX(i),p=E||isX(o),l=p||isX(a),c=l;return\"=\"===s&&c&&(s=\"\"),n=r.includePrerelease?\"-0\":\"\",E?t=\">\"===s||\"<\"===s?\"<0.0.0-0\":\"*\":s&&c?(p&&(o=0),a=0,\">\"===s?(s=\">=\",p?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):\"<=\"===s&&(s=\"<\",p?i=+i+1:o=+o+1),\"<\"===s&&(n=\"-0\"),t=`${s+i}.${o}.${a}${n}`):p?t=`>=${i}.0.0${n} <${+i+1}.0.0-0`:l&&(t=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`),debug_1(\"xRange return\",t),t})},replaceStars=(e,r)=>(debug_1(\"replaceStars\",e,r),e.trim().replace(re$2[t$2.STAR],\"\")),replaceGTE0=(e,r)=>(debug_1(\"replaceGTE0\",e,r),e.trim().replace(re$2[r.includePrerelease?t$2.GTE0PRE:t$2.GTE0],\"\")),hyphenReplace=e=>(r,t,s,i,o,a,n,E,p,l,c,$,h)=>`${t=isX(s)?\"\":isX(i)?`>=${s}.0.0${e?\"-0\":\"\"}`:isX(o)?`>=${s}.${i}.0${e?\"-0\":\"\"}`:a?`>=${t}`:`>=${t}${e?\"-0\":\"\"}`} ${E=isX(p)?\"\":isX(l)?`<${+p+1}.0.0-0`:isX(c)?`<${p}.${+l+1}.0-0`:$?`<=${p}.${l}.${c}-${$}`:e?`<${p}.${l}.${+c+1}-0`:`<=${E}`}`.trim(),testSet=(e,r,t)=>{for(let t=0;t0){const s=e[t].semver;if(s.major===r.major&&s.minor===r.minor&&s.patch===r.patch)return!0}return!1}return!0};export const satisfies=(e,r,t)=>{try{r=new Range(r,t)}catch(e){return!1}return r.test(e)};const satisfies_1=satisfies,{MAX_LENGTH:MAX_LENGTH}=constants,{re:re$1,t:t$1}=re_1,parse=(e,r)=>{if(r&&\"object\"==typeof r||(r={loose:!!r,includePrerelease:!1}),e instanceof SemVer)return e;if(\"string\"!=typeof e)return null;if(e.length>MAX_LENGTH)return null;if(!(r.loose?re$1[t$1.LOOSE]:re$1[t$1.FULL]).test(e))return null;try{return new SemVer(e,r)}catch(e){return null}},parse_1=parse,{re:re,t:t}=re_1;export const coerce=(e,r)=>{if(e instanceof SemVer)return e;if(\"number\"==typeof e&&(e=String(e)),\"string\"!=typeof e)return null;let s=null;if((r=r||{}).rtl){let r;for(;(r=re[t.COERCERTL].exec(e))&&(!s||s.index+s[0].length!==e.length);)s&&r.index+r[0].length===s.index+s[0].length||(s=r),re[t.COERCERTL].lastIndex=r.index+r[1].length+r[2].length;re[t.COERCERTL].lastIndex=-1}else s=e.match(re[t.COERCE]);return null===s?null:parse_1(`${s[2]}.${s[3]||\"0\"}.${s[4]||\"0\"}`,r)};\n","function percentToByte(p: string) {\n return String.fromCharCode(parseInt(p.slice(1), 16));\n}\n\nfunction byteToPercent(b: string) {\n return `%${`00${b.charCodeAt(0).toString(16)}`.slice(-2)}`;\n}\n\n/**\n * Encodes a Base64 string. Safe for UTF-8 characters.\n * Original source is from the `universal-base64` NPM package.\n *\n * @source https://github.com/blakeembrey/universal-base64/blob/master/src/browser.ts\n */\nfunction btoaUTF8(str: string): string {\n return btoa(encodeURIComponent(str).replace(/%[0-9A-F]{2}/g, percentToByte));\n}\n\n/**\n * Decodes a Base64 string. Safe for UTF-8 characters.\n * Original source is from the `universal-base64` NPM package.\n *\n * @source https://github.com/blakeembrey/universal-base64/blob/master/src/browser.ts\n */\nfunction atobUTF8(str: string): string {\n return decodeURIComponent(Array.from(atob(str), byteToPercent).join(''));\n}\n\n/**\n * Given a JSON-serializable object, encode as a Base64 string.\n */\nexport function encodeJSON(options: T): string {\n return btoaUTF8(JSON.stringify(options));\n}\n\n/**\n * Given a Base64 JSON string, decode a JavaScript object.\n */\nexport function decodeJSON(queryString: string): T {\n return JSON.parse(atobUTF8(queryString));\n}\n","/**\n * This file contains our type guards.\n *\n * Type guards are a feature of TypeScript which narrow the type signature of\n * intesection types (types that can be one thing or another).\n *\n * @see\n * https://www.typescriptlang.org/docs/handbook/advanced-types.html#type-guards-and-differentiating-types\n */\n\nimport { JsonRpcRequestPayload, JsonRpcResponsePayload, MagicPayloadMethod, RPCErrorCode } from '@magic-sdk/types';\n\n/**\n * Assert `value` is `undefined`.\n */\nfunction isUndefined(value: any): value is undefined {\n return typeof value === 'undefined';\n}\n\n/**\n * Assert `value` is `null`.\n */\nfunction isNull(value: any): value is null {\n return value === null;\n}\n\n/**\n * Assert `value` is `null` or `undefined`.\n */\nfunction isNil(value: any): value is null | undefined {\n return isNull(value) || isUndefined(value);\n}\n\n/**\n * Assert `value` is a `JsonRpcRequestPayload` object.\n */\nexport function isJsonRpcRequestPayload(value?: JsonRpcRequestPayload): value is JsonRpcRequestPayload {\n if (isNil(value)) return false;\n return (\n !isUndefined(value.jsonrpc) && !isUndefined(value.id) && !isUndefined(value.method) && !isUndefined(value.params)\n );\n}\n\n/**\n * Assert `value` is a `JsonRpcResponsePayload` object.\n */\nexport function isJsonRpcResponsePayload(value: any): value is JsonRpcResponsePayload {\n if (isNil(value)) return false;\n return (\n !isUndefined(value.jsonrpc) && !isUndefined(value.id) && (!isUndefined(value.result) || !isUndefined(value.error))\n );\n}\n\n/**\n * Assert `value` is a Magic SDK payload method identifier.\n */\nexport function isMagicPayloadMethod(value?: any): value is MagicPayloadMethod {\n if (isNil(value)) return false;\n return typeof value === 'string' && Object.values(MagicPayloadMethod).includes(value as any);\n}\n\n/**\n * Assert `value` is an expected JSON RPC error code.\n */\nexport function isJsonRpcErrorCode(value?: any): value is RPCErrorCode {\n if (isNil(value)) return false;\n return typeof value === 'number' && Object.values(RPCErrorCode).includes(value);\n}\n\n/**\n * Assert `value` is an empty, plain object.\n */\nexport function isEmpty(value?: any): value is {} {\n if (!value) return true;\n\n for (const key in value) {\n /* istanbul ignore else */\n if (Object.hasOwnProperty.call(value, key)) {\n return false;\n }\n }\n\n return true;\n}\n","import type localForage from 'localforage';\nimport type { ViewController } from './view-controller';\nimport type { SDKBase } from './sdk';\nimport type { WithExtensions } from '../modules/base-extension';\n\ntype ConstructorOf = { new (...args: any[]): C };\n\n/**\n * A structure containing details about the current environment.\n * This is guaranteed to be populated before the SDK is instantiated.\n */\nexport interface SDKEnvironment {\n sdkName: 'magic-sdk' | '@magic-sdk/react-native' | '@magic-sdk/react-native-bare' | '@magic-sdk/react-native-expo';\n version: string;\n platform: 'web' | 'react-native';\n defaultEndpoint: string;\n ViewController: ConstructorOf;\n configureStorage: () => Promise;\n bundleId?: string | null;\n}\n\nexport const SDKEnvironment: SDKEnvironment = {} as any;\n\nexport function createSDK(\n SDKBaseCtor: ConstructorOf,\n environment: SDKEnvironment,\n): WithExtensions {\n Object.assign(SDKEnvironment, environment);\n return SDKBaseCtor as any;\n}\n\nexport const sdkNameToEnvName = {\n 'magic-sdk': 'magic-sdk' as const,\n '@magic-sdk/react-native': 'magic-sdk-rn' as const,\n '@magic-sdk/react-native-bare': 'magic-sdk-rn-bare' as const,\n '@magic-sdk/react-native-expo': 'magic-sdk-rn-expo' as const,\n};\n","import { JsonRpcError, RPCErrorCode, SDKErrorCode, SDKWarningCode } from '@magic-sdk/types';\nimport { isJsonRpcErrorCode } from '../util/type-guards';\nimport { SDKEnvironment } from './sdk-environment';\nimport { Extension } from '../modules/base-extension';\n\n// --- Error/warning classes\n\n/**\n * This error type represents internal SDK errors. This could be developer\n * mistakes (or Magic's mistakes), or execution errors unrelated to standard\n * JavaScript exceptions.\n */\nexport class MagicSDKError extends Error {\n __proto__ = Error;\n\n constructor(public code: SDKErrorCode, public rawMessage: string) {\n super(`Magic SDK Error: [${code}] ${rawMessage}`);\n Object.setPrototypeOf(this, MagicSDKError.prototype);\n }\n}\n\n/**\n * This error type communicates exceptions that occur during execution in the\n * Magic `