magic-sdk 28.0.6 → 28.0.7-canary.747.9472447874.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.
Files changed (2) hide show
  1. package/dist/magic.js +10 -4
  2. package/package.json +4 -4
package/dist/magic.js CHANGED
@@ -1,6 +1,12 @@
1
- "use strict";var Magic=(()=>{var ui=Object.create;var Ve=Object.defineProperty;var fi=Object.getOwnPropertyDescriptor;var di=Object.getOwnPropertyNames,ur=Object.getOwnPropertySymbols,hi=Object.getPrototypeOf,dr=Object.prototype.hasOwnProperty,mi=Object.prototype.propertyIsEnumerable;var fr=(e,t,r)=>t in e?Ve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,hr=(e,t)=>{for(var r in t||(t={}))dr.call(t,r)&&fr(e,r,t[r]);if(ur)for(var r of ur(t))mi.call(t,r)&&fr(e,r,t[r]);return e};var Ke=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var mr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),pr=(e,t)=>{for(var r in t)Ve(e,r,{get:t[r],enumerable:!0})},vr=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of di(t))!dr.call(e,a)&&a!==r&&Ve(e,a,{get:()=>t[a],enumerable:!(o=fi(t,a))||o.enumerable});return e};var gr=(e,t,r)=>(r=e!=null?ui(hi(e)):{},vr(t||!e||!e.__esModule?Ve(r,"default",{value:e,enumerable:!0}):r,e)),pi=e=>vr(Ve({},"__esModule",{value:!0}),e);var Pe=(e,t,r)=>new Promise((o,a)=>{var s=g=>{try{h(r.next(g))}catch(v){a(v)}},m=g=>{try{h(r.throw(g))}catch(v){a(v)}},h=g=>g.done?o(g.value):Promise.resolve(g.value).then(s,m);h((r=r.apply(e,t)).next())});var hn=mr((dn,jt)=>{(function(e){if(typeof dn=="object"&&typeof jt<"u")jt.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,r;return function o(a,s,m){function h(y,T){if(!s[y]){if(!a[y]){var _=typeof Ke=="function"&&Ke;if(!T&&_)return _(y,!0);if(g)return g(y,!0);var N=new Error("Cannot find module '"+y+"'");throw N.code="MODULE_NOT_FOUND",N}var L=s[y]={exports:{}};a[y][0].call(L.exports,function(k){var C=a[y][1][k];return h(C||k)},L,L.exports,o,a,s,m)}return s[y].exports}for(var g=typeof Ke=="function"&&Ke,v=0;v<m.length;v++)h(m[v]);return h}({1:[function(o,a,s){(function(m){"use strict";var h=m.MutationObserver||m.WebKitMutationObserver,g;if(h){var v=0,y=new h(k),T=m.document.createTextNode("");y.observe(T,{characterData:!0}),g=function(){T.data=v=++v%2}}else if(!m.setImmediate&&typeof m.MessageChannel<"u"){var _=new m.MessageChannel;_.port1.onmessage=k,g=function(){_.port2.postMessage(0)}}else"document"in m&&"onreadystatechange"in m.document.createElement("script")?g=function(){var B=m.document.createElement("script");B.onreadystatechange=function(){k(),B.onreadystatechange=null,B.parentNode.removeChild(B),B=null},m.document.documentElement.appendChild(B)}:g=function(){setTimeout(k,0)};var N,L=[];function k(){N=!0;for(var B,Q,D=L.length;D;){for(Q=L,L=[],B=-1;++B<D;)Q[B]();D=L.length}N=!1}a.exports=C;function C(B){L.push(B)===1&&!N&&g()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(o,a,s){"use strict";var m=o(1);function h(){}var g={},v=["REJECTED"],y=["FULFILLED"],T=["PENDING"];a.exports=_;function _(S){if(typeof S!="function")throw new TypeError("resolver must be a function");this.state=T,this.queue=[],this.outcome=void 0,S!==h&&C(this,S)}_.prototype.catch=function(S){return this.then(null,S)},_.prototype.then=function(S,G){if(typeof S!="function"&&this.state===y||typeof G!="function"&&this.state===v)return this;var U=new this.constructor(h);if(this.state!==T){var K=this.state===y?S:G;L(U,K,this.outcome)}else this.queue.push(new N(U,S,G));return U};function N(S,G,U){this.promise=S,typeof G=="function"&&(this.onFulfilled=G,this.callFulfilled=this.otherCallFulfilled),typeof U=="function"&&(this.onRejected=U,this.callRejected=this.otherCallRejected)}N.prototype.callFulfilled=function(S){g.resolve(this.promise,S)},N.prototype.otherCallFulfilled=function(S){L(this.promise,this.onFulfilled,S)},N.prototype.callRejected=function(S){g.reject(this.promise,S)},N.prototype.otherCallRejected=function(S){L(this.promise,this.onRejected,S)};function L(S,G,U){m(function(){var K;try{K=G(U)}catch(Z){return g.reject(S,Z)}K===S?g.reject(S,new TypeError("Cannot resolve promise with itself")):g.resolve(S,K)})}g.resolve=function(S,G){var U=B(k,G);if(U.status==="error")return g.reject(S,U.value);var K=U.value;if(K)C(S,K);else{S.state=y,S.outcome=G;for(var Z=-1,oe=S.queue.length;++Z<oe;)S.queue[Z].callFulfilled(G)}return S},g.reject=function(S,G){S.state=v,S.outcome=G;for(var U=-1,K=S.queue.length;++U<K;)S.queue[U].callRejected(G);return S};function k(S){var G=S&&S.then;if(S&&(typeof S=="object"||typeof S=="function")&&typeof G=="function")return function(){G.apply(S,arguments)}}function C(S,G){var U=!1;function K(ce){U||(U=!0,g.reject(S,ce))}function Z(ce){U||(U=!0,g.resolve(S,ce))}function oe(){G(Z,K)}var le=B(oe);le.status==="error"&&K(le.value)}function B(S,G){var U={};try{U.value=S(G),U.status="success"}catch(K){U.status="error",U.value=K}return U}_.resolve=Q;function Q(S){return S instanceof this?S:g.resolve(new this(h),S)}_.reject=D;function D(S){var G=new this(h);return g.reject(G,S)}_.all=_e;function _e(S){var G=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var U=S.length,K=!1;if(!U)return this.resolve([]);for(var Z=new Array(U),oe=0,le=-1,ce=new this(h);++le<U;)de(S[le],le);return ce;function de(Re,d){G.resolve(Re).then(I,function(A){K||(K=!0,g.reject(ce,A))});function I(A){Z[d]=A,++oe===U&&!K&&(K=!0,g.resolve(ce,Z))}}}_.race=ie;function ie(S){var G=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var U=S.length,K=!1;if(!U)return this.resolve([]);for(var Z=-1,oe=new this(h);++Z<U;)le(S[Z]);return oe;function le(ce){G.resolve(ce).then(function(de){K||(K=!0,g.resolve(oe,de))},function(de){K||(K=!0,g.reject(oe,de))})}}},{1:1}],3:[function(o,a,s){(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,a,s){"use strict";var m=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function h(n,l){if(!(n instanceof l))throw new TypeError("Cannot call a class as a function")}function g(){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 v=g();function y(){try{if(!v||!v.open)return!1;var n=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),l=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!n||l)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function T(n,l){n=n||[],l=l||{};try{return new Blob(n,l)}catch(c){if(c.name!=="TypeError")throw c;for(var i=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,u=new i,f=0;f<n.length;f+=1)u.append(n[f]);return u.getBlob(l.type)}}typeof Promise>"u"&&o(3);var _=Promise;function N(n,l){l&&n.then(function(i){l(null,i)},function(i){l(i)})}function L(n,l,i){typeof l=="function"&&n.then(l),typeof i=="function"&&n.catch(i)}function k(n){return typeof n!="string"&&(console.warn(n+" used as a key, but it is not a string."),n=String(n)),n}function C(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var B="local-forage-detect-blob-support",Q=void 0,D={},_e=Object.prototype.toString,ie="readonly",S="readwrite";function G(n){for(var l=n.length,i=new ArrayBuffer(l),u=new Uint8Array(i),f=0;f<l;f++)u[f]=n.charCodeAt(f);return i}function U(n){return new _(function(l){var i=n.transaction(B,S),u=T([""]);i.objectStore(B).put(u,"key"),i.onabort=function(f){f.preventDefault(),f.stopPropagation(),l(!1)},i.oncomplete=function(){var f=navigator.userAgent.match(/Chrome\/(\d+)/),c=navigator.userAgent.match(/Edge\//);l(c||!f||parseInt(f[1],10)>=43)}}).catch(function(){return!1})}function K(n){return typeof Q=="boolean"?_.resolve(Q):U(n).then(function(l){return Q=l,Q})}function Z(n){var l=D[n.name],i={};i.promise=new _(function(u,f){i.resolve=u,i.reject=f}),l.deferredOperations.push(i),l.dbReady?l.dbReady=l.dbReady.then(function(){return i.promise}):l.dbReady=i.promise}function oe(n){var l=D[n.name],i=l.deferredOperations.pop();if(i)return i.resolve(),i.promise}function le(n,l){var i=D[n.name],u=i.deferredOperations.pop();if(u)return u.reject(l),u.promise}function ce(n,l){return new _(function(i,u){if(D[n.name]=D[n.name]||ee(),n.db)if(l)Z(n),n.db.close();else return i(n.db);var f=[n.name];l&&f.push(n.version);var c=v.open.apply(v,f);l&&(c.onupgradeneeded=function(p){var E=c.result;try{E.createObjectStore(n.storeName),p.oldVersion<=1&&E.createObjectStore(B)}catch(w){if(w.name==="ConstraintError")console.warn('The database "'+n.name+'" has been upgraded from version '+p.oldVersion+" to version "+p.newVersion+', but the storage "'+n.storeName+'" already exists.');else throw w}}),c.onerror=function(p){p.preventDefault(),u(c.error)},c.onsuccess=function(){var p=c.result;p.onversionchange=function(E){E.target.close()},i(p),oe(n)}})}function de(n){return ce(n,!1)}function Re(n){return ce(n,!0)}function d(n,l){if(!n.db)return!0;var i=!n.db.objectStoreNames.contains(n.storeName),u=n.version<n.db.version,f=n.version>n.db.version;if(u&&(n.version!==l&&console.warn('The database "'+n.name+`" can't be downgraded from version `+n.db.version+" to version "+n.version+"."),n.version=n.db.version),f||i){if(i){var c=n.db.version+1;c>n.version&&(n.version=c)}return!0}return!1}function I(n){return new _(function(l,i){var u=new FileReader;u.onerror=i,u.onloadend=function(f){var c=btoa(f.target.result||"");l({__local_forage_encoded_blob:!0,data:c,type:n.type})},u.readAsBinaryString(n)})}function A(n){var l=G(atob(n.data));return T([l],{type:n.type})}function P(n){return n&&n.__local_forage_encoded_blob}function $(n){var l=this,i=l._initReady().then(function(){var u=D[l._dbInfo.name];if(u&&u.dbReady)return u.dbReady});return L(i,n,n),i}function x(n){Z(n);for(var l=D[n.name],i=l.forages,u=0;u<i.length;u++){var f=i[u];f._dbInfo.db&&(f._dbInfo.db.close(),f._dbInfo.db=null)}return n.db=null,de(n).then(function(c){return n.db=c,d(n)?Re(n):c}).then(function(c){n.db=l.db=c;for(var p=0;p<i.length;p++)i[p]._dbInfo.db=c}).catch(function(c){throw le(n,c),c})}function j(n,l,i,u){u===void 0&&(u=1);try{var f=n.db.transaction(n.storeName,l);i(null,f)}catch(c){if(u>0&&(!n.db||c.name==="InvalidStateError"||c.name==="NotFoundError"))return _.resolve().then(function(){if(!n.db||c.name==="NotFoundError"&&!n.db.objectStoreNames.contains(n.storeName)&&n.version<=n.db.version)return n.db&&(n.version=n.db.version+1),Re(n)}).then(function(){return x(n).then(function(){j(n,l,i,u-1)})}).catch(i);i(c)}}function ee(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Le(n){var l=this,i={db:null};if(n)for(var u in n)i[u]=n[u];var f=D[i.name];f||(f=ee(),D[i.name]=f),f.forages.push(l),l._initReady||(l._initReady=l.ready,l.ready=$);var c=[];function p(){return _.resolve()}for(var E=0;E<f.forages.length;E++){var w=f.forages[E];w!==l&&c.push(w._initReady().catch(p))}var b=f.forages.slice(0);return _.all(c).then(function(){return i.db=f.db,de(i)}).then(function(R){return i.db=R,d(i,l._defaultConfig.version)?Re(i):R}).then(function(R){i.db=f.db=R,l._dbInfo=i;for(var O=0;O<b.length;O++){var F=b[O];F!==l&&(F._dbInfo.db=i.db,F._dbInfo.version=i.version)}})}function Ae(n,l){var i=this;n=k(n);var u=new _(function(f,c){i.ready().then(function(){j(i._dbInfo,ie,function(p,E){if(p)return c(p);try{var w=E.objectStore(i._dbInfo.storeName),b=w.get(n);b.onsuccess=function(){var R=b.result;R===void 0&&(R=null),P(R)&&(R=A(R)),f(R)},b.onerror=function(){c(b.error)}}catch(R){c(R)}})}).catch(c)});return N(u,l),u}function Be(n,l){var i=this,u=new _(function(f,c){i.ready().then(function(){j(i._dbInfo,ie,function(p,E){if(p)return c(p);try{var w=E.objectStore(i._dbInfo.storeName),b=w.openCursor(),R=1;b.onsuccess=function(){var O=b.result;if(O){var F=O.value;P(F)&&(F=A(F));var V=n(F,O.key,R++);V!==void 0?f(V):O.continue()}else f()},b.onerror=function(){c(b.error)}}catch(O){c(O)}})}).catch(c)});return N(u,l),u}function vn(n,l,i){var u=this;n=k(n);var f=new _(function(c,p){var E;u.ready().then(function(){return E=u._dbInfo,_e.call(l)==="[object Blob]"?K(E.db).then(function(w){return w?l:I(l)}):l}).then(function(w){j(u._dbInfo,S,function(b,R){if(b)return p(b);try{var O=R.objectStore(u._dbInfo.storeName);w===null&&(w=void 0);var F=O.put(w,n);R.oncomplete=function(){w===void 0&&(w=null),c(w)},R.onabort=R.onerror=function(){var V=F.error?F.error:F.transaction.error;p(V)}}catch(V){p(V)}})}).catch(p)});return N(f,i),f}function gn(n,l){var i=this;n=k(n);var u=new _(function(f,c){i.ready().then(function(){j(i._dbInfo,S,function(p,E){if(p)return c(p);try{var w=E.objectStore(i._dbInfo.storeName),b=w.delete(n);E.oncomplete=function(){f()},E.onerror=function(){c(b.error)},E.onabort=function(){var R=b.error?b.error:b.transaction.error;c(R)}}catch(R){c(R)}})}).catch(c)});return N(u,l),u}function yn(n){var l=this,i=new _(function(u,f){l.ready().then(function(){j(l._dbInfo,S,function(c,p){if(c)return f(c);try{var E=p.objectStore(l._dbInfo.storeName),w=E.clear();p.oncomplete=function(){u()},p.onabort=p.onerror=function(){var b=w.error?w.error:w.transaction.error;f(b)}}catch(b){f(b)}})}).catch(f)});return N(i,n),i}function En(n){var l=this,i=new _(function(u,f){l.ready().then(function(){j(l._dbInfo,ie,function(c,p){if(c)return f(c);try{var E=p.objectStore(l._dbInfo.storeName),w=E.count();w.onsuccess=function(){u(w.result)},w.onerror=function(){f(w.error)}}catch(b){f(b)}})}).catch(f)});return N(i,n),i}function _n(n,l){var i=this,u=new _(function(f,c){if(n<0){f(null);return}i.ready().then(function(){j(i._dbInfo,ie,function(p,E){if(p)return c(p);try{var w=E.objectStore(i._dbInfo.storeName),b=!1,R=w.openKeyCursor();R.onsuccess=function(){var O=R.result;if(!O){f(null);return}n===0||b?f(O.key):(b=!0,O.advance(n))},R.onerror=function(){c(R.error)}}catch(O){c(O)}})}).catch(c)});return N(u,l),u}function In(n){var l=this,i=new _(function(u,f){l.ready().then(function(){j(l._dbInfo,ie,function(c,p){if(c)return f(c);try{var E=p.objectStore(l._dbInfo.storeName),w=E.openKeyCursor(),b=[];w.onsuccess=function(){var R=w.result;if(!R){u(b);return}b.push(R.key),R.continue()},w.onerror=function(){f(w.error)}}catch(R){f(R)}})}).catch(f)});return N(i,n),i}function wn(n,l){l=C.apply(this,arguments);var i=this.config();n=typeof n!="function"&&n||{},n.name||(n.name=n.name||i.name,n.storeName=n.storeName||i.storeName);var u=this,f;if(!n.name)f=_.reject("Invalid arguments");else{var c=n.name===i.name&&u._dbInfo.db,p=c?_.resolve(u._dbInfo.db):de(n).then(function(E){var w=D[n.name],b=w.forages;w.db=E;for(var R=0;R<b.length;R++)b[R]._dbInfo.db=E;return E});n.storeName?f=p.then(function(E){if(!!E.objectStoreNames.contains(n.storeName)){var w=E.version+1;Z(n);var b=D[n.name],R=b.forages;E.close();for(var O=0;O<R.length;O++){var F=R[O];F._dbInfo.db=null,F._dbInfo.version=w}var V=new _(function(q,J){var z=v.open(n.name,w);z.onerror=function(fe){var je=z.result;je.close(),J(fe)},z.onupgradeneeded=function(){var fe=z.result;fe.deleteObjectStore(n.storeName)},z.onsuccess=function(){var fe=z.result;fe.close(),q(fe)}});return V.then(function(q){b.db=q;for(var J=0;J<R.length;J++){var z=R[J];z._dbInfo.db=q,oe(z._dbInfo)}}).catch(function(q){throw(le(n,q)||_.resolve()).catch(function(){}),q})}}):f=p.then(function(E){Z(n);var w=D[n.name],b=w.forages;E.close();for(var R=0;R<b.length;R++){var O=b[R];O._dbInfo.db=null}var F=new _(function(V,q){var J=v.deleteDatabase(n.name);J.onerror=function(){var z=J.result;z&&z.close(),q(J.error)},J.onblocked=function(){console.warn('dropInstance blocked for database "'+n.name+'" until all open connections are closed')},J.onsuccess=function(){var z=J.result;z&&z.close(),V(z)}});return F.then(function(V){w.db=V;for(var q=0;q<b.length;q++){var J=b[q];oe(J._dbInfo)}}).catch(function(V){throw(le(n,V)||_.resolve()).catch(function(){}),V})})}return N(f,l),f}var bn={_driver:"asyncStorage",_initStorage:Le,_support:y(),iterate:Be,getItem:Ae,setItem:vn,removeItem:gn,clear:yn,length:En,key:_n,keys:In,dropInstance:wn};function Rn(){return typeof openDatabase=="function"}var Ie="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",An="~~local_forage_type~",Kt=/^~~local_forage_type~([^~]+)~/,rt="__lfsc__:",Et=rt.length,_t="arbf",It="blob",qt="si08",Ht="ui08",Yt="uic8",Xt="si16",zt="si32",Jt="ur16",Qt="ui32",Zt="fl32",er="fl64",tr=Et+_t.length,rr=Object.prototype.toString;function nr(n){var l=n.length*.75,i=n.length,u,f=0,c,p,E,w;n[n.length-1]==="="&&(l--,n[n.length-2]==="="&&l--);var b=new ArrayBuffer(l),R=new Uint8Array(b);for(u=0;u<i;u+=4)c=Ie.indexOf(n[u]),p=Ie.indexOf(n[u+1]),E=Ie.indexOf(n[u+2]),w=Ie.indexOf(n[u+3]),R[f++]=c<<2|p>>4,R[f++]=(p&15)<<4|E>>2,R[f++]=(E&3)<<6|w&63;return b}function wt(n){var l=new Uint8Array(n),i="",u;for(u=0;u<l.length;u+=3)i+=Ie[l[u]>>2],i+=Ie[(l[u]&3)<<4|l[u+1]>>4],i+=Ie[(l[u+1]&15)<<2|l[u+2]>>6],i+=Ie[l[u+2]&63];return l.length%3===2?i=i.substring(0,i.length-1)+"=":l.length%3===1&&(i=i.substring(0,i.length-2)+"=="),i}function Sn(n,l){var i="";if(n&&(i=rr.call(n)),n&&(i==="[object ArrayBuffer]"||n.buffer&&rr.call(n.buffer)==="[object ArrayBuffer]")){var u,f=rt;n instanceof ArrayBuffer?(u=n,f+=_t):(u=n.buffer,i==="[object Int8Array]"?f+=qt:i==="[object Uint8Array]"?f+=Ht:i==="[object Uint8ClampedArray]"?f+=Yt:i==="[object Int16Array]"?f+=Xt:i==="[object Uint16Array]"?f+=Jt:i==="[object Int32Array]"?f+=zt:i==="[object Uint32Array]"?f+=Qt:i==="[object Float32Array]"?f+=Zt:i==="[object Float64Array]"?f+=er:l(new Error("Failed to get type for BinaryArray"))),l(f+wt(u))}else if(i==="[object Blob]"){var c=new FileReader;c.onload=function(){var p=An+n.type+"~"+wt(this.result);l(rt+It+p)},c.readAsArrayBuffer(n)}else try{l(JSON.stringify(n))}catch(p){console.error("Couldn't convert value into a JSON string: ",n),l(null,p)}}function Nn(n){if(n.substring(0,Et)!==rt)return JSON.parse(n);var l=n.substring(tr),i=n.substring(Et,tr),u;if(i===It&&Kt.test(l)){var f=l.match(Kt);u=f[1],l=l.substring(f[0].length)}var c=nr(l);switch(i){case _t:return c;case It:return T([c],{type:u});case qt:return new Int8Array(c);case Ht:return new Uint8Array(c);case Yt:return new Uint8ClampedArray(c);case Xt:return new Int16Array(c);case Jt:return new Uint16Array(c);case zt:return new Int32Array(c);case Qt:return new Uint32Array(c);case Zt:return new Float32Array(c);case er:return new Float64Array(c);default:throw new Error("Unkown type: "+i)}}var bt={serialize:Sn,deserialize:Nn,stringToBuffer:nr,bufferToString:wt};function ir(n,l,i,u){n.executeSql("CREATE TABLE IF NOT EXISTS "+l.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],i,u)}function Tn(n){var l=this,i={db:null};if(n)for(var u in n)i[u]=typeof n[u]!="string"?n[u].toString():n[u];var f=new _(function(c,p){try{i.db=openDatabase(i.name,String(i.version),i.description,i.size)}catch(E){return p(E)}i.db.transaction(function(E){ir(E,i,function(){l._dbInfo=i,c()},function(w,b){p(b)})},p)});return i.serializer=bt,f}function we(n,l,i,u,f,c){n.executeSql(i,u,f,function(p,E){E.code===E.SYNTAX_ERR?p.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[l.storeName],function(w,b){b.rows.length?c(w,E):ir(w,l,function(){w.executeSql(i,u,f,c)},c)},c):c(p,E)},c)}function On(n,l){var i=this;n=k(n);var u=new _(function(f,c){i.ready().then(function(){var p=i._dbInfo;p.db.transaction(function(E){we(E,p,"SELECT * FROM "+p.storeName+" WHERE key = ? LIMIT 1",[n],function(w,b){var R=b.rows.length?b.rows.item(0).value:null;R&&(R=p.serializer.deserialize(R)),f(R)},function(w,b){c(b)})})}).catch(c)});return N(u,l),u}function Mn(n,l){var i=this,u=new _(function(f,c){i.ready().then(function(){var p=i._dbInfo;p.db.transaction(function(E){we(E,p,"SELECT * FROM "+p.storeName,[],function(w,b){for(var R=b.rows,O=R.length,F=0;F<O;F++){var V=R.item(F),q=V.value;if(q&&(q=p.serializer.deserialize(q)),q=n(q,V.key,F+1),q!==void 0){f(q);return}}f()},function(w,b){c(b)})})}).catch(c)});return N(u,l),u}function or(n,l,i,u){var f=this;n=k(n);var c=new _(function(p,E){f.ready().then(function(){l===void 0&&(l=null);var w=l,b=f._dbInfo;b.serializer.serialize(l,function(R,O){O?E(O):b.db.transaction(function(F){we(F,b,"INSERT OR REPLACE INTO "+b.storeName+" (key, value) VALUES (?, ?)",[n,R],function(){p(w)},function(V,q){E(q)})},function(F){if(F.code===F.QUOTA_ERR){if(u>0){p(or.apply(f,[n,w,i,u-1]));return}E(F)}})})}).catch(E)});return N(c,i),c}function Ln(n,l,i){return or.apply(this,[n,l,i,1])}function Cn(n,l){var i=this;n=k(n);var u=new _(function(f,c){i.ready().then(function(){var p=i._dbInfo;p.db.transaction(function(E){we(E,p,"DELETE FROM "+p.storeName+" WHERE key = ?",[n],function(){f()},function(w,b){c(b)})})}).catch(c)});return N(u,l),u}function Pn(n){var l=this,i=new _(function(u,f){l.ready().then(function(){var c=l._dbInfo;c.db.transaction(function(p){we(p,c,"DELETE FROM "+c.storeName,[],function(){u()},function(E,w){f(w)})})}).catch(f)});return N(i,n),i}function $n(n){var l=this,i=new _(function(u,f){l.ready().then(function(){var c=l._dbInfo;c.db.transaction(function(p){we(p,c,"SELECT COUNT(key) as c FROM "+c.storeName,[],function(E,w){var b=w.rows.item(0).c;u(b)},function(E,w){f(w)})})}).catch(f)});return N(i,n),i}function Dn(n,l){var i=this,u=new _(function(f,c){i.ready().then(function(){var p=i._dbInfo;p.db.transaction(function(E){we(E,p,"SELECT key FROM "+p.storeName+" WHERE id = ? LIMIT 1",[n+1],function(w,b){var R=b.rows.length?b.rows.item(0).key:null;f(R)},function(w,b){c(b)})})}).catch(c)});return N(u,l),u}function xn(n){var l=this,i=new _(function(u,f){l.ready().then(function(){var c=l._dbInfo;c.db.transaction(function(p){we(p,c,"SELECT key FROM "+c.storeName,[],function(E,w){for(var b=[],R=0;R<w.rows.length;R++)b.push(w.rows.item(R).key);u(b)},function(E,w){f(w)})})}).catch(f)});return N(i,n),i}function Un(n){return new _(function(l,i){n.transaction(function(u){u.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(f,c){for(var p=[],E=0;E<c.rows.length;E++)p.push(c.rows.item(E).name);l({db:n,storeNames:p})},function(f,c){i(c)})},function(u){i(u)})})}function kn(n,l){l=C.apply(this,arguments);var i=this.config();n=typeof n!="function"&&n||{},n.name||(n.name=n.name||i.name,n.storeName=n.storeName||i.storeName);var u=this,f;return n.name?f=new _(function(c){var p;n.name===i.name?p=u._dbInfo.db:p=openDatabase(n.name,"","",0),n.storeName?c({db:p,storeNames:[n.storeName]}):c(Un(p))}).then(function(c){return new _(function(p,E){c.db.transaction(function(w){function b(V){return new _(function(q,J){w.executeSql("DROP TABLE IF EXISTS "+V,[],function(){q()},function(z,fe){J(fe)})})}for(var R=[],O=0,F=c.storeNames.length;O<F;O++)R.push(b(c.storeNames[O]));_.all(R).then(function(){p()}).catch(function(V){E(V)})},function(w){E(w)})})}):f=_.reject("Invalid arguments"),N(f,l),f}var Fn={_driver:"webSQLStorage",_initStorage:Tn,_support:Rn(),iterate:Mn,getItem:On,setItem:Ln,removeItem:Cn,clear:Pn,length:$n,key:Dn,keys:xn,dropInstance:kn};function Wn(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function ar(n,l){var i=n.name+"/";return n.storeName!==l.storeName&&(i+=n.storeName+"/"),i}function Bn(){var n="_localforage_support_test";try{return localStorage.setItem(n,!0),localStorage.removeItem(n),!1}catch{return!0}}function Gn(){return!Bn()||localStorage.length>0}function jn(n){var l=this,i={};if(n)for(var u in n)i[u]=n[u];return i.keyPrefix=ar(n,l._defaultConfig),Gn()?(l._dbInfo=i,i.serializer=bt,_.resolve()):_.reject()}function Vn(n){var l=this,i=l.ready().then(function(){for(var u=l._dbInfo.keyPrefix,f=localStorage.length-1;f>=0;f--){var c=localStorage.key(f);c.indexOf(u)===0&&localStorage.removeItem(c)}});return N(i,n),i}function Kn(n,l){var i=this;n=k(n);var u=i.ready().then(function(){var f=i._dbInfo,c=localStorage.getItem(f.keyPrefix+n);return c&&(c=f.serializer.deserialize(c)),c});return N(u,l),u}function qn(n,l){var i=this,u=i.ready().then(function(){for(var f=i._dbInfo,c=f.keyPrefix,p=c.length,E=localStorage.length,w=1,b=0;b<E;b++){var R=localStorage.key(b);if(R.indexOf(c)===0){var O=localStorage.getItem(R);if(O&&(O=f.serializer.deserialize(O)),O=n(O,R.substring(p),w++),O!==void 0)return O}}});return N(u,l),u}function Hn(n,l){var i=this,u=i.ready().then(function(){var f=i._dbInfo,c;try{c=localStorage.key(n)}catch{c=null}return c&&(c=c.substring(f.keyPrefix.length)),c});return N(u,l),u}function Yn(n){var l=this,i=l.ready().then(function(){for(var u=l._dbInfo,f=localStorage.length,c=[],p=0;p<f;p++){var E=localStorage.key(p);E.indexOf(u.keyPrefix)===0&&c.push(E.substring(u.keyPrefix.length))}return c});return N(i,n),i}function Xn(n){var l=this,i=l.keys().then(function(u){return u.length});return N(i,n),i}function zn(n,l){var i=this;n=k(n);var u=i.ready().then(function(){var f=i._dbInfo;localStorage.removeItem(f.keyPrefix+n)});return N(u,l),u}function Jn(n,l,i){var u=this;n=k(n);var f=u.ready().then(function(){l===void 0&&(l=null);var c=l;return new _(function(p,E){var w=u._dbInfo;w.serializer.serialize(l,function(b,R){if(R)E(R);else try{localStorage.setItem(w.keyPrefix+n,b),p(c)}catch(O){(O.name==="QuotaExceededError"||O.name==="NS_ERROR_DOM_QUOTA_REACHED")&&E(O),E(O)}})})});return N(f,i),f}function Qn(n,l){if(l=C.apply(this,arguments),n=typeof n!="function"&&n||{},!n.name){var i=this.config();n.name=n.name||i.name,n.storeName=n.storeName||i.storeName}var u=this,f;return n.name?f=new _(function(c){n.storeName?c(ar(n,u._defaultConfig)):c(n.name+"/")}).then(function(c){for(var p=localStorage.length-1;p>=0;p--){var E=localStorage.key(p);E.indexOf(c)===0&&localStorage.removeItem(E)}}):f=_.reject("Invalid arguments"),N(f,l),f}var Zn={_driver:"localStorageWrapper",_initStorage:jn,_support:Wn(),iterate:qn,getItem:Kn,setItem:Jn,removeItem:zn,clear:Vn,length:Xn,key:Hn,keys:Yn,dropInstance:Qn},ei=function(l,i){return l===i||typeof l=="number"&&typeof i=="number"&&isNaN(l)&&isNaN(i)},ti=function(l,i){for(var u=l.length,f=0;f<u;){if(ei(l[f],i))return!0;f++}return!1},sr=Array.isArray||function(n){return Object.prototype.toString.call(n)==="[object Array]"},Ge={},lr={},Ce={INDEXEDDB:bn,WEBSQL:Fn,LOCALSTORAGE:Zn},ri=[Ce.INDEXEDDB._driver,Ce.WEBSQL._driver,Ce.LOCALSTORAGE._driver],nt=["dropInstance"],Rt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(nt),ni={description:"",driver:ri.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function ii(n,l){n[l]=function(){var i=arguments;return n.ready().then(function(){return n[l].apply(n,i)})}}function At(){for(var n=1;n<arguments.length;n++){var l=arguments[n];if(l)for(var i in l)l.hasOwnProperty(i)&&(sr(l[i])?arguments[0][i]=l[i].slice():arguments[0][i]=l[i])}return arguments[0]}var oi=function(){function n(l){h(this,n);for(var i in Ce)if(Ce.hasOwnProperty(i)){var u=Ce[i],f=u._driver;this[i]=f,Ge[f]||this.defineDriver(u)}this._defaultConfig=At({},ni),this._config=At({},this._defaultConfig,l),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return n.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},n.prototype.defineDriver=function(i,u,f){var c=new _(function(p,E){try{var w=i._driver,b=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!i._driver){E(b);return}for(var R=Rt.concat("_initStorage"),O=0,F=R.length;O<F;O++){var V=R[O],q=!ti(nt,V);if((q||i[V])&&typeof i[V]!="function"){E(b);return}}var J=function(){for(var je=function(li){return function(){var ci=new Error("Method "+li+" is not implemented by the current driver"),cr=_.reject(ci);return N(cr,arguments[arguments.length-1]),cr}},St=0,si=nt.length;St<si;St++){var Nt=nt[St];i[Nt]||(i[Nt]=je(Nt))}};J();var z=function(je){Ge[w]&&console.info("Redefining LocalForage driver: "+w),Ge[w]=i,lr[w]=je,p()};"_support"in i?i._support&&typeof i._support=="function"?i._support().then(z,E):z(!!i._support):z(!0)}catch(fe){E(fe)}});return L(c,u,f),c},n.prototype.driver=function(){return this._driver||null},n.prototype.getDriver=function(i,u,f){var c=Ge[i]?_.resolve(Ge[i]):_.reject(new Error("Driver not found."));return L(c,u,f),c},n.prototype.getSerializer=function(i){var u=_.resolve(bt);return L(u,i),u},n.prototype.ready=function(i){var u=this,f=u._driverSet.then(function(){return u._ready===null&&(u._ready=u._initDriver()),u._ready});return L(f,i,i),f},n.prototype.setDriver=function(i,u,f){var c=this;sr(i)||(i=[i]);var p=this._getSupportedDrivers(i);function E(){c._config.driver=c.driver()}function w(O){return c._extend(O),E(),c._ready=c._initStorage(c._config),c._ready}function b(O){return function(){var F=0;function V(){for(;F<O.length;){var q=O[F];return F++,c._dbInfo=null,c._ready=null,c.getDriver(q).then(w).catch(V)}E();var J=new Error("No available storage method found.");return c._driverSet=_.reject(J),c._driverSet}return V()}}var R=this._driverSet!==null?this._driverSet.catch(function(){return _.resolve()}):_.resolve();return this._driverSet=R.then(function(){var O=p[0];return c._dbInfo=null,c._ready=null,c.getDriver(O).then(function(F){c._driver=F._driver,E(),c._wrapLibraryMethodsWithReady(),c._initDriver=b(p)})}).catch(function(){E();var O=new Error("No available storage method found.");return c._driverSet=_.reject(O),c._driverSet}),L(this._driverSet,u,f),this._driverSet},n.prototype.supports=function(i){return!!lr[i]},n.prototype._extend=function(i){At(this,i)},n.prototype._getSupportedDrivers=function(i){for(var u=[],f=0,c=i.length;f<c;f++){var p=i[f];this.supports(p)&&u.push(p)}return u},n.prototype._wrapLibraryMethodsWithReady=function(){for(var i=0,u=Rt.length;i<u;i++)ii(this,Rt[i])},n.prototype.createInstance=function(i){return new n(i)},n}(),ai=new oi;a.exports=ai},{3:3}]},{},[4])(4)})});var pn=mr((vt,mn)=>{(function(e,t){typeof vt=="object"&&typeof mn<"u"?t(vt):typeof define=="function"&&define.amd?define("localforage-driver-memory",["exports"],t):t(e.LocalforageDriverMemory={})})(typeof self<"u"?self:vt,function(e){"use strict";var t="localforage-driver-memory";function r(d){var I=typeof Symbol=="function"&&d[Symbol.iterator],A=0;return I?I.call(d):{next:function(){return d&&A>=d.length&&(d=void 0),{value:d&&d[A++],done:!d}}}}function o(d,I){d=d||[],I=I||{};try{return new Blob(d,I)}catch(x){if(x.name!=="TypeError")throw x;for(var A=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,P=new A,$=0;$<d.length;$+=1)P.append(d[$]);return P.getBlob(I.type)}}var a=/^~~local_forage_type~([^~]+)~/,s=9,m=s+4,h=Object.prototype.toString;function g(d){var I=d.length*.75,A=d.length;d[d.length-1]==="="&&(I--,d[d.length-2]==="="&&I--);for(var P=new ArrayBuffer(I),$=new Uint8Array(P),x=0,j=0;x<A;x+=4){var ee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d[x]),Le="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d[x+1]),Ae="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d[x+2]),Be="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d[x+3]);$[j++]=ee<<2|Le>>4,$[j++]=(Le&15)<<4|Ae>>2,$[j++]=(Ae&3)<<6|Be&63}return P}function v(d){for(var I=new Uint8Array(d),A="",P=0;P<I.length;P+=3)A+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[I[P]>>2],A+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(I[P]&3)<<4|I[P+1]>>4],A+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(I[P+1]&15)<<2|I[P+2]>>6],A+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[I[P+2]&63];return I.length%3===2?A=A.substring(0,A.length-1)+"=":I.length%3===1&&(A=A.substring(0,A.length-2)+"=="),A}function y(d,I){var A="";if(d&&(A=h.call(d)),d&&(A==="[object ArrayBuffer]"||d.buffer&&h.call(d.buffer)==="[object ArrayBuffer]")){var P=void 0,$="__lfsc__:";d instanceof ArrayBuffer?(P=d,$+="arbf"):(P=d.buffer,A==="[object Int8Array]"?$+="si08":A==="[object Uint8Array]"?$+="ui08":A==="[object Uint8ClampedArray]"?$+="uic8":A==="[object Int16Array]"?$+="si16":A==="[object Uint16Array]"?$+="ur16":A==="[object Int32Array]"?$+="si32":A==="[object Uint32Array]"?$+="ui32":A==="[object Float32Array]"?$+="fl32":A==="[object Float64Array]"?$+="fl64":I(new Error("Failed to get type for BinaryArray"))),I($+v(P))}else if(A==="[object Blob]"){var x=new FileReader;x.onload=function(){var j="~~local_forage_type~"+d.type+"~"+v(this.result);I("__lfsc__:blob"+j)},x.readAsArrayBuffer(d)}else try{I(JSON.stringify(d))}catch(j){console.error("Couldn't convert value into a JSON string: ",d),I(null,j)}}function T(d){if(d.substring(0,s)!=="__lfsc__:")return JSON.parse(d);var I=d.substring(m),A=d.substring(s,m),P;if(A==="blob"&&a.test(I)){var $=I.match(a);P=$[1],I=I.substring($[0].length)}var x=g(I);switch(A){case"arbf":return x;case"blob":return o([x],{type:P});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 _(d){var I,A;if(d===null||typeof d!="object"||"isActiveClone"in d)return d;var P=d instanceof Date?new Date(d):d.constructor();try{for(var $=r(Object.keys(d)),x=$.next();!x.done;x=$.next()){var j=x.value;Object.prototype.hasOwnProperty.call(d,j)&&(d.isActiveClone=null,P[j]=_(d[j]),delete d.isActiveClone)}}catch(ee){I={error:ee}}finally{try{x&&!x.done&&(A=$.return)&&A.call($)}finally{if(I)throw I.error}}return P}function N(d,I){return(d.name||I.name)+"/"+(d.storeName||I.storeName)+"/"}function L(d,I){I&&d.then(function(A){I(null,A)},function(A){I(A)})}function k(){for(var d=[],I=0;I<arguments.length;I++)d[I]=arguments[I];if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}function C(d,I){var A=this;if(I=k.apply(this,arguments),d=typeof d!="function"&&d||{},!d.name){var P=this.config();d.name=d.name||P.name,d.storeName=d.storeName||P.storeName}var $;return d.name?$=new Promise(function(x){d.storeName?x(N(d,A._defaultConfig)):x(d.name+"/")}):$=Promise.reject("Invalid arguments"),{promise:$,callback:I}}function B(d){return typeof d!="string"&&(console.warn(d+" used as a key, but it is not a string."),d=String(d)),d}var Q={bufferToString:v,deserialize:T,serialize:y,stringToBuffer:g},D={},_e=function(){function d(I){this.kp=I,this.data={}}return d.resolve=function(I){return D[I]||(D[I]=new d(I)),D[I]},d.prototype.clear=function(){this.data={}},d.prototype.drop=function(){this.clear(),delete D[this.kp]},d.prototype.get=function(I){return this.data[I]},d.prototype.key=function(I){return this.keys()[I]},d.prototype.keys=function(){return Object.keys(this.data)},d.prototype.rm=function(I){delete this.data[I]},d.prototype.set=function(I,A){this.data[I]=A},d}();function ie(d){var I=d?_(d):{},A=N(I,this._defaultConfig),P=_e.resolve(A);return this._dbInfo=I,this._dbInfo.serializer=Q,this._dbInfo.keyPrefix=A,this._dbInfo.mStore=P,Promise.resolve()}function S(d){var I=this,A=this.ready().then(function(){I._dbInfo.mStore.clear()});return L(A,d),A}function G(d,I){var A=C.apply(this,arguments),P=A.promise,$=A.callback,x=P.then(function(j){_e.resolve(j).drop()});return L(x,$),P}function U(d,I){var A=this;d=B(d);var P=this.ready().then(function(){var $=A._dbInfo.mStore.get(d);return $==null?null:A._dbInfo.serializer.deserialize($)});return L(P,I),P}function K(d,I){var A=this,P=this.ready().then(function(){for(var $=A._dbInfo.mStore,x=$.keys(),j=0;j<x.length;j++){var ee=$.get(x[j]);if(ee&&(ee=A._dbInfo.serializer.deserialize(ee)),ee=d(ee,x[j],j+1),ee!==void 0)return ee}});return L(P,I),P}function Z(d,I){var A=this,P=this.ready().then(function(){var $;try{$=A._dbInfo.mStore.key(d),$===void 0&&($=null)}catch{$=null}return $});return L(P,I),P}function oe(d){var I=this,A=this.ready().then(function(){return I._dbInfo.mStore.keys()});return L(A,d),A}function le(d){var I=this.keys().then(function(A){return A.length});return L(I,d),I}function ce(d,I){var A=this;d=B(d);var P=this.ready().then(function(){A._dbInfo.mStore.rm(d)});return L(P,I),P}function de(d,I,A){var P=this;d=B(d);var $=this.ready().then(function(){I===void 0&&(I=null);var x=I;return new Promise(function(j,ee){P._dbInfo.serializer.serialize(I,function(Le,Ae){if(Ae)ee(Ae);else try{P._dbInfo.mStore.set(d,Le),j(x)}catch(Be){ee(Be)}})})});return L($,A),$}var Re=!0;e._support=Re,e._driver=t,e._initStorage=ie,e.clear=S,e.dropInstance=G,e.getItem=U,e.iterate=K,e.key=Z,e.keys=oe,e.length=le,e.removeItem=ce,e.setItem=de,Object.defineProperty(e,"__esModule",{value:!0})})});var ga={};pr(ga,{default:()=>va});var pe=(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))(pe||{}),ve=(e=>(e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE",e.ProductAnnouncement="ANNOUNCEMENT",e))(ve||{}),$e=(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))($e||{}),ue=(e=>(e.MetaMask="metamask",e.CoinbaseWallet="coinbase_wallet",e))(ue||{}),De=(e=>(e.WalletSelected="wallet_selected",e.WalletConnected="wallet_connected",e.WalletRejected="wallet_rejected",e))(De||{}),M=(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.NFTCheckout="magic_nft_checkout",e.NFTTransfer="magic_nft_transfer",e.RequestUserInfoWithUI="mc_request_user_info",e.Disconnect="mc_disconnect",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.EncryptV1="magic_auth_encrypt_v1",e.DecryptV1="magic_auth_decrypt_v1",e.ShowNFTs="magic_show_nfts",e.ShowOnRamp="magic_show_fiat_onramp",e.ShowSendTokensUI="magic_show_send_tokens_ui",e.ShowAddress="magic_show_address",e.ShowBalances="magic_show_balances",e.SendGaslessTransaction="eth_sendGaslessTransaction",e.RevealPK="magic_reveal_key",e))(M||{}),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.MAGIC_SEND_PRODUCT_ANNOUNCEMENT="MAGIC_SEND_PRODUCT_ANNOUNCEMENT",e))(he||{}),Se=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e))(Se||{}),yr=(e=>(e.UpdateEmail="update-email",e.MFA="mfa",e.Recovery="recovery",e))(yr||{}),Er=(e=>(e.Retry="retry",e))(Er||{}),_r=(e=>(e.EmailSent="email-sent",e.EmailNotDeliverable="email-not-deliverable",e))(_r||{}),Ne=(e=>(e.VerifyEmailOtp="verify-email-otp",e.Cancel="cancel",e))(Ne||{}),Ir=(e=>(e.EmailOTPSent="email-otp-sent",e.InvalidEmailOtp="invalid-email-otp",e.ExpiredEmailOtp="expired-email-otp",e))(Ir||{}),qe=(e=>(e.Retry="device-retry",e))(qe||{}),wr=(e=>(e.DeviceApproved="device-approved",e.DeviceNeedsApproval="device-needs-approval",e.DeviceVerificationLinkExpired="device-verification-link-expired",e.DeviceVerificationEmailSent="device-verification-email-sent",e))(wr||{}),ge=(e=>(e.Retry="Recency/auth-factor-retry",e.Cancel="Recency/auth-factor-verification-cancel",e.VerifyEmailOtp="Recency/auth-factor-verify-email-otp",e))(ge||{}),br=(e=>(e.PrimaryAuthFactorNeedsVerification="Recency/auth-factor-needs-verification",e.PrimaryAuthFactorVerified="Recency/auth-factor-verified",e.InvalidEmailOtp="Recency/auth-factor-invalid-email-otp",e.EmailExpired="Recency/auth-factor-verification-email-expired",e.EmailSent="Recency/auth-factor-verification-email-sent",e.EmailNotDeliverable="Recency/auth-factor-verification-email-not-deliverable",e))(br||{}),ye=(e=>(e.RetryWithNewEmail="UpdateEmail/retry-with-new-email",e.Cancel="UpdateEmail/new-email-verification-cancel",e.VerifyEmailOtp="UpdateEmail/new-email-verify-otp",e))(ye||{}),Rr=(e=>(e.NewAuthFactorNeedsVerification="UpdateEmail/new-email-needs-verification",e.EmailUpdated="UpdateEmail/email-updated",e.InvalidEmailOtp="UpdateEmail/new-email-invalid-email-otp",e.EmailExpired="UpdateEmail/new-email-verification-email-expired",e.EmailSent="UpdateEmail/new-email-verification-email-sent",e.EmailNotDeliverable="UpdateEmail/new-email-verification-email-not-deliverable",e.InvalidEmail="UpdateEmail/new-email-invalid",e.EmailAlreadyExists="UpdateEmail/new-email-already-exists",e))(Rr||{}),Ar=(e=>(e.IDTokenCreated="Auth/id-token-created",e))(Ar||{}),Sr=(e=>(e.Harmony="HARMONY",e))(Sr||{}),Nr=(e=>(e.PhoneNumber="phone_number",e))(Nr||{}),Tr=(e=>(e.Success="nft-checkout-success",e.Failure="nft-checkout-failure",e.Initiated="nft-checkout-initiated",e.Disconnect="disconnect",e))(Tr||{}),Or=(e=>(e.WalletInfoFetched="Wallet/wallet-info-fetched",e))(Or||{});var vi=Object.create,ht=Object.defineProperty,gi=Object.defineProperties,yi=Object.getOwnPropertyDescriptor,Ei=Object.getOwnPropertyDescriptors,_i=Object.getOwnPropertyNames,Mr=Object.getOwnPropertySymbols,Ii=Object.getPrototypeOf,Vr=Object.prototype.hasOwnProperty,wi=Object.prototype.propertyIsEnumerable,Lr=(e,t,r)=>t in e?ht(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Mt=(e,t)=>{for(var r in t||(t={}))Vr.call(t,r)&&Lr(e,r,t[r]);if(Mr)for(var r of Mr(t))wi.call(t,r)&&Lr(e,r,t[r]);return e},Lt=(e,t)=>gi(e,Ei(t)),bi=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ri=(e,t)=>{for(var r in t)ht(e,r,{get:t[r],enumerable:!0})},Ai=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of _i(t))!Vr.call(e,a)&&a!==r&&ht(e,a,{get:()=>t[a],enumerable:!(o=yi(t,a))||o.enumerable});return e},Si=(e,t,r)=>(r=e!=null?vi(Ii(e)):{},Ai(t||!e||!e.__esModule?ht(r,"default",{value:e,enumerable:!0}):r,e)),X=(e,t,r)=>new Promise((o,a)=>{var s=g=>{try{h(r.next(g))}catch(v){a(v)}},m=g=>{try{h(r.throw(g))}catch(v){a(v)}},h=g=>g.done?o(g.value):Promise.resolve(g.value).then(s,m);h((r=r.apply(e,t)).next())}),Ni=bi((e,t)=>{"use strict";var r=Object.prototype.hasOwnProperty,o="~";function a(){}Object.create&&(a.prototype=Object.create(null),new a().__proto__||(o=!1));function s(v,y,T){this.fn=v,this.context=y,this.once=T||!1}function m(v,y,T,_,N){if(typeof T!="function")throw new TypeError("The listener must be a function");var L=new s(T,_||v,N),k=o?o+y:y;return v._events[k]?v._events[k].fn?v._events[k]=[v._events[k],L]:v._events[k].push(L):(v._events[k]=L,v._eventsCount++),v}function h(v,y){--v._eventsCount===0?v._events=new a:delete v._events[y]}function g(){this._events=new a,this._eventsCount=0}g.prototype.eventNames=function(){var v=[],y,T;if(this._eventsCount===0)return v;for(T in y=this._events)r.call(y,T)&&v.push(o?T.slice(1):T);return Object.getOwnPropertySymbols?v.concat(Object.getOwnPropertySymbols(y)):v},g.prototype.listeners=function(v){var y=o?o+v:v,T=this._events[y];if(!T)return[];if(T.fn)return[T.fn];for(var _=0,N=T.length,L=new Array(N);_<N;_++)L[_]=T[_].fn;return L},g.prototype.listenerCount=function(v){var y=o?o+v:v,T=this._events[y];return T?T.fn?1:T.length:0},g.prototype.emit=function(v,y,T,_,N,L){var k=o?o+v:v;if(!this._events[k])return!1;var C=this._events[k],B=arguments.length,Q,D;if(C.fn){switch(C.once&&this.removeListener(v,C.fn,void 0,!0),B){case 1:return C.fn.call(C.context),!0;case 2:return C.fn.call(C.context,y),!0;case 3:return C.fn.call(C.context,y,T),!0;case 4:return C.fn.call(C.context,y,T,_),!0;case 5:return C.fn.call(C.context,y,T,_,N),!0;case 6:return C.fn.call(C.context,y,T,_,N,L),!0}for(D=1,Q=new Array(B-1);D<B;D++)Q[D-1]=arguments[D];C.fn.apply(C.context,Q)}else{var _e=C.length,ie;for(D=0;D<_e;D++)switch(C[D].once&&this.removeListener(v,C[D].fn,void 0,!0),B){case 1:C[D].fn.call(C[D].context);break;case 2:C[D].fn.call(C[D].context,y);break;case 3:C[D].fn.call(C[D].context,y,T);break;case 4:C[D].fn.call(C[D].context,y,T,_);break;default:if(!Q)for(ie=1,Q=new Array(B-1);ie<B;ie++)Q[ie-1]=arguments[ie];C[D].fn.apply(C[D].context,Q)}}return!0},g.prototype.on=function(v,y,T){return m(this,v,y,T,!1)},g.prototype.once=function(v,y,T){return m(this,v,y,T,!0)},g.prototype.removeListener=function(v,y,T,_){var N=o?o+v:v;if(!this._events[N])return this;if(!y)return h(this,N),this;var L=this._events[N];if(L.fn)L.fn===y&&(!_||L.once)&&(!T||L.context===T)&&h(this,N);else{for(var k=0,C=[],B=L.length;k<B;k++)(L[k].fn!==y||_&&!L[k].once||T&&L[k].context!==T)&&C.push(L[k]);C.length?this._events[N]=C.length===1?C[0]:C:h(this,N)}return this},g.prototype.removeAllListeners=function(v){var y;return v?(y=o?o+v:v,this._events[y]&&h(this,y)):(this._events=new a,this._eventsCount=0),this},g.prototype.off=g.prototype.removeListener,g.prototype.addListener=g.prototype.on,g.prefixed=o,g.EventEmitter=g,typeof t<"u"&&(t.exports=g)});function Ti(e){let t={exports:{}};return e(t,t.exports),t.exports}var Oi=Number.MAX_SAFE_INTEGER||9007199254740991,Ct={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:Oi,MAX_SAFE_COMPONENT_LENGTH:16},Mi=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{},H=Mi,tt=Ti(function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:r}=Ct,o=(t=e.exports={}).re=[],a=t.src=[],s=t.t={},m=0,h=(g,v,y)=>{let T=m++;H(T,v),s[g]=T,a[T]=v,o[T]=new RegExp(v,y?"g":void 0)};h("NUMERICIDENTIFIER","0|[1-9]\\d*"),h("NUMERICIDENTIFIERLOOSE","[0-9]+"),h("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),h("MAINVERSION",`(${a[s.NUMERICIDENTIFIER]})\\.(${a[s.NUMERICIDENTIFIER]})\\.(${a[s.NUMERICIDENTIFIER]})`),h("MAINVERSIONLOOSE",`(${a[s.NUMERICIDENTIFIERLOOSE]})\\.(${a[s.NUMERICIDENTIFIERLOOSE]})\\.(${a[s.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASEIDENTIFIER",`(?:${a[s.NUMERICIDENTIFIER]}|${a[s.NONNUMERICIDENTIFIER]})`),h("PRERELEASEIDENTIFIERLOOSE",`(?:${a[s.NUMERICIDENTIFIERLOOSE]}|${a[s.NONNUMERICIDENTIFIER]})`),h("PRERELEASE",`(?:-(${a[s.PRERELEASEIDENTIFIER]}(?:\\.${a[s.PRERELEASEIDENTIFIER]})*))`),h("PRERELEASELOOSE",`(?:-?(${a[s.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${a[s.PRERELEASEIDENTIFIERLOOSE]})*))`),h("BUILDIDENTIFIER","[0-9A-Za-z-]+"),h("BUILD",`(?:\\+(${a[s.BUILDIDENTIFIER]}(?:\\.${a[s.BUILDIDENTIFIER]})*))`),h("FULLPLAIN",`v?${a[s.MAINVERSION]}${a[s.PRERELEASE]}?${a[s.BUILD]}?`),h("FULL",`^${a[s.FULLPLAIN]}$`),h("LOOSEPLAIN",`[v=\\s]*${a[s.MAINVERSIONLOOSE]}${a[s.PRERELEASELOOSE]}?${a[s.BUILD]}?`),h("LOOSE",`^${a[s.LOOSEPLAIN]}$`),h("GTLT","((?:<|>)?=?)"),h("XRANGEIDENTIFIERLOOSE",`${a[s.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h("XRANGEIDENTIFIER",`${a[s.NUMERICIDENTIFIER]}|x|X|\\*`),h("XRANGEPLAIN",`[v=\\s]*(${a[s.XRANGEIDENTIFIER]})(?:\\.(${a[s.XRANGEIDENTIFIER]})(?:\\.(${a[s.XRANGEIDENTIFIER]})(?:${a[s.PRERELEASE]})?${a[s.BUILD]}?)?)?`),h("XRANGEPLAINLOOSE",`[v=\\s]*(${a[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${a[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${a[s.XRANGEIDENTIFIERLOOSE]})(?:${a[s.PRERELEASELOOSE]})?${a[s.BUILD]}?)?)?`),h("XRANGE",`^${a[s.GTLT]}\\s*${a[s.XRANGEPLAIN]}$`),h("XRANGELOOSE",`^${a[s.GTLT]}\\s*${a[s.XRANGEPLAINLOOSE]}$`),h("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),h("COERCERTL",a[s.COERCE],!0),h("LONETILDE","(?:~>?)"),h("TILDETRIM",`(\\s*)${a[s.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",h("TILDE",`^${a[s.LONETILDE]}${a[s.XRANGEPLAIN]}$`),h("TILDELOOSE",`^${a[s.LONETILDE]}${a[s.XRANGEPLAINLOOSE]}$`),h("LONECARET","(?:\\^)"),h("CARETTRIM",`(\\s*)${a[s.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",h("CARET",`^${a[s.LONECARET]}${a[s.XRANGEPLAIN]}$`),h("CARETLOOSE",`^${a[s.LONECARET]}${a[s.XRANGEPLAINLOOSE]}$`),h("COMPARATORLOOSE",`^${a[s.GTLT]}\\s*(${a[s.LOOSEPLAIN]})$|^$`),h("COMPARATOR",`^${a[s.GTLT]}\\s*(${a[s.FULLPLAIN]})$|^$`),h("COMPARATORTRIM",`(\\s*)${a[s.GTLT]}\\s*(${a[s.LOOSEPLAIN]}|${a[s.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",h("HYPHENRANGE",`^\\s*(${a[s.XRANGEPLAIN]})\\s+-\\s+(${a[s.XRANGEPLAIN]})\\s*$`),h("HYPHENRANGELOOSE",`^\\s*(${a[s.XRANGEPLAINLOOSE]})\\s+-\\s+(${a[s.XRANGEPLAINLOOSE]})\\s*$`),h("STAR","(<|>)?=?\\s*\\*"),h("GTE0","^\\s*>=\\s*0.0.0\\s*$"),h("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")}),Cr=/^[0-9]+$/,Kr=(e,t)=>{let r=Cr.test(e),o=Cr.test(t);return r&&o&&(e=+e,t=+t),e===t?0:r&&!o?-1:o&&!r?1:e<t?-1:1},Li=(e,t)=>Kr(t,e),Ci={compareIdentifiers:Kr,rcompareIdentifiers:Li},{MAX_LENGTH:Pr,MAX_SAFE_INTEGER:it}=Ct,{re:$r,t:Dr}=tt,{compareIdentifiers:He}=Ci,te=class{constructor(e,t){if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof te){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>Pr)throw new TypeError(`version is longer than ${Pr} characters`);H("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?$r[Dr.LOOSE]:$r[Dr.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>it||this.major<0)throw new TypeError("Invalid major version");if(this.minor>it||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>it||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let a=+o;if(a>=0&&a<it)return a}return o}):this.prerelease=[],this.build=r[5]?r[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(H("SemVer.compare",this.version,this.options,e),!(e instanceof te)){if(typeof e=="string"&&e===this.version)return 0;e=new te(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof te||(e=new te(e,this.options)),He(this.major,e.major)||He(this.minor,e.minor)||He(this.patch,e.patch)}comparePre(e){if(e instanceof te||(e=new te(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 r=this.prerelease[t],o=e.prerelease[t];if(H("prerelease compare",t,r,o),r===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(r===void 0)return-1;if(r!==o)return He(r,o)}while(++t)}compareBuild(e){e instanceof te||(e=new te(e,this.options));let t=0;do{let r=this.build[t],o=e.build[t];if(H("prerelease compare",t,r,o),r===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(r===void 0)return-1;if(r!==o)return He(r,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 r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]=="number"&&(this.prerelease[r]++,r=-2);r===-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}},Pi=(e,t,r)=>new te(e,r).compare(new te(t,r)),We=Pi,$i=(e,t,r)=>We(e,t,r)===0,Di=$i,xi=(e,t,r)=>We(e,t,r)!==0,Ui=xi,ki=(e,t,r)=>We(e,t,r)>0,Fi=ki,Wi=(e,t,r)=>We(e,t,r)>=0,Bi=Wi,Gi=(e,t,r)=>We(e,t,r)<0,ji=Gi,Vi=(e,t,r)=>We(e,t,r)<=0,Ki=Vi,qi=(e,t,r,o)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return Di(e,r,o);case"!=":return Ui(e,r,o);case">":return Fi(e,r,o);case">=":return Bi(e,r,o);case"<":return ji(e,r,o);case"<=":return Ki(e,r,o);default:throw new TypeError(`Invalid operator: ${t}`)}},Tt=qi,Ye=Symbol("SemVer ANY"),Qe=class{static get ANY(){return Ye}constructor(e,t){if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof Qe){if(e.loose===!!t.loose)return e;e=e.value}H("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===Ye?this.value="":this.value=this.operator+this.semver.version,H("comp",this)}parse(e){let t=this.options.loose?xr[Ur.COMPARATORLOOSE]:xr[Ur.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=r[1]!==void 0?r[1]:"",this.operator==="="&&(this.operator=""),r[2]?this.semver=new te(r[2],this.options.loose):this.semver=Ye}toString(){return this.value}test(e){if(H("Comparator.test",e,this.options.loose),this.semver===Ye||e===Ye)return!0;if(typeof e=="string")try{e=new te(e,this.options)}catch(t){return!1}return Tt(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof Qe))throw new TypeError("a Comparator is required");if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),this.operator==="")return this.value===""||new Ue(e.value,t).test(this.value);if(e.operator==="")return e.value===""||new Ue(this.value,t).test(e.semver);let r=!(this.operator!==">="&&this.operator!==">"||e.operator!==">="&&e.operator!==">"),o=!(this.operator!=="<="&&this.operator!=="<"||e.operator!=="<="&&e.operator!=="<"),a=this.semver.version===e.semver.version,s=!(this.operator!==">="&&this.operator!=="<="||e.operator!==">="&&e.operator!=="<="),m=Tt(this.semver,"<",e.semver,t)&&(this.operator===">="||this.operator===">")&&(e.operator==="<="||e.operator==="<"),h=Tt(this.semver,">",e.semver,t)&&(this.operator==="<="||this.operator==="<")&&(e.operator===">="||e.operator===">");return r||o||a&&s||m||h}},{re:xr,t:Ur}=tt,Ue=class{constructor(e,t){if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof Ue)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new Ue(e.raw,t);if(e instanceof Qe)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(r=>this.parseRange(r.trim())).filter(r=>r.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 r=t?ne[re.HYPHENRANGELOOSE]:ne[re.HYPHENRANGE];e=e.replace(r,oo(this.options.includePrerelease)),H("hyphen replace",e),e=e.replace(ne[re.COMPARATORTRIM],Hi),H("comparator trim",e,ne[re.COMPARATORTRIM]),e=(e=(e=e.replace(ne[re.TILDETRIM],Yi)).replace(ne[re.CARETTRIM],Xi)).split(/\s+/).join(" ");let o=t?ne[re.COMPARATORLOOSE]:ne[re.COMPARATOR];return e.split(" ").map(a=>zi(a,this.options)).join(" ").split(/\s+/).map(a=>io(a,this.options)).filter(this.options.loose?a=>!!a.match(o):()=>!0).map(a=>new Qe(a,this.options))}intersects(e,t){if(!(e instanceof Ue))throw new TypeError("a Range is required");return this.set.some(r=>kr(r,t)&&e.set.some(o=>kr(o,t)&&r.every(a=>o.every(s=>a.intersects(s,t)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new te(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(ao(this.set[t],e,this.options))return!0;return!1}},{re:ne,t:re,comparatorTrimReplace:Hi,tildeTrimReplace:Yi,caretTrimReplace:Xi}=tt,kr=(e,t)=>{let r=!0,o=e.slice(),a=o.pop();for(;r&&o.length;)r=o.every(s=>a.intersects(s,t)),a=o.pop();return r},zi=(e,t)=>(H("comp",e,t),e=Zi(e,t),H("caret",e),e=Ji(e,t),H("tildes",e),e=to(e,t),H("xrange",e),e=no(e,t),H("stars",e),e),ae=e=>!e||e.toLowerCase()==="x"||e==="*",Ji=(e,t)=>e.trim().split(/\s+/).map(r=>Qi(r,t)).join(" "),Qi=(e,t)=>{let r=t.loose?ne[re.TILDELOOSE]:ne[re.TILDE];return e.replace(r,(o,a,s,m,h)=>{let g;return H("tilde",e,o,a,s,m,h),ae(a)?g="":ae(s)?g=`>=${a}.0.0 <${+a+1}.0.0-0`:ae(m)?g=`>=${a}.${s}.0 <${a}.${+s+1}.0-0`:h?(H("replaceTilde pr",h),g=`>=${a}.${s}.${m}-${h} <${a}.${+s+1}.0-0`):g=`>=${a}.${s}.${m} <${a}.${+s+1}.0-0`,H("tilde return",g),g})},Zi=(e,t)=>e.trim().split(/\s+/).map(r=>eo(r,t)).join(" "),eo=(e,t)=>{H("caret",e,t);let r=t.loose?ne[re.CARETLOOSE]:ne[re.CARET],o=t.includePrerelease?"-0":"";return e.replace(r,(a,s,m,h,g)=>{let v;return H("caret",e,a,s,m,h,g),ae(s)?v="":ae(m)?v=`>=${s}.0.0${o} <${+s+1}.0.0-0`:ae(h)?v=s==="0"?`>=${s}.${m}.0${o} <${s}.${+m+1}.0-0`:`>=${s}.${m}.0${o} <${+s+1}.0.0-0`:g?(H("replaceCaret pr",g),v=s==="0"?m==="0"?`>=${s}.${m}.${h}-${g} <${s}.${m}.${+h+1}-0`:`>=${s}.${m}.${h}-${g} <${s}.${+m+1}.0-0`:`>=${s}.${m}.${h}-${g} <${+s+1}.0.0-0`):(H("no pr"),v=s==="0"?m==="0"?`>=${s}.${m}.${h}${o} <${s}.${m}.${+h+1}-0`:`>=${s}.${m}.${h}${o} <${s}.${+m+1}.0-0`:`>=${s}.${m}.${h} <${+s+1}.0.0-0`),H("caret return",v),v})},to=(e,t)=>(H("replaceXRanges",e,t),e.split(/\s+/).map(r=>ro(r,t)).join(" ")),ro=(e,t)=>{e=e.trim();let r=t.loose?ne[re.XRANGELOOSE]:ne[re.XRANGE];return e.replace(r,(o,a,s,m,h,g)=>{H("xRange",e,o,a,s,m,h,g);let v=ae(s),y=v||ae(m),T=y||ae(h),_=T;return a==="="&&_&&(a=""),g=t.includePrerelease?"-0":"",v?o=a===">"||a==="<"?"<0.0.0-0":"*":a&&_?(y&&(m=0),h=0,a===">"?(a=">=",y?(s=+s+1,m=0,h=0):(m=+m+1,h=0)):a==="<="&&(a="<",y?s=+s+1:m=+m+1),a==="<"&&(g="-0"),o=`${a+s}.${m}.${h}${g}`):y?o=`>=${s}.0.0${g} <${+s+1}.0.0-0`:T&&(o=`>=${s}.${m}.0${g} <${s}.${+m+1}.0-0`),H("xRange return",o),o})},no=(e,t)=>(H("replaceStars",e,t),e.trim().replace(ne[re.STAR],"")),io=(e,t)=>(H("replaceGTE0",e,t),e.trim().replace(ne[t.includePrerelease?re.GTE0PRE:re.GTE0],"")),oo=e=>(t,r,o,a,s,m,h,g,v,y,T,_,N)=>`${r=ae(o)?"":ae(a)?`>=${o}.0.0${e?"-0":""}`:ae(s)?`>=${o}.${a}.0${e?"-0":""}`:m?`>=${r}`:`>=${r}${e?"-0":""}`} ${g=ae(v)?"":ae(y)?`<${+v+1}.0.0-0`:ae(T)?`<${v}.${+y+1}.0-0`:_?`<=${v}.${y}.${T}-${_}`:e?`<${v}.${y}.${+T+1}-0`:`<=${g}`}`.trim(),ao=(e,t,r)=>{for(let o=0;o<e.length;o++)if(!e[o].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let o=0;o<e.length;o++)if(H(e[o].semver),e[o].semver!==Qe.ANY&&e[o].semver.prerelease.length>0){let a=e[o].semver;if(a.major===t.major&&a.minor===t.minor&&a.patch===t.patch)return!0}return!1}return!0},so=(e,t,r)=>{try{t=new Ue(t,r)}catch(o){return!1}return t.test(e)},{MAX_LENGTH:lo}=Ct,{re:Fr,t:Wr}=tt,co=(e,t)=>{if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof te)return e;if(typeof e!="string"||e.length>lo||!(t.loose?Fr[Wr.LOOSE]:Fr[Wr.FULL]).test(e))return null;try{return new te(e,t)}catch(r){return null}},uo=co,{re:ot,t:at}=tt,fo=(e,t)=>{if(e instanceof te)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;let r=null;if((t=t||{}).rtl){let o;for(;(o=ot[at.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&o.index+o[0].length===r.index+r[0].length||(r=o),ot[at.COERCERTL].lastIndex=o.index+o[1].length+o[2].length;ot[at.COERCERTL].lastIndex=-1}else r=e.match(ot[at.COERCE]);return r===null?null:uo(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};function ho(e){return String.fromCharCode(parseInt(e.slice(1),16))}function mo(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}function po(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,ho))}function vo(e){return decodeURIComponent(Array.from(atob(e),mo).join(""))}function qr(e){return po(JSON.stringify(e))}function go(e){return JSON.parse(vo(e))}function Xe(e){return typeof e=="undefined"}function yo(e){return e===null}function Hr(e){return yo(e)||Xe(e)}function Eo(e){return Hr(e)?!1:!Xe(e.jsonrpc)&&!Xe(e.id)&&(!Xe(e.result)||!Xe(e.error))}function _o(e){return Hr(e)?!1:typeof e=="number"&&Object.values($e).includes(e)}function ut(e){if(!e)return!0;for(let t in e)if(Object.hasOwnProperty.call(e,t))return!1;return!0}var Y={};function Yr(e,t){return Object.assign(Y,t),e}var Io={"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"},Ee=class extends Error{constructor(e,t){super(`Magic SDK Error: [${e}] ${t}`),this.code=e,this.rawMessage=t,this.__proto__=Error,Object.setPrototypeOf(this,Ee.prototype)}},Fe=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=_o(t)?t:$e.InternalError,this.message=`Magic RPC Error: [${this.code}] ${this.rawMessage}`,this.data=(e==null?void 0:e.data)||void 0,Object.setPrototypeOf(this,Fe.prototype)}},Oe=class{constructor(e,t){this.code=e,this.rawMessage=t,this.message=`Magic SDK Warning: [${e}] ${t}`}log(){console.warn(this.message)}},mt=class extends Error{constructor(e,t,r,o){super(`Magic Extension Error (${e.name}): [${t}] ${r}`),this.code=t,this.rawMessage=r,this.data=o,this.__proto__=Error,Object.setPrototypeOf(this,mt.prototype)}},ft=class{constructor(e,t,r){this.code=t,this.rawMessage=r,this.message=`Magic Extension Warning (${e.name}): [${t}] ${r}`}log(){console.warn(this.message)}};function wo(){return new Ee(pe.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")}function Pt(){return new Ee(pe.ModalNotReady,"Modal is not ready.")}function bo(){return new Ee(pe.MalformedResponse,"Response from the Magic iframe is malformed.")}function Ro(e){return new Ee(pe.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 Ao(e){let t=`Some extensions are incompatible with \`${Y.sdkName}@${Y.version}\`:`;return e.filter(r=>typeof r.compat!="undefined"&&r.compat!==null).forEach(r=>{let o=r.compat[Y.sdkName];typeof o=="string"?t+=`
2
- - Extension \`${r.name}\` supports version(s) \`${o}\``:o||(t+=`
3
- - Extension \`${r.name}\` does not support ${Y.platform} environments.`)}),new Ee(pe.IncompatibleExtensions,t)}function So(e){let t=r=>{let o=r+1,a=o%10,s=o%100;return a===1&&s!==11?`${o}st`:a===2&&s!==12?`${o}nd`:a===3&&s!==13?`${o}rd`:`${o}th`};return new Ee(pe.InvalidArgument,`Invalid ${t(e.argument)} argument given to \`${e.procedure}\`.
1
+ "use strict";var Magic=(()=>{var qu=Object.create;var or=Object.defineProperty;var Vu=Object.getOwnPropertyDescriptor;var zu=Object.getOwnPropertyNames,Ei=Object.getOwnPropertySymbols,Xu=Object.getPrototypeOf,Si=Object.prototype.hasOwnProperty,Ju=Object.prototype.propertyIsEnumerable;var bi=(e,t,r)=>t in e?or(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_i=(e,t)=>{for(var r in t||(t={}))Si.call(t,r)&&bi(e,r,t[r]);if(Ei)for(var r of Ei(t))Ju.call(t,r)&&bi(e,r,t[r]);return e};var ir=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var Ii=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),wi=(e,t)=>{for(var r in t)or(e,r,{get:t[r],enumerable:!0})},xi=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of zu(t))!Si.call(e,o)&&o!==r&&or(e,o,{get:()=>t[o],enumerable:!(n=Vu(t,o))||n.enumerable});return e};var Ti=(e,t,r)=>(r=e!=null?qu(Xu(e)):{},xi(t||!e||!e.__esModule?or(r,"default",{value:e,enumerable:!0}):r,e)),Zu=e=>xi(or({},"__esModule",{value:!0}),e);var xt=(e,t,r)=>new Promise((n,o)=>{var i=f=>{try{c(r.next(f))}catch(l){o(l)}},a=f=>{try{c(r.throw(f))}catch(l){o(l)}},c=f=>f.done?n(f.value):Promise.resolve(f.value).then(i,a);c((r=r.apply(e,t)).next())});var Xs=Ii((zs,Zo)=>{(function(e){if(typeof zs=="object"&&typeof Zo<"u")Zo.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,r;return function n(o,i,a){function c(p,g){if(!i[p]){if(!o[p]){var y=typeof ir=="function"&&ir;if(!g&&y)return y(p,!0);if(f)return f(p,!0);var I=new Error("Cannot find module '"+p+"'");throw I.code="MODULE_NOT_FOUND",I}var L=i[p]={exports:{}};o[p][0].call(L.exports,function(C){var N=o[p][1][C];return c(N||C)},L,L.exports,n,o,i,a)}return i[p].exports}for(var f=typeof ir=="function"&&ir,l=0;l<a.length;l++)c(a[l]);return c}({1:[function(n,o,i){(function(a){"use strict";var c=a.MutationObserver||a.WebKitMutationObserver,f;if(c){var l=0,p=new c(C),g=a.document.createTextNode("");p.observe(g,{characterData:!0}),f=function(){g.data=l=++l%2}}else if(!a.setImmediate&&typeof a.MessageChannel<"u"){var y=new a.MessageChannel;y.port1.onmessage=C,f=function(){y.port2.postMessage(0)}}else"document"in a&&"onreadystatechange"in a.document.createElement("script")?f=function(){var G=a.document.createElement("script");G.onreadystatechange=function(){C(),G.onreadystatechange=null,G.parentNode.removeChild(G),G=null},a.document.documentElement.appendChild(G)}:f=function(){setTimeout(C,0)};var I,L=[];function C(){I=!0;for(var G,Z,P=L.length;P;){for(Z=L,L=[],G=-1;++G<P;)Z[G]();P=L.length}I=!1}o.exports=N;function N(G){L.push(G)===1&&!I&&f()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,o,i){"use strict";var a=n(1);function c(){}var f={},l=["REJECTED"],p=["FULFILLED"],g=["PENDING"];o.exports=y;function y(O){if(typeof O!="function")throw new TypeError("resolver must be a function");this.state=g,this.queue=[],this.outcome=void 0,O!==c&&N(this,O)}y.prototype.catch=function(O){return this.then(null,O)},y.prototype.then=function(O,A){if(typeof O!="function"&&this.state===p||typeof A!="function"&&this.state===l)return this;var $=new this.constructor(c);if(this.state!==g){var q=this.state===p?O:A;L($,q,this.outcome)}else this.queue.push(new I($,O,A));return $};function I(O,A,$){this.promise=O,typeof A=="function"&&(this.onFulfilled=A,this.callFulfilled=this.otherCallFulfilled),typeof $=="function"&&(this.onRejected=$,this.callRejected=this.otherCallRejected)}I.prototype.callFulfilled=function(O){f.resolve(this.promise,O)},I.prototype.otherCallFulfilled=function(O){L(this.promise,this.onFulfilled,O)},I.prototype.callRejected=function(O){f.reject(this.promise,O)},I.prototype.otherCallRejected=function(O){L(this.promise,this.onRejected,O)};function L(O,A,$){a(function(){var q;try{q=A($)}catch(oe){return f.reject(O,oe)}q===O?f.reject(O,new TypeError("Cannot resolve promise with itself")):f.resolve(O,q)})}f.resolve=function(O,A){var $=G(C,A);if($.status==="error")return f.reject(O,$.value);var q=$.value;if(q)N(O,q);else{O.state=p,O.outcome=A;for(var oe=-1,me=O.queue.length;++oe<me;)O.queue[oe].callFulfilled(A)}return O},f.reject=function(O,A){O.state=l,O.outcome=A;for(var $=-1,q=O.queue.length;++$<q;)O.queue[$].callRejected(A);return O};function C(O){var A=O&&O.then;if(O&&(typeof O=="object"||typeof O=="function")&&typeof A=="function")return function(){A.apply(O,arguments)}}function N(O,A){var $=!1;function q(Ee){$||($=!0,f.reject(O,Ee))}function oe(Ee){$||($=!0,f.resolve(O,Ee))}function me(){A(oe,q)}var ye=G(me);ye.status==="error"&&q(ye.value)}function G(O,A){var $={};try{$.value=O(A),$.status="success"}catch(q){$.status="error",$.value=q}return $}y.resolve=Z;function Z(O){return O instanceof this?O:f.resolve(new this(c),O)}y.reject=P;function P(O){var A=new this(c);return f.reject(A,O)}y.all=$e;function $e(O){var A=this;if(Object.prototype.toString.call(O)!=="[object Array]")return this.reject(new TypeError("must be an array"));var $=O.length,q=!1;if(!$)return this.resolve([]);for(var oe=new Array($),me=0,ye=-1,Ee=new this(c);++ye<$;)ke(O[ye],ye);return Ee;function ke(ft,E){A.resolve(ft).then(_,function(R){q||(q=!0,f.reject(Ee,R))});function _(R){oe[E]=R,++me===$&&!q&&(q=!0,f.resolve(Ee,oe))}}}y.race=ue;function ue(O){var A=this;if(Object.prototype.toString.call(O)!=="[object Array]")return this.reject(new TypeError("must be an array"));var $=O.length,q=!1;if(!$)return this.resolve([]);for(var oe=-1,me=new this(c);++oe<$;)ye(O[oe]);return me;function ye(Ee){A.resolve(Ee).then(function(ke){q||(q=!0,f.resolve(me,ke))},function(ke){q||(q=!0,f.reject(me,ke))})}}},{1:1}],3:[function(n,o,i){(function(a){"use strict";typeof a.Promise!="function"&&(a.Promise=n(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,o,i){"use strict";var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s};function c(s,d){if(!(s instanceof d))throw new TypeError("Cannot call a class as a function")}function f(){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 l=f();function p(){try{if(!l||!l.open)return!1;var s=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),d=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!s||d)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function g(s,d){s=s||[],d=d||{};try{return new Blob(s,d)}catch(m){if(m.name!=="TypeError")throw m;for(var u=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,h=new u,v=0;v<s.length;v+=1)h.append(s[v]);return h.getBlob(d.type)}}typeof Promise>"u"&&n(3);var y=Promise;function I(s,d){d&&s.then(function(u){d(null,u)},function(u){d(u)})}function L(s,d,u){typeof d=="function"&&s.then(d),typeof u=="function"&&s.catch(u)}function C(s){return typeof s!="string"&&(console.warn(s+" used as a key, but it is not a string."),s=String(s)),s}function N(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var G="local-forage-detect-blob-support",Z=void 0,P={},$e=Object.prototype.toString,ue="readonly",O="readwrite";function A(s){for(var d=s.length,u=new ArrayBuffer(d),h=new Uint8Array(u),v=0;v<d;v++)h[v]=s.charCodeAt(v);return u}function $(s){return new y(function(d){var u=s.transaction(G,O),h=g([""]);u.objectStore(G).put(h,"key"),u.onabort=function(v){v.preventDefault(),v.stopPropagation(),d(!1)},u.oncomplete=function(){var v=navigator.userAgent.match(/Chrome\/(\d+)/),m=navigator.userAgent.match(/Edge\//);d(m||!v||parseInt(v[1],10)>=43)}}).catch(function(){return!1})}function q(s){return typeof Z=="boolean"?y.resolve(Z):$(s).then(function(d){return Z=d,Z})}function oe(s){var d=P[s.name],u={};u.promise=new y(function(h,v){u.resolve=h,u.reject=v}),d.deferredOperations.push(u),d.dbReady?d.dbReady=d.dbReady.then(function(){return u.promise}):d.dbReady=u.promise}function me(s){var d=P[s.name],u=d.deferredOperations.pop();if(u)return u.resolve(),u.promise}function ye(s,d){var u=P[s.name],h=u.deferredOperations.pop();if(h)return h.reject(d),h.promise}function Ee(s,d){return new y(function(u,h){if(P[s.name]=P[s.name]||ce(),s.db)if(d)oe(s),s.db.close();else return u(s.db);var v=[s.name];d&&v.push(s.version);var m=l.open.apply(l,v);d&&(m.onupgradeneeded=function(b){var S=m.result;try{S.createObjectStore(s.storeName),b.oldVersion<=1&&S.createObjectStore(G)}catch(w){if(w.name==="ConstraintError")console.warn('The database "'+s.name+'" has been upgraded from version '+b.oldVersion+" to version "+b.newVersion+', but the storage "'+s.storeName+'" already exists.');else throw w}}),m.onerror=function(b){b.preventDefault(),h(m.error)},m.onsuccess=function(){var b=m.result;b.onversionchange=function(S){S.target.close()},u(b),me(s)}})}function ke(s){return Ee(s,!1)}function ft(s){return Ee(s,!0)}function E(s,d){if(!s.db)return!0;var u=!s.db.objectStoreNames.contains(s.storeName),h=s.version<s.db.version,v=s.version>s.db.version;if(h&&(s.version!==d&&console.warn('The database "'+s.name+`" can't be downgraded from version `+s.db.version+" to version "+s.version+"."),s.version=s.db.version),v||u){if(u){var m=s.db.version+1;m>s.version&&(s.version=m)}return!0}return!1}function _(s){return new y(function(d,u){var h=new FileReader;h.onerror=u,h.onloadend=function(v){var m=btoa(v.target.result||"");d({__local_forage_encoded_blob:!0,data:m,type:s.type})},h.readAsBinaryString(s)})}function R(s){var d=A(atob(s.data));return g([d],{type:s.type})}function D(s){return s&&s.__local_forage_encoded_blob}function U(s){var d=this,u=d._initReady().then(function(){var h=P[d._dbInfo.name];if(h&&h.dbReady)return h.dbReady});return L(u,s,s),u}function F(s){oe(s);for(var d=P[s.name],u=d.forages,h=0;h<u.length;h++){var v=u[h];v._dbInfo.db&&(v._dbInfo.db.close(),v._dbInfo.db=null)}return s.db=null,ke(s).then(function(m){return s.db=m,E(s)?ft(s):m}).then(function(m){s.db=d.db=m;for(var b=0;b<u.length;b++)u[b]._dbInfo.db=m}).catch(function(m){throw ye(s,m),m})}function V(s,d,u,h){h===void 0&&(h=1);try{var v=s.db.transaction(s.storeName,d);u(null,v)}catch(m){if(h>0&&(!s.db||m.name==="InvalidStateError"||m.name==="NotFoundError"))return y.resolve().then(function(){if(!s.db||m.name==="NotFoundError"&&!s.db.objectStoreNames.contains(s.storeName)&&s.version<=s.db.version)return s.db&&(s.version=s.db.version+1),ft(s)}).then(function(){return F(s).then(function(){V(s,d,u,h-1)})}).catch(u);u(m)}}function ce(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function It(s){var d=this,u={db:null};if(s)for(var h in s)u[h]=s[h];var v=P[u.name];v||(v=ce(),P[u.name]=v),v.forages.push(d),d._initReady||(d._initReady=d.ready,d.ready=U);var m=[];function b(){return y.resolve()}for(var S=0;S<v.forages.length;S++){var w=v.forages[S];w!==d&&m.push(w._initReady().catch(b))}var x=v.forages.slice(0);return y.all(m).then(function(){return u.db=v.db,ke(u)}).then(function(T){return u.db=T,E(u,d._defaultConfig.version)?ft(u):T}).then(function(T){u.db=v.db=T,d._dbInfo=u;for(var M=0;M<x.length;M++){var j=x[M];j!==d&&(j._dbInfo.db=u.db,j._dbInfo.version=u.version)}})}function dt(s,d){var u=this;s=C(s);var h=new y(function(v,m){u.ready().then(function(){V(u._dbInfo,ue,function(b,S){if(b)return m(b);try{var w=S.objectStore(u._dbInfo.storeName),x=w.get(s);x.onsuccess=function(){var T=x.result;T===void 0&&(T=null),D(T)&&(T=R(T)),v(T)},x.onerror=function(){m(x.error)}}catch(T){m(T)}})}).catch(m)});return I(h,d),h}function tr(s,d){var u=this,h=new y(function(v,m){u.ready().then(function(){V(u._dbInfo,ue,function(b,S){if(b)return m(b);try{var w=S.objectStore(u._dbInfo.storeName),x=w.openCursor(),T=1;x.onsuccess=function(){var M=x.result;if(M){var j=M.value;D(j)&&(j=R(j));var z=s(j,M.key,T++);z!==void 0?v(z):M.continue()}else v()},x.onerror=function(){m(x.error)}}catch(M){m(M)}})}).catch(m)});return I(h,d),h}function Qs(s,d,u){var h=this;s=C(s);var v=new y(function(m,b){var S;h.ready().then(function(){return S=h._dbInfo,$e.call(d)==="[object Blob]"?q(S.db).then(function(w){return w?d:_(d)}):d}).then(function(w){V(h._dbInfo,O,function(x,T){if(x)return b(x);try{var M=T.objectStore(h._dbInfo.storeName);w===null&&(w=void 0);var j=M.put(w,s);T.oncomplete=function(){w===void 0&&(w=null),m(w)},T.onabort=T.onerror=function(){var z=j.error?j.error:j.transaction.error;b(z)}}catch(z){b(z)}})}).catch(b)});return I(v,u),v}function eu(s,d){var u=this;s=C(s);var h=new y(function(v,m){u.ready().then(function(){V(u._dbInfo,O,function(b,S){if(b)return m(b);try{var w=S.objectStore(u._dbInfo.storeName),x=w.delete(s);S.oncomplete=function(){v()},S.onerror=function(){m(x.error)},S.onabort=function(){var T=x.error?x.error:x.transaction.error;m(T)}}catch(T){m(T)}})}).catch(m)});return I(h,d),h}function tu(s){var d=this,u=new y(function(h,v){d.ready().then(function(){V(d._dbInfo,O,function(m,b){if(m)return v(m);try{var S=b.objectStore(d._dbInfo.storeName),w=S.clear();b.oncomplete=function(){h()},b.onabort=b.onerror=function(){var x=w.error?w.error:w.transaction.error;v(x)}}catch(x){v(x)}})}).catch(v)});return I(u,s),u}function ru(s){var d=this,u=new y(function(h,v){d.ready().then(function(){V(d._dbInfo,ue,function(m,b){if(m)return v(m);try{var S=b.objectStore(d._dbInfo.storeName),w=S.count();w.onsuccess=function(){h(w.result)},w.onerror=function(){v(w.error)}}catch(x){v(x)}})}).catch(v)});return I(u,s),u}function nu(s,d){var u=this,h=new y(function(v,m){if(s<0){v(null);return}u.ready().then(function(){V(u._dbInfo,ue,function(b,S){if(b)return m(b);try{var w=S.objectStore(u._dbInfo.storeName),x=!1,T=w.openKeyCursor();T.onsuccess=function(){var M=T.result;if(!M){v(null);return}s===0||x?v(M.key):(x=!0,M.advance(s))},T.onerror=function(){m(T.error)}}catch(M){m(M)}})}).catch(m)});return I(h,d),h}function ou(s){var d=this,u=new y(function(h,v){d.ready().then(function(){V(d._dbInfo,ue,function(m,b){if(m)return v(m);try{var S=b.objectStore(d._dbInfo.storeName),w=S.openKeyCursor(),x=[];w.onsuccess=function(){var T=w.result;if(!T){h(x);return}x.push(T.key),T.continue()},w.onerror=function(){v(w.error)}}catch(T){v(T)}})}).catch(v)});return I(u,s),u}function iu(s,d){d=N.apply(this,arguments);var u=this.config();s=typeof s!="function"&&s||{},s.name||(s.name=s.name||u.name,s.storeName=s.storeName||u.storeName);var h=this,v;if(!s.name)v=y.reject("Invalid arguments");else{var m=s.name===u.name&&h._dbInfo.db,b=m?y.resolve(h._dbInfo.db):ke(s).then(function(S){var w=P[s.name],x=w.forages;w.db=S;for(var T=0;T<x.length;T++)x[T]._dbInfo.db=S;return S});s.storeName?v=b.then(function(S){if(!!S.objectStoreNames.contains(s.storeName)){var w=S.version+1;oe(s);var x=P[s.name],T=x.forages;S.close();for(var M=0;M<T.length;M++){var j=T[M];j._dbInfo.db=null,j._dbInfo.version=w}var z=new y(function(X,ae){var ie=l.open(s.name,w);ie.onerror=function(Re){var nr=ie.result;nr.close(),ae(Re)},ie.onupgradeneeded=function(){var Re=ie.result;Re.deleteObjectStore(s.storeName)},ie.onsuccess=function(){var Re=ie.result;Re.close(),X(Re)}});return z.then(function(X){x.db=X;for(var ae=0;ae<T.length;ae++){var ie=T[ae];ie._dbInfo.db=X,me(ie._dbInfo)}}).catch(function(X){throw(ye(s,X)||y.resolve()).catch(function(){}),X})}}):v=b.then(function(S){oe(s);var w=P[s.name],x=w.forages;S.close();for(var T=0;T<x.length;T++){var M=x[T];M._dbInfo.db=null}var j=new y(function(z,X){var ae=l.deleteDatabase(s.name);ae.onerror=function(){var ie=ae.result;ie&&ie.close(),X(ae.error)},ae.onblocked=function(){console.warn('dropInstance blocked for database "'+s.name+'" until all open connections are closed')},ae.onsuccess=function(){var ie=ae.result;ie&&ie.close(),z(ie)}});return j.then(function(z){w.db=z;for(var X=0;X<x.length;X++){var ae=x[X];me(ae._dbInfo)}}).catch(function(z){throw(ye(s,z)||y.resolve()).catch(function(){}),z})})}return I(v,d),v}var au={_driver:"asyncStorage",_initStorage:It,_support:p(),iterate:tr,getItem:dt,setItem:Qs,removeItem:eu,clear:tu,length:ru,key:nu,keys:ou,dropInstance:iu};function su(){return typeof openDatabase=="function"}var nt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",uu="~~local_forage_type~",ei=/^~~local_forage_type~([^~]+)~/,Mr="__lfsc__:",kn=Mr.length,Pn="arbf",Dn="blob",ti="si08",ri="ui08",ni="uic8",oi="si16",ii="si32",ai="ur16",si="ui32",ui="fl32",ci="fl64",li=kn+Pn.length,fi=Object.prototype.toString;function di(s){var d=s.length*.75,u=s.length,h,v=0,m,b,S,w;s[s.length-1]==="="&&(d--,s[s.length-2]==="="&&d--);var x=new ArrayBuffer(d),T=new Uint8Array(x);for(h=0;h<u;h+=4)m=nt.indexOf(s[h]),b=nt.indexOf(s[h+1]),S=nt.indexOf(s[h+2]),w=nt.indexOf(s[h+3]),T[v++]=m<<2|b>>4,T[v++]=(b&15)<<4|S>>2,T[v++]=(S&3)<<6|w&63;return x}function Un(s){var d=new Uint8Array(s),u="",h;for(h=0;h<d.length;h+=3)u+=nt[d[h]>>2],u+=nt[(d[h]&3)<<4|d[h+1]>>4],u+=nt[(d[h+1]&15)<<2|d[h+2]>>6],u+=nt[d[h+2]&63];return d.length%3===2?u=u.substring(0,u.length-1)+"=":d.length%3===1&&(u=u.substring(0,u.length-2)+"=="),u}function cu(s,d){var u="";if(s&&(u=fi.call(s)),s&&(u==="[object ArrayBuffer]"||s.buffer&&fi.call(s.buffer)==="[object ArrayBuffer]")){var h,v=Mr;s instanceof ArrayBuffer?(h=s,v+=Pn):(h=s.buffer,u==="[object Int8Array]"?v+=ti:u==="[object Uint8Array]"?v+=ri:u==="[object Uint8ClampedArray]"?v+=ni:u==="[object Int16Array]"?v+=oi:u==="[object Uint16Array]"?v+=ai:u==="[object Int32Array]"?v+=ii:u==="[object Uint32Array]"?v+=si:u==="[object Float32Array]"?v+=ui:u==="[object Float64Array]"?v+=ci:d(new Error("Failed to get type for BinaryArray"))),d(v+Un(h))}else if(u==="[object Blob]"){var m=new FileReader;m.onload=function(){var b=uu+s.type+"~"+Un(this.result);d(Mr+Dn+b)},m.readAsArrayBuffer(s)}else try{d(JSON.stringify(s))}catch(b){console.error("Couldn't convert value into a JSON string: ",s),d(null,b)}}function lu(s){if(s.substring(0,kn)!==Mr)return JSON.parse(s);var d=s.substring(li),u=s.substring(kn,li),h;if(u===Dn&&ei.test(d)){var v=d.match(ei);h=v[1],d=d.substring(v[0].length)}var m=di(d);switch(u){case Pn:return m;case Dn:return g([m],{type:h});case ti:return new Int8Array(m);case ri:return new Uint8Array(m);case ni:return new Uint8ClampedArray(m);case oi:return new Int16Array(m);case ai:return new Uint16Array(m);case ii:return new Int32Array(m);case si:return new Uint32Array(m);case ui:return new Float32Array(m);case ci:return new Float64Array(m);default:throw new Error("Unkown type: "+u)}}var Bn={serialize:cu,deserialize:lu,stringToBuffer:di,bufferToString:Un};function pi(s,d,u,h){s.executeSql("CREATE TABLE IF NOT EXISTS "+d.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],u,h)}function fu(s){var d=this,u={db:null};if(s)for(var h in s)u[h]=typeof s[h]!="string"?s[h].toString():s[h];var v=new y(function(m,b){try{u.db=openDatabase(u.name,String(u.version),u.description,u.size)}catch(S){return b(S)}u.db.transaction(function(S){pi(S,u,function(){d._dbInfo=u,m()},function(w,x){b(x)})},b)});return u.serializer=Bn,v}function ot(s,d,u,h,v,m){s.executeSql(u,h,v,function(b,S){S.code===S.SYNTAX_ERR?b.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[d.storeName],function(w,x){x.rows.length?m(w,S):pi(w,d,function(){w.executeSql(u,h,v,m)},m)},m):m(b,S)},m)}function du(s,d){var u=this;s=C(s);var h=new y(function(v,m){u.ready().then(function(){var b=u._dbInfo;b.db.transaction(function(S){ot(S,b,"SELECT * FROM "+b.storeName+" WHERE key = ? LIMIT 1",[s],function(w,x){var T=x.rows.length?x.rows.item(0).value:null;T&&(T=b.serializer.deserialize(T)),v(T)},function(w,x){m(x)})})}).catch(m)});return I(h,d),h}function pu(s,d){var u=this,h=new y(function(v,m){u.ready().then(function(){var b=u._dbInfo;b.db.transaction(function(S){ot(S,b,"SELECT * FROM "+b.storeName,[],function(w,x){for(var T=x.rows,M=T.length,j=0;j<M;j++){var z=T.item(j),X=z.value;if(X&&(X=b.serializer.deserialize(X)),X=s(X,z.key,j+1),X!==void 0){v(X);return}}v()},function(w,x){m(x)})})}).catch(m)});return I(h,d),h}function mi(s,d,u,h){var v=this;s=C(s);var m=new y(function(b,S){v.ready().then(function(){d===void 0&&(d=null);var w=d,x=v._dbInfo;x.serializer.serialize(d,function(T,M){M?S(M):x.db.transaction(function(j){ot(j,x,"INSERT OR REPLACE INTO "+x.storeName+" (key, value) VALUES (?, ?)",[s,T],function(){b(w)},function(z,X){S(X)})},function(j){if(j.code===j.QUOTA_ERR){if(h>0){b(mi.apply(v,[s,w,u,h-1]));return}S(j)}})})}).catch(S)});return I(m,u),m}function mu(s,d,u){return mi.apply(this,[s,d,u,1])}function hu(s,d){var u=this;s=C(s);var h=new y(function(v,m){u.ready().then(function(){var b=u._dbInfo;b.db.transaction(function(S){ot(S,b,"DELETE FROM "+b.storeName+" WHERE key = ?",[s],function(){v()},function(w,x){m(x)})})}).catch(m)});return I(h,d),h}function vu(s){var d=this,u=new y(function(h,v){d.ready().then(function(){var m=d._dbInfo;m.db.transaction(function(b){ot(b,m,"DELETE FROM "+m.storeName,[],function(){h()},function(S,w){v(w)})})}).catch(v)});return I(u,s),u}function gu(s){var d=this,u=new y(function(h,v){d.ready().then(function(){var m=d._dbInfo;m.db.transaction(function(b){ot(b,m,"SELECT COUNT(key) as c FROM "+m.storeName,[],function(S,w){var x=w.rows.item(0).c;h(x)},function(S,w){v(w)})})}).catch(v)});return I(u,s),u}function yu(s,d){var u=this,h=new y(function(v,m){u.ready().then(function(){var b=u._dbInfo;b.db.transaction(function(S){ot(S,b,"SELECT key FROM "+b.storeName+" WHERE id = ? LIMIT 1",[s+1],function(w,x){var T=x.rows.length?x.rows.item(0).key:null;v(T)},function(w,x){m(x)})})}).catch(m)});return I(h,d),h}function Eu(s){var d=this,u=new y(function(h,v){d.ready().then(function(){var m=d._dbInfo;m.db.transaction(function(b){ot(b,m,"SELECT key FROM "+m.storeName,[],function(S,w){for(var x=[],T=0;T<w.rows.length;T++)x.push(w.rows.item(T).key);h(x)},function(S,w){v(w)})})}).catch(v)});return I(u,s),u}function bu(s){return new y(function(d,u){s.transaction(function(h){h.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(v,m){for(var b=[],S=0;S<m.rows.length;S++)b.push(m.rows.item(S).name);d({db:s,storeNames:b})},function(v,m){u(m)})},function(h){u(h)})})}function Su(s,d){d=N.apply(this,arguments);var u=this.config();s=typeof s!="function"&&s||{},s.name||(s.name=s.name||u.name,s.storeName=s.storeName||u.storeName);var h=this,v;return s.name?v=new y(function(m){var b;s.name===u.name?b=h._dbInfo.db:b=openDatabase(s.name,"","",0),s.storeName?m({db:b,storeNames:[s.storeName]}):m(bu(b))}).then(function(m){return new y(function(b,S){m.db.transaction(function(w){function x(z){return new y(function(X,ae){w.executeSql("DROP TABLE IF EXISTS "+z,[],function(){X()},function(ie,Re){ae(Re)})})}for(var T=[],M=0,j=m.storeNames.length;M<j;M++)T.push(x(m.storeNames[M]));y.all(T).then(function(){b()}).catch(function(z){S(z)})},function(w){S(w)})})}):v=y.reject("Invalid arguments"),I(v,d),v}var _u={_driver:"webSQLStorage",_initStorage:fu,_support:su(),iterate:pu,getItem:du,setItem:mu,removeItem:hu,clear:vu,length:gu,key:yu,keys:Eu,dropInstance:Su};function Iu(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function hi(s,d){var u=s.name+"/";return s.storeName!==d.storeName&&(u+=s.storeName+"/"),u}function wu(){var s="_localforage_support_test";try{return localStorage.setItem(s,!0),localStorage.removeItem(s),!1}catch{return!0}}function xu(){return!wu()||localStorage.length>0}function Tu(s){var d=this,u={};if(s)for(var h in s)u[h]=s[h];return u.keyPrefix=hi(s,d._defaultConfig),xu()?(d._dbInfo=u,u.serializer=Bn,y.resolve()):y.reject()}function Ru(s){var d=this,u=d.ready().then(function(){for(var h=d._dbInfo.keyPrefix,v=localStorage.length-1;v>=0;v--){var m=localStorage.key(v);m.indexOf(h)===0&&localStorage.removeItem(m)}});return I(u,s),u}function Ou(s,d){var u=this;s=C(s);var h=u.ready().then(function(){var v=u._dbInfo,m=localStorage.getItem(v.keyPrefix+s);return m&&(m=v.serializer.deserialize(m)),m});return I(h,d),h}function Cu(s,d){var u=this,h=u.ready().then(function(){for(var v=u._dbInfo,m=v.keyPrefix,b=m.length,S=localStorage.length,w=1,x=0;x<S;x++){var T=localStorage.key(x);if(T.indexOf(m)===0){var M=localStorage.getItem(T);if(M&&(M=v.serializer.deserialize(M)),M=s(M,T.substring(b),w++),M!==void 0)return M}}});return I(h,d),h}function Au(s,d){var u=this,h=u.ready().then(function(){var v=u._dbInfo,m;try{m=localStorage.key(s)}catch{m=null}return m&&(m=m.substring(v.keyPrefix.length)),m});return I(h,d),h}function Lu(s){var d=this,u=d.ready().then(function(){for(var h=d._dbInfo,v=localStorage.length,m=[],b=0;b<v;b++){var S=localStorage.key(b);S.indexOf(h.keyPrefix)===0&&m.push(S.substring(h.keyPrefix.length))}return m});return I(u,s),u}function Nu(s){var d=this,u=d.keys().then(function(h){return h.length});return I(u,s),u}function Mu(s,d){var u=this;s=C(s);var h=u.ready().then(function(){var v=u._dbInfo;localStorage.removeItem(v.keyPrefix+s)});return I(h,d),h}function ku(s,d,u){var h=this;s=C(s);var v=h.ready().then(function(){d===void 0&&(d=null);var m=d;return new y(function(b,S){var w=h._dbInfo;w.serializer.serialize(d,function(x,T){if(T)S(T);else try{localStorage.setItem(w.keyPrefix+s,x),b(m)}catch(M){(M.name==="QuotaExceededError"||M.name==="NS_ERROR_DOM_QUOTA_REACHED")&&S(M),S(M)}})})});return I(v,u),v}function Pu(s,d){if(d=N.apply(this,arguments),s=typeof s!="function"&&s||{},!s.name){var u=this.config();s.name=s.name||u.name,s.storeName=s.storeName||u.storeName}var h=this,v;return s.name?v=new y(function(m){s.storeName?m(hi(s,h._defaultConfig)):m(s.name+"/")}).then(function(m){for(var b=localStorage.length-1;b>=0;b--){var S=localStorage.key(b);S.indexOf(m)===0&&localStorage.removeItem(S)}}):v=y.reject("Invalid arguments"),I(v,d),v}var Du={_driver:"localStorageWrapper",_initStorage:Tu,_support:Iu(),iterate:Cu,getItem:Ou,setItem:ku,removeItem:Mu,clear:Ru,length:Nu,key:Au,keys:Lu,dropInstance:Pu},Uu=function(d,u){return d===u||typeof d=="number"&&typeof u=="number"&&isNaN(d)&&isNaN(u)},Bu=function(d,u){for(var h=d.length,v=0;v<h;){if(Uu(d[v],u))return!0;v++}return!1},vi=Array.isArray||function(s){return Object.prototype.toString.call(s)==="[object Array]"},rr={},gi={},wt={INDEXEDDB:au,WEBSQL:_u,LOCALSTORAGE:Du},$u=[wt.INDEXEDDB._driver,wt.WEBSQL._driver,wt.LOCALSTORAGE._driver],kr=["dropInstance"],$n=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(kr),Fu={description:"",driver:$u.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Gu(s,d){s[d]=function(){var u=arguments;return s.ready().then(function(){return s[d].apply(s,u)})}}function Fn(){for(var s=1;s<arguments.length;s++){var d=arguments[s];if(d)for(var u in d)d.hasOwnProperty(u)&&(vi(d[u])?arguments[0][u]=d[u].slice():arguments[0][u]=d[u])}return arguments[0]}var ju=function(){function s(d){c(this,s);for(var u in wt)if(wt.hasOwnProperty(u)){var h=wt[u],v=h._driver;this[u]=v,rr[v]||this.defineDriver(h)}this._defaultConfig=Fn({},Fu),this._config=Fn({},this._defaultConfig,d),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return s.prototype.config=function(u){if((typeof u>"u"?"undefined":a(u))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var h in u){if(h==="storeName"&&(u[h]=u[h].replace(/\W/g,"_")),h==="version"&&typeof u[h]!="number")return new Error("Database version must be a number.");this._config[h]=u[h]}return"driver"in u&&u.driver?this.setDriver(this._config.driver):!0}else return typeof u=="string"?this._config[u]:this._config},s.prototype.defineDriver=function(u,h,v){var m=new y(function(b,S){try{var w=u._driver,x=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!u._driver){S(x);return}for(var T=$n.concat("_initStorage"),M=0,j=T.length;M<j;M++){var z=T[M],X=!Bu(kr,z);if((X||u[z])&&typeof u[z]!="function"){S(x);return}}var ae=function(){for(var nr=function(Ku){return function(){var Yu=new Error("Method "+Ku+" is not implemented by the current driver"),yi=y.reject(Yu);return I(yi,arguments[arguments.length-1]),yi}},Gn=0,Hu=kr.length;Gn<Hu;Gn++){var jn=kr[Gn];u[jn]||(u[jn]=nr(jn))}};ae();var ie=function(nr){rr[w]&&console.info("Redefining LocalForage driver: "+w),rr[w]=u,gi[w]=nr,b()};"_support"in u?u._support&&typeof u._support=="function"?u._support().then(ie,S):ie(!!u._support):ie(!0)}catch(Re){S(Re)}});return L(m,h,v),m},s.prototype.driver=function(){return this._driver||null},s.prototype.getDriver=function(u,h,v){var m=rr[u]?y.resolve(rr[u]):y.reject(new Error("Driver not found."));return L(m,h,v),m},s.prototype.getSerializer=function(u){var h=y.resolve(Bn);return L(h,u),h},s.prototype.ready=function(u){var h=this,v=h._driverSet.then(function(){return h._ready===null&&(h._ready=h._initDriver()),h._ready});return L(v,u,u),v},s.prototype.setDriver=function(u,h,v){var m=this;vi(u)||(u=[u]);var b=this._getSupportedDrivers(u);function S(){m._config.driver=m.driver()}function w(M){return m._extend(M),S(),m._ready=m._initStorage(m._config),m._ready}function x(M){return function(){var j=0;function z(){for(;j<M.length;){var X=M[j];return j++,m._dbInfo=null,m._ready=null,m.getDriver(X).then(w).catch(z)}S();var ae=new Error("No available storage method found.");return m._driverSet=y.reject(ae),m._driverSet}return z()}}var T=this._driverSet!==null?this._driverSet.catch(function(){return y.resolve()}):y.resolve();return this._driverSet=T.then(function(){var M=b[0];return m._dbInfo=null,m._ready=null,m.getDriver(M).then(function(j){m._driver=j._driver,S(),m._wrapLibraryMethodsWithReady(),m._initDriver=x(b)})}).catch(function(){S();var M=new Error("No available storage method found.");return m._driverSet=y.reject(M),m._driverSet}),L(this._driverSet,h,v),this._driverSet},s.prototype.supports=function(u){return!!gi[u]},s.prototype._extend=function(u){Fn(this,u)},s.prototype._getSupportedDrivers=function(u){for(var h=[],v=0,m=u.length;v<m;v++){var b=u[v];this.supports(b)&&h.push(b)}return h},s.prototype._wrapLibraryMethodsWithReady=function(){for(var u=0,h=$n.length;u<h;u++)Gu(this,$n[u])},s.prototype.createInstance=function(u){return new s(u)},s}(),Wu=new ju;o.exports=Wu},{3:3}]},{},[4])(4)})});var Zs=Ii((Ln,Js)=>{(function(e,t){typeof Ln=="object"&&typeof Js<"u"?t(Ln):typeof define=="function"&&define.amd?define("localforage-driver-memory",["exports"],t):t(e.LocalforageDriverMemory={})})(typeof self<"u"?self:Ln,function(e){"use strict";var t="localforage-driver-memory";function r(E){var _=typeof Symbol=="function"&&E[Symbol.iterator],R=0;return _?_.call(E):{next:function(){return E&&R>=E.length&&(E=void 0),{value:E&&E[R++],done:!E}}}}function n(E,_){E=E||[],_=_||{};try{return new Blob(E,_)}catch(F){if(F.name!=="TypeError")throw F;for(var R=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,D=new R,U=0;U<E.length;U+=1)D.append(E[U]);return D.getBlob(_.type)}}var o=/^~~local_forage_type~([^~]+)~/,i=9,a=i+4,c=Object.prototype.toString;function f(E){var _=E.length*.75,R=E.length;E[E.length-1]==="="&&(_--,E[E.length-2]==="="&&_--);for(var D=new ArrayBuffer(_),U=new Uint8Array(D),F=0,V=0;F<R;F+=4){var ce="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(E[F]),It="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(E[F+1]),dt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(E[F+2]),tr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(E[F+3]);U[V++]=ce<<2|It>>4,U[V++]=(It&15)<<4|dt>>2,U[V++]=(dt&3)<<6|tr&63}return D}function l(E){for(var _=new Uint8Array(E),R="",D=0;D<_.length;D+=3)R+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[_[D]>>2],R+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(_[D]&3)<<4|_[D+1]>>4],R+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(_[D+1]&15)<<2|_[D+2]>>6],R+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[_[D+2]&63];return _.length%3===2?R=R.substring(0,R.length-1)+"=":_.length%3===1&&(R=R.substring(0,R.length-2)+"=="),R}function p(E,_){var R="";if(E&&(R=c.call(E)),E&&(R==="[object ArrayBuffer]"||E.buffer&&c.call(E.buffer)==="[object ArrayBuffer]")){var D=void 0,U="__lfsc__:";E instanceof ArrayBuffer?(D=E,U+="arbf"):(D=E.buffer,R==="[object Int8Array]"?U+="si08":R==="[object Uint8Array]"?U+="ui08":R==="[object Uint8ClampedArray]"?U+="uic8":R==="[object Int16Array]"?U+="si16":R==="[object Uint16Array]"?U+="ur16":R==="[object Int32Array]"?U+="si32":R==="[object Uint32Array]"?U+="ui32":R==="[object Float32Array]"?U+="fl32":R==="[object Float64Array]"?U+="fl64":_(new Error("Failed to get type for BinaryArray"))),_(U+l(D))}else if(R==="[object Blob]"){var F=new FileReader;F.onload=function(){var V="~~local_forage_type~"+E.type+"~"+l(this.result);_("__lfsc__:blob"+V)},F.readAsArrayBuffer(E)}else try{_(JSON.stringify(E))}catch(V){console.error("Couldn't convert value into a JSON string: ",E),_(null,V)}}function g(E){if(E.substring(0,i)!=="__lfsc__:")return JSON.parse(E);var _=E.substring(a),R=E.substring(i,a),D;if(R==="blob"&&o.test(_)){var U=_.match(o);D=U[1],_=_.substring(U[0].length)}var F=f(_);switch(R){case"arbf":return F;case"blob":return n([F],{type:D});case"si08":return new Int8Array(F);case"ui08":return new Uint8Array(F);case"uic8":return new Uint8ClampedArray(F);case"si16":return new Int16Array(F);case"ur16":return new Uint16Array(F);case"si32":return new Int32Array(F);case"ui32":return new Uint32Array(F);case"fl32":return new Float32Array(F);case"fl64":return new Float64Array(F);default:throw new Error("Unkown type: "+R)}}function y(E){var _,R;if(E===null||typeof E!="object"||"isActiveClone"in E)return E;var D=E instanceof Date?new Date(E):E.constructor();try{for(var U=r(Object.keys(E)),F=U.next();!F.done;F=U.next()){var V=F.value;Object.prototype.hasOwnProperty.call(E,V)&&(E.isActiveClone=null,D[V]=y(E[V]),delete E.isActiveClone)}}catch(ce){_={error:ce}}finally{try{F&&!F.done&&(R=U.return)&&R.call(U)}finally{if(_)throw _.error}}return D}function I(E,_){return(E.name||_.name)+"/"+(E.storeName||_.storeName)+"/"}function L(E,_){_&&E.then(function(R){_(null,R)},function(R){_(R)})}function C(){for(var E=[],_=0;_<arguments.length;_++)E[_]=arguments[_];if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}function N(E,_){var R=this;if(_=C.apply(this,arguments),E=typeof E!="function"&&E||{},!E.name){var D=this.config();E.name=E.name||D.name,E.storeName=E.storeName||D.storeName}var U;return E.name?U=new Promise(function(F){E.storeName?F(I(E,R._defaultConfig)):F(E.name+"/")}):U=Promise.reject("Invalid arguments"),{promise:U,callback:_}}function G(E){return typeof E!="string"&&(console.warn(E+" used as a key, but it is not a string."),E=String(E)),E}var Z={bufferToString:l,deserialize:g,serialize:p,stringToBuffer:f},P={},$e=function(){function E(_){this.kp=_,this.data={}}return E.resolve=function(_){return P[_]||(P[_]=new E(_)),P[_]},E.prototype.clear=function(){this.data={}},E.prototype.drop=function(){this.clear(),delete P[this.kp]},E.prototype.get=function(_){return this.data[_]},E.prototype.key=function(_){return this.keys()[_]},E.prototype.keys=function(){return Object.keys(this.data)},E.prototype.rm=function(_){delete this.data[_]},E.prototype.set=function(_,R){this.data[_]=R},E}();function ue(E){var _=E?y(E):{},R=I(_,this._defaultConfig),D=$e.resolve(R);return this._dbInfo=_,this._dbInfo.serializer=Z,this._dbInfo.keyPrefix=R,this._dbInfo.mStore=D,Promise.resolve()}function O(E){var _=this,R=this.ready().then(function(){_._dbInfo.mStore.clear()});return L(R,E),R}function A(E,_){var R=N.apply(this,arguments),D=R.promise,U=R.callback,F=D.then(function(V){$e.resolve(V).drop()});return L(F,U),D}function $(E,_){var R=this;E=G(E);var D=this.ready().then(function(){var U=R._dbInfo.mStore.get(E);return U==null?null:R._dbInfo.serializer.deserialize(U)});return L(D,_),D}function q(E,_){var R=this,D=this.ready().then(function(){for(var U=R._dbInfo.mStore,F=U.keys(),V=0;V<F.length;V++){var ce=U.get(F[V]);if(ce&&(ce=R._dbInfo.serializer.deserialize(ce)),ce=E(ce,F[V],V+1),ce!==void 0)return ce}});return L(D,_),D}function oe(E,_){var R=this,D=this.ready().then(function(){var U;try{U=R._dbInfo.mStore.key(E),U===void 0&&(U=null)}catch{U=null}return U});return L(D,_),D}function me(E){var _=this,R=this.ready().then(function(){return _._dbInfo.mStore.keys()});return L(R,E),R}function ye(E){var _=this.keys().then(function(R){return R.length});return L(_,E),_}function Ee(E,_){var R=this;E=G(E);var D=this.ready().then(function(){R._dbInfo.mStore.rm(E)});return L(D,_),D}function ke(E,_,R){var D=this;E=G(E);var U=this.ready().then(function(){_===void 0&&(_=null);var F=_;return new Promise(function(V,ce){D._dbInfo.serializer.serialize(_,function(It,dt){if(dt)ce(dt);else try{D._dbInfo.mStore.set(E,It),V(F)}catch(tr){ce(tr)}})})});return L(U,R),U}var ft=!0;e._support=ft,e._driver=t,e._initStorage=ue,e.clear=O,e.dropInstance=A,e.getItem=$,e.iterate=q,e.key=oe,e.keys=me,e.length=ye,e.removeItem=Ee,e.setItem=ke,Object.defineProperty(e,"__esModule",{value:!0})})});var vp={};wi(vp,{default:()=>hp});var qe=(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))(qe||{}),Ve=(e=>(e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE",e.ProductAnnouncement="ANNOUNCEMENT",e))(Ve||{}),Tt=(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))(Tt||{}),_e=(e=>(e.MetaMask="metamask",e.CoinbaseWallet="coinbase_wallet",e))(_e||{}),Rt=(e=>(e.WalletSelected="wallet_selected",e.WalletConnected="wallet_connected",e.WalletRejected="wallet_rejected",e))(Rt||{}),k=(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.NFTCheckout="magic_nft_checkout",e.NFTTransfer="magic_nft_transfer",e.RequestUserInfoWithUI="mc_request_user_info",e.Disconnect="mc_disconnect",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.EncryptV1="magic_auth_encrypt_v1",e.DecryptV1="magic_auth_decrypt_v1",e.ShowNFTs="magic_show_nfts",e.ShowOnRamp="magic_show_fiat_onramp",e.ShowSendTokensUI="magic_show_send_tokens_ui",e.ShowAddress="magic_show_address",e.ShowBalances="magic_show_balances",e.SendGaslessTransaction="eth_sendGaslessTransaction",e.RevealPK="magic_reveal_key",e))(k||{}),Fe=(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.MAGIC_SEND_PRODUCT_ANNOUNCEMENT="MAGIC_SEND_PRODUCT_ANNOUNCEMENT",e))(Fe||{}),pt=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e))(pt||{}),Ri=(e=>(e.UpdateEmail="update-email",e.MFA="mfa",e.Recovery="recovery",e))(Ri||{}),Oi=(e=>(e.Retry="retry",e))(Oi||{}),Ci=(e=>(e.EmailSent="email-sent",e.EmailNotDeliverable="email-not-deliverable",e))(Ci||{}),mt=(e=>(e.VerifyEmailOtp="verify-email-otp",e.Cancel="cancel",e))(mt||{}),Ai=(e=>(e.EmailOTPSent="email-otp-sent",e.InvalidEmailOtp="invalid-email-otp",e.ExpiredEmailOtp="expired-email-otp",e))(Ai||{}),ar=(e=>(e.Retry="device-retry",e))(ar||{}),Li=(e=>(e.DeviceApproved="device-approved",e.DeviceNeedsApproval="device-needs-approval",e.DeviceVerificationLinkExpired="device-verification-link-expired",e.DeviceVerificationEmailSent="device-verification-email-sent",e))(Li||{}),ze=(e=>(e.Retry="Recency/auth-factor-retry",e.Cancel="Recency/auth-factor-verification-cancel",e.VerifyEmailOtp="Recency/auth-factor-verify-email-otp",e))(ze||{}),Ni=(e=>(e.PrimaryAuthFactorNeedsVerification="Recency/auth-factor-needs-verification",e.PrimaryAuthFactorVerified="Recency/auth-factor-verified",e.InvalidEmailOtp="Recency/auth-factor-invalid-email-otp",e.EmailExpired="Recency/auth-factor-verification-email-expired",e.EmailSent="Recency/auth-factor-verification-email-sent",e.EmailNotDeliverable="Recency/auth-factor-verification-email-not-deliverable",e))(Ni||{}),Xe=(e=>(e.RetryWithNewEmail="UpdateEmail/retry-with-new-email",e.Cancel="UpdateEmail/new-email-verification-cancel",e.VerifyEmailOtp="UpdateEmail/new-email-verify-otp",e))(Xe||{}),Mi=(e=>(e.NewAuthFactorNeedsVerification="UpdateEmail/new-email-needs-verification",e.EmailUpdated="UpdateEmail/email-updated",e.InvalidEmailOtp="UpdateEmail/new-email-invalid-email-otp",e.EmailExpired="UpdateEmail/new-email-verification-email-expired",e.EmailSent="UpdateEmail/new-email-verification-email-sent",e.EmailNotDeliverable="UpdateEmail/new-email-verification-email-not-deliverable",e.InvalidEmail="UpdateEmail/new-email-invalid",e.EmailAlreadyExists="UpdateEmail/new-email-already-exists",e))(Mi||{}),ki=(e=>(e.IDTokenCreated="Auth/id-token-created",e))(ki||{}),Pi=(e=>(e.Harmony="HARMONY",e))(Pi||{}),Di=(e=>(e.PhoneNumber="phone_number",e))(Di||{}),Ui=(e=>(e.Success="nft-checkout-success",e.Failure="nft-checkout-failure",e.Initiated="nft-checkout-initiated",e.Disconnect="disconnect",e))(Ui||{}),Bi=(e=>(e.WalletInfoFetched="Wallet/wallet-info-fetched",e))(Bi||{});var Q={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},Oe=console,it={};Object.keys(Q).forEach(function(e){it[e]=Oe[e]});var sr="Datadog Browser SDK:",K={debug:it.debug.bind(Oe,sr),log:it.log.bind(Oe,sr),info:it.info.bind(Oe,sr),warn:it.warn.bind(Oe,sr),error:it.error.bind(Oe,sr)},at="https://docs.datadoghq.com";function Pr(e,t){return function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];try{return e.apply(void 0,r)}catch(o){K.error(t,o)}}}function Ot(e){return e!==0&&Math.random()*100<=e}function ur(e){return Qu(e)&&e>=0&&e<=100}function Qu(e){return typeof e=="number"}var Je=1e3,Ie=60*Je,Hn=60*Ie,ec=24*Hn,wp=365*ec;function ht(){return new Date().getTime()}function he(){return ht()}function Ct(){return performance.now()}function Ce(){return{relative:Ct(),timeStamp:he()}}function $i(){return{relative:0,timeStamp:Wi()}}function Fi(e,t){return t-e}function Gi(e,t){return e+t}function ji(e){return e-Wi()}var Wn;function Wi(){return Wn===void 0&&(Wn=performance.timing.navigationStart),Wn}var be=1024,Kn=1024*be,tc=/[^\u0000-\u007F]/;function At(e){return tc.test(e)?window.TextEncoder!==void 0?new TextEncoder().encode(e).length:new Blob([e]).size:e.length}function Ae(e,t){return e.indexOf(t)!==-1}function Lt(e){if(Array.from)return Array.from(e);var t=[];if(e instanceof Set)e.forEach(function(n){return t.push(n)});else for(var r=0;r<e.length;r++)t.push(e[r]);return t}function Hi(e,t){for(var r=0;r<e.length;r+=1){var n=e[r];if(t(n,r))return n}}function Ge(e){return Object.keys(e).map(function(t){return e[t]})}function Ki(e){return Object.keys(e).map(function(t){return[t,e[t]]})}function Nt(e,t){return e.slice(0,t.length)===t}function Yi(e,t){return e.slice(-t.length)===t}function ee(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.forEach(function(n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}),e}function qi(e){return ee({},e)}function Dr(e,t){return Object.keys(e).some(function(r){return e[r]===t})}function Mt(e){return Object.keys(e).length===0}function Le(){if(typeof globalThis=="object")return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get:function(){return this},configurable:!0});var e=_dd_temp_;return delete Object.prototype._dd_temp_,typeof e!="object"&&(typeof self=="object"?e=self:typeof window=="object"?e=window:e={}),e}function st(e,t){var r=Le(),n;return r.Zone&&typeof r.Zone.__symbol__=="function"&&(n=e[r.Zone.__symbol__(t)]),n||(n=e[t]),n}var rc=function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},Ur,Vi=!1;function zi(e){Ur=e}function Yn(e){Vi=e}function qn(e,t,r){var n=r.value;r.value=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];var a=Ur?W(n):n;return a.apply(this,o)}}function W(e){return function(){return Ze(e,this,arguments)}}function Ze(e,t,r){try{return e.apply(t,r)}catch(n){if(Br(n),Ur)try{Ur(n)}catch(o){Br(o)}}}function Br(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];Vi&&K.error.apply(K,rc(["[MONITOR]"],e,!1))}function je(e,t){return st(Le(),"setTimeout")(W(e),t)}function $r(e){st(Le(),"clearTimeout")(e)}function kt(e,t){return st(Le(),"setInterval")(W(e),t)}function Pt(e){st(Le(),"clearInterval")(e)}var Y=function(){function e(t){this.onFirstSubscribe=t,this.observers=[]}return e.prototype.subscribe=function(t){var r=this;return!this.observers.length&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe(this)||void 0),this.observers.push(t),{unsubscribe:function(){r.observers=r.observers.filter(function(n){return t!==n}),!r.observers.length&&r.onLastUnsubscribe&&r.onLastUnsubscribe()}}},e.prototype.notify=function(t){this.observers.forEach(function(r){return r(t)})},e}();function Fr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new Y(function(r){var n=e.map(function(o){return o.subscribe(function(i){return r.notify(i)})});return function(){return n.forEach(function(o){return o.unsubscribe()})}})}function Gr(e,t,r){var n=r&&r.leading!==void 0?r.leading:!0,o=r&&r.trailing!==void 0?r.trailing:!0,i=!1,a,c;return{throttled:function(){for(var f=[],l=0;l<arguments.length;l++)f[l]=arguments[l];if(i){a=f;return}n?e.apply(void 0,f):a=f,i=!0,c=je(function(){o&&a&&e.apply(void 0,a),i=!1,a=void 0},t)},cancel:function(){$r(c),i=!1,a=void 0}}}function we(){}function Ne(e){return e?(parseInt(e,10)^Math.random()*16>>parseInt(e,10)/4).toString(16):"".concat(1e7,"-").concat(1e3,"-").concat(4e3,"-").concat(8e3,"-").concat(1e11).replace(/[018]/g,Ne)}var jr=/([\w-]+)\s*=\s*([^;]+)/g;function Xi(e,t){for(jr.lastIndex=0;;){var r=jr.exec(e);if(r){if(r[1]===t)return r[2]}else break}}function Ji(e){var t=new Map;for(jr.lastIndex=0;;){var r=jr.exec(e);if(r)t.set(r[1],r[2]);else break}return t}function Zi(e,t,r){r===void 0&&(r="");var n=e.charCodeAt(t-1),o=n>=55296&&n<=56319,i=o?t+1:t;return e.length<=i?e:"".concat(e.slice(0,i)).concat(r)}function Qi(){return nc()===1}var Wr;function nc(){return Wr??(Wr=oc())}function oc(e){var t;e===void 0&&(e=window);var r=e.navigator.userAgent;return e.chrome||/HeadlessChrome/.test(r)?1:((t=e.navigator.vendor)===null||t===void 0?void 0:t.indexOf("Apple"))===0||/safari/i.test(r)&&!/chrome|android/i.test(r)?2:e.document.documentMode?0:3}function Dt(e,t,r,n){var o=new Date;o.setTime(o.getTime()+r);var i="expires=".concat(o.toUTCString()),a=n&&n.crossSite?"none":"strict",c=n&&n.domain?";domain=".concat(n.domain):"",f=n&&n.secure?";secure":"",l=n&&n.partitioned?";partitioned":"";document.cookie="".concat(e,"=").concat(t,";").concat(i,";path=/;samesite=").concat(a).concat(c).concat(f).concat(l)}function Hr(e){return Xi(document.cookie,e)}var Vn;function Qe(e){return Vn||(Vn=Ji(document.cookie)),Vn.get(e)}function ea(e,t){Dt(e,"",0,t)}function ta(e){if(document.cookie===void 0||document.cookie===null)return!1;try{var t="dd_cookie_test_".concat(Ne()),r="test";Dt(t,r,Ie,e);var n=Hr(t)===r;return ea(t,e),n}catch(o){return K.error(o),!1}}var zn;function ra(){if(zn===void 0){for(var e="dd_site_test_".concat(Ne()),t="test",r=window.location.hostname.split("."),n=r.pop();r.length&&!Hr(e);)n="".concat(r.pop(),".").concat(n),Dt(e,t,Je,{domain:n});ea(e,{domain:n}),zn=n}return zn}var et="_dd_s";var Ut=4*Hn,Kr=15*Ie;var na=/^([a-zA-Z]+)=([a-z0-9-]+)$/,Xn="&",ic="1";function We(){return{isExpired:ic}}function cr(e){return Mt(e)}function Yr(e){return!cr(e)}function Bt(e){return e.isExpired!==void 0||!ac(e)}function ac(e){return(e.created===void 0||ht()-Number(e.created)<Ut)&&(e.expire===void 0||ht()<Number(e.expire))}function qr(e){e.expire=String(ht()+Kr)}function lr(e){return Ki(e).map(function(t){var r=t[0],n=t[1];return"".concat(r,"=").concat(n)}).join(Xn)}function Vr(e){var t={};return sc(e)&&e.split(Xn).forEach(function(r){var n=na.exec(r);if(n!==null){var o=n[1],i=n[2];t[o]=i}}),t}function sc(e){return!!e&&(e.indexOf(Xn)!==-1||na.test(e))}var uc="_dd",cc="_dd_r",lc="_dd_l",fc="rum",dc="logs";function oa(e){var t=Qe(et);if(!t){var r=Qe(uc),n=Qe(cc),o=Qe(lc),i={};r&&(i.id=r),o&&/^[01]$/.test(o)&&(i[dc]=o),n&&/^[012]$/.test(n)&&(i[fc]=n),Yr(i)&&(qr(i),e.persistSession(i))}}function ia(e){var t=vc(e);return ta(t)?{type:"Cookie",cookieOptions:t}:void 0}function aa(e){var t={isLockEnabled:Qi(),persistSession:pc(e),retrieveSession:hc,expireSession:function(){return mc(e)}};return oa(t),t}function pc(e){return function(t){Dt(et,lr(t),Kr,e)}}function mc(e){Dt(et,lr(We()),Ut,e)}function hc(){var e=Hr(et);return Vr(e)}function vc(e){var t={};return t.secure=!!e.useSecureSessionCookie||!!e.usePartitionedCrossSiteSessionCookie||!!e.useCrossSiteSessionCookie,t.crossSite=!!e.usePartitionedCrossSiteSessionCookie||!!e.useCrossSiteSessionCookie,t.partitioned=!!e.usePartitionedCrossSiteSessionCookie,e.trackSessionAcrossSubdomains&&(t.domain=ra()),t}var gc="_dd_test_";function sa(){try{var e=Ne(),t="".concat(gc).concat(e);localStorage.setItem(t,e);var r=localStorage.getItem(t);return localStorage.removeItem(t),e===r?{type:"LocalStorage"}:void 0}catch{return}}function ua(){return{isLockEnabled:!1,persistSession:ca,retrieveSession:yc,expireSession:Ec}}function ca(e){localStorage.setItem(et,lr(e))}function yc(){var e=localStorage.getItem(et);return Vr(e)}function Ec(){ca(We())}var bc=10,Sc=100,fa=[],Xr;function ut(e,t,r){var n;r===void 0&&(r=0);var o=t.isLockEnabled,i=t.persistSession,a=t.expireSession,c=function(y){return i(ee({},y,{lock:l}))},f=function(){var y=t.retrieveSession(),I=y.lock;return y.lock&&delete y.lock,{session:y,lock:I}};if(Xr||(Xr=e),e!==Xr){fa.push(e);return}if(o&&r>=Sc){la(t);return}var l,p=f();if(o){if(p.lock){zr(e,t,r);return}if(l=Ne(),c(p.session),p=f(),p.lock!==l){zr(e,t,r);return}}var g=e.process(p.session);if(o&&(p=f(),p.lock!==l)){zr(e,t,r);return}if(g&&(Bt(g)?a():(qr(g),o?c(g):i(g))),o&&!(g&&Bt(g))){if(p=f(),p.lock!==l){zr(e,t,r);return}i(p.session),g=p.session}(n=e.after)===null||n===void 0||n.call(e,g||p.session),la(t)}function zr(e,t,r){je(function(){ut(e,t,r+1)},bc)}function la(e){Xr=void 0;var t=fa.shift();t&&ut(t,e)}var da=Je;function pa(e){var t=ia(e);return!t&&e.allowFallbackToLocalStorage&&(t=sa()),t}function ma(e,t,r){var n=new Y,o=new Y,i=new Y,a=e.type==="Cookie"?aa(e.cookieOptions):ua(),c=a.expireSession,f=kt(L,da),l;N();var p=Gr(function(){ut({process:function(A){if(!cr(A)){var $=C(A);return G($),$}},after:function(A){Yr(A)&&!Z()&&ue(A),l=A}},a)},da),g=p.throttled,y=p.cancel;function I(){ut({process:function(A){return Z()?C(A):void 0}},a)}function L(){ut({process:function(A){return Bt(A)?We():void 0},after:C},a)}function C(A){return Bt(A)&&(A=We()),Z()&&(P(A)?$e():(i.notify({previousState:l,newState:A}),l=A)),A}function N(){ut({process:function(A){if(cr(A))return We()},after:function(A){l=A}},a)}function G(A){if(cr(A))return!1;var $=r(A[t]),q=$.trackingType,oe=$.isTracked;A[t]=q,delete A.isExpired,oe&&!A.id&&(A.id=Ne(),A.created=String(ht()))}function Z(){return l[t]!==void 0}function P(A){return l.id!==A.id||l[t]!==A[t]}function $e(){l=We(),o.notify()}function ue(A){l=A,n.notify()}function O(A){ut({process:function($){return ee({},$,A)},after:C},a)}return{expandOrRenewSession:g,expandSession:I,getSession:function(){return l},renewObservable:n,expireObservable:o,sessionStateUpdateObservable:i,restartSession:N,expire:function(){y(),c(),C(We())},stop:function(){Pt(f)},updateSessionState:O}}var fr={GRANTED:"granted",NOT_GRANTED:"not-granted"};function Jn(e){var t=new Y;return{tryToInit:function(r){e||(e=r)},update:function(r){e=r,t.notify()},isGranted:function(){return e===fr.GRANTED},observable:t}}function xe(e,t,r){if(typeof e!="object"||e===null)return JSON.stringify(e);var n=vt(Object.prototype),o=vt(Array.prototype),i=vt(Object.getPrototypeOf(e)),a=vt(e);try{return JSON.stringify(e,t,r)}catch{return"<error: unable to serialize object>"}finally{n(),o(),i(),a()}}function vt(e){var t=e,r=t.toJSON;return r?(delete t.toJSON,function(){t.toJSON=r}):we}function $t(e){return _c(e,location.href).href}function _c(e,t){var r=Ic();if(r)try{return t!==void 0?new r(e,t):new r(e)}catch(a){throw new Error("Failed to construct URL: ".concat(String(a)," ").concat(xe({url:e,base:t})))}if(t===void 0&&!/:/.test(e))throw new Error("Invalid URL: '".concat(e,"'"));var n=document,o=n.createElement("a");if(t!==void 0){n=document.implementation.createHTMLDocument("");var i=n.createElement("base");i.href=t,n.head.appendChild(i),n.body.appendChild(o)}return o.href=e,o}var ha=URL,Jr;function Ic(){if(Jr===void 0)try{var e=new ha("http://test/path");Jr=e.href==="http://test/path"}catch{Jr=!1}return Jr?ha:void 0}var Zn="datad0g.com",va="dd0g-gov.com",He="datadoghq.com";var Qn="ddog-gov.com",Zr="pci.browser-intake-datadoghq.com";function Ft(e,t,r){var n=wc(e,t);return{build:function(o,i){var a=Tc(e,t,r,o,i);return n(a)},urlPrefix:n(""),trackType:t}}function wc(e,t){var r="/api/v2/".concat(t),n=e.proxy;if(typeof n=="string"){var o=$t(n);return function(a){return"".concat(o,"?ddforward=").concat(encodeURIComponent("".concat(r,"?").concat(a)))}}if(typeof n=="function")return function(a){return n({path:r,parameters:a})};var i=xc(t,e);return function(a){return"https://".concat(i).concat(r,"?").concat(a)}}function xc(e,t){var r=t.site,n=r===void 0?He:r,o=t.internalAnalyticsSubdomain;if(e==="logs"&&t.usePciIntake&&n===He)return Zr;if(o&&n===He)return"".concat(o,".").concat(He);if(n===va)return"http-intake.logs.".concat(n);var i=n.split("."),a=i.pop();return"browser-intake-".concat(i.join("-"),".").concat(a)}function Tc(e,t,r,n,o){var i=e.clientToken,a=e.internalAnalyticsSubdomain,c=o.retry,f=o.encoding,l=["sdk_version:".concat("5.21.0"),"api:".concat(n)].concat(r);c&&l.push("retry_count:".concat(c.count),"retry_after:".concat(c.lastFailureStatus));var p=["ddsource=browser","ddtags=".concat(encodeURIComponent(l.join(","))),"dd-api-key=".concat(i),"dd-evp-origin-version=".concat(encodeURIComponent("5.21.0")),"dd-evp-origin=browser","dd-request-id=".concat(Ne())];return f&&p.push("dd-evp-encoding=".concat(f)),t==="rum"&&p.push("batch_time=".concat(he())),a&&p.reverse(),p.join("&")}var Rc=200;function ga(e){var t=e.env,r=e.service,n=e.version,o=e.datacenter,i=[];return t&&i.push(Qr("env",t)),r&&i.push(Qr("service",r)),n&&i.push(Qr("version",n)),o&&i.push(Qr("datacenter",o)),i}var Oc=/[^a-z0-9_:./-]/;function Qr(e,t){var r=Rc-e.length-1;(t.length>r||Oc.test(t))&&K.warn("".concat(e," value doesn't meet tag requirements and will be sanitized. More details: ").concat(at,"/getting_started/tagging/#defining-tags"));var n=t.replace(/,/g,"_");return"".concat(e,":").concat(n)}function ya(e){var t=e.site||He,r=ga(e),n=Cc(e,r),o=Lc(n,t),i=Ac(e,o,r);return ee({isIntakeUrl:function(a){return o.some(function(c){return a.indexOf(c)===0})},replica:i,site:t},n)}function Cc(e,t){return{logsEndpointBuilder:Ft(e,"logs",t),rumEndpointBuilder:Ft(e,"rum",t),sessionReplayEndpointBuilder:Ft(e,"replay",t)}}function Ac(e,t,r){if(!!e.replica){var n=ee({},e,{site:He,clientToken:e.replica.clientToken}),o={logsEndpointBuilder:Ft(n,"logs",r),rumEndpointBuilder:Ft(n,"rum",r)};return t.push.apply(t,Ge(o).map(function(i){return i.urlPrefix})),ee({applicationId:e.replica.applicationId},o)}}function Lc(e,t){var r=Ge(e).map(function(n){return n.urlPrefix});return t===He&&r.push("https://".concat(Zr,"/")),r}function eo(e,t){return e!=null&&typeof e!="string"?(K.error("".concat(t," must be defined as a string")),!1):!0}function Nc(e){return/(datadog|ddog|datad0g|dd0g)/.test(e)}function en(e){var t,r,n,o,i;if(!e||!e.clientToken){K.error("Client Token is not configured, we will not send any data.");return}if(e.sessionSampleRate!==void 0&&!ur(e.sessionSampleRate)){K.error("Session Sample Rate should be a number between 0 and 100");return}if(e.telemetrySampleRate!==void 0&&!ur(e.telemetrySampleRate)){K.error("Telemetry Sample Rate should be a number between 0 and 100");return}if(e.telemetryConfigurationSampleRate!==void 0&&!ur(e.telemetryConfigurationSampleRate)){K.error("Telemetry Configuration Sample Rate should be a number between 0 and 100");return}if(e.telemetryUsageSampleRate!==void 0&&!ur(e.telemetryUsageSampleRate)){K.error("Telemetry Usage Sample Rate should be a number between 0 and 100");return}if(!!eo(e.version,"Version")&&!!eo(e.env,"Env")&&!!eo(e.service,"Service")){if(e.trackingConsent!==void 0&&!Dr(fr,e.trackingConsent)){K.error('Tracking Consent should be either "granted" or "not-granted"');return}if(e.site&&!Nc(e.site)){K.error("Site should be a valid Datadog site. Learn more here: ".concat(at,"/getting_started/site/."));return}return ee({beforeSend:e.beforeSend&&Pr(e.beforeSend,"beforeSend threw an error:"),sessionStoreStrategyType:pa(e),sessionSampleRate:(t=e.sessionSampleRate)!==null&&t!==void 0?t:100,telemetrySampleRate:(r=e.telemetrySampleRate)!==null&&r!==void 0?r:20,telemetryConfigurationSampleRate:(n=e.telemetryConfigurationSampleRate)!==null&&n!==void 0?n:5,telemetryUsageSampleRate:(o=e.telemetryUsageSampleRate)!==null&&o!==void 0?o:5,service:e.service||void 0,silentMultipleInit:!!e.silentMultipleInit,allowUntrustedEvents:!!e.allowUntrustedEvents,trackingConsent:(i=e.trackingConsent)!==null&&i!==void 0?i:fr.GRANTED,storeContextsAcrossPages:!!e.storeContextsAcrossPages,batchBytesLimit:16*be,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:30*Je,batchMessagesLimit:50,messageBytesLimit:256*be},ya(e))}}function tn(e){return{session_sample_rate:e.sessionSampleRate,telemetry_sample_rate:e.telemetrySampleRate,telemetry_configuration_sample_rate:e.telemetryConfigurationSampleRate,telemetry_usage_sample_rate:e.telemetryUsageSampleRate,use_before_send:!!e.beforeSend,use_cross_site_session_cookie:e.useCrossSiteSessionCookie,use_partitioned_cross_site_session_cookie:e.usePartitionedCrossSiteSessionCookie,use_secure_session_cookie:e.useSecureSessionCookie,use_proxy:!!e.proxy,silent_multiple_init:e.silentMultipleInit,track_session_across_subdomains:e.trackSessionAcrossSubdomains,allow_fallback_to_local_storage:!!e.allowFallbackToLocalStorage,store_contexts_across_pages:!!e.storeContextsAcrossPages,allow_untrusted_events:!!e.allowUntrustedEvents,tracking_consent:e.trackingConsent}}var rn;(function(e){e.WRITABLE_RESOURCE_GRAPHQL="writable_resource_graphql",e.CUSTOM_VITALS="custom_vitals",e.TOLERANT_RESOURCE_TIMINGS="tolerant_resource_timings",e.MICRO_FRONTEND="micro_frontend"})(rn||(rn={}));var Ea=new Set;function to(e){Array.isArray(e)&&ba(e.filter(function(t){return Dr(rn,t)}))}function ba(e){e.forEach(function(t){Ea.add(t)})}function ro(){return Ea}var dr="?";function le(e){var t=[],r=no(e,"stack"),n=String(e);return r&&Nt(r,n)&&(r=r.slice(n.length)),r&&r.split(`
2
+ `).forEach(function(o){var i=Uc(o)||$c(o)||Gc(o)||Hc(o);i&&(!i.func&&i.line&&(i.func=dr),t.push(i))}),{message:no(e,"message"),name:no(e,"name"),stack:t}}var Sa="((?:file|https?|blob|chrome-extension|native|eval|webpack|snippet|<anonymous>|\\w+\\.|\\/).*?)",Gt="(?::(\\d+))",Pc=new RegExp("^\\s*at (.*?) ?\\(".concat(Sa).concat(Gt,"?").concat(Gt,"?\\)?\\s*$"),"i"),Dc=new RegExp("\\((\\S*)".concat(Gt).concat(Gt,"\\)"));function Uc(e){var t=Pc.exec(e);if(!!t){var r=t[2]&&t[2].indexOf("native")===0,n=t[2]&&t[2].indexOf("eval")===0,o=Dc.exec(t[2]);return n&&o&&(t[2]=o[1],t[3]=o[2],t[4]=o[3]),{args:r?[t[2]]:[],column:t[4]?+t[4]:void 0,func:t[1]||dr,line:t[3]?+t[3]:void 0,url:r?void 0:t[2]}}}var Bc=new RegExp("^\\s*at ?".concat(Sa).concat(Gt,"?").concat(Gt,"??\\s*$"),"i");function $c(e){var t=Bc.exec(e);if(!!t)return{args:[],column:t[3]?+t[3]:void 0,func:dr,line:t[2]?+t[2]:void 0,url:t[1]}}var Fc=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;function Gc(e){var t=Fc.exec(e);if(!!t)return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||dr,line:+t[3],url:t[2]}}var jc=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,Wc=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function Hc(e){var t=jc.exec(e);if(!!t){var r=t[3]&&t[3].indexOf(" > eval")>-1,n=Wc.exec(t[3]);return r&&n&&(t[3]=n[1],t[4]=n[2],t[5]=void 0),{args:t[2]?t[2].split(","):[],column:t[5]?+t[5]:void 0,func:t[1]||dr,line:t[4]?+t[4]:void 0,url:t[3]}}}function no(e,t){if(!(typeof e!="object"||!e||!(t in e))){var r=e[t];return typeof r=="string"?r:void 0}}function _a(e,t,r,n){var o=[{url:t,column:n,line:r}],i=Yc(e),a=i.name,c=i.message;return{name:a,message:c,stack:o}}var Kc=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\s\S]*)$/;function Yc(e){var t,r,n;return{}.toString.call(e)==="[object String]"&&(t=Kc.exec(e),r=t[1],n=t[2]),{name:r,message:n}}function nn(){var e=2,t=new Error,r;if(!t.stack)try{throw t}catch{}return Ze(function(){var n=le(t);n.stack=n.stack.slice(e),r=Me(n)}),r}function Me(e){var t=oo(e);return e.stack.forEach(function(r){var n=r.func==="?"?"<anonymous>":r.func,o=r.args&&r.args.length>0?"(".concat(r.args.join(", "),")"):"",i=r.line?":".concat(r.line):"",a=r.line&&r.column?":".concat(r.column):"";t+=`
3
+ at `.concat(n).concat(o," @ ").concat(r.url).concat(i).concat(a)}),t}function oo(e){return"".concat(e.name||"Error",": ").concat(e.message)}function Ke(e,t,r,n){var o=n===void 0?{}:n,i=o.computeHandlingStack,a=e[t];if(typeof a!="function")if(Nt(t,"on"))a=we;else return{stop:we};var c=!1,f=function(){if(c)return a.apply(this,arguments);var l=Lt(arguments),p;Ze(r,null,[{target:this,parameters:l,onPostCall:function(y){p=y},handlingStack:i?nn():void 0}]);var g=a.apply(this,l);return p&&Ze(p,null,[g]),g};return e[t]=f,{stop:function(){c=!0,e[t]===f&&(e[t]=a)}}}var qc=220*be,Vc="$",zc=3;function Se(e,t){var r;t===void 0&&(t=qc);var n=vt(Object.prototype),o=vt(Array.prototype),i=[],a=new WeakMap,c=io(e,Vc,void 0,i,a),f=((r=JSON.stringify(c))===null||r===void 0?void 0:r.length)||0;if(f>t){ao(t,"discarded",e);return}for(;i.length>0&&f<t;){var l=i.shift(),p=0;if(Array.isArray(l.source))for(var g=0;g<l.source.length;g++){var y=io(l.source[g],l.path,g,i,a);if(y!==void 0?f+=JSON.stringify(y).length:f+=4,f+=p,p=1,f>t){ao(t,"truncated",e);break}l.target[g]=y}else for(var g in l.source)if(Object.prototype.hasOwnProperty.call(l.source,g)){var y=io(l.source[g],l.path,g,i,a);if(y!==void 0&&(f+=JSON.stringify(y).length+p+g.length+zc,p=1),f>t){ao(t,"truncated",e);break}l.target[g]=y}}return n(),o(),c}function io(e,t,r,n,o){var i=Zc(e);if(!i||typeof i!="object")return Xc(i);var a=Jc(i);if(a!=="[Object]"&&a!=="[Array]"&&a!=="[Error]")return a;var c=e;if(o.has(c))return"[Reference seen at ".concat(o.get(c),"]");var f=r!==void 0?"".concat(t,".").concat(r):t,l=Array.isArray(i)?[]:{};return o.set(c,f),n.push({source:i,target:l,path:f}),l}function Xc(e){return typeof e=="bigint"?"[BigInt] ".concat(e.toString()):typeof e=="function"?"[Function] ".concat(e.name||"unknown"):typeof e=="symbol"?"[Symbol] ".concat(e.description||e.toString()):e}function Jc(e){try{if(e instanceof Event)return{isTrusted:e.isTrusted};var t=Object.prototype.toString.call(e),r=t.match(/\[object (.*)\]/);if(r&&r[1])return"[".concat(r[1],"]")}catch{}return"[Unserializable]"}function Zc(e){var t=e;if(t&&typeof t.toJSON=="function")try{return t.toJSON()}catch{}return e}function ao(e,t,r){K.warn("The data provided has been ".concat(t," as it is over the limit of ").concat(e," characters:"),r)}var on="No stack, consider using an instance of Error";function pr(e){var t=e.stackTrace,r=e.originalError,n=e.handlingStack,o=e.startClocks,i=e.nonErrorPrefix,a=e.source,c=e.handling,f=r instanceof Error,l=Qc(t,f,i,r),p=el(f,t)?Me(t):on,g=f?co(r,a):void 0,y=t?.name,I=so(r);return{startClocks:o,source:a,handling:c,handlingStack:n,originalError:r,type:y,message:l,stack:p,causes:g,fingerprint:I}}function Qc(e,t,r,n){return e?.message&&e?.name?e.message:t?"Empty message":"".concat(r," ").concat(xe(Se(n)))}function el(e,t){return t===void 0?!1:e?!0:t.stack.length>0&&(t.stack.length>1||t.stack[0].url!==void 0)}function so(e){return e instanceof Error&&"dd_fingerprint"in e?String(e.dd_fingerprint):void 0}function uo(e){var t;return(t=/@ (.+)/.exec(e))===null||t===void 0?void 0:t[1]}function co(e,t){for(var r=e,n=[];r?.cause instanceof Error&&n.length<10;){var o=le(r.cause);n.push({message:r.cause.message,source:t,type:o?.name,stack:o&&Me(o)}),r=r.cause}return n.length?n:void 0}var re={AGENT:"agent",CONSOLE:"console",CUSTOM:"custom",LOGGER:"logger",NETWORK:"network",SOURCE:"source",REPORT:"report"};function lo(e){var t=function(o,i){var a=pr({stackTrace:o,originalError:i,startClocks:Ce(),nonErrorPrefix:"Uncaught",source:re.SOURCE,handling:"unhandled"});e.notify(a)},r=tl(t).stop,n=rl(t).stop;return{stop:function(){r(),n()}}}function tl(e){return Ke(window,"onerror",function(t){var r=t.parameters,n=r[0],o=r[1],i=r[2],a=r[3],c=r[4],f;c instanceof Error?f=le(c):f=_a(n,o,i,a),e(f,c??n)})}function rl(e){return Ke(window,"onunhandledrejection",function(t){var r=t.parameters[0],n=r.reason||"Empty reason",o=le(n);e(o,n)})}function fo(e){var t=ee({version:"5.21.0",onReady:function(r){r()}},e);return Object.defineProperty(t,"_setDebug",{get:function(){return Yn},enumerable:!1}),t}function po(e,t,r){var n=e[t];n&&!n.q&&n.version&&K.warn("SDK is loaded more than once. This is unsupported and might have unexpected behavior."),e[t]=r,n&&n.q&&n.q.forEach(function(o){return Pr(o,"onReady callback threw an error:")()})}function mr(e,t){t.silentMultipleInit||K.error("".concat(e," is already initialized."))}var se;(function(e){e.BEFORE_UNLOAD="beforeunload",e.CLICK="click",e.DBL_CLICK="dblclick",e.KEY_DOWN="keydown",e.LOAD="load",e.POP_STATE="popstate",e.SCROLL="scroll",e.TOUCH_START="touchstart",e.TOUCH_END="touchend",e.TOUCH_MOVE="touchmove",e.VISIBILITY_CHANGE="visibilitychange",e.PAGE_SHOW="pageshow",e.FREEZE="freeze",e.RESUME="resume",e.DOM_CONTENT_LOADED="DOMContentLoaded",e.POINTER_DOWN="pointerdown",e.POINTER_UP="pointerup",e.POINTER_CANCEL="pointercancel",e.HASH_CHANGE="hashchange",e.PAGE_HIDE="pagehide",e.MOUSE_DOWN="mousedown",e.MOUSE_UP="mouseup",e.MOUSE_MOVE="mousemove",e.FOCUS="focus",e.BLUR="blur",e.CONTEXT_MENU="contextmenu",e.RESIZE="resize",e.CHANGE="change",e.INPUT="input",e.PLAY="play",e.PAUSE="pause",e.SECURITY_POLICY_VIOLATION="securitypolicyviolation",e.SELECTION_CHANGE="selectionchange",e.STORAGE="storage"})(se||(se={}));function Te(e,t,r,n,o){return hr(e,t,[r],n,o)}function hr(e,t,r,n,o){var i=o===void 0?{}:o,a=i.once,c=i.capture,f=i.passive,l=W(function(I){!I.isTrusted&&!I.__ddIsTrusted&&!e.allowUntrustedEvents||(a&&y(),n(I))}),p=f?{capture:c,passive:f}:c,g=st(t,"addEventListener");r.forEach(function(I){return g.call(t,I,l,p)});function y(){var I=st(t,"removeEventListener");r.forEach(function(L){return I.call(t,L,l,p)})}return{stop:y}}var Pe={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function mo(e,t){var r=[];Ae(t,Pe.cspViolation)&&r.push(ol(e));var n=t.filter(function(o){return o!==Pe.cspViolation});return n.length&&r.push(nl(n)),Fr.apply(void 0,r)}function nl(e){return new Y(function(t){if(!!window.ReportingObserver){var r=W(function(o,i){return o.forEach(function(a){t.notify(il(a))})}),n=new window.ReportingObserver(r,{types:e,buffered:!0});return n.observe(),function(){n.disconnect()}}})}function ol(e){return new Y(function(t){var r=Te(e,document,se.SECURITY_POLICY_VIOLATION,function(n){t.notify(al(n))}).stop;return r})}function il(e){var t=e.type,r=e.body;return{type:t,subtype:r.id,message:"".concat(t,": ").concat(r.message),originalReport:e,stack:Ia(r.id,r.message,r.sourceFile,r.lineNumber,r.columnNumber)}}function al(e){var t=Pe.cspViolation,r="'".concat(e.blockedURI,"' blocked by '").concat(e.effectiveDirective,"' directive");return{type:Pe.cspViolation,subtype:e.effectiveDirective,message:"".concat(t,": ").concat(r),stack:Ia(e.effectiveDirective,e.originalPolicy?"".concat(r,' of the policy "').concat(Zi(e.originalPolicy,100,"..."),'"'):"no policy",e.sourceFile,e.lineNumber,e.columnNumber),originalReport:e}}function Ia(e,t,r,n,o){return r?Me({name:e,message:t,stack:[{func:"?",url:r,line:n??void 0,column:o??void 0}]}):void 0}function vr(e,t){var r=window.__ddBrowserSdkExtensionCallback;r&&r({type:e,payload:t})}function jt(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function an(e,t,r){if(r===void 0&&(r=sl()),t===void 0)return e;if(typeof t!="object"||t===null)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){var n=t.flags||[t.global?"g":"",t.ignoreCase?"i":"",t.multiline?"m":"",t.sticky?"y":"",t.unicode?"u":""].join("");return new RegExp(t.source,n)}if(!r.hasAlreadyBeenSeen(t)){if(Array.isArray(t)){for(var o=Array.isArray(e)?e:[],i=0;i<t.length;++i)o[i]=an(o[i],t[i],r);return o}var a=jt(e)==="object"?e:{};for(var c in t)Object.prototype.hasOwnProperty.call(t,c)&&(a[c]=an(a[c],t[c],r));return a}}function sn(e){return an(void 0,e)}function De(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r,n=0,o=e;n<o.length;n++){var i=o[n];i!=null&&(r=an(r,i))}return r}function sl(){if(typeof WeakSet<"u"){var e=new WeakSet;return{hasAlreadyBeenSeen:function(r){var n=e.has(r);return n||e.add(r),n}}}var t=[];return{hasAlreadyBeenSeen:function(r){var n=t.indexOf(r)>=0;return n||t.push(r),n}}}function wa(){var e,t=window.navigator;return{status:t.onLine?"connected":"not_connected",interfaces:t.connection&&t.connection.type?[t.connection.type]:void 0,effective_type:(e=t.connection)===null||e===void 0?void 0:e.effectiveType}}function xa(e){var t=new Set;return e.forEach(function(r){return t.add(r)}),Lt(t)}function un(e,t){var r=e.indexOf(t);r>=0&&e.splice(r,1)}var ul=500,gr=function(){function e(){this.buffer=[]}return e.prototype.add=function(t){var r=this.buffer.push(t);r>ul&&this.buffer.splice(0,1)},e.prototype.remove=function(t){un(this.buffer,t)},e.prototype.drain=function(t){this.buffer.forEach(function(r){return r(t)}),this.buffer.length=0},e}();var ct={log:"log",configuration:"configuration",usage:"usage"};var cl=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","https://d3uc069fcn7uxw.cloudfront.net","https://d20xtzwzcl0ceb.cloudfront.net","http://localhost","<anonymous>"],ll=[Qn],Ta=new gr,Wt=function(e){Ta.add(function(){return Wt(e)})};function cn(e,t){var r,n,o=new Y,i=new Set,a=!Ae(ll,t.site)&&Ot(t.telemetrySampleRate),c=(r={},r[ct.log]=a,r[ct.configuration]=a&&Ot(t.telemetryConfigurationSampleRate),r[ct.usage]=a&&Ot(t.telemetryUsageSampleRate),r),f=fl();Wt=function(p){var g=xe(p);if(c[p.type]&&i.size<t.maxTelemetryEventsPerPage&&!i.has(g)){var y=l(e,p,f);o.notify(y),vr("telemetry",y),i.add(g)}},zi(yr);function l(p,g,y){return De({type:"telemetry",date:he(),service:p,version:"5.21.0",source:"browser",_dd:{format_version:2},telemetry:De(g,{runtime_env:y,connectivity:wa()}),experimental_features:Lt(ro())},n!==void 0?n():{})}return{setContextProvider:function(p){n=p},observable:o,enabled:a}}function fl(){return{is_local_file:window.location.protocol==="file:",is_worker:"WorkerGlobalScope"in self}}function ln(){Ta.drain()}function fn(e){return e.site===Zn}function Ht(e,t){Br(Q.debug,e,t),Wt(ee({type:ct.log,message:e,status:"debug"},t))}function yr(e,t){Wt(ee({type:ct.log,status:"error"},dl(e),t))}function dn(e){Wt({type:ct.configuration,configuration:e})}function pn(e){Wt({type:ct.usage,usage:e})}function dl(e){if(e instanceof Error){var t=le(e);return{error:{kind:t.name,stack:Me(pl(t))},message:t.message}}return{error:{stack:on},message:"".concat("Uncaught"," ").concat(xe(e))}}function pl(e){return e.stack=e.stack.filter(function(t){return!t.url||cl.some(function(r){return Nt(t.url,r)})}),e}var mn=1/0,vl=Ie,Ra=function(){function e(t,r){var n=this;this.expireDelay=t,this.maxEntries=r,this.entries=[],this.clearOldValuesInterval=kt(function(){return n.clearOldValues()},vl)}return e.prototype.add=function(t,r){var n=this,o={value:t,startTime:r,endTime:mn,remove:function(){un(n.entries,o)},close:function(i){o.endTime=i}};return this.maxEntries&&this.entries.length>=this.maxEntries&&this.entries.pop(),this.entries.unshift(o),o},e.prototype.find=function(t,r){t===void 0&&(t=mn),r===void 0&&(r={returnInactive:!1});for(var n=0,o=this.entries;n<o.length;n++){var i=o[n];if(i.startTime<=t){if(r.returnInactive||t<=i.endTime)return i.value;break}}},e.prototype.closeActive=function(t){var r=this.entries[0];r&&r.endTime===mn&&r.close(t)},e.prototype.findAll=function(t,r){t===void 0&&(t=mn),r===void 0&&(r=0);var n=Gi(t,r);return this.entries.filter(function(o){return o.startTime<=n&&t<=o.endTime}).map(function(o){return o.value})},e.prototype.reset=function(){this.entries=[]},e.prototype.stop=function(){Pt(this.clearOldValuesInterval)},e.prototype.clearOldValues=function(){for(var t=Ct()-this.expireDelay;this.entries.length>0&&this.entries[this.entries.length-1].endTime<t;)this.entries.pop()},e}();var gl=Ie,yl=Ut,Kt=[];function ho(e,t,r,n){var o=new Y,i=new Y,a=ma(e.sessionStoreStrategyType,t,r);Kt.push(function(){return a.stop()});var c=new Ra(yl);Kt.push(function(){return c.stop()}),a.renewObservable.subscribe(function(){c.add(f(),Ct()),o.notify()}),a.expireObservable.subscribe(function(){i.notify(),c.closeActive(Ct())}),a.expandOrRenewSession(),c.add(f(),$i().relative),n.observable.subscribe(function(){n.isGranted()?a.expandOrRenewSession():a.expire()}),El(e,function(){n.isGranted()&&a.expandOrRenewSession()}),bl(e,function(){return a.expandSession()}),Sl(e,function(){return a.restartSession()});function f(){return{id:a.getSession().id,trackingType:a.getSession()[t],isReplayForced:!!a.getSession().forcedReplay}}return{findSession:function(l,p){return c.find(l,p)},renewObservable:o,expireObservable:i,sessionStateUpdateObservable:a.sessionStateUpdateObservable,expire:a.expire,updateSessionState:a.updateSessionState}}function El(e,t){var r=hr(e,window,[se.CLICK,se.TOUCH_START,se.KEY_DOWN,se.SCROLL],t,{capture:!0,passive:!0}).stop;Kt.push(r)}function bl(e,t){var r=function(){document.visibilityState==="visible"&&t()},n=Te(e,document,se.VISIBILITY_CHANGE,r).stop;Kt.push(n);var o=kt(r,gl);Kt.push(function(){Pt(o)})}function Sl(e,t){var r=Te(e,window,se.RESUME,t,{capture:!0}).stop;Kt.push(r)}function hn(e){return e>=500}function Oa(e){try{return e.clone()}catch{return}}var _l=80*be,Il=32,Ca=3*Kn,wl=Ie,Aa=Je;function vo(e,t,r,n,o){t.transportStatus===0&&t.queuedPayloads.size()===0&&t.bandwidthMonitor.canHandle(e)?Na(e,t,r,{onSuccess:function(){return Ma(0,t,r,n,o)},onFailure:function(){t.queuedPayloads.enqueue(e),La(t,r,n,o)}}):t.queuedPayloads.enqueue(e)}function La(e,t,r,n){e.transportStatus===2&&je(function(){var o=e.queuedPayloads.first();Na(o,e,t,{onSuccess:function(){e.queuedPayloads.dequeue(),e.currentBackoffTime=Aa,Ma(1,e,t,r,n)},onFailure:function(){e.currentBackoffTime=Math.min(wl,e.currentBackoffTime*2),La(e,t,r,n)}})},e.currentBackoffTime)}function Na(e,t,r,n){var o=n.onSuccess,i=n.onFailure;t.bandwidthMonitor.add(e),r(e,function(a){t.bandwidthMonitor.remove(e),xl(a)?(t.transportStatus=t.bandwidthMonitor.ongoingRequestCount>0?1:2,e.retry={count:e.retry?e.retry.count+1:1,lastFailureStatus:a.status},i()):(t.transportStatus=0,o())})}function Ma(e,t,r,n,o){e===0&&t.queuedPayloads.isFull()&&!t.queueFullReported&&(o({message:"Reached max ".concat(n," events size queued for upload: ").concat(Ca/Kn,"MiB"),source:re.AGENT,startClocks:Ce()}),t.queueFullReported=!0);var i=t.queuedPayloads;for(t.queuedPayloads=Pa();i.size()>0;)vo(i.dequeue(),t,r,n,o)}function xl(e){return e.type!=="opaque"&&(e.status===0&&!navigator.onLine||e.status===408||e.status===429||hn(e.status))}function ka(){return{transportStatus:0,currentBackoffTime:Aa,bandwidthMonitor:Tl(),queuedPayloads:Pa(),queueFullReported:!1}}function Pa(){var e=[];return{bytesCount:0,enqueue:function(t){this.isFull()||(e.push(t),this.bytesCount+=t.bytesCount)},first:function(){return e[0]},dequeue:function(){var t=e.shift();return t&&(this.bytesCount-=t.bytesCount),t},size:function(){return e.length},isFull:function(){return this.bytesCount>=Ca}}}function Tl(){return{ongoingRequestCount:0,ongoingByteCount:0,canHandle:function(e){return this.ongoingRequestCount===0||this.ongoingByteCount+e.bytesCount<=_l&&this.ongoingRequestCount<Il},add:function(e){this.ongoingRequestCount+=1,this.ongoingByteCount+=e.bytesCount},remove:function(e){this.ongoingRequestCount-=1,this.ongoingByteCount-=e.bytesCount}}}function yo(e,t,r,n){var o=ka(),i=function(a,c){return Cl(e,t,r,a,c)};return{send:function(a){vo(a,o,i,t.trackType,n)},sendOnExit:function(a){Rl(e,t,r,a)}}}function Rl(e,t,r,n){var o=!!navigator.sendBeacon&&n.bytesCount<r;if(o)try{var i=t.build("beacon",n),a=navigator.sendBeacon(i,n.data);if(a)return}catch(f){Ol(f)}var c=t.build("xhr",n);go(e,c,n.data)}var Da=!1;function Ol(e){Da||(Da=!0,yr(e))}function Cl(e,t,r,n,o){var i=Al()&&n.bytesCount<r;if(i){var a=t.build("fetch",n);fetch(a,{method:"POST",body:n.data,keepalive:!0,mode:"cors"}).then(W(function(f){return o?.({status:f.status,type:f.type})}),W(function(){var f=t.build("xhr",n);go(e,f,n.data,o)}))}else{var c=t.build("xhr",n);go(e,c,n.data,o)}}function Al(){try{return window.Request&&"keepalive"in new Request("http://a")}catch{return!1}}function go(e,t,r,n){var o=new XMLHttpRequest;o.open("POST",t,!0),r instanceof Blob&&o.setRequestHeader("Content-Type",r.type),Te(e,o,"loadend",function(){n?.({status:o.status})},{once:!0}),o.send(r)}function gt(){var e=Ll();if(!!e)return{getCapabilities:function(){var t;return JSON.parse(((t=e.getCapabilities)===null||t===void 0?void 0:t.call(e))||"[]")},getPrivacyLevel:function(){var t;return(t=e.getPrivacyLevel)===null||t===void 0?void 0:t.call(e)},getAllowedWebViewHosts:function(){return JSON.parse(e.getAllowedWebViewHosts())},send:function(t,r,n){var o=n?{id:n}:void 0;e.send(JSON.stringify({eventType:t,event:r,view:o}))}}}function tt(e){var t;e===void 0&&(e=(t=Le().location)===null||t===void 0?void 0:t.hostname);var r=gt();return!!r&&r.getAllowedWebViewHosts().some(function(n){return e===n||Yi(e,".".concat(n))})}function Ll(){return Le().DatadogEventBridge}var Er={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};function Eo(e){return new Y(function(t){var r=hr(e,window,[se.VISIBILITY_CHANGE,se.FREEZE],function(o){o.type===se.VISIBILITY_CHANGE&&document.visibilityState==="hidden"?t.notify({reason:Er.HIDDEN}):o.type===se.FREEZE&&t.notify({reason:Er.FROZEN})},{capture:!0}).stop,n=Te(e,window,se.BEFORE_UNLOAD,function(){t.notify({reason:Er.UNLOADING})}).stop;return function(){r(),n()}})}function bo(e){return Ae(Ge(Er),e)}var Ba=function(){function e(t,r,n,o){var i=this;this.encoder=t,this.request=r,this.flushController=n,this.messageBytesLimit=o,this.upsertBuffer={},this.flushSubscription=this.flushController.flushObservable.subscribe(function(a){return i.flush(a)})}return e.prototype.add=function(t){this.addOrUpdate(t)},e.prototype.upsert=function(t,r){this.addOrUpdate(t,r)},e.prototype.stop=function(){this.flushSubscription.unsubscribe()},e.prototype.flush=function(t){var r=Ge(this.upsertBuffer).join(`
4
+ `);this.upsertBuffer={};var n=bo(t.reason),o=n?this.request.sendOnExit:this.request.send;if(n&&this.encoder.isAsync){var i=this.encoder.finishSync();i.outputBytesCount&&o(Ua(i));var a=[i.pendingData,r].filter(Boolean).join(`
5
+ `);a&&o({data:a,bytesCount:At(a)})}else r&&this.encoder.write(this.encoder.isEmpty?r:`
6
+ `.concat(r)),this.encoder.finish(function(c){o(Ua(c))})},e.prototype.addOrUpdate=function(t,r){var n=xe(t),o=this.encoder.estimateEncodedBytesCount(n);if(o>=this.messageBytesLimit){K.warn("Discarded a message whose size was bigger than the maximum allowed size ".concat(this.messageBytesLimit,"KB. More details: ").concat(at,"/real_user_monitoring/browser/troubleshooting/#technical-limitations"));return}this.hasMessageFor(r)&&this.remove(r),this.push(n,o,r)},e.prototype.push=function(t,r,n){var o=this;this.flushController.notifyBeforeAddMessage(r),n!==void 0?(this.upsertBuffer[n]=t,this.flushController.notifyAfterAddMessage()):this.encoder.write(this.encoder.isEmpty?t:`
7
+ `.concat(t),function(i){o.flushController.notifyAfterAddMessage(i-r)})},e.prototype.remove=function(t){var r=this.upsertBuffer[t];delete this.upsertBuffer[t];var n=this.encoder.estimateEncodedBytesCount(r);this.flushController.notifyAfterRemoveMessage(n)},e.prototype.hasMessageFor=function(t){return t!==void 0&&this.upsertBuffer[t]!==void 0},e}();function Ua(e){var t;return typeof e.output=="string"?t=e.output:t=new Blob([e.output],{type:"text/plain"}),{data:t,bytesCount:e.outputBytesCount,encoding:e.encoding}}function So(e){var t=e.messagesLimit,r=e.bytesLimit,n=e.durationLimit,o=e.pageExitObservable,i=e.sessionExpireObservable,a=o.subscribe(function(C){return g(C.reason)}),c=i.subscribe(function(){return g("session_expire")}),f=new Y(function(){return function(){a.unsubscribe(),c.unsubscribe()}}),l=0,p=0;function g(C){if(p!==0){var N=p,G=l;p=0,l=0,L(),f.notify({reason:C,messagesCount:N,bytesCount:G})}}var y;function I(){y===void 0&&(y=je(function(){g("duration_limit")},n))}function L(){$r(y),y=void 0}return{flushObservable:f,get messagesCount(){return p},notifyBeforeAddMessage:function(C){l+C>=r&&g("bytes_limit"),p+=1,l+=C,I()},notifyAfterAddMessage:function(C){C===void 0&&(C=0),l+=C,p>=t?g("messages_limit"):l>=r&&g("bytes_limit")},notifyAfterRemoveMessage:function(C){l-=C,p-=1,p===0&&L()}}}function Yt(e,t,r,n,o,i){var a=f(e,t),c=r&&f(e,r);function f(l,p){var g=p.endpoint,y=p.encoder;return new Ba(y,yo(l,g,l.batchBytesLimit,n),So({messagesLimit:l.batchMessagesLimit,bytesLimit:l.batchBytesLimit,durationLimit:l.flushTimeout,pageExitObservable:o,sessionExpireObservable:i}),l.messageBytesLimit)}return{flushObservable:a.flushController.flushObservable,add:function(l,p){p===void 0&&(p=!0),a.add(l),c&&p&&c.add(r.transformMessage?r.transformMessage(l):l)},upsert:function(l,p){a.upsert(l,p),c&&c.upsert(r.transformMessage?r.transformMessage(l):l,p)},stop:function(){a.stop(),c?.stop()}}}function yt(){var e="",t=0;return{isAsync:!1,get isEmpty(){return!e},write:function(r,n){var o=At(r);t+=o,e+=r,n&&n(o)},finish:function(r){r(this.finishSync())},finishSync:function(){var r={output:e,outputBytesCount:t,rawBytesCount:t,pendingData:""};return e="",t=0,r},estimateEncodedBytesCount:function(r){return r.length}}}var _o=function(){function e(){this.callbacks={}}return e.prototype.notify=function(t,r){var n=this.callbacks[t];n&&n.forEach(function(o){return o(r)})},e.prototype.subscribe=function(t,r){var n=this;return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(r),{unsubscribe:function(){n.callbacks[t]=n.callbacks[t].filter(function(o){return r!==o})}}},e}();function $a(e,t,r){var n=0,o=!1;return{isLimitReached:function(){if(n===0&&je(function(){n=0},Ie),n+=1,n<=t||o)return o=!1,!1;if(n===t+1){o=!0;try{r({message:"Reached max number of ".concat(e,"s by minute: ").concat(t),source:re.AGENT,startClocks:Ce()})}finally{o=!1}}return!0}}}var Io,wo=new WeakMap;function xo(e){return Io||(Io=Ml(e)),Io}function Ml(e){return new Y(function(t){var r=Ke(XMLHttpRequest.prototype,"open",kl).stop,n=Ke(XMLHttpRequest.prototype,"send",function(i){Pl(i,e,t)},{computeHandlingStack:!0}).stop,o=Ke(XMLHttpRequest.prototype,"abort",Dl).stop;return function(){r(),n(),o()}})}function kl(e){var t=e.target,r=e.parameters,n=r[0],o=r[1];wo.set(t,{state:"open",method:String(n).toUpperCase(),url:$t(String(o))})}function Pl(e,t,r){var n=e.target,o=e.handlingStack,i=wo.get(n);if(!!i){var a=i;a.state="start",a.startClocks=Ce(),a.isAborted=!1,a.xhr=n,a.handlingStack=o;var c=!1,f=Ke(n,"onreadystatechange",function(){n.readyState===XMLHttpRequest.DONE&&l()}).stop,l=function(){if(p(),f(),!c){c=!0;var g=i;g.state="complete",g.duration=Fi(a.startClocks.timeStamp,he()),g.status=n.status,r.notify(qi(g))}},p=Te(t,n,"loadend",l).stop;r.notify(a)}}function Dl(e){var t=e.target,r=wo.get(t);r&&(r.isAborted=!0)}var To;function Ro(){return To||(To=Ul()),To}function Ul(){return new Y(function(e){if(!!window.fetch){var t=Ke(window,"fetch",function(r){return Bl(r,e)},{computeHandlingStack:!0}).stop;return t}})}function Bl(e,t){var r=e.parameters,n=e.onPostCall,o=e.handlingStack,i=r[0],a=r[1],c=a&&a.method;c===void 0&&i instanceof Request&&(c=i.method);var f=c!==void 0?String(c).toUpperCase():"GET",l=i instanceof Request?i.url:$t(String(i)),p=Ce(),g={state:"start",init:a,input:i,method:f,startClocks:p,url:l,handlingStack:o};t.notify(g),r[0]=g.input,r[1]=g.init,n(function(y){return $l(t,y,g)})}function $l(e,t,r){var n=function(o){var i=r;i.state="resolve","stack"in o||o instanceof Error?(i.status=0,i.isAborted=o instanceof DOMException&&o.code===DOMException.ABORT_ERR,i.error=o):"status"in o&&(i.response=o,i.responseType=o.type,i.status=o.status,i.isAborted=!1),e.notify(i)};t.then(W(n),W(n))}var Oo={};function Co(e){var t=e.map(function(r){return Oo[r]||(Oo[r]=Fl(r)),Oo[r]});return Fr.apply(void 0,t)}function Fl(e){return new Y(function(t){var r=Oe[e];return Oe[e]=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];r.apply(console,n);var i=nn();Ze(function(){t.notify(Gl(n,e,i))})},function(){Oe[e]=r}})}function Gl(e,t,r){var n=e.map(function(f){return jl(f)}).join(" "),o,i,a;if(t===Q.error){var c=Hi(e,function(f){return f instanceof Error});o=c?Me(le(c)):void 0,i=so(c),a=c?co(c,"console"):void 0}return{api:t,message:n,stack:o,handlingStack:r,fingerprint:i,causes:a}}function jl(e){return typeof e=="string"?Se(e):e instanceof Error?oo(le(e)):xe(Se(e),void 0,2)}function qt(e){var t={},r=new Y,n={getContext:function(){return sn(t)},setContext:function(o){jt(o)==="object"?(t=Se(o),e.updateCustomerData(t)):n.clearContext(),r.notify()},setContextProperty:function(o,i){t[o]=Se(i),e.updateCustomerData(t),r.notify()},removeContextProperty:function(o){delete t[o],e.updateCustomerData(t),r.notify()},clearContext:function(){t={},e.resetCustomerData(),r.notify()},changeObservable:r};return n}var Wl="_dd_c",Hl=[];function vn(e,t,r,n){var o=Kl(r,n);Hl.push(Te(e,window,se.STORAGE,function(f){var l=f.key;o===l&&i()})),t.changeObservable.subscribe(a),t.setContext(De(c(),t.getContext()));function i(){t.setContext(c())}function a(){localStorage.setItem(o,JSON.stringify(t.getContext()))}function c(){var f=localStorage.getItem(o);return f!==null?JSON.parse(f):{}}}function Kl(e,t){return"".concat(Wl,"_").concat(e,"_").concat(t)}var Fa=3*be,Yl=16*be,ql=200;function Lo(e){e===void 0&&(e=2);var t=new Map,r=!1;function n(o){if(o===void 0&&(o=0),!(r||e===0)){var i=e===2?Fa:Yl,a=o;t.forEach(function(c){a+=c.getBytesCount()}),a>i&&(Vl(i),r=!0)}}return{createDetachedTracker:function(){var o=Ao(function(){return n(o.getBytesCount())});return o},getOrCreateTracker:function(o){return t.has(o)||t.set(o,Ao(n)),t.get(o)},setCompressionStatus:function(o){e===0&&(e=o,n())},getCompressionStatus:function(){return e},stop:function(){t.forEach(function(o){return o.stop()}),t.clear()}}}function Ao(e){var t=0,r=Gr(function(a){t=At(xe(a)),e()},ql),n=r.throttled,o=r.cancel,i=function(){o(),t=0};return{updateCustomerData:function(a){Mt(a)?i():n(a)},resetCustomerData:i,getBytesCount:function(){return t},stop:function(){o()}}}function Vl(e){K.warn("Customer data exceeds the recommended ".concat(e/be,"KiB threshold. More details: ").concat(at,"/real_user_monitoring/browser/troubleshooting/#customer-data-exceeds-the-recommended-threshold-warning"))}function No(e,t,r){var n=e.getReader(),o=[],i=0;a();function a(){n.read().then(W(function(f){if(f.done){c();return}r.collectStreamBody&&o.push(f.value),i+=f.value.length,i>r.bytesLimit?c():a()}),W(function(f){return t(f)}))}function c(){n.cancel().catch(we);var f,l;if(r.collectStreamBody){var p;if(o.length===1)p=o[0];else{p=new Uint8Array(i);var g=0;o.forEach(function(y){p.set(y,g),g+=y.length})}f=p.slice(0,r.bytesLimit),l=p.length>r.bytesLimit}t(void 0,f,l)}}var zl="datadog-synthetics-public-id",Xl="datadog-synthetics-result-id",Jl="datadog-synthetics-injects-rum";function br(){return Boolean(window._DATADOG_SYNTHETICS_INJECTS_RUM||Qe(Jl))}function Mo(){var e=window._DATADOG_SYNTHETICS_PUBLIC_ID||Qe(zl);return typeof e=="string"?e:void 0}function ko(){var e=window._DATADOG_SYNTHETICS_RESULT_ID||Qe(Xl);return typeof e=="string"?e:void 0}function gn(e){var t=ee({},e),r=["id","name","email"];return r.forEach(function(n){n in t&&(t[n]=String(t[n]))}),t}function Po(e){var t=jt(e)==="object";return t||K.error("Unsupported user:",e),t}var Zl=function(e,t,r,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(a=e[c])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i},B={ok:"ok",debug:"debug",info:"info",notice:"notice",warn:"warn",error:"error",critical:"critical",alert:"alert",emerg:"emerg"},Sr={console:"console",http:"http",silent:"silent"},Ga=Object.keys(B),yn=function(){function e(t,r,n,o,i,a){o===void 0&&(o=Sr.http),i===void 0&&(i=B.debug),a===void 0&&(a={}),this.handleLogStrategy=t,this.handlerType=o,this.level=i,this.contextManager=qt(r),this.contextManager.setContext(a),n&&this.contextManager.setContextProperty("logger",{name:n})}return e.prototype.log=function(t,r,n,o){n===void 0&&(n=B.info);var i;if(o!=null){var a=o instanceof Error?le(o):void 0,c=pr({stackTrace:a,originalError:o,nonErrorPrefix:"Provided",source:re.LOGGER,handling:"handled",startClocks:Ce()});i={stack:c.stack,kind:c.type,message:c.message,causes:c.causes}}var f=Se(r),l=i?De({error:i},f):f;this.handleLogStrategy({message:Se(t),context:l,status:n},this)},e.prototype.ok=function(t,r,n){this.log(t,r,B.ok,n)},e.prototype.debug=function(t,r,n){this.log(t,r,B.debug,n)},e.prototype.info=function(t,r,n){this.log(t,r,B.info,n)},e.prototype.notice=function(t,r,n){this.log(t,r,B.notice,n)},e.prototype.warn=function(t,r,n){this.log(t,r,B.warn,n)},e.prototype.error=function(t,r,n){this.log(t,r,B.error,n)},e.prototype.critical=function(t,r,n){this.log(t,r,B.critical,n)},e.prototype.alert=function(t,r,n){this.log(t,r,B.alert,n)},e.prototype.emerg=function(t,r,n){this.log(t,r,B.emerg,n)},e.prototype.setContext=function(t){this.contextManager.setContext(t)},e.prototype.getContext=function(){return this.contextManager.getContext()},e.prototype.setContextProperty=function(t,r){this.contextManager.setContextProperty(t,r)},e.prototype.removeContextProperty=function(t){this.contextManager.removeContextProperty(t)},e.prototype.clearContext=function(){this.contextManager.clearContext()},e.prototype.setHandler=function(t){this.handlerType=t},e.prototype.getHandler=function(){return this.handlerType},e.prototype.setLevel=function(t){this.level=t},e.prototype.getLevel=function(){return this.level},Zl([qn],e.prototype,"log",null),e}();function ja(e,t){return{view:{referrer:document.referrer,url:window.location.href},context:e.getContext(),user:t.getContext()}}var Ql=32*be;function Ha(e){e.usePciIntake===!0&&e.site&&e.site!=="datadoghq.com"&&K.warn("PCI compliance for Logs is only available for Datadog organizations in the US1 site. Default intake will be used.");var t=en(e),r=Wa(e.forwardConsoleLogs,Ge(Q),"Forward Console Logs"),n=Wa(e.forwardReports,Ge(Pe),"Forward Reports");if(!(!t||!r||!n))return e.forwardErrorsToLogs&&!Ae(r,Q.error)&&r.push(Q.error),ee({forwardErrorsToLogs:e.forwardErrorsToLogs!==!1,forwardConsoleLogs:r,forwardReports:n,requestErrorResponseLengthLimit:Ql,sendLogsAfterSessionExpiration:!!e.sendLogsAfterSessionExpiration},t)}function Wa(e,t,r){if(e===void 0)return[];if(!(e==="all"||Array.isArray(e)&&e.every(function(n){return Ae(t,n)}))){K.error("".concat(r,' should be "all" or an array with allowed values "').concat(t.join('", "'),'"'));return}return e==="all"?t:xa(e)}function Ka(e){var t=tn(e);return ee({forward_errors_to_logs:e.forwardErrorsToLogs,forward_console_logs:e.forwardConsoleLogs,forward_reports:e.forwardReports,use_pci_intake:e.usePciIntake,send_logs_after_session_expiration:e.sendLogsAfterSessionExpiration},t)}function Ya(e,t,r){var n=new gr,o,i,a=t.observable.subscribe(c);function c(){if(!(!i||!o||!t.isGranted())){a.unsubscribe();var f=r(o,i);n.drain(f)}}return{init:function(f){if(!f){K.error("Missing configuration");return}if(to(f.enableExperimentalFeatures),tt()&&(f=ef(f)),o=f,i){mr("DD_LOGS",f);return}var l=Ha(f);!l||(i=l,t.tryToInit(l.trackingConsent),c())},get initConfiguration(){return o},getInternalContext:we,handleLog:function(f,l,p,g){p===void 0&&(p=e()),g===void 0&&(g=he()),n.add(function(y){return y.handleLog(f,l,p,g)})}}}function ef(e){return ee({},e,{clientToken:"empty"})}var qa="logs";function Va(e){var t=Lo(),r=qt(t.getOrCreateTracker(2)),n=qt(t.getOrCreateTracker(1)),o=Jn();function i(){return ja(r,n)}var a=Ya(i,o,function(l,p){l.storeContextsAcrossPages&&(vn(p,r,qa,2),vn(p,n,qa,1));var g=e(l,p,i,o);return a=tf(l,g),g}),c={},f=new yn(function(){for(var l=[],p=0;p<arguments.length;p++)l[p]=arguments[p];return a.handleLog.apply(a,l)},t.createDetachedTracker());return fo({logger:f,init:W(function(l){return a.init(l)}),setTrackingConsent:W(function(l){o.update(l),pn({feature:"set-tracking-consent",tracking_consent:l})}),getGlobalContext:W(function(){return r.getContext()}),setGlobalContext:W(function(l){return r.setContext(l)}),setGlobalContextProperty:W(function(l,p){return r.setContextProperty(l,p)}),removeGlobalContextProperty:W(function(l){return r.removeContextProperty(l)}),clearGlobalContext:W(function(){return r.clearContext()}),createLogger:W(function(l,p){return p===void 0&&(p={}),c[l]=new yn(function(){for(var g=[],y=0;y<arguments.length;y++)g[y]=arguments[y];return a.handleLog.apply(a,g)},t.createDetachedTracker(),Se(l),p.handler,p.level,Se(p.context)),c[l]}),getLogger:W(function(l){return c[l]}),getInitConfiguration:W(function(){return sn(a.initConfiguration)}),getInternalContext:W(function(l){return a.getInternalContext(l)}),setUser:W(function(l){Po(l)&&n.setContext(gn(l))}),getUser:W(function(){return n.getContext()}),setUserProperty:W(function(l,p){var g,y=gn((g={},g[l]=p,g))[l];n.setContextProperty(l,y)}),removeUserProperty:W(function(l){return n.removeContextProperty(l)}),clearUser:W(function(){return n.clearContext()})})}function tf(e,t){return ee({init:function(r){mr("DD_LOGS",r)},initConfiguration:e},t)}var rf="logs";function za(e,t){var r=ho(e,rf,function(n){return nf(e,n)},t);return{findTrackedSession:function(n,o){o===void 0&&(o={returnInactive:!1});var i=r.findSession(n,o);return i&&i.trackingType==="1"?{id:i.id}:void 0},expireObservable:r.expireObservable}}function Xa(e){var t=Ja(e)==="1",r=t?{}:void 0;return{findTrackedSession:function(){return r},expireObservable:new Y}}function Ja(e){return Ot(e.sessionSampleRate)?"1":"0"}function nf(e,t){var r=of(t)?t:Ja(e);return{trackingType:r,isTracked:r==="1"}}function of(e){return e==="0"||e==="1"}var Za=!1;function Vt(e){var t=window;if(br()){var r=n(t.DD_RUM_SYNTHETICS);return!r&&!Za&&(Za=!0,Ht("Logs sent before RUM is injected by the synthetics worker",{testId:Mo(),resultId:ko()})),r}return n(t.DD_RUM);function n(o){if(o&&o.getInternalContext)return o.getInternalContext(e)}}function Qa(e,t,r,n,o){var i=Ga.concat(["custom"]),a={};i.forEach(function(c){a[c]=$a(c,t.eventRateLimiterThreshold,o)}),r.subscribe(0,function(c){var f,l,p=c.rawLogsEvent,g=c.messageContext,y=g===void 0?void 0:g,I=c.savedCommonContext,L=I===void 0?void 0:I,C=c.domainContext,N=ji(p.date),G=e.findTrackedSession(N);if(!(!G&&(!t.sendLogsAfterSessionExpiration||!e.findTrackedSession(N,{returnInactive:!0})))){var Z=L||n(),P=De({service:t.service,session_id:G?.id,usr:Mt(Z.user)?void 0:Z.user,view:Z.view},Z.context,Vt(N),p,y);((f=t.beforeSend)===null||f===void 0?void 0:f.call(t,P,C))===!1||P.origin!==re.AGENT&&((l=a[P.status])!==null&&l!==void 0?l:a.custom).isLimitReached()||r.notify(1,P)}})}var Et,af=(Et={},Et[Q.log]=B.info,Et[Q.debug]=B.debug,Et[Q.info]=B.info,Et[Q.warn]=B.warn,Et[Q.error]=B.error,Et);function es(e,t){var r=Co(e.forwardConsoleLogs).subscribe(function(n){t.notify(0,{rawLogsEvent:{date:he(),message:n.message,origin:re.CONSOLE,error:n.api===Q.error?{stack:n.stack,fingerprint:n.fingerprint,causes:n.causes}:void 0,status:af[n.api]}})});return{stop:function(){r.unsubscribe()}}}var _r,sf=(_r={},_r[Pe.cspViolation]=B.error,_r[Pe.intervention]=B.error,_r[Pe.deprecation]=B.warn,_r);function ts(e,t){var r=mo(e,e.forwardReports).subscribe(function(n){var o=n.message,i=sf[n.type],a;i===B.error?a={kind:n.subtype,stack:n.stack}:n.stack&&(o+=" Found in ".concat(uo(n.stack))),t.notify(0,{rawLogsEvent:{date:he(),message:o,origin:re.REPORT,error:a,status:i}})});return{stop:function(){r.unsubscribe()}}}function rs(e,t){if(!e.forwardErrorsToLogs)return{stop:we};var r=xo(e).subscribe(function(i){i.state==="complete"&&o("xhr",i)}),n=Ro().subscribe(function(i){i.state==="resolve"&&o("fetch",i)});function o(i,a){!e.isIntakeUrl(a.url)&&(ff(a)||hn(a.status))&&("xhr"in a?uf(a.xhr,e,c):a.response?lf(a.response,e,c):a.error&&cf(a.error,e,c));function c(f){var l={isAborted:a.isAborted};t.notify(0,{rawLogsEvent:{message:"".concat(df(i)," error ").concat(a.method," ").concat(a.url),date:a.startClocks.timeStamp,error:{stack:f||"Failed to load"},http:{method:a.method,status_code:a.status,url:a.url},status:B.error,origin:re.NETWORK},domainContext:l})}}return{stop:function(){r.unsubscribe(),n.unsubscribe()}}}function uf(e,t,r){typeof e.response=="string"?r(Do(e.response,t)):r(e.response)}function cf(e,t,r){r(Do(Me(le(e)),t))}function lf(e,t,r){var n=Oa(e);!n||!n.body?r():window.TextDecoder?pf(n.body,t.requestErrorResponseLengthLimit,function(o,i){r(o?"Unable to retrieve response: ".concat(o):i)}):n.text().then(W(function(o){return r(Do(o,t))}),W(function(o){return r("Unable to retrieve response: ".concat(o))}))}function ff(e){return e.status===0&&e.responseType!=="opaque"}function Do(e,t){return e.length>t.requestErrorResponseLengthLimit?"".concat(e.substring(0,t.requestErrorResponseLengthLimit),"..."):e}function df(e){return e==="xhr"?"XHR":"Fetch"}function pf(e,t,r){No(e,function(n,o,i){if(n)r(n);else{var a=new TextDecoder().decode(o);i&&(a+="..."),r(void 0,a)}},{bytesLimit:t,collectStreamBody:!0})}function ns(e,t){if(!e.forwardErrorsToLogs)return{stop:we};var r=new Y,n=lo(r).stop,o=r.subscribe(function(i){t.notify(0,{rawLogsEvent:{message:i.message,date:i.startClocks.timeStamp,error:{kind:i.type,stack:i.stack,causes:i.causes},origin:re.SOURCE,status:B.error}})});return{stop:function(){n(),o.unsubscribe()}}}var os=_o;var Ue,Be,is=(Ue={},Ue[B.ok]=0,Ue[B.debug]=1,Ue[B.info]=2,Ue[B.notice]=4,Ue[B.warn]=5,Ue[B.error]=6,Ue[B.critical]=7,Ue[B.alert]=8,Ue[B.emerg]=9,Ue);function ss(e){function t(r,n,o,i){var a=De(n.getContext(),r.context);as(r.status,Sr.console,n)&&hf(r,a),as(r.status,Sr.http,n)&&e.notify(0,{rawLogsEvent:{date:i||he(),message:r.message,status:r.status,origin:re.LOGGER},messageContext:a,savedCommonContext:o})}return{handleLog:t}}function as(e,t,r){var n=r.getHandler(),o=Array.isArray(n)?n:[n];return is[e]>=is[r.getLevel()]&&Ae(o,t)}var mf=(Be={},Be[B.ok]=Q.debug,Be[B.debug]=Q.debug,Be[B.info]=Q.info,Be[B.notice]=Q.info,Be[B.warn]=Q.warn,Be[B.error]=Q.error,Be[B.critical]=Q.error,Be[B.alert]=Q.error,Be[B.emerg]=Q.error,Be);function hf(e,t){var r=e.status,n=e.message;it[mf[r]].call(Oe,n,t)}function us(e,t,r,n,o){var i=Yt(e,{endpoint:e.logsEndpointBuilder,encoder:yt()},e.replica&&{endpoint:e.replica.logsEndpointBuilder,encoder:yt()},r,n,o.expireObservable);return t.subscribe(1,function(a){i.add(a)}),i}function cs(e){var t=gt();e.subscribe(1,function(r){t.send("log",r)})}function ls(e){return{get:function(t){var r=e.findTrackedSession(t);if(r)return{session_id:r.id}}}}function fs(e){return function(t){e.notify(0,{rawLogsEvent:{message:t.message,date:t.startClocks.timeStamp,origin:re.AGENT,status:B.error}}),Ht("Error reported to customer",{"error.message":t.message})}}function ds(e,t,r,n,o){var i=cn("browser-logs-sdk",t);i.setContextProvider(function(){var g,y,I,L,C,N;return{application:{id:(g=Vt())===null||g===void 0?void 0:g.application_id},session:{id:(y=o.findTrackedSession())===null||y===void 0?void 0:y.id},view:{id:(L=(I=Vt())===null||I===void 0?void 0:I.view)===null||L===void 0?void 0:L.id},action:{id:(N=(C=Vt())===null||C===void 0?void 0:C.user_action)===null||N===void 0?void 0:N.id}}});var a=[];if(tt()){var c=gt(),f=i.observable.subscribe(function(g){return c.send("internal_telemetry",g)});a.push(function(){return f.unsubscribe()})}else{var l=Yt(t,{endpoint:t.rumEndpointBuilder,encoder:yt()},t.replica&&{endpoint:t.replica.rumEndpointBuilder,encoder:yt()},r,n,o.expireObservable);a.push(function(){return l.stop()});var p=i.observable.subscribe(function(g){return l.add(g,fn(t))});a.push(function(){return p.unsubscribe()})}return ln(),dn(Ka(e)),{telemetry:i,stop:function(){a.forEach(function(g){return g()})}}}function ps(e,t,r,n){var o=new os,i=[];o.subscribe(1,function(I){return vr("logs",I)});var a=fs(o),c=Eo(t),f=t.sessionStoreStrategyType&&!tt()&&!br()?za(t,n):Xa(t),l=ds(e,t,a,c,f).stop;i.push(function(){return l()}),rs(t,o),ns(t,o),es(t,o),ts(t,o);var p=ss(o).handleLog;if(Qa(f,t,o,r,a),tt())cs(o);else{var g=us(t,o,a,c,f).stop;i.push(function(){return g()})}var y=ls(f);return{handleLog:p,getInternalContext:y.get,stop:function(){i.forEach(function(I){return I()})}}}var Ir=Va(ps);po(Le(),"DD_LOGS",Ir);var vf=Object.create,On=Object.defineProperty,gf=Object.defineProperties,yf=Object.getOwnPropertyDescriptor,Ef=Object.getOwnPropertyDescriptors,bf=Object.getOwnPropertyNames,ms=Object.getOwnPropertySymbols,Sf=Object.getPrototypeOf,Os=Object.prototype.hasOwnProperty,_f=Object.prototype.propertyIsEnumerable,hs=(e,t,r)=>t in e?On(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$o=(e,t)=>{for(var r in t||(t={}))Os.call(t,r)&&hs(e,r,t[r]);if(ms)for(var r of ms(t))_f.call(t,r)&&hs(e,r,t[r]);return e},Fo=(e,t)=>gf(e,Ef(t)),If=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),wf=(e,t)=>{for(var r in t)On(e,r,{get:t[r],enumerable:!0})},xf=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of bf(t))!Os.call(e,o)&&o!==r&&On(e,o,{get:()=>t[o],enumerable:!(n=yf(t,o))||n.enumerable});return e},Tf=(e,t,r)=>(r=e!=null?vf(Sf(e)):{},xf(t||!e||!e.__esModule?On(r,"default",{value:e,enumerable:!0}):r,e)),ne=(e,t,r)=>new Promise((n,o)=>{var i=f=>{try{c(r.next(f))}catch(l){o(l)}},a=f=>{try{c(r.throw(f))}catch(l){o(l)}},c=f=>f.done?n(f.value):Promise.resolve(f.value).then(i,a);c((r=r.apply(e,t)).next())}),Rf=If((e,t)=>{"use strict";var r=Object.prototype.hasOwnProperty,n="~";function o(){}Object.create&&(o.prototype=Object.create(null),new o().__proto__||(n=!1));function i(l,p,g){this.fn=l,this.context=p,this.once=g||!1}function a(l,p,g,y,I){if(typeof g!="function")throw new TypeError("The listener must be a function");var L=new i(g,y||l,I),C=n?n+p:p;return l._events[C]?l._events[C].fn?l._events[C]=[l._events[C],L]:l._events[C].push(L):(l._events[C]=L,l._eventsCount++),l}function c(l,p){--l._eventsCount===0?l._events=new o:delete l._events[p]}function f(){this._events=new o,this._eventsCount=0}f.prototype.eventNames=function(){var l=[],p,g;if(this._eventsCount===0)return l;for(g in p=this._events)r.call(p,g)&&l.push(n?g.slice(1):g);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(p)):l},f.prototype.listeners=function(l){var p=n?n+l:l,g=this._events[p];if(!g)return[];if(g.fn)return[g.fn];for(var y=0,I=g.length,L=new Array(I);y<I;y++)L[y]=g[y].fn;return L},f.prototype.listenerCount=function(l){var p=n?n+l:l,g=this._events[p];return g?g.fn?1:g.length:0},f.prototype.emit=function(l,p,g,y,I,L){var C=n?n+l:l;if(!this._events[C])return!1;var N=this._events[C],G=arguments.length,Z,P;if(N.fn){switch(N.once&&this.removeListener(l,N.fn,void 0,!0),G){case 1:return N.fn.call(N.context),!0;case 2:return N.fn.call(N.context,p),!0;case 3:return N.fn.call(N.context,p,g),!0;case 4:return N.fn.call(N.context,p,g,y),!0;case 5:return N.fn.call(N.context,p,g,y,I),!0;case 6:return N.fn.call(N.context,p,g,y,I,L),!0}for(P=1,Z=new Array(G-1);P<G;P++)Z[P-1]=arguments[P];N.fn.apply(N.context,Z)}else{var $e=N.length,ue;for(P=0;P<$e;P++)switch(N[P].once&&this.removeListener(l,N[P].fn,void 0,!0),G){case 1:N[P].fn.call(N[P].context);break;case 2:N[P].fn.call(N[P].context,p);break;case 3:N[P].fn.call(N[P].context,p,g);break;case 4:N[P].fn.call(N[P].context,p,g,y);break;default:if(!Z)for(ue=1,Z=new Array(G-1);ue<G;ue++)Z[ue-1]=arguments[ue];N[P].fn.apply(N[P].context,Z)}}return!0},f.prototype.on=function(l,p,g){return a(this,l,p,g,!1)},f.prototype.once=function(l,p,g){return a(this,l,p,g,!0)},f.prototype.removeListener=function(l,p,g,y){var I=n?n+l:l;if(!this._events[I])return this;if(!p)return c(this,I),this;var L=this._events[I];if(L.fn)L.fn===p&&(!y||L.once)&&(!g||L.context===g)&&c(this,I);else{for(var C=0,N=[],G=L.length;C<G;C++)(L[C].fn!==p||y&&!L[C].once||g&&L[C].context!==g)&&N.push(L[C]);N.length?this._events[I]=N.length===1?N[0]:N:c(this,I)}return this},f.prototype.removeAllListeners=function(l){var p;return l?(p=n?n+l:l,this._events[p]&&c(this,p)):(this._events=new o,this._eventsCount=0),this},f.prototype.off=f.prototype.removeListener,f.prototype.addListener=f.prototype.on,f.prefixed=n,f.EventEmitter=f,typeof t<"u"&&(t.exports=f)});function Of(e){let t={exports:{}};return e(t,t.exports),t.exports}var Cf=Number.MAX_SAFE_INTEGER||9007199254740991,Go={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:Cf,MAX_SAFE_COMPONENT_LENGTH:16},Af=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{},J=Af,Nr=Of(function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:r}=Go,n=(t=e.exports={}).re=[],o=t.src=[],i=t.t={},a=0,c=(f,l,p)=>{let g=a++;J(g,l),i[f]=g,o[g]=l,n[g]=new RegExp(l,p?"g":void 0)};c("NUMERICIDENTIFIER","0|[1-9]\\d*"),c("NUMERICIDENTIFIERLOOSE","[0-9]+"),c("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),c("MAINVERSION",`(${o[i.NUMERICIDENTIFIER]})\\.(${o[i.NUMERICIDENTIFIER]})\\.(${o[i.NUMERICIDENTIFIER]})`),c("MAINVERSIONLOOSE",`(${o[i.NUMERICIDENTIFIERLOOSE]})\\.(${o[i.NUMERICIDENTIFIERLOOSE]})\\.(${o[i.NUMERICIDENTIFIERLOOSE]})`),c("PRERELEASEIDENTIFIER",`(?:${o[i.NUMERICIDENTIFIER]}|${o[i.NONNUMERICIDENTIFIER]})`),c("PRERELEASEIDENTIFIERLOOSE",`(?:${o[i.NUMERICIDENTIFIERLOOSE]}|${o[i.NONNUMERICIDENTIFIER]})`),c("PRERELEASE",`(?:-(${o[i.PRERELEASEIDENTIFIER]}(?:\\.${o[i.PRERELEASEIDENTIFIER]})*))`),c("PRERELEASELOOSE",`(?:-?(${o[i.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[i.PRERELEASEIDENTIFIERLOOSE]})*))`),c("BUILDIDENTIFIER","[0-9A-Za-z-]+"),c("BUILD",`(?:\\+(${o[i.BUILDIDENTIFIER]}(?:\\.${o[i.BUILDIDENTIFIER]})*))`),c("FULLPLAIN",`v?${o[i.MAINVERSION]}${o[i.PRERELEASE]}?${o[i.BUILD]}?`),c("FULL",`^${o[i.FULLPLAIN]}$`),c("LOOSEPLAIN",`[v=\\s]*${o[i.MAINVERSIONLOOSE]}${o[i.PRERELEASELOOSE]}?${o[i.BUILD]}?`),c("LOOSE",`^${o[i.LOOSEPLAIN]}$`),c("GTLT","((?:<|>)?=?)"),c("XRANGEIDENTIFIERLOOSE",`${o[i.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),c("XRANGEIDENTIFIER",`${o[i.NUMERICIDENTIFIER]}|x|X|\\*`),c("XRANGEPLAIN",`[v=\\s]*(${o[i.XRANGEIDENTIFIER]})(?:\\.(${o[i.XRANGEIDENTIFIER]})(?:\\.(${o[i.XRANGEIDENTIFIER]})(?:${o[i.PRERELEASE]})?${o[i.BUILD]}?)?)?`),c("XRANGEPLAINLOOSE",`[v=\\s]*(${o[i.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[i.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[i.XRANGEIDENTIFIERLOOSE]})(?:${o[i.PRERELEASELOOSE]})?${o[i.BUILD]}?)?)?`),c("XRANGE",`^${o[i.GTLT]}\\s*${o[i.XRANGEPLAIN]}$`),c("XRANGELOOSE",`^${o[i.GTLT]}\\s*${o[i.XRANGEPLAINLOOSE]}$`),c("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),c("COERCERTL",o[i.COERCE],!0),c("LONETILDE","(?:~>?)"),c("TILDETRIM",`(\\s*)${o[i.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",c("TILDE",`^${o[i.LONETILDE]}${o[i.XRANGEPLAIN]}$`),c("TILDELOOSE",`^${o[i.LONETILDE]}${o[i.XRANGEPLAINLOOSE]}$`),c("LONECARET","(?:\\^)"),c("CARETTRIM",`(\\s*)${o[i.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",c("CARET",`^${o[i.LONECARET]}${o[i.XRANGEPLAIN]}$`),c("CARETLOOSE",`^${o[i.LONECARET]}${o[i.XRANGEPLAINLOOSE]}$`),c("COMPARATORLOOSE",`^${o[i.GTLT]}\\s*(${o[i.LOOSEPLAIN]})$|^$`),c("COMPARATOR",`^${o[i.GTLT]}\\s*(${o[i.FULLPLAIN]})$|^$`),c("COMPARATORTRIM",`(\\s*)${o[i.GTLT]}\\s*(${o[i.LOOSEPLAIN]}|${o[i.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",c("HYPHENRANGE",`^\\s*(${o[i.XRANGEPLAIN]})\\s+-\\s+(${o[i.XRANGEPLAIN]})\\s*$`),c("HYPHENRANGELOOSE",`^\\s*(${o[i.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[i.XRANGEPLAINLOOSE]})\\s*$`),c("STAR","(<|>)?=?\\s*\\*"),c("GTE0","^\\s*>=\\s*0.0.0\\s*$"),c("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")}),vs=/^[0-9]+$/,Cs=(e,t)=>{let r=vs.test(e),n=vs.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},Lf=(e,t)=>Cs(t,e),Nf={compareIdentifiers:Cs,rcompareIdentifiers:Lf},{MAX_LENGTH:gs,MAX_SAFE_INTEGER:En}=Go,{re:ys,t:Es}=Nr,{compareIdentifiers:wr}=Nf,fe=class{constructor(e,t){if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof fe){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>gs)throw new TypeError(`version is longer than ${gs} characters`);J("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?ys[Es.LOOSE]:ys[Es.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>En||this.major<0)throw new TypeError("Invalid major version");if(this.minor>En||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>En||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let o=+n;if(o>=0&&o<En)return o}return n}):this.prerelease=[],this.build=r[5]?r[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(J("SemVer.compare",this.version,this.options,e),!(e instanceof fe)){if(typeof e=="string"&&e===this.version)return 0;e=new fe(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof fe||(e=new fe(e,this.options)),wr(this.major,e.major)||wr(this.minor,e.minor)||wr(this.patch,e.patch)}comparePre(e){if(e instanceof fe||(e=new fe(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 r=this.prerelease[t],n=e.prerelease[t];if(J("prerelease compare",t,r,n),r===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(r===void 0)return-1;if(r!==n)return wr(r,n)}while(++t)}compareBuild(e){e instanceof fe||(e=new fe(e,this.options));let t=0;do{let r=this.build[t],n=e.build[t];if(J("prerelease compare",t,r,n),r===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(r===void 0)return-1;if(r!==n)return wr(r,n)}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 r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]=="number"&&(this.prerelease[r]++,r=-2);r===-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}},Mf=(e,t,r)=>new fe(e,r).compare(new fe(t,r)),er=Mf,kf=(e,t,r)=>er(e,t,r)===0,Pf=kf,Df=(e,t,r)=>er(e,t,r)!==0,Uf=Df,Bf=(e,t,r)=>er(e,t,r)>0,$f=Bf,Ff=(e,t,r)=>er(e,t,r)>=0,Gf=Ff,jf=(e,t,r)=>er(e,t,r)<0,Wf=jf,Hf=(e,t,r)=>er(e,t,r)<=0,Kf=Hf,Yf=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return Pf(e,r,n);case"!=":return Uf(e,r,n);case">":return $f(e,r,n);case">=":return Gf(e,r,n);case"<":return Wf(e,r,n);case"<=":return Kf(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}},Uo=Yf,xr=Symbol("SemVer ANY"),Cr=class{static get ANY(){return xr}constructor(e,t){if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof Cr){if(e.loose===!!t.loose)return e;e=e.value}J("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===xr?this.value="":this.value=this.operator+this.semver.version,J("comp",this)}parse(e){let t=this.options.loose?bs[Ss.COMPARATORLOOSE]:bs[Ss.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=r[1]!==void 0?r[1]:"",this.operator==="="&&(this.operator=""),r[2]?this.semver=new fe(r[2],this.options.loose):this.semver=xr}toString(){return this.value}test(e){if(J("Comparator.test",e,this.options.loose),this.semver===xr||e===xr)return!0;if(typeof e=="string")try{e=new fe(e,this.options)}catch(t){return!1}return Uo(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof Cr))throw new TypeError("a Comparator is required");if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),this.operator==="")return this.value===""||new Xt(e.value,t).test(this.value);if(e.operator==="")return e.value===""||new Xt(this.value,t).test(e.semver);let r=!(this.operator!==">="&&this.operator!==">"||e.operator!==">="&&e.operator!==">"),n=!(this.operator!=="<="&&this.operator!=="<"||e.operator!=="<="&&e.operator!=="<"),o=this.semver.version===e.semver.version,i=!(this.operator!==">="&&this.operator!=="<="||e.operator!==">="&&e.operator!=="<="),a=Uo(this.semver,"<",e.semver,t)&&(this.operator===">="||this.operator===">")&&(e.operator==="<="||e.operator==="<"),c=Uo(this.semver,">",e.semver,t)&&(this.operator==="<="||this.operator==="<")&&(e.operator===">="||e.operator===">");return r||n||o&&i||a||c}},{re:bs,t:Ss}=Nr,Xt=class{constructor(e,t){if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof Xt)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new Xt(e.raw,t);if(e instanceof Cr)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(r=>this.parseRange(r.trim())).filter(r=>r.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 r=t?pe[de.HYPHENRANGELOOSE]:pe[de.HYPHENRANGE];e=e.replace(r,id(this.options.includePrerelease)),J("hyphen replace",e),e=e.replace(pe[de.COMPARATORTRIM],qf),J("comparator trim",e,pe[de.COMPARATORTRIM]),e=(e=(e=e.replace(pe[de.TILDETRIM],Vf)).replace(pe[de.CARETTRIM],zf)).split(/\s+/).join(" ");let n=t?pe[de.COMPARATORLOOSE]:pe[de.COMPARATOR];return e.split(" ").map(o=>Xf(o,this.options)).join(" ").split(/\s+/).map(o=>od(o,this.options)).filter(this.options.loose?o=>!!o.match(n):()=>!0).map(o=>new Cr(o,this.options))}intersects(e,t){if(!(e instanceof Xt))throw new TypeError("a Range is required");return this.set.some(r=>_s(r,t)&&e.set.some(n=>_s(n,t)&&r.every(o=>n.every(i=>o.intersects(i,t)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new fe(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(ad(this.set[t],e,this.options))return!0;return!1}},{re:pe,t:de,comparatorTrimReplace:qf,tildeTrimReplace:Vf,caretTrimReplace:zf}=Nr,_s=(e,t)=>{let r=!0,n=e.slice(),o=n.pop();for(;r&&n.length;)r=n.every(i=>o.intersects(i,t)),o=n.pop();return r},Xf=(e,t)=>(J("comp",e,t),e=Qf(e,t),J("caret",e),e=Jf(e,t),J("tildes",e),e=td(e,t),J("xrange",e),e=nd(e,t),J("stars",e),e),ve=e=>!e||e.toLowerCase()==="x"||e==="*",Jf=(e,t)=>e.trim().split(/\s+/).map(r=>Zf(r,t)).join(" "),Zf=(e,t)=>{let r=t.loose?pe[de.TILDELOOSE]:pe[de.TILDE];return e.replace(r,(n,o,i,a,c)=>{let f;return J("tilde",e,n,o,i,a,c),ve(o)?f="":ve(i)?f=`>=${o}.0.0 <${+o+1}.0.0-0`:ve(a)?f=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:c?(J("replaceTilde pr",c),f=`>=${o}.${i}.${a}-${c} <${o}.${+i+1}.0-0`):f=`>=${o}.${i}.${a} <${o}.${+i+1}.0-0`,J("tilde return",f),f})},Qf=(e,t)=>e.trim().split(/\s+/).map(r=>ed(r,t)).join(" "),ed=(e,t)=>{J("caret",e,t);let r=t.loose?pe[de.CARETLOOSE]:pe[de.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(o,i,a,c,f)=>{let l;return J("caret",e,o,i,a,c,f),ve(i)?l="":ve(a)?l=`>=${i}.0.0${n} <${+i+1}.0.0-0`:ve(c)?l=i==="0"?`>=${i}.${a}.0${n} <${i}.${+a+1}.0-0`:`>=${i}.${a}.0${n} <${+i+1}.0.0-0`:f?(J("replaceCaret pr",f),l=i==="0"?a==="0"?`>=${i}.${a}.${c}-${f} <${i}.${a}.${+c+1}-0`:`>=${i}.${a}.${c}-${f} <${i}.${+a+1}.0-0`:`>=${i}.${a}.${c}-${f} <${+i+1}.0.0-0`):(J("no pr"),l=i==="0"?a==="0"?`>=${i}.${a}.${c}${n} <${i}.${a}.${+c+1}-0`:`>=${i}.${a}.${c}${n} <${i}.${+a+1}.0-0`:`>=${i}.${a}.${c} <${+i+1}.0.0-0`),J("caret return",l),l})},td=(e,t)=>(J("replaceXRanges",e,t),e.split(/\s+/).map(r=>rd(r,t)).join(" ")),rd=(e,t)=>{e=e.trim();let r=t.loose?pe[de.XRANGELOOSE]:pe[de.XRANGE];return e.replace(r,(n,o,i,a,c,f)=>{J("xRange",e,n,o,i,a,c,f);let l=ve(i),p=l||ve(a),g=p||ve(c),y=g;return o==="="&&y&&(o=""),f=t.includePrerelease?"-0":"",l?n=o===">"||o==="<"?"<0.0.0-0":"*":o&&y?(p&&(a=0),c=0,o===">"?(o=">=",p?(i=+i+1,a=0,c=0):(a=+a+1,c=0)):o==="<="&&(o="<",p?i=+i+1:a=+a+1),o==="<"&&(f="-0"),n=`${o+i}.${a}.${c}${f}`):p?n=`>=${i}.0.0${f} <${+i+1}.0.0-0`:g&&(n=`>=${i}.${a}.0${f} <${i}.${+a+1}.0-0`),J("xRange return",n),n})},nd=(e,t)=>(J("replaceStars",e,t),e.trim().replace(pe[de.STAR],"")),od=(e,t)=>(J("replaceGTE0",e,t),e.trim().replace(pe[t.includePrerelease?de.GTE0PRE:de.GTE0],"")),id=e=>(t,r,n,o,i,a,c,f,l,p,g,y,I)=>`${r=ve(n)?"":ve(o)?`>=${n}.0.0${e?"-0":""}`:ve(i)?`>=${n}.${o}.0${e?"-0":""}`:a?`>=${r}`:`>=${r}${e?"-0":""}`} ${f=ve(l)?"":ve(p)?`<${+l+1}.0.0-0`:ve(g)?`<${l}.${+p+1}.0-0`:y?`<=${l}.${p}.${g}-${y}`:e?`<${l}.${p}.${+g+1}-0`:`<=${f}`}`.trim(),ad=(e,t,r)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let n=0;n<e.length;n++)if(J(e[n].semver),e[n].semver!==Cr.ANY&&e[n].semver.prerelease.length>0){let o=e[n].semver;if(o.major===t.major&&o.minor===t.minor&&o.patch===t.patch)return!0}return!1}return!0},sd=(e,t,r)=>{try{t=new Xt(t,r)}catch(n){return!1}return t.test(e)},{MAX_LENGTH:ud}=Go,{re:Is,t:ws}=Nr,cd=(e,t)=>{if(t&&typeof t=="object"||(t={loose:!!t,includePrerelease:!1}),e instanceof fe)return e;if(typeof e!="string"||e.length>ud||!(t.loose?Is[ws.LOOSE]:Is[ws.FULL]).test(e))return null;try{return new fe(e,t)}catch(r){return null}},ld=cd,{re:bn,t:Sn}=Nr,fd=(e,t)=>{if(e instanceof fe)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;let r=null;if((t=t||{}).rtl){let n;for(;(n=bn[Sn.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&n.index+n[0].length===r.index+r[0].length||(r=n),bn[Sn.COERCERTL].lastIndex=n.index+n[1].length+n[2].length;bn[Sn.COERCERTL].lastIndex=-1}else r=e.match(bn[Sn.COERCE]);return r===null?null:ld(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};function dd(e){return String.fromCharCode(parseInt(e.slice(1),16))}function pd(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}function md(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,dd))}function hd(e){return decodeURIComponent(Array.from(atob(e),pd).join(""))}function As(e){return md(JSON.stringify(e))}function vd(e){return JSON.parse(hd(e))}function Tr(e){return typeof e=="undefined"}function gd(e){return e===null}function Ls(e){return gd(e)||Tr(e)}function yd(e){return Ls(e)?!1:!Tr(e.jsonrpc)&&!Tr(e.id)&&(!Tr(e.result)||!Tr(e.error))}function Ed(e){return Ls(e)?!1:typeof e=="number"&&Object.values(Tt).includes(e)}function xn(e){if(!e)return!0;for(let t in e)if(Object.hasOwnProperty.call(e,t))return!1;return!0}var te={};function Ns(e,t){return Object.assign(te,t),e}var bd={"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"},rt=class extends Error{constructor(e,t){super(`Magic SDK Error: [${e}] ${t}`),this.code=e,this.rawMessage=t,this.__proto__=Error,Object.setPrototypeOf(this,rt.prototype)}},Qt=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=Ed(t)?t:Tt.InternalError,this.message=`Magic RPC Error: [${this.code}] ${this.rawMessage}`,this.data=(e==null?void 0:e.data)||void 0,Object.setPrototypeOf(this,Qt.prototype)}},St=class{constructor(e,t){this.code=e,this.rawMessage=t,this.message=`Magic SDK Warning: [${e}] ${t}`}log(){console.warn(this.message)}},Cn=class extends Error{constructor(e,t,r,n){super(`Magic Extension Error (${e.name}): [${t}] ${r}`),this.code=t,this.rawMessage=r,this.data=n,this.__proto__=Error,Object.setPrototypeOf(this,Cn.prototype)}},Tn=class{constructor(e,t,r){this.code=t,this.rawMessage=r,this.message=`Magic Extension Warning (${e.name}): [${t}] ${r}`}log(){console.warn(this.message)}};function Sd(){return new rt(qe.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")}function jo(){return new rt(qe.ModalNotReady,"Modal is not ready.")}function _d(){return new rt(qe.MalformedResponse,"Response from the Magic iframe is malformed.")}function Id(e){return new rt(qe.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 wd(e){let t=`Some extensions are incompatible with \`${te.sdkName}@${te.version}\`:`;return e.filter(r=>typeof r.compat!="undefined"&&r.compat!==null).forEach(r=>{let n=r.compat[te.sdkName];typeof n=="string"?t+=`
8
+ - Extension \`${r.name}\` supports version(s) \`${n}\``:n||(t+=`
9
+ - Extension \`${r.name}\` does not support ${te.platform} environments.`)}),new rt(qe.IncompatibleExtensions,t)}function xd(e){let t=r=>{let n=r+1,o=n%10,i=n%100;return o===1&&i!==11?`${n}st`:o===2&&i!==12?`${n}nd`:o===3&&i!==13?`${n}rd`:`${n}th`};return new rt(qe.InvalidArgument,`Invalid ${t(e.argument)} argument given to \`${e.procedure}\`.
4
10
  Expected: \`${e.expected}\`
5
- Received: \`${e.received}\``)}function Xr(){return new Oe(ve.DuplicateIframe,"Duplicate iframes found.")}function No(){return new Oe(ve.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 To(){return new Oe(ve.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 \`${Y.defaultEndpoint}\`. Changing this default behavior will lead to unexpected results and potentially security-threatening bugs.`)}function ze(e){let{method:t,removalVersions:r,useInstead:o}=e,a=r[Y.sdkName],s=o?` Use \`${o}\` instead.`:"",m=`\`${t}\` will be removed from \`${Y.sdkName}\` in version \`${a}\`.${s}`;return new Oe(ve.DeprecationNotice,m)}function*Oo(){let e=0;for(;;)e<Number.MAX_SAFE_INTEGER?yield++e:e=0}var Mo=Oo();function zr(){return Mo.next().value}var Jr=Symbol("Payload pre-processed by Magic SDK");function Qr(e){return Object.defineProperty(e,Jr,{value:!0,enumerable:!1}),e}function Lo(e){return!!e[Jr]}function dt(e){var t,r,o;return Lo(e)||(e.jsonrpc=(t=e.jsonrpc)!=null?t:"2.0",e.id=zr(),e.method=(r=e.method)!=null?r:"noop",e.params=(o=e.params)!=null?o:[],Qr(e)),e}function W(e,t=[]){return Qr({params:t,method:e,jsonrpc:"2.0",id:zr()})}var $t=class{constructor(e){e instanceof $t?(this._jsonrpc=e.payload.jsonrpc,this._id=e.payload.id,this._result=e.payload.result,this._error=e.payload.error):Eo(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}}},Co=Si(Ni()),Po=class extends Co.default{};function Zr(){let e=new Po;return{emitter:e,createChainingEmitterMethod:(t,r)=>(...o)=>(e[t].apply(e,o),r),createBoundEmitterMethod:t=>(...r)=>e[t].apply(e,r)}}var en=Symbol("isPromiEvent");function Dt(e){return!!e[en]}function Ze(e){let t=tn(e),{createBoundEmitterMethod:r,createChainingEmitterMethod:o}=Zr(),a=Symbol("Promise.then"),s=Symbol("Promise.catch"),m=Symbol("Promise.finally"),h=(y,T)=>(..._)=>{let N=T[y].apply(T,_);return g(N)},g=y=>Object.assign(y,{[en]:!0,[a]:y[a]||y.then,[s]:y[s]||y.catch,[m]:y[m]||y.finally,then:h(a,y),catch:h(s,y),finally:h(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:r("emit"),eventNames:r("eventNames"),listeners:r("listeners"),listenerCount:r("listenerCount")}),v=g(t.then(y=>(v.emit("done",y),v.emit("settled"),y),y=>{throw v.emit("error",y),v.emit("settled"),y}));return v}function tn(e){return new Promise((t,r)=>{let o=e(t,r);Promise.resolve(o).catch(r)})}var Me=class{constructor(e){this.sdk=e}get overlay(){return this.sdk.overlay}request(e){let t=this.overlay.post(Se.MAGIC_HANDLE_REQUEST,dt(e)),r=Ze((a,s)=>{t.then(m=>{if(o(),m.hasError)s(new Fe(m.payload.error));else if(m.hasResult)a(m.payload.result);else throw bo()}).catch(m=>{o(),s(m)})}),o=this.overlay.on(he.MAGIC_HANDLE_EVENT,a=>{var s;let{response:m}=a.data;if(m.id===e.id&&((s=m.result)==null?void 0:s.event)){let{event:h,params:g=[]}=m.result;r.emit(h,...g)}});return r}createIntermediaryEvent(e,t){return r=>{let o=W(M.IntermediaryEvent,[{payloadId:t,eventType:e,args:r}]);this.request(o)}}};function $o(e,t){let[r]=e.split(".").map(Number);return r>=t}var Je={"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"},Do=class extends Me{loginWithMagicLink(e){let t=Y.sdkName==="@magic-sdk/react-native"||Y.sdkName==="@magic-sdk/react-native-bare"||Y.sdkName==="@magic-sdk/react-native-expo";if(t&&$o(Y.version,19))throw new Error("loginWithMagicLink() is deprecated for this package, please utlize a passcode method like loginWithSMS or loginWithEmailOTP instead.");t&&ze({method:"auth.loginWithMagicLink()",removalVersions:Je,useInstead:"auth.loginWithEmailOTP()"}).log();let{email:r,showUI:o=!0,redirectURI:a,overrides:s}=e,m=W(this.sdk.testMode?M.LoginWithMagicLinkTestMode:M.LoginWithMagicLink,[{email:r,showUI:o,redirectURI:a,overrides:s}]);return this.request(m)}loginWithSMS(e){let{phoneNumber:t}=e,r=W(this.sdk.testMode?M.LoginWithSmsTestMode:M.LoginWithSms,[{phoneNumber:t,showUI:!0}]);return this.request(r)}loginWithEmailOTP(e){let{email:t,showUI:r,deviceCheckUI:o,overrides:a}=e,s=W(this.sdk.testMode?M.LoginWithEmailOTPTestMode:M.LoginWithEmailOTP,[{email:t,showUI:r,deviceCheckUI:o,overrides:a}]),m=this.request(s);return!o&&m&&m.on(qe.Retry,()=>{this.createIntermediaryEvent(qe.Retry,s.id)()}),!r&&m&&(m.on(Ne.VerifyEmailOtp,h=>{this.createIntermediaryEvent(Ne.VerifyEmailOtp,s.id)(h)}),m.on(Ne.Cancel,()=>{this.createIntermediaryEvent(Ne.Cancel,s.id)()})),m}loginWithCredential(e){let t=e!=null?e:"";if(!e&&Y.platform==="web"){t=window.location.search;let o=window.location.origin+window.location.pathname;window.history.replaceState(null,"",o)}let r=W(this.sdk.testMode?M.LoginWithCredentialTestMode:M.LoginWithCredential,[t]);return this.request(r)}setAuthorizationToken(e){let t=W(M.SetAuthorizationToken,[{jwt:e}]);return this.request(t)}updateEmailWithUI(e){let{email:t,showUI:r=!0}=e,o=W(this.sdk.testMode?M.UpdateEmailTestMode:M.UpdateEmail,[{email:t,showUI:r}]),a=this.request(o);return r||(a.on(ge.Retry,()=>{this.createIntermediaryEvent(ge.Retry,o.id)()}),a.on(ge.Cancel,()=>{this.createIntermediaryEvent(ge.Cancel,o.id)()}),a.on(ge.VerifyEmailOtp,s=>{this.createIntermediaryEvent(ge.VerifyEmailOtp,o.id)(s)}),a.on(ye.RetryWithNewEmail,s=>{this.createIntermediaryEvent(ye.RetryWithNewEmail,o.id)(s)}),a.on(ye.Cancel,()=>{this.createIntermediaryEvent(ye.Cancel,o.id)()}),a.on(ye.VerifyEmailOtp,s=>{this.createIntermediaryEvent(ye.VerifyEmailOtp,o.id)(s)})),a}},rn={};Ri(rn,{clear:()=>xo,getItem:()=>se,iterate:()=>nn,key:()=>ko,keys:()=>Fo,length:()=>Uo,removeItem:()=>ke,setItem:()=>me});var st;function be(e){return(...t)=>X(this,null,function*(){return st||(st=yield Y.configureStorage()),yield st.ready(),st[e](...t)})}var se=be("getItem"),me=be("setItem"),ke=be("removeItem"),xo=be("clear"),Uo=be("length"),ko=be("key"),Fo=be("keys"),nn=be("iterate");function Wo(){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 on="STORE_KEY_PRIVATE_KEY",Ot="STORE_KEY_PUBLIC_JWK",an="ECDSA",Bo="P-256",Go={name:an,namedCurve:Bo};function pt(){let e=typeof window!="undefined"&&!!window.crypto,t=e&&!!window.crypto.subtle;return e&&t}function jo(){return X(this,null,function*(){let e=yield Vo();if(!e){console.info("unable to create public key or webcrypto is unsupported");return}let{subtle:t}=window.crypto,r=yield se(on);if(!r||!t){console.info("unable to find private key or webcrypto unsupported");return}let o={iat:Math.floor(new Date().getTime()/1e3),jti:Wo()},a={typ:"dpop+jwt",alg:"ES256",jwk:e},s={protected:Br(JSON.stringify(a)),claims:Br(JSON.stringify(o))},m=qo(`${s.protected}.${s.claims}`),h={name:an,hash:{name:"SHA-256"}},g=Yo(new Uint8Array(yield t.sign(h,r,m)));return`${s.protected}.${s.claims}.${g}`})}function Vo(){return X(this,null,function*(){if(!pt()){console.info("webcrypto is not supported");return}return(yield se(Ot))||(yield Ko()),se(Ot)})}function Ko(){return X(this,null,function*(){let{subtle:e}=window.crypto,t=yield e.generateKey(Go,!1,["sign"]),r=yield e.exportKey("jwk",t.publicKey);yield me(on,t.privateKey),yield me(Ot,r)})}function Br(e){return sn(Ho(e))}function qo(e){return new TextEncoder().encode(e)}function sn(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+/g,"")}function Ho(e){return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(t,r)=>String.fromCharCode(parseInt(r,16)))}function Yo(e){let t="";return e.forEach(r=>{t+=String.fromCharCode(r)}),sn(t)}var xt="ds",Ut="ek",kt="iv",Ft="AES-GCM",Xo=256;function Wt(){return X(this,null,function*(){let e=[];yield nn((t,r,o)=>{r.startsWith(`${xt}_`)&&e.push(r)});for(let t of e)yield ke(t)})}function ln(e){let t="",r=new Uint8Array(e),o=r.byteLength;for(let a=0;a<o;a++)t+=String.fromCharCode(r[a]);return window.btoa(t)}function cn(e){let t=window.atob(e),r=t.length,o=new Uint8Array(r);for(let a=0;a<r;a++)o[a]=t.charCodeAt(a);return o.buffer}function zo(){return X(this,null,function*(){if(!pt()){console.info("webcrypto is not supported");return}let{crypto:e}=window;return(yield se(kt))||e.getRandomValues(new Uint8Array(12))})}function Jo(){return X(this,null,function*(){if(!pt()){console.info("webcrypto is not supported");return}let{subtle:e}=window.crypto;return(yield se(Ut))||(yield e.generateKey({name:Ft,length:Xo},!1,["encrypt","decrypt"]))})}function Qo(e,t){return X(this,null,function*(){let r=yield zo(),o=yield Jo();if(!r||!o||!e)return;let a=cn(e),{subtle:s}=window.crypto,m=yield s.encrypt({name:Ft,iv:r},o,a),h=ln(m);yield me(`${xt}_${t}`,h),yield me(Ut,o),yield me(kt,r)})}function Zo(e){return X(this,null,function*(){let t=yield se(`${xt}_${e}`),r=yield se(kt),o=yield se(Ut);if(!r||!t||!o||!pt())return;let{subtle:a}=window.crypto,s=yield a.decrypt({name:Ft,iv:r},o,cn(t));return ln(s)})}function et(e,t){return t?new URL(e,t):new URL(e)}var ea=class extends Me{constructor(){super(...arguments),this.localForageKey="mc_active_wallet",this.localForageIsLoggedInKey="magic_auth_is_logged_in",this.userLoggedOutCallbacks=[]}getIdToken(e){let t=W(this.sdk.testMode?M.GetIdTokenTestMode:M.GetIdToken,[e]);return this.request(t)}generateIdToken(e){let t=W(this.sdk.testMode?M.GenerateIdTokenTestMode:M.GenerateIdToken,[e]);return this.request(t)}getInfo(){return X(this,null,function*(){let e=yield se(this.localForageKey),t=W(M.GetInfo,[{walletType:e}]);return this.request(t)})}isLoggedIn(){return Ze((e,t)=>X(this,null,function*(){try{let r=!1;this.sdk.useStorageCache&&(r=(yield se(this.localForageIsLoggedInKey))==="true",r&&e(!0));let o=W(this.sdk.testMode?M.IsLoggedInTestMode:M.IsLoggedIn),a=yield this.request(o);this.sdk.useStorageCache&&(a?me(this.localForageIsLoggedInKey,!0):ke(this.localForageIsLoggedInKey),r&&!a&&this.emitUserLoggedOut(!0)),e(a)}catch(r){t(r)}}))}logout(){return ke(this.localForageKey),ke(this.localForageIsLoggedInKey),Wt(),Ze((e,t)=>X(this,null,function*(){try{let r=W(this.sdk.testMode?M.LogoutTestMode:M.Logout),o=yield this.request(r);this.sdk.useStorageCache&&this.emitUserLoggedOut(o),e(o)}catch(r){t(r)}}))}requestInfoWithUI(e){let t=W(M.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}showSettings(e){let t=W(this.sdk.testMode?M.UserSettingsTestMode:M.UserSettings,[e]);return this.request(t)}recoverAccount(e){let t=W(this.sdk.testMode?M.RecoverAccountTestMode:M.RecoverAccount,[e]);return this.request(t)}revealPrivateKey(){let e=W(M.RevealPK);return this.request(e)}getMetadata(){ze({method:"user.getMetadata()",removalVersions:Je,useInstead:"user.getInfo()"}).log();let e=W(this.sdk.testMode?M.GetMetadataTestMode:M.GetMetadata);return this.request(e)}onUserLoggedOut(e){this.userLoggedOutCallbacks.push(e)}emitUserLoggedOut(e){this.userLoggedOutCallbacks.forEach(t=>{t(e)})}},ta=class extends Me{constructor(){super(...arguments),this.localForageKey="mc_active_wallet"}connectWithUI(){let e=Ze((t,r)=>X(this,null,function*(){try{if(this.isMetaMaskBrowser()&&(yield this.isWalletEnabled(ue.MetaMask))){let h=yield this.autoConnectIfWalletBrowser(ue.MetaMask);t(h);return}if(this.isCoinbaseWalletBrowser()&&(yield this.isWalletEnabled(ue.CoinbaseWallet))){let h=yield this.autoConnectIfWalletBrowser(ue.CoinbaseWallet);t(h);return}let o=this.getUserEnv(),a=W(M.Login,[o]),s=this.request(a);s.on(De.WalletSelected,h=>this.handleWalletSelected(Lt(Mt({},h),{payloadId:a.id}))),s.on("id-token-created",h=>{e.emit("id-token-created",h)});let m=yield s;m.error&&r(m),t(m)}catch(o){r(o)}}));return e}showUI(){return this.request(W(M.ShowUI))}showAddress(){return this.request(W(M.ShowAddress))}showSendTokensUI(){return this.request(W(M.ShowSendTokensUI))}showOnRamp(){return this.request(W(M.ShowOnRamp))}showNFTs(){return this.request(W(M.ShowNFTs))}showBalances(){return this.request(W(M.ShowBalances))}sendGaslessTransaction(e,t){return this.request(W(M.SendGaslessTransaction,[e,t]))}getInfo(){return X(this,null,function*(){ze({method:"wallet.getInfo()",removalVersions:Je,useInstead:"user.getInfo()"}).log();let e=yield se(this.localForageKey),t=W(M.GetInfo,[{walletType:e}]);return this.request(t)})}disconnect(){ze({method:"wallet.disconnect()",removalVersions:Je,useInstead:"user.logout()"}).log(),ke(this.localForageKey),Wt();let e=W(M.Disconnect);return this.request(e)}requestUserInfoWithUI(e){ze({method:"wallet.requestUserInfoWithUI()",removalVersions:Je,useInstead:"user.requestUserInfoWithUI()"}).log();let t=W(M.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}getProvider(){return X(this,null,function*(){switch(yield se(this.localForageKey)){case ue.MetaMask:return this.getMetaMaskProvider();case ue.CoinbaseWallet:return this.getCoinbaseProvider();default:return this.sdk.rpcProvider}})}isMetaMaskInstalled(){var e,t,r;return((e=window.ethereum)==null?void 0:e.isMetaMask)||!!((r=(t=window.ethereum)==null?void 0:t.providers)!=null&&r.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(r=>r==null?void 0:r.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,r;return((e=window.ethereum)==null?void 0:e.isCoinbaseWallet)||!!((r=(t=window.ethereum)==null?void 0:t.providers)!=null&&r.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(r=>r==null?void 0:r.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 ue.MetaMask:return this.connectToMetaMask();case ue.CoinbaseWallet:return this.connectToCoinbaseWallet();default:throw new Error(`Invalid provider: ${e}. Must be one of "metamask" or "coinbase_wallet".`)}}isWalletEnabled(e){let t=W("mc_is_wallet_enabled",[{wallet:e}]);return this.request(t)}handleWalletSelected(e){return X(this,null,function*(){try{let t=yield this.connectToThirdPartyWallet(e.wallet);yield me(this.localForageKey,e.wallet),this.createIntermediaryEvent(De.WalletConnected,e.payloadId)(t)}catch(t){console.error(t),this.createIntermediaryEvent(De.WalletRejected,e.payloadId)()}})}autoConnectIfWalletBrowser(e){return X(this,null,function*(){let t;e===ue.MetaMask&&(t=yield this.getMetaMaskProvider().request({method:"eth_requestAccounts"})),e===ue.CoinbaseWallet&&(t=yield this.getCoinbaseProvider().request({method:"eth_requestAccounts"})),yield me(this.localForageKey,e);let r=W(M.AutoConnect,[{wallet:e,address:t}]);return this.request(r)})}},{createBoundEmitterMethod:lt,createChainingEmitterMethod:xe}=Zr(),ra=class extends Me{constructor(){super(...arguments),this.isMagic=!0,this.on=xe("on",this),this.once=xe("once",this),this.addListener=xe("addListener",this),this.off=xe("off",this),this.removeListener=xe("removeListener",this),this.removeAllListeners=xe("removeAllListeners",this),this.emit=lt("emit"),this.eventNames=lt("eventNames"),this.listeners=lt("listeners"),this.listenerCount=lt("listenerCount")}sendAsync(e,t){if(!t)throw So({procedure:"Magic.rpcProvider.sendAsync",argument:1,expected:"function",received:t===null?"null":typeof t});if(Array.isArray(e))this.overlay.post(Se.MAGIC_HANDLE_REQUEST,e.map(r=>{let o=dt(r);return this.prefixPayloadMethodForTestMode(o),o})).then(r=>{t(null,r.map(o=>Lt(Mt({},o.payload),{error:o.hasError?new Fe(o.payload.error):null})))});else{let r=dt(e);this.prefixPayloadMethodForTestMode(r),this.overlay.post(Se.MAGIC_HANDLE_REQUEST,r).then(o=>{t(o.hasError?new Fe(o.payload.error):null,o.payload)})}}send(e,t){if(typeof e=="string"){let o=W(e,Array.isArray(t)?t:[]);return this.request(o)}if(Array.isArray(e)||!!t){this.sendAsync(e,t);return}let r=No();return r.log(),new $t(e).applyError({code:-32603,message:r.rawMessage}).payload}enable(){let e=W(M.Login);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}`)}},Gr=["request","overlay","sdk"];function na(e){let t=Object.getPrototypeOf(e),r=[t];for(;t!==Me.prototype;)t=Object.getPrototypeOf(t),r.push(t);return r}var un=class extends Me{constructor(){super(void 0),this.__sdk_access_field_descriptors__=new Map,this.__is_initialized__=!1,this.utils={createPromiEvent:Ze,isPromiEvent:Dt,encodeJSON:qr,decodeJSON:go,createJsonRpcRequestPayload:W,standardizeJsonRpcRequestPayload:dt,storage:rn};let e=[this,...na(this)];Gr.forEach(t=>{let r=e.map(m=>Object.getOwnPropertyDescriptor(m,t)),o=r.findIndex(m=>!!m),a=o>0,s=r[o];s&&(this.__sdk_access_field_descriptors__.set(t,{descriptor:s,isPrototypeField:a}),Object.defineProperty(this,t,{configurable:!0,get:()=>{throw Ro(t)}}))})}init(e){this.__is_initialized__||(Gr.forEach(t=>{if(this.__sdk_access_field_descriptors__.has(t)){let{descriptor:r,isPrototypeField:o}=this.__sdk_access_field_descriptors__.get(t);o?delete this[t]:Object.defineProperty(this,t,r)}}),this.sdk=e,this.__is_initialized__=!0)}createDeprecationWarning(e){let{method:t,removalVersion:r,useInstead:o}=e,a=o?` Use \`${o}\` instead.`:"",s=`\`${t}\` will be removed from this Extension in version \`${r}\`.${a}`;return new ft(this,"DEPRECATION_NOTICE",s)}createWarning(e,t){return new ft(this,e,t)}createError(e,t,r){return new mt(this,e,t,r)}},ia=class extends un{},Te=class extends un{};Te.Internal=ia,Te.Anonymous="anonymous extension";var oa=class extends Me{purchase(e){let t=W(M.NFTPurchase,[e]);return this.request(t)}checkout(e){let t=W(M.NFTCheckout,[e]);return this.request(t)}transfer(e){let t=W(M.NFTTransfer,[e]);return this.request(t)}};function jr(e){return e.compat&&e.compat[Y.sdkName]!=null?typeof e.compat[Y.sdkName]=="string"?so(fo(Y.version),e.compat[Y.sdkName]):!!e.compat[Y.sdkName]:!0}function aa(e,t,r){return!t&&!r?`${e}_eth_mainnet`:r?`${e}_${JSON.stringify(r)}`:t?typeof t=="string"?`${e}_eth_${t}`:`${e}_${t.rpcUrl}_${t.chainId}_${t.chainType}`:`${e}_unknown`}function sa(e){var t;let r=(t=e==null?void 0:e.extensions)!=null?t:[],o={},a=[];if(Array.isArray(r)?r.forEach(s=>{jr(s)?(s.init(this),(s.name||s.name!==Te.Anonymous)&&(this[s.name]=s),s instanceof Te.Internal&&(ut(s.config)||(o[s.name]=s.config))):a.push(s)}):Object.keys(r).forEach(s=>{if(jr(r[s])){r[s].init(this);let m=r[s];this[s]=m,m instanceof Te.Internal&&(ut(m.config)||(o[r[s].name]=m.config))}else a.push(r[s])}),a.length)throw Ao(a);return o}var ct=class{constructor(e,t){this.apiKey=e;var r;if(!e)throw wo();Y.platform==="react-native"&&(t==null?void 0:t.endpoint)&&To().log();let{defaultEndpoint:o,version:a}=Y;this.testMode=!!(t!=null&&t.testMode),this.useStorageCache=!!(t!=null&&t.useStorageCache),this.endpoint=et((r=t==null?void 0:t.endpoint)!=null?r:o).origin,this.auth=new Do(this),this.user=new ea(this),this.wallet=new ta(this),this.nft=new oa(this),this.rpcProvider=new ra(this);let s=sa.call(this,t);this.parameters=qr(Lt(Mt({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:t==null?void 0:t.network,host:et(this.endpoint).host,sdk:Io[Y.sdkName],version:a,ext:ut(s)?void 0:s,locale:(t==null?void 0:t.locale)||"en_US"},Y.bundleId?{bundleId:Y.bundleId}:{}),{meta:t==null?void 0:t.meta})),this.networkHash=aa(this.apiKey,t==null?void 0:t.network,ut(s)?void 0:s),t!=null&&t.deferPreload||this.preload()}get overlay(){if(!ct.__overlays__.has(this.parameters)){let e=new Y.ViewController(this.endpoint,this.parameters,this.networkHash);e.init(),ct.__overlays__.set(this.parameters,e)}return ct.__overlays__.get(this.parameters)}preload(){return X(this,null,function*(){yield this.overlay.checkIsReadyForRequest})}},Bt=ct;Bt.__overlays__=new Map;function la(e,t){return t&&Array.isArray(e)?e.find(r=>r.id===t):e}function ca(e,t){var r;let o=(r=t.data.response)==null?void 0:r.id,a=la(e,o);if(o&&a){let s=new $t(a).applyResult(t.data.response.result).applyError(t.data.response.error);return{id:o,response:s}}return{}}function ua(e,t,r){return X(this,null,function*(){var o;let a=yield se("rt"),s;if(Y.platform==="web")try{s=(o=yield se("jwt"))!=null?o:yield jo()}catch(g){console.error("webcrypto error",g)}let m={msgType:e,payload:t};s&&(m.jwt=s),s&&a&&(m.rt=a);let h=yield Zo(r);return h&&(m.deviceShare=h),m})}function fa(e){return X(this,null,function*(){!e.data.rt||(yield me("rt",e.data.rt))})}var fn=class{constructor(e,t,r){this.endpoint=e,this.parameters=t,this.networkHash=r,this.messageHandlers=new Set,this.isConnectedToInternet=!0,this.checkIsReadyForRequest=this.waitForReady(),this.isReadyForRequest=!1,this.listen()}post(e,t){return X(this,null,function*(){return tn((r,o)=>X(this,null,function*(){if(!this.isConnectedToInternet){let v=Pt();o(v)}this.isReadyForRequest||(yield this.waitForReady());let a=[],s=Array.isArray(t)?t.map(v=>v.id):[],m=yield ua(`${e}-${this.parameters}`,t,this.networkHash);yield this._post(m);let h=v=>y=>{var T;let{id:_,response:N}=ca(t,y);if(fa(y),((T=N==null?void 0:N.payload.error)==null?void 0:T.message)==="User denied account access.")Wt();else if(y.data.deviceShare){let{deviceShare:L}=y.data;Qo(L,this.networkHash)}_&&N&&Array.isArray(t)&&s.includes(_)?(a.push(N),a.length===t.length&&(v(),r(a))):_&&N&&!Array.isArray(t)&&_===t.id&&(v(),r(N))},g=this.on(he.MAGIC_HANDLE_RESPONSE,h(()=>g()))}))})}on(e,t){let r=t.bind(window),o=a=>{a.data.msgType===`${e}-${this.parameters}`&&r(a)};return this.messageHandlers.add(o),()=>this.messageHandlers.delete(o)}waitForReady(){return new Promise(e=>{let t=this.on(he.MAGIC_OVERLAY_READY,()=>{this.isReadyForRequest=!0,e(),t()})})}listen(){this.on(he.MAGIC_HIDE_OVERLAY,()=>{this.hideOverlay()}),this.on(he.MAGIC_SHOW_OVERLAY,()=>{this.showOverlay()}),this.on(he.MAGIC_SEND_PRODUCT_ANNOUNCEMENT,e=>{e.data.response.result.product_announcement&&new Oe(ve.ProductAnnouncement,e.data.response.result.product_announcement).log()})}};var Gt={};pr(Gt,{AuthEventOnReceived:()=>Ar,DeepLinkPage:()=>yr,DeviceVerificationEventEmit:()=>qe,DeviceVerificationEventOnReceived:()=>wr,EthChainType:()=>Sr,Events:()=>De,Extension:()=>Te,ExtensionError:()=>mt,ExtensionWarning:()=>ft,LoginWithEmailOTPEventEmit:()=>Ne,LoginWithEmailOTPEventOnReceived:()=>Ir,LoginWithMagicLinkEventEmit:()=>Er,LoginWithMagicLinkEventOnReceived:()=>_r,MagicIncomingWindowMessage:()=>he,MagicOutgoingWindowMessage:()=>Se,MagicPayloadMethod:()=>M,NftCheckoutIntermediaryEvents:()=>Tr,RPCError:()=>Fe,RPCErrorCode:()=>$e,RecencyCheckEventEmit:()=>ge,RecencyCheckEventOnReceived:()=>br,RecoveryMethodType:()=>Nr,SDKError:()=>Ee,SDKErrorCode:()=>pe,SDKWarning:()=>Oe,SDKWarningCode:()=>ve,UpdateEmailEventEmit:()=>ye,UpdateEmailEventOnReceived:()=>Rr,WalletEventOnReceived:()=>Or,Wallets:()=>ue,isPromiEvent:()=>Dt});var yt=gr(hn()),Vt=gr(pn());var da={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};function ha(e){for(let[t,r]of Object.entries(da))e.style[t]=r}function ma(e){let t=[].slice.call(document.querySelectorAll(".magic-iframe"));return Boolean(t.find(r=>r.src.includes(e)))}var gt=class extends fn{constructor(){super(...arguments);this.activeElement=null}init(){this.test="hello",this.iframe=new Promise(r=>{let o=()=>{if(ma(encodeURIComponent(this.parameters)))Xr().log();else{let a=document.createElement("iframe");a.classList.add("magic-iframe"),a.dataset.magicIframeLabel=et(this.endpoint).host,a.title="Secure Modal",a.src=et(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href,a.allow="clipboard-read; clipboard-write",ha(a),document.body.appendChild(a),r(a)}};["loaded","interactive","complete"].includes(document.readyState)?o():window.addEventListener("load",o,!1)}),window.addEventListener("message",r=>{var o;if(r.origin===this.endpoint&&r.data&&r.data.msgType&&this.messageHandlers.size){r.data.response=(o=r.data.response)!=null?o:{};for(let a of this.messageHandlers.values())a(r)}})}showOverlay(){return Pe(this,null,function*(){let r=yield this.iframe;r.style.display="block",this.activeElement=document.activeElement,r.focus()})}hideOverlay(){return Pe(this,null,function*(){var o;let r=yield this.iframe;r.style.display="none",(o=this.activeElement)!=null&&o.focus&&this.activeElement.focus(),this.activeElement=null})}_post(r){return Pe(this,null,function*(){let o=yield this.iframe;if(o&&o.contentWindow)o.contentWindow.postMessage(r,this.endpoint);else throw Pt()})}};var pa=Object.assign(Yr(Bt,{platform:"web",sdkName:"magic-sdk",version:"28.0.6",defaultEndpoint:"https://auth.magic.link/",ViewController:gt,configureStorage:()=>Pe(void 0,null,function*(){let e=yt.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return yield e.defineDriver(Vt),yield e.setDriver([yt.default.INDEXEDDB,yt.default.LOCALSTORAGE,Vt._driver]),e})}),hr({},Gt)),va=pa;return pi(ga);})();
11
+ Received: \`${e.received}\``)}function Ms(){return new St(Ve.DuplicateIframe,"Duplicate iframes found.")}function Td(){return new St(Ve.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 Rd(){return new St(Ve.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 \`${te.defaultEndpoint}\`. Changing this default behavior will lead to unexpected results and potentially security-threatening bugs.`)}function Rr(e){let{method:t,removalVersions:r,useInstead:n}=e,o=r[te.sdkName],i=n?` Use \`${n}\` instead.`:"",a=`\`${t}\` will be removed from \`${te.sdkName}\` in version \`${o}\`.${i}`;return new St(Ve.DeprecationNotice,a)}function*Od(){let e=0;for(;;)e<Number.MAX_SAFE_INTEGER?yield++e:e=0}var Cd=Od();function ks(){return Cd.next().value}var Ps=Symbol("Payload pre-processed by Magic SDK");function Ds(e){return Object.defineProperty(e,Ps,{value:!0,enumerable:!1}),e}function Ad(e){return!!e[Ps]}function Rn(e){var t,r,n;return Ad(e)||(e.jsonrpc=(t=e.jsonrpc)!=null?t:"2.0",e.id=ks(),e.method=(r=e.method)!=null?r:"noop",e.params=(n=e.params)!=null?n:[],Ds(e)),e}function H(e,t=[]){return Ds({params:t,method:e,jsonrpc:"2.0",id:ks()})}var Wo=class{constructor(e){e instanceof Wo?(this._jsonrpc=e.payload.jsonrpc,this._id=e.payload.id,this._result=e.payload.result,this._error=e.payload.error):yd(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}}},Ld=Tf(Rf()),Nd=class extends Ld.default{};function Us(){let e=new Nd;return{emitter:e,createChainingEmitterMethod:(t,r)=>(...n)=>(e[t].apply(e,n),r),createBoundEmitterMethod:t=>(...r)=>e[t].apply(e,r)}}var Bs=Symbol("isPromiEvent");function Ho(e){return!!e[Bs]}function Ar(e){let t=$s(e),{createBoundEmitterMethod:r,createChainingEmitterMethod:n}=Us(),o=Symbol("Promise.then"),i=Symbol("Promise.catch"),a=Symbol("Promise.finally"),c=(p,g)=>(...y)=>{let I=g[p].apply(g,y);return f(I)},f=p=>Object.assign(p,{[Bs]:!0,[o]:p[o]||p.then,[i]:p[i]||p.catch,[a]:p[a]||p.finally,then:c(o,p),catch:c(i,p),finally:c(a,p),on:n("on",p),once:n("once",p),addListener:n("addListener",p),off:n("off",p),removeListener:n("removeListener",p),removeAllListeners:n("removeAllListeners",p),emit:r("emit"),eventNames:r("eventNames"),listeners:r("listeners"),listenerCount:r("listenerCount")}),l=f(t.then(p=>(l.emit("done",p),l.emit("settled"),p),p=>{throw l.emit("error",p),l.emit("settled"),p}));return l}function $s(e){return new Promise((t,r)=>{let n=e(t,r);Promise.resolve(n).catch(r)})}var _t=class{constructor(e){this.sdk=e}get overlay(){return this.sdk.overlay}request(e){let t=this.overlay.post(pt.MAGIC_HANDLE_REQUEST,Rn(e)),r=Ar((o,i)=>{t.then(a=>{if(n(),a.hasError)i(new Qt(a.payload.error));else if(a.hasResult)o(a.payload.result);else throw _d()}).catch(a=>{n(),i(a)})}),n=this.overlay.on(Fe.MAGIC_HANDLE_EVENT,o=>{var i;let{response:a}=o.data;if(a.id===e.id&&((i=a.result)==null?void 0:i.event)){let{event:c,params:f=[]}=a.result;r.emit(c,...f)}});return r}createIntermediaryEvent(e,t){return r=>{let n=H(k.IntermediaryEvent,[{payloadId:t,eventType:e,args:r}]);this.request(n)}}};function Md(e,t){let[r]=e.split(".").map(Number);return r>=t}var Or={"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"},kd=class extends _t{loginWithMagicLink(e){let t=te.sdkName==="@magic-sdk/react-native"||te.sdkName==="@magic-sdk/react-native-bare"||te.sdkName==="@magic-sdk/react-native-expo";if(t&&Md(te.version,19))throw new Error("loginWithMagicLink() is deprecated for this package, please utlize a passcode method like loginWithSMS or loginWithEmailOTP instead.");t&&Rr({method:"auth.loginWithMagicLink()",removalVersions:Or,useInstead:"auth.loginWithEmailOTP()"}).log();let{email:r,showUI:n=!0,redirectURI:o,overrides:i}=e,a=H(this.sdk.testMode?k.LoginWithMagicLinkTestMode:k.LoginWithMagicLink,[{email:r,showUI:n,redirectURI:o,overrides:i}]);return this.request(a)}loginWithSMS(e){let{phoneNumber:t}=e,r=H(this.sdk.testMode?k.LoginWithSmsTestMode:k.LoginWithSms,[{phoneNumber:t,showUI:!0}]);return this.request(r)}loginWithEmailOTP(e){let{email:t,showUI:r,deviceCheckUI:n,overrides:o}=e,i=H(this.sdk.testMode?k.LoginWithEmailOTPTestMode:k.LoginWithEmailOTP,[{email:t,showUI:r,deviceCheckUI:n,overrides:o}]),a=this.request(i);return!n&&a&&a.on(ar.Retry,()=>{this.createIntermediaryEvent(ar.Retry,i.id)()}),!r&&a&&(a.on(mt.VerifyEmailOtp,c=>{this.createIntermediaryEvent(mt.VerifyEmailOtp,i.id)(c)}),a.on(mt.Cancel,()=>{this.createIntermediaryEvent(mt.Cancel,i.id)()})),a}loginWithCredential(e){let t=e!=null?e:"";if(!e&&te.platform==="web"){t=window.location.search;let n=window.location.origin+window.location.pathname;window.history.replaceState(null,"",n)}let r=H(this.sdk.testMode?k.LoginWithCredentialTestMode:k.LoginWithCredential,[t]);return this.request(r)}setAuthorizationToken(e){let t=H(k.SetAuthorizationToken,[{jwt:e}]);return this.request(t)}updateEmailWithUI(e){let{email:t,showUI:r=!0}=e,n=H(this.sdk.testMode?k.UpdateEmailTestMode:k.UpdateEmail,[{email:t,showUI:r}]),o=this.request(n);return r||(o.on(ze.Retry,()=>{this.createIntermediaryEvent(ze.Retry,n.id)()}),o.on(ze.Cancel,()=>{this.createIntermediaryEvent(ze.Cancel,n.id)()}),o.on(ze.VerifyEmailOtp,i=>{this.createIntermediaryEvent(ze.VerifyEmailOtp,n.id)(i)}),o.on(Xe.RetryWithNewEmail,i=>{this.createIntermediaryEvent(Xe.RetryWithNewEmail,n.id)(i)}),o.on(Xe.Cancel,()=>{this.createIntermediaryEvent(Xe.Cancel,n.id)()}),o.on(Xe.VerifyEmailOtp,i=>{this.createIntermediaryEvent(Xe.VerifyEmailOtp,n.id)(i)})),o}},Fs={};wf(Fs,{clear:()=>Pd,getItem:()=>ge,iterate:()=>Gs,key:()=>Ud,keys:()=>Bd,length:()=>Dd,removeItem:()=>Zt,setItem:()=>Ye});var Jt=(e,t={})=>{Ir.logger.log(e,{data:t})},_n;function lt(e){return(...t)=>ne(this,null,function*(){return Jt("proxyLocalForageMethod starting"),_n||(_n=yield te.configureStorage()),Jt("proxyLocalForageMethod waiting for ready"),yield _n.ready(),Jt("proxyLocalForageMethod is ready!!!"),_n[e](...t)})}var ge=lt("getItem"),Ye=lt("setItem"),Zt=lt("removeItem"),Pd=lt("clear"),Dd=lt("length"),Ud=lt("key"),Bd=lt("keys"),Gs=lt("iterate");function $d(){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 js="STORE_KEY_PRIVATE_KEY",Bo="STORE_KEY_PUBLIC_JWK",Ws="ECDSA",Fd="P-256",Gd={name:Ws,namedCurve:Fd};function An(){let e=typeof window!="undefined"&&!!window.crypto,t=e&&!!window.crypto.subtle;return e&&t}function jd(){return ne(this,null,function*(){let e=yield Wd();if(!e){console.info("unable to create public key or webcrypto is unsupported");return}let{subtle:t}=window.crypto,r=yield ge(js);if(!r||!t){console.info("unable to find private key or webcrypto unsupported");return}let n={iat:Math.floor(new Date().getTime()/1e3),jti:$d()},o={typ:"dpop+jwt",alg:"ES256",jwk:e},i={protected:xs(JSON.stringify(o)),claims:xs(JSON.stringify(n))},a=Kd(`${i.protected}.${i.claims}`),c={name:Ws,hash:{name:"SHA-256"}},f=qd(new Uint8Array(yield t.sign(c,r,a)));return`${i.protected}.${i.claims}.${f}`})}function Wd(){return ne(this,null,function*(){if(!An()){console.info("webcrypto is not supported");return}return(yield ge(Bo))||(yield Hd()),ge(Bo)})}function Hd(){return ne(this,null,function*(){let{subtle:e}=window.crypto,t=yield e.generateKey(Gd,!1,["sign"]),r=yield e.exportKey("jwk",t.publicKey);yield Ye(js,t.privateKey),yield Ye(Bo,r)})}function xs(e){return Hs(Yd(e))}function Kd(e){return new TextEncoder().encode(e)}function Hs(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+/g,"")}function Yd(e){return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(t,r)=>String.fromCharCode(parseInt(r,16)))}function qd(e){let t="";return e.forEach(r=>{t+=String.fromCharCode(r)}),Hs(t)}var Ko="ds",Yo="ek",qo="iv",Vo="AES-GCM",Vd=256;function zo(){return ne(this,null,function*(){let e=[];yield Gs((t,r,n)=>{r.startsWith(`${Ko}_`)&&e.push(r)});for(let t of e)yield Zt(t)})}function Ks(e){let t="",r=new Uint8Array(e),n=r.byteLength;for(let o=0;o<n;o++)t+=String.fromCharCode(r[o]);return window.btoa(t)}function Ys(e){let t=window.atob(e),r=t.length,n=new Uint8Array(r);for(let o=0;o<r;o++)n[o]=t.charCodeAt(o);return n.buffer}function zd(){return ne(this,null,function*(){if(!An()){console.info("webcrypto is not supported");return}let{crypto:e}=window;return(yield ge(qo))||e.getRandomValues(new Uint8Array(12))})}function Xd(){return ne(this,null,function*(){if(!An()){console.info("webcrypto is not supported");return}let{subtle:e}=window.crypto;return(yield ge(Yo))||(yield e.generateKey({name:Vo,length:Vd},!1,["encrypt","decrypt"]))})}function Jd(e,t){return ne(this,null,function*(){let r=yield zd(),n=yield Xd();if(!r||!n||!e)return;let o=Ys(e),{subtle:i}=window.crypto,a=yield i.encrypt({name:Vo,iv:r},n,o),c=Ks(a);yield Ye(`${Ko}_${t}`,c),yield Ye(Yo,n),yield Ye(qo,r)})}function Zd(e){return ne(this,null,function*(){let t=yield ge(`${Ko}_${e}`),r=yield ge(qo),n=yield ge(Yo);if(!r||!t||!n||!An())return;let{subtle:o}=window.crypto,i=yield o.decrypt({name:Vo,iv:r},n,Ys(t));return Ks(i)})}function Lr(e,t){return t?new URL(e,t):new URL(e)}var Qd=class extends _t{constructor(){super(...arguments),this.localForageKey="mc_active_wallet",this.localForageIsLoggedInKey="magic_auth_is_logged_in",this.userLoggedOutCallbacks=[]}getIdToken(e){let t=H(this.sdk.testMode?k.GetIdTokenTestMode:k.GetIdToken,[e]);return this.request(t)}generateIdToken(e){let t=H(this.sdk.testMode?k.GenerateIdTokenTestMode:k.GenerateIdToken,[e]);return this.request(t)}getInfo(){return ne(this,null,function*(){let e=yield ge(this.localForageKey),t=H(k.GetInfo,[{walletType:e}]);return this.request(t)})}isLoggedIn(){return Ar((e,t)=>ne(this,null,function*(){try{let r=!1;this.sdk.useStorageCache&&(r=(yield ge(this.localForageIsLoggedInKey))==="true",r&&e(!0));let n=H(this.sdk.testMode?k.IsLoggedInTestMode:k.IsLoggedIn),o=yield this.request(n);this.sdk.useStorageCache&&(o?Ye(this.localForageIsLoggedInKey,!0):Zt(this.localForageIsLoggedInKey),r&&!o&&this.emitUserLoggedOut(!0)),e(o)}catch(r){t(r)}}))}logout(){return Zt(this.localForageKey),Zt(this.localForageIsLoggedInKey),zo(),Ar((e,t)=>ne(this,null,function*(){try{let r=H(this.sdk.testMode?k.LogoutTestMode:k.Logout),n=yield this.request(r);this.sdk.useStorageCache&&this.emitUserLoggedOut(n),e(n)}catch(r){t(r)}}))}requestInfoWithUI(e){let t=H(k.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}showSettings(e){let t=H(this.sdk.testMode?k.UserSettingsTestMode:k.UserSettings,[e]);return this.request(t)}recoverAccount(e){let t=H(this.sdk.testMode?k.RecoverAccountTestMode:k.RecoverAccount,[e]);return this.request(t)}revealPrivateKey(){let e=H(k.RevealPK);return this.request(e)}getMetadata(){Rr({method:"user.getMetadata()",removalVersions:Or,useInstead:"user.getInfo()"}).log();let e=H(this.sdk.testMode?k.GetMetadataTestMode:k.GetMetadata);return this.request(e)}onUserLoggedOut(e){this.userLoggedOutCallbacks.push(e)}emitUserLoggedOut(e){this.userLoggedOutCallbacks.forEach(t=>{t(e)})}},ep=class extends _t{constructor(){super(...arguments),this.localForageKey="mc_active_wallet"}connectWithUI(){let e=Ar((t,r)=>ne(this,null,function*(){try{if(this.isMetaMaskBrowser()&&(yield this.isWalletEnabled(_e.MetaMask))){let c=yield this.autoConnectIfWalletBrowser(_e.MetaMask);t(c);return}if(this.isCoinbaseWalletBrowser()&&(yield this.isWalletEnabled(_e.CoinbaseWallet))){let c=yield this.autoConnectIfWalletBrowser(_e.CoinbaseWallet);t(c);return}let n=this.getUserEnv(),o=H(k.Login,[n]),i=this.request(o);i.on(Rt.WalletSelected,c=>this.handleWalletSelected(Fo($o({},c),{payloadId:o.id}))),i.on("id-token-created",c=>{e.emit("id-token-created",c)});let a=yield i;a.error&&r(a),t(a)}catch(n){r(n)}}));return e}showUI(){return this.request(H(k.ShowUI))}showAddress(){return this.request(H(k.ShowAddress))}showSendTokensUI(){return this.request(H(k.ShowSendTokensUI))}showOnRamp(){return this.request(H(k.ShowOnRamp))}showNFTs(){return this.request(H(k.ShowNFTs))}showBalances(){return this.request(H(k.ShowBalances))}sendGaslessTransaction(e,t){return this.request(H(k.SendGaslessTransaction,[e,t]))}getInfo(){return ne(this,null,function*(){Rr({method:"wallet.getInfo()",removalVersions:Or,useInstead:"user.getInfo()"}).log();let e=yield ge(this.localForageKey),t=H(k.GetInfo,[{walletType:e}]);return this.request(t)})}disconnect(){Rr({method:"wallet.disconnect()",removalVersions:Or,useInstead:"user.logout()"}).log(),Zt(this.localForageKey),zo();let e=H(k.Disconnect);return this.request(e)}requestUserInfoWithUI(e){Rr({method:"wallet.requestUserInfoWithUI()",removalVersions:Or,useInstead:"user.requestUserInfoWithUI()"}).log();let t=H(k.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}getProvider(){return ne(this,null,function*(){switch(yield ge(this.localForageKey)){case _e.MetaMask:return this.getMetaMaskProvider();case _e.CoinbaseWallet:return this.getCoinbaseProvider();default:return this.sdk.rpcProvider}})}isMetaMaskInstalled(){var e,t,r;return((e=window.ethereum)==null?void 0:e.isMetaMask)||!!((r=(t=window.ethereum)==null?void 0:t.providers)!=null&&r.find(n=>n==null?void 0:n.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(r=>r==null?void 0:r.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,r;return((e=window.ethereum)==null?void 0:e.isCoinbaseWallet)||!!((r=(t=window.ethereum)==null?void 0:t.providers)!=null&&r.find(n=>n==null?void 0:n.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(r=>r==null?void 0:r.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 _e.MetaMask:return this.connectToMetaMask();case _e.CoinbaseWallet:return this.connectToCoinbaseWallet();default:throw new Error(`Invalid provider: ${e}. Must be one of "metamask" or "coinbase_wallet".`)}}isWalletEnabled(e){let t=H("mc_is_wallet_enabled",[{wallet:e}]);return this.request(t)}handleWalletSelected(e){return ne(this,null,function*(){try{let t=yield this.connectToThirdPartyWallet(e.wallet);yield Ye(this.localForageKey,e.wallet),this.createIntermediaryEvent(Rt.WalletConnected,e.payloadId)(t)}catch(t){console.error(t),this.createIntermediaryEvent(Rt.WalletRejected,e.payloadId)()}})}autoConnectIfWalletBrowser(e){return ne(this,null,function*(){let t;e===_e.MetaMask&&(t=yield this.getMetaMaskProvider().request({method:"eth_requestAccounts"})),e===_e.CoinbaseWallet&&(t=yield this.getCoinbaseProvider().request({method:"eth_requestAccounts"})),yield Ye(this.localForageKey,e);let r=H(k.AutoConnect,[{wallet:e,address:t}]);return this.request(r)})}},{createBoundEmitterMethod:In,createChainingEmitterMethod:zt}=Us(),tp=class extends _t{constructor(){super(...arguments),this.isMagic=!0,this.on=zt("on",this),this.once=zt("once",this),this.addListener=zt("addListener",this),this.off=zt("off",this),this.removeListener=zt("removeListener",this),this.removeAllListeners=zt("removeAllListeners",this),this.emit=In("emit"),this.eventNames=In("eventNames"),this.listeners=In("listeners"),this.listenerCount=In("listenerCount")}sendAsync(e,t){if(!t)throw xd({procedure:"Magic.rpcProvider.sendAsync",argument:1,expected:"function",received:t===null?"null":typeof t});if(Array.isArray(e))this.overlay.post(pt.MAGIC_HANDLE_REQUEST,e.map(r=>{let n=Rn(r);return this.prefixPayloadMethodForTestMode(n),n})).then(r=>{t(null,r.map(n=>Fo($o({},n.payload),{error:n.hasError?new Qt(n.payload.error):null})))});else{let r=Rn(e);this.prefixPayloadMethodForTestMode(r),this.overlay.post(pt.MAGIC_HANDLE_REQUEST,r).then(n=>{t(n.hasError?new Qt(n.payload.error):null,n.payload)})}}send(e,t){if(typeof e=="string"){let n=H(e,Array.isArray(t)?t:[]);return this.request(n)}if(Array.isArray(e)||!!t){this.sendAsync(e,t);return}let r=Td();return r.log(),new Wo(e).applyError({code:-32603,message:r.rawMessage}).payload}enable(){let e=H(k.Login);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}`)}},Ts=["request","overlay","sdk"];function rp(e){let t=Object.getPrototypeOf(e),r=[t];for(;t!==_t.prototype;)t=Object.getPrototypeOf(t),r.push(t);return r}var qs=class extends _t{constructor(){super(void 0),this.__sdk_access_field_descriptors__=new Map,this.__is_initialized__=!1,this.utils={createPromiEvent:Ar,isPromiEvent:Ho,encodeJSON:As,decodeJSON:vd,createJsonRpcRequestPayload:H,standardizeJsonRpcRequestPayload:Rn,storage:Fs};let e=[this,...rp(this)];Ts.forEach(t=>{let r=e.map(a=>Object.getOwnPropertyDescriptor(a,t)),n=r.findIndex(a=>!!a),o=n>0,i=r[n];i&&(this.__sdk_access_field_descriptors__.set(t,{descriptor:i,isPrototypeField:o}),Object.defineProperty(this,t,{configurable:!0,get:()=>{throw Id(t)}}))})}init(e){this.__is_initialized__||(Ts.forEach(t=>{if(this.__sdk_access_field_descriptors__.has(t)){let{descriptor:r,isPrototypeField:n}=this.__sdk_access_field_descriptors__.get(t);n?delete this[t]:Object.defineProperty(this,t,r)}}),this.sdk=e,this.__is_initialized__=!0)}createDeprecationWarning(e){let{method:t,removalVersion:r,useInstead:n}=e,o=n?` Use \`${n}\` instead.`:"",i=`\`${t}\` will be removed from this Extension in version \`${r}\`.${o}`;return new Tn(this,"DEPRECATION_NOTICE",i)}createWarning(e,t){return new Tn(this,e,t)}createError(e,t,r){return new Cn(this,e,t,r)}},np=class extends qs{},bt=class extends qs{};bt.Internal=np,bt.Anonymous="anonymous extension";var op=class extends _t{purchase(e){let t=H(k.NFTPurchase,[e]);return this.request(t)}checkout(e){let t=H(k.NFTCheckout,[e]);return this.request(t)}transfer(e){let t=H(k.NFTTransfer,[e]);return this.request(t)}};function Rs(e){return e.compat&&e.compat[te.sdkName]!=null?typeof e.compat[te.sdkName]=="string"?sd(fd(te.version),e.compat[te.sdkName]):!!e.compat[te.sdkName]:!0}function ip(e,t,r){return!t&&!r?`${e}_eth_mainnet`:r?`${e}_${JSON.stringify(r)}`:t?typeof t=="string"?`${e}_eth_${t}`:`${e}_${t.rpcUrl}_${t.chainId}_${t.chainType}`:`${e}_unknown`}function ap(e){var t;let r=(t=e==null?void 0:e.extensions)!=null?t:[],n={},o=[];if(Array.isArray(r)?r.forEach(i=>{Rs(i)?(i.init(this),(i.name||i.name!==bt.Anonymous)&&(this[i.name]=i),i instanceof bt.Internal&&(xn(i.config)||(n[i.name]=i.config))):o.push(i)}):Object.keys(r).forEach(i=>{if(Rs(r[i])){r[i].init(this);let a=r[i];this[i]=a,a instanceof bt.Internal&&(xn(a.config)||(n[r[i].name]=a.config))}else o.push(r[i])}),o.length)throw wd(o);return n}var wn=class{constructor(e,t){this.apiKey=e;var r;if(!e)throw Sd();te.platform==="react-native"&&(t==null?void 0:t.endpoint)&&Rd().log();let{defaultEndpoint:n,version:o}=te;this.testMode=!!(t!=null&&t.testMode),this.useStorageCache=!!(t!=null&&t.useStorageCache),this.endpoint=Lr((r=t==null?void 0:t.endpoint)!=null?r:n).origin,this.externalLogger=t==null?void 0:t.externalLogger,this.auth=new kd(this),this.user=new Qd(this),this.wallet=new ep(this),this.nft=new op(this),this.rpcProvider=new tp(this);let i=ap.call(this,t);this.parameters=As(Fo($o({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:t==null?void 0:t.network,host:Lr(this.endpoint).host,sdk:bd[te.sdkName],version:o,ext:xn(i)?void 0:i,locale:(t==null?void 0:t.locale)||"en_US"},te.bundleId?{bundleId:te.bundleId}:{}),{meta:t==null?void 0:t.meta})),this.networkHash=ip(this.apiKey,t==null?void 0:t.network,xn(i)?void 0:i),t!=null&&t.deferPreload||this.preload()}get overlay(){if(!wn.__overlays__.has(this.parameters)){let e=new te.ViewController(this.endpoint,this.parameters,this.networkHash,this.externalLogger);e.init(),wn.__overlays__.set(this.parameters,e)}return wn.__overlays__.get(this.parameters)}preload(){return ne(this,null,function*(){yield this.overlay.checkIsReadyForRequest})}},Xo=wn;Xo.__overlays__=new Map;Ir.init({clientToken:"pubabac4d3c893a1ad69023911f42fce019",service:"movement"});function sp(e,t){return t&&Array.isArray(e)?e.find(r=>r.id===t):e}function up(e,t){var r;let n=(r=t.data.response)==null?void 0:r.id,o=sp(e,n);if(n&&o){let i=new Wo(o).applyResult(t.data.response.result).applyError(t.data.response.error);return{id:n,response:i}}return{}}function cp(e,t,r){return ne(this,null,function*(){var n;let o=yield ge("rt"),i;if(te.platform==="web")try{i=(n=yield ge("jwt"))!=null?n:yield jd()}catch(f){console.error("webcrypto error",f)}let a={msgType:e,payload:t};i&&(a.jwt=i),i&&o&&(a.rt=o);let c=yield Zd(r);return c&&(a.deviceShare=c),a})}function lp(e){return ne(this,null,function*(){!e.data.rt||(yield Ye("rt",e.data.rt))})}var Vs=class{constructor(e,t,r,n){this.endpoint=e,this.parameters=t,this.networkHash=r,this.externalLogger=n,this.messageHandlers=new Set,this.isConnectedToInternet=!0,this.checkIsReadyForRequest=this.waitForReady(),this.isReadyForRequest=!1,this.listen()}post(e,t){return ne(this,null,function*(){return $s((r,n)=>ne(this,null,function*(){var o,i;if(!this.isConnectedToInternet){let g=jo();n(g)}console.log("this.isReadyForRequest: ",this.isReadyForRequest),Jt("this.isReadyForRequest",{isReadyForRequest:this.isReadyForRequest}),this.isReadyForRequest||(console.log("waiting for ready"),Jt("waiting for ready",{msgType:e,payload:t}),(o=this.externalLogger)==null||o.log("waiting for ready",{msgType:e,payload:t}),yield this.waitForReady(),console.log("ready for requests"),Jt("ready for requests",{msgType:e,payload:t}),(i=this.externalLogger)==null||i.log("ready for requests",{msgType:e,payload:t}));let a=[],c=Array.isArray(t)?t.map(g=>g.id):[],f=yield cp(`${e}-${this.parameters}`,t,this.networkHash);yield this._post(f);let l=g=>y=>{var I;let{id:L,response:C}=up(t,y);if(lp(y),((I=C==null?void 0:C.payload.error)==null?void 0:I.message)==="User denied account access.")zo();else if(y.data.deviceShare){let{deviceShare:N}=y.data;Jd(N,this.networkHash)}L&&C&&Array.isArray(t)&&c.includes(L)?(a.push(C),a.length===t.length&&(g(),r(a))):L&&C&&!Array.isArray(t)&&L===t.id&&(g(),r(C))},p=this.on(Fe.MAGIC_HANDLE_RESPONSE,l(()=>p()))}))})}on(e,t){let r=t.bind(window),n=o=>{o.data.msgType===`${e}-${this.parameters}`&&r(o)};return this.messageHandlers.add(n),()=>this.messageHandlers.delete(n)}waitForReady(){return new Promise(e=>{let t=this.on(Fe.MAGIC_OVERLAY_READY,()=>{this.isReadyForRequest=!0,e(),t()})})}listen(){this.on(Fe.MAGIC_HIDE_OVERLAY,()=>{this.hideOverlay()}),this.on(Fe.MAGIC_SHOW_OVERLAY,()=>{this.showOverlay()}),this.on(Fe.MAGIC_SEND_PRODUCT_ANNOUNCEMENT,e=>{e.data.response.result.product_announcement&&new St(Ve.ProductAnnouncement,e.data.response.result.product_announcement).log()})}};var Jo={};wi(Jo,{AuthEventOnReceived:()=>ki,DeepLinkPage:()=>Ri,DeviceVerificationEventEmit:()=>ar,DeviceVerificationEventOnReceived:()=>Li,EthChainType:()=>Pi,Events:()=>Rt,Extension:()=>bt,ExtensionError:()=>Cn,ExtensionWarning:()=>Tn,LoginWithEmailOTPEventEmit:()=>mt,LoginWithEmailOTPEventOnReceived:()=>Ai,LoginWithMagicLinkEventEmit:()=>Oi,LoginWithMagicLinkEventOnReceived:()=>Ci,MagicIncomingWindowMessage:()=>Fe,MagicOutgoingWindowMessage:()=>pt,MagicPayloadMethod:()=>k,NftCheckoutIntermediaryEvents:()=>Ui,RPCError:()=>Qt,RPCErrorCode:()=>Tt,RecencyCheckEventEmit:()=>ze,RecencyCheckEventOnReceived:()=>Ni,RecoveryMethodType:()=>Di,SDKError:()=>rt,SDKErrorCode:()=>qe,SDKWarning:()=>St,SDKWarningCode:()=>Ve,UpdateEmailEventEmit:()=>Xe,UpdateEmailEventOnReceived:()=>Mi,WalletEventOnReceived:()=>Bi,Wallets:()=>_e,isPromiEvent:()=>Ho});var Mn=Ti(Xs()),Qo=Ti(Zs());var fp={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};function dp(e){for(let[t,r]of Object.entries(fp))e.style[t]=r}function pp(e){let t=[].slice.call(document.querySelectorAll(".magic-iframe"));return Boolean(t.find(r=>r.src.includes(e)))}var Nn=class extends Vs{constructor(){super(...arguments);this.activeElement=null}init(){this.test="hello",this.iframe=new Promise(r=>{let n=()=>{if(pp(encodeURIComponent(this.parameters)))Ms().log();else{let o=document.createElement("iframe");o.classList.add("magic-iframe"),o.dataset.magicIframeLabel=Lr(this.endpoint).host,o.title="Secure Modal",o.src=Lr(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href,o.allow="clipboard-read; clipboard-write",dp(o),document.body.appendChild(o),r(o)}};["loaded","interactive","complete"].includes(document.readyState)?n():window.addEventListener("load",n,!1)}),window.addEventListener("message",r=>{var n;if(r.origin===this.endpoint&&r.data&&r.data.msgType&&this.messageHandlers.size){r.data.response=(n=r.data.response)!=null?n:{};for(let o of this.messageHandlers.values())o(r)}})}showOverlay(){return xt(this,null,function*(){let r=yield this.iframe;r.style.display="block",this.activeElement=document.activeElement,r.focus()})}hideOverlay(){return xt(this,null,function*(){var n;let r=yield this.iframe;r.style.display="none",(n=this.activeElement)!=null&&n.focus&&this.activeElement.focus(),this.activeElement=null})}_post(r){return xt(this,null,function*(){let n=yield this.iframe;if(n&&n.contentWindow)n.contentWindow.postMessage(r,this.endpoint);else throw jo()})}};var mp=Object.assign(Ns(Xo,{platform:"web",sdkName:"magic-sdk",version:"28.0.6",defaultEndpoint:"https://auth.magic.link/",ViewController:Nn,configureStorage:()=>xt(void 0,null,function*(){let e=Mn.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return yield e.defineDriver(Qo),yield e.setDriver([Mn.default.INDEXEDDB,Mn.default.LOCALSTORAGE,Qo._driver]),e})}),_i({},Jo)),hp=mp;return Zu(vp);})();
6
12
  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": "28.0.6",
3
+ "version": "28.0.7-canary.747.9472447874.0",
4
4
  "description": "Passwordless authentication for the web.",
5
5
  "author": "Magic Labs <team@magic.link> (https://magic.link/)",
6
6
  "license": "MIT",
@@ -29,8 +29,8 @@
29
29
  ]
30
30
  },
31
31
  "dependencies": {
32
- "@magic-sdk/commons": "^24.0.5",
33
- "@magic-sdk/provider": "^28.0.5",
32
+ "@magic-sdk/commons": "24.0.6-canary.747.9472447874.0",
33
+ "@magic-sdk/provider": "28.0.6-canary.747.9472311791.0",
34
34
  "@magic-sdk/types": "^24.0.4",
35
35
  "localforage": "^1.7.4"
36
36
  },
@@ -40,5 +40,5 @@
40
40
  "@babel/runtime": "^7.9.6",
41
41
  "localforage-driver-memory": "^1.0.5"
42
42
  },
43
- "gitHead": "4dd22c57c7ae5674fc37b86f80b4da6de2a6e6bb"
43
+ "gitHead": "6bc7abb2bb0b477a8243966d44a2c6be901d362e"
44
44
  }