@vkontakte/videoplayer-statistics 1.0.83-dev.c0e6f99b.0 → 1.0.83

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