@amedia/user 0.13.12 → 0.13.15
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/README.md +17 -9
- package/build.js +25 -0
- package/dist/clients/mercury.d.ts +0 -7
- package/dist/clients/mercuryLog.d.ts +7 -0
- package/dist/index.d.ts +696 -17
- package/dist/index.esm.js +15 -0
- package/dist/index.esm.js.map +7 -0
- package/dist/index.js +15 -2
- package/dist/index.js.map +7 -0
- package/dist/lib/UserDataRequest.spec.d.ts +1 -0
- package/eik.json +5 -4
- package/package.json +30 -39
- package/src/actions/userData.ts +7 -9
- package/src/clients/jupiter.spec.ts +1 -3
- package/src/clients/mercury.spec.ts +2 -23
- package/src/clients/mercury.ts +17 -59
- package/src/clients/mercuryLog.spec.ts +30 -0
- package/src/clients/mercuryLog.ts +56 -0
- package/src/clients/pluto.spec.ts +2 -5
- package/src/lib/UserDataRequest.spec.ts +71 -0
- package/src/utils/log.ts +1 -1
- package/tsconfig.eslint.json +2 -4
- package/tsconfig.json +2 -1
- package/amedia-user-js.iml +0 -9
- package/dist/cache/engines/indexeddb.d.ts +0 -7
- package/dist/index.js.LICENSE.txt +0 -14
- package/dist/lib/PaywallUnlocker.d.ts +0 -16
- package/dist/lib/PaywallUnlocker.spec.d.ts +0 -4
- package/dist/lib/User.d.ts +0 -21
- package/dist/utils/logValidationError.d.ts +0 -1
- package/rollup.config.js +0 -14
- package/test.html +0 -12
- package/webpack.config.js +0 -28
- /package/dist/{janitor/index.spec.d.ts → clients/mercuryLog.spec.d.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
var e={808:(e,t,n)=>{var r,o,i;void 0===(o="function"==typeof(r=i=function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function o(){}function i(t,n,i){if("undefined"!=typeof document){"number"==typeof(i=e({path:"/"},o.defaults,i)).expires&&(i.expires=new Date(1*new Date+864e5*i.expires)),i.expires=i.expires?i.expires.toUTCString():"";try{var a=JSON.stringify(n);/^[\{\[]/.test(a)&&(n=a)}catch(e){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var s="";for(var c in i)i[c]&&(s+="; "+c,!0!==i[c]&&(s+="="+i[c].split(";")[0]));return document.cookie=t+"="+n+s}}function a(e,n){if("undefined"!=typeof document){for(var o={},i=document.cookie?document.cookie.split("; "):[],a=0;a<i.length;a++){var s=i[a].split("="),c=s.slice(1).join("=");n||'"'!==c.charAt(0)||(c=c.slice(1,-1));try{var u=t(s[0]);if(c=(r.read||r)(c,u)||t(c),n)try{c=JSON.parse(c)}catch(e){}if(o[u]=c,e===u)break}catch(e){}}return e?o[e]:o}}return o.set=i,o.get=function(e){return a(e,!1)},o.getJSON=function(e){return a(e,!0)},o.remove=function(t,n){i(t,"",e(n,{expires:-1}))},o.defaults={},o.withConverter=n,o}((function(){}))})?r.call(t,n,t,e):r)||(e.exports=o),e.exports=i()},483:(e,t,n)=>{e.exports=function e(t,n,r){function o(a,s){if(!n[a]){if(!t[a]){if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[a]={exports:{}};t[a][0].call(u.exports,(function(e){return o(t[a][1][e]||e)}),u,u.exports,e,t,n,r)}return n[a].exports}for(var i=void 0,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(e,t,r){(function(e){var n,r,o=e.MutationObserver||e.WebKitMutationObserver;if(o){var i=0,a=new o(f),s=e.document.createTextNode("");a.observe(s,{characterData:!0}),n=function(){s.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){f(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(f,0)};else{var c=new e.MessageChannel;c.port1.onmessage=f,n=function(){c.port2.postMessage(0)}}var u=[];function f(){var e,t;r=!0;for(var n=u.length;n;){for(t=u,u=[],e=-1;++e<n;)t[e]();n=u.length}r=!1}t.exports=function(e){1!==u.push(e)||r||n()}}).call(this,void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){var r=e(1);function o(){}var i={},a=["REJECTED"],s=["FULFILLED"],c=["PENDING"];function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==o&&v(this,e)}function f(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function l(e,t,n){r((function(){var r;try{r=t(n)}catch(t){return i.reject(e,t)}r===e?i.reject(e,new TypeError("Cannot resolve promise with itself")):i.resolve(e,r)}))}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 v(e,t){var n=!1;function r(t){n||(n=!0,i.reject(e,t))}function o(t){n||(n=!0,i.resolve(e,t))}var a=h((function(){t(o,r)}));"error"===a.status&&r(a.value)}function h(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}t.exports=u,u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===s||"function"!=typeof t&&this.state===a)return this;var n=new this.constructor(o);return this.state!==c?l(n,this.state===s?e:t,this.outcome):this.queue.push(new f(n,e,t)),n},f.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},f.prototype.otherCallFulfilled=function(e){l(this.promise,this.onFulfilled,e)},f.prototype.callRejected=function(e){i.reject(this.promise,e)},f.prototype.otherCallRejected=function(e){l(this.promise,this.onRejected,e)},i.resolve=function(e,t){var n=h(d,t);if("error"===n.status)return i.reject(e,n.value);var r=n.value;if(r)v(e,r);else{e.state=s,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 n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},u.resolve=function(e){return e instanceof this?e:i.resolve(new this(o),e)},u.reject=function(e){var t=new this(o);return i.reject(t,e)},u.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var a=new Array(n),s=0,c=-1,u=new this(o);++c<n;)f(e[c],c);return u;function f(e,o){t.resolve(e).then((function(e){a[o]=e,++s!==n||r||(r=!0,i.resolve(u,a))}),(function(e){r||(r=!0,i.reject(u,e))}))}},u.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n,r=e.length,a=!1;if(!r)return this.resolve([]);for(var s=-1,c=new this(o);++s<r;)n=e[s],t.resolve(n).then((function(e){a||(a=!0,i.resolve(c,e))}),(function(e){a||(a=!0,i.reject(c,e))}));return c}},{1:1}],3:[function(e,t,r){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){var r="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};var 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 n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<e.length;r+=1)n.append(e[r]);return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var a=Promise;function s(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function c(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function u(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",d=void 0,v={},h=Object.prototype.toString,p="readonly",y="readwrite";function g(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),o=0;o<t;o++)r[o]=e.charCodeAt(o);return n}function m(e){return"boolean"==typeof d?a.resolve(d):function(e){return new a((function(t){var n=e.transaction(l,y),r=i([""]);n.objectStore(l).put(r,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}(e).then((function(e){return d=e}))}function b(e){var t=v[e.name],n={};n.promise=new a((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function E(e){var t=v[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function _(e,t){var n=v[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function w(e,t){return new a((function(n,r){if(v[e.name]=v[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(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 n=a.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(l)}catch(n){if("ConstraintError"!==n.name)throw n;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(),r(a.error)},a.onsuccess=function(){n(a.result),E(e)}}))}function S(e){return w(e,!1)}function R(e){return w(e,!0)}function O(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),r=e.version<e.db.version,o=e.version>e.db.version;if(r&&(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),o||n){if(n){var i=e.db.version+1;i>e.version&&(e.version=i)}return!0}return!1}function C(e){return i([g(atob(e.data))],{type:e.type})}function T(e){return e&&e.__local_forage_encoded_blob}function I(e){var t=this,n=t._initReady().then((function(){var e=v[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return c(n,e,e),n}function A(e,t,n,r){void 0===r&&(r=1);try{var o=e.db.transaction(e.storeName,t);n(null,o)}catch(o){if(r>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),R(e)})).then((function(){return function(e){b(e);for(var t=v[e.name],n=t.forages,r=0;r<n.length;r++){var o=n[r];o._dbInfo.db&&(o._dbInfo.db.close(),o._dbInfo.db=null)}return e.db=null,S(e).then((function(t){return e.db=t,O(e)?R(e):t})).then((function(r){e.db=t.db=r;for(var o=0;o<n.length;o++)n[o]._dbInfo.db=r})).catch((function(t){throw _(e,t),t}))}(e).then((function(){A(e,t,n,r-1)}))})).catch(n);n(o)}}var N={_driver:"asyncStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]=e[r];var o=v[n.name];o||(o={forages:[],db:null,dbReady:null,deferredOperations:[]},v[n.name]=o),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=I);var i=[];function s(){return a.resolve()}for(var c=0;c<o.forages.length;c++){var u=o.forages[c];u!==t&&i.push(u._initReady().catch(s))}var f=o.forages.slice(0);return a.all(i).then((function(){return n.db=o.db,S(n)})).then((function(e){return n.db=e,O(n,t._defaultConfig.version)?R(n):e})).then((function(e){n.db=o.db=e,t._dbInfo=n;for(var r=0;r<f.length;r++){var i=f[r];i!==t&&(i._dbInfo.db=n.db,i._dbInfo.version=n.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 n=this,r=new a((function(t,r){n.ready().then((function(){A(n._dbInfo,p,(function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName).openCursor(),s=1;a.onsuccess=function(){var n=a.result;if(n){var r=n.value;T(r)&&(r=C(r));var o=e(r,n.key,s++);void 0!==o?t(o):n.continue()}else t()},a.onerror=function(){r(a.error)}}catch(e){r(e)}}))})).catch(r)}));return s(r,t),r},getItem:function(e,t){var n=this;e=u(e);var r=new a((function(t,r){n.ready().then((function(){A(n._dbInfo,p,(function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName).get(e);a.onsuccess=function(){var e=a.result;void 0===e&&(e=null),T(e)&&(e=C(e)),t(e)},a.onerror=function(){r(a.error)}}catch(e){r(e)}}))})).catch(r)}));return s(r,t),r},setItem:function(e,t,n){var r=this;e=u(e);var o=new a((function(n,o){var i;r.ready().then((function(){return i=r._dbInfo,"[object Blob]"===h.call(t)?m(i.db).then((function(e){return e?t:(n=t,new a((function(e,t){var r=new FileReader;r.onerror=t,r.onloadend=function(t){var r=btoa(t.target.result||"");e({__local_forage_encoded_blob:!0,data:r,type:n.type})},r.readAsBinaryString(n)})));var n})):t})).then((function(t){A(r._dbInfo,y,(function(i,a){if(i)return o(i);try{var s=a.objectStore(r._dbInfo.storeName);null===t&&(t=void 0);var c=s.put(t,e);a.oncomplete=function(){void 0===t&&(t=null),n(t)},a.onabort=a.onerror=function(){var e=c.error?c.error:c.transaction.error;o(e)}}catch(e){o(e)}}))})).catch(o)}));return s(o,n),o},removeItem:function(e,t){var n=this;e=u(e);var r=new a((function(t,r){n.ready().then((function(){A(n._dbInfo,y,(function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName).delete(e);i.oncomplete=function(){t()},i.onerror=function(){r(a.error)},i.onabort=function(){var e=a.error?a.error:a.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return s(r,t),r},clear:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){A(t._dbInfo,y,(function(r,o){if(r)return n(r);try{var i=o.objectStore(t._dbInfo.storeName).clear();o.oncomplete=function(){e()},o.onabort=o.onerror=function(){var e=i.error?i.error:i.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return s(n,e),n},length:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){A(t._dbInfo,p,(function(r,o){if(r)return n(r);try{var i=o.objectStore(t._dbInfo.storeName).count();i.onsuccess=function(){e(i.result)},i.onerror=function(){n(i.error)}}catch(e){n(e)}}))})).catch(n)}));return s(n,e),n},key:function(e,t){var n=this,r=new a((function(t,r){e<0?t(null):n.ready().then((function(){A(n._dbInfo,p,(function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName),s=!1,c=a.openKeyCursor();c.onsuccess=function(){var n=c.result;n?0===e||s?t(n.key):(s=!0,n.advance(e)):t(null)},c.onerror=function(){r(c.error)}}catch(e){r(e)}}))})).catch(r)}));return s(r,t),r},keys:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){A(t._dbInfo,p,(function(r,o){if(r)return n(r);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(){n(i.error)}}catch(e){n(e)}}))})).catch(n)}));return s(n,e),n},dropInstance:function(e,t){t=f.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var r,i=this;if(e.name){var c=e.name===n.name&&i._dbInfo.db?a.resolve(i._dbInfo.db):S(e).then((function(t){var n=v[e.name],r=n.forages;n.db=t;for(var o=0;o<r.length;o++)r[o]._dbInfo.db=t;return t}));r=e.storeName?c.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;b(e);var r=v[e.name],i=r.forages;t.close();for(var s=0;s<i.length;s++){var c=i[s];c._dbInfo.db=null,c._dbInfo.version=n}return new a((function(t,r){var i=o.open(e.name,n);i.onerror=function(e){i.result.close(),r(e)},i.onupgradeneeded=function(){i.result.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result;e.close(),t(e)}})).then((function(e){r.db=e;for(var t=0;t<i.length;t++){var n=i[t];n._dbInfo.db=e,E(n._dbInfo)}})).catch((function(t){throw(_(e,t)||a.resolve()).catch((function(){})),t}))}})):c.then((function(t){b(e);var n=v[e.name],r=n.forages;t.close();for(var i=0;i<r.length;i++)r[i]._dbInfo.db=null;return new a((function(t,n){var r=o.deleteDatabase(e.name);r.onerror=r.onblocked=function(e){var t=r.result;t&&t.close(),n(e)},r.onsuccess=function(){var e=r.result;e&&e.close(),t(e)}})).then((function(e){n.db=e;for(var t=0;t<r.length;t++)E(r[t]._dbInfo)})).catch((function(t){throw(_(e,t)||a.resolve()).catch((function(){})),t}))}))}else r=a.reject("Invalid arguments");return s(r,t),r}};var j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",P=/^~~local_forage_type~([^~]+)~/,U="__lfsc__:",k=U.length,x="arbf",L="blob",F="si08",D="ui08",M="uic8",B="si16",$="si32",V="ur16",q="ui32",G="fl32",K="fl64",Y=k+x.length,z=Object.prototype.toString;function H(e){var t,n,r,o,i,a=.75*e.length,s=e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var u=new ArrayBuffer(a),f=new Uint8Array(u);for(t=0;t<s;t+=4)n=j.indexOf(e[t]),r=j.indexOf(e[t+1]),o=j.indexOf(e[t+2]),i=j.indexOf(e[t+3]),f[c++]=n<<2|r>>4,f[c++]=(15&r)<<4|o>>2,f[c++]=(3&o)<<6|63&i;return u}function W(e){var t,n=new Uint8Array(e),r="";for(t=0;t<n.length;t+=3)r+=j[n[t]>>2],r+=j[(3&n[t])<<4|n[t+1]>>4],r+=j[(15&n[t+1])<<2|n[t+2]>>6],r+=j[63&n[t+2]];return n.length%3==2?r=r.substring(0,r.length-1)+"=":n.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}var Q={serialize:function(e,t){var n="";if(e&&(n=z.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===z.call(e.buffer))){var r,o=U;e instanceof ArrayBuffer?(r=e,o+=x):(r=e.buffer,"[object Int8Array]"===n?o+=F:"[object Uint8Array]"===n?o+=D:"[object Uint8ClampedArray]"===n?o+=M:"[object Int16Array]"===n?o+=B:"[object Uint16Array]"===n?o+=V:"[object Int32Array]"===n?o+=$:"[object Uint32Array]"===n?o+=q:"[object Float32Array]"===n?o+=G:"[object Float64Array]"===n?o+=K:t(new Error("Failed to get type for BinaryArray"))),t(o+W(r))}else if("[object Blob]"===n){var i=new FileReader;i.onload=function(){var n="~~local_forage_type~"+e.type+"~"+W(this.result);t("__lfsc__:blob"+n)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},deserialize:function(e){if(e.substring(0,k)!==U)return JSON.parse(e);var t,n=e.substring(Y),r=e.substring(k,Y);if(r===L&&P.test(n)){var o=n.match(P);t=o[1],n=n.substring(o[0].length)}var a=H(n);switch(r){case x:return a;case L:return i([a],{type:t});case F:return new Int8Array(a);case D:return new Uint8Array(a);case M:return new Uint8ClampedArray(a);case B:return new Int16Array(a);case V:return new Uint16Array(a);case $:return new Int32Array(a);case q:return new Uint32Array(a);case G:return new Float32Array(a);case K:return new Float64Array(a);default:throw new Error("Unkown type: "+r)}},stringToBuffer:H,bufferToString:W};function J(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function X(e,t,n,r,o,i){e.executeSql(n,r,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,s){s.rows.length?i(e,a):J(e,t,(function(){e.executeSql(n,r,o,i)}),i)}),i):i(e,a)}),i)}function Z(e,t,n,r){var o=this;e=u(e);var i=new a((function(i,a){o.ready().then((function(){void 0===t&&(t=null);var s=t,c=o._dbInfo;c.serializer.serialize(t,(function(t,u){u?a(u):c.db.transaction((function(n){X(n,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){i(s)}),(function(e,t){a(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(r>0)return void i(Z.apply(o,[e,s,n,r-1]));a(t)}}))}))})).catch(a)}));return s(i,n),i}function ee(e){return new a((function(t,n){e.transaction((function(r){r.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,r){for(var o=[],i=0;i<r.rows.length;i++)o.push(r.rows.item(i).name);t({db:e,storeNames:o})}),(function(e,t){n(t)}))}),(function(e){n(e)}))}))}var te={_driver:"webSQLStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]="string"!=typeof e[r]?e[r].toString():e[r];var o=new a((function(e,r){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return r(e)}n.db.transaction((function(o){J(o,n,(function(){t._dbInfo=n,e()}),(function(e,t){r(t)}))}),r)}));return n.serializer=Q,o},_support:"function"==typeof openDatabase,iterate:function(e,t){var n=this,r=new a((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){X(n,o,"SELECT * FROM "+o.storeName,[],(function(n,r){for(var i=r.rows,a=i.length,s=0;s<a;s++){var c=i.item(s),u=c.value;if(u&&(u=o.serializer.deserialize(u)),void 0!==(u=e(u,c.key,s+1)))return void t(u)}t()}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,t),r},getItem:function(e,t){var n=this;e=u(e);var r=new a((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){X(n,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,n){var r=n.rows.length?n.rows.item(0).value:null;r&&(r=o.serializer.deserialize(r)),t(r)}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,t),r},setItem:function(e,t,n){return Z.apply(this,[e,t,n,1])},removeItem:function(e,t){var n=this;e=u(e);var r=new a((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){X(n,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,t),r},clear:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){X(t,r,"DELETE FROM "+r.storeName,[],(function(){e()}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,e),n},length:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){X(t,r,"SELECT COUNT(key) as c FROM "+r.storeName,[],(function(t,n){var r=n.rows.item(0).c;e(r)}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,e),n},key:function(e,t){var n=this,r=new a((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){X(n,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,n){var r=n.rows.length?n.rows.item(0).key:null;t(r)}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,t),r},keys:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){X(t,r,"SELECT key FROM "+r.storeName,[],(function(t,n){for(var r=[],o=0;o<n.rows.length;o++)r.push(n.rows.item(o).key);e(r)}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,e),n},dropInstance:function(e,t){t=f.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var r,o=this;return s(r=e.name?new a((function(t){var r;r=e.name===n.name?o._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:r,storeNames:[e.storeName]}):t(ee(r))})).then((function(e){return new a((function(t,n){e.db.transaction((function(r){function o(e){return new a((function(t,n){r.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){n(t)}))}))}for(var i=[],s=0,c=e.storeNames.length;s<c;s++)i.push(o(e.storeNames[s]));a.all(i).then((function(){t()})).catch((function(e){n(e)}))}),(function(e){n(e)}))}))})):a.reject("Invalid arguments"),t),r}};function ne(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function re(){return!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}()||localStorage.length>0}var oe={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var n in e)t[n]=e[n];return t.keyPrefix=ne(e,this._defaultConfig),re()?(this._dbInfo=t,t.serializer=Q,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 n=this,r=n.ready().then((function(){for(var t=n._dbInfo,r=t.keyPrefix,o=r.length,i=localStorage.length,a=1,s=0;s<i;s++){var c=localStorage.key(s);if(0===c.indexOf(r)){var u=localStorage.getItem(c);if(u&&(u=t.serializer.deserialize(u)),void 0!==(u=e(u,c.substring(o),a++)))return u}}}));return s(r,t),r},getItem:function(e,t){var n=this;e=u(e);var r=n.ready().then((function(){var t=n._dbInfo,r=localStorage.getItem(t.keyPrefix+e);return r&&(r=t.serializer.deserialize(r)),r}));return s(r,t),r},setItem:function(e,t,n){var r=this;e=u(e);var o=r.ready().then((function(){void 0===t&&(t=null);var n=t;return new a((function(o,i){var a=r._dbInfo;a.serializer.serialize(t,(function(t,r){if(r)i(r);else try{localStorage.setItem(a.keyPrefix+e,t),o(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||i(e),i(e)}}))}))}));return s(o,n),o},removeItem:function(e,t){var n=this;e=u(e);var r=n.ready().then((function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return s(r,t),r},clear:function(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var r=localStorage.key(n);0===r.indexOf(e)&&localStorage.removeItem(r)}}));return s(n,e),n},length:function(e){var t=this.keys().then((function(e){return e.length}));return s(t,e),t},key:function(e,t){var n=this,r=n.ready().then((function(){var t,r=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(r.keyPrefix.length)),t}));return s(r,t),r},keys:function(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo,n=localStorage.length,r=[],o=0;o<n;o++){var i=localStorage.key(o);0===i.indexOf(e.keyPrefix)&&r.push(i.substring(e.keyPrefix.length))}return r}));return s(n,e),n},dropInstance:function(e,t){if(t=f.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}var r,o=this;return s(r=e.name?new a((function(t){e.storeName?t(ne(e,o._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}})):a.reject("Invalid arguments"),t),r}},ie=function(e,t){for(var n=e.length,r=0;r<n;){if((o=e[r])===(i=t)||"number"==typeof o&&"number"==typeof i&&isNaN(o)&&isNaN(i))return!0;r++}var o,i;return!1},ae=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},se={},ce={},ue={INDEXEDDB:N,WEBSQL:te,LOCALSTORAGE:oe},fe=[ue.INDEXEDDB._driver,ue.WEBSQL._driver,ue.LOCALSTORAGE._driver],le=["dropInstance"],de=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(le),ve={description:"",driver:fe.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function he(e,t){e[t]=function(){var n=arguments;return e.ready().then((function(){return e[t].apply(e,n)}))}}function pe(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(ae(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}var ye=new(function(){function e(t){for(var n in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ue)if(ue.hasOwnProperty(n)){var r=ue[n],o=r._driver;this[n]=o,se[o]||this.defineDriver(r)}this._defaultConfig=pe({},ve),this._config=pe({},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":r(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,n){var r=new a((function(t,n){try{var r=e._driver,o=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(o);for(var i=de.concat("_initStorage"),c=0,u=i.length;c<u;c++){var f=i[c];if((!ie(le,f)||e[f])&&"function"!=typeof e[f])return void n(o)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),n=a.reject(t);return s(n,arguments[arguments.length-1]),n}},n=0,r=le.length;n<r;n++){var o=le[n];e[o]||(e[o]=t(o))}}();var l=function(n){se[r]&&console.info("Redefining LocalForage driver: "+r),se[r]=e,ce[r]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(l,n):l(!!e._support):l(!0)}catch(e){n(e)}}));return c(r,t,n),r},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var r=se[e]?a.resolve(se[e]):a.reject(new Error("Driver not found."));return c(r,t,n),r},e.prototype.getSerializer=function(e){var t=a.resolve(Q);return c(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return c(n,e,e),n},e.prototype.setDriver=function(e,t,n){var r=this;ae(e)||(e=[e]);var o=this._getSupportedDrivers(e);function i(){r._config.driver=r.driver()}function s(e){return r._extend(e),i(),r._ready=r._initStorage(r._config),r._ready}var u=null!==this._driverSet?this._driverSet.catch((function(){return a.resolve()})):a.resolve();return this._driverSet=u.then((function(){var e=o[0];return r._dbInfo=null,r._ready=null,r.getDriver(e).then((function(e){r._driver=e._driver,i(),r._wrapLibraryMethodsWithReady(),r._initDriver=function(e){return function(){var t=0;return function n(){for(;t<e.length;){var o=e[t];return t++,r._dbInfo=null,r._ready=null,r.getDriver(o).then(s).catch(n)}i();var c=new Error("No available storage method found.");return r._driverSet=a.reject(c),r._driverSet}()}}(o)}))})).catch((function(){i();var e=new Error("No available storage method found.");return r._driverSet=a.reject(e),r._driverSet})),c(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!ce[e]},e.prototype._extend=function(e){pe(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n];this.supports(o)&&t.push(o)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=de.length;e<t;e++)he(this,de[e])},e.prototype.createInstance=function(t){return new e(t)},e}());t.exports=ye},{3:3}]},{},[4])(4)},36:function(e,t,n){var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncContract=void 0;var i=n(888),a=n(611);t.AsyncContract=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.length-1,s=e.slice(0,n),c=e[n];return{enforce:function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if(t.length<s.length){var u="Expected "+s.length+" arguments but only received "+t.length,f=a.FAILURE.ARGUMENT_INCORRECT(u);throw new i.ValidationError(f)}for(var l=0;l<s.length;l++)s[l].check(t[l]);var d=e.apply(void 0,o([],r(t)));if(!(d instanceof Promise))throw u="Expected function to return a promise, but instead got "+d,f=a.FAILURE.RETURN_INCORRECT(u),new i.ValidationError(f);return d.then(c.check)}}}}},361:function(e,t,n){var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.Contract=void 0;var i=n(888),a=n(611);t.Contract=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.length-1,s=e.slice(0,n),c=e[n];return{enforce:function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if(t.length<s.length){var u="Expected "+s.length+" arguments but only received "+t.length,f=a.FAILURE.ARGUMENT_INCORRECT(u);throw new i.ValidationError(f)}for(var l=0;l<s.length;l++)s[l].check(t[l]);return c.check(e.apply(void 0,o([],r(t))))}}}}},316:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.checked=t.check=void 0;var r=n(888),o=n(611),i=new WeakMap;function a(e,t,n){var r=i.get(e),o=r&&r.get(t);if(o)return o;for(var a=[],s=0;s<n;s++)a.push(s);return a}t.check=function(e,t,n){var r=i.get(e)||new Map;i.set(e,r);var o=r.get(t)||[];r.set(t,o),o.push(n)},t.checked=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(0===e.length)throw new Error("No runtype provided to `@checked`. Please remove the decorator.");return function(t,n,i){var s=i.value,c=(t.name||t.constructor.name+".prototype")+("string"==typeof n?'["'+n+'"]':"["+String(n)+"]"),u=a(t,n,e.length);if(u.length!==e.length)throw new Error("Number of `@checked` runtypes and @check parameters not matched.");if(u.length>s.length)throw new Error("Number of `@checked` runtypes exceeds actual parameter length.");i.value=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.forEach((function(e,n){var i=u[n],a=e.validate(t[i]);if(!a.success){var s=c+", argument #"+i+": "+a.message,f=o.FAILURE.ARGUMENT_INCORRECT(s);throw new r.ValidationError(f)}})),s.apply(this,t)}}}},888:function(e,t){var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.ValidationError=void 0;var o=function(e){function t(n){var r=e.call(this,n.message)||this;return r.name="ValidationError",r.code=n.code,void 0!==n.details&&(r.details=n.details),Object.setPrototypeOf(r,t.prototype),r}return r(t,e),t}(Error);t.ValidationError=o},529:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.InstanceOf=t.Null=t.Undefined=t.Literal=void 0,o(n(550),t),o(n(691),t),o(n(361),t),o(n(36),t),o(n(74),t),o(n(888),t),o(n(101),t),o(n(913),t),o(n(203),t);var i=n(275);Object.defineProperty(t,"Literal",{enumerable:!0,get:function(){return i.Literal}}),Object.defineProperty(t,"Undefined",{enumerable:!0,get:function(){return i.Undefined}}),Object.defineProperty(t,"Null",{enumerable:!0,get:function(){return i.Null}}),o(n(19),t),o(n(257),t),o(n(481),t),o(n(304),t),o(n(333),t),o(n(380),t),o(n(226),t),o(n(695),t),o(n(132),t),o(n(724),t),o(n(239),t),o(n(209),t),o(n(559),t);var a=n(867);Object.defineProperty(t,"InstanceOf",{enumerable:!0,get:function(){return a.InstanceOf}}),o(n(802),t),o(n(845),t),o(n(111),t),o(n(316),t)},74:function(e,t){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0}),t.match=void 0,t.match=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){var o,i;try{for(var a=n(e),s=a.next();!s.done;s=a.next()){var c=r(s.value,2),u=c[0],f=c[1];if(u.guard(t))return f(t)}}catch(e){o={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}throw new Error("No alternatives were matched")}}},550:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},691:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Failcode=void 0,t.Failcode={TYPE_INCORRECT:"TYPE_INCORRECT",VALUE_INCORRECT:"VALUE_INCORRECT",KEY_INCORRECT:"KEY_INCORRECT",CONTENT_INCORRECT:"CONTENT_INCORRECT",ARGUMENT_INCORRECT:"ARGUMENT_INCORRECT",RETURN_INCORRECT:"RETURN_INCORRECT",CONSTRAINT_FAILED:"CONSTRAINT_FAILED",PROPERTY_MISSING:"PROPERTY_MISSING",PROPERTY_PRESENT:"PROPERTY_PRESENT",NOTHING_EXPECTED:"NOTHING_EXPECTED"}},732:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.innerValidate=t.create=void 0;var r=n(529),o=n(233),i=n(888),a=n(611);t.create=function(e,t){return t.check=n,t.assert=n,t._innerValidate=function(n,r){return r.has(n,t)?a.SUCCESS(n):e(n,r)},t.validate=function(e){return t._innerValidate(e,(n=new WeakMap,r=function(e,t){if(null!==e&&"object"==typeof e){var r=n.get(e);n.set(e,r?r.set(t,!0):(new WeakMap).set(t,!0))}},{has:function(e,t){var o=n.get(e),i=o&&o.get(t)||!1;return r(e,t),i}}));var n,r},t.guard=function(e){return t.validate(e).success},t.Or=function(e){return r.Union(t,e)},t.And=function(e){return r.Intersect(t,e)},t.optional=function(){return r.Optional(t)},t.nullable=function(){return r.Union(t,r.Null)},t.withConstraint=function(e,n){return r.Constraint(t,e,n)},t.withGuard=function(e,n){return r.Constraint(t,e,n)},t.withBrand=function(e){return r.Brand(e,t)},t.reflect=t,t.toString=function(){return"Runtype<"+o.default(t)+">"},t;function n(e){var n=t.validate(e);if(n.success)return n.value;throw new i.ValidationError(n)}},t.innerValidate=function(e,t,n){return e._innerValidate(t,n)}},233:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){return function(o){var i=function(t){return e?"("+t+")":t};if(t.has(o))return i("CIRCULAR "+o.tag);t.add(o);try{switch(o.tag){case"unknown":case"never":case"void":case"boolean":case"number":case"bigint":case"string":case"symbol":case"function":return o.tag;case"literal":var a=o.value;return"string"==typeof a?'"'+a+'"':String(a);case"array":return""+r(o)+n(!0,t)(o.element)+"[]";case"dictionary":return"{ [_: "+o.key+"]: "+n(!1,t)(o.value)+" }";case"record":var s=Object.keys(o.fields);return s.length?"{ "+s.map((function(e){return""+r(o)+e+(a=e,s=(i=o).isPartial,c=i.fields,(s||void 0!==a&&"optional"===c[a].tag?"?":"")+": ")+("optional"===o.fields[e].tag?n(!1,t)(o.fields[e].underlying):n(!1,t)(o.fields[e]))+";";var i,a,s,c})).join(" ")+" }":"{}";case"tuple":return"["+o.components.map(n(!1,t)).join(", ")+"]";case"union":return i(""+o.alternatives.map(n(!0,t)).join(" | "));case"intersect":return i(""+o.intersectees.map(n(!0,t)).join(" & "));case"optional":return n(e,t)(o.underlying)+" | undefined";case"constraint":return o.name||n(e,t)(o.underlying);case"instanceof":return o.ctor.name;case"brand":return n(e,t)(o.entity)}}finally{t.delete(o)}throw Error("impossible")}};function r(e){return e.isReadonly?"readonly ":""}t.default=n(!1,new Set)},380:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Array=void 0;var r=n(732),o=n(611);function i(e,t){var n,a={tag:"array",isReadonly:t,element:e};return(n=r.create((function(t,n){if(!Array.isArray(t))return o.FAILURE.TYPE_INCORRECT(a,t);var i=o.enumerableKeysOf(t),s=i.map((function(o){return r.innerValidate(e,t[o],n)})),c=i.reduce((function(e,t){var n=s[t];return n.success||(e[t]=n.details||n.message),e}),[]);return 0!==o.enumerableKeysOf(c).length?o.FAILURE.CONTENT_INCORRECT(a,c):o.SUCCESS(t)}),a)).asReadonly=function(){return i(n.element,!0)},n}t.Array=function(e){return i(e,!1)}},481:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BigInt=void 0;var r=n(732),o=n(611),i={tag:"bigint"};t.BigInt=r.create((function(e){return"bigint"==typeof e?o.SUCCESS(e):o.FAILURE.TYPE_INCORRECT(i,e)}),i)},19:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Boolean=void 0;var r=n(732),o=n(611),i={tag:"boolean"};t.Boolean=r.create((function(e){return"boolean"==typeof e?o.SUCCESS(e):o.FAILURE.TYPE_INCORRECT(i,e)}),i)},111:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Brand=void 0;var r=n(732);t.Brand=function(e,t){var n={tag:"brand",brand:e,entity:t};return r.create((function(e){return t.validate(e)}),n)}},845:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Guard=t.Constraint=void 0;var r=n(732),o=n(611),i=n(101);t.Constraint=function(e,t,n){var i=n&&n.name,a=n&&n.args,s={tag:"constraint",underlying:e,constraint:t,name:i,args:a};return r.create((function(n){var r=e.validate(n);if(!r.success)return r;var i=t(r.value);return"string"==typeof i?o.FAILURE.CONSTRAINT_FAILED(s,i):i?o.SUCCESS(r.value):o.FAILURE.CONSTRAINT_FAILED(s)}),s)},t.Guard=function(e,t){return i.Unknown.withGuard(e,t)}},132:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Dictionary=void 0;var r=n(732),o=n(304),i=n(845),a=n(233),s=n(611),c=i.Constraint(o.String,(function(e){return!isNaN(+e)}),{name:"number"});t.Dictionary=function(e,t){var i=void 0===t||"string"===t?o.String:"number"===t?c:t,u=a.default(i),f={tag:"dictionary",key:u,value:e};return r.create((function(t,o){if(null==t||"object"!=typeof t)return s.FAILURE.TYPE_INCORRECT(f,t);if(Object.getPrototypeOf(t)!==Object.prototype&&(!Array.isArray(t)||"string"===u))return s.FAILURE.TYPE_INCORRECT(f,t);var a=/^(?:NaN|-?\d+(?:\.\d+)?)$/u,c=s.enumerableKeysOf(t),l=c.reduce((function(c,u){var l="string"==typeof u&&a.test(u),d=l?n.g.Number(u):u;return(l?i.guard(d)||i.guard(u):i.guard(d))?c[u]=r.innerValidate(e,t[u],o):c[u]=s.FAILURE.KEY_INCORRECT(f,i.reflect,d),c}),{}),d=c.reduce((function(e,t){var n=l[t];return n.success||(e[t]=n.details||n.message),e}),{});return 0!==s.enumerableKeysOf(d).length?s.FAILURE.CONTENT_INCORRECT(f,d):s.SUCCESS(t)}),f)}},559:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Function=void 0;var r=n(732),o=n(611),i={tag:"function"};t.Function=r.create((function(e){return"function"==typeof e?o.SUCCESS(e):o.FAILURE.TYPE_INCORRECT(i,e)}),i)},867:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstanceOf=void 0;var r=n(732),o=n(611);t.InstanceOf=function(e){var t={tag:"instanceof",ctor:e};return r.create((function(n){return n instanceof e?o.SUCCESS(n):o.FAILURE.TYPE_INCORRECT(t,n)}),t)}},239:function(e,t,n){var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.Intersect=void 0;var o=n(732),i=n(611);t.Intersect=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={tag:"intersect",intersectees:e};return o.create((function(t,n){var a,s;try{for(var c=r(e),u=c.next();!u.done;u=c.next()){var f=u.value,l=o.innerValidate(f,t,n);if(!l.success)return l}}catch(e){a={error:e}}finally{try{u&&!u.done&&(s=c.return)&&s.call(c)}finally{if(a)throw a.error}}return i.SUCCESS(t)}),n)}},802:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Lazy=void 0;var r=n(732);t.Lazy=function(e){var t,n={get tag(){return o().tag}};function o(){if(!t)for(var r in t=e())"tag"!==r&&(n[r]=t[r]);return t}return r.create((function(e){return o().validate(e)}),n)}},275:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Null=t.Undefined=t.Literal=void 0;var r=n(732),o=n(611);function i(e){return Array.isArray(e)?String(e.map(String)):"bigint"==typeof e?String(e)+"n":String(e)}function a(e){var t={tag:"literal",value:e};return r.create((function(t){return t===e?o.SUCCESS(t):o.FAILURE.VALUE_INCORRECT("literal","`"+i(e)+"`","`"+i(t)+"`")}),t)}t.Literal=a,t.Undefined=a(void 0),t.Null=a(null)},913:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Never=void 0;var r=n(732),o=n(611);t.Never=r.create(o.FAILURE.NOTHING_EXPECTED,{tag:"never"})},257:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Number=void 0;var r=n(732),o=n(611),i={tag:"number"};t.Number=r.create((function(e){return"number"==typeof e?o.SUCCESS(e):o.FAILURE.TYPE_INCORRECT(i,e)}),i)},209:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Optional=void 0;var r=n(732),o=n(611);t.Optional=function(e){var t={tag:"optional",underlying:e};return r.create((function(t){return void 0===t?o.SUCCESS(t):e.validate(t)}),t)}},695:function(e,t,n){var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.Partial=t.Record=t.InternalRecord=void 0;var i=n(732),a=n(611);function s(e,t,n){var c,u={tag:"record",isPartial:t,isReadonly:n,fields:e};return(c=i.create((function(n,s){if(null==n)return a.FAILURE.TYPE_INCORRECT(u,n);var c=a.enumerableKeysOf(e);if(0!==c.length&&"object"!=typeof n)return a.FAILURE.TYPE_INCORRECT(u,n);var f=o([],r(new Set(o(o([],r(c)),r(a.enumerableKeysOf(n)))))),l=f.reduce((function(r,o){var c=a.hasKey(o,e),u=a.hasKey(o,n);if(c){var f=e[o],l=t||"optional"===f.reflect.tag;if(u){var d=n[o];r[o]=l&&void 0===d?a.SUCCESS(d):i.innerValidate(f,d,s)}else r[o]=l?a.SUCCESS(void 0):a.FAILURE.PROPERTY_MISSING(f.reflect)}else{if(!u)throw new Error("impossible");d=n[o],r[o]=a.SUCCESS(d)}return r}),{}),d=f.reduce((function(e,t){var n=l[t];return n.success||(e[t]=n.details||n.message),e}),{});return 0!==a.enumerableKeysOf(d).length?a.FAILURE.CONTENT_INCORRECT(u,d):a.SUCCESS(n)}),u)).asPartial=function(){return s(c.fields,!0,c.isReadonly)},c.asReadonly=function(){return s(c.fields,c.isPartial,!0)},c.pick=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={};return e.forEach((function(e){n[e]=c.fields[e]})),s(n,c.isPartial,c.isReadonly)},c.omit=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={};return a.enumerableKeysOf(c.fields).forEach((function(t){e.includes(t)||(n[t]=c.fields[t])})),s(n,c.isPartial,c.isReadonly)},c}t.InternalRecord=s,t.Record=function(e){return s(e,!1,!1)},t.Partial=function(e){return s(e,!0,!1)}},304:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.String=void 0;var r=n(732),o=n(611),i={tag:"string"};t.String=r.create((function(e){return"string"==typeof e?o.SUCCESS(e):o.FAILURE.TYPE_INCORRECT(i,e)}),i)},333:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Symbol=void 0;var r=n(732),o=n(611),i={tag:"symbol"};t.Symbol=r.create((function(e){return"symbol"==typeof e?o.SUCCESS(e):o.FAILURE.TYPE_INCORRECT(i,e)}),Object.assign((function(e){var t={tag:"symbol",key:e};return r.create((function(r){if("symbol"!=typeof r)return o.FAILURE.TYPE_INCORRECT(t,r);var i=n.g.Symbol.keyFor(r);return i!==e?o.FAILURE.VALUE_INCORRECT("symbol key",a(e),a(i)):o.SUCCESS(r)}),t)}),i));var a=function(e){return void 0===e?"undefined":'"'+e+'"'}},226:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Tuple=void 0;var r=n(732),o=n(611);t.Tuple=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={tag:"tuple",components:e};return r.create((function(t,i){if(!Array.isArray(t))return o.FAILURE.TYPE_INCORRECT(n,t);if(t.length!==e.length)return o.FAILURE.CONSTRAINT_FAILED(n,"Expected length "+e.length+", but was "+t.length);var a=o.enumerableKeysOf(t),s=a.map((function(n){return r.innerValidate(e[n],t[n],i)})),c=a.reduce((function(e,t){var n=s[t];return n.success||(e[t]=n.details||n.message),e}),[]);return 0!==o.enumerableKeysOf(c).length?o.FAILURE.CONTENT_INCORRECT(n,c):o.SUCCESS(t)}),n)}},724:function(e,t,n){var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.Union=void 0;var o=n(732),i=n(611);t.Union=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return function(n){for(var r=0;r<e.length;r++)if(e[r].guard(n))return t[r](n)}},a={tag:"union",alternatives:e,match:n};return o.create((function(t,n){var s,c,u,f,l,d,v,h;if("object"!=typeof t||null===t){try{for(var p=r(e),y=p.next();!y.done;y=p.next()){var g=y.value;if(o.innerValidate(g,t,n).success)return i.SUCCESS(t)}}catch(e){s={error:e}}finally{try{y&&!y.done&&(c=p.return)&&c.call(p)}finally{if(s)throw s.error}}return i.FAILURE.TYPE_INCORRECT(a,t)}var m={};try{for(var b=r(e),E=b.next();!E.done;E=b.next())if("record"===(g=E.value).reflect.tag){var _=function(e){var t=g.reflect.fields[e];"literal"===t.tag&&(m[e]?m[e].every((function(e){return e!==t.value}))&&m[e].push(t.value):m[e]=[t.value])};for(var w in g.reflect.fields)_(w)}}catch(e){u={error:e}}finally{try{E&&!E.done&&(f=b.return)&&f.call(b)}finally{if(u)throw u.error}}for(var w in m)if(m[w].length===e.length)try{for(var S=(l=void 0,r(e)),R=S.next();!R.done;R=S.next())if("record"===(g=R.value).reflect.tag){var O=g.reflect.fields[w];if("literal"===O.tag&&i.hasKey(w,t)&&t[w]===O.value)return o.innerValidate(g,t,n)}}catch(e){l={error:e}}finally{try{R&&!R.done&&(d=S.return)&&d.call(S)}finally{if(l)throw l.error}}try{for(var C=r(e),T=C.next();!T.done;T=C.next()){var I=T.value;if(o.innerValidate(I,t,n).success)return i.SUCCESS(t)}}catch(e){v={error:e}}finally{try{T&&!T.done&&(h=C.return)&&h.call(C)}finally{if(v)throw v.error}}return i.FAILURE.TYPE_INCORRECT(a,t)}),a)}},101:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Unknown=void 0;var r=n(732),o=n(611);t.Unknown=r.create((function(e){return o.SUCCESS(e)}),{tag:"unknown"})},203:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Void=void 0;var r=n(101);t.Void=r.Unknown},611:function(e,t,n){var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.FAILURE=t.SUCCESS=t.enumerableKeysOf=t.typeOf=t.hasKey=void 0;var o=n(691),i=n(233);t.hasKey=function(e,t){return"object"==typeof t&&null!==t&&e in t},t.typeOf=function(e){return"object"==typeof e?null===e?"null":Array.isArray(e)?"array":"Object"===e.constructor.name?"object":e.constructor.name:typeof e},t.enumerableKeysOf=function(e){return"object"==typeof e&&null!==e?Reflect.ownKeys(e).filter((function(t){var n,r;return null===(r=null===(n=e.propertyIsEnumerable)||void 0===n?void 0:n.call(e,t))||void 0===r||r})):[]},t.SUCCESS=function(e){return{success:!0,value:e}},t.FAILURE=Object.assign((function(e,t,n){return r({success:!1,code:e,message:t},n?{details:n}:{})}),{TYPE_INCORRECT:function(e,n){var r="Expected "+i.default(e)+", but was "+t.typeOf(n);return t.FAILURE(o.Failcode.TYPE_INCORRECT,r)},VALUE_INCORRECT:function(e,n,r){return t.FAILURE(o.Failcode.VALUE_INCORRECT,"Expected "+e+" "+String(n)+", but was "+String(r))},KEY_INCORRECT:function(e,n,r){return t.FAILURE(o.Failcode.KEY_INCORRECT,"Expected "+i.default(e)+" key to be "+i.default(n)+", but was "+t.typeOf(r))},CONTENT_INCORRECT:function(e,n){var r="Expected "+i.default(e)+", but was incompatible";return t.FAILURE(o.Failcode.CONTENT_INCORRECT,r,n)},ARGUMENT_INCORRECT:function(e){return t.FAILURE(o.Failcode.ARGUMENT_INCORRECT,e)},RETURN_INCORRECT:function(e){return t.FAILURE(o.Failcode.RETURN_INCORRECT,e)},CONSTRAINT_FAILED:function(e,n){var r=n?": "+n:"";return t.FAILURE(o.Failcode.CONSTRAINT_FAILED,"Failed constraint check for "+i.default(e)+r)},PROPERTY_MISSING:function(e){var n="Expected "+i.default(e)+", but was missing";return t.FAILURE(o.Failcode.PROPERTY_MISSING,n)},PROPERTY_PRESENT:function(e){var n="Expected nothing, but was "+t.typeOf(e);return t.FAILURE(o.Failcode.PROPERTY_PRESENT,n)},NOTHING_EXPECTED:function(e){var n="Expected nothing, but was "+t.typeOf(e);return t.FAILURE(o.Failcode.NOTHING_EXPECTED,n)}})},905:(e,t)=>{var n=function(e){if("object"==typeof e&&null!==e){if("function"==typeof Object.getPrototypeOf){var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}return"[object Object]"===Object.prototype.toString.call(e)}return!1},r=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce((function(e,t){return Object.keys(t).forEach((function(o){Array.isArray(e[o])&&Array.isArray(t[o])?e[o]=Array.from(new Set(e[o].concat(t[o]))):n(e[o])&&n(t[o])?e[o]=r(e[o],t[o]):e[o]=t[o]})),e}),{})};t.Z=r}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var r={};(()=>{n.d(r,{Hr:()=>dt,vg:()=>Re,EX:()=>vt,kS:()=>ht,Lk:()=>pt,Hc:()=>yt});const e=()=>window.location.hostname,t=()=>window.location.href,o=()=>e().replace(/\.[^.]+\.api\.no/,""),i=()=>{const t=(()=>{const t=/^bed-([^.]+)\.api\.no$/.exec(e()),n=/\.([^.]+)\.api\.no/.exec(e());return t?t[1]:n?n[1]:null})();let n="www.aid.no";return"localhost"===t?n="www.aid.no.localhost.api.no":t&&(n=`www-${t}.aid.no`),n};var a=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};const s=(n,r,o)=>{const i={};Object.keys(o).forEach((e=>{if(["string","number","boolean"].includes(typeof o[e]))i[e]=o[e];else try{i[e]=JSON.stringify(o[e])}catch(t){i[e]=o[e]}})),function(e,t){const n=new FormData;Object.keys(t).forEach((e=>n.append(e,t[e]))),fetch(e,{method:"POST",body:n,headers:{Accept:"application/json"}}).then((e=>{if(!e.ok)throw new Error(`Error, status: ${e.status}, text: ${e.statusText}`)}))}(`/api/mercury/v1/log/${n}`,Object.assign(Object.assign({},i),{message:r,url:t(),domain:e()}))},c={error:(e,t)=>s("error",e,t),warn:(e,t)=>s("warn",e,t),info:(e,t)=>s("info",e,t),debug:(e,t)=>s("debug",e,t)};class u extends Error{}const f=c;var l=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};const d=e=>{const t={message:e.message};return Object.getOwnPropertyNames(e).forEach((n=>{t[n]=e[n]})),t},v=e=>l(void 0,void 0,void 0,(function*(){const t=e.bodyUsed?"Response body not available for logging":yield e.text(),n={url:e.url,status:e.status,statusText:e.statusText,body:t};return Object.getOwnPropertyNames(e).forEach((t=>{n[t]=e[t]})),n})),h=(e,t,n)=>{((e,t={})=>l(void 0,void 0,void 0,(function*(){let n=e,r=t||{};if(n instanceof Error){const e=d(n);n=e.message,r=Object.assign(Object.assign({},r),{error:e})}if(r=Object.assign(Object.assign({},r),{origin:"@amedia/user"}),t instanceof Error){const e=d(t);r=Object.assign(Object.assign({},r),{[Object.keys(r).includes("error")?"contextError":"error"]:e})}else if(r instanceof Response){const e=yield v(r);r=Object.assign(Object.assign({},r),{response:e})}else for(const e of Object.keys(r))if(r[e]instanceof Error)r[e]=d(r[e]);else if(r[e]instanceof Response){const t=yield v(r[e]);r[e]=t}return{message:n,context:r}})))(t,n).then((({message:t,context:n})=>f[e](t,n)))},p=(e,t)=>h("warn",e,t),y=(e,t)=>h("error",e,t);let g;var m;"undefined"!=typeof window&&(m=window,g=m);const b=(e,t)=>{g?g.addEventListener(e,(e=>{e.stopImmediatePropagation(),t.apply(g,[e])})):y("No root element to bind event to!")},E=(e,t)=>{g?g.addEventListener(e,(e=>{t.apply(g,[e])})):y("No root element to bind event to!")},_=e=>{g?g.dispatchEvent(e):y("No root element to dispatch event on!")};var w=n(529);const S={},R=e=>{const t=S[e];return t?(delete S[e],t):[]},O=()=>{const e="undefined"!=typeof window?window:n.g;return e.amediaUserCache||(e.amediaUserCache={})},C={get:e=>{const t=O()[e];return Promise.resolve(t)},set:(e,t,n)=>(O()[e]={key:e,data:t,expires:n},Promise.resolve()),remove:e=>(delete O()[e],Promise.resolve()),clear:()=>(("undefined"!=typeof window?window:n.g).amediaUserCache={},Promise.resolve())};const T=()=>C,I=e=>T().remove(e),A=(e,t)=>{return n=void 0,r=void 0,i=function*(){const n=yield T().get(e);if(!n)return Promise.resolve();if(Date.now()>n.expires)return I(e),Promise.resolve();try{return t.check(n.data)}catch(t){return y(t,{cacheData:n.data}),I(e),Promise.resolve()}},new((o=void 0)||(o=Promise))((function(e,t){function a(e){try{c(i.next(e))}catch(e){t(e)}}function s(e){try{c(i.throw(e))}catch(e){t(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(a,s)}c((i=i.apply(n,r||[])).next())}));var n,r,o,i},N=(e,t,n)=>T().set(e,t,Date.now()+n);function j(e,t,n,r){return new Promise(((o,i)=>{((e,t)=>{S[e]||(S[e]=[]),S[e].push(t)})(e,{resolve:o,reject:i}),(e=>{var t;return(null===(t=S[e])||void 0===t?void 0:t.length)||0})(e)>1||A(e,t).then((t=>{!t||r&&!r(t)?n().then((n=>{const r=t?((e,t)=>!e||Array.isArray(t)?t:t?"object"==typeof e&&"object"==typeof t?Object.assign(Object.assign({},e),t):t:e)(t,n.data):n.data;N(e,r,n.ttl),R(e).forEach((e=>{e.resolve(n.data)}))})).catch((()=>{R(e).forEach((e=>{e.reject()}))})):R(e).forEach((e=>{e.resolve(t)}))}))}))}const P=(0,w.Record)({id:w.Number,domain:w.String}),U=(0,w.Record)({status:(0,w.Literal)("success"),access:(0,w.Union)((0,w.Literal)("granted"),(0,w.Literal)("denied")),publication:P,access_features:(0,w.Array)(w.String)}),k=(0,w.Record)({status:(0,w.Literal)("success"),cookie:w.String,access_features:(0,w.Array)(w.String)}),x=(0,w.Record)({status:(0,w.Literal)("success"),vstoken_cookie:w.String,uuid:w.String,access_features:(0,w.Array)(w.String)});var L=n(905);const F={},D={},M=(e,t)=>{F[e]=t,(e=>{var t;null===(t=D[e])||void 0===t||t.forEach((t=>t(F[e])))})(e)},B=(e,t)=>{M(e,(0,L.Z)(F[e]||{},t))},$=M,V=e=>F[e],q=(e,t)=>{D[e]||(D[e]=[]),D[e].push(t)},G=["avbrutt","kansellert","cancelled","aborted","failed to fetch","abgebrochen","the operation was aborted."];var K=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};const Y=(0,w.Partial)({user_uuid:w.String,user_name:w.String,tracking_key:w.String}),z=(0,w.Record)({code:w.String}),H=(0,w.Record)({errors:(0,w.Array)(z)}),W=["session.not_found","session.not_specified","user.deactivated"],Q=["session.invalid_for_domain","user.not_found"],J=e=>K(void 0,void 0,void 0,(function*(){let t;const n=e.clone();try{[t]=H.check(yield e.json()).errors}catch(e){return r=null==e?void 0:e.message,G.includes(r.toLowerCase().trim())?Promise.resolve():(p("Unable to parse error body from pluto",{error:e,response:n}),Promise.reject(e))}var r;return W.includes(null==t?void 0:t.code)?Promise.resolve():Q.includes(null==t?void 0:t.code)?(p(`Pluto responded with HTTP/${e.status}: (${t.code}) while fetching current session`,{error:t,response:e}),Promise.resolve()):(y(`Pluto responded with HTTP/${e.status}: ${e.statusText}) when fetching current session`,{error:t,response:e}),Promise.reject())})),X=()=>fetch("/api/pluto/v1/sessions/current").then((e=>e.ok?e.json():J(e).then((()=>({}))))).then((e=>{const t={ttl:-1,data:e};if(0===Object.keys(e).length)return t;try{return{ttl:1e4,data:Y.check(e)}}catch(n){return y(n,{json:e}),t}})),Z=e=>K(void 0,void 0,void 0,(function*(){return fetch(`/api/pluto/v1/sessions/current?publication_domain=${e}`,{method:"DELETE"}).then((e=>{if(!e.ok){if(403===e.status)return;throw new Error(`Error, could not perform deleteRequest. Status: ${e.status} Text: ${e.statusText}`)}B("state",{isLoggedIn:!1})}))}));let ee;const te=self||window,ne="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||void 0!==te.msCrypto&&"function"==typeof te.msCrypto.getRandomValues&&te.msCrypto.getRandomValues.bind(te.msCrypto);if(ne){const e=new Uint8Array(16);ee=function(){return ne(e),e}}else{const e=new Array(16);ee=function(){for(let t,n=0;n<16;n+=1)0==(3&n)&&(t=4294967296*Math.random()),e[n]=t>>>((3&n)<<3)&255;return e}}const re=[];for(let e=0;e<256;++e)re[e]=(e+256).toString(16).substr(1);function oe(e,t){return(...n)=>{const{resolve:r,reject:o,promise:i}=function(){let e,t,n=!1;return{promise:new Promise(((r,o)=>{e=e=>{n||r(e),n=!0},t=e=>{n||o(e),n=!0}})),resolve:e,reject:t}}(),a=function(){const e=ee();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e,t){let n=0;const r=re;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")}(e)}(),s=new CustomEvent(`amedia-rpc-event:${e}:${t}`,{detail:{eventId:a,args:n}});if(self.dispatchEvent(s),self.amediaNativeBridge){const r=JSON.stringify(n);self.amediaNativeBridge.callNativeMethod(e,t,r,a)}return self.addEventListener(`amedia-rpc-event:${e}:${t}:${a}`,(e=>{e.detail||r();const{error:t,result:n}=e.detail;return t?o(t):r(n)})),i}}class ie{constructor({version:e,component:t,methods:n=[]}){this.component=t,this.version=e,this.queue=[],n.forEach((e=>this.addMethod(e))),this.boundLiveHandler=this.liveHandler.bind(this),self.addEventListener(`amedia-rpc-event:${t}:live`,this.boundLiveHandler),setTimeout((()=>self.dispatchEvent(new CustomEvent(`amedia-rpc-event:${t}:ready`))),0)}liveHandler(e){const[t,n]=e.detail.version.split(".").map((e=>parseInt(e,10))),[r,o]=this.version.split(".").map((e=>parseInt(e,10)));if(t!==r)throw new Error(`${this.component} version mismatch. Server version: ${t}. Client version: ${r}`);n<o&&console.warn(`${this.component} server version is on an earlier minor version (${n}) than the client (${o})`);const i=this.queue.slice(0);delete this.queue,i.forEach((e=>e())),self.removeEventListener(`amedia-rpc-event:${this.component}:live`,this.boundLiveHandler)}addMethod(e){if(this[e])throw new Error(`${e} already exists on the RPC interface.`);this[e]=(...t)=>{if(this.queue){let n,r;const o=new Promise(((e,t)=>{n=e,r=t}));return this.queue.push((()=>this[e](...t).then(n).catch(r))),o}return this[e]=oe(this.component,e),this[e](...t)}}}let ae;const se=(e,t)=>{const n=t.substring(e.length,t.length);return"{"===n.substring(0,1)?JSON.parse(n):"%7B"===n.substring(0,3)?JSON.parse(decodeURIComponent(n)):"undefined"!==n?""===n||"null"===n?null:n:void 0},ce=e=>{const t=`${e}=`,n=document.cookie.split(";");for(let e=n.length-1;e>=0;e-=1){const r=n[e].trim();if(0===r.indexOf(t))return se(t,r)}return null};function ue(e,t,n=Date.now(),r="/",o=!1){const i=new Date;let a=`${e}=`;return t&&""!==t||(n=-1),a+=(e=>e&&""!==e?e instanceof Object?encodeURIComponent(JSON.stringify(e)):"number"==typeof e?e.toString(10):e:"")(t),a+=((e,t)=>t?t instanceof Date?`; expires=${t.toUTCString()}`:(e.setTime(e.getTime()+24*t*60*60*1e3),`; expires=${e.toUTCString()}`):"")(i,n),a+=`; path=${r}`,o&&(a+="; secure"),document.cookie=a,n&&-1!==n&&null===ce(e)&&(document.cookie=a.replace(/; expires=[^;]*/,"")),a}function fe(e){ue(e)}const le=e=>{window.location.href=e};const de=()=>{return e=void 0,t=void 0,r=function*(){return Promise.all([Z(o()),T().clear()]).then((()=>{(ae||(ae=new ie({version:"1.0.0",component:"userdata-session",methods:["userAuthenticated"]}),ae)).userAuthenticated(!1),fe("VSTOKEN"),fe("aid.session"),fe("aid_invitation_code"),fe("aid-reload-article"),fe("VSTOKEN2")})).catch((e=>{y("Failure while logging out",e)}))},new((n=void 0)||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}));var e,t,n,r},ve=()=>K(void 0,void 0,void 0,(function*(){return j("getCurrentSession",Y,X).then((e=>{return B("state",{isLoggedIn:void 0!==e.user_uuid}),{uuid:(t=e).user_uuid,name:t.user_name,trackingKey:t.tracking_key};var t}))}));var he=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};const pe=e=>he(void 0,void 0,void 0,(function*(){try{return yield(e=>a(void 0,void 0,void 0,(function*(){return fetch(`/api/mercury/v2/access/activate?publication_wwwdomain=${o()}&access_features=${e.join(",")}`,{method:"post"}).then((t=>a(void 0,void 0,void 0,(function*(){const n=yield t.text();let r;try{r=JSON.parse(n)}catch(r){c.error("Activate subscription. Response from mercury does not contain parsable json",{error:r,response:t,accessFeatures:e,body:n})}if(!t.ok){if(401===t.status&&"user_deactivated"===(null==r?void 0:r.status))throw new u;return[]}return null==r?void 0:r.access_features}))))})))(e)}catch(e){if(e instanceof u)return yield de(),[];throw e}})),ye=(e,t)=>t.length<1||t.filter((t=>e.includes(t))).length>0,ge=e=>he(void 0,void 0,void 0,(function*(){const t=yield(e=>fetch(`/api/jupiter/v1/get_vstoken/${e}`,{method:"post"}).then((e=>{if(!e.ok)throw new Error(`Request not ok (${e.status}: ${e.statusText}).`);return e.json()})).then((e=>{try{return k.check(e)}catch(t){throw y(t,{json:e}),t}})))(e);return"success"===t.status&&ue("VSTOKEN",t.cookie,365,"/"),{success:"success"===t.status,accessFeatures:t.access_features}})),me=e=>he(void 0,void 0,void 0,(function*(){const t=yield(e=>fetch(`/api/jupiter/v1/non_user_access/${e}`,{method:"post"}).then((e=>{if(!e.ok)throw new Error(`Request not ok (${e.status}: ${e.statusText}).`);return e.json()})).then((e=>{try{return x.check(e)}catch(t){throw y(t,{json:e}),t}})))(e);return"success"===t.status&&ue("VSTOKEN2",t.vstoken_cookie,1,"/"),{success:"success"===t.status,accessFeatures:t.access_features}}));var be,Ee;!function(e){e.REQUEST_ACTIVATION="amedia-user.activation.request-activation",e.ON_ACTIVATION_COMPLETE="amedia-user.activation.on-activation-complete"}(be||(be={})),b(be.REQUEST_ACTIVATION,(e=>{pe(e.detail.accessFeatures).then((e=>{_(new CustomEvent(be.ON_ACTIVATION_COMPLETE,{detail:{accessFeatures:e}}))}))})),function(e){e.REQUEST_STATE="amedia-user.request-state",e.REQUEST_USER_ATTRIBUTES="amedia-user.request-user-attributes",e.REQUEST_STORAGE_NAMESPACES="amedia-user.request-storage-namespaces",e.UPDATE_STORAGE="amedua-user.update-storage-namespaces",e.ON_ATTRIBUTES_UPDATED="amedia-user.on-user-attributes-updated",e.ON_STATE_UPDATED="amedia-user.on-state-updated",e.ON_STORAGE_UPDATED="amedia-user.on-storage-updated"}(Ee||(Ee={}));const _e=(e,t)=>{if(e===t)return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){if(!r.includes(o))return!1;if("function"==typeof e[o]||"function"==typeof t[o]){if(e[o].toString()!==t[o].toString())return!1}else if(!_e(e[o],t[o]))return!1}return!0};function we(e,t){return!!(e&&e.length>0)&&(!(t&&Object.keys(t).length>0)||e.filter((e=>!Object.keys(t).includes(e))).length>0)}class Se{constructor(e,t){this.attributes=e,this.namespaces=t}withAttributes(e){return new Se([...this.attributes||[],...e],this.namespaces)}withStorage(e){return new Se(this.attributes,[...this.namespaces||[],...e])}subscribe(e){let t=this.setupLocalCache();E(Ee.ON_STATE_UPDATED,(n=>{const r=n.detail;Object.keys(t.state).length>0&&_e(t.state,r)||(t=Object.assign(Object.assign({},t),{state:r}),e(t))})),_(new CustomEvent(Ee.REQUEST_STATE)),Array.isArray(this.attributes)&&this.attributes.length>0&&(E(Ee.ON_ATTRIBUTES_UPDATED,(n=>{const r=this.processUserAttributesEvent(n);Object.keys(t.attributes).length>0&&_e(t.attributes,r)||(t=Object.assign(Object.assign({},t),{attributes:r}),e(t))})),_(new CustomEvent(Ee.REQUEST_USER_ATTRIBUTES,{detail:this.attributes}))),Array.isArray(this.namespaces)&&this.namespaces.length>0&&(E(Ee.ON_STORAGE_UPDATED,(n=>{const r=this.processStorageEvent(n);_e(t.storage,r)||(t=Object.assign(Object.assign({},t),{storage:r}),e(t))})),_(new CustomEvent(Ee.REQUEST_STORAGE_NAMESPACES,{detail:this.namespaces})))}fetch(){return new Promise((e=>{this.subscribe((t=>{void 0!==t.state.isLoggedIn&&(!1!==t.state.isLoggedIn&&(we(this.attributes,t.attributes)||we(this.namespaces,t.storage))||e(t))}))}))}processUserAttributesEvent(e){const t=e.detail;return this.attributes.reduce(((e,n)=>(void 0!==t[n]&&(e[n]=t[n]),e)),{})}processStorageEvent(e){const t=e.detail;return this.namespaces&&this.namespaces.reduce(((e,n)=>(void 0!==t[n]&&(e[n]=t[n]),e)),{})}setupLocalCache(){const e={state:{}};return this.attributes&&this.attributes.length>0&&(e.attributes={}),this.namespaces&&this.namespaces.length>0&&(e.storage={}),e}}const Re=Se;var Oe=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};const Ce="jupiter";function Te(){return Oe(this,void 0,void 0,(function*(){const e="VSTOKEN",t=o(),n=ce(e);let r=!1;(new Re).withAttributes(["uuid"]).subscribe((({attributes:o,state:i})=>Oe(this,void 0,void 0,(function*(){if(!1===i.isLoggedIn)return void("string"==typeof n&&fe(e));if(!o.uuid||void 0===i.isLoggedIn||r)return;if(r=!0,"string"!=typeof n)return void(yield ge(t));const a=n.split(":"),s=new Date(1e3*parseInt(a[1],10));s.setDate(s.getDate()-1),s.getTime()>Date.now()&&a[3]===o.uuid&&t.includes(a[4])&&a[5]===Ce||(yield ge(t))}))))}))}function Ie(){const e="VSTOKEN2",t=o(),n=ce(e);(new Re).fetch().then((({state:{isLoggedIn:r}})=>Oe(this,void 0,void 0,(function*(){if(r){if("string"!=typeof n)return void(yield me(t));const e=n.split(":"),r=new Date(1e3*parseInt(e[1],10));if(r.setMinutes(r.getMinutes()-30),r.getTime()>Date.now()&&t.includes(e[4])&&e[5]===Ce)return;yield me(t)}else fe(e)})))).then((()=>{}))}const Ae="haveTriedThirdPartyLoginCheck",Ne=(0,w.Record)({user_name:w.String,tracking_key:w.String});function je(){return e=this,t=void 0,r=function*(){return!(yield A(Ae,w.Boolean))&&(yield N(Ae,!0,36e5),!!(yield fetch(`https://${i()}/api/pluto/v1/sessions/current`,{mode:"cors",credentials:"include"}).then((e=>e.ok?e.json():J(e).then((()=>null)).catch((()=>null)))).then((e=>{if(!e)return null;try{return Ne.check(e)}catch(t){return y(t,{data:e}),null}}))))},new((n=void 0)||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}));var e,t,n,r}var Pe=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};const Ue="has-tried-autologin";function ke(){const e=ce(Ue);if(e&&"object"!=typeof e)try{if(Date.now()-parseInt(e,10)<6e4)return!0}catch(e){fe(Ue)}return ue(Ue,Date.now(),Date.now()+6e4),!1}const xe=e=>Pe(void 0,void 0,void 0,(function*(){if(function(){try{return window.self!==window.top}catch(e){return!0}}())return;const{state:{isLoggedIn:n}}=yield(new Re).fetch();if(!n)for(const n of e)if(!(yield n.handler().then((e=>{if(e){if(ke())return!1;const e=new URL(`https://${i()}/aid/logg_inn/auto`);return e.searchParams.set("context",`auto_login_${n.name}`),e.searchParams.set("requestedUrl",t()),le(e.href),!1}return!0}))))return}));var Le=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};const Fe=[()=>Pe(void 0,void 0,void 0,(function*(){return xe([{name:"third_party",handler:je}])})),function(){return Promise.all([Te(),Ie()])},function(){(new Re).subscribe((({state:e})=>{!1===e.isLoggedIn&&($("userAttributes",{}),$("storage",{}))}))}];var De;!function(e){e.LOADED="amedia-user.janitor.loaded"}(De||(De={}));var Me=n(483),Be=n(808);let $e;const Ve="undefined"==typeof self?window:self,qe="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||void 0!==Ve.msCrypto&&"function"==typeof Ve.msCrypto.getRandomValues&&Ve.msCrypto.getRandomValues.bind(Ve.msCrypto);if(qe){const e=new Uint8Array(16);$e=function(){return qe(e),e}}else{const e=new Array(16);$e=function(){for(let t,n=0;n<16;n+=1)0==(3&n)&&(t=4294967296*Math.random()),e[n]=t>>>((3&n)<<3)&255;return e}}const Ge=[];for(let e=0;e<256;++e)Ge[e]=(e+256).toString(16).substr(1);function Ke(){const e=$e();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e,t){let n=0;const r=Ge;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")}(e)}Me.config({name:"aid:userdata"});const Ye=self.location.hostname.replace(/(.*\.)([^.]+\.\w+$)/,"$2");function ze(){let e=Be.get("amedia:fpbid");return e||(e=Ke(),Be.set("amedia:fpbid",e,{expires:3650,domain:Ye,sameSite:"strict"})),Promise.resolve(e)}function He(e){return Be.set("amedia:visitid",e,{expires:new Date(Date.now()+18e5),domain:Ye,sameSite:"strict"}),Me.setItem("visitid",e).then((()=>e))}function We(){const e=Date.now();return He(`${Ke()}|${e}`)}function Qe(){return function(){const e=Be.get("amedia:visitid");return e?Promise.resolve(e):Me.getItem("visitid")}().then((e=>e||We())).then((e=>{const[t,n]=e.split("|");return!t||n&&Date.now()-18e5>n?We():He(`${t}|${Date.now()}`)})).catch((e=>console.error(e)))}"undefined"!=typeof window&&["mousedown","keydown","mousemove","focus","scroll","resize","seshat-video-active","touchmove","deviceorientation"].forEach((e=>window.addEventListener(e,function(e){let t=!1;return(...n)=>{t||(e.apply(this,n),t=!0,setTimeout((()=>{t=!1}),400))}}(Qe))));var Je=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};const Xe=3e5,Ze=(0,w.Record)({namespaces:(0,w.Dictionary)(w.Unknown,w.String)}),et=(e,t="GET",n)=>fetch(e,{method:t,body:n&&JSON.stringify(n),headers:{"Content-Type":"application/json",Accept:"application/json"}}),tt=(e,t={ignoreCache:!1})=>Je(void 0,void 0,void 0,(function*(){if(0===e.length)throw new Error("namespaces array cannot be of length 0");return j("europa",Ze,(()=>et(`/api/europa/v1/me/${e.join(",")}`).then((t=>Je(void 0,void 0,void 0,(function*(){const n=yield t.text();return t.ok?JSON.parse(n):(400!==t.status&&y(`Could not get namespaces for: ${e}, status: ${t.status}`,{response:t,body:n}),{namespaces:{}})})))).then((e=>({ttl:Xe,data:e})))),(n=>!t.ignoreCache||0===Object.keys(n.namespaces).filter((t=>!Object.keys(e).includes(t))).length)).then((e=>e.namespaces))}));const nt=(0,w.Record)({allowResearchUsage:w.Boolean,connectWithSurveys:w.Boolean,personalizedAds:w.Boolean,personalizedContent:w.Boolean}),rt=e=>"true"===e||!0===e,ot=(0,w.Dictionary)(w.Unknown,w.String).And((0,w.Partial)({ad_segments:w.String,ad_segments_user:w.String,amedia_employee:w.Boolean,amedia_employee_user:w.Boolean,age:w.Number,age_user:w.Number,birth_year:w.String,birth_year_user:w.String,gender:w.String,gender_user:w.String,grunnkrets:w.String,grunnkrets_user:w.String,postcode:w.String,postcode_user:w.String,shared_account:w.Boolean,shared_account_user:w.Boolean,user_grouping_number:w.String,user_grouping_number_user:w.String})),it=e=>({extraData:e}),at=()=>new Promise((e=>{var t;const n=null===(t=V("state"))||void 0===t?void 0:t.isLoggedIn;!1!==n&&!0!==n?q("state",(({isLoggedIn:t})=>{!1!==t&&!0!==t||e(t)})):e(n)})),st=()=>new Promise((e=>at().then((t=>{t&&e()})))),ct={uuid:ve,name:ve,trackingKey:ve,access:()=>st().then((()=>((e=["newspaper"])=>((e,t)=>j("checkForAccess",U,(()=>fetch(`/api/jupiter/v1/check_access_for_paper/${e}/?require=any&access_features=${t.join(",")}`).then((e=>{if(!e.ok)throw new Error(`Request not ok (${e.status}: ${e.statusText}).`);return e.json()})).then((e=>{try{const t=U.check(e);return{ttl:"granted"===t.access?1e4:0,data:t}}catch(t){throw y(t,{json:e}),t}})))).then((e=>({access:e.access_features}))))(o(),e))())),extraData:()=>Promise.all([ze(),at()]).then((([e,t])=>{var n;return((e,t,n)=>j("getNebulaInfo",ot,(()=>((e,t,n)=>{const r=new URL("https://services.gcloud.api.no/api/nebula/v1/info");return r.searchParams.set("domain",e),r.searchParams.set("browser_id",t),n&&r.searchParams.set("user_key",n),fetch(r.href).then((e=>e.json())).then((e=>{try{return{ttl:18e6,data:ot.check(e)}}catch(t){throw y(t,{json:e}),t}}))})(e,t,n))).then(it))(window.location.hostname,e,t?null===(n=V("userAttributes"))||void 0===n?void 0:n.trackingKey:void 0)})),privacyPreferences:()=>st().then((()=>{return e=void 0,t=void 0,r=function*(){return j("privacyPreferences",nt,(()=>tt(["privacy_preferences"]).then((e=>{const t=e.privacy_preferences;return{ttl:3e5,data:{allowResearchUsage:rt(t.allow_research_usage),connectWithSurveys:rt(t.connect_with_surveys),personalizedAds:rt(t.personalized_ads),personalizedContent:rt(t.personalized_content)}}})))).then((e=>({privacyPreferences:e})))},new((n=void 0)||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}));var e,t,n,r}))};class ut extends Error{constructor(e,t){super(e),this.code=t}}ut.ERROR_RELOADED_NO_ACCESS="RELOADED_NO_ACCESS",ut.ERROR_ENABLING_ACCESS_FAILED="ENABLING_ACCESS_FAILED",ut.ERROR_NO_ACCESS_AFTER_SUCCESSFUL_ACTIVATION_WITH_REQUESTED_ACCESS_FEATURES="NO_ACCESS_AFTER_SUCCESSFUL_ACTIVATION_WITH_REQUESTED_ACCESS_FEATURES";const ft=ut;var lt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};const dt=class{constructor(){this.requestedAccessFeatures=["newspaper"],this.reload=!1}withAccessFeatures(e){return this.requestedAccessFeatures=e,this}reloadOnAccess(){return this.reload=!0,this}redirectOnAccess(e){return this.requestedUrl=e,this}tryUnlock(){return lt(this,void 0,void 0,(function*(){const{state:{isLoggedIn:e}}=yield(new Re).withAttributes(["name"]).fetch();if(!e)return yield Pe(void 0,void 0,void 0,(function*(){return xe([{name:"paywall",handler:()=>Promise.resolve(!0)}])})),{isLoggedIn:!1,hasAccess:!1,accessFeatures:[]};let n=yield this.setAccessCookiesAndGetAccessFeatures(this.requestedAccessFeatures);if(n.denied){if(n=yield this.activateAccess(this.requestedAccessFeatures),n.denied)return{isLoggedIn:!0,hasAccess:!1,accessFeatures:n.accessFeatures};if(n=yield this.setAccessCookiesAndGetAccessFeatures(this.requestedAccessFeatures),n.denied)throw new ft("New subscription was attached and checked successfully, but internal systems disagree about current newspaper access.",ft.ERROR_NO_ACCESS_AFTER_SUCCESSFUL_ACTIVATION_WITH_REQUESTED_ACCESS_FEATURES)}if(this.reload||this.requestedUrl){if(r=this.requestedUrl,ce("aid-paywall-reload-performed")===(r||t()))throw new ft("Unlock check already performed.",ft.ERROR_RELOADED_NO_ACCESS);(e=>{const n=new Date;n.setTime(n.getTime()+12e4),ue("aid-paywall-reload-performed",e||t(),n)})(this.requestedUrl),this.reload&&window.location.reload(),this.requestedUrl&&(e=>{window.location.replace(e)})(this.requestedUrl)}var r;return{isLoggedIn:!0,hasAccess:!0,accessFeatures:n.accessFeatures}}))}setAccessCookiesAndGetAccessFeatures(e){return(t=o(),he(void 0,void 0,void 0,(function*(){const e=[];return e.push(ge(t).catch((()=>Promise.resolve({success:!1,accessFeatures:[]})))),e.push(me(t).catch((()=>Promise.resolve({success:!1,accessFeatures:[]})))),Promise.all(e).then((e=>e.reduce(((e,t)=>({success:e.success&&t.success,accessFeatures:e.accessFeatures.concat(t.accessFeatures).filter(((e,t,n)=>n.indexOf(e)===t)).sort()})),{success:!0,accessFeatures:[]})))}))).then((t=>{const n=!ye(t.accessFeatures,e);if(!t.success&&n)throw new ft("Could not set access cookies",ft.ERROR_ENABLING_ACCESS_FAILED);return{denied:n,accessFeatures:t.accessFeatures}}));var t}activateAccess(e){return lt(this,void 0,void 0,(function*(){const t=yield pe(this.requestedAccessFeatures);return{denied:!ye(t,e),accessFeatures:t}}))}},vt=e=>(e=>{const t=new URL(`https://${i()}/aid/logg_inn/${o()}/`);t.searchParams.set("requestedUrl",e instanceof URL?e.href:e),le(t.href)})(e||t()),ht=()=>de(),pt=e=>new Promise((t=>{E(be.ON_ACTIVATION_COMPLETE,(n=>{const r=n.detail.accessFeatures;t({hasAccess:ye(r,e),accessFeatures:r})})),_(new CustomEvent(be.REQUEST_ACTIVATION,{detail:{accessFeatures:e}}))})),yt=e=>{_(new CustomEvent(Ee.UPDATE_STORAGE,{detail:e}))};"undefined"==typeof process&&(b(Ee.REQUEST_STATE,(()=>{const e=V("state");e&&Object.keys(e).length>0&&_(new CustomEvent(Ee.ON_STATE_UPDATED,{detail:e})),q("state",(e=>{_(new CustomEvent(Ee.ON_STATE_UPDATED,{detail:e}))}))})),q("userAttributes",(e=>{_(new CustomEvent(Ee.ON_ATTRIBUTES_UPDATED,{detail:e}))})),b(Ee.REQUEST_USER_ATTRIBUTES,(e=>{const t=e.detail,n=V("userAttributes")||{};Object.keys(n).length>0&&_(new CustomEvent(Ee.ON_ATTRIBUTES_UPDATED,{detail:n}));const r=t.filter((e=>void 0===n[e]));r.length>0&&(e=>{const t=[];e.forEach((e=>{const n=ct[e];n?t.includes(n)||t.push(n):p(`Unknown attribute ${e} was requested`)}));const n=[];t.forEach((e=>{n.push(e().then((e=>{B("userAttributes",e)})).catch((t=>{p(`User attribute call failed (${e.toString()})`,t)})))})),Promise.all(n).then((()=>{}))})(r)})),q("storage",(e=>{_(new CustomEvent(Ee.ON_STORAGE_UPDATED,{detail:e}))})),b(Ee.REQUEST_STORAGE_NAMESPACES,(e=>{st().then((()=>{const t=e.detail,n=V("storage")||{};Object.keys(n).length>0&&_(new CustomEvent(Ee.ON_STORAGE_UPDATED,{detail:n}));const r=t.filter((e=>void 0===n[e]));r.length>0&&tt(r).then((e=>{B("storage",e)}))}))})),b(Ee.UPDATE_STORAGE,(e=>{st().then((()=>{var t;t=e.detail,Object.keys(t).forEach((e=>((e,t)=>Je(void 0,void 0,void 0,(function*(){const n=yield et(`/api/europa/v1/me/${e}`,"PATCH",t);return n.ok?((e,t)=>Je(void 0,void 0,void 0,(function*(){const n=yield A("europa",Ze),r=n?Object.assign(Object.assign({},n),{namespaces:Object.assign(Object.assign({},n.namespaces),{[e]:t})}):{namespaces:{[e]:t}};return N("europa",r,Date.now()+Xe)})))(e,t):(y(`Could not get namespace: ${e}, status: ${n.status}, statusText: ${n.statusText}`,n),{})})))(e,t[e])))}))})),Le(void 0,void 0,void 0,(function*(){let e=!1;b(De.LOADED,(()=>{e||(e=!0,function(){Le(this,void 0,void 0,(function*(){for(const e of Fe)yield e()}))}())})),_(new CustomEvent(De.LOADED))})))})();var o=r.Hr,i=r.vg,a=r.EX,s=r.kS,c=r.Lk,u=r.Hc;export{o as PaywallUnlockRequest,i as UserDataRequest,a as goToLoginPage,s as logout,c as tryActivateSubscriptionAccess,u as updateStorage};
|
|
1
|
+
(()=>{var ys=Object.create;var St=Object.defineProperty,Es=Object.defineProperties,bs=Object.getOwnPropertyDescriptor,_s=Object.getOwnPropertyDescriptors,Ss=Object.getOwnPropertyNames,dn=Object.getOwnPropertySymbols,ws=Object.getPrototypeOf,pn=Object.prototype.hasOwnProperty,Rs=Object.prototype.propertyIsEnumerable;var mn=(e,t,r)=>t in e?St(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,re=(e,t)=>{for(var r in t||(t={}))pn.call(t,r)&&mn(e,r,t[r]);if(dn)for(var r of dn(t))Rs.call(t,r)&&mn(e,r,t[r]);return e},ue=(e,t)=>Es(e,_s(t)),Cs=e=>St(e,"__esModule",{value:!0});var ct=e=>{if(typeof require!="undefined")return require(e);throw new Error('Dynamic require of "'+e+'" is not supported')};var x=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var As=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ss(t))!pn.call(e,n)&&n!=="default"&&St(e,n,{get:()=>t[n],enumerable:!(r=bs(t,n))||r.enumerable});return e},Se=e=>As(Cs(St(e!=null?ys(ws(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var T=(e,t,r)=>new Promise((n,s)=>{var l=h=>{try{p(r.next(h))}catch(_){s(_)}},d=h=>{try{p(r.throw(h))}catch(_){s(_)}},p=h=>h.done?n(h.value):Promise.resolve(h.value).then(l,d);p((r=r.apply(e,t)).next())});var yn=x(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0})});var br=x(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.Failcode=void 0;Ct.Failcode={TYPE_INCORRECT:"TYPE_INCORRECT",VALUE_INCORRECT:"VALUE_INCORRECT",KEY_INCORRECT:"KEY_INCORRECT",CONTENT_INCORRECT:"CONTENT_INCORRECT",ARGUMENT_INCORRECT:"ARGUMENT_INCORRECT",RETURN_INCORRECT:"RETURN_INCORRECT",CONSTRAINT_FAILED:"CONSTRAINT_FAILED",PROPERTY_MISSING:"PROPERTY_MISSING",PROPERTY_PRESENT:"PROPERTY_PRESENT",NOTHING_EXPECTED:"NOTHING_EXPECTED"}});var He=x(Ke=>{"use strict";var Ls=Ke&&Ke.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var l in s)Object.prototype.hasOwnProperty.call(s,l)&&(n[l]=s[l])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(Ke,"__esModule",{value:!0});Ke.ValidationError=void 0;var Fs=function(e){Ls(t,e);function t(r){var n=e.call(this,r.message)||this;return n.name="ValidationError",n.code=r.code,r.details!==void 0&&(n.details=r.details),Object.setPrototypeOf(n,t.prototype),n}return t}(Error);Ke.ValidationError=Fs});var At=x(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});var ve=function(e,t){return function(r){var n=function(d){return e?"("+d+")":d};if(t.has(r))return n("CIRCULAR "+r.tag);t.add(r);try{switch(r.tag){case"unknown":case"never":case"void":case"boolean":case"number":case"bigint":case"string":case"symbol":case"function":return r.tag;case"literal":{var s=r.value;return typeof s=="string"?'"'+s+'"':String(s)}case"array":return""+En(r)+ve(!0,t)(r.element)+"[]";case"dictionary":return"{ [_: "+r.key+"]: "+ve(!1,t)(r.value)+" }";case"record":{var l=Object.keys(r.fields);return l.length?"{ "+l.map(function(d){return""+En(r)+d+ks(r,d)+": "+(r.fields[d].tag==="optional"?ve(!1,t)(r.fields[d].underlying):ve(!1,t)(r.fields[d]))+";"}).join(" ")+" }":"{}"}case"tuple":return"["+r.components.map(ve(!1,t)).join(", ")+"]";case"union":return n(""+r.alternatives.map(ve(!0,t)).join(" | "));case"intersect":return n(""+r.intersectees.map(ve(!0,t)).join(" & "));case"optional":return ve(e,t)(r.underlying)+" | undefined";case"constraint":return r.name||ve(e,t)(r.underlying);case"instanceof":return r.ctor.name;case"brand":return ve(e,t)(r.entity)}}finally{t.delete(r)}throw Error("impossible")}};_r.default=ve(!1,new Set);function ks(e,t){var r=e.isPartial,n=e.fields;return r||t!==void 0&&n[t].tag==="optional"?"?":""}function En(e){var t=e.isReadonly;return t?"readonly ":""}});var H=x(q=>{"use strict";var Sr=q&&q.__assign||function(){return Sr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},Sr.apply(this,arguments)};Object.defineProperty(q,"__esModule",{value:!0});q.FAILURE=q.SUCCESS=q.enumerableKeysOf=q.typeOf=q.hasKey=void 0;var Ee=br(),ze=At();function js(e,t){return typeof t=="object"&&t!==null&&e in t}q.hasKey=js;var qs=function(e){var t,r,n;return typeof e=="object"?e===null?"null":Array.isArray(e)?"array":((t=e.constructor)===null||t===void 0?void 0:t.name)==="Object"?"object":(n=(r=e.constructor)===null||r===void 0?void 0:r.name)!==null&&n!==void 0?n:typeof e:typeof e};q.typeOf=qs;var Ms=function(e){return typeof e=="object"&&e!==null?Reflect.ownKeys(e).filter(function(t){var r,n;return(n=(r=e.propertyIsEnumerable)===null||r===void 0?void 0:r.call(e,t))!==null&&n!==void 0?n:!0}):[]};q.enumerableKeysOf=Ms;function Bs(e){return{success:!0,value:e}}q.SUCCESS=Bs;q.FAILURE=Object.assign(function(e,t,r){return Sr({success:!1,code:e,message:t},r?{details:r}:{})},{TYPE_INCORRECT:function(e,t){var r="Expected "+ze.default(e)+", but was "+q.typeOf(t);return q.FAILURE(Ee.Failcode.TYPE_INCORRECT,r)},VALUE_INCORRECT:function(e,t,r){return q.FAILURE(Ee.Failcode.VALUE_INCORRECT,"Expected "+e+" "+String(t)+", but was "+String(r))},KEY_INCORRECT:function(e,t,r){return q.FAILURE(Ee.Failcode.KEY_INCORRECT,"Expected "+ze.default(e)+" key to be "+ze.default(t)+", but was "+q.typeOf(r))},CONTENT_INCORRECT:function(e,t){var r="Expected "+ze.default(e)+", but was incompatible";return q.FAILURE(Ee.Failcode.CONTENT_INCORRECT,r,t)},ARGUMENT_INCORRECT:function(e){return q.FAILURE(Ee.Failcode.ARGUMENT_INCORRECT,e)},RETURN_INCORRECT:function(e){return q.FAILURE(Ee.Failcode.RETURN_INCORRECT,e)},CONSTRAINT_FAILED:function(e,t){var r=t?": "+t:"";return q.FAILURE(Ee.Failcode.CONSTRAINT_FAILED,"Failed constraint check for "+ze.default(e)+r)},PROPERTY_MISSING:function(e){var t="Expected "+ze.default(e)+", but was missing";return q.FAILURE(Ee.Failcode.PROPERTY_MISSING,t)},PROPERTY_PRESENT:function(e){var t="Expected nothing, but was "+q.typeOf(e);return q.FAILURE(Ee.Failcode.PROPERTY_PRESENT,t)},NOTHING_EXPECTED:function(e){var t="Expected nothing, but was "+q.typeOf(e);return q.FAILURE(Ee.Failcode.NOTHING_EXPECTED,t)}})});var bn=x(Te=>{"use strict";var $s=Te&&Te.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),s,l=[],d;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)l.push(s.value)}catch(p){d={error:p}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(d)throw d.error}}return l},Vs=Te&&Te.__spreadArray||function(e,t){for(var r=0,n=t.length,s=e.length;r<n;r++,s++)e[s]=t[r];return e};Object.defineProperty(Te,"__esModule",{value:!0});Te.Contract=void 0;var Gs=He(),Ys=H();function Ws(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.length-1,n=e.slice(0,r),s=e[r];return{enforce:function(l){return function(){for(var d=[],p=0;p<arguments.length;p++)d[p]=arguments[p];if(d.length<n.length){var h="Expected "+n.length+" arguments but only received "+d.length,_=Ys.FAILURE.ARGUMENT_INCORRECT(h);throw new Gs.ValidationError(_)}for(var S=0;S<n.length;S++)n[S].check(d[S]);return s.check(l.apply(void 0,Vs([],$s(d))))}}}}Te.Contract=Ws});var wn=x(Oe=>{"use strict";var Ks=Oe&&Oe.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),s,l=[],d;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)l.push(s.value)}catch(p){d={error:p}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(d)throw d.error}}return l},Hs=Oe&&Oe.__spreadArray||function(e,t){for(var r=0,n=t.length,s=e.length;r<n;r++,s++)e[s]=t[r];return e};Object.defineProperty(Oe,"__esModule",{value:!0});Oe.AsyncContract=void 0;var _n=He(),Sn=H();function zs(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.length-1,n=e.slice(0,r),s=e[r];return{enforce:function(l){return function(){for(var d=[],p=0;p<arguments.length;p++)d[p]=arguments[p];if(d.length<n.length){var h="Expected "+n.length+" arguments but only received "+d.length,_=Sn.FAILURE.ARGUMENT_INCORRECT(h);throw new _n.ValidationError(_)}for(var S=0;S<n.length;S++)n[S].check(d[S]);var R=l.apply(void 0,Hs([],Ks(d)));if(!(R instanceof Promise)){var h="Expected function to return a promise, but instead got "+R,_=Sn.FAILURE.RETURN_INCORRECT(h);throw new _n.ValidationError(_)}return R.then(s.check)}}}}Oe.AsyncContract=zs});var Rn=x(Ie=>{"use strict";var Qs=Ie&&Ie.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Js=Ie&&Ie.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),s,l=[],d;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)l.push(s.value)}catch(p){d={error:p}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(d)throw d.error}}return l};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.match=void 0;function Xs(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(r){var n,s;try{for(var l=Qs(e),d=l.next();!d.done;d=l.next()){var p=Js(d.value,2),h=p[0],_=p[1];if(h.guard(r))return _(r)}}catch(S){n={error:S}}finally{try{d&&!d.done&&(s=l.return)&&s.call(l)}finally{if(n)throw n.error}}throw new Error("No alternatives were matched")}}Ie.match=Xs});var Q=x(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.innerValidate=Qe.create=void 0;var Ne=Pe(),Zs=At(),ea=He(),ta=H();function ra(e,t){return t.check=r,t.assert=r,t._innerValidate=function(R,v){return v.has(R,t)?ta.SUCCESS(R):e(R,v)},t.validate=function(R){return t._innerValidate(R,oa())},t.guard=n,t.Or=s,t.And=l,t.optional=d,t.nullable=p,t.withConstraint=h,t.withGuard=_,t.withBrand=S,t.reflect=t,t.toString=function(){return"Runtype<"+Zs.default(t)+">"},t;function r(R){var v=t.validate(R);if(v.success)return v.value;throw new ea.ValidationError(v)}function n(R){return t.validate(R).success}function s(R){return Ne.Union(t,R)}function l(R){return Ne.Intersect(t,R)}function d(){return Ne.Optional(t)}function p(){return Ne.Union(t,Ne.Null)}function h(R,v){return Ne.Constraint(t,R,v)}function _(R,v){return Ne.Constraint(t,R,v)}function S(R){return Ne.Brand(R,t)}}Qe.create=ra;function na(e,t,r){return e._innerValidate(t,r)}Qe.innerValidate=na;function oa(){var e=new WeakMap,t=function(n,s){if(!(n===null||typeof n!="object")){var l=e.get(n);e.set(n,l?l.set(s,!0):new WeakMap().set(s,!0))}},r=function(n,s){var l=e.get(n),d=l&&l.get(s)||!1;return t(n,s),d};return{has:r}}});var Ot=x(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.Unknown=void 0;var ia=Q(),sa=H(),aa={tag:"unknown"};Tt.Unknown=ia.create(function(e){return sa.SUCCESS(e)},aa)});var Cn=x(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.Never=void 0;var ua=Q(),ca=H(),fa={tag:"never"};It.Never=ua.create(ca.FAILURE.NOTHING_EXPECTED,fa)});var An=x(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.Void=void 0;var la=Ot();Nt.Void=la.Unknown});var wr=x(Je=>{"use strict";var Pt=Je&&Je.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Je,"__esModule",{value:!0});Je.Union=void 0;var Ut=Q(),lt=H();function da(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=function(){for(var s=[],l=0;l<arguments.length;l++)s[l]=arguments[l];return function(d){for(var p=0;p<e.length;p++)if(e[p].guard(d))return s[p](d)}},n={tag:"union",alternatives:e,match:r};return Ut.create(function(s,l){var d,p,h,_,S,R,v,C;if(typeof s!="object"||s===null){try{for(var N=Pt(e),D=N.next();!D.done;D=N.next()){var B=D.value;if(Ut.innerValidate(B,s,l).success)return lt.SUCCESS(s)}}catch(te){d={error:te}}finally{try{D&&!D.done&&(p=N.return)&&p.call(N)}finally{if(d)throw d.error}}return lt.FAILURE.TYPE_INCORRECT(n,s)}var V={};try{for(var ie=Pt(e),Y=ie.next();!Y.done;Y=ie.next()){var B=Y.value;if(B.reflect.tag==="record"){var st=function(J){var ae=B.reflect.fields[J];ae.tag==="literal"&&(V[J]?V[J].every(function(Le){return Le!==ae.value})&&V[J].push(ae.value):V[J]=[ae.value])};for(var se in B.reflect.fields)st(se)}}}catch(te){h={error:te}}finally{try{Y&&!Y.done&&(_=ie.return)&&_.call(ie)}finally{if(h)throw h.error}}for(var se in V)if(V[se].length===e.length)try{for(var w=(S=void 0,Pt(e)),U=w.next();!U.done;U=w.next()){var B=U.value;if(B.reflect.tag==="record"){var I=B.reflect.fields[se];if(I.tag==="literal"&<.hasKey(se,s)&&s[se]===I.value)return Ut.innerValidate(B,s,l)}}}catch(J){S={error:J}}finally{try{U&&!U.done&&(R=w.return)&&R.call(w)}finally{if(S)throw S.error}}try{for(var L=Pt(e),K=L.next();!K.done;K=L.next()){var ne=K.value;if(Ut.innerValidate(ne,s,l).success)return lt.SUCCESS(s)}}catch(te){v={error:te}}finally{try{K&&!K.done&&(C=L.return)&&C.call(L)}finally{if(v)throw v.error}}return lt.FAILURE.TYPE_INCORRECT(n,s)},n)}Je.Union=da});var In=x(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.Nullish=le.Null=le.Undefined=le.Literal=void 0;var pa=Q(),Tn=H(),ma=wr();function On(e){return Array.isArray(e)?String(e.map(String)):typeof e=="bigint"?String(e)+"n":String(e)}function Rr(e){var t={tag:"literal",value:e};return pa.create(function(r){return r===e?Tn.SUCCESS(r):Tn.FAILURE.VALUE_INCORRECT("literal","`"+On(e)+"`","`"+On(r)+"`")},t)}le.Literal=Rr;le.Undefined=Rr(void 0);le.Null=Rr(null);le.Nullish=ma.Union(le.Null,le.Undefined)});var Un=x(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.Boolean=void 0;var va=Q(),Nn=H(),Pn={tag:"boolean"};xt.Boolean=va.create(function(e){return typeof e=="boolean"?Nn.SUCCESS(e):Nn.FAILURE.TYPE_INCORRECT(Pn,e)},Pn)});var Ln=x(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.Number=void 0;var ha=Q(),xn=H(),Dn={tag:"number"};Dt.Number=ha.create(function(e){return typeof e=="number"?xn.SUCCESS(e):xn.FAILURE.TYPE_INCORRECT(Dn,e)},Dn)});var jn=x(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.BigInt=void 0;var ga=Q(),Fn=H(),kn={tag:"bigint"};Lt.BigInt=ga.create(function(e){return typeof e=="bigint"?Fn.SUCCESS(e):Fn.FAILURE.TYPE_INCORRECT(kn,e)},kn)});var Cr=x(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.String=void 0;var ya=Q(),qn=H(),Mn={tag:"string"};Ft.String=ya.create(function(e){return typeof e=="string"?qn.SUCCESS(e):qn.FAILURE.TYPE_INCORRECT(Mn,e)},Mn)});var Gn=x(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.Symbol=void 0;var Bn=Q(),dt=H(),Ea=function(e){var t={tag:"symbol",key:e};return Bn.create(function(r){if(typeof r!="symbol")return dt.FAILURE.TYPE_INCORRECT(t,r);var n=globalThis.Symbol.keyFor(r);return n!==e?dt.FAILURE.VALUE_INCORRECT("symbol key",Vn(e),Vn(n)):dt.SUCCESS(r)},t)},$n={tag:"symbol"};kt.Symbol=Bn.create(function(e){return typeof e=="symbol"?dt.SUCCESS(e):dt.FAILURE.TYPE_INCORRECT($n,e)},Object.assign(Ea,$n));var Vn=function(e){return e===void 0?"undefined":'"'+e+'"'}});var Kn=x(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.Array=void 0;var Yn=Q(),pt=H();function Wn(e,t){var r={tag:"array",isReadonly:t,element:e};return _a(Yn.create(function(n,s){if(!Array.isArray(n))return pt.FAILURE.TYPE_INCORRECT(r,n);var l=pt.enumerableKeysOf(n),d=l.map(function(h){return Yn.innerValidate(e,n[h],s)}),p=l.reduce(function(h,_){var S=d[_];return S.success||(h[_]=S.details||S.message),h},[]);return pt.enumerableKeysOf(p).length!==0?pt.FAILURE.CONTENT_INCORRECT(r,p):pt.SUCCESS(n)},r))}function ba(e){return Wn(e,!1)}jt.Array=ba;function _a(e){return e.asReadonly=t,e;function t(){return Wn(e.element,!0)}}});var zn=x(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.Tuple=void 0;var Hn=Q(),Xe=H();function Sa(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r={tag:"tuple",components:e};return Hn.create(function(n,s){if(!Array.isArray(n))return Xe.FAILURE.TYPE_INCORRECT(r,n);if(n.length!==e.length)return Xe.FAILURE.CONSTRAINT_FAILED(r,"Expected length "+e.length+", but was "+n.length);var l=Xe.enumerableKeysOf(n),d=l.map(function(h){return Hn.innerValidate(e[h],n[h],s)}),p=l.reduce(function(h,_){var S=d[_];return S.success||(h[_]=S.details||S.message),h},[]);return Xe.enumerableKeysOf(p).length!==0?Xe.FAILURE.CONTENT_INCORRECT(r,p):Xe.SUCCESS(n)},r)}qt.Tuple=Sa});var Jn=x(de=>{"use strict";var Ar=de&&de.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),s,l=[],d;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)l.push(s.value)}catch(p){d={error:p}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(d)throw d.error}}return l},Tr=de&&de.__spreadArray||function(e,t){for(var r=0,n=t.length,s=e.length;r<n;r++,s++)e[s]=t[r];return e};Object.defineProperty(de,"__esModule",{value:!0});de.Partial=de.Record=de.InternalRecord=void 0;var Qn=Q(),ce=H();function Ue(e,t,r){var n={tag:"record",isPartial:t,isReadonly:r,fields:e};return Ca(Qn.create(function(s,l){if(s==null)return ce.FAILURE.TYPE_INCORRECT(n,s);var d=ce.enumerableKeysOf(e);if(d.length!==0&&typeof s!="object")return ce.FAILURE.TYPE_INCORRECT(n,s);var p=Tr([],Ar(new Set(Tr(Tr([],Ar(d)),Ar(ce.enumerableKeysOf(s)))))),h=p.reduce(function(S,R){var v=ce.hasKey(R,e),C=ce.hasKey(R,s);if(v){var N=e[R],D=t||N.reflect.tag==="optional";if(C){var B=s[R];D&&B===void 0?S[R]=ce.SUCCESS(B):S[R]=Qn.innerValidate(N,B,l)}else D?S[R]=ce.SUCCESS(void 0):S[R]=ce.FAILURE.PROPERTY_MISSING(N.reflect)}else if(C){var B=s[R];S[R]=ce.SUCCESS(B)}else throw new Error("impossible");return S},{}),_=p.reduce(function(S,R){var v=h[R];return v.success||(S[R]=v.details||v.message),S},{});return ce.enumerableKeysOf(_).length!==0?ce.FAILURE.CONTENT_INCORRECT(n,_):ce.SUCCESS(s)},n))}de.InternalRecord=Ue;function wa(e){return Ue(e,!1,!1)}de.Record=wa;function Ra(e){return Ue(e,!0,!1)}de.Partial=Ra;function Ca(e){return e.asPartial=t,e.asReadonly=r,e.pick=n,e.omit=s,e.extend=l,e;function t(){return Ue(e.fields,!0,e.isReadonly)}function r(){return Ue(e.fields,e.isPartial,!0)}function n(){for(var d=[],p=0;p<arguments.length;p++)d[p]=arguments[p];var h={};return d.forEach(function(_){h[_]=e.fields[_]}),Ue(h,e.isPartial,e.isReadonly)}function s(){for(var d=[],p=0;p<arguments.length;p++)d[p]=arguments[p];var h={},_=ce.enumerableKeysOf(e.fields);return _.forEach(function(S){d.includes(S)||(h[S]=e.fields[S])}),Ue(h,e.isPartial,e.isReadonly)}function l(d){return Ue(Object.assign({},e.fields,d),e.isPartial,e.isReadonly)}}});var Ir=x(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.Guard=Ze.Constraint=void 0;var Aa=Q(),Or=H(),Ta=Ot();function Oa(e,t,r){var n=r&&r.name,s=r&&r.args,l={tag:"constraint",underlying:e,constraint:t,name:n,args:s};return Aa.create(function(d){var p=e.validate(d);if(!p.success)return p;var h=t(p.value);return typeof h=="string"?Or.FAILURE.CONSTRAINT_FAILED(l,h):h?Or.SUCCESS(p.value):Or.FAILURE.CONSTRAINT_FAILED(l)},l)}Ze.Constraint=Oa;var Ia=function(e,t){return Ta.Unknown.withGuard(e,t)};Ze.Guard=Ia});var Zn=x(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.Dictionary=void 0;var Xn=Q(),Nr=Cr(),Na=Ir(),Pa=At(),Fe=H(),Ua=Na.Constraint(Nr.String,function(e){return!isNaN(+e)},{name:"number"});function xa(e,t){var r=t===void 0||t==="string"?Nr.String:t==="number"?Ua:t,n=Pa.default(r),s={tag:"dictionary",key:n,value:e};return Xn.create(function(l,d){if(l==null||typeof l!="object"||Object.getPrototypeOf(l)!==Object.prototype&&(!Array.isArray(l)||n==="string"))return Fe.FAILURE.TYPE_INCORRECT(s,l);var p=/^(?:NaN|-?\d+(?:\.\d+)?)$/,h=Fe.enumerableKeysOf(l),_=h.reduce(function(R,v){var C=typeof v=="string"&&p.test(v),N=C?globalThis.Number(v):v;return(C?!r.guard(N)&&!r.guard(v):!r.guard(N))?R[v]=Fe.FAILURE.KEY_INCORRECT(s,r.reflect,N):R[v]=Xn.innerValidate(e,l[v],d),R},{}),S=h.reduce(function(R,v){var C=_[v];return C.success||(R[v]=C.details||C.message),R},{});return Fe.enumerableKeysOf(S).length!==0?Fe.FAILURE.CONTENT_INCORRECT(s,S):Fe.SUCCESS(l)},s)}Mt.Dictionary=xa});var to=x(et=>{"use strict";var Da=et&&et.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(et,"__esModule",{value:!0});et.Intersect=void 0;var eo=Q(),La=H();function Fa(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r={tag:"intersect",intersectees:e};return eo.create(function(n,s){var l,d;try{for(var p=Da(e),h=p.next();!h.done;h=p.next()){var _=h.value,S=eo.innerValidate(_,n,s);if(!S.success)return S}}catch(R){l={error:R}}finally{try{h&&!h.done&&(d=p.return)&&d.call(p)}finally{if(l)throw l.error}}return La.SUCCESS(n)},r)}et.Intersect=Fa});var ro=x(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.Optional=void 0;var ka=Q(),ja=H();function qa(e){var t={tag:"optional",underlying:e};return ka.create(function(r){return r===void 0?ja.SUCCESS(r):e.validate(r)},t)}Bt.Optional=qa});var io=x($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.Function=void 0;var Ma=Q(),no=H(),oo={tag:"function"};$t.Function=Ma.create(function(e){return typeof e=="function"?no.SUCCESS(e):no.FAILURE.TYPE_INCORRECT(oo,e)},oo)});var ao=x(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.InstanceOf=void 0;var Ba=Q(),so=H();function $a(e){var t={tag:"instanceof",ctor:e};return Ba.create(function(r){return r instanceof e?so.SUCCESS(r):so.FAILURE.TYPE_INCORRECT(t,r)},t)}Vt.InstanceOf=$a});var uo=x(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.Lazy=void 0;var Va=Q();function Ga(e){var t={get tag(){return n().tag}},r;function n(){if(!r){r=e();for(var s in r)s!=="tag"&&(t[s]=r[s])}return r}return Va.create(function(s){return n().validate(s)},t)}Gt.Lazy=Ga});var co=x(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.Brand=void 0;var Ya=Q();function Wa(e,t){var r={tag:"brand",brand:e,entity:t};return Ya.create(function(n){return t.validate(n)},r)}Yt.Brand=Wa});var fo=x(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.checked=tt.check=void 0;var Ka=He(),Ha=H(),Pr=new WeakMap;function za(e,t,r){var n=Pr.get(e)||new Map;Pr.set(e,n);var s=n.get(t)||[];n.set(t,s),s.push(r)}tt.check=za;function Qa(e,t,r){var n=Pr.get(e),s=n&&n.get(t);if(s)return s;for(var l=[],d=0;d<r;d++)l.push(d);return l}function Ja(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length===0)throw new Error("No runtype provided to `@checked`. Please remove the decorator.");return function(r,n,s){var l=s.value,d=(r.name||r.constructor.name+".prototype")+(typeof n=="string"?'["'+n+'"]':"["+String(n)+"]"),p=Qa(r,n,e.length);if(p.length!==e.length)throw new Error("Number of `@checked` runtypes and @check parameters not matched.");if(p.length>l.length)throw new Error("Number of `@checked` runtypes exceeds actual parameter length.");s.value=function(){for(var h=[],_=0;_<arguments.length;_++)h[_]=arguments[_];return e.forEach(function(S,R){var v=p[R],C=S.validate(h[v]);if(!C.success){var N=d+", argument #"+v+": "+C.message,D=Ha.FAILURE.ARGUMENT_INCORRECT(N);throw new Ka.ValidationError(D)}}),l.apply(this,h)}}}tt.checked=Ja});var Pe=x(O=>{"use strict";var Xa=O&&O.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),G=O&&O.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Xa(t,e,r)};Object.defineProperty(O,"__esModule",{value:!0});O.InstanceOf=O.Nullish=O.Null=O.Undefined=O.Literal=void 0;G(yn(),O);G(br(),O);G(bn(),O);G(wn(),O);G(Rn(),O);G(He(),O);G(Ot(),O);G(Cn(),O);G(An(),O);var Wt=In();Object.defineProperty(O,"Literal",{enumerable:!0,get:function(){return Wt.Literal}});Object.defineProperty(O,"Undefined",{enumerable:!0,get:function(){return Wt.Undefined}});Object.defineProperty(O,"Null",{enumerable:!0,get:function(){return Wt.Null}});Object.defineProperty(O,"Nullish",{enumerable:!0,get:function(){return Wt.Nullish}});G(Un(),O);G(Ln(),O);G(jn(),O);G(Cr(),O);G(Gn(),O);G(Kn(),O);G(zn(),O);G(Jn(),O);G(Zn(),O);G(wr(),O);G(to(),O);G(ro(),O);G(io(),O);var Za=ao();Object.defineProperty(O,"InstanceOf",{enumerable:!0,get:function(){return Za.InstanceOf}});G(uo(),O);G(Ir(),O);G(co(),O);G(fo(),O)});var bo=x(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});var yo=function(e){if(typeof e=="object"&&e!==null){if(typeof Object.getPrototypeOf=="function"){var t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}return Object.prototype.toString.call(e)==="[object Object]"}return!1},Eo=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce(function(r,n){return Object.keys(n).forEach(function(s){Array.isArray(r[s])&&Array.isArray(n[s])?r[s]=Array.from(new Set(r[s].concat(n[s]))):yo(r[s])&&yo(n[s])?r[s]=Eo(r[s],n[s]):r[s]=n[s]}),r},{})};Dr.default=Eo});var zo=x((Ho,Mr)=>{(function(e){if(typeof Ho=="object"&&typeof Mr!="undefined")Mr.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t;typeof window!="undefined"?t=window:typeof global!="undefined"?t=global:typeof self!="undefined"?t=self:t=this,t.localforage=e()}})(function(){var e,t,r;return function n(s,l,d){function p(S,R){if(!l[S]){if(!s[S]){var v=typeof ct=="function"&&ct;if(!R&&v)return v(S,!0);if(h)return h(S,!0);var C=new Error("Cannot find module '"+S+"'");throw C.code="MODULE_NOT_FOUND",C}var N=l[S]={exports:{}};s[S][0].call(N.exports,function(D){var B=s[S][1][D];return p(B||D)},N,N.exports,n,s,l,d)}return l[S].exports}for(var h=typeof ct=="function"&&ct,_=0;_<d.length;_++)p(d[_]);return p}({1:[function(n,s,l){(function(d){"use strict";var p=d.MutationObserver||d.WebKitMutationObserver,h;if(p){var _=0,S=new p(D),R=d.document.createTextNode("");S.observe(R,{characterData:!0}),h=function(){R.data=_=++_%2}}else if(!d.setImmediate&&typeof d.MessageChannel!="undefined"){var v=new d.MessageChannel;v.port1.onmessage=D,h=function(){v.port2.postMessage(0)}}else"document"in d&&"onreadystatechange"in d.document.createElement("script")?h=function(){var V=d.document.createElement("script");V.onreadystatechange=function(){D(),V.onreadystatechange=null,V.parentNode.removeChild(V),V=null},d.document.documentElement.appendChild(V)}:h=function(){setTimeout(D,0)};var C,N=[];function D(){C=!0;for(var V,ie,Y=N.length;Y;){for(ie=N,N=[],V=-1;++V<Y;)ie[V]();Y=N.length}C=!1}s.exports=B;function B(V){N.push(V)===1&&!C&&h()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(n,s,l){"use strict";var d=n(1);function p(){}var h={},_=["REJECTED"],S=["FULFILLED"],R=["PENDING"];s.exports=v;function v(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=R,this.queue=[],this.outcome=void 0,w!==p&&B(this,w)}v.prototype.catch=function(w){return this.then(null,w)},v.prototype.then=function(w,U){if(typeof w!="function"&&this.state===S||typeof U!="function"&&this.state===_)return this;var I=new this.constructor(p);if(this.state!==R){var L=this.state===S?w:U;N(I,L,this.outcome)}else this.queue.push(new C(I,w,U));return I};function C(w,U,I){this.promise=w,typeof U=="function"&&(this.onFulfilled=U,this.callFulfilled=this.otherCallFulfilled),typeof I=="function"&&(this.onRejected=I,this.callRejected=this.otherCallRejected)}C.prototype.callFulfilled=function(w){h.resolve(this.promise,w)},C.prototype.otherCallFulfilled=function(w){N(this.promise,this.onFulfilled,w)},C.prototype.callRejected=function(w){h.reject(this.promise,w)},C.prototype.otherCallRejected=function(w){N(this.promise,this.onRejected,w)};function N(w,U,I){d(function(){var L;try{L=U(I)}catch(K){return h.reject(w,K)}L===w?h.reject(w,new TypeError("Cannot resolve promise with itself")):h.resolve(w,L)})}h.resolve=function(w,U){var I=V(D,U);if(I.status==="error")return h.reject(w,I.value);var L=I.value;if(L)B(w,L);else{w.state=S,w.outcome=U;for(var K=-1,ne=w.queue.length;++K<ne;)w.queue[K].callFulfilled(U)}return w},h.reject=function(w,U){w.state=_,w.outcome=U;for(var I=-1,L=w.queue.length;++I<L;)w.queue[I].callRejected(U);return w};function D(w){var U=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof U=="function")return function(){U.apply(w,arguments)}}function B(w,U){var I=!1;function L(J){I||(I=!0,h.reject(w,J))}function K(J){I||(I=!0,h.resolve(w,J))}function ne(){U(K,L)}var te=V(ne);te.status==="error"&&L(te.value)}function V(w,U){var I={};try{I.value=w(U),I.status="success"}catch(L){I.status="error",I.value=L}return I}v.resolve=ie;function ie(w){return w instanceof this?w:h.resolve(new this(p),w)}v.reject=Y;function Y(w){var U=new this(p);return h.reject(U,w)}v.all=st;function st(w){var U=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var I=w.length,L=!1;if(!I)return this.resolve([]);for(var K=new Array(I),ne=0,te=-1,J=new this(p);++te<I;)ae(w[te],te);return J;function ae(Le,Et){U.resolve(Le).then(cr,function(Ve){L||(L=!0,h.reject(J,Ve))});function cr(Ve){K[Et]=Ve,++ne===I&&!L&&(L=!0,h.resolve(J,K))}}}v.race=se;function se(w){var U=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var I=w.length,L=!1;if(!I)return this.resolve([]);for(var K=-1,ne=new this(p);++K<I;)te(w[K]);return ne;function te(J){U.resolve(J).then(function(ae){L||(L=!0,h.resolve(ne,ae))},function(ae){L||(L=!0,h.reject(ne,ae))})}}},{"1":1}],3:[function(n,s,l){(function(d){"use strict";typeof d.Promise!="function"&&(d.Promise=n(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"2":2}],4:[function(n,s,l){"use strict";var d=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o};function p(o,a){if(!(o instanceof a))throw new TypeError("Cannot call a class as a function")}function h(){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(o){return}}var _=h();function S(){try{if(!_||!_.open)return!1;var o=typeof openDatabase!="undefined"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),a=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!o||a)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch(i){return!1}}function R(o,a){o=o||[],a=a||{};try{return new Blob(o,a)}catch(u){if(u.name!=="TypeError")throw u;for(var i=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,c=new i,f=0;f<o.length;f+=1)c.append(o[f]);return c.getBlob(a.type)}}typeof Promise=="undefined"&&n(3);var v=Promise;function C(o,a){a&&o.then(function(i){a(null,i)},function(i){a(i)})}function N(o,a,i){typeof a=="function"&&o.then(a),typeof i=="function"&&o.catch(i)}function D(o){return typeof o!="string"&&(console.warn(o+" used as a key, but it is not a string."),o=String(o)),o}function B(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var V="local-forage-detect-blob-support",ie=void 0,Y={},st=Object.prototype.toString,se="readonly",w="readwrite";function U(o){for(var a=o.length,i=new ArrayBuffer(a),c=new Uint8Array(i),f=0;f<a;f++)c[f]=o.charCodeAt(f);return i}function I(o){return new v(function(a){var i=o.transaction(V,w),c=R([""]);i.objectStore(V).put(c,"key"),i.onabort=function(f){f.preventDefault(),f.stopPropagation(),a(!1)},i.oncomplete=function(){var f=navigator.userAgent.match(/Chrome\/(\d+)/),u=navigator.userAgent.match(/Edge\//);a(u||!f||parseInt(f[1],10)>=43)}}).catch(function(){return!1})}function L(o){return typeof ie=="boolean"?v.resolve(ie):I(o).then(function(a){return ie=a,ie})}function K(o){var a=Y[o.name],i={};i.promise=new v(function(c,f){i.resolve=c,i.reject=f}),a.deferredOperations.push(i),a.dbReady?a.dbReady=a.dbReady.then(function(){return i.promise}):a.dbReady=i.promise}function ne(o){var a=Y[o.name],i=a.deferredOperations.pop();if(i)return i.resolve(),i.promise}function te(o,a){var i=Y[o.name],c=i.deferredOperations.pop();if(c)return c.reject(a),c.promise}function J(o,a){return new v(function(i,c){if(Y[o.name]=Y[o.name]||Yr(),o.db)if(a)K(o),o.db.close();else return i(o.db);var f=[o.name];a&&f.push(o.version);var u=_.open.apply(_,f);a&&(u.onupgradeneeded=function(m){var g=u.result;try{g.createObjectStore(o.storeName),m.oldVersion<=1&&g.createObjectStore(V)}catch(y){if(y.name==="ConstraintError")console.warn('The database "'+o.name+'" has been upgraded from version '+m.oldVersion+" to version "+m.newVersion+', but the storage "'+o.storeName+'" already exists.');else throw y}}),u.onerror=function(m){m.preventDefault(),c(u.error)},u.onsuccess=function(){i(u.result),ne(o)}})}function ae(o){return J(o,!1)}function Le(o){return J(o,!0)}function Et(o,a){if(!o.db)return!0;var i=!o.db.objectStoreNames.contains(o.storeName),c=o.version<o.db.version,f=o.version>o.db.version;if(c&&(o.version!==a&&console.warn('The database "'+o.name+`" can't be downgraded from version `+o.db.version+" to version "+o.version+"."),o.version=o.db.version),f||i){if(i){var u=o.db.version+1;u>o.version&&(o.version=u)}return!0}return!1}function cr(o){return new v(function(a,i){var c=new FileReader;c.onerror=i,c.onloadend=function(f){var u=btoa(f.target.result||"");a({__local_forage_encoded_blob:!0,data:u,type:o.type})},c.readAsBinaryString(o)})}function Ve(o){var a=U(atob(o.data));return R([a],{type:o.type})}function Gr(o){return o&&o.__local_forage_encoded_blob}function Ei(o){var a=this,i=a._initReady().then(function(){var c=Y[a._dbInfo.name];if(c&&c.dbReady)return c.dbReady});return N(i,o,o),i}function bi(o){K(o);for(var a=Y[o.name],i=a.forages,c=0;c<i.length;c++){var f=i[c];f._dbInfo.db&&(f._dbInfo.db.close(),f._dbInfo.db=null)}return o.db=null,ae(o).then(function(u){return o.db=u,Et(o)?Le(o):u}).then(function(u){o.db=a.db=u;for(var m=0;m<i.length;m++)i[m]._dbInfo.db=u}).catch(function(u){throw te(o,u),u})}function _e(o,a,i,c){c===void 0&&(c=1);try{var f=o.db.transaction(o.storeName,a);i(null,f)}catch(u){if(c>0&&(!o.db||u.name==="InvalidStateError"||u.name==="NotFoundError"))return v.resolve().then(function(){if(!o.db||u.name==="NotFoundError"&&!o.db.objectStoreNames.contains(o.storeName)&&o.version<=o.db.version)return o.db&&(o.version=o.db.version+1),Le(o)}).then(function(){return bi(o).then(function(){_e(o,a,i,c-1)})}).catch(i);i(u)}}function Yr(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function _i(o){var a=this,i={db:null};if(o)for(var c in o)i[c]=o[c];var f=Y[i.name];f||(f=Yr(),Y[i.name]=f),f.forages.push(a),a._initReady||(a._initReady=a.ready,a.ready=Ei);var u=[];function m(){return v.resolve()}for(var g=0;g<f.forages.length;g++){var y=f.forages[g];y!==a&&u.push(y._initReady().catch(m))}var E=f.forages.slice(0);return v.all(u).then(function(){return i.db=f.db,ae(i)}).then(function(b){return i.db=b,Et(i,a._defaultConfig.version)?Le(i):b}).then(function(b){i.db=f.db=b,a._dbInfo=i;for(var A=0;A<E.length;A++){var P=E[A];P!==a&&(P._dbInfo.db=i.db,P._dbInfo.version=i.version)}})}function Si(o,a){var i=this;o=D(o);var c=new v(function(f,u){i.ready().then(function(){_e(i._dbInfo,se,function(m,g){if(m)return u(m);try{var y=g.objectStore(i._dbInfo.storeName),E=y.get(o);E.onsuccess=function(){var b=E.result;b===void 0&&(b=null),Gr(b)&&(b=Ve(b)),f(b)},E.onerror=function(){u(E.error)}}catch(b){u(b)}})}).catch(u)});return C(c,a),c}function wi(o,a){var i=this,c=new v(function(f,u){i.ready().then(function(){_e(i._dbInfo,se,function(m,g){if(m)return u(m);try{var y=g.objectStore(i._dbInfo.storeName),E=y.openCursor(),b=1;E.onsuccess=function(){var A=E.result;if(A){var P=A.value;Gr(P)&&(P=Ve(P));var F=o(P,A.key,b++);F!==void 0?f(F):A.continue()}else f()},E.onerror=function(){u(E.error)}}catch(A){u(A)}})}).catch(u)});return C(c,a),c}function Ri(o,a,i){var c=this;o=D(o);var f=new v(function(u,m){var g;c.ready().then(function(){return g=c._dbInfo,st.call(a)==="[object Blob]"?L(g.db).then(function(y){return y?a:cr(a)}):a}).then(function(y){_e(c._dbInfo,w,function(E,b){if(E)return m(E);try{var A=b.objectStore(c._dbInfo.storeName);y===null&&(y=void 0);var P=A.put(y,o);b.oncomplete=function(){y===void 0&&(y=null),u(y)},b.onabort=b.onerror=function(){var F=P.error?P.error:P.transaction.error;m(F)}}catch(F){m(F)}})}).catch(m)});return C(f,i),f}function Ci(o,a){var i=this;o=D(o);var c=new v(function(f,u){i.ready().then(function(){_e(i._dbInfo,w,function(m,g){if(m)return u(m);try{var y=g.objectStore(i._dbInfo.storeName),E=y.delete(o);g.oncomplete=function(){f()},g.onerror=function(){u(E.error)},g.onabort=function(){var b=E.error?E.error:E.transaction.error;u(b)}}catch(b){u(b)}})}).catch(u)});return C(c,a),c}function Ai(o){var a=this,i=new v(function(c,f){a.ready().then(function(){_e(a._dbInfo,w,function(u,m){if(u)return f(u);try{var g=m.objectStore(a._dbInfo.storeName),y=g.clear();m.oncomplete=function(){c()},m.onabort=m.onerror=function(){var E=y.error?y.error:y.transaction.error;f(E)}}catch(E){f(E)}})}).catch(f)});return C(i,o),i}function Ti(o){var a=this,i=new v(function(c,f){a.ready().then(function(){_e(a._dbInfo,se,function(u,m){if(u)return f(u);try{var g=m.objectStore(a._dbInfo.storeName),y=g.count();y.onsuccess=function(){c(y.result)},y.onerror=function(){f(y.error)}}catch(E){f(E)}})}).catch(f)});return C(i,o),i}function Oi(o,a){var i=this,c=new v(function(f,u){if(o<0){f(null);return}i.ready().then(function(){_e(i._dbInfo,se,function(m,g){if(m)return u(m);try{var y=g.objectStore(i._dbInfo.storeName),E=!1,b=y.openKeyCursor();b.onsuccess=function(){var A=b.result;if(!A){f(null);return}o===0||E?f(A.key):(E=!0,A.advance(o))},b.onerror=function(){u(b.error)}}catch(A){u(A)}})}).catch(u)});return C(c,a),c}function Ii(o){var a=this,i=new v(function(c,f){a.ready().then(function(){_e(a._dbInfo,se,function(u,m){if(u)return f(u);try{var g=m.objectStore(a._dbInfo.storeName),y=g.openKeyCursor(),E=[];y.onsuccess=function(){var b=y.result;if(!b){c(E);return}E.push(b.key),b.continue()},y.onerror=function(){f(y.error)}}catch(b){f(b)}})}).catch(f)});return C(i,o),i}function Ni(o,a){a=B.apply(this,arguments);var i=this.config();o=typeof o!="function"&&o||{},o.name||(o.name=o.name||i.name,o.storeName=o.storeName||i.storeName);var c=this,f;if(!o.name)f=v.reject("Invalid arguments");else{var u=o.name===i.name&&c._dbInfo.db,m=u?v.resolve(c._dbInfo.db):ae(o).then(function(g){var y=Y[o.name],E=y.forages;y.db=g;for(var b=0;b<E.length;b++)E[b]._dbInfo.db=g;return g});o.storeName?f=m.then(function(g){if(!!g.objectStoreNames.contains(o.storeName)){var y=g.version+1;K(o);var E=Y[o.name],b=E.forages;g.close();for(var A=0;A<b.length;A++){var P=b[A];P._dbInfo.db=null,P._dbInfo.version=y}var F=new v(function(j,ee){var X=_.open(o.name,y);X.onerror=function(oe){var ut=X.result;ut.close(),ee(oe)},X.onupgradeneeded=function(){var oe=X.result;oe.deleteObjectStore(o.storeName)},X.onsuccess=function(){var oe=X.result;oe.close(),j(oe)}});return F.then(function(j){E.db=j;for(var ee=0;ee<b.length;ee++){var X=b[ee];X._dbInfo.db=j,ne(X._dbInfo)}}).catch(function(j){throw(te(o,j)||v.resolve()).catch(function(){}),j})}}):f=m.then(function(g){K(o);var y=Y[o.name],E=y.forages;g.close();for(var b=0;b<E.length;b++){var A=E[b];A._dbInfo.db=null}var P=new v(function(F,j){var ee=_.deleteDatabase(o.name);ee.onerror=ee.onblocked=function(X){var oe=ee.result;oe&&oe.close(),j(X)},ee.onsuccess=function(){var X=ee.result;X&&X.close(),F(X)}});return P.then(function(F){y.db=F;for(var j=0;j<E.length;j++){var ee=E[j];ne(ee._dbInfo)}}).catch(function(F){throw(te(o,F)||v.resolve()).catch(function(){}),F})})}return C(f,a),f}var Pi={_driver:"asyncStorage",_initStorage:_i,_support:S(),iterate:wi,getItem:Si,setItem:Ri,removeItem:Ci,clear:Ai,length:Ti,key:Oi,keys:Ii,dropInstance:Ni};function Ui(){return typeof openDatabase=="function"}var Ce="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xi="~~local_forage_type~",Wr=/^~~local_forage_type~([^~]+)~/,bt="__lfsc__:",fr=bt.length,lr="arbf",dr="blob",Kr="si08",Hr="ui08",zr="uic8",Qr="si16",Jr="si32",Xr="ur16",Zr="ui32",en="fl32",tn="fl64",rn=fr+lr.length,nn=Object.prototype.toString;function on(o){var a=o.length*.75,i=o.length,c,f=0,u,m,g,y;o[o.length-1]==="="&&(a--,o[o.length-2]==="="&&a--);var E=new ArrayBuffer(a),b=new Uint8Array(E);for(c=0;c<i;c+=4)u=Ce.indexOf(o[c]),m=Ce.indexOf(o[c+1]),g=Ce.indexOf(o[c+2]),y=Ce.indexOf(o[c+3]),b[f++]=u<<2|m>>4,b[f++]=(m&15)<<4|g>>2,b[f++]=(g&3)<<6|y&63;return E}function pr(o){var a=new Uint8Array(o),i="",c;for(c=0;c<a.length;c+=3)i+=Ce[a[c]>>2],i+=Ce[(a[c]&3)<<4|a[c+1]>>4],i+=Ce[(a[c+1]&15)<<2|a[c+2]>>6],i+=Ce[a[c+2]&63];return a.length%3==2?i=i.substring(0,i.length-1)+"=":a.length%3==1&&(i=i.substring(0,i.length-2)+"=="),i}function Di(o,a){var i="";if(o&&(i=nn.call(o)),o&&(i==="[object ArrayBuffer]"||o.buffer&&nn.call(o.buffer)==="[object ArrayBuffer]")){var c,f=bt;o instanceof ArrayBuffer?(c=o,f+=lr):(c=o.buffer,i==="[object Int8Array]"?f+=Kr:i==="[object Uint8Array]"?f+=Hr:i==="[object Uint8ClampedArray]"?f+=zr:i==="[object Int16Array]"?f+=Qr:i==="[object Uint16Array]"?f+=Xr:i==="[object Int32Array]"?f+=Jr:i==="[object Uint32Array]"?f+=Zr:i==="[object Float32Array]"?f+=en:i==="[object Float64Array]"?f+=tn:a(new Error("Failed to get type for BinaryArray"))),a(f+pr(c))}else if(i==="[object Blob]"){var u=new FileReader;u.onload=function(){var m=xi+o.type+"~"+pr(this.result);a(bt+dr+m)},u.readAsArrayBuffer(o)}else try{a(JSON.stringify(o))}catch(m){console.error("Couldn't convert value into a JSON string: ",o),a(null,m)}}function Li(o){if(o.substring(0,fr)!==bt)return JSON.parse(o);var a=o.substring(rn),i=o.substring(fr,rn),c;if(i===dr&&Wr.test(a)){var f=a.match(Wr);c=f[1],a=a.substring(f[0].length)}var u=on(a);switch(i){case lr:return u;case dr:return R([u],{type:c});case Kr:return new Int8Array(u);case Hr:return new Uint8Array(u);case zr:return new Uint8ClampedArray(u);case Qr:return new Int16Array(u);case Xr:return new Uint16Array(u);case Jr:return new Int32Array(u);case Zr:return new Uint32Array(u);case en:return new Float32Array(u);case tn:return new Float64Array(u);default:throw new Error("Unkown type: "+i)}}var mr={serialize:Di,deserialize:Li,stringToBuffer:on,bufferToString:pr};function sn(o,a,i,c){o.executeSql("CREATE TABLE IF NOT EXISTS "+a.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],i,c)}function Fi(o){var a=this,i={db:null};if(o)for(var c in o)i[c]=typeof o[c]!="string"?o[c].toString():o[c];var f=new v(function(u,m){try{i.db=openDatabase(i.name,String(i.version),i.description,i.size)}catch(g){return m(g)}i.db.transaction(function(g){sn(g,i,function(){a._dbInfo=i,u()},function(y,E){m(E)})},m)});return i.serializer=mr,f}function Ae(o,a,i,c,f,u){o.executeSql(i,c,f,function(m,g){g.code===g.SYNTAX_ERR?m.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[a.storeName],function(y,E){E.rows.length?u(y,g):sn(y,a,function(){y.executeSql(i,c,f,u)},u)},u):u(m,g)},u)}function ki(o,a){var i=this;o=D(o);var c=new v(function(f,u){i.ready().then(function(){var m=i._dbInfo;m.db.transaction(function(g){Ae(g,m,"SELECT * FROM "+m.storeName+" WHERE key = ? LIMIT 1",[o],function(y,E){var b=E.rows.length?E.rows.item(0).value:null;b&&(b=m.serializer.deserialize(b)),f(b)},function(y,E){u(E)})})}).catch(u)});return C(c,a),c}function ji(o,a){var i=this,c=new v(function(f,u){i.ready().then(function(){var m=i._dbInfo;m.db.transaction(function(g){Ae(g,m,"SELECT * FROM "+m.storeName,[],function(y,E){for(var b=E.rows,A=b.length,P=0;P<A;P++){var F=b.item(P),j=F.value;if(j&&(j=m.serializer.deserialize(j)),j=o(j,F.key,P+1),j!==void 0){f(j);return}}f()},function(y,E){u(E)})})}).catch(u)});return C(c,a),c}function an(o,a,i,c){var f=this;o=D(o);var u=new v(function(m,g){f.ready().then(function(){a===void 0&&(a=null);var y=a,E=f._dbInfo;E.serializer.serialize(a,function(b,A){A?g(A):E.db.transaction(function(P){Ae(P,E,"INSERT OR REPLACE INTO "+E.storeName+" (key, value) VALUES (?, ?)",[o,b],function(){m(y)},function(F,j){g(j)})},function(P){if(P.code===P.QUOTA_ERR){if(c>0){m(an.apply(f,[o,y,i,c-1]));return}g(P)}})})}).catch(g)});return C(u,i),u}function qi(o,a,i){return an.apply(this,[o,a,i,1])}function Mi(o,a){var i=this;o=D(o);var c=new v(function(f,u){i.ready().then(function(){var m=i._dbInfo;m.db.transaction(function(g){Ae(g,m,"DELETE FROM "+m.storeName+" WHERE key = ?",[o],function(){f()},function(y,E){u(E)})})}).catch(u)});return C(c,a),c}function Bi(o){var a=this,i=new v(function(c,f){a.ready().then(function(){var u=a._dbInfo;u.db.transaction(function(m){Ae(m,u,"DELETE FROM "+u.storeName,[],function(){c()},function(g,y){f(y)})})}).catch(f)});return C(i,o),i}function $i(o){var a=this,i=new v(function(c,f){a.ready().then(function(){var u=a._dbInfo;u.db.transaction(function(m){Ae(m,u,"SELECT COUNT(key) as c FROM "+u.storeName,[],function(g,y){var E=y.rows.item(0).c;c(E)},function(g,y){f(y)})})}).catch(f)});return C(i,o),i}function Vi(o,a){var i=this,c=new v(function(f,u){i.ready().then(function(){var m=i._dbInfo;m.db.transaction(function(g){Ae(g,m,"SELECT key FROM "+m.storeName+" WHERE id = ? LIMIT 1",[o+1],function(y,E){var b=E.rows.length?E.rows.item(0).key:null;f(b)},function(y,E){u(E)})})}).catch(u)});return C(c,a),c}function Gi(o){var a=this,i=new v(function(c,f){a.ready().then(function(){var u=a._dbInfo;u.db.transaction(function(m){Ae(m,u,"SELECT key FROM "+u.storeName,[],function(g,y){for(var E=[],b=0;b<y.rows.length;b++)E.push(y.rows.item(b).key);c(E)},function(g,y){f(y)})})}).catch(f)});return C(i,o),i}function Yi(o){return new v(function(a,i){o.transaction(function(c){c.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(f,u){for(var m=[],g=0;g<u.rows.length;g++)m.push(u.rows.item(g).name);a({db:o,storeNames:m})},function(f,u){i(u)})},function(c){i(c)})})}function Wi(o,a){a=B.apply(this,arguments);var i=this.config();o=typeof o!="function"&&o||{},o.name||(o.name=o.name||i.name,o.storeName=o.storeName||i.storeName);var c=this,f;return o.name?f=new v(function(u){var m;o.name===i.name?m=c._dbInfo.db:m=openDatabase(o.name,"","",0),o.storeName?u({db:m,storeNames:[o.storeName]}):u(Yi(m))}).then(function(u){return new v(function(m,g){u.db.transaction(function(y){function E(F){return new v(function(j,ee){y.executeSql("DROP TABLE IF EXISTS "+F,[],function(){j()},function(X,oe){ee(oe)})})}for(var b=[],A=0,P=u.storeNames.length;A<P;A++)b.push(E(u.storeNames[A]));v.all(b).then(function(){m()}).catch(function(F){g(F)})},function(y){g(y)})})}):f=v.reject("Invalid arguments"),C(f,a),f}var Ki={_driver:"webSQLStorage",_initStorage:Fi,_support:Ui(),iterate:ji,getItem:ki,setItem:qi,removeItem:Mi,clear:Bi,length:$i,key:Vi,keys:Gi,dropInstance:Wi};function Hi(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(o){return!1}}function un(o,a){var i=o.name+"/";return o.storeName!==a.storeName&&(i+=o.storeName+"/"),i}function zi(){var o="_localforage_support_test";try{return localStorage.setItem(o,!0),localStorage.removeItem(o),!1}catch(a){return!0}}function Qi(){return!zi()||localStorage.length>0}function Ji(o){var a=this,i={};if(o)for(var c in o)i[c]=o[c];return i.keyPrefix=un(o,a._defaultConfig),Qi()?(a._dbInfo=i,i.serializer=mr,v.resolve()):v.reject()}function Xi(o){var a=this,i=a.ready().then(function(){for(var c=a._dbInfo.keyPrefix,f=localStorage.length-1;f>=0;f--){var u=localStorage.key(f);u.indexOf(c)===0&&localStorage.removeItem(u)}});return C(i,o),i}function Zi(o,a){var i=this;o=D(o);var c=i.ready().then(function(){var f=i._dbInfo,u=localStorage.getItem(f.keyPrefix+o);return u&&(u=f.serializer.deserialize(u)),u});return C(c,a),c}function es(o,a){var i=this,c=i.ready().then(function(){for(var f=i._dbInfo,u=f.keyPrefix,m=u.length,g=localStorage.length,y=1,E=0;E<g;E++){var b=localStorage.key(E);if(b.indexOf(u)===0){var A=localStorage.getItem(b);if(A&&(A=f.serializer.deserialize(A)),A=o(A,b.substring(m),y++),A!==void 0)return A}}});return C(c,a),c}function ts(o,a){var i=this,c=i.ready().then(function(){var f=i._dbInfo,u;try{u=localStorage.key(o)}catch(m){u=null}return u&&(u=u.substring(f.keyPrefix.length)),u});return C(c,a),c}function rs(o){var a=this,i=a.ready().then(function(){for(var c=a._dbInfo,f=localStorage.length,u=[],m=0;m<f;m++){var g=localStorage.key(m);g.indexOf(c.keyPrefix)===0&&u.push(g.substring(c.keyPrefix.length))}return u});return C(i,o),i}function ns(o){var a=this,i=a.keys().then(function(c){return c.length});return C(i,o),i}function os(o,a){var i=this;o=D(o);var c=i.ready().then(function(){var f=i._dbInfo;localStorage.removeItem(f.keyPrefix+o)});return C(c,a),c}function is(o,a,i){var c=this;o=D(o);var f=c.ready().then(function(){a===void 0&&(a=null);var u=a;return new v(function(m,g){var y=c._dbInfo;y.serializer.serialize(a,function(E,b){if(b)g(b);else try{localStorage.setItem(y.keyPrefix+o,E),m(u)}catch(A){(A.name==="QuotaExceededError"||A.name==="NS_ERROR_DOM_QUOTA_REACHED")&&g(A),g(A)}})})});return C(f,i),f}function ss(o,a){if(a=B.apply(this,arguments),o=typeof o!="function"&&o||{},!o.name){var i=this.config();o.name=o.name||i.name,o.storeName=o.storeName||i.storeName}var c=this,f;return o.name?f=new v(function(u){o.storeName?u(un(o,c._defaultConfig)):u(o.name+"/")}).then(function(u){for(var m=localStorage.length-1;m>=0;m--){var g=localStorage.key(m);g.indexOf(u)===0&&localStorage.removeItem(g)}}):f=v.reject("Invalid arguments"),C(f,a),f}var as={_driver:"localStorageWrapper",_initStorage:Ji,_support:Hi(),iterate:es,getItem:Zi,setItem:is,removeItem:os,clear:Xi,length:ns,key:ts,keys:rs,dropInstance:ss},us=function(a,i){return a===i||typeof a=="number"&&typeof i=="number"&&isNaN(a)&&isNaN(i)},cs=function(a,i){for(var c=a.length,f=0;f<c;){if(us(a[f],i))return!0;f++}return!1},cn=Array.isArray||function(o){return Object.prototype.toString.call(o)==="[object Array]"},at={},fn={},Ge={INDEXEDDB:Pi,WEBSQL:Ki,LOCALSTORAGE:as},fs=[Ge.INDEXEDDB._driver,Ge.WEBSQL._driver,Ge.LOCALSTORAGE._driver],_t=["dropInstance"],vr=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(_t),ls={description:"",driver:fs.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function ds(o,a){o[a]=function(){var i=arguments;return o.ready().then(function(){return o[a].apply(o,i)})}}function hr(){for(var o=1;o<arguments.length;o++){var a=arguments[o];if(a)for(var i in a)a.hasOwnProperty(i)&&(cn(a[i])?arguments[0][i]=a[i].slice():arguments[0][i]=a[i])}return arguments[0]}var ps=function(){function o(a){p(this,o);for(var i in Ge)if(Ge.hasOwnProperty(i)){var c=Ge[i],f=c._driver;this[i]=f,at[f]||this.defineDriver(c)}this._defaultConfig=hr({},ls),this._config=hr({},this._defaultConfig,a),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return o.prototype.config=function(i){if((typeof i=="undefined"?"undefined":d(i))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var c in i){if(c==="storeName"&&(i[c]=i[c].replace(/\W/g,"_")),c==="version"&&typeof i[c]!="number")return new Error("Database version must be a number.");this._config[c]=i[c]}return"driver"in i&&i.driver?this.setDriver(this._config.driver):!0}else return typeof i=="string"?this._config[i]:this._config},o.prototype.defineDriver=function(i,c,f){var u=new v(function(m,g){try{var y=i._driver,E=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!i._driver){g(E);return}for(var b=vr.concat("_initStorage"),A=0,P=b.length;A<P;A++){var F=b[A],j=!cs(_t,F);if((j||i[F])&&typeof i[F]!="function"){g(E);return}}var ee=function(){for(var ut=function(hs){return function(){var gs=new Error("Method "+hs+" is not implemented by the current driver"),ln=v.reject(gs);return C(ln,arguments[arguments.length-1]),ln}},gr=0,vs=_t.length;gr<vs;gr++){var yr=_t[gr];i[yr]||(i[yr]=ut(yr))}};ee();var X=function(ut){at[y]&&console.info("Redefining LocalForage driver: "+y),at[y]=i,fn[y]=ut,m()};"_support"in i?i._support&&typeof i._support=="function"?i._support().then(X,g):X(!!i._support):X(!0)}catch(oe){g(oe)}});return N(u,c,f),u},o.prototype.driver=function(){return this._driver||null},o.prototype.getDriver=function(i,c,f){var u=at[i]?v.resolve(at[i]):v.reject(new Error("Driver not found."));return N(u,c,f),u},o.prototype.getSerializer=function(i){var c=v.resolve(mr);return N(c,i),c},o.prototype.ready=function(i){var c=this,f=c._driverSet.then(function(){return c._ready===null&&(c._ready=c._initDriver()),c._ready});return N(f,i,i),f},o.prototype.setDriver=function(i,c,f){var u=this;cn(i)||(i=[i]);var m=this._getSupportedDrivers(i);function g(){u._config.driver=u.driver()}function y(A){return u._extend(A),g(),u._ready=u._initStorage(u._config),u._ready}function E(A){return function(){var P=0;function F(){for(;P<A.length;){var j=A[P];return P++,u._dbInfo=null,u._ready=null,u.getDriver(j).then(y).catch(F)}g();var ee=new Error("No available storage method found.");return u._driverSet=v.reject(ee),u._driverSet}return F()}}var b=this._driverSet!==null?this._driverSet.catch(function(){return v.resolve()}):v.resolve();return this._driverSet=b.then(function(){var A=m[0];return u._dbInfo=null,u._ready=null,u.getDriver(A).then(function(P){u._driver=P._driver,g(),u._wrapLibraryMethodsWithReady(),u._initDriver=E(m)})}).catch(function(){g();var A=new Error("No available storage method found.");return u._driverSet=v.reject(A),u._driverSet}),N(this._driverSet,c,f),this._driverSet},o.prototype.supports=function(i){return!!fn[i]},o.prototype._extend=function(i){hr(this,i)},o.prototype._getSupportedDrivers=function(i){for(var c=[],f=0,u=i.length;f<u;f++){var m=i[f];this.supports(m)&&c.push(m)}return c},o.prototype._wrapLibraryMethodsWithReady=function(){for(var i=0,c=vr.length;i<c;i++)ds(this,vr[i])},o.prototype.createInstance=function(i){return new o(i)},o}(),ms=new ps;s.exports=ms},{"3":3}]},{},[4])(4)})});var Xo=x((Qo,Jo)=>{(function(e){var t;if(typeof define=="function"&&define.amd&&(define(e),t=!0),typeof Qo=="object"&&(Jo.exports=e(),t=!0),!t){var r=window.Cookies,n=window.Cookies=e();n.noConflict=function(){return window.Cookies=r,n}}})(function(){function e(){for(var n=0,s={};n<arguments.length;n++){var l=arguments[n];for(var d in l)s[d]=l[d]}return s}function t(n){return n.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}function r(n){function s(){}function l(p,h,_){if(typeof document!="undefined"){_=e({path:"/"},s.defaults,_),typeof _.expires=="number"&&(_.expires=new Date(new Date*1+_.expires*864e5)),_.expires=_.expires?_.expires.toUTCString():"";try{var S=JSON.stringify(h);/^[\{\[]/.test(S)&&(h=S)}catch(C){}h=n.write?n.write(h,p):encodeURIComponent(String(h)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),p=encodeURIComponent(String(p)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var R="";for(var v in _)!_[v]||(R+="; "+v,_[v]!==!0&&(R+="="+_[v].split(";")[0]));return document.cookie=p+"="+h+R}}function d(p,h){if(typeof document!="undefined"){for(var _={},S=document.cookie?document.cookie.split("; "):[],R=0;R<S.length;R++){var v=S[R].split("="),C=v.slice(1).join("=");!h&&C.charAt(0)==='"'&&(C=C.slice(1,-1));try{var N=t(v[0]);if(C=(n.read||n)(C,N)||t(C),h)try{C=JSON.parse(C)}catch(D){}if(_[N]=C,p===N)break}catch(D){}}return p?_[p]:_}}return s.set=l,s.get=function(p){return d(p,!1)},s.getJSON=function(p){return d(p,!0)},s.remove=function(p,h){l(p,"",e(h,{expires:-1}))},s.defaults={},s.withConverter=r,s}return r(function(){})})});var Ts;var ft=()=>Ts||window.location.hostname,we=()=>window.location.href,Os=()=>{let e=/^bed-([^.]+)\.api\.no$/.exec(ft()),t=/\.([^.]+)\.api\.no/.exec(ft());return e?e[1]:t?t[1]:null},fe=()=>ft().replace(/\.[^.]+\.api\.no/,""),Ye=()=>{let e=Os(),t="www.aid.no";return e==="localhost"?t="www.aid.no.localhost.api.no":e&&(t=`www-${e}.aid.no`),t};function Is(e,t){let r=new FormData;Object.keys(t).forEach(s=>r.append(s,t[s])),fetch(e,{method:"POST",body:r,headers:{Accept:"application/json"}}).then(s=>{if(!s.ok)throw new Error(`Error, status: ${s.status}, text: ${s.statusText}`)})}var wt=(e,t,r)=>{let n={};Object.keys(r).forEach(l=>{if(["string","number","boolean"].includes(typeof r[l])){n[l]=r[l];return}try{n[l]=JSON.stringify(r[l])}catch(d){n[l]=r[l]}});let s=ue(re({},n),{message:t,url:we(),domain:ft()});Is(`/api/mercury/v1/log/${e}`,s)},Ns={error:(e,t)=>wt("error",e,t),warn:(e,t)=>wt("warn",e,t),info:(e,t)=>wt("info",e,t),debug:(e,t)=>wt("debug",e,t)},vn=Ns;var Ps;var Us=()=>Ps||vn,Er=e=>{let t={message:e.message};return Object.getOwnPropertyNames(e).forEach(r=>{t[r]=e[r]}),t},hn=e=>T(void 0,null,function*(){let t=e.bodyUsed?"Response body not available for logging":yield e.text(),r={url:e.url,status:e.status,statusText:e.statusText,body:t};return Object.getOwnPropertyNames(e).forEach(n=>{r[n]=e[n]}),r}),xs=(r,...n)=>T(void 0,[r,...n],function*(e,t={}){let s=e,l=t||{};if(s instanceof Error){let d=Er(s);s=d.message,l=ue(re({},l),{error:d})}if(l=ue(re({},l),{origin:"@amedia/user"}),t instanceof Error){let d=Er(t);l=ue(re({},l),{[Object.keys(l).includes("error")?"contextError":"error"]:d})}else if(l instanceof Response){let d=yield hn(l);l=ue(re({},l),{response:d})}else for(let d of Object.keys(l))if(l[d]instanceof Error)l[d]=Er(l[d]);else if(l[d]instanceof Response){let p=yield hn(l[d]);l[d]=p}return{message:s,context:l}}),Rt=(e,t,r)=>{xs(t,r).then(({message:n,context:s})=>Us()[e](n,s))},k={debug:(e,t)=>Rt("debug",e,t),info:(e,t)=>Rt("info",e,t),warn:(e,t)=>Rt("warn",e,t),error:(e,t)=>Rt("error",e,t)};var Re,Ds=e=>{Re=e};typeof window!="undefined"&&Ds(window);var me=(e,t)=>{if(!Re){k.error("No root element to bind event to!");return}Re.addEventListener(e,r=>{r.stopImmediatePropagation(),t.apply(Re,[r])})},We=(e,t)=>{if(!Re){k.error("No root element to bind event to!");return}Re.addEventListener(e,r=>{t.apply(Re,[r])})},Z=e=>{if(!Re){k.error("No root element to dispatch event on!");return}Re.dispatchEvent(e)};var $=Se(Pe());var rt={},eu=(e,t)=>{rt[e]||(rt[e]=[]),rt[e].push(t)},tu=e=>{let t=rt[e];return t?(delete rt[e],t):[]},ru=e=>{var t;return((t=rt[e])==null?void 0:t.length)||0},nt={add:eu,getAll:tu,peekQueueSize:ru};var Ur=()=>{let e=typeof window!="undefined"?window:global;return e.amediaUserCache||(e.amediaUserCache={})},nu=e=>{let t=Ur()[e];return Promise.resolve(t)},ou=(e,t,r)=>(Ur()[e]={key:e,data:t,expires:r},Promise.resolve()),iu=e=>(delete Ur()[e],Promise.resolve()),su=()=>((typeof window!="undefined"?window:global).amediaUserCache={},Promise.resolve()),lo={get:nu,set:ou,remove:iu,clear:su};var au;var Kt=()=>au||lo,uu=(e,t,r)=>Kt().set(e,t,Date.now()+r),xr=e=>Kt().remove(e),cu=(e,t)=>T(void 0,null,function*(){let r=yield Kt().get(e);if(!r)return Promise.resolve();if(Date.now()>r.expires)return xr(e),Promise.resolve();try{return t.check(r.data)}catch(n){return k.error(n,{cacheData:r.data}),xr(e),Promise.resolve()}}),fu=()=>Kt().clear(),he={get:cu,set:uu,remove:xr,clear:fu};var lu=(e,t)=>!e||Array.isArray(t)?t:t?typeof e=="object"&&typeof t=="object"?re(re({},e),t):t:e;function ge(e,t,r,n){return new Promise((s,l)=>{nt.add(e,{resolve:s,reject:l}),!(nt.peekQueueSize(e)>1)&&he.get(e,t).then(d=>{if(d&&(!n||n(d))){nt.getAll(e).forEach(p=>{p.resolve(d)});return}r().then(p=>{let h=d?lu(d,p.data):p.data;he.set(e,h,p.ttl),nt.getAll(e).forEach(_=>{_.resolve(p.data)})}).catch(()=>{nt.getAll(e).forEach(p=>{p.reject()})})})})}var du=(0,$.Record)({id:$.Number,domain:$.String}),po=(0,$.Record)({status:(0,$.Literal)("success"),access:(0,$.Union)((0,$.Literal)("granted"),(0,$.Literal)("denied")),publication:du,access_features:(0,$.Array)($.String)}),pu=(0,$.Record)({status:(0,$.Literal)("success"),cookie:$.String,access_features:(0,$.Array)($.String)}),mu=(0,$.Record)({status:(0,$.Literal)("success"),vstoken_cookie:$.String,uuid:$.String,access_features:(0,$.Array)($.String)}),mo=(e,t)=>ge("checkForAccess",po,()=>fetch(`/api/jupiter/v1/check_access_for_paper/${e}/?require=any&access_features=${t.join(",")}`).then(r=>{if(!r.ok)throw new Error(`Request not ok (${r.status}: ${r.statusText}).`);return r.json()}).then(r=>{try{let n=po.check(r);return{ttl:n.access==="granted"?1e3*10:0,data:n}}catch(n){throw k.error(n,{json:r}),n}})).then(r=>({access:r.access_features})),vo=e=>fetch(`/api/jupiter/v1/get_vstoken/${e}`,{method:"post"}).then(t=>{if(!t.ok)throw new Error(`Request not ok (${t.status}: ${t.statusText}).`);return t.json()}).then(t=>{try{return pu.check(t)}catch(r){throw k.error(r,{json:t}),r}}),ho=e=>fetch(`/api/jupiter/v1/non_user_access/${e}`,{method:"post"}).then(t=>{if(!t.ok)throw new Error(`Request not ok (${t.status}: ${t.statusText}).`);return t.json()}).then(t=>{try{return mu.check(t)}catch(r){throw k.error(r,{json:t}),r}});var Ht=class extends Error{},vu=["no_session_found","subscription_not_found"],go=e=>T(void 0,null,function*(){return fetch(`/api/mercury/v2/access/activate?publication_wwwdomain=${fe()}&access_features=${e.join(",")}`,{method:"post"}).then(t=>T(void 0,null,function*(){let r=yield t.text(),n;try{n=JSON.parse(r)}catch(s){k.error(`Activate subscription failed. Mercury (HTTP/${t.status}: ${r})`,{error:s,response:t,accessFeatures:e,body:r})}if(!t.ok){if((n==null?void 0:n.status)==="user_deactivated")throw new Ht;return vu.includes(n==null?void 0:n.status)?[]:(k.error(`Activate subscription failed. Mercury (HTTP/${t.status}: ${r})`,{response:t,accessFeatures:e,body:r}),[])}return n==null?void 0:n.access_features}))});var pe=Se(Pe());var _o=Se(bo()),ke={},ot={},hu=e=>{var t;(t=ot[e])==null||t.forEach(r=>r(ke[e]))},gu=(e,t)=>{ot[e]||(ot[e]=[]),ot[e].push(t)},So=(e,t)=>{ke[e]=t,hu(e)},yu=(e,t)=>{So(e,(0,_o.default)(ke[e]||{},t))},Eu=e=>ke[e],bu=()=>{ke.state=void 0,ke.userAttributes=void 0,ke.storage=void 0,Object.keys(ot).forEach(e=>{ot[e]=[]})},z={merge:yu,set:So,get:Eu,on:gu,clear:bu};var _u=["avbrutt","kansellert","cancelled","aborted","failed to fetch","abgebrochen","the operation was aborted."],wo=e=>_u.includes(e.toLowerCase().trim());var Ro=(0,pe.Partial)({user_uuid:pe.String,user_name:pe.String,tracking_key:pe.String}),Su=e=>({uuid:e.user_uuid,name:e.user_name,trackingKey:e.tracking_key}),wu=(0,pe.Record)({code:pe.String}),Ru=(0,pe.Record)({errors:(0,pe.Array)(wu)}),Cu=["session.not_found","session.not_specified","user.deactivated"],Au=["session.invalid_for_domain","user.not_found"],Lr=e=>T(void 0,null,function*(){let t,r=e.clone();try{[t]=Ru.check(yield e.json()).errors}catch(n){return wo(n==null?void 0:n.message)?Promise.resolve():(k.warn("Unable to parse error body from pluto",{error:n,response:r}),Promise.reject(n))}return Cu.includes(t==null?void 0:t.code)?Promise.resolve():Au.includes(t==null?void 0:t.code)?(k.warn(`Pluto responded with HTTP/${e.status}: (${t.code}) while fetching current session`,{error:t,response:e}),Promise.resolve()):(k.error(`Pluto responded with HTTP/${e.status}: ${e.statusText}) when fetching current session`,{error:t,response:e}),Promise.reject())}),Tu=()=>fetch("/api/pluto/v1/sessions/current").then(e=>e.ok?e.json():Lr(e).then(()=>({}))).then(e=>{let t={ttl:-1,data:e};if(Object.keys(e).length===0)return t;try{return{ttl:1e4,data:Ro.check(e)}}catch(r){return k.error(r,{json:e}),t}}),Co=()=>T(void 0,null,function*(){return ge("getCurrentSession",Ro,Tu).then(e=>(z.merge("state",{isLoggedIn:e.user_uuid!==void 0}),Su(e)))}),Ao=e=>T(void 0,null,function*(){return fetch(`/api/pluto/v1/sessions/current?publication_domain=${e}`,{method:"DELETE"}).then(t=>{if(!t.ok){if(t.status===403)return;throw new Error(`Error, could not perform deleteRequest. Status: ${t.status} Text: ${t.statusText}`)}z.merge("state",{isLoggedIn:!1})})});var Fr,zt=self||window,To=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof zt.msCrypto!="undefined"&&typeof zt.msCrypto.getRandomValues=="function"&&zt.msCrypto.getRandomValues.bind(zt.msCrypto);if(To){let e=new Uint8Array(16);Fr=function(){return To(e),e}}else{let e=new Array(16);Fr=function(){for(let r=0,n;r<16;r+=1)(r&3)==0&&(n=Math.random()*4294967296),e[r]=n>>>((r&3)<<3)&255;return e}}var Oo=[];for(let e=0;e<256;++e)Oo[e]=(e+256).toString(16).substr(1);function Ou(e,t){let r=t||0,n=Oo;return[n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]]].join("")}function Io(){let e=Fr();return e[6]=e[6]&15|64,e[8]=e[8]&63|128,Ou(e)}function Iu(){let e,t,r=!1;return{promise:new Promise((s,l)=>{e=d=>{r||s(d),r=!0},t=d=>{r||l(d),r=!0}}),resolve:e,reject:t}}function Nu(e,t){return(...r)=>{let{resolve:n,reject:s,promise:l}=Iu(),d=Io(),p={eventId:d,args:r},h=new CustomEvent(`amedia-rpc-event:${e}:${t}`,{detail:p});if(self.dispatchEvent(h),self.amediaNativeBridge){let _=JSON.stringify(r);self.amediaNativeBridge.callNativeMethod(e,t,_,d)}return self.addEventListener(`amedia-rpc-event:${e}:${t}:${d}`,_=>{_.detail||n();let{error:S,result:R}=_.detail;return S?s(S):n(R)}),l}}var Qt=class{constructor({version:t,component:r,methods:n=[]}){this.component=r,this.version=t,this.queue=[],n.forEach(s=>this.addMethod(s)),this.boundLiveHandler=this.liveHandler.bind(this),self.addEventListener(`amedia-rpc-event:${r}:live`,this.boundLiveHandler),setTimeout(()=>self.dispatchEvent(new CustomEvent(`amedia-rpc-event:${r}:ready`)),0)}liveHandler(t){let[r,n]=t.detail.version.split(".").map(p=>parseInt(p,10)),[s,l]=this.version.split(".").map(p=>parseInt(p,10));if(r!==s)throw new Error(`${this.component} version mismatch. Server version: ${r}. Client version: ${s}`);n<l&&console.warn(`${this.component} server version is on an earlier minor version (${n}) than the client (${l})`);let d=this.queue.slice(0);delete this.queue,d.forEach(p=>p()),self.removeEventListener(`amedia-rpc-event:${this.component}:live`,this.boundLiveHandler)}addMethod(t){if(this[t])throw new Error(`${t} already exists on the RPC interface.`);this[t]=(...r)=>{if(this.queue){let n,s,l=new Promise((d,p)=>{n=d,s=p});return this.queue.push(()=>this[t](...r).then(n).catch(s)),l}return this[t]=Nu(this.component,t),this[t](...r)}}};var Jt,No=()=>Jt||(Jt=new Qt({version:"1.0.0",component:"userdata-session",methods:["userAuthenticated"]}),Jt);var Pu=(e,t)=>{let r=t.substring(e.length,t.length);if(r.substring(0,1)==="{")return JSON.parse(r);if(r.substring(0,3)==="%7B")return JSON.parse(decodeURIComponent(r));if(r!=="undefined")return r===""||r==="null"?null:r},xe=e=>{let t=`${e}=`,r=document.cookie.split(";");for(let n=r.length-1;n>=0;n-=1){let s=r[n].trim();if(s.indexOf(t)===0)return Pu(t,s)}return null},Uu=(e,t)=>t?t instanceof Date?`; expires=${t.toUTCString()}`:(e.setTime(e.getTime()+t*24*60*60*1e3),`; expires=${e.toUTCString()}`):"",xu=e=>!e||e===""?"":e instanceof Object?encodeURIComponent(JSON.stringify(e)):typeof e=="number"?e.toString(10):e;function je(e,t,r=Date.now(),n="/",s=!1){let l=new Date,d=`${e}=`;return(!t||t==="")&&(r=-1),d+=xu(t),d+=Uu(l,r),d+=`; path=${n}`,s&&(d+="; secure"),document.cookie=d,r&&r!==-1&&xe(e)===null&&(document.cookie=d.replace(/; expires=[^;]*/,"")),d}function ye(e){je(e)}var Po=()=>window.location.reload(),Uo=e=>window.location.replace(e),Xt=e=>{window.location.href=e};var xo=e=>{let t=new URL(`https://${Ye()}/aid/logg_inn/${fe()}/`);t.searchParams.set("requestedUrl",e instanceof URL?e.href:e),Xt(t.href)};function Du(){ye("VSTOKEN"),ye("aid.session"),ye("aid_invitation_code"),ye("aid-reload-article")}var Zt=()=>T(void 0,null,function*(){return Promise.all([Ao(fe()),he.clear()]).then(()=>{No().userAuthenticated(!1),Du(),ye("VSTOKEN2")}).catch(e=>{k.error("Failure while logging out",e)})}),er=()=>Co();var Do=(e=["newspaper"])=>mo(fe(),e),tr=e=>T(void 0,null,function*(){try{return yield go(e)}catch(t){if(t instanceof Ht)return yield Zt(),[];throw t}}),mt=(e,t)=>t.length<1||t.filter(r=>e.includes(r)).length>0,rr=e=>T(void 0,null,function*(){let t=yield vo(e);return t.status==="success"&&je("VSTOKEN",t.cookie,365,"/"),{success:t.status==="success",accessFeatures:t.access_features}}),nr=e=>T(void 0,null,function*(){let t=yield ho(e);return t.status==="success"&&je("VSTOKEN2",t.vstoken_cookie,1,"/"),{success:t.status==="success",accessFeatures:t.access_features}}),Lo=e=>T(void 0,null,function*(){let t=[];return t.push(rr(e).catch(()=>Promise.resolve({success:!1,accessFeatures:[]}))),t.push(nr(e).catch(()=>Promise.resolve({success:!1,accessFeatures:[]}))),Promise.all(t).then(r=>r.reduce((n,s)=>({success:n.success&&s.success,accessFeatures:n.accessFeatures.concat(s.accessFeatures).filter((l,d,p)=>p.indexOf(l)===d).sort()}),{success:!0,accessFeatures:[]}))}),Fo=e=>{let t=new Date;t.setTime(t.getTime()+2*60*1e3),je("aid-paywall-reload-performed",e||we(),t)},ko=e=>xe("aid-paywall-reload-performed")===(e||we());var qe;(function(r){r.REQUEST_ACTIVATION="amedia-user.activation.request-activation",r.ON_ACTIVATION_COMPLETE="amedia-user.activation.on-activation-complete"})(qe||(qe={}));var Lu=()=>{me(qe.REQUEST_ACTIVATION,e=>{tr(e.detail.accessFeatures).then(t=>{Z(new CustomEvent(qe.ON_ACTIVATION_COMPLETE,{detail:{accessFeatures:t}}))})})};Lu();var W;(function(p){p.REQUEST_STATE="amedia-user.request-state",p.REQUEST_USER_ATTRIBUTES="amedia-user.request-user-attributes",p.REQUEST_STORAGE_NAMESPACES="amedia-user.request-storage-namespaces",p.UPDATE_STORAGE="amedua-user.update-storage-namespaces",p.ON_ATTRIBUTES_UPDATED="amedia-user.on-user-attributes-updated",p.ON_STATE_UPDATED="amedia-user.on-state-updated",p.ON_STORAGE_UPDATED="amedia-user.on-storage-updated"})(W||(W={}));var vt=(e,t)=>{if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null)return!1;let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let s of r){if(!n.includes(s))return!1;if(typeof e[s]=="function"||typeof t[s]=="function"){if(e[s].toString()!==t[s].toString())return!1}else if(!vt(e[s],t[s]))return!1}return!0};function jo(e,t){return e&&e.length>0?t&&Object.keys(t).length>0?e.filter(r=>!Object.keys(t).includes(r)).length>0:!0:!1}var ht=class{constructor(t,r){this.attributes=t;this.namespaces=r}withAttributes(t){return new ht([...this.attributes||[],...t],this.namespaces)}withStorage(t){return new ht(this.attributes,[...this.namespaces||[],...t])}subscribe(t){let r=this.setupLocalCache();We(W.ON_STATE_UPDATED,n=>{let s=n.detail;Object.keys(r.state).length>0&&vt(r.state,s)||(r=ue(re({},r),{state:s}),t(r))}),Z(new CustomEvent(W.REQUEST_STATE)),Array.isArray(this.attributes)&&this.attributes.length>0&&(We(W.ON_ATTRIBUTES_UPDATED,n=>{let s=this.processUserAttributesEvent(n);Object.keys(r.attributes).length>0&&vt(r.attributes,s)||(r=ue(re({},r),{attributes:s}),t(r))}),Z(new CustomEvent(W.REQUEST_USER_ATTRIBUTES,{detail:this.attributes}))),Array.isArray(this.namespaces)&&this.namespaces.length>0&&(We(W.ON_STORAGE_UPDATED,n=>{let s=this.processStorageEvent(n);vt(r.storage,s)||(r=ue(re({},r),{storage:s}),t(r))}),Z(new CustomEvent(W.REQUEST_STORAGE_NAMESPACES,{detail:this.namespaces})))}fetch(){return new Promise(t=>{this.subscribe(r=>{if(typeof r.state.isLoggedIn!="undefined"){if(r.state.isLoggedIn===!1){t(r);return}jo(this.attributes,r.attributes)||jo(this.namespaces,r.storage)||t(r)}})})}processUserAttributesEvent(t){let r=t.detail;return this.attributes.reduce((s,l)=>(r[l]!==void 0&&(s[l]=r[l]),s),{})}processStorageEvent(t){let r=t.detail;return this.namespaces&&this.namespaces.reduce((n,s)=>(r[s]!==void 0&&(n[s]=r[s]),n),{})}setupLocalCache(){let t={state:{}};return this.attributes&&this.attributes.length>0&&(t.attributes={}),this.namespaces&&this.namespaces.length>0&&(t.storage={}),t}},be=ht;var qo="jupiter";function Fu(){return T(this,null,function*(){let e="VSTOKEN",t=fe(),r=xe(e),n=!1;new be().withAttributes(["uuid"]).subscribe(d=>T(this,[d],function*({attributes:s,state:l}){if(l.isLoggedIn===!1){typeof r=="string"&&ye(e);return}if(!s.uuid||l.isLoggedIn===void 0||n)return;if(n=!0,typeof r!="string"){yield rr(t);return}let p=r.split(":"),h=new Date(parseInt(p[1],10)*1e3);h.setDate(h.getDate()-1),!(h.getTime()>Date.now()&&p[3]===s.uuid&&t.includes(p[4])&&p[5]===qo)&&(yield rr(t))}))})}function ku(){let e="VSTOKEN2",t=fe(),r=xe(e);new be().fetch().then(s=>T(this,[s],function*({state:{isLoggedIn:n}}){if(n){if(typeof r!="string"){yield nr(t);return}let l=r.split(":"),d=new Date(parseInt(l[1],10)*1e3);if(d.setMinutes(d.getMinutes()-30),d.getTime()>Date.now()&&t.includes(l[4])&&l[5]===qo)return;yield nr(t)}else ye(e)})).then(()=>{})}function kr(){return Promise.all([Fu(),ku()])}function Mo(){new be().subscribe(({state:e})=>{e.isLoggedIn===!1&&(z.set("userAttributes",{}),z.set("storage",{}))})}var Me=Se(Pe());var Bo="haveTriedThirdPartyLoginCheck",ju=60*60*1e3,qu=(0,Me.Record)({user_name:Me.String,tracking_key:Me.String}),Mu=()=>fetch(`https://${Ye()}/api/pluto/v1/sessions/current`,{mode:"cors",credentials:"include"}).then(e=>e.ok?e.json():Lr(e).then(()=>null).catch(()=>null)).then(e=>{if(!e)return null;try{return qu.check(e)}catch(t){return k.error(t,{data:e}),null}});function jr(){return T(this,null,function*(){return(yield he.get(Bo,Me.Boolean))?!1:(yield he.set(Bo,!0,ju),!!(yield Mu()))})}var qr="has-tried-autologin",$o=6e4;function Bu(){try{return window.self!==window.top}catch(e){return!0}}function $u(){let e=xe(qr);if(e&&typeof e!="object")try{if(Date.now()-parseInt(e,10)<$o)return!0}catch(t){ye(qr)}return je(qr,Date.now(),Date.now()+$o),!1}var Vo=e=>T(void 0,null,function*(){if(Bu())return;let{state:{isLoggedIn:t}}=yield new be().fetch();if(!t){for(let r of e)if(!(yield r.handler().then(s=>{if(s){if($u())return!1;let l=new URL(`https://${Ye()}/aid/logg_inn/auto`);return l.searchParams.set("context",`auto_login_${r.name}`),l.searchParams.set("requestedUrl",we()),Xt(l.href),!1}return!0})))return}}),Go=()=>T(void 0,null,function*(){return Vo([{name:"third_party",handler:jr}])}),Yo=()=>T(void 0,null,function*(){return Vo([{name:"paywall",handler:()=>Promise.resolve(!0)}])});var Vu=[Go,kr,Mo];function Gu(){return T(this,null,function*(){for(let e of Vu)yield e()})}var or;(function(t){t.LOADED="amedia-user.janitor.loaded"})(or||(or={}));var Wo=()=>T(void 0,null,function*(){let e=!1;me(or.LOADED,()=>{e||(e=!0,Gu())}),Z(new CustomEvent(or.LOADED))});var Ko=()=>{me(W.REQUEST_STATE,()=>{let e=z.get("state");e&&Object.keys(e).length>0&&Z(new CustomEvent(W.ON_STATE_UPDATED,{detail:e})),z.on("state",t=>{Z(new CustomEvent(W.ON_STATE_UPDATED,{detail:t}))})})};var sr=Se(zo()),gt=Se(Xo());var Br,ir=typeof self=="undefined"?window:self,Zo=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof ir.msCrypto!="undefined"&&typeof ir.msCrypto.getRandomValues=="function"&&ir.msCrypto.getRandomValues.bind(ir.msCrypto);if(Zo){let e=new Uint8Array(16);Br=function(){return Zo(e),e}}else{let e=new Array(16);Br=function(){for(let r=0,n;r<16;r+=1)(r&3)==0&&(n=Math.random()*4294967296),e[r]=n>>>((r&3)<<3)&255;return e}}var ei=[];for(let e=0;e<256;++e)ei[e]=(e+256).toString(16).substr(1);function Yu(e,t){let r=t||0,n=ei;return[n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]]].join("")}function $r(){let e=Br();return e[6]=e[6]&15|64,e[8]=e[8]&63|128,Yu(e)}function ti(e){let t=!1;return(...r)=>{t||(e.apply(this,r),t=!0,setTimeout(()=>{t=!1},400))}}sr.default.config({name:"aid:userdata"});var ri=self.location.hostname.replace(/(.*\.)([^.]+\.\w+$)/,"$2");function ni(){let e=gt.default.get("amedia:fpbid");return e||(e=$r(),gt.default.set("amedia:fpbid",e,{expires:365*10,domain:ri,sameSite:"strict"})),Promise.resolve(e)}function Wu(){let e=gt.default.get("amedia:visitid");return e?Promise.resolve(e):sr.default.getItem("visitid")}function oi(e){return gt.default.set("amedia:visitid",e,{expires:new Date(Date.now()+18e5),domain:ri,sameSite:"strict"}),sr.default.setItem("visitid",e).then(()=>e)}function ii(){let e=Date.now(),t=`${$r()}|${e}`;return oi(t)}function Ku(){return Wu().then(e=>e||ii()).then(e=>{let[t,r]=e.split("|");return!t||r&&Date.now()-18e5>r?ii():oi(`${t}|${Date.now()}`)}).catch(e=>console.error(e))}typeof window!="undefined"&&["mousedown","keydown","mousemove","focus","scroll","resize","seshat-video-active","touchmove","deviceorientation"].forEach(e=>window.addEventListener(e,ti(Ku)));var Be=Se(Pe());var De=Se(Pe());var si=5*6e4,ai=(0,De.Record)({namespaces:(0,De.Dictionary)(De.Unknown,De.String)});var ui=(e,t="GET",r)=>fetch(e,{method:t,body:r&&JSON.stringify(r),headers:{"Content-Type":"application/json",Accept:"application/json"}}),Hu=(e,t)=>T(void 0,null,function*(){let r=yield he.get("europa",ai),n=r?ue(re({},r),{namespaces:ue(re({},r.namespaces),{[e]:t})}):{namespaces:{[e]:t}};return he.set("europa",n,Date.now()+si)}),ci=(e,t)=>T(void 0,null,function*(){let r=yield ui(`/api/europa/v1/me/${e}`,"PATCH",t);return r.ok?Hu(e,t):(k.error(`Could not get namespace: ${e}, status: ${r.status}, statusText: ${r.statusText}`,r),{})}),ar=(r,...n)=>T(void 0,[r,...n],function*(e,t={ignoreCache:!1}){if(e.length===0)throw new Error("namespaces array cannot be of length 0");return ge("europa",ai,()=>ui(`/api/europa/v1/me/${e.join(",")}`).then(s=>T(void 0,null,function*(){let l=yield s.text();return s.ok?JSON.parse(l):(s.status!==400&&k.error(`Could not get namespaces for: ${e}, status: ${s.status}`,{response:s,body:l}),{namespaces:{}})})).then(s=>({ttl:si,data:s})),s=>!t.ignoreCache||Object.keys(s.namespaces).filter(l=>!Object.keys(e).includes(l)).length===0).then(s=>s.namespaces)});var zu=5*6e4,Qu="privacyPreferences",Ju=(0,Be.Record)({allowResearchUsage:Be.Boolean,connectWithSurveys:Be.Boolean,personalizedAds:Be.Boolean,personalizedContent:Be.Boolean}),ur=e=>e==="true"||e===!0,fi=()=>T(void 0,null,function*(){return ge(Qu,Ju,()=>ar(["privacy_preferences"]).then(e=>{let t=e.privacy_preferences;return{ttl:zu,data:{allowResearchUsage:ur(t.allow_research_usage),connectWithSurveys:ur(t.connect_with_surveys),personalizedAds:ur(t.personalized_ads),personalizedContent:ur(t.personalized_content)}}})).then(e=>({privacyPreferences:e}))});var M=Se(Pe());var li=(0,M.Dictionary)(M.Unknown,M.String).And((0,M.Partial)({ad_segments:M.String,ad_segments_user:M.String,amedia_employee:M.Boolean,amedia_employee_user:M.Boolean,age:M.Number,age_user:M.Number,birth_year:M.String,birth_year_user:M.String,gender:M.String,gender_user:M.String,grunnkrets:M.String,grunnkrets_user:M.String,postcode:M.String,postcode_user:M.String,shared_account:M.Boolean,shared_account_user:M.Boolean,user_grouping_number:M.String,user_grouping_number_user:M.String})),Xu=(e,t,r)=>{let n=new URL("https://services.gcloud.api.no/api/nebula/v1/info");return n.searchParams.set("domain",e),n.searchParams.set("browser_id",t),r&&n.searchParams.set("user_key",r),fetch(n.href).then(s=>s.json()).then(s=>{try{return{ttl:1e3*60*60*5,data:li.check(s)}}catch(l){throw k.error(l,{json:s}),l}})},Zu=e=>({extraData:e}),di=(e,t,r)=>ge("getNebulaInfo",li,()=>Xu(e,t,r)).then(Zu);var Vr=()=>new Promise(e=>{var r;let t=(r=z.get("state"))==null?void 0:r.isLoggedIn;if(t===!1||t===!0){e(t);return}z.on("state",({isLoggedIn:n})=>{(n===!1||n===!0)&&e(n)})}),it=()=>new Promise(e=>Vr().then(t=>{t&&e()}));var ec=()=>Promise.all([ni(),Vr()]).then(([e,t])=>{var r;return di(window.location.hostname,e,t?(r=z.get("userAttributes"))==null?void 0:r.trackingKey:void 0)}),tc={uuid:er,name:er,trackingKey:er,access:()=>it().then(()=>Do()),extraData:ec,privacyPreferences:()=>it().then(()=>fi())},pi=e=>{let t=[];e.forEach(n=>{let s=tc[n];if(!s){k.warn(`Unknown attribute ${n} was requested`);return}t.includes(s)||t.push(s)});let r=[];return t.forEach(n=>{r.push(n().then(s=>{z.merge("userAttributes",s)}).catch(s=>{k.warn(`User attribute call failed (${n.toString()})`,s)}))}),Promise.all(r).then(()=>{})};var mi=()=>{z.on("userAttributes",e=>{Z(new CustomEvent(W.ON_ATTRIBUTES_UPDATED,{detail:e}))}),me(W.REQUEST_USER_ATTRIBUTES,e=>{let t=e.detail,r=z.get("userAttributes")||{};Object.keys(r).length>0&&Z(new CustomEvent(W.ON_ATTRIBUTES_UPDATED,{detail:r}));let n=t.filter(s=>r[s]===void 0);n.length>0&&pi(n)})};var vi=e=>{ar(e).then(t=>{z.merge("storage",t)})},hi=e=>Object.keys(e).forEach(t=>ci(t,e[t]));var gi=()=>{z.on("storage",e=>{Z(new CustomEvent(W.ON_STORAGE_UPDATED,{detail:e}))}),me(W.REQUEST_STORAGE_NAMESPACES,e=>{it().then(()=>{let t=e.detail,r=z.get("storage")||{};Object.keys(r).length>0&&Z(new CustomEvent(W.ON_STORAGE_UPDATED,{detail:r}));let n=t.filter(s=>r[s]===void 0);n.length>0&&vi(n)})}),me(W.UPDATE_STORAGE,e=>{it().then(()=>{hi(e.detail)})})};var yt=class extends Error{constructor(t,r){super(t);this.code=r}};yt.ERROR_RELOADED_NO_ACCESS="RELOADED_NO_ACCESS",yt.ERROR_ENABLING_ACCESS_FAILED="ENABLING_ACCESS_FAILED",yt.ERROR_NO_ACCESS_AFTER_SUCCESSFUL_ACTIVATION_WITH_REQUESTED_ACCESS_FEATURES="NO_ACCESS_AFTER_SUCCESSFUL_ACTIVATION_WITH_REQUESTED_ACCESS_FEATURES";var $e=yt;var yi=class{constructor(){this.requestedAccessFeatures=["newspaper"];this.reload=!1}withAccessFeatures(t){return this.requestedAccessFeatures=t,this}reloadOnAccess(){return this.reload=!0,this}redirectOnAccess(t){return this.requestedUrl=t,this}tryUnlock(){return T(this,null,function*(){let{state:{isLoggedIn:t}}=yield new be().withAttributes(["name"]).fetch();if(!t)return yield Yo(),{isLoggedIn:!1,hasAccess:!1,accessFeatures:[]};let r=yield this.setAccessCookiesAndGetAccessFeatures(this.requestedAccessFeatures);if(r.denied){if(r=yield this.activateAccess(this.requestedAccessFeatures),r.denied)return{isLoggedIn:!0,hasAccess:!1,accessFeatures:r.accessFeatures};if(r=yield this.setAccessCookiesAndGetAccessFeatures(this.requestedAccessFeatures),r.denied)throw new $e("New subscription was attached and checked successfully, but internal systems disagree about current newspaper access.",$e.ERROR_NO_ACCESS_AFTER_SUCCESSFUL_ACTIVATION_WITH_REQUESTED_ACCESS_FEATURES)}if(this.reload||this.requestedUrl){if(ko(this.requestedUrl))throw new $e("Unlock check already performed.",$e.ERROR_RELOADED_NO_ACCESS);Fo(this.requestedUrl),this.reload&&Po(),this.requestedUrl&&Uo(this.requestedUrl)}return{isLoggedIn:!0,hasAccess:!0,accessFeatures:r.accessFeatures}})}setAccessCookiesAndGetAccessFeatures(t){return Lo(fe()).then(r=>{let n=!mt(r.accessFeatures,t);if(!r.success&&n)throw new $e("Could not set access cookies",$e.ERROR_ENABLING_ACCESS_FAILED);return{denied:n,accessFeatures:r.accessFeatures}})}activateAccess(t){return T(this,null,function*(){let r=yield tr(this.requestedAccessFeatures);return{denied:!mt(r,t),accessFeatures:r}})}},rc=yi;var xd=e=>xo(e||we()),Dd=()=>Zt(),Ld=e=>new Promise(t=>{We(qe.ON_ACTIVATION_COMPLETE,r=>{let n=r.detail.accessFeatures;t({hasAccess:mt(n,e),accessFeatures:n})}),Z(new CustomEvent(qe.REQUEST_ACTIVATION,{detail:{accessFeatures:e}}))}),Fd=e=>{Z(new CustomEvent(W.UPDATE_STORAGE,{detail:e}))};typeof process=="undefined"&&(Ko(),mi(),gi(),Wo());})();
|
|
2
|
+
/*!
|
|
3
|
+
localForage -- Offline Storage, Improved
|
|
4
|
+
Version 1.9.0
|
|
5
|
+
https://localforage.github.io/localForage
|
|
6
|
+
(c) 2013-2017 Mozilla, Apache License 2.0
|
|
7
|
+
*/
|
|
8
|
+
/*!
|
|
9
|
+
* JavaScript Cookie v2.2.1
|
|
10
|
+
* https://github.com/js-cookie/js-cookie
|
|
11
|
+
*
|
|
12
|
+
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
|
13
|
+
* Released under the MIT license
|
|
14
|
+
*/
|
|
15
|
+
//# sourceMappingURL=index.js.map
|