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