@amedia/user 0.13.24 → 0.13.25
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.esm.js +1 -1
- package/dist/index.esm.js.map +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
- package/src/index.ts +4 -8
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Ss=Object.create;var We=Object.defineProperty,ws=Object.defineProperties,Rs=Object.getOwnPropertyDescriptor,Cs=Object.getOwnPropertyDescriptors,Ts=Object.getOwnPropertyNames,mn=Object.getOwnPropertySymbols,As=Object.getPrototypeOf,vn=Object.prototype.hasOwnProperty,Os=Object.prototype.propertyIsEnumerable;var hn=(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={}))vn.call(t,r)&&hn(e,r,t[r]);if(mn)for(var r of mn(t))Os.call(t,r)&&hn(e,r,t[r]);return e},ce=(e,t)=>ws(e,Cs(t)),gn=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),Is=(e,t)=>{gn(e);for(var r in t)We(e,r,{get:t[r],enumerable:!0})},Ns=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ts(t))!vn.call(e,o)&&o!=="default"&&We(e,o,{get:()=>t[o],enumerable:!(r=Rs(t,o))||r.enumerable});return e},we=e=>Ns(gn(We(e!=null?Ss(As(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 p=g=>{try{m(r.next(g))}catch(S){a(S)}},d=g=>{try{m(r.throw(g))}catch(S){a(S)}},m=g=>g.done?o(g.value):Promise.resolve(g.value).then(p,d);m((r=r.apply(e,t)).next())});var _n=D(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0})});var br=D(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.Failcode=void 0;At.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 qs=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 p in a)Object.prototype.hasOwnProperty.call(a,p)&&(o[p]=a[p])},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 Ms=function(e){qs(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=Ms});var Ot=D(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});var Ee=n(function(e,t){return function(r){var o=n(function(d){return e?"("+d+")":d},"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""+Sn(r)+Ee(!0,t)(r.element)+"[]";case"dictionary":return"{ [_: "+r.key+"]: "+Ee(!1,t)(r.value)+" }";case"record":{var p=Object.keys(r.fields);return p.length?"{ "+p.map(function(d){return""+Sn(r)+d+Bs(r,d)+": "+(r.fields[d].tag==="optional"?Ee(!1,t)(r.fields[d].underlying):Ee(!1,t)(r.fields[d]))+";"}).join(" ")+" }":"{}"}case"tuple":return"["+r.components.map(Ee(!1,t)).join(", ")+"]";case"union":return o(""+r.alternatives.map(Ee(!0,t)).join(" | "));case"intersect":return o(""+r.intersectees.map(Ee(!0,t)).join(" & "));case"optional":return Ee(e,t)(r.underlying)+" | undefined";case"constraint":return r.name||Ee(e,t)(r.underlying);case"instanceof":return r.ctor.name;case"brand":return Ee(e,t)(r.entity)}}finally{t.delete(r)}throw Error("impossible")}},"show");_r.default=Ee(!1,new Set);function Bs(e,t){var r=e.isPartial,o=e.fields;return r||t!==void 0&&o[t].tag==="optional"?"?":""}n(Bs,"partialTag");function Sn(e){var t=e.isReadonly;return t?"readonly ":""}n(Sn,"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 be=br(),Je=Ot();function $s(e,t){return typeof t=="object"&&t!==null&&e in t}n($s,"hasKey");M.hasKey=$s;var Vs=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=Vs;var Gs=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=Gs;function Ys(e){return{success:!0,value:e}}n(Ys,"SUCCESS");M.SUCCESS=Ys;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(be.Failcode.TYPE_INCORRECT,r)},VALUE_INCORRECT:function(e,t,r){return M.FAILURE(be.Failcode.VALUE_INCORRECT,"Expected "+e+" "+String(t)+", but was "+String(r))},KEY_INCORRECT:function(e,t,r){return M.FAILURE(be.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(be.Failcode.CONTENT_INCORRECT,r,t)},ARGUMENT_INCORRECT:function(e){return M.FAILURE(be.Failcode.ARGUMENT_INCORRECT,e)},RETURN_INCORRECT:function(e){return M.FAILURE(be.Failcode.RETURN_INCORRECT,e)},CONSTRAINT_FAILED:function(e,t){var r=t?": "+t:"";return M.FAILURE(be.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(be.Failcode.PROPERTY_MISSING,t)},PROPERTY_PRESENT:function(e){var t="Expected nothing, but was "+M.typeOf(e);return M.FAILURE(be.Failcode.PROPERTY_PRESENT,t)},NOTHING_EXPECTED:function(e){var t="Expected nothing, but was "+M.typeOf(e);return M.FAILURE(be.Failcode.NOTHING_EXPECTED,t)}})});var wn=D(Ie=>{"use strict";var Ws=Ie&&Ie.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),a,p=[],d;try{for(;(t===void 0||t-- >0)&&!(a=o.next()).done;)p.push(a.value)}catch(m){d={error:m}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(d)throw d.error}}return p},Ks=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.Contract=void 0;var Hs=Qe(),zs=z();function Qs(){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(p){return function(){for(var d=[],m=0;m<arguments.length;m++)d[m]=arguments[m];if(d.length<o.length){var g="Expected "+o.length+" arguments but only received "+d.length,S=zs.FAILURE.ARGUMENT_INCORRECT(g);throw new Hs.ValidationError(S)}for(var w=0;w<o.length;w++)o[w].check(d[w]);return a.check(p.apply(void 0,Ks([],Ws(d))))}}}}n(Qs,"Contract");Ie.Contract=Qs});var Tn=D(Ne=>{"use strict";var Js=Ne&&Ne.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),a,p=[],d;try{for(;(t===void 0||t-- >0)&&!(a=o.next()).done;)p.push(a.value)}catch(m){d={error:m}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(d)throw d.error}}return p},Xs=Ne&&Ne.__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(Ne,"__esModule",{value:!0});Ne.AsyncContract=void 0;var Rn=Qe(),Cn=z();function Zs(){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(p){return function(){for(var d=[],m=0;m<arguments.length;m++)d[m]=arguments[m];if(d.length<o.length){var g="Expected "+o.length+" arguments but only received "+d.length,S=Cn.FAILURE.ARGUMENT_INCORRECT(g);throw new Rn.ValidationError(S)}for(var w=0;w<o.length;w++)o[w].check(d[w]);var C=p.apply(void 0,Xs([],Js(d)));if(!(C instanceof Promise)){var g="Expected function to return a promise, but instead got "+C,S=Cn.FAILURE.RETURN_INCORRECT(g);throw new Rn.ValidationError(S)}return C.then(a.check)}}}}n(Zs,"AsyncContract");Ne.AsyncContract=Zs});var An=D(Pe=>{"use strict";var ea=Pe&&Pe.__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.")},ta=Pe&&Pe.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),a,p=[],d;try{for(;(t===void 0||t-- >0)&&!(a=o.next()).done;)p.push(a.value)}catch(m){d={error:m}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(d)throw d.error}}return p};Object.defineProperty(Pe,"__esModule",{value:!0});Pe.match=void 0;function ra(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(r){var o,a;try{for(var p=ea(e),d=p.next();!d.done;d=p.next()){var m=ta(d.value,2),g=m[0],S=m[1];if(g.guard(r))return S(r)}}catch(w){o={error:w}}finally{try{d&&!d.done&&(a=p.return)&&a.call(p)}finally{if(o)throw o.error}}throw new Error("No alternatives were matched")}}n(ra,"match");Pe.match=ra});var J=D(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.innerValidate=Xe.create=void 0;var Ue=xe(),na=Ot(),oa=Qe(),ia=z();function sa(e,t){return t.check=r,t.assert=r,t._innerValidate=function(C,h){return h.has(C,t)?ia.SUCCESS(C):e(C,h)},t.validate=function(C){return t._innerValidate(C,ua())},t.guard=o,t.Or=a,t.And=p,t.optional=d,t.nullable=m,t.withConstraint=g,t.withGuard=S,t.withBrand=w,t.reflect=t,t.toString=function(){return"Runtype<"+na.default(t)+">"},t;function r(C){var h=t.validate(C);if(h.success)return h.value;throw new oa.ValidationError(h)}n(r,"check");function o(C){return t.validate(C).success}n(o,"guard");function a(C){return Ue.Union(t,C)}n(a,"Or");function p(C){return Ue.Intersect(t,C)}n(p,"And");function d(){return Ue.Optional(t)}n(d,"optional");function m(){return Ue.Union(t,Ue.Null)}n(m,"nullable");function g(C,h){return Ue.Constraint(t,C,h)}n(g,"withConstraint");function S(C,h){return Ue.Constraint(t,C,h)}n(S,"withGuard");function w(C){return Ue.Brand(C,t)}n(w,"withBrand")}n(sa,"create");Xe.create=sa;function aa(e,t,r){return e._innerValidate(t,r)}n(aa,"innerValidate");Xe.innerValidate=aa;function ua(){var e=new WeakMap,t=n(function(o,a){if(!(o===null||typeof o!="object")){var p=e.get(o);e.set(o,p?p.set(a,!0):new WeakMap().set(a,!0))}},"add"),r=n(function(o,a){var p=e.get(o),d=p&&p.get(a)||!1;return t(o,a),d},"has");return{has:r}}n(ua,"VisitedState")});var Nt=D(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.Unknown=void 0;var ca=J(),fa=z(),la={tag:"unknown"};It.Unknown=ca.create(function(e){return fa.SUCCESS(e)},la)});var On=D(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.Never=void 0;var da=J(),pa=z(),ma={tag:"never"};Pt.Never=da.create(pa.FAILURE.NOTHING_EXPECTED,ma)});var In=D(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.Void=void 0;var va=Nt();Ut.Void=va.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 ha(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=n(function(){for(var a=[],p=0;p<arguments.length;p++)a[p]=arguments[p];return function(d){for(var m=0;m<e.length;m++)if(e[m].guard(d))return a[m](d)}},"match"),o={tag:"union",alternatives:e,match:r};return Dt.create(function(a,p){var d,m,g,S,w,C,h,T;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,p).success)return mt.SUCCESS(a)}}catch(re){d={error:re}}finally{try{L&&!L.done&&(m=P.return)&&m.call(P)}finally{if(d)throw d.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,p)}}}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 k=xt(e),H=k.next();!H.done;H=k.next()){var oe=H.value;if(Dt.innerValidate(oe,a,p).success)return mt.SUCCESS(a)}}catch(re){h={error:re}}finally{try{H&&!H.done&&(T=k.return)&&T.call(k)}finally{if(h)throw h.error}}return mt.FAILURE.TYPE_INCORRECT(o,a)},o)}n(ha,"Union");Ze.Union=ha});var Un=D(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.Nullish=me.Null=me.Undefined=me.Literal=void 0;var ga=J(),Nn=z(),ya=wr();function Pn(e){return Array.isArray(e)?String(e.map(String)):typeof e=="bigint"?String(e)+"n":String(e)}n(Pn,"literal");function Rr(e){var t={tag:"literal",value:e};return ga.create(function(r){return r===e?Nn.SUCCESS(r):Nn.FAILURE.VALUE_INCORRECT("literal","`"+Pn(e)+"`","`"+Pn(r)+"`")},t)}n(Rr,"Literal");me.Literal=Rr;me.Undefined=Rr(void 0);me.Null=Rr(null);me.Nullish=ya.Union(me.Null,me.Undefined)});var Ln=D(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.Boolean=void 0;var Ea=J(),xn=z(),Dn={tag:"boolean"};Lt.Boolean=Ea.create(function(e){return typeof e=="boolean"?xn.SUCCESS(e):xn.FAILURE.TYPE_INCORRECT(Dn,e)},Dn)});var jn=D(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.Number=void 0;var ba=J(),kn=z(),Fn={tag:"number"};kt.Number=ba.create(function(e){return typeof e=="number"?kn.SUCCESS(e):kn.FAILURE.TYPE_INCORRECT(Fn,e)},Fn)});var Bn=D(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.BigInt=void 0;var _a=J(),qn=z(),Mn={tag:"bigint"};Ft.BigInt=_a.create(function(e){return typeof e=="bigint"?qn.SUCCESS(e):qn.FAILURE.TYPE_INCORRECT(Mn,e)},Mn)});var Cr=D(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.String=void 0;var Sa=J(),$n=z(),Vn={tag:"string"};jt.String=Sa.create(function(e){return typeof e=="string"?$n.SUCCESS(e):$n.FAILURE.TYPE_INCORRECT(Vn,e)},Vn)});var Kn=D(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.Symbol=void 0;var Gn=J(),vt=z(),wa=n(function(e){var t={tag:"symbol",key:e};return Gn.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",Wn(e),Wn(o)):vt.SUCCESS(r)},t)},"f"),Yn={tag:"symbol"};qt.Symbol=Gn.create(function(e){return typeof e=="symbol"?vt.SUCCESS(e):vt.FAILURE.TYPE_INCORRECT(Yn,e)},Object.assign(wa,Yn));var Wn=n(function(e){return e===void 0?"undefined":'"'+e+'"'},"quoteIfPresent")});var Qn=D(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.Array=void 0;var Hn=J(),ht=z();function zn(e,t){var r={tag:"array",isReadonly:t,element:e};return Ca(Hn.create(function(o,a){if(!Array.isArray(o))return ht.FAILURE.TYPE_INCORRECT(r,o);var p=ht.enumerableKeysOf(o),d=p.map(function(g){return Hn.innerValidate(e,o[g],a)}),m=p.reduce(function(g,S){var w=d[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(zn,"InternalArr");function Ra(e){return zn(e,!1)}n(Ra,"Arr");Mt.Array=Ra;function Ca(e){return e.asReadonly=t,e;function t(){return zn(e.element,!0)}n(t,"asReadonly")}n(Ca,"withExtraModifierFuncs")});var Xn=D(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.Tuple=void 0;var Jn=J(),et=z();function Ta(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r={tag:"tuple",components:e};return Jn.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 p=et.enumerableKeysOf(o),d=p.map(function(g){return Jn.innerValidate(e[g],o[g],a)}),m=p.reduce(function(g,S){var w=d[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(Ta,"Tuple");Bt.Tuple=Ta});var eo=D(ve=>{"use strict";var Tr=ve&&ve.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),a,p=[],d;try{for(;(t===void 0||t-- >0)&&!(a=o.next()).done;)p.push(a.value)}catch(m){d={error:m}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(d)throw d.error}}return p},Ar=ve&&ve.__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(ve,"__esModule",{value:!0});ve.Partial=ve.Record=ve.InternalRecord=void 0;var Zn=J(),le=z();function De(e,t,r){var o={tag:"record",isPartial:t,isReadonly:r,fields:e};return Ia(Zn.create(function(a,p){if(a==null)return le.FAILURE.TYPE_INCORRECT(o,a);var d=le.enumerableKeysOf(e);if(d.length!==0&&typeof a!="object")return le.FAILURE.TYPE_INCORRECT(o,a);var m=Ar([],Tr(new Set(Ar(Ar([],Tr(d)),Tr(le.enumerableKeysOf(a)))))),g=m.reduce(function(w,C){var h=le.hasKey(C,e),T=le.hasKey(C,a);if(h){var P=e[C],L=t||P.reflect.tag==="optional";if(T){var $=a[C];L&&$===void 0?w[C]=le.SUCCESS($):w[C]=Zn.innerValidate(P,$,p)}else L?w[C]=le.SUCCESS(void 0):w[C]=le.FAILURE.PROPERTY_MISSING(P.reflect)}else if(T){var $=a[C];w[C]=le.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 le.enumerableKeysOf(S).length!==0?le.FAILURE.CONTENT_INCORRECT(o,S):le.SUCCESS(a)},o))}n(De,"InternalRecord");ve.InternalRecord=De;function Aa(e){return De(e,!1,!1)}n(Aa,"Record");ve.Record=Aa;function Oa(e){return De(e,!0,!1)}n(Oa,"Partial");ve.Partial=Oa;function Ia(e){return e.asPartial=t,e.asReadonly=r,e.pick=o,e.omit=a,e.extend=p,e;function t(){return De(e.fields,!0,e.isReadonly)}n(t,"asPartial");function r(){return De(e.fields,e.isPartial,!0)}n(r,"asReadonly");function o(){for(var d=[],m=0;m<arguments.length;m++)d[m]=arguments[m];var g={};return d.forEach(function(S){g[S]=e.fields[S]}),De(g,e.isPartial,e.isReadonly)}n(o,"pick");function a(){for(var d=[],m=0;m<arguments.length;m++)d[m]=arguments[m];var g={},S=le.enumerableKeysOf(e.fields);return S.forEach(function(w){d.includes(w)||(g[w]=e.fields[w])}),De(g,e.isPartial,e.isReadonly)}n(a,"omit");function p(d){return De(Object.assign({},e.fields,d),e.isPartial,e.isReadonly)}n(p,"extend")}n(Ia,"withExtraModifierFuncs")});var Ir=D(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.Guard=tt.Constraint=void 0;var Na=J(),Or=z(),Pa=Nt();function Ua(e,t,r){var o=r&&r.name,a=r&&r.args,p={tag:"constraint",underlying:e,constraint:t,name:o,args:a};return Na.create(function(d){var m=e.validate(d);if(!m.success)return m;var g=t(m.value);return typeof g=="string"?Or.FAILURE.CONSTRAINT_FAILED(p,g):g?Or.SUCCESS(m.value):Or.FAILURE.CONSTRAINT_FAILED(p)},p)}n(Ua,"Constraint");tt.Constraint=Ua;var xa=n(function(e,t){return Pa.Unknown.withGuard(e,t)},"Guard");tt.Guard=xa});var ro=D($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.Dictionary=void 0;var to=J(),Nr=Cr(),Da=Ir(),La=Ot(),je=z(),ka=Da.Constraint(Nr.String,function(e){return!isNaN(+e)},{name:"number"});function Fa(e,t){var r=t===void 0||t==="string"?Nr.String:t==="number"?ka:t,o=La.default(r),a={tag:"dictionary",key:o,value:e};return to.create(function(p,d){if(p==null||typeof p!="object"||Object.getPrototypeOf(p)!==Object.prototype&&(!Array.isArray(p)||o==="string"))return je.FAILURE.TYPE_INCORRECT(a,p);var m=/^(?:NaN|-?\d+(?:\.\d+)?)$/,g=je.enumerableKeysOf(p),S=g.reduce(function(C,h){var T=typeof h=="string"&&m.test(h),P=T?globalThis.Number(h):h;return(T?!r.guard(P)&&!r.guard(h):!r.guard(P))?C[h]=je.FAILURE.KEY_INCORRECT(a,r.reflect,P):C[h]=to.innerValidate(e,p[h],d),C},{}),w=g.reduce(function(C,h){var T=S[h];return T.success||(C[h]=T.details||T.message),C},{});return je.enumerableKeysOf(w).length!==0?je.FAILURE.CONTENT_INCORRECT(a,w):je.SUCCESS(p)},a)}n(Fa,"Dictionary");$t.Dictionary=Fa});var oo=D(rt=>{"use strict";var ja=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 no=J(),qa=z();function Ma(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r={tag:"intersect",intersectees:e};return no.create(function(o,a){var p,d;try{for(var m=ja(e),g=m.next();!g.done;g=m.next()){var S=g.value,w=no.innerValidate(S,o,a);if(!w.success)return w}}catch(C){p={error:C}}finally{try{g&&!g.done&&(d=m.return)&&d.call(m)}finally{if(p)throw p.error}}return qa.SUCCESS(o)},r)}n(Ma,"Intersect");rt.Intersect=Ma});var io=D(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.Optional=void 0;var Ba=J(),$a=z();function Va(e){var t={tag:"optional",underlying:e};return Ba.create(function(r){return r===void 0?$a.SUCCESS(r):e.validate(r)},t)}n(Va,"Optional");Vt.Optional=Va});var uo=D(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.Function=void 0;var Ga=J(),so=z(),ao={tag:"function"};Gt.Function=Ga.create(function(e){return typeof e=="function"?so.SUCCESS(e):so.FAILURE.TYPE_INCORRECT(ao,e)},ao)});var fo=D(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.InstanceOf=void 0;var Ya=J(),co=z();function Wa(e){var t={tag:"instanceof",ctor:e};return Ya.create(function(r){return r instanceof e?co.SUCCESS(r):co.FAILURE.TYPE_INCORRECT(t,r)},t)}n(Wa,"InstanceOf");Yt.InstanceOf=Wa});var lo=D(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.Lazy=void 0;var Ka=J();function Ha(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"),Ka.create(function(a){return o().validate(a)},t)}n(Ha,"Lazy");Wt.Lazy=Ha});var po=D(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.Brand=void 0;var za=J();function Qa(e,t){var r={tag:"brand",brand:e,entity:t};return za.create(function(o){return t.validate(o)},r)}n(Qa,"Brand");Kt.Brand=Qa});var mo=D(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.checked=nt.check=void 0;var Ja=Qe(),Xa=z(),Pr=new WeakMap;function Za(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(Za,"check");nt.check=Za;function eu(e,t,r){var o=Pr.get(e),a=o&&o.get(t);if(a)return a;for(var p=[],d=0;d<r;d++)p.push(d);return p}n(eu,"getValidParameterIndices");function tu(){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 p=a.value,d=(r.name||r.constructor.name+".prototype")+(typeof o=="string"?'["'+o+'"]':"["+String(o)+"]"),m=eu(r,o,e.length);if(m.length!==e.length)throw new Error("Number of `@checked` runtypes and @check parameters not matched.");if(m.length>p.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],T=w.validate(g[h]);if(!T.success){var P=d+", argument #"+h+": "+T.message,L=Xa.FAILURE.ARGUMENT_INCORRECT(P);throw new Ja.ValidationError(L)}}),p.apply(this,g)}}}n(tu,"checked");nt.checked=tu});var xe=D(I=>{"use strict";var ru=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)&&ru(t,e,r)};Object.defineProperty(I,"__esModule",{value:!0});I.InstanceOf=I.Nullish=I.Null=I.Undefined=I.Literal=void 0;Y(_n(),I);Y(br(),I);Y(wn(),I);Y(Tn(),I);Y(An(),I);Y(Qe(),I);Y(Nt(),I);Y(On(),I);Y(In(),I);var Ht=Un();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(Ln(),I);Y(jn(),I);Y(Bn(),I);Y(Cr(),I);Y(Kn(),I);Y(Qn(),I);Y(Xn(),I);Y(eo(),I);Y(ro(),I);Y(wr(),I);Y(oo(),I);Y(io(),I);Y(uo(),I);var nu=fo();Object.defineProperty(I,"InstanceOf",{enumerable:!0,get:function(){return nu.InstanceOf}});Y(lo(),I);Y(Ir(),I);Y(po(),I);Y(mo(),I)});var wo=D(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});var _o=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"),So=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]))):_o(r[a])&&_o(o[a])?r[a]=So(r[a],o[a]):r[a]=o[a]}),r},{})},"merge");Dr.default=So});var Xo=D((Jo,Br)=>{(function(e){if(typeof Jo=="object"&&typeof Br!="undefined")Br.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,p,d){function m(w,C){if(!p[w]){if(!a[w]){var h=typeof require=="function"&&require;if(!C&&h)return h(w,!0);if(g)return g(w,!0);var T=new Error("Cannot find module '"+w+"'");throw T.code="MODULE_NOT_FOUND",T}var P=p[w]={exports:{}};a[w][0].call(P.exports,function(L){var $=a[w][1][L];return m($||L)},P,P.exports,o,a,p,d)}return p[w].exports}n(m,"s");for(var g=typeof require=="function"&&require,S=0;S<d.length;S++)m(d[S]);return m},"e")({1:[function(o,a,p){(function(d){"use strict";var m=d.MutationObserver||d.WebKitMutationObserver,g;if(m){var S=0,w=new m(L),C=d.document.createTextNode("");w.observe(C,{characterData:!0}),g=n(function(){C.data=S=++S%2},"scheduleDrain")}else if(!d.setImmediate&&typeof d.MessageChannel!="undefined"){var h=new d.MessageChannel;h.port1.onmessage=L,g=n(function(){h.port2.postMessage(0)},"scheduleDrain")}else"document"in d&&"onreadystatechange"in d.document.createElement("script")?g=n(function(){var G=d.document.createElement("script");G.onreadystatechange=function(){L(),G.onreadystatechange=null,G.parentNode.removeChild(G),G=null},d.document.documentElement.appendChild(G)},"scheduleDrain"):g=n(function(){setTimeout(L,0)},"scheduleDrain");var T,P=[];function L(){T=!0;for(var G,se,W=P.length;W;){for(se=P,P=[],G=-1;++G<W;)se[G]();W=P.length}T=!1}n(L,"nextTick"),a.exports=$;function $(G){P.push(G)===1&&!T&&g()}n($,"immediate")}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(o,a,p){"use strict";var d=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 k=this.state===w?R:x;P(N,k,this.outcome)}else this.queue.push(new T(N,R,x));return N};function T(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(T,"QueueItem"),T.prototype.callFulfilled=function(R){g.resolve(this.promise,R)},T.prototype.otherCallFulfilled=function(R){P(this.promise,this.onFulfilled,R)},T.prototype.callRejected=function(R){g.reject(this.promise,R)},T.prototype.otherCallRejected=function(R){P(this.promise,this.onRejected,R)};function P(R,x,N){d(function(){var k;try{k=x(N)}catch(H){return g.reject(R,H)}k===R?g.reject(R,new TypeError("Cannot resolve promise with itself")):g.resolve(R,k)})}n(P,"unwrap"),g.resolve=function(R,x){var N=G(L,x);if(N.status==="error")return g.reject(R,N.value);var k=N.value;if(k)$(R,k);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,k=R.queue.length;++N<k;)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 k(X){N||(N=!0,g.reject(R,X))}n(k,"onError");function H(X){N||(N=!0,g.resolve(R,X))}n(H,"onSuccess");function oe(){x(H,k)}n(oe,"tryToUnwrap");var re=G(oe);re.status==="error"&&k(re.value)}n($,"safelyResolveThenable");function G(R,x){var N={};try{N.value=R(x),N.status="success"}catch(k){N.status="error",N.value=k}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,k=!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){k||(k=!0,g.reject(X,Ge))});function cr(Ge){H[St]=Ge,++oe===N&&!k&&(k=!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,k=!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){k||(k=!0,g.resolve(oe,ue))},function(ue){k||(k=!0,g.reject(oe,ue))})}}n(ae,"race")},{"1":1}],3:[function(o,a,p){(function(d){"use strict";typeof d.Promise!="function"&&(d.Promise=o(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"2":2}],4:[function(o,a,p){"use strict";var d=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 T(i,u){u&&i.then(function(s){u(null,s)},function(s){u(s)})}n(T,"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 k(i){return typeof se=="boolean"?h.resolve(se):N(i).then(function(u){return se=u,se})}n(k,"_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]||Kr(),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 Wr(i){return i&&i.__local_forage_encoded_blob}n(Wr,"_isEncodedBlob");function wi(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(wi,"_fullyReady");function Ri(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(Ri,"_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 Ri(i).then(function(){Se(i,u,s,f-1)})}).catch(s);s(c)}}n(Se,"createTransaction");function Kr(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}n(Kr,"createDbContext");function Ci(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=Kr(),W[s.name]=l),l.forages.push(u),u._initReady||(u._initReady=u.ready,u.ready=wi);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 A=0;A<b.length;A++){var U=b[A];U!==u&&(U._dbInfo.db=s.db,U._dbInfo.version=s.version)}})}n(Ci,"_initStorage");function Ti(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),Wr(_)&&(_=Ge(_)),l(_)},b.onerror=function(){c(b.error)}}catch(_){c(_)}})}).catch(c)});return T(f,u),f}n(Ti,"getItem");function Ai(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 A=b.result;if(A){var U=A.value;Wr(U)&&(U=Ge(U));var j=i(U,A.key,_++);j!==void 0?l(j):A.continue()}else l()},b.onerror=function(){c(b.error)}}catch(A){c(A)}})}).catch(c)});return T(f,u),f}n(Ai,"iterate");function Oi(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]"?k(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 A=_.objectStore(f._dbInfo.storeName);E===null&&(E=void 0);var U=A.put(E,i);_.oncomplete=function(){E===void 0&&(E=null),c(E)},_.onabort=_.onerror=function(){var j=U.error?U.error:U.transaction.error;v(j)}}catch(j){v(j)}})}).catch(v)});return T(l,s),l}n(Oi,"setItem");function Ii(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 T(f,u),f}n(Ii,"removeItem");function Ni(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 T(s,i),s}n(Ni,"clear");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.count();E.onsuccess=function(){f(E.result)},E.onerror=function(){l(E.error)}}catch(b){l(b)}})}).catch(l)});return T(s,i),s}n(Pi,"length");function Ui(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 A=_.result;if(!A){l(null);return}i===0||b?l(A.key):(b=!0,A.advance(i))},_.onerror=function(){c(_.error)}}catch(A){c(A)}})}).catch(c)});return T(f,u),f}n(Ui,"key");function xi(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 T(s,i),s}n(xi,"keys");function Di(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 A=0;A<_.length;A++){var U=_[A];U._dbInfo.db=null,U._dbInfo.version=E}var j=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 j.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 A=b[_];A._dbInfo.db=null}var U=new h(function(j,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(),j(Z)}});return U.then(function(j){E.db=j;for(var q=0;q<b.length;q++){var te=b[q];oe(te._dbInfo)}}).catch(function(j){throw(re(i,j)||h.resolve()).catch(function(){}),j})})}return T(l,u),l}n(Di,"dropInstance");var Li={_driver:"asyncStorage",_initStorage:Ci,_support:w(),iterate:Ai,getItem:Ti,setItem:Oi,removeItem:Ii,clear:Ni,length:Pi,key:Ui,keys:xi,dropInstance:Di};function ki(){return typeof openDatabase=="function"}n(ki,"isWebSQLValid");var Ae="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fi="~~local_forage_type~",Hr=/^~~local_forage_type~([^~]+)~/,wt="__lfsc__:",fr=wt.length,lr="arbf",dr="blob",zr="si08",Qr="ui08",Jr="uic8",Xr="si16",Zr="si32",en="ur16",tn="ui32",rn="fl32",nn="fl64",on=fr+lr.length,sn=Object.prototype.toString;function an(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(an,"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 ji(i,u){var s="";if(i&&(s=sn.call(i)),i&&(s==="[object ArrayBuffer]"||i.buffer&&sn.call(i.buffer)==="[object ArrayBuffer]")){var f,l=wt;i instanceof ArrayBuffer?(f=i,l+=lr):(f=i.buffer,s==="[object Int8Array]"?l+=zr:s==="[object Uint8Array]"?l+=Qr:s==="[object Uint8ClampedArray]"?l+=Jr:s==="[object Int16Array]"?l+=Xr:s==="[object Uint16Array]"?l+=en:s==="[object Int32Array]"?l+=Zr:s==="[object Uint32Array]"?l+=tn:s==="[object Float32Array]"?l+=rn:s==="[object Float64Array]"?l+=nn: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=Fi+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(ji,"serialize");function qi(i){if(i.substring(0,fr)!==wt)return JSON.parse(i);var u=i.substring(on),s=i.substring(fr,on),f;if(s===dr&&Hr.test(u)){var l=u.match(Hr);f=l[1],u=u.substring(l[0].length)}var c=an(u);switch(s){case lr:return c;case dr:return C([c],{type:f});case zr:return new Int8Array(c);case Qr:return new Uint8Array(c);case Jr:return new Uint8ClampedArray(c);case Xr:return new Int16Array(c);case en:return new Uint16Array(c);case Zr:return new Int32Array(c);case tn:return new Uint32Array(c);case rn:return new Float32Array(c);case nn:return new Float64Array(c);default:throw new Error("Unkown type: "+s)}}n(qi,"deserialize");var mr={serialize:ji,deserialize:qi,stringToBuffer:an,bufferToString:pr};function un(i,u,s,f){i.executeSql("CREATE TABLE IF NOT EXISTS "+u.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],s,f)}n(un,"createDbTable");function Mi(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){un(y,s,function(){u._dbInfo=s,c()},function(E,b){v(b)})},v)});return s.serializer=mr,l}n(Mi,"_initStorage$1");function Oe(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):un(E,u,function(){E.executeSql(s,f,l,c)},c)},c):c(v,y)},c)}n(Oe,"tryExecuteSql");function Bi(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){Oe(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 T(f,u),f}n(Bi,"getItem$1");function $i(i,u){var s=this,f=new h(function(l,c){s.ready().then(function(){var v=s._dbInfo;v.db.transaction(function(y){Oe(y,v,"SELECT * FROM "+v.storeName,[],function(E,b){for(var _=b.rows,A=_.length,U=0;U<A;U++){var j=_.item(U),q=j.value;if(q&&(q=v.serializer.deserialize(q)),q=i(q,j.key,U+1),q!==void 0){l(q);return}}l()},function(E,b){c(b)})})}).catch(c)});return T(f,u),f}n($i,"iterate$1");function cn(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(_,A){A?y(A):b.db.transaction(function(U){Oe(U,b,"INSERT OR REPLACE INTO "+b.storeName+" (key, value) VALUES (?, ?)",[i,_],function(){v(E)},function(j,q){y(q)})},function(U){if(U.code===U.QUOTA_ERR){if(f>0){v(cn.apply(l,[i,E,s,f-1]));return}y(U)}})})}).catch(y)});return T(c,s),c}n(cn,"_setItem");function Vi(i,u,s){return cn.apply(this,[i,u,s,1])}n(Vi,"setItem$1");function Gi(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){Oe(y,v,"DELETE FROM "+v.storeName+" WHERE key = ?",[i],function(){l()},function(E,b){c(b)})})}).catch(c)});return T(f,u),f}n(Gi,"removeItem$1");function Yi(i){var u=this,s=new h(function(f,l){u.ready().then(function(){var c=u._dbInfo;c.db.transaction(function(v){Oe(v,c,"DELETE FROM "+c.storeName,[],function(){f()},function(y,E){l(E)})})}).catch(l)});return T(s,i),s}n(Yi,"clear$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){Oe(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 T(s,i),s}n(Wi,"length$1");function Ki(i,u){var s=this,f=new h(function(l,c){s.ready().then(function(){var v=s._dbInfo;v.db.transaction(function(y){Oe(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 T(f,u),f}n(Ki,"key$1");function Hi(i){var u=this,s=new h(function(f,l){u.ready().then(function(){var c=u._dbInfo;c.db.transaction(function(v){Oe(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 T(s,i),s}n(Hi,"keys$1");function zi(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(zi,"getAllStoreNames");function Qi(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(zi(v))}).then(function(c){return new h(function(v,y){c.db.transaction(function(E){function b(j){return new h(function(q,te){E.executeSql("DROP TABLE IF EXISTS "+j,[],function(){q()},function(Z,ie){te(ie)})})}n(b,"dropTable");for(var _=[],A=0,U=c.storeNames.length;A<U;A++)_.push(b(c.storeNames[A]));h.all(_).then(function(){v()}).catch(function(j){y(j)})},function(E){y(E)})})}):l=h.reject("Invalid arguments"),T(l,u),l}n(Qi,"dropInstance$1");var Ji={_driver:"webSQLStorage",_initStorage:Mi,_support:ki(),iterate:$i,getItem:Bi,setItem:Vi,removeItem:Gi,clear:Yi,length:Wi,key:Ki,keys:Hi,dropInstance:Qi};function Xi(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(i){return!1}}n(Xi,"isLocalStorageValid");function fn(i,u){var s=i.name+"/";return i.storeName!==u.storeName&&(s+=i.storeName+"/"),s}n(fn,"_getKeyPrefix");function Zi(){var i="_localforage_support_test";try{return localStorage.setItem(i,!0),localStorage.removeItem(i),!1}catch(u){return!0}}n(Zi,"checkIfLocalStorageThrows");function es(){return!Zi()||localStorage.length>0}n(es,"_isLocalStorageUsable");function ts(i){var u=this,s={};if(i)for(var f in i)s[f]=i[f];return s.keyPrefix=fn(i,u._defaultConfig),es()?(u._dbInfo=s,s.serializer=mr,h.resolve()):h.reject()}n(ts,"_initStorage$2");function rs(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 T(s,i),s}n(rs,"clear$2");function ns(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 T(f,u),f}n(ns,"getItem$2");function os(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 A=localStorage.getItem(_);if(A&&(A=l.serializer.deserialize(A)),A=i(A,_.substring(v),E++),A!==void 0)return A}}});return T(f,u),f}n(os,"iterate$2");function is(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 T(f,u),f}n(is,"key$2");function ss(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 T(s,i),s}n(ss,"keys$2");function as(i){var u=this,s=u.keys().then(function(f){return f.length});return T(s,i),s}n(as,"length$2");function us(i,u){var s=this;i=L(i);var f=s.ready().then(function(){var l=s._dbInfo;localStorage.removeItem(l.keyPrefix+i)});return T(f,u),f}n(us,"removeItem$2");function cs(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(A){(A.name==="QuotaExceededError"||A.name==="NS_ERROR_DOM_QUOTA_REACHED")&&y(A),y(A)}})})});return T(l,s),l}n(cs,"setItem$2");function fs(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(fn(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"),T(l,u),l}n(fs,"dropInstance$2");var ls={_driver:"localStorageWrapper",_initStorage:ts,_support:Xi(),iterate:os,getItem:ns,setItem:cs,removeItem:us,clear:rs,length:as,key:is,keys:ss,dropInstance:fs},ds=n(function(u,s){return u===s||typeof u=="number"&&typeof s=="number"&&isNaN(u)&&isNaN(s)},"sameValue"),ps=n(function(u,s){for(var f=u.length,l=0;l<f;){if(ds(u[l],s))return!0;l++}return!1},"includes"),ln=Array.isArray||function(i){return Object.prototype.toString.call(i)==="[object Array]"},lt={},dn={},Ye={INDEXEDDB:Li,WEBSQL:Ji,LOCALSTORAGE:ls},ms=[Ye.INDEXEDDB._driver,Ye.WEBSQL._driver,Ye.LOCALSTORAGE._driver],Rt=["dropInstance"],vr=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Rt),vs={description:"",driver:ms.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function hs(i,u){i[u]=function(){var s=arguments;return i.ready().then(function(){return i[u].apply(i,s)})}}n(hs,"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)&&(ln(u[s])?arguments[0][s]=u[s].slice():arguments[0][s]=u[s])}return arguments[0]}n(hr,"extend");var gs=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({},vs),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":d(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"),A=0,U=_.length;A<U;A++){var j=_[A],q=!ps(Rt,j);if((q||s[j])&&typeof s[j]!="function"){y(b);return}}var te=n(function(){for(var dt=n(function(bs){return function(){var _s=new Error("Method "+bs+" is not implemented by the current driver"),pn=h.reject(_s);return T(pn,arguments[arguments.length-1]),pn}},"methodNotImplementedFactory"),gr=0,Es=Rt.length;gr<Es;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,dn[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;ln(s)||(s=[s]);var v=this._getSupportedDrivers(s);function y(){c._config.driver=c.driver()}n(y,"setDriverToConfig");function E(A){return c._extend(A),y(),c._ready=c._initStorage(c._config),c._ready}n(E,"extendSelfWithDriver");function b(A){return function(){var U=0;function j(){for(;U<A.length;){var q=A[U];return U++,c._dbInfo=null,c._ready=null,c.getDriver(q).then(E).catch(j)}y();var te=new Error("No available storage method found.");return c._driverSet=h.reject(te),c._driverSet}return n(j,"driverPromiseLoop"),j()}}n(b,"initDriver");var _=this._driverSet!==null?this._driverSet.catch(function(){return h.resolve()}):h.resolve();return this._driverSet=_.then(function(){var A=v[0];return c._dbInfo=null,c._ready=null,c.getDriver(A).then(function(U){c._driver=U._driver,y(),c._wrapLibraryMethodsWithReady(),c._initDriver=b(v)})}).catch(function(){y();var A=new Error("No available storage method found.");return c._driverSet=h.reject(A),c._driverSet}),P(this._driverSet,f,l),this._driverSet},"setDriver"),i.prototype.supports=n(function(s){return!!dn[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++)hs(this,vr[s])},"_wrapLibraryMethodsWithReady"),i.prototype.createInstance=n(function(s){return new i(s)},"createInstance"),i}(),ys=new gs;a.exports=ys},{"3":3}]},{},[4])(4)})});var ti=D((Zo,ei)=>{(function(e){var t;if(typeof define=="function"&&define.amd&&(define(e),t=!0),typeof Zo=="object"&&(ei.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 p=arguments[o];for(var d in p)a[d]=p[d]}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 p(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(T){}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(p,"set");function d(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("="),T=h.slice(1).join("=");!g&&T.charAt(0)==='"'&&(T=T.slice(1,-1));try{var P=t(h[0]);if(T=(o.read||o)(T,P)||t(T),g)try{T=JSON.parse(T)}catch(L){}if(S[P]=T,m===P)break}catch(L){}}return m?S[m]:S}}return n(d,"get"),a.set=p,a.get=function(m){return d(m,!1)},a.getJSON=function(m){return d(m,!0)},a.remove=function(m,g){p(m,"",e(g,{expires:-1}))},a.defaults={},a.withConverter=r,a}return n(r,"init"),r(function(){})})});Is(exports,{PaywallUnlockRequest:()=>Si,UserDataRequest:()=>pe,goToLoginPage:()=>uc,logout:()=>cc,tryActivateSubscriptionAccess:()=>fc,updateStorage:()=>lc});var Ps;var pt=n(()=>Ps||window.location.hostname,"getCurrentHostname"),Re=n(()=>window.location.href,"getCurrentUrl"),Us=n(()=>{let e=/^bed-([^.]+)\.api\.no$/.exec(pt()),t=/\.([^.]+)\.api\.no/.exec(pt());return e?e[1]:t?t[1]:null},"getCurrentEnvironment"),fe=n(()=>pt().replace(/\.[^.]+\.api\.no/,""),"getCurrentPublicationDomain"),Ke=n(()=>{let e=Us(),t="www.aid.no";return e==="localhost"?t="www.aid.no.localhost.api.no":e&&(t=`www-${e}.aid.no`),t},"getAidDomain");function xs(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(xs,"postLog");var Ct=n((e,t,r)=>{let o={};Object.keys(r).forEach(p=>{if(["string","number","boolean"].includes(typeof r[p])){o[p]=r[p];return}try{o[p]=JSON.stringify(r[p])}catch(d){o[p]=r[p]}});let a=ce(ne({},o),{message:t,url:Re(),domain:pt()});xs(`/api/mercury/v1/log/${e}`,a)},"backendLog"),Ds={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)},yn=Ds;var Ls;var ks=n(()=>Ls||yn,"getLogger"),Er=n(e=>{let t={message:e.message};return Object.getOwnPropertyNames(e).forEach(r=>{t[r]=e[r]}),t},"rewriteErrorObject"),En=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"),Fs=n((r,...o)=>O(void 0,[r,...o],function*(e,t={}){let a=e,p=t||{};if(a instanceof Error){let d=Er(a);a=d.message,p=ce(ne({},p),{error:d})}if(p=ce(ne({},p),{origin:"@amedia/user"}),t instanceof Error){let d=Er(t);p=ce(ne({},p),{[Object.keys(p).includes("error")?"contextError":"error"]:d})}else if(p instanceof Response){let d=yield En(p);p=ce(ne({},p),{response:d})}else for(let d of Object.keys(p))if(p[d]instanceof Error)p[d]=Er(p[d]);else if(p[d]instanceof Response){let m=yield En(p[d]);p[d]=m}return{message:a,context:p}}),"processIncomingLogData"),Tt=n((e,t,r)=>{Fs(t,r).then(({message:o,context:a})=>ks()[e](o,a))},"processAndLog"),F={debug:(e,t)=>Tt("debug",e,t),info:(e,t)=>Tt("info",e,t),warn:(e,t)=>Tt("warn",e,t),error:(e,t)=>Tt("error",e,t)};var Ce,js=n(e=>{Ce=e},"setRootElement");typeof window!="undefined"&&js(window);var ye=n((e,t)=>{if(!Ce){F.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){F.error("No root element to bind event to!");return}Ce.addEventListener(e,r=>{t.apply(Ce,[r])})},"listenForAllEvents"),ee=n(e=>{if(!Ce){F.error("No root element to dispatch event on!");return}Ce.dispatchEvent(e)},"dispatch");var V=we(xe());var ot={},ou=n((e,t)=>{ot[e]||(ot[e]=[]),ot[e].push(t)},"add"),iu=n(e=>{let t=ot[e];return t?(delete ot[e],t):[]},"getAll"),su=n(e=>{var t;return((t=ot[e])==null?void 0:t.length)||0},"peekQueueSize"),it={add:ou,getAll:iu,peekQueueSize:su};var Ur=n(()=>{let e=typeof window!="undefined"?window:global;return e.amediaUserCache||(e.amediaUserCache={})},"getStorage"),au=n(e=>{let t=Ur()[e];return Promise.resolve(t)},"get"),uu=n((e,t,r)=>(Ur()[e]={key:e,data:t,expires:r},Promise.resolve()),"set"),cu=n(e=>(delete Ur()[e],Promise.resolve()),"remove"),fu=n(()=>((typeof window!="undefined"?window:global).amediaUserCache={},Promise.resolve()),"clear"),vo={get:au,set:uu,remove:cu,clear:fu};var lu;var zt=n(()=>lu||vo,"getCacheEngine"),du=n((e,t,r)=>zt().set(e,t,Date.now()+r),"set"),xr=n(e=>zt().remove(e),"remove"),pu=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 F.error(o,{cacheData:r.data}),xr(e),Promise.resolve()}}),"get"),mu=n(()=>zt().clear(),"clear"),he={get:pu,set:du,remove:xr,clear:mu};var vu=n((e,t)=>!e||Array.isArray(t)?t:t?typeof e=="object"&&typeof t=="object"?ne(ne({},e),t):t:e,"mergeCache");function _e(e,t,r,o){return new Promise((a,p)=>{it.add(e,{resolve:a,reject:p}),!(it.peekQueueSize(e)>1)&&he.get(e,t).then(d=>{if(d&&(!o||o(d))){it.getAll(e).forEach(m=>{m.resolve(d)});return}r().then(m=>{let g=d?vu(d,m.data):m.data;he.set(e,g,m.ttl),it.getAll(e).forEach(S=>{S.resolve(m.data)})}).catch(()=>{it.getAll(e).forEach(m=>{m.reject()})})})})}n(_e,"getOrUpdate");var hu=(0,V.Record)({id:V.Number,domain:V.String}),ho=(0,V.Record)({status:(0,V.Literal)("success"),access:(0,V.Union)((0,V.Literal)("granted"),(0,V.Literal)("denied")),publication:hu,access_features:(0,V.Array)(V.String)}),gu=(0,V.Record)({status:(0,V.Literal)("success"),cookie:V.String,access_features:(0,V.Array)(V.String)}),yu=(0,V.Record)({status:(0,V.Literal)("success"),vstoken_cookie:V.String,uuid:V.String,access_features:(0,V.Array)(V.String)}),go=n((e,t)=>_e("checkForAccess",ho,()=>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=ho.check(r);return{ttl:o.access==="granted"?1e3*10:0,data:o}}catch(o){throw F.error(o,{json:r}),o}})).then(r=>({access:r.access_features})),"checkForAccess"),yo=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 gu.check(t)}catch(r){throw F.error(r,{json:t}),r}}),"getUserAccess"),Eo=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 yu.check(t)}catch(r){throw F.error(r,{json:t}),r}}),"getNonUserAccess");var gt=class extends Error{};n(gt,"UserDeactivatedError");var Eu=["no_session_found","subscription_not_found","publication_not_subscribable"],bo=n(e=>O(void 0,null,function*(){return fetch(`/api/mercury/v2/access/activate?publication_wwwdomain=${fe()}&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){F.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 Eu.includes(o==null?void 0:o.status)?[]:(F.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 ge=we(xe());var Ro=we(wo()),qe={},st={},bu=n(e=>{var t;(t=st[e])==null||t.forEach(r=>r(qe[e]))},"emit"),_u=n((e,t)=>{st[e]||(st[e]=[]),st[e].push(t)},"on"),Co=n((e,t)=>{qe[e]=t,bu(e)},"set"),Su=n((e,t)=>{Co(e,(0,Ro.default)(qe[e]||{},t))},"merge"),wu=n(e=>qe[e],"get"),Ru=n(()=>{qe.state=void 0,qe.userAttributes=void 0,qe.storage=void 0,Object.keys(st).forEach(e=>{st[e]=[]})},"clear"),Q={merge:Su,set:Co,get:wu,on:_u,clear:Ru};var Cu=["avbrutt","kansellert","cancelled","aborted","failed to fetch","abgebrochen","the operation was aborted."],To=n(e=>Cu.includes(e.toLowerCase().trim()),"isAbortedNetworkError");var Ao=(0,ge.Partial)({user_uuid:ge.String,user_name:ge.String,tracking_key:ge.String}),Tu=n(e=>({uuid:e.user_uuid||null,name:e.user_name||null,trackingKey:e.tracking_key||null}),"mapSessionToUserAttributes"),Au=(0,ge.Record)({code:ge.String}),Ou=(0,ge.Record)({errors:(0,ge.Array)(Au)}),Iu=["session.not_found","session.not_specified","user.deactivated"],Nu=["session.invalid_for_domain","user.not_found"],Lr=n(e=>O(void 0,null,function*(){let t,r=e.clone();try{[t]=Ou.check(yield e.json()).errors}catch(o){return To(o==null?void 0:o.message)?Promise.resolve():(F.warn("Unable to parse error body from pluto",{error:o,response:r}),Promise.reject(o))}return Iu.includes(t==null?void 0:t.code)?Promise.resolve():Nu.includes(t==null?void 0:t.code)?(F.warn(`Pluto responded with HTTP/${e.status}: (${t.code}) while fetching current session`,{error:t,response:e}),Promise.resolve()):(F.error(`Pluto responded with HTTP/${e.status}: ${e.statusText}) when fetching current session`,{error:t,response:e}),Promise.reject())}),"resolveBadPlutoResponse"),Pu=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 F.error(r,{json:e}),t}}),"fetchCurrentSession"),Oo=n(()=>O(void 0,null,function*(){return _e("getCurrentSession",Ao,Pu).then(e=>Tu(e))}),"getCurrentSession"),Io=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 kr,Qt=self||window,No=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(No){let e=new Uint8Array(16);kr=n(function(){return No(e),e},"whatwgRNG")}else{let e=new Array(16);kr=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 Po=[];for(let e=0;e<256;++e)Po[e]=(e+256).toString(16).substr(1);function Uu(e,t){let r=t||0,o=Po;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(Uu,"bytesToUuid");function Uo(){let e=kr();return e[6]=e[6]&15|64,e[8]=e[8]&63|128,Uu(e)}n(Uo,"uuid");function xu(){let e,t,r=!1;return{promise:new Promise((a,p)=>{e=n(d=>{r||a(d),r=!0},"resolve"),t=n(d=>{r||p(d),r=!0},"reject")}),resolve:e,reject:t}}n(xu,"createPromise");function Du(e,t){return(...r)=>{let{resolve:o,reject:a,promise:p}=xu(),d=Uo(),m={eventId:d,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,d)}return self.addEventListener(`amedia-rpc-event:${e}:${t}:${d}`,S=>{S.detail||o();let{error:w,result:C}=S.detail;return w?a(w):o(C)}),p}}n(Du,"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,p]=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<p&&console.warn(`${this.component} server version is on an earlier minor version (${o}) than the client (${p})`);let d=this.queue.slice(0);delete this.queue,d.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,p=new Promise((d,m)=>{o=d,a=m});return this.queue.push(()=>this[t](...r).then(o).catch(a)),p}return this[t]=Du(this.component,t),this[t](...r)}}};n(yt,"RPCclient");var Jt,xo=n(()=>Jt||(Jt=new yt({version:"1.0.0",component:"userdata-session",methods:["userAuthenticated"]}),Jt),"getRPCClient");var Lu=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"),Le=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 Lu(t,a)}return null},"getCookie"),ku=n((e,t)=>t?t instanceof Date?`; expires=${t.toUTCString()}`:(e.setTime(e.getTime()+t*24*60*60*1e3),`; expires=${e.toUTCString()}`):"","setValidTime"),Fu=n(e=>!e||e===""?"":e instanceof Object?encodeURIComponent(JSON.stringify(e)):typeof e=="number"?e.toString(10):e,"setValue");function Te(e,t,r=Date.now(),o="/",a=!1){let p=new Date,d=`${e}=`;return(!t||t==="")&&(r=-1),d+=Fu(t),d+=ku(p,r),d+=`; path=${o}`,a&&(d+="; secure"),document.cookie=d,r&&r!==-1&&Le(e)===null&&(document.cookie=d.replace(/; expires=[^;]*/,"")),d}n(Te,"setCookie");function de(e){Te(e)}n(de,"removeCookie");var Do=n(()=>window.location.reload(),"reload"),Lo=n(e=>window.location.replace(e),"replace"),Xt=n(e=>{window.location.href=e},"navigateTo");var ko=n(e=>{let t=new URL(`https://${Ke()}/aid/logg_inn/${fe()}/`);t.searchParams.set("requestedUrl",e instanceof URL?e.href:e),Xt(t.href)},"login");function ju(){de("VSTOKEN"),de("aid.session"),de("aid_invitation_code"),de("aid-reload-article"),de("daxsub")}n(ju,"clearCookies");var Zt=n(()=>O(void 0,null,function*(){return Promise.all([Io(fe()),he.clear()]).then(()=>{xo().userAuthenticated(!1),ju(),de("VSTOKEN2")}).catch(e=>{F.error("Failure while logging out",e)})}),"logout"),er=n(()=>Oo(),"getSession");var Fo=n((e=["newspaper"])=>go(fe(),e),"getAccess"),tr=n(e=>O(void 0,null,function*(){try{return yield bo(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 yo(e);return t.status==="success"&&Te("VSTOKEN",t.cookie,365,"/"),{success:t.status==="success",accessFeatures:t.access_features}}),"setUserAccessCookie"),nr=n(e=>O(void 0,null,function*(){let t=yield Eo(e);return t.status==="success"&&Te("VSTOKEN2",t.vstoken_cookie,1,"/"),{success:t.status==="success",accessFeatures:t.access_features}}),"setNonUserAccessCookie"),jo=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((p,d,m)=>m.indexOf(p)===d).sort()}),{success:!0,accessFeatures:[]}))}),"setAccessCookies"),qo=n(e=>{let t=new Date;t.setTime(t.getTime()+2*60*1e3),Te("aid-paywall-reload-performed",e||Re(),t)},"setHasPerformedPaywallReload"),Mo=n(e=>Le("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 qu=n(()=>{ye(Me.REQUEST_ACTIVATION,e=>{tr(e.detail.accessFeatures).then(t=>{ee(new CustomEvent(Me.ON_ACTIVATION_COMPLETE,{detail:{accessFeatures:t}}))})})},"listenForActivationRequests");qu();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 Bo(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(Bo,"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,"uuid"]}))),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=>{var o;if(typeof r.state.isLoggedIn!="undefined"){if(r.state.isLoggedIn===!1){if(((o=this.attributes)==null?void 0:o.includes("extraData"))&&!Object.keys(r.attributes).includes("extraData"))return;t(r);return}Bo(this.attributes,r.attributes)||Bo(this.namespaces,r.storage)||t(r)}})})}processUserAttributesEvent(t){let r=t.detail;return this.attributes.reduce((a,p)=>(r[p]!==void 0&&(a[p]=r[p]),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 pe=at;var $o="jupiter";function Mu(){return O(this,null,function*(){let e="VSTOKEN",t=fe(),r=Le(e);new pe().withAttributes(["uuid"]).fetch().then(p=>O(this,[p],function*({attributes:o,state:a}){if(a.isLoggedIn===!1){typeof r=="string"&&de(e);return}if(typeof r!="string"){yield rr(t);return}let d=r.split(":"),m=new Date(parseInt(d[1],10)*1e3);m.setDate(m.getDate()-1),!(m.getTime()>Date.now()&&d[3]===o.uuid&&t.includes(d[4])&&d[5]===$o)&&(yield rr(t))}))})}n(Mu,"verifyAndSetUserAccessCookie");function Bu(){let e="VSTOKEN2",t=fe(),r=Le(e);new pe().fetch().then(a=>O(this,[a],function*({state:{isLoggedIn:o}}){if(o){if(typeof r!="string"){yield nr(t);return}let p=r.split(":"),d=new Date(parseInt(p[1],10)*1e3);if(d.setMinutes(d.getMinutes()-30),d.getTime()>Date.now()&&t.includes(p[4])&&p[5]===$o)return;yield nr(t)}else de(e)})).then(()=>{})}n(Bu,"verifyAndSetNonUserAccessCookie");function Fr(){return Promise.all([Mu(),Bu()])}n(Fr,"accessCookieRefresher");function Vo(){new pe().subscribe(({state:e})=>{e.isLoggedIn===!1&&(Q.set("userAttributes",{}),Q.set("storage",{}))})}n(Vo,"removeUserStorage");var Be=we(xe());var Go="haveTriedThirdPartyLoginCheck",$u=60*60*1e3,Vu=(0,Be.Record)({user_name:Be.String,tracking_key:Be.String}),Gu=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 Vu.check(e)}catch(t){return F.error(t,{data:e}),null}}),"getAidSession");function jr(){return O(this,null,function*(){return(yield he.get(Go,Be.Boolean))?!1:(yield he.set(Go,!0,$u),!!(yield Gu()))})}n(jr,"thirdPartyCookie");var qr="has-tried-autologin",Yo=6e4;function Yu(){try{return window.self!==window.top}catch(e){return!0}}n(Yu,"inIframe");function Wu(){let e=Le(qr);if(e&&typeof e!="object")try{if(Date.now()-parseInt(e,10)<Yo)return!0}catch(t){de(qr)}return Te(qr,Date.now(),Date.now()+Yo),!1}n(Wu,"hasAlreadyAttemptedAutoLogin");var Wo=n(e=>O(void 0,null,function*(){if(Yu())return;let{state:{isLoggedIn:t}}=yield new pe().fetch();if(!t){for(let r of e)if(!(yield r.handler().then(a=>{if(a){if(Wu())return!1;let p=new URL(`https://${Ke()}/aid/logg_inn/auto`);return p.searchParams.set("context",`auto_login_${r.name}`),p.searchParams.set("requestedUrl",Re()),Xt(p.href),!1}return!0})))return}}),"attemptAutologin"),Ko=n(()=>O(void 0,null,function*(){return Wo([{name:"third_party",handler:jr}])}),"attemptAutoLoginJob"),Ho=n(()=>O(void 0,null,function*(){return Wo([{name:"paywall",handler:()=>Promise.resolve(!0)}])}),"attemptPaywallAutoLogin");function Ku(e){return`a_sub_status=${e.extraData.customer_keys?"active":"null"}&a_user_key=${e.trackingKey}`}n(Ku,"getCookieValue");function Hu(e){let t="daxsub",r=Ku(e),o=encodeURIComponent(r);Te(t,o,1)}n(Hu,"setDaxsubCookie");function Mr(){return new pe().withAttributes(["trackingKey","extraData"]).fetch().then(({attributes:e,state:t})=>{if(!t.isLoggedIn){de("daxsub");return}Hu(e)}).catch(e=>{F.error(`Setting daxsub cookie failed. Error: ${e.message}`,e)})}n(Mr,"daxSubCookieHandler");var zu=[Ko,Fr,Mr,Vo];function Qu(){return O(this,null,function*(){for(let e of zu)yield e()})}n(Qu,"performJobs");var or;(function(t){t.LOADED="amedia-user.janitor.loaded"})(or||(or={}));var zo=n(()=>O(void 0,null,function*(){let e=!1;ye(or.LOADED,()=>{e||(e=!0,Qu())}),ee(new CustomEvent(or.LOADED))}),"runJanitor");var Qo=n(()=>{ye(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(Xo()),_t=we(ti());var $r,ir=typeof self=="undefined"?window:self,ri=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(ri){let e=new Uint8Array(16);$r=n(function(){return ri(e),e},"whatwgRNG")}else{let e=new Array(16);$r=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 ni=[];for(let e=0;e<256;++e)ni[e]=(e+256).toString(16).substr(1);function Ju(e,t){let r=t||0,o=ni;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(Ju,"bytesToUuid");function Vr(){let e=$r();return e[6]=e[6]&15|64,e[8]=e[8]&63|128,Ju(e)}n(Vr,"uuid");function oi(e){let t=!1;return(...r)=>{t||(e.apply(this,r),t=!0,setTimeout(()=>{t=!1},400))}}n(oi,"throttle");sr.default.config({name:"aid:userdata"});var ii=self.location.hostname.replace(/(.*\.)([^.]+\.\w+$)/,"$2");function si(){let e=_t.default.get("amedia:fpbid");return e||(e=Vr(),_t.default.set("amedia:fpbid",e,{expires:365*10,domain:ii,sameSite:"strict"})),Promise.resolve(e)}n(si,"getBrowserId");function Xu(){let e=_t.default.get("amedia:visitid");return e?Promise.resolve(e):sr.default.getItem("visitid")}n(Xu,"getVisitIdFromStorage");function ai(e){return _t.default.set("amedia:visitid",e,{expires:new Date(Date.now()+18e5),domain:ii,sameSite:"strict"}),sr.default.setItem("visitid",e).then(()=>e)}n(ai,"storeVisitId");function ui(){let e=Date.now(),t=`${Vr()}|${e}`;return ai(t)}n(ui,"createVisitId");function Zu(){return Xu().then(e=>e||ui()).then(e=>{let[t,r]=e.split("|");return!t||r&&Date.now()-18e5>r?ui():ai(`${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,oi(Zu)));var $e=we(xe());var ke=we(xe());var ec=5*6e4,ci=(0,ke.Record)({namespaces:(0,ke.Dictionary)(ke.Unknown,ke.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");function li(e,t){return{namespaces:Object.entries(t.namespaces).reduce((r,[o,a])=>ce(ne({},r),{[o]:a}),(e==null?void 0:e.namespaces)||{})}}n(li,"mergeCache");var di=n((e,t)=>O(void 0,null,function*(){let r=yield he.get("europa",ci),o=li(r,{namespaces:{[e]:t}});return he.set("europa",o,Date.now()+ec)}),"updateNamespaceInCache"),pi=n((e,t)=>O(void 0,null,function*(){let r=yield fi(`/api/europa/v1/me/${e}`,"PATCH",t);return r.ok?di(e,t):(F.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");let a=e,p=yield he.get("europa",ci);if(!t.ignoreCache&&(a=p?e.filter(m=>!Object.keys(p.namespaces).includes(m)):e,p&&a.length===0))return Promise.resolve(p.namespaces);let d=yield fi(`/api/europa/v1/me/${a.join(",")}`).then(m=>O(void 0,null,function*(){let g=yield m.text();return m.ok?JSON.parse(g):(m.status!==400&&F.error(`Could not get namespaces for: ${e}, status: ${m.status}`,{response:m,body:g}),{namespaces:{}})}));return Object.entries(d.namespaces).forEach(([m,g])=>di(m,g)),Promise.resolve(Object.entries(li(p,d).namespaces).filter(([m])=>e.includes(m)).reduce((m,[g,S])=>ce(ne({},m),{[g]:S}),{}))}),"getNamespaces");var tc=5*6e4,rc="privacyPreferences",nc=(0,$e.Record)({allowResearchUsage:$e.Boolean,connectWithSurveys:$e.Boolean,personalizedAds:$e.Boolean,personalizedContent:$e.Boolean}),ur=n(e=>e==="true"||e===!0,"toBoolean"),mi=n(()=>O(void 0,null,function*(){return _e(rc,nc,()=>ar(["privacy_preferences"]).then(e=>{let t=e.privacy_preferences;return{ttl:tc,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(xe());var vi=(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})),oc=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:vi.check(a)}}catch(p){throw F.error(p,{json:a}),p}})},"getNebulaData"),ic=n(e=>({extraData:e}),"mapNebulaToUserData"),hi=n((e,t,r)=>_e("getNebulaInfo",vi,()=>oc(e,t,r)).then(ic),"getInfo");var Gr=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=>Gr().then(t=>{t&&e()})),"whenIsLoggedIn");var sc=n(()=>Promise.all([si(),Gr()]).then(([e,t])=>{var r;return hi(fe(),e,t&&((r=Q.get("userAttributes"))==null?void 0:r.trackingKey)||void 0)}),"getExtraData"),ac={uuid:er,name:er,trackingKey:er,access:()=>ut().then(()=>Fo()),extraData:sc,privacyPreferences:()=>ut().then(()=>mi())},gi=n(e=>{let t=[];e.forEach(o=>{let a=ac[o];if(!a){F.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),a.uuid!==void 0&&Q.merge("state",{isLoggedIn:a.uuid!==null})}).catch(a=>{F.warn(`User attribute call failed (${o.toString()})`,a)}))}),Promise.all(r).then(()=>{})},"requestAttributes");var yi=n(()=>{Q.on("userAttributes",e=>{ee(new CustomEvent(K.ON_ATTRIBUTES_UPDATED,{detail:e}))}),ye(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&&gi(o)})},"listenForUserAttributeRequests");var Ei=n(e=>{ar(e).then(t=>{Q.merge("storage",t)})},"requestStorage"),bi=n(e=>Object.keys(e).forEach(t=>pi(t,e[t])),"updateStorage");var _i=n(()=>{Q.on("storage",e=>{ee(new CustomEvent(K.ON_STORAGE_UPDATED,{detail:e}))}),ye(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&&Ei(o)})}),ye(K.UPDATE_STORAGE,e=>{ut().then(()=>{bi(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 Yr=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 pe().withAttributes(["name"]).fetch();if(!t)return yield Ho(),{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(Mo(this.requestedUrl))throw new Ve("Unlock check already performed.",Ve.ERROR_RELOADED_NO_ACCESS);qo(this.requestedUrl),this.reload&&Do(),this.requestedUrl&&Lo(this.requestedUrl)}return{isLoggedIn:!0,hasAccess:!0,accessFeatures:r.accessFeatures}})}setAccessCookiesAndGetAccessFeatures(t){return jo(fe()).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(Yr,"PaywallUnlockRequest");var Si=Yr;var uc=n(e=>ko(e||Re()),"goToLoginPage"),cc=n(()=>Zt(),"logout"),fc=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"),lc=n(e=>{ee(new CustomEvent(K.UPDATE_STORAGE,{detail:e}))},"updateStorage");typeof process=="undefined"&&(Qo(),yi(),_i(),zo());
|
|
1
|
+
var Ss=Object.create;var We=Object.defineProperty,ws=Object.defineProperties,Rs=Object.getOwnPropertyDescriptor,Cs=Object.getOwnPropertyDescriptors,Ts=Object.getOwnPropertyNames,mn=Object.getOwnPropertySymbols,As=Object.getPrototypeOf,vn=Object.prototype.hasOwnProperty,Os=Object.prototype.propertyIsEnumerable;var hn=(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={}))vn.call(t,r)&&hn(e,r,t[r]);if(mn)for(var r of mn(t))Os.call(t,r)&&hn(e,r,t[r]);return e},ce=(e,t)=>ws(e,Cs(t)),gn=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),Is=(e,t)=>{gn(e);for(var r in t)We(e,r,{get:t[r],enumerable:!0})},Ns=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ts(t))!vn.call(e,o)&&o!=="default"&&We(e,o,{get:()=>t[o],enumerable:!(r=Rs(t,o))||r.enumerable});return e},we=e=>Ns(gn(We(e!=null?Ss(As(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 p=g=>{try{m(r.next(g))}catch(S){a(S)}},d=g=>{try{m(r.throw(g))}catch(S){a(S)}},m=g=>g.done?o(g.value):Promise.resolve(g.value).then(p,d);m((r=r.apply(e,t)).next())});var _n=D(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0})});var br=D(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.Failcode=void 0;At.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 qs=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 p in a)Object.prototype.hasOwnProperty.call(a,p)&&(o[p]=a[p])},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 Ms=function(e){qs(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=Ms});var Ot=D(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});var Ee=n(function(e,t){return function(r){var o=n(function(d){return e?"("+d+")":d},"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""+Sn(r)+Ee(!0,t)(r.element)+"[]";case"dictionary":return"{ [_: "+r.key+"]: "+Ee(!1,t)(r.value)+" }";case"record":{var p=Object.keys(r.fields);return p.length?"{ "+p.map(function(d){return""+Sn(r)+d+Bs(r,d)+": "+(r.fields[d].tag==="optional"?Ee(!1,t)(r.fields[d].underlying):Ee(!1,t)(r.fields[d]))+";"}).join(" ")+" }":"{}"}case"tuple":return"["+r.components.map(Ee(!1,t)).join(", ")+"]";case"union":return o(""+r.alternatives.map(Ee(!0,t)).join(" | "));case"intersect":return o(""+r.intersectees.map(Ee(!0,t)).join(" & "));case"optional":return Ee(e,t)(r.underlying)+" | undefined";case"constraint":return r.name||Ee(e,t)(r.underlying);case"instanceof":return r.ctor.name;case"brand":return Ee(e,t)(r.entity)}}finally{t.delete(r)}throw Error("impossible")}},"show");_r.default=Ee(!1,new Set);function Bs(e,t){var r=e.isPartial,o=e.fields;return r||t!==void 0&&o[t].tag==="optional"?"?":""}n(Bs,"partialTag");function Sn(e){var t=e.isReadonly;return t?"readonly ":""}n(Sn,"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 be=br(),Je=Ot();function $s(e,t){return typeof t=="object"&&t!==null&&e in t}n($s,"hasKey");M.hasKey=$s;var Vs=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=Vs;var Gs=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=Gs;function Ys(e){return{success:!0,value:e}}n(Ys,"SUCCESS");M.SUCCESS=Ys;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(be.Failcode.TYPE_INCORRECT,r)},VALUE_INCORRECT:function(e,t,r){return M.FAILURE(be.Failcode.VALUE_INCORRECT,"Expected "+e+" "+String(t)+", but was "+String(r))},KEY_INCORRECT:function(e,t,r){return M.FAILURE(be.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(be.Failcode.CONTENT_INCORRECT,r,t)},ARGUMENT_INCORRECT:function(e){return M.FAILURE(be.Failcode.ARGUMENT_INCORRECT,e)},RETURN_INCORRECT:function(e){return M.FAILURE(be.Failcode.RETURN_INCORRECT,e)},CONSTRAINT_FAILED:function(e,t){var r=t?": "+t:"";return M.FAILURE(be.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(be.Failcode.PROPERTY_MISSING,t)},PROPERTY_PRESENT:function(e){var t="Expected nothing, but was "+M.typeOf(e);return M.FAILURE(be.Failcode.PROPERTY_PRESENT,t)},NOTHING_EXPECTED:function(e){var t="Expected nothing, but was "+M.typeOf(e);return M.FAILURE(be.Failcode.NOTHING_EXPECTED,t)}})});var wn=D(Ie=>{"use strict";var Ws=Ie&&Ie.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),a,p=[],d;try{for(;(t===void 0||t-- >0)&&!(a=o.next()).done;)p.push(a.value)}catch(m){d={error:m}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(d)throw d.error}}return p},Ks=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.Contract=void 0;var Hs=Qe(),zs=z();function Qs(){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(p){return function(){for(var d=[],m=0;m<arguments.length;m++)d[m]=arguments[m];if(d.length<o.length){var g="Expected "+o.length+" arguments but only received "+d.length,S=zs.FAILURE.ARGUMENT_INCORRECT(g);throw new Hs.ValidationError(S)}for(var w=0;w<o.length;w++)o[w].check(d[w]);return a.check(p.apply(void 0,Ks([],Ws(d))))}}}}n(Qs,"Contract");Ie.Contract=Qs});var Tn=D(Ne=>{"use strict";var Js=Ne&&Ne.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),a,p=[],d;try{for(;(t===void 0||t-- >0)&&!(a=o.next()).done;)p.push(a.value)}catch(m){d={error:m}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(d)throw d.error}}return p},Xs=Ne&&Ne.__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(Ne,"__esModule",{value:!0});Ne.AsyncContract=void 0;var Rn=Qe(),Cn=z();function Zs(){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(p){return function(){for(var d=[],m=0;m<arguments.length;m++)d[m]=arguments[m];if(d.length<o.length){var g="Expected "+o.length+" arguments but only received "+d.length,S=Cn.FAILURE.ARGUMENT_INCORRECT(g);throw new Rn.ValidationError(S)}for(var w=0;w<o.length;w++)o[w].check(d[w]);var C=p.apply(void 0,Xs([],Js(d)));if(!(C instanceof Promise)){var g="Expected function to return a promise, but instead got "+C,S=Cn.FAILURE.RETURN_INCORRECT(g);throw new Rn.ValidationError(S)}return C.then(a.check)}}}}n(Zs,"AsyncContract");Ne.AsyncContract=Zs});var An=D(Pe=>{"use strict";var ea=Pe&&Pe.__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.")},ta=Pe&&Pe.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),a,p=[],d;try{for(;(t===void 0||t-- >0)&&!(a=o.next()).done;)p.push(a.value)}catch(m){d={error:m}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(d)throw d.error}}return p};Object.defineProperty(Pe,"__esModule",{value:!0});Pe.match=void 0;function ra(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(r){var o,a;try{for(var p=ea(e),d=p.next();!d.done;d=p.next()){var m=ta(d.value,2),g=m[0],S=m[1];if(g.guard(r))return S(r)}}catch(w){o={error:w}}finally{try{d&&!d.done&&(a=p.return)&&a.call(p)}finally{if(o)throw o.error}}throw new Error("No alternatives were matched")}}n(ra,"match");Pe.match=ra});var J=D(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.innerValidate=Xe.create=void 0;var Ue=xe(),na=Ot(),oa=Qe(),ia=z();function sa(e,t){return t.check=r,t.assert=r,t._innerValidate=function(C,h){return h.has(C,t)?ia.SUCCESS(C):e(C,h)},t.validate=function(C){return t._innerValidate(C,ua())},t.guard=o,t.Or=a,t.And=p,t.optional=d,t.nullable=m,t.withConstraint=g,t.withGuard=S,t.withBrand=w,t.reflect=t,t.toString=function(){return"Runtype<"+na.default(t)+">"},t;function r(C){var h=t.validate(C);if(h.success)return h.value;throw new oa.ValidationError(h)}n(r,"check");function o(C){return t.validate(C).success}n(o,"guard");function a(C){return Ue.Union(t,C)}n(a,"Or");function p(C){return Ue.Intersect(t,C)}n(p,"And");function d(){return Ue.Optional(t)}n(d,"optional");function m(){return Ue.Union(t,Ue.Null)}n(m,"nullable");function g(C,h){return Ue.Constraint(t,C,h)}n(g,"withConstraint");function S(C,h){return Ue.Constraint(t,C,h)}n(S,"withGuard");function w(C){return Ue.Brand(C,t)}n(w,"withBrand")}n(sa,"create");Xe.create=sa;function aa(e,t,r){return e._innerValidate(t,r)}n(aa,"innerValidate");Xe.innerValidate=aa;function ua(){var e=new WeakMap,t=n(function(o,a){if(!(o===null||typeof o!="object")){var p=e.get(o);e.set(o,p?p.set(a,!0):new WeakMap().set(a,!0))}},"add"),r=n(function(o,a){var p=e.get(o),d=p&&p.get(a)||!1;return t(o,a),d},"has");return{has:r}}n(ua,"VisitedState")});var Nt=D(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.Unknown=void 0;var ca=J(),fa=z(),la={tag:"unknown"};It.Unknown=ca.create(function(e){return fa.SUCCESS(e)},la)});var On=D(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.Never=void 0;var da=J(),pa=z(),ma={tag:"never"};Pt.Never=da.create(pa.FAILURE.NOTHING_EXPECTED,ma)});var In=D(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.Void=void 0;var va=Nt();Ut.Void=va.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 ha(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=n(function(){for(var a=[],p=0;p<arguments.length;p++)a[p]=arguments[p];return function(d){for(var m=0;m<e.length;m++)if(e[m].guard(d))return a[m](d)}},"match"),o={tag:"union",alternatives:e,match:r};return Dt.create(function(a,p){var d,m,g,S,w,C,h,T;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,p).success)return mt.SUCCESS(a)}}catch(re){d={error:re}}finally{try{L&&!L.done&&(m=P.return)&&m.call(P)}finally{if(d)throw d.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,p)}}}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 k=xt(e),H=k.next();!H.done;H=k.next()){var oe=H.value;if(Dt.innerValidate(oe,a,p).success)return mt.SUCCESS(a)}}catch(re){h={error:re}}finally{try{H&&!H.done&&(T=k.return)&&T.call(k)}finally{if(h)throw h.error}}return mt.FAILURE.TYPE_INCORRECT(o,a)},o)}n(ha,"Union");Ze.Union=ha});var Un=D(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.Nullish=me.Null=me.Undefined=me.Literal=void 0;var ga=J(),Nn=z(),ya=wr();function Pn(e){return Array.isArray(e)?String(e.map(String)):typeof e=="bigint"?String(e)+"n":String(e)}n(Pn,"literal");function Rr(e){var t={tag:"literal",value:e};return ga.create(function(r){return r===e?Nn.SUCCESS(r):Nn.FAILURE.VALUE_INCORRECT("literal","`"+Pn(e)+"`","`"+Pn(r)+"`")},t)}n(Rr,"Literal");me.Literal=Rr;me.Undefined=Rr(void 0);me.Null=Rr(null);me.Nullish=ya.Union(me.Null,me.Undefined)});var Ln=D(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.Boolean=void 0;var Ea=J(),xn=z(),Dn={tag:"boolean"};Lt.Boolean=Ea.create(function(e){return typeof e=="boolean"?xn.SUCCESS(e):xn.FAILURE.TYPE_INCORRECT(Dn,e)},Dn)});var jn=D(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.Number=void 0;var ba=J(),kn=z(),Fn={tag:"number"};kt.Number=ba.create(function(e){return typeof e=="number"?kn.SUCCESS(e):kn.FAILURE.TYPE_INCORRECT(Fn,e)},Fn)});var Bn=D(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.BigInt=void 0;var _a=J(),qn=z(),Mn={tag:"bigint"};Ft.BigInt=_a.create(function(e){return typeof e=="bigint"?qn.SUCCESS(e):qn.FAILURE.TYPE_INCORRECT(Mn,e)},Mn)});var Cr=D(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.String=void 0;var Sa=J(),$n=z(),Vn={tag:"string"};jt.String=Sa.create(function(e){return typeof e=="string"?$n.SUCCESS(e):$n.FAILURE.TYPE_INCORRECT(Vn,e)},Vn)});var Kn=D(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.Symbol=void 0;var Gn=J(),vt=z(),wa=n(function(e){var t={tag:"symbol",key:e};return Gn.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",Wn(e),Wn(o)):vt.SUCCESS(r)},t)},"f"),Yn={tag:"symbol"};qt.Symbol=Gn.create(function(e){return typeof e=="symbol"?vt.SUCCESS(e):vt.FAILURE.TYPE_INCORRECT(Yn,e)},Object.assign(wa,Yn));var Wn=n(function(e){return e===void 0?"undefined":'"'+e+'"'},"quoteIfPresent")});var Qn=D(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.Array=void 0;var Hn=J(),ht=z();function zn(e,t){var r={tag:"array",isReadonly:t,element:e};return Ca(Hn.create(function(o,a){if(!Array.isArray(o))return ht.FAILURE.TYPE_INCORRECT(r,o);var p=ht.enumerableKeysOf(o),d=p.map(function(g){return Hn.innerValidate(e,o[g],a)}),m=p.reduce(function(g,S){var w=d[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(zn,"InternalArr");function Ra(e){return zn(e,!1)}n(Ra,"Arr");Mt.Array=Ra;function Ca(e){return e.asReadonly=t,e;function t(){return zn(e.element,!0)}n(t,"asReadonly")}n(Ca,"withExtraModifierFuncs")});var Xn=D(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.Tuple=void 0;var Jn=J(),et=z();function Ta(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r={tag:"tuple",components:e};return Jn.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 p=et.enumerableKeysOf(o),d=p.map(function(g){return Jn.innerValidate(e[g],o[g],a)}),m=p.reduce(function(g,S){var w=d[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(Ta,"Tuple");Bt.Tuple=Ta});var eo=D(ve=>{"use strict";var Tr=ve&&ve.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),a,p=[],d;try{for(;(t===void 0||t-- >0)&&!(a=o.next()).done;)p.push(a.value)}catch(m){d={error:m}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(d)throw d.error}}return p},Ar=ve&&ve.__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(ve,"__esModule",{value:!0});ve.Partial=ve.Record=ve.InternalRecord=void 0;var Zn=J(),le=z();function De(e,t,r){var o={tag:"record",isPartial:t,isReadonly:r,fields:e};return Ia(Zn.create(function(a,p){if(a==null)return le.FAILURE.TYPE_INCORRECT(o,a);var d=le.enumerableKeysOf(e);if(d.length!==0&&typeof a!="object")return le.FAILURE.TYPE_INCORRECT(o,a);var m=Ar([],Tr(new Set(Ar(Ar([],Tr(d)),Tr(le.enumerableKeysOf(a)))))),g=m.reduce(function(w,C){var h=le.hasKey(C,e),T=le.hasKey(C,a);if(h){var P=e[C],L=t||P.reflect.tag==="optional";if(T){var $=a[C];L&&$===void 0?w[C]=le.SUCCESS($):w[C]=Zn.innerValidate(P,$,p)}else L?w[C]=le.SUCCESS(void 0):w[C]=le.FAILURE.PROPERTY_MISSING(P.reflect)}else if(T){var $=a[C];w[C]=le.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 le.enumerableKeysOf(S).length!==0?le.FAILURE.CONTENT_INCORRECT(o,S):le.SUCCESS(a)},o))}n(De,"InternalRecord");ve.InternalRecord=De;function Aa(e){return De(e,!1,!1)}n(Aa,"Record");ve.Record=Aa;function Oa(e){return De(e,!0,!1)}n(Oa,"Partial");ve.Partial=Oa;function Ia(e){return e.asPartial=t,e.asReadonly=r,e.pick=o,e.omit=a,e.extend=p,e;function t(){return De(e.fields,!0,e.isReadonly)}n(t,"asPartial");function r(){return De(e.fields,e.isPartial,!0)}n(r,"asReadonly");function o(){for(var d=[],m=0;m<arguments.length;m++)d[m]=arguments[m];var g={};return d.forEach(function(S){g[S]=e.fields[S]}),De(g,e.isPartial,e.isReadonly)}n(o,"pick");function a(){for(var d=[],m=0;m<arguments.length;m++)d[m]=arguments[m];var g={},S=le.enumerableKeysOf(e.fields);return S.forEach(function(w){d.includes(w)||(g[w]=e.fields[w])}),De(g,e.isPartial,e.isReadonly)}n(a,"omit");function p(d){return De(Object.assign({},e.fields,d),e.isPartial,e.isReadonly)}n(p,"extend")}n(Ia,"withExtraModifierFuncs")});var Ir=D(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.Guard=tt.Constraint=void 0;var Na=J(),Or=z(),Pa=Nt();function Ua(e,t,r){var o=r&&r.name,a=r&&r.args,p={tag:"constraint",underlying:e,constraint:t,name:o,args:a};return Na.create(function(d){var m=e.validate(d);if(!m.success)return m;var g=t(m.value);return typeof g=="string"?Or.FAILURE.CONSTRAINT_FAILED(p,g):g?Or.SUCCESS(m.value):Or.FAILURE.CONSTRAINT_FAILED(p)},p)}n(Ua,"Constraint");tt.Constraint=Ua;var xa=n(function(e,t){return Pa.Unknown.withGuard(e,t)},"Guard");tt.Guard=xa});var ro=D($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.Dictionary=void 0;var to=J(),Nr=Cr(),Da=Ir(),La=Ot(),je=z(),ka=Da.Constraint(Nr.String,function(e){return!isNaN(+e)},{name:"number"});function Fa(e,t){var r=t===void 0||t==="string"?Nr.String:t==="number"?ka:t,o=La.default(r),a={tag:"dictionary",key:o,value:e};return to.create(function(p,d){if(p==null||typeof p!="object"||Object.getPrototypeOf(p)!==Object.prototype&&(!Array.isArray(p)||o==="string"))return je.FAILURE.TYPE_INCORRECT(a,p);var m=/^(?:NaN|-?\d+(?:\.\d+)?)$/,g=je.enumerableKeysOf(p),S=g.reduce(function(C,h){var T=typeof h=="string"&&m.test(h),P=T?globalThis.Number(h):h;return(T?!r.guard(P)&&!r.guard(h):!r.guard(P))?C[h]=je.FAILURE.KEY_INCORRECT(a,r.reflect,P):C[h]=to.innerValidate(e,p[h],d),C},{}),w=g.reduce(function(C,h){var T=S[h];return T.success||(C[h]=T.details||T.message),C},{});return je.enumerableKeysOf(w).length!==0?je.FAILURE.CONTENT_INCORRECT(a,w):je.SUCCESS(p)},a)}n(Fa,"Dictionary");$t.Dictionary=Fa});var oo=D(rt=>{"use strict";var ja=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 no=J(),qa=z();function Ma(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r={tag:"intersect",intersectees:e};return no.create(function(o,a){var p,d;try{for(var m=ja(e),g=m.next();!g.done;g=m.next()){var S=g.value,w=no.innerValidate(S,o,a);if(!w.success)return w}}catch(C){p={error:C}}finally{try{g&&!g.done&&(d=m.return)&&d.call(m)}finally{if(p)throw p.error}}return qa.SUCCESS(o)},r)}n(Ma,"Intersect");rt.Intersect=Ma});var io=D(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.Optional=void 0;var Ba=J(),$a=z();function Va(e){var t={tag:"optional",underlying:e};return Ba.create(function(r){return r===void 0?$a.SUCCESS(r):e.validate(r)},t)}n(Va,"Optional");Vt.Optional=Va});var uo=D(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.Function=void 0;var Ga=J(),so=z(),ao={tag:"function"};Gt.Function=Ga.create(function(e){return typeof e=="function"?so.SUCCESS(e):so.FAILURE.TYPE_INCORRECT(ao,e)},ao)});var fo=D(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.InstanceOf=void 0;var Ya=J(),co=z();function Wa(e){var t={tag:"instanceof",ctor:e};return Ya.create(function(r){return r instanceof e?co.SUCCESS(r):co.FAILURE.TYPE_INCORRECT(t,r)},t)}n(Wa,"InstanceOf");Yt.InstanceOf=Wa});var lo=D(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.Lazy=void 0;var Ka=J();function Ha(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"),Ka.create(function(a){return o().validate(a)},t)}n(Ha,"Lazy");Wt.Lazy=Ha});var po=D(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.Brand=void 0;var za=J();function Qa(e,t){var r={tag:"brand",brand:e,entity:t};return za.create(function(o){return t.validate(o)},r)}n(Qa,"Brand");Kt.Brand=Qa});var mo=D(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.checked=nt.check=void 0;var Ja=Qe(),Xa=z(),Pr=new WeakMap;function Za(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(Za,"check");nt.check=Za;function eu(e,t,r){var o=Pr.get(e),a=o&&o.get(t);if(a)return a;for(var p=[],d=0;d<r;d++)p.push(d);return p}n(eu,"getValidParameterIndices");function tu(){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 p=a.value,d=(r.name||r.constructor.name+".prototype")+(typeof o=="string"?'["'+o+'"]':"["+String(o)+"]"),m=eu(r,o,e.length);if(m.length!==e.length)throw new Error("Number of `@checked` runtypes and @check parameters not matched.");if(m.length>p.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],T=w.validate(g[h]);if(!T.success){var P=d+", argument #"+h+": "+T.message,L=Xa.FAILURE.ARGUMENT_INCORRECT(P);throw new Ja.ValidationError(L)}}),p.apply(this,g)}}}n(tu,"checked");nt.checked=tu});var xe=D(I=>{"use strict";var ru=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)&&ru(t,e,r)};Object.defineProperty(I,"__esModule",{value:!0});I.InstanceOf=I.Nullish=I.Null=I.Undefined=I.Literal=void 0;Y(_n(),I);Y(br(),I);Y(wn(),I);Y(Tn(),I);Y(An(),I);Y(Qe(),I);Y(Nt(),I);Y(On(),I);Y(In(),I);var Ht=Un();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(Ln(),I);Y(jn(),I);Y(Bn(),I);Y(Cr(),I);Y(Kn(),I);Y(Qn(),I);Y(Xn(),I);Y(eo(),I);Y(ro(),I);Y(wr(),I);Y(oo(),I);Y(io(),I);Y(uo(),I);var nu=fo();Object.defineProperty(I,"InstanceOf",{enumerable:!0,get:function(){return nu.InstanceOf}});Y(lo(),I);Y(Ir(),I);Y(po(),I);Y(mo(),I)});var wo=D(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});var _o=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"),So=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]))):_o(r[a])&&_o(o[a])?r[a]=So(r[a],o[a]):r[a]=o[a]}),r},{})},"merge");Dr.default=So});var Xo=D((Jo,Br)=>{(function(e){if(typeof Jo=="object"&&typeof Br!="undefined")Br.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,p,d){function m(w,C){if(!p[w]){if(!a[w]){var h=typeof require=="function"&&require;if(!C&&h)return h(w,!0);if(g)return g(w,!0);var T=new Error("Cannot find module '"+w+"'");throw T.code="MODULE_NOT_FOUND",T}var P=p[w]={exports:{}};a[w][0].call(P.exports,function(L){var $=a[w][1][L];return m($||L)},P,P.exports,o,a,p,d)}return p[w].exports}n(m,"s");for(var g=typeof require=="function"&&require,S=0;S<d.length;S++)m(d[S]);return m},"e")({1:[function(o,a,p){(function(d){"use strict";var m=d.MutationObserver||d.WebKitMutationObserver,g;if(m){var S=0,w=new m(L),C=d.document.createTextNode("");w.observe(C,{characterData:!0}),g=n(function(){C.data=S=++S%2},"scheduleDrain")}else if(!d.setImmediate&&typeof d.MessageChannel!="undefined"){var h=new d.MessageChannel;h.port1.onmessage=L,g=n(function(){h.port2.postMessage(0)},"scheduleDrain")}else"document"in d&&"onreadystatechange"in d.document.createElement("script")?g=n(function(){var G=d.document.createElement("script");G.onreadystatechange=function(){L(),G.onreadystatechange=null,G.parentNode.removeChild(G),G=null},d.document.documentElement.appendChild(G)},"scheduleDrain"):g=n(function(){setTimeout(L,0)},"scheduleDrain");var T,P=[];function L(){T=!0;for(var G,se,W=P.length;W;){for(se=P,P=[],G=-1;++G<W;)se[G]();W=P.length}T=!1}n(L,"nextTick"),a.exports=$;function $(G){P.push(G)===1&&!T&&g()}n($,"immediate")}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(o,a,p){"use strict";var d=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 k=this.state===w?R:x;P(N,k,this.outcome)}else this.queue.push(new T(N,R,x));return N};function T(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(T,"QueueItem"),T.prototype.callFulfilled=function(R){g.resolve(this.promise,R)},T.prototype.otherCallFulfilled=function(R){P(this.promise,this.onFulfilled,R)},T.prototype.callRejected=function(R){g.reject(this.promise,R)},T.prototype.otherCallRejected=function(R){P(this.promise,this.onRejected,R)};function P(R,x,N){d(function(){var k;try{k=x(N)}catch(H){return g.reject(R,H)}k===R?g.reject(R,new TypeError("Cannot resolve promise with itself")):g.resolve(R,k)})}n(P,"unwrap"),g.resolve=function(R,x){var N=G(L,x);if(N.status==="error")return g.reject(R,N.value);var k=N.value;if(k)$(R,k);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,k=R.queue.length;++N<k;)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 k(X){N||(N=!0,g.reject(R,X))}n(k,"onError");function H(X){N||(N=!0,g.resolve(R,X))}n(H,"onSuccess");function oe(){x(H,k)}n(oe,"tryToUnwrap");var re=G(oe);re.status==="error"&&k(re.value)}n($,"safelyResolveThenable");function G(R,x){var N={};try{N.value=R(x),N.status="success"}catch(k){N.status="error",N.value=k}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,k=!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){k||(k=!0,g.reject(X,Ge))});function cr(Ge){H[St]=Ge,++oe===N&&!k&&(k=!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,k=!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){k||(k=!0,g.resolve(oe,ue))},function(ue){k||(k=!0,g.reject(oe,ue))})}}n(ae,"race")},{"1":1}],3:[function(o,a,p){(function(d){"use strict";typeof d.Promise!="function"&&(d.Promise=o(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"2":2}],4:[function(o,a,p){"use strict";var d=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 T(i,u){u&&i.then(function(s){u(null,s)},function(s){u(s)})}n(T,"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 k(i){return typeof se=="boolean"?h.resolve(se):N(i).then(function(u){return se=u,se})}n(k,"_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]||Kr(),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 Wr(i){return i&&i.__local_forage_encoded_blob}n(Wr,"_isEncodedBlob");function wi(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(wi,"_fullyReady");function Ri(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(Ri,"_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 Ri(i).then(function(){Se(i,u,s,f-1)})}).catch(s);s(c)}}n(Se,"createTransaction");function Kr(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}n(Kr,"createDbContext");function Ci(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=Kr(),W[s.name]=l),l.forages.push(u),u._initReady||(u._initReady=u.ready,u.ready=wi);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 A=0;A<b.length;A++){var U=b[A];U!==u&&(U._dbInfo.db=s.db,U._dbInfo.version=s.version)}})}n(Ci,"_initStorage");function Ti(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),Wr(_)&&(_=Ge(_)),l(_)},b.onerror=function(){c(b.error)}}catch(_){c(_)}})}).catch(c)});return T(f,u),f}n(Ti,"getItem");function Ai(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 A=b.result;if(A){var U=A.value;Wr(U)&&(U=Ge(U));var j=i(U,A.key,_++);j!==void 0?l(j):A.continue()}else l()},b.onerror=function(){c(b.error)}}catch(A){c(A)}})}).catch(c)});return T(f,u),f}n(Ai,"iterate");function Oi(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]"?k(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 A=_.objectStore(f._dbInfo.storeName);E===null&&(E=void 0);var U=A.put(E,i);_.oncomplete=function(){E===void 0&&(E=null),c(E)},_.onabort=_.onerror=function(){var j=U.error?U.error:U.transaction.error;v(j)}}catch(j){v(j)}})}).catch(v)});return T(l,s),l}n(Oi,"setItem");function Ii(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 T(f,u),f}n(Ii,"removeItem");function Ni(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 T(s,i),s}n(Ni,"clear");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.count();E.onsuccess=function(){f(E.result)},E.onerror=function(){l(E.error)}}catch(b){l(b)}})}).catch(l)});return T(s,i),s}n(Pi,"length");function Ui(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 A=_.result;if(!A){l(null);return}i===0||b?l(A.key):(b=!0,A.advance(i))},_.onerror=function(){c(_.error)}}catch(A){c(A)}})}).catch(c)});return T(f,u),f}n(Ui,"key");function xi(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 T(s,i),s}n(xi,"keys");function Di(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 A=0;A<_.length;A++){var U=_[A];U._dbInfo.db=null,U._dbInfo.version=E}var j=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 j.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 A=b[_];A._dbInfo.db=null}var U=new h(function(j,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(),j(Z)}});return U.then(function(j){E.db=j;for(var q=0;q<b.length;q++){var te=b[q];oe(te._dbInfo)}}).catch(function(j){throw(re(i,j)||h.resolve()).catch(function(){}),j})})}return T(l,u),l}n(Di,"dropInstance");var Li={_driver:"asyncStorage",_initStorage:Ci,_support:w(),iterate:Ai,getItem:Ti,setItem:Oi,removeItem:Ii,clear:Ni,length:Pi,key:Ui,keys:xi,dropInstance:Di};function ki(){return typeof openDatabase=="function"}n(ki,"isWebSQLValid");var Ae="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fi="~~local_forage_type~",Hr=/^~~local_forage_type~([^~]+)~/,wt="__lfsc__:",fr=wt.length,lr="arbf",dr="blob",zr="si08",Qr="ui08",Jr="uic8",Xr="si16",Zr="si32",en="ur16",tn="ui32",rn="fl32",nn="fl64",on=fr+lr.length,sn=Object.prototype.toString;function an(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(an,"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 ji(i,u){var s="";if(i&&(s=sn.call(i)),i&&(s==="[object ArrayBuffer]"||i.buffer&&sn.call(i.buffer)==="[object ArrayBuffer]")){var f,l=wt;i instanceof ArrayBuffer?(f=i,l+=lr):(f=i.buffer,s==="[object Int8Array]"?l+=zr:s==="[object Uint8Array]"?l+=Qr:s==="[object Uint8ClampedArray]"?l+=Jr:s==="[object Int16Array]"?l+=Xr:s==="[object Uint16Array]"?l+=en:s==="[object Int32Array]"?l+=Zr:s==="[object Uint32Array]"?l+=tn:s==="[object Float32Array]"?l+=rn:s==="[object Float64Array]"?l+=nn: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=Fi+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(ji,"serialize");function qi(i){if(i.substring(0,fr)!==wt)return JSON.parse(i);var u=i.substring(on),s=i.substring(fr,on),f;if(s===dr&&Hr.test(u)){var l=u.match(Hr);f=l[1],u=u.substring(l[0].length)}var c=an(u);switch(s){case lr:return c;case dr:return C([c],{type:f});case zr:return new Int8Array(c);case Qr:return new Uint8Array(c);case Jr:return new Uint8ClampedArray(c);case Xr:return new Int16Array(c);case en:return new Uint16Array(c);case Zr:return new Int32Array(c);case tn:return new Uint32Array(c);case rn:return new Float32Array(c);case nn:return new Float64Array(c);default:throw new Error("Unkown type: "+s)}}n(qi,"deserialize");var mr={serialize:ji,deserialize:qi,stringToBuffer:an,bufferToString:pr};function un(i,u,s,f){i.executeSql("CREATE TABLE IF NOT EXISTS "+u.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],s,f)}n(un,"createDbTable");function Mi(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){un(y,s,function(){u._dbInfo=s,c()},function(E,b){v(b)})},v)});return s.serializer=mr,l}n(Mi,"_initStorage$1");function Oe(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):un(E,u,function(){E.executeSql(s,f,l,c)},c)},c):c(v,y)},c)}n(Oe,"tryExecuteSql");function Bi(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){Oe(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 T(f,u),f}n(Bi,"getItem$1");function $i(i,u){var s=this,f=new h(function(l,c){s.ready().then(function(){var v=s._dbInfo;v.db.transaction(function(y){Oe(y,v,"SELECT * FROM "+v.storeName,[],function(E,b){for(var _=b.rows,A=_.length,U=0;U<A;U++){var j=_.item(U),q=j.value;if(q&&(q=v.serializer.deserialize(q)),q=i(q,j.key,U+1),q!==void 0){l(q);return}}l()},function(E,b){c(b)})})}).catch(c)});return T(f,u),f}n($i,"iterate$1");function cn(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(_,A){A?y(A):b.db.transaction(function(U){Oe(U,b,"INSERT OR REPLACE INTO "+b.storeName+" (key, value) VALUES (?, ?)",[i,_],function(){v(E)},function(j,q){y(q)})},function(U){if(U.code===U.QUOTA_ERR){if(f>0){v(cn.apply(l,[i,E,s,f-1]));return}y(U)}})})}).catch(y)});return T(c,s),c}n(cn,"_setItem");function Vi(i,u,s){return cn.apply(this,[i,u,s,1])}n(Vi,"setItem$1");function Gi(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){Oe(y,v,"DELETE FROM "+v.storeName+" WHERE key = ?",[i],function(){l()},function(E,b){c(b)})})}).catch(c)});return T(f,u),f}n(Gi,"removeItem$1");function Yi(i){var u=this,s=new h(function(f,l){u.ready().then(function(){var c=u._dbInfo;c.db.transaction(function(v){Oe(v,c,"DELETE FROM "+c.storeName,[],function(){f()},function(y,E){l(E)})})}).catch(l)});return T(s,i),s}n(Yi,"clear$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){Oe(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 T(s,i),s}n(Wi,"length$1");function Ki(i,u){var s=this,f=new h(function(l,c){s.ready().then(function(){var v=s._dbInfo;v.db.transaction(function(y){Oe(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 T(f,u),f}n(Ki,"key$1");function Hi(i){var u=this,s=new h(function(f,l){u.ready().then(function(){var c=u._dbInfo;c.db.transaction(function(v){Oe(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 T(s,i),s}n(Hi,"keys$1");function zi(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(zi,"getAllStoreNames");function Qi(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(zi(v))}).then(function(c){return new h(function(v,y){c.db.transaction(function(E){function b(j){return new h(function(q,te){E.executeSql("DROP TABLE IF EXISTS "+j,[],function(){q()},function(Z,ie){te(ie)})})}n(b,"dropTable");for(var _=[],A=0,U=c.storeNames.length;A<U;A++)_.push(b(c.storeNames[A]));h.all(_).then(function(){v()}).catch(function(j){y(j)})},function(E){y(E)})})}):l=h.reject("Invalid arguments"),T(l,u),l}n(Qi,"dropInstance$1");var Ji={_driver:"webSQLStorage",_initStorage:Mi,_support:ki(),iterate:$i,getItem:Bi,setItem:Vi,removeItem:Gi,clear:Yi,length:Wi,key:Ki,keys:Hi,dropInstance:Qi};function Xi(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(i){return!1}}n(Xi,"isLocalStorageValid");function fn(i,u){var s=i.name+"/";return i.storeName!==u.storeName&&(s+=i.storeName+"/"),s}n(fn,"_getKeyPrefix");function Zi(){var i="_localforage_support_test";try{return localStorage.setItem(i,!0),localStorage.removeItem(i),!1}catch(u){return!0}}n(Zi,"checkIfLocalStorageThrows");function es(){return!Zi()||localStorage.length>0}n(es,"_isLocalStorageUsable");function ts(i){var u=this,s={};if(i)for(var f in i)s[f]=i[f];return s.keyPrefix=fn(i,u._defaultConfig),es()?(u._dbInfo=s,s.serializer=mr,h.resolve()):h.reject()}n(ts,"_initStorage$2");function rs(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 T(s,i),s}n(rs,"clear$2");function ns(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 T(f,u),f}n(ns,"getItem$2");function os(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 A=localStorage.getItem(_);if(A&&(A=l.serializer.deserialize(A)),A=i(A,_.substring(v),E++),A!==void 0)return A}}});return T(f,u),f}n(os,"iterate$2");function is(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 T(f,u),f}n(is,"key$2");function ss(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 T(s,i),s}n(ss,"keys$2");function as(i){var u=this,s=u.keys().then(function(f){return f.length});return T(s,i),s}n(as,"length$2");function us(i,u){var s=this;i=L(i);var f=s.ready().then(function(){var l=s._dbInfo;localStorage.removeItem(l.keyPrefix+i)});return T(f,u),f}n(us,"removeItem$2");function cs(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(A){(A.name==="QuotaExceededError"||A.name==="NS_ERROR_DOM_QUOTA_REACHED")&&y(A),y(A)}})})});return T(l,s),l}n(cs,"setItem$2");function fs(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(fn(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"),T(l,u),l}n(fs,"dropInstance$2");var ls={_driver:"localStorageWrapper",_initStorage:ts,_support:Xi(),iterate:os,getItem:ns,setItem:cs,removeItem:us,clear:rs,length:as,key:is,keys:ss,dropInstance:fs},ds=n(function(u,s){return u===s||typeof u=="number"&&typeof s=="number"&&isNaN(u)&&isNaN(s)},"sameValue"),ps=n(function(u,s){for(var f=u.length,l=0;l<f;){if(ds(u[l],s))return!0;l++}return!1},"includes"),ln=Array.isArray||function(i){return Object.prototype.toString.call(i)==="[object Array]"},lt={},dn={},Ye={INDEXEDDB:Li,WEBSQL:Ji,LOCALSTORAGE:ls},ms=[Ye.INDEXEDDB._driver,Ye.WEBSQL._driver,Ye.LOCALSTORAGE._driver],Rt=["dropInstance"],vr=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Rt),vs={description:"",driver:ms.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function hs(i,u){i[u]=function(){var s=arguments;return i.ready().then(function(){return i[u].apply(i,s)})}}n(hs,"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)&&(ln(u[s])?arguments[0][s]=u[s].slice():arguments[0][s]=u[s])}return arguments[0]}n(hr,"extend");var gs=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({},vs),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":d(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"),A=0,U=_.length;A<U;A++){var j=_[A],q=!ps(Rt,j);if((q||s[j])&&typeof s[j]!="function"){y(b);return}}var te=n(function(){for(var dt=n(function(bs){return function(){var _s=new Error("Method "+bs+" is not implemented by the current driver"),pn=h.reject(_s);return T(pn,arguments[arguments.length-1]),pn}},"methodNotImplementedFactory"),gr=0,Es=Rt.length;gr<Es;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,dn[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;ln(s)||(s=[s]);var v=this._getSupportedDrivers(s);function y(){c._config.driver=c.driver()}n(y,"setDriverToConfig");function E(A){return c._extend(A),y(),c._ready=c._initStorage(c._config),c._ready}n(E,"extendSelfWithDriver");function b(A){return function(){var U=0;function j(){for(;U<A.length;){var q=A[U];return U++,c._dbInfo=null,c._ready=null,c.getDriver(q).then(E).catch(j)}y();var te=new Error("No available storage method found.");return c._driverSet=h.reject(te),c._driverSet}return n(j,"driverPromiseLoop"),j()}}n(b,"initDriver");var _=this._driverSet!==null?this._driverSet.catch(function(){return h.resolve()}):h.resolve();return this._driverSet=_.then(function(){var A=v[0];return c._dbInfo=null,c._ready=null,c.getDriver(A).then(function(U){c._driver=U._driver,y(),c._wrapLibraryMethodsWithReady(),c._initDriver=b(v)})}).catch(function(){y();var A=new Error("No available storage method found.");return c._driverSet=h.reject(A),c._driverSet}),P(this._driverSet,f,l),this._driverSet},"setDriver"),i.prototype.supports=n(function(s){return!!dn[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++)hs(this,vr[s])},"_wrapLibraryMethodsWithReady"),i.prototype.createInstance=n(function(s){return new i(s)},"createInstance"),i}(),ys=new gs;a.exports=ys},{"3":3}]},{},[4])(4)})});var ti=D((Zo,ei)=>{(function(e){var t;if(typeof define=="function"&&define.amd&&(define(e),t=!0),typeof Zo=="object"&&(ei.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 p=arguments[o];for(var d in p)a[d]=p[d]}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 p(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(T){}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(p,"set");function d(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("="),T=h.slice(1).join("=");!g&&T.charAt(0)==='"'&&(T=T.slice(1,-1));try{var P=t(h[0]);if(T=(o.read||o)(T,P)||t(T),g)try{T=JSON.parse(T)}catch(L){}if(S[P]=T,m===P)break}catch(L){}}return m?S[m]:S}}return n(d,"get"),a.set=p,a.get=function(m){return d(m,!1)},a.getJSON=function(m){return d(m,!0)},a.remove=function(m,g){p(m,"",e(g,{expires:-1}))},a.defaults={},a.withConverter=r,a}return n(r,"init"),r(function(){})})});Is(exports,{PaywallUnlockRequest:()=>Si,UserDataRequest:()=>pe,goToLoginPage:()=>uc,logout:()=>cc,tryActivateSubscriptionAccess:()=>fc,updateStorage:()=>lc});var Ps;var pt=n(()=>Ps||window.location.hostname,"getCurrentHostname"),Re=n(()=>window.location.href,"getCurrentUrl"),Us=n(()=>{let e=/^bed-([^.]+)\.api\.no$/.exec(pt()),t=/\.([^.]+)\.api\.no/.exec(pt());return e?e[1]:t?t[1]:null},"getCurrentEnvironment"),fe=n(()=>pt().replace(/\.[^.]+\.api\.no/,""),"getCurrentPublicationDomain"),Ke=n(()=>{let e=Us(),t="www.aid.no";return e==="localhost"?t="www.aid.no.localhost.api.no":e&&(t=`www-${e}.aid.no`),t},"getAidDomain");function xs(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(xs,"postLog");var Ct=n((e,t,r)=>{let o={};Object.keys(r).forEach(p=>{if(["string","number","boolean"].includes(typeof r[p])){o[p]=r[p];return}try{o[p]=JSON.stringify(r[p])}catch(d){o[p]=r[p]}});let a=ce(ne({},o),{message:t,url:Re(),domain:pt()});xs(`/api/mercury/v1/log/${e}`,a)},"backendLog"),Ds={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)},yn=Ds;var Ls;var ks=n(()=>Ls||yn,"getLogger"),Er=n(e=>{let t={message:e.message};return Object.getOwnPropertyNames(e).forEach(r=>{t[r]=e[r]}),t},"rewriteErrorObject"),En=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"),Fs=n((r,...o)=>O(void 0,[r,...o],function*(e,t={}){let a=e,p=t||{};if(a instanceof Error){let d=Er(a);a=d.message,p=ce(ne({},p),{error:d})}if(p=ce(ne({},p),{origin:"@amedia/user"}),t instanceof Error){let d=Er(t);p=ce(ne({},p),{[Object.keys(p).includes("error")?"contextError":"error"]:d})}else if(p instanceof Response){let d=yield En(p);p=ce(ne({},p),{response:d})}else for(let d of Object.keys(p))if(p[d]instanceof Error)p[d]=Er(p[d]);else if(p[d]instanceof Response){let m=yield En(p[d]);p[d]=m}return{message:a,context:p}}),"processIncomingLogData"),Tt=n((e,t,r)=>{Fs(t,r).then(({message:o,context:a})=>ks()[e](o,a))},"processAndLog"),F={debug:(e,t)=>Tt("debug",e,t),info:(e,t)=>Tt("info",e,t),warn:(e,t)=>Tt("warn",e,t),error:(e,t)=>Tt("error",e,t)};var Ce,js=n(e=>{Ce=e},"setRootElement");typeof window!="undefined"&&js(window);var ye=n((e,t)=>{if(!Ce){F.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){F.error("No root element to bind event to!");return}Ce.addEventListener(e,r=>{t.apply(Ce,[r])})},"listenForAllEvents"),ee=n(e=>{if(!Ce){F.error("No root element to dispatch event on!");return}Ce.dispatchEvent(e)},"dispatch");var V=we(xe());var ot={},ou=n((e,t)=>{ot[e]||(ot[e]=[]),ot[e].push(t)},"add"),iu=n(e=>{let t=ot[e];return t?(delete ot[e],t):[]},"getAll"),su=n(e=>{var t;return((t=ot[e])==null?void 0:t.length)||0},"peekQueueSize"),it={add:ou,getAll:iu,peekQueueSize:su};var Ur=n(()=>{let e=typeof window!="undefined"?window:global;return e.amediaUserCache||(e.amediaUserCache={})},"getStorage"),au=n(e=>{let t=Ur()[e];return Promise.resolve(t)},"get"),uu=n((e,t,r)=>(Ur()[e]={key:e,data:t,expires:r},Promise.resolve()),"set"),cu=n(e=>(delete Ur()[e],Promise.resolve()),"remove"),fu=n(()=>((typeof window!="undefined"?window:global).amediaUserCache={},Promise.resolve()),"clear"),vo={get:au,set:uu,remove:cu,clear:fu};var lu;var zt=n(()=>lu||vo,"getCacheEngine"),du=n((e,t,r)=>zt().set(e,t,Date.now()+r),"set"),xr=n(e=>zt().remove(e),"remove"),pu=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 F.error(o,{cacheData:r.data}),xr(e),Promise.resolve()}}),"get"),mu=n(()=>zt().clear(),"clear"),he={get:pu,set:du,remove:xr,clear:mu};var vu=n((e,t)=>!e||Array.isArray(t)?t:t?typeof e=="object"&&typeof t=="object"?ne(ne({},e),t):t:e,"mergeCache");function _e(e,t,r,o){return new Promise((a,p)=>{it.add(e,{resolve:a,reject:p}),!(it.peekQueueSize(e)>1)&&he.get(e,t).then(d=>{if(d&&(!o||o(d))){it.getAll(e).forEach(m=>{m.resolve(d)});return}r().then(m=>{let g=d?vu(d,m.data):m.data;he.set(e,g,m.ttl),it.getAll(e).forEach(S=>{S.resolve(m.data)})}).catch(()=>{it.getAll(e).forEach(m=>{m.reject()})})})})}n(_e,"getOrUpdate");var hu=(0,V.Record)({id:V.Number,domain:V.String}),ho=(0,V.Record)({status:(0,V.Literal)("success"),access:(0,V.Union)((0,V.Literal)("granted"),(0,V.Literal)("denied")),publication:hu,access_features:(0,V.Array)(V.String)}),gu=(0,V.Record)({status:(0,V.Literal)("success"),cookie:V.String,access_features:(0,V.Array)(V.String)}),yu=(0,V.Record)({status:(0,V.Literal)("success"),vstoken_cookie:V.String,uuid:V.String,access_features:(0,V.Array)(V.String)}),go=n((e,t)=>_e("checkForAccess",ho,()=>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=ho.check(r);return{ttl:o.access==="granted"?1e3*10:0,data:o}}catch(o){throw F.error(o,{json:r}),o}})).then(r=>({access:r.access_features})),"checkForAccess"),yo=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 gu.check(t)}catch(r){throw F.error(r,{json:t}),r}}),"getUserAccess"),Eo=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 yu.check(t)}catch(r){throw F.error(r,{json:t}),r}}),"getNonUserAccess");var gt=class extends Error{};n(gt,"UserDeactivatedError");var Eu=["no_session_found","subscription_not_found","publication_not_subscribable"],bo=n(e=>O(void 0,null,function*(){return fetch(`/api/mercury/v2/access/activate?publication_wwwdomain=${fe()}&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){F.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 Eu.includes(o==null?void 0:o.status)?[]:(F.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 ge=we(xe());var Ro=we(wo()),qe={},st={},bu=n(e=>{var t;(t=st[e])==null||t.forEach(r=>r(qe[e]))},"emit"),_u=n((e,t)=>{st[e]||(st[e]=[]),st[e].push(t)},"on"),Co=n((e,t)=>{qe[e]=t,bu(e)},"set"),Su=n((e,t)=>{Co(e,(0,Ro.default)(qe[e]||{},t))},"merge"),wu=n(e=>qe[e],"get"),Ru=n(()=>{qe.state=void 0,qe.userAttributes=void 0,qe.storage=void 0,Object.keys(st).forEach(e=>{st[e]=[]})},"clear"),Q={merge:Su,set:Co,get:wu,on:_u,clear:Ru};var Cu=["avbrutt","kansellert","cancelled","aborted","failed to fetch","abgebrochen","the operation was aborted."],To=n(e=>Cu.includes(e.toLowerCase().trim()),"isAbortedNetworkError");var Ao=(0,ge.Partial)({user_uuid:ge.String,user_name:ge.String,tracking_key:ge.String}),Tu=n(e=>({uuid:e.user_uuid||null,name:e.user_name||null,trackingKey:e.tracking_key||null}),"mapSessionToUserAttributes"),Au=(0,ge.Record)({code:ge.String}),Ou=(0,ge.Record)({errors:(0,ge.Array)(Au)}),Iu=["session.not_found","session.not_specified","user.deactivated"],Nu=["session.invalid_for_domain","user.not_found"],Lr=n(e=>O(void 0,null,function*(){let t,r=e.clone();try{[t]=Ou.check(yield e.json()).errors}catch(o){return To(o==null?void 0:o.message)?Promise.resolve():(F.warn("Unable to parse error body from pluto",{error:o,response:r}),Promise.reject(o))}return Iu.includes(t==null?void 0:t.code)?Promise.resolve():Nu.includes(t==null?void 0:t.code)?(F.warn(`Pluto responded with HTTP/${e.status}: (${t.code}) while fetching current session`,{error:t,response:e}),Promise.resolve()):(F.error(`Pluto responded with HTTP/${e.status}: ${e.statusText}) when fetching current session`,{error:t,response:e}),Promise.reject())}),"resolveBadPlutoResponse"),Pu=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 F.error(r,{json:e}),t}}),"fetchCurrentSession"),Oo=n(()=>O(void 0,null,function*(){return _e("getCurrentSession",Ao,Pu).then(e=>Tu(e))}),"getCurrentSession"),Io=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 kr,Qt=self||window,No=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(No){let e=new Uint8Array(16);kr=n(function(){return No(e),e},"whatwgRNG")}else{let e=new Array(16);kr=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 Po=[];for(let e=0;e<256;++e)Po[e]=(e+256).toString(16).substr(1);function Uu(e,t){let r=t||0,o=Po;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(Uu,"bytesToUuid");function Uo(){let e=kr();return e[6]=e[6]&15|64,e[8]=e[8]&63|128,Uu(e)}n(Uo,"uuid");function xu(){let e,t,r=!1;return{promise:new Promise((a,p)=>{e=n(d=>{r||a(d),r=!0},"resolve"),t=n(d=>{r||p(d),r=!0},"reject")}),resolve:e,reject:t}}n(xu,"createPromise");function Du(e,t){return(...r)=>{let{resolve:o,reject:a,promise:p}=xu(),d=Uo(),m={eventId:d,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,d)}return self.addEventListener(`amedia-rpc-event:${e}:${t}:${d}`,S=>{S.detail||o();let{error:w,result:C}=S.detail;return w?a(w):o(C)}),p}}n(Du,"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,p]=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<p&&console.warn(`${this.component} server version is on an earlier minor version (${o}) than the client (${p})`);let d=this.queue.slice(0);delete this.queue,d.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,p=new Promise((d,m)=>{o=d,a=m});return this.queue.push(()=>this[t](...r).then(o).catch(a)),p}return this[t]=Du(this.component,t),this[t](...r)}}};n(yt,"RPCclient");var Jt,xo=n(()=>Jt||(Jt=new yt({version:"1.0.0",component:"userdata-session",methods:["userAuthenticated"]}),Jt),"getRPCClient");var Lu=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"),Le=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 Lu(t,a)}return null},"getCookie"),ku=n((e,t)=>t?t instanceof Date?`; expires=${t.toUTCString()}`:(e.setTime(e.getTime()+t*24*60*60*1e3),`; expires=${e.toUTCString()}`):"","setValidTime"),Fu=n(e=>!e||e===""?"":e instanceof Object?encodeURIComponent(JSON.stringify(e)):typeof e=="number"?e.toString(10):e,"setValue");function Te(e,t,r=Date.now(),o="/",a=!1){let p=new Date,d=`${e}=`;return(!t||t==="")&&(r=-1),d+=Fu(t),d+=ku(p,r),d+=`; path=${o}`,a&&(d+="; secure"),document.cookie=d,r&&r!==-1&&Le(e)===null&&(document.cookie=d.replace(/; expires=[^;]*/,"")),d}n(Te,"setCookie");function de(e){Te(e)}n(de,"removeCookie");var Do=n(()=>window.location.reload(),"reload"),Lo=n(e=>window.location.replace(e),"replace"),Xt=n(e=>{window.location.href=e},"navigateTo");var ko=n(e=>{let t=new URL(`https://${Ke()}/aid/logg_inn/${fe()}/`);t.searchParams.set("requestedUrl",e instanceof URL?e.href:e),Xt(t.href)},"login");function ju(){de("VSTOKEN"),de("aid.session"),de("aid_invitation_code"),de("aid-reload-article"),de("daxsub")}n(ju,"clearCookies");var Zt=n(()=>O(void 0,null,function*(){return Promise.all([Io(fe()),he.clear()]).then(()=>{xo().userAuthenticated(!1),ju(),de("VSTOKEN2")}).catch(e=>{F.error("Failure while logging out",e)})}),"logout"),er=n(()=>Oo(),"getSession");var Fo=n((e=["newspaper"])=>go(fe(),e),"getAccess"),tr=n(e=>O(void 0,null,function*(){try{return yield bo(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 yo(e);return t.status==="success"&&Te("VSTOKEN",t.cookie,365,"/"),{success:t.status==="success",accessFeatures:t.access_features}}),"setUserAccessCookie"),nr=n(e=>O(void 0,null,function*(){let t=yield Eo(e);return t.status==="success"&&Te("VSTOKEN2",t.vstoken_cookie,1,"/"),{success:t.status==="success",accessFeatures:t.access_features}}),"setNonUserAccessCookie"),jo=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((p,d,m)=>m.indexOf(p)===d).sort()}),{success:!0,accessFeatures:[]}))}),"setAccessCookies"),qo=n(e=>{let t=new Date;t.setTime(t.getTime()+2*60*1e3),Te("aid-paywall-reload-performed",e||Re(),t)},"setHasPerformedPaywallReload"),Mo=n(e=>Le("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 qu=n(()=>{ye(Me.REQUEST_ACTIVATION,e=>{tr(e.detail.accessFeatures).then(t=>{ee(new CustomEvent(Me.ON_ACTIVATION_COMPLETE,{detail:{accessFeatures:t}}))})})},"listenForActivationRequests");qu();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 Bo(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(Bo,"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,"uuid"]}))),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=>{var o;if(typeof r.state.isLoggedIn!="undefined"){if(r.state.isLoggedIn===!1){if(((o=this.attributes)==null?void 0:o.includes("extraData"))&&!Object.keys(r.attributes).includes("extraData"))return;t(r);return}Bo(this.attributes,r.attributes)||Bo(this.namespaces,r.storage)||t(r)}})})}processUserAttributesEvent(t){let r=t.detail;return this.attributes.reduce((a,p)=>(r[p]!==void 0&&(a[p]=r[p]),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 pe=at;var $o="jupiter";function Mu(){return O(this,null,function*(){let e="VSTOKEN",t=fe(),r=Le(e);new pe().withAttributes(["uuid"]).fetch().then(p=>O(this,[p],function*({attributes:o,state:a}){if(a.isLoggedIn===!1){typeof r=="string"&&de(e);return}if(typeof r!="string"){yield rr(t);return}let d=r.split(":"),m=new Date(parseInt(d[1],10)*1e3);m.setDate(m.getDate()-1),!(m.getTime()>Date.now()&&d[3]===o.uuid&&t.includes(d[4])&&d[5]===$o)&&(yield rr(t))}))})}n(Mu,"verifyAndSetUserAccessCookie");function Bu(){let e="VSTOKEN2",t=fe(),r=Le(e);new pe().fetch().then(a=>O(this,[a],function*({state:{isLoggedIn:o}}){if(o){if(typeof r!="string"){yield nr(t);return}let p=r.split(":"),d=new Date(parseInt(p[1],10)*1e3);if(d.setMinutes(d.getMinutes()-30),d.getTime()>Date.now()&&t.includes(p[4])&&p[5]===$o)return;yield nr(t)}else de(e)})).then(()=>{})}n(Bu,"verifyAndSetNonUserAccessCookie");function Fr(){return Promise.all([Mu(),Bu()])}n(Fr,"accessCookieRefresher");function Vo(){new pe().subscribe(({state:e})=>{e.isLoggedIn===!1&&(Q.set("userAttributes",{}),Q.set("storage",{}))})}n(Vo,"removeUserStorage");var Be=we(xe());var Go="haveTriedThirdPartyLoginCheck",$u=60*60*1e3,Vu=(0,Be.Record)({user_name:Be.String,tracking_key:Be.String}),Gu=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 Vu.check(e)}catch(t){return F.error(t,{data:e}),null}}),"getAidSession");function jr(){return O(this,null,function*(){return(yield he.get(Go,Be.Boolean))?!1:(yield he.set(Go,!0,$u),!!(yield Gu()))})}n(jr,"thirdPartyCookie");var qr="has-tried-autologin",Yo=6e4;function Yu(){try{return window.self!==window.top}catch(e){return!0}}n(Yu,"inIframe");function Wu(){let e=Le(qr);if(e&&typeof e!="object")try{if(Date.now()-parseInt(e,10)<Yo)return!0}catch(t){de(qr)}return Te(qr,Date.now(),Date.now()+Yo),!1}n(Wu,"hasAlreadyAttemptedAutoLogin");var Wo=n(e=>O(void 0,null,function*(){if(Yu())return;let{state:{isLoggedIn:t}}=yield new pe().fetch();if(!t){for(let r of e)if(!(yield r.handler().then(a=>{if(a){if(Wu())return!1;let p=new URL(`https://${Ke()}/aid/logg_inn/auto`);return p.searchParams.set("context",`auto_login_${r.name}`),p.searchParams.set("requestedUrl",Re()),Xt(p.href),!1}return!0})))return}}),"attemptAutologin"),Ko=n(()=>O(void 0,null,function*(){return Wo([{name:"third_party",handler:jr}])}),"attemptAutoLoginJob"),Ho=n(()=>O(void 0,null,function*(){return Wo([{name:"paywall",handler:()=>Promise.resolve(!0)}])}),"attemptPaywallAutoLogin");function Ku(e){return`a_sub_status=${e.extraData.customer_keys?"active":"null"}&a_user_key=${e.trackingKey}`}n(Ku,"getCookieValue");function Hu(e){let t="daxsub",r=Ku(e),o=encodeURIComponent(r);Te(t,o,1)}n(Hu,"setDaxsubCookie");function Mr(){return new pe().withAttributes(["trackingKey","extraData"]).fetch().then(({attributes:e,state:t})=>{if(!t.isLoggedIn){de("daxsub");return}Hu(e)}).catch(e=>{F.error(`Setting daxsub cookie failed. Error: ${e.message}`,e)})}n(Mr,"daxSubCookieHandler");var zu=[Ko,Fr,Mr,Vo];function Qu(){return O(this,null,function*(){for(let e of zu)yield e()})}n(Qu,"performJobs");var or;(function(t){t.LOADED="amedia-user.janitor.loaded"})(or||(or={}));var zo=n(()=>O(void 0,null,function*(){let e=!1;ye(or.LOADED,()=>{e||(e=!0,Qu())}),ee(new CustomEvent(or.LOADED))}),"runJanitor");var Qo=n(()=>{ye(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(Xo()),_t=we(ti());var $r,ir=typeof self=="undefined"?window:self,ri=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(ri){let e=new Uint8Array(16);$r=n(function(){return ri(e),e},"whatwgRNG")}else{let e=new Array(16);$r=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 ni=[];for(let e=0;e<256;++e)ni[e]=(e+256).toString(16).substr(1);function Ju(e,t){let r=t||0,o=ni;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(Ju,"bytesToUuid");function Vr(){let e=$r();return e[6]=e[6]&15|64,e[8]=e[8]&63|128,Ju(e)}n(Vr,"uuid");function oi(e){let t=!1;return(...r)=>{t||(e.apply(this,r),t=!0,setTimeout(()=>{t=!1},400))}}n(oi,"throttle");sr.default.config({name:"aid:userdata"});var ii=self.location.hostname.replace(/(.*\.)([^.]+\.\w+$)/,"$2");function si(){let e=_t.default.get("amedia:fpbid");return e||(e=Vr(),_t.default.set("amedia:fpbid",e,{expires:365*10,domain:ii,sameSite:"strict"})),Promise.resolve(e)}n(si,"getBrowserId");function Xu(){let e=_t.default.get("amedia:visitid");return e?Promise.resolve(e):sr.default.getItem("visitid")}n(Xu,"getVisitIdFromStorage");function ai(e){return _t.default.set("amedia:visitid",e,{expires:new Date(Date.now()+18e5),domain:ii,sameSite:"strict"}),sr.default.setItem("visitid",e).then(()=>e)}n(ai,"storeVisitId");function ui(){let e=Date.now(),t=`${Vr()}|${e}`;return ai(t)}n(ui,"createVisitId");function Zu(){return Xu().then(e=>e||ui()).then(e=>{let[t,r]=e.split("|");return!t||r&&Date.now()-18e5>r?ui():ai(`${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,oi(Zu)));var $e=we(xe());var ke=we(xe());var ec=5*6e4,ci=(0,ke.Record)({namespaces:(0,ke.Dictionary)(ke.Unknown,ke.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");function li(e,t){return{namespaces:Object.entries(t.namespaces).reduce((r,[o,a])=>ce(ne({},r),{[o]:a}),(e==null?void 0:e.namespaces)||{})}}n(li,"mergeCache");var di=n((e,t)=>O(void 0,null,function*(){let r=yield he.get("europa",ci),o=li(r,{namespaces:{[e]:t}});return he.set("europa",o,Date.now()+ec)}),"updateNamespaceInCache"),pi=n((e,t)=>O(void 0,null,function*(){let r=yield fi(`/api/europa/v1/me/${e}`,"PATCH",t);return r.ok?di(e,t):(F.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");let a=e,p=yield he.get("europa",ci);if(!t.ignoreCache&&(a=p?e.filter(m=>!Object.keys(p.namespaces).includes(m)):e,p&&a.length===0))return Promise.resolve(p.namespaces);let d=yield fi(`/api/europa/v1/me/${a.join(",")}`).then(m=>O(void 0,null,function*(){let g=yield m.text();return m.ok?JSON.parse(g):(m.status!==400&&F.error(`Could not get namespaces for: ${e}, status: ${m.status}`,{response:m,body:g}),{namespaces:{}})}));return Object.entries(d.namespaces).forEach(([m,g])=>di(m,g)),Promise.resolve(Object.entries(li(p,d).namespaces).filter(([m])=>e.includes(m)).reduce((m,[g,S])=>ce(ne({},m),{[g]:S}),{}))}),"getNamespaces");var tc=5*6e4,rc="privacyPreferences",nc=(0,$e.Record)({allowResearchUsage:$e.Boolean,connectWithSurveys:$e.Boolean,personalizedAds:$e.Boolean,personalizedContent:$e.Boolean}),ur=n(e=>e==="true"||e===!0,"toBoolean"),mi=n(()=>O(void 0,null,function*(){return _e(rc,nc,()=>ar(["privacy_preferences"]).then(e=>{let t=e.privacy_preferences;return{ttl:tc,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(xe());var vi=(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})),oc=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:vi.check(a)}}catch(p){throw F.error(p,{json:a}),p}})},"getNebulaData"),ic=n(e=>({extraData:e}),"mapNebulaToUserData"),hi=n((e,t,r)=>_e("getNebulaInfo",vi,()=>oc(e,t,r)).then(ic),"getInfo");var Gr=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=>Gr().then(t=>{t&&e()})),"whenIsLoggedIn");var sc=n(()=>Promise.all([si(),Gr()]).then(([e,t])=>{var r;return hi(fe(),e,t&&((r=Q.get("userAttributes"))==null?void 0:r.trackingKey)||void 0)}),"getExtraData"),ac={uuid:er,name:er,trackingKey:er,access:()=>ut().then(()=>Fo()),extraData:sc,privacyPreferences:()=>ut().then(()=>mi())},gi=n(e=>{let t=[];e.forEach(o=>{let a=ac[o];if(!a){F.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),a.uuid!==void 0&&Q.merge("state",{isLoggedIn:a.uuid!==null})}).catch(a=>{F.warn(`User attribute call failed (${o.toString()})`,a)}))}),Promise.all(r).then(()=>{})},"requestAttributes");var yi=n(()=>{Q.on("userAttributes",e=>{ee(new CustomEvent(K.ON_ATTRIBUTES_UPDATED,{detail:e}))}),ye(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&&gi(o)})},"listenForUserAttributeRequests");var Ei=n(e=>{ar(e).then(t=>{Q.merge("storage",t)})},"requestStorage"),bi=n(e=>Object.keys(e).forEach(t=>pi(t,e[t])),"updateStorage");var _i=n(()=>{Q.on("storage",e=>{ee(new CustomEvent(K.ON_STORAGE_UPDATED,{detail:e}))}),ye(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&&Ei(o)})}),ye(K.UPDATE_STORAGE,e=>{ut().then(()=>{bi(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 Yr=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 pe().withAttributes(["name"]).fetch();if(!t)return yield Ho(),{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(Mo(this.requestedUrl))throw new Ve("Unlock check already performed.",Ve.ERROR_RELOADED_NO_ACCESS);qo(this.requestedUrl),this.reload&&Do(),this.requestedUrl&&Lo(this.requestedUrl)}return{isLoggedIn:!0,hasAccess:!0,accessFeatures:r.accessFeatures}})}setAccessCookiesAndGetAccessFeatures(t){return jo(fe()).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(Yr,"PaywallUnlockRequest");var Si=Yr;var uc=n(e=>ko(e||Re()),"goToLoginPage"),cc=n(()=>Zt(),"logout"),fc=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"),lc=n(e=>{ee(new CustomEvent(K.UPDATE_STORAGE,{detail:e}))},"updateStorage");Qo();yi();_i();zo();
|
|
2
2
|
/*!
|
|
3
3
|
localForage -- Offline Storage, Improved
|
|
4
4
|
Version 1.9.0
|