@vkontakte/videoplayer-statistics 1.0.83-dev.c0e6f99b.0 → 1.0.83

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/es2018.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-statistics v1.0.83-dev.c0e6f99b.0
3
- * Tue, 05 Aug 2025 09:57:25 GMT
2
+ * @vkontakte/videoplayer-statistics v1.0.83
3
+ * Tue, 05 Aug 2025 13:54:03 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-83/doc/
5
5
  */
6
- "use strict";var Cd=Object.create;var ct=Object.defineProperty;var kd=Object.getOwnPropertyDescriptor;var Ld=Object.getOwnPropertyNames;var Nd=Object.getPrototypeOf,Dd=Object.prototype.hasOwnProperty;var a=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Oo=(t,e)=>{for(var r in e)ct(t,r,{get:e[r],enumerable:!0})},Ao=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ld(e))!Dd.call(t,o)&&o!==r&&ct(t,o,{get:()=>e[o],enumerable:!(i=kd(e,o))||i.enumerable});return t};var R=(t,e,r)=>(r=t!=null?Cd(Nd(t)):{},Ao(e||!t||!t.__esModule?ct(r,"default",{value:t,enumerable:!0}):r,t)),$d=t=>Ao(ct({},"__esModule",{value:!0}),t);var O=a((vr,xo)=>{"use strict";var Ne=function(t){return t&&t.Math===Math&&t};xo.exports=Ne(typeof globalThis=="object"&&globalThis)||Ne(typeof window=="object"&&window)||Ne(typeof self=="object"&&self)||Ne(typeof global=="object"&&global)||Ne(typeof vr=="object"&&vr)||function(){return this}()||Function("return this")()});var C=a((Wy,qo)=>{"use strict";qo.exports=function(t){try{return!!t()}catch(e){return!0}}});var De=a((Hy,Ro)=>{"use strict";var Md=C();Ro.exports=!Md(function(){var t=function(){}.bind();return typeof t!="function"||t.hasOwnProperty("prototype")})});var gr=a((Ky,No)=>{"use strict";var Vd=De(),Lo=Function.prototype,Co=Lo.apply,ko=Lo.call;No.exports=typeof Reflect=="object"&&Reflect.apply||(Vd?ko.bind(Co):function(){return ko.apply(Co,arguments)})});var k=a((Gy,Mo)=>{"use strict";var Do=De(),$o=Function.prototype,mr=$o.call,Fd=Do&&$o.bind.bind(mr,mr);Mo.exports=Do?Fd:function(t){return function(){return mr.apply(t,arguments)}}});var $e=a((zy,Fo)=>{"use strict";var Vo=k(),Ud=Vo({}.toString),Bd=Vo("".slice);Fo.exports=function(t){return Bd(Ud(t),8,-1)}});var br=a((Qy,Uo)=>{"use strict";var jd=$e(),Wd=k();Uo.exports=function(t){if(jd(t)==="Function")return Wd(t)}});var A=a((Yy,Bo)=>{"use strict";var yr=typeof document=="object"&&document.all;Bo.exports=typeof yr=="undefined"&&yr!==void 0?function(t){return typeof t=="function"||t===yr}:function(t){return typeof t=="function"}});var N=a((Jy,jo)=>{"use strict";var Hd=C();jo.exports=!Hd(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var B=a((Xy,Wo)=>{"use strict";var Kd=De(),lt=Function.prototype.call;Wo.exports=Kd?lt.bind(lt):function(){return lt.apply(lt,arguments)}});var Ir=a(Go=>{"use strict";var Ho={}.propertyIsEnumerable,Ko=Object.getOwnPropertyDescriptor,Gd=Ko&&!Ho.call({1:2},1);Go.f=Gd?function(e){var r=Ko(this,e);return!!r&&r.enumerable}:Ho});var Me=a((eI,zo)=>{"use strict";zo.exports=function(t,e){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:e}}});var Yo=a((tI,Qo)=>{"use strict";var zd=k(),Qd=C(),Yd=$e(),Sr=Object,Jd=zd("".split);Qo.exports=Qd(function(){return!Sr("z").propertyIsEnumerable(0)})?function(t){return Yd(t)==="String"?Jd(t,""):Sr(t)}:Sr});var Ve=a((rI,Jo)=>{"use strict";Jo.exports=function(t){return t==null}});var ve=a((iI,Xo)=>{"use strict";var Xd=Ve(),Zd=TypeError;Xo.exports=function(t){if(Xd(t))throw new Zd("Can't call method on "+t);return t}});var ne=a((oI,Zo)=>{"use strict";var ef=Yo(),tf=ve();Zo.exports=function(t){return ef(tf(t))}});var j=a((nI,en)=>{"use strict";var rf=A();en.exports=function(t){return typeof t=="object"?t!==null:rf(t)}});var ge=a((aI,tn)=>{"use strict";tn.exports={}});var J=a((sI,on)=>{"use strict";var _r=ge(),Pr=O(),of=A(),rn=function(t){return of(t)?t:void 0};on.exports=function(t,e){return arguments.length<2?rn(_r[t])||rn(Pr[t]):_r[t]&&_r[t][e]||Pr[t]&&Pr[t][e]}});var dt=a((uI,nn)=>{"use strict";var nf=k();nn.exports=nf({}.isPrototypeOf)});var ae=a((cI,un)=>{"use strict";var af=O(),an=af.navigator,sn=an&&an.userAgent;un.exports=sn?String(sn):""});var Tr=a((lI,hn)=>{"use strict";var pn=O(),Er=ae(),cn=pn.process,ln=pn.Deno,dn=cn&&cn.versions||ln&&ln.version,fn=dn&&dn.v8,W,ft;fn&&(W=fn.split("."),ft=W[0]>0&&W[0]<4?1:+(W[0]+W[1]));!ft&&Er&&(W=Er.match(/Edge\/(\d+)/),(!W||W[1]>=74)&&(W=Er.match(/Chrome\/(\d+)/),W&&(ft=+W[1])));hn.exports=ft});var wr=a((dI,gn)=>{"use strict";var vn=Tr(),sf=C(),uf=O(),cf=uf.String;gn.exports=!!Object.getOwnPropertySymbols&&!sf(function(){var t=Symbol("symbol detection");return!cf(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&vn&&vn<41})});var Or=a((fI,mn)=>{"use strict";var lf=wr();mn.exports=lf&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Ar=a((pI,bn)=>{"use strict";var df=J(),ff=A(),pf=dt(),hf=Or(),vf=Object;bn.exports=hf?function(t){return typeof t=="symbol"}:function(t){var e=df("Symbol");return ff(e)&&pf(e.prototype,vf(t))}});var Fe=a((hI,yn)=>{"use strict";var gf=String;yn.exports=function(t){try{return gf(t)}catch(e){return"Object"}}});var X=a((vI,In)=>{"use strict";var mf=A(),bf=Fe(),yf=TypeError;In.exports=function(t){if(mf(t))return t;throw new yf(bf(t)+" is not a function")}});var pt=a((gI,Sn)=>{"use strict";var If=X(),Sf=Ve();Sn.exports=function(t,e){var r=t[e];return Sf(r)?void 0:If(r)}});var Pn=a((mI,_n)=>{"use strict";var xr=B(),qr=A(),Rr=j(),_f=TypeError;_n.exports=function(t,e){var r,i;if(e==="string"&&qr(r=t.toString)&&!Rr(i=xr(r,t))||qr(r=t.valueOf)&&!Rr(i=xr(r,t))||e!=="string"&&qr(r=t.toString)&&!Rr(i=xr(r,t)))return i;throw new _f("Can't convert object to primitive value")}});var Q=a((bI,En)=>{"use strict";En.exports=!0});var On=a((yI,wn)=>{"use strict";var Tn=O(),Pf=Object.defineProperty;wn.exports=function(t,e){try{Pf(Tn,t,{value:e,configurable:!0,writable:!0})}catch(r){Tn[t]=e}return e}});var Ue=a((II,qn)=>{"use strict";var Ef=Q(),Tf=O(),wf=On(),An="__core-js_shared__",xn=qn.exports=Tf[An]||wf(An,{});(xn.versions||(xn.versions=[])).push({version:"3.43.0",mode:Ef?"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 Cr=a((SI,Cn)=>{"use strict";var Rn=Ue();Cn.exports=function(t,e){return Rn[t]||(Rn[t]=e||{})}});var kr=a((_I,kn)=>{"use strict";var Of=ve(),Af=Object;kn.exports=function(t){return Af(Of(t))}});var Y=a((PI,Ln)=>{"use strict";var xf=k(),qf=kr(),Rf=xf({}.hasOwnProperty);Ln.exports=Object.hasOwn||function(e,r){return Rf(qf(e),r)}});var Lr=a((EI,Nn)=>{"use strict";var Cf=k(),kf=0,Lf=Math.random(),Nf=Cf(1.1.toString);Nn.exports=function(t){return"Symbol("+(t===void 0?"":t)+")_"+Nf(++kf+Lf,36)}});var D=a((TI,$n)=>{"use strict";var Df=O(),$f=Cr(),Dn=Y(),Mf=Lr(),Vf=wr(),Ff=Or(),me=Df.Symbol,Nr=$f("wks"),Uf=Ff?me.for||me:me&&me.withoutSetter||Mf;$n.exports=function(t){return Dn(Nr,t)||(Nr[t]=Vf&&Dn(me,t)?me[t]:Uf("Symbol."+t)),Nr[t]}});var Un=a((wI,Fn)=>{"use strict";var Bf=B(),Mn=j(),Vn=Ar(),jf=pt(),Wf=Pn(),Hf=D(),Kf=TypeError,Gf=Hf("toPrimitive");Fn.exports=function(t,e){if(!Mn(t)||Vn(t))return t;var r=jf(t,Gf),i;if(r){if(e===void 0&&(e="default"),i=Bf(r,t,e),!Mn(i)||Vn(i))return i;throw new Kf("Can't convert object to primitive value")}return e===void 0&&(e="number"),Wf(t,e)}});var Dr=a((OI,Bn)=>{"use strict";var zf=Un(),Qf=Ar();Bn.exports=function(t){var e=zf(t,"string");return Qf(e)?e:e+""}});var ht=a((AI,Wn)=>{"use strict";var Yf=O(),jn=j(),$r=Yf.document,Jf=jn($r)&&jn($r.createElement);Wn.exports=function(t){return Jf?$r.createElement(t):{}}});var Mr=a((xI,Hn)=>{"use strict";var Xf=N(),Zf=C(),ep=ht();Hn.exports=!Xf&&!Zf(function(){return Object.defineProperty(ep("div"),"a",{get:function(){return 7}}).a!==7})});var zn=a(Gn=>{"use strict";var tp=N(),rp=B(),ip=Ir(),op=Me(),np=ne(),ap=Dr(),sp=Y(),up=Mr(),Kn=Object.getOwnPropertyDescriptor;Gn.f=tp?Kn:function(e,r){if(e=np(e),r=ap(r),up)try{return Kn(e,r)}catch(i){}if(sp(e,r))return op(!rp(ip.f,e,r),e[r])}});var Vr=a((RI,Qn)=>{"use strict";var cp=C(),lp=A(),dp=/#|\.prototype\./,Be=function(t,e){var r=pp[fp(t)];return r===vp?!0:r===hp?!1:lp(e)?cp(e):!!e},fp=Be.normalize=function(t){return String(t).replace(dp,".").toLowerCase()},pp=Be.data={},hp=Be.NATIVE="N",vp=Be.POLYFILL="P";Qn.exports=Be});var je=a((CI,Jn)=>{"use strict";var Yn=br(),gp=X(),mp=De(),bp=Yn(Yn.bind);Jn.exports=function(t,e){return gp(t),e===void 0?t:mp?bp(t,e):function(){return t.apply(e,arguments)}}});var Fr=a((kI,Xn)=>{"use strict";var yp=N(),Ip=C();Xn.exports=yp&&Ip(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var Z=a((LI,Zn)=>{"use strict";var Sp=j(),_p=String,Pp=TypeError;Zn.exports=function(t){if(Sp(t))return t;throw new Pp(_p(t)+" is not an object")}});var se=a(ta=>{"use strict";var Ep=N(),Tp=Mr(),wp=Fr(),vt=Z(),ea=Dr(),Op=TypeError,Ur=Object.defineProperty,Ap=Object.getOwnPropertyDescriptor,Br="enumerable",jr="configurable",Wr="writable";ta.f=Ep?wp?function(e,r,i){if(vt(e),r=ea(r),vt(i),typeof e=="function"&&r==="prototype"&&"value"in i&&Wr in i&&!i[Wr]){var o=Ap(e,r);o&&o[Wr]&&(e[r]=i.value,i={configurable:jr in i?i[jr]:o[jr],enumerable:Br in i?i[Br]:o[Br],writable:!1})}return Ur(e,r,i)}:Ur:function(e,r,i){if(vt(e),r=ea(r),vt(i),Tp)try{return Ur(e,r,i)}catch(o){}if("get"in i||"set"in i)throw new Op("Accessors not supported");return"value"in i&&(e[r]=i.value),e}});var be=a((DI,ra)=>{"use strict";var xp=N(),qp=se(),Rp=Me();ra.exports=xp?function(t,e,r){return qp.f(t,e,Rp(1,r))}:function(t,e,r){return t[e]=r,t}});var $=a(($I,oa)=>{"use strict";var We=O(),Cp=gr(),kp=br(),Lp=A(),Np=zn().f,Dp=Vr(),ye=ge(),$p=je(),Ie=be(),ia=Y();Ue();var Mp=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 Cp(t,this,arguments)};return e.prototype=t.prototype,e};oa.exports=function(t,e){var r=t.target,i=t.global,o=t.stat,n=t.proto,s=i?We:o?We[r]:We[r]&&We[r].prototype,u=i?ye:ye[r]||Ie(ye,r,{})[r],d=u.prototype,l,p,h,c,f,g,m,S,I;for(c in e)l=Dp(i?c:r+(o?".":"#")+c,t.forced),p=!l&&s&&ia(s,c),g=u[c],p&&(t.dontCallGetSet?(I=Np(s,c),m=I&&I.value):m=s[c]),f=p&&m?m:e[c],!(!l&&!n&&typeof g==typeof f)&&(t.bind&&p?S=$p(f,We):t.wrap&&p?S=Mp(f):n&&Lp(f)?S=kp(f):S=f,(t.sham||f&&f.sham||g&&g.sham)&&Ie(S,"sham",!0),Ie(u,c,S),n&&(h=r+"Prototype",ia(ye,h)||Ie(ye,h,{}),Ie(ye[h],c,f),t.real&&d&&(l||!d[c])&&Ie(d,c,f)))}});var aa=a((MI,na)=>{"use strict";var Vp=Math.ceil,Fp=Math.floor;na.exports=Math.trunc||function(e){var r=+e;return(r>0?Fp:Vp)(r)}});var gt=a((VI,sa)=>{"use strict";var Up=aa();sa.exports=function(t){var e=+t;return e!==e||e===0?0:Up(e)}});var ca=a((FI,ua)=>{"use strict";var Bp=gt(),jp=Math.max,Wp=Math.min;ua.exports=function(t,e){var r=Bp(t);return r<0?jp(r+e,0):Wp(r,e)}});var Hr=a((UI,la)=>{"use strict";var Hp=gt(),Kp=Math.min;la.exports=function(t){var e=Hp(t);return e>0?Kp(e,9007199254740991):0}});var Kr=a((BI,da)=>{"use strict";var Gp=Hr();da.exports=function(t){return Gp(t.length)}});var Gr=a((jI,pa)=>{"use strict";var zp=ne(),Qp=ca(),Yp=Kr(),fa=function(t){return function(e,r,i){var o=zp(e),n=Yp(o);if(n===0)return!t&&-1;var s=Qp(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}};pa.exports={includes:fa(!0),indexOf:fa(!1)}});var zr=a((WI,ha)=>{"use strict";ha.exports=function(){}});var va=a(()=>{"use strict";var Jp=$(),Xp=Gr().includes,Zp=C(),eh=zr(),th=Zp(function(){return!Array(1).includes()});Jp({target:"Array",proto:!0,forced:th},{includes:function(e){return Xp(this,e,arguments.length>1?arguments[1]:void 0)}});eh("includes")});var mt=a((GI,ga)=>{"use strict";var rh=J();ga.exports=rh});var ba=a((zI,ma)=>{"use strict";va();var ih=mt();ma.exports=ih("Array","includes")});var Ia=a((QI,ya)=>{"use strict";var oh=ba();ya.exports=oh});var Se=a((YI,Sa)=>{"use strict";var nh=Ia();Sa.exports=nh});var xa=a(()=>{"use strict"});var Xr=a((uS,qa)=>{"use strict";var He=O(),sh=ae(),uh=$e(),_t=function(t){return sh.slice(0,t.length)===t};qa.exports=function(){return _t("Bun/")?"BUN":_t("Cloudflare-Workers")?"CLOUDFLARE":_t("Deno/")?"DENO":_t("Node.js/")?"NODE":He.Bun&&typeof Bun.version=="string"?"BUN":He.Deno&&typeof Deno.version=="object"?"DENO":uh(He.process)==="process"?"NODE":He.window&&He.document?"BROWSER":"REST"}()});var Pt=a((cS,Ra)=>{"use strict";var ch=Xr();Ra.exports=ch==="NODE"});var Pe=a((lS,Ca)=>{"use strict";var lh=be();Ca.exports=function(t,e,r,i){return i&&i.enumerable?t[e]=r:lh(t,e,r),t}});var La=a((dS,ka)=>{"use strict";var dh=k(),fh=X();ka.exports=function(t,e,r){try{return dh(fh(Object.getOwnPropertyDescriptor(t,e)[r]))}catch(i){}}});var Da=a((fS,Na)=>{"use strict";var ph=j();Na.exports=function(t){return ph(t)||t===null}});var Ma=a((pS,$a)=>{"use strict";var hh=Da(),vh=String,gh=TypeError;$a.exports=function(t){if(hh(t))return t;throw new gh("Can't set "+vh(t)+" as a prototype")}});var Zr=a((hS,Va)=>{"use strict";var mh=La(),bh=j(),yh=ve(),Ih=Ma();Va.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t=!1,e={},r;try{r=mh(Object.prototype,"__proto__","set"),r(e,[]),t=e instanceof Array}catch(i){}return function(o,n){return yh(o),Ih(n),bh(o)&&(t?r(o,n):o.__proto__=n),o}}():void 0)});var Et=a((vS,Ua)=>{"use strict";var Sh=D(),_h=Sh("toStringTag"),Fa={};Fa[_h]="z";Ua.exports=String(Fa)==="[object z]"});var Ke=a((gS,Ba)=>{"use strict";var Ph=Et(),Eh=A(),Tt=$e(),Th=D(),wh=Th("toStringTag"),Oh=Object,Ah=Tt(function(){return arguments}())==="Arguments",xh=function(t,e){try{return t[e]}catch(r){}};Ba.exports=Ph?Tt:function(t){var e,r,i;return t===void 0?"Undefined":t===null?"Null":typeof(r=xh(e=Oh(t),wh))=="string"?r:Ah?Tt(e):(i=Tt(e))==="Object"&&Eh(e.callee)?"Arguments":i}});var Wa=a((mS,ja)=>{"use strict";var qh=Et(),Rh=Ke();ja.exports=qh?{}.toString:function(){return"[object "+Rh(this)+"]"}});var Ge=a((bS,Ka)=>{"use strict";var Ch=Et(),kh=se().f,Lh=be(),Nh=Y(),Dh=Wa(),$h=D(),Ha=$h("toStringTag");Ka.exports=function(t,e,r,i){var o=r?t:t&&t.prototype;o&&(Nh(o,Ha)||kh(o,Ha,{configurable:!0,value:e}),i&&!Ch&&Lh(o,"toString",Dh))}});var za=a((yS,Ga)=>{"use strict";var Mh=se();Ga.exports=function(t,e,r){return Mh.f(t,e,r)}});var Ja=a((IS,Ya)=>{"use strict";var Vh=J(),Fh=za(),Uh=D(),Bh=N(),Qa=Uh("species");Ya.exports=function(t){var e=Vh(t);Bh&&e&&!e[Qa]&&Fh(e,Qa,{configurable:!0,get:function(){return this}})}});var Za=a((SS,Xa)=>{"use strict";var jh=dt(),Wh=TypeError;Xa.exports=function(t,e){if(jh(e,t))return t;throw new Wh("Incorrect invocation")}});var ti=a((_S,es)=>{"use strict";var Hh=k(),Kh=A(),ei=Ue(),Gh=Hh(Function.toString);Kh(ei.inspectSource)||(ei.inspectSource=function(t){return Gh(t)});es.exports=ei.inspectSource});var as=a((PS,ns)=>{"use strict";var zh=k(),Qh=C(),ts=A(),Yh=Ke(),Jh=J(),Xh=ti(),rs=function(){},is=Jh("Reflect","construct"),ri=/^\s*(?:class|function)\b/,Zh=zh(ri.exec),ev=!ri.test(rs),ze=function(e){if(!ts(e))return!1;try{return is(rs,[],e),!0}catch(r){return!1}},os=function(e){if(!ts(e))return!1;switch(Yh(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ev||!!Zh(ri,Xh(e))}catch(r){return!0}};os.sham=!0;ns.exports=!is||Qh(function(){var t;return ze(ze.call)||!ze(Object)||!ze(function(){t=!0})||t})?os:ze});var us=a((ES,ss)=>{"use strict";var tv=as(),rv=Fe(),iv=TypeError;ss.exports=function(t){if(tv(t))return t;throw new iv(rv(t)+" is not a constructor")}});var ii=a((TS,ls)=>{"use strict";var cs=Z(),ov=us(),nv=Ve(),av=D(),sv=av("species");ls.exports=function(t,e){var r=cs(t).constructor,i;return r===void 0||nv(i=cs(r)[sv])?e:ov(i)}});var oi=a((wS,ds)=>{"use strict";var uv=J();ds.exports=uv("document","documentElement")});var ps=a((OS,fs)=>{"use strict";var cv=k();fs.exports=cv([].slice)});var vs=a((AS,hs)=>{"use strict";var lv=TypeError;hs.exports=function(t,e){if(t<e)throw new lv("Not enough arguments");return t}});var ni=a((xS,gs)=>{"use strict";var dv=ae();gs.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(dv)});var hi=a((qS,Ts)=>{"use strict";var M=O(),fv=gr(),pv=je(),ms=A(),hv=Y(),Es=C(),bs=oi(),vv=ps(),ys=ht(),gv=vs(),mv=ni(),bv=Pt(),di=M.setImmediate,fi=M.clearImmediate,yv=M.process,ai=M.Dispatch,Iv=M.Function,Is=M.MessageChannel,Sv=M.String,si=0,Qe={},Ss="onreadystatechange",Ye,ue,ui,ci;Es(function(){Ye=M.location});var pi=function(t){if(hv(Qe,t)){var e=Qe[t];delete Qe[t],e()}},li=function(t){return function(){pi(t)}},_s=function(t){pi(t.data)},Ps=function(t){M.postMessage(Sv(t),Ye.protocol+"//"+Ye.host)};(!di||!fi)&&(di=function(e){gv(arguments.length,1);var r=ms(e)?e:Iv(e),i=vv(arguments,1);return Qe[++si]=function(){fv(r,void 0,i)},ue(si),si},fi=function(e){delete Qe[e]},bv?ue=function(t){yv.nextTick(li(t))}:ai&&ai.now?ue=function(t){ai.now(li(t))}:Is&&!mv?(ui=new Is,ci=ui.port2,ui.port1.onmessage=_s,ue=pv(ci.postMessage,ci)):M.addEventListener&&ms(M.postMessage)&&!M.importScripts&&Ye&&Ye.protocol!=="file:"&&!Es(Ps)?(ue=Ps,M.addEventListener("message",_s,!1)):Ss in ys("script")?ue=function(t){bs.appendChild(ys("script"))[Ss]=function(){bs.removeChild(this),pi(t)}}:ue=function(t){setTimeout(li(t),0)});Ts.exports={set:di,clear:fi}});var As=a((RS,Os)=>{"use strict";var ws=O(),_v=N(),Pv=Object.getOwnPropertyDescriptor;Os.exports=function(t){if(!_v)return ws[t];var e=Pv(ws,t);return e&&e.value}});var vi=a((CS,qs)=>{"use strict";var xs=function(){this.head=null,this.tail=null};xs.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}}};qs.exports=xs});var Cs=a((kS,Rs)=>{"use strict";var Ev=ae();Rs.exports=/ipad|iphone|ipod/i.test(Ev)&&typeof Pebble!="undefined"});var Ls=a((LS,ks)=>{"use strict";var Tv=ae();ks.exports=/web0s(?!.*chrome)/i.test(Tv)});var Us=a((NS,Fs)=>{"use strict";var Te=O(),wv=As(),Ns=je(),gi=hi().set,Ov=vi(),Av=ni(),xv=Cs(),qv=Ls(),mi=Pt(),Ds=Te.MutationObserver||Te.WebKitMutationObserver,$s=Te.document,Ms=Te.process,wt=Te.Promise,Ii=wv("queueMicrotask"),Ee,bi,yi,Ot,Vs;Ii||(Je=new Ov,Xe=function(){var t,e;for(mi&&(t=Ms.domain)&&t.exit();e=Je.get();)try{e()}catch(r){throw Je.head&&Ee(),r}t&&t.enter()},!Av&&!mi&&!qv&&Ds&&$s?(bi=!0,yi=$s.createTextNode(""),new Ds(Xe).observe(yi,{characterData:!0}),Ee=function(){yi.data=bi=!bi}):!xv&&wt&&wt.resolve?(Ot=wt.resolve(void 0),Ot.constructor=wt,Vs=Ns(Ot.then,Ot),Ee=function(){Vs(Xe)}):mi?Ee=function(){Ms.nextTick(Xe)}:(gi=Ns(gi,Te),Ee=function(){gi(Xe)}),Ii=function(t){Je.head||Ee(),Je.add(t)});var Je,Xe;Fs.exports=Ii});var js=a((DS,Bs)=>{"use strict";Bs.exports=function(t,e){try{arguments.length===1?console.error(t):console.error(t,e)}catch(r){}}});var At=a(($S,Ws)=>{"use strict";Ws.exports=function(t){try{return{error:!1,value:t()}}catch(e){return{error:!0,value:e}}}});var Gs=a((MS,Ks)=>{"use strict";var Rv=O(),Cv=A(),Hs=Rv.WeakMap;Ks.exports=Cv(Hs)&&/native code/.test(String(Hs))});var xt=a((VS,Qs)=>{"use strict";var kv=Cr(),Lv=Lr(),zs=kv("keys");Qs.exports=function(t){return zs[t]||(zs[t]=Lv(t))}});var qt=a((FS,Ys)=>{"use strict";Ys.exports={}});var Ei=a((US,Zs)=>{"use strict";var Nv=Gs(),Xs=O(),Dv=j(),$v=be(),Si=Y(),_i=Ue(),Mv=xt(),Vv=qt(),Js="Object already initialized",Pi=Xs.TypeError,Fv=Xs.WeakMap,Rt,Ze,Ct,Uv=function(t){return Ct(t)?Ze(t):Rt(t,{})},Bv=function(t){return function(e){var r;if(!Dv(e)||(r=Ze(e)).type!==t)throw new Pi("Incompatible receiver, "+t+" required");return r}};Nv||_i.state?(H=_i.state||(_i.state=new Fv),H.get=H.get,H.has=H.has,H.set=H.set,Rt=function(t,e){if(H.has(t))throw new Pi(Js);return e.facade=t,H.set(t,e),e},Ze=function(t){return H.get(t)||{}},Ct=function(t){return H.has(t)}):(ce=Mv("state"),Vv[ce]=!0,Rt=function(t,e){if(Si(t,ce))throw new Pi(Js);return e.facade=t,$v(t,ce,e),e},Ze=function(t){return Si(t,ce)?t[ce]:{}},Ct=function(t){return Si(t,ce)});var H,ce;Zs.exports={set:Rt,get:Ze,has:Ct,enforce:Uv,getterFor:Bv}});var le=a((BS,eu)=>{"use strict";var jv=O();eu.exports=jv.Promise});var we=a((jS,ou)=>{"use strict";var Wv=O(),et=le(),Hv=A(),Kv=Vr(),Gv=ti(),zv=D(),tu=Xr(),Qv=Q(),Ti=Tr(),ru=et&&et.prototype,Yv=zv("species"),wi=!1,iu=Hv(Wv.PromiseRejectionEvent),Jv=Kv("Promise",function(){var t=Gv(et),e=t!==String(et);if(!e&&Ti===66||Qv&&!(ru.catch&&ru.finally))return!0;if(!Ti||Ti<51||!/native code/.test(t)){var r=new et(function(n){n(1)}),i=function(n){n(function(){},function(){})},o=r.constructor={};if(o[Yv]=i,wi=r.then(function(){})instanceof i,!wi)return!0}return!e&&(tu==="BROWSER"||tu==="DENO")&&!iu});ou.exports={CONSTRUCTOR:Jv,REJECTION_EVENT:iu,SUBCLASSING:wi}});var Oe=a((WS,au)=>{"use strict";var nu=X(),Xv=TypeError,Zv=function(t){var e,r;this.promise=new t(function(i,o){if(e!==void 0||r!==void 0)throw new Xv("Bad Promise constructor");e=i,r=o}),this.resolve=nu(e),this.reject=nu(r)};au.exports.f=function(t){return new Zv(t)}});var wu=a(()=>{"use strict";var eg=$(),tg=Q(),Dt=Pt(),ie=O(),rg=ge(),Re=B(),su=Pe(),uu=Zr(),ig=Ge(),og=Ja(),ng=X(),Nt=A(),ag=j(),sg=Za(),ug=ii(),pu=hi().set,Ri=Us(),cg=js(),lg=At(),dg=vi(),hu=Ei(),$t=le(),Ci=we(),vu=Oe(),Mt="Promise",gu=Ci.CONSTRUCTOR,fg=Ci.REJECTION_EVENT,pg=Ci.SUBCLASSING,Oi=hu.getterFor(Mt),hg=hu.set,Ae=$t&&$t.prototype,de=$t,kt=Ae,mu=ie.TypeError,Ai=ie.document,ki=ie.process,xi=vu.f,vg=xi,gg=!!(Ai&&Ai.createEvent&&ie.dispatchEvent),bu="unhandledrejection",mg="rejectionhandled",cu=0,yu=1,bg=2,Li=1,Iu=2,Lt,lu,Su,du,_u=function(t){var e;return ag(t)&&Nt(e=t.then)?e:!1},Pu=function(t,e){var r=e.value,i=e.state===yu,o=i?t.ok:t.fail,n=t.resolve,s=t.reject,u=t.domain,d,l,p;try{o?(i||(e.rejection===Iu&&Ig(e),e.rejection=Li),o===!0?d=r:(u&&u.enter(),d=o(r),u&&(u.exit(),p=!0)),d===t.promise?s(new mu("Promise-chain cycle")):(l=_u(d))?Re(l,d,n,s):n(d)):s(r)}catch(h){u&&!p&&u.exit(),s(h)}},Eu=function(t,e){t.notified||(t.notified=!0,Ri(function(){for(var r=t.reactions,i;i=r.get();)Pu(i,t);t.notified=!1,e&&!t.rejection&&yg(t)}))},Tu=function(t,e,r){var i,o;gg?(i=Ai.createEvent("Event"),i.promise=e,i.reason=r,i.initEvent(t,!1,!0),ie.dispatchEvent(i)):i={promise:e,reason:r},!fg&&(o=ie["on"+t])?o(i):t===bu&&cg("Unhandled promise rejection",r)},yg=function(t){Re(pu,ie,function(){var e=t.facade,r=t.value,i=fu(t),o;if(i&&(o=lg(function(){Dt?ki.emit("unhandledRejection",r,e):Tu(bu,e,r)}),t.rejection=Dt||fu(t)?Iu:Li,o.error))throw o.value})},fu=function(t){return t.rejection!==Li&&!t.parent},Ig=function(t){Re(pu,ie,function(){var e=t.facade;Dt?ki.emit("rejectionHandled",e):Tu(mg,e,t.value)})},xe=function(t,e,r){return function(i){t(e,i,r)}},qe=function(t,e,r){t.done||(t.done=!0,r&&(t=r),t.value=e,t.state=bg,Eu(t,!0))},qi=function(t,e,r){if(!t.done){t.done=!0,r&&(t=r);try{if(t.facade===e)throw new mu("Promise can't be resolved itself");var i=_u(e);i?Ri(function(){var o={done:!1};try{Re(i,e,xe(qi,o,t),xe(qe,o,t))}catch(n){qe(o,n,t)}}):(t.value=e,t.state=yu,Eu(t,!1))}catch(o){qe({done:!1},o,t)}}};if(gu&&(de=function(e){sg(this,kt),ng(e),Re(Lt,this);var r=Oi(this);try{e(xe(qi,r),xe(qe,r))}catch(i){qe(r,i)}},kt=de.prototype,Lt=function(e){hg(this,{type:Mt,done:!1,notified:!1,parent:!1,reactions:new dg,rejection:!1,state:cu,value:null})},Lt.prototype=su(kt,"then",function(e,r){var i=Oi(this),o=xi(ug(this,de));return i.parent=!0,o.ok=Nt(e)?e:!0,o.fail=Nt(r)&&r,o.domain=Dt?ki.domain:void 0,i.state===cu?i.reactions.add(o):Ri(function(){Pu(o,i)}),o.promise}),lu=function(){var t=new Lt,e=Oi(t);this.promise=t,this.resolve=xe(qi,e),this.reject=xe(qe,e)},vu.f=xi=function(t){return t===de||t===Su?new lu(t):vg(t)},!tg&&Nt($t)&&Ae!==Object.prototype)){du=Ae.then,pg||su(Ae,"then",function(e,r){var i=this;return new de(function(o,n){Re(du,i,o,n)}).then(e,r)},{unsafe:!0});try{delete Ae.constructor}catch(t){}uu&&uu(Ae,kt)}eg({global:!0,constructor:!0,wrap:!0,forced:gu},{Promise:de});Su=rg.Promise;ig(de,Mt,!1,!0);og(Mt)});var fe=a((GS,Ou)=>{"use strict";Ou.exports={}});var xu=a((zS,Au)=>{"use strict";var Sg=D(),_g=fe(),Pg=Sg("iterator"),Eg=Array.prototype;Au.exports=function(t){return t!==void 0&&(_g.Array===t||Eg[Pg]===t)}});var Ni=a((QS,Ru)=>{"use strict";var Tg=Ke(),qu=pt(),wg=Ve(),Og=fe(),Ag=D(),xg=Ag("iterator");Ru.exports=function(t){if(!wg(t))return qu(t,xg)||qu(t,"@@iterator")||Og[Tg(t)]}});var ku=a((YS,Cu)=>{"use strict";var qg=B(),Rg=X(),Cg=Z(),kg=Fe(),Lg=Ni(),Ng=TypeError;Cu.exports=function(t,e){var r=arguments.length<2?Lg(t):e;if(Rg(r))return Cg(qg(r,t));throw new Ng(kg(t)+" is not iterable")}});var Du=a((JS,Nu)=>{"use strict";var Dg=B(),Lu=Z(),$g=pt();Nu.exports=function(t,e,r){var i,o;Lu(t);try{if(i=$g(t,"return"),!i){if(e==="throw")throw r;return r}i=Dg(i,t)}catch(n){o=!0,i=n}if(e==="throw")throw r;if(o)throw i;return Lu(i),r}});var Ft=a((XS,Fu)=>{"use strict";var Mg=je(),Vg=B(),Fg=Z(),Ug=Fe(),Bg=xu(),jg=Kr(),$u=dt(),Wg=ku(),Hg=Ni(),Mu=Du(),Kg=TypeError,Vt=function(t,e){this.stopped=t,this.result=e},Vu=Vt.prototype;Fu.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),d=Mg(e,i),l,p,h,c,f,g,m,S=function(_){return l&&Mu(l,"normal"),new Vt(!0,_)},I=function(_){return o?(Fg(_),u?d(_[0],_[1],S):d(_[0],_[1])):u?d(_,S):d(_)};if(n)l=t.iterator;else if(s)l=t;else{if(p=Hg(t),!p)throw new Kg(Ug(t)+" is not iterable");if(Bg(p)){for(h=0,c=jg(t);c>h;h++)if(f=I(t[h]),f&&$u(Vu,f))return f;return new Vt(!1)}l=Wg(t,p)}for(g=n?t.next:l.next;!(m=Vg(g,l)).done;){try{f=I(m.value)}catch(_){Mu(l,"throw",_)}if(typeof f=="object"&&f&&$u(Vu,f))return f}return new Vt(!1)}});var Hu=a((ZS,Wu)=>{"use strict";var Gg=D(),Bu=Gg("iterator"),ju=!1;try{Uu=0,Di={next:function(){return{done:!!Uu++}},return:function(){ju=!0}},Di[Bu]=function(){return this},Array.from(Di,function(){throw 2})}catch(t){}var Uu,Di;Wu.exports=function(t,e){try{if(!e&&!ju)return!1}catch(o){return!1}var r=!1;try{var i={};i[Bu]=function(){return{next:function(){return{done:r=!0}}}},t(i)}catch(o){}return r}});var $i=a((e_,Ku)=>{"use strict";var zg=le(),Qg=Hu(),Yg=we().CONSTRUCTOR;Ku.exports=Yg||!Qg(function(t){zg.all(t).then(void 0,function(){})})});var Gu=a(()=>{"use strict";var Jg=$(),Xg=B(),Zg=X(),em=Oe(),tm=At(),rm=Ft(),im=$i();Jg({target:"Promise",stat:!0,forced:im},{all:function(e){var r=this,i=em.f(r),o=i.resolve,n=i.reject,s=tm(function(){var u=Zg(r.resolve),d=[],l=0,p=1;rm(e,function(h){var c=l++,f=!1;p++,Xg(u,r,h).then(function(g){f||(f=!0,d[c]=g,--p||o(d))},n)}),--p||o(d)});return s.error&&n(s.value),i.promise}})});var Qu=a(()=>{"use strict";var om=$(),nm=Q(),am=we().CONSTRUCTOR,Vi=le(),sm=J(),um=A(),cm=Pe(),zu=Vi&&Vi.prototype;om({target:"Promise",proto:!0,forced:am,real:!0},{catch:function(t){return this.then(void 0,t)}});!nm&&um(Vi)&&(Mi=sm("Promise").prototype.catch,zu.catch!==Mi&&cm(zu,"catch",Mi,{unsafe:!0}));var Mi});var Yu=a(()=>{"use strict";var lm=$(),dm=B(),fm=X(),pm=Oe(),hm=At(),vm=Ft(),gm=$i();lm({target:"Promise",stat:!0,forced:gm},{race:function(e){var r=this,i=pm.f(r),o=i.reject,n=hm(function(){var s=fm(r.resolve);vm(e,function(u){dm(s,r,u).then(i.resolve,o)})});return n.error&&o(n.value),i.promise}})});var Ju=a(()=>{"use strict";var mm=$(),bm=Oe(),ym=we().CONSTRUCTOR;mm({target:"Promise",stat:!0,forced:ym},{reject:function(e){var r=bm.f(this),i=r.reject;return i(e),r.promise}})});var Fi=a((c_,Xu)=>{"use strict";var Im=Z(),Sm=j(),_m=Oe();Xu.exports=function(t,e){if(Im(t),Sm(e)&&e.constructor===t)return e;var r=_m.f(t),i=r.resolve;return i(e),r.promise}});var tc=a(()=>{"use strict";var Pm=$(),Em=J(),Zu=Q(),Tm=le(),ec=we().CONSTRUCTOR,wm=Fi(),Om=Em("Promise"),Am=Zu&&!ec;Pm({target:"Promise",stat:!0,forced:Zu||ec},{resolve:function(e){return wm(Am&&this===Om?Tm:this,e)}})});var rc=a(()=>{"use strict";wu();Gu();Qu();Yu();Ju();tc()});var ac=a(()=>{"use strict";var xm=$(),qm=Q(),Ut=le(),Rm=C(),oc=J(),nc=A(),Cm=ii(),ic=Fi(),km=Pe(),Bi=Ut&&Ut.prototype,Lm=!!Ut&&Rm(function(){Bi.finally.call({then:function(){}},function(){})});xm({target:"Promise",proto:!0,real:!0,forced:Lm},{finally:function(t){var e=Cm(this,oc("Promise")),r=nc(t);return this.then(r?function(i){return ic(e,t()).then(function(){return i})}:t,r?function(i){return ic(e,t()).then(function(){throw i})}:t)}});!qm&&nc(Ut)&&(Ui=oc("Promise").prototype.finally,Bi.finally!==Ui&&km(Bi,"finally",Ui,{unsafe:!0}));var Ui});var uc=a((g_,sc)=>{"use strict";xa();rc();ac();var Nm=mt();sc.exports=Nm("Promise","finally")});var lc=a((m_,cc)=>{"use strict";var Dm=uc();cc.exports=Dm});var ji=a((b_,dc)=>{"use strict";var $m=lc();dc.exports=$m});var pc=a((y_,fc)=>{"use strict";var Mm=C();fc.exports=!Mm(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})});var Bt=a((I_,vc)=>{"use strict";var Vm=Y(),Fm=A(),Um=kr(),Bm=xt(),jm=pc(),hc=Bm("IE_PROTO"),Wi=Object,Wm=Wi.prototype;vc.exports=jm?Wi.getPrototypeOf:function(t){var e=Um(t);if(Vm(e,hc))return e[hc];var r=e.constructor;return Fm(r)&&e instanceof r?r.prototype:e instanceof Wi?Wm:null}});var bc=a((S_,mc)=>{"use strict";var Hm=k(),Hi=Y(),Km=ne(),Gm=Gr().indexOf,zm=qt(),gc=Hm([].push);mc.exports=function(t,e){var r=Km(t),i=0,o=[],n;for(n in r)!Hi(zm,n)&&Hi(r,n)&&gc(o,n);for(;e.length>i;)Hi(r,n=e[i++])&&(~Gm(o,n)||gc(o,n));return o}});var Ki=a((__,yc)=>{"use strict";yc.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Gi=a((P_,Ic)=>{"use strict";var Qm=bc(),Ym=Ki();Ic.exports=Object.keys||function(e){return Qm(e,Ym)}});var wc=a((E_,Tc)=>{"use strict";var _c=N(),Jm=C(),Pc=k(),Xm=Bt(),Zm=Gi(),eb=ne(),tb=Ir().f,Ec=Pc(tb),rb=Pc([].push),ib=_c&&Jm(function(){var t=Object.create(null);return t[2]=2,!Ec(t,2)}),Sc=function(t){return function(e){for(var r=eb(e),i=Zm(r),o=ib&&Xm(r)===null,n=i.length,s=0,u=[],d;n>s;)d=i[s++],(!_c||(o?d in r:Ec(r,d)))&&rb(u,t?[d,r[d]]:r[d]);return u}};Tc.exports={entries:Sc(!0),values:Sc(!1)}});var Oc=a(()=>{"use strict";var ob=$(),nb=wc().entries;ob({target:"Object",stat:!0},{entries:function(e){return nb(e)}})});var xc=a((O_,Ac)=>{"use strict";Oc();var ab=ge();Ac.exports=ab.Object.entries});var Rc=a((A_,qc)=>{"use strict";var sb=xc();qc.exports=sb});var Ce=a((x_,Cc)=>{"use strict";var ub=Rc();Cc.exports=ub});var Nc=a((q_,Lc)=>{"use strict";var zi=N(),cb=Y(),kc=Function.prototype,lb=zi&&Object.getOwnPropertyDescriptor,Qi=cb(kc,"name"),db=Qi&&function(){}.name==="something",fb=Qi&&(!zi||zi&&lb(kc,"name").configurable);Lc.exports={EXISTS:Qi,PROPER:db,CONFIGURABLE:fb}});var $c=a(Dc=>{"use strict";var pb=N(),hb=Fr(),vb=se(),gb=Z(),mb=ne(),bb=Gi();Dc.f=pb&&!hb?Object.defineProperties:function(e,r){gb(e);for(var i=mb(r),o=bb(r),n=o.length,s=0,u;n>s;)vb.f(e,u=o[s++],i[u]);return e}});var Zi=a((C_,Wc)=>{"use strict";var yb=Z(),Ib=$c(),Mc=Ki(),Sb=qt(),_b=oi(),Pb=ht(),Eb=xt(),Vc=">",Fc="<",Ji="prototype",Xi="script",Bc=Eb("IE_PROTO"),Yi=function(){},jc=function(t){return Fc+Xi+Vc+t+Fc+"/"+Xi+Vc},Uc=function(t){t.write(jc("")),t.close();var e=t.parentWindow.Object;return t=null,e},Tb=function(){var t=Pb("iframe"),e="java"+Xi+":",r;return t.style.display="none",_b.appendChild(t),t.src=String(e),r=t.contentWindow.document,r.open(),r.write(jc("document.F=Object")),r.close(),r.F},jt,Wt=function(){try{jt=new ActiveXObject("htmlfile")}catch(e){}Wt=typeof document!="undefined"?document.domain&&jt?Uc(jt):Tb():Uc(jt);for(var t=Mc.length;t--;)delete Wt[Ji][Mc[t]];return Wt()};Sb[Bc]=!0;Wc.exports=Object.create||function(e,r){var i;return e!==null?(Yi[Ji]=yb(e),i=new Yi,Yi[Ji]=null,i[Bc]=e):i=Wt(),r===void 0?i:Ib.f(i,r)}});var io=a((k_,Gc)=>{"use strict";var wb=C(),Ob=A(),Ab=j(),xb=Zi(),Hc=Bt(),qb=Pe(),Rb=D(),Cb=Q(),ro=Rb("iterator"),Kc=!1,ee,eo,to;[].keys&&(to=[].keys(),"next"in to?(eo=Hc(Hc(to)),eo!==Object.prototype&&(ee=eo)):Kc=!0);var kb=!Ab(ee)||wb(function(){var t={};return ee[ro].call(t)!==t});kb?ee={}:Cb&&(ee=xb(ee));Ob(ee[ro])||qb(ee,ro,function(){return this});Gc.exports={IteratorPrototype:ee,BUGGY_SAFARI_ITERATORS:Kc}});var Qc=a((L_,zc)=>{"use strict";var Lb=io().IteratorPrototype,Nb=Zi(),Db=Me(),$b=Ge(),Mb=fe(),Vb=function(){return this};zc.exports=function(t,e,r,i){var o=e+" Iterator";return t.prototype=Nb(Lb,{next:Db(+!i,r)}),$b(t,o,!1,!0),Mb[o]=Vb,t}});var al=a((N_,nl)=>{"use strict";var Fb=$(),Ub=B(),Ht=Q(),il=Nc(),Bb=A(),jb=Qc(),Yc=Bt(),Jc=Zr(),Wb=Ge(),Hb=be(),oo=Pe(),Kb=D(),Xc=fe(),ol=io(),Gb=il.PROPER,zb=il.CONFIGURABLE,Zc=ol.IteratorPrototype,Kt=ol.BUGGY_SAFARI_ITERATORS,tt=Kb("iterator"),el="keys",rt="values",tl="entries",rl=function(){return this};nl.exports=function(t,e,r,i,o,n,s){jb(r,e,i);var u=function(I){if(I===o&&c)return c;if(!Kt&&I&&I in p)return p[I];switch(I){case el:return function(){return new r(this,I)};case rt:return function(){return new r(this,I)};case tl:return function(){return new r(this,I)}}return function(){return new r(this)}},d=e+" Iterator",l=!1,p=t.prototype,h=p[tt]||p["@@iterator"]||o&&p[o],c=!Kt&&h||u(o),f=e==="Array"&&p.entries||h,g,m,S;if(f&&(g=Yc(f.call(new t)),g!==Object.prototype&&g.next&&(!Ht&&Yc(g)!==Zc&&(Jc?Jc(g,Zc):Bb(g[tt])||oo(g,tt,rl)),Wb(g,d,!0,!0),Ht&&(Xc[d]=rl))),Gb&&o===rt&&h&&h.name!==rt&&(!Ht&&zb?Hb(p,"name",rt):(l=!0,c=function(){return Ub(h,this)})),o)if(m={values:u(rt),keys:n?c:u(el),entries:u(tl)},s)for(S in m)(Kt||l||!(S in p))&&oo(p,S,m[S]);else Fb({target:e,proto:!0,forced:Kt||l},m);return(!Ht||s)&&p[tt]!==c&&oo(p,tt,c,{name:o}),Xc[e]=c,m}});var ul=a((D_,sl)=>{"use strict";sl.exports=function(t,e){return{value:t,done:e}}});var ao=a(($_,pl)=>{"use strict";var Qb=ne(),no=zr(),cl=fe(),dl=Ei(),Yb=se().f,Jb=al(),Gt=ul(),Xb=Q(),Zb=N(),fl="Array Iterator",ey=dl.set,ty=dl.getterFor(fl);pl.exports=Jb(Array,"Array",function(t,e){ey(this,{type:fl,target:Qb(t),index:0,kind:e})},function(){var t=ty(this),e=t.target,r=t.index++;if(!e||r>=e.length)return t.target=null,Gt(void 0,!0);switch(t.kind){case"keys":return Gt(r,!1);case"values":return Gt(e[r],!1)}return Gt([r,e[r]],!1)},"values");var ll=cl.Arguments=cl.Array;no("keys");no("values");no("entries");if(!Xb&&Zb&&ll.name!=="values")try{Yb(ll,"name",{value:"values"})}catch(t){}});var vl=a((M_,hl)=>{"use strict";var ry=N(),iy=se(),oy=Me();hl.exports=function(t,e,r){ry?iy.f(t,e,oy(0,r)):t[e]=r}});var gl=a(()=>{"use strict";var ny=$(),ay=Ft(),sy=vl();ny({target:"Object",stat:!0},{fromEntries:function(e){var r={};return ay(e,function(i,o){sy(r,i,o)},{AS_ENTRIES:!0}),r}})});var bl=a((U_,ml)=>{"use strict";ao();gl();var uy=ge();ml.exports=uy.Object.fromEntries});var Il=a((B_,yl)=>{"use strict";yl.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 _l=a(()=>{"use strict";ao();var cy=Il(),ly=O(),dy=Ge(),Sl=fe();for(zt in cy)dy(ly[zt],zt),Sl[zt]=Sl.Array;var zt});var El=a((H_,Pl)=>{"use strict";var fy=bl();_l();Pl.exports=fy});var wl=a((K_,Tl)=>{"use strict";var py=El();Tl.exports=py});var fo=a((DP,Fl)=>{"use strict";var my=Ke(),by=String;Fl.exports=function(t){if(my(t)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return by(t)}});var Bl=a(($P,Ul)=>{"use strict";var yy=gt(),Iy=fo(),Sy=ve(),_y=RangeError;Ul.exports=function(e){var r=Iy(Sy(this)),i="",o=yy(e);if(o<0||o===1/0)throw new _y("Wrong number of repetitions");for(;o>0;(o>>>=1)&&(r+=r))o&1&&(i+=r);return i}});var Gl=a((MP,Kl)=>{"use strict";var Hl=k(),Py=Hr(),jl=fo(),Ey=Bl(),Ty=ve(),wy=Hl(Ey),Oy=Hl("".slice),Ay=Math.ceil,Wl=function(t){return function(e,r,i){var o=jl(Ty(e)),n=Py(r),s=o.length,u=i===void 0?" ":jl(i),d,l;return n<=s||u===""?o:(d=n-s,l=wy(u,Ay(d/u.length)),l.length>d&&(l=Oy(l,0,d)),t?o+l:l+o)}};Kl.exports={start:Wl(!1),end:Wl(!0)}});var Ql=a((VP,zl)=>{"use strict";var xy=ae();zl.exports=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(xy)});var Yl=a(()=>{"use strict";var qy=$(),Ry=Gl().start,Cy=Ql();qy({target:"String",proto:!0,forced:Cy},{padStart:function(e){return Ry(this,e,arguments.length>1?arguments[1]:void 0)}})});var Xl=a((BP,Jl)=>{"use strict";Yl();var ky=mt();Jl.exports=ky("String","padStart")});var ed=a((jP,Zl)=>{"use strict";var Ly=Xl();Zl.exports=Ly});var po=a((WP,td)=>{"use strict";var Ny=ed();td.exports=Ny});var By={};Oo(By,{ApiEnv:()=>_e,ConnectionType:()=>It,ContentType:()=>yt,InteractiveInterfaceClick:()=>Qr,MediascopePixel:()=>pr,MediascopePixelTypes:()=>wo,OneStat:()=>rr,Quality:()=>bt,SeekAction:()=>St,ThinOneStat:()=>dr,VERSION:()=>L});module.exports=$d(By);var mo=R(Se(),1);var _e=(s=>(s.PROD="prod",s.VK_ALIAS="vk_alias",s.VIDEOTEST="videotest",s.TEST="test",s.OKCDN="okcdn",s.AUTO="auto",s))(_e||{}),bt=(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))(bt||{}),yt=(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))(yt||{});var It=(i=>(i.HTTP1="http1",i.HTTP2="http2",i.HTTP3="http3",i))(It||{});var St=(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))(St||{}),Qr=(n=>(n.GRAPH_SHOW="iGraphShow",n.GRAPH_HIDE="iGraphHide",n.NEXT_AREA="iNextChapterArea",n.NEXT_BUTTON="iNextChapterBtn",n.WATCH_AGAIN="iWatchAgainBtn",n))(Qr||{}),_a={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"},Pa={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"},Ea={unknown:"un",mobile:"m",lowest:"ls",low:"l",medium:"md",high:"h",fullhd:"f",quadhd:"q",ultrahd:"u"},Ta={pip:"pi",fullscreen:"fs",external:"ex",prefetch:"pr",airplay:"ap",chromecast:"cc",invisible:"iv"};var Oa=require("@vkontakte/videoplayer-shared/es2018");var wa="CIOPGQJGDIHBABABA",Yr={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 ah={apiEnv:"vk_alias",apiKey:wa,requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageInterval:15e3,disabledOperations:["quality"],disabledCustomFields:[],shorten:!0,maxLoops:100,embedUrlParams:[],useBeacon:!0,synchronizeTime:!0,debugLog:!1,clearStorageAtUnload:!0,useVKComIsMobileLogic:!1,backoff:{start:1e3,factor:1.5,max:5*60*1e3,random:.1},useKeepalive:!1},Aa=t=>(0,Oa.fillWithDefault)(t,ah);function Jr(){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/es2018"),ir=require("@vkontakte/videoplayer-shared/es2018");var Qt=R(ji(),1);var Ol=R(Ce(),1),Al=R(wl(),1);var xl=t=>{var o;let{operation:e,custom:r}=t,i=(0,Al.default)((0,Ol.default)(r).map(([n,s])=>{var l,p,h;let u=(l=Pa[n])!=null?l:n,d=s;return s&&(n==="mode"?d=(p=Ta[s])!=null?p:s:n==="quality"&&(d=(h=Ea[s])!=null?h:s)),[u,d]}));return{...t,operation:(o=_a[e])!=null?o:e,custom:i}};var L="1.0.83-dev.c0e6f99b.0";var K=require("@vkontakte/videoplayer-shared/es2018");var hy=/Mobile|mini|Fennec|Android|iP(ad|od|hone)|opera (mini|mobi)/i,it=class{constructor(e){this.consequentAuthErrors=0;this.authorized$=new K.ValueSubject(!1);this.params=e}async authorize(e){return this.authToken=e!=null?e:await 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(()=>{})}async logRequest(e){var s;let r="log.externalLog",i=this.createLogParams(e),o=(s=this.sessionKey)!=null?s:await this._authorizeWithBackoff();if(!o)return;let n=async(u,d=this.params.config.requestRetryCount)=>{try{return await this.params.apiTransport.sendRequest(r,i,o)}catch(l){if(!l||!("error_code"in l)){this.params.error$.next({id:"logRequestUnknown",category:K.ErrorCategory.NETWORK,message:`Unknown ${r} error`,thrown:l});return}let p=l==null?void 0:l.error_code;switch(p){case 102:case 103:case 104:return this.authorized$.next(!1),this.sessionKey=await this._authorizeWithBackoff(),d>0?n(u,d-1):void 0;case 401:return this.authorized$.next(!1),this.authToken=await this.refreshAuthToken(),this.sessionKey=await this._authorizeWithBackoff(),d>0?n(u,d-1):void 0;default:{this.params.error$.next({id:`LogRequest#${p}`,category:K.ErrorCategory.EXTERNAL_API,message:`${r} error`,data:l});return}}}};return n(e)}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}async refreshAuthToken(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=(0,Qt.default)(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise}createLogParams(e){let r="WEB",i=!1,o=`@vkontakte/videoplayer-statistics:${L}`;if(this.params.config.useVKComIsMobileLogic){let{appVersion:n}=window.navigator;i=hy.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(xl):e})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();let e=(0,K.getExponentialDelay)(this.consequentAuthErrors,this.params.config.backoff);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{(0,Qt.default)(this._authorize().then(r).catch(i=>this.params.error$.next({id:"AuthorizeBackoff",category:K.ErrorCategory.NETWORK,message:"Otherwise unhandled error in authorization",thrown:i})),()=>this.backoffTimeoutId=0)},e))})}async _authorize(){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:L.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,Qt.default)(this.params.apiTransport.sendRequest(e,r).then(i=>{var o;return(!i||!i.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:K.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(async i=>{this.sessionKey=void 0;let o=i==null?void 0:i.error_code;switch(o){case 401:return this.authToken=await this.refreshAuthToken(),this._authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:K.ErrorCategory.EXTERNAL_API,message:"authorize error",data:i}):this.params.error$.next({id:"AuthorizeUnknown",category:K.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:oP,NativeAbortController:nP}=function(t){return{NativeAbortSignal:t.AbortSignal,NativeAbortController:t.AbortController}}(typeof self!="undefined"?self:global);function ql(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 Rl(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 Yt=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}},ke=class extends Yt{constructor(){super(),this.listeners||Yt.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(e){e.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,e)),super.dispatchEvent(e)}throwIfAborted(){let{aborted:e,reason:r="Aborted"}=this;if(e)throw r}static timeout(e){let r=new pe;return setTimeout(()=>r.abort(new DOMException(`This signal is timeout in ${e}ms`,"TimeoutError")),e),r.signal}static any(e){let r=new pe;function i(){r.abort(this.reason),o()}function o(){for(let n of e)n.removeEventListener("abort",i)}for(let n of e)if(n.aborted){r.abort(n.reason);break}else n.addEventListener("abort",i);return r.signal}},pe=class{constructor(){Object.defineProperty(this,"signal",{value:new ke,writable:!0,configurable:!0})}abort(e){let r=Rl(e),i=ql(r);this.signal.reason=r,this.signal.dispatchEvent(i)}toString(){return"[object AbortController]"}};typeof Symbol!="undefined"&&Symbol.toStringTag&&(pe.prototype[Symbol.toStringTag]="AbortController",ke.prototype[Symbol.toStringTag]="AbortSignal");function Jt(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 so(t){typeof t=="function"&&(t={fetch:t});let{fetch:e,Request:r=e.Request,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=t;if(!Jt({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,p){let h;p&&p.signal&&(h=p.signal,delete p.signal);let c=new r(l,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:(d,l)=>{let p=n&&n.prototype.isPrototypeOf(d)?d.signal:l?l.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 l&&l.signal&&delete l.signal,Promise.race([c,s(d,l)])}return s(d,l)},Request:n}}var vy=()=>"fetch"in window,ot=vy()&&Jt({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),Cl=ot?so({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,Le=ot?Cl.fetch:window.fetch,vP=ot?Cl.Request:window.Request,gP=ot?pe:window.AbortController,mP=ot?ke:window.AbortSignal;var kl=R(Se(),1),Ll=R(Ce(),1),te=require("@vkontakte/videoplayer-shared/es2018");var nt=class{constructor(e){this.params=e,this.apiKey=e.config.apiKey,this.apiEnv=e.config.apiEnv,this.apiBaseUrl=Yr[this.apiEnv],this.timeSynchronisation=e.timeSynchronisation,this.isApiBaseUrlFetched=!1}async resolveApiBaseUrl(){var e;if(this.apiEnv!=="auto"||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{let r=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=await(await Le(r,{method:"GET",mode:"cors",cache:"no-cache"})).json(),n=(e=o==null?void 0:o.Answer[0])==null?void 0:e.data;if(!n)throw new Error("Wrong DNS response");return n}catch(r){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:te.ErrorCategory.NETWORK,message:"Unhandled resolve api base url error",thrown:r}),Yr.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:te.ErrorCategory.NETWORK,message:"Unhandled beacon error",thrown:s,data:{method:e,params:r}})}return!1}async sendRequest(e,r,i){let o=(0,te.now)(),n=u=>{if(u instanceof TypeError&&(0,kl.default)(["Failed to fetch","NetworkError when attempting to fetch resource."],u.message)){this.params.error$.next({id:"Network",category:te.ErrorCategory.NETWORK,message:"Request failed",thrown:u});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:te.ErrorCategory.NETWORK,message:"Unhandled request error",thrown:u,data:{method:e,params:r,sessionKey:i,time:(0,te.now)()-o}})};this.apiBaseUrl=await 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),Le(`${this.apiBaseUrl}/fb.do`,s).then(u=>{var h,c;let d=Number(u.headers.get("content-length"))===0,l=new Date((h=u.headers.get("date"))!=null?h:"").getTime(),p=(0,te.now)()-o;if(isFinite(l)&&((c=this.timeSynchronisation)==null||c.addServerTime(l,p)),!d)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,Ll.default)(e.queryParams).forEach(([i,o])=>r.append(i,typeof o=="string"?o:JSON.stringify(o))),r}};var Nl=R(Se(),1),Dl=R(Ce(),1),V=require("@vkontakte/videoplayer-shared/es2018"),Xt="onestat_events",uo=t=>e=>e.timestamp+t>=(0,V.now)(),Zt=class{constructor(e){this.unsaltedStorage=[];this.isPaused=!1;this.isUrgent=e=>{let{operation:r}=e;return(0,Nl.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,V.debounceFn)(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});let r=V.safeStorage.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=(0,V.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:V.ErrorCategory.WTF,message:e?String(e):"Unknown logger error",thrown:e})}}readFromStorage(){let e=V.safeStorage.get(Xt);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(uo(this.params.config.storageExpiration));V.safeStorage.set(Xt,JSON.stringify({...r,[this.userSalt]:[...o,e]}))}getFromStorage(){var i;return this.userSalt?((i=this.readFromStorage()[this.userSalt])!=null?i:[]).filter(uo(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}let e=this.readFromStorage();delete e[this.userSalt],V.safeStorage.set(Xt,JSON.stringify(e))}housekeepStorage(){let e=this.readFromStorage();for(let[r,i]of(0,Dl.default)(e)){let o=i.filter(uo(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`})}V.safeStorage.set(Xt,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/es2018"),co=require("@vkontakte/videoplayer-shared/es2018");var $l=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],lo=t=>t&&{[b.HttpConnectionType.HTTP1]:"http1",[b.HttpConnectionType.HTTP2]:"http2",[b.HttpConnectionType.QUIC]:"http3"}[t],Ml=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,co.assertNever)(t)}},er=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,co.assertNever)(t)}},Vl=t=>{switch(t){case"slow-2g":return"poor";case"2g":return"poor";case"3g":return"good";case"4g":return"excellent"}};var tr=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 ho=R(po(),1),rd=()=>(0,ho.default)(Math.floor(Math.random()*2**32).toString(36),7,"0"),id=()=>(0,ho.default)(Math.floor(Math.random()*2**64).toString(36),13,"0");var vo=require("@vkontakte/videoplayer-core/es2018"),P=require("@vkontakte/videoplayer-shared/es2018"),od=(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)(q=>q&&q/1e3)).subscribe(n):s=t.info.position$.subscribe(n),i.add(s)}));let{playing$:u,paused$:d}=t.events,l=t.events.willSeek$.pipe((0,P.filter)(()=>t.info.playbackState$.getValue()===vo.PlaybackState.PLAYING)),p=t.events.seeked$.pipe((0,P.filter)(()=>t.info.playbackState$.getValue()===vo.PlaybackState.PLAYING)),h=!1,c=new P.Subject;i.add(l.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)(d,c,o,t.events.looped$,g),I,_=()=>I=n.getValue(),x=()=>{let w=n.getValue();(0,P.isNullable)(I)||I===w||(0,P.isNullable)(w)||(r.next({from:I,to:w}),I=void 0)},U=()=>{g.next(),f.next()};if(i.add(m.subscribe(_)),i.add(S.subscribe(x)),e.forceInterval&&isFinite(e.forceInterval)){let w=0;i.add(m.subscribe(()=>w=window.setTimeout(U,e.forceInterval))),i.add(S.subscribe(()=>window.clearTimeout(w)))}return i});var Dy="_one-stat_",nd=`${Dy}deviceId`,go=()=>{let t=new v.Subscription;return{subscription:t,subscribe:(e,r)=>{e&&t.add(e.subscribe(r))}}},rr=class{constructor(e,r){this.subscription=new v.Subscription;this.debugLogger=new ir.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 d,l,p;this.statContext=e,this.config=Aa((d=r.config)!=null?d:{}),(0,v.isNonNullable)(r.apiEnv)&&(this.config.apiEnv=r.apiEnv),this.config.synchronizeTime&&(this.timeSynchronisation=new tr);let i=new v.Subject;this.experimental={error$:i};let o=v.safeStorage.get(nd);this.statContext.deviceId?this.deviceId=this.statContext.deviceId:o?this.deviceId=o:(this.deviceId=Jr(),v.safeStorage.set(nd,this.deviceId)),this.resetViewSession(),r.useIsid&&this.isid$.next((l=r.isid)!=null?l:id()),this.zenUid$.next(r.zenUid);let n=new nt({config:this.config,error$:i,timeSynchronisation:this.timeSynchronisation});this.api=new it({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 Zt({config:this.config,debugLogger:this.debugLogger,api:this.api,error$:i,userSalt:r.userSalt});let{isEmbed:s,topOrigin:u}=(0,ir.detectEmbed)();this.isEmbed=s,this.embedParent=u?new URL(u).hostname:void 0,this.subscribe()}updateContext(e){this.statContext={...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(od(e,{forceInterval:this.config.watchCoverageInterval}),c=>{var S,I,_,x;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 U=(S=e.info.liveLatency$.getValue())!=null?S:0,w=(_=(I=e.info.currentBuffer$.getValue())==null?void 0:I.end)!=null?_:0,q=(x=e.info.liveBufferTime$.getValue())!=null?x:0,st=Math.round((U-(w-q))*1e3),ut=Math.round(U*1e3);st&&ut&&(m.latency=st,m.bufferLatency=ut)}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,d=!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=>{!d&&c&&c.end-c.start>0&&(0,v.isNonNullable)(s)&&(this.logPlayerReady({duration:(0,v.now)()-s}),d=!0)}),i(e.events.firstFrame$,()=>{(0,v.isNonNullable)(s)&&!d&&(this.logPlayerReady({duration:(0,v.now)()-s}),d=!0),(0,v.isNonNullable)(u)&&this.logFirstFrame({time:(0,v.now)()-u})});let l;i(e.info.currentVideoStream$,c=>{c&&(l&&c.id!==l&&this.logTrackSwitch(c),l=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=$l(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:Ml(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:lo(c)}),this.updateContext({connectionType:lo(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:er(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}=go();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":er((s=this.player)==null?void 0:s.info.surface$.getValue());this.updateContext({mode:n})}),i(e.inFullscreen$,o=>{var s;let n=o?"fullscreen":er((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}=go();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}=go();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(rd())}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:Vl(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,mo.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(),d=e==="empty_buffer"||e==="close_at_empty_buffer"?this.statContext.connectionType:this.statContext.firstConnectionType,l=this.statContext.firstConnectionReused,p,h;if(this.isEmbed||this.statContext.place==="embed"){p=this.embedParent;let x=[...new URLSearchParams(location.search).entries()].filter(([U,w])=>(0,mo.default)(this.config.embedUrlParams,U));h=new URLSearchParams(x).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={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:d,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: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 x of this.config.disabledCustomFields)delete c[x];return{operation:e,type:1,time:i,network:this.statContext.network,timestamp:n,custom:c}}};var dr={};Oo(dr,{SeekType:()=>or,ThinOneStat:()=>lr,VERSION:()=>L});var T=require("@vkontakte/videoplayer-shared/es2018"),z=require("@vkontakte/videoplayer-core/es2018");var ud=require("@vkontakte/videoplayer-shared/es2018");var or=(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))(or||{});var sd="CIOPGQJGDIHBABABA",bo={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 $y={apiKey:sd,apiEnv:"vk_alias",requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageHeartbeatInterval:15,synchronizeTime:!0,useBeacon:!1,alwaysSendDesktop:!1},cd=t=>(0,ud.fillWithDefault)(t,$y);var yo=R(ji(),1),G=require("@vkontakte/videoplayer-shared/es2018");var nr=class{constructor(e){this.params=e,this.authorized$=new G.ValueSubject(!1),this.consequentAuthErrors=0}async authorize(e){return this.authToken=e!=null?e:await 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(()=>{})}async logRequest(e){var u;let r="log.logUvStat",i=this.createLogParams(e),o={},n=(u=this.sessionKey)!=null?u:await this.authorizeWithBackoff();if(!n)return;let s=async(d,l=this.params.config.requestRetryCount)=>{try{return await this.params.apiTransport.sendRequest(r,i,n,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 h=p==null?void 0:p.error_code;switch(h){case 102:case 103:case 104:return this.authorized$.next(!1),this.sessionKey=await this.authorizeWithBackoff(),l>0?s(d,l-1):void 0;case 401:return this.authorized$.next(!1),this.authToken=await this.refreshAuthToken(),this.sessionKey=await this.authorizeWithBackoff(),l>0?s(d,l-1):void 0;default:{this.params.error$.next({id:`LogRequest#${h}`,category:G.ErrorCategory.EXTERNAL_API,message:`${r} error`,data:p});return}}}};return s(e)}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}async refreshAuthToken(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=(0,yo.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:${L}`,platform:e[0].platform,product:e[0].product,events:e})}}authorizeWithBackoff(){if(!this.consequentAuthErrors)return this.doAuthorize();let e=(0,G.getExponentialDelay)(this.consequentAuthErrors);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(async()=>{try{let i=await this.doAuthorize();r(i)}catch(i){this.params.error$.next({id:"AuthorizeBackoff",category:G.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:L.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,yo.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(async i=>{this.sessionKey=void 0;let o=i==null?void 0:i.error_code;switch(o){case 401:return this.authToken=await 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 ld=R(Se(),1);var dd=R(Ce(),1),re=require("@vkontakte/videoplayer-shared/es2018");var ar=class{constructor(e){this.params=e,this.apiKey=e.config.apiKey,this.apiEnv=e.config.apiEnv,this.apiBaseUrl=bo[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:re.ErrorCategory.NETWORK,message:"Unhandled beacon error",thrown:s,data:{method:e,params:r}})}return!1}async sendRequest(e,r,i,o){let n=(0,re.now)(),s=u=>{if(u instanceof TypeError&&(0,ld.default)(["Failed to fetch","NetworkError when attempting to fetch resource."],u.message)){this.params.error$.next({id:"Network",category:re.ErrorCategory.NETWORK,message:"Request failed",thrown:u});return}this.params.error$.next({id:"ThinOneStat:ApiTransport:sendRequest",category:re.ErrorCategory.NETWORK,message:"Unhandled request error",thrown:u,data:{method:e,params:r,sessionKey:i,time:(0,re.now)()-n}})};return this.apiBaseUrl=await this.resolveApiBaseUrl(),Le(`${this.apiBaseUrl}/fb.do`,{method:"post",headers:{"Content-type":"application/x-www-form-urlencoded",...o},body:this.prepareQueryParams({method:e,queryParams:r,sessionKey:i})}).then(u=>{var h,c;let d=Number(u.headers.get("content-length"))===0,l=new Date((h=u.headers.get("date"))!=null?h:"").getTime(),p=(0,re.now)()-n;if(isFinite(l)&&((c=this.timeSynchronisation)==null||c.addServerTime(l,p)),!d)return u.json().then(f=>Object.prototype.hasOwnProperty.call(f,"error_msg")?Promise.reject(f):f,s)},s)}async resolveApiBaseUrl(){var e;if(this.apiEnv!=="auto"||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{let r=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=await(await Le(r,{method:"GET",mode:"cors",cache:"no-cache"})).json(),n=(e=o==null?void 0:o.Answer[0])==null?void 0:e.data;if(!n)throw new Error("Wrong DNS response");return n}catch(r){return this.params.error$.next({id:"ThinOneStat:ApiTransport:resolveApiBaseUrl",category:re.ErrorCategory.NETWORK,message:"Unhandled resolve api base url error",thrown:r}),bo.vk_alias}finally{this.isApiBaseUrlFetched=!0}}prepareQueryParams(e){let r=new URLSearchParams({format:"JSON",method:e.method,application_key:this.apiKey});return e.sessionKey!==void 0&&r.append("session_key",e.sessionKey),(0,dd.default)(e.queryParams).forEach(([i,o])=>r.append(i,typeof o=="string"?o:JSON.stringify(o))),r}};var fd=R(Se(),1),pd=R(Ce(),1),F=require("@vkontakte/videoplayer-shared/es2018"),sr="thinonestat_events",Io=t=>e=>e.client_time+t>=(0,F.now)(),ur=class{constructor(e){this.unsaltedStorage=[];this.isPaused=!1;this.isUrgent=e=>{let{event_name:r}=e;return(0,fd.default)(["watch_coverage","watch_coverage_live","watched_n","playback_started"],r)};this.params=e,this.api=e.api,this.error$=e.error$,this.userSalt=e.userSalt,this.loggerDebugLog=e.debugLogger.createComponentLog("stat logger"),this.firstFlush=(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:String(e)||"Unknown logger error",thrown:e})}}readFromStorage(){let e=F.safeStorage.get(sr);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(Io(this.params.config.storageExpiration));F.safeStorage.set(sr,JSON.stringify({...r,[this.userSalt]:[...o,e]}))}getFromStorage(){var i;return this.userSalt?((i=this.readFromStorage()[this.userSalt])!=null?i:[]).filter(Io(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}let e=this.readFromStorage();delete e[this.userSalt],F.safeStorage.set(sr,JSON.stringify(e))}housekeepStorage(){let e=this.readFromStorage();for(let[r,i]of(0,pd.default)(e)){let o=i.filter(Io(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(sr,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 So(){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 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 _o=require("@vkontakte/videoplayer-core/es2018"),E=require("@vkontakte/videoplayer-shared/es2018"),hd=(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(q=>{n&&(n.unsubscribe(),o.next(void 0)),q?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$:d,looped$:l}=t.events,p=t.events.willSeek$.pipe((0,E.filter)(()=>t.info.playbackState$.getValue()===_o.PlaybackState.PLAYING)),h=t.events.seeked$.pipe((0,E.filter)(()=>t.info.playbackState$.getValue()===_o.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 q=o.getValue();(0,E.isNullable)(m)||(0,E.isNullable)(q)||m===q||(r.next({from:m,to:q}),m=void 0)},_=new E.Subject,x=new E.Subject,U=(0,E.merge)(s,f,_),w=(0,E.merge)(u,h,g,d,l,x);if(i.add(U.subscribe(S)).add(w.subscribe(I)),e.heartbeatInterval&&isFinite(e.heartbeatInterval)){let q=[],st=e.heartbeatInterval*1e3,ut=()=>{x.next(),_.next()};i.add(U.subscribe(()=>{let hr=window.setTimeout(ut,st);q.push(hr)})).add(w.subscribe(()=>{q.forEach(hr=>{window.clearTimeout(hr)}),q=[]}))}return i});var vd=require("@vkontakte/videoplayer-core/es2018"),gd=require("@vkontakte/videoplayer-shared/es2018"),md=(t,e)=>new gd.Observable(r=>{let i=new vd.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 he=require("@vkontakte/videoplayer-shared/es2018"),bd=t=>new he.Observable(e=>{let r=new he.Subscription,i=0,o=1,n=0,s=!1,u=!1,d=()=>{if(!s)return;let w=Date.now();n+=(w-i)*o,i=w},l=()=>{(!s||u)&&(i=Date.now(),s=!0,u=!1)},p=()=>{s&&(d(),s=!1)},h=()=>{s&&(d(),s=!1,u=!0)},c=w=>{s&&d(),o=w,i=Date.now()},{started$:f,playing$:g,paused$:m,willSeek$:S,ended$:I,willDestruct$:_}=t.events,{currentPlaybackRate$:x}=t.info;r.add(S.subscribe(h)).add((0,he.merge)(f,g).subscribe(l)).add((0,he.merge)(m,I,_).subscribe(p)).add(x.subscribe(c));let U=()=>{let w=n;return s&&(w+=(Date.now()-i)*o),Math.floor(w/1e3)};return e.next(U),r});var Po=require("@vkontakte/videoplayer-shared/es2018"),y=require("@vkontakte/videoplayer-core/es2018");var Eo=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,Po.assertNever)(t)}},oe=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,Po.assertNever)(t)}},yd=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}},Id=(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}},Sd=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"}},_d=t=>{if(t!==void 0)return t===y.Surface.INVISIBLE?"background":"foreground"};var To=R(po(),1),Pd=()=>(0,To.default)(Math.floor(Math.random()*2**32).toString(36),13,"0"),Ed=()=>(0,To.default)(Math.floor(Math.random()*2**64).toString(36),13,"0");var My="_thin-one-stat_",Td=`${My}deviceId`,Vy=()=>{let t=new T.Subscription;return{subscription:t,subscribe:(e,r)=>{e&&t.add(e.subscribe(r))}}},lr=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 d,l;this.statContext=e,this.config=cd((d=r.config)!=null?d:{}),this.subscription=new T.Subscription,this.config.synchronizeTime&&(this.timeSynchronisation=new cr);let i=new T.Subject,o=T.safeStorage.get(Td);this.statContext.deviceId?this.deviceId=this.statContext.deviceId:o?this.deviceId=o:(this.deviceId=So(),T.safeStorage.set(Td,this.deviceId)),this.resetViewSession(),r.useIsid&&this.isid$.next((l=r.isid)!=null?l:Ed());let n=new ar({error$:i,config:this.config,timeSynchronisation:this.timeSynchronisation});this.api=new nr({config:this.config,apiTransport:n,error$:i,deviceId:this.deviceId,refreshAuthToken:r.refreshAuthToken}),this.logger=new ur({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={...this.statContext,...e}}attachTo(e){let r=new T.Subscription,i=(n,s)=>r.add(n.subscribe(s));i(bd(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(hd(e,{heartbeatInterval:this.config.watchCoverageHeartbeatInterval}),n=>{let s=Math.round(n.from*1e3),u=Math.round(n.to*1e3),d={watch_interval:`${s}-${u}`,in_history:!!this.statContext.inHistory,content_type:Eo(e.info.currentFormat$.getValue()),playback_quality:oe(e.info.currentQuality$.getValue()),recom_info:this.statContext.recomInfo};if(!e.info.isLive$.getValue())this.logWatchCoverage(d);else{let p=e.info.atLiveEdge$.getValue();this.logWatchCoverageLive({...d,live:!!p})}}),i(md(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:yd(Eo(e.info.currentFormat$.getValue())),dpi:z.clientChecker.display.pixelRatio,web_layout:z.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(),d=e.info.currentQuality$.getValue(),l={target_buffer_time:u?u.end-u.start:void 0,playback_url:Id(n,s,d),playback_quality:oe(d)};this.logPreloadStarted(l)}}),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===z.PlaybackState.PLAYING){let u=e.info.currentBuffer$.getValue(),d={buffer_time:u?u.end-u.start:void 0};if(this.logPlaying(d),this.isStarted)this.logResume();else{this.isStarted=!0;let l=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:oe(l),user_quality:p?"auto":oe(l),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:Sd(f),visibility:_d(f),subtitles_enabled:!!m,auto_subtitles:!!((s=g.find(({id:x})=>x===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===z.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 d=e.info.isAutoQualityEnabled$.getValue(),l=(s=e.info.currentVideoStream$.getValue())==null?void 0:s.codec,p=(u=e.info.currentAudioStream$.getValue())==null?void 0:u.codec,h={user_quality:d?"auto":oe(n),playback_quality:oe(n),download_quality:oe(n),codec_info:l&&p?`${l},${p}`:void 0,manual_switch:!d};this.logQualityChanged(h)}}),this.resubscribeBeforeunload(),this.subscription.add(r),r}attachToUi(e){let{subscribe:r,subscription:i}=Vy();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(Pd()),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:${L}`,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:L,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({...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 wo={};var Fy=(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)},Uy=t=>window.clearTimeout(t),wd=t=>typeof t=="function"&&(t==null?void 0:t.toString().endsWith("{ [native code] }")),Od=!wd(window.requestIdleCallback)||!wd(window.cancelIdleCallback),Ad=Od?Fy:window.requestIdleCallback,xd=Od?Uy:window.cancelIdleCallback;var at=require("@vkontakte/videoplayer-core/es2018"),Rd=require("@vkontakte/videoplayer-shared/es2018");var fr=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 qd=()=>window.Image?new Image:document.createElement("img");var pr=class{constructor(e){this.position=0;this.started=!1;this.heartbeatPixels=[];this.heartbeatLastTimeSent={};this.idleCallbackIds=[];this.stopwatch=new fr;this.subscription=new at.Subscription;this.params=e;let r=new Rd.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=>xd(e)),this.send("stop")}onPlaybackState(e){e===at.PlaybackState.PLAYING?this.started?this.play():this.start():e===at.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(Ad(()=>qd().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 Cd=Object.create;var ct=Object.defineProperty;var Ld=Object.getOwnPropertyDescriptor;var kd=Object.getOwnPropertyNames;var Nd=Object.getPrototypeOf,Dd=Object.prototype.hasOwnProperty;var a=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Oo=(t,e)=>{for(var r in e)ct(t,r,{get:e[r],enumerable:!0})},Ao=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of kd(e))!Dd.call(t,o)&&o!==r&&ct(t,o,{get:()=>e[o],enumerable:!(i=Ld(e,o))||i.enumerable});return t};var R=(t,e,r)=>(r=t!=null?Cd(Nd(t)):{},Ao(e||!t||!t.__esModule?ct(r,"default",{value:t,enumerable:!0}):r,t)),$d=t=>Ao(ct({},"__esModule",{value:!0}),t);var O=a((vr,xo)=>{"use strict";var Ne=function(t){return t&&t.Math===Math&&t};xo.exports=Ne(typeof globalThis=="object"&&globalThis)||Ne(typeof window=="object"&&window)||Ne(typeof self=="object"&&self)||Ne(typeof global=="object"&&global)||Ne(typeof vr=="object"&&vr)||function(){return this}()||Function("return this")()});var C=a((Wy,qo)=>{"use strict";qo.exports=function(t){try{return!!t()}catch(e){return!0}}});var De=a((Hy,Ro)=>{"use strict";var Md=C();Ro.exports=!Md(function(){var t=function(){}.bind();return typeof t!="function"||t.hasOwnProperty("prototype")})});var gr=a((Ky,No)=>{"use strict";var Vd=De(),ko=Function.prototype,Co=ko.apply,Lo=ko.call;No.exports=typeof Reflect=="object"&&Reflect.apply||(Vd?Lo.bind(Co):function(){return Lo.apply(Co,arguments)})});var L=a((Gy,Mo)=>{"use strict";var Do=De(),$o=Function.prototype,mr=$o.call,Fd=Do&&$o.bind.bind(mr,mr);Mo.exports=Do?Fd:function(t){return function(){return mr.apply(t,arguments)}}});var $e=a((zy,Fo)=>{"use strict";var Vo=L(),Ud=Vo({}.toString),Bd=Vo("".slice);Fo.exports=function(t){return Bd(Ud(t),8,-1)}});var br=a((Qy,Uo)=>{"use strict";var jd=$e(),Wd=L();Uo.exports=function(t){if(jd(t)==="Function")return Wd(t)}});var A=a((Yy,Bo)=>{"use strict";var yr=typeof document=="object"&&document.all;Bo.exports=typeof yr=="undefined"&&yr!==void 0?function(t){return typeof t=="function"||t===yr}:function(t){return typeof t=="function"}});var N=a((Jy,jo)=>{"use strict";var Hd=C();jo.exports=!Hd(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var B=a((Xy,Wo)=>{"use strict";var Kd=De(),lt=Function.prototype.call;Wo.exports=Kd?lt.bind(lt):function(){return lt.apply(lt,arguments)}});var Ir=a(Go=>{"use strict";var Ho={}.propertyIsEnumerable,Ko=Object.getOwnPropertyDescriptor,Gd=Ko&&!Ho.call({1:2},1);Go.f=Gd?function(e){var r=Ko(this,e);return!!r&&r.enumerable}:Ho});var Me=a((eI,zo)=>{"use strict";zo.exports=function(t,e){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:e}}});var Yo=a((tI,Qo)=>{"use strict";var zd=L(),Qd=C(),Yd=$e(),Sr=Object,Jd=zd("".split);Qo.exports=Qd(function(){return!Sr("z").propertyIsEnumerable(0)})?function(t){return Yd(t)==="String"?Jd(t,""):Sr(t)}:Sr});var Ve=a((rI,Jo)=>{"use strict";Jo.exports=function(t){return t==null}});var ve=a((iI,Xo)=>{"use strict";var Xd=Ve(),Zd=TypeError;Xo.exports=function(t){if(Xd(t))throw new Zd("Can't call method on "+t);return t}});var ne=a((oI,Zo)=>{"use strict";var ef=Yo(),tf=ve();Zo.exports=function(t){return ef(tf(t))}});var j=a((nI,en)=>{"use strict";var rf=A();en.exports=function(t){return typeof t=="object"?t!==null:rf(t)}});var ge=a((aI,tn)=>{"use strict";tn.exports={}});var J=a((sI,on)=>{"use strict";var _r=ge(),Pr=O(),of=A(),rn=function(t){return of(t)?t:void 0};on.exports=function(t,e){return arguments.length<2?rn(_r[t])||rn(Pr[t]):_r[t]&&_r[t][e]||Pr[t]&&Pr[t][e]}});var dt=a((uI,nn)=>{"use strict";var nf=L();nn.exports=nf({}.isPrototypeOf)});var ae=a((cI,un)=>{"use strict";var af=O(),an=af.navigator,sn=an&&an.userAgent;un.exports=sn?String(sn):""});var Tr=a((lI,hn)=>{"use strict";var pn=O(),Er=ae(),cn=pn.process,ln=pn.Deno,dn=cn&&cn.versions||ln&&ln.version,fn=dn&&dn.v8,W,ft;fn&&(W=fn.split("."),ft=W[0]>0&&W[0]<4?1:+(W[0]+W[1]));!ft&&Er&&(W=Er.match(/Edge\/(\d+)/),(!W||W[1]>=74)&&(W=Er.match(/Chrome\/(\d+)/),W&&(ft=+W[1])));hn.exports=ft});var wr=a((dI,gn)=>{"use strict";var vn=Tr(),sf=C(),uf=O(),cf=uf.String;gn.exports=!!Object.getOwnPropertySymbols&&!sf(function(){var t=Symbol("symbol detection");return!cf(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&vn&&vn<41})});var Or=a((fI,mn)=>{"use strict";var lf=wr();mn.exports=lf&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Ar=a((pI,bn)=>{"use strict";var df=J(),ff=A(),pf=dt(),hf=Or(),vf=Object;bn.exports=hf?function(t){return typeof t=="symbol"}:function(t){var e=df("Symbol");return ff(e)&&pf(e.prototype,vf(t))}});var Fe=a((hI,yn)=>{"use strict";var gf=String;yn.exports=function(t){try{return gf(t)}catch(e){return"Object"}}});var X=a((vI,In)=>{"use strict";var mf=A(),bf=Fe(),yf=TypeError;In.exports=function(t){if(mf(t))return t;throw new yf(bf(t)+" is not a function")}});var pt=a((gI,Sn)=>{"use strict";var If=X(),Sf=Ve();Sn.exports=function(t,e){var r=t[e];return Sf(r)?void 0:If(r)}});var Pn=a((mI,_n)=>{"use strict";var xr=B(),qr=A(),Rr=j(),_f=TypeError;_n.exports=function(t,e){var r,i;if(e==="string"&&qr(r=t.toString)&&!Rr(i=xr(r,t))||qr(r=t.valueOf)&&!Rr(i=xr(r,t))||e!=="string"&&qr(r=t.toString)&&!Rr(i=xr(r,t)))return i;throw new _f("Can't convert object to primitive value")}});var Q=a((bI,En)=>{"use strict";En.exports=!0});var On=a((yI,wn)=>{"use strict";var Tn=O(),Pf=Object.defineProperty;wn.exports=function(t,e){try{Pf(Tn,t,{value:e,configurable:!0,writable:!0})}catch(r){Tn[t]=e}return e}});var Ue=a((II,qn)=>{"use strict";var Ef=Q(),Tf=O(),wf=On(),An="__core-js_shared__",xn=qn.exports=Tf[An]||wf(An,{});(xn.versions||(xn.versions=[])).push({version:"3.43.0",mode:Ef?"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 Cr=a((SI,Cn)=>{"use strict";var Rn=Ue();Cn.exports=function(t,e){return Rn[t]||(Rn[t]=e||{})}});var Lr=a((_I,Ln)=>{"use strict";var Of=ve(),Af=Object;Ln.exports=function(t){return Af(Of(t))}});var Y=a((PI,kn)=>{"use strict";var xf=L(),qf=Lr(),Rf=xf({}.hasOwnProperty);kn.exports=Object.hasOwn||function(e,r){return Rf(qf(e),r)}});var kr=a((EI,Nn)=>{"use strict";var Cf=L(),Lf=0,kf=Math.random(),Nf=Cf(1.1.toString);Nn.exports=function(t){return"Symbol("+(t===void 0?"":t)+")_"+Nf(++Lf+kf,36)}});var D=a((TI,$n)=>{"use strict";var Df=O(),$f=Cr(),Dn=Y(),Mf=kr(),Vf=wr(),Ff=Or(),me=Df.Symbol,Nr=$f("wks"),Uf=Ff?me.for||me:me&&me.withoutSetter||Mf;$n.exports=function(t){return Dn(Nr,t)||(Nr[t]=Vf&&Dn(me,t)?me[t]:Uf("Symbol."+t)),Nr[t]}});var Un=a((wI,Fn)=>{"use strict";var Bf=B(),Mn=j(),Vn=Ar(),jf=pt(),Wf=Pn(),Hf=D(),Kf=TypeError,Gf=Hf("toPrimitive");Fn.exports=function(t,e){if(!Mn(t)||Vn(t))return t;var r=jf(t,Gf),i;if(r){if(e===void 0&&(e="default"),i=Bf(r,t,e),!Mn(i)||Vn(i))return i;throw new Kf("Can't convert object to primitive value")}return e===void 0&&(e="number"),Wf(t,e)}});var Dr=a((OI,Bn)=>{"use strict";var zf=Un(),Qf=Ar();Bn.exports=function(t){var e=zf(t,"string");return Qf(e)?e:e+""}});var ht=a((AI,Wn)=>{"use strict";var Yf=O(),jn=j(),$r=Yf.document,Jf=jn($r)&&jn($r.createElement);Wn.exports=function(t){return Jf?$r.createElement(t):{}}});var Mr=a((xI,Hn)=>{"use strict";var Xf=N(),Zf=C(),ep=ht();Hn.exports=!Xf&&!Zf(function(){return Object.defineProperty(ep("div"),"a",{get:function(){return 7}}).a!==7})});var zn=a(Gn=>{"use strict";var tp=N(),rp=B(),ip=Ir(),op=Me(),np=ne(),ap=Dr(),sp=Y(),up=Mr(),Kn=Object.getOwnPropertyDescriptor;Gn.f=tp?Kn:function(e,r){if(e=np(e),r=ap(r),up)try{return Kn(e,r)}catch(i){}if(sp(e,r))return op(!rp(ip.f,e,r),e[r])}});var Vr=a((RI,Qn)=>{"use strict";var cp=C(),lp=A(),dp=/#|\.prototype\./,Be=function(t,e){var r=pp[fp(t)];return r===vp?!0:r===hp?!1:lp(e)?cp(e):!!e},fp=Be.normalize=function(t){return String(t).replace(dp,".").toLowerCase()},pp=Be.data={},hp=Be.NATIVE="N",vp=Be.POLYFILL="P";Qn.exports=Be});var je=a((CI,Jn)=>{"use strict";var Yn=br(),gp=X(),mp=De(),bp=Yn(Yn.bind);Jn.exports=function(t,e){return gp(t),e===void 0?t:mp?bp(t,e):function(){return t.apply(e,arguments)}}});var Fr=a((LI,Xn)=>{"use strict";var yp=N(),Ip=C();Xn.exports=yp&&Ip(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var Z=a((kI,Zn)=>{"use strict";var Sp=j(),_p=String,Pp=TypeError;Zn.exports=function(t){if(Sp(t))return t;throw new Pp(_p(t)+" is not an object")}});var se=a(ta=>{"use strict";var Ep=N(),Tp=Mr(),wp=Fr(),vt=Z(),ea=Dr(),Op=TypeError,Ur=Object.defineProperty,Ap=Object.getOwnPropertyDescriptor,Br="enumerable",jr="configurable",Wr="writable";ta.f=Ep?wp?function(e,r,i){if(vt(e),r=ea(r),vt(i),typeof e=="function"&&r==="prototype"&&"value"in i&&Wr in i&&!i[Wr]){var o=Ap(e,r);o&&o[Wr]&&(e[r]=i.value,i={configurable:jr in i?i[jr]:o[jr],enumerable:Br in i?i[Br]:o[Br],writable:!1})}return Ur(e,r,i)}:Ur:function(e,r,i){if(vt(e),r=ea(r),vt(i),Tp)try{return Ur(e,r,i)}catch(o){}if("get"in i||"set"in i)throw new Op("Accessors not supported");return"value"in i&&(e[r]=i.value),e}});var be=a((DI,ra)=>{"use strict";var xp=N(),qp=se(),Rp=Me();ra.exports=xp?function(t,e,r){return qp.f(t,e,Rp(1,r))}:function(t,e,r){return t[e]=r,t}});var $=a(($I,oa)=>{"use strict";var We=O(),Cp=gr(),Lp=br(),kp=A(),Np=zn().f,Dp=Vr(),ye=ge(),$p=je(),Ie=be(),ia=Y();Ue();var Mp=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 Cp(t,this,arguments)};return e.prototype=t.prototype,e};oa.exports=function(t,e){var r=t.target,i=t.global,o=t.stat,n=t.proto,s=i?We:o?We[r]:We[r]&&We[r].prototype,u=i?ye:ye[r]||Ie(ye,r,{})[r],d=u.prototype,l,p,h,c,f,g,m,S,I;for(c in e)l=Dp(i?c:r+(o?".":"#")+c,t.forced),p=!l&&s&&ia(s,c),g=u[c],p&&(t.dontCallGetSet?(I=Np(s,c),m=I&&I.value):m=s[c]),f=p&&m?m:e[c],!(!l&&!n&&typeof g==typeof f)&&(t.bind&&p?S=$p(f,We):t.wrap&&p?S=Mp(f):n&&kp(f)?S=Lp(f):S=f,(t.sham||f&&f.sham||g&&g.sham)&&Ie(S,"sham",!0),Ie(u,c,S),n&&(h=r+"Prototype",ia(ye,h)||Ie(ye,h,{}),Ie(ye[h],c,f),t.real&&d&&(l||!d[c])&&Ie(d,c,f)))}});var aa=a((MI,na)=>{"use strict";var Vp=Math.ceil,Fp=Math.floor;na.exports=Math.trunc||function(e){var r=+e;return(r>0?Fp:Vp)(r)}});var gt=a((VI,sa)=>{"use strict";var Up=aa();sa.exports=function(t){var e=+t;return e!==e||e===0?0:Up(e)}});var ca=a((FI,ua)=>{"use strict";var Bp=gt(),jp=Math.max,Wp=Math.min;ua.exports=function(t,e){var r=Bp(t);return r<0?jp(r+e,0):Wp(r,e)}});var Hr=a((UI,la)=>{"use strict";var Hp=gt(),Kp=Math.min;la.exports=function(t){var e=Hp(t);return e>0?Kp(e,9007199254740991):0}});var Kr=a((BI,da)=>{"use strict";var Gp=Hr();da.exports=function(t){return Gp(t.length)}});var Gr=a((jI,pa)=>{"use strict";var zp=ne(),Qp=ca(),Yp=Kr(),fa=function(t){return function(e,r,i){var o=zp(e),n=Yp(o);if(n===0)return!t&&-1;var s=Qp(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}};pa.exports={includes:fa(!0),indexOf:fa(!1)}});var zr=a((WI,ha)=>{"use strict";ha.exports=function(){}});var va=a(()=>{"use strict";var Jp=$(),Xp=Gr().includes,Zp=C(),eh=zr(),th=Zp(function(){return!Array(1).includes()});Jp({target:"Array",proto:!0,forced:th},{includes:function(e){return Xp(this,e,arguments.length>1?arguments[1]:void 0)}});eh("includes")});var mt=a((GI,ga)=>{"use strict";var rh=J();ga.exports=rh});var ba=a((zI,ma)=>{"use strict";va();var ih=mt();ma.exports=ih("Array","includes")});var Ia=a((QI,ya)=>{"use strict";var oh=ba();ya.exports=oh});var Se=a((YI,Sa)=>{"use strict";var nh=Ia();Sa.exports=nh});var xa=a(()=>{"use strict"});var Xr=a((uS,qa)=>{"use strict";var He=O(),sh=ae(),uh=$e(),_t=function(t){return sh.slice(0,t.length)===t};qa.exports=function(){return _t("Bun/")?"BUN":_t("Cloudflare-Workers")?"CLOUDFLARE":_t("Deno/")?"DENO":_t("Node.js/")?"NODE":He.Bun&&typeof Bun.version=="string"?"BUN":He.Deno&&typeof Deno.version=="object"?"DENO":uh(He.process)==="process"?"NODE":He.window&&He.document?"BROWSER":"REST"}()});var Pt=a((cS,Ra)=>{"use strict";var ch=Xr();Ra.exports=ch==="NODE"});var Pe=a((lS,Ca)=>{"use strict";var lh=be();Ca.exports=function(t,e,r,i){return i&&i.enumerable?t[e]=r:lh(t,e,r),t}});var ka=a((dS,La)=>{"use strict";var dh=L(),fh=X();La.exports=function(t,e,r){try{return dh(fh(Object.getOwnPropertyDescriptor(t,e)[r]))}catch(i){}}});var Da=a((fS,Na)=>{"use strict";var ph=j();Na.exports=function(t){return ph(t)||t===null}});var Ma=a((pS,$a)=>{"use strict";var hh=Da(),vh=String,gh=TypeError;$a.exports=function(t){if(hh(t))return t;throw new gh("Can't set "+vh(t)+" as a prototype")}});var Zr=a((hS,Va)=>{"use strict";var mh=ka(),bh=j(),yh=ve(),Ih=Ma();Va.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t=!1,e={},r;try{r=mh(Object.prototype,"__proto__","set"),r(e,[]),t=e instanceof Array}catch(i){}return function(o,n){return yh(o),Ih(n),bh(o)&&(t?r(o,n):o.__proto__=n),o}}():void 0)});var Et=a((vS,Ua)=>{"use strict";var Sh=D(),_h=Sh("toStringTag"),Fa={};Fa[_h]="z";Ua.exports=String(Fa)==="[object z]"});var Ke=a((gS,Ba)=>{"use strict";var Ph=Et(),Eh=A(),Tt=$e(),Th=D(),wh=Th("toStringTag"),Oh=Object,Ah=Tt(function(){return arguments}())==="Arguments",xh=function(t,e){try{return t[e]}catch(r){}};Ba.exports=Ph?Tt:function(t){var e,r,i;return t===void 0?"Undefined":t===null?"Null":typeof(r=xh(e=Oh(t),wh))=="string"?r:Ah?Tt(e):(i=Tt(e))==="Object"&&Eh(e.callee)?"Arguments":i}});var Wa=a((mS,ja)=>{"use strict";var qh=Et(),Rh=Ke();ja.exports=qh?{}.toString:function(){return"[object "+Rh(this)+"]"}});var Ge=a((bS,Ka)=>{"use strict";var Ch=Et(),Lh=se().f,kh=be(),Nh=Y(),Dh=Wa(),$h=D(),Ha=$h("toStringTag");Ka.exports=function(t,e,r,i){var o=r?t:t&&t.prototype;o&&(Nh(o,Ha)||Lh(o,Ha,{configurable:!0,value:e}),i&&!Ch&&kh(o,"toString",Dh))}});var za=a((yS,Ga)=>{"use strict";var Mh=se();Ga.exports=function(t,e,r){return Mh.f(t,e,r)}});var Ja=a((IS,Ya)=>{"use strict";var Vh=J(),Fh=za(),Uh=D(),Bh=N(),Qa=Uh("species");Ya.exports=function(t){var e=Vh(t);Bh&&e&&!e[Qa]&&Fh(e,Qa,{configurable:!0,get:function(){return this}})}});var Za=a((SS,Xa)=>{"use strict";var jh=dt(),Wh=TypeError;Xa.exports=function(t,e){if(jh(e,t))return t;throw new Wh("Incorrect invocation")}});var ti=a((_S,es)=>{"use strict";var Hh=L(),Kh=A(),ei=Ue(),Gh=Hh(Function.toString);Kh(ei.inspectSource)||(ei.inspectSource=function(t){return Gh(t)});es.exports=ei.inspectSource});var as=a((PS,ns)=>{"use strict";var zh=L(),Qh=C(),ts=A(),Yh=Ke(),Jh=J(),Xh=ti(),rs=function(){},is=Jh("Reflect","construct"),ri=/^\s*(?:class|function)\b/,Zh=zh(ri.exec),ev=!ri.test(rs),ze=function(e){if(!ts(e))return!1;try{return is(rs,[],e),!0}catch(r){return!1}},os=function(e){if(!ts(e))return!1;switch(Yh(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ev||!!Zh(ri,Xh(e))}catch(r){return!0}};os.sham=!0;ns.exports=!is||Qh(function(){var t;return ze(ze.call)||!ze(Object)||!ze(function(){t=!0})||t})?os:ze});var us=a((ES,ss)=>{"use strict";var tv=as(),rv=Fe(),iv=TypeError;ss.exports=function(t){if(tv(t))return t;throw new iv(rv(t)+" is not a constructor")}});var ii=a((TS,ls)=>{"use strict";var cs=Z(),ov=us(),nv=Ve(),av=D(),sv=av("species");ls.exports=function(t,e){var r=cs(t).constructor,i;return r===void 0||nv(i=cs(r)[sv])?e:ov(i)}});var oi=a((wS,ds)=>{"use strict";var uv=J();ds.exports=uv("document","documentElement")});var ps=a((OS,fs)=>{"use strict";var cv=L();fs.exports=cv([].slice)});var vs=a((AS,hs)=>{"use strict";var lv=TypeError;hs.exports=function(t,e){if(t<e)throw new lv("Not enough arguments");return t}});var ni=a((xS,gs)=>{"use strict";var dv=ae();gs.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(dv)});var hi=a((qS,Ts)=>{"use strict";var M=O(),fv=gr(),pv=je(),ms=A(),hv=Y(),Es=C(),bs=oi(),vv=ps(),ys=ht(),gv=vs(),mv=ni(),bv=Pt(),di=M.setImmediate,fi=M.clearImmediate,yv=M.process,ai=M.Dispatch,Iv=M.Function,Is=M.MessageChannel,Sv=M.String,si=0,Qe={},Ss="onreadystatechange",Ye,ue,ui,ci;Es(function(){Ye=M.location});var pi=function(t){if(hv(Qe,t)){var e=Qe[t];delete Qe[t],e()}},li=function(t){return function(){pi(t)}},_s=function(t){pi(t.data)},Ps=function(t){M.postMessage(Sv(t),Ye.protocol+"//"+Ye.host)};(!di||!fi)&&(di=function(e){gv(arguments.length,1);var r=ms(e)?e:Iv(e),i=vv(arguments,1);return Qe[++si]=function(){fv(r,void 0,i)},ue(si),si},fi=function(e){delete Qe[e]},bv?ue=function(t){yv.nextTick(li(t))}:ai&&ai.now?ue=function(t){ai.now(li(t))}:Is&&!mv?(ui=new Is,ci=ui.port2,ui.port1.onmessage=_s,ue=pv(ci.postMessage,ci)):M.addEventListener&&ms(M.postMessage)&&!M.importScripts&&Ye&&Ye.protocol!=="file:"&&!Es(Ps)?(ue=Ps,M.addEventListener("message",_s,!1)):Ss in ys("script")?ue=function(t){bs.appendChild(ys("script"))[Ss]=function(){bs.removeChild(this),pi(t)}}:ue=function(t){setTimeout(li(t),0)});Ts.exports={set:di,clear:fi}});var As=a((RS,Os)=>{"use strict";var ws=O(),_v=N(),Pv=Object.getOwnPropertyDescriptor;Os.exports=function(t){if(!_v)return ws[t];var e=Pv(ws,t);return e&&e.value}});var vi=a((CS,qs)=>{"use strict";var xs=function(){this.head=null,this.tail=null};xs.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}}};qs.exports=xs});var Cs=a((LS,Rs)=>{"use strict";var Ev=ae();Rs.exports=/ipad|iphone|ipod/i.test(Ev)&&typeof Pebble!="undefined"});var ks=a((kS,Ls)=>{"use strict";var Tv=ae();Ls.exports=/web0s(?!.*chrome)/i.test(Tv)});var Us=a((NS,Fs)=>{"use strict";var Te=O(),wv=As(),Ns=je(),gi=hi().set,Ov=vi(),Av=ni(),xv=Cs(),qv=ks(),mi=Pt(),Ds=Te.MutationObserver||Te.WebKitMutationObserver,$s=Te.document,Ms=Te.process,wt=Te.Promise,Ii=wv("queueMicrotask"),Ee,bi,yi,Ot,Vs;Ii||(Je=new Ov,Xe=function(){var t,e;for(mi&&(t=Ms.domain)&&t.exit();e=Je.get();)try{e()}catch(r){throw Je.head&&Ee(),r}t&&t.enter()},!Av&&!mi&&!qv&&Ds&&$s?(bi=!0,yi=$s.createTextNode(""),new Ds(Xe).observe(yi,{characterData:!0}),Ee=function(){yi.data=bi=!bi}):!xv&&wt&&wt.resolve?(Ot=wt.resolve(void 0),Ot.constructor=wt,Vs=Ns(Ot.then,Ot),Ee=function(){Vs(Xe)}):mi?Ee=function(){Ms.nextTick(Xe)}:(gi=Ns(gi,Te),Ee=function(){gi(Xe)}),Ii=function(t){Je.head||Ee(),Je.add(t)});var Je,Xe;Fs.exports=Ii});var js=a((DS,Bs)=>{"use strict";Bs.exports=function(t,e){try{arguments.length===1?console.error(t):console.error(t,e)}catch(r){}}});var At=a(($S,Ws)=>{"use strict";Ws.exports=function(t){try{return{error:!1,value:t()}}catch(e){return{error:!0,value:e}}}});var Gs=a((MS,Ks)=>{"use strict";var Rv=O(),Cv=A(),Hs=Rv.WeakMap;Ks.exports=Cv(Hs)&&/native code/.test(String(Hs))});var xt=a((VS,Qs)=>{"use strict";var Lv=Cr(),kv=kr(),zs=Lv("keys");Qs.exports=function(t){return zs[t]||(zs[t]=kv(t))}});var qt=a((FS,Ys)=>{"use strict";Ys.exports={}});var Ei=a((US,Zs)=>{"use strict";var Nv=Gs(),Xs=O(),Dv=j(),$v=be(),Si=Y(),_i=Ue(),Mv=xt(),Vv=qt(),Js="Object already initialized",Pi=Xs.TypeError,Fv=Xs.WeakMap,Rt,Ze,Ct,Uv=function(t){return Ct(t)?Ze(t):Rt(t,{})},Bv=function(t){return function(e){var r;if(!Dv(e)||(r=Ze(e)).type!==t)throw new Pi("Incompatible receiver, "+t+" required");return r}};Nv||_i.state?(H=_i.state||(_i.state=new Fv),H.get=H.get,H.has=H.has,H.set=H.set,Rt=function(t,e){if(H.has(t))throw new Pi(Js);return e.facade=t,H.set(t,e),e},Ze=function(t){return H.get(t)||{}},Ct=function(t){return H.has(t)}):(ce=Mv("state"),Vv[ce]=!0,Rt=function(t,e){if(Si(t,ce))throw new Pi(Js);return e.facade=t,$v(t,ce,e),e},Ze=function(t){return Si(t,ce)?t[ce]:{}},Ct=function(t){return Si(t,ce)});var H,ce;Zs.exports={set:Rt,get:Ze,has:Ct,enforce:Uv,getterFor:Bv}});var le=a((BS,eu)=>{"use strict";var jv=O();eu.exports=jv.Promise});var we=a((jS,ou)=>{"use strict";var Wv=O(),et=le(),Hv=A(),Kv=Vr(),Gv=ti(),zv=D(),tu=Xr(),Qv=Q(),Ti=Tr(),ru=et&&et.prototype,Yv=zv("species"),wi=!1,iu=Hv(Wv.PromiseRejectionEvent),Jv=Kv("Promise",function(){var t=Gv(et),e=t!==String(et);if(!e&&Ti===66||Qv&&!(ru.catch&&ru.finally))return!0;if(!Ti||Ti<51||!/native code/.test(t)){var r=new et(function(n){n(1)}),i=function(n){n(function(){},function(){})},o=r.constructor={};if(o[Yv]=i,wi=r.then(function(){})instanceof i,!wi)return!0}return!e&&(tu==="BROWSER"||tu==="DENO")&&!iu});ou.exports={CONSTRUCTOR:Jv,REJECTION_EVENT:iu,SUBCLASSING:wi}});var Oe=a((WS,au)=>{"use strict";var nu=X(),Xv=TypeError,Zv=function(t){var e,r;this.promise=new t(function(i,o){if(e!==void 0||r!==void 0)throw new Xv("Bad Promise constructor");e=i,r=o}),this.resolve=nu(e),this.reject=nu(r)};au.exports.f=function(t){return new Zv(t)}});var wu=a(()=>{"use strict";var eg=$(),tg=Q(),Dt=Pt(),ie=O(),rg=ge(),Re=B(),su=Pe(),uu=Zr(),ig=Ge(),og=Ja(),ng=X(),Nt=A(),ag=j(),sg=Za(),ug=ii(),pu=hi().set,Ri=Us(),cg=js(),lg=At(),dg=vi(),hu=Ei(),$t=le(),Ci=we(),vu=Oe(),Mt="Promise",gu=Ci.CONSTRUCTOR,fg=Ci.REJECTION_EVENT,pg=Ci.SUBCLASSING,Oi=hu.getterFor(Mt),hg=hu.set,Ae=$t&&$t.prototype,de=$t,Lt=Ae,mu=ie.TypeError,Ai=ie.document,Li=ie.process,xi=vu.f,vg=xi,gg=!!(Ai&&Ai.createEvent&&ie.dispatchEvent),bu="unhandledrejection",mg="rejectionhandled",cu=0,yu=1,bg=2,ki=1,Iu=2,kt,lu,Su,du,_u=function(t){var e;return ag(t)&&Nt(e=t.then)?e:!1},Pu=function(t,e){var r=e.value,i=e.state===yu,o=i?t.ok:t.fail,n=t.resolve,s=t.reject,u=t.domain,d,l,p;try{o?(i||(e.rejection===Iu&&Ig(e),e.rejection=ki),o===!0?d=r:(u&&u.enter(),d=o(r),u&&(u.exit(),p=!0)),d===t.promise?s(new mu("Promise-chain cycle")):(l=_u(d))?Re(l,d,n,s):n(d)):s(r)}catch(h){u&&!p&&u.exit(),s(h)}},Eu=function(t,e){t.notified||(t.notified=!0,Ri(function(){for(var r=t.reactions,i;i=r.get();)Pu(i,t);t.notified=!1,e&&!t.rejection&&yg(t)}))},Tu=function(t,e,r){var i,o;gg?(i=Ai.createEvent("Event"),i.promise=e,i.reason=r,i.initEvent(t,!1,!0),ie.dispatchEvent(i)):i={promise:e,reason:r},!fg&&(o=ie["on"+t])?o(i):t===bu&&cg("Unhandled promise rejection",r)},yg=function(t){Re(pu,ie,function(){var e=t.facade,r=t.value,i=fu(t),o;if(i&&(o=lg(function(){Dt?Li.emit("unhandledRejection",r,e):Tu(bu,e,r)}),t.rejection=Dt||fu(t)?Iu:ki,o.error))throw o.value})},fu=function(t){return t.rejection!==ki&&!t.parent},Ig=function(t){Re(pu,ie,function(){var e=t.facade;Dt?Li.emit("rejectionHandled",e):Tu(mg,e,t.value)})},xe=function(t,e,r){return function(i){t(e,i,r)}},qe=function(t,e,r){t.done||(t.done=!0,r&&(t=r),t.value=e,t.state=bg,Eu(t,!0))},qi=function(t,e,r){if(!t.done){t.done=!0,r&&(t=r);try{if(t.facade===e)throw new mu("Promise can't be resolved itself");var i=_u(e);i?Ri(function(){var o={done:!1};try{Re(i,e,xe(qi,o,t),xe(qe,o,t))}catch(n){qe(o,n,t)}}):(t.value=e,t.state=yu,Eu(t,!1))}catch(o){qe({done:!1},o,t)}}};if(gu&&(de=function(e){sg(this,Lt),ng(e),Re(kt,this);var r=Oi(this);try{e(xe(qi,r),xe(qe,r))}catch(i){qe(r,i)}},Lt=de.prototype,kt=function(e){hg(this,{type:Mt,done:!1,notified:!1,parent:!1,reactions:new dg,rejection:!1,state:cu,value:null})},kt.prototype=su(Lt,"then",function(e,r){var i=Oi(this),o=xi(ug(this,de));return i.parent=!0,o.ok=Nt(e)?e:!0,o.fail=Nt(r)&&r,o.domain=Dt?Li.domain:void 0,i.state===cu?i.reactions.add(o):Ri(function(){Pu(o,i)}),o.promise}),lu=function(){var t=new kt,e=Oi(t);this.promise=t,this.resolve=xe(qi,e),this.reject=xe(qe,e)},vu.f=xi=function(t){return t===de||t===Su?new lu(t):vg(t)},!tg&&Nt($t)&&Ae!==Object.prototype)){du=Ae.then,pg||su(Ae,"then",function(e,r){var i=this;return new de(function(o,n){Re(du,i,o,n)}).then(e,r)},{unsafe:!0});try{delete Ae.constructor}catch(t){}uu&&uu(Ae,Lt)}eg({global:!0,constructor:!0,wrap:!0,forced:gu},{Promise:de});Su=rg.Promise;ig(de,Mt,!1,!0);og(Mt)});var fe=a((GS,Ou)=>{"use strict";Ou.exports={}});var xu=a((zS,Au)=>{"use strict";var Sg=D(),_g=fe(),Pg=Sg("iterator"),Eg=Array.prototype;Au.exports=function(t){return t!==void 0&&(_g.Array===t||Eg[Pg]===t)}});var Ni=a((QS,Ru)=>{"use strict";var Tg=Ke(),qu=pt(),wg=Ve(),Og=fe(),Ag=D(),xg=Ag("iterator");Ru.exports=function(t){if(!wg(t))return qu(t,xg)||qu(t,"@@iterator")||Og[Tg(t)]}});var Lu=a((YS,Cu)=>{"use strict";var qg=B(),Rg=X(),Cg=Z(),Lg=Fe(),kg=Ni(),Ng=TypeError;Cu.exports=function(t,e){var r=arguments.length<2?kg(t):e;if(Rg(r))return Cg(qg(r,t));throw new Ng(Lg(t)+" is not iterable")}});var Du=a((JS,Nu)=>{"use strict";var Dg=B(),ku=Z(),$g=pt();Nu.exports=function(t,e,r){var i,o;ku(t);try{if(i=$g(t,"return"),!i){if(e==="throw")throw r;return r}i=Dg(i,t)}catch(n){o=!0,i=n}if(e==="throw")throw r;if(o)throw i;return ku(i),r}});var Ft=a((XS,Fu)=>{"use strict";var Mg=je(),Vg=B(),Fg=Z(),Ug=Fe(),Bg=xu(),jg=Kr(),$u=dt(),Wg=Lu(),Hg=Ni(),Mu=Du(),Kg=TypeError,Vt=function(t,e){this.stopped=t,this.result=e},Vu=Vt.prototype;Fu.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),d=Mg(e,i),l,p,h,c,f,g,m,S=function(_){return l&&Mu(l,"normal"),new Vt(!0,_)},I=function(_){return o?(Fg(_),u?d(_[0],_[1],S):d(_[0],_[1])):u?d(_,S):d(_)};if(n)l=t.iterator;else if(s)l=t;else{if(p=Hg(t),!p)throw new Kg(Ug(t)+" is not iterable");if(Bg(p)){for(h=0,c=jg(t);c>h;h++)if(f=I(t[h]),f&&$u(Vu,f))return f;return new Vt(!1)}l=Wg(t,p)}for(g=n?t.next:l.next;!(m=Vg(g,l)).done;){try{f=I(m.value)}catch(_){Mu(l,"throw",_)}if(typeof f=="object"&&f&&$u(Vu,f))return f}return new Vt(!1)}});var Hu=a((ZS,Wu)=>{"use strict";var Gg=D(),Bu=Gg("iterator"),ju=!1;try{Uu=0,Di={next:function(){return{done:!!Uu++}},return:function(){ju=!0}},Di[Bu]=function(){return this},Array.from(Di,function(){throw 2})}catch(t){}var Uu,Di;Wu.exports=function(t,e){try{if(!e&&!ju)return!1}catch(o){return!1}var r=!1;try{var i={};i[Bu]=function(){return{next:function(){return{done:r=!0}}}},t(i)}catch(o){}return r}});var $i=a((e_,Ku)=>{"use strict";var zg=le(),Qg=Hu(),Yg=we().CONSTRUCTOR;Ku.exports=Yg||!Qg(function(t){zg.all(t).then(void 0,function(){})})});var Gu=a(()=>{"use strict";var Jg=$(),Xg=B(),Zg=X(),em=Oe(),tm=At(),rm=Ft(),im=$i();Jg({target:"Promise",stat:!0,forced:im},{all:function(e){var r=this,i=em.f(r),o=i.resolve,n=i.reject,s=tm(function(){var u=Zg(r.resolve),d=[],l=0,p=1;rm(e,function(h){var c=l++,f=!1;p++,Xg(u,r,h).then(function(g){f||(f=!0,d[c]=g,--p||o(d))},n)}),--p||o(d)});return s.error&&n(s.value),i.promise}})});var Qu=a(()=>{"use strict";var om=$(),nm=Q(),am=we().CONSTRUCTOR,Vi=le(),sm=J(),um=A(),cm=Pe(),zu=Vi&&Vi.prototype;om({target:"Promise",proto:!0,forced:am,real:!0},{catch:function(t){return this.then(void 0,t)}});!nm&&um(Vi)&&(Mi=sm("Promise").prototype.catch,zu.catch!==Mi&&cm(zu,"catch",Mi,{unsafe:!0}));var Mi});var Yu=a(()=>{"use strict";var lm=$(),dm=B(),fm=X(),pm=Oe(),hm=At(),vm=Ft(),gm=$i();lm({target:"Promise",stat:!0,forced:gm},{race:function(e){var r=this,i=pm.f(r),o=i.reject,n=hm(function(){var s=fm(r.resolve);vm(e,function(u){dm(s,r,u).then(i.resolve,o)})});return n.error&&o(n.value),i.promise}})});var Ju=a(()=>{"use strict";var mm=$(),bm=Oe(),ym=we().CONSTRUCTOR;mm({target:"Promise",stat:!0,forced:ym},{reject:function(e){var r=bm.f(this),i=r.reject;return i(e),r.promise}})});var Fi=a((c_,Xu)=>{"use strict";var Im=Z(),Sm=j(),_m=Oe();Xu.exports=function(t,e){if(Im(t),Sm(e)&&e.constructor===t)return e;var r=_m.f(t),i=r.resolve;return i(e),r.promise}});var tc=a(()=>{"use strict";var Pm=$(),Em=J(),Zu=Q(),Tm=le(),ec=we().CONSTRUCTOR,wm=Fi(),Om=Em("Promise"),Am=Zu&&!ec;Pm({target:"Promise",stat:!0,forced:Zu||ec},{resolve:function(e){return wm(Am&&this===Om?Tm:this,e)}})});var rc=a(()=>{"use strict";wu();Gu();Qu();Yu();Ju();tc()});var ac=a(()=>{"use strict";var xm=$(),qm=Q(),Ut=le(),Rm=C(),oc=J(),nc=A(),Cm=ii(),ic=Fi(),Lm=Pe(),Bi=Ut&&Ut.prototype,km=!!Ut&&Rm(function(){Bi.finally.call({then:function(){}},function(){})});xm({target:"Promise",proto:!0,real:!0,forced:km},{finally:function(t){var e=Cm(this,oc("Promise")),r=nc(t);return this.then(r?function(i){return ic(e,t()).then(function(){return i})}:t,r?function(i){return ic(e,t()).then(function(){throw i})}:t)}});!qm&&nc(Ut)&&(Ui=oc("Promise").prototype.finally,Bi.finally!==Ui&&Lm(Bi,"finally",Ui,{unsafe:!0}));var Ui});var uc=a((g_,sc)=>{"use strict";xa();rc();ac();var Nm=mt();sc.exports=Nm("Promise","finally")});var lc=a((m_,cc)=>{"use strict";var Dm=uc();cc.exports=Dm});var ji=a((b_,dc)=>{"use strict";var $m=lc();dc.exports=$m});var pc=a((y_,fc)=>{"use strict";var Mm=C();fc.exports=!Mm(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})});var Bt=a((I_,vc)=>{"use strict";var Vm=Y(),Fm=A(),Um=Lr(),Bm=xt(),jm=pc(),hc=Bm("IE_PROTO"),Wi=Object,Wm=Wi.prototype;vc.exports=jm?Wi.getPrototypeOf:function(t){var e=Um(t);if(Vm(e,hc))return e[hc];var r=e.constructor;return Fm(r)&&e instanceof r?r.prototype:e instanceof Wi?Wm:null}});var bc=a((S_,mc)=>{"use strict";var Hm=L(),Hi=Y(),Km=ne(),Gm=Gr().indexOf,zm=qt(),gc=Hm([].push);mc.exports=function(t,e){var r=Km(t),i=0,o=[],n;for(n in r)!Hi(zm,n)&&Hi(r,n)&&gc(o,n);for(;e.length>i;)Hi(r,n=e[i++])&&(~Gm(o,n)||gc(o,n));return o}});var Ki=a((__,yc)=>{"use strict";yc.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Gi=a((P_,Ic)=>{"use strict";var Qm=bc(),Ym=Ki();Ic.exports=Object.keys||function(e){return Qm(e,Ym)}});var wc=a((E_,Tc)=>{"use strict";var _c=N(),Jm=C(),Pc=L(),Xm=Bt(),Zm=Gi(),eb=ne(),tb=Ir().f,Ec=Pc(tb),rb=Pc([].push),ib=_c&&Jm(function(){var t=Object.create(null);return t[2]=2,!Ec(t,2)}),Sc=function(t){return function(e){for(var r=eb(e),i=Zm(r),o=ib&&Xm(r)===null,n=i.length,s=0,u=[],d;n>s;)d=i[s++],(!_c||(o?d in r:Ec(r,d)))&&rb(u,t?[d,r[d]]:r[d]);return u}};Tc.exports={entries:Sc(!0),values:Sc(!1)}});var Oc=a(()=>{"use strict";var ob=$(),nb=wc().entries;ob({target:"Object",stat:!0},{entries:function(e){return nb(e)}})});var xc=a((O_,Ac)=>{"use strict";Oc();var ab=ge();Ac.exports=ab.Object.entries});var Rc=a((A_,qc)=>{"use strict";var sb=xc();qc.exports=sb});var Ce=a((x_,Cc)=>{"use strict";var ub=Rc();Cc.exports=ub});var Nc=a((q_,kc)=>{"use strict";var zi=N(),cb=Y(),Lc=Function.prototype,lb=zi&&Object.getOwnPropertyDescriptor,Qi=cb(Lc,"name"),db=Qi&&function(){}.name==="something",fb=Qi&&(!zi||zi&&lb(Lc,"name").configurable);kc.exports={EXISTS:Qi,PROPER:db,CONFIGURABLE:fb}});var $c=a(Dc=>{"use strict";var pb=N(),hb=Fr(),vb=se(),gb=Z(),mb=ne(),bb=Gi();Dc.f=pb&&!hb?Object.defineProperties:function(e,r){gb(e);for(var i=mb(r),o=bb(r),n=o.length,s=0,u;n>s;)vb.f(e,u=o[s++],i[u]);return e}});var Zi=a((C_,Wc)=>{"use strict";var yb=Z(),Ib=$c(),Mc=Ki(),Sb=qt(),_b=oi(),Pb=ht(),Eb=xt(),Vc=">",Fc="<",Ji="prototype",Xi="script",Bc=Eb("IE_PROTO"),Yi=function(){},jc=function(t){return Fc+Xi+Vc+t+Fc+"/"+Xi+Vc},Uc=function(t){t.write(jc("")),t.close();var e=t.parentWindow.Object;return t=null,e},Tb=function(){var t=Pb("iframe"),e="java"+Xi+":",r;return t.style.display="none",_b.appendChild(t),t.src=String(e),r=t.contentWindow.document,r.open(),r.write(jc("document.F=Object")),r.close(),r.F},jt,Wt=function(){try{jt=new ActiveXObject("htmlfile")}catch(e){}Wt=typeof document!="undefined"?document.domain&&jt?Uc(jt):Tb():Uc(jt);for(var t=Mc.length;t--;)delete Wt[Ji][Mc[t]];return Wt()};Sb[Bc]=!0;Wc.exports=Object.create||function(e,r){var i;return e!==null?(Yi[Ji]=yb(e),i=new Yi,Yi[Ji]=null,i[Bc]=e):i=Wt(),r===void 0?i:Ib.f(i,r)}});var io=a((L_,Gc)=>{"use strict";var wb=C(),Ob=A(),Ab=j(),xb=Zi(),Hc=Bt(),qb=Pe(),Rb=D(),Cb=Q(),ro=Rb("iterator"),Kc=!1,ee,eo,to;[].keys&&(to=[].keys(),"next"in to?(eo=Hc(Hc(to)),eo!==Object.prototype&&(ee=eo)):Kc=!0);var Lb=!Ab(ee)||wb(function(){var t={};return ee[ro].call(t)!==t});Lb?ee={}:Cb&&(ee=xb(ee));Ob(ee[ro])||qb(ee,ro,function(){return this});Gc.exports={IteratorPrototype:ee,BUGGY_SAFARI_ITERATORS:Kc}});var Qc=a((k_,zc)=>{"use strict";var kb=io().IteratorPrototype,Nb=Zi(),Db=Me(),$b=Ge(),Mb=fe(),Vb=function(){return this};zc.exports=function(t,e,r,i){var o=e+" Iterator";return t.prototype=Nb(kb,{next:Db(+!i,r)}),$b(t,o,!1,!0),Mb[o]=Vb,t}});var al=a((N_,nl)=>{"use strict";var Fb=$(),Ub=B(),Ht=Q(),il=Nc(),Bb=A(),jb=Qc(),Yc=Bt(),Jc=Zr(),Wb=Ge(),Hb=be(),oo=Pe(),Kb=D(),Xc=fe(),ol=io(),Gb=il.PROPER,zb=il.CONFIGURABLE,Zc=ol.IteratorPrototype,Kt=ol.BUGGY_SAFARI_ITERATORS,tt=Kb("iterator"),el="keys",rt="values",tl="entries",rl=function(){return this};nl.exports=function(t,e,r,i,o,n,s){jb(r,e,i);var u=function(I){if(I===o&&c)return c;if(!Kt&&I&&I in p)return p[I];switch(I){case el:return function(){return new r(this,I)};case rt:return function(){return new r(this,I)};case tl:return function(){return new r(this,I)}}return function(){return new r(this)}},d=e+" Iterator",l=!1,p=t.prototype,h=p[tt]||p["@@iterator"]||o&&p[o],c=!Kt&&h||u(o),f=e==="Array"&&p.entries||h,g,m,S;if(f&&(g=Yc(f.call(new t)),g!==Object.prototype&&g.next&&(!Ht&&Yc(g)!==Zc&&(Jc?Jc(g,Zc):Bb(g[tt])||oo(g,tt,rl)),Wb(g,d,!0,!0),Ht&&(Xc[d]=rl))),Gb&&o===rt&&h&&h.name!==rt&&(!Ht&&zb?Hb(p,"name",rt):(l=!0,c=function(){return Ub(h,this)})),o)if(m={values:u(rt),keys:n?c:u(el),entries:u(tl)},s)for(S in m)(Kt||l||!(S in p))&&oo(p,S,m[S]);else Fb({target:e,proto:!0,forced:Kt||l},m);return(!Ht||s)&&p[tt]!==c&&oo(p,tt,c,{name:o}),Xc[e]=c,m}});var ul=a((D_,sl)=>{"use strict";sl.exports=function(t,e){return{value:t,done:e}}});var ao=a(($_,pl)=>{"use strict";var Qb=ne(),no=zr(),cl=fe(),dl=Ei(),Yb=se().f,Jb=al(),Gt=ul(),Xb=Q(),Zb=N(),fl="Array Iterator",ey=dl.set,ty=dl.getterFor(fl);pl.exports=Jb(Array,"Array",function(t,e){ey(this,{type:fl,target:Qb(t),index:0,kind:e})},function(){var t=ty(this),e=t.target,r=t.index++;if(!e||r>=e.length)return t.target=null,Gt(void 0,!0);switch(t.kind){case"keys":return Gt(r,!1);case"values":return Gt(e[r],!1)}return Gt([r,e[r]],!1)},"values");var ll=cl.Arguments=cl.Array;no("keys");no("values");no("entries");if(!Xb&&Zb&&ll.name!=="values")try{Yb(ll,"name",{value:"values"})}catch(t){}});var vl=a((M_,hl)=>{"use strict";var ry=N(),iy=se(),oy=Me();hl.exports=function(t,e,r){ry?iy.f(t,e,oy(0,r)):t[e]=r}});var gl=a(()=>{"use strict";var ny=$(),ay=Ft(),sy=vl();ny({target:"Object",stat:!0},{fromEntries:function(e){var r={};return ay(e,function(i,o){sy(r,i,o)},{AS_ENTRIES:!0}),r}})});var bl=a((U_,ml)=>{"use strict";ao();gl();var uy=ge();ml.exports=uy.Object.fromEntries});var Il=a((B_,yl)=>{"use strict";yl.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 _l=a(()=>{"use strict";ao();var cy=Il(),ly=O(),dy=Ge(),Sl=fe();for(zt in cy)dy(ly[zt],zt),Sl[zt]=Sl.Array;var zt});var El=a((H_,Pl)=>{"use strict";var fy=bl();_l();Pl.exports=fy});var wl=a((K_,Tl)=>{"use strict";var py=El();Tl.exports=py});var fo=a((DP,Fl)=>{"use strict";var my=Ke(),by=String;Fl.exports=function(t){if(my(t)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return by(t)}});var Bl=a(($P,Ul)=>{"use strict";var yy=gt(),Iy=fo(),Sy=ve(),_y=RangeError;Ul.exports=function(e){var r=Iy(Sy(this)),i="",o=yy(e);if(o<0||o===1/0)throw new _y("Wrong number of repetitions");for(;o>0;(o>>>=1)&&(r+=r))o&1&&(i+=r);return i}});var Gl=a((MP,Kl)=>{"use strict";var Hl=L(),Py=Hr(),jl=fo(),Ey=Bl(),Ty=ve(),wy=Hl(Ey),Oy=Hl("".slice),Ay=Math.ceil,Wl=function(t){return function(e,r,i){var o=jl(Ty(e)),n=Py(r),s=o.length,u=i===void 0?" ":jl(i),d,l;return n<=s||u===""?o:(d=n-s,l=wy(u,Ay(d/u.length)),l.length>d&&(l=Oy(l,0,d)),t?o+l:l+o)}};Kl.exports={start:Wl(!1),end:Wl(!0)}});var Ql=a((VP,zl)=>{"use strict";var xy=ae();zl.exports=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(xy)});var Yl=a(()=>{"use strict";var qy=$(),Ry=Gl().start,Cy=Ql();qy({target:"String",proto:!0,forced:Cy},{padStart:function(e){return Ry(this,e,arguments.length>1?arguments[1]:void 0)}})});var Xl=a((BP,Jl)=>{"use strict";Yl();var Ly=mt();Jl.exports=Ly("String","padStart")});var ed=a((jP,Zl)=>{"use strict";var ky=Xl();Zl.exports=ky});var po=a((WP,td)=>{"use strict";var Ny=ed();td.exports=Ny});var By={};Oo(By,{ApiEnv:()=>_e,ConnectionType:()=>It,ContentType:()=>yt,InteractiveInterfaceClick:()=>Qr,MediascopePixel:()=>pr,MediascopePixelTypes:()=>wo,OneStat:()=>rr,Quality:()=>bt,SeekAction:()=>St,ThinOneStat:()=>dr,VERSION:()=>k});module.exports=$d(By);var mo=R(Se(),1);var _e=(s=>(s.PROD="prod",s.VK_ALIAS="vk_alias",s.VIDEOTEST="videotest",s.TEST="test",s.OKCDN="okcdn",s.AUTO="auto",s))(_e||{}),bt=(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))(bt||{}),yt=(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))(yt||{});var It=(i=>(i.HTTP1="http1",i.HTTP2="http2",i.HTTP3="http3",i))(It||{});var St=(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))(St||{}),Qr=(n=>(n.GRAPH_SHOW="iGraphShow",n.GRAPH_HIDE="iGraphHide",n.NEXT_AREA="iNextChapterArea",n.NEXT_BUTTON="iNextChapterBtn",n.WATCH_AGAIN="iWatchAgainBtn",n))(Qr||{}),_a={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"},Pa={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"},Ea={unknown:"un",mobile:"m",lowest:"ls",low:"l",medium:"md",high:"h",fullhd:"f",quadhd:"q",ultrahd:"u"},Ta={pip:"pi",fullscreen:"fs",external:"ex",prefetch:"pr",airplay:"ap",chromecast:"cc",invisible:"iv"};var Oa=require("@vkontakte/videoplayer-shared/es2018");var wa="CIOPGQJGDIHBABABA",Yr={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 ah={apiEnv:"vk_alias",apiKey:wa,requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageInterval:15e3,disabledOperations:["quality"],disabledCustomFields:[],shorten:!0,maxLoops:100,embedUrlParams:[],useBeacon:!0,synchronizeTime:!0,debugLog:!1,clearStorageAtUnload:!0,useVKComIsMobileLogic:!1,backoff:{start:1e3,factor:1.5,max:5*60*1e3,random:.1},useKeepalive:!1},Aa=t=>(0,Oa.fillWithDefault)(t,ah);function Jr(){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/es2018"),ir=require("@vkontakte/videoplayer-shared/es2018");var Qt=R(ji(),1);var Ol=R(Ce(),1),Al=R(wl(),1);var xl=t=>{var o;let{operation:e,custom:r}=t,i=(0,Al.default)((0,Ol.default)(r).map(([n,s])=>{var l,p,h;let u=(l=Pa[n])!=null?l:n,d=s;return s&&(n==="mode"?d=(p=Ta[s])!=null?p:s:n==="quality"&&(d=(h=Ea[s])!=null?h:s)),[u,d]}));return{...t,operation:(o=_a[e])!=null?o:e,custom:i}};var k="1.0.83";var K=require("@vkontakte/videoplayer-shared/es2018");var hy=/Mobile|mini|Fennec|Android|iP(ad|od|hone)|opera (mini|mobi)/i,it=class{constructor(e){this.consequentAuthErrors=0;this.authorized$=new K.ValueSubject(!1);this.params=e}async authorize(e){return this.authToken=e!=null?e:await 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(()=>{})}async logRequest(e){var s;let r="log.externalLog",i=this.createLogParams(e),o=(s=this.sessionKey)!=null?s:await this._authorizeWithBackoff();if(!o)return;let n=async(u,d=this.params.config.requestRetryCount)=>{try{return await this.params.apiTransport.sendRequest(r,i,o)}catch(l){if(!l||!("error_code"in l)){this.params.error$.next({id:"logRequestUnknown",category:K.ErrorCategory.NETWORK,message:`Unknown ${r} error`,thrown:l});return}let p=l==null?void 0:l.error_code;switch(p){case 102:case 103:case 104:return this.authorized$.next(!1),this.sessionKey=await this._authorizeWithBackoff(),d>0?n(u,d-1):void 0;case 401:return this.authorized$.next(!1),this.authToken=await this.refreshAuthToken(),this.sessionKey=await this._authorizeWithBackoff(),d>0?n(u,d-1):void 0;default:{this.params.error$.next({id:`LogRequest#${p}`,category:K.ErrorCategory.EXTERNAL_API,message:`${r} error`,data:l});return}}}};return n(e)}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}async refreshAuthToken(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=(0,Qt.default)(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise}createLogParams(e){let r="WEB",i=!1,o=`@vkontakte/videoplayer-statistics:${k}`;if(this.params.config.useVKComIsMobileLogic){let{appVersion:n}=window.navigator;i=hy.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(xl):e})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();let e=(0,K.getExponentialDelay)(this.consequentAuthErrors,this.params.config.backoff);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{(0,Qt.default)(this._authorize().then(r).catch(i=>this.params.error$.next({id:"AuthorizeBackoff",category:K.ErrorCategory.NETWORK,message:"Otherwise unhandled error in authorization",thrown:i})),()=>this.backoffTimeoutId=0)},e))})}async _authorize(){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:k.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,Qt.default)(this.params.apiTransport.sendRequest(e,r).then(i=>{var o;return(!i||!i.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:K.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(async i=>{this.sessionKey=void 0;let o=i==null?void 0:i.error_code;switch(o){case 401:return this.authToken=await this.refreshAuthToken(),this._authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:K.ErrorCategory.EXTERNAL_API,message:"authorize error",data:i}):this.params.error$.next({id:"AuthorizeUnknown",category:K.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:oP,NativeAbortController:nP}=function(t){return{NativeAbortSignal:t.AbortSignal,NativeAbortController:t.AbortController}}(typeof self!="undefined"?self:global);function ql(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 Rl(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 Yt=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}},Le=class extends Yt{constructor(){super(),this.listeners||Yt.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(e){e.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,e)),super.dispatchEvent(e)}throwIfAborted(){let{aborted:e,reason:r="Aborted"}=this;if(e)throw r}static timeout(e){let r=new pe;return setTimeout(()=>r.abort(new DOMException(`This signal is timeout in ${e}ms`,"TimeoutError")),e),r.signal}static any(e){let r=new pe;function i(){r.abort(this.reason),o()}function o(){for(let n of e)n.removeEventListener("abort",i)}for(let n of e)if(n.aborted){r.abort(n.reason);break}else n.addEventListener("abort",i);return r.signal}},pe=class{constructor(){Object.defineProperty(this,"signal",{value:new Le,writable:!0,configurable:!0})}abort(e){let r=Rl(e),i=ql(r);this.signal.reason=r,this.signal.dispatchEvent(i)}toString(){return"[object AbortController]"}};typeof Symbol!="undefined"&&Symbol.toStringTag&&(pe.prototype[Symbol.toStringTag]="AbortController",Le.prototype[Symbol.toStringTag]="AbortSignal");function Jt(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 so(t){typeof t=="function"&&(t={fetch:t});let{fetch:e,Request:r=e.Request,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=t;if(!Jt({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,p){let h;p&&p.signal&&(h=p.signal,delete p.signal);let c=new r(l,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:(d,l)=>{let p=n&&n.prototype.isPrototypeOf(d)?d.signal:l?l.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 l&&l.signal&&delete l.signal,Promise.race([c,s(d,l)])}return s(d,l)},Request:n}}var vy=()=>"fetch"in window,ot=vy()&&Jt({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),Cl=ot?so({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,ke=ot?Cl.fetch:window.fetch,vP=ot?Cl.Request:window.Request,gP=ot?pe:window.AbortController,mP=ot?Le:window.AbortSignal;var Ll=R(Se(),1),kl=R(Ce(),1),te=require("@vkontakte/videoplayer-shared/es2018");var nt=class{constructor(e){this.params=e,this.apiKey=e.config.apiKey,this.apiEnv=e.config.apiEnv,this.apiBaseUrl=Yr[this.apiEnv],this.timeSynchronisation=e.timeSynchronisation,this.isApiBaseUrlFetched=!1}async resolveApiBaseUrl(){var e;if(this.apiEnv!=="auto"||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{let r=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=await(await ke(r,{method:"GET",mode:"cors",cache:"no-cache"})).json(),n=(e=o==null?void 0:o.Answer[0])==null?void 0:e.data;if(!n)throw new Error("Wrong DNS response");return n}catch(r){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:te.ErrorCategory.NETWORK,message:"Unhandled resolve api base url error",thrown:r}),Yr.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:te.ErrorCategory.NETWORK,message:"Unhandled beacon error",thrown:s,data:{method:e,params:r}})}return!1}async sendRequest(e,r,i){let o=(0,te.now)(),n=u=>{if(u instanceof TypeError&&(0,Ll.default)(["Failed to fetch","NetworkError when attempting to fetch resource."],u.message)){this.params.error$.next({id:"Network",category:te.ErrorCategory.NETWORK,message:"Request failed",thrown:u});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:te.ErrorCategory.NETWORK,message:"Unhandled request error",thrown:u,data:{method:e,params:r,sessionKey:i,time:(0,te.now)()-o}})};this.apiBaseUrl=await 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),ke(`${this.apiBaseUrl}/fb.do`,s).then(u=>{var h,c;let d=Number(u.headers.get("content-length"))===0,l=new Date((h=u.headers.get("date"))!=null?h:"").getTime(),p=(0,te.now)()-o;if(isFinite(l)&&((c=this.timeSynchronisation)==null||c.addServerTime(l,p)),!d)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,kl.default)(e.queryParams).forEach(([i,o])=>r.append(i,typeof o=="string"?o:JSON.stringify(o))),r}};var Nl=R(Se(),1),Dl=R(Ce(),1),V=require("@vkontakte/videoplayer-shared/es2018"),Xt="onestat_events",uo=t=>e=>e.timestamp+t>=(0,V.now)(),Zt=class{constructor(e){this.unsaltedStorage=[];this.isPaused=!1;this.isUrgent=e=>{let{operation:r}=e;return(0,Nl.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,V.debounceFn)(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});let r=V.safeStorage.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=(0,V.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:V.ErrorCategory.WTF,message:e?String(e):"Unknown logger error",thrown:e})}}readFromStorage(){let e=V.safeStorage.get(Xt);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(uo(this.params.config.storageExpiration));V.safeStorage.set(Xt,JSON.stringify({...r,[this.userSalt]:[...o,e]}))}getFromStorage(){var i;return this.userSalt?((i=this.readFromStorage()[this.userSalt])!=null?i:[]).filter(uo(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}let e=this.readFromStorage();delete e[this.userSalt],V.safeStorage.set(Xt,JSON.stringify(e))}housekeepStorage(){let e=this.readFromStorage();for(let[r,i]of(0,Dl.default)(e)){let o=i.filter(uo(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`})}V.safeStorage.set(Xt,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/es2018"),co=require("@vkontakte/videoplayer-shared/es2018");var $l=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],lo=t=>t&&{[b.HttpConnectionType.HTTP1]:"http1",[b.HttpConnectionType.HTTP2]:"http2",[b.HttpConnectionType.QUIC]:"http3"}[t],Ml=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,co.assertNever)(t)}},er=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,co.assertNever)(t)}},Vl=t=>{switch(t){case"slow-2g":return"poor";case"2g":return"poor";case"3g":return"good";case"4g":return"excellent"}};var tr=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 ho=R(po(),1),rd=()=>(0,ho.default)(Math.floor(Math.random()*2**32).toString(36),7,"0"),id=()=>(0,ho.default)(Math.floor(Math.random()*2**64).toString(36),13,"0");var vo=require("@vkontakte/videoplayer-core/es2018"),P=require("@vkontakte/videoplayer-shared/es2018"),od=(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)(q=>q&&q/1e3)).subscribe(n):s=t.info.position$.subscribe(n),i.add(s)}));let{playing$:u,paused$:d}=t.events,l=t.events.willSeek$.pipe((0,P.filter)(()=>t.info.playbackState$.getValue()===vo.PlaybackState.PLAYING)),p=t.events.seeked$.pipe((0,P.filter)(()=>t.info.playbackState$.getValue()===vo.PlaybackState.PLAYING)),h=!1,c=new P.Subject;i.add(l.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)(d,c,o,t.events.looped$,g),I,_=()=>I=n.getValue(),x=()=>{let w=n.getValue();(0,P.isNullable)(I)||I===w||(0,P.isNullable)(w)||(r.next({from:I,to:w}),I=void 0)},U=()=>{g.next(),f.next()};if(i.add(m.subscribe(_)),i.add(S.subscribe(x)),e.forceInterval&&isFinite(e.forceInterval)){let w=0;i.add(m.subscribe(()=>w=window.setTimeout(U,e.forceInterval))),i.add(S.subscribe(()=>window.clearTimeout(w)))}return i});var Dy="_one-stat_",nd=`${Dy}deviceId`,go=()=>{let t=new v.Subscription;return{subscription:t,subscribe:(e,r)=>{e&&t.add(e.subscribe(r))}}},rr=class{constructor(e,r){this.subscription=new v.Subscription;this.debugLogger=new ir.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 d,l,p;this.statContext=e,this.config=Aa((d=r.config)!=null?d:{}),(0,v.isNonNullable)(r.apiEnv)&&(this.config.apiEnv=r.apiEnv),this.config.synchronizeTime&&(this.timeSynchronisation=new tr);let i=new v.Subject;this.experimental={error$:i};let o=v.safeStorage.get(nd);this.statContext.deviceId?this.deviceId=this.statContext.deviceId:o?this.deviceId=o:(this.deviceId=Jr(),v.safeStorage.set(nd,this.deviceId)),this.resetViewSession(),r.useIsid&&this.isid$.next((l=r.isid)!=null?l:id()),this.zenUid$.next(r.zenUid);let n=new nt({config:this.config,error$:i,timeSynchronisation:this.timeSynchronisation});this.api=new it({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 Zt({config:this.config,debugLogger:this.debugLogger,api:this.api,error$:i,userSalt:r.userSalt});let{isEmbed:s,topOrigin:u}=(0,ir.detectEmbed)();this.isEmbed=s,this.embedParent=u?new URL(u).hostname:void 0,this.subscribe()}updateContext(e){this.statContext={...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(od(e,{forceInterval:this.config.watchCoverageInterval}),c=>{var S,I,_,x;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 U=(S=e.info.liveLatency$.getValue())!=null?S:0,w=(_=(I=e.info.currentBuffer$.getValue())==null?void 0:I.end)!=null?_:0,q=(x=e.info.liveBufferTime$.getValue())!=null?x:0,st=Math.round((U-(w-q))*1e3),ut=Math.round(U*1e3);st&&ut&&(m.latency=st,m.bufferLatency=ut)}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,d=!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=>{!d&&c&&c.end-c.start>0&&(0,v.isNonNullable)(s)&&(this.logPlayerReady({duration:(0,v.now)()-s}),d=!0)}),i(e.events.firstFrame$,()=>{(0,v.isNonNullable)(s)&&!d&&(this.logPlayerReady({duration:(0,v.now)()-s}),d=!0),(0,v.isNonNullable)(u)&&this.logFirstFrame({time:(0,v.now)()-u})});let l;i(e.info.currentVideoStream$,c=>{c&&(l&&c.id!==l&&this.logTrackSwitch(c),l=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=$l(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:Ml(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:lo(c)}),this.updateContext({connectionType:lo(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:er(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}=go();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":er((s=this.player)==null?void 0:s.info.surface$.getValue());this.updateContext({mode:n})}),i(e.inFullscreen$,o=>{var s;let n=o?"fullscreen":er((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}=go();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}=go();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(rd())}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:Vl(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,mo.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(),d=e==="empty_buffer"||e==="close_at_empty_buffer"?this.statContext.connectionType:this.statContext.firstConnectionType,l=this.statContext.firstConnectionReused,p,h;if(this.isEmbed||this.statContext.place==="embed"){p=this.embedParent;let x=[...new URLSearchParams(location.search).entries()].filter(([U,w])=>(0,mo.default)(this.config.embedUrlParams,U));h=new URLSearchParams(x).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={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:d,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: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 x of this.config.disabledCustomFields)delete c[x];return{operation:e,type:1,time:i,network:this.statContext.network,timestamp:n,custom:c}}};var dr={};Oo(dr,{SeekType:()=>or,ThinOneStat:()=>lr,VERSION:()=>k});var T=require("@vkontakte/videoplayer-shared/es2018"),z=require("@vkontakte/videoplayer-core/es2018");var ud=require("@vkontakte/videoplayer-shared/es2018");var or=(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))(or||{});var sd="CIOPGQJGDIHBABABA",bo={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 $y={apiKey:sd,apiEnv:"vk_alias",requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageHeartbeatInterval:15,synchronizeTime:!0,useBeacon:!1,alwaysSendDesktop:!1},cd=t=>(0,ud.fillWithDefault)(t,$y);var yo=R(ji(),1),G=require("@vkontakte/videoplayer-shared/es2018");var nr=class{constructor(e){this.params=e,this.authorized$=new G.ValueSubject(!1),this.consequentAuthErrors=0}async authorize(e){return this.authToken=e!=null?e:await 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(()=>{})}async logRequest(e){var u;let r="log.logUvStat",i=this.createLogParams(e),o={},n=(u=this.sessionKey)!=null?u:await this.authorizeWithBackoff();if(!n)return;let s=async(d,l=this.params.config.requestRetryCount)=>{try{return await this.params.apiTransport.sendRequest(r,i,n,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 h=p==null?void 0:p.error_code;switch(h){case 102:case 103:case 104:return this.authorized$.next(!1),this.sessionKey=await this.authorizeWithBackoff(),l>0?s(d,l-1):void 0;case 401:return this.authorized$.next(!1),this.authToken=await this.refreshAuthToken(),this.sessionKey=await this.authorizeWithBackoff(),l>0?s(d,l-1):void 0;default:{this.params.error$.next({id:`LogRequest#${h}`,category:G.ErrorCategory.EXTERNAL_API,message:`${r} error`,data:p});return}}}};return s(e)}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}async refreshAuthToken(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=(0,yo.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:${k}`,platform:e[0].platform,product:e[0].product,events:e})}}authorizeWithBackoff(){if(!this.consequentAuthErrors)return this.doAuthorize();let e=(0,G.getExponentialDelay)(this.consequentAuthErrors);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(async()=>{try{let i=await this.doAuthorize();r(i)}catch(i){this.params.error$.next({id:"AuthorizeBackoff",category:G.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:k.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,yo.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(async i=>{this.sessionKey=void 0;let o=i==null?void 0:i.error_code;switch(o){case 401:return this.authToken=await 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 ld=R(Se(),1);var dd=R(Ce(),1),re=require("@vkontakte/videoplayer-shared/es2018");var ar=class{constructor(e){this.params=e,this.apiKey=e.config.apiKey,this.apiEnv=e.config.apiEnv,this.apiBaseUrl=bo[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:re.ErrorCategory.NETWORK,message:"Unhandled beacon error",thrown:s,data:{method:e,params:r}})}return!1}async sendRequest(e,r,i,o){let n=(0,re.now)(),s=u=>{if(u instanceof TypeError&&(0,ld.default)(["Failed to fetch","NetworkError when attempting to fetch resource."],u.message)){this.params.error$.next({id:"Network",category:re.ErrorCategory.NETWORK,message:"Request failed",thrown:u});return}this.params.error$.next({id:"ThinOneStat:ApiTransport:sendRequest",category:re.ErrorCategory.NETWORK,message:"Unhandled request error",thrown:u,data:{method:e,params:r,sessionKey:i,time:(0,re.now)()-n}})};return this.apiBaseUrl=await this.resolveApiBaseUrl(),ke(`${this.apiBaseUrl}/fb.do`,{method:"post",headers:{"Content-type":"application/x-www-form-urlencoded",...o},body:this.prepareQueryParams({method:e,queryParams:r,sessionKey:i})}).then(u=>{var h,c;let d=Number(u.headers.get("content-length"))===0,l=new Date((h=u.headers.get("date"))!=null?h:"").getTime(),p=(0,re.now)()-n;if(isFinite(l)&&((c=this.timeSynchronisation)==null||c.addServerTime(l,p)),!d)return u.json().then(f=>Object.prototype.hasOwnProperty.call(f,"error_msg")?Promise.reject(f):f,s)},s)}async resolveApiBaseUrl(){var e;if(this.apiEnv!=="auto"||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{let r=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=await(await ke(r,{method:"GET",mode:"cors",cache:"no-cache"})).json(),n=(e=o==null?void 0:o.Answer[0])==null?void 0:e.data;if(!n)throw new Error("Wrong DNS response");return n}catch(r){return this.params.error$.next({id:"ThinOneStat:ApiTransport:resolveApiBaseUrl",category:re.ErrorCategory.NETWORK,message:"Unhandled resolve api base url error",thrown:r}),bo.vk_alias}finally{this.isApiBaseUrlFetched=!0}}prepareQueryParams(e){let r=new URLSearchParams({format:"JSON",method:e.method,application_key:this.apiKey});return e.sessionKey!==void 0&&r.append("session_key",e.sessionKey),(0,dd.default)(e.queryParams).forEach(([i,o])=>r.append(i,typeof o=="string"?o:JSON.stringify(o))),r}};var fd=R(Se(),1),pd=R(Ce(),1),F=require("@vkontakte/videoplayer-shared/es2018"),sr="thinonestat_events",Io=t=>e=>e.client_time+t>=(0,F.now)(),ur=class{constructor(e){this.unsaltedStorage=[];this.isPaused=!1;this.isUrgent=e=>{let{event_name:r}=e;return(0,fd.default)(["watch_coverage","watch_coverage_live","watched_n","playback_started"],r)};this.params=e,this.api=e.api,this.error$=e.error$,this.userSalt=e.userSalt,this.loggerDebugLog=e.debugLogger.createComponentLog("stat logger"),this.firstFlush=(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:String(e)||"Unknown logger error",thrown:e})}}readFromStorage(){let e=F.safeStorage.get(sr);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(Io(this.params.config.storageExpiration));F.safeStorage.set(sr,JSON.stringify({...r,[this.userSalt]:[...o,e]}))}getFromStorage(){var i;return this.userSalt?((i=this.readFromStorage()[this.userSalt])!=null?i:[]).filter(Io(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}let e=this.readFromStorage();delete e[this.userSalt],F.safeStorage.set(sr,JSON.stringify(e))}housekeepStorage(){let e=this.readFromStorage();for(let[r,i]of(0,pd.default)(e)){let o=i.filter(Io(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(sr,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 So(){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 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 _o=require("@vkontakte/videoplayer-core/es2018"),E=require("@vkontakte/videoplayer-shared/es2018"),hd=(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(q=>{n&&(n.unsubscribe(),o.next(void 0)),q?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$:d,looped$:l}=t.events,p=t.events.willSeek$.pipe((0,E.filter)(()=>t.info.playbackState$.getValue()===_o.PlaybackState.PLAYING)),h=t.events.seeked$.pipe((0,E.filter)(()=>t.info.playbackState$.getValue()===_o.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 q=o.getValue();(0,E.isNullable)(m)||(0,E.isNullable)(q)||m===q||(r.next({from:m,to:q}),m=void 0)},_=new E.Subject,x=new E.Subject,U=(0,E.merge)(s,f,_),w=(0,E.merge)(u,h,g,d,l,x);if(i.add(U.subscribe(S)).add(w.subscribe(I)),e.heartbeatInterval&&isFinite(e.heartbeatInterval)){let q=[],st=e.heartbeatInterval*1e3,ut=()=>{x.next(),_.next()};i.add(U.subscribe(()=>{let hr=window.setTimeout(ut,st);q.push(hr)})).add(w.subscribe(()=>{q.forEach(hr=>{window.clearTimeout(hr)}),q=[]}))}return i});var vd=require("@vkontakte/videoplayer-core/es2018"),gd=require("@vkontakte/videoplayer-shared/es2018"),md=(t,e)=>new gd.Observable(r=>{let i=new vd.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 he=require("@vkontakte/videoplayer-shared/es2018"),bd=t=>new he.Observable(e=>{let r=new he.Subscription,i=0,o=1,n=0,s=!1,u=!1,d=()=>{if(!s)return;let w=Date.now();n+=(w-i)*o,i=w},l=()=>{(!s||u)&&(i=Date.now(),s=!0,u=!1)},p=()=>{s&&(d(),s=!1)},h=()=>{s&&(d(),s=!1,u=!0)},c=w=>{s&&d(),o=w,i=Date.now()},{started$:f,playing$:g,paused$:m,willSeek$:S,ended$:I,willDestruct$:_}=t.events,{currentPlaybackRate$:x}=t.info;r.add(S.subscribe(h)).add((0,he.merge)(f,g).subscribe(l)).add((0,he.merge)(m,I,_).subscribe(p)).add(x.subscribe(c));let U=()=>{let w=n;return s&&(w+=(Date.now()-i)*o),Math.floor(w/1e3)};return e.next(U),r});var Po=require("@vkontakte/videoplayer-shared/es2018"),y=require("@vkontakte/videoplayer-core/es2018");var Eo=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,Po.assertNever)(t)}},oe=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,Po.assertNever)(t)}},yd=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}},Id=(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}},Sd=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"}},_d=t=>{if(t!==void 0)return t===y.Surface.INVISIBLE?"background":"foreground"};var To=R(po(),1),Pd=()=>(0,To.default)(Math.floor(Math.random()*2**32).toString(36),13,"0"),Ed=()=>(0,To.default)(Math.floor(Math.random()*2**64).toString(36),13,"0");var My="_thin-one-stat_",Td=`${My}deviceId`,Vy=()=>{let t=new T.Subscription;return{subscription:t,subscribe:(e,r)=>{e&&t.add(e.subscribe(r))}}},lr=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 d,l;this.statContext=e,this.config=cd((d=r.config)!=null?d:{}),this.subscription=new T.Subscription,this.config.synchronizeTime&&(this.timeSynchronisation=new cr);let i=new T.Subject,o=T.safeStorage.get(Td);this.statContext.deviceId?this.deviceId=this.statContext.deviceId:o?this.deviceId=o:(this.deviceId=So(),T.safeStorage.set(Td,this.deviceId)),this.resetViewSession(),r.useIsid&&this.isid$.next((l=r.isid)!=null?l:Ed());let n=new ar({error$:i,config:this.config,timeSynchronisation:this.timeSynchronisation});this.api=new nr({config:this.config,apiTransport:n,error$:i,deviceId:this.deviceId,refreshAuthToken:r.refreshAuthToken}),this.logger=new ur({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={...this.statContext,...e}}attachTo(e){let r=new T.Subscription,i=(n,s)=>r.add(n.subscribe(s));i(bd(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(hd(e,{heartbeatInterval:this.config.watchCoverageHeartbeatInterval}),n=>{let s=Math.round(n.from*1e3),u=Math.round(n.to*1e3),d={watch_interval:`${s}-${u}`,in_history:!!this.statContext.inHistory,content_type:Eo(e.info.currentFormat$.getValue()),playback_quality:oe(e.info.currentQuality$.getValue()),recom_info:this.statContext.recomInfo};if(!e.info.isLive$.getValue())this.logWatchCoverage(d);else{let p=e.info.atLiveEdge$.getValue();this.logWatchCoverageLive({...d,live:!!p})}}),i(md(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:yd(Eo(e.info.currentFormat$.getValue())),dpi:z.clientChecker.display.pixelRatio,web_layout:z.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(),d=e.info.currentQuality$.getValue(),l={target_buffer_time:u?u.end-u.start:void 0,playback_url:Id(n,s,d),playback_quality:oe(d)};this.logPreloadStarted(l)}}),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===z.PlaybackState.PLAYING){let u=e.info.currentBuffer$.getValue(),d={buffer_time:u?u.end-u.start:void 0};if(this.logPlaying(d),this.isStarted)this.logResume();else{this.isStarted=!0;let l=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:oe(l),user_quality:p?"auto":oe(l),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:Sd(f),visibility:_d(f),subtitles_enabled:!!m,auto_subtitles:!!((s=g.find(({id:x})=>x===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===z.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 d=e.info.isAutoQualityEnabled$.getValue(),l=(s=e.info.currentVideoStream$.getValue())==null?void 0:s.codec,p=(u=e.info.currentAudioStream$.getValue())==null?void 0:u.codec,h={user_quality:d?"auto":oe(n),playback_quality:oe(n),download_quality:oe(n),codec_info:l&&p?`${l},${p}`:void 0,manual_switch:!d};this.logQualityChanged(h)}}),this.resubscribeBeforeunload(),this.subscription.add(r),r}attachToUi(e){let{subscribe:r,subscription:i}=Vy();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(Pd()),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:${k}`,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:k,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({...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 wo={};var Fy=(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)},Uy=t=>window.clearTimeout(t),wd=t=>typeof t=="function"&&(t==null?void 0:t.toString().endsWith("{ [native code] }")),Od=!wd(window.requestIdleCallback)||!wd(window.cancelIdleCallback),Ad=Od?Fy:window.requestIdleCallback,xd=Od?Uy:window.cancelIdleCallback;var at=require("@vkontakte/videoplayer-core/es2018"),Rd=require("@vkontakte/videoplayer-shared/es2018");var fr=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 qd=()=>window.Image?new Image:document.createElement("img");var pr=class{constructor(e){this.position=0;this.started=!1;this.heartbeatPixels=[];this.heartbeatLastTimeSent={};this.idleCallbackIds=[];this.stopwatch=new fr;this.subscription=new at.Subscription;this.params=e;let r=new Rd.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=>xd(e)),this.send("stop")}onPlaybackState(e){e===at.PlaybackState.PLAYING?this.started?this.play():this.start():e===at.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(Ad(()=>qd().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)}};