@vkontakte/videoplayer-statistics 1.0.97-dev.ba996fd4.0 → 1.0.97-dev.bc3c59e8.0

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