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