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