@vkontakte/videoplayer-statistics 1.0.87-dev.b2257cf8.0 → 1.0.87-dev.b94c1554.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es2015.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-statistics v1.0.87-dev.b2257cf8.0
3
- * Thu, 25 Sep 2025 11:03:03 GMT
2
+ * @vkontakte/videoplayer-statistics v1.0.87-dev.b94c1554.0
3
+ * Mon, 22 Sep 2025 17:21:27 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-87/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.87-dev.b2257cf8.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 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(),Lf=Ue(),Er=Object,kf=Rf("".split);dn.exports=Cf(function(){return!Er("z").propertyIsEnumerable(0)})?function(t){return Lf(t)==="String"?kf(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((LS,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((kS,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,Ln)=>{"use strict";var Gf=G(),Qf=P(),zf=mt(),Yf=qr(),Jf=Object;Ln.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,kn)=>{"use strict";var Xf=String;kn.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=$(),Lr=P(),kr=M(),op=TypeError;$n.exports=function(t,e){var r,i;if(e==="string"&&Lr(r=t.toString)&&!kr(i=Cr(r,t))||Lr(r=t.valueOf)&&!kr(i=Cr(r,t))||e!=="string"&&Lr(r=t.toString)&&!kr(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,Lp=oa(Fr)&&oa(Fr.createElement);na.exports=function(t){return Lp?Fr.createElement(t):{}}});var Br=a((XS,aa)=>{"use strict";var kp=R(),Np=x(),Dp=It();aa.exports=!kp&&!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 L=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 Lh=L(),kh=Yr().includes,Nh=x(),Dh=Jr(),$h=Nh(function(){return!Array(1).includes()});Lh({target:"Array",proto:!0,forced:$h},{includes:function(e){return kh(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 La=a((m_,Ca)=>{"use strict";qa();var Vh=Pt();Ca.exports=Vh("Array","includes")});var Na=a((b_,ka)=>{"use strict";var Fh=La();ka.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((L_,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((k_,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=L(),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(),Lv=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),Lv(n),Rv(o)&&(t?r(o,n):o.__proto__=n),o}}():void 0)});var Ps=a((Z_,_s)=>{"use strict";var kv=Et(),Nv=Je();_s.exports=kv?{}.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,Ls)=>{"use strict";var zv=O(),Yv=P(),si=Ke(),Jv=zv(Function.toString);Yv(si.inspectSource)||(si.inspectSource=function(t){return Jv(t)});Ls.exports=si.inspectSource});var Vs=a((nP,Ms)=>{"use strict";var Xv=O(),Zv=x(),ks=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(!ks(e))return!1;try{return Ds(Ns,[],e),!0}catch(r){return!1}},$s=function(e){if(!ks(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 k=_(),gg=yr(),mg=Qe(),Ys=P(),bg=W(),iu=x(),Js=di(),yg=Ks(),Xs=It(),Ig=Qs(),Sg=fi(),_g=xt(),bi=k.setImmediate,yi=k.clearImmediate,Pg=k.process,pi=k.Dispatch,Eg=k.Function,Zs=k.MessageChannel,Tg=k.String,hi=0,tt={},eu="onreadystatechange",rt,ne,vi,gi;iu(function(){rt=k.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){k.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)):k.addEventListener&&Ys(k.postMessage)&&!k.importScripts&&rt&&rt.protocol!=="file:"&&!iu(ru)?(ne=ru,k.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(),Lg=du(),kg=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&&!kg&&vu&&gu?(Ti=!0,wi=gu.createTextNode(""),new vu(ot).observe(wi,{characterData:!0}),_e=function(){wi.data=Ti=!Ti}):!Lg&&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 Lt=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=Lt(),qu="Object already initialized",qi=Ru.TypeError,Hg=Ru.WeakMap,kt,nt,Nt,Wg=function(t){return Nt(t)?nt(t):kt(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,kt=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,kt=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:kt,get:nt,has:Nt,enforce:Wg,getterFor:Kg}});var se=a((EP,Lu)=>{"use strict";var Gg=_();Lu.exports=Gg.Promise});var Ee=a((TP,$u)=>{"use strict";var Qg=_(),at=se(),zg=P(),Yg=Ur(),Jg=ui(),Xg=C(),ku=ni(),Zg=H(),Ci=xr(),Nu=at&&at.prototype,em=Xg("species"),Li=!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,Li=r.then(function(){})instanceof i,!Li)return!0}return!e&&(ku==="BROWSER"||ku==="DENO")&&!Du});$u.exports={CONSTRUCTOR:tm,REJECTION_EVENT:Du,SUBCLASSING:Li}});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=L(),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,ki=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=ki(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=ki(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=ki(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(),Lm=Cm("iterator");lc.exports=function(t){if(!qm(t))return cc(t,Lm)||cc(t,"@@iterator")||Rm[Om(t)]}});var fc=a((CP,dc)=>{"use strict";var km=$(),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(km(r,t));throw new Vm($m(t)+" is not iterable")}});var vc=a((LP,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((kP,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=L(),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=L(),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=L(),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=L(),_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 kc=a(()=>{"use strict";var Ab=L(),xb=G(),Cc=H(),Ob=se(),Lc=Ee().CONSTRUCTOR,qb=Gi(),Rb=xb("Promise"),Cb=Cc&&!Lc;Ab({target:"Promise",stat:!0,forced:Cc||Lc},{resolve:function(e){return qb(Cb&&this===Rb?Ob:this,e)}})});var Nc=a(()=>{"use strict";nc();wc();xc();Oc();qc();kc()});var Vc=a(()=>{"use strict";var Lb=L(),kb=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(){})});Lb({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)}});!kb&&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=Lt(),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=L(),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=Lt(),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(),Ly=ao(),El=Wt(),ky=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=Ly(Y));Ry(Y[co])||ky(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=L(),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"),Ll="keys",ut="values",kl="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 Ll:return function(){return new r(this,b)};case ut:return function(){return new r(this,b)};case kl: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(Ll),entries:d(kl)},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=L(),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 LI,once as kI,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.87-dev.b94c1554.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,Le=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 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: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),Le(`${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 ke,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 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 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(kI()).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"),LI(["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 Ld="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:Ld,apiEnv:"okcdn",requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageHeartbeatInterval:30,synchronizeTime:!0,useBeacon:!1,alwaysSendDesktop:!1},kd=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(),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,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 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: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 Lo=t=>t&&{[Co.HTTP1]:"http1",[Co.HTTP2]:"http2",[Co.QUIC]:"http3"}[t],ko=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=kd((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:Lo(e.info.httpConnectionType$.getValue()),connection_reused:e.info.httpConnectionReused$.getValue()};this.logCdnHostChanged(f),this.cdnHostname=n=s}),o(e.info.httpConnectionType$,s=>{this.connectionType=Lo(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:ko(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(ko(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};