@vkontakte/videoplayer-statistics 1.0.35 → 1.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es2015.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-statistics v1.0.35
3
- * Mon, 19 Jun 2023 16:54:12 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-35/doc/
2
+ * @vkontakte/videoplayer-statistics v1.0.36
3
+ * Mon, 03 Jul 2023 18:22:45 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-36/doc/
5
5
  */
6
- "use strict";var s=require("@vkontakte/videoplayer-shared/es2015.cjs.js"),Gt=require("lodash/debounce.js"),p=require("@vkontakte/videoplayer-core/es2015.cjs.js");function I(e,t,r,n){function o(i){return i instanceof r?i:new r(function(c){c(i)})}return new(r||(r=Promise))(function(i,c){function v(a){try{u(n.next(a))}catch(l){c(l)}}function f(a){try{u(n.throw(a))}catch(l){c(l)}}function u(a){a.done?i(a.value):o(a.value).then(v,f)}u((n=n.apply(e,t||[])).next())})}var Qt=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},fe=function(e){return e&&e.Math==Math&&e},b=fe(typeof globalThis=="object"&&globalThis)||fe(typeof window=="object"&&window)||fe(typeof self=="object"&&self)||fe(typeof Qt=="object"&&Qt)||function(){return this}()||Function("return this")(),T=function(e){try{return!!e()}catch(t){return!0}},$o=T,De=!$o(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),mo=De,on=Function.prototype,zt=on.apply,Yt=on.call,an=typeof Reflect=="object"&&Reflect.apply||(mo?Yt.bind(zt):function(){return Yt.apply(zt,arguments)}),sn=De,cn=Function.prototype,gt=cn.call,So=sn&&cn.bind.bind(gt,gt),_=sn?So:function(e){return function(){return gt.apply(e,arguments)}},un=_,Eo=un({}.toString),To=un("".slice),Le=function(e){return To(Eo(e),8,-1)},_o=Le,Oo=_,ln=function(e){if(_o(e)==="Function")return Oo(e)},bt=typeof document=="object"&&document.all,Po=typeof bt=="undefined"&&bt!==void 0,fn={all:bt,IS_HTMLDDA:Po},vn=fn,wo=vn.all,y=vn.IS_HTMLDDA?function(e){return typeof e=="function"||e===wo}:function(e){return typeof e=="function"},Nt={},Co=T,Z=!Co(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),Io=De,ve=Function.prototype.call,O=Io?ve.bind(ve):function(){return ve.apply(ve,arguments)},dn={},hn={}.propertyIsEnumerable,pn=Object.getOwnPropertyDescriptor,Ro=pn&&!hn.call({1:2},1);dn.f=Ro?function(t){var r=pn(this,t);return!!r&&r.enumerable}:hn;var yn=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},Ao=_,No=T,Do=Le,He=Object,Lo=Ao("".split),jo=No(function(){return!He("z").propertyIsEnumerable(0)})?function(e){return Do(e)=="String"?Lo(e,""):He(e)}:He,je=function(e){return e==null},xo=je,ko=TypeError,gn=function(e){if(xo(e))throw ko("Can't call method on "+e);return e},Fo=jo,Uo=gn,Mo=function(e){return Fo(Uo(e))},Jt=y,bn=fn,Bo=bn.all,F=bn.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:Jt(e)||e===Bo}:function(e){return typeof e=="object"?e!==null:Jt(e)},$n={},Ke=$n,We=b,Vo=y,Xt=function(e){return Vo(e)?e:void 0},A=function(e,t){return arguments.length<2?Xt(Ke[e])||Xt(We[e]):Ke[e]&&Ke[e][t]||We[e]&&We[e][t]},Ho=_,Dt=Ho({}.isPrototypeOf),xe=typeof navigator!="undefined"&&String(navigator.userAgent)||"",mn=b,qe=xe,Zt=mn.process,er=mn.Deno,tr=Zt&&Zt.versions||er&&er.version,rr=tr&&tr.v8,S,Oe;rr&&(S=rr.split("."),Oe=S[0]>0&&S[0]<4?1:+(S[0]+S[1]));!Oe&&qe&&(S=qe.match(/Edge\/(\d+)/),(!S||S[1]>=74)&&(S=qe.match(/Chrome\/(\d+)/),S&&(Oe=+S[1])));var Sn=Oe,nr=Sn,Ko=T,En=!!Object.getOwnPropertySymbols&&!Ko(function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&nr&&nr<41}),Wo=En,Tn=Wo&&!Symbol.sham&&typeof Symbol.iterator=="symbol",qo=A,Go=y,Qo=Dt,zo=Tn,Yo=Object,_n=zo?function(e){return typeof e=="symbol"}:function(e){var t=qo("Symbol");return Go(t)&&Qo(t.prototype,Yo(e))},Jo=String,ke=function(e){try{return Jo(e)}catch(t){return"Object"}},Xo=y,Zo=ke,ea=TypeError,U=function(e){if(Xo(e))return e;throw ea(Zo(e)+" is not a function")},ta=U,ra=je,Lt=function(e,t){var r=e[t];return ra(r)?void 0:ta(r)},Ge=O,Qe=y,ze=F,na=TypeError,oa=function(e,t){var r,n;if(t==="string"&&Qe(r=e.toString)&&!ze(n=Ge(r,e))||Qe(r=e.valueOf)&&!ze(n=Ge(r,e))||t!=="string"&&Qe(r=e.toString)&&!ze(n=Ge(r,e)))return n;throw na("Can't convert object to primitive value")},Pe={},aa={get exports(){return Pe},set exports(e){Pe=e}},ce=!0,or=b,ia=Object.defineProperty,sa=function(e,t){try{ia(or,e,{value:t,configurable:!0,writable:!0})}catch(r){or[e]=t}return t},ca=b,ua=sa,ar="__core-js_shared__",la=ca[ar]||ua(ar,{}),jt=la,ir=jt;(aa.exports=function(e,t){return ir[e]||(ir[e]=t!==void 0?t:{})})("versions",[]).push({version:"3.27.2",mode:"pure",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.27.2/LICENSE",source:"https://github.com/zloirock/core-js"});var fa=gn,va=Object,da=function(e){return va(fa(e))},ha=_,pa=da,ya=ha({}.hasOwnProperty),ee=Object.hasOwn||function(t,r){return ya(pa(t),r)},ga=_,ba=0,$a=Math.random(),ma=ga(1 .toString),On=function(e){return"Symbol("+(e===void 0?"":e)+")_"+ma(++ba+$a,36)},Sa=b,Ea=Pe,sr=ee,Ta=On,_a=En,Oa=Tn,Q=Sa.Symbol,Ye=Ea("wks"),Pa=Oa?Q.for||Q:Q&&Q.withoutSetter||Ta,P=function(e){return sr(Ye,e)||(Ye[e]=_a&&sr(Q,e)?Q[e]:Pa("Symbol."+e)),Ye[e]},wa=O,cr=F,ur=_n,Ca=Lt,Ia=oa,Ra=P,Aa=TypeError,Na=Ra("toPrimitive"),Da=function(e,t){if(!cr(e)||ur(e))return e;var r=Ca(e,Na),n;if(r){if(t===void 0&&(t="default"),n=wa(r,e,t),!cr(n)||ur(n))return n;throw Aa("Can't convert object to primitive value")}return t===void 0&&(t="number"),Ia(e,t)},La=Da,ja=_n,Pn=function(e){var t=La(e,"string");return ja(t)?t:t+""},xa=b,lr=F,$t=xa.document,ka=lr($t)&&lr($t.createElement),wn=function(e){return ka?$t.createElement(e):{}},Fa=Z,Ua=T,Ma=wn,Cn=!Fa&&!Ua(function(){return Object.defineProperty(Ma("div"),"a",{get:function(){return 7}}).a!=7}),Ba=Z,Va=O,Ha=dn,Ka=yn,Wa=Mo,qa=Pn,Ga=ee,Qa=Cn,fr=Object.getOwnPropertyDescriptor;Nt.f=Ba?fr:function(t,r){if(t=Wa(t),r=qa(r),Qa)try{return fr(t,r)}catch(n){}if(Ga(t,r))return Ka(!Va(Ha.f,t,r),t[r])};var za=T,Ya=y,Ja=/#|\.prototype\./,ue=function(e,t){var r=Za[Xa(e)];return r==ti?!0:r==ei?!1:Ya(t)?za(t):!!t},Xa=ue.normalize=function(e){return String(e).replace(Ja,".").toLowerCase()},Za=ue.data={},ei=ue.NATIVE="N",ti=ue.POLYFILL="P",In=ue,vr=ln,ri=U,ni=De,oi=vr(vr.bind),Fe=function(e,t){return ri(e),t===void 0?e:ni?oi(e,t):function(){return e.apply(t,arguments)}},Ue={},ai=Z,ii=T,si=ai&&ii(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),ci=F,ui=String,li=TypeError,M=function(e){if(ci(e))return e;throw li(ui(e)+" is not an object")},fi=Z,vi=Cn,di=si,de=M,dr=Pn,hi=TypeError,Je=Object.defineProperty,pi=Object.getOwnPropertyDescriptor,Xe="enumerable",Ze="configurable",et="writable";Ue.f=fi?di?function(t,r,n){if(de(t),r=dr(r),de(n),typeof t=="function"&&r==="prototype"&&"value"in n&&et in n&&!n[et]){var o=pi(t,r);o&&o[et]&&(t[r]=n.value,n={configurable:Ze in n?n[Ze]:o[Ze],enumerable:Xe in n?n[Xe]:o[Xe],writable:!1})}return Je(t,r,n)}:Je:function(t,r,n){if(de(t),r=dr(r),de(n),vi)try{return Je(t,r,n)}catch(o){}if("get"in n||"set"in n)throw hi("Accessors not supported");return"value"in n&&(t[r]=n.value),t};var yi=Z,gi=Ue,bi=yn,Me=yi?function(e,t,r){return gi.f(e,t,bi(1,r))}:function(e,t,r){return e[t]=r,e},he=b,$i=an,mi=ln,Si=y,Ei=Nt.f,Ti=In,H=$n,_i=Fe,K=Me,hr=ee,Oi=function(e){var t=function(r,n,o){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,o)}return $i(e,this,arguments)};return t.prototype=e.prototype,t},B=function(e,t){var r=e.target,n=e.global,o=e.stat,i=e.proto,c=n?he:o?he[r]:(he[r]||{}).prototype,v=n?H:H[r]||K(H,r,{})[r],f=v.prototype,u,a,l,d,h,g,N,w,V;for(d in t)u=Ti(n?d:r+(o?".":"#")+d,e.forced),a=!u&&c&&hr(c,d),g=v[d],a&&(e.dontCallGetSet?(V=Ei(c,d),N=V&&V.value):N=c[d]),h=a&&N?N:t[d],!(a&&typeof g==typeof h)&&(e.bind&&a?w=_i(h,he):e.wrap&&a?w=Oi(h):i&&Si(h)?w=mi(h):w=h,(e.sham||h&&h.sham||g&&g.sham)&&K(w,"sham",!0),K(v,d,w),i&&(l=r+"Prototype",hr(H,l)||K(H,l,{}),K(H[l],d,h),e.real&&f&&(u||!f[d])&&K(f,d,h)))},Pi=Le,Be=typeof process!="undefined"&&Pi(process)=="process",wi=Me,xt=function(e,t,r,n){return n&&n.enumerable?e[t]=r:wi(e,t,r),e},Ci=y,Ii=String,Ri=TypeError,Ai=function(e){if(typeof e=="object"||Ci(e))return e;throw Ri("Can't set "+Ii(e)+" as a prototype")},Ni=_,Di=M,Li=Ai,ji=Object.setPrototypeOf||("__proto__"in{}?function(){var e=!1,t={},r;try{r=Ni(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),r(t,[]),e=t instanceof Array}catch(n){}return function(o,i){return Di(o),Li(i),e?r(o,i):o.__proto__=i,o}}():void 0),xi=P,ki=xi("toStringTag"),Rn={};Rn[ki]="z";var kt=String(Rn)==="[object z]",Fi=kt,Ui=y,Ee=Le,Mi=P,Bi=Mi("toStringTag"),Vi=Object,Hi=Ee(function(){return arguments}())=="Arguments",Ki=function(e,t){try{return e[t]}catch(r){}},Ft=Fi?Ee:function(e){var t,r,n;return e===void 0?"Undefined":e===null?"Null":typeof(r=Ki(t=Vi(e),Bi))=="string"?r:Hi?Ee(t):(n=Ee(t))=="Object"&&Ui(t.callee)?"Arguments":n},Wi=kt,qi=Ft,Gi=Wi?{}.toString:function(){return"[object "+qi(this)+"]"},Qi=kt,zi=Ue.f,Yi=Me,Ji=ee,Xi=Gi,Zi=P,pr=Zi("toStringTag"),es=function(e,t,r,n){if(e){var o=r?e:e.prototype;Ji(o,pr)||zi(o,pr,{configurable:!0,value:t}),n&&!Qi&&Yi(o,"toString",Xi)}},ts=A,rs=Ue,ns=P,os=Z,yr=ns("species"),as=function(e){var t=ts(e),r=rs.f;os&&t&&!t[yr]&&r(t,yr,{configurable:!0,get:function(){return this}})},is=Dt,ss=TypeError,cs=function(e,t){if(is(t,e))return e;throw ss("Incorrect invocation")},us=_,ls=y,mt=jt,fs=us(Function.toString);ls(mt.inspectSource)||(mt.inspectSource=function(e){return fs(e)});var An=mt.inspectSource,vs=_,ds=T,Nn=y,hs=Ft,ps=A,ys=An,Dn=function(){},gs=[],Ln=ps("Reflect","construct"),Ut=/^\s*(?:class|function)\b/,bs=vs(Ut.exec),$s=!Ut.exec(Dn),ne=function(t){if(!Nn(t))return!1;try{return Ln(Dn,gs,t),!0}catch(r){return!1}},jn=function(t){if(!Nn(t))return!1;switch(hs(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return $s||!!bs(Ut,ys(t))}catch(r){return!0}};jn.sham=!0;var ms=!Ln||ds(function(){var e;return ne(ne.call)||!ne(Object)||!ne(function(){e=!0})||e})?jn:ne,Ss=ms,Es=ke,Ts=TypeError,_s=function(e){if(Ss(e))return e;throw Ts(Es(e)+" is not a constructor")},gr=M,Os=_s,Ps=je,ws=P,Cs=ws("species"),xn=function(e,t){var r=gr(e).constructor,n;return r===void 0||Ps(n=gr(r)[Cs])?t:Os(n)},Is=A,Rs=Is("document","documentElement"),As=_,Ns=As([].slice),Ds=TypeError,Ls=function(e,t){if(e<t)throw Ds("Not enough arguments");return e},js=xe,kn=/(?:ipad|iphone|ipod).*applewebkit/i.test(js),$=b,xs=an,ks=Fe,br=y,Fs=ee,Fn=T,$r=Rs,Us=Ns,mr=wn,Ms=Ls,Bs=kn,Vs=Be,St=$.setImmediate,Et=$.clearImmediate,Hs=$.process,tt=$.Dispatch,Ks=$.Function,Sr=$.MessageChannel,Ws=$.String,rt=0,oe={},Er="onreadystatechange",ie,D,nt,ot;Fn(function(){ie=$.location});var Mt=function(e){if(Fs(oe,e)){var t=oe[e];delete oe[e],t()}},at=function(e){return function(){Mt(e)}},Tr=function(e){Mt(e.data)},_r=function(e){$.postMessage(Ws(e),ie.protocol+"//"+ie.host)};(!St||!Et)&&(St=function(t){Ms(arguments.length,1);var r=br(t)?t:Ks(t),n=Us(arguments,1);return oe[++rt]=function(){xs(r,void 0,n)},D(rt),rt},Et=function(t){delete oe[t]},Vs?D=function(e){Hs.nextTick(at(e))}:tt&&tt.now?D=function(e){tt.now(at(e))}:Sr&&!Bs?(nt=new Sr,ot=nt.port2,nt.port1.onmessage=Tr,D=ks(ot.postMessage,ot)):$.addEventListener&&br($.postMessage)&&!$.importScripts&&ie&&ie.protocol!=="file:"&&!Fn(_r)?(D=_r,$.addEventListener("message",Tr,!1)):Er in mr("script")?D=function(e){$r.appendChild(mr("script"))[Er]=function(){$r.removeChild(this),Mt(e)}}:D=function(e){setTimeout(at(e),0)});var Un={set:St,clear:Et},Mn=function(){this.head=null,this.tail=null};Mn.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e){var t=this.head=e.next;return t===null&&(this.tail=null),e.item}}};var Bn=Mn,qs=xe,Gs=/ipad|iphone|ipod/i.test(qs)&&typeof Pebble!="undefined",Qs=xe,zs=/web0s(?!.*chrome)/i.test(Qs),k=b,Or=Fe,Ys=Nt.f,it=Un.set,Js=Bn,Xs=kn,Zs=Gs,ec=zs,st=Be,Pr=k.MutationObserver||k.WebKitMutationObserver,wr=k.document,Cr=k.process,pe=k.Promise,Ir=Ys(k,"queueMicrotask"),Tt=Ir&&Ir.value,W,ct,ut,ye,Rr;if(!Tt){var ge=new Js,be=function(){var e,t;for(st&&(e=Cr.domain)&&e.exit();t=ge.get();)try{t()}catch(r){throw ge.head&&W(),r}e&&e.enter()};!Xs&&!st&&!ec&&Pr&&wr?(ct=!0,ut=wr.createTextNode(""),new Pr(be).observe(ut,{characterData:!0}),W=function(){ut.data=ct=!ct}):!Zs&&pe&&pe.resolve?(ye=pe.resolve(void 0),ye.constructor=pe,Rr=Or(ye.then,ye),W=function(){Rr(be)}):st?W=function(){Cr.nextTick(be)}:(it=Or(it,k),W=function(){it(be)}),Tt=function(e){ge.head||W(),ge.add(e)}}var tc=Tt,rc=function(e,t){try{arguments.length==1?console.error(e):console.error(e,t)}catch(r){}},Bt=function(e){try{return{error:!1,value:e()}}catch(t){return{error:!0,value:t}}},nc=b,oc=y,Ar=nc.WeakMap,ac=oc(Ar)&&/native code/.test(String(Ar)),ic=Pe,sc=On,Nr=ic("keys"),cc=function(e){return Nr[e]||(Nr[e]=sc(e))},uc={},lc=ac,Vn=b,fc=F,vc=Me,lt=ee,ft=jt,dc=cc,hc=uc,Dr="Object already initialized",_t=Vn.TypeError,pc=Vn.WeakMap,we,se,Ce,yc=function(e){return Ce(e)?se(e):we(e,{})},gc=function(e){return function(t){var r;if(!fc(t)||(r=se(t)).type!==e)throw _t("Incompatible receiver, "+e+" required");return r}};if(lc||ft.state){var E=ft.state||(ft.state=new pc);E.get=E.get,E.has=E.has,E.set=E.set,we=function(e,t){if(E.has(e))throw _t(Dr);return t.facade=e,E.set(e,t),t},se=function(e){return E.get(e)||{}},Ce=function(e){return E.has(e)}}else{var q=dc("state");hc[q]=!0,we=function(e,t){if(lt(e,q))throw _t(Dr);return t.facade=e,vc(e,q,t),t},se=function(e){return lt(e,q)?e[q]:{}},Ce=function(e){return lt(e,q)}}var bc={set:we,get:se,has:Ce,enforce:yc,getterFor:gc},$c=b,te=$c.Promise,Hn=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",mc=Hn,Sc=Be,Ec=!mc&&!Sc&&typeof window=="object"&&typeof document=="object",Tc=b,ae=te,_c=y,Oc=In,Pc=An,wc=P,Cc=Ec,Ic=Hn,Rc=ce,vt=Sn,Lr=ae&&ae.prototype,Ac=wc("species"),Ot=!1,Kn=_c(Tc.PromiseRejectionEvent),Nc=Oc("Promise",function(){var e=Pc(ae),t=e!==String(ae);if(!t&&vt===66||Rc&&!(Lr.catch&&Lr.finally))return!0;if(!vt||vt<51||!/native code/.test(e)){var r=new ae(function(i){i(1)}),n=function(i){i(function(){},function(){})},o=r.constructor={};if(o[Ac]=n,Ot=r.then(function(){})instanceof n,!Ot)return!0}return!t&&(Cc||Ic)&&!Kn}),le={CONSTRUCTOR:Nc,REJECTION_EVENT:Kn,SUBCLASSING:Ot},re={},jr=U,Dc=TypeError,Lc=function(e){var t,r;this.promise=new e(function(n,o){if(t!==void 0||r!==void 0)throw Dc("Bad Promise constructor");t=n,r=o}),this.resolve=jr(t),this.reject=jr(r)};re.f=function(e){return new Lc(e)};var jc=B,xc=ce,Ie=Be,R=b,X=O,xr=xt,kr=ji,kc=es,Fc=as,Uc=U,Te=y,Mc=F,Bc=cs,Vc=xn,Wn=Un.set,Vt=tc,Hc=rc,Kc=Bt,Wc=Bn,qn=bc,Re=te,Ht=le,Gn=re,Ve="Promise",Qn=Ht.CONSTRUCTOR,qc=Ht.REJECTION_EVENT,Gc=Ht.SUBCLASSING,dt=qn.getterFor(Ve),Qc=qn.set,G=Re&&Re.prototype,L=Re,$e=G,zn=R.TypeError,Pt=R.document,Kt=R.process,wt=Gn.f,zc=wt,Yc=!!(Pt&&Pt.createEvent&&R.dispatchEvent),Yn="unhandledrejection",Jc="rejectionhandled",Fr=0,Jn=1,Xc=2,Wt=1,Xn=2,me,Ur,Zc,Mr,Zn=function(e){var t;return Mc(e)&&Te(t=e.then)?t:!1},eo=function(e,t){var r=t.value,n=t.state==Jn,o=n?e.ok:e.fail,i=e.resolve,c=e.reject,v=e.domain,f,u,a;try{o?(n||(t.rejection===Xn&&tu(t),t.rejection=Wt),o===!0?f=r:(v&&v.enter(),f=o(r),v&&(v.exit(),a=!0)),f===e.promise?c(zn("Promise-chain cycle")):(u=Zn(f))?X(u,f,i,c):i(f)):c(r)}catch(l){v&&!a&&v.exit(),c(l)}},to=function(e,t){e.notified||(e.notified=!0,Vt(function(){for(var r=e.reactions,n;n=r.get();)eo(n,e);e.notified=!1,t&&!e.rejection&&eu(e)}))},ro=function(e,t,r){var n,o;Yc?(n=Pt.createEvent("Event"),n.promise=t,n.reason=r,n.initEvent(e,!1,!0),R.dispatchEvent(n)):n={promise:t,reason:r},!qc&&(o=R["on"+e])?o(n):e===Yn&&Hc("Unhandled promise rejection",r)},eu=function(e){X(Wn,R,function(){var t=e.facade,r=e.value,n=Br(e),o;if(n&&(o=Kc(function(){Ie?Kt.emit("unhandledRejection",r,t):ro(Yn,t,r)}),e.rejection=Ie||Br(e)?Xn:Wt,o.error))throw o.value})},Br=function(e){return e.rejection!==Wt&&!e.parent},tu=function(e){X(Wn,R,function(){var t=e.facade;Ie?Kt.emit("rejectionHandled",t):ro(Jc,t,e.value)})},z=function(e,t,r){return function(n){e(t,n,r)}},J=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=Xc,to(e,!0))},Ct=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw zn("Promise can't be resolved itself");var n=Zn(t);n?Vt(function(){var o={done:!1};try{X(n,t,z(Ct,o,e),z(J,o,e))}catch(i){J(o,i,e)}}):(e.value=t,e.state=Jn,to(e,!1))}catch(o){J({done:!1},o,e)}}};if(Qn&&(L=function(t){Bc(this,$e),Uc(t),X(me,this);var r=dt(this);try{t(z(Ct,r),z(J,r))}catch(n){J(r,n)}},$e=L.prototype,me=function(t){Qc(this,{type:Ve,done:!1,notified:!1,parent:!1,reactions:new Wc,rejection:!1,state:Fr,value:void 0})},me.prototype=xr($e,"then",function(t,r){var n=dt(this),o=wt(Vc(this,L));return n.parent=!0,o.ok=Te(t)?t:!0,o.fail=Te(r)&&r,o.domain=Ie?Kt.domain:void 0,n.state==Fr?n.reactions.add(o):Vt(function(){eo(o,n)}),o.promise}),Ur=function(){var e=new me,t=dt(e);this.promise=e,this.resolve=z(Ct,t),this.reject=z(J,t)},Gn.f=wt=function(e){return e===L||e===Zc?new Ur(e):zc(e)},!xc&&Te(Re)&&G!==Object.prototype)){Mr=G.then,Gc||xr(G,"then",function(t,r){var n=this;return new L(function(o,i){X(Mr,n,o,i)}).then(t,r)},{unsafe:!0});try{delete G.constructor}catch(e){}kr&&kr(G,$e)}jc({global:!0,constructor:!0,wrap:!0,forced:Qn},{Promise:L});kc(L,Ve,!1,!0);Fc(Ve);var no={},ru=P,nu=no,ou=ru("iterator"),au=Array.prototype,iu=function(e){return e!==void 0&&(nu.Array===e||au[ou]===e)},su=Math.ceil,cu=Math.floor,uu=Math.trunc||function(t){var r=+t;return(r>0?cu:su)(r)},lu=uu,fu=function(e){var t=+e;return t!==t||t===0?0:lu(t)},vu=fu,du=Math.min,hu=function(e){return e>0?du(vu(e),9007199254740991):0},pu=hu,yu=function(e){return pu(e.length)},gu=Ft,Vr=Lt,bu=je,$u=no,mu=P,Su=mu("iterator"),oo=function(e){if(!bu(e))return Vr(e,Su)||Vr(e,"@@iterator")||$u[gu(e)]},Eu=O,Tu=U,_u=M,Ou=ke,Pu=oo,wu=TypeError,Cu=function(e,t){var r=arguments.length<2?Pu(e):t;if(Tu(r))return _u(Eu(r,e));throw wu(Ou(e)+" is not iterable")},Iu=O,Hr=M,Ru=Lt,Au=function(e,t,r){var n,o;Hr(e);try{if(n=Ru(e,"return"),!n){if(t==="throw")throw r;return r}n=Iu(n,e)}catch(i){o=!0,n=i}if(t==="throw")throw r;if(o)throw n;return Hr(n),r},Nu=Fe,Du=O,Lu=M,ju=ke,xu=iu,ku=yu,Kr=Dt,Fu=Cu,Uu=oo,Wr=Au,Mu=TypeError,_e=function(e,t){this.stopped=e,this.result=t},qr=_e.prototype,ao=function(e,t,r){var n=r&&r.that,o=!!(r&&r.AS_ENTRIES),i=!!(r&&r.IS_RECORD),c=!!(r&&r.IS_ITERATOR),v=!!(r&&r.INTERRUPTED),f=Nu(t,n),u,a,l,d,h,g,N,w=function(m){return u&&Wr(u,"normal",m),new _e(!0,m)},V=function(m){return o?(Lu(m),v?f(m[0],m[1],w):f(m[0],m[1])):v?f(m,w):f(m)};if(i)u=e.iterator;else if(c)u=e;else{if(a=Uu(e),!a)throw Mu(ju(e)+" is not iterable");if(xu(a)){for(l=0,d=ku(e);d>l;l++)if(h=V(e[l]),h&&Kr(qr,h))return h;return new _e(!1)}u=Fu(e,a)}for(g=i?e.next:u.next;!(N=Du(g,u)).done;){try{h=V(N.value)}catch(m){Wr(u,"throw",m)}if(typeof h=="object"&&h&&Kr(qr,h))return h}return new _e(!1)},Bu=P,io=Bu("iterator"),so=!1;try{var Vu=0,Gr={next:function(){return{done:!!Vu++}},return:function(){so=!0}};Gr[io]=function(){return this},Array.from(Gr,function(){throw 2})}catch(e){}var Hu=function(e,t){if(!t&&!so)return!1;var r=!1;try{var n={};n[io]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(o){}return r},Ku=te,Wu=Hu,qu=le.CONSTRUCTOR,co=qu||!Wu(function(e){Ku.all(e).then(void 0,function(){})}),Gu=B,Qu=O,zu=U,Yu=re,Ju=Bt,Xu=ao,Zu=co;Gu({target:"Promise",stat:!0,forced:Zu},{all:function(t){var r=this,n=Yu.f(r),o=n.resolve,i=n.reject,c=Ju(function(){var v=zu(r.resolve),f=[],u=0,a=1;Xu(t,function(l){var d=u++,h=!1;a++,Qu(v,r,l).then(function(g){h||(h=!0,f[d]=g,--a||o(f))},i)}),--a||o(f)});return c.error&&i(c.value),n.promise}});var el=B,tl=ce,rl=le.CONSTRUCTOR,It=te,nl=A,ol=y,al=xt,Qr=It&&It.prototype;el({target:"Promise",proto:!0,forced:rl,real:!0},{catch:function(e){return this.then(void 0,e)}});if(!tl&&ol(It)){var zr=nl("Promise").prototype.catch;Qr.catch!==zr&&al(Qr,"catch",zr,{unsafe:!0})}var il=B,sl=O,cl=U,ul=re,ll=Bt,fl=ao,vl=co;il({target:"Promise",stat:!0,forced:vl},{race:function(t){var r=this,n=ul.f(r),o=n.reject,i=ll(function(){var c=cl(r.resolve);fl(t,function(v){sl(c,r,v).then(n.resolve,o)})});return i.error&&o(i.value),n.promise}});var dl=B,hl=O,pl=re,yl=le.CONSTRUCTOR;dl({target:"Promise",stat:!0,forced:yl},{reject:function(t){var r=pl.f(this);return hl(r.reject,void 0,t),r.promise}});var gl=M,bl=F,$l=re,uo=function(e,t){if(gl(e),bl(t)&&t.constructor===e)return t;var r=$l.f(e),n=r.resolve;return n(t),r.promise},ml=B,Sl=A,lo=ce,El=te,fo=le.CONSTRUCTOR,Tl=uo,_l=Sl("Promise"),Ol=lo&&!fo;ml({target:"Promise",stat:!0,forced:lo||fo},{resolve:function(t){return Tl(Ol&&this===_l?El:this,t)}});var Pl=B,wl=ce,Ae=te,Cl=T,vo=A,ho=y,Il=xn,Yr=uo,Rl=xt,Rt=Ae&&Ae.prototype,Al=!!Ae&&Cl(function(){Rt.finally.call({then:function(){}},function(){})});Pl({target:"Promise",proto:!0,real:!0,forced:Al},{finally:function(e){var t=Il(this,vo("Promise")),r=ho(e);return this.then(r?function(n){return Yr(t,e()).then(function(){return n})}:e,r?function(n){return Yr(t,e()).then(function(){throw n})}:e)}});if(!wl&&ho(Ae)){var Jr=vo("Promise").prototype.finally;Rt.finally!==Jr&&Rl(Rt,"finally",Jr,{unsafe:!0})}var Nl=A,Dl=Nl,Ll=Dl,jl=Ll("Promise","finally"),xl=jl,kl=xl,Fl=kl,Ul=Fl,ht=Ul;function Ml(){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),t=new Array(36);let r=0,n,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?t[o]="-":o===14?t[o]="4":(r<=2&&(r=33554432+Math.random()*16777216|0),n=r&15,r=r>>4,t[o]=e[o===19?n&3|8:n]);return t.join("")}exports.ApiEnv=void 0;(function(e){e.PROD="prod",e.VK_ALIAS="vk_alias",e.VIDEOTEST="videotest",e.TEST="test",e.AUTO="auto"})(exports.ApiEnv||(exports.ApiEnv={}));exports.Quality=void 0;(function(e){e.Q144P="mobile",e.Q240P="lowest",e.Q360P="low",e.Q480P="medium",e.Q720P="high",e.Q1080P="fullhd",e.Q1440P="quadhd",e.Q2160P="ultrahd",e.UNKNOWN="unknown"})(exports.Quality||(exports.Quality={}));exports.ContentType=void 0;(function(e){e.MP4="mp4",e.DASH="dash",e.DASH_SEP="dash_sep",e.ONDEMAND_DASH="ondemand_dash",e.HLS="hls",e.ONDEMAND_HLS="ondemand_hls",e.WEBM="webm",e.ONDEMAND_DASH_LIVE="ondemand_dash_live",e.ONDEMAND_HLS_LIVE="ondemand_hls_live",e.WEBRTC="webrtc",e.UNKNOWN="unknown",e.RTMP="rtmp"})(exports.ContentType||(exports.ContentType={}));var Ne;(function(e){e.AUTO="auto",e.MANUAL=""})(Ne||(Ne={}));exports.ConnectionType=void 0;(function(e){e.HTTP1="http1",e.HTTP2="http2",e.HTTP3="http3"})(exports.ConnectionType||(exports.ConnectionType={}));var C;(function(e){e[e.YES=1]="YES",e[e.NO=0]="NO"})(C||(C={}));var Y;(function(e){e.EXCELLENT="excellent",e.GOOD="good",e.POOR="poor"})(Y||(Y={}));var x;(function(e){e.PIP="pip",e.FULLSCREEN="fullscreen",e.EXTERNAL="external",e.PREFETCH="prefetch"})(x||(x={}));exports.SeekAction=void 0;(function(e){e.SLIDER="slider",e.DOUBLE_TAP="double_tap",e.TIME_CODE="time_code",e.EPISODE="episode",e.REWIND="rewind",e.LIVE="live",e.UNKNOWN="unknown"})(exports.SeekAction||(exports.SeekAction={}));const At="1.0.35",Bl="CIOPGQJGDIHBABABA",po={[exports.ApiEnv.PROD]:"https://api.ok.ru",[exports.ApiEnv.VK_ALIAS]:"https://api.mycdn.me",[exports.ApiEnv.VIDEOTEST]:"https://videotestapi.ok.ru/api",[exports.ApiEnv.TEST]:"https://apitest.ok.ru",[exports.ApiEnv.AUTO]:""},Vl="_one-stat_",Xr=`${Vl}uuid`,Hl={start:1e3,factor:1.5,max:5*60*1e3,random:.1};var j;(function(e){e[e.PARAM_SESSION_EXPIRED=102]="PARAM_SESSION_EXPIRED",e[e.PARAM_SESSION_KEY=103]="PARAM_SESSION_KEY",e[e.PARAM_SIGNATURE=104]="PARAM_SIGNATURE",e[e.AUTH_LOGIN=401]="AUTH_LOGIN"})(j||(j={}));class Kl{constructor(t){this.consequentAuthErrors=0,this.authorized$=new s.ValueSubject(!1),this.params=t;const r=s.safeStorage.get(Xr);r?this.uuid=String(r):(this.uuid=Ml(),s.safeStorage.set(Xr,this.uuid))}authorize(t){return I(this,void 0,void 0,function*(){return this.authToken=t!=null?t:yield this.refreshAuthToken(),this._authorizeWithBackoff()})}logBeacon(t){const r="log.externalLog",n=this.createLogParams(t),o=this.sessionKey;if(!o)return;this.params.apiTransport.sendBeacon(r,n,o)||this.logRequest(t)}logRequest(t){var r;return I(this,void 0,void 0,function*(){const n="log.externalLog",o=this.createLogParams(t),i=(r=this.sessionKey)!==null&&r!==void 0?r:yield this._authorizeWithBackoff();if(!i)return;const c=(v,f=this.params.requestRetryCount)=>I(this,void 0,void 0,function*(){try{return yield this.params.apiTransport.sendRequest(n,o,i)}catch(u){if(!u||!("error_code"in u)){this.params.error$.next({id:"logRequestUnknown",category:s.ErrorCategory.NETWORK,message:`Unknown ${n} error`,thrown:u});return}const a=u==null?void 0:u.error_code;switch(a){case j.PARAM_SESSION_EXPIRED:case j.PARAM_SESSION_KEY:case j.PARAM_SIGNATURE:return this.authorized$.next(!1),this.sessionKey=yield this._authorizeWithBackoff(),f>0?c(v,f-1):void 0;case j.AUTH_LOGIN:return this.authorized$.next(!1),this.authToken=yield this.refreshAuthToken(),this.sessionKey=yield this._authorizeWithBackoff(),f>0?c(v,f-1):void 0;default:{this.params.error$.next({id:`LogRequest#${a}`,category:s.ErrorCategory.EXTERNAL_API,message:`${n} error`,data:u});return}}}});return c(t)})}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}refreshAuthToken(){return I(this,void 0,void 0,function*(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=ht(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise})}createLogParams(t){return{collector:"ok.mobile.apps.video",data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${At}`,platform:this.params.mobile?"M_WEB":"WEB",items:t})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();const t=s.getExponentialDelay(this.consequentAuthErrors,Hl);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{ht(this._authorize().then(r).catch(n=>this.params.error$.next({id:"AuthorizeBackoff",category:s.ErrorCategory.NETWORK,message:"Otherwise unhandled error in authorization",thrown:n})),()=>this.backoffTimeoutId=0)},t))})}_authorize(){return I(this,void 0,void 0,function*(){if(this.authorizePromise)return this.authorizePromise;this.sessionKey=void 0,this.authorized$.next(!1);const t="auth.anonymLogin",r={session_data:{version:2,device_id:this.uuid,client_version:At.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=ht(this.params.apiTransport.sendRequest(t,r).then(n=>{var o;return(!n||!n.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:s.ErrorCategory.EXTERNAL_API,message:"No session key",data:n}),this.sessionKey=(o=n==null?void 0:n.session_key)!==null&&o!==void 0?o:void 0,this.sessionKey}).catch(n=>I(this,void 0,void 0,function*(){this.sessionKey=void 0;const o=n==null?void 0:n.error_code;switch(o){case j.AUTH_LOGIN:return this.authToken=yield this.refreshAuthToken(),this._authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:s.ErrorCategory.EXTERNAL_API,message:"authorize error",data:n}):this.params.error$.next({id:"AuthorizeUnknown",category:s.ErrorCategory.NETWORK,message:"authorize error",thrown:n})})),()=>{this.authorizePromise=void 0,this.consequentAuthErrors=this.sessionKey?0:this.consequentAuthErrors+1,this.authorized$.next(this.sessionKey!==void 0)}),this.authorizePromise})}}class Zr{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(t,r,n){t in this.listeners||(this.listeners[t]=[]),this.listeners[t].push({callback:r,options:n})}removeEventListener(t,r){if(!(t in this.listeners))return;const n=this.listeners[t];for(let o=0,i=n.length;o<i;o++)if(n[o].callback===r){n.splice(o,1);return}}dispatchEvent(t){if(!(t.type in this.listeners))return;const n=this.listeners[t.type].slice();for(let o=0,i=n.length;o<i;o++){const c=n[o];try{c.callback.call(this,t)}catch(v){Promise.resolve().then(()=>{throw v})}c.options&&c.options.once&&this.removeEventListener(t.type,c.callback)}return!t.defaultPrevented}}class yo extends Zr{constructor(){super(),this.listeners||Zr.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(t){t.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,t)),super.dispatchEvent(t)}}class Wl{constructor(){Object.defineProperty(this,"signal",{value:new yo,writable:!0,configurable:!0})}abort(t){let r;try{r=new Event("abort")}catch(o){typeof document!="undefined"?document.createEvent?(r=document.createEvent("Event"),r.initEvent("abort",!1,!1)):(r=document.createEventObject(),r.type="abort"):r={type:"abort",bubbles:!1,cancelable:!1}}let n=t;if(n===void 0)if(typeof document=="undefined")n=new Error("This operation was aborted"),n.name="AbortError";else try{n=new DOMException("signal is aborted without reason")}catch(o){n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(r)}toString(){return"[object AbortController]"}}typeof Symbol!="undefined"&&Symbol.toStringTag&&(Wl.prototype[Symbol.toStringTag]="AbortController",yo.prototype[Symbol.toStringTag]="AbortSignal");function go(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function ql(e){typeof e=="function"&&(e={fetch:e});const{fetch:t,Request:r=t.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=e;if(!go({fetch:t,Request:r,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o}))return{fetch:t,Request:i};let i=r;(i&&!i.prototype.hasOwnProperty("signal")||o)&&(i=function(u,a){let l;a&&a.signal&&(l=a.signal,delete a.signal);const d=new r(u,a);return l&&Object.defineProperty(d,"signal",{writable:!1,enumerable:!1,configurable:!0,value:l}),d},i.prototype=r.prototype);const c=t;return{fetch:(f,u)=>{const a=i&&i.prototype.isPrototypeOf(f)?f.signal:u?u.signal:void 0;if(a){let l;try{l=new DOMException("Aborted","AbortError")}catch(h){l=new Error("Aborted"),l.name="AbortError"}if(a.aborted)return Promise.reject(l);const d=new Promise((h,g)=>{a.addEventListener("abort",()=>g(l),{once:!0})});return u&&u.signal&&delete u.signal,Promise.race([d,c(f,u)])}return c(f,u)},Request:i}}const qt=go({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),bo=qt?ql({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,en=qt?bo.fetch:window.fetch;qt?bo.Request:window.Request;class Gl{constructor(t){this.params=t,this.apiKey=t.apiKey,this.apiEnv=t.apiEnv,this.apiBaseUrl=t.apiBaseUrl,this.timeSynchronisation=t.timeSynchronisation,this.isApiBaseUrlFetched=!1}resolveApiBaseUrl(){var t;return I(this,void 0,void 0,function*(){if(this.apiEnv!==exports.ApiEnv.AUTO||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{const r=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=yield(yield en(r,{method:"GET",mode:"cors",cache:"no-cache"})).json(),i=(t=o==null?void 0:o.Answer[0])===null||t===void 0?void 0:t.data;if(!i)throw new Error("Wrong DNS response");return i}catch(r){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:s.ErrorCategory.NETWORK,message:"Unhandled resolve api base url error",thrown:r}),po[exports.ApiEnv.VK_ALIAS]}finally{this.isApiBaseUrlFetched=!0}})}sendBeacon(t,r,n){if(!window.Blob||!window.navigator.sendBeacon)return!1;const o=this._prepareQueryParams({method:t,queryParams:r,sessionKey:n}),i=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,i)}catch(c){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:s.ErrorCategory.NETWORK,message:"Unhandled beacon error",thrown:c,data:{method:t,params:r}})}return!1}sendRequest(t,r,n){return I(this,void 0,void 0,function*(){const o=s.now(),i=c=>{if(c instanceof TypeError&&["Failed to fetch","NetworkError when attempting to fetch resource."].includes(c.message)){this.params.error$.next({id:"Network",category:s.ErrorCategory.NETWORK,message:"Request failed",thrown:c});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:s.ErrorCategory.NETWORK,message:"Unhandled request error",thrown:c,data:{method:t,params:r,sessionKey:n,time:s.now()-o}})};return this.apiBaseUrl=yield this.resolveApiBaseUrl(),en(`${this.apiBaseUrl}/fb.do`,{method:"post",headers:{"Content-type":"application/x-www-form-urlencoded"},body:this._prepareQueryParams({method:t,queryParams:r,sessionKey:n})}).then(c=>{var v;const f=Number(c.headers.get("content-length"))===0,u=new Date((v=c.headers.get("date"))!==null&&v!==void 0?v:"").getTime(),a=s.now()-o;if(isFinite(u)&&this.timeSynchronisation.addServerTime(u,a),!f)return c.json().then(l=>Object.prototype.hasOwnProperty.call(l,"error_msg")?Promise.reject(l):l,i)},i)})}_prepareQueryParams(t){const r=new URLSearchParams({format:"JSON",method:t.method,application_key:this.apiKey});return t.sessionKey!==void 0&&r.append("session_key",t.sessionKey),Object.entries(t.queryParams).forEach(([n,o])=>r.append(n,typeof o=="string"?o:JSON.stringify(o))),r}}const tn=5e3,Ql=1e4,zl=6e4,Se="onestat_events",Yl=36*60*60*1e3,pt=e=>e.timestamp+Yl>=s.now();class Jl{constructor(t){this.unsaltedStorage=[],this.isPaused=!1,this.isUrgent=r=>{const{operation:n,custom:{param:o}}=r;return["action_stop","close_at_empty_buffer"].includes(n)||n==="watch_coverage_record"&&o==="0-0"},this.firstFlush=Gt(()=>this.safeFlush(),tn,{maxWait:tn}),this.debouncedFlush=Gt(()=>this.safeFlush(),Ql,{maxWait:zl}),this.api=t.api,this.error$=t.error$,this.userSalt=t.userSalt,this.subscription=this.api.authorized$.subscribe(r=>{r&&this.debouncedFlush()}),this.housekeepStorage()}safeFlush(){var t;try{this.flush()}catch(r){this.error$.next({id:"LoggerError",category:s.ErrorCategory.WTF,message:(t=String(r))!==null&&t!==void 0?t:"Unknown logger error",thrown:r})}}readFromStorage(){const t=s.safeStorage.get(Se);try{return t?JSON.parse(t):{}}catch(r){}return{}}addToStorage(t){var r;if(!this.userSalt){this.unsaltedStorage.push(t);return}const n=this.readFromStorage(),i=((r=n[this.userSalt])!==null&&r!==void 0?r:[]).filter(pt);s.safeStorage.set(Se,JSON.stringify(Object.assign(Object.assign({},n),{[this.userSalt]:[...i,t]})))}getFromStorage(){var t;return this.userSalt?((t=this.readFromStorage()[this.userSalt])!==null&&t!==void 0?t:[]).filter(pt):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}const t=this.readFromStorage();delete t[this.userSalt],s.safeStorage.set(Se,JSON.stringify(t))}housekeepStorage(){const t=this.readFromStorage();for(const[r,n]of Object.entries(t)){const o=n.filter(pt);o.length?t[r]=o:delete t[r]}s.safeStorage.set(Se,JSON.stringify(t))}log(t){this.addToStorage(t),!this.isPaused&&(this.isUrgent(t)?this.flush():this.lastVsid!==t.custom.vsid?this.firstFlush():this.debouncedFlush(),this.lastVsid=t.custom.vsid)}flush(t=!1){const r=this.getFromStorage();r.length!==0&&(this.api.authorized$.getValue()?(t?this.api.logBeacon(r):this.api.logRequest(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()}}const Xl=()=>{let e,t;try{e=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?e=!0:(e=!1,console.error(n))}try{window.location.ancestorOrigins&&(t=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!t&&document.referrer&&(t=document.referrer)}catch(n){console.error(n)}const r=t?new URL(t).hostname:void 0;return{isEmbed:e,host:r}},Zl=e=>e&&{[p.VideoQuality.INVARIANT]:exports.Quality.UNKNOWN,[p.VideoQuality.Q_144P]:exports.Quality.Q144P,[p.VideoQuality.Q_240P]:exports.Quality.Q240P,[p.VideoQuality.Q_360P]:exports.Quality.Q360P,[p.VideoQuality.Q_480P]:exports.Quality.Q480P,[p.VideoQuality.Q_720P]:exports.Quality.Q720P,[p.VideoQuality.Q_1080P]:exports.Quality.Q1080P,[p.VideoQuality.Q_1440P]:exports.Quality.Q1440P,[p.VideoQuality.Q_2160P]:exports.Quality.Q2160P,[p.VideoQuality.Q_4320P]:exports.Quality.UNKNOWN}[e],rn=e=>e&&{[p.HttpConnectionType.HTTP1]:exports.ConnectionType.HTTP1,[p.HttpConnectionType.HTTP2]:exports.ConnectionType.HTTP2,[p.HttpConnectionType.QUIC]:exports.ConnectionType.HTTP3}[e],ef=e=>{if(e!==void 0)switch(e){case p.VideoFormat.MPEG:return exports.ContentType.MP4;case p.VideoFormat.DASH:case p.VideoFormat.DASH_LIVE:return exports.ContentType.DASH;case p.VideoFormat.DASH_SEP:return exports.ContentType.DASH_SEP;case p.VideoFormat.DASH_ONDEMAND:return exports.ContentType.ONDEMAND_DASH;case p.VideoFormat.DASH_WEBM:case p.VideoFormat.DASH_WEBM_AV1:case p.VideoFormat.DASH_LIVE_WEBM:return exports.ContentType.WEBM;case p.VideoFormat.DASH_LIVE_CMAF:return exports.ContentType.ONDEMAND_DASH_LIVE;case p.VideoFormat.HLS:case p.VideoFormat.HLS_LIVE:return exports.ContentType.HLS;case p.VideoFormat.HLS_ONDEMAND:return exports.ContentType.ONDEMAND_HLS;case p.VideoFormat.HLS_LIVE_CMAF:return exports.ContentType.ONDEMAND_HLS_LIVE;case p.VideoFormat.WEB_RTC_LIVE:return exports.ContentType.WEBRTC;default:return s.assertNever(e)}},yt=e=>{if(e!==void 0)switch(e){case p.Surface.NONE:case p.Surface.INLINE:return;case p.Surface.FULLSCREEN:return x.FULLSCREEN;case p.Surface.SECOND_SCREEN:return x.EXTERNAL;case p.Surface.PIP:return x.PIP;default:return s.assertNever(e)}},tf=e=>{switch(e){case"slow-2g":return Y.POOR;case"2g":return Y.POOR;case"3g":return Y.GOOD;case"4g":return Y.EXCELLENT}};class rf{constructor(t){this.offset=void 0,this.offset=t}getOffset(){var t;return(t=this.offset)!==null&&t!==void 0?t:0}setOffset(t){this.offset=t}now(){var t;return Date.now()+((t=this.offset)!==null&&t!==void 0?t:0)}date(t=new Date){var r;return t.setTime(t.getTime()+((r=this.offset)!==null&&r!==void 0?r:0)),t}addServerTime(t,r){const n=Date.now(),o=t-n-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)}}const nn=()=>Math.floor(Math.random()*Math.pow(2,32)).toString(36).padStart(8,"0"),nf=e=>new s.Observable(t=>{const r=new s.Subscription,n=s.merge(s.fromEvent(window,"beforeunload"),e.events.willDestruct$),o=new s.ValueSubject(void 0);let i;e.info.isLive$.pipe(s.filterChanged()).subscribe(h=>{i&&(i.unsubscribe(),o.next(void 0)),h?i=e.info.liveTime$.pipe(s.map(g=>g&&g/1e3)).subscribe(o):i=e.info.position$.subscribe(o),r.add(i)});const{playing$:c,paused$:v}=e.events,f=e.events.willSeek$.pipe(s.filter(()=>e.info.playbackState$.getValue()===p.PlaybackState.PLAYING)),u=e.events.seeked$.pipe(s.filter(()=>e.info.playbackState$.getValue()===p.PlaybackState.PLAYING)),a=s.merge(c,u),l=s.merge(v,f,n,e.events.looped$);let d;return r.add(a.subscribe(()=>d=o.getValue())),r.add(l.subscribe(()=>{const h=o.getValue();s.isNullable(d)||d===h||s.isNullable(h)||(t.next({from:d,to:h}),d=void 0)})),r});class of{constructor(t,r){var n,o;this.subscription=new s.Subscription,this.timeSynchronisation=new rf,this.vsid=nn(),this.seekAction$=new s.ValueSubject(exports.SeekAction.UNKNOWN),this.statContext=t,this.config=Object.assign(Object.assign({},(n=r.config)!==null&&n!==void 0?n:{}),{requestRetryCount:1});const i=new s.Subject;this.experimental={error$:i};const c=new Gl({apiKey:Bl,apiBaseUrl:po[r.apiEnv],apiEnv:r.apiEnv,error$:i,timeSynchronisation:this.timeSynchronisation});this.api=new Kl({apiTransport:c,refreshAuthToken:r.refreshAuthToken,requestRetryCount:this.config.requestRetryCount,mobile:(o=this.statContext.mobile)!==null&&o!==void 0?o:!1,error$:i}),this.logger=new Jl({api:this.api,error$:i,userSalt:r.userSalt});const{isEmbed:v,host:f}=Xl();this.isEmbed=v,this.embedParent=f,this.subscribe()}updateContext(t){this.statContext=Object.assign(Object.assign({},this.statContext),t)}attachTo(t){const r=new s.Subscription,n=(a,l)=>r.add(a.subscribe(l));n(t.events.willStart$,()=>{this.logActionPlay({position:t.info.position$.getValue()})}),n(t.events.looped$,()=>{this.resetViewSession(),this.logActionPlay({position:t.info.position$.getValue()})}),n(t.events.seeked$,()=>{this.logSeek({action:this.seekAction$.getValue(),time:t.info.position$.getValue()}),this.seekAction$.next(exports.SeekAction.UNKNOWN)}),n(t.events.paused$,()=>{this.logPause({position:t.info.position$.getValue()})}),n(t.events.willResume$,()=>{this.logPlay()}),n(t.events.started$,()=>{this.statContext.clip&&this.logWatchCoverageRecord({start:0,end:0})}),n(nf(t),a=>{const l=t.info.isLive$.getValue(),d={start:parseFloat(a.from.toFixed(3)),end:parseFloat(a.to.toFixed(3))};l?this.logWatchCoverageLive(d):this.logWatchCoverageRecord(d)});let o;n(t.info.isStalled$,a=>{a?o=s.now():(s.isNonNullable(o)&&this.logEmptyBuffer({duration:s.now()-o}),o=void 0)});let i=!1;r.add(t.events.fatalError$.pipe(s.once()).subscribe(()=>i=!0)),n(t.events.willStop$,()=>{if(t.info.isStalled$.getValue()){const l=s.isNonNullable(o)?s.now()-o:void 0;this.logCloseAtEmptyBuffer({duration:l!=null?l:0}),o=void 0}else i||this.logActionStop()}),n(t.events.managedError$,({id:a})=>{this.logError({fatal:!1,errorType:a})}),n(t.events.fatalError$,({id:a})=>{this.logError({fatal:!0,errorType:a})});let c,v,f=!1;n(t.events.firstBytes$,a=>{c=s.now(),this.logFirstBytes({time:a})}),n(t.events.willStart$,()=>v=s.now()),n(t.info.currentBuffer$,a=>{!f&&a&&a.end-a.start>0&&s.isNonNullable(c)&&(this.logPlayerReady({duration:s.now()-c}),f=!0)}),n(t.events.firstFrame$,()=>{s.isNonNullable(c)&&!f&&(this.logPlayerReady({duration:s.now()-c}),f=!0),s.isNonNullable(v)&&this.logFirstFrame({time:s.now()-v})}),n(t.info.atLiveEdge$,a=>this.updateContext({liveEdge:a})),n(s.combine({muted:t.info.muted$,volume:t.info.volume$}),({muted:a,volume:l})=>this.updateContext({audible:!a&&l>0})),n(t.info.currentQuality$,a=>this.updateContext({quality:Zl(a)})),n(t.info.isAutoQualityEnabled$,a=>this.updateContext({autoQuality:a})),n(t.info.currentFormat$,a=>this.updateContext({contentType:ef(a)}));let u;return n(t.info.hostname$,a=>{this.updateContext({cdnHostname:a,failover:u!==void 0&&u!==a}),u=a}),n(t.info.throughputEstimation$,a=>this.updateContext({downloadSpeed:a})),n(t.info.httpConnectionType$,a=>{this.statContext.firstConnectionType||this.updateContext({firstConnectionType:rn(a)}),this.updateContext({connectionType:rn(a)})}),n(t.info.httpConnectionReused$,a=>{s.isNullable(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:a}),this.updateContext({connectionReused:a})}),n(t.info.surface$,a=>this.updateContext({mode:yt(a)})),n(s.combine({current:t.info.currentTextTrack$,available:t.info.availableTextTracks$}),({current:a,available:l})=>{const d=l.find(({id:h})=>h===a);this.updateContext({subtitles:d==null?void 0:d.language})}),this.player=t,this.uiEvents&&this.attachToUi(this.uiEvents),this.subscription.add(r),r}attachToUi(t){this.uiEvents=t;const r=new s.Subscription;return this.player&&(r.add(t.actionRewind$.subscribe(()=>{this.player&&(this.resetViewSession(),this.logActionPlay({position:this.player.info.position$.getValue()}))})),r.add(t.actionSeek$.subscribe(this.seekAction$)),r.add(t.inPiP$.subscribe(n=>{var o;const i=n?x.PIP:yt((o=this.player)===null||o===void 0?void 0:o.info.surface$.getValue());this.updateContext({mode:i})})),r.add(t.inFullscreen$.subscribe(n=>{var o;const i=n?x.FULLSCREEN:yt((o=this.player)===null||o===void 0?void 0:o.info.surface$.getValue());this.updateContext({mode:i})})),r.add(t.actionSetSubtitle$.subscribe(n=>{this.updateContext({subtitles:n})})),this.subscription.add(r)),r}attachToAds(t){const r=new s.Subscription;return r.add(t.slotRequested$.subscribe(()=>this.logAdSlotRequest())).add(t.started$.subscribe(n=>this.logAdStarted(n))).add(t.paused$.subscribe(()=>this.logAdPaused())).add(t.resumed$.subscribe(()=>this.logAdResumed())).add(t.ended$.subscribe(()=>this.logAdEnded())).add(t.skipped$.subscribe(()=>this.logAdSkipped())).add(t.clicked$.subscribe(()=>this.logAdClicked())),this.subscription.add(r),r}authorize(t){return this.api.authorize(t)}pause(){this.logger.pause()}resume(){this.logger.resume()}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.vsid=nn()}setFieldBlacklist(){}logInited(){}logReady(t){this.log({operation:"player_ready",param:String(t.time)})}logStarted(...t){this.logActionPlay(...t)}logPlay(){this.log({operation:"play_toggle"})}logPause(t){this.log({operation:"pause",param:String(Math.round(t.position))})}logSeek(t){this.log({operation:"seek",param:t.action,time:t.time})}logFirstBytes(t){this.log({operation:"first_bytes",param:String(t.time)})}logFirstFrame(t){this.log({operation:"first_frame",param:String(t.time)})}logError(t){this.log({operation:"content_error",param:`${t.fatal?"fatal":"recoverable"}_${t.errorType}`})}logWatchCoverageRecord(t){this.log({operation:"watch_coverage_record",param:`${t.start}-${t.end}`})}logWatchCoverageLive(t){const r=t.start+this.timeSynchronisation.getOffset(),n=t.end+this.timeSynchronisation.getOffset();this.log({operation:"watch_coverage_live",param:`${r}-${n}`})}logEmptyBuffer(t){this.log({operation:"empty_buffer",param:String(t.duration)})}logDownloadSpeed(){}logAdSlotRequest(){this.log({operation:"adv",param:"slot_request"})}logAdStarted(t){this.log({operation:"adv",param:t})}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"})}subscribe(){this.subscription.add(s.fromEvent(window,"beforeunload").subscribe(()=>this.logger.flush(!0)));const t=window.navigator.connection;t&&"onchange"in t&&"effectiveType"in t&&this.subscription.add(s.merge(s.fromEvent(t,"change"),s.observableFrom(["init"])).subscribe(()=>this.updateContext({network:tf(t.effectiveType)})))}logPlayerReady(t){this.log({operation:"player_ready",param:String(Math.round(t.duration))})}logActionPlay(t){this.log({operation:"action_play",param:String(Math.round(t.position))})}logCloseAtEmptyBuffer(t){this.log({operation:"close_at_empty_buffer",param:String(Math.round(t.duration))})}logActionStop(){this.log({operation:"action_stop"})}log(t){const r=this.createLogItem(t);this.logger.log(r)}createLogItem({operation:t,param:r,time:n}){const o=this.timeSynchronisation.now(),i=t==="empty_buffer"||t==="close_at_empty_buffer"?this.statContext.connectionType:this.statContext.firstConnectionType,c=this.statContext.firstConnectionReused,v={vsid:this.vsid,vid:this.statContext.movieId,ct:this.statContext.contentType,place:this.isEmbed?"embed":this.statContext.place,quality:this.statContext.quality,cdn_host:this.statContext.cdnHostname,stat_type:this.statContext.autoplay===!0?Ne.AUTO:this.statContext.autoplay===!1?Ne.MANUAL:void 0,param:r,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode,connection_type:i,connection_reused:c===!0?C.YES:c===!1?C.NO:void 0,cached_data:this.statContext.cached===!0?C.YES:this.statContext.cached===!1?C.NO:void 0,live:this.statContext.liveEdge?C.YES:void 0,muted:this.statContext.audible===!1?C.YES:void 0,mode:this.statContext.mode,subtitles:this.statContext.subtitles,download_speed:this.statContext.downloadSpeed,manual_quality:this.statContext.autoQuality?void 0:C.YES,ref_domain:this.embedParent,aid:this.statContext.albumId,vk_playlist_id:this.statContext.vkPlaylistId};return{operation:t,type:1,time:n,network:this.statContext.network,timestamp:o,custom:v}}}exports.OneStat=of;exports.VERSION=At;
6
+ "use strict";var s=require("@vkontakte/videoplayer-shared/es2015.cjs.js"),Gt=require("lodash/debounce.js"),p=require("@vkontakte/videoplayer-core/es2015.cjs.js");function I(e,t,r,n){function o(i){return i instanceof r?i:new r(function(c){c(i)})}return new(r||(r=Promise))(function(i,c){function v(a){try{u(n.next(a))}catch(l){c(l)}}function f(a){try{u(n.throw(a))}catch(l){c(l)}}function u(a){a.done?i(a.value):o(a.value).then(v,f)}u((n=n.apply(e,t||[])).next())})}var Qt=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},fe=function(e){return e&&e.Math==Math&&e},b=fe(typeof globalThis=="object"&&globalThis)||fe(typeof window=="object"&&window)||fe(typeof self=="object"&&self)||fe(typeof Qt=="object"&&Qt)||function(){return this}()||Function("return this")(),T=function(e){try{return!!e()}catch(t){return!0}},$o=T,De=!$o(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),mo=De,on=Function.prototype,zt=on.apply,Yt=on.call,an=typeof Reflect=="object"&&Reflect.apply||(mo?Yt.bind(zt):function(){return Yt.apply(zt,arguments)}),sn=De,cn=Function.prototype,gt=cn.call,So=sn&&cn.bind.bind(gt,gt),_=sn?So:function(e){return function(){return gt.apply(e,arguments)}},un=_,Eo=un({}.toString),To=un("".slice),Le=function(e){return To(Eo(e),8,-1)},_o=Le,Oo=_,ln=function(e){if(_o(e)==="Function")return Oo(e)},bt=typeof document=="object"&&document.all,Po=typeof bt=="undefined"&&bt!==void 0,fn={all:bt,IS_HTMLDDA:Po},vn=fn,wo=vn.all,y=vn.IS_HTMLDDA?function(e){return typeof e=="function"||e===wo}:function(e){return typeof e=="function"},Nt={},Co=T,Z=!Co(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),Io=De,ve=Function.prototype.call,O=Io?ve.bind(ve):function(){return ve.apply(ve,arguments)},dn={},hn={}.propertyIsEnumerable,pn=Object.getOwnPropertyDescriptor,Ro=pn&&!hn.call({1:2},1);dn.f=Ro?function(t){var r=pn(this,t);return!!r&&r.enumerable}:hn;var yn=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},Ao=_,No=T,Do=Le,He=Object,Lo=Ao("".split),jo=No(function(){return!He("z").propertyIsEnumerable(0)})?function(e){return Do(e)=="String"?Lo(e,""):He(e)}:He,je=function(e){return e==null},xo=je,ko=TypeError,gn=function(e){if(xo(e))throw ko("Can't call method on "+e);return e},Fo=jo,Uo=gn,Mo=function(e){return Fo(Uo(e))},Jt=y,bn=fn,Bo=bn.all,F=bn.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:Jt(e)||e===Bo}:function(e){return typeof e=="object"?e!==null:Jt(e)},$n={},Ke=$n,We=b,Vo=y,Xt=function(e){return Vo(e)?e:void 0},A=function(e,t){return arguments.length<2?Xt(Ke[e])||Xt(We[e]):Ke[e]&&Ke[e][t]||We[e]&&We[e][t]},Ho=_,Dt=Ho({}.isPrototypeOf),xe=typeof navigator!="undefined"&&String(navigator.userAgent)||"",mn=b,qe=xe,Zt=mn.process,er=mn.Deno,tr=Zt&&Zt.versions||er&&er.version,rr=tr&&tr.v8,S,Oe;rr&&(S=rr.split("."),Oe=S[0]>0&&S[0]<4?1:+(S[0]+S[1]));!Oe&&qe&&(S=qe.match(/Edge\/(\d+)/),(!S||S[1]>=74)&&(S=qe.match(/Chrome\/(\d+)/),S&&(Oe=+S[1])));var Sn=Oe,nr=Sn,Ko=T,En=!!Object.getOwnPropertySymbols&&!Ko(function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&nr&&nr<41}),Wo=En,Tn=Wo&&!Symbol.sham&&typeof Symbol.iterator=="symbol",qo=A,Go=y,Qo=Dt,zo=Tn,Yo=Object,_n=zo?function(e){return typeof e=="symbol"}:function(e){var t=qo("Symbol");return Go(t)&&Qo(t.prototype,Yo(e))},Jo=String,ke=function(e){try{return Jo(e)}catch(t){return"Object"}},Xo=y,Zo=ke,ea=TypeError,U=function(e){if(Xo(e))return e;throw ea(Zo(e)+" is not a function")},ta=U,ra=je,Lt=function(e,t){var r=e[t];return ra(r)?void 0:ta(r)},Ge=O,Qe=y,ze=F,na=TypeError,oa=function(e,t){var r,n;if(t==="string"&&Qe(r=e.toString)&&!ze(n=Ge(r,e))||Qe(r=e.valueOf)&&!ze(n=Ge(r,e))||t!=="string"&&Qe(r=e.toString)&&!ze(n=Ge(r,e)))return n;throw na("Can't convert object to primitive value")},Pe={},aa={get exports(){return Pe},set exports(e){Pe=e}},ce=!0,or=b,ia=Object.defineProperty,sa=function(e,t){try{ia(or,e,{value:t,configurable:!0,writable:!0})}catch(r){or[e]=t}return t},ca=b,ua=sa,ar="__core-js_shared__",la=ca[ar]||ua(ar,{}),jt=la,ir=jt;(aa.exports=function(e,t){return ir[e]||(ir[e]=t!==void 0?t:{})})("versions",[]).push({version:"3.27.2",mode:"pure",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.27.2/LICENSE",source:"https://github.com/zloirock/core-js"});var fa=gn,va=Object,da=function(e){return va(fa(e))},ha=_,pa=da,ya=ha({}.hasOwnProperty),ee=Object.hasOwn||function(t,r){return ya(pa(t),r)},ga=_,ba=0,$a=Math.random(),ma=ga(1 .toString),On=function(e){return"Symbol("+(e===void 0?"":e)+")_"+ma(++ba+$a,36)},Sa=b,Ea=Pe,sr=ee,Ta=On,_a=En,Oa=Tn,Q=Sa.Symbol,Ye=Ea("wks"),Pa=Oa?Q.for||Q:Q&&Q.withoutSetter||Ta,P=function(e){return sr(Ye,e)||(Ye[e]=_a&&sr(Q,e)?Q[e]:Pa("Symbol."+e)),Ye[e]},wa=O,cr=F,ur=_n,Ca=Lt,Ia=oa,Ra=P,Aa=TypeError,Na=Ra("toPrimitive"),Da=function(e,t){if(!cr(e)||ur(e))return e;var r=Ca(e,Na),n;if(r){if(t===void 0&&(t="default"),n=wa(r,e,t),!cr(n)||ur(n))return n;throw Aa("Can't convert object to primitive value")}return t===void 0&&(t="number"),Ia(e,t)},La=Da,ja=_n,Pn=function(e){var t=La(e,"string");return ja(t)?t:t+""},xa=b,lr=F,$t=xa.document,ka=lr($t)&&lr($t.createElement),wn=function(e){return ka?$t.createElement(e):{}},Fa=Z,Ua=T,Ma=wn,Cn=!Fa&&!Ua(function(){return Object.defineProperty(Ma("div"),"a",{get:function(){return 7}}).a!=7}),Ba=Z,Va=O,Ha=dn,Ka=yn,Wa=Mo,qa=Pn,Ga=ee,Qa=Cn,fr=Object.getOwnPropertyDescriptor;Nt.f=Ba?fr:function(t,r){if(t=Wa(t),r=qa(r),Qa)try{return fr(t,r)}catch(n){}if(Ga(t,r))return Ka(!Va(Ha.f,t,r),t[r])};var za=T,Ya=y,Ja=/#|\.prototype\./,ue=function(e,t){var r=Za[Xa(e)];return r==ti?!0:r==ei?!1:Ya(t)?za(t):!!t},Xa=ue.normalize=function(e){return String(e).replace(Ja,".").toLowerCase()},Za=ue.data={},ei=ue.NATIVE="N",ti=ue.POLYFILL="P",In=ue,vr=ln,ri=U,ni=De,oi=vr(vr.bind),Fe=function(e,t){return ri(e),t===void 0?e:ni?oi(e,t):function(){return e.apply(t,arguments)}},Ue={},ai=Z,ii=T,si=ai&&ii(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),ci=F,ui=String,li=TypeError,M=function(e){if(ci(e))return e;throw li(ui(e)+" is not an object")},fi=Z,vi=Cn,di=si,de=M,dr=Pn,hi=TypeError,Je=Object.defineProperty,pi=Object.getOwnPropertyDescriptor,Xe="enumerable",Ze="configurable",et="writable";Ue.f=fi?di?function(t,r,n){if(de(t),r=dr(r),de(n),typeof t=="function"&&r==="prototype"&&"value"in n&&et in n&&!n[et]){var o=pi(t,r);o&&o[et]&&(t[r]=n.value,n={configurable:Ze in n?n[Ze]:o[Ze],enumerable:Xe in n?n[Xe]:o[Xe],writable:!1})}return Je(t,r,n)}:Je:function(t,r,n){if(de(t),r=dr(r),de(n),vi)try{return Je(t,r,n)}catch(o){}if("get"in n||"set"in n)throw hi("Accessors not supported");return"value"in n&&(t[r]=n.value),t};var yi=Z,gi=Ue,bi=yn,Me=yi?function(e,t,r){return gi.f(e,t,bi(1,r))}:function(e,t,r){return e[t]=r,e},he=b,$i=an,mi=ln,Si=y,Ei=Nt.f,Ti=In,H=$n,_i=Fe,K=Me,hr=ee,Oi=function(e){var t=function(r,n,o){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,o)}return $i(e,this,arguments)};return t.prototype=e.prototype,t},B=function(e,t){var r=e.target,n=e.global,o=e.stat,i=e.proto,c=n?he:o?he[r]:(he[r]||{}).prototype,v=n?H:H[r]||K(H,r,{})[r],f=v.prototype,u,a,l,d,h,g,N,w,V;for(d in t)u=Ti(n?d:r+(o?".":"#")+d,e.forced),a=!u&&c&&hr(c,d),g=v[d],a&&(e.dontCallGetSet?(V=Ei(c,d),N=V&&V.value):N=c[d]),h=a&&N?N:t[d],!(a&&typeof g==typeof h)&&(e.bind&&a?w=_i(h,he):e.wrap&&a?w=Oi(h):i&&Si(h)?w=mi(h):w=h,(e.sham||h&&h.sham||g&&g.sham)&&K(w,"sham",!0),K(v,d,w),i&&(l=r+"Prototype",hr(H,l)||K(H,l,{}),K(H[l],d,h),e.real&&f&&(u||!f[d])&&K(f,d,h)))},Pi=Le,Be=typeof process!="undefined"&&Pi(process)=="process",wi=Me,xt=function(e,t,r,n){return n&&n.enumerable?e[t]=r:wi(e,t,r),e},Ci=y,Ii=String,Ri=TypeError,Ai=function(e){if(typeof e=="object"||Ci(e))return e;throw Ri("Can't set "+Ii(e)+" as a prototype")},Ni=_,Di=M,Li=Ai,ji=Object.setPrototypeOf||("__proto__"in{}?function(){var e=!1,t={},r;try{r=Ni(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),r(t,[]),e=t instanceof Array}catch(n){}return function(o,i){return Di(o),Li(i),e?r(o,i):o.__proto__=i,o}}():void 0),xi=P,ki=xi("toStringTag"),Rn={};Rn[ki]="z";var kt=String(Rn)==="[object z]",Fi=kt,Ui=y,Ee=Le,Mi=P,Bi=Mi("toStringTag"),Vi=Object,Hi=Ee(function(){return arguments}())=="Arguments",Ki=function(e,t){try{return e[t]}catch(r){}},Ft=Fi?Ee:function(e){var t,r,n;return e===void 0?"Undefined":e===null?"Null":typeof(r=Ki(t=Vi(e),Bi))=="string"?r:Hi?Ee(t):(n=Ee(t))=="Object"&&Ui(t.callee)?"Arguments":n},Wi=kt,qi=Ft,Gi=Wi?{}.toString:function(){return"[object "+qi(this)+"]"},Qi=kt,zi=Ue.f,Yi=Me,Ji=ee,Xi=Gi,Zi=P,pr=Zi("toStringTag"),es=function(e,t,r,n){if(e){var o=r?e:e.prototype;Ji(o,pr)||zi(o,pr,{configurable:!0,value:t}),n&&!Qi&&Yi(o,"toString",Xi)}},ts=A,rs=Ue,ns=P,os=Z,yr=ns("species"),as=function(e){var t=ts(e),r=rs.f;os&&t&&!t[yr]&&r(t,yr,{configurable:!0,get:function(){return this}})},is=Dt,ss=TypeError,cs=function(e,t){if(is(t,e))return e;throw ss("Incorrect invocation")},us=_,ls=y,mt=jt,fs=us(Function.toString);ls(mt.inspectSource)||(mt.inspectSource=function(e){return fs(e)});var An=mt.inspectSource,vs=_,ds=T,Nn=y,hs=Ft,ps=A,ys=An,Dn=function(){},gs=[],Ln=ps("Reflect","construct"),Ut=/^\s*(?:class|function)\b/,bs=vs(Ut.exec),$s=!Ut.exec(Dn),ne=function(t){if(!Nn(t))return!1;try{return Ln(Dn,gs,t),!0}catch(r){return!1}},jn=function(t){if(!Nn(t))return!1;switch(hs(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return $s||!!bs(Ut,ys(t))}catch(r){return!0}};jn.sham=!0;var ms=!Ln||ds(function(){var e;return ne(ne.call)||!ne(Object)||!ne(function(){e=!0})||e})?jn:ne,Ss=ms,Es=ke,Ts=TypeError,_s=function(e){if(Ss(e))return e;throw Ts(Es(e)+" is not a constructor")},gr=M,Os=_s,Ps=je,ws=P,Cs=ws("species"),xn=function(e,t){var r=gr(e).constructor,n;return r===void 0||Ps(n=gr(r)[Cs])?t:Os(n)},Is=A,Rs=Is("document","documentElement"),As=_,Ns=As([].slice),Ds=TypeError,Ls=function(e,t){if(e<t)throw Ds("Not enough arguments");return e},js=xe,kn=/(?:ipad|iphone|ipod).*applewebkit/i.test(js),$=b,xs=an,ks=Fe,br=y,Fs=ee,Fn=T,$r=Rs,Us=Ns,mr=wn,Ms=Ls,Bs=kn,Vs=Be,St=$.setImmediate,Et=$.clearImmediate,Hs=$.process,tt=$.Dispatch,Ks=$.Function,Sr=$.MessageChannel,Ws=$.String,rt=0,oe={},Er="onreadystatechange",ie,D,nt,ot;Fn(function(){ie=$.location});var Mt=function(e){if(Fs(oe,e)){var t=oe[e];delete oe[e],t()}},at=function(e){return function(){Mt(e)}},Tr=function(e){Mt(e.data)},_r=function(e){$.postMessage(Ws(e),ie.protocol+"//"+ie.host)};(!St||!Et)&&(St=function(t){Ms(arguments.length,1);var r=br(t)?t:Ks(t),n=Us(arguments,1);return oe[++rt]=function(){xs(r,void 0,n)},D(rt),rt},Et=function(t){delete oe[t]},Vs?D=function(e){Hs.nextTick(at(e))}:tt&&tt.now?D=function(e){tt.now(at(e))}:Sr&&!Bs?(nt=new Sr,ot=nt.port2,nt.port1.onmessage=Tr,D=ks(ot.postMessage,ot)):$.addEventListener&&br($.postMessage)&&!$.importScripts&&ie&&ie.protocol!=="file:"&&!Fn(_r)?(D=_r,$.addEventListener("message",Tr,!1)):Er in mr("script")?D=function(e){$r.appendChild(mr("script"))[Er]=function(){$r.removeChild(this),Mt(e)}}:D=function(e){setTimeout(at(e),0)});var Un={set:St,clear:Et},Mn=function(){this.head=null,this.tail=null};Mn.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e){var t=this.head=e.next;return t===null&&(this.tail=null),e.item}}};var Bn=Mn,qs=xe,Gs=/ipad|iphone|ipod/i.test(qs)&&typeof Pebble!="undefined",Qs=xe,zs=/web0s(?!.*chrome)/i.test(Qs),k=b,Or=Fe,Ys=Nt.f,it=Un.set,Js=Bn,Xs=kn,Zs=Gs,ec=zs,st=Be,Pr=k.MutationObserver||k.WebKitMutationObserver,wr=k.document,Cr=k.process,pe=k.Promise,Ir=Ys(k,"queueMicrotask"),Tt=Ir&&Ir.value,W,ct,ut,ye,Rr;if(!Tt){var ge=new Js,be=function(){var e,t;for(st&&(e=Cr.domain)&&e.exit();t=ge.get();)try{t()}catch(r){throw ge.head&&W(),r}e&&e.enter()};!Xs&&!st&&!ec&&Pr&&wr?(ct=!0,ut=wr.createTextNode(""),new Pr(be).observe(ut,{characterData:!0}),W=function(){ut.data=ct=!ct}):!Zs&&pe&&pe.resolve?(ye=pe.resolve(void 0),ye.constructor=pe,Rr=Or(ye.then,ye),W=function(){Rr(be)}):st?W=function(){Cr.nextTick(be)}:(it=Or(it,k),W=function(){it(be)}),Tt=function(e){ge.head||W(),ge.add(e)}}var tc=Tt,rc=function(e,t){try{arguments.length==1?console.error(e):console.error(e,t)}catch(r){}},Bt=function(e){try{return{error:!1,value:e()}}catch(t){return{error:!0,value:t}}},nc=b,oc=y,Ar=nc.WeakMap,ac=oc(Ar)&&/native code/.test(String(Ar)),ic=Pe,sc=On,Nr=ic("keys"),cc=function(e){return Nr[e]||(Nr[e]=sc(e))},uc={},lc=ac,Vn=b,fc=F,vc=Me,lt=ee,ft=jt,dc=cc,hc=uc,Dr="Object already initialized",_t=Vn.TypeError,pc=Vn.WeakMap,we,se,Ce,yc=function(e){return Ce(e)?se(e):we(e,{})},gc=function(e){return function(t){var r;if(!fc(t)||(r=se(t)).type!==e)throw _t("Incompatible receiver, "+e+" required");return r}};if(lc||ft.state){var E=ft.state||(ft.state=new pc);E.get=E.get,E.has=E.has,E.set=E.set,we=function(e,t){if(E.has(e))throw _t(Dr);return t.facade=e,E.set(e,t),t},se=function(e){return E.get(e)||{}},Ce=function(e){return E.has(e)}}else{var q=dc("state");hc[q]=!0,we=function(e,t){if(lt(e,q))throw _t(Dr);return t.facade=e,vc(e,q,t),t},se=function(e){return lt(e,q)?e[q]:{}},Ce=function(e){return lt(e,q)}}var bc={set:we,get:se,has:Ce,enforce:yc,getterFor:gc},$c=b,te=$c.Promise,Hn=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",mc=Hn,Sc=Be,Ec=!mc&&!Sc&&typeof window=="object"&&typeof document=="object",Tc=b,ae=te,_c=y,Oc=In,Pc=An,wc=P,Cc=Ec,Ic=Hn,Rc=ce,vt=Sn,Lr=ae&&ae.prototype,Ac=wc("species"),Ot=!1,Kn=_c(Tc.PromiseRejectionEvent),Nc=Oc("Promise",function(){var e=Pc(ae),t=e!==String(ae);if(!t&&vt===66||Rc&&!(Lr.catch&&Lr.finally))return!0;if(!vt||vt<51||!/native code/.test(e)){var r=new ae(function(i){i(1)}),n=function(i){i(function(){},function(){})},o=r.constructor={};if(o[Ac]=n,Ot=r.then(function(){})instanceof n,!Ot)return!0}return!t&&(Cc||Ic)&&!Kn}),le={CONSTRUCTOR:Nc,REJECTION_EVENT:Kn,SUBCLASSING:Ot},re={},jr=U,Dc=TypeError,Lc=function(e){var t,r;this.promise=new e(function(n,o){if(t!==void 0||r!==void 0)throw Dc("Bad Promise constructor");t=n,r=o}),this.resolve=jr(t),this.reject=jr(r)};re.f=function(e){return new Lc(e)};var jc=B,xc=ce,Ie=Be,R=b,X=O,xr=xt,kr=ji,kc=es,Fc=as,Uc=U,Te=y,Mc=F,Bc=cs,Vc=xn,Wn=Un.set,Vt=tc,Hc=rc,Kc=Bt,Wc=Bn,qn=bc,Re=te,Ht=le,Gn=re,Ve="Promise",Qn=Ht.CONSTRUCTOR,qc=Ht.REJECTION_EVENT,Gc=Ht.SUBCLASSING,dt=qn.getterFor(Ve),Qc=qn.set,G=Re&&Re.prototype,L=Re,$e=G,zn=R.TypeError,Pt=R.document,Kt=R.process,wt=Gn.f,zc=wt,Yc=!!(Pt&&Pt.createEvent&&R.dispatchEvent),Yn="unhandledrejection",Jc="rejectionhandled",Fr=0,Jn=1,Xc=2,Wt=1,Xn=2,me,Ur,Zc,Mr,Zn=function(e){var t;return Mc(e)&&Te(t=e.then)?t:!1},eo=function(e,t){var r=t.value,n=t.state==Jn,o=n?e.ok:e.fail,i=e.resolve,c=e.reject,v=e.domain,f,u,a;try{o?(n||(t.rejection===Xn&&tu(t),t.rejection=Wt),o===!0?f=r:(v&&v.enter(),f=o(r),v&&(v.exit(),a=!0)),f===e.promise?c(zn("Promise-chain cycle")):(u=Zn(f))?X(u,f,i,c):i(f)):c(r)}catch(l){v&&!a&&v.exit(),c(l)}},to=function(e,t){e.notified||(e.notified=!0,Vt(function(){for(var r=e.reactions,n;n=r.get();)eo(n,e);e.notified=!1,t&&!e.rejection&&eu(e)}))},ro=function(e,t,r){var n,o;Yc?(n=Pt.createEvent("Event"),n.promise=t,n.reason=r,n.initEvent(e,!1,!0),R.dispatchEvent(n)):n={promise:t,reason:r},!qc&&(o=R["on"+e])?o(n):e===Yn&&Hc("Unhandled promise rejection",r)},eu=function(e){X(Wn,R,function(){var t=e.facade,r=e.value,n=Br(e),o;if(n&&(o=Kc(function(){Ie?Kt.emit("unhandledRejection",r,t):ro(Yn,t,r)}),e.rejection=Ie||Br(e)?Xn:Wt,o.error))throw o.value})},Br=function(e){return e.rejection!==Wt&&!e.parent},tu=function(e){X(Wn,R,function(){var t=e.facade;Ie?Kt.emit("rejectionHandled",t):ro(Jc,t,e.value)})},z=function(e,t,r){return function(n){e(t,n,r)}},J=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=Xc,to(e,!0))},Ct=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw zn("Promise can't be resolved itself");var n=Zn(t);n?Vt(function(){var o={done:!1};try{X(n,t,z(Ct,o,e),z(J,o,e))}catch(i){J(o,i,e)}}):(e.value=t,e.state=Jn,to(e,!1))}catch(o){J({done:!1},o,e)}}};if(Qn&&(L=function(t){Bc(this,$e),Uc(t),X(me,this);var r=dt(this);try{t(z(Ct,r),z(J,r))}catch(n){J(r,n)}},$e=L.prototype,me=function(t){Qc(this,{type:Ve,done:!1,notified:!1,parent:!1,reactions:new Wc,rejection:!1,state:Fr,value:void 0})},me.prototype=xr($e,"then",function(t,r){var n=dt(this),o=wt(Vc(this,L));return n.parent=!0,o.ok=Te(t)?t:!0,o.fail=Te(r)&&r,o.domain=Ie?Kt.domain:void 0,n.state==Fr?n.reactions.add(o):Vt(function(){eo(o,n)}),o.promise}),Ur=function(){var e=new me,t=dt(e);this.promise=e,this.resolve=z(Ct,t),this.reject=z(J,t)},Gn.f=wt=function(e){return e===L||e===Zc?new Ur(e):zc(e)},!xc&&Te(Re)&&G!==Object.prototype)){Mr=G.then,Gc||xr(G,"then",function(t,r){var n=this;return new L(function(o,i){X(Mr,n,o,i)}).then(t,r)},{unsafe:!0});try{delete G.constructor}catch(e){}kr&&kr(G,$e)}jc({global:!0,constructor:!0,wrap:!0,forced:Qn},{Promise:L});kc(L,Ve,!1,!0);Fc(Ve);var no={},ru=P,nu=no,ou=ru("iterator"),au=Array.prototype,iu=function(e){return e!==void 0&&(nu.Array===e||au[ou]===e)},su=Math.ceil,cu=Math.floor,uu=Math.trunc||function(t){var r=+t;return(r>0?cu:su)(r)},lu=uu,fu=function(e){var t=+e;return t!==t||t===0?0:lu(t)},vu=fu,du=Math.min,hu=function(e){return e>0?du(vu(e),9007199254740991):0},pu=hu,yu=function(e){return pu(e.length)},gu=Ft,Vr=Lt,bu=je,$u=no,mu=P,Su=mu("iterator"),oo=function(e){if(!bu(e))return Vr(e,Su)||Vr(e,"@@iterator")||$u[gu(e)]},Eu=O,Tu=U,_u=M,Ou=ke,Pu=oo,wu=TypeError,Cu=function(e,t){var r=arguments.length<2?Pu(e):t;if(Tu(r))return _u(Eu(r,e));throw wu(Ou(e)+" is not iterable")},Iu=O,Hr=M,Ru=Lt,Au=function(e,t,r){var n,o;Hr(e);try{if(n=Ru(e,"return"),!n){if(t==="throw")throw r;return r}n=Iu(n,e)}catch(i){o=!0,n=i}if(t==="throw")throw r;if(o)throw n;return Hr(n),r},Nu=Fe,Du=O,Lu=M,ju=ke,xu=iu,ku=yu,Kr=Dt,Fu=Cu,Uu=oo,Wr=Au,Mu=TypeError,_e=function(e,t){this.stopped=e,this.result=t},qr=_e.prototype,ao=function(e,t,r){var n=r&&r.that,o=!!(r&&r.AS_ENTRIES),i=!!(r&&r.IS_RECORD),c=!!(r&&r.IS_ITERATOR),v=!!(r&&r.INTERRUPTED),f=Nu(t,n),u,a,l,d,h,g,N,w=function(m){return u&&Wr(u,"normal",m),new _e(!0,m)},V=function(m){return o?(Lu(m),v?f(m[0],m[1],w):f(m[0],m[1])):v?f(m,w):f(m)};if(i)u=e.iterator;else if(c)u=e;else{if(a=Uu(e),!a)throw Mu(ju(e)+" is not iterable");if(xu(a)){for(l=0,d=ku(e);d>l;l++)if(h=V(e[l]),h&&Kr(qr,h))return h;return new _e(!1)}u=Fu(e,a)}for(g=i?e.next:u.next;!(N=Du(g,u)).done;){try{h=V(N.value)}catch(m){Wr(u,"throw",m)}if(typeof h=="object"&&h&&Kr(qr,h))return h}return new _e(!1)},Bu=P,io=Bu("iterator"),so=!1;try{var Vu=0,Gr={next:function(){return{done:!!Vu++}},return:function(){so=!0}};Gr[io]=function(){return this},Array.from(Gr,function(){throw 2})}catch(e){}var Hu=function(e,t){if(!t&&!so)return!1;var r=!1;try{var n={};n[io]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(o){}return r},Ku=te,Wu=Hu,qu=le.CONSTRUCTOR,co=qu||!Wu(function(e){Ku.all(e).then(void 0,function(){})}),Gu=B,Qu=O,zu=U,Yu=re,Ju=Bt,Xu=ao,Zu=co;Gu({target:"Promise",stat:!0,forced:Zu},{all:function(t){var r=this,n=Yu.f(r),o=n.resolve,i=n.reject,c=Ju(function(){var v=zu(r.resolve),f=[],u=0,a=1;Xu(t,function(l){var d=u++,h=!1;a++,Qu(v,r,l).then(function(g){h||(h=!0,f[d]=g,--a||o(f))},i)}),--a||o(f)});return c.error&&i(c.value),n.promise}});var el=B,tl=ce,rl=le.CONSTRUCTOR,It=te,nl=A,ol=y,al=xt,Qr=It&&It.prototype;el({target:"Promise",proto:!0,forced:rl,real:!0},{catch:function(e){return this.then(void 0,e)}});if(!tl&&ol(It)){var zr=nl("Promise").prototype.catch;Qr.catch!==zr&&al(Qr,"catch",zr,{unsafe:!0})}var il=B,sl=O,cl=U,ul=re,ll=Bt,fl=ao,vl=co;il({target:"Promise",stat:!0,forced:vl},{race:function(t){var r=this,n=ul.f(r),o=n.reject,i=ll(function(){var c=cl(r.resolve);fl(t,function(v){sl(c,r,v).then(n.resolve,o)})});return i.error&&o(i.value),n.promise}});var dl=B,hl=O,pl=re,yl=le.CONSTRUCTOR;dl({target:"Promise",stat:!0,forced:yl},{reject:function(t){var r=pl.f(this);return hl(r.reject,void 0,t),r.promise}});var gl=M,bl=F,$l=re,uo=function(e,t){if(gl(e),bl(t)&&t.constructor===e)return t;var r=$l.f(e),n=r.resolve;return n(t),r.promise},ml=B,Sl=A,lo=ce,El=te,fo=le.CONSTRUCTOR,Tl=uo,_l=Sl("Promise"),Ol=lo&&!fo;ml({target:"Promise",stat:!0,forced:lo||fo},{resolve:function(t){return Tl(Ol&&this===_l?El:this,t)}});var Pl=B,wl=ce,Ae=te,Cl=T,vo=A,ho=y,Il=xn,Yr=uo,Rl=xt,Rt=Ae&&Ae.prototype,Al=!!Ae&&Cl(function(){Rt.finally.call({then:function(){}},function(){})});Pl({target:"Promise",proto:!0,real:!0,forced:Al},{finally:function(e){var t=Il(this,vo("Promise")),r=ho(e);return this.then(r?function(n){return Yr(t,e()).then(function(){return n})}:e,r?function(n){return Yr(t,e()).then(function(){throw n})}:e)}});if(!wl&&ho(Ae)){var Jr=vo("Promise").prototype.finally;Rt.finally!==Jr&&Rl(Rt,"finally",Jr,{unsafe:!0})}var Nl=A,Dl=Nl,Ll=Dl,jl=Ll("Promise","finally"),xl=jl,kl=xl,Fl=kl,Ul=Fl,ht=Ul;function Ml(){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),t=new Array(36);let r=0,n,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?t[o]="-":o===14?t[o]="4":(r<=2&&(r=33554432+Math.random()*16777216|0),n=r&15,r=r>>4,t[o]=e[o===19?n&3|8:n]);return t.join("")}exports.ApiEnv=void 0;(function(e){e.PROD="prod",e.VK_ALIAS="vk_alias",e.VIDEOTEST="videotest",e.TEST="test",e.AUTO="auto"})(exports.ApiEnv||(exports.ApiEnv={}));exports.Quality=void 0;(function(e){e.Q144P="mobile",e.Q240P="lowest",e.Q360P="low",e.Q480P="medium",e.Q720P="high",e.Q1080P="fullhd",e.Q1440P="quadhd",e.Q2160P="ultrahd",e.UNKNOWN="unknown"})(exports.Quality||(exports.Quality={}));exports.ContentType=void 0;(function(e){e.MP4="mp4",e.DASH="dash",e.DASH_SEP="dash_sep",e.ONDEMAND_DASH="ondemand_dash",e.HLS="hls",e.ONDEMAND_HLS="ondemand_hls",e.WEBM="webm",e.AV1="av1",e.ONDEMAND_DASH_LIVE="ondemand_dash_live",e.ONDEMAND_HLS_LIVE="ondemand_hls_live",e.WEBRTC="webrtc",e.UNKNOWN="unknown",e.RTMP="rtmp"})(exports.ContentType||(exports.ContentType={}));var Ne;(function(e){e.AUTO="auto",e.MANUAL=""})(Ne||(Ne={}));exports.ConnectionType=void 0;(function(e){e.HTTP1="http1",e.HTTP2="http2",e.HTTP3="http3"})(exports.ConnectionType||(exports.ConnectionType={}));var C;(function(e){e[e.YES=1]="YES",e[e.NO=0]="NO"})(C||(C={}));var Y;(function(e){e.EXCELLENT="excellent",e.GOOD="good",e.POOR="poor"})(Y||(Y={}));var x;(function(e){e.PIP="pip",e.FULLSCREEN="fullscreen",e.EXTERNAL="external",e.PREFETCH="prefetch"})(x||(x={}));exports.SeekAction=void 0;(function(e){e.SLIDER="slider",e.DOUBLE_TAP="double_tap",e.TIME_CODE="time_code",e.EPISODE="episode",e.REWIND="rewind",e.LIVE="live",e.UNKNOWN="unknown"})(exports.SeekAction||(exports.SeekAction={}));const At="1.0.36",Bl="CIOPGQJGDIHBABABA",po={[exports.ApiEnv.PROD]:"https://api.ok.ru",[exports.ApiEnv.VK_ALIAS]:"https://api.mycdn.me",[exports.ApiEnv.VIDEOTEST]:"https://videotestapi.ok.ru/api",[exports.ApiEnv.TEST]:"https://apitest.ok.ru",[exports.ApiEnv.AUTO]:""},Vl="_one-stat_",Xr=`${Vl}uuid`,Hl={start:1e3,factor:1.5,max:5*60*1e3,random:.1};var j;(function(e){e[e.PARAM_SESSION_EXPIRED=102]="PARAM_SESSION_EXPIRED",e[e.PARAM_SESSION_KEY=103]="PARAM_SESSION_KEY",e[e.PARAM_SIGNATURE=104]="PARAM_SIGNATURE",e[e.AUTH_LOGIN=401]="AUTH_LOGIN"})(j||(j={}));class Kl{constructor(t){this.consequentAuthErrors=0,this.authorized$=new s.ValueSubject(!1),this.params=t;const r=s.safeStorage.get(Xr);r?this.uuid=String(r):(this.uuid=Ml(),s.safeStorage.set(Xr,this.uuid))}authorize(t){return I(this,void 0,void 0,function*(){return this.authToken=t!=null?t:yield this.refreshAuthToken(),this._authorizeWithBackoff()})}logBeacon(t){const r="log.externalLog",n=this.createLogParams(t),o=this.sessionKey;if(!o)return;this.params.apiTransport.sendBeacon(r,n,o)||this.logRequest(t)}logRequest(t){var r;return I(this,void 0,void 0,function*(){const n="log.externalLog",o=this.createLogParams(t),i=(r=this.sessionKey)!==null&&r!==void 0?r:yield this._authorizeWithBackoff();if(!i)return;const c=(v,f=this.params.requestRetryCount)=>I(this,void 0,void 0,function*(){try{return yield this.params.apiTransport.sendRequest(n,o,i)}catch(u){if(!u||!("error_code"in u)){this.params.error$.next({id:"logRequestUnknown",category:s.ErrorCategory.NETWORK,message:`Unknown ${n} error`,thrown:u});return}const a=u==null?void 0:u.error_code;switch(a){case j.PARAM_SESSION_EXPIRED:case j.PARAM_SESSION_KEY:case j.PARAM_SIGNATURE:return this.authorized$.next(!1),this.sessionKey=yield this._authorizeWithBackoff(),f>0?c(v,f-1):void 0;case j.AUTH_LOGIN:return this.authorized$.next(!1),this.authToken=yield this.refreshAuthToken(),this.sessionKey=yield this._authorizeWithBackoff(),f>0?c(v,f-1):void 0;default:{this.params.error$.next({id:`LogRequest#${a}`,category:s.ErrorCategory.EXTERNAL_API,message:`${n} error`,data:u});return}}}});return c(t)})}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}refreshAuthToken(){return I(this,void 0,void 0,function*(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=ht(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise})}createLogParams(t){return{collector:"ok.mobile.apps.video",data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${At}`,platform:this.params.mobile?"M_WEB":"WEB",items:t})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();const t=s.getExponentialDelay(this.consequentAuthErrors,Hl);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{ht(this._authorize().then(r).catch(n=>this.params.error$.next({id:"AuthorizeBackoff",category:s.ErrorCategory.NETWORK,message:"Otherwise unhandled error in authorization",thrown:n})),()=>this.backoffTimeoutId=0)},t))})}_authorize(){return I(this,void 0,void 0,function*(){if(this.authorizePromise)return this.authorizePromise;this.sessionKey=void 0,this.authorized$.next(!1);const t="auth.anonymLogin",r={session_data:{version:2,device_id:this.uuid,client_version:At.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=ht(this.params.apiTransport.sendRequest(t,r).then(n=>{var o;return(!n||!n.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:s.ErrorCategory.EXTERNAL_API,message:"No session key",data:n}),this.sessionKey=(o=n==null?void 0:n.session_key)!==null&&o!==void 0?o:void 0,this.sessionKey}).catch(n=>I(this,void 0,void 0,function*(){this.sessionKey=void 0;const o=n==null?void 0:n.error_code;switch(o){case j.AUTH_LOGIN:return this.authToken=yield this.refreshAuthToken(),this._authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:s.ErrorCategory.EXTERNAL_API,message:"authorize error",data:n}):this.params.error$.next({id:"AuthorizeUnknown",category:s.ErrorCategory.NETWORK,message:"authorize error",thrown:n})})),()=>{this.authorizePromise=void 0,this.consequentAuthErrors=this.sessionKey?0:this.consequentAuthErrors+1,this.authorized$.next(this.sessionKey!==void 0)}),this.authorizePromise})}}class Zr{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(t,r,n){t in this.listeners||(this.listeners[t]=[]),this.listeners[t].push({callback:r,options:n})}removeEventListener(t,r){if(!(t in this.listeners))return;const n=this.listeners[t];for(let o=0,i=n.length;o<i;o++)if(n[o].callback===r){n.splice(o,1);return}}dispatchEvent(t){if(!(t.type in this.listeners))return;const n=this.listeners[t.type].slice();for(let o=0,i=n.length;o<i;o++){const c=n[o];try{c.callback.call(this,t)}catch(v){Promise.resolve().then(()=>{throw v})}c.options&&c.options.once&&this.removeEventListener(t.type,c.callback)}return!t.defaultPrevented}}class yo extends Zr{constructor(){super(),this.listeners||Zr.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(t){t.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,t)),super.dispatchEvent(t)}}class Wl{constructor(){Object.defineProperty(this,"signal",{value:new yo,writable:!0,configurable:!0})}abort(t){let r;try{r=new Event("abort")}catch(o){typeof document!="undefined"?document.createEvent?(r=document.createEvent("Event"),r.initEvent("abort",!1,!1)):(r=document.createEventObject(),r.type="abort"):r={type:"abort",bubbles:!1,cancelable:!1}}let n=t;if(n===void 0)if(typeof document=="undefined")n=new Error("This operation was aborted"),n.name="AbortError";else try{n=new DOMException("signal is aborted without reason")}catch(o){n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(r)}toString(){return"[object AbortController]"}}typeof Symbol!="undefined"&&Symbol.toStringTag&&(Wl.prototype[Symbol.toStringTag]="AbortController",yo.prototype[Symbol.toStringTag]="AbortSignal");function go(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function ql(e){typeof e=="function"&&(e={fetch:e});const{fetch:t,Request:r=t.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=e;if(!go({fetch:t,Request:r,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o}))return{fetch:t,Request:i};let i=r;(i&&!i.prototype.hasOwnProperty("signal")||o)&&(i=function(u,a){let l;a&&a.signal&&(l=a.signal,delete a.signal);const d=new r(u,a);return l&&Object.defineProperty(d,"signal",{writable:!1,enumerable:!1,configurable:!0,value:l}),d},i.prototype=r.prototype);const c=t;return{fetch:(f,u)=>{const a=i&&i.prototype.isPrototypeOf(f)?f.signal:u?u.signal:void 0;if(a){let l;try{l=new DOMException("Aborted","AbortError")}catch(h){l=new Error("Aborted"),l.name="AbortError"}if(a.aborted)return Promise.reject(l);const d=new Promise((h,g)=>{a.addEventListener("abort",()=>g(l),{once:!0})});return u&&u.signal&&delete u.signal,Promise.race([d,c(f,u)])}return c(f,u)},Request:i}}const qt=go({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),bo=qt?ql({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,en=qt?bo.fetch:window.fetch;qt?bo.Request:window.Request;class Gl{constructor(t){this.params=t,this.apiKey=t.apiKey,this.apiEnv=t.apiEnv,this.apiBaseUrl=t.apiBaseUrl,this.timeSynchronisation=t.timeSynchronisation,this.isApiBaseUrlFetched=!1}resolveApiBaseUrl(){var t;return I(this,void 0,void 0,function*(){if(this.apiEnv!==exports.ApiEnv.AUTO||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{const r=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=yield(yield en(r,{method:"GET",mode:"cors",cache:"no-cache"})).json(),i=(t=o==null?void 0:o.Answer[0])===null||t===void 0?void 0:t.data;if(!i)throw new Error("Wrong DNS response");return i}catch(r){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:s.ErrorCategory.NETWORK,message:"Unhandled resolve api base url error",thrown:r}),po[exports.ApiEnv.VK_ALIAS]}finally{this.isApiBaseUrlFetched=!0}})}sendBeacon(t,r,n){if(!window.Blob||!window.navigator.sendBeacon)return!1;const o=this._prepareQueryParams({method:t,queryParams:r,sessionKey:n}),i=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,i)}catch(c){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:s.ErrorCategory.NETWORK,message:"Unhandled beacon error",thrown:c,data:{method:t,params:r}})}return!1}sendRequest(t,r,n){return I(this,void 0,void 0,function*(){const o=s.now(),i=c=>{if(c instanceof TypeError&&["Failed to fetch","NetworkError when attempting to fetch resource."].includes(c.message)){this.params.error$.next({id:"Network",category:s.ErrorCategory.NETWORK,message:"Request failed",thrown:c});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:s.ErrorCategory.NETWORK,message:"Unhandled request error",thrown:c,data:{method:t,params:r,sessionKey:n,time:s.now()-o}})};return this.apiBaseUrl=yield this.resolveApiBaseUrl(),en(`${this.apiBaseUrl}/fb.do`,{method:"post",headers:{"Content-type":"application/x-www-form-urlencoded"},body:this._prepareQueryParams({method:t,queryParams:r,sessionKey:n})}).then(c=>{var v;const f=Number(c.headers.get("content-length"))===0,u=new Date((v=c.headers.get("date"))!==null&&v!==void 0?v:"").getTime(),a=s.now()-o;if(isFinite(u)&&this.timeSynchronisation.addServerTime(u,a),!f)return c.json().then(l=>Object.prototype.hasOwnProperty.call(l,"error_msg")?Promise.reject(l):l,i)},i)})}_prepareQueryParams(t){const r=new URLSearchParams({format:"JSON",method:t.method,application_key:this.apiKey});return t.sessionKey!==void 0&&r.append("session_key",t.sessionKey),Object.entries(t.queryParams).forEach(([n,o])=>r.append(n,typeof o=="string"?o:JSON.stringify(o))),r}}const tn=5e3,Ql=1e4,zl=6e4,Se="onestat_events",Yl=36*60*60*1e3,pt=e=>e.timestamp+Yl>=s.now();class Jl{constructor(t){this.unsaltedStorage=[],this.isPaused=!1,this.isUrgent=r=>{const{operation:n,custom:{param:o}}=r;return["action_stop","close_at_empty_buffer"].includes(n)||n==="watch_coverage_record"&&o==="0-0"},this.firstFlush=Gt(()=>this.safeFlush(),tn,{maxWait:tn}),this.debouncedFlush=Gt(()=>this.safeFlush(),Ql,{maxWait:zl}),this.api=t.api,this.error$=t.error$,this.userSalt=t.userSalt,this.subscription=this.api.authorized$.subscribe(r=>{r&&this.debouncedFlush()}),this.housekeepStorage()}safeFlush(){var t;try{this.flush()}catch(r){this.error$.next({id:"LoggerError",category:s.ErrorCategory.WTF,message:(t=String(r))!==null&&t!==void 0?t:"Unknown logger error",thrown:r})}}readFromStorage(){const t=s.safeStorage.get(Se);try{return t?JSON.parse(t):{}}catch(r){}return{}}addToStorage(t){var r;if(!this.userSalt){this.unsaltedStorage.push(t);return}const n=this.readFromStorage(),i=((r=n[this.userSalt])!==null&&r!==void 0?r:[]).filter(pt);s.safeStorage.set(Se,JSON.stringify(Object.assign(Object.assign({},n),{[this.userSalt]:[...i,t]})))}getFromStorage(){var t;return this.userSalt?((t=this.readFromStorage()[this.userSalt])!==null&&t!==void 0?t:[]).filter(pt):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}const t=this.readFromStorage();delete t[this.userSalt],s.safeStorage.set(Se,JSON.stringify(t))}housekeepStorage(){const t=this.readFromStorage();for(const[r,n]of Object.entries(t)){const o=n.filter(pt);o.length?t[r]=o:delete t[r]}s.safeStorage.set(Se,JSON.stringify(t))}log(t){this.addToStorage(t),!this.isPaused&&(this.isUrgent(t)?this.flush():this.lastVsid!==t.custom.vsid?this.firstFlush():this.debouncedFlush(),this.lastVsid=t.custom.vsid)}flush(t=!1){const r=this.getFromStorage();r.length!==0&&(this.api.authorized$.getValue()?(t?this.api.logBeacon(r):this.api.logRequest(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()}}const Xl=()=>{let e,t;try{e=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?e=!0:(e=!1,console.error(n))}try{window.location.ancestorOrigins&&(t=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!t&&document.referrer&&(t=document.referrer)}catch(n){console.error(n)}const r=t?new URL(t).hostname:void 0;return{isEmbed:e,host:r}},Zl=e=>e&&{[p.VideoQuality.INVARIANT]:exports.Quality.UNKNOWN,[p.VideoQuality.Q_144P]:exports.Quality.Q144P,[p.VideoQuality.Q_240P]:exports.Quality.Q240P,[p.VideoQuality.Q_360P]:exports.Quality.Q360P,[p.VideoQuality.Q_480P]:exports.Quality.Q480P,[p.VideoQuality.Q_720P]:exports.Quality.Q720P,[p.VideoQuality.Q_1080P]:exports.Quality.Q1080P,[p.VideoQuality.Q_1440P]:exports.Quality.Q1440P,[p.VideoQuality.Q_2160P]:exports.Quality.Q2160P,[p.VideoQuality.Q_4320P]:exports.Quality.UNKNOWN}[e],rn=e=>e&&{[p.HttpConnectionType.HTTP1]:exports.ConnectionType.HTTP1,[p.HttpConnectionType.HTTP2]:exports.ConnectionType.HTTP2,[p.HttpConnectionType.QUIC]:exports.ConnectionType.HTTP3}[e],ef=e=>{if(e!==void 0)switch(e){case p.VideoFormat.MPEG:return exports.ContentType.MP4;case p.VideoFormat.DASH:case p.VideoFormat.DASH_LIVE:return exports.ContentType.DASH;case p.VideoFormat.DASH_SEP:return exports.ContentType.DASH_SEP;case p.VideoFormat.DASH_ONDEMAND:return exports.ContentType.ONDEMAND_DASH;case p.VideoFormat.DASH_WEBM:case p.VideoFormat.DASH_LIVE_WEBM:return exports.ContentType.WEBM;case p.VideoFormat.DASH_WEBM_AV1:return exports.ContentType.AV1;case p.VideoFormat.DASH_LIVE_CMAF:return exports.ContentType.ONDEMAND_DASH_LIVE;case p.VideoFormat.HLS:case p.VideoFormat.HLS_LIVE:return exports.ContentType.HLS;case p.VideoFormat.HLS_ONDEMAND:return exports.ContentType.ONDEMAND_HLS;case p.VideoFormat.HLS_LIVE_CMAF:return exports.ContentType.ONDEMAND_HLS_LIVE;case p.VideoFormat.WEB_RTC_LIVE:return exports.ContentType.WEBRTC;default:return s.assertNever(e)}},yt=e=>{if(e!==void 0)switch(e){case p.Surface.NONE:case p.Surface.INLINE:return;case p.Surface.FULLSCREEN:return x.FULLSCREEN;case p.Surface.SECOND_SCREEN:return x.EXTERNAL;case p.Surface.PIP:return x.PIP;default:return s.assertNever(e)}},tf=e=>{switch(e){case"slow-2g":return Y.POOR;case"2g":return Y.POOR;case"3g":return Y.GOOD;case"4g":return Y.EXCELLENT}};class rf{constructor(t){this.offset=void 0,this.offset=t}getOffset(){var t;return(t=this.offset)!==null&&t!==void 0?t:0}setOffset(t){this.offset=t}now(){var t;return Date.now()+((t=this.offset)!==null&&t!==void 0?t:0)}date(t=new Date){var r;return t.setTime(t.getTime()+((r=this.offset)!==null&&r!==void 0?r:0)),t}addServerTime(t,r){const n=Date.now(),o=t-n-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)}}const nn=()=>Math.floor(Math.random()*Math.pow(2,32)).toString(36).padStart(8,"0"),nf=e=>new s.Observable(t=>{const r=new s.Subscription,n=s.merge(s.fromEvent(window,"beforeunload"),e.events.willDestruct$),o=new s.ValueSubject(void 0);let i;r.add(e.info.isLive$.pipe(s.filterChanged()).subscribe(h=>{i&&(i.unsubscribe(),o.next(void 0)),h?i=e.info.liveTime$.pipe(s.map(g=>g&&g/1e3)).subscribe(o):i=e.info.position$.subscribe(o),r.add(i)}));const{playing$:c,paused$:v}=e.events,f=e.events.willSeek$.pipe(s.filter(()=>e.info.playbackState$.getValue()===p.PlaybackState.PLAYING)),u=e.events.seeked$.pipe(s.filter(()=>e.info.playbackState$.getValue()===p.PlaybackState.PLAYING)),a=s.merge(c,u),l=s.merge(v,f,n,e.events.looped$);let d;return r.add(a.subscribe(()=>d=o.getValue())),r.add(l.subscribe(()=>{const h=o.getValue();s.isNullable(d)||d===h||s.isNullable(h)||(t.next({from:d,to:h}),d=void 0)})),r});class of{constructor(t,r){var n,o;this.subscription=new s.Subscription,this.timeSynchronisation=new rf,this.vsid=nn(),this.seekAction$=new s.ValueSubject(exports.SeekAction.UNKNOWN),this.statContext=t,this.config=Object.assign(Object.assign({},(n=r.config)!==null&&n!==void 0?n:{}),{requestRetryCount:1});const i=new s.Subject;this.experimental={error$:i};const c=new Gl({apiKey:Bl,apiBaseUrl:po[r.apiEnv],apiEnv:r.apiEnv,error$:i,timeSynchronisation:this.timeSynchronisation});this.api=new Kl({apiTransport:c,refreshAuthToken:r.refreshAuthToken,requestRetryCount:this.config.requestRetryCount,mobile:(o=this.statContext.mobile)!==null&&o!==void 0?o:!1,error$:i}),this.logger=new Jl({api:this.api,error$:i,userSalt:r.userSalt});const{isEmbed:v,host:f}=Xl();this.isEmbed=v,this.embedParent=f,this.subscribe()}updateContext(t){this.statContext=Object.assign(Object.assign({},this.statContext),t)}attachTo(t){const r=new s.Subscription,n=(a,l)=>r.add(a.subscribe(l));n(t.events.willStart$,()=>{this.logActionPlay({position:t.info.position$.getValue()})}),n(t.events.looped$,()=>{this.resetViewSession(),this.logActionPlay({position:t.info.position$.getValue()})}),n(t.events.seeked$,()=>{this.logSeek({action:this.seekAction$.getValue(),time:t.info.position$.getValue()}),this.seekAction$.next(exports.SeekAction.UNKNOWN)}),n(t.events.paused$,()=>{this.logPause({position:t.info.position$.getValue()})}),n(t.events.willResume$,()=>{this.logPlay()}),n(t.events.started$,()=>{this.statContext.clip&&this.logWatchCoverageRecord({start:0,end:0})}),n(nf(t),a=>{const l=t.info.isLive$.getValue(),d={start:parseFloat(a.from.toFixed(3)),end:parseFloat(a.to.toFixed(3))};l?this.logWatchCoverageLive(d):this.logWatchCoverageRecord(d)});let o;n(t.info.isStalled$,a=>{a?o=s.now():(s.isNonNullable(o)&&this.logEmptyBuffer({duration:s.now()-o}),o=void 0)});let i=!1;r.add(t.events.fatalError$.pipe(s.once()).subscribe(()=>i=!0)),n(t.events.willStop$,()=>{if(t.info.isStalled$.getValue()){const l=s.isNonNullable(o)?s.now()-o:void 0;this.logCloseAtEmptyBuffer({duration:l!=null?l:0}),o=void 0}else i||this.logActionStop()}),n(t.events.managedError$,({id:a})=>{this.logError({fatal:!1,errorType:a})}),n(t.events.fatalError$,({id:a})=>{this.logError({fatal:!0,errorType:a})});let c,v,f=!1;n(t.events.firstBytes$,a=>{c=s.now(),this.logFirstBytes({time:a})}),n(t.events.willStart$,()=>v=s.now()),n(t.info.currentBuffer$,a=>{!f&&a&&a.end-a.start>0&&s.isNonNullable(c)&&(this.logPlayerReady({duration:s.now()-c}),f=!0)}),n(t.events.firstFrame$,()=>{s.isNonNullable(c)&&!f&&(this.logPlayerReady({duration:s.now()-c}),f=!0),s.isNonNullable(v)&&this.logFirstFrame({time:s.now()-v})}),n(t.info.atLiveEdge$,a=>this.updateContext({liveEdge:a})),n(s.combine({muted:t.info.muted$,volume:t.info.volume$}),({muted:a,volume:l})=>this.updateContext({audible:!a&&l>0})),n(t.info.currentQuality$,a=>this.updateContext({quality:Zl(a)})),n(t.info.isAutoQualityEnabled$,a=>this.updateContext({autoQuality:a})),n(t.info.currentFormat$,a=>this.updateContext({contentType:ef(a)}));let u;return n(t.info.hostname$,a=>{this.updateContext({cdnHostname:a,failover:u!==void 0&&u!==a}),u=a}),n(t.info.throughputEstimation$,a=>this.updateContext({downloadSpeed:a})),n(t.info.httpConnectionType$,a=>{this.statContext.firstConnectionType||this.updateContext({firstConnectionType:rn(a)}),this.updateContext({connectionType:rn(a)})}),n(t.info.httpConnectionReused$,a=>{s.isNullable(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:a}),this.updateContext({connectionReused:a})}),n(t.info.surface$,a=>this.updateContext({mode:yt(a)})),n(s.combine({current:t.info.currentTextTrack$,available:t.info.availableTextTracks$}),({current:a,available:l})=>{const d=l.find(({id:h})=>h===a);this.updateContext({subtitles:d==null?void 0:d.language})}),this.player=t,this.uiEvents&&this.attachToUi(this.uiEvents),this.subscription.add(r),r}attachToUi(t){this.uiEvents=t;const r=new s.Subscription;return this.player&&(r.add(t.actionRewind$.subscribe(()=>{this.player&&(this.resetViewSession(),this.logActionPlay({position:this.player.info.position$.getValue()}))})),r.add(t.actionSeek$.subscribe(this.seekAction$)),r.add(t.inPiP$.subscribe(n=>{var o;const i=n?x.PIP:yt((o=this.player)===null||o===void 0?void 0:o.info.surface$.getValue());this.updateContext({mode:i})})),r.add(t.inFullscreen$.subscribe(n=>{var o;const i=n?x.FULLSCREEN:yt((o=this.player)===null||o===void 0?void 0:o.info.surface$.getValue());this.updateContext({mode:i})})),r.add(t.actionSetSubtitle$.subscribe(n=>{this.updateContext({subtitles:n})})),this.subscription.add(r)),r}attachToAds(t){const r=new s.Subscription;return r.add(t.slotRequested$.subscribe(()=>this.logAdSlotRequest())).add(t.started$.subscribe(n=>this.logAdStarted(n))).add(t.paused$.subscribe(()=>this.logAdPaused())).add(t.resumed$.subscribe(()=>this.logAdResumed())).add(t.ended$.subscribe(()=>this.logAdEnded())).add(t.skipped$.subscribe(()=>this.logAdSkipped())).add(t.clicked$.subscribe(()=>this.logAdClicked())),this.subscription.add(r),r}authorize(t){return this.api.authorize(t)}pause(){this.logger.pause()}resume(){this.logger.resume()}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.vsid=nn()}setFieldBlacklist(){}logInited(){}logReady(t){this.log({operation:"player_ready",param:String(t.time)})}logStarted(...t){this.logActionPlay(...t)}logPlay(){this.log({operation:"play_toggle"})}logPause(t){this.log({operation:"pause",param:String(Math.round(t.position))})}logSeek(t){this.log({operation:"seek",param:t.action,time:t.time})}logFirstBytes(t){this.log({operation:"first_bytes",param:String(t.time)})}logFirstFrame(t){this.log({operation:"first_frame",param:String(t.time)})}logError(t){this.log({operation:"content_error",param:`${t.fatal?"fatal":"recoverable"}_${t.errorType}`})}logWatchCoverageRecord(t){this.log({operation:"watch_coverage_record",param:`${t.start}-${t.end}`})}logWatchCoverageLive(t){const r=t.start+this.timeSynchronisation.getOffset(),n=t.end+this.timeSynchronisation.getOffset();this.log({operation:"watch_coverage_live",param:`${r}-${n}`})}logEmptyBuffer(t){this.log({operation:"empty_buffer",param:String(t.duration)})}logDownloadSpeed(){}logAdSlotRequest(){this.log({operation:"adv",param:"slot_request"})}logAdStarted(t){this.log({operation:"adv",param:t})}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"})}subscribe(){this.subscription.add(s.fromEvent(window,"beforeunload").subscribe(()=>this.logger.flush(!0)));const t=window.navigator.connection;t&&"onchange"in t&&"effectiveType"in t&&this.subscription.add(s.merge(s.fromEvent(t,"change"),s.observableFrom(["init"])).subscribe(()=>this.updateContext({network:tf(t.effectiveType)})))}logPlayerReady(t){this.log({operation:"player_ready",param:String(Math.round(t.duration))})}logActionPlay(t){this.log({operation:"action_play",param:String(Math.round(t.position))})}logCloseAtEmptyBuffer(t){this.log({operation:"close_at_empty_buffer",param:String(Math.round(t.duration))})}logActionStop(){this.log({operation:"action_stop"})}log(t){const r=this.createLogItem(t);this.logger.log(r)}createLogItem({operation:t,param:r,time:n}){const o=this.timeSynchronisation.now(),i=t==="empty_buffer"||t==="close_at_empty_buffer"?this.statContext.connectionType:this.statContext.firstConnectionType,c=this.statContext.firstConnectionReused,v={vsid:this.vsid,vid:this.statContext.movieId,ct:this.statContext.contentType,place:this.isEmbed?"embed":this.statContext.place,quality:this.statContext.quality,cdn_host:this.statContext.cdnHostname,stat_type:this.statContext.autoplay===!0?Ne.AUTO:this.statContext.autoplay===!1?Ne.MANUAL:void 0,param:r,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode,connection_type:i,connection_reused:c===!0?C.YES:c===!1?C.NO:void 0,cached_data:this.statContext.cached===!0?C.YES:this.statContext.cached===!1?C.NO:void 0,live:this.statContext.liveEdge?C.YES:void 0,muted:this.statContext.audible===!1?C.YES:void 0,mode:this.statContext.mode,subtitles:this.statContext.subtitles,download_speed:this.statContext.downloadSpeed,manual_quality:this.statContext.autoQuality?void 0:C.YES,ref_domain:this.embedParent,aid:this.statContext.albumId,vk_playlist_id:this.statContext.vkPlaylistId};return{operation:t,type:1,time:n,network:this.statContext.network,timestamp:o,custom:v}}}exports.OneStat=of;exports.VERSION=At;
package/es2015.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-statistics v1.0.35
3
- * Mon, 19 Jun 2023 16:54:12 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-35/doc/
2
+ * @vkontakte/videoplayer-statistics v1.0.36
3
+ * Mon, 03 Jul 2023 18:22:45 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-36/doc/
5
5
  */
6
- import{ValueSubject as Gt,safeStorage as Z,getExponentialDelay as Mo,ErrorCategory as _,now as E,assertNever as Tn,Observable as Fo,Subscription as ve,merge as Ne,fromEvent as At,filterChanged as Bo,map as Vo,filter as cr,isNullable as Ct,Subject as Ho,once as Ko,combine as ur,observableFrom as Wo,isNonNullable as ue}from"@vkontakte/videoplayer-shared/es2015.esm.js";import lr from"lodash/debounce.js";import{Surface as le,VideoQuality as O,HttpConnectionType as tt,VideoFormat as g,PlaybackState as fr}from"@vkontakte/videoplayer-core/es2015.esm.js";function L(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function f(a){try{c(n.next(a))}catch(u){s(u)}}function l(a){try{c(n.throw(a))}catch(u){s(u)}}function c(a){a.done?i(a.value):o(a.value).then(f,l)}c((n=n.apply(e,t||[])).next())})}var vr=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},Se=function(e){return e&&e.Math==Math&&e},y=Se(typeof globalThis=="object"&&globalThis)||Se(typeof window=="object"&&window)||Se(typeof self=="object"&&self)||Se(typeof vr=="object"&&vr)||function(){return this}()||Function("return this")(),w=function(e){try{return!!e()}catch(t){return!0}},Go=w,We=!Go(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),qo=We,On=Function.prototype,dr=On.apply,hr=On.call,Pn=typeof Reflect=="object"&&Reflect.apply||(qo?hr.bind(dr):function(){return hr.apply(dr,arguments)}),wn=We,In=Function.prototype,Nt=In.call,zo=wn&&In.bind.bind(Nt,Nt),I=wn?zo:function(e){return function(){return Nt.apply(e,arguments)}},Rn=I,Qo=Rn({}.toString),Yo=Rn("".slice),Ge=function(e){return Yo(Qo(e),8,-1)},Jo=Ge,Xo=I,An=function(e){if(Jo(e)==="Function")return Xo(e)},Dt=typeof document=="object"&&document.all,Zo=typeof Dt=="undefined"&&Dt!==void 0,Cn={all:Dt,IS_HTMLDDA:Zo},Nn=Cn,ea=Nn.all,h=Nn.IS_HTMLDDA?function(e){return typeof e=="function"||e===ea}:function(e){return typeof e=="function"},qt={},ta=w,ae=!ta(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),ra=We,Ee=Function.prototype.call,R=ra?Ee.bind(Ee):function(){return Ee.apply(Ee,arguments)},Dn={},Ln={}.propertyIsEnumerable,xn=Object.getOwnPropertyDescriptor,na=xn&&!Ln.call({1:2},1);Dn.f=na?function(t){var r=xn(this,t);return!!r&&r.enumerable}:Ln;var jn=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},oa=I,aa=w,ia=Ge,rt=Object,sa=oa("".split),ca=aa(function(){return!rt("z").propertyIsEnumerable(0)})?function(e){return ia(e)=="String"?sa(e,""):rt(e)}:rt,qe=function(e){return e==null},ua=qe,la=TypeError,Un=function(e){if(ua(e))throw la("Can't call method on "+e);return e},fa=ca,va=Un,da=function(e){return fa(va(e))},pr=h,kn=Cn,ha=kn.all,H=kn.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:pr(e)||e===ha}:function(e){return typeof e=="object"?e!==null:pr(e)},Mn={},nt=Mn,ot=y,pa=h,gr=function(e){return pa(e)?e:void 0},j=function(e,t){return arguments.length<2?gr(nt[e])||gr(ot[e]):nt[e]&&nt[e][t]||ot[e]&&ot[e][t]},ga=I,zt=ga({}.isPrototypeOf),ze=typeof navigator!="undefined"&&String(navigator.userAgent)||"",Fn=y,at=ze,yr=Fn.process,br=Fn.Deno,$r=yr&&yr.versions||br&&br.version,mr=$r&&$r.v8,T,je;mr&&(T=mr.split("."),je=T[0]>0&&T[0]<4?1:+(T[0]+T[1]));!je&&at&&(T=at.match(/Edge\/(\d+)/),(!T||T[1]>=74)&&(T=at.match(/Chrome\/(\d+)/),T&&(je=+T[1])));var Bn=je,Sr=Bn,ya=w,Vn=!!Object.getOwnPropertySymbols&&!ya(function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Sr&&Sr<41}),ba=Vn,Hn=ba&&!Symbol.sham&&typeof Symbol.iterator=="symbol",$a=j,ma=h,Sa=zt,Ea=Hn,_a=Object,Kn=Ea?function(e){return typeof e=="symbol"}:function(e){var t=$a("Symbol");return ma(t)&&Sa(t.prototype,_a(e))},Ta=String,Qe=function(e){try{return Ta(e)}catch(t){return"Object"}},Oa=h,Pa=Qe,wa=TypeError,K=function(e){if(Oa(e))return e;throw wa(Pa(e)+" is not a function")},Ia=K,Ra=qe,Qt=function(e,t){var r=e[t];return Ra(r)?void 0:Ia(r)},it=R,st=h,ct=H,Aa=TypeError,Ca=function(e,t){var r,n;if(t==="string"&&st(r=e.toString)&&!ct(n=it(r,e))||st(r=e.valueOf)&&!ct(n=it(r,e))||t!=="string"&&st(r=e.toString)&&!ct(n=it(r,e)))return n;throw Aa("Can't convert object to primitive value")},Ue={},Na={get exports(){return Ue},set exports(e){Ue=e}},be=!0,Er=y,Da=Object.defineProperty,La=function(e,t){try{Da(Er,e,{value:t,configurable:!0,writable:!0})}catch(r){Er[e]=t}return t},xa=y,ja=La,_r="__core-js_shared__",Ua=xa[_r]||ja(_r,{}),Yt=Ua,Tr=Yt;(Na.exports=function(e,t){return Tr[e]||(Tr[e]=t!==void 0?t:{})})("versions",[]).push({version:"3.27.2",mode:"pure",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.27.2/LICENSE",source:"https://github.com/zloirock/core-js"});var ka=Un,Ma=Object,Fa=function(e){return Ma(ka(e))},Ba=I,Va=Fa,Ha=Ba({}.hasOwnProperty),ie=Object.hasOwn||function(t,r){return Ha(Va(t),r)},Ka=I,Wa=0,Ga=Math.random(),qa=Ka(1 .toString),Wn=function(e){return"Symbol("+(e===void 0?"":e)+")_"+qa(++Wa+Ga,36)},za=y,Qa=Ue,Or=ie,Ya=Wn,Ja=Vn,Xa=Hn,ee=za.Symbol,ut=Qa("wks"),Za=Xa?ee.for||ee:ee&&ee.withoutSetter||Ya,A=function(e){return Or(ut,e)||(ut[e]=Ja&&Or(ee,e)?ee[e]:Za("Symbol."+e)),ut[e]},ei=R,Pr=H,wr=Kn,ti=Qt,ri=Ca,ni=A,oi=TypeError,ai=ni("toPrimitive"),ii=function(e,t){if(!Pr(e)||wr(e))return e;var r=ti(e,ai),n;if(r){if(t===void 0&&(t="default"),n=ei(r,e,t),!Pr(n)||wr(n))return n;throw oi("Can't convert object to primitive value")}return t===void 0&&(t="number"),ri(e,t)},si=ii,ci=Kn,Gn=function(e){var t=si(e,"string");return ci(t)?t:t+""},ui=y,Ir=H,Lt=ui.document,li=Ir(Lt)&&Ir(Lt.createElement),qn=function(e){return li?Lt.createElement(e):{}},fi=ae,vi=w,di=qn,zn=!fi&&!vi(function(){return Object.defineProperty(di("div"),"a",{get:function(){return 7}}).a!=7}),hi=ae,pi=R,gi=Dn,yi=jn,bi=da,$i=Gn,mi=ie,Si=zn,Rr=Object.getOwnPropertyDescriptor;qt.f=hi?Rr:function(t,r){if(t=bi(t),r=$i(r),Si)try{return Rr(t,r)}catch(n){}if(mi(t,r))return yi(!pi(gi.f,t,r),t[r])};var Ei=w,_i=h,Ti=/#|\.prototype\./,$e=function(e,t){var r=Pi[Oi(e)];return r==Ii?!0:r==wi?!1:_i(t)?Ei(t):!!t},Oi=$e.normalize=function(e){return String(e).replace(Ti,".").toLowerCase()},Pi=$e.data={},wi=$e.NATIVE="N",Ii=$e.POLYFILL="P",Qn=$e,Ar=An,Ri=K,Ai=We,Ci=Ar(Ar.bind),Ye=function(e,t){return Ri(e),t===void 0?e:Ai?Ci(e,t):function(){return e.apply(t,arguments)}},Je={},Ni=ae,Di=w,Li=Ni&&Di(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),xi=H,ji=String,Ui=TypeError,W=function(e){if(xi(e))return e;throw Ui(ji(e)+" is not an object")},ki=ae,Mi=zn,Fi=Li,_e=W,Cr=Gn,Bi=TypeError,lt=Object.defineProperty,Vi=Object.getOwnPropertyDescriptor,ft="enumerable",vt="configurable",dt="writable";Je.f=ki?Fi?function(t,r,n){if(_e(t),r=Cr(r),_e(n),typeof t=="function"&&r==="prototype"&&"value"in n&&dt in n&&!n[dt]){var o=Vi(t,r);o&&o[dt]&&(t[r]=n.value,n={configurable:vt in n?n[vt]:o[vt],enumerable:ft in n?n[ft]:o[ft],writable:!1})}return lt(t,r,n)}:lt:function(t,r,n){if(_e(t),r=Cr(r),_e(n),Mi)try{return lt(t,r,n)}catch(o){}if("get"in n||"set"in n)throw Bi("Accessors not supported");return"value"in n&&(t[r]=n.value),t};var Hi=ae,Ki=Je,Wi=jn,Xe=Hi?function(e,t,r){return Ki.f(e,t,Wi(1,r))}:function(e,t,r){return e[t]=r,e},Te=y,Gi=Pn,qi=An,zi=h,Qi=qt.f,Yi=Qn,z=Mn,Ji=Ye,Q=Xe,Nr=ie,Xi=function(e){var t=function(r,n,o){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,o)}return Gi(e,this,arguments)};return t.prototype=e.prototype,t},G=function(e,t){var r=e.target,n=e.global,o=e.stat,i=e.proto,s=n?Te:o?Te[r]:(Te[r]||{}).prototype,f=n?z:z[r]||Q(z,r,{})[r],l=f.prototype,c,a,u,v,d,p,U,C,q;for(v in t)c=Yi(n?v:r+(o?".":"#")+v,e.forced),a=!c&&s&&Nr(s,v),p=f[v],a&&(e.dontCallGetSet?(q=Qi(s,v),U=q&&q.value):U=s[v]),d=a&&U?U:t[v],!(a&&typeof p==typeof d)&&(e.bind&&a?C=Ji(d,Te):e.wrap&&a?C=Xi(d):i&&zi(d)?C=qi(d):C=d,(e.sham||d&&d.sham||p&&p.sham)&&Q(C,"sham",!0),Q(f,v,C),i&&(u=r+"Prototype",Nr(z,u)||Q(z,u,{}),Q(z[u],v,d),e.real&&l&&(c||!l[v])&&Q(l,v,d)))},Zi=Ge,Ze=typeof process!="undefined"&&Zi(process)=="process",es=Xe,Jt=function(e,t,r,n){return n&&n.enumerable?e[t]=r:es(e,t,r),e},ts=h,rs=String,ns=TypeError,os=function(e){if(typeof e=="object"||ts(e))return e;throw ns("Can't set "+rs(e)+" as a prototype")},as=I,is=W,ss=os,cs=Object.setPrototypeOf||("__proto__"in{}?function(){var e=!1,t={},r;try{r=as(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),r(t,[]),e=t instanceof Array}catch(n){}return function(o,i){return is(o),ss(i),e?r(o,i):o.__proto__=i,o}}():void 0),us=A,ls=us("toStringTag"),Yn={};Yn[ls]="z";var Xt=String(Yn)==="[object z]",fs=Xt,vs=h,De=Ge,ds=A,hs=ds("toStringTag"),ps=Object,gs=De(function(){return arguments}())=="Arguments",ys=function(e,t){try{return e[t]}catch(r){}},Zt=fs?De:function(e){var t,r,n;return e===void 0?"Undefined":e===null?"Null":typeof(r=ys(t=ps(e),hs))=="string"?r:gs?De(t):(n=De(t))=="Object"&&vs(t.callee)?"Arguments":n},bs=Xt,$s=Zt,ms=bs?{}.toString:function(){return"[object "+$s(this)+"]"},Ss=Xt,Es=Je.f,_s=Xe,Ts=ie,Os=ms,Ps=A,Dr=Ps("toStringTag"),ws=function(e,t,r,n){if(e){var o=r?e:e.prototype;Ts(o,Dr)||Es(o,Dr,{configurable:!0,value:t}),n&&!Ss&&_s(o,"toString",Os)}},Is=j,Rs=Je,As=A,Cs=ae,Lr=As("species"),Ns=function(e){var t=Is(e),r=Rs.f;Cs&&t&&!t[Lr]&&r(t,Lr,{configurable:!0,get:function(){return this}})},Ds=zt,Ls=TypeError,xs=function(e,t){if(Ds(t,e))return e;throw Ls("Incorrect invocation")},js=I,Us=h,xt=Yt,ks=js(Function.toString);Us(xt.inspectSource)||(xt.inspectSource=function(e){return ks(e)});var Jn=xt.inspectSource,Ms=I,Fs=w,Xn=h,Bs=Zt,Vs=j,Hs=Jn,Zn=function(){},Ks=[],eo=Vs("Reflect","construct"),er=/^\s*(?:class|function)\b/,Ws=Ms(er.exec),Gs=!er.exec(Zn),fe=function(t){if(!Xn(t))return!1;try{return eo(Zn,Ks,t),!0}catch(r){return!1}},to=function(t){if(!Xn(t))return!1;switch(Bs(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Gs||!!Ws(er,Hs(t))}catch(r){return!0}};to.sham=!0;var qs=!eo||Fs(function(){var e;return fe(fe.call)||!fe(Object)||!fe(function(){e=!0})||e})?to:fe,zs=qs,Qs=Qe,Ys=TypeError,Js=function(e){if(zs(e))return e;throw Ys(Qs(e)+" is not a constructor")},xr=W,Xs=Js,Zs=qe,ec=A,tc=ec("species"),ro=function(e,t){var r=xr(e).constructor,n;return r===void 0||Zs(n=xr(r)[tc])?t:Xs(n)},rc=j,nc=rc("document","documentElement"),oc=I,ac=oc([].slice),ic=TypeError,sc=function(e,t){if(e<t)throw ic("Not enough arguments");return e},cc=ze,no=/(?:ipad|iphone|ipod).*applewebkit/i.test(cc),b=y,uc=Pn,lc=Ye,jr=h,fc=ie,oo=w,Ur=nc,vc=ac,kr=qn,dc=sc,hc=no,pc=Ze,jt=b.setImmediate,Ut=b.clearImmediate,gc=b.process,ht=b.Dispatch,yc=b.Function,Mr=b.MessageChannel,bc=b.String,pt=0,de={},Fr="onreadystatechange",ge,k,gt,yt;oo(function(){ge=b.location});var tr=function(e){if(fc(de,e)){var t=de[e];delete de[e],t()}},bt=function(e){return function(){tr(e)}},Br=function(e){tr(e.data)},Vr=function(e){b.postMessage(bc(e),ge.protocol+"//"+ge.host)};(!jt||!Ut)&&(jt=function(t){dc(arguments.length,1);var r=jr(t)?t:yc(t),n=vc(arguments,1);return de[++pt]=function(){uc(r,void 0,n)},k(pt),pt},Ut=function(t){delete de[t]},pc?k=function(e){gc.nextTick(bt(e))}:ht&&ht.now?k=function(e){ht.now(bt(e))}:Mr&&!hc?(gt=new Mr,yt=gt.port2,gt.port1.onmessage=Br,k=lc(yt.postMessage,yt)):b.addEventListener&&jr(b.postMessage)&&!b.importScripts&&ge&&ge.protocol!=="file:"&&!oo(Vr)?(k=Vr,b.addEventListener("message",Br,!1)):Fr in kr("script")?k=function(e){Ur.appendChild(kr("script"))[Fr]=function(){Ur.removeChild(this),tr(e)}}:k=function(e){setTimeout(bt(e),0)});var ao={set:jt,clear:Ut},io=function(){this.head=null,this.tail=null};io.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e){var t=this.head=e.next;return t===null&&(this.tail=null),e.item}}};var so=io,$c=ze,mc=/ipad|iphone|ipod/i.test($c)&&typeof Pebble!="undefined",Sc=ze,Ec=/web0s(?!.*chrome)/i.test(Sc),V=y,Hr=Ye,_c=qt.f,$t=ao.set,Tc=so,Oc=no,Pc=mc,wc=Ec,mt=Ze,Kr=V.MutationObserver||V.WebKitMutationObserver,Wr=V.document,Gr=V.process,Oe=V.Promise,qr=_c(V,"queueMicrotask"),kt=qr&&qr.value,Y,St,Et,Pe,zr;if(!kt){var we=new Tc,Ie=function(){var e,t;for(mt&&(e=Gr.domain)&&e.exit();t=we.get();)try{t()}catch(r){throw we.head&&Y(),r}e&&e.enter()};!Oc&&!mt&&!wc&&Kr&&Wr?(St=!0,Et=Wr.createTextNode(""),new Kr(Ie).observe(Et,{characterData:!0}),Y=function(){Et.data=St=!St}):!Pc&&Oe&&Oe.resolve?(Pe=Oe.resolve(void 0),Pe.constructor=Oe,zr=Hr(Pe.then,Pe),Y=function(){zr(Ie)}):mt?Y=function(){Gr.nextTick(Ie)}:($t=Hr($t,V),Y=function(){$t(Ie)}),kt=function(e){we.head||Y(),we.add(e)}}var Ic=kt,Rc=function(e,t){try{arguments.length==1?console.error(e):console.error(e,t)}catch(r){}},rr=function(e){try{return{error:!1,value:e()}}catch(t){return{error:!0,value:t}}},Ac=y,Cc=h,Qr=Ac.WeakMap,Nc=Cc(Qr)&&/native code/.test(String(Qr)),Dc=Ue,Lc=Wn,Yr=Dc("keys"),xc=function(e){return Yr[e]||(Yr[e]=Lc(e))},jc={},Uc=Nc,co=y,kc=H,Mc=Xe,_t=ie,Tt=Yt,Fc=xc,Bc=jc,Jr="Object already initialized",Mt=co.TypeError,Vc=co.WeakMap,ke,ye,Me,Hc=function(e){return Me(e)?ye(e):ke(e,{})},Kc=function(e){return function(t){var r;if(!kc(t)||(r=ye(t)).type!==e)throw Mt("Incompatible receiver, "+e+" required");return r}};if(Uc||Tt.state){var P=Tt.state||(Tt.state=new Vc);P.get=P.get,P.has=P.has,P.set=P.set,ke=function(e,t){if(P.has(e))throw Mt(Jr);return t.facade=e,P.set(e,t),t},ye=function(e){return P.get(e)||{}},Me=function(e){return P.has(e)}}else{var J=Fc("state");Bc[J]=!0,ke=function(e,t){if(_t(e,J))throw Mt(Jr);return t.facade=e,Mc(e,J,t),t},ye=function(e){return _t(e,J)?e[J]:{}},Me=function(e){return _t(e,J)}}var Wc={set:ke,get:ye,has:Me,enforce:Hc,getterFor:Kc},Gc=y,se=Gc.Promise,uo=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",qc=uo,zc=Ze,Qc=!qc&&!zc&&typeof window=="object"&&typeof document=="object",Yc=y,he=se,Jc=h,Xc=Qn,Zc=Jn,eu=A,tu=Qc,ru=uo,nu=be,Ot=Bn,Xr=he&&he.prototype,ou=eu("species"),Ft=!1,lo=Jc(Yc.PromiseRejectionEvent),au=Xc("Promise",function(){var e=Zc(he),t=e!==String(he);if(!t&&Ot===66||nu&&!(Xr.catch&&Xr.finally))return!0;if(!Ot||Ot<51||!/native code/.test(e)){var r=new he(function(i){i(1)}),n=function(i){i(function(){},function(){})},o=r.constructor={};if(o[ou]=n,Ft=r.then(function(){})instanceof n,!Ft)return!0}return!t&&(tu||ru)&&!lo}),me={CONSTRUCTOR:au,REJECTION_EVENT:lo,SUBCLASSING:Ft},ce={},Zr=K,iu=TypeError,su=function(e){var t,r;this.promise=new e(function(n,o){if(t!==void 0||r!==void 0)throw iu("Bad Promise constructor");t=n,r=o}),this.resolve=Zr(t),this.reject=Zr(r)};ce.f=function(e){return new su(e)};var cu=G,uu=be,Fe=Ze,x=y,oe=R,en=Jt,tn=cs,lu=ws,fu=Ns,vu=K,Le=h,du=H,hu=xs,pu=ro,fo=ao.set,nr=Ic,gu=Rc,yu=rr,bu=so,vo=Wc,Be=se,or=me,ho=ce,et="Promise",po=or.CONSTRUCTOR,$u=or.REJECTION_EVENT,mu=or.SUBCLASSING,Pt=vo.getterFor(et),Su=vo.set,X=Be&&Be.prototype,M=Be,Re=X,go=x.TypeError,Bt=x.document,ar=x.process,Vt=ho.f,Eu=Vt,_u=!!(Bt&&Bt.createEvent&&x.dispatchEvent),yo="unhandledrejection",Tu="rejectionhandled",rn=0,bo=1,Ou=2,ir=1,$o=2,Ae,nn,Pu,on,mo=function(e){var t;return du(e)&&Le(t=e.then)?t:!1},So=function(e,t){var r=t.value,n=t.state==bo,o=n?e.ok:e.fail,i=e.resolve,s=e.reject,f=e.domain,l,c,a;try{o?(n||(t.rejection===$o&&Iu(t),t.rejection=ir),o===!0?l=r:(f&&f.enter(),l=o(r),f&&(f.exit(),a=!0)),l===e.promise?s(go("Promise-chain cycle")):(c=mo(l))?oe(c,l,i,s):i(l)):s(r)}catch(u){f&&!a&&f.exit(),s(u)}},Eo=function(e,t){e.notified||(e.notified=!0,nr(function(){for(var r=e.reactions,n;n=r.get();)So(n,e);e.notified=!1,t&&!e.rejection&&wu(e)}))},_o=function(e,t,r){var n,o;_u?(n=Bt.createEvent("Event"),n.promise=t,n.reason=r,n.initEvent(e,!1,!0),x.dispatchEvent(n)):n={promise:t,reason:r},!$u&&(o=x["on"+e])?o(n):e===yo&&gu("Unhandled promise rejection",r)},wu=function(e){oe(fo,x,function(){var t=e.facade,r=e.value,n=an(e),o;if(n&&(o=yu(function(){Fe?ar.emit("unhandledRejection",r,t):_o(yo,t,r)}),e.rejection=Fe||an(e)?$o:ir,o.error))throw o.value})},an=function(e){return e.rejection!==ir&&!e.parent},Iu=function(e){oe(fo,x,function(){var t=e.facade;Fe?ar.emit("rejectionHandled",t):_o(Tu,t,e.value)})},te=function(e,t,r){return function(n){e(t,n,r)}},ne=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=Ou,Eo(e,!0))},Ht=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw go("Promise can't be resolved itself");var n=mo(t);n?nr(function(){var o={done:!1};try{oe(n,t,te(Ht,o,e),te(ne,o,e))}catch(i){ne(o,i,e)}}):(e.value=t,e.state=bo,Eo(e,!1))}catch(o){ne({done:!1},o,e)}}};if(po&&(M=function(t){hu(this,Re),vu(t),oe(Ae,this);var r=Pt(this);try{t(te(Ht,r),te(ne,r))}catch(n){ne(r,n)}},Re=M.prototype,Ae=function(t){Su(this,{type:et,done:!1,notified:!1,parent:!1,reactions:new bu,rejection:!1,state:rn,value:void 0})},Ae.prototype=en(Re,"then",function(t,r){var n=Pt(this),o=Vt(pu(this,M));return n.parent=!0,o.ok=Le(t)?t:!0,o.fail=Le(r)&&r,o.domain=Fe?ar.domain:void 0,n.state==rn?n.reactions.add(o):nr(function(){So(o,n)}),o.promise}),nn=function(){var e=new Ae,t=Pt(e);this.promise=e,this.resolve=te(Ht,t),this.reject=te(ne,t)},ho.f=Vt=function(e){return e===M||e===Pu?new nn(e):Eu(e)},!uu&&Le(Be)&&X!==Object.prototype)){on=X.then,mu||en(X,"then",function(t,r){var n=this;return new M(function(o,i){oe(on,n,o,i)}).then(t,r)},{unsafe:!0});try{delete X.constructor}catch(e){}tn&&tn(X,Re)}cu({global:!0,constructor:!0,wrap:!0,forced:po},{Promise:M});lu(M,et,!1,!0);fu(et);var To={},Ru=A,Au=To,Cu=Ru("iterator"),Nu=Array.prototype,Du=function(e){return e!==void 0&&(Au.Array===e||Nu[Cu]===e)},Lu=Math.ceil,xu=Math.floor,ju=Math.trunc||function(t){var r=+t;return(r>0?xu:Lu)(r)},Uu=ju,ku=function(e){var t=+e;return t!==t||t===0?0:Uu(t)},Mu=ku,Fu=Math.min,Bu=function(e){return e>0?Fu(Mu(e),9007199254740991):0},Vu=Bu,Hu=function(e){return Vu(e.length)},Ku=Zt,sn=Qt,Wu=qe,Gu=To,qu=A,zu=qu("iterator"),Oo=function(e){if(!Wu(e))return sn(e,zu)||sn(e,"@@iterator")||Gu[Ku(e)]},Qu=R,Yu=K,Ju=W,Xu=Qe,Zu=Oo,el=TypeError,tl=function(e,t){var r=arguments.length<2?Zu(e):t;if(Yu(r))return Ju(Qu(r,e));throw el(Xu(e)+" is not iterable")},rl=R,cn=W,nl=Qt,ol=function(e,t,r){var n,o;cn(e);try{if(n=nl(e,"return"),!n){if(t==="throw")throw r;return r}n=rl(n,e)}catch(i){o=!0,n=i}if(t==="throw")throw r;if(o)throw n;return cn(n),r},al=Ye,il=R,sl=W,cl=Qe,ul=Du,ll=Hu,un=zt,fl=tl,vl=Oo,ln=ol,dl=TypeError,xe=function(e,t){this.stopped=e,this.result=t},fn=xe.prototype,Po=function(e,t,r){var n=r&&r.that,o=!!(r&&r.AS_ENTRIES),i=!!(r&&r.IS_RECORD),s=!!(r&&r.IS_ITERATOR),f=!!(r&&r.INTERRUPTED),l=al(t,n),c,a,u,v,d,p,U,C=function($){return c&&ln(c,"normal",$),new xe(!0,$)},q=function($){return o?(sl($),f?l($[0],$[1],C):l($[0],$[1])):f?l($,C):l($)};if(i)c=e.iterator;else if(s)c=e;else{if(a=vl(e),!a)throw dl(cl(e)+" is not iterable");if(ul(a)){for(u=0,v=ll(e);v>u;u++)if(d=q(e[u]),d&&un(fn,d))return d;return new xe(!1)}c=fl(e,a)}for(p=i?e.next:c.next;!(U=il(p,c)).done;){try{d=q(U.value)}catch($){ln(c,"throw",$)}if(typeof d=="object"&&d&&un(fn,d))return d}return new xe(!1)},hl=A,wo=hl("iterator"),Io=!1;try{var pl=0,vn={next:function(){return{done:!!pl++}},return:function(){Io=!0}};vn[wo]=function(){return this},Array.from(vn,function(){throw 2})}catch(e){}var gl=function(e,t){if(!t&&!Io)return!1;var r=!1;try{var n={};n[wo]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(o){}return r},yl=se,bl=gl,$l=me.CONSTRUCTOR,Ro=$l||!bl(function(e){yl.all(e).then(void 0,function(){})}),ml=G,Sl=R,El=K,_l=ce,Tl=rr,Ol=Po,Pl=Ro;ml({target:"Promise",stat:!0,forced:Pl},{all:function(t){var r=this,n=_l.f(r),o=n.resolve,i=n.reject,s=Tl(function(){var f=El(r.resolve),l=[],c=0,a=1;Ol(t,function(u){var v=c++,d=!1;a++,Sl(f,r,u).then(function(p){d||(d=!0,l[v]=p,--a||o(l))},i)}),--a||o(l)});return s.error&&i(s.value),n.promise}});var wl=G,Il=be,Rl=me.CONSTRUCTOR,Kt=se,Al=j,Cl=h,Nl=Jt,dn=Kt&&Kt.prototype;wl({target:"Promise",proto:!0,forced:Rl,real:!0},{catch:function(e){return this.then(void 0,e)}});if(!Il&&Cl(Kt)){var hn=Al("Promise").prototype.catch;dn.catch!==hn&&Nl(dn,"catch",hn,{unsafe:!0})}var Dl=G,Ll=R,xl=K,jl=ce,Ul=rr,kl=Po,Ml=Ro;Dl({target:"Promise",stat:!0,forced:Ml},{race:function(t){var r=this,n=jl.f(r),o=n.reject,i=Ul(function(){var s=xl(r.resolve);kl(t,function(f){Ll(s,r,f).then(n.resolve,o)})});return i.error&&o(i.value),n.promise}});var Fl=G,Bl=R,Vl=ce,Hl=me.CONSTRUCTOR;Fl({target:"Promise",stat:!0,forced:Hl},{reject:function(t){var r=Vl.f(this);return Bl(r.reject,void 0,t),r.promise}});var Kl=W,Wl=H,Gl=ce,Ao=function(e,t){if(Kl(e),Wl(t)&&t.constructor===e)return t;var r=Gl.f(e),n=r.resolve;return n(t),r.promise},ql=G,zl=j,Co=be,Ql=se,No=me.CONSTRUCTOR,Yl=Ao,Jl=zl("Promise"),Xl=Co&&!No;ql({target:"Promise",stat:!0,forced:Co||No},{resolve:function(t){return Yl(Xl&&this===Jl?Ql:this,t)}});var Zl=G,ef=be,Ve=se,tf=w,Do=j,Lo=h,rf=ro,pn=Ao,nf=Jt,Wt=Ve&&Ve.prototype,of=!!Ve&&tf(function(){Wt.finally.call({then:function(){}},function(){})});Zl({target:"Promise",proto:!0,real:!0,forced:of},{finally:function(e){var t=rf(this,Do("Promise")),r=Lo(e);return this.then(r?function(n){return pn(t,e()).then(function(){return n})}:e,r?function(n){return pn(t,e()).then(function(){throw n})}:e)}});if(!ef&&Lo(Ve)){var gn=Do("Promise").prototype.finally;Wt.finally!==gn&&nf(Wt,"finally",gn,{unsafe:!0})}var af=j,sf=af,cf=sf,uf=cf("Promise","finally"),lf=uf,ff=lf,vf=ff,df=vf,wt=df;function hf(){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),t=new Array(36);let r=0,n,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?t[o]="-":o===14?t[o]="4":(r<=2&&(r=33554432+Math.random()*16777216|0),n=r&15,r=r>>4,t[o]=e[o===19?n&3|8:n]);return t.join("")}var D;(function(e){e.PROD="prod",e.VK_ALIAS="vk_alias",e.VIDEOTEST="videotest",e.TEST="test",e.AUTO="auto"})(D||(D={}));var m;(function(e){e.Q144P="mobile",e.Q240P="lowest",e.Q360P="low",e.Q480P="medium",e.Q720P="high",e.Q1080P="fullhd",e.Q1440P="quadhd",e.Q2160P="ultrahd",e.UNKNOWN="unknown"})(m||(m={}));var S;(function(e){e.MP4="mp4",e.DASH="dash",e.DASH_SEP="dash_sep",e.ONDEMAND_DASH="ondemand_dash",e.HLS="hls",e.ONDEMAND_HLS="ondemand_hls",e.WEBM="webm",e.ONDEMAND_DASH_LIVE="ondemand_dash_live",e.ONDEMAND_HLS_LIVE="ondemand_hls_live",e.WEBRTC="webrtc",e.UNKNOWN="unknown",e.RTMP="rtmp"})(S||(S={}));var He;(function(e){e.AUTO="auto",e.MANUAL=""})(He||(He={}));var pe;(function(e){e.HTTP1="http1",e.HTTP2="http2",e.HTTP3="http3"})(pe||(pe={}));var N;(function(e){e[e.YES=1]="YES",e[e.NO=0]="NO"})(N||(N={}));var re;(function(e){e.EXCELLENT="excellent",e.GOOD="good",e.POOR="poor"})(re||(re={}));var B;(function(e){e.PIP="pip",e.FULLSCREEN="fullscreen",e.EXTERNAL="external",e.PREFETCH="prefetch"})(B||(B={}));var Ke;(function(e){e.SLIDER="slider",e.DOUBLE_TAP="double_tap",e.TIME_CODE="time_code",e.EPISODE="episode",e.REWIND="rewind",e.LIVE="live",e.UNKNOWN="unknown"})(Ke||(Ke={}));const yn="1.0.35",pf="CIOPGQJGDIHBABABA",xo={[D.PROD]:"https://api.ok.ru",[D.VK_ALIAS]:"https://api.mycdn.me",[D.VIDEOTEST]:"https://videotestapi.ok.ru/api",[D.TEST]:"https://apitest.ok.ru",[D.AUTO]:""},gf="_one-stat_",bn=`${gf}uuid`,yf={start:1e3,factor:1.5,max:5*60*1e3,random:.1};var F;(function(e){e[e.PARAM_SESSION_EXPIRED=102]="PARAM_SESSION_EXPIRED",e[e.PARAM_SESSION_KEY=103]="PARAM_SESSION_KEY",e[e.PARAM_SIGNATURE=104]="PARAM_SIGNATURE",e[e.AUTH_LOGIN=401]="AUTH_LOGIN"})(F||(F={}));class bf{constructor(t){this.consequentAuthErrors=0,this.authorized$=new Gt(!1),this.params=t;const r=Z.get(bn);r?this.uuid=String(r):(this.uuid=hf(),Z.set(bn,this.uuid))}authorize(t){return L(this,void 0,void 0,function*(){return this.authToken=t!=null?t:yield this.refreshAuthToken(),this._authorizeWithBackoff()})}logBeacon(t){const r="log.externalLog",n=this.createLogParams(t),o=this.sessionKey;if(!o)return;this.params.apiTransport.sendBeacon(r,n,o)||this.logRequest(t)}logRequest(t){var r;return L(this,void 0,void 0,function*(){const n="log.externalLog",o=this.createLogParams(t),i=(r=this.sessionKey)!==null&&r!==void 0?r:yield this._authorizeWithBackoff();if(!i)return;const s=(f,l=this.params.requestRetryCount)=>L(this,void 0,void 0,function*(){try{return yield this.params.apiTransport.sendRequest(n,o,i)}catch(c){if(!c||!("error_code"in c)){this.params.error$.next({id:"logRequestUnknown",category:_.NETWORK,message:`Unknown ${n} error`,thrown:c});return}const a=c==null?void 0:c.error_code;switch(a){case F.PARAM_SESSION_EXPIRED:case F.PARAM_SESSION_KEY:case F.PARAM_SIGNATURE:return this.authorized$.next(!1),this.sessionKey=yield this._authorizeWithBackoff(),l>0?s(f,l-1):void 0;case F.AUTH_LOGIN:return this.authorized$.next(!1),this.authToken=yield this.refreshAuthToken(),this.sessionKey=yield this._authorizeWithBackoff(),l>0?s(f,l-1):void 0;default:{this.params.error$.next({id:`LogRequest#${a}`,category:_.EXTERNAL_API,message:`${n} error`,data:c});return}}}});return s(t)})}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}refreshAuthToken(){return L(this,void 0,void 0,function*(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=wt(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise})}createLogParams(t){return{collector:"ok.mobile.apps.video",data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${yn}`,platform:this.params.mobile?"M_WEB":"WEB",items:t})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();const t=Mo(this.consequentAuthErrors,yf);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{wt(this._authorize().then(r).catch(n=>this.params.error$.next({id:"AuthorizeBackoff",category:_.NETWORK,message:"Otherwise unhandled error in authorization",thrown:n})),()=>this.backoffTimeoutId=0)},t))})}_authorize(){return L(this,void 0,void 0,function*(){if(this.authorizePromise)return this.authorizePromise;this.sessionKey=void 0,this.authorized$.next(!1);const t="auth.anonymLogin",r={session_data:{version:2,device_id:this.uuid,client_version:yn.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=wt(this.params.apiTransport.sendRequest(t,r).then(n=>{var o;return(!n||!n.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:_.EXTERNAL_API,message:"No session key",data:n}),this.sessionKey=(o=n==null?void 0:n.session_key)!==null&&o!==void 0?o:void 0,this.sessionKey}).catch(n=>L(this,void 0,void 0,function*(){this.sessionKey=void 0;const o=n==null?void 0:n.error_code;switch(o){case F.AUTH_LOGIN:return this.authToken=yield this.refreshAuthToken(),this._authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:_.EXTERNAL_API,message:"authorize error",data:n}):this.params.error$.next({id:"AuthorizeUnknown",category:_.NETWORK,message:"authorize error",thrown:n})})),()=>{this.authorizePromise=void 0,this.consequentAuthErrors=this.sessionKey?0:this.consequentAuthErrors+1,this.authorized$.next(this.sessionKey!==void 0)}),this.authorizePromise})}}class $n{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(t,r,n){t in this.listeners||(this.listeners[t]=[]),this.listeners[t].push({callback:r,options:n})}removeEventListener(t,r){if(!(t in this.listeners))return;const n=this.listeners[t];for(let o=0,i=n.length;o<i;o++)if(n[o].callback===r){n.splice(o,1);return}}dispatchEvent(t){if(!(t.type in this.listeners))return;const n=this.listeners[t.type].slice();for(let o=0,i=n.length;o<i;o++){const s=n[o];try{s.callback.call(this,t)}catch(f){Promise.resolve().then(()=>{throw f})}s.options&&s.options.once&&this.removeEventListener(t.type,s.callback)}return!t.defaultPrevented}}class jo extends $n{constructor(){super(),this.listeners||$n.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(t){t.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,t)),super.dispatchEvent(t)}}class $f{constructor(){Object.defineProperty(this,"signal",{value:new jo,writable:!0,configurable:!0})}abort(t){let r;try{r=new Event("abort")}catch(o){typeof document!="undefined"?document.createEvent?(r=document.createEvent("Event"),r.initEvent("abort",!1,!1)):(r=document.createEventObject(),r.type="abort"):r={type:"abort",bubbles:!1,cancelable:!1}}let n=t;if(n===void 0)if(typeof document=="undefined")n=new Error("This operation was aborted"),n.name="AbortError";else try{n=new DOMException("signal is aborted without reason")}catch(o){n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(r)}toString(){return"[object AbortController]"}}typeof Symbol!="undefined"&&Symbol.toStringTag&&($f.prototype[Symbol.toStringTag]="AbortController",jo.prototype[Symbol.toStringTag]="AbortSignal");function Uo(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function mf(e){typeof e=="function"&&(e={fetch:e});const{fetch:t,Request:r=t.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=e;if(!Uo({fetch:t,Request:r,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o}))return{fetch:t,Request:i};let i=r;(i&&!i.prototype.hasOwnProperty("signal")||o)&&(i=function(c,a){let u;a&&a.signal&&(u=a.signal,delete a.signal);const v=new r(c,a);return u&&Object.defineProperty(v,"signal",{writable:!1,enumerable:!1,configurable:!0,value:u}),v},i.prototype=r.prototype);const s=t;return{fetch:(l,c)=>{const a=i&&i.prototype.isPrototypeOf(l)?l.signal:c?c.signal:void 0;if(a){let u;try{u=new DOMException("Aborted","AbortError")}catch(d){u=new Error("Aborted"),u.name="AbortError"}if(a.aborted)return Promise.reject(u);const v=new Promise((d,p)=>{a.addEventListener("abort",()=>p(u),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([v,s(l,c)])}return s(l,c)},Request:i}}const sr=Uo({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),ko=sr?mf({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,mn=sr?ko.fetch:window.fetch;sr?ko.Request:window.Request;class Sf{constructor(t){this.params=t,this.apiKey=t.apiKey,this.apiEnv=t.apiEnv,this.apiBaseUrl=t.apiBaseUrl,this.timeSynchronisation=t.timeSynchronisation,this.isApiBaseUrlFetched=!1}resolveApiBaseUrl(){var t;return L(this,void 0,void 0,function*(){if(this.apiEnv!==D.AUTO||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{const r=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=yield(yield mn(r,{method:"GET",mode:"cors",cache:"no-cache"})).json(),i=(t=o==null?void 0:o.Answer[0])===null||t===void 0?void 0:t.data;if(!i)throw new Error("Wrong DNS response");return i}catch(r){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:_.NETWORK,message:"Unhandled resolve api base url error",thrown:r}),xo[D.VK_ALIAS]}finally{this.isApiBaseUrlFetched=!0}})}sendBeacon(t,r,n){if(!window.Blob||!window.navigator.sendBeacon)return!1;const o=this._prepareQueryParams({method:t,queryParams:r,sessionKey:n}),i=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,i)}catch(s){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:_.NETWORK,message:"Unhandled beacon error",thrown:s,data:{method:t,params:r}})}return!1}sendRequest(t,r,n){return L(this,void 0,void 0,function*(){const o=E(),i=s=>{if(s instanceof TypeError&&["Failed to fetch","NetworkError when attempting to fetch resource."].includes(s.message)){this.params.error$.next({id:"Network",category:_.NETWORK,message:"Request failed",thrown:s});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:_.NETWORK,message:"Unhandled request error",thrown:s,data:{method:t,params:r,sessionKey:n,time:E()-o}})};return this.apiBaseUrl=yield this.resolveApiBaseUrl(),mn(`${this.apiBaseUrl}/fb.do`,{method:"post",headers:{"Content-type":"application/x-www-form-urlencoded"},body:this._prepareQueryParams({method:t,queryParams:r,sessionKey:n})}).then(s=>{var f;const l=Number(s.headers.get("content-length"))===0,c=new Date((f=s.headers.get("date"))!==null&&f!==void 0?f:"").getTime(),a=E()-o;if(isFinite(c)&&this.timeSynchronisation.addServerTime(c,a),!l)return s.json().then(u=>Object.prototype.hasOwnProperty.call(u,"error_msg")?Promise.reject(u):u,i)},i)})}_prepareQueryParams(t){const r=new URLSearchParams({format:"JSON",method:t.method,application_key:this.apiKey});return t.sessionKey!==void 0&&r.append("session_key",t.sessionKey),Object.entries(t.queryParams).forEach(([n,o])=>r.append(n,typeof o=="string"?o:JSON.stringify(o))),r}}const Sn=5e3,Ef=1e4,_f=6e4,Ce="onestat_events",Tf=36*60*60*1e3,It=e=>e.timestamp+Tf>=E();class Of{constructor(t){this.unsaltedStorage=[],this.isPaused=!1,this.isUrgent=r=>{const{operation:n,custom:{param:o}}=r;return["action_stop","close_at_empty_buffer"].includes(n)||n==="watch_coverage_record"&&o==="0-0"},this.firstFlush=lr(()=>this.safeFlush(),Sn,{maxWait:Sn}),this.debouncedFlush=lr(()=>this.safeFlush(),Ef,{maxWait:_f}),this.api=t.api,this.error$=t.error$,this.userSalt=t.userSalt,this.subscription=this.api.authorized$.subscribe(r=>{r&&this.debouncedFlush()}),this.housekeepStorage()}safeFlush(){var t;try{this.flush()}catch(r){this.error$.next({id:"LoggerError",category:_.WTF,message:(t=String(r))!==null&&t!==void 0?t:"Unknown logger error",thrown:r})}}readFromStorage(){const t=Z.get(Ce);try{return t?JSON.parse(t):{}}catch(r){}return{}}addToStorage(t){var r;if(!this.userSalt){this.unsaltedStorage.push(t);return}const n=this.readFromStorage(),i=((r=n[this.userSalt])!==null&&r!==void 0?r:[]).filter(It);Z.set(Ce,JSON.stringify(Object.assign(Object.assign({},n),{[this.userSalt]:[...i,t]})))}getFromStorage(){var t;return this.userSalt?((t=this.readFromStorage()[this.userSalt])!==null&&t!==void 0?t:[]).filter(It):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}const t=this.readFromStorage();delete t[this.userSalt],Z.set(Ce,JSON.stringify(t))}housekeepStorage(){const t=this.readFromStorage();for(const[r,n]of Object.entries(t)){const o=n.filter(It);o.length?t[r]=o:delete t[r]}Z.set(Ce,JSON.stringify(t))}log(t){this.addToStorage(t),!this.isPaused&&(this.isUrgent(t)?this.flush():this.lastVsid!==t.custom.vsid?this.firstFlush():this.debouncedFlush(),this.lastVsid=t.custom.vsid)}flush(t=!1){const r=this.getFromStorage();r.length!==0&&(this.api.authorized$.getValue()?(t?this.api.logBeacon(r):this.api.logRequest(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()}}const Pf=()=>{let e,t;try{e=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?e=!0:(e=!1,console.error(n))}try{window.location.ancestorOrigins&&(t=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!t&&document.referrer&&(t=document.referrer)}catch(n){console.error(n)}const r=t?new URL(t).hostname:void 0;return{isEmbed:e,host:r}},wf=e=>e&&{[O.INVARIANT]:m.UNKNOWN,[O.Q_144P]:m.Q144P,[O.Q_240P]:m.Q240P,[O.Q_360P]:m.Q360P,[O.Q_480P]:m.Q480P,[O.Q_720P]:m.Q720P,[O.Q_1080P]:m.Q1080P,[O.Q_1440P]:m.Q1440P,[O.Q_2160P]:m.Q2160P,[O.Q_4320P]:m.UNKNOWN}[e],En=e=>e&&{[tt.HTTP1]:pe.HTTP1,[tt.HTTP2]:pe.HTTP2,[tt.QUIC]:pe.HTTP3}[e],If=e=>{if(e!==void 0)switch(e){case g.MPEG:return S.MP4;case g.DASH:case g.DASH_LIVE:return S.DASH;case g.DASH_SEP:return S.DASH_SEP;case g.DASH_ONDEMAND:return S.ONDEMAND_DASH;case g.DASH_WEBM:case g.DASH_WEBM_AV1:case g.DASH_LIVE_WEBM:return S.WEBM;case g.DASH_LIVE_CMAF:return S.ONDEMAND_DASH_LIVE;case g.HLS:case g.HLS_LIVE:return S.HLS;case g.HLS_ONDEMAND:return S.ONDEMAND_HLS;case g.HLS_LIVE_CMAF:return S.ONDEMAND_HLS_LIVE;case g.WEB_RTC_LIVE:return S.WEBRTC;default:return Tn(e)}},Rt=e=>{if(e!==void 0)switch(e){case le.NONE:case le.INLINE:return;case le.FULLSCREEN:return B.FULLSCREEN;case le.SECOND_SCREEN:return B.EXTERNAL;case le.PIP:return B.PIP;default:return Tn(e)}},Rf=e=>{switch(e){case"slow-2g":return re.POOR;case"2g":return re.POOR;case"3g":return re.GOOD;case"4g":return re.EXCELLENT}};class Af{constructor(t){this.offset=void 0,this.offset=t}getOffset(){var t;return(t=this.offset)!==null&&t!==void 0?t:0}setOffset(t){this.offset=t}now(){var t;return Date.now()+((t=this.offset)!==null&&t!==void 0?t:0)}date(t=new Date){var r;return t.setTime(t.getTime()+((r=this.offset)!==null&&r!==void 0?r:0)),t}addServerTime(t,r){const n=Date.now(),o=t-n-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)}}const _n=()=>Math.floor(Math.random()*Math.pow(2,32)).toString(36).padStart(8,"0"),Cf=e=>new Fo(t=>{const r=new ve,n=Ne(At(window,"beforeunload"),e.events.willDestruct$),o=new Gt(void 0);let i;e.info.isLive$.pipe(Bo()).subscribe(d=>{i&&(i.unsubscribe(),o.next(void 0)),d?i=e.info.liveTime$.pipe(Vo(p=>p&&p/1e3)).subscribe(o):i=e.info.position$.subscribe(o),r.add(i)});const{playing$:s,paused$:f}=e.events,l=e.events.willSeek$.pipe(cr(()=>e.info.playbackState$.getValue()===fr.PLAYING)),c=e.events.seeked$.pipe(cr(()=>e.info.playbackState$.getValue()===fr.PLAYING)),a=Ne(s,c),u=Ne(f,l,n,e.events.looped$);let v;return r.add(a.subscribe(()=>v=o.getValue())),r.add(u.subscribe(()=>{const d=o.getValue();Ct(v)||v===d||Ct(d)||(t.next({from:v,to:d}),v=void 0)})),r});class xf{constructor(t,r){var n,o;this.subscription=new ve,this.timeSynchronisation=new Af,this.vsid=_n(),this.seekAction$=new Gt(Ke.UNKNOWN),this.statContext=t,this.config=Object.assign(Object.assign({},(n=r.config)!==null&&n!==void 0?n:{}),{requestRetryCount:1});const i=new Ho;this.experimental={error$:i};const s=new Sf({apiKey:pf,apiBaseUrl:xo[r.apiEnv],apiEnv:r.apiEnv,error$:i,timeSynchronisation:this.timeSynchronisation});this.api=new bf({apiTransport:s,refreshAuthToken:r.refreshAuthToken,requestRetryCount:this.config.requestRetryCount,mobile:(o=this.statContext.mobile)!==null&&o!==void 0?o:!1,error$:i}),this.logger=new Of({api:this.api,error$:i,userSalt:r.userSalt});const{isEmbed:f,host:l}=Pf();this.isEmbed=f,this.embedParent=l,this.subscribe()}updateContext(t){this.statContext=Object.assign(Object.assign({},this.statContext),t)}attachTo(t){const r=new ve,n=(a,u)=>r.add(a.subscribe(u));n(t.events.willStart$,()=>{this.logActionPlay({position:t.info.position$.getValue()})}),n(t.events.looped$,()=>{this.resetViewSession(),this.logActionPlay({position:t.info.position$.getValue()})}),n(t.events.seeked$,()=>{this.logSeek({action:this.seekAction$.getValue(),time:t.info.position$.getValue()}),this.seekAction$.next(Ke.UNKNOWN)}),n(t.events.paused$,()=>{this.logPause({position:t.info.position$.getValue()})}),n(t.events.willResume$,()=>{this.logPlay()}),n(t.events.started$,()=>{this.statContext.clip&&this.logWatchCoverageRecord({start:0,end:0})}),n(Cf(t),a=>{const u=t.info.isLive$.getValue(),v={start:parseFloat(a.from.toFixed(3)),end:parseFloat(a.to.toFixed(3))};u?this.logWatchCoverageLive(v):this.logWatchCoverageRecord(v)});let o;n(t.info.isStalled$,a=>{a?o=E():(ue(o)&&this.logEmptyBuffer({duration:E()-o}),o=void 0)});let i=!1;r.add(t.events.fatalError$.pipe(Ko()).subscribe(()=>i=!0)),n(t.events.willStop$,()=>{if(t.info.isStalled$.getValue()){const u=ue(o)?E()-o:void 0;this.logCloseAtEmptyBuffer({duration:u!=null?u:0}),o=void 0}else i||this.logActionStop()}),n(t.events.managedError$,({id:a})=>{this.logError({fatal:!1,errorType:a})}),n(t.events.fatalError$,({id:a})=>{this.logError({fatal:!0,errorType:a})});let s,f,l=!1;n(t.events.firstBytes$,a=>{s=E(),this.logFirstBytes({time:a})}),n(t.events.willStart$,()=>f=E()),n(t.info.currentBuffer$,a=>{!l&&a&&a.end-a.start>0&&ue(s)&&(this.logPlayerReady({duration:E()-s}),l=!0)}),n(t.events.firstFrame$,()=>{ue(s)&&!l&&(this.logPlayerReady({duration:E()-s}),l=!0),ue(f)&&this.logFirstFrame({time:E()-f})}),n(t.info.atLiveEdge$,a=>this.updateContext({liveEdge:a})),n(ur({muted:t.info.muted$,volume:t.info.volume$}),({muted:a,volume:u})=>this.updateContext({audible:!a&&u>0})),n(t.info.currentQuality$,a=>this.updateContext({quality:wf(a)})),n(t.info.isAutoQualityEnabled$,a=>this.updateContext({autoQuality:a})),n(t.info.currentFormat$,a=>this.updateContext({contentType:If(a)}));let c;return n(t.info.hostname$,a=>{this.updateContext({cdnHostname:a,failover:c!==void 0&&c!==a}),c=a}),n(t.info.throughputEstimation$,a=>this.updateContext({downloadSpeed:a})),n(t.info.httpConnectionType$,a=>{this.statContext.firstConnectionType||this.updateContext({firstConnectionType:En(a)}),this.updateContext({connectionType:En(a)})}),n(t.info.httpConnectionReused$,a=>{Ct(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:a}),this.updateContext({connectionReused:a})}),n(t.info.surface$,a=>this.updateContext({mode:Rt(a)})),n(ur({current:t.info.currentTextTrack$,available:t.info.availableTextTracks$}),({current:a,available:u})=>{const v=u.find(({id:d})=>d===a);this.updateContext({subtitles:v==null?void 0:v.language})}),this.player=t,this.uiEvents&&this.attachToUi(this.uiEvents),this.subscription.add(r),r}attachToUi(t){this.uiEvents=t;const r=new ve;return this.player&&(r.add(t.actionRewind$.subscribe(()=>{this.player&&(this.resetViewSession(),this.logActionPlay({position:this.player.info.position$.getValue()}))})),r.add(t.actionSeek$.subscribe(this.seekAction$)),r.add(t.inPiP$.subscribe(n=>{var o;const i=n?B.PIP:Rt((o=this.player)===null||o===void 0?void 0:o.info.surface$.getValue());this.updateContext({mode:i})})),r.add(t.inFullscreen$.subscribe(n=>{var o;const i=n?B.FULLSCREEN:Rt((o=this.player)===null||o===void 0?void 0:o.info.surface$.getValue());this.updateContext({mode:i})})),r.add(t.actionSetSubtitle$.subscribe(n=>{this.updateContext({subtitles:n})})),this.subscription.add(r)),r}attachToAds(t){const r=new ve;return r.add(t.slotRequested$.subscribe(()=>this.logAdSlotRequest())).add(t.started$.subscribe(n=>this.logAdStarted(n))).add(t.paused$.subscribe(()=>this.logAdPaused())).add(t.resumed$.subscribe(()=>this.logAdResumed())).add(t.ended$.subscribe(()=>this.logAdEnded())).add(t.skipped$.subscribe(()=>this.logAdSkipped())).add(t.clicked$.subscribe(()=>this.logAdClicked())),this.subscription.add(r),r}authorize(t){return this.api.authorize(t)}pause(){this.logger.pause()}resume(){this.logger.resume()}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.vsid=_n()}setFieldBlacklist(){}logInited(){}logReady(t){this.log({operation:"player_ready",param:String(t.time)})}logStarted(...t){this.logActionPlay(...t)}logPlay(){this.log({operation:"play_toggle"})}logPause(t){this.log({operation:"pause",param:String(Math.round(t.position))})}logSeek(t){this.log({operation:"seek",param:t.action,time:t.time})}logFirstBytes(t){this.log({operation:"first_bytes",param:String(t.time)})}logFirstFrame(t){this.log({operation:"first_frame",param:String(t.time)})}logError(t){this.log({operation:"content_error",param:`${t.fatal?"fatal":"recoverable"}_${t.errorType}`})}logWatchCoverageRecord(t){this.log({operation:"watch_coverage_record",param:`${t.start}-${t.end}`})}logWatchCoverageLive(t){const r=t.start+this.timeSynchronisation.getOffset(),n=t.end+this.timeSynchronisation.getOffset();this.log({operation:"watch_coverage_live",param:`${r}-${n}`})}logEmptyBuffer(t){this.log({operation:"empty_buffer",param:String(t.duration)})}logDownloadSpeed(){}logAdSlotRequest(){this.log({operation:"adv",param:"slot_request"})}logAdStarted(t){this.log({operation:"adv",param:t})}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"})}subscribe(){this.subscription.add(At(window,"beforeunload").subscribe(()=>this.logger.flush(!0)));const t=window.navigator.connection;t&&"onchange"in t&&"effectiveType"in t&&this.subscription.add(Ne(At(t,"change"),Wo(["init"])).subscribe(()=>this.updateContext({network:Rf(t.effectiveType)})))}logPlayerReady(t){this.log({operation:"player_ready",param:String(Math.round(t.duration))})}logActionPlay(t){this.log({operation:"action_play",param:String(Math.round(t.position))})}logCloseAtEmptyBuffer(t){this.log({operation:"close_at_empty_buffer",param:String(Math.round(t.duration))})}logActionStop(){this.log({operation:"action_stop"})}log(t){const r=this.createLogItem(t);this.logger.log(r)}createLogItem({operation:t,param:r,time:n}){const o=this.timeSynchronisation.now(),i=t==="empty_buffer"||t==="close_at_empty_buffer"?this.statContext.connectionType:this.statContext.firstConnectionType,s=this.statContext.firstConnectionReused,f={vsid:this.vsid,vid:this.statContext.movieId,ct:this.statContext.contentType,place:this.isEmbed?"embed":this.statContext.place,quality:this.statContext.quality,cdn_host:this.statContext.cdnHostname,stat_type:this.statContext.autoplay===!0?He.AUTO:this.statContext.autoplay===!1?He.MANUAL:void 0,param:r,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode,connection_type:i,connection_reused:s===!0?N.YES:s===!1?N.NO:void 0,cached_data:this.statContext.cached===!0?N.YES:this.statContext.cached===!1?N.NO:void 0,live:this.statContext.liveEdge?N.YES:void 0,muted:this.statContext.audible===!1?N.YES:void 0,mode:this.statContext.mode,subtitles:this.statContext.subtitles,download_speed:this.statContext.downloadSpeed,manual_quality:this.statContext.autoQuality?void 0:N.YES,ref_domain:this.embedParent,aid:this.statContext.albumId,vk_playlist_id:this.statContext.vkPlaylistId};return{operation:t,type:1,time:n,network:this.statContext.network,timestamp:o,custom:f}}}export{D as ApiEnv,pe as ConnectionType,S as ContentType,xf as OneStat,m as Quality,Ke as SeekAction,yn as VERSION};
6
+ import{ValueSubject as Gt,safeStorage as Z,getExponentialDelay as Mo,ErrorCategory as _,now as E,assertNever as Tn,Observable as Fo,Subscription as ve,merge as Ne,fromEvent as At,filterChanged as Bo,map as Vo,filter as cr,isNullable as Ct,Subject as Ho,once as Ko,combine as ur,observableFrom as Wo,isNonNullable as ue}from"@vkontakte/videoplayer-shared/es2015.esm.js";import lr from"lodash/debounce.js";import{Surface as le,VideoQuality as O,HttpConnectionType as tt,VideoFormat as g,PlaybackState as fr}from"@vkontakte/videoplayer-core/es2015.esm.js";function L(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function f(a){try{c(n.next(a))}catch(u){s(u)}}function l(a){try{c(n.throw(a))}catch(u){s(u)}}function c(a){a.done?i(a.value):o(a.value).then(f,l)}c((n=n.apply(e,t||[])).next())})}var vr=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},Se=function(e){return e&&e.Math==Math&&e},y=Se(typeof globalThis=="object"&&globalThis)||Se(typeof window=="object"&&window)||Se(typeof self=="object"&&self)||Se(typeof vr=="object"&&vr)||function(){return this}()||Function("return this")(),w=function(e){try{return!!e()}catch(t){return!0}},Go=w,We=!Go(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),qo=We,On=Function.prototype,dr=On.apply,hr=On.call,Pn=typeof Reflect=="object"&&Reflect.apply||(qo?hr.bind(dr):function(){return hr.apply(dr,arguments)}),wn=We,In=Function.prototype,Nt=In.call,zo=wn&&In.bind.bind(Nt,Nt),I=wn?zo:function(e){return function(){return Nt.apply(e,arguments)}},Rn=I,Qo=Rn({}.toString),Yo=Rn("".slice),Ge=function(e){return Yo(Qo(e),8,-1)},Jo=Ge,Xo=I,An=function(e){if(Jo(e)==="Function")return Xo(e)},Dt=typeof document=="object"&&document.all,Zo=typeof Dt=="undefined"&&Dt!==void 0,Cn={all:Dt,IS_HTMLDDA:Zo},Nn=Cn,ea=Nn.all,h=Nn.IS_HTMLDDA?function(e){return typeof e=="function"||e===ea}:function(e){return typeof e=="function"},qt={},ta=w,ae=!ta(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),ra=We,Ee=Function.prototype.call,R=ra?Ee.bind(Ee):function(){return Ee.apply(Ee,arguments)},Dn={},Ln={}.propertyIsEnumerable,xn=Object.getOwnPropertyDescriptor,na=xn&&!Ln.call({1:2},1);Dn.f=na?function(t){var r=xn(this,t);return!!r&&r.enumerable}:Ln;var jn=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},oa=I,aa=w,ia=Ge,rt=Object,sa=oa("".split),ca=aa(function(){return!rt("z").propertyIsEnumerable(0)})?function(e){return ia(e)=="String"?sa(e,""):rt(e)}:rt,qe=function(e){return e==null},ua=qe,la=TypeError,Un=function(e){if(ua(e))throw la("Can't call method on "+e);return e},fa=ca,va=Un,da=function(e){return fa(va(e))},pr=h,kn=Cn,ha=kn.all,H=kn.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:pr(e)||e===ha}:function(e){return typeof e=="object"?e!==null:pr(e)},Mn={},nt=Mn,ot=y,pa=h,gr=function(e){return pa(e)?e:void 0},j=function(e,t){return arguments.length<2?gr(nt[e])||gr(ot[e]):nt[e]&&nt[e][t]||ot[e]&&ot[e][t]},ga=I,zt=ga({}.isPrototypeOf),ze=typeof navigator!="undefined"&&String(navigator.userAgent)||"",Fn=y,at=ze,yr=Fn.process,br=Fn.Deno,$r=yr&&yr.versions||br&&br.version,mr=$r&&$r.v8,T,je;mr&&(T=mr.split("."),je=T[0]>0&&T[0]<4?1:+(T[0]+T[1]));!je&&at&&(T=at.match(/Edge\/(\d+)/),(!T||T[1]>=74)&&(T=at.match(/Chrome\/(\d+)/),T&&(je=+T[1])));var Bn=je,Sr=Bn,ya=w,Vn=!!Object.getOwnPropertySymbols&&!ya(function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Sr&&Sr<41}),ba=Vn,Hn=ba&&!Symbol.sham&&typeof Symbol.iterator=="symbol",$a=j,ma=h,Sa=zt,Ea=Hn,_a=Object,Kn=Ea?function(e){return typeof e=="symbol"}:function(e){var t=$a("Symbol");return ma(t)&&Sa(t.prototype,_a(e))},Ta=String,Qe=function(e){try{return Ta(e)}catch(t){return"Object"}},Oa=h,Pa=Qe,wa=TypeError,K=function(e){if(Oa(e))return e;throw wa(Pa(e)+" is not a function")},Ia=K,Ra=qe,Qt=function(e,t){var r=e[t];return Ra(r)?void 0:Ia(r)},it=R,st=h,ct=H,Aa=TypeError,Ca=function(e,t){var r,n;if(t==="string"&&st(r=e.toString)&&!ct(n=it(r,e))||st(r=e.valueOf)&&!ct(n=it(r,e))||t!=="string"&&st(r=e.toString)&&!ct(n=it(r,e)))return n;throw Aa("Can't convert object to primitive value")},Ue={},Na={get exports(){return Ue},set exports(e){Ue=e}},be=!0,Er=y,Da=Object.defineProperty,La=function(e,t){try{Da(Er,e,{value:t,configurable:!0,writable:!0})}catch(r){Er[e]=t}return t},xa=y,ja=La,_r="__core-js_shared__",Ua=xa[_r]||ja(_r,{}),Yt=Ua,Tr=Yt;(Na.exports=function(e,t){return Tr[e]||(Tr[e]=t!==void 0?t:{})})("versions",[]).push({version:"3.27.2",mode:"pure",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.27.2/LICENSE",source:"https://github.com/zloirock/core-js"});var ka=Un,Ma=Object,Fa=function(e){return Ma(ka(e))},Ba=I,Va=Fa,Ha=Ba({}.hasOwnProperty),ie=Object.hasOwn||function(t,r){return Ha(Va(t),r)},Ka=I,Wa=0,Ga=Math.random(),qa=Ka(1 .toString),Wn=function(e){return"Symbol("+(e===void 0?"":e)+")_"+qa(++Wa+Ga,36)},za=y,Qa=Ue,Or=ie,Ya=Wn,Ja=Vn,Xa=Hn,ee=za.Symbol,ut=Qa("wks"),Za=Xa?ee.for||ee:ee&&ee.withoutSetter||Ya,A=function(e){return Or(ut,e)||(ut[e]=Ja&&Or(ee,e)?ee[e]:Za("Symbol."+e)),ut[e]},ei=R,Pr=H,wr=Kn,ti=Qt,ri=Ca,ni=A,oi=TypeError,ai=ni("toPrimitive"),ii=function(e,t){if(!Pr(e)||wr(e))return e;var r=ti(e,ai),n;if(r){if(t===void 0&&(t="default"),n=ei(r,e,t),!Pr(n)||wr(n))return n;throw oi("Can't convert object to primitive value")}return t===void 0&&(t="number"),ri(e,t)},si=ii,ci=Kn,Gn=function(e){var t=si(e,"string");return ci(t)?t:t+""},ui=y,Ir=H,Lt=ui.document,li=Ir(Lt)&&Ir(Lt.createElement),qn=function(e){return li?Lt.createElement(e):{}},fi=ae,vi=w,di=qn,zn=!fi&&!vi(function(){return Object.defineProperty(di("div"),"a",{get:function(){return 7}}).a!=7}),hi=ae,pi=R,gi=Dn,yi=jn,bi=da,$i=Gn,mi=ie,Si=zn,Rr=Object.getOwnPropertyDescriptor;qt.f=hi?Rr:function(t,r){if(t=bi(t),r=$i(r),Si)try{return Rr(t,r)}catch(n){}if(mi(t,r))return yi(!pi(gi.f,t,r),t[r])};var Ei=w,_i=h,Ti=/#|\.prototype\./,$e=function(e,t){var r=Pi[Oi(e)];return r==Ii?!0:r==wi?!1:_i(t)?Ei(t):!!t},Oi=$e.normalize=function(e){return String(e).replace(Ti,".").toLowerCase()},Pi=$e.data={},wi=$e.NATIVE="N",Ii=$e.POLYFILL="P",Qn=$e,Ar=An,Ri=K,Ai=We,Ci=Ar(Ar.bind),Ye=function(e,t){return Ri(e),t===void 0?e:Ai?Ci(e,t):function(){return e.apply(t,arguments)}},Je={},Ni=ae,Di=w,Li=Ni&&Di(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),xi=H,ji=String,Ui=TypeError,W=function(e){if(xi(e))return e;throw Ui(ji(e)+" is not an object")},ki=ae,Mi=zn,Fi=Li,_e=W,Cr=Gn,Bi=TypeError,lt=Object.defineProperty,Vi=Object.getOwnPropertyDescriptor,ft="enumerable",vt="configurable",dt="writable";Je.f=ki?Fi?function(t,r,n){if(_e(t),r=Cr(r),_e(n),typeof t=="function"&&r==="prototype"&&"value"in n&&dt in n&&!n[dt]){var o=Vi(t,r);o&&o[dt]&&(t[r]=n.value,n={configurable:vt in n?n[vt]:o[vt],enumerable:ft in n?n[ft]:o[ft],writable:!1})}return lt(t,r,n)}:lt:function(t,r,n){if(_e(t),r=Cr(r),_e(n),Mi)try{return lt(t,r,n)}catch(o){}if("get"in n||"set"in n)throw Bi("Accessors not supported");return"value"in n&&(t[r]=n.value),t};var Hi=ae,Ki=Je,Wi=jn,Xe=Hi?function(e,t,r){return Ki.f(e,t,Wi(1,r))}:function(e,t,r){return e[t]=r,e},Te=y,Gi=Pn,qi=An,zi=h,Qi=qt.f,Yi=Qn,z=Mn,Ji=Ye,Q=Xe,Nr=ie,Xi=function(e){var t=function(r,n,o){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,o)}return Gi(e,this,arguments)};return t.prototype=e.prototype,t},G=function(e,t){var r=e.target,n=e.global,o=e.stat,i=e.proto,s=n?Te:o?Te[r]:(Te[r]||{}).prototype,f=n?z:z[r]||Q(z,r,{})[r],l=f.prototype,c,a,u,v,d,p,U,C,q;for(v in t)c=Yi(n?v:r+(o?".":"#")+v,e.forced),a=!c&&s&&Nr(s,v),p=f[v],a&&(e.dontCallGetSet?(q=Qi(s,v),U=q&&q.value):U=s[v]),d=a&&U?U:t[v],!(a&&typeof p==typeof d)&&(e.bind&&a?C=Ji(d,Te):e.wrap&&a?C=Xi(d):i&&zi(d)?C=qi(d):C=d,(e.sham||d&&d.sham||p&&p.sham)&&Q(C,"sham",!0),Q(f,v,C),i&&(u=r+"Prototype",Nr(z,u)||Q(z,u,{}),Q(z[u],v,d),e.real&&l&&(c||!l[v])&&Q(l,v,d)))},Zi=Ge,Ze=typeof process!="undefined"&&Zi(process)=="process",es=Xe,Jt=function(e,t,r,n){return n&&n.enumerable?e[t]=r:es(e,t,r),e},ts=h,rs=String,ns=TypeError,os=function(e){if(typeof e=="object"||ts(e))return e;throw ns("Can't set "+rs(e)+" as a prototype")},as=I,is=W,ss=os,cs=Object.setPrototypeOf||("__proto__"in{}?function(){var e=!1,t={},r;try{r=as(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),r(t,[]),e=t instanceof Array}catch(n){}return function(o,i){return is(o),ss(i),e?r(o,i):o.__proto__=i,o}}():void 0),us=A,ls=us("toStringTag"),Yn={};Yn[ls]="z";var Xt=String(Yn)==="[object z]",fs=Xt,vs=h,De=Ge,ds=A,hs=ds("toStringTag"),ps=Object,gs=De(function(){return arguments}())=="Arguments",ys=function(e,t){try{return e[t]}catch(r){}},Zt=fs?De:function(e){var t,r,n;return e===void 0?"Undefined":e===null?"Null":typeof(r=ys(t=ps(e),hs))=="string"?r:gs?De(t):(n=De(t))=="Object"&&vs(t.callee)?"Arguments":n},bs=Xt,$s=Zt,ms=bs?{}.toString:function(){return"[object "+$s(this)+"]"},Ss=Xt,Es=Je.f,_s=Xe,Ts=ie,Os=ms,Ps=A,Dr=Ps("toStringTag"),ws=function(e,t,r,n){if(e){var o=r?e:e.prototype;Ts(o,Dr)||Es(o,Dr,{configurable:!0,value:t}),n&&!Ss&&_s(o,"toString",Os)}},Is=j,Rs=Je,As=A,Cs=ae,Lr=As("species"),Ns=function(e){var t=Is(e),r=Rs.f;Cs&&t&&!t[Lr]&&r(t,Lr,{configurable:!0,get:function(){return this}})},Ds=zt,Ls=TypeError,xs=function(e,t){if(Ds(t,e))return e;throw Ls("Incorrect invocation")},js=I,Us=h,xt=Yt,ks=js(Function.toString);Us(xt.inspectSource)||(xt.inspectSource=function(e){return ks(e)});var Jn=xt.inspectSource,Ms=I,Fs=w,Xn=h,Bs=Zt,Vs=j,Hs=Jn,Zn=function(){},Ks=[],eo=Vs("Reflect","construct"),er=/^\s*(?:class|function)\b/,Ws=Ms(er.exec),Gs=!er.exec(Zn),fe=function(t){if(!Xn(t))return!1;try{return eo(Zn,Ks,t),!0}catch(r){return!1}},to=function(t){if(!Xn(t))return!1;switch(Bs(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Gs||!!Ws(er,Hs(t))}catch(r){return!0}};to.sham=!0;var qs=!eo||Fs(function(){var e;return fe(fe.call)||!fe(Object)||!fe(function(){e=!0})||e})?to:fe,zs=qs,Qs=Qe,Ys=TypeError,Js=function(e){if(zs(e))return e;throw Ys(Qs(e)+" is not a constructor")},xr=W,Xs=Js,Zs=qe,ec=A,tc=ec("species"),ro=function(e,t){var r=xr(e).constructor,n;return r===void 0||Zs(n=xr(r)[tc])?t:Xs(n)},rc=j,nc=rc("document","documentElement"),oc=I,ac=oc([].slice),ic=TypeError,sc=function(e,t){if(e<t)throw ic("Not enough arguments");return e},cc=ze,no=/(?:ipad|iphone|ipod).*applewebkit/i.test(cc),$=y,uc=Pn,lc=Ye,jr=h,fc=ie,oo=w,Ur=nc,vc=ac,kr=qn,dc=sc,hc=no,pc=Ze,jt=$.setImmediate,Ut=$.clearImmediate,gc=$.process,ht=$.Dispatch,yc=$.Function,Mr=$.MessageChannel,bc=$.String,pt=0,de={},Fr="onreadystatechange",ge,k,gt,yt;oo(function(){ge=$.location});var tr=function(e){if(fc(de,e)){var t=de[e];delete de[e],t()}},bt=function(e){return function(){tr(e)}},Br=function(e){tr(e.data)},Vr=function(e){$.postMessage(bc(e),ge.protocol+"//"+ge.host)};(!jt||!Ut)&&(jt=function(t){dc(arguments.length,1);var r=jr(t)?t:yc(t),n=vc(arguments,1);return de[++pt]=function(){uc(r,void 0,n)},k(pt),pt},Ut=function(t){delete de[t]},pc?k=function(e){gc.nextTick(bt(e))}:ht&&ht.now?k=function(e){ht.now(bt(e))}:Mr&&!hc?(gt=new Mr,yt=gt.port2,gt.port1.onmessage=Br,k=lc(yt.postMessage,yt)):$.addEventListener&&jr($.postMessage)&&!$.importScripts&&ge&&ge.protocol!=="file:"&&!oo(Vr)?(k=Vr,$.addEventListener("message",Br,!1)):Fr in kr("script")?k=function(e){Ur.appendChild(kr("script"))[Fr]=function(){Ur.removeChild(this),tr(e)}}:k=function(e){setTimeout(bt(e),0)});var ao={set:jt,clear:Ut},io=function(){this.head=null,this.tail=null};io.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e){var t=this.head=e.next;return t===null&&(this.tail=null),e.item}}};var so=io,$c=ze,mc=/ipad|iphone|ipod/i.test($c)&&typeof Pebble!="undefined",Sc=ze,Ec=/web0s(?!.*chrome)/i.test(Sc),V=y,Hr=Ye,_c=qt.f,$t=ao.set,Tc=so,Oc=no,Pc=mc,wc=Ec,mt=Ze,Kr=V.MutationObserver||V.WebKitMutationObserver,Wr=V.document,Gr=V.process,Oe=V.Promise,qr=_c(V,"queueMicrotask"),kt=qr&&qr.value,Y,St,Et,Pe,zr;if(!kt){var we=new Tc,Ie=function(){var e,t;for(mt&&(e=Gr.domain)&&e.exit();t=we.get();)try{t()}catch(r){throw we.head&&Y(),r}e&&e.enter()};!Oc&&!mt&&!wc&&Kr&&Wr?(St=!0,Et=Wr.createTextNode(""),new Kr(Ie).observe(Et,{characterData:!0}),Y=function(){Et.data=St=!St}):!Pc&&Oe&&Oe.resolve?(Pe=Oe.resolve(void 0),Pe.constructor=Oe,zr=Hr(Pe.then,Pe),Y=function(){zr(Ie)}):mt?Y=function(){Gr.nextTick(Ie)}:($t=Hr($t,V),Y=function(){$t(Ie)}),kt=function(e){we.head||Y(),we.add(e)}}var Ic=kt,Rc=function(e,t){try{arguments.length==1?console.error(e):console.error(e,t)}catch(r){}},rr=function(e){try{return{error:!1,value:e()}}catch(t){return{error:!0,value:t}}},Ac=y,Cc=h,Qr=Ac.WeakMap,Nc=Cc(Qr)&&/native code/.test(String(Qr)),Dc=Ue,Lc=Wn,Yr=Dc("keys"),xc=function(e){return Yr[e]||(Yr[e]=Lc(e))},jc={},Uc=Nc,co=y,kc=H,Mc=Xe,_t=ie,Tt=Yt,Fc=xc,Bc=jc,Jr="Object already initialized",Mt=co.TypeError,Vc=co.WeakMap,ke,ye,Me,Hc=function(e){return Me(e)?ye(e):ke(e,{})},Kc=function(e){return function(t){var r;if(!kc(t)||(r=ye(t)).type!==e)throw Mt("Incompatible receiver, "+e+" required");return r}};if(Uc||Tt.state){var P=Tt.state||(Tt.state=new Vc);P.get=P.get,P.has=P.has,P.set=P.set,ke=function(e,t){if(P.has(e))throw Mt(Jr);return t.facade=e,P.set(e,t),t},ye=function(e){return P.get(e)||{}},Me=function(e){return P.has(e)}}else{var J=Fc("state");Bc[J]=!0,ke=function(e,t){if(_t(e,J))throw Mt(Jr);return t.facade=e,Mc(e,J,t),t},ye=function(e){return _t(e,J)?e[J]:{}},Me=function(e){return _t(e,J)}}var Wc={set:ke,get:ye,has:Me,enforce:Hc,getterFor:Kc},Gc=y,se=Gc.Promise,uo=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",qc=uo,zc=Ze,Qc=!qc&&!zc&&typeof window=="object"&&typeof document=="object",Yc=y,he=se,Jc=h,Xc=Qn,Zc=Jn,eu=A,tu=Qc,ru=uo,nu=be,Ot=Bn,Xr=he&&he.prototype,ou=eu("species"),Ft=!1,lo=Jc(Yc.PromiseRejectionEvent),au=Xc("Promise",function(){var e=Zc(he),t=e!==String(he);if(!t&&Ot===66||nu&&!(Xr.catch&&Xr.finally))return!0;if(!Ot||Ot<51||!/native code/.test(e)){var r=new he(function(i){i(1)}),n=function(i){i(function(){},function(){})},o=r.constructor={};if(o[ou]=n,Ft=r.then(function(){})instanceof n,!Ft)return!0}return!t&&(tu||ru)&&!lo}),me={CONSTRUCTOR:au,REJECTION_EVENT:lo,SUBCLASSING:Ft},ce={},Zr=K,iu=TypeError,su=function(e){var t,r;this.promise=new e(function(n,o){if(t!==void 0||r!==void 0)throw iu("Bad Promise constructor");t=n,r=o}),this.resolve=Zr(t),this.reject=Zr(r)};ce.f=function(e){return new su(e)};var cu=G,uu=be,Fe=Ze,x=y,oe=R,en=Jt,tn=cs,lu=ws,fu=Ns,vu=K,Le=h,du=H,hu=xs,pu=ro,fo=ao.set,nr=Ic,gu=Rc,yu=rr,bu=so,vo=Wc,Be=se,or=me,ho=ce,et="Promise",po=or.CONSTRUCTOR,$u=or.REJECTION_EVENT,mu=or.SUBCLASSING,Pt=vo.getterFor(et),Su=vo.set,X=Be&&Be.prototype,M=Be,Re=X,go=x.TypeError,Bt=x.document,ar=x.process,Vt=ho.f,Eu=Vt,_u=!!(Bt&&Bt.createEvent&&x.dispatchEvent),yo="unhandledrejection",Tu="rejectionhandled",rn=0,bo=1,Ou=2,ir=1,$o=2,Ae,nn,Pu,on,mo=function(e){var t;return du(e)&&Le(t=e.then)?t:!1},So=function(e,t){var r=t.value,n=t.state==bo,o=n?e.ok:e.fail,i=e.resolve,s=e.reject,f=e.domain,l,c,a;try{o?(n||(t.rejection===$o&&Iu(t),t.rejection=ir),o===!0?l=r:(f&&f.enter(),l=o(r),f&&(f.exit(),a=!0)),l===e.promise?s(go("Promise-chain cycle")):(c=mo(l))?oe(c,l,i,s):i(l)):s(r)}catch(u){f&&!a&&f.exit(),s(u)}},Eo=function(e,t){e.notified||(e.notified=!0,nr(function(){for(var r=e.reactions,n;n=r.get();)So(n,e);e.notified=!1,t&&!e.rejection&&wu(e)}))},_o=function(e,t,r){var n,o;_u?(n=Bt.createEvent("Event"),n.promise=t,n.reason=r,n.initEvent(e,!1,!0),x.dispatchEvent(n)):n={promise:t,reason:r},!$u&&(o=x["on"+e])?o(n):e===yo&&gu("Unhandled promise rejection",r)},wu=function(e){oe(fo,x,function(){var t=e.facade,r=e.value,n=an(e),o;if(n&&(o=yu(function(){Fe?ar.emit("unhandledRejection",r,t):_o(yo,t,r)}),e.rejection=Fe||an(e)?$o:ir,o.error))throw o.value})},an=function(e){return e.rejection!==ir&&!e.parent},Iu=function(e){oe(fo,x,function(){var t=e.facade;Fe?ar.emit("rejectionHandled",t):_o(Tu,t,e.value)})},te=function(e,t,r){return function(n){e(t,n,r)}},ne=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=Ou,Eo(e,!0))},Ht=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw go("Promise can't be resolved itself");var n=mo(t);n?nr(function(){var o={done:!1};try{oe(n,t,te(Ht,o,e),te(ne,o,e))}catch(i){ne(o,i,e)}}):(e.value=t,e.state=bo,Eo(e,!1))}catch(o){ne({done:!1},o,e)}}};if(po&&(M=function(t){hu(this,Re),vu(t),oe(Ae,this);var r=Pt(this);try{t(te(Ht,r),te(ne,r))}catch(n){ne(r,n)}},Re=M.prototype,Ae=function(t){Su(this,{type:et,done:!1,notified:!1,parent:!1,reactions:new bu,rejection:!1,state:rn,value:void 0})},Ae.prototype=en(Re,"then",function(t,r){var n=Pt(this),o=Vt(pu(this,M));return n.parent=!0,o.ok=Le(t)?t:!0,o.fail=Le(r)&&r,o.domain=Fe?ar.domain:void 0,n.state==rn?n.reactions.add(o):nr(function(){So(o,n)}),o.promise}),nn=function(){var e=new Ae,t=Pt(e);this.promise=e,this.resolve=te(Ht,t),this.reject=te(ne,t)},ho.f=Vt=function(e){return e===M||e===Pu?new nn(e):Eu(e)},!uu&&Le(Be)&&X!==Object.prototype)){on=X.then,mu||en(X,"then",function(t,r){var n=this;return new M(function(o,i){oe(on,n,o,i)}).then(t,r)},{unsafe:!0});try{delete X.constructor}catch(e){}tn&&tn(X,Re)}cu({global:!0,constructor:!0,wrap:!0,forced:po},{Promise:M});lu(M,et,!1,!0);fu(et);var To={},Ru=A,Au=To,Cu=Ru("iterator"),Nu=Array.prototype,Du=function(e){return e!==void 0&&(Au.Array===e||Nu[Cu]===e)},Lu=Math.ceil,xu=Math.floor,ju=Math.trunc||function(t){var r=+t;return(r>0?xu:Lu)(r)},Uu=ju,ku=function(e){var t=+e;return t!==t||t===0?0:Uu(t)},Mu=ku,Fu=Math.min,Bu=function(e){return e>0?Fu(Mu(e),9007199254740991):0},Vu=Bu,Hu=function(e){return Vu(e.length)},Ku=Zt,sn=Qt,Wu=qe,Gu=To,qu=A,zu=qu("iterator"),Oo=function(e){if(!Wu(e))return sn(e,zu)||sn(e,"@@iterator")||Gu[Ku(e)]},Qu=R,Yu=K,Ju=W,Xu=Qe,Zu=Oo,el=TypeError,tl=function(e,t){var r=arguments.length<2?Zu(e):t;if(Yu(r))return Ju(Qu(r,e));throw el(Xu(e)+" is not iterable")},rl=R,cn=W,nl=Qt,ol=function(e,t,r){var n,o;cn(e);try{if(n=nl(e,"return"),!n){if(t==="throw")throw r;return r}n=rl(n,e)}catch(i){o=!0,n=i}if(t==="throw")throw r;if(o)throw n;return cn(n),r},al=Ye,il=R,sl=W,cl=Qe,ul=Du,ll=Hu,un=zt,fl=tl,vl=Oo,ln=ol,dl=TypeError,xe=function(e,t){this.stopped=e,this.result=t},fn=xe.prototype,Po=function(e,t,r){var n=r&&r.that,o=!!(r&&r.AS_ENTRIES),i=!!(r&&r.IS_RECORD),s=!!(r&&r.IS_ITERATOR),f=!!(r&&r.INTERRUPTED),l=al(t,n),c,a,u,v,d,p,U,C=function(m){return c&&ln(c,"normal",m),new xe(!0,m)},q=function(m){return o?(sl(m),f?l(m[0],m[1],C):l(m[0],m[1])):f?l(m,C):l(m)};if(i)c=e.iterator;else if(s)c=e;else{if(a=vl(e),!a)throw dl(cl(e)+" is not iterable");if(ul(a)){for(u=0,v=ll(e);v>u;u++)if(d=q(e[u]),d&&un(fn,d))return d;return new xe(!1)}c=fl(e,a)}for(p=i?e.next:c.next;!(U=il(p,c)).done;){try{d=q(U.value)}catch(m){ln(c,"throw",m)}if(typeof d=="object"&&d&&un(fn,d))return d}return new xe(!1)},hl=A,wo=hl("iterator"),Io=!1;try{var pl=0,vn={next:function(){return{done:!!pl++}},return:function(){Io=!0}};vn[wo]=function(){return this},Array.from(vn,function(){throw 2})}catch(e){}var gl=function(e,t){if(!t&&!Io)return!1;var r=!1;try{var n={};n[wo]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(o){}return r},yl=se,bl=gl,$l=me.CONSTRUCTOR,Ro=$l||!bl(function(e){yl.all(e).then(void 0,function(){})}),ml=G,Sl=R,El=K,_l=ce,Tl=rr,Ol=Po,Pl=Ro;ml({target:"Promise",stat:!0,forced:Pl},{all:function(t){var r=this,n=_l.f(r),o=n.resolve,i=n.reject,s=Tl(function(){var f=El(r.resolve),l=[],c=0,a=1;Ol(t,function(u){var v=c++,d=!1;a++,Sl(f,r,u).then(function(p){d||(d=!0,l[v]=p,--a||o(l))},i)}),--a||o(l)});return s.error&&i(s.value),n.promise}});var wl=G,Il=be,Rl=me.CONSTRUCTOR,Kt=se,Al=j,Cl=h,Nl=Jt,dn=Kt&&Kt.prototype;wl({target:"Promise",proto:!0,forced:Rl,real:!0},{catch:function(e){return this.then(void 0,e)}});if(!Il&&Cl(Kt)){var hn=Al("Promise").prototype.catch;dn.catch!==hn&&Nl(dn,"catch",hn,{unsafe:!0})}var Dl=G,Ll=R,xl=K,jl=ce,Ul=rr,kl=Po,Ml=Ro;Dl({target:"Promise",stat:!0,forced:Ml},{race:function(t){var r=this,n=jl.f(r),o=n.reject,i=Ul(function(){var s=xl(r.resolve);kl(t,function(f){Ll(s,r,f).then(n.resolve,o)})});return i.error&&o(i.value),n.promise}});var Fl=G,Bl=R,Vl=ce,Hl=me.CONSTRUCTOR;Fl({target:"Promise",stat:!0,forced:Hl},{reject:function(t){var r=Vl.f(this);return Bl(r.reject,void 0,t),r.promise}});var Kl=W,Wl=H,Gl=ce,Ao=function(e,t){if(Kl(e),Wl(t)&&t.constructor===e)return t;var r=Gl.f(e),n=r.resolve;return n(t),r.promise},ql=G,zl=j,Co=be,Ql=se,No=me.CONSTRUCTOR,Yl=Ao,Jl=zl("Promise"),Xl=Co&&!No;ql({target:"Promise",stat:!0,forced:Co||No},{resolve:function(t){return Yl(Xl&&this===Jl?Ql:this,t)}});var Zl=G,ef=be,Ve=se,tf=w,Do=j,Lo=h,rf=ro,pn=Ao,nf=Jt,Wt=Ve&&Ve.prototype,of=!!Ve&&tf(function(){Wt.finally.call({then:function(){}},function(){})});Zl({target:"Promise",proto:!0,real:!0,forced:of},{finally:function(e){var t=rf(this,Do("Promise")),r=Lo(e);return this.then(r?function(n){return pn(t,e()).then(function(){return n})}:e,r?function(n){return pn(t,e()).then(function(){throw n})}:e)}});if(!ef&&Lo(Ve)){var gn=Do("Promise").prototype.finally;Wt.finally!==gn&&nf(Wt,"finally",gn,{unsafe:!0})}var af=j,sf=af,cf=sf,uf=cf("Promise","finally"),lf=uf,ff=lf,vf=ff,df=vf,wt=df;function hf(){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),t=new Array(36);let r=0,n,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?t[o]="-":o===14?t[o]="4":(r<=2&&(r=33554432+Math.random()*16777216|0),n=r&15,r=r>>4,t[o]=e[o===19?n&3|8:n]);return t.join("")}var D;(function(e){e.PROD="prod",e.VK_ALIAS="vk_alias",e.VIDEOTEST="videotest",e.TEST="test",e.AUTO="auto"})(D||(D={}));var S;(function(e){e.Q144P="mobile",e.Q240P="lowest",e.Q360P="low",e.Q480P="medium",e.Q720P="high",e.Q1080P="fullhd",e.Q1440P="quadhd",e.Q2160P="ultrahd",e.UNKNOWN="unknown"})(S||(S={}));var b;(function(e){e.MP4="mp4",e.DASH="dash",e.DASH_SEP="dash_sep",e.ONDEMAND_DASH="ondemand_dash",e.HLS="hls",e.ONDEMAND_HLS="ondemand_hls",e.WEBM="webm",e.AV1="av1",e.ONDEMAND_DASH_LIVE="ondemand_dash_live",e.ONDEMAND_HLS_LIVE="ondemand_hls_live",e.WEBRTC="webrtc",e.UNKNOWN="unknown",e.RTMP="rtmp"})(b||(b={}));var He;(function(e){e.AUTO="auto",e.MANUAL=""})(He||(He={}));var pe;(function(e){e.HTTP1="http1",e.HTTP2="http2",e.HTTP3="http3"})(pe||(pe={}));var N;(function(e){e[e.YES=1]="YES",e[e.NO=0]="NO"})(N||(N={}));var re;(function(e){e.EXCELLENT="excellent",e.GOOD="good",e.POOR="poor"})(re||(re={}));var B;(function(e){e.PIP="pip",e.FULLSCREEN="fullscreen",e.EXTERNAL="external",e.PREFETCH="prefetch"})(B||(B={}));var Ke;(function(e){e.SLIDER="slider",e.DOUBLE_TAP="double_tap",e.TIME_CODE="time_code",e.EPISODE="episode",e.REWIND="rewind",e.LIVE="live",e.UNKNOWN="unknown"})(Ke||(Ke={}));const yn="1.0.36",pf="CIOPGQJGDIHBABABA",xo={[D.PROD]:"https://api.ok.ru",[D.VK_ALIAS]:"https://api.mycdn.me",[D.VIDEOTEST]:"https://videotestapi.ok.ru/api",[D.TEST]:"https://apitest.ok.ru",[D.AUTO]:""},gf="_one-stat_",bn=`${gf}uuid`,yf={start:1e3,factor:1.5,max:5*60*1e3,random:.1};var F;(function(e){e[e.PARAM_SESSION_EXPIRED=102]="PARAM_SESSION_EXPIRED",e[e.PARAM_SESSION_KEY=103]="PARAM_SESSION_KEY",e[e.PARAM_SIGNATURE=104]="PARAM_SIGNATURE",e[e.AUTH_LOGIN=401]="AUTH_LOGIN"})(F||(F={}));class bf{constructor(t){this.consequentAuthErrors=0,this.authorized$=new Gt(!1),this.params=t;const r=Z.get(bn);r?this.uuid=String(r):(this.uuid=hf(),Z.set(bn,this.uuid))}authorize(t){return L(this,void 0,void 0,function*(){return this.authToken=t!=null?t:yield this.refreshAuthToken(),this._authorizeWithBackoff()})}logBeacon(t){const r="log.externalLog",n=this.createLogParams(t),o=this.sessionKey;if(!o)return;this.params.apiTransport.sendBeacon(r,n,o)||this.logRequest(t)}logRequest(t){var r;return L(this,void 0,void 0,function*(){const n="log.externalLog",o=this.createLogParams(t),i=(r=this.sessionKey)!==null&&r!==void 0?r:yield this._authorizeWithBackoff();if(!i)return;const s=(f,l=this.params.requestRetryCount)=>L(this,void 0,void 0,function*(){try{return yield this.params.apiTransport.sendRequest(n,o,i)}catch(c){if(!c||!("error_code"in c)){this.params.error$.next({id:"logRequestUnknown",category:_.NETWORK,message:`Unknown ${n} error`,thrown:c});return}const a=c==null?void 0:c.error_code;switch(a){case F.PARAM_SESSION_EXPIRED:case F.PARAM_SESSION_KEY:case F.PARAM_SIGNATURE:return this.authorized$.next(!1),this.sessionKey=yield this._authorizeWithBackoff(),l>0?s(f,l-1):void 0;case F.AUTH_LOGIN:return this.authorized$.next(!1),this.authToken=yield this.refreshAuthToken(),this.sessionKey=yield this._authorizeWithBackoff(),l>0?s(f,l-1):void 0;default:{this.params.error$.next({id:`LogRequest#${a}`,category:_.EXTERNAL_API,message:`${n} error`,data:c});return}}}});return s(t)})}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}refreshAuthToken(){return L(this,void 0,void 0,function*(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=wt(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise})}createLogParams(t){return{collector:"ok.mobile.apps.video",data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${yn}`,platform:this.params.mobile?"M_WEB":"WEB",items:t})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();const t=Mo(this.consequentAuthErrors,yf);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{wt(this._authorize().then(r).catch(n=>this.params.error$.next({id:"AuthorizeBackoff",category:_.NETWORK,message:"Otherwise unhandled error in authorization",thrown:n})),()=>this.backoffTimeoutId=0)},t))})}_authorize(){return L(this,void 0,void 0,function*(){if(this.authorizePromise)return this.authorizePromise;this.sessionKey=void 0,this.authorized$.next(!1);const t="auth.anonymLogin",r={session_data:{version:2,device_id:this.uuid,client_version:yn.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=wt(this.params.apiTransport.sendRequest(t,r).then(n=>{var o;return(!n||!n.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:_.EXTERNAL_API,message:"No session key",data:n}),this.sessionKey=(o=n==null?void 0:n.session_key)!==null&&o!==void 0?o:void 0,this.sessionKey}).catch(n=>L(this,void 0,void 0,function*(){this.sessionKey=void 0;const o=n==null?void 0:n.error_code;switch(o){case F.AUTH_LOGIN:return this.authToken=yield this.refreshAuthToken(),this._authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:_.EXTERNAL_API,message:"authorize error",data:n}):this.params.error$.next({id:"AuthorizeUnknown",category:_.NETWORK,message:"authorize error",thrown:n})})),()=>{this.authorizePromise=void 0,this.consequentAuthErrors=this.sessionKey?0:this.consequentAuthErrors+1,this.authorized$.next(this.sessionKey!==void 0)}),this.authorizePromise})}}class $n{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(t,r,n){t in this.listeners||(this.listeners[t]=[]),this.listeners[t].push({callback:r,options:n})}removeEventListener(t,r){if(!(t in this.listeners))return;const n=this.listeners[t];for(let o=0,i=n.length;o<i;o++)if(n[o].callback===r){n.splice(o,1);return}}dispatchEvent(t){if(!(t.type in this.listeners))return;const n=this.listeners[t.type].slice();for(let o=0,i=n.length;o<i;o++){const s=n[o];try{s.callback.call(this,t)}catch(f){Promise.resolve().then(()=>{throw f})}s.options&&s.options.once&&this.removeEventListener(t.type,s.callback)}return!t.defaultPrevented}}class jo extends $n{constructor(){super(),this.listeners||$n.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(t){t.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,t)),super.dispatchEvent(t)}}class $f{constructor(){Object.defineProperty(this,"signal",{value:new jo,writable:!0,configurable:!0})}abort(t){let r;try{r=new Event("abort")}catch(o){typeof document!="undefined"?document.createEvent?(r=document.createEvent("Event"),r.initEvent("abort",!1,!1)):(r=document.createEventObject(),r.type="abort"):r={type:"abort",bubbles:!1,cancelable:!1}}let n=t;if(n===void 0)if(typeof document=="undefined")n=new Error("This operation was aborted"),n.name="AbortError";else try{n=new DOMException("signal is aborted without reason")}catch(o){n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(r)}toString(){return"[object AbortController]"}}typeof Symbol!="undefined"&&Symbol.toStringTag&&($f.prototype[Symbol.toStringTag]="AbortController",jo.prototype[Symbol.toStringTag]="AbortSignal");function Uo(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function mf(e){typeof e=="function"&&(e={fetch:e});const{fetch:t,Request:r=t.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=e;if(!Uo({fetch:t,Request:r,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o}))return{fetch:t,Request:i};let i=r;(i&&!i.prototype.hasOwnProperty("signal")||o)&&(i=function(c,a){let u;a&&a.signal&&(u=a.signal,delete a.signal);const v=new r(c,a);return u&&Object.defineProperty(v,"signal",{writable:!1,enumerable:!1,configurable:!0,value:u}),v},i.prototype=r.prototype);const s=t;return{fetch:(l,c)=>{const a=i&&i.prototype.isPrototypeOf(l)?l.signal:c?c.signal:void 0;if(a){let u;try{u=new DOMException("Aborted","AbortError")}catch(d){u=new Error("Aborted"),u.name="AbortError"}if(a.aborted)return Promise.reject(u);const v=new Promise((d,p)=>{a.addEventListener("abort",()=>p(u),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([v,s(l,c)])}return s(l,c)},Request:i}}const sr=Uo({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),ko=sr?mf({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,mn=sr?ko.fetch:window.fetch;sr?ko.Request:window.Request;class Sf{constructor(t){this.params=t,this.apiKey=t.apiKey,this.apiEnv=t.apiEnv,this.apiBaseUrl=t.apiBaseUrl,this.timeSynchronisation=t.timeSynchronisation,this.isApiBaseUrlFetched=!1}resolveApiBaseUrl(){var t;return L(this,void 0,void 0,function*(){if(this.apiEnv!==D.AUTO||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{const r=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=yield(yield mn(r,{method:"GET",mode:"cors",cache:"no-cache"})).json(),i=(t=o==null?void 0:o.Answer[0])===null||t===void 0?void 0:t.data;if(!i)throw new Error("Wrong DNS response");return i}catch(r){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:_.NETWORK,message:"Unhandled resolve api base url error",thrown:r}),xo[D.VK_ALIAS]}finally{this.isApiBaseUrlFetched=!0}})}sendBeacon(t,r,n){if(!window.Blob||!window.navigator.sendBeacon)return!1;const o=this._prepareQueryParams({method:t,queryParams:r,sessionKey:n}),i=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,i)}catch(s){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:_.NETWORK,message:"Unhandled beacon error",thrown:s,data:{method:t,params:r}})}return!1}sendRequest(t,r,n){return L(this,void 0,void 0,function*(){const o=E(),i=s=>{if(s instanceof TypeError&&["Failed to fetch","NetworkError when attempting to fetch resource."].includes(s.message)){this.params.error$.next({id:"Network",category:_.NETWORK,message:"Request failed",thrown:s});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:_.NETWORK,message:"Unhandled request error",thrown:s,data:{method:t,params:r,sessionKey:n,time:E()-o}})};return this.apiBaseUrl=yield this.resolveApiBaseUrl(),mn(`${this.apiBaseUrl}/fb.do`,{method:"post",headers:{"Content-type":"application/x-www-form-urlencoded"},body:this._prepareQueryParams({method:t,queryParams:r,sessionKey:n})}).then(s=>{var f;const l=Number(s.headers.get("content-length"))===0,c=new Date((f=s.headers.get("date"))!==null&&f!==void 0?f:"").getTime(),a=E()-o;if(isFinite(c)&&this.timeSynchronisation.addServerTime(c,a),!l)return s.json().then(u=>Object.prototype.hasOwnProperty.call(u,"error_msg")?Promise.reject(u):u,i)},i)})}_prepareQueryParams(t){const r=new URLSearchParams({format:"JSON",method:t.method,application_key:this.apiKey});return t.sessionKey!==void 0&&r.append("session_key",t.sessionKey),Object.entries(t.queryParams).forEach(([n,o])=>r.append(n,typeof o=="string"?o:JSON.stringify(o))),r}}const Sn=5e3,Ef=1e4,_f=6e4,Ce="onestat_events",Tf=36*60*60*1e3,It=e=>e.timestamp+Tf>=E();class Of{constructor(t){this.unsaltedStorage=[],this.isPaused=!1,this.isUrgent=r=>{const{operation:n,custom:{param:o}}=r;return["action_stop","close_at_empty_buffer"].includes(n)||n==="watch_coverage_record"&&o==="0-0"},this.firstFlush=lr(()=>this.safeFlush(),Sn,{maxWait:Sn}),this.debouncedFlush=lr(()=>this.safeFlush(),Ef,{maxWait:_f}),this.api=t.api,this.error$=t.error$,this.userSalt=t.userSalt,this.subscription=this.api.authorized$.subscribe(r=>{r&&this.debouncedFlush()}),this.housekeepStorage()}safeFlush(){var t;try{this.flush()}catch(r){this.error$.next({id:"LoggerError",category:_.WTF,message:(t=String(r))!==null&&t!==void 0?t:"Unknown logger error",thrown:r})}}readFromStorage(){const t=Z.get(Ce);try{return t?JSON.parse(t):{}}catch(r){}return{}}addToStorage(t){var r;if(!this.userSalt){this.unsaltedStorage.push(t);return}const n=this.readFromStorage(),i=((r=n[this.userSalt])!==null&&r!==void 0?r:[]).filter(It);Z.set(Ce,JSON.stringify(Object.assign(Object.assign({},n),{[this.userSalt]:[...i,t]})))}getFromStorage(){var t;return this.userSalt?((t=this.readFromStorage()[this.userSalt])!==null&&t!==void 0?t:[]).filter(It):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}const t=this.readFromStorage();delete t[this.userSalt],Z.set(Ce,JSON.stringify(t))}housekeepStorage(){const t=this.readFromStorage();for(const[r,n]of Object.entries(t)){const o=n.filter(It);o.length?t[r]=o:delete t[r]}Z.set(Ce,JSON.stringify(t))}log(t){this.addToStorage(t),!this.isPaused&&(this.isUrgent(t)?this.flush():this.lastVsid!==t.custom.vsid?this.firstFlush():this.debouncedFlush(),this.lastVsid=t.custom.vsid)}flush(t=!1){const r=this.getFromStorage();r.length!==0&&(this.api.authorized$.getValue()?(t?this.api.logBeacon(r):this.api.logRequest(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()}}const Pf=()=>{let e,t;try{e=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?e=!0:(e=!1,console.error(n))}try{window.location.ancestorOrigins&&(t=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!t&&document.referrer&&(t=document.referrer)}catch(n){console.error(n)}const r=t?new URL(t).hostname:void 0;return{isEmbed:e,host:r}},wf=e=>e&&{[O.INVARIANT]:S.UNKNOWN,[O.Q_144P]:S.Q144P,[O.Q_240P]:S.Q240P,[O.Q_360P]:S.Q360P,[O.Q_480P]:S.Q480P,[O.Q_720P]:S.Q720P,[O.Q_1080P]:S.Q1080P,[O.Q_1440P]:S.Q1440P,[O.Q_2160P]:S.Q2160P,[O.Q_4320P]:S.UNKNOWN}[e],En=e=>e&&{[tt.HTTP1]:pe.HTTP1,[tt.HTTP2]:pe.HTTP2,[tt.QUIC]:pe.HTTP3}[e],If=e=>{if(e!==void 0)switch(e){case g.MPEG:return b.MP4;case g.DASH:case g.DASH_LIVE:return b.DASH;case g.DASH_SEP:return b.DASH_SEP;case g.DASH_ONDEMAND:return b.ONDEMAND_DASH;case g.DASH_WEBM:case g.DASH_LIVE_WEBM:return b.WEBM;case g.DASH_WEBM_AV1:return b.AV1;case g.DASH_LIVE_CMAF:return b.ONDEMAND_DASH_LIVE;case g.HLS:case g.HLS_LIVE:return b.HLS;case g.HLS_ONDEMAND:return b.ONDEMAND_HLS;case g.HLS_LIVE_CMAF:return b.ONDEMAND_HLS_LIVE;case g.WEB_RTC_LIVE:return b.WEBRTC;default:return Tn(e)}},Rt=e=>{if(e!==void 0)switch(e){case le.NONE:case le.INLINE:return;case le.FULLSCREEN:return B.FULLSCREEN;case le.SECOND_SCREEN:return B.EXTERNAL;case le.PIP:return B.PIP;default:return Tn(e)}},Rf=e=>{switch(e){case"slow-2g":return re.POOR;case"2g":return re.POOR;case"3g":return re.GOOD;case"4g":return re.EXCELLENT}};class Af{constructor(t){this.offset=void 0,this.offset=t}getOffset(){var t;return(t=this.offset)!==null&&t!==void 0?t:0}setOffset(t){this.offset=t}now(){var t;return Date.now()+((t=this.offset)!==null&&t!==void 0?t:0)}date(t=new Date){var r;return t.setTime(t.getTime()+((r=this.offset)!==null&&r!==void 0?r:0)),t}addServerTime(t,r){const n=Date.now(),o=t-n-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)}}const _n=()=>Math.floor(Math.random()*Math.pow(2,32)).toString(36).padStart(8,"0"),Cf=e=>new Fo(t=>{const r=new ve,n=Ne(At(window,"beforeunload"),e.events.willDestruct$),o=new Gt(void 0);let i;r.add(e.info.isLive$.pipe(Bo()).subscribe(d=>{i&&(i.unsubscribe(),o.next(void 0)),d?i=e.info.liveTime$.pipe(Vo(p=>p&&p/1e3)).subscribe(o):i=e.info.position$.subscribe(o),r.add(i)}));const{playing$:s,paused$:f}=e.events,l=e.events.willSeek$.pipe(cr(()=>e.info.playbackState$.getValue()===fr.PLAYING)),c=e.events.seeked$.pipe(cr(()=>e.info.playbackState$.getValue()===fr.PLAYING)),a=Ne(s,c),u=Ne(f,l,n,e.events.looped$);let v;return r.add(a.subscribe(()=>v=o.getValue())),r.add(u.subscribe(()=>{const d=o.getValue();Ct(v)||v===d||Ct(d)||(t.next({from:v,to:d}),v=void 0)})),r});class xf{constructor(t,r){var n,o;this.subscription=new ve,this.timeSynchronisation=new Af,this.vsid=_n(),this.seekAction$=new Gt(Ke.UNKNOWN),this.statContext=t,this.config=Object.assign(Object.assign({},(n=r.config)!==null&&n!==void 0?n:{}),{requestRetryCount:1});const i=new Ho;this.experimental={error$:i};const s=new Sf({apiKey:pf,apiBaseUrl:xo[r.apiEnv],apiEnv:r.apiEnv,error$:i,timeSynchronisation:this.timeSynchronisation});this.api=new bf({apiTransport:s,refreshAuthToken:r.refreshAuthToken,requestRetryCount:this.config.requestRetryCount,mobile:(o=this.statContext.mobile)!==null&&o!==void 0?o:!1,error$:i}),this.logger=new Of({api:this.api,error$:i,userSalt:r.userSalt});const{isEmbed:f,host:l}=Pf();this.isEmbed=f,this.embedParent=l,this.subscribe()}updateContext(t){this.statContext=Object.assign(Object.assign({},this.statContext),t)}attachTo(t){const r=new ve,n=(a,u)=>r.add(a.subscribe(u));n(t.events.willStart$,()=>{this.logActionPlay({position:t.info.position$.getValue()})}),n(t.events.looped$,()=>{this.resetViewSession(),this.logActionPlay({position:t.info.position$.getValue()})}),n(t.events.seeked$,()=>{this.logSeek({action:this.seekAction$.getValue(),time:t.info.position$.getValue()}),this.seekAction$.next(Ke.UNKNOWN)}),n(t.events.paused$,()=>{this.logPause({position:t.info.position$.getValue()})}),n(t.events.willResume$,()=>{this.logPlay()}),n(t.events.started$,()=>{this.statContext.clip&&this.logWatchCoverageRecord({start:0,end:0})}),n(Cf(t),a=>{const u=t.info.isLive$.getValue(),v={start:parseFloat(a.from.toFixed(3)),end:parseFloat(a.to.toFixed(3))};u?this.logWatchCoverageLive(v):this.logWatchCoverageRecord(v)});let o;n(t.info.isStalled$,a=>{a?o=E():(ue(o)&&this.logEmptyBuffer({duration:E()-o}),o=void 0)});let i=!1;r.add(t.events.fatalError$.pipe(Ko()).subscribe(()=>i=!0)),n(t.events.willStop$,()=>{if(t.info.isStalled$.getValue()){const u=ue(o)?E()-o:void 0;this.logCloseAtEmptyBuffer({duration:u!=null?u:0}),o=void 0}else i||this.logActionStop()}),n(t.events.managedError$,({id:a})=>{this.logError({fatal:!1,errorType:a})}),n(t.events.fatalError$,({id:a})=>{this.logError({fatal:!0,errorType:a})});let s,f,l=!1;n(t.events.firstBytes$,a=>{s=E(),this.logFirstBytes({time:a})}),n(t.events.willStart$,()=>f=E()),n(t.info.currentBuffer$,a=>{!l&&a&&a.end-a.start>0&&ue(s)&&(this.logPlayerReady({duration:E()-s}),l=!0)}),n(t.events.firstFrame$,()=>{ue(s)&&!l&&(this.logPlayerReady({duration:E()-s}),l=!0),ue(f)&&this.logFirstFrame({time:E()-f})}),n(t.info.atLiveEdge$,a=>this.updateContext({liveEdge:a})),n(ur({muted:t.info.muted$,volume:t.info.volume$}),({muted:a,volume:u})=>this.updateContext({audible:!a&&u>0})),n(t.info.currentQuality$,a=>this.updateContext({quality:wf(a)})),n(t.info.isAutoQualityEnabled$,a=>this.updateContext({autoQuality:a})),n(t.info.currentFormat$,a=>this.updateContext({contentType:If(a)}));let c;return n(t.info.hostname$,a=>{this.updateContext({cdnHostname:a,failover:c!==void 0&&c!==a}),c=a}),n(t.info.throughputEstimation$,a=>this.updateContext({downloadSpeed:a})),n(t.info.httpConnectionType$,a=>{this.statContext.firstConnectionType||this.updateContext({firstConnectionType:En(a)}),this.updateContext({connectionType:En(a)})}),n(t.info.httpConnectionReused$,a=>{Ct(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:a}),this.updateContext({connectionReused:a})}),n(t.info.surface$,a=>this.updateContext({mode:Rt(a)})),n(ur({current:t.info.currentTextTrack$,available:t.info.availableTextTracks$}),({current:a,available:u})=>{const v=u.find(({id:d})=>d===a);this.updateContext({subtitles:v==null?void 0:v.language})}),this.player=t,this.uiEvents&&this.attachToUi(this.uiEvents),this.subscription.add(r),r}attachToUi(t){this.uiEvents=t;const r=new ve;return this.player&&(r.add(t.actionRewind$.subscribe(()=>{this.player&&(this.resetViewSession(),this.logActionPlay({position:this.player.info.position$.getValue()}))})),r.add(t.actionSeek$.subscribe(this.seekAction$)),r.add(t.inPiP$.subscribe(n=>{var o;const i=n?B.PIP:Rt((o=this.player)===null||o===void 0?void 0:o.info.surface$.getValue());this.updateContext({mode:i})})),r.add(t.inFullscreen$.subscribe(n=>{var o;const i=n?B.FULLSCREEN:Rt((o=this.player)===null||o===void 0?void 0:o.info.surface$.getValue());this.updateContext({mode:i})})),r.add(t.actionSetSubtitle$.subscribe(n=>{this.updateContext({subtitles:n})})),this.subscription.add(r)),r}attachToAds(t){const r=new ve;return r.add(t.slotRequested$.subscribe(()=>this.logAdSlotRequest())).add(t.started$.subscribe(n=>this.logAdStarted(n))).add(t.paused$.subscribe(()=>this.logAdPaused())).add(t.resumed$.subscribe(()=>this.logAdResumed())).add(t.ended$.subscribe(()=>this.logAdEnded())).add(t.skipped$.subscribe(()=>this.logAdSkipped())).add(t.clicked$.subscribe(()=>this.logAdClicked())),this.subscription.add(r),r}authorize(t){return this.api.authorize(t)}pause(){this.logger.pause()}resume(){this.logger.resume()}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.vsid=_n()}setFieldBlacklist(){}logInited(){}logReady(t){this.log({operation:"player_ready",param:String(t.time)})}logStarted(...t){this.logActionPlay(...t)}logPlay(){this.log({operation:"play_toggle"})}logPause(t){this.log({operation:"pause",param:String(Math.round(t.position))})}logSeek(t){this.log({operation:"seek",param:t.action,time:t.time})}logFirstBytes(t){this.log({operation:"first_bytes",param:String(t.time)})}logFirstFrame(t){this.log({operation:"first_frame",param:String(t.time)})}logError(t){this.log({operation:"content_error",param:`${t.fatal?"fatal":"recoverable"}_${t.errorType}`})}logWatchCoverageRecord(t){this.log({operation:"watch_coverage_record",param:`${t.start}-${t.end}`})}logWatchCoverageLive(t){const r=t.start+this.timeSynchronisation.getOffset(),n=t.end+this.timeSynchronisation.getOffset();this.log({operation:"watch_coverage_live",param:`${r}-${n}`})}logEmptyBuffer(t){this.log({operation:"empty_buffer",param:String(t.duration)})}logDownloadSpeed(){}logAdSlotRequest(){this.log({operation:"adv",param:"slot_request"})}logAdStarted(t){this.log({operation:"adv",param:t})}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"})}subscribe(){this.subscription.add(At(window,"beforeunload").subscribe(()=>this.logger.flush(!0)));const t=window.navigator.connection;t&&"onchange"in t&&"effectiveType"in t&&this.subscription.add(Ne(At(t,"change"),Wo(["init"])).subscribe(()=>this.updateContext({network:Rf(t.effectiveType)})))}logPlayerReady(t){this.log({operation:"player_ready",param:String(Math.round(t.duration))})}logActionPlay(t){this.log({operation:"action_play",param:String(Math.round(t.position))})}logCloseAtEmptyBuffer(t){this.log({operation:"close_at_empty_buffer",param:String(Math.round(t.duration))})}logActionStop(){this.log({operation:"action_stop"})}log(t){const r=this.createLogItem(t);this.logger.log(r)}createLogItem({operation:t,param:r,time:n}){const o=this.timeSynchronisation.now(),i=t==="empty_buffer"||t==="close_at_empty_buffer"?this.statContext.connectionType:this.statContext.firstConnectionType,s=this.statContext.firstConnectionReused,f={vsid:this.vsid,vid:this.statContext.movieId,ct:this.statContext.contentType,place:this.isEmbed?"embed":this.statContext.place,quality:this.statContext.quality,cdn_host:this.statContext.cdnHostname,stat_type:this.statContext.autoplay===!0?He.AUTO:this.statContext.autoplay===!1?He.MANUAL:void 0,param:r,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode,connection_type:i,connection_reused:s===!0?N.YES:s===!1?N.NO:void 0,cached_data:this.statContext.cached===!0?N.YES:this.statContext.cached===!1?N.NO:void 0,live:this.statContext.liveEdge?N.YES:void 0,muted:this.statContext.audible===!1?N.YES:void 0,mode:this.statContext.mode,subtitles:this.statContext.subtitles,download_speed:this.statContext.downloadSpeed,manual_quality:this.statContext.autoQuality?void 0:N.YES,ref_domain:this.embedParent,aid:this.statContext.albumId,vk_playlist_id:this.statContext.vkPlaylistId};return{operation:t,type:1,time:n,network:this.statContext.network,timestamp:o,custom:f}}}export{D as ApiEnv,pe as ConnectionType,b as ContentType,xf as OneStat,S as Quality,Ke as SeekAction,yn as VERSION};