@sesamy/sesamy-js 1.92.0 → 1.93.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sesamy-js.cjs +1 -1
- package/dist/sesamy-js.iife.js +1 -1
- package/dist/sesamy-js.mjs +11 -5
- package/package.json +1 -1
package/dist/sesamy-js.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var Hs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Gs={},Nn,Ws;function Ae(){return Ws||(Ws=1,Nn=function(e){try{return!!e()}catch{return!0}}),Nn}var jn,Vs;function dn(){if(Vs)return jn;Vs=1;var e=Ae();return jn=!e(function(){var r=(function(){}).bind();return typeof r!="function"||r.hasOwnProperty("prototype")}),jn}var Dn,zs;function pe(){if(zs)return Dn;zs=1;var e=dn(),r=Function.prototype,t=r.call,n=e&&r.bind.bind(t,t);return Dn=e?n:function(a){return function(){return t.apply(a,arguments)}},Dn}var Mn,Ks;function vn(){if(Ks)return Mn;Ks=1;var e=pe(),r=e({}.toString),t=e("".slice);return Mn=function(n){return t(r(n),8,-1)},Mn}var Fn,Js;function Bd(){if(Js)return Fn;Js=1;var e=pe(),r=Ae(),t=vn(),n=Object,a=e("".split);return Fn=r(function(){return!n("z").propertyIsEnumerable(0)})?function(i){return t(i)==="String"?a(i,""):n(i)}:n,Fn}var Bn,Ys;function hn(){return Ys||(Ys=1,Bn=function(e){return e==null}),Bn}var Hn,Qs;function pn(){if(Qs)return Hn;Qs=1;var e=hn(),r=TypeError;return Hn=function(t){if(e(t))throw new r("Can't call method on "+t);return t},Hn}var Gn,Xs;function Ut(){if(Xs)return Gn;Xs=1;var e=Bd(),r=pn();return Gn=function(t){return e(r(t))},Gn}var wt,Zs;function me(){if(Zs)return wt;Zs=1;var e=function(r){return r&&r.Math===Math&&r};return wt=e(typeof globalThis=="object"&&globalThis)||e(typeof window=="object"&&window)||e(typeof self=="object"&&self)||e(typeof Hs=="object"&&Hs)||e(typeof wt=="object"&&wt)||(function(){return this})()||Function("return this")(),wt}var Wn={exports:{}},Vn,eu;function sr(){return eu||(eu=1,Vn=!1),Vn}var zn,ru;function is(){if(ru)return zn;ru=1;var e=me(),r=Object.defineProperty;return zn=function(t,n){try{r(e,t,{value:n,configurable:!0,writable:!0})}catch{e[t]=n}return n},zn}var tu;function os(){if(tu)return Wn.exports;tu=1;var e=sr(),r=me(),t=is(),n="__core-js_shared__",a=Wn.exports=r[n]||t(n,{});return(a.versions||(a.versions=[])).push({version:"3.46.0",mode:e?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru), 2025 CoreJS Company (core-js.io)",license:"https://github.com/zloirock/core-js/blob/v3.46.0/LICENSE",source:"https://github.com/zloirock/core-js"}),Wn.exports}var Kn,nu;function Hd(){if(nu)return Kn;nu=1;var e=os();return Kn=function(r,t){return e[r]||(e[r]=t||{})},Kn}var Jn,au;function mn(){if(au)return Jn;au=1;var e=pn(),r=Object;return Jn=function(t){return r(e(t))},Jn}var Yn,iu;function ze(){if(iu)return Yn;iu=1;var e=pe(),r=mn(),t=e({}.hasOwnProperty);return Yn=Object.hasOwn||function(a,i){return t(r(a),i)},Yn}var Qn,ou;function Gd(){if(ou)return Qn;ou=1;var e=pe(),r=0,t=Math.random(),n=e(1.1.toString);return Qn=function(a){return"Symbol("+(a===void 0?"":a)+")_"+n(++r+t,36)},Qn}var Xn,su;function Lt(){if(su)return Xn;su=1;var e=me(),r=e.navigator,t=r&&r.userAgent;return Xn=t?String(t):"",Xn}var Zn,uu;function Wd(){if(uu)return Zn;uu=1;var e=me(),r=Lt(),t=e.process,n=e.Deno,a=t&&t.versions||n&&n.version,i=a&&a.v8,o,s;return i&&(o=i.split("."),s=o[0]>0&&o[0]<4?1:+(o[0]+o[1])),!s&&r&&(o=r.match(/Edge\/(\d+)/),(!o||o[1]>=74)&&(o=r.match(/Chrome\/(\d+)/),o&&(s=+o[1]))),Zn=s,Zn}var ea,cu;function Vd(){if(cu)return ea;cu=1;var e=Wd(),r=Ae(),t=me(),n=t.String;return ea=!!Object.getOwnPropertySymbols&&!r(function(){var a=Symbol("symbol detection");return!n(a)||!(Object(a)instanceof Symbol)||!Symbol.sham&&e&&e<41}),ea}var ra,lu;function zd(){if(lu)return ra;lu=1;var e=Vd();return ra=e&&!Symbol.sham&&typeof Symbol.iterator=="symbol",ra}var ta,fu;function ke(){if(fu)return ta;fu=1;var e=me(),r=Hd(),t=ze(),n=Gd(),a=Vd(),i=zd(),o=e.Symbol,s=r("wks"),u=i?o.for||o:o&&o.withoutSetter||n;return ta=function(c){return t(s,c)||(s[c]=a&&t(o,c)?o[c]:u("Symbol."+c)),s[c]},ta}var na,du;function we(){if(du)return na;du=1;var e=typeof document=="object"&&document.all;return na=typeof e>"u"&&e!==void 0?function(r){return typeof r=="function"||r===e}:function(r){return typeof r=="function"},na}var aa,vu;function Ke(){if(vu)return aa;vu=1;var e=we();return aa=function(r){return typeof r=="object"?r!==null:e(r)},aa}var ia,hu;function rr(){if(hu)return ia;hu=1;var e=Ke(),r=String,t=TypeError;return ia=function(n){if(e(n))return n;throw new t(r(n)+" is not an object")},ia}var oa={},sa,pu;function qe(){if(pu)return sa;pu=1;var e=Ae();return sa=!e(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),sa}var ua,mu;function Kd(){if(mu)return ua;mu=1;var e=qe(),r=Ae();return ua=e&&r(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),ua}var ca={},la,gu;function gn(){if(gu)return la;gu=1;var e=me(),r=Ke(),t=e.document,n=r(t)&&r(t.createElement);return la=function(a){return n?t.createElement(a):{}},la}var fa,yu;function Jd(){if(yu)return fa;yu=1;var e=qe(),r=Ae(),t=gn();return fa=!e&&!r(function(){return Object.defineProperty(t("div"),"a",{get:function(){return 7}}).a!==7}),fa}var da,bu;function Le(){if(bu)return da;bu=1;var e=dn(),r=Function.prototype.call;return da=e?r.bind(r):function(){return r.apply(r,arguments)},da}var va,wu;function Je(){if(wu)return va;wu=1;var e=me(),r=we(),t=function(n){return r(n)?n:void 0};return va=function(n,a){return arguments.length<2?t(e[n]):e[n]&&e[n][a]},va}var ha,Su;function yn(){if(Su)return ha;Su=1;var e=pe();return ha=e({}.isPrototypeOf),ha}var pa,Iu;function Yd(){if(Iu)return pa;Iu=1;var e=Je(),r=we(),t=yn(),n=zd(),a=Object;return pa=n?function(i){return typeof i=="symbol"}:function(i){var o=e("Symbol");return r(o)&&t(o.prototype,a(i))},pa}var ma,Pu;function bn(){if(Pu)return ma;Pu=1;var e=String;return ma=function(r){try{return e(r)}catch{return"Object"}},ma}var ga,Eu;function tr(){if(Eu)return ga;Eu=1;var e=we(),r=bn(),t=TypeError;return ga=function(n){if(e(n))return n;throw new t(r(n)+" is not a function")},ga}var ya,Ru;function ss(){if(Ru)return ya;Ru=1;var e=tr(),r=hn();return ya=function(t,n){var a=t[n];return r(a)?void 0:e(a)},ya}var ba,Tu;function Bh(){if(Tu)return ba;Tu=1;var e=Le(),r=we(),t=Ke(),n=TypeError;return ba=function(a,i){var o,s;if(i==="string"&&r(o=a.toString)&&!t(s=e(o,a))||r(o=a.valueOf)&&!t(s=e(o,a))||i!=="string"&&r(o=a.toString)&&!t(s=e(o,a)))return s;throw new n("Can't convert object to primitive value")},ba}var wa,Ou;function Hh(){if(Ou)return wa;Ou=1;var e=Le(),r=Ke(),t=Yd(),n=ss(),a=Bh(),i=ke(),o=TypeError,s=i("toPrimitive");return wa=function(u,c){if(!r(u)||t(u))return u;var l=n(u,s),f;if(l){if(c===void 0&&(c="default"),f=e(l,u,c),!r(f)||t(f))return f;throw new o("Can't convert object to primitive value")}return c===void 0&&(c="number"),a(u,c)},wa}var Sa,Cu;function Qd(){if(Cu)return Sa;Cu=1;var e=Hh(),r=Yd();return Sa=function(t){var n=e(t,"string");return r(n)?n:n+""},Sa}var _u;function gr(){if(_u)return ca;_u=1;var e=qe(),r=Jd(),t=Kd(),n=rr(),a=Qd(),i=TypeError,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,u="enumerable",c="configurable",l="writable";return ca.f=e?t?function(v,d,h){if(n(v),d=a(d),n(h),typeof v=="function"&&d==="prototype"&&"value"in h&&l in h&&!h[l]){var p=s(v,d);p&&p[l]&&(v[d]=h.value,h={configurable:c in h?h[c]:p[c],enumerable:u in h?h[u]:p[u],writable:!1})}return o(v,d,h)}:o:function(v,d,h){if(n(v),d=a(d),n(h),r)try{return o(v,d,h)}catch{}if("get"in h||"set"in h)throw new i("Accessors not supported");return"value"in h&&(v[d]=h.value),v},ca}var Ia,Au;function Gh(){if(Au)return Ia;Au=1;var e=Math.ceil,r=Math.floor;return Ia=Math.trunc||function(n){var a=+n;return(a>0?r:e)(a)},Ia}var Pa,ku;function us(){if(ku)return Pa;ku=1;var e=Gh();return Pa=function(r){var t=+r;return t!==t||t===0?0:e(t)},Pa}var Ea,qu;function Xd(){if(qu)return Ea;qu=1;var e=us(),r=Math.max,t=Math.min;return Ea=function(n,a){var i=e(n);return i<0?r(i+a,0):t(i,a)},Ea}var Ra,$u;function Wh(){if($u)return Ra;$u=1;var e=us(),r=Math.min;return Ra=function(t){var n=e(t);return n>0?r(n,9007199254740991):0},Ra}var Ta,Uu;function cs(){if(Uu)return Ta;Uu=1;var e=Wh();return Ta=function(r){return e(r.length)},Ta}var Oa,Lu;function Vh(){if(Lu)return Oa;Lu=1;var e=Ut(),r=Xd(),t=cs(),n=function(a){return function(i,o,s){var u=e(i),c=t(u);if(c===0)return!a&&-1;var l=r(s,c),f;if(a&&o!==o){for(;c>l;)if(f=u[l++],f!==f)return!0}else for(;c>l;l++)if((a||l in u)&&u[l]===o)return a||l||0;return!a&&-1}};return Oa={includes:n(!0),indexOf:n(!1)},Oa}var Ca,xu;function ls(){return xu||(xu=1,Ca={}),Ca}var _a,Nu;function Zd(){if(Nu)return _a;Nu=1;var e=pe(),r=ze(),t=Ut(),n=Vh().indexOf,a=ls(),i=e([].push);return _a=function(o,s){var u=t(o),c=0,l=[],f;for(f in u)!r(a,f)&&r(u,f)&&i(l,f);for(;s.length>c;)r(u,f=s[c++])&&(~n(l,f)||i(l,f));return l},_a}var Aa,ju;function fs(){return ju||(ju=1,Aa=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]),Aa}var ka,Du;function ev(){if(Du)return ka;Du=1;var e=Zd(),r=fs();return ka=Object.keys||function(n){return e(n,r)},ka}var Mu;function zh(){if(Mu)return oa;Mu=1;var e=qe(),r=Kd(),t=gr(),n=rr(),a=Ut(),i=ev();return oa.f=e&&!r?Object.defineProperties:function(s,u){n(s);for(var c=a(u),l=i(u),f=l.length,v=0,d;f>v;)t.f(s,d=l[v++],c[d]);return s},oa}var qa,Fu;function rv(){if(Fu)return qa;Fu=1;var e=Je();return qa=e("document","documentElement"),qa}var $a,Bu;function ds(){if(Bu)return $a;Bu=1;var e=Hd(),r=Gd(),t=e("keys");return $a=function(n){return t[n]||(t[n]=r(n))},$a}var Ua,Hu;function xt(){if(Hu)return Ua;Hu=1;var e=rr(),r=zh(),t=fs(),n=ls(),a=rv(),i=gn(),o=ds(),s=">",u="<",c="prototype",l="script",f=o("IE_PROTO"),v=function(){},d=function(I){return u+l+s+I+u+"/"+l+s},h=function(I){I.write(d("")),I.close();var g=I.parentWindow.Object;return I=null,g},p=function(){var I=i("iframe"),g="java"+l+":",b;return I.style.display="none",a.appendChild(I),I.src=String(g),b=I.contentWindow.document,b.open(),b.write(d("document.F=Object")),b.close(),b.F},S,R=function(){try{S=new ActiveXObject("htmlfile")}catch{}R=typeof document<"u"?document.domain&&S?h(S):p():h(S);for(var I=t.length;I--;)delete R[c][t[I]];return R()};return n[f]=!0,Ua=Object.create||function(g,b){var y;return g!==null?(v[c]=e(g),y=new v,v[c]=null,y[f]=g):y=R(),b===void 0?y:r.f(y,b)},Ua}var La,Gu;function Kh(){if(Gu)return La;Gu=1;var e=ke(),r=xt(),t=gr().f,n=e("unscopables"),a=Array.prototype;return a[n]===void 0&&t(a,n,{configurable:!0,value:r(null)}),La=function(i){a[n][i]=!0},La}var xa,Wu;function Nt(){return Wu||(Wu=1,xa={}),xa}var Na,Vu;function Jh(){if(Vu)return Na;Vu=1;var e=me(),r=we(),t=e.WeakMap;return Na=r(t)&&/native code/.test(String(t)),Na}var ja,zu;function Gr(){return zu||(zu=1,ja=function(e,r){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:r}}),ja}var Da,Ku;function Wr(){if(Ku)return Da;Ku=1;var e=qe(),r=gr(),t=Gr();return Da=e?function(n,a,i){return r.f(n,a,t(1,i))}:function(n,a,i){return n[a]=i,n},Da}var Ma,Ju;function ft(){if(Ju)return Ma;Ju=1;var e=Jh(),r=me(),t=Ke(),n=Wr(),a=ze(),i=os(),o=ds(),s=ls(),u="Object already initialized",c=r.TypeError,l=r.WeakMap,f,v,d,h=function(I){return d(I)?v(I):f(I,{})},p=function(I){return function(g){var b;if(!t(g)||(b=v(g)).type!==I)throw new c("Incompatible receiver, "+I+" required");return b}};if(e||i.state){var S=i.state||(i.state=new l);S.get=S.get,S.has=S.has,S.set=S.set,f=function(I,g){if(S.has(I))throw new c(u);return g.facade=I,S.set(I,g),g},v=function(I){return S.get(I)||{}},d=function(I){return S.has(I)}}else{var R=o("state");s[R]=!0,f=function(I,g){if(a(I,R))throw new c(u);return g.facade=I,n(I,R,g),g},v=function(I){return a(I,R)?I[R]:{}},d=function(I){return a(I,R)}}return Ma={set:f,get:v,has:d,enforce:h,getterFor:p},Ma}var Fa={},Ba={},Yu;function tv(){if(Yu)return Ba;Yu=1;var e={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,t=r&&!e.call({1:2},1);return Ba.f=t?function(a){var i=r(this,a);return!!i&&i.enumerable}:e,Ba}var Qu;function nv(){if(Qu)return Fa;Qu=1;var e=qe(),r=Le(),t=tv(),n=Gr(),a=Ut(),i=Qd(),o=ze(),s=Jd(),u=Object.getOwnPropertyDescriptor;return Fa.f=e?u:function(l,f){if(l=a(l),f=i(f),s)try{return u(l,f)}catch{}if(o(l,f))return n(!r(t.f,l,f),l[f])},Fa}var Ha={exports:{}},Ga,Xu;function av(){if(Xu)return Ga;Xu=1;var e=qe(),r=ze(),t=Function.prototype,n=e&&Object.getOwnPropertyDescriptor,a=r(t,"name"),i=a&&(function(){}).name==="something",o=a&&(!e||e&&n(t,"name").configurable);return Ga={EXISTS:a,PROPER:i,CONFIGURABLE:o},Ga}var Wa,Zu;function vs(){if(Zu)return Wa;Zu=1;var e=pe(),r=we(),t=os(),n=e(Function.toString);return r(t.inspectSource)||(t.inspectSource=function(a){return n(a)}),Wa=t.inspectSource,Wa}var ec;function iv(){if(ec)return Ha.exports;ec=1;var e=pe(),r=Ae(),t=we(),n=ze(),a=qe(),i=av().CONFIGURABLE,o=vs(),s=ft(),u=s.enforce,c=s.get,l=String,f=Object.defineProperty,v=e("".slice),d=e("".replace),h=e([].join),p=a&&!r(function(){return f(function(){},"length",{value:8}).length!==8}),S=String(String).split("String"),R=Ha.exports=function(I,g,b){v(l(g),0,7)==="Symbol("&&(g="["+d(l(g),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),b&&b.getter&&(g="get "+g),b&&b.setter&&(g="set "+g),(!n(I,"name")||i&&I.name!==g)&&(a?f(I,"name",{value:g,configurable:!0}):I.name=g),p&&b&&n(b,"arity")&&I.length!==b.arity&&f(I,"length",{value:b.arity});try{b&&n(b,"constructor")&&b.constructor?a&&f(I,"prototype",{writable:!1}):I.prototype&&(I.prototype=void 0)}catch{}var y=u(I);return n(y,"source")||(y.source=h(S,typeof g=="string"?g:"")),I};return Function.prototype.toString=R(function(){return t(this)&&c(this).source||o(this)},"toString"),Ha.exports}var Va,rc;function Ye(){if(rc)return Va;rc=1;var e=we(),r=gr(),t=iv(),n=is();return Va=function(a,i,o,s){s||(s={});var u=s.enumerable,c=s.name!==void 0?s.name:i;if(e(o)&&t(o,c,s),s.global)u?a[i]=o:n(i,o);else{try{s.unsafe?a[i]&&(u=!0):delete a[i]}catch{}u?a[i]=o:r.f(a,i,{value:o,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return a},Va}var za={},tc;function Yh(){if(tc)return za;tc=1;var e=Zd(),r=fs(),t=r.concat("length","prototype");return za.f=Object.getOwnPropertyNames||function(a){return e(a,t)},za}var Ka={},nc;function ov(){return nc||(nc=1,Ka.f=Object.getOwnPropertySymbols),Ka}var Ja,ac;function Qh(){if(ac)return Ja;ac=1;var e=Je(),r=pe(),t=Yh(),n=ov(),a=rr(),i=r([].concat);return Ja=e("Reflect","ownKeys")||function(s){var u=t.f(a(s)),c=n.f;return c?i(u,c(s)):u},Ja}var Ya,ic;function sv(){if(ic)return Ya;ic=1;var e=ze(),r=Qh(),t=nv(),n=gr();return Ya=function(a,i,o){for(var s=r(i),u=n.f,c=t.f,l=0;l<s.length;l++){var f=s[l];!e(a,f)&&!(o&&e(o,f))&&u(a,f,c(i,f))}},Ya}var Qa,oc;function uv(){if(oc)return Qa;oc=1;var e=Ae(),r=we(),t=/#|\.prototype\./,n=function(u,c){var l=i[a(u)];return l===s?!0:l===o?!1:r(c)?e(c):!!c},a=n.normalize=function(u){return String(u).replace(t,".").toLowerCase()},i=n.data={},o=n.NATIVE="N",s=n.POLYFILL="P";return Qa=n,Qa}var Xa,sc;function Pe(){if(sc)return Xa;sc=1;var e=me(),r=nv().f,t=Wr(),n=Ye(),a=is(),i=sv(),o=uv();return Xa=function(s,u){var c=s.target,l=s.global,f=s.stat,v,d,h,p,S,R;if(l?d=e:f?d=e[c]||a(c,{}):d=e[c]&&e[c].prototype,d)for(h in u){if(S=u[h],s.dontCallGetSet?(R=r(d,h),p=R&&R.value):p=d[h],v=o(l?h:c+(f?".":"#")+h,s.forced),!v&&p!==void 0){if(typeof S==typeof p)continue;i(S,p)}(s.sham||p&&p.sham)&&t(S,"sham",!0),n(d,h,S,s)}},Xa}var Za,uc;function Xh(){if(uc)return Za;uc=1;var e=Ae();return Za=!e(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype}),Za}var ei,cc;function hs(){if(cc)return ei;cc=1;var e=ze(),r=we(),t=mn(),n=ds(),a=Xh(),i=n("IE_PROTO"),o=Object,s=o.prototype;return ei=a?o.getPrototypeOf:function(u){var c=t(u);if(e(c,i))return c[i];var l=c.constructor;return r(l)&&c instanceof l?l.prototype:c instanceof o?s:null},ei}var ri,lc;function cv(){if(lc)return ri;lc=1;var e=Ae(),r=we(),t=Ke(),n=xt(),a=hs(),i=Ye(),o=ke(),s=sr(),u=o("iterator"),c=!1,l,f,v;[].keys&&(v=[].keys(),"next"in v?(f=a(a(v)),f!==Object.prototype&&(l=f)):c=!0);var d=!t(l)||e(function(){var h={};return l[u].call(h)!==h});return d?l={}:s&&(l=n(l)),r(l[u])||i(l,u,function(){return this}),ri={IteratorPrototype:l,BUGGY_SAFARI_ITERATORS:c},ri}var ti,fc;function dt(){if(fc)return ti;fc=1;var e=gr().f,r=ze(),t=ke(),n=t("toStringTag");return ti=function(a,i,o){a&&!o&&(a=a.prototype),a&&!r(a,n)&&e(a,n,{configurable:!0,value:i})},ti}var ni,dc;function lv(){if(dc)return ni;dc=1;var e=cv().IteratorPrototype,r=xt(),t=Gr(),n=dt(),a=Nt(),i=function(){return this};return ni=function(o,s,u,c){var l=s+" Iterator";return o.prototype=r(e,{next:t(+!c,u)}),n(o,l,!1,!0),a[l]=i,o},ni}var ai,vc;function Zh(){if(vc)return ai;vc=1;var e=pe(),r=tr();return ai=function(t,n,a){try{return e(r(Object.getOwnPropertyDescriptor(t,n)[a]))}catch{}},ai}var ii,hc;function ep(){if(hc)return ii;hc=1;var e=Ke();return ii=function(r){return e(r)||r===null},ii}var oi,pc;function rp(){if(pc)return oi;pc=1;var e=ep(),r=String,t=TypeError;return oi=function(n){if(e(n))return n;throw new t("Can't set "+r(n)+" as a prototype")},oi}var si,mc;function ps(){if(mc)return si;mc=1;var e=Zh(),r=Ke(),t=pn(),n=rp();return si=Object.setPrototypeOf||("__proto__"in{}?(function(){var a=!1,i={},o;try{o=e(Object.prototype,"__proto__","set"),o(i,[]),a=i instanceof Array}catch{}return function(u,c){return t(u),n(c),r(u)&&(a?o(u,c):u.__proto__=c),u}})():void 0),si}var ui,gc;function fv(){if(gc)return ui;gc=1;var e=Pe(),r=Le(),t=sr(),n=av(),a=we(),i=lv(),o=hs(),s=ps(),u=dt(),c=Wr(),l=Ye(),f=ke(),v=Nt(),d=cv(),h=n.PROPER,p=n.CONFIGURABLE,S=d.IteratorPrototype,R=d.BUGGY_SAFARI_ITERATORS,I=f("iterator"),g="keys",b="values",y="entries",A=function(){return this};return ui=function(q,j,G,K,re,L,M){i(G,j,K);var N=function(J){if(J===re&&w)return w;if(!R&&J&&J in U)return U[J];switch(J){case g:return function(){return new G(this,J)};case b:return function(){return new G(this,J)};case y:return function(){return new G(this,J)}}return function(){return new G(this)}},m=j+" Iterator",C=!1,U=q.prototype,F=U[I]||U["@@iterator"]||re&&U[re],w=!R&&F||N(re),T=j==="Array"&&U.entries||F,x,H,Q;if(T&&(x=o(T.call(new q)),x!==Object.prototype&&x.next&&(!t&&o(x)!==S&&(s?s(x,S):a(x[I])||l(x,I,A)),u(x,m,!0,!0),t&&(v[m]=A))),h&&re===b&&F&&F.name!==b&&(!t&&p?c(U,"name",b):(C=!0,w=function(){return r(F,this)})),re)if(H={values:N(b),keys:L?w:N(g),entries:N(y)},M)for(Q in H)(R||C||!(Q in U))&&l(U,Q,H[Q]);else e({target:j,proto:!0,forced:R||C},H);return(!t||M)&&U[I]!==w&&l(U,I,w,{name:re}),v[j]=w,H},ui}var ci,yc;function ms(){return yc||(yc=1,ci=function(e,r){return{value:e,done:r}}),ci}var li,bc;function gs(){if(bc)return li;bc=1;var e=Ut(),r=Kh(),t=Nt(),n=ft(),a=gr().f,i=fv(),o=ms(),s=sr(),u=qe(),c="Array Iterator",l=n.set,f=n.getterFor(c);li=i(Array,"Array",function(d,h){l(this,{type:c,target:e(d),index:0,kind:h})},function(){var d=f(this),h=d.target,p=d.index++;if(!h||p>=h.length)return d.target=null,o(void 0,!0);switch(d.kind){case"keys":return o(p,!1);case"values":return o(h[p],!1)}return o([p,h[p]],!1)},"values");var v=t.Arguments=t.Array;if(r("keys"),r("values"),r("entries"),!s&&u&&v.name!=="values")try{a(v,"name",{value:"values"})}catch{}return li}var wc={},Sc;function tp(){if(Sc)return wc;Sc=1;var e=Pe(),r=pe(),t=Xd(),n=RangeError,a=String.fromCharCode,i=String.fromCodePoint,o=r([].join),s=!!i&&i.length!==1;return e({target:"String",stat:!0,arity:1,forced:s},{fromCodePoint:function(c){for(var l=[],f=arguments.length,v=0,d;f>v;){if(d=+arguments[v++],t(d,1114111)!==d)throw new n(d+" is not a valid code point");l[v]=d<65536?a(d):a(((d-=65536)>>10)+55296,d%1024+56320)}return o(l,"")}}),wc}var fi,Ic;function dv(){if(Ic)return fi;Ic=1;var e=me(),r=qe(),t=Object.getOwnPropertyDescriptor;return fi=function(n){if(!r)return e[n];var a=t(e,n);return a&&a.value},fi}var di,Pc;function wn(){if(Pc)return di;Pc=1;var e=Ae(),r=ke(),t=qe(),n=sr(),a=r("iterator");return di=!e(function(){var i=new URL("b?a=1&b=2&c=3","https://a"),o=i.searchParams,s=new URLSearchParams("a=1&a=2&b=3"),u="";return i.pathname="c%20d",o.forEach(function(c,l){o.delete("b"),u+=l+c}),s.delete("a",2),s.delete("b",void 0),n&&(!i.toJSON||!s.has("a",1)||s.has("a",2)||!s.has("a",void 0)||s.has("b"))||!o.size&&(n||!t)||!o.sort||i.href!=="https://a/c%20d?a=1&c=3"||o.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!o[a]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("https://тест").host!=="xn--e1aybc"||new URL("https://a#б").hash!=="#%D0%B1"||u!=="a1c3"||new URL("https://x",void 0).host!=="x"}),di}var vi,Ec;function Sn(){if(Ec)return vi;Ec=1;var e=iv(),r=gr();return vi=function(t,n,a){return a.get&&e(a.get,n,{getter:!0}),a.set&&e(a.set,n,{setter:!0}),r.f(t,n,a)},vi}var hi,Rc;function np(){if(Rc)return hi;Rc=1;var e=Ye();return hi=function(r,t,n){for(var a in t)e(r,a,t[a],n);return r},hi}var pi,Tc;function ys(){if(Tc)return pi;Tc=1;var e=yn(),r=TypeError;return pi=function(t,n){if(e(n,t))return t;throw new r("Incorrect invocation")},pi}var mi,Oc;function ap(){if(Oc)return mi;Oc=1;var e=vn(),r=pe();return mi=function(t){if(e(t)==="Function")return r(t)},mi}var gi,Cc;function vt(){if(Cc)return gi;Cc=1;var e=ap(),r=tr(),t=dn(),n=e(e.bind);return gi=function(a,i){return r(a),i===void 0?a:t?n(a,i):function(){return a.apply(i,arguments)}},gi}var yi,_c;function bs(){if(_c)return yi;_c=1;var e=ke(),r=e("toStringTag"),t={};return t[r]="z",yi=String(t)==="[object z]",yi}var bi,Ac;function jt(){if(Ac)return bi;Ac=1;var e=bs(),r=we(),t=vn(),n=ke(),a=n("toStringTag"),i=Object,o=t((function(){return arguments})())==="Arguments",s=function(u,c){try{return u[c]}catch{}};return bi=e?t:function(u){var c,l,f;return u===void 0?"Undefined":u===null?"Null":typeof(l=s(c=i(u),a))=="string"?l:o?t(c):(f=t(c))==="Object"&&r(c.callee)?"Arguments":f},bi}var wi,kc;function yr(){if(kc)return wi;kc=1;var e=jt(),r=String;return wi=function(t){if(e(t)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return r(t)},wi}var Si,qc;function In(){if(qc)return Si;qc=1;var e=jt(),r=ss(),t=hn(),n=Nt(),a=ke(),i=a("iterator");return Si=function(o){if(!t(o))return r(o,i)||r(o,"@@iterator")||n[e(o)]},Si}var Ii,$c;function ws(){if($c)return Ii;$c=1;var e=Le(),r=tr(),t=rr(),n=bn(),a=In(),i=TypeError;return Ii=function(o,s){var u=arguments.length<2?a(o):s;if(r(u))return t(e(u,o));throw new i(n(o)+" is not iterable")},Ii}var Pi,Uc;function Vr(){if(Uc)return Pi;Uc=1;var e=TypeError;return Pi=function(r,t){if(r<t)throw new e("Not enough arguments");return r},Pi}var Ei,Lc;function Pn(){if(Lc)return Ei;Lc=1;var e=pe();return Ei=e([].slice),Ei}var Ri,xc;function ip(){if(xc)return Ri;xc=1;var e=Pn(),r=Math.floor,t=function(n,a){var i=n.length;if(i<8)for(var o=1,s,u;o<i;){for(u=o,s=n[o];u&&a(n[u-1],s)>0;)n[u]=n[--u];u!==o++&&(n[u]=s)}else for(var c=r(i/2),l=t(e(n,0,c),a),f=t(e(n,c),a),v=l.length,d=f.length,h=0,p=0;h<v||p<d;)n[h+p]=h<v&&p<d?a(l[h],f[p])<=0?l[h++]:f[p++]:h<v?l[h++]:f[p++];return n};return Ri=t,Ri}var Ti,Nc;function vv(){if(Nc)return Ti;Nc=1,gs(),tp();var e=Pe(),r=me(),t=dv(),n=Je(),a=Le(),i=pe(),o=qe(),s=wn(),u=Ye(),c=Sn(),l=np(),f=dt(),v=lv(),d=ft(),h=ys(),p=we(),S=ze(),R=vt(),I=jt(),g=rr(),b=Ke(),y=yr(),A=xt(),q=Gr(),j=ws(),G=In(),K=ms(),re=Vr(),L=ke(),M=ip(),N=L("iterator"),m="URLSearchParams",C=m+"Iterator",U=d.set,F=d.getterFor(m),w=d.getterFor(C),T=t("fetch"),x=t("Request"),H=t("Headers"),Q=x&&x.prototype,J=H&&H.prototype,le=r.TypeError,ne=r.encodeURIComponent,ue=String.fromCharCode,ae=n("String","fromCodePoint"),Re=parseInt,xe=i("".charAt),je=i([].join),$e=i([].push),Qe=i("".replace),wr=i([].shift),Sr=i([].splice),_r=i("".split),Ar=i("".slice),yt=i(/./.exec),zr=/\+/g,kr="�",ye=/^[0-9a-f]+$/i,Xe=function(D,V){var z=Ar(D,V,V+2);return yt(ye,z)?Re(z,16):NaN},qr=function(D){for(var V=0,z=128;z>0&&(D&z)!==0;z>>=1)V++;return V},B=function(D){var V=null;switch(D.length){case 1:V=D[0];break;case 2:V=(D[0]&31)<<6|D[1]&63;break;case 3:V=(D[0]&15)<<12|(D[1]&63)<<6|D[2]&63;break;case 4:V=(D[0]&7)<<18|(D[1]&63)<<12|(D[2]&63)<<6|D[3]&63;break}return V>1114111?null:V},X=function(D){D=Qe(D,zr," ");for(var V=D.length,z="",Y=0;Y<V;){var ie=xe(D,Y);if(ie==="%"){if(xe(D,Y+1)==="%"||Y+3>V){z+="%",Y++;continue}var se=Xe(D,Y+1);if(se!==se){z+=ie,Y++;continue}Y+=2;var ve=qr(se);if(ve===0)ie=ue(se);else{if(ve===1||ve>4){z+=kr,Y++;continue}for(var he=[se],Se=1;Se<ve&&(Y++,!(Y+3>V||xe(D,Y)!=="%"));){var Ue=Xe(D,Y+1);if(Ue!==Ue){Y+=3;break}if(Ue>191||Ue<128)break;$e(he,Ue),Y+=2,Se++}if(he.length!==ve){z+=kr;continue}var nr=B(he);nr===null?z+=kr:ie=ae(nr)}}z+=ie,Y++}return z},oe=/[!'()~]|%20/g,ce={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},fe=function(D){return ce[D]},He=function(D){return Qe(ne(D),oe,fe)},Te=v(function(V,z){U(this,{type:C,target:F(V).entries,index:0,kind:z})},m,function(){var V=w(this),z=V.target,Y=V.index++;if(!z||Y>=z.length)return V.target=null,K(void 0,!0);var ie=z[Y];switch(V.kind){case"keys":return K(ie.key,!1);case"values":return K(ie.value,!1)}return K([ie.key,ie.value],!1)},!0),De=function(D){this.entries=[],this.url=null,D!==void 0&&(b(D)?this.parseObject(D):this.parseQuery(typeof D=="string"?xe(D,0)==="?"?Ar(D,1):D:y(D)))};De.prototype={type:m,bindURL:function(D){this.url=D,this.update()},parseObject:function(D){var V=this.entries,z=G(D),Y,ie,se,ve,he,Se,Ue;if(z)for(Y=j(D,z),ie=Y.next;!(se=a(ie,Y)).done;){if(ve=j(g(se.value)),he=ve.next,(Se=a(he,ve)).done||(Ue=a(he,ve)).done||!a(he,ve).done)throw new le("Expected sequence with length 2");$e(V,{key:y(Se.value),value:y(Ue.value)})}else for(var nr in D)S(D,nr)&&$e(V,{key:nr,value:y(D[nr])})},parseQuery:function(D){if(D)for(var V=this.entries,z=_r(D,"&"),Y=0,ie,se;Y<z.length;)ie=z[Y++],ie.length&&(se=_r(ie,"="),$e(V,{key:X(wr(se)),value:X(je(se,"="))}))},serialize:function(){for(var D=this.entries,V=[],z=0,Y;z<D.length;)Y=D[z++],$e(V,He(Y.key)+"="+He(Y.value));return je(V,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var Oe=function(){h(this,Ge);var V=arguments.length>0?arguments[0]:void 0,z=U(this,new De(V));o||(this.size=z.entries.length)},Ge=Oe.prototype;if(l(Ge,{append:function(V,z){var Y=F(this);re(arguments.length,2),$e(Y.entries,{key:y(V),value:y(z)}),o||this.length++,Y.updateURL()},delete:function(D){for(var V=F(this),z=re(arguments.length,1),Y=V.entries,ie=y(D),se=z<2?void 0:arguments[1],ve=se===void 0?se:y(se),he=0;he<Y.length;){var Se=Y[he];if(Se.key===ie&&(ve===void 0||Se.value===ve)){if(Sr(Y,he,1),ve!==void 0)break}else he++}o||(this.size=Y.length),V.updateURL()},get:function(V){var z=F(this).entries;re(arguments.length,1);for(var Y=y(V),ie=0;ie<z.length;ie++)if(z[ie].key===Y)return z[ie].value;return null},getAll:function(V){var z=F(this).entries;re(arguments.length,1);for(var Y=y(V),ie=[],se=0;se<z.length;se++)z[se].key===Y&&$e(ie,z[se].value);return ie},has:function(V){for(var z=F(this).entries,Y=re(arguments.length,1),ie=y(V),se=Y<2?void 0:arguments[1],ve=se===void 0?se:y(se),he=0;he<z.length;){var Se=z[he++];if(Se.key===ie&&(ve===void 0||Se.value===ve))return!0}return!1},set:function(V,z){var Y=F(this);re(arguments.length,1);for(var ie=Y.entries,se=!1,ve=y(V),he=y(z),Se=0,Ue;Se<ie.length;Se++)Ue=ie[Se],Ue.key===ve&&(se?Sr(ie,Se--,1):(se=!0,Ue.value=he));se||$e(ie,{key:ve,value:he}),o||(this.size=ie.length),Y.updateURL()},sort:function(){var V=F(this);M(V.entries,function(z,Y){return z.key>Y.key?1:-1}),V.updateURL()},forEach:function(V){for(var z=F(this).entries,Y=R(V,arguments.length>1?arguments[1]:void 0),ie=0,se;ie<z.length;)se=z[ie++],Y(se.value,se.key,this)},keys:function(){return new Te(this,"keys")},values:function(){return new Te(this,"values")},entries:function(){return new Te(this,"entries")}},{enumerable:!0}),u(Ge,N,Ge.entries,{name:"entries"}),u(Ge,"toString",function(){return F(this).serialize()},{enumerable:!0}),o&&c(Ge,"size",{get:function(){return F(this).entries.length},configurable:!0,enumerable:!0}),f(Oe,m),e({global:!0,constructor:!0,forced:!s},{URLSearchParams:Oe}),!s&&p(H)){var Kr=i(J.has),bt=i(J.set),Jr=function(D){if(b(D)){var V=D.body,z;if(I(V)===m)return z=D.headers?new H(D.headers):new H,Kr(z,"content-type")||bt(z,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),A(D,{body:q(0,y(V)),headers:q(0,z)})}return D};if(p(T)&&e({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(V){return T(V,arguments.length>1?Jr(arguments[1]):{})}}),p(x)){var Yr=function(V){return h(this,Q),new x(V,arguments.length>1?Jr(arguments[1]):{})};Q.constructor=Yr,Yr.prototype=Q,e({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Yr})}}return Ti={URLSearchParams:Oe,getState:F},Ti}var jc;function op(){return jc||(jc=1,vv()),Gs}var Dc={},Mc;function sp(){if(Mc)return Dc;Mc=1;var e=Ye(),r=pe(),t=yr(),n=Vr(),a=URLSearchParams,i=a.prototype,o=r(i.append),s=r(i.delete),u=r(i.forEach),c=r([].push),l=new a("a=1&a=2&b=3");return l.delete("a",1),l.delete("b",void 0),l+""!="a=2"&&e(i,"delete",function(f){var v=arguments.length,d=v<2?void 0:arguments[1];if(v&&d===void 0)return s(this,f);var h=[];u(this,function(A,q){c(h,{key:q,value:A})}),n(v,1);for(var p=t(f),S=t(d),R=0,I=0,g=!1,b=h.length,y;R<b;)y=h[R++],g||y.key===p?(g=!0,s(this,y.key)):I++;for(;I<b;)y=h[I++],y.key===p&&y.value===S||o(this,y.key,y.value)},{enumerable:!0,unsafe:!0}),Dc}var Fc={},Bc;function up(){if(Bc)return Fc;Bc=1;var e=Ye(),r=pe(),t=yr(),n=Vr(),a=URLSearchParams,i=a.prototype,o=r(i.getAll),s=r(i.has),u=new a("a=1");return(u.has("a",2)||!u.has("a",void 0))&&e(i,"has",function(l){var f=arguments.length,v=f<2?void 0:arguments[1];if(f&&v===void 0)return s(this,l);var d=o(this,l);n(f,1);for(var h=t(v),p=0;p<d.length;)if(d[p++]===h)return!0;return!1},{enumerable:!0,unsafe:!0}),Fc}var Hc={},Gc;function cp(){if(Gc)return Hc;Gc=1;var e=qe(),r=pe(),t=Sn(),n=URLSearchParams.prototype,a=r(n.forEach);return e&&!("size"in n)&&t(n,"size",{get:function(){var o=0;return a(this,function(){o++}),o},configurable:!0,enumerable:!0}),Hc}var Oi,Wc;function En(){if(Wc)return Oi;Wc=1;var e=me();return Oi=e,Oi}var Ci,Vc;function hv(){if(Vc)return Ci;Vc=1,op(),sp(),up(),cp();var e=En();return Ci=e.URLSearchParams,Ci}var zc={},Kc={},Jc={},_i,Yc;function pv(){if(Yc)return _i;Yc=1;var e=pe(),r=us(),t=yr(),n=pn(),a=e("".charAt),i=e("".charCodeAt),o=e("".slice),s=function(u){return function(c,l){var f=t(n(c)),v=r(l),d=f.length,h,p;return v<0||v>=d?u?"":void 0:(h=i(f,v),h<55296||h>56319||v+1===d||(p=i(f,v+1))<56320||p>57343?u?a(f,v):h:u?o(f,v,v+2):(h-55296<<10)+(p-56320)+65536)}};return _i={codeAt:s(!1),charAt:s(!0)},_i}var Qc;function mv(){if(Qc)return Jc;Qc=1;var e=pv().charAt,r=yr(),t=ft(),n=fv(),a=ms(),i="String Iterator",o=t.set,s=t.getterFor(i);return n(String,"String",function(u){o(this,{type:i,string:r(u),index:0})},function(){var c=s(this),l=c.string,f=c.index,v;return f>=l.length?a(void 0,!0):(v=e(l,f),c.index+=v.length,a(v,!1))}),Jc}var Ai,Xc;function lp(){if(Xc)return Ai;Xc=1;var e=qe(),r=pe(),t=Le(),n=Ae(),a=ev(),i=ov(),o=tv(),s=mn(),u=Bd(),c=Object.assign,l=Object.defineProperty,f=r([].concat);return Ai=!c||n(function(){if(e&&c({b:1},c(l({},"a",{enumerable:!0,get:function(){l(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var v={},d={},h=Symbol("assign detection"),p="abcdefghijklmnopqrst";return v[h]=7,p.split("").forEach(function(S){d[S]=S}),c({},v)[h]!==7||a(c({},d)).join("")!==p})?function(d,h){for(var p=s(d),S=arguments.length,R=1,I=i.f,g=o.f;S>R;)for(var b=u(arguments[R++]),y=I?f(a(b),I(b)):a(b),A=y.length,q=0,j;A>q;)j=y[q++],(!e||t(g,b,j))&&(p[j]=b[j]);return p}:c,Ai}var ki,Zc;function gv(){if(Zc)return ki;Zc=1;var e=Le(),r=rr(),t=ss();return ki=function(n,a,i){var o,s;r(n);try{if(o=t(n,"return"),!o){if(a==="throw")throw i;return i}o=e(o,n)}catch(u){s=!0,o=u}if(a==="throw")throw i;if(s)throw o;return r(o),i},ki}var qi,el;function fp(){if(el)return qi;el=1;var e=rr(),r=gv();return qi=function(t,n,a,i){try{return i?n(e(a)[0],a[1]):n(a)}catch(o){r(t,"throw",o)}},qi}var $i,rl;function yv(){if(rl)return $i;rl=1;var e=ke(),r=Nt(),t=e("iterator"),n=Array.prototype;return $i=function(a){return a!==void 0&&(r.Array===a||n[t]===a)},$i}var Ui,tl;function bv(){if(tl)return Ui;tl=1;var e=pe(),r=Ae(),t=we(),n=jt(),a=Je(),i=vs(),o=function(){},s=a("Reflect","construct"),u=/^\s*(?:class|function)\b/,c=e(u.exec),l=!u.test(o),f=function(h){if(!t(h))return!1;try{return s(o,[],h),!0}catch{return!1}},v=function(h){if(!t(h))return!1;switch(n(h)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return l||!!c(u,i(h))}catch{return!0}};return v.sham=!0,Ui=!s||r(function(){var d;return f(f.call)||!f(Object)||!f(function(){d=!0})||d})?v:f,Ui}var Li,nl;function dp(){if(nl)return Li;nl=1;var e=qe(),r=gr(),t=Gr();return Li=function(n,a,i){e?r.f(n,a,t(0,i)):n[a]=i},Li}var xi,al;function vp(){if(al)return xi;al=1;var e=vt(),r=Le(),t=mn(),n=fp(),a=yv(),i=bv(),o=cs(),s=dp(),u=ws(),c=In(),l=Array;return xi=function(v){var d=t(v),h=i(this),p=arguments.length,S=p>1?arguments[1]:void 0,R=S!==void 0;R&&(S=e(S,p>2?arguments[2]:void 0));var I=c(d),g=0,b,y,A,q,j,G;if(I&&!(this===l&&a(I)))for(y=h?new this:[],q=u(d,I),j=q.next;!(A=r(j,q)).done;g++)G=R?n(q,S,[A.value,g],!0):A.value,s(y,g,G);else for(b=o(d),y=h?new this(b):l(b);b>g;g++)G=R?S(d[g],g):d[g],s(y,g,G);return y.length=g,y},xi}var Ni,il;function hp(){if(il)return Ni;il=1;var e=pe(),r=2147483647,t=36,n=1,a=26,i=38,o=700,s=72,u=128,c="-",l=/[^\0-\u007E]/,f=/[.\u3002\uFF0E\uFF61]/g,v="Overflow: input needs wider integers to process",d=t-n,h=RangeError,p=e(f.exec),S=Math.floor,R=String.fromCharCode,I=e("".charCodeAt),g=e([].join),b=e([].push),y=e("".replace),A=e("".split),q=e("".toLowerCase),j=function(L){for(var M=[],N=0,m=L.length;N<m;){var C=I(L,N++);if(C>=55296&&C<=56319&&N<m){var U=I(L,N++);(U&64512)===56320?b(M,((C&1023)<<10)+(U&1023)+65536):(b(M,C),N--)}else b(M,C)}return M},G=function(L){return L+22+75*(L<26)},K=function(L,M,N){var m=0;for(L=N?S(L/o):L>>1,L+=S(L/M);L>d*a>>1;)L=S(L/d),m+=t;return S(m+(d+1)*L/(L+i))},re=function(L){var M=[];L=j(L);var N=L.length,m=u,C=0,U=s,F,w;for(F=0;F<L.length;F++)w=L[F],w<128&&b(M,R(w));var T=M.length,x=T;for(T&&b(M,c);x<N;){var H=r;for(F=0;F<L.length;F++)w=L[F],w>=m&&w<H&&(H=w);var Q=x+1;if(H-m>S((r-C)/Q))throw new h(v);for(C+=(H-m)*Q,m=H,F=0;F<L.length;F++){if(w=L[F],w<m&&++C>r)throw new h(v);if(w===m){for(var J=C,le=t;;){var ne=le<=U?n:le>=U+a?a:le-U;if(J<ne)break;var ue=J-ne,ae=t-ne;b(M,R(G(ne+ue%ae))),J=S(ue/ae),le+=t}b(M,R(G(J))),U=K(C,Q,x===T),C=0,x++}}C++,m++}return g(M,"")};return Ni=function(L){var M=[],N=A(y(q(L),f,"."),"."),m,C;for(m=0;m<N.length;m++)C=N[m],b(M,p(l,C)?"xn--"+re(C):C);return g(M,".")},Ni}var ol;function pp(){if(ol)return Kc;ol=1,mv();var e=Pe(),r=qe(),t=wn(),n=me(),a=vt(),i=pe(),o=Ye(),s=Sn(),u=ys(),c=ze(),l=lp(),f=vp(),v=Pn(),d=pv().codeAt,h=hp(),p=yr(),S=dt(),R=Vr(),I=vv(),g=ft(),b=g.set,y=g.getterFor("URL"),A=I.URLSearchParams,q=I.getState,j=n.URL,G=n.TypeError,K=n.parseInt,re=Math.floor,L=Math.pow,M=i("".charAt),N=i(/./.exec),m=i([].join),C=i(1.1.toString),U=i([].pop),F=i([].push),w=i("".replace),T=i([].shift),x=i("".split),H=i("".slice),Q=i("".toLowerCase),J=i([].unshift),le="Invalid authority",ne="Invalid scheme",ue="Invalid host",ae="Invalid port",Re=/[a-z]/i,xe=/[\d+-.a-z]/i,je=/\d/,$e=/^0x/i,Qe=/^[0-7]+$/,wr=/^\d+$/,Sr=/^[\da-f]+$/i,_r=/[\0\t\n\r #%/:<>?@[\\\]^|]/,Ar=/[\0\t\n\r #/:<>?@[\\\]^|]/,yt=/^[\u0000-\u0020]+/,zr=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,kr=/[\t\n\r]/g,ye,Xe=function(E){var $=x(E,"."),O,P,_,te,W,be,Ie;if($.length&&$[$.length-1]===""&&$.length--,O=$.length,O>4)return E;for(P=[],_=0;_<O;_++){if(te=$[_],te==="")return E;if(W=10,te.length>1&&M(te,0)==="0"&&(W=N($e,te)?16:8,te=H(te,W===8?1:2)),te==="")be=0;else{if(!N(W===10?wr:W===8?Qe:Sr,te))return E;be=K(te,W)}F(P,be)}for(_=0;_<O;_++)if(be=P[_],_===O-1){if(be>=L(256,5-O))return null}else if(be>255)return null;for(Ie=U(P),_=0;_<P.length;_++)Ie+=P[_]*L(256,3-_);return Ie},qr=function(E){var $=[0,0,0,0,0,0,0,0],O=0,P=null,_=0,te,W,be,Ie,Ce,Ve,k,Ee=function(){return M(E,_)};if(Ee()===":"){if(M(E,1)!==":")return;_+=2,O++,P=O}for(;Ee();){if(O===8)return;if(Ee()===":"){if(P!==null)return;_++,O++,P=O;continue}for(te=W=0;W<4&&N(Sr,Ee());)te=te*16+K(Ee(),16),_++,W++;if(Ee()==="."){if(W===0||(_-=W,O>6))return;for(be=0;Ee();){if(Ie=null,be>0)if(Ee()==="."&&be<4)_++;else return;if(!N(je,Ee()))return;for(;N(je,Ee());){if(Ce=K(Ee(),10),Ie===null)Ie=Ce;else{if(Ie===0)return;Ie=Ie*10+Ce}if(Ie>255)return;_++}$[O]=$[O]*256+Ie,be++,(be===2||be===4)&&O++}if(be!==4)return;break}else if(Ee()===":"){if(_++,!Ee())return}else if(Ee())return;$[O++]=te}if(P!==null)for(Ve=O-P,O=7;O!==0&&Ve>0;)k=$[O],$[O--]=$[P+Ve-1],$[P+--Ve]=k;else if(O!==8)return;return $},B=function(E){for(var $=null,O=1,P=null,_=0,te=0;te<8;te++)E[te]!==0?(_>O&&($=P,O=_),P=null,_=0):(P===null&&(P=te),++_);return _>O?P:$},X=function(E){var $,O,P,_;if(typeof E=="number"){for($=[],O=0;O<4;O++)J($,E%256),E=re(E/256);return m($,".")}if(typeof E=="object"){for($="",P=B(E),O=0;O<8;O++)_&&E[O]===0||(_&&(_=!1),P===O?($+=O?":":"::",_=!0):($+=C(E[O],16),O<7&&($+=":")));return"["+$+"]"}return E},oe={},ce=l({},oe,{" ":1,'"':1,"<":1,">":1,"`":1}),fe=l({},ce,{"#":1,"?":1,"{":1,"}":1}),He=l({},fe,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Te=function(E,$){var O=d(E,0);return O>32&&O<127&&!c($,E)?E:encodeURIComponent(E)},De={ftp:21,file:null,http:80,https:443,ws:80,wss:443},Oe=function(E,$){var O;return E.length===2&&N(Re,M(E,0))&&((O=M(E,1))===":"||!$&&O==="|")},Ge=function(E){var $;return E.length>1&&Oe(H(E,0,2))&&(E.length===2||($=M(E,2))==="/"||$==="\\"||$==="?"||$==="#")},Kr=function(E){return E==="."||Q(E)==="%2e"},bt=function(E){return E=Q(E),E===".."||E==="%2e."||E===".%2e"||E==="%2e%2e"},Jr={},Yr={},D={},V={},z={},Y={},ie={},se={},ve={},he={},Se={},Ue={},nr={},qn={},Ns={},$n={},Qr={},ar={},js={},$r={},ur={},Un=function(E,$,O){var P=p(E),_,te,W;if($){if(te=this.parse(P),te)throw new G(te);this.searchParams=null}else{if(O!==void 0&&(_=new Un(O,!0)),te=this.parse(P,null,_),te)throw new G(te);W=q(new A),W.bindURL(this),this.searchParams=W}};Un.prototype={type:"URL",parse:function(E,$,O){var P=this,_=$||Jr,te=0,W="",be=!1,Ie=!1,Ce=!1,Ve,k,Ee,cr;for(E=p(E),$||(P.scheme="",P.username="",P.password="",P.host=null,P.port=null,P.path=[],P.query=null,P.fragment=null,P.cannotBeABaseURL=!1,E=w(E,yt,""),E=w(E,zr,"$1")),E=w(E,kr,""),Ve=f(E);te<=Ve.length;){switch(k=Ve[te],_){case Jr:if(k&&N(Re,k))W+=Q(k),_=Yr;else{if($)return ne;_=D;continue}break;case Yr:if(k&&(N(xe,k)||k==="+"||k==="-"||k==="."))W+=Q(k);else if(k===":"){if($&&(P.isSpecial()!==c(De,W)||W==="file"&&(P.includesCredentials()||P.port!==null)||P.scheme==="file"&&!P.host))return;if(P.scheme=W,$){P.isSpecial()&&De[P.scheme]===P.port&&(P.port=null);return}W="",P.scheme==="file"?_=qn:P.isSpecial()&&O&&O.scheme===P.scheme?_=V:P.isSpecial()?_=se:Ve[te+1]==="/"?(_=z,te++):(P.cannotBeABaseURL=!0,F(P.path,""),_=js)}else{if($)return ne;W="",_=D,te=0;continue}break;case D:if(!O||O.cannotBeABaseURL&&k!=="#")return ne;if(O.cannotBeABaseURL&&k==="#"){P.scheme=O.scheme,P.path=v(O.path),P.query=O.query,P.fragment="",P.cannotBeABaseURL=!0,_=ur;break}_=O.scheme==="file"?qn:Y;continue;case V:if(k==="/"&&Ve[te+1]==="/")_=ve,te++;else{_=Y;continue}break;case z:if(k==="/"){_=he;break}else{_=ar;continue}case Y:if(P.scheme=O.scheme,k===ye)P.username=O.username,P.password=O.password,P.host=O.host,P.port=O.port,P.path=v(O.path),P.query=O.query;else if(k==="/"||k==="\\"&&P.isSpecial())_=ie;else if(k==="?")P.username=O.username,P.password=O.password,P.host=O.host,P.port=O.port,P.path=v(O.path),P.query="",_=$r;else if(k==="#")P.username=O.username,P.password=O.password,P.host=O.host,P.port=O.port,P.path=v(O.path),P.query=O.query,P.fragment="",_=ur;else{P.username=O.username,P.password=O.password,P.host=O.host,P.port=O.port,P.path=v(O.path),P.path.length--,_=ar;continue}break;case ie:if(P.isSpecial()&&(k==="/"||k==="\\"))_=ve;else if(k==="/")_=he;else{P.username=O.username,P.password=O.password,P.host=O.host,P.port=O.port,_=ar;continue}break;case se:if(_=ve,k!=="/"||M(W,te+1)!=="/")continue;te++;break;case ve:if(k!=="/"&&k!=="\\"){_=he;continue}break;case he:if(k==="@"){be&&(W="%40"+W),be=!0,Ee=f(W);for(var Ln=0;Ln<Ee.length;Ln++){var Fs=Ee[Ln];if(Fs===":"&&!Ce){Ce=!0;continue}var Bs=Te(Fs,He);Ce?P.password+=Bs:P.username+=Bs}W=""}else if(k===ye||k==="/"||k==="?"||k==="#"||k==="\\"&&P.isSpecial()){if(be&&W==="")return le;te-=f(W).length+1,W="",_=Se}else W+=k;break;case Se:case Ue:if($&&P.scheme==="file"){_=$n;continue}else if(k===":"&&!Ie){if(W==="")return ue;if(cr=P.parseHost(W),cr)return cr;if(W="",_=nr,$===Ue)return}else if(k===ye||k==="/"||k==="?"||k==="#"||k==="\\"&&P.isSpecial()){if(P.isSpecial()&&W==="")return ue;if($&&W===""&&(P.includesCredentials()||P.port!==null))return;if(cr=P.parseHost(W),cr)return cr;if(W="",_=Qr,$)return;continue}else k==="["?Ie=!0:k==="]"&&(Ie=!1),W+=k;break;case nr:if(N(je,k))W+=k;else if(k===ye||k==="/"||k==="?"||k==="#"||k==="\\"&&P.isSpecial()||$){if(W!==""){var xn=K(W,10);if(xn>65535)return ae;P.port=P.isSpecial()&&xn===De[P.scheme]?null:xn,W=""}if($)return;_=Qr;continue}else return ae;break;case qn:if(P.scheme="file",k==="/"||k==="\\")_=Ns;else if(O&&O.scheme==="file")switch(k){case ye:P.host=O.host,P.path=v(O.path),P.query=O.query;break;case"?":P.host=O.host,P.path=v(O.path),P.query="",_=$r;break;case"#":P.host=O.host,P.path=v(O.path),P.query=O.query,P.fragment="",_=ur;break;default:Ge(m(v(Ve,te),""))||(P.host=O.host,P.path=v(O.path),P.shortenPath()),_=ar;continue}else{_=ar;continue}break;case Ns:if(k==="/"||k==="\\"){_=$n;break}O&&O.scheme==="file"&&!Ge(m(v(Ve,te),""))&&(Oe(O.path[0],!0)?F(P.path,O.path[0]):P.host=O.host),_=ar;continue;case $n:if(k===ye||k==="/"||k==="\\"||k==="?"||k==="#"){if(!$&&Oe(W))_=ar;else if(W===""){if(P.host="",$)return;_=Qr}else{if(cr=P.parseHost(W),cr)return cr;if(P.host==="localhost"&&(P.host=""),$)return;W="",_=Qr}continue}else W+=k;break;case Qr:if(P.isSpecial()){if(_=ar,k!=="/"&&k!=="\\")continue}else if(!$&&k==="?")P.query="",_=$r;else if(!$&&k==="#")P.fragment="",_=ur;else if(k!==ye&&(_=ar,k!=="/"))continue;break;case ar:if(k===ye||k==="/"||k==="\\"&&P.isSpecial()||!$&&(k==="?"||k==="#")){if(bt(W)?(P.shortenPath(),k!=="/"&&!(k==="\\"&&P.isSpecial())&&F(P.path,"")):Kr(W)?k!=="/"&&!(k==="\\"&&P.isSpecial())&&F(P.path,""):(P.scheme==="file"&&!P.path.length&&Oe(W)&&(P.host&&(P.host=""),W=M(W,0)+":"),F(P.path,W)),W="",P.scheme==="file"&&(k===ye||k==="?"||k==="#"))for(;P.path.length>1&&P.path[0]==="";)T(P.path);k==="?"?(P.query="",_=$r):k==="#"&&(P.fragment="",_=ur)}else W+=Te(k,fe);break;case js:k==="?"?(P.query="",_=$r):k==="#"?(P.fragment="",_=ur):k!==ye&&(P.path[0]+=Te(k,oe));break;case $r:!$&&k==="#"?(P.fragment="",_=ur):k!==ye&&(k==="'"&&P.isSpecial()?P.query+="%27":k==="#"?P.query+="%23":P.query+=Te(k,oe));break;case ur:k!==ye&&(P.fragment+=Te(k,ce));break}te++}},parseHost:function(E){var $,O,P;if(M(E,0)==="["){if(M(E,E.length-1)!=="]"||($=qr(H(E,1,-1)),!$))return ue;this.host=$}else if(this.isSpecial()){if(E=h(E),N(_r,E)||($=Xe(E),$===null))return ue;this.host=$}else{if(N(Ar,E))return ue;for($="",O=f(E),P=0;P<O.length;P++)$+=Te(O[P],oe);this.host=$}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme==="file"},includesCredentials:function(){return this.username!==""||this.password!==""},isSpecial:function(){return c(De,this.scheme)},shortenPath:function(){var E=this.path,$=E.length;$&&(this.scheme!=="file"||$!==1||!Oe(E[0],!0))&&E.length--},serialize:function(){var E=this,$=E.scheme,O=E.username,P=E.password,_=E.host,te=E.port,W=E.path,be=E.query,Ie=E.fragment,Ce=$+":";return _!==null?(Ce+="//",E.includesCredentials()&&(Ce+=O+(P?":"+P:"")+"@"),Ce+=X(_),te!==null&&(Ce+=":"+te)):$==="file"&&(Ce+="//"),Ce+=E.cannotBeABaseURL?W[0]:W.length?"/"+m(W,"/"):"",be!==null&&(Ce+="?"+be),Ie!==null&&(Ce+="#"+Ie),Ce},setHref:function(E){var $=this.parse(E);if($)throw new G($);this.searchParams.update()},getOrigin:function(){var E=this.scheme,$=this.port;if(E==="blob")try{return new Xr(E.path[0]).origin}catch{return"null"}return E==="file"||!this.isSpecial()?"null":E+"://"+X(this.host)+($!==null?":"+$:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(E){this.parse(p(E)+":",Jr)},getUsername:function(){return this.username},setUsername:function(E){var $=f(p(E));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var O=0;O<$.length;O++)this.username+=Te($[O],He)}},getPassword:function(){return this.password},setPassword:function(E){var $=f(p(E));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var O=0;O<$.length;O++)this.password+=Te($[O],He)}},getHost:function(){var E=this.host,$=this.port;return E===null?"":$===null?X(E):X(E)+":"+$},setHost:function(E){this.cannotBeABaseURL||this.parse(E,Se)},getHostname:function(){var E=this.host;return E===null?"":X(E)},setHostname:function(E){this.cannotBeABaseURL||this.parse(E,Ue)},getPort:function(){var E=this.port;return E===null?"":p(E)},setPort:function(E){this.cannotHaveUsernamePasswordPort()||(E=p(E),E===""?this.port=null:this.parse(E,nr))},getPathname:function(){var E=this.path;return this.cannotBeABaseURL?E[0]:E.length?"/"+m(E,"/"):""},setPathname:function(E){this.cannotBeABaseURL||(this.path=[],this.parse(E,Qr))},getSearch:function(){var E=this.query;return E?"?"+E:""},setSearch:function(E){E=p(E),E===""?this.query=null:(M(E,0)==="?"&&(E=H(E,1)),this.query="",this.parse(E,$r)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var E=this.fragment;return E?"#"+E:""},setHash:function(E){if(E=p(E),E===""){this.fragment=null;return}M(E,0)==="#"&&(E=H(E,1)),this.fragment="",this.parse(E,ur)},update:function(){this.query=this.searchParams.serialize()||null}};var Xr=function($){var O=u(this,Ne),P=R(arguments.length,1)>1?arguments[1]:void 0,_=b(O,new Un($,!1,P));r||(O.href=_.serialize(),O.origin=_.getOrigin(),O.protocol=_.getProtocol(),O.username=_.getUsername(),O.password=_.getPassword(),O.host=_.getHost(),O.hostname=_.getHostname(),O.port=_.getPort(),O.pathname=_.getPathname(),O.search=_.getSearch(),O.searchParams=_.getSearchParams(),O.hash=_.getHash())},Ne=Xr.prototype,We=function(E,$){return{get:function(){return y(this)[E]()},set:$&&function(O){return y(this)[$](O)},configurable:!0,enumerable:!0}};if(r&&(s(Ne,"href",We("serialize","setHref")),s(Ne,"origin",We("getOrigin")),s(Ne,"protocol",We("getProtocol","setProtocol")),s(Ne,"username",We("getUsername","setUsername")),s(Ne,"password",We("getPassword","setPassword")),s(Ne,"host",We("getHost","setHost")),s(Ne,"hostname",We("getHostname","setHostname")),s(Ne,"port",We("getPort","setPort")),s(Ne,"pathname",We("getPathname","setPathname")),s(Ne,"search",We("getSearch","setSearch")),s(Ne,"searchParams",We("getSearchParams")),s(Ne,"hash",We("getHash","setHash"))),o(Ne,"toJSON",function(){return y(this).serialize()},{enumerable:!0}),o(Ne,"toString",function(){return y(this).serialize()},{enumerable:!0}),j){var Ds=j.createObjectURL,Ms=j.revokeObjectURL;Ds&&o(Xr,"createObjectURL",a(Ds,j)),Ms&&o(Xr,"revokeObjectURL",a(Ms,j))}return S(Xr,"URL"),e({global:!0,constructor:!0,forced:!t,sham:!r},{URL:Xr}),Kc}var sl;function mp(){return sl||(sl=1,pp()),zc}var ul={},cl;function gp(){if(cl)return ul;cl=1;var e=Pe(),r=Je(),t=Ae(),n=Vr(),a=yr(),i=wn(),o=r("URL"),s=i&&t(function(){o.canParse()}),u=t(function(){return o.canParse.length!==1});return e({target:"URL",stat:!0,forced:!s||u},{canParse:function(l){var f=n(arguments.length,1),v=a(l),d=f<2||arguments[1]===void 0?void 0:a(arguments[1]);try{return!!new o(v,d)}catch{return!1}}}),ul}var ll={},fl;function yp(){if(fl)return ll;fl=1;var e=Pe(),r=Je(),t=Vr(),n=yr(),a=wn(),i=r("URL");return e({target:"URL",stat:!0,forced:!a},{parse:function(s){var u=t(arguments.length,1),c=n(s),l=u<2||arguments[1]===void 0?void 0:n(arguments[1]);try{return new i(c,l)}catch{return null}}}),ll}var dl={},vl;function bp(){if(vl)return dl;vl=1;var e=Pe(),r=Le();return e({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return r(URL.prototype.toString,this)}}),dl}var ji,hl;function wp(){if(hl)return ji;hl=1,hv(),mp(),gp(),yp(),bp();var e=En();return ji=e.URL,ji}var Di,pl;function Sp(){if(pl)return Di;pl=1;var e=wp();return Di=e,Di}var Mi,ml;function Ip(){if(ml)return Mi;ml=1;var e=Sp();return Mi=e,Mi}Ip();var gl={},Fi,yl;function Pp(){return yl||(yl=1,Fi={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}),Fi}var Bi,bl;function Ep(){if(bl)return Bi;bl=1;var e=gn(),r=e("span").classList,t=r&&r.constructor&&r.constructor.prototype;return Bi=t===Object.prototype?void 0:t,Bi}var wl;function wv(){if(wl)return gl;wl=1;var e=me(),r=Pp(),t=Ep(),n=gs(),a=Wr(),i=dt(),o=ke(),s=o("iterator"),u=n.values,c=function(f,v){if(f){if(f[s]!==u)try{a(f,s,u)}catch{f[s]=u}if(i(f,v,!0),r[v]){for(var d in n)if(f[d]!==n[d])try{a(f,d,n[d])}catch{f[d]=n[d]}}}};for(var l in r)c(e[l]&&e[l].prototype,l);return c(t,"DOMTokenList"),gl}var Hi,Sl;function Rp(){if(Sl)return Hi;Sl=1;var e=hv();return wv(),Hi=e,Hi}var Gi,Il;function Tp(){if(Il)return Gi;Il=1;var e=Rp();return Gi=e,Gi}Tp();var Pl={},El={},Wi,Rl;function Op(){if(Rl)return Wi;Rl=1;var e=Ke(),r=Wr();return Wi=function(t,n){e(n)&&"cause"in n&&r(t,"cause",n.cause)},Wi}var Vi,Tl;function Cp(){if(Tl)return Vi;Tl=1;var e=pe(),r=Error,t=e("".replace),n=(function(o){return String(new r(o).stack)})("zxcasd"),a=/\n\s*at [^:]*:[^\n]*/,i=a.test(n);return Vi=function(o,s){if(i&&typeof o=="string"&&!r.prepareStackTrace)for(;s--;)o=t(o,a,"");return o},Vi}var zi,Ol;function _p(){if(Ol)return zi;Ol=1;var e=Ae(),r=Gr();return zi=!e(function(){var t=new Error("a");return"stack"in t?(Object.defineProperty(t,"stack",r(1,7)),t.stack!==7):!0}),zi}var Ki,Cl;function Ap(){if(Cl)return Ki;Cl=1;var e=Wr(),r=Cp(),t=_p(),n=Error.captureStackTrace;return Ki=function(a,i,o,s){t&&(n?n(a,i):e(a,"stack",r(o,s)))},Ki}var Ji,_l;function Dt(){if(_l)return Ji;_l=1;var e=vt(),r=Le(),t=rr(),n=bn(),a=yv(),i=cs(),o=yn(),s=ws(),u=In(),c=gv(),l=TypeError,f=function(d,h){this.stopped=d,this.result=h},v=f.prototype;return Ji=function(d,h,p){var S=p&&p.that,R=!!(p&&p.AS_ENTRIES),I=!!(p&&p.IS_RECORD),g=!!(p&&p.IS_ITERATOR),b=!!(p&&p.INTERRUPTED),y=e(h,S),A,q,j,G,K,re,L,M=function(m){return A&&c(A,"normal"),new f(!0,m)},N=function(m){return R?(t(m),b?y(m[0],m[1],M):y(m[0],m[1])):b?y(m,M):y(m)};if(I)A=d.iterator;else if(g)A=d;else{if(q=u(d),!q)throw new l(n(d)+" is not iterable");if(a(q)){for(j=0,G=i(d);G>j;j++)if(K=N(d[j]),K&&o(v,K))return K;return new f(!1)}A=s(d,q)}for(re=I?d.next:A.next;!(L=r(re,A)).done;){try{K=N(L.value)}catch(m){c(A,"throw",m)}if(typeof K=="object"&&K&&o(v,K))return K}return new f(!1)},Ji}var Yi,Al;function kp(){if(Al)return Yi;Al=1;var e=yr();return Yi=function(r,t){return r===void 0?arguments.length<2?"":t:e(r)},Yi}var kl;function qp(){if(kl)return El;kl=1;var e=Pe(),r=yn(),t=hs(),n=ps(),a=sv(),i=xt(),o=Wr(),s=Gr(),u=Op(),c=Ap(),l=Dt(),f=kp(),v=ke(),d=v("toStringTag"),h=Error,p=[].push,S=function(g,b){var y=r(R,this),A;n?A=n(new h,y?t(this):R):(A=y?this:i(R),o(A,d,"Error")),b!==void 0&&o(A,"message",f(b)),c(A,S,A.stack,1),arguments.length>2&&u(A,arguments[2]);var q=[];return l(g,p,{that:q}),o(A,"errors",q),A};n?n(S,h):a(S,h,{name:!0});var R=S.prototype=i(h.prototype,{constructor:s(1,S),message:s(1,""),name:s(1,"AggregateError")});return e({global:!0,constructor:!0,arity:2},{AggregateError:S}),El}var ql;function $p(){return ql||(ql=1,qp()),Pl}var $l={},Qi,Ul;function Up(){if(Ul)return Qi;Ul=1;var e=bs(),r=jt();return Qi=e?{}.toString:function(){return"[object "+r(this)+"]"},Qi}var Ll;function Lp(){if(Ll)return $l;Ll=1;var e=bs(),r=Ye(),t=Up();return e||r(Object.prototype,"toString",t,{unsafe:!0}),$l}var xl={},Nl={},Xi,jl;function Sv(){if(jl)return Xi;jl=1;var e=me(),r=Lt(),t=vn(),n=function(a){return r.slice(0,a.length)===a};return Xi=(function(){return n("Bun/")?"BUN":n("Cloudflare-Workers")?"CLOUDFLARE":n("Deno/")?"DENO":n("Node.js/")?"NODE":e.Bun&&typeof Bun.version=="string"?"BUN":e.Deno&&typeof Deno.version=="object"?"DENO":t(e.process)==="process"?"NODE":e.window&&e.document?"BROWSER":"REST"})(),Xi}var Zi,Dl;function Ss(){if(Dl)return Zi;Dl=1;var e=Sv();return Zi=e==="NODE",Zi}var eo,Ml;function xp(){if(Ml)return eo;Ml=1;var e=Je(),r=Sn(),t=ke(),n=qe(),a=t("species");return eo=function(i){var o=e(i);n&&o&&!o[a]&&r(o,a,{configurable:!0,get:function(){return this}})},eo}var ro,Fl;function Np(){if(Fl)return ro;Fl=1;var e=bv(),r=bn(),t=TypeError;return ro=function(n){if(e(n))return n;throw new t(r(n)+" is not a constructor")},ro}var to,Bl;function Iv(){if(Bl)return to;Bl=1;var e=rr(),r=Np(),t=hn(),n=ke(),a=n("species");return to=function(i,o){var s=e(i).constructor,u;return s===void 0||t(u=e(s)[a])?o:r(u)},to}var no,Hl;function Pv(){if(Hl)return no;Hl=1;var e=dn(),r=Function.prototype,t=r.apply,n=r.call;return no=typeof Reflect=="object"&&Reflect.apply||(e?n.bind(t):function(){return n.apply(t,arguments)}),no}var ao,Gl;function Ev(){if(Gl)return ao;Gl=1;var e=Lt();return ao=/(?:ipad|iphone|ipod).*applewebkit/i.test(e),ao}var io,Wl;function Rv(){if(Wl)return io;Wl=1;var e=me(),r=Pv(),t=vt(),n=we(),a=ze(),i=Ae(),o=rv(),s=Pn(),u=gn(),c=Vr(),l=Ev(),f=Ss(),v=e.setImmediate,d=e.clearImmediate,h=e.process,p=e.Dispatch,S=e.Function,R=e.MessageChannel,I=e.String,g=0,b={},y="onreadystatechange",A,q,j,G;i(function(){A=e.location});var K=function(N){if(a(b,N)){var m=b[N];delete b[N],m()}},re=function(N){return function(){K(N)}},L=function(N){K(N.data)},M=function(N){e.postMessage(I(N),A.protocol+"//"+A.host)};return(!v||!d)&&(v=function(m){c(arguments.length,1);var C=n(m)?m:S(m),U=s(arguments,1);return b[++g]=function(){r(C,void 0,U)},q(g),g},d=function(m){delete b[m]},f?q=function(N){h.nextTick(re(N))}:p&&p.now?q=function(N){p.now(re(N))}:R&&!l?(j=new R,G=j.port2,j.port1.onmessage=L,q=t(G.postMessage,G)):e.addEventListener&&n(e.postMessage)&&!e.importScripts&&A&&A.protocol!=="file:"&&!i(M)?(q=M,e.addEventListener("message",L,!1)):y in u("script")?q=function(N){o.appendChild(u("script"))[y]=function(){o.removeChild(this),K(N)}}:q=function(N){setTimeout(re(N),0)}),io={set:v,clear:d},io}var oo,Vl;function Tv(){if(Vl)return oo;Vl=1;var e=function(){this.head=null,this.tail=null};return e.prototype={add:function(r){var t={item:r,next:null},n=this.tail;n?n.next=t:this.head=t,this.tail=t},get:function(){var r=this.head;if(r){var t=this.head=r.next;return t===null&&(this.tail=null),r.item}}},oo=e,oo}var so,zl;function jp(){if(zl)return so;zl=1;var e=Lt();return so=/ipad|iphone|ipod/i.test(e)&&typeof Pebble<"u",so}var uo,Kl;function Dp(){if(Kl)return uo;Kl=1;var e=Lt();return uo=/web0s(?!.*chrome)/i.test(e),uo}var co,Jl;function Mp(){if(Jl)return co;Jl=1;var e=me(),r=dv(),t=vt(),n=Rv().set,a=Tv(),i=Ev(),o=jp(),s=Dp(),u=Ss(),c=e.MutationObserver||e.WebKitMutationObserver,l=e.document,f=e.process,v=e.Promise,d=r("queueMicrotask"),h,p,S,R,I;if(!d){var g=new a,b=function(){var y,A;for(u&&(y=f.domain)&&y.exit();A=g.get();)try{A()}catch(q){throw g.head&&h(),q}y&&y.enter()};!i&&!u&&!s&&c&&l?(p=!0,S=l.createTextNode(""),new c(b).observe(S,{characterData:!0}),h=function(){S.data=p=!p}):!o&&v&&v.resolve?(R=v.resolve(void 0),R.constructor=v,I=t(R.then,R),h=function(){I(b)}):u?h=function(){f.nextTick(b)}:(n=t(n,e),h=function(){n(b)}),d=function(y){g.head||h(),g.add(y)}}return co=d,co}var lo,Yl;function Fp(){return Yl||(Yl=1,lo=function(e,r){try{arguments.length===1?console.error(e):console.error(e,r)}catch{}}),lo}var fo,Ql;function ht(){return Ql||(Ql=1,fo=function(e){try{return{error:!1,value:e()}}catch(r){return{error:!0,value:r}}}),fo}var vo,Xl;function pt(){if(Xl)return vo;Xl=1;var e=me();return vo=e.Promise,vo}var ho,Zl;function Mt(){if(Zl)return ho;Zl=1;var e=me(),r=pt(),t=we(),n=uv(),a=vs(),i=ke(),o=Sv(),s=sr(),u=Wd(),c=r&&r.prototype,l=i("species"),f=!1,v=t(e.PromiseRejectionEvent),d=n("Promise",function(){var h=a(r),p=h!==String(r);if(!p&&u===66||s&&!(c.catch&&c.finally))return!0;if(!u||u<51||!/native code/.test(h)){var S=new r(function(g){g(1)}),R=function(g){g(function(){},function(){})},I=S.constructor={};if(I[l]=R,f=S.then(function(){})instanceof R,!f)return!0}return!p&&(o==="BROWSER"||o==="DENO")&&!v});return ho={CONSTRUCTOR:d,REJECTION_EVENT:v,SUBCLASSING:f},ho}var po={},ef;function br(){if(ef)return po;ef=1;var e=tr(),r=TypeError,t=function(n){var a,i;this.promise=new n(function(o,s){if(a!==void 0||i!==void 0)throw new r("Bad Promise constructor");a=o,i=s}),this.resolve=e(a),this.reject=e(i)};return po.f=function(n){return new t(n)},po}var rf;function Bp(){if(rf)return Nl;rf=1;var e=Pe(),r=sr(),t=Ss(),n=me(),a=En(),i=Le(),o=Ye(),s=ps(),u=dt(),c=xp(),l=tr(),f=we(),v=Ke(),d=ys(),h=Iv(),p=Rv().set,S=Mp(),R=Fp(),I=ht(),g=Tv(),b=ft(),y=pt(),A=Mt(),q=br(),j="Promise",G=A.CONSTRUCTOR,K=A.REJECTION_EVENT,re=A.SUBCLASSING,L=b.getterFor(j),M=b.set,N=y&&y.prototype,m=y,C=N,U=n.TypeError,F=n.document,w=n.process,T=q.f,x=T,H=!!(F&&F.createEvent&&n.dispatchEvent),Q="unhandledrejection",J="rejectionhandled",le=0,ne=1,ue=2,ae=1,Re=2,xe,je,$e,Qe,wr=function(B){var X;return v(B)&&f(X=B.then)?X:!1},Sr=function(B,X){var oe=X.value,ce=X.state===ne,fe=ce?B.ok:B.fail,He=B.resolve,Te=B.reject,De=B.domain,Oe,Ge,Kr;try{fe?(ce||(X.rejection===Re&&kr(X),X.rejection=ae),fe===!0?Oe=oe:(De&&De.enter(),Oe=fe(oe),De&&(De.exit(),Kr=!0)),Oe===B.promise?Te(new U("Promise-chain cycle")):(Ge=wr(Oe))?i(Ge,Oe,He,Te):He(Oe)):Te(oe)}catch(bt){De&&!Kr&&De.exit(),Te(bt)}},_r=function(B,X){B.notified||(B.notified=!0,S(function(){for(var oe=B.reactions,ce;ce=oe.get();)Sr(ce,B);B.notified=!1,X&&!B.rejection&&yt(B)}))},Ar=function(B,X,oe){var ce,fe;H?(ce=F.createEvent("Event"),ce.promise=X,ce.reason=oe,ce.initEvent(B,!1,!0),n.dispatchEvent(ce)):ce={promise:X,reason:oe},!K&&(fe=n["on"+B])?fe(ce):B===Q&&R("Unhandled promise rejection",oe)},yt=function(B){i(p,n,function(){var X=B.facade,oe=B.value,ce=zr(B),fe;if(ce&&(fe=I(function(){t?w.emit("unhandledRejection",oe,X):Ar(Q,X,oe)}),B.rejection=t||zr(B)?Re:ae,fe.error))throw fe.value})},zr=function(B){return B.rejection!==ae&&!B.parent},kr=function(B){i(p,n,function(){var X=B.facade;t?w.emit("rejectionHandled",X):Ar(J,X,B.value)})},ye=function(B,X,oe){return function(ce){B(X,ce,oe)}},Xe=function(B,X,oe){B.done||(B.done=!0,oe&&(B=oe),B.value=X,B.state=ue,_r(B,!0))},qr=function(B,X,oe){if(!B.done){B.done=!0,oe&&(B=oe);try{if(B.facade===X)throw new U("Promise can't be resolved itself");var ce=wr(X);ce?S(function(){var fe={done:!1};try{i(ce,X,ye(qr,fe,B),ye(Xe,fe,B))}catch(He){Xe(fe,He,B)}}):(B.value=X,B.state=ne,_r(B,!1))}catch(fe){Xe({done:!1},fe,B)}}};if(G&&(m=function(X){d(this,C),l(X),i(xe,this);var oe=L(this);try{X(ye(qr,oe),ye(Xe,oe))}catch(ce){Xe(oe,ce)}},C=m.prototype,xe=function(X){M(this,{type:j,done:!1,notified:!1,parent:!1,reactions:new g,rejection:!1,state:le,value:null})},xe.prototype=o(C,"then",function(X,oe){var ce=L(this),fe=T(h(this,m));return ce.parent=!0,fe.ok=f(X)?X:!0,fe.fail=f(oe)&&oe,fe.domain=t?w.domain:void 0,ce.state===le?ce.reactions.add(fe):S(function(){Sr(fe,ce)}),fe.promise}),je=function(){var B=new xe,X=L(B);this.promise=B,this.resolve=ye(qr,X),this.reject=ye(Xe,X)},q.f=T=function(B){return B===m||B===$e?new je(B):x(B)},!r&&f(y)&&N!==Object.prototype)){Qe=N.then,re||o(N,"then",function(X,oe){var ce=this;return new m(function(fe,He){i(Qe,ce,fe,He)}).then(X,oe)},{unsafe:!0});try{delete N.constructor}catch{}s&&s(N,C)}return e({global:!0,constructor:!0,wrap:!0,forced:G},{Promise:m}),$e=a.Promise,u(m,j,!1,!0),c(j),Nl}var tf={},mo,nf;function Hp(){if(nf)return mo;nf=1;var e=ke(),r=e("iterator"),t=!1;try{var n=0,a={next:function(){return{done:!!n++}},return:function(){t=!0}};a[r]=function(){return this},Array.from(a,function(){throw 2})}catch{}return mo=function(i,o){try{if(!o&&!t)return!1}catch{return!1}var s=!1;try{var u={};u[r]=function(){return{next:function(){return{done:s=!0}}}},i(u)}catch{}return s},mo}var go,af;function Rn(){if(af)return go;af=1;var e=pt(),r=Hp(),t=Mt().CONSTRUCTOR;return go=t||!r(function(n){e.all(n).then(void 0,function(){})}),go}var of;function Gp(){if(of)return tf;of=1;var e=Pe(),r=Le(),t=tr(),n=br(),a=ht(),i=Dt(),o=Rn();return e({target:"Promise",stat:!0,forced:o},{all:function(u){var c=this,l=n.f(c),f=l.resolve,v=l.reject,d=a(function(){var h=t(c.resolve),p=[],S=0,R=1;i(u,function(I){var g=S++,b=!1;R++,r(h,c,I).then(function(y){b||(b=!0,p[g]=y,--R||f(p))},v)}),--R||f(p)});return d.error&&v(d.value),l.promise}}),tf}var sf={},uf;function Wp(){if(uf)return sf;uf=1;var e=Pe(),r=sr(),t=Mt().CONSTRUCTOR,n=pt(),a=Je(),i=we(),o=Ye(),s=n&&n.prototype;if(e({target:"Promise",proto:!0,forced:t,real:!0},{catch:function(c){return this.then(void 0,c)}}),!r&&i(n)){var u=a("Promise").prototype.catch;s.catch!==u&&o(s,"catch",u,{unsafe:!0})}return sf}var cf={},lf;function Vp(){if(lf)return cf;lf=1;var e=Pe(),r=Le(),t=tr(),n=br(),a=ht(),i=Dt(),o=Rn();return e({target:"Promise",stat:!0,forced:o},{race:function(u){var c=this,l=n.f(c),f=l.reject,v=a(function(){var d=t(c.resolve);i(u,function(h){r(d,c,h).then(l.resolve,f)})});return v.error&&f(v.value),l.promise}}),cf}var ff={},df;function zp(){if(df)return ff;df=1;var e=Pe(),r=br(),t=Mt().CONSTRUCTOR;return e({target:"Promise",stat:!0,forced:t},{reject:function(a){var i=r.f(this),o=i.reject;return o(a),i.promise}}),ff}var vf={},yo,hf;function Ov(){if(hf)return yo;hf=1;var e=rr(),r=Ke(),t=br();return yo=function(n,a){if(e(n),r(a)&&a.constructor===n)return a;var i=t.f(n),o=i.resolve;return o(a),i.promise},yo}var pf;function Kp(){if(pf)return vf;pf=1;var e=Pe(),r=Je(),t=sr(),n=pt(),a=Mt().CONSTRUCTOR,i=Ov(),o=r("Promise"),s=t&&!a;return e({target:"Promise",stat:!0,forced:t||a},{resolve:function(c){return i(s&&this===o?n:this,c)}}),vf}var mf;function Jp(){return mf||(mf=1,Bp(),Gp(),Wp(),Vp(),zp(),Kp()),xl}var gf={},yf;function Yp(){if(yf)return gf;yf=1;var e=Pe(),r=Le(),t=tr(),n=br(),a=ht(),i=Dt(),o=Rn();return e({target:"Promise",stat:!0,forced:o},{allSettled:function(u){var c=this,l=n.f(c),f=l.resolve,v=l.reject,d=a(function(){var h=t(c.resolve),p=[],S=0,R=1;i(u,function(I){var g=S++,b=!1;R++,r(h,c,I).then(function(y){b||(b=!0,p[g]={status:"fulfilled",value:y},--R||f(p))},function(y){b||(b=!0,p[g]={status:"rejected",reason:y},--R||f(p))})}),--R||f(p)});return d.error&&v(d.value),l.promise}}),gf}var bf={},wf;function Qp(){if(wf)return bf;wf=1;var e=Pe(),r=Le(),t=tr(),n=Je(),a=br(),i=ht(),o=Dt(),s=Rn(),u="No one promise resolved";return e({target:"Promise",stat:!0,forced:s},{any:function(l){var f=this,v=n("AggregateError"),d=a.f(f),h=d.resolve,p=d.reject,S=i(function(){var R=t(f.resolve),I=[],g=0,b=1,y=!1;o(l,function(A){var q=g++,j=!1;b++,r(R,f,A).then(function(G){j||y||(y=!0,h(G))},function(G){j||y||(j=!0,I[q]=G,--b||p(new v(I,u)))})}),--b||p(new v(I,u))});return S.error&&p(S.value),d.promise}}),bf}var Sf={},If;function Cv(){if(If)return Sf;If=1;var e=Pe(),r=me(),t=Pv(),n=Pn(),a=br(),i=tr(),o=ht(),s=r.Promise,u=!1,c=!s||!s.try||o(function(){s.try(function(l){u=l===8},8)}).error||!u;return e({target:"Promise",stat:!0,forced:c},{try:function(l){var f=arguments.length>1?n(arguments,1):[],v=a.f(this),d=o(function(){return t(i(l),void 0,f)});return(d.error?v.reject:v.resolve)(d.value),v.promise}}),Sf}var Pf={},Ef;function _v(){if(Ef)return Pf;Ef=1;var e=Pe(),r=br();return e({target:"Promise",stat:!0},{withResolvers:function(){var n=r.f(this);return{promise:n.promise,resolve:n.resolve,reject:n.reject}}}),Pf}var Rf={},Tf;function Xp(){if(Tf)return Rf;Tf=1;var e=Pe(),r=sr(),t=pt(),n=Ae(),a=Je(),i=we(),o=Iv(),s=Ov(),u=Ye(),c=t&&t.prototype,l=!!t&&n(function(){c.finally.call({then:function(){}},function(){})});if(e({target:"Promise",proto:!0,real:!0,forced:l},{finally:function(v){var d=o(this,a("Promise")),h=i(v);return this.then(h?function(p){return s(d,v()).then(function(){return p})}:v,h?function(p){return s(d,v()).then(function(){throw p})}:v)}}),!r&&i(t)){var f=a("Promise").prototype.finally;c.finally!==f&&u(c,"finally",f,{unsafe:!0})}return Rf}var bo,Of;function Zp(){if(Of)return bo;Of=1,$p(),gs(),Lp(),Jp(),Yp(),Qp(),Cv(),_v(),Xp(),mv();var e=En();return bo=e.Promise,bo}var wo,Cf;function em(){if(Cf)return wo;Cf=1;var e=Zp();return wv(),wo=e,wo}var _f={},Af;function rm(){return Af||(Af=1,Cv()),_f}var kf={},qf;function tm(){return qf||(qf=1,_v()),kf}var So,$f;function nm(){if($f)return So;$f=1;var e=em();return rm(),tm(),So=e,So}nm();const Av="sesamy-debug";function am(e,r,t){const n=new Date;n.setTime(n.getTime()+t*60*60*1e3);const a="expires="+n.toUTCString();document.cookie=`${e}=${r}; ${a}; path=/`}function im(e){if(typeof document>"u")return null;const r=e+"=",t=document.cookie.split(";");for(let n=0;n<t.length;n++){let a=t[n];for(;a.charAt(0)===" ";)a=a.substring(1);if(a.indexOf(r)===0)return a.substring(r.length,a.length)}return null}function om(e){am(Av,e.toString(),1)}function sm(){return im(Av)==="true"}function de(e){sm()&&console.log(e)}function Lr(e,r){if(typeof window>"u")return;const t=new CustomEvent(e,{detail:r,bubbles:!0,composed:!0});de(`Triggering event: ${e}`),dispatchEvent(t)}const um=Object.freeze(Object.defineProperty({__proto__:null,triggerEvent:Lr},Symbol.toStringTag,{value:"Module"}));let kv=null;function Do(e){kv=e}function qv(){return kv}var er=(e=>(e.AUTH_INITIALIZED="sesamyJsAuthInitialized",e.READY="sesamyJsReady",e.AUTHENTICATED="sesamyJsAuthenticated",e.LOGOUT="sesamyJsLogout",e.CLEAR_CACHE="sesamyJsClearCache",e.USER_ATTRIBUTE_CHANGED="sesamyUserAttributeChanged",e.PURCHASE="sesamyJsPurchase",e))(er||{});const cm=Object.freeze(Object.defineProperty({__proto__:null,Events:er},Symbol.toStringTag,{value:"Module"})),$v="sesamy_is_authenticated";function lm(){try{return document.cookie.split(";").some(e=>e.trim().startsWith(`${$v}=true`))}catch{return!1}}function Io(e){try{const r=e?2592e3:0,t=window.location.protocol==="https:"?"; Secure":"";document.cookie=`${$v}=${e}; path=/; max-age=${r}; SameSite=Lax${t}`}catch{}}function Uf(e={}){let r=e.baseUrl??"",t="",n=!1,a=null,i=null;async function o(){try{const u=await fetch(`${r}/auth/userinfo`,{credentials:"include",headers:{Accept:"application/json"}});return u.ok?await u.json():null}catch(u){return de(`[cookie-auth] Failed to fetch userinfo: ${u.message}`),null}}const s={async init(u){if(t=u.vendorId||u.clientId||"",de(`[cookie-auth] Initializing with baseUrl: ${r}`),lm()){const c=await o();c===null?de("[cookie-auth] userinfo fetch failed transiently; retaining session hint"):c.authenticated&&c.sub?(a=!0,i=c,Io(!0),Lr(er.AUTHENTICATED,{sub:c.sub,appState:void 0})):(a=!1,Io(!1))}else a=!1;n=!0,Lr(er.AUTH_INITIALIZED,{})},async isAuthenticated(){if(!n)return!1;if(a!==null)return a;const u=await o();return u===null?(de("[cookie-auth] userinfo fetch failed transiently in isAuthenticated; will retry"),!1):(a=u.authenticated,a)},async getTokenSilently(u,c){return null},async getUser(){if(!n)return null;if(i)return i;const u=await o();return u?.authenticated&&u.sub?(i=u,i):null},async login(u){if(!t)throw new Error("[cookie-auth] vendorId is required to build a login URL");const c=u?.returnTo??window.location.href,l=new URL(`${r}/auth/${encodeURIComponent(t)}/login`,window.location.origin);l.searchParams.set("return_to",c),window.location.href=l.toString()},async loginWithRedirect(u){return s.login(u)},async loginWithPopup(u){return de("[cookie-auth] loginWithPopup called — falling back to redirect"),s.login(u)},async logout(u){a=!1,i=null,Io(!1),Lr(er.LOGOUT,{});const c=u?.returnTo??window.location.href,l=new URL(`${r}/auth/logout`,window.location.origin);l.searchParams.set("return_to",c),u?.localOnly&&l.searchParams.set("local_only","true"),window.location.href=l.toString()}};return s}const fm="sesamyAccessToken";let qt=!1;function Cr(){const e=qv();if(!e)throw new Error("[sesamy-js] No auth plugin registered. This should not happen.");return e}async function dm(e){if(e.enabled===!1){de("Auth disabled via config"),qt=!0;return}e.useHttpCookies?(de("useHttpCookies=true — using cookie-based BFF plugin"),Do(Uf())):qv()||(de("No auth plugin registered — defaulting to cookie-based BFF plugin"),Do(Uf())),await Cr().init(e),qt=!0}async function dr(){return qt?Cr().isAuthenticated():!1}async function fr(e=!0,r=!1){return qt?Cr().getTokenSilently(e,r):null}async function vm(){return qt?Cr().getUser():null}async function hm(e){return Cr().login(e)}async function Is(e){return Cr().loginWithRedirect(e)}async function pm(e){return Cr().loginWithPopup(e)}async function mm(e={}){return Cr().logout(e)}async function Mo(e){const r=e.split(".");if(r.length!==3)throw new Error("Invalid token");const t=decodeURIComponent(atob(r[1].replace(/-/g,"+").replace(/_/g,"/")).split("").map(o=>"%"+("00"+o.charCodeAt(0).toString(16)).slice(-2)).join("")),n=JSON.parse(t);if(!n?.exp||n.exp<Date.now()/1e3)throw new Error("Invalid token");de("Set token"),localStorage.setItem(fm,e);const{triggerEvent:a}=await Promise.resolve().then(()=>um),{Events:i}=await Promise.resolve().then(()=>cm);a(i.AUTHENTICATED,{...n,appState:void 0})}const gm=(e,r)=>r.skipDedupe||r.method!=="GET",ym=(e,r)=>r.method+"@"+e,bm=e=>e.clone(),wm=({skip:e=gm,key:r=ym,resolver:t=bm}={})=>{const n=new Map;return a=>(i,o)=>{if(e(i,o))return a(i,o);const s=r(i,o);if(!n.has(s))n.set(s,[]);else return new Promise((u,c)=>{n.get(s).push([u,c])});try{return a(i,o).then(u=>(n.get(s).forEach(([c])=>c(t(u))),n.delete(s),u)).catch(u=>{throw n.get(s).forEach(([,c])=>c(u)),n.delete(s),u})}catch(u){return n.delete(s),Promise.reject(u)}}},Sm=(e,r)=>e*r,Im=e=>e&&e.ok,Pm=({delayTimer:e=500,delayRamp:r=Sm,maxAttempts:t=10,until:n=Im,onRetry:a=null,retryOnNetworkError:i=!1,resolveWithLatestResponse:o=!1,skip:s}={})=>u=>(c,l)=>{let f=0;if(s&&s(c,l))return u(c,l);const v=(d,h)=>Promise.resolve(n(d,h)).then(p=>p?d&&o?d:h?Promise.reject(h):d:(f++,!t||f<=t?new Promise(S=>{const R=r(e,f);setTimeout(()=>{typeof a=="function"?Promise.resolve(a({response:d,error:h,url:c,options:l})).then((I={})=>{var g,b;S(u((g=I&&I.url)!==null&&g!==void 0?g:c,(b=I&&I.options)!==null&&b!==void 0?b:l))}):S(u(c,l))},R)}).then(v).catch(S=>{if(!i)throw S;return v(null,S)}):d&&o?d:Promise.reject(h||new Error("Number of attempts exceeded."))));return u(c,l).then(v).catch(d=>{if(!i)throw d;return v(null,d)})};let Po=class Uv extends Error{status;statusText;url;body;constructor(r,t,n,a,i){super(a),this.name="APIError",this.status=r,this.statusText=t,this.url=n,this.body=i,Error.captureStackTrace&&Error.captureStackTrace(this,Uv)}isClientError(){return this.status>=400&&this.status<500}isServerError(){return this.status>=500}isForbiddenError(){return this.status===403}isNotFoundError(){return this.status===404}};var rn=(e=>(e.BROWSER="browser",e.NORMAL="normal",e))(rn||{});const Em="application/json",Lv="Content-Type",Zr=Symbol(),xv=Symbol();function Lf(e={}){var r;const t=e instanceof Array?Object.fromEntries(e):e;return(r=Object.entries(t).find(([n])=>n.toLowerCase()===Lv.toLowerCase()))===null||r===void 0?void 0:r[1]}function xf(e){return/^application\/.*json.*/.test(e)}const xr=function(e,r,t=!1){return Object.entries(r).reduce((n,[a,i])=>{const o=e[a];return Array.isArray(o)&&Array.isArray(i)?n[a]=t?[...o,...i]:i:typeof o=="object"&&typeof i=="object"?n[a]=xr(o,i,t):n[a]=i,n},{...e})},st={options:{},errorType:"text",polyfills:{},polyfill(e,r=!0,t=!1,...n){const a=this.polyfills[e]||(typeof self<"u"?self[e]:null)||(typeof global<"u"?global[e]:null);if(r&&!a)throw new Error(e+" is not defined");return t&&a?new a(...n):a}};function Rm(e,r=!1){st.options=r?e:xr(st.options,e)}function Tm(e,r=!1){st.polyfills=r?e:xr(st.polyfills,e)}function Om(e){st.errorType=e}const Cm=e=>r=>e.reduceRight((t,n)=>n(t),r)||r;let Nv=class extends Error{};const _m=e=>{const r=Object.create(null);e=e._addons.reduce((g,b)=>b.beforeRequest&&b.beforeRequest(g,e._options,r)||g,e);const{_url:t,_options:n,_config:a,_catchers:i,_resolvers:o,_middlewares:s,_addons:u}=e,c=new Map(i),l=xr(a.options,n);let f=t;const v=Cm(s)((g,b)=>(f=g,a.polyfill("fetch")(g,b)))(t,l),d=new Error,h=v.catch(g=>{throw{[Zr]:g}}).then(g=>{var b;if(!g.ok){const y=new Nv;if(y.cause=d,y.stack=y.stack+`
|
|
2
|
-
CAUSE: `+d.stack,y.response=g,y.status=g.status,y.url=f,g.type==="opaque")throw y;const A=a.errorType==="json"||((b=g.headers.get("Content-Type"))===null||b===void 0?void 0:b.split(";")[0])==="application/json";return(a.errorType?A?g.text():g[a.errorType]():Promise.resolve(g.body)).then(q=>{if(y.message=typeof q=="string"?q:g.statusText,q)if(A&&typeof q=="string"){y.text=q;try{y.json=JSON.parse(q)}catch{}}else y[a.errorType]=q;throw y})}return g}),p=g=>g.catch(b=>{const y=Object.prototype.hasOwnProperty.call(b,Zr),A=y?b[Zr]:b,q=A?.status&&c.get(A.status)||c.get(A?.name)||y&&c.has(Zr)&&c.get(Zr);if(q)return q(A,e);const j=c.get(xv);if(j)return j(A,e);throw A}),S=g=>b=>p(g?h.then(y=>y&&y[g]()).then(y=>b?b(y):y):h.then(y=>b?b(y):y)),R={_wretchReq:e,_fetchReq:v,_sharedState:r,res:S(null),json:S("json"),blob:S("blob"),formData:S("formData"),arrayBuffer:S("arrayBuffer"),text:S("text"),error(g,b){return c.set(g,b),this},badRequest(g){return this.error(400,g)},unauthorized(g){return this.error(401,g)},forbidden(g){return this.error(403,g)},notFound(g){return this.error(404,g)},timeout(g){return this.error(408,g)},internalError(g){return this.error(500,g)},fetchError(g){return this.error(Zr,g)}},I=u.reduce((g,b)=>({...g,...typeof b.resolver=="function"?b.resolver(g):b.resolver}),R);return o.reduce((g,b)=>b(g,e),I)},Am={_url:"",_options:{},_config:st,_catchers:new Map,_resolvers:[],_deferred:[],_middlewares:[],_addons:[],addon(e){return{...this,_addons:[...this._addons,e],...e.wretch}},errorType(e){return{...this,_config:{...this._config,errorType:e}}},polyfills(e,r=!1){return{...this,_config:{...this._config,polyfills:r?e:xr(this._config.polyfills,e)}}},url(e,r=!1){if(r)return{...this,_url:e};const t=this._url.split("?");return{...this,_url:t.length>1?t[0]+e+"?"+t[1]:this._url+e}},options(e,r=!1){return{...this,_options:r?e:xr(this._options,e)}},headers(e){const r=e?Array.isArray(e)?Object.fromEntries(e):"entries"in e?Object.fromEntries(e.entries()):e:{};return{...this,_options:xr(this._options,{headers:r})}},accept(e){return this.headers({Accept:e})},content(e){return this.headers({[Lv]:e})},auth(e){return this.headers({Authorization:e})},catcher(e,r){const t=new Map(this._catchers);return t.set(e,r),{...this,_catchers:t}},catcherFallback(e){return this.catcher(xv,e)},resolve(e,r=!1){return{...this,_resolvers:r?[e]:[...this._resolvers,e]}},defer(e,r=!1){return{...this,_deferred:r?[e]:[...this._deferred,e]}},middlewares(e,r=!1){return{...this,_middlewares:r?e:[...this._middlewares,...e]}},fetch(e=this._options.method,r="",t=null){let n=this.url(r).options({method:e});const a=Lf(n._options.headers),i=this._config.polyfill("FormData",!1),o=typeof t=="object"&&!(i&&t instanceof i)&&(!n._options.headers||!a||xf(a));return n=t?o?n.json(t,a):n.body(t):n,_m(n._deferred.reduce((s,u)=>u(s,s._url,s._options),n))},get(e=""){return this.fetch("GET",e)},delete(e=""){return this.fetch("DELETE",e)},put(e,r=""){return this.fetch("PUT",r,e)},post(e,r=""){return this.fetch("POST",r,e)},patch(e,r=""){return this.fetch("PATCH",r,e)},head(e=""){return this.fetch("HEAD",e)},opts(e=""){return this.fetch("OPTIONS",e)},body(e){return{...this,_options:{...this._options,body:e}}},json(e,r){const t=Lf(this._options.headers);return this.content(r||xf(t)&&t||Em).body(JSON.stringify(e))}};function or(e="",r={}){return{...Am,_url:e,_options:r}}or.default=or;or.options=Rm;or.errorType=Om;or.polyfills=Tm;or.WretchError=Nv;const km=(e,r)=>r.skipDedupe||r.method!=="GET",qm=(e,r)=>r.method+"@"+e,$m=e=>e.clone(),Um=({skip:e=km,key:r=qm,resolver:t=$m}={})=>{const n=new Map;return a=>(i,o)=>{if(e(i,o))return a(i,o);const s=r(i,o);if(!n.has(s))n.set(s,[]);else return new Promise((u,c)=>{n.get(s).push([u,c])});try{return a(i,o).then(u=>(n.get(s).forEach(([c])=>c(t(u))),n.delete(s),u)).catch(u=>{throw n.get(s).forEach(([,c])=>c(u)),n.delete(s),u})}catch(u){return n.delete(s),Promise.reject(u)}}},Lm=(e,r)=>r.skipCache||r.method!=="GET",xm=(e,r)=>r.method+"@"+e,Nm=()=>!1,jm=()=>null,Dm=e=>e.ok,Mm=({throttle:e=1e3,skip:r=Lm,key:t=xm,clear:n=Nm,invalidate:a=jm,condition:i=Dm,flagResponseOnCacheHit:o="__cached"}={})=>{const s=new Map,u=new Map,c=new Set,l=v=>{e&&!c.has(v)&&(c.add(v),setTimeout(()=>{c.delete(v)},e))},f=v=>(d,h)=>{const p=t(d,h);let S=a(d,h);if(S&&(S instanceof Array||(S=[S]),S.forEach(R=>{typeof R=="string"?s.delete(R):R instanceof RegExp&&s.forEach((I,g)=>{R.test(g)&&s.delete(g)})})),n(d,h)&&s.clear(),r(d,h))return v(d,h);if(c.has(p)){if(s.has(p)){const R=s.get(p).clone();return o&&Object.defineProperty(R,o,{value:p,enumerable:!1}),Promise.resolve(R)}else if(u.has(p))return new Promise((R,I)=>{u.get(p).push([R,I])})}return u.has(p)||u.set(p,[]),l(p),v(d,h).then(R=>(i(R.clone())&&s.set(p,R.clone()),u.get(p).forEach(([I])=>I(R.clone())),u.delete(p),R)).catch(R=>{throw u.get(p).forEach(([,I])=>I(R)),u.delete(p),R})};return f.cacheResponse=function(v,d){l(v),s.set(v,d)},f.cache=s,f.inflight=u,f.throttling=c,f},Fm=(e,r)=>e*r,Bm=e=>e&&e.ok,Hm=({delayTimer:e=500,delayRamp:r=Fm,maxAttempts:t=10,until:n=Bm,onRetry:a=null,retryOnNetworkError:i=!1,resolveWithLatestResponse:o=!1,skip:s}={})=>u=>(c,l)=>{let f=0;if(s&&s(c,l))return u(c,l);const v=(d,h)=>Promise.resolve(n(d,h)).then(p=>p?d&&o?d:h?Promise.reject(h):d:(f++,!t||f<=t?new Promise(S=>{const R=r(e,f);setTimeout(()=>{typeof a=="function"?Promise.resolve(a({response:d,error:h,url:c,options:l})).then((I={})=>{var g,b;S(u((g=I&&I.url)!==null&&g!==void 0?g:c,(b=I&&I.options)!==null&&b!==void 0?b:l))}):S(u(c,l))},R)}).then(v).catch(S=>{if(!i)throw S;return v(null,S)}):d&&o?d:Promise.reject(h||new Error("Number of attempts exceeded."))));return u(c,l).then(v).catch(d=>{if(!i)throw d;return v(null,d)})},Gm="@sesamy/sdk",Wm="1.23.0";let Vm=class{cache=new Map;get(r){return this.cache.get(r)||null}set(r,t){this.cache.set(r,t)}remove(r){this.cache.delete(r)}clear(){this.cache.clear()}};const Tt="sesamyCacheTimestamp",zm=e=>{const{libraryName:r=Gm,libraryVersion:t=Wm,cache:n}=e,a=n?.storage||new Vm,i=[s=>async(u,c)=>{if(n?.mode===rn.BROWSER){let l;typeof sessionStorage<"u"?(l=sessionStorage.getItem(Tt),l||(l=Date.now().toString(),sessionStorage.setItem(Tt,l))):(l=a.get(Tt),l||(l=Date.now().toString(),a.set(Tt,l)));const f={...c,headers:{...c.headers,"Cache-Timestamp":l}};return s(u,f)}return s(u,c)},s=>async(u,c)=>{const l=await e.tokenProvider();if(l===null)return s(u,c);const f={...c,headers:{...c.headers,Authorization:l}};return s(u,f)},Um()];n?.mode===rn.NORMAL&&i.push(Mm({throttle:300*1e3,skip:(s,u)=>u.method!=="GET"})),i.push(Hm({delayTimer:1e3,delayRamp:(s,u)=>s*u,maxAttempts:3,until:s=>!!(s&&(s.ok||s.status>=400&&s.status<500)),retryOnNetworkError:!1}));const o=or(e.baseUrl).headers({"Content-Type":"application/json","X-Sesamy-Client":`${r}/${t}`,...e.headers}).middlewares(i);return{async request(s,u={}){try{const c=/^https?:\/\//.test(s);let l=o.url(s,c);u.headers&&(l=l.headers(u.headers));const f=(u.method||"GET").toLowerCase();let v;switch(f){case"get":v=l.get();break;case"post":v=l.post(u.body);break;case"put":v=l.put(u.body);break;case"patch":v=l.patch(u.body);break;case"delete":v=l.delete();break;default:v=l.get()}const d=await v.res();if(d.ok&&["post","patch","put","delete"].includes(f)&&vr(),d.status===204)return null;if(!d.ok){const h=await d.text().catch(()=>"Unknown error");throw new Po(d.status,d.statusText,d.url,`API Error ${d.status}: ${h}`,h)}return await d.json()}catch(c){if(c instanceof Po)throw c;const l=c.status||500,f=c.message||"Unknown error",v=`${e.baseUrl}${s}`;throw new Po(l,f,v,`API Error ${l}: ${c.message||"Unknown error"}`,c.message||"Unknown error")}}}},vr=()=>(typeof sessionStorage<"u"&&sessionStorage.removeItem(Tt),"Cache cleared"),St={get:async(e,r)=>e.request(`/profile/${r}`),update:async(e,r,t)=>e.request(`/profile/${r}`,{method:"PATCH",body:JSON.stringify(t)}),checkSpotifyLink:async e=>e.request("/profile/spotify-link"),unlinkSpotify:async e=>e.request("/profile/unlink-spotify",{method:"POST"}),delete:async e=>{await e.request("/profile",{method:"DELETE"})}},Eo={list:async(e,r)=>{const t=new URLSearchParams;r?.type&&t.append("type",r.type),r?.sku&&t.append("sku",r.sku),r?.purchaseOptionId&&t.append("purchase-option-id",r.purchaseOptionId),r?.waitForEntitlementAfter&&t.append("wait-for-entitlement-after",r.waitForEntitlementAfter);const n=t.toString(),a=n?`/entitlements?${n}`:"/entitlements";return e.request(a)},get:async(e,r)=>e.request(`/entitlements/${r}`),getAccess:async(e,r)=>e.request(`/entitlements/${r}/access`)},Nf={list:async e=>e.request("/subscriptions"),get:async(e,r)=>e.request(`/subscriptions/${r}`)},jf={get:async(e,r)=>e.request(`/products/${r}`),autoOnboard:async(e,r)=>e.request(`/products/${r}/auto-onboard`,{method:"POST"})},Km=(e,r)=>{if(!e||!r)return e;const t=new URL(e);return t.hash=`access_token=${r}`,t.toString()},Df=(e,r)=>!e.manageUrl||!r?e:{...e,manageUrl:Km(e.manageUrl,r)},It={list:async e=>e.request("/contracts"),get:async(e,r)=>e.request(`/contracts/${r}`),cancel:async(e,r)=>e.request(`/contracts/${r}/cancel`,{method:"POST"}),createAmendment:async(e,r,t)=>e.request(`/contracts/${r}/amendments`,{method:"POST",body:JSON.stringify(t)}),confirmAmendment:async(e,r,t)=>e.request(`/contracts/${r}/amendments/${t}/confirm`,{method:"POST"})},Ro={get:async e=>e.request("/user-metadata"),set:async(e,r,t)=>{await e.request(`/user-metadata/${r}`,{method:"PUT",body:t})},delete:async(e,r)=>{await e.request(`/user-metadata/${r}`,{method:"DELETE"})}},et={list:async e=>e.request("/tallies"),get:async(e,r)=>e.request(`/tallies/${r}`),update:async(e,r,t)=>e.request(`/tallies/${r}`,{method:"PUT",body:JSON.stringify(t)}),create:async(e,r)=>e.request("/tallies",{method:"POST",body:JSON.stringify(r)}),delete:async(e,r)=>{try{return await e.request(`/tallies/${r}`,{method:"DELETE"}),!0}catch{return!1}},push:async(e,r,t)=>e.request(`/tallies/${r}/push`,{method:"POST",body:JSON.stringify(t)})},To={list:async e=>e.request("/tags"),add:async(e,r)=>{await e.request("/tags",{method:"POST",body:JSON.stringify({tag:r})})},remove:async(e,r)=>{await e.request(`/tags/${r}`,{method:"DELETE"})}},rt={generateCheckoutLink:(e,r)=>{const t=new URL(`${e.apiUrl}/checkouts`);return r.items&&t.searchParams.set("items",JSON.stringify(r.items)),r.email&&t.searchParams.set("email",r.email),r.language&&t.searchParams.set("lang",r.language),r.redirectUrl&&t.searchParams.set("redirect-url",r.redirectUrl),r.giftMode&&t.searchParams.set("gift-mode","true"),r.payerEmail&&t.searchParams.set("payer-email",r.payerEmail),r.requireAddress&&t.searchParams.set("require-address","true"),r.metadata&&Object.entries(r.metadata).forEach(([n,a])=>{t.searchParams.set(`metadata.${n}`,a)}),t.toString()},generateAccountLink:(e,r)=>{const t=r.language||"en",n=new URL(`${e.baseUrl}/account/${encodeURIComponent(t)}/subscriptions/${encodeURIComponent(e.clientId)}${r.contractId?`/${encodeURIComponent(r.contractId)}`:""}`);return n.searchParams.set("sesamy-redirect-url",r.redirectUrl||"/"),n.toString()},generateChangePaymentLink:(e,r)=>{const t=r.language||"en",n=new URL(`${e.baseUrl}/account/${encodeURIComponent(t)}/subscriptions/${encodeURIComponent(e.clientId)}/${encodeURIComponent(r.contractId)}/change-payment-method`);return n.searchParams.set("sesamy-redirect-url",r.redirectUrl||"/"),n.toString()},generateChangePlanLink:(e,r)=>{const t=r.language||"en",n=new URL(`${e.baseUrl}/account/${encodeURIComponent(t)}/subscriptions/${encodeURIComponent(e.clientId)}/${encodeURIComponent(r.contractId)}/edit-plan`);return n.searchParams.set("sesamy-redirect-url",r.redirectUrl||"/"),n.toString()},generateConsumeLink:(e,r)=>{const t=r.language||"en";let n=new URL(`${e.baseUrl}/consume/${encodeURIComponent(t)}/@${encodeURIComponent(e.clientId)}/${encodeURIComponent(r.sku)}`);return r.episodeId?n.href+=`/${encodeURIComponent(r.episodeId)}`:n.href+="/listen",n.searchParams.set("sesamy-redirect-url",r.redirectUrl||"/"),n.toString()}},Oo={generateLink:(e,r)=>{const t=new URL(`${e.apiUrl}/checkouts`);return r.items&&t.searchParams.set("items",JSON.stringify(r.items)),r.email&&t.searchParams.set("email",r.email),r.language&&t.searchParams.set("lang",r.language),r.redirectUrl&&t.searchParams.set("redirect-url",r.redirectUrl),r.giftMode&&t.searchParams.set("gift-mode","true"),r.payerEmail&&t.searchParams.set("payer-email",r.payerEmail),r.requireAddress&&t.searchParams.set("require-address","true"),r.metadata&&Object.entries(r.metadata).forEach(([n,a])=>{t.searchParams.set(`metadata.${n}`,a)}),t.toString()},create:async(e,r)=>e.request("/checkouts",{method:"POST",body:JSON.stringify(r)}),get:async(e,r)=>e.request(`/checkouts/${r}`),update:async(e,r,t)=>e.request(`/checkouts/${r}`,{method:"PATCH",body:JSON.stringify(t)})},Mf={list:async e=>e.request("/bills"),get:async(e,r)=>e.request(`/bills/${r}`)},Ff={list:async e=>e.request("/fulfillments"),create:async(e,r)=>e.request("/fulfillments",{method:"POST",body:JSON.stringify(r)})},Jm={get:async(e,r)=>{try{return new URL(r),e.request(r)}catch{return e.request(`/paywalls/${r}`)}}},Ym={list:async e=>e.request("/payment-issues")},Qm={content:async(e,r,t,n,a)=>{const i=new URLSearchParams({url:r});return t&&i.append("selector",t),n&&i.append("cache",n),e.request(`/proxy?${i.toString()}`,a)}},Xm={list:async(e,r)=>{const t=(r?new URLSearchParams({q:r}):new URLSearchParams).toString(),n=t?`/transactions?${t}`:"/transactions";return e.request(n)}},Bf={get:async e=>e.request("/vendor"),list:async e=>e.request("/vendors")},Zm=e=>{const r=zm(e);return{profile:{get:t=>St.get(r,t),update:(t,n)=>St.update(r,t,n),checkSpotifyLink:()=>St.checkSpotifyLink(r),unlinkSpotify:()=>St.unlinkSpotify(r),delete:()=>St.delete(r)},entitlements:{list:t=>Eo.list(r,t),get:t=>Eo.get(r,t),getAccess:t=>Eo.getAccess(r,t)},subscriptions:{list:()=>Nf.list(r),get:t=>Nf.get(r,t)},products:{get:t=>jf.get(r,t),autoOnboard:t=>jf.autoOnboard(r,t)},contracts:{list:async()=>{const t=await It.list(r),n=await e.tokenProvider();if(!n.toLowerCase().startsWith("bearer "))return t;const a=n.substring(7);return t.map(i=>Df(i,a))},get:async t=>{const n=await It.get(r,t),a=await e.tokenProvider();if(!a.toLowerCase().startsWith("bearer "))return n;const i=a.substring(7);return Df(n,i)},cancel:t=>It.cancel(r,t),createAmendment:(t,n)=>It.createAmendment(r,t,n),confirmAmendment:(t,n)=>It.confirmAmendment(r,t,n)},userMetadata:{get:()=>Ro.get(r),set:(t,n)=>Ro.set(r,t,n),delete:t=>Ro.delete(r,t)},tallies:{list:()=>et.list(r),get:t=>et.get(r,t),update:(t,n)=>et.update(r,t,n),create:t=>et.create(r,t),delete:t=>et.delete(r,t),push:(t,n)=>et.push(r,t,n)},tags:{list:()=>To.list(r),add:t=>To.add(r,t),remove:t=>To.remove(r,t)},checkouts:{generateLink:(t,n)=>rt.generateCheckoutLink(t,n),create:t=>Oo.create(r,t),get:t=>Oo.get(r,t),update:(t,n)=>Oo.update(r,t,n)},links:{generateCheckoutLink:(t,n)=>rt.generateCheckoutLink(t,n),generateAccountLink:(t,n)=>rt.generateAccountLink(t,n),generateChangePaymentLink:(t,n)=>rt.generateChangePaymentLink(t,n),generateChangePlanLink:(t,n)=>rt.generateChangePlanLink(t,n),generateConsumeLink:(t,n)=>rt.generateConsumeLink(t,n)},bills:{list:()=>Mf.list(r),get:t=>Mf.get(r,t)},fulfillments:{list:()=>Ff.list(r),create:t=>Ff.create(r,t)},paywalls:{get:t=>Jm.get(r,t)},paymentIssues:{list:()=>Ym.list(r)},proxy:{content:(t,n,a,i)=>Qm.content(r,t,n,a,i)},transactions:{list:t=>Xm.list(r,t)},vendor:{get:()=>Bf.get(r),list:()=>Bf.list(r)}}},eg="sesamy.com",rg="sesamy.dev",tg="https://sesa.my",Hf="sesamyCacheTimestamp",Gf="sesamyContentReloaded";class ng{get(r){return typeof sessionStorage>"u"?null:sessionStorage.getItem(r)}set(r,t){typeof sessionStorage<"u"&&sessionStorage.setItem(r,t)}remove(r){typeof sessionStorage<"u"&&sessionStorage.removeItem(r)}clear(){}}function ag(e,r){return`${e}.${r==="dev"?rg:eg}`}function ir(e,r){return`https://${ag(e,r)}`}function Qt(){let r=(document.documentElement.getAttribute("lang")??navigator.language??"en").split("-")[0]?.toLowerCase()??"en";return r==="nn"&&(r="nb"),r}function Fo(e){let r;try{r=new URL(e)}catch{return!1}return r.protocol==="http:"||r.protocol==="https:"}function jv(e,r){if(Fo(e))return{itemSrc:e};const t=e.split(":");if(t.length<2)throw new Error(`Invalid itemSrc format: expected at least 2 segments separated by ':', got ${t.length}`);const[n,a,i]=t;if(!a)throw new Error("Invalid itemSrc format: sku segment is empty");return{sku:`${n}:${a}`,purchaseOption:r||i}}function Wf(e){return e.endsWith("/")?e.slice(0,-1):e}function Vf(e,r){if(!Fo(e)||!Fo(r))return!1;const t=new URL(e),n=new URL(r);return t.origin===n.origin&&Wf(t.pathname)===Wf(n.pathname)}function ig(e,r,t){const n=new URL(`${ir("checkout3",e.environment)}`);r.language&&n.searchParams.set("lang",r.language);let a=r.sku,i=r.purchaseOptionId,o=r.itemSrc;if(r.itemSrc){const l=jv(r.itemSrc,r.purchaseOptionId);a=l.sku||a,i=l.purchaseOption||i,o=l.itemSrc}a?(n.searchParams.set("sku",a),i&&n.searchParams.set("po-id",i)):o&&n.searchParams.set("url",o),r.email&&n.searchParams.set("email",r.email),r.business&&n.searchParams.set("business","true"),r.currency&&n.searchParams.set("currency",r.currency),r.price&&n.searchParams.set("price",r.price.toString()),r.discountCode&&n.searchParams.set("discount-code",r.discountCode),r.attributionItemSrc?n.searchParams.set("itemSrc",r.attributionItemSrc):t.itemSrc&&n.searchParams.set("itemSrc",t.itemSrc),r.attributionPublisherContentId?n.searchParams.set("publisherContentId",r.attributionPublisherContentId):t.publisherContentId&&n.searchParams.set("publisherContentId",t.publisherContentId),r.utmSource?n.searchParams.set("utm_source",r.utmSource):t.utmSource&&n.searchParams.set("utm_source",t.utmSource),r.utmMedium?n.searchParams.set("utm_medium",r.utmMedium):t.utmMedium&&n.searchParams.set("utm_medium",t.utmMedium),r.utmCampaign?n.searchParams.set("utm_campaign",r.utmCampaign):t.utmCampaign&&n.searchParams.set("utm_campaign",t.utmCampaign),r.utmTerm?n.searchParams.set("utm_term",r.utmTerm):t.utmTerm&&n.searchParams.set("utm_term",t.utmTerm),r.utmContent?n.searchParams.set("utm_content",r.utmContent):t.utmContent&&n.searchParams.set("utm_content",t.utmContent);const s=["_ga","_gid","_fbp","_fbc"];document.cookie.split(";").map(l=>{const[f,v]=l.trim().split("=");return{key:f,value:v}}).filter(l=>s.some(f=>f===l.key)).forEach(l=>{n.searchParams.append(l.key,l.value)});let c=new URL(window.location.href);if(r.redirectUrl)try{c=new URL(r.redirectUrl)}catch{console.warn("Invalid redirect URL provided, using current URL instead:",r.redirectUrl)}return c.searchParams.set("force-refetch-entitlements","true"),r.itemSrc&&c.searchParams.set("sesamy-purchase",r.itemSrc),n.searchParams.set("redirect-url",c.toString()),r.paymentMethodsFilter&&n.searchParams.set("paymentmethods-filter",r.paymentMethodsFilter.flatMap(({provider:l,methods:f})=>f?f.map(v=>`${l}|${v}`):l).join(",")),r.requireAddress&&n.searchParams.set("require-address","true"),r.giftMode&&n.searchParams.set("gift-mode","true"),r.payerEmail&&n.searchParams.set("payer-email",r.payerEmail),r.metadata&&Object.entries(r.metadata).forEach(([l,f])=>{n.searchParams.set(`metadata.${l}`,String(f))}),n}const Dv="sesamySignedURLs";function Ps(){const e=sessionStorage.getItem(Dv);return e?JSON.parse(e):[]}function zf(e){const r=Ps();r.push(e),de(`Adding signed URL: ${e}`),sessionStorage.setItem(Dv,JSON.stringify(r))}function og(e){const r={};return Object.keys(e).forEach(t=>{const n=e[t];n!=null&&(r[t]=n.toString())}),r}const Bo="sesamyAttribution";function sg(e){const r=localStorage.getItem(e);if(!r)return null;try{return JSON.parse(r).value}catch{return console.error(`Failed to parse ${e}`),null}}function ug(e){return Object.keys(e).find(r=>r.startsWith("utm_"))?{utmSource:void 0,utmMedium:void 0,utmCampaign:void 0,...e}:e}function tn(){return sg(Bo)||{}}function Mv(e){if(e===null)localStorage.removeItem(Bo);else{de(`Setting attribution ${JSON.stringify(e)}`);const r=tn()??{},t=og({...r,...ug(e)});localStorage.setItem(Bo,JSON.stringify({value:t}))}}const Es="@sesamy/sesamy-js",Ft="1.92.0",Fv="sesamyFlags";async function Bv(e){try{localStorage.setItem(Fv,JSON.stringify(e))}catch{de("Failed to save flags to localStorage")}}async function Hv(e,r){const t=await Bt();t[e]=r,await Bv(t)}async function Gv(e){return(await Bt())[e]}async function Wv(e){const r=await Bt();e in r&&(delete r[e],await Bv(r))}async function Bt(){try{const e=localStorage.getItem(Fv);return e?JSON.parse(e):{}}catch{return{}}}function Vv(e){function r(n){return n.id?`#${n.id}`:n.classList.length>0?Array.from(n.classList).map(i=>`.${i}`).join(""):null}function t(n){const a=[];let i=n;for(;i&&i!==document.body&&i!==document.documentElement;){const o=r(i);if(o){a.unshift(o);break}if(i.parentElement){const s=Array.from(i.parentElement.children),u=s.indexOf(i)+1,c=i.tagName.toLowerCase();s.filter(f=>f.tagName.toLowerCase()===c).length>1?a.unshift(`${c}:nth-child(${u})`):a.unshift(c)}i=i.parentElement}return a.join(" > ")}return t(e)}function zv(e){return e?Object.fromEntries(Object.entries(e).filter(([r,t])=>t!==void 0)):{}}function cg(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}let Me={article:{selector:"sesamy-article"},image:{selector:"img",attribute:"src"},title:{selector:"h1",attribute:"textContent"},excerpt:{selector:"p",attribute:"textContent"},price:{selector:"sesamy-article",attribute:"price"},currency:{selector:"sesamy-article",attribute:"currency"},url:{selector:"sesamy-article",attribute:"item-src"},accessLevel:{selector:"sesamy-article",attribute:"access-level"},id:{selector:"sesamy-article",attribute:"publisher-content-id"},pass:{selector:"sesamy-article",attribute:"pass"},paywallUrl:{selector:"sesamy-article",attribute:"paywall-url"}},Kv=[],Jv=!1,Rr;function Rs(){const e=window.location.pathname,r=new URLSearchParams(window.location.search),t=navigator.userAgent;return Kv.find(n=>{if(n.path&&!e.includes(n.path)||n.queryParam&&r.get(n.queryParam.key)!==n.queryParam.value)return!1;if(n.headers){const a=n.headers.name.toLowerCase(),i=n.headers.contains.toLowerCase();if(a==="user-agent"){if(!t.toLowerCase().includes(i))return!1}else return!1}return!(n.userAgentContains&&!t.includes(n.userAgentContains))})}function lg(){return Rs()}function fg(e,r){Kv=e.content||[];const t=Rs();t&&t.type==="article"&&(Me={...Me,...zv(t.selectors)},Jv=t.enablePaywallSettingsUrlFallback||!1),Rr=r}function dg(e,r){const{selector:t,attribute:n}=r;return t===Me.article.selector||n&&e.hasAttribute(n)?e:e.querySelector(t)}function Yv(e,r,t=!1){if(e){if(r.attribute){if(r.attribute==="textContent")return e.textContent??void 0;const n=e.getAttribute(r.attribute),a=Yv(e.parentElement,r,t);if(t){const i=[];return n&&i.push(...n.split(",").map(o=>o.trim()).filter(Boolean)),a&&i.push(...a.split(",").map(o=>o.trim()).filter(Boolean)),i.length>0?[...new Set(i)].join(","):void 0}return n??a}return e.textContent??void 0}}function ge(e){const r=document.head.querySelectorAll(`[property~='${e}'][content]`);for(let n=0;n<r.length;n+=1)if(r[n].content)return r[n].content;const t=document.head.querySelectorAll(`[name~='${e}'][content]`);for(let n=0;n<t.length;n+=1)if(t[n].content)return t[n].content}function Ot(e){const r=[];return document.head.querySelectorAll(`[property~='${e}'][content]`).forEach(a=>{a.content&&r.push(a.content)}),document.head.querySelectorAll(`[name~='${e}'][content]`).forEach(a=>{a.content&&r.push(a.content)}),r}let Ct=null;function Qv(){const e=[],r=document.querySelectorAll('script[type="application/ld+json"]');for(const t of r)try{const n=JSON.parse(t.textContent||"");Array.isArray(n)?e.push(...n):n["@graph"]&&Array.isArray(n["@graph"])?e.push(...n["@graph"]):e.push(n)}catch{}return e}function _t(e){const r=Qv(),t=n=>!e||n["@type"]===e||Array.isArray(n["@type"])&&n["@type"].includes(e);return r.find(t)||null}function vg(e){const r=Qv(),t=n=>!e||n["@type"]===e||Array.isArray(n["@type"])&&n["@type"].includes(e);return r.filter(t)}function Ho(e,r,t){if(!e||typeof e!="object")return typeof e=="string"?e:void 0;const a=e[r];if(typeof a=="string")return a;if(a&&typeof a=="object"&&t)return a[t]}function hg(e){if(!e)return;const t=(Array.isArray(e)?e:[e]).map(n=>{if(typeof n=="string")return{name:n};if(typeof n=="object"&&n!==null){const a=n,i=a.name;return i?{name:i,url:a.url,image:Ho(a,"image","url"),jobTitle:a.jobTitle,sameAs:a.sameAs}:null}return null}).filter(n=>n!==null&&!!n.name);return t.length>0?t:void 0}function Co(e){if(Array.isArray(e))return e.filter(r=>typeof r=="string");if(typeof e=="string"){const r=e.split(",").map(t=>t.trim()).filter(Boolean);return r.length>0?r:void 0}}function Xv(){if(Ct)return Ct;const e=_t("NewsArticle")||_t("Article")||_t("BlogPosting")||_t("WebPage"),r=(...a)=>a.find(i=>i!=null&&i!=="")||void 0,t=(...a)=>a.find(i=>i&&i.length>0),n={contentType:e?Array.isArray(e["@type"])?e["@type"][0]:e["@type"]:void 0,authors:hg(e?.author)||(Ot("article:author").length>0?Ot("article:author").map(a=>({name:a})):void 0)||(ge("author")?[{name:ge("author")}]:void 0),keywords:t(Co(e?.keywords),Co(ge("keywords"))),tags:Ot("article:tag").length>0?Ot("article:tag"):void 0,categories:Co(ge("news_keywords")),section:r(e?.articleSection,ge("article:section")),publishedAt:r(e?.datePublished,ge("article:published_time")),modifiedAt:r(e?.dateModified,ge("article:modified_time")),ogType:ge("og:type"),ogSiteName:ge("og:site_name"),ogLocale:ge("og:locale"),twitterCard:ge("twitter:card"),twitterSite:ge("twitter:site"),twitterCreator:ge("twitter:creator"),creator:r(ge("creator"),ge("dc.creator")),mainEntityOfPage:e?Ho(e.mainEntityOfPage,"@id")||(typeof e.mainEntityOfPage=="string"?e.mainEntityOfPage:void 0):void 0,isAccessibleForFree:typeof e?.isAccessibleForFree=="boolean"?e.isAccessibleForFree:void 0,wordCount:typeof e?.wordCount=="number"?e.wordCount:void 0,publisher:e?.publisher&&typeof e.publisher=="object"?{name:e.publisher.name||"",url:e.publisher.url,logo:Ho(e.publisher,"logo","url")}:void 0};return Ct=zv(n),Ct}function pg(){Ct=null}function Ts({publisherContentId:e,key:r,defaultValue:t=""}){const n=e?document.body.querySelector(`sesamy-content-data[id='${e}']`):null,a=r.replace(/-([a-z])/g,(i,o)=>o.toUpperCase());return n?.getAttribute(r)||ge(`sesamy:${r}`)||ge(`sesamy:${a}`)||ge(`og:${r}`)||ge(r)||t}function Zv(){const e=document.querySelectorAll(Me.article.selector);return Array.from(e).map(Ht).filter(r=>r!==null)}function Ht(e){const r=typeof e=="string"?document.querySelector(e):e;if(!r)return null;const t={element:r,selector:typeof e=="string"?e:Vv(r)},n=(i,o,s,u)=>{const{transform:c,collect:l=!1}=u||{},f=dg(r,o),v=Yv(f,o,l),d=Ts({publisherContentId:s,key:cg(String(i))}),h=v||d||void 0;h&&(t[i]=c?c(h):h)};n("id",Me.id),n("title",Me.title,t.id),n("excerpt",Me.excerpt,t.id),n("image",Me.image,t.id),n("price",Me.price,t.id,{transform:i=>{const o=parseFloat(i);return Number.isNaN(o)?void 0:o}}),n("currency",Me.currency,t.id),n("url",Me.url,t.id),n("pass",Me.pass,t.id,{collect:!0}),n("paywallUrl",Me.paywallUrl,t.id),n("accessLevel",Me.accessLevel,t.id,{transform:i=>i||"entitlement"});const a=Rs();if(a&&a.type==="article"&&(a.pass&&(t.pass=t.pass?`${t.pass},${a.pass}`:a.pass),a.price&&!t.price&&(t.price=a.price.amount),a.price?.currency&&!t.currency&&(t.currency=a.price.currency),a.paywallUrl&&!t.paywallUrl&&(t.paywallUrl=a.paywallUrl)),Jv&&!t.paywallUrl){const i=document.querySelector("sesamy-paywall");if(i){const o=i.getAttribute("settings-url");o&&(t.paywallUrl=o)}}return t.url||(t.url=window.location.href),t.metadata=Xv(),t}async function mg(e){const r=Ht(e);if(!r)throw new Error("Could not find article element");if(r.accessLevel==="public")return!0;if(r.accessLevel==="logged-in"&&!r.paywallUrl)return await Rr.auth.isAuthenticated()?!0:null;if(r.paywallUrl&&((await Rr.paywalls.get(r.paywallUrl)).settings.template==="LOGIN"?"logged-in":"entitlement")==="logged-in")return await Rr.auth.isAuthenticated()?!0:null;if(!r.url)throw new Error("Article must have a URL");return await Rr.entitlements.hasAccess(r.url,r.pass?.split(",")||[])||null}async function eh(e,r){const t=typeof e=="string"?document.querySelector(e):e;if(!t)throw new Error("Could not find element");const n=Ht(t);if(!n?.url)throw new Error("Could not find content for element");const a=await Rr.entitlements.hasAccess(n.url,n.pass?.split(",")||[]);if(!a)throw new Error("User does not have access to the content");const i=await Rr.entitlements.access(a.id);if(!i.token)throw new Error("Could not get access token");const o=r||Vv(t.parentElement||t);return Rr.proxy.getContent(i.token,n.url,o)}function rh(e,r={}){const{closeOnBackdropClick:t=!0,closeOnEscape:n=!0,zIndex:a=2147483647,backdropBlur:i="5px",overlayBackground:o="rgba(0,0,0,0.5)"}=r,s=document.createElement("div");s.setAttribute("data-sesamy-modal","true"),Object.assign(s.style,{position:"fixed",top:"0",left:"0",width:"100vw",height:"100vh",background:o,zIndex:String(a),display:"flex",alignItems:"center",justifyContent:"center",backdropFilter:`blur(${i})`});const u=document.createElement("div");u.setAttribute("data-sesamy-modal-content","true"),typeof e=="string"?u.innerHTML=e:u.appendChild(e),s.appendChild(u);const c=()=>{s.remove(),n&&document.removeEventListener("keydown",l)},l=f=>{f.key==="Escape"&&c()};return t&&s.addEventListener("click",f=>{f.target===s&&c()}),n&&document.addEventListener("keydown",l),document.body.appendChild(s),{element:s,close:c}}function gg(e,r={}){const{position:t="top",fixed:n=!0,zIndex:a=2147483647,autoDismissMs:i,pushContent:o=!1,height:s,transitionDuration:u="0.3s"}=r,c=document.createElement("div");c.setAttribute("data-sesamy-notification-bar","true"),c.setAttribute("data-sesamy-notification-position",t),Object.assign(c.style,{position:n?"fixed":"absolute",[t]:"0",left:"0",width:"100%",zIndex:String(a),boxSizing:"border-box",...s&&{height:s}}),typeof e=="string"?c.innerHTML=e:c.appendChild(e);let l,f,v;const d=()=>{if(v&&clearTimeout(v),o&&s){const h=document.documentElement;h.style.transform=l||"",setTimeout(()=>{c.remove(),h.style.transition=f||""},parseFloat(u)*1e3)}else c.remove()};if(i&&(v=setTimeout(d,i)),o&&s){const h=document.documentElement;l=h.style.transform,f=h.style.transition,h.style.transition=`transform ${u} ease`,c.style.transition=`transform ${u} ease`,t==="top"?(h.style.transform=`translateY(${s})`,c.style.transform=`translateY(-${s})`):(h.style.transform=`translateY(-${s})`,c.style.transform=`translateY(${s})`),document.documentElement.prepend(c)}else document.body.appendChild(c);return{element:c,close:d}}function yg(e){const r=e.endpoint??ir("api2",e.environment),n=Zm({baseUrl:r,tokenProvider:async()=>{if(await dr())try{const U=await fr(!1);return U?`Bearer ${U}`:null}catch{}const m=localStorage.getItem("__anon_id");return`Basic ${btoa(`${e.vendorId||e.clientId}|${m}:`)}`},libraryName:Es,libraryVersion:Ft,vendorId:e.vendorId,cache:{mode:rn.BROWSER,storage:new ng}}),a=m=>async(C,U)=>{let F=sessionStorage.getItem(Hf);F||(F=Date.now().toString(),sessionStorage.setItem(Hf,F));const w={...U,headers:{...U.headers,"Cache-Timestamp":F}};return m(C,w)},i=(m=!0)=>C=>async(U,F)=>{const w=await fr(m);if(!w){if(await dr()){const x={...F,credentials:"include"};return C(U,x)}if(m)throw new Error("No access token available");return C(U,F)}const T={...F,headers:{...F.headers,Authorization:`Bearer ${w}`}};return C(U,T)},o=or(r).headers({"Content-Type":"application/json"}).middlewares([a,i(),wm(),Pm({delayTimer:1e3,delayRamp:(m,C)=>m*C,maxAttempts:3,until:m=>!!(m&&(m.ok||m.status>=400&&m.status<500)),retryOnNetworkError:!1})]);async function s(m={}){const{waitForEntitlementAfter:C,includeSignedLinks:U=!0}=m,F=await dr()?await n.entitlements.list({waitForEntitlementAfter:C?.toISOString()}):[];return U&&F.push(...Ps()),F}async function u(m,C=[]){return(await s())?.find(w=>{if(m){const{sku:T,purchaseOption:x}=jv(m);if("sku"in w&&T===w.sku||x&&"purchaseOptionsId"in w&&x===w.purchaseOptionsId||Vf(m,w.url))return!0}return!!C.some(T=>Vf(T,w.url))})}async function c(m,C,U){const F=new URL(r,window.location.origin);return F.pathname=F.pathname.replace(/\/$/,"")+"/proxy",F.searchParams.set("url",C),U&&F.searchParams.set("selector",U),or(F.toString()).headers({Authorization:`Bearer ${m}`}).get().text()}async function l(m){if(!m)throw new Error("SKU is required to get fulfillments");return await dr()?await o.get(`/fulfillments?sku=${encodeURIComponent(m)}`).json():[]}async function f(m,C){if(!m||!C)throw new Error("SKU and itemId are required to request delivery");return(await o.post({sku:m},`/fulfillments/${encodeURIComponent(C)}/request-delivery?`).res()).ok}async function v(){return console.warn("getSubscriptions is deprecated, use getContracts instead"),o.get("/subscriptions").json()}async function d(m){return(await n.transactions.list())?.find(U=>U.id===m)}async function h(){return await o.url("/tags").get().json()}async function p(m){const C=await o.url(`/tags/${encodeURIComponent(m)}`).delete().res();return vr(),C.ok}async function S(m){const C=await o.url("/tags").post(encodeURIComponent(m)).res();return Lr(er.USER_ATTRIBUTE_CHANGED,{}),vr(),C.ok}async function R(m){return(await n.tallies.get(m)).value}async function I(){const m=await n.tallies.list(),C={};for(const U of m)C[U.id]=U.value;return C}async function g(m){return await n.tallies.delete(m)}async function b(m,C){return await n.tallies.push(m,C)}async function y(){return await fr(!1)?await o.url("/profile").get().json():null}async function A(m){const C=await o.url("/profile").patch(m).res();return vr(),C.ok}async function q(){return(await o.url("/profile/spotify-link").get().json()).isSpotifyLinked}async function j(){return(await o.url("/profile/unlink-spotify").post().res()).ok}async function G(m){const C=await fr(!1);if(!C)throw new Error("No access token available");const U=new URL(`${ir("access-sync",e.environment)}/spotify/sesamy-callback`);U.searchParams.set("access_token",C),U.searchParams.set("state",m),window.location.href=U.toString()}async function K(m){const C=await o.url(`/products/${encodeURIComponent(m)}/auto-onboard`).post().json();return C.length&&vr(),C}async function re(m,C=3600){const{shortlink:U}=await or(tg).post({url:m,ttl:C}).json();return U}async function L(m){const C=await fr(!1,!0);let U;const F=m.language||Qt(),w=tn();switch(m.target){case"account":U=new URL(`${ir("account",e.environment)}/${encodeURIComponent(m.language||F)}/subscriptions/${encodeURIComponent(e.vendorId||e.clientId)}${m.contractId?`/${encodeURIComponent(m.contractId)}`:""}`),U.searchParams.set("sesamy-redirect-url",m.redirectUrl||window.location.href);break;case"change-payment":U=new URL(`${ir("account",e.environment)}/${encodeURIComponent(m.language||F)}/subscriptions/${encodeURIComponent(e.vendorId||e.clientId)}/${encodeURIComponent(m.contractId)}/change-payment-method`),U.searchParams.set("sesamy-redirect-url",m.redirectUrl||window.location.href);break;case"change-plan":U=new URL(`${ir("account",e.environment)}/${encodeURIComponent(m.language||F)}/subscriptions/${encodeURIComponent(e.vendorId||e.clientId)}/${encodeURIComponent(m.contractId)}/edit-plan`),U.searchParams.set("sesamy-redirect-url",m.redirectUrl||window.location.href);break;case"consume":U=new URL(`${ir("consume",e.environment)}/${encodeURIComponent(m.language||F)}/@${encodeURIComponent(e.vendorId||e.clientId)}/${encodeURIComponent(m.sku)}`),m.episodeId?U.href+=`/${m.episodeId}`:U.href+="/listen",U.searchParams.set("sesamy-redirect-url",m.redirectUrl||window.location.href);break;case"checkout":U=ig(e,{language:F,...m},w);break;default:throw new Error("Invalid target")}return C&&(U.hash=`#access_token=${C}`),m.shorten?re(U.href,m.ttl):U.href}async function M(){const m=await fr(!1),C=new URL(`${ir("account",e.environment)}/subscriptions/${e.vendorId||e.clientId}`);m&&(C.hash=`#access_token=${m}`),window.location.href=C.toString()}async function N(m){const C=tn(),U=["_ga","_gid","_fbp","_fbc"];return document.cookie.split(";").forEach(F=>{const[w,T]=F.trim().split("=");U.includes(w)&&!C[w]&&(C[w]=T)}),n.checkouts.create({language:Qt(),...m,attribution:{...C,...m.attribution}})}return{autoOnboardProduct:K,bills:n.bills,checkouts:{create:N,get:n.checkouts.get,update:n.checkouts.update},content:{list:Zv,get:Ht,getLanguage:Qt,unlock:eh,getPropertyFromHTML:Ts},contracts:n.contracts,deleteTag:p,deleteTally:g,entitlements:n.entitlements,flags:{get:Gv,set:Hv,list:Bt,delete:Wv},generateLink:L,getProxyContent:c,getEntitlements:s,getFulfillments:l,requestDelivery:f,hasAccess:u,isSpotifyLinked:q,linkSpotify:G,openHostedAccountPage:M,paywalls:n.paywalls,paymentIssues:n.paymentIssues,getProfile:y,products:n.products,getSubscriptions:v,getTally:R,getTallies:I,getTags:h,getTransaction:d,transactions:n.transactions,userMetadata:n.userMetadata,pushTally:b,setTag:S,unlinkSpotify:j,updateProfile:A,vendor:n.vendor}}function Kf(e,r,t,n,a){for(r=r.split?r.split("."):r,n=0;n<r.length;n++)e=e?e[r[n]]:a;return e===a?t:e}var bg="function",wg="string",Ze="undefined",Sg="boolean",nn="object",Ig="array",Pg="number",Eg="symbol",Rg="null",Go=function(){},th="any",nh="*",Fr="__",Tg="form",Og="input",Cg="button",_g="select",an=typeof process!==Ze?process:{};an.env&&an.env.NODE_ENV;var _e=typeof document!==Ze;an.versions!=null&&an.versions.node!=null;typeof Deno!==Ze&&Deno.core;_e&&window.name==="nodejs"||typeof navigator!==Ze&&typeof navigator.userAgent!==Ze&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));function ah(e,r){return r.charAt(0)[e]()+r.slice(1)}var Ag=ah.bind(null,"toUpperCase"),kg=ah.bind(null,"toLowerCase");function qg(e){return ih(e)?Ag(Rg):typeof e===nn?xg(e):Object.prototype.toString.call(e).slice(8,-1)}function on(e,r){r===void 0&&(r=!0);var t=qg(e);return r?kg(t):t}function Gt(e,r){return typeof r===e}var Be=Gt.bind(null,bg),Tr=Gt.bind(null,wg),tt=Gt.bind(null,Ze),$g=Gt.bind(null,Sg);Gt.bind(null,Eg);function ih(e){return e===null}function Ug(e){return on(e)===Pg&&!isNaN(e)}function oh(e){return on(e)===Ig}function Fe(e){if(!Lg(e))return!1;for(var r=e;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r}function Lg(e){return e&&(typeof e===nn||e!==null)}function xg(e){return Be(e.constructor)?e.constructor.name:null}function Ng(e){return e instanceof Error||Tr(e.message)&&e.constructor&&Ug(e.constructor.stackTraceLimit)}function sh(e,r){if(typeof r!="object"||ih(r))return!1;if(r instanceof e)return!0;var t=on(new e(""));if(Ng(r))for(;r;){if(on(r)===t)return!0;r=Object.getPrototypeOf(r)}return!1}sh.bind(null,TypeError);sh.bind(null,SyntaxError);function Tn(e,r){var t=e instanceof Element||e instanceof HTMLDocument;return t&&r?jg(e,r):t}function jg(e,r){return r===void 0&&(r=""),e&&e.nodeName===r.toUpperCase()}function On(e){var r=[].slice.call(arguments,1);return function(){return e.apply(void 0,[].slice.call(arguments).concat(r))}}On(Tn,Tg);On(Tn,Cg);On(Tn,Og);On(Tn,_g);function Dg(e){return e?oh(e)?e:[e]:[]}function Jf(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function Mg(){if(_e){var e=navigator,r=e.languages;return e.userLanguage||(r&&r.length?r[0]:e.language)}}function Fg(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function Bg(e){return(function(r){for(var t,n=Object.create(null),a=/([^&=]+)=?([^&]*)/g;t=a.exec(r);){var i=Jf(t[1]),o=Jf(t[2]);if(i)if(i.substring(i.length-2)==="[]"){var s=n[i=i.substring(0,i.length-2)]||(n[i]=[]);n[i]=Array.isArray(s)?s:[],n[i].push(o)}else n[i]=o===""||o}for(var u in n){var c=u.split("[");c.length>1&&(Hg(n,c.map(function(l){return l.replace(/[?[\]\\ ]/g,"")}),n[u]),delete n[u])}return n})((function(r){return _e&&window.location.search.substring(1)})())}function Hg(e,r,t){for(var n=r.length-1,a=0;a<n;++a){var i=r[a];if(i==="__proto__"||i==="constructor")break;i in e||(e[i]={}),e=e[i]}e[r[n]]=t}function Cn(){for(var e="",r=0,t=4294967295*Math.random()|0;r++<36;){var n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[r-1],a=15&t;e+=n=="-"||n=="4"?n:(n=="x"?a:3&a|8).toString(16),t=r%8==0?4294967295*Math.random()|0:t>>4}return e}function Gg(e,r){var t,n,a,i=null,o=0,s=function(){o=new Date,i=null,a=e.apply(t,n)};return function(){var u=new Date;o||(o=u);var c=r-(u-o);return t=this,n=arguments,c<=0?(clearTimeout(i),i=null,o=u,a=e.apply(t,n)):i||(i=setTimeout(s,c)),a}}var Nr="global",ut=Fr+Nr+Fr,ct=typeof self===nn&&self.self===self&&self||typeof global===nn&&global[Nr]===global&&global||void 0;function Br(e){return ct[ut][e]}function Hr(e,r){return ct[ut][e]=r}function mt(e){delete ct[ut][e]}function gt(e,r,t){var n;try{if(Os(e)){var a=window[e];n=a[r].bind(a)}}catch{}return n||t}ct[ut]||(ct[ut]={});var Wt={};function Os(e){if(typeof Wt[e]!==Ze)return Wt[e];try{var r=window[e];r.setItem(Ze,Ze),r.removeItem(Ze)}catch{return Wt[e]=!1}return Wt[e]=!0}function ee(){return ee=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},ee.apply(null,arguments)}var Pr="function",hr="undefined",kt="reducer",uh="@@redux/",Wo=uh+"INIT",Wg=uh+Math.random().toString(36),Yf=(function(){return typeof Symbol===Pr&&Symbol.observable||"@@observable"})(),Vt=" != "+Pr;function ch(e,r,t){var n;if(typeof r===Pr&&typeof t===hr&&(t=r,r=void 0),typeof t!==hr){if(typeof t!==Pr)throw new Error("enhancer"+Vt);return t(ch)(e,r)}if(typeof e!==Pr)throw new Error(kt+Vt);var a=e,i=r,o=[],s=o,u=!1;function c(){s===o&&(s=o.slice())}function l(){return i}function f(d){if(typeof d!==Pr)throw new Error("Listener"+Vt);var h=!0;return c(),s.push(d),function(){if(h){h=!1,c();var p=s.indexOf(d);s.splice(p,1)}}}function v(d){if(!Fe(d))throw new Error("Act != obj");if(typeof d.type===hr)throw new Error("ActType "+hr);if(u)throw new Error("Dispatch in "+kt);try{u=!0,i=a(i,d)}finally{u=!1}for(var h=o=s,p=0;p<h.length;p++)(0,h[p])();return d}return v({type:Wo}),(n={dispatch:v,subscribe:f,getState:l,replaceReducer:function(d){if(typeof d!==Pr)throw new Error("next "+kt+Vt);a=d,v({type:Wo})}})[Yf]=function(){var d,h=f;return(d={subscribe:function(p){if(typeof p!="object")throw new TypeError("Observer != obj");function S(){p.next&&p.next(l())}return S(),{unsubscribe:h(S)}}})[Yf]=function(){return this},d},n}function Vg(e,r){var t=r&&r.type;return"action "+(t&&t.toString()||"?")+kt+" "+e+" returns "+hr}function lt(){var e=[].slice.call(arguments);return e.length===0?function(r){return r}:e.length===1?e[0]:e.reduce(function(r,t){return function(){return r(t.apply(void 0,[].slice.call(arguments)))}})}function zg(){var e=arguments;return function(r){return function(t,n,a){var i,o=r(t,n,a),s=o.dispatch,u={getState:o.getState,dispatch:function(c){return s(c)}};return i=[].slice.call(e).map(function(c){return c(u)}),ee({},o,{dispatch:s=lt.apply(void 0,i)(o.dispatch)})}}}var Or=Fr+"anon_id",jr=Fr+"user_id",at=Fr+"user_traits",Vo="analytics",Ir="userId",nt="anonymousId",Xt=["bootstrap","params","campaign","initializeStart","initialize","initializeEnd","ready","resetStart","reset","resetEnd","pageStart","page","pageEnd","pageAborted","trackStart","track","trackEnd","trackAborted","identifyStart","identify","identifyEnd","identifyAborted","userIdChanged","registerPlugins","enablePlugin","disablePlugin","online","offline","setItemStart","setItem","setItemEnd","setItemAborted","removeItemStart","removeItem","removeItemEnd","removeItemAborted"],zo=["name","EVENTS","config","loaded"],Z=Xt.reduce(function(e,r){return e[r]=r,e},{registerPluginType:function(e){return"registerPlugin:"+e},pluginReadyType:function(e){return"ready:"+e}}),Qf=/^utm_/,Xf=/^an_prop_/,Zf=/^an_trait_/;function Kg(e){var r=e.storage.setItem;return function(t){return function(n){return function(a){if(a.type===Z.bootstrap){var i=a.params,o=a.user,s=a.persistedUser,u=a.initialUser,c=s.userId===o.userId;s.anonymousId!==o.anonymousId&&r(Or,o.anonymousId),c||r(jr,o.userId),u.traits&&r(at,ee({},c&&s.traits?s.traits:{},u.traits));var l=Object.keys(a.params);if(l.length){var f=i.an_uid,v=i.an_event,d=l.reduce(function(h,p){if(p.match(Qf)||p.match(/^(d|g)clid/)){var S=p.replace(Qf,"");h.campaign[S==="campaign"?"name":S]=i[p]}return p.match(Xf)&&(h.props[p.replace(Xf,"")]=i[p]),p.match(Zf)&&(h.traits[p.replace(Zf,"")]=i[p]),h},{campaign:{},props:{},traits:{}});t.dispatch(ee({type:Z.params,raw:i},d,f?{userId:f}:{})),f&&setTimeout(function(){return e.identify(f,d.traits)},0),v&&setTimeout(function(){return e.track(v,d.props)},0),Object.keys(d.campaign).length&&t.dispatch({type:Z.campaign,campaign:d.campaign})}}return n(a)}}}}function Jg(e){return function(r,t){if(r===void 0&&(r={}),t===void 0&&(t={}),t.type===Z.setItemEnd){if(t.key===Or)return ee({},r,{anonymousId:t.value});if(t.key===jr)return ee({},r,{userId:t.value})}switch(t.type){case Z.identify:return Object.assign({},r,{userId:t.userId,traits:ee({},r.traits,t.traits)});case Z.reset:return[jr,Or,at].forEach(function(n){e.removeItem(n)}),Object.assign({},r,{userId:null,anonymousId:null,traits:{}});default:return r}}}function ed(e){return{userId:e.getItem(jr),anonymousId:e.getItem(Or),traits:e.getItem(at)}}var Ko=function(e){return Fr+"TEMP"+Fr+e};function Yg(e){var r=e.storage,t=r.setItem,n=r.removeItem,a=r.getItem;return function(i){return function(o){return function(s){var u=s.userId,c=s.traits,l=s.options;if(s.type===Z.reset&&([jr,at,Or].forEach(function(d){n(d)}),[Ir,nt,"traits"].forEach(function(d){mt(Ko(d))})),s.type===Z.identify){a(Or)||t(Or,Cn());var f=a(jr),v=a(at)||{};f&&f!==u&&i.dispatch({type:Z.userIdChanged,old:{userId:f,traits:v},new:{userId:u,traits:c},options:l}),u&&t(jr,u),c&&t(at,ee({},v,c))}return o(s)}}}}var At={};function rd(e,r){At[e]&&Be(At[e])&&(At[e](r),delete At[e])}function lh(e,r,t){return new Promise(function(n,a){return r()?n(e):t<1?a(ee({},e,{queue:!0})):new Promise(function(i){return setTimeout(i,10)}).then(function(i){return lh(e,r,t-10).then(n,a)})})}function Qg(e){return{abort:e}}function fh(e,r,t){var n={},a=r(),i=e.getState(),o=i.plugins,s=i.queue,u=i.user;if(!i.context.offline&&s&&s.actions&&s.actions.length){var c=s.actions.reduce(function(f,v,d){return o[v.plugin].loaded?(f.process.push(v),f.processIndex.push(d)):(f.requeue.push(v),f.requeueIndex.push(d)),f},{processIndex:[],process:[],requeue:[],requeueIndex:[]});if(c.processIndex&&c.processIndex.length){c.processIndex.forEach(function(f){var v=s.actions[f],d=v.plugin,h=v.payload.type,p=a[d][h];if(p&&Be(p)){var S,R=(function(b,y){return b===void 0&&(b={}),y===void 0&&(y={}),[Ir,nt].reduce(function(A,q){return b.hasOwnProperty(q)&&y[q]&&y[q]!==b[q]&&(A[q]=y[q]),A},b)})(v.payload,u),I=n[R.meta.rid];if(!I&&(S=p({payload:R,config:o[d].config,instance:t,abort:Qg}))&&Fe(S)&&S.abort)return void(n[R.meta.rid]=!0);if(!I){var g=h+":"+d;e.dispatch(ee({},R,{type:g,_:{called:g,from:"queueDrain"}}))}}});var l=s.actions.filter(function(f,v){return!~c.processIndex.indexOf(v)});s.actions=l}}}var _o=function(e){var r=e.data,t=e.action,n=e.instance,a=e.state,i=e.allPlugins,o=e.allMatches,s=e.store,u=e.EVENTS;try{var c=a.plugins,l=a.context,f=t.type,v=f.match(it),d=r.exact.map(function(S){return S.pluginName});v&&(d=o.during.map(function(S){return S.pluginName}));var h=(function(S,R){return function(I,g,b){var y=g.config,A=g.name,q=A+"."+I.type;b&&(q=b.event);var j=I.type.match(it)?(function(G,K,re,L,M){return function(N,m){var C=L?L.name:G,U=m&&$t(m)?m:re;if(L&&(!(U=m&&$t(m)?m:[G]).includes(G)||U.length!==1))throw new Error("Method "+K+" can only abort "+G+" plugin. "+JSON.stringify(U)+" input valid");return ee({},M,{abort:{reason:N,plugins:U,caller:K,_:C}})}})(A,q,R,b,I):(function(G,K){return function(){throw new Error(G.type+" action not cancellable. Remove abort in "+K)}})(I,q);return{payload:Xg(I),instance:S,config:y||{},abort:j}}})(n,d),p=r.exact.reduce(function(S,R){var I=R.pluginName,g=R.methodName,b=!1;return g.match(/^initialize/)||g.match(/^reset/)||(b=!c[I].loaded),l.offline&&g.match(/^(page|track|identify)/)&&(b=!0),S[""+I]=b,S},{});return Promise.resolve(r.exact.reduce(function(S,R,I){var g=R.pluginName;return Promise.resolve(S).then(function(b){function y(){return Promise.resolve(b)}var A=(function(){if(r.namespaced&&r.namespaced[g])return Promise.resolve(r.namespaced[g].reduce(function(q,j,G){return Promise.resolve(q).then(function(K){return j.method&&Be(j.method)?((function(N,m){var C=ud(N);if(C&&C.name===m){var U=ud(C.method);throw new Error([m+" plugin is calling method "+N,"Plugins cant call self","Use "+C.method+" "+(U?"or "+U.method:"")+" in "+m+" plugin insteadof "+N].join(`
|
|
2
|
+
CAUSE: `+d.stack,y.response=g,y.status=g.status,y.url=f,g.type==="opaque")throw y;const A=a.errorType==="json"||((b=g.headers.get("Content-Type"))===null||b===void 0?void 0:b.split(";")[0])==="application/json";return(a.errorType?A?g.text():g[a.errorType]():Promise.resolve(g.body)).then(q=>{if(y.message=typeof q=="string"?q:g.statusText,q)if(A&&typeof q=="string"){y.text=q;try{y.json=JSON.parse(q)}catch{}}else y[a.errorType]=q;throw y})}return g}),p=g=>g.catch(b=>{const y=Object.prototype.hasOwnProperty.call(b,Zr),A=y?b[Zr]:b,q=A?.status&&c.get(A.status)||c.get(A?.name)||y&&c.has(Zr)&&c.get(Zr);if(q)return q(A,e);const j=c.get(xv);if(j)return j(A,e);throw A}),S=g=>b=>p(g?h.then(y=>y&&y[g]()).then(y=>b?b(y):y):h.then(y=>b?b(y):y)),R={_wretchReq:e,_fetchReq:v,_sharedState:r,res:S(null),json:S("json"),blob:S("blob"),formData:S("formData"),arrayBuffer:S("arrayBuffer"),text:S("text"),error(g,b){return c.set(g,b),this},badRequest(g){return this.error(400,g)},unauthorized(g){return this.error(401,g)},forbidden(g){return this.error(403,g)},notFound(g){return this.error(404,g)},timeout(g){return this.error(408,g)},internalError(g){return this.error(500,g)},fetchError(g){return this.error(Zr,g)}},I=u.reduce((g,b)=>({...g,...typeof b.resolver=="function"?b.resolver(g):b.resolver}),R);return o.reduce((g,b)=>b(g,e),I)},Am={_url:"",_options:{},_config:st,_catchers:new Map,_resolvers:[],_deferred:[],_middlewares:[],_addons:[],addon(e){return{...this,_addons:[...this._addons,e],...e.wretch}},errorType(e){return{...this,_config:{...this._config,errorType:e}}},polyfills(e,r=!1){return{...this,_config:{...this._config,polyfills:r?e:xr(this._config.polyfills,e)}}},url(e,r=!1){if(r)return{...this,_url:e};const t=this._url.split("?");return{...this,_url:t.length>1?t[0]+e+"?"+t[1]:this._url+e}},options(e,r=!1){return{...this,_options:r?e:xr(this._options,e)}},headers(e){const r=e?Array.isArray(e)?Object.fromEntries(e):"entries"in e?Object.fromEntries(e.entries()):e:{};return{...this,_options:xr(this._options,{headers:r})}},accept(e){return this.headers({Accept:e})},content(e){return this.headers({[Lv]:e})},auth(e){return this.headers({Authorization:e})},catcher(e,r){const t=new Map(this._catchers);return t.set(e,r),{...this,_catchers:t}},catcherFallback(e){return this.catcher(xv,e)},resolve(e,r=!1){return{...this,_resolvers:r?[e]:[...this._resolvers,e]}},defer(e,r=!1){return{...this,_deferred:r?[e]:[...this._deferred,e]}},middlewares(e,r=!1){return{...this,_middlewares:r?e:[...this._middlewares,...e]}},fetch(e=this._options.method,r="",t=null){let n=this.url(r).options({method:e});const a=Lf(n._options.headers),i=this._config.polyfill("FormData",!1),o=typeof t=="object"&&!(i&&t instanceof i)&&(!n._options.headers||!a||xf(a));return n=t?o?n.json(t,a):n.body(t):n,_m(n._deferred.reduce((s,u)=>u(s,s._url,s._options),n))},get(e=""){return this.fetch("GET",e)},delete(e=""){return this.fetch("DELETE",e)},put(e,r=""){return this.fetch("PUT",r,e)},post(e,r=""){return this.fetch("POST",r,e)},patch(e,r=""){return this.fetch("PATCH",r,e)},head(e=""){return this.fetch("HEAD",e)},opts(e=""){return this.fetch("OPTIONS",e)},body(e){return{...this,_options:{...this._options,body:e}}},json(e,r){const t=Lf(this._options.headers);return this.content(r||xf(t)&&t||Em).body(JSON.stringify(e))}};function or(e="",r={}){return{...Am,_url:e,_options:r}}or.default=or;or.options=Rm;or.errorType=Om;or.polyfills=Tm;or.WretchError=Nv;const km=(e,r)=>r.skipDedupe||r.method!=="GET",qm=(e,r)=>r.method+"@"+e,$m=e=>e.clone(),Um=({skip:e=km,key:r=qm,resolver:t=$m}={})=>{const n=new Map;return a=>(i,o)=>{if(e(i,o))return a(i,o);const s=r(i,o);if(!n.has(s))n.set(s,[]);else return new Promise((u,c)=>{n.get(s).push([u,c])});try{return a(i,o).then(u=>(n.get(s).forEach(([c])=>c(t(u))),n.delete(s),u)).catch(u=>{throw n.get(s).forEach(([,c])=>c(u)),n.delete(s),u})}catch(u){return n.delete(s),Promise.reject(u)}}},Lm=(e,r)=>r.skipCache||r.method!=="GET",xm=(e,r)=>r.method+"@"+e,Nm=()=>!1,jm=()=>null,Dm=e=>e.ok,Mm=({throttle:e=1e3,skip:r=Lm,key:t=xm,clear:n=Nm,invalidate:a=jm,condition:i=Dm,flagResponseOnCacheHit:o="__cached"}={})=>{const s=new Map,u=new Map,c=new Set,l=v=>{e&&!c.has(v)&&(c.add(v),setTimeout(()=>{c.delete(v)},e))},f=v=>(d,h)=>{const p=t(d,h);let S=a(d,h);if(S&&(S instanceof Array||(S=[S]),S.forEach(R=>{typeof R=="string"?s.delete(R):R instanceof RegExp&&s.forEach((I,g)=>{R.test(g)&&s.delete(g)})})),n(d,h)&&s.clear(),r(d,h))return v(d,h);if(c.has(p)){if(s.has(p)){const R=s.get(p).clone();return o&&Object.defineProperty(R,o,{value:p,enumerable:!1}),Promise.resolve(R)}else if(u.has(p))return new Promise((R,I)=>{u.get(p).push([R,I])})}return u.has(p)||u.set(p,[]),l(p),v(d,h).then(R=>(i(R.clone())&&s.set(p,R.clone()),u.get(p).forEach(([I])=>I(R.clone())),u.delete(p),R)).catch(R=>{throw u.get(p).forEach(([,I])=>I(R)),u.delete(p),R})};return f.cacheResponse=function(v,d){l(v),s.set(v,d)},f.cache=s,f.inflight=u,f.throttling=c,f},Fm=(e,r)=>e*r,Bm=e=>e&&e.ok,Hm=({delayTimer:e=500,delayRamp:r=Fm,maxAttempts:t=10,until:n=Bm,onRetry:a=null,retryOnNetworkError:i=!1,resolveWithLatestResponse:o=!1,skip:s}={})=>u=>(c,l)=>{let f=0;if(s&&s(c,l))return u(c,l);const v=(d,h)=>Promise.resolve(n(d,h)).then(p=>p?d&&o?d:h?Promise.reject(h):d:(f++,!t||f<=t?new Promise(S=>{const R=r(e,f);setTimeout(()=>{typeof a=="function"?Promise.resolve(a({response:d,error:h,url:c,options:l})).then((I={})=>{var g,b;S(u((g=I&&I.url)!==null&&g!==void 0?g:c,(b=I&&I.options)!==null&&b!==void 0?b:l))}):S(u(c,l))},R)}).then(v).catch(S=>{if(!i)throw S;return v(null,S)}):d&&o?d:Promise.reject(h||new Error("Number of attempts exceeded."))));return u(c,l).then(v).catch(d=>{if(!i)throw d;return v(null,d)})},Gm="@sesamy/sdk",Wm="1.23.0";let Vm=class{cache=new Map;get(r){return this.cache.get(r)||null}set(r,t){this.cache.set(r,t)}remove(r){this.cache.delete(r)}clear(){this.cache.clear()}};const Tt="sesamyCacheTimestamp",zm=e=>{const{libraryName:r=Gm,libraryVersion:t=Wm,cache:n}=e,a=n?.storage||new Vm,i=[s=>async(u,c)=>{if(n?.mode===rn.BROWSER){let l;typeof sessionStorage<"u"?(l=sessionStorage.getItem(Tt),l||(l=Date.now().toString(),sessionStorage.setItem(Tt,l))):(l=a.get(Tt),l||(l=Date.now().toString(),a.set(Tt,l)));const f={...c,headers:{...c.headers,"Cache-Timestamp":l}};return s(u,f)}return s(u,c)},s=>async(u,c)=>{const l=await e.tokenProvider();if(l===null)return s(u,c);const f={...c,headers:{...c.headers,Authorization:l}};return s(u,f)},Um()];n?.mode===rn.NORMAL&&i.push(Mm({throttle:300*1e3,skip:(s,u)=>u.method!=="GET"})),i.push(Hm({delayTimer:1e3,delayRamp:(s,u)=>s*u,maxAttempts:3,until:s=>!!(s&&(s.ok||s.status>=400&&s.status<500)),retryOnNetworkError:!1}));const o=or(e.baseUrl).headers({"Content-Type":"application/json","X-Sesamy-Client":`${r}/${t}`,...e.headers}).middlewares(i);return{async request(s,u={}){try{const c=/^https?:\/\//.test(s);let l=o.url(s,c);u.headers&&(l=l.headers(u.headers));const f=(u.method||"GET").toLowerCase();let v;switch(f){case"get":v=l.get();break;case"post":v=l.post(u.body);break;case"put":v=l.put(u.body);break;case"patch":v=l.patch(u.body);break;case"delete":v=l.delete();break;default:v=l.get()}const d=await v.res();if(d.ok&&["post","patch","put","delete"].includes(f)&&vr(),d.status===204)return null;if(!d.ok){const h=await d.text().catch(()=>"Unknown error");throw new Po(d.status,d.statusText,d.url,`API Error ${d.status}: ${h}`,h)}return await d.json()}catch(c){if(c instanceof Po)throw c;const l=c.status||500,f=c.message||"Unknown error",v=`${e.baseUrl}${s}`;throw new Po(l,f,v,`API Error ${l}: ${c.message||"Unknown error"}`,c.message||"Unknown error")}}}},vr=()=>(typeof sessionStorage<"u"&&sessionStorage.removeItem(Tt),"Cache cleared"),St={get:async(e,r)=>e.request(`/profile/${r}`),update:async(e,r,t)=>e.request(`/profile/${r}`,{method:"PATCH",body:JSON.stringify(t)}),checkSpotifyLink:async e=>e.request("/profile/spotify-link"),unlinkSpotify:async e=>e.request("/profile/unlink-spotify",{method:"POST"}),delete:async e=>{await e.request("/profile",{method:"DELETE"})}},Eo={list:async(e,r)=>{const t=new URLSearchParams;r?.type&&t.append("type",r.type),r?.sku&&t.append("sku",r.sku),r?.purchaseOptionId&&t.append("purchase-option-id",r.purchaseOptionId),r?.waitForEntitlementAfter&&t.append("wait-for-entitlement-after",r.waitForEntitlementAfter);const n=t.toString(),a=n?`/entitlements?${n}`:"/entitlements";return e.request(a)},get:async(e,r)=>e.request(`/entitlements/${r}`),getAccess:async(e,r)=>e.request(`/entitlements/${r}/access`)},Nf={list:async e=>e.request("/subscriptions"),get:async(e,r)=>e.request(`/subscriptions/${r}`)},jf={get:async(e,r)=>e.request(`/products/${r}`),autoOnboard:async(e,r)=>e.request(`/products/${r}/auto-onboard`,{method:"POST"})},Km=(e,r)=>{if(!e||!r)return e;const t=new URL(e);return t.hash=`access_token=${r}`,t.toString()},Df=(e,r)=>!e.manageUrl||!r?e:{...e,manageUrl:Km(e.manageUrl,r)},It={list:async e=>e.request("/contracts"),get:async(e,r)=>e.request(`/contracts/${r}`),cancel:async(e,r)=>e.request(`/contracts/${r}/cancel`,{method:"POST"}),createAmendment:async(e,r,t)=>e.request(`/contracts/${r}/amendments`,{method:"POST",body:JSON.stringify(t)}),confirmAmendment:async(e,r,t)=>e.request(`/contracts/${r}/amendments/${t}/confirm`,{method:"POST"})},Ro={get:async e=>e.request("/user-metadata"),set:async(e,r,t)=>{await e.request(`/user-metadata/${r}`,{method:"PUT",body:t})},delete:async(e,r)=>{await e.request(`/user-metadata/${r}`,{method:"DELETE"})}},et={list:async e=>e.request("/tallies"),get:async(e,r)=>e.request(`/tallies/${r}`),update:async(e,r,t)=>e.request(`/tallies/${r}`,{method:"PUT",body:JSON.stringify(t)}),create:async(e,r)=>e.request("/tallies",{method:"POST",body:JSON.stringify(r)}),delete:async(e,r)=>{try{return await e.request(`/tallies/${r}`,{method:"DELETE"}),!0}catch{return!1}},push:async(e,r,t)=>e.request(`/tallies/${r}/push`,{method:"POST",body:JSON.stringify(t)})},To={list:async e=>e.request("/tags"),add:async(e,r)=>{await e.request("/tags",{method:"POST",body:JSON.stringify({tag:r})})},remove:async(e,r)=>{await e.request(`/tags/${r}`,{method:"DELETE"})}},rt={generateCheckoutLink:(e,r)=>{const t=new URL(`${e.apiUrl}/checkouts`);return r.items&&t.searchParams.set("items",JSON.stringify(r.items)),r.email&&t.searchParams.set("email",r.email),r.language&&t.searchParams.set("lang",r.language),r.redirectUrl&&t.searchParams.set("redirect-url",r.redirectUrl),r.giftMode&&t.searchParams.set("gift-mode","true"),r.payerEmail&&t.searchParams.set("payer-email",r.payerEmail),r.requireAddress&&t.searchParams.set("require-address","true"),r.metadata&&Object.entries(r.metadata).forEach(([n,a])=>{t.searchParams.set(`metadata.${n}`,a)}),t.toString()},generateAccountLink:(e,r)=>{const t=r.language||"en",n=new URL(`${e.baseUrl}/account/${encodeURIComponent(t)}/subscriptions/${encodeURIComponent(e.clientId)}${r.contractId?`/${encodeURIComponent(r.contractId)}`:""}`);return n.searchParams.set("sesamy-redirect-url",r.redirectUrl||"/"),n.toString()},generateChangePaymentLink:(e,r)=>{const t=r.language||"en",n=new URL(`${e.baseUrl}/account/${encodeURIComponent(t)}/subscriptions/${encodeURIComponent(e.clientId)}/${encodeURIComponent(r.contractId)}/change-payment-method`);return n.searchParams.set("sesamy-redirect-url",r.redirectUrl||"/"),n.toString()},generateChangePlanLink:(e,r)=>{const t=r.language||"en",n=new URL(`${e.baseUrl}/account/${encodeURIComponent(t)}/subscriptions/${encodeURIComponent(e.clientId)}/${encodeURIComponent(r.contractId)}/edit-plan`);return n.searchParams.set("sesamy-redirect-url",r.redirectUrl||"/"),n.toString()},generateConsumeLink:(e,r)=>{const t=r.language||"en";let n=new URL(`${e.baseUrl}/consume/${encodeURIComponent(t)}/@${encodeURIComponent(e.clientId)}/${encodeURIComponent(r.sku)}`);return r.episodeId?n.href+=`/${encodeURIComponent(r.episodeId)}`:n.href+="/listen",n.searchParams.set("sesamy-redirect-url",r.redirectUrl||"/"),n.toString()}},Oo={generateLink:(e,r)=>{const t=new URL(`${e.apiUrl}/checkouts`);return r.items&&t.searchParams.set("items",JSON.stringify(r.items)),r.email&&t.searchParams.set("email",r.email),r.language&&t.searchParams.set("lang",r.language),r.redirectUrl&&t.searchParams.set("redirect-url",r.redirectUrl),r.giftMode&&t.searchParams.set("gift-mode","true"),r.payerEmail&&t.searchParams.set("payer-email",r.payerEmail),r.requireAddress&&t.searchParams.set("require-address","true"),r.metadata&&Object.entries(r.metadata).forEach(([n,a])=>{t.searchParams.set(`metadata.${n}`,a)}),t.toString()},create:async(e,r)=>e.request("/checkouts",{method:"POST",body:JSON.stringify(r)}),get:async(e,r)=>e.request(`/checkouts/${r}`),update:async(e,r,t)=>e.request(`/checkouts/${r}`,{method:"PATCH",body:JSON.stringify(t)})},Mf={list:async e=>e.request("/bills"),get:async(e,r)=>e.request(`/bills/${r}`)},Ff={list:async e=>e.request("/fulfillments"),create:async(e,r)=>e.request("/fulfillments",{method:"POST",body:JSON.stringify(r)})},Jm={get:async(e,r)=>{try{return new URL(r),e.request(r)}catch{return e.request(`/paywalls/${r}`)}}},Ym={list:async e=>e.request("/payment-issues")},Qm={content:async(e,r,t,n,a)=>{const i=new URLSearchParams({url:r});return t&&i.append("selector",t),n&&i.append("cache",n),e.request(`/proxy?${i.toString()}`,a)}},Xm={list:async(e,r)=>{const t=(r?new URLSearchParams({q:r}):new URLSearchParams).toString(),n=t?`/transactions?${t}`:"/transactions";return e.request(n)}},Bf={get:async e=>e.request("/vendor"),list:async e=>e.request("/vendors")},Zm=e=>{const r=zm(e);return{profile:{get:t=>St.get(r,t),update:(t,n)=>St.update(r,t,n),checkSpotifyLink:()=>St.checkSpotifyLink(r),unlinkSpotify:()=>St.unlinkSpotify(r),delete:()=>St.delete(r)},entitlements:{list:t=>Eo.list(r,t),get:t=>Eo.get(r,t),getAccess:t=>Eo.getAccess(r,t)},subscriptions:{list:()=>Nf.list(r),get:t=>Nf.get(r,t)},products:{get:t=>jf.get(r,t),autoOnboard:t=>jf.autoOnboard(r,t)},contracts:{list:async()=>{const t=await It.list(r),n=await e.tokenProvider();if(!n.toLowerCase().startsWith("bearer "))return t;const a=n.substring(7);return t.map(i=>Df(i,a))},get:async t=>{const n=await It.get(r,t),a=await e.tokenProvider();if(!a.toLowerCase().startsWith("bearer "))return n;const i=a.substring(7);return Df(n,i)},cancel:t=>It.cancel(r,t),createAmendment:(t,n)=>It.createAmendment(r,t,n),confirmAmendment:(t,n)=>It.confirmAmendment(r,t,n)},userMetadata:{get:()=>Ro.get(r),set:(t,n)=>Ro.set(r,t,n),delete:t=>Ro.delete(r,t)},tallies:{list:()=>et.list(r),get:t=>et.get(r,t),update:(t,n)=>et.update(r,t,n),create:t=>et.create(r,t),delete:t=>et.delete(r,t),push:(t,n)=>et.push(r,t,n)},tags:{list:()=>To.list(r),add:t=>To.add(r,t),remove:t=>To.remove(r,t)},checkouts:{generateLink:(t,n)=>rt.generateCheckoutLink(t,n),create:t=>Oo.create(r,t),get:t=>Oo.get(r,t),update:(t,n)=>Oo.update(r,t,n)},links:{generateCheckoutLink:(t,n)=>rt.generateCheckoutLink(t,n),generateAccountLink:(t,n)=>rt.generateAccountLink(t,n),generateChangePaymentLink:(t,n)=>rt.generateChangePaymentLink(t,n),generateChangePlanLink:(t,n)=>rt.generateChangePlanLink(t,n),generateConsumeLink:(t,n)=>rt.generateConsumeLink(t,n)},bills:{list:()=>Mf.list(r),get:t=>Mf.get(r,t)},fulfillments:{list:()=>Ff.list(r),create:t=>Ff.create(r,t)},paywalls:{get:t=>Jm.get(r,t)},paymentIssues:{list:()=>Ym.list(r)},proxy:{content:(t,n,a,i)=>Qm.content(r,t,n,a,i)},transactions:{list:t=>Xm.list(r,t)},vendor:{get:()=>Bf.get(r),list:()=>Bf.list(r)}}},eg="sesamy.com",rg="sesamy.dev",tg="https://sesa.my",Hf="sesamyCacheTimestamp",Gf="sesamyContentReloaded";class ng{get(r){return typeof sessionStorage>"u"?null:sessionStorage.getItem(r)}set(r,t){typeof sessionStorage<"u"&&sessionStorage.setItem(r,t)}remove(r){typeof sessionStorage<"u"&&sessionStorage.removeItem(r)}clear(){}}function ag(e,r){return`${e}.${r==="dev"?rg:eg}`}function ir(e,r){return`https://${ag(e,r)}`}function Qt(){let r=(document.documentElement.getAttribute("lang")??navigator.language??"en").split("-")[0]?.toLowerCase()??"en";return r==="nn"&&(r="nb"),r}function Fo(e){let r;try{r=new URL(e)}catch{return!1}return r.protocol==="http:"||r.protocol==="https:"}function jv(e,r){if(Fo(e))return{itemSrc:e};const t=e.split(":");if(t.length<2)throw new Error(`Invalid itemSrc format: expected at least 2 segments separated by ':', got ${t.length}`);const[n,a,i]=t;if(!a)throw new Error("Invalid itemSrc format: sku segment is empty");return{sku:`${n}:${a}`,purchaseOption:r||i}}function Wf(e){return e.endsWith("/")?e.slice(0,-1):e}function Vf(e,r){if(!Fo(e)||!Fo(r))return!1;const t=new URL(e),n=new URL(r);return t.origin===n.origin&&Wf(t.pathname)===Wf(n.pathname)}function ig(e,r,t){const n=new URL(`${ir("checkout3",e.environment)}`);r.language&&n.searchParams.set("lang",r.language);let a=r.sku,i=r.purchaseOptionId,o=r.itemSrc;if(r.itemSrc){const l=jv(r.itemSrc,r.purchaseOptionId);a=l.sku||a,i=l.purchaseOption||i,o=l.itemSrc}a?(n.searchParams.set("sku",a),i&&n.searchParams.set("po-id",i)):o&&n.searchParams.set("url",o),r.email&&n.searchParams.set("email",r.email),r.business&&n.searchParams.set("business","true"),r.currency&&n.searchParams.set("currency",r.currency),r.price&&n.searchParams.set("price",r.price.toString()),r.discountCode&&n.searchParams.set("discount-code",r.discountCode),r.attributionItemSrc?n.searchParams.set("itemSrc",r.attributionItemSrc):t.itemSrc&&n.searchParams.set("itemSrc",t.itemSrc),r.attributionPublisherContentId?n.searchParams.set("publisherContentId",r.attributionPublisherContentId):t.publisherContentId&&n.searchParams.set("publisherContentId",t.publisherContentId),r.utmSource?n.searchParams.set("utm_source",r.utmSource):t.utmSource&&n.searchParams.set("utm_source",t.utmSource),r.utmMedium?n.searchParams.set("utm_medium",r.utmMedium):t.utmMedium&&n.searchParams.set("utm_medium",t.utmMedium),r.utmCampaign?n.searchParams.set("utm_campaign",r.utmCampaign):t.utmCampaign&&n.searchParams.set("utm_campaign",t.utmCampaign),r.utmTerm?n.searchParams.set("utm_term",r.utmTerm):t.utmTerm&&n.searchParams.set("utm_term",t.utmTerm),r.utmContent?n.searchParams.set("utm_content",r.utmContent):t.utmContent&&n.searchParams.set("utm_content",t.utmContent);const s=["_ga","_gid","_fbp","_fbc"];document.cookie.split(";").map(l=>{const[f,v]=l.trim().split("=");return{key:f,value:v}}).filter(l=>s.some(f=>f===l.key)).forEach(l=>{n.searchParams.append(l.key,l.value)});let c=new URL(window.location.href);if(r.redirectUrl)try{c=new URL(r.redirectUrl)}catch{console.warn("Invalid redirect URL provided, using current URL instead:",r.redirectUrl)}return c.searchParams.set("force-refetch-entitlements","true"),r.itemSrc&&c.searchParams.set("sesamy-purchase",r.itemSrc),n.searchParams.set("redirect-url",c.toString()),r.paymentMethodsFilter&&n.searchParams.set("paymentmethods-filter",r.paymentMethodsFilter.flatMap(({provider:l,methods:f})=>f?f.map(v=>`${l}|${v}`):l).join(",")),r.requireAddress&&n.searchParams.set("require-address","true"),r.giftMode&&n.searchParams.set("gift-mode","true"),r.payerEmail&&n.searchParams.set("payer-email",r.payerEmail),r.metadata&&Object.entries(r.metadata).forEach(([l,f])=>{n.searchParams.set(`metadata.${l}`,String(f))}),n}const Dv="sesamySignedURLs";function Ps(){const e=sessionStorage.getItem(Dv);return e?JSON.parse(e):[]}function zf(e){const r=Ps();r.push(e),de(`Adding signed URL: ${e}`),sessionStorage.setItem(Dv,JSON.stringify(r))}function og(e){const r={};return Object.keys(e).forEach(t=>{const n=e[t];n!=null&&(r[t]=n.toString())}),r}const Bo="sesamyAttribution";function sg(e){const r=localStorage.getItem(e);if(!r)return null;try{return JSON.parse(r).value}catch{return console.error(`Failed to parse ${e}`),null}}function ug(e){return Object.keys(e).find(r=>r.startsWith("utm_"))?{utmSource:void 0,utmMedium:void 0,utmCampaign:void 0,...e}:e}function tn(){return sg(Bo)||{}}function Mv(e){if(e===null)localStorage.removeItem(Bo);else{de(`Setting attribution ${JSON.stringify(e)}`);const r=tn()??{},t=og({...r,...ug(e)});localStorage.setItem(Bo,JSON.stringify({value:t}))}}const Es="@sesamy/sesamy-js",Ft="1.93.0",Fv="sesamyFlags";async function Bv(e){try{localStorage.setItem(Fv,JSON.stringify(e))}catch{de("Failed to save flags to localStorage")}}async function Hv(e,r){const t=await Bt();t[e]=r,await Bv(t)}async function Gv(e){return(await Bt())[e]}async function Wv(e){const r=await Bt();e in r&&(delete r[e],await Bv(r))}async function Bt(){try{const e=localStorage.getItem(Fv);return e?JSON.parse(e):{}}catch{return{}}}function Vv(e){function r(n){return n.id?`#${n.id}`:n.classList.length>0?Array.from(n.classList).map(i=>`.${i}`).join(""):null}function t(n){const a=[];let i=n;for(;i&&i!==document.body&&i!==document.documentElement;){const o=r(i);if(o){a.unshift(o);break}if(i.parentElement){const s=Array.from(i.parentElement.children),u=s.indexOf(i)+1,c=i.tagName.toLowerCase();s.filter(f=>f.tagName.toLowerCase()===c).length>1?a.unshift(`${c}:nth-child(${u})`):a.unshift(c)}i=i.parentElement}return a.join(" > ")}return t(e)}function zv(e){return e?Object.fromEntries(Object.entries(e).filter(([r,t])=>t!==void 0)):{}}function cg(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}let Me={article:{selector:"sesamy-article"},image:{selector:"img",attribute:"src"},title:{selector:"h1",attribute:"textContent"},excerpt:{selector:"p",attribute:"textContent"},price:{selector:"sesamy-article",attribute:"price"},currency:{selector:"sesamy-article",attribute:"currency"},url:{selector:"sesamy-article",attribute:"item-src"},accessLevel:{selector:"sesamy-article",attribute:"access-level"},id:{selector:"sesamy-article",attribute:"publisher-content-id"},pass:{selector:"sesamy-article",attribute:"pass"},paywallUrl:{selector:"sesamy-article",attribute:"paywall-url"}},Kv=[],Jv=!1,Rr;function Rs(){const e=window.location.pathname,r=new URLSearchParams(window.location.search),t=navigator.userAgent;return Kv.find(n=>{if(n.path&&!e.includes(n.path)||n.queryParam&&r.get(n.queryParam.key)!==n.queryParam.value)return!1;if(n.headers){const a=n.headers.name.toLowerCase(),i=n.headers.contains.toLowerCase();if(a==="user-agent"){if(!t.toLowerCase().includes(i))return!1}else return!1}return!(n.userAgentContains&&!t.includes(n.userAgentContains))})}function lg(){return Rs()}function fg(e,r){Kv=e.content||[];const t=Rs();t&&t.type==="article"&&(Me={...Me,...zv(t.selectors)},Jv=t.enablePaywallSettingsUrlFallback||!1),Rr=r}function dg(e,r){const{selector:t,attribute:n}=r;return t===Me.article.selector||n&&e.hasAttribute(n)?e:e.querySelector(t)}function Yv(e,r,t=!1){if(e){if(r.attribute){if(r.attribute==="textContent")return e.textContent??void 0;const n=e.getAttribute(r.attribute),a=Yv(e.parentElement,r,t);if(t){const i=[];return n&&i.push(...n.split(",").map(o=>o.trim()).filter(Boolean)),a&&i.push(...a.split(",").map(o=>o.trim()).filter(Boolean)),i.length>0?[...new Set(i)].join(","):void 0}return n??a}return e.textContent??void 0}}function ge(e){const r=document.head.querySelectorAll(`[property~='${e}'][content]`);for(let n=0;n<r.length;n+=1)if(r[n].content)return r[n].content;const t=document.head.querySelectorAll(`[name~='${e}'][content]`);for(let n=0;n<t.length;n+=1)if(t[n].content)return t[n].content}function Ot(e){const r=[];return document.head.querySelectorAll(`[property~='${e}'][content]`).forEach(a=>{a.content&&r.push(a.content)}),document.head.querySelectorAll(`[name~='${e}'][content]`).forEach(a=>{a.content&&r.push(a.content)}),r}let Ct=null;function Qv(){const e=[],r=document.querySelectorAll('script[type="application/ld+json"]');for(const t of r)try{const n=JSON.parse(t.textContent||"");Array.isArray(n)?e.push(...n):n["@graph"]&&Array.isArray(n["@graph"])?e.push(...n["@graph"]):e.push(n)}catch{}return e}function _t(e){const r=Qv(),t=n=>!e||n["@type"]===e||Array.isArray(n["@type"])&&n["@type"].includes(e);return r.find(t)||null}function vg(e){const r=Qv(),t=n=>!e||n["@type"]===e||Array.isArray(n["@type"])&&n["@type"].includes(e);return r.filter(t)}function Ho(e,r,t){if(!e||typeof e!="object")return typeof e=="string"?e:void 0;const a=e[r];if(typeof a=="string")return a;if(a&&typeof a=="object"&&t)return a[t]}function hg(e){if(!e)return;const t=(Array.isArray(e)?e:[e]).map(n=>{if(typeof n=="string")return{name:n};if(typeof n=="object"&&n!==null){const a=n,i=a.name;return i?{name:i,url:a.url,image:Ho(a,"image","url"),jobTitle:a.jobTitle,sameAs:a.sameAs}:null}return null}).filter(n=>n!==null&&!!n.name);return t.length>0?t:void 0}function Co(e){if(Array.isArray(e))return e.filter(r=>typeof r=="string");if(typeof e=="string"){const r=e.split(",").map(t=>t.trim()).filter(Boolean);return r.length>0?r:void 0}}function Xv(){if(Ct)return Ct;const e=_t("NewsArticle")||_t("Article")||_t("BlogPosting")||_t("WebPage"),r=(...a)=>a.find(i=>i!=null&&i!=="")||void 0,t=(...a)=>a.find(i=>i&&i.length>0),n={contentType:e?Array.isArray(e["@type"])?e["@type"][0]:e["@type"]:void 0,authors:hg(e?.author)||(Ot("article:author").length>0?Ot("article:author").map(a=>({name:a})):void 0)||(ge("author")?[{name:ge("author")}]:void 0),keywords:t(Co(e?.keywords),Co(ge("keywords"))),tags:Ot("article:tag").length>0?Ot("article:tag"):void 0,categories:Co(ge("news_keywords")),section:r(e?.articleSection,ge("article:section")),publishedAt:r(e?.datePublished,ge("article:published_time")),modifiedAt:r(e?.dateModified,ge("article:modified_time")),ogType:ge("og:type"),ogSiteName:ge("og:site_name"),ogLocale:ge("og:locale"),twitterCard:ge("twitter:card"),twitterSite:ge("twitter:site"),twitterCreator:ge("twitter:creator"),creator:r(ge("creator"),ge("dc.creator")),mainEntityOfPage:e?Ho(e.mainEntityOfPage,"@id")||(typeof e.mainEntityOfPage=="string"?e.mainEntityOfPage:void 0):void 0,isAccessibleForFree:typeof e?.isAccessibleForFree=="boolean"?e.isAccessibleForFree:void 0,wordCount:typeof e?.wordCount=="number"?e.wordCount:void 0,publisher:e?.publisher&&typeof e.publisher=="object"?{name:e.publisher.name||"",url:e.publisher.url,logo:Ho(e.publisher,"logo","url")}:void 0};return Ct=zv(n),Ct}function pg(){Ct=null}function Ts({publisherContentId:e,key:r,defaultValue:t=""}){const n=e?document.body.querySelector(`sesamy-content-data[id='${e}']`):null,a=r.replace(/-([a-z])/g,(i,o)=>o.toUpperCase());return n?.getAttribute(r)||ge(`sesamy:${r}`)||ge(`sesamy:${a}`)||ge(`og:${r}`)||ge(r)||t}function Zv(){const e=document.querySelectorAll(Me.article.selector);return Array.from(e).map(Ht).filter(r=>r!==null)}function Ht(e){const r=typeof e=="string"?document.querySelector(e):e;if(!r)return null;const t={element:r,selector:typeof e=="string"?e:Vv(r)},n=(i,o,s,u)=>{const{transform:c,collect:l=!1}=u||{},f=dg(r,o),v=Yv(f,o,l),d=Ts({publisherContentId:s,key:cg(String(i))}),h=v||d||void 0;h&&(t[i]=c?c(h):h)};n("id",Me.id),n("title",Me.title,t.id),n("excerpt",Me.excerpt,t.id),n("image",Me.image,t.id),n("price",Me.price,t.id,{transform:i=>{const o=parseFloat(i);return Number.isNaN(o)?void 0:o}}),n("currency",Me.currency,t.id),n("url",Me.url,t.id),n("pass",Me.pass,t.id,{collect:!0}),n("paywallUrl",Me.paywallUrl,t.id),n("accessLevel",Me.accessLevel,t.id,{transform:i=>i||"entitlement"});const a=Rs();if(a&&a.type==="article"&&(a.pass&&(t.pass=t.pass?`${t.pass},${a.pass}`:a.pass),a.price&&!t.price&&(t.price=a.price.amount),a.price?.currency&&!t.currency&&(t.currency=a.price.currency),a.paywallUrl&&!t.paywallUrl&&(t.paywallUrl=a.paywallUrl)),Jv&&!t.paywallUrl){const i=document.querySelector("sesamy-paywall");if(i){const o=i.getAttribute("settings-url");o&&(t.paywallUrl=o)}}return t.url||(t.url=window.location.href),t.metadata=Xv(),t}async function mg(e){const r=Ht(e);if(!r)throw new Error("Could not find article element");if(r.accessLevel==="public")return!0;if(r.accessLevel==="logged-in"&&!r.paywallUrl)return await Rr.auth.isAuthenticated()?!0:null;if(r.paywallUrl&&((await Rr.paywalls.get(r.paywallUrl)).settings.template==="LOGIN"?"logged-in":"entitlement")==="logged-in")return await Rr.auth.isAuthenticated()?!0:null;if(!r.url)throw new Error("Article must have a URL");return await Rr.entitlements.hasAccess(r.url,r.pass?.split(",")||[])||null}async function eh(e,r){const t=typeof e=="string"?document.querySelector(e):e;if(!t)throw new Error("Could not find element");const n=Ht(t);if(!n?.url)throw new Error("Could not find content for element");const a=await Rr.entitlements.hasAccess(n.url,n.pass?.split(",")||[]);if(!a)throw new Error("User does not have access to the content");let i;if(!a.id&&a.token)i=a.token;else{const s=await Rr.entitlements.access(a.id);if(!s.token)throw new Error("Could not get access token");i=s.token}const o=r||Vv(t.parentElement||t);return Rr.proxy.getContent(i,n.url,o)}function rh(e,r={}){const{closeOnBackdropClick:t=!0,closeOnEscape:n=!0,zIndex:a=2147483647,backdropBlur:i="5px",overlayBackground:o="rgba(0,0,0,0.5)"}=r,s=document.createElement("div");s.setAttribute("data-sesamy-modal","true"),Object.assign(s.style,{position:"fixed",top:"0",left:"0",width:"100vw",height:"100vh",background:o,zIndex:String(a),display:"flex",alignItems:"center",justifyContent:"center",backdropFilter:`blur(${i})`});const u=document.createElement("div");u.setAttribute("data-sesamy-modal-content","true"),typeof e=="string"?u.innerHTML=e:u.appendChild(e),s.appendChild(u);const c=()=>{s.remove(),n&&document.removeEventListener("keydown",l)},l=f=>{f.key==="Escape"&&c()};return t&&s.addEventListener("click",f=>{f.target===s&&c()}),n&&document.addEventListener("keydown",l),document.body.appendChild(s),{element:s,close:c}}function gg(e,r={}){const{position:t="top",fixed:n=!0,zIndex:a=2147483647,autoDismissMs:i,pushContent:o=!1,height:s,transitionDuration:u="0.3s"}=r,c=document.createElement("div");c.setAttribute("data-sesamy-notification-bar","true"),c.setAttribute("data-sesamy-notification-position",t),Object.assign(c.style,{position:n?"fixed":"absolute",[t]:"0",left:"0",width:"100%",zIndex:String(a),boxSizing:"border-box",...s&&{height:s}}),typeof e=="string"?c.innerHTML=e:c.appendChild(e);let l,f,v;const d=()=>{if(v&&clearTimeout(v),o&&s){const h=document.documentElement;h.style.transform=l||"",setTimeout(()=>{c.remove(),h.style.transition=f||""},parseFloat(u)*1e3)}else c.remove()};if(i&&(v=setTimeout(d,i)),o&&s){const h=document.documentElement;l=h.style.transform,f=h.style.transition,h.style.transition=`transform ${u} ease`,c.style.transition=`transform ${u} ease`,t==="top"?(h.style.transform=`translateY(${s})`,c.style.transform=`translateY(-${s})`):(h.style.transform=`translateY(-${s})`,c.style.transform=`translateY(${s})`),document.documentElement.prepend(c)}else document.body.appendChild(c);return{element:c,close:d}}function yg(e){const r=e.endpoint??ir("api2",e.environment),n=Zm({baseUrl:r,tokenProvider:async()=>{if(await dr())try{const U=await fr(!1);return U?`Bearer ${U}`:null}catch{}const m=localStorage.getItem("__anon_id");return`Basic ${btoa(`${e.vendorId||e.clientId}|${m}:`)}`},libraryName:Es,libraryVersion:Ft,vendorId:e.vendorId,cache:{mode:rn.BROWSER,storage:new ng}}),a=m=>async(C,U)=>{let F=sessionStorage.getItem(Hf);F||(F=Date.now().toString(),sessionStorage.setItem(Hf,F));const w={...U,headers:{...U.headers,"Cache-Timestamp":F}};return m(C,w)},i=(m=!0)=>C=>async(U,F)=>{const w=await fr(m);if(!w){if(await dr()){const x={...F,credentials:"include"};return C(U,x)}if(m)throw new Error("No access token available");return C(U,F)}const T={...F,headers:{...F.headers,Authorization:`Bearer ${w}`}};return C(U,T)},o=or(r).headers({"Content-Type":"application/json"}).middlewares([a,i(),wm(),Pm({delayTimer:1e3,delayRamp:(m,C)=>m*C,maxAttempts:3,until:m=>!!(m&&(m.ok||m.status>=400&&m.status<500)),retryOnNetworkError:!1})]);async function s(m={}){const{waitForEntitlementAfter:C,includeSignedLinks:U=!0}=m,F=await dr()?await n.entitlements.list({waitForEntitlementAfter:C?.toISOString()}):[];return U&&F.push(...Ps()),F}async function u(m,C=[]){return(await s())?.find(w=>{if(m){const{sku:T,purchaseOption:x}=jv(m);if("sku"in w&&T===w.sku||x&&"purchaseOptionsId"in w&&x===w.purchaseOptionsId||Vf(m,w.url))return!0}return!!C.some(T=>Vf(T,w.url))})}async function c(m,C,U){const F=new URL(r,window.location.origin);return F.pathname=F.pathname.replace(/\/$/,"")+"/proxy",F.searchParams.set("url",C),U&&F.searchParams.set("selector",U),or(F.toString()).headers({Authorization:`Bearer ${m}`}).get().text()}async function l(m){if(!m)throw new Error("SKU is required to get fulfillments");return await dr()?await o.get(`/fulfillments?sku=${encodeURIComponent(m)}`).json():[]}async function f(m,C){if(!m||!C)throw new Error("SKU and itemId are required to request delivery");return(await o.post({sku:m},`/fulfillments/${encodeURIComponent(C)}/request-delivery?`).res()).ok}async function v(){return console.warn("getSubscriptions is deprecated, use getContracts instead"),o.get("/subscriptions").json()}async function d(m){return(await n.transactions.list())?.find(U=>U.id===m)}async function h(){return await o.url("/tags").get().json()}async function p(m){const C=await o.url(`/tags/${encodeURIComponent(m)}`).delete().res();return vr(),C.ok}async function S(m){const C=await o.url("/tags").post(encodeURIComponent(m)).res();return Lr(er.USER_ATTRIBUTE_CHANGED,{}),vr(),C.ok}async function R(m){return(await n.tallies.get(m)).value}async function I(){const m=await n.tallies.list(),C={};for(const U of m)C[U.id]=U.value;return C}async function g(m){return await n.tallies.delete(m)}async function b(m,C){return await n.tallies.push(m,C)}async function y(){return await fr(!1)?await o.url("/profile").get().json():null}async function A(m){const C=await o.url("/profile").patch(m).res();return vr(),C.ok}async function q(){return(await o.url("/profile/spotify-link").get().json()).isSpotifyLinked}async function j(){return(await o.url("/profile/unlink-spotify").post().res()).ok}async function G(m){const C=await fr(!1);if(!C)throw new Error("No access token available");const U=new URL(`${ir("access-sync",e.environment)}/spotify/sesamy-callback`);U.searchParams.set("access_token",C),U.searchParams.set("state",m),window.location.href=U.toString()}async function K(m){const C=await o.url(`/products/${encodeURIComponent(m)}/auto-onboard`).post().json();return C.length&&vr(),C}async function re(m,C=3600){const{shortlink:U}=await or(tg).post({url:m,ttl:C}).json();return U}async function L(m){const C=await fr(!1,!0);let U;const F=m.language||Qt(),w=tn();switch(m.target){case"account":U=new URL(`${ir("account",e.environment)}/${encodeURIComponent(m.language||F)}/subscriptions/${encodeURIComponent(e.vendorId||e.clientId)}${m.contractId?`/${encodeURIComponent(m.contractId)}`:""}`),U.searchParams.set("sesamy-redirect-url",m.redirectUrl||window.location.href);break;case"change-payment":U=new URL(`${ir("account",e.environment)}/${encodeURIComponent(m.language||F)}/subscriptions/${encodeURIComponent(e.vendorId||e.clientId)}/${encodeURIComponent(m.contractId)}/change-payment-method`),U.searchParams.set("sesamy-redirect-url",m.redirectUrl||window.location.href);break;case"change-plan":U=new URL(`${ir("account",e.environment)}/${encodeURIComponent(m.language||F)}/subscriptions/${encodeURIComponent(e.vendorId||e.clientId)}/${encodeURIComponent(m.contractId)}/edit-plan`),U.searchParams.set("sesamy-redirect-url",m.redirectUrl||window.location.href);break;case"consume":U=new URL(`${ir("consume",e.environment)}/${encodeURIComponent(m.language||F)}/@${encodeURIComponent(e.vendorId||e.clientId)}/${encodeURIComponent(m.sku)}`),m.episodeId?U.href+=`/${m.episodeId}`:U.href+="/listen",U.searchParams.set("sesamy-redirect-url",m.redirectUrl||window.location.href);break;case"checkout":U=ig(e,{language:F,...m},w);break;default:throw new Error("Invalid target")}return C&&(U.hash=`#access_token=${C}`),m.shorten?re(U.href,m.ttl):U.href}async function M(){const m=await fr(!1),C=new URL(`${ir("account",e.environment)}/subscriptions/${e.vendorId||e.clientId}`);m&&(C.hash=`#access_token=${m}`),window.location.href=C.toString()}async function N(m){const C=tn(),U=["_ga","_gid","_fbp","_fbc"];return document.cookie.split(";").forEach(F=>{const[w,T]=F.trim().split("=");U.includes(w)&&!C[w]&&(C[w]=T)}),n.checkouts.create({language:Qt(),...m,attribution:{...C,...m.attribution}})}return{autoOnboardProduct:K,bills:n.bills,checkouts:{create:N,get:n.checkouts.get,update:n.checkouts.update},content:{list:Zv,get:Ht,getLanguage:Qt,unlock:eh,getPropertyFromHTML:Ts},contracts:n.contracts,deleteTag:p,deleteTally:g,entitlements:n.entitlements,flags:{get:Gv,set:Hv,list:Bt,delete:Wv},generateLink:L,getProxyContent:c,getEntitlements:s,getFulfillments:l,requestDelivery:f,hasAccess:u,isSpotifyLinked:q,linkSpotify:G,openHostedAccountPage:M,paywalls:n.paywalls,paymentIssues:n.paymentIssues,getProfile:y,products:n.products,getSubscriptions:v,getTally:R,getTallies:I,getTags:h,getTransaction:d,transactions:n.transactions,userMetadata:n.userMetadata,pushTally:b,setTag:S,unlinkSpotify:j,updateProfile:A,vendor:n.vendor}}function Kf(e,r,t,n,a){for(r=r.split?r.split("."):r,n=0;n<r.length;n++)e=e?e[r[n]]:a;return e===a?t:e}var bg="function",wg="string",Ze="undefined",Sg="boolean",nn="object",Ig="array",Pg="number",Eg="symbol",Rg="null",Go=function(){},th="any",nh="*",Fr="__",Tg="form",Og="input",Cg="button",_g="select",an=typeof process!==Ze?process:{};an.env&&an.env.NODE_ENV;var _e=typeof document!==Ze;an.versions!=null&&an.versions.node!=null;typeof Deno!==Ze&&Deno.core;_e&&window.name==="nodejs"||typeof navigator!==Ze&&typeof navigator.userAgent!==Ze&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));function ah(e,r){return r.charAt(0)[e]()+r.slice(1)}var Ag=ah.bind(null,"toUpperCase"),kg=ah.bind(null,"toLowerCase");function qg(e){return ih(e)?Ag(Rg):typeof e===nn?xg(e):Object.prototype.toString.call(e).slice(8,-1)}function on(e,r){r===void 0&&(r=!0);var t=qg(e);return r?kg(t):t}function Gt(e,r){return typeof r===e}var Be=Gt.bind(null,bg),Tr=Gt.bind(null,wg),tt=Gt.bind(null,Ze),$g=Gt.bind(null,Sg);Gt.bind(null,Eg);function ih(e){return e===null}function Ug(e){return on(e)===Pg&&!isNaN(e)}function oh(e){return on(e)===Ig}function Fe(e){if(!Lg(e))return!1;for(var r=e;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r}function Lg(e){return e&&(typeof e===nn||e!==null)}function xg(e){return Be(e.constructor)?e.constructor.name:null}function Ng(e){return e instanceof Error||Tr(e.message)&&e.constructor&&Ug(e.constructor.stackTraceLimit)}function sh(e,r){if(typeof r!="object"||ih(r))return!1;if(r instanceof e)return!0;var t=on(new e(""));if(Ng(r))for(;r;){if(on(r)===t)return!0;r=Object.getPrototypeOf(r)}return!1}sh.bind(null,TypeError);sh.bind(null,SyntaxError);function Tn(e,r){var t=e instanceof Element||e instanceof HTMLDocument;return t&&r?jg(e,r):t}function jg(e,r){return r===void 0&&(r=""),e&&e.nodeName===r.toUpperCase()}function On(e){var r=[].slice.call(arguments,1);return function(){return e.apply(void 0,[].slice.call(arguments).concat(r))}}On(Tn,Tg);On(Tn,Cg);On(Tn,Og);On(Tn,_g);function Dg(e){return e?oh(e)?e:[e]:[]}function Jf(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function Mg(){if(_e){var e=navigator,r=e.languages;return e.userLanguage||(r&&r.length?r[0]:e.language)}}function Fg(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function Bg(e){return(function(r){for(var t,n=Object.create(null),a=/([^&=]+)=?([^&]*)/g;t=a.exec(r);){var i=Jf(t[1]),o=Jf(t[2]);if(i)if(i.substring(i.length-2)==="[]"){var s=n[i=i.substring(0,i.length-2)]||(n[i]=[]);n[i]=Array.isArray(s)?s:[],n[i].push(o)}else n[i]=o===""||o}for(var u in n){var c=u.split("[");c.length>1&&(Hg(n,c.map(function(l){return l.replace(/[?[\]\\ ]/g,"")}),n[u]),delete n[u])}return n})((function(r){return _e&&window.location.search.substring(1)})())}function Hg(e,r,t){for(var n=r.length-1,a=0;a<n;++a){var i=r[a];if(i==="__proto__"||i==="constructor")break;i in e||(e[i]={}),e=e[i]}e[r[n]]=t}function Cn(){for(var e="",r=0,t=4294967295*Math.random()|0;r++<36;){var n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[r-1],a=15&t;e+=n=="-"||n=="4"?n:(n=="x"?a:3&a|8).toString(16),t=r%8==0?4294967295*Math.random()|0:t>>4}return e}function Gg(e,r){var t,n,a,i=null,o=0,s=function(){o=new Date,i=null,a=e.apply(t,n)};return function(){var u=new Date;o||(o=u);var c=r-(u-o);return t=this,n=arguments,c<=0?(clearTimeout(i),i=null,o=u,a=e.apply(t,n)):i||(i=setTimeout(s,c)),a}}var Nr="global",ut=Fr+Nr+Fr,ct=typeof self===nn&&self.self===self&&self||typeof global===nn&&global[Nr]===global&&global||void 0;function Br(e){return ct[ut][e]}function Hr(e,r){return ct[ut][e]=r}function mt(e){delete ct[ut][e]}function gt(e,r,t){var n;try{if(Os(e)){var a=window[e];n=a[r].bind(a)}}catch{}return n||t}ct[ut]||(ct[ut]={});var Wt={};function Os(e){if(typeof Wt[e]!==Ze)return Wt[e];try{var r=window[e];r.setItem(Ze,Ze),r.removeItem(Ze)}catch{return Wt[e]=!1}return Wt[e]=!0}function ee(){return ee=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},ee.apply(null,arguments)}var Pr="function",hr="undefined",kt="reducer",uh="@@redux/",Wo=uh+"INIT",Wg=uh+Math.random().toString(36),Yf=(function(){return typeof Symbol===Pr&&Symbol.observable||"@@observable"})(),Vt=" != "+Pr;function ch(e,r,t){var n;if(typeof r===Pr&&typeof t===hr&&(t=r,r=void 0),typeof t!==hr){if(typeof t!==Pr)throw new Error("enhancer"+Vt);return t(ch)(e,r)}if(typeof e!==Pr)throw new Error(kt+Vt);var a=e,i=r,o=[],s=o,u=!1;function c(){s===o&&(s=o.slice())}function l(){return i}function f(d){if(typeof d!==Pr)throw new Error("Listener"+Vt);var h=!0;return c(),s.push(d),function(){if(h){h=!1,c();var p=s.indexOf(d);s.splice(p,1)}}}function v(d){if(!Fe(d))throw new Error("Act != obj");if(typeof d.type===hr)throw new Error("ActType "+hr);if(u)throw new Error("Dispatch in "+kt);try{u=!0,i=a(i,d)}finally{u=!1}for(var h=o=s,p=0;p<h.length;p++)(0,h[p])();return d}return v({type:Wo}),(n={dispatch:v,subscribe:f,getState:l,replaceReducer:function(d){if(typeof d!==Pr)throw new Error("next "+kt+Vt);a=d,v({type:Wo})}})[Yf]=function(){var d,h=f;return(d={subscribe:function(p){if(typeof p!="object")throw new TypeError("Observer != obj");function S(){p.next&&p.next(l())}return S(),{unsubscribe:h(S)}}})[Yf]=function(){return this},d},n}function Vg(e,r){var t=r&&r.type;return"action "+(t&&t.toString()||"?")+kt+" "+e+" returns "+hr}function lt(){var e=[].slice.call(arguments);return e.length===0?function(r){return r}:e.length===1?e[0]:e.reduce(function(r,t){return function(){return r(t.apply(void 0,[].slice.call(arguments)))}})}function zg(){var e=arguments;return function(r){return function(t,n,a){var i,o=r(t,n,a),s=o.dispatch,u={getState:o.getState,dispatch:function(c){return s(c)}};return i=[].slice.call(e).map(function(c){return c(u)}),ee({},o,{dispatch:s=lt.apply(void 0,i)(o.dispatch)})}}}var Or=Fr+"anon_id",jr=Fr+"user_id",at=Fr+"user_traits",Vo="analytics",Ir="userId",nt="anonymousId",Xt=["bootstrap","params","campaign","initializeStart","initialize","initializeEnd","ready","resetStart","reset","resetEnd","pageStart","page","pageEnd","pageAborted","trackStart","track","trackEnd","trackAborted","identifyStart","identify","identifyEnd","identifyAborted","userIdChanged","registerPlugins","enablePlugin","disablePlugin","online","offline","setItemStart","setItem","setItemEnd","setItemAborted","removeItemStart","removeItem","removeItemEnd","removeItemAborted"],zo=["name","EVENTS","config","loaded"],Z=Xt.reduce(function(e,r){return e[r]=r,e},{registerPluginType:function(e){return"registerPlugin:"+e},pluginReadyType:function(e){return"ready:"+e}}),Qf=/^utm_/,Xf=/^an_prop_/,Zf=/^an_trait_/;function Kg(e){var r=e.storage.setItem;return function(t){return function(n){return function(a){if(a.type===Z.bootstrap){var i=a.params,o=a.user,s=a.persistedUser,u=a.initialUser,c=s.userId===o.userId;s.anonymousId!==o.anonymousId&&r(Or,o.anonymousId),c||r(jr,o.userId),u.traits&&r(at,ee({},c&&s.traits?s.traits:{},u.traits));var l=Object.keys(a.params);if(l.length){var f=i.an_uid,v=i.an_event,d=l.reduce(function(h,p){if(p.match(Qf)||p.match(/^(d|g)clid/)){var S=p.replace(Qf,"");h.campaign[S==="campaign"?"name":S]=i[p]}return p.match(Xf)&&(h.props[p.replace(Xf,"")]=i[p]),p.match(Zf)&&(h.traits[p.replace(Zf,"")]=i[p]),h},{campaign:{},props:{},traits:{}});t.dispatch(ee({type:Z.params,raw:i},d,f?{userId:f}:{})),f&&setTimeout(function(){return e.identify(f,d.traits)},0),v&&setTimeout(function(){return e.track(v,d.props)},0),Object.keys(d.campaign).length&&t.dispatch({type:Z.campaign,campaign:d.campaign})}}return n(a)}}}}function Jg(e){return function(r,t){if(r===void 0&&(r={}),t===void 0&&(t={}),t.type===Z.setItemEnd){if(t.key===Or)return ee({},r,{anonymousId:t.value});if(t.key===jr)return ee({},r,{userId:t.value})}switch(t.type){case Z.identify:return Object.assign({},r,{userId:t.userId,traits:ee({},r.traits,t.traits)});case Z.reset:return[jr,Or,at].forEach(function(n){e.removeItem(n)}),Object.assign({},r,{userId:null,anonymousId:null,traits:{}});default:return r}}}function ed(e){return{userId:e.getItem(jr),anonymousId:e.getItem(Or),traits:e.getItem(at)}}var Ko=function(e){return Fr+"TEMP"+Fr+e};function Yg(e){var r=e.storage,t=r.setItem,n=r.removeItem,a=r.getItem;return function(i){return function(o){return function(s){var u=s.userId,c=s.traits,l=s.options;if(s.type===Z.reset&&([jr,at,Or].forEach(function(d){n(d)}),[Ir,nt,"traits"].forEach(function(d){mt(Ko(d))})),s.type===Z.identify){a(Or)||t(Or,Cn());var f=a(jr),v=a(at)||{};f&&f!==u&&i.dispatch({type:Z.userIdChanged,old:{userId:f,traits:v},new:{userId:u,traits:c},options:l}),u&&t(jr,u),c&&t(at,ee({},v,c))}return o(s)}}}}var At={};function rd(e,r){At[e]&&Be(At[e])&&(At[e](r),delete At[e])}function lh(e,r,t){return new Promise(function(n,a){return r()?n(e):t<1?a(ee({},e,{queue:!0})):new Promise(function(i){return setTimeout(i,10)}).then(function(i){return lh(e,r,t-10).then(n,a)})})}function Qg(e){return{abort:e}}function fh(e,r,t){var n={},a=r(),i=e.getState(),o=i.plugins,s=i.queue,u=i.user;if(!i.context.offline&&s&&s.actions&&s.actions.length){var c=s.actions.reduce(function(f,v,d){return o[v.plugin].loaded?(f.process.push(v),f.processIndex.push(d)):(f.requeue.push(v),f.requeueIndex.push(d)),f},{processIndex:[],process:[],requeue:[],requeueIndex:[]});if(c.processIndex&&c.processIndex.length){c.processIndex.forEach(function(f){var v=s.actions[f],d=v.plugin,h=v.payload.type,p=a[d][h];if(p&&Be(p)){var S,R=(function(b,y){return b===void 0&&(b={}),y===void 0&&(y={}),[Ir,nt].reduce(function(A,q){return b.hasOwnProperty(q)&&y[q]&&y[q]!==b[q]&&(A[q]=y[q]),A},b)})(v.payload,u),I=n[R.meta.rid];if(!I&&(S=p({payload:R,config:o[d].config,instance:t,abort:Qg}))&&Fe(S)&&S.abort)return void(n[R.meta.rid]=!0);if(!I){var g=h+":"+d;e.dispatch(ee({},R,{type:g,_:{called:g,from:"queueDrain"}}))}}});var l=s.actions.filter(function(f,v){return!~c.processIndex.indexOf(v)});s.actions=l}}}var _o=function(e){var r=e.data,t=e.action,n=e.instance,a=e.state,i=e.allPlugins,o=e.allMatches,s=e.store,u=e.EVENTS;try{var c=a.plugins,l=a.context,f=t.type,v=f.match(it),d=r.exact.map(function(S){return S.pluginName});v&&(d=o.during.map(function(S){return S.pluginName}));var h=(function(S,R){return function(I,g,b){var y=g.config,A=g.name,q=A+"."+I.type;b&&(q=b.event);var j=I.type.match(it)?(function(G,K,re,L,M){return function(N,m){var C=L?L.name:G,U=m&&$t(m)?m:re;if(L&&(!(U=m&&$t(m)?m:[G]).includes(G)||U.length!==1))throw new Error("Method "+K+" can only abort "+G+" plugin. "+JSON.stringify(U)+" input valid");return ee({},M,{abort:{reason:N,plugins:U,caller:K,_:C}})}})(A,q,R,b,I):(function(G,K){return function(){throw new Error(G.type+" action not cancellable. Remove abort in "+K)}})(I,q);return{payload:Xg(I),instance:S,config:y||{},abort:j}}})(n,d),p=r.exact.reduce(function(S,R){var I=R.pluginName,g=R.methodName,b=!1;return g.match(/^initialize/)||g.match(/^reset/)||(b=!c[I].loaded),l.offline&&g.match(/^(page|track|identify)/)&&(b=!0),S[""+I]=b,S},{});return Promise.resolve(r.exact.reduce(function(S,R,I){var g=R.pluginName;return Promise.resolve(S).then(function(b){function y(){return Promise.resolve(b)}var A=(function(){if(r.namespaced&&r.namespaced[g])return Promise.resolve(r.namespaced[g].reduce(function(q,j,G){return Promise.resolve(q).then(function(K){return j.method&&Be(j.method)?((function(N,m){var C=ud(N);if(C&&C.name===m){var U=ud(C.method);throw new Error([m+" plugin is calling method "+N,"Plugins cant call self","Use "+C.method+" "+(U?"or "+U.method:"")+" in "+m+" plugin insteadof "+N].join(`
|
|
3
3
|
`))}})(j.methodName,j.pluginName),Promise.resolve(j.method({payload:K,instance:n,abort:(re=K,L=g,M=j.pluginName,function(N,m){return ee({},re,{abort:{reason:N,plugins:m||[L],caller:f,from:M||L}})}),config:ad(j.pluginName,c,i),plugins:c})).then(function(N){var m=Fe(N)?N:{};return Promise.resolve(ee({},K,m))})):K;var re,L,M})},Promise.resolve(t))).then(function(q){b[g]=q});b[g]=t})();return A&&A.then?A.then(y):y()})},Promise.resolve({}))).then(function(S){return Promise.resolve(r.exact.reduce(function(R,I,g){try{var b=r.exact.length===g+1,y=I.pluginName,A=i[y];return Promise.resolve(R).then(function(q){var j=S[y]?S[y]:{};if(v&&(j=q),ko(j,y))return Ao({data:j,method:f,instance:n,pluginName:y,store:s}),Promise.resolve(q);if(ko(q,y))return b&&Ao({data:q,method:f,instance:n,store:s}),Promise.resolve(q);if(p.hasOwnProperty(y)&&p[y]===!0)return s.dispatch({type:"queue",plugin:y,payload:j,_:{called:"queue",from:"queueMechanism"}}),Promise.resolve(q);var G=h(S[y],i[y]);return Promise.resolve(A[f]({abort:G.abort,payload:j,instance:n,config:ad(y,c,i),plugins:c})).then(function(K){var re=Fe(K)?K:{},L=ee({},q,re),M=S[y];if(ko(M,y))Ao({data:M,method:f,instance:n,pluginName:y,store:s});else{var N=f+":"+y;(N.match(/:/g)||[]).length<2&&!f.match(td)&&!f.match(nd)&&n.dispatch(ee({},v?L:j,{type:N,_:{called:N,from:"submethod"}}))}return Promise.resolve(L)})})}catch(q){return Promise.reject(q)}},Promise.resolve(t))).then(function(R){if(!(f.match(it)||f.match(/^registerPlugin/)||f.match(nd)||f.match(td)||f.match(/^params/)||f.match(/^userIdChanged/))){if(u.plugins.includes(f),R._&&R._.originalAction===f)return R;var I=ee({},R,{_:{originalAction:R.type,called:R.type,from:"engineEnd"}});dh(R,r.exact.length)&&!f.match(/End$/)&&(I=ee({},I,{type:R.type+"Aborted"})),s.dispatch(I)}return R})})}catch(S){return Promise.reject(S)}},it=/Start$/,td=/^bootstrap/,nd=/^ready/;function Ao(e){var r=e.pluginName,t=e.method+"Aborted"+(r?":"+r:"");e.store.dispatch(ee({},e.data,{type:t,_:{called:t,from:"abort"}}))}function ad(e,r,t){var n=r[e]||t[e];return n&&n.config?n.config:{}}function id(e,r){return r.reduce(function(t,n){return n[e]?t.concat({methodName:e,pluginName:n.name,method:n[e]}):t},[])}function od(e,r){var t=e.replace(it,""),n=r?":"+r:"";return[""+e+n,""+t+n,t+"End"+n]}function ko(e,r){var t=e.abort;return!!t&&(t===!0||sd(t,r)||t&&sd(t.plugins,r))}function dh(e,r){var t=e.abort;if(!t)return!1;if(t===!0||Tr(t))return!0;var n=t.plugins;return $t(t)&&t.length===r||$t(n)&&n.length===r}function $t(e){return Array.isArray(e)}function sd(e,r){return!(!e||!$t(e))&&e.includes(r)}function ud(e){var r=e.match(/(.*):(.*)/);return!!r&&{method:r[1],name:r[2]}}function Xg(e){return Object.keys(e).reduce(function(r,t){return t==="type"||(r[t]=Fe(e[t])?Object.assign({},e[t]):e[t]),r},{})}function Zg(e,r,t){var n={};return function(a){return function(i){return function(o){try{var s,u=function(b){return s?b:i(f)},c=o.type,l=o.plugins,f=o;if(o.abort)return Promise.resolve(i(o));if(c===Z.enablePlugin&&a.dispatch({type:Z.initializeStart,plugins:l,disabled:[],fromEnable:!0,meta:o.meta}),c===Z.disablePlugin&&setTimeout(function(){return rd(o.meta.rid,{payload:o})},0),c===Z.initializeEnd){var v=r(),d=Object.keys(v),h=d.filter(function(b){return l.includes(b)}).map(function(b){return v[b]}),p=[],S=[],R=o.disabled,I=h.map(function(b){var y=b.loaded,A=b.name,q=b.config;return lh(b,function(){return y({config:q})},1e4).then(function(j){return n[A]||(a.dispatch({type:Z.pluginReadyType(A),name:A,events:Object.keys(b).filter(function(G){return!zo.includes(G)})}),n[A]=!0),p=p.concat(A),b}).catch(function(j){if(j instanceof Error)throw new Error(j);return S=S.concat(j.name),j})});Promise.all(I).then(function(b){var y={plugins:p,failed:S,disabled:R};setTimeout(function(){d.length===I.length+R.length&&a.dispatch(ee({},{type:Z.ready},y))},0)})}var g=(function(){if(c!==Z.bootstrap)return/^ready:([^:]*)$/.test(c)&&setTimeout(function(){return fh(a,r,e)},0),Promise.resolve((function(b,y,A,q,j){try{var G=Be(y)?y():y,K=b.type,re=K.replace(it,"");if(b._&&b._.called)return Promise.resolve(b);var L=A.getState(),M=(C=G,(U=L.plugins)===void 0&&(U={}),(F=b.options)===void 0&&(F={}),Object.keys(C).filter(function(w){var T=F.plugins||{};return $g(T[w])?T[w]:T.all!==!1&&(!U[w]||U[w].enabled!==!1)}).map(function(w){return C[w]}));K===Z.initializeStart&&b.fromEnable&&(M=Object.keys(L.plugins).filter(function(w){var T=L.plugins[w];return b.plugins.includes(w)&&!T.initialized}).map(function(w){return G[w]}));var N=M.map(function(w){return w.name}),m=(function(w,T){var x=od(w).map(function(H){return id(H,T)});return T.reduce(function(H,Q){var J=Q.name,le=od(w,J).map(function(Re){return id(Re,T)}),ne=le[0],ue=le[1],ae=le[2];return ne.length&&(H.beforeNS[J]=ne),ue.length&&(H.duringNS[J]=ue),ae.length&&(H.afterNS[J]=ae),H},{before:x[0],beforeNS:{},during:x[1],duringNS:{},after:x[2],afterNS:{}})})(K,M);return Promise.resolve(_o({action:b,data:{exact:m.before,namespaced:m.beforeNS},state:L,allPlugins:G,allMatches:m,instance:A,store:q,EVENTS:j})).then(function(w){function T(){var Q=(function(){if(K.match(it))return Promise.resolve(_o({action:ee({},x,{type:re+"End"}),data:{exact:m.after,namespaced:m.afterNS},state:L,allPlugins:G,allMatches:m,instance:A,store:q,EVENTS:j})).then(function(J){J.meta&&J.meta.hasCallback&&rd(J.meta.rid,{payload:J})})})();return Q&&Q.then?Q.then(function(){return w}):w}if(dh(w,N.length))return w;var x,H=(function(){if(K!==re)return Promise.resolve(_o({action:ee({},w,{type:re}),data:{exact:m.during,namespaced:m.duringNS},state:L,allPlugins:G,allMatches:m,instance:A,store:q,EVENTS:j})).then(function(Q){x=Q});x=w})();return H&&H.then?H.then(T):T()})}catch(w){return Promise.reject(w)}var C,U,F})(o,r,e,a,t)).then(function(b){var y=i(b);return s=1,y})})();return Promise.resolve(g&&g.then?g.then(u):u(g))}catch(b){return Promise.reject(b)}}}}}function ey(e){return function(r){return function(t){return function(n){var a=n.type,i=n.key,o=n.value,s=n.options;if(a===Z.setItem||a===Z.removeItem){if(n.abort)return t(n);a===Z.setItem?e.setItem(i,o,s):e.removeItem(i,s)}return t(n)}}}}var ry=function(){var e=this;this.before=[],this.after=[],this.addMiddleware=function(r,t){e[t]=e[t].concat(r)},this.removeMiddleware=function(r,t){var n=e[t].findIndex(function(a){return a===r});n!==-1&&(e[t]=[].concat(e[t].slice(0,n),e[t].slice(n+1)))},this.dynamicMiddlewares=function(r){return function(t){return function(n){return function(a){var i={getState:t.getState,dispatch:function(s){return t.dispatch(s)}},o=e[r].map(function(s){return s(i)});return lt.apply(void 0,o)(n)(a)}}}}};function ty(e){return function(r,t){r===void 0&&(r={});var n={};if(t.type==="initialize:aborted")return r;if(/^registerPlugin:([^:]*)$/.test(t.type)){var a=cd(t.type,"registerPlugin"),i=e()[a];if(!i||!a)return r;var o=t.enabled,s=i.config;return n[a]={enabled:o,initialized:!!o&&!i.initialize,loaded:!!o&&!!i.loaded({config:s}),config:s},ee({},r,n)}if(/^initialize:([^:]*)$/.test(t.type)){var u=cd(t.type,Z.initialize),c=e()[u];return c&&u?(n[u]=ee({},r[u],{initialized:!0,loaded:!!c.loaded({config:c.config})}),ee({},r,n)):r}if(/^ready:([^:]*)$/.test(t.type))return n[t.name]=ee({},r[t.name],{loaded:!0}),ee({},r,n);switch(t.type){case Z.disablePlugin:return ee({},r,ld(t.plugins,!1,r));case Z.enablePlugin:return ee({},r,ld(t.plugins,!0,r));default:return r}}}function cd(e,r){return e.substring(r.length+1,e.length)}function ld(e,r,t){return e.reduce(function(n,a){return n[a]=ee({},t[a],{enabled:r}),n},t)}function vh(e){try{return JSON.parse(JSON.stringify(e))}catch{}return e}var ny={last:{},history:[]};function ay(e,r){e===void 0&&(e=ny);var t=r.options,n=r.meta;if(r.type===Z.track){var a=vh(ee({event:r.event,properties:r.properties},Object.keys(t).length&&{options:t},{meta:n}));return ee({},e,{last:a,history:e.history.concat(a)})}return e}var iy={actions:[]};function oy(e,r){e===void 0&&(e=iy);var t=r.payload;switch(r.type){case"queue":var n;return n=t&&t.type&&t.type===Z.identify?[r].concat(e.actions):e.actions.concat(r),ee({},e,{actions:n});case"dequeue":return[];default:return e}}var hh=/#.*$/;function sy(e){var r=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(e);return"/"+(r&&r[3]?r[3].split("?")[0].replace(hh,""):"")}var ph,mh,gh,yh,uy=function(e){if(e===void 0&&(e={}),!_e)return e;var r=document,t=r.title,n=r.referrer,a=window,i=a.location,o=a.innerWidth,s=a.innerHeight,u=i.hash,c=i.search,l=(function(v){var d=(function(){if(_e){for(var h,p=document.getElementsByTagName("link"),S=0;h=p[S];S++)if(h.getAttribute("rel")==="canonical")return h.getAttribute("href")}})();return d?d.match(/\?/)?d:d+v:window.location.href.replace(hh,"")})(c),f={title:t,url:l,path:sy(l),hash:u,search:c,width:o,height:s};return n&&n!==""&&(f.referrer=n),ee({},f,e)},cy={last:{},history:[]};function ly(e,r){e===void 0&&(e=cy);var t=r.options;if(r.type===Z.page){var n=vh(ee({properties:r.properties,meta:r.meta},Object.keys(t).length&&{options:t}));return ee({},e,{last:n,history:e.history.concat(n)})}return e}ph=(function(){if(!_e)return!1;var e=navigator.appVersion;return~e.indexOf("Win")?"Windows":~e.indexOf("Mac")?"MacOS":~e.indexOf("X11")?"UNIX":~e.indexOf("Linux")?"Linux":"Unknown OS"})(),mh=_e?document.referrer:null,gh=Mg(),yh=Fg();var fd={initialized:!1,sessionId:Cn(),app:null,version:null,debug:!1,offline:!!_e&&!navigator.onLine,os:{name:ph},userAgent:_e?navigator.userAgent:"node",library:{name:Vo,version:"0.13.1"},timezone:yh,locale:gh,campaign:{},referrer:mh};function fy(e,r){e===void 0&&(e=fd);var t=e.initialized,n=r.campaign;switch(r.type){case Z.campaign:return ee({},e,{campaign:n});case Z.offline:return ee({},e,{offline:!0});case Z.online:return ee({},e,{offline:!1});default:return t?e:ee({},fd,e,{initialized:!0})}}var dy=["plugins","reducers","storage"];function vy(e,r,t){if(_e){var n=window[(t?"add":"remove")+"EventListener"];e.split(" ").forEach(function(a){n(a,r)})}}function hy(e){var r=vy.bind(null,"online offline",function(t){return Promise.resolve(!navigator.onLine).then(e)});return r(!0),function(t){return r(!1)}}function bh(){return Hr(Vo,[]),function(e){return function(r,t,n){var a=e(r,t,n),i=a.dispatch;return Object.assign(a,{dispatch:function(o){return ct[ut][Vo].push(o.action||o),i(o)}})}}}function dd(e){return function(){return lt(lt.apply(null,arguments),bh())}}function qo(e){return e?oh(e)?e:[e]:[]}function vd(e,r,t){e===void 0&&(e={});var n,a,i=Cn();return r&&(At[i]=(n=r,a=(function(o){for(var s,u=o||Array.prototype.slice.call(arguments),c=0;c<u.length;c++)if(Be(u[c])){s=u[c];break}return s})(t),function(o){a&&a(o),n(o)})),ee({},e,{rid:i,ts:new Date().getTime()},r?{hasCallback:!0}:{})}function py(e){e===void 0&&(e={});var r=e.reducers||{},t=e.initialUser||{},n=(e.plugins||[]).reduce(function(w,T){if(Be(T))return w.middlewares=w.middlewares.concat(T),w;if(T.NAMESPACE&&(T.name=T.NAMESPACE),!T.name)throw new Error("https://lytics.dev/errors/1");T.config||(T.config={});var x=T.EVENTS?Object.keys(T.EVENTS).map(function(J){return T.EVENTS[J]}):[];w.pluginEnabled[T.name]=!(T.enabled===!1||T.config.enabled===!1),delete T.enabled,T.methods&&(w.methods[T.name]=Object.keys(T.methods).reduce(function(J,le){var ne;return J[le]=(ne=T.methods[le],function(){for(var ue=Array.prototype.slice.call(arguments),ae=new Array(ne.length),Re=0;Re<ue.length;Re++)ae[Re]=ue[Re];return ae[ae.length]=y,ne.apply({instance:y},ae)}),J},{}),delete T.methods);var H=Object.keys(T).concat(x),Q=new Set(w.events.concat(H));if(w.events=Array.from(Q),w.pluginsArray=w.pluginsArray.concat(T),w.plugins[T.name])throw new Error(T.name+"AlreadyLoaded");return w.plugins[T.name]=T,w.plugins[T.name].loaded||(w.plugins[T.name].loaded=function(){return!0}),w},{plugins:{},pluginEnabled:{},methods:{},pluginsArray:[],middlewares:[],events:[]}),a=e.storage?e.storage:{getItem:Br,setItem:Hr,removeItem:mt},i=(function(w){return function(T,x,H){return x.getState("user")[T]||(H&&Fe(H)&&H[T]?H[T]:ed(w)[T]||Br(Ko(T))||null)}})(a),o=n.plugins,s=n.events.filter(function(w){return!zo.includes(w)}).sort(),u=new Set(s.concat(Xt).filter(function(w){return!zo.includes(w)})),c=Array.from(u).sort(),l=function(){return o},f=new ry,v=f.addMiddleware,d=f.removeMiddleware,h=f.dynamicMiddlewares,p=function(){throw new Error("Abort disabled inListener")},S=Bg(),R=ed(a),I=ee({},R,t,S.an_uid?{userId:S.an_uid}:{},S.an_aid?{anonymousId:S.an_aid}:{});I.anonymousId||(I.anonymousId=Cn());var g=ee({enable:function(w,T){return new Promise(function(x){m.dispatch({type:Z.enablePlugin,plugins:qo(w),_:{originalAction:Z.enablePlugin}},x,[T])})},disable:function(w,T){return new Promise(function(x){m.dispatch({type:Z.disablePlugin,plugins:qo(w),_:{originalAction:Z.disablePlugin}},x,[T])})}},n.methods),b=!1,y={identify:function(w,T,x,H){try{var Q=Tr(w)?w:null,J=Fe(w)?w:T,le=x||{},ne=y.user();Hr(Ko(Ir),Q);var ue=Q||J.userId||i(Ir,y,J);return Promise.resolve(new Promise(function(ae){m.dispatch(ee({type:Z.identifyStart,userId:ue,traits:J||{},options:le,anonymousId:ne.anonymousId},ne.id&&ne.id!==Q&&{previousId:ne.id}),ae,[T,x,H])}))}catch(ae){return Promise.reject(ae)}},track:function(w,T,x,H){try{var Q=Fe(w)?w.event:w;if(!Q||!Tr(Q))throw new Error("EventMissing");var J=Fe(w)?w:T||{},le=Fe(x)?x:{};return Promise.resolve(new Promise(function(ne){m.dispatch({type:Z.trackStart,event:Q,properties:J,options:le,userId:i(Ir,y,T),anonymousId:i(nt,y,T)},ne,[T,x,H])}))}catch(ne){return Promise.reject(ne)}},page:function(w,T,x){try{var H=Fe(w)?w:{},Q=Fe(T)?T:{};return Promise.resolve(new Promise(function(J){m.dispatch({type:Z.pageStart,properties:uy(H),options:Q,userId:i(Ir,y,H),anonymousId:i(nt,y,H)},J,[w,T,x])}))}catch(J){return Promise.reject(J)}},user:function(w){if(w===Ir||w==="id")return i(Ir,y);if(w===nt||w==="anonId")return i(nt,y);var T=y.getState("user");return w?Kf(T,w):T},reset:function(w){return new Promise(function(T){m.dispatch({type:Z.resetStart},T,w)})},ready:function(w){return b&&w({plugins:g,instance:y}),y.on(Z.ready,function(T){w&&w(T),b=!0})},on:function(w,T){if(!w||!Be(T))return!1;if(w===Z.bootstrap)throw new Error(".on disabled for "+w);var x=/Start$|Start:/;if(w==="*"){var H=function(ne){return function(ue){return function(ae){return ae.type.match(x)&&T({payload:ae,instance:y,plugins:o}),ue(ae)}}},Q=function(ne){return function(ue){return function(ae){return ae.type.match(x)||T({payload:ae,instance:y,plugins:o}),ue(ae)}}};return v(H,zt),v(Q,Kt),function(){d(H,zt),d(Q,Kt)}}var J=w.match(x)?zt:Kt,le=function(ne){return function(ue){return function(ae){return ae.type===w&&T({payload:ae,instance:y,plugins:o,abort:p}),ue(ae)}}};return v(le,J),function(){return d(le,J)}},once:function(w,T){if(!w||!Be(T))return!1;if(w===Z.bootstrap)throw new Error(".once disabled for "+w);var x=y.on(w,function(H){T({payload:H.payload,instance:y,plugins:o,abort:p}),x()});return x},getState:function(w){var T=m.getState();return w?Kf(T,w):Object.assign({},T)},dispatch:function(w){var T=Tr(w)?{type:w}:w;if(Xt.includes(T.type))throw new Error("reserved action "+T.type);var x=ee({},T,{_:ee({originalAction:T.type},w._||{})});m.dispatch(x)},enablePlugin:g.enable,disablePlugin:g.disable,plugins:g,storage:{getItem:a.getItem,setItem:function(w,T,x){m.dispatch({type:Z.setItemStart,key:w,value:T,options:x})},removeItem:function(w,T){m.dispatch({type:Z.removeItemStart,key:w,options:T})}},setAnonymousId:function(w,T){y.storage.setItem(Or,w,T)},events:{core:Xt,plugins:s}},A=n.middlewares.concat([function(w){return function(T){return function(x){return x.meta||(x.meta=vd()),T(x)}}},h(zt),Zg(y,l,{all:c,plugins:s}),ey(a),Kg(y),Yg(y),h(Kt)]),q={context:fy,user:Jg(a),page:ly,track:ay,plugins:ty(l),queue:oy},j=lt,G=lt;if(_e&&e.debug){var K=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;K&&(j=K({trace:!0,traceLimit:25})),G=function(){return arguments.length===0?bh():Fe(typeof arguments[0])?dd():dd().apply(null,arguments)}}var re,L=(function(w){return Object.keys(w).reduce(function(T,x){return dy.includes(x)||(T[x]=w[x]),T},{})})(e),M=n.pluginsArray.reduce(function(w,T){var x=T.name,H=T.config,Q=T.loaded,J=n.pluginEnabled[x];return w[x]={enabled:J,initialized:!!J&&!T.initialize,loaded:!!Q({config:H}),config:H},w},{}),N={context:L,user:I,plugins:M},m=ch((function(w){for(var T=Object.keys(w),x={},H=0;H<T.length;H++){var Q=T[H];typeof w[Q]===Pr&&(x[Q]=w[Q])}var J,le=Object.keys(x);try{(function(ne){Object.keys(ne).forEach(function(ue){var ae=ne[ue];if(typeof ae(void 0,{type:Wo})===hr||typeof ae(void 0,{type:Wg})===hr)throw new Error(kt+" "+ue+" "+hr)})})(x)}catch(ne){J=ne}return function(ne,ue){if(ne===void 0&&(ne={}),J)throw J;for(var ae=!1,Re={},xe=0;xe<le.length;xe++){var je=le[xe],$e=ne[je],Qe=(0,x[je])($e,ue);if(typeof Qe===hr){var wr=Vg(je,ue);throw new Error(wr)}Re[je]=Qe,ae=ae||Qe!==$e}return ae?Re:ne}})(ee({},q,r)),N,G(j(zg.apply(void 0,A))));m.dispatch=(re=m.dispatch,function(w,T,x){var H=ee({},w,{meta:vd(w.meta,T,qo(x))});return re.apply(null,[H])});var C=Object.keys(o);m.dispatch({type:Z.bootstrap,plugins:C,config:L,params:S,user:I,initialUser:t,persistedUser:R});var U=C.filter(function(w){return n.pluginEnabled[w]}),F=C.filter(function(w){return!n.pluginEnabled[w]});return m.dispatch({type:Z.registerPlugins,plugins:C,enabled:n.pluginEnabled}),n.pluginsArray.map(function(w,T){var x=w.bootstrap,H=w.config,Q=w.name;x&&Be(x)&&x({instance:y,config:H,payload:w}),m.dispatch({type:Z.registerPluginType(Q),name:Q,enabled:n.pluginEnabled[Q],plugin:w}),n.pluginsArray.length===T+1&&m.dispatch({type:Z.initializeStart,plugins:U,disabled:F})}),hy(function(w){m.dispatch({type:w?Z.offline:Z.online})}),(function(w,T,x){setInterval(function(){return fh(w,T,x)},3e3)})(m,l,y),y}var zt="before",Kt="after",Dr="cookie",Ur=Ih(),wh=_n,my=_n;function Sh(e){return Ur?_n(e,"",-1):mt(e)}function Ih(){if(Ur!==void 0)return Ur;var e=Dr+Dr;try{_n(e,e),Ur=document.cookie.indexOf(e)!==-1,Sh(e)}catch{Ur=!1}return Ur}function _n(e,r,t,n,a,i){if(typeof window<"u"){var o=arguments.length>1;return Ur===!1&&(o?Hr(e,r):Br(e)),o?document.cookie=e+"="+encodeURIComponent(r)+(t?"; expires="+new Date(+new Date+1e3*t).toUTCString()+(n?"; path="+n:"")+(a?"; domain="+a:"")+(i?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}}var pr="localStorage",gy=Os.bind(null,pr);gt(pr,"getItem",Br);gt(pr,"setItem",Hr);gt(pr,"removeItem",mt);var mr="sessionStorage",yy=Os.bind(null,mr);gt(mr,"getItem",Br);gt(mr,"setItem",Hr);gt(mr,"removeItem",mt);function ot(e){var r=e;try{if((r=JSON.parse(e))==="true")return!0;if(r==="false")return!1;if(Fe(r))return r;parseFloat(r)===r&&(r=parseFloat(r))}catch{}if(r!==null&&r!=="")return r}var by=gy(),wy=yy(),Sy=Ih();function Mr(e,r){if(e){var t=Cs(r),n=!qs(t),a=_s(t)?ot(localStorage.getItem(e)):void 0;if(n&&!tt(a))return a;var i=As(t)?ot(wh(e)):void 0;if(n&&i)return i;var o=ks(t)?ot(sessionStorage.getItem(e)):void 0;if(n&&o)return o;var s=Br(e);return n?s:{localStorage:a,sessionStorage:o,cookie:i,global:s}}}function sn(e,r,t){if(e&&!tt(r)){var n={},a=Cs(t),i=JSON.stringify(r),o=!qs(a);return _s(a)&&(n[pr]=Jt(pr,r,ot(localStorage.getItem(e))),localStorage.setItem(e,i),o)?n[pr]:As(a)&&(n[Dr]=Jt(Dr,r,ot(wh(e))),my(e,i),o)?n[Dr]:ks(a)&&(n[mr]=Jt(mr,r,ot(sessionStorage.getItem(e))),sessionStorage.setItem(e,i),o)?n[mr]:(n[Nr]=Jt(Nr,r,Br(e)),Hr(e,r),o?n[Nr]:n)}}function Iy(e,r){if(e){var t=Cs(r),n=Mr(e,nh),a={};return!tt(n.localStorage)&&_s(t)&&(localStorage.removeItem(e),a[pr]=n.localStorage),!tt(n.cookie)&&As(t)&&(Sh(e),a[Dr]=n.cookie),!tt(n.sessionStorage)&&ks(t)&&(sessionStorage.removeItem(e),a[mr]=n.sessionStorage),!tt(n.global)&&An(t,Nr)&&(mt(e),a[Nr]=n.global),a}}function Cs(e){return e?Tr(e)?e:e.storage:th}function _s(e){return by&&An(e,pr)}function As(e){return Sy&&An(e,Dr)}function ks(e){return wy&&An(e,mr)}function qs(e){return e===nh||e==="all"}function An(e,r){return e===th||e===r||qs(e)}function Jt(e,r,t){return{location:e,current:r,previous:t}}var Py={setItem:sn,getItem:Mr,removeItem:Iy};function Ey(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function hd(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),t.push.apply(t,n)}return t}function pd(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?hd(Object(t),!0).forEach(function(n){Ey(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):hd(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function Ry(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r={storage:Py};return py(pd(pd({},r),e))}function Ty(e){if(typeof window>"u")return;const{addEventListener:r,history:t,location:n}=window;let a=n.pathname;r("popstate",()=>e(n.pathname)),["push","replace"].map(i=>{const o=`${i}State`;if(o!=="pushState"&&o!=="replaceState")return;const s=t[o];t[o]=function(...u){const c=u[2]?.toString()||"",l=Cy(c);return a!==l&&(a=l,setTimeout(()=>e(c),0)),s.apply(t,u)}})}function Oy(e,r){const t=e.indexOf(r);return t>-1?e.slice(0,t):e}function Cy(e){return["#","?"].forEach(r=>e=Oy(e,r)),e}function _y(){Ty(()=>{lr.page()})}var $o="up",Uo="down";function Ay(e){if(e===void 0&&(e={}),!_e)return Go;var r=gd(),t=Jo(),n=md(),a=Yt(n,r),i=Yt(t,r),o=[],s=[],u=[],c=n,l=a,f=i,v=Object.keys(e);if(!v.length)return Go;var d=v.map(function(p){return Number(p)}),h=Gg(function(){var p=gd(),S=(function(L,M){return M.map(function(N){return N===100?L-5:L*(N/100)})})(p,d),R=Jo(),I=md(),g=Yt(I,p),b=Yt(R,p);if(l=g>l?g:l,f=b<f?b:f,!(o.length>=d.length)){var y=c===I,A=$o;y?A="initial":c<=I&&(A=Uo);var q=S,j=d;(A===$o||y)&&(q=S.slice().reverse(),j=d.slice().reverse());var G=j.reduce(function(L,M,N){var m=q[N];return u.includes(M)&&I<=m&&(u=u.filter(function(C){return C!==M}),L.singleFunction=M),A===Uo&&!o.includes(M)&&I>=m&&M>i?(s.push(M),L.callbacks=L.callbacks.concat(M),L):A===$o&&!o.includes(M)&&I<=m&&M<=g?(L.foundFunc=[M],L):(y&&I>=m&&L.foundFunc.length===0&&(L.foundFunc=[M]),!s.includes(M)&&I>=m&&(s.push(M),L.singleFunction?u.push(M):L.singleFunction=M),L)},{foundFunc:[],singleFunction:null,callbacks:[],direction:A});if(c=I,A===Uo&&G.callbacks&&G.callbacks.forEach(function(L){Be(e[L])&&(e[L]({trigger:L,direction:A,scrollMin:f,scrollMax:l,range:[f,l]}),o.push(L))}),G.singleFunction){var K=G.singleFunction,re=G.direction;Be(e[K])&&e[K]({trigger:K,direction:re,scrollMin:f,scrollMax:l,range:[f,l]}),o.push(K)}}},500);return window.addEventListener("scroll",h),function(){return window.removeEventListener("scroll",h)}}function Jo(){return _e?document.body.scrollTop||document.documentElement.scrollTop:0}function ky(){return _e?window.innerHeight||document.documentElement.clientHeight:0}function md(){return Math.round(Jo()+ky())}function gd(){if(!_e)return 0;var e=document.body,r=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,r.clientHeight,r.scrollHeight,r.offsetHeight)}function Yt(e,r){return Math.round(e/r*100)}var $s="Event",yd=$s+"Listener";function qy(e){return function(r,t,n,a){var i=n||Go,o=a||!1;if(!_e)return i;var s=un(t),u=un(r,!0);if(!u.length)throw new Error("noElements");if(!s.length)throw new Error("no"+$s);var c=[];return(function l(f){f&&(c=[]);for(var v=f?"add"+yd:"remove"+yd,d=0;d<u.length;d++){var h=u[d];c[d]=f?o&&o.once?$y(i):i:c[d]||i;for(var p=0;p<s.length;p++)h[v]?h["on"+s[p]]=f?c[d]:null:h[v](s[p],c[d],o)}return l.bind(null,!f)})(e)}}function un(e,r){if(Tr(e))return r?un(document.querySelectorAll(e)):(t=e).split(t.indexOf(",")>-1?",":" ").map(function(o){return o.trim()});var t;if(NodeList.prototype.isPrototypeOf(e)){for(var n=[],a=e.length>>>0;a--;)n[a]=e[a];return n}var i=Dg(e);return r?i.map(function(o){return Tr(o)?un(o,!0):o}).flat():i}function $y(e,r){var t;return function(){return e&&(t=e.apply(this,arguments),e=null),t}}var Lo=qy($s);function Ph(e,r){return _e&&Be(window[e])?(t=window[e],n=r,(a=window)===void 0&&(a=null),Be(t)?function(){t.apply(a,arguments),n.apply(a,arguments)}:n):window[e]=r;var t,n,a}Ph.bind(null,"onerror");Ph.bind(null,"onload");var Eh=typeof window>"u",bd="hidden";function Uy(e){if(Eh)return!1;var r=Ly(),t="".concat(r.replace(/[H|h]idden/,""),"visibilitychange"),n=function(){return e(!!document[r])},a=function(){return document.addEventListener(t,n)};return a(),function(){return document.removeEventListener(t,n),a}}function Ly(){var e=["webkit","moz","ms","o"];return Eh||bd in document?bd:e.reduce(function(r,t){var n=t+"Hidden";return!r&&n in document?n:r},null)}var xy=["mousemove","mousedown","touchmove","touchstart","touchend","keydown"];function Ny(e,r){r===void 0&&(r={});var t=(function(o,s){var u=this,c=!1;return function(l){c||(o.call(u,l),c=!0,setTimeout(function(){return c=!1},s))}})(e,r.throttle||1e4),n=[];function a(){var o=Uy(function(s){s||t({type:"tabVisible"})});return n=[o].concat(xy.map(function(s){return Lo(document,s,t)})).concat(Lo(window,"load",t)).concat(Lo(window,"scroll",t,{capture:!0,passive:!0})),i}function i(){n.map(function(o){return o()})}return a(),function(){return i(),a}}function jy(e){var r,t,n=e.onIdle,a=e.onWakeUp,i=e.onHeartbeat,o=e.timeout,s=o,u=e.throttle,c=u===void 0?2e3:u,l=!1,f=!1,v=new Date,d=function(){return clearTimeout(r)};function h(S){d(),i&&!l&&i(Pt(v),S),a&&l&&(l=!1,a(Pt(t),S),v=new Date),r=setTimeout(function(){l=!0,n&&(t=new Date,n(Pt(v),S))},s)}var p=Ny(h,{throttle:c});return{disable:function(){f=!0,l=!1,d();var S=p();return function(){return f=!1,v=new Date,h({type:"load"}),S()}},getStatus:function(){return{isIdle:l,isDisabled:f,active:l?0:Pt(v,f),idle:l?Pt(t,f):0}}}}function Pt(e,r){return r?0:Math.round((new Date-e)/1e3)}const wd=5e3;class Dy{element;isInViewport=!1;isAwake=!1;isFlushing;observer;lastEventAt=Date.now();registeredView=!1;viewCallback;activeDurationCallback;idleDurationCallback;scrollCallback;constructor(r){this.element=r.element,this.viewCallback=r.viewCallback,this.activeDurationCallback=r.activeDurationCallback,this.idleDurationCallback=r.idleDurationCallback,this.scrollCallback=r.scrollCallback,this.observer=new IntersectionObserver(t=>{t.forEach(n=>{this.handleInViewPort(n.isIntersecting)})},{threshold:0}),this.observer.observe(this.element),jy({onIdle:t=>this.handleAwake(!1,t),onWakeUp:t=>this.handleAwake(!0,t),timeout:wd}),Ay({25:this.handleScroll.bind(this),50:this.handleScroll.bind(this),75:this.handleScroll.bind(this),90:this.handleScroll.bind(this),100:this.handleScroll.bind(this)})}flush(){this.isFlushing=!0,this.handleAwake(!this.isAwake)}handleInViewPort(r){r?(this.isAwake=!0,this.trackInViewport()):this.handleAwake(!1),this.isInViewport=r}handleAwake(r,t=Math.round((Date.now()-this.lastEventAt)/1e3)){this.isAwake=r,this.lastEventAt=r?Date.now()-t*wd:Date.now(),this.isInViewport&&this.trackAwake(r,t)}handleScroll(r){this.scrollCallback&&this.scrollCallback(r)}handleVisibilityChange(){this.isAwake=!1;const r=Math.round((Date.now()-this.lastEventAt)/1e3);r>1&&(this.lastEventAt=Date.now(),this.trackAwake(!1,r))}trackAwake(r,t){!r&&this.activeDurationCallback&&this.activeDurationCallback(t,this.isFlushing,this.lastEventAt),r&&this.idleDurationCallback&&this.idleDurationCallback(t,this.isFlushing,this.lastEventAt)}trackInViewport(){this.registeredView||(this.registeredView=!0,this.viewCallback&&this.viewCallback())}}function Rh(e){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):e()}function My(e,r){r=r||{};var t,n,a=[],i=r.max||1/0;function o(){clearInterval(t),e(a.splice(0,i)),s()}function s(){t=setInterval(o,r.interval||1e4)}return s(),{flush:o,push:function(u){return n=a.push(u),n>=i&&o(),n},size:function(){return a.length},end:function(u){u&&o(),clearInterval(t)}}}const Sd="sesamy_session_id";function Fy(){let e=sessionStorage.getItem(Sd);return e||(e=Math.random().toString(36).slice(2,9),sessionStorage.setItem(Sd,e)),e}let Th=!1,Zt,cn,Yo;function Oh(e){return JSON.stringify(e.map(r=>{const{campaign:t,...n}=r.properties||{};return{anonymousId:r.anonymousId,userId:r.userId,type:r.type,properties:n,clientId:Yo,requestId:Math.random().toString(36).slice(2,9),sessionId:Fy(),timestamp:new Date().toISOString(),version:Ft,event:r.event,context:{...r.context,page:{url:window.location.href,title:document.title,referrer:document.referrer,itemSrc:ge("sesamy:item-src"),publisherContentId:ge("sesamy:publisher-content-id")},campaign:t,locale:navigator.language,library:Es,userAgent:navigator.userAgent,clientId:Yo}}}))}const Ch=My(async e=>{if(e.length>0){const r=Oh(e);Th?navigator.sendBeacon(cn,r):(await fetch(cn,{method:"POST",body:r,headers:{"Content-Type":"text/plain"}})).ok}},{max:10,interval:3e3});function xo(e){if(e.anonymousId)if(e.properties?.flushing){const r={...e};delete r.properties.flushing,navigator.sendBeacon(cn,Oh([r]))}else Ch.push(e)}function By(){return Th=!0,Ch.flush()}function Hy(e,r,t){Zt=r,cn=`${ir("logs",t)}/events`,Yo=e}const Gy={name:"custom-analytics-plugin",page:({payload:e})=>{if(!Zt)return;const{properties:r,anonymousId:t,userId:n,event:a}=e;xo({anonymousId:t,userId:n,properties:r,event:a,type:"page"})},track:({payload:e})=>{if(!Zt)return;const{properties:r,anonymousId:t,userId:n,event:a}=e;xo({anonymousId:t,userId:n,properties:r,event:a,type:"track"})},identify:({payload:e})=>{if(!Zt)return;const{properties:r,anonymousId:t,userId:n}=e;xo({anonymousId:t,userId:n,properties:r,type:"identify"})}},Id=["source","medium","campaign","term","content"],Er="utm_",Wy=1800*1e3;function _h(e){return e?Date.now()-parseInt(e,10)>Wy:!0}function Pd(){const e=document.referrer||"";if(!e)return;const r=Mr(`${Er}set_at`);(_h(r)||!Mr(`${Er}referrer`))&&sn(`${Er}referrer`,e)}function Vy(){const e=()=>{const t={};for(const a of Id){const i=Mr(`${Er}${a}`);i&&(t[`utm_${a}`]=i)}const n=Mr(`${Er}referrer`);return n&&(t.utm_referrer=n),t};return{name:"attribution-tracking",initialize(){Pd()},campaign({payload:t}){const n=t?.campaign||{},a=Mr(`${Er}set_at`);if(Object.keys(n).length>0&&_h(a)){for(const o of Id){const s=n[o];s&&sn(`${Er}${o}`,s)}sn(`${Er}set_at`,String(Date.now()))}Pd()},page({payload:t}){return t.properties.campaign=e(),t},track({payload:t}){return t.properties.campaign=e(),t},getStoredCampaignData:e}}const zy=Vy(),Ed=new Map,Rd=new Map;function Ky({clientId:e,enabled:r=!0,environment:t}){Hy(e,r,t),r&&(window.addEventListener("beforeunload",()=>{Rd.forEach((n,a)=>{n.bind(a)()}),By()}),window.addEventListener("visibilitychange",()=>{document.visibilityState!=="visible"&&Ed.forEach((n,a)=>{n.bind(a)()})}),_y(),Rh(()=>{const n=new Dy({element:document.body,viewCallback:()=>{lr.page()},activeDurationCallback:(a,i,o)=>{lr.track("activeDuration",{duration:a,durationStart:o,flushing:i})},idleDurationCallback:(a,i,o)=>{lr.track("idleDuration",{duration:a,durationStart:o,flushing:i})},scrollCallback:a=>{lr.track("scroll",{scroll:a.scrollMax})}});Rd.set(document.body,()=>{n.flush()}),Ed.set(document.body,()=>{n.handleVisibilityChange()})}),window.addEventListener(er.AUTHENTICATED,async n=>{const a=n;await lr.identify(a.detail.sub)}),window.addEventListener(er.LOGOUT,async()=>{await lr.track("logout",{}),await lr.reset()}))}const lr=Ry({app:Es,version:Ft,plugins:[zy,Gy]});function Ah(e,r){lr.track(e,r)}const Jy=["AdHeader","AdContainer","AD_Top","homead","ad-lead"];function kh(){return new Promise(e=>{const r=Jy.map(t=>{const n=document.createElement("div");return n.innerHTML=" ",n.id=t,n.style.position="absolute",document.body.appendChild(n),n});window.setTimeout(()=>{const t=!r.every(n=>document.querySelector(`#${n.id}`)?.offsetParent);r.forEach(n=>n.remove()),e(t)},100)})}function qh(){const e=navigator.userAgent.toLowerCase(),r=[{name:"Facebook",regex:/fbav|fban/i},{name:"LinkedIn",regex:/linkedin/i},{name:"Instagram",regex:/instagram/i},{name:"Gmail",regex:/gmail/i},{name:"Twitter",regex:/twitter/i},{name:"WeChat",regex:/micromessenger/i},{name:"Line",regex:/line/i},{name:"Snapchat",regex:/snapchat/i},{name:"Pinterest",regex:/pinterest/i},{name:"Kakao",regex:/kakaotalk/i},{name:"Skype",regex:/skype/i},{name:"WhatsApp",regex:/whatsapp/i}];for(const t of r)if(t.regex.test(e))return{isInAppBrowser:!0,browserName:t.name};return/; wv\)/.test(e)?{isInAppBrowser:!0,browserName:"Unknown In-App Browser"}:{isInAppBrowser:!1,browserName:null}}/*!
|
|
4
4
|
*
|
|
5
5
|
* detectIncognito v1.6.2
|
package/dist/sesamy-js.iife.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var sesamyJs=(function($e){"use strict";var js=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ds={},$n,Ms;function Re(){return Ms||(Ms=1,$n=function(e){try{return!!e()}catch{return!0}}),$n}var Un,Fs;function Vt(){if(Fs)return Un;Fs=1;var e=Re();return Un=!e(function(){var r=(function(){}).bind();return typeof r!="function"||r.hasOwnProperty("prototype")}),Un}var Ln,Bs;function pe(){if(Bs)return Ln;Bs=1;var e=Vt(),r=Function.prototype,t=r.call,n=e&&r.bind.bind(t,t);return Ln=e?n:function(a){return function(){return t.apply(a,arguments)}},Ln}var Nn,Hs;function zt(){if(Hs)return Nn;Hs=1;var e=pe(),r=e({}.toString),t=e("".slice);return Nn=function(n){return t(r(n),8,-1)},Nn}var xn,Gs;function Ws(){if(Gs)return xn;Gs=1;var e=pe(),r=Re(),t=zt(),n=Object,a=e("".split);return xn=r(function(){return!n("z").propertyIsEnumerable(0)})?function(i){return t(i)==="String"?a(i,""):n(i)}:n,xn}var jn,Vs;function Kt(){return Vs||(Vs=1,jn=function(e){return e==null}),jn}var Dn,zs;function Jt(){if(zs)return Dn;zs=1;var e=Kt(),r=TypeError;return Dn=function(t){if(e(t))throw new r("Can't call method on "+t);return t},Dn}var Mn,Ks;function bt(){if(Ks)return Mn;Ks=1;var e=Ws(),r=Jt();return Mn=function(t){return e(r(t))},Mn}var wt,Js;function me(){if(Js)return wt;Js=1;var e=function(r){return r&&r.Math===Math&&r};return wt=e(typeof globalThis=="object"&&globalThis)||e(typeof window=="object"&&window)||e(typeof self=="object"&&self)||e(typeof js=="object"&&js)||e(typeof wt=="object"&&wt)||(function(){return this})()||Function("return this")(),wt}var Fn={exports:{}},Bn,Ys;function ar(){return Ys||(Ys=1,Bn=!1),Bn}var Hn,Qs;function Gn(){if(Qs)return Hn;Qs=1;var e=me(),r=Object.defineProperty;return Hn=function(t,n){try{r(e,t,{value:n,configurable:!0,writable:!0})}catch{e[t]=n}return n},Hn}var Xs;function Wn(){if(Xs)return Fn.exports;Xs=1;var e=ar(),r=me(),t=Gn(),n="__core-js_shared__",a=Fn.exports=r[n]||t(n,{});return(a.versions||(a.versions=[])).push({version:"3.46.0",mode:e?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru), 2025 CoreJS Company (core-js.io)",license:"https://github.com/zloirock/core-js/blob/v3.46.0/LICENSE",source:"https://github.com/zloirock/core-js"}),Fn.exports}var Vn,Zs;function eu(){if(Zs)return Vn;Zs=1;var e=Wn();return Vn=function(r,t){return e[r]||(e[r]=t||{})},Vn}var zn,ru;function Yt(){if(ru)return zn;ru=1;var e=Jt(),r=Object;return zn=function(t){return r(e(t))},zn}var Kn,tu;function We(){if(tu)return Kn;tu=1;var e=pe(),r=Yt(),t=e({}.hasOwnProperty);return Kn=Object.hasOwn||function(a,i){return t(r(a),i)},Kn}var Jn,nu;function au(){if(nu)return Jn;nu=1;var e=pe(),r=0,t=Math.random(),n=e(1.1.toString);return Jn=function(a){return"Symbol("+(a===void 0?"":a)+")_"+n(++r+t,36)},Jn}var Yn,iu;function St(){if(iu)return Yn;iu=1;var e=me(),r=e.navigator,t=r&&r.userAgent;return Yn=t?String(t):"",Yn}var Qn,ou;function su(){if(ou)return Qn;ou=1;var e=me(),r=St(),t=e.process,n=e.Deno,a=t&&t.versions||n&&n.version,i=a&&a.v8,o,s;return i&&(o=i.split("."),s=o[0]>0&&o[0]<4?1:+(o[0]+o[1])),!s&&r&&(o=r.match(/Edge\/(\d+)/),(!o||o[1]>=74)&&(o=r.match(/Chrome\/(\d+)/),o&&(s=+o[1]))),Qn=s,Qn}var Xn,uu;function cu(){if(uu)return Xn;uu=1;var e=su(),r=Re(),t=me(),n=t.String;return Xn=!!Object.getOwnPropertySymbols&&!r(function(){var a=Symbol("symbol detection");return!n(a)||!(Object(a)instanceof Symbol)||!Symbol.sham&&e&&e<41}),Xn}var Zn,lu;function fu(){if(lu)return Zn;lu=1;var e=cu();return Zn=e&&!Symbol.sham&&typeof Symbol.iterator=="symbol",Zn}var ea,du;function Te(){if(du)return ea;du=1;var e=me(),r=eu(),t=We(),n=au(),a=cu(),i=fu(),o=e.Symbol,s=r("wks"),u=i?o.for||o:o&&o.withoutSetter||n;return ea=function(c){return t(s,c)||(s[c]=a&&t(o,c)?o[c]:u("Symbol."+c)),s[c]},ea}var ra,vu;function ye(){if(vu)return ra;vu=1;var e=typeof document=="object"&&document.all;return ra=typeof e>"u"&&e!==void 0?function(r){return typeof r=="function"||r===e}:function(r){return typeof r=="function"},ra}var ta,hu;function Ve(){if(hu)return ta;hu=1;var e=ye();return ta=function(r){return typeof r=="object"?r!==null:e(r)},ta}var na,pu;function Xe(){if(pu)return na;pu=1;var e=Ve(),r=String,t=TypeError;return na=function(n){if(e(n))return n;throw new t(r(n)+" is not an object")},na}var aa={},ia,mu;function Oe(){if(mu)return ia;mu=1;var e=Re();return ia=!e(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),ia}var oa,gu;function yu(){if(gu)return oa;gu=1;var e=Oe(),r=Re();return oa=e&&r(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),oa}var sa={},ua,bu;function Qt(){if(bu)return ua;bu=1;var e=me(),r=Ve(),t=e.document,n=r(t)&&r(t.createElement);return ua=function(a){return n?t.createElement(a):{}},ua}var ca,wu;function Su(){if(wu)return ca;wu=1;var e=Oe(),r=Re(),t=Qt();return ca=!e&&!r(function(){return Object.defineProperty(t("div"),"a",{get:function(){return 7}}).a!==7}),ca}var la,Iu;function Ue(){if(Iu)return la;Iu=1;var e=Vt(),r=Function.prototype.call;return la=e?r.bind(r):function(){return r.apply(r,arguments)},la}var fa,Pu;function ze(){if(Pu)return fa;Pu=1;var e=me(),r=ye(),t=function(n){return r(n)?n:void 0};return fa=function(n,a){return arguments.length<2?t(e[n]):e[n]&&e[n][a]},fa}var da,Eu;function Xt(){if(Eu)return da;Eu=1;var e=pe();return da=e({}.isPrototypeOf),da}var va,Ru;function Tu(){if(Ru)return va;Ru=1;var e=ze(),r=ye(),t=Xt(),n=fu(),a=Object;return va=n?function(i){return typeof i=="symbol"}:function(i){var o=e("Symbol");return r(o)&&t(o.prototype,a(i))},va}var ha,Ou;function Zt(){if(Ou)return ha;Ou=1;var e=String;return ha=function(r){try{return e(r)}catch{return"Object"}},ha}var pa,Cu;function Ze(){if(Cu)return pa;Cu=1;var e=ye(),r=Zt(),t=TypeError;return pa=function(n){if(e(n))return n;throw new t(r(n)+" is not a function")},pa}var ma,_u;function ga(){if(_u)return ma;_u=1;var e=Ze(),r=Kt();return ma=function(t,n){var a=t[n];return r(a)?void 0:e(a)},ma}var ya,Au;function Hh(){if(Au)return ya;Au=1;var e=Ue(),r=ye(),t=Ve(),n=TypeError;return ya=function(a,i){var o,s;if(i==="string"&&r(o=a.toString)&&!t(s=e(o,a))||r(o=a.valueOf)&&!t(s=e(o,a))||i!=="string"&&r(o=a.toString)&&!t(s=e(o,a)))return s;throw new n("Can't convert object to primitive value")},ya}var ba,ku;function Gh(){if(ku)return ba;ku=1;var e=Ue(),r=Ve(),t=Tu(),n=ga(),a=Hh(),i=Te(),o=TypeError,s=i("toPrimitive");return ba=function(u,c){if(!r(u)||t(u))return u;var l=n(u,s),f;if(l){if(c===void 0&&(c="default"),f=e(l,u,c),!r(f)||t(f))return f;throw new o("Can't convert object to primitive value")}return c===void 0&&(c="number"),a(u,c)},ba}var wa,qu;function $u(){if(qu)return wa;qu=1;var e=Gh(),r=Tu();return wa=function(t){var n=e(t,"string");return r(n)?n:n+""},wa}var Uu;function cr(){if(Uu)return sa;Uu=1;var e=Oe(),r=Su(),t=yu(),n=Xe(),a=$u(),i=TypeError,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,u="enumerable",c="configurable",l="writable";return sa.f=e?t?function(v,d,h){if(n(v),d=a(d),n(h),typeof v=="function"&&d==="prototype"&&"value"in h&&l in h&&!h[l]){var p=s(v,d);p&&p[l]&&(v[d]=h.value,h={configurable:c in h?h[c]:p[c],enumerable:u in h?h[u]:p[u],writable:!1})}return o(v,d,h)}:o:function(v,d,h){if(n(v),d=a(d),n(h),r)try{return o(v,d,h)}catch{}if("get"in h||"set"in h)throw new i("Accessors not supported");return"value"in h&&(v[d]=h.value),v},sa}var Sa,Lu;function Wh(){if(Lu)return Sa;Lu=1;var e=Math.ceil,r=Math.floor;return Sa=Math.trunc||function(n){var a=+n;return(a>0?r:e)(a)},Sa}var Ia,Nu;function Pa(){if(Nu)return Ia;Nu=1;var e=Wh();return Ia=function(r){var t=+r;return t!==t||t===0?0:e(t)},Ia}var Ea,xu;function ju(){if(xu)return Ea;xu=1;var e=Pa(),r=Math.max,t=Math.min;return Ea=function(n,a){var i=e(n);return i<0?r(i+a,0):t(i,a)},Ea}var Ra,Du;function Vh(){if(Du)return Ra;Du=1;var e=Pa(),r=Math.min;return Ra=function(t){var n=e(t);return n>0?r(n,9007199254740991):0},Ra}var Ta,Mu;function Oa(){if(Mu)return Ta;Mu=1;var e=Vh();return Ta=function(r){return e(r.length)},Ta}var Ca,Fu;function zh(){if(Fu)return Ca;Fu=1;var e=bt(),r=ju(),t=Oa(),n=function(a){return function(i,o,s){var u=e(i),c=t(u);if(c===0)return!a&&-1;var l=r(s,c),f;if(a&&o!==o){for(;c>l;)if(f=u[l++],f!==f)return!0}else for(;c>l;l++)if((a||l in u)&&u[l]===o)return a||l||0;return!a&&-1}};return Ca={includes:n(!0),indexOf:n(!1)},Ca}var _a,Bu;function Aa(){return Bu||(Bu=1,_a={}),_a}var ka,Hu;function Gu(){if(Hu)return ka;Hu=1;var e=pe(),r=We(),t=bt(),n=zh().indexOf,a=Aa(),i=e([].push);return ka=function(o,s){var u=t(o),c=0,l=[],f;for(f in u)!r(a,f)&&r(u,f)&&i(l,f);for(;s.length>c;)r(u,f=s[c++])&&(~n(l,f)||i(l,f));return l},ka}var qa,Wu;function $a(){return Wu||(Wu=1,qa=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]),qa}var Ua,Vu;function zu(){if(Vu)return Ua;Vu=1;var e=Gu(),r=$a();return Ua=Object.keys||function(n){return e(n,r)},Ua}var Ku;function Kh(){if(Ku)return aa;Ku=1;var e=Oe(),r=yu(),t=cr(),n=Xe(),a=bt(),i=zu();return aa.f=e&&!r?Object.defineProperties:function(s,u){n(s);for(var c=a(u),l=i(u),f=l.length,v=0,d;f>v;)t.f(s,d=l[v++],c[d]);return s},aa}var La,Ju;function Yu(){if(Ju)return La;Ju=1;var e=ze();return La=e("document","documentElement"),La}var Na,Qu;function xa(){if(Qu)return Na;Qu=1;var e=eu(),r=au(),t=e("keys");return Na=function(n){return t[n]||(t[n]=r(n))},Na}var ja,Xu;function It(){if(Xu)return ja;Xu=1;var e=Xe(),r=Kh(),t=$a(),n=Aa(),a=Yu(),i=Qt(),o=xa(),s=">",u="<",c="prototype",l="script",f=o("IE_PROTO"),v=function(){},d=function(I){return u+l+s+I+u+"/"+l+s},h=function(I){I.write(d("")),I.close();var g=I.parentWindow.Object;return I=null,g},p=function(){var I=i("iframe"),g="java"+l+":",b;return I.style.display="none",a.appendChild(I),I.src=String(g),b=I.contentWindow.document,b.open(),b.write(d("document.F=Object")),b.close(),b.F},S,R=function(){try{S=new ActiveXObject("htmlfile")}catch{}R=typeof document<"u"?document.domain&&S?h(S):p():h(S);for(var I=t.length;I--;)delete R[c][t[I]];return R()};return n[f]=!0,ja=Object.create||function(g,b){var y;return g!==null?(v[c]=e(g),y=new v,v[c]=null,y[f]=g):y=R(),b===void 0?y:r.f(y,b)},ja}var Da,Zu;function Jh(){if(Zu)return Da;Zu=1;var e=Te(),r=It(),t=cr().f,n=e("unscopables"),a=Array.prototype;return a[n]===void 0&&t(a,n,{configurable:!0,value:r(null)}),Da=function(i){a[n][i]=!0},Da}var Ma,ec;function Pt(){return ec||(ec=1,Ma={}),Ma}var Fa,rc;function Yh(){if(rc)return Fa;rc=1;var e=me(),r=ye(),t=e.WeakMap;return Fa=r(t)&&/native code/.test(String(t)),Fa}var Ba,tc;function Ar(){return tc||(tc=1,Ba=function(e,r){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:r}}),Ba}var Ha,nc;function kr(){if(nc)return Ha;nc=1;var e=Oe(),r=cr(),t=Ar();return Ha=e?function(n,a,i){return r.f(n,a,t(1,i))}:function(n,a,i){return n[a]=i,n},Ha}var Ga,ac;function Kr(){if(ac)return Ga;ac=1;var e=Yh(),r=me(),t=Ve(),n=kr(),a=We(),i=Wn(),o=xa(),s=Aa(),u="Object already initialized",c=r.TypeError,l=r.WeakMap,f,v,d,h=function(I){return d(I)?v(I):f(I,{})},p=function(I){return function(g){var b;if(!t(g)||(b=v(g)).type!==I)throw new c("Incompatible receiver, "+I+" required");return b}};if(e||i.state){var S=i.state||(i.state=new l);S.get=S.get,S.has=S.has,S.set=S.set,f=function(I,g){if(S.has(I))throw new c(u);return g.facade=I,S.set(I,g),g},v=function(I){return S.get(I)||{}},d=function(I){return S.has(I)}}else{var R=o("state");s[R]=!0,f=function(I,g){if(a(I,R))throw new c(u);return g.facade=I,n(I,R,g),g},v=function(I){return a(I,R)?I[R]:{}},d=function(I){return a(I,R)}}return Ga={set:f,get:v,has:d,enforce:h,getterFor:p},Ga}var Wa={},Va={},ic;function oc(){if(ic)return Va;ic=1;var e={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,t=r&&!e.call({1:2},1);return Va.f=t?function(a){var i=r(this,a);return!!i&&i.enumerable}:e,Va}var sc;function uc(){if(sc)return Wa;sc=1;var e=Oe(),r=Ue(),t=oc(),n=Ar(),a=bt(),i=$u(),o=We(),s=Su(),u=Object.getOwnPropertyDescriptor;return Wa.f=e?u:function(l,f){if(l=a(l),f=i(f),s)try{return u(l,f)}catch{}if(o(l,f))return n(!r(t.f,l,f),l[f])},Wa}var za={exports:{}},Ka,cc;function lc(){if(cc)return Ka;cc=1;var e=Oe(),r=We(),t=Function.prototype,n=e&&Object.getOwnPropertyDescriptor,a=r(t,"name"),i=a&&(function(){}).name==="something",o=a&&(!e||e&&n(t,"name").configurable);return Ka={EXISTS:a,PROPER:i,CONFIGURABLE:o},Ka}var Ja,fc;function Ya(){if(fc)return Ja;fc=1;var e=pe(),r=ye(),t=Wn(),n=e(Function.toString);return r(t.inspectSource)||(t.inspectSource=function(a){return n(a)}),Ja=t.inspectSource,Ja}var dc;function vc(){if(dc)return za.exports;dc=1;var e=pe(),r=Re(),t=ye(),n=We(),a=Oe(),i=lc().CONFIGURABLE,o=Ya(),s=Kr(),u=s.enforce,c=s.get,l=String,f=Object.defineProperty,v=e("".slice),d=e("".replace),h=e([].join),p=a&&!r(function(){return f(function(){},"length",{value:8}).length!==8}),S=String(String).split("String"),R=za.exports=function(I,g,b){v(l(g),0,7)==="Symbol("&&(g="["+d(l(g),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),b&&b.getter&&(g="get "+g),b&&b.setter&&(g="set "+g),(!n(I,"name")||i&&I.name!==g)&&(a?f(I,"name",{value:g,configurable:!0}):I.name=g),p&&b&&n(b,"arity")&&I.length!==b.arity&&f(I,"length",{value:b.arity});try{b&&n(b,"constructor")&&b.constructor?a&&f(I,"prototype",{writable:!1}):I.prototype&&(I.prototype=void 0)}catch{}var y=u(I);return n(y,"source")||(y.source=h(S,typeof g=="string"?g:"")),I};return Function.prototype.toString=R(function(){return t(this)&&c(this).source||o(this)},"toString"),za.exports}var Qa,hc;function Ke(){if(hc)return Qa;hc=1;var e=ye(),r=cr(),t=vc(),n=Gn();return Qa=function(a,i,o,s){s||(s={});var u=s.enumerable,c=s.name!==void 0?s.name:i;if(e(o)&&t(o,c,s),s.global)u?a[i]=o:n(i,o);else{try{s.unsafe?a[i]&&(u=!0):delete a[i]}catch{}u?a[i]=o:r.f(a,i,{value:o,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return a},Qa}var Xa={},pc;function Qh(){if(pc)return Xa;pc=1;var e=Gu(),r=$a(),t=r.concat("length","prototype");return Xa.f=Object.getOwnPropertyNames||function(a){return e(a,t)},Xa}var Za={},mc;function gc(){return mc||(mc=1,Za.f=Object.getOwnPropertySymbols),Za}var ei,yc;function Xh(){if(yc)return ei;yc=1;var e=ze(),r=pe(),t=Qh(),n=gc(),a=Xe(),i=r([].concat);return ei=e("Reflect","ownKeys")||function(s){var u=t.f(a(s)),c=n.f;return c?i(u,c(s)):u},ei}var ri,bc;function wc(){if(bc)return ri;bc=1;var e=We(),r=Xh(),t=uc(),n=cr();return ri=function(a,i,o){for(var s=r(i),u=n.f,c=t.f,l=0;l<s.length;l++){var f=s[l];!e(a,f)&&!(o&&e(o,f))&&u(a,f,c(i,f))}},ri}var ti,Sc;function Ic(){if(Sc)return ti;Sc=1;var e=Re(),r=ye(),t=/#|\.prototype\./,n=function(u,c){var l=i[a(u)];return l===s?!0:l===o?!1:r(c)?e(c):!!c},a=n.normalize=function(u){return String(u).replace(t,".").toLowerCase()},i=n.data={},o=n.NATIVE="N",s=n.POLYFILL="P";return ti=n,ti}var ni,Pc;function Ie(){if(Pc)return ni;Pc=1;var e=me(),r=uc().f,t=kr(),n=Ke(),a=Gn(),i=wc(),o=Ic();return ni=function(s,u){var c=s.target,l=s.global,f=s.stat,v,d,h,p,S,R;if(l?d=e:f?d=e[c]||a(c,{}):d=e[c]&&e[c].prototype,d)for(h in u){if(S=u[h],s.dontCallGetSet?(R=r(d,h),p=R&&R.value):p=d[h],v=o(l?h:c+(f?".":"#")+h,s.forced),!v&&p!==void 0){if(typeof S==typeof p)continue;i(S,p)}(s.sham||p&&p.sham)&&t(S,"sham",!0),n(d,h,S,s)}},ni}var ai,Ec;function Zh(){if(Ec)return ai;Ec=1;var e=Re();return ai=!e(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype}),ai}var ii,Rc;function oi(){if(Rc)return ii;Rc=1;var e=We(),r=ye(),t=Yt(),n=xa(),a=Zh(),i=n("IE_PROTO"),o=Object,s=o.prototype;return ii=a?o.getPrototypeOf:function(u){var c=t(u);if(e(c,i))return c[i];var l=c.constructor;return r(l)&&c instanceof l?l.prototype:c instanceof o?s:null},ii}var si,Tc;function Oc(){if(Tc)return si;Tc=1;var e=Re(),r=ye(),t=Ve(),n=It(),a=oi(),i=Ke(),o=Te(),s=ar(),u=o("iterator"),c=!1,l,f,v;[].keys&&(v=[].keys(),"next"in v?(f=a(a(v)),f!==Object.prototype&&(l=f)):c=!0);var d=!t(l)||e(function(){var h={};return l[u].call(h)!==h});return d?l={}:s&&(l=n(l)),r(l[u])||i(l,u,function(){return this}),si={IteratorPrototype:l,BUGGY_SAFARI_ITERATORS:c},si}var ui,Cc;function Jr(){if(Cc)return ui;Cc=1;var e=cr().f,r=We(),t=Te(),n=t("toStringTag");return ui=function(a,i,o){a&&!o&&(a=a.prototype),a&&!r(a,n)&&e(a,n,{configurable:!0,value:i})},ui}var ci,_c;function Ac(){if(_c)return ci;_c=1;var e=Oc().IteratorPrototype,r=It(),t=Ar(),n=Jr(),a=Pt(),i=function(){return this};return ci=function(o,s,u,c){var l=s+" Iterator";return o.prototype=r(e,{next:t(+!c,u)}),n(o,l,!1,!0),a[l]=i,o},ci}var li,kc;function ep(){if(kc)return li;kc=1;var e=pe(),r=Ze();return li=function(t,n,a){try{return e(r(Object.getOwnPropertyDescriptor(t,n)[a]))}catch{}},li}var fi,qc;function rp(){if(qc)return fi;qc=1;var e=Ve();return fi=function(r){return e(r)||r===null},fi}var di,$c;function tp(){if($c)return di;$c=1;var e=rp(),r=String,t=TypeError;return di=function(n){if(e(n))return n;throw new t("Can't set "+r(n)+" as a prototype")},di}var vi,Uc;function hi(){if(Uc)return vi;Uc=1;var e=ep(),r=Ve(),t=Jt(),n=tp();return vi=Object.setPrototypeOf||("__proto__"in{}?(function(){var a=!1,i={},o;try{o=e(Object.prototype,"__proto__","set"),o(i,[]),a=i instanceof Array}catch{}return function(u,c){return t(u),n(c),r(u)&&(a?o(u,c):u.__proto__=c),u}})():void 0),vi}var pi,Lc;function Nc(){if(Lc)return pi;Lc=1;var e=Ie(),r=Ue(),t=ar(),n=lc(),a=ye(),i=Ac(),o=oi(),s=hi(),u=Jr(),c=kr(),l=Ke(),f=Te(),v=Pt(),d=Oc(),h=n.PROPER,p=n.CONFIGURABLE,S=d.IteratorPrototype,R=d.BUGGY_SAFARI_ITERATORS,I=f("iterator"),g="keys",b="values",y="entries",A=function(){return this};return pi=function(q,j,G,K,re,L,M){i(G,j,K);var x=function(J){if(J===re&&w)return w;if(!R&&J&&J in U)return U[J];switch(J){case g:return function(){return new G(this,J)};case b:return function(){return new G(this,J)};case y:return function(){return new G(this,J)}}return function(){return new G(this)}},m=j+" Iterator",C=!1,U=q.prototype,F=U[I]||U["@@iterator"]||re&&U[re],w=!R&&F||x(re),T=j==="Array"&&U.entries||F,N,H,Q;if(T&&(N=o(T.call(new q)),N!==Object.prototype&&N.next&&(!t&&o(N)!==S&&(s?s(N,S):a(N[I])||l(N,I,A)),u(N,m,!0,!0),t&&(v[m]=A))),h&&re===b&&F&&F.name!==b&&(!t&&p?c(U,"name",b):(C=!0,w=function(){return r(F,this)})),re)if(H={values:x(b),keys:L?w:x(g),entries:x(y)},M)for(Q in H)(R||C||!(Q in U))&&l(U,Q,H[Q]);else e({target:j,proto:!0,forced:R||C},H);return(!t||M)&&U[I]!==w&&l(U,I,w,{name:re}),v[j]=w,H},pi}var mi,xc;function gi(){return xc||(xc=1,mi=function(e,r){return{value:e,done:r}}),mi}var yi,jc;function bi(){if(jc)return yi;jc=1;var e=bt(),r=Jh(),t=Pt(),n=Kr(),a=cr().f,i=Nc(),o=gi(),s=ar(),u=Oe(),c="Array Iterator",l=n.set,f=n.getterFor(c);yi=i(Array,"Array",function(d,h){l(this,{type:c,target:e(d),index:0,kind:h})},function(){var d=f(this),h=d.target,p=d.index++;if(!h||p>=h.length)return d.target=null,o(void 0,!0);switch(d.kind){case"keys":return o(p,!1);case"values":return o(h[p],!1)}return o([p,h[p]],!1)},"values");var v=t.Arguments=t.Array;if(r("keys"),r("values"),r("entries"),!s&&u&&v.name!=="values")try{a(v,"name",{value:"values"})}catch{}return yi}var Dc={},Mc;function np(){if(Mc)return Dc;Mc=1;var e=Ie(),r=pe(),t=ju(),n=RangeError,a=String.fromCharCode,i=String.fromCodePoint,o=r([].join),s=!!i&&i.length!==1;return e({target:"String",stat:!0,arity:1,forced:s},{fromCodePoint:function(c){for(var l=[],f=arguments.length,v=0,d;f>v;){if(d=+arguments[v++],t(d,1114111)!==d)throw new n(d+" is not a valid code point");l[v]=d<65536?a(d):a(((d-=65536)>>10)+55296,d%1024+56320)}return o(l,"")}}),Dc}var wi,Fc;function Bc(){if(Fc)return wi;Fc=1;var e=me(),r=Oe(),t=Object.getOwnPropertyDescriptor;return wi=function(n){if(!r)return e[n];var a=t(e,n);return a&&a.value},wi}var Si,Hc;function en(){if(Hc)return Si;Hc=1;var e=Re(),r=Te(),t=Oe(),n=ar(),a=r("iterator");return Si=!e(function(){var i=new URL("b?a=1&b=2&c=3","https://a"),o=i.searchParams,s=new URLSearchParams("a=1&a=2&b=3"),u="";return i.pathname="c%20d",o.forEach(function(c,l){o.delete("b"),u+=l+c}),s.delete("a",2),s.delete("b",void 0),n&&(!i.toJSON||!s.has("a",1)||s.has("a",2)||!s.has("a",void 0)||s.has("b"))||!o.size&&(n||!t)||!o.sort||i.href!=="https://a/c%20d?a=1&c=3"||o.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!o[a]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("https://тест").host!=="xn--e1aybc"||new URL("https://a#б").hash!=="#%D0%B1"||u!=="a1c3"||new URL("https://x",void 0).host!=="x"}),Si}var Ii,Gc;function rn(){if(Gc)return Ii;Gc=1;var e=vc(),r=cr();return Ii=function(t,n,a){return a.get&&e(a.get,n,{getter:!0}),a.set&&e(a.set,n,{setter:!0}),r.f(t,n,a)},Ii}var Pi,Wc;function ap(){if(Wc)return Pi;Wc=1;var e=Ke();return Pi=function(r,t,n){for(var a in t)e(r,a,t[a],n);return r},Pi}var Ei,Vc;function Ri(){if(Vc)return Ei;Vc=1;var e=Xt(),r=TypeError;return Ei=function(t,n){if(e(n,t))return t;throw new r("Incorrect invocation")},Ei}var Ti,zc;function ip(){if(zc)return Ti;zc=1;var e=zt(),r=pe();return Ti=function(t){if(e(t)==="Function")return r(t)},Ti}var Oi,Kc;function Yr(){if(Kc)return Oi;Kc=1;var e=ip(),r=Ze(),t=Vt(),n=e(e.bind);return Oi=function(a,i){return r(a),i===void 0?a:t?n(a,i):function(){return a.apply(i,arguments)}},Oi}var Ci,Jc;function _i(){if(Jc)return Ci;Jc=1;var e=Te(),r=e("toStringTag"),t={};return t[r]="z",Ci=String(t)==="[object z]",Ci}var Ai,Yc;function Et(){if(Yc)return Ai;Yc=1;var e=_i(),r=ye(),t=zt(),n=Te(),a=n("toStringTag"),i=Object,o=t((function(){return arguments})())==="Arguments",s=function(u,c){try{return u[c]}catch{}};return Ai=e?t:function(u){var c,l,f;return u===void 0?"Undefined":u===null?"Null":typeof(l=s(c=i(u),a))=="string"?l:o?t(c):(f=t(c))==="Object"&&r(c.callee)?"Arguments":f},Ai}var ki,Qc;function lr(){if(Qc)return ki;Qc=1;var e=Et(),r=String;return ki=function(t){if(e(t)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return r(t)},ki}var qi,Xc;function tn(){if(Xc)return qi;Xc=1;var e=Et(),r=ga(),t=Kt(),n=Pt(),a=Te(),i=a("iterator");return qi=function(o){if(!t(o))return r(o,i)||r(o,"@@iterator")||n[e(o)]},qi}var $i,Zc;function Ui(){if(Zc)return $i;Zc=1;var e=Ue(),r=Ze(),t=Xe(),n=Zt(),a=tn(),i=TypeError;return $i=function(o,s){var u=arguments.length<2?a(o):s;if(r(u))return t(e(u,o));throw new i(n(o)+" is not iterable")},$i}var Li,el;function qr(){if(el)return Li;el=1;var e=TypeError;return Li=function(r,t){if(r<t)throw new e("Not enough arguments");return r},Li}var Ni,rl;function nn(){if(rl)return Ni;rl=1;var e=pe();return Ni=e([].slice),Ni}var xi,tl;function op(){if(tl)return xi;tl=1;var e=nn(),r=Math.floor,t=function(n,a){var i=n.length;if(i<8)for(var o=1,s,u;o<i;){for(u=o,s=n[o];u&&a(n[u-1],s)>0;)n[u]=n[--u];u!==o++&&(n[u]=s)}else for(var c=r(i/2),l=t(e(n,0,c),a),f=t(e(n,c),a),v=l.length,d=f.length,h=0,p=0;h<v||p<d;)n[h+p]=h<v&&p<d?a(l[h],f[p])<=0?l[h++]:f[p++]:h<v?l[h++]:f[p++];return n};return xi=t,xi}var ji,nl;function al(){if(nl)return ji;nl=1,bi(),np();var e=Ie(),r=me(),t=Bc(),n=ze(),a=Ue(),i=pe(),o=Oe(),s=en(),u=Ke(),c=rn(),l=ap(),f=Jr(),v=Ac(),d=Kr(),h=Ri(),p=ye(),S=We(),R=Yr(),I=Et(),g=Xe(),b=Ve(),y=lr(),A=It(),q=Ar(),j=Ui(),G=tn(),K=gi(),re=qr(),L=Te(),M=op(),x=L("iterator"),m="URLSearchParams",C=m+"Iterator",U=d.set,F=d.getterFor(m),w=d.getterFor(C),T=t("fetch"),N=t("Request"),H=t("Headers"),Q=N&&N.prototype,J=H&&H.prototype,le=r.TypeError,ne=r.encodeURIComponent,ue=String.fromCharCode,ae=n("String","fromCodePoint"),_e=parseInt,xe=i("".charAt),Be=i([].join),Le=i([].push),tr=i("".replace),Cr=i([].shift),_r=i([].splice),Hr=i("".split),Gr=i("".slice),Gt=i(/./.exec),vt=/\+/g,Wr="�",be=/^[0-9a-f]+$/i,nr=function(D,V){var z=Gr(D,V,V+2);return Gt(be,z)?_e(z,16):NaN},Vr=function(D){for(var V=0,z=128;z>0&&(D&z)!==0;z>>=1)V++;return V},B=function(D){var V=null;switch(D.length){case 1:V=D[0];break;case 2:V=(D[0]&31)<<6|D[1]&63;break;case 3:V=(D[0]&15)<<12|(D[1]&63)<<6|D[2]&63;break;case 4:V=(D[0]&7)<<18|(D[1]&63)<<12|(D[2]&63)<<6|D[3]&63;break}return V>1114111?null:V},X=function(D){D=tr(D,vt," ");for(var V=D.length,z="",Y=0;Y<V;){var ie=xe(D,Y);if(ie==="%"){if(xe(D,Y+1)==="%"||Y+3>V){z+="%",Y++;continue}var se=nr(D,Y+1);if(se!==se){z+=ie,Y++;continue}Y+=2;var ve=Vr(se);if(ve===0)ie=ue(se);else{if(ve===1||ve>4){z+=Wr,Y++;continue}for(var he=[se],Se=1;Se<ve&&(Y++,!(Y+3>V||xe(D,Y)!=="%"));){var Ne=nr(D,Y+1);if(Ne!==Ne){Y+=3;break}if(Ne>191||Ne<128)break;Le(he,Ne),Y+=2,Se++}if(he.length!==ve){z+=Wr;continue}var sr=B(he);sr===null?z+=Wr:ie=ae(sr)}}z+=ie,Y++}return z},oe=/[!'()~]|%20/g,ce={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},fe=function(D){return ce[D]},Ge=function(D){return tr(ne(D),oe,fe)},Ae=v(function(V,z){U(this,{type:C,target:F(V).entries,index:0,kind:z})},m,function(){var V=w(this),z=V.target,Y=V.index++;if(!z||Y>=z.length)return V.target=null,K(void 0,!0);var ie=z[Y];switch(V.kind){case"keys":return K(ie.key,!1);case"values":return K(ie.value,!1)}return K([ie.key,ie.value],!1)},!0),He=function(D){this.entries=[],this.url=null,D!==void 0&&(b(D)?this.parseObject(D):this.parseQuery(typeof D=="string"?xe(D,0)==="?"?Gr(D,1):D:y(D)))};He.prototype={type:m,bindURL:function(D){this.url=D,this.update()},parseObject:function(D){var V=this.entries,z=G(D),Y,ie,se,ve,he,Se,Ne;if(z)for(Y=j(D,z),ie=Y.next;!(se=a(ie,Y)).done;){if(ve=j(g(se.value)),he=ve.next,(Se=a(he,ve)).done||(Ne=a(he,ve)).done||!a(he,ve).done)throw new le("Expected sequence with length 2");Le(V,{key:y(Se.value),value:y(Ne.value)})}else for(var sr in D)S(D,sr)&&Le(V,{key:sr,value:y(D[sr])})},parseQuery:function(D){if(D)for(var V=this.entries,z=Hr(D,"&"),Y=0,ie,se;Y<z.length;)ie=z[Y++],ie.length&&(se=Hr(ie,"="),Le(V,{key:X(Cr(se)),value:X(Be(se,"="))}))},serialize:function(){for(var D=this.entries,V=[],z=0,Y;z<D.length;)Y=D[z++],Le(V,Ge(Y.key)+"="+Ge(Y.value));return Be(V,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var ke=function(){h(this,Je);var V=arguments.length>0?arguments[0]:void 0,z=U(this,new He(V));o||(this.size=z.entries.length)},Je=ke.prototype;if(l(Je,{append:function(V,z){var Y=F(this);re(arguments.length,2),Le(Y.entries,{key:y(V),value:y(z)}),o||this.length++,Y.updateURL()},delete:function(D){for(var V=F(this),z=re(arguments.length,1),Y=V.entries,ie=y(D),se=z<2?void 0:arguments[1],ve=se===void 0?se:y(se),he=0;he<Y.length;){var Se=Y[he];if(Se.key===ie&&(ve===void 0||Se.value===ve)){if(_r(Y,he,1),ve!==void 0)break}else he++}o||(this.size=Y.length),V.updateURL()},get:function(V){var z=F(this).entries;re(arguments.length,1);for(var Y=y(V),ie=0;ie<z.length;ie++)if(z[ie].key===Y)return z[ie].value;return null},getAll:function(V){var z=F(this).entries;re(arguments.length,1);for(var Y=y(V),ie=[],se=0;se<z.length;se++)z[se].key===Y&&Le(ie,z[se].value);return ie},has:function(V){for(var z=F(this).entries,Y=re(arguments.length,1),ie=y(V),se=Y<2?void 0:arguments[1],ve=se===void 0?se:y(se),he=0;he<z.length;){var Se=z[he++];if(Se.key===ie&&(ve===void 0||Se.value===ve))return!0}return!1},set:function(V,z){var Y=F(this);re(arguments.length,1);for(var ie=Y.entries,se=!1,ve=y(V),he=y(z),Se=0,Ne;Se<ie.length;Se++)Ne=ie[Se],Ne.key===ve&&(se?_r(ie,Se--,1):(se=!0,Ne.value=he));se||Le(ie,{key:ve,value:he}),o||(this.size=ie.length),Y.updateURL()},sort:function(){var V=F(this);M(V.entries,function(z,Y){return z.key>Y.key?1:-1}),V.updateURL()},forEach:function(V){for(var z=F(this).entries,Y=R(V,arguments.length>1?arguments[1]:void 0),ie=0,se;ie<z.length;)se=z[ie++],Y(se.value,se.key,this)},keys:function(){return new Ae(this,"keys")},values:function(){return new Ae(this,"values")},entries:function(){return new Ae(this,"entries")}},{enumerable:!0}),u(Je,x,Je.entries,{name:"entries"}),u(Je,"toString",function(){return F(this).serialize()},{enumerable:!0}),o&&c(Je,"size",{get:function(){return F(this).entries.length},configurable:!0,enumerable:!0}),f(ke,m),e({global:!0,constructor:!0,forced:!s},{URLSearchParams:ke}),!s&&p(H)){var ht=i(J.has),Wt=i(J.set),pt=function(D){if(b(D)){var V=D.body,z;if(I(V)===m)return z=D.headers?new H(D.headers):new H,ht(z,"content-type")||Wt(z,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),A(D,{body:q(0,y(V)),headers:q(0,z)})}return D};if(p(T)&&e({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(V){return T(V,arguments.length>1?pt(arguments[1]):{})}}),p(N)){var mt=function(V){return h(this,Q),new N(V,arguments.length>1?pt(arguments[1]):{})};Q.constructor=mt,mt.prototype=Q,e({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:mt})}}return ji={URLSearchParams:ke,getState:F},ji}var il;function sp(){return il||(il=1,al()),Ds}var ol={},sl;function up(){if(sl)return ol;sl=1;var e=Ke(),r=pe(),t=lr(),n=qr(),a=URLSearchParams,i=a.prototype,o=r(i.append),s=r(i.delete),u=r(i.forEach),c=r([].push),l=new a("a=1&a=2&b=3");return l.delete("a",1),l.delete("b",void 0),l+""!="a=2"&&e(i,"delete",function(f){var v=arguments.length,d=v<2?void 0:arguments[1];if(v&&d===void 0)return s(this,f);var h=[];u(this,function(A,q){c(h,{key:q,value:A})}),n(v,1);for(var p=t(f),S=t(d),R=0,I=0,g=!1,b=h.length,y;R<b;)y=h[R++],g||y.key===p?(g=!0,s(this,y.key)):I++;for(;I<b;)y=h[I++],y.key===p&&y.value===S||o(this,y.key,y.value)},{enumerable:!0,unsafe:!0}),ol}var ul={},cl;function cp(){if(cl)return ul;cl=1;var e=Ke(),r=pe(),t=lr(),n=qr(),a=URLSearchParams,i=a.prototype,o=r(i.getAll),s=r(i.has),u=new a("a=1");return(u.has("a",2)||!u.has("a",void 0))&&e(i,"has",function(l){var f=arguments.length,v=f<2?void 0:arguments[1];if(f&&v===void 0)return s(this,l);var d=o(this,l);n(f,1);for(var h=t(v),p=0;p<d.length;)if(d[p++]===h)return!0;return!1},{enumerable:!0,unsafe:!0}),ul}var ll={},fl;function lp(){if(fl)return ll;fl=1;var e=Oe(),r=pe(),t=rn(),n=URLSearchParams.prototype,a=r(n.forEach);return e&&!("size"in n)&&t(n,"size",{get:function(){var o=0;return a(this,function(){o++}),o},configurable:!0,enumerable:!0}),ll}var Di,dl;function an(){if(dl)return Di;dl=1;var e=me();return Di=e,Di}var Mi,vl;function hl(){if(vl)return Mi;vl=1,sp(),up(),cp(),lp();var e=an();return Mi=e.URLSearchParams,Mi}var pl={},ml={},gl={},Fi,yl;function bl(){if(yl)return Fi;yl=1;var e=pe(),r=Pa(),t=lr(),n=Jt(),a=e("".charAt),i=e("".charCodeAt),o=e("".slice),s=function(u){return function(c,l){var f=t(n(c)),v=r(l),d=f.length,h,p;return v<0||v>=d?u?"":void 0:(h=i(f,v),h<55296||h>56319||v+1===d||(p=i(f,v+1))<56320||p>57343?u?a(f,v):h:u?o(f,v,v+2):(h-55296<<10)+(p-56320)+65536)}};return Fi={codeAt:s(!1),charAt:s(!0)},Fi}var wl;function Sl(){if(wl)return gl;wl=1;var e=bl().charAt,r=lr(),t=Kr(),n=Nc(),a=gi(),i="String Iterator",o=t.set,s=t.getterFor(i);return n(String,"String",function(u){o(this,{type:i,string:r(u),index:0})},function(){var c=s(this),l=c.string,f=c.index,v;return f>=l.length?a(void 0,!0):(v=e(l,f),c.index+=v.length,a(v,!1))}),gl}var Bi,Il;function fp(){if(Il)return Bi;Il=1;var e=Oe(),r=pe(),t=Ue(),n=Re(),a=zu(),i=gc(),o=oc(),s=Yt(),u=Ws(),c=Object.assign,l=Object.defineProperty,f=r([].concat);return Bi=!c||n(function(){if(e&&c({b:1},c(l({},"a",{enumerable:!0,get:function(){l(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var v={},d={},h=Symbol("assign detection"),p="abcdefghijklmnopqrst";return v[h]=7,p.split("").forEach(function(S){d[S]=S}),c({},v)[h]!==7||a(c({},d)).join("")!==p})?function(d,h){for(var p=s(d),S=arguments.length,R=1,I=i.f,g=o.f;S>R;)for(var b=u(arguments[R++]),y=I?f(a(b),I(b)):a(b),A=y.length,q=0,j;A>q;)j=y[q++],(!e||t(g,b,j))&&(p[j]=b[j]);return p}:c,Bi}var Hi,Pl;function El(){if(Pl)return Hi;Pl=1;var e=Ue(),r=Xe(),t=ga();return Hi=function(n,a,i){var o,s;r(n);try{if(o=t(n,"return"),!o){if(a==="throw")throw i;return i}o=e(o,n)}catch(u){s=!0,o=u}if(a==="throw")throw i;if(s)throw o;return r(o),i},Hi}var Gi,Rl;function dp(){if(Rl)return Gi;Rl=1;var e=Xe(),r=El();return Gi=function(t,n,a,i){try{return i?n(e(a)[0],a[1]):n(a)}catch(o){r(t,"throw",o)}},Gi}var Wi,Tl;function Ol(){if(Tl)return Wi;Tl=1;var e=Te(),r=Pt(),t=e("iterator"),n=Array.prototype;return Wi=function(a){return a!==void 0&&(r.Array===a||n[t]===a)},Wi}var Vi,Cl;function _l(){if(Cl)return Vi;Cl=1;var e=pe(),r=Re(),t=ye(),n=Et(),a=ze(),i=Ya(),o=function(){},s=a("Reflect","construct"),u=/^\s*(?:class|function)\b/,c=e(u.exec),l=!u.test(o),f=function(h){if(!t(h))return!1;try{return s(o,[],h),!0}catch{return!1}},v=function(h){if(!t(h))return!1;switch(n(h)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return l||!!c(u,i(h))}catch{return!0}};return v.sham=!0,Vi=!s||r(function(){var d;return f(f.call)||!f(Object)||!f(function(){d=!0})||d})?v:f,Vi}var zi,Al;function vp(){if(Al)return zi;Al=1;var e=Oe(),r=cr(),t=Ar();return zi=function(n,a,i){e?r.f(n,a,t(0,i)):n[a]=i},zi}var Ki,kl;function hp(){if(kl)return Ki;kl=1;var e=Yr(),r=Ue(),t=Yt(),n=dp(),a=Ol(),i=_l(),o=Oa(),s=vp(),u=Ui(),c=tn(),l=Array;return Ki=function(v){var d=t(v),h=i(this),p=arguments.length,S=p>1?arguments[1]:void 0,R=S!==void 0;R&&(S=e(S,p>2?arguments[2]:void 0));var I=c(d),g=0,b,y,A,q,j,G;if(I&&!(this===l&&a(I)))for(y=h?new this:[],q=u(d,I),j=q.next;!(A=r(j,q)).done;g++)G=R?n(q,S,[A.value,g],!0):A.value,s(y,g,G);else for(b=o(d),y=h?new this(b):l(b);b>g;g++)G=R?S(d[g],g):d[g],s(y,g,G);return y.length=g,y},Ki}var Ji,ql;function pp(){if(ql)return Ji;ql=1;var e=pe(),r=2147483647,t=36,n=1,a=26,i=38,o=700,s=72,u=128,c="-",l=/[^\0-\u007E]/,f=/[.\u3002\uFF0E\uFF61]/g,v="Overflow: input needs wider integers to process",d=t-n,h=RangeError,p=e(f.exec),S=Math.floor,R=String.fromCharCode,I=e("".charCodeAt),g=e([].join),b=e([].push),y=e("".replace),A=e("".split),q=e("".toLowerCase),j=function(L){for(var M=[],x=0,m=L.length;x<m;){var C=I(L,x++);if(C>=55296&&C<=56319&&x<m){var U=I(L,x++);(U&64512)===56320?b(M,((C&1023)<<10)+(U&1023)+65536):(b(M,C),x--)}else b(M,C)}return M},G=function(L){return L+22+75*(L<26)},K=function(L,M,x){var m=0;for(L=x?S(L/o):L>>1,L+=S(L/M);L>d*a>>1;)L=S(L/d),m+=t;return S(m+(d+1)*L/(L+i))},re=function(L){var M=[];L=j(L);var x=L.length,m=u,C=0,U=s,F,w;for(F=0;F<L.length;F++)w=L[F],w<128&&b(M,R(w));var T=M.length,N=T;for(T&&b(M,c);N<x;){var H=r;for(F=0;F<L.length;F++)w=L[F],w>=m&&w<H&&(H=w);var Q=N+1;if(H-m>S((r-C)/Q))throw new h(v);for(C+=(H-m)*Q,m=H,F=0;F<L.length;F++){if(w=L[F],w<m&&++C>r)throw new h(v);if(w===m){for(var J=C,le=t;;){var ne=le<=U?n:le>=U+a?a:le-U;if(J<ne)break;var ue=J-ne,ae=t-ne;b(M,R(G(ne+ue%ae))),J=S(ue/ae),le+=t}b(M,R(G(J))),U=K(C,Q,N===T),C=0,N++}}C++,m++}return g(M,"")};return Ji=function(L){var M=[],x=A(y(q(L),f,"."),"."),m,C;for(m=0;m<x.length;m++)C=x[m],b(M,p(l,C)?"xn--"+re(C):C);return g(M,".")},Ji}var $l;function mp(){if($l)return ml;$l=1,Sl();var e=Ie(),r=Oe(),t=en(),n=me(),a=Yr(),i=pe(),o=Ke(),s=rn(),u=Ri(),c=We(),l=fp(),f=hp(),v=nn(),d=bl().codeAt,h=pp(),p=lr(),S=Jr(),R=qr(),I=al(),g=Kr(),b=g.set,y=g.getterFor("URL"),A=I.URLSearchParams,q=I.getState,j=n.URL,G=n.TypeError,K=n.parseInt,re=Math.floor,L=Math.pow,M=i("".charAt),x=i(/./.exec),m=i([].join),C=i(1.1.toString),U=i([].pop),F=i([].push),w=i("".replace),T=i([].shift),N=i("".split),H=i("".slice),Q=i("".toLowerCase),J=i([].unshift),le="Invalid authority",ne="Invalid scheme",ue="Invalid host",ae="Invalid port",_e=/[a-z]/i,xe=/[\d+-.a-z]/i,Be=/\d/,Le=/^0x/i,tr=/^[0-7]+$/,Cr=/^\d+$/,_r=/^[\da-f]+$/i,Hr=/[\0\t\n\r #%/:<>?@[\\\]^|]/,Gr=/[\0\t\n\r #/:<>?@[\\\]^|]/,Gt=/^[\u0000-\u0020]+/,vt=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,Wr=/[\t\n\r]/g,be,nr=function(E){var $=N(E,"."),O,P,_,te,W,we,Pe;if($.length&&$[$.length-1]===""&&$.length--,O=$.length,O>4)return E;for(P=[],_=0;_<O;_++){if(te=$[_],te==="")return E;if(W=10,te.length>1&&M(te,0)==="0"&&(W=x(Le,te)?16:8,te=H(te,W===8?1:2)),te==="")we=0;else{if(!x(W===10?Cr:W===8?tr:_r,te))return E;we=K(te,W)}F(P,we)}for(_=0;_<O;_++)if(we=P[_],_===O-1){if(we>=L(256,5-O))return null}else if(we>255)return null;for(Pe=U(P),_=0;_<P.length;_++)Pe+=P[_]*L(256,3-_);return Pe},Vr=function(E){var $=[0,0,0,0,0,0,0,0],O=0,P=null,_=0,te,W,we,Pe,qe,Qe,k,Ee=function(){return M(E,_)};if(Ee()===":"){if(M(E,1)!==":")return;_+=2,O++,P=O}for(;Ee();){if(O===8)return;if(Ee()===":"){if(P!==null)return;_++,O++,P=O;continue}for(te=W=0;W<4&&x(_r,Ee());)te=te*16+K(Ee(),16),_++,W++;if(Ee()==="."){if(W===0||(_-=W,O>6))return;for(we=0;Ee();){if(Pe=null,we>0)if(Ee()==="."&&we<4)_++;else return;if(!x(Be,Ee()))return;for(;x(Be,Ee());){if(qe=K(Ee(),10),Pe===null)Pe=qe;else{if(Pe===0)return;Pe=Pe*10+qe}if(Pe>255)return;_++}$[O]=$[O]*256+Pe,we++,(we===2||we===4)&&O++}if(we!==4)return;break}else if(Ee()===":"){if(_++,!Ee())return}else if(Ee())return;$[O++]=te}if(P!==null)for(Qe=O-P,O=7;O!==0&&Qe>0;)k=$[O],$[O--]=$[P+Qe-1],$[P+--Qe]=k;else if(O!==8)return;return $},B=function(E){for(var $=null,O=1,P=null,_=0,te=0;te<8;te++)E[te]!==0?(_>O&&($=P,O=_),P=null,_=0):(P===null&&(P=te),++_);return _>O?P:$},X=function(E){var $,O,P,_;if(typeof E=="number"){for($=[],O=0;O<4;O++)J($,E%256),E=re(E/256);return m($,".")}if(typeof E=="object"){for($="",P=B(E),O=0;O<8;O++)_&&E[O]===0||(_&&(_=!1),P===O?($+=O?":":"::",_=!0):($+=C(E[O],16),O<7&&($+=":")));return"["+$+"]"}return E},oe={},ce=l({},oe,{" ":1,'"':1,"<":1,">":1,"`":1}),fe=l({},ce,{"#":1,"?":1,"{":1,"}":1}),Ge=l({},fe,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Ae=function(E,$){var O=d(E,0);return O>32&&O<127&&!c($,E)?E:encodeURIComponent(E)},He={ftp:21,file:null,http:80,https:443,ws:80,wss:443},ke=function(E,$){var O;return E.length===2&&x(_e,M(E,0))&&((O=M(E,1))===":"||!$&&O==="|")},Je=function(E){var $;return E.length>1&&ke(H(E,0,2))&&(E.length===2||($=M(E,2))==="/"||$==="\\"||$==="?"||$==="#")},ht=function(E){return E==="."||Q(E)==="%2e"},Wt=function(E){return E=Q(E),E===".."||E==="%2e."||E===".%2e"||E==="%2e%2e"},pt={},mt={},D={},V={},z={},Y={},ie={},se={},ve={},he={},Se={},Ne={},sr={},$s={},Nh={},Us={},gt={},ur={},xh={},zr={},br={},Ls=function(E,$,O){var P=p(E),_,te,W;if($){if(te=this.parse(P),te)throw new G(te);this.searchParams=null}else{if(O!==void 0&&(_=new Ls(O,!0)),te=this.parse(P,null,_),te)throw new G(te);W=q(new A),W.bindURL(this),this.searchParams=W}};Ls.prototype={type:"URL",parse:function(E,$,O){var P=this,_=$||pt,te=0,W="",we=!1,Pe=!1,qe=!1,Qe,k,Ee,wr;for(E=p(E),$||(P.scheme="",P.username="",P.password="",P.host=null,P.port=null,P.path=[],P.query=null,P.fragment=null,P.cannotBeABaseURL=!1,E=w(E,Gt,""),E=w(E,vt,"$1")),E=w(E,Wr,""),Qe=f(E);te<=Qe.length;){switch(k=Qe[te],_){case pt:if(k&&x(_e,k))W+=Q(k),_=mt;else{if($)return ne;_=D;continue}break;case mt:if(k&&(x(xe,k)||k==="+"||k==="-"||k==="."))W+=Q(k);else if(k===":"){if($&&(P.isSpecial()!==c(He,W)||W==="file"&&(P.includesCredentials()||P.port!==null)||P.scheme==="file"&&!P.host))return;if(P.scheme=W,$){P.isSpecial()&&He[P.scheme]===P.port&&(P.port=null);return}W="",P.scheme==="file"?_=$s:P.isSpecial()&&O&&O.scheme===P.scheme?_=V:P.isSpecial()?_=se:Qe[te+1]==="/"?(_=z,te++):(P.cannotBeABaseURL=!0,F(P.path,""),_=xh)}else{if($)return ne;W="",_=D,te=0;continue}break;case D:if(!O||O.cannotBeABaseURL&&k!=="#")return ne;if(O.cannotBeABaseURL&&k==="#"){P.scheme=O.scheme,P.path=v(O.path),P.query=O.query,P.fragment="",P.cannotBeABaseURL=!0,_=br;break}_=O.scheme==="file"?$s:Y;continue;case V:if(k==="/"&&Qe[te+1]==="/")_=ve,te++;else{_=Y;continue}break;case z:if(k==="/"){_=he;break}else{_=ur;continue}case Y:if(P.scheme=O.scheme,k===be)P.username=O.username,P.password=O.password,P.host=O.host,P.port=O.port,P.path=v(O.path),P.query=O.query;else if(k==="/"||k==="\\"&&P.isSpecial())_=ie;else if(k==="?")P.username=O.username,P.password=O.password,P.host=O.host,P.port=O.port,P.path=v(O.path),P.query="",_=zr;else if(k==="#")P.username=O.username,P.password=O.password,P.host=O.host,P.port=O.port,P.path=v(O.path),P.query=O.query,P.fragment="",_=br;else{P.username=O.username,P.password=O.password,P.host=O.host,P.port=O.port,P.path=v(O.path),P.path.length--,_=ur;continue}break;case ie:if(P.isSpecial()&&(k==="/"||k==="\\"))_=ve;else if(k==="/")_=he;else{P.username=O.username,P.password=O.password,P.host=O.host,P.port=O.port,_=ur;continue}break;case se:if(_=ve,k!=="/"||M(W,te+1)!=="/")continue;te++;break;case ve:if(k!=="/"&&k!=="\\"){_=he;continue}break;case he:if(k==="@"){we&&(W="%40"+W),we=!0,Ee=f(W);for(var Ns=0;Ns<Ee.length;Ns++){var Mh=Ee[Ns];if(Mh===":"&&!qe){qe=!0;continue}var Fh=Ae(Mh,Ge);qe?P.password+=Fh:P.username+=Fh}W=""}else if(k===be||k==="/"||k==="?"||k==="#"||k==="\\"&&P.isSpecial()){if(we&&W==="")return le;te-=f(W).length+1,W="",_=Se}else W+=k;break;case Se:case Ne:if($&&P.scheme==="file"){_=Us;continue}else if(k===":"&&!Pe){if(W==="")return ue;if(wr=P.parseHost(W),wr)return wr;if(W="",_=sr,$===Ne)return}else if(k===be||k==="/"||k==="?"||k==="#"||k==="\\"&&P.isSpecial()){if(P.isSpecial()&&W==="")return ue;if($&&W===""&&(P.includesCredentials()||P.port!==null))return;if(wr=P.parseHost(W),wr)return wr;if(W="",_=gt,$)return;continue}else k==="["?Pe=!0:k==="]"&&(Pe=!1),W+=k;break;case sr:if(x(Be,k))W+=k;else if(k===be||k==="/"||k==="?"||k==="#"||k==="\\"&&P.isSpecial()||$){if(W!==""){var xs=K(W,10);if(xs>65535)return ae;P.port=P.isSpecial()&&xs===He[P.scheme]?null:xs,W=""}if($)return;_=gt;continue}else return ae;break;case $s:if(P.scheme="file",k==="/"||k==="\\")_=Nh;else if(O&&O.scheme==="file")switch(k){case be:P.host=O.host,P.path=v(O.path),P.query=O.query;break;case"?":P.host=O.host,P.path=v(O.path),P.query="",_=zr;break;case"#":P.host=O.host,P.path=v(O.path),P.query=O.query,P.fragment="",_=br;break;default:Je(m(v(Qe,te),""))||(P.host=O.host,P.path=v(O.path),P.shortenPath()),_=ur;continue}else{_=ur;continue}break;case Nh:if(k==="/"||k==="\\"){_=Us;break}O&&O.scheme==="file"&&!Je(m(v(Qe,te),""))&&(ke(O.path[0],!0)?F(P.path,O.path[0]):P.host=O.host),_=ur;continue;case Us:if(k===be||k==="/"||k==="\\"||k==="?"||k==="#"){if(!$&&ke(W))_=ur;else if(W===""){if(P.host="",$)return;_=gt}else{if(wr=P.parseHost(W),wr)return wr;if(P.host==="localhost"&&(P.host=""),$)return;W="",_=gt}continue}else W+=k;break;case gt:if(P.isSpecial()){if(_=ur,k!=="/"&&k!=="\\")continue}else if(!$&&k==="?")P.query="",_=zr;else if(!$&&k==="#")P.fragment="",_=br;else if(k!==be&&(_=ur,k!=="/"))continue;break;case ur:if(k===be||k==="/"||k==="\\"&&P.isSpecial()||!$&&(k==="?"||k==="#")){if(Wt(W)?(P.shortenPath(),k!=="/"&&!(k==="\\"&&P.isSpecial())&&F(P.path,"")):ht(W)?k!=="/"&&!(k==="\\"&&P.isSpecial())&&F(P.path,""):(P.scheme==="file"&&!P.path.length&&ke(W)&&(P.host&&(P.host=""),W=M(W,0)+":"),F(P.path,W)),W="",P.scheme==="file"&&(k===be||k==="?"||k==="#"))for(;P.path.length>1&&P.path[0]==="";)T(P.path);k==="?"?(P.query="",_=zr):k==="#"&&(P.fragment="",_=br)}else W+=Ae(k,fe);break;case xh:k==="?"?(P.query="",_=zr):k==="#"?(P.fragment="",_=br):k!==be&&(P.path[0]+=Ae(k,oe));break;case zr:!$&&k==="#"?(P.fragment="",_=br):k!==be&&(k==="'"&&P.isSpecial()?P.query+="%27":k==="#"?P.query+="%23":P.query+=Ae(k,oe));break;case br:k!==be&&(P.fragment+=Ae(k,ce));break}te++}},parseHost:function(E){var $,O,P;if(M(E,0)==="["){if(M(E,E.length-1)!=="]"||($=Vr(H(E,1,-1)),!$))return ue;this.host=$}else if(this.isSpecial()){if(E=h(E),x(Hr,E)||($=nr(E),$===null))return ue;this.host=$}else{if(x(Gr,E))return ue;for($="",O=f(E),P=0;P<O.length;P++)$+=Ae(O[P],oe);this.host=$}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme==="file"},includesCredentials:function(){return this.username!==""||this.password!==""},isSpecial:function(){return c(He,this.scheme)},shortenPath:function(){var E=this.path,$=E.length;$&&(this.scheme!=="file"||$!==1||!ke(E[0],!0))&&E.length--},serialize:function(){var E=this,$=E.scheme,O=E.username,P=E.password,_=E.host,te=E.port,W=E.path,we=E.query,Pe=E.fragment,qe=$+":";return _!==null?(qe+="//",E.includesCredentials()&&(qe+=O+(P?":"+P:"")+"@"),qe+=X(_),te!==null&&(qe+=":"+te)):$==="file"&&(qe+="//"),qe+=E.cannotBeABaseURL?W[0]:W.length?"/"+m(W,"/"):"",we!==null&&(qe+="?"+we),Pe!==null&&(qe+="#"+Pe),qe},setHref:function(E){var $=this.parse(E);if($)throw new G($);this.searchParams.update()},getOrigin:function(){var E=this.scheme,$=this.port;if(E==="blob")try{return new yt(E.path[0]).origin}catch{return"null"}return E==="file"||!this.isSpecial()?"null":E+"://"+X(this.host)+($!==null?":"+$:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(E){this.parse(p(E)+":",pt)},getUsername:function(){return this.username},setUsername:function(E){var $=f(p(E));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var O=0;O<$.length;O++)this.username+=Ae($[O],Ge)}},getPassword:function(){return this.password},setPassword:function(E){var $=f(p(E));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var O=0;O<$.length;O++)this.password+=Ae($[O],Ge)}},getHost:function(){var E=this.host,$=this.port;return E===null?"":$===null?X(E):X(E)+":"+$},setHost:function(E){this.cannotBeABaseURL||this.parse(E,Se)},getHostname:function(){var E=this.host;return E===null?"":X(E)},setHostname:function(E){this.cannotBeABaseURL||this.parse(E,Ne)},getPort:function(){var E=this.port;return E===null?"":p(E)},setPort:function(E){this.cannotHaveUsernamePasswordPort()||(E=p(E),E===""?this.port=null:this.parse(E,sr))},getPathname:function(){var E=this.path;return this.cannotBeABaseURL?E[0]:E.length?"/"+m(E,"/"):""},setPathname:function(E){this.cannotBeABaseURL||(this.path=[],this.parse(E,gt))},getSearch:function(){var E=this.query;return E?"?"+E:""},setSearch:function(E){E=p(E),E===""?this.query=null:(M(E,0)==="?"&&(E=H(E,1)),this.query="",this.parse(E,zr)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var E=this.fragment;return E?"#"+E:""},setHash:function(E){if(E=p(E),E===""){this.fragment=null;return}M(E,0)==="#"&&(E=H(E,1)),this.fragment="",this.parse(E,br)},update:function(){this.query=this.searchParams.serialize()||null}};var yt=function($){var O=u(this,je),P=R(arguments.length,1)>1?arguments[1]:void 0,_=b(O,new Ls($,!1,P));r||(O.href=_.serialize(),O.origin=_.getOrigin(),O.protocol=_.getProtocol(),O.username=_.getUsername(),O.password=_.getPassword(),O.host=_.getHost(),O.hostname=_.getHostname(),O.port=_.getPort(),O.pathname=_.getPathname(),O.search=_.getSearch(),O.searchParams=_.getSearchParams(),O.hash=_.getHash())},je=yt.prototype,Ye=function(E,$){return{get:function(){return y(this)[E]()},set:$&&function(O){return y(this)[$](O)},configurable:!0,enumerable:!0}};if(r&&(s(je,"href",Ye("serialize","setHref")),s(je,"origin",Ye("getOrigin")),s(je,"protocol",Ye("getProtocol","setProtocol")),s(je,"username",Ye("getUsername","setUsername")),s(je,"password",Ye("getPassword","setPassword")),s(je,"host",Ye("getHost","setHost")),s(je,"hostname",Ye("getHostname","setHostname")),s(je,"port",Ye("getPort","setPort")),s(je,"pathname",Ye("getPathname","setPathname")),s(je,"search",Ye("getSearch","setSearch")),s(je,"searchParams",Ye("getSearchParams")),s(je,"hash",Ye("getHash","setHash"))),o(je,"toJSON",function(){return y(this).serialize()},{enumerable:!0}),o(je,"toString",function(){return y(this).serialize()},{enumerable:!0}),j){var jh=j.createObjectURL,Dh=j.revokeObjectURL;jh&&o(yt,"createObjectURL",a(jh,j)),Dh&&o(yt,"revokeObjectURL",a(Dh,j))}return S(yt,"URL"),e({global:!0,constructor:!0,forced:!t,sham:!r},{URL:yt}),ml}var Ul;function gp(){return Ul||(Ul=1,mp()),pl}var Ll={},Nl;function yp(){if(Nl)return Ll;Nl=1;var e=Ie(),r=ze(),t=Re(),n=qr(),a=lr(),i=en(),o=r("URL"),s=i&&t(function(){o.canParse()}),u=t(function(){return o.canParse.length!==1});return e({target:"URL",stat:!0,forced:!s||u},{canParse:function(l){var f=n(arguments.length,1),v=a(l),d=f<2||arguments[1]===void 0?void 0:a(arguments[1]);try{return!!new o(v,d)}catch{return!1}}}),Ll}var xl={},jl;function bp(){if(jl)return xl;jl=1;var e=Ie(),r=ze(),t=qr(),n=lr(),a=en(),i=r("URL");return e({target:"URL",stat:!0,forced:!a},{parse:function(s){var u=t(arguments.length,1),c=n(s),l=u<2||arguments[1]===void 0?void 0:n(arguments[1]);try{return new i(c,l)}catch{return null}}}),xl}var Dl={},Ml;function wp(){if(Ml)return Dl;Ml=1;var e=Ie(),r=Ue();return e({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return r(URL.prototype.toString,this)}}),Dl}var Yi,Fl;function Sp(){if(Fl)return Yi;Fl=1,hl(),gp(),yp(),bp(),wp();var e=an();return Yi=e.URL,Yi}var Qi,Bl;function Ip(){if(Bl)return Qi;Bl=1;var e=Sp();return Qi=e,Qi}var Xi,Hl;function Pp(){if(Hl)return Xi;Hl=1;var e=Ip();return Xi=e,Xi}Pp();var Gl={},Zi,Wl;function Ep(){return Wl||(Wl=1,Zi={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}),Zi}var eo,Vl;function Rp(){if(Vl)return eo;Vl=1;var e=Qt(),r=e("span").classList,t=r&&r.constructor&&r.constructor.prototype;return eo=t===Object.prototype?void 0:t,eo}var zl;function Kl(){if(zl)return Gl;zl=1;var e=me(),r=Ep(),t=Rp(),n=bi(),a=kr(),i=Jr(),o=Te(),s=o("iterator"),u=n.values,c=function(f,v){if(f){if(f[s]!==u)try{a(f,s,u)}catch{f[s]=u}if(i(f,v,!0),r[v]){for(var d in n)if(f[d]!==n[d])try{a(f,d,n[d])}catch{f[d]=n[d]}}}};for(var l in r)c(e[l]&&e[l].prototype,l);return c(t,"DOMTokenList"),Gl}var ro,Jl;function Tp(){if(Jl)return ro;Jl=1;var e=hl();return Kl(),ro=e,ro}var to,Yl;function Op(){if(Yl)return to;Yl=1;var e=Tp();return to=e,to}Op();var Ql={},Xl={},no,Zl;function Cp(){if(Zl)return no;Zl=1;var e=Ve(),r=kr();return no=function(t,n){e(n)&&"cause"in n&&r(t,"cause",n.cause)},no}var ao,ef;function _p(){if(ef)return ao;ef=1;var e=pe(),r=Error,t=e("".replace),n=(function(o){return String(new r(o).stack)})("zxcasd"),a=/\n\s*at [^:]*:[^\n]*/,i=a.test(n);return ao=function(o,s){if(i&&typeof o=="string"&&!r.prepareStackTrace)for(;s--;)o=t(o,a,"");return o},ao}var io,rf;function Ap(){if(rf)return io;rf=1;var e=Re(),r=Ar();return io=!e(function(){var t=new Error("a");return"stack"in t?(Object.defineProperty(t,"stack",r(1,7)),t.stack!==7):!0}),io}var oo,tf;function kp(){if(tf)return oo;tf=1;var e=kr(),r=_p(),t=Ap(),n=Error.captureStackTrace;return oo=function(a,i,o,s){t&&(n?n(a,i):e(a,"stack",r(o,s)))},oo}var so,nf;function Rt(){if(nf)return so;nf=1;var e=Yr(),r=Ue(),t=Xe(),n=Zt(),a=Ol(),i=Oa(),o=Xt(),s=Ui(),u=tn(),c=El(),l=TypeError,f=function(d,h){this.stopped=d,this.result=h},v=f.prototype;return so=function(d,h,p){var S=p&&p.that,R=!!(p&&p.AS_ENTRIES),I=!!(p&&p.IS_RECORD),g=!!(p&&p.IS_ITERATOR),b=!!(p&&p.INTERRUPTED),y=e(h,S),A,q,j,G,K,re,L,M=function(m){return A&&c(A,"normal"),new f(!0,m)},x=function(m){return R?(t(m),b?y(m[0],m[1],M):y(m[0],m[1])):b?y(m,M):y(m)};if(I)A=d.iterator;else if(g)A=d;else{if(q=u(d),!q)throw new l(n(d)+" is not iterable");if(a(q)){for(j=0,G=i(d);G>j;j++)if(K=x(d[j]),K&&o(v,K))return K;return new f(!1)}A=s(d,q)}for(re=I?d.next:A.next;!(L=r(re,A)).done;){try{K=x(L.value)}catch(m){c(A,"throw",m)}if(typeof K=="object"&&K&&o(v,K))return K}return new f(!1)},so}var uo,af;function qp(){if(af)return uo;af=1;var e=lr();return uo=function(r,t){return r===void 0?arguments.length<2?"":t:e(r)},uo}var of;function $p(){if(of)return Xl;of=1;var e=Ie(),r=Xt(),t=oi(),n=hi(),a=wc(),i=It(),o=kr(),s=Ar(),u=Cp(),c=kp(),l=Rt(),f=qp(),v=Te(),d=v("toStringTag"),h=Error,p=[].push,S=function(g,b){var y=r(R,this),A;n?A=n(new h,y?t(this):R):(A=y?this:i(R),o(A,d,"Error")),b!==void 0&&o(A,"message",f(b)),c(A,S,A.stack,1),arguments.length>2&&u(A,arguments[2]);var q=[];return l(g,p,{that:q}),o(A,"errors",q),A};n?n(S,h):a(S,h,{name:!0});var R=S.prototype=i(h.prototype,{constructor:s(1,S),message:s(1,""),name:s(1,"AggregateError")});return e({global:!0,constructor:!0,arity:2},{AggregateError:S}),Xl}var sf;function Up(){return sf||(sf=1,$p()),Ql}var uf={},co,cf;function Lp(){if(cf)return co;cf=1;var e=_i(),r=Et();return co=e?{}.toString:function(){return"[object "+r(this)+"]"},co}var lf;function Np(){if(lf)return uf;lf=1;var e=_i(),r=Ke(),t=Lp();return e||r(Object.prototype,"toString",t,{unsafe:!0}),uf}var ff={},df={},lo,vf;function hf(){if(vf)return lo;vf=1;var e=me(),r=St(),t=zt(),n=function(a){return r.slice(0,a.length)===a};return lo=(function(){return n("Bun/")?"BUN":n("Cloudflare-Workers")?"CLOUDFLARE":n("Deno/")?"DENO":n("Node.js/")?"NODE":e.Bun&&typeof Bun.version=="string"?"BUN":e.Deno&&typeof Deno.version=="object"?"DENO":t(e.process)==="process"?"NODE":e.window&&e.document?"BROWSER":"REST"})(),lo}var fo,pf;function vo(){if(pf)return fo;pf=1;var e=hf();return fo=e==="NODE",fo}var ho,mf;function xp(){if(mf)return ho;mf=1;var e=ze(),r=rn(),t=Te(),n=Oe(),a=t("species");return ho=function(i){var o=e(i);n&&o&&!o[a]&&r(o,a,{configurable:!0,get:function(){return this}})},ho}var po,gf;function jp(){if(gf)return po;gf=1;var e=_l(),r=Zt(),t=TypeError;return po=function(n){if(e(n))return n;throw new t(r(n)+" is not a constructor")},po}var mo,yf;function bf(){if(yf)return mo;yf=1;var e=Xe(),r=jp(),t=Kt(),n=Te(),a=n("species");return mo=function(i,o){var s=e(i).constructor,u;return s===void 0||t(u=e(s)[a])?o:r(u)},mo}var go,wf;function Sf(){if(wf)return go;wf=1;var e=Vt(),r=Function.prototype,t=r.apply,n=r.call;return go=typeof Reflect=="object"&&Reflect.apply||(e?n.bind(t):function(){return n.apply(t,arguments)}),go}var yo,If;function Pf(){if(If)return yo;If=1;var e=St();return yo=/(?:ipad|iphone|ipod).*applewebkit/i.test(e),yo}var bo,Ef;function Rf(){if(Ef)return bo;Ef=1;var e=me(),r=Sf(),t=Yr(),n=ye(),a=We(),i=Re(),o=Yu(),s=nn(),u=Qt(),c=qr(),l=Pf(),f=vo(),v=e.setImmediate,d=e.clearImmediate,h=e.process,p=e.Dispatch,S=e.Function,R=e.MessageChannel,I=e.String,g=0,b={},y="onreadystatechange",A,q,j,G;i(function(){A=e.location});var K=function(x){if(a(b,x)){var m=b[x];delete b[x],m()}},re=function(x){return function(){K(x)}},L=function(x){K(x.data)},M=function(x){e.postMessage(I(x),A.protocol+"//"+A.host)};return(!v||!d)&&(v=function(m){c(arguments.length,1);var C=n(m)?m:S(m),U=s(arguments,1);return b[++g]=function(){r(C,void 0,U)},q(g),g},d=function(m){delete b[m]},f?q=function(x){h.nextTick(re(x))}:p&&p.now?q=function(x){p.now(re(x))}:R&&!l?(j=new R,G=j.port2,j.port1.onmessage=L,q=t(G.postMessage,G)):e.addEventListener&&n(e.postMessage)&&!e.importScripts&&A&&A.protocol!=="file:"&&!i(M)?(q=M,e.addEventListener("message",L,!1)):y in u("script")?q=function(x){o.appendChild(u("script"))[y]=function(){o.removeChild(this),K(x)}}:q=function(x){setTimeout(re(x),0)}),bo={set:v,clear:d},bo}var wo,Tf;function Of(){if(Tf)return wo;Tf=1;var e=function(){this.head=null,this.tail=null};return e.prototype={add:function(r){var t={item:r,next:null},n=this.tail;n?n.next=t:this.head=t,this.tail=t},get:function(){var r=this.head;if(r){var t=this.head=r.next;return t===null&&(this.tail=null),r.item}}},wo=e,wo}var So,Cf;function Dp(){if(Cf)return So;Cf=1;var e=St();return So=/ipad|iphone|ipod/i.test(e)&&typeof Pebble<"u",So}var Io,_f;function Mp(){if(_f)return Io;_f=1;var e=St();return Io=/web0s(?!.*chrome)/i.test(e),Io}var Po,Af;function Fp(){if(Af)return Po;Af=1;var e=me(),r=Bc(),t=Yr(),n=Rf().set,a=Of(),i=Pf(),o=Dp(),s=Mp(),u=vo(),c=e.MutationObserver||e.WebKitMutationObserver,l=e.document,f=e.process,v=e.Promise,d=r("queueMicrotask"),h,p,S,R,I;if(!d){var g=new a,b=function(){var y,A;for(u&&(y=f.domain)&&y.exit();A=g.get();)try{A()}catch(q){throw g.head&&h(),q}y&&y.enter()};!i&&!u&&!s&&c&&l?(p=!0,S=l.createTextNode(""),new c(b).observe(S,{characterData:!0}),h=function(){S.data=p=!p}):!o&&v&&v.resolve?(R=v.resolve(void 0),R.constructor=v,I=t(R.then,R),h=function(){I(b)}):u?h=function(){f.nextTick(b)}:(n=t(n,e),h=function(){n(b)}),d=function(y){g.head||h(),g.add(y)}}return Po=d,Po}var Eo,kf;function Bp(){return kf||(kf=1,Eo=function(e,r){try{arguments.length===1?console.error(e):console.error(e,r)}catch{}}),Eo}var Ro,qf;function Qr(){return qf||(qf=1,Ro=function(e){try{return{error:!1,value:e()}}catch(r){return{error:!0,value:r}}}),Ro}var To,$f;function Xr(){if($f)return To;$f=1;var e=me();return To=e.Promise,To}var Oo,Uf;function Tt(){if(Uf)return Oo;Uf=1;var e=me(),r=Xr(),t=ye(),n=Ic(),a=Ya(),i=Te(),o=hf(),s=ar(),u=su(),c=r&&r.prototype,l=i("species"),f=!1,v=t(e.PromiseRejectionEvent),d=n("Promise",function(){var h=a(r),p=h!==String(r);if(!p&&u===66||s&&!(c.catch&&c.finally))return!0;if(!u||u<51||!/native code/.test(h)){var S=new r(function(g){g(1)}),R=function(g){g(function(){},function(){})},I=S.constructor={};if(I[l]=R,f=S.then(function(){})instanceof R,!f)return!0}return!p&&(o==="BROWSER"||o==="DENO")&&!v});return Oo={CONSTRUCTOR:d,REJECTION_EVENT:v,SUBCLASSING:f},Oo}var Co={},Lf;function fr(){if(Lf)return Co;Lf=1;var e=Ze(),r=TypeError,t=function(n){var a,i;this.promise=new n(function(o,s){if(a!==void 0||i!==void 0)throw new r("Bad Promise constructor");a=o,i=s}),this.resolve=e(a),this.reject=e(i)};return Co.f=function(n){return new t(n)},Co}var Nf;function Hp(){if(Nf)return df;Nf=1;var e=Ie(),r=ar(),t=vo(),n=me(),a=an(),i=Ue(),o=Ke(),s=hi(),u=Jr(),c=xp(),l=Ze(),f=ye(),v=Ve(),d=Ri(),h=bf(),p=Rf().set,S=Fp(),R=Bp(),I=Qr(),g=Of(),b=Kr(),y=Xr(),A=Tt(),q=fr(),j="Promise",G=A.CONSTRUCTOR,K=A.REJECTION_EVENT,re=A.SUBCLASSING,L=b.getterFor(j),M=b.set,x=y&&y.prototype,m=y,C=x,U=n.TypeError,F=n.document,w=n.process,T=q.f,N=T,H=!!(F&&F.createEvent&&n.dispatchEvent),Q="unhandledrejection",J="rejectionhandled",le=0,ne=1,ue=2,ae=1,_e=2,xe,Be,Le,tr,Cr=function(B){var X;return v(B)&&f(X=B.then)?X:!1},_r=function(B,X){var oe=X.value,ce=X.state===ne,fe=ce?B.ok:B.fail,Ge=B.resolve,Ae=B.reject,He=B.domain,ke,Je,ht;try{fe?(ce||(X.rejection===_e&&Wr(X),X.rejection=ae),fe===!0?ke=oe:(He&&He.enter(),ke=fe(oe),He&&(He.exit(),ht=!0)),ke===B.promise?Ae(new U("Promise-chain cycle")):(Je=Cr(ke))?i(Je,ke,Ge,Ae):Ge(ke)):Ae(oe)}catch(Wt){He&&!ht&&He.exit(),Ae(Wt)}},Hr=function(B,X){B.notified||(B.notified=!0,S(function(){for(var oe=B.reactions,ce;ce=oe.get();)_r(ce,B);B.notified=!1,X&&!B.rejection&&Gt(B)}))},Gr=function(B,X,oe){var ce,fe;H?(ce=F.createEvent("Event"),ce.promise=X,ce.reason=oe,ce.initEvent(B,!1,!0),n.dispatchEvent(ce)):ce={promise:X,reason:oe},!K&&(fe=n["on"+B])?fe(ce):B===Q&&R("Unhandled promise rejection",oe)},Gt=function(B){i(p,n,function(){var X=B.facade,oe=B.value,ce=vt(B),fe;if(ce&&(fe=I(function(){t?w.emit("unhandledRejection",oe,X):Gr(Q,X,oe)}),B.rejection=t||vt(B)?_e:ae,fe.error))throw fe.value})},vt=function(B){return B.rejection!==ae&&!B.parent},Wr=function(B){i(p,n,function(){var X=B.facade;t?w.emit("rejectionHandled",X):Gr(J,X,B.value)})},be=function(B,X,oe){return function(ce){B(X,ce,oe)}},nr=function(B,X,oe){B.done||(B.done=!0,oe&&(B=oe),B.value=X,B.state=ue,Hr(B,!0))},Vr=function(B,X,oe){if(!B.done){B.done=!0,oe&&(B=oe);try{if(B.facade===X)throw new U("Promise can't be resolved itself");var ce=Cr(X);ce?S(function(){var fe={done:!1};try{i(ce,X,be(Vr,fe,B),be(nr,fe,B))}catch(Ge){nr(fe,Ge,B)}}):(B.value=X,B.state=ne,Hr(B,!1))}catch(fe){nr({done:!1},fe,B)}}};if(G&&(m=function(X){d(this,C),l(X),i(xe,this);var oe=L(this);try{X(be(Vr,oe),be(nr,oe))}catch(ce){nr(oe,ce)}},C=m.prototype,xe=function(X){M(this,{type:j,done:!1,notified:!1,parent:!1,reactions:new g,rejection:!1,state:le,value:null})},xe.prototype=o(C,"then",function(X,oe){var ce=L(this),fe=T(h(this,m));return ce.parent=!0,fe.ok=f(X)?X:!0,fe.fail=f(oe)&&oe,fe.domain=t?w.domain:void 0,ce.state===le?ce.reactions.add(fe):S(function(){_r(fe,ce)}),fe.promise}),Be=function(){var B=new xe,X=L(B);this.promise=B,this.resolve=be(Vr,X),this.reject=be(nr,X)},q.f=T=function(B){return B===m||B===Le?new Be(B):N(B)},!r&&f(y)&&x!==Object.prototype)){tr=x.then,re||o(x,"then",function(X,oe){var ce=this;return new m(function(fe,Ge){i(tr,ce,fe,Ge)}).then(X,oe)},{unsafe:!0});try{delete x.constructor}catch{}s&&s(x,C)}return e({global:!0,constructor:!0,wrap:!0,forced:G},{Promise:m}),Le=a.Promise,u(m,j,!1,!0),c(j),df}var xf={},_o,jf;function Gp(){if(jf)return _o;jf=1;var e=Te(),r=e("iterator"),t=!1;try{var n=0,a={next:function(){return{done:!!n++}},return:function(){t=!0}};a[r]=function(){return this},Array.from(a,function(){throw 2})}catch{}return _o=function(i,o){try{if(!o&&!t)return!1}catch{return!1}var s=!1;try{var u={};u[r]=function(){return{next:function(){return{done:s=!0}}}},i(u)}catch{}return s},_o}var Ao,Df;function on(){if(Df)return Ao;Df=1;var e=Xr(),r=Gp(),t=Tt().CONSTRUCTOR;return Ao=t||!r(function(n){e.all(n).then(void 0,function(){})}),Ao}var Mf;function Wp(){if(Mf)return xf;Mf=1;var e=Ie(),r=Ue(),t=Ze(),n=fr(),a=Qr(),i=Rt(),o=on();return e({target:"Promise",stat:!0,forced:o},{all:function(u){var c=this,l=n.f(c),f=l.resolve,v=l.reject,d=a(function(){var h=t(c.resolve),p=[],S=0,R=1;i(u,function(I){var g=S++,b=!1;R++,r(h,c,I).then(function(y){b||(b=!0,p[g]=y,--R||f(p))},v)}),--R||f(p)});return d.error&&v(d.value),l.promise}}),xf}var Ff={},Bf;function Vp(){if(Bf)return Ff;Bf=1;var e=Ie(),r=ar(),t=Tt().CONSTRUCTOR,n=Xr(),a=ze(),i=ye(),o=Ke(),s=n&&n.prototype;if(e({target:"Promise",proto:!0,forced:t,real:!0},{catch:function(c){return this.then(void 0,c)}}),!r&&i(n)){var u=a("Promise").prototype.catch;s.catch!==u&&o(s,"catch",u,{unsafe:!0})}return Ff}var Hf={},Gf;function zp(){if(Gf)return Hf;Gf=1;var e=Ie(),r=Ue(),t=Ze(),n=fr(),a=Qr(),i=Rt(),o=on();return e({target:"Promise",stat:!0,forced:o},{race:function(u){var c=this,l=n.f(c),f=l.reject,v=a(function(){var d=t(c.resolve);i(u,function(h){r(d,c,h).then(l.resolve,f)})});return v.error&&f(v.value),l.promise}}),Hf}var Wf={},Vf;function Kp(){if(Vf)return Wf;Vf=1;var e=Ie(),r=fr(),t=Tt().CONSTRUCTOR;return e({target:"Promise",stat:!0,forced:t},{reject:function(a){var i=r.f(this),o=i.reject;return o(a),i.promise}}),Wf}var zf={},ko,Kf;function Jf(){if(Kf)return ko;Kf=1;var e=Xe(),r=Ve(),t=fr();return ko=function(n,a){if(e(n),r(a)&&a.constructor===n)return a;var i=t.f(n),o=i.resolve;return o(a),i.promise},ko}var Yf;function Jp(){if(Yf)return zf;Yf=1;var e=Ie(),r=ze(),t=ar(),n=Xr(),a=Tt().CONSTRUCTOR,i=Jf(),o=r("Promise"),s=t&&!a;return e({target:"Promise",stat:!0,forced:t||a},{resolve:function(c){return i(s&&this===o?n:this,c)}}),zf}var Qf;function Yp(){return Qf||(Qf=1,Hp(),Wp(),Vp(),zp(),Kp(),Jp()),ff}var Xf={},Zf;function Qp(){if(Zf)return Xf;Zf=1;var e=Ie(),r=Ue(),t=Ze(),n=fr(),a=Qr(),i=Rt(),o=on();return e({target:"Promise",stat:!0,forced:o},{allSettled:function(u){var c=this,l=n.f(c),f=l.resolve,v=l.reject,d=a(function(){var h=t(c.resolve),p=[],S=0,R=1;i(u,function(I){var g=S++,b=!1;R++,r(h,c,I).then(function(y){b||(b=!0,p[g]={status:"fulfilled",value:y},--R||f(p))},function(y){b||(b=!0,p[g]={status:"rejected",reason:y},--R||f(p))})}),--R||f(p)});return d.error&&v(d.value),l.promise}}),Xf}var ed={},rd;function Xp(){if(rd)return ed;rd=1;var e=Ie(),r=Ue(),t=Ze(),n=ze(),a=fr(),i=Qr(),o=Rt(),s=on(),u="No one promise resolved";return e({target:"Promise",stat:!0,forced:s},{any:function(l){var f=this,v=n("AggregateError"),d=a.f(f),h=d.resolve,p=d.reject,S=i(function(){var R=t(f.resolve),I=[],g=0,b=1,y=!1;o(l,function(A){var q=g++,j=!1;b++,r(R,f,A).then(function(G){j||y||(y=!0,h(G))},function(G){j||y||(j=!0,I[q]=G,--b||p(new v(I,u)))})}),--b||p(new v(I,u))});return S.error&&p(S.value),d.promise}}),ed}var td={},nd;function ad(){if(nd)return td;nd=1;var e=Ie(),r=me(),t=Sf(),n=nn(),a=fr(),i=Ze(),o=Qr(),s=r.Promise,u=!1,c=!s||!s.try||o(function(){s.try(function(l){u=l===8},8)}).error||!u;return e({target:"Promise",stat:!0,forced:c},{try:function(l){var f=arguments.length>1?n(arguments,1):[],v=a.f(this),d=o(function(){return t(i(l),void 0,f)});return(d.error?v.reject:v.resolve)(d.value),v.promise}}),td}var id={},od;function sd(){if(od)return id;od=1;var e=Ie(),r=fr();return e({target:"Promise",stat:!0},{withResolvers:function(){var n=r.f(this);return{promise:n.promise,resolve:n.resolve,reject:n.reject}}}),id}var ud={},cd;function Zp(){if(cd)return ud;cd=1;var e=Ie(),r=ar(),t=Xr(),n=Re(),a=ze(),i=ye(),o=bf(),s=Jf(),u=Ke(),c=t&&t.prototype,l=!!t&&n(function(){c.finally.call({then:function(){}},function(){})});if(e({target:"Promise",proto:!0,real:!0,forced:l},{finally:function(v){var d=o(this,a("Promise")),h=i(v);return this.then(h?function(p){return s(d,v()).then(function(){return p})}:v,h?function(p){return s(d,v()).then(function(){throw p})}:v)}}),!r&&i(t)){var f=a("Promise").prototype.finally;c.finally!==f&&u(c,"finally",f,{unsafe:!0})}return ud}var qo,ld;function em(){if(ld)return qo;ld=1,Up(),bi(),Np(),Yp(),Qp(),Xp(),ad(),sd(),Zp(),Sl();var e=an();return qo=e.Promise,qo}var $o,fd;function rm(){if(fd)return $o;fd=1;var e=em();return Kl(),$o=e,$o}var dd={},vd;function tm(){return vd||(vd=1,ad()),dd}var hd={},pd;function nm(){return pd||(pd=1,sd()),hd}var Uo,md;function am(){if(md)return Uo;md=1;var e=rm();return tm(),nm(),Uo=e,Uo}am();const gd="sesamy-debug";function im(e,r,t){const n=new Date;n.setTime(n.getTime()+t*60*60*1e3);const a="expires="+n.toUTCString();document.cookie=`${e}=${r}; ${a}; path=/`}function om(e){if(typeof document>"u")return null;const r=e+"=",t=document.cookie.split(";");for(let n=0;n<t.length;n++){let a=t[n];for(;a.charAt(0)===" ";)a=a.substring(1);if(a.indexOf(r)===0)return a.substring(r.length,a.length)}return null}function sm(e){im(gd,e.toString(),1)}function um(){return om(gd)==="true"}function de(e){um()&&console.log(e)}function $r(e,r){if(typeof window>"u")return;const t=new CustomEvent(e,{detail:r,bubbles:!0,composed:!0});de(`Triggering event: ${e}`),dispatchEvent(t)}const cm=Object.freeze(Object.defineProperty({__proto__:null,triggerEvent:$r},Symbol.toStringTag,{value:"Module"}));let yd=null;function Lo(e){yd=e}function bd(){return yd}var er=(e=>(e.AUTH_INITIALIZED="sesamyJsAuthInitialized",e.READY="sesamyJsReady",e.AUTHENTICATED="sesamyJsAuthenticated",e.LOGOUT="sesamyJsLogout",e.CLEAR_CACHE="sesamyJsClearCache",e.USER_ATTRIBUTE_CHANGED="sesamyUserAttributeChanged",e.PURCHASE="sesamyJsPurchase",e))(er||{});const lm=Object.freeze(Object.defineProperty({__proto__:null,Events:er},Symbol.toStringTag,{value:"Module"})),wd="sesamy_is_authenticated";function fm(){try{return document.cookie.split(";").some(e=>e.trim().startsWith(`${wd}=true`))}catch{return!1}}function No(e){try{const r=e?2592e3:0,t=window.location.protocol==="https:"?"; Secure":"";document.cookie=`${wd}=${e}; path=/; max-age=${r}; SameSite=Lax${t}`}catch{}}function Sd(e={}){let r=e.baseUrl??"",t="",n=!1,a=null,i=null;async function o(){try{const u=await fetch(`${r}/auth/userinfo`,{credentials:"include",headers:{Accept:"application/json"}});return u.ok?await u.json():null}catch(u){return de(`[cookie-auth] Failed to fetch userinfo: ${u.message}`),null}}const s={async init(u){if(t=u.vendorId||u.clientId||"",de(`[cookie-auth] Initializing with baseUrl: ${r}`),fm()){const c=await o();c===null?de("[cookie-auth] userinfo fetch failed transiently; retaining session hint"):c.authenticated&&c.sub?(a=!0,i=c,No(!0),$r(er.AUTHENTICATED,{sub:c.sub,appState:void 0})):(a=!1,No(!1))}else a=!1;n=!0,$r(er.AUTH_INITIALIZED,{})},async isAuthenticated(){if(!n)return!1;if(a!==null)return a;const u=await o();return u===null?(de("[cookie-auth] userinfo fetch failed transiently in isAuthenticated; will retry"),!1):(a=u.authenticated,a)},async getTokenSilently(u,c){return null},async getUser(){if(!n)return null;if(i)return i;const u=await o();return u?.authenticated&&u.sub?(i=u,i):null},async login(u){if(!t)throw new Error("[cookie-auth] vendorId is required to build a login URL");const c=u?.returnTo??window.location.href,l=new URL(`${r}/auth/${encodeURIComponent(t)}/login`,window.location.origin);l.searchParams.set("return_to",c),window.location.href=l.toString()},async loginWithRedirect(u){return s.login(u)},async loginWithPopup(u){return de("[cookie-auth] loginWithPopup called — falling back to redirect"),s.login(u)},async logout(u){a=!1,i=null,No(!1),$r(er.LOGOUT,{});const c=u?.returnTo??window.location.href,l=new URL(`${r}/auth/logout`,window.location.origin);l.searchParams.set("return_to",c),u?.localOnly&&l.searchParams.set("local_only","true"),window.location.href=l.toString()}};return s}const dm="sesamyAccessToken";let Ot=!1;function Sr(){const e=bd();if(!e)throw new Error("[sesamy-js] No auth plugin registered. This should not happen.");return e}async function vm(e){if(e.enabled===!1){de("Auth disabled via config"),Ot=!0;return}e.useHttpCookies?(de("useHttpCookies=true — using cookie-based BFF plugin"),Lo(Sd())):bd()||(de("No auth plugin registered — defaulting to cookie-based BFF plugin"),Lo(Sd())),await Sr().init(e),Ot=!0}async function dr(){return Ot?Sr().isAuthenticated():!1}async function vr(e=!0,r=!1){return Ot?Sr().getTokenSilently(e,r):null}async function hm(){return Ot?Sr().getUser():null}async function pm(e){return Sr().login(e)}async function xo(e){return Sr().loginWithRedirect(e)}async function mm(e){return Sr().loginWithPopup(e)}async function gm(e={}){return Sr().logout(e)}async function jo(e){const r=e.split(".");if(r.length!==3)throw new Error("Invalid token");const t=decodeURIComponent(atob(r[1].replace(/-/g,"+").replace(/_/g,"/")).split("").map(o=>"%"+("00"+o.charCodeAt(0).toString(16)).slice(-2)).join("")),n=JSON.parse(t);if(!n?.exp||n.exp<Date.now()/1e3)throw new Error("Invalid token");de("Set token"),localStorage.setItem(dm,e);const{triggerEvent:a}=await Promise.resolve().then(()=>cm),{Events:i}=await Promise.resolve().then(()=>lm);a(i.AUTHENTICATED,{...n,appState:void 0})}const ym=(e,r)=>r.skipDedupe||r.method!=="GET",bm=(e,r)=>r.method+"@"+e,wm=e=>e.clone(),Sm=({skip:e=ym,key:r=bm,resolver:t=wm}={})=>{const n=new Map;return a=>(i,o)=>{if(e(i,o))return a(i,o);const s=r(i,o);if(!n.has(s))n.set(s,[]);else return new Promise((u,c)=>{n.get(s).push([u,c])});try{return a(i,o).then(u=>(n.get(s).forEach(([c])=>c(t(u))),n.delete(s),u)).catch(u=>{throw n.get(s).forEach(([,c])=>c(u)),n.delete(s),u})}catch(u){return n.delete(s),Promise.reject(u)}}},Im=(e,r)=>e*r,Pm=e=>e&&e.ok,Em=({delayTimer:e=500,delayRamp:r=Im,maxAttempts:t=10,until:n=Pm,onRetry:a=null,retryOnNetworkError:i=!1,resolveWithLatestResponse:o=!1,skip:s}={})=>u=>(c,l)=>{let f=0;if(s&&s(c,l))return u(c,l);const v=(d,h)=>Promise.resolve(n(d,h)).then(p=>p?d&&o?d:h?Promise.reject(h):d:(f++,!t||f<=t?new Promise(S=>{const R=r(e,f);setTimeout(()=>{typeof a=="function"?Promise.resolve(a({response:d,error:h,url:c,options:l})).then((I={})=>{var g,b;S(u((g=I&&I.url)!==null&&g!==void 0?g:c,(b=I&&I.options)!==null&&b!==void 0?b:l))}):S(u(c,l))},R)}).then(v).catch(S=>{if(!i)throw S;return v(null,S)}):d&&o?d:Promise.reject(h||new Error("Number of attempts exceeded."))));return u(c,l).then(v).catch(d=>{if(!i)throw d;return v(null,d)})};let Do=class Bh extends Error{status;statusText;url;body;constructor(r,t,n,a,i){super(a),this.name="APIError",this.status=r,this.statusText=t,this.url=n,this.body=i,Error.captureStackTrace&&Error.captureStackTrace(this,Bh)}isClientError(){return this.status>=400&&this.status<500}isServerError(){return this.status>=500}isForbiddenError(){return this.status===403}isNotFoundError(){return this.status===404}};var sn=(e=>(e.BROWSER="browser",e.NORMAL="normal",e))(sn||{});const Rm="application/json",Id="Content-Type",Zr=Symbol(),Pd=Symbol();function Ed(e={}){var r;const t=e instanceof Array?Object.fromEntries(e):e;return(r=Object.entries(t).find(([n])=>n.toLowerCase()===Id.toLowerCase()))===null||r===void 0?void 0:r[1]}function Rd(e){return/^application\/.*json.*/.test(e)}const Ur=function(e,r,t=!1){return Object.entries(r).reduce((n,[a,i])=>{const o=e[a];return Array.isArray(o)&&Array.isArray(i)?n[a]=t?[...o,...i]:i:typeof o=="object"&&typeof i=="object"?n[a]=Ur(o,i,t):n[a]=i,n},{...e})},et={options:{},errorType:"text",polyfills:{},polyfill(e,r=!0,t=!1,...n){const a=this.polyfills[e]||(typeof self<"u"?self[e]:null)||(typeof global<"u"?global[e]:null);if(r&&!a)throw new Error(e+" is not defined");return t&&a?new a(...n):a}};function Tm(e,r=!1){et.options=r?e:Ur(et.options,e)}function Om(e,r=!1){et.polyfills=r?e:Ur(et.polyfills,e)}function Cm(e){et.errorType=e}const _m=e=>r=>e.reduceRight((t,n)=>n(t),r)||r;let Td=class extends Error{};const Am=e=>{const r=Object.create(null);e=e._addons.reduce((g,b)=>b.beforeRequest&&b.beforeRequest(g,e._options,r)||g,e);const{_url:t,_options:n,_config:a,_catchers:i,_resolvers:o,_middlewares:s,_addons:u}=e,c=new Map(i),l=Ur(a.options,n);let f=t;const v=_m(s)((g,b)=>(f=g,a.polyfill("fetch")(g,b)))(t,l),d=new Error,h=v.catch(g=>{throw{[Zr]:g}}).then(g=>{var b;if(!g.ok){const y=new Td;if(y.cause=d,y.stack=y.stack+`
|
|
2
|
-
CAUSE: `+d.stack,y.response=g,y.status=g.status,y.url=f,g.type==="opaque")throw y;const A=a.errorType==="json"||((b=g.headers.get("Content-Type"))===null||b===void 0?void 0:b.split(";")[0])==="application/json";return(a.errorType?A?g.text():g[a.errorType]():Promise.resolve(g.body)).then(q=>{if(y.message=typeof q=="string"?q:g.statusText,q)if(A&&typeof q=="string"){y.text=q;try{y.json=JSON.parse(q)}catch{}}else y[a.errorType]=q;throw y})}return g}),p=g=>g.catch(b=>{const y=Object.prototype.hasOwnProperty.call(b,Zr),A=y?b[Zr]:b,q=A?.status&&c.get(A.status)||c.get(A?.name)||y&&c.has(Zr)&&c.get(Zr);if(q)return q(A,e);const j=c.get(Pd);if(j)return j(A,e);throw A}),S=g=>b=>p(g?h.then(y=>y&&y[g]()).then(y=>b?b(y):y):h.then(y=>b?b(y):y)),R={_wretchReq:e,_fetchReq:v,_sharedState:r,res:S(null),json:S("json"),blob:S("blob"),formData:S("formData"),arrayBuffer:S("arrayBuffer"),text:S("text"),error(g,b){return c.set(g,b),this},badRequest(g){return this.error(400,g)},unauthorized(g){return this.error(401,g)},forbidden(g){return this.error(403,g)},notFound(g){return this.error(404,g)},timeout(g){return this.error(408,g)},internalError(g){return this.error(500,g)},fetchError(g){return this.error(Zr,g)}},I=u.reduce((g,b)=>({...g,...typeof b.resolver=="function"?b.resolver(g):b.resolver}),R);return o.reduce((g,b)=>b(g,e),I)},km={_url:"",_options:{},_config:et,_catchers:new Map,_resolvers:[],_deferred:[],_middlewares:[],_addons:[],addon(e){return{...this,_addons:[...this._addons,e],...e.wretch}},errorType(e){return{...this,_config:{...this._config,errorType:e}}},polyfills(e,r=!1){return{...this,_config:{...this._config,polyfills:r?e:Ur(this._config.polyfills,e)}}},url(e,r=!1){if(r)return{...this,_url:e};const t=this._url.split("?");return{...this,_url:t.length>1?t[0]+e+"?"+t[1]:this._url+e}},options(e,r=!1){return{...this,_options:r?e:Ur(this._options,e)}},headers(e){const r=e?Array.isArray(e)?Object.fromEntries(e):"entries"in e?Object.fromEntries(e.entries()):e:{};return{...this,_options:Ur(this._options,{headers:r})}},accept(e){return this.headers({Accept:e})},content(e){return this.headers({[Id]:e})},auth(e){return this.headers({Authorization:e})},catcher(e,r){const t=new Map(this._catchers);return t.set(e,r),{...this,_catchers:t}},catcherFallback(e){return this.catcher(Pd,e)},resolve(e,r=!1){return{...this,_resolvers:r?[e]:[...this._resolvers,e]}},defer(e,r=!1){return{...this,_deferred:r?[e]:[...this._deferred,e]}},middlewares(e,r=!1){return{...this,_middlewares:r?e:[...this._middlewares,...e]}},fetch(e=this._options.method,r="",t=null){let n=this.url(r).options({method:e});const a=Ed(n._options.headers),i=this._config.polyfill("FormData",!1),o=typeof t=="object"&&!(i&&t instanceof i)&&(!n._options.headers||!a||Rd(a));return n=t?o?n.json(t,a):n.body(t):n,Am(n._deferred.reduce((s,u)=>u(s,s._url,s._options),n))},get(e=""){return this.fetch("GET",e)},delete(e=""){return this.fetch("DELETE",e)},put(e,r=""){return this.fetch("PUT",r,e)},post(e,r=""){return this.fetch("POST",r,e)},patch(e,r=""){return this.fetch("PATCH",r,e)},head(e=""){return this.fetch("HEAD",e)},opts(e=""){return this.fetch("OPTIONS",e)},body(e){return{...this,_options:{...this._options,body:e}}},json(e,r){const t=Ed(this._options.headers);return this.content(r||Rd(t)&&t||Rm).body(JSON.stringify(e))}};function ir(e="",r={}){return{...km,_url:e,_options:r}}ir.default=ir,ir.options=Tm,ir.errorType=Cm,ir.polyfills=Om,ir.WretchError=Td;const qm=(e,r)=>r.skipDedupe||r.method!=="GET",$m=(e,r)=>r.method+"@"+e,Um=e=>e.clone(),Lm=({skip:e=qm,key:r=$m,resolver:t=Um}={})=>{const n=new Map;return a=>(i,o)=>{if(e(i,o))return a(i,o);const s=r(i,o);if(!n.has(s))n.set(s,[]);else return new Promise((u,c)=>{n.get(s).push([u,c])});try{return a(i,o).then(u=>(n.get(s).forEach(([c])=>c(t(u))),n.delete(s),u)).catch(u=>{throw n.get(s).forEach(([,c])=>c(u)),n.delete(s),u})}catch(u){return n.delete(s),Promise.reject(u)}}},Nm=(e,r)=>r.skipCache||r.method!=="GET",xm=(e,r)=>r.method+"@"+e,jm=()=>!1,Dm=()=>null,Mm=e=>e.ok,Fm=({throttle:e=1e3,skip:r=Nm,key:t=xm,clear:n=jm,invalidate:a=Dm,condition:i=Mm,flagResponseOnCacheHit:o="__cached"}={})=>{const s=new Map,u=new Map,c=new Set,l=v=>{e&&!c.has(v)&&(c.add(v),setTimeout(()=>{c.delete(v)},e))},f=v=>(d,h)=>{const p=t(d,h);let S=a(d,h);if(S&&(S instanceof Array||(S=[S]),S.forEach(R=>{typeof R=="string"?s.delete(R):R instanceof RegExp&&s.forEach((I,g)=>{R.test(g)&&s.delete(g)})})),n(d,h)&&s.clear(),r(d,h))return v(d,h);if(c.has(p)){if(s.has(p)){const R=s.get(p).clone();return o&&Object.defineProperty(R,o,{value:p,enumerable:!1}),Promise.resolve(R)}else if(u.has(p))return new Promise((R,I)=>{u.get(p).push([R,I])})}return u.has(p)||u.set(p,[]),l(p),v(d,h).then(R=>(i(R.clone())&&s.set(p,R.clone()),u.get(p).forEach(([I])=>I(R.clone())),u.delete(p),R)).catch(R=>{throw u.get(p).forEach(([,I])=>I(R)),u.delete(p),R})};return f.cacheResponse=function(v,d){l(v),s.set(v,d)},f.cache=s,f.inflight=u,f.throttling=c,f},Bm=(e,r)=>e*r,Hm=e=>e&&e.ok,Gm=({delayTimer:e=500,delayRamp:r=Bm,maxAttempts:t=10,until:n=Hm,onRetry:a=null,retryOnNetworkError:i=!1,resolveWithLatestResponse:o=!1,skip:s}={})=>u=>(c,l)=>{let f=0;if(s&&s(c,l))return u(c,l);const v=(d,h)=>Promise.resolve(n(d,h)).then(p=>p?d&&o?d:h?Promise.reject(h):d:(f++,!t||f<=t?new Promise(S=>{const R=r(e,f);setTimeout(()=>{typeof a=="function"?Promise.resolve(a({response:d,error:h,url:c,options:l})).then((I={})=>{var g,b;S(u((g=I&&I.url)!==null&&g!==void 0?g:c,(b=I&&I.options)!==null&&b!==void 0?b:l))}):S(u(c,l))},R)}).then(v).catch(S=>{if(!i)throw S;return v(null,S)}):d&&o?d:Promise.reject(h||new Error("Number of attempts exceeded."))));return u(c,l).then(v).catch(d=>{if(!i)throw d;return v(null,d)})},Wm="@sesamy/sdk",Vm="1.23.0";let zm=class{cache=new Map;get(r){return this.cache.get(r)||null}set(r,t){this.cache.set(r,t)}remove(r){this.cache.delete(r)}clear(){this.cache.clear()}};const Ct="sesamyCacheTimestamp",Km=e=>{const{libraryName:r=Wm,libraryVersion:t=Vm,cache:n}=e,a=n?.storage||new zm,i=[s=>async(u,c)=>{if(n?.mode===sn.BROWSER){let l;typeof sessionStorage<"u"?(l=sessionStorage.getItem(Ct),l||(l=Date.now().toString(),sessionStorage.setItem(Ct,l))):(l=a.get(Ct),l||(l=Date.now().toString(),a.set(Ct,l)));const f={...c,headers:{...c.headers,"Cache-Timestamp":l}};return s(u,f)}return s(u,c)},s=>async(u,c)=>{const l=await e.tokenProvider();if(l===null)return s(u,c);const f={...c,headers:{...c.headers,Authorization:l}};return s(u,f)},Lm()];n?.mode===sn.NORMAL&&i.push(Fm({throttle:300*1e3,skip:(s,u)=>u.method!=="GET"})),i.push(Gm({delayTimer:1e3,delayRamp:(s,u)=>s*u,maxAttempts:3,until:s=>!!(s&&(s.ok||s.status>=400&&s.status<500)),retryOnNetworkError:!1}));const o=ir(e.baseUrl).headers({"Content-Type":"application/json","X-Sesamy-Client":`${r}/${t}`,...e.headers}).middlewares(i);return{async request(s,u={}){try{const c=/^https?:\/\//.test(s);let l=o.url(s,c);u.headers&&(l=l.headers(u.headers));const f=(u.method||"GET").toLowerCase();let v;switch(f){case"get":v=l.get();break;case"post":v=l.post(u.body);break;case"put":v=l.put(u.body);break;case"patch":v=l.patch(u.body);break;case"delete":v=l.delete();break;default:v=l.get()}const d=await v.res();if(d.ok&&["post","patch","put","delete"].includes(f)&&hr(),d.status===204)return null;if(!d.ok){const h=await d.text().catch(()=>"Unknown error");throw new Do(d.status,d.statusText,d.url,`API Error ${d.status}: ${h}`,h)}return await d.json()}catch(c){if(c instanceof Do)throw c;const l=c.status||500,f=c.message||"Unknown error",v=`${e.baseUrl}${s}`;throw new Do(l,f,v,`API Error ${l}: ${c.message||"Unknown error"}`,c.message||"Unknown error")}}}},hr=()=>(typeof sessionStorage<"u"&&sessionStorage.removeItem(Ct),"Cache cleared"),_t={get:async(e,r)=>e.request(`/profile/${r}`),update:async(e,r,t)=>e.request(`/profile/${r}`,{method:"PATCH",body:JSON.stringify(t)}),checkSpotifyLink:async e=>e.request("/profile/spotify-link"),unlinkSpotify:async e=>e.request("/profile/unlink-spotify",{method:"POST"}),delete:async e=>{await e.request("/profile",{method:"DELETE"})}},Mo={list:async(e,r)=>{const t=new URLSearchParams;r?.type&&t.append("type",r.type),r?.sku&&t.append("sku",r.sku),r?.purchaseOptionId&&t.append("purchase-option-id",r.purchaseOptionId),r?.waitForEntitlementAfter&&t.append("wait-for-entitlement-after",r.waitForEntitlementAfter);const n=t.toString(),a=n?`/entitlements?${n}`:"/entitlements";return e.request(a)},get:async(e,r)=>e.request(`/entitlements/${r}`),getAccess:async(e,r)=>e.request(`/entitlements/${r}/access`)},Od={list:async e=>e.request("/subscriptions"),get:async(e,r)=>e.request(`/subscriptions/${r}`)},Cd={get:async(e,r)=>e.request(`/products/${r}`),autoOnboard:async(e,r)=>e.request(`/products/${r}/auto-onboard`,{method:"POST"})},Jm=(e,r)=>{if(!e||!r)return e;const t=new URL(e);return t.hash=`access_token=${r}`,t.toString()},_d=(e,r)=>!e.manageUrl||!r?e:{...e,manageUrl:Jm(e.manageUrl,r)},At={list:async e=>e.request("/contracts"),get:async(e,r)=>e.request(`/contracts/${r}`),cancel:async(e,r)=>e.request(`/contracts/${r}/cancel`,{method:"POST"}),createAmendment:async(e,r,t)=>e.request(`/contracts/${r}/amendments`,{method:"POST",body:JSON.stringify(t)}),confirmAmendment:async(e,r,t)=>e.request(`/contracts/${r}/amendments/${t}/confirm`,{method:"POST"})},Fo={get:async e=>e.request("/user-metadata"),set:async(e,r,t)=>{await e.request(`/user-metadata/${r}`,{method:"PUT",body:t})},delete:async(e,r)=>{await e.request(`/user-metadata/${r}`,{method:"DELETE"})}},rt={list:async e=>e.request("/tallies"),get:async(e,r)=>e.request(`/tallies/${r}`),update:async(e,r,t)=>e.request(`/tallies/${r}`,{method:"PUT",body:JSON.stringify(t)}),create:async(e,r)=>e.request("/tallies",{method:"POST",body:JSON.stringify(r)}),delete:async(e,r)=>{try{return await e.request(`/tallies/${r}`,{method:"DELETE"}),!0}catch{return!1}},push:async(e,r,t)=>e.request(`/tallies/${r}/push`,{method:"POST",body:JSON.stringify(t)})},Bo={list:async e=>e.request("/tags"),add:async(e,r)=>{await e.request("/tags",{method:"POST",body:JSON.stringify({tag:r})})},remove:async(e,r)=>{await e.request(`/tags/${r}`,{method:"DELETE"})}},tt={generateCheckoutLink:(e,r)=>{const t=new URL(`${e.apiUrl}/checkouts`);return r.items&&t.searchParams.set("items",JSON.stringify(r.items)),r.email&&t.searchParams.set("email",r.email),r.language&&t.searchParams.set("lang",r.language),r.redirectUrl&&t.searchParams.set("redirect-url",r.redirectUrl),r.giftMode&&t.searchParams.set("gift-mode","true"),r.payerEmail&&t.searchParams.set("payer-email",r.payerEmail),r.requireAddress&&t.searchParams.set("require-address","true"),r.metadata&&Object.entries(r.metadata).forEach(([n,a])=>{t.searchParams.set(`metadata.${n}`,a)}),t.toString()},generateAccountLink:(e,r)=>{const t=r.language||"en",n=new URL(`${e.baseUrl}/account/${encodeURIComponent(t)}/subscriptions/${encodeURIComponent(e.clientId)}${r.contractId?`/${encodeURIComponent(r.contractId)}`:""}`);return n.searchParams.set("sesamy-redirect-url",r.redirectUrl||"/"),n.toString()},generateChangePaymentLink:(e,r)=>{const t=r.language||"en",n=new URL(`${e.baseUrl}/account/${encodeURIComponent(t)}/subscriptions/${encodeURIComponent(e.clientId)}/${encodeURIComponent(r.contractId)}/change-payment-method`);return n.searchParams.set("sesamy-redirect-url",r.redirectUrl||"/"),n.toString()},generateChangePlanLink:(e,r)=>{const t=r.language||"en",n=new URL(`${e.baseUrl}/account/${encodeURIComponent(t)}/subscriptions/${encodeURIComponent(e.clientId)}/${encodeURIComponent(r.contractId)}/edit-plan`);return n.searchParams.set("sesamy-redirect-url",r.redirectUrl||"/"),n.toString()},generateConsumeLink:(e,r)=>{const t=r.language||"en";let n=new URL(`${e.baseUrl}/consume/${encodeURIComponent(t)}/@${encodeURIComponent(e.clientId)}/${encodeURIComponent(r.sku)}`);return r.episodeId?n.href+=`/${encodeURIComponent(r.episodeId)}`:n.href+="/listen",n.searchParams.set("sesamy-redirect-url",r.redirectUrl||"/"),n.toString()}},Ho={generateLink:(e,r)=>{const t=new URL(`${e.apiUrl}/checkouts`);return r.items&&t.searchParams.set("items",JSON.stringify(r.items)),r.email&&t.searchParams.set("email",r.email),r.language&&t.searchParams.set("lang",r.language),r.redirectUrl&&t.searchParams.set("redirect-url",r.redirectUrl),r.giftMode&&t.searchParams.set("gift-mode","true"),r.payerEmail&&t.searchParams.set("payer-email",r.payerEmail),r.requireAddress&&t.searchParams.set("require-address","true"),r.metadata&&Object.entries(r.metadata).forEach(([n,a])=>{t.searchParams.set(`metadata.${n}`,a)}),t.toString()},create:async(e,r)=>e.request("/checkouts",{method:"POST",body:JSON.stringify(r)}),get:async(e,r)=>e.request(`/checkouts/${r}`),update:async(e,r,t)=>e.request(`/checkouts/${r}`,{method:"PATCH",body:JSON.stringify(t)})},Ad={list:async e=>e.request("/bills"),get:async(e,r)=>e.request(`/bills/${r}`)},kd={list:async e=>e.request("/fulfillments"),create:async(e,r)=>e.request("/fulfillments",{method:"POST",body:JSON.stringify(r)})},Ym={get:async(e,r)=>{try{return new URL(r),e.request(r)}catch{return e.request(`/paywalls/${r}`)}}},Qm={list:async e=>e.request("/payment-issues")},Xm={content:async(e,r,t,n,a)=>{const i=new URLSearchParams({url:r});return t&&i.append("selector",t),n&&i.append("cache",n),e.request(`/proxy?${i.toString()}`,a)}},Zm={list:async(e,r)=>{const t=(r?new URLSearchParams({q:r}):new URLSearchParams).toString(),n=t?`/transactions?${t}`:"/transactions";return e.request(n)}},qd={get:async e=>e.request("/vendor"),list:async e=>e.request("/vendors")},eg=e=>{const r=Km(e);return{profile:{get:t=>_t.get(r,t),update:(t,n)=>_t.update(r,t,n),checkSpotifyLink:()=>_t.checkSpotifyLink(r),unlinkSpotify:()=>_t.unlinkSpotify(r),delete:()=>_t.delete(r)},entitlements:{list:t=>Mo.list(r,t),get:t=>Mo.get(r,t),getAccess:t=>Mo.getAccess(r,t)},subscriptions:{list:()=>Od.list(r),get:t=>Od.get(r,t)},products:{get:t=>Cd.get(r,t),autoOnboard:t=>Cd.autoOnboard(r,t)},contracts:{list:async()=>{const t=await At.list(r),n=await e.tokenProvider();if(!n.toLowerCase().startsWith("bearer "))return t;const a=n.substring(7);return t.map(i=>_d(i,a))},get:async t=>{const n=await At.get(r,t),a=await e.tokenProvider();if(!a.toLowerCase().startsWith("bearer "))return n;const i=a.substring(7);return _d(n,i)},cancel:t=>At.cancel(r,t),createAmendment:(t,n)=>At.createAmendment(r,t,n),confirmAmendment:(t,n)=>At.confirmAmendment(r,t,n)},userMetadata:{get:()=>Fo.get(r),set:(t,n)=>Fo.set(r,t,n),delete:t=>Fo.delete(r,t)},tallies:{list:()=>rt.list(r),get:t=>rt.get(r,t),update:(t,n)=>rt.update(r,t,n),create:t=>rt.create(r,t),delete:t=>rt.delete(r,t),push:(t,n)=>rt.push(r,t,n)},tags:{list:()=>Bo.list(r),add:t=>Bo.add(r,t),remove:t=>Bo.remove(r,t)},checkouts:{generateLink:(t,n)=>tt.generateCheckoutLink(t,n),create:t=>Ho.create(r,t),get:t=>Ho.get(r,t),update:(t,n)=>Ho.update(r,t,n)},links:{generateCheckoutLink:(t,n)=>tt.generateCheckoutLink(t,n),generateAccountLink:(t,n)=>tt.generateAccountLink(t,n),generateChangePaymentLink:(t,n)=>tt.generateChangePaymentLink(t,n),generateChangePlanLink:(t,n)=>tt.generateChangePlanLink(t,n),generateConsumeLink:(t,n)=>tt.generateConsumeLink(t,n)},bills:{list:()=>Ad.list(r),get:t=>Ad.get(r,t)},fulfillments:{list:()=>kd.list(r),create:t=>kd.create(r,t)},paywalls:{get:t=>Ym.get(r,t)},paymentIssues:{list:()=>Qm.list(r)},proxy:{content:(t,n,a,i)=>Xm.content(r,t,n,a,i)},transactions:{list:t=>Zm.list(r,t)},vendor:{get:()=>qd.get(r),list:()=>qd.list(r)}}},rg="sesamy.com",tg="sesamy.dev",ng="https://sesa.my",$d="sesamyCacheTimestamp",Ud="sesamyContentReloaded";class ag{get(r){return typeof sessionStorage>"u"?null:sessionStorage.getItem(r)}set(r,t){typeof sessionStorage<"u"&&sessionStorage.setItem(r,t)}remove(r){typeof sessionStorage<"u"&&sessionStorage.removeItem(r)}clear(){}}function ig(e,r){return`${e}.${r==="dev"?tg:rg}`}function or(e,r){return`https://${ig(e,r)}`}function un(){let r=(document.documentElement.getAttribute("lang")??navigator.language??"en").split("-")[0]?.toLowerCase()??"en";return r==="nn"&&(r="nb"),r}function Go(e){let r;try{r=new URL(e)}catch{return!1}return r.protocol==="http:"||r.protocol==="https:"}function Ld(e,r){if(Go(e))return{itemSrc:e};const t=e.split(":");if(t.length<2)throw new Error(`Invalid itemSrc format: expected at least 2 segments separated by ':', got ${t.length}`);const[n,a,i]=t;if(!a)throw new Error("Invalid itemSrc format: sku segment is empty");return{sku:`${n}:${a}`,purchaseOption:r||i}}function Nd(e){return e.endsWith("/")?e.slice(0,-1):e}function xd(e,r){if(!Go(e)||!Go(r))return!1;const t=new URL(e),n=new URL(r);return t.origin===n.origin&&Nd(t.pathname)===Nd(n.pathname)}function og(e,r,t){const n=new URL(`${or("checkout3",e.environment)}`);r.language&&n.searchParams.set("lang",r.language);let a=r.sku,i=r.purchaseOptionId,o=r.itemSrc;if(r.itemSrc){const l=Ld(r.itemSrc,r.purchaseOptionId);a=l.sku||a,i=l.purchaseOption||i,o=l.itemSrc}a?(n.searchParams.set("sku",a),i&&n.searchParams.set("po-id",i)):o&&n.searchParams.set("url",o),r.email&&n.searchParams.set("email",r.email),r.business&&n.searchParams.set("business","true"),r.currency&&n.searchParams.set("currency",r.currency),r.price&&n.searchParams.set("price",r.price.toString()),r.discountCode&&n.searchParams.set("discount-code",r.discountCode),r.attributionItemSrc?n.searchParams.set("itemSrc",r.attributionItemSrc):t.itemSrc&&n.searchParams.set("itemSrc",t.itemSrc),r.attributionPublisherContentId?n.searchParams.set("publisherContentId",r.attributionPublisherContentId):t.publisherContentId&&n.searchParams.set("publisherContentId",t.publisherContentId),r.utmSource?n.searchParams.set("utm_source",r.utmSource):t.utmSource&&n.searchParams.set("utm_source",t.utmSource),r.utmMedium?n.searchParams.set("utm_medium",r.utmMedium):t.utmMedium&&n.searchParams.set("utm_medium",t.utmMedium),r.utmCampaign?n.searchParams.set("utm_campaign",r.utmCampaign):t.utmCampaign&&n.searchParams.set("utm_campaign",t.utmCampaign),r.utmTerm?n.searchParams.set("utm_term",r.utmTerm):t.utmTerm&&n.searchParams.set("utm_term",t.utmTerm),r.utmContent?n.searchParams.set("utm_content",r.utmContent):t.utmContent&&n.searchParams.set("utm_content",t.utmContent);const s=["_ga","_gid","_fbp","_fbc"];document.cookie.split(";").map(l=>{const[f,v]=l.trim().split("=");return{key:f,value:v}}).filter(l=>s.some(f=>f===l.key)).forEach(l=>{n.searchParams.append(l.key,l.value)});let c=new URL(window.location.href);if(r.redirectUrl)try{c=new URL(r.redirectUrl)}catch{console.warn("Invalid redirect URL provided, using current URL instead:",r.redirectUrl)}return c.searchParams.set("force-refetch-entitlements","true"),r.itemSrc&&c.searchParams.set("sesamy-purchase",r.itemSrc),n.searchParams.set("redirect-url",c.toString()),r.paymentMethodsFilter&&n.searchParams.set("paymentmethods-filter",r.paymentMethodsFilter.flatMap(({provider:l,methods:f})=>f?f.map(v=>`${l}|${v}`):l).join(",")),r.requireAddress&&n.searchParams.set("require-address","true"),r.giftMode&&n.searchParams.set("gift-mode","true"),r.payerEmail&&n.searchParams.set("payer-email",r.payerEmail),r.metadata&&Object.entries(r.metadata).forEach(([l,f])=>{n.searchParams.set(`metadata.${l}`,String(f))}),n}const jd="sesamySignedURLs";function Wo(){const e=sessionStorage.getItem(jd);return e?JSON.parse(e):[]}function Dd(e){const r=Wo();r.push(e),de(`Adding signed URL: ${e}`),sessionStorage.setItem(jd,JSON.stringify(r))}function sg(e){const r={};return Object.keys(e).forEach(t=>{const n=e[t];n!=null&&(r[t]=n.toString())}),r}const Vo="sesamyAttribution";function ug(e){const r=localStorage.getItem(e);if(!r)return null;try{return JSON.parse(r).value}catch{return console.error(`Failed to parse ${e}`),null}}function cg(e){return Object.keys(e).find(r=>r.startsWith("utm_"))?{utmSource:void 0,utmMedium:void 0,utmCampaign:void 0,...e}:e}function cn(){return ug(Vo)||{}}function Md(e){if(e===null)localStorage.removeItem(Vo);else{de(`Setting attribution ${JSON.stringify(e)}`);const r=cn()??{},t=sg({...r,...cg(e)});localStorage.setItem(Vo,JSON.stringify({value:t}))}}const zo="@sesamy/sesamy-js",kt="1.92.0",Fd="sesamyFlags";async function Bd(e){try{localStorage.setItem(Fd,JSON.stringify(e))}catch{de("Failed to save flags to localStorage")}}async function Hd(e,r){const t=await qt();t[e]=r,await Bd(t)}async function Gd(e){return(await qt())[e]}async function Wd(e){const r=await qt();e in r&&(delete r[e],await Bd(r))}async function qt(){try{const e=localStorage.getItem(Fd);return e?JSON.parse(e):{}}catch{return{}}}function Vd(e){function r(n){return n.id?`#${n.id}`:n.classList.length>0?Array.from(n.classList).map(i=>`.${i}`).join(""):null}function t(n){const a=[];let i=n;for(;i&&i!==document.body&&i!==document.documentElement;){const o=r(i);if(o){a.unshift(o);break}if(i.parentElement){const s=Array.from(i.parentElement.children),u=s.indexOf(i)+1,c=i.tagName.toLowerCase();s.filter(f=>f.tagName.toLowerCase()===c).length>1?a.unshift(`${c}:nth-child(${u})`):a.unshift(c)}i=i.parentElement}return a.join(" > ")}return t(e)}function zd(e){return e?Object.fromEntries(Object.entries(e).filter(([r,t])=>t!==void 0)):{}}function lg(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}let De={article:{selector:"sesamy-article"},image:{selector:"img",attribute:"src"},title:{selector:"h1",attribute:"textContent"},excerpt:{selector:"p",attribute:"textContent"},price:{selector:"sesamy-article",attribute:"price"},currency:{selector:"sesamy-article",attribute:"currency"},url:{selector:"sesamy-article",attribute:"item-src"},accessLevel:{selector:"sesamy-article",attribute:"access-level"},id:{selector:"sesamy-article",attribute:"publisher-content-id"},pass:{selector:"sesamy-article",attribute:"pass"},paywallUrl:{selector:"sesamy-article",attribute:"paywall-url"}},Kd=[],Jd=!1,Ir;function Ko(){const e=window.location.pathname,r=new URLSearchParams(window.location.search),t=navigator.userAgent;return Kd.find(n=>{if(n.path&&!e.includes(n.path)||n.queryParam&&r.get(n.queryParam.key)!==n.queryParam.value)return!1;if(n.headers){const a=n.headers.name.toLowerCase(),i=n.headers.contains.toLowerCase();if(a==="user-agent"){if(!t.toLowerCase().includes(i))return!1}else return!1}return!(n.userAgentContains&&!t.includes(n.userAgentContains))})}function fg(){return Ko()}function dg(e,r){Kd=e.content||[];const t=Ko();t&&t.type==="article"&&(De={...De,...zd(t.selectors)},Jd=t.enablePaywallSettingsUrlFallback||!1),Ir=r}function vg(e,r){const{selector:t,attribute:n}=r;return t===De.article.selector||n&&e.hasAttribute(n)?e:e.querySelector(t)}function Yd(e,r,t=!1){if(e){if(r.attribute){if(r.attribute==="textContent")return e.textContent??void 0;const n=e.getAttribute(r.attribute),a=Yd(e.parentElement,r,t);if(t){const i=[];return n&&i.push(...n.split(",").map(o=>o.trim()).filter(Boolean)),a&&i.push(...a.split(",").map(o=>o.trim()).filter(Boolean)),i.length>0?[...new Set(i)].join(","):void 0}return n??a}return e.textContent??void 0}}function ge(e){const r=document.head.querySelectorAll(`[property~='${e}'][content]`);for(let n=0;n<r.length;n+=1)if(r[n].content)return r[n].content;const t=document.head.querySelectorAll(`[name~='${e}'][content]`);for(let n=0;n<t.length;n+=1)if(t[n].content)return t[n].content}function $t(e){const r=[];return document.head.querySelectorAll(`[property~='${e}'][content]`).forEach(a=>{a.content&&r.push(a.content)}),document.head.querySelectorAll(`[name~='${e}'][content]`).forEach(a=>{a.content&&r.push(a.content)}),r}let Ut=null;function Qd(){const e=[],r=document.querySelectorAll('script[type="application/ld+json"]');for(const t of r)try{const n=JSON.parse(t.textContent||"");Array.isArray(n)?e.push(...n):n["@graph"]&&Array.isArray(n["@graph"])?e.push(...n["@graph"]):e.push(n)}catch{}return e}function Lt(e){const r=Qd(),t=n=>!e||n["@type"]===e||Array.isArray(n["@type"])&&n["@type"].includes(e);return r.find(t)||null}function hg(e){const r=Qd(),t=n=>!e||n["@type"]===e||Array.isArray(n["@type"])&&n["@type"].includes(e);return r.filter(t)}function Jo(e,r,t){if(!e||typeof e!="object")return typeof e=="string"?e:void 0;const a=e[r];if(typeof a=="string")return a;if(a&&typeof a=="object"&&t)return a[t]}function pg(e){if(!e)return;const t=(Array.isArray(e)?e:[e]).map(n=>{if(typeof n=="string")return{name:n};if(typeof n=="object"&&n!==null){const a=n,i=a.name;return i?{name:i,url:a.url,image:Jo(a,"image","url"),jobTitle:a.jobTitle,sameAs:a.sameAs}:null}return null}).filter(n=>n!==null&&!!n.name);return t.length>0?t:void 0}function Yo(e){if(Array.isArray(e))return e.filter(r=>typeof r=="string");if(typeof e=="string"){const r=e.split(",").map(t=>t.trim()).filter(Boolean);return r.length>0?r:void 0}}function Xd(){if(Ut)return Ut;const e=Lt("NewsArticle")||Lt("Article")||Lt("BlogPosting")||Lt("WebPage"),r=(...a)=>a.find(i=>i!=null&&i!=="")||void 0,t=(...a)=>a.find(i=>i&&i.length>0),n={contentType:e?Array.isArray(e["@type"])?e["@type"][0]:e["@type"]:void 0,authors:pg(e?.author)||($t("article:author").length>0?$t("article:author").map(a=>({name:a})):void 0)||(ge("author")?[{name:ge("author")}]:void 0),keywords:t(Yo(e?.keywords),Yo(ge("keywords"))),tags:$t("article:tag").length>0?$t("article:tag"):void 0,categories:Yo(ge("news_keywords")),section:r(e?.articleSection,ge("article:section")),publishedAt:r(e?.datePublished,ge("article:published_time")),modifiedAt:r(e?.dateModified,ge("article:modified_time")),ogType:ge("og:type"),ogSiteName:ge("og:site_name"),ogLocale:ge("og:locale"),twitterCard:ge("twitter:card"),twitterSite:ge("twitter:site"),twitterCreator:ge("twitter:creator"),creator:r(ge("creator"),ge("dc.creator")),mainEntityOfPage:e?Jo(e.mainEntityOfPage,"@id")||(typeof e.mainEntityOfPage=="string"?e.mainEntityOfPage:void 0):void 0,isAccessibleForFree:typeof e?.isAccessibleForFree=="boolean"?e.isAccessibleForFree:void 0,wordCount:typeof e?.wordCount=="number"?e.wordCount:void 0,publisher:e?.publisher&&typeof e.publisher=="object"?{name:e.publisher.name||"",url:e.publisher.url,logo:Jo(e.publisher,"logo","url")}:void 0};return Ut=zd(n),Ut}function mg(){Ut=null}function Qo({publisherContentId:e,key:r,defaultValue:t=""}){const n=e?document.body.querySelector(`sesamy-content-data[id='${e}']`):null,a=r.replace(/-([a-z])/g,(i,o)=>o.toUpperCase());return n?.getAttribute(r)||ge(`sesamy:${r}`)||ge(`sesamy:${a}`)||ge(`og:${r}`)||ge(r)||t}function Zd(){const e=document.querySelectorAll(De.article.selector);return Array.from(e).map(Nt).filter(r=>r!==null)}function Nt(e){const r=typeof e=="string"?document.querySelector(e):e;if(!r)return null;const t={element:r,selector:typeof e=="string"?e:Vd(r)},n=(i,o,s,u)=>{const{transform:c,collect:l=!1}=u||{},f=vg(r,o),v=Yd(f,o,l),d=Qo({publisherContentId:s,key:lg(String(i))}),h=v||d||void 0;h&&(t[i]=c?c(h):h)};n("id",De.id),n("title",De.title,t.id),n("excerpt",De.excerpt,t.id),n("image",De.image,t.id),n("price",De.price,t.id,{transform:i=>{const o=parseFloat(i);return Number.isNaN(o)?void 0:o}}),n("currency",De.currency,t.id),n("url",De.url,t.id),n("pass",De.pass,t.id,{collect:!0}),n("paywallUrl",De.paywallUrl,t.id),n("accessLevel",De.accessLevel,t.id,{transform:i=>i||"entitlement"});const a=Ko();if(a&&a.type==="article"&&(a.pass&&(t.pass=t.pass?`${t.pass},${a.pass}`:a.pass),a.price&&!t.price&&(t.price=a.price.amount),a.price?.currency&&!t.currency&&(t.currency=a.price.currency),a.paywallUrl&&!t.paywallUrl&&(t.paywallUrl=a.paywallUrl)),Jd&&!t.paywallUrl){const i=document.querySelector("sesamy-paywall");if(i){const o=i.getAttribute("settings-url");o&&(t.paywallUrl=o)}}return t.url||(t.url=window.location.href),t.metadata=Xd(),t}async function gg(e){const r=Nt(e);if(!r)throw new Error("Could not find article element");if(r.accessLevel==="public")return!0;if(r.accessLevel==="logged-in"&&!r.paywallUrl)return await Ir.auth.isAuthenticated()?!0:null;if(r.paywallUrl&&((await Ir.paywalls.get(r.paywallUrl)).settings.template==="LOGIN"?"logged-in":"entitlement")==="logged-in")return await Ir.auth.isAuthenticated()?!0:null;if(!r.url)throw new Error("Article must have a URL");return await Ir.entitlements.hasAccess(r.url,r.pass?.split(",")||[])||null}async function ev(e,r){const t=typeof e=="string"?document.querySelector(e):e;if(!t)throw new Error("Could not find element");const n=Nt(t);if(!n?.url)throw new Error("Could not find content for element");const a=await Ir.entitlements.hasAccess(n.url,n.pass?.split(",")||[]);if(!a)throw new Error("User does not have access to the content");const i=await Ir.entitlements.access(a.id);if(!i.token)throw new Error("Could not get access token");const o=r||Vd(t.parentElement||t);return Ir.proxy.getContent(i.token,n.url,o)}function rv(e,r={}){const{closeOnBackdropClick:t=!0,closeOnEscape:n=!0,zIndex:a=2147483647,backdropBlur:i="5px",overlayBackground:o="rgba(0,0,0,0.5)"}=r,s=document.createElement("div");s.setAttribute("data-sesamy-modal","true"),Object.assign(s.style,{position:"fixed",top:"0",left:"0",width:"100vw",height:"100vh",background:o,zIndex:String(a),display:"flex",alignItems:"center",justifyContent:"center",backdropFilter:`blur(${i})`});const u=document.createElement("div");u.setAttribute("data-sesamy-modal-content","true"),typeof e=="string"?u.innerHTML=e:u.appendChild(e),s.appendChild(u);const c=()=>{s.remove(),n&&document.removeEventListener("keydown",l)},l=f=>{f.key==="Escape"&&c()};return t&&s.addEventListener("click",f=>{f.target===s&&c()}),n&&document.addEventListener("keydown",l),document.body.appendChild(s),{element:s,close:c}}function yg(e,r={}){const{position:t="top",fixed:n=!0,zIndex:a=2147483647,autoDismissMs:i,pushContent:o=!1,height:s,transitionDuration:u="0.3s"}=r,c=document.createElement("div");c.setAttribute("data-sesamy-notification-bar","true"),c.setAttribute("data-sesamy-notification-position",t),Object.assign(c.style,{position:n?"fixed":"absolute",[t]:"0",left:"0",width:"100%",zIndex:String(a),boxSizing:"border-box",...s&&{height:s}}),typeof e=="string"?c.innerHTML=e:c.appendChild(e);let l,f,v;const d=()=>{if(v&&clearTimeout(v),o&&s){const h=document.documentElement;h.style.transform=l||"",setTimeout(()=>{c.remove(),h.style.transition=f||""},parseFloat(u)*1e3)}else c.remove()};if(i&&(v=setTimeout(d,i)),o&&s){const h=document.documentElement;l=h.style.transform,f=h.style.transition,h.style.transition=`transform ${u} ease`,c.style.transition=`transform ${u} ease`,t==="top"?(h.style.transform=`translateY(${s})`,c.style.transform=`translateY(-${s})`):(h.style.transform=`translateY(-${s})`,c.style.transform=`translateY(${s})`),document.documentElement.prepend(c)}else document.body.appendChild(c);return{element:c,close:d}}function bg(e){const r=e.endpoint??or("api2",e.environment),n=eg({baseUrl:r,tokenProvider:async()=>{if(await dr())try{const U=await vr(!1);return U?`Bearer ${U}`:null}catch{}const m=localStorage.getItem("__anon_id");return`Basic ${btoa(`${e.vendorId||e.clientId}|${m}:`)}`},libraryName:zo,libraryVersion:kt,vendorId:e.vendorId,cache:{mode:sn.BROWSER,storage:new ag}}),a=m=>async(C,U)=>{let F=sessionStorage.getItem($d);F||(F=Date.now().toString(),sessionStorage.setItem($d,F));const w={...U,headers:{...U.headers,"Cache-Timestamp":F}};return m(C,w)},i=(m=!0)=>C=>async(U,F)=>{const w=await vr(m);if(!w){if(await dr()){const N={...F,credentials:"include"};return C(U,N)}if(m)throw new Error("No access token available");return C(U,F)}const T={...F,headers:{...F.headers,Authorization:`Bearer ${w}`}};return C(U,T)},o=ir(r).headers({"Content-Type":"application/json"}).middlewares([a,i(),Sm(),Em({delayTimer:1e3,delayRamp:(m,C)=>m*C,maxAttempts:3,until:m=>!!(m&&(m.ok||m.status>=400&&m.status<500)),retryOnNetworkError:!1})]);async function s(m={}){const{waitForEntitlementAfter:C,includeSignedLinks:U=!0}=m,F=await dr()?await n.entitlements.list({waitForEntitlementAfter:C?.toISOString()}):[];return U&&F.push(...Wo()),F}async function u(m,C=[]){return(await s())?.find(w=>{if(m){const{sku:T,purchaseOption:N}=Ld(m);if("sku"in w&&T===w.sku||N&&"purchaseOptionsId"in w&&N===w.purchaseOptionsId||xd(m,w.url))return!0}return!!C.some(T=>xd(T,w.url))})}async function c(m,C,U){const F=new URL(r,window.location.origin);return F.pathname=F.pathname.replace(/\/$/,"")+"/proxy",F.searchParams.set("url",C),U&&F.searchParams.set("selector",U),ir(F.toString()).headers({Authorization:`Bearer ${m}`}).get().text()}async function l(m){if(!m)throw new Error("SKU is required to get fulfillments");return await dr()?await o.get(`/fulfillments?sku=${encodeURIComponent(m)}`).json():[]}async function f(m,C){if(!m||!C)throw new Error("SKU and itemId are required to request delivery");return(await o.post({sku:m},`/fulfillments/${encodeURIComponent(C)}/request-delivery?`).res()).ok}async function v(){return console.warn("getSubscriptions is deprecated, use getContracts instead"),o.get("/subscriptions").json()}async function d(m){return(await n.transactions.list())?.find(U=>U.id===m)}async function h(){return await o.url("/tags").get().json()}async function p(m){const C=await o.url(`/tags/${encodeURIComponent(m)}`).delete().res();return hr(),C.ok}async function S(m){const C=await o.url("/tags").post(encodeURIComponent(m)).res();return $r(er.USER_ATTRIBUTE_CHANGED,{}),hr(),C.ok}async function R(m){return(await n.tallies.get(m)).value}async function I(){const m=await n.tallies.list(),C={};for(const U of m)C[U.id]=U.value;return C}async function g(m){return await n.tallies.delete(m)}async function b(m,C){return await n.tallies.push(m,C)}async function y(){return await vr(!1)?await o.url("/profile").get().json():null}async function A(m){const C=await o.url("/profile").patch(m).res();return hr(),C.ok}async function q(){return(await o.url("/profile/spotify-link").get().json()).isSpotifyLinked}async function j(){return(await o.url("/profile/unlink-spotify").post().res()).ok}async function G(m){const C=await vr(!1);if(!C)throw new Error("No access token available");const U=new URL(`${or("access-sync",e.environment)}/spotify/sesamy-callback`);U.searchParams.set("access_token",C),U.searchParams.set("state",m),window.location.href=U.toString()}async function K(m){const C=await o.url(`/products/${encodeURIComponent(m)}/auto-onboard`).post().json();return C.length&&hr(),C}async function re(m,C=3600){const{shortlink:U}=await ir(ng).post({url:m,ttl:C}).json();return U}async function L(m){const C=await vr(!1,!0);let U;const F=m.language||un(),w=cn();switch(m.target){case"account":U=new URL(`${or("account",e.environment)}/${encodeURIComponent(m.language||F)}/subscriptions/${encodeURIComponent(e.vendorId||e.clientId)}${m.contractId?`/${encodeURIComponent(m.contractId)}`:""}`),U.searchParams.set("sesamy-redirect-url",m.redirectUrl||window.location.href);break;case"change-payment":U=new URL(`${or("account",e.environment)}/${encodeURIComponent(m.language||F)}/subscriptions/${encodeURIComponent(e.vendorId||e.clientId)}/${encodeURIComponent(m.contractId)}/change-payment-method`),U.searchParams.set("sesamy-redirect-url",m.redirectUrl||window.location.href);break;case"change-plan":U=new URL(`${or("account",e.environment)}/${encodeURIComponent(m.language||F)}/subscriptions/${encodeURIComponent(e.vendorId||e.clientId)}/${encodeURIComponent(m.contractId)}/edit-plan`),U.searchParams.set("sesamy-redirect-url",m.redirectUrl||window.location.href);break;case"consume":U=new URL(`${or("consume",e.environment)}/${encodeURIComponent(m.language||F)}/@${encodeURIComponent(e.vendorId||e.clientId)}/${encodeURIComponent(m.sku)}`),m.episodeId?U.href+=`/${m.episodeId}`:U.href+="/listen",U.searchParams.set("sesamy-redirect-url",m.redirectUrl||window.location.href);break;case"checkout":U=og(e,{language:F,...m},w);break;default:throw new Error("Invalid target")}return C&&(U.hash=`#access_token=${C}`),m.shorten?re(U.href,m.ttl):U.href}async function M(){const m=await vr(!1),C=new URL(`${or("account",e.environment)}/subscriptions/${e.vendorId||e.clientId}`);m&&(C.hash=`#access_token=${m}`),window.location.href=C.toString()}async function x(m){const C=cn(),U=["_ga","_gid","_fbp","_fbc"];return document.cookie.split(";").forEach(F=>{const[w,T]=F.trim().split("=");U.includes(w)&&!C[w]&&(C[w]=T)}),n.checkouts.create({language:un(),...m,attribution:{...C,...m.attribution}})}return{autoOnboardProduct:K,bills:n.bills,checkouts:{create:x,get:n.checkouts.get,update:n.checkouts.update},content:{list:Zd,get:Nt,getLanguage:un,unlock:ev,getPropertyFromHTML:Qo},contracts:n.contracts,deleteTag:p,deleteTally:g,entitlements:n.entitlements,flags:{get:Gd,set:Hd,list:qt,delete:Wd},generateLink:L,getProxyContent:c,getEntitlements:s,getFulfillments:l,requestDelivery:f,hasAccess:u,isSpotifyLinked:q,linkSpotify:G,openHostedAccountPage:M,paywalls:n.paywalls,paymentIssues:n.paymentIssues,getProfile:y,products:n.products,getSubscriptions:v,getTally:R,getTallies:I,getTags:h,getTransaction:d,transactions:n.transactions,userMetadata:n.userMetadata,pushTally:b,setTag:S,unlinkSpotify:j,updateProfile:A,vendor:n.vendor}}function tv(e,r,t,n,a){for(r=r.split?r.split("."):r,n=0;n<r.length;n++)e=e?e[r[n]]:a;return e===a?t:e}var wg="function",Sg="string",rr="undefined",Ig="boolean",ln="object",Pg="array",Eg="number",Rg="symbol",Tg="null",Xo=function(){},nv="any",av="*",Lr="__",Og="form",Cg="input",_g="button",Ag="select",fn=typeof process!==rr?process:{};fn.env&&fn.env.NODE_ENV;var Ce=typeof document!==rr;fn.versions!=null&&fn.versions.node!=null,typeof Deno!==rr&&Deno.core,Ce&&window.name==="nodejs"||typeof navigator!==rr&&typeof navigator.userAgent!==rr&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));function iv(e,r){return r.charAt(0)[e]()+r.slice(1)}var kg=iv.bind(null,"toUpperCase"),qg=iv.bind(null,"toLowerCase");function $g(e){return ov(e)?kg(Tg):typeof e===ln?xg(e):Object.prototype.toString.call(e).slice(8,-1)}function dn(e,r){r===void 0&&(r=!0);var t=$g(e);return r?qg(t):t}function xt(e,r){return typeof r===e}var Me=xt.bind(null,wg),Pr=xt.bind(null,Sg),nt=xt.bind(null,rr),Ug=xt.bind(null,Ig);xt.bind(null,Rg);function ov(e){return e===null}function Lg(e){return dn(e)===Eg&&!isNaN(e)}function sv(e){return dn(e)===Pg}function Fe(e){if(!Ng(e))return!1;for(var r=e;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r}function Ng(e){return e&&(typeof e===ln||e!==null)}function xg(e){return Me(e.constructor)?e.constructor.name:null}function jg(e){return e instanceof Error||Pr(e.message)&&e.constructor&&Lg(e.constructor.stackTraceLimit)}function uv(e,r){if(typeof r!="object"||ov(r))return!1;if(r instanceof e)return!0;var t=dn(new e(""));if(jg(r))for(;r;){if(dn(r)===t)return!0;r=Object.getPrototypeOf(r)}return!1}uv.bind(null,TypeError),uv.bind(null,SyntaxError);function vn(e,r){var t=e instanceof Element||e instanceof HTMLDocument;return t&&r?Dg(e,r):t}function Dg(e,r){return r===void 0&&(r=""),e&&e.nodeName===r.toUpperCase()}function hn(e){var r=[].slice.call(arguments,1);return function(){return e.apply(void 0,[].slice.call(arguments).concat(r))}}hn(vn,Og),hn(vn,_g),hn(vn,Cg),hn(vn,Ag);function Mg(e){return e?sv(e)?e:[e]:[]}function cv(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function Fg(){if(Ce){var e=navigator,r=e.languages;return e.userLanguage||(r&&r.length?r[0]:e.language)}}function Bg(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function Hg(e){return(function(r){for(var t,n=Object.create(null),a=/([^&=]+)=?([^&]*)/g;t=a.exec(r);){var i=cv(t[1]),o=cv(t[2]);if(i)if(i.substring(i.length-2)==="[]"){var s=n[i=i.substring(0,i.length-2)]||(n[i]=[]);n[i]=Array.isArray(s)?s:[],n[i].push(o)}else n[i]=o===""||o}for(var u in n){var c=u.split("[");c.length>1&&(Gg(n,c.map(function(l){return l.replace(/[?[\]\\ ]/g,"")}),n[u]),delete n[u])}return n})((function(r){return Ce&&window.location.search.substring(1)})())}function Gg(e,r,t){for(var n=r.length-1,a=0;a<n;++a){var i=r[a];if(i==="__proto__"||i==="constructor")break;i in e||(e[i]={}),e=e[i]}e[r[n]]=t}function pn(){for(var e="",r=0,t=4294967295*Math.random()|0;r++<36;){var n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[r-1],a=15&t;e+=n=="-"||n=="4"?n:(n=="x"?a:3&a|8).toString(16),t=r%8==0?4294967295*Math.random()|0:t>>4}return e}function Wg(e,r){var t,n,a,i=null,o=0,s=function(){o=new Date,i=null,a=e.apply(t,n)};return function(){var u=new Date;o||(o=u);var c=r-(u-o);return t=this,n=arguments,c<=0?(clearTimeout(i),i=null,o=u,a=e.apply(t,n)):i||(i=setTimeout(s,c)),a}}var Nr="global",at=Lr+Nr+Lr,it=typeof self===ln&&self.self===self&&self||typeof global===ln&&global[Nr]===global&&global||void 0;function xr(e){return it[at][e]}function jr(e,r){return it[at][e]=r}function ot(e){delete it[at][e]}function st(e,r,t){var n;try{if(Zo(e)){var a=window[e];n=a[r].bind(a)}}catch{}return n||t}it[at]||(it[at]={});var mn={};function Zo(e){if(typeof mn[e]!==rr)return mn[e];try{var r=window[e];r.setItem(rr,rr),r.removeItem(rr)}catch{return mn[e]=!1}return mn[e]=!0}function Z(){return Z=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},Z.apply(null,arguments)}var Er="function",pr="undefined",jt="reducer",lv="@@redux/",es=lv+"INIT",Vg=lv+Math.random().toString(36),fv=(function(){return typeof Symbol===Er&&Symbol.observable||"@@observable"})(),gn=" != "+Er;function dv(e,r,t){var n;if(typeof r===Er&&typeof t===pr&&(t=r,r=void 0),typeof t!==pr){if(typeof t!==Er)throw new Error("enhancer"+gn);return t(dv)(e,r)}if(typeof e!==Er)throw new Error(jt+gn);var a=e,i=r,o=[],s=o,u=!1;function c(){s===o&&(s=o.slice())}function l(){return i}function f(d){if(typeof d!==Er)throw new Error("Listener"+gn);var h=!0;return c(),s.push(d),function(){if(h){h=!1,c();var p=s.indexOf(d);s.splice(p,1)}}}function v(d){if(!Fe(d))throw new Error("Act != obj");if(typeof d.type===pr)throw new Error("ActType "+pr);if(u)throw new Error("Dispatch in "+jt);try{u=!0,i=a(i,d)}finally{u=!1}for(var h=o=s,p=0;p<h.length;p++)(0,h[p])();return d}return v({type:es}),(n={dispatch:v,subscribe:f,getState:l,replaceReducer:function(d){if(typeof d!==Er)throw new Error("next "+jt+gn);a=d,v({type:es})}})[fv]=function(){var d,h=f;return(d={subscribe:function(p){if(typeof p!="object")throw new TypeError("Observer != obj");function S(){p.next&&p.next(l())}return S(),{unsubscribe:h(S)}}})[fv]=function(){return this},d},n}function zg(e,r){var t=r&&r.type;return"action "+(t&&t.toString()||"?")+jt+" "+e+" returns "+pr}function ut(){var e=[].slice.call(arguments);return e.length===0?function(r){return r}:e.length===1?e[0]:e.reduce(function(r,t){return function(){return r(t.apply(void 0,[].slice.call(arguments)))}})}function Kg(){var e=arguments;return function(r){return function(t,n,a){var i,o=r(t,n,a),s=o.dispatch,u={getState:o.getState,dispatch:function(c){return s(c)}};return i=[].slice.call(e).map(function(c){return c(u)}),Z({},o,{dispatch:s=ut.apply(void 0,i)(o.dispatch)})}}}var Rr=Lr+"anon_id",Dr=Lr+"user_id",ct=Lr+"user_traits",rs="analytics",Tr="userId",lt="anonymousId",yn=["bootstrap","params","campaign","initializeStart","initialize","initializeEnd","ready","resetStart","reset","resetEnd","pageStart","page","pageEnd","pageAborted","trackStart","track","trackEnd","trackAborted","identifyStart","identify","identifyEnd","identifyAborted","userIdChanged","registerPlugins","enablePlugin","disablePlugin","online","offline","setItemStart","setItem","setItemEnd","setItemAborted","removeItemStart","removeItem","removeItemEnd","removeItemAborted"],ts=["name","EVENTS","config","loaded"],ee=yn.reduce(function(e,r){return e[r]=r,e},{registerPluginType:function(e){return"registerPlugin:"+e},pluginReadyType:function(e){return"ready:"+e}}),vv=/^utm_/,hv=/^an_prop_/,pv=/^an_trait_/;function Jg(e){var r=e.storage.setItem;return function(t){return function(n){return function(a){if(a.type===ee.bootstrap){var i=a.params,o=a.user,s=a.persistedUser,u=a.initialUser,c=s.userId===o.userId;s.anonymousId!==o.anonymousId&&r(Rr,o.anonymousId),c||r(Dr,o.userId),u.traits&&r(ct,Z({},c&&s.traits?s.traits:{},u.traits));var l=Object.keys(a.params);if(l.length){var f=i.an_uid,v=i.an_event,d=l.reduce(function(h,p){if(p.match(vv)||p.match(/^(d|g)clid/)){var S=p.replace(vv,"");h.campaign[S==="campaign"?"name":S]=i[p]}return p.match(hv)&&(h.props[p.replace(hv,"")]=i[p]),p.match(pv)&&(h.traits[p.replace(pv,"")]=i[p]),h},{campaign:{},props:{},traits:{}});t.dispatch(Z({type:ee.params,raw:i},d,f?{userId:f}:{})),f&&setTimeout(function(){return e.identify(f,d.traits)},0),v&&setTimeout(function(){return e.track(v,d.props)},0),Object.keys(d.campaign).length&&t.dispatch({type:ee.campaign,campaign:d.campaign})}}return n(a)}}}}function Yg(e){return function(r,t){if(r===void 0&&(r={}),t===void 0&&(t={}),t.type===ee.setItemEnd){if(t.key===Rr)return Z({},r,{anonymousId:t.value});if(t.key===Dr)return Z({},r,{userId:t.value})}switch(t.type){case ee.identify:return Object.assign({},r,{userId:t.userId,traits:Z({},r.traits,t.traits)});case ee.reset:return[Dr,Rr,ct].forEach(function(n){e.removeItem(n)}),Object.assign({},r,{userId:null,anonymousId:null,traits:{}});default:return r}}}function mv(e){return{userId:e.getItem(Dr),anonymousId:e.getItem(Rr),traits:e.getItem(ct)}}var ns=function(e){return Lr+"TEMP"+Lr+e};function Qg(e){var r=e.storage,t=r.setItem,n=r.removeItem,a=r.getItem;return function(i){return function(o){return function(s){var u=s.userId,c=s.traits,l=s.options;if(s.type===ee.reset&&([Dr,ct,Rr].forEach(function(d){n(d)}),[Tr,lt,"traits"].forEach(function(d){ot(ns(d))})),s.type===ee.identify){a(Rr)||t(Rr,pn());var f=a(Dr),v=a(ct)||{};f&&f!==u&&i.dispatch({type:ee.userIdChanged,old:{userId:f,traits:v},new:{userId:u,traits:c},options:l}),u&&t(Dr,u),c&&t(ct,Z({},v,c))}return o(s)}}}}var Dt={};function gv(e,r){Dt[e]&&Me(Dt[e])&&(Dt[e](r),delete Dt[e])}function yv(e,r,t){return new Promise(function(n,a){return r()?n(e):t<1?a(Z({},e,{queue:!0})):new Promise(function(i){return setTimeout(i,10)}).then(function(i){return yv(e,r,t-10).then(n,a)})})}function Xg(e){return{abort:e}}function bv(e,r,t){var n={},a=r(),i=e.getState(),o=i.plugins,s=i.queue,u=i.user;if(!i.context.offline&&s&&s.actions&&s.actions.length){var c=s.actions.reduce(function(f,v,d){return o[v.plugin].loaded?(f.process.push(v),f.processIndex.push(d)):(f.requeue.push(v),f.requeueIndex.push(d)),f},{processIndex:[],process:[],requeue:[],requeueIndex:[]});if(c.processIndex&&c.processIndex.length){c.processIndex.forEach(function(f){var v=s.actions[f],d=v.plugin,h=v.payload.type,p=a[d][h];if(p&&Me(p)){var S,R=(function(b,y){return b===void 0&&(b={}),y===void 0&&(y={}),[Tr,lt].reduce(function(A,q){return b.hasOwnProperty(q)&&y[q]&&y[q]!==b[q]&&(A[q]=y[q]),A},b)})(v.payload,u),I=n[R.meta.rid];if(!I&&(S=p({payload:R,config:o[d].config,instance:t,abort:Xg}))&&Fe(S)&&S.abort)return void(n[R.meta.rid]=!0);if(!I){var g=h+":"+d;e.dispatch(Z({},R,{type:g,_:{called:g,from:"queueDrain"}}))}}});var l=s.actions.filter(function(f,v){return!~c.processIndex.indexOf(v)});s.actions=l}}}var as=function(e){var r=e.data,t=e.action,n=e.instance,a=e.state,i=e.allPlugins,o=e.allMatches,s=e.store,u=e.EVENTS;try{var c=a.plugins,l=a.context,f=t.type,v=f.match(ft),d=r.exact.map(function(S){return S.pluginName});v&&(d=o.during.map(function(S){return S.pluginName}));var h=(function(S,R){return function(I,g,b){var y=g.config,A=g.name,q=A+"."+I.type;b&&(q=b.event);var j=I.type.match(ft)?(function(G,K,re,L,M){return function(x,m){var C=L?L.name:G,U=m&&Mt(m)?m:re;if(L&&(!(U=m&&Mt(m)?m:[G]).includes(G)||U.length!==1))throw new Error("Method "+K+" can only abort "+G+" plugin. "+JSON.stringify(U)+" input valid");return Z({},M,{abort:{reason:x,plugins:U,caller:K,_:C}})}})(A,q,R,b,I):(function(G,K){return function(){throw new Error(G.type+" action not cancellable. Remove abort in "+K)}})(I,q);return{payload:Zg(I),instance:S,config:y||{},abort:j}}})(n,d),p=r.exact.reduce(function(S,R){var I=R.pluginName,g=R.methodName,b=!1;return g.match(/^initialize/)||g.match(/^reset/)||(b=!c[I].loaded),l.offline&&g.match(/^(page|track|identify)/)&&(b=!0),S[""+I]=b,S},{});return Promise.resolve(r.exact.reduce(function(S,R,I){var g=R.pluginName;return Promise.resolve(S).then(function(b){function y(){return Promise.resolve(b)}var A=(function(){if(r.namespaced&&r.namespaced[g])return Promise.resolve(r.namespaced[g].reduce(function(q,j,G){return Promise.resolve(q).then(function(K){return j.method&&Me(j.method)?((function(x,m){var C=Ov(x);if(C&&C.name===m){var U=Ov(C.method);throw new Error([m+" plugin is calling method "+x,"Plugins cant call self","Use "+C.method+" "+(U?"or "+U.method:"")+" in "+m+" plugin insteadof "+x].join(`
|
|
2
|
+
CAUSE: `+d.stack,y.response=g,y.status=g.status,y.url=f,g.type==="opaque")throw y;const A=a.errorType==="json"||((b=g.headers.get("Content-Type"))===null||b===void 0?void 0:b.split(";")[0])==="application/json";return(a.errorType?A?g.text():g[a.errorType]():Promise.resolve(g.body)).then(q=>{if(y.message=typeof q=="string"?q:g.statusText,q)if(A&&typeof q=="string"){y.text=q;try{y.json=JSON.parse(q)}catch{}}else y[a.errorType]=q;throw y})}return g}),p=g=>g.catch(b=>{const y=Object.prototype.hasOwnProperty.call(b,Zr),A=y?b[Zr]:b,q=A?.status&&c.get(A.status)||c.get(A?.name)||y&&c.has(Zr)&&c.get(Zr);if(q)return q(A,e);const j=c.get(Pd);if(j)return j(A,e);throw A}),S=g=>b=>p(g?h.then(y=>y&&y[g]()).then(y=>b?b(y):y):h.then(y=>b?b(y):y)),R={_wretchReq:e,_fetchReq:v,_sharedState:r,res:S(null),json:S("json"),blob:S("blob"),formData:S("formData"),arrayBuffer:S("arrayBuffer"),text:S("text"),error(g,b){return c.set(g,b),this},badRequest(g){return this.error(400,g)},unauthorized(g){return this.error(401,g)},forbidden(g){return this.error(403,g)},notFound(g){return this.error(404,g)},timeout(g){return this.error(408,g)},internalError(g){return this.error(500,g)},fetchError(g){return this.error(Zr,g)}},I=u.reduce((g,b)=>({...g,...typeof b.resolver=="function"?b.resolver(g):b.resolver}),R);return o.reduce((g,b)=>b(g,e),I)},km={_url:"",_options:{},_config:et,_catchers:new Map,_resolvers:[],_deferred:[],_middlewares:[],_addons:[],addon(e){return{...this,_addons:[...this._addons,e],...e.wretch}},errorType(e){return{...this,_config:{...this._config,errorType:e}}},polyfills(e,r=!1){return{...this,_config:{...this._config,polyfills:r?e:Ur(this._config.polyfills,e)}}},url(e,r=!1){if(r)return{...this,_url:e};const t=this._url.split("?");return{...this,_url:t.length>1?t[0]+e+"?"+t[1]:this._url+e}},options(e,r=!1){return{...this,_options:r?e:Ur(this._options,e)}},headers(e){const r=e?Array.isArray(e)?Object.fromEntries(e):"entries"in e?Object.fromEntries(e.entries()):e:{};return{...this,_options:Ur(this._options,{headers:r})}},accept(e){return this.headers({Accept:e})},content(e){return this.headers({[Id]:e})},auth(e){return this.headers({Authorization:e})},catcher(e,r){const t=new Map(this._catchers);return t.set(e,r),{...this,_catchers:t}},catcherFallback(e){return this.catcher(Pd,e)},resolve(e,r=!1){return{...this,_resolvers:r?[e]:[...this._resolvers,e]}},defer(e,r=!1){return{...this,_deferred:r?[e]:[...this._deferred,e]}},middlewares(e,r=!1){return{...this,_middlewares:r?e:[...this._middlewares,...e]}},fetch(e=this._options.method,r="",t=null){let n=this.url(r).options({method:e});const a=Ed(n._options.headers),i=this._config.polyfill("FormData",!1),o=typeof t=="object"&&!(i&&t instanceof i)&&(!n._options.headers||!a||Rd(a));return n=t?o?n.json(t,a):n.body(t):n,Am(n._deferred.reduce((s,u)=>u(s,s._url,s._options),n))},get(e=""){return this.fetch("GET",e)},delete(e=""){return this.fetch("DELETE",e)},put(e,r=""){return this.fetch("PUT",r,e)},post(e,r=""){return this.fetch("POST",r,e)},patch(e,r=""){return this.fetch("PATCH",r,e)},head(e=""){return this.fetch("HEAD",e)},opts(e=""){return this.fetch("OPTIONS",e)},body(e){return{...this,_options:{...this._options,body:e}}},json(e,r){const t=Ed(this._options.headers);return this.content(r||Rd(t)&&t||Rm).body(JSON.stringify(e))}};function ir(e="",r={}){return{...km,_url:e,_options:r}}ir.default=ir,ir.options=Tm,ir.errorType=Cm,ir.polyfills=Om,ir.WretchError=Td;const qm=(e,r)=>r.skipDedupe||r.method!=="GET",$m=(e,r)=>r.method+"@"+e,Um=e=>e.clone(),Lm=({skip:e=qm,key:r=$m,resolver:t=Um}={})=>{const n=new Map;return a=>(i,o)=>{if(e(i,o))return a(i,o);const s=r(i,o);if(!n.has(s))n.set(s,[]);else return new Promise((u,c)=>{n.get(s).push([u,c])});try{return a(i,o).then(u=>(n.get(s).forEach(([c])=>c(t(u))),n.delete(s),u)).catch(u=>{throw n.get(s).forEach(([,c])=>c(u)),n.delete(s),u})}catch(u){return n.delete(s),Promise.reject(u)}}},Nm=(e,r)=>r.skipCache||r.method!=="GET",xm=(e,r)=>r.method+"@"+e,jm=()=>!1,Dm=()=>null,Mm=e=>e.ok,Fm=({throttle:e=1e3,skip:r=Nm,key:t=xm,clear:n=jm,invalidate:a=Dm,condition:i=Mm,flagResponseOnCacheHit:o="__cached"}={})=>{const s=new Map,u=new Map,c=new Set,l=v=>{e&&!c.has(v)&&(c.add(v),setTimeout(()=>{c.delete(v)},e))},f=v=>(d,h)=>{const p=t(d,h);let S=a(d,h);if(S&&(S instanceof Array||(S=[S]),S.forEach(R=>{typeof R=="string"?s.delete(R):R instanceof RegExp&&s.forEach((I,g)=>{R.test(g)&&s.delete(g)})})),n(d,h)&&s.clear(),r(d,h))return v(d,h);if(c.has(p)){if(s.has(p)){const R=s.get(p).clone();return o&&Object.defineProperty(R,o,{value:p,enumerable:!1}),Promise.resolve(R)}else if(u.has(p))return new Promise((R,I)=>{u.get(p).push([R,I])})}return u.has(p)||u.set(p,[]),l(p),v(d,h).then(R=>(i(R.clone())&&s.set(p,R.clone()),u.get(p).forEach(([I])=>I(R.clone())),u.delete(p),R)).catch(R=>{throw u.get(p).forEach(([,I])=>I(R)),u.delete(p),R})};return f.cacheResponse=function(v,d){l(v),s.set(v,d)},f.cache=s,f.inflight=u,f.throttling=c,f},Bm=(e,r)=>e*r,Hm=e=>e&&e.ok,Gm=({delayTimer:e=500,delayRamp:r=Bm,maxAttempts:t=10,until:n=Hm,onRetry:a=null,retryOnNetworkError:i=!1,resolveWithLatestResponse:o=!1,skip:s}={})=>u=>(c,l)=>{let f=0;if(s&&s(c,l))return u(c,l);const v=(d,h)=>Promise.resolve(n(d,h)).then(p=>p?d&&o?d:h?Promise.reject(h):d:(f++,!t||f<=t?new Promise(S=>{const R=r(e,f);setTimeout(()=>{typeof a=="function"?Promise.resolve(a({response:d,error:h,url:c,options:l})).then((I={})=>{var g,b;S(u((g=I&&I.url)!==null&&g!==void 0?g:c,(b=I&&I.options)!==null&&b!==void 0?b:l))}):S(u(c,l))},R)}).then(v).catch(S=>{if(!i)throw S;return v(null,S)}):d&&o?d:Promise.reject(h||new Error("Number of attempts exceeded."))));return u(c,l).then(v).catch(d=>{if(!i)throw d;return v(null,d)})},Wm="@sesamy/sdk",Vm="1.23.0";let zm=class{cache=new Map;get(r){return this.cache.get(r)||null}set(r,t){this.cache.set(r,t)}remove(r){this.cache.delete(r)}clear(){this.cache.clear()}};const Ct="sesamyCacheTimestamp",Km=e=>{const{libraryName:r=Wm,libraryVersion:t=Vm,cache:n}=e,a=n?.storage||new zm,i=[s=>async(u,c)=>{if(n?.mode===sn.BROWSER){let l;typeof sessionStorage<"u"?(l=sessionStorage.getItem(Ct),l||(l=Date.now().toString(),sessionStorage.setItem(Ct,l))):(l=a.get(Ct),l||(l=Date.now().toString(),a.set(Ct,l)));const f={...c,headers:{...c.headers,"Cache-Timestamp":l}};return s(u,f)}return s(u,c)},s=>async(u,c)=>{const l=await e.tokenProvider();if(l===null)return s(u,c);const f={...c,headers:{...c.headers,Authorization:l}};return s(u,f)},Lm()];n?.mode===sn.NORMAL&&i.push(Fm({throttle:300*1e3,skip:(s,u)=>u.method!=="GET"})),i.push(Gm({delayTimer:1e3,delayRamp:(s,u)=>s*u,maxAttempts:3,until:s=>!!(s&&(s.ok||s.status>=400&&s.status<500)),retryOnNetworkError:!1}));const o=ir(e.baseUrl).headers({"Content-Type":"application/json","X-Sesamy-Client":`${r}/${t}`,...e.headers}).middlewares(i);return{async request(s,u={}){try{const c=/^https?:\/\//.test(s);let l=o.url(s,c);u.headers&&(l=l.headers(u.headers));const f=(u.method||"GET").toLowerCase();let v;switch(f){case"get":v=l.get();break;case"post":v=l.post(u.body);break;case"put":v=l.put(u.body);break;case"patch":v=l.patch(u.body);break;case"delete":v=l.delete();break;default:v=l.get()}const d=await v.res();if(d.ok&&["post","patch","put","delete"].includes(f)&&hr(),d.status===204)return null;if(!d.ok){const h=await d.text().catch(()=>"Unknown error");throw new Do(d.status,d.statusText,d.url,`API Error ${d.status}: ${h}`,h)}return await d.json()}catch(c){if(c instanceof Do)throw c;const l=c.status||500,f=c.message||"Unknown error",v=`${e.baseUrl}${s}`;throw new Do(l,f,v,`API Error ${l}: ${c.message||"Unknown error"}`,c.message||"Unknown error")}}}},hr=()=>(typeof sessionStorage<"u"&&sessionStorage.removeItem(Ct),"Cache cleared"),_t={get:async(e,r)=>e.request(`/profile/${r}`),update:async(e,r,t)=>e.request(`/profile/${r}`,{method:"PATCH",body:JSON.stringify(t)}),checkSpotifyLink:async e=>e.request("/profile/spotify-link"),unlinkSpotify:async e=>e.request("/profile/unlink-spotify",{method:"POST"}),delete:async e=>{await e.request("/profile",{method:"DELETE"})}},Mo={list:async(e,r)=>{const t=new URLSearchParams;r?.type&&t.append("type",r.type),r?.sku&&t.append("sku",r.sku),r?.purchaseOptionId&&t.append("purchase-option-id",r.purchaseOptionId),r?.waitForEntitlementAfter&&t.append("wait-for-entitlement-after",r.waitForEntitlementAfter);const n=t.toString(),a=n?`/entitlements?${n}`:"/entitlements";return e.request(a)},get:async(e,r)=>e.request(`/entitlements/${r}`),getAccess:async(e,r)=>e.request(`/entitlements/${r}/access`)},Od={list:async e=>e.request("/subscriptions"),get:async(e,r)=>e.request(`/subscriptions/${r}`)},Cd={get:async(e,r)=>e.request(`/products/${r}`),autoOnboard:async(e,r)=>e.request(`/products/${r}/auto-onboard`,{method:"POST"})},Jm=(e,r)=>{if(!e||!r)return e;const t=new URL(e);return t.hash=`access_token=${r}`,t.toString()},_d=(e,r)=>!e.manageUrl||!r?e:{...e,manageUrl:Jm(e.manageUrl,r)},At={list:async e=>e.request("/contracts"),get:async(e,r)=>e.request(`/contracts/${r}`),cancel:async(e,r)=>e.request(`/contracts/${r}/cancel`,{method:"POST"}),createAmendment:async(e,r,t)=>e.request(`/contracts/${r}/amendments`,{method:"POST",body:JSON.stringify(t)}),confirmAmendment:async(e,r,t)=>e.request(`/contracts/${r}/amendments/${t}/confirm`,{method:"POST"})},Fo={get:async e=>e.request("/user-metadata"),set:async(e,r,t)=>{await e.request(`/user-metadata/${r}`,{method:"PUT",body:t})},delete:async(e,r)=>{await e.request(`/user-metadata/${r}`,{method:"DELETE"})}},rt={list:async e=>e.request("/tallies"),get:async(e,r)=>e.request(`/tallies/${r}`),update:async(e,r,t)=>e.request(`/tallies/${r}`,{method:"PUT",body:JSON.stringify(t)}),create:async(e,r)=>e.request("/tallies",{method:"POST",body:JSON.stringify(r)}),delete:async(e,r)=>{try{return await e.request(`/tallies/${r}`,{method:"DELETE"}),!0}catch{return!1}},push:async(e,r,t)=>e.request(`/tallies/${r}/push`,{method:"POST",body:JSON.stringify(t)})},Bo={list:async e=>e.request("/tags"),add:async(e,r)=>{await e.request("/tags",{method:"POST",body:JSON.stringify({tag:r})})},remove:async(e,r)=>{await e.request(`/tags/${r}`,{method:"DELETE"})}},tt={generateCheckoutLink:(e,r)=>{const t=new URL(`${e.apiUrl}/checkouts`);return r.items&&t.searchParams.set("items",JSON.stringify(r.items)),r.email&&t.searchParams.set("email",r.email),r.language&&t.searchParams.set("lang",r.language),r.redirectUrl&&t.searchParams.set("redirect-url",r.redirectUrl),r.giftMode&&t.searchParams.set("gift-mode","true"),r.payerEmail&&t.searchParams.set("payer-email",r.payerEmail),r.requireAddress&&t.searchParams.set("require-address","true"),r.metadata&&Object.entries(r.metadata).forEach(([n,a])=>{t.searchParams.set(`metadata.${n}`,a)}),t.toString()},generateAccountLink:(e,r)=>{const t=r.language||"en",n=new URL(`${e.baseUrl}/account/${encodeURIComponent(t)}/subscriptions/${encodeURIComponent(e.clientId)}${r.contractId?`/${encodeURIComponent(r.contractId)}`:""}`);return n.searchParams.set("sesamy-redirect-url",r.redirectUrl||"/"),n.toString()},generateChangePaymentLink:(e,r)=>{const t=r.language||"en",n=new URL(`${e.baseUrl}/account/${encodeURIComponent(t)}/subscriptions/${encodeURIComponent(e.clientId)}/${encodeURIComponent(r.contractId)}/change-payment-method`);return n.searchParams.set("sesamy-redirect-url",r.redirectUrl||"/"),n.toString()},generateChangePlanLink:(e,r)=>{const t=r.language||"en",n=new URL(`${e.baseUrl}/account/${encodeURIComponent(t)}/subscriptions/${encodeURIComponent(e.clientId)}/${encodeURIComponent(r.contractId)}/edit-plan`);return n.searchParams.set("sesamy-redirect-url",r.redirectUrl||"/"),n.toString()},generateConsumeLink:(e,r)=>{const t=r.language||"en";let n=new URL(`${e.baseUrl}/consume/${encodeURIComponent(t)}/@${encodeURIComponent(e.clientId)}/${encodeURIComponent(r.sku)}`);return r.episodeId?n.href+=`/${encodeURIComponent(r.episodeId)}`:n.href+="/listen",n.searchParams.set("sesamy-redirect-url",r.redirectUrl||"/"),n.toString()}},Ho={generateLink:(e,r)=>{const t=new URL(`${e.apiUrl}/checkouts`);return r.items&&t.searchParams.set("items",JSON.stringify(r.items)),r.email&&t.searchParams.set("email",r.email),r.language&&t.searchParams.set("lang",r.language),r.redirectUrl&&t.searchParams.set("redirect-url",r.redirectUrl),r.giftMode&&t.searchParams.set("gift-mode","true"),r.payerEmail&&t.searchParams.set("payer-email",r.payerEmail),r.requireAddress&&t.searchParams.set("require-address","true"),r.metadata&&Object.entries(r.metadata).forEach(([n,a])=>{t.searchParams.set(`metadata.${n}`,a)}),t.toString()},create:async(e,r)=>e.request("/checkouts",{method:"POST",body:JSON.stringify(r)}),get:async(e,r)=>e.request(`/checkouts/${r}`),update:async(e,r,t)=>e.request(`/checkouts/${r}`,{method:"PATCH",body:JSON.stringify(t)})},Ad={list:async e=>e.request("/bills"),get:async(e,r)=>e.request(`/bills/${r}`)},kd={list:async e=>e.request("/fulfillments"),create:async(e,r)=>e.request("/fulfillments",{method:"POST",body:JSON.stringify(r)})},Ym={get:async(e,r)=>{try{return new URL(r),e.request(r)}catch{return e.request(`/paywalls/${r}`)}}},Qm={list:async e=>e.request("/payment-issues")},Xm={content:async(e,r,t,n,a)=>{const i=new URLSearchParams({url:r});return t&&i.append("selector",t),n&&i.append("cache",n),e.request(`/proxy?${i.toString()}`,a)}},Zm={list:async(e,r)=>{const t=(r?new URLSearchParams({q:r}):new URLSearchParams).toString(),n=t?`/transactions?${t}`:"/transactions";return e.request(n)}},qd={get:async e=>e.request("/vendor"),list:async e=>e.request("/vendors")},eg=e=>{const r=Km(e);return{profile:{get:t=>_t.get(r,t),update:(t,n)=>_t.update(r,t,n),checkSpotifyLink:()=>_t.checkSpotifyLink(r),unlinkSpotify:()=>_t.unlinkSpotify(r),delete:()=>_t.delete(r)},entitlements:{list:t=>Mo.list(r,t),get:t=>Mo.get(r,t),getAccess:t=>Mo.getAccess(r,t)},subscriptions:{list:()=>Od.list(r),get:t=>Od.get(r,t)},products:{get:t=>Cd.get(r,t),autoOnboard:t=>Cd.autoOnboard(r,t)},contracts:{list:async()=>{const t=await At.list(r),n=await e.tokenProvider();if(!n.toLowerCase().startsWith("bearer "))return t;const a=n.substring(7);return t.map(i=>_d(i,a))},get:async t=>{const n=await At.get(r,t),a=await e.tokenProvider();if(!a.toLowerCase().startsWith("bearer "))return n;const i=a.substring(7);return _d(n,i)},cancel:t=>At.cancel(r,t),createAmendment:(t,n)=>At.createAmendment(r,t,n),confirmAmendment:(t,n)=>At.confirmAmendment(r,t,n)},userMetadata:{get:()=>Fo.get(r),set:(t,n)=>Fo.set(r,t,n),delete:t=>Fo.delete(r,t)},tallies:{list:()=>rt.list(r),get:t=>rt.get(r,t),update:(t,n)=>rt.update(r,t,n),create:t=>rt.create(r,t),delete:t=>rt.delete(r,t),push:(t,n)=>rt.push(r,t,n)},tags:{list:()=>Bo.list(r),add:t=>Bo.add(r,t),remove:t=>Bo.remove(r,t)},checkouts:{generateLink:(t,n)=>tt.generateCheckoutLink(t,n),create:t=>Ho.create(r,t),get:t=>Ho.get(r,t),update:(t,n)=>Ho.update(r,t,n)},links:{generateCheckoutLink:(t,n)=>tt.generateCheckoutLink(t,n),generateAccountLink:(t,n)=>tt.generateAccountLink(t,n),generateChangePaymentLink:(t,n)=>tt.generateChangePaymentLink(t,n),generateChangePlanLink:(t,n)=>tt.generateChangePlanLink(t,n),generateConsumeLink:(t,n)=>tt.generateConsumeLink(t,n)},bills:{list:()=>Ad.list(r),get:t=>Ad.get(r,t)},fulfillments:{list:()=>kd.list(r),create:t=>kd.create(r,t)},paywalls:{get:t=>Ym.get(r,t)},paymentIssues:{list:()=>Qm.list(r)},proxy:{content:(t,n,a,i)=>Xm.content(r,t,n,a,i)},transactions:{list:t=>Zm.list(r,t)},vendor:{get:()=>qd.get(r),list:()=>qd.list(r)}}},rg="sesamy.com",tg="sesamy.dev",ng="https://sesa.my",$d="sesamyCacheTimestamp",Ud="sesamyContentReloaded";class ag{get(r){return typeof sessionStorage>"u"?null:sessionStorage.getItem(r)}set(r,t){typeof sessionStorage<"u"&&sessionStorage.setItem(r,t)}remove(r){typeof sessionStorage<"u"&&sessionStorage.removeItem(r)}clear(){}}function ig(e,r){return`${e}.${r==="dev"?tg:rg}`}function or(e,r){return`https://${ig(e,r)}`}function un(){let r=(document.documentElement.getAttribute("lang")??navigator.language??"en").split("-")[0]?.toLowerCase()??"en";return r==="nn"&&(r="nb"),r}function Go(e){let r;try{r=new URL(e)}catch{return!1}return r.protocol==="http:"||r.protocol==="https:"}function Ld(e,r){if(Go(e))return{itemSrc:e};const t=e.split(":");if(t.length<2)throw new Error(`Invalid itemSrc format: expected at least 2 segments separated by ':', got ${t.length}`);const[n,a,i]=t;if(!a)throw new Error("Invalid itemSrc format: sku segment is empty");return{sku:`${n}:${a}`,purchaseOption:r||i}}function Nd(e){return e.endsWith("/")?e.slice(0,-1):e}function xd(e,r){if(!Go(e)||!Go(r))return!1;const t=new URL(e),n=new URL(r);return t.origin===n.origin&&Nd(t.pathname)===Nd(n.pathname)}function og(e,r,t){const n=new URL(`${or("checkout3",e.environment)}`);r.language&&n.searchParams.set("lang",r.language);let a=r.sku,i=r.purchaseOptionId,o=r.itemSrc;if(r.itemSrc){const l=Ld(r.itemSrc,r.purchaseOptionId);a=l.sku||a,i=l.purchaseOption||i,o=l.itemSrc}a?(n.searchParams.set("sku",a),i&&n.searchParams.set("po-id",i)):o&&n.searchParams.set("url",o),r.email&&n.searchParams.set("email",r.email),r.business&&n.searchParams.set("business","true"),r.currency&&n.searchParams.set("currency",r.currency),r.price&&n.searchParams.set("price",r.price.toString()),r.discountCode&&n.searchParams.set("discount-code",r.discountCode),r.attributionItemSrc?n.searchParams.set("itemSrc",r.attributionItemSrc):t.itemSrc&&n.searchParams.set("itemSrc",t.itemSrc),r.attributionPublisherContentId?n.searchParams.set("publisherContentId",r.attributionPublisherContentId):t.publisherContentId&&n.searchParams.set("publisherContentId",t.publisherContentId),r.utmSource?n.searchParams.set("utm_source",r.utmSource):t.utmSource&&n.searchParams.set("utm_source",t.utmSource),r.utmMedium?n.searchParams.set("utm_medium",r.utmMedium):t.utmMedium&&n.searchParams.set("utm_medium",t.utmMedium),r.utmCampaign?n.searchParams.set("utm_campaign",r.utmCampaign):t.utmCampaign&&n.searchParams.set("utm_campaign",t.utmCampaign),r.utmTerm?n.searchParams.set("utm_term",r.utmTerm):t.utmTerm&&n.searchParams.set("utm_term",t.utmTerm),r.utmContent?n.searchParams.set("utm_content",r.utmContent):t.utmContent&&n.searchParams.set("utm_content",t.utmContent);const s=["_ga","_gid","_fbp","_fbc"];document.cookie.split(";").map(l=>{const[f,v]=l.trim().split("=");return{key:f,value:v}}).filter(l=>s.some(f=>f===l.key)).forEach(l=>{n.searchParams.append(l.key,l.value)});let c=new URL(window.location.href);if(r.redirectUrl)try{c=new URL(r.redirectUrl)}catch{console.warn("Invalid redirect URL provided, using current URL instead:",r.redirectUrl)}return c.searchParams.set("force-refetch-entitlements","true"),r.itemSrc&&c.searchParams.set("sesamy-purchase",r.itemSrc),n.searchParams.set("redirect-url",c.toString()),r.paymentMethodsFilter&&n.searchParams.set("paymentmethods-filter",r.paymentMethodsFilter.flatMap(({provider:l,methods:f})=>f?f.map(v=>`${l}|${v}`):l).join(",")),r.requireAddress&&n.searchParams.set("require-address","true"),r.giftMode&&n.searchParams.set("gift-mode","true"),r.payerEmail&&n.searchParams.set("payer-email",r.payerEmail),r.metadata&&Object.entries(r.metadata).forEach(([l,f])=>{n.searchParams.set(`metadata.${l}`,String(f))}),n}const jd="sesamySignedURLs";function Wo(){const e=sessionStorage.getItem(jd);return e?JSON.parse(e):[]}function Dd(e){const r=Wo();r.push(e),de(`Adding signed URL: ${e}`),sessionStorage.setItem(jd,JSON.stringify(r))}function sg(e){const r={};return Object.keys(e).forEach(t=>{const n=e[t];n!=null&&(r[t]=n.toString())}),r}const Vo="sesamyAttribution";function ug(e){const r=localStorage.getItem(e);if(!r)return null;try{return JSON.parse(r).value}catch{return console.error(`Failed to parse ${e}`),null}}function cg(e){return Object.keys(e).find(r=>r.startsWith("utm_"))?{utmSource:void 0,utmMedium:void 0,utmCampaign:void 0,...e}:e}function cn(){return ug(Vo)||{}}function Md(e){if(e===null)localStorage.removeItem(Vo);else{de(`Setting attribution ${JSON.stringify(e)}`);const r=cn()??{},t=sg({...r,...cg(e)});localStorage.setItem(Vo,JSON.stringify({value:t}))}}const zo="@sesamy/sesamy-js",kt="1.93.0",Fd="sesamyFlags";async function Bd(e){try{localStorage.setItem(Fd,JSON.stringify(e))}catch{de("Failed to save flags to localStorage")}}async function Hd(e,r){const t=await qt();t[e]=r,await Bd(t)}async function Gd(e){return(await qt())[e]}async function Wd(e){const r=await qt();e in r&&(delete r[e],await Bd(r))}async function qt(){try{const e=localStorage.getItem(Fd);return e?JSON.parse(e):{}}catch{return{}}}function Vd(e){function r(n){return n.id?`#${n.id}`:n.classList.length>0?Array.from(n.classList).map(i=>`.${i}`).join(""):null}function t(n){const a=[];let i=n;for(;i&&i!==document.body&&i!==document.documentElement;){const o=r(i);if(o){a.unshift(o);break}if(i.parentElement){const s=Array.from(i.parentElement.children),u=s.indexOf(i)+1,c=i.tagName.toLowerCase();s.filter(f=>f.tagName.toLowerCase()===c).length>1?a.unshift(`${c}:nth-child(${u})`):a.unshift(c)}i=i.parentElement}return a.join(" > ")}return t(e)}function zd(e){return e?Object.fromEntries(Object.entries(e).filter(([r,t])=>t!==void 0)):{}}function lg(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}let De={article:{selector:"sesamy-article"},image:{selector:"img",attribute:"src"},title:{selector:"h1",attribute:"textContent"},excerpt:{selector:"p",attribute:"textContent"},price:{selector:"sesamy-article",attribute:"price"},currency:{selector:"sesamy-article",attribute:"currency"},url:{selector:"sesamy-article",attribute:"item-src"},accessLevel:{selector:"sesamy-article",attribute:"access-level"},id:{selector:"sesamy-article",attribute:"publisher-content-id"},pass:{selector:"sesamy-article",attribute:"pass"},paywallUrl:{selector:"sesamy-article",attribute:"paywall-url"}},Kd=[],Jd=!1,Ir;function Ko(){const e=window.location.pathname,r=new URLSearchParams(window.location.search),t=navigator.userAgent;return Kd.find(n=>{if(n.path&&!e.includes(n.path)||n.queryParam&&r.get(n.queryParam.key)!==n.queryParam.value)return!1;if(n.headers){const a=n.headers.name.toLowerCase(),i=n.headers.contains.toLowerCase();if(a==="user-agent"){if(!t.toLowerCase().includes(i))return!1}else return!1}return!(n.userAgentContains&&!t.includes(n.userAgentContains))})}function fg(){return Ko()}function dg(e,r){Kd=e.content||[];const t=Ko();t&&t.type==="article"&&(De={...De,...zd(t.selectors)},Jd=t.enablePaywallSettingsUrlFallback||!1),Ir=r}function vg(e,r){const{selector:t,attribute:n}=r;return t===De.article.selector||n&&e.hasAttribute(n)?e:e.querySelector(t)}function Yd(e,r,t=!1){if(e){if(r.attribute){if(r.attribute==="textContent")return e.textContent??void 0;const n=e.getAttribute(r.attribute),a=Yd(e.parentElement,r,t);if(t){const i=[];return n&&i.push(...n.split(",").map(o=>o.trim()).filter(Boolean)),a&&i.push(...a.split(",").map(o=>o.trim()).filter(Boolean)),i.length>0?[...new Set(i)].join(","):void 0}return n??a}return e.textContent??void 0}}function ge(e){const r=document.head.querySelectorAll(`[property~='${e}'][content]`);for(let n=0;n<r.length;n+=1)if(r[n].content)return r[n].content;const t=document.head.querySelectorAll(`[name~='${e}'][content]`);for(let n=0;n<t.length;n+=1)if(t[n].content)return t[n].content}function $t(e){const r=[];return document.head.querySelectorAll(`[property~='${e}'][content]`).forEach(a=>{a.content&&r.push(a.content)}),document.head.querySelectorAll(`[name~='${e}'][content]`).forEach(a=>{a.content&&r.push(a.content)}),r}let Ut=null;function Qd(){const e=[],r=document.querySelectorAll('script[type="application/ld+json"]');for(const t of r)try{const n=JSON.parse(t.textContent||"");Array.isArray(n)?e.push(...n):n["@graph"]&&Array.isArray(n["@graph"])?e.push(...n["@graph"]):e.push(n)}catch{}return e}function Lt(e){const r=Qd(),t=n=>!e||n["@type"]===e||Array.isArray(n["@type"])&&n["@type"].includes(e);return r.find(t)||null}function hg(e){const r=Qd(),t=n=>!e||n["@type"]===e||Array.isArray(n["@type"])&&n["@type"].includes(e);return r.filter(t)}function Jo(e,r,t){if(!e||typeof e!="object")return typeof e=="string"?e:void 0;const a=e[r];if(typeof a=="string")return a;if(a&&typeof a=="object"&&t)return a[t]}function pg(e){if(!e)return;const t=(Array.isArray(e)?e:[e]).map(n=>{if(typeof n=="string")return{name:n};if(typeof n=="object"&&n!==null){const a=n,i=a.name;return i?{name:i,url:a.url,image:Jo(a,"image","url"),jobTitle:a.jobTitle,sameAs:a.sameAs}:null}return null}).filter(n=>n!==null&&!!n.name);return t.length>0?t:void 0}function Yo(e){if(Array.isArray(e))return e.filter(r=>typeof r=="string");if(typeof e=="string"){const r=e.split(",").map(t=>t.trim()).filter(Boolean);return r.length>0?r:void 0}}function Xd(){if(Ut)return Ut;const e=Lt("NewsArticle")||Lt("Article")||Lt("BlogPosting")||Lt("WebPage"),r=(...a)=>a.find(i=>i!=null&&i!=="")||void 0,t=(...a)=>a.find(i=>i&&i.length>0),n={contentType:e?Array.isArray(e["@type"])?e["@type"][0]:e["@type"]:void 0,authors:pg(e?.author)||($t("article:author").length>0?$t("article:author").map(a=>({name:a})):void 0)||(ge("author")?[{name:ge("author")}]:void 0),keywords:t(Yo(e?.keywords),Yo(ge("keywords"))),tags:$t("article:tag").length>0?$t("article:tag"):void 0,categories:Yo(ge("news_keywords")),section:r(e?.articleSection,ge("article:section")),publishedAt:r(e?.datePublished,ge("article:published_time")),modifiedAt:r(e?.dateModified,ge("article:modified_time")),ogType:ge("og:type"),ogSiteName:ge("og:site_name"),ogLocale:ge("og:locale"),twitterCard:ge("twitter:card"),twitterSite:ge("twitter:site"),twitterCreator:ge("twitter:creator"),creator:r(ge("creator"),ge("dc.creator")),mainEntityOfPage:e?Jo(e.mainEntityOfPage,"@id")||(typeof e.mainEntityOfPage=="string"?e.mainEntityOfPage:void 0):void 0,isAccessibleForFree:typeof e?.isAccessibleForFree=="boolean"?e.isAccessibleForFree:void 0,wordCount:typeof e?.wordCount=="number"?e.wordCount:void 0,publisher:e?.publisher&&typeof e.publisher=="object"?{name:e.publisher.name||"",url:e.publisher.url,logo:Jo(e.publisher,"logo","url")}:void 0};return Ut=zd(n),Ut}function mg(){Ut=null}function Qo({publisherContentId:e,key:r,defaultValue:t=""}){const n=e?document.body.querySelector(`sesamy-content-data[id='${e}']`):null,a=r.replace(/-([a-z])/g,(i,o)=>o.toUpperCase());return n?.getAttribute(r)||ge(`sesamy:${r}`)||ge(`sesamy:${a}`)||ge(`og:${r}`)||ge(r)||t}function Zd(){const e=document.querySelectorAll(De.article.selector);return Array.from(e).map(Nt).filter(r=>r!==null)}function Nt(e){const r=typeof e=="string"?document.querySelector(e):e;if(!r)return null;const t={element:r,selector:typeof e=="string"?e:Vd(r)},n=(i,o,s,u)=>{const{transform:c,collect:l=!1}=u||{},f=vg(r,o),v=Yd(f,o,l),d=Qo({publisherContentId:s,key:lg(String(i))}),h=v||d||void 0;h&&(t[i]=c?c(h):h)};n("id",De.id),n("title",De.title,t.id),n("excerpt",De.excerpt,t.id),n("image",De.image,t.id),n("price",De.price,t.id,{transform:i=>{const o=parseFloat(i);return Number.isNaN(o)?void 0:o}}),n("currency",De.currency,t.id),n("url",De.url,t.id),n("pass",De.pass,t.id,{collect:!0}),n("paywallUrl",De.paywallUrl,t.id),n("accessLevel",De.accessLevel,t.id,{transform:i=>i||"entitlement"});const a=Ko();if(a&&a.type==="article"&&(a.pass&&(t.pass=t.pass?`${t.pass},${a.pass}`:a.pass),a.price&&!t.price&&(t.price=a.price.amount),a.price?.currency&&!t.currency&&(t.currency=a.price.currency),a.paywallUrl&&!t.paywallUrl&&(t.paywallUrl=a.paywallUrl)),Jd&&!t.paywallUrl){const i=document.querySelector("sesamy-paywall");if(i){const o=i.getAttribute("settings-url");o&&(t.paywallUrl=o)}}return t.url||(t.url=window.location.href),t.metadata=Xd(),t}async function gg(e){const r=Nt(e);if(!r)throw new Error("Could not find article element");if(r.accessLevel==="public")return!0;if(r.accessLevel==="logged-in"&&!r.paywallUrl)return await Ir.auth.isAuthenticated()?!0:null;if(r.paywallUrl&&((await Ir.paywalls.get(r.paywallUrl)).settings.template==="LOGIN"?"logged-in":"entitlement")==="logged-in")return await Ir.auth.isAuthenticated()?!0:null;if(!r.url)throw new Error("Article must have a URL");return await Ir.entitlements.hasAccess(r.url,r.pass?.split(",")||[])||null}async function ev(e,r){const t=typeof e=="string"?document.querySelector(e):e;if(!t)throw new Error("Could not find element");const n=Nt(t);if(!n?.url)throw new Error("Could not find content for element");const a=await Ir.entitlements.hasAccess(n.url,n.pass?.split(",")||[]);if(!a)throw new Error("User does not have access to the content");let i;if(!a.id&&a.token)i=a.token;else{const s=await Ir.entitlements.access(a.id);if(!s.token)throw new Error("Could not get access token");i=s.token}const o=r||Vd(t.parentElement||t);return Ir.proxy.getContent(i,n.url,o)}function rv(e,r={}){const{closeOnBackdropClick:t=!0,closeOnEscape:n=!0,zIndex:a=2147483647,backdropBlur:i="5px",overlayBackground:o="rgba(0,0,0,0.5)"}=r,s=document.createElement("div");s.setAttribute("data-sesamy-modal","true"),Object.assign(s.style,{position:"fixed",top:"0",left:"0",width:"100vw",height:"100vh",background:o,zIndex:String(a),display:"flex",alignItems:"center",justifyContent:"center",backdropFilter:`blur(${i})`});const u=document.createElement("div");u.setAttribute("data-sesamy-modal-content","true"),typeof e=="string"?u.innerHTML=e:u.appendChild(e),s.appendChild(u);const c=()=>{s.remove(),n&&document.removeEventListener("keydown",l)},l=f=>{f.key==="Escape"&&c()};return t&&s.addEventListener("click",f=>{f.target===s&&c()}),n&&document.addEventListener("keydown",l),document.body.appendChild(s),{element:s,close:c}}function yg(e,r={}){const{position:t="top",fixed:n=!0,zIndex:a=2147483647,autoDismissMs:i,pushContent:o=!1,height:s,transitionDuration:u="0.3s"}=r,c=document.createElement("div");c.setAttribute("data-sesamy-notification-bar","true"),c.setAttribute("data-sesamy-notification-position",t),Object.assign(c.style,{position:n?"fixed":"absolute",[t]:"0",left:"0",width:"100%",zIndex:String(a),boxSizing:"border-box",...s&&{height:s}}),typeof e=="string"?c.innerHTML=e:c.appendChild(e);let l,f,v;const d=()=>{if(v&&clearTimeout(v),o&&s){const h=document.documentElement;h.style.transform=l||"",setTimeout(()=>{c.remove(),h.style.transition=f||""},parseFloat(u)*1e3)}else c.remove()};if(i&&(v=setTimeout(d,i)),o&&s){const h=document.documentElement;l=h.style.transform,f=h.style.transition,h.style.transition=`transform ${u} ease`,c.style.transition=`transform ${u} ease`,t==="top"?(h.style.transform=`translateY(${s})`,c.style.transform=`translateY(-${s})`):(h.style.transform=`translateY(-${s})`,c.style.transform=`translateY(${s})`),document.documentElement.prepend(c)}else document.body.appendChild(c);return{element:c,close:d}}function bg(e){const r=e.endpoint??or("api2",e.environment),n=eg({baseUrl:r,tokenProvider:async()=>{if(await dr())try{const U=await vr(!1);return U?`Bearer ${U}`:null}catch{}const m=localStorage.getItem("__anon_id");return`Basic ${btoa(`${e.vendorId||e.clientId}|${m}:`)}`},libraryName:zo,libraryVersion:kt,vendorId:e.vendorId,cache:{mode:sn.BROWSER,storage:new ag}}),a=m=>async(C,U)=>{let F=sessionStorage.getItem($d);F||(F=Date.now().toString(),sessionStorage.setItem($d,F));const w={...U,headers:{...U.headers,"Cache-Timestamp":F}};return m(C,w)},i=(m=!0)=>C=>async(U,F)=>{const w=await vr(m);if(!w){if(await dr()){const N={...F,credentials:"include"};return C(U,N)}if(m)throw new Error("No access token available");return C(U,F)}const T={...F,headers:{...F.headers,Authorization:`Bearer ${w}`}};return C(U,T)},o=ir(r).headers({"Content-Type":"application/json"}).middlewares([a,i(),Sm(),Em({delayTimer:1e3,delayRamp:(m,C)=>m*C,maxAttempts:3,until:m=>!!(m&&(m.ok||m.status>=400&&m.status<500)),retryOnNetworkError:!1})]);async function s(m={}){const{waitForEntitlementAfter:C,includeSignedLinks:U=!0}=m,F=await dr()?await n.entitlements.list({waitForEntitlementAfter:C?.toISOString()}):[];return U&&F.push(...Wo()),F}async function u(m,C=[]){return(await s())?.find(w=>{if(m){const{sku:T,purchaseOption:N}=Ld(m);if("sku"in w&&T===w.sku||N&&"purchaseOptionsId"in w&&N===w.purchaseOptionsId||xd(m,w.url))return!0}return!!C.some(T=>xd(T,w.url))})}async function c(m,C,U){const F=new URL(r,window.location.origin);return F.pathname=F.pathname.replace(/\/$/,"")+"/proxy",F.searchParams.set("url",C),U&&F.searchParams.set("selector",U),ir(F.toString()).headers({Authorization:`Bearer ${m}`}).get().text()}async function l(m){if(!m)throw new Error("SKU is required to get fulfillments");return await dr()?await o.get(`/fulfillments?sku=${encodeURIComponent(m)}`).json():[]}async function f(m,C){if(!m||!C)throw new Error("SKU and itemId are required to request delivery");return(await o.post({sku:m},`/fulfillments/${encodeURIComponent(C)}/request-delivery?`).res()).ok}async function v(){return console.warn("getSubscriptions is deprecated, use getContracts instead"),o.get("/subscriptions").json()}async function d(m){return(await n.transactions.list())?.find(U=>U.id===m)}async function h(){return await o.url("/tags").get().json()}async function p(m){const C=await o.url(`/tags/${encodeURIComponent(m)}`).delete().res();return hr(),C.ok}async function S(m){const C=await o.url("/tags").post(encodeURIComponent(m)).res();return $r(er.USER_ATTRIBUTE_CHANGED,{}),hr(),C.ok}async function R(m){return(await n.tallies.get(m)).value}async function I(){const m=await n.tallies.list(),C={};for(const U of m)C[U.id]=U.value;return C}async function g(m){return await n.tallies.delete(m)}async function b(m,C){return await n.tallies.push(m,C)}async function y(){return await vr(!1)?await o.url("/profile").get().json():null}async function A(m){const C=await o.url("/profile").patch(m).res();return hr(),C.ok}async function q(){return(await o.url("/profile/spotify-link").get().json()).isSpotifyLinked}async function j(){return(await o.url("/profile/unlink-spotify").post().res()).ok}async function G(m){const C=await vr(!1);if(!C)throw new Error("No access token available");const U=new URL(`${or("access-sync",e.environment)}/spotify/sesamy-callback`);U.searchParams.set("access_token",C),U.searchParams.set("state",m),window.location.href=U.toString()}async function K(m){const C=await o.url(`/products/${encodeURIComponent(m)}/auto-onboard`).post().json();return C.length&&hr(),C}async function re(m,C=3600){const{shortlink:U}=await ir(ng).post({url:m,ttl:C}).json();return U}async function L(m){const C=await vr(!1,!0);let U;const F=m.language||un(),w=cn();switch(m.target){case"account":U=new URL(`${or("account",e.environment)}/${encodeURIComponent(m.language||F)}/subscriptions/${encodeURIComponent(e.vendorId||e.clientId)}${m.contractId?`/${encodeURIComponent(m.contractId)}`:""}`),U.searchParams.set("sesamy-redirect-url",m.redirectUrl||window.location.href);break;case"change-payment":U=new URL(`${or("account",e.environment)}/${encodeURIComponent(m.language||F)}/subscriptions/${encodeURIComponent(e.vendorId||e.clientId)}/${encodeURIComponent(m.contractId)}/change-payment-method`),U.searchParams.set("sesamy-redirect-url",m.redirectUrl||window.location.href);break;case"change-plan":U=new URL(`${or("account",e.environment)}/${encodeURIComponent(m.language||F)}/subscriptions/${encodeURIComponent(e.vendorId||e.clientId)}/${encodeURIComponent(m.contractId)}/edit-plan`),U.searchParams.set("sesamy-redirect-url",m.redirectUrl||window.location.href);break;case"consume":U=new URL(`${or("consume",e.environment)}/${encodeURIComponent(m.language||F)}/@${encodeURIComponent(e.vendorId||e.clientId)}/${encodeURIComponent(m.sku)}`),m.episodeId?U.href+=`/${m.episodeId}`:U.href+="/listen",U.searchParams.set("sesamy-redirect-url",m.redirectUrl||window.location.href);break;case"checkout":U=og(e,{language:F,...m},w);break;default:throw new Error("Invalid target")}return C&&(U.hash=`#access_token=${C}`),m.shorten?re(U.href,m.ttl):U.href}async function M(){const m=await vr(!1),C=new URL(`${or("account",e.environment)}/subscriptions/${e.vendorId||e.clientId}`);m&&(C.hash=`#access_token=${m}`),window.location.href=C.toString()}async function x(m){const C=cn(),U=["_ga","_gid","_fbp","_fbc"];return document.cookie.split(";").forEach(F=>{const[w,T]=F.trim().split("=");U.includes(w)&&!C[w]&&(C[w]=T)}),n.checkouts.create({language:un(),...m,attribution:{...C,...m.attribution}})}return{autoOnboardProduct:K,bills:n.bills,checkouts:{create:x,get:n.checkouts.get,update:n.checkouts.update},content:{list:Zd,get:Nt,getLanguage:un,unlock:ev,getPropertyFromHTML:Qo},contracts:n.contracts,deleteTag:p,deleteTally:g,entitlements:n.entitlements,flags:{get:Gd,set:Hd,list:qt,delete:Wd},generateLink:L,getProxyContent:c,getEntitlements:s,getFulfillments:l,requestDelivery:f,hasAccess:u,isSpotifyLinked:q,linkSpotify:G,openHostedAccountPage:M,paywalls:n.paywalls,paymentIssues:n.paymentIssues,getProfile:y,products:n.products,getSubscriptions:v,getTally:R,getTallies:I,getTags:h,getTransaction:d,transactions:n.transactions,userMetadata:n.userMetadata,pushTally:b,setTag:S,unlinkSpotify:j,updateProfile:A,vendor:n.vendor}}function tv(e,r,t,n,a){for(r=r.split?r.split("."):r,n=0;n<r.length;n++)e=e?e[r[n]]:a;return e===a?t:e}var wg="function",Sg="string",rr="undefined",Ig="boolean",ln="object",Pg="array",Eg="number",Rg="symbol",Tg="null",Xo=function(){},nv="any",av="*",Lr="__",Og="form",Cg="input",_g="button",Ag="select",fn=typeof process!==rr?process:{};fn.env&&fn.env.NODE_ENV;var Ce=typeof document!==rr;fn.versions!=null&&fn.versions.node!=null,typeof Deno!==rr&&Deno.core,Ce&&window.name==="nodejs"||typeof navigator!==rr&&typeof navigator.userAgent!==rr&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));function iv(e,r){return r.charAt(0)[e]()+r.slice(1)}var kg=iv.bind(null,"toUpperCase"),qg=iv.bind(null,"toLowerCase");function $g(e){return ov(e)?kg(Tg):typeof e===ln?xg(e):Object.prototype.toString.call(e).slice(8,-1)}function dn(e,r){r===void 0&&(r=!0);var t=$g(e);return r?qg(t):t}function xt(e,r){return typeof r===e}var Me=xt.bind(null,wg),Pr=xt.bind(null,Sg),nt=xt.bind(null,rr),Ug=xt.bind(null,Ig);xt.bind(null,Rg);function ov(e){return e===null}function Lg(e){return dn(e)===Eg&&!isNaN(e)}function sv(e){return dn(e)===Pg}function Fe(e){if(!Ng(e))return!1;for(var r=e;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r}function Ng(e){return e&&(typeof e===ln||e!==null)}function xg(e){return Me(e.constructor)?e.constructor.name:null}function jg(e){return e instanceof Error||Pr(e.message)&&e.constructor&&Lg(e.constructor.stackTraceLimit)}function uv(e,r){if(typeof r!="object"||ov(r))return!1;if(r instanceof e)return!0;var t=dn(new e(""));if(jg(r))for(;r;){if(dn(r)===t)return!0;r=Object.getPrototypeOf(r)}return!1}uv.bind(null,TypeError),uv.bind(null,SyntaxError);function vn(e,r){var t=e instanceof Element||e instanceof HTMLDocument;return t&&r?Dg(e,r):t}function Dg(e,r){return r===void 0&&(r=""),e&&e.nodeName===r.toUpperCase()}function hn(e){var r=[].slice.call(arguments,1);return function(){return e.apply(void 0,[].slice.call(arguments).concat(r))}}hn(vn,Og),hn(vn,_g),hn(vn,Cg),hn(vn,Ag);function Mg(e){return e?sv(e)?e:[e]:[]}function cv(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function Fg(){if(Ce){var e=navigator,r=e.languages;return e.userLanguage||(r&&r.length?r[0]:e.language)}}function Bg(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function Hg(e){return(function(r){for(var t,n=Object.create(null),a=/([^&=]+)=?([^&]*)/g;t=a.exec(r);){var i=cv(t[1]),o=cv(t[2]);if(i)if(i.substring(i.length-2)==="[]"){var s=n[i=i.substring(0,i.length-2)]||(n[i]=[]);n[i]=Array.isArray(s)?s:[],n[i].push(o)}else n[i]=o===""||o}for(var u in n){var c=u.split("[");c.length>1&&(Gg(n,c.map(function(l){return l.replace(/[?[\]\\ ]/g,"")}),n[u]),delete n[u])}return n})((function(r){return Ce&&window.location.search.substring(1)})())}function Gg(e,r,t){for(var n=r.length-1,a=0;a<n;++a){var i=r[a];if(i==="__proto__"||i==="constructor")break;i in e||(e[i]={}),e=e[i]}e[r[n]]=t}function pn(){for(var e="",r=0,t=4294967295*Math.random()|0;r++<36;){var n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[r-1],a=15&t;e+=n=="-"||n=="4"?n:(n=="x"?a:3&a|8).toString(16),t=r%8==0?4294967295*Math.random()|0:t>>4}return e}function Wg(e,r){var t,n,a,i=null,o=0,s=function(){o=new Date,i=null,a=e.apply(t,n)};return function(){var u=new Date;o||(o=u);var c=r-(u-o);return t=this,n=arguments,c<=0?(clearTimeout(i),i=null,o=u,a=e.apply(t,n)):i||(i=setTimeout(s,c)),a}}var Nr="global",at=Lr+Nr+Lr,it=typeof self===ln&&self.self===self&&self||typeof global===ln&&global[Nr]===global&&global||void 0;function xr(e){return it[at][e]}function jr(e,r){return it[at][e]=r}function ot(e){delete it[at][e]}function st(e,r,t){var n;try{if(Zo(e)){var a=window[e];n=a[r].bind(a)}}catch{}return n||t}it[at]||(it[at]={});var mn={};function Zo(e){if(typeof mn[e]!==rr)return mn[e];try{var r=window[e];r.setItem(rr,rr),r.removeItem(rr)}catch{return mn[e]=!1}return mn[e]=!0}function Z(){return Z=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},Z.apply(null,arguments)}var Er="function",pr="undefined",jt="reducer",lv="@@redux/",es=lv+"INIT",Vg=lv+Math.random().toString(36),fv=(function(){return typeof Symbol===Er&&Symbol.observable||"@@observable"})(),gn=" != "+Er;function dv(e,r,t){var n;if(typeof r===Er&&typeof t===pr&&(t=r,r=void 0),typeof t!==pr){if(typeof t!==Er)throw new Error("enhancer"+gn);return t(dv)(e,r)}if(typeof e!==Er)throw new Error(jt+gn);var a=e,i=r,o=[],s=o,u=!1;function c(){s===o&&(s=o.slice())}function l(){return i}function f(d){if(typeof d!==Er)throw new Error("Listener"+gn);var h=!0;return c(),s.push(d),function(){if(h){h=!1,c();var p=s.indexOf(d);s.splice(p,1)}}}function v(d){if(!Fe(d))throw new Error("Act != obj");if(typeof d.type===pr)throw new Error("ActType "+pr);if(u)throw new Error("Dispatch in "+jt);try{u=!0,i=a(i,d)}finally{u=!1}for(var h=o=s,p=0;p<h.length;p++)(0,h[p])();return d}return v({type:es}),(n={dispatch:v,subscribe:f,getState:l,replaceReducer:function(d){if(typeof d!==Er)throw new Error("next "+jt+gn);a=d,v({type:es})}})[fv]=function(){var d,h=f;return(d={subscribe:function(p){if(typeof p!="object")throw new TypeError("Observer != obj");function S(){p.next&&p.next(l())}return S(),{unsubscribe:h(S)}}})[fv]=function(){return this},d},n}function zg(e,r){var t=r&&r.type;return"action "+(t&&t.toString()||"?")+jt+" "+e+" returns "+pr}function ut(){var e=[].slice.call(arguments);return e.length===0?function(r){return r}:e.length===1?e[0]:e.reduce(function(r,t){return function(){return r(t.apply(void 0,[].slice.call(arguments)))}})}function Kg(){var e=arguments;return function(r){return function(t,n,a){var i,o=r(t,n,a),s=o.dispatch,u={getState:o.getState,dispatch:function(c){return s(c)}};return i=[].slice.call(e).map(function(c){return c(u)}),Z({},o,{dispatch:s=ut.apply(void 0,i)(o.dispatch)})}}}var Rr=Lr+"anon_id",Dr=Lr+"user_id",ct=Lr+"user_traits",rs="analytics",Tr="userId",lt="anonymousId",yn=["bootstrap","params","campaign","initializeStart","initialize","initializeEnd","ready","resetStart","reset","resetEnd","pageStart","page","pageEnd","pageAborted","trackStart","track","trackEnd","trackAborted","identifyStart","identify","identifyEnd","identifyAborted","userIdChanged","registerPlugins","enablePlugin","disablePlugin","online","offline","setItemStart","setItem","setItemEnd","setItemAborted","removeItemStart","removeItem","removeItemEnd","removeItemAborted"],ts=["name","EVENTS","config","loaded"],ee=yn.reduce(function(e,r){return e[r]=r,e},{registerPluginType:function(e){return"registerPlugin:"+e},pluginReadyType:function(e){return"ready:"+e}}),vv=/^utm_/,hv=/^an_prop_/,pv=/^an_trait_/;function Jg(e){var r=e.storage.setItem;return function(t){return function(n){return function(a){if(a.type===ee.bootstrap){var i=a.params,o=a.user,s=a.persistedUser,u=a.initialUser,c=s.userId===o.userId;s.anonymousId!==o.anonymousId&&r(Rr,o.anonymousId),c||r(Dr,o.userId),u.traits&&r(ct,Z({},c&&s.traits?s.traits:{},u.traits));var l=Object.keys(a.params);if(l.length){var f=i.an_uid,v=i.an_event,d=l.reduce(function(h,p){if(p.match(vv)||p.match(/^(d|g)clid/)){var S=p.replace(vv,"");h.campaign[S==="campaign"?"name":S]=i[p]}return p.match(hv)&&(h.props[p.replace(hv,"")]=i[p]),p.match(pv)&&(h.traits[p.replace(pv,"")]=i[p]),h},{campaign:{},props:{},traits:{}});t.dispatch(Z({type:ee.params,raw:i},d,f?{userId:f}:{})),f&&setTimeout(function(){return e.identify(f,d.traits)},0),v&&setTimeout(function(){return e.track(v,d.props)},0),Object.keys(d.campaign).length&&t.dispatch({type:ee.campaign,campaign:d.campaign})}}return n(a)}}}}function Yg(e){return function(r,t){if(r===void 0&&(r={}),t===void 0&&(t={}),t.type===ee.setItemEnd){if(t.key===Rr)return Z({},r,{anonymousId:t.value});if(t.key===Dr)return Z({},r,{userId:t.value})}switch(t.type){case ee.identify:return Object.assign({},r,{userId:t.userId,traits:Z({},r.traits,t.traits)});case ee.reset:return[Dr,Rr,ct].forEach(function(n){e.removeItem(n)}),Object.assign({},r,{userId:null,anonymousId:null,traits:{}});default:return r}}}function mv(e){return{userId:e.getItem(Dr),anonymousId:e.getItem(Rr),traits:e.getItem(ct)}}var ns=function(e){return Lr+"TEMP"+Lr+e};function Qg(e){var r=e.storage,t=r.setItem,n=r.removeItem,a=r.getItem;return function(i){return function(o){return function(s){var u=s.userId,c=s.traits,l=s.options;if(s.type===ee.reset&&([Dr,ct,Rr].forEach(function(d){n(d)}),[Tr,lt,"traits"].forEach(function(d){ot(ns(d))})),s.type===ee.identify){a(Rr)||t(Rr,pn());var f=a(Dr),v=a(ct)||{};f&&f!==u&&i.dispatch({type:ee.userIdChanged,old:{userId:f,traits:v},new:{userId:u,traits:c},options:l}),u&&t(Dr,u),c&&t(ct,Z({},v,c))}return o(s)}}}}var Dt={};function gv(e,r){Dt[e]&&Me(Dt[e])&&(Dt[e](r),delete Dt[e])}function yv(e,r,t){return new Promise(function(n,a){return r()?n(e):t<1?a(Z({},e,{queue:!0})):new Promise(function(i){return setTimeout(i,10)}).then(function(i){return yv(e,r,t-10).then(n,a)})})}function Xg(e){return{abort:e}}function bv(e,r,t){var n={},a=r(),i=e.getState(),o=i.plugins,s=i.queue,u=i.user;if(!i.context.offline&&s&&s.actions&&s.actions.length){var c=s.actions.reduce(function(f,v,d){return o[v.plugin].loaded?(f.process.push(v),f.processIndex.push(d)):(f.requeue.push(v),f.requeueIndex.push(d)),f},{processIndex:[],process:[],requeue:[],requeueIndex:[]});if(c.processIndex&&c.processIndex.length){c.processIndex.forEach(function(f){var v=s.actions[f],d=v.plugin,h=v.payload.type,p=a[d][h];if(p&&Me(p)){var S,R=(function(b,y){return b===void 0&&(b={}),y===void 0&&(y={}),[Tr,lt].reduce(function(A,q){return b.hasOwnProperty(q)&&y[q]&&y[q]!==b[q]&&(A[q]=y[q]),A},b)})(v.payload,u),I=n[R.meta.rid];if(!I&&(S=p({payload:R,config:o[d].config,instance:t,abort:Xg}))&&Fe(S)&&S.abort)return void(n[R.meta.rid]=!0);if(!I){var g=h+":"+d;e.dispatch(Z({},R,{type:g,_:{called:g,from:"queueDrain"}}))}}});var l=s.actions.filter(function(f,v){return!~c.processIndex.indexOf(v)});s.actions=l}}}var as=function(e){var r=e.data,t=e.action,n=e.instance,a=e.state,i=e.allPlugins,o=e.allMatches,s=e.store,u=e.EVENTS;try{var c=a.plugins,l=a.context,f=t.type,v=f.match(ft),d=r.exact.map(function(S){return S.pluginName});v&&(d=o.during.map(function(S){return S.pluginName}));var h=(function(S,R){return function(I,g,b){var y=g.config,A=g.name,q=A+"."+I.type;b&&(q=b.event);var j=I.type.match(ft)?(function(G,K,re,L,M){return function(x,m){var C=L?L.name:G,U=m&&Mt(m)?m:re;if(L&&(!(U=m&&Mt(m)?m:[G]).includes(G)||U.length!==1))throw new Error("Method "+K+" can only abort "+G+" plugin. "+JSON.stringify(U)+" input valid");return Z({},M,{abort:{reason:x,plugins:U,caller:K,_:C}})}})(A,q,R,b,I):(function(G,K){return function(){throw new Error(G.type+" action not cancellable. Remove abort in "+K)}})(I,q);return{payload:Zg(I),instance:S,config:y||{},abort:j}}})(n,d),p=r.exact.reduce(function(S,R){var I=R.pluginName,g=R.methodName,b=!1;return g.match(/^initialize/)||g.match(/^reset/)||(b=!c[I].loaded),l.offline&&g.match(/^(page|track|identify)/)&&(b=!0),S[""+I]=b,S},{});return Promise.resolve(r.exact.reduce(function(S,R,I){var g=R.pluginName;return Promise.resolve(S).then(function(b){function y(){return Promise.resolve(b)}var A=(function(){if(r.namespaced&&r.namespaced[g])return Promise.resolve(r.namespaced[g].reduce(function(q,j,G){return Promise.resolve(q).then(function(K){return j.method&&Me(j.method)?((function(x,m){var C=Ov(x);if(C&&C.name===m){var U=Ov(C.method);throw new Error([m+" plugin is calling method "+x,"Plugins cant call self","Use "+C.method+" "+(U?"or "+U.method:"")+" in "+m+" plugin insteadof "+x].join(`
|
|
3
3
|
`))}})(j.methodName,j.pluginName),Promise.resolve(j.method({payload:K,instance:n,abort:(re=K,L=g,M=j.pluginName,function(x,m){return Z({},re,{abort:{reason:x,plugins:m||[L],caller:f,from:M||L}})}),config:Iv(j.pluginName,c,i),plugins:c})).then(function(x){var m=Fe(x)?x:{};return Promise.resolve(Z({},K,m))})):K;var re,L,M})},Promise.resolve(t))).then(function(q){b[g]=q});b[g]=t})();return A&&A.then?A.then(y):y()})},Promise.resolve({}))).then(function(S){return Promise.resolve(r.exact.reduce(function(R,I,g){try{var b=r.exact.length===g+1,y=I.pluginName,A=i[y];return Promise.resolve(R).then(function(q){var j=S[y]?S[y]:{};if(v&&(j=q),os(j,y))return is({data:j,method:f,instance:n,pluginName:y,store:s}),Promise.resolve(q);if(os(q,y))return b&&is({data:q,method:f,instance:n,store:s}),Promise.resolve(q);if(p.hasOwnProperty(y)&&p[y]===!0)return s.dispatch({type:"queue",plugin:y,payload:j,_:{called:"queue",from:"queueMechanism"}}),Promise.resolve(q);var G=h(S[y],i[y]);return Promise.resolve(A[f]({abort:G.abort,payload:j,instance:n,config:Iv(y,c,i),plugins:c})).then(function(K){var re=Fe(K)?K:{},L=Z({},q,re),M=S[y];if(os(M,y))is({data:M,method:f,instance:n,pluginName:y,store:s});else{var x=f+":"+y;(x.match(/:/g)||[]).length<2&&!f.match(wv)&&!f.match(Sv)&&n.dispatch(Z({},v?L:j,{type:x,_:{called:x,from:"submethod"}}))}return Promise.resolve(L)})})}catch(q){return Promise.reject(q)}},Promise.resolve(t))).then(function(R){if(!(f.match(ft)||f.match(/^registerPlugin/)||f.match(Sv)||f.match(wv)||f.match(/^params/)||f.match(/^userIdChanged/))){if(u.plugins.includes(f),R._&&R._.originalAction===f)return R;var I=Z({},R,{_:{originalAction:R.type,called:R.type,from:"engineEnd"}});Rv(R,r.exact.length)&&!f.match(/End$/)&&(I=Z({},I,{type:R.type+"Aborted"})),s.dispatch(I)}return R})})}catch(S){return Promise.reject(S)}},ft=/Start$/,wv=/^bootstrap/,Sv=/^ready/;function is(e){var r=e.pluginName,t=e.method+"Aborted"+(r?":"+r:"");e.store.dispatch(Z({},e.data,{type:t,_:{called:t,from:"abort"}}))}function Iv(e,r,t){var n=r[e]||t[e];return n&&n.config?n.config:{}}function Pv(e,r){return r.reduce(function(t,n){return n[e]?t.concat({methodName:e,pluginName:n.name,method:n[e]}):t},[])}function Ev(e,r){var t=e.replace(ft,""),n=r?":"+r:"";return[""+e+n,""+t+n,t+"End"+n]}function os(e,r){var t=e.abort;return!!t&&(t===!0||Tv(t,r)||t&&Tv(t.plugins,r))}function Rv(e,r){var t=e.abort;if(!t)return!1;if(t===!0||Pr(t))return!0;var n=t.plugins;return Mt(t)&&t.length===r||Mt(n)&&n.length===r}function Mt(e){return Array.isArray(e)}function Tv(e,r){return!(!e||!Mt(e))&&e.includes(r)}function Ov(e){var r=e.match(/(.*):(.*)/);return!!r&&{method:r[1],name:r[2]}}function Zg(e){return Object.keys(e).reduce(function(r,t){return t==="type"||(r[t]=Fe(e[t])?Object.assign({},e[t]):e[t]),r},{})}function ey(e,r,t){var n={};return function(a){return function(i){return function(o){try{var s,u=function(b){return s?b:i(f)},c=o.type,l=o.plugins,f=o;if(o.abort)return Promise.resolve(i(o));if(c===ee.enablePlugin&&a.dispatch({type:ee.initializeStart,plugins:l,disabled:[],fromEnable:!0,meta:o.meta}),c===ee.disablePlugin&&setTimeout(function(){return gv(o.meta.rid,{payload:o})},0),c===ee.initializeEnd){var v=r(),d=Object.keys(v),h=d.filter(function(b){return l.includes(b)}).map(function(b){return v[b]}),p=[],S=[],R=o.disabled,I=h.map(function(b){var y=b.loaded,A=b.name,q=b.config;return yv(b,function(){return y({config:q})},1e4).then(function(j){return n[A]||(a.dispatch({type:ee.pluginReadyType(A),name:A,events:Object.keys(b).filter(function(G){return!ts.includes(G)})}),n[A]=!0),p=p.concat(A),b}).catch(function(j){if(j instanceof Error)throw new Error(j);return S=S.concat(j.name),j})});Promise.all(I).then(function(b){var y={plugins:p,failed:S,disabled:R};setTimeout(function(){d.length===I.length+R.length&&a.dispatch(Z({},{type:ee.ready},y))},0)})}var g=(function(){if(c!==ee.bootstrap)return/^ready:([^:]*)$/.test(c)&&setTimeout(function(){return bv(a,r,e)},0),Promise.resolve((function(b,y,A,q,j){try{var G=Me(y)?y():y,K=b.type,re=K.replace(ft,"");if(b._&&b._.called)return Promise.resolve(b);var L=A.getState(),M=(C=G,(U=L.plugins)===void 0&&(U={}),(F=b.options)===void 0&&(F={}),Object.keys(C).filter(function(w){var T=F.plugins||{};return Ug(T[w])?T[w]:T.all!==!1&&(!U[w]||U[w].enabled!==!1)}).map(function(w){return C[w]}));K===ee.initializeStart&&b.fromEnable&&(M=Object.keys(L.plugins).filter(function(w){var T=L.plugins[w];return b.plugins.includes(w)&&!T.initialized}).map(function(w){return G[w]}));var x=M.map(function(w){return w.name}),m=(function(w,T){var N=Ev(w).map(function(H){return Pv(H,T)});return T.reduce(function(H,Q){var J=Q.name,le=Ev(w,J).map(function(_e){return Pv(_e,T)}),ne=le[0],ue=le[1],ae=le[2];return ne.length&&(H.beforeNS[J]=ne),ue.length&&(H.duringNS[J]=ue),ae.length&&(H.afterNS[J]=ae),H},{before:N[0],beforeNS:{},during:N[1],duringNS:{},after:N[2],afterNS:{}})})(K,M);return Promise.resolve(as({action:b,data:{exact:m.before,namespaced:m.beforeNS},state:L,allPlugins:G,allMatches:m,instance:A,store:q,EVENTS:j})).then(function(w){function T(){var Q=(function(){if(K.match(ft))return Promise.resolve(as({action:Z({},N,{type:re+"End"}),data:{exact:m.after,namespaced:m.afterNS},state:L,allPlugins:G,allMatches:m,instance:A,store:q,EVENTS:j})).then(function(J){J.meta&&J.meta.hasCallback&&gv(J.meta.rid,{payload:J})})})();return Q&&Q.then?Q.then(function(){return w}):w}if(Rv(w,x.length))return w;var N,H=(function(){if(K!==re)return Promise.resolve(as({action:Z({},w,{type:re}),data:{exact:m.during,namespaced:m.duringNS},state:L,allPlugins:G,allMatches:m,instance:A,store:q,EVENTS:j})).then(function(Q){N=Q});N=w})();return H&&H.then?H.then(T):T()})}catch(w){return Promise.reject(w)}var C,U,F})(o,r,e,a,t)).then(function(b){var y=i(b);return s=1,y})})();return Promise.resolve(g&&g.then?g.then(u):u(g))}catch(b){return Promise.reject(b)}}}}}function ry(e){return function(r){return function(t){return function(n){var a=n.type,i=n.key,o=n.value,s=n.options;if(a===ee.setItem||a===ee.removeItem){if(n.abort)return t(n);a===ee.setItem?e.setItem(i,o,s):e.removeItem(i,s)}return t(n)}}}}var ty=function(){var e=this;this.before=[],this.after=[],this.addMiddleware=function(r,t){e[t]=e[t].concat(r)},this.removeMiddleware=function(r,t){var n=e[t].findIndex(function(a){return a===r});n!==-1&&(e[t]=[].concat(e[t].slice(0,n),e[t].slice(n+1)))},this.dynamicMiddlewares=function(r){return function(t){return function(n){return function(a){var i={getState:t.getState,dispatch:function(s){return t.dispatch(s)}},o=e[r].map(function(s){return s(i)});return ut.apply(void 0,o)(n)(a)}}}}};function ny(e){return function(r,t){r===void 0&&(r={});var n={};if(t.type==="initialize:aborted")return r;if(/^registerPlugin:([^:]*)$/.test(t.type)){var a=Cv(t.type,"registerPlugin"),i=e()[a];if(!i||!a)return r;var o=t.enabled,s=i.config;return n[a]={enabled:o,initialized:!!o&&!i.initialize,loaded:!!o&&!!i.loaded({config:s}),config:s},Z({},r,n)}if(/^initialize:([^:]*)$/.test(t.type)){var u=Cv(t.type,ee.initialize),c=e()[u];return c&&u?(n[u]=Z({},r[u],{initialized:!0,loaded:!!c.loaded({config:c.config})}),Z({},r,n)):r}if(/^ready:([^:]*)$/.test(t.type))return n[t.name]=Z({},r[t.name],{loaded:!0}),Z({},r,n);switch(t.type){case ee.disablePlugin:return Z({},r,_v(t.plugins,!1,r));case ee.enablePlugin:return Z({},r,_v(t.plugins,!0,r));default:return r}}}function Cv(e,r){return e.substring(r.length+1,e.length)}function _v(e,r,t){return e.reduce(function(n,a){return n[a]=Z({},t[a],{enabled:r}),n},t)}function Av(e){try{return JSON.parse(JSON.stringify(e))}catch{}return e}var ay={last:{},history:[]};function iy(e,r){e===void 0&&(e=ay);var t=r.options,n=r.meta;if(r.type===ee.track){var a=Av(Z({event:r.event,properties:r.properties},Object.keys(t).length&&{options:t},{meta:n}));return Z({},e,{last:a,history:e.history.concat(a)})}return e}var oy={actions:[]};function sy(e,r){e===void 0&&(e=oy);var t=r.payload;switch(r.type){case"queue":var n;return n=t&&t.type&&t.type===ee.identify?[r].concat(e.actions):e.actions.concat(r),Z({},e,{actions:n});case"dequeue":return[];default:return e}}var kv=/#.*$/;function uy(e){var r=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(e);return"/"+(r&&r[3]?r[3].split("?")[0].replace(kv,""):"")}var qv,$v,Uv,Lv,cy=function(e){if(e===void 0&&(e={}),!Ce)return e;var r=document,t=r.title,n=r.referrer,a=window,i=a.location,o=a.innerWidth,s=a.innerHeight,u=i.hash,c=i.search,l=(function(v){var d=(function(){if(Ce){for(var h,p=document.getElementsByTagName("link"),S=0;h=p[S];S++)if(h.getAttribute("rel")==="canonical")return h.getAttribute("href")}})();return d?d.match(/\?/)?d:d+v:window.location.href.replace(kv,"")})(c),f={title:t,url:l,path:uy(l),hash:u,search:c,width:o,height:s};return n&&n!==""&&(f.referrer=n),Z({},f,e)},ly={last:{},history:[]};function fy(e,r){e===void 0&&(e=ly);var t=r.options;if(r.type===ee.page){var n=Av(Z({properties:r.properties,meta:r.meta},Object.keys(t).length&&{options:t}));return Z({},e,{last:n,history:e.history.concat(n)})}return e}qv=(function(){if(!Ce)return!1;var e=navigator.appVersion;return~e.indexOf("Win")?"Windows":~e.indexOf("Mac")?"MacOS":~e.indexOf("X11")?"UNIX":~e.indexOf("Linux")?"Linux":"Unknown OS"})(),$v=Ce?document.referrer:null,Uv=Fg(),Lv=Bg();var Nv={initialized:!1,sessionId:pn(),app:null,version:null,debug:!1,offline:!!Ce&&!navigator.onLine,os:{name:qv},userAgent:Ce?navigator.userAgent:"node",library:{name:rs,version:"0.13.1"},timezone:Lv,locale:Uv,campaign:{},referrer:$v};function dy(e,r){e===void 0&&(e=Nv);var t=e.initialized,n=r.campaign;switch(r.type){case ee.campaign:return Z({},e,{campaign:n});case ee.offline:return Z({},e,{offline:!0});case ee.online:return Z({},e,{offline:!1});default:return t?e:Z({},Nv,e,{initialized:!0})}}var vy=["plugins","reducers","storage"];function hy(e,r,t){if(Ce){var n=window[(t?"add":"remove")+"EventListener"];e.split(" ").forEach(function(a){n(a,r)})}}function py(e){var r=hy.bind(null,"online offline",function(t){return Promise.resolve(!navigator.onLine).then(e)});return r(!0),function(t){return r(!1)}}function xv(){return jr(rs,[]),function(e){return function(r,t,n){var a=e(r,t,n),i=a.dispatch;return Object.assign(a,{dispatch:function(o){return it[at][rs].push(o.action||o),i(o)}})}}}function jv(e){return function(){return ut(ut.apply(null,arguments),xv())}}function ss(e){return e?sv(e)?e:[e]:[]}function Dv(e,r,t){e===void 0&&(e={});var n,a,i=pn();return r&&(Dt[i]=(n=r,a=(function(o){for(var s,u=o||Array.prototype.slice.call(arguments),c=0;c<u.length;c++)if(Me(u[c])){s=u[c];break}return s})(t),function(o){a&&a(o),n(o)})),Z({},e,{rid:i,ts:new Date().getTime()},r?{hasCallback:!0}:{})}function my(e){e===void 0&&(e={});var r=e.reducers||{},t=e.initialUser||{},n=(e.plugins||[]).reduce(function(w,T){if(Me(T))return w.middlewares=w.middlewares.concat(T),w;if(T.NAMESPACE&&(T.name=T.NAMESPACE),!T.name)throw new Error("https://lytics.dev/errors/1");T.config||(T.config={});var N=T.EVENTS?Object.keys(T.EVENTS).map(function(J){return T.EVENTS[J]}):[];w.pluginEnabled[T.name]=!(T.enabled===!1||T.config.enabled===!1),delete T.enabled,T.methods&&(w.methods[T.name]=Object.keys(T.methods).reduce(function(J,le){var ne;return J[le]=(ne=T.methods[le],function(){for(var ue=Array.prototype.slice.call(arguments),ae=new Array(ne.length),_e=0;_e<ue.length;_e++)ae[_e]=ue[_e];return ae[ae.length]=y,ne.apply({instance:y},ae)}),J},{}),delete T.methods);var H=Object.keys(T).concat(N),Q=new Set(w.events.concat(H));if(w.events=Array.from(Q),w.pluginsArray=w.pluginsArray.concat(T),w.plugins[T.name])throw new Error(T.name+"AlreadyLoaded");return w.plugins[T.name]=T,w.plugins[T.name].loaded||(w.plugins[T.name].loaded=function(){return!0}),w},{plugins:{},pluginEnabled:{},methods:{},pluginsArray:[],middlewares:[],events:[]}),a=e.storage?e.storage:{getItem:xr,setItem:jr,removeItem:ot},i=(function(w){return function(T,N,H){return N.getState("user")[T]||(H&&Fe(H)&&H[T]?H[T]:mv(w)[T]||xr(ns(T))||null)}})(a),o=n.plugins,s=n.events.filter(function(w){return!ts.includes(w)}).sort(),u=new Set(s.concat(yn).filter(function(w){return!ts.includes(w)})),c=Array.from(u).sort(),l=function(){return o},f=new ty,v=f.addMiddleware,d=f.removeMiddleware,h=f.dynamicMiddlewares,p=function(){throw new Error("Abort disabled inListener")},S=Hg(),R=mv(a),I=Z({},R,t,S.an_uid?{userId:S.an_uid}:{},S.an_aid?{anonymousId:S.an_aid}:{});I.anonymousId||(I.anonymousId=pn());var g=Z({enable:function(w,T){return new Promise(function(N){m.dispatch({type:ee.enablePlugin,plugins:ss(w),_:{originalAction:ee.enablePlugin}},N,[T])})},disable:function(w,T){return new Promise(function(N){m.dispatch({type:ee.disablePlugin,plugins:ss(w),_:{originalAction:ee.disablePlugin}},N,[T])})}},n.methods),b=!1,y={identify:function(w,T,N,H){try{var Q=Pr(w)?w:null,J=Fe(w)?w:T,le=N||{},ne=y.user();jr(ns(Tr),Q);var ue=Q||J.userId||i(Tr,y,J);return Promise.resolve(new Promise(function(ae){m.dispatch(Z({type:ee.identifyStart,userId:ue,traits:J||{},options:le,anonymousId:ne.anonymousId},ne.id&&ne.id!==Q&&{previousId:ne.id}),ae,[T,N,H])}))}catch(ae){return Promise.reject(ae)}},track:function(w,T,N,H){try{var Q=Fe(w)?w.event:w;if(!Q||!Pr(Q))throw new Error("EventMissing");var J=Fe(w)?w:T||{},le=Fe(N)?N:{};return Promise.resolve(new Promise(function(ne){m.dispatch({type:ee.trackStart,event:Q,properties:J,options:le,userId:i(Tr,y,T),anonymousId:i(lt,y,T)},ne,[T,N,H])}))}catch(ne){return Promise.reject(ne)}},page:function(w,T,N){try{var H=Fe(w)?w:{},Q=Fe(T)?T:{};return Promise.resolve(new Promise(function(J){m.dispatch({type:ee.pageStart,properties:cy(H),options:Q,userId:i(Tr,y,H),anonymousId:i(lt,y,H)},J,[w,T,N])}))}catch(J){return Promise.reject(J)}},user:function(w){if(w===Tr||w==="id")return i(Tr,y);if(w===lt||w==="anonId")return i(lt,y);var T=y.getState("user");return w?tv(T,w):T},reset:function(w){return new Promise(function(T){m.dispatch({type:ee.resetStart},T,w)})},ready:function(w){return b&&w({plugins:g,instance:y}),y.on(ee.ready,function(T){w&&w(T),b=!0})},on:function(w,T){if(!w||!Me(T))return!1;if(w===ee.bootstrap)throw new Error(".on disabled for "+w);var N=/Start$|Start:/;if(w==="*"){var H=function(ne){return function(ue){return function(ae){return ae.type.match(N)&&T({payload:ae,instance:y,plugins:o}),ue(ae)}}},Q=function(ne){return function(ue){return function(ae){return ae.type.match(N)||T({payload:ae,instance:y,plugins:o}),ue(ae)}}};return v(H,bn),v(Q,wn),function(){d(H,bn),d(Q,wn)}}var J=w.match(N)?bn:wn,le=function(ne){return function(ue){return function(ae){return ae.type===w&&T({payload:ae,instance:y,plugins:o,abort:p}),ue(ae)}}};return v(le,J),function(){return d(le,J)}},once:function(w,T){if(!w||!Me(T))return!1;if(w===ee.bootstrap)throw new Error(".once disabled for "+w);var N=y.on(w,function(H){T({payload:H.payload,instance:y,plugins:o,abort:p}),N()});return N},getState:function(w){var T=m.getState();return w?tv(T,w):Object.assign({},T)},dispatch:function(w){var T=Pr(w)?{type:w}:w;if(yn.includes(T.type))throw new Error("reserved action "+T.type);var N=Z({},T,{_:Z({originalAction:T.type},w._||{})});m.dispatch(N)},enablePlugin:g.enable,disablePlugin:g.disable,plugins:g,storage:{getItem:a.getItem,setItem:function(w,T,N){m.dispatch({type:ee.setItemStart,key:w,value:T,options:N})},removeItem:function(w,T){m.dispatch({type:ee.removeItemStart,key:w,options:T})}},setAnonymousId:function(w,T){y.storage.setItem(Rr,w,T)},events:{core:yn,plugins:s}},A=n.middlewares.concat([function(w){return function(T){return function(N){return N.meta||(N.meta=Dv()),T(N)}}},h(bn),ey(y,l,{all:c,plugins:s}),ry(a),Jg(y),Qg(y),h(wn)]),q={context:dy,user:Yg(a),page:fy,track:iy,plugins:ny(l),queue:sy},j=ut,G=ut;if(Ce&&e.debug){var K=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;K&&(j=K({trace:!0,traceLimit:25})),G=function(){return arguments.length===0?xv():Fe(typeof arguments[0])?jv():jv().apply(null,arguments)}}var re,L=(function(w){return Object.keys(w).reduce(function(T,N){return vy.includes(N)||(T[N]=w[N]),T},{})})(e),M=n.pluginsArray.reduce(function(w,T){var N=T.name,H=T.config,Q=T.loaded,J=n.pluginEnabled[N];return w[N]={enabled:J,initialized:!!J&&!T.initialize,loaded:!!Q({config:H}),config:H},w},{}),x={context:L,user:I,plugins:M},m=dv((function(w){for(var T=Object.keys(w),N={},H=0;H<T.length;H++){var Q=T[H];typeof w[Q]===Er&&(N[Q]=w[Q])}var J,le=Object.keys(N);try{(function(ne){Object.keys(ne).forEach(function(ue){var ae=ne[ue];if(typeof ae(void 0,{type:es})===pr||typeof ae(void 0,{type:Vg})===pr)throw new Error(jt+" "+ue+" "+pr)})})(N)}catch(ne){J=ne}return function(ne,ue){if(ne===void 0&&(ne={}),J)throw J;for(var ae=!1,_e={},xe=0;xe<le.length;xe++){var Be=le[xe],Le=ne[Be],tr=(0,N[Be])(Le,ue);if(typeof tr===pr){var Cr=zg(Be,ue);throw new Error(Cr)}_e[Be]=tr,ae=ae||tr!==Le}return ae?_e:ne}})(Z({},q,r)),x,G(j(Kg.apply(void 0,A))));m.dispatch=(re=m.dispatch,function(w,T,N){var H=Z({},w,{meta:Dv(w.meta,T,ss(N))});return re.apply(null,[H])});var C=Object.keys(o);m.dispatch({type:ee.bootstrap,plugins:C,config:L,params:S,user:I,initialUser:t,persistedUser:R});var U=C.filter(function(w){return n.pluginEnabled[w]}),F=C.filter(function(w){return!n.pluginEnabled[w]});return m.dispatch({type:ee.registerPlugins,plugins:C,enabled:n.pluginEnabled}),n.pluginsArray.map(function(w,T){var N=w.bootstrap,H=w.config,Q=w.name;N&&Me(N)&&N({instance:y,config:H,payload:w}),m.dispatch({type:ee.registerPluginType(Q),name:Q,enabled:n.pluginEnabled[Q],plugin:w}),n.pluginsArray.length===T+1&&m.dispatch({type:ee.initializeStart,plugins:U,disabled:F})}),py(function(w){m.dispatch({type:w?ee.offline:ee.online})}),(function(w,T,N){setInterval(function(){return bv(w,T,N)},3e3)})(m,l,y),y}var bn="before",wn="after",Mr="cookie",Fr=Bv(),Mv=Sn,gy=Sn;function Fv(e){return Fr?Sn(e,"",-1):ot(e)}function Bv(){if(Fr!==void 0)return Fr;var e=Mr+Mr;try{Sn(e,e),Fr=document.cookie.indexOf(e)!==-1,Fv(e)}catch{Fr=!1}return Fr}function Sn(e,r,t,n,a,i){if(typeof window<"u"){var o=arguments.length>1;return Fr===!1&&(o?jr(e,r):xr(e)),o?document.cookie=e+"="+encodeURIComponent(r)+(t?"; expires="+new Date(+new Date+1e3*t).toUTCString()+(n?"; path="+n:"")+(a?"; domain="+a:"")+(i?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}}var mr="localStorage",yy=Zo.bind(null,mr);st(mr,"getItem",xr),st(mr,"setItem",jr),st(mr,"removeItem",ot);var gr="sessionStorage",by=Zo.bind(null,gr);st(gr,"getItem",xr),st(gr,"setItem",jr),st(gr,"removeItem",ot);function dt(e){var r=e;try{if((r=JSON.parse(e))==="true")return!0;if(r==="false")return!1;if(Fe(r))return r;parseFloat(r)===r&&(r=parseFloat(r))}catch{}if(r!==null&&r!=="")return r}var wy=yy(),Sy=by(),Iy=Bv();function Br(e,r){if(e){var t=us(r),n=!ds(t),a=cs(t)?dt(localStorage.getItem(e)):void 0;if(n&&!nt(a))return a;var i=ls(t)?dt(Mv(e)):void 0;if(n&&i)return i;var o=fs(t)?dt(sessionStorage.getItem(e)):void 0;if(n&&o)return o;var s=xr(e);return n?s:{localStorage:a,sessionStorage:o,cookie:i,global:s}}}function In(e,r,t){if(e&&!nt(r)){var n={},a=us(t),i=JSON.stringify(r),o=!ds(a);return cs(a)&&(n[mr]=En(mr,r,dt(localStorage.getItem(e))),localStorage.setItem(e,i),o)?n[mr]:ls(a)&&(n[Mr]=En(Mr,r,dt(Mv(e))),gy(e,i),o)?n[Mr]:fs(a)&&(n[gr]=En(gr,r,dt(sessionStorage.getItem(e))),sessionStorage.setItem(e,i),o)?n[gr]:(n[Nr]=En(Nr,r,xr(e)),jr(e,r),o?n[Nr]:n)}}function Py(e,r){if(e){var t=us(r),n=Br(e,av),a={};return!nt(n.localStorage)&&cs(t)&&(localStorage.removeItem(e),a[mr]=n.localStorage),!nt(n.cookie)&&ls(t)&&(Fv(e),a[Mr]=n.cookie),!nt(n.sessionStorage)&&fs(t)&&(sessionStorage.removeItem(e),a[gr]=n.sessionStorage),!nt(n.global)&&Pn(t,Nr)&&(ot(e),a[Nr]=n.global),a}}function us(e){return e?Pr(e)?e:e.storage:nv}function cs(e){return wy&&Pn(e,mr)}function ls(e){return Iy&&Pn(e,Mr)}function fs(e){return Sy&&Pn(e,gr)}function ds(e){return e===av||e==="all"}function Pn(e,r){return e===nv||e===r||ds(e)}function En(e,r,t){return{location:e,current:r,previous:t}}var Ey={setItem:In,getItem:Br,removeItem:Py};function Ry(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function Hv(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),t.push.apply(t,n)}return t}function Gv(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?Hv(Object(t),!0).forEach(function(n){Ry(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Hv(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function Ty(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r={storage:Ey};return my(Gv(Gv({},r),e))}function Oy(e){if(typeof window>"u")return;const{addEventListener:r,history:t,location:n}=window;let a=n.pathname;r("popstate",()=>e(n.pathname)),["push","replace"].map(i=>{const o=`${i}State`;if(o!=="pushState"&&o!=="replaceState")return;const s=t[o];t[o]=function(...u){const c=u[2]?.toString()||"",l=_y(c);return a!==l&&(a=l,setTimeout(()=>e(c),0)),s.apply(t,u)}})}function Cy(e,r){const t=e.indexOf(r);return t>-1?e.slice(0,t):e}function _y(e){return["#","?"].forEach(r=>e=Cy(e,r)),e}function Ay(){Oy(()=>{yr.page()})}var vs="up",hs="down";function ky(e){if(e===void 0&&(e={}),!Ce)return Xo;var r=Vv(),t=ps(),n=Wv(),a=Rn(n,r),i=Rn(t,r),o=[],s=[],u=[],c=n,l=a,f=i,v=Object.keys(e);if(!v.length)return Xo;var d=v.map(function(p){return Number(p)}),h=Wg(function(){var p=Vv(),S=(function(L,M){return M.map(function(x){return x===100?L-5:L*(x/100)})})(p,d),R=ps(),I=Wv(),g=Rn(I,p),b=Rn(R,p);if(l=g>l?g:l,f=b<f?b:f,!(o.length>=d.length)){var y=c===I,A=vs;y?A="initial":c<=I&&(A=hs);var q=S,j=d;(A===vs||y)&&(q=S.slice().reverse(),j=d.slice().reverse());var G=j.reduce(function(L,M,x){var m=q[x];return u.includes(M)&&I<=m&&(u=u.filter(function(C){return C!==M}),L.singleFunction=M),A===hs&&!o.includes(M)&&I>=m&&M>i?(s.push(M),L.callbacks=L.callbacks.concat(M),L):A===vs&&!o.includes(M)&&I<=m&&M<=g?(L.foundFunc=[M],L):(y&&I>=m&&L.foundFunc.length===0&&(L.foundFunc=[M]),!s.includes(M)&&I>=m&&(s.push(M),L.singleFunction?u.push(M):L.singleFunction=M),L)},{foundFunc:[],singleFunction:null,callbacks:[],direction:A});if(c=I,A===hs&&G.callbacks&&G.callbacks.forEach(function(L){Me(e[L])&&(e[L]({trigger:L,direction:A,scrollMin:f,scrollMax:l,range:[f,l]}),o.push(L))}),G.singleFunction){var K=G.singleFunction,re=G.direction;Me(e[K])&&e[K]({trigger:K,direction:re,scrollMin:f,scrollMax:l,range:[f,l]}),o.push(K)}}},500);return window.addEventListener("scroll",h),function(){return window.removeEventListener("scroll",h)}}function ps(){return Ce?document.body.scrollTop||document.documentElement.scrollTop:0}function qy(){return Ce?window.innerHeight||document.documentElement.clientHeight:0}function Wv(){return Math.round(ps()+qy())}function Vv(){if(!Ce)return 0;var e=document.body,r=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,r.clientHeight,r.scrollHeight,r.offsetHeight)}function Rn(e,r){return Math.round(e/r*100)}var ms="Event",zv=ms+"Listener";function $y(e){return function(r,t,n,a){var i=n||Xo,o=a||!1;if(!Ce)return i;var s=Tn(t),u=Tn(r,!0);if(!u.length)throw new Error("noElements");if(!s.length)throw new Error("no"+ms);var c=[];return(function l(f){f&&(c=[]);for(var v=f?"add"+zv:"remove"+zv,d=0;d<u.length;d++){var h=u[d];c[d]=f?o&&o.once?Uy(i):i:c[d]||i;for(var p=0;p<s.length;p++)h[v]?h["on"+s[p]]=f?c[d]:null:h[v](s[p],c[d],o)}return l.bind(null,!f)})(e)}}function Tn(e,r){if(Pr(e))return r?Tn(document.querySelectorAll(e)):(t=e).split(t.indexOf(",")>-1?",":" ").map(function(o){return o.trim()});var t;if(NodeList.prototype.isPrototypeOf(e)){for(var n=[],a=e.length>>>0;a--;)n[a]=e[a];return n}var i=Mg(e);return r?i.map(function(o){return Pr(o)?Tn(o,!0):o}).flat():i}function Uy(e,r){var t;return function(){return e&&(t=e.apply(this,arguments),e=null),t}}var gs=$y(ms);function Kv(e,r){return Ce&&Me(window[e])?(t=window[e],n=r,(a=window)===void 0&&(a=null),Me(t)?function(){t.apply(a,arguments),n.apply(a,arguments)}:n):window[e]=r;var t,n,a}Kv.bind(null,"onerror"),Kv.bind(null,"onload");var Jv=typeof window>"u",Yv="hidden";function Ly(e){if(Jv)return!1;var r=Ny(),t="".concat(r.replace(/[H|h]idden/,""),"visibilitychange"),n=function(){return e(!!document[r])},a=function(){return document.addEventListener(t,n)};return a(),function(){return document.removeEventListener(t,n),a}}function Ny(){var e=["webkit","moz","ms","o"];return Jv||Yv in document?Yv:e.reduce(function(r,t){var n=t+"Hidden";return!r&&n in document?n:r},null)}var xy=["mousemove","mousedown","touchmove","touchstart","touchend","keydown"];function jy(e,r){r===void 0&&(r={});var t=(function(o,s){var u=this,c=!1;return function(l){c||(o.call(u,l),c=!0,setTimeout(function(){return c=!1},s))}})(e,r.throttle||1e4),n=[];function a(){var o=Ly(function(s){s||t({type:"tabVisible"})});return n=[o].concat(xy.map(function(s){return gs(document,s,t)})).concat(gs(window,"load",t)).concat(gs(window,"scroll",t,{capture:!0,passive:!0})),i}function i(){n.map(function(o){return o()})}return a(),function(){return i(),a}}function Dy(e){var r,t,n=e.onIdle,a=e.onWakeUp,i=e.onHeartbeat,o=e.timeout,s=o,u=e.throttle,c=u===void 0?2e3:u,l=!1,f=!1,v=new Date,d=function(){return clearTimeout(r)};function h(S){d(),i&&!l&&i(Ft(v),S),a&&l&&(l=!1,a(Ft(t),S),v=new Date),r=setTimeout(function(){l=!0,n&&(t=new Date,n(Ft(v),S))},s)}var p=jy(h,{throttle:c});return{disable:function(){f=!0,l=!1,d();var S=p();return function(){return f=!1,v=new Date,h({type:"load"}),S()}},getStatus:function(){return{isIdle:l,isDisabled:f,active:l?0:Ft(v,f),idle:l?Ft(t,f):0}}}}function Ft(e,r){return r?0:Math.round((new Date-e)/1e3)}const Qv=5e3;class My{element;isInViewport=!1;isAwake=!1;isFlushing;observer;lastEventAt=Date.now();registeredView=!1;viewCallback;activeDurationCallback;idleDurationCallback;scrollCallback;constructor(r){this.element=r.element,this.viewCallback=r.viewCallback,this.activeDurationCallback=r.activeDurationCallback,this.idleDurationCallback=r.idleDurationCallback,this.scrollCallback=r.scrollCallback,this.observer=new IntersectionObserver(t=>{t.forEach(n=>{this.handleInViewPort(n.isIntersecting)})},{threshold:0}),this.observer.observe(this.element),Dy({onIdle:t=>this.handleAwake(!1,t),onWakeUp:t=>this.handleAwake(!0,t),timeout:Qv}),ky({25:this.handleScroll.bind(this),50:this.handleScroll.bind(this),75:this.handleScroll.bind(this),90:this.handleScroll.bind(this),100:this.handleScroll.bind(this)})}flush(){this.isFlushing=!0,this.handleAwake(!this.isAwake)}handleInViewPort(r){r?(this.isAwake=!0,this.trackInViewport()):this.handleAwake(!1),this.isInViewport=r}handleAwake(r,t=Math.round((Date.now()-this.lastEventAt)/1e3)){this.isAwake=r,this.lastEventAt=r?Date.now()-t*Qv:Date.now(),this.isInViewport&&this.trackAwake(r,t)}handleScroll(r){this.scrollCallback&&this.scrollCallback(r)}handleVisibilityChange(){this.isAwake=!1;const r=Math.round((Date.now()-this.lastEventAt)/1e3);r>1&&(this.lastEventAt=Date.now(),this.trackAwake(!1,r))}trackAwake(r,t){!r&&this.activeDurationCallback&&this.activeDurationCallback(t,this.isFlushing,this.lastEventAt),r&&this.idleDurationCallback&&this.idleDurationCallback(t,this.isFlushing,this.lastEventAt)}trackInViewport(){this.registeredView||(this.registeredView=!0,this.viewCallback&&this.viewCallback())}}function Xv(e){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):e()}function Fy(e,r){r=r||{};var t,n,a=[],i=r.max||1/0;function o(){clearInterval(t),e(a.splice(0,i)),s()}function s(){t=setInterval(o,r.interval||1e4)}return s(),{flush:o,push:function(u){return n=a.push(u),n>=i&&o(),n},size:function(){return a.length},end:function(u){u&&o(),clearInterval(t)}}}const Zv="sesamy_session_id";function By(){let e=sessionStorage.getItem(Zv);return e||(e=Math.random().toString(36).slice(2,9),sessionStorage.setItem(Zv,e)),e}let eh=!1,On,Cn,ys;function rh(e){return JSON.stringify(e.map(r=>{const{campaign:t,...n}=r.properties||{};return{anonymousId:r.anonymousId,userId:r.userId,type:r.type,properties:n,clientId:ys,requestId:Math.random().toString(36).slice(2,9),sessionId:By(),timestamp:new Date().toISOString(),version:kt,event:r.event,context:{...r.context,page:{url:window.location.href,title:document.title,referrer:document.referrer,itemSrc:ge("sesamy:item-src"),publisherContentId:ge("sesamy:publisher-content-id")},campaign:t,locale:navigator.language,library:zo,userAgent:navigator.userAgent,clientId:ys}}}))}const th=Fy(async e=>{if(e.length>0){const r=rh(e);eh?navigator.sendBeacon(Cn,r):(await fetch(Cn,{method:"POST",body:r,headers:{"Content-Type":"text/plain"}})).ok}},{max:10,interval:3e3});function bs(e){if(e.anonymousId)if(e.properties?.flushing){const r={...e};delete r.properties.flushing,navigator.sendBeacon(Cn,rh([r]))}else th.push(e)}function Hy(){return eh=!0,th.flush()}function Gy(e,r,t){On=r,Cn=`${or("logs",t)}/events`,ys=e}const Wy={name:"custom-analytics-plugin",page:({payload:e})=>{if(!On)return;const{properties:r,anonymousId:t,userId:n,event:a}=e;bs({anonymousId:t,userId:n,properties:r,event:a,type:"page"})},track:({payload:e})=>{if(!On)return;const{properties:r,anonymousId:t,userId:n,event:a}=e;bs({anonymousId:t,userId:n,properties:r,event:a,type:"track"})},identify:({payload:e})=>{if(!On)return;const{properties:r,anonymousId:t,userId:n}=e;bs({anonymousId:t,userId:n,properties:r,type:"identify"})}},nh=["source","medium","campaign","term","content"],Or="utm_",Vy=1800*1e3;function ah(e){return e?Date.now()-parseInt(e,10)>Vy:!0}function ih(){const e=document.referrer||"";if(!e)return;const r=Br(`${Or}set_at`);(ah(r)||!Br(`${Or}referrer`))&&In(`${Or}referrer`,e)}function zy(){const e=()=>{const t={};for(const a of nh){const i=Br(`${Or}${a}`);i&&(t[`utm_${a}`]=i)}const n=Br(`${Or}referrer`);return n&&(t.utm_referrer=n),t};return{name:"attribution-tracking",initialize(){ih()},campaign({payload:t}){const n=t?.campaign||{},a=Br(`${Or}set_at`);if(Object.keys(n).length>0&&ah(a)){for(const o of nh){const s=n[o];s&&In(`${Or}${o}`,s)}In(`${Or}set_at`,String(Date.now()))}ih()},page({payload:t}){return t.properties.campaign=e(),t},track({payload:t}){return t.properties.campaign=e(),t},getStoredCampaignData:e}}const Ky=zy(),oh=new Map,sh=new Map;function Jy({clientId:e,enabled:r=!0,environment:t}){Gy(e,r,t),r&&(window.addEventListener("beforeunload",()=>{sh.forEach((n,a)=>{n.bind(a)()}),Hy()}),window.addEventListener("visibilitychange",()=>{document.visibilityState!=="visible"&&oh.forEach((n,a)=>{n.bind(a)()})}),Ay(),Xv(()=>{const n=new My({element:document.body,viewCallback:()=>{yr.page()},activeDurationCallback:(a,i,o)=>{yr.track("activeDuration",{duration:a,durationStart:o,flushing:i})},idleDurationCallback:(a,i,o)=>{yr.track("idleDuration",{duration:a,durationStart:o,flushing:i})},scrollCallback:a=>{yr.track("scroll",{scroll:a.scrollMax})}});sh.set(document.body,()=>{n.flush()}),oh.set(document.body,()=>{n.handleVisibilityChange()})}),window.addEventListener(er.AUTHENTICATED,async n=>{const a=n;await yr.identify(a.detail.sub)}),window.addEventListener(er.LOGOUT,async()=>{await yr.track("logout",{}),await yr.reset()}))}const yr=Ty({app:zo,version:kt,plugins:[Ky,Wy]});function uh(e,r){yr.track(e,r)}const Yy=["AdHeader","AdContainer","AD_Top","homead","ad-lead"];function ch(){return new Promise(e=>{const r=Yy.map(t=>{const n=document.createElement("div");return n.innerHTML=" ",n.id=t,n.style.position="absolute",document.body.appendChild(n),n});window.setTimeout(()=>{const t=!r.every(n=>document.querySelector(`#${n.id}`)?.offsetParent);r.forEach(n=>n.remove()),e(t)},100)})}function lh(){const e=navigator.userAgent.toLowerCase(),r=[{name:"Facebook",regex:/fbav|fban/i},{name:"LinkedIn",regex:/linkedin/i},{name:"Instagram",regex:/instagram/i},{name:"Gmail",regex:/gmail/i},{name:"Twitter",regex:/twitter/i},{name:"WeChat",regex:/micromessenger/i},{name:"Line",regex:/line/i},{name:"Snapchat",regex:/snapchat/i},{name:"Pinterest",regex:/pinterest/i},{name:"Kakao",regex:/kakaotalk/i},{name:"Skype",regex:/skype/i},{name:"WhatsApp",regex:/whatsapp/i}];for(const t of r)if(t.regex.test(e))return{isInAppBrowser:!0,browserName:t.name};return/; wv\)/.test(e)?{isInAppBrowser:!0,browserName:"Unknown In-App Browser"}:{isInAppBrowser:!1,browserName:null}}/*!
|
|
4
4
|
*
|
|
5
5
|
* detectIncognito v1.6.2
|
package/dist/sesamy-js.mjs
CHANGED
|
@@ -4594,7 +4594,7 @@ function Fv(e) {
|
|
|
4594
4594
|
localStorage.setItem(Bo, JSON.stringify({ value: t }));
|
|
4595
4595
|
}
|
|
4596
4596
|
}
|
|
4597
|
-
const Es = "@sesamy/sesamy-js", Dt = "1.
|
|
4597
|
+
const Es = "@sesamy/sesamy-js", Dt = "1.93.0", Bv = "sesamyFlags";
|
|
4598
4598
|
async function Hv(e) {
|
|
4599
4599
|
try {
|
|
4600
4600
|
localStorage.setItem(Bv, JSON.stringify(e));
|
|
@@ -4900,11 +4900,17 @@ async function eh(e, r) {
|
|
|
4900
4900
|
const a = await Rr.entitlements.hasAccess(n.url, n.pass?.split(",") || []);
|
|
4901
4901
|
if (!a)
|
|
4902
4902
|
throw new Error("User does not have access to the content");
|
|
4903
|
-
|
|
4904
|
-
if (!
|
|
4905
|
-
|
|
4903
|
+
let i;
|
|
4904
|
+
if (!a.id && a.token)
|
|
4905
|
+
i = a.token;
|
|
4906
|
+
else {
|
|
4907
|
+
const s = await Rr.entitlements.access(a.id);
|
|
4908
|
+
if (!s.token)
|
|
4909
|
+
throw new Error("Could not get access token");
|
|
4910
|
+
i = s.token;
|
|
4911
|
+
}
|
|
4906
4912
|
const o = r || Kv(t.parentElement || t);
|
|
4907
|
-
return Rr.proxy.getContent(i
|
|
4913
|
+
return Rr.proxy.getContent(i, n.url, o);
|
|
4908
4914
|
}
|
|
4909
4915
|
function rh(e, r = {}) {
|
|
4910
4916
|
const {
|