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