magic-sdk 17.1.0-canary.497.4747297114.0 → 17.1.0-canary.497.4756676437.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/magic.js +4 -4
- package/package.json +5 -5
package/dist/magic.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
"use strict";var Magic=(()=>{var Vn=Object.create;var yt=Object.defineProperty;var Hn=Object.getOwnPropertyDescriptor;var zn=Object.getOwnPropertyNames,Xr=Object.getOwnPropertySymbols,qn=Object.getPrototypeOf,Qr=Object.prototype.hasOwnProperty,Xn=Object.prototype.propertyIsEnumerable;var Jr=(e,n,u)=>n in e?yt(e,n,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[n]=u,Zr=(e,n)=>{for(var u in n||(n={}))Qr.call(n,u)&&Jr(e,u,n[u]);if(Xr)for(var u of Xr(n))Xn.call(n,u)&&Jr(e,u,n[u]);return e};var _e=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(n,u)=>(typeof require!="undefined"?require:n)[u]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var $r=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),en=(e,n)=>{for(var u in n)yt(e,u,{get:n[u],enumerable:!0})},tn=(e,n,u,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of zn(n))!Qr.call(e,l)&&l!==u&&yt(e,l,{get:()=>n[l],enumerable:!(c=Hn(n,l))||c.enumerable});return e};var xr=(e,n,u)=>(u=e!=null?Vn(qn(e)):{},tn(n||!e||!e.__esModule?yt(u,"default",{value:e,enumerable:!0}):u,e)),Jn=e=>tn(yt({},"__esModule",{value:!0}),e);var je=(e,n,u)=>new Promise((c,l)=>{var d=E=>{try{b(u.next(E))}catch(R){l(R)}},I=E=>{try{b(u.throw(E))}catch(R){l(R)}},b=E=>E.done?c(E.value):Promise.resolve(E.value).then(d,I);b((u=u.apply(e,n)).next())});var on=$r((nn,Br)=>{(function(e){if(typeof nn=="object"&&typeof Br<"u")Br.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var n;typeof window<"u"?n=window:typeof global<"u"?n=global:typeof self<"u"?n=self:n=this,n.localforage=e()}})(function(){var e,n,u;return function c(l,d,I){function b(S,O){if(!d[S]){if(!l[S]){var g=typeof _e=="function"&&_e;if(!O&&g)return g(S,!0);if(E)return E(S,!0);var A=new Error("Cannot find module '"+S+"'");throw A.code="MODULE_NOT_FOUND",A}var P=d[S]={exports:{}};l[S][0].call(P.exports,function(U){var $=l[S][1][U];return b($||U)},P,P.exports,c,l,d,I)}return d[S].exports}for(var E=typeof _e=="function"&&_e,R=0;R<I.length;R++)b(I[R]);return b}({1:[function(c,l,d){(function(I){"use strict";var b=I.MutationObserver||I.WebKitMutationObserver,E;if(b){var R=0,S=new b(U),O=I.document.createTextNode("");S.observe(O,{characterData:!0}),E=function(){O.data=R=++R%2}}else if(!I.setImmediate&&typeof I.MessageChannel<"u"){var g=new I.MessageChannel;g.port1.onmessage=U,E=function(){g.port2.postMessage(0)}}else"document"in I&&"onreadystatechange"in I.document.createElement("script")?E=function(){var k=I.document.createElement("script");k.onreadystatechange=function(){U(),k.onreadystatechange=null,k.parentNode.removeChild(k),k=null},I.document.documentElement.appendChild(k)}:E=function(){setTimeout(U,0)};var A,P=[];function U(){A=!0;for(var k,X,C=P.length;C;){for(X=P,P=[],k=-1;++k<C;)X[k]();C=P.length}A=!1}l.exports=$;function $(k){P.push(k)===1&&!A&&E()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(c,l,d){"use strict";var I=c(1);function b(){}var E={},R=["REJECTED"],S=["FULFILLED"],O=["PENDING"];l.exports=g;function g(y){if(typeof y!="function")throw new TypeError("resolver must be a function");this.state=O,this.queue=[],this.outcome=void 0,y!==b&&$(this,y)}g.prototype.catch=function(y){return this.then(null,y)},g.prototype.then=function(y,D){if(typeof y!="function"&&this.state===S||typeof D!="function"&&this.state===R)return this;var M=new this.constructor(b);if(this.state!==O){var F=this.state===S?y:D;P(M,F,this.outcome)}else this.queue.push(new A(M,y,D));return M};function A(y,D,M){this.promise=y,typeof D=="function"&&(this.onFulfilled=D,this.callFulfilled=this.otherCallFulfilled),typeof M=="function"&&(this.onRejected=M,this.callRejected=this.otherCallRejected)}A.prototype.callFulfilled=function(y){E.resolve(this.promise,y)},A.prototype.otherCallFulfilled=function(y){P(this.promise,this.onFulfilled,y)},A.prototype.callRejected=function(y){E.reject(this.promise,y)},A.prototype.otherCallRejected=function(y){P(this.promise,this.onRejected,y)};function P(y,D,M){I(function(){var F;try{F=D(M)}catch(z){return E.reject(y,z)}F===y?E.reject(y,new TypeError("Cannot resolve promise with itself")):E.resolve(y,F)})}E.resolve=function(y,D){var M=k(U,D);if(M.status==="error")return E.reject(y,M.value);var F=M.value;if(F)$(y,F);else{y.state=S,y.outcome=D;for(var z=-1,J=y.queue.length;++z<J;)y.queue[z].callFulfilled(D)}return y},E.reject=function(y,D){y.state=R,y.outcome=D;for(var M=-1,F=y.queue.length;++M<F;)y.queue[M].callRejected(D);return y};function U(y){var D=y&&y.then;if(y&&(typeof y=="object"||typeof y=="function")&&typeof D=="function")return function(){D.apply(y,arguments)}}function $(y,D){var M=!1;function F(ee){M||(M=!0,E.reject(y,ee))}function z(ee){M||(M=!0,E.resolve(y,ee))}function J(){D(z,F)}var Z=k(J);Z.status==="error"&&F(Z.value)}function k(y,D){var M={};try{M.value=y(D),M.status="success"}catch(F){M.status="error",M.value=F}return M}g.resolve=X;function X(y){return y instanceof this?y:E.resolve(new this(b),y)}g.reject=C;function C(y){var D=new this(b);return E.reject(D,y)}g.all=pe;function pe(y){var D=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var M=y.length,F=!1;if(!M)return this.resolve([]);for(var z=new Array(M),J=0,Z=-1,ee=new this(b);++Z<M;)oe(y[Z],Z);return ee;function oe(he,_){D.resolve(he).then(N,function(T){F||(F=!0,E.reject(ee,T))});function N(T){z[_]=T,++J===M&&!F&&(F=!0,E.resolve(ee,z))}}}g.race=re;function re(y){var D=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var M=y.length,F=!1;if(!M)return this.resolve([]);for(var z=-1,J=new this(b);++z<M;)Z(y[z]);return J;function Z(ee){D.resolve(ee).then(function(oe){F||(F=!0,E.resolve(J,oe))},function(oe){F||(F=!0,E.reject(J,oe))})}}},{1:1}],3:[function(c,l,d){(function(I){"use strict";typeof I.Promise!="function"&&(I.Promise=c(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(c,l,d){"use strict";var I=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function b(t,o){if(!(t instanceof o))throw new TypeError("Cannot call a class as a function")}function E(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var R=E();function S(){try{if(!R||!R.open)return!1;var t=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),o=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!t||o)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function O(t,o){t=t||[],o=o||{};try{return new Blob(t,o)}catch(i){if(i.name!=="TypeError")throw i;for(var r=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,a=new r,s=0;s<t.length;s+=1)a.append(t[s]);return a.getBlob(o.type)}}typeof Promise>"u"&&c(3);var g=Promise;function A(t,o){o&&t.then(function(r){o(null,r)},function(r){o(r)})}function P(t,o,r){typeof o=="function"&&t.then(o),typeof r=="function"&&t.catch(r)}function U(t){return typeof t!="string"&&(console.warn(t+" used as a key, but it is not a string."),t=String(t)),t}function $(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var k="local-forage-detect-blob-support",X=void 0,C={},pe=Object.prototype.toString,re="readonly",y="readwrite";function D(t){for(var o=t.length,r=new ArrayBuffer(o),a=new Uint8Array(r),s=0;s<o;s++)a[s]=t.charCodeAt(s);return r}function M(t){return new g(function(o){var r=t.transaction(k,y),a=O([""]);r.objectStore(k).put(a,"key"),r.onabort=function(s){s.preventDefault(),s.stopPropagation(),o(!1)},r.oncomplete=function(){var s=navigator.userAgent.match(/Chrome\/(\d+)/),i=navigator.userAgent.match(/Edge\//);o(i||!s||parseInt(s[1],10)>=43)}}).catch(function(){return!1})}function F(t){return typeof X=="boolean"?g.resolve(X):M(t).then(function(o){return X=o,X})}function z(t){var o=C[t.name],r={};r.promise=new g(function(a,s){r.resolve=a,r.reject=s}),o.deferredOperations.push(r),o.dbReady?o.dbReady=o.dbReady.then(function(){return r.promise}):o.dbReady=r.promise}function J(t){var o=C[t.name],r=o.deferredOperations.pop();if(r)return r.resolve(),r.promise}function Z(t,o){var r=C[t.name],a=r.deferredOperations.pop();if(a)return a.reject(o),a.promise}function ee(t,o){return new g(function(r,a){if(C[t.name]=C[t.name]||ie(),t.db)if(o)z(t),t.db.close();else return r(t.db);var s=[t.name];o&&s.push(t.version);var i=R.open.apply(R,s);o&&(i.onupgradeneeded=function(f){var h=i.result;try{h.createObjectStore(t.storeName),f.oldVersion<=1&&h.createObjectStore(k)}catch(v){if(v.name==="ConstraintError")console.warn('The database "'+t.name+'" has been upgraded from version '+f.oldVersion+" to version "+f.newVersion+', but the storage "'+t.storeName+'" already exists.');else throw v}}),i.onerror=function(f){f.preventDefault(),a(i.error)},i.onsuccess=function(){var f=i.result;f.onversionchange=function(h){h.target.close()},r(f),J(t)}})}function oe(t){return ee(t,!1)}function he(t){return ee(t,!0)}function _(t,o){if(!t.db)return!0;var r=!t.db.objectStoreNames.contains(t.storeName),a=t.version<t.db.version,s=t.version>t.db.version;if(a&&(t.version!==o&&console.warn('The database "'+t.name+`" can't be downgraded from version `+t.db.version+" to version "+t.version+"."),t.version=t.db.version),s||r){if(r){var i=t.db.version+1;i>t.version&&(t.version=i)}return!0}return!1}function N(t){return new g(function(o,r){var a=new FileReader;a.onerror=r,a.onloadend=function(s){var i=btoa(s.target.result||"");o({__local_forage_encoded_blob:!0,data:i,type:t.type})},a.readAsBinaryString(t)})}function T(t){var o=D(atob(t.data));return O([o],{type:t.type})}function W(t){return t&&t.__local_forage_encoded_blob}function G(t){var o=this,r=o._initReady().then(function(){var a=C[o._dbInfo.name];if(a&&a.dbReady)return a.dbReady});return P(r,t,t),r}function Y(t){z(t);for(var o=C[t.name],r=o.forages,a=0;a<r.length;a++){var s=r[a];s._dbInfo.db&&(s._dbInfo.db.close(),s._dbInfo.db=null)}return t.db=null,oe(t).then(function(i){return t.db=i,_(t)?he(t):i}).then(function(i){t.db=o.db=i;for(var f=0;f<r.length;f++)r[f]._dbInfo.db=i}).catch(function(i){throw Z(t,i),i})}function V(t,o,r,a){a===void 0&&(a=1);try{var s=t.db.transaction(t.storeName,o);r(null,s)}catch(i){if(a>0&&(!t.db||i.name==="InvalidStateError"||i.name==="NotFoundError"))return g.resolve().then(function(){if(!t.db||i.name==="NotFoundError"&&!t.db.objectStoreNames.contains(t.storeName)&&t.version<=t.db.version)return t.db&&(t.version=t.db.version+1),he(t)}).then(function(){return Y(t).then(function(){V(t,o,r,a-1)})}).catch(r);r(i)}}function ie(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Ae(t){var o=this,r={db:null};if(t)for(var a in t)r[a]=t[a];var s=C[r.name];s||(s=ie(),C[r.name]=s),s.forages.push(o),o._initReady||(o._initReady=o.ready,o.ready=G);var i=[];function f(){return g.resolve()}for(var h=0;h<s.forages.length;h++){var v=s.forages[h];v!==o&&i.push(v._initReady().catch(f))}var m=s.forages.slice(0);return g.all(i).then(function(){return r.db=s.db,oe(r)}).then(function(p){return r.db=p,_(r,o._defaultConfig.version)?he(r):p}).then(function(p){r.db=s.db=p,o._dbInfo=r;for(var w=0;w<m.length;w++){var L=m[w];L!==o&&(L._dbInfo.db=r.db,L._dbInfo.version=r.version)}})}function Ee(t,o){var r=this;t=U(t);var a=new g(function(s,i){r.ready().then(function(){V(r._dbInfo,re,function(f,h){if(f)return i(f);try{var v=h.objectStore(r._dbInfo.storeName),m=v.get(t);m.onsuccess=function(){var p=m.result;p===void 0&&(p=null),W(p)&&(p=T(p)),s(p)},m.onerror=function(){i(m.error)}}catch(p){i(p)}})}).catch(i)});return A(a,o),a}function Te(t,o){var r=this,a=new g(function(s,i){r.ready().then(function(){V(r._dbInfo,re,function(f,h){if(f)return i(f);try{var v=h.objectStore(r._dbInfo.storeName),m=v.openCursor(),p=1;m.onsuccess=function(){var w=m.result;if(w){var L=w.value;W(L)&&(L=T(L));var x=t(L,w.key,p++);x!==void 0?s(x):w.continue()}else s()},m.onerror=function(){i(m.error)}}catch(w){i(w)}})}).catch(i)});return A(a,o),a}function kt(t,o,r){var a=this;t=U(t);var s=new g(function(i,f){var h;a.ready().then(function(){return h=a._dbInfo,pe.call(o)==="[object Blob]"?F(h.db).then(function(v){return v?o:N(o)}):o}).then(function(v){V(a._dbInfo,y,function(m,p){if(m)return f(m);try{var w=p.objectStore(a._dbInfo.storeName);v===null&&(v=void 0);var L=w.put(v,t);p.oncomplete=function(){v===void 0&&(v=null),i(v)},p.onabort=p.onerror=function(){var x=L.error?L.error:L.transaction.error;f(x)}}catch(x){f(x)}})}).catch(f)});return A(s,r),s}function Gt(t,o){var r=this;t=U(t);var a=new g(function(s,i){r.ready().then(function(){V(r._dbInfo,y,function(f,h){if(f)return i(f);try{var v=h.objectStore(r._dbInfo.storeName),m=v.delete(t);h.oncomplete=function(){s()},h.onerror=function(){i(m.error)},h.onabort=function(){var p=m.error?m.error:m.transaction.error;i(p)}}catch(p){i(p)}})}).catch(i)});return A(a,o),a}function jt(t){var o=this,r=new g(function(a,s){o.ready().then(function(){V(o._dbInfo,y,function(i,f){if(i)return s(i);try{var h=f.objectStore(o._dbInfo.storeName),v=h.clear();f.oncomplete=function(){a()},f.onabort=f.onerror=function(){var m=v.error?v.error:v.transaction.error;s(m)}}catch(m){s(m)}})}).catch(s)});return A(r,t),r}function Yt(t){var o=this,r=new g(function(a,s){o.ready().then(function(){V(o._dbInfo,re,function(i,f){if(i)return s(i);try{var h=f.objectStore(o._dbInfo.storeName),v=h.count();v.onsuccess=function(){a(v.result)},v.onerror=function(){s(v.error)}}catch(m){s(m)}})}).catch(s)});return A(r,t),r}function Kt(t,o){var r=this,a=new g(function(s,i){if(t<0){s(null);return}r.ready().then(function(){V(r._dbInfo,re,function(f,h){if(f)return i(f);try{var v=h.objectStore(r._dbInfo.storeName),m=!1,p=v.openKeyCursor();p.onsuccess=function(){var w=p.result;if(!w){s(null);return}t===0||m?s(w.key):(m=!0,w.advance(t))},p.onerror=function(){i(p.error)}}catch(w){i(w)}})}).catch(i)});return A(a,o),a}function Vt(t){var o=this,r=new g(function(a,s){o.ready().then(function(){V(o._dbInfo,re,function(i,f){if(i)return s(i);try{var h=f.objectStore(o._dbInfo.storeName),v=h.openKeyCursor(),m=[];v.onsuccess=function(){var p=v.result;if(!p){a(m);return}m.push(p.key),p.continue()},v.onerror=function(){s(v.error)}}catch(p){s(p)}})}).catch(s)});return A(r,t),r}function Ht(t,o){o=$.apply(this,arguments);var r=this.config();t=typeof t!="function"&&t||{},t.name||(t.name=t.name||r.name,t.storeName=t.storeName||r.storeName);var a=this,s;if(!t.name)s=g.reject("Invalid arguments");else{var i=t.name===r.name&&a._dbInfo.db,f=i?g.resolve(a._dbInfo.db):oe(t).then(function(h){var v=C[t.name],m=v.forages;v.db=h;for(var p=0;p<m.length;p++)m[p]._dbInfo.db=h;return h});t.storeName?s=f.then(function(h){if(!!h.objectStoreNames.contains(t.storeName)){var v=h.version+1;z(t);var m=C[t.name],p=m.forages;h.close();for(var w=0;w<p.length;w++){var L=p[w];L._dbInfo.db=null,L._dbInfo.version=v}var x=new g(function(B,H){var K=R.open(t.name,v);K.onerror=function(te){var ye=K.result;ye.close(),H(te)},K.onupgradeneeded=function(){var te=K.result;te.deleteObjectStore(t.storeName)},K.onsuccess=function(){var te=K.result;te.close(),B(te)}});return x.then(function(B){m.db=B;for(var H=0;H<p.length;H++){var K=p[H];K._dbInfo.db=B,J(K._dbInfo)}}).catch(function(B){throw(Z(t,B)||g.resolve()).catch(function(){}),B})}}):s=f.then(function(h){z(t);var v=C[t.name],m=v.forages;h.close();for(var p=0;p<m.length;p++){var w=m[p];w._dbInfo.db=null}var L=new g(function(x,B){var H=R.deleteDatabase(t.name);H.onerror=function(){var K=H.result;K&&K.close(),B(H.error)},H.onblocked=function(){console.warn('dropInstance blocked for database "'+t.name+'" until all open connections are closed')},H.onsuccess=function(){var K=H.result;K&&K.close(),x(K)}});return L.then(function(x){v.db=x;for(var B=0;B<m.length;B++){var H=m[B];J(H._dbInfo)}}).catch(function(x){throw(Z(t,x)||g.resolve()).catch(function(){}),x})})}return A(s,o),s}var zt={_driver:"asyncStorage",_initStorage:Ae,_support:S(),iterate:Te,getItem:Ee,setItem:kt,removeItem:Gt,clear:jt,length:Yt,key:Kt,keys:Vt,dropInstance:Ht};function qt(){return typeof openDatabase=="function"}var ae="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Xt="~~local_forage_type~",Ze=/^~~local_forage_type~([^~]+)~/,Ie="__lfsc__:",Oe=Ie.length,Me="arbf",Le="blob",et="si08",tt="ui08",rt="uic8",nt="si16",ot="si32",it="ur16",at="ui32",st="fl32",ut="fl64",ct=Oe+Me.length,ft=Object.prototype.toString;function lt(t){var o=t.length*.75,r=t.length,a,s=0,i,f,h,v;t[t.length-1]==="="&&(o--,t[t.length-2]==="="&&o--);var m=new ArrayBuffer(o),p=new Uint8Array(m);for(a=0;a<r;a+=4)i=ae.indexOf(t[a]),f=ae.indexOf(t[a+1]),h=ae.indexOf(t[a+2]),v=ae.indexOf(t[a+3]),p[s++]=i<<2|f>>4,p[s++]=(f&15)<<4|h>>2,p[s++]=(h&3)<<6|v&63;return m}function Pe(t){var o=new Uint8Array(t),r="",a;for(a=0;a<o.length;a+=3)r+=ae[o[a]>>2],r+=ae[(o[a]&3)<<4|o[a+1]>>4],r+=ae[(o[a+1]&15)<<2|o[a+2]>>6],r+=ae[o[a+2]&63];return o.length%3===2?r=r.substring(0,r.length-1)+"=":o.length%3===1&&(r=r.substring(0,r.length-2)+"=="),r}function Jt(t,o){var r="";if(t&&(r=ft.call(t)),t&&(r==="[object ArrayBuffer]"||t.buffer&&ft.call(t.buffer)==="[object ArrayBuffer]")){var a,s=Ie;t instanceof ArrayBuffer?(a=t,s+=Me):(a=t.buffer,r==="[object Int8Array]"?s+=et:r==="[object Uint8Array]"?s+=tt:r==="[object Uint8ClampedArray]"?s+=rt:r==="[object Int16Array]"?s+=nt:r==="[object Uint16Array]"?s+=it:r==="[object Int32Array]"?s+=ot:r==="[object Uint32Array]"?s+=at:r==="[object Float32Array]"?s+=st:r==="[object Float64Array]"?s+=ut:o(new Error("Failed to get type for BinaryArray"))),o(s+Pe(a))}else if(r==="[object Blob]"){var i=new FileReader;i.onload=function(){var f=Xt+t.type+"~"+Pe(this.result);o(Ie+Le+f)},i.readAsArrayBuffer(t)}else try{o(JSON.stringify(t))}catch(f){console.error("Couldn't convert value into a JSON string: ",t),o(null,f)}}function Qt(t){if(t.substring(0,Oe)!==Ie)return JSON.parse(t);var o=t.substring(ct),r=t.substring(Oe,ct),a;if(r===Le&&Ze.test(o)){var s=o.match(Ze);a=s[1],o=o.substring(s[0].length)}var i=lt(o);switch(r){case Me:return i;case Le:return O([i],{type:a});case et:return new Int8Array(i);case tt:return new Uint8Array(i);case rt:return new Uint8ClampedArray(i);case nt:return new Int16Array(i);case it:return new Uint16Array(i);case ot:return new Int32Array(i);case at:return new Uint32Array(i);case st:return new Float32Array(i);case ut:return new Float64Array(i);default:throw new Error("Unkown type: "+r)}}var Ce={serialize:Jt,deserialize:Qt,stringToBuffer:lt,bufferToString:Pe};function dt(t,o,r,a){t.executeSql("CREATE TABLE IF NOT EXISTS "+o.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,a)}function Zt(t){var o=this,r={db:null};if(t)for(var a in t)r[a]=typeof t[a]!="string"?t[a].toString():t[a];var s=new g(function(i,f){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(h){return f(h)}r.db.transaction(function(h){dt(h,r,function(){o._dbInfo=r,i()},function(v,m){f(m)})},f)});return r.serializer=Ce,s}function se(t,o,r,a,s,i){t.executeSql(r,a,s,function(f,h){h.code===h.SYNTAX_ERR?f.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[o.storeName],function(v,m){m.rows.length?i(v,h):dt(v,o,function(){v.executeSql(r,a,s,i)},i)},i):i(f,h)},i)}function er(t,o){var r=this;t=U(t);var a=new g(function(s,i){r.ready().then(function(){var f=r._dbInfo;f.db.transaction(function(h){se(h,f,"SELECT * FROM "+f.storeName+" WHERE key = ? LIMIT 1",[t],function(v,m){var p=m.rows.length?m.rows.item(0).value:null;p&&(p=f.serializer.deserialize(p)),s(p)},function(v,m){i(m)})})}).catch(i)});return A(a,o),a}function tr(t,o){var r=this,a=new g(function(s,i){r.ready().then(function(){var f=r._dbInfo;f.db.transaction(function(h){se(h,f,"SELECT * FROM "+f.storeName,[],function(v,m){for(var p=m.rows,w=p.length,L=0;L<w;L++){var x=p.item(L),B=x.value;if(B&&(B=f.serializer.deserialize(B)),B=t(B,x.key,L+1),B!==void 0){s(B);return}}s()},function(v,m){i(m)})})}).catch(i)});return A(a,o),a}function ht(t,o,r,a){var s=this;t=U(t);var i=new g(function(f,h){s.ready().then(function(){o===void 0&&(o=null);var v=o,m=s._dbInfo;m.serializer.serialize(o,function(p,w){w?h(w):m.db.transaction(function(L){se(L,m,"INSERT OR REPLACE INTO "+m.storeName+" (key, value) VALUES (?, ?)",[t,p],function(){f(v)},function(x,B){h(B)})},function(L){if(L.code===L.QUOTA_ERR){if(a>0){f(ht.apply(s,[t,v,r,a-1]));return}h(L)}})})}).catch(h)});return A(i,r),i}function rr(t,o,r){return ht.apply(this,[t,o,r,1])}function nr(t,o){var r=this;t=U(t);var a=new g(function(s,i){r.ready().then(function(){var f=r._dbInfo;f.db.transaction(function(h){se(h,f,"DELETE FROM "+f.storeName+" WHERE key = ?",[t],function(){s()},function(v,m){i(m)})})}).catch(i)});return A(a,o),a}function or(t){var o=this,r=new g(function(a,s){o.ready().then(function(){var i=o._dbInfo;i.db.transaction(function(f){se(f,i,"DELETE FROM "+i.storeName,[],function(){a()},function(h,v){s(v)})})}).catch(s)});return A(r,t),r}function ir(t){var o=this,r=new g(function(a,s){o.ready().then(function(){var i=o._dbInfo;i.db.transaction(function(f){se(f,i,"SELECT COUNT(key) as c FROM "+i.storeName,[],function(h,v){var m=v.rows.item(0).c;a(m)},function(h,v){s(v)})})}).catch(s)});return A(r,t),r}function ar(t,o){var r=this,a=new g(function(s,i){r.ready().then(function(){var f=r._dbInfo;f.db.transaction(function(h){se(h,f,"SELECT key FROM "+f.storeName+" WHERE id = ? LIMIT 1",[t+1],function(v,m){var p=m.rows.length?m.rows.item(0).key:null;s(p)},function(v,m){i(m)})})}).catch(i)});return A(a,o),a}function sr(t){var o=this,r=new g(function(a,s){o.ready().then(function(){var i=o._dbInfo;i.db.transaction(function(f){se(f,i,"SELECT key FROM "+i.storeName,[],function(h,v){for(var m=[],p=0;p<v.rows.length;p++)m.push(v.rows.item(p).key);a(m)},function(h,v){s(v)})})}).catch(s)});return A(r,t),r}function ur(t){return new g(function(o,r){t.transaction(function(a){a.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(s,i){for(var f=[],h=0;h<i.rows.length;h++)f.push(i.rows.item(h).name);o({db:t,storeNames:f})},function(s,i){r(i)})},function(a){r(a)})})}function cr(t,o){o=$.apply(this,arguments);var r=this.config();t=typeof t!="function"&&t||{},t.name||(t.name=t.name||r.name,t.storeName=t.storeName||r.storeName);var a=this,s;return t.name?s=new g(function(i){var f;t.name===r.name?f=a._dbInfo.db:f=openDatabase(t.name,"","",0),t.storeName?i({db:f,storeNames:[t.storeName]}):i(ur(f))}).then(function(i){return new g(function(f,h){i.db.transaction(function(v){function m(x){return new g(function(B,H){v.executeSql("DROP TABLE IF EXISTS "+x,[],function(){B()},function(K,te){H(te)})})}for(var p=[],w=0,L=i.storeNames.length;w<L;w++)p.push(m(i.storeNames[w]));g.all(p).then(function(){f()}).catch(function(x){h(x)})},function(v){h(v)})})}):s=g.reject("Invalid arguments"),A(s,o),s}var fr={_driver:"webSQLStorage",_initStorage:Zt,_support:qt(),iterate:tr,getItem:er,setItem:rr,removeItem:nr,clear:or,length:ir,key:ar,keys:sr,dropInstance:cr};function lr(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function vt(t,o){var r=t.name+"/";return t.storeName!==o.storeName&&(r+=t.storeName+"/"),r}function dr(){var t="_localforage_support_test";try{return localStorage.setItem(t,!0),localStorage.removeItem(t),!1}catch{return!0}}function hr(){return!dr()||localStorage.length>0}function vr(t){var o=this,r={};if(t)for(var a in t)r[a]=t[a];return r.keyPrefix=vt(t,o._defaultConfig),hr()?(o._dbInfo=r,r.serializer=Ce,g.resolve()):g.reject()}function mr(t){var o=this,r=o.ready().then(function(){for(var a=o._dbInfo.keyPrefix,s=localStorage.length-1;s>=0;s--){var i=localStorage.key(s);i.indexOf(a)===0&&localStorage.removeItem(i)}});return A(r,t),r}function pr(t,o){var r=this;t=U(t);var a=r.ready().then(function(){var s=r._dbInfo,i=localStorage.getItem(s.keyPrefix+t);return i&&(i=s.serializer.deserialize(i)),i});return A(a,o),a}function gr(t,o){var r=this,a=r.ready().then(function(){for(var s=r._dbInfo,i=s.keyPrefix,f=i.length,h=localStorage.length,v=1,m=0;m<h;m++){var p=localStorage.key(m);if(p.indexOf(i)===0){var w=localStorage.getItem(p);if(w&&(w=s.serializer.deserialize(w)),w=t(w,p.substring(f),v++),w!==void 0)return w}}});return A(a,o),a}function yr(t,o){var r=this,a=r.ready().then(function(){var s=r._dbInfo,i;try{i=localStorage.key(t)}catch{i=null}return i&&(i=i.substring(s.keyPrefix.length)),i});return A(a,o),a}function _r(t){var o=this,r=o.ready().then(function(){for(var a=o._dbInfo,s=localStorage.length,i=[],f=0;f<s;f++){var h=localStorage.key(f);h.indexOf(a.keyPrefix)===0&&i.push(h.substring(a.keyPrefix.length))}return i});return A(r,t),r}function Er(t){var o=this,r=o.keys().then(function(a){return a.length});return A(r,t),r}function Ir(t,o){var r=this;t=U(t);var a=r.ready().then(function(){var s=r._dbInfo;localStorage.removeItem(s.keyPrefix+t)});return A(a,o),a}function br(t,o,r){var a=this;t=U(t);var s=a.ready().then(function(){o===void 0&&(o=null);var i=o;return new g(function(f,h){var v=a._dbInfo;v.serializer.serialize(o,function(m,p){if(p)h(p);else try{localStorage.setItem(v.keyPrefix+t,m),f(i)}catch(w){(w.name==="QuotaExceededError"||w.name==="NS_ERROR_DOM_QUOTA_REACHED")&&h(w),h(w)}})})});return A(s,r),s}function wr(t,o){if(o=$.apply(this,arguments),t=typeof t!="function"&&t||{},!t.name){var r=this.config();t.name=t.name||r.name,t.storeName=t.storeName||r.storeName}var a=this,s;return t.name?s=new g(function(i){t.storeName?i(vt(t,a._defaultConfig)):i(t.name+"/")}).then(function(i){for(var f=localStorage.length-1;f>=0;f--){var h=localStorage.key(f);h.indexOf(i)===0&&localStorage.removeItem(h)}}):s=g.reject("Invalid arguments"),A(s,o),s}var Rr={_driver:"localStorageWrapper",_initStorage:vr,_support:lr(),iterate:gr,getItem:pr,setItem:br,removeItem:Ir,clear:mr,length:Er,key:yr,keys:_r,dropInstance:wr},Sr=function(o,r){return o===r||typeof o=="number"&&typeof r=="number"&&isNaN(o)&&isNaN(r)},Ar=function(o,r){for(var a=o.length,s=0;s<a;){if(Sr(o[s],r))return!0;s++}return!1},mt=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"},ge={},pt={},ve={INDEXEDDB:zt,WEBSQL:fr,LOCALSTORAGE:Rr},Nr=[ve.INDEXEDDB._driver,ve.WEBSQL._driver,ve.LOCALSTORAGE._driver],be=["dropInstance"],De=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(be),Tr={description:"",driver:Nr.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Or(t,o){t[o]=function(){var r=arguments;return t.ready().then(function(){return t[o].apply(t,r)})}}function $e(){for(var t=1;t<arguments.length;t++){var o=arguments[t];if(o)for(var r in o)o.hasOwnProperty(r)&&(mt(o[r])?arguments[0][r]=o[r].slice():arguments[0][r]=o[r])}return arguments[0]}var Mr=function(){function t(o){b(this,t);for(var r in ve)if(ve.hasOwnProperty(r)){var a=ve[r],s=a._driver;this[r]=s,ge[s]||this.defineDriver(a)}this._defaultConfig=$e({},Tr),this._config=$e({},this._defaultConfig,o),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return t.prototype.config=function(r){if((typeof r>"u"?"undefined":I(r))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var a in r){if(a==="storeName"&&(r[a]=r[a].replace(/\W/g,"_")),a==="version"&&typeof r[a]!="number")return new Error("Database version must be a number.");this._config[a]=r[a]}return"driver"in r&&r.driver?this.setDriver(this._config.driver):!0}else return typeof r=="string"?this._config[r]:this._config},t.prototype.defineDriver=function(r,a,s){var i=new g(function(f,h){try{var v=r._driver,m=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!r._driver){h(m);return}for(var p=De.concat("_initStorage"),w=0,L=p.length;w<L;w++){var x=p[w],B=!Ar(be,x);if((B||r[x])&&typeof r[x]!="function"){h(m);return}}var H=function(){for(var ye=function(Cr){return function(){var Dr=new Error("Method "+Cr+" is not implemented by the current driver"),gt=g.reject(Dr);return A(gt,arguments[arguments.length-1]),gt}},xe=0,Pr=be.length;xe<Pr;xe++){var Be=be[xe];r[Be]||(r[Be]=ye(Be))}};H();var K=function(ye){ge[v]&&console.info("Redefining LocalForage driver: "+v),ge[v]=r,pt[v]=ye,f()};"_support"in r?r._support&&typeof r._support=="function"?r._support().then(K,h):K(!!r._support):K(!0)}catch(te){h(te)}});return P(i,a,s),i},t.prototype.driver=function(){return this._driver||null},t.prototype.getDriver=function(r,a,s){var i=ge[r]?g.resolve(ge[r]):g.reject(new Error("Driver not found."));return P(i,a,s),i},t.prototype.getSerializer=function(r){var a=g.resolve(Ce);return P(a,r),a},t.prototype.ready=function(r){var a=this,s=a._driverSet.then(function(){return a._ready===null&&(a._ready=a._initDriver()),a._ready});return P(s,r,r),s},t.prototype.setDriver=function(r,a,s){var i=this;mt(r)||(r=[r]);var f=this._getSupportedDrivers(r);function h(){i._config.driver=i.driver()}function v(w){return i._extend(w),h(),i._ready=i._initStorage(i._config),i._ready}function m(w){return function(){var L=0;function x(){for(;L<w.length;){var B=w[L];return L++,i._dbInfo=null,i._ready=null,i.getDriver(B).then(v).catch(x)}h();var H=new Error("No available storage method found.");return i._driverSet=g.reject(H),i._driverSet}return x()}}var p=this._driverSet!==null?this._driverSet.catch(function(){return g.resolve()}):g.resolve();return this._driverSet=p.then(function(){var w=f[0];return i._dbInfo=null,i._ready=null,i.getDriver(w).then(function(L){i._driver=L._driver,h(),i._wrapLibraryMethodsWithReady(),i._initDriver=m(f)})}).catch(function(){h();var w=new Error("No available storage method found.");return i._driverSet=g.reject(w),i._driverSet}),P(this._driverSet,a,s),this._driverSet},t.prototype.supports=function(r){return!!pt[r]},t.prototype._extend=function(r){$e(this,r)},t.prototype._getSupportedDrivers=function(r){for(var a=[],s=0,i=r.length;s<i;s++){var f=r[s];this.supports(f)&&a.push(f)}return a},t.prototype._wrapLibraryMethodsWithReady=function(){for(var r=0,a=De.length;r<a;r++)Or(this,De[r])},t.prototype.createInstance=function(r){return new t(r)},t}(),Lr=new Mr;l.exports=Lr},{3:3}]},{},[4])(4)})});var Gn=$r((kn,zr)=>{(function(e){if(typeof kn=="object"&&typeof zr<"u")zr.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var n;typeof window<"u"?n=window:typeof global<"u"?n=global:typeof self<"u"?n=self:n=this,n.localforage=e()}})(function(){var e,n,u;return function c(l,d,I){function b(S,O){if(!d[S]){if(!l[S]){var g=typeof _e=="function"&&_e;if(!O&&g)return g(S,!0);if(E)return E(S,!0);var A=new Error("Cannot find module '"+S+"'");throw A.code="MODULE_NOT_FOUND",A}var P=d[S]={exports:{}};l[S][0].call(P.exports,function(U){var $=l[S][1][U];return b($||U)},P,P.exports,c,l,d,I)}return d[S].exports}for(var E=typeof _e=="function"&&_e,R=0;R<I.length;R++)b(I[R]);return b}({1:[function(c,l,d){(function(I){"use strict";var b=I.MutationObserver||I.WebKitMutationObserver,E;if(b){var R=0,S=new b(U),O=I.document.createTextNode("");S.observe(O,{characterData:!0}),E=function(){O.data=R=++R%2}}else if(!I.setImmediate&&typeof I.MessageChannel<"u"){var g=new I.MessageChannel;g.port1.onmessage=U,E=function(){g.port2.postMessage(0)}}else"document"in I&&"onreadystatechange"in I.document.createElement("script")?E=function(){var k=I.document.createElement("script");k.onreadystatechange=function(){U(),k.onreadystatechange=null,k.parentNode.removeChild(k),k=null},I.document.documentElement.appendChild(k)}:E=function(){setTimeout(U,0)};var A,P=[];function U(){A=!0;for(var k,X,C=P.length;C;){for(X=P,P=[],k=-1;++k<C;)X[k]();C=P.length}A=!1}l.exports=$;function $(k){P.push(k)===1&&!A&&E()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(c,l,d){"use strict";var I=c(1);function b(){}var E={},R=["REJECTED"],S=["FULFILLED"],O=["PENDING"];l.exports=g;function g(y){if(typeof y!="function")throw new TypeError("resolver must be a function");this.state=O,this.queue=[],this.outcome=void 0,y!==b&&$(this,y)}g.prototype.catch=function(y){return this.then(null,y)},g.prototype.then=function(y,D){if(typeof y!="function"&&this.state===S||typeof D!="function"&&this.state===R)return this;var M=new this.constructor(b);if(this.state!==O){var F=this.state===S?y:D;P(M,F,this.outcome)}else this.queue.push(new A(M,y,D));return M};function A(y,D,M){this.promise=y,typeof D=="function"&&(this.onFulfilled=D,this.callFulfilled=this.otherCallFulfilled),typeof M=="function"&&(this.onRejected=M,this.callRejected=this.otherCallRejected)}A.prototype.callFulfilled=function(y){E.resolve(this.promise,y)},A.prototype.otherCallFulfilled=function(y){P(this.promise,this.onFulfilled,y)},A.prototype.callRejected=function(y){E.reject(this.promise,y)},A.prototype.otherCallRejected=function(y){P(this.promise,this.onRejected,y)};function P(y,D,M){I(function(){var F;try{F=D(M)}catch(z){return E.reject(y,z)}F===y?E.reject(y,new TypeError("Cannot resolve promise with itself")):E.resolve(y,F)})}E.resolve=function(y,D){var M=k(U,D);if(M.status==="error")return E.reject(y,M.value);var F=M.value;if(F)$(y,F);else{y.state=S,y.outcome=D;for(var z=-1,J=y.queue.length;++z<J;)y.queue[z].callFulfilled(D)}return y},E.reject=function(y,D){y.state=R,y.outcome=D;for(var M=-1,F=y.queue.length;++M<F;)y.queue[M].callRejected(D);return y};function U(y){var D=y&&y.then;if(y&&(typeof y=="object"||typeof y=="function")&&typeof D=="function")return function(){D.apply(y,arguments)}}function $(y,D){var M=!1;function F(ee){M||(M=!0,E.reject(y,ee))}function z(ee){M||(M=!0,E.resolve(y,ee))}function J(){D(z,F)}var Z=k(J);Z.status==="error"&&F(Z.value)}function k(y,D){var M={};try{M.value=y(D),M.status="success"}catch(F){M.status="error",M.value=F}return M}g.resolve=X;function X(y){return y instanceof this?y:E.resolve(new this(b),y)}g.reject=C;function C(y){var D=new this(b);return E.reject(D,y)}g.all=pe;function pe(y){var D=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var M=y.length,F=!1;if(!M)return this.resolve([]);for(var z=new Array(M),J=0,Z=-1,ee=new this(b);++Z<M;)oe(y[Z],Z);return ee;function oe(he,_){D.resolve(he).then(N,function(T){F||(F=!0,E.reject(ee,T))});function N(T){z[_]=T,++J===M&&!F&&(F=!0,E.resolve(ee,z))}}}g.race=re;function re(y){var D=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var M=y.length,F=!1;if(!M)return this.resolve([]);for(var z=-1,J=new this(b);++z<M;)Z(y[z]);return J;function Z(ee){D.resolve(ee).then(function(oe){F||(F=!0,E.resolve(J,oe))},function(oe){F||(F=!0,E.reject(J,oe))})}}},{1:1}],3:[function(c,l,d){(function(I){"use strict";typeof I.Promise!="function"&&(I.Promise=c(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(c,l,d){"use strict";var I=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function b(t,o){if(!(t instanceof o))throw new TypeError("Cannot call a class as a function")}function E(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var R=E();function S(){try{if(!R||!R.open)return!1;var t=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),o=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!t||o)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function O(t,o){t=t||[],o=o||{};try{return new Blob(t,o)}catch(i){if(i.name!=="TypeError")throw i;for(var r=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,a=new r,s=0;s<t.length;s+=1)a.append(t[s]);return a.getBlob(o.type)}}typeof Promise>"u"&&c(3);var g=Promise;function A(t,o){o&&t.then(function(r){o(null,r)},function(r){o(r)})}function P(t,o,r){typeof o=="function"&&t.then(o),typeof r=="function"&&t.catch(r)}function U(t){return typeof t!="string"&&(console.warn(t+" used as a key, but it is not a string."),t=String(t)),t}function $(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var k="local-forage-detect-blob-support",X=void 0,C={},pe=Object.prototype.toString,re="readonly",y="readwrite";function D(t){for(var o=t.length,r=new ArrayBuffer(o),a=new Uint8Array(r),s=0;s<o;s++)a[s]=t.charCodeAt(s);return r}function M(t){return new g(function(o){var r=t.transaction(k,y),a=O([""]);r.objectStore(k).put(a,"key"),r.onabort=function(s){s.preventDefault(),s.stopPropagation(),o(!1)},r.oncomplete=function(){var s=navigator.userAgent.match(/Chrome\/(\d+)/),i=navigator.userAgent.match(/Edge\//);o(i||!s||parseInt(s[1],10)>=43)}}).catch(function(){return!1})}function F(t){return typeof X=="boolean"?g.resolve(X):M(t).then(function(o){return X=o,X})}function z(t){var o=C[t.name],r={};r.promise=new g(function(a,s){r.resolve=a,r.reject=s}),o.deferredOperations.push(r),o.dbReady?o.dbReady=o.dbReady.then(function(){return r.promise}):o.dbReady=r.promise}function J(t){var o=C[t.name],r=o.deferredOperations.pop();if(r)return r.resolve(),r.promise}function Z(t,o){var r=C[t.name],a=r.deferredOperations.pop();if(a)return a.reject(o),a.promise}function ee(t,o){return new g(function(r,a){if(C[t.name]=C[t.name]||ie(),t.db)if(o)z(t),t.db.close();else return r(t.db);var s=[t.name];o&&s.push(t.version);var i=R.open.apply(R,s);o&&(i.onupgradeneeded=function(f){var h=i.result;try{h.createObjectStore(t.storeName),f.oldVersion<=1&&h.createObjectStore(k)}catch(v){if(v.name==="ConstraintError")console.warn('The database "'+t.name+'" has been upgraded from version '+f.oldVersion+" to version "+f.newVersion+', but the storage "'+t.storeName+'" already exists.');else throw v}}),i.onerror=function(f){f.preventDefault(),a(i.error)},i.onsuccess=function(){var f=i.result;f.onversionchange=function(h){h.target.close()},r(f),J(t)}})}function oe(t){return ee(t,!1)}function he(t){return ee(t,!0)}function _(t,o){if(!t.db)return!0;var r=!t.db.objectStoreNames.contains(t.storeName),a=t.version<t.db.version,s=t.version>t.db.version;if(a&&(t.version!==o&&console.warn('The database "'+t.name+`" can't be downgraded from version `+t.db.version+" to version "+t.version+"."),t.version=t.db.version),s||r){if(r){var i=t.db.version+1;i>t.version&&(t.version=i)}return!0}return!1}function N(t){return new g(function(o,r){var a=new FileReader;a.onerror=r,a.onloadend=function(s){var i=btoa(s.target.result||"");o({__local_forage_encoded_blob:!0,data:i,type:t.type})},a.readAsBinaryString(t)})}function T(t){var o=D(atob(t.data));return O([o],{type:t.type})}function W(t){return t&&t.__local_forage_encoded_blob}function G(t){var o=this,r=o._initReady().then(function(){var a=C[o._dbInfo.name];if(a&&a.dbReady)return a.dbReady});return P(r,t,t),r}function Y(t){z(t);for(var o=C[t.name],r=o.forages,a=0;a<r.length;a++){var s=r[a];s._dbInfo.db&&(s._dbInfo.db.close(),s._dbInfo.db=null)}return t.db=null,oe(t).then(function(i){return t.db=i,_(t)?he(t):i}).then(function(i){t.db=o.db=i;for(var f=0;f<r.length;f++)r[f]._dbInfo.db=i}).catch(function(i){throw Z(t,i),i})}function V(t,o,r,a){a===void 0&&(a=1);try{var s=t.db.transaction(t.storeName,o);r(null,s)}catch(i){if(a>0&&(!t.db||i.name==="InvalidStateError"||i.name==="NotFoundError"))return g.resolve().then(function(){if(!t.db||i.name==="NotFoundError"&&!t.db.objectStoreNames.contains(t.storeName)&&t.version<=t.db.version)return t.db&&(t.version=t.db.version+1),he(t)}).then(function(){return Y(t).then(function(){V(t,o,r,a-1)})}).catch(r);r(i)}}function ie(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Ae(t){var o=this,r={db:null};if(t)for(var a in t)r[a]=t[a];var s=C[r.name];s||(s=ie(),C[r.name]=s),s.forages.push(o),o._initReady||(o._initReady=o.ready,o.ready=G);var i=[];function f(){return g.resolve()}for(var h=0;h<s.forages.length;h++){var v=s.forages[h];v!==o&&i.push(v._initReady().catch(f))}var m=s.forages.slice(0);return g.all(i).then(function(){return r.db=s.db,oe(r)}).then(function(p){return r.db=p,_(r,o._defaultConfig.version)?he(r):p}).then(function(p){r.db=s.db=p,o._dbInfo=r;for(var w=0;w<m.length;w++){var L=m[w];L!==o&&(L._dbInfo.db=r.db,L._dbInfo.version=r.version)}})}function Ee(t,o){var r=this;t=U(t);var a=new g(function(s,i){r.ready().then(function(){V(r._dbInfo,re,function(f,h){if(f)return i(f);try{var v=h.objectStore(r._dbInfo.storeName),m=v.get(t);m.onsuccess=function(){var p=m.result;p===void 0&&(p=null),W(p)&&(p=T(p)),s(p)},m.onerror=function(){i(m.error)}}catch(p){i(p)}})}).catch(i)});return A(a,o),a}function Te(t,o){var r=this,a=new g(function(s,i){r.ready().then(function(){V(r._dbInfo,re,function(f,h){if(f)return i(f);try{var v=h.objectStore(r._dbInfo.storeName),m=v.openCursor(),p=1;m.onsuccess=function(){var w=m.result;if(w){var L=w.value;W(L)&&(L=T(L));var x=t(L,w.key,p++);x!==void 0?s(x):w.continue()}else s()},m.onerror=function(){i(m.error)}}catch(w){i(w)}})}).catch(i)});return A(a,o),a}function kt(t,o,r){var a=this;t=U(t);var s=new g(function(i,f){var h;a.ready().then(function(){return h=a._dbInfo,pe.call(o)==="[object Blob]"?F(h.db).then(function(v){return v?o:N(o)}):o}).then(function(v){V(a._dbInfo,y,function(m,p){if(m)return f(m);try{var w=p.objectStore(a._dbInfo.storeName);v===null&&(v=void 0);var L=w.put(v,t);p.oncomplete=function(){v===void 0&&(v=null),i(v)},p.onabort=p.onerror=function(){var x=L.error?L.error:L.transaction.error;f(x)}}catch(x){f(x)}})}).catch(f)});return A(s,r),s}function Gt(t,o){var r=this;t=U(t);var a=new g(function(s,i){r.ready().then(function(){V(r._dbInfo,y,function(f,h){if(f)return i(f);try{var v=h.objectStore(r._dbInfo.storeName),m=v.delete(t);h.oncomplete=function(){s()},h.onerror=function(){i(m.error)},h.onabort=function(){var p=m.error?m.error:m.transaction.error;i(p)}}catch(p){i(p)}})}).catch(i)});return A(a,o),a}function jt(t){var o=this,r=new g(function(a,s){o.ready().then(function(){V(o._dbInfo,y,function(i,f){if(i)return s(i);try{var h=f.objectStore(o._dbInfo.storeName),v=h.clear();f.oncomplete=function(){a()},f.onabort=f.onerror=function(){var m=v.error?v.error:v.transaction.error;s(m)}}catch(m){s(m)}})}).catch(s)});return A(r,t),r}function Yt(t){var o=this,r=new g(function(a,s){o.ready().then(function(){V(o._dbInfo,re,function(i,f){if(i)return s(i);try{var h=f.objectStore(o._dbInfo.storeName),v=h.count();v.onsuccess=function(){a(v.result)},v.onerror=function(){s(v.error)}}catch(m){s(m)}})}).catch(s)});return A(r,t),r}function Kt(t,o){var r=this,a=new g(function(s,i){if(t<0){s(null);return}r.ready().then(function(){V(r._dbInfo,re,function(f,h){if(f)return i(f);try{var v=h.objectStore(r._dbInfo.storeName),m=!1,p=v.openKeyCursor();p.onsuccess=function(){var w=p.result;if(!w){s(null);return}t===0||m?s(w.key):(m=!0,w.advance(t))},p.onerror=function(){i(p.error)}}catch(w){i(w)}})}).catch(i)});return A(a,o),a}function Vt(t){var o=this,r=new g(function(a,s){o.ready().then(function(){V(o._dbInfo,re,function(i,f){if(i)return s(i);try{var h=f.objectStore(o._dbInfo.storeName),v=h.openKeyCursor(),m=[];v.onsuccess=function(){var p=v.result;if(!p){a(m);return}m.push(p.key),p.continue()},v.onerror=function(){s(v.error)}}catch(p){s(p)}})}).catch(s)});return A(r,t),r}function Ht(t,o){o=$.apply(this,arguments);var r=this.config();t=typeof t!="function"&&t||{},t.name||(t.name=t.name||r.name,t.storeName=t.storeName||r.storeName);var a=this,s;if(!t.name)s=g.reject("Invalid arguments");else{var i=t.name===r.name&&a._dbInfo.db,f=i?g.resolve(a._dbInfo.db):oe(t).then(function(h){var v=C[t.name],m=v.forages;v.db=h;for(var p=0;p<m.length;p++)m[p]._dbInfo.db=h;return h});t.storeName?s=f.then(function(h){if(!!h.objectStoreNames.contains(t.storeName)){var v=h.version+1;z(t);var m=C[t.name],p=m.forages;h.close();for(var w=0;w<p.length;w++){var L=p[w];L._dbInfo.db=null,L._dbInfo.version=v}var x=new g(function(B,H){var K=R.open(t.name,v);K.onerror=function(te){var ye=K.result;ye.close(),H(te)},K.onupgradeneeded=function(){var te=K.result;te.deleteObjectStore(t.storeName)},K.onsuccess=function(){var te=K.result;te.close(),B(te)}});return x.then(function(B){m.db=B;for(var H=0;H<p.length;H++){var K=p[H];K._dbInfo.db=B,J(K._dbInfo)}}).catch(function(B){throw(Z(t,B)||g.resolve()).catch(function(){}),B})}}):s=f.then(function(h){z(t);var v=C[t.name],m=v.forages;h.close();for(var p=0;p<m.length;p++){var w=m[p];w._dbInfo.db=null}var L=new g(function(x,B){var H=R.deleteDatabase(t.name);H.onerror=function(){var K=H.result;K&&K.close(),B(H.error)},H.onblocked=function(){console.warn('dropInstance blocked for database "'+t.name+'" until all open connections are closed')},H.onsuccess=function(){var K=H.result;K&&K.close(),x(K)}});return L.then(function(x){v.db=x;for(var B=0;B<m.length;B++){var H=m[B];J(H._dbInfo)}}).catch(function(x){throw(Z(t,x)||g.resolve()).catch(function(){}),x})})}return A(s,o),s}var zt={_driver:"asyncStorage",_initStorage:Ae,_support:S(),iterate:Te,getItem:Ee,setItem:kt,removeItem:Gt,clear:jt,length:Yt,key:Kt,keys:Vt,dropInstance:Ht};function qt(){return typeof openDatabase=="function"}var ae="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Xt="~~local_forage_type~",Ze=/^~~local_forage_type~([^~]+)~/,Ie="__lfsc__:",Oe=Ie.length,Me="arbf",Le="blob",et="si08",tt="ui08",rt="uic8",nt="si16",ot="si32",it="ur16",at="ui32",st="fl32",ut="fl64",ct=Oe+Me.length,ft=Object.prototype.toString;function lt(t){var o=t.length*.75,r=t.length,a,s=0,i,f,h,v;t[t.length-1]==="="&&(o--,t[t.length-2]==="="&&o--);var m=new ArrayBuffer(o),p=new Uint8Array(m);for(a=0;a<r;a+=4)i=ae.indexOf(t[a]),f=ae.indexOf(t[a+1]),h=ae.indexOf(t[a+2]),v=ae.indexOf(t[a+3]),p[s++]=i<<2|f>>4,p[s++]=(f&15)<<4|h>>2,p[s++]=(h&3)<<6|v&63;return m}function Pe(t){var o=new Uint8Array(t),r="",a;for(a=0;a<o.length;a+=3)r+=ae[o[a]>>2],r+=ae[(o[a]&3)<<4|o[a+1]>>4],r+=ae[(o[a+1]&15)<<2|o[a+2]>>6],r+=ae[o[a+2]&63];return o.length%3===2?r=r.substring(0,r.length-1)+"=":o.length%3===1&&(r=r.substring(0,r.length-2)+"=="),r}function Jt(t,o){var r="";if(t&&(r=ft.call(t)),t&&(r==="[object ArrayBuffer]"||t.buffer&&ft.call(t.buffer)==="[object ArrayBuffer]")){var a,s=Ie;t instanceof ArrayBuffer?(a=t,s+=Me):(a=t.buffer,r==="[object Int8Array]"?s+=et:r==="[object Uint8Array]"?s+=tt:r==="[object Uint8ClampedArray]"?s+=rt:r==="[object Int16Array]"?s+=nt:r==="[object Uint16Array]"?s+=it:r==="[object Int32Array]"?s+=ot:r==="[object Uint32Array]"?s+=at:r==="[object Float32Array]"?s+=st:r==="[object Float64Array]"?s+=ut:o(new Error("Failed to get type for BinaryArray"))),o(s+Pe(a))}else if(r==="[object Blob]"){var i=new FileReader;i.onload=function(){var f=Xt+t.type+"~"+Pe(this.result);o(Ie+Le+f)},i.readAsArrayBuffer(t)}else try{o(JSON.stringify(t))}catch(f){console.error("Couldn't convert value into a JSON string: ",t),o(null,f)}}function Qt(t){if(t.substring(0,Oe)!==Ie)return JSON.parse(t);var o=t.substring(ct),r=t.substring(Oe,ct),a;if(r===Le&&Ze.test(o)){var s=o.match(Ze);a=s[1],o=o.substring(s[0].length)}var i=lt(o);switch(r){case Me:return i;case Le:return O([i],{type:a});case et:return new Int8Array(i);case tt:return new Uint8Array(i);case rt:return new Uint8ClampedArray(i);case nt:return new Int16Array(i);case it:return new Uint16Array(i);case ot:return new Int32Array(i);case at:return new Uint32Array(i);case st:return new Float32Array(i);case ut:return new Float64Array(i);default:throw new Error("Unkown type: "+r)}}var Ce={serialize:Jt,deserialize:Qt,stringToBuffer:lt,bufferToString:Pe};function dt(t,o,r,a){t.executeSql("CREATE TABLE IF NOT EXISTS "+o.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,a)}function Zt(t){var o=this,r={db:null};if(t)for(var a in t)r[a]=typeof t[a]!="string"?t[a].toString():t[a];var s=new g(function(i,f){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(h){return f(h)}r.db.transaction(function(h){dt(h,r,function(){o._dbInfo=r,i()},function(v,m){f(m)})},f)});return r.serializer=Ce,s}function se(t,o,r,a,s,i){t.executeSql(r,a,s,function(f,h){h.code===h.SYNTAX_ERR?f.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[o.storeName],function(v,m){m.rows.length?i(v,h):dt(v,o,function(){v.executeSql(r,a,s,i)},i)},i):i(f,h)},i)}function er(t,o){var r=this;t=U(t);var a=new g(function(s,i){r.ready().then(function(){var f=r._dbInfo;f.db.transaction(function(h){se(h,f,"SELECT * FROM "+f.storeName+" WHERE key = ? LIMIT 1",[t],function(v,m){var p=m.rows.length?m.rows.item(0).value:null;p&&(p=f.serializer.deserialize(p)),s(p)},function(v,m){i(m)})})}).catch(i)});return A(a,o),a}function tr(t,o){var r=this,a=new g(function(s,i){r.ready().then(function(){var f=r._dbInfo;f.db.transaction(function(h){se(h,f,"SELECT * FROM "+f.storeName,[],function(v,m){for(var p=m.rows,w=p.length,L=0;L<w;L++){var x=p.item(L),B=x.value;if(B&&(B=f.serializer.deserialize(B)),B=t(B,x.key,L+1),B!==void 0){s(B);return}}s()},function(v,m){i(m)})})}).catch(i)});return A(a,o),a}function ht(t,o,r,a){var s=this;t=U(t);var i=new g(function(f,h){s.ready().then(function(){o===void 0&&(o=null);var v=o,m=s._dbInfo;m.serializer.serialize(o,function(p,w){w?h(w):m.db.transaction(function(L){se(L,m,"INSERT OR REPLACE INTO "+m.storeName+" (key, value) VALUES (?, ?)",[t,p],function(){f(v)},function(x,B){h(B)})},function(L){if(L.code===L.QUOTA_ERR){if(a>0){f(ht.apply(s,[t,v,r,a-1]));return}h(L)}})})}).catch(h)});return A(i,r),i}function rr(t,o,r){return ht.apply(this,[t,o,r,1])}function nr(t,o){var r=this;t=U(t);var a=new g(function(s,i){r.ready().then(function(){var f=r._dbInfo;f.db.transaction(function(h){se(h,f,"DELETE FROM "+f.storeName+" WHERE key = ?",[t],function(){s()},function(v,m){i(m)})})}).catch(i)});return A(a,o),a}function or(t){var o=this,r=new g(function(a,s){o.ready().then(function(){var i=o._dbInfo;i.db.transaction(function(f){se(f,i,"DELETE FROM "+i.storeName,[],function(){a()},function(h,v){s(v)})})}).catch(s)});return A(r,t),r}function ir(t){var o=this,r=new g(function(a,s){o.ready().then(function(){var i=o._dbInfo;i.db.transaction(function(f){se(f,i,"SELECT COUNT(key) as c FROM "+i.storeName,[],function(h,v){var m=v.rows.item(0).c;a(m)},function(h,v){s(v)})})}).catch(s)});return A(r,t),r}function ar(t,o){var r=this,a=new g(function(s,i){r.ready().then(function(){var f=r._dbInfo;f.db.transaction(function(h){se(h,f,"SELECT key FROM "+f.storeName+" WHERE id = ? LIMIT 1",[t+1],function(v,m){var p=m.rows.length?m.rows.item(0).key:null;s(p)},function(v,m){i(m)})})}).catch(i)});return A(a,o),a}function sr(t){var o=this,r=new g(function(a,s){o.ready().then(function(){var i=o._dbInfo;i.db.transaction(function(f){se(f,i,"SELECT key FROM "+i.storeName,[],function(h,v){for(var m=[],p=0;p<v.rows.length;p++)m.push(v.rows.item(p).key);a(m)},function(h,v){s(v)})})}).catch(s)});return A(r,t),r}function ur(t){return new g(function(o,r){t.transaction(function(a){a.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(s,i){for(var f=[],h=0;h<i.rows.length;h++)f.push(i.rows.item(h).name);o({db:t,storeNames:f})},function(s,i){r(i)})},function(a){r(a)})})}function cr(t,o){o=$.apply(this,arguments);var r=this.config();t=typeof t!="function"&&t||{},t.name||(t.name=t.name||r.name,t.storeName=t.storeName||r.storeName);var a=this,s;return t.name?s=new g(function(i){var f;t.name===r.name?f=a._dbInfo.db:f=openDatabase(t.name,"","",0),t.storeName?i({db:f,storeNames:[t.storeName]}):i(ur(f))}).then(function(i){return new g(function(f,h){i.db.transaction(function(v){function m(x){return new g(function(B,H){v.executeSql("DROP TABLE IF EXISTS "+x,[],function(){B()},function(K,te){H(te)})})}for(var p=[],w=0,L=i.storeNames.length;w<L;w++)p.push(m(i.storeNames[w]));g.all(p).then(function(){f()}).catch(function(x){h(x)})},function(v){h(v)})})}):s=g.reject("Invalid arguments"),A(s,o),s}var fr={_driver:"webSQLStorage",_initStorage:Zt,_support:qt(),iterate:tr,getItem:er,setItem:rr,removeItem:nr,clear:or,length:ir,key:ar,keys:sr,dropInstance:cr};function lr(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function vt(t,o){var r=t.name+"/";return t.storeName!==o.storeName&&(r+=t.storeName+"/"),r}function dr(){var t="_localforage_support_test";try{return localStorage.setItem(t,!0),localStorage.removeItem(t),!1}catch{return!0}}function hr(){return!dr()||localStorage.length>0}function vr(t){var o=this,r={};if(t)for(var a in t)r[a]=t[a];return r.keyPrefix=vt(t,o._defaultConfig),hr()?(o._dbInfo=r,r.serializer=Ce,g.resolve()):g.reject()}function mr(t){var o=this,r=o.ready().then(function(){for(var a=o._dbInfo.keyPrefix,s=localStorage.length-1;s>=0;s--){var i=localStorage.key(s);i.indexOf(a)===0&&localStorage.removeItem(i)}});return A(r,t),r}function pr(t,o){var r=this;t=U(t);var a=r.ready().then(function(){var s=r._dbInfo,i=localStorage.getItem(s.keyPrefix+t);return i&&(i=s.serializer.deserialize(i)),i});return A(a,o),a}function gr(t,o){var r=this,a=r.ready().then(function(){for(var s=r._dbInfo,i=s.keyPrefix,f=i.length,h=localStorage.length,v=1,m=0;m<h;m++){var p=localStorage.key(m);if(p.indexOf(i)===0){var w=localStorage.getItem(p);if(w&&(w=s.serializer.deserialize(w)),w=t(w,p.substring(f),v++),w!==void 0)return w}}});return A(a,o),a}function yr(t,o){var r=this,a=r.ready().then(function(){var s=r._dbInfo,i;try{i=localStorage.key(t)}catch{i=null}return i&&(i=i.substring(s.keyPrefix.length)),i});return A(a,o),a}function _r(t){var o=this,r=o.ready().then(function(){for(var a=o._dbInfo,s=localStorage.length,i=[],f=0;f<s;f++){var h=localStorage.key(f);h.indexOf(a.keyPrefix)===0&&i.push(h.substring(a.keyPrefix.length))}return i});return A(r,t),r}function Er(t){var o=this,r=o.keys().then(function(a){return a.length});return A(r,t),r}function Ir(t,o){var r=this;t=U(t);var a=r.ready().then(function(){var s=r._dbInfo;localStorage.removeItem(s.keyPrefix+t)});return A(a,o),a}function br(t,o,r){var a=this;t=U(t);var s=a.ready().then(function(){o===void 0&&(o=null);var i=o;return new g(function(f,h){var v=a._dbInfo;v.serializer.serialize(o,function(m,p){if(p)h(p);else try{localStorage.setItem(v.keyPrefix+t,m),f(i)}catch(w){(w.name==="QuotaExceededError"||w.name==="NS_ERROR_DOM_QUOTA_REACHED")&&h(w),h(w)}})})});return A(s,r),s}function wr(t,o){if(o=$.apply(this,arguments),t=typeof t!="function"&&t||{},!t.name){var r=this.config();t.name=t.name||r.name,t.storeName=t.storeName||r.storeName}var a=this,s;return t.name?s=new g(function(i){t.storeName?i(vt(t,a._defaultConfig)):i(t.name+"/")}).then(function(i){for(var f=localStorage.length-1;f>=0;f--){var h=localStorage.key(f);h.indexOf(i)===0&&localStorage.removeItem(h)}}):s=g.reject("Invalid arguments"),A(s,o),s}var Rr={_driver:"localStorageWrapper",_initStorage:vr,_support:lr(),iterate:gr,getItem:pr,setItem:br,removeItem:Ir,clear:mr,length:Er,key:yr,keys:_r,dropInstance:wr},Sr=function(o,r){return o===r||typeof o=="number"&&typeof r=="number"&&isNaN(o)&&isNaN(r)},Ar=function(o,r){for(var a=o.length,s=0;s<a;){if(Sr(o[s],r))return!0;s++}return!1},mt=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"},ge={},pt={},ve={INDEXEDDB:zt,WEBSQL:fr,LOCALSTORAGE:Rr},Nr=[ve.INDEXEDDB._driver,ve.WEBSQL._driver,ve.LOCALSTORAGE._driver],be=["dropInstance"],De=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(be),Tr={description:"",driver:Nr.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Or(t,o){t[o]=function(){var r=arguments;return t.ready().then(function(){return t[o].apply(t,r)})}}function $e(){for(var t=1;t<arguments.length;t++){var o=arguments[t];if(o)for(var r in o)o.hasOwnProperty(r)&&(mt(o[r])?arguments[0][r]=o[r].slice():arguments[0][r]=o[r])}return arguments[0]}var Mr=function(){function t(o){b(this,t);for(var r in ve)if(ve.hasOwnProperty(r)){var a=ve[r],s=a._driver;this[r]=s,ge[s]||this.defineDriver(a)}this._defaultConfig=$e({},Tr),this._config=$e({},this._defaultConfig,o),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return t.prototype.config=function(r){if((typeof r>"u"?"undefined":I(r))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var a in r){if(a==="storeName"&&(r[a]=r[a].replace(/\W/g,"_")),a==="version"&&typeof r[a]!="number")return new Error("Database version must be a number.");this._config[a]=r[a]}return"driver"in r&&r.driver?this.setDriver(this._config.driver):!0}else return typeof r=="string"?this._config[r]:this._config},t.prototype.defineDriver=function(r,a,s){var i=new g(function(f,h){try{var v=r._driver,m=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!r._driver){h(m);return}for(var p=De.concat("_initStorage"),w=0,L=p.length;w<L;w++){var x=p[w],B=!Ar(be,x);if((B||r[x])&&typeof r[x]!="function"){h(m);return}}var H=function(){for(var ye=function(Cr){return function(){var Dr=new Error("Method "+Cr+" is not implemented by the current driver"),gt=g.reject(Dr);return A(gt,arguments[arguments.length-1]),gt}},xe=0,Pr=be.length;xe<Pr;xe++){var Be=be[xe];r[Be]||(r[Be]=ye(Be))}};H();var K=function(ye){ge[v]&&console.info("Redefining LocalForage driver: "+v),ge[v]=r,pt[v]=ye,f()};"_support"in r?r._support&&typeof r._support=="function"?r._support().then(K,h):K(!!r._support):K(!0)}catch(te){h(te)}});return P(i,a,s),i},t.prototype.driver=function(){return this._driver||null},t.prototype.getDriver=function(r,a,s){var i=ge[r]?g.resolve(ge[r]):g.reject(new Error("Driver not found."));return P(i,a,s),i},t.prototype.getSerializer=function(r){var a=g.resolve(Ce);return P(a,r),a},t.prototype.ready=function(r){var a=this,s=a._driverSet.then(function(){return a._ready===null&&(a._ready=a._initDriver()),a._ready});return P(s,r,r),s},t.prototype.setDriver=function(r,a,s){var i=this;mt(r)||(r=[r]);var f=this._getSupportedDrivers(r);function h(){i._config.driver=i.driver()}function v(w){return i._extend(w),h(),i._ready=i._initStorage(i._config),i._ready}function m(w){return function(){var L=0;function x(){for(;L<w.length;){var B=w[L];return L++,i._dbInfo=null,i._ready=null,i.getDriver(B).then(v).catch(x)}h();var H=new Error("No available storage method found.");return i._driverSet=g.reject(H),i._driverSet}return x()}}var p=this._driverSet!==null?this._driverSet.catch(function(){return g.resolve()}):g.resolve();return this._driverSet=p.then(function(){var w=f[0];return i._dbInfo=null,i._ready=null,i.getDriver(w).then(function(L){i._driver=L._driver,h(),i._wrapLibraryMethodsWithReady(),i._initDriver=m(f)})}).catch(function(){h();var w=new Error("No available storage method found.");return i._driverSet=g.reject(w),i._driverSet}),P(this._driverSet,a,s),this._driverSet},t.prototype.supports=function(r){return!!pt[r]},t.prototype._extend=function(r){$e(this,r)},t.prototype._getSupportedDrivers=function(r){for(var a=[],s=0,i=r.length;s<i;s++){var f=r[s];this.supports(f)&&a.push(f)}return a},t.prototype._wrapLibraryMethodsWithReady=function(){for(var r=0,a=De.length;r<a;r++)Or(this,De[r])},t.prototype.createInstance=function(r){return new t(r)},t}(),Lr=new Mr;l.exports=Lr},{3:3}]},{},[4])(4)})});var Yn=$r((Ut,jn)=>{(function(e,n){typeof Ut=="object"&&typeof jn<"u"?n(Ut):typeof define=="function"&&define.amd?define("localforage-driver-memory",["exports"],n):n(e.LocalforageDriverMemory={})})(typeof self<"u"?self:Ut,function(e){"use strict";var n="localforage-driver-memory";function u(_){var N=typeof Symbol=="function"&&_[Symbol.iterator],T=0;return N?N.call(_):{next:function(){return _&&T>=_.length&&(_=void 0),{value:_&&_[T++],done:!_}}}}function c(_,N){_=_||[],N=N||{};try{return new Blob(_,N)}catch(Y){if(Y.name!=="TypeError")throw Y;for(var T=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,W=new T,G=0;G<_.length;G+=1)W.append(_[G]);return W.getBlob(N.type)}}var l=/^~~local_forage_type~([^~]+)~/,d=9,I=d+4,b=Object.prototype.toString;function E(_){var N=_.length*.75,T=_.length;_[_.length-1]==="="&&(N--,_[_.length-2]==="="&&N--);for(var W=new ArrayBuffer(N),G=new Uint8Array(W),Y=0,V=0;Y<T;Y+=4){var ie="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(_[Y]),Ae="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(_[Y+1]),Ee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(_[Y+2]),Te="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(_[Y+3]);G[V++]=ie<<2|Ae>>4,G[V++]=(Ae&15)<<4|Ee>>2,G[V++]=(Ee&3)<<6|Te&63}return W}function R(_){for(var N=new Uint8Array(_),T="",W=0;W<N.length;W+=3)T+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[N[W]>>2],T+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(N[W]&3)<<4|N[W+1]>>4],T+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(N[W+1]&15)<<2|N[W+2]>>6],T+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[N[W+2]&63];return N.length%3===2?T=T.substring(0,T.length-1)+"=":N.length%3===1&&(T=T.substring(0,T.length-2)+"=="),T}function S(_,N){var T="";if(_&&(T=b.call(_)),_&&(T==="[object ArrayBuffer]"||_.buffer&&b.call(_.buffer)==="[object ArrayBuffer]")){var W=void 0,G="__lfsc__:";_ instanceof ArrayBuffer?(W=_,G+="arbf"):(W=_.buffer,T==="[object Int8Array]"?G+="si08":T==="[object Uint8Array]"?G+="ui08":T==="[object Uint8ClampedArray]"?G+="uic8":T==="[object Int16Array]"?G+="si16":T==="[object Uint16Array]"?G+="ur16":T==="[object Int32Array]"?G+="si32":T==="[object Uint32Array]"?G+="ui32":T==="[object Float32Array]"?G+="fl32":T==="[object Float64Array]"?G+="fl64":N(new Error("Failed to get type for BinaryArray"))),N(G+R(W))}else if(T==="[object Blob]"){var Y=new FileReader;Y.onload=function(){var V="~~local_forage_type~"+_.type+"~"+R(this.result);N("__lfsc__:blob"+V)},Y.readAsArrayBuffer(_)}else try{N(JSON.stringify(_))}catch(V){console.error("Couldn't convert value into a JSON string: ",_),N(null,V)}}function O(_){if(_.substring(0,d)!=="__lfsc__:")return JSON.parse(_);var N=_.substring(I),T=_.substring(d,I),W;if(T==="blob"&&l.test(N)){var G=N.match(l);W=G[1],N=N.substring(G[0].length)}var Y=E(N);switch(T){case"arbf":return Y;case"blob":return c([Y],{type:W});case"si08":return new Int8Array(Y);case"ui08":return new Uint8Array(Y);case"uic8":return new Uint8ClampedArray(Y);case"si16":return new Int16Array(Y);case"ur16":return new Uint16Array(Y);case"si32":return new Int32Array(Y);case"ui32":return new Uint32Array(Y);case"fl32":return new Float32Array(Y);case"fl64":return new Float64Array(Y);default:throw new Error("Unkown type: "+T)}}function g(_){var N,T;if(_===null||typeof _!="object"||"isActiveClone"in _)return _;var W=_ instanceof Date?new Date(_):_.constructor();try{for(var G=u(Object.keys(_)),Y=G.next();!Y.done;Y=G.next()){var V=Y.value;Object.prototype.hasOwnProperty.call(_,V)&&(_.isActiveClone=null,W[V]=g(_[V]),delete _.isActiveClone)}}catch(ie){N={error:ie}}finally{try{Y&&!Y.done&&(T=G.return)&&T.call(G)}finally{if(N)throw N.error}}return W}function A(_,N){return(_.name||N.name)+"/"+(_.storeName||N.storeName)+"/"}function P(_,N){N&&_.then(function(T){N(null,T)},function(T){N(T)})}function U(){for(var _=[],N=0;N<arguments.length;N++)_[N]=arguments[N];if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}function $(_,N){var T=this;if(N=U.apply(this,arguments),_=typeof _!="function"&&_||{},!_.name){var W=this.config();_.name=_.name||W.name,_.storeName=_.storeName||W.storeName}var G;return _.name?G=new Promise(function(Y){_.storeName?Y(A(_,T._defaultConfig)):Y(_.name+"/")}):G=Promise.reject("Invalid arguments"),{promise:G,callback:N}}function k(_){return typeof _!="string"&&(console.warn(_+" used as a key, but it is not a string."),_=String(_)),_}var X={bufferToString:R,deserialize:O,serialize:S,stringToBuffer:E},C={},pe=function(){function _(N){this.kp=N,this.data={}}return _.resolve=function(N){return C[N]||(C[N]=new _(N)),C[N]},_.prototype.clear=function(){this.data={}},_.prototype.drop=function(){this.clear(),delete C[this.kp]},_.prototype.get=function(N){return this.data[N]},_.prototype.key=function(N){return this.keys()[N]},_.prototype.keys=function(){return Object.keys(this.data)},_.prototype.rm=function(N){delete this.data[N]},_.prototype.set=function(N,T){this.data[N]=T},_}();function re(_){var N=_?g(_):{},T=A(N,this._defaultConfig),W=pe.resolve(T);return this._dbInfo=N,this._dbInfo.serializer=X,this._dbInfo.keyPrefix=T,this._dbInfo.mStore=W,Promise.resolve()}function y(_){var N=this,T=this.ready().then(function(){N._dbInfo.mStore.clear()});return P(T,_),T}function D(_,N){var T=$.apply(this,arguments),W=T.promise,G=T.callback,Y=W.then(function(V){pe.resolve(V).drop()});return P(Y,G),W}function M(_,N){var T=this;_=k(_);var W=this.ready().then(function(){var G=T._dbInfo.mStore.get(_);return G==null?null:T._dbInfo.serializer.deserialize(G)});return P(W,N),W}function F(_,N){var T=this,W=this.ready().then(function(){for(var G=T._dbInfo.mStore,Y=G.keys(),V=0;V<Y.length;V++){var ie=G.get(Y[V]);if(ie&&(ie=T._dbInfo.serializer.deserialize(ie)),ie=_(ie,Y[V],V+1),ie!==void 0)return ie}});return P(W,N),W}function z(_,N){var T=this,W=this.ready().then(function(){var G;try{G=T._dbInfo.mStore.key(_),G===void 0&&(G=null)}catch{G=null}return G});return P(W,N),W}function J(_){var N=this,T=this.ready().then(function(){return N._dbInfo.mStore.keys()});return P(T,_),T}function Z(_){var N=this.keys().then(function(T){return T.length});return P(N,_),N}function ee(_,N){var T=this;_=k(_);var W=this.ready().then(function(){T._dbInfo.mStore.rm(_)});return P(W,N),W}function oe(_,N,T){var W=this;_=k(_);var G=this.ready().then(function(){N===void 0&&(N=null);var Y=N;return new Promise(function(V,ie){W._dbInfo.serializer.serialize(N,function(Ae,Ee){if(Ee)ie(Ee);else try{W._dbInfo.mStore.set(_,Ae),V(Y)}catch(Te){ie(Te)}})})});return P(G,T),G}var he=!0;e._support=he,e._driver=n,e._initStorage=re,e.clear=y,e.dropInstance=D,e.getItem=M,e.iterate=F,e.key=z,e.keys=J,e.length=Z,e.removeItem=ee,e.setItem=oe,Object.defineProperty(e,"__esModule",{value:!0})})});var zi={};en(zi,{default:()=>Hi});var we=(e=>(e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.MalformedResponse="MALFORMED_RESPONSE",e.InvalidArgument="INVALID_ARGUMENT",e.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",e.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",e))(we||{}),Ue=(e=>(e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE",e))(Ue||{}),Ye=(e=>(e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",e[e.MagicLinkExpired=-10001]="MagicLinkExpired",e[e.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",e[e.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",e[e.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",e[e.UpdateEmailFailed=-10004]="UpdateEmailFailed",e[e.UserRequestEditEmail=-10005]="UserRequestEditEmail",e[e.InactiveRecipient=-10010]="InactiveRecipient",e[e.AccessDeniedToUser=-10011]="AccessDeniedToUser",e))(Ye||{}),me=(e=>(e.MetaMask="metamask",e.CoinbaseWallet="coinbase_wallet",e))(me||{}),Ke=(e=>(e.WalletSelected="wallet_selected",e.WalletConnected="wallet_connected",e.WalletRejected="wallet_rejected",e))(Ke||{}),j=(e=>(e.LoginWithSms="magic_auth_login_with_sms",e.LoginWithEmailOTP="magic_auth_login_with_email_otp",e.LoginWithMagicLink="magic_auth_login_with_magic_link",e.LoginWithCredential="magic_auth_login_with_credential",e.SetAuthorizationToken="magic_auth_set_authorization_token",e.GetIdToken="magic_auth_get_id_token",e.GenerateIdToken="magic_auth_generate_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_is_logged_in",e.Logout="magic_auth_logout",e.UpdateEmail="magic_auth_update_email",e.UserSettings="magic_auth_settings",e.UserSettingsTestMode="magic_auth_settings_testing_mode",e.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",e.LoginWithEmailOTPTestMode="magic_auth_login_with_email_otp_testing_mode",e.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",e.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",e.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",e.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",e.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",e.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",e.LogoutTestMode="magic_auth_logout_testing_mode",e.UpdateEmailTestMode="magic_auth_update_email_testing_mode",e.IntermediaryEvent="magic_intermediary_event",e.RequestAccounts="eth_requestAccounts",e.GetInfo="magic_get_info",e.ShowUI="magic_wallet",e.NFTPurchase="magic_nft_purchase",e.RequestUserInfoWithUI="mc_request_user_info",e.Disconnect="mc_disconnect",e.UpdatePhoneNumber="magic_auth_update_phone_number",e.UpdatePhoneNumberTestMode="magic_auth_update_phone_number_testing_mode",e.RecoverAccount="magic_auth_recover_account",e.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",e.MagicBoxHeartBeat="magic_box_heart_beat",e.AutoConnect="mc_auto_connect",e.Login="mc_login",e))(j||{}),Re=(e=>(e.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",e.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",e.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",e.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",e.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT",e.MAGIC_MG_BOX_SEND_RECEIPT="MAGIC_MG_BOX_SEND_RECEIPT",e))(Re||{}),Fe=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e))(Fe||{}),rn=(e=>(e.Harmony="HARMONY",e))(rn||{});var Bt=xr(on());var Qn=Object.create,$t=Object.defineProperty,Zn=Object.defineProperties,eo=Object.getOwnPropertyDescriptor,to=Object.getOwnPropertyDescriptors,ro=Object.getOwnPropertyNames,an=Object.getOwnPropertySymbols,no=Object.getPrototypeOf,En=Object.prototype.hasOwnProperty,oo=Object.prototype.propertyIsEnumerable,sn=(e,n,u)=>n in e?$t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[n]=u,Wr=(e,n)=>{for(var u in n||(n={}))En.call(n,u)&&sn(e,u,n[u]);if(an)for(var u of an(n))oo.call(n,u)&&sn(e,u,n[u]);return e},In=(e,n)=>Zn(e,to(n)),io=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),ao=(e,n)=>{for(var u in n)$t(e,u,{get:n[u],enumerable:!0})},so=(e,n,u,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of ro(n))!En.call(e,l)&&l!==u&&$t(e,l,{get:()=>n[l],enumerable:!(c=eo(n,l))||c.enumerable});return e},uo=(e,n,u)=>(u=e!=null?Qn(no(e)):{},so(n||!e||!e.__esModule?$t(u,"default",{value:e,enumerable:!0}):u,e)),de=(e,n,u)=>new Promise((c,l)=>{var d=E=>{try{b(u.next(E))}catch(R){l(R)}},I=E=>{try{b(u.throw(E))}catch(R){l(R)}},b=E=>E.done?c(E.value):Promise.resolve(E.value).then(d,I);b((u=u.apply(e,n)).next())}),co=io((e,n)=>{"use strict";var u=Object.prototype.hasOwnProperty,c="~";function l(){}Object.create&&(l.prototype=Object.create(null),new l().__proto__||(c=!1));function d(R,S,O){this.fn=R,this.context=S,this.once=O||!1}function I(R,S,O,g,A){if(typeof O!="function")throw new TypeError("The listener must be a function");var P=new d(O,g||R,A),U=c?c+S:S;return R._events[U]?R._events[U].fn?R._events[U]=[R._events[U],P]:R._events[U].push(P):(R._events[U]=P,R._eventsCount++),R}function b(R,S){--R._eventsCount===0?R._events=new l:delete R._events[S]}function E(){this._events=new l,this._eventsCount=0}E.prototype.eventNames=function(){var R=[],S,O;if(this._eventsCount===0)return R;for(O in S=this._events)u.call(S,O)&&R.push(c?O.slice(1):O);return Object.getOwnPropertySymbols?R.concat(Object.getOwnPropertySymbols(S)):R},E.prototype.listeners=function(R){var S=c?c+R:R,O=this._events[S];if(!O)return[];if(O.fn)return[O.fn];for(var g=0,A=O.length,P=new Array(A);g<A;g++)P[g]=O[g].fn;return P},E.prototype.listenerCount=function(R){var S=c?c+R:R,O=this._events[S];return O?O.fn?1:O.length:0},E.prototype.emit=function(R,S,O,g,A,P){var U=c?c+R:R;if(!this._events[U])return!1;var $=this._events[U],k=arguments.length,X,C;if($.fn){switch($.once&&this.removeListener(R,$.fn,void 0,!0),k){case 1:return $.fn.call($.context),!0;case 2:return $.fn.call($.context,S),!0;case 3:return $.fn.call($.context,S,O),!0;case 4:return $.fn.call($.context,S,O,g),!0;case 5:return $.fn.call($.context,S,O,g,A),!0;case 6:return $.fn.call($.context,S,O,g,A,P),!0}for(C=1,X=new Array(k-1);C<k;C++)X[C-1]=arguments[C];$.fn.apply($.context,X)}else{var pe=$.length,re;for(C=0;C<pe;C++)switch($[C].once&&this.removeListener(R,$[C].fn,void 0,!0),k){case 1:$[C].fn.call($[C].context);break;case 2:$[C].fn.call($[C].context,S);break;case 3:$[C].fn.call($[C].context,S,O);break;case 4:$[C].fn.call($[C].context,S,O,g);break;default:if(!X)for(re=1,X=new Array(k-1);re<k;re++)X[re-1]=arguments[re];$[C].fn.apply($[C].context,X)}}return!0},E.prototype.on=function(R,S,O){return I(this,R,S,O,!1)},E.prototype.once=function(R,S,O){return I(this,R,S,O,!0)},E.prototype.removeListener=function(R,S,O,g){var A=c?c+R:R;if(!this._events[A])return this;if(!S)return b(this,A),this;var P=this._events[A];if(P.fn)P.fn===S&&(!g||P.once)&&(!O||P.context===O)&&b(this,A);else{for(var U=0,$=[],k=P.length;U<k;U++)(P[U].fn!==S||g&&!P[U].once||O&&P[U].context!==O)&&$.push(P[U]);$.length?this._events[A]=$.length===1?$[0]:$:b(this,A)}return this},E.prototype.removeAllListeners=function(R){var S;return R?(S=c?c+R:R,this._events[S]&&b(this,S)):(this._events=new l,this._eventsCount=0),this},E.prototype.off=E.prototype.removeListener,E.prototype.addListener=E.prototype.on,E.prefixed=c,E.EventEmitter=E,typeof n<"u"&&(n.exports=E)});function fo(e){let n={exports:{}};return e(n,n.exports),n.exports}var lo=Number.MAX_SAFE_INTEGER||9007199254740991,kr={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:lo,MAX_SAFE_COMPONENT_LENGTH:16},ho=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{},Q=ho,Rt=fo(function(e,n){let{MAX_SAFE_COMPONENT_LENGTH:u}=kr,c=(n=e.exports={}).re=[],l=n.src=[],d=n.t={},I=0,b=(E,R,S)=>{let O=I++;Q(O,R),d[E]=O,l[O]=R,c[O]=new RegExp(R,S?"g":void 0)};b("NUMERICIDENTIFIER","0|[1-9]\\d*"),b("NUMERICIDENTIFIERLOOSE","[0-9]+"),b("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),b("MAINVERSION",`(${l[d.NUMERICIDENTIFIER]})\\.(${l[d.NUMERICIDENTIFIER]})\\.(${l[d.NUMERICIDENTIFIER]})`),b("MAINVERSIONLOOSE",`(${l[d.NUMERICIDENTIFIERLOOSE]})\\.(${l[d.NUMERICIDENTIFIERLOOSE]})\\.(${l[d.NUMERICIDENTIFIERLOOSE]})`),b("PRERELEASEIDENTIFIER",`(?:${l[d.NUMERICIDENTIFIER]}|${l[d.NONNUMERICIDENTIFIER]})`),b("PRERELEASEIDENTIFIERLOOSE",`(?:${l[d.NUMERICIDENTIFIERLOOSE]}|${l[d.NONNUMERICIDENTIFIER]})`),b("PRERELEASE",`(?:-(${l[d.PRERELEASEIDENTIFIER]}(?:\\.${l[d.PRERELEASEIDENTIFIER]})*))`),b("PRERELEASELOOSE",`(?:-?(${l[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[d.PRERELEASEIDENTIFIERLOOSE]})*))`),b("BUILDIDENTIFIER","[0-9A-Za-z-]+"),b("BUILD",`(?:\\+(${l[d.BUILDIDENTIFIER]}(?:\\.${l[d.BUILDIDENTIFIER]})*))`),b("FULLPLAIN",`v?${l[d.MAINVERSION]}${l[d.PRERELEASE]}?${l[d.BUILD]}?`),b("FULL",`^${l[d.FULLPLAIN]}$`),b("LOOSEPLAIN",`[v=\\s]*${l[d.MAINVERSIONLOOSE]}${l[d.PRERELEASELOOSE]}?${l[d.BUILD]}?`),b("LOOSE",`^${l[d.LOOSEPLAIN]}$`),b("GTLT","((?:<|>)?=?)"),b("XRANGEIDENTIFIERLOOSE",`${l[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),b("XRANGEIDENTIFIER",`${l[d.NUMERICIDENTIFIER]}|x|X|\\*`),b("XRANGEPLAIN",`[v=\\s]*(${l[d.XRANGEIDENTIFIER]})(?:\\.(${l[d.XRANGEIDENTIFIER]})(?:\\.(${l[d.XRANGEIDENTIFIER]})(?:${l[d.PRERELEASE]})?${l[d.BUILD]}?)?)?`),b("XRANGEPLAINLOOSE",`[v=\\s]*(${l[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[d.XRANGEIDENTIFIERLOOSE]})(?:${l[d.PRERELEASELOOSE]})?${l[d.BUILD]}?)?)?`),b("XRANGE",`^${l[d.GTLT]}\\s*${l[d.XRANGEPLAIN]}$`),b("XRANGELOOSE",`^${l[d.GTLT]}\\s*${l[d.XRANGEPLAINLOOSE]}$`),b("COERCE",`(^|[^\\d])(\\d{1,${u}})(?:\\.(\\d{1,${u}}))?(?:\\.(\\d{1,${u}}))?(?:$|[^\\d])`),b("COERCERTL",l[d.COERCE],!0),b("LONETILDE","(?:~>?)"),b("TILDETRIM",`(\\s*)${l[d.LONETILDE]}\\s+`,!0),n.tildeTrimReplace="$1~",b("TILDE",`^${l[d.LONETILDE]}${l[d.XRANGEPLAIN]}$`),b("TILDELOOSE",`^${l[d.LONETILDE]}${l[d.XRANGEPLAINLOOSE]}$`),b("LONECARET","(?:\\^)"),b("CARETTRIM",`(\\s*)${l[d.LONECARET]}\\s+`,!0),n.caretTrimReplace="$1^",b("CARET",`^${l[d.LONECARET]}${l[d.XRANGEPLAIN]}$`),b("CARETLOOSE",`^${l[d.LONECARET]}${l[d.XRANGEPLAINLOOSE]}$`),b("COMPARATORLOOSE",`^${l[d.GTLT]}\\s*(${l[d.LOOSEPLAIN]})$|^$`),b("COMPARATOR",`^${l[d.GTLT]}\\s*(${l[d.FULLPLAIN]})$|^$`),b("COMPARATORTRIM",`(\\s*)${l[d.GTLT]}\\s*(${l[d.LOOSEPLAIN]}|${l[d.XRANGEPLAIN]})`,!0),n.comparatorTrimReplace="$1$2$3",b("HYPHENRANGE",`^\\s*(${l[d.XRANGEPLAIN]})\\s+-\\s+(${l[d.XRANGEPLAIN]})\\s*$`),b("HYPHENRANGELOOSE",`^\\s*(${l[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[d.XRANGEPLAINLOOSE]})\\s*$`),b("STAR","(<|>)?=?\\s*\\*"),b("GTE0","^\\s*>=\\s*0.0.0\\s*$"),b("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")}),un=/^[0-9]+$/,bn=(e,n)=>{let u=un.test(e),c=un.test(n);return u&&c&&(e=+e,n=+n),e===n?0:u&&!c?-1:c&&!u?1:e<n?-1:1},vo=(e,n)=>bn(n,e),mo={compareIdentifiers:bn,rcompareIdentifiers:vo},{MAX_LENGTH:cn,MAX_SAFE_INTEGER:St}=kr,{re:fn,t:ln}=Rt,{compareIdentifiers:_t}=mo,ue=class{constructor(e,n){if(n&&typeof n=="object"||(n={loose:!!n,includePrerelease:!1}),e instanceof ue){if(e.loose===!!n.loose&&e.includePrerelease===!!n.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid Version: ${e}`);if(e.length>cn)throw new TypeError(`version is longer than ${cn} characters`);Q("SemVer",e,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let u=e.trim().match(n.loose?fn[ln.LOOSE]:fn[ln.FULL]);if(!u)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+u[1],this.minor=+u[2],this.patch=+u[3],this.major>St||this.major<0)throw new TypeError("Invalid major version");if(this.minor>St||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>St||this.patch<0)throw new TypeError("Invalid patch version");u[4]?this.prerelease=u[4].split(".").map(c=>{if(/^[0-9]+$/.test(c)){let l=+c;if(l>=0&&l<St)return l}return c}):this.prerelease=[],this.build=u[5]?u[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(Q("SemVer.compare",this.version,this.options,e),!(e instanceof ue)){if(typeof e=="string"&&e===this.version)return 0;e=new ue(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof ue||(e=new ue(e,this.options)),_t(this.major,e.major)||_t(this.minor,e.minor)||_t(this.patch,e.patch)}comparePre(e){if(e instanceof ue||(e=new ue(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let n=0;do{let u=this.prerelease[n],c=e.prerelease[n];if(Q("prerelease compare",n,u,c),u===void 0&&c===void 0)return 0;if(c===void 0)return 1;if(u===void 0)return-1;if(u!==c)return _t(u,c)}while(++n)}compareBuild(e){e instanceof ue||(e=new ue(e,this.options));let n=0;do{let u=this.build[n],c=e.build[n];if(Q("prerelease compare",n,u,c),u===void 0&&c===void 0)return 0;if(c===void 0)return 1;if(u===void 0)return-1;if(u!==c)return _t(u,c)}while(++n)}inc(e,n){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",n),this.inc("pre",n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",n),this.inc("pre",n);break;case"major":this.minor===0&&this.patch===0&&this.prerelease.length!==0||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":this.patch===0&&this.prerelease.length!==0||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":if(this.prerelease.length===0)this.prerelease=[0];else{let u=this.prerelease.length;for(;--u>=0;)typeof this.prerelease[u]=="number"&&(this.prerelease[u]++,u=-2);u===-1&&this.prerelease.push(0)}n&&(this.prerelease[0]===n?isNaN(this.prerelease[1])&&(this.prerelease=[n,0]):this.prerelease=[n,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}},po=(e,n,u)=>new ue(e,u).compare(new ue(n,u)),Je=po,go=(e,n,u)=>Je(e,n,u)===0,yo=go,_o=(e,n,u)=>Je(e,n,u)!==0,Eo=_o,Io=(e,n,u)=>Je(e,n,u)>0,bo=Io,wo=(e,n,u)=>Je(e,n,u)>=0,Ro=wo,So=(e,n,u)=>Je(e,n,u)<0,Ao=So,No=(e,n,u)=>Je(e,n,u)<=0,To=No,Oo=(e,n,u,c)=>{switch(n){case"===":return typeof e=="object"&&(e=e.version),typeof u=="object"&&(u=u.version),e===u;case"!==":return typeof e=="object"&&(e=e.version),typeof u=="object"&&(u=u.version),e!==u;case"":case"=":case"==":return yo(e,u,c);case"!=":return Eo(e,u,c);case">":return bo(e,u,c);case">=":return Ro(e,u,c);case"<":return Ao(e,u,c);case"<=":return To(e,u,c);default:throw new TypeError(`Invalid operator: ${n}`)}},Ur=Oo,Et=Symbol("SemVer ANY"),bt=class{static get ANY(){return Et}constructor(e,n){if(n&&typeof n=="object"||(n={loose:!!n,includePrerelease:!1}),e instanceof bt){if(e.loose===!!n.loose)return e;e=e.value}Q("comparator",e,n),this.options=n,this.loose=!!n.loose,this.parse(e),this.semver===Et?this.value="":this.value=this.operator+this.semver.version,Q("comp",this)}parse(e){let n=this.options.loose?dn[hn.COMPARATORLOOSE]:dn[hn.COMPARATOR],u=e.match(n);if(!u)throw new TypeError(`Invalid comparator: ${e}`);this.operator=u[1]!==void 0?u[1]:"",this.operator==="="&&(this.operator=""),u[2]?this.semver=new ue(u[2],this.options.loose):this.semver=Et}toString(){return this.value}test(e){if(Q("Comparator.test",e,this.options.loose),this.semver===Et||e===Et)return!0;if(typeof e=="string")try{e=new ue(e,this.options)}catch(n){return!1}return Ur(e,this.operator,this.semver,this.options)}intersects(e,n){if(!(e instanceof bt))throw new TypeError("a Comparator is required");if(n&&typeof n=="object"||(n={loose:!!n,includePrerelease:!1}),this.operator==="")return this.value===""||new He(e.value,n).test(this.value);if(e.operator==="")return e.value===""||new He(this.value,n).test(e.semver);let u=!(this.operator!==">="&&this.operator!==">"||e.operator!==">="&&e.operator!==">"),c=!(this.operator!=="<="&&this.operator!=="<"||e.operator!=="<="&&e.operator!=="<"),l=this.semver.version===e.semver.version,d=!(this.operator!==">="&&this.operator!=="<="||e.operator!==">="&&e.operator!=="<="),I=Ur(this.semver,"<",e.semver,n)&&(this.operator===">="||this.operator===">")&&(e.operator==="<="||e.operator==="<"),b=Ur(this.semver,">",e.semver,n)&&(this.operator==="<="||this.operator==="<")&&(e.operator===">="||e.operator===">");return u||c||l&&d||I||b}},{re:dn,t:hn}=Rt,He=class{constructor(e,n){if(n&&typeof n=="object"||(n={loose:!!n,includePrerelease:!1}),e instanceof He)return e.loose===!!n.loose&&e.includePrerelease===!!n.includePrerelease?e:new He(e.raw,n);if(e instanceof bt)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map(u=>this.parseRange(u.trim())).filter(u=>u.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){let{loose:n}=this.options;e=e.trim();let u=n?fe[ce.HYPHENRANGELOOSE]:fe[ce.HYPHENRANGE];e=e.replace(u,Go(this.options.includePrerelease)),Q("hyphen replace",e),e=e.replace(fe[ce.COMPARATORTRIM],Mo),Q("comparator trim",e,fe[ce.COMPARATORTRIM]),e=(e=(e=e.replace(fe[ce.TILDETRIM],Lo)).replace(fe[ce.CARETTRIM],Po)).split(/\s+/).join(" ");let c=n?fe[ce.COMPARATORLOOSE]:fe[ce.COMPARATOR];return e.split(" ").map(l=>Co(l,this.options)).join(" ").split(/\s+/).map(l=>ko(l,this.options)).filter(this.options.loose?l=>!!l.match(c):()=>!0).map(l=>new bt(l,this.options))}intersects(e,n){if(!(e instanceof He))throw new TypeError("a Range is required");return this.set.some(u=>vn(u,n)&&e.set.some(c=>vn(c,n)&&u.every(l=>c.every(d=>l.intersects(d,n)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new ue(e,this.options)}catch(n){return!1}for(let n=0;n<this.set.length;n++)if(jo(this.set[n],e,this.options))return!0;return!1}},{re:fe,t:ce,comparatorTrimReplace:Mo,tildeTrimReplace:Lo,caretTrimReplace:Po}=Rt,vn=(e,n)=>{let u=!0,c=e.slice(),l=c.pop();for(;u&&c.length;)u=c.every(d=>l.intersects(d,n)),l=c.pop();return u},Co=(e,n)=>(Q("comp",e,n),e=xo(e,n),Q("caret",e),e=Do(e,n),Q("tildes",e),e=Uo(e,n),Q("xrange",e),e=Wo(e,n),Q("stars",e),e),le=e=>!e||e.toLowerCase()==="x"||e==="*",Do=(e,n)=>e.trim().split(/\s+/).map(u=>$o(u,n)).join(" "),$o=(e,n)=>{let u=n.loose?fe[ce.TILDELOOSE]:fe[ce.TILDE];return e.replace(u,(c,l,d,I,b)=>{let E;return Q("tilde",e,c,l,d,I,b),le(l)?E="":le(d)?E=`>=${l}.0.0 <${+l+1}.0.0-0`:le(I)?E=`>=${l}.${d}.0 <${l}.${+d+1}.0-0`:b?(Q("replaceTilde pr",b),E=`>=${l}.${d}.${I}-${b} <${l}.${+d+1}.0-0`):E=`>=${l}.${d}.${I} <${l}.${+d+1}.0-0`,Q("tilde return",E),E})},xo=(e,n)=>e.trim().split(/\s+/).map(u=>Bo(u,n)).join(" "),Bo=(e,n)=>{Q("caret",e,n);let u=n.loose?fe[ce.CARETLOOSE]:fe[ce.CARET],c=n.includePrerelease?"-0":"";return e.replace(u,(l,d,I,b,E)=>{let R;return Q("caret",e,l,d,I,b,E),le(d)?R="":le(I)?R=`>=${d}.0.0${c} <${+d+1}.0.0-0`:le(b)?R=d==="0"?`>=${d}.${I}.0${c} <${d}.${+I+1}.0-0`:`>=${d}.${I}.0${c} <${+d+1}.0.0-0`:E?(Q("replaceCaret pr",E),R=d==="0"?I==="0"?`>=${d}.${I}.${b}-${E} <${d}.${I}.${+b+1}-0`:`>=${d}.${I}.${b}-${E} <${d}.${+I+1}.0-0`:`>=${d}.${I}.${b}-${E} <${+d+1}.0.0-0`):(Q("no pr"),R=d==="0"?I==="0"?`>=${d}.${I}.${b}${c} <${d}.${I}.${+b+1}-0`:`>=${d}.${I}.${b}${c} <${d}.${+I+1}.0-0`:`>=${d}.${I}.${b} <${+d+1}.0.0-0`),Q("caret return",R),R})},Uo=(e,n)=>(Q("replaceXRanges",e,n),e.split(/\s+/).map(u=>Fo(u,n)).join(" ")),Fo=(e,n)=>{e=e.trim();let u=n.loose?fe[ce.XRANGELOOSE]:fe[ce.XRANGE];return e.replace(u,(c,l,d,I,b,E)=>{Q("xRange",e,c,l,d,I,b,E);let R=le(d),S=R||le(I),O=S||le(b),g=O;return l==="="&&g&&(l=""),E=n.includePrerelease?"-0":"",R?c=l===">"||l==="<"?"<0.0.0-0":"*":l&&g?(S&&(I=0),b=0,l===">"?(l=">=",S?(d=+d+1,I=0,b=0):(I=+I+1,b=0)):l==="<="&&(l="<",S?d=+d+1:I=+I+1),l==="<"&&(E="-0"),c=`${l+d}.${I}.${b}${E}`):S?c=`>=${d}.0.0${E} <${+d+1}.0.0-0`:O&&(c=`>=${d}.${I}.0${E} <${d}.${+I+1}.0-0`),Q("xRange return",c),c})},Wo=(e,n)=>(Q("replaceStars",e,n),e.trim().replace(fe[ce.STAR],"")),ko=(e,n)=>(Q("replaceGTE0",e,n),e.trim().replace(fe[n.includePrerelease?ce.GTE0PRE:ce.GTE0],"")),Go=e=>(n,u,c,l,d,I,b,E,R,S,O,g,A)=>`${u=le(c)?"":le(l)?`>=${c}.0.0${e?"-0":""}`:le(d)?`>=${c}.${l}.0${e?"-0":""}`:I?`>=${u}`:`>=${u}${e?"-0":""}`} ${E=le(R)?"":le(S)?`<${+R+1}.0.0-0`:le(O)?`<${R}.${+S+1}.0-0`:g?`<=${R}.${S}.${O}-${g}`:e?`<${R}.${S}.${+O+1}-0`:`<=${E}`}`.trim(),jo=(e,n,u)=>{for(let c=0;c<e.length;c++)if(!e[c].test(n))return!1;if(n.prerelease.length&&!u.includePrerelease){for(let c=0;c<e.length;c++)if(Q(e[c].semver),e[c].semver!==bt.ANY&&e[c].semver.prerelease.length>0){let l=e[c].semver;if(l.major===n.major&&l.minor===n.minor&&l.patch===n.patch)return!0}return!1}return!0},Yo=(e,n,u)=>{try{n=new He(n,u)}catch(c){return!1}return n.test(e)},{MAX_LENGTH:Ko}=kr,{re:mn,t:pn}=Rt,Vo=(e,n)=>{if(n&&typeof n=="object"||(n={loose:!!n,includePrerelease:!1}),e instanceof ue)return e;if(typeof e!="string"||e.length>Ko||!(n.loose?mn[pn.LOOSE]:mn[pn.FULL]).test(e))return null;try{return new ue(e,n)}catch(u){return null}},Ho=Vo,{re:At,t:Nt}=Rt,zo=(e,n)=>{if(e instanceof ue)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;let u=null;if((n=n||{}).rtl){let c;for(;(c=At[Nt.COERCERTL].exec(e))&&(!u||u.index+u[0].length!==e.length);)u&&c.index+c[0].length===u.index+u[0].length||(u=c),At[Nt.COERCERTL].lastIndex=c.index+c[1].length+c[2].length;At[Nt.COERCERTL].lastIndex=-1}else u=e.match(At[Nt.COERCE]);return u===null?null:Ho(`${u[2]}.${u[3]||"0"}.${u[4]||"0"}`,n)};function qo(e){return String.fromCharCode(parseInt(e.slice(1),16))}function Xo(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}function Jo(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,qo))}function Qo(e){return decodeURIComponent(Array.from(atob(e),Xo).join(""))}function wn(e){return Jo(JSON.stringify(e))}function Zo(e){return JSON.parse(Qo(e))}function It(e){return typeof e=="undefined"}function ei(e){return e===null}function Rn(e){return ei(e)||It(e)}function ti(e){return Rn(e)?!1:!It(e.jsonrpc)&&!It(e.id)&&(!It(e.result)||!It(e.error))}function ri(e){return Rn(e)?!1:typeof e=="number"&&Object.values(Ye).includes(e)}function Fr(e){if(!e)return!0;for(let n in e)if(Object.hasOwnProperty.call(e,n))return!1;return!0}var ne={};function Sn(e,n){return Object.assign(ne,n),e}var ni={"magic-sdk":"magic-sdk","@magic-sdk/react-native":"magic-sdk-rn","@magic-sdk/react-native-bare":"magic-sdk-rn-bare","@magic-sdk/react-native-expo":"magic-sdk-rn-expo"},Se=class extends Error{constructor(e,n){super(`Magic SDK Error: [${e}] ${n}`),this.code=e,this.rawMessage=n,this.__proto__=Error,Object.setPrototypeOf(this,Se.prototype)}},qe=class extends Error{constructor(e){super(),this.__proto__=Error;let n=Number(e==null?void 0:e.code);this.rawMessage=(e==null?void 0:e.message)||"Internal error",this.code=ri(n)?n:Ye.InternalError,this.message=`Magic RPC Error: [${this.code}] ${this.rawMessage}`,this.data=(e==null?void 0:e.data)||void 0,Object.setPrototypeOf(this,qe.prototype)}},Qe=class{constructor(e,n){this.code=e,this.rawMessage=n,this.message=`Magic SDK Warning: [${e}] ${n}`}log(){console.warn(this.message)}},xt=class extends Error{constructor(e,n,u,c){super(`Magic Extension Error (${e.name}): [${n}] ${u}`),this.code=n,this.rawMessage=u,this.data=c,this.__proto__=Error,Object.setPrototypeOf(this,xt.prototype)}},Lt=class{constructor(e,n,u){this.code=n,this.rawMessage=u,this.message=`Magic Extension Warning (${e.name}): [${n}] ${u}`}log(){console.warn(this.message)}};function oi(){return new Se(we.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")}function An(){return new Se(we.ModalNotReady,"Modal is not ready.")}function ii(){return new Se(we.MalformedResponse,"Response from the Magic iframe is malformed.")}function ai(e){return new Se(we.ExtensionNotInitialized,`Extensions must be initialized with a Magic SDK instance before \`Extension.${e}\` can be accessed. Do not invoke \`Extension.${e}\` inside an extension constructor.`)}function si(e){let n=`Some extensions are incompatible with \`${ne.sdkName}@${ne.version}\`:`;return e.filter(u=>typeof u.compat!="undefined"&&u.compat!==null).forEach(u=>{let c=u.compat[ne.sdkName];typeof c=="string"?n+=`
|
2
|
-
- Extension \`${
|
3
|
-
- Extension \`${
|
1
|
+
"use strict";var Magic=(()=>{var Fn=Object.create;var Fe=Object.defineProperty;var Gn=Object.getOwnPropertyDescriptor;var jn=Object.getOwnPropertyNames,Qt=Object.getOwnPropertySymbols,Kn=Object.getPrototypeOf,er=Object.prototype.hasOwnProperty,qn=Object.prototype.propertyIsEnumerable;var Zt=(e,t,n)=>t in e?Fe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tr=(e,t)=>{for(var n in t||(t={}))er.call(t,n)&&Zt(e,n,t[n]);if(Qt)for(var n of Qt(t))qn.call(t,n)&&Zt(e,n,t[n]);return e};var Ge=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,n)=>(typeof require!="undefined"?require:t)[n]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var rr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),nr=(e,t)=>{for(var n in t)Fe(e,n,{get:t[n],enumerable:!0})},ir=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of jn(t))!er.call(e,s)&&s!==n&&Fe(e,s,{get:()=>t[s],enumerable:!(o=Gn(t,s))||o.enumerable});return e};var or=(e,t,n)=>(n=e!=null?Fn(Kn(e)):{},ir(t||!e||!e.__esModule?Fe(n,"default",{value:e,enumerable:!0}):n,e)),Vn=e=>ir(Fe({},"__esModule",{value:!0}),e);var Me=(e,t,n)=>new Promise((o,s)=>{var c=v=>{try{p(n.next(v))}catch(g){s(g)}},m=v=>{try{p(n.throw(v))}catch(g){s(g)}},p=v=>v.done?o(v.value):Promise.resolve(v.value).then(c,m);p((n=n.apply(e,t)).next())});var jr=rr((Gr,Lt)=>{(function(e){if(typeof Gr=="object"&&typeof Lt<"u")Lt.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t;typeof window<"u"?t=window:typeof global<"u"?t=global:typeof self<"u"?t=self:t=this,t.localforage=e()}})(function(){var e,t,n;return function o(s,c,m){function p(y,N){if(!c[y]){if(!s[y]){var I=typeof Ge=="function"&&Ge;if(!N&&I)return I(y,!0);if(v)return v(y,!0);var M=new Error("Cannot find module '"+y+"'");throw M.code="MODULE_NOT_FOUND",M}var C=c[y]={exports:{}};s[y][0].call(C.exports,function(k){var O=s[y][1][k];return p(O||k)},C,C.exports,o,s,c,m)}return c[y].exports}for(var v=typeof Ge=="function"&&Ge,g=0;g<m.length;g++)p(m[g]);return p}({1:[function(o,s,c){(function(m){"use strict";var p=m.MutationObserver||m.WebKitMutationObserver,v;if(p){var g=0,y=new p(k),N=m.document.createTextNode("");y.observe(N,{characterData:!0}),v=function(){N.data=g=++g%2}}else if(!m.setImmediate&&typeof m.MessageChannel<"u"){var I=new m.MessageChannel;I.port1.onmessage=k,v=function(){I.port2.postMessage(0)}}else"document"in m&&"onreadystatechange"in m.document.createElement("script")?v=function(){var W=m.document.createElement("script");W.onreadystatechange=function(){k(),W.onreadystatechange=null,W.parentNode.removeChild(W),W=null},m.document.documentElement.appendChild(W)}:v=function(){setTimeout(k,0)};var M,C=[];function k(){M=!0;for(var W,J,D=C.length;D;){for(J=C,C=[],W=-1;++W<D;)J[W]();D=C.length}M=!1}s.exports=O;function O(W){C.push(W)===1&&!M&&v()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(o,s,c){"use strict";var m=o(1);function p(){}var v={},g=["REJECTED"],y=["FULFILLED"],N=["PENDING"];s.exports=I;function I(S){if(typeof S!="function")throw new TypeError("resolver must be a function");this.state=N,this.queue=[],this.outcome=void 0,S!==p&&O(this,S)}I.prototype.catch=function(S){return this.then(null,S)},I.prototype.then=function(S,F){if(typeof S!="function"&&this.state===y||typeof F!="function"&&this.state===g)return this;var U=new this.constructor(p);if(this.state!==N){var q=this.state===y?S:F;C(U,q,this.outcome)}else this.queue.push(new M(U,S,F));return U};function M(S,F,U){this.promise=S,typeof F=="function"&&(this.onFulfilled=F,this.callFulfilled=this.otherCallFulfilled),typeof U=="function"&&(this.onRejected=U,this.callRejected=this.otherCallRejected)}M.prototype.callFulfilled=function(S){v.resolve(this.promise,S)},M.prototype.otherCallFulfilled=function(S){C(this.promise,this.onFulfilled,S)},M.prototype.callRejected=function(S){v.reject(this.promise,S)},M.prototype.otherCallRejected=function(S){C(this.promise,this.onRejected,S)};function C(S,F,U){m(function(){var q;try{q=F(U)}catch(Q){return v.reject(S,Q)}q===S?v.reject(S,new TypeError("Cannot resolve promise with itself")):v.resolve(S,q)})}v.resolve=function(S,F){var U=W(k,F);if(U.status==="error")return v.reject(S,U.value);var q=U.value;if(q)O(S,q);else{S.state=y,S.outcome=F;for(var Q=-1,ie=S.queue.length;++Q<ie;)S.queue[Q].callFulfilled(F)}return S},v.reject=function(S,F){S.state=g,S.outcome=F;for(var U=-1,q=S.queue.length;++U<q;)S.queue[U].callRejected(F);return S};function k(S){var F=S&&S.then;if(S&&(typeof S=="object"||typeof S=="function")&&typeof F=="function")return function(){F.apply(S,arguments)}}function O(S,F){var U=!1;function q(le){U||(U=!0,v.reject(S,le))}function Q(le){U||(U=!0,v.resolve(S,le))}function ie(){F(Q,q)}var se=W(ie);se.status==="error"&&q(se.value)}function W(S,F){var U={};try{U.value=S(F),U.status="success"}catch(q){U.status="error",U.value=q}return U}I.resolve=J;function J(S){return S instanceof this?S:v.resolve(new this(p),S)}I.reject=D;function D(S){var F=new this(p);return v.reject(F,S)}I.all=me;function me(S){var F=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var U=S.length,q=!1;if(!U)return this.resolve([]);for(var Q=new Array(U),ie=0,se=-1,le=new this(p);++se<U;)fe(S[se],se);return le;function fe(_e,d){F.resolve(_e).then(_,function(A){q||(q=!0,v.reject(le,A))});function _(A){Q[d]=A,++ie===U&&!q&&(q=!0,v.resolve(le,Q))}}}I.race=ne;function ne(S){var F=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var U=S.length,q=!1;if(!U)return this.resolve([]);for(var Q=-1,ie=new this(p);++Q<U;)se(S[Q]);return ie;function se(le){F.resolve(le).then(function(fe){q||(q=!0,v.resolve(ie,fe))},function(fe){q||(q=!0,v.reject(ie,fe))})}}},{1:1}],3:[function(o,s,c){(function(m){"use strict";typeof m.Promise!="function"&&(m.Promise=o(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(o,s,c){"use strict";var m=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r};function p(r,a){if(!(r instanceof a))throw new TypeError("Cannot call a class as a function")}function v(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var g=v();function y(){try{if(!g||!g.open)return!1;var r=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),a=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!r||a)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function N(r,a){r=r||[],a=a||{};try{return new Blob(r,a)}catch(l){if(l.name!=="TypeError")throw l;for(var i=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,u=new i,f=0;f<r.length;f+=1)u.append(r[f]);return u.getBlob(a.type)}}typeof Promise>"u"&&o(3);var I=Promise;function M(r,a){a&&r.then(function(i){a(null,i)},function(i){a(i)})}function C(r,a,i){typeof a=="function"&&r.then(a),typeof i=="function"&&r.catch(i)}function k(r){return typeof r!="string"&&(console.warn(r+" used as a key, but it is not a string."),r=String(r)),r}function O(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var W="local-forage-detect-blob-support",J=void 0,D={},me=Object.prototype.toString,ne="readonly",S="readwrite";function F(r){for(var a=r.length,i=new ArrayBuffer(a),u=new Uint8Array(i),f=0;f<a;f++)u[f]=r.charCodeAt(f);return i}function U(r){return new I(function(a){var i=r.transaction(W,S),u=N([""]);i.objectStore(W).put(u,"key"),i.onabort=function(f){f.preventDefault(),f.stopPropagation(),a(!1)},i.oncomplete=function(){var f=navigator.userAgent.match(/Chrome\/(\d+)/),l=navigator.userAgent.match(/Edge\//);a(l||!f||parseInt(f[1],10)>=43)}}).catch(function(){return!1})}function q(r){return typeof J=="boolean"?I.resolve(J):U(r).then(function(a){return J=a,J})}function Q(r){var a=D[r.name],i={};i.promise=new I(function(u,f){i.resolve=u,i.reject=f}),a.deferredOperations.push(i),a.dbReady?a.dbReady=a.dbReady.then(function(){return i.promise}):a.dbReady=i.promise}function ie(r){var a=D[r.name],i=a.deferredOperations.pop();if(i)return i.resolve(),i.promise}function se(r,a){var i=D[r.name],u=i.deferredOperations.pop();if(u)return u.reject(a),u.promise}function le(r,a){return new I(function(i,u){if(D[r.name]=D[r.name]||Z(),r.db)if(a)Q(r),r.db.close();else return i(r.db);var f=[r.name];a&&f.push(r.version);var l=g.open.apply(g,f);a&&(l.onupgradeneeded=function(h){var E=l.result;try{E.createObjectStore(r.storeName),h.oldVersion<=1&&E.createObjectStore(W)}catch(b){if(b.name==="ConstraintError")console.warn('The database "'+r.name+'" has been upgraded from version '+h.oldVersion+" to version "+h.newVersion+', but the storage "'+r.storeName+'" already exists.');else throw b}}),l.onerror=function(h){h.preventDefault(),u(l.error)},l.onsuccess=function(){var h=l.result;h.onversionchange=function(E){E.target.close()},i(h),ie(r)}})}function fe(r){return le(r,!1)}function _e(r){return le(r,!0)}function d(r,a){if(!r.db)return!0;var i=!r.db.objectStoreNames.contains(r.storeName),u=r.version<r.db.version,f=r.version>r.db.version;if(u&&(r.version!==a&&console.warn('The database "'+r.name+`" can't be downgraded from version `+r.db.version+" to version "+r.version+"."),r.version=r.db.version),f||i){if(i){var l=r.db.version+1;l>r.version&&(r.version=l)}return!0}return!1}function _(r){return new I(function(a,i){var u=new FileReader;u.onerror=i,u.onloadend=function(f){var l=btoa(f.target.result||"");a({__local_forage_encoded_blob:!0,data:l,type:r.type})},u.readAsBinaryString(r)})}function A(r){var a=F(atob(r.data));return N([a],{type:r.type})}function L(r){return r&&r.__local_forage_encoded_blob}function P(r){var a=this,i=a._initReady().then(function(){var u=D[a._dbInfo.name];if(u&&u.dbReady)return u.dbReady});return C(i,r,r),i}function x(r){Q(r);for(var a=D[r.name],i=a.forages,u=0;u<i.length;u++){var f=i[u];f._dbInfo.db&&(f._dbInfo.db.close(),f._dbInfo.db=null)}return r.db=null,fe(r).then(function(l){return r.db=l,d(r)?_e(r):l}).then(function(l){r.db=a.db=l;for(var h=0;h<i.length;h++)i[h]._dbInfo.db=l}).catch(function(l){throw se(r,l),l})}function G(r,a,i,u){u===void 0&&(u=1);try{var f=r.db.transaction(r.storeName,a);i(null,f)}catch(l){if(u>0&&(!r.db||l.name==="InvalidStateError"||l.name==="NotFoundError"))return I.resolve().then(function(){if(!r.db||l.name==="NotFoundError"&&!r.db.objectStoreNames.contains(r.storeName)&&r.version<=r.db.version)return r.db&&(r.version=r.db.version+1),_e(r)}).then(function(){return x(r).then(function(){G(r,a,i,u-1)})}).catch(i);i(l)}}function Z(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Se(r){var a=this,i={db:null};if(r)for(var u in r)i[u]=r[u];var f=D[i.name];f||(f=Z(),D[i.name]=f),f.forages.push(a),a._initReady||(a._initReady=a.ready,a.ready=P);var l=[];function h(){return I.resolve()}for(var E=0;E<f.forages.length;E++){var b=f.forages[E];b!==a&&l.push(b._initReady().catch(h))}var w=f.forages.slice(0);return I.all(l).then(function(){return i.db=f.db,fe(i)}).then(function(R){return i.db=R,d(i,a._defaultConfig.version)?_e(i):R}).then(function(R){i.db=f.db=R,a._dbInfo=i;for(var T=0;T<w.length;T++){var B=w[T];B!==a&&(B._dbInfo.db=i.db,B._dbInfo.version=i.version)}})}function Ie(r,a){var i=this;r=k(r);var u=new I(function(f,l){i.ready().then(function(){G(i._dbInfo,ne,function(h,E){if(h)return l(h);try{var b=E.objectStore(i._dbInfo.storeName),w=b.get(r);w.onsuccess=function(){var R=w.result;R===void 0&&(R=null),L(R)&&(R=A(R)),f(R)},w.onerror=function(){l(w.error)}}catch(R){l(R)}})}).catch(l)});return M(u,a),u}function ke(r,a){var i=this,u=new I(function(f,l){i.ready().then(function(){G(i._dbInfo,ne,function(h,E){if(h)return l(h);try{var b=E.objectStore(i._dbInfo.storeName),w=b.openCursor(),R=1;w.onsuccess=function(){var T=w.result;if(T){var B=T.value;L(B)&&(B=A(B));var j=r(B,T.key,R++);j!==void 0?f(j):T.continue()}else f()},w.onerror=function(){l(w.error)}}catch(T){l(T)}})}).catch(l)});return M(u,a),u}function Vr(r,a,i){var u=this;r=k(r);var f=new I(function(l,h){var E;u.ready().then(function(){return E=u._dbInfo,me.call(a)==="[object Blob]"?q(E.db).then(function(b){return b?a:_(a)}):a}).then(function(b){G(u._dbInfo,S,function(w,R){if(w)return h(w);try{var T=R.objectStore(u._dbInfo.storeName);b===null&&(b=void 0);var B=T.put(b,r);R.oncomplete=function(){b===void 0&&(b=null),l(b)},R.onabort=R.onerror=function(){var j=B.error?B.error:B.transaction.error;h(j)}}catch(j){h(j)}})}).catch(h)});return M(f,i),f}function Yr(r,a){var i=this;r=k(r);var u=new I(function(f,l){i.ready().then(function(){G(i._dbInfo,S,function(h,E){if(h)return l(h);try{var b=E.objectStore(i._dbInfo.storeName),w=b.delete(r);E.oncomplete=function(){f()},E.onerror=function(){l(w.error)},E.onabort=function(){var R=w.error?w.error:w.transaction.error;l(R)}}catch(R){l(R)}})}).catch(l)});return M(u,a),u}function Hr(r){var a=this,i=new I(function(u,f){a.ready().then(function(){G(a._dbInfo,S,function(l,h){if(l)return f(l);try{var E=h.objectStore(a._dbInfo.storeName),b=E.clear();h.oncomplete=function(){u()},h.onabort=h.onerror=function(){var w=b.error?b.error:b.transaction.error;f(w)}}catch(w){f(w)}})}).catch(f)});return M(i,r),i}function Xr(r){var a=this,i=new I(function(u,f){a.ready().then(function(){G(a._dbInfo,ne,function(l,h){if(l)return f(l);try{var E=h.objectStore(a._dbInfo.storeName),b=E.count();b.onsuccess=function(){u(b.result)},b.onerror=function(){f(b.error)}}catch(w){f(w)}})}).catch(f)});return M(i,r),i}function zr(r,a){var i=this,u=new I(function(f,l){if(r<0){f(null);return}i.ready().then(function(){G(i._dbInfo,ne,function(h,E){if(h)return l(h);try{var b=E.objectStore(i._dbInfo.storeName),w=!1,R=b.openKeyCursor();R.onsuccess=function(){var T=R.result;if(!T){f(null);return}r===0||w?f(T.key):(w=!0,T.advance(r))},R.onerror=function(){l(R.error)}}catch(T){l(T)}})}).catch(l)});return M(u,a),u}function Jr(r){var a=this,i=new I(function(u,f){a.ready().then(function(){G(a._dbInfo,ne,function(l,h){if(l)return f(l);try{var E=h.objectStore(a._dbInfo.storeName),b=E.openKeyCursor(),w=[];b.onsuccess=function(){var R=b.result;if(!R){u(w);return}w.push(R.key),R.continue()},b.onerror=function(){f(b.error)}}catch(R){f(R)}})}).catch(f)});return M(i,r),i}function Qr(r,a){a=O.apply(this,arguments);var i=this.config();r=typeof r!="function"&&r||{},r.name||(r.name=r.name||i.name,r.storeName=r.storeName||i.storeName);var u=this,f;if(!r.name)f=I.reject("Invalid arguments");else{var l=r.name===i.name&&u._dbInfo.db,h=l?I.resolve(u._dbInfo.db):fe(r).then(function(E){var b=D[r.name],w=b.forages;b.db=E;for(var R=0;R<w.length;R++)w[R]._dbInfo.db=E;return E});r.storeName?f=h.then(function(E){if(!!E.objectStoreNames.contains(r.storeName)){var b=E.version+1;Q(r);var w=D[r.name],R=w.forages;E.close();for(var T=0;T<R.length;T++){var B=R[T];B._dbInfo.db=null,B._dbInfo.version=b}var j=new I(function(V,z){var X=g.open(r.name,b);X.onerror=function(ue){var We=X.result;We.close(),z(ue)},X.onupgradeneeded=function(){var ue=X.result;ue.deleteObjectStore(r.storeName)},X.onsuccess=function(){var ue=X.result;ue.close(),V(ue)}});return j.then(function(V){w.db=V;for(var z=0;z<R.length;z++){var X=R[z];X._dbInfo.db=V,ie(X._dbInfo)}}).catch(function(V){throw(se(r,V)||I.resolve()).catch(function(){}),V})}}):f=h.then(function(E){Q(r);var b=D[r.name],w=b.forages;E.close();for(var R=0;R<w.length;R++){var T=w[R];T._dbInfo.db=null}var B=new I(function(j,V){var z=g.deleteDatabase(r.name);z.onerror=function(){var X=z.result;X&&X.close(),V(z.error)},z.onblocked=function(){console.warn('dropInstance blocked for database "'+r.name+'" until all open connections are closed')},z.onsuccess=function(){var X=z.result;X&&X.close(),j(X)}});return B.then(function(j){b.db=j;for(var V=0;V<w.length;V++){var z=w[V];ie(z._dbInfo)}}).catch(function(j){throw(se(r,j)||I.resolve()).catch(function(){}),j})})}return M(f,a),f}var Zr={_driver:"asyncStorage",_initStorage:Se,_support:y(),iterate:ke,getItem:Ie,setItem:Vr,removeItem:Yr,clear:Hr,length:Xr,key:zr,keys:Jr,dropInstance:Qr};function en(){return typeof openDatabase=="function"}var ve="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",tn="~~local_forage_type~",Ct=/^~~local_forage_type~([^~]+)~/,ze="__lfsc__:",dt=ze.length,ht="arbf",pt="blob",$t="si08",Dt="ui08",xt="uic8",Ut="si16",kt="si32",Bt="ur16",Wt="ui32",Ft="fl32",Gt="fl64",jt=dt+ht.length,Kt=Object.prototype.toString;function qt(r){var a=r.length*.75,i=r.length,u,f=0,l,h,E,b;r[r.length-1]==="="&&(a--,r[r.length-2]==="="&&a--);var w=new ArrayBuffer(a),R=new Uint8Array(w);for(u=0;u<i;u+=4)l=ve.indexOf(r[u]),h=ve.indexOf(r[u+1]),E=ve.indexOf(r[u+2]),b=ve.indexOf(r[u+3]),R[f++]=l<<2|h>>4,R[f++]=(h&15)<<4|E>>2,R[f++]=(E&3)<<6|b&63;return w}function mt(r){var a=new Uint8Array(r),i="",u;for(u=0;u<a.length;u+=3)i+=ve[a[u]>>2],i+=ve[(a[u]&3)<<4|a[u+1]>>4],i+=ve[(a[u+1]&15)<<2|a[u+2]>>6],i+=ve[a[u+2]&63];return a.length%3===2?i=i.substring(0,i.length-1)+"=":a.length%3===1&&(i=i.substring(0,i.length-2)+"=="),i}function rn(r,a){var i="";if(r&&(i=Kt.call(r)),r&&(i==="[object ArrayBuffer]"||r.buffer&&Kt.call(r.buffer)==="[object ArrayBuffer]")){var u,f=ze;r instanceof ArrayBuffer?(u=r,f+=ht):(u=r.buffer,i==="[object Int8Array]"?f+=$t:i==="[object Uint8Array]"?f+=Dt:i==="[object Uint8ClampedArray]"?f+=xt:i==="[object Int16Array]"?f+=Ut:i==="[object Uint16Array]"?f+=Bt:i==="[object Int32Array]"?f+=kt:i==="[object Uint32Array]"?f+=Wt:i==="[object Float32Array]"?f+=Ft:i==="[object Float64Array]"?f+=Gt:a(new Error("Failed to get type for BinaryArray"))),a(f+mt(u))}else if(i==="[object Blob]"){var l=new FileReader;l.onload=function(){var h=tn+r.type+"~"+mt(this.result);a(ze+pt+h)},l.readAsArrayBuffer(r)}else try{a(JSON.stringify(r))}catch(h){console.error("Couldn't convert value into a JSON string: ",r),a(null,h)}}function nn(r){if(r.substring(0,dt)!==ze)return JSON.parse(r);var a=r.substring(jt),i=r.substring(dt,jt),u;if(i===pt&&Ct.test(a)){var f=a.match(Ct);u=f[1],a=a.substring(f[0].length)}var l=qt(a);switch(i){case ht:return l;case pt:return N([l],{type:u});case $t:return new Int8Array(l);case Dt:return new Uint8Array(l);case xt:return new Uint8ClampedArray(l);case Ut:return new Int16Array(l);case Bt:return new Uint16Array(l);case kt:return new Int32Array(l);case Wt:return new Uint32Array(l);case Ft:return new Float32Array(l);case Gt:return new Float64Array(l);default:throw new Error("Unkown type: "+i)}}var vt={serialize:rn,deserialize:nn,stringToBuffer:qt,bufferToString:mt};function Vt(r,a,i,u){r.executeSql("CREATE TABLE IF NOT EXISTS "+a.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],i,u)}function on(r){var a=this,i={db:null};if(r)for(var u in r)i[u]=typeof r[u]!="string"?r[u].toString():r[u];var f=new I(function(l,h){try{i.db=openDatabase(i.name,String(i.version),i.description,i.size)}catch(E){return h(E)}i.db.transaction(function(E){Vt(E,i,function(){a._dbInfo=i,l()},function(b,w){h(w)})},h)});return i.serializer=vt,f}function ge(r,a,i,u,f,l){r.executeSql(i,u,f,function(h,E){E.code===E.SYNTAX_ERR?h.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[a.storeName],function(b,w){w.rows.length?l(b,E):Vt(b,a,function(){b.executeSql(i,u,f,l)},l)},l):l(h,E)},l)}function an(r,a){var i=this;r=k(r);var u=new I(function(f,l){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(E){ge(E,h,"SELECT * FROM "+h.storeName+" WHERE key = ? LIMIT 1",[r],function(b,w){var R=w.rows.length?w.rows.item(0).value:null;R&&(R=h.serializer.deserialize(R)),f(R)},function(b,w){l(w)})})}).catch(l)});return M(u,a),u}function sn(r,a){var i=this,u=new I(function(f,l){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(E){ge(E,h,"SELECT * FROM "+h.storeName,[],function(b,w){for(var R=w.rows,T=R.length,B=0;B<T;B++){var j=R.item(B),V=j.value;if(V&&(V=h.serializer.deserialize(V)),V=r(V,j.key,B+1),V!==void 0){f(V);return}}f()},function(b,w){l(w)})})}).catch(l)});return M(u,a),u}function Yt(r,a,i,u){var f=this;r=k(r);var l=new I(function(h,E){f.ready().then(function(){a===void 0&&(a=null);var b=a,w=f._dbInfo;w.serializer.serialize(a,function(R,T){T?E(T):w.db.transaction(function(B){ge(B,w,"INSERT OR REPLACE INTO "+w.storeName+" (key, value) VALUES (?, ?)",[r,R],function(){h(b)},function(j,V){E(V)})},function(B){if(B.code===B.QUOTA_ERR){if(u>0){h(Yt.apply(f,[r,b,i,u-1]));return}E(B)}})})}).catch(E)});return M(l,i),l}function ln(r,a,i){return Yt.apply(this,[r,a,i,1])}function cn(r,a){var i=this;r=k(r);var u=new I(function(f,l){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(E){ge(E,h,"DELETE FROM "+h.storeName+" WHERE key = ?",[r],function(){f()},function(b,w){l(w)})})}).catch(l)});return M(u,a),u}function un(r){var a=this,i=new I(function(u,f){a.ready().then(function(){var l=a._dbInfo;l.db.transaction(function(h){ge(h,l,"DELETE FROM "+l.storeName,[],function(){u()},function(E,b){f(b)})})}).catch(f)});return M(i,r),i}function fn(r){var a=this,i=new I(function(u,f){a.ready().then(function(){var l=a._dbInfo;l.db.transaction(function(h){ge(h,l,"SELECT COUNT(key) as c FROM "+l.storeName,[],function(E,b){var w=b.rows.item(0).c;u(w)},function(E,b){f(b)})})}).catch(f)});return M(i,r),i}function dn(r,a){var i=this,u=new I(function(f,l){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(E){ge(E,h,"SELECT key FROM "+h.storeName+" WHERE id = ? LIMIT 1",[r+1],function(b,w){var R=w.rows.length?w.rows.item(0).key:null;f(R)},function(b,w){l(w)})})}).catch(l)});return M(u,a),u}function hn(r){var a=this,i=new I(function(u,f){a.ready().then(function(){var l=a._dbInfo;l.db.transaction(function(h){ge(h,l,"SELECT key FROM "+l.storeName,[],function(E,b){for(var w=[],R=0;R<b.rows.length;R++)w.push(b.rows.item(R).key);u(w)},function(E,b){f(b)})})}).catch(f)});return M(i,r),i}function pn(r){return new I(function(a,i){r.transaction(function(u){u.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(f,l){for(var h=[],E=0;E<l.rows.length;E++)h.push(l.rows.item(E).name);a({db:r,storeNames:h})},function(f,l){i(l)})},function(u){i(u)})})}function mn(r,a){a=O.apply(this,arguments);var i=this.config();r=typeof r!="function"&&r||{},r.name||(r.name=r.name||i.name,r.storeName=r.storeName||i.storeName);var u=this,f;return r.name?f=new I(function(l){var h;r.name===i.name?h=u._dbInfo.db:h=openDatabase(r.name,"","",0),r.storeName?l({db:h,storeNames:[r.storeName]}):l(pn(h))}).then(function(l){return new I(function(h,E){l.db.transaction(function(b){function w(j){return new I(function(V,z){b.executeSql("DROP TABLE IF EXISTS "+j,[],function(){V()},function(X,ue){z(ue)})})}for(var R=[],T=0,B=l.storeNames.length;T<B;T++)R.push(w(l.storeNames[T]));I.all(R).then(function(){h()}).catch(function(j){E(j)})},function(b){E(b)})})}):f=I.reject("Invalid arguments"),M(f,a),f}var vn={_driver:"webSQLStorage",_initStorage:on,_support:en(),iterate:sn,getItem:an,setItem:ln,removeItem:cn,clear:un,length:fn,key:dn,keys:hn,dropInstance:mn};function gn(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Ht(r,a){var i=r.name+"/";return r.storeName!==a.storeName&&(i+=r.storeName+"/"),i}function yn(){var r="_localforage_support_test";try{return localStorage.setItem(r,!0),localStorage.removeItem(r),!1}catch{return!0}}function En(){return!yn()||localStorage.length>0}function _n(r){var a=this,i={};if(r)for(var u in r)i[u]=r[u];return i.keyPrefix=Ht(r,a._defaultConfig),En()?(a._dbInfo=i,i.serializer=vt,I.resolve()):I.reject()}function In(r){var a=this,i=a.ready().then(function(){for(var u=a._dbInfo.keyPrefix,f=localStorage.length-1;f>=0;f--){var l=localStorage.key(f);l.indexOf(u)===0&&localStorage.removeItem(l)}});return M(i,r),i}function bn(r,a){var i=this;r=k(r);var u=i.ready().then(function(){var f=i._dbInfo,l=localStorage.getItem(f.keyPrefix+r);return l&&(l=f.serializer.deserialize(l)),l});return M(u,a),u}function wn(r,a){var i=this,u=i.ready().then(function(){for(var f=i._dbInfo,l=f.keyPrefix,h=l.length,E=localStorage.length,b=1,w=0;w<E;w++){var R=localStorage.key(w);if(R.indexOf(l)===0){var T=localStorage.getItem(R);if(T&&(T=f.serializer.deserialize(T)),T=r(T,R.substring(h),b++),T!==void 0)return T}}});return M(u,a),u}function Rn(r,a){var i=this,u=i.ready().then(function(){var f=i._dbInfo,l;try{l=localStorage.key(r)}catch{l=null}return l&&(l=l.substring(f.keyPrefix.length)),l});return M(u,a),u}function An(r){var a=this,i=a.ready().then(function(){for(var u=a._dbInfo,f=localStorage.length,l=[],h=0;h<f;h++){var E=localStorage.key(h);E.indexOf(u.keyPrefix)===0&&l.push(E.substring(u.keyPrefix.length))}return l});return M(i,r),i}function Sn(r){var a=this,i=a.keys().then(function(u){return u.length});return M(i,r),i}function Nn(r,a){var i=this;r=k(r);var u=i.ready().then(function(){var f=i._dbInfo;localStorage.removeItem(f.keyPrefix+r)});return M(u,a),u}function Mn(r,a,i){var u=this;r=k(r);var f=u.ready().then(function(){a===void 0&&(a=null);var l=a;return new I(function(h,E){var b=u._dbInfo;b.serializer.serialize(a,function(w,R){if(R)E(R);else try{localStorage.setItem(b.keyPrefix+r,w),h(l)}catch(T){(T.name==="QuotaExceededError"||T.name==="NS_ERROR_DOM_QUOTA_REACHED")&&E(T),E(T)}})})});return M(f,i),f}function Tn(r,a){if(a=O.apply(this,arguments),r=typeof r!="function"&&r||{},!r.name){var i=this.config();r.name=r.name||i.name,r.storeName=r.storeName||i.storeName}var u=this,f;return r.name?f=new I(function(l){r.storeName?l(Ht(r,u._defaultConfig)):l(r.name+"/")}).then(function(l){for(var h=localStorage.length-1;h>=0;h--){var E=localStorage.key(h);E.indexOf(l)===0&&localStorage.removeItem(E)}}):f=I.reject("Invalid arguments"),M(f,a),f}var On={_driver:"localStorageWrapper",_initStorage:_n,_support:gn(),iterate:wn,getItem:bn,setItem:Mn,removeItem:Nn,clear:In,length:Sn,key:Rn,keys:An,dropInstance:Tn},Ln=function(a,i){return a===i||typeof a=="number"&&typeof i=="number"&&isNaN(a)&&isNaN(i)},Pn=function(a,i){for(var u=a.length,f=0;f<u;){if(Ln(a[f],i))return!0;f++}return!1},Xt=Array.isArray||function(r){return Object.prototype.toString.call(r)==="[object Array]"},Be={},zt={},Ne={INDEXEDDB:Zr,WEBSQL:vn,LOCALSTORAGE:On},Cn=[Ne.INDEXEDDB._driver,Ne.WEBSQL._driver,Ne.LOCALSTORAGE._driver],Je=["dropInstance"],gt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Je),$n={description:"",driver:Cn.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Dn(r,a){r[a]=function(){var i=arguments;return r.ready().then(function(){return r[a].apply(r,i)})}}function yt(){for(var r=1;r<arguments.length;r++){var a=arguments[r];if(a)for(var i in a)a.hasOwnProperty(i)&&(Xt(a[i])?arguments[0][i]=a[i].slice():arguments[0][i]=a[i])}return arguments[0]}var xn=function(){function r(a){p(this,r);for(var i in Ne)if(Ne.hasOwnProperty(i)){var u=Ne[i],f=u._driver;this[i]=f,Be[f]||this.defineDriver(u)}this._defaultConfig=yt({},$n),this._config=yt({},this._defaultConfig,a),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return r.prototype.config=function(i){if((typeof i>"u"?"undefined":m(i))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var u in i){if(u==="storeName"&&(i[u]=i[u].replace(/\W/g,"_")),u==="version"&&typeof i[u]!="number")return new Error("Database version must be a number.");this._config[u]=i[u]}return"driver"in i&&i.driver?this.setDriver(this._config.driver):!0}else return typeof i=="string"?this._config[i]:this._config},r.prototype.defineDriver=function(i,u,f){var l=new I(function(h,E){try{var b=i._driver,w=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!i._driver){E(w);return}for(var R=gt.concat("_initStorage"),T=0,B=R.length;T<B;T++){var j=R[T],V=!Pn(Je,j);if((V||i[j])&&typeof i[j]!="function"){E(w);return}}var z=function(){for(var We=function(Bn){return function(){var Wn=new Error("Method "+Bn+" is not implemented by the current driver"),Jt=I.reject(Wn);return M(Jt,arguments[arguments.length-1]),Jt}},Et=0,kn=Je.length;Et<kn;Et++){var _t=Je[Et];i[_t]||(i[_t]=We(_t))}};z();var X=function(We){Be[b]&&console.info("Redefining LocalForage driver: "+b),Be[b]=i,zt[b]=We,h()};"_support"in i?i._support&&typeof i._support=="function"?i._support().then(X,E):X(!!i._support):X(!0)}catch(ue){E(ue)}});return C(l,u,f),l},r.prototype.driver=function(){return this._driver||null},r.prototype.getDriver=function(i,u,f){var l=Be[i]?I.resolve(Be[i]):I.reject(new Error("Driver not found."));return C(l,u,f),l},r.prototype.getSerializer=function(i){var u=I.resolve(vt);return C(u,i),u},r.prototype.ready=function(i){var u=this,f=u._driverSet.then(function(){return u._ready===null&&(u._ready=u._initDriver()),u._ready});return C(f,i,i),f},r.prototype.setDriver=function(i,u,f){var l=this;Xt(i)||(i=[i]);var h=this._getSupportedDrivers(i);function E(){l._config.driver=l.driver()}function b(T){return l._extend(T),E(),l._ready=l._initStorage(l._config),l._ready}function w(T){return function(){var B=0;function j(){for(;B<T.length;){var V=T[B];return B++,l._dbInfo=null,l._ready=null,l.getDriver(V).then(b).catch(j)}E();var z=new Error("No available storage method found.");return l._driverSet=I.reject(z),l._driverSet}return j()}}var R=this._driverSet!==null?this._driverSet.catch(function(){return I.resolve()}):I.resolve();return this._driverSet=R.then(function(){var T=h[0];return l._dbInfo=null,l._ready=null,l.getDriver(T).then(function(B){l._driver=B._driver,E(),l._wrapLibraryMethodsWithReady(),l._initDriver=w(h)})}).catch(function(){E();var T=new Error("No available storage method found.");return l._driverSet=I.reject(T),l._driverSet}),C(this._driverSet,u,f),this._driverSet},r.prototype.supports=function(i){return!!zt[i]},r.prototype._extend=function(i){yt(this,i)},r.prototype._getSupportedDrivers=function(i){for(var u=[],f=0,l=i.length;f<l;f++){var h=i[f];this.supports(h)&&u.push(h)}return u},r.prototype._wrapLibraryMethodsWithReady=function(){for(var i=0,u=gt.length;i<u;i++)Dn(this,gt[i])},r.prototype.createInstance=function(i){return new r(i)},r}(),Un=new xn;s.exports=Un},{3:3}]},{},[4])(4)})});var qr=rr((ct,Kr)=>{(function(e,t){typeof ct=="object"&&typeof Kr<"u"?t(ct):typeof define=="function"&&define.amd?define("localforage-driver-memory",["exports"],t):t(e.LocalforageDriverMemory={})})(typeof self<"u"?self:ct,function(e){"use strict";var t="localforage-driver-memory";function n(d){var _=typeof Symbol=="function"&&d[Symbol.iterator],A=0;return _?_.call(d):{next:function(){return d&&A>=d.length&&(d=void 0),{value:d&&d[A++],done:!d}}}}function o(d,_){d=d||[],_=_||{};try{return new Blob(d,_)}catch(x){if(x.name!=="TypeError")throw x;for(var A=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,L=new A,P=0;P<d.length;P+=1)L.append(d[P]);return L.getBlob(_.type)}}var s=/^~~local_forage_type~([^~]+)~/,c=9,m=c+4,p=Object.prototype.toString;function v(d){var _=d.length*.75,A=d.length;d[d.length-1]==="="&&(_--,d[d.length-2]==="="&&_--);for(var L=new ArrayBuffer(_),P=new Uint8Array(L),x=0,G=0;x<A;x+=4){var Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d[x]),Se="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d[x+1]),Ie="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d[x+2]),ke="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d[x+3]);P[G++]=Z<<2|Se>>4,P[G++]=(Se&15)<<4|Ie>>2,P[G++]=(Ie&3)<<6|ke&63}return L}function g(d){for(var _=new Uint8Array(d),A="",L=0;L<_.length;L+=3)A+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[_[L]>>2],A+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(_[L]&3)<<4|_[L+1]>>4],A+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(_[L+1]&15)<<2|_[L+2]>>6],A+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[_[L+2]&63];return _.length%3===2?A=A.substring(0,A.length-1)+"=":_.length%3===1&&(A=A.substring(0,A.length-2)+"=="),A}function y(d,_){var A="";if(d&&(A=p.call(d)),d&&(A==="[object ArrayBuffer]"||d.buffer&&p.call(d.buffer)==="[object ArrayBuffer]")){var L=void 0,P="__lfsc__:";d instanceof ArrayBuffer?(L=d,P+="arbf"):(L=d.buffer,A==="[object Int8Array]"?P+="si08":A==="[object Uint8Array]"?P+="ui08":A==="[object Uint8ClampedArray]"?P+="uic8":A==="[object Int16Array]"?P+="si16":A==="[object Uint16Array]"?P+="ur16":A==="[object Int32Array]"?P+="si32":A==="[object Uint32Array]"?P+="ui32":A==="[object Float32Array]"?P+="fl32":A==="[object Float64Array]"?P+="fl64":_(new Error("Failed to get type for BinaryArray"))),_(P+g(L))}else if(A==="[object Blob]"){var x=new FileReader;x.onload=function(){var G="~~local_forage_type~"+d.type+"~"+g(this.result);_("__lfsc__:blob"+G)},x.readAsArrayBuffer(d)}else try{_(JSON.stringify(d))}catch(G){console.error("Couldn't convert value into a JSON string: ",d),_(null,G)}}function N(d){if(d.substring(0,c)!=="__lfsc__:")return JSON.parse(d);var _=d.substring(m),A=d.substring(c,m),L;if(A==="blob"&&s.test(_)){var P=_.match(s);L=P[1],_=_.substring(P[0].length)}var x=v(_);switch(A){case"arbf":return x;case"blob":return o([x],{type:L});case"si08":return new Int8Array(x);case"ui08":return new Uint8Array(x);case"uic8":return new Uint8ClampedArray(x);case"si16":return new Int16Array(x);case"ur16":return new Uint16Array(x);case"si32":return new Int32Array(x);case"ui32":return new Uint32Array(x);case"fl32":return new Float32Array(x);case"fl64":return new Float64Array(x);default:throw new Error("Unkown type: "+A)}}function I(d){var _,A;if(d===null||typeof d!="object"||"isActiveClone"in d)return d;var L=d instanceof Date?new Date(d):d.constructor();try{for(var P=n(Object.keys(d)),x=P.next();!x.done;x=P.next()){var G=x.value;Object.prototype.hasOwnProperty.call(d,G)&&(d.isActiveClone=null,L[G]=I(d[G]),delete d.isActiveClone)}}catch(Z){_={error:Z}}finally{try{x&&!x.done&&(A=P.return)&&A.call(P)}finally{if(_)throw _.error}}return L}function M(d,_){return(d.name||_.name)+"/"+(d.storeName||_.storeName)+"/"}function C(d,_){_&&d.then(function(A){_(null,A)},function(A){_(A)})}function k(){for(var d=[],_=0;_<arguments.length;_++)d[_]=arguments[_];if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}function O(d,_){var A=this;if(_=k.apply(this,arguments),d=typeof d!="function"&&d||{},!d.name){var L=this.config();d.name=d.name||L.name,d.storeName=d.storeName||L.storeName}var P;return d.name?P=new Promise(function(x){d.storeName?x(M(d,A._defaultConfig)):x(d.name+"/")}):P=Promise.reject("Invalid arguments"),{promise:P,callback:_}}function W(d){return typeof d!="string"&&(console.warn(d+" used as a key, but it is not a string."),d=String(d)),d}var J={bufferToString:g,deserialize:N,serialize:y,stringToBuffer:v},D={},me=function(){function d(_){this.kp=_,this.data={}}return d.resolve=function(_){return D[_]||(D[_]=new d(_)),D[_]},d.prototype.clear=function(){this.data={}},d.prototype.drop=function(){this.clear(),delete D[this.kp]},d.prototype.get=function(_){return this.data[_]},d.prototype.key=function(_){return this.keys()[_]},d.prototype.keys=function(){return Object.keys(this.data)},d.prototype.rm=function(_){delete this.data[_]},d.prototype.set=function(_,A){this.data[_]=A},d}();function ne(d){var _=d?I(d):{},A=M(_,this._defaultConfig),L=me.resolve(A);return this._dbInfo=_,this._dbInfo.serializer=J,this._dbInfo.keyPrefix=A,this._dbInfo.mStore=L,Promise.resolve()}function S(d){var _=this,A=this.ready().then(function(){_._dbInfo.mStore.clear()});return C(A,d),A}function F(d,_){var A=O.apply(this,arguments),L=A.promise,P=A.callback,x=L.then(function(G){me.resolve(G).drop()});return C(x,P),L}function U(d,_){var A=this;d=W(d);var L=this.ready().then(function(){var P=A._dbInfo.mStore.get(d);return P==null?null:A._dbInfo.serializer.deserialize(P)});return C(L,_),L}function q(d,_){var A=this,L=this.ready().then(function(){for(var P=A._dbInfo.mStore,x=P.keys(),G=0;G<x.length;G++){var Z=P.get(x[G]);if(Z&&(Z=A._dbInfo.serializer.deserialize(Z)),Z=d(Z,x[G],G+1),Z!==void 0)return Z}});return C(L,_),L}function Q(d,_){var A=this,L=this.ready().then(function(){var P;try{P=A._dbInfo.mStore.key(d),P===void 0&&(P=null)}catch{P=null}return P});return C(L,_),L}function ie(d){var _=this,A=this.ready().then(function(){return _._dbInfo.mStore.keys()});return C(A,d),A}function se(d){var _=this.keys().then(function(A){return A.length});return C(_,d),_}function le(d,_){var A=this;d=W(d);var L=this.ready().then(function(){A._dbInfo.mStore.rm(d)});return C(L,_),L}function fe(d,_,A){var L=this;d=W(d);var P=this.ready().then(function(){_===void 0&&(_=null);var x=_;return new Promise(function(G,Z){L._dbInfo.serializer.serialize(_,function(Se,Ie){if(Ie)Z(Ie);else try{L._dbInfo.mStore.set(d,Se),G(x)}catch(ke){Z(ke)}})})});return C(P,A),P}var _e=!0;e._support=_e,e._driver=t,e._initStorage=ne,e.clear=S,e.dropInstance=F,e.getItem=U,e.iterate=q,e.key=Q,e.keys=ie,e.length=se,e.removeItem=le,e.setItem=fe,Object.defineProperty(e,"__esModule",{value:!0})})});var jo={};nr(jo,{default:()=>Go});var de=(e=>(e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.MalformedResponse="MALFORMED_RESPONSE",e.InvalidArgument="INVALID_ARGUMENT",e.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",e.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",e))(de||{}),be=(e=>(e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE",e))(be||{}),Te=(e=>(e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",e[e.MagicLinkExpired=-10001]="MagicLinkExpired",e[e.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",e[e.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",e[e.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",e[e.UpdateEmailFailed=-10004]="UpdateEmailFailed",e[e.UserRequestEditEmail=-10005]="UserRequestEditEmail",e[e.InactiveRecipient=-10010]="InactiveRecipient",e[e.AccessDeniedToUser=-10011]="AccessDeniedToUser",e[e.RedirectLoginComplete=-10015]="RedirectLoginComplete",e))(Te||{}),ce=(e=>(e.MetaMask="metamask",e.CoinbaseWallet="coinbase_wallet",e))(ce||{}),Oe=(e=>(e.WalletSelected="wallet_selected",e.WalletConnected="wallet_connected",e.WalletRejected="wallet_rejected",e))(Oe||{}),$=(e=>(e.LoginWithSms="magic_auth_login_with_sms",e.LoginWithEmailOTP="magic_auth_login_with_email_otp",e.LoginWithMagicLink="magic_auth_login_with_magic_link",e.LoginWithCredential="magic_auth_login_with_credential",e.SetAuthorizationToken="magic_auth_set_authorization_token",e.GetIdToken="magic_auth_get_id_token",e.GenerateIdToken="magic_auth_generate_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_is_logged_in",e.Logout="magic_auth_logout",e.UpdateEmail="magic_auth_update_email",e.UserSettings="magic_auth_settings",e.UserSettingsTestMode="magic_auth_settings_testing_mode",e.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",e.LoginWithEmailOTPTestMode="magic_auth_login_with_email_otp_testing_mode",e.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",e.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",e.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",e.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",e.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",e.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",e.LogoutTestMode="magic_auth_logout_testing_mode",e.UpdateEmailTestMode="magic_auth_update_email_testing_mode",e.IntermediaryEvent="magic_intermediary_event",e.RequestAccounts="eth_requestAccounts",e.GetInfo="magic_get_info",e.ShowUI="magic_wallet",e.NFTPurchase="magic_nft_purchase",e.RequestUserInfoWithUI="mc_request_user_info",e.Disconnect="mc_disconnect",e.UpdatePhoneNumber="magic_auth_update_phone_number",e.UpdatePhoneNumberTestMode="magic_auth_update_phone_number_testing_mode",e.RecoverAccount="magic_auth_recover_account",e.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",e.MagicBoxHeartBeat="magic_box_heart_beat",e.AutoConnect="mc_auto_connect",e.Login="mc_login",e))($||{}),he=(e=>(e.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",e.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",e.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",e.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",e.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT",e.MAGIC_MG_BOX_SEND_RECEIPT="MAGIC_MG_BOX_SEND_RECEIPT",e))(he||{}),we=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e))(we||{}),ar=(e=>(e.Harmony="HARMONY",e))(ar||{});var Yn=Object.create,st=Object.defineProperty,Hn=Object.defineProperties,Xn=Object.getOwnPropertyDescriptor,zn=Object.getOwnPropertyDescriptors,Jn=Object.getOwnPropertyNames,sr=Object.getOwnPropertySymbols,Qn=Object.getPrototypeOf,Ir=Object.prototype.hasOwnProperty,Zn=Object.prototype.propertyIsEnumerable,lr=(e,t,n)=>t in e?st(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wt=(e,t)=>{for(var n in t||(t={}))Ir.call(t,n)&&lr(e,n,t[n]);if(sr)for(var n of sr(t))Zn.call(t,n)&&lr(e,n,t[n]);return e},br=(e,t)=>Hn(e,zn(t)),ei=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ti=(e,t)=>{for(var n in t)st(e,n,{get:t[n],enumerable:!0})},ri=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Jn(t))!Ir.call(e,s)&&s!==n&&st(e,s,{get:()=>t[s],enumerable:!(o=Xn(t,s))||o.enumerable});return e},ni=(e,t,n)=>(n=e!=null?Yn(Qn(e)):{},ri(t||!e||!e.__esModule?st(n,"default",{value:e,enumerable:!0}):n,e)),ae=(e,t,n)=>new Promise((o,s)=>{var c=v=>{try{p(n.next(v))}catch(g){s(g)}},m=v=>{try{p(n.throw(v))}catch(g){s(g)}},p=v=>v.done?o(v.value):Promise.resolve(v.value).then(c,m);p((n=n.apply(e,t)).next())}),ii=ei((e,t)=>{"use strict";var n=Object.prototype.hasOwnProperty,o="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(o=!1));function c(g,y,N){this.fn=g,this.context=y,this.once=N||!1}function m(g,y,N,I,M){if(typeof N!="function")throw new TypeError("The listener must be a function");var C=new c(N,I||g,M),k=o?o+y:y;return g._events[k]?g._events[k].fn?g._events[k]=[g._events[k],C]:g._events[k].push(C):(g._events[k]=C,g._eventsCount++),g}function p(g,y){--g._eventsCount===0?g._events=new s:delete g._events[y]}function v(){this._events=new s,this._eventsCount=0}v.prototype.eventNames=function(){var g=[],y,N;if(this._eventsCount===0)return g;for(N in y=this._events)n.call(y,N)&&g.push(o?N.slice(1):N);return Object.getOwnPropertySymbols?g.concat(Object.getOwnPropertySymbols(y)):g},v.prototype.listeners=function(g){var y=o?o+g:g,N=this._events[y];if(!N)return[];if(N.fn)return[N.fn];for(var I=0,M=N.length,C=new Array(M);I<M;I++)C[I]=N[I].fn;return C},v.prototype.listenerCount=function(g){var y=o?o+g:g,N=this._events[y];return N?N.fn?1:N.length:0},v.prototype.emit=function(g,y,N,I,M,C){var k=o?o+g:g;if(!this._events[k])return!1;var O=this._events[k],W=arguments.length,J,D;if(O.fn){switch(O.once&&this.removeListener(g,O.fn,void 0,!0),W){case 1:return O.fn.call(O.context),!0;case 2:return O.fn.call(O.context,y),!0;case 3:return O.fn.call(O.context,y,N),!0;case 4:return O.fn.call(O.context,y,N,I),!0;case 5:return O.fn.call(O.context,y,N,I,M),!0;case 6:return O.fn.call(O.context,y,N,I,M,C),!0}for(D=1,J=new Array(W-1);D<W;D++)J[D-1]=arguments[D];O.fn.apply(O.context,J)}else{var me=O.length,ne;for(D=0;D<me;D++)switch(O[D].once&&this.removeListener(g,O[D].fn,void 0,!0),W){case 1:O[D].fn.call(O[D].context);break;case 2:O[D].fn.call(O[D].context,y);break;case 3:O[D].fn.call(O[D].context,y,N);break;case 4:O[D].fn.call(O[D].context,y,N,I);break;default:if(!J)for(ne=1,J=new Array(W-1);ne<W;ne++)J[ne-1]=arguments[ne];O[D].fn.apply(O[D].context,J)}}return!0},v.prototype.on=function(g,y,N){return m(this,g,y,N,!1)},v.prototype.once=function(g,y,N){return m(this,g,y,N,!0)},v.prototype.removeListener=function(g,y,N,I){var M=o?o+g:g;if(!this._events[M])return this;if(!y)return p(this,M),this;var C=this._events[M];if(C.fn)C.fn===y&&(!I||C.once)&&(!N||C.context===N)&&p(this,M);else{for(var k=0,O=[],W=C.length;k<W;k++)(C[k].fn!==y||I&&!C[k].once||N&&C[k].context!==N)&&O.push(C[k]);O.length?this._events[M]=O.length===1?O[0]:O:p(this,M)}return this},v.prototype.removeAllListeners=function(g){var y;return g?(y=o?o+g:g,this._events[y]&&p(this,y)):(this._events=new s,this._eventsCount=0),this},v.prototype.off=v.prototype.removeListener,v.prototype.addListener=v.prototype.on,v.prefixed=o,v.EventEmitter=v,typeof t<"u"&&(t.exports=v)});function oi(e){let t={exports:{}};return e(t,t.exports),t.exports}var ai=Number.MAX_SAFE_INTEGER||9007199254740991,Rt={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:ai,MAX_SAFE_COMPONENT_LENGTH:16},si=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{},Y=si,Xe=oi(function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:n}=Rt,o=(t=e.exports={}).re=[],s=t.src=[],c=t.t={},m=0,p=(v,g,y)=>{let N=m++;Y(N,g),c[v]=N,s[N]=g,o[N]=new RegExp(g,y?"g":void 0)};p("NUMERICIDENTIFIER","0|[1-9]\\d*"),p("NUMERICIDENTIFIERLOOSE","[0-9]+"),p("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),p("MAINVERSION",`(${s[c.NUMERICIDENTIFIER]})\\.(${s[c.NUMERICIDENTIFIER]})\\.(${s[c.NUMERICIDENTIFIER]})`),p("MAINVERSIONLOOSE",`(${s[c.NUMERICIDENTIFIERLOOSE]})\\.(${s[c.NUMERICIDENTIFIERLOOSE]})\\.(${s[c.NUMERICIDENTIFIERLOOSE]})`),p("PRERELEASEIDENTIFIER",`(?:${s[c.NUMERICIDENTIFIER]}|${s[c.NONNUMERICIDENTIFIER]})`),p("PRERELEASEIDENTIFIERLOOSE",`(?:${s[c.NUMERICIDENTIFIERLOOSE]}|${s[c.NONNUMERICIDENTIFIER]})`),p("PRERELEASE",`(?:-(${s[c.PRERELEASEIDENTIFIER]}(?:\\.${s[c.PRERELEASEIDENTIFIER]})*))`),p("PRERELEASELOOSE",`(?:-?(${s[c.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${s[c.PRERELEASEIDENTIFIERLOOSE]})*))`),p("BUILDIDENTIFIER","[0-9A-Za-z-]+"),p("BUILD",`(?:\\+(${s[c.BUILDIDENTIFIER]}(?:\\.${s[c.BUILDIDENTIFIER]})*))`),p("FULLPLAIN",`v?${s[c.MAINVERSION]}${s[c.PRERELEASE]}?${s[c.BUILD]}?`),p("FULL",`^${s[c.FULLPLAIN]}$`),p("LOOSEPLAIN",`[v=\\s]*${s[c.MAINVERSIONLOOSE]}${s[c.PRERELEASELOOSE]}?${s[c.BUILD]}?`),p("LOOSE",`^${s[c.LOOSEPLAIN]}$`),p("GTLT","((?:<|>)?=?)"),p("XRANGEIDENTIFIERLOOSE",`${s[c.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),p("XRANGEIDENTIFIER",`${s[c.NUMERICIDENTIFIER]}|x|X|\\*`),p("XRANGEPLAIN",`[v=\\s]*(${s[c.XRANGEIDENTIFIER]})(?:\\.(${s[c.XRANGEIDENTIFIER]})(?:\\.(${s[c.XRANGEIDENTIFIER]})(?:${s[c.PRERELEASE]})?${s[c.BUILD]}?)?)?`),p("XRANGEPLAINLOOSE",`[v=\\s]*(${s[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${s[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${s[c.XRANGEIDENTIFIERLOOSE]})(?:${s[c.PRERELEASELOOSE]})?${s[c.BUILD]}?)?)?`),p("XRANGE",`^${s[c.GTLT]}\\s*${s[c.XRANGEPLAIN]}$`),p("XRANGELOOSE",`^${s[c.GTLT]}\\s*${s[c.XRANGEPLAINLOOSE]}$`),p("COERCE",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?(?:$|[^\\d])`),p("COERCERTL",s[c.COERCE],!0),p("LONETILDE","(?:~>?)"),p("TILDETRIM",`(\\s*)${s[c.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",p("TILDE",`^${s[c.LONETILDE]}${s[c.XRANGEPLAIN]}$`),p("TILDELOOSE",`^${s[c.LONETILDE]}${s[c.XRANGEPLAINLOOSE]}$`),p("LONECARET","(?:\\^)"),p("CARETTRIM",`(\\s*)${s[c.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",p("CARET",`^${s[c.LONECARET]}${s[c.XRANGEPLAIN]}$`),p("CARETLOOSE",`^${s[c.LONECARET]}${s[c.XRANGEPLAINLOOSE]}$`),p("COMPARATORLOOSE",`^${s[c.GTLT]}\\s*(${s[c.LOOSEPLAIN]})$|^$`),p("COMPARATOR",`^${s[c.GTLT]}\\s*(${s[c.FULLPLAIN]})$|^$`),p("COMPARATORTRIM",`(\\s*)${s[c.GTLT]}\\s*(${s[c.LOOSEPLAIN]}|${s[c.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",p("HYPHENRANGE",`^\\s*(${s[c.XRANGEPLAIN]})\\s+-\\s+(${s[c.XRANGEPLAIN]})\\s*$`),p("HYPHENRANGELOOSE",`^\\s*(${s[c.XRANGEPLAINLOOSE]})\\s+-\\s+(${s[c.XRANGEPLAINLOOSE]})\\s*$`),p("STAR","(<|>)?=?\\s*\\*"),p("GTE0","^\\s*>=\\s*0.0.0\\s*$"),p("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")}),cr=/^[0-9]+$/,wr=(e,t)=>{let n=cr.test(e),o=cr.test(t);return n&&o&&(e=+e,t=+t),e===t?0:n&&!o?-1:o&&!n?1:e<t?-1:1},li=(e,t)=>wr(t,e),ci={compareIdentifiers:wr,rcompareIdentifiers:li},{MAX_LENGTH:ur,MAX_SAFE_INTEGER:Qe}=Rt,{re:fr,t:dr}=Xe,{compareIdentifiers:je}=ci,ee=class{constructor(e,t){if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof ee){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid Version: ${e}`);if(e.length>ur)throw new TypeError(`version is longer than ${ur} characters`);Y("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let n=e.trim().match(t.loose?fr[dr.LOOSE]:fr[dr.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Qe||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Qe||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Qe||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let s=+o;if(s>=0&&s<Qe)return s}return o}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(Y("SemVer.compare",this.version,this.options,e),!(e instanceof ee)){if(typeof e=="string"&&e===this.version)return 0;e=new ee(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof ee||(e=new ee(e,this.options)),je(this.major,e.major)||je(this.minor,e.minor)||je(this.patch,e.patch)}comparePre(e){if(e instanceof ee||(e=new ee(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let n=this.prerelease[t],o=e.prerelease[t];if(Y("prerelease compare",t,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n!==o)return je(n,o)}while(++t)}compareBuild(e){e instanceof ee||(e=new ee(e,this.options));let t=0;do{let n=this.build[t],o=e.build[t];if(Y("prerelease compare",t,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n!==o)return je(n,o)}while(++t)}inc(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",t),this.inc("pre",t);break;case"major":this.minor===0&&this.patch===0&&this.prerelease.length!==0||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":this.patch===0&&this.prerelease.length!==0||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":if(this.prerelease.length===0)this.prerelease=[0];else{let n=this.prerelease.length;for(;--n>=0;)typeof this.prerelease[n]=="number"&&(this.prerelease[n]++,n=-2);n===-1&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}},ui=(e,t,n)=>new ee(e,n).compare(new ee(t,n)),xe=ui,fi=(e,t,n)=>xe(e,t,n)===0,di=fi,hi=(e,t,n)=>xe(e,t,n)!==0,pi=hi,mi=(e,t,n)=>xe(e,t,n)>0,vi=mi,gi=(e,t,n)=>xe(e,t,n)>=0,yi=gi,Ei=(e,t,n)=>xe(e,t,n)<0,_i=Ei,Ii=(e,t,n)=>xe(e,t,n)<=0,bi=Ii,wi=(e,t,n,o)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof n=="object"&&(n=n.version),e===n;case"!==":return typeof e=="object"&&(e=e.version),typeof n=="object"&&(n=n.version),e!==n;case"":case"=":case"==":return di(e,n,o);case"!=":return pi(e,n,o);case">":return vi(e,n,o);case">=":return yi(e,n,o);case"<":return _i(e,n,o);case"<=":return bi(e,n,o);default:throw new TypeError(`Invalid operator: ${t}`)}},It=wi,Ke=Symbol("SemVer ANY"),Ve=class{static get ANY(){return Ke}constructor(e,t){if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof Ve){if(e.loose===!!t.loose)return e;e=e.value}Y("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===Ke?this.value="":this.value=this.operator+this.semver.version,Y("comp",this)}parse(e){let t=this.options.loose?hr[pr.COMPARATORLOOSE]:hr[pr.COMPARATOR],n=e.match(t);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new ee(n[2],this.options.loose):this.semver=Ke}toString(){return this.value}test(e){if(Y("Comparator.test",e,this.options.loose),this.semver===Ke||e===Ke)return!0;if(typeof e=="string")try{e=new ee(e,this.options)}catch(t){return!1}return It(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof Ve))throw new TypeError("a Comparator is required");if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),this.operator==="")return this.value===""||new Pe(e.value,t).test(this.value);if(e.operator==="")return e.value===""||new Pe(this.value,t).test(e.semver);let n=!(this.operator!==">="&&this.operator!==">"||e.operator!==">="&&e.operator!==">"),o=!(this.operator!=="<="&&this.operator!=="<"||e.operator!=="<="&&e.operator!=="<"),s=this.semver.version===e.semver.version,c=!(this.operator!==">="&&this.operator!=="<="||e.operator!==">="&&e.operator!=="<="),m=It(this.semver,"<",e.semver,t)&&(this.operator===">="||this.operator===">")&&(e.operator==="<="||e.operator==="<"),p=It(this.semver,">",e.semver,t)&&(this.operator==="<="||this.operator==="<")&&(e.operator===">="||e.operator===">");return n||o||s&&c||m||p}},{re:hr,t:pr}=Xe,Pe=class{constructor(e,t){if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof Pe)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new Pe(e.raw,t);if(e instanceof Ve)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map(n=>this.parseRange(n.trim())).filter(n=>n.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){let{loose:t}=this.options;e=e.trim();let n=t?re[te.HYPHENRANGELOOSE]:re[te.HYPHENRANGE];e=e.replace(n,xi(this.options.includePrerelease)),Y("hyphen replace",e),e=e.replace(re[te.COMPARATORTRIM],Ri),Y("comparator trim",e,re[te.COMPARATORTRIM]),e=(e=(e=e.replace(re[te.TILDETRIM],Ai)).replace(re[te.CARETTRIM],Si)).split(/\s+/).join(" ");let o=t?re[te.COMPARATORLOOSE]:re[te.COMPARATOR];return e.split(" ").map(s=>Ni(s,this.options)).join(" ").split(/\s+/).map(s=>Di(s,this.options)).filter(this.options.loose?s=>!!s.match(o):()=>!0).map(s=>new Ve(s,this.options))}intersects(e,t){if(!(e instanceof Pe))throw new TypeError("a Range is required");return this.set.some(n=>mr(n,t)&&e.set.some(o=>mr(o,t)&&n.every(s=>o.every(c=>s.intersects(c,t)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new ee(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(Ui(this.set[t],e,this.options))return!0;return!1}},{re,t:te,comparatorTrimReplace:Ri,tildeTrimReplace:Ai,caretTrimReplace:Si}=Xe,mr=(e,t)=>{let n=!0,o=e.slice(),s=o.pop();for(;n&&o.length;)n=o.every(c=>s.intersects(c,t)),s=o.pop();return n},Ni=(e,t)=>(Y("comp",e,t),e=Oi(e,t),Y("caret",e),e=Mi(e,t),Y("tildes",e),e=Pi(e,t),Y("xrange",e),e=$i(e,t),Y("stars",e),e),oe=e=>!e||e.toLowerCase()==="x"||e==="*",Mi=(e,t)=>e.trim().split(/\s+/).map(n=>Ti(n,t)).join(" "),Ti=(e,t)=>{let n=t.loose?re[te.TILDELOOSE]:re[te.TILDE];return e.replace(n,(o,s,c,m,p)=>{let v;return Y("tilde",e,o,s,c,m,p),oe(s)?v="":oe(c)?v=`>=${s}.0.0 <${+s+1}.0.0-0`:oe(m)?v=`>=${s}.${c}.0 <${s}.${+c+1}.0-0`:p?(Y("replaceTilde pr",p),v=`>=${s}.${c}.${m}-${p} <${s}.${+c+1}.0-0`):v=`>=${s}.${c}.${m} <${s}.${+c+1}.0-0`,Y("tilde return",v),v})},Oi=(e,t)=>e.trim().split(/\s+/).map(n=>Li(n,t)).join(" "),Li=(e,t)=>{Y("caret",e,t);let n=t.loose?re[te.CARETLOOSE]:re[te.CARET],o=t.includePrerelease?"-0":"";return e.replace(n,(s,c,m,p,v)=>{let g;return Y("caret",e,s,c,m,p,v),oe(c)?g="":oe(m)?g=`>=${c}.0.0${o} <${+c+1}.0.0-0`:oe(p)?g=c==="0"?`>=${c}.${m}.0${o} <${c}.${+m+1}.0-0`:`>=${c}.${m}.0${o} <${+c+1}.0.0-0`:v?(Y("replaceCaret pr",v),g=c==="0"?m==="0"?`>=${c}.${m}.${p}-${v} <${c}.${m}.${+p+1}-0`:`>=${c}.${m}.${p}-${v} <${c}.${+m+1}.0-0`:`>=${c}.${m}.${p}-${v} <${+c+1}.0.0-0`):(Y("no pr"),g=c==="0"?m==="0"?`>=${c}.${m}.${p}${o} <${c}.${m}.${+p+1}-0`:`>=${c}.${m}.${p}${o} <${c}.${+m+1}.0-0`:`>=${c}.${m}.${p} <${+c+1}.0.0-0`),Y("caret return",g),g})},Pi=(e,t)=>(Y("replaceXRanges",e,t),e.split(/\s+/).map(n=>Ci(n,t)).join(" ")),Ci=(e,t)=>{e=e.trim();let n=t.loose?re[te.XRANGELOOSE]:re[te.XRANGE];return e.replace(n,(o,s,c,m,p,v)=>{Y("xRange",e,o,s,c,m,p,v);let g=oe(c),y=g||oe(m),N=y||oe(p),I=N;return s==="="&&I&&(s=""),v=t.includePrerelease?"-0":"",g?o=s===">"||s==="<"?"<0.0.0-0":"*":s&&I?(y&&(m=0),p=0,s===">"?(s=">=",y?(c=+c+1,m=0,p=0):(m=+m+1,p=0)):s==="<="&&(s="<",y?c=+c+1:m=+m+1),s==="<"&&(v="-0"),o=`${s+c}.${m}.${p}${v}`):y?o=`>=${c}.0.0${v} <${+c+1}.0.0-0`:N&&(o=`>=${c}.${m}.0${v} <${c}.${+m+1}.0-0`),Y("xRange return",o),o})},$i=(e,t)=>(Y("replaceStars",e,t),e.trim().replace(re[te.STAR],"")),Di=(e,t)=>(Y("replaceGTE0",e,t),e.trim().replace(re[t.includePrerelease?te.GTE0PRE:te.GTE0],"")),xi=e=>(t,n,o,s,c,m,p,v,g,y,N,I,M)=>`${n=oe(o)?"":oe(s)?`>=${o}.0.0${e?"-0":""}`:oe(c)?`>=${o}.${s}.0${e?"-0":""}`:m?`>=${n}`:`>=${n}${e?"-0":""}`} ${v=oe(g)?"":oe(y)?`<${+g+1}.0.0-0`:oe(N)?`<${g}.${+y+1}.0-0`:I?`<=${g}.${y}.${N}-${I}`:e?`<${g}.${y}.${+N+1}-0`:`<=${v}`}`.trim(),Ui=(e,t,n)=>{for(let o=0;o<e.length;o++)if(!e[o].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let o=0;o<e.length;o++)if(Y(e[o].semver),e[o].semver!==Ve.ANY&&e[o].semver.prerelease.length>0){let s=e[o].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0},ki=(e,t,n)=>{try{t=new Pe(t,n)}catch(o){return!1}return t.test(e)},{MAX_LENGTH:Bi}=Rt,{re:vr,t:gr}=Xe,Wi=(e,t)=>{if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof ee)return e;if(typeof e!="string"||e.length>Bi||!(t.loose?vr[gr.LOOSE]:vr[gr.FULL]).test(e))return null;try{return new ee(e,t)}catch(n){return null}},Fi=Wi,{re:Ze,t:et}=Xe,Gi=(e,t)=>{if(e instanceof ee)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;let n=null;if((t=t||{}).rtl){let o;for(;(o=Ze[et.COERCERTL].exec(e))&&(!n||n.index+n[0].length!==e.length);)n&&o.index+o[0].length===n.index+n[0].length||(n=o),Ze[et.COERCERTL].lastIndex=o.index+o[1].length+o[2].length;Ze[et.COERCERTL].lastIndex=-1}else n=e.match(Ze[et.COERCE]);return n===null?null:Fi(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)};function ji(e){return String.fromCharCode(parseInt(e.slice(1),16))}function Ki(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}function qi(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,ji))}function Vi(e){return decodeURIComponent(Array.from(atob(e),Ki).join(""))}function Rr(e){return qi(JSON.stringify(e))}function Yi(e){return JSON.parse(Vi(e))}function qe(e){return typeof e=="undefined"}function Hi(e){return e===null}function Ar(e){return Hi(e)||qe(e)}function Xi(e){return Ar(e)?!1:!qe(e.jsonrpc)&&!qe(e.id)&&(!qe(e.result)||!qe(e.error))}function zi(e){return Ar(e)?!1:typeof e=="number"&&Object.values(Te).includes(e)}function bt(e){if(!e)return!0;for(let t in e)if(Object.hasOwnProperty.call(e,t))return!1;return!0}var H={};function Sr(e,t){return Object.assign(H,t),e}var Ji={"magic-sdk":"magic-sdk","@magic-sdk/react-native":"magic-sdk-rn","@magic-sdk/react-native-bare":"magic-sdk-rn-bare","@magic-sdk/react-native-expo":"magic-sdk-rn-expo"},pe=class extends Error{constructor(e,t){super(`Magic SDK Error: [${e}] ${t}`),this.code=e,this.rawMessage=t,this.__proto__=Error,Object.setPrototypeOf(this,pe.prototype)}},$e=class extends Error{constructor(e){super(),this.__proto__=Error;let t=Number(e==null?void 0:e.code);this.rawMessage=(e==null?void 0:e.message)||"Internal error",this.code=zi(t)?t:Te.InternalError,this.message=`Magic RPC Error: [${this.code}] ${this.rawMessage}`,this.data=(e==null?void 0:e.data)||void 0,Object.setPrototypeOf(this,$e.prototype)}},Ue=class{constructor(e,t){this.code=e,this.rawMessage=t,this.message=`Magic SDK Warning: [${e}] ${t}`}log(){console.warn(this.message)}},lt=class extends Error{constructor(e,t,n,o){super(`Magic Extension Error (${e.name}): [${t}] ${n}`),this.code=t,this.rawMessage=n,this.data=o,this.__proto__=Error,Object.setPrototypeOf(this,lt.prototype)}},it=class{constructor(e,t,n){this.code=t,this.rawMessage=n,this.message=`Magic Extension Warning (${e.name}): [${t}] ${n}`}log(){console.warn(this.message)}};function Qi(){return new pe(de.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")}function Nr(){return new pe(de.ModalNotReady,"Modal is not ready.")}function Zi(){return new pe(de.MalformedResponse,"Response from the Magic iframe is malformed.")}function eo(e){return new pe(de.ExtensionNotInitialized,`Extensions must be initialized with a Magic SDK instance before \`Extension.${e}\` can be accessed. Do not invoke \`Extension.${e}\` inside an extension constructor.`)}function to(e){let t=`Some extensions are incompatible with \`${H.sdkName}@${H.version}\`:`;return e.filter(n=>typeof n.compat!="undefined"&&n.compat!==null).forEach(n=>{let o=n.compat[H.sdkName];typeof o=="string"?t+=`
|
2
|
+
- Extension \`${n.name}\` supports version(s) \`${o}\``:o||(t+=`
|
3
|
+
- Extension \`${n.name}\` does not support ${H.platform} environments.`)}),new pe(de.IncompatibleExtensions,t)}function ro(e){let t=n=>{let o=n+1,s=o%10,c=o%100;return s===1&&c!==11?`${o}st`:s===2&&c!==12?`${o}nd`:s===3&&c!==13?`${o}rd`:`${o}th`};return new pe(de.InvalidArgument,`Invalid ${t(e.argument)} argument given to \`${e.procedure}\`.
|
4
4
|
Expected: \`${e.expected}\`
|
5
|
-
Received: \`${e.received}\``)}function Nn(){return new Qe(Ue.DuplicateIframe,"Duplicate iframes found.")}function ci(){return new Qe(Ue.SyncWeb3Method,"Non-async web3 methods are deprecated in web3 > 1.0 and are not supported by the Magic web3 provider. Please use an async method instead.")}function fi(){return new Qe(Ue.ReactNativeEndpointConfiguration,`CUSTOM DOMAINS ARE NOT SUPPORTED WHEN USING MAGIC SDK WITH REACT NATIVE! The \`endpoint\` parameter SHOULD NOT be provided. The Magic \`<iframe>\` is automatically wrapped by a WebView pointed at \`${ne.defaultEndpoint}\`. Changing this default behavior will lead to unexpected results and potentially security-threatening bugs.`)}function ze(e){let{method:n,removalVersions:u,useInstead:c}=e,l=u[ne.sdkName],d=c?` Use \`${c}\` instead.`:"",I=`\`${n}\` will be removed from \`${ne.sdkName}\` in version \`${l}\`.${d}`;return new Qe(Ue.DeprecationNotice,I)}function*li(){let e=0;for(;;)e<Number.MAX_SAFE_INTEGER?yield++e:e=0}var di=li();function Tn(){return di.next().value}var On=Symbol("Payload pre-processed by Magic SDK");function Mn(e){return Object.defineProperty(e,On,{value:!0,enumerable:!1}),e}function hi(e){return!!e[On]}function Pt(e){var n,u,c;return hi(e)||(e.jsonrpc=(n=e.jsonrpc)!=null?n:"2.0",e.id=Tn(),e.method=(u=e.method)!=null?u:"noop",e.params=(c=e.params)!=null?c:[],Mn(e)),e}function q(e,n=[]){return Mn({params:n,method:e,jsonrpc:"2.0",id:Tn()})}var Gr=class{constructor(e){e instanceof Gr?(this._jsonrpc=e.payload.jsonrpc,this._id=e.payload.id,this._result=e.payload.result,this._error=e.payload.error):ti(e)?(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=e.result,this._error=e.error):(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=void 0,this._error=void 0)}applyError(e){return this._error=e,this}applyResult(e){return this._result=e,this}get hasError(){return typeof this._error!="undefined"&&this._error!==null}get hasResult(){return typeof this._result!="undefined"}get payload(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}}},vi=uo(co()),mi=class extends vi.default{};function Ln(){let e=new mi;return{emitter:e,createChainingEmitterMethod:(n,u)=>(...c)=>(e[n].apply(e,c),u),createBoundEmitterMethod:n=>(...u)=>e[n].apply(e,u)}}var Pn=Symbol("isPromiEvent");function jr(e){return!!e[Pn]}function Cn(e){let n=Dn(e),{createBoundEmitterMethod:u,createChainingEmitterMethod:c}=Ln(),l=Symbol("Promise.then"),d=Symbol("Promise.catch"),I=Symbol("Promise.finally"),b=(S,O)=>(...g)=>{let A=O[S].apply(O,g);return E(A)},E=S=>Object.assign(S,{[Pn]:!0,[l]:S[l]||S.then,[d]:S[d]||S.catch,[I]:S[I]||S.finally,then:b(l,S),catch:b(d,S),finally:b(I,S),on:c("on",S),once:c("once",S),addListener:c("addListener",S),off:c("off",S),removeListener:c("removeListener",S),removeAllListeners:c("removeAllListeners",S),emit:u("emit"),eventNames:u("eventNames"),listeners:u("listeners"),listenerCount:u("listenerCount")}),R=E(n.then(S=>(R.emit("done",S),R.emit("settled"),S),S=>{throw R.emit("error",S),R.emit("settled"),S}));return R}function Dn(e){return new Promise((n,u)=>{let c=e(n,u);Promise.resolve(c).catch(u)})}var Ge=class{constructor(e){this.sdk=e}get overlay(){return this.sdk.overlay}request(e){let n=this.overlay.post(Fe.MAGIC_HANDLE_REQUEST,Pt(e)),u=Cn((l,d)=>{n.then(I=>{if(c(),I.hasError)d(new qe(I.payload.error));else if(I.hasResult)l(I.payload.result);else throw ii()}).catch(I=>{c(),d(I)})}),c=this.overlay.on(Re.MAGIC_HANDLE_EVENT,l=>{var d;let{response:I}=l.data;if(I.id===e.id&&((d=I.result)==null?void 0:d.event)){let{event:b,params:E=[]}=I.result;u.emit(b,...E)}});return u}createIntermediaryEvent(e,n){return u=>{let c=q(j.IntermediaryEvent,[{payloadId:n,eventType:e,args:u}]);this.request(c)}}},pi=class extends Ge{loginWithMagicLink(e){let{email:n,showUI:u=!0,redirectURI:c}=e,l=q(this.sdk.testMode?j.LoginWithMagicLinkTestMode:j.LoginWithMagicLink,[{email:n,showUI:u,redirectURI:c}]);return this.request(l)}loginWithSMS(e){let{phoneNumber:n}=e,u=q(this.sdk.testMode?j.LoginWithSmsTestMode:j.LoginWithSms,[{phoneNumber:n,showUI:!0}]);return this.request(u)}loginWithEmailOTP(e){let{email:n,showUI:u}=e,c=q(this.sdk.testMode?j.LoginWithEmailOTPTestMode:j.LoginWithEmailOTP,[{email:n,showUI:u}]);if(!u){let l=this.request(c);return l&&(l.on("verify-email-otp",d=>{this.createIntermediaryEvent("verify-email-otp",c.id)(d)}),l.on("cancel",()=>{this.createIntermediaryEvent("cancel",c.id)()})),l}return this.request(c)}loginWithCredential(e){let n=e!=null?e:"";if(!e&&ne.platform==="web"){n=window.location.search;let c=window.location.origin+window.location.pathname;window.history.replaceState(null,"",c)}let u=q(this.sdk.testMode?j.LoginWithCredentialTestMode:j.LoginWithCredential,[n]);return this.request(u)}setAuthorizationToken(){let e=q(j.SetAuthorizationToken);return this.request(e)}updateEmailWithUI(e){let{email:n,showUI:u=!0}=e,c=q(this.sdk.testMode?j.UpdateEmailTestMode:j.UpdateEmail,[{email:n,showUI:u}]);return this.request(c)}updatePhoneNumberWithUI(){let e=q(this.sdk.testMode?j.UpdatePhoneNumberTestMode:j.UpdatePhoneNumber);return this.request(e)}},$n={};ao($n,{clear:()=>gi,getItem:()=>ke,iterate:()=>Ii,key:()=>_i,keys:()=>Ei,length:()=>yi,removeItem:()=>Ct,setItem:()=>Xe});var Tt;function Ne(e){return(...n)=>de(this,null,function*(){return Tt||(Tt=yield ne.configureStorage()),yield Tt.ready(),Tt[e](...n)})}var ke=Ne("getItem"),Xe=Ne("setItem"),Ct=Ne("removeItem"),gi=Ne("clear"),yi=Ne("length"),_i=Ne("key"),Ei=Ne("keys"),Ii=Ne("iterate");function bi(){let e=window.crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&191|128;let n="";return n+=e[0].toString(16),n+=e[1].toString(16),n+=e[2].toString(16),n+=e[3].toString(16),n+="-",n+=e[4].toString(16),n+=e[5].toString(16),n+="-",n+=e[6].toString(16),n+=e[7].toString(16),n+="-",n+=e[8].toString(16),n+=e[9].toString(16),n+="-",n+=e[10].toString(16),n+=e[11].toString(16),n+=e[12].toString(16),n+=e[13].toString(16),n+=e[14].toString(16),n+=e[15].toString(16),n}var Yr="STORE_KEY_PRIVATE_KEY",Dt="STORE_KEY_PUBLIC_JWK",Kr="ECDSA",xn="P-256",wi={name:Kr,namedCurve:xn},Ri={name:Kr,namedCurve:xn};function Bn(){Ct(Dt),Ct(Yr)}function Si(){return de(this,null,function*(){let e=yield Ai();if(!e){console.info("unable to create public key or webcrypto is unsupported");return}let{subtle:n}=window.crypto,u=yield ke(Yr);if(!u||!n){console.info("unable to find private key or webcrypto unsupported");return}let c={iat:Math.floor(new Date().getTime()/1e3),jti:bi()},l={typ:"dpop+jwt",alg:"ES256",jwk:e},d={protected:gn(JSON.stringify(l)),claims:gn(JSON.stringify(c))},I=Oi(`${d.protected}.${d.claims}`),b={name:Kr,hash:{name:"SHA-256"}},E=Li(new Uint8Array(yield n.sign(b,u,I)));return`${d.protected}.${d.claims}.${E}`})}function Ai(){return de(this,null,function*(){if(!Ti()){console.info("webcrypto is not supported");return}return(yield ke(Dt))||(yield Ni()),ke(Dt)})}function Ni(){return de(this,null,function*(){let e=null,{subtle:n}=window.crypto,u=yield n.generateKey(wi,!0,["sign"]),c=yield n.exportKey("jwk",u.privateKey);e=yield n.exportKey("jwk",u.publicKey);let l=yield n.importKey("jwk",c,Ri,!1,["sign"]);yield Xe(Yr,l),yield Xe(Dt,e)})}function Ti(){let e=typeof window!="undefined"&&!!window.crypto,n=e&&!!window.crypto.subtle;return e&&n}function gn(e){return Un(Mi(e))}function Oi(e){return new TextEncoder().encode(e)}function Un(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+/g,"")}function Mi(e){return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(n,u)=>String.fromCharCode(parseInt(u,16)))}function Li(e){let n="";return e.forEach(u=>{n+=String.fromCharCode(u)}),Un(n)}var Pi=class extends Ge{constructor(){super(...arguments),this.localForageKey="mc_active_wallet"}getIdToken(e){let n=q(this.sdk.testMode?j.GetIdTokenTestMode:j.GetIdToken,[e]);return this.request(n)}generateIdToken(e){let n=q(this.sdk.testMode?j.GenerateIdTokenTestMode:j.GenerateIdToken,[e]);return this.request(n)}getInfo(){return de(this,null,function*(){let e=yield(0,Bt.getItem)(this.localForageKey),n=q(j.GetInfo,[{walletType:e}]);return this.request(n)})}isLoggedIn(){let e=q(this.sdk.testMode?j.IsLoggedInTestMode:j.IsLoggedIn);return this.request(e)}logout(){Bn(),(0,Bt.removeItem)(this.localForageKey);let e=q(this.sdk.testMode?j.LogoutTestMode:j.Logout);return this.request(e)}requestUserInfoWithUI(e){let n=q(j.RequestUserInfoWithUI,e?[e]:[]);return this.request(n)}showSettings(){let e=q(this.sdk.testMode?j.UserSettingsTestMode:j.UserSettings);return this.request(e)}recoverAccount(e){let n=q(this.sdk.testMode?j.RecoverAccountTestMode:j.RecoverAccount,[e]);return this.request(n)}getMetadata(){ze({method:"user.getMetadata()",removalVersions:{"magic-sdk":"v18.0.0","@magic-sdk/react-native":"v14.0.0","@magic-sdk/react-native-bare":"v19.0.0","@magic-sdk/react-native-expo":"v19.0.0"},useInstead:"user.getInfo()"}).log();let e=q(this.sdk.testMode?j.GetMetadataTestMode:j.GetMetadata);return this.request(e)}updateEmail(e){ze({method:"user.updateEmail()",removalVersions:{"magic-sdk":"v18.0.0","@magic-sdk/react-native":"v14.0.0","@magic-sdk/react-native-bare":"v19.0.0","@magic-sdk/react-native-expo":"v19.0.0"},useInstead:"auth.updateEmailWithUI()"}).log();let{email:n,showUI:u=!0}=e,c=q(this.sdk.testMode?j.UpdateEmailTestMode:j.UpdateEmail,[{email:n,showUI:u}]);return this.request(c)}updatePhoneNumber(){ze({method:"user.updatePhoneNumber()",removalVersions:{"magic-sdk":"v18.0.0","@magic-sdk/react-native":"v14.0.0","@magic-sdk/react-native-bare":"v19.0.0","@magic-sdk/react-native-expo":"v19.0.0"},useInstead:"auth.updatePhoneNumberWithUI()"}).log();let e=q(this.sdk.testMode?j.UpdatePhoneNumberTestMode:j.UpdatePhoneNumber);return this.request(e)}},Ci=class extends Ge{constructor(){super(...arguments),this.localForageKey="mc_active_wallet"}connectWithUI(){return de(this,null,function*(){if(this.isMetaMaskBrowser())try{if(yield this.isWalletEnabled(me.MetaMask))return this.autoConnectIfWalletBrowser(me.MetaMask)}catch(c){console.error(c)}if(this.isCoinbaseWalletBrowser())try{if(yield this.isWalletEnabled(me.CoinbaseWallet))return this.autoConnectIfWalletBrowser(me.CoinbaseWallet)}catch(c){console.error(c)}let e=this.getUserEnv(),n=q(j.Login,[e]),u=this.request(n);return u.on(Ke.WalletSelected,c=>this.handleWalletSelected(In(Wr({},c),{payloadId:n.id}))),u})}showUI(){let e=q(j.ShowUI);return this.request(e)}getInfo(){return de(this,null,function*(){ze({method:"wallet.getInfo()",removalVersions:{"magic-sdk":"v18.0.0","@magic-sdk/react-native":"v14.0.0","@magic-sdk/react-native-bare":"v19.0.0","@magic-sdk/react-native-expo":"v19.0.0"},useInstead:"user.getInfo()"}).log();let e=yield ke(this.localForageKey),n=q(j.GetInfo,[{walletType:e}]);return this.request(n)})}disconnect(){ze({method:"wallet.disconnect()",removalVersions:{"magic-sdk":"v18.0.0","@magic-sdk/react-native":"v14.0.0","@magic-sdk/react-native-bare":"v19.0.0","@magic-sdk/react-native-expo":"v19.0.0"},useInstead:"user.logout()"}).log(),Bn(),Ct(this.localForageKey);let e=q(j.Disconnect);return this.request(e)}requestUserInfoWithUI(e){ze({method:"wallet.requestUserInfoWithUI()",removalVersions:{"magic-sdk":"v18.0.0","@magic-sdk/react-native":"v14.0.0","@magic-sdk/react-native-bare":"v19.0.0","@magic-sdk/react-native-expo":"v19.0.0"},useInstead:"user.requestUserInfoWithUI()"}).log();let n=q(j.RequestUserInfoWithUI,e?[e]:[]);return this.request(n)}getProvider(){return de(this,null,function*(){switch(yield ke(this.localForageKey)){case me.MetaMask:return this.getMetaMaskProvider();case me.CoinbaseWallet:return this.getCoinbaseProvider();default:return this.sdk.rpcProvider}})}isMetaMaskInstalled(){var e,n,u;return((e=window.ethereum)==null?void 0:e.isMetaMask)||!!((u=(n=window.ethereum)==null?void 0:n.providers)!=null&&u.find(c=>c==null?void 0:c.isMetaMask))}isMetaMaskBrowser(){return this.isMobile()&&this.isMetaMaskInstalled()}getMetaMaskProvider(){var e,n;return((n=(e=window.ethereum)==null?void 0:e.providers)==null?void 0:n.find(u=>u==null?void 0:u.isMetaMask))||window.ethereum}connectToMetaMask(){if(this.isMobile()&&!this.isMetaMaskInstalled()){let e=`https://metamask.app.link/dapp/${window.location.href.replace(/(^\w+:|^)\/\//,"")}`;window.location.href=e}return this.getMetaMaskProvider().request({method:"eth_requestAccounts"})}isCoinbaseWalletInstalled(){var e,n,u;return((e=window.ethereum)==null?void 0:e.isCoinbaseWallet)||!!((u=(n=window.ethereum)==null?void 0:n.providers)!=null&&u.find(c=>c==null?void 0:c.isCoinbaseWallet))}isCoinbaseWalletBrowser(){var e;return!!((e=window.ethereum)!=null&&e.isCoinbaseBrowser)}getCoinbaseProvider(){var e,n;return((n=(e=window.ethereum)==null?void 0:e.providers)==null?void 0:n.find(u=>u==null?void 0:u.isCoinbaseWallet))||window.ethereum}connectToCoinbaseWallet(){if(this.isMobile()&&!this.isCoinbaseWalletBrowser()){let e=`https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(window.location.href)}`;window.location.href=e}return this.getCoinbaseProvider().request({method:"eth_requestAccounts"})}isMobile(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Silk|Opera Mini/i.test(navigator.userAgent)}getUserEnv(){return{env:{isMetaMaskInstalled:this.isMetaMaskInstalled(),isCoinbaseWalletInstalled:this.isCoinbaseWalletInstalled()}}}connectToThirdPartyWallet(e){switch(e){case me.MetaMask:return this.connectToMetaMask();case me.CoinbaseWallet:return this.connectToCoinbaseWallet();default:throw new Error(`Invalid provider: ${e}. Must be one of "metamask" or "coinbase_wallet".`)}}isWalletEnabled(e){let n=q("mc_is_wallet_enabled",[{wallet:e}]);return this.request(n)}handleWalletSelected(e){return de(this,null,function*(){try{let n=yield this.connectToThirdPartyWallet(e.wallet);yield Xe(this.localForageKey,e.wallet),this.createIntermediaryEvent(Ke.WalletConnected,e.payloadId)(n)}catch(n){console.error(n),this.createIntermediaryEvent(Ke.WalletRejected,e.payloadId)()}})}autoConnectIfWalletBrowser(e){return de(this,null,function*(){let n;e===me.MetaMask&&(n=yield this.getMetaMaskProvider().request({method:"eth_requestAccounts"})),e===me.CoinbaseWallet&&(n=yield this.getCoinbaseProvider().request({method:"eth_requestAccounts"})),yield Xe(this.localForageKey,e);let u=q(j.AutoConnect,[{wallet:e,address:n}]);return this.request(u)})}},{createBoundEmitterMethod:Ot,createChainingEmitterMethod:Ve}=Ln(),Di=class extends Ge{constructor(){super(...arguments),this.isMagic=!0,this.on=Ve("on",this),this.once=Ve("once",this),this.addListener=Ve("addListener",this),this.off=Ve("off",this),this.removeListener=Ve("removeListener",this),this.removeAllListeners=Ve("removeAllListeners",this),this.emit=Ot("emit"),this.eventNames=Ot("eventNames"),this.listeners=Ot("listeners"),this.listenerCount=Ot("listenerCount")}sendAsync(e,n){if(!n)throw ui({procedure:"Magic.rpcProvider.sendAsync",argument:1,expected:"function",received:n===null?"null":typeof n});if(Array.isArray(e))this.overlay.post(Fe.MAGIC_HANDLE_REQUEST,e.map(u=>{let c=Pt(u);return this.prefixPayloadMethodForTestMode(c),c})).then(u=>{n(null,u.map(c=>In(Wr({},c.payload),{error:c.hasError?new qe(c.payload.error):null})))});else{let u=Pt(e);this.prefixPayloadMethodForTestMode(u),this.overlay.post(Fe.MAGIC_HANDLE_REQUEST,u).then(c=>{n(c.hasError?new qe(c.payload.error):null,c.payload)})}}send(e,n){if(typeof e=="string"){let c=q(e,Array.isArray(n)?n:[]);return this.request(c)}if(Array.isArray(e)||!!n){this.sendAsync(e,n);return}let u=ci();return u.log(),new Gr(e).applyError({code:-32603,message:u.rawMessage}).payload}enable(){let e=q("eth_accounts");return this.request(e)}request(e){return this.prefixPayloadMethodForTestMode(e),super.request(e)}prefixPayloadMethodForTestMode(e){let n="testMode/eth/";this.sdk.testMode&&(e.method=`${n}${e.method}`)}};function wt(e,n){return n?new URL(e,n):new URL(e)}var yn=["request","overlay","sdk"];function $i(e){let n=Object.getPrototypeOf(e),u=[n];for(;n!==Ge.prototype;)n=Object.getPrototypeOf(n),u.push(n);return u}var Fn=class extends Ge{constructor(){super(void 0),this.__sdk_access_field_descriptors__=new Map,this.__is_initialized__=!1,this.utils={createPromiEvent:Cn,isPromiEvent:jr,encodeJSON:wn,decodeJSON:Zo,createJsonRpcRequestPayload:q,standardizeJsonRpcRequestPayload:Pt,storage:$n};let e=[this,...$i(this)];yn.forEach(n=>{let u=e.map(I=>Object.getOwnPropertyDescriptor(I,n)),c=u.findIndex(I=>!!I),l=c>0,d=u[c];d&&(this.__sdk_access_field_descriptors__.set(n,{descriptor:d,isPrototypeField:l}),Object.defineProperty(this,n,{configurable:!0,get:()=>{throw ai(n)}}))})}init(e){this.__is_initialized__||(yn.forEach(n=>{if(this.__sdk_access_field_descriptors__.has(n)){let{descriptor:u,isPrototypeField:c}=this.__sdk_access_field_descriptors__.get(n);c?delete this[n]:Object.defineProperty(this,n,u)}}),this.sdk=e,this.__is_initialized__=!0)}createDeprecationWarning(e){let{method:n,removalVersion:u,useInstead:c}=e,l=c?` Use \`${c}\` instead.`:"",d=`\`${n}\` will be removed from this Extension in version \`${u}\`.${l}`;return new Lt(this,"DEPRECATION_NOTICE",d)}createWarning(e,n){return new Lt(this,e,n)}createError(e,n,u){return new xt(this,e,n,u)}},xi=class extends Fn{},We=class extends Fn{};We.Internal=xi,We.Anonymous="anonymous extension";var Bi=class extends Ge{purchase(e){let n=q(j.NFTPurchase,[e]);return this.request(n)}};function _n(e){return e.compat&&e.compat[ne.sdkName]!=null?typeof e.compat[ne.sdkName]=="string"?Yo(zo(ne.version),e.compat[ne.sdkName]):!!e.compat[ne.sdkName]:!0}function Ui(e){var n;let u=(n=e==null?void 0:e.extensions)!=null?n:[],c={},l=[];if(Array.isArray(u)?u.forEach(d=>{_n(d)?(d.init(this),(d.name||d.name!==We.Anonymous)&&(this[d.name]=d),d instanceof We.Internal&&(Fr(d.config)||(c[d.name]=d.config))):l.push(d)}):Object.keys(u).forEach(d=>{if(_n(u[d])){u[d].init(this);let I=u[d];this[d]=I,I instanceof We.Internal&&(Fr(I.config)||(c[u[d].name]=I.config))}else l.push(u[d])}),l.length)throw si(l);return c}var Mt=class{constructor(e,n){this.apiKey=e;var u;if(!e)throw oi();ne.platform==="react-native"&&(n==null?void 0:n.endpoint)&&fi().log();let{defaultEndpoint:c,version:l}=ne;this.testMode=!!(n!=null&&n.testMode),this.endpoint=wt((u=n==null?void 0:n.endpoint)!=null?u:c).origin,this.auth=new pi(this),this.user=new Pi(this),this.wallet=new Ci(this),this.nft=new Bi(this),this.rpcProvider=new Di(this);let d=Ui.call(this,n);this.parameters=wn(Wr({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:n==null?void 0:n.network,host:wt(this.endpoint).host,sdk:ni[ne.sdkName],version:l,ext:Fr(d)?void 0:d,locale:(n==null?void 0:n.locale)||"en_US"},ne.bundleId?{bundleId:ne.bundleId}:{}))}get overlay(){if(!Mt.__overlays__.has(this.parameters)){let e=new ne.ViewController(this.endpoint,this.parameters);e.init(),Mt.__overlays__.set(this.parameters,e)}return Mt.__overlays__.get(this.parameters)}preload(){return de(this,null,function*(){yield this.overlay.ready})}},Vr=Mt;Vr.__overlays__=new Map;function Fi(e,n){return n&&Array.isArray(e)?e.find(u=>u.id===n):e}function Wi(e,n){var u;let c=(u=n.data.response)==null?void 0:u.id,l=Fi(e,c);if(c&&l){let d=new Gr(l).applyResult(n.data.response.result).applyError(n.data.response.error);return{id:c,response:d}}return{}}function ki(e,n){return de(this,null,function*(){let u=yield ke("rt"),c;if(ne.platform==="web")try{c=yield Si()}catch(l){console.error("webcrypto error",l)}return c?u?{msgType:e,payload:n,jwt:c,rt:u}:{msgType:e,payload:n,jwt:c}:{msgType:e,payload:n}})}function Gi(e){return de(this,null,function*(){!e.data.rt||(yield Xe("rt",e.data.rt))})}var Wn=class{constructor(e,n){this.endpoint=e,this.parameters=n,this.messageHandlers=new Set,this.ready=this.waitForReady(),this.listen()}post(e,n){return de(this,null,function*(){return Dn(u=>de(this,null,function*(){yield this.ready;let c=[],l=Array.isArray(n)?n.map(E=>E.id):[],d=yield ki(`${e}-${this.parameters}`,n);yield this._post(d);let I=E=>R=>{let{id:S,response:O}=Wi(n,R);Gi(R),S&&O&&Array.isArray(n)&&l.includes(S)?(c.push(O),c.length===n.length&&(E(),u(c))):S&&O&&!Array.isArray(n)&&S===n.id&&(E(),u(O))},b=this.on(Re.MAGIC_HANDLE_RESPONSE,I(()=>b()))}))})}on(e,n){let u=n.bind(window),c=l=>{l.data.msgType===`${e}-${this.parameters}`&&u(l)};return this.messageHandlers.add(c),()=>this.messageHandlers.delete(c)}waitForReady(){return new Promise(e=>{this.on(Re.MAGIC_OVERLAY_READY,()=>e())})}listen(){this.on(Re.MAGIC_HIDE_OVERLAY,()=>{this.hideOverlay()}),this.on(Re.MAGIC_SHOW_OVERLAY,()=>{this.showOverlay()})}};var Hr={};en(Hr,{EthChainType:()=>rn,Events:()=>Ke,Extension:()=>We,ExtensionError:()=>xt,ExtensionWarning:()=>Lt,MagicIncomingWindowMessage:()=>Re,MagicOutgoingWindowMessage:()=>Fe,MagicPayloadMethod:()=>j,RPCError:()=>qe,RPCErrorCode:()=>Ye,SDKError:()=>Se,SDKErrorCode:()=>we,SDKWarning:()=>Qe,SDKWarningCode:()=>Ue,Wallets:()=>me,isPromiEvent:()=>jr});var Wt=xr(Gn()),qr=xr(Yn());var ji={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};function Yi(e){for(let[n,u]of Object.entries(ji))e.style[n]=u}function Ki(e){let n=[].slice.call(document.querySelectorAll(".magic-iframe"));return Boolean(n.find(u=>u.src.includes(e)))}var Ft=class extends Wn{constructor(){super(...arguments);this.activeElement=null}init(){this.test="hello",this.iframe=new Promise(u=>{let c=()=>{if(Ki(encodeURIComponent(this.parameters)))Nn().log();else{let l=document.createElement("iframe");l.classList.add("magic-iframe"),l.dataset.magicIframeLabel=wt(this.endpoint).host,l.title="Secure Modal",l.src=wt(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href,Yi(l),document.body.appendChild(l),u(l)}};["loaded","interactive","complete"].includes(document.readyState)?c():window.addEventListener("load",c,!1)}),window.addEventListener("message",u=>{var c;if(u.origin===this.endpoint&&u.data&&u.data.msgType&&this.messageHandlers.size){u.data.response=(c=u.data.response)!=null?c:{};for(let l of this.messageHandlers.values())l(u)}})}showOverlay(){return je(this,null,function*(){let u=yield this.iframe;u.style.display="block",this.activeElement=document.activeElement,u.focus()})}hideOverlay(){return je(this,null,function*(){var c;let u=yield this.iframe;u.style.display="none",(c=this.activeElement)!=null&&c.focus&&this.activeElement.focus(),this.activeElement=null})}_post(u){return je(this,null,function*(){let c=yield this.iframe;if(c&&c.contentWindow)c.contentWindow.postMessage(u,this.endpoint);else throw An()})}};var Vi=Object.assign(Sn(Vr,{platform:"web",sdkName:"magic-sdk",version:"17.0.0",defaultEndpoint:"https://auth.magic.link/",ViewController:Ft,configureStorage:()=>je(void 0,null,function*(){let e=Wt.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return yield e.defineDriver(qr),yield e.setDriver([Wt.default.INDEXEDDB,Wt.default.LOCALSTORAGE,qr._driver]),e})}),Zr({},Hr)),Hi=Vi;return Jn(zi);})();
|
5
|
+
Received: \`${e.received}\``)}function Mr(){return new Ue(be.DuplicateIframe,"Duplicate iframes found.")}function no(){return new Ue(be.SyncWeb3Method,"Non-async web3 methods are deprecated in web3 > 1.0 and are not supported by the Magic web3 provider. Please use an async method instead.")}function io(){return new Ue(be.ReactNativeEndpointConfiguration,`CUSTOM DOMAINS ARE NOT SUPPORTED WHEN USING MAGIC SDK WITH REACT NATIVE! The \`endpoint\` parameter SHOULD NOT be provided. The Magic \`<iframe>\` is automatically wrapped by a WebView pointed at \`${H.defaultEndpoint}\`. Changing this default behavior will lead to unexpected results and potentially security-threatening bugs.`)}function Ce(e){let{method:t,removalVersions:n,useInstead:o}=e,s=n[H.sdkName],c=o?` Use \`${o}\` instead.`:"",m=`\`${t}\` will be removed from \`${H.sdkName}\` in version \`${s}\`.${c}`;return new Ue(be.DeprecationNotice,m)}function*oo(){let e=0;for(;;)e<Number.MAX_SAFE_INTEGER?yield++e:e=0}var ao=oo();function Tr(){return ao.next().value}var Or=Symbol("Payload pre-processed by Magic SDK");function Lr(e){return Object.defineProperty(e,Or,{value:!0,enumerable:!1}),e}function so(e){return!!e[Or]}function ot(e){var t,n,o;return so(e)||(e.jsonrpc=(t=e.jsonrpc)!=null?t:"2.0",e.id=Tr(),e.method=(n=e.method)!=null?n:"noop",e.params=(o=e.params)!=null?o:[],Lr(e)),e}function K(e,t=[]){return Lr({params:t,method:e,jsonrpc:"2.0",id:Tr()})}var At=class{constructor(e){e instanceof At?(this._jsonrpc=e.payload.jsonrpc,this._id=e.payload.id,this._result=e.payload.result,this._error=e.payload.error):Xi(e)?(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=e.result,this._error=e.error):(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=void 0,this._error=void 0)}applyError(e){return this._error=e,this}applyResult(e){return this._result=e,this}get hasError(){return typeof this._error!="undefined"&&this._error!==null}get hasResult(){return typeof this._result!="undefined"}get payload(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}}},lo=ni(ii()),co=class extends lo.default{};function Pr(){let e=new co;return{emitter:e,createChainingEmitterMethod:(t,n)=>(...o)=>(e[t].apply(e,o),n),createBoundEmitterMethod:t=>(...n)=>e[t].apply(e,n)}}var Cr=Symbol("isPromiEvent");function St(e){return!!e[Cr]}function $r(e){let t=Dr(e),{createBoundEmitterMethod:n,createChainingEmitterMethod:o}=Pr(),s=Symbol("Promise.then"),c=Symbol("Promise.catch"),m=Symbol("Promise.finally"),p=(y,N)=>(...I)=>{let M=N[y].apply(N,I);return v(M)},v=y=>Object.assign(y,{[Cr]:!0,[s]:y[s]||y.then,[c]:y[c]||y.catch,[m]:y[m]||y.finally,then:p(s,y),catch:p(c,y),finally:p(m,y),on:o("on",y),once:o("once",y),addListener:o("addListener",y),off:o("off",y),removeListener:o("removeListener",y),removeAllListeners:o("removeAllListeners",y),emit:n("emit"),eventNames:n("eventNames"),listeners:n("listeners"),listenerCount:n("listenerCount")}),g=v(t.then(y=>(g.emit("done",y),g.emit("settled"),y),y=>{throw g.emit("error",y),g.emit("settled"),y}));return g}function Dr(e){return new Promise((t,n)=>{let o=e(t,n);Promise.resolve(o).catch(n)})}var Ae=class{constructor(e){this.sdk=e}get overlay(){return this.sdk.overlay}request(e){let t=this.overlay.post(we.MAGIC_HANDLE_REQUEST,ot(e)),n=$r((s,c)=>{t.then(m=>{if(o(),m.hasError)c(new $e(m.payload.error));else if(m.hasResult)s(m.payload.result);else throw Zi()}).catch(m=>{o(),c(m)})}),o=this.overlay.on(he.MAGIC_HANDLE_EVENT,s=>{var c;let{response:m}=s.data;if(m.id===e.id&&((c=m.result)==null?void 0:c.event)){let{event:p,params:v=[]}=m.result;n.emit(p,...v)}});return n}createIntermediaryEvent(e,t){return n=>{let o=K($.IntermediaryEvent,[{payloadId:t,eventType:e,args:n}]);this.request(o)}}},uo=class extends Ae{loginWithMagicLink(e){let{email:t,showUI:n=!0,redirectURI:o}=e,s=K(this.sdk.testMode?$.LoginWithMagicLinkTestMode:$.LoginWithMagicLink,[{email:t,showUI:n,redirectURI:o}]);return this.request(s)}loginWithSMS(e){let{phoneNumber:t}=e,n=K(this.sdk.testMode?$.LoginWithSmsTestMode:$.LoginWithSms,[{phoneNumber:t,showUI:!0}]);return this.request(n)}loginWithEmailOTP(e){let{email:t,showUI:n}=e,o=K(this.sdk.testMode?$.LoginWithEmailOTPTestMode:$.LoginWithEmailOTP,[{email:t,showUI:n}]);if(!n){let s=this.request(o);return s&&(s.on("verify-email-otp",c=>{this.createIntermediaryEvent("verify-email-otp",o.id)(c)}),s.on("cancel",()=>{this.createIntermediaryEvent("cancel",o.id)()})),s}return this.request(o)}loginWithCredential(e){let t=e!=null?e:"";if(!e&&H.platform==="web"){t=window.location.search;let o=window.location.origin+window.location.pathname;window.history.replaceState(null,"",o)}let n=K(this.sdk.testMode?$.LoginWithCredentialTestMode:$.LoginWithCredential,[t]);return this.request(n)}setAuthorizationToken(){let e=K($.SetAuthorizationToken);return this.request(e)}updateEmailWithUI(e){let{email:t,showUI:n=!0}=e,o=K(this.sdk.testMode?$.UpdateEmailTestMode:$.UpdateEmail,[{email:t,showUI:n}]);return this.request(o)}updatePhoneNumberWithUI(){let e=K(this.sdk.testMode?$.UpdatePhoneNumberTestMode:$.UpdatePhoneNumber);return this.request(e)}},xr={};ti(xr,{clear:()=>fo,getItem:()=>ye,iterate:()=>vo,key:()=>po,keys:()=>mo,length:()=>ho,removeItem:()=>Ye,setItem:()=>De});var tt;function Ee(e){return(...t)=>ae(this,null,function*(){return tt||(tt=yield H.configureStorage()),yield tt.ready(),tt[e](...t)})}var ye=Ee("getItem"),De=Ee("setItem"),Ye=Ee("removeItem"),fo=Ee("clear"),ho=Ee("length"),po=Ee("key"),mo=Ee("keys"),vo=Ee("iterate");function go(){let e=window.crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&191|128;let t="";return t+=e[0].toString(16),t+=e[1].toString(16),t+=e[2].toString(16),t+=e[3].toString(16),t+="-",t+=e[4].toString(16),t+=e[5].toString(16),t+="-",t+=e[6].toString(16),t+=e[7].toString(16),t+="-",t+=e[8].toString(16),t+=e[9].toString(16),t+="-",t+=e[10].toString(16),t+=e[11].toString(16),t+=e[12].toString(16),t+=e[13].toString(16),t+=e[14].toString(16),t+=e[15].toString(16),t}var Nt="STORE_KEY_PRIVATE_KEY",at="STORE_KEY_PUBLIC_JWK",Mt="ECDSA",Ur="P-256",yo={name:Mt,namedCurve:Ur},Eo={name:Mt,namedCurve:Ur};function kr(){Ye(at),Ye(Nt)}function _o(){return ae(this,null,function*(){let e=yield Io();if(!e){console.info("unable to create public key or webcrypto is unsupported");return}let{subtle:t}=window.crypto,n=yield ye(Nt);if(!n||!t){console.info("unable to find private key or webcrypto unsupported");return}let o={iat:Math.floor(new Date().getTime()/1e3),jti:go()},s={typ:"dpop+jwt",alg:"ES256",jwk:e},c={protected:yr(JSON.stringify(s)),claims:yr(JSON.stringify(o))},m=Ro(`${c.protected}.${c.claims}`),p={name:Mt,hash:{name:"SHA-256"}},v=So(new Uint8Array(yield t.sign(p,n,m)));return`${c.protected}.${c.claims}.${v}`})}function Io(){return ae(this,null,function*(){if(!wo()){console.info("webcrypto is not supported");return}return(yield ye(at))||(yield bo()),ye(at)})}function bo(){return ae(this,null,function*(){let e=null,{subtle:t}=window.crypto,n=yield t.generateKey(yo,!0,["sign"]),o=yield t.exportKey("jwk",n.privateKey);e=yield t.exportKey("jwk",n.publicKey);let s=yield t.importKey("jwk",o,Eo,!1,["sign"]);yield De(Nt,s),yield De(at,e)})}function wo(){let e=typeof window!="undefined"&&!!window.crypto,t=e&&!!window.crypto.subtle;return e&&t}function yr(e){return Br(Ao(e))}function Ro(e){return new TextEncoder().encode(e)}function Br(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+/g,"")}function Ao(e){return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(t,n)=>String.fromCharCode(parseInt(n,16)))}function So(e){let t="";return e.forEach(n=>{t+=String.fromCharCode(n)}),Br(t)}var No=class extends Ae{constructor(){super(...arguments),this.localForageKey="mc_active_wallet"}getIdToken(e){let t=K(this.sdk.testMode?$.GetIdTokenTestMode:$.GetIdToken,[e]);return this.request(t)}generateIdToken(e){let t=K(this.sdk.testMode?$.GenerateIdTokenTestMode:$.GenerateIdToken,[e]);return this.request(t)}getInfo(){return ae(this,null,function*(){let e=yield ye(this.localForageKey),t=K($.GetInfo,[{walletType:e}]);return this.request(t)})}isLoggedIn(){let e=K(this.sdk.testMode?$.IsLoggedInTestMode:$.IsLoggedIn);return this.request(e)}logout(){kr(),Ye(this.localForageKey);let e=K(this.sdk.testMode?$.LogoutTestMode:$.Logout);return this.request(e)}requestInfoWithUI(e){let t=K($.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}showSettings(){let e=K(this.sdk.testMode?$.UserSettingsTestMode:$.UserSettings);return this.request(e)}recoverAccount(e){let t=K(this.sdk.testMode?$.RecoverAccountTestMode:$.RecoverAccount,[e]);return this.request(t)}getMetadata(){Ce({method:"user.getMetadata()",removalVersions:{"magic-sdk":"v18.0.0","@magic-sdk/react-native":"v14.0.0","@magic-sdk/react-native-bare":"v19.0.0","@magic-sdk/react-native-expo":"v19.0.0"},useInstead:"user.getInfo()"}).log();let e=K(this.sdk.testMode?$.GetMetadataTestMode:$.GetMetadata);return this.request(e)}updateEmail(e){Ce({method:"user.updateEmail()",removalVersions:{"magic-sdk":"v18.0.0","@magic-sdk/react-native":"v14.0.0","@magic-sdk/react-native-bare":"v19.0.0","@magic-sdk/react-native-expo":"v19.0.0"},useInstead:"auth.updateEmailWithUI()"}).log();let{email:t,showUI:n=!0}=e,o=K(this.sdk.testMode?$.UpdateEmailTestMode:$.UpdateEmail,[{email:t,showUI:n}]);return this.request(o)}updatePhoneNumber(){Ce({method:"user.updatePhoneNumber()",removalVersions:{"magic-sdk":"v18.0.0","@magic-sdk/react-native":"v14.0.0","@magic-sdk/react-native-bare":"v19.0.0","@magic-sdk/react-native-expo":"v19.0.0"},useInstead:"auth.updatePhoneNumberWithUI()"}).log();let e=K(this.sdk.testMode?$.UpdatePhoneNumberTestMode:$.UpdatePhoneNumber);return this.request(e)}},Mo=class extends Ae{constructor(){super(...arguments),this.localForageKey="mc_active_wallet"}connectWithUI(){return ae(this,null,function*(){if(this.isMetaMaskBrowser())try{if(yield this.isWalletEnabled(ce.MetaMask))return this.autoConnectIfWalletBrowser(ce.MetaMask)}catch(o){console.error(o)}if(this.isCoinbaseWalletBrowser())try{if(yield this.isWalletEnabled(ce.CoinbaseWallet))return this.autoConnectIfWalletBrowser(ce.CoinbaseWallet)}catch(o){console.error(o)}let e=this.getUserEnv(),t=K($.Login,[e]),n=this.request(t);return n.on(Oe.WalletSelected,o=>this.handleWalletSelected(br(wt({},o),{payloadId:t.id}))),n})}showUI(){let e=K($.ShowUI);return this.request(e)}getInfo(){return ae(this,null,function*(){Ce({method:"wallet.getInfo()",removalVersions:{"magic-sdk":"v18.0.0","@magic-sdk/react-native":"v14.0.0","@magic-sdk/react-native-bare":"v19.0.0","@magic-sdk/react-native-expo":"v19.0.0"},useInstead:"user.getInfo()"}).log();let e=yield ye(this.localForageKey),t=K($.GetInfo,[{walletType:e}]);return this.request(t)})}disconnect(){Ce({method:"wallet.disconnect()",removalVersions:{"magic-sdk":"v18.0.0","@magic-sdk/react-native":"v14.0.0","@magic-sdk/react-native-bare":"v19.0.0","@magic-sdk/react-native-expo":"v19.0.0"},useInstead:"user.logout()"}).log(),kr(),Ye(this.localForageKey);let e=K($.Disconnect);return this.request(e)}requestUserInfoWithUI(e){Ce({method:"wallet.requestUserInfoWithUI()",removalVersions:{"magic-sdk":"v18.0.0","@magic-sdk/react-native":"v14.0.0","@magic-sdk/react-native-bare":"v19.0.0","@magic-sdk/react-native-expo":"v19.0.0"},useInstead:"user.requestUserInfoWithUI()"}).log();let t=K($.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}getProvider(){return ae(this,null,function*(){switch(yield ye(this.localForageKey)){case ce.MetaMask:return this.getMetaMaskProvider();case ce.CoinbaseWallet:return this.getCoinbaseProvider();default:return this.sdk.rpcProvider}})}isMetaMaskInstalled(){var e,t,n;return((e=window.ethereum)==null?void 0:e.isMetaMask)||!!((n=(t=window.ethereum)==null?void 0:t.providers)!=null&&n.find(o=>o==null?void 0:o.isMetaMask))}isMetaMaskBrowser(){return this.isMobile()&&this.isMetaMaskInstalled()}getMetaMaskProvider(){var e,t;return((t=(e=window.ethereum)==null?void 0:e.providers)==null?void 0:t.find(n=>n==null?void 0:n.isMetaMask))||window.ethereum}connectToMetaMask(){if(this.isMobile()&&!this.isMetaMaskInstalled()){let e=`https://metamask.app.link/dapp/${window.location.href.replace(/(^\w+:|^)\/\//,"")}`;window.location.href=e}return this.getMetaMaskProvider().request({method:"eth_requestAccounts"})}isCoinbaseWalletInstalled(){var e,t,n;return((e=window.ethereum)==null?void 0:e.isCoinbaseWallet)||!!((n=(t=window.ethereum)==null?void 0:t.providers)!=null&&n.find(o=>o==null?void 0:o.isCoinbaseWallet))}isCoinbaseWalletBrowser(){var e;return!!((e=window.ethereum)!=null&&e.isCoinbaseBrowser)}getCoinbaseProvider(){var e,t;return((t=(e=window.ethereum)==null?void 0:e.providers)==null?void 0:t.find(n=>n==null?void 0:n.isCoinbaseWallet))||window.ethereum}connectToCoinbaseWallet(){if(this.isMobile()&&!this.isCoinbaseWalletBrowser()){let e=`https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(window.location.href)}`;window.location.href=e}return this.getCoinbaseProvider().request({method:"eth_requestAccounts"})}isMobile(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Silk|Opera Mini/i.test(navigator.userAgent)}getUserEnv(){return{env:{isMetaMaskInstalled:this.isMetaMaskInstalled(),isCoinbaseWalletInstalled:this.isCoinbaseWalletInstalled()}}}connectToThirdPartyWallet(e){switch(e){case ce.MetaMask:return this.connectToMetaMask();case ce.CoinbaseWallet:return this.connectToCoinbaseWallet();default:throw new Error(`Invalid provider: ${e}. Must be one of "metamask" or "coinbase_wallet".`)}}isWalletEnabled(e){let t=K("mc_is_wallet_enabled",[{wallet:e}]);return this.request(t)}handleWalletSelected(e){return ae(this,null,function*(){try{let t=yield this.connectToThirdPartyWallet(e.wallet);yield De(this.localForageKey,e.wallet),this.createIntermediaryEvent(Oe.WalletConnected,e.payloadId)(t)}catch(t){console.error(t),this.createIntermediaryEvent(Oe.WalletRejected,e.payloadId)()}})}autoConnectIfWalletBrowser(e){return ae(this,null,function*(){let t;e===ce.MetaMask&&(t=yield this.getMetaMaskProvider().request({method:"eth_requestAccounts"})),e===ce.CoinbaseWallet&&(t=yield this.getCoinbaseProvider().request({method:"eth_requestAccounts"})),yield De(this.localForageKey,e);let n=K($.AutoConnect,[{wallet:e,address:t}]);return this.request(n)})}},{createBoundEmitterMethod:rt,createChainingEmitterMethod:Le}=Pr(),To=class extends Ae{constructor(){super(...arguments),this.isMagic=!0,this.on=Le("on",this),this.once=Le("once",this),this.addListener=Le("addListener",this),this.off=Le("off",this),this.removeListener=Le("removeListener",this),this.removeAllListeners=Le("removeAllListeners",this),this.emit=rt("emit"),this.eventNames=rt("eventNames"),this.listeners=rt("listeners"),this.listenerCount=rt("listenerCount")}sendAsync(e,t){if(!t)throw ro({procedure:"Magic.rpcProvider.sendAsync",argument:1,expected:"function",received:t===null?"null":typeof t});if(Array.isArray(e))this.overlay.post(we.MAGIC_HANDLE_REQUEST,e.map(n=>{let o=ot(n);return this.prefixPayloadMethodForTestMode(o),o})).then(n=>{t(null,n.map(o=>br(wt({},o.payload),{error:o.hasError?new $e(o.payload.error):null})))});else{let n=ot(e);this.prefixPayloadMethodForTestMode(n),this.overlay.post(we.MAGIC_HANDLE_REQUEST,n).then(o=>{t(o.hasError?new $e(o.payload.error):null,o.payload)})}}send(e,t){if(typeof e=="string"){let o=K(e,Array.isArray(t)?t:[]);return this.request(o)}if(Array.isArray(e)||!!t){this.sendAsync(e,t);return}let n=no();return n.log(),new At(e).applyError({code:-32603,message:n.rawMessage}).payload}enable(){let e=K("eth_accounts");return this.request(e)}request(e){return this.prefixPayloadMethodForTestMode(e),super.request(e)}prefixPayloadMethodForTestMode(e){let t="testMode/eth/";this.sdk.testMode&&(e.method=`${t}${e.method}`)}};function He(e,t){return t?new URL(e,t):new URL(e)}var Er=["request","overlay","sdk"];function Oo(e){let t=Object.getPrototypeOf(e),n=[t];for(;t!==Ae.prototype;)t=Object.getPrototypeOf(t),n.push(t);return n}var Wr=class extends Ae{constructor(){super(void 0),this.__sdk_access_field_descriptors__=new Map,this.__is_initialized__=!1,this.utils={createPromiEvent:$r,isPromiEvent:St,encodeJSON:Rr,decodeJSON:Yi,createJsonRpcRequestPayload:K,standardizeJsonRpcRequestPayload:ot,storage:xr};let e=[this,...Oo(this)];Er.forEach(t=>{let n=e.map(m=>Object.getOwnPropertyDescriptor(m,t)),o=n.findIndex(m=>!!m),s=o>0,c=n[o];c&&(this.__sdk_access_field_descriptors__.set(t,{descriptor:c,isPrototypeField:s}),Object.defineProperty(this,t,{configurable:!0,get:()=>{throw eo(t)}}))})}init(e){this.__is_initialized__||(Er.forEach(t=>{if(this.__sdk_access_field_descriptors__.has(t)){let{descriptor:n,isPrototypeField:o}=this.__sdk_access_field_descriptors__.get(t);o?delete this[t]:Object.defineProperty(this,t,n)}}),this.sdk=e,this.__is_initialized__=!0)}createDeprecationWarning(e){let{method:t,removalVersion:n,useInstead:o}=e,s=o?` Use \`${o}\` instead.`:"",c=`\`${t}\` will be removed from this Extension in version \`${n}\`.${s}`;return new it(this,"DEPRECATION_NOTICE",c)}createWarning(e,t){return new it(this,e,t)}createError(e,t,n){return new lt(this,e,t,n)}},Lo=class extends Wr{},Re=class extends Wr{};Re.Internal=Lo,Re.Anonymous="anonymous extension";var Po=class extends Ae{purchase(e){let t=K($.NFTPurchase,[e]);return this.request(t)}};function _r(e){return e.compat&&e.compat[H.sdkName]!=null?typeof e.compat[H.sdkName]=="string"?ki(Gi(H.version),e.compat[H.sdkName]):!!e.compat[H.sdkName]:!0}function Co(e){var t;let n=(t=e==null?void 0:e.extensions)!=null?t:[],o={},s=[];if(Array.isArray(n)?n.forEach(c=>{_r(c)?(c.init(this),(c.name||c.name!==Re.Anonymous)&&(this[c.name]=c),c instanceof Re.Internal&&(bt(c.config)||(o[c.name]=c.config))):s.push(c)}):Object.keys(n).forEach(c=>{if(_r(n[c])){n[c].init(this);let m=n[c];this[c]=m,m instanceof Re.Internal&&(bt(m.config)||(o[n[c].name]=m.config))}else s.push(n[c])}),s.length)throw to(s);return o}var nt=class{constructor(e,t){this.apiKey=e;var n;if(!e)throw Qi();H.platform==="react-native"&&(t==null?void 0:t.endpoint)&&io().log();let{defaultEndpoint:o,version:s}=H;this.testMode=!!(t!=null&&t.testMode),this.endpoint=He((n=t==null?void 0:t.endpoint)!=null?n:o).origin,this.auth=new uo(this),this.user=new No(this),this.wallet=new Mo(this),this.nft=new Po(this),this.rpcProvider=new To(this);let c=Co.call(this,t);this.parameters=Rr(wt({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:t==null?void 0:t.network,host:He(this.endpoint).host,sdk:Ji[H.sdkName],version:s,ext:bt(c)?void 0:c,locale:(t==null?void 0:t.locale)||"en_US"},H.bundleId?{bundleId:H.bundleId}:{}))}get overlay(){if(!nt.__overlays__.has(this.parameters)){let e=new H.ViewController(this.endpoint,this.parameters);e.init(),nt.__overlays__.set(this.parameters,e)}return nt.__overlays__.get(this.parameters)}preload(){return ae(this,null,function*(){yield this.overlay.ready})}},Tt=nt;Tt.__overlays__=new Map;function $o(e,t){return t&&Array.isArray(e)?e.find(n=>n.id===t):e}function Do(e,t){var n;let o=(n=t.data.response)==null?void 0:n.id,s=$o(e,o);if(o&&s){let c=new At(s).applyResult(t.data.response.result).applyError(t.data.response.error);return{id:o,response:c}}return{}}function xo(e,t){return ae(this,null,function*(){let n=yield ye("rt"),o;if(H.platform==="web")try{o=yield _o()}catch(s){console.error("webcrypto error",s)}return o?n?{msgType:e,payload:t,jwt:o,rt:n}:{msgType:e,payload:t,jwt:o}:{msgType:e,payload:t}})}function Uo(e){return ae(this,null,function*(){!e.data.rt||(yield De("rt",e.data.rt))})}var Fr=class{constructor(e,t){this.endpoint=e,this.parameters=t,this.messageHandlers=new Set,this.ready=this.waitForReady(),this.listen()}post(e,t){return ae(this,null,function*(){return Dr(n=>ae(this,null,function*(){yield this.ready;let o=[],s=Array.isArray(t)?t.map(v=>v.id):[],c=yield xo(`${e}-${this.parameters}`,t);yield this._post(c);let m=v=>g=>{let{id:y,response:N}=Do(t,g);Uo(g),y&&N&&Array.isArray(t)&&s.includes(y)?(o.push(N),o.length===t.length&&(v(),n(o))):y&&N&&!Array.isArray(t)&&y===t.id&&(v(),n(N))},p=this.on(he.MAGIC_HANDLE_RESPONSE,m(()=>p()))}))})}on(e,t){let n=t.bind(window),o=s=>{s.data.msgType===`${e}-${this.parameters}`&&n(s)};return this.messageHandlers.add(o),()=>this.messageHandlers.delete(o)}waitForReady(){return new Promise(e=>{this.on(he.MAGIC_OVERLAY_READY,()=>e())})}listen(){this.on(he.MAGIC_HIDE_OVERLAY,()=>{this.hideOverlay()}),this.on(he.MAGIC_SHOW_OVERLAY,()=>{this.showOverlay()})}};var Ot={};nr(Ot,{EthChainType:()=>ar,Events:()=>Oe,Extension:()=>Re,ExtensionError:()=>lt,ExtensionWarning:()=>it,MagicIncomingWindowMessage:()=>he,MagicOutgoingWindowMessage:()=>we,MagicPayloadMethod:()=>$,RPCError:()=>$e,RPCErrorCode:()=>Te,SDKError:()=>pe,SDKErrorCode:()=>de,SDKWarning:()=>Ue,SDKWarningCode:()=>be,Wallets:()=>ce,isPromiEvent:()=>St});var ft=or(jr()),Pt=or(qr());var ko={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};function Bo(e){for(let[t,n]of Object.entries(ko))e.style[t]=n}function Wo(e){let t=[].slice.call(document.querySelectorAll(".magic-iframe"));return Boolean(t.find(n=>n.src.includes(e)))}var ut=class extends Fr{constructor(){super(...arguments);this.activeElement=null}init(){this.test="hello",this.iframe=new Promise(n=>{let o=()=>{if(Wo(encodeURIComponent(this.parameters)))Mr().log();else{let s=document.createElement("iframe");s.classList.add("magic-iframe"),s.dataset.magicIframeLabel=He(this.endpoint).host,s.title="Secure Modal",s.src=He(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href,Bo(s),document.body.appendChild(s),n(s)}};["loaded","interactive","complete"].includes(document.readyState)?o():window.addEventListener("load",o,!1)}),window.addEventListener("message",n=>{var o;if(n.origin===this.endpoint&&n.data&&n.data.msgType&&this.messageHandlers.size){n.data.response=(o=n.data.response)!=null?o:{};for(let s of this.messageHandlers.values())s(n)}})}showOverlay(){return Me(this,null,function*(){let n=yield this.iframe;n.style.display="block",this.activeElement=document.activeElement,n.focus()})}hideOverlay(){return Me(this,null,function*(){var o;let n=yield this.iframe;n.style.display="none",(o=this.activeElement)!=null&&o.focus&&this.activeElement.focus(),this.activeElement=null})}_post(n){return Me(this,null,function*(){let o=yield this.iframe;if(o&&o.contentWindow)o.contentWindow.postMessage(n,this.endpoint);else throw Nr()})}};var Fo=Object.assign(Sr(Tt,{platform:"web",sdkName:"magic-sdk",version:"17.0.0",defaultEndpoint:"https://auth.magic.link/",ViewController:ut,configureStorage:()=>Me(void 0,null,function*(){let e=ft.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return yield e.defineDriver(Pt),yield e.setDriver([ft.default.INDEXEDDB,ft.default.LOCALSTORAGE,Pt._driver]),e})}),tr({},Ot)),Go=Fo;return Vn(jo);})();
|
6
6
|
if (Magic && Magic.default != null) { Magic = Object.assign(Magic.default, Magic); delete Magic.default; }
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "magic-sdk",
|
3
|
-
"version": "17.1.0-canary.497.
|
3
|
+
"version": "17.1.0-canary.497.4756676437.0",
|
4
4
|
"description": "Passwordless authentication for the web.",
|
5
5
|
"author": "Magic Labs <team@magic.link> (https://magic.link/)",
|
6
6
|
"license": "MIT",
|
@@ -28,9 +28,9 @@
|
|
28
28
|
]
|
29
29
|
},
|
30
30
|
"dependencies": {
|
31
|
-
"@magic-sdk/commons": "13.1.0-canary.497.
|
32
|
-
"@magic-sdk/provider": "17.1.0-canary.497.
|
33
|
-
"@magic-sdk/types": "15.1.0-canary.497.
|
31
|
+
"@magic-sdk/commons": "13.1.0-canary.497.4756676437.0",
|
32
|
+
"@magic-sdk/provider": "17.1.0-canary.497.4756676437.0",
|
33
|
+
"@magic-sdk/types": "15.1.0-canary.497.4756676437.0",
|
34
34
|
"localforage": "^1.7.4"
|
35
35
|
},
|
36
36
|
"devDependencies": {
|
@@ -39,5 +39,5 @@
|
|
39
39
|
"@babel/runtime": "^7.9.6",
|
40
40
|
"localforage-driver-memory": "^1.0.5"
|
41
41
|
},
|
42
|
-
"gitHead": "
|
42
|
+
"gitHead": "f0ce8ea757cab2238aa22daf03e6e03d016e7441"
|
43
43
|
}
|