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