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