@vkontakte/videoplayer-statistics 1.0.38 → 1.0.39

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