magic-sdk 7.0.0 → 8.0.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,24 @@
1
+ # v8.0.0 (Tue Jan 25 2022)
2
+
3
+ #### 💥 Breaking Change
4
+
5
+ - Switch from `microbundle` to `esbuild` [#220](https://github.com/magiclabs/magic-js/pull/220) ([@smithki](https://github.com/smithki))
6
+
7
+ #### 🐛 Bug Fix
8
+
9
+ - Merge with master ([@smithki](https://github.com/smithki))
10
+ - Merge branch 'master' into feat/faster-builds ([@smithki](https://github.com/smithki))
11
+ - Modify CDN default exports ([@smithki](https://github.com/smithki))
12
+ - Remove comments from README files ([@smithki](https://github.com/smithki))
13
+ - Fix build errors related to isolatedModules ([@smithki](https://github.com/smithki))
14
+ - Replace microbundle with ESBuild ([@smithki](https://github.com/smithki))
15
+
16
+ #### Authors: 1
17
+
18
+ - Ian K Smith ([@smithki](https://github.com/smithki))
19
+
20
+ ---
21
+
1
22
  # v7.0.0 (Tue Dec 14 2021)
2
23
 
3
24
  #### 💥 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)
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 kr=Object.create;var pe=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var rt=Object.getOwnPropertyNames;var tt=Object.getPrototypeOf,nt=Object.prototype.hasOwnProperty;var qe=g=>pe(g,"__esModule",{value:!0});var ke=(g,_)=>()=>(_||g((_={exports:{}}).exports,_),_.exports),ot=(g,_)=>{qe(g);for(var N in _)pe(g,N,{get:_[N],enumerable:!0})},re=(g,_,N)=>{if(_&&typeof _=="object"||typeof _=="function")for(let C of rt(_))!nt.call(g,C)&&C!=="default"&&pe(g,C,{get:()=>_[C],enumerable:!(N=et(_,C))||N.enumerable});return g},me=g=>re(qe(pe(g!=null?kr(tt(g)):{},"default",g&&g.__esModule&&"default"in g?{get:()=>g.default,enumerable:!0}:{value:g,enumerable:!0})),g);var le=(g,_,N)=>new Promise((C,V)=>{var Q=S=>{try{U(N.next(S))}catch(P){V(P)}},L=S=>{try{U(N.throw(S))}catch(P){V(P)}},U=S=>S.done?C(S.value):Promise.resolve(S.value).then(Q,L);U((N=N.apply(g,_)).next())});var rr=ke((er,xe)=>{(function(g){if(typeof er=="object"&&typeof xe!="undefined")xe.exports=g();else if(typeof define=="function"&&define.amd)define([],g);else{var _;typeof window!="undefined"?_=window:typeof global!="undefined"?_=global:typeof self!="undefined"?_=self:_=this,_.localforage=g()}})(function(){var g,_,N;return function C(V,Q,L){function U(W,Z){if(!Q[W]){if(!V[W]){var m=typeof require=="function"&&require;if(!Z&&m)return m(W,!0);if(S)return S(W,!0);var w=new Error("Cannot find module '"+W+"'");throw w.code="MODULE_NOT_FOUND",w}var T=Q[W]={exports:{}};V[W][0].call(T.exports,function(Y){var q=V[W][1][Y];return U(q||Y)},T,T.exports,C,V,Q,L)}return Q[W].exports}for(var S=typeof require=="function"&&require,P=0;P<L.length;P++)U(L[P]);return U}({1:[function(C,V,Q){(function(L){"use strict";var U=L.MutationObserver||L.WebKitMutationObserver,S;if(U){var P=0,W=new U(Y),Z=L.document.createTextNode("");W.observe(Z,{characterData:!0}),S=function(){Z.data=P=++P%2}}else if(!L.setImmediate&&typeof L.MessageChannel!="undefined"){var m=new L.MessageChannel;m.port1.onmessage=Y,S=function(){m.port2.postMessage(0)}}else"document"in L&&"onreadystatechange"in L.document.createElement("script")?S=function(){var M=L.document.createElement("script");M.onreadystatechange=function(){Y(),M.onreadystatechange=null,M.parentNode.removeChild(M),M=null},L.document.documentElement.appendChild(M)}:S=function(){setTimeout(Y,0)};var w,T=[];function Y(){w=!0;for(var M,k,F=T.length;F;){for(k=T,T=[],M=-1;++M<F;)k[M]();F=T.length}w=!1}V.exports=q;function q(M){T.push(M)===1&&!w&&S()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(C,V,Q){"use strict";var L=C(1);function U(){}var S={},P=["REJECTED"],W=["FULFILLED"],Z=["PENDING"];V.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!==U&&q(this,h)}m.prototype.catch=function(h){return this.then(null,h)},m.prototype.then=function(h,R){if(typeof h!="function"&&this.state===W||typeof R!="function"&&this.state===P)return this;var I=new this.constructor(U);if(this.state!==Z){var x=this.state===W?h:R;T(I,x,this.outcome)}else this.queue.push(new w(I,h,R));return I};function w(h,R,I){this.promise=h,typeof R=="function"&&(this.onFulfilled=R,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,R,I){L(function(){var x;try{x=R(I)}catch(K){return S.reject(h,K)}x===h?S.reject(h,new TypeError("Cannot resolve promise with itself")):S.resolve(h,x)})}S.resolve=function(h,R){var I=M(Y,R);if(I.status==="error")return S.reject(h,I.value);var x=I.value;if(x)q(h,x);else{h.state=W,h.outcome=R;for(var K=-1,j=h.queue.length;++K<j;)h.queue[K].callFulfilled(R)}return h},S.reject=function(h,R){h.state=P,h.outcome=R;for(var I=-1,x=h.queue.length;++I<x;)h.queue[I].callRejected(R);return h};function Y(h){var R=h&&h.then;if(h&&(typeof h=="object"||typeof h=="function")&&typeof R=="function")return function(){R.apply(h,arguments)}}function q(h,R){var I=!1;function x($){I||(I=!0,S.reject(h,$))}function K($){I||(I=!0,S.resolve(h,$))}function j(){R(K,x)}var J=M(j);J.status==="error"&&x(J.value)}function M(h,R){var I={};try{I.value=h(R),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(U),h)}m.reject=F;function F(h){var R=new this(U);return S.reject(R,h)}m.all=ue;function ue(h){var R=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 K=new Array(I),j=0,J=-1,$=new this(U);++J<I;)ee(h[J],J);return $;function ee(ae,a){R.resolve(ae).then(s,function(v){x||(x=!0,S.reject($,v))});function s(v){K[a]=v,++j===I&&!x&&(x=!0,S.resolve($,K))}}}m.race=te;function te(h){var R=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 K=-1,j=new this(U);++K<I;)J(h[K]);return j;function J($){R.resolve($).then(function(ee){x||(x=!0,S.resolve(j,ee))},function(ee){x||(x=!0,S.reject(j,ee))})}}},{"1":1}],3:[function(C,V,Q){(function(L){"use strict";typeof L.Promise!="function"&&(L.Promise=C(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"2":2}],4:[function(C,V,Q){"use strict";var L=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 U(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 W(){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"&&C(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 Y(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 M="local-forage-detect-blob-support",k=void 0,F={},ue=Object.prototype.toString,te="readonly",h="readwrite";function R(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(M,h),o=Z([""]);r.objectStore(M).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 K(e){var t=F[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=F[e.name],r=t.deferredOperations.pop();if(r)return r.resolve(),r.promise}function J(e,t){var r=F[e.name],o=r.deferredOperations.pop();if(o)return o.reject(t),o.promise}function $(e,t){return new m(function(r,o){if(F[e.name]=F[e.name]||G(),e.db)if(t)K(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(M)}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 ae(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=R(atob(e.data));return Z([t],{type:e.type})}function p(e){return e&&e.__local_forage_encoded_blob}function b(e){var t=this,r=t._initReady().then(function(){var o=F[t._dbInfo.name];if(o&&o.dbReady)return o.dbReady});return T(r,e,e),r}function E(e){K(e);for(var t=F[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)?ae(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 D(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),ae(e)}).then(function(){return E(e).then(function(){D(e,t,r,o-1)})}).catch(r);r(n)}}function G(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function se(e){var t=this,r={db:null};if(e)for(var o in e)r[o]=e[o];var i=F[r.name];i||(i=G(),F[r.name]=i),i.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=b);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)?ae(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 fe(e,t){var r=this;e=Y(e);var o=new m(function(i,n){r.ready().then(function(){D(r._dbInfo,te,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),p(d)&&(d=v(d)),i(d)},l.onerror=function(){n(l.error)}}catch(d){n(d)}})}).catch(n)});return w(o,t),o}function de(e,t){var r=this,o=new m(function(i,n){r.ready().then(function(){D(r._dbInfo,te,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;p(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 ir(e,t,r){var o=this;e=Y(e);var i=new m(function(n,f){var u;o.ready().then(function(){return u=o._dbInfo,ue.call(t)==="[object Blob]"?x(u.db).then(function(c){return c?t:s(t)}):t}).then(function(c){D(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 ar(e,t){var r=this;e=Y(e);var o=new m(function(i,n){r.ready().then(function(){D(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 fr(e){var t=this,r=new m(function(o,i){t.ready().then(function(){D(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 ur(e){var t=this,r=new m(function(o,i){t.ready().then(function(){D(t._dbInfo,te,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 sr(e,t){var r=this,o=new m(function(i,n){if(e<0){i(null);return}r.ready().then(function(){D(r._dbInfo,te,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 cr(e){var t=this,r=new m(function(o,i){t.ready().then(function(){D(t._dbInfo,te,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 lr(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=F[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;K(e);var l=F[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,H){var z=P.open(e.name,c);z.onerror=function(X){var he=z.result;he.close(),H(X)},z.onupgradeneeded=function(){var X=z.result;X.deleteObjectStore(e.storeName)},z.onsuccess=function(){var X=z.result;X.close(),O(X)}});return B.then(function(O){l.db=O;for(var H=0;H<d.length;H++){var z=d[H];z._dbInfo.db=O,j(z._dbInfo)}}).catch(function(O){throw(J(e,O)||m.resolve()).catch(function(){}),O})}}):i=f.then(function(u){K(e);var c=F[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 H=P.deleteDatabase(e.name);H.onerror=H.onblocked=function(z){var X=H.result;X&&X.close(),O(z)},H.onsuccess=function(){var z=H.result;z&&z.close(),B(z)}});return A.then(function(B){c.db=B;for(var O=0;O<l.length;O++){var H=l[O];j(H._dbInfo)}}).catch(function(B){throw(J(e,B)||m.resolve()).catch(function(){}),B})})}return w(i,t),i}var dr={_driver:"asyncStorage",_initStorage:se,_support:W(),iterate:de,getItem:fe,setItem:ir,removeItem:ar,clear:fr,length:ur,key:sr,keys:cr,dropInstance:lr};function vr(){return typeof openDatabase=="function"}var oe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",hr="~~local_forage_type~",Ce=/^~~local_forage_type~([^~]+)~/,ye="__lfsc__:",Ee=ye.length,Ie="arbf",Se="blob",Le="si08",Pe="ui08",Me="uic8",Fe="si16",Ue="si32",Ye="ur16",ze="ui32",We="fl32",Ke="fl64",He=Ee+Ie.length,Ve=Object.prototype.toString;function Ge(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=oe.indexOf(e[o]),f=oe.indexOf(e[o+1]),u=oe.indexOf(e[o+2]),c=oe.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+=oe[t[o]>>2],r+=oe[(t[o]&3)<<4|t[o+1]>>4],r+=oe[(t[o+1]&15)<<2|t[o+2]>>6],r+=oe[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 mr(e,t){var r="";if(e&&(r=Ve.call(e)),e&&(r==="[object ArrayBuffer]"||e.buffer&&Ve.call(e.buffer)==="[object ArrayBuffer]")){var o,i=ye;e instanceof ArrayBuffer?(o=e,i+=Ie):(o=e.buffer,r==="[object Int8Array]"?i+=Le:r==="[object Uint8Array]"?i+=Pe:r==="[object Uint8ClampedArray]"?i+=Me:r==="[object Int16Array]"?i+=Fe:r==="[object Uint16Array]"?i+=Ye:r==="[object Int32Array]"?i+=Ue:r==="[object Uint32Array]"?i+=ze:r==="[object Float32Array]"?i+=We:r==="[object Float64Array]"?i+=Ke: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=hr+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 yr(e){if(e.substring(0,Ee)!==ye)return JSON.parse(e);var t=e.substring(He),r=e.substring(Ee,He),o;if(r===Se&&Ce.test(t)){var i=t.match(Ce);o=i[1],t=t.substring(i[0].length)}var n=Ge(t);switch(r){case Ie:return n;case Se:return Z([n],{type:o});case Le:return new Int8Array(n);case Pe:return new Uint8Array(n);case Me:return new Uint8ClampedArray(n);case Fe:return new Int16Array(n);case Ye:return new Uint16Array(n);case Ue:return new Int32Array(n);case ze:return new Uint32Array(n);case We:return new Float32Array(n);case Ke:return new Float64Array(n);default:throw new Error("Unkown type: "+r)}}var Re={serialize:mr,deserialize:yr,stringToBuffer:Ge,bufferToString:Ae};function je(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){je(u,r,function(){t._dbInfo=r,n()},function(c,l){f(l)})},f)});return r.serializer=Re,i}function ie(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):je(c,t,function(){c.executeSql(r,o,i,n)},n)},n):n(f,u)},n)}function pr(e,t){var r=this;e=Y(e);var o=new m(function(i,n){r.ready().then(function(){var f=r._dbInfo;f.db.transaction(function(u){ie(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 br(e,t){var r=this,o=new m(function(i,n){r.ready().then(function(){var f=r._dbInfo;f.db.transaction(function(u){ie(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 Xe(e,t,r,o){var i=this;e=Y(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){ie(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(Xe.apply(i,[e,c,r,o-1]));return}u(A)}})})}).catch(u)});return w(n,r),n}function _r(e,t,r){return Xe.apply(this,[e,t,r,1])}function wr(e,t){var r=this;e=Y(e);var o=new m(function(i,n){r.ready().then(function(){var f=r._dbInfo;f.db.transaction(function(u){ie(u,f,"DELETE FROM "+f.storeName+" WHERE key = ?",[e],function(){i()},function(c,l){n(l)})})}).catch(n)});return w(o,t),o}function Er(e){var t=this,r=new m(function(o,i){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(f){ie(f,n,"DELETE FROM "+n.storeName,[],function(){o()},function(u,c){i(c)})})}).catch(i)});return w(r,e),r}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){ie(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 Sr(e,t){var r=this,o=new m(function(i,n){r.ready().then(function(){var f=r._dbInfo;f.db.transaction(function(u){ie(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 Ar(e){var t=this,r=new m(function(o,i){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(f){ie(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 Rr(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 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;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(Rr(f))}).then(function(n){return new m(function(f,u){n.db.transaction(function(c){function l(B){return new m(function(O,H){c.executeSql("DROP TABLE IF EXISTS "+B,[],function(){O()},function(z,X){H(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 Nr={_driver:"webSQLStorage",_initStorage:gr,_support:vr(),iterate:br,getItem:pr,setItem:_r,removeItem:wr,clear:Er,length:Ir,key:Sr,keys:Ar,dropInstance:Dr};function Tr(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Qe(e,t){var r=e.name+"/";return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}function Br(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return!0}}function xr(){return!Br()||localStorage.length>0}function Or(e){var t=this,r={};if(e)for(var o in e)r[o]=e[o];return r.keyPrefix=Qe(e,t._defaultConfig),xr()?(t._dbInfo=r,r.serializer=Re,m.resolve()):m.reject()}function Cr(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 Lr(e,t){var r=this;e=Y(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 Pr(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 Mr(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 Fr(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 Ur(e){var t=this,r=t.keys().then(function(o){return o.length});return w(r,e),r}function Yr(e,t){var r=this;e=Y(e);var o=r.ready().then(function(){var i=r._dbInfo;localStorage.removeItem(i.keyPrefix+e)});return w(o,t),o}function zr(e,t,r){var o=this;e=Y(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 Wr(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(Qe(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 Kr={_driver:"localStorageWrapper",_initStorage:Or,_support:Tr(),iterate:Pr,getItem:Lr,setItem:zr,removeItem:Yr,clear:Cr,length:Ur,key:Mr,keys:Fr,dropInstance:Wr},Hr=function(t,r){return t===r||typeof t=="number"&&typeof r=="number"&&isNaN(t)&&isNaN(r)},Vr=function(t,r){for(var o=t.length,i=0;i<o;){if(Hr(t[i],r))return!0;i++}return!1},Je=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"},ve={},$e={},ce={INDEXEDDB:dr,WEBSQL:Nr,LOCALSTORAGE:Kr},Gr=[ce.INDEXEDDB._driver,ce.WEBSQL._driver,ce.LOCALSTORAGE._driver],ge=["dropInstance"],De=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ge),jr={description:"",driver:Gr.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Xr(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)&&(Je(t[r])?arguments[0][r]=t[r].slice():arguments[0][r]=t[r])}return arguments[0]}var Qr=function(){function e(t){U(this,e);for(var r in ce)if(ce.hasOwnProperty(r)){var o=ce[r],i=o._driver;this[r]=i,ve[i]||this.defineDriver(o)}this._defaultConfig=Ne({},jr),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":L(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=!Vr(ge,B);if((O||r[B])&&typeof r[B]!="function"){u(l);return}}var H=function(){for(var he=function(Zr){return function(){var qr=new Error("Method "+Zr+" is not implemented by the current driver"),Ze=m.reject(qr);return w(Ze,arguments[arguments.length-1]),Ze}},Te=0,$r=ge.length;Te<$r;Te++){var Be=ge[Te];r[Be]||(r[Be]=he(Be))}};H();var z=function(he){ve[c]&&console.info("Redefining LocalForage driver: "+c),ve[c]=r,$e[c]=he,f()};"_support"in r?r._support&&typeof r._support=="function"?r._support().then(z,u):z(!!r._support):z(!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=ve[r]?m.resolve(ve[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;Je(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 H=new Error("No available storage method found.");return n._driverSet=m.reject(H),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!!$e[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++)Xr(this,De[r])},e.prototype.createInstance=function(r){return new e(r)},e}(),Jr=new Qr;V.exports=Jr},{"3":3}]},{},[4])(4)})});var nr=ke((be,tr)=>{(function(g,_){typeof be=="object"&&typeof tr!="undefined"?_(be):typeof define=="function"&&define.amd?define("localforage-driver-memory",["exports"],_):_(g.LocalforageDriverMemory={})})(typeof self!="undefined"?self:be,function(g){"use strict";var _="localforage-driver-memory";function N(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 C(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,p=new v,b=0;b<a.length;b+=1)p.append(a[b]);return p.getBlob(s.type)}}var V=/^~~local_forage_type~([^~]+)~/,Q="__lfsc__:".length,L=Q+"arbf".length,U=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 p=new ArrayBuffer(s),b=new Uint8Array(p),E=0,D=0;E<v;E+=4){var G="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a[E]),se="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a[E+1]),fe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a[E+2]),de="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a[E+3]);b[D++]=G<<2|se>>4,b[D++]=(se&15)<<4|fe>>2,b[D++]=(fe&3)<<6|de&63}return p}function P(a){for(var s=new Uint8Array(a),v="",p=0;p<s.length;p+=3)v+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[s[p]>>2],v+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(s[p]&3)<<4|s[p+1]>>4],v+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(s[p+1]&15)<<2|s[p+2]>>6],v+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[s[p+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 W(a,s){var v="";if(a&&(v=U.call(a)),a&&(v==="[object ArrayBuffer]"||a.buffer&&U.call(a.buffer)==="[object ArrayBuffer]")){var p=void 0,b="__lfsc__:";a instanceof ArrayBuffer?(p=a,b+="arbf"):(p=a.buffer,v==="[object Int8Array]"?b+="si08":v==="[object Uint8Array]"?b+="ui08":v==="[object Uint8ClampedArray]"?b+="uic8":v==="[object Int16Array]"?b+="si16":v==="[object Uint16Array]"?b+="ur16":v==="[object Int32Array]"?b+="si32":v==="[object Uint32Array]"?b+="ui32":v==="[object Float32Array]"?b+="fl32":v==="[object Float64Array]"?b+="fl64":s(new Error("Failed to get type for BinaryArray"))),s(b+P(p))}else if(v==="[object Blob]"){var E=new FileReader;E.onload=function(){var D="~~local_forage_type~"+a.type+"~"+P(this.result);s("__lfsc__:blob"+D)},E.readAsArrayBuffer(a)}else try{s(JSON.stringify(a))}catch(D){console.error("Couldn't convert value into a JSON string: ",a),s(null,D)}}function Z(a){if(a.substring(0,Q)!=="__lfsc__:")return JSON.parse(a);var s=a.substring(L),v=a.substring(Q,L),p;if(v==="blob"&&V.test(s)){var b=s.match(V);p=b[1],s=s.substring(b[0].length)}var E=S(s);switch(v){case"arbf":return E;case"blob":return C([E],{type:p});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 p=a instanceof Date?new Date(a):a.constructor();try{for(var b=N(Object.keys(a)),E=b.next();!E.done;E=b.next()){var D=E.value;Object.prototype.hasOwnProperty.call(a,D)&&(a.isActiveClone=null,p[D]=m(a[D]),delete a.isActiveClone)}}catch(G){s={error:G}}finally{try{E&&!E.done&&(v=b.return)&&v.call(b)}finally{if(s)throw s.error}}return p}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 Y(){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=Y.apply(this,arguments),a=typeof a!="function"&&a||{},!a.name){var p=this.config();a.name=a.name||p.name,a.storeName=a.storeName||p.storeName}var b;return a.name?b=new Promise(function(E){a.storeName?E(w(a,v._defaultConfig)):E(a.name+"/")}):b=Promise.reject("Invalid arguments"),{promise:b,callback:s}}function M(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:W,stringToBuffer:S},F={},ue=function(){function a(s){this.kp=s,this.data={}}return a.resolve=function(s){return F[s]||(F[s]=new a(s)),F[s]},a.prototype.clear=function(){this.data={}},a.prototype.drop=function(){this.clear(),delete F[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 te(a){var s=a?m(a):{},v=w(s,this._defaultConfig),p=ue.resolve(v);return this._dbInfo=s,this._dbInfo.serializer=k,this._dbInfo.keyPrefix=v,this._dbInfo.mStore=p,Promise.resolve()}function h(a){var s=this,v=this.ready().then(function(){s._dbInfo.mStore.clear()});return T(v,a),v}function R(a,s){var v=q.apply(this,arguments),p=v.promise,b=v.callback,E=p.then(function(D){ue.resolve(D).drop()});return T(E,b),p}function I(a,s){var v=this;a=M(a);var p=this.ready().then(function(){var b=v._dbInfo.mStore.get(a);return b==null?null:v._dbInfo.serializer.deserialize(b)});return T(p,s),p}function x(a,s){var v=this,p=this.ready().then(function(){for(var b=v._dbInfo.mStore,E=b.keys(),D=0;D<E.length;D++){var G=b.get(E[D]);if(G&&(G=v._dbInfo.serializer.deserialize(G)),G=a(G,E[D],D+1),G!==void 0)return G}});return T(p,s),p}function K(a,s){var v=this,p=this.ready().then(function(){var b;try{b=v._dbInfo.mStore.key(a),b===void 0&&(b=null)}catch{b=null}return b});return T(p,s),p}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=M(a);var p=this.ready().then(function(){v._dbInfo.mStore.rm(a)});return T(p,s),p}function ee(a,s,v){var p=this;a=M(a);var b=this.ready().then(function(){s===void 0&&(s=null);var E=s;return new Promise(function(D,G){p._dbInfo.serializer.serialize(s,function(se,fe){if(fe)G(fe);else try{p._dbInfo.mStore.set(a,se),D(E)}catch(de){G(de)}})})});return T(b,v),b}var ae=!0;g._support=ae,g._driver=_,g._initStorage=te,g.clear=h,g.dropInstance=R,g.getItem=I,g.iterate=x,g.key=K,g.keys=j,g.length=J,g.removeItem=$,g.setItem=ee,Object.defineProperty(g,"__esModule",{value:!0})})});ot(exports,{Magic:()=>ut});var _e=me(require("@magic-sdk/provider")),we=me(rr()),or=me(nr());var ne=me(require("@magic-sdk/provider")),it={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};function at(g){for(let[_,N]of Object.entries(it))g.style[_]=N}function ft(g){let _=[].slice.call(document.querySelectorAll(".magic-iframe"));return Boolean(_.find(N=>N.src.includes(g)))}var Oe=class extends ne.ViewController{constructor(){super(...arguments);this.activeElement=null}init(){this.test="hello",this.iframe=new Promise(_=>{let N=()=>{if(ft(encodeURIComponent(this.parameters)))(0,ne.createDuplicateIframeWarning)().log();else{let C=document.createElement("iframe");C.classList.add("magic-iframe"),C.dataset.magicIframeLabel=(0,ne.createURL)(this.endpoint).host,C.title="Secure Modal",C.src=(0,ne.createURL)(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href,at(C),document.body.appendChild(C),_(C)}};["loaded","interactive","complete"].includes(document.readyState)?N():window.addEventListener("load",N,!1)}),window.addEventListener("message",_=>{var N;if(_.origin===this.endpoint&&_.data&&_.data.msgType&&this.messageHandlers.size){_.data.response=(N=_.data.response)!=null?N:{};for(let C of this.messageHandlers.values())C(_)}})}showOverlay(){return le(this,null,function*(){let _=yield this.iframe;_.style.display="block",this.activeElement=document.activeElement,_.focus()})}hideOverlay(){return le(this,null,function*(){var N;let _=yield this.iframe;_.style.display="none",((N=this.activeElement)==null?void 0:N.focus)&&this.activeElement.focus(),this.activeElement=null})}_post(_){return le(this,null,function*(){let N=yield this.iframe;if(N&&N.contentWindow)N.contentWindow.postMessage(_,this.endpoint);else throw(0,ne.createModalNotReadyError)()})}};re(exports,me(require("@magic-sdk/commons")));var ut=(0,_e.createSDK)(_e.SDKBase,{platform:"web",sdkName:"magic-sdk",version:"8.0.0",defaultEndpoint:"https://auth.magic.link/",ViewController:Oe,configureStorage:()=>le(void 0,null,function*(){let g=we.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return yield g.defineDriver(or),yield g.setDriver([we.default.INDEXEDDB,we.default.LOCALSTORAGE,or._driver]),g})});
2
2
  //# sourceMappingURL=index.js.map