magic-sdk 7.0.0 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,53 @@
1
+ # v8.1.0 (Mon Mar 07 2022)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Update READMEs with outdated context/hyperlinks ([@smithki](https://github.com/smithki))
6
+
7
+ #### 🏠 Internal
8
+
9
+ - Internal documentation updates (`BUILD_SYSTEM.md`) [#283](https://github.com/magiclabs/magic-js/pull/283) ([@smithki](https://github.com/smithki))
10
+
11
+ #### Authors: 1
12
+
13
+ - Ian K Smith ([@smithki](https://github.com/smithki))
14
+
15
+ ---
16
+
17
+ # v8.0.1 (Tue Jan 25 2022)
18
+
19
+ #### 🐛 Bug Fix
20
+
21
+ - Fix CDN build targets [#270](https://github.com/magiclabs/magic-js/pull/270) ([@smithki](https://github.com/smithki))
22
+ - Fix CDN issues related to ESBuild ([@smithki](https://github.com/smithki))
23
+
24
+ #### Authors: 1
25
+
26
+ - Ian K Smith ([@smithki](https://github.com/smithki))
27
+
28
+ ---
29
+
30
+ # v8.0.0 (Tue Jan 25 2022)
31
+
32
+ #### 💥 Breaking Change
33
+
34
+ - Switch from `microbundle` to `esbuild` [#220](https://github.com/magiclabs/magic-js/pull/220) ([@smithki](https://github.com/smithki))
35
+
36
+ #### 🐛 Bug Fix
37
+
38
+ - Merge with master ([@smithki](https://github.com/smithki))
39
+ - Merge branch 'master' into feat/faster-builds ([@smithki](https://github.com/smithki))
40
+ - Modify CDN default exports ([@smithki](https://github.com/smithki))
41
+ - Remove comments from README files ([@smithki](https://github.com/smithki))
42
+ - Fix build errors related to isolatedModules ([@smithki](https://github.com/smithki))
43
+ - Replace microbundle with ESBuild ([@smithki](https://github.com/smithki))
44
+
45
+ #### Authors: 1
46
+
47
+ - Ian K Smith ([@smithki](https://github.com/smithki))
48
+
49
+ ---
50
+
1
51
  # v7.0.0 (Tue Dec 14 2021)
2
52
 
3
53
  #### 💥 Breaking Change
package/README.md CHANGED
@@ -1,5 +1,3 @@
1
- <!-- force publish -->
2
-
3
1
  # ✨ Magic Authentication JavaScript SDK
4
2
 
5
3
  [![<MagicLabs>](https://circleci.com/gh/magiclabs/magic-js.svg?style=shield)](https://circleci.com/gh/magiclabs/magic-js)
@@ -14,7 +12,7 @@
14
12
 
15
13
  ## 📖 Documentation
16
14
 
17
- See the [developer documentation](https://docs.magic.link) to learn how you can master the Magic SDK in a matter of minutes.
15
+ See the [developer documentation](https://magic.link/docs) to learn how you can master the Magic SDK in a matter of minutes.
18
16
 
19
17
  ## 🔗 Installation
20
18
 
package/dist/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var e=require("@magic-sdk/provider"),t=require("@magic-sdk/commons"),r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function o(e){var t={exports:{}};return e(t,t.exports),t.exports}function i(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets option of @rollup/plugin-commonjs appropriately for this require call to behave properly.')}o(function(e){var t=function(e){var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,r,n){var o=Object.create((t&&t.prototype instanceof y?t:y).prototype),i=new N(n||[]);return o._invoke=function(e,t,r){var n=s;return function(o,i){if(n===d)throw new Error("Generator is already running");if(n===h){if("throw"===o)throw i;return x()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=E(a,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===s)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var c=f(e,t,r);if("normal"===c.type){if(n=r.done?h:l,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=h,r.method="throw",r.arg=c.arg)}}}(e,r,i),o}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var s="suspendedStart",l="suspendedYield",d="executing",h="completed",v={};function y(){}function p(){}function m(){}var b={};b[i]=function(){return this};var g=Object.getPrototypeOf,_=g&&g(g(O([])));_&&_!==r&&n.call(_,i)&&(b=_);var w=m.prototype=y.prototype=Object.create(b);function I(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function S(e,t){function r(o,i,a,u){var c=f(e[o],e,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then(function(e){r("next",e,a,u)},function(e){r("throw",e,a,u)}):t.resolve(l).then(function(e){s.value=e,a(s)},function(e){return r("throw",e,a,u)})}u(c.arg)}var o;this._invoke=function(e,n){function i(){return new t(function(t,o){r(e,n,t,o)})}return o=o?o.then(i,i):i()}}function E(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,E(e,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=f(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function O(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:x}}function x(){return{value:t,done:!0}}return p.prototype=w.constructor=m,m.constructor=p,m[u]=p.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,u in e||(e[u]="GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},I(S.prototype),S.prototype[a]=function(){return this},e.AsyncIterator=S,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new S(c(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(e){return e.done?e.value:a.next()})},I(w),w[u]="Generator",w[i]=function(){return this},w.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=O,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),f=n.call(a,"finallyLoc");if(c&&f){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:O(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}});var a=o(function(e,t){e.exports=function e(t,r,n){function o(u,c){if(!r[u]){if(!t[u]){if(!c&&i)return i(u);if(a)return a(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var s=r[u]={exports:{}};t[u][0].call(s.exports,function(e){return o(t[u][1][e]||e)},s,s.exports,e,t,r,n)}return r[u].exports}for(var a=i,u=0;u<n.length;u++)o(n[u]);return o}({1:[function(e,t,n){(function(e){var r,n,o=e.MutationObserver||e.WebKitMutationObserver;if(o){var i=0,a=new o(s),u=e.document.createTextNode("");a.observe(u,{characterData:!0}),r=function(){u.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){s(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(s,0)};else{var c=new e.MessageChannel;c.port1.onmessage=s,r=function(){c.port2.postMessage(0)}}var f=[];function s(){var e,t;n=!0;for(var r=f.length;r;){for(t=f,f=[],e=-1;++e<r;)t[e]();r=f.length}n=!1}t.exports=function(e){1!==f.push(e)||n||r()}}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,r){var n=e(1);function o(){}var i={},a=["REJECTED"],u=["FULFILLED"],c=["PENDING"];function f(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==o&&h(this,e)}function s(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function l(e,t,r){n(function(){var n;try{n=t(r)}catch(t){return i.reject(e,t)}n===e?i.reject(e,new TypeError("Cannot resolve promise with itself")):i.resolve(e,n)})}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function h(e,t){var r=!1;function n(t){r||(r=!0,i.reject(e,t))}function o(t){r||(r=!0,i.resolve(e,t))}var a=v(function(){t(o,n)});"error"===a.status&&n(a.value)}function v(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}t.exports=f,f.prototype.catch=function(e){return this.then(null,e)},f.prototype.then=function(e,t){if("function"!=typeof e&&this.state===u||"function"!=typeof t&&this.state===a)return this;var r=new this.constructor(o);return this.state!==c?l(r,this.state===u?e:t,this.outcome):this.queue.push(new s(r,e,t)),r},s.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},s.prototype.otherCallFulfilled=function(e){l(this.promise,this.onFulfilled,e)},s.prototype.callRejected=function(e){i.reject(this.promise,e)},s.prototype.otherCallRejected=function(e){l(this.promise,this.onRejected,e)},i.resolve=function(e,t){var r=v(d,t);if("error"===r.status)return i.reject(e,r.value);var n=r.value;if(n)h(e,n);else{e.state=u,e.outcome=t;for(var o=-1,a=e.queue.length;++o<a;)e.queue[o].callFulfilled(t)}return e},i.reject=function(e,t){e.state=a,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e},f.resolve=function(e){return e instanceof this?e:i.resolve(new this(o),e)},f.reject=function(e){var t=new this(o);return i.reject(t,e)},f.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var a=new Array(r),u=0,c=-1,f=new this(o);++c<r;)s(e[c],c);return f;function s(e,o){t.resolve(e).then(function(e){a[o]=e,++u!==r||n||(n=!0,i.resolve(f,a))},function(e){n||(n=!0,i.reject(f,e))})}},f.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t=e.length,r=!1;if(!t)return this.resolve([]);for(var n=-1,a=new this(o);++n<t;)this.resolve(e[n]).then(function(e){r||(r=!0,i.resolve(a,e))},function(e){r||(r=!0,i.reject(a,e))});return a}},{1:1}],3:[function(e,t,n){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,r){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();function i(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var r=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var a=Promise;function u(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function c(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}function f(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function s(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",d=void 0,h={},v=Object.prototype.toString,y="readonly",p="readwrite";function m(e){for(var t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r),o=0;o<t;o++)n[o]=e.charCodeAt(o);return r}function b(e){var t=h[e.name],r={};r.promise=new a(function(e,t){r.resolve=e,r.reject=t}),t.deferredOperations.push(r),t.dbReady=t.dbReady?t.dbReady.then(function(){return r.promise}):r.promise}function g(e){var t=h[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function _(e,t){var r=h[e.name].deferredOperations.pop();if(r)return r.reject(t),r.promise}function w(e,t){return new a(function(r,n){if(h[e.name]=h[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return r(e.db);b(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var a=o.open.apply(o,i);t&&(a.onupgradeneeded=function(t){var r=a.result;try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(l)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),n(a.error)},a.onsuccess=function(){r(a.result),g(e)}})}function I(e){return w(e,!1)}function S(e){return w(e,!0)}function E(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),n=e.version>e.db.version;if(e.version<e.db.version&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),n||r){if(r){var o=e.db.version+1;o>e.version&&(e.version=o)}return!0}return!1}function j(e){return i([m(atob(e.data))],{type:e.type})}function A(e){return e&&e.__local_forage_encoded_blob}function N(e){var t=this,r=t._initReady().then(function(){var e=h[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady});return c(r,e,e),r}function O(e,t,r,n){void 0===n&&(n=1);try{var o=e.db.transaction(e.storeName,t);r(null,o)}catch(o){if(n>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return a.resolve().then(function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),S(e)}).then(function(){return function(e){b(e);for(var t=h[e.name],r=t.forages,n=0;n<r.length;n++){var o=r[n];o._dbInfo.db&&(o._dbInfo.db.close(),o._dbInfo.db=null)}return e.db=null,I(e).then(function(t){return e.db=t,E(e)?S(e):t}).then(function(n){e.db=t.db=n;for(var o=0;o<r.length;o++)r[o]._dbInfo.db=n}).catch(function(t){throw _(e,t),t})}(e).then(function(){O(e,t,r,n-1)})}).catch(r);r(o)}}var x={_driver:"asyncStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]=e[n];var o=h[r.name];o||(h[r.name]=o={forages:[],db:null,dbReady:null,deferredOperations:[]}),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=N);var i=[];function u(){return a.resolve()}for(var c=0;c<o.forages.length;c++){var f=o.forages[c];f!==t&&i.push(f._initReady().catch(u))}var s=o.forages.slice(0);return a.all(i).then(function(){return r.db=o.db,I(r)}).then(function(e){return r.db=e,E(r,t._defaultConfig.version)?S(r):e}).then(function(e){r.db=o.db=e,t._dbInfo=r;for(var n=0;n<s.length;n++){var i=s[n];i!==t&&(i._dbInfo.db=r.db,i._dbInfo.version=r.version)}})},_support:function(){try{if(!o||!o.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){O(r._dbInfo,y,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).openCursor(),u=1;a.onsuccess=function(){var r=a.result;if(r){var n=r.value;A(n)&&(n=j(n));var o=e(n,r.key,u++);void 0!==o?t(o):r.continue()}else t()},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)});return u(n,t),n},getItem:function(e,t){var r=this;e=f(e);var n=new a(function(t,n){r.ready().then(function(){O(r._dbInfo,y,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).get(e);a.onsuccess=function(){var e=a.result;void 0===e&&(e=null),A(e)&&(e=j(e)),t(e)},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)});return u(n,t),n},setItem:function(e,t,r){var n=this;e=f(e);var o=new a(function(r,o){var u;n.ready().then(function(){return u=n._dbInfo,"[object Blob]"===v.call(t)?function(e){return"boolean"==typeof d?a.resolve(d):function(e){return new a(function(t){var r=e.transaction(l,p),n=i([""]);r.objectStore(l).put(n,"key"),r.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},r.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),r=navigator.userAgent.match(/Edge\//);t(r||!e||parseInt(e[1],10)>=43)}}).catch(function(){return!1})}(e).then(function(e){return d=e})}(u.db).then(function(e){return e?t:(r=t,new a(function(e,t){var n=new FileReader;n.onerror=t,n.onloadend=function(t){var n=btoa(t.target.result||"");e({__local_forage_encoded_blob:!0,data:n,type:r.type})},n.readAsBinaryString(r)}));var r}):t}).then(function(t){O(n._dbInfo,p,function(i,a){if(i)return o(i);try{var u=a.objectStore(n._dbInfo.storeName);null===t&&(t=void 0);var c=u.put(t,e);a.oncomplete=function(){void 0===t&&(t=null),r(t)},a.onabort=a.onerror=function(){o(c.error?c.error:c.transaction.error)}}catch(e){o(e)}})}).catch(o)});return u(o,r),o},removeItem:function(e,t){var r=this;e=f(e);var n=new a(function(t,n){r.ready().then(function(){O(r._dbInfo,p,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).delete(e);i.oncomplete=function(){t()},i.onerror=function(){n(a.error)},i.onabort=function(){n(a.error?a.error:a.transaction.error)}}catch(e){n(e)}})}).catch(n)});return u(n,t),n},clear:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){O(t._dbInfo,p,function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).clear();o.oncomplete=function(){e()},o.onabort=o.onerror=function(){r(i.error?i.error:i.transaction.error)}}catch(e){r(e)}})}).catch(r)});return u(r,e),r},length:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){O(t._dbInfo,y,function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).count();i.onsuccess=function(){e(i.result)},i.onerror=function(){r(i.error)}}catch(e){r(e)}})}).catch(r)});return u(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){e<0?t(null):r.ready().then(function(){O(r._dbInfo,y,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName),u=!1,c=a.openKeyCursor();c.onsuccess=function(){var r=c.result;r?0===e||u?t(r.key):(u=!0,r.advance(e)):t(null)},c.onerror=function(){n(c.error)}}catch(e){n(e)}})}).catch(n)});return u(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){O(t._dbInfo,y,function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).openKeyCursor(),a=[];i.onsuccess=function(){var t=i.result;t?(a.push(t.key),t.continue()):e(a)},i.onerror=function(){r(i.error)}}catch(e){r(e)}})}).catch(r)});return u(r,e),r},dropInstance:function(e,t){t=s.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,i=this;if(e.name){var c=e.name===r.name&&i._dbInfo.db?a.resolve(i._dbInfo.db):I(e).then(function(t){var r=h[e.name],n=r.forages;r.db=t;for(var o=0;o<n.length;o++)n[o]._dbInfo.db=t;return t});n=c.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1;b(e);var n=h[e.name],i=n.forages;t.close();for(var u=0;u<i.length;u++){var c=i[u];c._dbInfo.db=null,c._dbInfo.version=r}return new a(function(t,n){var i=o.open(e.name,r);i.onerror=function(e){i.result.close(),n(e)},i.onupgradeneeded=function(){i.result.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result;e.close(),t(e)}}).then(function(e){n.db=e;for(var t=0;t<i.length;t++){var r=i[t];r._dbInfo.db=e,g(r._dbInfo)}}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})}}:function(t){b(e);var r=h[e.name],n=r.forages;t.close();for(var i=0;i<n.length;i++)n[i]._dbInfo.db=null;return new a(function(t,r){var n=o.deleteDatabase(e.name);n.onerror=n.onblocked=function(e){var t=n.result;t&&t.close(),r(e)},n.onsuccess=function(){var e=n.result;e&&e.close(),t(e)}}).then(function(e){r.db=e;for(var t=0;t<n.length;t++)g(n[t]._dbInfo)}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})})}else n=a.reject("Invalid arguments");return u(n,t),n}},k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",B=/^~~local_forage_type~([^~]+)~/,R="__lfsc__:",L=R.length,D="arbf",C="blob",T="si08",P="ui08",F="uic8",M="si16",z="si32",U="ur16",q="ui32",W="fl32",G="fl64",K=L+D.length,H=Object.prototype.toString;function J(e){var t,r,n,o,i,a=.75*e.length,u=e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var f=new ArrayBuffer(a),s=new Uint8Array(f);for(t=0;t<u;t+=4)r=k.indexOf(e[t]),n=k.indexOf(e[t+1]),o=k.indexOf(e[t+2]),i=k.indexOf(e[t+3]),s[c++]=r<<2|n>>4,s[c++]=(15&n)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return f}function Q(e){var t,r=new Uint8Array(e),n="";for(t=0;t<r.length;t+=3)n+=k[r[t]>>2],n+=k[(3&r[t])<<4|r[t+1]>>4],n+=k[(15&r[t+1])<<2|r[t+2]>>6],n+=k[63&r[t+2]];return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var V={serialize:function(e,t){var r="";if(e&&(r=H.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===H.call(e.buffer))){var n,o=R;e instanceof ArrayBuffer?(n=e,o+=D):(n=e.buffer,"[object Int8Array]"===r?o+=T:"[object Uint8Array]"===r?o+=P:"[object Uint8ClampedArray]"===r?o+=F:"[object Int16Array]"===r?o+=M:"[object Uint16Array]"===r?o+=U:"[object Int32Array]"===r?o+=z:"[object Uint32Array]"===r?o+=q:"[object Float32Array]"===r?o+=W:"[object Float64Array]"===r?o+=G:t(new Error("Failed to get type for BinaryArray"))),t(o+Q(n))}else if("[object Blob]"===r){var i=new FileReader;i.onload=function(){var r="~~local_forage_type~"+e.type+"~"+Q(this.result);t("__lfsc__:blob"+r)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},deserialize:function(e){if(e.substring(0,L)!==R)return JSON.parse(e);var t,r=e.substring(K),n=e.substring(L,K);if(n===C&&B.test(r)){var o=r.match(B);t=o[1],r=r.substring(o[0].length)}var a=J(r);switch(n){case D:return a;case C:return i([a],{type:t});case T:return new Int8Array(a);case P:return new Uint8Array(a);case F:return new Uint8ClampedArray(a);case M:return new Int16Array(a);case U:return new Uint16Array(a);case z:return new Int32Array(a);case q:return new Uint32Array(a);case W:return new Float32Array(a);case G:return new Float64Array(a);default:throw new Error("Unkown type: "+n)}},stringToBuffer:J,bufferToString:Q};function X(e,t,r,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function Y(e,t,r,n,o,i){e.executeSql(r,n,o,function(e,a){a.code===a.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],function(e,u){u.rows.length?i(e,a):X(e,t,function(){e.executeSql(r,n,o,i)},i)},i):i(e,a)},i)}function Z(e,t,r,n){var o=this;e=f(e);var i=new a(function(i,a){o.ready().then(function(){void 0===t&&(t=null);var u=t,c=o._dbInfo;c.serializer.serialize(t,function(t,f){f?a(f):c.db.transaction(function(r){Y(r,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],function(){i(u)},function(e,t){a(t)})},function(t){if(t.code===t.QUOTA_ERR){if(n>0)return void i(Z.apply(o,[e,u,r,n-1]));a(t)}})})}).catch(a)});return u(i,r),i}function $(e){return new a(function(t,r){e.transaction(function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(r,n){for(var o=[],i=0;i<n.rows.length;i++)o.push(n.rows.item(i).name);t({db:e,storeNames:o})},function(e,t){r(t)})},function(e){r(e)})})}var ee={_driver:"webSQLStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]="string"!=typeof e[n]?e[n].toString():e[n];var o=new a(function(e,n){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(e){return n(e)}r.db.transaction(function(o){X(o,r,function(){t._dbInfo=r,e()},function(e,t){n(t)})},n)});return r.serializer=V,o},_support:"function"==typeof openDatabase,iterate:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){Y(r,o,"SELECT * FROM "+o.storeName,[],function(r,n){for(var i=n.rows,a=i.length,u=0;u<a;u++){var c=i.item(u),f=c.value;if(f&&(f=o.serializer.deserialize(f)),void 0!==(f=e(f,c.key,u+1)))return void t(f)}t()},function(e,t){n(t)})})}).catch(n)});return u(n,t),n},getItem:function(e,t){var r=this;e=f(e);var n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){Y(r,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],function(e,r){var n=r.rows.length?r.rows.item(0).value:null;n&&(n=o.serializer.deserialize(n)),t(n)},function(e,t){n(t)})})}).catch(n)});return u(n,t),n},setItem:function(e,t,r){return Z.apply(this,[e,t,r,1])},removeItem:function(e,t){var r=this;e=f(e);var n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){Y(r,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],function(){t()},function(e,t){n(t)})})}).catch(n)});return u(n,t),n},clear:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){Y(t,n,"DELETE FROM "+n.storeName,[],function(){e()},function(e,t){r(t)})})}).catch(r)});return u(r,e),r},length:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){Y(t,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],function(t,r){var n=r.rows.item(0).c;e(n)},function(e,t){r(t)})})}).catch(r)});return u(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){Y(r,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],function(e,r){var n=r.rows.length?r.rows.item(0).key:null;t(n)},function(e,t){n(t)})})}).catch(n)});return u(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){Y(t,n,"SELECT key FROM "+n.storeName,[],function(t,r){for(var n=[],o=0;o<r.rows.length;o++)n.push(r.rows.item(o).key);e(n)},function(e,t){r(t)})})}).catch(r)});return u(r,e),r},dropInstance:function(e,t){t=s.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,o=this;return u(n=e.name?new a(function(t){var n;n=e.name===r.name?o._dbInfo.db:openDatabase(e.name,"","",0),t(e.storeName?{db:n,storeNames:[e.storeName]}:$(n))}).then(function(e){return new a(function(t,r){e.db.transaction(function(n){function o(e){return new a(function(t,r){n.executeSql("DROP TABLE IF EXISTS "+e,[],function(){t()},function(e,t){r(t)})})}for(var i=[],u=0,c=e.storeNames.length;u<c;u++)i.push(o(e.storeNames[u]));a.all(i).then(function(){t()}).catch(function(e){r(e)})},function(e){r(e)})})}):a.reject("Invalid arguments"),t),n}};function te(e,t){var r=e.name+"/";return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}var re={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var r in e)t[r]=e[r];return t.keyPrefix=te(e,this._defaultConfig),!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}()||localStorage.length>0?(this._dbInfo=t,t.serializer=V,a.resolve()):a.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var r=this,n=r.ready().then(function(){for(var t=r._dbInfo,n=t.keyPrefix,o=n.length,i=localStorage.length,a=1,u=0;u<i;u++){var c=localStorage.key(u);if(0===c.indexOf(n)){var f=localStorage.getItem(c);if(f&&(f=t.serializer.deserialize(f)),void 0!==(f=e(f,c.substring(o),a++)))return f}}});return u(n,t),n},getItem:function(e,t){var r=this;e=f(e);var n=r.ready().then(function(){var t=r._dbInfo,n=localStorage.getItem(t.keyPrefix+e);return n&&(n=t.serializer.deserialize(n)),n});return u(n,t),n},setItem:function(e,t,r){var n=this;e=f(e);var o=n.ready().then(function(){void 0===t&&(t=null);var r=t;return new a(function(o,i){var a=n._dbInfo;a.serializer.serialize(t,function(t,n){if(n)i(n);else try{localStorage.setItem(a.keyPrefix+e,t),o(r)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||i(e),i(e)}})})});return u(o,r),o},removeItem:function(e,t){var r=this;e=f(e);var n=r.ready().then(function(){localStorage.removeItem(r._dbInfo.keyPrefix+e)});return u(n,t),n},clear:function(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var n=localStorage.key(r);0===n.indexOf(e)&&localStorage.removeItem(n)}});return u(r,e),r},length:function(e){var t=this.keys().then(function(e){return e.length});return u(t,e),t},key:function(e,t){var r=this,n=r.ready().then(function(){var t,n=r._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(n.keyPrefix.length)),t});return u(n,t),n},keys:function(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo,r=localStorage.length,n=[],o=0;o<r;o++){var i=localStorage.key(o);0===i.indexOf(e.keyPrefix)&&n.push(i.substring(e.keyPrefix.length))}return n});return u(r,e),r},dropInstance:function(e,t){if(t=s.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var r=this.config();e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}var n,o=this;return u(n=e.name?new a(function(t){t(e.storeName?te(e,o._defaultConfig):e.name+"/")}).then(function(e){for(var t=localStorage.length-1;t>=0;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}}):a.reject("Invalid arguments"),t),n}},ne=function(e,t){for(var r=e.length,n=0;n<r;){if((o=e[n])===(i=t)||"number"==typeof o&&"number"==typeof i&&isNaN(o)&&isNaN(i))return!0;n++}var o,i;return!1},oe=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie={},ae={},ue={INDEXEDDB:x,WEBSQL:ee,LOCALSTORAGE:re},ce=[ue.INDEXEDDB._driver,ue.WEBSQL._driver,ue.LOCALSTORAGE._driver],fe=["dropInstance"],se=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(fe),le={description:"",driver:ce.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function de(e,t){e[t]=function(){var r=arguments;return e.ready().then(function(){return e[t].apply(e,r)})}}function he(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var r in t)t.hasOwnProperty(r)&&(arguments[0][r]=oe(t[r])?t[r].slice():t[r])}return arguments[0]}var ve=new(function(){function e(t){for(var r in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ue)if(ue.hasOwnProperty(r)){var n=ue[r],o=n._driver;this[r]=o,ie[o]||this.defineDriver(n)}this._defaultConfig=he({},le),this._config=he({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":n(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,r){var n=new a(function(t,r){try{var n=e._driver,o=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void r(o);for(var i=se.concat("_initStorage"),c=0,f=i.length;c<f;c++){var s=i[c];if((!ne(fe,s)||e[s])&&"function"!=typeof e[s])return void r(o)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),r=a.reject(t);return u(r,arguments[arguments.length-1]),r}},r=0,n=fe.length;r<n;r++){var o=fe[r];e[o]||(e[o]=t(o))}}();var l=function(r){ie[n]&&console.info("Redefining LocalForage driver: "+n),ie[n]=e,ae[n]=r,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(l,r):l(!!e._support):l(!0)}catch(e){r(e)}});return c(n,t,r),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,r){var n=ie[e]?a.resolve(ie[e]):a.reject(new Error("Driver not found."));return c(n,t,r),n},e.prototype.getSerializer=function(e){var t=a.resolve(V);return c(t,e),t},e.prototype.ready=function(e){var t=this,r=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready});return c(r,e,e),r},e.prototype.setDriver=function(e,t,r){var n=this;oe(e)||(e=[e]);var o=this._getSupportedDrivers(e);function i(){n._config.driver=n.driver()}function u(e){return n._extend(e),i(),n._ready=n._initStorage(n._config),n._ready}var f=null!==this._driverSet?this._driverSet.catch(function(){return a.resolve()}):a.resolve();return this._driverSet=f.then(function(){var e=o[0];return n._dbInfo=null,n._ready=null,n.getDriver(e).then(function(e){n._driver=e._driver,i(),n._wrapLibraryMethodsWithReady(),n._initDriver=function(e){return function(){var t=0;return function r(){for(;t<e.length;){var o=e[t];return t++,n._dbInfo=null,n._ready=null,n.getDriver(o).then(u).catch(r)}i();var c=new Error("No available storage method found.");return n._driverSet=a.reject(c),n._driverSet}()}}(o)})}).catch(function(){i();var e=new Error("No available storage method found.");return n._driverSet=a.reject(e),n._driverSet}),c(this._driverSet,t,r),this._driverSet},e.prototype.supports=function(e){return!!ae[e]},e.prototype._extend=function(e){he(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var o=e[r];this.supports(o)&&t.push(o)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=se.length;e<t;e++)de(this,se[e])},e.prototype.createInstance=function(t){return new e(t)},e}());t.exports=ve},{3:3}]},{},[4])(4)}),u=o(function(e,t){"undefined"!=typeof self&&self,function(e){var t=/^~~local_forage_type~([^~]+)~/,r="__lfsc__:".length,n=r+"arbf".length,o=Object.prototype.toString;function i(e){var t=.75*e.length,r=e.length;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);for(var n=new ArrayBuffer(t),o=new Uint8Array(n),i=0,a=0;i<r;i+=4){var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i]),c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+1]),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+2]),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+3]);o[a++]=u<<2|c>>4,o[a++]=(15&c)<<4|f>>2,o[a++]=(3&f)<<6|63&s}return n}function a(e){for(var t=new Uint8Array(e),r="",n=0;n<t.length;n+=3)r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t[n]>>2],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t[n])<<4|t[n+1]>>4],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t[n+1])<<2|t[n+2]>>6],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[63&t[n+2]];return t.length%3==2?r=r.substring(0,r.length-1)+"=":t.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}function u(e){var t,r;if(null===e||"object"!=typeof e||"isActiveClone"in e)return e;var n=e instanceof Date?new Date(e):e.constructor();try{for(var o=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}(Object.keys(e)),i=o.next();!i.done;i=o.next()){var a=i.value;Object.prototype.hasOwnProperty.call(e,a)&&(e.isActiveClone=null,n[a]=u(e[a]),delete e.isActiveClone)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return n}function c(e,t){return(e.name||t.name)+"/"+(e.storeName||t.storeName)+"/"}function f(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function s(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function l(e,t){var r=this;if(t=s.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}return{promise:e.name?new Promise(function(t){t(e.storeName?c(e,r._defaultConfig):e.name+"/")}):Promise.reject("Invalid arguments"),callback:t}}function d(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}var h={bufferToString:a,deserialize:function(e){if("__lfsc__:"!==e.substring(0,r))return JSON.parse(e);var o,a=e.substring(n),u=e.substring(r,n);if("blob"===u&&t.test(a)){var c=a.match(t);o=c[1],a=a.substring(c[0].length)}var f=i(a);switch(u){case"arbf":return f;case"blob":return function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var r=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}([f],{type:o});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: "+u)}},serialize:function(e,t){var r="";if(e&&(r=o.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===o.call(e.buffer))){var n=void 0,i="__lfsc__:";e instanceof ArrayBuffer?(n=e,i+="arbf"):(n=e.buffer,"[object Int8Array]"===r?i+="si08":"[object Uint8Array]"===r?i+="ui08":"[object Uint8ClampedArray]"===r?i+="uic8":"[object Int16Array]"===r?i+="si16":"[object Uint16Array]"===r?i+="ur16":"[object Int32Array]"===r?i+="si32":"[object Uint32Array]"===r?i+="ui32":"[object Float32Array]"===r?i+="fl32":"[object Float64Array]"===r?i+="fl64":t(new Error("Failed to get type for BinaryArray"))),t(i+a(n))}else if("[object Blob]"===r){var u=new FileReader;u.onload=function(){var r="~~local_forage_type~"+e.type+"~"+a(this.result);t("__lfsc__:blob"+r)},u.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},stringToBuffer:i},v={},y=function(){function e(e){this.kp=e,this.data={}}return e.resolve=function(t){return v[t]||(v[t]=new e(t)),v[t]},e.prototype.clear=function(){this.data={}},e.prototype.drop=function(){this.clear(),delete v[this.kp]},e.prototype.get=function(e){return this.data[e]},e.prototype.key=function(e){return this.keys()[e]},e.prototype.keys=function(){return Object.keys(this.data)},e.prototype.rm=function(e){delete this.data[e]},e.prototype.set=function(e,t){this.data[e]=t},e}();e._support=!0,e._driver="localforage-driver-memory",e._initStorage=function(e){var t=e?u(e):{},r=c(t,this._defaultConfig),n=y.resolve(r);return this._dbInfo=t,this._dbInfo.serializer=h,this._dbInfo.keyPrefix=r,this._dbInfo.mStore=n,Promise.resolve()},e.clear=function(e){var t=this,r=this.ready().then(function(){t._dbInfo.mStore.clear()});return f(r,e),r},e.dropInstance=function(e,t){var r=l.apply(this,arguments),n=r.promise,o=r.callback;return f(n.then(function(e){y.resolve(e).drop()}),o),n},e.getItem=function(e,t){var r=this;e=d(e);var n=this.ready().then(function(){var t=r._dbInfo.mStore.get(e);return null==t?null:r._dbInfo.serializer.deserialize(t)});return f(n,t),n},e.iterate=function(e,t){var r=this,n=this.ready().then(function(){for(var t=r._dbInfo.mStore,n=t.keys(),o=0;o<n.length;o++){var i=t.get(n[o]);if(i&&(i=r._dbInfo.serializer.deserialize(i)),void 0!==(i=e(i,n[o],o+1)))return i}});return f(n,t),n},e.key=function(e,t){var r=this,n=this.ready().then(function(){var t;try{void 0===(t=r._dbInfo.mStore.key(e))&&(t=null)}catch(e){t=null}return t});return f(n,t),n},e.keys=function(e){var t=this,r=this.ready().then(function(){return t._dbInfo.mStore.keys()});return f(r,e),r},e.length=function(e){var t=this.keys().then(function(e){return e.length});return f(t,e),t},e.removeItem=function(e,t){var r=this;e=d(e);var n=this.ready().then(function(){r._dbInfo.mStore.rm(e)});return f(n,t),n},e.setItem=function(e,t,r){var n=this;e=d(e);var o=this.ready().then(function(){void 0===t&&(t=null);var r=t;return new Promise(function(o,i){n._dbInfo.serializer.serialize(t,function(t,a){if(a)i(a);else try{n._dbInfo.mStore.set(e,t),o(r)}catch(e){i(e)}})})});return f(o,r),o},Object.defineProperty(e,"__esModule",{value:!0})}(t)}),c=n(u),f=Object.assign(Object.create(null),u,{default:c});function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var d={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"},h=function(t){var r,n;function o(){for(var e,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(e=t.call.apply(t,[this].concat(n))||this).iframe=void 0,e.activeElement=null,e}n=t,(r=o).prototype=Object.create(n.prototype),r.prototype.constructor=r,s(r,n);var i=o.prototype;return i.init=function(){var t=this;this.test="hello",this.iframe=new Promise(function(r){var n=function(){if(o=encodeURIComponent(t.parameters),i=[].slice.call(document.querySelectorAll(".magic-iframe")),Boolean(i.find(function(e){return e.src.includes(o)})))e.createDuplicateIframeWarning().log();else{var n=document.createElement("iframe");n.classList.add("magic-iframe"),n.dataset.magicIframeLabel=e.createURL(t.endpoint).host,n.title="Secure Modal",n.src=e.createURL("/send?params="+encodeURIComponent(t.parameters),t.endpoint).href,function(e){for(var t=0,r=Object.entries(d);t<r.length;t++){var n=r[t];e.style[n[0]]=n[1]}}(n),document.body.appendChild(n),r(n)}var o,i};["loaded","interactive","complete"].includes(document.readyState)?n():window.addEventListener("load",n,!1)}),window.addEventListener("message",function(e){if(e.origin===t.endpoint&&e.data&&e.data.msgType&&t.messageHandlers.size){var r;e.data.response=null!=(r=e.data.response)?r:{};for(var n,o=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(t.messageHandlers.values());!(n=o()).done;)(0,n.value)(e)}})},i.showOverlay=function(){try{var e=this;return Promise.resolve(e.iframe).then(function(t){t.style.display="block",e.activeElement=document.activeElement,t.focus()})}catch(e){return Promise.reject(e)}},i.hideOverlay=function(){try{var e=this;return Promise.resolve(e.iframe).then(function(t){var r;t.style.display="none",null!==(r=e.activeElement)&&void 0!==r&&r.focus&&e.activeElement.focus(),e.activeElement=null})}catch(e){return Promise.reject(e)}},i._post=function(t){try{var r=this;return Promise.resolve(r.iframe).then(function(n){if(!n||!n.contentWindow)throw e.createModalNotReadyError();n.contentWindow.postMessage(t,r.endpoint)})}catch(e){return Promise.reject(e)}},o}(e.ViewController),v=e.createSDK(e.SDKBase,{platform:"web",sdkName:"magic-sdk",version:"7.0.0",defaultEndpoint:"https://auth.magic.link/",ViewController:h,configureStorage:function(){try{var e=a.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return Promise.resolve(e.defineDriver(f)).then(function(){return Promise.resolve(e.setDriver([a.INDEXEDDB,a.LOCALSTORAGE,u._driver])).then(function(){return e})})}catch(e){return Promise.reject(e)}}});exports.Magic=v,Object.keys(t).forEach(function(e){"default"===e||exports.hasOwnProperty(e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})});
1
+ var et=Object.create;var ge=Object.defineProperty;var rt=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var nt=Object.getPrototypeOf,ot=Object.prototype.hasOwnProperty;var ke=g=>ge(g,"__esModule",{value:!0});var er=(g,p)=>()=>(p||g((p={exports:{}}).exports,p),p.exports),it=(g,p)=>{for(var R in p)ge(g,R,{get:p[R],enumerable:!0})},re=(g,p,R,L)=>{if(p&&typeof p=="object"||typeof p=="function")for(let M of tt(p))!ot.call(g,M)&&(R||M!=="default")&&ge(g,M,{get:()=>p[M],enumerable:!(L=rt(p,M))||L.enumerable});return g},rr=(g,p)=>re(ke(ge(g!=null?et(nt(g)):{},"default",!p&&g&&g.__esModule?{get:()=>g.default,enumerable:!0}:{value:g,enumerable:!0})),g),at=(g=>(p,R)=>g&&g.get(p)||(R=re(ke({}),p,1),g&&g.set(p,R),R))(typeof WeakMap!="undefined"?new WeakMap:0);var de=(g,p,R)=>new Promise((L,M)=>{var Q=S=>{try{Y(R.next(S))}catch(P){M(P)}},C=S=>{try{Y(R.throw(S))}catch(P){M(P)}},Y=S=>S.done?L(S.value):Promise.resolve(S.value).then(Q,C);Y((R=R.apply(g,p)).next())});var nr=er((tr,xe)=>{(function(g){if(typeof tr=="object"&&typeof xe!="undefined")xe.exports=g();else if(typeof define=="function"&&define.amd)define([],g);else{var p;typeof window!="undefined"?p=window:typeof global!="undefined"?p=global:typeof self!="undefined"?p=self:p=this,p.localforage=g()}})(function(){var g,p,R;return function L(M,Q,C){function Y(K,Z){if(!Q[K]){if(!M[K]){var m=typeof require=="function"&&require;if(!Z&&m)return m(K,!0);if(S)return S(K,!0);var w=new Error("Cannot find module '"+K+"'");throw w.code="MODULE_NOT_FOUND",w}var T=Q[K]={exports:{}};M[K][0].call(T.exports,function(z){var q=M[K][1][z];return Y(q||z)},T,T.exports,L,M,Q,C)}return Q[K].exports}for(var S=typeof require=="function"&&require,P=0;P<C.length;P++)Y(C[P]);return Y}({1:[function(L,M,Q){(function(C){"use strict";var Y=C.MutationObserver||C.WebKitMutationObserver,S;if(Y){var P=0,K=new Y(z),Z=C.document.createTextNode("");K.observe(Z,{characterData:!0}),S=function(){Z.data=P=++P%2}}else if(!C.setImmediate&&typeof C.MessageChannel!="undefined"){var m=new C.MessageChannel;m.port1.onmessage=z,S=function(){m.port2.postMessage(0)}}else"document"in C&&"onreadystatechange"in C.document.createElement("script")?S=function(){var F=C.document.createElement("script");F.onreadystatechange=function(){z(),F.onreadystatechange=null,F.parentNode.removeChild(F),F=null},C.document.documentElement.appendChild(F)}:S=function(){setTimeout(z,0)};var w,T=[];function z(){w=!0;for(var F,k,U=T.length;U;){for(k=T,T=[],F=-1;++F<U;)k[F]();U=T.length}w=!1}M.exports=q;function q(F){T.push(F)===1&&!w&&S()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(L,M,Q){"use strict";var C=L(1);function Y(){}var S={},P=["REJECTED"],K=["FULFILLED"],Z=["PENDING"];M.exports=m;function m(h){if(typeof h!="function")throw new TypeError("resolver must be a function");this.state=Z,this.queue=[],this.outcome=void 0,h!==Y&&q(this,h)}m.prototype.catch=function(h){return this.then(null,h)},m.prototype.then=function(h,D){if(typeof h!="function"&&this.state===K||typeof D!="function"&&this.state===P)return this;var I=new this.constructor(Y);if(this.state!==Z){var x=this.state===K?h:D;T(I,x,this.outcome)}else this.queue.push(new w(I,h,D));return I};function w(h,D,I){this.promise=h,typeof D=="function"&&(this.onFulfilled=D,this.callFulfilled=this.otherCallFulfilled),typeof I=="function"&&(this.onRejected=I,this.callRejected=this.otherCallRejected)}w.prototype.callFulfilled=function(h){S.resolve(this.promise,h)},w.prototype.otherCallFulfilled=function(h){T(this.promise,this.onFulfilled,h)},w.prototype.callRejected=function(h){S.reject(this.promise,h)},w.prototype.otherCallRejected=function(h){T(this.promise,this.onRejected,h)};function T(h,D,I){C(function(){var x;try{x=D(I)}catch(H){return S.reject(h,H)}x===h?S.reject(h,new TypeError("Cannot resolve promise with itself")):S.resolve(h,x)})}S.resolve=function(h,D){var I=F(z,D);if(I.status==="error")return S.reject(h,I.value);var x=I.value;if(x)q(h,x);else{h.state=K,h.outcome=D;for(var H=-1,j=h.queue.length;++H<j;)h.queue[H].callFulfilled(D)}return h},S.reject=function(h,D){h.state=P,h.outcome=D;for(var I=-1,x=h.queue.length;++I<x;)h.queue[I].callRejected(D);return h};function z(h){var D=h&&h.then;if(h&&(typeof h=="object"||typeof h=="function")&&typeof D=="function")return function(){D.apply(h,arguments)}}function q(h,D){var I=!1;function x($){I||(I=!0,S.reject(h,$))}function H($){I||(I=!0,S.resolve(h,$))}function j(){D(H,x)}var J=F(j);J.status==="error"&&x(J.value)}function F(h,D){var I={};try{I.value=h(D),I.status="success"}catch(x){I.status="error",I.value=x}return I}m.resolve=k;function k(h){return h instanceof this?h:S.resolve(new this(Y),h)}m.reject=U;function U(h){var D=new this(Y);return S.reject(D,h)}m.all=se;function se(h){var D=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var I=h.length,x=!1;if(!I)return this.resolve([]);for(var H=new Array(I),j=0,J=-1,$=new this(Y);++J<I;)ee(h[J],J);return $;function ee(fe,a){D.resolve(fe).then(s,function(v){x||(x=!0,S.reject($,v))});function s(v){H[a]=v,++j===I&&!x&&(x=!0,S.resolve($,H))}}}m.race=ne;function ne(h){var D=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var I=h.length,x=!1;if(!I)return this.resolve([]);for(var H=-1,j=new this(Y);++H<I;)J(h[H]);return j;function J($){D.resolve($).then(function(ee){x||(x=!0,S.resolve(j,ee))},function(ee){x||(x=!0,S.reject(j,ee))})}}},{"1":1}],3:[function(L,M,Q){(function(C){"use strict";typeof C.Promise!="function"&&(C.Promise=L(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"2":2}],4:[function(L,M,Q){"use strict";var C=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function Y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S(){try{if(typeof indexedDB!="undefined")return indexedDB;if(typeof webkitIndexedDB!="undefined")return webkitIndexedDB;if(typeof mozIndexedDB!="undefined")return mozIndexedDB;if(typeof OIndexedDB!="undefined")return OIndexedDB;if(typeof msIndexedDB!="undefined")return msIndexedDB}catch{return}}var P=S();function K(){try{if(!P||!P.open)return!1;var e=typeof openDatabase!="undefined"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!e||t)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch{return!1}}function Z(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(n){if(n.name!=="TypeError")throw n;for(var r=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,o=new r,i=0;i<e.length;i+=1)o.append(e[i]);return o.getBlob(t.type)}}typeof Promise=="undefined"&&L(3);var m=Promise;function w(e,t){t&&e.then(function(r){t(null,r)},function(r){t(r)})}function T(e,t,r){typeof t=="function"&&e.then(t),typeof r=="function"&&e.catch(r)}function z(e){return typeof e!="string"&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function q(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var F="local-forage-detect-blob-support",k=void 0,U={},se=Object.prototype.toString,ne="readonly",h="readwrite";function D(e){for(var t=e.length,r=new ArrayBuffer(t),o=new Uint8Array(r),i=0;i<t;i++)o[i]=e.charCodeAt(i);return r}function I(e){return new m(function(t){var r=e.transaction(F,h),o=Z([""]);r.objectStore(F).put(o,"key"),r.onabort=function(i){i.preventDefault(),i.stopPropagation(),t(!1)},r.oncomplete=function(){var i=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!i||parseInt(i[1],10)>=43)}}).catch(function(){return!1})}function x(e){return typeof k=="boolean"?m.resolve(k):I(e).then(function(t){return k=t,k})}function H(e){var t=U[e.name],r={};r.promise=new m(function(o,i){r.resolve=o,r.reject=i}),t.deferredOperations.push(r),t.dbReady?t.dbReady=t.dbReady.then(function(){return r.promise}):t.dbReady=r.promise}function j(e){var t=U[e.name],r=t.deferredOperations.pop();if(r)return r.resolve(),r.promise}function J(e,t){var r=U[e.name],o=r.deferredOperations.pop();if(o)return o.reject(t),o.promise}function $(e,t){return new m(function(r,o){if(U[e.name]=U[e.name]||G(),e.db)if(t)H(e),e.db.close();else return r(e.db);var i=[e.name];t&&i.push(e.version);var n=P.open.apply(P,i);t&&(n.onupgradeneeded=function(f){var u=n.result;try{u.createObjectStore(e.storeName),f.oldVersion<=1&&u.createObjectStore(F)}catch(c){if(c.name==="ConstraintError")console.warn('The database "'+e.name+'" has been upgraded from version '+f.oldVersion+" to version "+f.newVersion+', but the storage "'+e.storeName+'" already exists.');else throw c}}),n.onerror=function(f){f.preventDefault(),o(n.error)},n.onsuccess=function(){r(n.result),j(e)}})}function ee(e){return $(e,!1)}function fe(e){return $(e,!0)}function a(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),o=e.version<e.db.version,i=e.version>e.db.version;if(o&&(e.version!==t&&console.warn('The database "'+e.name+`" can't be downgraded from version `+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||r){if(r){var n=e.db.version+1;n>e.version&&(e.version=n)}return!0}return!1}function s(e){return new m(function(t,r){var o=new FileReader;o.onerror=r,o.onloadend=function(i){var n=btoa(i.target.result||"");t({__local_forage_encoded_blob:!0,data:n,type:e.type})},o.readAsBinaryString(e)})}function v(e){var t=D(atob(e.data));return Z([t],{type:e.type})}function b(e){return e&&e.__local_forage_encoded_blob}function _(e){var t=this,r=t._initReady().then(function(){var o=U[t._dbInfo.name];if(o&&o.dbReady)return o.dbReady});return T(r,e,e),r}function E(e){H(e);for(var t=U[e.name],r=t.forages,o=0;o<r.length;o++){var i=r[o];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null)}return e.db=null,ee(e).then(function(n){return e.db=n,a(e)?fe(e):n}).then(function(n){e.db=t.db=n;for(var f=0;f<r.length;f++)r[f]._dbInfo.db=n}).catch(function(n){throw J(e,n),n})}function N(e,t,r,o){o===void 0&&(o=1);try{var i=e.db.transaction(e.storeName,t);r(null,i)}catch(n){if(o>0&&(!e.db||n.name==="InvalidStateError"||n.name==="NotFoundError"))return m.resolve().then(function(){if(!e.db||n.name==="NotFoundError"&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),fe(e)}).then(function(){return E(e).then(function(){N(e,t,r,o-1)})}).catch(r);r(n)}}function G(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function ce(e){var t=this,r={db:null};if(e)for(var o in e)r[o]=e[o];var i=U[r.name];i||(i=G(),U[r.name]=i),i.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=_);var n=[];function f(){return m.resolve()}for(var u=0;u<i.forages.length;u++){var c=i.forages[u];c!==t&&n.push(c._initReady().catch(f))}var l=i.forages.slice(0);return m.all(n).then(function(){return r.db=i.db,ee(r)}).then(function(d){return r.db=d,a(r,t._defaultConfig.version)?fe(r):d}).then(function(d){r.db=i.db=d,t._dbInfo=r;for(var y=0;y<l.length;y++){var A=l[y];A!==t&&(A._dbInfo.db=r.db,A._dbInfo.version=r.version)}})}function ue(e,t){var r=this;e=z(e);var o=new m(function(i,n){r.ready().then(function(){N(r._dbInfo,ne,function(f,u){if(f)return n(f);try{var c=u.objectStore(r._dbInfo.storeName),l=c.get(e);l.onsuccess=function(){var d=l.result;d===void 0&&(d=null),b(d)&&(d=v(d)),i(d)},l.onerror=function(){n(l.error)}}catch(d){n(d)}})}).catch(n)});return w(o,t),o}function ve(e,t){var r=this,o=new m(function(i,n){r.ready().then(function(){N(r._dbInfo,ne,function(f,u){if(f)return n(f);try{var c=u.objectStore(r._dbInfo.storeName),l=c.openCursor(),d=1;l.onsuccess=function(){var y=l.result;if(y){var A=y.value;b(A)&&(A=v(A));var B=e(A,y.key,d++);B!==void 0?i(B):y.continue()}else i()},l.onerror=function(){n(l.error)}}catch(y){n(y)}})}).catch(n)});return w(o,t),o}function ar(e,t,r){var o=this;e=z(e);var i=new m(function(n,f){var u;o.ready().then(function(){return u=o._dbInfo,se.call(t)==="[object Blob]"?x(u.db).then(function(c){return c?t:s(t)}):t}).then(function(c){N(o._dbInfo,h,function(l,d){if(l)return f(l);try{var y=d.objectStore(o._dbInfo.storeName);c===null&&(c=void 0);var A=y.put(c,e);d.oncomplete=function(){c===void 0&&(c=null),n(c)},d.onabort=d.onerror=function(){var B=A.error?A.error:A.transaction.error;f(B)}}catch(B){f(B)}})}).catch(f)});return w(i,r),i}function fr(e,t){var r=this;e=z(e);var o=new m(function(i,n){r.ready().then(function(){N(r._dbInfo,h,function(f,u){if(f)return n(f);try{var c=u.objectStore(r._dbInfo.storeName),l=c.delete(e);u.oncomplete=function(){i()},u.onerror=function(){n(l.error)},u.onabort=function(){var d=l.error?l.error:l.transaction.error;n(d)}}catch(d){n(d)}})}).catch(n)});return w(o,t),o}function ur(e){var t=this,r=new m(function(o,i){t.ready().then(function(){N(t._dbInfo,h,function(n,f){if(n)return i(n);try{var u=f.objectStore(t._dbInfo.storeName),c=u.clear();f.oncomplete=function(){o()},f.onabort=f.onerror=function(){var l=c.error?c.error:c.transaction.error;i(l)}}catch(l){i(l)}})}).catch(i)});return w(r,e),r}function sr(e){var t=this,r=new m(function(o,i){t.ready().then(function(){N(t._dbInfo,ne,function(n,f){if(n)return i(n);try{var u=f.objectStore(t._dbInfo.storeName),c=u.count();c.onsuccess=function(){o(c.result)},c.onerror=function(){i(c.error)}}catch(l){i(l)}})}).catch(i)});return w(r,e),r}function cr(e,t){var r=this,o=new m(function(i,n){if(e<0){i(null);return}r.ready().then(function(){N(r._dbInfo,ne,function(f,u){if(f)return n(f);try{var c=u.objectStore(r._dbInfo.storeName),l=!1,d=c.openKeyCursor();d.onsuccess=function(){var y=d.result;if(!y){i(null);return}e===0||l?i(y.key):(l=!0,y.advance(e))},d.onerror=function(){n(d.error)}}catch(y){n(y)}})}).catch(n)});return w(o,t),o}function lr(e){var t=this,r=new m(function(o,i){t.ready().then(function(){N(t._dbInfo,ne,function(n,f){if(n)return i(n);try{var u=f.objectStore(t._dbInfo.storeName),c=u.openKeyCursor(),l=[];c.onsuccess=function(){var d=c.result;if(!d){o(l);return}l.push(d.key),d.continue()},c.onerror=function(){i(c.error)}}catch(d){i(d)}})}).catch(i)});return w(r,e),r}function dr(e,t){t=q.apply(this,arguments);var r=this.config();e=typeof e!="function"&&e||{},e.name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var o=this,i;if(!e.name)i=m.reject("Invalid arguments");else{var n=e.name===r.name&&o._dbInfo.db,f=n?m.resolve(o._dbInfo.db):ee(e).then(function(u){var c=U[e.name],l=c.forages;c.db=u;for(var d=0;d<l.length;d++)l[d]._dbInfo.db=u;return u});e.storeName?i=f.then(function(u){if(!!u.objectStoreNames.contains(e.storeName)){var c=u.version+1;H(e);var l=U[e.name],d=l.forages;u.close();for(var y=0;y<d.length;y++){var A=d[y];A._dbInfo.db=null,A._dbInfo.version=c}var B=new m(function(O,V){var W=P.open(e.name,c);W.onerror=function(X){var me=W.result;me.close(),V(X)},W.onupgradeneeded=function(){var X=W.result;X.deleteObjectStore(e.storeName)},W.onsuccess=function(){var X=W.result;X.close(),O(X)}});return B.then(function(O){l.db=O;for(var V=0;V<d.length;V++){var W=d[V];W._dbInfo.db=O,j(W._dbInfo)}}).catch(function(O){throw(J(e,O)||m.resolve()).catch(function(){}),O})}}):i=f.then(function(u){H(e);var c=U[e.name],l=c.forages;u.close();for(var d=0;d<l.length;d++){var y=l[d];y._dbInfo.db=null}var A=new m(function(B,O){var V=P.deleteDatabase(e.name);V.onerror=V.onblocked=function(W){var X=V.result;X&&X.close(),O(W)},V.onsuccess=function(){var W=V.result;W&&W.close(),B(W)}});return A.then(function(B){c.db=B;for(var O=0;O<l.length;O++){var V=l[O];j(V._dbInfo)}}).catch(function(B){throw(J(e,B)||m.resolve()).catch(function(){}),B})})}return w(i,t),i}var vr={_driver:"asyncStorage",_initStorage:ce,_support:K(),iterate:ve,getItem:ue,setItem:ar,removeItem:fr,clear:ur,length:sr,key:cr,keys:lr,dropInstance:dr};function hr(){return typeof openDatabase=="function"}var ie="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mr="~~local_forage_type~",Le=/^~~local_forage_type~([^~]+)~/,ye="__lfsc__:",Ee=ye.length,Ie="arbf",Se="blob",Pe="si08",Me="ui08",Fe="uic8",Ue="si16",Ye="si32",ze="ur16",We="ui32",Ke="fl32",He="fl64",Ve=Ee+Ie.length,Ge=Object.prototype.toString;function je(e){var t=e.length*.75,r=e.length,o,i=0,n,f,u,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var l=new ArrayBuffer(t),d=new Uint8Array(l);for(o=0;o<r;o+=4)n=ie.indexOf(e[o]),f=ie.indexOf(e[o+1]),u=ie.indexOf(e[o+2]),c=ie.indexOf(e[o+3]),d[i++]=n<<2|f>>4,d[i++]=(f&15)<<4|u>>2,d[i++]=(u&3)<<6|c&63;return l}function Ae(e){var t=new Uint8Array(e),r="",o;for(o=0;o<t.length;o+=3)r+=ie[t[o]>>2],r+=ie[(t[o]&3)<<4|t[o+1]>>4],r+=ie[(t[o+1]&15)<<2|t[o+2]>>6],r+=ie[t[o+2]&63];return t.length%3===2?r=r.substring(0,r.length-1)+"=":t.length%3===1&&(r=r.substring(0,r.length-2)+"=="),r}function yr(e,t){var r="";if(e&&(r=Ge.call(e)),e&&(r==="[object ArrayBuffer]"||e.buffer&&Ge.call(e.buffer)==="[object ArrayBuffer]")){var o,i=ye;e instanceof ArrayBuffer?(o=e,i+=Ie):(o=e.buffer,r==="[object Int8Array]"?i+=Pe:r==="[object Uint8Array]"?i+=Me:r==="[object Uint8ClampedArray]"?i+=Fe:r==="[object Int16Array]"?i+=Ue:r==="[object Uint16Array]"?i+=ze:r==="[object Int32Array]"?i+=Ye:r==="[object Uint32Array]"?i+=We:r==="[object Float32Array]"?i+=Ke:r==="[object Float64Array]"?i+=He:t(new Error("Failed to get type for BinaryArray"))),t(i+Ae(o))}else if(r==="[object Blob]"){var n=new FileReader;n.onload=function(){var f=mr+e.type+"~"+Ae(this.result);t(ye+Se+f)},n.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(f){console.error("Couldn't convert value into a JSON string: ",e),t(null,f)}}function pr(e){if(e.substring(0,Ee)!==ye)return JSON.parse(e);var t=e.substring(Ve),r=e.substring(Ee,Ve),o;if(r===Se&&Le.test(t)){var i=t.match(Le);o=i[1],t=t.substring(i[0].length)}var n=je(t);switch(r){case Ie:return n;case Se:return Z([n],{type:o});case Pe:return new Int8Array(n);case Me:return new Uint8Array(n);case Fe:return new Uint8ClampedArray(n);case Ue:return new Int16Array(n);case ze:return new Uint16Array(n);case Ye:return new Int32Array(n);case We:return new Uint32Array(n);case Ke:return new Float32Array(n);case He:return new Float64Array(n);default:throw new Error("Unkown type: "+r)}}var Re={serialize:yr,deserialize:pr,stringToBuffer:je,bufferToString:Ae};function Xe(e,t,r,o){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,o)}function gr(e){var t=this,r={db:null};if(e)for(var o in e)r[o]=typeof e[o]!="string"?e[o].toString():e[o];var i=new m(function(n,f){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(u){return f(u)}r.db.transaction(function(u){Xe(u,r,function(){t._dbInfo=r,n()},function(c,l){f(l)})},f)});return r.serializer=Re,i}function ae(e,t,r,o,i,n){e.executeSql(r,o,i,function(f,u){u.code===u.SYNTAX_ERR?f.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],function(c,l){l.rows.length?n(c,u):Xe(c,t,function(){c.executeSql(r,o,i,n)},n)},n):n(f,u)},n)}function br(e,t){var r=this;e=z(e);var o=new m(function(i,n){r.ready().then(function(){var f=r._dbInfo;f.db.transaction(function(u){ae(u,f,"SELECT * FROM "+f.storeName+" WHERE key = ? LIMIT 1",[e],function(c,l){var d=l.rows.length?l.rows.item(0).value:null;d&&(d=f.serializer.deserialize(d)),i(d)},function(c,l){n(l)})})}).catch(n)});return w(o,t),o}function _r(e,t){var r=this,o=new m(function(i,n){r.ready().then(function(){var f=r._dbInfo;f.db.transaction(function(u){ae(u,f,"SELECT * FROM "+f.storeName,[],function(c,l){for(var d=l.rows,y=d.length,A=0;A<y;A++){var B=d.item(A),O=B.value;if(O&&(O=f.serializer.deserialize(O)),O=e(O,B.key,A+1),O!==void 0){i(O);return}}i()},function(c,l){n(l)})})}).catch(n)});return w(o,t),o}function Qe(e,t,r,o){var i=this;e=z(e);var n=new m(function(f,u){i.ready().then(function(){t===void 0&&(t=null);var c=t,l=i._dbInfo;l.serializer.serialize(t,function(d,y){y?u(y):l.db.transaction(function(A){ae(A,l,"INSERT OR REPLACE INTO "+l.storeName+" (key, value) VALUES (?, ?)",[e,d],function(){f(c)},function(B,O){u(O)})},function(A){if(A.code===A.QUOTA_ERR){if(o>0){f(Qe.apply(i,[e,c,r,o-1]));return}u(A)}})})}).catch(u)});return w(n,r),n}function wr(e,t,r){return Qe.apply(this,[e,t,r,1])}function Er(e,t){var r=this;e=z(e);var o=new m(function(i,n){r.ready().then(function(){var f=r._dbInfo;f.db.transaction(function(u){ae(u,f,"DELETE FROM "+f.storeName+" WHERE key = ?",[e],function(){i()},function(c,l){n(l)})})}).catch(n)});return w(o,t),o}function Ir(e){var t=this,r=new m(function(o,i){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(f){ae(f,n,"DELETE FROM "+n.storeName,[],function(){o()},function(u,c){i(c)})})}).catch(i)});return w(r,e),r}function Sr(e){var t=this,r=new m(function(o,i){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(f){ae(f,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],function(u,c){var l=c.rows.item(0).c;o(l)},function(u,c){i(c)})})}).catch(i)});return w(r,e),r}function Ar(e,t){var r=this,o=new m(function(i,n){r.ready().then(function(){var f=r._dbInfo;f.db.transaction(function(u){ae(u,f,"SELECT key FROM "+f.storeName+" WHERE id = ? LIMIT 1",[e+1],function(c,l){var d=l.rows.length?l.rows.item(0).key:null;i(d)},function(c,l){n(l)})})}).catch(n)});return w(o,t),o}function Rr(e){var t=this,r=new m(function(o,i){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(f){ae(f,n,"SELECT key FROM "+n.storeName,[],function(u,c){for(var l=[],d=0;d<c.rows.length;d++)l.push(c.rows.item(d).key);o(l)},function(u,c){i(c)})})}).catch(i)});return w(r,e),r}function Dr(e){return new m(function(t,r){e.transaction(function(o){o.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(i,n){for(var f=[],u=0;u<n.rows.length;u++)f.push(n.rows.item(u).name);t({db:e,storeNames:f})},function(i,n){r(n)})},function(o){r(o)})})}function Nr(e,t){t=q.apply(this,arguments);var r=this.config();e=typeof e!="function"&&e||{},e.name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var o=this,i;return e.name?i=new m(function(n){var f;e.name===r.name?f=o._dbInfo.db:f=openDatabase(e.name,"","",0),e.storeName?n({db:f,storeNames:[e.storeName]}):n(Dr(f))}).then(function(n){return new m(function(f,u){n.db.transaction(function(c){function l(B){return new m(function(O,V){c.executeSql("DROP TABLE IF EXISTS "+B,[],function(){O()},function(W,X){V(X)})})}for(var d=[],y=0,A=n.storeNames.length;y<A;y++)d.push(l(n.storeNames[y]));m.all(d).then(function(){f()}).catch(function(B){u(B)})},function(c){u(c)})})}):i=m.reject("Invalid arguments"),w(i,t),i}var Tr={_driver:"webSQLStorage",_initStorage:gr,_support:hr(),iterate:_r,getItem:br,setItem:wr,removeItem:Er,clear:Ir,length:Sr,key:Ar,keys:Rr,dropInstance:Nr};function Br(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Je(e,t){var r=e.name+"/";return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}function xr(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return!0}}function Or(){return!xr()||localStorage.length>0}function Cr(e){var t=this,r={};if(e)for(var o in e)r[o]=e[o];return r.keyPrefix=Je(e,t._defaultConfig),Or()?(t._dbInfo=r,r.serializer=Re,m.resolve()):m.reject()}function Lr(e){var t=this,r=t.ready().then(function(){for(var o=t._dbInfo.keyPrefix,i=localStorage.length-1;i>=0;i--){var n=localStorage.key(i);n.indexOf(o)===0&&localStorage.removeItem(n)}});return w(r,e),r}function Pr(e,t){var r=this;e=z(e);var o=r.ready().then(function(){var i=r._dbInfo,n=localStorage.getItem(i.keyPrefix+e);return n&&(n=i.serializer.deserialize(n)),n});return w(o,t),o}function Mr(e,t){var r=this,o=r.ready().then(function(){for(var i=r._dbInfo,n=i.keyPrefix,f=n.length,u=localStorage.length,c=1,l=0;l<u;l++){var d=localStorage.key(l);if(d.indexOf(n)===0){var y=localStorage.getItem(d);if(y&&(y=i.serializer.deserialize(y)),y=e(y,d.substring(f),c++),y!==void 0)return y}}});return w(o,t),o}function Fr(e,t){var r=this,o=r.ready().then(function(){var i=r._dbInfo,n;try{n=localStorage.key(e)}catch{n=null}return n&&(n=n.substring(i.keyPrefix.length)),n});return w(o,t),o}function Ur(e){var t=this,r=t.ready().then(function(){for(var o=t._dbInfo,i=localStorage.length,n=[],f=0;f<i;f++){var u=localStorage.key(f);u.indexOf(o.keyPrefix)===0&&n.push(u.substring(o.keyPrefix.length))}return n});return w(r,e),r}function Yr(e){var t=this,r=t.keys().then(function(o){return o.length});return w(r,e),r}function zr(e,t){var r=this;e=z(e);var o=r.ready().then(function(){var i=r._dbInfo;localStorage.removeItem(i.keyPrefix+e)});return w(o,t),o}function Wr(e,t,r){var o=this;e=z(e);var i=o.ready().then(function(){t===void 0&&(t=null);var n=t;return new m(function(f,u){var c=o._dbInfo;c.serializer.serialize(t,function(l,d){if(d)u(d);else try{localStorage.setItem(c.keyPrefix+e,l),f(n)}catch(y){(y.name==="QuotaExceededError"||y.name==="NS_ERROR_DOM_QUOTA_REACHED")&&u(y),u(y)}})})});return w(i,r),i}function Kr(e,t){if(t=q.apply(this,arguments),e=typeof e!="function"&&e||{},!e.name){var r=this.config();e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}var o=this,i;return e.name?i=new m(function(n){e.storeName?n(Je(e,o._defaultConfig)):n(e.name+"/")}).then(function(n){for(var f=localStorage.length-1;f>=0;f--){var u=localStorage.key(f);u.indexOf(n)===0&&localStorage.removeItem(u)}}):i=m.reject("Invalid arguments"),w(i,t),i}var Hr={_driver:"localStorageWrapper",_initStorage:Cr,_support:Br(),iterate:Mr,getItem:Pr,setItem:Wr,removeItem:zr,clear:Lr,length:Yr,key:Fr,keys:Ur,dropInstance:Kr},Vr=function(t,r){return t===r||typeof t=="number"&&typeof r=="number"&&isNaN(t)&&isNaN(r)},Gr=function(t,r){for(var o=t.length,i=0;i<o;){if(Vr(t[i],r))return!0;i++}return!1},$e=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"},he={},Ze={},le={INDEXEDDB:vr,WEBSQL:Tr,LOCALSTORAGE:Hr},jr=[le.INDEXEDDB._driver,le.WEBSQL._driver,le.LOCALSTORAGE._driver],pe=["dropInstance"],De=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(pe),Xr={description:"",driver:jr.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Qr(e,t){e[t]=function(){var r=arguments;return e.ready().then(function(){return e[t].apply(e,r)})}}function Ne(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var r in t)t.hasOwnProperty(r)&&($e(t[r])?arguments[0][r]=t[r].slice():arguments[0][r]=t[r])}return arguments[0]}var Jr=function(){function e(t){Y(this,e);for(var r in le)if(le.hasOwnProperty(r)){var o=le[r],i=o._driver;this[r]=i,he[i]||this.defineDriver(o)}this._defaultConfig=Ne({},Xr),this._config=Ne({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return e.prototype.config=function(r){if((typeof r=="undefined"?"undefined":C(r))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var o in r){if(o==="storeName"&&(r[o]=r[o].replace(/\W/g,"_")),o==="version"&&typeof r[o]!="number")return new Error("Database version must be a number.");this._config[o]=r[o]}return"driver"in r&&r.driver?this.setDriver(this._config.driver):!0}else return typeof r=="string"?this._config[r]:this._config},e.prototype.defineDriver=function(r,o,i){var n=new m(function(f,u){try{var c=r._driver,l=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!r._driver){u(l);return}for(var d=De.concat("_initStorage"),y=0,A=d.length;y<A;y++){var B=d[y],O=!Gr(pe,B);if((O||r[B])&&typeof r[B]!="function"){u(l);return}}var V=function(){for(var me=function(qr){return function(){var kr=new Error("Method "+qr+" is not implemented by the current driver"),qe=m.reject(kr);return w(qe,arguments[arguments.length-1]),qe}},Te=0,Zr=pe.length;Te<Zr;Te++){var Be=pe[Te];r[Be]||(r[Be]=me(Be))}};V();var W=function(me){he[c]&&console.info("Redefining LocalForage driver: "+c),he[c]=r,Ze[c]=me,f()};"_support"in r?r._support&&typeof r._support=="function"?r._support().then(W,u):W(!!r._support):W(!0)}catch(X){u(X)}});return T(n,o,i),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(r,o,i){var n=he[r]?m.resolve(he[r]):m.reject(new Error("Driver not found."));return T(n,o,i),n},e.prototype.getSerializer=function(r){var o=m.resolve(Re);return T(o,r),o},e.prototype.ready=function(r){var o=this,i=o._driverSet.then(function(){return o._ready===null&&(o._ready=o._initDriver()),o._ready});return T(i,r,r),i},e.prototype.setDriver=function(r,o,i){var n=this;$e(r)||(r=[r]);var f=this._getSupportedDrivers(r);function u(){n._config.driver=n.driver()}function c(y){return n._extend(y),u(),n._ready=n._initStorage(n._config),n._ready}function l(y){return function(){var A=0;function B(){for(;A<y.length;){var O=y[A];return A++,n._dbInfo=null,n._ready=null,n.getDriver(O).then(c).catch(B)}u();var V=new Error("No available storage method found.");return n._driverSet=m.reject(V),n._driverSet}return B()}}var d=this._driverSet!==null?this._driverSet.catch(function(){return m.resolve()}):m.resolve();return this._driverSet=d.then(function(){var y=f[0];return n._dbInfo=null,n._ready=null,n.getDriver(y).then(function(A){n._driver=A._driver,u(),n._wrapLibraryMethodsWithReady(),n._initDriver=l(f)})}).catch(function(){u();var y=new Error("No available storage method found.");return n._driverSet=m.reject(y),n._driverSet}),T(this._driverSet,o,i),this._driverSet},e.prototype.supports=function(r){return!!Ze[r]},e.prototype._extend=function(r){Ne(this,r)},e.prototype._getSupportedDrivers=function(r){for(var o=[],i=0,n=r.length;i<n;i++){var f=r[i];this.supports(f)&&o.push(f)}return o},e.prototype._wrapLibraryMethodsWithReady=function(){for(var r=0,o=De.length;r<o;r++)Qr(this,De[r])},e.prototype.createInstance=function(r){return new e(r)},e}(),$r=new Jr;M.exports=$r},{"3":3}]},{},[4])(4)})});var ir=er((be,or)=>{(function(g,p){typeof be=="object"&&typeof or!="undefined"?p(be):typeof define=="function"&&define.amd?define("localforage-driver-memory",["exports"],p):p(g.LocalforageDriverMemory={})})(typeof self!="undefined"?self:be,function(g){"use strict";var p="localforage-driver-memory";function R(a){var s=typeof Symbol=="function"&&a[Symbol.iterator],v=0;return s?s.call(a):{next:function(){return a&&v>=a.length&&(a=void 0),{value:a&&a[v++],done:!a}}}}function L(a,s){a=a||[],s=s||{};try{return new Blob(a,s)}catch(E){if(E.name!=="TypeError")throw E;for(var v=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,b=new v,_=0;_<a.length;_+=1)b.append(a[_]);return b.getBlob(s.type)}}var M=/^~~local_forage_type~([^~]+)~/,Q="__lfsc__:".length,C=Q+"arbf".length,Y=Object.prototype.toString;function S(a){var s=a.length*.75,v=a.length;a[a.length-1]==="="&&(s--,a[a.length-2]==="="&&s--);for(var b=new ArrayBuffer(s),_=new Uint8Array(b),E=0,N=0;E<v;E+=4){var G="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a[E]),ce="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a[E+1]),ue="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a[E+2]),ve="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a[E+3]);_[N++]=G<<2|ce>>4,_[N++]=(ce&15)<<4|ue>>2,_[N++]=(ue&3)<<6|ve&63}return b}function P(a){for(var s=new Uint8Array(a),v="",b=0;b<s.length;b+=3)v+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[s[b]>>2],v+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(s[b]&3)<<4|s[b+1]>>4],v+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(s[b+1]&15)<<2|s[b+2]>>6],v+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[s[b+2]&63];return s.length%3===2?v=v.substring(0,v.length-1)+"=":s.length%3===1&&(v=v.substring(0,v.length-2)+"=="),v}function K(a,s){var v="";if(a&&(v=Y.call(a)),a&&(v==="[object ArrayBuffer]"||a.buffer&&Y.call(a.buffer)==="[object ArrayBuffer]")){var b=void 0,_="__lfsc__:";a instanceof ArrayBuffer?(b=a,_+="arbf"):(b=a.buffer,v==="[object Int8Array]"?_+="si08":v==="[object Uint8Array]"?_+="ui08":v==="[object Uint8ClampedArray]"?_+="uic8":v==="[object Int16Array]"?_+="si16":v==="[object Uint16Array]"?_+="ur16":v==="[object Int32Array]"?_+="si32":v==="[object Uint32Array]"?_+="ui32":v==="[object Float32Array]"?_+="fl32":v==="[object Float64Array]"?_+="fl64":s(new Error("Failed to get type for BinaryArray"))),s(_+P(b))}else if(v==="[object Blob]"){var E=new FileReader;E.onload=function(){var N="~~local_forage_type~"+a.type+"~"+P(this.result);s("__lfsc__:blob"+N)},E.readAsArrayBuffer(a)}else try{s(JSON.stringify(a))}catch(N){console.error("Couldn't convert value into a JSON string: ",a),s(null,N)}}function Z(a){if(a.substring(0,Q)!=="__lfsc__:")return JSON.parse(a);var s=a.substring(C),v=a.substring(Q,C),b;if(v==="blob"&&M.test(s)){var _=s.match(M);b=_[1],s=s.substring(_[0].length)}var E=S(s);switch(v){case"arbf":return E;case"blob":return L([E],{type:b});case"si08":return new Int8Array(E);case"ui08":return new Uint8Array(E);case"uic8":return new Uint8ClampedArray(E);case"si16":return new Int16Array(E);case"ur16":return new Uint16Array(E);case"si32":return new Int32Array(E);case"ui32":return new Uint32Array(E);case"fl32":return new Float32Array(E);case"fl64":return new Float64Array(E);default:throw new Error("Unkown type: "+v)}}function m(a){var s,v;if(a===null||typeof a!="object"||"isActiveClone"in a)return a;var b=a instanceof Date?new Date(a):a.constructor();try{for(var _=R(Object.keys(a)),E=_.next();!E.done;E=_.next()){var N=E.value;Object.prototype.hasOwnProperty.call(a,N)&&(a.isActiveClone=null,b[N]=m(a[N]),delete a.isActiveClone)}}catch(G){s={error:G}}finally{try{E&&!E.done&&(v=_.return)&&v.call(_)}finally{if(s)throw s.error}}return b}function w(a,s){return(a.name||s.name)+"/"+(a.storeName||s.storeName)+"/"}function T(a,s){s&&a.then(function(v){s(null,v)},function(v){s(v)})}function z(){for(var a=[],s=0;s<arguments.length;s++)a[s]=arguments[s];if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}function q(a,s){var v=this;if(s=z.apply(this,arguments),a=typeof a!="function"&&a||{},!a.name){var b=this.config();a.name=a.name||b.name,a.storeName=a.storeName||b.storeName}var _;return a.name?_=new Promise(function(E){a.storeName?E(w(a,v._defaultConfig)):E(a.name+"/")}):_=Promise.reject("Invalid arguments"),{promise:_,callback:s}}function F(a){return typeof a!="string"&&(console.warn(a+" used as a key, but it is not a string."),a=String(a)),a}var k={bufferToString:P,deserialize:Z,serialize:K,stringToBuffer:S},U={},se=function(){function a(s){this.kp=s,this.data={}}return a.resolve=function(s){return U[s]||(U[s]=new a(s)),U[s]},a.prototype.clear=function(){this.data={}},a.prototype.drop=function(){this.clear(),delete U[this.kp]},a.prototype.get=function(s){return this.data[s]},a.prototype.key=function(s){return this.keys()[s]},a.prototype.keys=function(){return Object.keys(this.data)},a.prototype.rm=function(s){delete this.data[s]},a.prototype.set=function(s,v){this.data[s]=v},a}();function ne(a){var s=a?m(a):{},v=w(s,this._defaultConfig),b=se.resolve(v);return this._dbInfo=s,this._dbInfo.serializer=k,this._dbInfo.keyPrefix=v,this._dbInfo.mStore=b,Promise.resolve()}function h(a){var s=this,v=this.ready().then(function(){s._dbInfo.mStore.clear()});return T(v,a),v}function D(a,s){var v=q.apply(this,arguments),b=v.promise,_=v.callback,E=b.then(function(N){se.resolve(N).drop()});return T(E,_),b}function I(a,s){var v=this;a=F(a);var b=this.ready().then(function(){var _=v._dbInfo.mStore.get(a);return _==null?null:v._dbInfo.serializer.deserialize(_)});return T(b,s),b}function x(a,s){var v=this,b=this.ready().then(function(){for(var _=v._dbInfo.mStore,E=_.keys(),N=0;N<E.length;N++){var G=_.get(E[N]);if(G&&(G=v._dbInfo.serializer.deserialize(G)),G=a(G,E[N],N+1),G!==void 0)return G}});return T(b,s),b}function H(a,s){var v=this,b=this.ready().then(function(){var _;try{_=v._dbInfo.mStore.key(a),_===void 0&&(_=null)}catch{_=null}return _});return T(b,s),b}function j(a){var s=this,v=this.ready().then(function(){return s._dbInfo.mStore.keys()});return T(v,a),v}function J(a){var s=this.keys().then(function(v){return v.length});return T(s,a),s}function $(a,s){var v=this;a=F(a);var b=this.ready().then(function(){v._dbInfo.mStore.rm(a)});return T(b,s),b}function ee(a,s,v){var b=this;a=F(a);var _=this.ready().then(function(){s===void 0&&(s=null);var E=s;return new Promise(function(N,G){b._dbInfo.serializer.serialize(s,function(ce,ue){if(ue)G(ue);else try{b._dbInfo.mStore.set(a,ce),N(E)}catch(ve){G(ve)}})})});return T(_,v),_}var fe=!0;g._support=fe,g._driver=p,g._initStorage=ne,g.clear=h,g.dropInstance=D,g.getItem=I,g.iterate=x,g.key=H,g.keys=j,g.length=J,g.removeItem=$,g.setItem=ee,Object.defineProperty(g,"__esModule",{value:!0})})});var te={};it(te,{Magic:()=>ct});var _e=require("@magic-sdk/provider"),we=rr(nr()),Ce=rr(ir());var oe=require("@magic-sdk/provider"),ft={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};function ut(g){for(let[p,R]of Object.entries(ft))g.style[p]=R}function st(g){let p=[].slice.call(document.querySelectorAll(".magic-iframe"));return Boolean(p.find(R=>R.src.includes(g)))}var Oe=class extends oe.ViewController{constructor(){super(...arguments);this.activeElement=null}init(){this.test="hello",this.iframe=new Promise(p=>{let R=()=>{if(st(encodeURIComponent(this.parameters)))(0,oe.createDuplicateIframeWarning)().log();else{let L=document.createElement("iframe");L.classList.add("magic-iframe"),L.dataset.magicIframeLabel=(0,oe.createURL)(this.endpoint).host,L.title="Secure Modal",L.src=(0,oe.createURL)(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href,ut(L),document.body.appendChild(L),p(L)}};["loaded","interactive","complete"].includes(document.readyState)?R():window.addEventListener("load",R,!1)}),window.addEventListener("message",p=>{var R;if(p.origin===this.endpoint&&p.data&&p.data.msgType&&this.messageHandlers.size){p.data.response=(R=p.data.response)!=null?R:{};for(let L of this.messageHandlers.values())L(p)}})}showOverlay(){return de(this,null,function*(){let p=yield this.iframe;p.style.display="block",this.activeElement=document.activeElement,p.focus()})}hideOverlay(){return de(this,null,function*(){var R;let p=yield this.iframe;p.style.display="none",((R=this.activeElement)==null?void 0:R.focus)&&this.activeElement.focus(),this.activeElement=null})}_post(p){return de(this,null,function*(){let R=yield this.iframe;if(R&&R.contentWindow)R.contentWindow.postMessage(p,this.endpoint);else throw(0,oe.createModalNotReadyError)()})}};re(te,require("@magic-sdk/commons"));var ct=(0,_e.createSDK)(_e.SDKBase,{platform:"web",sdkName:"magic-sdk",version:"8.1.0",defaultEndpoint:"https://auth.magic.link/",ViewController:Oe,configureStorage:()=>de(void 0,null,function*(){let g=we.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return yield g.defineDriver(Ce),yield g.setDriver([we.default.INDEXEDDB,we.default.LOCALSTORAGE,Ce._driver]),g})});module.exports=at(te);
2
2
  //# sourceMappingURL=index.js.map