@sesamy/sesamy-js 1.87.0 → 1.88.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.
@@ -1,7 +1,7 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var Oc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Cc={},ga,Ac;function $e(){return Ac||(Ac=1,ga=function(t){try{return!!t()}catch{return!0}}),ga}var ya,$c;function zn(){if($c)return ya;$c=1;var t=$e();return ya=!t(function(){var e=(function(){}).bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),ya}var wa,Uc;function ve(){if(Uc)return wa;Uc=1;var t=zn(),e=Function.prototype,r=e.call,n=t&&e.bind.bind(r,r);return wa=t?n:function(a){return function(){return r.apply(a,arguments)}},wa}var ba,Lc;function Hn(){if(Lc)return ba;Lc=1;var t=ve(),e=t({}.toString),r=t("".slice);return ba=function(n){return r(e(n),8,-1)},ba}var Sa,qc;function Uh(){if(qc)return Sa;qc=1;var t=ve(),e=$e(),r=Hn(),n=Object,a=t("".split);return Sa=e(function(){return!n("z").propertyIsEnumerable(0)})?function(i){return r(i)==="String"?a(i,""):n(i)}:n,Sa}var Ia,Nc;function Bn(){return Nc||(Nc=1,Ia=function(t){return t==null}),Ia}var Pa,xc;function Gn(){if(xc)return Pa;xc=1;var t=Bn(),e=TypeError;return Pa=function(r){if(t(r))throw new e("Can't call method on "+r);return r},Pa}var Ea,jc;function rn(){if(jc)return Ea;jc=1;var t=Uh(),e=Gn();return Ea=function(r){return t(e(r))},Ea}var Lr,Dc;function me(){if(Dc)return Lr;Dc=1;var t=function(e){return e&&e.Math===Math&&e};return Lr=t(typeof globalThis=="object"&&globalThis)||t(typeof window=="object"&&window)||t(typeof self=="object"&&self)||t(typeof Oc=="object"&&Oc)||t(typeof Lr=="object"&&Lr)||(function(){return this})()||Function("return this")(),Lr}var ka={exports:{}},_a,Mc;function lt(){return Mc||(Mc=1,_a=!1),_a}var Ta,Fc;function js(){if(Fc)return Ta;Fc=1;var t=me(),e=Object.defineProperty;return Ta=function(r,n){try{e(t,r,{value:n,configurable:!0,writable:!0})}catch{t[r]=n}return n},Ta}var Kc;function Ds(){if(Kc)return ka.exports;Kc=1;var t=lt(),e=me(),r=js(),n="__core-js_shared__",a=ka.exports=e[n]||r(n,{});return(a.versions||(a.versions=[])).push({version:"3.46.0",mode:t?"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"}),ka.exports}var Ra,zc;function Lh(){if(zc)return Ra;zc=1;var t=Ds();return Ra=function(e,r){return t[e]||(t[e]=r||{})},Ra}var Oa,Hc;function Wn(){if(Hc)return Oa;Hc=1;var t=Gn(),e=Object;return Oa=function(r){return e(t(r))},Oa}var Ca,Bc;function Ze(){if(Bc)return Ca;Bc=1;var t=ve(),e=Wn(),r=t({}.hasOwnProperty);return Ca=Object.hasOwn||function(a,i){return r(e(a),i)},Ca}var Aa,Gc;function qh(){if(Gc)return Aa;Gc=1;var t=ve(),e=0,r=Math.random(),n=t(1.1.toString);return Aa=function(a){return"Symbol("+(a===void 0?"":a)+")_"+n(++e+r,36)},Aa}var $a,Wc;function nn(){if(Wc)return $a;Wc=1;var t=me(),e=t.navigator,r=e&&e.userAgent;return $a=r?String(r):"",$a}var Ua,Vc;function Nh(){if(Vc)return Ua;Vc=1;var t=me(),e=nn(),r=t.process,n=t.Deno,a=r&&r.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&&e&&(o=e.match(/Edge\/(\d+)/),(!o||o[1]>=74)&&(o=e.match(/Chrome\/(\d+)/),o&&(s=+o[1]))),Ua=s,Ua}var La,Jc;function xh(){if(Jc)return La;Jc=1;var t=Nh(),e=$e(),r=me(),n=r.String;return La=!!Object.getOwnPropertySymbols&&!e(function(){var a=Symbol("symbol detection");return!n(a)||!(Object(a)instanceof Symbol)||!Symbol.sham&&t&&t<41}),La}var qa,Zc;function jh(){if(Zc)return qa;Zc=1;var t=xh();return qa=t&&!Symbol.sham&&typeof Symbol.iterator=="symbol",qa}var Na,Yc;function Ue(){if(Yc)return Na;Yc=1;var t=me(),e=Lh(),r=Ze(),n=qh(),a=xh(),i=jh(),o=t.Symbol,s=e("wks"),u=i?o.for||o:o&&o.withoutSetter||n;return Na=function(l){return r(s,l)||(s[l]=a&&r(o,l)?o[l]:u("Symbol."+l)),s[l]},Na}var xa,Xc;function be(){if(Xc)return xa;Xc=1;var t=typeof document=="object"&&document.all;return xa=typeof t>"u"&&t!==void 0?function(e){return typeof e=="function"||e===t}:function(e){return typeof e=="function"},xa}var ja,Qc;function Ye(){if(Qc)return ja;Qc=1;var t=be();return ja=function(e){return typeof e=="object"?e!==null:t(e)},ja}var Da,eu;function at(){if(eu)return Da;eu=1;var t=Ye(),e=String,r=TypeError;return Da=function(n){if(t(n))return n;throw new r(e(n)+" is not an object")},Da}var Ma={},Fa,tu;function Le(){if(tu)return Fa;tu=1;var t=$e();return Fa=!t(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),Fa}var Ka,ru;function Dh(){if(ru)return Ka;ru=1;var t=Le(),e=$e();return Ka=t&&e(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),Ka}var za={},Ha,nu;function Vn(){if(nu)return Ha;nu=1;var t=me(),e=Ye(),r=t.document,n=e(r)&&e(r.createElement);return Ha=function(a){return n?r.createElement(a):{}},Ha}var Ba,au;function Mh(){if(au)return Ba;au=1;var t=Le(),e=$e(),r=Vn();return Ba=!t&&!e(function(){return Object.defineProperty(r("div"),"a",{get:function(){return 7}}).a!==7}),Ba}var Ga,iu;function xe(){if(iu)return Ga;iu=1;var t=zn(),e=Function.prototype.call;return Ga=t?e.bind(e):function(){return e.apply(e,arguments)},Ga}var Wa,ou;function Xe(){if(ou)return Wa;ou=1;var t=me(),e=be(),r=function(n){return e(n)?n:void 0};return Wa=function(n,a){return arguments.length<2?r(t[n]):t[n]&&t[n][a]},Wa}var Va,su;function Jn(){if(su)return Va;su=1;var t=ve();return Va=t({}.isPrototypeOf),Va}var Ja,cu;function Fh(){if(cu)return Ja;cu=1;var t=Xe(),e=be(),r=Jn(),n=jh(),a=Object;return Ja=n?function(i){return typeof i=="symbol"}:function(i){var o=t("Symbol");return e(o)&&r(o.prototype,a(i))},Ja}var Za,uu;function Zn(){if(uu)return Za;uu=1;var t=String;return Za=function(e){try{return t(e)}catch{return"Object"}},Za}var Ya,lu;function it(){if(lu)return Ya;lu=1;var t=be(),e=Zn(),r=TypeError;return Ya=function(n){if(t(n))return n;throw new r(e(n)+" is not a function")},Ya}var Xa,fu;function Ms(){if(fu)return Xa;fu=1;var t=it(),e=Bn();return Xa=function(r,n){var a=r[n];return e(a)?void 0:t(a)},Xa}var Qa,du;function em(){if(du)return Qa;du=1;var t=xe(),e=be(),r=Ye(),n=TypeError;return Qa=function(a,i){var o,s;if(i==="string"&&e(o=a.toString)&&!r(s=t(o,a))||e(o=a.valueOf)&&!r(s=t(o,a))||i!=="string"&&e(o=a.toString)&&!r(s=t(o,a)))return s;throw new n("Can't convert object to primitive value")},Qa}var ei,hu;function tm(){if(hu)return ei;hu=1;var t=xe(),e=Ye(),r=Fh(),n=Ms(),a=em(),i=Ue(),o=TypeError,s=i("toPrimitive");return ei=function(u,l){if(!e(u)||r(u))return u;var c=n(u,s),f;if(c){if(l===void 0&&(l="default"),f=t(c,u,l),!e(f)||r(f))return f;throw new o("Can't convert object to primitive value")}return l===void 0&&(l="number"),a(u,l)},ei}var ti,pu;function Kh(){if(pu)return ti;pu=1;var t=tm(),e=Fh();return ti=function(r){var n=t(r,"string");return e(n)?n:n+""},ti}var vu;function bt(){if(vu)return za;vu=1;var t=Le(),e=Mh(),r=Dh(),n=at(),a=Kh(),i=TypeError,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,u="enumerable",l="configurable",c="writable";return za.f=t?r?function(h,d,p){if(n(h),d=a(d),n(p),typeof h=="function"&&d==="prototype"&&"value"in p&&c in p&&!p[c]){var v=s(h,d);v&&v[c]&&(h[d]=p.value,p={configurable:l in p?p[l]:v[l],enumerable:u in p?p[u]:v[u],writable:!1})}return o(h,d,p)}:o:function(h,d,p){if(n(h),d=a(d),n(p),e)try{return o(h,d,p)}catch{}if("get"in p||"set"in p)throw new i("Accessors not supported");return"value"in p&&(h[d]=p.value),h},za}var ri,mu;function rm(){if(mu)return ri;mu=1;var t=Math.ceil,e=Math.floor;return ri=Math.trunc||function(n){var a=+n;return(a>0?e:t)(a)},ri}var ni,gu;function Fs(){if(gu)return ni;gu=1;var t=rm();return ni=function(e){var r=+e;return r!==r||r===0?0:t(r)},ni}var ai,yu;function zh(){if(yu)return ai;yu=1;var t=Fs(),e=Math.max,r=Math.min;return ai=function(n,a){var i=t(n);return i<0?e(i+a,0):r(i,a)},ai}var ii,wu;function nm(){if(wu)return ii;wu=1;var t=Fs(),e=Math.min;return ii=function(r){var n=t(r);return n>0?e(n,9007199254740991):0},ii}var oi,bu;function Ks(){if(bu)return oi;bu=1;var t=nm();return oi=function(e){return t(e.length)},oi}var si,Su;function am(){if(Su)return si;Su=1;var t=rn(),e=zh(),r=Ks(),n=function(a){return function(i,o,s){var u=t(i),l=r(u);if(l===0)return!a&&-1;var c=e(s,l),f;if(a&&o!==o){for(;l>c;)if(f=u[c++],f!==f)return!0}else for(;l>c;c++)if((a||c in u)&&u[c]===o)return a||c||0;return!a&&-1}};return si={includes:n(!0),indexOf:n(!1)},si}var ci,Iu;function zs(){return Iu||(Iu=1,ci={}),ci}var ui,Pu;function Hh(){if(Pu)return ui;Pu=1;var t=ve(),e=Ze(),r=rn(),n=am().indexOf,a=zs(),i=t([].push);return ui=function(o,s){var u=r(o),l=0,c=[],f;for(f in u)!e(a,f)&&e(u,f)&&i(c,f);for(;s.length>l;)e(u,f=s[l++])&&(~n(c,f)||i(c,f));return c},ui}var li,Eu;function Hs(){return Eu||(Eu=1,li=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]),li}var fi,ku;function Bh(){if(ku)return fi;ku=1;var t=Hh(),e=Hs();return fi=Object.keys||function(n){return t(n,e)},fi}var _u;function im(){if(_u)return Ma;_u=1;var t=Le(),e=Dh(),r=bt(),n=at(),a=rn(),i=Bh();return Ma.f=t&&!e?Object.defineProperties:function(s,u){n(s);for(var l=a(u),c=i(u),f=c.length,h=0,d;f>h;)r.f(s,d=c[h++],l[d]);return s},Ma}var di,Tu;function Gh(){if(Tu)return di;Tu=1;var t=Xe();return di=t("document","documentElement"),di}var hi,Ru;function Bs(){if(Ru)return hi;Ru=1;var t=Lh(),e=qh(),r=t("keys");return hi=function(n){return r[n]||(r[n]=e(n))},hi}var pi,Ou;function an(){if(Ou)return pi;Ou=1;var t=at(),e=im(),r=Hs(),n=zs(),a=Gh(),i=Vn(),o=Bs(),s=">",u="<",l="prototype",c="script",f=o("IE_PROTO"),h=function(){},d=function(b){return u+c+s+b+u+"/"+c+s},p=function(b){b.write(d("")),b.close();var y=b.parentWindow.Object;return b=null,y},v=function(){var b=i("iframe"),y="java"+c+":",m;return b.style.display="none",a.appendChild(b),b.src=String(y),m=b.contentWindow.document,m.open(),m.write(d("document.F=Object")),m.close(),m.F},g,P=function(){try{g=new ActiveXObject("htmlfile")}catch{}P=typeof document<"u"?document.domain&&g?p(g):v():p(g);for(var b=r.length;b--;)delete P[l][r[b]];return P()};return n[f]=!0,pi=Object.create||function(y,m){var w;return y!==null?(h[l]=t(y),w=new h,h[l]=null,w[f]=y):w=P(),m===void 0?w:e.f(w,m)},pi}var vi,Cu;function om(){if(Cu)return vi;Cu=1;var t=Ue(),e=an(),r=bt().f,n=t("unscopables"),a=Array.prototype;return a[n]===void 0&&r(a,n,{configurable:!0,value:e(null)}),vi=function(i){a[n][i]=!0},vi}var mi,Au;function on(){return Au||(Au=1,mi={}),mi}var gi,$u;function sm(){if($u)return gi;$u=1;var t=me(),e=be(),r=t.WeakMap;return gi=e(r)&&/native code/.test(String(r)),gi}var yi,Uu;function rr(){return Uu||(Uu=1,yi=function(t,e){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:e}}),yi}var wi,Lu;function nr(){if(Lu)return wi;Lu=1;var t=Le(),e=bt(),r=rr();return wi=t?function(n,a,i){return e.f(n,a,r(1,i))}:function(n,a,i){return n[a]=i,n},wi}var bi,qu;function kr(){if(qu)return bi;qu=1;var t=sm(),e=me(),r=Ye(),n=nr(),a=Ze(),i=Ds(),o=Bs(),s=zs(),u="Object already initialized",l=e.TypeError,c=e.WeakMap,f,h,d,p=function(b){return d(b)?h(b):f(b,{})},v=function(b){return function(y){var m;if(!r(y)||(m=h(y)).type!==b)throw new l("Incompatible receiver, "+b+" required");return m}};if(t||i.state){var g=i.state||(i.state=new c);g.get=g.get,g.has=g.has,g.set=g.set,f=function(b,y){if(g.has(b))throw new l(u);return y.facade=b,g.set(b,y),y},h=function(b){return g.get(b)||{}},d=function(b){return g.has(b)}}else{var P=o("state");s[P]=!0,f=function(b,y){if(a(b,P))throw new l(u);return y.facade=b,n(b,P,y),y},h=function(b){return a(b,P)?b[P]:{}},d=function(b){return a(b,P)}}return bi={set:f,get:h,has:d,enforce:p,getterFor:v},bi}var Si={},Ii={},Nu;function Wh(){if(Nu)return Ii;Nu=1;var t={}.propertyIsEnumerable,e=Object.getOwnPropertyDescriptor,r=e&&!t.call({1:2},1);return Ii.f=r?function(a){var i=e(this,a);return!!i&&i.enumerable}:t,Ii}var xu;function Vh(){if(xu)return Si;xu=1;var t=Le(),e=xe(),r=Wh(),n=rr(),a=rn(),i=Kh(),o=Ze(),s=Mh(),u=Object.getOwnPropertyDescriptor;return Si.f=t?u:function(c,f){if(c=a(c),f=i(f),s)try{return u(c,f)}catch{}if(o(c,f))return n(!e(r.f,c,f),c[f])},Si}var Pi={exports:{}},Ei,ju;function Jh(){if(ju)return Ei;ju=1;var t=Le(),e=Ze(),r=Function.prototype,n=t&&Object.getOwnPropertyDescriptor,a=e(r,"name"),i=a&&(function(){}).name==="something",o=a&&(!t||t&&n(r,"name").configurable);return Ei={EXISTS:a,PROPER:i,CONFIGURABLE:o},Ei}var ki,Du;function Gs(){if(Du)return ki;Du=1;var t=ve(),e=be(),r=Ds(),n=t(Function.toString);return e(r.inspectSource)||(r.inspectSource=function(a){return n(a)}),ki=r.inspectSource,ki}var Mu;function Zh(){if(Mu)return Pi.exports;Mu=1;var t=ve(),e=$e(),r=be(),n=Ze(),a=Le(),i=Jh().CONFIGURABLE,o=Gs(),s=kr(),u=s.enforce,l=s.get,c=String,f=Object.defineProperty,h=t("".slice),d=t("".replace),p=t([].join),v=a&&!e(function(){return f(function(){},"length",{value:8}).length!==8}),g=String(String).split("String"),P=Pi.exports=function(b,y,m){h(c(y),0,7)==="Symbol("&&(y="["+d(c(y),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),m&&m.getter&&(y="get "+y),m&&m.setter&&(y="set "+y),(!n(b,"name")||i&&b.name!==y)&&(a?f(b,"name",{value:y,configurable:!0}):b.name=y),v&&m&&n(m,"arity")&&b.length!==m.arity&&f(b,"length",{value:m.arity});try{m&&n(m,"constructor")&&m.constructor?a&&f(b,"prototype",{writable:!1}):b.prototype&&(b.prototype=void 0)}catch{}var w=u(b);return n(w,"source")||(w.source=p(g,typeof y=="string"?y:"")),b};return Function.prototype.toString=P(function(){return r(this)&&l(this).source||o(this)},"toString"),Pi.exports}var _i,Fu;function Qe(){if(Fu)return _i;Fu=1;var t=be(),e=bt(),r=Zh(),n=js();return _i=function(a,i,o,s){s||(s={});var u=s.enumerable,l=s.name!==void 0?s.name:i;if(t(o)&&r(o,l,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:e.f(a,i,{value:o,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return a},_i}var Ti={},Ku;function cm(){if(Ku)return Ti;Ku=1;var t=Hh(),e=Hs(),r=e.concat("length","prototype");return Ti.f=Object.getOwnPropertyNames||function(a){return t(a,r)},Ti}var Ri={},zu;function Yh(){return zu||(zu=1,Ri.f=Object.getOwnPropertySymbols),Ri}var Oi,Hu;function um(){if(Hu)return Oi;Hu=1;var t=Xe(),e=ve(),r=cm(),n=Yh(),a=at(),i=e([].concat);return Oi=t("Reflect","ownKeys")||function(s){var u=r.f(a(s)),l=n.f;return l?i(u,l(s)):u},Oi}var Ci,Bu;function Xh(){if(Bu)return Ci;Bu=1;var t=Ze(),e=um(),r=Vh(),n=bt();return Ci=function(a,i,o){for(var s=e(i),u=n.f,l=r.f,c=0;c<s.length;c++){var f=s[c];!t(a,f)&&!(o&&t(o,f))&&u(a,f,l(i,f))}},Ci}var Ai,Gu;function Qh(){if(Gu)return Ai;Gu=1;var t=$e(),e=be(),r=/#|\.prototype\./,n=function(u,l){var c=i[a(u)];return c===s?!0:c===o?!1:e(l)?t(l):!!l},a=n.normalize=function(u){return String(u).replace(r,".").toLowerCase()},i=n.data={},o=n.NATIVE="N",s=n.POLYFILL="P";return Ai=n,Ai}var $i,Wu;function Ee(){if(Wu)return $i;Wu=1;var t=me(),e=Vh().f,r=nr(),n=Qe(),a=js(),i=Xh(),o=Qh();return $i=function(s,u){var l=s.target,c=s.global,f=s.stat,h,d,p,v,g,P;if(c?d=t:f?d=t[l]||a(l,{}):d=t[l]&&t[l].prototype,d)for(p in u){if(g=u[p],s.dontCallGetSet?(P=e(d,p),v=P&&P.value):v=d[p],h=o(c?p:l+(f?".":"#")+p,s.forced),!h&&v!==void 0){if(typeof g==typeof v)continue;i(g,v)}(s.sham||v&&v.sham)&&r(g,"sham",!0),n(d,p,g,s)}},$i}var Ui,Vu;function lm(){if(Vu)return Ui;Vu=1;var t=$e();return Ui=!t(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),Ui}var Li,Ju;function Ws(){if(Ju)return Li;Ju=1;var t=Ze(),e=be(),r=Wn(),n=Bs(),a=lm(),i=n("IE_PROTO"),o=Object,s=o.prototype;return Li=a?o.getPrototypeOf:function(u){var l=r(u);if(t(l,i))return l[i];var c=l.constructor;return e(c)&&l instanceof c?c.prototype:l instanceof o?s:null},Li}var qi,Zu;function ep(){if(Zu)return qi;Zu=1;var t=$e(),e=be(),r=Ye(),n=an(),a=Ws(),i=Qe(),o=Ue(),s=lt(),u=o("iterator"),l=!1,c,f,h;[].keys&&(h=[].keys(),"next"in h?(f=a(a(h)),f!==Object.prototype&&(c=f)):l=!0);var d=!r(c)||t(function(){var p={};return c[u].call(p)!==p});return d?c={}:s&&(c=n(c)),e(c[u])||i(c,u,function(){return this}),qi={IteratorPrototype:c,BUGGY_SAFARI_ITERATORS:l},qi}var Ni,Yu;function _r(){if(Yu)return Ni;Yu=1;var t=bt().f,e=Ze(),r=Ue(),n=r("toStringTag");return Ni=function(a,i,o){a&&!o&&(a=a.prototype),a&&!e(a,n)&&t(a,n,{configurable:!0,value:i})},Ni}var xi,Xu;function tp(){if(Xu)return xi;Xu=1;var t=ep().IteratorPrototype,e=an(),r=rr(),n=_r(),a=on(),i=function(){return this};return xi=function(o,s,u,l){var c=s+" Iterator";return o.prototype=e(t,{next:r(+!l,u)}),n(o,c,!1,!0),a[c]=i,o},xi}var ji,Qu;function fm(){if(Qu)return ji;Qu=1;var t=ve(),e=it();return ji=function(r,n,a){try{return t(e(Object.getOwnPropertyDescriptor(r,n)[a]))}catch{}},ji}var Di,el;function dm(){if(el)return Di;el=1;var t=Ye();return Di=function(e){return t(e)||e===null},Di}var Mi,tl;function hm(){if(tl)return Mi;tl=1;var t=dm(),e=String,r=TypeError;return Mi=function(n){if(t(n))return n;throw new r("Can't set "+e(n)+" as a prototype")},Mi}var Fi,rl;function Vs(){if(rl)return Fi;rl=1;var t=fm(),e=Ye(),r=Gn(),n=hm();return Fi=Object.setPrototypeOf||("__proto__"in{}?(function(){var a=!1,i={},o;try{o=t(Object.prototype,"__proto__","set"),o(i,[]),a=i instanceof Array}catch{}return function(u,l){return r(u),n(l),e(u)&&(a?o(u,l):u.__proto__=l),u}})():void 0),Fi}var Ki,nl;function rp(){if(nl)return Ki;nl=1;var t=Ee(),e=xe(),r=lt(),n=Jh(),a=be(),i=tp(),o=Ws(),s=Vs(),u=_r(),l=nr(),c=Qe(),f=Ue(),h=on(),d=ep(),p=n.PROPER,v=n.CONFIGURABLE,g=d.IteratorPrototype,P=d.BUGGY_SAFARI_ITERATORS,b=f("iterator"),y="keys",m="values",w="entries",R=function(){return this};return Ki=function(A,j,K,B,re,L,M){i(K,j,B);var N=function(Z){if(Z===re&&I)return I;if(!P&&Z&&Z in q)return q[Z];switch(Z){case y:return function(){return new K(this,Z)};case m:return function(){return new K(this,Z)};case w:return function(){return new K(this,Z)}}return function(){return new K(this)}},S=j+" Iterator",O=!1,q=A.prototype,F=q[b]||q["@@iterator"]||re&&q[re],I=!P&&F||N(re),_=j==="Array"&&q.entries||F,x,H,X;if(_&&(x=o(_.call(new A)),x!==Object.prototype&&x.next&&(!r&&o(x)!==g&&(s?s(x,g):a(x[b])||c(x,b,R)),u(x,S,!0,!0),r&&(h[S]=R))),p&&re===m&&F&&F.name!==m&&(!r&&v?l(q,"name",m):(O=!0,I=function(){return e(F,this)})),re)if(H={values:N(m),keys:L?I:N(y),entries:N(w)},M)for(X in H)(P||O||!(X in q))&&c(q,X,H[X]);else t({target:j,proto:!0,forced:P||O},H);return(!r||M)&&q[b]!==I&&c(q,b,I,{name:re}),h[j]=I,H},Ki}var zi,al;function Js(){return al||(al=1,zi=function(t,e){return{value:t,done:e}}),zi}var Hi,il;function Zs(){if(il)return Hi;il=1;var t=rn(),e=om(),r=on(),n=kr(),a=bt().f,i=rp(),o=Js(),s=lt(),u=Le(),l="Array Iterator",c=n.set,f=n.getterFor(l);Hi=i(Array,"Array",function(d,p){c(this,{type:l,target:t(d),index:0,kind:p})},function(){var d=f(this),p=d.target,v=d.index++;if(!p||v>=p.length)return d.target=null,o(void 0,!0);switch(d.kind){case"keys":return o(v,!1);case"values":return o(p[v],!1)}return o([v,p[v]],!1)},"values");var h=r.Arguments=r.Array;if(e("keys"),e("values"),e("entries"),!s&&u&&h.name!=="values")try{a(h,"name",{value:"values"})}catch{}return Hi}var ol={},sl;function pm(){if(sl)return ol;sl=1;var t=Ee(),e=ve(),r=zh(),n=RangeError,a=String.fromCharCode,i=String.fromCodePoint,o=e([].join),s=!!i&&i.length!==1;return t({target:"String",stat:!0,arity:1,forced:s},{fromCodePoint:function(l){for(var c=[],f=arguments.length,h=0,d;f>h;){if(d=+arguments[h++],r(d,1114111)!==d)throw new n(d+" is not a valid code point");c[h]=d<65536?a(d):a(((d-=65536)>>10)+55296,d%1024+56320)}return o(c,"")}}),ol}var Bi,cl;function np(){if(cl)return Bi;cl=1;var t=me(),e=Le(),r=Object.getOwnPropertyDescriptor;return Bi=function(n){if(!e)return t[n];var a=r(t,n);return a&&a.value},Bi}var Gi,ul;function Yn(){if(ul)return Gi;ul=1;var t=$e(),e=Ue(),r=Le(),n=lt(),a=e("iterator");return Gi=!t(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(l,c){o.delete("b"),u+=c+l}),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||!r)||!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"}),Gi}var Wi,ll;function Xn(){if(ll)return Wi;ll=1;var t=Zh(),e=bt();return Wi=function(r,n,a){return a.get&&t(a.get,n,{getter:!0}),a.set&&t(a.set,n,{setter:!0}),e.f(r,n,a)},Wi}var Vi,fl;function vm(){if(fl)return Vi;fl=1;var t=Qe();return Vi=function(e,r,n){for(var a in r)t(e,a,r[a],n);return e},Vi}var Ji,dl;function Ys(){if(dl)return Ji;dl=1;var t=Jn(),e=TypeError;return Ji=function(r,n){if(t(n,r))return r;throw new e("Incorrect invocation")},Ji}var Zi,hl;function mm(){if(hl)return Zi;hl=1;var t=Hn(),e=ve();return Zi=function(r){if(t(r)==="Function")return e(r)},Zi}var Yi,pl;function Tr(){if(pl)return Yi;pl=1;var t=mm(),e=it(),r=zn(),n=t(t.bind);return Yi=function(a,i){return e(a),i===void 0?a:r?n(a,i):function(){return a.apply(i,arguments)}},Yi}var Xi,vl;function Xs(){if(vl)return Xi;vl=1;var t=Ue(),e=t("toStringTag"),r={};return r[e]="z",Xi=String(r)==="[object z]",Xi}var Qi,ml;function sn(){if(ml)return Qi;ml=1;var t=Xs(),e=be(),r=Hn(),n=Ue(),a=n("toStringTag"),i=Object,o=r((function(){return arguments})())==="Arguments",s=function(u,l){try{return u[l]}catch{}};return Qi=t?r:function(u){var l,c,f;return u===void 0?"Undefined":u===null?"Null":typeof(c=s(l=i(u),a))=="string"?c:o?r(l):(f=r(l))==="Object"&&e(l.callee)?"Arguments":f},Qi}var eo,gl;function St(){if(gl)return eo;gl=1;var t=sn(),e=String;return eo=function(r){if(t(r)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return e(r)},eo}var to,yl;function Qn(){if(yl)return to;yl=1;var t=sn(),e=Ms(),r=Bn(),n=on(),a=Ue(),i=a("iterator");return to=function(o){if(!r(o))return e(o,i)||e(o,"@@iterator")||n[t(o)]},to}var ro,wl;function Qs(){if(wl)return ro;wl=1;var t=xe(),e=it(),r=at(),n=Zn(),a=Qn(),i=TypeError;return ro=function(o,s){var u=arguments.length<2?a(o):s;if(e(u))return r(t(u,o));throw new i(n(o)+" is not iterable")},ro}var no,bl;function ar(){if(bl)return no;bl=1;var t=TypeError;return no=function(e,r){if(e<r)throw new t("Not enough arguments");return e},no}var ao,Sl;function ea(){if(Sl)return ao;Sl=1;var t=ve();return ao=t([].slice),ao}var io,Il;function gm(){if(Il)return io;Il=1;var t=ea(),e=Math.floor,r=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 l=e(i/2),c=r(t(n,0,l),a),f=r(t(n,l),a),h=c.length,d=f.length,p=0,v=0;p<h||v<d;)n[p+v]=p<h&&v<d?a(c[p],f[v])<=0?c[p++]:f[v++]:p<h?c[p++]:f[v++];return n};return io=r,io}var oo,Pl;function ap(){if(Pl)return oo;Pl=1,Zs(),pm();var t=Ee(),e=me(),r=np(),n=Xe(),a=xe(),i=ve(),o=Le(),s=Yn(),u=Qe(),l=Xn(),c=vm(),f=_r(),h=tp(),d=kr(),p=Ys(),v=be(),g=Ze(),P=Tr(),b=sn(),y=at(),m=Ye(),w=St(),R=an(),A=rr(),j=Qs(),K=Qn(),B=Js(),re=ar(),L=Ue(),M=gm(),N=L("iterator"),S="URLSearchParams",O=S+"Iterator",q=d.set,F=d.getterFor(S),I=d.getterFor(O),_=r("fetch"),x=r("Request"),H=r("Headers"),X=x&&x.prototype,Z=H&&H.prototype,fe=e.TypeError,ae=e.encodeURIComponent,ue=String.fromCharCode,ie=n("String","fromCodePoint"),Te=parseInt,je=i("".charAt),Me=i([].join),qe=i([].push),et=i("".replace),Pt=i([].shift),Et=i([].splice),$t=i("".split),Ut=i("".slice),$r=i(/./.exec),ir=/\+/g,Lt="�",ye=/^[0-9a-f]+$/i,tt=function(D,V){var J=Ut(D,V,V+2);return $r(ye,J)?Te(J,16):NaN},qt=function(D){for(var V=0,J=128;J>0&&(D&J)!==0;J>>=1)V++;return V},z=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},Q=function(D){D=et(D,ir," ");for(var V=D.length,J="",Y=0;Y<V;){var oe=je(D,Y);if(oe==="%"){if(je(D,Y+1)==="%"||Y+3>V){J+="%",Y++;continue}var ce=tt(D,Y+1);if(ce!==ce){J+=oe,Y++;continue}Y+=2;var he=qt(ce);if(he===0)oe=ue(ce);else{if(he===1||he>4){J+=Lt,Y++;continue}for(var pe=[ce],Se=1;Se<he&&(Y++,!(Y+3>V||je(D,Y)!=="%"));){var Ne=tt(D,Y+1);if(Ne!==Ne){Y+=3;break}if(Ne>191||Ne<128)break;qe(pe,Ne),Y+=2,Se++}if(pe.length!==he){J+=Lt;continue}var ot=z(pe);ot===null?J+=Lt:oe=ie(ot)}}J+=oe,Y++}return J},se=/[!'()~]|%20/g,le={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},de=function(D){return le[D]},Be=function(D){return et(ae(D),se,de)},Re=h(function(V,J){q(this,{type:O,target:F(V).entries,index:0,kind:J})},S,function(){var V=I(this),J=V.target,Y=V.index++;if(!J||Y>=J.length)return V.target=null,B(void 0,!0);var oe=J[Y];switch(V.kind){case"keys":return B(oe.key,!1);case"values":return B(oe.value,!1)}return B([oe.key,oe.value],!1)},!0),Fe=function(D){this.entries=[],this.url=null,D!==void 0&&(m(D)?this.parseObject(D):this.parseQuery(typeof D=="string"?je(D,0)==="?"?Ut(D,1):D:w(D)))};Fe.prototype={type:S,bindURL:function(D){this.url=D,this.update()},parseObject:function(D){var V=this.entries,J=K(D),Y,oe,ce,he,pe,Se,Ne;if(J)for(Y=j(D,J),oe=Y.next;!(ce=a(oe,Y)).done;){if(he=j(y(ce.value)),pe=he.next,(Se=a(pe,he)).done||(Ne=a(pe,he)).done||!a(pe,he).done)throw new fe("Expected sequence with length 2");qe(V,{key:w(Se.value),value:w(Ne.value)})}else for(var ot in D)g(D,ot)&&qe(V,{key:ot,value:w(D[ot])})},parseQuery:function(D){if(D)for(var V=this.entries,J=$t(D,"&"),Y=0,oe,ce;Y<J.length;)oe=J[Y++],oe.length&&(ce=$t(oe,"="),qe(V,{key:Q(Pt(ce)),value:Q(Me(ce,"="))}))},serialize:function(){for(var D=this.entries,V=[],J=0,Y;J<D.length;)Y=D[J++],qe(V,Be(Y.key)+"="+Be(Y.value));return Me(V,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var Oe=function(){p(this,We);var V=arguments.length>0?arguments[0]:void 0,J=q(this,new Fe(V));o||(this.size=J.entries.length)},We=Oe.prototype;if(c(We,{append:function(V,J){var Y=F(this);re(arguments.length,2),qe(Y.entries,{key:w(V),value:w(J)}),o||this.length++,Y.updateURL()},delete:function(D){for(var V=F(this),J=re(arguments.length,1),Y=V.entries,oe=w(D),ce=J<2?void 0:arguments[1],he=ce===void 0?ce:w(ce),pe=0;pe<Y.length;){var Se=Y[pe];if(Se.key===oe&&(he===void 0||Se.value===he)){if(Et(Y,pe,1),he!==void 0)break}else pe++}o||(this.size=Y.length),V.updateURL()},get:function(V){var J=F(this).entries;re(arguments.length,1);for(var Y=w(V),oe=0;oe<J.length;oe++)if(J[oe].key===Y)return J[oe].value;return null},getAll:function(V){var J=F(this).entries;re(arguments.length,1);for(var Y=w(V),oe=[],ce=0;ce<J.length;ce++)J[ce].key===Y&&qe(oe,J[ce].value);return oe},has:function(V){for(var J=F(this).entries,Y=re(arguments.length,1),oe=w(V),ce=Y<2?void 0:arguments[1],he=ce===void 0?ce:w(ce),pe=0;pe<J.length;){var Se=J[pe++];if(Se.key===oe&&(he===void 0||Se.value===he))return!0}return!1},set:function(V,J){var Y=F(this);re(arguments.length,1);for(var oe=Y.entries,ce=!1,he=w(V),pe=w(J),Se=0,Ne;Se<oe.length;Se++)Ne=oe[Se],Ne.key===he&&(ce?Et(oe,Se--,1):(ce=!0,Ne.value=pe));ce||qe(oe,{key:he,value:pe}),o||(this.size=oe.length),Y.updateURL()},sort:function(){var V=F(this);M(V.entries,function(J,Y){return J.key>Y.key?1:-1}),V.updateURL()},forEach:function(V){for(var J=F(this).entries,Y=P(V,arguments.length>1?arguments[1]:void 0),oe=0,ce;oe<J.length;)ce=J[oe++],Y(ce.value,ce.key,this)},keys:function(){return new Re(this,"keys")},values:function(){return new Re(this,"values")},entries:function(){return new Re(this,"entries")}},{enumerable:!0}),u(We,N,We.entries,{name:"entries"}),u(We,"toString",function(){return F(this).serialize()},{enumerable:!0}),o&&l(We,"size",{get:function(){return F(this).entries.length},configurable:!0,enumerable:!0}),f(Oe,S),t({global:!0,constructor:!0,forced:!s},{URLSearchParams:Oe}),!s&&v(H)){var or=i(Z.has),Ur=i(Z.set),sr=function(D){if(m(D)){var V=D.body,J;if(b(V)===S)return J=D.headers?new H(D.headers):new H,or(J,"content-type")||Ur(J,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),R(D,{body:A(0,w(V)),headers:A(0,J)})}return D};if(v(_)&&t({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(V){return _(V,arguments.length>1?sr(arguments[1]):{})}}),v(x)){var cr=function(V){return p(this,X),new x(V,arguments.length>1?sr(arguments[1]):{})};X.constructor=cr,cr.prototype=X,t({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:cr})}}return oo={URLSearchParams:Oe,getState:F},oo}var El;function ym(){return El||(El=1,ap()),Cc}var kl={},_l;function wm(){if(_l)return kl;_l=1;var t=Qe(),e=ve(),r=St(),n=ar(),a=URLSearchParams,i=a.prototype,o=e(i.append),s=e(i.delete),u=e(i.forEach),l=e([].push),c=new a("a=1&a=2&b=3");return c.delete("a",1),c.delete("b",void 0),c+""!="a=2"&&t(i,"delete",function(f){var h=arguments.length,d=h<2?void 0:arguments[1];if(h&&d===void 0)return s(this,f);var p=[];u(this,function(R,A){l(p,{key:A,value:R})}),n(h,1);for(var v=r(f),g=r(d),P=0,b=0,y=!1,m=p.length,w;P<m;)w=p[P++],y||w.key===v?(y=!0,s(this,w.key)):b++;for(;b<m;)w=p[b++],w.key===v&&w.value===g||o(this,w.key,w.value)},{enumerable:!0,unsafe:!0}),kl}var Tl={},Rl;function bm(){if(Rl)return Tl;Rl=1;var t=Qe(),e=ve(),r=St(),n=ar(),a=URLSearchParams,i=a.prototype,o=e(i.getAll),s=e(i.has),u=new a("a=1");return(u.has("a",2)||!u.has("a",void 0))&&t(i,"has",function(c){var f=arguments.length,h=f<2?void 0:arguments[1];if(f&&h===void 0)return s(this,c);var d=o(this,c);n(f,1);for(var p=r(h),v=0;v<d.length;)if(d[v++]===p)return!0;return!1},{enumerable:!0,unsafe:!0}),Tl}var Ol={},Cl;function Sm(){if(Cl)return Ol;Cl=1;var t=Le(),e=ve(),r=Xn(),n=URLSearchParams.prototype,a=e(n.forEach);return t&&!("size"in n)&&r(n,"size",{get:function(){var o=0;return a(this,function(){o++}),o},configurable:!0,enumerable:!0}),Ol}var so,Al;function ta(){if(Al)return so;Al=1;var t=me();return so=t,so}var co,$l;function ip(){if($l)return co;$l=1,ym(),wm(),bm(),Sm();var t=ta();return co=t.URLSearchParams,co}var Ul={},Ll={},ql={},uo,Nl;function op(){if(Nl)return uo;Nl=1;var t=ve(),e=Fs(),r=St(),n=Gn(),a=t("".charAt),i=t("".charCodeAt),o=t("".slice),s=function(u){return function(l,c){var f=r(n(l)),h=e(c),d=f.length,p,v;return h<0||h>=d?u?"":void 0:(p=i(f,h),p<55296||p>56319||h+1===d||(v=i(f,h+1))<56320||v>57343?u?a(f,h):p:u?o(f,h,h+2):(p-55296<<10)+(v-56320)+65536)}};return uo={codeAt:s(!1),charAt:s(!0)},uo}var xl;function sp(){if(xl)return ql;xl=1;var t=op().charAt,e=St(),r=kr(),n=rp(),a=Js(),i="String Iterator",o=r.set,s=r.getterFor(i);return n(String,"String",function(u){o(this,{type:i,string:e(u),index:0})},function(){var l=s(this),c=l.string,f=l.index,h;return f>=c.length?a(void 0,!0):(h=t(c,f),l.index+=h.length,a(h,!1))}),ql}var lo,jl;function Im(){if(jl)return lo;jl=1;var t=Le(),e=ve(),r=xe(),n=$e(),a=Bh(),i=Yh(),o=Wh(),s=Wn(),u=Uh(),l=Object.assign,c=Object.defineProperty,f=e([].concat);return lo=!l||n(function(){if(t&&l({b:1},l(c({},"a",{enumerable:!0,get:function(){c(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var h={},d={},p=Symbol("assign detection"),v="abcdefghijklmnopqrst";return h[p]=7,v.split("").forEach(function(g){d[g]=g}),l({},h)[p]!==7||a(l({},d)).join("")!==v})?function(d,p){for(var v=s(d),g=arguments.length,P=1,b=i.f,y=o.f;g>P;)for(var m=u(arguments[P++]),w=b?f(a(m),b(m)):a(m),R=w.length,A=0,j;R>A;)j=w[A++],(!t||r(y,m,j))&&(v[j]=m[j]);return v}:l,lo}var fo,Dl;function cp(){if(Dl)return fo;Dl=1;var t=xe(),e=at(),r=Ms();return fo=function(n,a,i){var o,s;e(n);try{if(o=r(n,"return"),!o){if(a==="throw")throw i;return i}o=t(o,n)}catch(u){s=!0,o=u}if(a==="throw")throw i;if(s)throw o;return e(o),i},fo}var ho,Ml;function Pm(){if(Ml)return ho;Ml=1;var t=at(),e=cp();return ho=function(r,n,a,i){try{return i?n(t(a)[0],a[1]):n(a)}catch(o){e(r,"throw",o)}},ho}var po,Fl;function up(){if(Fl)return po;Fl=1;var t=Ue(),e=on(),r=t("iterator"),n=Array.prototype;return po=function(a){return a!==void 0&&(e.Array===a||n[r]===a)},po}var vo,Kl;function lp(){if(Kl)return vo;Kl=1;var t=ve(),e=$e(),r=be(),n=sn(),a=Xe(),i=Gs(),o=function(){},s=a("Reflect","construct"),u=/^\s*(?:class|function)\b/,l=t(u.exec),c=!u.test(o),f=function(p){if(!r(p))return!1;try{return s(o,[],p),!0}catch{return!1}},h=function(p){if(!r(p))return!1;switch(n(p)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return c||!!l(u,i(p))}catch{return!0}};return h.sham=!0,vo=!s||e(function(){var d;return f(f.call)||!f(Object)||!f(function(){d=!0})||d})?h:f,vo}var mo,zl;function Em(){if(zl)return mo;zl=1;var t=Le(),e=bt(),r=rr();return mo=function(n,a,i){t?e.f(n,a,r(0,i)):n[a]=i},mo}var go,Hl;function km(){if(Hl)return go;Hl=1;var t=Tr(),e=xe(),r=Wn(),n=Pm(),a=up(),i=lp(),o=Ks(),s=Em(),u=Qs(),l=Qn(),c=Array;return go=function(h){var d=r(h),p=i(this),v=arguments.length,g=v>1?arguments[1]:void 0,P=g!==void 0;P&&(g=t(g,v>2?arguments[2]:void 0));var b=l(d),y=0,m,w,R,A,j,K;if(b&&!(this===c&&a(b)))for(w=p?new this:[],A=u(d,b),j=A.next;!(R=e(j,A)).done;y++)K=P?n(A,g,[R.value,y],!0):R.value,s(w,y,K);else for(m=o(d),w=p?new this(m):c(m);m>y;y++)K=P?g(d[y],y):d[y],s(w,y,K);return w.length=y,w},go}var yo,Bl;function _m(){if(Bl)return yo;Bl=1;var t=ve(),e=2147483647,r=36,n=1,a=26,i=38,o=700,s=72,u=128,l="-",c=/[^\0-\u007E]/,f=/[.\u3002\uFF0E\uFF61]/g,h="Overflow: input needs wider integers to process",d=r-n,p=RangeError,v=t(f.exec),g=Math.floor,P=String.fromCharCode,b=t("".charCodeAt),y=t([].join),m=t([].push),w=t("".replace),R=t("".split),A=t("".toLowerCase),j=function(L){for(var M=[],N=0,S=L.length;N<S;){var O=b(L,N++);if(O>=55296&&O<=56319&&N<S){var q=b(L,N++);(q&64512)===56320?m(M,((O&1023)<<10)+(q&1023)+65536):(m(M,O),N--)}else m(M,O)}return M},K=function(L){return L+22+75*(L<26)},B=function(L,M,N){var S=0;for(L=N?g(L/o):L>>1,L+=g(L/M);L>d*a>>1;)L=g(L/d),S+=r;return g(S+(d+1)*L/(L+i))},re=function(L){var M=[];L=j(L);var N=L.length,S=u,O=0,q=s,F,I;for(F=0;F<L.length;F++)I=L[F],I<128&&m(M,P(I));var _=M.length,x=_;for(_&&m(M,l);x<N;){var H=e;for(F=0;F<L.length;F++)I=L[F],I>=S&&I<H&&(H=I);var X=x+1;if(H-S>g((e-O)/X))throw new p(h);for(O+=(H-S)*X,S=H,F=0;F<L.length;F++){if(I=L[F],I<S&&++O>e)throw new p(h);if(I===S){for(var Z=O,fe=r;;){var ae=fe<=q?n:fe>=q+a?a:fe-q;if(Z<ae)break;var ue=Z-ae,ie=r-ae;m(M,P(K(ae+ue%ie))),Z=g(ue/ie),fe+=r}m(M,P(K(Z))),q=B(O,X,x===_),O=0,x++}}O++,S++}return y(M,"")};return yo=function(L){var M=[],N=R(w(A(L),f,"."),"."),S,O;for(S=0;S<N.length;S++)O=N[S],m(M,v(c,O)?"xn--"+re(O):O);return y(M,".")},yo}var Gl;function Tm(){if(Gl)return Ll;Gl=1,sp();var t=Ee(),e=Le(),r=Yn(),n=me(),a=Tr(),i=ve(),o=Qe(),s=Xn(),u=Ys(),l=Ze(),c=Im(),f=km(),h=ea(),d=op().codeAt,p=_m(),v=St(),g=_r(),P=ar(),b=ap(),y=kr(),m=y.set,w=y.getterFor("URL"),R=b.URLSearchParams,A=b.getState,j=n.URL,K=n.TypeError,B=n.parseInt,re=Math.floor,L=Math.pow,M=i("".charAt),N=i(/./.exec),S=i([].join),O=i(1.1.toString),q=i([].pop),F=i([].push),I=i("".replace),_=i([].shift),x=i("".split),H=i("".slice),X=i("".toLowerCase),Z=i([].unshift),fe="Invalid authority",ae="Invalid scheme",ue="Invalid host",ie="Invalid port",Te=/[a-z]/i,je=/[\d+-.a-z]/i,Me=/\d/,qe=/^0x/i,et=/^[0-7]+$/,Pt=/^\d+$/,Et=/^[\da-f]+$/i,$t=/[\0\t\n\r #%/:<>?@[\\\]^|]/,Ut=/[\0\t\n\r #/:<>?@[\\\]^|]/,$r=/^[\u0000-\u0020]+/,ir=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,Lt=/[\t\n\r]/g,ye,tt=function(k){var U=x(k,"."),T,E,C,ne,W,we,Ie;if(U.length&&U[U.length-1]===""&&U.length--,T=U.length,T>4)return k;for(E=[],C=0;C<T;C++){if(ne=U[C],ne==="")return k;if(W=10,ne.length>1&&M(ne,0)==="0"&&(W=N(qe,ne)?16:8,ne=H(ne,W===8?1:2)),ne==="")we=0;else{if(!N(W===10?Pt:W===8?et:Et,ne))return k;we=B(ne,W)}F(E,we)}for(C=0;C<T;C++)if(we=E[C],C===T-1){if(we>=L(256,5-T))return null}else if(we>255)return null;for(Ie=q(E),C=0;C<E.length;C++)Ie+=E[C]*L(256,3-C);return Ie},qt=function(k){var U=[0,0,0,0,0,0,0,0],T=0,E=null,C=0,ne,W,we,Ie,Ce,Je,$,ke=function(){return M(k,C)};if(ke()===":"){if(M(k,1)!==":")return;C+=2,T++,E=T}for(;ke();){if(T===8)return;if(ke()===":"){if(E!==null)return;C++,T++,E=T;continue}for(ne=W=0;W<4&&N(Et,ke());)ne=ne*16+B(ke(),16),C++,W++;if(ke()==="."){if(W===0||(C-=W,T>6))return;for(we=0;ke();){if(Ie=null,we>0)if(ke()==="."&&we<4)C++;else return;if(!N(Me,ke()))return;for(;N(Me,ke());){if(Ce=B(ke(),10),Ie===null)Ie=Ce;else{if(Ie===0)return;Ie=Ie*10+Ce}if(Ie>255)return;C++}U[T]=U[T]*256+Ie,we++,(we===2||we===4)&&T++}if(we!==4)return;break}else if(ke()===":"){if(C++,!ke())return}else if(ke())return;U[T++]=ne}if(E!==null)for(Je=T-E,T=7;T!==0&&Je>0;)$=U[T],U[T--]=U[E+Je-1],U[E+--Je]=$;else if(T!==8)return;return U},z=function(k){for(var U=null,T=1,E=null,C=0,ne=0;ne<8;ne++)k[ne]!==0?(C>T&&(U=E,T=C),E=null,C=0):(E===null&&(E=ne),++C);return C>T?E:U},Q=function(k){var U,T,E,C;if(typeof k=="number"){for(U=[],T=0;T<4;T++)Z(U,k%256),k=re(k/256);return S(U,".")}if(typeof k=="object"){for(U="",E=z(k),T=0;T<8;T++)C&&k[T]===0||(C&&(C=!1),E===T?(U+=T?":":"::",C=!0):(U+=O(k[T],16),T<7&&(U+=":")));return"["+U+"]"}return k},se={},le=c({},se,{" ":1,'"':1,"<":1,">":1,"`":1}),de=c({},le,{"#":1,"?":1,"{":1,"}":1}),Be=c({},de,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Re=function(k,U){var T=d(k,0);return T>32&&T<127&&!l(U,k)?k:encodeURIComponent(k)},Fe={ftp:21,file:null,http:80,https:443,ws:80,wss:443},Oe=function(k,U){var T;return k.length===2&&N(Te,M(k,0))&&((T=M(k,1))===":"||!U&&T==="|")},We=function(k){var U;return k.length>1&&Oe(H(k,0,2))&&(k.length===2||(U=M(k,2))==="/"||U==="\\"||U==="?"||U==="#")},or=function(k){return k==="."||X(k)==="%2e"},Ur=function(k){return k=X(k),k===".."||k==="%2e."||k===".%2e"||k==="%2e%2e"},sr={},cr={},D={},V={},J={},Y={},oe={},ce={},he={},pe={},Se={},Ne={},ot={},da={},Pc={},ha={},ur={},st={},Ec={},Nt={},ft={},pa=function(k,U,T){var E=v(k),C,ne,W;if(U){if(ne=this.parse(E),ne)throw new K(ne);this.searchParams=null}else{if(T!==void 0&&(C=new pa(T,!0)),ne=this.parse(E,null,C),ne)throw new K(ne);W=A(new R),W.bindURL(this),this.searchParams=W}};pa.prototype={type:"URL",parse:function(k,U,T){var E=this,C=U||sr,ne=0,W="",we=!1,Ie=!1,Ce=!1,Je,$,ke,dt;for(k=v(k),U||(E.scheme="",E.username="",E.password="",E.host=null,E.port=null,E.path=[],E.query=null,E.fragment=null,E.cannotBeABaseURL=!1,k=I(k,$r,""),k=I(k,ir,"$1")),k=I(k,Lt,""),Je=f(k);ne<=Je.length;){switch($=Je[ne],C){case sr:if($&&N(Te,$))W+=X($),C=cr;else{if(U)return ae;C=D;continue}break;case cr:if($&&(N(je,$)||$==="+"||$==="-"||$==="."))W+=X($);else if($===":"){if(U&&(E.isSpecial()!==l(Fe,W)||W==="file"&&(E.includesCredentials()||E.port!==null)||E.scheme==="file"&&!E.host))return;if(E.scheme=W,U){E.isSpecial()&&Fe[E.scheme]===E.port&&(E.port=null);return}W="",E.scheme==="file"?C=da:E.isSpecial()&&T&&T.scheme===E.scheme?C=V:E.isSpecial()?C=ce:Je[ne+1]==="/"?(C=J,ne++):(E.cannotBeABaseURL=!0,F(E.path,""),C=Ec)}else{if(U)return ae;W="",C=D,ne=0;continue}break;case D:if(!T||T.cannotBeABaseURL&&$!=="#")return ae;if(T.cannotBeABaseURL&&$==="#"){E.scheme=T.scheme,E.path=h(T.path),E.query=T.query,E.fragment="",E.cannotBeABaseURL=!0,C=ft;break}C=T.scheme==="file"?da:Y;continue;case V:if($==="/"&&Je[ne+1]==="/")C=he,ne++;else{C=Y;continue}break;case J:if($==="/"){C=pe;break}else{C=st;continue}case Y:if(E.scheme=T.scheme,$===ye)E.username=T.username,E.password=T.password,E.host=T.host,E.port=T.port,E.path=h(T.path),E.query=T.query;else if($==="/"||$==="\\"&&E.isSpecial())C=oe;else if($==="?")E.username=T.username,E.password=T.password,E.host=T.host,E.port=T.port,E.path=h(T.path),E.query="",C=Nt;else if($==="#")E.username=T.username,E.password=T.password,E.host=T.host,E.port=T.port,E.path=h(T.path),E.query=T.query,E.fragment="",C=ft;else{E.username=T.username,E.password=T.password,E.host=T.host,E.port=T.port,E.path=h(T.path),E.path.length--,C=st;continue}break;case oe:if(E.isSpecial()&&($==="/"||$==="\\"))C=he;else if($==="/")C=pe;else{E.username=T.username,E.password=T.password,E.host=T.host,E.port=T.port,C=st;continue}break;case ce:if(C=he,$!=="/"||M(W,ne+1)!=="/")continue;ne++;break;case he:if($!=="/"&&$!=="\\"){C=pe;continue}break;case pe:if($==="@"){we&&(W="%40"+W),we=!0,ke=f(W);for(var va=0;va<ke.length;va++){var Tc=ke[va];if(Tc===":"&&!Ce){Ce=!0;continue}var Rc=Re(Tc,Be);Ce?E.password+=Rc:E.username+=Rc}W=""}else if($===ye||$==="/"||$==="?"||$==="#"||$==="\\"&&E.isSpecial()){if(we&&W==="")return fe;ne-=f(W).length+1,W="",C=Se}else W+=$;break;case Se:case Ne:if(U&&E.scheme==="file"){C=ha;continue}else if($===":"&&!Ie){if(W==="")return ue;if(dt=E.parseHost(W),dt)return dt;if(W="",C=ot,U===Ne)return}else if($===ye||$==="/"||$==="?"||$==="#"||$==="\\"&&E.isSpecial()){if(E.isSpecial()&&W==="")return ue;if(U&&W===""&&(E.includesCredentials()||E.port!==null))return;if(dt=E.parseHost(W),dt)return dt;if(W="",C=ur,U)return;continue}else $==="["?Ie=!0:$==="]"&&(Ie=!1),W+=$;break;case ot:if(N(Me,$))W+=$;else if($===ye||$==="/"||$==="?"||$==="#"||$==="\\"&&E.isSpecial()||U){if(W!==""){var ma=B(W,10);if(ma>65535)return ie;E.port=E.isSpecial()&&ma===Fe[E.scheme]?null:ma,W=""}if(U)return;C=ur;continue}else return ie;break;case da:if(E.scheme="file",$==="/"||$==="\\")C=Pc;else if(T&&T.scheme==="file")switch($){case ye:E.host=T.host,E.path=h(T.path),E.query=T.query;break;case"?":E.host=T.host,E.path=h(T.path),E.query="",C=Nt;break;case"#":E.host=T.host,E.path=h(T.path),E.query=T.query,E.fragment="",C=ft;break;default:We(S(h(Je,ne),""))||(E.host=T.host,E.path=h(T.path),E.shortenPath()),C=st;continue}else{C=st;continue}break;case Pc:if($==="/"||$==="\\"){C=ha;break}T&&T.scheme==="file"&&!We(S(h(Je,ne),""))&&(Oe(T.path[0],!0)?F(E.path,T.path[0]):E.host=T.host),C=st;continue;case ha:if($===ye||$==="/"||$==="\\"||$==="?"||$==="#"){if(!U&&Oe(W))C=st;else if(W===""){if(E.host="",U)return;C=ur}else{if(dt=E.parseHost(W),dt)return dt;if(E.host==="localhost"&&(E.host=""),U)return;W="",C=ur}continue}else W+=$;break;case ur:if(E.isSpecial()){if(C=st,$!=="/"&&$!=="\\")continue}else if(!U&&$==="?")E.query="",C=Nt;else if(!U&&$==="#")E.fragment="",C=ft;else if($!==ye&&(C=st,$!=="/"))continue;break;case st:if($===ye||$==="/"||$==="\\"&&E.isSpecial()||!U&&($==="?"||$==="#")){if(Ur(W)?(E.shortenPath(),$!=="/"&&!($==="\\"&&E.isSpecial())&&F(E.path,"")):or(W)?$!=="/"&&!($==="\\"&&E.isSpecial())&&F(E.path,""):(E.scheme==="file"&&!E.path.length&&Oe(W)&&(E.host&&(E.host=""),W=M(W,0)+":"),F(E.path,W)),W="",E.scheme==="file"&&($===ye||$==="?"||$==="#"))for(;E.path.length>1&&E.path[0]==="";)_(E.path);$==="?"?(E.query="",C=Nt):$==="#"&&(E.fragment="",C=ft)}else W+=Re($,de);break;case Ec:$==="?"?(E.query="",C=Nt):$==="#"?(E.fragment="",C=ft):$!==ye&&(E.path[0]+=Re($,se));break;case Nt:!U&&$==="#"?(E.fragment="",C=ft):$!==ye&&($==="'"&&E.isSpecial()?E.query+="%27":$==="#"?E.query+="%23":E.query+=Re($,se));break;case ft:$!==ye&&(E.fragment+=Re($,le));break}ne++}},parseHost:function(k){var U,T,E;if(M(k,0)==="["){if(M(k,k.length-1)!=="]"||(U=qt(H(k,1,-1)),!U))return ue;this.host=U}else if(this.isSpecial()){if(k=p(k),N($t,k)||(U=tt(k),U===null))return ue;this.host=U}else{if(N(Ut,k))return ue;for(U="",T=f(k),E=0;E<T.length;E++)U+=Re(T[E],se);this.host=U}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme==="file"},includesCredentials:function(){return this.username!==""||this.password!==""},isSpecial:function(){return l(Fe,this.scheme)},shortenPath:function(){var k=this.path,U=k.length;U&&(this.scheme!=="file"||U!==1||!Oe(k[0],!0))&&k.length--},serialize:function(){var k=this,U=k.scheme,T=k.username,E=k.password,C=k.host,ne=k.port,W=k.path,we=k.query,Ie=k.fragment,Ce=U+":";return C!==null?(Ce+="//",k.includesCredentials()&&(Ce+=T+(E?":"+E:"")+"@"),Ce+=Q(C),ne!==null&&(Ce+=":"+ne)):U==="file"&&(Ce+="//"),Ce+=k.cannotBeABaseURL?W[0]:W.length?"/"+S(W,"/"):"",we!==null&&(Ce+="?"+we),Ie!==null&&(Ce+="#"+Ie),Ce},setHref:function(k){var U=this.parse(k);if(U)throw new K(U);this.searchParams.update()},getOrigin:function(){var k=this.scheme,U=this.port;if(k==="blob")try{return new lr(k.path[0]).origin}catch{return"null"}return k==="file"||!this.isSpecial()?"null":k+"://"+Q(this.host)+(U!==null?":"+U:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(k){this.parse(v(k)+":",sr)},getUsername:function(){return this.username},setUsername:function(k){var U=f(v(k));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var T=0;T<U.length;T++)this.username+=Re(U[T],Be)}},getPassword:function(){return this.password},setPassword:function(k){var U=f(v(k));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var T=0;T<U.length;T++)this.password+=Re(U[T],Be)}},getHost:function(){var k=this.host,U=this.port;return k===null?"":U===null?Q(k):Q(k)+":"+U},setHost:function(k){this.cannotBeABaseURL||this.parse(k,Se)},getHostname:function(){var k=this.host;return k===null?"":Q(k)},setHostname:function(k){this.cannotBeABaseURL||this.parse(k,Ne)},getPort:function(){var k=this.port;return k===null?"":v(k)},setPort:function(k){this.cannotHaveUsernamePasswordPort()||(k=v(k),k===""?this.port=null:this.parse(k,ot))},getPathname:function(){var k=this.path;return this.cannotBeABaseURL?k[0]:k.length?"/"+S(k,"/"):""},setPathname:function(k){this.cannotBeABaseURL||(this.path=[],this.parse(k,ur))},getSearch:function(){var k=this.query;return k?"?"+k:""},setSearch:function(k){k=v(k),k===""?this.query=null:(M(k,0)==="?"&&(k=H(k,1)),this.query="",this.parse(k,Nt)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var k=this.fragment;return k?"#"+k:""},setHash:function(k){if(k=v(k),k===""){this.fragment=null;return}M(k,0)==="#"&&(k=H(k,1)),this.fragment="",this.parse(k,ft)},update:function(){this.query=this.searchParams.serialize()||null}};var lr=function(U){var T=u(this,De),E=P(arguments.length,1)>1?arguments[1]:void 0,C=m(T,new pa(U,!1,E));e||(T.href=C.serialize(),T.origin=C.getOrigin(),T.protocol=C.getProtocol(),T.username=C.getUsername(),T.password=C.getPassword(),T.host=C.getHost(),T.hostname=C.getHostname(),T.port=C.getPort(),T.pathname=C.getPathname(),T.search=C.getSearch(),T.searchParams=C.getSearchParams(),T.hash=C.getHash())},De=lr.prototype,Ve=function(k,U){return{get:function(){return w(this)[k]()},set:U&&function(T){return w(this)[U](T)},configurable:!0,enumerable:!0}};if(e&&(s(De,"href",Ve("serialize","setHref")),s(De,"origin",Ve("getOrigin")),s(De,"protocol",Ve("getProtocol","setProtocol")),s(De,"username",Ve("getUsername","setUsername")),s(De,"password",Ve("getPassword","setPassword")),s(De,"host",Ve("getHost","setHost")),s(De,"hostname",Ve("getHostname","setHostname")),s(De,"port",Ve("getPort","setPort")),s(De,"pathname",Ve("getPathname","setPathname")),s(De,"search",Ve("getSearch","setSearch")),s(De,"searchParams",Ve("getSearchParams")),s(De,"hash",Ve("getHash","setHash"))),o(De,"toJSON",function(){return w(this).serialize()},{enumerable:!0}),o(De,"toString",function(){return w(this).serialize()},{enumerable:!0}),j){var kc=j.createObjectURL,_c=j.revokeObjectURL;kc&&o(lr,"createObjectURL",a(kc,j)),_c&&o(lr,"revokeObjectURL",a(_c,j))}return g(lr,"URL"),t({global:!0,constructor:!0,forced:!r,sham:!e},{URL:lr}),Ll}var Wl;function Rm(){return Wl||(Wl=1,Tm()),Ul}var Vl={},Jl;function Om(){if(Jl)return Vl;Jl=1;var t=Ee(),e=Xe(),r=$e(),n=ar(),a=St(),i=Yn(),o=e("URL"),s=i&&r(function(){o.canParse()}),u=r(function(){return o.canParse.length!==1});return t({target:"URL",stat:!0,forced:!s||u},{canParse:function(c){var f=n(arguments.length,1),h=a(c),d=f<2||arguments[1]===void 0?void 0:a(arguments[1]);try{return!!new o(h,d)}catch{return!1}}}),Vl}var Zl={},Yl;function Cm(){if(Yl)return Zl;Yl=1;var t=Ee(),e=Xe(),r=ar(),n=St(),a=Yn(),i=e("URL");return t({target:"URL",stat:!0,forced:!a},{parse:function(s){var u=r(arguments.length,1),l=n(s),c=u<2||arguments[1]===void 0?void 0:n(arguments[1]);try{return new i(l,c)}catch{return null}}}),Zl}var Xl={},Ql;function Am(){if(Ql)return Xl;Ql=1;var t=Ee(),e=xe();return t({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return e(URL.prototype.toString,this)}}),Xl}var wo,ef;function $m(){if(ef)return wo;ef=1,ip(),Rm(),Om(),Cm(),Am();var t=ta();return wo=t.URL,wo}var bo,tf;function Um(){if(tf)return bo;tf=1;var t=$m();return bo=t,bo}var So,rf;function Lm(){if(rf)return So;rf=1;var t=Um();return So=t,So}Lm();var nf={},Io,af;function qm(){return af||(af=1,Io={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}),Io}var Po,of;function Nm(){if(of)return Po;of=1;var t=Vn(),e=t("span").classList,r=e&&e.constructor&&e.constructor.prototype;return Po=r===Object.prototype?void 0:r,Po}var sf;function fp(){if(sf)return nf;sf=1;var t=me(),e=qm(),r=Nm(),n=Zs(),a=nr(),i=_r(),o=Ue(),s=o("iterator"),u=n.values,l=function(f,h){if(f){if(f[s]!==u)try{a(f,s,u)}catch{f[s]=u}if(i(f,h,!0),e[h]){for(var d in n)if(f[d]!==n[d])try{a(f,d,n[d])}catch{f[d]=n[d]}}}};for(var c in e)l(t[c]&&t[c].prototype,c);return l(r,"DOMTokenList"),nf}var Eo,cf;function xm(){if(cf)return Eo;cf=1;var t=ip();return fp(),Eo=t,Eo}var ko,uf;function jm(){if(uf)return ko;uf=1;var t=xm();return ko=t,ko}jm();var lf={},ff={},_o,df;function Dm(){if(df)return _o;df=1;var t=Ye(),e=nr();return _o=function(r,n){t(n)&&"cause"in n&&e(r,"cause",n.cause)},_o}var To,hf;function Mm(){if(hf)return To;hf=1;var t=ve(),e=Error,r=t("".replace),n=(function(o){return String(new e(o).stack)})("zxcasd"),a=/\n\s*at [^:]*:[^\n]*/,i=a.test(n);return To=function(o,s){if(i&&typeof o=="string"&&!e.prepareStackTrace)for(;s--;)o=r(o,a,"");return o},To}var Ro,pf;function Fm(){if(pf)return Ro;pf=1;var t=$e(),e=rr();return Ro=!t(function(){var r=new Error("a");return"stack"in r?(Object.defineProperty(r,"stack",e(1,7)),r.stack!==7):!0}),Ro}var Oo,vf;function Km(){if(vf)return Oo;vf=1;var t=nr(),e=Mm(),r=Fm(),n=Error.captureStackTrace;return Oo=function(a,i,o,s){r&&(n?n(a,i):t(a,"stack",e(o,s)))},Oo}var Co,mf;function cn(){if(mf)return Co;mf=1;var t=Tr(),e=xe(),r=at(),n=Zn(),a=up(),i=Ks(),o=Jn(),s=Qs(),u=Qn(),l=cp(),c=TypeError,f=function(d,p){this.stopped=d,this.result=p},h=f.prototype;return Co=function(d,p,v){var g=v&&v.that,P=!!(v&&v.AS_ENTRIES),b=!!(v&&v.IS_RECORD),y=!!(v&&v.IS_ITERATOR),m=!!(v&&v.INTERRUPTED),w=t(p,g),R,A,j,K,B,re,L,M=function(S){return R&&l(R,"normal"),new f(!0,S)},N=function(S){return P?(r(S),m?w(S[0],S[1],M):w(S[0],S[1])):m?w(S,M):w(S)};if(b)R=d.iterator;else if(y)R=d;else{if(A=u(d),!A)throw new c(n(d)+" is not iterable");if(a(A)){for(j=0,K=i(d);K>j;j++)if(B=N(d[j]),B&&o(h,B))return B;return new f(!1)}R=s(d,A)}for(re=b?d.next:R.next;!(L=e(re,R)).done;){try{B=N(L.value)}catch(S){l(R,"throw",S)}if(typeof B=="object"&&B&&o(h,B))return B}return new f(!1)},Co}var Ao,gf;function zm(){if(gf)return Ao;gf=1;var t=St();return Ao=function(e,r){return e===void 0?arguments.length<2?"":r:t(e)},Ao}var yf;function Hm(){if(yf)return ff;yf=1;var t=Ee(),e=Jn(),r=Ws(),n=Vs(),a=Xh(),i=an(),o=nr(),s=rr(),u=Dm(),l=Km(),c=cn(),f=zm(),h=Ue(),d=h("toStringTag"),p=Error,v=[].push,g=function(y,m){var w=e(P,this),R;n?R=n(new p,w?r(this):P):(R=w?this:i(P),o(R,d,"Error")),m!==void 0&&o(R,"message",f(m)),l(R,g,R.stack,1),arguments.length>2&&u(R,arguments[2]);var A=[];return c(y,v,{that:A}),o(R,"errors",A),R};n?n(g,p):a(g,p,{name:!0});var P=g.prototype=i(p.prototype,{constructor:s(1,g),message:s(1,""),name:s(1,"AggregateError")});return t({global:!0,constructor:!0,arity:2},{AggregateError:g}),ff}var wf;function Bm(){return wf||(wf=1,Hm()),lf}var bf={},$o,Sf;function Gm(){if(Sf)return $o;Sf=1;var t=Xs(),e=sn();return $o=t?{}.toString:function(){return"[object "+e(this)+"]"},$o}var If;function Wm(){if(If)return bf;If=1;var t=Xs(),e=Qe(),r=Gm();return t||e(Object.prototype,"toString",r,{unsafe:!0}),bf}var Pf={},Ef={},Uo,kf;function dp(){if(kf)return Uo;kf=1;var t=me(),e=nn(),r=Hn(),n=function(a){return e.slice(0,a.length)===a};return Uo=(function(){return n("Bun/")?"BUN":n("Cloudflare-Workers")?"CLOUDFLARE":n("Deno/")?"DENO":n("Node.js/")?"NODE":t.Bun&&typeof Bun.version=="string"?"BUN":t.Deno&&typeof Deno.version=="object"?"DENO":r(t.process)==="process"?"NODE":t.window&&t.document?"BROWSER":"REST"})(),Uo}var Lo,_f;function ec(){if(_f)return Lo;_f=1;var t=dp();return Lo=t==="NODE",Lo}var qo,Tf;function Vm(){if(Tf)return qo;Tf=1;var t=Xe(),e=Xn(),r=Ue(),n=Le(),a=r("species");return qo=function(i){var o=t(i);n&&o&&!o[a]&&e(o,a,{configurable:!0,get:function(){return this}})},qo}var No,Rf;function Jm(){if(Rf)return No;Rf=1;var t=lp(),e=Zn(),r=TypeError;return No=function(n){if(t(n))return n;throw new r(e(n)+" is not a constructor")},No}var xo,Of;function hp(){if(Of)return xo;Of=1;var t=at(),e=Jm(),r=Bn(),n=Ue(),a=n("species");return xo=function(i,o){var s=t(i).constructor,u;return s===void 0||r(u=t(s)[a])?o:e(u)},xo}var jo,Cf;function pp(){if(Cf)return jo;Cf=1;var t=zn(),e=Function.prototype,r=e.apply,n=e.call;return jo=typeof Reflect=="object"&&Reflect.apply||(t?n.bind(r):function(){return n.apply(r,arguments)}),jo}var Do,Af;function vp(){if(Af)return Do;Af=1;var t=nn();return Do=/(?:ipad|iphone|ipod).*applewebkit/i.test(t),Do}var Mo,$f;function mp(){if($f)return Mo;$f=1;var t=me(),e=pp(),r=Tr(),n=be(),a=Ze(),i=$e(),o=Gh(),s=ea(),u=Vn(),l=ar(),c=vp(),f=ec(),h=t.setImmediate,d=t.clearImmediate,p=t.process,v=t.Dispatch,g=t.Function,P=t.MessageChannel,b=t.String,y=0,m={},w="onreadystatechange",R,A,j,K;i(function(){R=t.location});var B=function(N){if(a(m,N)){var S=m[N];delete m[N],S()}},re=function(N){return function(){B(N)}},L=function(N){B(N.data)},M=function(N){t.postMessage(b(N),R.protocol+"//"+R.host)};return(!h||!d)&&(h=function(S){l(arguments.length,1);var O=n(S)?S:g(S),q=s(arguments,1);return m[++y]=function(){e(O,void 0,q)},A(y),y},d=function(S){delete m[S]},f?A=function(N){p.nextTick(re(N))}:v&&v.now?A=function(N){v.now(re(N))}:P&&!c?(j=new P,K=j.port2,j.port1.onmessage=L,A=r(K.postMessage,K)):t.addEventListener&&n(t.postMessage)&&!t.importScripts&&R&&R.protocol!=="file:"&&!i(M)?(A=M,t.addEventListener("message",L,!1)):w in u("script")?A=function(N){o.appendChild(u("script"))[w]=function(){o.removeChild(this),B(N)}}:A=function(N){setTimeout(re(N),0)}),Mo={set:h,clear:d},Mo}var Fo,Uf;function gp(){if(Uf)return Fo;Uf=1;var t=function(){this.head=null,this.tail=null};return t.prototype={add:function(e){var r={item:e,next:null},n=this.tail;n?n.next=r:this.head=r,this.tail=r},get:function(){var e=this.head;if(e){var r=this.head=e.next;return r===null&&(this.tail=null),e.item}}},Fo=t,Fo}var Ko,Lf;function Zm(){if(Lf)return Ko;Lf=1;var t=nn();return Ko=/ipad|iphone|ipod/i.test(t)&&typeof Pebble<"u",Ko}var zo,qf;function Ym(){if(qf)return zo;qf=1;var t=nn();return zo=/web0s(?!.*chrome)/i.test(t),zo}var Ho,Nf;function Xm(){if(Nf)return Ho;Nf=1;var t=me(),e=np(),r=Tr(),n=mp().set,a=gp(),i=vp(),o=Zm(),s=Ym(),u=ec(),l=t.MutationObserver||t.WebKitMutationObserver,c=t.document,f=t.process,h=t.Promise,d=e("queueMicrotask"),p,v,g,P,b;if(!d){var y=new a,m=function(){var w,R;for(u&&(w=f.domain)&&w.exit();R=y.get();)try{R()}catch(A){throw y.head&&p(),A}w&&w.enter()};!i&&!u&&!s&&l&&c?(v=!0,g=c.createTextNode(""),new l(m).observe(g,{characterData:!0}),p=function(){g.data=v=!v}):!o&&h&&h.resolve?(P=h.resolve(void 0),P.constructor=h,b=r(P.then,P),p=function(){b(m)}):u?p=function(){f.nextTick(m)}:(n=r(n,t),p=function(){n(m)}),d=function(w){y.head||p(),y.add(w)}}return Ho=d,Ho}var Bo,xf;function Qm(){return xf||(xf=1,Bo=function(t,e){try{arguments.length===1?console.error(t):console.error(t,e)}catch{}}),Bo}var Go,jf;function Rr(){return jf||(jf=1,Go=function(t){try{return{error:!1,value:t()}}catch(e){return{error:!0,value:e}}}),Go}var Wo,Df;function Or(){if(Df)return Wo;Df=1;var t=me();return Wo=t.Promise,Wo}var Vo,Mf;function un(){if(Mf)return Vo;Mf=1;var t=me(),e=Or(),r=be(),n=Qh(),a=Gs(),i=Ue(),o=dp(),s=lt(),u=Nh(),l=e&&e.prototype,c=i("species"),f=!1,h=r(t.PromiseRejectionEvent),d=n("Promise",function(){var p=a(e),v=p!==String(e);if(!v&&u===66||s&&!(l.catch&&l.finally))return!0;if(!u||u<51||!/native code/.test(p)){var g=new e(function(y){y(1)}),P=function(y){y(function(){},function(){})},b=g.constructor={};if(b[c]=P,f=g.then(function(){})instanceof P,!f)return!0}return!v&&(o==="BROWSER"||o==="DENO")&&!h});return Vo={CONSTRUCTOR:d,REJECTION_EVENT:h,SUBCLASSING:f},Vo}var Jo={},Ff;function It(){if(Ff)return Jo;Ff=1;var t=it(),e=TypeError,r=function(n){var a,i;this.promise=new n(function(o,s){if(a!==void 0||i!==void 0)throw new e("Bad Promise constructor");a=o,i=s}),this.resolve=t(a),this.reject=t(i)};return Jo.f=function(n){return new r(n)},Jo}var Kf;function eg(){if(Kf)return Ef;Kf=1;var t=Ee(),e=lt(),r=ec(),n=me(),a=ta(),i=xe(),o=Qe(),s=Vs(),u=_r(),l=Vm(),c=it(),f=be(),h=Ye(),d=Ys(),p=hp(),v=mp().set,g=Xm(),P=Qm(),b=Rr(),y=gp(),m=kr(),w=Or(),R=un(),A=It(),j="Promise",K=R.CONSTRUCTOR,B=R.REJECTION_EVENT,re=R.SUBCLASSING,L=m.getterFor(j),M=m.set,N=w&&w.prototype,S=w,O=N,q=n.TypeError,F=n.document,I=n.process,_=A.f,x=_,H=!!(F&&F.createEvent&&n.dispatchEvent),X="unhandledrejection",Z="rejectionhandled",fe=0,ae=1,ue=2,ie=1,Te=2,je,Me,qe,et,Pt=function(z){var Q;return h(z)&&f(Q=z.then)?Q:!1},Et=function(z,Q){var se=Q.value,le=Q.state===ae,de=le?z.ok:z.fail,Be=z.resolve,Re=z.reject,Fe=z.domain,Oe,We,or;try{de?(le||(Q.rejection===Te&&Lt(Q),Q.rejection=ie),de===!0?Oe=se:(Fe&&Fe.enter(),Oe=de(se),Fe&&(Fe.exit(),or=!0)),Oe===z.promise?Re(new q("Promise-chain cycle")):(We=Pt(Oe))?i(We,Oe,Be,Re):Be(Oe)):Re(se)}catch(Ur){Fe&&!or&&Fe.exit(),Re(Ur)}},$t=function(z,Q){z.notified||(z.notified=!0,g(function(){for(var se=z.reactions,le;le=se.get();)Et(le,z);z.notified=!1,Q&&!z.rejection&&$r(z)}))},Ut=function(z,Q,se){var le,de;H?(le=F.createEvent("Event"),le.promise=Q,le.reason=se,le.initEvent(z,!1,!0),n.dispatchEvent(le)):le={promise:Q,reason:se},!B&&(de=n["on"+z])?de(le):z===X&&P("Unhandled promise rejection",se)},$r=function(z){i(v,n,function(){var Q=z.facade,se=z.value,le=ir(z),de;if(le&&(de=b(function(){r?I.emit("unhandledRejection",se,Q):Ut(X,Q,se)}),z.rejection=r||ir(z)?Te:ie,de.error))throw de.value})},ir=function(z){return z.rejection!==ie&&!z.parent},Lt=function(z){i(v,n,function(){var Q=z.facade;r?I.emit("rejectionHandled",Q):Ut(Z,Q,z.value)})},ye=function(z,Q,se){return function(le){z(Q,le,se)}},tt=function(z,Q,se){z.done||(z.done=!0,se&&(z=se),z.value=Q,z.state=ue,$t(z,!0))},qt=function(z,Q,se){if(!z.done){z.done=!0,se&&(z=se);try{if(z.facade===Q)throw new q("Promise can't be resolved itself");var le=Pt(Q);le?g(function(){var de={done:!1};try{i(le,Q,ye(qt,de,z),ye(tt,de,z))}catch(Be){tt(de,Be,z)}}):(z.value=Q,z.state=ae,$t(z,!1))}catch(de){tt({done:!1},de,z)}}};if(K&&(S=function(Q){d(this,O),c(Q),i(je,this);var se=L(this);try{Q(ye(qt,se),ye(tt,se))}catch(le){tt(se,le)}},O=S.prototype,je=function(Q){M(this,{type:j,done:!1,notified:!1,parent:!1,reactions:new y,rejection:!1,state:fe,value:null})},je.prototype=o(O,"then",function(Q,se){var le=L(this),de=_(p(this,S));return le.parent=!0,de.ok=f(Q)?Q:!0,de.fail=f(se)&&se,de.domain=r?I.domain:void 0,le.state===fe?le.reactions.add(de):g(function(){Et(de,le)}),de.promise}),Me=function(){var z=new je,Q=L(z);this.promise=z,this.resolve=ye(qt,Q),this.reject=ye(tt,Q)},A.f=_=function(z){return z===S||z===qe?new Me(z):x(z)},!e&&f(w)&&N!==Object.prototype)){et=N.then,re||o(N,"then",function(Q,se){var le=this;return new S(function(de,Be){i(et,le,de,Be)}).then(Q,se)},{unsafe:!0});try{delete N.constructor}catch{}s&&s(N,O)}return t({global:!0,constructor:!0,wrap:!0,forced:K},{Promise:S}),qe=a.Promise,u(S,j,!1,!0),l(j),Ef}var zf={},Zo,Hf;function tg(){if(Hf)return Zo;Hf=1;var t=Ue(),e=t("iterator"),r=!1;try{var n=0,a={next:function(){return{done:!!n++}},return:function(){r=!0}};a[e]=function(){return this},Array.from(a,function(){throw 2})}catch{}return Zo=function(i,o){try{if(!o&&!r)return!1}catch{return!1}var s=!1;try{var u={};u[e]=function(){return{next:function(){return{done:s=!0}}}},i(u)}catch{}return s},Zo}var Yo,Bf;function ra(){if(Bf)return Yo;Bf=1;var t=Or(),e=tg(),r=un().CONSTRUCTOR;return Yo=r||!e(function(n){t.all(n).then(void 0,function(){})}),Yo}var Gf;function rg(){if(Gf)return zf;Gf=1;var t=Ee(),e=xe(),r=it(),n=It(),a=Rr(),i=cn(),o=ra();return t({target:"Promise",stat:!0,forced:o},{all:function(u){var l=this,c=n.f(l),f=c.resolve,h=c.reject,d=a(function(){var p=r(l.resolve),v=[],g=0,P=1;i(u,function(b){var y=g++,m=!1;P++,e(p,l,b).then(function(w){m||(m=!0,v[y]=w,--P||f(v))},h)}),--P||f(v)});return d.error&&h(d.value),c.promise}}),zf}var Wf={},Vf;function ng(){if(Vf)return Wf;Vf=1;var t=Ee(),e=lt(),r=un().CONSTRUCTOR,n=Or(),a=Xe(),i=be(),o=Qe(),s=n&&n.prototype;if(t({target:"Promise",proto:!0,forced:r,real:!0},{catch:function(l){return this.then(void 0,l)}}),!e&&i(n)){var u=a("Promise").prototype.catch;s.catch!==u&&o(s,"catch",u,{unsafe:!0})}return Wf}var Jf={},Zf;function ag(){if(Zf)return Jf;Zf=1;var t=Ee(),e=xe(),r=it(),n=It(),a=Rr(),i=cn(),o=ra();return t({target:"Promise",stat:!0,forced:o},{race:function(u){var l=this,c=n.f(l),f=c.reject,h=a(function(){var d=r(l.resolve);i(u,function(p){e(d,l,p).then(c.resolve,f)})});return h.error&&f(h.value),c.promise}}),Jf}var Yf={},Xf;function ig(){if(Xf)return Yf;Xf=1;var t=Ee(),e=It(),r=un().CONSTRUCTOR;return t({target:"Promise",stat:!0,forced:r},{reject:function(a){var i=e.f(this),o=i.reject;return o(a),i.promise}}),Yf}var Qf={},Xo,ed;function yp(){if(ed)return Xo;ed=1;var t=at(),e=Ye(),r=It();return Xo=function(n,a){if(t(n),e(a)&&a.constructor===n)return a;var i=r.f(n),o=i.resolve;return o(a),i.promise},Xo}var td;function og(){if(td)return Qf;td=1;var t=Ee(),e=Xe(),r=lt(),n=Or(),a=un().CONSTRUCTOR,i=yp(),o=e("Promise"),s=r&&!a;return t({target:"Promise",stat:!0,forced:r||a},{resolve:function(l){return i(s&&this===o?n:this,l)}}),Qf}var rd;function sg(){return rd||(rd=1,eg(),rg(),ng(),ag(),ig(),og()),Pf}var nd={},ad;function cg(){if(ad)return nd;ad=1;var t=Ee(),e=xe(),r=it(),n=It(),a=Rr(),i=cn(),o=ra();return t({target:"Promise",stat:!0,forced:o},{allSettled:function(u){var l=this,c=n.f(l),f=c.resolve,h=c.reject,d=a(function(){var p=r(l.resolve),v=[],g=0,P=1;i(u,function(b){var y=g++,m=!1;P++,e(p,l,b).then(function(w){m||(m=!0,v[y]={status:"fulfilled",value:w},--P||f(v))},function(w){m||(m=!0,v[y]={status:"rejected",reason:w},--P||f(v))})}),--P||f(v)});return d.error&&h(d.value),c.promise}}),nd}var id={},od;function ug(){if(od)return id;od=1;var t=Ee(),e=xe(),r=it(),n=Xe(),a=It(),i=Rr(),o=cn(),s=ra(),u="No one promise resolved";return t({target:"Promise",stat:!0,forced:s},{any:function(c){var f=this,h=n("AggregateError"),d=a.f(f),p=d.resolve,v=d.reject,g=i(function(){var P=r(f.resolve),b=[],y=0,m=1,w=!1;o(c,function(R){var A=y++,j=!1;m++,e(P,f,R).then(function(K){j||w||(w=!0,p(K))},function(K){j||w||(j=!0,b[A]=K,--m||v(new h(b,u)))})}),--m||v(new h(b,u))});return g.error&&v(g.value),d.promise}}),id}var sd={},cd;function wp(){if(cd)return sd;cd=1;var t=Ee(),e=me(),r=pp(),n=ea(),a=It(),i=it(),o=Rr(),s=e.Promise,u=!1,l=!s||!s.try||o(function(){s.try(function(c){u=c===8},8)}).error||!u;return t({target:"Promise",stat:!0,forced:l},{try:function(c){var f=arguments.length>1?n(arguments,1):[],h=a.f(this),d=o(function(){return r(i(c),void 0,f)});return(d.error?h.reject:h.resolve)(d.value),h.promise}}),sd}var ud={},ld;function bp(){if(ld)return ud;ld=1;var t=Ee(),e=It();return t({target:"Promise",stat:!0},{withResolvers:function(){var n=e.f(this);return{promise:n.promise,resolve:n.resolve,reject:n.reject}}}),ud}var fd={},dd;function lg(){if(dd)return fd;dd=1;var t=Ee(),e=lt(),r=Or(),n=$e(),a=Xe(),i=be(),o=hp(),s=yp(),u=Qe(),l=r&&r.prototype,c=!!r&&n(function(){l.finally.call({then:function(){}},function(){})});if(t({target:"Promise",proto:!0,real:!0,forced:c},{finally:function(h){var d=o(this,a("Promise")),p=i(h);return this.then(p?function(v){return s(d,h()).then(function(){return v})}:h,p?function(v){return s(d,h()).then(function(){throw v})}:h)}}),!e&&i(r)){var f=a("Promise").prototype.finally;l.finally!==f&&u(l,"finally",f,{unsafe:!0})}return fd}var Qo,hd;function fg(){if(hd)return Qo;hd=1,Bm(),Zs(),Wm(),sg(),cg(),ug(),wp(),bp(),lg(),sp();var t=ta();return Qo=t.Promise,Qo}var es,pd;function dg(){if(pd)return es;pd=1;var t=fg();return fp(),es=t,es}var vd={},md;function hg(){return md||(md=1,wp()),vd}var gd={},yd;function pg(){return yd||(yd=1,bp()),gd}var ts,wd;function vg(){if(wd)return ts;wd=1;var t=dg();return hg(),pg(),ts=t,ts}vg();const Sp="sesamy-debug";function mg(t,e,r){const n=new Date;n.setTime(n.getTime()+r*60*60*1e3);const a="expires="+n.toUTCString();document.cookie=`${t}=${e}; ${a}; path=/`}function gg(t){if(typeof document>"u")return null;const e=t+"=",r=document.cookie.split(";");for(let n=0;n<r.length;n++){let a=r[n];for(;a.charAt(0)===" ";)a=a.substring(1);if(a.indexOf(e)===0)return a.substring(e.length,a.length)}return null}function yg(t){mg(Sp,t.toString(),1)}function wg(){return gg(Sp)==="true"}function G(t){wg()&&console.log(t)}function Zt(t,e){if(typeof window>"u")return;const r=new CustomEvent(t,{detail:e,bubbles:!0,composed:!0});G(`Triggering event: ${t}`),dispatchEvent(r)}function ct(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function"){var a=0;for(n=Object.getOwnPropertySymbols(t);a<n.length;a++)e.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(t,n[a])&&(r[n[a]]=t[n[a]])}return r}var Dt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function tc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function rc(t,e){return t(e={exports:{}},e.exports),e.exports}var jt=rc((function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var r=(function(){function n(){var a=this;this.locked=new Map,this.addToLocked=function(i,o){var s=a.locked.get(i);s===void 0?o===void 0?a.locked.set(i,[]):a.locked.set(i,[o]):o!==void 0&&(s.unshift(o),a.locked.set(i,s))},this.isLocked=function(i){return a.locked.has(i)},this.lock=function(i){return new Promise((function(o,s){a.isLocked(i)?a.addToLocked(i,o):(a.addToLocked(i),o())}))},this.unlock=function(i){var o=a.locked.get(i);if(o!==void 0&&o.length!==0){var s=o.pop();a.locked.set(i,o),s!==void 0&&setTimeout(s,0)}else a.locked.delete(i)}}return n.getInstance=function(){return n.instance===void 0&&(n.instance=new n),n.instance},n})();e.default=function(){return r.getInstance()}}));tc(jt);var bg=tc(rc((function(t,e){var r=Dt&&Dt.__awaiter||function(c,f,h,d){return new(h||(h=Promise))((function(p,v){function g(y){try{b(d.next(y))}catch(m){v(m)}}function P(y){try{b(d.throw(y))}catch(m){v(m)}}function b(y){y.done?p(y.value):new h((function(m){m(y.value)})).then(g,P)}b((d=d.apply(c,f||[])).next())}))},n=Dt&&Dt.__generator||function(c,f){var h,d,p,v,g={label:0,sent:function(){if(1&p[0])throw p[1];return p[1]},trys:[],ops:[]};return v={next:P(0),throw:P(1),return:P(2)},typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function P(b){return function(y){return(function(m){if(h)throw new TypeError("Generator is already executing.");for(;g;)try{if(h=1,d&&(p=2&m[0]?d.return:m[0]?d.throw||((p=d.return)&&p.call(d),0):d.next)&&!(p=p.call(d,m[1])).done)return p;switch(d=0,p&&(m=[2&m[0],p.value]),m[0]){case 0:case 1:p=m;break;case 4:return g.label++,{value:m[1],done:!1};case 5:g.label++,d=m[1],m=[0];continue;case 7:m=g.ops.pop(),g.trys.pop();continue;default:if(p=g.trys,!((p=p.length>0&&p[p.length-1])||m[0]!==6&&m[0]!==2)){g=0;continue}if(m[0]===3&&(!p||m[1]>p[0]&&m[1]<p[3])){g.label=m[1];break}if(m[0]===6&&g.label<p[1]){g.label=p[1],p=m;break}if(p&&g.label<p[2]){g.label=p[2],g.ops.push(m);break}p[2]&&g.ops.pop(),g.trys.pop();continue}m=f.call(c,g)}catch(w){m=[6,w],d=0}finally{h=p=0}if(5&m[0])throw m[1];return{value:m[0]?m[1]:void 0,done:!0}})([b,y])}}},a=Dt;Object.defineProperty(e,"__esModule",{value:!0});var i="browser-tabs-lock-key",o={key:function(c){return r(a,void 0,void 0,(function(){return n(this,(function(f){throw new Error("Unsupported")}))}))},getItem:function(c){return r(a,void 0,void 0,(function(){return n(this,(function(f){throw new Error("Unsupported")}))}))},clear:function(){return r(a,void 0,void 0,(function(){return n(this,(function(c){return[2,window.localStorage.clear()]}))}))},removeItem:function(c){return r(a,void 0,void 0,(function(){return n(this,(function(f){throw new Error("Unsupported")}))}))},setItem:function(c,f){return r(a,void 0,void 0,(function(){return n(this,(function(h){throw new Error("Unsupported")}))}))},keySync:function(c){return window.localStorage.key(c)},getItemSync:function(c){return window.localStorage.getItem(c)},clearSync:function(){return window.localStorage.clear()},removeItemSync:function(c){return window.localStorage.removeItem(c)},setItemSync:function(c,f){return window.localStorage.setItem(c,f)}};function s(c){return new Promise((function(f){return setTimeout(f,c)}))}function u(c){for(var f="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",h="",d=0;d<c;d++)h+=f[Math.floor(Math.random()*f.length)];return h}var l=(function(){function c(f){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+u(15),this.acquireLock=this.acquireLock.bind(this),this.releaseLock=this.releaseLock.bind(this),this.releaseLock__private__=this.releaseLock__private__.bind(this),this.waitForSomethingToChange=this.waitForSomethingToChange.bind(this),this.refreshLockWhileAcquired=this.refreshLockWhileAcquired.bind(this),this.storageHandler=f,c.waiters===void 0&&(c.waiters=[])}return c.prototype.acquireLock=function(f,h){return h===void 0&&(h=5e3),r(this,void 0,void 0,(function(){var d,p,v,g,P,b,y;return n(this,(function(m){switch(m.label){case 0:d=Date.now()+u(4),p=Date.now()+h,v=i+"-"+f,g=this.storageHandler===void 0?o:this.storageHandler,m.label=1;case 1:return Date.now()<p?[4,s(30)]:[3,8];case 2:return m.sent(),g.getItemSync(v)!==null?[3,5]:(P=this.id+"-"+f+"-"+d,[4,s(Math.floor(25*Math.random()))]);case 3:return m.sent(),g.setItemSync(v,JSON.stringify({id:this.id,iat:d,timeoutKey:P,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,s(30)];case 4:return m.sent(),(b=g.getItemSync(v))!==null&&(y=JSON.parse(b)).id===this.id&&y.iat===d?(this.acquiredIatSet.add(d),this.refreshLockWhileAcquired(v,d),[2,!0]):[3,7];case 5:return c.lockCorrector(this.storageHandler===void 0?o:this.storageHandler),[4,this.waitForSomethingToChange(p)];case 6:m.sent(),m.label=7;case 7:return d=Date.now()+u(4),[3,1];case 8:return[2,!1]}}))}))},c.prototype.refreshLockWhileAcquired=function(f,h){return r(this,void 0,void 0,(function(){var d=this;return n(this,(function(p){return setTimeout((function(){return r(d,void 0,void 0,(function(){var v,g,P;return n(this,(function(b){switch(b.label){case 0:return[4,jt.default().lock(h)];case 1:return b.sent(),this.acquiredIatSet.has(h)?(v=this.storageHandler===void 0?o:this.storageHandler,(g=v.getItemSync(f))===null?(jt.default().unlock(h),[2]):((P=JSON.parse(g)).timeRefreshed=Date.now(),v.setItemSync(f,JSON.stringify(P)),jt.default().unlock(h),this.refreshLockWhileAcquired(f,h),[2])):(jt.default().unlock(h),[2])}}))}))}),1e3),[2]}))}))},c.prototype.waitForSomethingToChange=function(f){return r(this,void 0,void 0,(function(){return n(this,(function(h){switch(h.label){case 0:return[4,new Promise((function(d){var p=!1,v=Date.now(),g=!1;function P(){if(g||(window.removeEventListener("storage",P),c.removeFromWaiting(P),clearTimeout(b),g=!0),!p){p=!0;var y=50-(Date.now()-v);y>0?setTimeout(d,y):d(null)}}window.addEventListener("storage",P),c.addToWaiting(P);var b=setTimeout(P,Math.max(0,f-Date.now()))}))];case 1:return h.sent(),[2]}}))}))},c.addToWaiting=function(f){this.removeFromWaiting(f),c.waiters!==void 0&&c.waiters.push(f)},c.removeFromWaiting=function(f){c.waiters!==void 0&&(c.waiters=c.waiters.filter((function(h){return h!==f})))},c.notifyWaiters=function(){c.waiters!==void 0&&c.waiters.slice().forEach((function(f){return f()}))},c.prototype.releaseLock=function(f){return r(this,void 0,void 0,(function(){return n(this,(function(h){switch(h.label){case 0:return[4,this.releaseLock__private__(f)];case 1:return[2,h.sent()]}}))}))},c.prototype.releaseLock__private__=function(f){return r(this,void 0,void 0,(function(){var h,d,p,v;return n(this,(function(g){switch(g.label){case 0:return h=this.storageHandler===void 0?o:this.storageHandler,d=i+"-"+f,(p=h.getItemSync(d))===null?[2]:(v=JSON.parse(p)).id!==this.id?[3,2]:[4,jt.default().lock(v.iat)];case 1:g.sent(),this.acquiredIatSet.delete(v.iat),h.removeItemSync(d),jt.default().unlock(v.iat),c.notifyWaiters(),g.label=2;case 2:return[2]}}))}))},c.lockCorrector=function(f){for(var h=Date.now()-5e3,d=f,p=[],v=0;;){var g=d.keySync(v);if(g===null)break;p.push(g),v++}for(var P=!1,b=0;b<p.length;b++){var y=p[b];if(y.includes(i)){var m=d.getItemSync(y);if(m!==null){var w=JSON.parse(m);(w.timeRefreshed===void 0&&w.timeAcquired<h||w.timeRefreshed!==void 0&&w.timeRefreshed<h)&&(d.removeItemSync(y),P=!0)}}}P&&c.notifyWaiters()},c.waiters=void 0,c})();e.default=l})));const Sg={timeoutInSeconds:60},Ip={name:"auth0-spa-js",version:"2.11.3"},Pp=()=>Date.now();let Pe=class ws extends Error{constructor(e,r){super(r),this.error=e,this.error_description=r,Object.setPrototypeOf(this,ws.prototype)}static fromPayload({error:e,error_description:r}){return new ws(e,r)}},Ig=class Ep extends Pe{constructor(e,r,n,a=null){super(e,r),this.state=n,this.appState=a,Object.setPrototypeOf(this,Ep.prototype)}},Pg=class kp extends Pe{constructor(e,r,n,a,i=null){super(e,r),this.connection=n,this.state=a,this.appState=i,Object.setPrototypeOf(this,kp.prototype)}},Pn=class _p extends Pe{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,_p.prototype)}};class nc extends Pn{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,nc.prototype)}}let Eg=class Tp extends Pe{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,Tp.prototype)}},kg=class Rp extends Pe{constructor(){super("popup_open","Unable to open a popup for loginWithPopup - window.open returned `null`"),Object.setPrototypeOf(this,Rp.prototype)}},_g=class Op extends Pe{constructor(e,r,n){super(e,r),this.mfa_token=n,Object.setPrototypeOf(this,Op.prototype)}},Cp=class Ap extends Pe{constructor(e,r){super("missing_refresh_token",`Missing Refresh Token (audience: '${$n(e,["default"])}', scope: '${$n(r)}')`),this.audience=e,this.scope=r,Object.setPrototypeOf(this,Ap.prototype)}},Tg=class $p extends Pe{constructor(e,r){super("missing_scopes",`Missing requested scopes after refresh (audience: '${$n(e,["default"])}', missing scope: '${$n(r)}')`),this.audience=e,this.scope=r,Object.setPrototypeOf(this,$p.prototype)}},Up=class Lp extends Pe{constructor(e){super("use_dpop_nonce","Server rejected DPoP proof: wrong nonce"),this.newDpopNonce=e,Object.setPrototypeOf(this,Lp.prototype)}};function $n(t,e=[]){return t&&!e.includes(t)?t:""}const Un=()=>window.crypto,qr=()=>{const t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let e="";return Array.from(Un().getRandomValues(new Uint8Array(43))).forEach((r=>e+=t[r%t.length])),e},rs=t=>btoa(t),Rg=[{key:"name",type:["string"]},{key:"version",type:["string","number"]},{key:"env",type:["object"]}],Og=t=>Object.keys(t).reduce(((e,r)=>{const n=Rg.find((a=>a.key===r));return n&&n.type.includes(typeof t[r])&&(e[r]=t[r]),e}),{}),bs=t=>{var{clientId:e}=t,r=ct(t,["clientId"]);return new URLSearchParams((n=>Object.keys(n).filter((a=>n[a]!==void 0)).reduce(((a,i)=>Object.assign(Object.assign({},a),{[i]:n[i]})),{}))(Object.assign({client_id:e},r))).toString()},bd=async t=>await Un().subtle.digest({name:"SHA-256"},new TextEncoder().encode(t)),Sd=t=>(e=>decodeURIComponent(atob(e).split("").map((r=>"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2))).join("")))(t.replace(/_/g,"/").replace(/-/g,"+")),Id=t=>{const e=new Uint8Array(t);return(r=>{const n={"+":"-","/":"_","=":""};return r.replace(/[+/=]/g,(a=>n[a]))})(window.btoa(String.fromCharCode(...Array.from(e))))},Cg=new TextEncoder,Ag=new TextDecoder;function Jr(t){return typeof t=="string"?Cg.encode(t):Ag.decode(t)}function Pd(t){if(typeof t.modulusLength!="number"||t.modulusLength<2048)throw new Ug(`${t.name} modulusLength must be at least 2048 bits`)}async function $g(t,e,r){if(r.usages.includes("sign")===!1)throw new TypeError('private CryptoKey instances used for signing assertions must include "sign" in their "usages"');const n=`${Zr(Jr(JSON.stringify(t)))}.${Zr(Jr(JSON.stringify(e)))}`;return`${n}.${Zr(await crypto.subtle.sign((function(a){switch(a.algorithm.name){case"ECDSA":return{name:a.algorithm.name,hash:"SHA-256"};case"RSA-PSS":return Pd(a.algorithm),{name:a.algorithm.name,saltLength:32};case"RSASSA-PKCS1-v1_5":return Pd(a.algorithm),{name:a.algorithm.name};case"Ed25519":return{name:a.algorithm.name}}throw new Kt})(r),r,Jr(n)))}`}let Ss;Uint8Array.prototype.toBase64?Ss=t=>(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),t.toBase64({alphabet:"base64url",omitPadding:!0})):Ss=e=>{e instanceof ArrayBuffer&&(e=new Uint8Array(e));const r=[];for(let n=0;n<e.byteLength;n+=32768)r.push(String.fromCharCode.apply(null,e.subarray(n,n+32768)));return btoa(r.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")};function Zr(t){return Ss(t)}let Kt=class extends Error{constructor(e){var r;super(e??"operation not supported"),this.name=this.constructor.name,(r=Error.captureStackTrace)===null||r===void 0||r.call(Error,this,this.constructor)}},Ug=class extends Error{constructor(e){var r;super(e),this.name=this.constructor.name,(r=Error.captureStackTrace)===null||r===void 0||r.call(Error,this,this.constructor)}};function Lg(t){switch(t.algorithm.name){case"RSA-PSS":return(function(e){if(e.algorithm.hash.name==="SHA-256")return"PS256";throw new Kt("unsupported RsaHashedKeyAlgorithm hash name")})(t);case"RSASSA-PKCS1-v1_5":return(function(e){if(e.algorithm.hash.name==="SHA-256")return"RS256";throw new Kt("unsupported RsaHashedKeyAlgorithm hash name")})(t);case"ECDSA":return(function(e){if(e.algorithm.namedCurve==="P-256")return"ES256";throw new Kt("unsupported EcKeyAlgorithm namedCurve")})(t);case"Ed25519":return"Ed25519";default:throw new Kt("unsupported CryptoKey algorithm name")}}function qp(t){return t instanceof CryptoKey}function Np(t){return qp(t)&&t.type==="public"}async function qg(t,e,r,n,a,i){const o=t?.privateKey,s=t?.publicKey;if(!qp(u=o)||u.type!=="private")throw new TypeError('"keypair.privateKey" must be a private CryptoKey');var u;if(!Np(s))throw new TypeError('"keypair.publicKey" must be a public CryptoKey');if(s.extractable!==!0)throw new TypeError('"keypair.publicKey.extractable" must be true');if(typeof e!="string")throw new TypeError('"htu" must be a string');if(typeof r!="string")throw new TypeError('"htm" must be a string');if(n!==void 0&&typeof n!="string")throw new TypeError('"nonce" must be a string or undefined');if(a!==void 0&&typeof a!="string")throw new TypeError('"accessToken" must be a string or undefined');return $g({alg:Lg(o),typ:"dpop+jwt",jwk:await xp(s)},Object.assign(Object.assign({},i),{iat:Math.floor(Date.now()/1e3),jti:crypto.randomUUID(),htm:r,nonce:n,htu:e,ath:a?Zr(await crypto.subtle.digest("SHA-256",Jr(a))):void 0}),o)}async function xp(t){const{kty:e,e:r,n,x:a,y:i,crv:o}=await crypto.subtle.exportKey("jwk",t);return{kty:e,crv:o,e:r,n,x:a,y:i}}const Ng=["authorization_code","refresh_token","urn:ietf:params:oauth:grant-type:token-exchange"];function xg(){return(async function(t,e){var r;let n;if(t.length===0)throw new TypeError('"alg" must be a non-empty string');switch(t){case"PS256":n={name:"RSA-PSS",hash:"SHA-256",modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case"RS256":n={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256",modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case"ES256":n={name:"ECDSA",namedCurve:"P-256"};break;case"Ed25519":n={name:"Ed25519"};break;default:throw new Kt}return crypto.subtle.generateKey(n,(r=e?.extractable)!==null&&r!==void 0&&r,["sign","verify"])})("ES256",{extractable:!1})}function jg(t){return(async function(e){if(!Np(e))throw new TypeError('"publicKey" must be a public CryptoKey');if(e.extractable!==!0)throw new TypeError('"publicKey.extractable" must be true');const r=await xp(e);let n;switch(r.kty){case"EC":n={crv:r.crv,kty:r.kty,x:r.x,y:r.y};break;case"OKP":n={crv:r.crv,kty:r.kty,x:r.x};break;case"RSA":n={e:r.e,kty:r.kty,n:r.n};break;default:throw new Kt("unsupported JWK kty")}return Zr(await crypto.subtle.digest({name:"SHA-256"},Jr(JSON.stringify(n))))})(t.publicKey)}function Dg({keyPair:t,url:e,method:r,nonce:n,accessToken:a}){const i=(function(o){const s=new URL(o);return s.search="",s.hash="",s.href})(e);return qg(t,i,r,n,a)}const Mg=async(t,e)=>{const r=await fetch(t,e);return{ok:r.ok,json:await r.json(),headers:(n=r.headers,[...n].reduce(((a,[i,o])=>(a[i]=o,a)),{}))};var n},Fg=async(t,e,r)=>{const n=new AbortController;let a;return e.signal=n.signal,Promise.race([Mg(t,e),new Promise(((i,o)=>{a=setTimeout((()=>{n.abort(),o(new Error("Timeout when executing 'fetch'"))}),r)}))]).finally((()=>{clearTimeout(a)}))},Kg=async(t,e,r,n,a,i,o,s)=>{return u={auth:{audience:e,scope:r},timeout:a,fetchUrl:t,fetchOptions:n,useFormData:o,useMrrt:s},l=i,new Promise((function(c,f){const h=new MessageChannel;h.port1.onmessage=function(d){d.data.error?f(new Error(d.data.error)):c(d.data),h.port1.close()},l.postMessage(u,[h.port2])}));var u,l},zg=async(t,e,r,n,a,i,o=1e4,s)=>a?Kg(t,e,r,n,o,a,i,s):Fg(t,n,o);async function jp(t,e,r,n,a,i,o,s,u,l){if(u){const y=await u.generateProof({url:t,method:a.method||"GET",nonce:await u.getNonce()});a.headers=Object.assign(Object.assign({},a.headers),{dpop:y})}let c,f=null;for(let y=0;y<3;y++)try{c=await zg(t,r,n,a,i,o,e,s),f=null;break}catch(m){f=m}if(f)throw f;const h=c.json,{error:d,error_description:p}=h,v=ct(h,["error","error_description"]),{headers:g,ok:P}=c;let b;if(u&&(b=g["dpop-nonce"],b&&await u.setNonce(b)),!P){const y=p||`HTTP error. Unable to fetch ${t}`;if(d==="mfa_required")throw new _g(d,y,v.mfa_token);if(d==="missing_refresh_token")throw new Cp(r,n);if(d==="use_dpop_nonce"){if(!u||!b||l)throw new Up(b);return jp(t,e,r,n,a,i,o,s,u,!0)}throw new Pe(d||"request_error",y)}return v}async function Hg(t,e){var{baseUrl:r,timeout:n,audience:a,scope:i,auth0Client:o,useFormData:s,useMrrt:u,dpop:l}=t,c=ct(t,["baseUrl","timeout","audience","scope","auth0Client","useFormData","useMrrt","dpop"]);const f=c.grant_type==="urn:ietf:params:oauth:grant-type:token-exchange",h=c.grant_type==="refresh_token"&&u,d=Object.assign(Object.assign(Object.assign(Object.assign({},c),f&&a&&{audience:a}),f&&i&&{scope:i}),h&&{audience:a,scope:i}),p=s?bs(d):JSON.stringify(d),v=(g=c.grant_type,Ng.includes(g));var g;return await jp(`${r}/oauth/token`,n,a||"default",i,{method:"POST",body:p,headers:{"Content-Type":s?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(Og(o||Ip)))}},e,s,u,v?l:void 0)}const En=(...t)=>{return(e=t.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(e))).join(" ");var e},vn=(t,e,r)=>{let n;return r&&(n=t[r]),n||(n=t.default),En(n,e)};let vt=class Is{constructor(e,r="@@auth0spajs@@",n){this.prefix=r,this.suffix=n,this.clientId=e.clientId,this.scope=e.scope,this.audience=e.audience}toKey(){return[this.prefix,this.clientId,this.audience,this.scope,this.suffix].filter(Boolean).join("::")}static fromKey(e){const[r,n,a,i]=e.split("::");return new Is({clientId:n,scope:i,audience:a},r)}static fromCacheEntry(e){const{scope:r,audience:n,client_id:a}=e;return new Is({scope:r,audience:n,clientId:a})}},Bg=class{set(e,r){localStorage.setItem(e,JSON.stringify(r))}get(e){const r=window.localStorage.getItem(e);if(r)try{return JSON.parse(r)}catch{return}}remove(e){localStorage.removeItem(e)}allKeys(){return Object.keys(window.localStorage).filter((e=>e.startsWith("@@auth0spajs@@")))}},Dp=class{constructor(){this.enclosedCache=(function(){let e={};return{set(r,n){e[r]=n},get(r){const n=e[r];if(n)return n},remove(r){delete e[r]},allKeys:()=>Object.keys(e)}})()}},Gg=class{constructor(e,r,n){this.cache=e,this.keyManifest=r,this.nowProvider=n||Pp}async setIdToken(e,r,n){var a;const i=this.getIdTokenCacheKey(e);await this.cache.set(i,{id_token:r,decodedToken:n}),await((a=this.keyManifest)===null||a===void 0?void 0:a.add(i))}async getIdToken(e){const r=await this.cache.get(this.getIdTokenCacheKey(e.clientId));if(!r&&e.scope&&e.audience){const n=await this.get(e);return!n||!n.id_token||!n.decodedToken?void 0:{id_token:n.id_token,decodedToken:n.decodedToken}}if(r)return{id_token:r.id_token,decodedToken:r.decodedToken}}async get(e,r=0,n=!1,a){var i;let o=await this.cache.get(e.toKey());if(!o){const l=await this.getCacheKeys();if(!l)return;const c=this.matchExistingCacheKey(e,l);if(c&&(o=await this.cache.get(c)),!o&&n&&a!=="cache-only")return this.getEntryWithRefreshToken(e,l)}if(!o)return;const s=await this.nowProvider(),u=Math.floor(s/1e3);return o.expiresAt-r<u?o.body.refresh_token?this.modifiedCachedEntry(o,e):(await this.cache.remove(e.toKey()),void await((i=this.keyManifest)===null||i===void 0?void 0:i.remove(e.toKey()))):o.body}async modifiedCachedEntry(e,r){return e.body={refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope},await this.cache.set(r.toKey(),e),{refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope}}async set(e){var r;const n=new vt({clientId:e.client_id,scope:e.scope,audience:e.audience}),a=await this.wrapCacheEntry(e);await this.cache.set(n.toKey(),a),await((r=this.keyManifest)===null||r===void 0?void 0:r.add(n.toKey()))}async remove(e,r,n){const a=new vt({clientId:e,scope:n,audience:r});await this.cache.remove(a.toKey())}async clear(e){var r;const n=await this.getCacheKeys();n&&(await n.filter((a=>!e||a.includes(e))).reduce((async(a,i)=>{await a,await this.cache.remove(i)}),Promise.resolve()),await((r=this.keyManifest)===null||r===void 0?void 0:r.clear()))}async wrapCacheEntry(e){const r=await this.nowProvider();return{body:e,expiresAt:Math.floor(r/1e3)+e.expires_in}}async getCacheKeys(){var e;return this.keyManifest?(e=await this.keyManifest.get())===null||e===void 0?void 0:e.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(e){return new vt({clientId:e},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(e,r){return r.filter((n=>{var a;const i=vt.fromKey(n),o=new Set(i.scope&&i.scope.split(" ")),s=((a=e.scope)===null||a===void 0?void 0:a.split(" "))||[],u=i.scope&&s.reduce(((l,c)=>l&&o.has(c)),!0);return i.prefix==="@@auth0spajs@@"&&i.clientId===e.clientId&&i.audience===e.audience&&u}))[0]}async getEntryWithRefreshToken(e,r){var n;for(const a of r){const i=vt.fromKey(a);if(i.prefix==="@@auth0spajs@@"&&i.clientId===e.clientId){const o=await this.cache.get(a);if(!((n=o?.body)===null||n===void 0)&&n.refresh_token)return this.modifiedCachedEntry(o,e)}}}async updateEntry(e,r){var n;const a=await this.getCacheKeys();if(a)for(const i of a){const o=await this.cache.get(i);if(((n=o?.body)===null||n===void 0?void 0:n.refresh_token)===e){const s=Object.assign(Object.assign({},o.body),{refresh_token:r});await this.set(s)}}}},Wg=class{constructor(e,r,n){this.storage=e,this.clientId=r,this.cookieDomain=n,this.storageKey=`a0.spajs.txs.${this.clientId}`}create(e){this.storage.save(this.storageKey,e,{daysUntilExpire:1,cookieDomain:this.cookieDomain})}get(){return this.storage.get(this.storageKey)}remove(){this.storage.remove(this.storageKey,{cookieDomain:this.cookieDomain})}};const Nr=t=>typeof t=="number",Vg=["iss","aud","exp","nbf","iat","jti","azp","nonce","auth_time","at_hash","c_hash","acr","amr","sub_jwk","cnf","sip_from_tag","sip_date","sip_callid","sip_cseq_num","sip_via_branch","orig","dest","mky","events","toe","txn","rph","sid","vot","vtm"],Jg=t=>{if(!t.id_token)throw new Error("ID token is required but missing");const e=(i=>{const o=i.split("."),[s,u,l]=o;if(o.length!==3||!s||!u||!l)throw new Error("ID token could not be decoded");const c=JSON.parse(Sd(u)),f={__raw:i},h={};return Object.keys(c).forEach((d=>{f[d]=c[d],Vg.includes(d)||(h[d]=c[d])})),{encoded:{header:s,payload:u,signature:l},header:JSON.parse(Sd(s)),claims:f,user:h}})(t.id_token);if(!e.claims.iss)throw new Error("Issuer (iss) claim must be a string present in the ID token");if(e.claims.iss!==t.iss)throw new Error(`Issuer (iss) claim mismatch in the ID token; expected "${t.iss}", found "${e.claims.iss}"`);if(!e.user.sub)throw new Error("Subject (sub) claim must be a string present in the ID token");if(e.header.alg!=="RS256")throw new Error(`Signature algorithm of "${e.header.alg}" is not supported. Expected the ID token to be signed with "RS256".`);if(!e.claims.aud||typeof e.claims.aud!="string"&&!Array.isArray(e.claims.aud))throw new Error("Audience (aud) claim must be a string or array of strings present in the ID token");if(Array.isArray(e.claims.aud)){if(!e.claims.aud.includes(t.aud))throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${t.aud}" but was not one of "${e.claims.aud.join(", ")}"`);if(e.claims.aud.length>1){if(!e.claims.azp)throw new Error("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values");if(e.claims.azp!==t.aud)throw new Error(`Authorized Party (azp) claim mismatch in the ID token; expected "${t.aud}", found "${e.claims.azp}"`)}}else if(e.claims.aud!==t.aud)throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${t.aud}" but found "${e.claims.aud}"`);if(t.nonce){if(!e.claims.nonce)throw new Error("Nonce (nonce) claim must be a string present in the ID token");if(e.claims.nonce!==t.nonce)throw new Error(`Nonce (nonce) claim mismatch in the ID token; expected "${t.nonce}", found "${e.claims.nonce}"`)}if(t.max_age&&!Nr(e.claims.auth_time))throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");if(e.claims.exp==null||!Nr(e.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!Nr(e.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const r=t.leeway||60,n=new Date(t.now||Date.now()),a=new Date(0);if(a.setUTCSeconds(e.claims.exp+r),n>a)throw new Error(`Expiration Time (exp) claim error in the ID token; current time (${n}) is after expiration time (${a})`);if(e.claims.nbf!=null&&Nr(e.claims.nbf)){const i=new Date(0);if(i.setUTCSeconds(e.claims.nbf-r),n<i)throw new Error(`Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (${n}) is before ${i}`)}if(e.claims.auth_time!=null&&Nr(e.claims.auth_time)){const i=new Date(0);if(i.setUTCSeconds(parseInt(e.claims.auth_time)+t.max_age+r),n>i)throw new Error(`Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (${n}) is after last auth at ${i}`)}if(t.organization){const i=t.organization.trim();if(i.startsWith("org_")){const o=i;if(!e.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(o!==e.claims.org_id)throw new Error(`Organization ID (org_id) claim mismatch in the ID token; expected "${o}", found "${e.claims.org_id}"`)}else{const o=i.toLowerCase();if(!e.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(o!==e.claims.org_name)throw new Error(`Organization Name (org_name) claim mismatch in the ID token; expected "${o}", found "${e.claims.org_name}"`)}}return e};var zt=rc((function(t,e){var r=Dt&&Dt.__assign||function(){return r=Object.assign||function(u){for(var l,c=1,f=arguments.length;c<f;c++)for(var h in l=arguments[c])Object.prototype.hasOwnProperty.call(l,h)&&(u[h]=l[h]);return u},r.apply(this,arguments)};function n(u,l){if(!l)return"";var c="; "+u;return l===!0?c:c+"="+l}function a(u,l,c){return encodeURIComponent(u).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(l).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+(function(f){if(typeof f.expires=="number"){var h=new Date;h.setMilliseconds(h.getMilliseconds()+864e5*f.expires),f.expires=h}return n("Expires",f.expires?f.expires.toUTCString():"")+n("Domain",f.domain)+n("Path",f.path)+n("Secure",f.secure)+n("SameSite",f.sameSite)})(c)}function i(u){for(var l={},c=u?u.split("; "):[],f=/(%[\dA-F]{2})+/gi,h=0;h<c.length;h++){var d=c[h].split("="),p=d.slice(1).join("=");p.charAt(0)==='"'&&(p=p.slice(1,-1));try{l[d[0].replace(f,decodeURIComponent)]=p.replace(f,decodeURIComponent)}catch{}}return l}function o(){return i(document.cookie)}function s(u,l,c){document.cookie=a(u,l,r({path:"/"},c))}e.__esModule=!0,e.encode=a,e.parse=i,e.getAll=o,e.get=function(u){return o()[u]},e.set=s,e.remove=function(u,l){s(u,"",r(r({},l),{expires:-1}))}}));tc(zt),zt.encode,zt.parse,zt.getAll;var Zg=zt.get,Mp=zt.set,Fp=zt.remove;const pr={get(t){const e=Zg(t);if(e!==void 0)return JSON.parse(e)},save(t,e,r){let n={};window.location.protocol==="https:"&&(n={secure:!0,sameSite:"none"}),r?.daysUntilExpire&&(n.expires=r.daysUntilExpire),r?.cookieDomain&&(n.domain=r.cookieDomain),Mp(t,JSON.stringify(e),n)},remove(t,e){let r={};e?.cookieDomain&&(r.domain=e.cookieDomain),Fp(t,r)}},Yg={get(t){return pr.get(t)||pr.get(`_legacy_${t}`)},save(t,e,r){let n={};window.location.protocol==="https:"&&(n={secure:!0}),r?.daysUntilExpire&&(n.expires=r.daysUntilExpire),r?.cookieDomain&&(n.domain=r.cookieDomain),Mp(`_legacy_${t}`,JSON.stringify(e),n),pr.save(t,e,r)},remove(t,e){let r={};e?.cookieDomain&&(r.domain=e.cookieDomain),Fp(t,r),pr.remove(t,e),pr.remove(`_legacy_${t}`,e)}},Xg={get(t){if(typeof sessionStorage>"u")return;const e=sessionStorage.getItem(t);return e!=null?JSON.parse(e):void 0},save(t,e){sessionStorage.setItem(t,JSON.stringify(e))},remove(t){sessionStorage.removeItem(t)}};var Mt;(function(t){t.Code="code",t.ConnectCode="connect_code"})(Mt||(Mt={}));function Qg(t,e,r){var n=e===void 0?null:e,a=(function(u,l){var c=atob(u);if(l){for(var f=new Uint8Array(c.length),h=0,d=c.length;h<d;++h)f[h]=c.charCodeAt(h);return String.fromCharCode.apply(null,new Uint16Array(f.buffer))}return c})(t,r!==void 0&&r),i=a.indexOf(`
2
- `,10)+1,o=a.substring(i)+(n?"//# sourceMappingURL="+n:""),s=new Blob([o],{type:"application/javascript"});return URL.createObjectURL(s)}var Ed,kd,_d,ns,ey=(Ed="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YSx1c2VNcnJ0OmZ9LHBvcnRzOltwXX0pPT57bGV0IGgsdSxsPXt9O2NvbnN0e2F1ZGllbmNlOmQsc2NvcGU6eX09cnx8e307dHJ5e2NvbnN0IHI9YT8oZT0+e2NvbnN0IHQ9bmV3IFVSTFNlYXJjaFBhcmFtcyhlKSxyPXt9O3JldHVybiB0LmZvckVhY2goKChlLHQpPT57clt0XT1lfSkpLHJ9KShjLmJvZHkpOkpTT04ucGFyc2UoYy5ib2R5KTtpZighci5yZWZyZXNoX3Rva2VuJiYicmVmcmVzaF90b2tlbiI9PT1yLmdyYW50X3R5cGUpe2lmKHU9KChlLHQpPT5vW24oZSx0KV0pKGQseSksIXUmJmYpe2NvbnN0IGU9by5sYXRlc3RfcmVmcmVzaF90b2tlbix0PSgoZSx0KT0+e2NvbnN0IHI9T2JqZWN0LmtleXMobykuZmluZCgocj0+e2lmKCJsYXRlc3RfcmVmcmVzaF90b2tlbiIhPT1yKXtjb25zdCBzPSgoZSx0KT0+dC5zdGFydHNXaXRoKGAke2V9fGApKSh0LHIpLG89ci5zcGxpdCgifCIpWzFdLnNwbGl0KCIgIiksbj1lLnNwbGl0KCIgIikuZXZlcnkoKGU9Pm8uaW5jbHVkZXMoZSkpKTtyZXR1cm4gcyYmbn19KSk7cmV0dXJuISFyfSkoeSxkKTtlJiYhdCYmKHU9ZSl9aWYoIXUpdGhyb3cgbmV3IHQoZCx5KTtjLmJvZHk9YT9zKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxyKSx7cmVmcmVzaF90b2tlbjp1fSkpOkpTT04uc3RyaW5naWZ5KE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxyKSx7cmVmcmVzaF90b2tlbjp1fSkpfWxldCBqLGs7ImZ1bmN0aW9uIj09dHlwZW9mIEFib3J0Q29udHJvbGxlciYmKGo9bmV3IEFib3J0Q29udHJvbGxlcixjLnNpZ25hbD1qLnNpZ25hbCk7dHJ5e2s9YXdhaXQgUHJvbWlzZS5yYWNlKFsoXz1lLG5ldyBQcm9taXNlKChlPT5zZXRUaW1lb3V0KGUsXykpKSksZmV0Y2goaSxPYmplY3QuYXNzaWduKHt9LGMpKV0pfWNhdGNoKGUpe3JldHVybiB2b2lkIHAucG9zdE1lc3NhZ2Uoe2Vycm9yOmUubWVzc2FnZX0pfWlmKCFrKXJldHVybiBqJiZqLmFib3J0KCksdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjoiVGltZW91dCB3aGVuIGV4ZWN1dGluZyAnZmV0Y2gnIn0pO2c9ay5oZWFkZXJzLGw9Wy4uLmddLnJlZHVjZSgoKGUsW3Qscl0pPT4oZVt0XT1yLGUpKSx7fSksaD1hd2FpdCBrLmpzb24oKSxoLnJlZnJlc2hfdG9rZW4/KGYmJihvLmxhdGVzdF9yZWZyZXNoX3Rva2VuPWgucmVmcmVzaF90b2tlbixPPXUsYj1oLnJlZnJlc2hfdG9rZW4sT2JqZWN0LmVudHJpZXMobykuZm9yRWFjaCgoKFtlLHRdKT0+e3Q9PT1PJiYob1tlXT1iKX0pKSksKChlLHQscik9PntvW24odCxyKV09ZX0pKGgucmVmcmVzaF90b2tlbixkLHkpLGRlbGV0ZSBoLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KShkLHkpLHAucG9zdE1lc3NhZ2Uoe29rOmsub2ssanNvbjpoLGhlYWRlcnM6bH0pfWNhdGNoKGUpe3AucG9zdE1lc3NhZ2Uoe29rOiExLGpzb246e2Vycm9yOmUuZXJyb3IsZXJyb3JfZGVzY3JpcHRpb246ZS5tZXNzYWdlfSxoZWFkZXJzOmx9KX12YXIgTyxiLGcsX30pKX0oKTsKCg==",kd=null,_d=!1,function(t){return ns=ns||Qg(Ed,kd,_d),new Worker(ns,t)});const as={},Td=async(t,e=3)=>{for(let r=0;r<e;r++)if(await t())return!0;return!1};let ty=class{constructor(e,r){this.cache=e,this.clientId=r,this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(e){var r;const n=new Set(((r=await this.cache.get(this.manifestKey))===null||r===void 0?void 0:r.keys)||[]);n.add(e),await this.cache.set(this.manifestKey,{keys:[...n]})}async remove(e){const r=await this.cache.get(this.manifestKey);if(r){const n=new Set(r.keys);return n.delete(e),n.size>0?await this.cache.set(this.manifestKey,{keys:[...n]}):await this.cache.remove(this.manifestKey)}}get(){return this.cache.get(this.manifestKey)}clear(){return this.cache.remove(this.manifestKey)}createManifestKeyFrom(e){return`@@auth0spajs@@::${e}`}};const ry={memory:()=>new Dp().enclosedCache,localstorage:()=>new Bg},Rd=t=>ry[t],Od=t=>{const{openUrl:e,onRedirect:r}=t,n=ct(t,["openUrl","onRedirect"]);return Object.assign(Object.assign({},n),{openUrl:e===!1||e?e:r})},Cd=(t,e)=>{const r=e?.split(" ")||[];return(t?.split(" ")||[]).every((n=>r.includes(n)))},xt={NONCE:"nonce",KEYPAIR:"keypair"};let ny=class{constructor(e){this.clientId=e}getVersion(){return 1}createDbHandle(){const e=window.indexedDB.open("auth0-spa-js",this.getVersion());return new Promise(((r,n)=>{e.onupgradeneeded=()=>Object.values(xt).forEach((a=>e.result.createObjectStore(a))),e.onerror=()=>n(e.error),e.onsuccess=()=>r(e.result)}))}async getDbHandle(){return this.dbHandle||(this.dbHandle=await this.createDbHandle()),this.dbHandle}async executeDbRequest(e,r,n){const a=n((await this.getDbHandle()).transaction(e,r).objectStore(e));return new Promise(((i,o)=>{a.onsuccess=()=>i(a.result),a.onerror=()=>o(a.error)}))}buildKey(e){const r=e?`_${e}`:"auth0";return`${this.clientId}::${r}`}setNonce(e,r){return this.save(xt.NONCE,this.buildKey(r),e)}setKeyPair(e){return this.save(xt.KEYPAIR,this.buildKey(),e)}async save(e,r,n){await this.executeDbRequest(e,"readwrite",(a=>a.put(n,r)))}findNonce(e){return this.find(xt.NONCE,this.buildKey(e))}findKeyPair(){return this.find(xt.KEYPAIR,this.buildKey())}find(e,r){return this.executeDbRequest(e,"readonly",(n=>n.get(r)))}async deleteBy(e,r){const n=await this.executeDbRequest(e,"readonly",(a=>a.getAllKeys()));n?.filter(r).map((a=>this.executeDbRequest(e,"readwrite",(i=>i.delete(a)))))}deleteByClientId(e,r){return this.deleteBy(e,(n=>typeof n=="string"&&n.startsWith(`${r}::`)))}clearNonces(){return this.deleteByClientId(xt.NONCE,this.clientId)}clearKeyPairs(){return this.deleteByClientId(xt.KEYPAIR,this.clientId)}},ay=class{constructor(e){this.storage=new ny(e)}getNonce(e){return this.storage.findNonce(e)}setNonce(e,r){return this.storage.setNonce(e,r)}async getOrGenerateKeyPair(){let e=await this.storage.findKeyPair();return e||(e=await xg(),await this.storage.setKeyPair(e)),e}async generateProof(e){const r=await this.getOrGenerateKeyPair();return Dg(Object.assign({keyPair:r},e))}async calculateThumbprint(){return jg(await this.getOrGenerateKeyPair())}async clear(){await Promise.all([this.storage.clearNonces(),this.storage.clearKeyPairs()])}};var vr;(function(t){t.Bearer="Bearer",t.DPoP="DPoP"})(vr||(vr={}));let iy=class{constructor(e,r){this.hooks=r,this.config=Object.assign(Object.assign({},e),{fetch:e.fetch||(typeof window>"u"?fetch:window.fetch.bind(window))})}isAbsoluteUrl(e){return/^(https?:)?\/\//i.test(e)}buildUrl(e,r){if(r){if(this.isAbsoluteUrl(r))return r;if(e)return`${e.replace(/\/?\/$/,"")}/${r.replace(/^\/+/,"")}`}throw new TypeError("`url` must be absolute or `baseUrl` non-empty.")}getAccessToken(e){return this.config.getAccessToken?this.config.getAccessToken(e):this.hooks.getAccessToken(e)}extractUrl(e){return typeof e=="string"?e:e instanceof URL?e.href:e.url}buildBaseRequest(e,r){if(!this.config.baseUrl)return new Request(e,r);const n=this.buildUrl(this.config.baseUrl,this.extractUrl(e)),a=e instanceof Request?new Request(n,e):n;return new Request(a,r)}setAuthorizationHeader(e,r,n=vr.Bearer){e.headers.set("authorization",`${n} ${r}`)}async setDpopProofHeader(e,r){if(!this.config.dpopNonceId)return;const n=await this.hooks.getDpopNonce(),a=await this.hooks.generateDpopProof({accessToken:r,method:e.method,nonce:n,url:e.url});e.headers.set("dpop",a)}async prepareRequest(e,r){const n=await this.getAccessToken(r);let a,i;typeof n=="string"?(a=this.config.dpopNonceId?vr.DPoP:vr.Bearer,i=n):(a=n.token_type,i=n.access_token),this.setAuthorizationHeader(e,i,a),a===vr.DPoP&&await this.setDpopProofHeader(e,i)}getHeader(e,r){return Array.isArray(e)?new Headers(e).get(r)||"":typeof e.get=="function"?e.get(r)||"":e[r]||""}hasUseDpopNonceError(e){if(e.status!==401)return!1;const r=this.getHeader(e.headers,"www-authenticate");return r.includes("invalid_dpop_nonce")||r.includes("use_dpop_nonce")}async handleResponse(e,r){const n=this.getHeader(e.headers,"dpop-nonce");if(n&&await this.hooks.setDpopNonce(n),!this.hasUseDpopNonceError(e))return e;if(!n||!r.onUseDpopNonceError)throw new Up(n);return r.onUseDpopNonceError()}async internalFetchWithAuth(e,r,n,a){const i=this.buildBaseRequest(e,r);await this.prepareRequest(i,a);const o=await this.config.fetch(i);return this.handleResponse(o,n)}fetchWithAuth(e,r,n){const a={onUseDpopNonceError:()=>this.internalFetchWithAuth(e,r,Object.assign(Object.assign({},a),{onUseDpopNonceError:void 0}),n)};return this.internalFetchWithAuth(e,r,a,n)}},oy=class{constructor(e,r){this.myAccountFetcher=e,this.apiBase=r}async connectAccount(e){const r=await this.myAccountFetcher.fetchWithAuth(`${this.apiBase}v1/connected-accounts/connect`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(r)}async completeAccount(e){const r=await this.myAccountFetcher.fetchWithAuth(`${this.apiBase}v1/connected-accounts/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(r)}async _handleResponse(e){let r;try{r=await e.text(),r=JSON.parse(r)}catch(n){throw new Ad({type:"invalid_json",status:e.status,title:"Invalid JSON response",detail:r||String(n)})}if(e.ok)return r;throw new Ad(r)}},Ad=class Kp extends Error{constructor({type:e,status:r,title:n,detail:a,validation_errors:i}){super(a),this.name="MyAccountApiError",this.type=e,this.status=r,this.title=n,this.detail=a,this.validation_errors=i,Object.setPrototypeOf(this,Kp.prototype)}};const xr=new bg;class sy{constructor(e){let r,n;if(this.userCache=new Dp().enclosedCache,this.activeLockKeys=new Set,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},this._releaseLockOnPageHide=async()=>{const u=Array.from(this.activeLockKeys);for(const l of u)await xr.releaseLock(l);this.activeLockKeys.clear(),window.removeEventListener("pagehide",this._releaseLockOnPageHide)},this.options=Object.assign(Object.assign(Object.assign({},this.defaultOptions),e),{authorizationParams:Object.assign(Object.assign({},this.defaultOptions.authorizationParams),e.authorizationParams)}),typeof window<"u"&&(()=>{if(!Un())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(Un().subtle===void 0)throw new Error(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var jc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Dc={},wa,Mc;function $e(){return Mc||(Mc=1,wa=function(t){try{return!!t()}catch{return!0}}),wa}var ba,Fc;function zn(){if(Fc)return ba;Fc=1;var t=$e();return ba=!t(function(){var e=(function(){}).bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),ba}var Sa,Bc;function ve(){if(Bc)return Sa;Bc=1;var t=zn(),e=Function.prototype,r=e.call,n=t&&e.bind.bind(r,r);return Sa=t?n:function(a){return function(){return r.apply(a,arguments)}},Sa}var Ia,Kc;function Hn(){if(Kc)return Ia;Kc=1;var t=ve(),e=t({}.toString),r=t("".slice);return Ia=function(n){return r(e(n),8,-1)},Ia}var Pa,zc;function Vh(){if(zc)return Pa;zc=1;var t=ve(),e=$e(),r=Hn(),n=Object,a=t("".split);return Pa=e(function(){return!n("z").propertyIsEnumerable(0)})?function(i){return r(i)==="String"?a(i,""):n(i)}:n,Pa}var Ea,Hc;function Wn(){return Hc||(Hc=1,Ea=function(t){return t==null}),Ea}var ka,Wc;function Gn(){if(Wc)return ka;Wc=1;var t=Wn(),e=TypeError;return ka=function(r){if(t(r))throw new e("Can't call method on "+r);return r},ka}var Ta,Gc;function rn(){if(Gc)return Ta;Gc=1;var t=Vh(),e=Gn();return Ta=function(r){return t(e(r))},Ta}var Ur,Vc;function me(){if(Vc)return Ur;Vc=1;var t=function(e){return e&&e.Math===Math&&e};return Ur=t(typeof globalThis=="object"&&globalThis)||t(typeof window=="object"&&window)||t(typeof self=="object"&&self)||t(typeof jc=="object"&&jc)||t(typeof Ur=="object"&&Ur)||(function(){return this})()||Function("return this")(),Ur}var _a={exports:{}},Ra,Jc;function lt(){return Jc||(Jc=1,Ra=!1),Ra}var Oa,Zc;function Gs(){if(Zc)return Oa;Zc=1;var t=me(),e=Object.defineProperty;return Oa=function(r,n){try{e(t,r,{value:n,configurable:!0,writable:!0})}catch{t[r]=n}return n},Oa}var Yc;function Vs(){if(Yc)return _a.exports;Yc=1;var t=lt(),e=me(),r=Gs(),n="__core-js_shared__",a=_a.exports=e[n]||r(n,{});return(a.versions||(a.versions=[])).push({version:"3.46.0",mode:t?"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"}),_a.exports}var Ca,Xc;function Jh(){if(Xc)return Ca;Xc=1;var t=Vs();return Ca=function(e,r){return t[e]||(t[e]=r||{})},Ca}var Aa,Qc;function Vn(){if(Qc)return Aa;Qc=1;var t=Gn(),e=Object;return Aa=function(r){return e(t(r))},Aa}var $a,eu;function Ze(){if(eu)return $a;eu=1;var t=ve(),e=Vn(),r=t({}.hasOwnProperty);return $a=Object.hasOwn||function(a,i){return r(e(a),i)},$a}var La,tu;function Zh(){if(tu)return La;tu=1;var t=ve(),e=0,r=Math.random(),n=t(1.1.toString);return La=function(a){return"Symbol("+(a===void 0?"":a)+")_"+n(++e+r,36)},La}var Ua,ru;function nn(){if(ru)return Ua;ru=1;var t=me(),e=t.navigator,r=e&&e.userAgent;return Ua=r?String(r):"",Ua}var xa,nu;function Yh(){if(nu)return xa;nu=1;var t=me(),e=nn(),r=t.process,n=t.Deno,a=r&&r.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&&e&&(o=e.match(/Edge\/(\d+)/),(!o||o[1]>=74)&&(o=e.match(/Chrome\/(\d+)/),o&&(s=+o[1]))),xa=s,xa}var qa,au;function Xh(){if(au)return qa;au=1;var t=Yh(),e=$e(),r=me(),n=r.String;return qa=!!Object.getOwnPropertySymbols&&!e(function(){var a=Symbol("symbol detection");return!n(a)||!(Object(a)instanceof Symbol)||!Symbol.sham&&t&&t<41}),qa}var Na,iu;function Qh(){if(iu)return Na;iu=1;var t=Xh();return Na=t&&!Symbol.sham&&typeof Symbol.iterator=="symbol",Na}var ja,ou;function Le(){if(ou)return ja;ou=1;var t=me(),e=Jh(),r=Ze(),n=Zh(),a=Xh(),i=Qh(),o=t.Symbol,s=e("wks"),u=i?o.for||o:o&&o.withoutSetter||n;return ja=function(l){return r(s,l)||(s[l]=a&&r(o,l)?o[l]:u("Symbol."+l)),s[l]},ja}var Da,su;function be(){if(su)return Da;su=1;var t=typeof document=="object"&&document.all;return Da=typeof t>"u"&&t!==void 0?function(e){return typeof e=="function"||e===t}:function(e){return typeof e=="function"},Da}var Ma,cu;function Ye(){if(cu)return Ma;cu=1;var t=be();return Ma=function(e){return typeof e=="object"?e!==null:t(e)},Ma}var Fa,uu;function at(){if(uu)return Fa;uu=1;var t=Ye(),e=String,r=TypeError;return Fa=function(n){if(t(n))return n;throw new r(e(n)+" is not an object")},Fa}var Ba={},Ka,lu;function Ue(){if(lu)return Ka;lu=1;var t=$e();return Ka=!t(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),Ka}var za,fu;function ep(){if(fu)return za;fu=1;var t=Ue(),e=$e();return za=t&&e(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),za}var Ha={},Wa,du;function Jn(){if(du)return Wa;du=1;var t=me(),e=Ye(),r=t.document,n=e(r)&&e(r.createElement);return Wa=function(a){return n?r.createElement(a):{}},Wa}var Ga,hu;function tp(){if(hu)return Ga;hu=1;var t=Ue(),e=$e(),r=Jn();return Ga=!t&&!e(function(){return Object.defineProperty(r("div"),"a",{get:function(){return 7}}).a!==7}),Ga}var Va,pu;function Ne(){if(pu)return Va;pu=1;var t=zn(),e=Function.prototype.call;return Va=t?e.bind(e):function(){return e.apply(e,arguments)},Va}var Ja,vu;function Xe(){if(vu)return Ja;vu=1;var t=me(),e=be(),r=function(n){return e(n)?n:void 0};return Ja=function(n,a){return arguments.length<2?r(t[n]):t[n]&&t[n][a]},Ja}var Za,mu;function Zn(){if(mu)return Za;mu=1;var t=ve();return Za=t({}.isPrototypeOf),Za}var Ya,gu;function rp(){if(gu)return Ya;gu=1;var t=Xe(),e=be(),r=Zn(),n=Qh(),a=Object;return Ya=n?function(i){return typeof i=="symbol"}:function(i){var o=t("Symbol");return e(o)&&r(o.prototype,a(i))},Ya}var Xa,yu;function Yn(){if(yu)return Xa;yu=1;var t=String;return Xa=function(e){try{return t(e)}catch{return"Object"}},Xa}var Qa,wu;function it(){if(wu)return Qa;wu=1;var t=be(),e=Yn(),r=TypeError;return Qa=function(n){if(t(n))return n;throw new r(e(n)+" is not a function")},Qa}var ei,bu;function Js(){if(bu)return ei;bu=1;var t=it(),e=Wn();return ei=function(r,n){var a=r[n];return e(a)?void 0:t(a)},ei}var ti,Su;function gm(){if(Su)return ti;Su=1;var t=Ne(),e=be(),r=Ye(),n=TypeError;return ti=function(a,i){var o,s;if(i==="string"&&e(o=a.toString)&&!r(s=t(o,a))||e(o=a.valueOf)&&!r(s=t(o,a))||i!=="string"&&e(o=a.toString)&&!r(s=t(o,a)))return s;throw new n("Can't convert object to primitive value")},ti}var ri,Iu;function ym(){if(Iu)return ri;Iu=1;var t=Ne(),e=Ye(),r=rp(),n=Js(),a=gm(),i=Le(),o=TypeError,s=i("toPrimitive");return ri=function(u,l){if(!e(u)||r(u))return u;var c=n(u,s),f;if(c){if(l===void 0&&(l="default"),f=t(c,u,l),!e(f)||r(f))return f;throw new o("Can't convert object to primitive value")}return l===void 0&&(l="number"),a(u,l)},ri}var ni,Pu;function np(){if(Pu)return ni;Pu=1;var t=ym(),e=rp();return ni=function(r){var n=t(r,"string");return e(n)?n:n+""},ni}var Eu;function bt(){if(Eu)return Ha;Eu=1;var t=Ue(),e=tp(),r=ep(),n=at(),a=np(),i=TypeError,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,u="enumerable",l="configurable",c="writable";return Ha.f=t?r?function(h,d,p){if(n(h),d=a(d),n(p),typeof h=="function"&&d==="prototype"&&"value"in p&&c in p&&!p[c]){var v=s(h,d);v&&v[c]&&(h[d]=p.value,p={configurable:l in p?p[l]:v[l],enumerable:u in p?p[u]:v[u],writable:!1})}return o(h,d,p)}:o:function(h,d,p){if(n(h),d=a(d),n(p),e)try{return o(h,d,p)}catch{}if("get"in p||"set"in p)throw new i("Accessors not supported");return"value"in p&&(h[d]=p.value),h},Ha}var ai,ku;function wm(){if(ku)return ai;ku=1;var t=Math.ceil,e=Math.floor;return ai=Math.trunc||function(n){var a=+n;return(a>0?e:t)(a)},ai}var ii,Tu;function Zs(){if(Tu)return ii;Tu=1;var t=wm();return ii=function(e){var r=+e;return r!==r||r===0?0:t(r)},ii}var oi,_u;function ap(){if(_u)return oi;_u=1;var t=Zs(),e=Math.max,r=Math.min;return oi=function(n,a){var i=t(n);return i<0?e(i+a,0):r(i,a)},oi}var si,Ru;function bm(){if(Ru)return si;Ru=1;var t=Zs(),e=Math.min;return si=function(r){var n=t(r);return n>0?e(n,9007199254740991):0},si}var ci,Ou;function Ys(){if(Ou)return ci;Ou=1;var t=bm();return ci=function(e){return t(e.length)},ci}var ui,Cu;function Sm(){if(Cu)return ui;Cu=1;var t=rn(),e=ap(),r=Ys(),n=function(a){return function(i,o,s){var u=t(i),l=r(u);if(l===0)return!a&&-1;var c=e(s,l),f;if(a&&o!==o){for(;l>c;)if(f=u[c++],f!==f)return!0}else for(;l>c;c++)if((a||c in u)&&u[c]===o)return a||c||0;return!a&&-1}};return ui={includes:n(!0),indexOf:n(!1)},ui}var li,Au;function Xs(){return Au||(Au=1,li={}),li}var fi,$u;function ip(){if($u)return fi;$u=1;var t=ve(),e=Ze(),r=rn(),n=Sm().indexOf,a=Xs(),i=t([].push);return fi=function(o,s){var u=r(o),l=0,c=[],f;for(f in u)!e(a,f)&&e(u,f)&&i(c,f);for(;s.length>l;)e(u,f=s[l++])&&(~n(c,f)||i(c,f));return c},fi}var di,Lu;function Qs(){return Lu||(Lu=1,di=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]),di}var hi,Uu;function op(){if(Uu)return hi;Uu=1;var t=ip(),e=Qs();return hi=Object.keys||function(n){return t(n,e)},hi}var xu;function Im(){if(xu)return Ba;xu=1;var t=Ue(),e=ep(),r=bt(),n=at(),a=rn(),i=op();return Ba.f=t&&!e?Object.defineProperties:function(s,u){n(s);for(var l=a(u),c=i(u),f=c.length,h=0,d;f>h;)r.f(s,d=c[h++],l[d]);return s},Ba}var pi,qu;function sp(){if(qu)return pi;qu=1;var t=Xe();return pi=t("document","documentElement"),pi}var vi,Nu;function ec(){if(Nu)return vi;Nu=1;var t=Jh(),e=Zh(),r=t("keys");return vi=function(n){return r[n]||(r[n]=e(n))},vi}var mi,ju;function an(){if(ju)return mi;ju=1;var t=at(),e=Im(),r=Qs(),n=Xs(),a=sp(),i=Jn(),o=ec(),s=">",u="<",l="prototype",c="script",f=o("IE_PROTO"),h=function(){},d=function(b){return u+c+s+b+u+"/"+c+s},p=function(b){b.write(d("")),b.close();var y=b.parentWindow.Object;return b=null,y},v=function(){var b=i("iframe"),y="java"+c+":",m;return b.style.display="none",a.appendChild(b),b.src=String(y),m=b.contentWindow.document,m.open(),m.write(d("document.F=Object")),m.close(),m.F},g,P=function(){try{g=new ActiveXObject("htmlfile")}catch{}P=typeof document<"u"?document.domain&&g?p(g):v():p(g);for(var b=r.length;b--;)delete P[l][r[b]];return P()};return n[f]=!0,mi=Object.create||function(y,m){var w;return y!==null?(h[l]=t(y),w=new h,h[l]=null,w[f]=y):w=P(),m===void 0?w:e.f(w,m)},mi}var gi,Du;function Pm(){if(Du)return gi;Du=1;var t=Le(),e=an(),r=bt().f,n=t("unscopables"),a=Array.prototype;return a[n]===void 0&&r(a,n,{configurable:!0,value:e(null)}),gi=function(i){a[n][i]=!0},gi}var yi,Mu;function on(){return Mu||(Mu=1,yi={}),yi}var wi,Fu;function Em(){if(Fu)return wi;Fu=1;var t=me(),e=be(),r=t.WeakMap;return wi=e(r)&&/native code/.test(String(r)),wi}var bi,Bu;function rr(){return Bu||(Bu=1,bi=function(t,e){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:e}}),bi}var Si,Ku;function nr(){if(Ku)return Si;Ku=1;var t=Ue(),e=bt(),r=rr();return Si=t?function(n,a,i){return e.f(n,a,r(1,i))}:function(n,a,i){return n[a]=i,n},Si}var Ii,zu;function kr(){if(zu)return Ii;zu=1;var t=Em(),e=me(),r=Ye(),n=nr(),a=Ze(),i=Vs(),o=ec(),s=Xs(),u="Object already initialized",l=e.TypeError,c=e.WeakMap,f,h,d,p=function(b){return d(b)?h(b):f(b,{})},v=function(b){return function(y){var m;if(!r(y)||(m=h(y)).type!==b)throw new l("Incompatible receiver, "+b+" required");return m}};if(t||i.state){var g=i.state||(i.state=new c);g.get=g.get,g.has=g.has,g.set=g.set,f=function(b,y){if(g.has(b))throw new l(u);return y.facade=b,g.set(b,y),y},h=function(b){return g.get(b)||{}},d=function(b){return g.has(b)}}else{var P=o("state");s[P]=!0,f=function(b,y){if(a(b,P))throw new l(u);return y.facade=b,n(b,P,y),y},h=function(b){return a(b,P)?b[P]:{}},d=function(b){return a(b,P)}}return Ii={set:f,get:h,has:d,enforce:p,getterFor:v},Ii}var Pi={},Ei={},Hu;function cp(){if(Hu)return Ei;Hu=1;var t={}.propertyIsEnumerable,e=Object.getOwnPropertyDescriptor,r=e&&!t.call({1:2},1);return Ei.f=r?function(a){var i=e(this,a);return!!i&&i.enumerable}:t,Ei}var Wu;function up(){if(Wu)return Pi;Wu=1;var t=Ue(),e=Ne(),r=cp(),n=rr(),a=rn(),i=np(),o=Ze(),s=tp(),u=Object.getOwnPropertyDescriptor;return Pi.f=t?u:function(c,f){if(c=a(c),f=i(f),s)try{return u(c,f)}catch{}if(o(c,f))return n(!e(r.f,c,f),c[f])},Pi}var ki={exports:{}},Ti,Gu;function lp(){if(Gu)return Ti;Gu=1;var t=Ue(),e=Ze(),r=Function.prototype,n=t&&Object.getOwnPropertyDescriptor,a=e(r,"name"),i=a&&(function(){}).name==="something",o=a&&(!t||t&&n(r,"name").configurable);return Ti={EXISTS:a,PROPER:i,CONFIGURABLE:o},Ti}var _i,Vu;function tc(){if(Vu)return _i;Vu=1;var t=ve(),e=be(),r=Vs(),n=t(Function.toString);return e(r.inspectSource)||(r.inspectSource=function(a){return n(a)}),_i=r.inspectSource,_i}var Ju;function fp(){if(Ju)return ki.exports;Ju=1;var t=ve(),e=$e(),r=be(),n=Ze(),a=Ue(),i=lp().CONFIGURABLE,o=tc(),s=kr(),u=s.enforce,l=s.get,c=String,f=Object.defineProperty,h=t("".slice),d=t("".replace),p=t([].join),v=a&&!e(function(){return f(function(){},"length",{value:8}).length!==8}),g=String(String).split("String"),P=ki.exports=function(b,y,m){h(c(y),0,7)==="Symbol("&&(y="["+d(c(y),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),m&&m.getter&&(y="get "+y),m&&m.setter&&(y="set "+y),(!n(b,"name")||i&&b.name!==y)&&(a?f(b,"name",{value:y,configurable:!0}):b.name=y),v&&m&&n(m,"arity")&&b.length!==m.arity&&f(b,"length",{value:m.arity});try{m&&n(m,"constructor")&&m.constructor?a&&f(b,"prototype",{writable:!1}):b.prototype&&(b.prototype=void 0)}catch{}var w=u(b);return n(w,"source")||(w.source=p(g,typeof y=="string"?y:"")),b};return Function.prototype.toString=P(function(){return r(this)&&l(this).source||o(this)},"toString"),ki.exports}var Ri,Zu;function Qe(){if(Zu)return Ri;Zu=1;var t=be(),e=bt(),r=fp(),n=Gs();return Ri=function(a,i,o,s){s||(s={});var u=s.enumerable,l=s.name!==void 0?s.name:i;if(t(o)&&r(o,l,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:e.f(a,i,{value:o,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return a},Ri}var Oi={},Yu;function km(){if(Yu)return Oi;Yu=1;var t=ip(),e=Qs(),r=e.concat("length","prototype");return Oi.f=Object.getOwnPropertyNames||function(a){return t(a,r)},Oi}var Ci={},Xu;function dp(){return Xu||(Xu=1,Ci.f=Object.getOwnPropertySymbols),Ci}var Ai,Qu;function Tm(){if(Qu)return Ai;Qu=1;var t=Xe(),e=ve(),r=km(),n=dp(),a=at(),i=e([].concat);return Ai=t("Reflect","ownKeys")||function(s){var u=r.f(a(s)),l=n.f;return l?i(u,l(s)):u},Ai}var $i,el;function hp(){if(el)return $i;el=1;var t=Ze(),e=Tm(),r=up(),n=bt();return $i=function(a,i,o){for(var s=e(i),u=n.f,l=r.f,c=0;c<s.length;c++){var f=s[c];!t(a,f)&&!(o&&t(o,f))&&u(a,f,l(i,f))}},$i}var Li,tl;function pp(){if(tl)return Li;tl=1;var t=$e(),e=be(),r=/#|\.prototype\./,n=function(u,l){var c=i[a(u)];return c===s?!0:c===o?!1:e(l)?t(l):!!l},a=n.normalize=function(u){return String(u).replace(r,".").toLowerCase()},i=n.data={},o=n.NATIVE="N",s=n.POLYFILL="P";return Li=n,Li}var Ui,rl;function Ee(){if(rl)return Ui;rl=1;var t=me(),e=up().f,r=nr(),n=Qe(),a=Gs(),i=hp(),o=pp();return Ui=function(s,u){var l=s.target,c=s.global,f=s.stat,h,d,p,v,g,P;if(c?d=t:f?d=t[l]||a(l,{}):d=t[l]&&t[l].prototype,d)for(p in u){if(g=u[p],s.dontCallGetSet?(P=e(d,p),v=P&&P.value):v=d[p],h=o(c?p:l+(f?".":"#")+p,s.forced),!h&&v!==void 0){if(typeof g==typeof v)continue;i(g,v)}(s.sham||v&&v.sham)&&r(g,"sham",!0),n(d,p,g,s)}},Ui}var xi,nl;function _m(){if(nl)return xi;nl=1;var t=$e();return xi=!t(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),xi}var qi,al;function rc(){if(al)return qi;al=1;var t=Ze(),e=be(),r=Vn(),n=ec(),a=_m(),i=n("IE_PROTO"),o=Object,s=o.prototype;return qi=a?o.getPrototypeOf:function(u){var l=r(u);if(t(l,i))return l[i];var c=l.constructor;return e(c)&&l instanceof c?c.prototype:l instanceof o?s:null},qi}var Ni,il;function vp(){if(il)return Ni;il=1;var t=$e(),e=be(),r=Ye(),n=an(),a=rc(),i=Qe(),o=Le(),s=lt(),u=o("iterator"),l=!1,c,f,h;[].keys&&(h=[].keys(),"next"in h?(f=a(a(h)),f!==Object.prototype&&(c=f)):l=!0);var d=!r(c)||t(function(){var p={};return c[u].call(p)!==p});return d?c={}:s&&(c=n(c)),e(c[u])||i(c,u,function(){return this}),Ni={IteratorPrototype:c,BUGGY_SAFARI_ITERATORS:l},Ni}var ji,ol;function Tr(){if(ol)return ji;ol=1;var t=bt().f,e=Ze(),r=Le(),n=r("toStringTag");return ji=function(a,i,o){a&&!o&&(a=a.prototype),a&&!e(a,n)&&t(a,n,{configurable:!0,value:i})},ji}var Di,sl;function mp(){if(sl)return Di;sl=1;var t=vp().IteratorPrototype,e=an(),r=rr(),n=Tr(),a=on(),i=function(){return this};return Di=function(o,s,u,l){var c=s+" Iterator";return o.prototype=e(t,{next:r(+!l,u)}),n(o,c,!1,!0),a[c]=i,o},Di}var Mi,cl;function Rm(){if(cl)return Mi;cl=1;var t=ve(),e=it();return Mi=function(r,n,a){try{return t(e(Object.getOwnPropertyDescriptor(r,n)[a]))}catch{}},Mi}var Fi,ul;function Om(){if(ul)return Fi;ul=1;var t=Ye();return Fi=function(e){return t(e)||e===null},Fi}var Bi,ll;function Cm(){if(ll)return Bi;ll=1;var t=Om(),e=String,r=TypeError;return Bi=function(n){if(t(n))return n;throw new r("Can't set "+e(n)+" as a prototype")},Bi}var Ki,fl;function nc(){if(fl)return Ki;fl=1;var t=Rm(),e=Ye(),r=Gn(),n=Cm();return Ki=Object.setPrototypeOf||("__proto__"in{}?(function(){var a=!1,i={},o;try{o=t(Object.prototype,"__proto__","set"),o(i,[]),a=i instanceof Array}catch{}return function(u,l){return r(u),n(l),e(u)&&(a?o(u,l):u.__proto__=l),u}})():void 0),Ki}var zi,dl;function gp(){if(dl)return zi;dl=1;var t=Ee(),e=Ne(),r=lt(),n=lp(),a=be(),i=mp(),o=rc(),s=nc(),u=Tr(),l=nr(),c=Qe(),f=Le(),h=on(),d=vp(),p=n.PROPER,v=n.CONFIGURABLE,g=d.IteratorPrototype,P=d.BUGGY_SAFARI_ITERATORS,b=f("iterator"),y="keys",m="values",w="entries",R=function(){return this};return zi=function(A,j,B,W,re,U,M){i(B,j,W);var q=function(Z){if(Z===re&&I)return I;if(!P&&Z&&Z in x)return x[Z];switch(Z){case y:return function(){return new B(this,Z)};case m:return function(){return new B(this,Z)};case w:return function(){return new B(this,Z)}}return function(){return new B(this)}},S=j+" Iterator",O=!1,x=A.prototype,F=x[b]||x["@@iterator"]||re&&x[re],I=!P&&F||q(re),T=j==="Array"&&x.entries||F,N,z,X;if(T&&(N=o(T.call(new A)),N!==Object.prototype&&N.next&&(!r&&o(N)!==g&&(s?s(N,g):a(N[b])||c(N,b,R)),u(N,S,!0,!0),r&&(h[S]=R))),p&&re===m&&F&&F.name!==m&&(!r&&v?l(x,"name",m):(O=!0,I=function(){return e(F,this)})),re)if(z={values:q(m),keys:U?I:q(y),entries:q(w)},M)for(X in z)(P||O||!(X in x))&&c(x,X,z[X]);else t({target:j,proto:!0,forced:P||O},z);return(!r||M)&&x[b]!==I&&c(x,b,I,{name:re}),h[j]=I,z},zi}var Hi,hl;function ac(){return hl||(hl=1,Hi=function(t,e){return{value:t,done:e}}),Hi}var Wi,pl;function ic(){if(pl)return Wi;pl=1;var t=rn(),e=Pm(),r=on(),n=kr(),a=bt().f,i=gp(),o=ac(),s=lt(),u=Ue(),l="Array Iterator",c=n.set,f=n.getterFor(l);Wi=i(Array,"Array",function(d,p){c(this,{type:l,target:t(d),index:0,kind:p})},function(){var d=f(this),p=d.target,v=d.index++;if(!p||v>=p.length)return d.target=null,o(void 0,!0);switch(d.kind){case"keys":return o(v,!1);case"values":return o(p[v],!1)}return o([v,p[v]],!1)},"values");var h=r.Arguments=r.Array;if(e("keys"),e("values"),e("entries"),!s&&u&&h.name!=="values")try{a(h,"name",{value:"values"})}catch{}return Wi}var vl={},ml;function Am(){if(ml)return vl;ml=1;var t=Ee(),e=ve(),r=ap(),n=RangeError,a=String.fromCharCode,i=String.fromCodePoint,o=e([].join),s=!!i&&i.length!==1;return t({target:"String",stat:!0,arity:1,forced:s},{fromCodePoint:function(l){for(var c=[],f=arguments.length,h=0,d;f>h;){if(d=+arguments[h++],r(d,1114111)!==d)throw new n(d+" is not a valid code point");c[h]=d<65536?a(d):a(((d-=65536)>>10)+55296,d%1024+56320)}return o(c,"")}}),vl}var Gi,gl;function yp(){if(gl)return Gi;gl=1;var t=me(),e=Ue(),r=Object.getOwnPropertyDescriptor;return Gi=function(n){if(!e)return t[n];var a=r(t,n);return a&&a.value},Gi}var Vi,yl;function Xn(){if(yl)return Vi;yl=1;var t=$e(),e=Le(),r=Ue(),n=lt(),a=e("iterator");return Vi=!t(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(l,c){o.delete("b"),u+=c+l}),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||!r)||!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"}),Vi}var Ji,wl;function Qn(){if(wl)return Ji;wl=1;var t=fp(),e=bt();return Ji=function(r,n,a){return a.get&&t(a.get,n,{getter:!0}),a.set&&t(a.set,n,{setter:!0}),e.f(r,n,a)},Ji}var Zi,bl;function $m(){if(bl)return Zi;bl=1;var t=Qe();return Zi=function(e,r,n){for(var a in r)t(e,a,r[a],n);return e},Zi}var Yi,Sl;function oc(){if(Sl)return Yi;Sl=1;var t=Zn(),e=TypeError;return Yi=function(r,n){if(t(n,r))return r;throw new e("Incorrect invocation")},Yi}var Xi,Il;function Lm(){if(Il)return Xi;Il=1;var t=Hn(),e=ve();return Xi=function(r){if(t(r)==="Function")return e(r)},Xi}var Qi,Pl;function _r(){if(Pl)return Qi;Pl=1;var t=Lm(),e=it(),r=zn(),n=t(t.bind);return Qi=function(a,i){return e(a),i===void 0?a:r?n(a,i):function(){return a.apply(i,arguments)}},Qi}var eo,El;function sc(){if(El)return eo;El=1;var t=Le(),e=t("toStringTag"),r={};return r[e]="z",eo=String(r)==="[object z]",eo}var to,kl;function sn(){if(kl)return to;kl=1;var t=sc(),e=be(),r=Hn(),n=Le(),a=n("toStringTag"),i=Object,o=r((function(){return arguments})())==="Arguments",s=function(u,l){try{return u[l]}catch{}};return to=t?r:function(u){var l,c,f;return u===void 0?"Undefined":u===null?"Null":typeof(c=s(l=i(u),a))=="string"?c:o?r(l):(f=r(l))==="Object"&&e(l.callee)?"Arguments":f},to}var ro,Tl;function St(){if(Tl)return ro;Tl=1;var t=sn(),e=String;return ro=function(r){if(t(r)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return e(r)},ro}var no,_l;function ea(){if(_l)return no;_l=1;var t=sn(),e=Js(),r=Wn(),n=on(),a=Le(),i=a("iterator");return no=function(o){if(!r(o))return e(o,i)||e(o,"@@iterator")||n[t(o)]},no}var ao,Rl;function cc(){if(Rl)return ao;Rl=1;var t=Ne(),e=it(),r=at(),n=Yn(),a=ea(),i=TypeError;return ao=function(o,s){var u=arguments.length<2?a(o):s;if(e(u))return r(t(u,o));throw new i(n(o)+" is not iterable")},ao}var io,Ol;function ar(){if(Ol)return io;Ol=1;var t=TypeError;return io=function(e,r){if(e<r)throw new t("Not enough arguments");return e},io}var oo,Cl;function ta(){if(Cl)return oo;Cl=1;var t=ve();return oo=t([].slice),oo}var so,Al;function Um(){if(Al)return so;Al=1;var t=ta(),e=Math.floor,r=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 l=e(i/2),c=r(t(n,0,l),a),f=r(t(n,l),a),h=c.length,d=f.length,p=0,v=0;p<h||v<d;)n[p+v]=p<h&&v<d?a(c[p],f[v])<=0?c[p++]:f[v++]:p<h?c[p++]:f[v++];return n};return so=r,so}var co,$l;function wp(){if($l)return co;$l=1,ic(),Am();var t=Ee(),e=me(),r=yp(),n=Xe(),a=Ne(),i=ve(),o=Ue(),s=Xn(),u=Qe(),l=Qn(),c=$m(),f=Tr(),h=mp(),d=kr(),p=oc(),v=be(),g=Ze(),P=_r(),b=sn(),y=at(),m=Ye(),w=St(),R=an(),A=rr(),j=cc(),B=ea(),W=ac(),re=ar(),U=Le(),M=Um(),q=U("iterator"),S="URLSearchParams",O=S+"Iterator",x=d.set,F=d.getterFor(S),I=d.getterFor(O),T=r("fetch"),N=r("Request"),z=r("Headers"),X=N&&N.prototype,Z=z&&z.prototype,fe=e.TypeError,ae=e.encodeURIComponent,ue=String.fromCharCode,ie=n("String","fromCodePoint"),_e=parseInt,je=i("".charAt),Me=i([].join),xe=i([].push),et=i("".replace),Pt=i([].shift),Et=i([].splice),$t=i("".split),Lt=i("".slice),$r=i(/./.exec),ir=/\+/g,Ut="�",ye=/^[0-9a-f]+$/i,tt=function(D,V){var J=Lt(D,V,V+2);return $r(ye,J)?_e(J,16):NaN},xt=function(D){for(var V=0,J=128;J>0&&(D&J)!==0;J>>=1)V++;return V},K=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},Q=function(D){D=et(D,ir," ");for(var V=D.length,J="",Y=0;Y<V;){var oe=je(D,Y);if(oe==="%"){if(je(D,Y+1)==="%"||Y+3>V){J+="%",Y++;continue}var ce=tt(D,Y+1);if(ce!==ce){J+=oe,Y++;continue}Y+=2;var he=xt(ce);if(he===0)oe=ue(ce);else{if(he===1||he>4){J+=Ut,Y++;continue}for(var pe=[ce],Se=1;Se<he&&(Y++,!(Y+3>V||je(D,Y)!=="%"));){var qe=tt(D,Y+1);if(qe!==qe){Y+=3;break}if(qe>191||qe<128)break;xe(pe,qe),Y+=2,Se++}if(pe.length!==he){J+=Ut;continue}var ot=K(pe);ot===null?J+=Ut:oe=ie(ot)}}J+=oe,Y++}return J},se=/[!'()~]|%20/g,le={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},de=function(D){return le[D]},He=function(D){return et(ae(D),se,de)},Re=h(function(V,J){x(this,{type:O,target:F(V).entries,index:0,kind:J})},S,function(){var V=I(this),J=V.target,Y=V.index++;if(!J||Y>=J.length)return V.target=null,W(void 0,!0);var oe=J[Y];switch(V.kind){case"keys":return W(oe.key,!1);case"values":return W(oe.value,!1)}return W([oe.key,oe.value],!1)},!0),Fe=function(D){this.entries=[],this.url=null,D!==void 0&&(m(D)?this.parseObject(D):this.parseQuery(typeof D=="string"?je(D,0)==="?"?Lt(D,1):D:w(D)))};Fe.prototype={type:S,bindURL:function(D){this.url=D,this.update()},parseObject:function(D){var V=this.entries,J=B(D),Y,oe,ce,he,pe,Se,qe;if(J)for(Y=j(D,J),oe=Y.next;!(ce=a(oe,Y)).done;){if(he=j(y(ce.value)),pe=he.next,(Se=a(pe,he)).done||(qe=a(pe,he)).done||!a(pe,he).done)throw new fe("Expected sequence with length 2");xe(V,{key:w(Se.value),value:w(qe.value)})}else for(var ot in D)g(D,ot)&&xe(V,{key:ot,value:w(D[ot])})},parseQuery:function(D){if(D)for(var V=this.entries,J=$t(D,"&"),Y=0,oe,ce;Y<J.length;)oe=J[Y++],oe.length&&(ce=$t(oe,"="),xe(V,{key:Q(Pt(ce)),value:Q(Me(ce,"="))}))},serialize:function(){for(var D=this.entries,V=[],J=0,Y;J<D.length;)Y=D[J++],xe(V,He(Y.key)+"="+He(Y.value));return Me(V,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var Oe=function(){p(this,Ge);var V=arguments.length>0?arguments[0]:void 0,J=x(this,new Fe(V));o||(this.size=J.entries.length)},Ge=Oe.prototype;if(c(Ge,{append:function(V,J){var Y=F(this);re(arguments.length,2),xe(Y.entries,{key:w(V),value:w(J)}),o||this.length++,Y.updateURL()},delete:function(D){for(var V=F(this),J=re(arguments.length,1),Y=V.entries,oe=w(D),ce=J<2?void 0:arguments[1],he=ce===void 0?ce:w(ce),pe=0;pe<Y.length;){var Se=Y[pe];if(Se.key===oe&&(he===void 0||Se.value===he)){if(Et(Y,pe,1),he!==void 0)break}else pe++}o||(this.size=Y.length),V.updateURL()},get:function(V){var J=F(this).entries;re(arguments.length,1);for(var Y=w(V),oe=0;oe<J.length;oe++)if(J[oe].key===Y)return J[oe].value;return null},getAll:function(V){var J=F(this).entries;re(arguments.length,1);for(var Y=w(V),oe=[],ce=0;ce<J.length;ce++)J[ce].key===Y&&xe(oe,J[ce].value);return oe},has:function(V){for(var J=F(this).entries,Y=re(arguments.length,1),oe=w(V),ce=Y<2?void 0:arguments[1],he=ce===void 0?ce:w(ce),pe=0;pe<J.length;){var Se=J[pe++];if(Se.key===oe&&(he===void 0||Se.value===he))return!0}return!1},set:function(V,J){var Y=F(this);re(arguments.length,1);for(var oe=Y.entries,ce=!1,he=w(V),pe=w(J),Se=0,qe;Se<oe.length;Se++)qe=oe[Se],qe.key===he&&(ce?Et(oe,Se--,1):(ce=!0,qe.value=pe));ce||xe(oe,{key:he,value:pe}),o||(this.size=oe.length),Y.updateURL()},sort:function(){var V=F(this);M(V.entries,function(J,Y){return J.key>Y.key?1:-1}),V.updateURL()},forEach:function(V){for(var J=F(this).entries,Y=P(V,arguments.length>1?arguments[1]:void 0),oe=0,ce;oe<J.length;)ce=J[oe++],Y(ce.value,ce.key,this)},keys:function(){return new Re(this,"keys")},values:function(){return new Re(this,"values")},entries:function(){return new Re(this,"entries")}},{enumerable:!0}),u(Ge,q,Ge.entries,{name:"entries"}),u(Ge,"toString",function(){return F(this).serialize()},{enumerable:!0}),o&&l(Ge,"size",{get:function(){return F(this).entries.length},configurable:!0,enumerable:!0}),f(Oe,S),t({global:!0,constructor:!0,forced:!s},{URLSearchParams:Oe}),!s&&v(z)){var or=i(Z.has),Lr=i(Z.set),sr=function(D){if(m(D)){var V=D.body,J;if(b(V)===S)return J=D.headers?new z(D.headers):new z,or(J,"content-type")||Lr(J,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),R(D,{body:A(0,w(V)),headers:A(0,J)})}return D};if(v(T)&&t({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(V){return T(V,arguments.length>1?sr(arguments[1]):{})}}),v(N)){var cr=function(V){return p(this,X),new N(V,arguments.length>1?sr(arguments[1]):{})};X.constructor=cr,cr.prototype=X,t({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:cr})}}return co={URLSearchParams:Oe,getState:F},co}var Ll;function xm(){return Ll||(Ll=1,wp()),Dc}var Ul={},xl;function qm(){if(xl)return Ul;xl=1;var t=Qe(),e=ve(),r=St(),n=ar(),a=URLSearchParams,i=a.prototype,o=e(i.append),s=e(i.delete),u=e(i.forEach),l=e([].push),c=new a("a=1&a=2&b=3");return c.delete("a",1),c.delete("b",void 0),c+""!="a=2"&&t(i,"delete",function(f){var h=arguments.length,d=h<2?void 0:arguments[1];if(h&&d===void 0)return s(this,f);var p=[];u(this,function(R,A){l(p,{key:A,value:R})}),n(h,1);for(var v=r(f),g=r(d),P=0,b=0,y=!1,m=p.length,w;P<m;)w=p[P++],y||w.key===v?(y=!0,s(this,w.key)):b++;for(;b<m;)w=p[b++],w.key===v&&w.value===g||o(this,w.key,w.value)},{enumerable:!0,unsafe:!0}),Ul}var ql={},Nl;function Nm(){if(Nl)return ql;Nl=1;var t=Qe(),e=ve(),r=St(),n=ar(),a=URLSearchParams,i=a.prototype,o=e(i.getAll),s=e(i.has),u=new a("a=1");return(u.has("a",2)||!u.has("a",void 0))&&t(i,"has",function(c){var f=arguments.length,h=f<2?void 0:arguments[1];if(f&&h===void 0)return s(this,c);var d=o(this,c);n(f,1);for(var p=r(h),v=0;v<d.length;)if(d[v++]===p)return!0;return!1},{enumerable:!0,unsafe:!0}),ql}var jl={},Dl;function jm(){if(Dl)return jl;Dl=1;var t=Ue(),e=ve(),r=Qn(),n=URLSearchParams.prototype,a=e(n.forEach);return t&&!("size"in n)&&r(n,"size",{get:function(){var o=0;return a(this,function(){o++}),o},configurable:!0,enumerable:!0}),jl}var uo,Ml;function ra(){if(Ml)return uo;Ml=1;var t=me();return uo=t,uo}var lo,Fl;function bp(){if(Fl)return lo;Fl=1,xm(),qm(),Nm(),jm();var t=ra();return lo=t.URLSearchParams,lo}var Bl={},Kl={},zl={},fo,Hl;function Sp(){if(Hl)return fo;Hl=1;var t=ve(),e=Zs(),r=St(),n=Gn(),a=t("".charAt),i=t("".charCodeAt),o=t("".slice),s=function(u){return function(l,c){var f=r(n(l)),h=e(c),d=f.length,p,v;return h<0||h>=d?u?"":void 0:(p=i(f,h),p<55296||p>56319||h+1===d||(v=i(f,h+1))<56320||v>57343?u?a(f,h):p:u?o(f,h,h+2):(p-55296<<10)+(v-56320)+65536)}};return fo={codeAt:s(!1),charAt:s(!0)},fo}var Wl;function Ip(){if(Wl)return zl;Wl=1;var t=Sp().charAt,e=St(),r=kr(),n=gp(),a=ac(),i="String Iterator",o=r.set,s=r.getterFor(i);return n(String,"String",function(u){o(this,{type:i,string:e(u),index:0})},function(){var l=s(this),c=l.string,f=l.index,h;return f>=c.length?a(void 0,!0):(h=t(c,f),l.index+=h.length,a(h,!1))}),zl}var ho,Gl;function Dm(){if(Gl)return ho;Gl=1;var t=Ue(),e=ve(),r=Ne(),n=$e(),a=op(),i=dp(),o=cp(),s=Vn(),u=Vh(),l=Object.assign,c=Object.defineProperty,f=e([].concat);return ho=!l||n(function(){if(t&&l({b:1},l(c({},"a",{enumerable:!0,get:function(){c(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var h={},d={},p=Symbol("assign detection"),v="abcdefghijklmnopqrst";return h[p]=7,v.split("").forEach(function(g){d[g]=g}),l({},h)[p]!==7||a(l({},d)).join("")!==v})?function(d,p){for(var v=s(d),g=arguments.length,P=1,b=i.f,y=o.f;g>P;)for(var m=u(arguments[P++]),w=b?f(a(m),b(m)):a(m),R=w.length,A=0,j;R>A;)j=w[A++],(!t||r(y,m,j))&&(v[j]=m[j]);return v}:l,ho}var po,Vl;function Pp(){if(Vl)return po;Vl=1;var t=Ne(),e=at(),r=Js();return po=function(n,a,i){var o,s;e(n);try{if(o=r(n,"return"),!o){if(a==="throw")throw i;return i}o=t(o,n)}catch(u){s=!0,o=u}if(a==="throw")throw i;if(s)throw o;return e(o),i},po}var vo,Jl;function Mm(){if(Jl)return vo;Jl=1;var t=at(),e=Pp();return vo=function(r,n,a,i){try{return i?n(t(a)[0],a[1]):n(a)}catch(o){e(r,"throw",o)}},vo}var mo,Zl;function Ep(){if(Zl)return mo;Zl=1;var t=Le(),e=on(),r=t("iterator"),n=Array.prototype;return mo=function(a){return a!==void 0&&(e.Array===a||n[r]===a)},mo}var go,Yl;function kp(){if(Yl)return go;Yl=1;var t=ve(),e=$e(),r=be(),n=sn(),a=Xe(),i=tc(),o=function(){},s=a("Reflect","construct"),u=/^\s*(?:class|function)\b/,l=t(u.exec),c=!u.test(o),f=function(p){if(!r(p))return!1;try{return s(o,[],p),!0}catch{return!1}},h=function(p){if(!r(p))return!1;switch(n(p)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return c||!!l(u,i(p))}catch{return!0}};return h.sham=!0,go=!s||e(function(){var d;return f(f.call)||!f(Object)||!f(function(){d=!0})||d})?h:f,go}var yo,Xl;function Fm(){if(Xl)return yo;Xl=1;var t=Ue(),e=bt(),r=rr();return yo=function(n,a,i){t?e.f(n,a,r(0,i)):n[a]=i},yo}var wo,Ql;function Bm(){if(Ql)return wo;Ql=1;var t=_r(),e=Ne(),r=Vn(),n=Mm(),a=Ep(),i=kp(),o=Ys(),s=Fm(),u=cc(),l=ea(),c=Array;return wo=function(h){var d=r(h),p=i(this),v=arguments.length,g=v>1?arguments[1]:void 0,P=g!==void 0;P&&(g=t(g,v>2?arguments[2]:void 0));var b=l(d),y=0,m,w,R,A,j,B;if(b&&!(this===c&&a(b)))for(w=p?new this:[],A=u(d,b),j=A.next;!(R=e(j,A)).done;y++)B=P?n(A,g,[R.value,y],!0):R.value,s(w,y,B);else for(m=o(d),w=p?new this(m):c(m);m>y;y++)B=P?g(d[y],y):d[y],s(w,y,B);return w.length=y,w},wo}var bo,ef;function Km(){if(ef)return bo;ef=1;var t=ve(),e=2147483647,r=36,n=1,a=26,i=38,o=700,s=72,u=128,l="-",c=/[^\0-\u007E]/,f=/[.\u3002\uFF0E\uFF61]/g,h="Overflow: input needs wider integers to process",d=r-n,p=RangeError,v=t(f.exec),g=Math.floor,P=String.fromCharCode,b=t("".charCodeAt),y=t([].join),m=t([].push),w=t("".replace),R=t("".split),A=t("".toLowerCase),j=function(U){for(var M=[],q=0,S=U.length;q<S;){var O=b(U,q++);if(O>=55296&&O<=56319&&q<S){var x=b(U,q++);(x&64512)===56320?m(M,((O&1023)<<10)+(x&1023)+65536):(m(M,O),q--)}else m(M,O)}return M},B=function(U){return U+22+75*(U<26)},W=function(U,M,q){var S=0;for(U=q?g(U/o):U>>1,U+=g(U/M);U>d*a>>1;)U=g(U/d),S+=r;return g(S+(d+1)*U/(U+i))},re=function(U){var M=[];U=j(U);var q=U.length,S=u,O=0,x=s,F,I;for(F=0;F<U.length;F++)I=U[F],I<128&&m(M,P(I));var T=M.length,N=T;for(T&&m(M,l);N<q;){var z=e;for(F=0;F<U.length;F++)I=U[F],I>=S&&I<z&&(z=I);var X=N+1;if(z-S>g((e-O)/X))throw new p(h);for(O+=(z-S)*X,S=z,F=0;F<U.length;F++){if(I=U[F],I<S&&++O>e)throw new p(h);if(I===S){for(var Z=O,fe=r;;){var ae=fe<=x?n:fe>=x+a?a:fe-x;if(Z<ae)break;var ue=Z-ae,ie=r-ae;m(M,P(B(ae+ue%ie))),Z=g(ue/ie),fe+=r}m(M,P(B(Z))),x=W(O,X,N===T),O=0,N++}}O++,S++}return y(M,"")};return bo=function(U){var M=[],q=R(w(A(U),f,"."),"."),S,O;for(S=0;S<q.length;S++)O=q[S],m(M,v(c,O)?"xn--"+re(O):O);return y(M,".")},bo}var tf;function zm(){if(tf)return Kl;tf=1,Ip();var t=Ee(),e=Ue(),r=Xn(),n=me(),a=_r(),i=ve(),o=Qe(),s=Qn(),u=oc(),l=Ze(),c=Dm(),f=Bm(),h=ta(),d=Sp().codeAt,p=Km(),v=St(),g=Tr(),P=ar(),b=wp(),y=kr(),m=y.set,w=y.getterFor("URL"),R=b.URLSearchParams,A=b.getState,j=n.URL,B=n.TypeError,W=n.parseInt,re=Math.floor,U=Math.pow,M=i("".charAt),q=i(/./.exec),S=i([].join),O=i(1.1.toString),x=i([].pop),F=i([].push),I=i("".replace),T=i([].shift),N=i("".split),z=i("".slice),X=i("".toLowerCase),Z=i([].unshift),fe="Invalid authority",ae="Invalid scheme",ue="Invalid host",ie="Invalid port",_e=/[a-z]/i,je=/[\d+-.a-z]/i,Me=/\d/,xe=/^0x/i,et=/^[0-7]+$/,Pt=/^\d+$/,Et=/^[\da-f]+$/i,$t=/[\0\t\n\r #%/:<>?@[\\\]^|]/,Lt=/[\0\t\n\r #/:<>?@[\\\]^|]/,$r=/^[\u0000-\u0020]+/,ir=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,Ut=/[\t\n\r]/g,ye,tt=function(k){var L=N(k,"."),_,E,C,ne,G,we,Ie;if(L.length&&L[L.length-1]===""&&L.length--,_=L.length,_>4)return k;for(E=[],C=0;C<_;C++){if(ne=L[C],ne==="")return k;if(G=10,ne.length>1&&M(ne,0)==="0"&&(G=q(xe,ne)?16:8,ne=z(ne,G===8?1:2)),ne==="")we=0;else{if(!q(G===10?Pt:G===8?et:Et,ne))return k;we=W(ne,G)}F(E,we)}for(C=0;C<_;C++)if(we=E[C],C===_-1){if(we>=U(256,5-_))return null}else if(we>255)return null;for(Ie=x(E),C=0;C<E.length;C++)Ie+=E[C]*U(256,3-C);return Ie},xt=function(k){var L=[0,0,0,0,0,0,0,0],_=0,E=null,C=0,ne,G,we,Ie,Ce,Je,$,ke=function(){return M(k,C)};if(ke()===":"){if(M(k,1)!==":")return;C+=2,_++,E=_}for(;ke();){if(_===8)return;if(ke()===":"){if(E!==null)return;C++,_++,E=_;continue}for(ne=G=0;G<4&&q(Et,ke());)ne=ne*16+W(ke(),16),C++,G++;if(ke()==="."){if(G===0||(C-=G,_>6))return;for(we=0;ke();){if(Ie=null,we>0)if(ke()==="."&&we<4)C++;else return;if(!q(Me,ke()))return;for(;q(Me,ke());){if(Ce=W(ke(),10),Ie===null)Ie=Ce;else{if(Ie===0)return;Ie=Ie*10+Ce}if(Ie>255)return;C++}L[_]=L[_]*256+Ie,we++,(we===2||we===4)&&_++}if(we!==4)return;break}else if(ke()===":"){if(C++,!ke())return}else if(ke())return;L[_++]=ne}if(E!==null)for(Je=_-E,_=7;_!==0&&Je>0;)$=L[_],L[_--]=L[E+Je-1],L[E+--Je]=$;else if(_!==8)return;return L},K=function(k){for(var L=null,_=1,E=null,C=0,ne=0;ne<8;ne++)k[ne]!==0?(C>_&&(L=E,_=C),E=null,C=0):(E===null&&(E=ne),++C);return C>_?E:L},Q=function(k){var L,_,E,C;if(typeof k=="number"){for(L=[],_=0;_<4;_++)Z(L,k%256),k=re(k/256);return S(L,".")}if(typeof k=="object"){for(L="",E=K(k),_=0;_<8;_++)C&&k[_]===0||(C&&(C=!1),E===_?(L+=_?":":"::",C=!0):(L+=O(k[_],16),_<7&&(L+=":")));return"["+L+"]"}return k},se={},le=c({},se,{" ":1,'"':1,"<":1,">":1,"`":1}),de=c({},le,{"#":1,"?":1,"{":1,"}":1}),He=c({},de,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Re=function(k,L){var _=d(k,0);return _>32&&_<127&&!l(L,k)?k:encodeURIComponent(k)},Fe={ftp:21,file:null,http:80,https:443,ws:80,wss:443},Oe=function(k,L){var _;return k.length===2&&q(_e,M(k,0))&&((_=M(k,1))===":"||!L&&_==="|")},Ge=function(k){var L;return k.length>1&&Oe(z(k,0,2))&&(k.length===2||(L=M(k,2))==="/"||L==="\\"||L==="?"||L==="#")},or=function(k){return k==="."||X(k)==="%2e"},Lr=function(k){return k=X(k),k===".."||k==="%2e."||k===".%2e"||k==="%2e%2e"},sr={},cr={},D={},V={},J={},Y={},oe={},ce={},he={},pe={},Se={},qe={},ot={},pa={},$c={},va={},ur={},st={},Lc={},qt={},ft={},ma=function(k,L,_){var E=v(k),C,ne,G;if(L){if(ne=this.parse(E),ne)throw new B(ne);this.searchParams=null}else{if(_!==void 0&&(C=new ma(_,!0)),ne=this.parse(E,null,C),ne)throw new B(ne);G=A(new R),G.bindURL(this),this.searchParams=G}};ma.prototype={type:"URL",parse:function(k,L,_){var E=this,C=L||sr,ne=0,G="",we=!1,Ie=!1,Ce=!1,Je,$,ke,dt;for(k=v(k),L||(E.scheme="",E.username="",E.password="",E.host=null,E.port=null,E.path=[],E.query=null,E.fragment=null,E.cannotBeABaseURL=!1,k=I(k,$r,""),k=I(k,ir,"$1")),k=I(k,Ut,""),Je=f(k);ne<=Je.length;){switch($=Je[ne],C){case sr:if($&&q(_e,$))G+=X($),C=cr;else{if(L)return ae;C=D;continue}break;case cr:if($&&(q(je,$)||$==="+"||$==="-"||$==="."))G+=X($);else if($===":"){if(L&&(E.isSpecial()!==l(Fe,G)||G==="file"&&(E.includesCredentials()||E.port!==null)||E.scheme==="file"&&!E.host))return;if(E.scheme=G,L){E.isSpecial()&&Fe[E.scheme]===E.port&&(E.port=null);return}G="",E.scheme==="file"?C=pa:E.isSpecial()&&_&&_.scheme===E.scheme?C=V:E.isSpecial()?C=ce:Je[ne+1]==="/"?(C=J,ne++):(E.cannotBeABaseURL=!0,F(E.path,""),C=Lc)}else{if(L)return ae;G="",C=D,ne=0;continue}break;case D:if(!_||_.cannotBeABaseURL&&$!=="#")return ae;if(_.cannotBeABaseURL&&$==="#"){E.scheme=_.scheme,E.path=h(_.path),E.query=_.query,E.fragment="",E.cannotBeABaseURL=!0,C=ft;break}C=_.scheme==="file"?pa:Y;continue;case V:if($==="/"&&Je[ne+1]==="/")C=he,ne++;else{C=Y;continue}break;case J:if($==="/"){C=pe;break}else{C=st;continue}case Y:if(E.scheme=_.scheme,$===ye)E.username=_.username,E.password=_.password,E.host=_.host,E.port=_.port,E.path=h(_.path),E.query=_.query;else if($==="/"||$==="\\"&&E.isSpecial())C=oe;else if($==="?")E.username=_.username,E.password=_.password,E.host=_.host,E.port=_.port,E.path=h(_.path),E.query="",C=qt;else if($==="#")E.username=_.username,E.password=_.password,E.host=_.host,E.port=_.port,E.path=h(_.path),E.query=_.query,E.fragment="",C=ft;else{E.username=_.username,E.password=_.password,E.host=_.host,E.port=_.port,E.path=h(_.path),E.path.length--,C=st;continue}break;case oe:if(E.isSpecial()&&($==="/"||$==="\\"))C=he;else if($==="/")C=pe;else{E.username=_.username,E.password=_.password,E.host=_.host,E.port=_.port,C=st;continue}break;case ce:if(C=he,$!=="/"||M(G,ne+1)!=="/")continue;ne++;break;case he:if($!=="/"&&$!=="\\"){C=pe;continue}break;case pe:if($==="@"){we&&(G="%40"+G),we=!0,ke=f(G);for(var ga=0;ga<ke.length;ga++){var qc=ke[ga];if(qc===":"&&!Ce){Ce=!0;continue}var Nc=Re(qc,He);Ce?E.password+=Nc:E.username+=Nc}G=""}else if($===ye||$==="/"||$==="?"||$==="#"||$==="\\"&&E.isSpecial()){if(we&&G==="")return fe;ne-=f(G).length+1,G="",C=Se}else G+=$;break;case Se:case qe:if(L&&E.scheme==="file"){C=va;continue}else if($===":"&&!Ie){if(G==="")return ue;if(dt=E.parseHost(G),dt)return dt;if(G="",C=ot,L===qe)return}else if($===ye||$==="/"||$==="?"||$==="#"||$==="\\"&&E.isSpecial()){if(E.isSpecial()&&G==="")return ue;if(L&&G===""&&(E.includesCredentials()||E.port!==null))return;if(dt=E.parseHost(G),dt)return dt;if(G="",C=ur,L)return;continue}else $==="["?Ie=!0:$==="]"&&(Ie=!1),G+=$;break;case ot:if(q(Me,$))G+=$;else if($===ye||$==="/"||$==="?"||$==="#"||$==="\\"&&E.isSpecial()||L){if(G!==""){var ya=W(G,10);if(ya>65535)return ie;E.port=E.isSpecial()&&ya===Fe[E.scheme]?null:ya,G=""}if(L)return;C=ur;continue}else return ie;break;case pa:if(E.scheme="file",$==="/"||$==="\\")C=$c;else if(_&&_.scheme==="file")switch($){case ye:E.host=_.host,E.path=h(_.path),E.query=_.query;break;case"?":E.host=_.host,E.path=h(_.path),E.query="",C=qt;break;case"#":E.host=_.host,E.path=h(_.path),E.query=_.query,E.fragment="",C=ft;break;default:Ge(S(h(Je,ne),""))||(E.host=_.host,E.path=h(_.path),E.shortenPath()),C=st;continue}else{C=st;continue}break;case $c:if($==="/"||$==="\\"){C=va;break}_&&_.scheme==="file"&&!Ge(S(h(Je,ne),""))&&(Oe(_.path[0],!0)?F(E.path,_.path[0]):E.host=_.host),C=st;continue;case va:if($===ye||$==="/"||$==="\\"||$==="?"||$==="#"){if(!L&&Oe(G))C=st;else if(G===""){if(E.host="",L)return;C=ur}else{if(dt=E.parseHost(G),dt)return dt;if(E.host==="localhost"&&(E.host=""),L)return;G="",C=ur}continue}else G+=$;break;case ur:if(E.isSpecial()){if(C=st,$!=="/"&&$!=="\\")continue}else if(!L&&$==="?")E.query="",C=qt;else if(!L&&$==="#")E.fragment="",C=ft;else if($!==ye&&(C=st,$!=="/"))continue;break;case st:if($===ye||$==="/"||$==="\\"&&E.isSpecial()||!L&&($==="?"||$==="#")){if(Lr(G)?(E.shortenPath(),$!=="/"&&!($==="\\"&&E.isSpecial())&&F(E.path,"")):or(G)?$!=="/"&&!($==="\\"&&E.isSpecial())&&F(E.path,""):(E.scheme==="file"&&!E.path.length&&Oe(G)&&(E.host&&(E.host=""),G=M(G,0)+":"),F(E.path,G)),G="",E.scheme==="file"&&($===ye||$==="?"||$==="#"))for(;E.path.length>1&&E.path[0]==="";)T(E.path);$==="?"?(E.query="",C=qt):$==="#"&&(E.fragment="",C=ft)}else G+=Re($,de);break;case Lc:$==="?"?(E.query="",C=qt):$==="#"?(E.fragment="",C=ft):$!==ye&&(E.path[0]+=Re($,se));break;case qt:!L&&$==="#"?(E.fragment="",C=ft):$!==ye&&($==="'"&&E.isSpecial()?E.query+="%27":$==="#"?E.query+="%23":E.query+=Re($,se));break;case ft:$!==ye&&(E.fragment+=Re($,le));break}ne++}},parseHost:function(k){var L,_,E;if(M(k,0)==="["){if(M(k,k.length-1)!=="]"||(L=xt(z(k,1,-1)),!L))return ue;this.host=L}else if(this.isSpecial()){if(k=p(k),q($t,k)||(L=tt(k),L===null))return ue;this.host=L}else{if(q(Lt,k))return ue;for(L="",_=f(k),E=0;E<_.length;E++)L+=Re(_[E],se);this.host=L}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme==="file"},includesCredentials:function(){return this.username!==""||this.password!==""},isSpecial:function(){return l(Fe,this.scheme)},shortenPath:function(){var k=this.path,L=k.length;L&&(this.scheme!=="file"||L!==1||!Oe(k[0],!0))&&k.length--},serialize:function(){var k=this,L=k.scheme,_=k.username,E=k.password,C=k.host,ne=k.port,G=k.path,we=k.query,Ie=k.fragment,Ce=L+":";return C!==null?(Ce+="//",k.includesCredentials()&&(Ce+=_+(E?":"+E:"")+"@"),Ce+=Q(C),ne!==null&&(Ce+=":"+ne)):L==="file"&&(Ce+="//"),Ce+=k.cannotBeABaseURL?G[0]:G.length?"/"+S(G,"/"):"",we!==null&&(Ce+="?"+we),Ie!==null&&(Ce+="#"+Ie),Ce},setHref:function(k){var L=this.parse(k);if(L)throw new B(L);this.searchParams.update()},getOrigin:function(){var k=this.scheme,L=this.port;if(k==="blob")try{return new lr(k.path[0]).origin}catch{return"null"}return k==="file"||!this.isSpecial()?"null":k+"://"+Q(this.host)+(L!==null?":"+L:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(k){this.parse(v(k)+":",sr)},getUsername:function(){return this.username},setUsername:function(k){var L=f(v(k));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var _=0;_<L.length;_++)this.username+=Re(L[_],He)}},getPassword:function(){return this.password},setPassword:function(k){var L=f(v(k));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var _=0;_<L.length;_++)this.password+=Re(L[_],He)}},getHost:function(){var k=this.host,L=this.port;return k===null?"":L===null?Q(k):Q(k)+":"+L},setHost:function(k){this.cannotBeABaseURL||this.parse(k,Se)},getHostname:function(){var k=this.host;return k===null?"":Q(k)},setHostname:function(k){this.cannotBeABaseURL||this.parse(k,qe)},getPort:function(){var k=this.port;return k===null?"":v(k)},setPort:function(k){this.cannotHaveUsernamePasswordPort()||(k=v(k),k===""?this.port=null:this.parse(k,ot))},getPathname:function(){var k=this.path;return this.cannotBeABaseURL?k[0]:k.length?"/"+S(k,"/"):""},setPathname:function(k){this.cannotBeABaseURL||(this.path=[],this.parse(k,ur))},getSearch:function(){var k=this.query;return k?"?"+k:""},setSearch:function(k){k=v(k),k===""?this.query=null:(M(k,0)==="?"&&(k=z(k,1)),this.query="",this.parse(k,qt)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var k=this.fragment;return k?"#"+k:""},setHash:function(k){if(k=v(k),k===""){this.fragment=null;return}M(k,0)==="#"&&(k=z(k,1)),this.fragment="",this.parse(k,ft)},update:function(){this.query=this.searchParams.serialize()||null}};var lr=function(L){var _=u(this,De),E=P(arguments.length,1)>1?arguments[1]:void 0,C=m(_,new ma(L,!1,E));e||(_.href=C.serialize(),_.origin=C.getOrigin(),_.protocol=C.getProtocol(),_.username=C.getUsername(),_.password=C.getPassword(),_.host=C.getHost(),_.hostname=C.getHostname(),_.port=C.getPort(),_.pathname=C.getPathname(),_.search=C.getSearch(),_.searchParams=C.getSearchParams(),_.hash=C.getHash())},De=lr.prototype,Ve=function(k,L){return{get:function(){return w(this)[k]()},set:L&&function(_){return w(this)[L](_)},configurable:!0,enumerable:!0}};if(e&&(s(De,"href",Ve("serialize","setHref")),s(De,"origin",Ve("getOrigin")),s(De,"protocol",Ve("getProtocol","setProtocol")),s(De,"username",Ve("getUsername","setUsername")),s(De,"password",Ve("getPassword","setPassword")),s(De,"host",Ve("getHost","setHost")),s(De,"hostname",Ve("getHostname","setHostname")),s(De,"port",Ve("getPort","setPort")),s(De,"pathname",Ve("getPathname","setPathname")),s(De,"search",Ve("getSearch","setSearch")),s(De,"searchParams",Ve("getSearchParams")),s(De,"hash",Ve("getHash","setHash"))),o(De,"toJSON",function(){return w(this).serialize()},{enumerable:!0}),o(De,"toString",function(){return w(this).serialize()},{enumerable:!0}),j){var Uc=j.createObjectURL,xc=j.revokeObjectURL;Uc&&o(lr,"createObjectURL",a(Uc,j)),xc&&o(lr,"revokeObjectURL",a(xc,j))}return g(lr,"URL"),t({global:!0,constructor:!0,forced:!r,sham:!e},{URL:lr}),Kl}var rf;function Hm(){return rf||(rf=1,zm()),Bl}var nf={},af;function Wm(){if(af)return nf;af=1;var t=Ee(),e=Xe(),r=$e(),n=ar(),a=St(),i=Xn(),o=e("URL"),s=i&&r(function(){o.canParse()}),u=r(function(){return o.canParse.length!==1});return t({target:"URL",stat:!0,forced:!s||u},{canParse:function(c){var f=n(arguments.length,1),h=a(c),d=f<2||arguments[1]===void 0?void 0:a(arguments[1]);try{return!!new o(h,d)}catch{return!1}}}),nf}var of={},sf;function Gm(){if(sf)return of;sf=1;var t=Ee(),e=Xe(),r=ar(),n=St(),a=Xn(),i=e("URL");return t({target:"URL",stat:!0,forced:!a},{parse:function(s){var u=r(arguments.length,1),l=n(s),c=u<2||arguments[1]===void 0?void 0:n(arguments[1]);try{return new i(l,c)}catch{return null}}}),of}var cf={},uf;function Vm(){if(uf)return cf;uf=1;var t=Ee(),e=Ne();return t({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return e(URL.prototype.toString,this)}}),cf}var So,lf;function Jm(){if(lf)return So;lf=1,bp(),Hm(),Wm(),Gm(),Vm();var t=ra();return So=t.URL,So}var Io,ff;function Zm(){if(ff)return Io;ff=1;var t=Jm();return Io=t,Io}var Po,df;function Ym(){if(df)return Po;df=1;var t=Zm();return Po=t,Po}Ym();var hf={},Eo,pf;function Xm(){return pf||(pf=1,Eo={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}),Eo}var ko,vf;function Qm(){if(vf)return ko;vf=1;var t=Jn(),e=t("span").classList,r=e&&e.constructor&&e.constructor.prototype;return ko=r===Object.prototype?void 0:r,ko}var mf;function Tp(){if(mf)return hf;mf=1;var t=me(),e=Xm(),r=Qm(),n=ic(),a=nr(),i=Tr(),o=Le(),s=o("iterator"),u=n.values,l=function(f,h){if(f){if(f[s]!==u)try{a(f,s,u)}catch{f[s]=u}if(i(f,h,!0),e[h]){for(var d in n)if(f[d]!==n[d])try{a(f,d,n[d])}catch{f[d]=n[d]}}}};for(var c in e)l(t[c]&&t[c].prototype,c);return l(r,"DOMTokenList"),hf}var To,gf;function eg(){if(gf)return To;gf=1;var t=bp();return Tp(),To=t,To}var _o,yf;function tg(){if(yf)return _o;yf=1;var t=eg();return _o=t,_o}tg();var wf={},bf={},Ro,Sf;function rg(){if(Sf)return Ro;Sf=1;var t=Ye(),e=nr();return Ro=function(r,n){t(n)&&"cause"in n&&e(r,"cause",n.cause)},Ro}var Oo,If;function ng(){if(If)return Oo;If=1;var t=ve(),e=Error,r=t("".replace),n=(function(o){return String(new e(o).stack)})("zxcasd"),a=/\n\s*at [^:]*:[^\n]*/,i=a.test(n);return Oo=function(o,s){if(i&&typeof o=="string"&&!e.prepareStackTrace)for(;s--;)o=r(o,a,"");return o},Oo}var Co,Pf;function ag(){if(Pf)return Co;Pf=1;var t=$e(),e=rr();return Co=!t(function(){var r=new Error("a");return"stack"in r?(Object.defineProperty(r,"stack",e(1,7)),r.stack!==7):!0}),Co}var Ao,Ef;function ig(){if(Ef)return Ao;Ef=1;var t=nr(),e=ng(),r=ag(),n=Error.captureStackTrace;return Ao=function(a,i,o,s){r&&(n?n(a,i):t(a,"stack",e(o,s)))},Ao}var $o,kf;function cn(){if(kf)return $o;kf=1;var t=_r(),e=Ne(),r=at(),n=Yn(),a=Ep(),i=Ys(),o=Zn(),s=cc(),u=ea(),l=Pp(),c=TypeError,f=function(d,p){this.stopped=d,this.result=p},h=f.prototype;return $o=function(d,p,v){var g=v&&v.that,P=!!(v&&v.AS_ENTRIES),b=!!(v&&v.IS_RECORD),y=!!(v&&v.IS_ITERATOR),m=!!(v&&v.INTERRUPTED),w=t(p,g),R,A,j,B,W,re,U,M=function(S){return R&&l(R,"normal"),new f(!0,S)},q=function(S){return P?(r(S),m?w(S[0],S[1],M):w(S[0],S[1])):m?w(S,M):w(S)};if(b)R=d.iterator;else if(y)R=d;else{if(A=u(d),!A)throw new c(n(d)+" is not iterable");if(a(A)){for(j=0,B=i(d);B>j;j++)if(W=q(d[j]),W&&o(h,W))return W;return new f(!1)}R=s(d,A)}for(re=b?d.next:R.next;!(U=e(re,R)).done;){try{W=q(U.value)}catch(S){l(R,"throw",S)}if(typeof W=="object"&&W&&o(h,W))return W}return new f(!1)},$o}var Lo,Tf;function og(){if(Tf)return Lo;Tf=1;var t=St();return Lo=function(e,r){return e===void 0?arguments.length<2?"":r:t(e)},Lo}var _f;function sg(){if(_f)return bf;_f=1;var t=Ee(),e=Zn(),r=rc(),n=nc(),a=hp(),i=an(),o=nr(),s=rr(),u=rg(),l=ig(),c=cn(),f=og(),h=Le(),d=h("toStringTag"),p=Error,v=[].push,g=function(y,m){var w=e(P,this),R;n?R=n(new p,w?r(this):P):(R=w?this:i(P),o(R,d,"Error")),m!==void 0&&o(R,"message",f(m)),l(R,g,R.stack,1),arguments.length>2&&u(R,arguments[2]);var A=[];return c(y,v,{that:A}),o(R,"errors",A),R};n?n(g,p):a(g,p,{name:!0});var P=g.prototype=i(p.prototype,{constructor:s(1,g),message:s(1,""),name:s(1,"AggregateError")});return t({global:!0,constructor:!0,arity:2},{AggregateError:g}),bf}var Rf;function cg(){return Rf||(Rf=1,sg()),wf}var Of={},Uo,Cf;function ug(){if(Cf)return Uo;Cf=1;var t=sc(),e=sn();return Uo=t?{}.toString:function(){return"[object "+e(this)+"]"},Uo}var Af;function lg(){if(Af)return Of;Af=1;var t=sc(),e=Qe(),r=ug();return t||e(Object.prototype,"toString",r,{unsafe:!0}),Of}var $f={},Lf={},xo,Uf;function _p(){if(Uf)return xo;Uf=1;var t=me(),e=nn(),r=Hn(),n=function(a){return e.slice(0,a.length)===a};return xo=(function(){return n("Bun/")?"BUN":n("Cloudflare-Workers")?"CLOUDFLARE":n("Deno/")?"DENO":n("Node.js/")?"NODE":t.Bun&&typeof Bun.version=="string"?"BUN":t.Deno&&typeof Deno.version=="object"?"DENO":r(t.process)==="process"?"NODE":t.window&&t.document?"BROWSER":"REST"})(),xo}var qo,xf;function uc(){if(xf)return qo;xf=1;var t=_p();return qo=t==="NODE",qo}var No,qf;function fg(){if(qf)return No;qf=1;var t=Xe(),e=Qn(),r=Le(),n=Ue(),a=r("species");return No=function(i){var o=t(i);n&&o&&!o[a]&&e(o,a,{configurable:!0,get:function(){return this}})},No}var jo,Nf;function dg(){if(Nf)return jo;Nf=1;var t=kp(),e=Yn(),r=TypeError;return jo=function(n){if(t(n))return n;throw new r(e(n)+" is not a constructor")},jo}var Do,jf;function Rp(){if(jf)return Do;jf=1;var t=at(),e=dg(),r=Wn(),n=Le(),a=n("species");return Do=function(i,o){var s=t(i).constructor,u;return s===void 0||r(u=t(s)[a])?o:e(u)},Do}var Mo,Df;function Op(){if(Df)return Mo;Df=1;var t=zn(),e=Function.prototype,r=e.apply,n=e.call;return Mo=typeof Reflect=="object"&&Reflect.apply||(t?n.bind(r):function(){return n.apply(r,arguments)}),Mo}var Fo,Mf;function Cp(){if(Mf)return Fo;Mf=1;var t=nn();return Fo=/(?:ipad|iphone|ipod).*applewebkit/i.test(t),Fo}var Bo,Ff;function Ap(){if(Ff)return Bo;Ff=1;var t=me(),e=Op(),r=_r(),n=be(),a=Ze(),i=$e(),o=sp(),s=ta(),u=Jn(),l=ar(),c=Cp(),f=uc(),h=t.setImmediate,d=t.clearImmediate,p=t.process,v=t.Dispatch,g=t.Function,P=t.MessageChannel,b=t.String,y=0,m={},w="onreadystatechange",R,A,j,B;i(function(){R=t.location});var W=function(q){if(a(m,q)){var S=m[q];delete m[q],S()}},re=function(q){return function(){W(q)}},U=function(q){W(q.data)},M=function(q){t.postMessage(b(q),R.protocol+"//"+R.host)};return(!h||!d)&&(h=function(S){l(arguments.length,1);var O=n(S)?S:g(S),x=s(arguments,1);return m[++y]=function(){e(O,void 0,x)},A(y),y},d=function(S){delete m[S]},f?A=function(q){p.nextTick(re(q))}:v&&v.now?A=function(q){v.now(re(q))}:P&&!c?(j=new P,B=j.port2,j.port1.onmessage=U,A=r(B.postMessage,B)):t.addEventListener&&n(t.postMessage)&&!t.importScripts&&R&&R.protocol!=="file:"&&!i(M)?(A=M,t.addEventListener("message",U,!1)):w in u("script")?A=function(q){o.appendChild(u("script"))[w]=function(){o.removeChild(this),W(q)}}:A=function(q){setTimeout(re(q),0)}),Bo={set:h,clear:d},Bo}var Ko,Bf;function $p(){if(Bf)return Ko;Bf=1;var t=function(){this.head=null,this.tail=null};return t.prototype={add:function(e){var r={item:e,next:null},n=this.tail;n?n.next=r:this.head=r,this.tail=r},get:function(){var e=this.head;if(e){var r=this.head=e.next;return r===null&&(this.tail=null),e.item}}},Ko=t,Ko}var zo,Kf;function hg(){if(Kf)return zo;Kf=1;var t=nn();return zo=/ipad|iphone|ipod/i.test(t)&&typeof Pebble<"u",zo}var Ho,zf;function pg(){if(zf)return Ho;zf=1;var t=nn();return Ho=/web0s(?!.*chrome)/i.test(t),Ho}var Wo,Hf;function vg(){if(Hf)return Wo;Hf=1;var t=me(),e=yp(),r=_r(),n=Ap().set,a=$p(),i=Cp(),o=hg(),s=pg(),u=uc(),l=t.MutationObserver||t.WebKitMutationObserver,c=t.document,f=t.process,h=t.Promise,d=e("queueMicrotask"),p,v,g,P,b;if(!d){var y=new a,m=function(){var w,R;for(u&&(w=f.domain)&&w.exit();R=y.get();)try{R()}catch(A){throw y.head&&p(),A}w&&w.enter()};!i&&!u&&!s&&l&&c?(v=!0,g=c.createTextNode(""),new l(m).observe(g,{characterData:!0}),p=function(){g.data=v=!v}):!o&&h&&h.resolve?(P=h.resolve(void 0),P.constructor=h,b=r(P.then,P),p=function(){b(m)}):u?p=function(){f.nextTick(m)}:(n=r(n,t),p=function(){n(m)}),d=function(w){y.head||p(),y.add(w)}}return Wo=d,Wo}var Go,Wf;function mg(){return Wf||(Wf=1,Go=function(t,e){try{arguments.length===1?console.error(t):console.error(t,e)}catch{}}),Go}var Vo,Gf;function Rr(){return Gf||(Gf=1,Vo=function(t){try{return{error:!1,value:t()}}catch(e){return{error:!0,value:e}}}),Vo}var Jo,Vf;function Or(){if(Vf)return Jo;Vf=1;var t=me();return Jo=t.Promise,Jo}var Zo,Jf;function un(){if(Jf)return Zo;Jf=1;var t=me(),e=Or(),r=be(),n=pp(),a=tc(),i=Le(),o=_p(),s=lt(),u=Yh(),l=e&&e.prototype,c=i("species"),f=!1,h=r(t.PromiseRejectionEvent),d=n("Promise",function(){var p=a(e),v=p!==String(e);if(!v&&u===66||s&&!(l.catch&&l.finally))return!0;if(!u||u<51||!/native code/.test(p)){var g=new e(function(y){y(1)}),P=function(y){y(function(){},function(){})},b=g.constructor={};if(b[c]=P,f=g.then(function(){})instanceof P,!f)return!0}return!v&&(o==="BROWSER"||o==="DENO")&&!h});return Zo={CONSTRUCTOR:d,REJECTION_EVENT:h,SUBCLASSING:f},Zo}var Yo={},Zf;function It(){if(Zf)return Yo;Zf=1;var t=it(),e=TypeError,r=function(n){var a,i;this.promise=new n(function(o,s){if(a!==void 0||i!==void 0)throw new e("Bad Promise constructor");a=o,i=s}),this.resolve=t(a),this.reject=t(i)};return Yo.f=function(n){return new r(n)},Yo}var Yf;function gg(){if(Yf)return Lf;Yf=1;var t=Ee(),e=lt(),r=uc(),n=me(),a=ra(),i=Ne(),o=Qe(),s=nc(),u=Tr(),l=fg(),c=it(),f=be(),h=Ye(),d=oc(),p=Rp(),v=Ap().set,g=vg(),P=mg(),b=Rr(),y=$p(),m=kr(),w=Or(),R=un(),A=It(),j="Promise",B=R.CONSTRUCTOR,W=R.REJECTION_EVENT,re=R.SUBCLASSING,U=m.getterFor(j),M=m.set,q=w&&w.prototype,S=w,O=q,x=n.TypeError,F=n.document,I=n.process,T=A.f,N=T,z=!!(F&&F.createEvent&&n.dispatchEvent),X="unhandledrejection",Z="rejectionhandled",fe=0,ae=1,ue=2,ie=1,_e=2,je,Me,xe,et,Pt=function(K){var Q;return h(K)&&f(Q=K.then)?Q:!1},Et=function(K,Q){var se=Q.value,le=Q.state===ae,de=le?K.ok:K.fail,He=K.resolve,Re=K.reject,Fe=K.domain,Oe,Ge,or;try{de?(le||(Q.rejection===_e&&Ut(Q),Q.rejection=ie),de===!0?Oe=se:(Fe&&Fe.enter(),Oe=de(se),Fe&&(Fe.exit(),or=!0)),Oe===K.promise?Re(new x("Promise-chain cycle")):(Ge=Pt(Oe))?i(Ge,Oe,He,Re):He(Oe)):Re(se)}catch(Lr){Fe&&!or&&Fe.exit(),Re(Lr)}},$t=function(K,Q){K.notified||(K.notified=!0,g(function(){for(var se=K.reactions,le;le=se.get();)Et(le,K);K.notified=!1,Q&&!K.rejection&&$r(K)}))},Lt=function(K,Q,se){var le,de;z?(le=F.createEvent("Event"),le.promise=Q,le.reason=se,le.initEvent(K,!1,!0),n.dispatchEvent(le)):le={promise:Q,reason:se},!W&&(de=n["on"+K])?de(le):K===X&&P("Unhandled promise rejection",se)},$r=function(K){i(v,n,function(){var Q=K.facade,se=K.value,le=ir(K),de;if(le&&(de=b(function(){r?I.emit("unhandledRejection",se,Q):Lt(X,Q,se)}),K.rejection=r||ir(K)?_e:ie,de.error))throw de.value})},ir=function(K){return K.rejection!==ie&&!K.parent},Ut=function(K){i(v,n,function(){var Q=K.facade;r?I.emit("rejectionHandled",Q):Lt(Z,Q,K.value)})},ye=function(K,Q,se){return function(le){K(Q,le,se)}},tt=function(K,Q,se){K.done||(K.done=!0,se&&(K=se),K.value=Q,K.state=ue,$t(K,!0))},xt=function(K,Q,se){if(!K.done){K.done=!0,se&&(K=se);try{if(K.facade===Q)throw new x("Promise can't be resolved itself");var le=Pt(Q);le?g(function(){var de={done:!1};try{i(le,Q,ye(xt,de,K),ye(tt,de,K))}catch(He){tt(de,He,K)}}):(K.value=Q,K.state=ae,$t(K,!1))}catch(de){tt({done:!1},de,K)}}};if(B&&(S=function(Q){d(this,O),c(Q),i(je,this);var se=U(this);try{Q(ye(xt,se),ye(tt,se))}catch(le){tt(se,le)}},O=S.prototype,je=function(Q){M(this,{type:j,done:!1,notified:!1,parent:!1,reactions:new y,rejection:!1,state:fe,value:null})},je.prototype=o(O,"then",function(Q,se){var le=U(this),de=T(p(this,S));return le.parent=!0,de.ok=f(Q)?Q:!0,de.fail=f(se)&&se,de.domain=r?I.domain:void 0,le.state===fe?le.reactions.add(de):g(function(){Et(de,le)}),de.promise}),Me=function(){var K=new je,Q=U(K);this.promise=K,this.resolve=ye(xt,Q),this.reject=ye(tt,Q)},A.f=T=function(K){return K===S||K===xe?new Me(K):N(K)},!e&&f(w)&&q!==Object.prototype)){et=q.then,re||o(q,"then",function(Q,se){var le=this;return new S(function(de,He){i(et,le,de,He)}).then(Q,se)},{unsafe:!0});try{delete q.constructor}catch{}s&&s(q,O)}return t({global:!0,constructor:!0,wrap:!0,forced:B},{Promise:S}),xe=a.Promise,u(S,j,!1,!0),l(j),Lf}var Xf={},Xo,Qf;function yg(){if(Qf)return Xo;Qf=1;var t=Le(),e=t("iterator"),r=!1;try{var n=0,a={next:function(){return{done:!!n++}},return:function(){r=!0}};a[e]=function(){return this},Array.from(a,function(){throw 2})}catch{}return Xo=function(i,o){try{if(!o&&!r)return!1}catch{return!1}var s=!1;try{var u={};u[e]=function(){return{next:function(){return{done:s=!0}}}},i(u)}catch{}return s},Xo}var Qo,ed;function na(){if(ed)return Qo;ed=1;var t=Or(),e=yg(),r=un().CONSTRUCTOR;return Qo=r||!e(function(n){t.all(n).then(void 0,function(){})}),Qo}var td;function wg(){if(td)return Xf;td=1;var t=Ee(),e=Ne(),r=it(),n=It(),a=Rr(),i=cn(),o=na();return t({target:"Promise",stat:!0,forced:o},{all:function(u){var l=this,c=n.f(l),f=c.resolve,h=c.reject,d=a(function(){var p=r(l.resolve),v=[],g=0,P=1;i(u,function(b){var y=g++,m=!1;P++,e(p,l,b).then(function(w){m||(m=!0,v[y]=w,--P||f(v))},h)}),--P||f(v)});return d.error&&h(d.value),c.promise}}),Xf}var rd={},nd;function bg(){if(nd)return rd;nd=1;var t=Ee(),e=lt(),r=un().CONSTRUCTOR,n=Or(),a=Xe(),i=be(),o=Qe(),s=n&&n.prototype;if(t({target:"Promise",proto:!0,forced:r,real:!0},{catch:function(l){return this.then(void 0,l)}}),!e&&i(n)){var u=a("Promise").prototype.catch;s.catch!==u&&o(s,"catch",u,{unsafe:!0})}return rd}var ad={},id;function Sg(){if(id)return ad;id=1;var t=Ee(),e=Ne(),r=it(),n=It(),a=Rr(),i=cn(),o=na();return t({target:"Promise",stat:!0,forced:o},{race:function(u){var l=this,c=n.f(l),f=c.reject,h=a(function(){var d=r(l.resolve);i(u,function(p){e(d,l,p).then(c.resolve,f)})});return h.error&&f(h.value),c.promise}}),ad}var od={},sd;function Ig(){if(sd)return od;sd=1;var t=Ee(),e=It(),r=un().CONSTRUCTOR;return t({target:"Promise",stat:!0,forced:r},{reject:function(a){var i=e.f(this),o=i.reject;return o(a),i.promise}}),od}var cd={},es,ud;function Lp(){if(ud)return es;ud=1;var t=at(),e=Ye(),r=It();return es=function(n,a){if(t(n),e(a)&&a.constructor===n)return a;var i=r.f(n),o=i.resolve;return o(a),i.promise},es}var ld;function Pg(){if(ld)return cd;ld=1;var t=Ee(),e=Xe(),r=lt(),n=Or(),a=un().CONSTRUCTOR,i=Lp(),o=e("Promise"),s=r&&!a;return t({target:"Promise",stat:!0,forced:r||a},{resolve:function(l){return i(s&&this===o?n:this,l)}}),cd}var fd;function Eg(){return fd||(fd=1,gg(),wg(),bg(),Sg(),Ig(),Pg()),$f}var dd={},hd;function kg(){if(hd)return dd;hd=1;var t=Ee(),e=Ne(),r=it(),n=It(),a=Rr(),i=cn(),o=na();return t({target:"Promise",stat:!0,forced:o},{allSettled:function(u){var l=this,c=n.f(l),f=c.resolve,h=c.reject,d=a(function(){var p=r(l.resolve),v=[],g=0,P=1;i(u,function(b){var y=g++,m=!1;P++,e(p,l,b).then(function(w){m||(m=!0,v[y]={status:"fulfilled",value:w},--P||f(v))},function(w){m||(m=!0,v[y]={status:"rejected",reason:w},--P||f(v))})}),--P||f(v)});return d.error&&h(d.value),c.promise}}),dd}var pd={},vd;function Tg(){if(vd)return pd;vd=1;var t=Ee(),e=Ne(),r=it(),n=Xe(),a=It(),i=Rr(),o=cn(),s=na(),u="No one promise resolved";return t({target:"Promise",stat:!0,forced:s},{any:function(c){var f=this,h=n("AggregateError"),d=a.f(f),p=d.resolve,v=d.reject,g=i(function(){var P=r(f.resolve),b=[],y=0,m=1,w=!1;o(c,function(R){var A=y++,j=!1;m++,e(P,f,R).then(function(B){j||w||(w=!0,p(B))},function(B){j||w||(j=!0,b[A]=B,--m||v(new h(b,u)))})}),--m||v(new h(b,u))});return g.error&&v(g.value),d.promise}}),pd}var md={},gd;function Up(){if(gd)return md;gd=1;var t=Ee(),e=me(),r=Op(),n=ta(),a=It(),i=it(),o=Rr(),s=e.Promise,u=!1,l=!s||!s.try||o(function(){s.try(function(c){u=c===8},8)}).error||!u;return t({target:"Promise",stat:!0,forced:l},{try:function(c){var f=arguments.length>1?n(arguments,1):[],h=a.f(this),d=o(function(){return r(i(c),void 0,f)});return(d.error?h.reject:h.resolve)(d.value),h.promise}}),md}var yd={},wd;function xp(){if(wd)return yd;wd=1;var t=Ee(),e=It();return t({target:"Promise",stat:!0},{withResolvers:function(){var n=e.f(this);return{promise:n.promise,resolve:n.resolve,reject:n.reject}}}),yd}var bd={},Sd;function _g(){if(Sd)return bd;Sd=1;var t=Ee(),e=lt(),r=Or(),n=$e(),a=Xe(),i=be(),o=Rp(),s=Lp(),u=Qe(),l=r&&r.prototype,c=!!r&&n(function(){l.finally.call({then:function(){}},function(){})});if(t({target:"Promise",proto:!0,real:!0,forced:c},{finally:function(h){var d=o(this,a("Promise")),p=i(h);return this.then(p?function(v){return s(d,h()).then(function(){return v})}:h,p?function(v){return s(d,h()).then(function(){throw v})}:h)}}),!e&&i(r)){var f=a("Promise").prototype.finally;l.finally!==f&&u(l,"finally",f,{unsafe:!0})}return bd}var ts,Id;function Rg(){if(Id)return ts;Id=1,cg(),ic(),lg(),Eg(),kg(),Tg(),Up(),xp(),_g(),Ip();var t=ra();return ts=t.Promise,ts}var rs,Pd;function Og(){if(Pd)return rs;Pd=1;var t=Rg();return Tp(),rs=t,rs}var Ed={},kd;function Cg(){return kd||(kd=1,Up()),Ed}var Td={},_d;function Ag(){return _d||(_d=1,xp()),Td}var ns,Rd;function $g(){if(Rd)return ns;Rd=1;var t=Og();return Cg(),Ag(),ns=t,ns}$g();const qp="sesamy-debug";function Lg(t,e,r){const n=new Date;n.setTime(n.getTime()+r*60*60*1e3);const a="expires="+n.toUTCString();document.cookie=`${t}=${e}; ${a}; path=/`}function Ug(t){if(typeof document>"u")return null;const e=t+"=",r=document.cookie.split(";");for(let n=0;n<r.length;n++){let a=r[n];for(;a.charAt(0)===" ";)a=a.substring(1);if(a.indexOf(e)===0)return a.substring(e.length,a.length)}return null}function xg(t){Lg(qp,t.toString(),1)}function qg(){return Ug(qp)==="true"}function H(t){qg()&&console.log(t)}function Zt(t,e){if(typeof window>"u")return;const r=new CustomEvent(t,{detail:e,bubbles:!0,composed:!0});H(`Triggering event: ${t}`),dispatchEvent(r)}function ct(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function"){var a=0;for(n=Object.getOwnPropertySymbols(t);a<n.length;a++)e.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(t,n[a])&&(r[n[a]]=t[n[a]])}return r}var Dt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function lc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function fc(t,e){return t(e={exports:{}},e.exports),e.exports}var jt=fc((function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var r=(function(){function n(){var a=this;this.locked=new Map,this.addToLocked=function(i,o){var s=a.locked.get(i);s===void 0?o===void 0?a.locked.set(i,[]):a.locked.set(i,[o]):o!==void 0&&(s.unshift(o),a.locked.set(i,s))},this.isLocked=function(i){return a.locked.has(i)},this.lock=function(i){return new Promise((function(o,s){a.isLocked(i)?a.addToLocked(i,o):(a.addToLocked(i),o())}))},this.unlock=function(i){var o=a.locked.get(i);if(o!==void 0&&o.length!==0){var s=o.pop();a.locked.set(i,o),s!==void 0&&setTimeout(s,0)}else a.locked.delete(i)}}return n.getInstance=function(){return n.instance===void 0&&(n.instance=new n),n.instance},n})();e.default=function(){return r.getInstance()}}));lc(jt);var Ng=lc(fc((function(t,e){var r=Dt&&Dt.__awaiter||function(c,f,h,d){return new(h||(h=Promise))((function(p,v){function g(y){try{b(d.next(y))}catch(m){v(m)}}function P(y){try{b(d.throw(y))}catch(m){v(m)}}function b(y){y.done?p(y.value):new h((function(m){m(y.value)})).then(g,P)}b((d=d.apply(c,f||[])).next())}))},n=Dt&&Dt.__generator||function(c,f){var h,d,p,v,g={label:0,sent:function(){if(1&p[0])throw p[1];return p[1]},trys:[],ops:[]};return v={next:P(0),throw:P(1),return:P(2)},typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function P(b){return function(y){return(function(m){if(h)throw new TypeError("Generator is already executing.");for(;g;)try{if(h=1,d&&(p=2&m[0]?d.return:m[0]?d.throw||((p=d.return)&&p.call(d),0):d.next)&&!(p=p.call(d,m[1])).done)return p;switch(d=0,p&&(m=[2&m[0],p.value]),m[0]){case 0:case 1:p=m;break;case 4:return g.label++,{value:m[1],done:!1};case 5:g.label++,d=m[1],m=[0];continue;case 7:m=g.ops.pop(),g.trys.pop();continue;default:if(p=g.trys,!((p=p.length>0&&p[p.length-1])||m[0]!==6&&m[0]!==2)){g=0;continue}if(m[0]===3&&(!p||m[1]>p[0]&&m[1]<p[3])){g.label=m[1];break}if(m[0]===6&&g.label<p[1]){g.label=p[1],p=m;break}if(p&&g.label<p[2]){g.label=p[2],g.ops.push(m);break}p[2]&&g.ops.pop(),g.trys.pop();continue}m=f.call(c,g)}catch(w){m=[6,w],d=0}finally{h=p=0}if(5&m[0])throw m[1];return{value:m[0]?m[1]:void 0,done:!0}})([b,y])}}},a=Dt;Object.defineProperty(e,"__esModule",{value:!0});var i="browser-tabs-lock-key",o={key:function(c){return r(a,void 0,void 0,(function(){return n(this,(function(f){throw new Error("Unsupported")}))}))},getItem:function(c){return r(a,void 0,void 0,(function(){return n(this,(function(f){throw new Error("Unsupported")}))}))},clear:function(){return r(a,void 0,void 0,(function(){return n(this,(function(c){return[2,window.localStorage.clear()]}))}))},removeItem:function(c){return r(a,void 0,void 0,(function(){return n(this,(function(f){throw new Error("Unsupported")}))}))},setItem:function(c,f){return r(a,void 0,void 0,(function(){return n(this,(function(h){throw new Error("Unsupported")}))}))},keySync:function(c){return window.localStorage.key(c)},getItemSync:function(c){return window.localStorage.getItem(c)},clearSync:function(){return window.localStorage.clear()},removeItemSync:function(c){return window.localStorage.removeItem(c)},setItemSync:function(c,f){return window.localStorage.setItem(c,f)}};function s(c){return new Promise((function(f){return setTimeout(f,c)}))}function u(c){for(var f="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",h="",d=0;d<c;d++)h+=f[Math.floor(Math.random()*f.length)];return h}var l=(function(){function c(f){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+u(15),this.acquireLock=this.acquireLock.bind(this),this.releaseLock=this.releaseLock.bind(this),this.releaseLock__private__=this.releaseLock__private__.bind(this),this.waitForSomethingToChange=this.waitForSomethingToChange.bind(this),this.refreshLockWhileAcquired=this.refreshLockWhileAcquired.bind(this),this.storageHandler=f,c.waiters===void 0&&(c.waiters=[])}return c.prototype.acquireLock=function(f,h){return h===void 0&&(h=5e3),r(this,void 0,void 0,(function(){var d,p,v,g,P,b,y;return n(this,(function(m){switch(m.label){case 0:d=Date.now()+u(4),p=Date.now()+h,v=i+"-"+f,g=this.storageHandler===void 0?o:this.storageHandler,m.label=1;case 1:return Date.now()<p?[4,s(30)]:[3,8];case 2:return m.sent(),g.getItemSync(v)!==null?[3,5]:(P=this.id+"-"+f+"-"+d,[4,s(Math.floor(25*Math.random()))]);case 3:return m.sent(),g.setItemSync(v,JSON.stringify({id:this.id,iat:d,timeoutKey:P,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,s(30)];case 4:return m.sent(),(b=g.getItemSync(v))!==null&&(y=JSON.parse(b)).id===this.id&&y.iat===d?(this.acquiredIatSet.add(d),this.refreshLockWhileAcquired(v,d),[2,!0]):[3,7];case 5:return c.lockCorrector(this.storageHandler===void 0?o:this.storageHandler),[4,this.waitForSomethingToChange(p)];case 6:m.sent(),m.label=7;case 7:return d=Date.now()+u(4),[3,1];case 8:return[2,!1]}}))}))},c.prototype.refreshLockWhileAcquired=function(f,h){return r(this,void 0,void 0,(function(){var d=this;return n(this,(function(p){return setTimeout((function(){return r(d,void 0,void 0,(function(){var v,g,P;return n(this,(function(b){switch(b.label){case 0:return[4,jt.default().lock(h)];case 1:return b.sent(),this.acquiredIatSet.has(h)?(v=this.storageHandler===void 0?o:this.storageHandler,(g=v.getItemSync(f))===null?(jt.default().unlock(h),[2]):((P=JSON.parse(g)).timeRefreshed=Date.now(),v.setItemSync(f,JSON.stringify(P)),jt.default().unlock(h),this.refreshLockWhileAcquired(f,h),[2])):(jt.default().unlock(h),[2])}}))}))}),1e3),[2]}))}))},c.prototype.waitForSomethingToChange=function(f){return r(this,void 0,void 0,(function(){return n(this,(function(h){switch(h.label){case 0:return[4,new Promise((function(d){var p=!1,v=Date.now(),g=!1;function P(){if(g||(window.removeEventListener("storage",P),c.removeFromWaiting(P),clearTimeout(b),g=!0),!p){p=!0;var y=50-(Date.now()-v);y>0?setTimeout(d,y):d(null)}}window.addEventListener("storage",P),c.addToWaiting(P);var b=setTimeout(P,Math.max(0,f-Date.now()))}))];case 1:return h.sent(),[2]}}))}))},c.addToWaiting=function(f){this.removeFromWaiting(f),c.waiters!==void 0&&c.waiters.push(f)},c.removeFromWaiting=function(f){c.waiters!==void 0&&(c.waiters=c.waiters.filter((function(h){return h!==f})))},c.notifyWaiters=function(){c.waiters!==void 0&&c.waiters.slice().forEach((function(f){return f()}))},c.prototype.releaseLock=function(f){return r(this,void 0,void 0,(function(){return n(this,(function(h){switch(h.label){case 0:return[4,this.releaseLock__private__(f)];case 1:return[2,h.sent()]}}))}))},c.prototype.releaseLock__private__=function(f){return r(this,void 0,void 0,(function(){var h,d,p,v;return n(this,(function(g){switch(g.label){case 0:return h=this.storageHandler===void 0?o:this.storageHandler,d=i+"-"+f,(p=h.getItemSync(d))===null?[2]:(v=JSON.parse(p)).id!==this.id?[3,2]:[4,jt.default().lock(v.iat)];case 1:g.sent(),this.acquiredIatSet.delete(v.iat),h.removeItemSync(d),jt.default().unlock(v.iat),c.notifyWaiters(),g.label=2;case 2:return[2]}}))}))},c.lockCorrector=function(f){for(var h=Date.now()-5e3,d=f,p=[],v=0;;){var g=d.keySync(v);if(g===null)break;p.push(g),v++}for(var P=!1,b=0;b<p.length;b++){var y=p[b];if(y.includes(i)){var m=d.getItemSync(y);if(m!==null){var w=JSON.parse(m);(w.timeRefreshed===void 0&&w.timeAcquired<h||w.timeRefreshed!==void 0&&w.timeRefreshed<h)&&(d.removeItemSync(y),P=!0)}}}P&&c.notifyWaiters()},c.waiters=void 0,c})();e.default=l})));const jg={timeoutInSeconds:60},Np={name:"auth0-spa-js",version:"2.11.3"},jp=()=>Date.now();let Pe=class Ps extends Error{constructor(e,r){super(r),this.error=e,this.error_description=r,Object.setPrototypeOf(this,Ps.prototype)}static fromPayload({error:e,error_description:r}){return new Ps(e,r)}},Dg=class Dp extends Pe{constructor(e,r,n,a=null){super(e,r),this.state=n,this.appState=a,Object.setPrototypeOf(this,Dp.prototype)}},Mg=class Mp extends Pe{constructor(e,r,n,a,i=null){super(e,r),this.connection=n,this.state=a,this.appState=i,Object.setPrototypeOf(this,Mp.prototype)}},Pn=class Fp extends Pe{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,Fp.prototype)}};class dc extends Pn{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,dc.prototype)}}let Fg=class Bp extends Pe{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,Bp.prototype)}},Bg=class Kp extends Pe{constructor(){super("popup_open","Unable to open a popup for loginWithPopup - window.open returned `null`"),Object.setPrototypeOf(this,Kp.prototype)}},Kg=class zp extends Pe{constructor(e,r,n){super(e,r),this.mfa_token=n,Object.setPrototypeOf(this,zp.prototype)}},Hp=class Wp extends Pe{constructor(e,r){super("missing_refresh_token",`Missing Refresh Token (audience: '${$n(e,["default"])}', scope: '${$n(r)}')`),this.audience=e,this.scope=r,Object.setPrototypeOf(this,Wp.prototype)}},zg=class Gp extends Pe{constructor(e,r){super("missing_scopes",`Missing requested scopes after refresh (audience: '${$n(e,["default"])}', missing scope: '${$n(r)}')`),this.audience=e,this.scope=r,Object.setPrototypeOf(this,Gp.prototype)}},Vp=class Jp extends Pe{constructor(e){super("use_dpop_nonce","Server rejected DPoP proof: wrong nonce"),this.newDpopNonce=e,Object.setPrototypeOf(this,Jp.prototype)}};function $n(t,e=[]){return t&&!e.includes(t)?t:""}const Ln=()=>window.crypto,xr=()=>{const t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let e="";return Array.from(Ln().getRandomValues(new Uint8Array(43))).forEach((r=>e+=t[r%t.length])),e},as=t=>btoa(t),Hg=[{key:"name",type:["string"]},{key:"version",type:["string","number"]},{key:"env",type:["object"]}],Wg=t=>Object.keys(t).reduce(((e,r)=>{const n=Hg.find((a=>a.key===r));return n&&n.type.includes(typeof t[r])&&(e[r]=t[r]),e}),{}),Es=t=>{var{clientId:e}=t,r=ct(t,["clientId"]);return new URLSearchParams((n=>Object.keys(n).filter((a=>n[a]!==void 0)).reduce(((a,i)=>Object.assign(Object.assign({},a),{[i]:n[i]})),{}))(Object.assign({client_id:e},r))).toString()},Od=async t=>await Ln().subtle.digest({name:"SHA-256"},new TextEncoder().encode(t)),Cd=t=>(e=>decodeURIComponent(atob(e).split("").map((r=>"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2))).join("")))(t.replace(/_/g,"/").replace(/-/g,"+")),Ad=t=>{const e=new Uint8Array(t);return(r=>{const n={"+":"-","/":"_","=":""};return r.replace(/[+/=]/g,(a=>n[a]))})(window.btoa(String.fromCharCode(...Array.from(e))))},Gg=new TextEncoder,Vg=new TextDecoder;function Jr(t){return typeof t=="string"?Gg.encode(t):Vg.decode(t)}function $d(t){if(typeof t.modulusLength!="number"||t.modulusLength<2048)throw new Zg(`${t.name} modulusLength must be at least 2048 bits`)}async function Jg(t,e,r){if(r.usages.includes("sign")===!1)throw new TypeError('private CryptoKey instances used for signing assertions must include "sign" in their "usages"');const n=`${Zr(Jr(JSON.stringify(t)))}.${Zr(Jr(JSON.stringify(e)))}`;return`${n}.${Zr(await crypto.subtle.sign((function(a){switch(a.algorithm.name){case"ECDSA":return{name:a.algorithm.name,hash:"SHA-256"};case"RSA-PSS":return $d(a.algorithm),{name:a.algorithm.name,saltLength:32};case"RSASSA-PKCS1-v1_5":return $d(a.algorithm),{name:a.algorithm.name};case"Ed25519":return{name:a.algorithm.name}}throw new Bt})(r),r,Jr(n)))}`}let ks;Uint8Array.prototype.toBase64?ks=t=>(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),t.toBase64({alphabet:"base64url",omitPadding:!0})):ks=e=>{e instanceof ArrayBuffer&&(e=new Uint8Array(e));const r=[];for(let n=0;n<e.byteLength;n+=32768)r.push(String.fromCharCode.apply(null,e.subarray(n,n+32768)));return btoa(r.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")};function Zr(t){return ks(t)}let Bt=class extends Error{constructor(e){var r;super(e??"operation not supported"),this.name=this.constructor.name,(r=Error.captureStackTrace)===null||r===void 0||r.call(Error,this,this.constructor)}},Zg=class extends Error{constructor(e){var r;super(e),this.name=this.constructor.name,(r=Error.captureStackTrace)===null||r===void 0||r.call(Error,this,this.constructor)}};function Yg(t){switch(t.algorithm.name){case"RSA-PSS":return(function(e){if(e.algorithm.hash.name==="SHA-256")return"PS256";throw new Bt("unsupported RsaHashedKeyAlgorithm hash name")})(t);case"RSASSA-PKCS1-v1_5":return(function(e){if(e.algorithm.hash.name==="SHA-256")return"RS256";throw new Bt("unsupported RsaHashedKeyAlgorithm hash name")})(t);case"ECDSA":return(function(e){if(e.algorithm.namedCurve==="P-256")return"ES256";throw new Bt("unsupported EcKeyAlgorithm namedCurve")})(t);case"Ed25519":return"Ed25519";default:throw new Bt("unsupported CryptoKey algorithm name")}}function Zp(t){return t instanceof CryptoKey}function Yp(t){return Zp(t)&&t.type==="public"}async function Xg(t,e,r,n,a,i){const o=t?.privateKey,s=t?.publicKey;if(!Zp(u=o)||u.type!=="private")throw new TypeError('"keypair.privateKey" must be a private CryptoKey');var u;if(!Yp(s))throw new TypeError('"keypair.publicKey" must be a public CryptoKey');if(s.extractable!==!0)throw new TypeError('"keypair.publicKey.extractable" must be true');if(typeof e!="string")throw new TypeError('"htu" must be a string');if(typeof r!="string")throw new TypeError('"htm" must be a string');if(n!==void 0&&typeof n!="string")throw new TypeError('"nonce" must be a string or undefined');if(a!==void 0&&typeof a!="string")throw new TypeError('"accessToken" must be a string or undefined');return Jg({alg:Yg(o),typ:"dpop+jwt",jwk:await Xp(s)},Object.assign(Object.assign({},i),{iat:Math.floor(Date.now()/1e3),jti:crypto.randomUUID(),htm:r,nonce:n,htu:e,ath:a?Zr(await crypto.subtle.digest("SHA-256",Jr(a))):void 0}),o)}async function Xp(t){const{kty:e,e:r,n,x:a,y:i,crv:o}=await crypto.subtle.exportKey("jwk",t);return{kty:e,crv:o,e:r,n,x:a,y:i}}const Qg=["authorization_code","refresh_token","urn:ietf:params:oauth:grant-type:token-exchange"];function ey(){return(async function(t,e){var r;let n;if(t.length===0)throw new TypeError('"alg" must be a non-empty string');switch(t){case"PS256":n={name:"RSA-PSS",hash:"SHA-256",modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case"RS256":n={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256",modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case"ES256":n={name:"ECDSA",namedCurve:"P-256"};break;case"Ed25519":n={name:"Ed25519"};break;default:throw new Bt}return crypto.subtle.generateKey(n,(r=e?.extractable)!==null&&r!==void 0&&r,["sign","verify"])})("ES256",{extractable:!1})}function ty(t){return(async function(e){if(!Yp(e))throw new TypeError('"publicKey" must be a public CryptoKey');if(e.extractable!==!0)throw new TypeError('"publicKey.extractable" must be true');const r=await Xp(e);let n;switch(r.kty){case"EC":n={crv:r.crv,kty:r.kty,x:r.x,y:r.y};break;case"OKP":n={crv:r.crv,kty:r.kty,x:r.x};break;case"RSA":n={e:r.e,kty:r.kty,n:r.n};break;default:throw new Bt("unsupported JWK kty")}return Zr(await crypto.subtle.digest({name:"SHA-256"},Jr(JSON.stringify(n))))})(t.publicKey)}function ry({keyPair:t,url:e,method:r,nonce:n,accessToken:a}){const i=(function(o){const s=new URL(o);return s.search="",s.hash="",s.href})(e);return Xg(t,i,r,n,a)}const ny=async(t,e)=>{const r=await fetch(t,e);return{ok:r.ok,json:await r.json(),headers:(n=r.headers,[...n].reduce(((a,[i,o])=>(a[i]=o,a)),{}))};var n},ay=async(t,e,r)=>{const n=new AbortController;let a;return e.signal=n.signal,Promise.race([ny(t,e),new Promise(((i,o)=>{a=setTimeout((()=>{n.abort(),o(new Error("Timeout when executing 'fetch'"))}),r)}))]).finally((()=>{clearTimeout(a)}))},iy=async(t,e,r,n,a,i,o,s)=>{return u={auth:{audience:e,scope:r},timeout:a,fetchUrl:t,fetchOptions:n,useFormData:o,useMrrt:s},l=i,new Promise((function(c,f){const h=new MessageChannel;h.port1.onmessage=function(d){d.data.error?f(new Error(d.data.error)):c(d.data),h.port1.close()},l.postMessage(u,[h.port2])}));var u,l},oy=async(t,e,r,n,a,i,o=1e4,s)=>a?iy(t,e,r,n,o,a,i,s):ay(t,n,o);async function Qp(t,e,r,n,a,i,o,s,u,l){if(u){const y=await u.generateProof({url:t,method:a.method||"GET",nonce:await u.getNonce()});a.headers=Object.assign(Object.assign({},a.headers),{dpop:y})}let c,f=null;for(let y=0;y<3;y++)try{c=await oy(t,r,n,a,i,o,e,s),f=null;break}catch(m){f=m}if(f)throw f;const h=c.json,{error:d,error_description:p}=h,v=ct(h,["error","error_description"]),{headers:g,ok:P}=c;let b;if(u&&(b=g["dpop-nonce"],b&&await u.setNonce(b)),!P){const y=p||`HTTP error. Unable to fetch ${t}`;if(d==="mfa_required")throw new Kg(d,y,v.mfa_token);if(d==="missing_refresh_token")throw new Hp(r,n);if(d==="use_dpop_nonce"){if(!u||!b||l)throw new Vp(b);return Qp(t,e,r,n,a,i,o,s,u,!0)}throw new Pe(d||"request_error",y)}return v}async function sy(t,e){var{baseUrl:r,timeout:n,audience:a,scope:i,auth0Client:o,useFormData:s,useMrrt:u,dpop:l}=t,c=ct(t,["baseUrl","timeout","audience","scope","auth0Client","useFormData","useMrrt","dpop"]);const f=c.grant_type==="urn:ietf:params:oauth:grant-type:token-exchange",h=c.grant_type==="refresh_token"&&u,d=Object.assign(Object.assign(Object.assign(Object.assign({},c),f&&a&&{audience:a}),f&&i&&{scope:i}),h&&{audience:a,scope:i}),p=s?Es(d):JSON.stringify(d),v=(g=c.grant_type,Qg.includes(g));var g;return await Qp(`${r}/oauth/token`,n,a||"default",i,{method:"POST",body:p,headers:{"Content-Type":s?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(Wg(o||Np)))}},e,s,u,v?l:void 0)}const En=(...t)=>{return(e=t.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(e))).join(" ");var e},vn=(t,e,r)=>{let n;return r&&(n=t[r]),n||(n=t.default),En(n,e)};let vt=class Ts{constructor(e,r="@@auth0spajs@@",n){this.prefix=r,this.suffix=n,this.clientId=e.clientId,this.scope=e.scope,this.audience=e.audience}toKey(){return[this.prefix,this.clientId,this.audience,this.scope,this.suffix].filter(Boolean).join("::")}static fromKey(e){const[r,n,a,i]=e.split("::");return new Ts({clientId:n,scope:i,audience:a},r)}static fromCacheEntry(e){const{scope:r,audience:n,client_id:a}=e;return new Ts({scope:r,audience:n,clientId:a})}},cy=class{set(e,r){localStorage.setItem(e,JSON.stringify(r))}get(e){const r=window.localStorage.getItem(e);if(r)try{return JSON.parse(r)}catch{return}}remove(e){localStorage.removeItem(e)}allKeys(){return Object.keys(window.localStorage).filter((e=>e.startsWith("@@auth0spajs@@")))}},ev=class{constructor(){this.enclosedCache=(function(){let e={};return{set(r,n){e[r]=n},get(r){const n=e[r];if(n)return n},remove(r){delete e[r]},allKeys:()=>Object.keys(e)}})()}},uy=class{constructor(e,r,n){this.cache=e,this.keyManifest=r,this.nowProvider=n||jp}async setIdToken(e,r,n){var a;const i=this.getIdTokenCacheKey(e);await this.cache.set(i,{id_token:r,decodedToken:n}),await((a=this.keyManifest)===null||a===void 0?void 0:a.add(i))}async getIdToken(e){const r=await this.cache.get(this.getIdTokenCacheKey(e.clientId));if(!r&&e.scope&&e.audience){const n=await this.get(e);return!n||!n.id_token||!n.decodedToken?void 0:{id_token:n.id_token,decodedToken:n.decodedToken}}if(r)return{id_token:r.id_token,decodedToken:r.decodedToken}}async get(e,r=0,n=!1,a){var i;let o=await this.cache.get(e.toKey());if(!o){const l=await this.getCacheKeys();if(!l)return;const c=this.matchExistingCacheKey(e,l);if(c&&(o=await this.cache.get(c)),!o&&n&&a!=="cache-only")return this.getEntryWithRefreshToken(e,l)}if(!o)return;const s=await this.nowProvider(),u=Math.floor(s/1e3);return o.expiresAt-r<u?o.body.refresh_token?this.modifiedCachedEntry(o,e):(await this.cache.remove(e.toKey()),void await((i=this.keyManifest)===null||i===void 0?void 0:i.remove(e.toKey()))):o.body}async modifiedCachedEntry(e,r){return e.body={refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope},await this.cache.set(r.toKey(),e),{refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope}}async set(e){var r;const n=new vt({clientId:e.client_id,scope:e.scope,audience:e.audience}),a=await this.wrapCacheEntry(e);await this.cache.set(n.toKey(),a),await((r=this.keyManifest)===null||r===void 0?void 0:r.add(n.toKey()))}async remove(e,r,n){const a=new vt({clientId:e,scope:n,audience:r});await this.cache.remove(a.toKey())}async clear(e){var r;const n=await this.getCacheKeys();n&&(await n.filter((a=>!e||a.includes(e))).reduce((async(a,i)=>{await a,await this.cache.remove(i)}),Promise.resolve()),await((r=this.keyManifest)===null||r===void 0?void 0:r.clear()))}async wrapCacheEntry(e){const r=await this.nowProvider();return{body:e,expiresAt:Math.floor(r/1e3)+e.expires_in}}async getCacheKeys(){var e;return this.keyManifest?(e=await this.keyManifest.get())===null||e===void 0?void 0:e.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(e){return new vt({clientId:e},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(e,r){return r.filter((n=>{var a;const i=vt.fromKey(n),o=new Set(i.scope&&i.scope.split(" ")),s=((a=e.scope)===null||a===void 0?void 0:a.split(" "))||[],u=i.scope&&s.reduce(((l,c)=>l&&o.has(c)),!0);return i.prefix==="@@auth0spajs@@"&&i.clientId===e.clientId&&i.audience===e.audience&&u}))[0]}async getEntryWithRefreshToken(e,r){var n;for(const a of r){const i=vt.fromKey(a);if(i.prefix==="@@auth0spajs@@"&&i.clientId===e.clientId){const o=await this.cache.get(a);if(!((n=o?.body)===null||n===void 0)&&n.refresh_token)return this.modifiedCachedEntry(o,e)}}}async updateEntry(e,r){var n;const a=await this.getCacheKeys();if(a)for(const i of a){const o=await this.cache.get(i);if(((n=o?.body)===null||n===void 0?void 0:n.refresh_token)===e){const s=Object.assign(Object.assign({},o.body),{refresh_token:r});await this.set(s)}}}},ly=class{constructor(e,r,n){this.storage=e,this.clientId=r,this.cookieDomain=n,this.storageKey=`a0.spajs.txs.${this.clientId}`}create(e){this.storage.save(this.storageKey,e,{daysUntilExpire:1,cookieDomain:this.cookieDomain})}get(){return this.storage.get(this.storageKey)}remove(){this.storage.remove(this.storageKey,{cookieDomain:this.cookieDomain})}};const qr=t=>typeof t=="number",fy=["iss","aud","exp","nbf","iat","jti","azp","nonce","auth_time","at_hash","c_hash","acr","amr","sub_jwk","cnf","sip_from_tag","sip_date","sip_callid","sip_cseq_num","sip_via_branch","orig","dest","mky","events","toe","txn","rph","sid","vot","vtm"],dy=t=>{if(!t.id_token)throw new Error("ID token is required but missing");const e=(i=>{const o=i.split("."),[s,u,l]=o;if(o.length!==3||!s||!u||!l)throw new Error("ID token could not be decoded");const c=JSON.parse(Cd(u)),f={__raw:i},h={};return Object.keys(c).forEach((d=>{f[d]=c[d],fy.includes(d)||(h[d]=c[d])})),{encoded:{header:s,payload:u,signature:l},header:JSON.parse(Cd(s)),claims:f,user:h}})(t.id_token);if(!e.claims.iss)throw new Error("Issuer (iss) claim must be a string present in the ID token");if(e.claims.iss!==t.iss)throw new Error(`Issuer (iss) claim mismatch in the ID token; expected "${t.iss}", found "${e.claims.iss}"`);if(!e.user.sub)throw new Error("Subject (sub) claim must be a string present in the ID token");if(e.header.alg!=="RS256")throw new Error(`Signature algorithm of "${e.header.alg}" is not supported. Expected the ID token to be signed with "RS256".`);if(!e.claims.aud||typeof e.claims.aud!="string"&&!Array.isArray(e.claims.aud))throw new Error("Audience (aud) claim must be a string or array of strings present in the ID token");if(Array.isArray(e.claims.aud)){if(!e.claims.aud.includes(t.aud))throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${t.aud}" but was not one of "${e.claims.aud.join(", ")}"`);if(e.claims.aud.length>1){if(!e.claims.azp)throw new Error("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values");if(e.claims.azp!==t.aud)throw new Error(`Authorized Party (azp) claim mismatch in the ID token; expected "${t.aud}", found "${e.claims.azp}"`)}}else if(e.claims.aud!==t.aud)throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${t.aud}" but found "${e.claims.aud}"`);if(t.nonce){if(!e.claims.nonce)throw new Error("Nonce (nonce) claim must be a string present in the ID token");if(e.claims.nonce!==t.nonce)throw new Error(`Nonce (nonce) claim mismatch in the ID token; expected "${t.nonce}", found "${e.claims.nonce}"`)}if(t.max_age&&!qr(e.claims.auth_time))throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");if(e.claims.exp==null||!qr(e.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!qr(e.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const r=t.leeway||60,n=new Date(t.now||Date.now()),a=new Date(0);if(a.setUTCSeconds(e.claims.exp+r),n>a)throw new Error(`Expiration Time (exp) claim error in the ID token; current time (${n}) is after expiration time (${a})`);if(e.claims.nbf!=null&&qr(e.claims.nbf)){const i=new Date(0);if(i.setUTCSeconds(e.claims.nbf-r),n<i)throw new Error(`Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (${n}) is before ${i}`)}if(e.claims.auth_time!=null&&qr(e.claims.auth_time)){const i=new Date(0);if(i.setUTCSeconds(parseInt(e.claims.auth_time)+t.max_age+r),n>i)throw new Error(`Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (${n}) is after last auth at ${i}`)}if(t.organization){const i=t.organization.trim();if(i.startsWith("org_")){const o=i;if(!e.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(o!==e.claims.org_id)throw new Error(`Organization ID (org_id) claim mismatch in the ID token; expected "${o}", found "${e.claims.org_id}"`)}else{const o=i.toLowerCase();if(!e.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(o!==e.claims.org_name)throw new Error(`Organization Name (org_name) claim mismatch in the ID token; expected "${o}", found "${e.claims.org_name}"`)}}return e};var Kt=fc((function(t,e){var r=Dt&&Dt.__assign||function(){return r=Object.assign||function(u){for(var l,c=1,f=arguments.length;c<f;c++)for(var h in l=arguments[c])Object.prototype.hasOwnProperty.call(l,h)&&(u[h]=l[h]);return u},r.apply(this,arguments)};function n(u,l){if(!l)return"";var c="; "+u;return l===!0?c:c+"="+l}function a(u,l,c){return encodeURIComponent(u).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(l).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+(function(f){if(typeof f.expires=="number"){var h=new Date;h.setMilliseconds(h.getMilliseconds()+864e5*f.expires),f.expires=h}return n("Expires",f.expires?f.expires.toUTCString():"")+n("Domain",f.domain)+n("Path",f.path)+n("Secure",f.secure)+n("SameSite",f.sameSite)})(c)}function i(u){for(var l={},c=u?u.split("; "):[],f=/(%[\dA-F]{2})+/gi,h=0;h<c.length;h++){var d=c[h].split("="),p=d.slice(1).join("=");p.charAt(0)==='"'&&(p=p.slice(1,-1));try{l[d[0].replace(f,decodeURIComponent)]=p.replace(f,decodeURIComponent)}catch{}}return l}function o(){return i(document.cookie)}function s(u,l,c){document.cookie=a(u,l,r({path:"/"},c))}e.__esModule=!0,e.encode=a,e.parse=i,e.getAll=o,e.get=function(u){return o()[u]},e.set=s,e.remove=function(u,l){s(u,"",r(r({},l),{expires:-1}))}}));lc(Kt),Kt.encode,Kt.parse,Kt.getAll;var hy=Kt.get,tv=Kt.set,rv=Kt.remove;const pr={get(t){const e=hy(t);if(e!==void 0)return JSON.parse(e)},save(t,e,r){let n={};window.location.protocol==="https:"&&(n={secure:!0,sameSite:"none"}),r?.daysUntilExpire&&(n.expires=r.daysUntilExpire),r?.cookieDomain&&(n.domain=r.cookieDomain),tv(t,JSON.stringify(e),n)},remove(t,e){let r={};e?.cookieDomain&&(r.domain=e.cookieDomain),rv(t,r)}},py={get(t){return pr.get(t)||pr.get(`_legacy_${t}`)},save(t,e,r){let n={};window.location.protocol==="https:"&&(n={secure:!0}),r?.daysUntilExpire&&(n.expires=r.daysUntilExpire),r?.cookieDomain&&(n.domain=r.cookieDomain),tv(`_legacy_${t}`,JSON.stringify(e),n),pr.save(t,e,r)},remove(t,e){let r={};e?.cookieDomain&&(r.domain=e.cookieDomain),rv(t,r),pr.remove(t,e),pr.remove(`_legacy_${t}`,e)}},vy={get(t){if(typeof sessionStorage>"u")return;const e=sessionStorage.getItem(t);return e!=null?JSON.parse(e):void 0},save(t,e){sessionStorage.setItem(t,JSON.stringify(e))},remove(t){sessionStorage.removeItem(t)}};var Mt;(function(t){t.Code="code",t.ConnectCode="connect_code"})(Mt||(Mt={}));function my(t,e,r){var n=e===void 0?null:e,a=(function(u,l){var c=atob(u);if(l){for(var f=new Uint8Array(c.length),h=0,d=c.length;h<d;++h)f[h]=c.charCodeAt(h);return String.fromCharCode.apply(null,new Uint16Array(f.buffer))}return c})(t,r!==void 0&&r),i=a.indexOf(`
2
+ `,10)+1,o=a.substring(i)+(n?"//# sourceMappingURL="+n:""),s=new Blob([o],{type:"application/javascript"});return URL.createObjectURL(s)}var Ld,Ud,xd,is,gy=(Ld="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YSx1c2VNcnJ0OmZ9LHBvcnRzOltwXX0pPT57bGV0IGgsdSxsPXt9O2NvbnN0e2F1ZGllbmNlOmQsc2NvcGU6eX09cnx8e307dHJ5e2NvbnN0IHI9YT8oZT0+e2NvbnN0IHQ9bmV3IFVSTFNlYXJjaFBhcmFtcyhlKSxyPXt9O3JldHVybiB0LmZvckVhY2goKChlLHQpPT57clt0XT1lfSkpLHJ9KShjLmJvZHkpOkpTT04ucGFyc2UoYy5ib2R5KTtpZighci5yZWZyZXNoX3Rva2VuJiYicmVmcmVzaF90b2tlbiI9PT1yLmdyYW50X3R5cGUpe2lmKHU9KChlLHQpPT5vW24oZSx0KV0pKGQseSksIXUmJmYpe2NvbnN0IGU9by5sYXRlc3RfcmVmcmVzaF90b2tlbix0PSgoZSx0KT0+e2NvbnN0IHI9T2JqZWN0LmtleXMobykuZmluZCgocj0+e2lmKCJsYXRlc3RfcmVmcmVzaF90b2tlbiIhPT1yKXtjb25zdCBzPSgoZSx0KT0+dC5zdGFydHNXaXRoKGAke2V9fGApKSh0LHIpLG89ci5zcGxpdCgifCIpWzFdLnNwbGl0KCIgIiksbj1lLnNwbGl0KCIgIikuZXZlcnkoKGU9Pm8uaW5jbHVkZXMoZSkpKTtyZXR1cm4gcyYmbn19KSk7cmV0dXJuISFyfSkoeSxkKTtlJiYhdCYmKHU9ZSl9aWYoIXUpdGhyb3cgbmV3IHQoZCx5KTtjLmJvZHk9YT9zKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxyKSx7cmVmcmVzaF90b2tlbjp1fSkpOkpTT04uc3RyaW5naWZ5KE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxyKSx7cmVmcmVzaF90b2tlbjp1fSkpfWxldCBqLGs7ImZ1bmN0aW9uIj09dHlwZW9mIEFib3J0Q29udHJvbGxlciYmKGo9bmV3IEFib3J0Q29udHJvbGxlcixjLnNpZ25hbD1qLnNpZ25hbCk7dHJ5e2s9YXdhaXQgUHJvbWlzZS5yYWNlKFsoXz1lLG5ldyBQcm9taXNlKChlPT5zZXRUaW1lb3V0KGUsXykpKSksZmV0Y2goaSxPYmplY3QuYXNzaWduKHt9LGMpKV0pfWNhdGNoKGUpe3JldHVybiB2b2lkIHAucG9zdE1lc3NhZ2Uoe2Vycm9yOmUubWVzc2FnZX0pfWlmKCFrKXJldHVybiBqJiZqLmFib3J0KCksdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjoiVGltZW91dCB3aGVuIGV4ZWN1dGluZyAnZmV0Y2gnIn0pO2c9ay5oZWFkZXJzLGw9Wy4uLmddLnJlZHVjZSgoKGUsW3Qscl0pPT4oZVt0XT1yLGUpKSx7fSksaD1hd2FpdCBrLmpzb24oKSxoLnJlZnJlc2hfdG9rZW4/KGYmJihvLmxhdGVzdF9yZWZyZXNoX3Rva2VuPWgucmVmcmVzaF90b2tlbixPPXUsYj1oLnJlZnJlc2hfdG9rZW4sT2JqZWN0LmVudHJpZXMobykuZm9yRWFjaCgoKFtlLHRdKT0+e3Q9PT1PJiYob1tlXT1iKX0pKSksKChlLHQscik9PntvW24odCxyKV09ZX0pKGgucmVmcmVzaF90b2tlbixkLHkpLGRlbGV0ZSBoLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KShkLHkpLHAucG9zdE1lc3NhZ2Uoe29rOmsub2ssanNvbjpoLGhlYWRlcnM6bH0pfWNhdGNoKGUpe3AucG9zdE1lc3NhZ2Uoe29rOiExLGpzb246e2Vycm9yOmUuZXJyb3IsZXJyb3JfZGVzY3JpcHRpb246ZS5tZXNzYWdlfSxoZWFkZXJzOmx9KX12YXIgTyxiLGcsX30pKX0oKTsKCg==",Ud=null,xd=!1,function(t){return is=is||my(Ld,Ud,xd),new Worker(is,t)});const os={},qd=async(t,e=3)=>{for(let r=0;r<e;r++)if(await t())return!0;return!1};let yy=class{constructor(e,r){this.cache=e,this.clientId=r,this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(e){var r;const n=new Set(((r=await this.cache.get(this.manifestKey))===null||r===void 0?void 0:r.keys)||[]);n.add(e),await this.cache.set(this.manifestKey,{keys:[...n]})}async remove(e){const r=await this.cache.get(this.manifestKey);if(r){const n=new Set(r.keys);return n.delete(e),n.size>0?await this.cache.set(this.manifestKey,{keys:[...n]}):await this.cache.remove(this.manifestKey)}}get(){return this.cache.get(this.manifestKey)}clear(){return this.cache.remove(this.manifestKey)}createManifestKeyFrom(e){return`@@auth0spajs@@::${e}`}};const wy={memory:()=>new ev().enclosedCache,localstorage:()=>new cy},Nd=t=>wy[t],jd=t=>{const{openUrl:e,onRedirect:r}=t,n=ct(t,["openUrl","onRedirect"]);return Object.assign(Object.assign({},n),{openUrl:e===!1||e?e:r})},Dd=(t,e)=>{const r=e?.split(" ")||[];return(t?.split(" ")||[]).every((n=>r.includes(n)))},Nt={NONCE:"nonce",KEYPAIR:"keypair"};let by=class{constructor(e){this.clientId=e}getVersion(){return 1}createDbHandle(){const e=window.indexedDB.open("auth0-spa-js",this.getVersion());return new Promise(((r,n)=>{e.onupgradeneeded=()=>Object.values(Nt).forEach((a=>e.result.createObjectStore(a))),e.onerror=()=>n(e.error),e.onsuccess=()=>r(e.result)}))}async getDbHandle(){return this.dbHandle||(this.dbHandle=await this.createDbHandle()),this.dbHandle}async executeDbRequest(e,r,n){const a=n((await this.getDbHandle()).transaction(e,r).objectStore(e));return new Promise(((i,o)=>{a.onsuccess=()=>i(a.result),a.onerror=()=>o(a.error)}))}buildKey(e){const r=e?`_${e}`:"auth0";return`${this.clientId}::${r}`}setNonce(e,r){return this.save(Nt.NONCE,this.buildKey(r),e)}setKeyPair(e){return this.save(Nt.KEYPAIR,this.buildKey(),e)}async save(e,r,n){await this.executeDbRequest(e,"readwrite",(a=>a.put(n,r)))}findNonce(e){return this.find(Nt.NONCE,this.buildKey(e))}findKeyPair(){return this.find(Nt.KEYPAIR,this.buildKey())}find(e,r){return this.executeDbRequest(e,"readonly",(n=>n.get(r)))}async deleteBy(e,r){const n=await this.executeDbRequest(e,"readonly",(a=>a.getAllKeys()));n?.filter(r).map((a=>this.executeDbRequest(e,"readwrite",(i=>i.delete(a)))))}deleteByClientId(e,r){return this.deleteBy(e,(n=>typeof n=="string"&&n.startsWith(`${r}::`)))}clearNonces(){return this.deleteByClientId(Nt.NONCE,this.clientId)}clearKeyPairs(){return this.deleteByClientId(Nt.KEYPAIR,this.clientId)}},Sy=class{constructor(e){this.storage=new by(e)}getNonce(e){return this.storage.findNonce(e)}setNonce(e,r){return this.storage.setNonce(e,r)}async getOrGenerateKeyPair(){let e=await this.storage.findKeyPair();return e||(e=await ey(),await this.storage.setKeyPair(e)),e}async generateProof(e){const r=await this.getOrGenerateKeyPair();return ry(Object.assign({keyPair:r},e))}async calculateThumbprint(){return ty(await this.getOrGenerateKeyPair())}async clear(){await Promise.all([this.storage.clearNonces(),this.storage.clearKeyPairs()])}};var vr;(function(t){t.Bearer="Bearer",t.DPoP="DPoP"})(vr||(vr={}));let Iy=class{constructor(e,r){this.hooks=r,this.config=Object.assign(Object.assign({},e),{fetch:e.fetch||(typeof window>"u"?fetch:window.fetch.bind(window))})}isAbsoluteUrl(e){return/^(https?:)?\/\//i.test(e)}buildUrl(e,r){if(r){if(this.isAbsoluteUrl(r))return r;if(e)return`${e.replace(/\/?\/$/,"")}/${r.replace(/^\/+/,"")}`}throw new TypeError("`url` must be absolute or `baseUrl` non-empty.")}getAccessToken(e){return this.config.getAccessToken?this.config.getAccessToken(e):this.hooks.getAccessToken(e)}extractUrl(e){return typeof e=="string"?e:e instanceof URL?e.href:e.url}buildBaseRequest(e,r){if(!this.config.baseUrl)return new Request(e,r);const n=this.buildUrl(this.config.baseUrl,this.extractUrl(e)),a=e instanceof Request?new Request(n,e):n;return new Request(a,r)}setAuthorizationHeader(e,r,n=vr.Bearer){e.headers.set("authorization",`${n} ${r}`)}async setDpopProofHeader(e,r){if(!this.config.dpopNonceId)return;const n=await this.hooks.getDpopNonce(),a=await this.hooks.generateDpopProof({accessToken:r,method:e.method,nonce:n,url:e.url});e.headers.set("dpop",a)}async prepareRequest(e,r){const n=await this.getAccessToken(r);let a,i;typeof n=="string"?(a=this.config.dpopNonceId?vr.DPoP:vr.Bearer,i=n):(a=n.token_type,i=n.access_token),this.setAuthorizationHeader(e,i,a),a===vr.DPoP&&await this.setDpopProofHeader(e,i)}getHeader(e,r){return Array.isArray(e)?new Headers(e).get(r)||"":typeof e.get=="function"?e.get(r)||"":e[r]||""}hasUseDpopNonceError(e){if(e.status!==401)return!1;const r=this.getHeader(e.headers,"www-authenticate");return r.includes("invalid_dpop_nonce")||r.includes("use_dpop_nonce")}async handleResponse(e,r){const n=this.getHeader(e.headers,"dpop-nonce");if(n&&await this.hooks.setDpopNonce(n),!this.hasUseDpopNonceError(e))return e;if(!n||!r.onUseDpopNonceError)throw new Vp(n);return r.onUseDpopNonceError()}async internalFetchWithAuth(e,r,n,a){const i=this.buildBaseRequest(e,r);await this.prepareRequest(i,a);const o=await this.config.fetch(i);return this.handleResponse(o,n)}fetchWithAuth(e,r,n){const a={onUseDpopNonceError:()=>this.internalFetchWithAuth(e,r,Object.assign(Object.assign({},a),{onUseDpopNonceError:void 0}),n)};return this.internalFetchWithAuth(e,r,a,n)}},Py=class{constructor(e,r){this.myAccountFetcher=e,this.apiBase=r}async connectAccount(e){const r=await this.myAccountFetcher.fetchWithAuth(`${this.apiBase}v1/connected-accounts/connect`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(r)}async completeAccount(e){const r=await this.myAccountFetcher.fetchWithAuth(`${this.apiBase}v1/connected-accounts/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(r)}async _handleResponse(e){let r;try{r=await e.text(),r=JSON.parse(r)}catch(n){throw new Md({type:"invalid_json",status:e.status,title:"Invalid JSON response",detail:r||String(n)})}if(e.ok)return r;throw new Md(r)}},Md=class nv extends Error{constructor({type:e,status:r,title:n,detail:a,validation_errors:i}){super(a),this.name="MyAccountApiError",this.type=e,this.status=r,this.title=n,this.detail=a,this.validation_errors=i,Object.setPrototypeOf(this,nv.prototype)}};const Nr=new Ng;class Ey{constructor(e){let r,n;if(this.userCache=new ev().enclosedCache,this.activeLockKeys=new Set,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},this._releaseLockOnPageHide=async()=>{const u=Array.from(this.activeLockKeys);for(const l of u)await Nr.releaseLock(l);this.activeLockKeys.clear(),window.removeEventListener("pagehide",this._releaseLockOnPageHide)},this.options=Object.assign(Object.assign(Object.assign({},this.defaultOptions),e),{authorizationParams:Object.assign(Object.assign({},this.defaultOptions.authorizationParams),e.authorizationParams)}),typeof window<"u"&&(()=>{if(!Ln())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(Ln().subtle===void 0)throw new Error(`
3
3
  auth0-spa-js must run on a secure origin. See https://github.com/auth0/auth0-spa-js/blob/main/FAQ.md#why-do-i-get-auth0-spa-js-must-run-on-a-secure-origin for more information.
4
- `)})(),e.cache&&e.cacheLocation&&console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."),e.cache)n=e.cache;else{if(r=e.cacheLocation||"memory",!Rd(r))throw new Error(`Invalid cache location "${r}"`);n=Rd(r)()}this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:1e4,this.cookieStorage=e.legacySameSiteCookie===!1?pr:Yg,this.orgHintCookieName=`auth0.${this.options.clientId}.organization_hint`,this.isAuthenticatedCookieName=(u=>`auth0.${u}.is.authenticated`)(this.options.clientId),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;const a=e.useCookiesForTransactions?this.cookieStorage:Xg;var i;this.scope=((u,l,...c)=>{if(typeof u!="object")return{default:En(l,u,...c)};let f={default:En(l,...c)};return Object.keys(u).forEach((h=>{const d=u[h];f[h]=En(l,d,...c)})),f})(this.options.authorizationParams.scope,"openid",this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new Wg(a,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||Pp,this.cacheManager=new Gg(n,n.allKeys?void 0:new ty(n,this.options.clientId),this.nowProvider),this.dpop=this.options.useDpop?new ay(this.options.clientId):void 0,this.domainUrl=(i=this.options.domain,/^https?:\/\//.test(i)?i:`https://${i}`),this.tokenIssuer=((u,l)=>u?u.startsWith("https://")?u:`https://${u}/`:`${l}/`)(this.options.issuer,this.domainUrl);const o=`${this.domainUrl}/me/`,s=this.createFetcher(Object.assign(Object.assign({},this.options.useDpop&&{dpopNonceId:"__auth0_my_account_api__"}),{getAccessToken:()=>this.getTokenSilently({authorizationParams:{scope:"create:me:connected_accounts",audience:o},detailedResponse:!0})}));this.myAccountApi=new oy(s,o),typeof window<"u"&&window.Worker&&this.options.useRefreshTokens&&r==="memory"&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new ey)}_url(e){const r=encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client||Ip)));return`${this.domainUrl}${e}&auth0Client=${r}`}_authorizeUrl(e){return this._url(`/authorize?${bs(e)}`)}async _verifyIdToken(e,r,n){const a=await this.nowProvider();return Jg({iss:this.tokenIssuer,aud:this.options.clientId,id_token:e,nonce:r,organization:n,leeway:this.options.leeway,max_age:(i=this.options.authorizationParams.max_age,typeof i!="string"?i:parseInt(i,10)||void 0),now:a});var i}_processOrgHint(e){e?this.cookieStorage.save(this.orgHintCookieName,e,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}async _prepareAuthorizeUrl(e,r,n){var a;const i=rs(qr()),o=rs(qr()),s=qr(),u=await bd(s),l=Id(u),c=await((a=this.dpop)===null||a===void 0?void 0:a.calculateThumbprint()),f=((d,p,v,g,P,b,y,m,w)=>Object.assign(Object.assign(Object.assign({client_id:d.clientId},d.authorizationParams),v),{scope:vn(p,v.scope,v.audience),response_type:"code",response_mode:m||"query",state:g,nonce:P,redirect_uri:y||d.authorizationParams.redirect_uri,code_challenge:b,code_challenge_method:"S256",dpop_jkt:w}))(this.options,this.scope,e,i,o,l,e.redirect_uri||this.options.authorizationParams.redirect_uri||n,r?.response_mode,c),h=this._authorizeUrl(f);return{nonce:o,code_verifier:s,scope:f.scope,audience:f.audience||"default",redirect_uri:f.redirect_uri,state:i,url:h}}async loginWithPopup(e,r){var n;if(e=e||{},!(r=r||{}).popup&&(r.popup=(s=>{const u=window.screenX+(window.innerWidth-400)/2,l=window.screenY+(window.innerHeight-600)/2;return window.open(s,"auth0:authorize:popup",`left=${u},top=${l},width=400,height=600,resizable,scrollbars=yes,status=1`)})(""),!r.popup))throw new kg;const a=await this._prepareAuthorizeUrl(e.authorizationParams||{},{response_mode:"web_message"},window.location.origin);r.popup.location.href=a.url;const i=await(s=>new Promise(((u,l)=>{let c;const f=setInterval((()=>{s.popup&&s.popup.closed&&(clearInterval(f),clearTimeout(h),window.removeEventListener("message",c,!1),l(new Eg(s.popup)))}),1e3),h=setTimeout((()=>{clearInterval(f),l(new nc(s.popup)),window.removeEventListener("message",c,!1)}),1e3*(s.timeoutInSeconds||60));c=function(d){if(d.data&&d.data.type==="authorization_response"){if(clearTimeout(h),clearInterval(f),window.removeEventListener("message",c,!1),s.closePopup!==!1&&s.popup.close(),d.data.response.error)return l(Pe.fromPayload(d.data.response));u(d.data.response)}},window.addEventListener("message",c)})))(Object.assign(Object.assign({},r),{timeoutInSeconds:r.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(a.state!==i.state)throw new Pe("state_mismatch","Invalid state");const o=((n=e.authorizationParams)===null||n===void 0?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:a.audience,scope:a.scope,code_verifier:a.code_verifier,grant_type:"authorization_code",code:i.code,redirect_uri:a.redirect_uri},{nonceIn:a.nonce,organization:o})}async getUser(){var e;const r=await this._getIdTokenFromCache();return(e=r?.decodedToken)===null||e===void 0?void 0:e.user}async getIdTokenClaims(){var e;const r=await this._getIdTokenFromCache();return(e=r?.decodedToken)===null||e===void 0?void 0:e.claims}async loginWithRedirect(e={}){var r;const n=Od(e),{openUrl:a,fragment:i,appState:o}=n,s=ct(n,["openUrl","fragment","appState"]),u=((r=s.authorizationParams)===null||r===void 0?void 0:r.organization)||this.options.authorizationParams.organization,l=await this._prepareAuthorizeUrl(s.authorizationParams||{}),{url:c}=l,f=ct(l,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},f),{appState:o,response_type:Mt.Code}),u&&{organization:u}));const h=i?`${c}#${i}`:c;a?await a(h):window.location.assign(h)}async handleRedirectCallback(e=window.location.href){const r=e.split("?").slice(1);if(r.length===0)throw new Error("There are no query params available for parsing.");const n=this.transactionManager.get();if(!n)throw new Pe("missing_transaction","Invalid state");this.transactionManager.remove();const a=(i=>{i.indexOf("#")>-1&&(i=i.substring(0,i.indexOf("#")));const o=new URLSearchParams(i);return{state:o.get("state"),code:o.get("code")||void 0,connect_code:o.get("connect_code")||void 0,error:o.get("error")||void 0,error_description:o.get("error_description")||void 0}})(r.join(""));return n.response_type===Mt.ConnectCode?this._handleConnectAccountRedirectCallback(a,n):this._handleLoginRedirectCallback(a,n)}async _handleLoginRedirectCallback(e,r){const{code:n,state:a,error:i,error_description:o}=e;if(i)throw new Ig(i,o||i,a,r.appState);if(!r.code_verifier||r.state&&r.state!==a)throw new Pe("state_mismatch","Invalid state");const s=r.organization,u=r.nonce,l=r.redirect_uri;return await this._requestToken(Object.assign({audience:r.audience,scope:r.scope,code_verifier:r.code_verifier,grant_type:"authorization_code",code:n},l?{redirect_uri:l}:{}),{nonceIn:u,organization:s}),{appState:r.appState,response_type:Mt.Code}}async _handleConnectAccountRedirectCallback(e,r){const{connect_code:n,state:a,error:i,error_description:o}=e;if(i)throw new Pg(i,o||i,r.connection,a,r.appState);if(!n)throw new Pe("missing_connect_code","Missing connect code");if(!(r.code_verifier&&r.state&&r.auth_session&&r.redirect_uri&&r.state===a))throw new Pe("state_mismatch","Invalid state");const s=await this.myAccountApi.completeAccount({auth_session:r.auth_session,connect_code:n,redirect_uri:r.redirect_uri,code_verifier:r.code_verifier});return Object.assign(Object.assign({},s),{appState:r.appState,response_type:Mt.ConnectCode})}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get("auth0.is.authenticated"))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove("auth0.is.authenticated")}try{await this.getTokenSilently(e)}catch{}}async getTokenSilently(e={}){var r,n;const a=Object.assign(Object.assign({cacheMode:"on"},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:vn(this.scope,(r=e.authorizationParams)===null||r===void 0?void 0:r.scope,((n=e.authorizationParams)===null||n===void 0?void 0:n.audience)||this.options.authorizationParams.audience)})}),i=await((o,s)=>{let u=as[s];return u||(u=o().finally((()=>{delete as[s],u=null})),as[s]=u),u})((()=>this._getTokenSilently(a)),`${this.options.clientId}::${a.authorizationParams.audience}::${a.authorizationParams.scope}`);return e.detailedResponse?i:i?.access_token}async _getTokenSilently(e){const{cacheMode:r}=e,n=ct(e,["cacheMode"]);if(r!=="off"){const s=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId,cacheMode:r});if(s)return s}if(r==="cache-only")return;const a=(i=this.options.clientId,o=n.authorizationParams.audience||"default",`auth0.lock.getTokenSilently.${i}.${o}`);var i,o;if(!await Td((()=>xr.acquireLock(a,5e3)),10))throw new Pn;this.activeLockKeys.add(a),this.activeLockKeys.size===1&&window.addEventListener("pagehide",this._releaseLockOnPageHide);try{if(r!=="off"){const d=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId});if(d)return d}const s=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),{id_token:u,token_type:l,access_token:c,oauthTokenScope:f,expires_in:h}=s;return Object.assign(Object.assign({id_token:u,token_type:l,access_token:c},f?{scope:f}:null),{expires_in:h})}finally{await xr.releaseLock(a),this.activeLockKeys.delete(a),this.activeLockKeys.size===0&&window.removeEventListener("pagehide",this._releaseLockOnPageHide)}}async getTokenWithPopup(e={},r={}){var n,a;const i=Object.assign(Object.assign({},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:vn(this.scope,(n=e.authorizationParams)===null||n===void 0?void 0:n.scope,((a=e.authorizationParams)===null||a===void 0?void 0:a.audience)||this.options.authorizationParams.audience)})});return r=Object.assign(Object.assign({},Sg),r),await this.loginWithPopup(i,r),(await this.cacheManager.get(new vt({scope:i.authorizationParams.scope,audience:i.authorizationParams.audience||"default",clientId:this.options.clientId}),void 0,this.options.useMrrt)).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(e){e.clientId!==null?e.clientId=e.clientId||this.options.clientId:delete e.clientId;const r=e.logoutParams||{},{federated:n}=r,a=ct(r,["federated"]),i=n?"&federated":"";return this._url(`/v2/logout?${bs(Object.assign({clientId:e.clientId},a))}`)+i}async logout(e={}){var r;const n=Od(e),{openUrl:a}=n,i=ct(n,["openUrl"]);e.clientId===null?await this.cacheManager.clear():await this.cacheManager.clear(e.clientId||this.options.clientId),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove("@@user@@"),await((r=this.dpop)===null||r===void 0?void 0:r.clear());const o=this._buildLogoutUrl(i);a?await a(o):a!==!1&&window.location.assign(o)}async _getTokenFromIFrame(e){const r=`auth0.lock.getTokenFromIFrame.${this.options.clientId}`;if(!await Td((()=>xr.acquireLock(r,5e3)),10))throw new Pn;try{const n=Object.assign(Object.assign({},e.authorizationParams),{prompt:"none"}),a=this.cookieStorage.get(this.orgHintCookieName);a&&!n.organization&&(n.organization=a);const{url:i,state:o,nonce:s,code_verifier:u,redirect_uri:l,scope:c,audience:f}=await this._prepareAuthorizeUrl(n,{response_mode:"web_message"},window.location.origin);if(window.crossOriginIsolated)throw new Pe("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const h=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds;let d;try{d=new URL(this.domainUrl).origin}catch{d=this.domainUrl}const p=await((g,P,b=60)=>new Promise(((y,m)=>{const w=window.document.createElement("iframe");w.setAttribute("width","0"),w.setAttribute("height","0"),w.style.display="none";const R=()=>{window.document.body.contains(w)&&(window.document.body.removeChild(w),window.removeEventListener("message",A,!1))};let A;const j=setTimeout((()=>{m(new Pn),R()}),1e3*b);A=function(K){if(K.origin!=P||!K.data||K.data.type!=="authorization_response")return;const B=K.source;B&&B.close(),K.data.response.error?m(Pe.fromPayload(K.data.response)):y(K.data.response),clearTimeout(j),window.removeEventListener("message",A,!1),setTimeout(R,2e3)},window.addEventListener("message",A,!1),window.document.body.appendChild(w),w.setAttribute("src",g)})))(i,d,h);if(o!==p.state)throw new Pe("state_mismatch","Invalid state");const v=await this._requestToken(Object.assign(Object.assign({},e.authorizationParams),{code_verifier:u,code:p.code,grant_type:"authorization_code",redirect_uri:l,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:s,organization:n.organization});return Object.assign(Object.assign({},v),{scope:c,oauthTokenScope:v.scope,audience:f})}catch(n){throw n.error==="login_required"&&this.logout({openUrl:!1}),n}finally{await xr.releaseLock(r)}}async _getTokenUsingRefreshToken(e){const r=await this.cacheManager.get(new vt({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||"default",clientId:this.options.clientId}),void 0,this.options.useMrrt);if(!(r&&r.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new Cp(e.authorizationParams.audience||"default",e.authorizationParams.scope)}const n=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,a=typeof e.timeoutInSeconds=="number"?1e3*e.timeoutInSeconds:null,i=((c,f,h,d)=>{var p;if(c&&h&&d){if(f.audience!==h)return f.scope;const v=d.split(" "),g=((p=f.scope)===null||p===void 0?void 0:p.split(" "))||[],P=g.every((b=>v.includes(b)));return v.length>=g.length&&P?d:f.scope}return f.scope})(this.options.useMrrt,e.authorizationParams,r?.audience,r?.scope);try{const c=await this._requestToken(Object.assign(Object.assign(Object.assign({},e.authorizationParams),{grant_type:"refresh_token",refresh_token:r&&r.refresh_token,redirect_uri:n}),a&&{timeout:a}),{scopesToRequest:i});if(c.refresh_token&&r?.refresh_token&&await this.cacheManager.updateEntry(r.refresh_token,c.refresh_token),this.options.useMrrt&&(o=r?.audience,s=r?.scope,u=e.authorizationParams.audience,l=e.authorizationParams.scope,(o!==u||!Cd(l,s))&&!Cd(i,c.scope))){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);await this.cacheManager.remove(this.options.clientId,e.authorizationParams.audience,e.authorizationParams.scope);const f=((h,d)=>{const p=h?.split(" ")||[],v=d?.split(" ")||[];return p.filter((g=>v.indexOf(g)==-1)).join(",")})(i,c.scope);throw new Tg(e.authorizationParams.audience||"default",f)}return Object.assign(Object.assign({},c),{scope:e.authorizationParams.scope,oauthTokenScope:c.scope,audience:e.authorizationParams.audience||"default"})}catch(c){if((c.message.indexOf("Missing Refresh Token")>-1||c.message&&c.message.indexOf("invalid refresh token")>-1)&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw c}var o,s,u,l}async _saveEntryInCache(e){const{id_token:r,decodedToken:n}=e,a=ct(e,["id_token","decodedToken"]);this.userCache.set("@@user@@",{id_token:r,decodedToken:n}),await this.cacheManager.setIdToken(this.options.clientId,e.id_token,e.decodedToken),await this.cacheManager.set(a)}async _getIdTokenFromCache(){const e=this.options.authorizationParams.audience||"default",r=this.scope[e],n=await this.cacheManager.getIdToken(new vt({clientId:this.options.clientId,audience:e,scope:r})),a=this.userCache.get("@@user@@");return n&&n.id_token===a?.id_token?a:(this.userCache.set("@@user@@",n),n)}async _getEntryFromCache({scope:e,audience:r,clientId:n,cacheMode:a}){const i=await this.cacheManager.get(new vt({scope:e,audience:r,clientId:n}),60,this.options.useMrrt,a);if(i&&i.access_token){const{token_type:o,access_token:s,oauthTokenScope:u,expires_in:l}=i,c=await this._getIdTokenFromCache();return c&&Object.assign(Object.assign({id_token:c.id_token,token_type:o||"Bearer",access_token:s},u?{scope:u}:null),{expires_in:l})}}async _requestToken(e,r){var n,a;const{nonceIn:i,organization:o,scopesToRequest:s}=r||{},u=await Hg(Object.assign(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs,useMrrt:this.options.useMrrt,dpop:this.dpop},e),{scope:s||e.scope}),this.worker),l=await this._verifyIdToken(u.id_token,i,o);if(e.grant_type==="authorization_code"){const c=await this._getIdTokenFromCache();!((a=(n=c?.decodedToken)===null||n===void 0?void 0:n.claims)===null||a===void 0)&&a.sub&&c.decodedToken.claims.sub!==l.claims.sub&&(await this.cacheManager.clear(this.options.clientId),this.userCache.remove("@@user@@"))}return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},u),{decodedToken:l,scope:e.scope,audience:e.audience||"default"}),u.scope?{oauthTokenScope:u.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(o||l.claims.org_id),Object.assign(Object.assign({},u),{decodedToken:l})}async exchangeToken(e){return this._requestToken({grant_type:"urn:ietf:params:oauth:grant-type:token-exchange",subject_token:e.subject_token,subject_token_type:e.subject_token_type,scope:vn(this.scope,e.scope,e.audience||this.options.authorizationParams.audience),audience:e.audience||this.options.authorizationParams.audience,organization:e.organization||this.options.authorizationParams.organization})}_assertDpop(e){if(!e)throw new Error("`useDpop` option must be enabled before using DPoP.")}getDpopNonce(e){return this._assertDpop(this.dpop),this.dpop.getNonce(e)}setDpopNonce(e,r){return this._assertDpop(this.dpop),this.dpop.setNonce(e,r)}generateDpopProof(e){return this._assertDpop(this.dpop),this.dpop.generateProof(e)}createFetcher(e={}){return new iy(e,{isDpopEnabled:()=>!!this.options.useDpop,getAccessToken:r=>{var n;return this.getTokenSilently({authorizationParams:{scope:(n=r?.scope)===null||n===void 0?void 0:n.join(" "),audience:r?.audience},detailedResponse:!0})},getDpopNonce:()=>this.getDpopNonce(e.dpopNonceId),setDpopNonce:r=>this.setDpopNonce(r,e.dpopNonceId),generateDpopProof:r=>this.generateDpopProof(r)})}async connectAccountWithRedirect(e){const{openUrl:r,appState:n,connection:a,scopes:i,authorization_params:o,redirectUri:s=this.options.authorizationParams.redirect_uri||window.location.origin}=e;if(!a)throw new Error("connection is required");const u=rs(qr()),l=qr(),c=await bd(l),f=Id(c),{connect_uri:h,connect_params:d,auth_session:p}=await this.myAccountApi.connectAccount({connection:a,scopes:i,redirect_uri:s,state:u,code_challenge:f,code_challenge_method:"S256",authorization_params:o});this.transactionManager.create({state:u,code_verifier:l,auth_session:p,redirect_uri:s,appState:n,connection:a,response_type:Mt.ConnectCode});const v=new URL(h);v.searchParams.set("ticket",d.ticket),r?await r(v.toString()):window.location.assign(v)}}async function cy(t){const e=new sy(t);return await e.checkSession(),e}var Ge=(t=>(t.AUTH_INITIALIZED="sesamyJsAuthInitialized",t.READY="sesamyJsReady",t.AUTHENTICATED="sesamyJsAuthenticated",t.LOGOUT="sesamyJsLogout",t.CLEAR_CACHE="sesamyJsClearCache",t.USER_ATTRIBUTE_CHANGED="sesamyUserAttributeChanged",t.PURCHASE="sesamyJsPurchase",t))(Ge||{});const uy="sesamy.com",ly="sesamy.dev",fy="https://sesa.my",$d="sesamyCacheTimestamp",Ud="sesamyContentReloaded";function zp(t,e){return`${t}.${e==="dev"?ly:uy}`}function rt(t,e){return`https://${zp(t,e)}`}function Yr(){let e=(document.documentElement.getAttribute("lang")??navigator.language??"en").split("-")[0]?.toLowerCase()??"en";return e==="nn"&&(e="nb"),e}/*!
4
+ `)})(),e.cache&&e.cacheLocation&&console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."),e.cache)n=e.cache;else{if(r=e.cacheLocation||"memory",!Nd(r))throw new Error(`Invalid cache location "${r}"`);n=Nd(r)()}this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:1e4,this.cookieStorage=e.legacySameSiteCookie===!1?pr:py,this.orgHintCookieName=`auth0.${this.options.clientId}.organization_hint`,this.isAuthenticatedCookieName=(u=>`auth0.${u}.is.authenticated`)(this.options.clientId),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;const a=e.useCookiesForTransactions?this.cookieStorage:vy;var i;this.scope=((u,l,...c)=>{if(typeof u!="object")return{default:En(l,u,...c)};let f={default:En(l,...c)};return Object.keys(u).forEach((h=>{const d=u[h];f[h]=En(l,d,...c)})),f})(this.options.authorizationParams.scope,"openid",this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new ly(a,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||jp,this.cacheManager=new uy(n,n.allKeys?void 0:new yy(n,this.options.clientId),this.nowProvider),this.dpop=this.options.useDpop?new Sy(this.options.clientId):void 0,this.domainUrl=(i=this.options.domain,/^https?:\/\//.test(i)?i:`https://${i}`),this.tokenIssuer=((u,l)=>u?u.startsWith("https://")?u:`https://${u}/`:`${l}/`)(this.options.issuer,this.domainUrl);const o=`${this.domainUrl}/me/`,s=this.createFetcher(Object.assign(Object.assign({},this.options.useDpop&&{dpopNonceId:"__auth0_my_account_api__"}),{getAccessToken:()=>this.getTokenSilently({authorizationParams:{scope:"create:me:connected_accounts",audience:o},detailedResponse:!0})}));this.myAccountApi=new Py(s,o),typeof window<"u"&&window.Worker&&this.options.useRefreshTokens&&r==="memory"&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new gy)}_url(e){const r=encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client||Np)));return`${this.domainUrl}${e}&auth0Client=${r}`}_authorizeUrl(e){return this._url(`/authorize?${Es(e)}`)}async _verifyIdToken(e,r,n){const a=await this.nowProvider();return dy({iss:this.tokenIssuer,aud:this.options.clientId,id_token:e,nonce:r,organization:n,leeway:this.options.leeway,max_age:(i=this.options.authorizationParams.max_age,typeof i!="string"?i:parseInt(i,10)||void 0),now:a});var i}_processOrgHint(e){e?this.cookieStorage.save(this.orgHintCookieName,e,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}async _prepareAuthorizeUrl(e,r,n){var a;const i=as(xr()),o=as(xr()),s=xr(),u=await Od(s),l=Ad(u),c=await((a=this.dpop)===null||a===void 0?void 0:a.calculateThumbprint()),f=((d,p,v,g,P,b,y,m,w)=>Object.assign(Object.assign(Object.assign({client_id:d.clientId},d.authorizationParams),v),{scope:vn(p,v.scope,v.audience),response_type:"code",response_mode:m||"query",state:g,nonce:P,redirect_uri:y||d.authorizationParams.redirect_uri,code_challenge:b,code_challenge_method:"S256",dpop_jkt:w}))(this.options,this.scope,e,i,o,l,e.redirect_uri||this.options.authorizationParams.redirect_uri||n,r?.response_mode,c),h=this._authorizeUrl(f);return{nonce:o,code_verifier:s,scope:f.scope,audience:f.audience||"default",redirect_uri:f.redirect_uri,state:i,url:h}}async loginWithPopup(e,r){var n;if(e=e||{},!(r=r||{}).popup&&(r.popup=(s=>{const u=window.screenX+(window.innerWidth-400)/2,l=window.screenY+(window.innerHeight-600)/2;return window.open(s,"auth0:authorize:popup",`left=${u},top=${l},width=400,height=600,resizable,scrollbars=yes,status=1`)})(""),!r.popup))throw new Bg;const a=await this._prepareAuthorizeUrl(e.authorizationParams||{},{response_mode:"web_message"},window.location.origin);r.popup.location.href=a.url;const i=await(s=>new Promise(((u,l)=>{let c;const f=setInterval((()=>{s.popup&&s.popup.closed&&(clearInterval(f),clearTimeout(h),window.removeEventListener("message",c,!1),l(new Fg(s.popup)))}),1e3),h=setTimeout((()=>{clearInterval(f),l(new dc(s.popup)),window.removeEventListener("message",c,!1)}),1e3*(s.timeoutInSeconds||60));c=function(d){if(d.data&&d.data.type==="authorization_response"){if(clearTimeout(h),clearInterval(f),window.removeEventListener("message",c,!1),s.closePopup!==!1&&s.popup.close(),d.data.response.error)return l(Pe.fromPayload(d.data.response));u(d.data.response)}},window.addEventListener("message",c)})))(Object.assign(Object.assign({},r),{timeoutInSeconds:r.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(a.state!==i.state)throw new Pe("state_mismatch","Invalid state");const o=((n=e.authorizationParams)===null||n===void 0?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:a.audience,scope:a.scope,code_verifier:a.code_verifier,grant_type:"authorization_code",code:i.code,redirect_uri:a.redirect_uri},{nonceIn:a.nonce,organization:o})}async getUser(){var e;const r=await this._getIdTokenFromCache();return(e=r?.decodedToken)===null||e===void 0?void 0:e.user}async getIdTokenClaims(){var e;const r=await this._getIdTokenFromCache();return(e=r?.decodedToken)===null||e===void 0?void 0:e.claims}async loginWithRedirect(e={}){var r;const n=jd(e),{openUrl:a,fragment:i,appState:o}=n,s=ct(n,["openUrl","fragment","appState"]),u=((r=s.authorizationParams)===null||r===void 0?void 0:r.organization)||this.options.authorizationParams.organization,l=await this._prepareAuthorizeUrl(s.authorizationParams||{}),{url:c}=l,f=ct(l,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},f),{appState:o,response_type:Mt.Code}),u&&{organization:u}));const h=i?`${c}#${i}`:c;a?await a(h):window.location.assign(h)}async handleRedirectCallback(e=window.location.href){const r=e.split("?").slice(1);if(r.length===0)throw new Error("There are no query params available for parsing.");const n=this.transactionManager.get();if(!n)throw new Pe("missing_transaction","Invalid state");this.transactionManager.remove();const a=(i=>{i.indexOf("#")>-1&&(i=i.substring(0,i.indexOf("#")));const o=new URLSearchParams(i);return{state:o.get("state"),code:o.get("code")||void 0,connect_code:o.get("connect_code")||void 0,error:o.get("error")||void 0,error_description:o.get("error_description")||void 0}})(r.join(""));return n.response_type===Mt.ConnectCode?this._handleConnectAccountRedirectCallback(a,n):this._handleLoginRedirectCallback(a,n)}async _handleLoginRedirectCallback(e,r){const{code:n,state:a,error:i,error_description:o}=e;if(i)throw new Dg(i,o||i,a,r.appState);if(!r.code_verifier||r.state&&r.state!==a)throw new Pe("state_mismatch","Invalid state");const s=r.organization,u=r.nonce,l=r.redirect_uri;return await this._requestToken(Object.assign({audience:r.audience,scope:r.scope,code_verifier:r.code_verifier,grant_type:"authorization_code",code:n},l?{redirect_uri:l}:{}),{nonceIn:u,organization:s}),{appState:r.appState,response_type:Mt.Code}}async _handleConnectAccountRedirectCallback(e,r){const{connect_code:n,state:a,error:i,error_description:o}=e;if(i)throw new Mg(i,o||i,r.connection,a,r.appState);if(!n)throw new Pe("missing_connect_code","Missing connect code");if(!(r.code_verifier&&r.state&&r.auth_session&&r.redirect_uri&&r.state===a))throw new Pe("state_mismatch","Invalid state");const s=await this.myAccountApi.completeAccount({auth_session:r.auth_session,connect_code:n,redirect_uri:r.redirect_uri,code_verifier:r.code_verifier});return Object.assign(Object.assign({},s),{appState:r.appState,response_type:Mt.ConnectCode})}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get("auth0.is.authenticated"))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove("auth0.is.authenticated")}try{await this.getTokenSilently(e)}catch{}}async getTokenSilently(e={}){var r,n;const a=Object.assign(Object.assign({cacheMode:"on"},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:vn(this.scope,(r=e.authorizationParams)===null||r===void 0?void 0:r.scope,((n=e.authorizationParams)===null||n===void 0?void 0:n.audience)||this.options.authorizationParams.audience)})}),i=await((o,s)=>{let u=os[s];return u||(u=o().finally((()=>{delete os[s],u=null})),os[s]=u),u})((()=>this._getTokenSilently(a)),`${this.options.clientId}::${a.authorizationParams.audience}::${a.authorizationParams.scope}`);return e.detailedResponse?i:i?.access_token}async _getTokenSilently(e){const{cacheMode:r}=e,n=ct(e,["cacheMode"]);if(r!=="off"){const s=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId,cacheMode:r});if(s)return s}if(r==="cache-only")return;const a=(i=this.options.clientId,o=n.authorizationParams.audience||"default",`auth0.lock.getTokenSilently.${i}.${o}`);var i,o;if(!await qd((()=>Nr.acquireLock(a,5e3)),10))throw new Pn;this.activeLockKeys.add(a),this.activeLockKeys.size===1&&window.addEventListener("pagehide",this._releaseLockOnPageHide);try{if(r!=="off"){const d=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId});if(d)return d}const s=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),{id_token:u,token_type:l,access_token:c,oauthTokenScope:f,expires_in:h}=s;return Object.assign(Object.assign({id_token:u,token_type:l,access_token:c},f?{scope:f}:null),{expires_in:h})}finally{await Nr.releaseLock(a),this.activeLockKeys.delete(a),this.activeLockKeys.size===0&&window.removeEventListener("pagehide",this._releaseLockOnPageHide)}}async getTokenWithPopup(e={},r={}){var n,a;const i=Object.assign(Object.assign({},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:vn(this.scope,(n=e.authorizationParams)===null||n===void 0?void 0:n.scope,((a=e.authorizationParams)===null||a===void 0?void 0:a.audience)||this.options.authorizationParams.audience)})});return r=Object.assign(Object.assign({},jg),r),await this.loginWithPopup(i,r),(await this.cacheManager.get(new vt({scope:i.authorizationParams.scope,audience:i.authorizationParams.audience||"default",clientId:this.options.clientId}),void 0,this.options.useMrrt)).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(e){e.clientId!==null?e.clientId=e.clientId||this.options.clientId:delete e.clientId;const r=e.logoutParams||{},{federated:n}=r,a=ct(r,["federated"]),i=n?"&federated":"";return this._url(`/v2/logout?${Es(Object.assign({clientId:e.clientId},a))}`)+i}async logout(e={}){var r;const n=jd(e),{openUrl:a}=n,i=ct(n,["openUrl"]);e.clientId===null?await this.cacheManager.clear():await this.cacheManager.clear(e.clientId||this.options.clientId),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove("@@user@@"),await((r=this.dpop)===null||r===void 0?void 0:r.clear());const o=this._buildLogoutUrl(i);a?await a(o):a!==!1&&window.location.assign(o)}async _getTokenFromIFrame(e){const r=`auth0.lock.getTokenFromIFrame.${this.options.clientId}`;if(!await qd((()=>Nr.acquireLock(r,5e3)),10))throw new Pn;try{const n=Object.assign(Object.assign({},e.authorizationParams),{prompt:"none"}),a=this.cookieStorage.get(this.orgHintCookieName);a&&!n.organization&&(n.organization=a);const{url:i,state:o,nonce:s,code_verifier:u,redirect_uri:l,scope:c,audience:f}=await this._prepareAuthorizeUrl(n,{response_mode:"web_message"},window.location.origin);if(window.crossOriginIsolated)throw new Pe("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const h=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds;let d;try{d=new URL(this.domainUrl).origin}catch{d=this.domainUrl}const p=await((g,P,b=60)=>new Promise(((y,m)=>{const w=window.document.createElement("iframe");w.setAttribute("width","0"),w.setAttribute("height","0"),w.style.display="none";const R=()=>{window.document.body.contains(w)&&(window.document.body.removeChild(w),window.removeEventListener("message",A,!1))};let A;const j=setTimeout((()=>{m(new Pn),R()}),1e3*b);A=function(B){if(B.origin!=P||!B.data||B.data.type!=="authorization_response")return;const W=B.source;W&&W.close(),B.data.response.error?m(Pe.fromPayload(B.data.response)):y(B.data.response),clearTimeout(j),window.removeEventListener("message",A,!1),setTimeout(R,2e3)},window.addEventListener("message",A,!1),window.document.body.appendChild(w),w.setAttribute("src",g)})))(i,d,h);if(o!==p.state)throw new Pe("state_mismatch","Invalid state");const v=await this._requestToken(Object.assign(Object.assign({},e.authorizationParams),{code_verifier:u,code:p.code,grant_type:"authorization_code",redirect_uri:l,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:s,organization:n.organization});return Object.assign(Object.assign({},v),{scope:c,oauthTokenScope:v.scope,audience:f})}catch(n){throw n.error==="login_required"&&this.logout({openUrl:!1}),n}finally{await Nr.releaseLock(r)}}async _getTokenUsingRefreshToken(e){const r=await this.cacheManager.get(new vt({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||"default",clientId:this.options.clientId}),void 0,this.options.useMrrt);if(!(r&&r.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new Hp(e.authorizationParams.audience||"default",e.authorizationParams.scope)}const n=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,a=typeof e.timeoutInSeconds=="number"?1e3*e.timeoutInSeconds:null,i=((c,f,h,d)=>{var p;if(c&&h&&d){if(f.audience!==h)return f.scope;const v=d.split(" "),g=((p=f.scope)===null||p===void 0?void 0:p.split(" "))||[],P=g.every((b=>v.includes(b)));return v.length>=g.length&&P?d:f.scope}return f.scope})(this.options.useMrrt,e.authorizationParams,r?.audience,r?.scope);try{const c=await this._requestToken(Object.assign(Object.assign(Object.assign({},e.authorizationParams),{grant_type:"refresh_token",refresh_token:r&&r.refresh_token,redirect_uri:n}),a&&{timeout:a}),{scopesToRequest:i});if(c.refresh_token&&r?.refresh_token&&await this.cacheManager.updateEntry(r.refresh_token,c.refresh_token),this.options.useMrrt&&(o=r?.audience,s=r?.scope,u=e.authorizationParams.audience,l=e.authorizationParams.scope,(o!==u||!Dd(l,s))&&!Dd(i,c.scope))){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);await this.cacheManager.remove(this.options.clientId,e.authorizationParams.audience,e.authorizationParams.scope);const f=((h,d)=>{const p=h?.split(" ")||[],v=d?.split(" ")||[];return p.filter((g=>v.indexOf(g)==-1)).join(",")})(i,c.scope);throw new zg(e.authorizationParams.audience||"default",f)}return Object.assign(Object.assign({},c),{scope:e.authorizationParams.scope,oauthTokenScope:c.scope,audience:e.authorizationParams.audience||"default"})}catch(c){if((c.message.indexOf("Missing Refresh Token")>-1||c.message&&c.message.indexOf("invalid refresh token")>-1)&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw c}var o,s,u,l}async _saveEntryInCache(e){const{id_token:r,decodedToken:n}=e,a=ct(e,["id_token","decodedToken"]);this.userCache.set("@@user@@",{id_token:r,decodedToken:n}),await this.cacheManager.setIdToken(this.options.clientId,e.id_token,e.decodedToken),await this.cacheManager.set(a)}async _getIdTokenFromCache(){const e=this.options.authorizationParams.audience||"default",r=this.scope[e],n=await this.cacheManager.getIdToken(new vt({clientId:this.options.clientId,audience:e,scope:r})),a=this.userCache.get("@@user@@");return n&&n.id_token===a?.id_token?a:(this.userCache.set("@@user@@",n),n)}async _getEntryFromCache({scope:e,audience:r,clientId:n,cacheMode:a}){const i=await this.cacheManager.get(new vt({scope:e,audience:r,clientId:n}),60,this.options.useMrrt,a);if(i&&i.access_token){const{token_type:o,access_token:s,oauthTokenScope:u,expires_in:l}=i,c=await this._getIdTokenFromCache();return c&&Object.assign(Object.assign({id_token:c.id_token,token_type:o||"Bearer",access_token:s},u?{scope:u}:null),{expires_in:l})}}async _requestToken(e,r){var n,a;const{nonceIn:i,organization:o,scopesToRequest:s}=r||{},u=await sy(Object.assign(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs,useMrrt:this.options.useMrrt,dpop:this.dpop},e),{scope:s||e.scope}),this.worker),l=await this._verifyIdToken(u.id_token,i,o);if(e.grant_type==="authorization_code"){const c=await this._getIdTokenFromCache();!((a=(n=c?.decodedToken)===null||n===void 0?void 0:n.claims)===null||a===void 0)&&a.sub&&c.decodedToken.claims.sub!==l.claims.sub&&(await this.cacheManager.clear(this.options.clientId),this.userCache.remove("@@user@@"))}return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},u),{decodedToken:l,scope:e.scope,audience:e.audience||"default"}),u.scope?{oauthTokenScope:u.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(o||l.claims.org_id),Object.assign(Object.assign({},u),{decodedToken:l})}async exchangeToken(e){return this._requestToken({grant_type:"urn:ietf:params:oauth:grant-type:token-exchange",subject_token:e.subject_token,subject_token_type:e.subject_token_type,scope:vn(this.scope,e.scope,e.audience||this.options.authorizationParams.audience),audience:e.audience||this.options.authorizationParams.audience,organization:e.organization||this.options.authorizationParams.organization})}_assertDpop(e){if(!e)throw new Error("`useDpop` option must be enabled before using DPoP.")}getDpopNonce(e){return this._assertDpop(this.dpop),this.dpop.getNonce(e)}setDpopNonce(e,r){return this._assertDpop(this.dpop),this.dpop.setNonce(e,r)}generateDpopProof(e){return this._assertDpop(this.dpop),this.dpop.generateProof(e)}createFetcher(e={}){return new Iy(e,{isDpopEnabled:()=>!!this.options.useDpop,getAccessToken:r=>{var n;return this.getTokenSilently({authorizationParams:{scope:(n=r?.scope)===null||n===void 0?void 0:n.join(" "),audience:r?.audience},detailedResponse:!0})},getDpopNonce:()=>this.getDpopNonce(e.dpopNonceId),setDpopNonce:r=>this.setDpopNonce(r,e.dpopNonceId),generateDpopProof:r=>this.generateDpopProof(r)})}async connectAccountWithRedirect(e){const{openUrl:r,appState:n,connection:a,scopes:i,authorization_params:o,redirectUri:s=this.options.authorizationParams.redirect_uri||window.location.origin}=e;if(!a)throw new Error("connection is required");const u=as(xr()),l=xr(),c=await Od(l),f=Ad(c),{connect_uri:h,connect_params:d,auth_session:p}=await this.myAccountApi.connectAccount({connection:a,scopes:i,redirect_uri:s,state:u,code_challenge:f,code_challenge_method:"S256",authorization_params:o});this.transactionManager.create({state:u,code_verifier:l,auth_session:p,redirect_uri:s,appState:n,connection:a,response_type:Mt.ConnectCode});const v=new URL(h);v.searchParams.set("ticket",d.ticket),r?await r(v.toString()):window.location.assign(v)}}async function ky(t){const e=new Ey(t);return await e.checkSession(),e}var We=(t=>(t.AUTH_INITIALIZED="sesamyJsAuthInitialized",t.READY="sesamyJsReady",t.AUTHENTICATED="sesamyJsAuthenticated",t.LOGOUT="sesamyJsLogout",t.CLEAR_CACHE="sesamyJsClearCache",t.USER_ATTRIBUTE_CHANGED="sesamyUserAttributeChanged",t.PURCHASE="sesamyJsPurchase",t))(We||{});const Ty="sesamy.com",_y="sesamy.dev",Ry="https://sesa.my",Fd="sesamyCacheTimestamp",Bd="sesamyContentReloaded";function av(t,e){return`${t}.${e==="dev"?_y:Ty}`}function rt(t,e){return`https://${av(t,e)}`}function Yr(){let e=(document.documentElement.getAttribute("lang")??navigator.language??"en").split("-")[0]?.toLowerCase()??"en";return e==="nn"&&(e="nb"),e}/*!
5
5
  *
6
6
  * detectIncognito v1.6.2
7
7
  *
@@ -31,9 +31,9 @@
31
31
  *
32
32
  * Please keep this comment intact in order to properly abide by the MIT License.
33
33
  *
34
- **/var Ps={d:(t,e)=>{for(var r in e)Ps.o(e,r)&&!Ps.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},ac={};Ps.d(ac,{A:()=>dy,k:()=>ic});var jr=function(t,e,r,n){return new(r||(r=Promise))(function(a,i){function o(l){try{u(n.next(l))}catch(c){i(c)}}function s(l){try{u(n.throw(l))}catch(c){i(c)}}function u(l){var c;l.done?a(l.value):(c=l.value,c instanceof r?c:new r(function(f){f(c)})).then(o,s)}u((n=n.apply(t,[])).next())})},Dr=function(t,e){var r,n,a,i,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(u){return function(l){return(function(c){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&c[0]?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,n=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(a=o.trys,!((a=a.length>0&&a[a.length-1])||c[0]!==6&&c[0]!==2)){o=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(c[0]===6&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=e.call(t,o)}catch(f){c=[6,f],n=0}finally{r=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}})([u,l])}}};function ic(){return jr(this,void 0,Promise,function(){return Dr(this,function(t){switch(t.label){case 0:return[4,new Promise(function(e,r){var n="Unknown",a=!1;function i(h){a||(a=!0,e({isPrivate:h,browserName:n}))}function o(){var h=0,d=parseInt("-1");try{d.toFixed(d)}catch(p){h=p.message.length}return h}function s(){return jr(this,void 0,void 0,function(){var h,d;return Dr(this,function(p){switch(p.label){case 0:return p.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return p.sent(),i(!1),[3,3];case 2:return h=p.sent(),d=h instanceof Error&&typeof h.message=="string"?h.message:String(h),i(d.includes("unknown transient reason")),[3,3];case 3:return[2]}})})}function u(){var h;return jr(this,void 0,Promise,function(){return Dr(this,function(d){switch(d.label){case 0:return typeof((h=navigator.storage)===null||h===void 0?void 0:h.getDirectory)!="function"?[3,2]:[4,s()];case 1:return d.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?(function(){var p=String(Math.random());try{var v=indexedDB.open(p,1);v.onupgradeneeded=function(g){var P=g.target.result,b=function(y){i(y)};try{P.createObjectStore("t",{autoIncrement:!0}).put(new Blob),b(!1)}catch(y){(y instanceof Error&&typeof y.message=="string"?y.message:String(y)).includes("are not yet supported")?b(!0):b(!1)}finally{P.close(),indexedDB.deleteDatabase(p)}},v.onerror=function(){return i(!1)}}catch{i(!1)}})():(function(){var p=window.openDatabase,v=window.localStorage;try{p(null,null,null,null)}catch{return void i(!0)}try{v.setItem("test","1"),v.removeItem("test")}catch{return void i(!0)}i(!1)})(),d.label=3;case 3:return[2]}})})}function l(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(h,d){var p=Math.round(d/1048576),v=2*Math.round((function(){var g,P,b,y=window;return(b=(P=(g=y?.performance)===null||g===void 0?void 0:g.memory)===null||P===void 0?void 0:P.jsHeapSizeLimit)!==null&&b!==void 0?b:1073741824})()/1048576);i(p<v)},function(h){r(new Error("detectIncognito somehow failed to query storage quota: "+h.message))})}function c(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?l():(0,window.webkitRequestFileSystem)(0,1,function(){i(!1)},function(){i(!0)})}function f(){var h;return jr(this,void 0,Promise,function(){var d,p,v;return Dr(this,function(g){switch(g.label){case 0:if(typeof((h=navigator.storage)===null||h===void 0?void 0:h.getDirectory)!="function")return[3,5];g.label=1;case 1:return g.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return g.sent(),i(!1),[3,4];case 3:return d=g.sent(),p=d instanceof Error&&typeof d.message=="string"?d.message:String(d),i(p.includes("Security error")),[2];case 4:return[3,6];case 5:(v=indexedDB.open("inPrivate")).onerror=function(P){v.error&&v.error.name==="InvalidStateError"&&P.preventDefault(),i(!0)},v.onsuccess=function(){indexedDB.deleteDatabase("inPrivate"),i(!1)},g.label=6;case 6:return[2]}})})}(function(){return jr(this,void 0,Promise,function(){return Dr(this,function(h){switch(h.label){case 0:return o()!==44&&o()!==43?[3,2]:(n="Safari",[4,u()]);case 1:return h.sent(),[3,6];case 2:return o()!==51?[3,3]:(d=navigator.userAgent,n=d.match(/Chrome/)?navigator.brave!==void 0?"Brave":d.match(/Edg/)?"Edge":d.match(/OPR/)?"Opera":"Chrome":"Chromium",c(),[3,6]);case 3:return o()!==25?[3,5]:(n="Firefox",[4,f()]);case 4:return h.sent(),[3,6];case 5:navigator.msSaveBlob!==void 0?(n="Internet Explorer",i(window.indexedDB===void 0)):r(new Error("detectIncognito cannot determine the browser")),h.label=6;case 6:return[2]}var d})})})().catch(r)})];case 1:return[2,t.sent()]}})})}typeof window<"u"&&(window.detectIncognito=ic);const dy=ic;ac.A;const hy=ac.k,kn="sesamy_incognito_mode";function na(){try{const t=sessionStorage.getItem(kn);return t===null?void 0:t==="true"}catch{return}}async function Hp(){try{const t=sessionStorage.getItem(kn);if(t!==null)return t==="true";const{isPrivate:e}=await hy();return sessionStorage.setItem(kn,e.toString()),e}catch{try{sessionStorage.setItem(kn,"false")}catch{}return!1}}function Yt(){return typeof window<"u"}function py(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function vy(){return/android/i.test(navigator.userAgent)}let _e,oc,Xr,Es=!1,_n=!1,Tn=!1;Yt()&&window.addEventListener("pageshow",()=>{_n=!1,Tn=!1});const Xt="sesamyAccessToken",zr="sesamyRefreshToken",Ln="sesamySilentAuthThrottle",Bp="sesamy_is_authenticated",sc="sesamySilentRedirectState",my=300*1e3,Gp=60,gy=["login_required","consent_required","interaction_required","timeout","Timeout","access_denied"];function Wp(){if(!Yt())return!1;try{const t=document.cookie.split(";").map(a=>a.trim());if(t.some(a=>a.startsWith(`${Bp}=true`))||t.some(a=>a.startsWith("auth0.is.authenticated=true")))return!0;const n=Object.keys(localStorage).filter(a=>a.startsWith("@@auth0spajs@@"));if(n.length>0)for(const a of n)try{const i=JSON.parse(localStorage.getItem(a)||"{}");if(i?.body?.access_token||i?.body?.refresh_token)return!0}catch{}return!1}catch(t){return G(`Error checking session hint cookie: ${t.message}`),!1}}function ln(t){if(Yt())try{const e=t?2592e3:0,r=window.location.protocol==="https:"?"; Secure":"";document.cookie=`${Bp}=${t}; path=/; max-age=${e}; SameSite=Lax${r}`}catch(e){G(`Error setting session hint cookie: ${e.message}`)}}function Rn(){ln(!1)}function yy(){try{sessionStorage.setItem(sc,JSON.stringify({timestamp:Date.now()}))}catch{G("Failed to set silent redirect state")}}function On(){try{const t=sessionStorage.getItem(sc);if(t)return JSON.parse(t)}catch{}return null}function Qr(){try{sessionStorage.removeItem(sc)}catch{}}function wy(t){const e=t.message||"";return gy.some(r=>e.includes(r)||t.error===r)}async function aa(){return Es?!0:new Promise((t,e)=>{const r=setTimeout(()=>{Es?t(!0):e(new Error("Initialization failed: Timeout"))},2e3);window.addEventListener(Ge.AUTH_INITIALIZED,()=>{clearTimeout(r),t(!0)})})}async function by(t){if(!t)return null;const e=localStorage.getItem(zr);if(!e)return G("No refresh token found in localstorage"),null;const r=new URLSearchParams;r.set("client_id",t.iss),r.set("refresh_token",e),r.set("grant_type","refresh_token");const n=new URL(t.iss);n.pathname="/oauth/token",n.searchParams.set("user_id",t.sub);try{const a=await fetch(n.href,{body:r.toString(),method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"}});if(!a.ok){const o=await a.text().catch(()=>"Unknown error");throw G(`Token refresh failed with status ${a.status}: ${o}`),localStorage.removeItem(zr),new Error(`Renew token failed: ${a.status}`)}const i=await a.json();if(!i.access_token)throw G("Token refresh response missing access_token"),new Error("Invalid token response");return i.refresh_token&&localStorage.setItem(zr,i.refresh_token),localStorage.setItem(Xt,i.access_token),i.access_token}catch(a){return G(`Token refresh error: ${a.message}`),localStorage.removeItem(zr),localStorage.removeItem(Xt),await uc(),null}}async function cc(){const t=localStorage.getItem(Xt);if(!t)return null;const e=lc(t),r=Date.now()/1e3;if(!e||!e.exp||e.exp<r+Gp){const n=await by(e);return n||(localStorage.removeItem(Xt),null)}return t}let mn=null;const Sy=64;function Iy(){try{if(mn!==null)return mn;const e=Object.keys(localStorage).filter(r=>r.startsWith("@@auth0spajs@@"));for(const r of e){const n=JSON.parse(localStorage.getItem(r)||"{}");let a;if(typeof n=="object"&&(n.body&&typeof n.body=="object"&&"refresh_token"in n.body?a=n.body.refresh_token:"refresh_token"in n&&(a=n.refresh_token)),a&&typeof a=="string"&&a.length===Sy)return mn=!0,!0}}catch(t){G(`Error checking for existing auth0 tokens: ${t.message}`)}return mn=!1,!1}function Py(t){if(t.domains&&t.domains.length>0){const e=Ht(window.location.href);if(e){for(const r of t.domains)if(Ht(`https://${r}`)===e)return G(`Found matching domain in domains array: ${r} for TLD: ${e}`),r;G(`No matching domain found in domains array for TLD: ${e}`)}}if(t.domain)return G(`Using fallback domain property: ${t.domain}`),t.domain}function Ht(t){try{const e=new URL(t).hostname,r=e.split(".");if(r.length<=1)return e;const n=["co.uk","com.au","co.nz","co.za","com.br","co.jp","gov.uk","ac.uk","org.uk","net.uk","com.sg","com.my","co.in","co.id","co.th","co.kr","com.mx","com.ar","com.co","com.pe","com.ph","com.pk","com.sa","com.eg","com.ng","co.ke","co.tz","co.zw","co.bw","co.mz","gov.au","edu.au","org.au","net.au","asn.au","id.au"];for(const a of n)if(e.endsWith(`.${a}`)){const i=a.split(".").length+1;return r.slice(-i).join(".")}return r.slice(-2).join(".")}catch{return null}}async function Ey(t){if(t.enabled===!1)return;oc=t.organization;const e=Py(t);Xr=e&&!Iy()?e:zp("token",t.environment);const r=Ht(window.location.href)!==Ht(`https://${Xr}`),n=Ht(window.location.href),a=n?`.${n}`:void 0,i={domain:Xr,clientId:t.clientId,useCookiesForTransactions:!0,legacySameSiteCookie:!1,...a&&{cookieDomain:a}};i.cacheLocation="localstorage",(r||t.useRefreshTokens)&&(i.useRefreshTokens=!0),G(`Initializing auth0 client: ${JSON.stringify(i)}`),_e=await cy(i);const o=new URLSearchParams(window.location.search),s=o.get("code"),u=o.get("state"),l=o.get("error");if(l){const c=o.get("error_description");G(`Auth error in URL: ${l}${c?` - ${c}`:""}`);const f=new URL(location.href);f.searchParams.delete("error"),f.searchParams.delete("error_description"),f.searchParams.delete("state"),window.history.replaceState({},document.title,f.toString());const h=On();if(h&&Qr(),l==="login_required")G("Silent redirect returned login_required - user is not authenticated"),Rn();else if(h)G(`Silent redirect returned ${l} - treating as unauthenticated`),Rn();else{const d=c||`Authentication failed: ${l}`;G(`Non-silent auth error, alerting user: ${d}`),setTimeout(()=>{alert(d)},0)}}if(s)if(window.opener)G("Code found in URL, posting to opener"),window.opener.postMessage({type:"authorization_response",response:{code:s,state:u}},window.location.origin);else{G("Code found in URL, handling redirect");const c=window.location.href,f=new URL(location.href),h=f.searchParams;h.delete("code"),h.delete("state"),f.search=h.toString(),window.history.replaceState({},document.title,f.toString()),G("Rewrote url to remove code and state");try{const d=await _e.handleRedirectCallback(c);G(`Login result: ${JSON.stringify(d)}`);const p=await _e.getUser();if(!p)throw G("No user found"),new Error("No user found");G(`User found ${JSON.stringify(p)}`),oa(),On()&&(G("Successfully recovered session via prompt=none redirect"),Qr()),ln(!0),G(`Triggering AUTHENTICATED event with appState: ${JSON.stringify(d.appState)}`),Zt(Ge.AUTHENTICATED,{...p,appState:d.appState})}catch(d){G(`Error handling redirect: ${d.message}`),On()?(Qr(),Rn(),G("Silent redirect failed, cleared session hints")):alert("There was an error logging in"),console.error(d)}}Es=!0,Zt(Ge.AUTH_INITIALIZED,{})}async function Ot(){if(await aa(),await cc())return!0;if(!_e)return!1;const e=await _e.isAuthenticated();return e&&ln(!0),e}async function ky(){return await aa(),await cc()?(G("Using local user"),{sub:"local",name:"Local User"}):_e?_e.getUser():null}function Vp(t){if(_n)return G("Login already in progress"),null;if(_n=!0,setTimeout(()=>{_n=!1},3e3),localStorage.removeItem(Xt),!_e)throw new Error("Auth0 client not initialized");const e=t?.authorizationParams||{};return{...t,authorizationParams:{organization:oc,redirect_uri:window.location.href,ui_locales:Yr(),incognito:na(),...e}}}async function ia(t){const e=Vp(t);if(e)return _e.loginWithRedirect(e)}async function Jp(t){const e=Vp(t);if(!e)return;await _e.loginWithPopup(e,{timeoutInSeconds:1800}),oa(),ln(!0);const r=await _e.getUser();if(!r)throw G("No user found after popup login"),new Error("No user found");const n=new CustomEvent(Ge.AUTHENTICATED,{detail:{...r,appState:t?.appState},composed:!0,bubbles:!0});window.dispatchEvent(n)&&window.location.reload()}function _y(){if(!Xr)return!1;const t=Ht(window.location.href),e=Ht(`https://${Xr}`);return t!==e}async function Ty(t){return _y()&&(py()||vy()||na())?(G("Using popup login for cross-domain auth on Safari/Android/Incognito"),Jp(t)):(G("Using redirect login"),ia(t))}function Ry(){try{const t=sessionStorage.getItem(Ln);if(!t)return!1;const{timestamp:e}=JSON.parse(t);return Date.now()-e<my}catch{return sessionStorage.removeItem(Ln),!1}}function Oy(){try{const t={timestamp:Date.now()};sessionStorage.setItem(Ln,JSON.stringify(t))}catch{G("Failed to set silent auth throttle in sessionStorage")}}function oa(){try{sessionStorage.removeItem(Ln)}catch{}}async function Cy(){if(Tn){G("Silent redirect already in progress");return}if(!Wp()){G("No session hint cookie - skipping prompt=none redirect for anonymous user");return}const t=On();if(t&&Date.now()-t.timestamp<3e4){G("Recently attempted silent redirect, skipping to prevent loop");return}G("Attempting prompt=none redirect to recover session"),Tn=!0,yy();try{await _e.loginWithRedirect({authorizationParams:{prompt:"none",redirect_uri:window.location.href,organization:oc}})}catch(e){G(`Prompt=none redirect failed: ${e.message}`),Tn=!1,Qr()}}async function pt(t=!0,e=!1){await aa();const r=await cc();if(r)return r;if(!e&&Ry()){if(G("Silent auth is throttled due to recent failures, skipping request"),t)throw new Error("Silent auth throttled");return null}try{if(!_e)return G("Auth client not initialized"),null;let n=await _e.getTokenSilently();const a=lc(n),i=Date.now()/1e3;return e&&a?.exp&&a.exp-i<3600+Gp&&(n=await _e.getTokenSilently({cacheMode:"off"})),oa(),ln(!0),n}catch(n){const a=n;if(G(`Failed to get token silently: ${a.message}`),wy(a)){if(G("Iframe-based auth blocked by browser privacy restrictions"),Wp())return G("Session hint present - attempting prompt=none redirect recovery"),await Cy(),null;G("No session hint - user is likely anonymous, not attempting redirect")}if(Oy(),await _e.isAuthenticated()&&(a.message==="Invalid refresh token"||a.message.includes("Missing Refresh Token"))&&await uc(),t)throw n;return null}}async function uc(t={}){if(await aa(),localStorage.removeItem(Xt),localStorage.removeItem(zr),Rn(),Qr(),oa(),Zt(Ge.LOGOUT,{}),!!_e)return G(`Logout with options: ${JSON.stringify(t)}`),_e.logout({...t,logoutParams:{returnTo:window.location.href,...t.logoutParams}})}function lc(t){const e=t.split(".");if(e.length!==3)return null;const n=e[1].replace(/-/g,"+").replace(/_/g,"/"),a=decodeURIComponent(atob(n).split("").map(function(i){return"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(a)}async function ks(t){const e=lc(t);if(!e||!e.exp||e.exp<new Date().getTime()/1e3)throw new Error("Invalid token");G("Set token"),localStorage.setItem(Xt,t),Zt(Ge.AUTHENTICATED,{...e,appState:void 0})}const Ay=(t,e)=>e.skipDedupe||e.method!=="GET",$y=(t,e)=>e.method+"@"+t,Uy=t=>t.clone(),Ly=({skip:t=Ay,key:e=$y,resolver:r=Uy}={})=>{const n=new Map;return a=>(i,o)=>{if(t(i,o))return a(i,o);const s=e(i,o);if(!n.has(s))n.set(s,[]);else return new Promise((u,l)=>{n.get(s).push([u,l])});try{return a(i,o).then(u=>(n.get(s).forEach(([l])=>l(r(u))),n.delete(s),u)).catch(u=>{throw n.get(s).forEach(([,l])=>l(u)),n.delete(s),u})}catch(u){return n.delete(s),Promise.reject(u)}}},qy=(t,e)=>t*e,Ny=t=>t&&t.ok,xy=({delayTimer:t=500,delayRamp:e=qy,maxAttempts:r=10,until:n=Ny,onRetry:a=null,retryOnNetworkError:i=!1,resolveWithLatestResponse:o=!1,skip:s}={})=>u=>(l,c)=>{let f=0;if(s&&s(l,c))return u(l,c);const h=(d,p)=>Promise.resolve(n(d,p)).then(v=>v?d&&o?d:p?Promise.reject(p):d:(f++,!r||f<=r?new Promise(g=>{const P=e(t,f);setTimeout(()=>{typeof a=="function"?Promise.resolve(a({response:d,error:p,url:l,options:c})).then((b={})=>{var y,m;g(u((y=b&&b.url)!==null&&y!==void 0?y:l,(m=b&&b.options)!==null&&m!==void 0?m:c))}):g(u(l,c))},P)}).then(h).catch(g=>{if(!i)throw g;return h(null,g)}):d&&o?d:Promise.reject(p||new Error("Number of attempts exceeded."))));return u(l,c).then(h).catch(d=>{if(!i)throw d;return h(null,d)})};let is=class Zp extends Error{status;statusText;url;body;constructor(e,r,n,a,i){super(a),this.name="APIError",this.status=e,this.statusText=r,this.url=n,this.body=i,Error.captureStackTrace&&Error.captureStackTrace(this,Zp)}isClientError(){return this.status>=400&&this.status<500}isServerError(){return this.status>=500}isForbiddenError(){return this.status===403}isNotFoundError(){return this.status===404}};var qn=(t=>(t.BROWSER="browser",t.NORMAL="normal",t))(qn||{});const jy="application/json",Yp="Content-Type",fr=Symbol(),Xp=Symbol();function Ld(t={}){var e;const r=t instanceof Array?Object.fromEntries(t):t;return(e=Object.entries(r).find(([n])=>n.toLowerCase()===Yp.toLowerCase()))===null||e===void 0?void 0:e[1]}function qd(t){return/^application\/.*json.*/.test(t)}const Bt=function(t,e,r=!1){return Object.entries(e).reduce((n,[a,i])=>{const o=t[a];return Array.isArray(o)&&Array.isArray(i)?n[a]=r?[...o,...i]:i:typeof o=="object"&&typeof i=="object"?n[a]=Bt(o,i,r):n[a]=i,n},{...t})},Sr={options:{},errorType:"text",polyfills:{},polyfill(t,e=!0,r=!1,...n){const a=this.polyfills[t]||(typeof self<"u"?self[t]:null)||(typeof global<"u"?global[t]:null);if(e&&!a)throw new Error(t+" is not defined");return r&&a?new a(...n):a}};function Dy(t,e=!1){Sr.options=e?t:Bt(Sr.options,t)}function My(t,e=!1){Sr.polyfills=e?t:Bt(Sr.polyfills,t)}function Fy(t){Sr.errorType=t}const Ky=t=>e=>t.reduceRight((r,n)=>n(r),e)||e;let Qp=class extends Error{};const zy=t=>{const e=Object.create(null);t=t._addons.reduce((y,m)=>m.beforeRequest&&m.beforeRequest(y,t._options,e)||y,t);const{_url:r,_options:n,_config:a,_catchers:i,_resolvers:o,_middlewares:s,_addons:u}=t,l=new Map(i),c=Bt(a.options,n);let f=r;const h=Ky(s)((y,m)=>(f=y,a.polyfill("fetch")(y,m)))(r,c),d=new Error,p=h.catch(y=>{throw{[fr]:y}}).then(y=>{var m;if(!y.ok){const w=new Qp;if(w.cause=d,w.stack=w.stack+`
35
- CAUSE: `+d.stack,w.response=y,w.status=y.status,w.url=f,y.type==="opaque")throw w;const R=a.errorType==="json"||((m=y.headers.get("Content-Type"))===null||m===void 0?void 0:m.split(";")[0])==="application/json";return(a.errorType?R?y.text():y[a.errorType]():Promise.resolve(y.body)).then(A=>{if(w.message=typeof A=="string"?A:y.statusText,A)if(R&&typeof A=="string"){w.text=A;try{w.json=JSON.parse(A)}catch{}}else w[a.errorType]=A;throw w})}return y}),v=y=>y.catch(m=>{const w=Object.prototype.hasOwnProperty.call(m,fr),R=w?m[fr]:m,A=R?.status&&l.get(R.status)||l.get(R?.name)||w&&l.has(fr)&&l.get(fr);if(A)return A(R,t);const j=l.get(Xp);if(j)return j(R,t);throw R}),g=y=>m=>v(y?p.then(w=>w&&w[y]()).then(w=>m?m(w):w):p.then(w=>m?m(w):w)),P={_wretchReq:t,_fetchReq:h,_sharedState:e,res:g(null),json:g("json"),blob:g("blob"),formData:g("formData"),arrayBuffer:g("arrayBuffer"),text:g("text"),error(y,m){return l.set(y,m),this},badRequest(y){return this.error(400,y)},unauthorized(y){return this.error(401,y)},forbidden(y){return this.error(403,y)},notFound(y){return this.error(404,y)},timeout(y){return this.error(408,y)},internalError(y){return this.error(500,y)},fetchError(y){return this.error(fr,y)}},b=u.reduce((y,m)=>({...y,...typeof m.resolver=="function"?m.resolver(y):m.resolver}),P);return o.reduce((y,m)=>m(y,t),b)},Hy={_url:"",_options:{},_config:Sr,_catchers:new Map,_resolvers:[],_deferred:[],_middlewares:[],_addons:[],addon(t){return{...this,_addons:[...this._addons,t],...t.wretch}},errorType(t){return{...this,_config:{...this._config,errorType:t}}},polyfills(t,e=!1){return{...this,_config:{...this._config,polyfills:e?t:Bt(this._config.polyfills,t)}}},url(t,e=!1){if(e)return{...this,_url:t};const r=this._url.split("?");return{...this,_url:r.length>1?r[0]+t+"?"+r[1]:this._url+t}},options(t,e=!1){return{...this,_options:e?t:Bt(this._options,t)}},headers(t){const e=t?Array.isArray(t)?Object.fromEntries(t):"entries"in t?Object.fromEntries(t.entries()):t:{};return{...this,_options:Bt(this._options,{headers:e})}},accept(t){return this.headers({Accept:t})},content(t){return this.headers({[Yp]:t})},auth(t){return this.headers({Authorization:t})},catcher(t,e){const r=new Map(this._catchers);return r.set(t,e),{...this,_catchers:r}},catcherFallback(t){return this.catcher(Xp,t)},resolve(t,e=!1){return{...this,_resolvers:e?[t]:[...this._resolvers,t]}},defer(t,e=!1){return{...this,_deferred:e?[t]:[...this._deferred,t]}},middlewares(t,e=!1){return{...this,_middlewares:e?t:[...this._middlewares,...t]}},fetch(t=this._options.method,e="",r=null){let n=this.url(e).options({method:t});const a=Ld(n._options.headers),i=this._config.polyfill("FormData",!1),o=typeof r=="object"&&!(i&&r instanceof i)&&(!n._options.headers||!a||qd(a));return n=r?o?n.json(r,a):n.body(r):n,zy(n._deferred.reduce((s,u)=>u(s,s._url,s._options),n))},get(t=""){return this.fetch("GET",t)},delete(t=""){return this.fetch("DELETE",t)},put(t,e=""){return this.fetch("PUT",e,t)},post(t,e=""){return this.fetch("POST",e,t)},patch(t,e=""){return this.fetch("PATCH",e,t)},head(t=""){return this.fetch("HEAD",t)},opts(t=""){return this.fetch("OPTIONS",t)},body(t){return{...this,_options:{...this._options,body:t}}},json(t,e){const r=Ld(this._options.headers);return this.content(e||qd(r)&&r||jy).body(JSON.stringify(t))}};function ut(t="",e={}){return{...Hy,_url:t,_options:e}}ut.default=ut;ut.options=Dy;ut.errorType=Fy;ut.polyfills=My;ut.WretchError=Qp;const By=(t,e)=>e.skipDedupe||e.method!=="GET",Gy=(t,e)=>e.method+"@"+t,Wy=t=>t.clone(),Vy=({skip:t=By,key:e=Gy,resolver:r=Wy}={})=>{const n=new Map;return a=>(i,o)=>{if(t(i,o))return a(i,o);const s=e(i,o);if(!n.has(s))n.set(s,[]);else return new Promise((u,l)=>{n.get(s).push([u,l])});try{return a(i,o).then(u=>(n.get(s).forEach(([l])=>l(r(u))),n.delete(s),u)).catch(u=>{throw n.get(s).forEach(([,l])=>l(u)),n.delete(s),u})}catch(u){return n.delete(s),Promise.reject(u)}}},Jy=(t,e)=>e.skipCache||e.method!=="GET",Zy=(t,e)=>e.method+"@"+t,Yy=()=>!1,Xy=()=>null,Qy=t=>t.ok,ew=({throttle:t=1e3,skip:e=Jy,key:r=Zy,clear:n=Yy,invalidate:a=Xy,condition:i=Qy,flagResponseOnCacheHit:o="__cached"}={})=>{const s=new Map,u=new Map,l=new Set,c=h=>{t&&!l.has(h)&&(l.add(h),setTimeout(()=>{l.delete(h)},t))},f=h=>(d,p)=>{const v=r(d,p);let g=a(d,p);if(g&&(g instanceof Array||(g=[g]),g.forEach(P=>{typeof P=="string"?s.delete(P):P instanceof RegExp&&s.forEach((b,y)=>{P.test(y)&&s.delete(y)})})),n(d,p)&&s.clear(),e(d,p))return h(d,p);if(l.has(v)){if(s.has(v)){const P=s.get(v).clone();return o&&Object.defineProperty(P,o,{value:v,enumerable:!1}),Promise.resolve(P)}else if(u.has(v))return new Promise((P,b)=>{u.get(v).push([P,b])})}return u.has(v)||u.set(v,[]),c(v),h(d,p).then(P=>(i(P.clone())&&s.set(v,P.clone()),u.get(v).forEach(([b])=>b(P.clone())),u.delete(v),P)).catch(P=>{throw u.get(v).forEach(([,b])=>b(P)),u.delete(v),P})};return f.cacheResponse=function(h,d){c(h),s.set(h,d)},f.cache=s,f.inflight=u,f.throttling=l,f},tw=(t,e)=>t*e,rw=t=>t&&t.ok,nw=({delayTimer:t=500,delayRamp:e=tw,maxAttempts:r=10,until:n=rw,onRetry:a=null,retryOnNetworkError:i=!1,resolveWithLatestResponse:o=!1,skip:s}={})=>u=>(l,c)=>{let f=0;if(s&&s(l,c))return u(l,c);const h=(d,p)=>Promise.resolve(n(d,p)).then(v=>v?d&&o?d:p?Promise.reject(p):d:(f++,!r||f<=r?new Promise(g=>{const P=e(t,f);setTimeout(()=>{typeof a=="function"?Promise.resolve(a({response:d,error:p,url:l,options:c})).then((b={})=>{var y,m;g(u((y=b&&b.url)!==null&&y!==void 0?y:l,(m=b&&b.options)!==null&&m!==void 0?m:c))}):g(u(l,c))},P)}).then(h).catch(g=>{if(!i)throw g;return h(null,g)}):d&&o?d:Promise.reject(p||new Error("Number of attempts exceeded."))));return u(l,c).then(h).catch(d=>{if(!i)throw d;return h(null,d)})},aw="@sesamy/sdk",iw="1.23.0";let ow=class{cache=new Map;get(e){return this.cache.get(e)||null}set(e,r){this.cache.set(e,r)}remove(e){this.cache.delete(e)}clear(){this.cache.clear()}};const Hr="sesamyCacheTimestamp",sw=t=>{const{libraryName:e=aw,libraryVersion:r=iw,cache:n}=t,a=n?.storage||new ow,i=[s=>async(u,l)=>{if(n?.mode===qn.BROWSER){let c;typeof sessionStorage<"u"?(c=sessionStorage.getItem(Hr),c||(c=Date.now().toString(),sessionStorage.setItem(Hr,c))):(c=a.get(Hr),c||(c=Date.now().toString(),a.set(Hr,c)));const f={...l,headers:{...l.headers,"Cache-Timestamp":c}};return s(u,f)}return s(u,l)},s=>async(u,l)=>{const c=await t.tokenProvider(),f={...l,headers:{...l.headers,Authorization:c}};return s(u,f)},Vy()];n?.mode===qn.NORMAL&&i.push(ew({throttle:300*1e3,skip:(s,u)=>u.method!=="GET"})),i.push(nw({delayTimer:1e3,delayRamp:(s,u)=>s*u,maxAttempts:3,until:s=>!!(s&&(s.ok||s.status>=400&&s.status<500)),retryOnNetworkError:!1}));const o=ut(t.baseUrl).headers({"Content-Type":"application/json","X-Sesamy-Client":`${e}/${r}`,...t.headers}).middlewares(i);return{async request(s,u={}){try{const l=/^https?:\/\//.test(s);let c=o.url(s,l);u.headers&&(c=c.headers(u.headers));const f=(u.method||"GET").toLowerCase();let h;switch(f){case"get":h=c.get();break;case"post":h=c.post(u.body);break;case"put":h=c.put(u.body);break;case"patch":h=c.patch(u.body);break;case"delete":h=c.delete();break;default:h=c.get()}const d=await h.res();if(d.ok&&["post","patch","put","delete"].includes(f)&&mt(),d.status===204)return null;if(!d.ok){const p=await d.text().catch(()=>"Unknown error");throw new is(d.status,d.statusText,d.url,`API Error ${d.status}: ${p}`,p)}return await d.json()}catch(l){if(l instanceof is)throw l;const c=l.status||500,f=l.message||"Unknown error",h=`${t.baseUrl}${s}`;throw new is(c,f,h,`API Error ${c}: ${l.message||"Unknown error"}`,l.message||"Unknown error")}}}},mt=()=>(typeof sessionStorage<"u"&&sessionStorage.removeItem(Hr),"Cache cleared"),Mr={get:async(t,e)=>t.request(`/profile/${e}`),update:async(t,e,r)=>t.request(`/profile/${e}`,{method:"PATCH",body:JSON.stringify(r)}),checkSpotifyLink:async t=>t.request("/profile/spotify-link"),unlinkSpotify:async t=>t.request("/profile/unlink-spotify",{method:"POST"}),delete:async t=>{await t.request("/profile",{method:"DELETE"})}},os={list:async(t,e)=>{const r=new URLSearchParams;e?.type&&r.append("type",e.type),e?.sku&&r.append("sku",e.sku),e?.purchaseOptionId&&r.append("purchase-option-id",e.purchaseOptionId),e?.waitForEntitlementAfter&&r.append("wait-for-entitlement-after",e.waitForEntitlementAfter);const n=r.toString(),a=n?`/entitlements?${n}`:"/entitlements";return t.request(a)},get:async(t,e)=>t.request(`/entitlements/${e}`),getAccess:async(t,e)=>t.request(`/entitlements/${e}/access`)},Nd={list:async t=>t.request("/subscriptions"),get:async(t,e)=>t.request(`/subscriptions/${e}`)},xd={get:async(t,e)=>t.request(`/products/${e}`),autoOnboard:async(t,e)=>t.request(`/products/${e}/auto-onboard`,{method:"POST"})},cw=(t,e)=>{if(!t||!e)return t;const r=new URL(t);return r.hash=`access_token=${e}`,r.toString()},jd=(t,e)=>!t.manageUrl||!e?t:{...t,manageUrl:cw(t.manageUrl,e)},Fr={list:async t=>t.request("/contracts"),get:async(t,e)=>t.request(`/contracts/${e}`),cancel:async(t,e)=>t.request(`/contracts/${e}/cancel`,{method:"POST"}),createAmendment:async(t,e,r)=>t.request(`/contracts/${e}/amendments`,{method:"POST",body:JSON.stringify(r)}),confirmAmendment:async(t,e,r)=>t.request(`/contracts/${e}/amendments/${r}/confirm`,{method:"POST"})},ss={get:async t=>t.request("/user-metadata"),set:async(t,e,r)=>{await t.request(`/user-metadata/${e}`,{method:"PUT",body:r})},delete:async(t,e)=>{await t.request(`/user-metadata/${e}`,{method:"DELETE"})}},dr={list:async t=>t.request("/tallies"),get:async(t,e)=>t.request(`/tallies/${e}`),update:async(t,e,r)=>t.request(`/tallies/${e}`,{method:"PUT",body:JSON.stringify(r)}),create:async(t,e)=>t.request("/tallies",{method:"POST",body:JSON.stringify(e)}),delete:async(t,e)=>{try{return await t.request(`/tallies/${e}`,{method:"DELETE"}),!0}catch{return!1}},push:async(t,e,r)=>t.request(`/tallies/${e}/push`,{method:"POST",body:JSON.stringify(r)})},cs={list:async t=>t.request("/tags"),add:async(t,e)=>{await t.request("/tags",{method:"POST",body:JSON.stringify({tag:e})})},remove:async(t,e)=>{await t.request(`/tags/${e}`,{method:"DELETE"})}},hr={generateCheckoutLink:(t,e)=>{const r=new URL(`${t.apiUrl}/checkouts`);return e.items&&r.searchParams.set("items",JSON.stringify(e.items)),e.email&&r.searchParams.set("email",e.email),e.language&&r.searchParams.set("lang",e.language),e.redirectUrl&&r.searchParams.set("redirect-url",e.redirectUrl),e.giftMode&&r.searchParams.set("gift-mode","true"),e.payerEmail&&r.searchParams.set("payer-email",e.payerEmail),e.requireAddress&&r.searchParams.set("require-address","true"),e.metadata&&Object.entries(e.metadata).forEach(([n,a])=>{r.searchParams.set(`metadata.${n}`,a)}),r.toString()},generateAccountLink:(t,e)=>{const r=e.language||"en",n=new URL(`${t.baseUrl}/account/${encodeURIComponent(r)}/subscriptions/${encodeURIComponent(t.clientId)}${e.contractId?`/${encodeURIComponent(e.contractId)}`:""}`);return n.searchParams.set("sesamy-redirect-url",e.redirectUrl||"/"),n.toString()},generateChangePaymentLink:(t,e)=>{const r=e.language||"en",n=new URL(`${t.baseUrl}/account/${encodeURIComponent(r)}/subscriptions/${encodeURIComponent(t.clientId)}/${encodeURIComponent(e.contractId)}/change-payment-method`);return n.searchParams.set("sesamy-redirect-url",e.redirectUrl||"/"),n.toString()},generateChangePlanLink:(t,e)=>{const r=e.language||"en",n=new URL(`${t.baseUrl}/account/${encodeURIComponent(r)}/subscriptions/${encodeURIComponent(t.clientId)}/${encodeURIComponent(e.contractId)}/edit-plan`);return n.searchParams.set("sesamy-redirect-url",e.redirectUrl||"/"),n.toString()},generateConsumeLink:(t,e)=>{const r=e.language||"en";let n=new URL(`${t.baseUrl}/consume/${encodeURIComponent(r)}/@${encodeURIComponent(t.clientId)}/${encodeURIComponent(e.sku)}`);return e.episodeId?n.href+=`/${encodeURIComponent(e.episodeId)}`:n.href+="/listen",n.searchParams.set("sesamy-redirect-url",e.redirectUrl||"/"),n.toString()}},us={generateLink:(t,e)=>{const r=new URL(`${t.apiUrl}/checkouts`);return e.items&&r.searchParams.set("items",JSON.stringify(e.items)),e.email&&r.searchParams.set("email",e.email),e.language&&r.searchParams.set("lang",e.language),e.redirectUrl&&r.searchParams.set("redirect-url",e.redirectUrl),e.giftMode&&r.searchParams.set("gift-mode","true"),e.payerEmail&&r.searchParams.set("payer-email",e.payerEmail),e.requireAddress&&r.searchParams.set("require-address","true"),e.metadata&&Object.entries(e.metadata).forEach(([n,a])=>{r.searchParams.set(`metadata.${n}`,a)}),r.toString()},create:async(t,e)=>t.request("/checkouts",{method:"POST",body:JSON.stringify(e)}),get:async(t,e)=>t.request(`/checkouts/${e}`),update:async(t,e,r)=>t.request(`/checkouts/${e}`,{method:"PATCH",body:JSON.stringify(r)})},Dd={list:async t=>t.request("/bills"),get:async(t,e)=>t.request(`/bills/${e}`)},Md={list:async t=>t.request("/fulfillments"),create:async(t,e)=>t.request("/fulfillments",{method:"POST",body:JSON.stringify(e)})},uw={get:async(t,e)=>{try{return new URL(e),t.request(e)}catch{return t.request(`/paywalls/${e}`)}}},lw={list:async t=>t.request("/payment-issues")},fw={content:async(t,e,r,n,a)=>{const i=new URLSearchParams({url:e});return r&&i.append("selector",r),n&&i.append("cache",n),t.request(`/proxy?${i.toString()}`,a)}},dw={list:async(t,e)=>{const r=(e?new URLSearchParams({q:e}):new URLSearchParams).toString(),n=r?`/transactions?${r}`:"/transactions";return t.request(n)}},Fd={get:async t=>t.request("/vendor"),list:async t=>t.request("/vendors")},hw=t=>{const e=sw(t);return{profile:{get:r=>Mr.get(e,r),update:(r,n)=>Mr.update(e,r,n),checkSpotifyLink:()=>Mr.checkSpotifyLink(e),unlinkSpotify:()=>Mr.unlinkSpotify(e),delete:()=>Mr.delete(e)},entitlements:{list:r=>os.list(e,r),get:r=>os.get(e,r),getAccess:r=>os.getAccess(e,r)},subscriptions:{list:()=>Nd.list(e),get:r=>Nd.get(e,r)},products:{get:r=>xd.get(e,r),autoOnboard:r=>xd.autoOnboard(e,r)},contracts:{list:async()=>{const r=await Fr.list(e),n=await t.tokenProvider();if(!n.toLowerCase().startsWith("bearer "))return r;const a=n.substring(7);return r.map(i=>jd(i,a))},get:async r=>{const n=await Fr.get(e,r),a=await t.tokenProvider();if(!a.toLowerCase().startsWith("bearer "))return n;const i=a.substring(7);return jd(n,i)},cancel:r=>Fr.cancel(e,r),createAmendment:(r,n)=>Fr.createAmendment(e,r,n),confirmAmendment:(r,n)=>Fr.confirmAmendment(e,r,n)},userMetadata:{get:()=>ss.get(e),set:(r,n)=>ss.set(e,r,n),delete:r=>ss.delete(e,r)},tallies:{list:()=>dr.list(e),get:r=>dr.get(e,r),update:(r,n)=>dr.update(e,r,n),create:r=>dr.create(e,r),delete:r=>dr.delete(e,r),push:(r,n)=>dr.push(e,r,n)},tags:{list:()=>cs.list(e),add:r=>cs.add(e,r),remove:r=>cs.remove(e,r)},checkouts:{generateLink:(r,n)=>hr.generateCheckoutLink(r,n),create:r=>us.create(e,r),get:r=>us.get(e,r),update:(r,n)=>us.update(e,r,n)},links:{generateCheckoutLink:(r,n)=>hr.generateCheckoutLink(r,n),generateAccountLink:(r,n)=>hr.generateAccountLink(r,n),generateChangePaymentLink:(r,n)=>hr.generateChangePaymentLink(r,n),generateChangePlanLink:(r,n)=>hr.generateChangePlanLink(r,n),generateConsumeLink:(r,n)=>hr.generateConsumeLink(r,n)},bills:{list:()=>Dd.list(e),get:r=>Dd.get(e,r)},fulfillments:{list:()=>Md.list(e),create:r=>Md.create(e,r)},paywalls:{get:r=>uw.get(e,r)},paymentIssues:{list:()=>lw.list(e)},proxy:{content:(r,n,a,i)=>fw.content(e,r,n,a,i)},transactions:{list:r=>dw.list(e,r)},vendor:{get:()=>Fd.get(e),list:()=>Fd.list(e)}}};class pw{get(e){return typeof sessionStorage>"u"?null:sessionStorage.getItem(e)}set(e,r){typeof sessionStorage<"u"&&sessionStorage.setItem(e,r)}remove(e){typeof sessionStorage<"u"&&sessionStorage.removeItem(e)}clear(){}}function _s(t){let e;try{e=new URL(t)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}function ev(t,e){if(_s(t))return{itemSrc:t};const r=t.split(":");if(r.length<2)throw new Error(`Invalid itemSrc format: expected at least 2 segments separated by ':', got ${r.length}`);const[n,a,i]=r;if(!a)throw new Error("Invalid itemSrc format: sku segment is empty");return{sku:`${n}:${a}`,purchaseOption:e||i}}function Kd(t){return t.endsWith("/")?t.slice(0,-1):t}function zd(t,e){if(!_s(t)||!_s(e))return!1;const r=new URL(t),n=new URL(e);return r.origin===n.origin&&Kd(r.pathname)===Kd(n.pathname)}function vw(t,e,r){const n=new URL(`${rt("checkout3",t.environment)}`);e.language&&n.searchParams.set("lang",e.language);let a=e.sku,i=e.purchaseOptionId,o=e.itemSrc;if(e.itemSrc){const c=ev(e.itemSrc,e.purchaseOptionId);a=c.sku||a,i=c.purchaseOption||i,o=c.itemSrc}a?(n.searchParams.set("sku",a),i&&n.searchParams.set("po-id",i)):o&&n.searchParams.set("url",o),e.email&&n.searchParams.set("email",e.email),e.business&&n.searchParams.set("business","true"),e.currency&&n.searchParams.set("currency",e.currency),e.price&&n.searchParams.set("price",e.price.toString()),e.discountCode&&n.searchParams.set("discount-code",e.discountCode),e.attributionItemSrc?n.searchParams.set("itemSrc",e.attributionItemSrc):r.itemSrc&&n.searchParams.set("itemSrc",r.itemSrc),e.attributionPublisherContentId?n.searchParams.set("publisherContentId",e.attributionPublisherContentId):r.publisherContentId&&n.searchParams.set("publisherContentId",r.publisherContentId),e.utmSource?n.searchParams.set("utm_source",e.utmSource):r.utmSource&&n.searchParams.set("utm_source",r.utmSource),e.utmMedium?n.searchParams.set("utm_medium",e.utmMedium):r.utmMedium&&n.searchParams.set("utm_medium",r.utmMedium),e.utmCampaign?n.searchParams.set("utm_campaign",e.utmCampaign):r.utmCampaign&&n.searchParams.set("utm_campaign",r.utmCampaign),e.utmTerm?n.searchParams.set("utm_term",e.utmTerm):r.utmTerm&&n.searchParams.set("utm_term",r.utmTerm),e.utmContent?n.searchParams.set("utm_content",e.utmContent):r.utmContent&&n.searchParams.set("utm_content",r.utmContent);const s=["_ga","_gid","_fbp","_fbc"];document.cookie.split(";").map(c=>{const[f,h]=c.trim().split("=");return{key:f,value:h}}).filter(c=>s.some(f=>f===c.key)).forEach(c=>{n.searchParams.append(c.key,c.value)});let l=new URL(window.location.href);if(e.redirectUrl)try{l=new URL(e.redirectUrl)}catch{console.warn("Invalid redirect URL provided, using current URL instead:",e.redirectUrl)}return l.searchParams.set("force-refetch-entitlements","true"),e.itemSrc&&l.searchParams.set("sesamy-purchase",e.itemSrc),n.searchParams.set("redirect-url",l.toString()),e.paymentMethodsFilter&&n.searchParams.set("paymentmethods-filter",e.paymentMethodsFilter.flatMap(({provider:c,methods:f})=>f?f.map(h=>`${c}|${h}`):c).join(",")),e.requireAddress&&n.searchParams.set("require-address","true"),e.giftMode&&n.searchParams.set("gift-mode","true"),e.payerEmail&&n.searchParams.set("payer-email",e.payerEmail),e.metadata&&Object.entries(e.metadata).forEach(([c,f])=>{n.searchParams.set(`metadata.${c}`,String(f))}),n}const tv="sesamySignedURLs";function fc(){const t=sessionStorage.getItem(tv);return t?JSON.parse(t):[]}function mw(t){const e=fc();e.push(t),G(`Adding signed URL: ${t}`),sessionStorage.setItem(tv,JSON.stringify(e))}function gw(t){const e={};return Object.keys(t).forEach(r=>{const n=t[r];n!=null&&(e[r]=n.toString())}),e}const Ts="sesamyAttribution";function yw(t){const e=localStorage.getItem(t);if(!e)return null;try{return JSON.parse(e).value}catch{return console.error(`Failed to parse ${t}`),null}}function ww(t){return Object.keys(t).find(e=>e.startsWith("utm_"))?{utmSource:void 0,utmMedium:void 0,utmCampaign:void 0,...t}:t}function Nn(){return yw(Ts)||{}}function rv(t){if(t===null)localStorage.removeItem(Ts);else{G(`Setting attribution ${JSON.stringify(t)}`);const e=Nn()??{},r=gw({...e,...ww(t)});localStorage.setItem(Ts,JSON.stringify({value:r}))}}const dc="@sesamy/sesamy-js",fn="1.87.0",nv="sesamyFlags";async function av(t){try{localStorage.setItem(nv,JSON.stringify(t))}catch{G("Failed to save flags to localStorage")}}async function iv(t,e){const r=await dn();r[t]=e,await av(r)}async function ov(t){return(await dn())[t]}async function sv(t){const e=await dn();t in e&&(delete e[t],await av(e))}async function dn(){try{const t=localStorage.getItem(nv);return t?JSON.parse(t):{}}catch{return{}}}function cv(t){function e(n){return n.id?`#${n.id}`:n.classList.length>0?Array.from(n.classList).map(i=>`.${i}`).join(""):null}function r(n){const a=[];let i=n;for(;i&&i!==document.body&&i!==document.documentElement;){const o=e(i);if(o){a.unshift(o);break}if(i.parentElement){const s=Array.from(i.parentElement.children),u=s.indexOf(i)+1,l=i.tagName.toLowerCase();s.filter(f=>f.tagName.toLowerCase()===l).length>1?a.unshift(`${l}:nth-child(${u})`):a.unshift(l)}i=i.parentElement}return a.join(" > ")}return r(t)}function uv(t){return t?Object.fromEntries(Object.entries(t).filter(([e,r])=>r!==void 0)):{}}function bw(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}let Ke={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"}},lv=[],fv=!1,Rt;function hc(){const t=window.location.pathname,e=new URLSearchParams(window.location.search),r=navigator.userAgent;return lv.find(n=>{if(n.path&&!t.includes(n.path)||n.queryParam&&e.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(!r.toLowerCase().includes(i))return!1}else return!1}return!(n.userAgentContains&&!r.includes(n.userAgentContains))})}function Sw(){return hc()}function Iw(t,e){lv=t.content||[];const r=hc();r&&r.type==="article"&&(Ke={...Ke,...uv(r.selectors)},fv=r.enablePaywallSettingsUrlFallback||!1),Rt=e}function Pw(t,e){const{selector:r,attribute:n}=e;return r===Ke.article.selector||n&&t.hasAttribute(n)?t:t.querySelector(r)}function dv(t,e,r=!1){if(t){if(e.attribute){if(e.attribute==="textContent")return t.textContent??void 0;const n=t.getAttribute(e.attribute),a=dv(t.parentElement,e,r);if(r){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 t.textContent??void 0}}function ge(t){const e=document.head.querySelectorAll(`[property~='${t}'][content]`);for(let n=0;n<e.length;n+=1)if(e[n].content)return e[n].content;const r=document.head.querySelectorAll(`[name~='${t}'][content]`);for(let n=0;n<r.length;n+=1)if(r[n].content)return r[n].content}function Br(t){const e=[];return document.head.querySelectorAll(`[property~='${t}'][content]`).forEach(a=>{a.content&&e.push(a.content)}),document.head.querySelectorAll(`[name~='${t}'][content]`).forEach(a=>{a.content&&e.push(a.content)}),e}let Gr=null;function hv(){const t=[],e=document.querySelectorAll('script[type="application/ld+json"]');for(const r of e)try{const n=JSON.parse(r.textContent||"");Array.isArray(n)?t.push(...n):n["@graph"]&&Array.isArray(n["@graph"])?t.push(...n["@graph"]):t.push(n)}catch{}return t}function Wr(t){const e=hv(),r=n=>!t||n["@type"]===t||Array.isArray(n["@type"])&&n["@type"].includes(t);return e.find(r)||null}function Ew(t){const e=hv(),r=n=>!t||n["@type"]===t||Array.isArray(n["@type"])&&n["@type"].includes(t);return e.filter(r)}function Rs(t,e,r){if(!t||typeof t!="object")return typeof t=="string"?t:void 0;const a=t[e];if(typeof a=="string")return a;if(a&&typeof a=="object"&&r)return a[r]}function kw(t){if(!t)return;const r=(Array.isArray(t)?t:[t]).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:Rs(a,"image","url"),jobTitle:a.jobTitle,sameAs:a.sameAs}:null}return null}).filter(n=>n!==null&&!!n.name);return r.length>0?r:void 0}function ls(t){if(Array.isArray(t))return t.filter(e=>typeof e=="string");if(typeof t=="string"){const e=t.split(",").map(r=>r.trim()).filter(Boolean);return e.length>0?e:void 0}}function pv(){if(Gr)return Gr;const t=Wr("NewsArticle")||Wr("Article")||Wr("BlogPosting")||Wr("WebPage"),e=(...a)=>a.find(i=>i!=null&&i!=="")||void 0,r=(...a)=>a.find(i=>i&&i.length>0),n={contentType:t?Array.isArray(t["@type"])?t["@type"][0]:t["@type"]:void 0,authors:kw(t?.author)||(Br("article:author").length>0?Br("article:author").map(a=>({name:a})):void 0)||(ge("author")?[{name:ge("author")}]:void 0),keywords:r(ls(t?.keywords),ls(ge("keywords"))),tags:Br("article:tag").length>0?Br("article:tag"):void 0,categories:ls(ge("news_keywords")),section:e(t?.articleSection,ge("article:section")),publishedAt:e(t?.datePublished,ge("article:published_time")),modifiedAt:e(t?.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:e(ge("creator"),ge("dc.creator")),mainEntityOfPage:t?Rs(t.mainEntityOfPage,"@id")||(typeof t.mainEntityOfPage=="string"?t.mainEntityOfPage:void 0):void 0,isAccessibleForFree:typeof t?.isAccessibleForFree=="boolean"?t.isAccessibleForFree:void 0,wordCount:typeof t?.wordCount=="number"?t.wordCount:void 0,publisher:t?.publisher&&typeof t.publisher=="object"?{name:t.publisher.name||"",url:t.publisher.url,logo:Rs(t.publisher,"logo","url")}:void 0};return Gr=uv(n),Gr}function _w(){Gr=null}function pc({publisherContentId:t,key:e,defaultValue:r=""}){const n=t?document.body.querySelector(`sesamy-content-data[id='${t}']`):null,a=e.replace(/-([a-z])/g,(i,o)=>o.toUpperCase());return n?.getAttribute(e)||ge(`sesamy:${e}`)||ge(`sesamy:${a}`)||ge(`og:${e}`)||ge(e)||r}function vv(){const t=document.querySelectorAll(Ke.article.selector);return Array.from(t).map(hn).filter(e=>e!==null)}function hn(t){const e=typeof t=="string"?document.querySelector(t):t;if(!e)return null;const r={element:e,selector:typeof t=="string"?t:cv(e)},n=(i,o,s,u)=>{const{transform:l,collect:c=!1}=u||{},f=Pw(e,o),h=dv(f,o,c),d=pc({publisherContentId:s,key:bw(String(i))}),p=h||d||void 0;p&&(r[i]=l?l(p):p)};n("id",Ke.id),n("title",Ke.title,r.id),n("excerpt",Ke.excerpt,r.id),n("image",Ke.image,r.id),n("price",Ke.price,r.id,{transform:i=>{const o=parseFloat(i);return Number.isNaN(o)?void 0:o}}),n("currency",Ke.currency,r.id),n("url",Ke.url,r.id),n("pass",Ke.pass,r.id,{collect:!0}),n("paywallUrl",Ke.paywallUrl,r.id),n("accessLevel",Ke.accessLevel,r.id,{transform:i=>i||"entitlement"});const a=hc();if(a&&a.type==="article"&&(a.pass&&(r.pass=r.pass?`${r.pass},${a.pass}`:a.pass),a.price&&!r.price&&(r.price=a.price.amount),a.price?.currency&&!r.currency&&(r.currency=a.price.currency),a.paywallUrl&&!r.paywallUrl&&(r.paywallUrl=a.paywallUrl)),fv&&!r.paywallUrl){const i=document.querySelector("sesamy-paywall");if(i){const o=i.getAttribute("settings-url");o&&(r.paywallUrl=o)}}return r.url||(r.url=window.location.href),r.metadata=pv(),r}async function Tw(t){const e=hn(t);if(!e)throw new Error("Could not find article element");if(e.accessLevel==="public")return!0;if(e.accessLevel==="logged-in"&&!e.paywallUrl)return await Rt.auth.isAuthenticated()?!0:null;if(e.paywallUrl&&((await Rt.paywalls.get(e.paywallUrl)).settings.template==="LOGIN"?"logged-in":"entitlement")==="logged-in")return await Rt.auth.isAuthenticated()?!0:null;if(!e.url)throw new Error("Article must have a URL");return await Rt.entitlements.hasAccess(e.url,e.pass?.split(",")||[])||null}async function mv(t,e){const r=typeof t=="string"?document.querySelector(t):t;if(!r)throw new Error("Could not find element");const n=hn(r);if(!n?.url)throw new Error("Could not find content for element");const a=await Rt.entitlements.hasAccess(n.url,n.pass?.split(",")||[]);if(!a)throw new Error("User does not have access to the content");const i=await Rt.entitlements.access(a.id);if(!i.token)throw new Error("Could not get access token");const o=e||cv(r.parentElement||r);return Rt.proxy.getContent(i.token,n.url,o)}function gv(t,e={}){const{closeOnBackdropClick:r=!0,closeOnEscape:n=!0,zIndex:a=2147483647,backdropBlur:i="5px",overlayBackground:o="rgba(0,0,0,0.5)"}=e,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 t=="string"?u.innerHTML=t:u.appendChild(t),s.appendChild(u);const l=()=>{s.remove(),n&&document.removeEventListener("keydown",c)},c=f=>{f.key==="Escape"&&l()};return r&&s.addEventListener("click",f=>{f.target===s&&l()}),n&&document.addEventListener("keydown",c),document.body.appendChild(s),{element:s,close:l}}function Rw(t,e={}){const{position:r="top",fixed:n=!0,zIndex:a=2147483647,autoDismissMs:i,pushContent:o=!1,height:s,transitionDuration:u="0.3s"}=e,l=document.createElement("div");l.setAttribute("data-sesamy-notification-bar","true"),l.setAttribute("data-sesamy-notification-position",r),Object.assign(l.style,{position:n?"fixed":"absolute",[r]:"0",left:"0",width:"100%",zIndex:String(a),boxSizing:"border-box",...s&&{height:s}}),typeof t=="string"?l.innerHTML=t:l.appendChild(t);let c,f,h;const d=()=>{if(h&&clearTimeout(h),o&&s){const p=document.documentElement;p.style.transform=c||"",setTimeout(()=>{l.remove(),p.style.transition=f||""},parseFloat(u)*1e3)}else l.remove()};if(i&&(h=setTimeout(d,i)),o&&s){const p=document.documentElement;c=p.style.transform,f=p.style.transition,p.style.transition=`transform ${u} ease`,l.style.transition=`transform ${u} ease`,r==="top"?(p.style.transform=`translateY(${s})`,l.style.transform=`translateY(-${s})`):(p.style.transform=`translateY(-${s})`,l.style.transform=`translateY(${s})`),document.documentElement.prepend(l)}else document.body.appendChild(l);return{element:l,close:d}}function Ow(t){const e=t.endpoint||rt("api2",t.environment),n=hw({baseUrl:e,tokenProvider:async()=>{if(await Ot())try{const q=await pt(!1);if(q)return`Bearer ${q}`}catch{}const S=localStorage.getItem("__anon_id");return`Basic ${btoa(`${t.vendorId||t.clientId}|${S}:`)}`},libraryName:dc,libraryVersion:fn,vendorId:t.vendorId,cache:{mode:qn.BROWSER,storage:new pw}}),a=S=>async(O,q)=>{let F=sessionStorage.getItem($d);F||(F=Date.now().toString(),sessionStorage.setItem($d,F));const I={...q,headers:{...q.headers,"Cache-Timestamp":F}};return S(O,I)},i=(S=!0)=>O=>async(q,F)=>{let I=null;if(I=await pt(S),!I){if(S)throw new Error("No access token available");return O(q,F)}const _={...F,headers:{...F.headers,...I?{Authorization:`Bearer ${I}`}:{}}};return O(q,_)},o=ut(e).headers({"Content-Type":"application/json"}).middlewares([a,i(),Ly(),xy({delayTimer:1e3,delayRamp:(S,O)=>S*O,maxAttempts:3,until:S=>!!(S&&(S.ok||S.status>=400&&S.status<500)),retryOnNetworkError:!1})]);async function s(S={}){const{waitForEntitlementAfter:O,includeSignedLinks:q=!0}=S,F=await Ot()?await n.entitlements.list({waitForEntitlementAfter:O?.toISOString()}):[];return q&&F.push(...fc()),F}async function u(S,O=[]){return(await s())?.find(I=>{if(S){const{sku:_,purchaseOption:x}=ev(S);if("sku"in I&&_===I.sku||x&&"purchaseOptionsId"in I&&x===I.purchaseOptionsId||zd(S,I.url))return!0}return!!O.some(_=>zd(_,I.url))})}async function l(S,O,q){const F=new URL(rt("api2",t.environment));return F.pathname="/proxy",F.searchParams.set("url",O),q&&F.searchParams.set("selector",q),ut(F.toString()).headers({Authorization:`Bearer ${S}`}).get().text()}async function c(S){if(!S)throw new Error("SKU is required to get fulfillments");return await Ot()?await o.get(`/fulfillments?sku=${encodeURIComponent(S)}`).json():[]}async function f(S,O){if(!S||!O)throw new Error("SKU and itemId are required to request delivery");return(await o.post({sku:S},`/fulfillments/${encodeURIComponent(O)}/request-delivery?`).res()).ok}async function h(){return console.warn("getSubscriptions is deprecated, use getContracts instead"),o.get("/subscriptions").json()}async function d(S){return(await n.transactions.list())?.find(q=>q.id===S)}async function p(){return await o.url("/tags").get().json()}async function v(S){const O=await o.url(`/tags/${encodeURIComponent(S)}`).delete().res();return mt(),O.ok}async function g(S){const O=await o.url("/tags").post(encodeURIComponent(S)).res();return Zt(Ge.USER_ATTRIBUTE_CHANGED,{}),mt(),O.ok}async function P(S){return(await n.tallies.get(S)).value}async function b(){const S=await n.tallies.list(),O={};for(const q of S)O[q.id]=q.value;return O}async function y(S){return await n.tallies.delete(S)}async function m(S,O){return await n.tallies.push(S,O)}async function w(){return await pt(!1)?await o.url("/profile").get().json():null}async function R(S){const O=await o.url("/profile").patch(S).res();return mt(),O.ok}async function A(){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 K(S){const O=await pt(!1);if(!O)throw new Error("No access token available");const q=new URL(`${rt("access-sync",t.environment)}/spotify/sesamy-callback`);q.searchParams.set("access_token",O),q.searchParams.set("state",S),window.location.href=q.toString()}async function B(S){const O=await o.url(`/products/${encodeURIComponent(S)}/auto-onboard`).post().json();return O.length&&mt(),O}async function re(S,O=3600){const{shortlink:q}=await ut(fy).post({url:S,ttl:O}).json();return q}async function L(S){const O=await pt(!1,!0);let q;const F=S.language||Yr(),I=Nn();switch(S.target){case"account":q=new URL(`${rt("account",t.environment)}/${encodeURIComponent(S.language||F)}/subscriptions/${encodeURIComponent(t.vendorId||t.clientId)}${S.contractId?`/${encodeURIComponent(S.contractId)}`:""}`),q.searchParams.set("sesamy-redirect-url",S.redirectUrl||window.location.href);break;case"change-payment":q=new URL(`${rt("account",t.environment)}/${encodeURIComponent(S.language||F)}/subscriptions/${encodeURIComponent(t.vendorId||t.clientId)}/${encodeURIComponent(S.contractId)}/change-payment-method`),q.searchParams.set("sesamy-redirect-url",S.redirectUrl||window.location.href);break;case"change-plan":q=new URL(`${rt("account",t.environment)}/${encodeURIComponent(S.language||F)}/subscriptions/${encodeURIComponent(t.vendorId||t.clientId)}/${encodeURIComponent(S.contractId)}/edit-plan`),q.searchParams.set("sesamy-redirect-url",S.redirectUrl||window.location.href);break;case"consume":q=new URL(`${rt("consume",t.environment)}/${encodeURIComponent(S.language||F)}/@${encodeURIComponent(t.vendorId||t.clientId)}/${encodeURIComponent(S.sku)}`),S.episodeId?q.href+=`/${S.episodeId}`:q.href+="/listen",q.searchParams.set("sesamy-redirect-url",S.redirectUrl||window.location.href);break;case"checkout":q=vw(t,{language:F,...S},I);break;default:throw new Error("Invalid target")}return O&&(q.hash=`#access_token=${O}`),S.shorten?re(q.href,S.ttl):q.href}async function M(){const S=await pt(!1),O=new URL(`${rt("account",t.environment)}/subscriptions/${t.vendorId||t.clientId}`);S&&(O.hash=`#access_token=${S}`),window.location.href=O.toString()}async function N(S){const O=Nn(),q=["_ga","_gid","_fbp","_fbc"];return document.cookie.split(";").forEach(F=>{const[I,_]=F.trim().split("=");q.includes(I)&&!O[I]&&(O[I]=_)}),n.checkouts.create({language:Yr(),...S,attribution:{...O,...S.attribution}})}return{autoOnboardProduct:B,bills:n.bills,checkouts:{create:N,get:n.checkouts.get,update:n.checkouts.update},content:{list:vv,get:hn,getLanguage:Yr,unlock:mv,getPropertyFromHTML:pc},contracts:n.contracts,deleteTag:v,deleteTally:y,entitlements:n.entitlements,flags:{get:ov,set:iv,list:dn,delete:sv},generateLink:L,getProxyContent:l,getEntitlements:s,getFulfillments:c,requestDelivery:f,hasAccess:u,isSpotifyLinked:A,linkSpotify:K,openHostedAccountPage:M,paywalls:n.paywalls,paymentIssues:n.paymentIssues,getProfile:w,products:n.products,getSubscriptions:h,getTally:P,getTallies:b,getTags:p,getTransaction:d,transactions:n.transactions,userMetadata:n.userMetadata,pushTally:m,setTag:g,unlinkSpotify:j,updateProfile:R,vendor:n.vendor}}function Hd(t,e,r,n,a){for(e=e.split?e.split("."):e,n=0;n<e.length;n++)t=t?t[e[n]]:a;return t===a?r:t}var Cw="function",Aw="string",nt="undefined",$w="boolean",xn="object",Uw="array",Lw="number",qw="symbol",Nw="null",Os=function(){},yv="any",wv="*",Qt="__",xw="form",jw="input",Dw="button",Mw="select",jn=typeof process!==nt?process:{};jn.env&&jn.env.NODE_ENV;var Ae=typeof document!==nt;jn.versions!=null&&jn.versions.node!=null;typeof Deno!==nt&&Deno.core;Ae&&window.name==="nodejs"||typeof navigator!==nt&&typeof navigator.userAgent!==nt&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));function bv(t,e){return e.charAt(0)[t]()+e.slice(1)}var Fw=bv.bind(null,"toUpperCase"),Kw=bv.bind(null,"toLowerCase");function zw(t){return Sv(t)?Fw(Nw):typeof t===xn?Ww(t):Object.prototype.toString.call(t).slice(8,-1)}function Dn(t,e){e===void 0&&(e=!0);var r=zw(t);return e?Kw(r):r}function pn(t,e){return typeof e===t}var He=pn.bind(null,Cw),Ct=pn.bind(null,Aw),mr=pn.bind(null,nt),Hw=pn.bind(null,$w);pn.bind(null,qw);function Sv(t){return t===null}function Bw(t){return Dn(t)===Lw&&!isNaN(t)}function Iv(t){return Dn(t)===Uw}function ze(t){if(!Gw(t))return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function Gw(t){return t&&(typeof t===xn||t!==null)}function Ww(t){return He(t.constructor)?t.constructor.name:null}function Vw(t){return t instanceof Error||Ct(t.message)&&t.constructor&&Bw(t.constructor.stackTraceLimit)}function Pv(t,e){if(typeof e!="object"||Sv(e))return!1;if(e instanceof t)return!0;var r=Dn(new t(""));if(Vw(e))for(;e;){if(Dn(e)===r)return!0;e=Object.getPrototypeOf(e)}return!1}Pv.bind(null,TypeError);Pv.bind(null,SyntaxError);function sa(t,e){var r=t instanceof Element||t instanceof HTMLDocument;return r&&e?Jw(t,e):r}function Jw(t,e){return e===void 0&&(e=""),t&&t.nodeName===e.toUpperCase()}function ca(t){var e=[].slice.call(arguments,1);return function(){return t.apply(void 0,[].slice.call(arguments).concat(e))}}ca(sa,xw);ca(sa,Dw);ca(sa,jw);ca(sa,Mw);function Zw(t){return t?Iv(t)?t:[t]:[]}function Bd(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function Yw(){if(Ae){var t=navigator,e=t.languages;return t.userLanguage||(e&&e.length?e[0]:t.language)}}function Xw(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function Qw(t){return(function(e){for(var r,n=Object.create(null),a=/([^&=]+)=?([^&]*)/g;r=a.exec(e);){var i=Bd(r[1]),o=Bd(r[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 l=u.split("[");l.length>1&&(eb(n,l.map(function(c){return c.replace(/[?[\]\\ ]/g,"")}),n[u]),delete n[u])}return n})((function(e){return Ae&&window.location.search.substring(1)})())}function eb(t,e,r){for(var n=e.length-1,a=0;a<n;++a){var i=e[a];if(i==="__proto__"||i==="constructor")break;i in t||(t[i]={}),t=t[i]}t[e[n]]=r}function ua(){for(var t="",e=0,r=4294967295*Math.random()|0;e++<36;){var n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[e-1],a=15&r;t+=n=="-"||n=="4"?n:(n=="x"?a:3&a|8).toString(16),r=e%8==0?4294967295*Math.random()|0:r>>4}return t}function tb(t,e){var r,n,a,i=null,o=0,s=function(){o=new Date,i=null,a=t.apply(r,n)};return function(){var u=new Date;o||(o=u);var l=e-(u-o);return r=this,n=arguments,l<=0?(clearTimeout(i),i=null,o=u,a=t.apply(r,n)):i||(i=setTimeout(s,l)),a}}var Gt="global",Ir=Qt+Gt+Qt,Pr=typeof self===xn&&self.self===self&&self||typeof global===xn&&global[Gt]===global&&global||void 0;function er(t){return Pr[Ir][t]}function tr(t,e){return Pr[Ir][t]=e}function Cr(t){delete Pr[Ir][t]}function Ar(t,e,r){var n;try{if(vc(t)){var a=window[t];n=a[e].bind(a)}}catch{}return n||r}Pr[Ir]||(Pr[Ir]={});var gn={};function vc(t){if(typeof gn[t]!==nt)return gn[t];try{var e=window[t];e.setItem(nt,nt),e.removeItem(nt)}catch{return gn[t]=!1}return gn[t]=!0}function te(){return te=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},te.apply(null,arguments)}var _t="function",gt="undefined",en="reducer",Ev="@@redux/",Cs=Ev+"INIT",rb=Ev+Math.random().toString(36),Gd=(function(){return typeof Symbol===_t&&Symbol.observable||"@@observable"})(),yn=" != "+_t;function kv(t,e,r){var n;if(typeof e===_t&&typeof r===gt&&(r=e,e=void 0),typeof r!==gt){if(typeof r!==_t)throw new Error("enhancer"+yn);return r(kv)(t,e)}if(typeof t!==_t)throw new Error(en+yn);var a=t,i=e,o=[],s=o,u=!1;function l(){s===o&&(s=o.slice())}function c(){return i}function f(d){if(typeof d!==_t)throw new Error("Listener"+yn);var p=!0;return l(),s.push(d),function(){if(p){p=!1,l();var v=s.indexOf(d);s.splice(v,1)}}}function h(d){if(!ze(d))throw new Error("Act != obj");if(typeof d.type===gt)throw new Error("ActType "+gt);if(u)throw new Error("Dispatch in "+en);try{u=!0,i=a(i,d)}finally{u=!1}for(var p=o=s,v=0;v<p.length;v++)(0,p[v])();return d}return h({type:Cs}),(n={dispatch:h,subscribe:f,getState:c,replaceReducer:function(d){if(typeof d!==_t)throw new Error("next "+en+yn);a=d,h({type:Cs})}})[Gd]=function(){var d,p=f;return(d={subscribe:function(v){if(typeof v!="object")throw new TypeError("Observer != obj");function g(){v.next&&v.next(c())}return g(),{unsubscribe:p(g)}}})[Gd]=function(){return this},d},n}function nb(t,e){var r=e&&e.type;return"action "+(r&&r.toString()||"?")+en+" "+t+" returns "+gt}function Er(){var t=[].slice.call(arguments);return t.length===0?function(e){return e}:t.length===1?t[0]:t.reduce(function(e,r){return function(){return e(r.apply(void 0,[].slice.call(arguments)))}})}function ab(){var t=arguments;return function(e){return function(r,n,a){var i,o=e(r,n,a),s=o.dispatch,u={getState:o.getState,dispatch:function(l){return s(l)}};return i=[].slice.call(t).map(function(l){return l(u)}),te({},o,{dispatch:s=Er.apply(void 0,i)(o.dispatch)})}}}var At=Qt+"anon_id",Wt=Qt+"user_id",yr=Qt+"user_traits",As="analytics",kt="userId",gr="anonymousId",Cn=["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"],$s=["name","EVENTS","config","loaded"],ee=Cn.reduce(function(t,e){return t[e]=e,t},{registerPluginType:function(t){return"registerPlugin:"+t},pluginReadyType:function(t){return"ready:"+t}}),Wd=/^utm_/,Vd=/^an_prop_/,Jd=/^an_trait_/;function ib(t){var e=t.storage.setItem;return function(r){return function(n){return function(a){if(a.type===ee.bootstrap){var i=a.params,o=a.user,s=a.persistedUser,u=a.initialUser,l=s.userId===o.userId;s.anonymousId!==o.anonymousId&&e(At,o.anonymousId),l||e(Wt,o.userId),u.traits&&e(yr,te({},l&&s.traits?s.traits:{},u.traits));var c=Object.keys(a.params);if(c.length){var f=i.an_uid,h=i.an_event,d=c.reduce(function(p,v){if(v.match(Wd)||v.match(/^(d|g)clid/)){var g=v.replace(Wd,"");p.campaign[g==="campaign"?"name":g]=i[v]}return v.match(Vd)&&(p.props[v.replace(Vd,"")]=i[v]),v.match(Jd)&&(p.traits[v.replace(Jd,"")]=i[v]),p},{campaign:{},props:{},traits:{}});r.dispatch(te({type:ee.params,raw:i},d,f?{userId:f}:{})),f&&setTimeout(function(){return t.identify(f,d.traits)},0),h&&setTimeout(function(){return t.track(h,d.props)},0),Object.keys(d.campaign).length&&r.dispatch({type:ee.campaign,campaign:d.campaign})}}return n(a)}}}}function ob(t){return function(e,r){if(e===void 0&&(e={}),r===void 0&&(r={}),r.type===ee.setItemEnd){if(r.key===At)return te({},e,{anonymousId:r.value});if(r.key===Wt)return te({},e,{userId:r.value})}switch(r.type){case ee.identify:return Object.assign({},e,{userId:r.userId,traits:te({},e.traits,r.traits)});case ee.reset:return[Wt,At,yr].forEach(function(n){t.removeItem(n)}),Object.assign({},e,{userId:null,anonymousId:null,traits:{}});default:return e}}}function Zd(t){return{userId:t.getItem(Wt),anonymousId:t.getItem(At),traits:t.getItem(yr)}}var Us=function(t){return Qt+"TEMP"+Qt+t};function sb(t){var e=t.storage,r=e.setItem,n=e.removeItem,a=e.getItem;return function(i){return function(o){return function(s){var u=s.userId,l=s.traits,c=s.options;if(s.type===ee.reset&&([Wt,yr,At].forEach(function(d){n(d)}),[kt,gr,"traits"].forEach(function(d){Cr(Us(d))})),s.type===ee.identify){a(At)||r(At,ua());var f=a(Wt),h=a(yr)||{};f&&f!==u&&i.dispatch({type:ee.userIdChanged,old:{userId:f,traits:h},new:{userId:u,traits:l},options:c}),u&&r(Wt,u),l&&r(yr,te({},h,l))}return o(s)}}}}var Vr={};function Yd(t,e){Vr[t]&&He(Vr[t])&&(Vr[t](e),delete Vr[t])}function _v(t,e,r){return new Promise(function(n,a){return e()?n(t):r<1?a(te({},t,{queue:!0})):new Promise(function(i){return setTimeout(i,10)}).then(function(i){return _v(t,e,r-10).then(n,a)})})}function cb(t){return{abort:t}}function Tv(t,e,r){var n={},a=e(),i=t.getState(),o=i.plugins,s=i.queue,u=i.user;if(!i.context.offline&&s&&s.actions&&s.actions.length){var l=s.actions.reduce(function(f,h,d){return o[h.plugin].loaded?(f.process.push(h),f.processIndex.push(d)):(f.requeue.push(h),f.requeueIndex.push(d)),f},{processIndex:[],process:[],requeue:[],requeueIndex:[]});if(l.processIndex&&l.processIndex.length){l.processIndex.forEach(function(f){var h=s.actions[f],d=h.plugin,p=h.payload.type,v=a[d][p];if(v&&He(v)){var g,P=(function(m,w){return m===void 0&&(m={}),w===void 0&&(w={}),[kt,gr].reduce(function(R,A){return m.hasOwnProperty(A)&&w[A]&&w[A]!==m[A]&&(R[A]=w[A]),R},m)})(h.payload,u),b=n[P.meta.rid];if(!b&&(g=v({payload:P,config:o[d].config,instance:r,abort:cb}))&&ze(g)&&g.abort)return void(n[P.meta.rid]=!0);if(!b){var y=p+":"+d;t.dispatch(te({},P,{type:y,_:{called:y,from:"queueDrain"}}))}}});var c=s.actions.filter(function(f,h){return!~l.processIndex.indexOf(h)});s.actions=c}}}var fs=function(t){var e=t.data,r=t.action,n=t.instance,a=t.state,i=t.allPlugins,o=t.allMatches,s=t.store,u=t.EVENTS;try{var l=a.plugins,c=a.context,f=r.type,h=f.match(wr),d=e.exact.map(function(g){return g.pluginName});h&&(d=o.during.map(function(g){return g.pluginName}));var p=(function(g,P){return function(b,y,m){var w=y.config,R=y.name,A=R+"."+b.type;m&&(A=m.event);var j=b.type.match(wr)?(function(K,B,re,L,M){return function(N,S){var O=L?L.name:K,q=S&&tn(S)?S:re;if(L&&(!(q=S&&tn(S)?S:[K]).includes(K)||q.length!==1))throw new Error("Method "+B+" can only abort "+K+" plugin. "+JSON.stringify(q)+" input valid");return te({},M,{abort:{reason:N,plugins:q,caller:B,_:O}})}})(R,A,P,m,b):(function(K,B){return function(){throw new Error(K.type+" action not cancellable. Remove abort in "+B)}})(b,A);return{payload:ub(b),instance:g,config:w||{},abort:j}}})(n,d),v=e.exact.reduce(function(g,P){var b=P.pluginName,y=P.methodName,m=!1;return y.match(/^initialize/)||y.match(/^reset/)||(m=!l[b].loaded),c.offline&&y.match(/^(page|track|identify)/)&&(m=!0),g[""+b]=m,g},{});return Promise.resolve(e.exact.reduce(function(g,P,b){var y=P.pluginName;return Promise.resolve(g).then(function(m){function w(){return Promise.resolve(m)}var R=(function(){if(e.namespaced&&e.namespaced[y])return Promise.resolve(e.namespaced[y].reduce(function(A,j,K){return Promise.resolve(A).then(function(B){return j.method&&He(j.method)?((function(N,S){var O=ah(N);if(O&&O.name===S){var q=ah(O.method);throw new Error([S+" plugin is calling method "+N,"Plugins cant call self","Use "+O.method+" "+(q?"or "+q.method:"")+" in "+S+" plugin insteadof "+N].join(`
36
- `))}})(j.methodName,j.pluginName),Promise.resolve(j.method({payload:B,instance:n,abort:(re=B,L=y,M=j.pluginName,function(N,S){return te({},re,{abort:{reason:N,plugins:S||[L],caller:f,from:M||L}})}),config:eh(j.pluginName,l,i),plugins:l})).then(function(N){var S=ze(N)?N:{};return Promise.resolve(te({},B,S))})):B;var re,L,M})},Promise.resolve(r))).then(function(A){m[y]=A});m[y]=r})();return R&&R.then?R.then(w):w()})},Promise.resolve({}))).then(function(g){return Promise.resolve(e.exact.reduce(function(P,b,y){try{var m=e.exact.length===y+1,w=b.pluginName,R=i[w];return Promise.resolve(P).then(function(A){var j=g[w]?g[w]:{};if(h&&(j=A),hs(j,w))return ds({data:j,method:f,instance:n,pluginName:w,store:s}),Promise.resolve(A);if(hs(A,w))return m&&ds({data:A,method:f,instance:n,store:s}),Promise.resolve(A);if(v.hasOwnProperty(w)&&v[w]===!0)return s.dispatch({type:"queue",plugin:w,payload:j,_:{called:"queue",from:"queueMechanism"}}),Promise.resolve(A);var K=p(g[w],i[w]);return Promise.resolve(R[f]({abort:K.abort,payload:j,instance:n,config:eh(w,l,i),plugins:l})).then(function(B){var re=ze(B)?B:{},L=te({},A,re),M=g[w];if(hs(M,w))ds({data:M,method:f,instance:n,pluginName:w,store:s});else{var N=f+":"+w;(N.match(/:/g)||[]).length<2&&!f.match(Xd)&&!f.match(Qd)&&n.dispatch(te({},h?L:j,{type:N,_:{called:N,from:"submethod"}}))}return Promise.resolve(L)})})}catch(A){return Promise.reject(A)}},Promise.resolve(r))).then(function(P){if(!(f.match(wr)||f.match(/^registerPlugin/)||f.match(Qd)||f.match(Xd)||f.match(/^params/)||f.match(/^userIdChanged/))){if(u.plugins.includes(f),P._&&P._.originalAction===f)return P;var b=te({},P,{_:{originalAction:P.type,called:P.type,from:"engineEnd"}});Rv(P,e.exact.length)&&!f.match(/End$/)&&(b=te({},b,{type:P.type+"Aborted"})),s.dispatch(b)}return P})})}catch(g){return Promise.reject(g)}},wr=/Start$/,Xd=/^bootstrap/,Qd=/^ready/;function ds(t){var e=t.pluginName,r=t.method+"Aborted"+(e?":"+e:"");t.store.dispatch(te({},t.data,{type:r,_:{called:r,from:"abort"}}))}function eh(t,e,r){var n=e[t]||r[t];return n&&n.config?n.config:{}}function th(t,e){return e.reduce(function(r,n){return n[t]?r.concat({methodName:t,pluginName:n.name,method:n[t]}):r},[])}function rh(t,e){var r=t.replace(wr,""),n=e?":"+e:"";return[""+t+n,""+r+n,r+"End"+n]}function hs(t,e){var r=t.abort;return!!r&&(r===!0||nh(r,e)||r&&nh(r.plugins,e))}function Rv(t,e){var r=t.abort;if(!r)return!1;if(r===!0||Ct(r))return!0;var n=r.plugins;return tn(r)&&r.length===e||tn(n)&&n.length===e}function tn(t){return Array.isArray(t)}function nh(t,e){return!(!t||!tn(t))&&t.includes(e)}function ah(t){var e=t.match(/(.*):(.*)/);return!!e&&{method:e[1],name:e[2]}}function ub(t){return Object.keys(t).reduce(function(e,r){return r==="type"||(e[r]=ze(t[r])?Object.assign({},t[r]):t[r]),e},{})}function lb(t,e,r){var n={};return function(a){return function(i){return function(o){try{var s,u=function(m){return s?m:i(f)},l=o.type,c=o.plugins,f=o;if(o.abort)return Promise.resolve(i(o));if(l===ee.enablePlugin&&a.dispatch({type:ee.initializeStart,plugins:c,disabled:[],fromEnable:!0,meta:o.meta}),l===ee.disablePlugin&&setTimeout(function(){return Yd(o.meta.rid,{payload:o})},0),l===ee.initializeEnd){var h=e(),d=Object.keys(h),p=d.filter(function(m){return c.includes(m)}).map(function(m){return h[m]}),v=[],g=[],P=o.disabled,b=p.map(function(m){var w=m.loaded,R=m.name,A=m.config;return _v(m,function(){return w({config:A})},1e4).then(function(j){return n[R]||(a.dispatch({type:ee.pluginReadyType(R),name:R,events:Object.keys(m).filter(function(K){return!$s.includes(K)})}),n[R]=!0),v=v.concat(R),m}).catch(function(j){if(j instanceof Error)throw new Error(j);return g=g.concat(j.name),j})});Promise.all(b).then(function(m){var w={plugins:v,failed:g,disabled:P};setTimeout(function(){d.length===b.length+P.length&&a.dispatch(te({},{type:ee.ready},w))},0)})}var y=(function(){if(l!==ee.bootstrap)return/^ready:([^:]*)$/.test(l)&&setTimeout(function(){return Tv(a,e,t)},0),Promise.resolve((function(m,w,R,A,j){try{var K=He(w)?w():w,B=m.type,re=B.replace(wr,"");if(m._&&m._.called)return Promise.resolve(m);var L=R.getState(),M=(O=K,(q=L.plugins)===void 0&&(q={}),(F=m.options)===void 0&&(F={}),Object.keys(O).filter(function(I){var _=F.plugins||{};return Hw(_[I])?_[I]:_.all!==!1&&(!q[I]||q[I].enabled!==!1)}).map(function(I){return O[I]}));B===ee.initializeStart&&m.fromEnable&&(M=Object.keys(L.plugins).filter(function(I){var _=L.plugins[I];return m.plugins.includes(I)&&!_.initialized}).map(function(I){return K[I]}));var N=M.map(function(I){return I.name}),S=(function(I,_){var x=rh(I).map(function(H){return th(H,_)});return _.reduce(function(H,X){var Z=X.name,fe=rh(I,Z).map(function(Te){return th(Te,_)}),ae=fe[0],ue=fe[1],ie=fe[2];return ae.length&&(H.beforeNS[Z]=ae),ue.length&&(H.duringNS[Z]=ue),ie.length&&(H.afterNS[Z]=ie),H},{before:x[0],beforeNS:{},during:x[1],duringNS:{},after:x[2],afterNS:{}})})(B,M);return Promise.resolve(fs({action:m,data:{exact:S.before,namespaced:S.beforeNS},state:L,allPlugins:K,allMatches:S,instance:R,store:A,EVENTS:j})).then(function(I){function _(){var X=(function(){if(B.match(wr))return Promise.resolve(fs({action:te({},x,{type:re+"End"}),data:{exact:S.after,namespaced:S.afterNS},state:L,allPlugins:K,allMatches:S,instance:R,store:A,EVENTS:j})).then(function(Z){Z.meta&&Z.meta.hasCallback&&Yd(Z.meta.rid,{payload:Z})})})();return X&&X.then?X.then(function(){return I}):I}if(Rv(I,N.length))return I;var x,H=(function(){if(B!==re)return Promise.resolve(fs({action:te({},I,{type:re}),data:{exact:S.during,namespaced:S.duringNS},state:L,allPlugins:K,allMatches:S,instance:R,store:A,EVENTS:j})).then(function(X){x=X});x=I})();return H&&H.then?H.then(_):_()})}catch(I){return Promise.reject(I)}var O,q,F})(o,e,t,a,r)).then(function(m){var w=i(m);return s=1,w})})();return Promise.resolve(y&&y.then?y.then(u):u(y))}catch(m){return Promise.reject(m)}}}}}function fb(t){return function(e){return function(r){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 r(n);a===ee.setItem?t.setItem(i,o,s):t.removeItem(i,s)}return r(n)}}}}var db=function(){var t=this;this.before=[],this.after=[],this.addMiddleware=function(e,r){t[r]=t[r].concat(e)},this.removeMiddleware=function(e,r){var n=t[r].findIndex(function(a){return a===e});n!==-1&&(t[r]=[].concat(t[r].slice(0,n),t[r].slice(n+1)))},this.dynamicMiddlewares=function(e){return function(r){return function(n){return function(a){var i={getState:r.getState,dispatch:function(s){return r.dispatch(s)}},o=t[e].map(function(s){return s(i)});return Er.apply(void 0,o)(n)(a)}}}}};function hb(t){return function(e,r){e===void 0&&(e={});var n={};if(r.type==="initialize:aborted")return e;if(/^registerPlugin:([^:]*)$/.test(r.type)){var a=ih(r.type,"registerPlugin"),i=t()[a];if(!i||!a)return e;var o=r.enabled,s=i.config;return n[a]={enabled:o,initialized:!!o&&!i.initialize,loaded:!!o&&!!i.loaded({config:s}),config:s},te({},e,n)}if(/^initialize:([^:]*)$/.test(r.type)){var u=ih(r.type,ee.initialize),l=t()[u];return l&&u?(n[u]=te({},e[u],{initialized:!0,loaded:!!l.loaded({config:l.config})}),te({},e,n)):e}if(/^ready:([^:]*)$/.test(r.type))return n[r.name]=te({},e[r.name],{loaded:!0}),te({},e,n);switch(r.type){case ee.disablePlugin:return te({},e,oh(r.plugins,!1,e));case ee.enablePlugin:return te({},e,oh(r.plugins,!0,e));default:return e}}}function ih(t,e){return t.substring(e.length+1,t.length)}function oh(t,e,r){return t.reduce(function(n,a){return n[a]=te({},r[a],{enabled:e}),n},r)}function Ov(t){try{return JSON.parse(JSON.stringify(t))}catch{}return t}var pb={last:{},history:[]};function vb(t,e){t===void 0&&(t=pb);var r=e.options,n=e.meta;if(e.type===ee.track){var a=Ov(te({event:e.event,properties:e.properties},Object.keys(r).length&&{options:r},{meta:n}));return te({},t,{last:a,history:t.history.concat(a)})}return t}var mb={actions:[]};function gb(t,e){t===void 0&&(t=mb);var r=e.payload;switch(e.type){case"queue":var n;return n=r&&r.type&&r.type===ee.identify?[e].concat(t.actions):t.actions.concat(e),te({},t,{actions:n});case"dequeue":return[];default:return t}}var Cv=/#.*$/;function yb(t){var e=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(t);return"/"+(e&&e[3]?e[3].split("?")[0].replace(Cv,""):"")}var Av,$v,Uv,Lv,wb=function(t){if(t===void 0&&(t={}),!Ae)return t;var e=document,r=e.title,n=e.referrer,a=window,i=a.location,o=a.innerWidth,s=a.innerHeight,u=i.hash,l=i.search,c=(function(h){var d=(function(){if(Ae){for(var p,v=document.getElementsByTagName("link"),g=0;p=v[g];g++)if(p.getAttribute("rel")==="canonical")return p.getAttribute("href")}})();return d?d.match(/\?/)?d:d+h:window.location.href.replace(Cv,"")})(l),f={title:r,url:c,path:yb(c),hash:u,search:l,width:o,height:s};return n&&n!==""&&(f.referrer=n),te({},f,t)},bb={last:{},history:[]};function Sb(t,e){t===void 0&&(t=bb);var r=e.options;if(e.type===ee.page){var n=Ov(te({properties:e.properties,meta:e.meta},Object.keys(r).length&&{options:r}));return te({},t,{last:n,history:t.history.concat(n)})}return t}Av=(function(){if(!Ae)return!1;var t=navigator.appVersion;return~t.indexOf("Win")?"Windows":~t.indexOf("Mac")?"MacOS":~t.indexOf("X11")?"UNIX":~t.indexOf("Linux")?"Linux":"Unknown OS"})(),$v=Ae?document.referrer:null,Uv=Yw(),Lv=Xw();var sh={initialized:!1,sessionId:ua(),app:null,version:null,debug:!1,offline:!!Ae&&!navigator.onLine,os:{name:Av},userAgent:Ae?navigator.userAgent:"node",library:{name:As,version:"0.13.1"},timezone:Lv,locale:Uv,campaign:{},referrer:$v};function Ib(t,e){t===void 0&&(t=sh);var r=t.initialized,n=e.campaign;switch(e.type){case ee.campaign:return te({},t,{campaign:n});case ee.offline:return te({},t,{offline:!0});case ee.online:return te({},t,{offline:!1});default:return r?t:te({},sh,t,{initialized:!0})}}var Pb=["plugins","reducers","storage"];function Eb(t,e,r){if(Ae){var n=window[(r?"add":"remove")+"EventListener"];t.split(" ").forEach(function(a){n(a,e)})}}function kb(t){var e=Eb.bind(null,"online offline",function(r){return Promise.resolve(!navigator.onLine).then(t)});return e(!0),function(r){return e(!1)}}function qv(){return tr(As,[]),function(t){return function(e,r,n){var a=t(e,r,n),i=a.dispatch;return Object.assign(a,{dispatch:function(o){return Pr[Ir][As].push(o.action||o),i(o)}})}}}function ch(t){return function(){return Er(Er.apply(null,arguments),qv())}}function ps(t){return t?Iv(t)?t:[t]:[]}function uh(t,e,r){t===void 0&&(t={});var n,a,i=ua();return e&&(Vr[i]=(n=e,a=(function(o){for(var s,u=o||Array.prototype.slice.call(arguments),l=0;l<u.length;l++)if(He(u[l])){s=u[l];break}return s})(r),function(o){a&&a(o),n(o)})),te({},t,{rid:i,ts:new Date().getTime()},e?{hasCallback:!0}:{})}function _b(t){t===void 0&&(t={});var e=t.reducers||{},r=t.initialUser||{},n=(t.plugins||[]).reduce(function(I,_){if(He(_))return I.middlewares=I.middlewares.concat(_),I;if(_.NAMESPACE&&(_.name=_.NAMESPACE),!_.name)throw new Error("https://lytics.dev/errors/1");_.config||(_.config={});var x=_.EVENTS?Object.keys(_.EVENTS).map(function(Z){return _.EVENTS[Z]}):[];I.pluginEnabled[_.name]=!(_.enabled===!1||_.config.enabled===!1),delete _.enabled,_.methods&&(I.methods[_.name]=Object.keys(_.methods).reduce(function(Z,fe){var ae;return Z[fe]=(ae=_.methods[fe],function(){for(var ue=Array.prototype.slice.call(arguments),ie=new Array(ae.length),Te=0;Te<ue.length;Te++)ie[Te]=ue[Te];return ie[ie.length]=w,ae.apply({instance:w},ie)}),Z},{}),delete _.methods);var H=Object.keys(_).concat(x),X=new Set(I.events.concat(H));if(I.events=Array.from(X),I.pluginsArray=I.pluginsArray.concat(_),I.plugins[_.name])throw new Error(_.name+"AlreadyLoaded");return I.plugins[_.name]=_,I.plugins[_.name].loaded||(I.plugins[_.name].loaded=function(){return!0}),I},{plugins:{},pluginEnabled:{},methods:{},pluginsArray:[],middlewares:[],events:[]}),a=t.storage?t.storage:{getItem:er,setItem:tr,removeItem:Cr},i=(function(I){return function(_,x,H){return x.getState("user")[_]||(H&&ze(H)&&H[_]?H[_]:Zd(I)[_]||er(Us(_))||null)}})(a),o=n.plugins,s=n.events.filter(function(I){return!$s.includes(I)}).sort(),u=new Set(s.concat(Cn).filter(function(I){return!$s.includes(I)})),l=Array.from(u).sort(),c=function(){return o},f=new db,h=f.addMiddleware,d=f.removeMiddleware,p=f.dynamicMiddlewares,v=function(){throw new Error("Abort disabled inListener")},g=Qw(),P=Zd(a),b=te({},P,r,g.an_uid?{userId:g.an_uid}:{},g.an_aid?{anonymousId:g.an_aid}:{});b.anonymousId||(b.anonymousId=ua());var y=te({enable:function(I,_){return new Promise(function(x){S.dispatch({type:ee.enablePlugin,plugins:ps(I),_:{originalAction:ee.enablePlugin}},x,[_])})},disable:function(I,_){return new Promise(function(x){S.dispatch({type:ee.disablePlugin,plugins:ps(I),_:{originalAction:ee.disablePlugin}},x,[_])})}},n.methods),m=!1,w={identify:function(I,_,x,H){try{var X=Ct(I)?I:null,Z=ze(I)?I:_,fe=x||{},ae=w.user();tr(Us(kt),X);var ue=X||Z.userId||i(kt,w,Z);return Promise.resolve(new Promise(function(ie){S.dispatch(te({type:ee.identifyStart,userId:ue,traits:Z||{},options:fe,anonymousId:ae.anonymousId},ae.id&&ae.id!==X&&{previousId:ae.id}),ie,[_,x,H])}))}catch(ie){return Promise.reject(ie)}},track:function(I,_,x,H){try{var X=ze(I)?I.event:I;if(!X||!Ct(X))throw new Error("EventMissing");var Z=ze(I)?I:_||{},fe=ze(x)?x:{};return Promise.resolve(new Promise(function(ae){S.dispatch({type:ee.trackStart,event:X,properties:Z,options:fe,userId:i(kt,w,_),anonymousId:i(gr,w,_)},ae,[_,x,H])}))}catch(ae){return Promise.reject(ae)}},page:function(I,_,x){try{var H=ze(I)?I:{},X=ze(_)?_:{};return Promise.resolve(new Promise(function(Z){S.dispatch({type:ee.pageStart,properties:wb(H),options:X,userId:i(kt,w,H),anonymousId:i(gr,w,H)},Z,[I,_,x])}))}catch(Z){return Promise.reject(Z)}},user:function(I){if(I===kt||I==="id")return i(kt,w);if(I===gr||I==="anonId")return i(gr,w);var _=w.getState("user");return I?Hd(_,I):_},reset:function(I){return new Promise(function(_){S.dispatch({type:ee.resetStart},_,I)})},ready:function(I){return m&&I({plugins:y,instance:w}),w.on(ee.ready,function(_){I&&I(_),m=!0})},on:function(I,_){if(!I||!He(_))return!1;if(I===ee.bootstrap)throw new Error(".on disabled for "+I);var x=/Start$|Start:/;if(I==="*"){var H=function(ae){return function(ue){return function(ie){return ie.type.match(x)&&_({payload:ie,instance:w,plugins:o}),ue(ie)}}},X=function(ae){return function(ue){return function(ie){return ie.type.match(x)||_({payload:ie,instance:w,plugins:o}),ue(ie)}}};return h(H,wn),h(X,bn),function(){d(H,wn),d(X,bn)}}var Z=I.match(x)?wn:bn,fe=function(ae){return function(ue){return function(ie){return ie.type===I&&_({payload:ie,instance:w,plugins:o,abort:v}),ue(ie)}}};return h(fe,Z),function(){return d(fe,Z)}},once:function(I,_){if(!I||!He(_))return!1;if(I===ee.bootstrap)throw new Error(".once disabled for "+I);var x=w.on(I,function(H){_({payload:H.payload,instance:w,plugins:o,abort:v}),x()});return x},getState:function(I){var _=S.getState();return I?Hd(_,I):Object.assign({},_)},dispatch:function(I){var _=Ct(I)?{type:I}:I;if(Cn.includes(_.type))throw new Error("reserved action "+_.type);var x=te({},_,{_:te({originalAction:_.type},I._||{})});S.dispatch(x)},enablePlugin:y.enable,disablePlugin:y.disable,plugins:y,storage:{getItem:a.getItem,setItem:function(I,_,x){S.dispatch({type:ee.setItemStart,key:I,value:_,options:x})},removeItem:function(I,_){S.dispatch({type:ee.removeItemStart,key:I,options:_})}},setAnonymousId:function(I,_){w.storage.setItem(At,I,_)},events:{core:Cn,plugins:s}},R=n.middlewares.concat([function(I){return function(_){return function(x){return x.meta||(x.meta=uh()),_(x)}}},p(wn),lb(w,c,{all:l,plugins:s}),fb(a),ib(w),sb(w),p(bn)]),A={context:Ib,user:ob(a),page:Sb,track:vb,plugins:hb(c),queue:gb},j=Er,K=Er;if(Ae&&t.debug){var B=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;B&&(j=B({trace:!0,traceLimit:25})),K=function(){return arguments.length===0?qv():ze(typeof arguments[0])?ch():ch().apply(null,arguments)}}var re,L=(function(I){return Object.keys(I).reduce(function(_,x){return Pb.includes(x)||(_[x]=I[x]),_},{})})(t),M=n.pluginsArray.reduce(function(I,_){var x=_.name,H=_.config,X=_.loaded,Z=n.pluginEnabled[x];return I[x]={enabled:Z,initialized:!!Z&&!_.initialize,loaded:!!X({config:H}),config:H},I},{}),N={context:L,user:b,plugins:M},S=kv((function(I){for(var _=Object.keys(I),x={},H=0;H<_.length;H++){var X=_[H];typeof I[X]===_t&&(x[X]=I[X])}var Z,fe=Object.keys(x);try{(function(ae){Object.keys(ae).forEach(function(ue){var ie=ae[ue];if(typeof ie(void 0,{type:Cs})===gt||typeof ie(void 0,{type:rb})===gt)throw new Error(en+" "+ue+" "+gt)})})(x)}catch(ae){Z=ae}return function(ae,ue){if(ae===void 0&&(ae={}),Z)throw Z;for(var ie=!1,Te={},je=0;je<fe.length;je++){var Me=fe[je],qe=ae[Me],et=(0,x[Me])(qe,ue);if(typeof et===gt){var Pt=nb(Me,ue);throw new Error(Pt)}Te[Me]=et,ie=ie||et!==qe}return ie?Te:ae}})(te({},A,e)),N,K(j(ab.apply(void 0,R))));S.dispatch=(re=S.dispatch,function(I,_,x){var H=te({},I,{meta:uh(I.meta,_,ps(x))});return re.apply(null,[H])});var O=Object.keys(o);S.dispatch({type:ee.bootstrap,plugins:O,config:L,params:g,user:b,initialUser:r,persistedUser:P});var q=O.filter(function(I){return n.pluginEnabled[I]}),F=O.filter(function(I){return!n.pluginEnabled[I]});return S.dispatch({type:ee.registerPlugins,plugins:O,enabled:n.pluginEnabled}),n.pluginsArray.map(function(I,_){var x=I.bootstrap,H=I.config,X=I.name;x&&He(x)&&x({instance:w,config:H,payload:I}),S.dispatch({type:ee.registerPluginType(X),name:X,enabled:n.pluginEnabled[X],plugin:I}),n.pluginsArray.length===_+1&&S.dispatch({type:ee.initializeStart,plugins:q,disabled:F})}),kb(function(I){S.dispatch({type:I?ee.offline:ee.online})}),(function(I,_,x){setInterval(function(){return Tv(I,_,x)},3e3)})(S,c,w),w}var wn="before",bn="after",Vt="cookie",Ft=jv(),Nv=la,Tb=la;function xv(t){return Ft?la(t,"",-1):Cr(t)}function jv(){if(Ft!==void 0)return Ft;var t=Vt+Vt;try{la(t,t),Ft=document.cookie.indexOf(t)!==-1,xv(t)}catch{Ft=!1}return Ft}function la(t,e,r,n,a,i){if(typeof window<"u"){var o=arguments.length>1;return Ft===!1&&(o?tr(t,e):er(t)),o?document.cookie=t+"="+encodeURIComponent(e)+(r?"; expires="+new Date(+new Date+1e3*r).toUTCString()+(n?"; path="+n:"")+(a?"; domain="+a:"")+(i?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+t+"=")[1]||"").split(";")[0])}}var yt="localStorage",Rb=vc.bind(null,yt);Ar(yt,"getItem",er);Ar(yt,"setItem",tr);Ar(yt,"removeItem",Cr);var wt="sessionStorage",Ob=vc.bind(null,wt);Ar(wt,"getItem",er);Ar(wt,"setItem",tr);Ar(wt,"removeItem",Cr);function br(t){var e=t;try{if((e=JSON.parse(t))==="true")return!0;if(e==="false")return!1;if(ze(e))return e;parseFloat(e)===e&&(e=parseFloat(e))}catch{}if(e!==null&&e!=="")return e}var Cb=Rb(),Ab=Ob(),$b=jv();function Jt(t,e){if(t){var r=mc(e),n=!bc(r),a=gc(r)?br(localStorage.getItem(t)):void 0;if(n&&!mr(a))return a;var i=yc(r)?br(Nv(t)):void 0;if(n&&i)return i;var o=wc(r)?br(sessionStorage.getItem(t)):void 0;if(n&&o)return o;var s=er(t);return n?s:{localStorage:a,sessionStorage:o,cookie:i,global:s}}}function Mn(t,e,r){if(t&&!mr(e)){var n={},a=mc(r),i=JSON.stringify(e),o=!bc(a);return gc(a)&&(n[yt]=Sn(yt,e,br(localStorage.getItem(t))),localStorage.setItem(t,i),o)?n[yt]:yc(a)&&(n[Vt]=Sn(Vt,e,br(Nv(t))),Tb(t,i),o)?n[Vt]:wc(a)&&(n[wt]=Sn(wt,e,br(sessionStorage.getItem(t))),sessionStorage.setItem(t,i),o)?n[wt]:(n[Gt]=Sn(Gt,e,er(t)),tr(t,e),o?n[Gt]:n)}}function Ub(t,e){if(t){var r=mc(e),n=Jt(t,wv),a={};return!mr(n.localStorage)&&gc(r)&&(localStorage.removeItem(t),a[yt]=n.localStorage),!mr(n.cookie)&&yc(r)&&(xv(t),a[Vt]=n.cookie),!mr(n.sessionStorage)&&wc(r)&&(sessionStorage.removeItem(t),a[wt]=n.sessionStorage),!mr(n.global)&&fa(r,Gt)&&(Cr(t),a[Gt]=n.global),a}}function mc(t){return t?Ct(t)?t:t.storage:yv}function gc(t){return Cb&&fa(t,yt)}function yc(t){return $b&&fa(t,Vt)}function wc(t){return Ab&&fa(t,wt)}function bc(t){return t===wv||t==="all"}function fa(t,e){return t===yv||t===e||bc(t)}function Sn(t,e,r){return{location:t,current:e,previous:r}}var Lb={setItem:Mn,getItem:Jt,removeItem:Ub};function qb(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function lh(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function fh(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?lh(Object(r),!0).forEach(function(n){qb(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):lh(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Nb(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e={storage:Lb};return _b(fh(fh({},e),t))}function xb(t){if(typeof window>"u")return;const{addEventListener:e,history:r,location:n}=window;let a=n.pathname;e("popstate",()=>t(n.pathname)),["push","replace"].map(i=>{const o=`${i}State`;if(o!=="pushState"&&o!=="replaceState")return;const s=r[o];r[o]=function(...u){const l=u[2]?.toString()||"",c=Db(l);return a!==c&&(a=c,setTimeout(()=>t(l),0)),s.apply(r,u)}})}function jb(t,e){const r=t.indexOf(e);return r>-1?t.slice(0,r):t}function Db(t){return["#","?"].forEach(e=>t=jb(t,e)),t}function Mb(){xb(()=>{ht.page()})}var vs="up",ms="down";function Fb(t){if(t===void 0&&(t={}),!Ae)return Os;var e=hh(),r=Ls(),n=dh(),a=In(n,e),i=In(r,e),o=[],s=[],u=[],l=n,c=a,f=i,h=Object.keys(t);if(!h.length)return Os;var d=h.map(function(v){return Number(v)}),p=tb(function(){var v=hh(),g=(function(L,M){return M.map(function(N){return N===100?L-5:L*(N/100)})})(v,d),P=Ls(),b=dh(),y=In(b,v),m=In(P,v);if(c=y>c?y:c,f=m<f?m:f,!(o.length>=d.length)){var w=l===b,R=vs;w?R="initial":l<=b&&(R=ms);var A=g,j=d;(R===vs||w)&&(A=g.slice().reverse(),j=d.slice().reverse());var K=j.reduce(function(L,M,N){var S=A[N];return u.includes(M)&&b<=S&&(u=u.filter(function(O){return O!==M}),L.singleFunction=M),R===ms&&!o.includes(M)&&b>=S&&M>i?(s.push(M),L.callbacks=L.callbacks.concat(M),L):R===vs&&!o.includes(M)&&b<=S&&M<=y?(L.foundFunc=[M],L):(w&&b>=S&&L.foundFunc.length===0&&(L.foundFunc=[M]),!s.includes(M)&&b>=S&&(s.push(M),L.singleFunction?u.push(M):L.singleFunction=M),L)},{foundFunc:[],singleFunction:null,callbacks:[],direction:R});if(l=b,R===ms&&K.callbacks&&K.callbacks.forEach(function(L){He(t[L])&&(t[L]({trigger:L,direction:R,scrollMin:f,scrollMax:c,range:[f,c]}),o.push(L))}),K.singleFunction){var B=K.singleFunction,re=K.direction;He(t[B])&&t[B]({trigger:B,direction:re,scrollMin:f,scrollMax:c,range:[f,c]}),o.push(B)}}},500);return window.addEventListener("scroll",p),function(){return window.removeEventListener("scroll",p)}}function Ls(){return Ae?document.body.scrollTop||document.documentElement.scrollTop:0}function Kb(){return Ae?window.innerHeight||document.documentElement.clientHeight:0}function dh(){return Math.round(Ls()+Kb())}function hh(){if(!Ae)return 0;var t=document.body,e=document.documentElement;return Math.max(t.scrollHeight,t.offsetHeight,e.clientHeight,e.scrollHeight,e.offsetHeight)}function In(t,e){return Math.round(t/e*100)}var Sc="Event",ph=Sc+"Listener";function zb(t){return function(e,r,n,a){var i=n||Os,o=a||!1;if(!Ae)return i;var s=Fn(r),u=Fn(e,!0);if(!u.length)throw new Error("noElements");if(!s.length)throw new Error("no"+Sc);var l=[];return(function c(f){f&&(l=[]);for(var h=f?"add"+ph:"remove"+ph,d=0;d<u.length;d++){var p=u[d];l[d]=f?o&&o.once?Hb(i):i:l[d]||i;for(var v=0;v<s.length;v++)p[h]?p["on"+s[v]]=f?l[d]:null:p[h](s[v],l[d],o)}return c.bind(null,!f)})(t)}}function Fn(t,e){if(Ct(t))return e?Fn(document.querySelectorAll(t)):(r=t).split(r.indexOf(",")>-1?",":" ").map(function(o){return o.trim()});var r;if(NodeList.prototype.isPrototypeOf(t)){for(var n=[],a=t.length>>>0;a--;)n[a]=t[a];return n}var i=Zw(t);return e?i.map(function(o){return Ct(o)?Fn(o,!0):o}).flat():i}function Hb(t,e){var r;return function(){return t&&(r=t.apply(this,arguments),t=null),r}}var gs=zb(Sc);function Dv(t,e){return Ae&&He(window[t])?(r=window[t],n=e,(a=window)===void 0&&(a=null),He(r)?function(){r.apply(a,arguments),n.apply(a,arguments)}:n):window[t]=e;var r,n,a}Dv.bind(null,"onerror");Dv.bind(null,"onload");var Mv=typeof window>"u",vh="hidden";function Bb(t){if(Mv)return!1;var e=Gb(),r="".concat(e.replace(/[H|h]idden/,""),"visibilitychange"),n=function(){return t(!!document[e])},a=function(){return document.addEventListener(r,n)};return a(),function(){return document.removeEventListener(r,n),a}}function Gb(){var t=["webkit","moz","ms","o"];return Mv||vh in document?vh:t.reduce(function(e,r){var n=r+"Hidden";return!e&&n in document?n:e},null)}var Wb=["mousemove","mousedown","touchmove","touchstart","touchend","keydown"];function Vb(t,e){e===void 0&&(e={});var r=(function(o,s){var u=this,l=!1;return function(c){l||(o.call(u,c),l=!0,setTimeout(function(){return l=!1},s))}})(t,e.throttle||1e4),n=[];function a(){var o=Bb(function(s){s||r({type:"tabVisible"})});return n=[o].concat(Wb.map(function(s){return gs(document,s,r)})).concat(gs(window,"load",r)).concat(gs(window,"scroll",r,{capture:!0,passive:!0})),i}function i(){n.map(function(o){return o()})}return a(),function(){return i(),a}}function Jb(t){var e,r,n=t.onIdle,a=t.onWakeUp,i=t.onHeartbeat,o=t.timeout,s=o,u=t.throttle,l=u===void 0?2e3:u,c=!1,f=!1,h=new Date,d=function(){return clearTimeout(e)};function p(g){d(),i&&!c&&i(Kr(h),g),a&&c&&(c=!1,a(Kr(r),g),h=new Date),e=setTimeout(function(){c=!0,n&&(r=new Date,n(Kr(h),g))},s)}var v=Vb(p,{throttle:l});return{disable:function(){f=!0,c=!1,d();var g=v();return function(){return f=!1,h=new Date,p({type:"load"}),g()}},getStatus:function(){return{isIdle:c,isDisabled:f,active:c?0:Kr(h,f),idle:c?Kr(r,f):0}}}}function Kr(t,e){return e?0:Math.round((new Date-t)/1e3)}const mh=5e3;class Zb{element;isInViewport=!1;isAwake=!1;isFlushing;observer;lastEventAt=Date.now();registeredView=!1;viewCallback;activeDurationCallback;idleDurationCallback;scrollCallback;constructor(e){this.element=e.element,this.viewCallback=e.viewCallback,this.activeDurationCallback=e.activeDurationCallback,this.idleDurationCallback=e.idleDurationCallback,this.scrollCallback=e.scrollCallback,this.observer=new IntersectionObserver(r=>{r.forEach(n=>{this.handleInViewPort(n.isIntersecting)})},{threshold:0}),this.observer.observe(this.element),Jb({onIdle:r=>this.handleAwake(!1,r),onWakeUp:r=>this.handleAwake(!0,r),timeout:mh}),Fb({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(e){e?(this.isAwake=!0,this.trackInViewport()):this.handleAwake(!1),this.isInViewport=e}handleAwake(e,r=Math.round((Date.now()-this.lastEventAt)/1e3)){this.isAwake=e,this.lastEventAt=e?Date.now()-r*mh:Date.now(),this.isInViewport&&this.trackAwake(e,r)}handleScroll(e){this.scrollCallback&&this.scrollCallback(e)}handleVisibilityChange(){this.isAwake=!1;const e=Math.round((Date.now()-this.lastEventAt)/1e3);e>1&&(this.lastEventAt=Date.now(),this.trackAwake(!1,e))}trackAwake(e,r){!e&&this.activeDurationCallback&&this.activeDurationCallback(r,this.isFlushing,this.lastEventAt),e&&this.idleDurationCallback&&this.idleDurationCallback(r,this.isFlushing,this.lastEventAt)}trackInViewport(){this.registeredView||(this.registeredView=!0,this.viewCallback&&this.viewCallback())}}function Fv(t){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):t()}function Yb(t,e){e=e||{};var r,n,a=[],i=e.max||1/0;function o(){clearInterval(r),t(a.splice(0,i)),s()}function s(){r=setInterval(o,e.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(r)}}}const gh="sesamy_session_id";function Xb(){let t=sessionStorage.getItem(gh);return t||(t=Math.random().toString(36).slice(2,9),sessionStorage.setItem(gh,t)),t}let Kv=!1,An,Kn,qs;function zv(t){return JSON.stringify(t.map(e=>{const{campaign:r,...n}=e.properties||{};return{anonymousId:e.anonymousId,userId:e.userId,type:e.type,properties:n,clientId:qs,requestId:Math.random().toString(36).slice(2,9),sessionId:Xb(),timestamp:new Date().toISOString(),version:fn,event:e.event,context:{...e.context,page:{url:window.location.href,title:document.title,referrer:document.referrer,itemSrc:ge("sesamy:item-src"),publisherContentId:ge("sesamy:publisher-content-id")},campaign:r,locale:navigator.language,library:dc,userAgent:navigator.userAgent,clientId:qs}}}))}const Hv=Yb(async t=>{if(t.length>0){const e=zv(t);Kv?navigator.sendBeacon(Kn,e):(await fetch(Kn,{method:"POST",body:e,headers:{"Content-Type":"text/plain"}})).ok}},{max:10,interval:3e3});function ys(t){if(t.anonymousId)if(t.properties?.flushing){const e={...t};delete e.properties.flushing,navigator.sendBeacon(Kn,zv([e]))}else Hv.push(t)}function Qb(){return Kv=!0,Hv.flush()}function eS(t,e,r){An=e,Kn=`${rt("logs",r)}/events`,qs=t}const tS={name:"custom-analytics-plugin",page:({payload:t})=>{if(!An)return;const{properties:e,anonymousId:r,userId:n,event:a}=t;ys({anonymousId:r,userId:n,properties:e,event:a,type:"page"})},track:({payload:t})=>{if(!An)return;const{properties:e,anonymousId:r,userId:n,event:a}=t;ys({anonymousId:r,userId:n,properties:e,event:a,type:"track"})},identify:({payload:t})=>{if(!An)return;const{properties:e,anonymousId:r,userId:n}=t;ys({anonymousId:r,userId:n,properties:e,type:"identify"})}},yh=["source","medium","campaign","term","content"],Tt="utm_",rS=1800*1e3;function Bv(t){return t?Date.now()-parseInt(t,10)>rS:!0}function wh(){const t=document.referrer||"";if(!t)return;const e=Jt(`${Tt}set_at`);(Bv(e)||!Jt(`${Tt}referrer`))&&Mn(`${Tt}referrer`,t)}function nS(){const t=()=>{const r={};for(const a of yh){const i=Jt(`${Tt}${a}`);i&&(r[`utm_${a}`]=i)}const n=Jt(`${Tt}referrer`);return n&&(r.utm_referrer=n),r};return{name:"attribution-tracking",initialize(){wh()},campaign({payload:r}){const n=r?.campaign||{},a=Jt(`${Tt}set_at`);if(Object.keys(n).length>0&&Bv(a)){for(const o of yh){const s=n[o];s&&Mn(`${Tt}${o}`,s)}Mn(`${Tt}set_at`,String(Date.now()))}wh()},page({payload:r}){return r.properties.campaign=t(),r},track({payload:r}){return r.properties.campaign=t(),r},getStoredCampaignData:t}}const aS=nS(),bh=new Map,Sh=new Map;function iS({clientId:t,enabled:e=!0,environment:r}){eS(t,e,r),e&&(window.addEventListener("beforeunload",()=>{Sh.forEach((n,a)=>{n.bind(a)()}),Qb()}),window.addEventListener("visibilitychange",()=>{document.visibilityState!=="visible"&&bh.forEach((n,a)=>{n.bind(a)()})}),Mb(),Fv(()=>{const n=new Zb({element:document.body,viewCallback:()=>{ht.page()},activeDurationCallback:(a,i,o)=>{ht.track("activeDuration",{duration:a,durationStart:o,flushing:i})},idleDurationCallback:(a,i,o)=>{ht.track("idleDuration",{duration:a,durationStart:o,flushing:i})},scrollCallback:a=>{ht.track("scroll",{scroll:a.scrollMax})}});Sh.set(document.body,()=>{n.flush()}),bh.set(document.body,()=>{n.handleVisibilityChange()})}),window.addEventListener(Ge.AUTHENTICATED,async n=>{const a=n;await ht.identify(a.detail.sub)}),window.addEventListener(Ge.LOGOUT,async()=>{await ht.track("logout",{}),await ht.reset()}))}const ht=Nb({app:dc,version:fn,plugins:[aS,tS]});function Gv(t,e){ht.track(t,e)}const oS=["AdHeader","AdContainer","AD_Top","homead","ad-lead"];function Wv(){return new Promise(t=>{const e=oS.map(r=>{const n=document.createElement("div");return n.innerHTML="&nbsp;",n.id=r,n.style.position="absolute",document.body.appendChild(n),n});window.setTimeout(()=>{const r=!e.every(n=>document.querySelector(`#${n.id}`)?.offsetParent);e.forEach(n=>n.remove()),t(r)},100)})}function Vv(){const t=navigator.userAgent.toLowerCase(),e=[{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 r of e)if(r.regex.test(t))return{isInAppBrowser:!0,browserName:r.name};return/; wv\)/.test(t)?{isInAppBrowser:!0,browserName:"Unknown In-App Browser"}:{isInAppBrowser:!1,browserName:null}}function sS(t,e,r=!1){const n={name:t,data:e},a=new CustomEvent(t,{detail:n,cancelable:r,bubbles:!0});Gv(`event:${t}`,{...e,timestamp:new Date().toISOString()});const i=window.dispatchEvent(a);return r&&!i?{canceled:!0,message:n.cancellationMessage}:{canceled:!1}}function cS(t,e){t.cancelable&&(t.detail.cancellationMessage=e,t.preventDefault())}const uS=["sesamy","__sesamy","__anon_id","auth0","a0","_legacy_auth0"],lS=["access_token","id_token","refresh_token","token"];function Ns(t){const e=t.split(".");return e.length===3?`${e[0]}.${e[1]}.[REDACTED]`:t}function Jv(t){const e=t.toLowerCase();return lS.some(r=>e.includes(r))}function Zv(t){const e=t.split(".");return e.length===3&&e.every(r=>r.length>0)}function Ih(t){const e=[];for(let r=0;r<t.length;r++){const n=t.key(r);if(!n)continue;if(uS.some(i=>n.toLowerCase().startsWith(i.toLowerCase()))){let i=t.getItem(n)||"",o=!1;(Jv(n)||Zv(i))&&(i=Ns(i),o=!0);try{const s=JSON.parse(i);if(typeof s=="object"&&s!==null){const u=xs(s);u.wasRedacted&&(i=JSON.stringify(u.value),o=!0)}}catch{}e.push({key:n,value:i,redacted:o})}}return e}function xs(t){if(t==null)return{value:t,wasRedacted:!1};if(typeof t=="string")return Zv(t)?{value:Ns(t),wasRedacted:!0}:{value:t,wasRedacted:!1};if(Array.isArray(t)){let e=!1;return{value:t.map(n=>{const a=xs(n);return a.wasRedacted&&(e=!0),a.value}),wasRedacted:e}}if(typeof t=="object"){let e=!1;const r={};for(const[n,a]of Object.entries(t))if(Jv(n)&&typeof a=="string")r[n]=Ns(a),e=!0;else{const i=xs(a);i.wasRedacted&&(e=!0),r[n]=i.value}return{value:r,wasRedacted:e}}return{value:t,wasRedacted:!1}}function fS(){const t=navigator;return{userAgent:t.userAgent,platform:t.platform,language:t.language,languages:[...t.languages||[]],cookiesEnabled:t.cookieEnabled,onLine:t.onLine,hardwareConcurrency:t.hardwareConcurrency,deviceMemory:t.deviceMemory,maxTouchPoints:t.maxTouchPoints,vendor:t.vendor,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,screenWidth:screen.width,screenHeight:screen.height,pixelRatio:window.devicePixelRatio,colorDepth:screen.colorDepth,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,timezoneOffset:new Date().getTimezoneOffset()}}async function dS(){await Hp();const[t]=await Promise.all([Wv()]),e=Vv();return{adBlockEnabled:t,incognitoMode:na()??!1,inAppBrowser:e.isInAppBrowser}}async function Yv(t){const e=[],r={timestamp:new Date().toISOString(),sdkVersion:fn,clientId:t.clientId,fallbackId:t.fallbackId};r.pageUrl=window.location.href,r.pageTitle=document.title;try{r.browser=fS()}catch(a){e.push(`Browser info collection failed: ${a.message}`)}try{r.detection=await dS()}catch(a){e.push(`Detection collection failed: ${a.message}`)}try{r.localStorage=Ih(localStorage)}catch(a){e.push(`LocalStorage collection failed: ${a.message}`)}try{r.sessionStorage=Ih(sessionStorage)}catch(a){e.push(`SessionStorage collection failed: ${a.message}`)}if(await Ot()){try{const a=await pt(!1);if(a){const i=a.split(".");if(i.length>=2){const o=JSON.parse(atob(i[1]));r.userId=o.sub}}}catch(a){e.push(`User ID extraction failed: ${a.message}`)}if(t.getProfile)try{r.profile=await t.getProfile()||void 0}catch(a){e.push(`Profile collection failed: ${a.message}`)}if(t.getEntitlements)try{r.entitlements=await t.getEntitlements()}catch(a){e.push(`Entitlements collection failed: ${a.message}`)}if(t.getContracts)try{r.contracts=await t.getContracts()}catch(a){e.push(`Contracts collection failed: ${a.message}`)}if(t.getTags)try{r.tags=await t.getTags()}catch(a){e.push(`Tags collection failed: ${a.message}`)}if(t.getTallies)try{r.tallies=await t.getTallies()}catch(a){e.push(`Tallies collection failed: ${a.message}`)}}return e.length>0&&(r.errors=e),r}async function hS(t,e,r){const a=`${rt("api2",e)}/diagnostics`,i={"Content-Type":"application/json"};if(await Ot())try{const s=await pt(!1);s&&(i.Authorization=`Bearer ${s}`)}catch{}if(!i.Authorization&&r){const s=localStorage.getItem("__anon_id")?.replace(/"/g,"")||"",u=btoa(`${r}|${s}:`);i.Authorization=`Basic ${u}`}const o=await fetch(a,{method:"POST",headers:i,body:JSON.stringify(t)});if(!o.ok){const s=await o.text();throw new Error(`Failed to submit diagnostics: ${s}`)}return o.json()}const Ph="user-diagnostics",Eh="diagnostics-id",pS=`
34
+ **/var _s={d:(t,e)=>{for(var r in e)_s.o(e,r)&&!_s.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},hc={};_s.d(hc,{A:()=>Oy,k:()=>pc});var jr=function(t,e,r,n){return new(r||(r=Promise))(function(a,i){function o(l){try{u(n.next(l))}catch(c){i(c)}}function s(l){try{u(n.throw(l))}catch(c){i(c)}}function u(l){var c;l.done?a(l.value):(c=l.value,c instanceof r?c:new r(function(f){f(c)})).then(o,s)}u((n=n.apply(t,[])).next())})},Dr=function(t,e){var r,n,a,i,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(u){return function(l){return(function(c){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&c[0]?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,n=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(a=o.trys,!((a=a.length>0&&a[a.length-1])||c[0]!==6&&c[0]!==2)){o=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(c[0]===6&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=e.call(t,o)}catch(f){c=[6,f],n=0}finally{r=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}})([u,l])}}};function pc(){return jr(this,void 0,Promise,function(){return Dr(this,function(t){switch(t.label){case 0:return[4,new Promise(function(e,r){var n="Unknown",a=!1;function i(h){a||(a=!0,e({isPrivate:h,browserName:n}))}function o(){var h=0,d=parseInt("-1");try{d.toFixed(d)}catch(p){h=p.message.length}return h}function s(){return jr(this,void 0,void 0,function(){var h,d;return Dr(this,function(p){switch(p.label){case 0:return p.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return p.sent(),i(!1),[3,3];case 2:return h=p.sent(),d=h instanceof Error&&typeof h.message=="string"?h.message:String(h),i(d.includes("unknown transient reason")),[3,3];case 3:return[2]}})})}function u(){var h;return jr(this,void 0,Promise,function(){return Dr(this,function(d){switch(d.label){case 0:return typeof((h=navigator.storage)===null||h===void 0?void 0:h.getDirectory)!="function"?[3,2]:[4,s()];case 1:return d.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?(function(){var p=String(Math.random());try{var v=indexedDB.open(p,1);v.onupgradeneeded=function(g){var P=g.target.result,b=function(y){i(y)};try{P.createObjectStore("t",{autoIncrement:!0}).put(new Blob),b(!1)}catch(y){(y instanceof Error&&typeof y.message=="string"?y.message:String(y)).includes("are not yet supported")?b(!0):b(!1)}finally{P.close(),indexedDB.deleteDatabase(p)}},v.onerror=function(){return i(!1)}}catch{i(!1)}})():(function(){var p=window.openDatabase,v=window.localStorage;try{p(null,null,null,null)}catch{return void i(!0)}try{v.setItem("test","1"),v.removeItem("test")}catch{return void i(!0)}i(!1)})(),d.label=3;case 3:return[2]}})})}function l(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(h,d){var p=Math.round(d/1048576),v=2*Math.round((function(){var g,P,b,y=window;return(b=(P=(g=y?.performance)===null||g===void 0?void 0:g.memory)===null||P===void 0?void 0:P.jsHeapSizeLimit)!==null&&b!==void 0?b:1073741824})()/1048576);i(p<v)},function(h){r(new Error("detectIncognito somehow failed to query storage quota: "+h.message))})}function c(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?l():(0,window.webkitRequestFileSystem)(0,1,function(){i(!1)},function(){i(!0)})}function f(){var h;return jr(this,void 0,Promise,function(){var d,p,v;return Dr(this,function(g){switch(g.label){case 0:if(typeof((h=navigator.storage)===null||h===void 0?void 0:h.getDirectory)!="function")return[3,5];g.label=1;case 1:return g.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return g.sent(),i(!1),[3,4];case 3:return d=g.sent(),p=d instanceof Error&&typeof d.message=="string"?d.message:String(d),i(p.includes("Security error")),[2];case 4:return[3,6];case 5:(v=indexedDB.open("inPrivate")).onerror=function(P){v.error&&v.error.name==="InvalidStateError"&&P.preventDefault(),i(!0)},v.onsuccess=function(){indexedDB.deleteDatabase("inPrivate"),i(!1)},g.label=6;case 6:return[2]}})})}(function(){return jr(this,void 0,Promise,function(){return Dr(this,function(h){switch(h.label){case 0:return o()!==44&&o()!==43?[3,2]:(n="Safari",[4,u()]);case 1:return h.sent(),[3,6];case 2:return o()!==51?[3,3]:(d=navigator.userAgent,n=d.match(/Chrome/)?navigator.brave!==void 0?"Brave":d.match(/Edg/)?"Edge":d.match(/OPR/)?"Opera":"Chrome":"Chromium",c(),[3,6]);case 3:return o()!==25?[3,5]:(n="Firefox",[4,f()]);case 4:return h.sent(),[3,6];case 5:navigator.msSaveBlob!==void 0?(n="Internet Explorer",i(window.indexedDB===void 0)):r(new Error("detectIncognito cannot determine the browser")),h.label=6;case 6:return[2]}var d})})})().catch(r)})];case 1:return[2,t.sent()]}})})}typeof window<"u"&&(window.detectIncognito=pc);const Oy=pc;hc.A;const Cy=hc.k,kn="sesamy_incognito_mode";function aa(){try{const t=sessionStorage.getItem(kn);return t===null?void 0:t==="true"}catch{return}}async function iv(){try{const t=sessionStorage.getItem(kn);if(t!==null)return t==="true";const{isPrivate:e}=await Cy();return sessionStorage.setItem(kn,e.toString()),e}catch{try{sessionStorage.setItem(kn,"false")}catch{}return!1}}function Yt(){return typeof window<"u"}function Ay(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function $y(){return/android/i.test(navigator.userAgent)}let Te,vc,Xr,Rs=!1,Tn=!1,_n=!1;Yt()&&window.addEventListener("pageshow",()=>{Tn=!1,_n=!1});const Xt="sesamyAccessToken",Kr="sesamyRefreshToken",Un="sesamySilentAuthThrottle",ov="sesamy_is_authenticated",mc="sesamySilentRedirectState",Ly=300*1e3,sv=60,Uy=["login_required","consent_required","interaction_required","timeout","Timeout","access_denied"];function cv(){if(!Yt())return!1;try{const t=document.cookie.split(";").map(a=>a.trim());if(t.some(a=>a.startsWith(`${ov}=true`))||t.some(a=>a.startsWith("auth0.is.authenticated=true")))return!0;const n=Object.keys(localStorage).filter(a=>a.startsWith("@@auth0spajs@@"));if(n.length>0)for(const a of n)try{const i=JSON.parse(localStorage.getItem(a)||"{}");if(i?.body?.access_token||i?.body?.refresh_token)return!0}catch{}return!1}catch(t){return H(`Error checking session hint cookie: ${t.message}`),!1}}function ln(t){if(Yt())try{const e=t?2592e3:0,r=window.location.protocol==="https:"?"; Secure":"";document.cookie=`${ov}=${t}; path=/; max-age=${e}; SameSite=Lax${r}`}catch(e){H(`Error setting session hint cookie: ${e.message}`)}}function Rn(){ln(!1)}function xy(){try{sessionStorage.setItem(mc,JSON.stringify({timestamp:Date.now()}))}catch{H("Failed to set silent redirect state")}}function On(){try{const t=sessionStorage.getItem(mc);if(t)return JSON.parse(t)}catch{}return null}function Qr(){try{sessionStorage.removeItem(mc)}catch{}}function qy(t){const e=t.message||"";return Uy.some(r=>e.includes(r)||t.error===r)}async function ia(){return Rs?!0:new Promise((t,e)=>{const r=setTimeout(()=>{Rs?t(!0):e(new Error("Initialization failed: Timeout"))},2e3);window.addEventListener(We.AUTH_INITIALIZED,()=>{clearTimeout(r),t(!0)})})}async function Ny(t){if(!t)return null;const e=localStorage.getItem(Kr);if(!e)return H("No refresh token found in localstorage"),null;const r=new URLSearchParams;r.set("client_id",t.iss),r.set("refresh_token",e),r.set("grant_type","refresh_token");const n=new URL(t.iss);n.pathname="/oauth/token",n.searchParams.set("user_id",t.sub);try{const a=await fetch(n.href,{body:r.toString(),method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"}});if(!a.ok){const o=await a.text().catch(()=>"Unknown error");throw H(`Token refresh failed with status ${a.status}: ${o}`),localStorage.removeItem(Kr),new Error(`Renew token failed: ${a.status}`)}const i=await a.json();if(!i.access_token)throw H("Token refresh response missing access_token"),new Error("Invalid token response");return i.refresh_token&&localStorage.setItem(Kr,i.refresh_token),localStorage.setItem(Xt,i.access_token),i.access_token}catch(a){return H(`Token refresh error: ${a.message}`),localStorage.removeItem(Kr),localStorage.removeItem(Xt),await yc(),null}}async function gc(){const t=localStorage.getItem(Xt);if(!t)return null;const e=wc(t),r=Date.now()/1e3;if(!e||!e.exp||e.exp<r+sv){const n=await Ny(e);return n||(localStorage.removeItem(Xt),null)}return t}let mn=null;const jy=64;function Dy(){try{if(mn!==null)return mn;const e=Object.keys(localStorage).filter(r=>r.startsWith("@@auth0spajs@@"));for(const r of e){const n=JSON.parse(localStorage.getItem(r)||"{}");let a;if(typeof n=="object"&&(n.body&&typeof n.body=="object"&&"refresh_token"in n.body?a=n.body.refresh_token:"refresh_token"in n&&(a=n.refresh_token)),a&&typeof a=="string"&&a.length===jy)return mn=!0,!0}}catch(t){H(`Error checking for existing auth0 tokens: ${t.message}`)}return mn=!1,!1}function My(t){if(t.domains&&t.domains.length>0){const e=zt(window.location.href);if(e){for(const r of t.domains)if(zt(`https://${r}`)===e)return H(`Found matching domain in domains array: ${r} for TLD: ${e}`),r;H(`No matching domain found in domains array for TLD: ${e}`)}}if(t.domain)return H(`Using fallback domain property: ${t.domain}`),t.domain}function zt(t){try{const e=new URL(t).hostname,r=e.split(".");if(r.length<=1)return e;const n=["co.uk","com.au","co.nz","co.za","com.br","co.jp","gov.uk","ac.uk","org.uk","net.uk","com.sg","com.my","co.in","co.id","co.th","co.kr","com.mx","com.ar","com.co","com.pe","com.ph","com.pk","com.sa","com.eg","com.ng","co.ke","co.tz","co.zw","co.bw","co.mz","gov.au","edu.au","org.au","net.au","asn.au","id.au"];for(const a of n)if(e.endsWith(`.${a}`)){const i=a.split(".").length+1;return r.slice(-i).join(".")}return r.slice(-2).join(".")}catch{return null}}async function Fy(t){if(t.enabled===!1)return;vc=t.organization;const e=My(t);Xr=e&&!Dy()?e:av("token",t.environment);const r=zt(window.location.href)!==zt(`https://${Xr}`),n=zt(window.location.href),a=n?`.${n}`:void 0,i={domain:Xr,clientId:t.clientId,useCookiesForTransactions:!0,legacySameSiteCookie:!1,...a&&{cookieDomain:a}};i.cacheLocation="localstorage",(r||t.useRefreshTokens)&&(i.useRefreshTokens=!0),H(`Initializing auth0 client: ${JSON.stringify(i)}`),Te=await ky(i);const o=new URLSearchParams(window.location.search),s=o.get("code"),u=o.get("state"),l=o.get("error");if(l){const c=o.get("error_description");H(`Auth error in URL: ${l}${c?` - ${c}`:""}`);const f=new URL(location.href);f.searchParams.delete("error"),f.searchParams.delete("error_description"),f.searchParams.delete("state"),window.history.replaceState({},document.title,f.toString());const h=On();if(h&&Qr(),l==="login_required")H("Silent redirect returned login_required - user is not authenticated"),Rn();else if(h)H(`Silent redirect returned ${l} - treating as unauthenticated`),Rn();else{const d=c||`Authentication failed: ${l}`;H(`Non-silent auth error, alerting user: ${d}`),setTimeout(()=>{alert(d)},0)}}if(s)if(window.opener)H("Code found in URL, posting to opener"),window.opener.postMessage({type:"authorization_response",response:{code:s,state:u}},window.location.origin);else{H("Code found in URL, handling redirect");const c=window.location.href,f=new URL(location.href),h=f.searchParams;h.delete("code"),h.delete("state"),f.search=h.toString(),window.history.replaceState({},document.title,f.toString()),H("Rewrote url to remove code and state");try{const d=await Te.handleRedirectCallback(c);H(`Login result: ${JSON.stringify(d)}`);const p=await Te.getUser();if(!p)throw H("No user found"),new Error("No user found");H(`User found ${JSON.stringify(p)}`),sa(),On()&&(H("Successfully recovered session via prompt=none redirect"),Qr()),ln(!0),H(`Triggering AUTHENTICATED event with appState: ${JSON.stringify(d.appState)}`),Zt(We.AUTHENTICATED,{...p,appState:d.appState})}catch(d){H(`Error handling redirect: ${d.message}`),On()?(Qr(),Rn(),H("Silent redirect failed, cleared session hints")):alert("There was an error logging in"),console.error(d)}}Rs=!0,Zt(We.AUTH_INITIALIZED,{})}async function Ot(){if(await ia(),await gc())return!0;if(!Te)return!1;const e=await Te.isAuthenticated();return e&&ln(!0),e}async function By(){return await ia(),await gc()?(H("Using local user"),{sub:"local",name:"Local User"}):Te?Te.getUser():null}function uv(t){if(Tn)return H("Login already in progress"),null;if(Tn=!0,setTimeout(()=>{Tn=!1},3e3),localStorage.removeItem(Xt),!Te)throw new Error("Auth0 client not initialized");const e=t?.authorizationParams||{};return{...t,authorizationParams:{organization:vc,redirect_uri:window.location.href,ui_locales:Yr(),incognito:aa(),...e}}}async function oa(t){const e=uv(t);if(e)return Te.loginWithRedirect(e)}async function lv(t){const e=uv(t);if(!e)return;await Te.loginWithPopup(e,{timeoutInSeconds:1800}),sa(),ln(!0);const r=await Te.getUser();if(!r)throw H("No user found after popup login"),new Error("No user found");const n=new CustomEvent(We.AUTHENTICATED,{detail:{...r,appState:t?.appState},composed:!0,bubbles:!0});window.dispatchEvent(n)&&window.location.reload()}function Ky(){if(!Xr)return!1;const t=zt(window.location.href),e=zt(`https://${Xr}`);return t!==e}async function zy(t){return Ky()&&(Ay()||$y()||aa())?(H("Using popup login for cross-domain auth on Safari/Android/Incognito"),lv(t)):(H("Using redirect login"),oa(t))}function Hy(){try{const t=sessionStorage.getItem(Un);if(!t)return!1;const{timestamp:e}=JSON.parse(t);return Date.now()-e<Ly}catch{return sessionStorage.removeItem(Un),!1}}function Wy(){try{const t={timestamp:Date.now()};sessionStorage.setItem(Un,JSON.stringify(t))}catch{H("Failed to set silent auth throttle in sessionStorage")}}function sa(){try{sessionStorage.removeItem(Un)}catch{}}async function Gy(){if(_n){H("Silent redirect already in progress");return}if(!cv()){H("No session hint cookie - skipping prompt=none redirect for anonymous user");return}const t=On();if(t&&Date.now()-t.timestamp<3e4){H("Recently attempted silent redirect, skipping to prevent loop");return}H("Attempting prompt=none redirect to recover session"),_n=!0,xy();try{await Te.loginWithRedirect({authorizationParams:{prompt:"none",redirect_uri:window.location.href,organization:vc}})}catch(e){H(`Prompt=none redirect failed: ${e.message}`),_n=!1,Qr()}}async function pt(t=!0,e=!1){await ia();const r=await gc();if(r)return r;if(!e&&Hy()){if(H("Silent auth is throttled due to recent failures, skipping request"),t)throw new Error("Silent auth throttled");return null}try{if(!Te)return H("Auth client not initialized"),null;let n=await Te.getTokenSilently();const a=wc(n),i=Date.now()/1e3;return e&&a?.exp&&a.exp-i<3600+sv&&(n=await Te.getTokenSilently({cacheMode:"off"})),sa(),ln(!0),n}catch(n){const a=n;if(H(`Failed to get token silently: ${a.message}`),qy(a)){if(H("Iframe-based auth blocked by browser privacy restrictions"),cv())return H("Session hint present - attempting prompt=none redirect recovery"),await Gy(),null;H("No session hint - user is likely anonymous, not attempting redirect")}if(Wy(),await Te.isAuthenticated()&&(a.message==="Invalid refresh token"||a.message.includes("Missing Refresh Token"))&&await yc(),t)throw n;return null}}async function yc(t={}){if(await ia(),localStorage.removeItem(Xt),localStorage.removeItem(Kr),Rn(),Qr(),sa(),Zt(We.LOGOUT,{}),!!Te)return H(`Logout with options: ${JSON.stringify(t)}`),Te.logout({...t,logoutParams:{returnTo:window.location.href,...t.logoutParams}})}function wc(t){const e=t.split(".");if(e.length!==3)return null;const n=e[1].replace(/-/g,"+").replace(/_/g,"/"),a=decodeURIComponent(atob(n).split("").map(function(i){return"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(a)}async function Os(t){const e=wc(t);if(!e||!e.exp||e.exp<new Date().getTime()/1e3)throw new Error("Invalid token");H("Set token"),localStorage.setItem(Xt,t),Zt(We.AUTHENTICATED,{...e,appState:void 0})}const Vy=(t,e)=>e.skipDedupe||e.method!=="GET",Jy=(t,e)=>e.method+"@"+t,Zy=t=>t.clone(),Yy=({skip:t=Vy,key:e=Jy,resolver:r=Zy}={})=>{const n=new Map;return a=>(i,o)=>{if(t(i,o))return a(i,o);const s=e(i,o);if(!n.has(s))n.set(s,[]);else return new Promise((u,l)=>{n.get(s).push([u,l])});try{return a(i,o).then(u=>(n.get(s).forEach(([l])=>l(r(u))),n.delete(s),u)).catch(u=>{throw n.get(s).forEach(([,l])=>l(u)),n.delete(s),u})}catch(u){return n.delete(s),Promise.reject(u)}}},Xy=(t,e)=>t*e,Qy=t=>t&&t.ok,ew=({delayTimer:t=500,delayRamp:e=Xy,maxAttempts:r=10,until:n=Qy,onRetry:a=null,retryOnNetworkError:i=!1,resolveWithLatestResponse:o=!1,skip:s}={})=>u=>(l,c)=>{let f=0;if(s&&s(l,c))return u(l,c);const h=(d,p)=>Promise.resolve(n(d,p)).then(v=>v?d&&o?d:p?Promise.reject(p):d:(f++,!r||f<=r?new Promise(g=>{const P=e(t,f);setTimeout(()=>{typeof a=="function"?Promise.resolve(a({response:d,error:p,url:l,options:c})).then((b={})=>{var y,m;g(u((y=b&&b.url)!==null&&y!==void 0?y:l,(m=b&&b.options)!==null&&m!==void 0?m:c))}):g(u(l,c))},P)}).then(h).catch(g=>{if(!i)throw g;return h(null,g)}):d&&o?d:Promise.reject(p||new Error("Number of attempts exceeded."))));return u(l,c).then(h).catch(d=>{if(!i)throw d;return h(null,d)})};let ss=class fv extends Error{status;statusText;url;body;constructor(e,r,n,a,i){super(a),this.name="APIError",this.status=e,this.statusText=r,this.url=n,this.body=i,Error.captureStackTrace&&Error.captureStackTrace(this,fv)}isClientError(){return this.status>=400&&this.status<500}isServerError(){return this.status>=500}isForbiddenError(){return this.status===403}isNotFoundError(){return this.status===404}};var xn=(t=>(t.BROWSER="browser",t.NORMAL="normal",t))(xn||{});const tw="application/json",dv="Content-Type",fr=Symbol(),hv=Symbol();function Kd(t={}){var e;const r=t instanceof Array?Object.fromEntries(t):t;return(e=Object.entries(r).find(([n])=>n.toLowerCase()===dv.toLowerCase()))===null||e===void 0?void 0:e[1]}function zd(t){return/^application\/.*json.*/.test(t)}const Ht=function(t,e,r=!1){return Object.entries(e).reduce((n,[a,i])=>{const o=t[a];return Array.isArray(o)&&Array.isArray(i)?n[a]=r?[...o,...i]:i:typeof o=="object"&&typeof i=="object"?n[a]=Ht(o,i,r):n[a]=i,n},{...t})},Sr={options:{},errorType:"text",polyfills:{},polyfill(t,e=!0,r=!1,...n){const a=this.polyfills[t]||(typeof self<"u"?self[t]:null)||(typeof global<"u"?global[t]:null);if(e&&!a)throw new Error(t+" is not defined");return r&&a?new a(...n):a}};function rw(t,e=!1){Sr.options=e?t:Ht(Sr.options,t)}function nw(t,e=!1){Sr.polyfills=e?t:Ht(Sr.polyfills,t)}function aw(t){Sr.errorType=t}const iw=t=>e=>t.reduceRight((r,n)=>n(r),e)||e;let pv=class extends Error{};const ow=t=>{const e=Object.create(null);t=t._addons.reduce((y,m)=>m.beforeRequest&&m.beforeRequest(y,t._options,e)||y,t);const{_url:r,_options:n,_config:a,_catchers:i,_resolvers:o,_middlewares:s,_addons:u}=t,l=new Map(i),c=Ht(a.options,n);let f=r;const h=iw(s)((y,m)=>(f=y,a.polyfill("fetch")(y,m)))(r,c),d=new Error,p=h.catch(y=>{throw{[fr]:y}}).then(y=>{var m;if(!y.ok){const w=new pv;if(w.cause=d,w.stack=w.stack+`
35
+ CAUSE: `+d.stack,w.response=y,w.status=y.status,w.url=f,y.type==="opaque")throw w;const R=a.errorType==="json"||((m=y.headers.get("Content-Type"))===null||m===void 0?void 0:m.split(";")[0])==="application/json";return(a.errorType?R?y.text():y[a.errorType]():Promise.resolve(y.body)).then(A=>{if(w.message=typeof A=="string"?A:y.statusText,A)if(R&&typeof A=="string"){w.text=A;try{w.json=JSON.parse(A)}catch{}}else w[a.errorType]=A;throw w})}return y}),v=y=>y.catch(m=>{const w=Object.prototype.hasOwnProperty.call(m,fr),R=w?m[fr]:m,A=R?.status&&l.get(R.status)||l.get(R?.name)||w&&l.has(fr)&&l.get(fr);if(A)return A(R,t);const j=l.get(hv);if(j)return j(R,t);throw R}),g=y=>m=>v(y?p.then(w=>w&&w[y]()).then(w=>m?m(w):w):p.then(w=>m?m(w):w)),P={_wretchReq:t,_fetchReq:h,_sharedState:e,res:g(null),json:g("json"),blob:g("blob"),formData:g("formData"),arrayBuffer:g("arrayBuffer"),text:g("text"),error(y,m){return l.set(y,m),this},badRequest(y){return this.error(400,y)},unauthorized(y){return this.error(401,y)},forbidden(y){return this.error(403,y)},notFound(y){return this.error(404,y)},timeout(y){return this.error(408,y)},internalError(y){return this.error(500,y)},fetchError(y){return this.error(fr,y)}},b=u.reduce((y,m)=>({...y,...typeof m.resolver=="function"?m.resolver(y):m.resolver}),P);return o.reduce((y,m)=>m(y,t),b)},sw={_url:"",_options:{},_config:Sr,_catchers:new Map,_resolvers:[],_deferred:[],_middlewares:[],_addons:[],addon(t){return{...this,_addons:[...this._addons,t],...t.wretch}},errorType(t){return{...this,_config:{...this._config,errorType:t}}},polyfills(t,e=!1){return{...this,_config:{...this._config,polyfills:e?t:Ht(this._config.polyfills,t)}}},url(t,e=!1){if(e)return{...this,_url:t};const r=this._url.split("?");return{...this,_url:r.length>1?r[0]+t+"?"+r[1]:this._url+t}},options(t,e=!1){return{...this,_options:e?t:Ht(this._options,t)}},headers(t){const e=t?Array.isArray(t)?Object.fromEntries(t):"entries"in t?Object.fromEntries(t.entries()):t:{};return{...this,_options:Ht(this._options,{headers:e})}},accept(t){return this.headers({Accept:t})},content(t){return this.headers({[dv]:t})},auth(t){return this.headers({Authorization:t})},catcher(t,e){const r=new Map(this._catchers);return r.set(t,e),{...this,_catchers:r}},catcherFallback(t){return this.catcher(hv,t)},resolve(t,e=!1){return{...this,_resolvers:e?[t]:[...this._resolvers,t]}},defer(t,e=!1){return{...this,_deferred:e?[t]:[...this._deferred,t]}},middlewares(t,e=!1){return{...this,_middlewares:e?t:[...this._middlewares,...t]}},fetch(t=this._options.method,e="",r=null){let n=this.url(e).options({method:t});const a=Kd(n._options.headers),i=this._config.polyfill("FormData",!1),o=typeof r=="object"&&!(i&&r instanceof i)&&(!n._options.headers||!a||zd(a));return n=r?o?n.json(r,a):n.body(r):n,ow(n._deferred.reduce((s,u)=>u(s,s._url,s._options),n))},get(t=""){return this.fetch("GET",t)},delete(t=""){return this.fetch("DELETE",t)},put(t,e=""){return this.fetch("PUT",e,t)},post(t,e=""){return this.fetch("POST",e,t)},patch(t,e=""){return this.fetch("PATCH",e,t)},head(t=""){return this.fetch("HEAD",t)},opts(t=""){return this.fetch("OPTIONS",t)},body(t){return{...this,_options:{...this._options,body:t}}},json(t,e){const r=Kd(this._options.headers);return this.content(e||zd(r)&&r||tw).body(JSON.stringify(t))}};function ut(t="",e={}){return{...sw,_url:t,_options:e}}ut.default=ut;ut.options=rw;ut.errorType=aw;ut.polyfills=nw;ut.WretchError=pv;const cw=(t,e)=>e.skipDedupe||e.method!=="GET",uw=(t,e)=>e.method+"@"+t,lw=t=>t.clone(),fw=({skip:t=cw,key:e=uw,resolver:r=lw}={})=>{const n=new Map;return a=>(i,o)=>{if(t(i,o))return a(i,o);const s=e(i,o);if(!n.has(s))n.set(s,[]);else return new Promise((u,l)=>{n.get(s).push([u,l])});try{return a(i,o).then(u=>(n.get(s).forEach(([l])=>l(r(u))),n.delete(s),u)).catch(u=>{throw n.get(s).forEach(([,l])=>l(u)),n.delete(s),u})}catch(u){return n.delete(s),Promise.reject(u)}}},dw=(t,e)=>e.skipCache||e.method!=="GET",hw=(t,e)=>e.method+"@"+t,pw=()=>!1,vw=()=>null,mw=t=>t.ok,gw=({throttle:t=1e3,skip:e=dw,key:r=hw,clear:n=pw,invalidate:a=vw,condition:i=mw,flagResponseOnCacheHit:o="__cached"}={})=>{const s=new Map,u=new Map,l=new Set,c=h=>{t&&!l.has(h)&&(l.add(h),setTimeout(()=>{l.delete(h)},t))},f=h=>(d,p)=>{const v=r(d,p);let g=a(d,p);if(g&&(g instanceof Array||(g=[g]),g.forEach(P=>{typeof P=="string"?s.delete(P):P instanceof RegExp&&s.forEach((b,y)=>{P.test(y)&&s.delete(y)})})),n(d,p)&&s.clear(),e(d,p))return h(d,p);if(l.has(v)){if(s.has(v)){const P=s.get(v).clone();return o&&Object.defineProperty(P,o,{value:v,enumerable:!1}),Promise.resolve(P)}else if(u.has(v))return new Promise((P,b)=>{u.get(v).push([P,b])})}return u.has(v)||u.set(v,[]),c(v),h(d,p).then(P=>(i(P.clone())&&s.set(v,P.clone()),u.get(v).forEach(([b])=>b(P.clone())),u.delete(v),P)).catch(P=>{throw u.get(v).forEach(([,b])=>b(P)),u.delete(v),P})};return f.cacheResponse=function(h,d){c(h),s.set(h,d)},f.cache=s,f.inflight=u,f.throttling=l,f},yw=(t,e)=>t*e,ww=t=>t&&t.ok,bw=({delayTimer:t=500,delayRamp:e=yw,maxAttempts:r=10,until:n=ww,onRetry:a=null,retryOnNetworkError:i=!1,resolveWithLatestResponse:o=!1,skip:s}={})=>u=>(l,c)=>{let f=0;if(s&&s(l,c))return u(l,c);const h=(d,p)=>Promise.resolve(n(d,p)).then(v=>v?d&&o?d:p?Promise.reject(p):d:(f++,!r||f<=r?new Promise(g=>{const P=e(t,f);setTimeout(()=>{typeof a=="function"?Promise.resolve(a({response:d,error:p,url:l,options:c})).then((b={})=>{var y,m;g(u((y=b&&b.url)!==null&&y!==void 0?y:l,(m=b&&b.options)!==null&&m!==void 0?m:c))}):g(u(l,c))},P)}).then(h).catch(g=>{if(!i)throw g;return h(null,g)}):d&&o?d:Promise.reject(p||new Error("Number of attempts exceeded."))));return u(l,c).then(h).catch(d=>{if(!i)throw d;return h(null,d)})},Sw="@sesamy/sdk",Iw="1.23.0";let Pw=class{cache=new Map;get(e){return this.cache.get(e)||null}set(e,r){this.cache.set(e,r)}remove(e){this.cache.delete(e)}clear(){this.cache.clear()}};const zr="sesamyCacheTimestamp",Ew=t=>{const{libraryName:e=Sw,libraryVersion:r=Iw,cache:n}=t,a=n?.storage||new Pw,i=[s=>async(u,l)=>{if(n?.mode===xn.BROWSER){let c;typeof sessionStorage<"u"?(c=sessionStorage.getItem(zr),c||(c=Date.now().toString(),sessionStorage.setItem(zr,c))):(c=a.get(zr),c||(c=Date.now().toString(),a.set(zr,c)));const f={...l,headers:{...l.headers,"Cache-Timestamp":c}};return s(u,f)}return s(u,l)},s=>async(u,l)=>{const c=await t.tokenProvider(),f={...l,headers:{...l.headers,Authorization:c}};return s(u,f)},fw()];n?.mode===xn.NORMAL&&i.push(gw({throttle:300*1e3,skip:(s,u)=>u.method!=="GET"})),i.push(bw({delayTimer:1e3,delayRamp:(s,u)=>s*u,maxAttempts:3,until:s=>!!(s&&(s.ok||s.status>=400&&s.status<500)),retryOnNetworkError:!1}));const o=ut(t.baseUrl).headers({"Content-Type":"application/json","X-Sesamy-Client":`${e}/${r}`,...t.headers}).middlewares(i);return{async request(s,u={}){try{const l=/^https?:\/\//.test(s);let c=o.url(s,l);u.headers&&(c=c.headers(u.headers));const f=(u.method||"GET").toLowerCase();let h;switch(f){case"get":h=c.get();break;case"post":h=c.post(u.body);break;case"put":h=c.put(u.body);break;case"patch":h=c.patch(u.body);break;case"delete":h=c.delete();break;default:h=c.get()}const d=await h.res();if(d.ok&&["post","patch","put","delete"].includes(f)&&mt(),d.status===204)return null;if(!d.ok){const p=await d.text().catch(()=>"Unknown error");throw new ss(d.status,d.statusText,d.url,`API Error ${d.status}: ${p}`,p)}return await d.json()}catch(l){if(l instanceof ss)throw l;const c=l.status||500,f=l.message||"Unknown error",h=`${t.baseUrl}${s}`;throw new ss(c,f,h,`API Error ${c}: ${l.message||"Unknown error"}`,l.message||"Unknown error")}}}},mt=()=>(typeof sessionStorage<"u"&&sessionStorage.removeItem(zr),"Cache cleared"),Mr={get:async(t,e)=>t.request(`/profile/${e}`),update:async(t,e,r)=>t.request(`/profile/${e}`,{method:"PATCH",body:JSON.stringify(r)}),checkSpotifyLink:async t=>t.request("/profile/spotify-link"),unlinkSpotify:async t=>t.request("/profile/unlink-spotify",{method:"POST"}),delete:async t=>{await t.request("/profile",{method:"DELETE"})}},cs={list:async(t,e)=>{const r=new URLSearchParams;e?.type&&r.append("type",e.type),e?.sku&&r.append("sku",e.sku),e?.purchaseOptionId&&r.append("purchase-option-id",e.purchaseOptionId),e?.waitForEntitlementAfter&&r.append("wait-for-entitlement-after",e.waitForEntitlementAfter);const n=r.toString(),a=n?`/entitlements?${n}`:"/entitlements";return t.request(a)},get:async(t,e)=>t.request(`/entitlements/${e}`),getAccess:async(t,e)=>t.request(`/entitlements/${e}/access`)},Hd={list:async t=>t.request("/subscriptions"),get:async(t,e)=>t.request(`/subscriptions/${e}`)},Wd={get:async(t,e)=>t.request(`/products/${e}`),autoOnboard:async(t,e)=>t.request(`/products/${e}/auto-onboard`,{method:"POST"})},kw=(t,e)=>{if(!t||!e)return t;const r=new URL(t);return r.hash=`access_token=${e}`,r.toString()},Gd=(t,e)=>!t.manageUrl||!e?t:{...t,manageUrl:kw(t.manageUrl,e)},Fr={list:async t=>t.request("/contracts"),get:async(t,e)=>t.request(`/contracts/${e}`),cancel:async(t,e)=>t.request(`/contracts/${e}/cancel`,{method:"POST"}),createAmendment:async(t,e,r)=>t.request(`/contracts/${e}/amendments`,{method:"POST",body:JSON.stringify(r)}),confirmAmendment:async(t,e,r)=>t.request(`/contracts/${e}/amendments/${r}/confirm`,{method:"POST"})},us={get:async t=>t.request("/user-metadata"),set:async(t,e,r)=>{await t.request(`/user-metadata/${e}`,{method:"PUT",body:r})},delete:async(t,e)=>{await t.request(`/user-metadata/${e}`,{method:"DELETE"})}},dr={list:async t=>t.request("/tallies"),get:async(t,e)=>t.request(`/tallies/${e}`),update:async(t,e,r)=>t.request(`/tallies/${e}`,{method:"PUT",body:JSON.stringify(r)}),create:async(t,e)=>t.request("/tallies",{method:"POST",body:JSON.stringify(e)}),delete:async(t,e)=>{try{return await t.request(`/tallies/${e}`,{method:"DELETE"}),!0}catch{return!1}},push:async(t,e,r)=>t.request(`/tallies/${e}/push`,{method:"POST",body:JSON.stringify(r)})},ls={list:async t=>t.request("/tags"),add:async(t,e)=>{await t.request("/tags",{method:"POST",body:JSON.stringify({tag:e})})},remove:async(t,e)=>{await t.request(`/tags/${e}`,{method:"DELETE"})}},hr={generateCheckoutLink:(t,e)=>{const r=new URL(`${t.apiUrl}/checkouts`);return e.items&&r.searchParams.set("items",JSON.stringify(e.items)),e.email&&r.searchParams.set("email",e.email),e.language&&r.searchParams.set("lang",e.language),e.redirectUrl&&r.searchParams.set("redirect-url",e.redirectUrl),e.giftMode&&r.searchParams.set("gift-mode","true"),e.payerEmail&&r.searchParams.set("payer-email",e.payerEmail),e.requireAddress&&r.searchParams.set("require-address","true"),e.metadata&&Object.entries(e.metadata).forEach(([n,a])=>{r.searchParams.set(`metadata.${n}`,a)}),r.toString()},generateAccountLink:(t,e)=>{const r=e.language||"en",n=new URL(`${t.baseUrl}/account/${encodeURIComponent(r)}/subscriptions/${encodeURIComponent(t.clientId)}${e.contractId?`/${encodeURIComponent(e.contractId)}`:""}`);return n.searchParams.set("sesamy-redirect-url",e.redirectUrl||"/"),n.toString()},generateChangePaymentLink:(t,e)=>{const r=e.language||"en",n=new URL(`${t.baseUrl}/account/${encodeURIComponent(r)}/subscriptions/${encodeURIComponent(t.clientId)}/${encodeURIComponent(e.contractId)}/change-payment-method`);return n.searchParams.set("sesamy-redirect-url",e.redirectUrl||"/"),n.toString()},generateChangePlanLink:(t,e)=>{const r=e.language||"en",n=new URL(`${t.baseUrl}/account/${encodeURIComponent(r)}/subscriptions/${encodeURIComponent(t.clientId)}/${encodeURIComponent(e.contractId)}/edit-plan`);return n.searchParams.set("sesamy-redirect-url",e.redirectUrl||"/"),n.toString()},generateConsumeLink:(t,e)=>{const r=e.language||"en";let n=new URL(`${t.baseUrl}/consume/${encodeURIComponent(r)}/@${encodeURIComponent(t.clientId)}/${encodeURIComponent(e.sku)}`);return e.episodeId?n.href+=`/${encodeURIComponent(e.episodeId)}`:n.href+="/listen",n.searchParams.set("sesamy-redirect-url",e.redirectUrl||"/"),n.toString()}},fs={generateLink:(t,e)=>{const r=new URL(`${t.apiUrl}/checkouts`);return e.items&&r.searchParams.set("items",JSON.stringify(e.items)),e.email&&r.searchParams.set("email",e.email),e.language&&r.searchParams.set("lang",e.language),e.redirectUrl&&r.searchParams.set("redirect-url",e.redirectUrl),e.giftMode&&r.searchParams.set("gift-mode","true"),e.payerEmail&&r.searchParams.set("payer-email",e.payerEmail),e.requireAddress&&r.searchParams.set("require-address","true"),e.metadata&&Object.entries(e.metadata).forEach(([n,a])=>{r.searchParams.set(`metadata.${n}`,a)}),r.toString()},create:async(t,e)=>t.request("/checkouts",{method:"POST",body:JSON.stringify(e)}),get:async(t,e)=>t.request(`/checkouts/${e}`),update:async(t,e,r)=>t.request(`/checkouts/${e}`,{method:"PATCH",body:JSON.stringify(r)})},Vd={list:async t=>t.request("/bills"),get:async(t,e)=>t.request(`/bills/${e}`)},Jd={list:async t=>t.request("/fulfillments"),create:async(t,e)=>t.request("/fulfillments",{method:"POST",body:JSON.stringify(e)})},Tw={get:async(t,e)=>{try{return new URL(e),t.request(e)}catch{return t.request(`/paywalls/${e}`)}}},_w={list:async t=>t.request("/payment-issues")},Rw={content:async(t,e,r,n,a)=>{const i=new URLSearchParams({url:e});return r&&i.append("selector",r),n&&i.append("cache",n),t.request(`/proxy?${i.toString()}`,a)}},Ow={list:async(t,e)=>{const r=(e?new URLSearchParams({q:e}):new URLSearchParams).toString(),n=r?`/transactions?${r}`:"/transactions";return t.request(n)}},Zd={get:async t=>t.request("/vendor"),list:async t=>t.request("/vendors")},Cw=t=>{const e=Ew(t);return{profile:{get:r=>Mr.get(e,r),update:(r,n)=>Mr.update(e,r,n),checkSpotifyLink:()=>Mr.checkSpotifyLink(e),unlinkSpotify:()=>Mr.unlinkSpotify(e),delete:()=>Mr.delete(e)},entitlements:{list:r=>cs.list(e,r),get:r=>cs.get(e,r),getAccess:r=>cs.getAccess(e,r)},subscriptions:{list:()=>Hd.list(e),get:r=>Hd.get(e,r)},products:{get:r=>Wd.get(e,r),autoOnboard:r=>Wd.autoOnboard(e,r)},contracts:{list:async()=>{const r=await Fr.list(e),n=await t.tokenProvider();if(!n.toLowerCase().startsWith("bearer "))return r;const a=n.substring(7);return r.map(i=>Gd(i,a))},get:async r=>{const n=await Fr.get(e,r),a=await t.tokenProvider();if(!a.toLowerCase().startsWith("bearer "))return n;const i=a.substring(7);return Gd(n,i)},cancel:r=>Fr.cancel(e,r),createAmendment:(r,n)=>Fr.createAmendment(e,r,n),confirmAmendment:(r,n)=>Fr.confirmAmendment(e,r,n)},userMetadata:{get:()=>us.get(e),set:(r,n)=>us.set(e,r,n),delete:r=>us.delete(e,r)},tallies:{list:()=>dr.list(e),get:r=>dr.get(e,r),update:(r,n)=>dr.update(e,r,n),create:r=>dr.create(e,r),delete:r=>dr.delete(e,r),push:(r,n)=>dr.push(e,r,n)},tags:{list:()=>ls.list(e),add:r=>ls.add(e,r),remove:r=>ls.remove(e,r)},checkouts:{generateLink:(r,n)=>hr.generateCheckoutLink(r,n),create:r=>fs.create(e,r),get:r=>fs.get(e,r),update:(r,n)=>fs.update(e,r,n)},links:{generateCheckoutLink:(r,n)=>hr.generateCheckoutLink(r,n),generateAccountLink:(r,n)=>hr.generateAccountLink(r,n),generateChangePaymentLink:(r,n)=>hr.generateChangePaymentLink(r,n),generateChangePlanLink:(r,n)=>hr.generateChangePlanLink(r,n),generateConsumeLink:(r,n)=>hr.generateConsumeLink(r,n)},bills:{list:()=>Vd.list(e),get:r=>Vd.get(e,r)},fulfillments:{list:()=>Jd.list(e),create:r=>Jd.create(e,r)},paywalls:{get:r=>Tw.get(e,r)},paymentIssues:{list:()=>_w.list(e)},proxy:{content:(r,n,a,i)=>Rw.content(e,r,n,a,i)},transactions:{list:r=>Ow.list(e,r)},vendor:{get:()=>Zd.get(e),list:()=>Zd.list(e)}}};class Aw{get(e){return typeof sessionStorage>"u"?null:sessionStorage.getItem(e)}set(e,r){typeof sessionStorage<"u"&&sessionStorage.setItem(e,r)}remove(e){typeof sessionStorage<"u"&&sessionStorage.removeItem(e)}clear(){}}function Cs(t){let e;try{e=new URL(t)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}function vv(t,e){if(Cs(t))return{itemSrc:t};const r=t.split(":");if(r.length<2)throw new Error(`Invalid itemSrc format: expected at least 2 segments separated by ':', got ${r.length}`);const[n,a,i]=r;if(!a)throw new Error("Invalid itemSrc format: sku segment is empty");return{sku:`${n}:${a}`,purchaseOption:e||i}}function Yd(t){return t.endsWith("/")?t.slice(0,-1):t}function Xd(t,e){if(!Cs(t)||!Cs(e))return!1;const r=new URL(t),n=new URL(e);return r.origin===n.origin&&Yd(r.pathname)===Yd(n.pathname)}function $w(t,e,r){const n=new URL(`${rt("checkout3",t.environment)}`);e.language&&n.searchParams.set("lang",e.language);let a=e.sku,i=e.purchaseOptionId,o=e.itemSrc;if(e.itemSrc){const c=vv(e.itemSrc,e.purchaseOptionId);a=c.sku||a,i=c.purchaseOption||i,o=c.itemSrc}a?(n.searchParams.set("sku",a),i&&n.searchParams.set("po-id",i)):o&&n.searchParams.set("url",o),e.email&&n.searchParams.set("email",e.email),e.business&&n.searchParams.set("business","true"),e.currency&&n.searchParams.set("currency",e.currency),e.price&&n.searchParams.set("price",e.price.toString()),e.discountCode&&n.searchParams.set("discount-code",e.discountCode),e.attributionItemSrc?n.searchParams.set("itemSrc",e.attributionItemSrc):r.itemSrc&&n.searchParams.set("itemSrc",r.itemSrc),e.attributionPublisherContentId?n.searchParams.set("publisherContentId",e.attributionPublisherContentId):r.publisherContentId&&n.searchParams.set("publisherContentId",r.publisherContentId),e.utmSource?n.searchParams.set("utm_source",e.utmSource):r.utmSource&&n.searchParams.set("utm_source",r.utmSource),e.utmMedium?n.searchParams.set("utm_medium",e.utmMedium):r.utmMedium&&n.searchParams.set("utm_medium",r.utmMedium),e.utmCampaign?n.searchParams.set("utm_campaign",e.utmCampaign):r.utmCampaign&&n.searchParams.set("utm_campaign",r.utmCampaign),e.utmTerm?n.searchParams.set("utm_term",e.utmTerm):r.utmTerm&&n.searchParams.set("utm_term",r.utmTerm),e.utmContent?n.searchParams.set("utm_content",e.utmContent):r.utmContent&&n.searchParams.set("utm_content",r.utmContent);const s=["_ga","_gid","_fbp","_fbc"];document.cookie.split(";").map(c=>{const[f,h]=c.trim().split("=");return{key:f,value:h}}).filter(c=>s.some(f=>f===c.key)).forEach(c=>{n.searchParams.append(c.key,c.value)});let l=new URL(window.location.href);if(e.redirectUrl)try{l=new URL(e.redirectUrl)}catch{console.warn("Invalid redirect URL provided, using current URL instead:",e.redirectUrl)}return l.searchParams.set("force-refetch-entitlements","true"),e.itemSrc&&l.searchParams.set("sesamy-purchase",e.itemSrc),n.searchParams.set("redirect-url",l.toString()),e.paymentMethodsFilter&&n.searchParams.set("paymentmethods-filter",e.paymentMethodsFilter.flatMap(({provider:c,methods:f})=>f?f.map(h=>`${c}|${h}`):c).join(",")),e.requireAddress&&n.searchParams.set("require-address","true"),e.giftMode&&n.searchParams.set("gift-mode","true"),e.payerEmail&&n.searchParams.set("payer-email",e.payerEmail),e.metadata&&Object.entries(e.metadata).forEach(([c,f])=>{n.searchParams.set(`metadata.${c}`,String(f))}),n}const mv="sesamySignedURLs";function bc(){const t=sessionStorage.getItem(mv);return t?JSON.parse(t):[]}function Qd(t){const e=bc();e.push(t),H(`Adding signed URL: ${t}`),sessionStorage.setItem(mv,JSON.stringify(e))}function Lw(t){const e={};return Object.keys(t).forEach(r=>{const n=t[r];n!=null&&(e[r]=n.toString())}),e}const As="sesamyAttribution";function Uw(t){const e=localStorage.getItem(t);if(!e)return null;try{return JSON.parse(e).value}catch{return console.error(`Failed to parse ${t}`),null}}function xw(t){return Object.keys(t).find(e=>e.startsWith("utm_"))?{utmSource:void 0,utmMedium:void 0,utmCampaign:void 0,...t}:t}function qn(){return Uw(As)||{}}function gv(t){if(t===null)localStorage.removeItem(As);else{H(`Setting attribution ${JSON.stringify(t)}`);const e=qn()??{},r=Lw({...e,...xw(t)});localStorage.setItem(As,JSON.stringify({value:r}))}}const Sc="@sesamy/sesamy-js",fn="1.88.0",yv="sesamyFlags";async function wv(t){try{localStorage.setItem(yv,JSON.stringify(t))}catch{H("Failed to save flags to localStorage")}}async function bv(t,e){const r=await dn();r[t]=e,await wv(r)}async function Sv(t){return(await dn())[t]}async function Iv(t){const e=await dn();t in e&&(delete e[t],await wv(e))}async function dn(){try{const t=localStorage.getItem(yv);return t?JSON.parse(t):{}}catch{return{}}}function Pv(t){function e(n){return n.id?`#${n.id}`:n.classList.length>0?Array.from(n.classList).map(i=>`.${i}`).join(""):null}function r(n){const a=[];let i=n;for(;i&&i!==document.body&&i!==document.documentElement;){const o=e(i);if(o){a.unshift(o);break}if(i.parentElement){const s=Array.from(i.parentElement.children),u=s.indexOf(i)+1,l=i.tagName.toLowerCase();s.filter(f=>f.tagName.toLowerCase()===l).length>1?a.unshift(`${l}:nth-child(${u})`):a.unshift(l)}i=i.parentElement}return a.join(" > ")}return r(t)}function Ev(t){return t?Object.fromEntries(Object.entries(t).filter(([e,r])=>r!==void 0)):{}}function qw(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}let Be={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=[],Tv=!1,Rt;function Ic(){const t=window.location.pathname,e=new URLSearchParams(window.location.search),r=navigator.userAgent;return kv.find(n=>{if(n.path&&!t.includes(n.path)||n.queryParam&&e.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(!r.toLowerCase().includes(i))return!1}else return!1}return!(n.userAgentContains&&!r.includes(n.userAgentContains))})}function Nw(){return Ic()}function jw(t,e){kv=t.content||[];const r=Ic();r&&r.type==="article"&&(Be={...Be,...Ev(r.selectors)},Tv=r.enablePaywallSettingsUrlFallback||!1),Rt=e}function Dw(t,e){const{selector:r,attribute:n}=e;return r===Be.article.selector||n&&t.hasAttribute(n)?t:t.querySelector(r)}function _v(t,e,r=!1){if(t){if(e.attribute){if(e.attribute==="textContent")return t.textContent??void 0;const n=t.getAttribute(e.attribute),a=_v(t.parentElement,e,r);if(r){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 t.textContent??void 0}}function ge(t){const e=document.head.querySelectorAll(`[property~='${t}'][content]`);for(let n=0;n<e.length;n+=1)if(e[n].content)return e[n].content;const r=document.head.querySelectorAll(`[name~='${t}'][content]`);for(let n=0;n<r.length;n+=1)if(r[n].content)return r[n].content}function Hr(t){const e=[];return document.head.querySelectorAll(`[property~='${t}'][content]`).forEach(a=>{a.content&&e.push(a.content)}),document.head.querySelectorAll(`[name~='${t}'][content]`).forEach(a=>{a.content&&e.push(a.content)}),e}let Wr=null;function Rv(){const t=[],e=document.querySelectorAll('script[type="application/ld+json"]');for(const r of e)try{const n=JSON.parse(r.textContent||"");Array.isArray(n)?t.push(...n):n["@graph"]&&Array.isArray(n["@graph"])?t.push(...n["@graph"]):t.push(n)}catch{}return t}function Gr(t){const e=Rv(),r=n=>!t||n["@type"]===t||Array.isArray(n["@type"])&&n["@type"].includes(t);return e.find(r)||null}function Mw(t){const e=Rv(),r=n=>!t||n["@type"]===t||Array.isArray(n["@type"])&&n["@type"].includes(t);return e.filter(r)}function $s(t,e,r){if(!t||typeof t!="object")return typeof t=="string"?t:void 0;const a=t[e];if(typeof a=="string")return a;if(a&&typeof a=="object"&&r)return a[r]}function Fw(t){if(!t)return;const r=(Array.isArray(t)?t:[t]).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:$s(a,"image","url"),jobTitle:a.jobTitle,sameAs:a.sameAs}:null}return null}).filter(n=>n!==null&&!!n.name);return r.length>0?r:void 0}function ds(t){if(Array.isArray(t))return t.filter(e=>typeof e=="string");if(typeof t=="string"){const e=t.split(",").map(r=>r.trim()).filter(Boolean);return e.length>0?e:void 0}}function Ov(){if(Wr)return Wr;const t=Gr("NewsArticle")||Gr("Article")||Gr("BlogPosting")||Gr("WebPage"),e=(...a)=>a.find(i=>i!=null&&i!=="")||void 0,r=(...a)=>a.find(i=>i&&i.length>0),n={contentType:t?Array.isArray(t["@type"])?t["@type"][0]:t["@type"]:void 0,authors:Fw(t?.author)||(Hr("article:author").length>0?Hr("article:author").map(a=>({name:a})):void 0)||(ge("author")?[{name:ge("author")}]:void 0),keywords:r(ds(t?.keywords),ds(ge("keywords"))),tags:Hr("article:tag").length>0?Hr("article:tag"):void 0,categories:ds(ge("news_keywords")),section:e(t?.articleSection,ge("article:section")),publishedAt:e(t?.datePublished,ge("article:published_time")),modifiedAt:e(t?.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:e(ge("creator"),ge("dc.creator")),mainEntityOfPage:t?$s(t.mainEntityOfPage,"@id")||(typeof t.mainEntityOfPage=="string"?t.mainEntityOfPage:void 0):void 0,isAccessibleForFree:typeof t?.isAccessibleForFree=="boolean"?t.isAccessibleForFree:void 0,wordCount:typeof t?.wordCount=="number"?t.wordCount:void 0,publisher:t?.publisher&&typeof t.publisher=="object"?{name:t.publisher.name||"",url:t.publisher.url,logo:$s(t.publisher,"logo","url")}:void 0};return Wr=Ev(n),Wr}function Bw(){Wr=null}function Pc({publisherContentId:t,key:e,defaultValue:r=""}){const n=t?document.body.querySelector(`sesamy-content-data[id='${t}']`):null,a=e.replace(/-([a-z])/g,(i,o)=>o.toUpperCase());return n?.getAttribute(e)||ge(`sesamy:${e}`)||ge(`sesamy:${a}`)||ge(`og:${e}`)||ge(e)||r}function Cv(){const t=document.querySelectorAll(Be.article.selector);return Array.from(t).map(hn).filter(e=>e!==null)}function hn(t){const e=typeof t=="string"?document.querySelector(t):t;if(!e)return null;const r={element:e,selector:typeof t=="string"?t:Pv(e)},n=(i,o,s,u)=>{const{transform:l,collect:c=!1}=u||{},f=Dw(e,o),h=_v(f,o,c),d=Pc({publisherContentId:s,key:qw(String(i))}),p=h||d||void 0;p&&(r[i]=l?l(p):p)};n("id",Be.id),n("title",Be.title,r.id),n("excerpt",Be.excerpt,r.id),n("image",Be.image,r.id),n("price",Be.price,r.id,{transform:i=>{const o=parseFloat(i);return Number.isNaN(o)?void 0:o}}),n("currency",Be.currency,r.id),n("url",Be.url,r.id),n("pass",Be.pass,r.id,{collect:!0}),n("paywallUrl",Be.paywallUrl,r.id),n("accessLevel",Be.accessLevel,r.id,{transform:i=>i||"entitlement"});const a=Ic();if(a&&a.type==="article"&&(a.pass&&(r.pass=r.pass?`${r.pass},${a.pass}`:a.pass),a.price&&!r.price&&(r.price=a.price.amount),a.price?.currency&&!r.currency&&(r.currency=a.price.currency),a.paywallUrl&&!r.paywallUrl&&(r.paywallUrl=a.paywallUrl)),Tv&&!r.paywallUrl){const i=document.querySelector("sesamy-paywall");if(i){const o=i.getAttribute("settings-url");o&&(r.paywallUrl=o)}}return r.url||(r.url=window.location.href),r.metadata=Ov(),r}async function Kw(t){const e=hn(t);if(!e)throw new Error("Could not find article element");if(e.accessLevel==="public")return!0;if(e.accessLevel==="logged-in"&&!e.paywallUrl)return await Rt.auth.isAuthenticated()?!0:null;if(e.paywallUrl&&((await Rt.paywalls.get(e.paywallUrl)).settings.template==="LOGIN"?"logged-in":"entitlement")==="logged-in")return await Rt.auth.isAuthenticated()?!0:null;if(!e.url)throw new Error("Article must have a URL");return await Rt.entitlements.hasAccess(e.url,e.pass?.split(",")||[])||null}async function Av(t,e){const r=typeof t=="string"?document.querySelector(t):t;if(!r)throw new Error("Could not find element");const n=hn(r);if(!n?.url)throw new Error("Could not find content for element");const a=await Rt.entitlements.hasAccess(n.url,n.pass?.split(",")||[]);if(!a)throw new Error("User does not have access to the content");const i=await Rt.entitlements.access(a.id);if(!i.token)throw new Error("Could not get access token");const o=e||Pv(r.parentElement||r);return Rt.proxy.getContent(i.token,n.url,o)}function $v(t,e={}){const{closeOnBackdropClick:r=!0,closeOnEscape:n=!0,zIndex:a=2147483647,backdropBlur:i="5px",overlayBackground:o="rgba(0,0,0,0.5)"}=e,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 t=="string"?u.innerHTML=t:u.appendChild(t),s.appendChild(u);const l=()=>{s.remove(),n&&document.removeEventListener("keydown",c)},c=f=>{f.key==="Escape"&&l()};return r&&s.addEventListener("click",f=>{f.target===s&&l()}),n&&document.addEventListener("keydown",c),document.body.appendChild(s),{element:s,close:l}}function zw(t,e={}){const{position:r="top",fixed:n=!0,zIndex:a=2147483647,autoDismissMs:i,pushContent:o=!1,height:s,transitionDuration:u="0.3s"}=e,l=document.createElement("div");l.setAttribute("data-sesamy-notification-bar","true"),l.setAttribute("data-sesamy-notification-position",r),Object.assign(l.style,{position:n?"fixed":"absolute",[r]:"0",left:"0",width:"100%",zIndex:String(a),boxSizing:"border-box",...s&&{height:s}}),typeof t=="string"?l.innerHTML=t:l.appendChild(t);let c,f,h;const d=()=>{if(h&&clearTimeout(h),o&&s){const p=document.documentElement;p.style.transform=c||"",setTimeout(()=>{l.remove(),p.style.transition=f||""},parseFloat(u)*1e3)}else l.remove()};if(i&&(h=setTimeout(d,i)),o&&s){const p=document.documentElement;c=p.style.transform,f=p.style.transition,p.style.transition=`transform ${u} ease`,l.style.transition=`transform ${u} ease`,r==="top"?(p.style.transform=`translateY(${s})`,l.style.transform=`translateY(-${s})`):(p.style.transform=`translateY(-${s})`,l.style.transform=`translateY(${s})`),document.documentElement.prepend(l)}else document.body.appendChild(l);return{element:l,close:d}}function Hw(t){const e=t.endpoint||rt("api2",t.environment),n=Cw({baseUrl:e,tokenProvider:async()=>{if(await Ot())try{const x=await pt(!1);if(x)return`Bearer ${x}`}catch{}const S=localStorage.getItem("__anon_id");return`Basic ${btoa(`${t.vendorId||t.clientId}|${S}:`)}`},libraryName:Sc,libraryVersion:fn,vendorId:t.vendorId,cache:{mode:xn.BROWSER,storage:new Aw}}),a=S=>async(O,x)=>{let F=sessionStorage.getItem(Fd);F||(F=Date.now().toString(),sessionStorage.setItem(Fd,F));const I={...x,headers:{...x.headers,"Cache-Timestamp":F}};return S(O,I)},i=(S=!0)=>O=>async(x,F)=>{let I=null;if(I=await pt(S),!I){if(S)throw new Error("No access token available");return O(x,F)}const T={...F,headers:{...F.headers,...I?{Authorization:`Bearer ${I}`}:{}}};return O(x,T)},o=ut(e).headers({"Content-Type":"application/json"}).middlewares([a,i(),Yy(),ew({delayTimer:1e3,delayRamp:(S,O)=>S*O,maxAttempts:3,until:S=>!!(S&&(S.ok||S.status>=400&&S.status<500)),retryOnNetworkError:!1})]);async function s(S={}){const{waitForEntitlementAfter:O,includeSignedLinks:x=!0}=S,F=await Ot()?await n.entitlements.list({waitForEntitlementAfter:O?.toISOString()}):[];return x&&F.push(...bc()),F}async function u(S,O=[]){return(await s())?.find(I=>{if(S){const{sku:T,purchaseOption:N}=vv(S);if("sku"in I&&T===I.sku||N&&"purchaseOptionsId"in I&&N===I.purchaseOptionsId||Xd(S,I.url))return!0}return!!O.some(T=>Xd(T,I.url))})}async function l(S,O,x){const F=new URL(rt("api2",t.environment));return F.pathname="/proxy",F.searchParams.set("url",O),x&&F.searchParams.set("selector",x),ut(F.toString()).headers({Authorization:`Bearer ${S}`}).get().text()}async function c(S){if(!S)throw new Error("SKU is required to get fulfillments");return await Ot()?await o.get(`/fulfillments?sku=${encodeURIComponent(S)}`).json():[]}async function f(S,O){if(!S||!O)throw new Error("SKU and itemId are required to request delivery");return(await o.post({sku:S},`/fulfillments/${encodeURIComponent(O)}/request-delivery?`).res()).ok}async function h(){return console.warn("getSubscriptions is deprecated, use getContracts instead"),o.get("/subscriptions").json()}async function d(S){return(await n.transactions.list())?.find(x=>x.id===S)}async function p(){return await o.url("/tags").get().json()}async function v(S){const O=await o.url(`/tags/${encodeURIComponent(S)}`).delete().res();return mt(),O.ok}async function g(S){const O=await o.url("/tags").post(encodeURIComponent(S)).res();return Zt(We.USER_ATTRIBUTE_CHANGED,{}),mt(),O.ok}async function P(S){return(await n.tallies.get(S)).value}async function b(){const S=await n.tallies.list(),O={};for(const x of S)O[x.id]=x.value;return O}async function y(S){return await n.tallies.delete(S)}async function m(S,O){return await n.tallies.push(S,O)}async function w(){return await pt(!1)?await o.url("/profile").get().json():null}async function R(S){const O=await o.url("/profile").patch(S).res();return mt(),O.ok}async function A(){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 B(S){const O=await pt(!1);if(!O)throw new Error("No access token available");const x=new URL(`${rt("access-sync",t.environment)}/spotify/sesamy-callback`);x.searchParams.set("access_token",O),x.searchParams.set("state",S),window.location.href=x.toString()}async function W(S){const O=await o.url(`/products/${encodeURIComponent(S)}/auto-onboard`).post().json();return O.length&&mt(),O}async function re(S,O=3600){const{shortlink:x}=await ut(Ry).post({url:S,ttl:O}).json();return x}async function U(S){const O=await pt(!1,!0);let x;const F=S.language||Yr(),I=qn();switch(S.target){case"account":x=new URL(`${rt("account",t.environment)}/${encodeURIComponent(S.language||F)}/subscriptions/${encodeURIComponent(t.vendorId||t.clientId)}${S.contractId?`/${encodeURIComponent(S.contractId)}`:""}`),x.searchParams.set("sesamy-redirect-url",S.redirectUrl||window.location.href);break;case"change-payment":x=new URL(`${rt("account",t.environment)}/${encodeURIComponent(S.language||F)}/subscriptions/${encodeURIComponent(t.vendorId||t.clientId)}/${encodeURIComponent(S.contractId)}/change-payment-method`),x.searchParams.set("sesamy-redirect-url",S.redirectUrl||window.location.href);break;case"change-plan":x=new URL(`${rt("account",t.environment)}/${encodeURIComponent(S.language||F)}/subscriptions/${encodeURIComponent(t.vendorId||t.clientId)}/${encodeURIComponent(S.contractId)}/edit-plan`),x.searchParams.set("sesamy-redirect-url",S.redirectUrl||window.location.href);break;case"consume":x=new URL(`${rt("consume",t.environment)}/${encodeURIComponent(S.language||F)}/@${encodeURIComponent(t.vendorId||t.clientId)}/${encodeURIComponent(S.sku)}`),S.episodeId?x.href+=`/${S.episodeId}`:x.href+="/listen",x.searchParams.set("sesamy-redirect-url",S.redirectUrl||window.location.href);break;case"checkout":x=$w(t,{language:F,...S},I);break;default:throw new Error("Invalid target")}return O&&(x.hash=`#access_token=${O}`),S.shorten?re(x.href,S.ttl):x.href}async function M(){const S=await pt(!1),O=new URL(`${rt("account",t.environment)}/subscriptions/${t.vendorId||t.clientId}`);S&&(O.hash=`#access_token=${S}`),window.location.href=O.toString()}async function q(S){const O=qn(),x=["_ga","_gid","_fbp","_fbc"];return document.cookie.split(";").forEach(F=>{const[I,T]=F.trim().split("=");x.includes(I)&&!O[I]&&(O[I]=T)}),n.checkouts.create({language:Yr(),...S,attribution:{...O,...S.attribution}})}return{autoOnboardProduct:W,bills:n.bills,checkouts:{create:q,get:n.checkouts.get,update:n.checkouts.update},content:{list:Cv,get:hn,getLanguage:Yr,unlock:Av,getPropertyFromHTML:Pc},contracts:n.contracts,deleteTag:v,deleteTally:y,entitlements:n.entitlements,flags:{get:Sv,set:bv,list:dn,delete:Iv},generateLink:U,getProxyContent:l,getEntitlements:s,getFulfillments:c,requestDelivery:f,hasAccess:u,isSpotifyLinked:A,linkSpotify:B,openHostedAccountPage:M,paywalls:n.paywalls,paymentIssues:n.paymentIssues,getProfile:w,products:n.products,getSubscriptions:h,getTally:P,getTallies:b,getTags:p,getTransaction:d,transactions:n.transactions,userMetadata:n.userMetadata,pushTally:m,setTag:g,unlinkSpotify:j,updateProfile:R,vendor:n.vendor}}function eh(t,e,r,n,a){for(e=e.split?e.split("."):e,n=0;n<e.length;n++)t=t?t[e[n]]:a;return t===a?r:t}var Ww="function",Gw="string",nt="undefined",Vw="boolean",Nn="object",Jw="array",Zw="number",Yw="symbol",Xw="null",Ls=function(){},Lv="any",Uv="*",Qt="__",Qw="form",eb="input",tb="button",rb="select",jn=typeof process!==nt?process:{};jn.env&&jn.env.NODE_ENV;var Ae=typeof document!==nt;jn.versions!=null&&jn.versions.node!=null;typeof Deno!==nt&&Deno.core;Ae&&window.name==="nodejs"||typeof navigator!==nt&&typeof navigator.userAgent!==nt&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));function xv(t,e){return e.charAt(0)[t]()+e.slice(1)}var nb=xv.bind(null,"toUpperCase"),ab=xv.bind(null,"toLowerCase");function ib(t){return qv(t)?nb(Xw):typeof t===Nn?ub(t):Object.prototype.toString.call(t).slice(8,-1)}function Dn(t,e){e===void 0&&(e=!0);var r=ib(t);return e?ab(r):r}function pn(t,e){return typeof e===t}var ze=pn.bind(null,Ww),Ct=pn.bind(null,Gw),mr=pn.bind(null,nt),ob=pn.bind(null,Vw);pn.bind(null,Yw);function qv(t){return t===null}function sb(t){return Dn(t)===Zw&&!isNaN(t)}function Nv(t){return Dn(t)===Jw}function Ke(t){if(!cb(t))return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function cb(t){return t&&(typeof t===Nn||t!==null)}function ub(t){return ze(t.constructor)?t.constructor.name:null}function lb(t){return t instanceof Error||Ct(t.message)&&t.constructor&&sb(t.constructor.stackTraceLimit)}function jv(t,e){if(typeof e!="object"||qv(e))return!1;if(e instanceof t)return!0;var r=Dn(new t(""));if(lb(e))for(;e;){if(Dn(e)===r)return!0;e=Object.getPrototypeOf(e)}return!1}jv.bind(null,TypeError);jv.bind(null,SyntaxError);function ca(t,e){var r=t instanceof Element||t instanceof HTMLDocument;return r&&e?fb(t,e):r}function fb(t,e){return e===void 0&&(e=""),t&&t.nodeName===e.toUpperCase()}function ua(t){var e=[].slice.call(arguments,1);return function(){return t.apply(void 0,[].slice.call(arguments).concat(e))}}ua(ca,Qw);ua(ca,tb);ua(ca,eb);ua(ca,rb);function db(t){return t?Nv(t)?t:[t]:[]}function th(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function hb(){if(Ae){var t=navigator,e=t.languages;return t.userLanguage||(e&&e.length?e[0]:t.language)}}function pb(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function vb(t){return(function(e){for(var r,n=Object.create(null),a=/([^&=]+)=?([^&]*)/g;r=a.exec(e);){var i=th(r[1]),o=th(r[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 l=u.split("[");l.length>1&&(mb(n,l.map(function(c){return c.replace(/[?[\]\\ ]/g,"")}),n[u]),delete n[u])}return n})((function(e){return Ae&&window.location.search.substring(1)})())}function mb(t,e,r){for(var n=e.length-1,a=0;a<n;++a){var i=e[a];if(i==="__proto__"||i==="constructor")break;i in t||(t[i]={}),t=t[i]}t[e[n]]=r}function la(){for(var t="",e=0,r=4294967295*Math.random()|0;e++<36;){var n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[e-1],a=15&r;t+=n=="-"||n=="4"?n:(n=="x"?a:3&a|8).toString(16),r=e%8==0?4294967295*Math.random()|0:r>>4}return t}function gb(t,e){var r,n,a,i=null,o=0,s=function(){o=new Date,i=null,a=t.apply(r,n)};return function(){var u=new Date;o||(o=u);var l=e-(u-o);return r=this,n=arguments,l<=0?(clearTimeout(i),i=null,o=u,a=t.apply(r,n)):i||(i=setTimeout(s,l)),a}}var Wt="global",Ir=Qt+Wt+Qt,Pr=typeof self===Nn&&self.self===self&&self||typeof global===Nn&&global[Wt]===global&&global||void 0;function er(t){return Pr[Ir][t]}function tr(t,e){return Pr[Ir][t]=e}function Cr(t){delete Pr[Ir][t]}function Ar(t,e,r){var n;try{if(Ec(t)){var a=window[t];n=a[e].bind(a)}}catch{}return n||r}Pr[Ir]||(Pr[Ir]={});var gn={};function Ec(t){if(typeof gn[t]!==nt)return gn[t];try{var e=window[t];e.setItem(nt,nt),e.removeItem(nt)}catch{return gn[t]=!1}return gn[t]=!0}function te(){return te=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},te.apply(null,arguments)}var Tt="function",gt="undefined",en="reducer",Dv="@@redux/",Us=Dv+"INIT",yb=Dv+Math.random().toString(36),rh=(function(){return typeof Symbol===Tt&&Symbol.observable||"@@observable"})(),yn=" != "+Tt;function Mv(t,e,r){var n;if(typeof e===Tt&&typeof r===gt&&(r=e,e=void 0),typeof r!==gt){if(typeof r!==Tt)throw new Error("enhancer"+yn);return r(Mv)(t,e)}if(typeof t!==Tt)throw new Error(en+yn);var a=t,i=e,o=[],s=o,u=!1;function l(){s===o&&(s=o.slice())}function c(){return i}function f(d){if(typeof d!==Tt)throw new Error("Listener"+yn);var p=!0;return l(),s.push(d),function(){if(p){p=!1,l();var v=s.indexOf(d);s.splice(v,1)}}}function h(d){if(!Ke(d))throw new Error("Act != obj");if(typeof d.type===gt)throw new Error("ActType "+gt);if(u)throw new Error("Dispatch in "+en);try{u=!0,i=a(i,d)}finally{u=!1}for(var p=o=s,v=0;v<p.length;v++)(0,p[v])();return d}return h({type:Us}),(n={dispatch:h,subscribe:f,getState:c,replaceReducer:function(d){if(typeof d!==Tt)throw new Error("next "+en+yn);a=d,h({type:Us})}})[rh]=function(){var d,p=f;return(d={subscribe:function(v){if(typeof v!="object")throw new TypeError("Observer != obj");function g(){v.next&&v.next(c())}return g(),{unsubscribe:p(g)}}})[rh]=function(){return this},d},n}function wb(t,e){var r=e&&e.type;return"action "+(r&&r.toString()||"?")+en+" "+t+" returns "+gt}function Er(){var t=[].slice.call(arguments);return t.length===0?function(e){return e}:t.length===1?t[0]:t.reduce(function(e,r){return function(){return e(r.apply(void 0,[].slice.call(arguments)))}})}function bb(){var t=arguments;return function(e){return function(r,n,a){var i,o=e(r,n,a),s=o.dispatch,u={getState:o.getState,dispatch:function(l){return s(l)}};return i=[].slice.call(t).map(function(l){return l(u)}),te({},o,{dispatch:s=Er.apply(void 0,i)(o.dispatch)})}}}var At=Qt+"anon_id",Gt=Qt+"user_id",yr=Qt+"user_traits",xs="analytics",kt="userId",gr="anonymousId",Cn=["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"],qs=["name","EVENTS","config","loaded"],ee=Cn.reduce(function(t,e){return t[e]=e,t},{registerPluginType:function(t){return"registerPlugin:"+t},pluginReadyType:function(t){return"ready:"+t}}),nh=/^utm_/,ah=/^an_prop_/,ih=/^an_trait_/;function Sb(t){var e=t.storage.setItem;return function(r){return function(n){return function(a){if(a.type===ee.bootstrap){var i=a.params,o=a.user,s=a.persistedUser,u=a.initialUser,l=s.userId===o.userId;s.anonymousId!==o.anonymousId&&e(At,o.anonymousId),l||e(Gt,o.userId),u.traits&&e(yr,te({},l&&s.traits?s.traits:{},u.traits));var c=Object.keys(a.params);if(c.length){var f=i.an_uid,h=i.an_event,d=c.reduce(function(p,v){if(v.match(nh)||v.match(/^(d|g)clid/)){var g=v.replace(nh,"");p.campaign[g==="campaign"?"name":g]=i[v]}return v.match(ah)&&(p.props[v.replace(ah,"")]=i[v]),v.match(ih)&&(p.traits[v.replace(ih,"")]=i[v]),p},{campaign:{},props:{},traits:{}});r.dispatch(te({type:ee.params,raw:i},d,f?{userId:f}:{})),f&&setTimeout(function(){return t.identify(f,d.traits)},0),h&&setTimeout(function(){return t.track(h,d.props)},0),Object.keys(d.campaign).length&&r.dispatch({type:ee.campaign,campaign:d.campaign})}}return n(a)}}}}function Ib(t){return function(e,r){if(e===void 0&&(e={}),r===void 0&&(r={}),r.type===ee.setItemEnd){if(r.key===At)return te({},e,{anonymousId:r.value});if(r.key===Gt)return te({},e,{userId:r.value})}switch(r.type){case ee.identify:return Object.assign({},e,{userId:r.userId,traits:te({},e.traits,r.traits)});case ee.reset:return[Gt,At,yr].forEach(function(n){t.removeItem(n)}),Object.assign({},e,{userId:null,anonymousId:null,traits:{}});default:return e}}}function oh(t){return{userId:t.getItem(Gt),anonymousId:t.getItem(At),traits:t.getItem(yr)}}var Ns=function(t){return Qt+"TEMP"+Qt+t};function Pb(t){var e=t.storage,r=e.setItem,n=e.removeItem,a=e.getItem;return function(i){return function(o){return function(s){var u=s.userId,l=s.traits,c=s.options;if(s.type===ee.reset&&([Gt,yr,At].forEach(function(d){n(d)}),[kt,gr,"traits"].forEach(function(d){Cr(Ns(d))})),s.type===ee.identify){a(At)||r(At,la());var f=a(Gt),h=a(yr)||{};f&&f!==u&&i.dispatch({type:ee.userIdChanged,old:{userId:f,traits:h},new:{userId:u,traits:l},options:c}),u&&r(Gt,u),l&&r(yr,te({},h,l))}return o(s)}}}}var Vr={};function sh(t,e){Vr[t]&&ze(Vr[t])&&(Vr[t](e),delete Vr[t])}function Fv(t,e,r){return new Promise(function(n,a){return e()?n(t):r<1?a(te({},t,{queue:!0})):new Promise(function(i){return setTimeout(i,10)}).then(function(i){return Fv(t,e,r-10).then(n,a)})})}function Eb(t){return{abort:t}}function Bv(t,e,r){var n={},a=e(),i=t.getState(),o=i.plugins,s=i.queue,u=i.user;if(!i.context.offline&&s&&s.actions&&s.actions.length){var l=s.actions.reduce(function(f,h,d){return o[h.plugin].loaded?(f.process.push(h),f.processIndex.push(d)):(f.requeue.push(h),f.requeueIndex.push(d)),f},{processIndex:[],process:[],requeue:[],requeueIndex:[]});if(l.processIndex&&l.processIndex.length){l.processIndex.forEach(function(f){var h=s.actions[f],d=h.plugin,p=h.payload.type,v=a[d][p];if(v&&ze(v)){var g,P=(function(m,w){return m===void 0&&(m={}),w===void 0&&(w={}),[kt,gr].reduce(function(R,A){return m.hasOwnProperty(A)&&w[A]&&w[A]!==m[A]&&(R[A]=w[A]),R},m)})(h.payload,u),b=n[P.meta.rid];if(!b&&(g=v({payload:P,config:o[d].config,instance:r,abort:Eb}))&&Ke(g)&&g.abort)return void(n[P.meta.rid]=!0);if(!b){var y=p+":"+d;t.dispatch(te({},P,{type:y,_:{called:y,from:"queueDrain"}}))}}});var c=s.actions.filter(function(f,h){return!~l.processIndex.indexOf(h)});s.actions=c}}}var hs=function(t){var e=t.data,r=t.action,n=t.instance,a=t.state,i=t.allPlugins,o=t.allMatches,s=t.store,u=t.EVENTS;try{var l=a.plugins,c=a.context,f=r.type,h=f.match(wr),d=e.exact.map(function(g){return g.pluginName});h&&(d=o.during.map(function(g){return g.pluginName}));var p=(function(g,P){return function(b,y,m){var w=y.config,R=y.name,A=R+"."+b.type;m&&(A=m.event);var j=b.type.match(wr)?(function(B,W,re,U,M){return function(q,S){var O=U?U.name:B,x=S&&tn(S)?S:re;if(U&&(!(x=S&&tn(S)?S:[B]).includes(B)||x.length!==1))throw new Error("Method "+W+" can only abort "+B+" plugin. "+JSON.stringify(x)+" input valid");return te({},M,{abort:{reason:q,plugins:x,caller:W,_:O}})}})(R,A,P,m,b):(function(B,W){return function(){throw new Error(B.type+" action not cancellable. Remove abort in "+W)}})(b,A);return{payload:kb(b),instance:g,config:w||{},abort:j}}})(n,d),v=e.exact.reduce(function(g,P){var b=P.pluginName,y=P.methodName,m=!1;return y.match(/^initialize/)||y.match(/^reset/)||(m=!l[b].loaded),c.offline&&y.match(/^(page|track|identify)/)&&(m=!0),g[""+b]=m,g},{});return Promise.resolve(e.exact.reduce(function(g,P,b){var y=P.pluginName;return Promise.resolve(g).then(function(m){function w(){return Promise.resolve(m)}var R=(function(){if(e.namespaced&&e.namespaced[y])return Promise.resolve(e.namespaced[y].reduce(function(A,j,B){return Promise.resolve(A).then(function(W){return j.method&&ze(j.method)?((function(q,S){var O=ph(q);if(O&&O.name===S){var x=ph(O.method);throw new Error([S+" plugin is calling method "+q,"Plugins cant call self","Use "+O.method+" "+(x?"or "+x.method:"")+" in "+S+" plugin insteadof "+q].join(`
36
+ `))}})(j.methodName,j.pluginName),Promise.resolve(j.method({payload:W,instance:n,abort:(re=W,U=y,M=j.pluginName,function(q,S){return te({},re,{abort:{reason:q,plugins:S||[U],caller:f,from:M||U}})}),config:lh(j.pluginName,l,i),plugins:l})).then(function(q){var S=Ke(q)?q:{};return Promise.resolve(te({},W,S))})):W;var re,U,M})},Promise.resolve(r))).then(function(A){m[y]=A});m[y]=r})();return R&&R.then?R.then(w):w()})},Promise.resolve({}))).then(function(g){return Promise.resolve(e.exact.reduce(function(P,b,y){try{var m=e.exact.length===y+1,w=b.pluginName,R=i[w];return Promise.resolve(P).then(function(A){var j=g[w]?g[w]:{};if(h&&(j=A),vs(j,w))return ps({data:j,method:f,instance:n,pluginName:w,store:s}),Promise.resolve(A);if(vs(A,w))return m&&ps({data:A,method:f,instance:n,store:s}),Promise.resolve(A);if(v.hasOwnProperty(w)&&v[w]===!0)return s.dispatch({type:"queue",plugin:w,payload:j,_:{called:"queue",from:"queueMechanism"}}),Promise.resolve(A);var B=p(g[w],i[w]);return Promise.resolve(R[f]({abort:B.abort,payload:j,instance:n,config:lh(w,l,i),plugins:l})).then(function(W){var re=Ke(W)?W:{},U=te({},A,re),M=g[w];if(vs(M,w))ps({data:M,method:f,instance:n,pluginName:w,store:s});else{var q=f+":"+w;(q.match(/:/g)||[]).length<2&&!f.match(ch)&&!f.match(uh)&&n.dispatch(te({},h?U:j,{type:q,_:{called:q,from:"submethod"}}))}return Promise.resolve(U)})})}catch(A){return Promise.reject(A)}},Promise.resolve(r))).then(function(P){if(!(f.match(wr)||f.match(/^registerPlugin/)||f.match(uh)||f.match(ch)||f.match(/^params/)||f.match(/^userIdChanged/))){if(u.plugins.includes(f),P._&&P._.originalAction===f)return P;var b=te({},P,{_:{originalAction:P.type,called:P.type,from:"engineEnd"}});Kv(P,e.exact.length)&&!f.match(/End$/)&&(b=te({},b,{type:P.type+"Aborted"})),s.dispatch(b)}return P})})}catch(g){return Promise.reject(g)}},wr=/Start$/,ch=/^bootstrap/,uh=/^ready/;function ps(t){var e=t.pluginName,r=t.method+"Aborted"+(e?":"+e:"");t.store.dispatch(te({},t.data,{type:r,_:{called:r,from:"abort"}}))}function lh(t,e,r){var n=e[t]||r[t];return n&&n.config?n.config:{}}function fh(t,e){return e.reduce(function(r,n){return n[t]?r.concat({methodName:t,pluginName:n.name,method:n[t]}):r},[])}function dh(t,e){var r=t.replace(wr,""),n=e?":"+e:"";return[""+t+n,""+r+n,r+"End"+n]}function vs(t,e){var r=t.abort;return!!r&&(r===!0||hh(r,e)||r&&hh(r.plugins,e))}function Kv(t,e){var r=t.abort;if(!r)return!1;if(r===!0||Ct(r))return!0;var n=r.plugins;return tn(r)&&r.length===e||tn(n)&&n.length===e}function tn(t){return Array.isArray(t)}function hh(t,e){return!(!t||!tn(t))&&t.includes(e)}function ph(t){var e=t.match(/(.*):(.*)/);return!!e&&{method:e[1],name:e[2]}}function kb(t){return Object.keys(t).reduce(function(e,r){return r==="type"||(e[r]=Ke(t[r])?Object.assign({},t[r]):t[r]),e},{})}function Tb(t,e,r){var n={};return function(a){return function(i){return function(o){try{var s,u=function(m){return s?m:i(f)},l=o.type,c=o.plugins,f=o;if(o.abort)return Promise.resolve(i(o));if(l===ee.enablePlugin&&a.dispatch({type:ee.initializeStart,plugins:c,disabled:[],fromEnable:!0,meta:o.meta}),l===ee.disablePlugin&&setTimeout(function(){return sh(o.meta.rid,{payload:o})},0),l===ee.initializeEnd){var h=e(),d=Object.keys(h),p=d.filter(function(m){return c.includes(m)}).map(function(m){return h[m]}),v=[],g=[],P=o.disabled,b=p.map(function(m){var w=m.loaded,R=m.name,A=m.config;return Fv(m,function(){return w({config:A})},1e4).then(function(j){return n[R]||(a.dispatch({type:ee.pluginReadyType(R),name:R,events:Object.keys(m).filter(function(B){return!qs.includes(B)})}),n[R]=!0),v=v.concat(R),m}).catch(function(j){if(j instanceof Error)throw new Error(j);return g=g.concat(j.name),j})});Promise.all(b).then(function(m){var w={plugins:v,failed:g,disabled:P};setTimeout(function(){d.length===b.length+P.length&&a.dispatch(te({},{type:ee.ready},w))},0)})}var y=(function(){if(l!==ee.bootstrap)return/^ready:([^:]*)$/.test(l)&&setTimeout(function(){return Bv(a,e,t)},0),Promise.resolve((function(m,w,R,A,j){try{var B=ze(w)?w():w,W=m.type,re=W.replace(wr,"");if(m._&&m._.called)return Promise.resolve(m);var U=R.getState(),M=(O=B,(x=U.plugins)===void 0&&(x={}),(F=m.options)===void 0&&(F={}),Object.keys(O).filter(function(I){var T=F.plugins||{};return ob(T[I])?T[I]:T.all!==!1&&(!x[I]||x[I].enabled!==!1)}).map(function(I){return O[I]}));W===ee.initializeStart&&m.fromEnable&&(M=Object.keys(U.plugins).filter(function(I){var T=U.plugins[I];return m.plugins.includes(I)&&!T.initialized}).map(function(I){return B[I]}));var q=M.map(function(I){return I.name}),S=(function(I,T){var N=dh(I).map(function(z){return fh(z,T)});return T.reduce(function(z,X){var Z=X.name,fe=dh(I,Z).map(function(_e){return fh(_e,T)}),ae=fe[0],ue=fe[1],ie=fe[2];return ae.length&&(z.beforeNS[Z]=ae),ue.length&&(z.duringNS[Z]=ue),ie.length&&(z.afterNS[Z]=ie),z},{before:N[0],beforeNS:{},during:N[1],duringNS:{},after:N[2],afterNS:{}})})(W,M);return Promise.resolve(hs({action:m,data:{exact:S.before,namespaced:S.beforeNS},state:U,allPlugins:B,allMatches:S,instance:R,store:A,EVENTS:j})).then(function(I){function T(){var X=(function(){if(W.match(wr))return Promise.resolve(hs({action:te({},N,{type:re+"End"}),data:{exact:S.after,namespaced:S.afterNS},state:U,allPlugins:B,allMatches:S,instance:R,store:A,EVENTS:j})).then(function(Z){Z.meta&&Z.meta.hasCallback&&sh(Z.meta.rid,{payload:Z})})})();return X&&X.then?X.then(function(){return I}):I}if(Kv(I,q.length))return I;var N,z=(function(){if(W!==re)return Promise.resolve(hs({action:te({},I,{type:re}),data:{exact:S.during,namespaced:S.duringNS},state:U,allPlugins:B,allMatches:S,instance:R,store:A,EVENTS:j})).then(function(X){N=X});N=I})();return z&&z.then?z.then(T):T()})}catch(I){return Promise.reject(I)}var O,x,F})(o,e,t,a,r)).then(function(m){var w=i(m);return s=1,w})})();return Promise.resolve(y&&y.then?y.then(u):u(y))}catch(m){return Promise.reject(m)}}}}}function _b(t){return function(e){return function(r){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 r(n);a===ee.setItem?t.setItem(i,o,s):t.removeItem(i,s)}return r(n)}}}}var Rb=function(){var t=this;this.before=[],this.after=[],this.addMiddleware=function(e,r){t[r]=t[r].concat(e)},this.removeMiddleware=function(e,r){var n=t[r].findIndex(function(a){return a===e});n!==-1&&(t[r]=[].concat(t[r].slice(0,n),t[r].slice(n+1)))},this.dynamicMiddlewares=function(e){return function(r){return function(n){return function(a){var i={getState:r.getState,dispatch:function(s){return r.dispatch(s)}},o=t[e].map(function(s){return s(i)});return Er.apply(void 0,o)(n)(a)}}}}};function Ob(t){return function(e,r){e===void 0&&(e={});var n={};if(r.type==="initialize:aborted")return e;if(/^registerPlugin:([^:]*)$/.test(r.type)){var a=vh(r.type,"registerPlugin"),i=t()[a];if(!i||!a)return e;var o=r.enabled,s=i.config;return n[a]={enabled:o,initialized:!!o&&!i.initialize,loaded:!!o&&!!i.loaded({config:s}),config:s},te({},e,n)}if(/^initialize:([^:]*)$/.test(r.type)){var u=vh(r.type,ee.initialize),l=t()[u];return l&&u?(n[u]=te({},e[u],{initialized:!0,loaded:!!l.loaded({config:l.config})}),te({},e,n)):e}if(/^ready:([^:]*)$/.test(r.type))return n[r.name]=te({},e[r.name],{loaded:!0}),te({},e,n);switch(r.type){case ee.disablePlugin:return te({},e,mh(r.plugins,!1,e));case ee.enablePlugin:return te({},e,mh(r.plugins,!0,e));default:return e}}}function vh(t,e){return t.substring(e.length+1,t.length)}function mh(t,e,r){return t.reduce(function(n,a){return n[a]=te({},r[a],{enabled:e}),n},r)}function zv(t){try{return JSON.parse(JSON.stringify(t))}catch{}return t}var Cb={last:{},history:[]};function Ab(t,e){t===void 0&&(t=Cb);var r=e.options,n=e.meta;if(e.type===ee.track){var a=zv(te({event:e.event,properties:e.properties},Object.keys(r).length&&{options:r},{meta:n}));return te({},t,{last:a,history:t.history.concat(a)})}return t}var $b={actions:[]};function Lb(t,e){t===void 0&&(t=$b);var r=e.payload;switch(e.type){case"queue":var n;return n=r&&r.type&&r.type===ee.identify?[e].concat(t.actions):t.actions.concat(e),te({},t,{actions:n});case"dequeue":return[];default:return t}}var Hv=/#.*$/;function Ub(t){var e=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(t);return"/"+(e&&e[3]?e[3].split("?")[0].replace(Hv,""):"")}var Wv,Gv,Vv,Jv,xb=function(t){if(t===void 0&&(t={}),!Ae)return t;var e=document,r=e.title,n=e.referrer,a=window,i=a.location,o=a.innerWidth,s=a.innerHeight,u=i.hash,l=i.search,c=(function(h){var d=(function(){if(Ae){for(var p,v=document.getElementsByTagName("link"),g=0;p=v[g];g++)if(p.getAttribute("rel")==="canonical")return p.getAttribute("href")}})();return d?d.match(/\?/)?d:d+h:window.location.href.replace(Hv,"")})(l),f={title:r,url:c,path:Ub(c),hash:u,search:l,width:o,height:s};return n&&n!==""&&(f.referrer=n),te({},f,t)},qb={last:{},history:[]};function Nb(t,e){t===void 0&&(t=qb);var r=e.options;if(e.type===ee.page){var n=zv(te({properties:e.properties,meta:e.meta},Object.keys(r).length&&{options:r}));return te({},t,{last:n,history:t.history.concat(n)})}return t}Wv=(function(){if(!Ae)return!1;var t=navigator.appVersion;return~t.indexOf("Win")?"Windows":~t.indexOf("Mac")?"MacOS":~t.indexOf("X11")?"UNIX":~t.indexOf("Linux")?"Linux":"Unknown OS"})(),Gv=Ae?document.referrer:null,Vv=hb(),Jv=pb();var gh={initialized:!1,sessionId:la(),app:null,version:null,debug:!1,offline:!!Ae&&!navigator.onLine,os:{name:Wv},userAgent:Ae?navigator.userAgent:"node",library:{name:xs,version:"0.13.1"},timezone:Jv,locale:Vv,campaign:{},referrer:Gv};function jb(t,e){t===void 0&&(t=gh);var r=t.initialized,n=e.campaign;switch(e.type){case ee.campaign:return te({},t,{campaign:n});case ee.offline:return te({},t,{offline:!0});case ee.online:return te({},t,{offline:!1});default:return r?t:te({},gh,t,{initialized:!0})}}var Db=["plugins","reducers","storage"];function Mb(t,e,r){if(Ae){var n=window[(r?"add":"remove")+"EventListener"];t.split(" ").forEach(function(a){n(a,e)})}}function Fb(t){var e=Mb.bind(null,"online offline",function(r){return Promise.resolve(!navigator.onLine).then(t)});return e(!0),function(r){return e(!1)}}function Zv(){return tr(xs,[]),function(t){return function(e,r,n){var a=t(e,r,n),i=a.dispatch;return Object.assign(a,{dispatch:function(o){return Pr[Ir][xs].push(o.action||o),i(o)}})}}}function yh(t){return function(){return Er(Er.apply(null,arguments),Zv())}}function ms(t){return t?Nv(t)?t:[t]:[]}function wh(t,e,r){t===void 0&&(t={});var n,a,i=la();return e&&(Vr[i]=(n=e,a=(function(o){for(var s,u=o||Array.prototype.slice.call(arguments),l=0;l<u.length;l++)if(ze(u[l])){s=u[l];break}return s})(r),function(o){a&&a(o),n(o)})),te({},t,{rid:i,ts:new Date().getTime()},e?{hasCallback:!0}:{})}function Bb(t){t===void 0&&(t={});var e=t.reducers||{},r=t.initialUser||{},n=(t.plugins||[]).reduce(function(I,T){if(ze(T))return I.middlewares=I.middlewares.concat(T),I;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(Z){return T.EVENTS[Z]}):[];I.pluginEnabled[T.name]=!(T.enabled===!1||T.config.enabled===!1),delete T.enabled,T.methods&&(I.methods[T.name]=Object.keys(T.methods).reduce(function(Z,fe){var ae;return Z[fe]=(ae=T.methods[fe],function(){for(var ue=Array.prototype.slice.call(arguments),ie=new Array(ae.length),_e=0;_e<ue.length;_e++)ie[_e]=ue[_e];return ie[ie.length]=w,ae.apply({instance:w},ie)}),Z},{}),delete T.methods);var z=Object.keys(T).concat(N),X=new Set(I.events.concat(z));if(I.events=Array.from(X),I.pluginsArray=I.pluginsArray.concat(T),I.plugins[T.name])throw new Error(T.name+"AlreadyLoaded");return I.plugins[T.name]=T,I.plugins[T.name].loaded||(I.plugins[T.name].loaded=function(){return!0}),I},{plugins:{},pluginEnabled:{},methods:{},pluginsArray:[],middlewares:[],events:[]}),a=t.storage?t.storage:{getItem:er,setItem:tr,removeItem:Cr},i=(function(I){return function(T,N,z){return N.getState("user")[T]||(z&&Ke(z)&&z[T]?z[T]:oh(I)[T]||er(Ns(T))||null)}})(a),o=n.plugins,s=n.events.filter(function(I){return!qs.includes(I)}).sort(),u=new Set(s.concat(Cn).filter(function(I){return!qs.includes(I)})),l=Array.from(u).sort(),c=function(){return o},f=new Rb,h=f.addMiddleware,d=f.removeMiddleware,p=f.dynamicMiddlewares,v=function(){throw new Error("Abort disabled inListener")},g=vb(),P=oh(a),b=te({},P,r,g.an_uid?{userId:g.an_uid}:{},g.an_aid?{anonymousId:g.an_aid}:{});b.anonymousId||(b.anonymousId=la());var y=te({enable:function(I,T){return new Promise(function(N){S.dispatch({type:ee.enablePlugin,plugins:ms(I),_:{originalAction:ee.enablePlugin}},N,[T])})},disable:function(I,T){return new Promise(function(N){S.dispatch({type:ee.disablePlugin,plugins:ms(I),_:{originalAction:ee.disablePlugin}},N,[T])})}},n.methods),m=!1,w={identify:function(I,T,N,z){try{var X=Ct(I)?I:null,Z=Ke(I)?I:T,fe=N||{},ae=w.user();tr(Ns(kt),X);var ue=X||Z.userId||i(kt,w,Z);return Promise.resolve(new Promise(function(ie){S.dispatch(te({type:ee.identifyStart,userId:ue,traits:Z||{},options:fe,anonymousId:ae.anonymousId},ae.id&&ae.id!==X&&{previousId:ae.id}),ie,[T,N,z])}))}catch(ie){return Promise.reject(ie)}},track:function(I,T,N,z){try{var X=Ke(I)?I.event:I;if(!X||!Ct(X))throw new Error("EventMissing");var Z=Ke(I)?I:T||{},fe=Ke(N)?N:{};return Promise.resolve(new Promise(function(ae){S.dispatch({type:ee.trackStart,event:X,properties:Z,options:fe,userId:i(kt,w,T),anonymousId:i(gr,w,T)},ae,[T,N,z])}))}catch(ae){return Promise.reject(ae)}},page:function(I,T,N){try{var z=Ke(I)?I:{},X=Ke(T)?T:{};return Promise.resolve(new Promise(function(Z){S.dispatch({type:ee.pageStart,properties:xb(z),options:X,userId:i(kt,w,z),anonymousId:i(gr,w,z)},Z,[I,T,N])}))}catch(Z){return Promise.reject(Z)}},user:function(I){if(I===kt||I==="id")return i(kt,w);if(I===gr||I==="anonId")return i(gr,w);var T=w.getState("user");return I?eh(T,I):T},reset:function(I){return new Promise(function(T){S.dispatch({type:ee.resetStart},T,I)})},ready:function(I){return m&&I({plugins:y,instance:w}),w.on(ee.ready,function(T){I&&I(T),m=!0})},on:function(I,T){if(!I||!ze(T))return!1;if(I===ee.bootstrap)throw new Error(".on disabled for "+I);var N=/Start$|Start:/;if(I==="*"){var z=function(ae){return function(ue){return function(ie){return ie.type.match(N)&&T({payload:ie,instance:w,plugins:o}),ue(ie)}}},X=function(ae){return function(ue){return function(ie){return ie.type.match(N)||T({payload:ie,instance:w,plugins:o}),ue(ie)}}};return h(z,wn),h(X,bn),function(){d(z,wn),d(X,bn)}}var Z=I.match(N)?wn:bn,fe=function(ae){return function(ue){return function(ie){return ie.type===I&&T({payload:ie,instance:w,plugins:o,abort:v}),ue(ie)}}};return h(fe,Z),function(){return d(fe,Z)}},once:function(I,T){if(!I||!ze(T))return!1;if(I===ee.bootstrap)throw new Error(".once disabled for "+I);var N=w.on(I,function(z){T({payload:z.payload,instance:w,plugins:o,abort:v}),N()});return N},getState:function(I){var T=S.getState();return I?eh(T,I):Object.assign({},T)},dispatch:function(I){var T=Ct(I)?{type:I}:I;if(Cn.includes(T.type))throw new Error("reserved action "+T.type);var N=te({},T,{_:te({originalAction:T.type},I._||{})});S.dispatch(N)},enablePlugin:y.enable,disablePlugin:y.disable,plugins:y,storage:{getItem:a.getItem,setItem:function(I,T,N){S.dispatch({type:ee.setItemStart,key:I,value:T,options:N})},removeItem:function(I,T){S.dispatch({type:ee.removeItemStart,key:I,options:T})}},setAnonymousId:function(I,T){w.storage.setItem(At,I,T)},events:{core:Cn,plugins:s}},R=n.middlewares.concat([function(I){return function(T){return function(N){return N.meta||(N.meta=wh()),T(N)}}},p(wn),Tb(w,c,{all:l,plugins:s}),_b(a),Sb(w),Pb(w),p(bn)]),A={context:jb,user:Ib(a),page:Nb,track:Ab,plugins:Ob(c),queue:Lb},j=Er,B=Er;if(Ae&&t.debug){var W=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;W&&(j=W({trace:!0,traceLimit:25})),B=function(){return arguments.length===0?Zv():Ke(typeof arguments[0])?yh():yh().apply(null,arguments)}}var re,U=(function(I){return Object.keys(I).reduce(function(T,N){return Db.includes(N)||(T[N]=I[N]),T},{})})(t),M=n.pluginsArray.reduce(function(I,T){var N=T.name,z=T.config,X=T.loaded,Z=n.pluginEnabled[N];return I[N]={enabled:Z,initialized:!!Z&&!T.initialize,loaded:!!X({config:z}),config:z},I},{}),q={context:U,user:b,plugins:M},S=Mv((function(I){for(var T=Object.keys(I),N={},z=0;z<T.length;z++){var X=T[z];typeof I[X]===Tt&&(N[X]=I[X])}var Z,fe=Object.keys(N);try{(function(ae){Object.keys(ae).forEach(function(ue){var ie=ae[ue];if(typeof ie(void 0,{type:Us})===gt||typeof ie(void 0,{type:yb})===gt)throw new Error(en+" "+ue+" "+gt)})})(N)}catch(ae){Z=ae}return function(ae,ue){if(ae===void 0&&(ae={}),Z)throw Z;for(var ie=!1,_e={},je=0;je<fe.length;je++){var Me=fe[je],xe=ae[Me],et=(0,N[Me])(xe,ue);if(typeof et===gt){var Pt=wb(Me,ue);throw new Error(Pt)}_e[Me]=et,ie=ie||et!==xe}return ie?_e:ae}})(te({},A,e)),q,B(j(bb.apply(void 0,R))));S.dispatch=(re=S.dispatch,function(I,T,N){var z=te({},I,{meta:wh(I.meta,T,ms(N))});return re.apply(null,[z])});var O=Object.keys(o);S.dispatch({type:ee.bootstrap,plugins:O,config:U,params:g,user:b,initialUser:r,persistedUser:P});var x=O.filter(function(I){return n.pluginEnabled[I]}),F=O.filter(function(I){return!n.pluginEnabled[I]});return S.dispatch({type:ee.registerPlugins,plugins:O,enabled:n.pluginEnabled}),n.pluginsArray.map(function(I,T){var N=I.bootstrap,z=I.config,X=I.name;N&&ze(N)&&N({instance:w,config:z,payload:I}),S.dispatch({type:ee.registerPluginType(X),name:X,enabled:n.pluginEnabled[X],plugin:I}),n.pluginsArray.length===T+1&&S.dispatch({type:ee.initializeStart,plugins:x,disabled:F})}),Fb(function(I){S.dispatch({type:I?ee.offline:ee.online})}),(function(I,T,N){setInterval(function(){return Bv(I,T,N)},3e3)})(S,c,w),w}var wn="before",bn="after",Vt="cookie",Ft=Qv(),Yv=fa,Kb=fa;function Xv(t){return Ft?fa(t,"",-1):Cr(t)}function Qv(){if(Ft!==void 0)return Ft;var t=Vt+Vt;try{fa(t,t),Ft=document.cookie.indexOf(t)!==-1,Xv(t)}catch{Ft=!1}return Ft}function fa(t,e,r,n,a,i){if(typeof window<"u"){var o=arguments.length>1;return Ft===!1&&(o?tr(t,e):er(t)),o?document.cookie=t+"="+encodeURIComponent(e)+(r?"; expires="+new Date(+new Date+1e3*r).toUTCString()+(n?"; path="+n:"")+(a?"; domain="+a:"")+(i?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+t+"=")[1]||"").split(";")[0])}}var yt="localStorage",zb=Ec.bind(null,yt);Ar(yt,"getItem",er);Ar(yt,"setItem",tr);Ar(yt,"removeItem",Cr);var wt="sessionStorage",Hb=Ec.bind(null,wt);Ar(wt,"getItem",er);Ar(wt,"setItem",tr);Ar(wt,"removeItem",Cr);function br(t){var e=t;try{if((e=JSON.parse(t))==="true")return!0;if(e==="false")return!1;if(Ke(e))return e;parseFloat(e)===e&&(e=parseFloat(e))}catch{}if(e!==null&&e!=="")return e}var Wb=zb(),Gb=Hb(),Vb=Qv();function Jt(t,e){if(t){var r=kc(e),n=!Oc(r),a=Tc(r)?br(localStorage.getItem(t)):void 0;if(n&&!mr(a))return a;var i=_c(r)?br(Yv(t)):void 0;if(n&&i)return i;var o=Rc(r)?br(sessionStorage.getItem(t)):void 0;if(n&&o)return o;var s=er(t);return n?s:{localStorage:a,sessionStorage:o,cookie:i,global:s}}}function Mn(t,e,r){if(t&&!mr(e)){var n={},a=kc(r),i=JSON.stringify(e),o=!Oc(a);return Tc(a)&&(n[yt]=Sn(yt,e,br(localStorage.getItem(t))),localStorage.setItem(t,i),o)?n[yt]:_c(a)&&(n[Vt]=Sn(Vt,e,br(Yv(t))),Kb(t,i),o)?n[Vt]:Rc(a)&&(n[wt]=Sn(wt,e,br(sessionStorage.getItem(t))),sessionStorage.setItem(t,i),o)?n[wt]:(n[Wt]=Sn(Wt,e,er(t)),tr(t,e),o?n[Wt]:n)}}function Jb(t,e){if(t){var r=kc(e),n=Jt(t,Uv),a={};return!mr(n.localStorage)&&Tc(r)&&(localStorage.removeItem(t),a[yt]=n.localStorage),!mr(n.cookie)&&_c(r)&&(Xv(t),a[Vt]=n.cookie),!mr(n.sessionStorage)&&Rc(r)&&(sessionStorage.removeItem(t),a[wt]=n.sessionStorage),!mr(n.global)&&da(r,Wt)&&(Cr(t),a[Wt]=n.global),a}}function kc(t){return t?Ct(t)?t:t.storage:Lv}function Tc(t){return Wb&&da(t,yt)}function _c(t){return Vb&&da(t,Vt)}function Rc(t){return Gb&&da(t,wt)}function Oc(t){return t===Uv||t==="all"}function da(t,e){return t===Lv||t===e||Oc(t)}function Sn(t,e,r){return{location:t,current:e,previous:r}}var Zb={setItem:Mn,getItem:Jt,removeItem:Jb};function Yb(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function bh(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Sh(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?bh(Object(r),!0).forEach(function(n){Yb(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):bh(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Xb(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e={storage:Zb};return Bb(Sh(Sh({},e),t))}function Qb(t){if(typeof window>"u")return;const{addEventListener:e,history:r,location:n}=window;let a=n.pathname;e("popstate",()=>t(n.pathname)),["push","replace"].map(i=>{const o=`${i}State`;if(o!=="pushState"&&o!=="replaceState")return;const s=r[o];r[o]=function(...u){const l=u[2]?.toString()||"",c=tS(l);return a!==c&&(a=c,setTimeout(()=>t(l),0)),s.apply(r,u)}})}function eS(t,e){const r=t.indexOf(e);return r>-1?t.slice(0,r):t}function tS(t){return["#","?"].forEach(e=>t=eS(t,e)),t}function rS(){Qb(()=>{ht.page()})}var gs="up",ys="down";function nS(t){if(t===void 0&&(t={}),!Ae)return Ls;var e=Ph(),r=js(),n=Ih(),a=In(n,e),i=In(r,e),o=[],s=[],u=[],l=n,c=a,f=i,h=Object.keys(t);if(!h.length)return Ls;var d=h.map(function(v){return Number(v)}),p=gb(function(){var v=Ph(),g=(function(U,M){return M.map(function(q){return q===100?U-5:U*(q/100)})})(v,d),P=js(),b=Ih(),y=In(b,v),m=In(P,v);if(c=y>c?y:c,f=m<f?m:f,!(o.length>=d.length)){var w=l===b,R=gs;w?R="initial":l<=b&&(R=ys);var A=g,j=d;(R===gs||w)&&(A=g.slice().reverse(),j=d.slice().reverse());var B=j.reduce(function(U,M,q){var S=A[q];return u.includes(M)&&b<=S&&(u=u.filter(function(O){return O!==M}),U.singleFunction=M),R===ys&&!o.includes(M)&&b>=S&&M>i?(s.push(M),U.callbacks=U.callbacks.concat(M),U):R===gs&&!o.includes(M)&&b<=S&&M<=y?(U.foundFunc=[M],U):(w&&b>=S&&U.foundFunc.length===0&&(U.foundFunc=[M]),!s.includes(M)&&b>=S&&(s.push(M),U.singleFunction?u.push(M):U.singleFunction=M),U)},{foundFunc:[],singleFunction:null,callbacks:[],direction:R});if(l=b,R===ys&&B.callbacks&&B.callbacks.forEach(function(U){ze(t[U])&&(t[U]({trigger:U,direction:R,scrollMin:f,scrollMax:c,range:[f,c]}),o.push(U))}),B.singleFunction){var W=B.singleFunction,re=B.direction;ze(t[W])&&t[W]({trigger:W,direction:re,scrollMin:f,scrollMax:c,range:[f,c]}),o.push(W)}}},500);return window.addEventListener("scroll",p),function(){return window.removeEventListener("scroll",p)}}function js(){return Ae?document.body.scrollTop||document.documentElement.scrollTop:0}function aS(){return Ae?window.innerHeight||document.documentElement.clientHeight:0}function Ih(){return Math.round(js()+aS())}function Ph(){if(!Ae)return 0;var t=document.body,e=document.documentElement;return Math.max(t.scrollHeight,t.offsetHeight,e.clientHeight,e.scrollHeight,e.offsetHeight)}function In(t,e){return Math.round(t/e*100)}var Cc="Event",Eh=Cc+"Listener";function iS(t){return function(e,r,n,a){var i=n||Ls,o=a||!1;if(!Ae)return i;var s=Fn(r),u=Fn(e,!0);if(!u.length)throw new Error("noElements");if(!s.length)throw new Error("no"+Cc);var l=[];return(function c(f){f&&(l=[]);for(var h=f?"add"+Eh:"remove"+Eh,d=0;d<u.length;d++){var p=u[d];l[d]=f?o&&o.once?oS(i):i:l[d]||i;for(var v=0;v<s.length;v++)p[h]?p["on"+s[v]]=f?l[d]:null:p[h](s[v],l[d],o)}return c.bind(null,!f)})(t)}}function Fn(t,e){if(Ct(t))return e?Fn(document.querySelectorAll(t)):(r=t).split(r.indexOf(",")>-1?",":" ").map(function(o){return o.trim()});var r;if(NodeList.prototype.isPrototypeOf(t)){for(var n=[],a=t.length>>>0;a--;)n[a]=t[a];return n}var i=db(t);return e?i.map(function(o){return Ct(o)?Fn(o,!0):o}).flat():i}function oS(t,e){var r;return function(){return t&&(r=t.apply(this,arguments),t=null),r}}var ws=iS(Cc);function em(t,e){return Ae&&ze(window[t])?(r=window[t],n=e,(a=window)===void 0&&(a=null),ze(r)?function(){r.apply(a,arguments),n.apply(a,arguments)}:n):window[t]=e;var r,n,a}em.bind(null,"onerror");em.bind(null,"onload");var tm=typeof window>"u",kh="hidden";function sS(t){if(tm)return!1;var e=cS(),r="".concat(e.replace(/[H|h]idden/,""),"visibilitychange"),n=function(){return t(!!document[e])},a=function(){return document.addEventListener(r,n)};return a(),function(){return document.removeEventListener(r,n),a}}function cS(){var t=["webkit","moz","ms","o"];return tm||kh in document?kh:t.reduce(function(e,r){var n=r+"Hidden";return!e&&n in document?n:e},null)}var uS=["mousemove","mousedown","touchmove","touchstart","touchend","keydown"];function lS(t,e){e===void 0&&(e={});var r=(function(o,s){var u=this,l=!1;return function(c){l||(o.call(u,c),l=!0,setTimeout(function(){return l=!1},s))}})(t,e.throttle||1e4),n=[];function a(){var o=sS(function(s){s||r({type:"tabVisible"})});return n=[o].concat(uS.map(function(s){return ws(document,s,r)})).concat(ws(window,"load",r)).concat(ws(window,"scroll",r,{capture:!0,passive:!0})),i}function i(){n.map(function(o){return o()})}return a(),function(){return i(),a}}function fS(t){var e,r,n=t.onIdle,a=t.onWakeUp,i=t.onHeartbeat,o=t.timeout,s=o,u=t.throttle,l=u===void 0?2e3:u,c=!1,f=!1,h=new Date,d=function(){return clearTimeout(e)};function p(g){d(),i&&!c&&i(Br(h),g),a&&c&&(c=!1,a(Br(r),g),h=new Date),e=setTimeout(function(){c=!0,n&&(r=new Date,n(Br(h),g))},s)}var v=lS(p,{throttle:l});return{disable:function(){f=!0,c=!1,d();var g=v();return function(){return f=!1,h=new Date,p({type:"load"}),g()}},getStatus:function(){return{isIdle:c,isDisabled:f,active:c?0:Br(h,f),idle:c?Br(r,f):0}}}}function Br(t,e){return e?0:Math.round((new Date-t)/1e3)}const Th=5e3;class dS{element;isInViewport=!1;isAwake=!1;isFlushing;observer;lastEventAt=Date.now();registeredView=!1;viewCallback;activeDurationCallback;idleDurationCallback;scrollCallback;constructor(e){this.element=e.element,this.viewCallback=e.viewCallback,this.activeDurationCallback=e.activeDurationCallback,this.idleDurationCallback=e.idleDurationCallback,this.scrollCallback=e.scrollCallback,this.observer=new IntersectionObserver(r=>{r.forEach(n=>{this.handleInViewPort(n.isIntersecting)})},{threshold:0}),this.observer.observe(this.element),fS({onIdle:r=>this.handleAwake(!1,r),onWakeUp:r=>this.handleAwake(!0,r),timeout:Th}),nS({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(e){e?(this.isAwake=!0,this.trackInViewport()):this.handleAwake(!1),this.isInViewport=e}handleAwake(e,r=Math.round((Date.now()-this.lastEventAt)/1e3)){this.isAwake=e,this.lastEventAt=e?Date.now()-r*Th:Date.now(),this.isInViewport&&this.trackAwake(e,r)}handleScroll(e){this.scrollCallback&&this.scrollCallback(e)}handleVisibilityChange(){this.isAwake=!1;const e=Math.round((Date.now()-this.lastEventAt)/1e3);e>1&&(this.lastEventAt=Date.now(),this.trackAwake(!1,e))}trackAwake(e,r){!e&&this.activeDurationCallback&&this.activeDurationCallback(r,this.isFlushing,this.lastEventAt),e&&this.idleDurationCallback&&this.idleDurationCallback(r,this.isFlushing,this.lastEventAt)}trackInViewport(){this.registeredView||(this.registeredView=!0,this.viewCallback&&this.viewCallback())}}function rm(t){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):t()}function hS(t,e){e=e||{};var r,n,a=[],i=e.max||1/0;function o(){clearInterval(r),t(a.splice(0,i)),s()}function s(){r=setInterval(o,e.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(r)}}}const _h="sesamy_session_id";function pS(){let t=sessionStorage.getItem(_h);return t||(t=Math.random().toString(36).slice(2,9),sessionStorage.setItem(_h,t)),t}let nm=!1,An,Bn,Ds;function am(t){return JSON.stringify(t.map(e=>{const{campaign:r,...n}=e.properties||{};return{anonymousId:e.anonymousId,userId:e.userId,type:e.type,properties:n,clientId:Ds,requestId:Math.random().toString(36).slice(2,9),sessionId:pS(),timestamp:new Date().toISOString(),version:fn,event:e.event,context:{...e.context,page:{url:window.location.href,title:document.title,referrer:document.referrer,itemSrc:ge("sesamy:item-src"),publisherContentId:ge("sesamy:publisher-content-id")},campaign:r,locale:navigator.language,library:Sc,userAgent:navigator.userAgent,clientId:Ds}}}))}const im=hS(async t=>{if(t.length>0){const e=am(t);nm?navigator.sendBeacon(Bn,e):(await fetch(Bn,{method:"POST",body:e,headers:{"Content-Type":"text/plain"}})).ok}},{max:10,interval:3e3});function bs(t){if(t.anonymousId)if(t.properties?.flushing){const e={...t};delete e.properties.flushing,navigator.sendBeacon(Bn,am([e]))}else im.push(t)}function vS(){return nm=!0,im.flush()}function mS(t,e,r){An=e,Bn=`${rt("logs",r)}/events`,Ds=t}const gS={name:"custom-analytics-plugin",page:({payload:t})=>{if(!An)return;const{properties:e,anonymousId:r,userId:n,event:a}=t;bs({anonymousId:r,userId:n,properties:e,event:a,type:"page"})},track:({payload:t})=>{if(!An)return;const{properties:e,anonymousId:r,userId:n,event:a}=t;bs({anonymousId:r,userId:n,properties:e,event:a,type:"track"})},identify:({payload:t})=>{if(!An)return;const{properties:e,anonymousId:r,userId:n}=t;bs({anonymousId:r,userId:n,properties:e,type:"identify"})}},Rh=["source","medium","campaign","term","content"],_t="utm_",yS=1800*1e3;function om(t){return t?Date.now()-parseInt(t,10)>yS:!0}function Oh(){const t=document.referrer||"";if(!t)return;const e=Jt(`${_t}set_at`);(om(e)||!Jt(`${_t}referrer`))&&Mn(`${_t}referrer`,t)}function wS(){const t=()=>{const r={};for(const a of Rh){const i=Jt(`${_t}${a}`);i&&(r[`utm_${a}`]=i)}const n=Jt(`${_t}referrer`);return n&&(r.utm_referrer=n),r};return{name:"attribution-tracking",initialize(){Oh()},campaign({payload:r}){const n=r?.campaign||{},a=Jt(`${_t}set_at`);if(Object.keys(n).length>0&&om(a)){for(const o of Rh){const s=n[o];s&&Mn(`${_t}${o}`,s)}Mn(`${_t}set_at`,String(Date.now()))}Oh()},page({payload:r}){return r.properties.campaign=t(),r},track({payload:r}){return r.properties.campaign=t(),r},getStoredCampaignData:t}}const bS=wS(),Ch=new Map,Ah=new Map;function SS({clientId:t,enabled:e=!0,environment:r}){mS(t,e,r),e&&(window.addEventListener("beforeunload",()=>{Ah.forEach((n,a)=>{n.bind(a)()}),vS()}),window.addEventListener("visibilitychange",()=>{document.visibilityState!=="visible"&&Ch.forEach((n,a)=>{n.bind(a)()})}),rS(),rm(()=>{const n=new dS({element:document.body,viewCallback:()=>{ht.page()},activeDurationCallback:(a,i,o)=>{ht.track("activeDuration",{duration:a,durationStart:o,flushing:i})},idleDurationCallback:(a,i,o)=>{ht.track("idleDuration",{duration:a,durationStart:o,flushing:i})},scrollCallback:a=>{ht.track("scroll",{scroll:a.scrollMax})}});Ah.set(document.body,()=>{n.flush()}),Ch.set(document.body,()=>{n.handleVisibilityChange()})}),window.addEventListener(We.AUTHENTICATED,async n=>{const a=n;await ht.identify(a.detail.sub)}),window.addEventListener(We.LOGOUT,async()=>{await ht.track("logout",{}),await ht.reset()}))}const ht=Xb({app:Sc,version:fn,plugins:[bS,gS]});function sm(t,e){ht.track(t,e)}const IS=["AdHeader","AdContainer","AD_Top","homead","ad-lead"];function cm(){return new Promise(t=>{const e=IS.map(r=>{const n=document.createElement("div");return n.innerHTML="&nbsp;",n.id=r,n.style.position="absolute",document.body.appendChild(n),n});window.setTimeout(()=>{const r=!e.every(n=>document.querySelector(`#${n.id}`)?.offsetParent);e.forEach(n=>n.remove()),t(r)},100)})}function um(){const t=navigator.userAgent.toLowerCase(),e=[{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 r of e)if(r.regex.test(t))return{isInAppBrowser:!0,browserName:r.name};return/; wv\)/.test(t)?{isInAppBrowser:!0,browserName:"Unknown In-App Browser"}:{isInAppBrowser:!1,browserName:null}}function PS(t,e,r=!1){const n={name:t,data:e},a=new CustomEvent(t,{detail:n,cancelable:r,bubbles:!0});sm(`event:${t}`,{...e,timestamp:new Date().toISOString()});const i=window.dispatchEvent(a);return r&&!i?{canceled:!0,message:n.cancellationMessage}:{canceled:!1}}function ES(t,e){t.cancelable&&(t.detail.cancellationMessage=e,t.preventDefault())}const kS=["sesamy","__sesamy","__anon_id","auth0","a0","_legacy_auth0"],TS=["access_token","id_token","refresh_token","token"];function Ms(t){const e=t.split(".");return e.length===3?`${e[0]}.${e[1]}.[REDACTED]`:t}function lm(t){const e=t.toLowerCase();return TS.some(r=>e.includes(r))}function fm(t){const e=t.split(".");return e.length===3&&e.every(r=>r.length>0)}function $h(t){const e=[];for(let r=0;r<t.length;r++){const n=t.key(r);if(!n)continue;if(kS.some(i=>n.toLowerCase().startsWith(i.toLowerCase()))){let i=t.getItem(n)||"",o=!1;(lm(n)||fm(i))&&(i=Ms(i),o=!0);try{const s=JSON.parse(i);if(typeof s=="object"&&s!==null){const u=Fs(s);u.wasRedacted&&(i=JSON.stringify(u.value),o=!0)}}catch{}e.push({key:n,value:i,redacted:o})}}return e}function Fs(t){if(t==null)return{value:t,wasRedacted:!1};if(typeof t=="string")return fm(t)?{value:Ms(t),wasRedacted:!0}:{value:t,wasRedacted:!1};if(Array.isArray(t)){let e=!1;return{value:t.map(n=>{const a=Fs(n);return a.wasRedacted&&(e=!0),a.value}),wasRedacted:e}}if(typeof t=="object"){let e=!1;const r={};for(const[n,a]of Object.entries(t))if(lm(n)&&typeof a=="string")r[n]=Ms(a),e=!0;else{const i=Fs(a);i.wasRedacted&&(e=!0),r[n]=i.value}return{value:r,wasRedacted:e}}return{value:t,wasRedacted:!1}}function _S(){const t=navigator;return{userAgent:t.userAgent,platform:t.platform,language:t.language,languages:[...t.languages||[]],cookiesEnabled:t.cookieEnabled,onLine:t.onLine,hardwareConcurrency:t.hardwareConcurrency,deviceMemory:t.deviceMemory,maxTouchPoints:t.maxTouchPoints,vendor:t.vendor,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,screenWidth:screen.width,screenHeight:screen.height,pixelRatio:window.devicePixelRatio,colorDepth:screen.colorDepth,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,timezoneOffset:new Date().getTimezoneOffset()}}async function RS(){await iv();const[t]=await Promise.all([cm()]),e=um();return{adBlockEnabled:t,incognitoMode:aa()??!1,inAppBrowser:e.isInAppBrowser}}async function dm(t){const e=[],r={timestamp:new Date().toISOString(),sdkVersion:fn,clientId:t.clientId,fallbackId:t.fallbackId};r.pageUrl=window.location.href,r.pageTitle=document.title;try{r.browser=_S()}catch(a){e.push(`Browser info collection failed: ${a.message}`)}try{r.detection=await RS()}catch(a){e.push(`Detection collection failed: ${a.message}`)}try{r.localStorage=$h(localStorage)}catch(a){e.push(`LocalStorage collection failed: ${a.message}`)}try{r.sessionStorage=$h(sessionStorage)}catch(a){e.push(`SessionStorage collection failed: ${a.message}`)}if(await Ot()){try{const a=await pt(!1);if(a){const i=a.split(".");if(i.length>=2){const o=JSON.parse(atob(i[1]));r.userId=o.sub}}}catch(a){e.push(`User ID extraction failed: ${a.message}`)}if(t.getProfile)try{r.profile=await t.getProfile()||void 0}catch(a){e.push(`Profile collection failed: ${a.message}`)}if(t.getEntitlements)try{r.entitlements=await t.getEntitlements()}catch(a){e.push(`Entitlements collection failed: ${a.message}`)}if(t.getContracts)try{r.contracts=await t.getContracts()}catch(a){e.push(`Contracts collection failed: ${a.message}`)}if(t.getTags)try{r.tags=await t.getTags()}catch(a){e.push(`Tags collection failed: ${a.message}`)}if(t.getTallies)try{r.tallies=await t.getTallies()}catch(a){e.push(`Tallies collection failed: ${a.message}`)}}return e.length>0&&(r.errors=e),r}async function OS(t,e,r){const a=`${rt("api2",e)}/diagnostics`,i={"Content-Type":"application/json"};if(await Ot())try{const s=await pt(!1);s&&(i.Authorization=`Bearer ${s}`)}catch{}if(!i.Authorization&&r){const s=localStorage.getItem("__anon_id")?.replace(/"/g,"")||"",u=btoa(`${r}|${s}:`);i.Authorization=`Basic ${u}`}const o=await fetch(a,{method:"POST",headers:i,body:JSON.stringify(t)});if(!o.ok){const s=await o.text();throw new Error(`Failed to submit diagnostics: ${s}`)}return o.json()}const Lh="user-diagnostics",Uh="diagnostics-id",CS=`
37
37
  .sesamy-diagnostics-modal {
38
38
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
39
39
  background: white;
@@ -130,8 +130,8 @@ CAUSE: `+d.stack,w.response=y,w.status=y.status,w.url=f,y.type==="opaque")throw
130
130
  @keyframes spin {
131
131
  to { transform: rotate(360deg); }
132
132
  }
133
- `;function vS(){const t=document.createElement("div");return t.className="sesamy-diagnostics-modal",t.innerHTML=`
134
- <style>${pS}</style>
133
+ `;function AS(){const t=document.createElement("div");return t.className="sesamy-diagnostics-modal",t.innerHTML=`
134
+ <style>${CS}</style>
135
135
  <h2>Send Diagnostics</h2>
136
136
  <p>
137
137
  Our support team has requested diagnostic information to help troubleshoot your issue.
@@ -142,7 +142,7 @@ CAUSE: `+d.stack,w.response=y,w.status=y.status,w.url=f,y.type==="opaque")throw
142
142
  <button class="btn-primary" data-action="send">Send Diagnostics</button>
143
143
  </div>
144
144
  <div class="status" style="display: none;"></div>
145
- `,t}function Xv(t){return new Promise(e=>{const r=vS(),{close:n}=gv(r,{closeOnBackdropClick:!1,closeOnEscape:!0}),a=r.querySelector('[data-action="cancel"]'),i=r.querySelector('[data-action="send"]'),o=r.querySelector(".status"),s=(u,l)=>{o.style.display="block",o.className=`status ${l}`,l==="loading"?o.innerHTML=`<span class="spinner"></span>${u}`:o.textContent=u};a.addEventListener("click",()=>{n(),e({sent:!1})}),i.addEventListener("click",async()=>{i.disabled=!0,a.disabled=!0,s("Collecting diagnostics...","loading");try{const u=await Yv(t);s("Sending diagnostics...","loading");const l=await hS(u,t.environment,t.clientId);s("Diagnostics sent successfully!","success"),setTimeout(()=>{n(),e({sent:!0,id:l.id})},1500)}catch(u){G(`Failed to send diagnostics: ${u.message}`),s(`Failed to send: ${u.message}`,"error"),i.disabled=!1,a.disabled=!1}})})}async function mS(t){const e=new URLSearchParams(window.location.search);if(e.get(Ph)?.toLowerCase()!=="true")return;const n=e.get(Eh);n&&(t.fallbackId=n),G("User diagnostics requested via query parameter");const a=new URL(window.location.href);a.searchParams.delete(Ph),a.searchParams.delete(Eh),window.history.replaceState(null,"",a);const i=await Xv(t);i.sent?G(`Diagnostics sent with ID: ${i.id}`):G("User cancelled diagnostics")}async function gS(t){return Xv(t)}function yS(t){const{autoOnboardProduct:e,bills:r,checkouts:n,contracts:a,deleteTag:i,deleteTally:o,entitlements:s,generateLink:u,getEntitlements:l,getFulfillments:c,getProfile:f,getProxyContent:h,getSubscriptions:d,getTags:p,getTally:v,getTallies:g,getTransaction:P,hasAccess:b,isSpotifyLinked:y,linkSpotify:m,openHostedAccountPage:w,paywalls:R,paymentIssues:A,products:j,pushTally:K,requestDelivery:B,setTag:re,transactions:L,unlinkSpotify:M,updateProfile:N,userMetadata:S,vendor:O}=Ow(t),q=()=>A.list(),_={analytics:{track:Gv},attribution:{get:Nn,set:rv},auth:{getUser:f,getTokenSilently:pt,isAuthenticated:Ot,loginWithRedirect:ia,loginWithPopup:Jp,login:Ty,logout:uc,setToken:ks},bills:r,browser:{detectAdblock:Wv,isInAppBrowser:Vv,isIncognito:na},checkouts:n,clearCache:mt,content:{list:vv,get:hn,getLanguage:Yr,hasAccess:Tw,unlock:mv,getPropertyFromHTML:pc,showModal:gv,showNotificationBar:Rw},contracts:a,diagnostics:{send:x=>gS({clientId:t.clientId||t.vendorId,environment:t.environment,fallbackId:x,getProfile:()=>f(),getEntitlements:()=>l(),getContracts:()=>a.list(),getTags:()=>p(),getTallies:()=>g()}),collect:x=>Yv({clientId:t.clientId||t.vendorId,environment:t.environment,fallbackId:x,getProfile:()=>f(),getEntitlements:()=>l(),getContracts:()=>a.list(),getTags:()=>p(),getTallies:()=>g()})},entitlements:{...s,access:s.getAccess,hasAccess:b,list:l,signedLinks:fc},events:{emit:sS,cancel:cS},flags:{get:ov,set:iv,list:dn,delete:sv},fulfillments:{list:c,requestDelivery:B},generateLink:u,getPaymentIssues:q,getVersion:wS,isReady:()=>exports.isInitialized,log:G,paywalls:R,paymentIssues:A,products:{...j,autoOnboard:e,linkSpotify:m},profile:{get:f,isSpotifyLinked:y,openHostedAccountPage:w,unlinkSpotify:M,update:N},proxy:{getContent:h},subscriptions:{list:d},tags:{delete:i,list:p,set:re},tallies:{delete:o,get:v,list:g,push:K},transactions:{...L,get:P},userMetadata:S,vendor:O,setToken:ks};return t.namespace&&(window[t.namespace]=_),_}function wS(){return fn}function bS(t,e){t.style.position="relative",t.style.height="200px",t.style.overflow="hidden";let n=0;const a=Array.from(t.children);for(const o of a){const s=o.offsetHeight;n+s>200?o.remove():n+=s}const i=document.createElement("style");i.innerHTML=`
145
+ `,t}function hm(t){return new Promise(e=>{const r=AS(),{close:n}=$v(r,{closeOnBackdropClick:!1,closeOnEscape:!0}),a=r.querySelector('[data-action="cancel"]'),i=r.querySelector('[data-action="send"]'),o=r.querySelector(".status"),s=(u,l)=>{o.style.display="block",o.className=`status ${l}`,l==="loading"?o.innerHTML=`<span class="spinner"></span>${u}`:o.textContent=u};a.addEventListener("click",()=>{n(),e({sent:!1})}),i.addEventListener("click",async()=>{i.disabled=!0,a.disabled=!0,s("Collecting diagnostics...","loading");try{const u=await dm(t);s("Sending diagnostics...","loading");const l=await OS(u,t.environment,t.clientId);s("Diagnostics sent successfully!","success"),setTimeout(()=>{n(),e({sent:!0,id:l.id})},1500)}catch(u){H(`Failed to send diagnostics: ${u.message}`),s(`Failed to send: ${u.message}`,"error"),i.disabled=!1,a.disabled=!1}})})}async function $S(t){const e=new URLSearchParams(window.location.search);if(e.get(Lh)?.toLowerCase()!=="true")return;const n=e.get(Uh);n&&(t.fallbackId=n),H("User diagnostics requested via query parameter");const a=new URL(window.location.href);a.searchParams.delete(Lh),a.searchParams.delete(Uh),window.history.replaceState(null,"",a);const i=await hm(t);i.sent?H(`Diagnostics sent with ID: ${i.id}`):H("User cancelled diagnostics")}async function LS(t){return hm(t)}function US(t){const{autoOnboardProduct:e,bills:r,checkouts:n,contracts:a,deleteTag:i,deleteTally:o,entitlements:s,generateLink:u,getEntitlements:l,getFulfillments:c,getProfile:f,getProxyContent:h,getSubscriptions:d,getTags:p,getTally:v,getTallies:g,getTransaction:P,hasAccess:b,isSpotifyLinked:y,linkSpotify:m,openHostedAccountPage:w,paywalls:R,paymentIssues:A,products:j,pushTally:B,requestDelivery:W,setTag:re,transactions:U,unlinkSpotify:M,updateProfile:q,userMetadata:S,vendor:O}=Hw(t),x=()=>A.list(),T={analytics:{track:sm},attribution:{get:qn,set:gv},auth:{getUser:f,getTokenSilently:pt,isAuthenticated:Ot,loginWithRedirect:oa,loginWithPopup:lv,login:zy,logout:yc,setToken:Os},bills:r,browser:{detectAdblock:cm,isInAppBrowser:um,isIncognito:aa},checkouts:n,clearCache:mt,content:{list:Cv,get:hn,getLanguage:Yr,hasAccess:Kw,unlock:Av,getPropertyFromHTML:Pc,showModal:$v,showNotificationBar:zw},contracts:a,diagnostics:{send:N=>LS({clientId:t.clientId||t.vendorId,environment:t.environment,fallbackId:N,getProfile:()=>f(),getEntitlements:()=>l(),getContracts:()=>a.list(),getTags:()=>p(),getTallies:()=>g()}),collect:N=>dm({clientId:t.clientId||t.vendorId,environment:t.environment,fallbackId:N,getProfile:()=>f(),getEntitlements:()=>l(),getContracts:()=>a.list(),getTags:()=>p(),getTallies:()=>g()})},entitlements:{...s,access:s.getAccess,hasAccess:b,list:l,signedLinks:bc},events:{emit:PS,cancel:ES},flags:{get:Sv,set:bv,list:dn,delete:Iv},fulfillments:{list:c,requestDelivery:W},generateLink:u,getPaymentIssues:x,getVersion:xS,isReady:()=>exports.isInitialized,log:H,paywalls:R,paymentIssues:A,products:{...j,autoOnboard:e,linkSpotify:m},profile:{get:f,isSpotifyLinked:y,openHostedAccountPage:w,unlinkSpotify:M,update:q},proxy:{getContent:h},subscriptions:{list:d},tags:{delete:i,list:p,set:re},tallies:{delete:o,get:v,list:g,push:B},transactions:{...U,get:P},userMetadata:S,vendor:O,setToken:Os};return t.namespace&&(window[t.namespace]=T),T}function xS(){return fn}function qS(t,e){t.style.position="relative",t.style.height="200px",t.style.overflow="hidden";let n=0;const a=Array.from(t.children);for(const o of a){const s=o.offsetHeight;n+s>200?o.remove():n+=s}const i=document.createElement("style");i.innerHTML=`
146
146
  ${e.selector}::before {
147
147
  content: '';
148
148
  position: absolute;
@@ -153,4 +153,4 @@ CAUSE: `+d.stack,w.response=y,w.status=y.status,w.url=f,y.type==="opaque")throw
153
153
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), white);
154
154
  pointer-events: none;
155
155
  }
156
- `,document.head.appendChild(i)}async function SS(t){try{const e=await fetch(t);return e.ok?await e.text():(console.error(`Failed to fetch content from ${t}: ${e.statusText}`),null)}catch(e){return console.error(`Error fetching content from ${t}:`,e),null}}async function Ic(t){if(t.contentType==="selector"&&t.content){const e=document.querySelector(t.content);if(e)return e.innerHTML;console.warn(`Source element for selector '${t.content}' not found`)}else if(t.contentType==="url"&&t.content){const e=await SS(t.content);if(e)return e;console.warn(`Failed to fetch content from URL '${t.content}'`)}else if(t.content)return t.content;return""}async function IS(t,e){const r=e.insertionPoint||"inside",n=await Ic(e);switch(r){case"before":t.insertAdjacentHTML("beforebegin",n);break;case"after":t.insertAdjacentHTML("afterend",n);break;case"inside":default:t.innerHTML+=n;break}}async function PS(t,e){const r=await Ic(e);t.innerHTML=r}async function ES(t,e){const r=await Ic(e);t.innerHTML=r.replace("${content}",t.innerHTML)}async function kS({enabled:t=!1,rules:e}){t&&Fv(async()=>{const r=await Ot(),n=window.location.href;for(const a of e){const i=document.querySelectorAll(a.selector);if(!(a.path&&!new RegExp(a.path).test(n)))for(const o of i){const s=o;if(!(a.authenticated!==void 0&&a.authenticated!==r))switch(a.transform){case"insert":await IS(s,a);break;case"replace":await PS(s,a);break;case"remove":o.remove();break;case"wrap":await ES(s,a);break;case"gradient":bS(s,a);break;default:console.warn(`Unknown transform type: ${a.transform}`)}}}})}const kh="access_token";function _S(){const t=new URLSearchParams(window.location.hash.substring(1)),e=t.get(kh);if(e){ks(e);const r=new URL(window.location.href);t.delete(kh),r.hash=t.toString(),window.history.replaceState(null,"",r)}}const _h="sesamy-refresh",Th="force-refetch-entitlements";function TS(){const t=new URLSearchParams(window.location.search),e=t.get(Th),r=t.get(_h);if(e!==null||r!==null){const n=new URL(window.location.href);t.delete(Th),t.delete(_h),n.search=t.toString(),mt(),window.history.replaceState(null,"",n)}}function RS(t){if(!t||typeof t!="string")throw new Error("Invalid token: token must be a non-empty string");const e=t.split(".");if(e.length!==3)throw new Error("Invalid JWT format: token must have exactly 3 parts separated by dots");const[,r]=e;if(!r)throw new Error("Invalid JWT format: payload is empty");let n;try{n=atob(r)}catch{throw new Error("Invalid JWT format: payload is not valid base64")}try{return JSON.parse(n)}catch{throw new Error("Invalid JWT format: payload is not valid JSON")}}function OS(t,e){const r=new Date(t.exp*1e3);return{id:"",title:t.p?.toString(),sku:t.s?.toString(),purchaseOption:t.p?.toString(),publisherContentId:t.pid?.toString(),url:t.url?.toString(),token:e,type:"article",hasAccess:!0,expiresAt:r.toISOString(),createdAt:new Date(t.iat*1e3).toISOString(),updatedAt:new Date(t.iat*1e3).toISOString()}}function CS(t,e){const r=new Date(t.exp*1e3),n=t.meta;return{id:t.tid?.toString()||"",title:n?.purchaseOption?.toString()||t.tier?.toString(),sku:t.tier?.toString(),purchaseOption:n?.purchaseOption?.toString(),publisherContentId:t.contentId?.toString(),url:t.url?.toString(),token:e,type:"article",hasAccess:!0,expiresAt:r.toISOString(),createdAt:new Date(t.iat*1e3).toISOString(),updatedAt:new Date(t.iat*1e3).toISOString()}}function AS(t){return t.v===1&&typeof t.tier=="string"&&typeof t.contentId=="string"}function $S(){const t=new URLSearchParams(window.location.search),e=t.get("sesamy_token")||t.get("sesamy-token")||t.get("token");if(!e)return;try{const n=RS(e),a=AS(n)?CS(n,e):OS(n,e);mw(a)}catch(n){G(`Failed to extract signed link ${n}`)}const r=new URL(window.location.href);r.searchParams.delete("ss"),r.searchParams.delete("se"),r.searchParams.delete("sp"),r.searchParams.delete("so"),r.searchParams.delete("token"),r.searchParams.delete("sesamy-token"),r.searchParams.delete("sesamy_token"),window.history.replaceState(null,"",r)}const Rh="sesamy-user";async function US(){const e=new URLSearchParams(window.location.search).get(Rh)?.toLowerCase();if(!e)return;const r=await ky();r?.email!==e?(G(`Current user does not match sesamy user: ${r?.email} !== ${e}`),mt(),ia({authorizationParams:{login_hint:e}})):G(`Current user matches sesamy user: ${r?.email} === ${e}`);const n=new URL(window.location.href);n.searchParams.delete(Rh),window.history.replaceState(null,"",n)}const Oh="sesamy-purchase";function LS(){const t=new URLSearchParams(window.location.search),e=t.get(Oh);if(e!==null){const r=new URL(window.location.href);t.delete(Oh),r.search=t.toString(),G(`Purchase ${e}`),Zt(Ge.PURCHASE,{itemSrc:e}),mt(),window.history.replaceState(null,"",r)}}const Ch="sesamy-login",qS="sesamy_login";async function NS(){const t=new URLSearchParams(window.location.search);if(!(t.get(Ch)||t.get(qS)))return;await Ot()||ia();const n=new URL(window.location.href);n.searchParams.delete(Ch),window.history.replaceState(null,"",n)}const Ah="sesamy-debug";async function xS(){const e=new URLSearchParams(window.location.search).get(Ah)?.toLowerCase();if(!e)return;yg(e==="true");const r=new URL(window.location.href);r.searchParams.delete(Ah),window.history.replaceState(null,"",r)}function jS(){if(!document.referrer.length)return;const t=new URL(document.referrer);if(!(t.hostname===window.location.hostname||t.hostname.includes("sesamy")))return document.referrer}async function DS(t){if(!Yt())return;const e=new URLSearchParams(window.location.search),r={utmSource:e.get("utm_source")??void 0,utmMedium:e.get("utm_medium")??void 0,utmCampaign:e.get("utm_campaign")??void 0,utmTerm:e.get("utm_term")??void 0,utmContent:e.get("utm_content")??void 0,ref:e.get("ref")??void 0,referrer:jS()},[n]=t.content.list();n?.url&&(r.itemSrc=n.url,r.publisherContentId=n.id),rv(r)}function MS(){const t=new URLSearchParams(window.location.search);let e=!1;try{e=!!window.opener&&window.opener.location.origin===window.location.origin}catch{e=!1}const r=sessionStorage.getItem(Ud)==="true",n=t.has("code")||t.has("error")||t.has("state");!e||r||(sessionStorage.setItem(Ud,"true"),n||(G("Reloading page to get query params in incognito browser"),window.location.reload()))}async function FS(t){const e=a=>i=>{i.preventDefault();try{a()}catch(o){console.error("Error handling click:",o)}},r=(a,i)=>{try{document.querySelectorAll(a).forEach(s=>{s.addEventListener("click",e(i))})}catch(o){console.error(`Error attaching event handlers (selector: ${a}):`,o)}};r('[sesamy-link="login"]',()=>t.auth.loginWithRedirect()),r('[sesamy-link="logout"]',()=>t.auth.logout());const n=await t.generateLink({target:"account"});n&&r('[sesamy-link="account"]',()=>{window.location.href=n})}async function KS(t){const e=await t.auth.isAuthenticated();try{document.querySelectorAll(`[sesamy-visibility="${e?"not-logged-in":"logged-in"}"]`).forEach(a=>{a instanceof HTMLElement&&(a.style.display="none")}),document.querySelectorAll(`[sesamy-visibility="${e?"logged-in":"not-logged-in"}"]`).forEach(a=>{a instanceof HTMLElement&&(a.style.display="")})}catch(r){console.error("Error handling visibility:",r)}}async function zS(t){const e=ge("sesamy:locked-content-redirect-url");if(!e)return;const[r]=t.content.list();if(!r)return;await t.entitlements.hasAccess(r.url||"",r.pass?.split(",")||[])||(location.href=e)}exports.isInitialized=!1;async function $h(t,e){G(`Init with config: ${JSON.stringify(t)}`);try{MS(),iS({clientId:t.clientId,environment:t.environment,...t.analytics}),await Ey({clientId:t.clientId,organization:t.organization,environment:t.environment,...t.auth}),Iw(t,e),t.transform&&await kS(t.transform),Hp(),xS(),mS({clientId:t.clientId||t.vendorId,environment:t.environment,getProfile:()=>e.profile.get(),getEntitlements:()=>e.entitlements.list(),getContracts:()=>e.contracts.list(),getTags:()=>e.tags.list(),getTallies:()=>e.tallies.list()}),DS(e),_S(),TS(),$S(),await NS(),await US(),LS(),await KS(e),await FS(e),await zS(e),exports.isInitialized=!0,Zt(Ge.READY,{})}catch(r){G(`Failed to init ${r.message}`)}}async function Qv(t){G("Initializing Sesamy");const e=t.api?.namespace||"sesamy";if(Yt()&&e in window)return G("Sesamy already initialized. This is likely due to a duplicate import"),exports.isInitialized=!0,window[e];const r=yS({clientId:t.clientId,vendorId:t.vendorId,environment:t.environment,...t.api});return Yt()?(t.awaitAllServices?await $h(t,r):$h(t,r),r):(exports.isInitialized=!0,r)}if(Yt()){const t=document.getElementById("sesamy-js");if(t?.textContent)try{const e=JSON.parse(t.textContent);Qv(e)}catch(e){console.error("Failed to parse config",e)}}exports.Events=Ge;exports.clearMetadataCache=_w;exports.getAllLdJson=Ew;exports.getAllMetaTags=Br;exports.getContentConfig=Sw;exports.getContentMetadata=pv;exports.getLdJson=Wr;exports.init=Qv;
156
+ `,document.head.appendChild(i)}async function NS(t){try{const e=await fetch(t);return e.ok?await e.text():(console.error(`Failed to fetch content from ${t}: ${e.statusText}`),null)}catch(e){return console.error(`Error fetching content from ${t}:`,e),null}}async function Ac(t){if(t.contentType==="selector"&&t.content){const e=document.querySelector(t.content);if(e)return e.innerHTML;console.warn(`Source element for selector '${t.content}' not found`)}else if(t.contentType==="url"&&t.content){const e=await NS(t.content);if(e)return e;console.warn(`Failed to fetch content from URL '${t.content}'`)}else if(t.content)return t.content;return""}async function jS(t,e){const r=e.insertionPoint||"inside",n=await Ac(e);switch(r){case"before":t.insertAdjacentHTML("beforebegin",n);break;case"after":t.insertAdjacentHTML("afterend",n);break;case"inside":default:t.innerHTML+=n;break}}async function DS(t,e){const r=await Ac(e);t.innerHTML=r}async function MS(t,e){const r=await Ac(e);t.innerHTML=r.replace("${content}",t.innerHTML)}async function FS({enabled:t=!1,rules:e}){t&&rm(async()=>{const r=await Ot(),n=window.location.href;for(const a of e){const i=document.querySelectorAll(a.selector);if(!(a.path&&!new RegExp(a.path).test(n)))for(const o of i){const s=o;if(!(a.authenticated!==void 0&&a.authenticated!==r))switch(a.transform){case"insert":await jS(s,a);break;case"replace":await DS(s,a);break;case"remove":o.remove();break;case"wrap":await MS(s,a);break;case"gradient":qS(s,a);break;default:console.warn(`Unknown transform type: ${a.transform}`)}}}})}const xh="access_token";function BS(){const t=new URLSearchParams(window.location.hash.substring(1)),e=t.get(xh);if(e){Os(e);const r=new URL(window.location.href);t.delete(xh),r.hash=t.toString(),window.history.replaceState(null,"",r)}}const qh="sesamy-refresh",Nh="force-refetch-entitlements";function KS(){const t=new URLSearchParams(window.location.search),e=t.get(Nh),r=t.get(qh);if(e!==null||r!==null){const n=new URL(window.location.href);t.delete(Nh),t.delete(qh),n.search=t.toString(),mt(),window.history.replaceState(null,"",n)}}const Bs=(t,e)=>e.some(r=>t instanceof r);let jh,Dh;function zS(){return jh||(jh=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function HS(){return Dh||(Dh=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Ks=new WeakMap,Ss=new WeakMap,ha=new WeakMap;function WS(t){const e=new Promise((r,n)=>{const a=()=>{t.removeEventListener("success",i),t.removeEventListener("error",o)},i=()=>{r(Kn(t.result)),a()},o=()=>{n(t.error),a()};t.addEventListener("success",i),t.addEventListener("error",o)});return ha.set(e,t),e}function GS(t){if(Ks.has(t))return;const e=new Promise((r,n)=>{const a=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",o),t.removeEventListener("abort",o)},i=()=>{r(),a()},o=()=>{n(t.error||new DOMException("AbortError","AbortError")),a()};t.addEventListener("complete",i),t.addEventListener("error",o),t.addEventListener("abort",o)});Ks.set(t,e)}let zs={get(t,e,r){if(t instanceof IDBTransaction){if(e==="done")return Ks.get(t);if(e==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return Kn(t[e])},set(t,e,r){return t[e]=r,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function pm(t){zs=t(zs)}function VS(t){return HS().includes(t)?function(...e){return t.apply(Hs(this),e),Kn(this.request)}:function(...e){return Kn(t.apply(Hs(this),e))}}function JS(t){return typeof t=="function"?VS(t):(t instanceof IDBTransaction&&GS(t),Bs(t,zS())?new Proxy(t,zs):t)}function Kn(t){if(t instanceof IDBRequest)return WS(t);if(Ss.has(t))return Ss.get(t);const e=JS(t);return e!==t&&(Ss.set(t,e),ha.set(e,t)),e}const Hs=t=>ha.get(t),ZS=["get","getKey","getAll","getAllKeys","count"],YS=["put","add","delete","clear"],Is=new Map;function Mh(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Is.get(e))return Is.get(e);const r=e.replace(/FromIndex$/,""),n=e!==r,a=YS.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(a||ZS.includes(r)))return;const i=async function(o,...s){const u=this.transaction(o,a?"readwrite":"readonly");let l=u.store;return n&&(l=l.index(s.shift())),(await Promise.all([l[r](...s),a&&u.done]))[0]};return Is.set(e,i),i}pm(t=>({...t,get:(e,r,n)=>Mh(e,r)||t.get(e,r,n),has:(e,r)=>!!Mh(e,r)||t.has(e,r)}));const XS=["continue","continuePrimaryKey","advance"],Fh={},Ws=new WeakMap,vm=new WeakMap,QS={get(t,e){if(!XS.includes(e))return t[e];let r=Fh[e];return r||(r=Fh[e]=function(...n){Ws.set(this,vm.get(this)[e](...n))}),r}};async function*eI(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const r=new Proxy(e,QS);for(vm.set(r,e),ha.set(r,Hs(e));e;)yield r,e=await(Ws.get(r)||e.continue()),Ws.delete(r)}function Bh(t,e){return e===Symbol.asyncIterator&&Bs(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&Bs(t,[IDBIndex,IDBObjectStore])}pm(t=>({...t,get(e,r,n){return Bh(e,r)?eI:t.get(e,r,n)},has(e,r){return Bh(e,r)||t.has(e,r)}}));function tI(t){try{const e=t.lastIndexOf(".");if(e===-1)return{valid:!1,error:"invalid_format",message:"Token must contain payload and signature separated by '.'"};const r=t.substring(0,e),n=atob(rI(r)),a=JSON.parse(n);if(typeof a.v!="number"||typeof a.iss!="string"||typeof a.kid!="string"||typeof a.tier!="string"||typeof a.contentId!="string"||typeof a.exp!="number")return{valid:!1,error:"malformed",message:"Token missing required fields"};const i=Math.floor(Date.now()/1e3),o=a.exp-i;return{valid:!0,expired:o<0,expiresIn:o,payload:a}}catch{return{valid:!1,error:"malformed",message:"Failed to decode token"}}}function rI(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r&&(e+="=".repeat(4-r)),e}function nI(t){if(!t||typeof t!="string")throw new Error("Invalid token: token must be a non-empty string");const e=t.split(".");if(e.length!==3&&e.length!==2)throw new Error("Invalid JWT format: token must have 2 or 3 parts separated by dots");const r=e.length===3?e[1]:e[0];if(!r)throw new Error("Invalid JWT format: payload is empty");let n;try{n=atob(r)}catch{throw new Error("Invalid JWT format: payload is not valid base64")}try{return JSON.parse(n)}catch{throw new Error("Invalid JWT format: payload is not valid JSON")}}function aI(t,e){const r=new Date(t.exp*1e3);return{id:"",title:t.p?.toString(),sku:t.s?.toString(),purchaseOption:t.p?.toString(),publisherContentId:t.pid?.toString(),url:t.url?.toString(),token:e,type:"article",hasAccess:!0,expiresAt:r.toISOString(),createdAt:new Date(t.iat*1e3).toISOString(),updatedAt:new Date(t.iat*1e3).toISOString()}}function iI(t,e){const r=new Date(t.exp*1e3),n=t.meta;return{id:t.tid,title:n?.purchaseOption?.toString()||t.tier,sku:t.tier,purchaseOption:n?.purchaseOption?.toString(),publisherContentId:t.contentId,url:t.url,token:e,type:"article",hasAccess:!0,expiresAt:r.toISOString(),createdAt:new Date(t.iat*1e3).toISOString(),updatedAt:new Date(t.iat*1e3).toISOString()}}function oI(){const t=new URLSearchParams(window.location.search),e=t.get("sesamy_token")||t.get("sesamy-token")||t.get("token");if(!e)return;try{const n=tI(e);if(n.valid&&!n.expired){const a=iI(n.payload,e);Qd(a)}else if(n.valid)n.expired&&H("Share token has expired");else{const a=nI(e),i=aI(a,e);Qd(i)}}catch(n){H(`Failed to extract signed link ${n}`)}const r=new URL(window.location.href);r.searchParams.delete("ss"),r.searchParams.delete("se"),r.searchParams.delete("sp"),r.searchParams.delete("so"),r.searchParams.delete("token"),r.searchParams.delete("sesamy-token"),r.searchParams.delete("sesamy_token"),window.history.replaceState(null,"",r)}const Kh="sesamy-user";async function sI(){const e=new URLSearchParams(window.location.search).get(Kh)?.toLowerCase();if(!e)return;const r=await By();r?.email!==e?(H(`Current user does not match sesamy user: ${r?.email} !== ${e}`),mt(),oa({authorizationParams:{login_hint:e}})):H(`Current user matches sesamy user: ${r?.email} === ${e}`);const n=new URL(window.location.href);n.searchParams.delete(Kh),window.history.replaceState(null,"",n)}const zh="sesamy-purchase";function cI(){const t=new URLSearchParams(window.location.search),e=t.get(zh);if(e!==null){const r=new URL(window.location.href);t.delete(zh),r.search=t.toString(),H(`Purchase ${e}`),Zt(We.PURCHASE,{itemSrc:e}),mt(),window.history.replaceState(null,"",r)}}const Hh="sesamy-login",uI="sesamy_login";async function lI(){const t=new URLSearchParams(window.location.search);if(!(t.get(Hh)||t.get(uI)))return;await Ot()||oa();const n=new URL(window.location.href);n.searchParams.delete(Hh),window.history.replaceState(null,"",n)}const Wh="sesamy-debug";async function fI(){const e=new URLSearchParams(window.location.search).get(Wh)?.toLowerCase();if(!e)return;xg(e==="true");const r=new URL(window.location.href);r.searchParams.delete(Wh),window.history.replaceState(null,"",r)}function dI(){if(!document.referrer.length)return;const t=new URL(document.referrer);if(!(t.hostname===window.location.hostname||t.hostname.includes("sesamy")))return document.referrer}async function hI(t){if(!Yt())return;const e=new URLSearchParams(window.location.search),r={utmSource:e.get("utm_source")??void 0,utmMedium:e.get("utm_medium")??void 0,utmCampaign:e.get("utm_campaign")??void 0,utmTerm:e.get("utm_term")??void 0,utmContent:e.get("utm_content")??void 0,ref:e.get("ref")??void 0,referrer:dI()},[n]=t.content.list();n?.url&&(r.itemSrc=n.url,r.publisherContentId=n.id),gv(r)}function pI(){const t=new URLSearchParams(window.location.search);let e=!1;try{e=!!window.opener&&window.opener.location.origin===window.location.origin}catch{e=!1}const r=sessionStorage.getItem(Bd)==="true",n=t.has("code")||t.has("error")||t.has("state");!e||r||(sessionStorage.setItem(Bd,"true"),n||(H("Reloading page to get query params in incognito browser"),window.location.reload()))}async function vI(t){const e=a=>i=>{i.preventDefault();try{a()}catch(o){console.error("Error handling click:",o)}},r=(a,i)=>{try{document.querySelectorAll(a).forEach(s=>{s.addEventListener("click",e(i))})}catch(o){console.error(`Error attaching event handlers (selector: ${a}):`,o)}};r('[sesamy-link="login"]',()=>t.auth.loginWithRedirect()),r('[sesamy-link="logout"]',()=>t.auth.logout());const n=await t.generateLink({target:"account"});n&&r('[sesamy-link="account"]',()=>{window.location.href=n})}async function mI(t){const e=await t.auth.isAuthenticated();try{document.querySelectorAll(`[sesamy-visibility="${e?"not-logged-in":"logged-in"}"]`).forEach(a=>{a instanceof HTMLElement&&(a.style.display="none")}),document.querySelectorAll(`[sesamy-visibility="${e?"logged-in":"not-logged-in"}"]`).forEach(a=>{a instanceof HTMLElement&&(a.style.display="")})}catch(r){console.error("Error handling visibility:",r)}}async function gI(t){const e=ge("sesamy:locked-content-redirect-url");if(!e)return;const[r]=t.content.list();if(!r)return;await t.entitlements.hasAccess(r.url||"",r.pass?.split(",")||[])||(location.href=e)}exports.isInitialized=!1;async function Gh(t,e){H(`Init with config: ${JSON.stringify(t)}`);try{pI(),SS({clientId:t.clientId,environment:t.environment,...t.analytics}),await Fy({clientId:t.clientId,organization:t.organization,environment:t.environment,...t.auth}),jw(t,e),t.transform&&await FS(t.transform),iv(),fI(),$S({clientId:t.clientId||t.vendorId,environment:t.environment,getProfile:()=>e.profile.get(),getEntitlements:()=>e.entitlements.list(),getContracts:()=>e.contracts.list(),getTags:()=>e.tags.list(),getTallies:()=>e.tallies.list()}),hI(e),BS(),KS(),oI(),await lI(),await sI(),cI(),await mI(e),await vI(e),await gI(e),exports.isInitialized=!0,Zt(We.READY,{})}catch(r){H(`Failed to init ${r.message}`)}}async function mm(t){H("Initializing Sesamy");const e=t.api?.namespace||"sesamy";if(Yt()&&e in window)return H("Sesamy already initialized. This is likely due to a duplicate import"),exports.isInitialized=!0,window[e];const r=US({clientId:t.clientId,vendorId:t.vendorId,environment:t.environment,...t.api});return Yt()?(t.awaitAllServices?await Gh(t,r):Gh(t,r),r):(exports.isInitialized=!0,r)}if(Yt()){const t=document.getElementById("sesamy-js");if(t?.textContent)try{const e=JSON.parse(t.textContent);mm(e)}catch(e){console.error("Failed to parse config",e)}}exports.Events=We;exports.clearMetadataCache=Bw;exports.getAllLdJson=Mw;exports.getAllMetaTags=Hr;exports.getContentConfig=Nw;exports.getContentMetadata=Ov;exports.getLdJson=Gr;exports.init=mm;