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