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