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