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