@vkontakte/videoplayer-statistics 1.0.97-dev.51af1f96.0 → 1.0.97-dev.96546ef5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es2018.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-statistics v1.0.97-dev.51af1f96.0
3
- * Mon, 02 Feb 2026 13:12:02 GMT
2
+ * @vkontakte/videoplayer-statistics v1.0.97-dev.96546ef5.0
3
+ * Mon, 02 Feb 2026 13:53:07 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-97/doc/
5
5
  */
6
- "use strict";var tf=Object.create;var mt=Object.defineProperty;var rf=Object.getOwnPropertyDescriptor;var of=Object.getOwnPropertyNames;var nf=Object.getPrototypeOf,af=Object.prototype.hasOwnProperty;var u=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Fo=(t,e)=>{for(var r in e)mt(t,r,{get:e[r],enumerable:!0})},Bo=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of of(e))!af.call(t,o)&&o!==r&&mt(t,o,{get:()=>e[o],enumerable:!(i=rf(e,o))||i.enumerable});return t};var C=(t,e,r)=>(r=t!=null?tf(nf(t)):{},Bo(e||!t||!t.__esModule?mt(r,"default",{value:t,enumerable:!0}):r,t)),sf=t=>Bo(mt({},"__esModule",{value:!0}),t);var x=u((Ar,Uo)=>{"use strict";var He=function(t){return t&&t.Math===Math&&t};Uo.exports=He(typeof globalThis=="object"&&globalThis)||He(typeof window=="object"&&window)||He(typeof self=="object"&&self)||He(typeof global=="object"&&global)||He(typeof Ar=="object"&&Ar)||function(){return this}()||Function("return this")()});var R=u((bI,jo)=>{"use strict";jo.exports=function(t){try{return!!t()}catch(e){return!0}}});var We=u((yI,Ho)=>{"use strict";var uf=R();Ho.exports=!uf(function(){var t=function(){}.bind();return typeof t!="function"||t.hasOwnProperty("prototype")})});var Or=u((II,Go)=>{"use strict";var cf=We(),Qo=Function.prototype,Wo=Qo.apply,Ko=Qo.call;Go.exports=typeof Reflect=="object"&&Reflect.apply||(cf?Ko.bind(Wo):function(){return Ko.apply(Wo,arguments)})});var k=u((_I,Jo)=>{"use strict";var zo=We(),Yo=Function.prototype,Cr=Yo.call,lf=zo&&Yo.bind.bind(Cr,Cr);Jo.exports=zo?lf:function(t){return function(){return Cr.apply(t,arguments)}}});var Ke=u((SI,Zo)=>{"use strict";var Xo=k(),df=Xo({}.toString),ff=Xo("".slice);Zo.exports=function(t){return ff(df(t),8,-1)}});var qr=u((PI,en)=>{"use strict";var pf=Ke(),hf=k();en.exports=function(t){if(pf(t)==="Function")return hf(t)}});var A=u((TI,tn)=>{"use strict";var Rr=typeof document=="object"&&document.all;tn.exports=typeof Rr=="undefined"&&Rr!==void 0?function(t){return typeof t=="function"||t===Rr}:function(t){return typeof t=="function"}});var $=u((EI,rn)=>{"use strict";var vf=R();rn.exports=!vf(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var H=u((wI,on)=>{"use strict";var gf=We(),bt=Function.prototype.call;on.exports=gf?bt.bind(bt):function(){return bt.apply(bt,arguments)}});var kr=u(sn=>{"use strict";var nn={}.propertyIsEnumerable,an=Object.getOwnPropertyDescriptor,mf=an&&!nn.call({1:2},1);sn.f=mf?function(e){var r=an(this,e);return!!r&&r.enumerable}:nn});var Qe=u((AI,un)=>{"use strict";un.exports=function(t,e){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:e}}});var ln=u((OI,cn)=>{"use strict";var bf=k(),yf=R(),If=Ke(),Lr=Object,_f=bf("".split);cn.exports=yf(function(){return!Lr("z").propertyIsEnumerable(0)})?function(t){return If(t)==="String"?_f(t,""):Lr(t)}:Lr});var Ge=u((CI,dn)=>{"use strict";dn.exports=function(t){return t==null}});var Ee=u((qI,fn)=>{"use strict";var Sf=Ge(),Pf=TypeError;fn.exports=function(t){if(Sf(t))throw new Pf("Can't call method on "+t);return t}});var fe=u((RI,pn)=>{"use strict";var Tf=ln(),Ef=Ee();pn.exports=function(t){return Tf(Ef(t))}});var W=u((kI,hn)=>{"use strict";var wf=A();hn.exports=function(t){return typeof t=="object"?t!==null:wf(t)}});var pe=u((LI,vn)=>{"use strict";vn.exports={}});var te=u((NI,mn)=>{"use strict";var Nr=pe(),$r=x(),xf=A(),gn=function(t){return xf(t)?t:void 0};mn.exports=function(t,e){return arguments.length<2?gn(Nr[t])||gn($r[t]):Nr[t]&&Nr[t][e]||$r[t]&&$r[t][e]}});var yt=u(($I,bn)=>{"use strict";var Af=k();bn.exports=Af({}.isPrototypeOf)});var he=u((DI,_n)=>{"use strict";var Of=x(),yn=Of.navigator,In=yn&&yn.userAgent;_n.exports=In?String(In):""});var Mr=u((MI,xn)=>{"use strict";var wn=x(),Dr=he(),Sn=wn.process,Pn=wn.Deno,Tn=Sn&&Sn.versions||Pn&&Pn.version,En=Tn&&Tn.v8,K,It;En&&(K=En.split("."),It=K[0]>0&&K[0]<4?1:+(K[0]+K[1]));!It&&Dr&&(K=Dr.match(/Edge\/(\d+)/),(!K||K[1]>=74)&&(K=Dr.match(/Chrome\/(\d+)/),K&&(It=+K[1])));xn.exports=It});var Vr=u((VI,On)=>{"use strict";var An=Mr(),Cf=R(),qf=x(),Rf=qf.String;On.exports=!!Object.getOwnPropertySymbols&&!Cf(function(){var t=Symbol("symbol detection");return!Rf(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&An&&An<41})});var Fr=u((FI,Cn)=>{"use strict";var kf=Vr();Cn.exports=kf&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Br=u((BI,qn)=>{"use strict";var Lf=te(),Nf=A(),$f=yt(),Df=Fr(),Mf=Object;qn.exports=Df?function(t){return typeof t=="symbol"}:function(t){var e=Lf("Symbol");return Nf(e)&&$f(e.prototype,Mf(t))}});var ze=u((UI,Rn)=>{"use strict";var Vf=String;Rn.exports=function(t){try{return Vf(t)}catch(e){return"Object"}}});var re=u((jI,kn)=>{"use strict";var Ff=A(),Bf=ze(),Uf=TypeError;kn.exports=function(t){if(Ff(t))return t;throw new Uf(Bf(t)+" is not a function")}});var _t=u((HI,Ln)=>{"use strict";var jf=re(),Hf=Ge();Ln.exports=function(t,e){var r=t[e];return Hf(r)?void 0:jf(r)}});var $n=u((WI,Nn)=>{"use strict";var Ur=H(),jr=A(),Hr=W(),Wf=TypeError;Nn.exports=function(t,e){var r,i;if(e==="string"&&jr(r=t.toString)&&!Hr(i=Ur(r,t))||jr(r=t.valueOf)&&!Hr(i=Ur(r,t))||e!=="string"&&jr(r=t.toString)&&!Hr(i=Ur(r,t)))return i;throw new Wf("Can't convert object to primitive value")}});var Z=u((KI,Dn)=>{"use strict";Dn.exports=!0});var Fn=u((QI,Vn)=>{"use strict";var Mn=x(),Kf=Object.defineProperty;Vn.exports=function(t,e){try{Kf(Mn,t,{value:e,configurable:!0,writable:!0})}catch(r){Mn[t]=e}return e}});var Ye=u((GI,jn)=>{"use strict";var Qf=Z(),Gf=x(),zf=Fn(),Bn="__core-js_shared__",Un=jn.exports=Gf[Bn]||zf(Bn,{});(Un.versions||(Un.versions=[])).push({version:"3.43.0",mode:Qf?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.43.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var Wr=u((zI,Wn)=>{"use strict";var Hn=Ye();Wn.exports=function(t,e){return Hn[t]||(Hn[t]=e||{})}});var Kr=u((YI,Kn)=>{"use strict";var Yf=Ee(),Jf=Object;Kn.exports=function(t){return Jf(Yf(t))}});var ee=u((JI,Qn)=>{"use strict";var Xf=k(),Zf=Kr(),ep=Xf({}.hasOwnProperty);Qn.exports=Object.hasOwn||function(e,r){return ep(Zf(e),r)}});var Qr=u((XI,Gn)=>{"use strict";var tp=k(),rp=0,ip=Math.random(),op=tp(1.1.toString);Gn.exports=function(t){return"Symbol("+(t===void 0?"":t)+")_"+op(++rp+ip,36)}});var D=u((ZI,Yn)=>{"use strict";var np=x(),ap=Wr(),zn=ee(),sp=Qr(),up=Vr(),cp=Fr(),we=np.Symbol,Gr=ap("wks"),lp=cp?we.for||we:we&&we.withoutSetter||sp;Yn.exports=function(t){return zn(Gr,t)||(Gr[t]=up&&zn(we,t)?we[t]:lp("Symbol."+t)),Gr[t]}});var ea=u((e_,Zn)=>{"use strict";var dp=H(),Jn=W(),Xn=Br(),fp=_t(),pp=$n(),hp=D(),vp=TypeError,gp=hp("toPrimitive");Zn.exports=function(t,e){if(!Jn(t)||Xn(t))return t;var r=fp(t,gp),i;if(r){if(e===void 0&&(e="default"),i=dp(r,t,e),!Jn(i)||Xn(i))return i;throw new vp("Can't convert object to primitive value")}return e===void 0&&(e="number"),pp(t,e)}});var zr=u((t_,ta)=>{"use strict";var mp=ea(),bp=Br();ta.exports=function(t){var e=mp(t,"string");return bp(e)?e:e+""}});var St=u((r_,ia)=>{"use strict";var yp=x(),ra=W(),Yr=yp.document,Ip=ra(Yr)&&ra(Yr.createElement);ia.exports=function(t){return Ip?Yr.createElement(t):{}}});var Jr=u((i_,oa)=>{"use strict";var _p=$(),Sp=R(),Pp=St();oa.exports=!_p&&!Sp(function(){return Object.defineProperty(Pp("div"),"a",{get:function(){return 7}}).a!==7})});var sa=u(aa=>{"use strict";var Tp=$(),Ep=H(),wp=kr(),xp=Qe(),Ap=fe(),Op=zr(),Cp=ee(),qp=Jr(),na=Object.getOwnPropertyDescriptor;aa.f=Tp?na:function(e,r){if(e=Ap(e),r=Op(r),qp)try{return na(e,r)}catch(i){}if(Cp(e,r))return xp(!Ep(wp.f,e,r),e[r])}});var Xr=u((n_,ua)=>{"use strict";var Rp=R(),kp=A(),Lp=/#|\.prototype\./,Je=function(t,e){var r=$p[Np(t)];return r===Mp?!0:r===Dp?!1:kp(e)?Rp(e):!!e},Np=Je.normalize=function(t){return String(t).replace(Lp,".").toLowerCase()},$p=Je.data={},Dp=Je.NATIVE="N",Mp=Je.POLYFILL="P";ua.exports=Je});var Xe=u((a_,la)=>{"use strict";var ca=qr(),Vp=re(),Fp=We(),Bp=ca(ca.bind);la.exports=function(t,e){return Vp(t),e===void 0?t:Fp?Bp(t,e):function(){return t.apply(e,arguments)}}});var Zr=u((s_,da)=>{"use strict";var Up=$(),jp=R();da.exports=Up&&jp(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var ie=u((u_,fa)=>{"use strict";var Hp=W(),Wp=String,Kp=TypeError;fa.exports=function(t){if(Hp(t))return t;throw new Kp(Wp(t)+" is not an object")}});var ve=u(ha=>{"use strict";var Qp=$(),Gp=Jr(),zp=Zr(),Pt=ie(),pa=zr(),Yp=TypeError,ei=Object.defineProperty,Jp=Object.getOwnPropertyDescriptor,ti="enumerable",ri="configurable",ii="writable";ha.f=Qp?zp?function(e,r,i){if(Pt(e),r=pa(r),Pt(i),typeof e=="function"&&r==="prototype"&&"value"in i&&ii in i&&!i[ii]){var o=Jp(e,r);o&&o[ii]&&(e[r]=i.value,i={configurable:ri in i?i[ri]:o[ri],enumerable:ti in i?i[ti]:o[ti],writable:!1})}return ei(e,r,i)}:ei:function(e,r,i){if(Pt(e),r=pa(r),Pt(i),Gp)try{return ei(e,r,i)}catch(o){}if("get"in i||"set"in i)throw new Yp("Accessors not supported");return"value"in i&&(e[r]=i.value),e}});var xe=u((l_,va)=>{"use strict";var Xp=$(),Zp=ve(),eh=Qe();va.exports=Xp?function(t,e,r){return Zp.f(t,e,eh(1,r))}:function(t,e,r){return t[e]=r,t}});var L=u((d_,ma)=>{"use strict";var Ze=x(),th=Or(),rh=qr(),ih=A(),oh=sa().f,nh=Xr(),Ae=pe(),ah=Xe(),Oe=xe(),ga=ee();Ye();var sh=function(t){var e=function(r,i,o){if(this instanceof e){switch(arguments.length){case 0:return new t;case 1:return new t(r);case 2:return new t(r,i)}return new t(r,i,o)}return th(t,this,arguments)};return e.prototype=t.prototype,e};ma.exports=function(t,e){var r=t.target,i=t.global,o=t.stat,n=t.proto,c=i?Ze:o?Ze[r]:Ze[r]&&Ze[r].prototype,l=i?Ae:Ae[r]||Oe(Ae,r,{})[r],f=l.prototype,p,h,a,s,d,v,g,y,S;for(s in e)p=nh(i?s:r+(o?".":"#")+s,t.forced),h=!p&&c&&ga(c,s),v=l[s],h&&(t.dontCallGetSet?(S=oh(c,s),g=S&&S.value):g=c[s]),d=h&&g?g:e[s],!(!p&&!n&&typeof v==typeof d)&&(t.bind&&h?y=ah(d,Ze):t.wrap&&h?y=sh(d):n&&ih(d)?y=rh(d):y=d,(t.sham||d&&d.sham||v&&v.sham)&&Oe(y,"sham",!0),Oe(l,s,y),n&&(a=r+"Prototype",ga(Ae,a)||Oe(Ae,a,{}),Oe(Ae[a],s,d),t.real&&f&&(p||!f[s])&&Oe(f,s,d)))}});var ya=u((f_,ba)=>{"use strict";var uh=Math.ceil,ch=Math.floor;ba.exports=Math.trunc||function(e){var r=+e;return(r>0?ch:uh)(r)}});var Tt=u((p_,Ia)=>{"use strict";var lh=ya();Ia.exports=function(t){var e=+t;return e!==e||e===0?0:lh(e)}});var Sa=u((h_,_a)=>{"use strict";var dh=Tt(),fh=Math.max,ph=Math.min;_a.exports=function(t,e){var r=dh(t);return r<0?fh(r+e,0):ph(r,e)}});var oi=u((v_,Pa)=>{"use strict";var hh=Tt(),vh=Math.min;Pa.exports=function(t){var e=hh(t);return e>0?vh(e,9007199254740991):0}});var ni=u((g_,Ta)=>{"use strict";var gh=oi();Ta.exports=function(t){return gh(t.length)}});var ai=u((m_,wa)=>{"use strict";var mh=fe(),bh=Sa(),yh=ni(),Ea=function(t){return function(e,r,i){var o=mh(e),n=yh(o);if(n===0)return!t&&-1;var c=bh(i,n),l;if(t&&r!==r){for(;n>c;)if(l=o[c++],l!==l)return!0}else for(;n>c;c++)if((t||c in o)&&o[c]===r)return t||c||0;return!t&&-1}};wa.exports={includes:Ea(!0),indexOf:Ea(!1)}});var si=u((b_,xa)=>{"use strict";xa.exports=function(){}});var Aa=u(()=>{"use strict";var Ih=L(),_h=ai().includes,Sh=R(),Ph=si(),Th=Sh(function(){return!Array(1).includes()});Ih({target:"Array",proto:!0,forced:Th},{includes:function(e){return _h(this,e,arguments.length>1?arguments[1]:void 0)}});Ph("includes")});var Et=u((__,Oa)=>{"use strict";var Eh=te();Oa.exports=Eh});var qa=u((S_,Ca)=>{"use strict";Aa();var wh=Et();Ca.exports=wh("Array","includes")});var ka=u((P_,Ra)=>{"use strict";var xh=qa();Ra.exports=xh});var ge=u((T_,La)=>{"use strict";var Ah=ka();La.exports=Ah});var Ct=u((N_,Ha)=>{"use strict";var qh=D(),Rh=qh("toStringTag"),ja={};ja[Rh]="z";Ha.exports=String(ja)==="[object z]"});var et=u(($_,Wa)=>{"use strict";var kh=Ct(),Lh=A(),qt=Ke(),Nh=D(),$h=Nh("toStringTag"),Dh=Object,Mh=qt(function(){return arguments}())==="Arguments",Vh=function(t,e){try{return t[e]}catch(r){}};Wa.exports=kh?qt:function(t){var e,r,i;return t===void 0?"Undefined":t===null?"Null":typeof(r=Vh(e=Dh(t),$h))=="string"?r:Mh?qt(e):(i=qt(e))==="Object"&&Lh(e.callee)?"Arguments":i}});var di=u((D_,Ka)=>{"use strict";var Fh=et(),Bh=String;Ka.exports=function(t){if(Fh(t)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return Bh(t)}});var Ga=u((M_,Qa)=>{"use strict";var Uh=Tt(),jh=di(),Hh=Ee(),Wh=RangeError;Qa.exports=function(e){var r=jh(Hh(this)),i="",o=Uh(e);if(o<0||o===1/0)throw new Wh("Wrong number of repetitions");for(;o>0;(o>>>=1)&&(r+=r))o&1&&(i+=r);return i}});var Za=u((V_,Xa)=>{"use strict";var Ja=k(),Kh=oi(),za=di(),Qh=Ga(),Gh=Ee(),zh=Ja(Qh),Yh=Ja("".slice),Jh=Math.ceil,Ya=function(t){return function(e,r,i){var o=za(Gh(e)),n=Kh(r),c=o.length,l=i===void 0?" ":za(i),f,p;return n<=c||l===""?o:(f=n-c,p=zh(l,Jh(f/l.length)),p.length>f&&(p=Yh(p,0,f)),t?o+p:p+o)}};Xa.exports={start:Ya(!1),end:Ya(!0)}});var ts=u((F_,es)=>{"use strict";var Xh=he();es.exports=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(Xh)});var rs=u(()=>{"use strict";var Zh=L(),ev=Za().start,tv=ts();Zh({target:"String",proto:!0,forced:tv},{padStart:function(e){return ev(this,e,arguments.length>1?arguments[1]:void 0)}})});var os=u((j_,is)=>{"use strict";rs();var rv=Et();is.exports=rv("String","padStart")});var as=u((H_,ns)=>{"use strict";var iv=os();ns.exports=iv});var Rt=u((W_,ss)=>{"use strict";var ov=as();ss.exports=ov});var cs=u(()=>{"use strict"});var fi=u((z_,ls)=>{"use strict";var tt=x(),av=he(),sv=Ke(),kt=function(t){return av.slice(0,t.length)===t};ls.exports=function(){return kt("Bun/")?"BUN":kt("Cloudflare-Workers")?"CLOUDFLARE":kt("Deno/")?"DENO":kt("Node.js/")?"NODE":tt.Bun&&typeof Bun.version=="string"?"BUN":tt.Deno&&typeof Deno.version=="object"?"DENO":sv(tt.process)==="process"?"NODE":tt.window&&tt.document?"BROWSER":"REST"}()});var Lt=u((Y_,ds)=>{"use strict";var uv=fi();ds.exports=uv==="NODE"});var qe=u((J_,fs)=>{"use strict";var cv=xe();fs.exports=function(t,e,r,i){return i&&i.enumerable?t[e]=r:cv(t,e,r),t}});var hs=u((X_,ps)=>{"use strict";var lv=k(),dv=re();ps.exports=function(t,e,r){try{return lv(dv(Object.getOwnPropertyDescriptor(t,e)[r]))}catch(i){}}});var gs=u((Z_,vs)=>{"use strict";var fv=W();vs.exports=function(t){return fv(t)||t===null}});var bs=u((eS,ms)=>{"use strict";var pv=gs(),hv=String,vv=TypeError;ms.exports=function(t){if(pv(t))return t;throw new vv("Can't set "+hv(t)+" as a prototype")}});var pi=u((tS,ys)=>{"use strict";var gv=hs(),mv=W(),bv=Ee(),yv=bs();ys.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t=!1,e={},r;try{r=gv(Object.prototype,"__proto__","set"),r(e,[]),t=e instanceof Array}catch(i){}return function(o,n){return bv(o),yv(n),mv(o)&&(t?r(o,n):o.__proto__=n),o}}():void 0)});var _s=u((rS,Is)=>{"use strict";var Iv=Ct(),_v=et();Is.exports=Iv?{}.toString:function(){return"[object "+_v(this)+"]"}});var rt=u((iS,Ps)=>{"use strict";var Sv=Ct(),Pv=ve().f,Tv=xe(),Ev=ee(),wv=_s(),xv=D(),Ss=xv("toStringTag");Ps.exports=function(t,e,r,i){var o=r?t:t&&t.prototype;o&&(Ev(o,Ss)||Pv(o,Ss,{configurable:!0,value:e}),i&&!Sv&&Tv(o,"toString",wv))}});var Es=u((oS,Ts)=>{"use strict";var Av=ve();Ts.exports=function(t,e,r){return Av.f(t,e,r)}});var As=u((nS,xs)=>{"use strict";var Ov=te(),Cv=Es(),qv=D(),Rv=$(),ws=qv("species");xs.exports=function(t){var e=Ov(t);Rv&&e&&!e[ws]&&Cv(e,ws,{configurable:!0,get:function(){return this}})}});var Cs=u((aS,Os)=>{"use strict";var kv=yt(),Lv=TypeError;Os.exports=function(t,e){if(kv(e,t))return t;throw new Lv("Incorrect invocation")}});var vi=u((sS,qs)=>{"use strict";var Nv=k(),$v=A(),hi=Ye(),Dv=Nv(Function.toString);$v(hi.inspectSource)||(hi.inspectSource=function(t){return Dv(t)});qs.exports=hi.inspectSource});var Ds=u((uS,$s)=>{"use strict";var Mv=k(),Vv=R(),Rs=A(),Fv=et(),Bv=te(),Uv=vi(),ks=function(){},Ls=Bv("Reflect","construct"),gi=/^\s*(?:class|function)\b/,jv=Mv(gi.exec),Hv=!gi.test(ks),it=function(e){if(!Rs(e))return!1;try{return Ls(ks,[],e),!0}catch(r){return!1}},Ns=function(e){if(!Rs(e))return!1;switch(Fv(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Hv||!!jv(gi,Uv(e))}catch(r){return!0}};Ns.sham=!0;$s.exports=!Ls||Vv(function(){var t;return it(it.call)||!it(Object)||!it(function(){t=!0})||t})?Ns:it});var Vs=u((cS,Ms)=>{"use strict";var Wv=Ds(),Kv=ze(),Qv=TypeError;Ms.exports=function(t){if(Wv(t))return t;throw new Qv(Kv(t)+" is not a constructor")}});var mi=u((lS,Bs)=>{"use strict";var Fs=ie(),Gv=Vs(),zv=Ge(),Yv=D(),Jv=Yv("species");Bs.exports=function(t,e){var r=Fs(t).constructor,i;return r===void 0||zv(i=Fs(r)[Jv])?e:Gv(i)}});var bi=u((dS,Us)=>{"use strict";var Xv=te();Us.exports=Xv("document","documentElement")});var Hs=u((fS,js)=>{"use strict";var Zv=k();js.exports=Zv([].slice)});var Ks=u((pS,Ws)=>{"use strict";var eg=TypeError;Ws.exports=function(t,e){if(t<e)throw new eg("Not enough arguments");return t}});var yi=u((hS,Qs)=>{"use strict";var tg=he();Qs.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(tg)});var Ai=u((vS,ru)=>{"use strict";var M=x(),rg=Or(),ig=Xe(),Gs=A(),og=ee(),tu=R(),zs=bi(),ng=Hs(),Ys=St(),ag=Ks(),sg=yi(),ug=Lt(),Ei=M.setImmediate,wi=M.clearImmediate,cg=M.process,Ii=M.Dispatch,lg=M.Function,Js=M.MessageChannel,dg=M.String,_i=0,ot={},Xs="onreadystatechange",nt,me,Si,Pi;tu(function(){nt=M.location});var xi=function(t){if(og(ot,t)){var e=ot[t];delete ot[t],e()}},Ti=function(t){return function(){xi(t)}},Zs=function(t){xi(t.data)},eu=function(t){M.postMessage(dg(t),nt.protocol+"//"+nt.host)};(!Ei||!wi)&&(Ei=function(e){ag(arguments.length,1);var r=Gs(e)?e:lg(e),i=ng(arguments,1);return ot[++_i]=function(){rg(r,void 0,i)},me(_i),_i},wi=function(e){delete ot[e]},ug?me=function(t){cg.nextTick(Ti(t))}:Ii&&Ii.now?me=function(t){Ii.now(Ti(t))}:Js&&!sg?(Si=new Js,Pi=Si.port2,Si.port1.onmessage=Zs,me=ig(Pi.postMessage,Pi)):M.addEventListener&&Gs(M.postMessage)&&!M.importScripts&&nt&&nt.protocol!=="file:"&&!tu(eu)?(me=eu,M.addEventListener("message",Zs,!1)):Xs in Ys("script")?me=function(t){zs.appendChild(Ys("script"))[Xs]=function(){zs.removeChild(this),xi(t)}}:me=function(t){setTimeout(Ti(t),0)});ru.exports={set:Ei,clear:wi}});var nu=u((gS,ou)=>{"use strict";var iu=x(),fg=$(),pg=Object.getOwnPropertyDescriptor;ou.exports=function(t){if(!fg)return iu[t];var e=pg(iu,t);return e&&e.value}});var Oi=u((mS,su)=>{"use strict";var au=function(){this.head=null,this.tail=null};au.prototype={add:function(t){var e={item:t,next:null},r=this.tail;r?r.next=e:this.head=e,this.tail=e},get:function(){var t=this.head;if(t){var e=this.head=t.next;return e===null&&(this.tail=null),t.item}}};su.exports=au});var cu=u((bS,uu)=>{"use strict";var hg=he();uu.exports=/ipad|iphone|ipod/i.test(hg)&&typeof Pebble!="undefined"});var du=u((yS,lu)=>{"use strict";var vg=he();lu.exports=/web0s(?!.*chrome)/i.test(vg)});var bu=u((IS,mu)=>{"use strict";var ke=x(),gg=nu(),fu=Xe(),Ci=Ai().set,mg=Oi(),bg=yi(),yg=cu(),Ig=du(),qi=Lt(),pu=ke.MutationObserver||ke.WebKitMutationObserver,hu=ke.document,vu=ke.process,Nt=ke.Promise,Li=gg("queueMicrotask"),Re,Ri,ki,$t,gu;Li||(at=new mg,st=function(){var t,e;for(qi&&(t=vu.domain)&&t.exit();e=at.get();)try{e()}catch(r){throw at.head&&Re(),r}t&&t.enter()},!bg&&!qi&&!Ig&&pu&&hu?(Ri=!0,ki=hu.createTextNode(""),new pu(st).observe(ki,{characterData:!0}),Re=function(){ki.data=Ri=!Ri}):!yg&&Nt&&Nt.resolve?($t=Nt.resolve(void 0),$t.constructor=Nt,gu=fu($t.then,$t),Re=function(){gu(st)}):qi?Re=function(){vu.nextTick(st)}:(Ci=fu(Ci,ke),Re=function(){Ci(st)}),Li=function(t){at.head||Re(),at.add(t)});var at,st;mu.exports=Li});var Iu=u((_S,yu)=>{"use strict";yu.exports=function(t,e){try{arguments.length===1?console.error(t):console.error(t,e)}catch(r){}}});var Dt=u((SS,_u)=>{"use strict";_u.exports=function(t){try{return{error:!1,value:t()}}catch(e){return{error:!0,value:e}}}});var Tu=u((PS,Pu)=>{"use strict";var _g=x(),Sg=A(),Su=_g.WeakMap;Pu.exports=Sg(Su)&&/native code/.test(String(Su))});var Mt=u((TS,wu)=>{"use strict";var Pg=Wr(),Tg=Qr(),Eu=Pg("keys");wu.exports=function(t){return Eu[t]||(Eu[t]=Tg(t))}});var Vt=u((ES,xu)=>{"use strict";xu.exports={}});var Mi=u((wS,Cu)=>{"use strict";var Eg=Tu(),Ou=x(),wg=W(),xg=xe(),Ni=ee(),$i=Ye(),Ag=Mt(),Og=Vt(),Au="Object already initialized",Di=Ou.TypeError,Cg=Ou.WeakMap,Ft,ut,Bt,qg=function(t){return Bt(t)?ut(t):Ft(t,{})},Rg=function(t){return function(e){var r;if(!wg(e)||(r=ut(e)).type!==t)throw new Di("Incompatible receiver, "+t+" required");return r}};Eg||$i.state?(Q=$i.state||($i.state=new Cg),Q.get=Q.get,Q.has=Q.has,Q.set=Q.set,Ft=function(t,e){if(Q.has(t))throw new Di(Au);return e.facade=t,Q.set(t,e),e},ut=function(t){return Q.get(t)||{}},Bt=function(t){return Q.has(t)}):(be=Ag("state"),Og[be]=!0,Ft=function(t,e){if(Ni(t,be))throw new Di(Au);return e.facade=t,xg(t,be,e),e},ut=function(t){return Ni(t,be)?t[be]:{}},Bt=function(t){return Ni(t,be)});var Q,be;Cu.exports={set:Ft,get:ut,has:Bt,enforce:qg,getterFor:Rg}});var ye=u((xS,qu)=>{"use strict";var kg=x();qu.exports=kg.Promise});var Le=u((AS,Nu)=>{"use strict";var Lg=x(),ct=ye(),Ng=A(),$g=Xr(),Dg=vi(),Mg=D(),Ru=fi(),Vg=Z(),Vi=Mr(),ku=ct&&ct.prototype,Fg=Mg("species"),Fi=!1,Lu=Ng(Lg.PromiseRejectionEvent),Bg=$g("Promise",function(){var t=Dg(ct),e=t!==String(ct);if(!e&&Vi===66||Vg&&!(ku.catch&&ku.finally))return!0;if(!Vi||Vi<51||!/native code/.test(t)){var r=new ct(function(n){n(1)}),i=function(n){n(function(){},function(){})},o=r.constructor={};if(o[Fg]=i,Fi=r.then(function(){})instanceof i,!Fi)return!0}return!e&&(Ru==="BROWSER"||Ru==="DENO")&&!Lu});Nu.exports={CONSTRUCTOR:Bg,REJECTION_EVENT:Lu,SUBCLASSING:Fi}});var Ne=u((OS,Du)=>{"use strict";var $u=re(),Ug=TypeError,jg=function(t){var e,r;this.promise=new t(function(i,o){if(e!==void 0||r!==void 0)throw new Ug("Bad Promise constructor");e=i,r=o}),this.resolve=$u(e),this.reject=$u(r)};Du.exports.f=function(t){return new jg(t)}});var ic=u(()=>{"use strict";var Hg=L(),Wg=Z(),Wt=Lt(),le=x(),Kg=pe(),Ve=H(),Mu=qe(),Vu=pi(),Qg=rt(),Gg=As(),zg=re(),Ht=A(),Yg=W(),Jg=Cs(),Xg=mi(),Hu=Ai().set,Wi=bu(),Zg=Iu(),em=Dt(),tm=Oi(),Wu=Mi(),Kt=ye(),Ki=Le(),Ku=Ne(),Qt="Promise",Qu=Ki.CONSTRUCTOR,rm=Ki.REJECTION_EVENT,im=Ki.SUBCLASSING,Bi=Wu.getterFor(Qt),om=Wu.set,$e=Kt&&Kt.prototype,Ie=Kt,Ut=$e,Gu=le.TypeError,Ui=le.document,Qi=le.process,ji=Ku.f,nm=ji,am=!!(Ui&&Ui.createEvent&&le.dispatchEvent),zu="unhandledrejection",sm="rejectionhandled",Fu=0,Yu=1,um=2,Gi=1,Ju=2,jt,Bu,Xu,Uu,Zu=function(t){var e;return Yg(t)&&Ht(e=t.then)?e:!1},ec=function(t,e){var r=e.value,i=e.state===Yu,o=i?t.ok:t.fail,n=t.resolve,c=t.reject,l=t.domain,f,p,h;try{o?(i||(e.rejection===Ju&&lm(e),e.rejection=Gi),o===!0?f=r:(l&&l.enter(),f=o(r),l&&(l.exit(),h=!0)),f===t.promise?c(new Gu("Promise-chain cycle")):(p=Zu(f))?Ve(p,f,n,c):n(f)):c(r)}catch(a){l&&!h&&l.exit(),c(a)}},tc=function(t,e){t.notified||(t.notified=!0,Wi(function(){for(var r=t.reactions,i;i=r.get();)ec(i,t);t.notified=!1,e&&!t.rejection&&cm(t)}))},rc=function(t,e,r){var i,o;am?(i=Ui.createEvent("Event"),i.promise=e,i.reason=r,i.initEvent(t,!1,!0),le.dispatchEvent(i)):i={promise:e,reason:r},!rm&&(o=le["on"+t])?o(i):t===zu&&Zg("Unhandled promise rejection",r)},cm=function(t){Ve(Hu,le,function(){var e=t.facade,r=t.value,i=ju(t),o;if(i&&(o=em(function(){Wt?Qi.emit("unhandledRejection",r,e):rc(zu,e,r)}),t.rejection=Wt||ju(t)?Ju:Gi,o.error))throw o.value})},ju=function(t){return t.rejection!==Gi&&!t.parent},lm=function(t){Ve(Hu,le,function(){var e=t.facade;Wt?Qi.emit("rejectionHandled",e):rc(sm,e,t.value)})},De=function(t,e,r){return function(i){t(e,i,r)}},Me=function(t,e,r){t.done||(t.done=!0,r&&(t=r),t.value=e,t.state=um,tc(t,!0))},Hi=function(t,e,r){if(!t.done){t.done=!0,r&&(t=r);try{if(t.facade===e)throw new Gu("Promise can't be resolved itself");var i=Zu(e);i?Wi(function(){var o={done:!1};try{Ve(i,e,De(Hi,o,t),De(Me,o,t))}catch(n){Me(o,n,t)}}):(t.value=e,t.state=Yu,tc(t,!1))}catch(o){Me({done:!1},o,t)}}};if(Qu&&(Ie=function(e){Jg(this,Ut),zg(e),Ve(jt,this);var r=Bi(this);try{e(De(Hi,r),De(Me,r))}catch(i){Me(r,i)}},Ut=Ie.prototype,jt=function(e){om(this,{type:Qt,done:!1,notified:!1,parent:!1,reactions:new tm,rejection:!1,state:Fu,value:null})},jt.prototype=Mu(Ut,"then",function(e,r){var i=Bi(this),o=ji(Xg(this,Ie));return i.parent=!0,o.ok=Ht(e)?e:!0,o.fail=Ht(r)&&r,o.domain=Wt?Qi.domain:void 0,i.state===Fu?i.reactions.add(o):Wi(function(){ec(o,i)}),o.promise}),Bu=function(){var t=new jt,e=Bi(t);this.promise=t,this.resolve=De(Hi,e),this.reject=De(Me,e)},Ku.f=ji=function(t){return t===Ie||t===Xu?new Bu(t):nm(t)},!Wg&&Ht(Kt)&&$e!==Object.prototype)){Uu=$e.then,im||Mu($e,"then",function(e,r){var i=this;return new Ie(function(o,n){Ve(Uu,i,o,n)}).then(e,r)},{unsafe:!0});try{delete $e.constructor}catch(t){}Vu&&Vu($e,Ut)}Hg({global:!0,constructor:!0,wrap:!0,forced:Qu},{Promise:Ie});Xu=Kg.Promise;Qg(Ie,Qt,!1,!0);Gg(Qt)});var _e=u((RS,oc)=>{"use strict";oc.exports={}});var ac=u((kS,nc)=>{"use strict";var dm=D(),fm=_e(),pm=dm("iterator"),hm=Array.prototype;nc.exports=function(t){return t!==void 0&&(fm.Array===t||hm[pm]===t)}});var zi=u((LS,uc)=>{"use strict";var vm=et(),sc=_t(),gm=Ge(),mm=_e(),bm=D(),ym=bm("iterator");uc.exports=function(t){if(!gm(t))return sc(t,ym)||sc(t,"@@iterator")||mm[vm(t)]}});var lc=u((NS,cc)=>{"use strict";var Im=H(),_m=re(),Sm=ie(),Pm=ze(),Tm=zi(),Em=TypeError;cc.exports=function(t,e){var r=arguments.length<2?Tm(t):e;if(_m(r))return Sm(Im(r,t));throw new Em(Pm(t)+" is not iterable")}});var pc=u(($S,fc)=>{"use strict";var wm=H(),dc=ie(),xm=_t();fc.exports=function(t,e,r){var i,o;dc(t);try{if(i=xm(t,"return"),!i){if(e==="throw")throw r;return r}i=wm(i,t)}catch(n){o=!0,i=n}if(e==="throw")throw r;if(o)throw i;return dc(i),r}});var zt=u((DS,mc)=>{"use strict";var Am=Xe(),Om=H(),Cm=ie(),qm=ze(),Rm=ac(),km=ni(),hc=yt(),Lm=lc(),Nm=zi(),vc=pc(),$m=TypeError,Gt=function(t,e){this.stopped=t,this.result=e},gc=Gt.prototype;mc.exports=function(t,e,r){var i=r&&r.that,o=!!(r&&r.AS_ENTRIES),n=!!(r&&r.IS_RECORD),c=!!(r&&r.IS_ITERATOR),l=!!(r&&r.INTERRUPTED),f=Am(e,i),p,h,a,s,d,v,g,y=function(T){return p&&vc(p,"normal"),new Gt(!0,T)},S=function(T){return o?(Cm(T),l?f(T[0],T[1],y):f(T[0],T[1])):l?f(T,y):f(T)};if(n)p=t.iterator;else if(c)p=t;else{if(h=Nm(t),!h)throw new $m(qm(t)+" is not iterable");if(Rm(h)){for(a=0,s=km(t);s>a;a++)if(d=S(t[a]),d&&hc(gc,d))return d;return new Gt(!1)}p=Lm(t,h)}for(v=n?t.next:p.next;!(g=Om(v,p)).done;){try{d=S(g.value)}catch(T){vc(p,"throw",T)}if(typeof d=="object"&&d&&hc(gc,d))return d}return new Gt(!1)}});var Sc=u((MS,_c)=>{"use strict";var Dm=D(),yc=Dm("iterator"),Ic=!1;try{bc=0,Yi={next:function(){return{done:!!bc++}},return:function(){Ic=!0}},Yi[yc]=function(){return this},Array.from(Yi,function(){throw 2})}catch(t){}var bc,Yi;_c.exports=function(t,e){try{if(!e&&!Ic)return!1}catch(o){return!1}var r=!1;try{var i={};i[yc]=function(){return{next:function(){return{done:r=!0}}}},t(i)}catch(o){}return r}});var Ji=u((VS,Pc)=>{"use strict";var Mm=ye(),Vm=Sc(),Fm=Le().CONSTRUCTOR;Pc.exports=Fm||!Vm(function(t){Mm.all(t).then(void 0,function(){})})});var Tc=u(()=>{"use strict";var Bm=L(),Um=H(),jm=re(),Hm=Ne(),Wm=Dt(),Km=zt(),Qm=Ji();Bm({target:"Promise",stat:!0,forced:Qm},{all:function(e){var r=this,i=Hm.f(r),o=i.resolve,n=i.reject,c=Wm(function(){var l=jm(r.resolve),f=[],p=0,h=1;Km(e,function(a){var s=p++,d=!1;h++,Um(l,r,a).then(function(v){d||(d=!0,f[s]=v,--h||o(f))},n)}),--h||o(f)});return c.error&&n(c.value),i.promise}})});var wc=u(()=>{"use strict";var Gm=L(),zm=Z(),Ym=Le().CONSTRUCTOR,Zi=ye(),Jm=te(),Xm=A(),Zm=qe(),Ec=Zi&&Zi.prototype;Gm({target:"Promise",proto:!0,forced:Ym,real:!0},{catch:function(t){return this.then(void 0,t)}});!zm&&Xm(Zi)&&(Xi=Jm("Promise").prototype.catch,Ec.catch!==Xi&&Zm(Ec,"catch",Xi,{unsafe:!0}));var Xi});var xc=u(()=>{"use strict";var eb=L(),tb=H(),rb=re(),ib=Ne(),ob=Dt(),nb=zt(),ab=Ji();eb({target:"Promise",stat:!0,forced:ab},{race:function(e){var r=this,i=ib.f(r),o=i.reject,n=ob(function(){var c=rb(r.resolve);nb(e,function(l){tb(c,r,l).then(i.resolve,o)})});return n.error&&o(n.value),i.promise}})});var Ac=u(()=>{"use strict";var sb=L(),ub=Ne(),cb=Le().CONSTRUCTOR;sb({target:"Promise",stat:!0,forced:cb},{reject:function(e){var r=ub.f(this),i=r.reject;return i(e),r.promise}})});var eo=u((GS,Oc)=>{"use strict";var lb=ie(),db=W(),fb=Ne();Oc.exports=function(t,e){if(lb(t),db(e)&&e.constructor===t)return e;var r=fb.f(t),i=r.resolve;return i(e),r.promise}});var Rc=u(()=>{"use strict";var pb=L(),hb=te(),Cc=Z(),vb=ye(),qc=Le().CONSTRUCTOR,gb=eo(),mb=hb("Promise"),bb=Cc&&!qc;pb({target:"Promise",stat:!0,forced:Cc||qc},{resolve:function(e){return gb(bb&&this===mb?vb:this,e)}})});var kc=u(()=>{"use strict";ic();Tc();wc();xc();Ac();Rc()});var Dc=u(()=>{"use strict";var yb=L(),Ib=Z(),Yt=ye(),_b=R(),Nc=te(),$c=A(),Sb=mi(),Lc=eo(),Pb=qe(),ro=Yt&&Yt.prototype,Tb=!!Yt&&_b(function(){ro.finally.call({then:function(){}},function(){})});yb({target:"Promise",proto:!0,real:!0,forced:Tb},{finally:function(t){var e=Sb(this,Nc("Promise")),r=$c(t);return this.then(r?function(i){return Lc(e,t()).then(function(){return i})}:t,r?function(i){return Lc(e,t()).then(function(){throw i})}:t)}});!Ib&&$c(Yt)&&(to=Nc("Promise").prototype.finally,ro.finally!==to&&Pb(ro,"finally",to,{unsafe:!0}));var to});var Vc=u((tP,Mc)=>{"use strict";cs();kc();Dc();var Eb=Et();Mc.exports=Eb("Promise","finally")});var Bc=u((rP,Fc)=>{"use strict";var wb=Vc();Fc.exports=wb});var io=u((iP,Uc)=>{"use strict";var xb=Bc();Uc.exports=xb});var Hc=u((oP,jc)=>{"use strict";var Ab=R();jc.exports=!Ab(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})});var Jt=u((nP,Kc)=>{"use strict";var Ob=ee(),Cb=A(),qb=Kr(),Rb=Mt(),kb=Hc(),Wc=Rb("IE_PROTO"),oo=Object,Lb=oo.prototype;Kc.exports=kb?oo.getPrototypeOf:function(t){var e=qb(t);if(Ob(e,Wc))return e[Wc];var r=e.constructor;return Cb(r)&&e instanceof r?r.prototype:e instanceof oo?Lb:null}});var zc=u((aP,Gc)=>{"use strict";var Nb=k(),no=ee(),$b=fe(),Db=ai().indexOf,Mb=Vt(),Qc=Nb([].push);Gc.exports=function(t,e){var r=$b(t),i=0,o=[],n;for(n in r)!no(Mb,n)&&no(r,n)&&Qc(o,n);for(;e.length>i;)no(r,n=e[i++])&&(~Db(o,n)||Qc(o,n));return o}});var ao=u((sP,Yc)=>{"use strict";Yc.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var so=u((uP,Jc)=>{"use strict";var Vb=zc(),Fb=ao();Jc.exports=Object.keys||function(e){return Vb(e,Fb)}});var uo=u((cP,rl)=>{"use strict";var Zc=$(),Bb=R(),el=k(),Ub=Jt(),jb=so(),Hb=fe(),Wb=kr().f,tl=el(Wb),Kb=el([].push),Qb=Zc&&Bb(function(){var t=Object.create(null);return t[2]=2,!tl(t,2)}),Xc=function(t){return function(e){for(var r=Hb(e),i=jb(r),o=Qb&&Ub(r)===null,n=i.length,c=0,l=[],f;n>c;)f=i[c++],(!Zc||(o?f in r:tl(r,f)))&&Kb(l,t?[f,r[f]]:r[f]);return l}};rl.exports={entries:Xc(!0),values:Xc(!1)}});var il=u(()=>{"use strict";var Gb=L(),zb=uo().entries;Gb({target:"Object",stat:!0},{entries:function(e){return zb(e)}})});var nl=u((fP,ol)=>{"use strict";il();var Yb=pe();ol.exports=Yb.Object.entries});var sl=u((pP,al)=>{"use strict";var Jb=nl();al.exports=Jb});var Fe=u((hP,ul)=>{"use strict";var Xb=sl();ul.exports=Xb});var dl=u((vP,ll)=>{"use strict";var co=$(),Zb=ee(),cl=Function.prototype,ey=co&&Object.getOwnPropertyDescriptor,lo=Zb(cl,"name"),ty=lo&&function(){}.name==="something",ry=lo&&(!co||co&&ey(cl,"name").configurable);ll.exports={EXISTS:lo,PROPER:ty,CONFIGURABLE:ry}});var pl=u(fl=>{"use strict";var iy=$(),oy=Zr(),ny=ve(),ay=ie(),sy=fe(),uy=so();fl.f=iy&&!oy?Object.defineProperties:function(e,r){ay(e);for(var i=sy(r),o=uy(r),n=o.length,c=0,l;n>c;)ny.f(e,l=o[c++],i[l]);return e}});var vo=u((mP,Il)=>{"use strict";var cy=ie(),ly=pl(),hl=ao(),dy=Vt(),fy=bi(),py=St(),hy=Mt(),vl=">",gl="<",po="prototype",ho="script",bl=hy("IE_PROTO"),fo=function(){},yl=function(t){return gl+ho+vl+t+gl+"/"+ho+vl},ml=function(t){t.write(yl("")),t.close();var e=t.parentWindow.Object;return t=null,e},vy=function(){var t=py("iframe"),e="java"+ho+":",r;return t.style.display="none",fy.appendChild(t),t.src=String(e),r=t.contentWindow.document,r.open(),r.write(yl("document.F=Object")),r.close(),r.F},Xt,Zt=function(){try{Xt=new ActiveXObject("htmlfile")}catch(e){}Zt=typeof document!="undefined"?document.domain&&Xt?ml(Xt):vy():ml(Xt);for(var t=hl.length;t--;)delete Zt[po][hl[t]];return Zt()};dy[bl]=!0;Il.exports=Object.create||function(e,r){var i;return e!==null?(fo[po]=cy(e),i=new fo,fo[po]=null,i[bl]=e):i=Zt(),r===void 0?i:ly.f(i,r)}});var yo=u((bP,Pl)=>{"use strict";var gy=R(),my=A(),by=W(),yy=vo(),_l=Jt(),Iy=qe(),_y=D(),Sy=Z(),bo=_y("iterator"),Sl=!1,oe,go,mo;[].keys&&(mo=[].keys(),"next"in mo?(go=_l(_l(mo)),go!==Object.prototype&&(oe=go)):Sl=!0);var Py=!by(oe)||gy(function(){var t={};return oe[bo].call(t)!==t});Py?oe={}:Sy&&(oe=yy(oe));my(oe[bo])||Iy(oe,bo,function(){return this});Pl.exports={IteratorPrototype:oe,BUGGY_SAFARI_ITERATORS:Sl}});var El=u((yP,Tl)=>{"use strict";var Ty=yo().IteratorPrototype,Ey=vo(),wy=Qe(),xy=rt(),Ay=_e(),Oy=function(){return this};Tl.exports=function(t,e,r,i){var o=e+" Iterator";return t.prototype=Ey(Ty,{next:wy(+!i,r)}),xy(t,o,!1,!0),Ay[o]=Oy,t}});var $l=u((IP,Nl)=>{"use strict";var Cy=L(),qy=H(),er=Z(),kl=dl(),Ry=A(),ky=El(),wl=Jt(),xl=pi(),Ly=rt(),Ny=xe(),Io=qe(),$y=D(),Al=_e(),Ll=yo(),Dy=kl.PROPER,My=kl.CONFIGURABLE,Ol=Ll.IteratorPrototype,tr=Ll.BUGGY_SAFARI_ITERATORS,lt=$y("iterator"),Cl="keys",dt="values",ql="entries",Rl=function(){return this};Nl.exports=function(t,e,r,i,o,n,c){ky(r,e,i);var l=function(S){if(S===o&&s)return s;if(!tr&&S&&S in h)return h[S];switch(S){case Cl:return function(){return new r(this,S)};case dt:return function(){return new r(this,S)};case ql:return function(){return new r(this,S)}}return function(){return new r(this)}},f=e+" Iterator",p=!1,h=t.prototype,a=h[lt]||h["@@iterator"]||o&&h[o],s=!tr&&a||l(o),d=e==="Array"&&h.entries||a,v,g,y;if(d&&(v=wl(d.call(new t)),v!==Object.prototype&&v.next&&(!er&&wl(v)!==Ol&&(xl?xl(v,Ol):Ry(v[lt])||Io(v,lt,Rl)),Ly(v,f,!0,!0),er&&(Al[f]=Rl))),Dy&&o===dt&&a&&a.name!==dt&&(!er&&My?Ny(h,"name",dt):(p=!0,s=function(){return qy(a,this)})),o)if(g={values:l(dt),keys:n?s:l(Cl),entries:l(ql)},c)for(y in g)(tr||p||!(y in h))&&Io(h,y,g[y]);else Cy({target:e,proto:!0,forced:tr||p},g);return(!er||c)&&h[lt]!==s&&Io(h,lt,s,{name:o}),Al[e]=s,g}});var Ml=u((_P,Dl)=>{"use strict";Dl.exports=function(t,e){return{value:t,done:e}}});var So=u((SP,jl)=>{"use strict";var Vy=fe(),_o=si(),Vl=_e(),Bl=Mi(),Fy=ve().f,By=$l(),rr=Ml(),Uy=Z(),jy=$(),Ul="Array Iterator",Hy=Bl.set,Wy=Bl.getterFor(Ul);jl.exports=By(Array,"Array",function(t,e){Hy(this,{type:Ul,target:Vy(t),index:0,kind:e})},function(){var t=Wy(this),e=t.target,r=t.index++;if(!e||r>=e.length)return t.target=null,rr(void 0,!0);switch(t.kind){case"keys":return rr(r,!1);case"values":return rr(e[r],!1)}return rr([r,e[r]],!1)},"values");var Fl=Vl.Arguments=Vl.Array;_o("keys");_o("values");_o("entries");if(!Uy&&jy&&Fl.name!=="values")try{Fy(Fl,"name",{value:"values"})}catch(t){}});var Wl=u((PP,Hl)=>{"use strict";var Ky=$(),Qy=ve(),Gy=Qe();Hl.exports=function(t,e,r){Ky?Qy.f(t,e,Gy(0,r)):t[e]=r}});var Kl=u(()=>{"use strict";var zy=L(),Yy=zt(),Jy=Wl();zy({target:"Object",stat:!0},{fromEntries:function(e){var r={};return Yy(e,function(i,o){Jy(r,i,o)},{AS_ENTRIES:!0}),r}})});var Gl=u((wP,Ql)=>{"use strict";So();Kl();var Xy=pe();Ql.exports=Xy.Object.fromEntries});var Yl=u((xP,zl)=>{"use strict";zl.exports={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}});var Xl=u(()=>{"use strict";So();var Zy=Yl(),eI=x(),tI=rt(),Jl=_e();for(ir in Zy)tI(eI[ir],ir),Jl[ir]=Jl.Array;var ir});var ed=u((CP,Zl)=>{"use strict";var rI=Gl();Xl();Zl.exports=rI});var rd=u((qP,td)=>{"use strict";var iI=ed();td.exports=iI});var Id=u(()=>{"use strict";var sI=L(),uI=uo().values;sI({target:"Object",stat:!0},{values:function(e){return uI(e)}})});var Sd=u((CE,_d)=>{"use strict";Id();var cI=pe();_d.exports=cI.Object.values});var Td=u((qE,Pd)=>{"use strict";var lI=Sd();Pd.exports=lI});var wd=u((RE,Ed)=>{"use strict";var dI=Td();Ed.exports=dI});var gI={};Fo(gI,{ApiEnv:()=>Ce,ConnectionType:()=>At,ContentType:()=>xt,InteractiveInterfaceClick:()=>ui,MediascopePixel:()=>Er,MediascopePixelTypes:()=>Vo,OneStat:()=>dr,Quality:()=>wt,SeekAction:()=>Ot,ThinOneStat:()=>Pr,VERSION:()=>V});module.exports=sf(gI);var Co=C(ge(),1);var Oh=(t,e,r)=>{if(typeof t.canParse=="function")return t.canParse(e,r);try{return new t(e,r),!0}catch(i){return!1}},Na=Oh;var Ce=(c=>(c.PROD="prod",c.VK_ALIAS="vk_alias",c.VIDEOTEST="videotest",c.TEST="test",c.OKCDN="okcdn",c.AUTO="auto",c))(Ce||{}),wt=(p=>(p.Q144P="mobile",p.Q240P="lowest",p.Q360P="low",p.Q480P="medium",p.Q720P="high",p.Q1080P="fullhd",p.Q1440P="quadhd",p.Q2160P="ultrahd",p.UNKNOWN="unknown",p))(wt||{}),xt=(v=>(v.MP4="mp4",v.DASH="dash",v.DASH_SEP="dash_sep",v.ONDEMAND_DASH="ondemand_dash",v.HLS="hls",v.HLS_FMP4="hls_fmp4",v.ONDEMAND_HLS="ondemand_hls",v.WEBM="webm",v.AV1="av1",v.ONDEMAND_DASH_LIVE="ondemand_dash_live",v.ONDEMAND_HLS_LIVE="ondemand_hls_live",v.WEBRTC="webrtc",v.UNKNOWN="unknown",v.RTMP="rtmp",v))(xt||{});var At=(i=>(i.HTTP1="http1",i.HTTP2="http2",i.HTTP3="http3",i))(At||{});var Ot=(l=>(l.SLIDER="slider",l.DOUBLE_TAP="double_tap",l.TIME_CODE="time_code",l.EPISODE="episode",l.REWIND="rewind",l.LIVE="live",l.UNKNOWN="unknown",l))(Ot||{}),ui=(n=>(n.GRAPH_SHOW="iGraphShow",n.GRAPH_HIDE="iGraphHide",n.NEXT_AREA="iNextChapterArea",n.NEXT_BUTTON="iNextChapterBtn",n.WATCH_AGAIN="iWatchAgainBtn",n))(ui||{}),$a={action_play:"ap",action_play_interactive:"api",first_bytes:"fb",player_ready:"pr",first_frame:"ff",seek:"sk",watch_coverage_record:"wr",watch_coverage_live:"wl",empty_buffer:"eb",action_stop:"as",close_at_empty_buffer:"cb",content_error:"er",player_interface_click:"pc",next_movie:"nm",track_switch:"ts",failover:"fo",quality:"qt"},Da={vsid:"si",isid:"is",vid:"vi",place:"pl",quality:"qt",cdn_host:"ch",stat_type:"st",param:"pm",vk_app_id:"va",track_code:"tc",connection_type:"cnt",connection_reused:"cr",cached_data:"cd",live:"lv",muted:"mu",mode:"mo",subtitles:"sb",failover:"fo",download_speed:"ds",manual_quality:"mq",ref_domain:"rd",direct_url:"du"},Ma={unknown:"un",mobile:"m",lowest:"ls",low:"l",medium:"md",high:"h",fullhd:"f",quadhd:"q",ultrahd:"u"},Va={pip:"pi",fullscreen:"fs",external:"ex",prefetch:"pr",airplay:"ap",chromecast:"cc",invisible:"iv",minimal:"minimal"};var Ba=require("@vkontakte/videoplayer-shared/es2018");var Fa="CIOPGQJGDIHBABABA",ci={prod:"https://api.ok.ru",vk_alias:"https://api.mycdn.me",videotest:"https://videotestapi.ok.ru/api",test:"https://apitest.ok.ru",okcdn:"https://api.okcdn.ru",auto:""};var Ch={apiEnv:"vk_alias",apiKey:Fa,apiBaseUrl:null,requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageInterval:15e3,disabledOperations:["quality"],disabledCustomFields:[],shorten:!0,maxLoops:100,embedUrlParams:[],useBeacon:!0,synchronizeTime:!0,debugLog:!1,clearStorageAtUnload:!0,useVKComIsMobileLogic:!1,backoff:{start:1e3,factor:1.5,max:5*60*1e3,random:.1},useKeepalive:!1,watchCoverageTimeoutFix:!1},Ua=t=>(0,Ba.fillWithDefault)(t,Ch);function li(){let t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),e=new Array(36),r=0,i,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?e[o]="-":o===14?e[o]="4":(r<=2&&(r=33554432+Math.random()*16777216|0),i=r&15,r=r>>4,e[o]=t[o===19?i&3|8:i]);return e.join("")}var b=require("@vkontakte/videoplayer-shared/es2018"),fr=require("@vkontakte/videoplayer-shared/es2018");var us=C(Rt(),1),nv=()=>(0,us.default)(Math.floor(Math.random()*2**32).toString(36),13,"0"),ce=class t{static getVSID(){return t.vsid}static generateVSID(){return t.vsid=nv(),t.vsid}};var or=C(io(),1);var id=C(Fe(),1),od=C(rd(),1);var nd=t=>{var o;let{operation:e,custom:r}=t,i=(0,od.default)((0,id.default)(r).map(([n,c])=>{var p,h,a;let l=(p=Da[n])!=null?p:n,f=c;return c&&(n==="mode"?f=(h=Va[c])!=null?h:c:n==="quality"&&(f=(a=Ma[c])!=null?a:c)),[l,f]}));return{...t,operation:(o=$a[e])!=null?o:e,custom:i}};var V="1.0.97-dev.51af1f96.0";var G=require("@vkontakte/videoplayer-shared/es2018");var oI=/Mobile|mini|Fennec|Android|iP(ad|od|hone)|opera (mini|mobi)/i,ft=class{constructor(e){this.consequentAuthErrors=0;this.authorized$=new G.ValueSubject(!1);this.params=e}async authorize(e){return this.authToken=e!=null?e:await this.refreshAuthToken(),this._authorizeWithBackoff()}logBeacon(e){let r="log.externalLog",i=this.createLogParams(e),o=this.sessionKey;if(!o)return;this.params.apiTransport.sendBeacon(r,i,o)||this.logRequest(e).catch(()=>{})}async logRequest(e){var c;let r="log.externalLog",i=this.createLogParams(e),o=(c=this.sessionKey)!=null?c:await this._authorizeWithBackoff();if(!o)return;let n=async(l,f=this.params.config.requestRetryCount)=>{try{return await this.params.apiTransport.sendRequest(r,i,o)}catch(p){if(!p||!("error_code"in p)){this.params.error$.next({id:"logRequestUnknown",category:G.ErrorCategory.NETWORK,message:`Unknown ${r} error`,thrown:p});return}let h=p==null?void 0:p.error_code;switch(h){case 102:case 103:case 104:return this.authorized$.next(!1),this.sessionKey=await this._authorizeWithBackoff(),f>0?n(l,f-1):void 0;case 401:return this.authorized$.next(!1),this.authToken=await this.refreshAuthToken(),this.sessionKey=await this._authorizeWithBackoff(),f>0?n(l,f-1):void 0;default:{this.params.error$.next({id:`LogRequest#${h}`,category:G.ErrorCategory.EXTERNAL_API,message:`${r} error`,data:p});return}}}};return n(e)}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}async refreshAuthToken(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=(0,or.default)(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise}createLogParams(e){let r="WEB",i=!1,o=`@vkontakte/videoplayer-statistics:${V}`;if(this.params.config.useVKComIsMobileLogic){let{appVersion:n}=window.navigator;i=oI.test(n)}else this.params.mobile&&(i=!0);return i&&(r="M_WEB"),this.params.vktvVersion&&(r="SMART_TV",o=this.params.vktvVersion),{collector:"ok.mobile.apps.video",data:JSON.stringify({application:o,platform:r,items:this.params.config.shorten?e.map(nd):e})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();let e=(0,G.getExponentialDelay)(this.consequentAuthErrors,this.params.config.backoff);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{(0,or.default)(this._authorize().then(r).catch(i=>this.params.error$.next({id:"AuthorizeBackoff",category:G.ErrorCategory.NETWORK,message:"Otherwise unhandled error in authorization",thrown:i})),()=>this.backoffTimeoutId=0)},e))})}async _authorize(){if(this.authorizePromise)return this.authorizePromise;this.sessionKey=void 0,this.authorized$.next(!1);let e="auth.anonymLogin",r={session_data:{version:2,device_id:this.params.deviceId,client_version:V.split("-")[0],client_type:"SDK_JS"}};return this.authToken!==void 0&&(r.session_data.auth_token=this.authToken,r.session_data.version=3),this.authorizePromise=(0,or.default)(this.params.apiTransport.sendRequest(e,r).then(i=>{var o;return(!i||!i.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:G.ErrorCategory.EXTERNAL_API,message:"No session key",data:i}),this.sessionKey=(o=i==null?void 0:i.session_key)!=null?o:void 0,this.sessionKey}).catch(async i=>{this.sessionKey=void 0;let o=i==null?void 0:i.error_code;switch(o){case 401:return this.authToken=await this.refreshAuthToken(),this._authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:G.ErrorCategory.EXTERNAL_API,message:"authorize error",data:i}):this.params.error$.next({id:"AuthorizeUnknown",category:G.ErrorCategory.NETWORK,message:"authorize error",thrown:i})}),()=>{this.authorizePromise=void 0,this.consequentAuthErrors=this.sessionKey?0:this.consequentAuthErrors+1,this.authorized$.next(this.sessionKey!==void 0)}),this.authorizePromise}};var{NativeAbortSignal:jP,NativeAbortController:HP}=function(t){return{NativeAbortSignal:t.AbortSignal,NativeAbortController:t.AbortController}}(typeof self!="undefined"?self:global);function ad(t){let e;try{e=new Event("abort")}catch(r){typeof document!="undefined"?document.createEvent?(e=document.createEvent("Event"),e.initEvent("abort",!1,!1)):(e=document.createEventObject(),e.type="abort"):e={type:"abort",bubbles:!1,cancelable:!1}}return e.reason=t,e}function sd(t){if(t===void 0)if(typeof document=="undefined")t=new Error("This operation was aborted"),t.name="AbortError";else try{t=new DOMException("signal is aborted without reason"),Object.defineProperty(t,"name",{value:"AbortError"})}catch(e){t=new Error("This operation was aborted"),t.name="AbortError"}return t}var nr=class{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(e,r,i){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:r,options:i})}removeEventListener(e,r){if(!(e in this.listeners))return;let i=this.listeners[e];for(let o=0,n=i.length;o<n;o++)if(i[o].callback===r){i.splice(o,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let i=this.listeners[e.type].slice();for(let o=0,n=i.length;o<n;o++){let c=i[o];try{c.callback.call(this,e)}catch(l){Promise.resolve().then(()=>{throw l})}c.options&&c.options.once&&this.removeEventListener(e.type,c.callback)}return!e.defaultPrevented}},Be=class extends nr{constructor(){super(),this.listeners||nr.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(e){e.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,e)),super.dispatchEvent(e)}throwIfAborted(){let{aborted:e,reason:r="Aborted"}=this;if(e)throw r}static timeout(e){let r=new Se;return setTimeout(()=>r.abort(new DOMException(`This signal is timeout in ${e}ms`,"TimeoutError")),e),r.signal}static any(e){let r=new Se;function i(){r.abort(this.reason),o()}function o(){for(let n of e)n.removeEventListener("abort",i)}for(let n of e)if(n.aborted){r.abort(n.reason);break}else n.addEventListener("abort",i);return r.signal}},Se=class{constructor(){Object.defineProperty(this,"signal",{value:new Be,writable:!0,configurable:!0})}abort(e){let r=sd(e),i=ad(r);this.signal.reason=r,this.signal.dispatchEvent(i)}toString(){return"[object AbortController]"}};typeof Symbol!="undefined"&&Symbol.toStringTag&&(Se.prototype[Symbol.toStringTag]="AbortController",Be.prototype[Symbol.toStringTag]="AbortSignal");function ar(t){return t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof t.Request=="function"&&!t.Request.prototype.hasOwnProperty("signal")||!t.AbortController}function Po(t){typeof t=="function"&&(t={fetch:t});let{fetch:e,Request:r=e.Request,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=t;if(!ar({fetch:e,Request:r,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o}))return{fetch:e,Request:n};let n=r;(n&&!n.prototype.hasOwnProperty("signal")||o)&&(n=function(p,h){let a;h&&h.signal&&(a=h.signal,delete h.signal);let s=new r(p,h);return a&&Object.defineProperty(s,"signal",{writable:!1,enumerable:!1,configurable:!0,value:a}),s},n.prototype=r.prototype);let c=e;return{fetch:(f,p)=>{let h=n&&n.prototype.isPrototypeOf(f)?f.signal:p?p.signal:void 0;if(h){let a;try{a=new DOMException("Aborted","AbortError")}catch(d){a=new Error("Aborted"),a.name="AbortError"}if(h.aborted)return Promise.reject(a);let s=new Promise((d,v)=>{h.addEventListener("abort",()=>v(a),{once:!0})});return p&&p.signal&&delete p.signal,Promise.race([s,c(f,p)])}return c(f,p)},Request:n}}var O=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window;var nI=()=>"fetch"in O,pt=nI()&&ar({fetch:O.fetch,Request:O.Request,AbortController:O.AbortController}),ud=pt?Po({fetch:O.fetch,Request:O.Request,AbortController:O.AbortController}):void 0,Ue=pt?ud.fetch:O.fetch,rT=pt?ud.Request:O.Request,iT=pt?Se:O.AbortController,oT=pt?Be:O.AbortSignal;var cd=C(ge(),1),ld=C(Fe(),1),ne=require("@vkontakte/videoplayer-shared/es2018");var ht=class{constructor(e){var r;this.params=e,this.apiKey=e.config.apiKey,this.apiEnv=e.config.apiEnv,this.apiBaseUrl=(r=e.config.apiBaseUrl)!=null?r:ci[this.apiEnv],this.timeSynchronisation=e.timeSynchronisation,this.isApiBaseUrlFetched=!1}async resolveApiBaseUrl(){var e;if(this.apiEnv!=="auto"||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{let r=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=await(await Ue(r,{method:"GET",mode:"cors",cache:"no-cache"})).json(),n=(e=o==null?void 0:o.Answer[0])==null?void 0:e.data;if(!n)throw new Error("Wrong DNS response");return n}catch(r){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:ne.ErrorCategory.NETWORK,message:"Unhandled resolve api base url error",thrown:r}),ci.vk_alias}finally{this.isApiBaseUrlFetched=!0}}sendBeacon(e,r,i){if(!window.Blob||!window.navigator.sendBeacon)return!1;let o=this._prepareQueryParams({method:e,queryParams:r,sessionKey:i}),n=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,n)}catch(c){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:ne.ErrorCategory.NETWORK,message:"Unhandled beacon error",thrown:c,data:{method:e,params:r}})}return!1}async sendRequest(e,r,i){let o=(0,ne.now)(),n=l=>{if(l instanceof TypeError&&(0,cd.default)(["Failed to fetch","NetworkError when attempting to fetch resource."],l.message)){this.params.error$.next({id:"Network",category:ne.ErrorCategory.NETWORK,message:"Request failed",thrown:l});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:ne.ErrorCategory.NETWORK,message:"Unhandled request error",thrown:l,data:{method:e,params:r,sessionKey:i,time:(0,ne.now)()-o}})};this.apiBaseUrl=await this.resolveApiBaseUrl();let c={method:"post",headers:{"Content-type":"application/x-www-form-urlencoded"},body:this._prepareQueryParams({method:e,queryParams:r,sessionKey:i})};return this.params.config.useKeepalive&&(c.keepalive=!0),Ue(`${this.apiBaseUrl}/fb.do`,c).then(l=>{var a,s;let f=Number(l.headers.get("content-length"))===0,p=new Date((a=l.headers.get("date"))!=null?a:"").getTime(),h=(0,ne.now)()-o;if(isFinite(p)&&((s=this.timeSynchronisation)==null||s.addServerTime(p,h)),!f)return l.json().then(d=>Object.prototype.hasOwnProperty.call(d,"error_msg")?Promise.reject(d):d,n)},n)}_prepareQueryParams(e){let r=new URLSearchParams({format:"JSON",method:e.method,application_key:this.apiKey});return e.sessionKey!==void 0&&r.append("session_key",e.sessionKey),(0,ld.default)(e.queryParams).forEach(([i,o])=>r.append(i,typeof o=="string"?o:JSON.stringify(o))),r}};var dd=C(ge(),1),fd=C(Fe(),1),F=require("@vkontakte/videoplayer-shared/es2018"),sr="onestat_events",To=t=>e=>e.timestamp+t>=(0,F.now)(),ur=class{constructor(e){this.unsaltedStorage=[];this.isPaused=!1;this.isUrgent=e=>{let{operation:r}=e;return(0,dd.default)(["action_play","watch_coverage_record","watch_coverage_live"],r)};this.params=e,this.api=e.api,this.error$=e.error$,this.userSalt=e.userSalt,this.loggerDebugLog=e.debugLogger.createComponentLog("stat logger"),this.firstFlush=(0,F.debounceFn)(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});let r=F.safeStorage.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=(0,F.debounceFn)(()=>this.safeFlush(),this.params.config.flushDebounceTime,{maxWait:r}),this.subscription=this.api.authorized$.subscribe(i=>{i&&this.debouncedFlush()}),this.housekeepStorage()}safeFlush(){try{this.flush()}catch(e){this.error$.next({id:"LoggerError",category:F.ErrorCategory.WTF,message:e?String(e):"Unknown logger error",thrown:e})}}readFromStorage(){let e=F.safeStorage.get(sr);try{return e?JSON.parse(e):{}}catch(r){}return{}}addToStorage(e){var n;if(!this.userSalt){this.unsaltedStorage.push(e);return}let r=this.readFromStorage(),o=((n=r[this.userSalt])!=null?n:[]).filter(To(this.params.config.storageExpiration));F.safeStorage.set(sr,JSON.stringify({...r,[this.userSalt]:[...o,e]}))}getFromStorage(){var i;return this.userSalt?((i=this.readFromStorage()[this.userSalt])!=null?i:[]).filter(To(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}let e=this.readFromStorage();delete e[this.userSalt],F.safeStorage.set(sr,JSON.stringify(e))}housekeepStorage(){let e=this.readFromStorage();for(let[r,i]of(0,fd.default)(e)){let o=i.filter(To(this.params.config.storageExpiration));o.length?e[r]=o:delete e[r],this.loggerDebugLog({message:`${i.length} retrieved from storage, ${o.length} of them actual`})}F.safeStorage.set(sr,JSON.stringify(e))}log(e){this.addToStorage(e),!this.isPaused&&(this.isUrgent(e)?this.flush():this.lastVsid!==e.custom.vsid?this.firstFlush():this.debouncedFlush(),this.lastVsid=e.custom.vsid)}flush({wantBeacon:e,clearStorage:r}={wantBeacon:!1,clearStorage:!0}){let i=this.getFromStorage();i.length!==0&&(this.api.authorized$.getValue()?(e&&this.params.config.useBeacon?(this.loggerDebugLog({message:`Flushing ${i.length} events through beacon`}),this.api.logBeacon(i)):(this.loggerDebugLog({message:`Flushing ${i.length} events`}),this.api.logRequest(i)),r&&this.markStorageSent()):this.api.authorize(),this.firstFlush.cancel(),this.debouncedFlush.cancel())}pause(){this.isPaused=!0,this.debouncedFlush.cancel()}resume(){this.isPaused=!1,this.debouncedFlush()}destroy(){this.subscription.unsubscribe(),this.firstFlush.cancel(),this.debouncedFlush.cancel()}};var _=require("@vkontakte/videoplayer-core/es2018"),Eo=require("@vkontakte/videoplayer-shared/es2018");var pd=t=>t&&{[_.VideoQuality.INVARIANT]:"unknown",[_.VideoQuality.Q_144P]:"mobile",[_.VideoQuality.Q_240P]:"lowest",[_.VideoQuality.Q_360P]:"low",[_.VideoQuality.Q_480P]:"medium",[_.VideoQuality.Q_576P]:"unknown",[_.VideoQuality.Q_720P]:"high",[_.VideoQuality.Q_1080P]:"fullhd",[_.VideoQuality.Q_1440P]:"quadhd",[_.VideoQuality.Q_2160P]:"ultrahd",[_.VideoQuality.Q_4320P]:"unknown"}[t],wo=t=>t&&{[_.HttpConnectionType.HTTP1]:"http1",[_.HttpConnectionType.HTTP2]:"http2",[_.HttpConnectionType.QUIC]:"http3"}[t],hd=t=>{if(t!==void 0)switch(t){case _.VideoFormat.MPEG:return"mp4";case _.VideoFormat.DASH:case _.VideoFormat.DASH_LIVE:case _.VideoFormat.DASH_STREAMS:return"dash";case _.VideoFormat.DASH_SEP:return"dash_sep";case _.VideoFormat.DASH_ONDEMAND:return"ondemand_dash";case _.VideoFormat.DASH_WEBM:case _.VideoFormat.DASH_LIVE_WEBM:return"webm";case _.VideoFormat.DASH_WEBM_AV1:return"av1";case _.VideoFormat.DASH_LIVE_CMAF:return"ondemand_dash_live";case _.VideoFormat.HLS:case _.VideoFormat.HLS_LIVE:return"hls";case _.VideoFormat.HLS_FMP4:return"hls_fmp4";case _.VideoFormat.HLS_ONDEMAND:return"ondemand_hls";case _.VideoFormat.HLS_LIVE_CMAF:return"ondemand_hls_live";case _.VideoFormat.WEB_RTC_LIVE:return"webrtc";default:return(0,Eo.assertNever)(t)}},xo=(t,e)=>{if(e)return"minimal";switch(t){case void 0:case _.Surface.NONE:case _.Surface.INLINE:return;case _.Surface.FULLSCREEN:return"fullscreen";case _.Surface.SECOND_SCREEN:return"chromecast";case _.Surface.PIP:return"pip";case _.Surface.INVISIBLE:return"invisible";default:return(0,Eo.assertNever)(t)}},vd=t=>{switch(t){case"slow-2g":return"poor";case"2g":return"poor";case"3g":return"good";case"4g":return"excellent"}};var cr=class{constructor(e){this.offset=void 0;this.offset=e}getOffset(){var e;return(e=this.offset)!=null?e:0}setOffset(e){this.offset=e}now(){var e;return Date.now()+((e=this.offset)!=null?e:0)}date(e=new Date){var r;return e.setTime(e.getTime()+((r=this.offset)!=null?r:0)),e}addServerTime(e,r){let i=Date.now(),o=e-i-r/2;if(Math.abs(o)<1e3){this.offset=0;return}this.offset===void 0?this.offset=Math.round(o):this.offset=Math.round(.2*o+(1-.2)*this.offset)}};var gd=C(Rt(),1);var md=()=>(0,gd.default)(Math.floor(Math.random()*2**64).toString(36),13,"0");var Ao=require("@vkontakte/videoplayer-core/es2018"),w=require("@vkontakte/videoplayer-shared/es2018"),bd=(t,e)=>new w.Observable(r=>{let i=new w.Subscription,o=(0,w.merge)((0,w.fromEvent)(window,"beforeunload"),t.events.willDestruct$),n=new w.ValueSubject(void 0),c;i.add(t.info.isLive$.pipe((0,w.filterChanged)()).subscribe(P=>{c&&(c.unsubscribe(),n.next(void 0)),P?c=t.info.liveTime$.pipe((0,w.map)(q=>q&&q/1e3)).subscribe(n):c=t.info.position$.subscribe(n),i.add(c)}));let{playing$:l,paused$:f}=t.events,p=t.events.willSeek$.pipe((0,w.filter)(()=>t.info.playbackState$.getValue()===Ao.PlaybackState.PLAYING)),h=t.events.seeked$.pipe((0,w.filter)(()=>t.info.playbackState$.getValue()===Ao.PlaybackState.PLAYING)),a=!1,s=new w.Subject;i.add(p.subscribe(()=>{a||s.next(),a=!0})),i.add(h.subscribe(()=>a=!1));let d=new w.Subject,v=new w.Subject,g=(0,w.merge)(l,h,d),y=(0,w.merge)(f,s,o,t.events.looped$,v),S,T=()=>S=n.getValue(),N=()=>{let P=n.getValue();(0,w.isNullable)(S)||S===P||(0,w.isNullable)(P)||(r.next({from:S,to:P}),S=void 0)},U=()=>{v.next(),d.next()};if(i.add(g.subscribe(T)),i.add(y.subscribe(N)),e.forceInterval&&isFinite(e.forceInterval))if(e.watchCoverageTimeoutFix){let P,q=()=>{P!==void 0&&(window.clearTimeout(P),P=void 0)};i.add(g.subscribe(()=>{q(),P=window.setTimeout(U,e.forceInterval)})),i.add(y.subscribe(()=>q())),i.add(()=>q())}else{let P=0;i.add(g.subscribe(()=>P=window.setTimeout(U,e.forceInterval))),i.add(y.subscribe(()=>window.clearTimeout(P)))}return i});var z=require("@vkontakte/videoplayer-core/es2018"),je=require("@vkontakte/videoplayer-shared/es2018"),lr=(t,e,r)=>{let i=new je.Subject,o=i.pipe((0,je.debounce)(0),(0,je.filterChanged)()),n=!1,c=!1,l=!1;return e(t.inPiP$,f=>{n=f,i.next(f?z.Surface.PIP:c?z.Surface.FULLSCREEN:l?z.Surface.INLINE:void 0)}),e(t.inFullscreen$,f=>{c=f,i.next(f?z.Surface.FULLSCREEN:n?z.Surface.PIP:l?z.Surface.INLINE:void 0)}),r&&e(r.info.surface$,f=>{switch(f){case z.Surface.SECOND_SCREEN:case z.Surface.NONE:case z.Surface.INLINE:{!c&&!n&&(f===z.Surface.INLINE&&(l=!0),i.next(f));break}}}),{surface$:o}};var aI="_one-stat_",yd=`${aI}deviceId`,Oo=()=>{let t=new b.Subscription;return{subscription:t,subscribe:(e,r)=>{e&&t.add(e.subscribe(r))}}},dr=class{constructor(e,r){this.subscription=new b.Subscription;this.debugLogger=new fr.Logger;this.oneStatDebugLog=this.debugLogger.createComponentLog("onestat");this.loopCounter=0;this.disabled=!1;this.isid$=new b.ValueSubject(void 0);this.zenUid$=new b.ValueSubject(void 0);this.seekAction$=new b.ValueSubject("unknown");var f,p,h;this.statContext=e,this.config=Ua((f=r.config)!=null?f:{}),(0,b.isNonNullable)(r.apiEnv)&&(this.config.apiEnv=r.apiEnv),this.config.synchronizeTime&&(this.timeSynchronisation=new cr);let i=new b.Subject;this.experimental={error$:i};let o=b.safeStorage.get(yd);this.statContext.deviceId?this.deviceId=this.statContext.deviceId:o?this.deviceId=o:(this.deviceId=li(),b.safeStorage.set(yd,this.deviceId)),this.resetViewSession(),r.useIsid&&this.isid$.next((p=r.isid)!=null?p:md()),this.zenUid$.next(r.zenUid);let n=new ht({config:this.config,error$:i,timeSynchronisation:this.timeSynchronisation});this.api=new ft({config:this.config,apiTransport:n,refreshAuthToken:r.refreshAuthToken,mobile:(h=this.statContext.mobile)!=null?h:!1,deviceId:this.deviceId,error$:i,vktvVersion:r.vktvVersion}),this.logger=new ur({config:this.config,debugLogger:this.debugLogger,api:this.api,error$:i,userSalt:r.userSalt});let{isEmbed:c,topOrigin:l}=(0,fr.detectEmbed)();this.isEmbed=c,this.embedParent=l?new URL(l).hostname:void 0,this.subscribe()}get vsid$(){return new b.ValueSubject(ce.getVSID())}updateContext(e){this.statContext={...this.statContext,...e}}attachTo(e){let r=new b.Subscription,i=(s,d)=>r.add(s.subscribe(d));i(e.events.willStart$,()=>{let s=e.info.position$.getValue();this.logActionPlay({position:s}),this.statContext.projectId&&this.logActionPlayInteractive()}),i(e.events.looped$,()=>{this.resetViewSession(),++this.loopCounter>this.config.maxLoops&&(this.disabled=!0),this.logActionPlay({position:e.info.position$.getValue()})}),i(e.events.seeked$,()=>{this.logSeek({action:this.seekAction$.getValue(),time:e.info.position$.getValue()}),this.seekAction$.next("unknown")}),i(e.events.paused$,()=>{this.logPause({position:e.info.position$.getValue()})}),i(e.events.willResume$,()=>{this.logPlay()}),i(e.events.started$,()=>{this.statContext.clip&&this.logWatchCoverageRecord({start:0,end:0})}),i(e.events.playing$,()=>{this.logPlaying()}),i(bd(e,{forceInterval:this.config.watchCoverageInterval,watchCoverageTimeoutFix:this.config.watchCoverageTimeoutFix}),s=>{var y,S,T,N;let d=e.info.isLive$.getValue(),v=e.info.atLiveEdge$.getValue(),g={start:parseFloat(s.from.toFixed(3)),end:parseFloat(s.to.toFixed(3))};if(v){let U=(y=e.info.liveLatency$.getValue())!=null?y:0,P=(T=(S=e.info.currentBuffer$.getValue())==null?void 0:S.end)!=null?T:0,q=(N=e.info.liveBufferTime$.getValue())!=null?N:0,se=Math.round((U-(P-q))*1e3),ue=Math.round(U*1e3);se&&ue&&(g.latency=se,g.bufferLatency=ue)}d?this.logWatchCoverageLive(g):this.logWatchCoverageRecord(g)});let o;i(e.info.isStalled$,s=>{s?o=(0,b.now)():((0,b.isNonNullable)(o)&&this.logEmptyBuffer({duration:(0,b.now)()-o}),o=void 0)});let n=!1;r.add(e.events.fatalError$.pipe((0,b.once)()).subscribe(()=>n=!0)),i(e.events.willStop$,()=>{if(e.info.isStalled$.getValue()){let d=(0,b.isNonNullable)(o)?(0,b.now)()-o:void 0;this.logCloseAtEmptyBuffer({duration:d!=null?d:0}),o=void 0}else n||this.logActionStop()}),i(e.events.managedError$,({id:s})=>{this.logError({fatal:!1,errorType:s})}),i(e.events.fatalError$,({id:s})=>{this.logError({fatal:!0,errorType:s})});let c,l,f=!1;i(e.events.firstBytes$,s=>{c=(0,b.now)(),this.logFirstBytes({time:s})}),i(e.events.willStart$,()=>l=(0,b.now)()),i(e.info.currentBuffer$,s=>{!f&&s&&s.end-s.start>0&&(0,b.isNonNullable)(c)&&(this.logPlayerReady({duration:(0,b.now)()-c}),f=!0)}),i(e.events.firstFrame$,()=>{(0,b.isNonNullable)(c)&&!f&&(this.logPlayerReady({duration:(0,b.now)()-c}),f=!0),(0,b.isNonNullable)(l)&&this.logFirstFrame({time:(0,b.now)()-l})});let p;i(e.info.currentVideoStream$,s=>{s&&(p&&s.id!==p&&this.logTrackSwitch(s),p=s.id)});let h;i(e.info.currentAudioStream$,s=>{s&&(h&&s.id!==h&&this.logTrackSwitch(s),h=s.id)}),i(e.info.atLiveEdge$,s=>this.updateContext({liveEdge:s})),i((0,b.combine)({muted:e.info.muted$,volume:e.info.volume$}),({muted:s,volume:d})=>this.updateContext({audible:!s&&d>0})),i(e.info.currentQuality$,s=>{let d=pd(s);this.updateContext({quality:d}),d&&this.logQuality(d)}),i(e.info.isAutoQualityEnabled$,s=>this.updateContext({autoQuality:s})),i(e.info.currentFormat$,s=>this.updateContext({contentType:hd(s)})),i(e.info.currentPlaybackRate$,s=>this.updateContext({rate:s})),i(e.info.is3DVideo$,s=>this.updateContext({is3d:s}));let a;return i(e.info.hostname$,s=>{let d=a!==void 0&&a!==s;this.updateContext({cdnHostname:s,failover:d}),d&&this.logFailover(s),a=s}),i(e.info.throughputEstimation$,s=>this.updateContext({downloadSpeed:s})),i(e.info.httpConnectionType$,s=>{this.statContext.firstConnectionType||this.updateContext({firstConnectionType:wo(s)}),this.updateContext({connectionType:wo(s)})}),i(e.info.httpConnectionReused$,s=>{(0,b.isNullable)(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:s}),this.updateContext({connectionReused:s})}),i(e.info.surface$,s=>{this.uiEvents||this.updateContext({mode:xo(s,this.statContext.isPreviewPlayerView)})}),i((0,b.combine)({current:e.info.currentTextTrack$,available:e.info.availableTextTracks$}),({current:s,available:d})=>{let v=d.find(({id:y})=>y===s),g=v&&(v.isAuto?`${v.language}_auto`:v.language);this.updateContext({subtitles:g==null?void 0:g.split(".")[0]})}),this.player=e,this.uiEvents&&this.attachToUi(this.uiEvents),this.resubscribeBeforeunload(),this.subscription.add(r),r}attachToUi(e){this.uiEvents=e;let{subscription:r,subscribe:i}=Oo();if(!this.player)return r;i(e.actionRewind$,()=>{this.player&&(this.resetViewSession(),this.logActionPlay({position:this.player.info.position$.getValue()}))}),i(e.actionSeek$,this.seekAction$);let{surface$:o}=lr(this.uiEvents,i,this.player);return i(o,n=>{this.updateContext({mode:xo(n,this.statContext.isPreviewPlayerView)})}),i(e.actionSetSubtitle$,n=>this.updateContext({subtitles:n==null?void 0:n.split(".")[0]})),i(e.nextMovie$,n=>this.logNextMovie(n)),this.resubscribeBeforeunload(),this.subscription.add(r),r}attachToAds(e){let{subscription:r,subscribe:i}=Oo();return i(e.slotRequested$,()=>this.logAdSlotRequest()),i(e.started$,o=>this.logAdStarted(o)),i(e.paused$,()=>this.logAdPaused()),i(e.resumed$,()=>this.logAdResumed()),i(e.ended$,()=>this.logAdEnded()),i(e.skipped$,()=>this.logAdSkipped()),i(e.clicked$,()=>this.logAdClicked()),i(e.error$,o=>this.logError({errorType:o,fatal:!1})),this.resubscribeBeforeunload(),this.subscription.add(r),r}attachToInteractive(e){let{subscription:r,subscribe:i}=Oo();return i(e.click$,o=>this.logInterfaceClick(o)),i(e.nextMovie$,o=>this.logNextMovie(o)),this.resubscribeBeforeunload(),this.subscription.add(r),r}authorize(e){return this.api.authorize(e)}pause(){this.logger.pause(),this.oneStatDebugLog({message:"paused"})}resume(){this.logger.resume(),this.oneStatDebugLog({message:"resumed"})}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.oneStatDebugLog({message:"VSID reset"}),ce.generateVSID()}getDeviceId(){return this.deviceId}setFieldBlacklist(){}logInited(){}logReady(e){this.log({operation:"player_ready",param:String(e.time)})}logStarted(...e){this.logActionPlay(...e)}logPlay(){this.log({operation:"play_toggle"})}logPlaying(){this.log({operation:"playing"})}logPause(e){this.log({operation:"pause",param:String(Math.round(e.position))})}logSeek(e){this.log({operation:"seek",param:e.action,time:e.time})}logFirstBytes(e){this.log({operation:"first_bytes",param:String(e.time)})}logFirstFrame(e){this.log({operation:"first_frame",param:String(e.time)})}logError(e){this.log({operation:"content_error",param:`${e.fatal?"fatal":"recoverable"}_${e.errorType}`})}logWatchCoverageRecord(e){this.log({operation:"watch_coverage_record",param:`${e.start}-${e.end}`},{in_history:this.statContext.inHistory?1:void 0})}logWatchCoverageLive(e){var n,c;let r=(c=(n=this.timeSynchronisation)==null?void 0:n.getOffset())!=null?c:0,i=e.start+r,o=e.end+r;this.log({operation:"watch_coverage_live",param:`${i}-${o}`},{in_history:this.statContext.inHistory?1:void 0,latency:e.latency,buffer_latency:e.bufferLatency})}logEmptyBuffer(e){this.log({operation:"empty_buffer",param:String(e.duration)})}logDownloadSpeed(){}logAdSlotRequest(){this.log({operation:"adv",param:"slot_request"})}logAdStarted(e){this.log({operation:"adv",param:e})}logAdPaused(){this.log({operation:"adv",param:"pause"})}logAdResumed(){this.log({operation:"adv",param:"resume"})}logAdEnded(){this.log({operation:"adv",param:"ended"})}logAdSkipped(){this.log({operation:"adv",param:"skip"})}logAdClicked(){this.log({operation:"adv",param:"click"})}logInterfaceClick(e){this.log({operation:"player_interface_click",param:e})}logNextMovie(e){this.log({operation:"next_movie",param:String(e)})}subscribe(){this.resubscribeBeforeunload();let e=window.navigator.connection;e&&"onchange"in e&&"effectiveType"in e&&this.subscription.add((0,b.merge)((0,b.fromEvent)(e,"change"),(0,b.observableFrom)(["init"])).subscribe(()=>this.updateContext({network:vd(e.effectiveType)}))),this.config.debugLog&&this.debugLogger.log$.subscribe(r=>{console.debug("%c stat ","background:#fa6470;",`component: ${r.component}.`,r.message)})}resubscribeBeforeunload(){var e;(e=this.beforeunloadSubscription)==null||e.unsubscribe(),this.beforeunloadSubscription=(0,b.fromEvent)(window,"beforeunload").subscribe(()=>this.logger.flush({wantBeacon:!0,clearStorage:this.config.clearStorageAtUnload})),this.subscription.add(this.beforeunloadSubscription)}logPlayerReady(e){this.log({operation:"player_ready",param:String(Math.round(e.duration))})}logActionPlay(e){this.log({operation:"action_play",param:String(Math.round(e.position))})}logActionPlayInteractive(){this.statContext.projectId&&this.log({operation:"action_play_interactive",param:String(this.statContext.movieId)},{vid:this.statContext.projectId})}logFailover(e){this.log({operation:"failover",param:e})}logCloseAtEmptyBuffer(e){this.log({operation:"close_at_empty_buffer",param:String(Math.round(e.duration))})}logActionStop(){this.log({operation:"action_stop"})}logTrackSwitch(e){this.log({operation:"track_switch",param:e.id})}logQuality(e){this.log({operation:"quality",param:e})}log(e,r={}){if(this.disabled){this.oneStatDebugLog({message:`operation ${e.operation} but statistics is disabled`});return}if((0,Co.default)(this.config.disabledOperations,e.operation)){this.oneStatDebugLog({message:`operation ${e.operation} but it is disabled`});return}this.oneStatDebugLog({message:`operation ${e.operation} ${e.param}`});let i=this.createLogItem(e,r);this.logger.log(i)}createLogItem({operation:e,param:r,time:i},o={}){var d,v;let n=(v=(d=this.timeSynchronisation)==null?void 0:d.now())!=null?v:(0,b.now)(),c=this.vsid$.getValue();(0,b.assertNonNullable)(c);let l=this.isid$.getValue(),f=e==="empty_buffer"||e==="close_at_empty_buffer"?this.statContext.connectionType:this.statContext.firstConnectionType,p=this.statContext.firstConnectionReused,h,a;if(this.isEmbed||this.statContext.place==="embed"){h=this.embedParent;let g=[...new URLSearchParams(location.search).entries()].filter(([y,S])=>(0,Co.default)(this.config.embedUrlParams,y));a=new URLSearchParams(g).toString()}else if(this.statContext.place==="direct"){let g=this.statContext.refDomain||document.referrer;g&&Na(URL,g)?h=new URL(g).hostname:h=g,a=location.href.substring(0,1024)}let s={vsid:c,isid:l,vid:this.statContext.movieId,uid:this.zenUid$.getValue(),ct:this.statContext.contentType,place:this.isEmbed?"embed":this.statContext.place,quality:this.statContext.quality,cdn_host:this.statContext.cdnHostname,stat_type:this.statContext.autoplay===!0?"auto":this.statContext.autoplay===!1?"":void 0,param:r,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode,connection_type:f,connection_reused:p===!0?1:p===!1?0:void 0,cached_data:this.statContext.cached===!0?1:this.statContext.cached===!1?0:void 0,live:this.statContext.liveEdge?1:void 0,muted:this.statContext.audible===!1?1:void 0,mode:this.statContext.mode,subtitles:this.statContext.subtitles,download_speed:this.statContext.downloadSpeed,manual_quality:this.statContext.autoQuality?void 0:1,ref_domain:h,direct_url:a,rate:this.statContext.rate===1||(0,b.isNullable)(this.statContext.rate)?void 0:this.statContext.rate.toFixed(2),view_360:this.statContext.is3d?1:void 0,aid:this.statContext.albumId,vk_playlist_id:this.statContext.vkPlaylistId,...o};for(let g of this.config.disabledCustomFields)delete s[g];return{operation:e,type:1,time:i,network:this.statContext.network,timestamp:n,custom:s}}};var Pr={};Fo(Pr,{ActionSeekType:()=>pr,ThinOneStat:()=>Sr,VERSION:()=>V});var Kd=C(wd(),1),Qd=C(ge(),1),m=require("@vkontakte/videoplayer-shared/es2018"),X=require("@vkontakte/videoplayer-core/es2018");var Od=require("@vkontakte/videoplayer-shared/es2018");var qo=(i=>(i.AUTO="auto",i.AUTO_POOR="auto_poor",i.AUTO_RICH="auto_rich",i))(qo||{});var pr=(l=>(l.SLIDER="slider",l.DOUBLE_TAP="double_tap",l.TIME_CODE="time_code",l.EPISODE="episode",l.REWIND="rewind",l.LIVE="live",l.UNKNOWN="unknown",l))(pr||{});var Ad="CIOPGQJGDIHBABABA",Ro={prod:"https://api.ok.ru",vk_alias:"https://api.mycdn.me",videotest:"https://videotestapi.ok.ru/api",test:"https://apitest.ok.ru",okcdn:"https://api.okcdn.ru",auto:""};var fI={apiKey:Ad,apiEnv:"okcdn",apiBaseUrl:null,requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageHeartbeatInterval:30,synchronizeTime:!0,useBeacon:!1,alwaysSendDesktop:!1,watchedNFirstTvtLog:1e3,watchedNDefaultTargetDuration:1e4},Cd=t=>(0,Od.fillWithDefault)(t,fI);var ko=C(io(),1),Y=require("@vkontakte/videoplayer-shared/es2018");var hr=class{constructor(e){this.params=e,this.authorized$=new Y.ValueSubject(!1),this.consequentAuthErrors=0}async authorize(e){return this.authToken=e!=null?e:await this.refreshAuthToken(),this.authorizeWithBackoff()}logBeacon(e){let r="log.logUvStat",i=this.createLogParams(e),o=this.sessionKey;if(!o)return;this.params.apiTransport.sendBeacon(r,i,o)||this.logRequest(e).catch(()=>{})}async logRequest(e){var l;let r="log.logUvStat",i=this.createLogParams(e),o={},n=(l=this.sessionKey)!=null?l:await this.authorizeWithBackoff();if(!n)return;let c=async(f,p=this.params.config.requestRetryCount)=>{try{return await this.params.apiTransport.sendRequest(r,i,n,o)}catch(h){if(!h||!("error_code"in h)){this.params.error$.next({id:"logRequestUnknown",category:Y.ErrorCategory.NETWORK,message:`Unknown ${r} error`,thrown:h});return}let a=h==null?void 0:h.error_code;switch(a){case 102:case 103:case 104:return this.authorized$.next(!1),this.sessionKey=await this.authorizeWithBackoff(),p>0?c(f,p-1):void 0;case 401:return this.authorized$.next(!1),this.authToken=await this.refreshAuthToken(),this.sessionKey=await this.authorizeWithBackoff(),p>0?c(f,p-1):void 0;default:{this.params.error$.next({id:`LogRequest#${a}`,category:Y.ErrorCategory.EXTERNAL_API,message:`${r} error`,data:h});return}}}};return c(e)}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}async refreshAuthToken(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=(0,ko.default)(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise}createLogParams(e){return{collector:"ok.mobile.apps.video",uv_stat_data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${V}`,platform:e[0].platform,product:e[0].product,events:e})}}authorizeWithBackoff(){if(!this.consequentAuthErrors)return this.doAuthorize();let e=(0,Y.getExponentialDelay)(this.consequentAuthErrors);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(async()=>{try{let i=await this.doAuthorize();r(i)}catch(i){this.params.error$.next({id:"AuthorizeBackoff",category:Y.ErrorCategory.NETWORK,message:"Otherwise unhandled error in authorization",thrown:i})}finally{this.backoffTimeoutId=0}},e))})}doAuthorize(){if(this.authorizePromise)return this.authorizePromise;this.sessionKey=void 0,this.authorized$.next(!1);let e="auth.anonymLogin",r={session_data:{version:2,device_id:this.params.deviceId,client_version:V.split("-")[0],client_type:"SDK_JS"}};return this.authToken!==void 0&&(r.session_data.auth_token=this.authToken,r.session_data.version=3),this.authorizePromise=(0,ko.default)(this.params.apiTransport.sendRequest(e,r).then(i=>{var o;return(!i||!i.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:Y.ErrorCategory.EXTERNAL_API,message:"No session key",data:i}),this.sessionKey=(o=i==null?void 0:i.session_key)!=null?o:void 0,this.sessionKey}).catch(async i=>{this.sessionKey=void 0;let o=i==null?void 0:i.error_code;switch(o){case 401:return this.authToken=await this.refreshAuthToken(),this.authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:Y.ErrorCategory.EXTERNAL_API,message:"authorize error",data:i}):this.params.error$.next({id:"AuthorizeUnknown",category:Y.ErrorCategory.NETWORK,message:"authorize error",thrown:i})}),()=>{this.authorizePromise=void 0,this.consequentAuthErrors=this.sessionKey?0:this.consequentAuthErrors+1,this.authorized$.next(this.sessionKey!==void 0)}),this.authorizePromise}};var qd=C(ge(),1);var Rd=C(Fe(),1),ae=require("@vkontakte/videoplayer-shared/es2018");var vr=class{constructor(e){var r;this.params=e,this.apiKey=e.config.apiKey,this.apiEnv=e.config.apiEnv,this.apiBaseUrl=(r=e.config.apiBaseUrl)!=null?r:Ro[this.apiEnv],this.timeSynchronisation=e.timeSynchronisation,this.isApiBaseUrlFetched=!1}sendBeacon(e,r,i){if(!window.Blob||!window.navigator.sendBeacon)return!1;let o=this.prepareQueryParams({method:e,queryParams:r,sessionKey:i}),n=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,n)}catch(c){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:ae.ErrorCategory.NETWORK,message:"Unhandled beacon error",thrown:c,data:{method:e,params:r}})}return!1}async sendRequest(e,r,i,o){let n=(0,ae.now)(),c=l=>{if(l instanceof TypeError&&(0,qd.default)(["Failed to fetch","NetworkError when attempting to fetch resource."],l.message)){this.params.error$.next({id:"Network",category:ae.ErrorCategory.NETWORK,message:"Request failed",thrown:l});return}this.params.error$.next({id:"ThinOneStat:ApiTransport:sendRequest",category:ae.ErrorCategory.NETWORK,message:"Unhandled request error",thrown:l,data:{method:e,params:r,sessionKey:i,time:(0,ae.now)()-n}})};return this.apiBaseUrl=await this.resolveApiBaseUrl(),Ue(`${this.apiBaseUrl}/fb.do`,{method:"post",headers:{"Content-type":"application/x-www-form-urlencoded",...o},body:this.prepareQueryParams({method:e,queryParams:r,sessionKey:i})}).then(l=>{var a,s;let f=Number(l.headers.get("content-length"))===0,p=new Date((a=l.headers.get("date"))!=null?a:"").getTime(),h=(0,ae.now)()-n;if(isFinite(p)&&((s=this.timeSynchronisation)==null||s.addServerTime(p,h)),!f)return l.json().then(d=>Object.prototype.hasOwnProperty.call(d,"error_msg")?Promise.reject(d):d,c)},c)}async resolveApiBaseUrl(){var e;if(this.apiEnv!=="auto"||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{let r=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=await(await Ue(r,{method:"GET",mode:"cors",cache:"no-cache"})).json(),n=(e=o==null?void 0:o.Answer[0])==null?void 0:e.data;if(!n)throw new Error("Wrong DNS response");return n}catch(r){return this.params.error$.next({id:"ThinOneStat:ApiTransport:resolveApiBaseUrl",category:ae.ErrorCategory.NETWORK,message:"Unhandled resolve api base url error",thrown:r}),Ro.vk_alias}finally{this.isApiBaseUrlFetched=!0}}prepareQueryParams(e){let r=new URLSearchParams({format:"JSON",method:e.method,application_key:this.apiKey});return e.sessionKey!==void 0&&r.append("session_key",e.sessionKey),(0,Rd.default)(e.queryParams).forEach(([i,o])=>r.append(i,typeof o=="string"?o:JSON.stringify(o))),r}};var kd=C(ge(),1),Ld=C(Fe(),1),B=require("@vkontakte/videoplayer-shared/es2018"),gr="thinonestat_events",Lo=t=>e=>e.client_time+t>=(0,B.now)(),mr=class{constructor(e){this.unsaltedStorage=[];this.isPaused=!1;this.isUrgent=e=>{let{event_name:r}=e;return(0,kd.default)(["watch_coverage","watch_coverage_live","watched_n","playback_started"],r)};this.params=e,this.api=e.api,this.error$=e.error$,this.userSalt=e.userSalt,this.loggerDebugLog=e.debugLogger.createComponentLog("stat logger"),this.firstFlush=(0,B.debounceFn)(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});let r=B.safeStorage.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=(0,B.debounceFn)(()=>this.safeFlush(),this.params.config.flushDebounceTime,{maxWait:r}),this.subscription=this.api.authorized$.subscribe(i=>{i&&this.debouncedFlush()}),this.housekeepStorage()}safeFlush(){try{this.flush()}catch(e){this.error$.next({id:"LoggerError",category:B.ErrorCategory.WTF,message:String(e)||"Unknown logger error",thrown:e})}}readFromStorage(){let e=B.safeStorage.get(gr);try{return e?JSON.parse(e):{}}catch(r){}return{}}addToStorage(e){var n;if(!this.userSalt){this.unsaltedStorage.push(e);return}let r=this.readFromStorage(),o=((n=r[this.userSalt])!=null?n:[]).filter(Lo(this.params.config.storageExpiration));B.safeStorage.set(gr,JSON.stringify({...r,[this.userSalt]:[...o,e]}))}getFromStorage(){var i;return this.userSalt?((i=this.readFromStorage()[this.userSalt])!=null?i:[]).filter(Lo(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}let e=this.readFromStorage();delete e[this.userSalt],B.safeStorage.set(gr,JSON.stringify(e))}housekeepStorage(){let e=this.readFromStorage();for(let[r,i]of(0,Ld.default)(e)){let o=i.filter(Lo(this.params.config.storageExpiration));o.length?e[r]=o:delete e[r],this.loggerDebugLog({message:`${i.length} retrieved from storage, ${o.length} of them actual`})}B.safeStorage.set(gr,JSON.stringify(e))}log(e){this.addToStorage(e),!this.isPaused&&(this.isUrgent(e)?this.flush():this.lastVsid!==e.vsid?this.firstFlush():this.debouncedFlush(),this.lastVsid=e.vsid)}flush({wantBeacon:e,clearStorage:r}={wantBeacon:!1,clearStorage:!0}){let i=this.getFromStorage();i.length!==0&&(this.api.authorized$.getValue()?(e&&this.params.config.useBeacon?(this.loggerDebugLog({message:`Flushing ${i.length} events through beacon`}),this.api.logBeacon(i)):(this.loggerDebugLog({message:`Flushing ${i.length} events`}),this.api.logRequest(i)),r&&this.markStorageSent()):this.api.authorize(),this.firstFlush.cancel(),this.debouncedFlush.cancel())}pause(){this.isPaused=!0,this.debouncedFlush.cancel()}resume(){this.isPaused=!1,this.debouncedFlush()}destroy(){this.subscription.unsubscribe(),this.firstFlush.cancel(),this.debouncedFlush.cancel()}};function No(){let t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),e=new Array(36),r=0,i,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?e[o]="-":o===14?e[o]="4":(r<=2&&(r=33554432+Math.random()*16777216|0),i=r&15,r=r>>4,e[o]=t[o===19?i&3|8:i]);return e.join("")}var br=class{constructor(e){this.offset=void 0;this.offset=e}getOffset(){var e;return(e=this.offset)!=null?e:0}setOffset(e){this.offset=e}now(){var e;return Date.now()+((e=this.offset)!=null?e:0)}date(e=new Date){var r;return e.setTime(e.getTime()+((r=this.offset)!=null?r:0)),e}addServerTime(e,r){let i=Date.now(),o=e-i-r/2;if(Math.abs(o)<1e3){this.offset=0;return}this.offset===void 0?this.offset=Math.round(o):this.offset=Math.round(.2*o+(1-.2)*this.offset)}};var $o=require("@vkontakte/videoplayer-core/es2018"),E=require("@vkontakte/videoplayer-shared/es2018"),Nd=(t,e,r)=>new E.Observable(i=>{let o=new E.Subscription,n=new E.ValueSubject(void 0),c;o.add(t.info.isLive$.pipe((0,E.filterChanged)()).subscribe(j=>{c&&(c.unsubscribe(),n.next(void 0)),j?c=t.info.liveTime$.pipe((0,E.filterChanged)()).subscribe(n):c=t.info.position$.subscribe(n),o.add(c)}));let{playing$:l,paused$:f,ended$:p,looped$:h}=t.events,a=t.events.willSeek$.pipe((0,E.filter)(()=>t.info.playbackState$.getValue()===$o.PlaybackState.PLAYING)),s=t.events.seeked$.pipe((0,E.filter)(()=>t.info.playbackState$.getValue()===$o.PlaybackState.PLAYING)),d=!1,v=new E.Subject;o.add(a.subscribe(()=>{d||v.next(),d=!0})).add(s.subscribe(()=>d=!1));let g=(0,E.merge)((0,E.fromEvent)(window,"beforeunload"),t.events.willDestruct$),y,S=()=>y=n.getValue(),T=()=>{let j=n.getValue();(0,E.isNullable)(y)||(0,E.isNullable)(j)||y===j||(i.next({from:y,to:j}),y=void 0)},N=new E.Subject,U=new E.Subject,P=(0,E.merge)(l,v,N),q=(0,E.merge)(f,s,g,p,h,U),se=e.started$&&e.ended$?(0,E.merge)(P,e.ended$):P,ue=e.started$&&e.ended$?(0,E.merge)(q,e.started$):q;if(o.add(se.subscribe(S)).add(ue.subscribe(T)),r.heartbeatInterval&&isFinite(r.heartbeatInterval)){let j=[],wr=r.heartbeatInterval*1e3,ef=()=>{U.next(),N.next()};o.add(se.subscribe(()=>{let xr=window.setTimeout(ef,wr);j.push(xr)})).add(ue.subscribe(()=>{j.forEach(xr=>{window.clearTimeout(xr)}),j=[]}))}return o});var $d=require("@vkontakte/videoplayer-core/es2018"),yr=require("@vkontakte/videoplayer-shared/es2018"),Dd=(t,e)=>new yr.Observable(r=>{let i=new $d.Subscription,o=0;return i.add((0,yr.merge)(t.info.position$,t.info.liveTime$).subscribe(()=>{let n=e.getTotalViewTime();if(n>o){let c=e.firstTvtLog>o&&e.firstTvtLog<=n,l=Math.floor(n/e.targetDuration)>Math.floor(o/e.targetDuration);(c||l)&&(o=n,r.next({target_duration:e.targetDuration,current_tvt:n}))}})),i});var Md=require("@vkontakte/videoplayer-core/es2018"),Pe=require("@vkontakte/videoplayer-shared/es2018"),Vd=t=>new Pe.Observable(e=>{let r=new Md.Subscription,i={maxBytesThreshold:10*1024*1024,minBytesThreshold:100*1024,maxTimeWindow:1e4,minTimeWindow:2e3},o={bytes:0,startTime:0,lastEmitTime:0,timeoutId:0},n=()=>{o.timeoutId&&((0,Pe.getWindow)().clearTimeout(o.timeoutId),o.timeoutId=null)},c=()=>{o.bytes=0,o.startTime=0,o.lastEmitTime=0,n()},l=h=>{if(o.bytes<i.minBytesThreshold||h-o.lastEmitTime<i.minTimeWindow&&o.lastEmitTime>0)return!1;let s=o.startTime>0?h-o.startTime:0,d=o.bytes>=i.maxBytesThreshold,v=s>=i.maxTimeWindow;return d||v},f=(h=!1)=>{let a=Date.now();if(!h&&!l(a))return;n();let s=o.startTime>0?a-o.startTime:Math.max(i.minTimeWindow,1),d=o.bytes/(s/1e3);e.next({download_bytes:Math.round(o.bytes),download_speed:Math.round(d)}),o.lastEmitTime=a,c()},p=()=>{if(n(),o.startTime>0&&o.bytes>=i.minBytesThreshold){let a=Date.now()-o.startTime,s=i.maxTimeWindow-a;s>100?o.timeoutId=(0,Pe.getWindow)().setTimeout(()=>{o.timeoutId=null,f()},s):s>0&&f()}};return r.add(t.info.httpDownloadMetrics$.pipe((0,Pe.filter)(h=>h!==void 0)).subscribe(h=>{let a=Date.now();o.startTime===0&&(o.startTime=a),o.bytes+=h.bytes,l(a)?f():p()})),r.add(()=>{if(n(),o.bytes>0){let h=Date.now(),a=o.startTime>0?h-o.startTime:i.minTimeWindow,s=o.bytes/(a/1e3);e.next({download_bytes:Math.round(o.bytes),download_speed:Math.round(s)})}c()}),r});var Te=require("@vkontakte/videoplayer-shared/es2018"),Fd=t=>new Te.Observable(e=>{let r=new Te.Subscription,i=0,o=1,n=0,c=!1,l=!1,f=()=>{if(!c)return;let P=Date.now();n+=(P-i)*o,i=P},p=()=>{(!c||l)&&(i=Date.now(),c=!0,l=!1)},h=()=>{c&&(f(),c=!1)},a=()=>{c&&(f(),c=!1,l=!0)},s=P=>{c&&f(),o=P,i=Date.now()},{started$:d,playing$:v,paused$:g,willSeek$:y,ended$:S,willDestruct$:T}=t.events,{currentPlaybackRate$:N}=t.info;r.add(y.subscribe(a)).add((0,Te.merge)(d,v).subscribe(p)).add((0,Te.merge)(g,S,T).subscribe(h)).add(N.subscribe(s));let U=()=>{let P=n;return c&&(P+=(Date.now()-i)*o),P};return e.next(U),r});var Do=require("@vkontakte/videoplayer-shared/es2018"),I=require("@vkontakte/videoplayer-core/es2018");var Mo=t=>t&&{[I.HttpConnectionType.HTTP1]:"http1",[I.HttpConnectionType.HTTP2]:"http2",[I.HttpConnectionType.QUIC]:"http3"}[t],vt=t=>{if(t!==void 0)switch(t){case I.VideoFormat.MPEG:return"MP4";case I.VideoFormat.DASH:case I.VideoFormat.DASH_LIVE:return"DASH";case I.VideoFormat.DASH_SEP:return"DASH_SEP";case I.VideoFormat.DASH_ONDEMAND:return"ONDEMAND_DASH";case I.VideoFormat.HLS_ONDEMAND:return"ONDEMAND_HLS";case I.VideoFormat.HLS:case I.VideoFormat.HLS_LIVE:return"HLS";case I.VideoFormat.HLS_FMP4:return"HLS_FMP4";case I.VideoFormat.DASH_WEBM:case I.VideoFormat.DASH_LIVE_WEBM:return"WEBM";case I.VideoFormat.DASH_LIVE_CMAF:return"ONDEMAND_DASH_LIVE";case I.VideoFormat.HLS_LIVE_CMAF:return"ONDEMAND_HLS_LIVE";case I.VideoFormat.WEB_RTC_LIVE:return"WEBRTC";case I.VideoFormat.DASH_WEBM_AV1:return"AV1";case I.VideoFormat.DASH_STREAMS:return"MULTI_DASH";default:return(0,Do.assertNever)(t)}},J=t=>{if(t!==void 0)switch(t){case I.VideoQuality.Q_144P:return"144p";case I.VideoQuality.Q_240P:return"240p";case I.VideoQuality.Q_360P:return"360p";case I.VideoQuality.Q_480P:return"480p";case I.VideoQuality.Q_720P:return"720p";case I.VideoQuality.Q_1080P:return"1080p";case I.VideoQuality.Q_1440P:return"1440p";case I.VideoQuality.Q_2160P:return"2160p";case I.VideoQuality.INVARIANT:case I.VideoQuality.Q_576P:case I.VideoQuality.Q_4320P:return"UNKNOWN";default:return(0,Do.assertNever)(t)}},Bd=t=>{if(t!==void 0)switch(t){case"MP4":case"ONDEMAND_DASH":case"ONDEMAND_DASH_LIVE":case"ONDEMAND_HLS":case"ONDEMAND_HLS_LIVE":case"MULTI_DASH":case"WEBM":case"AV1":return"vod";case"DASH":case"HLS":case"HLS_FMP4":case"WEBRTC":return"live";default:return}},de=(t,e,r)=>{var i;if(t&&e)switch(t){case I.VideoFormat.MPEG:return r&&e[t]&&e[t][r];default:return(i=e[t])==null?void 0:i.url}},Ir=(t,e=!1)=>{if(e)return"minimal";switch(t){case void 0:case I.Surface.NONE:return;case I.Surface.INLINE:return"inline";case I.Surface.FULLSCREEN:return"fullscreen";case I.Surface.SECOND_SCREEN:return"chromecast";case I.Surface.PIP:return"pip_external"}},_r=t=>{switch(t){case void 0:return;case I.Surface.INVISIBLE:return"background";default:return"foreground"}};var Ud=C(Rt(),1);var jd=()=>(0,Ud.default)(Math.floor(Math.random()*2**64).toString(36),13,"0");var pI="_thin-one-stat_",Hd=`${pI}deviceId`,Wd=()=>{let t=new m.Subscription;return{subscription:t,subscribe:(e,r)=>{e&&t.add(e.subscribe(r))}}},Sr=class{constructor(e,r){this.debugLogger=new m.Logger;this.thinOneStatDebugLog=this.debugLogger.createComponentLog("ThinOneStat");this.eventNumber=1;this.playerSize={width:0,height:0};this.seekAction$=new m.ValueSubject("unknown");this.isid$=new m.ValueSubject(void 0);var f,p;this.statContext=e,this.config=Cd((f=r.config)!=null?f:{}),this.subscription=new m.Subscription,this.config.synchronizeTime&&(this.timeSynchronisation=new br);let i=new m.Subject,o=m.safeStorage.get(Hd);this.statContext.deviceId?this.deviceId=this.statContext.deviceId:o?this.deviceId=o:(this.deviceId=No(),m.safeStorage.set(Hd,this.deviceId)),this.statContext.targetDuration?this.targetDuration=this.statContext.targetDuration:this.targetDuration=this.config.watchedNDefaultTargetDuration,this.resetViewSession(),r.useIsid&&this.isid$.next((p=r.isid)!=null?p:jd());let n=new vr({error$:i,config:this.config,timeSynchronisation:this.timeSynchronisation});this.api=new hr({config:this.config,apiTransport:n,error$:i,deviceId:this.deviceId,refreshAuthToken:r.refreshAuthToken}),this.logger=new mr({config:this.config,debugLogger:this.debugLogger,api:this.api,error$:i,userSalt:r.userSalt});let{isEmbed:c,topOrigin:l}=(0,m.detectEmbed)();this.isEmbed=c,this.embedHostname=l?new URL(l).hostname:void 0}get vsid$(){return new m.ValueSubject(ce.getVSID())}authorize(e){return this.api.authorize(e)}updateContext(e){this.statContext={...this.statContext,...e}}attachTo(e,r){let i=new m.Subscription,o=(a,s)=>i.add(a.subscribe(s));o(Fd(e),a=>{this.getTotalViewTime=a}),o(e.info.isLive$,a=>this.isLive=a);let n;o((0,m.combine)({hostname:e.info.hostname$,connectionType:e.info.httpConnectionType$,connectionReused:e.info.httpConnectionReused$}).pipe((0,m.filter)(({hostname:a})=>a!==void 0),(0,m.filter)(({connectionType:a})=>a!==void 0),(0,m.filter)(({connectionReused:a})=>a!==void 0)),({hostname:a,connectionType:s,connectionReused:d})=>{if(n!==void 0&&n!==a){let g={cdn_host:a,connection_type:Mo(s),connection_reused:d,content_type:vt(e.info.currentFormat$.getValue())};this.logFailover(g)}this.cdnHostname=n=a}),o(e.info.httpConnectionType$,a=>{this.connectionType=Mo(a)}),o(e.info.httpConnectionReused$,a=>{this.connectionReused=a}),o(Nd(e,r,{heartbeatInterval:this.config.watchCoverageHeartbeatInterval}),a=>{let s=Math.round(a.from*1e3),d=Math.round(a.to*1e3),v={watch_interval:`${s}-${d}`,in_history:!!this.statContext.inHistory,content_type:vt(e.info.currentFormat$.getValue()),playback_quality:J(e.info.currentQuality$.getValue()),recom_info:this.statContext.recomInfo};if(!e.info.isLive$.getValue())this.logWatchCoverage(v);else{let y=e.info.atLiveEdge$.getValue();this.logWatchCoverageLive({...v,live:!!y})}}),o(Dd(e,{targetDuration:this.targetDuration,firstTvtLog:this.config.watchedNFirstTvtLog,getTotalViewTime:this.getTotalViewTime}),a=>{this.logWatchedN(a)}),o(e.events.willReady$,()=>{if(this.statContext.preload){let a=e.info.currentFormat$.getValue(),s=e.info.availableSources$.getValue(),d=e.info.currentBuffer$.getValue(),v=e.info.currentQuality$.getValue(),g={target_buffer_time:this.calcBufferTime(d),playback_url:de(a,s,v),playback_quality:J(v)};this.logPreloadStarted(g)}}),o(e.events.manifestRequested$,()=>{let a=e.info.currentFormat$.getValue(),s=e.info.availableSources$.getValue(),d=e.info.currentQuality$.getValue(),v={playback_url:de(a,s,d),cdn_host:this.cdnHostname,connection_type:this.connectionType,connection_reused:this.connectionReused};this.logManifestRequest(v)}),o(e.events.firstBytesManifest$,()=>{let a=e.info.currentFormat$.getValue(),s=e.info.availableSources$.getValue(),d=e.info.currentQuality$.getValue(),v={playback_url:de(a,s,d),cdn_host:this.cdnHostname,connection_type:this.connectionType,connection_reused:this.connectionReused};this.logFirstByteManifest(v)}),o(e.events.manifestReceived$,()=>{let a=e.info.currentFormat$.getValue(),s=e.info.availableSources$.getValue(),d=e.info.currentQuality$.getValue(),v={playback_url:de(a,s,d),cdn_host:this.cdnHostname,connection_type:this.connectionType,connection_reused:this.connectionReused};this.logManifestReceived(v)}),o(e.events.firstBytesRequested$,()=>{let a=e.info.currentFormat$.getValue(),s=e.info.availableSources$.getValue(),d=e.info.currentQuality$.getValue(),v={playback_url:de(a,s,d),cdn_host:this.cdnHostname,connection_type:this.connectionType,connection_reused:this.connectionReused};this.logFirstMediaRequest(v)}),o(e.events.firstBytesReceived$,()=>{let a=e.info.currentFormat$.getValue(),s=e.info.availableSources$.getValue(),d=e.info.currentQuality$.getValue(),v={playback_url:de(a,s,d),cdn_host:this.cdnHostname,connection_type:this.connectionType,connection_reused:this.connectionReused};this.logFirstByteMedia(v)}),o((0,m.merge)(e.events.willStart$,e.events.looped$),a=>{var v;a&&this.resetViewSession();let d={isid:this.isid$.getValue(),stream_profile:Bd(vt(e.info.currentFormat$.getValue())),dpi:96*X.clientChecker.display.pixelRatio,web_layout:this.statContext.isMobile||X.clientChecker.device.isMobile?"mobile":"desktop",preloaded:this.statContext.preload,navigation:this.statContext.navigation,recom_info:this.statContext.recomInfo};this.isEmbed&&(d.iframe_host=(v=this.embedHostname)!=null?v:"unknown"),this.logStartSession(d)}),o(e.events.started$,()=>{var q,se,ue,j;this.isStarted=!0;let a=e.info.currentBuffer$.getValue(),s=e.info.currentQuality$.getValue(),d=e.info.isAutoQualityEnabled$.getValue(),v=e.info.muted$.getValue(),g=e.info.volume$.getValue(),y=e.info.surface$.getValue(),S=e.info.availableTextTracks$.getValue(),T=e.info.currentTextTrack$.getValue(),N=e.info.currentAudioStream$.getValue(),U=e.info.currentPlaybackRate$.getValue(),P={playback_quality:J(s),user_quality:d?"auto":J(s),player_width:this.playerSize.width,player_height:this.playerSize.height,muted:v,sound_volume:Math.round(g*100),buffer_time:this.calcBufferTime(a),mode:Ir(y,this.statContext.isPreviewPlayerView),visibility:_r(y),subtitles_enabled:T?!!T:(q=this.currentSubtitle)==null?void 0:q.enabled,auto_subtitles:(j=(se=S.find(({id:wr})=>wr===T))==null?void 0:se.isAuto)!=null?j:(ue=this.currentSubtitle)==null?void 0:ue.auto,audio_track_lang:N==null?void 0:N.language,playback_rate:U,recom_info:this.statContext.recomInfo};this.logPlaybackStarted(P)}),o((0,m.merge)(e.events.willStart$,e.events.willResume$),()=>{this.logPlay()}),o(e.events.playing$,()=>{let a=e.info.currentBuffer$.getValue(),s={buffer_time:this.calcBufferTime(a)};this.logPlaying(s),this.wasPaused&&this.logResume()}),o(e.events.paused$,()=>{this.wasPaused=!0,this.logPause()}),o(e.events.willStop$,()=>{this.logStop()}),o((0,m.merge)(e.events.fetcherRecoverableError$,e.events.fatalError$),()=>{this.statContext.preload&&this.logPreloadError()});let c=a=>{switch(a){case m.ErrorCategory.NETWORK:return"network";case m.ErrorCategory.VIDEO_PIPELINE:return"video_pipeline";case m.ErrorCategory.EXTERNAL_API:return"external_api";case m.ErrorCategory.PARSER:return"parser";case m.ErrorCategory.DOM:return"dom";default:return"wtf"}},l=a=>m.ErrorCategory.FATAL===a?"critical":"informative";o(e.events.fetcherRecoverableError$,({id:a,category:s,data:d,message:v,httpCode:g,UVBackendErrorCode:y})=>{let S={error_severity:l(s),error_category:c(s),player_error_code:a,player_error_trace:d,http_error_code:g,uv_backend_error_code_subcode:y,error_message:v};this.logError(S)}),o(e.events.managedError$,({id:a,category:s,data:d,message:v})=>{let g={error_severity:l(s),error_category:c(s),player_error_code:a,player_error_trace:d,error_message:v};this.logError(g)}),o(e.events.fatalError$,({id:a,category:s,data:d,message:v})=>{let g={error_severity:"critical",error_category:c(s),player_error_code:a,player_error_trace:d,error_message:v};this.logError(g)}),o((0,m.combine)({connectionType:e.info.httpConnectionType$,connectionReused:e.info.httpConnectionReused$,connectionMetrics:e.info.httpConnectionMetrics$}).pipe((0,m.filter)(({connectionReused:a})=>a!==void 0),(0,m.filter)(({connectionMetrics:a})=>a!==void 0),(0,m.filterChanged)((a,s)=>a.connectionType===s.connectionType)),({connectionMetrics:a})=>{let s=e.info.currentFormat$.getValue(),d=e.info.availableSources$.getValue(),v=e.info.currentQuality$.getValue(),g=e.info.rttEstimation$.getValue(),y={playback_url:de(s,d,v),cdn_host:this.cdnHostname,connection_type:this.connectionType,connection_reused:this.connectionReused,rtt:g?Math.round(g):void 0,network_type:a==null?void 0:a.networkType,dns_resolve_time:a==null?void 0:a.dnsResolveTime,tcp_handshake_time:a==null?void 0:a.tcpHandshakeTime,tls_handshake_time:a==null?void 0:a.tlsHandshakeTime};this.logConnectionEstablished(y)}),o(Vd(e),a=>{this.logDownloadBytes(a)}),o(e.events.firstFrame$,()=>{this.logFirstVideoFrameDecoded()}),o(e.events.willSeek$,()=>{let a={seek_type:this.seekAction$.getValue()};this.logSeeking(a)}),o(e.events.seeked$,()=>{let a={seek_type:this.seekAction$.getValue()};this.logSeeked(a),this.seekAction$.next("unknown")}),o(e.info.isStalled$,a=>{let s=e.info.currentBuffer$.getValue(),d=this.calcBufferTime(s);a&&d&&d>0&&this.logBufferStarvation({buffer_time:d})}),o(e.info.currentBuffer$.pipe((0,m.filter)(a=>!!this.calcBufferTime(a)),(0,m.once)()),a=>{let s=this.calcBufferTime(a);if(this.statContext.preload){let d={buffer_time:s};this.logPreloadEnded(d)}this.logReady({buffer_time:s})});let f;o((0,m.combine)({videoStream:e.info.currentVideoStream$,audioStream:e.info.currentAudioStream$,quality:e.info.currentQuality$}).pipe((0,m.filter)(({videoStream:a,audioStream:s})=>a!==void 0&&s!==void 0),(0,m.filter)(({quality:a})=>a!==void 0)),({videoStream:a,audioStream:s,quality:d})=>{if(f!==d){let v=e.info.isAutoQualityEnabled$.getValue(),g=a==null?void 0:a.codec,y=s==null?void 0:s.codec,S={user_quality:v?"auto":J(d),playback_quality:J(d),download_quality:J(d),codec_info:g&&y?`${g},${y}`:void 0};f=d,this.logQualityChanged(S)}});let p,h;return o(e.info.surface$,a=>{let s=Ir(a,this.statContext.isPreviewPlayerView);s&&!this.uiEvents&&this.isStarted&&this.logModeChanged({mode:s}),h=_r(a),p!==h&&this.isStarted&&(p=_r(a),this.logVisibilityChanged({visibility:h}))}),o((0,m.combine)({muted:e.info.muted$,volume:e.info.volume$}),({muted:a,volume:s})=>{if(this.isStarted){let d={muted:a,sound_volume:Math.round(s*100)};this.logSoundChanged(d)}}),o(e.info.currentFormat$.pipe((0,m.filter)(a=>a!==void 0),(0,m.skip)(1)),a=>{let s={content_type:vt(a),cdn_host:this.cdnHostname,connection_type:this.connectionType,connection_reused:this.connectionReused};this.logContentTypeChange(s)}),o(e.info.currentAudioStream$.pipe((0,m.filter)(a=>a!==void 0),(0,m.skip)(1)),a=>{let s={audio_track_lang:a.language,codec_info:a.codec};this.logAudioTrackSwitched(s)}),o(e.info.currentVideoStream$.pipe((0,m.filter)(a=>a!==void 0),(0,m.skip)(1)),a=>{let s={hdr:a.hdr,codec_info:a.codec};this.logVideoTrackSwitched(s)}),this.player=e,this.resubscribeBeforeunload(),this.subscription.add(i),i}attachToUi(e){this.uiEvents=e;let{subscribe:r,subscription:i}=Wd();r(e.actionSeek$,this.seekAction$),r(e.playerSize$,({width:n,height:c})=>{n&&c&&(this.playerSize={width:n,height:c},this.logViewPortChanged({player_width:n,player_height:c}))}),r(e.isLoaderVisible$,n=>{n&&this.isStarted&&this.logShowLoader()}),r(e.actionSubtitlesSwitched$,n=>{if(this.currentSubtitle={...n},this.isStarted){let c={subtitles_enabled:n.enabled,subtitles_track_lang:n.lang,auto_subtitles:n.auto};this.logSubtitlesSwitched(c)}});let{surface$:o}=lr(this.uiEvents,r,this.player);return r(o,n=>{this.isStarted&&this.logModeChanged({mode:Ir(n)})}),r(e.actionQuality$,n=>{var h,a,s,d,v,g;let c=y=>(0,Qd.default)((0,Kd.default)(qo),y),l=(a=(h=this.player)==null?void 0:h.info.currentVideoStream$.getValue())==null?void 0:a.codec,f=(d=(s=this.player)==null?void 0:s.info.currentAudioStream$.getValue())==null?void 0:d.codec,p={user_quality:c(n)?"auto":J(n),playback_quality:J((v=this.player)==null?void 0:v.info.currentQuality$.getValue()),download_quality:J((g=this.player)==null?void 0:g.info.currentQuality$.getValue()),codec_info:l&&f?`${l},${f}`:void 0};this.logQualityChangeRequested(p)}),this.resubscribeBeforeunload(),this.subscription.add(i),i}attachToAds(e){let{subscription:r,subscribe:i}=Wd();return i(e.init$,o=>{let n={slot:o};this.logAdvConfiguration(n)}),i(e.slotRequested$,()=>{this.logAdvRequest()}),i(e.started$,o=>{let n={adv_section:o};this.logAdvBreakStarted(n)}),i(e.ended$,o=>{let n={adv_section:o};this.logAdvBreakEnded(n)}),i(e.error$,o=>{let n={error_message:o};this.logAdvError(n)}),this.resubscribeBeforeunload(),this.subscription.add(r),r}getDeviceId(){return this.deviceId}resetViewSession(){this.thinOneStatDebugLog({message:"VSID reset"}),ce.generateVSID(),this.eventNumber=0}destroy(){this.api.destroy()}calcBufferTime(e){var r,i;return e?Math.round(((r=e.end)!=null?r:0)-((i=e.start)!=null?i:0))*1e3:void 0}createRequiredParams(e){var n,c,l,f,p;let r=this.vsid$.getValue();(0,m.assertNonNullable)(r);let i=this.eventNumber++,o=((l=this.isLive?(n=this.player)==null?void 0:n.info.liveTime$.getValue():(c=this.player)==null?void 0:c.info.position$.getValue())!=null?l:0)*1e3;return{vsid:r,uv_movie_id:this.statContext.movieId,event_name:e,client_time:Date.now(),application:(f=this.statContext.application)!=null?f:`@vkontakte/videoplayer-statistics:${V}`,platform:(p=this.statContext.platform)!=null?p:`web:${this.statContext.isMobile||X.clientChecker.device.isMobile?"mobile":"desktop"}`,product:this.statContext.product,event_number:i,playback_position:o,current_tvt:this.getTotalViewTime(),cdn_host:this.cdnHostname}}createRequiredFatParams(){var e,r,i,o,n,c,l;return{stats_version:"2.1.1",browser:(e=this.statContext.browser)!=null?e:X.clientChecker.browser.current,browser_version:(r=this.statContext.browserVersion)!=null?r:String(X.clientChecker.browser.currentVersion),os:(i=this.statContext.os)!=null?i:X.clientChecker.device.os.name,os_version:(o=this.statContext.osVersion)!=null?o:X.clientChecker.device.os.version,device_type:(n=this.statContext.deviceType)!=null?n:this.statContext.isMobile||X.clientChecker.device.isMobile?"mobile":"desktop",device_manufacturer:(c=this.statContext.deviceManufacturer)!=null?c:X.clientChecker.device.details.vendor,device_model:(l=this.statContext.deviceModel)!=null?l:X.clientChecker.device.details.model,navigation:this.statContext.navigation}}log(e,r,i=!1){let o=this.createRequiredParams(e),n={};i&&(n=this.createRequiredFatParams()),this.logger.log({...o,...n,...r})}logWatchCoverage(e){this.log("watch_coverage",e,!0)}logWatchCoverageLive(e){this.log("watch_coverage_live",e,!0)}logWatchedN(e){this.log("watched_n",e,!0)}logStartSession(e){this.log("start_session",e,!0)}logPreloadStarted(e){this.log("preload_started",e)}logPreloadEnded(e){this.log("preload_ended",e)}logPreloadError(){this.log("preload_error")}logPlaybackStarted(e){this.log("playback_started",e,!0)}logPlay(){this.log("play")}logManifestRequest(e){this.log("manifest_request",e)}logFirstByteManifest(e){this.log("first_byte_manifest",e)}logFirstMediaRequest(e){this.log("first_media_request",e)}logFirstByteMedia(e){this.log("first_byte_media",e)}logManifestReceived(e){this.log("manifest_received",e)}logConnectionEstablished(e){this.log("connection_established",e)}logFirstVideoFrameDecoded(){this.log("first_video_frame_decoded")}logReady(e){this.log("ready",e)}logPlaying(e){this.log("playing",e)}logPause(){this.log("pause")}logResume(){this.log("resume")}logSeeking(e){this.log("seeking",e)}logSeeked(e){this.log("seeked",e)}logStop(){this.log("stop")}logBufferStarvation(e){this.log("buffer_starvation",e)}logShowLoader(){this.log("show_loader")}logQualityChangeRequested(e){this.log("quality_change_requested",e)}logQualityChanged(e){this.log("quality_changed",e)}logCdnHostChanged(e){this.log("cdn_host_changed",e)}logViewPortChanged(e){this.log("view_port_changed",e)}logModeChanged(e){this.log("mode_changed",e)}logVisibilityChanged(e){this.log("visibility_changed",e)}logAudioTrackSwitched(e){this.log("audio_track_switched",e)}logVideoTrackSwitched(e){this.log("video_track_switched",e)}logSubtitlesSwitched(e){this.log("subtitles_switched",e)}logSoundChanged(e){this.log("sound_changed",e)}logFailover(e){this.log("failover",e)}logContentTypeChange(e){this.log("content_type_change",e)}logError(e){this.log("error",e,!0)}logDownloadBytes(e){this.log("download_bytes",e)}logAdvConfiguration(e){this.log("adv_configuration",e)}logAdvRequest(){this.log("adv_request")}logAdvBreakStarted(e){this.log("adv_break_started",e)}logAdvBreakEnded(e){this.log("adv_break_ended",e)}logAdvError(e){this.log("adv_error",e)}resubscribeBeforeunload(){var e;(e=this.beforeunloadSubscription)==null||e.unsubscribe(),this.beforeunloadSubscription=(0,m.fromEvent)((0,m.getWindow)(),"beforeunload").subscribe(()=>{}),this.subscription.add(this.beforeunloadSubscription)}};var Vo={};var hI=(t,e={})=>{let i=e.timeout||1,o=performance.now();return O.setTimeout(()=>{t({get didTimeout(){return e.timeout?!1:performance.now()-o-1>i},timeRemaining(){return Math.max(0,1+(performance.now()-o))}})},1)},vI=t=>O.clearTimeout(t),Gd=t=>typeof t=="function"&&(t==null?void 0:t.toString().endsWith("{ [native code] }")),zd=!Gd(O.requestIdleCallback)||!Gd(O.cancelIdleCallback),Yd=zd?hI:O.requestIdleCallback,Jd=zd?vI:O.cancelIdleCallback;var gt=require("@vkontakte/videoplayer-core/es2018"),Zd=require("@vkontakte/videoplayer-shared/es2018");var Tr=class{constructor(){this.startTime=null;this.stopTime=null;this.accumulatedTime=0}get time(){return Math.floor(this.timeMs/1e3)}get timeMs(){var r;return this.startTime===null?0:((r=this.stopTime)!=null?r:this.now())-this.startTime-this.accumulatedTime}get isRunning(){return this.startTime!==null&&this.stopTime===null}start(){this.isRunning||(this.stopTime!==null?(this.accumulatedTime+=this.now()-this.stopTime,this.stopTime=null):this.startTime=this.now())}stop(){this.isRunning&&(this.stopTime=this.now())}reset(){this.startTime=null,this.stopTime=null,this.accumulatedTime=0}now(){return Date.now()}};var Xd=()=>window.Image?new Image:document.createElement("img");var Er=class{constructor(e){this.position=0;this.started=!1;this.heartbeatPixels=[];this.heartbeatLastTimeSent={};this.idleCallbackIds=[];this.stopwatch=new Tr;this.subscription=new gt.Subscription;this.params=e;let r=new Zd.Logger;this.log=r.createComponentLog("MediascopePixel")}attachTo(e){this.subscription.add(e.info.playbackState$.subscribe(r=>this.onPlaybackState(r))).add(e.info.position$.subscribe(r=>this.onPosition(r))).add(e.info.atLiveEdge$.subscribe(r=>this.isActiveLive=r)),this.subscription.add(e.events.willSeek$.subscribe(()=>this.onWillSeek())).add(e.events.seeked$.subscribe(()=>this.onSeeked())).add(e.events.ended$.subscribe(()=>this.onEnded()))}destroy(){this.stopwatch.reset(),this.subscription.unsubscribe(),window.clearTimeout(this.heartbeatFirstTimeoutId),this.idleCallbackIds.forEach(e=>Jd(e)),this.send("stop")}onPlaybackState(e){e===gt.PlaybackState.PLAYING?this.started?this.play():this.start():e===gt.PlaybackState.PAUSED&&this.pause()}start(){var i,o,n;this.started=!0,this.stopwatch.start(),this.send("start"),this.heartbeatPixels=this.prepareHeartbeatPixels(),this.heartbeatInterval=(i=this.heartbeatPixels[0])==null?void 0:i.interval;let e=(o=this.heartbeatPixels[0])==null?void 0:o.url,r=(n=this.heartbeatPixels[0])==null?void 0:n.delay;if(r!==void 0&&e)try{this.heartbeatFirstTimeoutId=window.setTimeout(()=>{this.sendHeartbeat(e)},r*1e3)}catch(c){this.log({message:c.message})}}play(){this.stopwatch.start(),this.send("resume")}pause(){this.stopwatch.stop(),this.send("pause")}onPosition(e){if(this.position=e,this.heartbeatInterval&&this.stopwatch.time!==0&&this.stopwatch.time%this.heartbeatInterval===0)for(let[r,{url:i}]of this.heartbeatPixels.entries())this.heartbeatLastTimeSent[r]!==this.stopwatch.time&&(this.heartbeatLastTimeSent[r]=this.stopwatch.time,this.sendHeartbeat(i))}onWillSeek(){this.started&&this.send("stop")}onSeeked(){this.started&&this.send("start")}onEnded(){this.stopwatch.stop(),this.send("stop")}validatePixels(e,r){return e==null?void 0:e.filter(i=>i.event===r.event&&r.keys.every(o=>!!i[o]))}getFrameTimestamp(){let e;if(this.isActiveLive){let r=Math.floor(Math.random()*25)+5;e=Date.now()/1e3-r}else e=this.position||0;return Math.floor(e)}getUTC(){return Math.floor(Date.now()/1e3)}prepareUrl(e){return e.replace("{@fts_fake_sec}",String(this.getFrameTimestamp())).replace("{@utc_sec}",String(this.getUTC())).split("&").filter(r=>!/={@[a-zA-Z_]+}/.test(r)).join("&")}preparePixels(e){return this.validatePixels(this.params.pixels,{event:e,keys:["url"]})}prepareHeartbeatPixels(){return this.validatePixels(this.params.pixels,{event:"heartbeat",keys:["url","interval"]})}call(e){try{this.idleCallbackIds.push(Yd(()=>Xd().src=this.prepareUrl(e)))}catch(r){this.log({message:r.message})}}send(e){let r=this.preparePixels(e);for(let{url:i}of r)this.call(i)}sendHeartbeat(e){this.call(e)}};
6
+ "use strict";var tf=Object.create;var mt=Object.defineProperty;var rf=Object.getOwnPropertyDescriptor;var of=Object.getOwnPropertyNames;var nf=Object.getPrototypeOf,af=Object.prototype.hasOwnProperty;var u=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Fo=(t,e)=>{for(var r in e)mt(t,r,{get:e[r],enumerable:!0})},Bo=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of of(e))!af.call(t,o)&&o!==r&&mt(t,o,{get:()=>e[o],enumerable:!(i=rf(e,o))||i.enumerable});return t};var C=(t,e,r)=>(r=t!=null?tf(nf(t)):{},Bo(e||!t||!t.__esModule?mt(r,"default",{value:t,enumerable:!0}):r,t)),sf=t=>Bo(mt({},"__esModule",{value:!0}),t);var x=u((Ar,Uo)=>{"use strict";var He=function(t){return t&&t.Math===Math&&t};Uo.exports=He(typeof globalThis=="object"&&globalThis)||He(typeof window=="object"&&window)||He(typeof self=="object"&&self)||He(typeof global=="object"&&global)||He(typeof Ar=="object"&&Ar)||function(){return this}()||Function("return this")()});var R=u((bI,jo)=>{"use strict";jo.exports=function(t){try{return!!t()}catch(e){return!0}}});var We=u((yI,Ho)=>{"use strict";var uf=R();Ho.exports=!uf(function(){var t=function(){}.bind();return typeof t!="function"||t.hasOwnProperty("prototype")})});var Or=u((II,Go)=>{"use strict";var cf=We(),Qo=Function.prototype,Wo=Qo.apply,Ko=Qo.call;Go.exports=typeof Reflect=="object"&&Reflect.apply||(cf?Ko.bind(Wo):function(){return Ko.apply(Wo,arguments)})});var k=u((_I,Jo)=>{"use strict";var zo=We(),Yo=Function.prototype,Cr=Yo.call,lf=zo&&Yo.bind.bind(Cr,Cr);Jo.exports=zo?lf:function(t){return function(){return Cr.apply(t,arguments)}}});var Ke=u((SI,Zo)=>{"use strict";var Xo=k(),df=Xo({}.toString),ff=Xo("".slice);Zo.exports=function(t){return ff(df(t),8,-1)}});var qr=u((PI,en)=>{"use strict";var pf=Ke(),hf=k();en.exports=function(t){if(pf(t)==="Function")return hf(t)}});var A=u((TI,tn)=>{"use strict";var Rr=typeof document=="object"&&document.all;tn.exports=typeof Rr=="undefined"&&Rr!==void 0?function(t){return typeof t=="function"||t===Rr}:function(t){return typeof t=="function"}});var $=u((EI,rn)=>{"use strict";var vf=R();rn.exports=!vf(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var H=u((wI,on)=>{"use strict";var gf=We(),bt=Function.prototype.call;on.exports=gf?bt.bind(bt):function(){return bt.apply(bt,arguments)}});var kr=u(sn=>{"use strict";var nn={}.propertyIsEnumerable,an=Object.getOwnPropertyDescriptor,mf=an&&!nn.call({1:2},1);sn.f=mf?function(e){var r=an(this,e);return!!r&&r.enumerable}:nn});var Qe=u((AI,un)=>{"use strict";un.exports=function(t,e){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:e}}});var ln=u((OI,cn)=>{"use strict";var bf=k(),yf=R(),If=Ke(),Lr=Object,_f=bf("".split);cn.exports=yf(function(){return!Lr("z").propertyIsEnumerable(0)})?function(t){return If(t)==="String"?_f(t,""):Lr(t)}:Lr});var Ge=u((CI,dn)=>{"use strict";dn.exports=function(t){return t==null}});var Ee=u((qI,fn)=>{"use strict";var Sf=Ge(),Pf=TypeError;fn.exports=function(t){if(Sf(t))throw new Pf("Can't call method on "+t);return t}});var fe=u((RI,pn)=>{"use strict";var Tf=ln(),Ef=Ee();pn.exports=function(t){return Tf(Ef(t))}});var W=u((kI,hn)=>{"use strict";var wf=A();hn.exports=function(t){return typeof t=="object"?t!==null:wf(t)}});var pe=u((LI,vn)=>{"use strict";vn.exports={}});var te=u((NI,mn)=>{"use strict";var Nr=pe(),$r=x(),xf=A(),gn=function(t){return xf(t)?t:void 0};mn.exports=function(t,e){return arguments.length<2?gn(Nr[t])||gn($r[t]):Nr[t]&&Nr[t][e]||$r[t]&&$r[t][e]}});var yt=u(($I,bn)=>{"use strict";var Af=k();bn.exports=Af({}.isPrototypeOf)});var he=u((DI,_n)=>{"use strict";var Of=x(),yn=Of.navigator,In=yn&&yn.userAgent;_n.exports=In?String(In):""});var Mr=u((MI,xn)=>{"use strict";var wn=x(),Dr=he(),Sn=wn.process,Pn=wn.Deno,Tn=Sn&&Sn.versions||Pn&&Pn.version,En=Tn&&Tn.v8,K,It;En&&(K=En.split("."),It=K[0]>0&&K[0]<4?1:+(K[0]+K[1]));!It&&Dr&&(K=Dr.match(/Edge\/(\d+)/),(!K||K[1]>=74)&&(K=Dr.match(/Chrome\/(\d+)/),K&&(It=+K[1])));xn.exports=It});var Vr=u((VI,On)=>{"use strict";var An=Mr(),Cf=R(),qf=x(),Rf=qf.String;On.exports=!!Object.getOwnPropertySymbols&&!Cf(function(){var t=Symbol("symbol detection");return!Rf(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&An&&An<41})});var Fr=u((FI,Cn)=>{"use strict";var kf=Vr();Cn.exports=kf&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Br=u((BI,qn)=>{"use strict";var Lf=te(),Nf=A(),$f=yt(),Df=Fr(),Mf=Object;qn.exports=Df?function(t){return typeof t=="symbol"}:function(t){var e=Lf("Symbol");return Nf(e)&&$f(e.prototype,Mf(t))}});var ze=u((UI,Rn)=>{"use strict";var Vf=String;Rn.exports=function(t){try{return Vf(t)}catch(e){return"Object"}}});var re=u((jI,kn)=>{"use strict";var Ff=A(),Bf=ze(),Uf=TypeError;kn.exports=function(t){if(Ff(t))return t;throw new Uf(Bf(t)+" is not a function")}});var _t=u((HI,Ln)=>{"use strict";var jf=re(),Hf=Ge();Ln.exports=function(t,e){var r=t[e];return Hf(r)?void 0:jf(r)}});var $n=u((WI,Nn)=>{"use strict";var Ur=H(),jr=A(),Hr=W(),Wf=TypeError;Nn.exports=function(t,e){var r,i;if(e==="string"&&jr(r=t.toString)&&!Hr(i=Ur(r,t))||jr(r=t.valueOf)&&!Hr(i=Ur(r,t))||e!=="string"&&jr(r=t.toString)&&!Hr(i=Ur(r,t)))return i;throw new Wf("Can't convert object to primitive value")}});var Z=u((KI,Dn)=>{"use strict";Dn.exports=!0});var Fn=u((QI,Vn)=>{"use strict";var Mn=x(),Kf=Object.defineProperty;Vn.exports=function(t,e){try{Kf(Mn,t,{value:e,configurable:!0,writable:!0})}catch(r){Mn[t]=e}return e}});var Ye=u((GI,jn)=>{"use strict";var Qf=Z(),Gf=x(),zf=Fn(),Bn="__core-js_shared__",Un=jn.exports=Gf[Bn]||zf(Bn,{});(Un.versions||(Un.versions=[])).push({version:"3.43.0",mode:Qf?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.43.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var Wr=u((zI,Wn)=>{"use strict";var Hn=Ye();Wn.exports=function(t,e){return Hn[t]||(Hn[t]=e||{})}});var Kr=u((YI,Kn)=>{"use strict";var Yf=Ee(),Jf=Object;Kn.exports=function(t){return Jf(Yf(t))}});var ee=u((JI,Qn)=>{"use strict";var Xf=k(),Zf=Kr(),ep=Xf({}.hasOwnProperty);Qn.exports=Object.hasOwn||function(e,r){return ep(Zf(e),r)}});var Qr=u((XI,Gn)=>{"use strict";var tp=k(),rp=0,ip=Math.random(),op=tp(1.1.toString);Gn.exports=function(t){return"Symbol("+(t===void 0?"":t)+")_"+op(++rp+ip,36)}});var D=u((ZI,Yn)=>{"use strict";var np=x(),ap=Wr(),zn=ee(),sp=Qr(),up=Vr(),cp=Fr(),we=np.Symbol,Gr=ap("wks"),lp=cp?we.for||we:we&&we.withoutSetter||sp;Yn.exports=function(t){return zn(Gr,t)||(Gr[t]=up&&zn(we,t)?we[t]:lp("Symbol."+t)),Gr[t]}});var ea=u((e_,Zn)=>{"use strict";var dp=H(),Jn=W(),Xn=Br(),fp=_t(),pp=$n(),hp=D(),vp=TypeError,gp=hp("toPrimitive");Zn.exports=function(t,e){if(!Jn(t)||Xn(t))return t;var r=fp(t,gp),i;if(r){if(e===void 0&&(e="default"),i=dp(r,t,e),!Jn(i)||Xn(i))return i;throw new vp("Can't convert object to primitive value")}return e===void 0&&(e="number"),pp(t,e)}});var zr=u((t_,ta)=>{"use strict";var mp=ea(),bp=Br();ta.exports=function(t){var e=mp(t,"string");return bp(e)?e:e+""}});var St=u((r_,ia)=>{"use strict";var yp=x(),ra=W(),Yr=yp.document,Ip=ra(Yr)&&ra(Yr.createElement);ia.exports=function(t){return Ip?Yr.createElement(t):{}}});var Jr=u((i_,oa)=>{"use strict";var _p=$(),Sp=R(),Pp=St();oa.exports=!_p&&!Sp(function(){return Object.defineProperty(Pp("div"),"a",{get:function(){return 7}}).a!==7})});var sa=u(aa=>{"use strict";var Tp=$(),Ep=H(),wp=kr(),xp=Qe(),Ap=fe(),Op=zr(),Cp=ee(),qp=Jr(),na=Object.getOwnPropertyDescriptor;aa.f=Tp?na:function(e,r){if(e=Ap(e),r=Op(r),qp)try{return na(e,r)}catch(i){}if(Cp(e,r))return xp(!Ep(wp.f,e,r),e[r])}});var Xr=u((n_,ua)=>{"use strict";var Rp=R(),kp=A(),Lp=/#|\.prototype\./,Je=function(t,e){var r=$p[Np(t)];return r===Mp?!0:r===Dp?!1:kp(e)?Rp(e):!!e},Np=Je.normalize=function(t){return String(t).replace(Lp,".").toLowerCase()},$p=Je.data={},Dp=Je.NATIVE="N",Mp=Je.POLYFILL="P";ua.exports=Je});var Xe=u((a_,la)=>{"use strict";var ca=qr(),Vp=re(),Fp=We(),Bp=ca(ca.bind);la.exports=function(t,e){return Vp(t),e===void 0?t:Fp?Bp(t,e):function(){return t.apply(e,arguments)}}});var Zr=u((s_,da)=>{"use strict";var Up=$(),jp=R();da.exports=Up&&jp(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var ie=u((u_,fa)=>{"use strict";var Hp=W(),Wp=String,Kp=TypeError;fa.exports=function(t){if(Hp(t))return t;throw new Kp(Wp(t)+" is not an object")}});var ve=u(ha=>{"use strict";var Qp=$(),Gp=Jr(),zp=Zr(),Pt=ie(),pa=zr(),Yp=TypeError,ei=Object.defineProperty,Jp=Object.getOwnPropertyDescriptor,ti="enumerable",ri="configurable",ii="writable";ha.f=Qp?zp?function(e,r,i){if(Pt(e),r=pa(r),Pt(i),typeof e=="function"&&r==="prototype"&&"value"in i&&ii in i&&!i[ii]){var o=Jp(e,r);o&&o[ii]&&(e[r]=i.value,i={configurable:ri in i?i[ri]:o[ri],enumerable:ti in i?i[ti]:o[ti],writable:!1})}return ei(e,r,i)}:ei:function(e,r,i){if(Pt(e),r=pa(r),Pt(i),Gp)try{return ei(e,r,i)}catch(o){}if("get"in i||"set"in i)throw new Yp("Accessors not supported");return"value"in i&&(e[r]=i.value),e}});var xe=u((l_,va)=>{"use strict";var Xp=$(),Zp=ve(),eh=Qe();va.exports=Xp?function(t,e,r){return Zp.f(t,e,eh(1,r))}:function(t,e,r){return t[e]=r,t}});var L=u((d_,ma)=>{"use strict";var Ze=x(),th=Or(),rh=qr(),ih=A(),oh=sa().f,nh=Xr(),Ae=pe(),ah=Xe(),Oe=xe(),ga=ee();Ye();var sh=function(t){var e=function(r,i,o){if(this instanceof e){switch(arguments.length){case 0:return new t;case 1:return new t(r);case 2:return new t(r,i)}return new t(r,i,o)}return th(t,this,arguments)};return e.prototype=t.prototype,e};ma.exports=function(t,e){var r=t.target,i=t.global,o=t.stat,n=t.proto,c=i?Ze:o?Ze[r]:Ze[r]&&Ze[r].prototype,l=i?Ae:Ae[r]||Oe(Ae,r,{})[r],f=l.prototype,p,h,a,s,d,v,g,y,S;for(s in e)p=nh(i?s:r+(o?".":"#")+s,t.forced),h=!p&&c&&ga(c,s),v=l[s],h&&(t.dontCallGetSet?(S=oh(c,s),g=S&&S.value):g=c[s]),d=h&&g?g:e[s],!(!p&&!n&&typeof v==typeof d)&&(t.bind&&h?y=ah(d,Ze):t.wrap&&h?y=sh(d):n&&ih(d)?y=rh(d):y=d,(t.sham||d&&d.sham||v&&v.sham)&&Oe(y,"sham",!0),Oe(l,s,y),n&&(a=r+"Prototype",ga(Ae,a)||Oe(Ae,a,{}),Oe(Ae[a],s,d),t.real&&f&&(p||!f[s])&&Oe(f,s,d)))}});var ya=u((f_,ba)=>{"use strict";var uh=Math.ceil,ch=Math.floor;ba.exports=Math.trunc||function(e){var r=+e;return(r>0?ch:uh)(r)}});var Tt=u((p_,Ia)=>{"use strict";var lh=ya();Ia.exports=function(t){var e=+t;return e!==e||e===0?0:lh(e)}});var Sa=u((h_,_a)=>{"use strict";var dh=Tt(),fh=Math.max,ph=Math.min;_a.exports=function(t,e){var r=dh(t);return r<0?fh(r+e,0):ph(r,e)}});var oi=u((v_,Pa)=>{"use strict";var hh=Tt(),vh=Math.min;Pa.exports=function(t){var e=hh(t);return e>0?vh(e,9007199254740991):0}});var ni=u((g_,Ta)=>{"use strict";var gh=oi();Ta.exports=function(t){return gh(t.length)}});var ai=u((m_,wa)=>{"use strict";var mh=fe(),bh=Sa(),yh=ni(),Ea=function(t){return function(e,r,i){var o=mh(e),n=yh(o);if(n===0)return!t&&-1;var c=bh(i,n),l;if(t&&r!==r){for(;n>c;)if(l=o[c++],l!==l)return!0}else for(;n>c;c++)if((t||c in o)&&o[c]===r)return t||c||0;return!t&&-1}};wa.exports={includes:Ea(!0),indexOf:Ea(!1)}});var si=u((b_,xa)=>{"use strict";xa.exports=function(){}});var Aa=u(()=>{"use strict";var Ih=L(),_h=ai().includes,Sh=R(),Ph=si(),Th=Sh(function(){return!Array(1).includes()});Ih({target:"Array",proto:!0,forced:Th},{includes:function(e){return _h(this,e,arguments.length>1?arguments[1]:void 0)}});Ph("includes")});var Et=u((__,Oa)=>{"use strict";var Eh=te();Oa.exports=Eh});var qa=u((S_,Ca)=>{"use strict";Aa();var wh=Et();Ca.exports=wh("Array","includes")});var ka=u((P_,Ra)=>{"use strict";var xh=qa();Ra.exports=xh});var ge=u((T_,La)=>{"use strict";var Ah=ka();La.exports=Ah});var Ct=u((N_,Ha)=>{"use strict";var qh=D(),Rh=qh("toStringTag"),ja={};ja[Rh]="z";Ha.exports=String(ja)==="[object z]"});var et=u(($_,Wa)=>{"use strict";var kh=Ct(),Lh=A(),qt=Ke(),Nh=D(),$h=Nh("toStringTag"),Dh=Object,Mh=qt(function(){return arguments}())==="Arguments",Vh=function(t,e){try{return t[e]}catch(r){}};Wa.exports=kh?qt:function(t){var e,r,i;return t===void 0?"Undefined":t===null?"Null":typeof(r=Vh(e=Dh(t),$h))=="string"?r:Mh?qt(e):(i=qt(e))==="Object"&&Lh(e.callee)?"Arguments":i}});var di=u((D_,Ka)=>{"use strict";var Fh=et(),Bh=String;Ka.exports=function(t){if(Fh(t)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return Bh(t)}});var Ga=u((M_,Qa)=>{"use strict";var Uh=Tt(),jh=di(),Hh=Ee(),Wh=RangeError;Qa.exports=function(e){var r=jh(Hh(this)),i="",o=Uh(e);if(o<0||o===1/0)throw new Wh("Wrong number of repetitions");for(;o>0;(o>>>=1)&&(r+=r))o&1&&(i+=r);return i}});var Za=u((V_,Xa)=>{"use strict";var Ja=k(),Kh=oi(),za=di(),Qh=Ga(),Gh=Ee(),zh=Ja(Qh),Yh=Ja("".slice),Jh=Math.ceil,Ya=function(t){return function(e,r,i){var o=za(Gh(e)),n=Kh(r),c=o.length,l=i===void 0?" ":za(i),f,p;return n<=c||l===""?o:(f=n-c,p=zh(l,Jh(f/l.length)),p.length>f&&(p=Yh(p,0,f)),t?o+p:p+o)}};Xa.exports={start:Ya(!1),end:Ya(!0)}});var ts=u((F_,es)=>{"use strict";var Xh=he();es.exports=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(Xh)});var rs=u(()=>{"use strict";var Zh=L(),ev=Za().start,tv=ts();Zh({target:"String",proto:!0,forced:tv},{padStart:function(e){return ev(this,e,arguments.length>1?arguments[1]:void 0)}})});var os=u((j_,is)=>{"use strict";rs();var rv=Et();is.exports=rv("String","padStart")});var as=u((H_,ns)=>{"use strict";var iv=os();ns.exports=iv});var Rt=u((W_,ss)=>{"use strict";var ov=as();ss.exports=ov});var cs=u(()=>{"use strict"});var fi=u((z_,ls)=>{"use strict";var tt=x(),av=he(),sv=Ke(),kt=function(t){return av.slice(0,t.length)===t};ls.exports=function(){return kt("Bun/")?"BUN":kt("Cloudflare-Workers")?"CLOUDFLARE":kt("Deno/")?"DENO":kt("Node.js/")?"NODE":tt.Bun&&typeof Bun.version=="string"?"BUN":tt.Deno&&typeof Deno.version=="object"?"DENO":sv(tt.process)==="process"?"NODE":tt.window&&tt.document?"BROWSER":"REST"}()});var Lt=u((Y_,ds)=>{"use strict";var uv=fi();ds.exports=uv==="NODE"});var qe=u((J_,fs)=>{"use strict";var cv=xe();fs.exports=function(t,e,r,i){return i&&i.enumerable?t[e]=r:cv(t,e,r),t}});var hs=u((X_,ps)=>{"use strict";var lv=k(),dv=re();ps.exports=function(t,e,r){try{return lv(dv(Object.getOwnPropertyDescriptor(t,e)[r]))}catch(i){}}});var gs=u((Z_,vs)=>{"use strict";var fv=W();vs.exports=function(t){return fv(t)||t===null}});var bs=u((eS,ms)=>{"use strict";var pv=gs(),hv=String,vv=TypeError;ms.exports=function(t){if(pv(t))return t;throw new vv("Can't set "+hv(t)+" as a prototype")}});var pi=u((tS,ys)=>{"use strict";var gv=hs(),mv=W(),bv=Ee(),yv=bs();ys.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t=!1,e={},r;try{r=gv(Object.prototype,"__proto__","set"),r(e,[]),t=e instanceof Array}catch(i){}return function(o,n){return bv(o),yv(n),mv(o)&&(t?r(o,n):o.__proto__=n),o}}():void 0)});var _s=u((rS,Is)=>{"use strict";var Iv=Ct(),_v=et();Is.exports=Iv?{}.toString:function(){return"[object "+_v(this)+"]"}});var rt=u((iS,Ps)=>{"use strict";var Sv=Ct(),Pv=ve().f,Tv=xe(),Ev=ee(),wv=_s(),xv=D(),Ss=xv("toStringTag");Ps.exports=function(t,e,r,i){var o=r?t:t&&t.prototype;o&&(Ev(o,Ss)||Pv(o,Ss,{configurable:!0,value:e}),i&&!Sv&&Tv(o,"toString",wv))}});var Es=u((oS,Ts)=>{"use strict";var Av=ve();Ts.exports=function(t,e,r){return Av.f(t,e,r)}});var As=u((nS,xs)=>{"use strict";var Ov=te(),Cv=Es(),qv=D(),Rv=$(),ws=qv("species");xs.exports=function(t){var e=Ov(t);Rv&&e&&!e[ws]&&Cv(e,ws,{configurable:!0,get:function(){return this}})}});var Cs=u((aS,Os)=>{"use strict";var kv=yt(),Lv=TypeError;Os.exports=function(t,e){if(kv(e,t))return t;throw new Lv("Incorrect invocation")}});var vi=u((sS,qs)=>{"use strict";var Nv=k(),$v=A(),hi=Ye(),Dv=Nv(Function.toString);$v(hi.inspectSource)||(hi.inspectSource=function(t){return Dv(t)});qs.exports=hi.inspectSource});var Ds=u((uS,$s)=>{"use strict";var Mv=k(),Vv=R(),Rs=A(),Fv=et(),Bv=te(),Uv=vi(),ks=function(){},Ls=Bv("Reflect","construct"),gi=/^\s*(?:class|function)\b/,jv=Mv(gi.exec),Hv=!gi.test(ks),it=function(e){if(!Rs(e))return!1;try{return Ls(ks,[],e),!0}catch(r){return!1}},Ns=function(e){if(!Rs(e))return!1;switch(Fv(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Hv||!!jv(gi,Uv(e))}catch(r){return!0}};Ns.sham=!0;$s.exports=!Ls||Vv(function(){var t;return it(it.call)||!it(Object)||!it(function(){t=!0})||t})?Ns:it});var Vs=u((cS,Ms)=>{"use strict";var Wv=Ds(),Kv=ze(),Qv=TypeError;Ms.exports=function(t){if(Wv(t))return t;throw new Qv(Kv(t)+" is not a constructor")}});var mi=u((lS,Bs)=>{"use strict";var Fs=ie(),Gv=Vs(),zv=Ge(),Yv=D(),Jv=Yv("species");Bs.exports=function(t,e){var r=Fs(t).constructor,i;return r===void 0||zv(i=Fs(r)[Jv])?e:Gv(i)}});var bi=u((dS,Us)=>{"use strict";var Xv=te();Us.exports=Xv("document","documentElement")});var Hs=u((fS,js)=>{"use strict";var Zv=k();js.exports=Zv([].slice)});var Ks=u((pS,Ws)=>{"use strict";var eg=TypeError;Ws.exports=function(t,e){if(t<e)throw new eg("Not enough arguments");return t}});var yi=u((hS,Qs)=>{"use strict";var tg=he();Qs.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(tg)});var Ai=u((vS,ru)=>{"use strict";var M=x(),rg=Or(),ig=Xe(),Gs=A(),og=ee(),tu=R(),zs=bi(),ng=Hs(),Ys=St(),ag=Ks(),sg=yi(),ug=Lt(),Ei=M.setImmediate,wi=M.clearImmediate,cg=M.process,Ii=M.Dispatch,lg=M.Function,Js=M.MessageChannel,dg=M.String,_i=0,ot={},Xs="onreadystatechange",nt,me,Si,Pi;tu(function(){nt=M.location});var xi=function(t){if(og(ot,t)){var e=ot[t];delete ot[t],e()}},Ti=function(t){return function(){xi(t)}},Zs=function(t){xi(t.data)},eu=function(t){M.postMessage(dg(t),nt.protocol+"//"+nt.host)};(!Ei||!wi)&&(Ei=function(e){ag(arguments.length,1);var r=Gs(e)?e:lg(e),i=ng(arguments,1);return ot[++_i]=function(){rg(r,void 0,i)},me(_i),_i},wi=function(e){delete ot[e]},ug?me=function(t){cg.nextTick(Ti(t))}:Ii&&Ii.now?me=function(t){Ii.now(Ti(t))}:Js&&!sg?(Si=new Js,Pi=Si.port2,Si.port1.onmessage=Zs,me=ig(Pi.postMessage,Pi)):M.addEventListener&&Gs(M.postMessage)&&!M.importScripts&&nt&&nt.protocol!=="file:"&&!tu(eu)?(me=eu,M.addEventListener("message",Zs,!1)):Xs in Ys("script")?me=function(t){zs.appendChild(Ys("script"))[Xs]=function(){zs.removeChild(this),xi(t)}}:me=function(t){setTimeout(Ti(t),0)});ru.exports={set:Ei,clear:wi}});var nu=u((gS,ou)=>{"use strict";var iu=x(),fg=$(),pg=Object.getOwnPropertyDescriptor;ou.exports=function(t){if(!fg)return iu[t];var e=pg(iu,t);return e&&e.value}});var Oi=u((mS,su)=>{"use strict";var au=function(){this.head=null,this.tail=null};au.prototype={add:function(t){var e={item:t,next:null},r=this.tail;r?r.next=e:this.head=e,this.tail=e},get:function(){var t=this.head;if(t){var e=this.head=t.next;return e===null&&(this.tail=null),t.item}}};su.exports=au});var cu=u((bS,uu)=>{"use strict";var hg=he();uu.exports=/ipad|iphone|ipod/i.test(hg)&&typeof Pebble!="undefined"});var du=u((yS,lu)=>{"use strict";var vg=he();lu.exports=/web0s(?!.*chrome)/i.test(vg)});var bu=u((IS,mu)=>{"use strict";var ke=x(),gg=nu(),fu=Xe(),Ci=Ai().set,mg=Oi(),bg=yi(),yg=cu(),Ig=du(),qi=Lt(),pu=ke.MutationObserver||ke.WebKitMutationObserver,hu=ke.document,vu=ke.process,Nt=ke.Promise,Li=gg("queueMicrotask"),Re,Ri,ki,$t,gu;Li||(at=new mg,st=function(){var t,e;for(qi&&(t=vu.domain)&&t.exit();e=at.get();)try{e()}catch(r){throw at.head&&Re(),r}t&&t.enter()},!bg&&!qi&&!Ig&&pu&&hu?(Ri=!0,ki=hu.createTextNode(""),new pu(st).observe(ki,{characterData:!0}),Re=function(){ki.data=Ri=!Ri}):!yg&&Nt&&Nt.resolve?($t=Nt.resolve(void 0),$t.constructor=Nt,gu=fu($t.then,$t),Re=function(){gu(st)}):qi?Re=function(){vu.nextTick(st)}:(Ci=fu(Ci,ke),Re=function(){Ci(st)}),Li=function(t){at.head||Re(),at.add(t)});var at,st;mu.exports=Li});var Iu=u((_S,yu)=>{"use strict";yu.exports=function(t,e){try{arguments.length===1?console.error(t):console.error(t,e)}catch(r){}}});var Dt=u((SS,_u)=>{"use strict";_u.exports=function(t){try{return{error:!1,value:t()}}catch(e){return{error:!0,value:e}}}});var Tu=u((PS,Pu)=>{"use strict";var _g=x(),Sg=A(),Su=_g.WeakMap;Pu.exports=Sg(Su)&&/native code/.test(String(Su))});var Mt=u((TS,wu)=>{"use strict";var Pg=Wr(),Tg=Qr(),Eu=Pg("keys");wu.exports=function(t){return Eu[t]||(Eu[t]=Tg(t))}});var Vt=u((ES,xu)=>{"use strict";xu.exports={}});var Mi=u((wS,Cu)=>{"use strict";var Eg=Tu(),Ou=x(),wg=W(),xg=xe(),Ni=ee(),$i=Ye(),Ag=Mt(),Og=Vt(),Au="Object already initialized",Di=Ou.TypeError,Cg=Ou.WeakMap,Ft,ut,Bt,qg=function(t){return Bt(t)?ut(t):Ft(t,{})},Rg=function(t){return function(e){var r;if(!wg(e)||(r=ut(e)).type!==t)throw new Di("Incompatible receiver, "+t+" required");return r}};Eg||$i.state?(Q=$i.state||($i.state=new Cg),Q.get=Q.get,Q.has=Q.has,Q.set=Q.set,Ft=function(t,e){if(Q.has(t))throw new Di(Au);return e.facade=t,Q.set(t,e),e},ut=function(t){return Q.get(t)||{}},Bt=function(t){return Q.has(t)}):(be=Ag("state"),Og[be]=!0,Ft=function(t,e){if(Ni(t,be))throw new Di(Au);return e.facade=t,xg(t,be,e),e},ut=function(t){return Ni(t,be)?t[be]:{}},Bt=function(t){return Ni(t,be)});var Q,be;Cu.exports={set:Ft,get:ut,has:Bt,enforce:qg,getterFor:Rg}});var ye=u((xS,qu)=>{"use strict";var kg=x();qu.exports=kg.Promise});var Le=u((AS,Nu)=>{"use strict";var Lg=x(),ct=ye(),Ng=A(),$g=Xr(),Dg=vi(),Mg=D(),Ru=fi(),Vg=Z(),Vi=Mr(),ku=ct&&ct.prototype,Fg=Mg("species"),Fi=!1,Lu=Ng(Lg.PromiseRejectionEvent),Bg=$g("Promise",function(){var t=Dg(ct),e=t!==String(ct);if(!e&&Vi===66||Vg&&!(ku.catch&&ku.finally))return!0;if(!Vi||Vi<51||!/native code/.test(t)){var r=new ct(function(n){n(1)}),i=function(n){n(function(){},function(){})},o=r.constructor={};if(o[Fg]=i,Fi=r.then(function(){})instanceof i,!Fi)return!0}return!e&&(Ru==="BROWSER"||Ru==="DENO")&&!Lu});Nu.exports={CONSTRUCTOR:Bg,REJECTION_EVENT:Lu,SUBCLASSING:Fi}});var Ne=u((OS,Du)=>{"use strict";var $u=re(),Ug=TypeError,jg=function(t){var e,r;this.promise=new t(function(i,o){if(e!==void 0||r!==void 0)throw new Ug("Bad Promise constructor");e=i,r=o}),this.resolve=$u(e),this.reject=$u(r)};Du.exports.f=function(t){return new jg(t)}});var ic=u(()=>{"use strict";var Hg=L(),Wg=Z(),Wt=Lt(),le=x(),Kg=pe(),Ve=H(),Mu=qe(),Vu=pi(),Qg=rt(),Gg=As(),zg=re(),Ht=A(),Yg=W(),Jg=Cs(),Xg=mi(),Hu=Ai().set,Wi=bu(),Zg=Iu(),em=Dt(),tm=Oi(),Wu=Mi(),Kt=ye(),Ki=Le(),Ku=Ne(),Qt="Promise",Qu=Ki.CONSTRUCTOR,rm=Ki.REJECTION_EVENT,im=Ki.SUBCLASSING,Bi=Wu.getterFor(Qt),om=Wu.set,$e=Kt&&Kt.prototype,Ie=Kt,Ut=$e,Gu=le.TypeError,Ui=le.document,Qi=le.process,ji=Ku.f,nm=ji,am=!!(Ui&&Ui.createEvent&&le.dispatchEvent),zu="unhandledrejection",sm="rejectionhandled",Fu=0,Yu=1,um=2,Gi=1,Ju=2,jt,Bu,Xu,Uu,Zu=function(t){var e;return Yg(t)&&Ht(e=t.then)?e:!1},ec=function(t,e){var r=e.value,i=e.state===Yu,o=i?t.ok:t.fail,n=t.resolve,c=t.reject,l=t.domain,f,p,h;try{o?(i||(e.rejection===Ju&&lm(e),e.rejection=Gi),o===!0?f=r:(l&&l.enter(),f=o(r),l&&(l.exit(),h=!0)),f===t.promise?c(new Gu("Promise-chain cycle")):(p=Zu(f))?Ve(p,f,n,c):n(f)):c(r)}catch(a){l&&!h&&l.exit(),c(a)}},tc=function(t,e){t.notified||(t.notified=!0,Wi(function(){for(var r=t.reactions,i;i=r.get();)ec(i,t);t.notified=!1,e&&!t.rejection&&cm(t)}))},rc=function(t,e,r){var i,o;am?(i=Ui.createEvent("Event"),i.promise=e,i.reason=r,i.initEvent(t,!1,!0),le.dispatchEvent(i)):i={promise:e,reason:r},!rm&&(o=le["on"+t])?o(i):t===zu&&Zg("Unhandled promise rejection",r)},cm=function(t){Ve(Hu,le,function(){var e=t.facade,r=t.value,i=ju(t),o;if(i&&(o=em(function(){Wt?Qi.emit("unhandledRejection",r,e):rc(zu,e,r)}),t.rejection=Wt||ju(t)?Ju:Gi,o.error))throw o.value})},ju=function(t){return t.rejection!==Gi&&!t.parent},lm=function(t){Ve(Hu,le,function(){var e=t.facade;Wt?Qi.emit("rejectionHandled",e):rc(sm,e,t.value)})},De=function(t,e,r){return function(i){t(e,i,r)}},Me=function(t,e,r){t.done||(t.done=!0,r&&(t=r),t.value=e,t.state=um,tc(t,!0))},Hi=function(t,e,r){if(!t.done){t.done=!0,r&&(t=r);try{if(t.facade===e)throw new Gu("Promise can't be resolved itself");var i=Zu(e);i?Wi(function(){var o={done:!1};try{Ve(i,e,De(Hi,o,t),De(Me,o,t))}catch(n){Me(o,n,t)}}):(t.value=e,t.state=Yu,tc(t,!1))}catch(o){Me({done:!1},o,t)}}};if(Qu&&(Ie=function(e){Jg(this,Ut),zg(e),Ve(jt,this);var r=Bi(this);try{e(De(Hi,r),De(Me,r))}catch(i){Me(r,i)}},Ut=Ie.prototype,jt=function(e){om(this,{type:Qt,done:!1,notified:!1,parent:!1,reactions:new tm,rejection:!1,state:Fu,value:null})},jt.prototype=Mu(Ut,"then",function(e,r){var i=Bi(this),o=ji(Xg(this,Ie));return i.parent=!0,o.ok=Ht(e)?e:!0,o.fail=Ht(r)&&r,o.domain=Wt?Qi.domain:void 0,i.state===Fu?i.reactions.add(o):Wi(function(){ec(o,i)}),o.promise}),Bu=function(){var t=new jt,e=Bi(t);this.promise=t,this.resolve=De(Hi,e),this.reject=De(Me,e)},Ku.f=ji=function(t){return t===Ie||t===Xu?new Bu(t):nm(t)},!Wg&&Ht(Kt)&&$e!==Object.prototype)){Uu=$e.then,im||Mu($e,"then",function(e,r){var i=this;return new Ie(function(o,n){Ve(Uu,i,o,n)}).then(e,r)},{unsafe:!0});try{delete $e.constructor}catch(t){}Vu&&Vu($e,Ut)}Hg({global:!0,constructor:!0,wrap:!0,forced:Qu},{Promise:Ie});Xu=Kg.Promise;Qg(Ie,Qt,!1,!0);Gg(Qt)});var _e=u((RS,oc)=>{"use strict";oc.exports={}});var ac=u((kS,nc)=>{"use strict";var dm=D(),fm=_e(),pm=dm("iterator"),hm=Array.prototype;nc.exports=function(t){return t!==void 0&&(fm.Array===t||hm[pm]===t)}});var zi=u((LS,uc)=>{"use strict";var vm=et(),sc=_t(),gm=Ge(),mm=_e(),bm=D(),ym=bm("iterator");uc.exports=function(t){if(!gm(t))return sc(t,ym)||sc(t,"@@iterator")||mm[vm(t)]}});var lc=u((NS,cc)=>{"use strict";var Im=H(),_m=re(),Sm=ie(),Pm=ze(),Tm=zi(),Em=TypeError;cc.exports=function(t,e){var r=arguments.length<2?Tm(t):e;if(_m(r))return Sm(Im(r,t));throw new Em(Pm(t)+" is not iterable")}});var pc=u(($S,fc)=>{"use strict";var wm=H(),dc=ie(),xm=_t();fc.exports=function(t,e,r){var i,o;dc(t);try{if(i=xm(t,"return"),!i){if(e==="throw")throw r;return r}i=wm(i,t)}catch(n){o=!0,i=n}if(e==="throw")throw r;if(o)throw i;return dc(i),r}});var zt=u((DS,mc)=>{"use strict";var Am=Xe(),Om=H(),Cm=ie(),qm=ze(),Rm=ac(),km=ni(),hc=yt(),Lm=lc(),Nm=zi(),vc=pc(),$m=TypeError,Gt=function(t,e){this.stopped=t,this.result=e},gc=Gt.prototype;mc.exports=function(t,e,r){var i=r&&r.that,o=!!(r&&r.AS_ENTRIES),n=!!(r&&r.IS_RECORD),c=!!(r&&r.IS_ITERATOR),l=!!(r&&r.INTERRUPTED),f=Am(e,i),p,h,a,s,d,v,g,y=function(T){return p&&vc(p,"normal"),new Gt(!0,T)},S=function(T){return o?(Cm(T),l?f(T[0],T[1],y):f(T[0],T[1])):l?f(T,y):f(T)};if(n)p=t.iterator;else if(c)p=t;else{if(h=Nm(t),!h)throw new $m(qm(t)+" is not iterable");if(Rm(h)){for(a=0,s=km(t);s>a;a++)if(d=S(t[a]),d&&hc(gc,d))return d;return new Gt(!1)}p=Lm(t,h)}for(v=n?t.next:p.next;!(g=Om(v,p)).done;){try{d=S(g.value)}catch(T){vc(p,"throw",T)}if(typeof d=="object"&&d&&hc(gc,d))return d}return new Gt(!1)}});var Sc=u((MS,_c)=>{"use strict";var Dm=D(),yc=Dm("iterator"),Ic=!1;try{bc=0,Yi={next:function(){return{done:!!bc++}},return:function(){Ic=!0}},Yi[yc]=function(){return this},Array.from(Yi,function(){throw 2})}catch(t){}var bc,Yi;_c.exports=function(t,e){try{if(!e&&!Ic)return!1}catch(o){return!1}var r=!1;try{var i={};i[yc]=function(){return{next:function(){return{done:r=!0}}}},t(i)}catch(o){}return r}});var Ji=u((VS,Pc)=>{"use strict";var Mm=ye(),Vm=Sc(),Fm=Le().CONSTRUCTOR;Pc.exports=Fm||!Vm(function(t){Mm.all(t).then(void 0,function(){})})});var Tc=u(()=>{"use strict";var Bm=L(),Um=H(),jm=re(),Hm=Ne(),Wm=Dt(),Km=zt(),Qm=Ji();Bm({target:"Promise",stat:!0,forced:Qm},{all:function(e){var r=this,i=Hm.f(r),o=i.resolve,n=i.reject,c=Wm(function(){var l=jm(r.resolve),f=[],p=0,h=1;Km(e,function(a){var s=p++,d=!1;h++,Um(l,r,a).then(function(v){d||(d=!0,f[s]=v,--h||o(f))},n)}),--h||o(f)});return c.error&&n(c.value),i.promise}})});var wc=u(()=>{"use strict";var Gm=L(),zm=Z(),Ym=Le().CONSTRUCTOR,Zi=ye(),Jm=te(),Xm=A(),Zm=qe(),Ec=Zi&&Zi.prototype;Gm({target:"Promise",proto:!0,forced:Ym,real:!0},{catch:function(t){return this.then(void 0,t)}});!zm&&Xm(Zi)&&(Xi=Jm("Promise").prototype.catch,Ec.catch!==Xi&&Zm(Ec,"catch",Xi,{unsafe:!0}));var Xi});var xc=u(()=>{"use strict";var eb=L(),tb=H(),rb=re(),ib=Ne(),ob=Dt(),nb=zt(),ab=Ji();eb({target:"Promise",stat:!0,forced:ab},{race:function(e){var r=this,i=ib.f(r),o=i.reject,n=ob(function(){var c=rb(r.resolve);nb(e,function(l){tb(c,r,l).then(i.resolve,o)})});return n.error&&o(n.value),i.promise}})});var Ac=u(()=>{"use strict";var sb=L(),ub=Ne(),cb=Le().CONSTRUCTOR;sb({target:"Promise",stat:!0,forced:cb},{reject:function(e){var r=ub.f(this),i=r.reject;return i(e),r.promise}})});var eo=u((GS,Oc)=>{"use strict";var lb=ie(),db=W(),fb=Ne();Oc.exports=function(t,e){if(lb(t),db(e)&&e.constructor===t)return e;var r=fb.f(t),i=r.resolve;return i(e),r.promise}});var Rc=u(()=>{"use strict";var pb=L(),hb=te(),Cc=Z(),vb=ye(),qc=Le().CONSTRUCTOR,gb=eo(),mb=hb("Promise"),bb=Cc&&!qc;pb({target:"Promise",stat:!0,forced:Cc||qc},{resolve:function(e){return gb(bb&&this===mb?vb:this,e)}})});var kc=u(()=>{"use strict";ic();Tc();wc();xc();Ac();Rc()});var Dc=u(()=>{"use strict";var yb=L(),Ib=Z(),Yt=ye(),_b=R(),Nc=te(),$c=A(),Sb=mi(),Lc=eo(),Pb=qe(),ro=Yt&&Yt.prototype,Tb=!!Yt&&_b(function(){ro.finally.call({then:function(){}},function(){})});yb({target:"Promise",proto:!0,real:!0,forced:Tb},{finally:function(t){var e=Sb(this,Nc("Promise")),r=$c(t);return this.then(r?function(i){return Lc(e,t()).then(function(){return i})}:t,r?function(i){return Lc(e,t()).then(function(){throw i})}:t)}});!Ib&&$c(Yt)&&(to=Nc("Promise").prototype.finally,ro.finally!==to&&Pb(ro,"finally",to,{unsafe:!0}));var to});var Vc=u((tP,Mc)=>{"use strict";cs();kc();Dc();var Eb=Et();Mc.exports=Eb("Promise","finally")});var Bc=u((rP,Fc)=>{"use strict";var wb=Vc();Fc.exports=wb});var io=u((iP,Uc)=>{"use strict";var xb=Bc();Uc.exports=xb});var Hc=u((oP,jc)=>{"use strict";var Ab=R();jc.exports=!Ab(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})});var Jt=u((nP,Kc)=>{"use strict";var Ob=ee(),Cb=A(),qb=Kr(),Rb=Mt(),kb=Hc(),Wc=Rb("IE_PROTO"),oo=Object,Lb=oo.prototype;Kc.exports=kb?oo.getPrototypeOf:function(t){var e=qb(t);if(Ob(e,Wc))return e[Wc];var r=e.constructor;return Cb(r)&&e instanceof r?r.prototype:e instanceof oo?Lb:null}});var zc=u((aP,Gc)=>{"use strict";var Nb=k(),no=ee(),$b=fe(),Db=ai().indexOf,Mb=Vt(),Qc=Nb([].push);Gc.exports=function(t,e){var r=$b(t),i=0,o=[],n;for(n in r)!no(Mb,n)&&no(r,n)&&Qc(o,n);for(;e.length>i;)no(r,n=e[i++])&&(~Db(o,n)||Qc(o,n));return o}});var ao=u((sP,Yc)=>{"use strict";Yc.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var so=u((uP,Jc)=>{"use strict";var Vb=zc(),Fb=ao();Jc.exports=Object.keys||function(e){return Vb(e,Fb)}});var uo=u((cP,rl)=>{"use strict";var Zc=$(),Bb=R(),el=k(),Ub=Jt(),jb=so(),Hb=fe(),Wb=kr().f,tl=el(Wb),Kb=el([].push),Qb=Zc&&Bb(function(){var t=Object.create(null);return t[2]=2,!tl(t,2)}),Xc=function(t){return function(e){for(var r=Hb(e),i=jb(r),o=Qb&&Ub(r)===null,n=i.length,c=0,l=[],f;n>c;)f=i[c++],(!Zc||(o?f in r:tl(r,f)))&&Kb(l,t?[f,r[f]]:r[f]);return l}};rl.exports={entries:Xc(!0),values:Xc(!1)}});var il=u(()=>{"use strict";var Gb=L(),zb=uo().entries;Gb({target:"Object",stat:!0},{entries:function(e){return zb(e)}})});var nl=u((fP,ol)=>{"use strict";il();var Yb=pe();ol.exports=Yb.Object.entries});var sl=u((pP,al)=>{"use strict";var Jb=nl();al.exports=Jb});var Fe=u((hP,ul)=>{"use strict";var Xb=sl();ul.exports=Xb});var dl=u((vP,ll)=>{"use strict";var co=$(),Zb=ee(),cl=Function.prototype,ey=co&&Object.getOwnPropertyDescriptor,lo=Zb(cl,"name"),ty=lo&&function(){}.name==="something",ry=lo&&(!co||co&&ey(cl,"name").configurable);ll.exports={EXISTS:lo,PROPER:ty,CONFIGURABLE:ry}});var pl=u(fl=>{"use strict";var iy=$(),oy=Zr(),ny=ve(),ay=ie(),sy=fe(),uy=so();fl.f=iy&&!oy?Object.defineProperties:function(e,r){ay(e);for(var i=sy(r),o=uy(r),n=o.length,c=0,l;n>c;)ny.f(e,l=o[c++],i[l]);return e}});var vo=u((mP,Il)=>{"use strict";var cy=ie(),ly=pl(),hl=ao(),dy=Vt(),fy=bi(),py=St(),hy=Mt(),vl=">",gl="<",po="prototype",ho="script",bl=hy("IE_PROTO"),fo=function(){},yl=function(t){return gl+ho+vl+t+gl+"/"+ho+vl},ml=function(t){t.write(yl("")),t.close();var e=t.parentWindow.Object;return t=null,e},vy=function(){var t=py("iframe"),e="java"+ho+":",r;return t.style.display="none",fy.appendChild(t),t.src=String(e),r=t.contentWindow.document,r.open(),r.write(yl("document.F=Object")),r.close(),r.F},Xt,Zt=function(){try{Xt=new ActiveXObject("htmlfile")}catch(e){}Zt=typeof document!="undefined"?document.domain&&Xt?ml(Xt):vy():ml(Xt);for(var t=hl.length;t--;)delete Zt[po][hl[t]];return Zt()};dy[bl]=!0;Il.exports=Object.create||function(e,r){var i;return e!==null?(fo[po]=cy(e),i=new fo,fo[po]=null,i[bl]=e):i=Zt(),r===void 0?i:ly.f(i,r)}});var yo=u((bP,Pl)=>{"use strict";var gy=R(),my=A(),by=W(),yy=vo(),_l=Jt(),Iy=qe(),_y=D(),Sy=Z(),bo=_y("iterator"),Sl=!1,oe,go,mo;[].keys&&(mo=[].keys(),"next"in mo?(go=_l(_l(mo)),go!==Object.prototype&&(oe=go)):Sl=!0);var Py=!by(oe)||gy(function(){var t={};return oe[bo].call(t)!==t});Py?oe={}:Sy&&(oe=yy(oe));my(oe[bo])||Iy(oe,bo,function(){return this});Pl.exports={IteratorPrototype:oe,BUGGY_SAFARI_ITERATORS:Sl}});var El=u((yP,Tl)=>{"use strict";var Ty=yo().IteratorPrototype,Ey=vo(),wy=Qe(),xy=rt(),Ay=_e(),Oy=function(){return this};Tl.exports=function(t,e,r,i){var o=e+" Iterator";return t.prototype=Ey(Ty,{next:wy(+!i,r)}),xy(t,o,!1,!0),Ay[o]=Oy,t}});var $l=u((IP,Nl)=>{"use strict";var Cy=L(),qy=H(),er=Z(),kl=dl(),Ry=A(),ky=El(),wl=Jt(),xl=pi(),Ly=rt(),Ny=xe(),Io=qe(),$y=D(),Al=_e(),Ll=yo(),Dy=kl.PROPER,My=kl.CONFIGURABLE,Ol=Ll.IteratorPrototype,tr=Ll.BUGGY_SAFARI_ITERATORS,lt=$y("iterator"),Cl="keys",dt="values",ql="entries",Rl=function(){return this};Nl.exports=function(t,e,r,i,o,n,c){ky(r,e,i);var l=function(S){if(S===o&&s)return s;if(!tr&&S&&S in h)return h[S];switch(S){case Cl:return function(){return new r(this,S)};case dt:return function(){return new r(this,S)};case ql:return function(){return new r(this,S)}}return function(){return new r(this)}},f=e+" Iterator",p=!1,h=t.prototype,a=h[lt]||h["@@iterator"]||o&&h[o],s=!tr&&a||l(o),d=e==="Array"&&h.entries||a,v,g,y;if(d&&(v=wl(d.call(new t)),v!==Object.prototype&&v.next&&(!er&&wl(v)!==Ol&&(xl?xl(v,Ol):Ry(v[lt])||Io(v,lt,Rl)),Ly(v,f,!0,!0),er&&(Al[f]=Rl))),Dy&&o===dt&&a&&a.name!==dt&&(!er&&My?Ny(h,"name",dt):(p=!0,s=function(){return qy(a,this)})),o)if(g={values:l(dt),keys:n?s:l(Cl),entries:l(ql)},c)for(y in g)(tr||p||!(y in h))&&Io(h,y,g[y]);else Cy({target:e,proto:!0,forced:tr||p},g);return(!er||c)&&h[lt]!==s&&Io(h,lt,s,{name:o}),Al[e]=s,g}});var Ml=u((_P,Dl)=>{"use strict";Dl.exports=function(t,e){return{value:t,done:e}}});var So=u((SP,jl)=>{"use strict";var Vy=fe(),_o=si(),Vl=_e(),Bl=Mi(),Fy=ve().f,By=$l(),rr=Ml(),Uy=Z(),jy=$(),Ul="Array Iterator",Hy=Bl.set,Wy=Bl.getterFor(Ul);jl.exports=By(Array,"Array",function(t,e){Hy(this,{type:Ul,target:Vy(t),index:0,kind:e})},function(){var t=Wy(this),e=t.target,r=t.index++;if(!e||r>=e.length)return t.target=null,rr(void 0,!0);switch(t.kind){case"keys":return rr(r,!1);case"values":return rr(e[r],!1)}return rr([r,e[r]],!1)},"values");var Fl=Vl.Arguments=Vl.Array;_o("keys");_o("values");_o("entries");if(!Uy&&jy&&Fl.name!=="values")try{Fy(Fl,"name",{value:"values"})}catch(t){}});var Wl=u((PP,Hl)=>{"use strict";var Ky=$(),Qy=ve(),Gy=Qe();Hl.exports=function(t,e,r){Ky?Qy.f(t,e,Gy(0,r)):t[e]=r}});var Kl=u(()=>{"use strict";var zy=L(),Yy=zt(),Jy=Wl();zy({target:"Object",stat:!0},{fromEntries:function(e){var r={};return Yy(e,function(i,o){Jy(r,i,o)},{AS_ENTRIES:!0}),r}})});var Gl=u((wP,Ql)=>{"use strict";So();Kl();var Xy=pe();Ql.exports=Xy.Object.fromEntries});var Yl=u((xP,zl)=>{"use strict";zl.exports={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}});var Xl=u(()=>{"use strict";So();var Zy=Yl(),eI=x(),tI=rt(),Jl=_e();for(ir in Zy)tI(eI[ir],ir),Jl[ir]=Jl.Array;var ir});var ed=u((CP,Zl)=>{"use strict";var rI=Gl();Xl();Zl.exports=rI});var rd=u((qP,td)=>{"use strict";var iI=ed();td.exports=iI});var Id=u(()=>{"use strict";var sI=L(),uI=uo().values;sI({target:"Object",stat:!0},{values:function(e){return uI(e)}})});var Sd=u((CE,_d)=>{"use strict";Id();var cI=pe();_d.exports=cI.Object.values});var Td=u((qE,Pd)=>{"use strict";var lI=Sd();Pd.exports=lI});var wd=u((RE,Ed)=>{"use strict";var dI=Td();Ed.exports=dI});var gI={};Fo(gI,{ApiEnv:()=>Ce,ConnectionType:()=>At,ContentType:()=>xt,InteractiveInterfaceClick:()=>ui,MediascopePixel:()=>Er,MediascopePixelTypes:()=>Vo,OneStat:()=>dr,Quality:()=>wt,SeekAction:()=>Ot,ThinOneStat:()=>Pr,VERSION:()=>V});module.exports=sf(gI);var Co=C(ge(),1);var Oh=(t,e,r)=>{if(typeof t.canParse=="function")return t.canParse(e,r);try{return new t(e,r),!0}catch(i){return!1}},Na=Oh;var Ce=(c=>(c.PROD="prod",c.VK_ALIAS="vk_alias",c.VIDEOTEST="videotest",c.TEST="test",c.OKCDN="okcdn",c.AUTO="auto",c))(Ce||{}),wt=(p=>(p.Q144P="mobile",p.Q240P="lowest",p.Q360P="low",p.Q480P="medium",p.Q720P="high",p.Q1080P="fullhd",p.Q1440P="quadhd",p.Q2160P="ultrahd",p.UNKNOWN="unknown",p))(wt||{}),xt=(v=>(v.MP4="mp4",v.DASH="dash",v.DASH_SEP="dash_sep",v.ONDEMAND_DASH="ondemand_dash",v.HLS="hls",v.HLS_FMP4="hls_fmp4",v.ONDEMAND_HLS="ondemand_hls",v.WEBM="webm",v.AV1="av1",v.ONDEMAND_DASH_LIVE="ondemand_dash_live",v.ONDEMAND_HLS_LIVE="ondemand_hls_live",v.WEBRTC="webrtc",v.UNKNOWN="unknown",v.RTMP="rtmp",v))(xt||{});var At=(i=>(i.HTTP1="http1",i.HTTP2="http2",i.HTTP3="http3",i))(At||{});var Ot=(l=>(l.SLIDER="slider",l.DOUBLE_TAP="double_tap",l.TIME_CODE="time_code",l.EPISODE="episode",l.REWIND="rewind",l.LIVE="live",l.UNKNOWN="unknown",l))(Ot||{}),ui=(n=>(n.GRAPH_SHOW="iGraphShow",n.GRAPH_HIDE="iGraphHide",n.NEXT_AREA="iNextChapterArea",n.NEXT_BUTTON="iNextChapterBtn",n.WATCH_AGAIN="iWatchAgainBtn",n))(ui||{}),$a={action_play:"ap",action_play_interactive:"api",first_bytes:"fb",player_ready:"pr",first_frame:"ff",seek:"sk",watch_coverage_record:"wr",watch_coverage_live:"wl",empty_buffer:"eb",action_stop:"as",close_at_empty_buffer:"cb",content_error:"er",player_interface_click:"pc",next_movie:"nm",track_switch:"ts",failover:"fo",quality:"qt"},Da={vsid:"si",isid:"is",vid:"vi",place:"pl",quality:"qt",cdn_host:"ch",stat_type:"st",param:"pm",vk_app_id:"va",track_code:"tc",connection_type:"cnt",connection_reused:"cr",cached_data:"cd",live:"lv",muted:"mu",mode:"mo",subtitles:"sb",failover:"fo",download_speed:"ds",manual_quality:"mq",ref_domain:"rd",direct_url:"du"},Ma={unknown:"un",mobile:"m",lowest:"ls",low:"l",medium:"md",high:"h",fullhd:"f",quadhd:"q",ultrahd:"u"},Va={pip:"pi",fullscreen:"fs",external:"ex",prefetch:"pr",airplay:"ap",chromecast:"cc",invisible:"iv",minimal:"minimal"};var Ba=require("@vkontakte/videoplayer-shared/es2018");var Fa="CIOPGQJGDIHBABABA",ci={prod:"https://api.ok.ru",vk_alias:"https://api.mycdn.me",videotest:"https://videotestapi.ok.ru/api",test:"https://apitest.ok.ru",okcdn:"https://api.okcdn.ru",auto:""};var Ch={apiEnv:"vk_alias",apiKey:Fa,apiBaseUrl:null,requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageInterval:15e3,disabledOperations:["quality"],disabledCustomFields:[],shorten:!0,maxLoops:100,embedUrlParams:[],useBeacon:!0,synchronizeTime:!0,debugLog:!1,clearStorageAtUnload:!0,useVKComIsMobileLogic:!1,backoff:{start:1e3,factor:1.5,max:5*60*1e3,random:.1},useKeepalive:!1,watchCoverageTimeoutFix:!1},Ua=t=>(0,Ba.fillWithDefault)(t,Ch);function li(){let t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),e=new Array(36),r=0,i,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?e[o]="-":o===14?e[o]="4":(r<=2&&(r=33554432+Math.random()*16777216|0),i=r&15,r=r>>4,e[o]=t[o===19?i&3|8:i]);return e.join("")}var b=require("@vkontakte/videoplayer-shared/es2018"),fr=require("@vkontakte/videoplayer-shared/es2018");var us=C(Rt(),1),nv=()=>(0,us.default)(Math.floor(Math.random()*2**32).toString(36),13,"0"),ce=class t{static getVSID(){return t.vsid}static generateVSID(){return t.vsid=nv(),t.vsid}};var or=C(io(),1);var id=C(Fe(),1),od=C(rd(),1);var nd=t=>{var o;let{operation:e,custom:r}=t,i=(0,od.default)((0,id.default)(r).map(([n,c])=>{var p,h,a;let l=(p=Da[n])!=null?p:n,f=c;return c&&(n==="mode"?f=(h=Va[c])!=null?h:c:n==="quality"&&(f=(a=Ma[c])!=null?a:c)),[l,f]}));return{...t,operation:(o=$a[e])!=null?o:e,custom:i}};var V="1.0.97-dev.96546ef5.0";var G=require("@vkontakte/videoplayer-shared/es2018");var oI=/Mobile|mini|Fennec|Android|iP(ad|od|hone)|opera (mini|mobi)/i,ft=class{constructor(e){this.consequentAuthErrors=0;this.authorized$=new G.ValueSubject(!1);this.params=e}async authorize(e){return this.authToken=e!=null?e:await this.refreshAuthToken(),this._authorizeWithBackoff()}logBeacon(e){let r="log.externalLog",i=this.createLogParams(e),o=this.sessionKey;if(!o)return;this.params.apiTransport.sendBeacon(r,i,o)||this.logRequest(e).catch(()=>{})}async logRequest(e){var c;let r="log.externalLog",i=this.createLogParams(e),o=(c=this.sessionKey)!=null?c:await this._authorizeWithBackoff();if(!o)return;let n=async(l,f=this.params.config.requestRetryCount)=>{try{return await this.params.apiTransport.sendRequest(r,i,o)}catch(p){if(!p||!("error_code"in p)){this.params.error$.next({id:"logRequestUnknown",category:G.ErrorCategory.NETWORK,message:`Unknown ${r} error`,thrown:p});return}let h=p==null?void 0:p.error_code;switch(h){case 102:case 103:case 104:return this.authorized$.next(!1),this.sessionKey=await this._authorizeWithBackoff(),f>0?n(l,f-1):void 0;case 401:return this.authorized$.next(!1),this.authToken=await this.refreshAuthToken(),this.sessionKey=await this._authorizeWithBackoff(),f>0?n(l,f-1):void 0;default:{this.params.error$.next({id:`LogRequest#${h}`,category:G.ErrorCategory.EXTERNAL_API,message:`${r} error`,data:p});return}}}};return n(e)}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}async refreshAuthToken(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=(0,or.default)(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise}createLogParams(e){let r="WEB",i=!1,o=`@vkontakte/videoplayer-statistics:${V}`;if(this.params.config.useVKComIsMobileLogic){let{appVersion:n}=window.navigator;i=oI.test(n)}else this.params.mobile&&(i=!0);return i&&(r="M_WEB"),this.params.vktvVersion&&(r="SMART_TV",o=this.params.vktvVersion),{collector:"ok.mobile.apps.video",data:JSON.stringify({application:o,platform:r,items:this.params.config.shorten?e.map(nd):e})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();let e=(0,G.getExponentialDelay)(this.consequentAuthErrors,this.params.config.backoff);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{(0,or.default)(this._authorize().then(r).catch(i=>this.params.error$.next({id:"AuthorizeBackoff",category:G.ErrorCategory.NETWORK,message:"Otherwise unhandled error in authorization",thrown:i})),()=>this.backoffTimeoutId=0)},e))})}async _authorize(){if(this.authorizePromise)return this.authorizePromise;this.sessionKey=void 0,this.authorized$.next(!1);let e="auth.anonymLogin",r={session_data:{version:2,device_id:this.params.deviceId,client_version:V.split("-")[0],client_type:"SDK_JS"}};return this.authToken!==void 0&&(r.session_data.auth_token=this.authToken,r.session_data.version=3),this.authorizePromise=(0,or.default)(this.params.apiTransport.sendRequest(e,r).then(i=>{var o;return(!i||!i.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:G.ErrorCategory.EXTERNAL_API,message:"No session key",data:i}),this.sessionKey=(o=i==null?void 0:i.session_key)!=null?o:void 0,this.sessionKey}).catch(async i=>{this.sessionKey=void 0;let o=i==null?void 0:i.error_code;switch(o){case 401:return this.authToken=await this.refreshAuthToken(),this._authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:G.ErrorCategory.EXTERNAL_API,message:"authorize error",data:i}):this.params.error$.next({id:"AuthorizeUnknown",category:G.ErrorCategory.NETWORK,message:"authorize error",thrown:i})}),()=>{this.authorizePromise=void 0,this.consequentAuthErrors=this.sessionKey?0:this.consequentAuthErrors+1,this.authorized$.next(this.sessionKey!==void 0)}),this.authorizePromise}};var{NativeAbortSignal:jP,NativeAbortController:HP}=function(t){return{NativeAbortSignal:t.AbortSignal,NativeAbortController:t.AbortController}}(typeof self!="undefined"?self:global);function ad(t){let e;try{e=new Event("abort")}catch(r){typeof document!="undefined"?document.createEvent?(e=document.createEvent("Event"),e.initEvent("abort",!1,!1)):(e=document.createEventObject(),e.type="abort"):e={type:"abort",bubbles:!1,cancelable:!1}}return e.reason=t,e}function sd(t){if(t===void 0)if(typeof document=="undefined")t=new Error("This operation was aborted"),t.name="AbortError";else try{t=new DOMException("signal is aborted without reason"),Object.defineProperty(t,"name",{value:"AbortError"})}catch(e){t=new Error("This operation was aborted"),t.name="AbortError"}return t}var nr=class{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(e,r,i){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:r,options:i})}removeEventListener(e,r){if(!(e in this.listeners))return;let i=this.listeners[e];for(let o=0,n=i.length;o<n;o++)if(i[o].callback===r){i.splice(o,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let i=this.listeners[e.type].slice();for(let o=0,n=i.length;o<n;o++){let c=i[o];try{c.callback.call(this,e)}catch(l){Promise.resolve().then(()=>{throw l})}c.options&&c.options.once&&this.removeEventListener(e.type,c.callback)}return!e.defaultPrevented}},Be=class extends nr{constructor(){super(),this.listeners||nr.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(e){e.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,e)),super.dispatchEvent(e)}throwIfAborted(){let{aborted:e,reason:r="Aborted"}=this;if(e)throw r}static timeout(e){let r=new Se;return setTimeout(()=>r.abort(new DOMException(`This signal is timeout in ${e}ms`,"TimeoutError")),e),r.signal}static any(e){let r=new Se;function i(){r.abort(this.reason),o()}function o(){for(let n of e)n.removeEventListener("abort",i)}for(let n of e)if(n.aborted){r.abort(n.reason);break}else n.addEventListener("abort",i);return r.signal}},Se=class{constructor(){Object.defineProperty(this,"signal",{value:new Be,writable:!0,configurable:!0})}abort(e){let r=sd(e),i=ad(r);this.signal.reason=r,this.signal.dispatchEvent(i)}toString(){return"[object AbortController]"}};typeof Symbol!="undefined"&&Symbol.toStringTag&&(Se.prototype[Symbol.toStringTag]="AbortController",Be.prototype[Symbol.toStringTag]="AbortSignal");function ar(t){return t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof t.Request=="function"&&!t.Request.prototype.hasOwnProperty("signal")||!t.AbortController}function Po(t){typeof t=="function"&&(t={fetch:t});let{fetch:e,Request:r=e.Request,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=t;if(!ar({fetch:e,Request:r,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o}))return{fetch:e,Request:n};let n=r;(n&&!n.prototype.hasOwnProperty("signal")||o)&&(n=function(p,h){let a;h&&h.signal&&(a=h.signal,delete h.signal);let s=new r(p,h);return a&&Object.defineProperty(s,"signal",{writable:!1,enumerable:!1,configurable:!0,value:a}),s},n.prototype=r.prototype);let c=e;return{fetch:(f,p)=>{let h=n&&n.prototype.isPrototypeOf(f)?f.signal:p?p.signal:void 0;if(h){let a;try{a=new DOMException("Aborted","AbortError")}catch(d){a=new Error("Aborted"),a.name="AbortError"}if(h.aborted)return Promise.reject(a);let s=new Promise((d,v)=>{h.addEventListener("abort",()=>v(a),{once:!0})});return p&&p.signal&&delete p.signal,Promise.race([s,c(f,p)])}return c(f,p)},Request:n}}var O=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window;var nI=()=>"fetch"in O,pt=nI()&&ar({fetch:O.fetch,Request:O.Request,AbortController:O.AbortController}),ud=pt?Po({fetch:O.fetch,Request:O.Request,AbortController:O.AbortController}):void 0,Ue=pt?ud.fetch:O.fetch,rT=pt?ud.Request:O.Request,iT=pt?Se:O.AbortController,oT=pt?Be:O.AbortSignal;var cd=C(ge(),1),ld=C(Fe(),1),ne=require("@vkontakte/videoplayer-shared/es2018");var ht=class{constructor(e){var r;this.params=e,this.apiKey=e.config.apiKey,this.apiEnv=e.config.apiEnv,this.apiBaseUrl=(r=e.config.apiBaseUrl)!=null?r:ci[this.apiEnv],this.timeSynchronisation=e.timeSynchronisation,this.isApiBaseUrlFetched=!1}async resolveApiBaseUrl(){var e;if(this.apiEnv!=="auto"||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{let r=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=await(await Ue(r,{method:"GET",mode:"cors",cache:"no-cache"})).json(),n=(e=o==null?void 0:o.Answer[0])==null?void 0:e.data;if(!n)throw new Error("Wrong DNS response");return n}catch(r){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:ne.ErrorCategory.NETWORK,message:"Unhandled resolve api base url error",thrown:r}),ci.vk_alias}finally{this.isApiBaseUrlFetched=!0}}sendBeacon(e,r,i){if(!window.Blob||!window.navigator.sendBeacon)return!1;let o=this._prepareQueryParams({method:e,queryParams:r,sessionKey:i}),n=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,n)}catch(c){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:ne.ErrorCategory.NETWORK,message:"Unhandled beacon error",thrown:c,data:{method:e,params:r}})}return!1}async sendRequest(e,r,i){let o=(0,ne.now)(),n=l=>{if(l instanceof TypeError&&(0,cd.default)(["Failed to fetch","NetworkError when attempting to fetch resource."],l.message)){this.params.error$.next({id:"Network",category:ne.ErrorCategory.NETWORK,message:"Request failed",thrown:l});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:ne.ErrorCategory.NETWORK,message:"Unhandled request error",thrown:l,data:{method:e,params:r,sessionKey:i,time:(0,ne.now)()-o}})};this.apiBaseUrl=await this.resolveApiBaseUrl();let c={method:"post",headers:{"Content-type":"application/x-www-form-urlencoded"},body:this._prepareQueryParams({method:e,queryParams:r,sessionKey:i})};return this.params.config.useKeepalive&&(c.keepalive=!0),Ue(`${this.apiBaseUrl}/fb.do`,c).then(l=>{var a,s;let f=Number(l.headers.get("content-length"))===0,p=new Date((a=l.headers.get("date"))!=null?a:"").getTime(),h=(0,ne.now)()-o;if(isFinite(p)&&((s=this.timeSynchronisation)==null||s.addServerTime(p,h)),!f)return l.json().then(d=>Object.prototype.hasOwnProperty.call(d,"error_msg")?Promise.reject(d):d,n)},n)}_prepareQueryParams(e){let r=new URLSearchParams({format:"JSON",method:e.method,application_key:this.apiKey});return e.sessionKey!==void 0&&r.append("session_key",e.sessionKey),(0,ld.default)(e.queryParams).forEach(([i,o])=>r.append(i,typeof o=="string"?o:JSON.stringify(o))),r}};var dd=C(ge(),1),fd=C(Fe(),1),F=require("@vkontakte/videoplayer-shared/es2018"),sr="onestat_events",To=t=>e=>e.timestamp+t>=(0,F.now)(),ur=class{constructor(e){this.unsaltedStorage=[];this.isPaused=!1;this.isUrgent=e=>{let{operation:r}=e;return(0,dd.default)(["action_play","watch_coverage_record","watch_coverage_live"],r)};this.params=e,this.api=e.api,this.error$=e.error$,this.userSalt=e.userSalt,this.loggerDebugLog=e.debugLogger.createComponentLog("stat logger"),this.firstFlush=(0,F.debounceFn)(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});let r=F.safeStorage.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=(0,F.debounceFn)(()=>this.safeFlush(),this.params.config.flushDebounceTime,{maxWait:r}),this.subscription=this.api.authorized$.subscribe(i=>{i&&this.debouncedFlush()}),this.housekeepStorage()}safeFlush(){try{this.flush()}catch(e){this.error$.next({id:"LoggerError",category:F.ErrorCategory.WTF,message:e?String(e):"Unknown logger error",thrown:e})}}readFromStorage(){let e=F.safeStorage.get(sr);try{return e?JSON.parse(e):{}}catch(r){}return{}}addToStorage(e){var n;if(!this.userSalt){this.unsaltedStorage.push(e);return}let r=this.readFromStorage(),o=((n=r[this.userSalt])!=null?n:[]).filter(To(this.params.config.storageExpiration));F.safeStorage.set(sr,JSON.stringify({...r,[this.userSalt]:[...o,e]}))}getFromStorage(){var i;return this.userSalt?((i=this.readFromStorage()[this.userSalt])!=null?i:[]).filter(To(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}let e=this.readFromStorage();delete e[this.userSalt],F.safeStorage.set(sr,JSON.stringify(e))}housekeepStorage(){let e=this.readFromStorage();for(let[r,i]of(0,fd.default)(e)){let o=i.filter(To(this.params.config.storageExpiration));o.length?e[r]=o:delete e[r],this.loggerDebugLog({message:`${i.length} retrieved from storage, ${o.length} of them actual`})}F.safeStorage.set(sr,JSON.stringify(e))}log(e){this.addToStorage(e),!this.isPaused&&(this.isUrgent(e)?this.flush():this.lastVsid!==e.custom.vsid?this.firstFlush():this.debouncedFlush(),this.lastVsid=e.custom.vsid)}flush({wantBeacon:e,clearStorage:r}={wantBeacon:!1,clearStorage:!0}){let i=this.getFromStorage();i.length!==0&&(this.api.authorized$.getValue()?(e&&this.params.config.useBeacon?(this.loggerDebugLog({message:`Flushing ${i.length} events through beacon`}),this.api.logBeacon(i)):(this.loggerDebugLog({message:`Flushing ${i.length} events`}),this.api.logRequest(i)),r&&this.markStorageSent()):this.api.authorize(),this.firstFlush.cancel(),this.debouncedFlush.cancel())}pause(){this.isPaused=!0,this.debouncedFlush.cancel()}resume(){this.isPaused=!1,this.debouncedFlush()}destroy(){this.subscription.unsubscribe(),this.firstFlush.cancel(),this.debouncedFlush.cancel()}};var _=require("@vkontakte/videoplayer-core/es2018"),Eo=require("@vkontakte/videoplayer-shared/es2018");var pd=t=>t&&{[_.VideoQuality.INVARIANT]:"unknown",[_.VideoQuality.Q_144P]:"mobile",[_.VideoQuality.Q_240P]:"lowest",[_.VideoQuality.Q_360P]:"low",[_.VideoQuality.Q_480P]:"medium",[_.VideoQuality.Q_576P]:"unknown",[_.VideoQuality.Q_720P]:"high",[_.VideoQuality.Q_1080P]:"fullhd",[_.VideoQuality.Q_1440P]:"quadhd",[_.VideoQuality.Q_2160P]:"ultrahd",[_.VideoQuality.Q_4320P]:"unknown"}[t],wo=t=>t&&{[_.HttpConnectionType.HTTP1]:"http1",[_.HttpConnectionType.HTTP2]:"http2",[_.HttpConnectionType.QUIC]:"http3"}[t],hd=t=>{if(t!==void 0)switch(t){case _.VideoFormat.MPEG:return"mp4";case _.VideoFormat.DASH:case _.VideoFormat.DASH_LIVE:case _.VideoFormat.DASH_STREAMS:return"dash";case _.VideoFormat.DASH_SEP:return"dash_sep";case _.VideoFormat.DASH_ONDEMAND:return"ondemand_dash";case _.VideoFormat.DASH_WEBM:case _.VideoFormat.DASH_LIVE_WEBM:return"webm";case _.VideoFormat.DASH_WEBM_AV1:return"av1";case _.VideoFormat.DASH_LIVE_CMAF:return"ondemand_dash_live";case _.VideoFormat.HLS:case _.VideoFormat.HLS_LIVE:return"hls";case _.VideoFormat.HLS_FMP4:return"hls_fmp4";case _.VideoFormat.HLS_ONDEMAND:return"ondemand_hls";case _.VideoFormat.HLS_LIVE_CMAF:return"ondemand_hls_live";case _.VideoFormat.WEB_RTC_LIVE:return"webrtc";default:return(0,Eo.assertNever)(t)}},xo=(t,e)=>{if(e)return"minimal";switch(t){case void 0:case _.Surface.NONE:case _.Surface.INLINE:return;case _.Surface.FULLSCREEN:return"fullscreen";case _.Surface.SECOND_SCREEN:return"chromecast";case _.Surface.PIP:return"pip";case _.Surface.INVISIBLE:return"invisible";default:return(0,Eo.assertNever)(t)}},vd=t=>{switch(t){case"slow-2g":return"poor";case"2g":return"poor";case"3g":return"good";case"4g":return"excellent"}};var cr=class{constructor(e){this.offset=void 0;this.offset=e}getOffset(){var e;return(e=this.offset)!=null?e:0}setOffset(e){this.offset=e}now(){var e;return Date.now()+((e=this.offset)!=null?e:0)}date(e=new Date){var r;return e.setTime(e.getTime()+((r=this.offset)!=null?r:0)),e}addServerTime(e,r){let i=Date.now(),o=e-i-r/2;if(Math.abs(o)<1e3){this.offset=0;return}this.offset===void 0?this.offset=Math.round(o):this.offset=Math.round(.2*o+(1-.2)*this.offset)}};var gd=C(Rt(),1);var md=()=>(0,gd.default)(Math.floor(Math.random()*2**64).toString(36),13,"0");var Ao=require("@vkontakte/videoplayer-core/es2018"),w=require("@vkontakte/videoplayer-shared/es2018"),bd=(t,e)=>new w.Observable(r=>{let i=new w.Subscription,o=(0,w.merge)((0,w.fromEvent)(window,"beforeunload"),t.events.willDestruct$),n=new w.ValueSubject(void 0),c;i.add(t.info.isLive$.pipe((0,w.filterChanged)()).subscribe(P=>{c&&(c.unsubscribe(),n.next(void 0)),P?c=t.info.liveTime$.pipe((0,w.map)(q=>q&&q/1e3)).subscribe(n):c=t.info.position$.subscribe(n),i.add(c)}));let{playing$:l,paused$:f}=t.events,p=t.events.willSeek$.pipe((0,w.filter)(()=>t.info.playbackState$.getValue()===Ao.PlaybackState.PLAYING)),h=t.events.seeked$.pipe((0,w.filter)(()=>t.info.playbackState$.getValue()===Ao.PlaybackState.PLAYING)),a=!1,s=new w.Subject;i.add(p.subscribe(()=>{a||s.next(),a=!0})),i.add(h.subscribe(()=>a=!1));let d=new w.Subject,v=new w.Subject,g=(0,w.merge)(l,h,d),y=(0,w.merge)(f,s,o,t.events.looped$,v),S,T=()=>S=n.getValue(),N=()=>{let P=n.getValue();(0,w.isNullable)(S)||S===P||(0,w.isNullable)(P)||(r.next({from:S,to:P}),S=void 0)},U=()=>{v.next(),d.next()};if(i.add(g.subscribe(T)),i.add(y.subscribe(N)),e.forceInterval&&isFinite(e.forceInterval))if(e.watchCoverageTimeoutFix){let P,q=()=>{P!==void 0&&(window.clearTimeout(P),P=void 0)};i.add(g.subscribe(()=>{q(),P=window.setTimeout(U,e.forceInterval)})),i.add(y.subscribe(()=>q())),i.add(()=>q())}else{let P=0;i.add(g.subscribe(()=>P=window.setTimeout(U,e.forceInterval))),i.add(y.subscribe(()=>window.clearTimeout(P)))}return i});var z=require("@vkontakte/videoplayer-core/es2018"),je=require("@vkontakte/videoplayer-shared/es2018"),lr=(t,e,r)=>{let i=new je.Subject,o=i.pipe((0,je.debounce)(0),(0,je.filterChanged)()),n=!1,c=!1,l=!1;return e(t.inPiP$,f=>{n=f,i.next(f?z.Surface.PIP:c?z.Surface.FULLSCREEN:l?z.Surface.INLINE:void 0)}),e(t.inFullscreen$,f=>{c=f,i.next(f?z.Surface.FULLSCREEN:n?z.Surface.PIP:l?z.Surface.INLINE:void 0)}),r&&e(r.info.surface$,f=>{switch(f){case z.Surface.SECOND_SCREEN:case z.Surface.NONE:case z.Surface.INLINE:{!c&&!n&&(f===z.Surface.INLINE&&(l=!0),i.next(f));break}}}),{surface$:o}};var aI="_one-stat_",yd=`${aI}deviceId`,Oo=()=>{let t=new b.Subscription;return{subscription:t,subscribe:(e,r)=>{e&&t.add(e.subscribe(r))}}},dr=class{constructor(e,r){this.subscription=new b.Subscription;this.debugLogger=new fr.Logger;this.oneStatDebugLog=this.debugLogger.createComponentLog("onestat");this.loopCounter=0;this.disabled=!1;this.isid$=new b.ValueSubject(void 0);this.zenUid$=new b.ValueSubject(void 0);this.seekAction$=new b.ValueSubject("unknown");var f,p,h;this.statContext=e,this.config=Ua((f=r.config)!=null?f:{}),(0,b.isNonNullable)(r.apiEnv)&&(this.config.apiEnv=r.apiEnv),this.config.synchronizeTime&&(this.timeSynchronisation=new cr);let i=new b.Subject;this.experimental={error$:i};let o=b.safeStorage.get(yd);this.statContext.deviceId?this.deviceId=this.statContext.deviceId:o?this.deviceId=o:(this.deviceId=li(),b.safeStorage.set(yd,this.deviceId)),this.resetViewSession(),r.useIsid&&this.isid$.next((p=r.isid)!=null?p:md()),this.zenUid$.next(r.zenUid);let n=new ht({config:this.config,error$:i,timeSynchronisation:this.timeSynchronisation});this.api=new ft({config:this.config,apiTransport:n,refreshAuthToken:r.refreshAuthToken,mobile:(h=this.statContext.mobile)!=null?h:!1,deviceId:this.deviceId,error$:i,vktvVersion:r.vktvVersion}),this.logger=new ur({config:this.config,debugLogger:this.debugLogger,api:this.api,error$:i,userSalt:r.userSalt});let{isEmbed:c,topOrigin:l}=(0,fr.detectEmbed)();this.isEmbed=c,this.embedParent=l?new URL(l).hostname:void 0,this.subscribe()}get vsid$(){return new b.ValueSubject(ce.getVSID())}updateContext(e){this.statContext={...this.statContext,...e}}attachTo(e){let r=new b.Subscription,i=(s,d)=>r.add(s.subscribe(d));i(e.events.willStart$,()=>{let s=e.info.position$.getValue();this.logActionPlay({position:s}),this.statContext.projectId&&this.logActionPlayInteractive()}),i(e.events.looped$,()=>{this.resetViewSession(),++this.loopCounter>this.config.maxLoops&&(this.disabled=!0),this.logActionPlay({position:e.info.position$.getValue()})}),i(e.events.seeked$,()=>{this.logSeek({action:this.seekAction$.getValue(),time:e.info.position$.getValue()}),this.seekAction$.next("unknown")}),i(e.events.paused$,()=>{this.logPause({position:e.info.position$.getValue()})}),i(e.events.willResume$,()=>{this.logPlay()}),i(e.events.started$,()=>{this.statContext.clip&&this.logWatchCoverageRecord({start:0,end:0})}),i(e.events.playing$,()=>{this.logPlaying()}),i(bd(e,{forceInterval:this.config.watchCoverageInterval,watchCoverageTimeoutFix:this.config.watchCoverageTimeoutFix}),s=>{var y,S,T,N;let d=e.info.isLive$.getValue(),v=e.info.atLiveEdge$.getValue(),g={start:parseFloat(s.from.toFixed(3)),end:parseFloat(s.to.toFixed(3))};if(v){let U=(y=e.info.liveLatency$.getValue())!=null?y:0,P=(T=(S=e.info.currentBuffer$.getValue())==null?void 0:S.end)!=null?T:0,q=(N=e.info.liveBufferTime$.getValue())!=null?N:0,se=Math.round((U-(P-q))*1e3),ue=Math.round(U*1e3);se&&ue&&(g.latency=se,g.bufferLatency=ue)}d?this.logWatchCoverageLive(g):this.logWatchCoverageRecord(g)});let o;i(e.info.isStalled$,s=>{s?o=(0,b.now)():((0,b.isNonNullable)(o)&&this.logEmptyBuffer({duration:(0,b.now)()-o}),o=void 0)});let n=!1;r.add(e.events.fatalError$.pipe((0,b.once)()).subscribe(()=>n=!0)),i(e.events.willStop$,()=>{if(e.info.isStalled$.getValue()){let d=(0,b.isNonNullable)(o)?(0,b.now)()-o:void 0;this.logCloseAtEmptyBuffer({duration:d!=null?d:0}),o=void 0}else n||this.logActionStop()}),i(e.events.managedError$,({id:s})=>{this.logError({fatal:!1,errorType:s})}),i(e.events.fatalError$,({id:s})=>{this.logError({fatal:!0,errorType:s})});let c,l,f=!1;i(e.events.firstBytes$,s=>{c=(0,b.now)(),this.logFirstBytes({time:s})}),i(e.events.willStart$,()=>l=(0,b.now)()),i(e.info.currentBuffer$,s=>{!f&&s&&s.end-s.start>0&&(0,b.isNonNullable)(c)&&(this.logPlayerReady({duration:(0,b.now)()-c}),f=!0)}),i(e.events.firstFrame$,()=>{(0,b.isNonNullable)(c)&&!f&&(this.logPlayerReady({duration:(0,b.now)()-c}),f=!0),(0,b.isNonNullable)(l)&&this.logFirstFrame({time:(0,b.now)()-l})});let p;i(e.info.currentVideoStream$,s=>{s&&(p&&s.id!==p&&this.logTrackSwitch(s),p=s.id)});let h;i(e.info.currentAudioStream$,s=>{s&&(h&&s.id!==h&&this.logTrackSwitch(s),h=s.id)}),i(e.info.atLiveEdge$,s=>this.updateContext({liveEdge:s})),i((0,b.combine)({muted:e.info.muted$,volume:e.info.volume$}),({muted:s,volume:d})=>this.updateContext({audible:!s&&d>0})),i(e.info.currentQuality$,s=>{let d=pd(s);this.updateContext({quality:d}),d&&this.logQuality(d)}),i(e.info.isAutoQualityEnabled$,s=>this.updateContext({autoQuality:s})),i(e.info.currentFormat$,s=>this.updateContext({contentType:hd(s)})),i(e.info.currentPlaybackRate$,s=>this.updateContext({rate:s})),i(e.info.is3DVideo$,s=>this.updateContext({is3d:s}));let a;return i(e.info.hostname$,s=>{let d=a!==void 0&&a!==s;this.updateContext({cdnHostname:s,failover:d}),d&&this.logFailover(s),a=s}),i(e.info.throughputEstimation$,s=>this.updateContext({downloadSpeed:s})),i(e.info.httpConnectionType$,s=>{this.statContext.firstConnectionType||this.updateContext({firstConnectionType:wo(s)}),this.updateContext({connectionType:wo(s)})}),i(e.info.httpConnectionReused$,s=>{(0,b.isNullable)(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:s}),this.updateContext({connectionReused:s})}),i(e.info.surface$,s=>{this.uiEvents||this.updateContext({mode:xo(s,this.statContext.isPreviewPlayerView)})}),i((0,b.combine)({current:e.info.currentTextTrack$,available:e.info.availableTextTracks$}),({current:s,available:d})=>{let v=d.find(({id:y})=>y===s),g=v&&(v.isAuto?`${v.language}_auto`:v.language);this.updateContext({subtitles:g==null?void 0:g.split(".")[0]})}),this.player=e,this.uiEvents&&this.attachToUi(this.uiEvents),this.resubscribeBeforeunload(),this.subscription.add(r),r}attachToUi(e){this.uiEvents=e;let{subscription:r,subscribe:i}=Oo();if(!this.player)return r;i(e.actionRewind$,()=>{this.player&&(this.resetViewSession(),this.logActionPlay({position:this.player.info.position$.getValue()}))}),i(e.actionSeek$,this.seekAction$);let{surface$:o}=lr(this.uiEvents,i,this.player);return i(o,n=>{this.updateContext({mode:xo(n,this.statContext.isPreviewPlayerView)})}),i(e.actionSetSubtitle$,n=>this.updateContext({subtitles:n==null?void 0:n.split(".")[0]})),i(e.nextMovie$,n=>this.logNextMovie(n)),this.resubscribeBeforeunload(),this.subscription.add(r),r}attachToAds(e){let{subscription:r,subscribe:i}=Oo();return i(e.slotRequested$,()=>this.logAdSlotRequest()),i(e.started$,o=>this.logAdStarted(o)),i(e.paused$,()=>this.logAdPaused()),i(e.resumed$,()=>this.logAdResumed()),i(e.ended$,()=>this.logAdEnded()),i(e.skipped$,()=>this.logAdSkipped()),i(e.clicked$,()=>this.logAdClicked()),i(e.error$,o=>this.logError({errorType:o,fatal:!1})),this.resubscribeBeforeunload(),this.subscription.add(r),r}attachToInteractive(e){let{subscription:r,subscribe:i}=Oo();return i(e.click$,o=>this.logInterfaceClick(o)),i(e.nextMovie$,o=>this.logNextMovie(o)),this.resubscribeBeforeunload(),this.subscription.add(r),r}authorize(e){return this.api.authorize(e)}pause(){this.logger.pause(),this.oneStatDebugLog({message:"paused"})}resume(){this.logger.resume(),this.oneStatDebugLog({message:"resumed"})}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.oneStatDebugLog({message:"VSID reset"}),ce.generateVSID()}getDeviceId(){return this.deviceId}setFieldBlacklist(){}logInited(){}logReady(e){this.log({operation:"player_ready",param:String(e.time)})}logStarted(...e){this.logActionPlay(...e)}logPlay(){this.log({operation:"play_toggle"})}logPlaying(){this.log({operation:"playing"})}logPause(e){this.log({operation:"pause",param:String(Math.round(e.position))})}logSeek(e){this.log({operation:"seek",param:e.action,time:e.time})}logFirstBytes(e){this.log({operation:"first_bytes",param:String(e.time)})}logFirstFrame(e){this.log({operation:"first_frame",param:String(e.time)})}logError(e){this.log({operation:"content_error",param:`${e.fatal?"fatal":"recoverable"}_${e.errorType}`})}logWatchCoverageRecord(e){this.log({operation:"watch_coverage_record",param:`${e.start}-${e.end}`},{in_history:this.statContext.inHistory?1:void 0})}logWatchCoverageLive(e){var n,c;let r=(c=(n=this.timeSynchronisation)==null?void 0:n.getOffset())!=null?c:0,i=e.start+r,o=e.end+r;this.log({operation:"watch_coverage_live",param:`${i}-${o}`},{in_history:this.statContext.inHistory?1:void 0,latency:e.latency,buffer_latency:e.bufferLatency})}logEmptyBuffer(e){this.log({operation:"empty_buffer",param:String(e.duration)})}logDownloadSpeed(){}logAdSlotRequest(){this.log({operation:"adv",param:"slot_request"})}logAdStarted(e){this.log({operation:"adv",param:e})}logAdPaused(){this.log({operation:"adv",param:"pause"})}logAdResumed(){this.log({operation:"adv",param:"resume"})}logAdEnded(){this.log({operation:"adv",param:"ended"})}logAdSkipped(){this.log({operation:"adv",param:"skip"})}logAdClicked(){this.log({operation:"adv",param:"click"})}logInterfaceClick(e){this.log({operation:"player_interface_click",param:e})}logNextMovie(e){this.log({operation:"next_movie",param:String(e)})}subscribe(){this.resubscribeBeforeunload();let e=window.navigator.connection;e&&"onchange"in e&&"effectiveType"in e&&this.subscription.add((0,b.merge)((0,b.fromEvent)(e,"change"),(0,b.observableFrom)(["init"])).subscribe(()=>this.updateContext({network:vd(e.effectiveType)}))),this.config.debugLog&&this.debugLogger.log$.subscribe(r=>{console.debug("%c stat ","background:#fa6470;",`component: ${r.component}.`,r.message)})}resubscribeBeforeunload(){var e;(e=this.beforeunloadSubscription)==null||e.unsubscribe(),this.beforeunloadSubscription=(0,b.fromEvent)(window,"beforeunload").subscribe(()=>this.logger.flush({wantBeacon:!0,clearStorage:this.config.clearStorageAtUnload})),this.subscription.add(this.beforeunloadSubscription)}logPlayerReady(e){this.log({operation:"player_ready",param:String(Math.round(e.duration))})}logActionPlay(e){this.log({operation:"action_play",param:String(Math.round(e.position))})}logActionPlayInteractive(){this.statContext.projectId&&this.log({operation:"action_play_interactive",param:String(this.statContext.movieId)},{vid:this.statContext.projectId})}logFailover(e){this.log({operation:"failover",param:e})}logCloseAtEmptyBuffer(e){this.log({operation:"close_at_empty_buffer",param:String(Math.round(e.duration))})}logActionStop(){this.log({operation:"action_stop"})}logTrackSwitch(e){this.log({operation:"track_switch",param:e.id})}logQuality(e){this.log({operation:"quality",param:e})}log(e,r={}){if(this.disabled){this.oneStatDebugLog({message:`operation ${e.operation} but statistics is disabled`});return}if((0,Co.default)(this.config.disabledOperations,e.operation)){this.oneStatDebugLog({message:`operation ${e.operation} but it is disabled`});return}this.oneStatDebugLog({message:`operation ${e.operation} ${e.param}`});let i=this.createLogItem(e,r);this.logger.log(i)}createLogItem({operation:e,param:r,time:i},o={}){var d,v;let n=(v=(d=this.timeSynchronisation)==null?void 0:d.now())!=null?v:(0,b.now)(),c=this.vsid$.getValue();(0,b.assertNonNullable)(c);let l=this.isid$.getValue(),f=e==="empty_buffer"||e==="close_at_empty_buffer"?this.statContext.connectionType:this.statContext.firstConnectionType,p=this.statContext.firstConnectionReused,h,a;if(this.isEmbed||this.statContext.place==="embed"){h=this.embedParent;let g=[...new URLSearchParams(location.search).entries()].filter(([y,S])=>(0,Co.default)(this.config.embedUrlParams,y));a=new URLSearchParams(g).toString()}else if(this.statContext.place==="direct"){let g=this.statContext.refDomain||document.referrer;g&&Na(URL,g)?h=new URL(g).hostname:h=g,a=location.href.substring(0,1024)}let s={vsid:c,isid:l,vid:this.statContext.movieId,uid:this.zenUid$.getValue(),ct:this.statContext.contentType,place:this.isEmbed?"embed":this.statContext.place,quality:this.statContext.quality,cdn_host:this.statContext.cdnHostname,stat_type:this.statContext.autoplay===!0?"auto":this.statContext.autoplay===!1?"":void 0,param:r,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode,connection_type:f,connection_reused:p===!0?1:p===!1?0:void 0,cached_data:this.statContext.cached===!0?1:this.statContext.cached===!1?0:void 0,live:this.statContext.liveEdge?1:void 0,muted:this.statContext.audible===!1?1:void 0,mode:this.statContext.mode,subtitles:this.statContext.subtitles,download_speed:this.statContext.downloadSpeed,manual_quality:this.statContext.autoQuality?void 0:1,ref_domain:h,direct_url:a,rate:this.statContext.rate===1||(0,b.isNullable)(this.statContext.rate)?void 0:this.statContext.rate.toFixed(2),view_360:this.statContext.is3d?1:void 0,aid:this.statContext.albumId,vk_playlist_id:this.statContext.vkPlaylistId,...o};for(let g of this.config.disabledCustomFields)delete s[g];return{operation:e,type:1,time:i,network:this.statContext.network,timestamp:n,custom:s}}};var Pr={};Fo(Pr,{ActionSeekType:()=>pr,ThinOneStat:()=>Sr,VERSION:()=>V});var Kd=C(wd(),1),Qd=C(ge(),1),m=require("@vkontakte/videoplayer-shared/es2018"),X=require("@vkontakte/videoplayer-core/es2018");var Od=require("@vkontakte/videoplayer-shared/es2018");var qo=(i=>(i.AUTO="auto",i.AUTO_POOR="auto_poor",i.AUTO_RICH="auto_rich",i))(qo||{});var pr=(l=>(l.SLIDER="slider",l.DOUBLE_TAP="double_tap",l.TIME_CODE="time_code",l.EPISODE="episode",l.REWIND="rewind",l.LIVE="live",l.UNKNOWN="unknown",l))(pr||{});var Ad="CIOPGQJGDIHBABABA",Ro={prod:"https://api.ok.ru",vk_alias:"https://api.mycdn.me",videotest:"https://videotestapi.ok.ru/api",test:"https://apitest.ok.ru",okcdn:"https://api.okcdn.ru",auto:""};var fI={apiKey:Ad,apiEnv:"okcdn",apiBaseUrl:null,requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageHeartbeatInterval:30,synchronizeTime:!0,useBeacon:!1,alwaysSendDesktop:!1,watchedNFirstTvtLog:1e3,watchedNDefaultTargetDuration:1e4},Cd=t=>(0,Od.fillWithDefault)(t,fI);var ko=C(io(),1),Y=require("@vkontakte/videoplayer-shared/es2018");var hr=class{constructor(e){this.params=e,this.authorized$=new Y.ValueSubject(!1),this.consequentAuthErrors=0}async authorize(e){return this.authToken=e!=null?e:await this.refreshAuthToken(),this.authorizeWithBackoff()}logBeacon(e){let r="log.logUvStat",i=this.createLogParams(e),o=this.sessionKey;if(!o)return;this.params.apiTransport.sendBeacon(r,i,o)||this.logRequest(e).catch(()=>{})}async logRequest(e){var l;let r="log.logUvStat",i=this.createLogParams(e),o={},n=(l=this.sessionKey)!=null?l:await this.authorizeWithBackoff();if(!n)return;let c=async(f,p=this.params.config.requestRetryCount)=>{try{return await this.params.apiTransport.sendRequest(r,i,n,o)}catch(h){if(!h||!("error_code"in h)){this.params.error$.next({id:"logRequestUnknown",category:Y.ErrorCategory.NETWORK,message:`Unknown ${r} error`,thrown:h});return}let a=h==null?void 0:h.error_code;switch(a){case 102:case 103:case 104:return this.authorized$.next(!1),this.sessionKey=await this.authorizeWithBackoff(),p>0?c(f,p-1):void 0;case 401:return this.authorized$.next(!1),this.authToken=await this.refreshAuthToken(),this.sessionKey=await this.authorizeWithBackoff(),p>0?c(f,p-1):void 0;default:{this.params.error$.next({id:`LogRequest#${a}`,category:Y.ErrorCategory.EXTERNAL_API,message:`${r} error`,data:h});return}}}};return c(e)}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}async refreshAuthToken(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=(0,ko.default)(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise}createLogParams(e){return{collector:"ok.mobile.apps.video",uv_stat_data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${V}`,platform:e[0].platform,product:e[0].product,events:e})}}authorizeWithBackoff(){if(!this.consequentAuthErrors)return this.doAuthorize();let e=(0,Y.getExponentialDelay)(this.consequentAuthErrors);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(async()=>{try{let i=await this.doAuthorize();r(i)}catch(i){this.params.error$.next({id:"AuthorizeBackoff",category:Y.ErrorCategory.NETWORK,message:"Otherwise unhandled error in authorization",thrown:i})}finally{this.backoffTimeoutId=0}},e))})}doAuthorize(){if(this.authorizePromise)return this.authorizePromise;this.sessionKey=void 0,this.authorized$.next(!1);let e="auth.anonymLogin",r={session_data:{version:2,device_id:this.params.deviceId,client_version:V.split("-")[0],client_type:"SDK_JS"}};return this.authToken!==void 0&&(r.session_data.auth_token=this.authToken,r.session_data.version=3),this.authorizePromise=(0,ko.default)(this.params.apiTransport.sendRequest(e,r).then(i=>{var o;return(!i||!i.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:Y.ErrorCategory.EXTERNAL_API,message:"No session key",data:i}),this.sessionKey=(o=i==null?void 0:i.session_key)!=null?o:void 0,this.sessionKey}).catch(async i=>{this.sessionKey=void 0;let o=i==null?void 0:i.error_code;switch(o){case 401:return this.authToken=await this.refreshAuthToken(),this.authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:Y.ErrorCategory.EXTERNAL_API,message:"authorize error",data:i}):this.params.error$.next({id:"AuthorizeUnknown",category:Y.ErrorCategory.NETWORK,message:"authorize error",thrown:i})}),()=>{this.authorizePromise=void 0,this.consequentAuthErrors=this.sessionKey?0:this.consequentAuthErrors+1,this.authorized$.next(this.sessionKey!==void 0)}),this.authorizePromise}};var qd=C(ge(),1);var Rd=C(Fe(),1),ae=require("@vkontakte/videoplayer-shared/es2018");var vr=class{constructor(e){var r;this.params=e,this.apiKey=e.config.apiKey,this.apiEnv=e.config.apiEnv,this.apiBaseUrl=(r=e.config.apiBaseUrl)!=null?r:Ro[this.apiEnv],this.timeSynchronisation=e.timeSynchronisation,this.isApiBaseUrlFetched=!1}sendBeacon(e,r,i){if(!window.Blob||!window.navigator.sendBeacon)return!1;let o=this.prepareQueryParams({method:e,queryParams:r,sessionKey:i}),n=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,n)}catch(c){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:ae.ErrorCategory.NETWORK,message:"Unhandled beacon error",thrown:c,data:{method:e,params:r}})}return!1}async sendRequest(e,r,i,o){let n=(0,ae.now)(),c=l=>{if(l instanceof TypeError&&(0,qd.default)(["Failed to fetch","NetworkError when attempting to fetch resource."],l.message)){this.params.error$.next({id:"Network",category:ae.ErrorCategory.NETWORK,message:"Request failed",thrown:l});return}this.params.error$.next({id:"ThinOneStat:ApiTransport:sendRequest",category:ae.ErrorCategory.NETWORK,message:"Unhandled request error",thrown:l,data:{method:e,params:r,sessionKey:i,time:(0,ae.now)()-n}})};return this.apiBaseUrl=await this.resolveApiBaseUrl(),Ue(`${this.apiBaseUrl}/fb.do`,{method:"post",headers:{"Content-type":"application/x-www-form-urlencoded",...o},body:this.prepareQueryParams({method:e,queryParams:r,sessionKey:i})}).then(l=>{var a,s;let f=Number(l.headers.get("content-length"))===0,p=new Date((a=l.headers.get("date"))!=null?a:"").getTime(),h=(0,ae.now)()-n;if(isFinite(p)&&((s=this.timeSynchronisation)==null||s.addServerTime(p,h)),!f)return l.json().then(d=>Object.prototype.hasOwnProperty.call(d,"error_msg")?Promise.reject(d):d,c)},c)}async resolveApiBaseUrl(){var e;if(this.apiEnv!=="auto"||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{let r=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=await(await Ue(r,{method:"GET",mode:"cors",cache:"no-cache"})).json(),n=(e=o==null?void 0:o.Answer[0])==null?void 0:e.data;if(!n)throw new Error("Wrong DNS response");return n}catch(r){return this.params.error$.next({id:"ThinOneStat:ApiTransport:resolveApiBaseUrl",category:ae.ErrorCategory.NETWORK,message:"Unhandled resolve api base url error",thrown:r}),Ro.vk_alias}finally{this.isApiBaseUrlFetched=!0}}prepareQueryParams(e){let r=new URLSearchParams({format:"JSON",method:e.method,application_key:this.apiKey});return e.sessionKey!==void 0&&r.append("session_key",e.sessionKey),(0,Rd.default)(e.queryParams).forEach(([i,o])=>r.append(i,typeof o=="string"?o:JSON.stringify(o))),r}};var kd=C(ge(),1),Ld=C(Fe(),1),B=require("@vkontakte/videoplayer-shared/es2018"),gr="thinonestat_events",Lo=t=>e=>e.client_time+t>=(0,B.now)(),mr=class{constructor(e){this.unsaltedStorage=[];this.isPaused=!1;this.isUrgent=e=>{let{event_name:r}=e;return(0,kd.default)(["watch_coverage","watch_coverage_live","watched_n","playback_started"],r)};this.params=e,this.api=e.api,this.error$=e.error$,this.userSalt=e.userSalt,this.loggerDebugLog=e.debugLogger.createComponentLog("stat logger"),this.firstFlush=(0,B.debounceFn)(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});let r=B.safeStorage.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=(0,B.debounceFn)(()=>this.safeFlush(),this.params.config.flushDebounceTime,{maxWait:r}),this.subscription=this.api.authorized$.subscribe(i=>{i&&this.debouncedFlush()}),this.housekeepStorage()}safeFlush(){try{this.flush()}catch(e){this.error$.next({id:"LoggerError",category:B.ErrorCategory.WTF,message:String(e)||"Unknown logger error",thrown:e})}}readFromStorage(){let e=B.safeStorage.get(gr);try{return e?JSON.parse(e):{}}catch(r){}return{}}addToStorage(e){var n;if(!this.userSalt){this.unsaltedStorage.push(e);return}let r=this.readFromStorage(),o=((n=r[this.userSalt])!=null?n:[]).filter(Lo(this.params.config.storageExpiration));B.safeStorage.set(gr,JSON.stringify({...r,[this.userSalt]:[...o,e]}))}getFromStorage(){var i;return this.userSalt?((i=this.readFromStorage()[this.userSalt])!=null?i:[]).filter(Lo(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}let e=this.readFromStorage();delete e[this.userSalt],B.safeStorage.set(gr,JSON.stringify(e))}housekeepStorage(){let e=this.readFromStorage();for(let[r,i]of(0,Ld.default)(e)){let o=i.filter(Lo(this.params.config.storageExpiration));o.length?e[r]=o:delete e[r],this.loggerDebugLog({message:`${i.length} retrieved from storage, ${o.length} of them actual`})}B.safeStorage.set(gr,JSON.stringify(e))}log(e){this.addToStorage(e),!this.isPaused&&(this.isUrgent(e)?this.flush():this.lastVsid!==e.vsid?this.firstFlush():this.debouncedFlush(),this.lastVsid=e.vsid)}flush({wantBeacon:e,clearStorage:r}={wantBeacon:!1,clearStorage:!0}){let i=this.getFromStorage();i.length!==0&&(this.api.authorized$.getValue()?(e&&this.params.config.useBeacon?(this.loggerDebugLog({message:`Flushing ${i.length} events through beacon`}),this.api.logBeacon(i)):(this.loggerDebugLog({message:`Flushing ${i.length} events`}),this.api.logRequest(i)),r&&this.markStorageSent()):this.api.authorize(),this.firstFlush.cancel(),this.debouncedFlush.cancel())}pause(){this.isPaused=!0,this.debouncedFlush.cancel()}resume(){this.isPaused=!1,this.debouncedFlush()}destroy(){this.subscription.unsubscribe(),this.firstFlush.cancel(),this.debouncedFlush.cancel()}};function No(){let t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),e=new Array(36),r=0,i,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?e[o]="-":o===14?e[o]="4":(r<=2&&(r=33554432+Math.random()*16777216|0),i=r&15,r=r>>4,e[o]=t[o===19?i&3|8:i]);return e.join("")}var br=class{constructor(e){this.offset=void 0;this.offset=e}getOffset(){var e;return(e=this.offset)!=null?e:0}setOffset(e){this.offset=e}now(){var e;return Date.now()+((e=this.offset)!=null?e:0)}date(e=new Date){var r;return e.setTime(e.getTime()+((r=this.offset)!=null?r:0)),e}addServerTime(e,r){let i=Date.now(),o=e-i-r/2;if(Math.abs(o)<1e3){this.offset=0;return}this.offset===void 0?this.offset=Math.round(o):this.offset=Math.round(.2*o+(1-.2)*this.offset)}};var $o=require("@vkontakte/videoplayer-core/es2018"),E=require("@vkontakte/videoplayer-shared/es2018"),Nd=(t,e,r)=>new E.Observable(i=>{let o=new E.Subscription,n=new E.ValueSubject(void 0),c;o.add(t.info.isLive$.pipe((0,E.filterChanged)()).subscribe(j=>{c&&(c.unsubscribe(),n.next(void 0)),j?c=t.info.liveTime$.pipe((0,E.filterChanged)()).subscribe(n):c=t.info.position$.subscribe(n),o.add(c)}));let{playing$:l,paused$:f,ended$:p,looped$:h}=t.events,a=t.events.willSeek$.pipe((0,E.filter)(()=>t.info.playbackState$.getValue()===$o.PlaybackState.PLAYING)),s=t.events.seeked$.pipe((0,E.filter)(()=>t.info.playbackState$.getValue()===$o.PlaybackState.PLAYING)),d=!1,v=new E.Subject;o.add(a.subscribe(()=>{d||v.next(),d=!0})).add(s.subscribe(()=>d=!1));let g=(0,E.merge)((0,E.fromEvent)(window,"beforeunload"),t.events.willDestruct$),y,S=()=>y=n.getValue(),T=()=>{let j=n.getValue();(0,E.isNullable)(y)||(0,E.isNullable)(j)||y===j||(i.next({from:y,to:j}),y=void 0)},N=new E.Subject,U=new E.Subject,P=(0,E.merge)(l,v,N),q=(0,E.merge)(f,s,g,p,h,U),se=e.started$&&e.ended$?(0,E.merge)(P,e.ended$):P,ue=e.started$&&e.ended$?(0,E.merge)(q,e.started$):q;if(o.add(se.subscribe(S)).add(ue.subscribe(T)),r.heartbeatInterval&&isFinite(r.heartbeatInterval)){let j=[],wr=r.heartbeatInterval*1e3,ef=()=>{U.next(),N.next()};o.add(se.subscribe(()=>{let xr=window.setTimeout(ef,wr);j.push(xr)})).add(ue.subscribe(()=>{j.forEach(xr=>{window.clearTimeout(xr)}),j=[]}))}return o});var $d=require("@vkontakte/videoplayer-core/es2018"),yr=require("@vkontakte/videoplayer-shared/es2018"),Dd=(t,e)=>new yr.Observable(r=>{let i=new $d.Subscription,o=0;return i.add((0,yr.merge)(t.info.position$,t.info.liveTime$).subscribe(()=>{let n=e.getTotalViewTime();if(n>o){let c=e.firstTvtLog>o&&e.firstTvtLog<=n,l=Math.floor(n/e.targetDuration)>Math.floor(o/e.targetDuration);(c||l)&&(o=n,r.next({target_duration:e.targetDuration,current_tvt:n}))}})),i});var Md=require("@vkontakte/videoplayer-core/es2018"),Pe=require("@vkontakte/videoplayer-shared/es2018"),Vd=t=>new Pe.Observable(e=>{let r=new Md.Subscription,i={maxBytesThreshold:10*1024*1024,minBytesThreshold:100*1024,maxTimeWindow:1e4,minTimeWindow:2e3},o={bytes:0,startTime:0,lastEmitTime:0,timeoutId:0},n=()=>{o.timeoutId&&((0,Pe.getWindow)().clearTimeout(o.timeoutId),o.timeoutId=null)},c=()=>{o.bytes=0,o.startTime=0,o.lastEmitTime=0,n()},l=h=>{if(o.bytes<i.minBytesThreshold||h-o.lastEmitTime<i.minTimeWindow&&o.lastEmitTime>0)return!1;let s=o.startTime>0?h-o.startTime:0,d=o.bytes>=i.maxBytesThreshold,v=s>=i.maxTimeWindow;return d||v},f=(h=!1)=>{let a=Date.now();if(!h&&!l(a))return;n();let s=o.startTime>0?a-o.startTime:Math.max(i.minTimeWindow,1),d=o.bytes/(s/1e3);e.next({download_bytes:Math.round(o.bytes),download_speed:Math.round(d)}),o.lastEmitTime=a,c()},p=()=>{if(n(),o.startTime>0&&o.bytes>=i.minBytesThreshold){let a=Date.now()-o.startTime,s=i.maxTimeWindow-a;s>100?o.timeoutId=(0,Pe.getWindow)().setTimeout(()=>{o.timeoutId=null,f()},s):s>0&&f()}};return r.add(t.info.httpDownloadMetrics$.pipe((0,Pe.filter)(h=>h!==void 0)).subscribe(h=>{let a=Date.now();o.startTime===0&&(o.startTime=a),o.bytes+=h.bytes,l(a)?f():p()})),r.add(()=>{if(n(),o.bytes>0){let h=Date.now(),a=o.startTime>0?h-o.startTime:i.minTimeWindow,s=o.bytes/(a/1e3);e.next({download_bytes:Math.round(o.bytes),download_speed:Math.round(s)})}c()}),r});var Te=require("@vkontakte/videoplayer-shared/es2018"),Fd=t=>new Te.Observable(e=>{let r=new Te.Subscription,i=0,o=1,n=0,c=!1,l=!1,f=()=>{if(!c)return;let P=Date.now();n+=(P-i)*o,i=P},p=()=>{(!c||l)&&(i=Date.now(),c=!0,l=!1)},h=()=>{c&&(f(),c=!1)},a=()=>{c&&(f(),c=!1,l=!0)},s=P=>{c&&f(),o=P,i=Date.now()},{started$:d,playing$:v,paused$:g,willSeek$:y,ended$:S,willDestruct$:T}=t.events,{currentPlaybackRate$:N}=t.info;r.add(y.subscribe(a)).add((0,Te.merge)(d,v).subscribe(p)).add((0,Te.merge)(g,S,T).subscribe(h)).add(N.subscribe(s));let U=()=>{let P=n;return c&&(P+=(Date.now()-i)*o),P};return e.next(U),r});var Do=require("@vkontakte/videoplayer-shared/es2018"),I=require("@vkontakte/videoplayer-core/es2018");var Mo=t=>t&&{[I.HttpConnectionType.HTTP1]:"http1",[I.HttpConnectionType.HTTP2]:"http2",[I.HttpConnectionType.QUIC]:"http3"}[t],vt=t=>{if(t!==void 0)switch(t){case I.VideoFormat.MPEG:return"MP4";case I.VideoFormat.DASH:case I.VideoFormat.DASH_LIVE:return"DASH";case I.VideoFormat.DASH_SEP:return"DASH_SEP";case I.VideoFormat.DASH_ONDEMAND:return"ONDEMAND_DASH";case I.VideoFormat.HLS_ONDEMAND:return"ONDEMAND_HLS";case I.VideoFormat.HLS:case I.VideoFormat.HLS_LIVE:return"HLS";case I.VideoFormat.HLS_FMP4:return"HLS_FMP4";case I.VideoFormat.DASH_WEBM:case I.VideoFormat.DASH_LIVE_WEBM:return"WEBM";case I.VideoFormat.DASH_LIVE_CMAF:return"ONDEMAND_DASH_LIVE";case I.VideoFormat.HLS_LIVE_CMAF:return"ONDEMAND_HLS_LIVE";case I.VideoFormat.WEB_RTC_LIVE:return"WEBRTC";case I.VideoFormat.DASH_WEBM_AV1:return"AV1";case I.VideoFormat.DASH_STREAMS:return"MULTI_DASH";default:return(0,Do.assertNever)(t)}},J=t=>{if(t!==void 0)switch(t){case I.VideoQuality.Q_144P:return"144p";case I.VideoQuality.Q_240P:return"240p";case I.VideoQuality.Q_360P:return"360p";case I.VideoQuality.Q_480P:return"480p";case I.VideoQuality.Q_720P:return"720p";case I.VideoQuality.Q_1080P:return"1080p";case I.VideoQuality.Q_1440P:return"1440p";case I.VideoQuality.Q_2160P:return"2160p";case I.VideoQuality.INVARIANT:case I.VideoQuality.Q_576P:case I.VideoQuality.Q_4320P:return"UNKNOWN";default:return(0,Do.assertNever)(t)}},Bd=t=>{if(t!==void 0)switch(t){case"MP4":case"ONDEMAND_DASH":case"ONDEMAND_DASH_LIVE":case"ONDEMAND_HLS":case"ONDEMAND_HLS_LIVE":case"MULTI_DASH":case"WEBM":case"AV1":return"vod";case"DASH":case"HLS":case"HLS_FMP4":case"WEBRTC":return"live";default:return}},de=(t,e,r)=>{var i;if(t&&e)switch(t){case I.VideoFormat.MPEG:return r&&e[t]&&e[t][r];default:return(i=e[t])==null?void 0:i.url}},Ir=(t,e=!1)=>{if(e)return"minimal";switch(t){case void 0:case I.Surface.NONE:return;case I.Surface.INLINE:return"inline";case I.Surface.FULLSCREEN:return"fullscreen";case I.Surface.SECOND_SCREEN:return"chromecast";case I.Surface.PIP:return"pip_external"}},_r=t=>{switch(t){case void 0:return;case I.Surface.INVISIBLE:return"background";default:return"foreground"}};var Ud=C(Rt(),1);var jd=()=>(0,Ud.default)(Math.floor(Math.random()*2**64).toString(36),13,"0");var pI="_thin-one-stat_",Hd=`${pI}deviceId`,Wd=()=>{let t=new m.Subscription;return{subscription:t,subscribe:(e,r)=>{e&&t.add(e.subscribe(r))}}},Sr=class{constructor(e,r){this.debugLogger=new m.Logger;this.thinOneStatDebugLog=this.debugLogger.createComponentLog("ThinOneStat");this.eventNumber=1;this.playerSize={width:0,height:0};this.seekAction$=new m.ValueSubject("unknown");this.isid$=new m.ValueSubject(void 0);var f,p;this.statContext=e,this.config=Cd((f=r.config)!=null?f:{}),this.subscription=new m.Subscription,this.config.synchronizeTime&&(this.timeSynchronisation=new br);let i=new m.Subject,o=m.safeStorage.get(Hd);this.statContext.deviceId?this.deviceId=this.statContext.deviceId:o?this.deviceId=o:(this.deviceId=No(),m.safeStorage.set(Hd,this.deviceId)),this.statContext.targetDuration?this.targetDuration=this.statContext.targetDuration:this.targetDuration=this.config.watchedNDefaultTargetDuration,this.resetViewSession(),r.useIsid&&this.isid$.next((p=r.isid)!=null?p:jd());let n=new vr({error$:i,config:this.config,timeSynchronisation:this.timeSynchronisation});this.api=new hr({config:this.config,apiTransport:n,error$:i,deviceId:this.deviceId,refreshAuthToken:r.refreshAuthToken}),this.logger=new mr({config:this.config,debugLogger:this.debugLogger,api:this.api,error$:i,userSalt:r.userSalt});let{isEmbed:c,topOrigin:l}=(0,m.detectEmbed)();this.isEmbed=c,this.embedHostname=l?new URL(l).hostname:void 0}get vsid$(){return new m.ValueSubject(ce.getVSID())}authorize(e){return this.api.authorize(e)}updateContext(e){this.statContext={...this.statContext,...e}}attachTo(e,r){let i=new m.Subscription,o=(a,s)=>i.add(a.subscribe(s));o(Fd(e),a=>{this.getTotalViewTime=a}),o(e.info.isLive$,a=>this.isLive=a);let n;o((0,m.combine)({hostname:e.info.hostname$,connectionType:e.info.httpConnectionType$,connectionReused:e.info.httpConnectionReused$}).pipe((0,m.filter)(({hostname:a})=>a!==void 0),(0,m.filter)(({connectionType:a})=>a!==void 0),(0,m.filter)(({connectionReused:a})=>a!==void 0)),({hostname:a,connectionType:s,connectionReused:d})=>{if(n!==void 0&&n!==a){let g={cdn_host:a,connection_type:Mo(s),connection_reused:d,content_type:vt(e.info.currentFormat$.getValue())};this.logFailover(g)}this.cdnHostname=n=a}),o(e.info.httpConnectionType$,a=>{this.connectionType=Mo(a)}),o(e.info.httpConnectionReused$,a=>{this.connectionReused=a}),o(Nd(e,r,{heartbeatInterval:this.config.watchCoverageHeartbeatInterval}),a=>{let s=Math.round(a.from*1e3),d=Math.round(a.to*1e3),v={watch_interval:`${s}-${d}`,in_history:!!this.statContext.inHistory,content_type:vt(e.info.currentFormat$.getValue()),playback_quality:J(e.info.currentQuality$.getValue()),recom_info:this.statContext.recomInfo};if(!e.info.isLive$.getValue())this.logWatchCoverage(v);else{let y=e.info.atLiveEdge$.getValue();this.logWatchCoverageLive({...v,live:!!y})}}),o(Dd(e,{targetDuration:this.targetDuration,firstTvtLog:this.config.watchedNFirstTvtLog,getTotalViewTime:this.getTotalViewTime}),a=>{this.logWatchedN(a)}),o(e.events.willReady$,()=>{if(this.statContext.preload){let a=e.info.currentFormat$.getValue(),s=e.info.availableSources$.getValue(),d=e.info.currentBuffer$.getValue(),v=e.info.currentQuality$.getValue(),g={target_buffer_time:this.calcBufferTime(d),playback_url:de(a,s,v),playback_quality:J(v)};this.logPreloadStarted(g)}}),o(e.events.manifestRequested$,()=>{let a=e.info.currentFormat$.getValue(),s=e.info.availableSources$.getValue(),d=e.info.currentQuality$.getValue(),v={playback_url:de(a,s,d),cdn_host:this.cdnHostname,connection_type:this.connectionType,connection_reused:this.connectionReused};this.logManifestRequest(v)}),o(e.events.firstBytesManifest$,()=>{let a=e.info.currentFormat$.getValue(),s=e.info.availableSources$.getValue(),d=e.info.currentQuality$.getValue(),v={playback_url:de(a,s,d),cdn_host:this.cdnHostname,connection_type:this.connectionType,connection_reused:this.connectionReused};this.logFirstByteManifest(v)}),o(e.events.manifestReceived$,()=>{let a=e.info.currentFormat$.getValue(),s=e.info.availableSources$.getValue(),d=e.info.currentQuality$.getValue(),v={playback_url:de(a,s,d),cdn_host:this.cdnHostname,connection_type:this.connectionType,connection_reused:this.connectionReused};this.logManifestReceived(v)}),o(e.events.firstBytesRequested$,()=>{let a=e.info.currentFormat$.getValue(),s=e.info.availableSources$.getValue(),d=e.info.currentQuality$.getValue(),v={playback_url:de(a,s,d),cdn_host:this.cdnHostname,connection_type:this.connectionType,connection_reused:this.connectionReused};this.logFirstMediaRequest(v)}),o(e.events.firstBytesReceived$,()=>{let a=e.info.currentFormat$.getValue(),s=e.info.availableSources$.getValue(),d=e.info.currentQuality$.getValue(),v={playback_url:de(a,s,d),cdn_host:this.cdnHostname,connection_type:this.connectionType,connection_reused:this.connectionReused};this.logFirstByteMedia(v)}),o((0,m.merge)(e.events.willStart$,e.events.looped$),a=>{var v;a&&this.resetViewSession();let d={isid:this.isid$.getValue(),stream_profile:Bd(vt(e.info.currentFormat$.getValue())),dpi:96*X.clientChecker.display.pixelRatio,web_layout:this.statContext.isMobile||X.clientChecker.device.isMobile?"mobile":"desktop",preloaded:this.statContext.preload,navigation:this.statContext.navigation,recom_info:this.statContext.recomInfo};this.isEmbed&&(d.iframe_host=(v=this.embedHostname)!=null?v:"unknown"),this.logStartSession(d)}),o(e.events.started$,()=>{var q,se,ue,j;this.isStarted=!0;let a=e.info.currentBuffer$.getValue(),s=e.info.currentQuality$.getValue(),d=e.info.isAutoQualityEnabled$.getValue(),v=e.info.muted$.getValue(),g=e.info.volume$.getValue(),y=e.info.surface$.getValue(),S=e.info.availableTextTracks$.getValue(),T=e.info.currentTextTrack$.getValue(),N=e.info.currentAudioStream$.getValue(),U=e.info.currentPlaybackRate$.getValue(),P={playback_quality:J(s),user_quality:d?"auto":J(s),player_width:this.playerSize.width,player_height:this.playerSize.height,muted:v,sound_volume:Math.round(g*100),buffer_time:this.calcBufferTime(a),mode:Ir(y,this.statContext.isPreviewPlayerView),visibility:_r(y),subtitles_enabled:T?!!T:(q=this.currentSubtitle)==null?void 0:q.enabled,auto_subtitles:(j=(se=S.find(({id:wr})=>wr===T))==null?void 0:se.isAuto)!=null?j:(ue=this.currentSubtitle)==null?void 0:ue.auto,audio_track_lang:N==null?void 0:N.language,playback_rate:U,recom_info:this.statContext.recomInfo};this.logPlaybackStarted(P)}),o((0,m.merge)(e.events.willStart$,e.events.willResume$),()=>{this.logPlay()}),o(e.events.playing$,()=>{let a=e.info.currentBuffer$.getValue(),s={buffer_time:this.calcBufferTime(a)};this.logPlaying(s),this.wasPaused&&this.logResume()}),o(e.events.paused$,()=>{this.wasPaused=!0,this.logPause()}),o(e.events.willStop$,()=>{this.logStop()}),o((0,m.merge)(e.events.fetcherRecoverableError$,e.events.fatalError$),()=>{this.statContext.preload&&this.logPreloadError()});let c=a=>{switch(a){case m.ErrorCategory.NETWORK:return"network";case m.ErrorCategory.VIDEO_PIPELINE:return"video_pipeline";case m.ErrorCategory.EXTERNAL_API:return"external_api";case m.ErrorCategory.PARSER:return"parser";case m.ErrorCategory.DOM:return"dom";default:return"wtf"}},l=a=>m.ErrorCategory.FATAL===a?"critical":"informative";o(e.events.fetcherRecoverableError$,({id:a,category:s,data:d,message:v,httpCode:g,UVBackendErrorCode:y})=>{let S={error_severity:l(s),error_category:c(s),player_error_code:a,player_error_trace:d,http_error_code:g,uv_backend_error_code_subcode:y,error_message:v};this.logError(S)}),o(e.events.managedError$,({id:a,category:s,data:d,message:v})=>{let g={error_severity:l(s),error_category:c(s),player_error_code:a,player_error_trace:d,error_message:v};this.logError(g)}),o(e.events.fatalError$,({id:a,category:s,data:d,message:v})=>{let g={error_severity:"critical",error_category:c(s),player_error_code:a,player_error_trace:d,error_message:v};this.logError(g)}),o((0,m.combine)({connectionType:e.info.httpConnectionType$,connectionReused:e.info.httpConnectionReused$,connectionMetrics:e.info.httpConnectionMetrics$}).pipe((0,m.filter)(({connectionReused:a})=>a!==void 0),(0,m.filter)(({connectionMetrics:a})=>a!==void 0),(0,m.filterChanged)((a,s)=>a.connectionType===s.connectionType)),({connectionMetrics:a})=>{let s=e.info.currentFormat$.getValue(),d=e.info.availableSources$.getValue(),v=e.info.currentQuality$.getValue(),g=e.info.rttEstimation$.getValue(),y={playback_url:de(s,d,v),cdn_host:this.cdnHostname,connection_type:this.connectionType,connection_reused:this.connectionReused,rtt:g?Math.round(g):void 0,network_type:a==null?void 0:a.networkType,dns_resolve_time:a==null?void 0:a.dnsResolveTime,tcp_handshake_time:a==null?void 0:a.tcpHandshakeTime,tls_handshake_time:a==null?void 0:a.tlsHandshakeTime};this.logConnectionEstablished(y)}),o(Vd(e),a=>{this.logDownloadBytes(a)}),o(e.events.firstFrame$,()=>{this.logFirstVideoFrameDecoded()}),o(e.events.willSeek$,()=>{let a={seek_type:this.seekAction$.getValue()};this.logSeeking(a)}),o(e.events.seeked$,()=>{let a={seek_type:this.seekAction$.getValue()};this.logSeeked(a),this.seekAction$.next("unknown")}),o(e.info.isStalled$,a=>{let s=e.info.currentBuffer$.getValue(),d=this.calcBufferTime(s);a&&d&&d>0&&this.logBufferStarvation({buffer_time:d})}),o(e.info.currentBuffer$.pipe((0,m.filter)(a=>!!this.calcBufferTime(a)),(0,m.once)()),a=>{let s=this.calcBufferTime(a);if(this.statContext.preload){let d={buffer_time:s};this.logPreloadEnded(d)}this.logReady({buffer_time:s})});let f;o((0,m.combine)({videoStream:e.info.currentVideoStream$,audioStream:e.info.currentAudioStream$,quality:e.info.currentQuality$}).pipe((0,m.filter)(({videoStream:a,audioStream:s})=>a!==void 0&&s!==void 0),(0,m.filter)(({quality:a})=>a!==void 0)),({videoStream:a,audioStream:s,quality:d})=>{if(f!==d){let v=e.info.isAutoQualityEnabled$.getValue(),g=a==null?void 0:a.codec,y=s==null?void 0:s.codec,S={user_quality:v?"auto":J(d),playback_quality:J(d),download_quality:J(d),codec_info:g&&y?`${g},${y}`:void 0};f=d,this.logQualityChanged(S)}});let p,h;return o(e.info.surface$,a=>{let s=Ir(a,this.statContext.isPreviewPlayerView);s&&!this.uiEvents&&this.isStarted&&this.logModeChanged({mode:s}),h=_r(a),p!==h&&this.isStarted&&(p=_r(a),this.logVisibilityChanged({visibility:h}))}),o((0,m.combine)({muted:e.info.muted$,volume:e.info.volume$}),({muted:a,volume:s})=>{if(this.isStarted){let d={muted:a,sound_volume:Math.round(s*100)};this.logSoundChanged(d)}}),o(e.info.currentFormat$.pipe((0,m.filter)(a=>a!==void 0),(0,m.skip)(1)),a=>{let s={content_type:vt(a),cdn_host:this.cdnHostname,connection_type:this.connectionType,connection_reused:this.connectionReused};this.logContentTypeChange(s)}),o(e.info.currentAudioStream$.pipe((0,m.filter)(a=>a!==void 0),(0,m.skip)(1)),a=>{let s={audio_track_lang:a.language,codec_info:a.codec};this.logAudioTrackSwitched(s)}),o(e.info.currentVideoStream$.pipe((0,m.filter)(a=>a!==void 0),(0,m.skip)(1)),a=>{let s={hdr:a.hdr,codec_info:a.codec};this.logVideoTrackSwitched(s)}),this.player=e,this.resubscribeBeforeunload(),this.subscription.add(i),i}attachToUi(e){this.uiEvents=e;let{subscribe:r,subscription:i}=Wd();r(e.actionSeek$,this.seekAction$),r(e.playerSize$,({width:n,height:c})=>{n&&c&&(this.playerSize={width:n,height:c},this.logViewPortChanged({player_width:n,player_height:c}))}),r(e.isLoaderVisible$,n=>{n&&this.isStarted&&this.logShowLoader()}),r(e.actionSubtitlesSwitched$,n=>{if(this.currentSubtitle={...n},this.isStarted){let c={subtitles_enabled:n.enabled,subtitles_track_lang:n.lang,auto_subtitles:n.auto};this.logSubtitlesSwitched(c)}});let{surface$:o}=lr(this.uiEvents,r,this.player);return r(o,n=>{this.isStarted&&this.logModeChanged({mode:Ir(n)})}),r(e.actionQuality$,n=>{var h,a,s,d,v,g;let c=y=>(0,Qd.default)((0,Kd.default)(qo),y),l=(a=(h=this.player)==null?void 0:h.info.currentVideoStream$.getValue())==null?void 0:a.codec,f=(d=(s=this.player)==null?void 0:s.info.currentAudioStream$.getValue())==null?void 0:d.codec,p={user_quality:c(n)?"auto":J(n),playback_quality:J((v=this.player)==null?void 0:v.info.currentQuality$.getValue()),download_quality:J((g=this.player)==null?void 0:g.info.currentQuality$.getValue()),codec_info:l&&f?`${l},${f}`:void 0};this.logQualityChangeRequested(p)}),this.resubscribeBeforeunload(),this.subscription.add(i),i}attachToAds(e){let{subscription:r,subscribe:i}=Wd();return i(e.init$,o=>{let n={slot:o};this.logAdvConfiguration(n)}),i(e.slotRequested$,()=>{this.logAdvRequest()}),i(e.started$,o=>{let n={adv_section:o};this.logAdvBreakStarted(n)}),i(e.ended$,o=>{let n={adv_section:o};this.logAdvBreakEnded(n)}),i(e.error$,o=>{let n={error_message:o};this.logAdvError(n)}),this.resubscribeBeforeunload(),this.subscription.add(r),r}getDeviceId(){return this.deviceId}resetViewSession(){this.thinOneStatDebugLog({message:"VSID reset"}),ce.generateVSID(),this.eventNumber=0}destroy(){this.api.destroy()}calcBufferTime(e){var r,i;return e?Math.round(((r=e.end)!=null?r:0)-((i=e.start)!=null?i:0))*1e3:void 0}createRequiredParams(e){var n,c,l,f,p;let r=this.vsid$.getValue();(0,m.assertNonNullable)(r);let i=this.eventNumber++,o=((l=this.isLive?(n=this.player)==null?void 0:n.info.liveTime$.getValue():(c=this.player)==null?void 0:c.info.position$.getValue())!=null?l:0)*1e3;return{vsid:r,uv_movie_id:this.statContext.movieId,event_name:e,client_time:Date.now(),application:(f=this.statContext.application)!=null?f:`@vkontakte/videoplayer-statistics:${V}`,platform:(p=this.statContext.platform)!=null?p:`web:${this.statContext.isMobile||X.clientChecker.device.isMobile?"mobile":"desktop"}`,product:this.statContext.product,event_number:i,playback_position:o,current_tvt:this.getTotalViewTime(),cdn_host:this.cdnHostname}}createRequiredFatParams(){var e,r,i,o,n,c,l;return{stats_version:"2.1.1",browser:(e=this.statContext.browser)!=null?e:X.clientChecker.browser.current,browser_version:(r=this.statContext.browserVersion)!=null?r:String(X.clientChecker.browser.currentVersion),os:(i=this.statContext.os)!=null?i:X.clientChecker.device.os.name,os_version:(o=this.statContext.osVersion)!=null?o:X.clientChecker.device.os.version,device_type:(n=this.statContext.deviceType)!=null?n:this.statContext.isMobile||X.clientChecker.device.isMobile?"mobile":"desktop",device_manufacturer:(c=this.statContext.deviceManufacturer)!=null?c:X.clientChecker.device.details.vendor,device_model:(l=this.statContext.deviceModel)!=null?l:X.clientChecker.device.details.model,navigation:this.statContext.navigation}}log(e,r,i=!1){let o=this.createRequiredParams(e),n={};i&&(n=this.createRequiredFatParams()),this.logger.log({...o,...n,...r})}logWatchCoverage(e){this.log("watch_coverage",e,!0)}logWatchCoverageLive(e){this.log("watch_coverage_live",e,!0)}logWatchedN(e){this.log("watched_n",e,!0)}logStartSession(e){this.log("start_session",e,!0)}logPreloadStarted(e){this.log("preload_started",e)}logPreloadEnded(e){this.log("preload_ended",e)}logPreloadError(){this.log("preload_error")}logPlaybackStarted(e){this.log("playback_started",e,!0)}logPlay(){this.log("play")}logManifestRequest(e){this.log("manifest_request",e)}logFirstByteManifest(e){this.log("first_byte_manifest",e)}logFirstMediaRequest(e){this.log("first_media_request",e)}logFirstByteMedia(e){this.log("first_byte_media",e)}logManifestReceived(e){this.log("manifest_received",e)}logConnectionEstablished(e){this.log("connection_established",e)}logFirstVideoFrameDecoded(){this.log("first_video_frame_decoded")}logReady(e){this.log("ready",e)}logPlaying(e){this.log("playing",e)}logPause(){this.log("pause")}logResume(){this.log("resume")}logSeeking(e){this.log("seeking",e)}logSeeked(e){this.log("seeked",e)}logStop(){this.log("stop")}logBufferStarvation(e){this.log("buffer_starvation",e)}logShowLoader(){this.log("show_loader")}logQualityChangeRequested(e){this.log("quality_change_requested",e)}logQualityChanged(e){this.log("quality_changed",e)}logCdnHostChanged(e){this.log("cdn_host_changed",e)}logViewPortChanged(e){this.log("view_port_changed",e)}logModeChanged(e){this.log("mode_changed",e)}logVisibilityChanged(e){this.log("visibility_changed",e)}logAudioTrackSwitched(e){this.log("audio_track_switched",e)}logVideoTrackSwitched(e){this.log("video_track_switched",e)}logSubtitlesSwitched(e){this.log("subtitles_switched",e)}logSoundChanged(e){this.log("sound_changed",e)}logFailover(e){this.log("failover",e)}logContentTypeChange(e){this.log("content_type_change",e)}logError(e){this.log("error",e,!0)}logDownloadBytes(e){this.log("download_bytes",e)}logAdvConfiguration(e){this.log("adv_configuration",e)}logAdvRequest(){this.log("adv_request")}logAdvBreakStarted(e){this.log("adv_break_started",e)}logAdvBreakEnded(e){this.log("adv_break_ended",e)}logAdvError(e){this.log("adv_error",e)}resubscribeBeforeunload(){var e;(e=this.beforeunloadSubscription)==null||e.unsubscribe(),this.beforeunloadSubscription=(0,m.fromEvent)((0,m.getWindow)(),"beforeunload").subscribe(()=>{}),this.subscription.add(this.beforeunloadSubscription)}};var Vo={};var hI=(t,e={})=>{let i=e.timeout||1,o=performance.now();return O.setTimeout(()=>{t({get didTimeout(){return e.timeout?!1:performance.now()-o-1>i},timeRemaining(){return Math.max(0,1+(performance.now()-o))}})},1)},vI=t=>O.clearTimeout(t),Gd=t=>typeof t=="function"&&(t==null?void 0:t.toString().endsWith("{ [native code] }")),zd=!Gd(O.requestIdleCallback)||!Gd(O.cancelIdleCallback),Yd=zd?hI:O.requestIdleCallback,Jd=zd?vI:O.cancelIdleCallback;var gt=require("@vkontakte/videoplayer-core/es2018"),Zd=require("@vkontakte/videoplayer-shared/es2018");var Tr=class{constructor(){this.startTime=null;this.stopTime=null;this.accumulatedTime=0}get time(){return Math.floor(this.timeMs/1e3)}get timeMs(){var r;return this.startTime===null?0:((r=this.stopTime)!=null?r:this.now())-this.startTime-this.accumulatedTime}get isRunning(){return this.startTime!==null&&this.stopTime===null}start(){this.isRunning||(this.stopTime!==null?(this.accumulatedTime+=this.now()-this.stopTime,this.stopTime=null):this.startTime=this.now())}stop(){this.isRunning&&(this.stopTime=this.now())}reset(){this.startTime=null,this.stopTime=null,this.accumulatedTime=0}now(){return Date.now()}};var Xd=()=>window.Image?new Image:document.createElement("img");var Er=class{constructor(e){this.position=0;this.started=!1;this.heartbeatPixels=[];this.heartbeatLastTimeSent={};this.idleCallbackIds=[];this.stopwatch=new Tr;this.subscription=new gt.Subscription;this.params=e;let r=new Zd.Logger;this.log=r.createComponentLog("MediascopePixel")}attachTo(e){this.subscription.add(e.info.playbackState$.subscribe(r=>this.onPlaybackState(r))).add(e.info.position$.subscribe(r=>this.onPosition(r))).add(e.info.atLiveEdge$.subscribe(r=>this.isActiveLive=r)),this.subscription.add(e.events.willSeek$.subscribe(()=>this.onWillSeek())).add(e.events.seeked$.subscribe(()=>this.onSeeked())).add(e.events.ended$.subscribe(()=>this.onEnded()))}destroy(){this.stopwatch.reset(),this.subscription.unsubscribe(),window.clearTimeout(this.heartbeatFirstTimeoutId),this.idleCallbackIds.forEach(e=>Jd(e)),this.send("stop")}onPlaybackState(e){e===gt.PlaybackState.PLAYING?this.started?this.play():this.start():e===gt.PlaybackState.PAUSED&&this.pause()}start(){var i,o,n;this.started=!0,this.stopwatch.start(),this.send("start"),this.heartbeatPixels=this.prepareHeartbeatPixels(),this.heartbeatInterval=(i=this.heartbeatPixels[0])==null?void 0:i.interval;let e=(o=this.heartbeatPixels[0])==null?void 0:o.url,r=(n=this.heartbeatPixels[0])==null?void 0:n.delay;if(r!==void 0&&e)try{this.heartbeatFirstTimeoutId=window.setTimeout(()=>{this.sendHeartbeat(e)},r*1e3)}catch(c){this.log({message:c.message})}}play(){this.stopwatch.start(),this.send("resume")}pause(){this.stopwatch.stop(),this.send("pause")}onPosition(e){if(this.position=e,this.heartbeatInterval&&this.stopwatch.time!==0&&this.stopwatch.time%this.heartbeatInterval===0)for(let[r,{url:i}]of this.heartbeatPixels.entries())this.heartbeatLastTimeSent[r]!==this.stopwatch.time&&(this.heartbeatLastTimeSent[r]=this.stopwatch.time,this.sendHeartbeat(i))}onWillSeek(){this.started&&this.send("stop")}onSeeked(){this.started&&this.send("start")}onEnded(){this.stopwatch.stop(),this.send("stop")}validatePixels(e,r){return e==null?void 0:e.filter(i=>i.event===r.event&&r.keys.every(o=>!!i[o]))}getFrameTimestamp(){let e;if(this.isActiveLive){let r=Math.floor(Math.random()*25)+5;e=Date.now()/1e3-r}else e=this.position||0;return Math.floor(e)}getUTC(){return Math.floor(Date.now()/1e3)}prepareUrl(e){return e.replace("{@fts_fake_sec}",String(this.getFrameTimestamp())).replace("{@utc_sec}",String(this.getUTC())).split("&").filter(r=>!/={@[a-zA-Z_]+}/.test(r)).join("&")}preparePixels(e){return this.validatePixels(this.params.pixels,{event:e,keys:["url"]})}prepareHeartbeatPixels(){return this.validatePixels(this.params.pixels,{event:"heartbeat",keys:["url","interval"]})}call(e){try{this.idleCallbackIds.push(Yd(()=>Xd().src=this.prepareUrl(e)))}catch(r){this.log({message:r.message})}}send(e){let r=this.preparePixels(e);for(let{url:i}of r)this.call(i)}sendHeartbeat(e){this.call(e)}};