@amedia/user 0.13.15 → 0.13.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
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"&&lt.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());})();
1
+ var bs=Object.create;var We=Object.defineProperty,_s=Object.defineProperties,Ss=Object.getOwnPropertyDescriptor,ws=Object.getOwnPropertyDescriptors,Rs=Object.getOwnPropertyNames,pn=Object.getOwnPropertySymbols,Cs=Object.getPrototypeOf,mn=Object.prototype.hasOwnProperty,As=Object.prototype.propertyIsEnumerable;var vn=(e,t,r)=>t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ne=(e,t)=>{for(var r in t||(t={}))mn.call(t,r)&&vn(e,r,t[r]);if(pn)for(var r of pn(t))As.call(t,r)&&vn(e,r,t[r]);return e},ce=(e,t)=>_s(e,ws(t)),hn=e=>We(e,"__esModule",{value:!0}),n=(e,t)=>We(e,"name",{value:t,configurable:!0});var D=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ts=(e,t)=>{hn(e);for(var r in t)We(e,r,{get:t[r],enumerable:!0})},Os=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Rs(t))!mn.call(e,o)&&o!=="default"&&We(e,o,{get:()=>t[o],enumerable:!(r=Ss(t,o))||r.enumerable});return e},we=e=>Os(hn(We(e!=null?bs(Cs(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var O=(e,t,r)=>new Promise((o,a)=>{var d=g=>{try{m(r.next(g))}catch(S){a(S)}},p=g=>{try{m(r.throw(g))}catch(S){a(S)}},m=g=>g.done?o(g.value):Promise.resolve(g.value).then(d,p);m((r=r.apply(e,t)).next())});var bn=D(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0})});var br=D(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.Failcode=void 0;Tt.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 Qe=D(ze=>{"use strict";var ks=ze&&ze.__extends||function(){var e=n(function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,a){o.__proto__=a}||function(o,a){for(var d in a)Object.prototype.hasOwnProperty.call(a,d)&&(o[d]=a[d])},e(t,r)},"extendStatics");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 o(){this.constructor=t}n(o,"__"),t.prototype=r===null?Object.create(r):(o.prototype=r.prototype,new o)}}();Object.defineProperty(ze,"__esModule",{value:!0});ze.ValidationError=void 0;var js=function(e){ks(t,e);function t(r){var o=e.call(this,r.message)||this;return o.name="ValidationError",o.code=r.code,r.details!==void 0&&(o.details=r.details),Object.setPrototypeOf(o,t.prototype),o}return n(t,"ValidationError"),t}(Error);ze.ValidationError=js});var Ot=D(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});var he=n(function(e,t){return function(r){var o=n(function(p){return e?"("+p+")":p},"parenthesize");if(t.has(r))return o("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 a=r.value;return typeof a=="string"?'"'+a+'"':String(a)}case"array":return""+_n(r)+he(!0,t)(r.element)+"[]";case"dictionary":return"{ [_: "+r.key+"]: "+he(!1,t)(r.value)+" }";case"record":{var d=Object.keys(r.fields);return d.length?"{ "+d.map(function(p){return""+_n(r)+p+qs(r,p)+": "+(r.fields[p].tag==="optional"?he(!1,t)(r.fields[p].underlying):he(!1,t)(r.fields[p]))+";"}).join(" ")+" }":"{}"}case"tuple":return"["+r.components.map(he(!1,t)).join(", ")+"]";case"union":return o(""+r.alternatives.map(he(!0,t)).join(" | "));case"intersect":return o(""+r.intersectees.map(he(!0,t)).join(" & "));case"optional":return he(e,t)(r.underlying)+" | undefined";case"constraint":return r.name||he(e,t)(r.underlying);case"instanceof":return r.ctor.name;case"brand":return he(e,t)(r.entity)}}finally{t.delete(r)}throw Error("impossible")}},"show");_r.default=he(!1,new Set);function qs(e,t){var r=e.isPartial,o=e.fields;return r||t!==void 0&&o[t].tag==="optional"?"?":""}n(qs,"partialTag");function _n(e){var t=e.isReadonly;return t?"readonly ":""}n(_n,"readonlyTag")});var z=D(M=>{"use strict";var Sr=M&&M.__assign||function(){return Sr=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++){t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},Sr.apply(this,arguments)};Object.defineProperty(M,"__esModule",{value:!0});M.FAILURE=M.SUCCESS=M.enumerableKeysOf=M.typeOf=M.hasKey=void 0;var _e=br(),Je=Ot();function Ms(e,t){return typeof t=="object"&&t!==null&&e in t}n(Ms,"hasKey");M.hasKey=Ms;var Bs=n(function(e){var t,r,o;return typeof e=="object"?e===null?"null":Array.isArray(e)?"array":((t=e.constructor)===null||t===void 0?void 0:t.name)==="Object"?"object":(o=(r=e.constructor)===null||r===void 0?void 0:r.name)!==null&&o!==void 0?o:typeof e:typeof e},"typeOf");M.typeOf=Bs;var $s=n(function(e){return typeof e=="object"&&e!==null?Reflect.ownKeys(e).filter(function(t){var r,o;return(o=(r=e.propertyIsEnumerable)===null||r===void 0?void 0:r.call(e,t))!==null&&o!==void 0?o:!0}):[]},"enumerableKeysOf");M.enumerableKeysOf=$s;function Vs(e){return{success:!0,value:e}}n(Vs,"SUCCESS");M.SUCCESS=Vs;M.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 "+Je.default(e)+", but was "+M.typeOf(t);return M.FAILURE(_e.Failcode.TYPE_INCORRECT,r)},VALUE_INCORRECT:function(e,t,r){return M.FAILURE(_e.Failcode.VALUE_INCORRECT,"Expected "+e+" "+String(t)+", but was "+String(r))},KEY_INCORRECT:function(e,t,r){return M.FAILURE(_e.Failcode.KEY_INCORRECT,"Expected "+Je.default(e)+" key to be "+Je.default(t)+", but was "+M.typeOf(r))},CONTENT_INCORRECT:function(e,t){var r="Expected "+Je.default(e)+", but was incompatible";return M.FAILURE(_e.Failcode.CONTENT_INCORRECT,r,t)},ARGUMENT_INCORRECT:function(e){return M.FAILURE(_e.Failcode.ARGUMENT_INCORRECT,e)},RETURN_INCORRECT:function(e){return M.FAILURE(_e.Failcode.RETURN_INCORRECT,e)},CONSTRAINT_FAILED:function(e,t){var r=t?": "+t:"";return M.FAILURE(_e.Failcode.CONSTRAINT_FAILED,"Failed constraint check for "+Je.default(e)+r)},PROPERTY_MISSING:function(e){var t="Expected "+Je.default(e)+", but was missing";return M.FAILURE(_e.Failcode.PROPERTY_MISSING,t)},PROPERTY_PRESENT:function(e){var t="Expected nothing, but was "+M.typeOf(e);return M.FAILURE(_e.Failcode.PROPERTY_PRESENT,t)},NOTHING_EXPECTED:function(e){var t="Expected nothing, but was "+M.typeOf(e);return M.FAILURE(_e.Failcode.NOTHING_EXPECTED,t)}})});var Sn=D(Oe=>{"use strict";var Gs=Oe&&Oe.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),a,d=[],p;try{for(;(t===void 0||t-- >0)&&!(a=o.next()).done;)d.push(a.value)}catch(m){p={error:m}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(p)throw p.error}}return d},Ys=Oe&&Oe.__spreadArray||function(e,t){for(var r=0,o=t.length,a=e.length;r<o;r++,a++)e[a]=t[r];return e};Object.defineProperty(Oe,"__esModule",{value:!0});Oe.Contract=void 0;var Ws=Qe(),Ks=z();function Hs(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.length-1,o=e.slice(0,r),a=e[r];return{enforce:function(d){return function(){for(var p=[],m=0;m<arguments.length;m++)p[m]=arguments[m];if(p.length<o.length){var g="Expected "+o.length+" arguments but only received "+p.length,S=Ks.FAILURE.ARGUMENT_INCORRECT(g);throw new Ws.ValidationError(S)}for(var w=0;w<o.length;w++)o[w].check(p[w]);return a.check(d.apply(void 0,Ys([],Gs(p))))}}}}n(Hs,"Contract");Oe.Contract=Hs});var Cn=D(Ie=>{"use strict";var zs=Ie&&Ie.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),a,d=[],p;try{for(;(t===void 0||t-- >0)&&!(a=o.next()).done;)d.push(a.value)}catch(m){p={error:m}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(p)throw p.error}}return d},Qs=Ie&&Ie.__spreadArray||function(e,t){for(var r=0,o=t.length,a=e.length;r<o;r++,a++)e[a]=t[r];return e};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.AsyncContract=void 0;var wn=Qe(),Rn=z();function Js(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.length-1,o=e.slice(0,r),a=e[r];return{enforce:function(d){return function(){for(var p=[],m=0;m<arguments.length;m++)p[m]=arguments[m];if(p.length<o.length){var g="Expected "+o.length+" arguments but only received "+p.length,S=Rn.FAILURE.ARGUMENT_INCORRECT(g);throw new wn.ValidationError(S)}for(var w=0;w<o.length;w++)o[w].check(p[w]);var C=d.apply(void 0,Qs([],zs(p)));if(!(C instanceof Promise)){var g="Expected function to return a promise, but instead got "+C,S=Rn.FAILURE.RETURN_INCORRECT(g);throw new wn.ValidationError(S)}return C.then(a.check)}}}}n(Js,"AsyncContract");Ie.AsyncContract=Js});var An=D(Ne=>{"use strict";var Xs=Ne&&Ne.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],o=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Zs=Ne&&Ne.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),a,d=[],p;try{for(;(t===void 0||t-- >0)&&!(a=o.next()).done;)d.push(a.value)}catch(m){p={error:m}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(p)throw p.error}}return d};Object.defineProperty(Ne,"__esModule",{value:!0});Ne.match=void 0;function ea(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(r){var o,a;try{for(var d=Xs(e),p=d.next();!p.done;p=d.next()){var m=Zs(p.value,2),g=m[0],S=m[1];if(g.guard(r))return S(r)}}catch(w){o={error:w}}finally{try{p&&!p.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}throw new Error("No alternatives were matched")}}n(ea,"match");Ne.match=ea});var J=D(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.innerValidate=Xe.create=void 0;var Pe=Ue(),ta=Ot(),ra=Qe(),na=z();function oa(e,t){return t.check=r,t.assert=r,t._innerValidate=function(C,h){return h.has(C,t)?na.SUCCESS(C):e(C,h)},t.validate=function(C){return t._innerValidate(C,sa())},t.guard=o,t.Or=a,t.And=d,t.optional=p,t.nullable=m,t.withConstraint=g,t.withGuard=S,t.withBrand=w,t.reflect=t,t.toString=function(){return"Runtype<"+ta.default(t)+">"},t;function r(C){var h=t.validate(C);if(h.success)return h.value;throw new ra.ValidationError(h)}n(r,"check");function o(C){return t.validate(C).success}n(o,"guard");function a(C){return Pe.Union(t,C)}n(a,"Or");function d(C){return Pe.Intersect(t,C)}n(d,"And");function p(){return Pe.Optional(t)}n(p,"optional");function m(){return Pe.Union(t,Pe.Null)}n(m,"nullable");function g(C,h){return Pe.Constraint(t,C,h)}n(g,"withConstraint");function S(C,h){return Pe.Constraint(t,C,h)}n(S,"withGuard");function w(C){return Pe.Brand(C,t)}n(w,"withBrand")}n(oa,"create");Xe.create=oa;function ia(e,t,r){return e._innerValidate(t,r)}n(ia,"innerValidate");Xe.innerValidate=ia;function sa(){var e=new WeakMap,t=n(function(o,a){if(!(o===null||typeof o!="object")){var d=e.get(o);e.set(o,d?d.set(a,!0):new WeakMap().set(a,!0))}},"add"),r=n(function(o,a){var d=e.get(o),p=d&&d.get(a)||!1;return t(o,a),p},"has");return{has:r}}n(sa,"VisitedState")});var Nt=D(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.Unknown=void 0;var aa=J(),ua=z(),ca={tag:"unknown"};It.Unknown=aa.create(function(e){return ua.SUCCESS(e)},ca)});var Tn=D(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.Never=void 0;var fa=J(),la=z(),da={tag:"never"};Pt.Never=fa.create(la.FAILURE.NOTHING_EXPECTED,da)});var On=D(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.Void=void 0;var pa=Nt();Ut.Void=pa.Unknown});var wr=D(Ze=>{"use strict";var xt=Ze&&Ze.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],o=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Ze,"__esModule",{value:!0});Ze.Union=void 0;var Dt=J(),mt=z();function ma(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=n(function(){for(var a=[],d=0;d<arguments.length;d++)a[d]=arguments[d];return function(p){for(var m=0;m<e.length;m++)if(e[m].guard(p))return a[m](p)}},"match"),o={tag:"union",alternatives:e,match:r};return Dt.create(function(a,d){var p,m,g,S,w,C,h,A;if(typeof a!="object"||a===null){try{for(var P=xt(e),L=P.next();!L.done;L=P.next()){var $=L.value;if(Dt.innerValidate($,a,d).success)return mt.SUCCESS(a)}}catch(re){p={error:re}}finally{try{L&&!L.done&&(m=P.return)&&m.call(P)}finally{if(p)throw p.error}}return mt.FAILURE.TYPE_INCORRECT(o,a)}var G={};try{for(var se=xt(e),W=se.next();!W.done;W=se.next()){var $=W.value;if($.reflect.tag==="record"){var ft=n(function(X){var ue=$.reflect.fields[X];ue.tag==="literal"&&(G[X]?G[X].every(function(Fe){return Fe!==ue.value})&&G[X].push(ue.value):G[X]=[ue.value])},"_loop_1");for(var ae in $.reflect.fields)ft(ae)}}}catch(re){g={error:re}}finally{try{W&&!W.done&&(S=se.return)&&S.call(se)}finally{if(g)throw g.error}}for(var ae in G)if(G[ae].length===e.length)try{for(var R=(w=void 0,xt(e)),x=R.next();!x.done;x=R.next()){var $=x.value;if($.reflect.tag==="record"){var N=$.reflect.fields[ae];if(N.tag==="literal"&&mt.hasKey(ae,a)&&a[ae]===N.value)return Dt.innerValidate($,a,d)}}}catch(X){w={error:X}}finally{try{x&&!x.done&&(C=R.return)&&C.call(R)}finally{if(w)throw w.error}}try{for(var F=xt(e),H=F.next();!H.done;H=F.next()){var oe=H.value;if(Dt.innerValidate(oe,a,d).success)return mt.SUCCESS(a)}}catch(re){h={error:re}}finally{try{H&&!H.done&&(A=F.return)&&A.call(F)}finally{if(h)throw h.error}}return mt.FAILURE.TYPE_INCORRECT(o,a)},o)}n(ma,"Union");Ze.Union=ma});var Pn=D(de=>{"use strict";Object.defineProperty(de,"__esModule",{value:!0});de.Nullish=de.Null=de.Undefined=de.Literal=void 0;var va=J(),In=z(),ha=wr();function Nn(e){return Array.isArray(e)?String(e.map(String)):typeof e=="bigint"?String(e)+"n":String(e)}n(Nn,"literal");function Rr(e){var t={tag:"literal",value:e};return va.create(function(r){return r===e?In.SUCCESS(r):In.FAILURE.VALUE_INCORRECT("literal","`"+Nn(e)+"`","`"+Nn(r)+"`")},t)}n(Rr,"Literal");de.Literal=Rr;de.Undefined=Rr(void 0);de.Null=Rr(null);de.Nullish=ha.Union(de.Null,de.Undefined)});var Dn=D(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.Boolean=void 0;var ga=J(),Un=z(),xn={tag:"boolean"};Lt.Boolean=ga.create(function(e){return typeof e=="boolean"?Un.SUCCESS(e):Un.FAILURE.TYPE_INCORRECT(xn,e)},xn)});var kn=D(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.Number=void 0;var ya=J(),Ln=z(),Fn={tag:"number"};Ft.Number=ya.create(function(e){return typeof e=="number"?Ln.SUCCESS(e):Ln.FAILURE.TYPE_INCORRECT(Fn,e)},Fn)});var Mn=D(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.BigInt=void 0;var Ea=J(),jn=z(),qn={tag:"bigint"};kt.BigInt=Ea.create(function(e){return typeof e=="bigint"?jn.SUCCESS(e):jn.FAILURE.TYPE_INCORRECT(qn,e)},qn)});var Cr=D(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.String=void 0;var ba=J(),Bn=z(),$n={tag:"string"};jt.String=ba.create(function(e){return typeof e=="string"?Bn.SUCCESS(e):Bn.FAILURE.TYPE_INCORRECT($n,e)},$n)});var Wn=D(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.Symbol=void 0;var Vn=J(),vt=z(),_a=n(function(e){var t={tag:"symbol",key:e};return Vn.create(function(r){if(typeof r!="symbol")return vt.FAILURE.TYPE_INCORRECT(t,r);var o=globalThis.Symbol.keyFor(r);return o!==e?vt.FAILURE.VALUE_INCORRECT("symbol key",Yn(e),Yn(o)):vt.SUCCESS(r)},t)},"f"),Gn={tag:"symbol"};qt.Symbol=Vn.create(function(e){return typeof e=="symbol"?vt.SUCCESS(e):vt.FAILURE.TYPE_INCORRECT(Gn,e)},Object.assign(_a,Gn));var Yn=n(function(e){return e===void 0?"undefined":'"'+e+'"'},"quoteIfPresent")});var zn=D(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.Array=void 0;var Kn=J(),ht=z();function Hn(e,t){var r={tag:"array",isReadonly:t,element:e};return wa(Kn.create(function(o,a){if(!Array.isArray(o))return ht.FAILURE.TYPE_INCORRECT(r,o);var d=ht.enumerableKeysOf(o),p=d.map(function(g){return Kn.innerValidate(e,o[g],a)}),m=d.reduce(function(g,S){var w=p[S];return w.success||(g[S]=w.details||w.message),g},[]);return ht.enumerableKeysOf(m).length!==0?ht.FAILURE.CONTENT_INCORRECT(r,m):ht.SUCCESS(o)},r))}n(Hn,"InternalArr");function Sa(e){return Hn(e,!1)}n(Sa,"Arr");Mt.Array=Sa;function wa(e){return e.asReadonly=t,e;function t(){return Hn(e.element,!0)}n(t,"asReadonly")}n(wa,"withExtraModifierFuncs")});var Jn=D(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.Tuple=void 0;var Qn=J(),et=z();function Ra(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r={tag:"tuple",components:e};return Qn.create(function(o,a){if(!Array.isArray(o))return et.FAILURE.TYPE_INCORRECT(r,o);if(o.length!==e.length)return et.FAILURE.CONSTRAINT_FAILED(r,"Expected length "+e.length+", but was "+o.length);var d=et.enumerableKeysOf(o),p=d.map(function(g){return Qn.innerValidate(e[g],o[g],a)}),m=d.reduce(function(g,S){var w=p[S];return w.success||(g[S]=w.details||w.message),g},[]);return et.enumerableKeysOf(m).length!==0?et.FAILURE.CONTENT_INCORRECT(r,m):et.SUCCESS(o)},r)}n(Ra,"Tuple");Bt.Tuple=Ra});var Zn=D(pe=>{"use strict";var Ar=pe&&pe.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),a,d=[],p;try{for(;(t===void 0||t-- >0)&&!(a=o.next()).done;)d.push(a.value)}catch(m){p={error:m}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(p)throw p.error}}return d},Tr=pe&&pe.__spreadArray||function(e,t){for(var r=0,o=t.length,a=e.length;r<o;r++,a++)e[a]=t[r];return e};Object.defineProperty(pe,"__esModule",{value:!0});pe.Partial=pe.Record=pe.InternalRecord=void 0;var Xn=J(),fe=z();function xe(e,t,r){var o={tag:"record",isPartial:t,isReadonly:r,fields:e};return Ta(Xn.create(function(a,d){if(a==null)return fe.FAILURE.TYPE_INCORRECT(o,a);var p=fe.enumerableKeysOf(e);if(p.length!==0&&typeof a!="object")return fe.FAILURE.TYPE_INCORRECT(o,a);var m=Tr([],Ar(new Set(Tr(Tr([],Ar(p)),Ar(fe.enumerableKeysOf(a)))))),g=m.reduce(function(w,C){var h=fe.hasKey(C,e),A=fe.hasKey(C,a);if(h){var P=e[C],L=t||P.reflect.tag==="optional";if(A){var $=a[C];L&&$===void 0?w[C]=fe.SUCCESS($):w[C]=Xn.innerValidate(P,$,d)}else L?w[C]=fe.SUCCESS(void 0):w[C]=fe.FAILURE.PROPERTY_MISSING(P.reflect)}else if(A){var $=a[C];w[C]=fe.SUCCESS($)}else throw new Error("impossible");return w},{}),S=m.reduce(function(w,C){var h=g[C];return h.success||(w[C]=h.details||h.message),w},{});return fe.enumerableKeysOf(S).length!==0?fe.FAILURE.CONTENT_INCORRECT(o,S):fe.SUCCESS(a)},o))}n(xe,"InternalRecord");pe.InternalRecord=xe;function Ca(e){return xe(e,!1,!1)}n(Ca,"Record");pe.Record=Ca;function Aa(e){return xe(e,!0,!1)}n(Aa,"Partial");pe.Partial=Aa;function Ta(e){return e.asPartial=t,e.asReadonly=r,e.pick=o,e.omit=a,e.extend=d,e;function t(){return xe(e.fields,!0,e.isReadonly)}n(t,"asPartial");function r(){return xe(e.fields,e.isPartial,!0)}n(r,"asReadonly");function o(){for(var p=[],m=0;m<arguments.length;m++)p[m]=arguments[m];var g={};return p.forEach(function(S){g[S]=e.fields[S]}),xe(g,e.isPartial,e.isReadonly)}n(o,"pick");function a(){for(var p=[],m=0;m<arguments.length;m++)p[m]=arguments[m];var g={},S=fe.enumerableKeysOf(e.fields);return S.forEach(function(w){p.includes(w)||(g[w]=e.fields[w])}),xe(g,e.isPartial,e.isReadonly)}n(a,"omit");function d(p){return xe(Object.assign({},e.fields,p),e.isPartial,e.isReadonly)}n(d,"extend")}n(Ta,"withExtraModifierFuncs")});var Ir=D(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.Guard=tt.Constraint=void 0;var Oa=J(),Or=z(),Ia=Nt();function Na(e,t,r){var o=r&&r.name,a=r&&r.args,d={tag:"constraint",underlying:e,constraint:t,name:o,args:a};return Oa.create(function(p){var m=e.validate(p);if(!m.success)return m;var g=t(m.value);return typeof g=="string"?Or.FAILURE.CONSTRAINT_FAILED(d,g):g?Or.SUCCESS(m.value):Or.FAILURE.CONSTRAINT_FAILED(d)},d)}n(Na,"Constraint");tt.Constraint=Na;var Pa=n(function(e,t){return Ia.Unknown.withGuard(e,t)},"Guard");tt.Guard=Pa});var to=D($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.Dictionary=void 0;var eo=J(),Nr=Cr(),Ua=Ir(),xa=Ot(),ke=z(),Da=Ua.Constraint(Nr.String,function(e){return!isNaN(+e)},{name:"number"});function La(e,t){var r=t===void 0||t==="string"?Nr.String:t==="number"?Da:t,o=xa.default(r),a={tag:"dictionary",key:o,value:e};return eo.create(function(d,p){if(d==null||typeof d!="object"||Object.getPrototypeOf(d)!==Object.prototype&&(!Array.isArray(d)||o==="string"))return ke.FAILURE.TYPE_INCORRECT(a,d);var m=/^(?:NaN|-?\d+(?:\.\d+)?)$/,g=ke.enumerableKeysOf(d),S=g.reduce(function(C,h){var A=typeof h=="string"&&m.test(h),P=A?globalThis.Number(h):h;return(A?!r.guard(P)&&!r.guard(h):!r.guard(P))?C[h]=ke.FAILURE.KEY_INCORRECT(a,r.reflect,P):C[h]=eo.innerValidate(e,d[h],p),C},{}),w=g.reduce(function(C,h){var A=S[h];return A.success||(C[h]=A.details||A.message),C},{});return ke.enumerableKeysOf(w).length!==0?ke.FAILURE.CONTENT_INCORRECT(a,w):ke.SUCCESS(d)},a)}n(La,"Dictionary");$t.Dictionary=La});var no=D(rt=>{"use strict";var Fa=rt&&rt.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],o=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(rt,"__esModule",{value:!0});rt.Intersect=void 0;var ro=J(),ka=z();function ja(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r={tag:"intersect",intersectees:e};return ro.create(function(o,a){var d,p;try{for(var m=Fa(e),g=m.next();!g.done;g=m.next()){var S=g.value,w=ro.innerValidate(S,o,a);if(!w.success)return w}}catch(C){d={error:C}}finally{try{g&&!g.done&&(p=m.return)&&p.call(m)}finally{if(d)throw d.error}}return ka.SUCCESS(o)},r)}n(ja,"Intersect");rt.Intersect=ja});var oo=D(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.Optional=void 0;var qa=J(),Ma=z();function Ba(e){var t={tag:"optional",underlying:e};return qa.create(function(r){return r===void 0?Ma.SUCCESS(r):e.validate(r)},t)}n(Ba,"Optional");Vt.Optional=Ba});var ao=D(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.Function=void 0;var $a=J(),io=z(),so={tag:"function"};Gt.Function=$a.create(function(e){return typeof e=="function"?io.SUCCESS(e):io.FAILURE.TYPE_INCORRECT(so,e)},so)});var co=D(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.InstanceOf=void 0;var Va=J(),uo=z();function Ga(e){var t={tag:"instanceof",ctor:e};return Va.create(function(r){return r instanceof e?uo.SUCCESS(r):uo.FAILURE.TYPE_INCORRECT(t,r)},t)}n(Ga,"InstanceOf");Yt.InstanceOf=Ga});var fo=D(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.Lazy=void 0;var Ya=J();function Wa(e){var t={get tag(){return o().tag}},r;function o(){if(!r){r=e();for(var a in r)a!=="tag"&&(t[a]=r[a])}return r}return n(o,"getWrapped"),Ya.create(function(a){return o().validate(a)},t)}n(Wa,"Lazy");Wt.Lazy=Wa});var lo=D(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.Brand=void 0;var Ka=J();function Ha(e,t){var r={tag:"brand",brand:e,entity:t};return Ka.create(function(o){return t.validate(o)},r)}n(Ha,"Brand");Kt.Brand=Ha});var po=D(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.checked=nt.check=void 0;var za=Qe(),Qa=z(),Pr=new WeakMap;function Ja(e,t,r){var o=Pr.get(e)||new Map;Pr.set(e,o);var a=o.get(t)||[];o.set(t,a),a.push(r)}n(Ja,"check");nt.check=Ja;function Xa(e,t,r){var o=Pr.get(e),a=o&&o.get(t);if(a)return a;for(var d=[],p=0;p<r;p++)d.push(p);return d}n(Xa,"getValidParameterIndices");function Za(){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,o,a){var d=a.value,p=(r.name||r.constructor.name+".prototype")+(typeof o=="string"?'["'+o+'"]':"["+String(o)+"]"),m=Xa(r,o,e.length);if(m.length!==e.length)throw new Error("Number of `@checked` runtypes and @check parameters not matched.");if(m.length>d.length)throw new Error("Number of `@checked` runtypes exceeds actual parameter length.");a.value=function(){for(var g=[],S=0;S<arguments.length;S++)g[S]=arguments[S];return e.forEach(function(w,C){var h=m[C],A=w.validate(g[h]);if(!A.success){var P=p+", argument #"+h+": "+A.message,L=Qa.FAILURE.ARGUMENT_INCORRECT(P);throw new za.ValidationError(L)}}),d.apply(this,g)}}}n(Za,"checked");nt.checked=Za});var Ue=D(I=>{"use strict";var eu=I&&I.__createBinding||(Object.create?function(e,t,r,o){o===void 0&&(o=r),Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,o){o===void 0&&(o=r),e[o]=t[r]}),Y=I&&I.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&eu(t,e,r)};Object.defineProperty(I,"__esModule",{value:!0});I.InstanceOf=I.Nullish=I.Null=I.Undefined=I.Literal=void 0;Y(bn(),I);Y(br(),I);Y(Sn(),I);Y(Cn(),I);Y(An(),I);Y(Qe(),I);Y(Nt(),I);Y(Tn(),I);Y(On(),I);var Ht=Pn();Object.defineProperty(I,"Literal",{enumerable:!0,get:function(){return Ht.Literal}});Object.defineProperty(I,"Undefined",{enumerable:!0,get:function(){return Ht.Undefined}});Object.defineProperty(I,"Null",{enumerable:!0,get:function(){return Ht.Null}});Object.defineProperty(I,"Nullish",{enumerable:!0,get:function(){return Ht.Nullish}});Y(Dn(),I);Y(kn(),I);Y(Mn(),I);Y(Cr(),I);Y(Wn(),I);Y(zn(),I);Y(Jn(),I);Y(Zn(),I);Y(to(),I);Y(wr(),I);Y(no(),I);Y(oo(),I);Y(ao(),I);var tu=co();Object.defineProperty(I,"InstanceOf",{enumerable:!0,get:function(){return tu.InstanceOf}});Y(fo(),I);Y(Ir(),I);Y(lo(),I);Y(po(),I)});var So=D(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});var bo=n(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},"isObject"),_o=n(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce(function(r,o){return Object.keys(o).forEach(function(a){Array.isArray(r[a])&&Array.isArray(o[a])?r[a]=Array.from(new Set(r[a].concat(o[a]))):bo(r[a])&&bo(o[a])?r[a]=_o(r[a],o[a]):r[a]=o[a]}),r},{})},"merge");Dr.default=_o});var Jo=D((Qo,Mr)=>{(function(e){if(typeof Qo=="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 n(function o(a,d,p){function m(w,C){if(!d[w]){if(!a[w]){var h=typeof require=="function"&&require;if(!C&&h)return h(w,!0);if(g)return g(w,!0);var A=new Error("Cannot find module '"+w+"'");throw A.code="MODULE_NOT_FOUND",A}var P=d[w]={exports:{}};a[w][0].call(P.exports,function(L){var $=a[w][1][L];return m($||L)},P,P.exports,o,a,d,p)}return d[w].exports}n(m,"s");for(var g=typeof require=="function"&&require,S=0;S<p.length;S++)m(p[S]);return m},"e")({1:[function(o,a,d){(function(p){"use strict";var m=p.MutationObserver||p.WebKitMutationObserver,g;if(m){var S=0,w=new m(L),C=p.document.createTextNode("");w.observe(C,{characterData:!0}),g=n(function(){C.data=S=++S%2},"scheduleDrain")}else if(!p.setImmediate&&typeof p.MessageChannel!="undefined"){var h=new p.MessageChannel;h.port1.onmessage=L,g=n(function(){h.port2.postMessage(0)},"scheduleDrain")}else"document"in p&&"onreadystatechange"in p.document.createElement("script")?g=n(function(){var G=p.document.createElement("script");G.onreadystatechange=function(){L(),G.onreadystatechange=null,G.parentNode.removeChild(G),G=null},p.document.documentElement.appendChild(G)},"scheduleDrain"):g=n(function(){setTimeout(L,0)},"scheduleDrain");var A,P=[];function L(){A=!0;for(var G,se,W=P.length;W;){for(se=P,P=[],G=-1;++G<W;)se[G]();W=P.length}A=!1}n(L,"nextTick"),a.exports=$;function $(G){P.push(G)===1&&!A&&g()}n($,"immediate")}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(o,a,d){"use strict";var p=o(1);function m(){}n(m,"INTERNAL");var g={},S=["REJECTED"],w=["FULFILLED"],C=["PENDING"];a.exports=h;function h(R){if(typeof R!="function")throw new TypeError("resolver must be a function");this.state=C,this.queue=[],this.outcome=void 0,R!==m&&$(this,R)}n(h,"Promise"),h.prototype.catch=function(R){return this.then(null,R)},h.prototype.then=function(R,x){if(typeof R!="function"&&this.state===w||typeof x!="function"&&this.state===S)return this;var N=new this.constructor(m);if(this.state!==C){var F=this.state===w?R:x;P(N,F,this.outcome)}else this.queue.push(new A(N,R,x));return N};function A(R,x,N){this.promise=R,typeof x=="function"&&(this.onFulfilled=x,this.callFulfilled=this.otherCallFulfilled),typeof N=="function"&&(this.onRejected=N,this.callRejected=this.otherCallRejected)}n(A,"QueueItem"),A.prototype.callFulfilled=function(R){g.resolve(this.promise,R)},A.prototype.otherCallFulfilled=function(R){P(this.promise,this.onFulfilled,R)},A.prototype.callRejected=function(R){g.reject(this.promise,R)},A.prototype.otherCallRejected=function(R){P(this.promise,this.onRejected,R)};function P(R,x,N){p(function(){var F;try{F=x(N)}catch(H){return g.reject(R,H)}F===R?g.reject(R,new TypeError("Cannot resolve promise with itself")):g.resolve(R,F)})}n(P,"unwrap"),g.resolve=function(R,x){var N=G(L,x);if(N.status==="error")return g.reject(R,N.value);var F=N.value;if(F)$(R,F);else{R.state=w,R.outcome=x;for(var H=-1,oe=R.queue.length;++H<oe;)R.queue[H].callFulfilled(x)}return R},g.reject=function(R,x){R.state=S,R.outcome=x;for(var N=-1,F=R.queue.length;++N<F;)R.queue[N].callRejected(x);return R};function L(R){var x=R&&R.then;if(R&&(typeof R=="object"||typeof R=="function")&&typeof x=="function")return n(function(){x.apply(R,arguments)},"appyThen")}n(L,"getThen");function $(R,x){var N=!1;function F(X){N||(N=!0,g.reject(R,X))}n(F,"onError");function H(X){N||(N=!0,g.resolve(R,X))}n(H,"onSuccess");function oe(){x(H,F)}n(oe,"tryToUnwrap");var re=G(oe);re.status==="error"&&F(re.value)}n($,"safelyResolveThenable");function G(R,x){var N={};try{N.value=R(x),N.status="success"}catch(F){N.status="error",N.value=F}return N}n(G,"tryCatch"),h.resolve=se;function se(R){return R instanceof this?R:g.resolve(new this(m),R)}n(se,"resolve"),h.reject=W;function W(R){var x=new this(m);return g.reject(x,R)}n(W,"reject"),h.all=ft;function ft(R){var x=this;if(Object.prototype.toString.call(R)!=="[object Array]")return this.reject(new TypeError("must be an array"));var N=R.length,F=!1;if(!N)return this.resolve([]);for(var H=new Array(N),oe=0,re=-1,X=new this(m);++re<N;)ue(R[re],re);return X;function ue(Fe,St){x.resolve(Fe).then(cr,function(Ge){F||(F=!0,g.reject(X,Ge))});function cr(Ge){H[St]=Ge,++oe===N&&!F&&(F=!0,g.resolve(X,H))}n(cr,"resolveFromAll")}}n(ft,"all"),h.race=ae;function ae(R){var x=this;if(Object.prototype.toString.call(R)!=="[object Array]")return this.reject(new TypeError("must be an array"));var N=R.length,F=!1;if(!N)return this.resolve([]);for(var H=-1,oe=new this(m);++H<N;)re(R[H]);return oe;function re(X){x.resolve(X).then(function(ue){F||(F=!0,g.resolve(oe,ue))},function(ue){F||(F=!0,g.reject(oe,ue))})}}n(ae,"race")},{"1":1}],3:[function(o,a,d){(function(p){"use strict";typeof p.Promise!="function"&&(p.Promise=o(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"2":2}],4:[function(o,a,d){"use strict";var p=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i};function m(i,u){if(!(i instanceof u))throw new TypeError("Cannot call a class as a function")}n(m,"_classCallCheck");function g(){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(i){return}}n(g,"getIDB");var S=g();function w(){try{if(!S||!S.open)return!1;var i=typeof openDatabase!="undefined"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),u=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!i||u)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch(s){return!1}}n(w,"isIndexedDBValid");function C(i,u){i=i||[],u=u||{};try{return new Blob(i,u)}catch(c){if(c.name!=="TypeError")throw c;for(var s=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,f=new s,l=0;l<i.length;l+=1)f.append(i[l]);return f.getBlob(u.type)}}n(C,"createBlob"),typeof Promise=="undefined"&&o(3);var h=Promise;function A(i,u){u&&i.then(function(s){u(null,s)},function(s){u(s)})}n(A,"executeCallback");function P(i,u,s){typeof u=="function"&&i.then(u),typeof s=="function"&&i.catch(s)}n(P,"executeTwoCallbacks");function L(i){return typeof i!="string"&&(console.warn(i+" used as a key, but it is not a string."),i=String(i)),i}n(L,"normalizeKey");function $(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}n($,"getCallback");var G="local-forage-detect-blob-support",se=void 0,W={},ft=Object.prototype.toString,ae="readonly",R="readwrite";function x(i){for(var u=i.length,s=new ArrayBuffer(u),f=new Uint8Array(s),l=0;l<u;l++)f[l]=i.charCodeAt(l);return s}n(x,"_binStringToArrayBuffer");function N(i){return new h(function(u){var s=i.transaction(G,R),f=C([""]);s.objectStore(G).put(f,"key"),s.onabort=function(l){l.preventDefault(),l.stopPropagation(),u(!1)},s.oncomplete=function(){var l=navigator.userAgent.match(/Chrome\/(\d+)/),c=navigator.userAgent.match(/Edge\//);u(c||!l||parseInt(l[1],10)>=43)}}).catch(function(){return!1})}n(N,"_checkBlobSupportWithoutCaching");function F(i){return typeof se=="boolean"?h.resolve(se):N(i).then(function(u){return se=u,se})}n(F,"_checkBlobSupport");function H(i){var u=W[i.name],s={};s.promise=new h(function(f,l){s.resolve=f,s.reject=l}),u.deferredOperations.push(s),u.dbReady?u.dbReady=u.dbReady.then(function(){return s.promise}):u.dbReady=s.promise}n(H,"_deferReadiness");function oe(i){var u=W[i.name],s=u.deferredOperations.pop();if(s)return s.resolve(),s.promise}n(oe,"_advanceReadiness");function re(i,u){var s=W[i.name],f=s.deferredOperations.pop();if(f)return f.reject(u),f.promise}n(re,"_rejectReadiness");function X(i,u){return new h(function(s,f){if(W[i.name]=W[i.name]||Wr(),i.db)if(u)H(i),i.db.close();else return s(i.db);var l=[i.name];u&&l.push(i.version);var c=S.open.apply(S,l);u&&(c.onupgradeneeded=function(v){var y=c.result;try{y.createObjectStore(i.storeName),v.oldVersion<=1&&y.createObjectStore(G)}catch(E){if(E.name==="ConstraintError")console.warn('The database "'+i.name+'" has been upgraded from version '+v.oldVersion+" to version "+v.newVersion+', but the storage "'+i.storeName+'" already exists.');else throw E}}),c.onerror=function(v){v.preventDefault(),f(c.error)},c.onsuccess=function(){s(c.result),oe(i)}})}n(X,"_getConnection");function ue(i){return X(i,!1)}n(ue,"_getOriginalConnection");function Fe(i){return X(i,!0)}n(Fe,"_getUpgradedConnection");function St(i,u){if(!i.db)return!0;var s=!i.db.objectStoreNames.contains(i.storeName),f=i.version<i.db.version,l=i.version>i.db.version;if(f&&(i.version!==u&&console.warn('The database "'+i.name+`" can't be downgraded from version `+i.db.version+" to version "+i.version+"."),i.version=i.db.version),l||s){if(s){var c=i.db.version+1;c>i.version&&(i.version=c)}return!0}return!1}n(St,"_isUpgradeNeeded");function cr(i){return new h(function(u,s){var f=new FileReader;f.onerror=s,f.onloadend=function(l){var c=btoa(l.target.result||"");u({__local_forage_encoded_blob:!0,data:c,type:i.type})},f.readAsBinaryString(i)})}n(cr,"_encodeBlob");function Ge(i){var u=x(atob(i.data));return C([u],{type:i.type})}n(Ge,"_decodeBlob");function Yr(i){return i&&i.__local_forage_encoded_blob}n(Yr,"_isEncodedBlob");function _i(i){var u=this,s=u._initReady().then(function(){var f=W[u._dbInfo.name];if(f&&f.dbReady)return f.dbReady});return P(s,i,i),s}n(_i,"_fullyReady");function Si(i){H(i);for(var u=W[i.name],s=u.forages,f=0;f<s.length;f++){var l=s[f];l._dbInfo.db&&(l._dbInfo.db.close(),l._dbInfo.db=null)}return i.db=null,ue(i).then(function(c){return i.db=c,St(i)?Fe(i):c}).then(function(c){i.db=u.db=c;for(var v=0;v<s.length;v++)s[v]._dbInfo.db=c}).catch(function(c){throw re(i,c),c})}n(Si,"_tryReconnect");function Se(i,u,s,f){f===void 0&&(f=1);try{var l=i.db.transaction(i.storeName,u);s(null,l)}catch(c){if(f>0&&(!i.db||c.name==="InvalidStateError"||c.name==="NotFoundError"))return h.resolve().then(function(){if(!i.db||c.name==="NotFoundError"&&!i.db.objectStoreNames.contains(i.storeName)&&i.version<=i.db.version)return i.db&&(i.version=i.db.version+1),Fe(i)}).then(function(){return Si(i).then(function(){Se(i,u,s,f-1)})}).catch(s);s(c)}}n(Se,"createTransaction");function Wr(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}n(Wr,"createDbContext");function wi(i){var u=this,s={db:null};if(i)for(var f in i)s[f]=i[f];var l=W[s.name];l||(l=Wr(),W[s.name]=l),l.forages.push(u),u._initReady||(u._initReady=u.ready,u.ready=_i);var c=[];function v(){return h.resolve()}n(v,"ignoreErrors");for(var y=0;y<l.forages.length;y++){var E=l.forages[y];E!==u&&c.push(E._initReady().catch(v))}var b=l.forages.slice(0);return h.all(c).then(function(){return s.db=l.db,ue(s)}).then(function(_){return s.db=_,St(s,u._defaultConfig.version)?Fe(s):_}).then(function(_){s.db=l.db=_,u._dbInfo=s;for(var T=0;T<b.length;T++){var U=b[T];U!==u&&(U._dbInfo.db=s.db,U._dbInfo.version=s.version)}})}n(wi,"_initStorage");function Ri(i,u){var s=this;i=L(i);var f=new h(function(l,c){s.ready().then(function(){Se(s._dbInfo,ae,function(v,y){if(v)return c(v);try{var E=y.objectStore(s._dbInfo.storeName),b=E.get(i);b.onsuccess=function(){var _=b.result;_===void 0&&(_=null),Yr(_)&&(_=Ge(_)),l(_)},b.onerror=function(){c(b.error)}}catch(_){c(_)}})}).catch(c)});return A(f,u),f}n(Ri,"getItem");function Ci(i,u){var s=this,f=new h(function(l,c){s.ready().then(function(){Se(s._dbInfo,ae,function(v,y){if(v)return c(v);try{var E=y.objectStore(s._dbInfo.storeName),b=E.openCursor(),_=1;b.onsuccess=function(){var T=b.result;if(T){var U=T.value;Yr(U)&&(U=Ge(U));var k=i(U,T.key,_++);k!==void 0?l(k):T.continue()}else l()},b.onerror=function(){c(b.error)}}catch(T){c(T)}})}).catch(c)});return A(f,u),f}n(Ci,"iterate");function Ai(i,u,s){var f=this;i=L(i);var l=new h(function(c,v){var y;f.ready().then(function(){return y=f._dbInfo,ft.call(u)==="[object Blob]"?F(y.db).then(function(E){return E?u:cr(u)}):u}).then(function(E){Se(f._dbInfo,R,function(b,_){if(b)return v(b);try{var T=_.objectStore(f._dbInfo.storeName);E===null&&(E=void 0);var U=T.put(E,i);_.oncomplete=function(){E===void 0&&(E=null),c(E)},_.onabort=_.onerror=function(){var k=U.error?U.error:U.transaction.error;v(k)}}catch(k){v(k)}})}).catch(v)});return A(l,s),l}n(Ai,"setItem");function Ti(i,u){var s=this;i=L(i);var f=new h(function(l,c){s.ready().then(function(){Se(s._dbInfo,R,function(v,y){if(v)return c(v);try{var E=y.objectStore(s._dbInfo.storeName),b=E.delete(i);y.oncomplete=function(){l()},y.onerror=function(){c(b.error)},y.onabort=function(){var _=b.error?b.error:b.transaction.error;c(_)}}catch(_){c(_)}})}).catch(c)});return A(f,u),f}n(Ti,"removeItem");function Oi(i){var u=this,s=new h(function(f,l){u.ready().then(function(){Se(u._dbInfo,R,function(c,v){if(c)return l(c);try{var y=v.objectStore(u._dbInfo.storeName),E=y.clear();v.oncomplete=function(){f()},v.onabort=v.onerror=function(){var b=E.error?E.error:E.transaction.error;l(b)}}catch(b){l(b)}})}).catch(l)});return A(s,i),s}n(Oi,"clear");function Ii(i){var u=this,s=new h(function(f,l){u.ready().then(function(){Se(u._dbInfo,ae,function(c,v){if(c)return l(c);try{var y=v.objectStore(u._dbInfo.storeName),E=y.count();E.onsuccess=function(){f(E.result)},E.onerror=function(){l(E.error)}}catch(b){l(b)}})}).catch(l)});return A(s,i),s}n(Ii,"length");function Ni(i,u){var s=this,f=new h(function(l,c){if(i<0){l(null);return}s.ready().then(function(){Se(s._dbInfo,ae,function(v,y){if(v)return c(v);try{var E=y.objectStore(s._dbInfo.storeName),b=!1,_=E.openKeyCursor();_.onsuccess=function(){var T=_.result;if(!T){l(null);return}i===0||b?l(T.key):(b=!0,T.advance(i))},_.onerror=function(){c(_.error)}}catch(T){c(T)}})}).catch(c)});return A(f,u),f}n(Ni,"key");function Pi(i){var u=this,s=new h(function(f,l){u.ready().then(function(){Se(u._dbInfo,ae,function(c,v){if(c)return l(c);try{var y=v.objectStore(u._dbInfo.storeName),E=y.openKeyCursor(),b=[];E.onsuccess=function(){var _=E.result;if(!_){f(b);return}b.push(_.key),_.continue()},E.onerror=function(){l(E.error)}}catch(_){l(_)}})}).catch(l)});return A(s,i),s}n(Pi,"keys");function Ui(i,u){u=$.apply(this,arguments);var s=this.config();i=typeof i!="function"&&i||{},i.name||(i.name=i.name||s.name,i.storeName=i.storeName||s.storeName);var f=this,l;if(!i.name)l=h.reject("Invalid arguments");else{var c=i.name===s.name&&f._dbInfo.db,v=c?h.resolve(f._dbInfo.db):ue(i).then(function(y){var E=W[i.name],b=E.forages;E.db=y;for(var _=0;_<b.length;_++)b[_]._dbInfo.db=y;return y});i.storeName?l=v.then(function(y){if(!!y.objectStoreNames.contains(i.storeName)){var E=y.version+1;H(i);var b=W[i.name],_=b.forages;y.close();for(var T=0;T<_.length;T++){var U=_[T];U._dbInfo.db=null,U._dbInfo.version=E}var k=new h(function(q,te){var Z=S.open(i.name,E);Z.onerror=function(ie){var dt=Z.result;dt.close(),te(ie)},Z.onupgradeneeded=function(){var ie=Z.result;ie.deleteObjectStore(i.storeName)},Z.onsuccess=function(){var ie=Z.result;ie.close(),q(ie)}});return k.then(function(q){b.db=q;for(var te=0;te<_.length;te++){var Z=_[te];Z._dbInfo.db=q,oe(Z._dbInfo)}}).catch(function(q){throw(re(i,q)||h.resolve()).catch(function(){}),q})}}):l=v.then(function(y){H(i);var E=W[i.name],b=E.forages;y.close();for(var _=0;_<b.length;_++){var T=b[_];T._dbInfo.db=null}var U=new h(function(k,q){var te=S.deleteDatabase(i.name);te.onerror=te.onblocked=function(Z){var ie=te.result;ie&&ie.close(),q(Z)},te.onsuccess=function(){var Z=te.result;Z&&Z.close(),k(Z)}});return U.then(function(k){E.db=k;for(var q=0;q<b.length;q++){var te=b[q];oe(te._dbInfo)}}).catch(function(k){throw(re(i,k)||h.resolve()).catch(function(){}),k})})}return A(l,u),l}n(Ui,"dropInstance");var xi={_driver:"asyncStorage",_initStorage:wi,_support:w(),iterate:Ci,getItem:Ri,setItem:Ai,removeItem:Ti,clear:Oi,length:Ii,key:Ni,keys:Pi,dropInstance:Ui};function Di(){return typeof openDatabase=="function"}n(Di,"isWebSQLValid");var Ae="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Li="~~local_forage_type~",Kr=/^~~local_forage_type~([^~]+)~/,wt="__lfsc__:",fr=wt.length,lr="arbf",dr="blob",Hr="si08",zr="ui08",Qr="uic8",Jr="si16",Xr="si32",Zr="ur16",en="ui32",tn="fl32",rn="fl64",nn=fr+lr.length,on=Object.prototype.toString;function sn(i){var u=i.length*.75,s=i.length,f,l=0,c,v,y,E;i[i.length-1]==="="&&(u--,i[i.length-2]==="="&&u--);var b=new ArrayBuffer(u),_=new Uint8Array(b);for(f=0;f<s;f+=4)c=Ae.indexOf(i[f]),v=Ae.indexOf(i[f+1]),y=Ae.indexOf(i[f+2]),E=Ae.indexOf(i[f+3]),_[l++]=c<<2|v>>4,_[l++]=(v&15)<<4|y>>2,_[l++]=(y&3)<<6|E&63;return b}n(sn,"stringToBuffer");function pr(i){var u=new Uint8Array(i),s="",f;for(f=0;f<u.length;f+=3)s+=Ae[u[f]>>2],s+=Ae[(u[f]&3)<<4|u[f+1]>>4],s+=Ae[(u[f+1]&15)<<2|u[f+2]>>6],s+=Ae[u[f+2]&63];return u.length%3==2?s=s.substring(0,s.length-1)+"=":u.length%3==1&&(s=s.substring(0,s.length-2)+"=="),s}n(pr,"bufferToString");function Fi(i,u){var s="";if(i&&(s=on.call(i)),i&&(s==="[object ArrayBuffer]"||i.buffer&&on.call(i.buffer)==="[object ArrayBuffer]")){var f,l=wt;i instanceof ArrayBuffer?(f=i,l+=lr):(f=i.buffer,s==="[object Int8Array]"?l+=Hr:s==="[object Uint8Array]"?l+=zr:s==="[object Uint8ClampedArray]"?l+=Qr:s==="[object Int16Array]"?l+=Jr:s==="[object Uint16Array]"?l+=Zr:s==="[object Int32Array]"?l+=Xr:s==="[object Uint32Array]"?l+=en:s==="[object Float32Array]"?l+=tn:s==="[object Float64Array]"?l+=rn:u(new Error("Failed to get type for BinaryArray"))),u(l+pr(f))}else if(s==="[object Blob]"){var c=new FileReader;c.onload=function(){var v=Li+i.type+"~"+pr(this.result);u(wt+dr+v)},c.readAsArrayBuffer(i)}else try{u(JSON.stringify(i))}catch(v){console.error("Couldn't convert value into a JSON string: ",i),u(null,v)}}n(Fi,"serialize");function ki(i){if(i.substring(0,fr)!==wt)return JSON.parse(i);var u=i.substring(nn),s=i.substring(fr,nn),f;if(s===dr&&Kr.test(u)){var l=u.match(Kr);f=l[1],u=u.substring(l[0].length)}var c=sn(u);switch(s){case lr:return c;case dr:return C([c],{type:f});case Hr:return new Int8Array(c);case zr:return new Uint8Array(c);case Qr:return new Uint8ClampedArray(c);case Jr:return new Int16Array(c);case Zr:return new Uint16Array(c);case Xr:return new Int32Array(c);case en:return new Uint32Array(c);case tn:return new Float32Array(c);case rn:return new Float64Array(c);default:throw new Error("Unkown type: "+s)}}n(ki,"deserialize");var mr={serialize:Fi,deserialize:ki,stringToBuffer:sn,bufferToString:pr};function an(i,u,s,f){i.executeSql("CREATE TABLE IF NOT EXISTS "+u.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],s,f)}n(an,"createDbTable");function ji(i){var u=this,s={db:null};if(i)for(var f in i)s[f]=typeof i[f]!="string"?i[f].toString():i[f];var l=new h(function(c,v){try{s.db=openDatabase(s.name,String(s.version),s.description,s.size)}catch(y){return v(y)}s.db.transaction(function(y){an(y,s,function(){u._dbInfo=s,c()},function(E,b){v(b)})},v)});return s.serializer=mr,l}n(ji,"_initStorage$1");function Te(i,u,s,f,l,c){i.executeSql(s,f,l,function(v,y){y.code===y.SYNTAX_ERR?v.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[u.storeName],function(E,b){b.rows.length?c(E,y):an(E,u,function(){E.executeSql(s,f,l,c)},c)},c):c(v,y)},c)}n(Te,"tryExecuteSql");function qi(i,u){var s=this;i=L(i);var f=new h(function(l,c){s.ready().then(function(){var v=s._dbInfo;v.db.transaction(function(y){Te(y,v,"SELECT * FROM "+v.storeName+" WHERE key = ? LIMIT 1",[i],function(E,b){var _=b.rows.length?b.rows.item(0).value:null;_&&(_=v.serializer.deserialize(_)),l(_)},function(E,b){c(b)})})}).catch(c)});return A(f,u),f}n(qi,"getItem$1");function Mi(i,u){var s=this,f=new h(function(l,c){s.ready().then(function(){var v=s._dbInfo;v.db.transaction(function(y){Te(y,v,"SELECT * FROM "+v.storeName,[],function(E,b){for(var _=b.rows,T=_.length,U=0;U<T;U++){var k=_.item(U),q=k.value;if(q&&(q=v.serializer.deserialize(q)),q=i(q,k.key,U+1),q!==void 0){l(q);return}}l()},function(E,b){c(b)})})}).catch(c)});return A(f,u),f}n(Mi,"iterate$1");function un(i,u,s,f){var l=this;i=L(i);var c=new h(function(v,y){l.ready().then(function(){u===void 0&&(u=null);var E=u,b=l._dbInfo;b.serializer.serialize(u,function(_,T){T?y(T):b.db.transaction(function(U){Te(U,b,"INSERT OR REPLACE INTO "+b.storeName+" (key, value) VALUES (?, ?)",[i,_],function(){v(E)},function(k,q){y(q)})},function(U){if(U.code===U.QUOTA_ERR){if(f>0){v(un.apply(l,[i,E,s,f-1]));return}y(U)}})})}).catch(y)});return A(c,s),c}n(un,"_setItem");function Bi(i,u,s){return un.apply(this,[i,u,s,1])}n(Bi,"setItem$1");function $i(i,u){var s=this;i=L(i);var f=new h(function(l,c){s.ready().then(function(){var v=s._dbInfo;v.db.transaction(function(y){Te(y,v,"DELETE FROM "+v.storeName+" WHERE key = ?",[i],function(){l()},function(E,b){c(b)})})}).catch(c)});return A(f,u),f}n($i,"removeItem$1");function Vi(i){var u=this,s=new h(function(f,l){u.ready().then(function(){var c=u._dbInfo;c.db.transaction(function(v){Te(v,c,"DELETE FROM "+c.storeName,[],function(){f()},function(y,E){l(E)})})}).catch(l)});return A(s,i),s}n(Vi,"clear$1");function Gi(i){var u=this,s=new h(function(f,l){u.ready().then(function(){var c=u._dbInfo;c.db.transaction(function(v){Te(v,c,"SELECT COUNT(key) as c FROM "+c.storeName,[],function(y,E){var b=E.rows.item(0).c;f(b)},function(y,E){l(E)})})}).catch(l)});return A(s,i),s}n(Gi,"length$1");function Yi(i,u){var s=this,f=new h(function(l,c){s.ready().then(function(){var v=s._dbInfo;v.db.transaction(function(y){Te(y,v,"SELECT key FROM "+v.storeName+" WHERE id = ? LIMIT 1",[i+1],function(E,b){var _=b.rows.length?b.rows.item(0).key:null;l(_)},function(E,b){c(b)})})}).catch(c)});return A(f,u),f}n(Yi,"key$1");function Wi(i){var u=this,s=new h(function(f,l){u.ready().then(function(){var c=u._dbInfo;c.db.transaction(function(v){Te(v,c,"SELECT key FROM "+c.storeName,[],function(y,E){for(var b=[],_=0;_<E.rows.length;_++)b.push(E.rows.item(_).key);f(b)},function(y,E){l(E)})})}).catch(l)});return A(s,i),s}n(Wi,"keys$1");function Ki(i){return new h(function(u,s){i.transaction(function(f){f.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(l,c){for(var v=[],y=0;y<c.rows.length;y++)v.push(c.rows.item(y).name);u({db:i,storeNames:v})},function(l,c){s(c)})},function(f){s(f)})})}n(Ki,"getAllStoreNames");function Hi(i,u){u=$.apply(this,arguments);var s=this.config();i=typeof i!="function"&&i||{},i.name||(i.name=i.name||s.name,i.storeName=i.storeName||s.storeName);var f=this,l;return i.name?l=new h(function(c){var v;i.name===s.name?v=f._dbInfo.db:v=openDatabase(i.name,"","",0),i.storeName?c({db:v,storeNames:[i.storeName]}):c(Ki(v))}).then(function(c){return new h(function(v,y){c.db.transaction(function(E){function b(k){return new h(function(q,te){E.executeSql("DROP TABLE IF EXISTS "+k,[],function(){q()},function(Z,ie){te(ie)})})}n(b,"dropTable");for(var _=[],T=0,U=c.storeNames.length;T<U;T++)_.push(b(c.storeNames[T]));h.all(_).then(function(){v()}).catch(function(k){y(k)})},function(E){y(E)})})}):l=h.reject("Invalid arguments"),A(l,u),l}n(Hi,"dropInstance$1");var zi={_driver:"webSQLStorage",_initStorage:ji,_support:Di(),iterate:Mi,getItem:qi,setItem:Bi,removeItem:$i,clear:Vi,length:Gi,key:Yi,keys:Wi,dropInstance:Hi};function Qi(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(i){return!1}}n(Qi,"isLocalStorageValid");function cn(i,u){var s=i.name+"/";return i.storeName!==u.storeName&&(s+=i.storeName+"/"),s}n(cn,"_getKeyPrefix");function Ji(){var i="_localforage_support_test";try{return localStorage.setItem(i,!0),localStorage.removeItem(i),!1}catch(u){return!0}}n(Ji,"checkIfLocalStorageThrows");function Xi(){return!Ji()||localStorage.length>0}n(Xi,"_isLocalStorageUsable");function Zi(i){var u=this,s={};if(i)for(var f in i)s[f]=i[f];return s.keyPrefix=cn(i,u._defaultConfig),Xi()?(u._dbInfo=s,s.serializer=mr,h.resolve()):h.reject()}n(Zi,"_initStorage$2");function es(i){var u=this,s=u.ready().then(function(){for(var f=u._dbInfo.keyPrefix,l=localStorage.length-1;l>=0;l--){var c=localStorage.key(l);c.indexOf(f)===0&&localStorage.removeItem(c)}});return A(s,i),s}n(es,"clear$2");function ts(i,u){var s=this;i=L(i);var f=s.ready().then(function(){var l=s._dbInfo,c=localStorage.getItem(l.keyPrefix+i);return c&&(c=l.serializer.deserialize(c)),c});return A(f,u),f}n(ts,"getItem$2");function rs(i,u){var s=this,f=s.ready().then(function(){for(var l=s._dbInfo,c=l.keyPrefix,v=c.length,y=localStorage.length,E=1,b=0;b<y;b++){var _=localStorage.key(b);if(_.indexOf(c)===0){var T=localStorage.getItem(_);if(T&&(T=l.serializer.deserialize(T)),T=i(T,_.substring(v),E++),T!==void 0)return T}}});return A(f,u),f}n(rs,"iterate$2");function ns(i,u){var s=this,f=s.ready().then(function(){var l=s._dbInfo,c;try{c=localStorage.key(i)}catch(v){c=null}return c&&(c=c.substring(l.keyPrefix.length)),c});return A(f,u),f}n(ns,"key$2");function os(i){var u=this,s=u.ready().then(function(){for(var f=u._dbInfo,l=localStorage.length,c=[],v=0;v<l;v++){var y=localStorage.key(v);y.indexOf(f.keyPrefix)===0&&c.push(y.substring(f.keyPrefix.length))}return c});return A(s,i),s}n(os,"keys$2");function is(i){var u=this,s=u.keys().then(function(f){return f.length});return A(s,i),s}n(is,"length$2");function ss(i,u){var s=this;i=L(i);var f=s.ready().then(function(){var l=s._dbInfo;localStorage.removeItem(l.keyPrefix+i)});return A(f,u),f}n(ss,"removeItem$2");function as(i,u,s){var f=this;i=L(i);var l=f.ready().then(function(){u===void 0&&(u=null);var c=u;return new h(function(v,y){var E=f._dbInfo;E.serializer.serialize(u,function(b,_){if(_)y(_);else try{localStorage.setItem(E.keyPrefix+i,b),v(c)}catch(T){(T.name==="QuotaExceededError"||T.name==="NS_ERROR_DOM_QUOTA_REACHED")&&y(T),y(T)}})})});return A(l,s),l}n(as,"setItem$2");function us(i,u){if(u=$.apply(this,arguments),i=typeof i!="function"&&i||{},!i.name){var s=this.config();i.name=i.name||s.name,i.storeName=i.storeName||s.storeName}var f=this,l;return i.name?l=new h(function(c){i.storeName?c(cn(i,f._defaultConfig)):c(i.name+"/")}).then(function(c){for(var v=localStorage.length-1;v>=0;v--){var y=localStorage.key(v);y.indexOf(c)===0&&localStorage.removeItem(y)}}):l=h.reject("Invalid arguments"),A(l,u),l}n(us,"dropInstance$2");var cs={_driver:"localStorageWrapper",_initStorage:Zi,_support:Qi(),iterate:rs,getItem:ts,setItem:as,removeItem:ss,clear:es,length:is,key:ns,keys:os,dropInstance:us},fs=n(function(u,s){return u===s||typeof u=="number"&&typeof s=="number"&&isNaN(u)&&isNaN(s)},"sameValue"),ls=n(function(u,s){for(var f=u.length,l=0;l<f;){if(fs(u[l],s))return!0;l++}return!1},"includes"),fn=Array.isArray||function(i){return Object.prototype.toString.call(i)==="[object Array]"},lt={},ln={},Ye={INDEXEDDB:xi,WEBSQL:zi,LOCALSTORAGE:cs},ds=[Ye.INDEXEDDB._driver,Ye.WEBSQL._driver,Ye.LOCALSTORAGE._driver],Rt=["dropInstance"],vr=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Rt),ps={description:"",driver:ds.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function ms(i,u){i[u]=function(){var s=arguments;return i.ready().then(function(){return i[u].apply(i,s)})}}n(ms,"callWhenReady");function hr(){for(var i=1;i<arguments.length;i++){var u=arguments[i];if(u)for(var s in u)u.hasOwnProperty(s)&&(fn(u[s])?arguments[0][s]=u[s].slice():arguments[0][s]=u[s])}return arguments[0]}n(hr,"extend");var vs=function(){function i(u){m(this,i);for(var s in Ye)if(Ye.hasOwnProperty(s)){var f=Ye[s],l=f._driver;this[s]=l,lt[l]||this.defineDriver(f)}this._defaultConfig=hr({},ps),this._config=hr({},this._defaultConfig,u),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return n(i,"LocalForage"),i.prototype.config=n(function(s){if((typeof s=="undefined"?"undefined":p(s))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var f in s){if(f==="storeName"&&(s[f]=s[f].replace(/\W/g,"_")),f==="version"&&typeof s[f]!="number")return new Error("Database version must be a number.");this._config[f]=s[f]}return"driver"in s&&s.driver?this.setDriver(this._config.driver):!0}else return typeof s=="string"?this._config[s]:this._config},"config"),i.prototype.defineDriver=n(function(s,f,l){var c=new h(function(v,y){try{var E=s._driver,b=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!s._driver){y(b);return}for(var _=vr.concat("_initStorage"),T=0,U=_.length;T<U;T++){var k=_[T],q=!ls(Rt,k);if((q||s[k])&&typeof s[k]!="function"){y(b);return}}var te=n(function(){for(var dt=n(function(ys){return function(){var Es=new Error("Method "+ys+" is not implemented by the current driver"),dn=h.reject(Es);return A(dn,arguments[arguments.length-1]),dn}},"methodNotImplementedFactory"),gr=0,gs=Rt.length;gr<gs;gr++){var yr=Rt[gr];s[yr]||(s[yr]=dt(yr))}},"configureMissingMethods");te();var Z=n(function(dt){lt[E]&&console.info("Redefining LocalForage driver: "+E),lt[E]=s,ln[E]=dt,v()},"setDriverSupport");"_support"in s?s._support&&typeof s._support=="function"?s._support().then(Z,y):Z(!!s._support):Z(!0)}catch(ie){y(ie)}});return P(c,f,l),c},"defineDriver"),i.prototype.driver=n(function(){return this._driver||null},"driver"),i.prototype.getDriver=n(function(s,f,l){var c=lt[s]?h.resolve(lt[s]):h.reject(new Error("Driver not found."));return P(c,f,l),c},"getDriver"),i.prototype.getSerializer=n(function(s){var f=h.resolve(mr);return P(f,s),f},"getSerializer"),i.prototype.ready=n(function(s){var f=this,l=f._driverSet.then(function(){return f._ready===null&&(f._ready=f._initDriver()),f._ready});return P(l,s,s),l},"ready"),i.prototype.setDriver=n(function(s,f,l){var c=this;fn(s)||(s=[s]);var v=this._getSupportedDrivers(s);function y(){c._config.driver=c.driver()}n(y,"setDriverToConfig");function E(T){return c._extend(T),y(),c._ready=c._initStorage(c._config),c._ready}n(E,"extendSelfWithDriver");function b(T){return function(){var U=0;function k(){for(;U<T.length;){var q=T[U];return U++,c._dbInfo=null,c._ready=null,c.getDriver(q).then(E).catch(k)}y();var te=new Error("No available storage method found.");return c._driverSet=h.reject(te),c._driverSet}return n(k,"driverPromiseLoop"),k()}}n(b,"initDriver");var _=this._driverSet!==null?this._driverSet.catch(function(){return h.resolve()}):h.resolve();return this._driverSet=_.then(function(){var T=v[0];return c._dbInfo=null,c._ready=null,c.getDriver(T).then(function(U){c._driver=U._driver,y(),c._wrapLibraryMethodsWithReady(),c._initDriver=b(v)})}).catch(function(){y();var T=new Error("No available storage method found.");return c._driverSet=h.reject(T),c._driverSet}),P(this._driverSet,f,l),this._driverSet},"setDriver"),i.prototype.supports=n(function(s){return!!ln[s]},"supports"),i.prototype._extend=n(function(s){hr(this,s)},"_extend"),i.prototype._getSupportedDrivers=n(function(s){for(var f=[],l=0,c=s.length;l<c;l++){var v=s[l];this.supports(v)&&f.push(v)}return f},"_getSupportedDrivers"),i.prototype._wrapLibraryMethodsWithReady=n(function(){for(var s=0,f=vr.length;s<f;s++)ms(this,vr[s])},"_wrapLibraryMethodsWithReady"),i.prototype.createInstance=n(function(s){return new i(s)},"createInstance"),i}(),hs=new vs;a.exports=hs},{"3":3}]},{},[4])(4)})});var ei=D((Xo,Zo)=>{(function(e){var t;if(typeof define=="function"&&define.amd&&(define(e),t=!0),typeof Xo=="object"&&(Zo.exports=e(),t=!0),!t){var r=window.Cookies,o=window.Cookies=e();o.noConflict=function(){return window.Cookies=r,o}}})(function(){function e(){for(var o=0,a={};o<arguments.length;o++){var d=arguments[o];for(var p in d)a[p]=d[p]}return a}n(e,"extend");function t(o){return o.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}n(t,"decode");function r(o){function a(){}n(a,"api");function d(m,g,S){if(typeof document!="undefined"){S=e({path:"/"},a.defaults,S),typeof S.expires=="number"&&(S.expires=new Date(new Date*1+S.expires*864e5)),S.expires=S.expires?S.expires.toUTCString():"";try{var w=JSON.stringify(g);/^[\{\[]/.test(w)&&(g=w)}catch(A){}g=o.write?o.write(g,m):encodeURIComponent(String(g)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),m=encodeURIComponent(String(m)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var C="";for(var h in S)!S[h]||(C+="; "+h,S[h]!==!0&&(C+="="+S[h].split(";")[0]));return document.cookie=m+"="+g+C}}n(d,"set");function p(m,g){if(typeof document!="undefined"){for(var S={},w=document.cookie?document.cookie.split("; "):[],C=0;C<w.length;C++){var h=w[C].split("="),A=h.slice(1).join("=");!g&&A.charAt(0)==='"'&&(A=A.slice(1,-1));try{var P=t(h[0]);if(A=(o.read||o)(A,P)||t(A),g)try{A=JSON.parse(A)}catch(L){}if(S[P]=A,m===P)break}catch(L){}}return m?S[m]:S}}return n(p,"get"),a.set=d,a.get=function(m){return p(m,!1)},a.getJSON=function(m){return p(m,!0)},a.remove=function(m,g){d(m,"",e(g,{expires:-1}))},a.defaults={},a.withConverter=r,a}return n(r,"init"),r(function(){})})});Ts(exports,{PaywallUnlockRequest:()=>bi,UserDataRequest:()=>be,goToLoginPage:()=>oc,logout:()=>ic,tryActivateSubscriptionAccess:()=>sc,updateStorage:()=>ac});var Is;var pt=n(()=>Is||window.location.hostname,"getCurrentHostname"),Re=n(()=>window.location.href,"getCurrentUrl"),Ns=n(()=>{let e=/^bed-([^.]+)\.api\.no$/.exec(pt()),t=/\.([^.]+)\.api\.no/.exec(pt());return e?e[1]:t?t[1]:null},"getCurrentEnvironment"),le=n(()=>pt().replace(/\.[^.]+\.api\.no/,""),"getCurrentPublicationDomain"),Ke=n(()=>{let e=Ns(),t="www.aid.no";return e==="localhost"?t="www.aid.no.localhost.api.no":e&&(t=`www-${e}.aid.no`),t},"getAidDomain");function Ps(e,t){let r=new FormData;Object.keys(t).forEach(a=>r.append(a,t[a])),fetch(e,{method:"POST",body:r,headers:{Accept:"application/json"}}).then(a=>{if(!a.ok)throw new Error(`Error, status: ${a.status}, text: ${a.statusText}`)})}n(Ps,"postLog");var Ct=n((e,t,r)=>{let o={};Object.keys(r).forEach(d=>{if(["string","number","boolean"].includes(typeof r[d])){o[d]=r[d];return}try{o[d]=JSON.stringify(r[d])}catch(p){o[d]=r[d]}});let a=ce(ne({},o),{message:t,url:Re(),domain:pt()});Ps(`/api/mercury/v1/log/${e}`,a)},"backendLog"),Us={error:(e,t)=>Ct("error",e,t),warn:(e,t)=>Ct("warn",e,t),info:(e,t)=>Ct("info",e,t),debug:(e,t)=>Ct("debug",e,t)},gn=Us;var xs;var Ds=n(()=>xs||gn,"getLogger"),Er=n(e=>{let t={message:e.message};return Object.getOwnPropertyNames(e).forEach(r=>{t[r]=e[r]}),t},"rewriteErrorObject"),yn=n(e=>O(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(o=>{r[o]=e[o]}),r}),"rewriteResponseObject"),Ls=n((r,...o)=>O(void 0,[r,...o],function*(e,t={}){let a=e,d=t||{};if(a instanceof Error){let p=Er(a);a=p.message,d=ce(ne({},d),{error:p})}if(d=ce(ne({},d),{origin:"@amedia/user"}),t instanceof Error){let p=Er(t);d=ce(ne({},d),{[Object.keys(d).includes("error")?"contextError":"error"]:p})}else if(d instanceof Response){let p=yield yn(d);d=ce(ne({},d),{response:p})}else for(let p of Object.keys(d))if(d[p]instanceof Error)d[p]=Er(d[p]);else if(d[p]instanceof Response){let m=yield yn(d[p]);d[p]=m}return{message:a,context:d}}),"processIncomingLogData"),At=n((e,t,r)=>{Ls(t,r).then(({message:o,context:a})=>Ds()[e](o,a))},"processAndLog"),j={debug:(e,t)=>At("debug",e,t),info:(e,t)=>At("info",e,t),warn:(e,t)=>At("warn",e,t),error:(e,t)=>At("error",e,t)};var Ce,Fs=n(e=>{Ce=e},"setRootElement");typeof window!="undefined"&&Fs(window);var ve=n((e,t)=>{if(!Ce){j.error("No root element to bind event to!");return}Ce.addEventListener(e,r=>{r.stopImmediatePropagation(),t.apply(Ce,[r])})},"listenWithExclusivity"),He=n((e,t)=>{if(!Ce){j.error("No root element to bind event to!");return}Ce.addEventListener(e,r=>{t.apply(Ce,[r])})},"listenForAllEvents"),ee=n(e=>{if(!Ce){j.error("No root element to dispatch event on!");return}Ce.dispatchEvent(e)},"dispatch");var V=we(Ue());var ot={},ru=n((e,t)=>{ot[e]||(ot[e]=[]),ot[e].push(t)},"add"),nu=n(e=>{let t=ot[e];return t?(delete ot[e],t):[]},"getAll"),ou=n(e=>{var t;return((t=ot[e])==null?void 0:t.length)||0},"peekQueueSize"),it={add:ru,getAll:nu,peekQueueSize:ou};var Ur=n(()=>{let e=typeof window!="undefined"?window:global;return e.amediaUserCache||(e.amediaUserCache={})},"getStorage"),iu=n(e=>{let t=Ur()[e];return Promise.resolve(t)},"get"),su=n((e,t,r)=>(Ur()[e]={key:e,data:t,expires:r},Promise.resolve()),"set"),au=n(e=>(delete Ur()[e],Promise.resolve()),"remove"),uu=n(()=>((typeof window!="undefined"?window:global).amediaUserCache={},Promise.resolve()),"clear"),mo={get:iu,set:su,remove:au,clear:uu};var cu;var zt=n(()=>cu||mo,"getCacheEngine"),fu=n((e,t,r)=>zt().set(e,t,Date.now()+r),"set"),xr=n(e=>zt().remove(e),"remove"),lu=n((e,t)=>O(void 0,null,function*(){let r=yield zt().get(e);if(!r)return Promise.resolve();if(Date.now()>r.expires)return xr(e),Promise.resolve();try{return t.check(r.data)}catch(o){return j.error(o,{cacheData:r.data}),xr(e),Promise.resolve()}}),"get"),du=n(()=>zt().clear(),"clear"),ge={get:lu,set:fu,remove:xr,clear:du};var pu=n((e,t)=>!e||Array.isArray(t)?t:t?typeof e=="object"&&typeof t=="object"?ne(ne({},e),t):t:e,"mergeCache");function ye(e,t,r,o){return new Promise((a,d)=>{it.add(e,{resolve:a,reject:d}),!(it.peekQueueSize(e)>1)&&ge.get(e,t).then(p=>{if(p&&(!o||o(p))){it.getAll(e).forEach(m=>{m.resolve(p)});return}r().then(m=>{let g=p?pu(p,m.data):m.data;ge.set(e,g,m.ttl),it.getAll(e).forEach(S=>{S.resolve(m.data)})}).catch(()=>{it.getAll(e).forEach(m=>{m.reject()})})})})}n(ye,"getOrUpdate");var mu=(0,V.Record)({id:V.Number,domain:V.String}),vo=(0,V.Record)({status:(0,V.Literal)("success"),access:(0,V.Union)((0,V.Literal)("granted"),(0,V.Literal)("denied")),publication:mu,access_features:(0,V.Array)(V.String)}),vu=(0,V.Record)({status:(0,V.Literal)("success"),cookie:V.String,access_features:(0,V.Array)(V.String)}),hu=(0,V.Record)({status:(0,V.Literal)("success"),vstoken_cookie:V.String,uuid:V.String,access_features:(0,V.Array)(V.String)}),ho=n((e,t)=>ye("checkForAccess",vo,()=>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 o=vo.check(r);return{ttl:o.access==="granted"?1e3*10:0,data:o}}catch(o){throw j.error(o,{json:r}),o}})).then(r=>({access:r.access_features})),"checkForAccess"),go=n(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 vu.check(t)}catch(r){throw j.error(r,{json:t}),r}}),"getUserAccess"),yo=n(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 hu.check(t)}catch(r){throw j.error(r,{json:t}),r}}),"getNonUserAccess");var gt=class extends Error{};n(gt,"UserDeactivatedError");var gu=["no_session_found","subscription_not_found"],Eo=n(e=>O(void 0,null,function*(){return fetch(`/api/mercury/v2/access/activate?publication_wwwdomain=${le()}&access_features=${e.join(",")}`,{method:"post"}).then(t=>O(void 0,null,function*(){let r=yield t.text(),o;try{o=JSON.parse(r)}catch(a){j.error(`Activate subscription failed. Mercury (HTTP/${t.status}: ${r})`,{error:a,response:t,accessFeatures:e,body:r})}if(!t.ok){if((o==null?void 0:o.status)==="user_deactivated")throw new gt;return gu.includes(o==null?void 0:o.status)?[]:(j.error(`Activate subscription failed. Mercury (HTTP/${t.status}: ${r})`,{response:t,accessFeatures:e,body:r}),[])}return o==null?void 0:o.access_features}))}),"activateSubscription");var me=we(Ue());var wo=we(So()),je={},st={},yu=n(e=>{var t;(t=st[e])==null||t.forEach(r=>r(je[e]))},"emit"),Eu=n((e,t)=>{st[e]||(st[e]=[]),st[e].push(t)},"on"),Ro=n((e,t)=>{je[e]=t,yu(e)},"set"),bu=n((e,t)=>{Ro(e,(0,wo.default)(je[e]||{},t))},"merge"),_u=n(e=>je[e],"get"),Su=n(()=>{je.state=void 0,je.userAttributes=void 0,je.storage=void 0,Object.keys(st).forEach(e=>{st[e]=[]})},"clear"),Q={merge:bu,set:Ro,get:_u,on:Eu,clear:Su};var wu=["avbrutt","kansellert","cancelled","aborted","failed to fetch","abgebrochen","the operation was aborted."],Co=n(e=>wu.includes(e.toLowerCase().trim()),"isAbortedNetworkError");var Ao=(0,me.Partial)({user_uuid:me.String,user_name:me.String,tracking_key:me.String}),Ru=n(e=>({uuid:e.user_uuid,name:e.user_name,trackingKey:e.tracking_key}),"mapSessionToUserAttributes"),Cu=(0,me.Record)({code:me.String}),Au=(0,me.Record)({errors:(0,me.Array)(Cu)}),Tu=["session.not_found","session.not_specified","user.deactivated"],Ou=["session.invalid_for_domain","user.not_found"],Lr=n(e=>O(void 0,null,function*(){let t,r=e.clone();try{[t]=Au.check(yield e.json()).errors}catch(o){return Co(o==null?void 0:o.message)?Promise.resolve():(j.warn("Unable to parse error body from pluto",{error:o,response:r}),Promise.reject(o))}return Tu.includes(t==null?void 0:t.code)?Promise.resolve():Ou.includes(t==null?void 0:t.code)?(j.warn(`Pluto responded with HTTP/${e.status}: (${t.code}) while fetching current session`,{error:t,response:e}),Promise.resolve()):(j.error(`Pluto responded with HTTP/${e.status}: ${e.statusText}) when fetching current session`,{error:t,response:e}),Promise.reject())}),"resolveBadPlutoResponse"),Iu=n(()=>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:Ao.check(e)}}catch(r){return j.error(r,{json:e}),t}}),"fetchCurrentSession"),To=n(()=>O(void 0,null,function*(){return ye("getCurrentSession",Ao,Iu).then(e=>(Q.merge("state",{isLoggedIn:e.user_uuid!==void 0}),Ru(e)))}),"getCurrentSession"),Oo=n(e=>O(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}`)}Q.merge("state",{isLoggedIn:!1})})}),"removeSession");var Fr,Qt=self||window,Io=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof Qt.msCrypto!="undefined"&&typeof Qt.msCrypto.getRandomValues=="function"&&Qt.msCrypto.getRandomValues.bind(Qt.msCrypto);if(Io){let e=new Uint8Array(16);Fr=n(function(){return Io(e),e},"whatwgRNG")}else{let e=new Array(16);Fr=n(function(){for(let r=0,o;r<16;r+=1)(r&3)==0&&(o=Math.random()*4294967296),e[r]=o>>>((r&3)<<3)&255;return e},"mathRNG")}var No=[];for(let e=0;e<256;++e)No[e]=(e+256).toString(16).substr(1);function Nu(e,t){let r=t||0,o=No;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]]].join("")}n(Nu,"bytesToUuid");function Po(){let e=Fr();return e[6]=e[6]&15|64,e[8]=e[8]&63|128,Nu(e)}n(Po,"uuid");function Pu(){let e,t,r=!1;return{promise:new Promise((a,d)=>{e=n(p=>{r||a(p),r=!0},"resolve"),t=n(p=>{r||d(p),r=!0},"reject")}),resolve:e,reject:t}}n(Pu,"createPromise");function Uu(e,t){return(...r)=>{let{resolve:o,reject:a,promise:d}=Pu(),p=Po(),m={eventId:p,args:r},g=new CustomEvent(`amedia-rpc-event:${e}:${t}`,{detail:m});if(self.dispatchEvent(g),self.amediaNativeBridge){let S=JSON.stringify(r);self.amediaNativeBridge.callNativeMethod(e,t,S,p)}return self.addEventListener(`amedia-rpc-event:${e}:${t}:${p}`,S=>{S.detail||o();let{error:w,result:C}=S.detail;return w?a(w):o(C)}),d}}n(Uu,"createMethod");var yt=class{constructor({version:t,component:r,methods:o=[]}){this.component=r,this.version=t,this.queue=[],o.forEach(a=>this.addMethod(a)),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,o]=t.detail.version.split(".").map(m=>parseInt(m,10)),[a,d]=this.version.split(".").map(m=>parseInt(m,10));if(r!==a)throw new Error(`${this.component} version mismatch. Server version: ${r}. Client version: ${a}`);o<d&&console.warn(`${this.component} server version is on an earlier minor version (${o}) than the client (${d})`);let p=this.queue.slice(0);delete this.queue,p.forEach(m=>m()),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 o,a,d=new Promise((p,m)=>{o=p,a=m});return this.queue.push(()=>this[t](...r).then(o).catch(a)),d}return this[t]=Uu(this.component,t),this[t](...r)}}};n(yt,"RPCclient");var Jt,Uo=n(()=>Jt||(Jt=new yt({version:"1.0.0",component:"userdata-session",methods:["userAuthenticated"]}),Jt),"getRPCClient");var xu=n((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},"getCookieValue"),De=n(e=>{let t=`${e}=`,r=document.cookie.split(";");for(let o=r.length-1;o>=0;o-=1){let a=r[o].trim();if(a.indexOf(t)===0)return xu(t,a)}return null},"getCookie"),Du=n((e,t)=>t?t instanceof Date?`; expires=${t.toUTCString()}`:(e.setTime(e.getTime()+t*24*60*60*1e3),`; expires=${e.toUTCString()}`):"","setValidTime"),Lu=n(e=>!e||e===""?"":e instanceof Object?encodeURIComponent(JSON.stringify(e)):typeof e=="number"?e.toString(10):e,"setValue");function qe(e,t,r=Date.now(),o="/",a=!1){let d=new Date,p=`${e}=`;return(!t||t==="")&&(r=-1),p+=Lu(t),p+=Du(d,r),p+=`; path=${o}`,a&&(p+="; secure"),document.cookie=p,r&&r!==-1&&De(e)===null&&(document.cookie=p.replace(/; expires=[^;]*/,"")),p}n(qe,"setCookie");function Ee(e){qe(e)}n(Ee,"removeCookie");var xo=n(()=>window.location.reload(),"reload"),Do=n(e=>window.location.replace(e),"replace"),Xt=n(e=>{window.location.href=e},"navigateTo");var Lo=n(e=>{let t=new URL(`https://${Ke()}/aid/logg_inn/${le()}/`);t.searchParams.set("requestedUrl",e instanceof URL?e.href:e),Xt(t.href)},"login");function Fu(){Ee("VSTOKEN"),Ee("aid.session"),Ee("aid_invitation_code"),Ee("aid-reload-article")}n(Fu,"clearCookies");var Zt=n(()=>O(void 0,null,function*(){return Promise.all([Oo(le()),ge.clear()]).then(()=>{Uo().userAuthenticated(!1),Fu(),Ee("VSTOKEN2")}).catch(e=>{j.error("Failure while logging out",e)})}),"logout"),er=n(()=>To(),"getSession");var Fo=n((e=["newspaper"])=>ho(le(),e),"getAccess"),tr=n(e=>O(void 0,null,function*(){try{return yield Eo(e)}catch(t){if(t instanceof gt)return yield Zt(),[];throw t}}),"activate"),Et=n((e,t)=>t.length<1||t.filter(r=>e.includes(r)).length>0,"hasAccess"),rr=n(e=>O(void 0,null,function*(){let t=yield go(e);return t.status==="success"&&qe("VSTOKEN",t.cookie,365,"/"),{success:t.status==="success",accessFeatures:t.access_features}}),"setUserAccessCookie"),nr=n(e=>O(void 0,null,function*(){let t=yield yo(e);return t.status==="success"&&qe("VSTOKEN2",t.vstoken_cookie,1,"/"),{success:t.status==="success",accessFeatures:t.access_features}}),"setNonUserAccessCookie"),ko=n(e=>O(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((o,a)=>({success:o.success&&a.success,accessFeatures:o.accessFeatures.concat(a.accessFeatures).filter((d,p,m)=>m.indexOf(d)===p).sort()}),{success:!0,accessFeatures:[]}))}),"setAccessCookies"),jo=n(e=>{let t=new Date;t.setTime(t.getTime()+2*60*1e3),qe("aid-paywall-reload-performed",e||Re(),t)},"setHasPerformedPaywallReload"),qo=n(e=>De("aid-paywall-reload-performed")===(e||Re()),"hasRecentlyPerformedPaywallReload");var Me;(function(r){r.REQUEST_ACTIVATION="amedia-user.activation.request-activation",r.ON_ACTIVATION_COMPLETE="amedia-user.activation.on-activation-complete"})(Me||(Me={}));var ku=n(()=>{ve(Me.REQUEST_ACTIVATION,e=>{tr(e.detail.accessFeatures).then(t=>{ee(new CustomEvent(Me.ON_ACTIVATION_COMPLETE,{detail:{accessFeatures:t}}))})})},"listenForActivationRequests");ku();var K;(function(m){m.REQUEST_STATE="amedia-user.request-state",m.REQUEST_USER_ATTRIBUTES="amedia-user.request-user-attributes",m.REQUEST_STORAGE_NAMESPACES="amedia-user.request-storage-namespaces",m.UPDATE_STORAGE="amedua-user.update-storage-namespaces",m.ON_ATTRIBUTES_UPDATED="amedia-user.on-user-attributes-updated",m.ON_STATE_UPDATED="amedia-user.on-state-updated",m.ON_STORAGE_UPDATED="amedia-user.on-storage-updated"})(K||(K={}));var bt=n((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),o=Object.keys(t);if(r.length!==o.length)return!1;for(let a of r){if(!o.includes(a))return!1;if(typeof e[a]=="function"||typeof t[a]=="function"){if(e[a].toString()!==t[a].toString())return!1}else if(!bt(e[a],t[a]))return!1}return!0},"deepEquals");function Mo(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}n(Mo,"isMissingData");var at=class{constructor(t,r){this.attributes=t;this.namespaces=r}withAttributes(t){return new at([...this.attributes||[],...t],this.namespaces)}withStorage(t){return new at(this.attributes,[...this.namespaces||[],...t])}subscribe(t){let r=this.setupLocalCache();He(K.ON_STATE_UPDATED,o=>{let a=o.detail;Object.keys(r.state).length>0&&bt(r.state,a)||(r=ce(ne({},r),{state:a}),t(r))}),ee(new CustomEvent(K.REQUEST_STATE)),Array.isArray(this.attributes)&&this.attributes.length>0&&(He(K.ON_ATTRIBUTES_UPDATED,o=>{let a=this.processUserAttributesEvent(o);Object.keys(r.attributes).length>0&&bt(r.attributes,a)||(r=ce(ne({},r),{attributes:a}),t(r))}),ee(new CustomEvent(K.REQUEST_USER_ATTRIBUTES,{detail:this.attributes}))),Array.isArray(this.namespaces)&&this.namespaces.length>0&&(He(K.ON_STORAGE_UPDATED,o=>{let a=this.processStorageEvent(o);bt(r.storage,a)||(r=ce(ne({},r),{storage:a}),t(r))}),ee(new CustomEvent(K.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}Mo(this.attributes,r.attributes)||Mo(this.namespaces,r.storage)||t(r)}})})}processUserAttributesEvent(t){let r=t.detail;return this.attributes.reduce((a,d)=>(r[d]!==void 0&&(a[d]=r[d]),a),{})}processStorageEvent(t){let r=t.detail;return this.namespaces&&this.namespaces.reduce((o,a)=>(r[a]!==void 0&&(o[a]=r[a]),o),{})}setupLocalCache(){let t={state:{}};return this.attributes&&this.attributes.length>0&&(t.attributes={}),this.namespaces&&this.namespaces.length>0&&(t.storage={}),t}};n(at,"UserDataRequest");var be=at;var Bo="jupiter";function ju(){return O(this,null,function*(){let e="VSTOKEN",t=le(),r=De(e),o=!1;new be().withAttributes(["uuid"]).subscribe(p=>O(this,[p],function*({attributes:a,state:d}){if(d.isLoggedIn===!1){typeof r=="string"&&Ee(e);return}if(!a.uuid||d.isLoggedIn===void 0||o)return;if(o=!0,typeof r!="string"){yield rr(t);return}let m=r.split(":"),g=new Date(parseInt(m[1],10)*1e3);g.setDate(g.getDate()-1),!(g.getTime()>Date.now()&&m[3]===a.uuid&&t.includes(m[4])&&m[5]===Bo)&&(yield rr(t))}))})}n(ju,"verifyAndSetUserAccessCookie");function qu(){let e="VSTOKEN2",t=le(),r=De(e);new be().fetch().then(a=>O(this,[a],function*({state:{isLoggedIn:o}}){if(o){if(typeof r!="string"){yield nr(t);return}let d=r.split(":"),p=new Date(parseInt(d[1],10)*1e3);if(p.setMinutes(p.getMinutes()-30),p.getTime()>Date.now()&&t.includes(d[4])&&d[5]===Bo)return;yield nr(t)}else Ee(e)})).then(()=>{})}n(qu,"verifyAndSetNonUserAccessCookie");function kr(){return Promise.all([ju(),qu()])}n(kr,"accessCookieRefresher");function $o(){new be().subscribe(({state:e})=>{e.isLoggedIn===!1&&(Q.set("userAttributes",{}),Q.set("storage",{}))})}n($o,"removeUserStorage");var Be=we(Ue());var Vo="haveTriedThirdPartyLoginCheck",Mu=60*60*1e3,Bu=(0,Be.Record)({user_name:Be.String,tracking_key:Be.String}),$u=n(()=>fetch(`https://${Ke()}/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 Bu.check(e)}catch(t){return j.error(t,{data:e}),null}}),"getAidSession");function jr(){return O(this,null,function*(){return(yield ge.get(Vo,Be.Boolean))?!1:(yield ge.set(Vo,!0,Mu),!!(yield $u()))})}n(jr,"thirdPartyCookie");var qr="has-tried-autologin",Go=6e4;function Vu(){try{return window.self!==window.top}catch(e){return!0}}n(Vu,"inIframe");function Gu(){let e=De(qr);if(e&&typeof e!="object")try{if(Date.now()-parseInt(e,10)<Go)return!0}catch(t){Ee(qr)}return qe(qr,Date.now(),Date.now()+Go),!1}n(Gu,"hasAlreadyAttemptedAutoLogin");var Yo=n(e=>O(void 0,null,function*(){if(Vu())return;let{state:{isLoggedIn:t}}=yield new be().fetch();if(!t){for(let r of e)if(!(yield r.handler().then(a=>{if(a){if(Gu())return!1;let d=new URL(`https://${Ke()}/aid/logg_inn/auto`);return d.searchParams.set("context",`auto_login_${r.name}`),d.searchParams.set("requestedUrl",Re()),Xt(d.href),!1}return!0})))return}}),"attemptAutologin"),Wo=n(()=>O(void 0,null,function*(){return Yo([{name:"third_party",handler:jr}])}),"attemptAutoLoginJob"),Ko=n(()=>O(void 0,null,function*(){return Yo([{name:"paywall",handler:()=>Promise.resolve(!0)}])}),"attemptPaywallAutoLogin");var Yu=[Wo,kr,$o];function Wu(){return O(this,null,function*(){for(let e of Yu)yield e()})}n(Wu,"performJobs");var or;(function(t){t.LOADED="amedia-user.janitor.loaded"})(or||(or={}));var Ho=n(()=>O(void 0,null,function*(){let e=!1;ve(or.LOADED,()=>{e||(e=!0,Wu())}),ee(new CustomEvent(or.LOADED))}),"runJanitor");var zo=n(()=>{ve(K.REQUEST_STATE,()=>{let e=Q.get("state");e&&Object.keys(e).length>0&&ee(new CustomEvent(K.ON_STATE_UPDATED,{detail:e})),Q.on("state",t=>{ee(new CustomEvent(K.ON_STATE_UPDATED,{detail:t}))})})},"listenForStateRequests");var sr=we(Jo()),_t=we(ei());var Br,ir=typeof self=="undefined"?window:self,ti=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(ti){let e=new Uint8Array(16);Br=n(function(){return ti(e),e},"whatwgRNG")}else{let e=new Array(16);Br=n(function(){for(let r=0,o;r<16;r+=1)(r&3)==0&&(o=Math.random()*4294967296),e[r]=o>>>((r&3)<<3)&255;return e},"mathRNG")}var ri=[];for(let e=0;e<256;++e)ri[e]=(e+256).toString(16).substr(1);function Ku(e,t){let r=t||0,o=ri;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]]].join("")}n(Ku,"bytesToUuid");function $r(){let e=Br();return e[6]=e[6]&15|64,e[8]=e[8]&63|128,Ku(e)}n($r,"uuid");function ni(e){let t=!1;return(...r)=>{t||(e.apply(this,r),t=!0,setTimeout(()=>{t=!1},400))}}n(ni,"throttle");sr.default.config({name:"aid:userdata"});var oi=self.location.hostname.replace(/(.*\.)([^.]+\.\w+$)/,"$2");function ii(){let e=_t.default.get("amedia:fpbid");return e||(e=$r(),_t.default.set("amedia:fpbid",e,{expires:365*10,domain:oi,sameSite:"strict"})),Promise.resolve(e)}n(ii,"getBrowserId");function Hu(){let e=_t.default.get("amedia:visitid");return e?Promise.resolve(e):sr.default.getItem("visitid")}n(Hu,"getVisitIdFromStorage");function si(e){return _t.default.set("amedia:visitid",e,{expires:new Date(Date.now()+18e5),domain:oi,sameSite:"strict"}),sr.default.setItem("visitid",e).then(()=>e)}n(si,"storeVisitId");function ai(){let e=Date.now(),t=`${$r()}|${e}`;return si(t)}n(ai,"createVisitId");function zu(){return Hu().then(e=>e||ai()).then(e=>{let[t,r]=e.split("|");return!t||r&&Date.now()-18e5>r?ai():si(`${t}|${Date.now()}`)}).catch(e=>console.error(e))}n(zu,"refreshVisitId");typeof window!="undefined"&&["mousedown","keydown","mousemove","focus","scroll","resize","seshat-video-active","touchmove","deviceorientation"].forEach(e=>window.addEventListener(e,ni(zu)));var $e=we(Ue());var Le=we(Ue());var ui=5*6e4,ci=(0,Le.Record)({namespaces:(0,Le.Dictionary)(Le.Unknown,Le.String)});var fi=n((e,t="GET",r)=>fetch(e,{method:t,body:r&&JSON.stringify(r),headers:{"Content-Type":"application/json",Accept:"application/json"}}),"doFetch"),Qu=n((e,t)=>O(void 0,null,function*(){let r=yield ge.get("europa",ci),o=r?ce(ne({},r),{namespaces:ce(ne({},r.namespaces),{[e]:t})}):{namespaces:{[e]:t}};return ge.set("europa",o,Date.now()+ui)}),"updateNamespaceInCache"),li=n((e,t)=>O(void 0,null,function*(){let r=yield fi(`/api/europa/v1/me/${e}`,"PATCH",t);return r.ok?Qu(e,t):(j.error(`Could not get namespace: ${e}, status: ${r.status}, statusText: ${r.statusText}`,r),{})}),"updateNamespace"),ar=n((r,...o)=>O(void 0,[r,...o],function*(e,t={ignoreCache:!1}){if(e.length===0)throw new Error("namespaces array cannot be of length 0");return ye("europa",ci,()=>fi(`/api/europa/v1/me/${e.join(",")}`).then(a=>O(void 0,null,function*(){let d=yield a.text();return a.ok?JSON.parse(d):(a.status!==400&&j.error(`Could not get namespaces for: ${e}, status: ${a.status}`,{response:a,body:d}),{namespaces:{}})})).then(a=>({ttl:ui,data:a})),a=>!t.ignoreCache||Object.keys(a.namespaces).filter(d=>!Object.keys(e).includes(d)).length===0).then(a=>a.namespaces)}),"getNamespaces");var Ju=5*6e4,Xu="privacyPreferences",Zu=(0,$e.Record)({allowResearchUsage:$e.Boolean,connectWithSurveys:$e.Boolean,personalizedAds:$e.Boolean,personalizedContent:$e.Boolean}),ur=n(e=>e==="true"||e===!0,"toBoolean"),di=n(()=>O(void 0,null,function*(){return ye(Xu,Zu,()=>ar(["privacy_preferences"]).then(e=>{let t=e.privacy_preferences;return{ttl:Ju,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}))}),"getPrivacyPreferences");var B=we(Ue());var pi=(0,B.Dictionary)(B.Unknown,B.String).And((0,B.Partial)({ad_segments:B.String,ad_segments_user:B.String,amedia_employee:B.Boolean,amedia_employee_user:B.Boolean,age:B.Number,age_user:B.Number,birth_year:B.String,birth_year_user:B.String,gender:B.String,gender_user:B.String,grunnkrets:B.String,grunnkrets_user:B.String,postcode:B.String,postcode_user:B.String,shared_account:B.Boolean,shared_account_user:B.Boolean,user_grouping_number:B.String,user_grouping_number_user:B.String})),ec=n((e,t,r)=>{let o=new URL("https://services.gcloud.api.no/api/nebula/v1/info");return o.searchParams.set("domain",e),o.searchParams.set("browser_id",t),r&&o.searchParams.set("user_key",r),fetch(o.href).then(a=>a.json()).then(a=>{try{return{ttl:1e3*60*60*5,data:pi.check(a)}}catch(d){throw j.error(d,{json:a}),d}})},"getNebulaData"),tc=n(e=>({extraData:e}),"mapNebulaToUserData"),mi=n((e,t,r)=>ye("getNebulaInfo",pi,()=>ec(e,t,r)).then(tc),"getInfo");var Vr=n(()=>new Promise(e=>{var r;let t=(r=Q.get("state"))==null?void 0:r.isLoggedIn;if(t===!1||t===!0){e(t);return}Q.on("state",({isLoggedIn:o})=>{(o===!1||o===!0)&&e(o)})}),"whenLoginStateResolved"),ut=n(()=>new Promise(e=>Vr().then(t=>{t&&e()})),"whenIsLoggedIn");var rc=n(()=>Promise.all([ii(),Vr()]).then(([e,t])=>{var r;return mi(window.location.hostname,e,t?(r=Q.get("userAttributes"))==null?void 0:r.trackingKey:void 0)}),"getExtraData"),nc={uuid:er,name:er,trackingKey:er,access:()=>ut().then(()=>Fo()),extraData:rc,privacyPreferences:()=>ut().then(()=>di())},vi=n(e=>{let t=[];e.forEach(o=>{let a=nc[o];if(!a){j.warn(`Unknown attribute ${o} was requested`);return}t.includes(a)||t.push(a)});let r=[];return t.forEach(o=>{r.push(o().then(a=>{Q.merge("userAttributes",a)}).catch(a=>{j.warn(`User attribute call failed (${o.toString()})`,a)}))}),Promise.all(r).then(()=>{})},"requestAttributes");var hi=n(()=>{Q.on("userAttributes",e=>{ee(new CustomEvent(K.ON_ATTRIBUTES_UPDATED,{detail:e}))}),ve(K.REQUEST_USER_ATTRIBUTES,e=>{let t=e.detail,r=Q.get("userAttributes")||{};Object.keys(r).length>0&&ee(new CustomEvent(K.ON_ATTRIBUTES_UPDATED,{detail:r}));let o=t.filter(a=>r[a]===void 0);o.length>0&&vi(o)})},"listenForUserAttributeRequests");var gi=n(e=>{ar(e).then(t=>{Q.merge("storage",t)})},"requestStorage"),yi=n(e=>Object.keys(e).forEach(t=>li(t,e[t])),"updateStorage");var Ei=n(()=>{Q.on("storage",e=>{ee(new CustomEvent(K.ON_STORAGE_UPDATED,{detail:e}))}),ve(K.REQUEST_STORAGE_NAMESPACES,e=>{ut().then(()=>{let t=e.detail,r=Q.get("storage")||{};Object.keys(r).length>0&&ee(new CustomEvent(K.ON_STORAGE_UPDATED,{detail:r}));let o=t.filter(a=>r[a]===void 0);o.length>0&&gi(o)})}),ve(K.UPDATE_STORAGE,e=>{ut().then(()=>{yi(e.detail)})})},"listenForStorageRequests");var ct=class extends Error{constructor(t,r){super(t);this.code=r}};n(ct,"PaywallError"),ct.ERROR_RELOADED_NO_ACCESS="RELOADED_NO_ACCESS",ct.ERROR_ENABLING_ACCESS_FAILED="ENABLING_ACCESS_FAILED",ct.ERROR_NO_ACCESS_AFTER_SUCCESSFUL_ACTIVATION_WITH_REQUESTED_ACCESS_FEATURES="NO_ACCESS_AFTER_SUCCESSFUL_ACTIVATION_WITH_REQUESTED_ACCESS_FEATURES";var Ve=ct;var Gr=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 O(this,null,function*(){let{state:{isLoggedIn:t}}=yield new be().withAttributes(["name"]).fetch();if(!t)return yield Ko(),{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 Ve("New subscription was attached and checked successfully, but internal systems disagree about current newspaper access.",Ve.ERROR_NO_ACCESS_AFTER_SUCCESSFUL_ACTIVATION_WITH_REQUESTED_ACCESS_FEATURES)}if(this.reload||this.requestedUrl){if(qo(this.requestedUrl))throw new Ve("Unlock check already performed.",Ve.ERROR_RELOADED_NO_ACCESS);jo(this.requestedUrl),this.reload&&xo(),this.requestedUrl&&Do(this.requestedUrl)}return{isLoggedIn:!0,hasAccess:!0,accessFeatures:r.accessFeatures}})}setAccessCookiesAndGetAccessFeatures(t){return ko(le()).then(r=>{let o=!Et(r.accessFeatures,t);if(!r.success&&o)throw new Ve("Could not set access cookies",Ve.ERROR_ENABLING_ACCESS_FAILED);return{denied:o,accessFeatures:r.accessFeatures}})}activateAccess(t){return O(this,null,function*(){let r=yield tr(this.requestedAccessFeatures);return{denied:!Et(r,t),accessFeatures:r}})}};n(Gr,"PaywallUnlockRequest");var bi=Gr;var oc=n(e=>Lo(e||Re()),"goToLoginPage"),ic=n(()=>Zt(),"logout"),sc=n(e=>new Promise(t=>{He(Me.ON_ACTIVATION_COMPLETE,r=>{let o=r.detail.accessFeatures;t({hasAccess:Et(o,e),accessFeatures:o})}),ee(new CustomEvent(Me.REQUEST_ACTIVATION,{detail:{accessFeatures:e}}))}),"tryActivateSubscriptionAccess"),ac=n(e=>{ee(new CustomEvent(K.UPDATE_STORAGE,{detail:e}))},"updateStorage");typeof process=="undefined"&&(zo(),hi(),Ei(),Ho());
2
2
  /*!
3
3
  localForage -- Offline Storage, Improved
4
4
  Version 1.9.0