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