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