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