@vkontakte/videoplayer-statistics 1.0.46-dev.df8758f1.0 → 1.0.46

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.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-statistics v1.0.46-dev.df8758f1.0
3
- * Wed, 13 Mar 2024 12:50:02 GMT
2
+ * @vkontakte/videoplayer-statistics v1.0.46
3
+ * Mon, 08 Apr 2024 01:44:19 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-46/doc/
5
5
  */
6
- import{fillWithDefault as zo,ValueSubject as qe,getExponentialDelay as Yo,ErrorCategory as A,now as T,debounceFn as Wr,safeStorage as K,assertNever as Sa,Observable as Qo,Subscription as ze,merge as Ge,fromEvent as er,filterChanged as Jo,map as Xo,filter as qr,Subject as Ke,isNullable as Ye,Logger as Zo,isNonNullable as Z,detectEmbed as ei,once as ti,combine as zr,observableFrom as ri,assertNonNullable as ni}from"@vkontakte/videoplayer-shared/es2015.esm.js";import{Surface as de,VideoQuality as N,HttpConnectionType as vt,VideoFormat as E,PlaybackState as Yr}from"@vkontakte/videoplayer-core/es2015.esm.js";var dt=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Sr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var we=function(e){return e&&e.Math==Math&&e},y=we(typeof globalThis=="object"&&globalThis)||we(typeof window=="object"&&window)||we(typeof self=="object"&&self)||we(typeof dt=="object"&&dt)||function(){return this}()||dt||Function("return this")(),w=function(e){try{return!!e()}catch(t){return!0}},ai=w,rt=!ai(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),oi=rt,Ea=Function.prototype,Qr=Ea.apply,Jr=Ea.call,Oa=typeof Reflect=="object"&&Reflect.apply||(oi?Jr.bind(Qr):function(){return Jr.apply(Qr,arguments)}),Ta=rt,_a=Function.prototype,tr=_a.call,ii=Ta&&_a.bind.bind(tr,tr),R=Ta?ii:function(e){return function(){return tr.apply(e,arguments)}},Pa=R,si=Pa({}.toString),ci=Pa("".slice),ye=function(e){return ci(si(e),8,-1)},ui=ye,li=R,Ia=function(e){if(ui(e)==="Function")return li(e)},rr=typeof document=="object"&&document.all,fi=typeof rr=="undefined"&&rr!==void 0,wa={all:rr,IS_HTMLDDA:fi},Ra=wa,vi=Ra.all,$=Ra.IS_HTMLDDA?function(e){return typeof e=="function"||e===vi}:function(e){return typeof e=="function"},Er={},di=w,H=!di(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),hi=rt,Re=Function.prototype.call,P=hi?Re.bind(Re):function(){return Re.apply(Re,arguments)},Aa={},Ca={}.propertyIsEnumerable,Na=Object.getOwnPropertyDescriptor,pi=Na&&!Ca.call({1:2},1);Aa.f=pi?function(t){var r=Na(this,t);return!!r&&r.enumerable}:Ca;var nt=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},gi=R,bi=w,$i=ye,ht=Object,mi=gi("".split),yi=bi(function(){return!ht("z").propertyIsEnumerable(0)})?function(e){return $i(e)=="String"?mi(e,""):ht(e)}:ht,Se=function(e){return e==null},Si=Se,Ei=TypeError,Or=function(e){if(Si(e))throw Ei("Can't call method on "+e);return e},Oi=yi,Ti=Or,Ee=function(e){return Oi(Ti(e))},Xr=$,La=wa,_i=La.all,F=La.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:Xr(e)||e===_i}:function(e){return typeof e=="object"?e!==null:Xr(e)},Tr={},pt=Tr,gt=y,Pi=$,Zr=function(e){return Pi(e)?e:void 0},Q=function(e,t){return arguments.length<2?Zr(pt[e])||Zr(gt[e]):pt[e]&&pt[e][t]||gt[e]&&gt[e][t]},Ii=R,at=Ii({}.isPrototypeOf),ot=typeof navigator!="undefined"&&String(navigator.userAgent)||"",xa=y,bt=ot,en=xa.process,tn=xa.Deno,rn=en&&en.versions||tn&&tn.version,nn=rn&&rn.v8,C,Qe;nn&&(C=nn.split("."),Qe=C[0]>0&&C[0]<4?1:+(C[0]+C[1]));!Qe&&bt&&(C=bt.match(/Edge\/(\d+)/),(!C||C[1]>=74)&&(C=bt.match(/Chrome\/(\d+)/),C&&(Qe=+C[1])));var Da=Qe,an=Da,wi=w,Ri=y,Ai=Ri.String,ja=!!Object.getOwnPropertySymbols&&!wi(function(){var e=Symbol();return!Ai(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&an&&an<41}),Ci=ja,ka=Ci&&!Symbol.sham&&typeof Symbol.iterator=="symbol",Ni=Q,Li=$,xi=at,Di=ka,ji=Object,Ma=Di?function(e){return typeof e=="symbol"}:function(e){var t=Ni("Symbol");return Li(t)&&xi(t.prototype,ji(e))},ki=String,it=function(e){try{return ki(e)}catch(t){return"Object"}},Mi=$,Fi=it,Bi=TypeError,J=function(e){if(Mi(e))return e;throw Bi(Fi(e)+" is not a function")},Ui=J,Gi=Se,st=function(e,t){var r=e[t];return Gi(r)?void 0:Ui(r)},$t=P,mt=$,yt=F,Ki=TypeError,Vi=function(e,t){var r,n;if(t==="string"&&mt(r=e.toString)&&!yt(n=$t(r,e))||mt(r=e.valueOf)&&!yt(n=$t(r,e))||t!=="string"&&mt(r=e.toString)&&!yt(n=$t(r,e)))return n;throw Ki("Can't convert object to primitive value")},Fa={exports:{}},Hi=!0,on=y,Wi=Object.defineProperty,qi=function(e,t){try{Wi(on,e,{value:t,configurable:!0,writable:!0})}catch(r){on[e]=t}return t},zi=y,Yi=qi,sn="__core-js_shared__",Qi=zi[sn]||Yi(sn,{}),_r=Qi,cn=_r;(Fa.exports=function(e,t){return cn[e]||(cn[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 Ba=Fa.exports,Ji=Or,Xi=Object,Pr=function(e){return Xi(Ji(e))},Zi=R,es=Pr,ts=Zi({}.hasOwnProperty),D=Object.hasOwn||function(t,r){return ts(es(t),r)},rs=R,ns=0,as=Math.random(),os=rs(1 .toString),Ua=function(e){return"Symbol("+(e===void 0?"":e)+")_"+os(++ns+as,36)},is=y,ss=Ba,un=D,cs=Ua,us=ja,ls=ka,oe=is.Symbol,St=ss("wks"),fs=ls?oe.for||oe:oe&&oe.withoutSetter||cs,S=function(e){return un(St,e)||(St[e]=us&&un(oe,e)?oe[e]:fs("Symbol."+e)),St[e]},vs=P,ln=F,fn=Ma,ds=st,hs=Vi,ps=S,gs=TypeError,bs=ps("toPrimitive"),$s=function(e,t){if(!ln(e)||fn(e))return e;var r=ds(e,bs),n;if(r){if(t===void 0&&(t="default"),n=vs(r,e,t),!ln(n)||fn(n))return n;throw gs("Can't convert object to primitive value")}return t===void 0&&(t="number"),hs(e,t)},ms=$s,ys=Ma,Ir=function(e){var t=ms(e,"string");return ys(t)?t:t+""},Ss=y,vn=F,nr=Ss.document,Es=vn(nr)&&vn(nr.createElement),wr=function(e){return Es?nr.createElement(e):{}},Os=H,Ts=w,_s=wr,Ga=!Os&&!Ts(function(){return Object.defineProperty(_s("div"),"a",{get:function(){return 7}}).a!=7}),Ps=H,Is=P,ws=Aa,Rs=nt,As=Ee,Cs=Ir,Ns=D,Ls=Ga,dn=Object.getOwnPropertyDescriptor;Er.f=Ps?dn:function(t,r){if(t=As(t),r=Cs(r),Ls)try{return dn(t,r)}catch(n){}if(Ns(t,r))return Rs(!Is(ws.f,t,r),t[r])};var xs=w,Ds=$,js=/#|\.prototype\./,Oe=function(e,t){var r=Ms[ks(e)];return r==Bs?!0:r==Fs?!1:Ds(t)?xs(t):!!t},ks=Oe.normalize=function(e){return String(e).replace(js,".").toLowerCase()},Ms=Oe.data={},Fs=Oe.NATIVE="N",Bs=Oe.POLYFILL="P",Ka=Oe,hn=Ia,Us=J,Gs=rt,Ks=hn(hn.bind),ct=function(e,t){return Us(e),t===void 0?e:Gs?Ks(e,t):function(){return e.apply(t,arguments)}},X={},Vs=H,Hs=w,Va=Vs&&Hs(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),Ws=F,qs=String,zs=TypeError,B=function(e){if(Ws(e))return e;throw zs(qs(e)+" is not an object")},Ys=H,Qs=Ga,Js=Va,Ae=B,pn=Ir,Xs=TypeError,Et=Object.defineProperty,Zs=Object.getOwnPropertyDescriptor,Ot="enumerable",Tt="configurable",_t="writable";X.f=Ys?Js?function(t,r,n){if(Ae(t),r=pn(r),Ae(n),typeof t=="function"&&r==="prototype"&&"value"in n&&_t in n&&!n[_t]){var a=Zs(t,r);a&&a[_t]&&(t[r]=n.value,n={configurable:Tt in n?n[Tt]:a[Tt],enumerable:Ot in n?n[Ot]:a[Ot],writable:!1})}return Et(t,r,n)}:Et:function(t,r,n){if(Ae(t),r=pn(r),Ae(n),Qs)try{return Et(t,r,n)}catch(a){}if("get"in n||"set"in n)throw Xs("Accessors not supported");return"value"in n&&(t[r]=n.value),t};var ec=H,tc=X,rc=nt,Te=ec?function(e,t,r){return tc.f(e,t,rc(1,r))}:function(e,t,r){return e[t]=r,e},Ce=y,nc=Oa,ac=Ia,oc=$,ic=Er.f,sc=Ka,ee=Tr,cc=ct,te=Te,gn=D,uc=function(e){var t=function(r,n,a){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,a)}return nc(e,this,arguments)};return t.prototype=e.prototype,t},j=function(e,t){var r=e.target,n=e.global,a=e.stat,i=e.proto,s=n?Ce:a?Ce[r]:(Ce[r]||{}).prototype,u=n?ee:ee[r]||te(ee,r,{})[r],f=u.prototype,l,o,c,v,d,h,p,b,g;for(v in t)l=sc(n?v:r+(a?".":"#")+v,e.forced),o=!l&&s&&gn(s,v),h=u[v],o&&(e.dontCallGetSet?(g=ic(s,v),p=g&&g.value):p=s[v]),d=o&&p?p:t[v],!(o&&typeof h==typeof d)&&(e.bind&&o?b=cc(d,Ce):e.wrap&&o?b=uc(d):i&&oc(d)?b=ac(d):b=d,(e.sham||d&&d.sham||h&&h.sham)&&te(b,"sham",!0),te(u,v,b),i&&(c=r+"Prototype",gn(ee,c)||te(ee,c,{}),te(ee[c],v,d),e.real&&f&&(l||!f[v])&&te(f,v,d)))},lc=F,fc=ye,vc=S,dc=vc("match"),hc=function(e){var t;return lc(e)&&((t=e[dc])!==void 0?!!t:fc(e)=="RegExp")},pc=S,gc=pc("toStringTag"),Ha={};Ha[gc]="z";var Rr=String(Ha)==="[object z]",bc=Rr,$c=$,Ve=ye,mc=S,yc=mc("toStringTag"),Sc=Object,Ec=Ve(function(){return arguments}())=="Arguments",Oc=function(e,t){try{return e[t]}catch(r){}},_e=bc?Ve:function(e){var t,r,n;return e===void 0?"Undefined":e===null?"Null":typeof(r=Oc(t=Sc(e),yc))=="string"?r:Ec?Ve(t):(n=Ve(t))=="Object"&&$c(t.callee)?"Arguments":n},Tc=_e,_c=String,Pc=function(e){if(Tc(e)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return _c(e)},Ic=B,wc=function(){var e=Ic(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},Rc=P,Ac=D,Cc=at,Nc=wc,bn=RegExp.prototype,Lc=function(e){var t=e.flags;return t===void 0&&!("flags"in bn)&&!Ac(e,"flags")&&Cc(bn,e)?Rc(Nc,e):t},Ar=R,xc=Pr,Dc=Math.floor,Pt=Ar("".charAt),jc=Ar("".replace),It=Ar("".slice),kc=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Mc=/\$([$&'`]|\d{1,2})/g,Fc=function(e,t,r,n,a,i){var s=r+e.length,u=n.length,f=Mc;return a!==void 0&&(a=xc(a),f=kc),jc(i,f,function(l,o){var c;switch(Pt(o,0)){case"$":return"$";case"&":return e;case"`":return It(t,0,r);case"'":return It(t,s);case"<":c=a[It(o,1,-1)];break;default:var v=+o;if(v===0)return l;if(v>u){var d=Dc(v/10);return d===0?l:d<=u?n[d-1]===void 0?Pt(o,1):n[d-1]+Pt(o,1):l}c=n[v-1]}return c===void 0?"":c})},Bc=j,Uc=P,Cr=R,$n=Or,Gc=$,Kc=Se,Vc=hc,re=Pc,Hc=st,Wc=Lc,qc=Fc,zc=S,Yc=zc("replace"),Qc=TypeError,Wa=Cr("".indexOf),Jc=Cr("".replace),mn=Cr("".slice),Xc=Math.max,yn=function(e,t,r){return r>e.length?-1:t===""?r:Wa(e,t,r)};Bc({target:"String",proto:!0},{replaceAll:function(t,r){var n=$n(this),a,i,s,u,f,l,o,c,v,d=0,h=0,p="";if(!Kc(t)){if(a=Vc(t),a&&(i=re($n(Wc(t))),!~Wa(i,"g")))throw Qc("`.replaceAll` does not allow non-global regexes");if(s=Hc(t,Yc),s)return Uc(s,t,n,r);if(a)return Jc(re(n),t,r)}for(u=re(n),f=re(t),l=Gc(r),l||(r=re(r)),o=f.length,c=Xc(1,o),d=yn(u,f,0);d!==-1;)v=l?re(r(f,d,u)):qc(f,u,d,[],void 0,r),p+=mn(u,h,d)+v,h=d+o,d=yn(u,f,d+c);return h<u.length&&(p+=mn(u,h)),p}});var Zc=Q,qa=Zc,eu=qa,tu=eu("String","replaceAll"),ru=tu,nu=ru,au=nu,ou=au,iu=Sr(ou),x;(function(e){e.PROD="prod",e.VK_ALIAS="vk_alias",e.VIDEOTEST="videotest",e.TEST="test",e.AUTO="auto"})(x||(x={}));var I;(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"})(I||(I={}));var O;(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"})(O||(O={}));var Je;(function(e){e.AUTO="auto",e.MANUAL=""})(Je||(Je={}));var pe;(function(e){e.HTTP1="http1",e.HTTP2="http2",e.HTTP3="http3"})(pe||(pe={}));var k;(function(e){e[e.YES=1]="YES",e[e.NO=0]="NO"})(k||(k={}));var ie;(function(e){e.EXCELLENT="excellent",e.GOOD="good",e.POOR="poor"})(ie||(ie={}));var z;(function(e){e.PIP="pip",e.FULLSCREEN="fullscreen",e.EXTERNAL="external",e.PREFETCH="prefetch",e.AIRPLAY="airplay",e.CHROMECAST="chromecast",e.INVISIBLE="invisible"})(z||(z={}));var Xe;(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"})(Xe||(Xe={}));var Sn;(function(e){e.GRAPH_SHOW="iGraphShow",e.GRAPH_HIDE="iGraphHide",e.NEXT_AREA="iNextChapterArea",e.NEXT_BUTTON="iNextChapterBtn",e.WATCH_AGAIN="iWatchAgainBtn"})(Sn||(Sn={}));const su={action_play:"ap",first_bytes:"fb",player_ready:"pr",first_frame:"ff",seek:"sk",watch_coverage_record:"wr",watch_coverage_live:"wl",empty_buffer:"eb",action_stop:"as",close_at_empty_buffer:"cb",content_error:"er",player_interface_click:"pc",next_movie:"nm",track_switch:"ts"},cu={vsid:"si",vid:"vi",place:"pl",quality:"qt",cdn_host:"ch",stat_type:"st",param:"pm",vk_app_id:"va",track_code:"tc",connection_type:"cnt",connection_reused:"cr",cached_data:"cd",live:"lv",muted:"mu",mode:"mo",subtitles:"sb",failover:"fo",download_speed:"ds",manual_quality:"mq",ref_domain:"rd",direct_url:"du"},uu={unknown:"un",mobile:"m",lowest:"ls",low:"l",medium:"md",high:"h",fullhd:"f",quadhd:"q",ultrahd:"u"},lu={pip:"pi",fullscreen:"fs",external:"ex",prefetch:"pr",airplay:"ap",chromecast:"cc",invisible:"iv"},fu={apiEnv:x.VK_ALIAS,requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageInterval:15e3,disabledOperations:[],disabledCustomFields:[],shorten:!0,maxLoops:100,embedUrlParams:[],useBeacon:!0,synchronizeTime:!0,debugLog:!1,backoff:{start:1e3,factor:1.5,max:5*60*1e3,random:.1}},vu=e=>zo(e,fu);function du(){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),t=new Array(36);let r=0,n,a;for(a=0;a<36;a++)a===8||a===13||a===18||a===23?t[a]="-":a===14?t[a]="4":(r<=2&&(r=33554432+Math.random()*16777216|0),n=r&15,r=r>>4,t[a]=e[a===19?n&3|8:n]);return t.join("")}function G(e,t,r,n){function a(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function u(o){try{l(n.next(o))}catch(c){s(c)}}function f(o){try{l(n.throw(o))}catch(c){s(c)}}function l(o){o.done?i(o.value):a(o.value).then(u,f)}l((n=n.apply(e,t||[])).next())})}var hu=ye,ut=typeof process!="undefined"&&hu(process)=="process",pu=Te,Nr=function(e,t,r,n){return n&&n.enumerable?e[t]=r:pu(e,t,r),e},gu=Rr,bu=_e,$u=gu?{}.toString:function(){return"[object "+bu(this)+"]"},mu=Rr,yu=X.f,Su=Te,Eu=D,Ou=$u,Tu=S,En=Tu("toStringTag"),Lr=function(e,t,r,n){if(e){var a=r?e:e.prototype;Eu(a,En)||yu(a,En,{configurable:!0,value:t}),n&&!mu&&Su(a,"toString",Ou)}},_u=X,Pu=function(e,t,r){return _u.f(e,t,r)},Iu=Q,wu=Pu,Ru=S,Au=H,On=Ru("species"),Cu=function(e){var t=Iu(e);Au&&t&&!t[On]&&wu(t,On,{configurable:!0,get:function(){return this}})},Nu=at,Lu=TypeError,xu=function(e,t){if(Nu(t,e))return e;throw Lu("Incorrect invocation")},Du=R,ju=$,ar=_r,ku=Du(Function.toString);ju(ar.inspectSource)||(ar.inspectSource=function(e){return ku(e)});var za=ar.inspectSource,Mu=R,Fu=w,Ya=$,Bu=_e,Uu=Q,Gu=za,Qa=function(){},Ku=[],Ja=Uu("Reflect","construct"),xr=/^\s*(?:class|function)\b/,Vu=Mu(xr.exec),Hu=!xr.exec(Qa),he=function(t){if(!Ya(t))return!1;try{return Ja(Qa,Ku,t),!0}catch(r){return!1}},Xa=function(t){if(!Ya(t))return!1;switch(Bu(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Hu||!!Vu(xr,Gu(t))}catch(r){return!0}};Xa.sham=!0;var Wu=!Ja||Fu(function(){var e;return he(he.call)||!he(Object)||!he(function(){e=!0})||e})?Xa:he,qu=Wu,zu=it,Yu=TypeError,Qu=function(e){if(qu(e))return e;throw Yu(zu(e)+" is not a constructor")},Tn=B,Ju=Qu,Xu=Se,Zu=S,el=Zu("species"),Za=function(e,t){var r=Tn(e).constructor,n;return r===void 0||Xu(n=Tn(r)[el])?t:Ju(n)},tl=Q,eo=tl("document","documentElement"),rl=R,nl=rl([].slice),al=TypeError,ol=function(e,t){if(e<t)throw al("Not enough arguments");return e},il=ot,to=/(?:ipad|iphone|ipod).*applewebkit/i.test(il),_=y,sl=Oa,cl=ct,_n=$,ul=D,ro=w,Pn=eo,ll=nl,In=wr,fl=ol,vl=to,dl=ut,or=_.setImmediate,ir=_.clearImmediate,hl=_.process,wt=_.Dispatch,pl=_.Function,wn=_.MessageChannel,gl=_.String,Rt=0,ge={},Rn="onreadystatechange",$e,W,At,Ct;ro(function(){$e=_.location});var Dr=function(e){if(ul(ge,e)){var t=ge[e];delete ge[e],t()}},Nt=function(e){return function(){Dr(e)}},An=function(e){Dr(e.data)},Cn=function(e){_.postMessage(gl(e),$e.protocol+"//"+$e.host)};(!or||!ir)&&(or=function(t){fl(arguments.length,1);var r=_n(t)?t:pl(t),n=ll(arguments,1);return ge[++Rt]=function(){sl(r,void 0,n)},W(Rt),Rt},ir=function(t){delete ge[t]},dl?W=function(e){hl.nextTick(Nt(e))}:wt&&wt.now?W=function(e){wt.now(Nt(e))}:wn&&!vl?(At=new wn,Ct=At.port2,At.port1.onmessage=An,W=cl(Ct.postMessage,Ct)):_.addEventListener&&_n(_.postMessage)&&!_.importScripts&&$e&&$e.protocol!=="file:"&&!ro(Cn)?(W=Cn,_.addEventListener("message",An,!1)):Rn in In("script")?W=function(e){Pn.appendChild(In("script"))[Rn]=function(){Pn.removeChild(this),Dr(e)}}:W=function(e){setTimeout(Nt(e),0)});var no={set:or,clear:ir},ao=function(){this.head=null,this.tail=null};ao.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 oo=ao,bl=ot,$l=/ipad|iphone|ipod/i.test(bl)&&typeof Pebble!="undefined",ml=ot,yl=/web0s(?!.*chrome)/i.test(ml),Y=y,Nn=ct,Sl=Er.f,Lt=no.set,El=oo,Ol=to,Tl=$l,_l=yl,xt=ut,Ln=Y.MutationObserver||Y.WebKitMutationObserver,xn=Y.document,Dn=Y.process,Ne=Y.Promise,jn=Sl(Y,"queueMicrotask"),sr=jn&&jn.value,ne,Dt,jt,Le,kn;if(!sr){var xe=new El,De=function(){var e,t;for(xt&&(e=Dn.domain)&&e.exit();t=xe.get();)try{t()}catch(r){throw xe.head&&ne(),r}e&&e.enter()};!Ol&&!xt&&!_l&&Ln&&xn?(Dt=!0,jt=xn.createTextNode(""),new Ln(De).observe(jt,{characterData:!0}),ne=function(){jt.data=Dt=!Dt}):!Tl&&Ne&&Ne.resolve?(Le=Ne.resolve(void 0),Le.constructor=Ne,kn=Nn(Le.then,Le),ne=function(){kn(De)}):xt?ne=function(){Dn.nextTick(De)}:(Lt=Nn(Lt,Y),ne=function(){Lt(De)}),sr=function(e){xe.head||ne(),xe.add(e)}}var Pl=sr,Il=function(e,t){try{arguments.length==1?console.error(e):console.error(e,t)}catch(r){}},jr=function(e){try{return{error:!1,value:e()}}catch(t){return{error:!0,value:t}}},wl=y,Rl=$,Mn=wl.WeakMap,Al=Rl(Mn)&&/native code/.test(String(Mn)),Cl=Ba,Nl=Ua,Fn=Cl("keys"),kr=function(e){return Fn[e]||(Fn[e]=Nl(e))},Mr={},Ll=Al,io=y,xl=F,Dl=Te,kt=D,Mt=_r,jl=kr,kl=Mr,Bn="Object already initialized",cr=io.TypeError,Ml=io.WeakMap,Ze,me,et,Fl=function(e){return et(e)?me(e):Ze(e,{})},Bl=function(e){return function(t){var r;if(!xl(t)||(r=me(t)).type!==e)throw cr("Incompatible receiver, "+e+" required");return r}};if(Ll||Mt.state){var L=Mt.state||(Mt.state=new Ml);L.get=L.get,L.has=L.has,L.set=L.set,Ze=function(e,t){if(L.has(e))throw cr(Bn);return t.facade=e,L.set(e,t),t},me=function(e){return L.get(e)||{}},et=function(e){return L.has(e)}}else{var ae=jl("state");kl[ae]=!0,Ze=function(e,t){if(kt(e,ae))throw cr(Bn);return t.facade=e,Dl(e,ae,t),t},me=function(e){return kt(e,ae)?e[ae]:{}},et=function(e){return kt(e,ae)}}var so={set:Ze,get:me,has:et,enforce:Fl,getterFor:Bl},Ul=y,le=Ul.Promise,co=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",Gl=co,Kl=ut,Vl=!Gl&&!Kl&&typeof window=="object"&&typeof document=="object",Hl=y,be=le,Wl=$,ql=Ka,zl=za,Yl=S,Ql=Vl,Jl=co,Ft=Da,Un=be&&be.prototype,Xl=Yl("species"),ur=!1,uo=Wl(Hl.PromiseRejectionEvent),Zl=ql("Promise",function(){var e=zl(be),t=e!==String(be);if(!t&&Ft===66||!(Un.catch&&Un.finally))return!0;if(!Ft||Ft<51||!/native code/.test(e)){var r=new be(function(i){i(1)}),n=function(i){i(function(){},function(){})},a=r.constructor={};if(a[Xl]=n,ur=r.then(function(){})instanceof n,!ur)return!0}return!t&&(Ql||Jl)&&!uo}),Pe={CONSTRUCTOR:Zl,REJECTION_EVENT:uo,SUBCLASSING:ur},fe={},Gn=J,ef=TypeError,tf=function(e){var t,r;this.promise=new e(function(n,a){if(t!==void 0||r!==void 0)throw ef("Bad Promise constructor");t=n,r=a}),this.resolve=Gn(t),this.reject=Gn(r)};fe.f=function(e){return new tf(e)};var rf=j,tt=ut,V=y,Ie=P,nf=Nr,af=Lr,of=Cu,sf=J,lr=$,cf=F,uf=xu,lf=Za,lo=no.set,Fr=Pl,ff=Il,vf=jr,df=oo,fo=so,fr=le,Br=Pe,vo=fe,lt="Promise",ho=Br.CONSTRUCTOR,hf=Br.REJECTION_EVENT;Br.SUBCLASSING;var Bt=fo.getterFor(lt),pf=fo.set,gf=fr&&fr.prototype,se=fr,Ut=gf,po=V.TypeError,vr=V.document,Ur=V.process,dr=vo.f,bf=dr,$f=!!(vr&&vr.createEvent&&V.dispatchEvent),go="unhandledrejection",mf="rejectionhandled",Kn=0,bo=1,yf=2,Gr=1,$o=2,je,Vn,Sf,mo=function(e){var t;return cf(e)&&lr(t=e.then)?t:!1},yo=function(e,t){var r=t.value,n=t.state==bo,a=n?e.ok:e.fail,i=e.resolve,s=e.reject,u=e.domain,f,l,o;try{a?(n||(t.rejection===$o&&Of(t),t.rejection=Gr),a===!0?f=r:(u&&u.enter(),f=a(r),u&&(u.exit(),o=!0)),f===e.promise?s(po("Promise-chain cycle")):(l=mo(f))?Ie(l,f,i,s):i(f)):s(r)}catch(c){u&&!o&&u.exit(),s(c)}},So=function(e,t){e.notified||(e.notified=!0,Fr(function(){for(var r=e.reactions,n;n=r.get();)yo(n,e);e.notified=!1,t&&!e.rejection&&Ef(e)}))},Eo=function(e,t,r){var n,a;$f?(n=vr.createEvent("Event"),n.promise=t,n.reason=r,n.initEvent(e,!1,!0),V.dispatchEvent(n)):n={promise:t,reason:r},!hf&&(a=V["on"+e])?a(n):e===go&&ff("Unhandled promise rejection",r)},Ef=function(e){Ie(lo,V,function(){var t=e.facade,r=e.value,n=Hn(e),a;if(n&&(a=vf(function(){tt?Ur.emit("unhandledRejection",r,t):Eo(go,t,r)}),e.rejection=tt||Hn(e)?$o:Gr,a.error))throw a.value})},Hn=function(e){return e.rejection!==Gr&&!e.parent},Of=function(e){Ie(lo,V,function(){var t=e.facade;tt?Ur.emit("rejectionHandled",t):Eo(mf,t,e.value)})},ce=function(e,t,r){return function(n){e(t,n,r)}},ue=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=yf,So(e,!0))},hr=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw po("Promise can't be resolved itself");var n=mo(t);n?Fr(function(){var a={done:!1};try{Ie(n,t,ce(hr,a,e),ce(ue,a,e))}catch(i){ue(a,i,e)}}):(e.value=t,e.state=bo,So(e,!1))}catch(a){ue({done:!1},a,e)}}};ho&&(se=function(t){uf(this,Ut),sf(t),Ie(je,this);var r=Bt(this);try{t(ce(hr,r),ce(ue,r))}catch(n){ue(r,n)}},Ut=se.prototype,je=function(t){pf(this,{type:lt,done:!1,notified:!1,parent:!1,reactions:new df,rejection:!1,state:Kn,value:void 0})},je.prototype=nf(Ut,"then",function(t,r){var n=Bt(this),a=dr(lf(this,se));return n.parent=!0,a.ok=lr(t)?t:!0,a.fail=lr(r)&&r,a.domain=tt?Ur.domain:void 0,n.state==Kn?n.reactions.add(a):Fr(function(){yo(a,n)}),a.promise}),Vn=function(){var e=new je,t=Bt(e);this.promise=e,this.resolve=ce(hr,t),this.reject=ce(ue,t)},vo.f=dr=function(e){return e===se||e===Sf?new Vn(e):bf(e)});rf({global:!0,constructor:!0,wrap:!0,forced:ho},{Promise:se});af(se,lt,!1,!0);of(lt);var ve={},Tf=S,_f=ve,Pf=Tf("iterator"),If=Array.prototype,wf=function(e){return e!==void 0&&(_f.Array===e||If[Pf]===e)},Rf=Math.ceil,Af=Math.floor,Cf=Math.trunc||function(t){var r=+t;return(r>0?Af:Rf)(r)},Nf=Cf,Oo=function(e){var t=+e;return t!==t||t===0?0:Nf(t)},Lf=Oo,xf=Math.min,Df=function(e){return e>0?xf(Lf(e),9007199254740991):0},jf=Df,To=function(e){return jf(e.length)},kf=_e,Wn=st,Mf=Se,Ff=ve,Bf=S,Uf=Bf("iterator"),_o=function(e){if(!Mf(e))return Wn(e,Uf)||Wn(e,"@@iterator")||Ff[kf(e)]},Gf=P,Kf=J,Vf=B,Hf=it,Wf=_o,qf=TypeError,zf=function(e,t){var r=arguments.length<2?Wf(e):t;if(Kf(r))return Vf(Gf(r,e));throw qf(Hf(e)+" is not iterable")},Yf=P,qn=B,Qf=st,Jf=function(e,t,r){var n,a;qn(e);try{if(n=Qf(e,"return"),!n){if(t==="throw")throw r;return r}n=Yf(n,e)}catch(i){a=!0,n=i}if(t==="throw")throw r;if(a)throw n;return qn(n),r},Xf=ct,Zf=P,ev=B,tv=it,rv=wf,nv=To,zn=at,av=zf,ov=_o,Yn=Jf,iv=TypeError,He=function(e,t){this.stopped=e,this.result=t},Qn=He.prototype,Kr=function(e,t,r){var n=r&&r.that,a=!!(r&&r.AS_ENTRIES),i=!!(r&&r.IS_RECORD),s=!!(r&&r.IS_ITERATOR),u=!!(r&&r.INTERRUPTED),f=Xf(t,n),l,o,c,v,d,h,p,b=function(m){return l&&Yn(l,"normal",m),new He(!0,m)},g=function(m){return a?(ev(m),u?f(m[0],m[1],b):f(m[0],m[1])):u?f(m,b):f(m)};if(i)l=e.iterator;else if(s)l=e;else{if(o=ov(e),!o)throw iv(tv(e)+" is not iterable");if(rv(o)){for(c=0,v=nv(e);v>c;c++)if(d=g(e[c]),d&&zn(Qn,d))return d;return new He(!1)}l=av(e,o)}for(h=i?e.next:l.next;!(p=Zf(h,l)).done;){try{d=g(p.value)}catch(m){Yn(l,"throw",m)}if(typeof d=="object"&&d&&zn(Qn,d))return d}return new He(!1)},sv=S,Po=sv("iterator"),Io=!1;try{var cv=0,Jn={next:function(){return{done:!!cv++}},return:function(){Io=!0}};Jn[Po]=function(){return this},Array.from(Jn,function(){throw 2})}catch(e){}var uv=function(e,t){if(!t&&!Io)return!1;var r=!1;try{var n={};n[Po]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(a){}return r},lv=le,fv=uv,vv=Pe.CONSTRUCTOR,wo=vv||!fv(function(e){lv.all(e).then(void 0,function(){})}),dv=j,hv=P,pv=J,gv=fe,bv=jr,$v=Kr,mv=wo;dv({target:"Promise",stat:!0,forced:mv},{all:function(t){var r=this,n=gv.f(r),a=n.resolve,i=n.reject,s=bv(function(){var u=pv(r.resolve),f=[],l=0,o=1;$v(t,function(c){var v=l++,d=!1;o++,hv(u,r,c).then(function(h){d||(d=!0,f[v]=h,--o||a(f))},i)}),--o||a(f)});return s.error&&i(s.value),n.promise}});var yv=j,Sv=Pe.CONSTRUCTOR,Xn=le;Xn&&Xn.prototype;yv({target:"Promise",proto:!0,forced:Sv,real:!0},{catch:function(e){return this.then(void 0,e)}});var Ev=j,Ov=P,Tv=J,_v=fe,Pv=jr,Iv=Kr,wv=wo;Ev({target:"Promise",stat:!0,forced:wv},{race:function(t){var r=this,n=_v.f(r),a=n.reject,i=Pv(function(){var s=Tv(r.resolve);Iv(t,function(u){Ov(s,r,u).then(n.resolve,a)})});return i.error&&a(i.value),n.promise}});var Rv=j,Av=P,Cv=fe,Nv=Pe.CONSTRUCTOR;Rv({target:"Promise",stat:!0,forced:Nv},{reject:function(t){var r=Cv.f(this);return Av(r.reject,void 0,t),r.promise}});var Lv=B,xv=F,Dv=fe,Ro=function(e,t){if(Lv(e),xv(t)&&t.constructor===e)return t;var r=Dv.f(e),n=r.resolve;return n(t),r.promise},jv=j,kv=Q,Mv=Hi,Fv=le,Bv=Pe.CONSTRUCTOR,Uv=Ro,Gv=kv("Promise"),Kv=!Bv;jv({target:"Promise",stat:!0,forced:Mv},{resolve:function(t){return Uv(Kv&&this===Gv?Fv:this,t)}});var Vv=j,pr=le,Hv=w,Wv=Q,qv=$,zv=Za,Zn=Ro,Yv=pr&&pr.prototype,Qv=!!pr&&Hv(function(){Yv.finally.call({then:function(){}},function(){})});Vv({target:"Promise",proto:!0,real:!0,forced:Qv},{finally:function(e){var t=zv(this,Wv("Promise")),r=qv(e);return this.then(r?function(n){return Zn(t,e()).then(function(){return n})}:e,r?function(n){return Zn(t,e()).then(function(){throw n})}:e)}});var Jv=qa,Xv=Jv("Promise","finally"),Zv=Xv,ed=Zv,td=ed,rd=td,Gt=Sr(rd),gr=H,nd=D,Ao=Function.prototype,ad=gr&&Object.getOwnPropertyDescriptor,Vr=nd(Ao,"name"),od=Vr&&function(){}.name==="something",id=Vr&&(!gr||gr&&ad(Ao,"name").configurable),sd={EXISTS:Vr,PROPER:od,CONFIGURABLE:id},Co={},cd=Oo,ud=Math.max,ld=Math.min,fd=function(e,t){var r=cd(e);return r<0?ud(r+t,0):ld(r,t)},vd=Ee,dd=fd,hd=To,ea=function(e){return function(t,r,n){var a=vd(t),i=hd(a),s=dd(n,i),u;if(e&&r!=r){for(;i>s;)if(u=a[s++],u!=u)return!0}else for(;i>s;s++)if((e||s in a)&&a[s]===r)return e||s||0;return!e&&-1}},pd={includes:ea(!0),indexOf:ea(!1)},gd=R,Kt=D,bd=Ee,$d=pd.indexOf,md=Mr,ta=gd([].push),yd=function(e,t){var r=bd(e),n=0,a=[],i;for(i in r)!Kt(md,i)&&Kt(r,i)&&ta(a,i);for(;t.length>n;)Kt(r,i=t[n++])&&(~$d(a,i)||ta(a,i));return a},No=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Sd=yd,Ed=No,Od=Object.keys||function(t){return Sd(t,Ed)},Td=H,_d=Va,Pd=X,Id=B,wd=Ee,Rd=Od;Co.f=Td&&!_d?Object.defineProperties:function(t,r){Id(t);for(var n=wd(r),a=Rd(r),i=a.length,s=0,u;i>s;)Pd.f(t,u=a[s++],n[u]);return t};var Ad=B,Cd=Co,ra=No,Nd=Mr,Ld=eo,xd=wr,Dd=kr,na=">",aa="<",br="prototype",$r="script",Lo=Dd("IE_PROTO"),Vt=function(){},xo=function(e){return aa+$r+na+e+aa+"/"+$r+na},oa=function(e){e.write(xo("")),e.close();var t=e.parentWindow.Object;return e=null,t},jd=function(){var e=xd("iframe"),t="java"+$r+":",r;return e.style.display="none",Ld.appendChild(e),e.src=String(t),r=e.contentWindow.document,r.open(),r.write(xo("document.F=Object")),r.close(),r.F},ke,We=function(){try{ke=new ActiveXObject("htmlfile")}catch(t){}We=typeof document!="undefined"?document.domain&&ke?oa(ke):jd():oa(ke);for(var e=ra.length;e--;)delete We[br][ra[e]];return We()};Nd[Lo]=!0;var Do=Object.create||function(t,r){var n;return t!==null?(Vt[br]=Ad(t),n=new Vt,Vt[br]=null,n[Lo]=t):n=We(),r===void 0?n:Cd.f(n,r)},kd=w,Md=!kd(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),Fd=D,Bd=$,Ud=Pr,Gd=kr,Kd=Md,ia=Gd("IE_PROTO"),mr=Object,Vd=mr.prototype,jo=Kd?mr.getPrototypeOf:function(e){var t=Ud(e);if(Fd(t,ia))return t[ia];var r=t.constructor;return Bd(r)&&t instanceof r?r.prototype:t instanceof mr?Vd:null},Hd=w,Wd=$,qd=F,zd=Do,sa=jo,Yd=Nr,Qd=S,yr=Qd("iterator"),ko=!1,M,Ht,Wt;[].keys&&(Wt=[].keys(),"next"in Wt?(Ht=sa(sa(Wt)),Ht!==Object.prototype&&(M=Ht)):ko=!0);var Jd=!qd(M)||Hd(function(){var e={};return M[yr].call(e)!==e});Jd?M={}:M=zd(M);Wd(M[yr])||Yd(M,yr,function(){return this});var Mo={IteratorPrototype:M,BUGGY_SAFARI_ITERATORS:ko},Xd=Mo.IteratorPrototype,Zd=Do,eh=nt,th=Lr,rh=ve,nh=function(){return this},ah=function(e,t,r,n){var a=t+" Iterator";return e.prototype=Zd(Xd,{next:eh(+!n,r)}),th(e,a,!1,!0),rh[a]=nh,e},oh=j,ih=P,Fo=sd,sh=ah,ch=jo,uh=Lr,ca=Nr,lh=S,ua=ve,Bo=Mo,fh=Fo.PROPER;Fo.CONFIGURABLE;Bo.IteratorPrototype;var Me=Bo.BUGGY_SAFARI_ITERATORS,qt=lh("iterator"),la="keys",Fe="values",fa="entries",vh=function(){return this},dh=function(e,t,r,n,a,i,s){sh(r,t,n);var u=function(g){if(g===a&&v)return v;if(!Me&&g in o)return o[g];switch(g){case la:return function(){return new r(this,g)};case Fe:return function(){return new r(this,g)};case fa:return function(){return new r(this,g)}}return function(){return new r(this)}},f=t+" Iterator",l=!1,o=e.prototype,c=o[qt]||o["@@iterator"]||a&&o[a],v=!Me&&c||u(a),d=t=="Array"&&o.entries||c,h,p,b;if(d&&(h=ch(d.call(new e)),h!==Object.prototype&&h.next&&(uh(h,f,!0,!0),ua[f]=vh)),fh&&a==Fe&&c&&c.name!==Fe&&(l=!0,v=function(){return ih(c,this)}),a)if(p={values:u(Fe),keys:i?v:u(la),entries:u(fa)},s)for(b in p)(Me||l||!(b in o))&&ca(o,b,p[b]);else oh({target:t,proto:!0,forced:Me||l},p);return s&&o[qt]!==v&&ca(o,qt,v,{name:a}),ua[t]=v,p},hh=function(e,t){return{value:e,done:t}},ph=Ee,va=ve,Uo=so;X.f;var gh=dh,Be=hh,Go="Array Iterator",bh=Uo.set,$h=Uo.getterFor(Go);gh(Array,"Array",function(e,t){bh(this,{type:Go,target:ph(e),index:0,kind:t})},function(){var e=$h(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,Be(void 0,!0)):r=="keys"?Be(n,!1):r=="values"?Be(t[n],!1):Be([n,t[n]],!1)},"values");va.Arguments=va.Array;var mh=Ir,yh=X,Sh=nt,Eh=function(e,t,r){var n=mh(t);n in e?yh.f(e,n,Sh(0,r)):e[n]=r},Oh=j,Th=Kr,_h=Eh;Oh({target:"Object",stat:!0},{fromEntries:function(t){var r={};return Th(t,function(n,a){_h(r,n,a)},{AS_ENTRIES:!0}),r}});var Ph=Tr,Ih=Ph.Object.fromEntries,wh={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Rh=wh,Ah=y,Ch=_e,Nh=Te,da=ve,Lh=S,ha=Lh("toStringTag");for(var zt in Rh){var pa=Ah[zt],Yt=pa&&pa.prototype;Yt&&Ch(Yt)!==ha&&Nh(Yt,ha,zt),da[zt]=da.Array}var xh=Ih,Dh=xh,jh=Dh,kh=jh,Mh=Sr(kh);const Fh=e=>{var t;const{operation:r,custom:n}=e,a=Mh(Object.entries(n).map(([i,s])=>{var u,f,l;const o=(u=cu[i])!==null&&u!==void 0?u:i;let c=s;return s&&(i==="mode"?c=(f=lu[s])!==null&&f!==void 0?f:s:i==="quality"&&(c=(l=uu[s])!==null&&l!==void 0?l:s)),[o,c]}));return Object.assign(Object.assign({},e),{operation:(t=su[r])!==null&&t!==void 0?t:r,custom:a})},ga="1.0.46-dev.df8758f1.0",Bh="CIOPGQJGDIHBABABA",ba={[x.PROD]:"https://api.ok.ru",[x.VK_ALIAS]:"https://api.mycdn.me",[x.VIDEOTEST]:"https://videotestapi.ok.ru/api",[x.TEST]:"https://apitest.ok.ru",[x.AUTO]:""};var q;(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"})(q||(q={}));class Uh{constructor(t){this.consequentAuthErrors=0,this.authorized$=new qe(!1),this.params=t}authorize(t){return G(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),a=this.sessionKey;if(!a)return;this.params.apiTransport.sendBeacon(r,n,a)||this.logRequest(t)}logRequest(t){var r;return G(this,void 0,void 0,function*(){const n="log.externalLog",a=this.createLogParams(t),i=(r=this.sessionKey)!==null&&r!==void 0?r:yield this._authorizeWithBackoff();if(!i)return;const s=(u,f=this.params.config.requestRetryCount)=>G(this,void 0,void 0,function*(){try{return yield this.params.apiTransport.sendRequest(n,a,i)}catch(l){if(!l||!("error_code"in l)){this.params.error$.next({id:"logRequestUnknown",category:A.NETWORK,message:`Unknown ${n} error`,thrown:l});return}const o=l==null?void 0:l.error_code;switch(o){case q.PARAM_SESSION_EXPIRED:case q.PARAM_SESSION_KEY:case q.PARAM_SIGNATURE:return this.authorized$.next(!1),this.sessionKey=yield this._authorizeWithBackoff(),f>0?s(u,f-1):void 0;case q.AUTH_LOGIN:return this.authorized$.next(!1),this.authToken=yield this.refreshAuthToken(),this.sessionKey=yield this._authorizeWithBackoff(),f>0?s(u,f-1):void 0;default:{this.params.error$.next({id:`LogRequest#${o}`,category:A.EXTERNAL_API,message:`${n} error`,data:l});return}}}});return s(t)})}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}refreshAuthToken(){return G(this,void 0,void 0,function*(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=Gt(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise})}createLogParams(t){return{collector:"ok.mobile.apps.video",data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${ga}`,platform:this.params.mobile?"M_WEB":"WEB",items:this.params.config.shorten?t.map(Fh):t})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();const t=Yo(this.consequentAuthErrors,this.params.config.backoff);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{Gt(this._authorize().then(r).catch(n=>this.params.error$.next({id:"AuthorizeBackoff",category:A.NETWORK,message:"Otherwise unhandled error in authorization",thrown:n})),()=>this.backoffTimeoutId=0)},t))})}_authorize(){return G(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.params.uuid,client_version:ga.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=Gt(this.params.apiTransport.sendRequest(t,r).then(n=>{var a;return(!n||!n.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:A.EXTERNAL_API,message:"No session key",data:n}),this.sessionKey=(a=n==null?void 0:n.session_key)!==null&&a!==void 0?a:void 0,this.sessionKey}).catch(n=>G(this,void 0,void 0,function*(){this.sessionKey=void 0;const a=n==null?void 0:n.error_code;switch(a){case q.AUTH_LOGIN:return this.authToken=yield this.refreshAuthToken(),this._authorizeWithBackoff()}a?this.params.error$.next({id:`Authorize#${a}`,category:A.EXTERNAL_API,message:"authorize error",data:n}):this.params.error$.next({id:"AuthorizeUnknown",category:A.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 $a{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 a=0,i=n.length;a<i;a++)if(n[a].callback===r){n.splice(a,1);return}}dispatchEvent(t){if(!(t.type in this.listeners))return;const n=this.listeners[t.type].slice();for(let a=0,i=n.length;a<i;a++){const s=n[a];try{s.callback.call(this,t)}catch(u){Promise.resolve().then(()=>{throw u})}s.options&&s.options.once&&this.removeEventListener(t.type,s.callback)}return!t.defaultPrevented}}class Ko extends $a{constructor(){super(),this.listeners||$a.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 Gh{constructor(){Object.defineProperty(this,"signal",{value:new Ko,writable:!0,configurable:!0})}abort(t){let r;try{r=new Event("abort")}catch(a){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(a){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&&(Gh.prototype[Symbol.toStringTag]="AbortController",Ko.prototype[Symbol.toStringTag]="AbortSignal");function Vo(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function Kh(e){typeof e=="function"&&(e={fetch:e});const{fetch:t,Request:r=t.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a=!1}=e;if(!Vo({fetch:t,Request:r,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a}))return{fetch:t,Request:i};let i=r;(i&&!i.prototype.hasOwnProperty("signal")||a)&&(i=function(l,o){let c;o&&o.signal&&(c=o.signal,delete o.signal);const v=new r(l,o);return c&&Object.defineProperty(v,"signal",{writable:!1,enumerable:!1,configurable:!0,value:c}),v},i.prototype=r.prototype);const s=t;return{fetch:(f,l)=>{const o=i&&i.prototype.isPrototypeOf(f)?f.signal:l?l.signal:void 0;if(o){let c;try{c=new DOMException("Aborted","AbortError")}catch(d){c=new Error("Aborted"),c.name="AbortError"}if(o.aborted)return Promise.reject(c);const v=new Promise((d,h)=>{o.addEventListener("abort",()=>h(c),{once:!0})});return l&&l.signal&&delete l.signal,Promise.race([v,s(f,l)])}return s(f,l)},Request:i}}const Hr=Vo({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),Ho=Hr?Kh({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,ma=Hr?Ho.fetch:window.fetch;Hr?Ho.Request:window.Request;class Vh{constructor(t){this.params=t,this.apiKey=t.apiKey,this.apiEnv=t.config.apiEnv,this.apiBaseUrl=ba[this.apiEnv],this.timeSynchronisation=t.timeSynchronisation,this.isApiBaseUrlFetched=!1}resolveApiBaseUrl(){var t;return G(this,void 0,void 0,function*(){if(this.apiEnv!==x.AUTO||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{const r=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),a=yield(yield ma(r,{method:"GET",mode:"cors",cache:"no-cache"})).json(),i=(t=a==null?void 0:a.Answer[0])===null||t===void 0?void 0:t.data;if(!i)throw new Error("Wrong DNS response");return i}catch(r){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:A.NETWORK,message:"Unhandled resolve api base url error",thrown:r}),ba[x.VK_ALIAS]}finally{this.isApiBaseUrlFetched=!0}})}sendBeacon(t,r,n){if(!window.Blob||!window.navigator.sendBeacon)return!1;const a=this._prepareQueryParams({method:t,queryParams:r,sessionKey:n}),i=new window.Blob([a.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,i)}catch(s){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:A.NETWORK,message:"Unhandled beacon error",thrown:s,data:{method:t,params:r}})}return!1}sendRequest(t,r,n){return G(this,void 0,void 0,function*(){const a=T(),i=s=>{if(s instanceof TypeError&&["Failed to fetch","NetworkError when attempting to fetch resource."].includes(s.message)){this.params.error$.next({id:"Network",category:A.NETWORK,message:"Request failed",thrown:s});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:A.NETWORK,message:"Unhandled request error",thrown:s,data:{method:t,params:r,sessionKey:n,time:T()-a}})};return this.apiBaseUrl=yield this.resolveApiBaseUrl(),ma(`${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 u,f;const l=Number(s.headers.get("content-length"))===0,o=new Date((u=s.headers.get("date"))!==null&&u!==void 0?u:"").getTime(),c=T()-a;if(isFinite(o)&&((f=this.timeSynchronisation)===null||f===void 0||f.addServerTime(o,c)),!l)return s.json().then(v=>Object.prototype.hasOwnProperty.call(v,"error_msg")?Promise.reject(v):v,i)},i)})}_prepareQueryParams(t){const r=new URLSearchParams({format:"JSON",method:t.method,application_key:this.apiKey});return t.sessionKey!==void 0&&r.append("session_key",t.sessionKey),Object.entries(t.queryParams).forEach(([n,a])=>r.append(n,typeof a=="string"?a:JSON.stringify(a))),r}}const Ue="onestat_events",Qt=e=>t=>t.timestamp+e>=T();class Hh{constructor(t){this.unsaltedStorage=[],this.isPaused=!1,this.isUrgent=n=>{const{operation:a}=n;return["action_play","watch_coverage_record","watch_coverage_live"].includes(a)},this.params=t,this.api=t.api,this.error$=t.error$,this.userSalt=t.userSalt,this.loggerDebugLog=t.debugLogger.createComponentLog("stat logger"),this.firstFlush=Wr(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});const r=K.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=Wr(()=>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:A.WTF,message:(t=String(r))!==null&&t!==void 0?t:"Unknown logger error",thrown:r})}}readFromStorage(){const t=K.get(Ue);try{return t?JSON.parse(t):{}}catch(r){}return{}}addToStorage(t){var r;if(!this.userSalt){this.unsaltedStorage.push(t);return}const n=this.readFromStorage(),i=((r=n[this.userSalt])!==null&&r!==void 0?r:[]).filter(Qt(this.params.config.storageExpiration));K.set(Ue,JSON.stringify(Object.assign(Object.assign({},n),{[this.userSalt]:[...i,t]})))}getFromStorage(){var t;return this.userSalt?((t=this.readFromStorage()[this.userSalt])!==null&&t!==void 0?t:[]).filter(Qt(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}const t=this.readFromStorage();delete t[this.userSalt],K.set(Ue,JSON.stringify(t))}housekeepStorage(){const t=this.readFromStorage();for(const[r,n]of Object.entries(t)){const a=n.filter(Qt(this.params.config.storageExpiration));a.length?t[r]=a:delete t[r],this.loggerDebugLog({message:`${n.length} retrieved from storage, ${a.length} of them actual`})}K.set(Ue,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.loggerDebugLog({message:`Flushing ${r.length} events through beacon`}),this.api.logBeacon(r)):(this.loggerDebugLog({message:`Flushing ${r.length} events`}),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 Wh=e=>e&&{[N.INVARIANT]:I.UNKNOWN,[N.Q_144P]:I.Q144P,[N.Q_240P]:I.Q240P,[N.Q_360P]:I.Q360P,[N.Q_480P]:I.Q480P,[N.Q_720P]:I.Q720P,[N.Q_1080P]:I.Q1080P,[N.Q_1440P]:I.Q1440P,[N.Q_2160P]:I.Q2160P,[N.Q_4320P]:I.UNKNOWN}[e],ya=e=>e&&{[vt.HTTP1]:pe.HTTP1,[vt.HTTP2]:pe.HTTP2,[vt.QUIC]:pe.HTTP3}[e],qh=e=>{if(e!==void 0)switch(e){case E.MPEG:return O.MP4;case E.DASH:case E.DASH_LIVE:return O.DASH;case E.DASH_SEP:return O.DASH_SEP;case E.DASH_ONDEMAND:return O.ONDEMAND_DASH;case E.DASH_WEBM:case E.DASH_LIVE_WEBM:return O.WEBM;case E.DASH_WEBM_AV1:return O.AV1;case E.DASH_LIVE_CMAF:return O.ONDEMAND_DASH_LIVE;case E.HLS:case E.HLS_LIVE:return O.HLS;case E.HLS_ONDEMAND:return O.ONDEMAND_HLS;case E.HLS_LIVE_CMAF:return O.ONDEMAND_HLS_LIVE;case E.WEB_RTC_LIVE:return O.WEBRTC;default:return Sa(e)}},Jt=e=>{if(e!==void 0)switch(e){case de.NONE:case de.INLINE:return;case de.FULLSCREEN:return z.FULLSCREEN;case de.SECOND_SCREEN:return z.CHROMECAST;case de.PIP:return z.PIP;default:return Sa(e)}},zh=e=>{switch(e){case"slow-2g":return ie.POOR;case"2g":return ie.POOR;case"3g":return ie.GOOD;case"4g":return ie.EXCELLENT}};class Yh{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(),a=t-n-r/2;if(Math.abs(a)<1e3){this.offset=0;return}this.offset===void 0?this.offset=Math.round(a):this.offset=Math.round(.2*a+(1-.2)*this.offset)}}const Qh=()=>Math.floor(Math.random()*Math.pow(2,32)).toString(36).padStart(8,"0"),Jh=(e,t)=>new Qo(r=>{const n=new ze,a=Ge(er(window,"beforeunload"),e.events.willDestruct$),i=new qe(void 0);let s;n.add(e.info.isLive$.pipe(Jo()).subscribe(U=>{s&&(s.unsubscribe(),i.next(void 0)),U?s=e.info.liveTime$.pipe(Xo(ft=>ft&&ft/1e3)).subscribe(i):s=e.info.position$.subscribe(i),n.add(s)}));const{playing$:u,paused$:f}=e.events,l=e.events.willSeek$.pipe(qr(()=>e.info.playbackState$.getValue()===Yr.PLAYING)),o=e.events.seeked$.pipe(qr(()=>e.info.playbackState$.getValue()===Yr.PLAYING));let c=!1;const v=new Ke;n.add(l.subscribe(()=>{c||v.next(),c=!0})),n.add(o.subscribe(()=>c=!1));const d=new Ke,h=new Ke,p=Ge(u,o,d),b=Ge(f,v,a,e.events.looped$,h);let g;const m=()=>g=i.getValue(),Wo=()=>{const U=i.getValue();Ye(g)||g===U||Ye(U)||(r.next({from:g,to:U}),g=void 0)},qo=()=>{h.next(),d.next()};if(n.add(p.subscribe(m)),n.add(b.subscribe(Wo)),t.forceInterval&&isFinite(t.forceInterval)){let U=0;n.add(p.subscribe(()=>U=window.setTimeout(qo,t.forceInterval))),n.add(b.subscribe(()=>window.clearTimeout(U)))}return n}),Xh="_one-stat_",Xt=`${Xh}uuid`,Zt=()=>{const e=new ze;return{subscription:e,subscribe:(t,r)=>{t&&e.add(t.subscribe(r))}}};class tp{constructor(t,r){var n,a;this.subscription=new ze,this.debugLogger=new Zo,this.oneStatDebugLog=this.debugLogger.createComponentLog("onestat"),this.loopCounter=0,this.disabled=!1,this.vsid$=new qe(void 0),this.seekAction$=new qe(Xe.UNKNOWN),this.statContext=t,this.config=vu((n=r.config)!==null&&n!==void 0?n:{}),Z(r.apiEnv)&&(this.config.apiEnv=r.apiEnv),this.config.synchronizeTime&&(this.timeSynchronisation=new Yh);const i=new Ke;this.experimental={error$:i};const s=K.get(Xt);s?s.startsWith('"')&&s.endsWith('"')?(this.uuid=iu(s,'"',""),K.set(Xt,this.uuid)):this.uuid=s:(this.uuid=du(),K.set(Xt,this.uuid)),r.vsid?this.vsid$.next(r.vsid):this.resetViewSession();const u=new Vh({apiKey:Bh,config:this.config,error$:i,timeSynchronisation:this.timeSynchronisation});this.api=new Uh({config:this.config,apiTransport:u,refreshAuthToken:r.refreshAuthToken,mobile:(a=this.statContext.mobile)!==null&&a!==void 0?a:!1,uuid:this.uuid,error$:i}),this.logger=new Hh({config:this.config,debugLogger:this.debugLogger,api:this.api,error$:i,userSalt:r.userSalt});const{isEmbed:f,host:l}=ei();this.isEmbed=f,this.embedParent=l,this.subscribe()}updateContext(t){this.statContext=Object.assign(Object.assign({},this.statContext),t)}attachTo(t){const r=new ze,n=(o,c)=>r.add(o.subscribe(c));n(t.events.willStart$,()=>{const o=t.info.position$.getValue();this.logActionPlay({position:o}),this.statContext.projectId&&this.logActionPlayWithProjectId({position:o})}),n(t.events.looped$,()=>{this.resetViewSession(),++this.loopCounter>this.config.maxLoops&&(this.disabled=!0),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(Xe.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(Jh(t,{forceInterval:this.config.watchCoverageInterval}),o=>{const c=t.info.isLive$.getValue(),v={start:parseFloat(o.from.toFixed(3)),end:parseFloat(o.to.toFixed(3))};c?this.logWatchCoverageLive(v):this.logWatchCoverageRecord(v)});let a;n(t.info.isStalled$,o=>{o?a=T():(Z(a)&&this.logEmptyBuffer({duration:T()-a}),a=void 0)});let i=!1;r.add(t.events.fatalError$.pipe(ti()).subscribe(()=>i=!0)),n(t.events.willStop$,()=>{if(t.info.isStalled$.getValue()){const c=Z(a)?T()-a:void 0;this.logCloseAtEmptyBuffer({duration:c!=null?c:0}),a=void 0}else i||this.logActionStop()}),n(t.events.managedError$,({id:o})=>{this.logError({fatal:!1,errorType:o})}),n(t.events.fatalError$,({id:o})=>{this.logError({fatal:!0,errorType:o})});let s,u,f=!1;n(t.events.firstBytes$,o=>{s=T(),this.logFirstBytes({time:o})}),n(t.events.willStart$,()=>u=T()),n(t.info.currentBuffer$,o=>{!f&&o&&o.end-o.start>0&&Z(s)&&(this.logPlayerReady({duration:T()-s}),f=!0)}),n(t.events.firstFrame$,()=>{Z(s)&&!f&&(this.logPlayerReady({duration:T()-s}),f=!0),Z(u)&&this.logFirstFrame({time:T()-u})}),n(t.info.atLiveEdge$,o=>this.updateContext({liveEdge:o})),n(zr({muted:t.info.muted$,volume:t.info.volume$}),({muted:o,volume:c})=>this.updateContext({audible:!o&&c>0})),n(t.info.currentQuality$,o=>this.updateContext({quality:Wh(o)})),n(t.info.isAutoQualityEnabled$,o=>this.updateContext({autoQuality:o})),n(t.info.currentFormat$,o=>this.updateContext({contentType:qh(o)})),n(t.info.currentPlaybackRate$,o=>this.updateContext({rate:o})),n(t.info.is3DVideo$,o=>this.updateContext({is3d:o}));let l;return n(t.info.hostname$,o=>{this.updateContext({cdnHostname:o,failover:l!==void 0&&l!==o}),l=o}),n(t.info.throughputEstimation$,o=>this.updateContext({downloadSpeed:o})),n(t.info.httpConnectionType$,o=>{this.statContext.firstConnectionType||this.updateContext({firstConnectionType:ya(o)}),this.updateContext({connectionType:ya(o)})}),n(t.info.httpConnectionReused$,o=>{Ye(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:o}),this.updateContext({connectionReused:o})}),n(t.info.surface$,o=>this.updateContext({mode:Jt(o)})),n(zr({current:t.info.currentTextTrack$,available:t.info.availableTextTracks$}),({current:o,available:c})=>{const v=c.find(({id:h})=>h===o),d=v&&(v.isAuto?`${v.language}_auto`:v.language);this.updateContext({subtitles:d})}),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}=Zt();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$,a=>{var i;const s=a?z.PIP:Jt((i=this.player)===null||i===void 0?void 0:i.info.surface$.getValue());this.updateContext({mode:s})}),n(t.inFullscreen$,a=>{var i;const s=a?z.FULLSCREEN:Jt((i=this.player)===null||i===void 0?void 0:i.info.surface$.getValue());this.updateContext({mode:s})}),n(t.actionSetSubtitle$,a=>this.updateContext({subtitles:a})),n(t.nextMovie$,a=>this.logNextMovie(a)),this.resubscribeBeforeunload(),this.subscription.add(r)),r}attachToAds(t){const{subscription:r,subscribe:n}=Zt();return n(t.slotRequested$,()=>this.logAdSlotRequest()),n(t.started$,a=>this.logAdStarted(a)),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}=Zt();return n(t.click$,a=>this.logInterfaceClick(a)),n(t.nextMovie$,a=>this.logNextMovie(a)),this.resubscribeBeforeunload(),this.subscription.add(r),r}authorize(t){return this.api.authorize(t)}pause(){this.logger.pause(),this.oneStatDebugLog({message:"paused"})}resume(){this.logger.resume(),this.oneStatDebugLog({message:"resumed"})}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.oneStatDebugLog({message:"VSID reset"}),this.vsid$.next(Qh())}getDeviceId(){return this.uuid}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 a=(n=(r=this.timeSynchronisation)===null||r===void 0?void 0:r.getOffset())!==null&&n!==void 0?n:0,i=t.start+a,s=t.end+a;this.log({operation:"watch_coverage_live",param:`${i}-${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(Ge(er(t,"change"),ri(["init"])).subscribe(()=>this.updateContext({network:zh(t.effectiveType)}))),this.config.debugLog&&this.debugLogger.log$.subscribe(r=>{console.debug("%c stat ","background:#fa6470;",`component: ${r.component}.`,r.message)})}resubscribeBeforeunload(){var t;(t=this.beforeunloadSubscription)===null||t===void 0||t.unsubscribe(),this.beforeunloadSubscription=er(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))})}logActionPlayWithProjectId(t){this.statContext.projectId&&this.log({operation:"action_play",param:String(Math.round(t.position))},{vid:this.statContext.projectId})}logCloseAtEmptyBuffer(t){this.log({operation:"close_at_empty_buffer",param:String(Math.round(t.duration))})}logActionStop(){this.log({operation:"action_stop"})}log(t,r={}){if(this.disabled){this.oneStatDebugLog({message:`operation ${t.operation} but statistics is disabled`});return}if(this.config.disabledOperations.includes(t.operation)){this.oneStatDebugLog({message:`operation ${t.operation} but it is disabled`});return}this.oneStatDebugLog({message:`operation ${t.operation} ${t.param}`});const n=this.createLogItem(t,r);this.logger.log(n)}createLogItem({operation:t,param:r,time:n},a={}){var i,s;const u=(s=(i=this.timeSynchronisation)===null||i===void 0?void 0:i.now())!==null&&s!==void 0?s:T(),f=this.vsid$.getValue();ni(f);const l=t==="empty_buffer"||t==="close_at_empty_buffer"?this.statContext.connectionType:this.statContext.firstConnectionType,o=this.statContext.firstConnectionReused;let c,v;if(this.isEmbed){c=this.embedParent;const h=[...new URLSearchParams(location.search).entries()].filter(([p,b])=>this.config.embedUrlParams.includes(p));v=new URLSearchParams(h).toString()}else this.statContext.place==="direct"&&(document.referrer&&(c=new URL(document.referrer).hostname),v=location.href.substring(0,1024));const d=Object.assign({vsid:f,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?Je.AUTO:this.statContext.autoplay===!1?Je.MANUAL:void 0,param:r,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode,connection_type:l,connection_reused:o===!0?k.YES:o===!1?k.NO:void 0,cached_data:this.statContext.cached===!0?k.YES:this.statContext.cached===!1?k.NO:void 0,live:this.statContext.liveEdge?k.YES:void 0,muted:this.statContext.audible===!1?k.YES:void 0,mode:this.statContext.mode,subtitles:this.statContext.subtitles,download_speed:this.statContext.downloadSpeed,manual_quality:this.statContext.autoQuality?void 0:k.YES,ref_domain:c,direct_url:v,rate:this.statContext.rate===1||Ye(this.statContext.rate)?void 0:this.statContext.rate.toFixed(2),view_360:this.statContext.is3d?1:void 0,aid:this.statContext.albumId,vk_playlist_id:this.statContext.vkPlaylistId},a);for(const h of this.config.disabledCustomFields)delete d[h];return{operation:t,type:1,time:n,network:this.statContext.network,timestamp:u,custom:d}}}export{x as ApiEnv,pe as ConnectionType,O as ContentType,Sn as InteractiveInterfaceClick,tp as OneStat,I as Quality,Xe as SeekAction,ga as VERSION};
6
+ import{fillWithDefault as zo,ValueSubject as qe,getExponentialDelay as Yo,ErrorCategory as A,now as T,debounceFn as Hr,safeStorage as K,assertNever as Sa,Observable as Qo,Subscription as ze,merge as Ge,fromEvent as er,filterChanged as Jo,map as Xo,filter as qr,Subject as Ke,isNullable as Ye,Logger as Zo,isNonNullable as Z,detectEmbed as ei,once as ti,combine as zr,observableFrom as ri,assertNonNullable as ni}from"@vkontakte/videoplayer-shared/es2015.esm.js";import{Surface as de,VideoQuality as N,HttpConnectionType as vt,VideoFormat as E,PlaybackState as Yr}from"@vkontakte/videoplayer-core/es2015.esm.js";var dt=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Sr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var we=function(e){return e&&e.Math==Math&&e},y=we(typeof globalThis=="object"&&globalThis)||we(typeof window=="object"&&window)||we(typeof self=="object"&&self)||we(typeof dt=="object"&&dt)||function(){return this}()||dt||Function("return this")(),w=function(e){try{return!!e()}catch(t){return!0}},ai=w,rt=!ai(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),oi=rt,Ea=Function.prototype,Qr=Ea.apply,Jr=Ea.call,Oa=typeof Reflect=="object"&&Reflect.apply||(oi?Jr.bind(Qr):function(){return Jr.apply(Qr,arguments)}),Ta=rt,_a=Function.prototype,tr=_a.call,ii=Ta&&_a.bind.bind(tr,tr),R=Ta?ii:function(e){return function(){return tr.apply(e,arguments)}},Pa=R,si=Pa({}.toString),ci=Pa("".slice),ye=function(e){return ci(si(e),8,-1)},ui=ye,li=R,Ia=function(e){if(ui(e)==="Function")return li(e)},rr=typeof document=="object"&&document.all,fi=typeof rr=="undefined"&&rr!==void 0,wa={all:rr,IS_HTMLDDA:fi},Ra=wa,vi=Ra.all,$=Ra.IS_HTMLDDA?function(e){return typeof e=="function"||e===vi}:function(e){return typeof e=="function"},Er={},di=w,W=!di(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),hi=rt,Re=Function.prototype.call,P=hi?Re.bind(Re):function(){return Re.apply(Re,arguments)},Aa={},Ca={}.propertyIsEnumerable,Na=Object.getOwnPropertyDescriptor,pi=Na&&!Ca.call({1:2},1);Aa.f=pi?function(t){var r=Na(this,t);return!!r&&r.enumerable}:Ca;var nt=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},gi=R,bi=w,$i=ye,ht=Object,mi=gi("".split),yi=bi(function(){return!ht("z").propertyIsEnumerable(0)})?function(e){return $i(e)=="String"?mi(e,""):ht(e)}:ht,Se=function(e){return e==null},Si=Se,Ei=TypeError,Or=function(e){if(Si(e))throw Ei("Can't call method on "+e);return e},Oi=yi,Ti=Or,Ee=function(e){return Oi(Ti(e))},Xr=$,La=wa,_i=La.all,F=La.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:Xr(e)||e===_i}:function(e){return typeof e=="object"?e!==null:Xr(e)},Tr={},pt=Tr,gt=y,Pi=$,Zr=function(e){return Pi(e)?e:void 0},Q=function(e,t){return arguments.length<2?Zr(pt[e])||Zr(gt[e]):pt[e]&&pt[e][t]||gt[e]&&gt[e][t]},Ii=R,at=Ii({}.isPrototypeOf),ot=typeof navigator!="undefined"&&String(navigator.userAgent)||"",xa=y,bt=ot,en=xa.process,tn=xa.Deno,rn=en&&en.versions||tn&&tn.version,nn=rn&&rn.v8,C,Qe;nn&&(C=nn.split("."),Qe=C[0]>0&&C[0]<4?1:+(C[0]+C[1]));!Qe&&bt&&(C=bt.match(/Edge\/(\d+)/),(!C||C[1]>=74)&&(C=bt.match(/Chrome\/(\d+)/),C&&(Qe=+C[1])));var Da=Qe,an=Da,wi=w,Ri=y,Ai=Ri.String,ja=!!Object.getOwnPropertySymbols&&!wi(function(){var e=Symbol();return!Ai(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&an&&an<41}),Ci=ja,ka=Ci&&!Symbol.sham&&typeof Symbol.iterator=="symbol",Ni=Q,Li=$,xi=at,Di=ka,ji=Object,Ma=Di?function(e){return typeof e=="symbol"}:function(e){var t=Ni("Symbol");return Li(t)&&xi(t.prototype,ji(e))},ki=String,it=function(e){try{return ki(e)}catch(t){return"Object"}},Mi=$,Fi=it,Bi=TypeError,J=function(e){if(Mi(e))return e;throw Bi(Fi(e)+" is not a function")},Ui=J,Gi=Se,st=function(e,t){var r=e[t];return Gi(r)?void 0:Ui(r)},$t=P,mt=$,yt=F,Ki=TypeError,Vi=function(e,t){var r,n;if(t==="string"&&mt(r=e.toString)&&!yt(n=$t(r,e))||mt(r=e.valueOf)&&!yt(n=$t(r,e))||t!=="string"&&mt(r=e.toString)&&!yt(n=$t(r,e)))return n;throw Ki("Can't convert object to primitive value")},Fa={exports:{}},Wi=!0,on=y,Hi=Object.defineProperty,qi=function(e,t){try{Hi(on,e,{value:t,configurable:!0,writable:!0})}catch(r){on[e]=t}return t},zi=y,Yi=qi,sn="__core-js_shared__",Qi=zi[sn]||Yi(sn,{}),_r=Qi,cn=_r;(Fa.exports=function(e,t){return cn[e]||(cn[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 Ba=Fa.exports,Ji=Or,Xi=Object,Pr=function(e){return Xi(Ji(e))},Zi=R,es=Pr,ts=Zi({}.hasOwnProperty),D=Object.hasOwn||function(t,r){return ts(es(t),r)},rs=R,ns=0,as=Math.random(),os=rs(1 .toString),Ua=function(e){return"Symbol("+(e===void 0?"":e)+")_"+os(++ns+as,36)},is=y,ss=Ba,un=D,cs=Ua,us=ja,ls=ka,oe=is.Symbol,St=ss("wks"),fs=ls?oe.for||oe:oe&&oe.withoutSetter||cs,S=function(e){return un(St,e)||(St[e]=us&&un(oe,e)?oe[e]:fs("Symbol."+e)),St[e]},vs=P,ln=F,fn=Ma,ds=st,hs=Vi,ps=S,gs=TypeError,bs=ps("toPrimitive"),$s=function(e,t){if(!ln(e)||fn(e))return e;var r=ds(e,bs),n;if(r){if(t===void 0&&(t="default"),n=vs(r,e,t),!ln(n)||fn(n))return n;throw gs("Can't convert object to primitive value")}return t===void 0&&(t="number"),hs(e,t)},ms=$s,ys=Ma,Ir=function(e){var t=ms(e,"string");return ys(t)?t:t+""},Ss=y,vn=F,nr=Ss.document,Es=vn(nr)&&vn(nr.createElement),wr=function(e){return Es?nr.createElement(e):{}},Os=W,Ts=w,_s=wr,Ga=!Os&&!Ts(function(){return Object.defineProperty(_s("div"),"a",{get:function(){return 7}}).a!=7}),Ps=W,Is=P,ws=Aa,Rs=nt,As=Ee,Cs=Ir,Ns=D,Ls=Ga,dn=Object.getOwnPropertyDescriptor;Er.f=Ps?dn:function(t,r){if(t=As(t),r=Cs(r),Ls)try{return dn(t,r)}catch(n){}if(Ns(t,r))return Rs(!Is(ws.f,t,r),t[r])};var xs=w,Ds=$,js=/#|\.prototype\./,Oe=function(e,t){var r=Ms[ks(e)];return r==Bs?!0:r==Fs?!1:Ds(t)?xs(t):!!t},ks=Oe.normalize=function(e){return String(e).replace(js,".").toLowerCase()},Ms=Oe.data={},Fs=Oe.NATIVE="N",Bs=Oe.POLYFILL="P",Ka=Oe,hn=Ia,Us=J,Gs=rt,Ks=hn(hn.bind),ct=function(e,t){return Us(e),t===void 0?e:Gs?Ks(e,t):function(){return e.apply(t,arguments)}},X={},Vs=W,Ws=w,Va=Vs&&Ws(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),Hs=F,qs=String,zs=TypeError,B=function(e){if(Hs(e))return e;throw zs(qs(e)+" is not an object")},Ys=W,Qs=Ga,Js=Va,Ae=B,pn=Ir,Xs=TypeError,Et=Object.defineProperty,Zs=Object.getOwnPropertyDescriptor,Ot="enumerable",Tt="configurable",_t="writable";X.f=Ys?Js?function(t,r,n){if(Ae(t),r=pn(r),Ae(n),typeof t=="function"&&r==="prototype"&&"value"in n&&_t in n&&!n[_t]){var a=Zs(t,r);a&&a[_t]&&(t[r]=n.value,n={configurable:Tt in n?n[Tt]:a[Tt],enumerable:Ot in n?n[Ot]:a[Ot],writable:!1})}return Et(t,r,n)}:Et:function(t,r,n){if(Ae(t),r=pn(r),Ae(n),Qs)try{return Et(t,r,n)}catch(a){}if("get"in n||"set"in n)throw Xs("Accessors not supported");return"value"in n&&(t[r]=n.value),t};var ec=W,tc=X,rc=nt,Te=ec?function(e,t,r){return tc.f(e,t,rc(1,r))}:function(e,t,r){return e[t]=r,e},Ce=y,nc=Oa,ac=Ia,oc=$,ic=Er.f,sc=Ka,ee=Tr,cc=ct,te=Te,gn=D,uc=function(e){var t=function(r,n,a){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,a)}return nc(e,this,arguments)};return t.prototype=e.prototype,t},j=function(e,t){var r=e.target,n=e.global,a=e.stat,i=e.proto,s=n?Ce:a?Ce[r]:(Ce[r]||{}).prototype,u=n?ee:ee[r]||te(ee,r,{})[r],f=u.prototype,l,o,c,v,d,h,p,b,g;for(v in t)l=sc(n?v:r+(a?".":"#")+v,e.forced),o=!l&&s&&gn(s,v),h=u[v],o&&(e.dontCallGetSet?(g=ic(s,v),p=g&&g.value):p=s[v]),d=o&&p?p:t[v],!(o&&typeof h==typeof d)&&(e.bind&&o?b=cc(d,Ce):e.wrap&&o?b=uc(d):i&&oc(d)?b=ac(d):b=d,(e.sham||d&&d.sham||h&&h.sham)&&te(b,"sham",!0),te(u,v,b),i&&(c=r+"Prototype",gn(ee,c)||te(ee,c,{}),te(ee[c],v,d),e.real&&f&&(l||!f[v])&&te(f,v,d)))},lc=F,fc=ye,vc=S,dc=vc("match"),hc=function(e){var t;return lc(e)&&((t=e[dc])!==void 0?!!t:fc(e)=="RegExp")},pc=S,gc=pc("toStringTag"),Wa={};Wa[gc]="z";var Rr=String(Wa)==="[object z]",bc=Rr,$c=$,Ve=ye,mc=S,yc=mc("toStringTag"),Sc=Object,Ec=Ve(function(){return arguments}())=="Arguments",Oc=function(e,t){try{return e[t]}catch(r){}},_e=bc?Ve:function(e){var t,r,n;return e===void 0?"Undefined":e===null?"Null":typeof(r=Oc(t=Sc(e),yc))=="string"?r:Ec?Ve(t):(n=Ve(t))=="Object"&&$c(t.callee)?"Arguments":n},Tc=_e,_c=String,Pc=function(e){if(Tc(e)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return _c(e)},Ic=B,wc=function(){var e=Ic(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},Rc=P,Ac=D,Cc=at,Nc=wc,bn=RegExp.prototype,Lc=function(e){var t=e.flags;return t===void 0&&!("flags"in bn)&&!Ac(e,"flags")&&Cc(bn,e)?Rc(Nc,e):t},Ar=R,xc=Pr,Dc=Math.floor,Pt=Ar("".charAt),jc=Ar("".replace),It=Ar("".slice),kc=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Mc=/\$([$&'`]|\d{1,2})/g,Fc=function(e,t,r,n,a,i){var s=r+e.length,u=n.length,f=Mc;return a!==void 0&&(a=xc(a),f=kc),jc(i,f,function(l,o){var c;switch(Pt(o,0)){case"$":return"$";case"&":return e;case"`":return It(t,0,r);case"'":return It(t,s);case"<":c=a[It(o,1,-1)];break;default:var v=+o;if(v===0)return l;if(v>u){var d=Dc(v/10);return d===0?l:d<=u?n[d-1]===void 0?Pt(o,1):n[d-1]+Pt(o,1):l}c=n[v-1]}return c===void 0?"":c})},Bc=j,Uc=P,Cr=R,$n=Or,Gc=$,Kc=Se,Vc=hc,re=Pc,Wc=st,Hc=Lc,qc=Fc,zc=S,Yc=zc("replace"),Qc=TypeError,Ha=Cr("".indexOf),Jc=Cr("".replace),mn=Cr("".slice),Xc=Math.max,yn=function(e,t,r){return r>e.length?-1:t===""?r:Ha(e,t,r)};Bc({target:"String",proto:!0},{replaceAll:function(t,r){var n=$n(this),a,i,s,u,f,l,o,c,v,d=0,h=0,p="";if(!Kc(t)){if(a=Vc(t),a&&(i=re($n(Hc(t))),!~Ha(i,"g")))throw Qc("`.replaceAll` does not allow non-global regexes");if(s=Wc(t,Yc),s)return Uc(s,t,n,r);if(a)return Jc(re(n),t,r)}for(u=re(n),f=re(t),l=Gc(r),l||(r=re(r)),o=f.length,c=Xc(1,o),d=yn(u,f,0);d!==-1;)v=l?re(r(f,d,u)):qc(f,u,d,[],void 0,r),p+=mn(u,h,d)+v,h=d+o,d=yn(u,f,d+c);return h<u.length&&(p+=mn(u,h)),p}});var Zc=Q,qa=Zc,eu=qa,tu=eu("String","replaceAll"),ru=tu,nu=ru,au=nu,ou=au,iu=Sr(ou),x;(function(e){e.PROD="prod",e.VK_ALIAS="vk_alias",e.VIDEOTEST="videotest",e.TEST="test",e.AUTO="auto"})(x||(x={}));var I;(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"})(I||(I={}));var O;(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"})(O||(O={}));var Je;(function(e){e.AUTO="auto",e.MANUAL=""})(Je||(Je={}));var pe;(function(e){e.HTTP1="http1",e.HTTP2="http2",e.HTTP3="http3"})(pe||(pe={}));var k;(function(e){e[e.YES=1]="YES",e[e.NO=0]="NO"})(k||(k={}));var ie;(function(e){e.EXCELLENT="excellent",e.GOOD="good",e.POOR="poor"})(ie||(ie={}));var z;(function(e){e.PIP="pip",e.FULLSCREEN="fullscreen",e.EXTERNAL="external",e.PREFETCH="prefetch",e.AIRPLAY="airplay",e.CHROMECAST="chromecast",e.INVISIBLE="invisible"})(z||(z={}));var Xe;(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"})(Xe||(Xe={}));var Sn;(function(e){e.GRAPH_SHOW="iGraphShow",e.GRAPH_HIDE="iGraphHide",e.NEXT_AREA="iNextChapterArea",e.NEXT_BUTTON="iNextChapterBtn",e.WATCH_AGAIN="iWatchAgainBtn"})(Sn||(Sn={}));const su={action_play:"ap",first_bytes:"fb",player_ready:"pr",first_frame:"ff",seek:"sk",watch_coverage_record:"wr",watch_coverage_live:"wl",empty_buffer:"eb",action_stop:"as",close_at_empty_buffer:"cb",content_error:"er",player_interface_click:"pc",next_movie:"nm",track_switch:"ts"},cu={vsid:"si",vid:"vi",place:"pl",quality:"qt",cdn_host:"ch",stat_type:"st",param:"pm",vk_app_id:"va",track_code:"tc",connection_type:"cnt",connection_reused:"cr",cached_data:"cd",live:"lv",muted:"mu",mode:"mo",subtitles:"sb",failover:"fo",download_speed:"ds",manual_quality:"mq",ref_domain:"rd",direct_url:"du"},uu={unknown:"un",mobile:"m",lowest:"ls",low:"l",medium:"md",high:"h",fullhd:"f",quadhd:"q",ultrahd:"u"},lu={pip:"pi",fullscreen:"fs",external:"ex",prefetch:"pr",airplay:"ap",chromecast:"cc",invisible:"iv"},fu={apiEnv:x.VK_ALIAS,requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageInterval:15e3,disabledOperations:[],disabledCustomFields:[],shorten:!0,maxLoops:100,embedUrlParams:[],useBeacon:!0,synchronizeTime:!0,debugLog:!1,backoff:{start:1e3,factor:1.5,max:5*60*1e3,random:.1}},vu=e=>zo(e,fu);function du(){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),t=new Array(36);let r=0,n,a;for(a=0;a<36;a++)a===8||a===13||a===18||a===23?t[a]="-":a===14?t[a]="4":(r<=2&&(r=33554432+Math.random()*16777216|0),n=r&15,r=r>>4,t[a]=e[a===19?n&3|8:n]);return t.join("")}function G(e,t,r,n){function a(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function u(o){try{l(n.next(o))}catch(c){s(c)}}function f(o){try{l(n.throw(o))}catch(c){s(c)}}function l(o){o.done?i(o.value):a(o.value).then(u,f)}l((n=n.apply(e,t||[])).next())})}var hu=ye,ut=typeof process!="undefined"&&hu(process)=="process",pu=Te,Nr=function(e,t,r,n){return n&&n.enumerable?e[t]=r:pu(e,t,r),e},gu=Rr,bu=_e,$u=gu?{}.toString:function(){return"[object "+bu(this)+"]"},mu=Rr,yu=X.f,Su=Te,Eu=D,Ou=$u,Tu=S,En=Tu("toStringTag"),Lr=function(e,t,r,n){if(e){var a=r?e:e.prototype;Eu(a,En)||yu(a,En,{configurable:!0,value:t}),n&&!mu&&Su(a,"toString",Ou)}},_u=X,Pu=function(e,t,r){return _u.f(e,t,r)},Iu=Q,wu=Pu,Ru=S,Au=W,On=Ru("species"),Cu=function(e){var t=Iu(e);Au&&t&&!t[On]&&wu(t,On,{configurable:!0,get:function(){return this}})},Nu=at,Lu=TypeError,xu=function(e,t){if(Nu(t,e))return e;throw Lu("Incorrect invocation")},Du=R,ju=$,ar=_r,ku=Du(Function.toString);ju(ar.inspectSource)||(ar.inspectSource=function(e){return ku(e)});var za=ar.inspectSource,Mu=R,Fu=w,Ya=$,Bu=_e,Uu=Q,Gu=za,Qa=function(){},Ku=[],Ja=Uu("Reflect","construct"),xr=/^\s*(?:class|function)\b/,Vu=Mu(xr.exec),Wu=!xr.exec(Qa),he=function(t){if(!Ya(t))return!1;try{return Ja(Qa,Ku,t),!0}catch(r){return!1}},Xa=function(t){if(!Ya(t))return!1;switch(Bu(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Wu||!!Vu(xr,Gu(t))}catch(r){return!0}};Xa.sham=!0;var Hu=!Ja||Fu(function(){var e;return he(he.call)||!he(Object)||!he(function(){e=!0})||e})?Xa:he,qu=Hu,zu=it,Yu=TypeError,Qu=function(e){if(qu(e))return e;throw Yu(zu(e)+" is not a constructor")},Tn=B,Ju=Qu,Xu=Se,Zu=S,el=Zu("species"),Za=function(e,t){var r=Tn(e).constructor,n;return r===void 0||Xu(n=Tn(r)[el])?t:Ju(n)},tl=Q,eo=tl("document","documentElement"),rl=R,nl=rl([].slice),al=TypeError,ol=function(e,t){if(e<t)throw al("Not enough arguments");return e},il=ot,to=/(?:ipad|iphone|ipod).*applewebkit/i.test(il),_=y,sl=Oa,cl=ct,_n=$,ul=D,ro=w,Pn=eo,ll=nl,In=wr,fl=ol,vl=to,dl=ut,or=_.setImmediate,ir=_.clearImmediate,hl=_.process,wt=_.Dispatch,pl=_.Function,wn=_.MessageChannel,gl=_.String,Rt=0,ge={},Rn="onreadystatechange",$e,H,At,Ct;ro(function(){$e=_.location});var Dr=function(e){if(ul(ge,e)){var t=ge[e];delete ge[e],t()}},Nt=function(e){return function(){Dr(e)}},An=function(e){Dr(e.data)},Cn=function(e){_.postMessage(gl(e),$e.protocol+"//"+$e.host)};(!or||!ir)&&(or=function(t){fl(arguments.length,1);var r=_n(t)?t:pl(t),n=ll(arguments,1);return ge[++Rt]=function(){sl(r,void 0,n)},H(Rt),Rt},ir=function(t){delete ge[t]},dl?H=function(e){hl.nextTick(Nt(e))}:wt&&wt.now?H=function(e){wt.now(Nt(e))}:wn&&!vl?(At=new wn,Ct=At.port2,At.port1.onmessage=An,H=cl(Ct.postMessage,Ct)):_.addEventListener&&_n(_.postMessage)&&!_.importScripts&&$e&&$e.protocol!=="file:"&&!ro(Cn)?(H=Cn,_.addEventListener("message",An,!1)):Rn in In("script")?H=function(e){Pn.appendChild(In("script"))[Rn]=function(){Pn.removeChild(this),Dr(e)}}:H=function(e){setTimeout(Nt(e),0)});var no={set:or,clear:ir},ao=function(){this.head=null,this.tail=null};ao.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 oo=ao,bl=ot,$l=/ipad|iphone|ipod/i.test(bl)&&typeof Pebble!="undefined",ml=ot,yl=/web0s(?!.*chrome)/i.test(ml),Y=y,Nn=ct,Sl=Er.f,Lt=no.set,El=oo,Ol=to,Tl=$l,_l=yl,xt=ut,Ln=Y.MutationObserver||Y.WebKitMutationObserver,xn=Y.document,Dn=Y.process,Ne=Y.Promise,jn=Sl(Y,"queueMicrotask"),sr=jn&&jn.value,ne,Dt,jt,Le,kn;if(!sr){var xe=new El,De=function(){var e,t;for(xt&&(e=Dn.domain)&&e.exit();t=xe.get();)try{t()}catch(r){throw xe.head&&ne(),r}e&&e.enter()};!Ol&&!xt&&!_l&&Ln&&xn?(Dt=!0,jt=xn.createTextNode(""),new Ln(De).observe(jt,{characterData:!0}),ne=function(){jt.data=Dt=!Dt}):!Tl&&Ne&&Ne.resolve?(Le=Ne.resolve(void 0),Le.constructor=Ne,kn=Nn(Le.then,Le),ne=function(){kn(De)}):xt?ne=function(){Dn.nextTick(De)}:(Lt=Nn(Lt,Y),ne=function(){Lt(De)}),sr=function(e){xe.head||ne(),xe.add(e)}}var Pl=sr,Il=function(e,t){try{arguments.length==1?console.error(e):console.error(e,t)}catch(r){}},jr=function(e){try{return{error:!1,value:e()}}catch(t){return{error:!0,value:t}}},wl=y,Rl=$,Mn=wl.WeakMap,Al=Rl(Mn)&&/native code/.test(String(Mn)),Cl=Ba,Nl=Ua,Fn=Cl("keys"),kr=function(e){return Fn[e]||(Fn[e]=Nl(e))},Mr={},Ll=Al,io=y,xl=F,Dl=Te,kt=D,Mt=_r,jl=kr,kl=Mr,Bn="Object already initialized",cr=io.TypeError,Ml=io.WeakMap,Ze,me,et,Fl=function(e){return et(e)?me(e):Ze(e,{})},Bl=function(e){return function(t){var r;if(!xl(t)||(r=me(t)).type!==e)throw cr("Incompatible receiver, "+e+" required");return r}};if(Ll||Mt.state){var L=Mt.state||(Mt.state=new Ml);L.get=L.get,L.has=L.has,L.set=L.set,Ze=function(e,t){if(L.has(e))throw cr(Bn);return t.facade=e,L.set(e,t),t},me=function(e){return L.get(e)||{}},et=function(e){return L.has(e)}}else{var ae=jl("state");kl[ae]=!0,Ze=function(e,t){if(kt(e,ae))throw cr(Bn);return t.facade=e,Dl(e,ae,t),t},me=function(e){return kt(e,ae)?e[ae]:{}},et=function(e){return kt(e,ae)}}var so={set:Ze,get:me,has:et,enforce:Fl,getterFor:Bl},Ul=y,le=Ul.Promise,co=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",Gl=co,Kl=ut,Vl=!Gl&&!Kl&&typeof window=="object"&&typeof document=="object",Wl=y,be=le,Hl=$,ql=Ka,zl=za,Yl=S,Ql=Vl,Jl=co,Ft=Da,Un=be&&be.prototype,Xl=Yl("species"),ur=!1,uo=Hl(Wl.PromiseRejectionEvent),Zl=ql("Promise",function(){var e=zl(be),t=e!==String(be);if(!t&&Ft===66||!(Un.catch&&Un.finally))return!0;if(!Ft||Ft<51||!/native code/.test(e)){var r=new be(function(i){i(1)}),n=function(i){i(function(){},function(){})},a=r.constructor={};if(a[Xl]=n,ur=r.then(function(){})instanceof n,!ur)return!0}return!t&&(Ql||Jl)&&!uo}),Pe={CONSTRUCTOR:Zl,REJECTION_EVENT:uo,SUBCLASSING:ur},fe={},Gn=J,ef=TypeError,tf=function(e){var t,r;this.promise=new e(function(n,a){if(t!==void 0||r!==void 0)throw ef("Bad Promise constructor");t=n,r=a}),this.resolve=Gn(t),this.reject=Gn(r)};fe.f=function(e){return new tf(e)};var rf=j,tt=ut,V=y,Ie=P,nf=Nr,af=Lr,of=Cu,sf=J,lr=$,cf=F,uf=xu,lf=Za,lo=no.set,Fr=Pl,ff=Il,vf=jr,df=oo,fo=so,fr=le,Br=Pe,vo=fe,lt="Promise",ho=Br.CONSTRUCTOR,hf=Br.REJECTION_EVENT;Br.SUBCLASSING;var Bt=fo.getterFor(lt),pf=fo.set,gf=fr&&fr.prototype,se=fr,Ut=gf,po=V.TypeError,vr=V.document,Ur=V.process,dr=vo.f,bf=dr,$f=!!(vr&&vr.createEvent&&V.dispatchEvent),go="unhandledrejection",mf="rejectionhandled",Kn=0,bo=1,yf=2,Gr=1,$o=2,je,Vn,Sf,mo=function(e){var t;return cf(e)&&lr(t=e.then)?t:!1},yo=function(e,t){var r=t.value,n=t.state==bo,a=n?e.ok:e.fail,i=e.resolve,s=e.reject,u=e.domain,f,l,o;try{a?(n||(t.rejection===$o&&Of(t),t.rejection=Gr),a===!0?f=r:(u&&u.enter(),f=a(r),u&&(u.exit(),o=!0)),f===e.promise?s(po("Promise-chain cycle")):(l=mo(f))?Ie(l,f,i,s):i(f)):s(r)}catch(c){u&&!o&&u.exit(),s(c)}},So=function(e,t){e.notified||(e.notified=!0,Fr(function(){for(var r=e.reactions,n;n=r.get();)yo(n,e);e.notified=!1,t&&!e.rejection&&Ef(e)}))},Eo=function(e,t,r){var n,a;$f?(n=vr.createEvent("Event"),n.promise=t,n.reason=r,n.initEvent(e,!1,!0),V.dispatchEvent(n)):n={promise:t,reason:r},!hf&&(a=V["on"+e])?a(n):e===go&&ff("Unhandled promise rejection",r)},Ef=function(e){Ie(lo,V,function(){var t=e.facade,r=e.value,n=Wn(e),a;if(n&&(a=vf(function(){tt?Ur.emit("unhandledRejection",r,t):Eo(go,t,r)}),e.rejection=tt||Wn(e)?$o:Gr,a.error))throw a.value})},Wn=function(e){return e.rejection!==Gr&&!e.parent},Of=function(e){Ie(lo,V,function(){var t=e.facade;tt?Ur.emit("rejectionHandled",t):Eo(mf,t,e.value)})},ce=function(e,t,r){return function(n){e(t,n,r)}},ue=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=yf,So(e,!0))},hr=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw po("Promise can't be resolved itself");var n=mo(t);n?Fr(function(){var a={done:!1};try{Ie(n,t,ce(hr,a,e),ce(ue,a,e))}catch(i){ue(a,i,e)}}):(e.value=t,e.state=bo,So(e,!1))}catch(a){ue({done:!1},a,e)}}};ho&&(se=function(t){uf(this,Ut),sf(t),Ie(je,this);var r=Bt(this);try{t(ce(hr,r),ce(ue,r))}catch(n){ue(r,n)}},Ut=se.prototype,je=function(t){pf(this,{type:lt,done:!1,notified:!1,parent:!1,reactions:new df,rejection:!1,state:Kn,value:void 0})},je.prototype=nf(Ut,"then",function(t,r){var n=Bt(this),a=dr(lf(this,se));return n.parent=!0,a.ok=lr(t)?t:!0,a.fail=lr(r)&&r,a.domain=tt?Ur.domain:void 0,n.state==Kn?n.reactions.add(a):Fr(function(){yo(a,n)}),a.promise}),Vn=function(){var e=new je,t=Bt(e);this.promise=e,this.resolve=ce(hr,t),this.reject=ce(ue,t)},vo.f=dr=function(e){return e===se||e===Sf?new Vn(e):bf(e)});rf({global:!0,constructor:!0,wrap:!0,forced:ho},{Promise:se});af(se,lt,!1,!0);of(lt);var ve={},Tf=S,_f=ve,Pf=Tf("iterator"),If=Array.prototype,wf=function(e){return e!==void 0&&(_f.Array===e||If[Pf]===e)},Rf=Math.ceil,Af=Math.floor,Cf=Math.trunc||function(t){var r=+t;return(r>0?Af:Rf)(r)},Nf=Cf,Oo=function(e){var t=+e;return t!==t||t===0?0:Nf(t)},Lf=Oo,xf=Math.min,Df=function(e){return e>0?xf(Lf(e),9007199254740991):0},jf=Df,To=function(e){return jf(e.length)},kf=_e,Hn=st,Mf=Se,Ff=ve,Bf=S,Uf=Bf("iterator"),_o=function(e){if(!Mf(e))return Hn(e,Uf)||Hn(e,"@@iterator")||Ff[kf(e)]},Gf=P,Kf=J,Vf=B,Wf=it,Hf=_o,qf=TypeError,zf=function(e,t){var r=arguments.length<2?Hf(e):t;if(Kf(r))return Vf(Gf(r,e));throw qf(Wf(e)+" is not iterable")},Yf=P,qn=B,Qf=st,Jf=function(e,t,r){var n,a;qn(e);try{if(n=Qf(e,"return"),!n){if(t==="throw")throw r;return r}n=Yf(n,e)}catch(i){a=!0,n=i}if(t==="throw")throw r;if(a)throw n;return qn(n),r},Xf=ct,Zf=P,ev=B,tv=it,rv=wf,nv=To,zn=at,av=zf,ov=_o,Yn=Jf,iv=TypeError,We=function(e,t){this.stopped=e,this.result=t},Qn=We.prototype,Kr=function(e,t,r){var n=r&&r.that,a=!!(r&&r.AS_ENTRIES),i=!!(r&&r.IS_RECORD),s=!!(r&&r.IS_ITERATOR),u=!!(r&&r.INTERRUPTED),f=Xf(t,n),l,o,c,v,d,h,p,b=function(m){return l&&Yn(l,"normal",m),new We(!0,m)},g=function(m){return a?(ev(m),u?f(m[0],m[1],b):f(m[0],m[1])):u?f(m,b):f(m)};if(i)l=e.iterator;else if(s)l=e;else{if(o=ov(e),!o)throw iv(tv(e)+" is not iterable");if(rv(o)){for(c=0,v=nv(e);v>c;c++)if(d=g(e[c]),d&&zn(Qn,d))return d;return new We(!1)}l=av(e,o)}for(h=i?e.next:l.next;!(p=Zf(h,l)).done;){try{d=g(p.value)}catch(m){Yn(l,"throw",m)}if(typeof d=="object"&&d&&zn(Qn,d))return d}return new We(!1)},sv=S,Po=sv("iterator"),Io=!1;try{var cv=0,Jn={next:function(){return{done:!!cv++}},return:function(){Io=!0}};Jn[Po]=function(){return this},Array.from(Jn,function(){throw 2})}catch(e){}var uv=function(e,t){if(!t&&!Io)return!1;var r=!1;try{var n={};n[Po]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(a){}return r},lv=le,fv=uv,vv=Pe.CONSTRUCTOR,wo=vv||!fv(function(e){lv.all(e).then(void 0,function(){})}),dv=j,hv=P,pv=J,gv=fe,bv=jr,$v=Kr,mv=wo;dv({target:"Promise",stat:!0,forced:mv},{all:function(t){var r=this,n=gv.f(r),a=n.resolve,i=n.reject,s=bv(function(){var u=pv(r.resolve),f=[],l=0,o=1;$v(t,function(c){var v=l++,d=!1;o++,hv(u,r,c).then(function(h){d||(d=!0,f[v]=h,--o||a(f))},i)}),--o||a(f)});return s.error&&i(s.value),n.promise}});var yv=j,Sv=Pe.CONSTRUCTOR,Xn=le;Xn&&Xn.prototype;yv({target:"Promise",proto:!0,forced:Sv,real:!0},{catch:function(e){return this.then(void 0,e)}});var Ev=j,Ov=P,Tv=J,_v=fe,Pv=jr,Iv=Kr,wv=wo;Ev({target:"Promise",stat:!0,forced:wv},{race:function(t){var r=this,n=_v.f(r),a=n.reject,i=Pv(function(){var s=Tv(r.resolve);Iv(t,function(u){Ov(s,r,u).then(n.resolve,a)})});return i.error&&a(i.value),n.promise}});var Rv=j,Av=P,Cv=fe,Nv=Pe.CONSTRUCTOR;Rv({target:"Promise",stat:!0,forced:Nv},{reject:function(t){var r=Cv.f(this);return Av(r.reject,void 0,t),r.promise}});var Lv=B,xv=F,Dv=fe,Ro=function(e,t){if(Lv(e),xv(t)&&t.constructor===e)return t;var r=Dv.f(e),n=r.resolve;return n(t),r.promise},jv=j,kv=Q,Mv=Wi,Fv=le,Bv=Pe.CONSTRUCTOR,Uv=Ro,Gv=kv("Promise"),Kv=!Bv;jv({target:"Promise",stat:!0,forced:Mv},{resolve:function(t){return Uv(Kv&&this===Gv?Fv:this,t)}});var Vv=j,pr=le,Wv=w,Hv=Q,qv=$,zv=Za,Zn=Ro,Yv=pr&&pr.prototype,Qv=!!pr&&Wv(function(){Yv.finally.call({then:function(){}},function(){})});Vv({target:"Promise",proto:!0,real:!0,forced:Qv},{finally:function(e){var t=zv(this,Hv("Promise")),r=qv(e);return this.then(r?function(n){return Zn(t,e()).then(function(){return n})}:e,r?function(n){return Zn(t,e()).then(function(){throw n})}:e)}});var Jv=qa,Xv=Jv("Promise","finally"),Zv=Xv,ed=Zv,td=ed,rd=td,Gt=Sr(rd),gr=W,nd=D,Ao=Function.prototype,ad=gr&&Object.getOwnPropertyDescriptor,Vr=nd(Ao,"name"),od=Vr&&function(){}.name==="something",id=Vr&&(!gr||gr&&ad(Ao,"name").configurable),sd={EXISTS:Vr,PROPER:od,CONFIGURABLE:id},Co={},cd=Oo,ud=Math.max,ld=Math.min,fd=function(e,t){var r=cd(e);return r<0?ud(r+t,0):ld(r,t)},vd=Ee,dd=fd,hd=To,ea=function(e){return function(t,r,n){var a=vd(t),i=hd(a),s=dd(n,i),u;if(e&&r!=r){for(;i>s;)if(u=a[s++],u!=u)return!0}else for(;i>s;s++)if((e||s in a)&&a[s]===r)return e||s||0;return!e&&-1}},pd={includes:ea(!0),indexOf:ea(!1)},gd=R,Kt=D,bd=Ee,$d=pd.indexOf,md=Mr,ta=gd([].push),yd=function(e,t){var r=bd(e),n=0,a=[],i;for(i in r)!Kt(md,i)&&Kt(r,i)&&ta(a,i);for(;t.length>n;)Kt(r,i=t[n++])&&(~$d(a,i)||ta(a,i));return a},No=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Sd=yd,Ed=No,Od=Object.keys||function(t){return Sd(t,Ed)},Td=W,_d=Va,Pd=X,Id=B,wd=Ee,Rd=Od;Co.f=Td&&!_d?Object.defineProperties:function(t,r){Id(t);for(var n=wd(r),a=Rd(r),i=a.length,s=0,u;i>s;)Pd.f(t,u=a[s++],n[u]);return t};var Ad=B,Cd=Co,ra=No,Nd=Mr,Ld=eo,xd=wr,Dd=kr,na=">",aa="<",br="prototype",$r="script",Lo=Dd("IE_PROTO"),Vt=function(){},xo=function(e){return aa+$r+na+e+aa+"/"+$r+na},oa=function(e){e.write(xo("")),e.close();var t=e.parentWindow.Object;return e=null,t},jd=function(){var e=xd("iframe"),t="java"+$r+":",r;return e.style.display="none",Ld.appendChild(e),e.src=String(t),r=e.contentWindow.document,r.open(),r.write(xo("document.F=Object")),r.close(),r.F},ke,He=function(){try{ke=new ActiveXObject("htmlfile")}catch(t){}He=typeof document!="undefined"?document.domain&&ke?oa(ke):jd():oa(ke);for(var e=ra.length;e--;)delete He[br][ra[e]];return He()};Nd[Lo]=!0;var Do=Object.create||function(t,r){var n;return t!==null?(Vt[br]=Ad(t),n=new Vt,Vt[br]=null,n[Lo]=t):n=He(),r===void 0?n:Cd.f(n,r)},kd=w,Md=!kd(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),Fd=D,Bd=$,Ud=Pr,Gd=kr,Kd=Md,ia=Gd("IE_PROTO"),mr=Object,Vd=mr.prototype,jo=Kd?mr.getPrototypeOf:function(e){var t=Ud(e);if(Fd(t,ia))return t[ia];var r=t.constructor;return Bd(r)&&t instanceof r?r.prototype:t instanceof mr?Vd:null},Wd=w,Hd=$,qd=F,zd=Do,sa=jo,Yd=Nr,Qd=S,yr=Qd("iterator"),ko=!1,M,Wt,Ht;[].keys&&(Ht=[].keys(),"next"in Ht?(Wt=sa(sa(Ht)),Wt!==Object.prototype&&(M=Wt)):ko=!0);var Jd=!qd(M)||Wd(function(){var e={};return M[yr].call(e)!==e});Jd?M={}:M=zd(M);Hd(M[yr])||Yd(M,yr,function(){return this});var Mo={IteratorPrototype:M,BUGGY_SAFARI_ITERATORS:ko},Xd=Mo.IteratorPrototype,Zd=Do,eh=nt,th=Lr,rh=ve,nh=function(){return this},ah=function(e,t,r,n){var a=t+" Iterator";return e.prototype=Zd(Xd,{next:eh(+!n,r)}),th(e,a,!1,!0),rh[a]=nh,e},oh=j,ih=P,Fo=sd,sh=ah,ch=jo,uh=Lr,ca=Nr,lh=S,ua=ve,Bo=Mo,fh=Fo.PROPER;Fo.CONFIGURABLE;Bo.IteratorPrototype;var Me=Bo.BUGGY_SAFARI_ITERATORS,qt=lh("iterator"),la="keys",Fe="values",fa="entries",vh=function(){return this},dh=function(e,t,r,n,a,i,s){sh(r,t,n);var u=function(g){if(g===a&&v)return v;if(!Me&&g in o)return o[g];switch(g){case la:return function(){return new r(this,g)};case Fe:return function(){return new r(this,g)};case fa:return function(){return new r(this,g)}}return function(){return new r(this)}},f=t+" Iterator",l=!1,o=e.prototype,c=o[qt]||o["@@iterator"]||a&&o[a],v=!Me&&c||u(a),d=t=="Array"&&o.entries||c,h,p,b;if(d&&(h=ch(d.call(new e)),h!==Object.prototype&&h.next&&(uh(h,f,!0,!0),ua[f]=vh)),fh&&a==Fe&&c&&c.name!==Fe&&(l=!0,v=function(){return ih(c,this)}),a)if(p={values:u(Fe),keys:i?v:u(la),entries:u(fa)},s)for(b in p)(Me||l||!(b in o))&&ca(o,b,p[b]);else oh({target:t,proto:!0,forced:Me||l},p);return s&&o[qt]!==v&&ca(o,qt,v,{name:a}),ua[t]=v,p},hh=function(e,t){return{value:e,done:t}},ph=Ee,va=ve,Uo=so;X.f;var gh=dh,Be=hh,Go="Array Iterator",bh=Uo.set,$h=Uo.getterFor(Go);gh(Array,"Array",function(e,t){bh(this,{type:Go,target:ph(e),index:0,kind:t})},function(){var e=$h(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,Be(void 0,!0)):r=="keys"?Be(n,!1):r=="values"?Be(t[n],!1):Be([n,t[n]],!1)},"values");va.Arguments=va.Array;var mh=Ir,yh=X,Sh=nt,Eh=function(e,t,r){var n=mh(t);n in e?yh.f(e,n,Sh(0,r)):e[n]=r},Oh=j,Th=Kr,_h=Eh;Oh({target:"Object",stat:!0},{fromEntries:function(t){var r={};return Th(t,function(n,a){_h(r,n,a)},{AS_ENTRIES:!0}),r}});var Ph=Tr,Ih=Ph.Object.fromEntries,wh={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Rh=wh,Ah=y,Ch=_e,Nh=Te,da=ve,Lh=S,ha=Lh("toStringTag");for(var zt in Rh){var pa=Ah[zt],Yt=pa&&pa.prototype;Yt&&Ch(Yt)!==ha&&Nh(Yt,ha,zt),da[zt]=da.Array}var xh=Ih,Dh=xh,jh=Dh,kh=jh,Mh=Sr(kh);const Fh=e=>{var t;const{operation:r,custom:n}=e,a=Mh(Object.entries(n).map(([i,s])=>{var u,f,l;const o=(u=cu[i])!==null&&u!==void 0?u:i;let c=s;return s&&(i==="mode"?c=(f=lu[s])!==null&&f!==void 0?f:s:i==="quality"&&(c=(l=uu[s])!==null&&l!==void 0?l:s)),[o,c]}));return Object.assign(Object.assign({},e),{operation:(t=su[r])!==null&&t!==void 0?t:r,custom:a})},ga="1.0.46",Bh="CIOPGQJGDIHBABABA",ba={[x.PROD]:"https://api.ok.ru",[x.VK_ALIAS]:"https://api.mycdn.me",[x.VIDEOTEST]:"https://videotestapi.ok.ru/api",[x.TEST]:"https://apitest.ok.ru",[x.AUTO]:""};var q;(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"})(q||(q={}));class Uh{constructor(t){this.consequentAuthErrors=0,this.authorized$=new qe(!1),this.params=t}authorize(t){return G(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),a=this.sessionKey;if(!a)return;this.params.apiTransport.sendBeacon(r,n,a)||this.logRequest(t)}logRequest(t){var r;return G(this,void 0,void 0,function*(){const n="log.externalLog",a=this.createLogParams(t),i=(r=this.sessionKey)!==null&&r!==void 0?r:yield this._authorizeWithBackoff();if(!i)return;const s=(u,f=this.params.config.requestRetryCount)=>G(this,void 0,void 0,function*(){try{return yield this.params.apiTransport.sendRequest(n,a,i)}catch(l){if(!l||!("error_code"in l)){this.params.error$.next({id:"logRequestUnknown",category:A.NETWORK,message:`Unknown ${n} error`,thrown:l});return}const o=l==null?void 0:l.error_code;switch(o){case q.PARAM_SESSION_EXPIRED:case q.PARAM_SESSION_KEY:case q.PARAM_SIGNATURE:return this.authorized$.next(!1),this.sessionKey=yield this._authorizeWithBackoff(),f>0?s(u,f-1):void 0;case q.AUTH_LOGIN:return this.authorized$.next(!1),this.authToken=yield this.refreshAuthToken(),this.sessionKey=yield this._authorizeWithBackoff(),f>0?s(u,f-1):void 0;default:{this.params.error$.next({id:`LogRequest#${o}`,category:A.EXTERNAL_API,message:`${n} error`,data:l});return}}}});return s(t)})}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}refreshAuthToken(){return G(this,void 0,void 0,function*(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=Gt(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise})}createLogParams(t){return{collector:"ok.mobile.apps.video",data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${ga}`,platform:this.params.mobile?"M_WEB":"WEB",items:this.params.config.shorten?t.map(Fh):t})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();const t=Yo(this.consequentAuthErrors,this.params.config.backoff);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{Gt(this._authorize().then(r).catch(n=>this.params.error$.next({id:"AuthorizeBackoff",category:A.NETWORK,message:"Otherwise unhandled error in authorization",thrown:n})),()=>this.backoffTimeoutId=0)},t))})}_authorize(){return G(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.params.uuid,client_version:ga.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=Gt(this.params.apiTransport.sendRequest(t,r).then(n=>{var a;return(!n||!n.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:A.EXTERNAL_API,message:"No session key",data:n}),this.sessionKey=(a=n==null?void 0:n.session_key)!==null&&a!==void 0?a:void 0,this.sessionKey}).catch(n=>G(this,void 0,void 0,function*(){this.sessionKey=void 0;const a=n==null?void 0:n.error_code;switch(a){case q.AUTH_LOGIN:return this.authToken=yield this.refreshAuthToken(),this._authorizeWithBackoff()}a?this.params.error$.next({id:`Authorize#${a}`,category:A.EXTERNAL_API,message:"authorize error",data:n}):this.params.error$.next({id:"AuthorizeUnknown",category:A.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 $a{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 a=0,i=n.length;a<i;a++)if(n[a].callback===r){n.splice(a,1);return}}dispatchEvent(t){if(!(t.type in this.listeners))return;const n=this.listeners[t.type].slice();for(let a=0,i=n.length;a<i;a++){const s=n[a];try{s.callback.call(this,t)}catch(u){Promise.resolve().then(()=>{throw u})}s.options&&s.options.once&&this.removeEventListener(t.type,s.callback)}return!t.defaultPrevented}}class Ko extends $a{constructor(){super(),this.listeners||$a.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 Gh{constructor(){Object.defineProperty(this,"signal",{value:new Ko,writable:!0,configurable:!0})}abort(t){let r;try{r=new Event("abort")}catch(a){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(a){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&&(Gh.prototype[Symbol.toStringTag]="AbortController",Ko.prototype[Symbol.toStringTag]="AbortSignal");function Vo(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function Kh(e){typeof e=="function"&&(e={fetch:e});const{fetch:t,Request:r=t.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a=!1}=e;if(!Vo({fetch:t,Request:r,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a}))return{fetch:t,Request:i};let i=r;(i&&!i.prototype.hasOwnProperty("signal")||a)&&(i=function(l,o){let c;o&&o.signal&&(c=o.signal,delete o.signal);const v=new r(l,o);return c&&Object.defineProperty(v,"signal",{writable:!1,enumerable:!1,configurable:!0,value:c}),v},i.prototype=r.prototype);const s=t;return{fetch:(f,l)=>{const o=i&&i.prototype.isPrototypeOf(f)?f.signal:l?l.signal:void 0;if(o){let c;try{c=new DOMException("Aborted","AbortError")}catch(d){c=new Error("Aborted"),c.name="AbortError"}if(o.aborted)return Promise.reject(c);const v=new Promise((d,h)=>{o.addEventListener("abort",()=>h(c),{once:!0})});return l&&l.signal&&delete l.signal,Promise.race([v,s(f,l)])}return s(f,l)},Request:i}}const Wr=Vo({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),Wo=Wr?Kh({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,ma=Wr?Wo.fetch:window.fetch;Wr?Wo.Request:window.Request;class Vh{constructor(t){this.params=t,this.apiKey=t.apiKey,this.apiEnv=t.config.apiEnv,this.apiBaseUrl=ba[this.apiEnv],this.timeSynchronisation=t.timeSynchronisation,this.isApiBaseUrlFetched=!1}resolveApiBaseUrl(){var t;return G(this,void 0,void 0,function*(){if(this.apiEnv!==x.AUTO||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{const r=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),a=yield(yield ma(r,{method:"GET",mode:"cors",cache:"no-cache"})).json(),i=(t=a==null?void 0:a.Answer[0])===null||t===void 0?void 0:t.data;if(!i)throw new Error("Wrong DNS response");return i}catch(r){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:A.NETWORK,message:"Unhandled resolve api base url error",thrown:r}),ba[x.VK_ALIAS]}finally{this.isApiBaseUrlFetched=!0}})}sendBeacon(t,r,n){if(!window.Blob||!window.navigator.sendBeacon)return!1;const a=this._prepareQueryParams({method:t,queryParams:r,sessionKey:n}),i=new window.Blob([a.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,i)}catch(s){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:A.NETWORK,message:"Unhandled beacon error",thrown:s,data:{method:t,params:r}})}return!1}sendRequest(t,r,n){return G(this,void 0,void 0,function*(){const a=T(),i=s=>{if(s instanceof TypeError&&["Failed to fetch","NetworkError when attempting to fetch resource."].includes(s.message)){this.params.error$.next({id:"Network",category:A.NETWORK,message:"Request failed",thrown:s});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:A.NETWORK,message:"Unhandled request error",thrown:s,data:{method:t,params:r,sessionKey:n,time:T()-a}})};return this.apiBaseUrl=yield this.resolveApiBaseUrl(),ma(`${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 u,f;const l=Number(s.headers.get("content-length"))===0,o=new Date((u=s.headers.get("date"))!==null&&u!==void 0?u:"").getTime(),c=T()-a;if(isFinite(o)&&((f=this.timeSynchronisation)===null||f===void 0||f.addServerTime(o,c)),!l)return s.json().then(v=>Object.prototype.hasOwnProperty.call(v,"error_msg")?Promise.reject(v):v,i)},i)})}_prepareQueryParams(t){const r=new URLSearchParams({format:"JSON",method:t.method,application_key:this.apiKey});return t.sessionKey!==void 0&&r.append("session_key",t.sessionKey),Object.entries(t.queryParams).forEach(([n,a])=>r.append(n,typeof a=="string"?a:JSON.stringify(a))),r}}const Ue="onestat_events",Qt=e=>t=>t.timestamp+e>=T();class Wh{constructor(t){this.unsaltedStorage=[],this.isPaused=!1,this.isUrgent=n=>{const{operation:a}=n;return["action_play","watch_coverage_record","watch_coverage_live"].includes(a)},this.params=t,this.api=t.api,this.error$=t.error$,this.userSalt=t.userSalt,this.loggerDebugLog=t.debugLogger.createComponentLog("stat logger"),this.firstFlush=Hr(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});const r=K.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=Hr(()=>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:A.WTF,message:(t=String(r))!==null&&t!==void 0?t:"Unknown logger error",thrown:r})}}readFromStorage(){const t=K.get(Ue);try{return t?JSON.parse(t):{}}catch(r){}return{}}addToStorage(t){var r;if(!this.userSalt){this.unsaltedStorage.push(t);return}const n=this.readFromStorage(),i=((r=n[this.userSalt])!==null&&r!==void 0?r:[]).filter(Qt(this.params.config.storageExpiration));K.set(Ue,JSON.stringify(Object.assign(Object.assign({},n),{[this.userSalt]:[...i,t]})))}getFromStorage(){var t;return this.userSalt?((t=this.readFromStorage()[this.userSalt])!==null&&t!==void 0?t:[]).filter(Qt(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}const t=this.readFromStorage();delete t[this.userSalt],K.set(Ue,JSON.stringify(t))}housekeepStorage(){const t=this.readFromStorage();for(const[r,n]of Object.entries(t)){const a=n.filter(Qt(this.params.config.storageExpiration));a.length?t[r]=a:delete t[r],this.loggerDebugLog({message:`${n.length} retrieved from storage, ${a.length} of them actual`})}K.set(Ue,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.loggerDebugLog({message:`Flushing ${r.length} events through beacon`}),this.api.logBeacon(r)):(this.loggerDebugLog({message:`Flushing ${r.length} events`}),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 Hh=e=>e&&{[N.INVARIANT]:I.UNKNOWN,[N.Q_144P]:I.Q144P,[N.Q_240P]:I.Q240P,[N.Q_360P]:I.Q360P,[N.Q_480P]:I.Q480P,[N.Q_720P]:I.Q720P,[N.Q_1080P]:I.Q1080P,[N.Q_1440P]:I.Q1440P,[N.Q_2160P]:I.Q2160P,[N.Q_4320P]:I.UNKNOWN}[e],ya=e=>e&&{[vt.HTTP1]:pe.HTTP1,[vt.HTTP2]:pe.HTTP2,[vt.QUIC]:pe.HTTP3}[e],qh=e=>{if(e!==void 0)switch(e){case E.MPEG:return O.MP4;case E.DASH_LIVE:return O.DASH;case E.DASH_SEP:return O.DASH_SEP;case E.DASH_ONDEMAND:return O.ONDEMAND_DASH;case E.DASH_WEBM:case E.DASH_LIVE_WEBM:return O.WEBM;case E.DASH_WEBM_AV1:return O.AV1;case E.DASH_LIVE_CMAF:return O.ONDEMAND_DASH_LIVE;case E.HLS:case E.HLS_LIVE:return O.HLS;case E.HLS_ONDEMAND:return O.ONDEMAND_HLS;case E.HLS_LIVE_CMAF:return O.ONDEMAND_HLS_LIVE;case E.WEB_RTC_LIVE:return O.WEBRTC;default:return Sa(e)}},Jt=e=>{if(e!==void 0)switch(e){case de.NONE:case de.INLINE:return;case de.FULLSCREEN:return z.FULLSCREEN;case de.SECOND_SCREEN:return z.CHROMECAST;case de.PIP:return z.PIP;default:return Sa(e)}},zh=e=>{switch(e){case"slow-2g":return ie.POOR;case"2g":return ie.POOR;case"3g":return ie.GOOD;case"4g":return ie.EXCELLENT}};class Yh{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(),a=t-n-r/2;if(Math.abs(a)<1e3){this.offset=0;return}this.offset===void 0?this.offset=Math.round(a):this.offset=Math.round(.2*a+(1-.2)*this.offset)}}const Qh=()=>Math.floor(Math.random()*Math.pow(2,32)).toString(36).padStart(8,"0"),Jh=(e,t)=>new Qo(r=>{const n=new ze,a=Ge(er(window,"beforeunload"),e.events.willDestruct$),i=new qe(void 0);let s;n.add(e.info.isLive$.pipe(Jo()).subscribe(U=>{s&&(s.unsubscribe(),i.next(void 0)),U?s=e.info.liveTime$.pipe(Xo(ft=>ft&&ft/1e3)).subscribe(i):s=e.info.position$.subscribe(i),n.add(s)}));const{playing$:u,paused$:f}=e.events,l=e.events.willSeek$.pipe(qr(()=>e.info.playbackState$.getValue()===Yr.PLAYING)),o=e.events.seeked$.pipe(qr(()=>e.info.playbackState$.getValue()===Yr.PLAYING));let c=!1;const v=new Ke;n.add(l.subscribe(()=>{c||v.next(),c=!0})),n.add(o.subscribe(()=>c=!1));const d=new Ke,h=new Ke,p=Ge(u,o,d),b=Ge(f,v,a,e.events.looped$,h);let g;const m=()=>g=i.getValue(),Ho=()=>{const U=i.getValue();Ye(g)||g===U||Ye(U)||(r.next({from:g,to:U}),g=void 0)},qo=()=>{h.next(),d.next()};if(n.add(p.subscribe(m)),n.add(b.subscribe(Ho)),t.forceInterval&&isFinite(t.forceInterval)){let U=0;n.add(p.subscribe(()=>U=window.setTimeout(qo,t.forceInterval))),n.add(b.subscribe(()=>window.clearTimeout(U)))}return n}),Xh="_one-stat_",Xt=`${Xh}uuid`,Zt=()=>{const e=new ze;return{subscription:e,subscribe:(t,r)=>{t&&e.add(t.subscribe(r))}}};class tp{constructor(t,r){var n,a;this.subscription=new ze,this.debugLogger=new Zo,this.oneStatDebugLog=this.debugLogger.createComponentLog("onestat"),this.loopCounter=0,this.disabled=!1,this.vsid$=new qe(void 0),this.seekAction$=new qe(Xe.UNKNOWN),this.statContext=t,this.config=vu((n=r.config)!==null&&n!==void 0?n:{}),Z(r.apiEnv)&&(this.config.apiEnv=r.apiEnv),this.config.synchronizeTime&&(this.timeSynchronisation=new Yh);const i=new Ke;this.experimental={error$:i};const s=K.get(Xt);s?s.startsWith('"')&&s.endsWith('"')?(this.uuid=iu(s,'"',""),K.set(Xt,this.uuid)):this.uuid=s:(this.uuid=du(),K.set(Xt,this.uuid)),r.vsid?this.vsid$.next(r.vsid):this.resetViewSession();const u=new Vh({apiKey:Bh,config:this.config,error$:i,timeSynchronisation:this.timeSynchronisation});this.api=new Uh({config:this.config,apiTransport:u,refreshAuthToken:r.refreshAuthToken,mobile:(a=this.statContext.mobile)!==null&&a!==void 0?a:!1,uuid:this.uuid,error$:i}),this.logger=new Wh({config:this.config,debugLogger:this.debugLogger,api:this.api,error$:i,userSalt:r.userSalt});const{isEmbed:f,host:l}=ei();this.isEmbed=f,this.embedParent=l,this.subscribe()}updateContext(t){this.statContext=Object.assign(Object.assign({},this.statContext),t)}attachTo(t){const r=new ze,n=(o,c)=>r.add(o.subscribe(c));n(t.events.willStart$,()=>{const o=t.info.position$.getValue();this.logActionPlay({position:o}),this.statContext.projectId&&this.logActionPlayWithProjectId({position:o})}),n(t.events.looped$,()=>{this.resetViewSession(),++this.loopCounter>this.config.maxLoops&&(this.disabled=!0),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(Xe.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(Jh(t,{forceInterval:this.config.watchCoverageInterval}),o=>{const c=t.info.isLive$.getValue(),v={start:parseFloat(o.from.toFixed(3)),end:parseFloat(o.to.toFixed(3))};c?this.logWatchCoverageLive(v):this.logWatchCoverageRecord(v)});let a;n(t.info.isStalled$,o=>{o?a=T():(Z(a)&&this.logEmptyBuffer({duration:T()-a}),a=void 0)});let i=!1;r.add(t.events.fatalError$.pipe(ti()).subscribe(()=>i=!0)),n(t.events.willStop$,()=>{if(t.info.isStalled$.getValue()){const c=Z(a)?T()-a:void 0;this.logCloseAtEmptyBuffer({duration:c!=null?c:0}),a=void 0}else i||this.logActionStop()}),n(t.events.managedError$,({id:o})=>{this.logError({fatal:!1,errorType:o})}),n(t.events.fatalError$,({id:o})=>{this.logError({fatal:!0,errorType:o})});let s,u,f=!1;n(t.events.firstBytes$,o=>{s=T(),this.logFirstBytes({time:o})}),n(t.events.willStart$,()=>u=T()),n(t.info.currentBuffer$,o=>{!f&&o&&o.end-o.start>0&&Z(s)&&(this.logPlayerReady({duration:T()-s}),f=!0)}),n(t.events.firstFrame$,()=>{Z(s)&&!f&&(this.logPlayerReady({duration:T()-s}),f=!0),Z(u)&&this.logFirstFrame({time:T()-u})}),n(t.info.atLiveEdge$,o=>this.updateContext({liveEdge:o})),n(zr({muted:t.info.muted$,volume:t.info.volume$}),({muted:o,volume:c})=>this.updateContext({audible:!o&&c>0})),n(t.info.currentQuality$,o=>this.updateContext({quality:Hh(o)})),n(t.info.isAutoQualityEnabled$,o=>this.updateContext({autoQuality:o})),n(t.info.currentFormat$,o=>this.updateContext({contentType:qh(o)})),n(t.info.currentPlaybackRate$,o=>this.updateContext({rate:o})),n(t.info.is3DVideo$,o=>this.updateContext({is3d:o}));let l;return n(t.info.hostname$,o=>{this.updateContext({cdnHostname:o,failover:l!==void 0&&l!==o}),l=o}),n(t.info.throughputEstimation$,o=>this.updateContext({downloadSpeed:o})),n(t.info.httpConnectionType$,o=>{this.statContext.firstConnectionType||this.updateContext({firstConnectionType:ya(o)}),this.updateContext({connectionType:ya(o)})}),n(t.info.httpConnectionReused$,o=>{Ye(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:o}),this.updateContext({connectionReused:o})}),n(t.info.surface$,o=>this.updateContext({mode:Jt(o)})),n(zr({current:t.info.currentTextTrack$,available:t.info.availableTextTracks$}),({current:o,available:c})=>{const v=c.find(({id:h})=>h===o),d=v&&(v.isAuto?`${v.language}_auto`:v.language);this.updateContext({subtitles:d})}),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}=Zt();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$,a=>{var i;const s=a?z.PIP:Jt((i=this.player)===null||i===void 0?void 0:i.info.surface$.getValue());this.updateContext({mode:s})}),n(t.inFullscreen$,a=>{var i;const s=a?z.FULLSCREEN:Jt((i=this.player)===null||i===void 0?void 0:i.info.surface$.getValue());this.updateContext({mode:s})}),n(t.actionSetSubtitle$,a=>this.updateContext({subtitles:a})),n(t.nextMovie$,a=>this.logNextMovie(a)),this.resubscribeBeforeunload(),this.subscription.add(r)),r}attachToAds(t){const{subscription:r,subscribe:n}=Zt();return n(t.slotRequested$,()=>this.logAdSlotRequest()),n(t.started$,a=>this.logAdStarted(a)),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}=Zt();return n(t.click$,a=>this.logInterfaceClick(a)),n(t.nextMovie$,a=>this.logNextMovie(a)),this.resubscribeBeforeunload(),this.subscription.add(r),r}authorize(t){return this.api.authorize(t)}pause(){this.logger.pause(),this.oneStatDebugLog({message:"paused"})}resume(){this.logger.resume(),this.oneStatDebugLog({message:"resumed"})}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.oneStatDebugLog({message:"VSID reset"}),this.vsid$.next(Qh())}getDeviceId(){return this.uuid}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 a=(n=(r=this.timeSynchronisation)===null||r===void 0?void 0:r.getOffset())!==null&&n!==void 0?n:0,i=t.start+a,s=t.end+a;this.log({operation:"watch_coverage_live",param:`${i}-${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(Ge(er(t,"change"),ri(["init"])).subscribe(()=>this.updateContext({network:zh(t.effectiveType)}))),this.config.debugLog&&this.debugLogger.log$.subscribe(r=>{console.debug("%c stat ","background:#fa6470;",`component: ${r.component}.`,r.message)})}resubscribeBeforeunload(){var t;(t=this.beforeunloadSubscription)===null||t===void 0||t.unsubscribe(),this.beforeunloadSubscription=er(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))})}logActionPlayWithProjectId(t){this.statContext.projectId&&this.log({operation:"action_play",param:String(Math.round(t.position))},{vid:this.statContext.projectId})}logCloseAtEmptyBuffer(t){this.log({operation:"close_at_empty_buffer",param:String(Math.round(t.duration))})}logActionStop(){this.log({operation:"action_stop"})}log(t,r={}){if(this.disabled){this.oneStatDebugLog({message:`operation ${t.operation} but statistics is disabled`});return}if(this.config.disabledOperations.includes(t.operation)){this.oneStatDebugLog({message:`operation ${t.operation} but it is disabled`});return}this.oneStatDebugLog({message:`operation ${t.operation} ${t.param}`});const n=this.createLogItem(t,r);this.logger.log(n)}createLogItem({operation:t,param:r,time:n},a={}){var i,s;const u=(s=(i=this.timeSynchronisation)===null||i===void 0?void 0:i.now())!==null&&s!==void 0?s:T(),f=this.vsid$.getValue();ni(f);const l=t==="empty_buffer"||t==="close_at_empty_buffer"?this.statContext.connectionType:this.statContext.firstConnectionType,o=this.statContext.firstConnectionReused;let c,v;if(this.isEmbed){c=this.embedParent;const h=[...new URLSearchParams(location.search).entries()].filter(([p,b])=>this.config.embedUrlParams.includes(p));v=new URLSearchParams(h).toString()}else this.statContext.place==="direct"&&(document.referrer&&(c=new URL(document.referrer).hostname),v=location.href.substring(0,1024));const d=Object.assign({vsid:f,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?Je.AUTO:this.statContext.autoplay===!1?Je.MANUAL:void 0,param:r,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode,connection_type:l,connection_reused:o===!0?k.YES:o===!1?k.NO:void 0,cached_data:this.statContext.cached===!0?k.YES:this.statContext.cached===!1?k.NO:void 0,live:this.statContext.liveEdge?k.YES:void 0,muted:this.statContext.audible===!1?k.YES:void 0,mode:this.statContext.mode,subtitles:this.statContext.subtitles,download_speed:this.statContext.downloadSpeed,manual_quality:this.statContext.autoQuality?void 0:k.YES,ref_domain:c,direct_url:v,rate:this.statContext.rate===1||Ye(this.statContext.rate)?void 0:this.statContext.rate.toFixed(2),view_360:this.statContext.is3d?1:void 0,aid:this.statContext.albumId,vk_playlist_id:this.statContext.vkPlaylistId},a);for(const h of this.config.disabledCustomFields)delete d[h];return{operation:t,type:1,time:n,network:this.statContext.network,timestamp:u,custom:d}}}export{x as ApiEnv,pe as ConnectionType,O as ContentType,Sn as InteractiveInterfaceClick,tp as OneStat,I as Quality,Xe as SeekAction,ga as VERSION};
package/es2018.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-statistics v1.0.46-dev.df8758f1.0
3
- * Wed, 13 Mar 2024 12:50:02 GMT
2
+ * @vkontakte/videoplayer-statistics v1.0.46
3
+ * Mon, 08 Apr 2024 01:44:19 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-46/doc/
5
5
  */
6
- "use strict";var l=require("@vkontakte/videoplayer-shared/es2018.cjs.js"),p=require("@vkontakte/videoplayer-core/es2018.cjs.js"),me=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function yr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Y=function(e){return e&&e.Math==Math&&e},T=Y(typeof globalThis=="object"&&globalThis)||Y(typeof window=="object"&&window)||Y(typeof self=="object"&&self)||Y(typeof me=="object"&&me)||function(){return this}()||me||Function("return this")(),P=function(e){try{return!!e()}catch(t){return!0}},gn=P,de=!gn(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),bn=de,mr=Function.prototype,mt=mr.apply,St=mr.call,yn=typeof Reflect=="object"&&Reflect.apply||(bn?St.bind(mt):function(){return St.apply(mt,arguments)}),Sr=de,$r=Function.prototype,qe=$r.call,mn=Sr&&$r.bind.bind(qe,qe),I=Sr?mn:function(e){return function(){return qe.apply(e,arguments)}},Er=I,Sn=Er({}.toString),$n=Er("".slice),he=function(e){return $n(Sn(e),8,-1)},En=he,Tn=I,Tr=function(e){if(En(e)==="Function")return Tn(e)},Qe=typeof document=="object"&&document.all,_n=typeof Qe=="undefined"&&Qe!==void 0,_r={all:Qe,IS_HTMLDDA:_n},Or=_r,On=Or.all,$=Or.IS_HTMLDDA?function(e){return typeof e=="function"||e===On}:function(e){return typeof e=="function"},wr={},wn=P,j=!wn(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),An=de,X=Function.prototype.call,R=An?X.bind(X):function(){return X.apply(X,arguments)},Ar={},Pr={}.propertyIsEnumerable,Ir=Object.getOwnPropertyDescriptor,Pn=Ir&&!Pr.call({1:2},1);Ar.f=Pn?function(t){var r=Ir(this,t);return!!r&&r.enumerable}:Pr;var ve=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},In=I,Rn=P,Cn=he,Se=Object,Nn=In("".split),Ln=Rn(function(){return!Se("z").propertyIsEnumerable(0)})?function(e){return Cn(e)=="String"?Nn(e,""):Se(e)}:Se,pe=function(e){return e==null},xn=pe,jn=TypeError,nt=function(e){if(xn(e))throw jn("Can't call method on "+e);return e},kn=Ln,Dn=nt,q=function(e){return kn(Dn(e))},$t=$,Rr=_r,Fn=Rr.all,k=Rr.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:$t(e)||e===Fn}:function(e){return typeof e=="object"?e!==null:$t(e)},ot={},$e=ot,Ee=T,Mn=$,Et=function(e){return Mn(e)?e:void 0},at=function(e,t){return arguments.length<2?Et($e[e])||Et(Ee[e]):$e[e]&&$e[e][t]||Ee[e]&&Ee[e][t]},Bn=I,it=Bn({}.isPrototypeOf),Un=typeof navigator!="undefined"&&String(navigator.userAgent)||"",Cr=T,Te=Un,Tt=Cr.process,_t=Cr.Deno,Ot=Tt&&Tt.versions||_t&&_t.version,wt=Ot&&Ot.v8,E,le;wt&&(E=wt.split("."),le=E[0]>0&&E[0]<4?1:+(E[0]+E[1]));!le&&Te&&(E=Te.match(/Edge\/(\d+)/),(!E||E[1]>=74)&&(E=Te.match(/Chrome\/(\d+)/),E&&(le=+E[1])));var Vn=le,At=Vn,Gn=P,Kn=T,Hn=Kn.String,Nr=!!Object.getOwnPropertySymbols&&!Gn(function(){var e=Symbol();return!Hn(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&At&&At<41}),Wn=Nr,Lr=Wn&&!Symbol.sham&&typeof Symbol.iterator=="symbol",qn=at,Qn=$,zn=it,Yn=Lr,Xn=Object,xr=Yn?function(e){return typeof e=="symbol"}:function(e){var t=qn("Symbol");return Qn(t)&&zn(t.prototype,Xn(e))},Jn=String,st=function(e){try{return Jn(e)}catch(t){return"Object"}},Zn=$,eo=st,to=TypeError,lt=function(e){if(Zn(e))return e;throw to(eo(e)+" is not a function")},ro=lt,no=pe,ge=function(e,t){var r=e[t];return no(r)?void 0:ro(r)},_e=R,Oe=$,we=k,oo=TypeError,ao=function(e,t){var r,n;if(t==="string"&&Oe(r=e.toString)&&!we(n=_e(r,e))||Oe(r=e.valueOf)&&!we(n=_e(r,e))||t!=="string"&&Oe(r=e.toString)&&!we(n=_e(r,e)))return n;throw oo("Can't convert object to primitive value")},jr={exports:{}},Pt=T,io=Object.defineProperty,so=function(e,t){try{io(Pt,e,{value:t,configurable:!0,writable:!0})}catch(r){Pt[e]=t}return t},lo=T,uo=so,It="__core-js_shared__",co=lo[It]||uo(It,{}),kr=co,Rt=kr;(jr.exports=function(e,t){return Rt[e]||(Rt[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 Dr=jr.exports,fo=nt,ho=Object,ut=function(e){return ho(fo(e))},vo=I,po=ut,go=vo({}.hasOwnProperty),C=Object.hasOwn||function(t,r){return go(po(t),r)},bo=I,yo=0,mo=Math.random(),So=bo(1 .toString),Fr=function(e){return"Symbol("+(e===void 0?"":e)+")_"+So(++yo+mo,36)},$o=T,Eo=Dr,Ct=C,To=Fr,_o=Nr,Oo=Lr,V=$o.Symbol,Ae=Eo("wks"),wo=Oo?V.for||V:V&&V.withoutSetter||To,_=function(e){return Ct(Ae,e)||(Ae[e]=_o&&Ct(V,e)?V[e]:wo("Symbol."+e)),Ae[e]},Ao=R,Nt=k,Lt=xr,Po=ge,Io=ao,Ro=_,Co=TypeError,No=Ro("toPrimitive"),Lo=function(e,t){if(!Nt(e)||Lt(e))return e;var r=Po(e,No),n;if(r){if(t===void 0&&(t="default"),n=Ao(r,e,t),!Nt(n)||Lt(n))return n;throw Co("Can't convert object to primitive value")}return t===void 0&&(t="number"),Io(e,t)},xo=Lo,jo=xr,ct=function(e){var t=xo(e,"string");return jo(t)?t:t+""},ko=T,xt=k,ze=ko.document,Do=xt(ze)&&xt(ze.createElement),Mr=function(e){return Do?ze.createElement(e):{}},Fo=j,Mo=P,Bo=Mr,Br=!Fo&&!Mo(function(){return Object.defineProperty(Bo("div"),"a",{get:function(){return 7}}).a!=7}),Uo=j,Vo=R,Go=Ar,Ko=ve,Ho=q,Wo=ct,qo=C,Qo=Br,jt=Object.getOwnPropertyDescriptor;wr.f=Uo?jt:function(t,r){if(t=Ho(t),r=Wo(r),Qo)try{return jt(t,r)}catch(n){}if(qo(t,r))return Ko(!Vo(Go.f,t,r),t[r])};var zo=P,Yo=$,Xo=/#|\.prototype\./,Q=function(e,t){var r=Zo[Jo(e)];return r==ta?!0:r==ea?!1:Yo(t)?zo(t):!!t},Jo=Q.normalize=function(e){return String(e).replace(Xo,".").toLowerCase()},Zo=Q.data={},ea=Q.NATIVE="N",ta=Q.POLYFILL="P",ra=Q,kt=Tr,na=lt,oa=de,aa=kt(kt.bind),Ur=function(e,t){return na(e),t===void 0?e:oa?aa(e,t):function(){return e.apply(t,arguments)}},K={},ia=j,sa=P,Vr=ia&&sa(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),la=k,ua=String,ca=TypeError,D=function(e){if(la(e))return e;throw ca(ua(e)+" is not an object")},fa=j,da=Br,ha=Vr,J=D,Dt=ct,va=TypeError,Pe=Object.defineProperty,pa=Object.getOwnPropertyDescriptor,Ie="enumerable",Re="configurable",Ce="writable";K.f=fa?ha?function(t,r,n){if(J(t),r=Dt(r),J(n),typeof t=="function"&&r==="prototype"&&"value"in n&&Ce in n&&!n[Ce]){var o=pa(t,r);o&&o[Ce]&&(t[r]=n.value,n={configurable:Re in n?n[Re]:o[Re],enumerable:Ie in n?n[Ie]:o[Ie],writable:!1})}return Pe(t,r,n)}:Pe:function(t,r,n){if(J(t),r=Dt(r),J(n),da)try{return Pe(t,r,n)}catch(o){}if("get"in n||"set"in n)throw va("Accessors not supported");return"value"in n&&(t[r]=n.value),t};var ga=j,ba=K,ya=ve,z=ga?function(e,t,r){return ba.f(e,t,ya(1,r))}:function(e,t,r){return e[t]=r,e},Z=T,ma=yn,Sa=Tr,$a=$,Ea=wr.f,Ta=ra,F=ot,_a=Ur,M=z,Ft=C,Oa=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 ma(e,this,arguments)};return t.prototype=e.prototype,t},ft=function(e,t){var r=e.target,n=e.global,o=e.stat,i=e.proto,s=n?Z:o?Z[r]:(Z[r]||{}).prototype,d=n?F:F[r]||M(F,r,{})[r],h=d.prototype,c,a,u,f,v,g,b,m,y;for(f in t)c=Ta(n?f:r+(o?".":"#")+f,e.forced),a=!c&&s&&Ft(s,f),g=d[f],a&&(e.dontCallGetSet?(y=Ea(s,f),b=y&&y.value):b=s[f]),v=a&&b?b:t[f],!(a&&typeof g==typeof v)&&(e.bind&&a?m=_a(v,Z):e.wrap&&a?m=Oa(v):i&&$a(v)?m=Sa(v):m=v,(e.sham||v&&v.sham||g&&g.sham)&&M(m,"sham",!0),M(d,f,m),i&&(u=r+"Prototype",Ft(F,u)||M(F,u,{}),M(F[u],f,v),e.real&&h&&(c||!h[f])&&M(h,f,v)))},wa=k,Aa=he,Pa=_,Ia=Pa("match"),Ra=function(e){var t;return wa(e)&&((t=e[Ia])!==void 0?!!t:Aa(e)=="RegExp")},Ca=_,Na=Ca("toStringTag"),Gr={};Gr[Na]="z";var dt=String(Gr)==="[object z]",La=dt,xa=$,ae=he,ja=_,ka=ja("toStringTag"),Da=Object,Fa=ae(function(){return arguments}())=="Arguments",Ma=function(e,t){try{return e[t]}catch(r){}},be=La?ae:function(e){var t,r,n;return e===void 0?"Undefined":e===null?"Null":typeof(r=Ma(t=Da(e),ka))=="string"?r:Fa?ae(t):(n=ae(t))=="Object"&&xa(t.callee)?"Arguments":n},Ba=be,Ua=String,Va=function(e){if(Ba(e)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return Ua(e)},Ga=D,Ka=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},Ha=R,Wa=C,qa=it,Qa=Ka,Mt=RegExp.prototype,za=function(e){var t=e.flags;return t===void 0&&!("flags"in Mt)&&!Wa(e,"flags")&&qa(Mt,e)?Ha(Qa,e):t},ht=I,Ya=ut,Xa=Math.floor,Ne=ht("".charAt),Ja=ht("".replace),Le=ht("".slice),Za=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,ei=/\$([$&'`]|\d{1,2})/g,ti=function(e,t,r,n,o,i){var s=r+e.length,d=n.length,h=ei;return o!==void 0&&(o=Ya(o),h=Za),Ja(i,h,function(c,a){var u;switch(Ne(a,0)){case"$":return"$";case"&":return e;case"`":return Le(t,0,r);case"'":return Le(t,s);case"<":u=o[Le(a,1,-1)];break;default:var f=+a;if(f===0)return c;if(f>d){var v=Xa(f/10);return v===0?c:v<=d?n[v-1]===void 0?Ne(a,1):n[v-1]+Ne(a,1):c}u=n[f-1]}return u===void 0?"":u})},ri=ft,ni=R,vt=I,Bt=nt,oi=$,ai=pe,ii=Ra,B=Va,si=ge,li=za,ui=ti,ci=_,fi=ci("replace"),di=TypeError,Kr=vt("".indexOf),hi=vt("".replace),Ut=vt("".slice),vi=Math.max,Vt=function(e,t,r){return r>e.length?-1:t===""?r:Kr(e,t,r)};ri({target:"String",proto:!0},{replaceAll:function(t,r){var n=Bt(this),o,i,s,d,h,c,a,u,f,v=0,g=0,b="";if(!ai(t)){if(o=ii(t),o&&(i=B(Bt(li(t))),!~Kr(i,"g")))throw di("`.replaceAll` does not allow non-global regexes");if(s=si(t,fi),s)return ni(s,t,n,r);if(o)return hi(B(n),t,r)}for(d=B(n),h=B(t),c=oi(r),c||(r=B(r)),a=h.length,u=vi(1,a),v=Vt(d,h,0);v!==-1;)f=c?B(r(h,v,d)):ui(h,d,v,[],void 0,r),b+=Ut(d,g,v)+f,g=v+a,v=Vt(d,h,v+u);return g<d.length&&(b+=Ut(d,g)),b}});var pi=at,gi=pi,bi=gi,yi=bi("String","replaceAll"),mi=yi,Si=mi,$i=Si,Ei=$i,Ti=yr(Ei);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 ue;(function(e){e.AUTO="auto",e.MANUAL=""})(ue||(ue={}));exports.ConnectionType=void 0;(function(e){e.HTTP1="http1",e.HTTP2="http2",e.HTTP3="http3"})(exports.ConnectionType||(exports.ConnectionType={}));var w;(function(e){e[e.YES=1]="YES",e[e.NO=0]="NO"})(w||(w={}));var G;(function(e){e.EXCELLENT="excellent",e.GOOD="good",e.POOR="poor"})(G||(G={}));var x;(function(e){e.PIP="pip",e.FULLSCREEN="fullscreen",e.EXTERNAL="external",e.PREFETCH="prefetch",e.AIRPLAY="airplay",e.CHROMECAST="chromecast",e.INVISIBLE="invisible"})(x||(x={}));exports.SeekAction=void 0;(function(e){e.SLIDER="slider",e.DOUBLE_TAP="double_tap",e.TIME_CODE="time_code",e.EPISODE="episode",e.REWIND="rewind",e.LIVE="live",e.UNKNOWN="unknown"})(exports.SeekAction||(exports.SeekAction={}));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 _i={action_play:"ap",first_bytes:"fb",player_ready:"pr",first_frame:"ff",seek:"sk",watch_coverage_record:"wr",watch_coverage_live:"wl",empty_buffer:"eb",action_stop:"as",close_at_empty_buffer:"cb",content_error:"er",player_interface_click:"pc",next_movie:"nm",track_switch:"ts"},Oi={vsid:"si",vid:"vi",place:"pl",quality:"qt",cdn_host:"ch",stat_type:"st",param:"pm",vk_app_id:"va",track_code:"tc",connection_type:"cnt",connection_reused:"cr",cached_data:"cd",live:"lv",muted:"mu",mode:"mo",subtitles:"sb",failover:"fo",download_speed:"ds",manual_quality:"mq",ref_domain:"rd",direct_url:"du"},wi={unknown:"un",mobile:"m",lowest:"ls",low:"l",medium:"md",high:"h",fullhd:"f",quadhd:"q",ultrahd:"u"},Ai={pip:"pi",fullscreen:"fs",external:"ex",prefetch:"pr",airplay:"ap",chromecast:"cc",invisible:"iv"},Pi={apiEnv:exports.ApiEnv.VK_ALIAS,requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageInterval:15e3,disabledOperations:[],disabledCustomFields:[],shorten:!0,maxLoops:100,embedUrlParams:[],useBeacon:!0,synchronizeTime:!0,debugLog:!1,backoff:{start:1e3,factor:1.5,max:5*60*1e3,random:.1}},Ii=e=>l.fillWithDefault(e,Pi);function Ri(){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),t=new Array(36);let r=0,n,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?t[o]="-":o===14?t[o]="4":(r<=2&&(r=33554432+Math.random()*16777216|0),n=r&15,r=r>>4,t[o]=e[o===19?n&3|8:n]);return t.join("")}var H={},Ci=T,Ni=$,Gt=Ci.WeakMap,Li=Ni(Gt)&&/native code/.test(String(Gt)),xi=Dr,ji=Fr,Kt=xi("keys"),pt=function(e){return Kt[e]||(Kt[e]=ji(e))},gt={},ki=Li,Hr=T,Di=k,Fi=z,xe=C,je=kr,Mi=pt,Bi=gt,Ht="Object already initialized",Ye=Hr.TypeError,Ui=Hr.WeakMap,ce,W,fe,Vi=function(e){return fe(e)?W(e):ce(e,{})},Gi=function(e){return function(t){var r;if(!Di(t)||(r=W(t)).type!==e)throw Ye("Incompatible receiver, "+e+" required");return r}};if(ki||je.state){var O=je.state||(je.state=new Ui);O.get=O.get,O.has=O.has,O.set=O.set,ce=function(e,t){if(O.has(e))throw Ye(Ht);return t.facade=e,O.set(e,t),t},W=function(e){return O.get(e)||{}},fe=function(e){return O.has(e)}}else{var U=Mi("state");Bi[U]=!0,ce=function(e,t){if(xe(e,U))throw Ye(Ht);return t.facade=e,Fi(e,U,t),t},W=function(e){return xe(e,U)?e[U]:{}},fe=function(e){return xe(e,U)}}var Ki={set:ce,get:W,has:fe,enforce:Vi,getterFor:Gi},Xe=j,Hi=C,Wr=Function.prototype,Wi=Xe&&Object.getOwnPropertyDescriptor,bt=Hi(Wr,"name"),qi=bt&&function(){}.name==="something",Qi=bt&&(!Xe||Xe&&Wi(Wr,"name").configurable),zi={EXISTS:bt,PROPER:qi,CONFIGURABLE:Qi},qr={},Yi=Math.ceil,Xi=Math.floor,Ji=Math.trunc||function(t){var r=+t;return(r>0?Xi:Yi)(r)},Zi=Ji,Qr=function(e){var t=+e;return t!==t||t===0?0:Zi(t)},es=Qr,ts=Math.max,rs=Math.min,ns=function(e,t){var r=es(e);return r<0?ts(r+t,0):rs(r,t)},os=Qr,as=Math.min,is=function(e){return e>0?as(os(e),9007199254740991):0},ss=is,zr=function(e){return ss(e.length)},ls=q,us=ns,cs=zr,Wt=function(e){return function(t,r,n){var o=ls(t),i=cs(o),s=us(n,i),d;if(e&&r!=r){for(;i>s;)if(d=o[s++],d!=d)return!0}else for(;i>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},fs={includes:Wt(!0),indexOf:Wt(!1)},ds=I,ke=C,hs=q,vs=fs.indexOf,ps=gt,qt=ds([].push),gs=function(e,t){var r=hs(e),n=0,o=[],i;for(i in r)!ke(ps,i)&&ke(r,i)&&qt(o,i);for(;t.length>n;)ke(r,i=t[n++])&&(~vs(o,i)||qt(o,i));return o},Yr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],bs=gs,ys=Yr,ms=Object.keys||function(t){return bs(t,ys)},Ss=j,$s=Vr,Es=K,Ts=D,_s=q,Os=ms;qr.f=Ss&&!$s?Object.defineProperties:function(t,r){Ts(t);for(var n=_s(r),o=Os(r),i=o.length,s=0,d;i>s;)Es.f(t,d=o[s++],n[d]);return t};var ws=at,As=ws("document","documentElement"),Ps=D,Is=qr,Qt=Yr,Rs=gt,Cs=As,Ns=Mr,Ls=pt,zt=">",Yt="<",Je="prototype",Ze="script",Xr=Ls("IE_PROTO"),De=function(){},Jr=function(e){return Yt+Ze+zt+e+Yt+"/"+Ze+zt},Xt=function(e){e.write(Jr("")),e.close();var t=e.parentWindow.Object;return e=null,t},xs=function(){var e=Ns("iframe"),t="java"+Ze+":",r;return e.style.display="none",Cs.appendChild(e),e.src=String(t),r=e.contentWindow.document,r.open(),r.write(Jr("document.F=Object")),r.close(),r.F},ee,ie=function(){try{ee=new ActiveXObject("htmlfile")}catch(t){}ie=typeof document!="undefined"?document.domain&&ee?Xt(ee):xs():Xt(ee);for(var e=Qt.length;e--;)delete ie[Je][Qt[e]];return ie()};Rs[Xr]=!0;var Zr=Object.create||function(t,r){var n;return t!==null?(De[Je]=Ps(t),n=new De,De[Je]=null,n[Xr]=t):n=ie(),r===void 0?n:Is.f(n,r)},js=P,ks=!js(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),Ds=C,Fs=$,Ms=ut,Bs=pt,Us=ks,Jt=Bs("IE_PROTO"),et=Object,Vs=et.prototype,en=Us?et.getPrototypeOf:function(e){var t=Ms(e);if(Ds(t,Jt))return t[Jt];var r=t.constructor;return Fs(r)&&t instanceof r?r.prototype:t instanceof et?Vs:null},Gs=z,tn=function(e,t,r,n){return n&&n.enumerable?e[t]=r:Gs(e,t,r),e},Ks=P,Hs=$,Ws=k,qs=Zr,Zt=en,Qs=tn,zs=_,tt=zs("iterator"),rn=!1,A,Fe,Me;[].keys&&(Me=[].keys(),"next"in Me?(Fe=Zt(Zt(Me)),Fe!==Object.prototype&&(A=Fe)):rn=!0);var Ys=!Ws(A)||Ks(function(){var e={};return A[tt].call(e)!==e});Ys?A={}:A=qs(A);Hs(A[tt])||Qs(A,tt,function(){return this});var nn={IteratorPrototype:A,BUGGY_SAFARI_ITERATORS:rn},Xs=dt,Js=be,Zs=Xs?{}.toString:function(){return"[object "+Js(this)+"]"},el=dt,tl=K.f,rl=z,nl=C,ol=Zs,al=_,er=al("toStringTag"),on=function(e,t,r,n){if(e){var o=r?e:e.prototype;nl(o,er)||tl(o,er,{configurable:!0,value:t}),n&&!el&&rl(o,"toString",ol)}},il=nn.IteratorPrototype,sl=Zr,ll=ve,ul=on,cl=H,fl=function(){return this},dl=function(e,t,r,n){var o=t+" Iterator";return e.prototype=sl(il,{next:ll(+!n,r)}),ul(e,o,!1,!0),cl[o]=fl,e},hl=ft,vl=R,an=zi,pl=dl,gl=en,bl=on,tr=tn,yl=_,rr=H,sn=nn,ml=an.PROPER;an.CONFIGURABLE;sn.IteratorPrototype;var te=sn.BUGGY_SAFARI_ITERATORS,Be=yl("iterator"),nr="keys",re="values",or="entries",Sl=function(){return this},$l=function(e,t,r,n,o,i,s){pl(r,t,n);var d=function(y){if(y===o&&f)return f;if(!te&&y in a)return a[y];switch(y){case nr:return function(){return new r(this,y)};case re:return function(){return new r(this,y)};case or:return function(){return new r(this,y)}}return function(){return new r(this)}},h=t+" Iterator",c=!1,a=e.prototype,u=a[Be]||a["@@iterator"]||o&&a[o],f=!te&&u||d(o),v=t=="Array"&&a.entries||u,g,b,m;if(v&&(g=gl(v.call(new e)),g!==Object.prototype&&g.next&&(bl(g,h,!0,!0),rr[h]=Sl)),ml&&o==re&&u&&u.name!==re&&(c=!0,f=function(){return vl(u,this)}),o)if(b={values:d(re),keys:i?f:d(nr),entries:d(or)},s)for(m in b)(te||c||!(m in a))&&tr(a,m,b[m]);else hl({target:t,proto:!0,forced:te||c},b);return s&&a[Be]!==f&&tr(a,Be,f,{name:o}),rr[t]=f,b},El=function(e,t){return{value:e,done:t}},Tl=q,ar=H,ln=Ki;K.f;var _l=$l,ne=El,un="Array Iterator",Ol=ln.set,wl=ln.getterFor(un);_l(Array,"Array",function(e,t){Ol(this,{type:un,target:Tl(e),index:0,kind:t})},function(){var e=wl(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,ne(void 0,!0)):r=="keys"?ne(n,!1):r=="values"?ne(t[n],!1):ne([n,t[n]],!1)},"values");ar.Arguments=ar.Array;var Al=_,Pl=H,Il=Al("iterator"),Rl=Array.prototype,Cl=function(e){return e!==void 0&&(Pl.Array===e||Rl[Il]===e)},Nl=be,ir=ge,Ll=pe,xl=H,jl=_,kl=jl("iterator"),cn=function(e){if(!Ll(e))return ir(e,kl)||ir(e,"@@iterator")||xl[Nl(e)]},Dl=R,Fl=lt,Ml=D,Bl=st,Ul=cn,Vl=TypeError,Gl=function(e,t){var r=arguments.length<2?Ul(e):t;if(Fl(r))return Ml(Dl(r,e));throw Vl(Bl(e)+" is not iterable")},Kl=R,sr=D,Hl=ge,Wl=function(e,t,r){var n,o;sr(e);try{if(n=Hl(e,"return"),!n){if(t==="throw")throw r;return r}n=Kl(n,e)}catch(i){o=!0,n=i}if(t==="throw")throw r;if(o)throw n;return sr(n),r},ql=Ur,Ql=R,zl=D,Yl=st,Xl=Cl,Jl=zr,lr=it,Zl=Gl,eu=cn,ur=Wl,tu=TypeError,se=function(e,t){this.stopped=e,this.result=t},cr=se.prototype,ru=function(e,t,r){var n=r&&r.that,o=!!(r&&r.AS_ENTRIES),i=!!(r&&r.IS_RECORD),s=!!(r&&r.IS_ITERATOR),d=!!(r&&r.INTERRUPTED),h=ql(t,n),c,a,u,f,v,g,b,m=function(S){return c&&ur(c,"normal",S),new se(!0,S)},y=function(S){return o?(zl(S),d?h(S[0],S[1],m):h(S[0],S[1])):d?h(S,m):h(S)};if(i)c=e.iterator;else if(s)c=e;else{if(a=eu(e),!a)throw tu(Yl(e)+" is not iterable");if(Xl(a)){for(u=0,f=Jl(e);f>u;u++)if(v=y(e[u]),v&&lr(cr,v))return v;return new se(!1)}c=Zl(e,a)}for(g=i?e.next:c.next;!(b=Ql(g,c)).done;){try{v=y(b.value)}catch(S){ur(c,"throw",S)}if(typeof v=="object"&&v&&lr(cr,v))return v}return new se(!1)},nu=ct,ou=K,au=ve,iu=function(e,t,r){var n=nu(t);n in e?ou.f(e,n,au(0,r)):e[n]=r},su=ft,lu=ru,uu=iu;su({target:"Object",stat:!0},{fromEntries:function(t){var r={};return lu(t,function(n,o){uu(r,n,o)},{AS_ENTRIES:!0}),r}});var cu=ot,fu=cu.Object.fromEntries,du={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},hu=du,vu=T,pu=be,gu=z,fr=H,bu=_,dr=bu("toStringTag");for(var Ue in hu){var hr=vu[Ue],Ve=hr&&hr.prototype;Ve&&pu(Ve)!==dr&&gu(Ve,dr,Ue),fr[Ue]=fr.Array}var yu=fu,mu=yu,Su=mu,$u=Su,Eu=yr($u);const Tu=e=>{var t;const{operation:r,custom:n}=e,o=Eu(Object.entries(n).map(([i,s])=>{var d,h,c;const a=(d=Oi[i])!==null&&d!==void 0?d:i;let u=s;return s&&(i==="mode"?u=(h=Ai[s])!==null&&h!==void 0?h:s:i==="quality"&&(u=(c=wi[s])!==null&&c!==void 0?c:s)),[a,u]}));return{...e,operation:(t=_i[r])!==null&&t!==void 0?t:r,custom:o}},rt="1.0.46-dev.df8758f1.0",_u="CIOPGQJGDIHBABABA",vr={[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]:""};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 Ou{constructor(t){this.consequentAuthErrors=0,this.authorized$=new l.ValueSubject(!1),this.params=t}async authorize(t){return this.authToken=t!=null?t:await 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)}async logRequest(t){var r;const n="log.externalLog",o=this.createLogParams(t),i=(r=this.sessionKey)!==null&&r!==void 0?r:await this._authorizeWithBackoff();if(!i)return;const s=async(d,h=this.params.config.requestRetryCount)=>{try{return await this.params.apiTransport.sendRequest(n,o,i)}catch(c){if(!c||!("error_code"in c)){this.params.error$.next({id:"logRequestUnknown",category:l.ErrorCategory.NETWORK,message:`Unknown ${n} error`,thrown:c});return}const a=c==null?void 0:c.error_code;switch(a){case L.PARAM_SESSION_EXPIRED:case L.PARAM_SESSION_KEY:case L.PARAM_SIGNATURE:return this.authorized$.next(!1),this.sessionKey=await this._authorizeWithBackoff(),h>0?s(d,h-1):void 0;case L.AUTH_LOGIN:return this.authorized$.next(!1),this.authToken=await this.refreshAuthToken(),this.sessionKey=await this._authorizeWithBackoff(),h>0?s(d,h-1):void 0;default:{this.params.error$.next({id:`LogRequest#${a}`,category:l.ErrorCategory.EXTERNAL_API,message:`${n} error`,data:c});return}}}};return s(t)}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}async refreshAuthToken(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=this.params.refreshAuthToken().finally(()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise}createLogParams(t){return{collector:"ok.mobile.apps.video",data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${rt}`,platform:this.params.mobile?"M_WEB":"WEB",items:this.params.config.shorten?t.map(Tu):t})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();const t=l.getExponentialDelay(this.consequentAuthErrors,this.params.config.backoff);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{this._authorize().then(r).catch(n=>this.params.error$.next({id:"AuthorizeBackoff",category:l.ErrorCategory.NETWORK,message:"Otherwise unhandled error in authorization",thrown:n})).finally(()=>this.backoffTimeoutId=0)},t))})}async _authorize(){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.params.uuid,client_version:rt.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=this.params.apiTransport.sendRequest(t,r).then(n=>{var o;return(!n||!n.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:l.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(async n=>{this.sessionKey=void 0;const o=n==null?void 0:n.error_code;switch(o){case L.AUTH_LOGIN:return this.authToken=await this.refreshAuthToken(),this._authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:l.ErrorCategory.EXTERNAL_API,message:"authorize error",data:n}):this.params.error$.next({id:"AuthorizeUnknown",category:l.ErrorCategory.NETWORK,message:"authorize error",thrown:n})}).finally(()=>{this.authorizePromise=void 0,this.consequentAuthErrors=this.sessionKey?0:this.consequentAuthErrors+1,this.authorized$.next(this.sessionKey!==void 0)}),this.authorizePromise}}class pr{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(t,r,n){t in this.listeners||(this.listeners[t]=[]),this.listeners[t].push({callback:r,options:n})}removeEventListener(t,r){if(!(t in this.listeners))return;const n=this.listeners[t];for(let o=0,i=n.length;o<i;o++)if(n[o].callback===r){n.splice(o,1);return}}dispatchEvent(t){if(!(t.type in this.listeners))return;const n=this.listeners[t.type].slice();for(let o=0,i=n.length;o<i;o++){const s=n[o];try{s.callback.call(this,t)}catch(d){Promise.resolve().then(()=>{throw d})}s.options&&s.options.once&&this.removeEventListener(t.type,s.callback)}return!t.defaultPrevented}}class fn extends pr{constructor(){super(),this.listeners||pr.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 wu{constructor(){Object.defineProperty(this,"signal",{value:new fn,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&&(wu.prototype[Symbol.toStringTag]="AbortController",fn.prototype[Symbol.toStringTag]="AbortSignal");function dn(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 Au(e){typeof e=="function"&&(e={fetch:e});const{fetch:t,Request:r=t.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=e;if(!dn({fetch:t,Request:r,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o}))return{fetch:t,Request:i};let i=r;(i&&!i.prototype.hasOwnProperty("signal")||o)&&(i=function(c,a){let u;a&&a.signal&&(u=a.signal,delete a.signal);const f=new r(c,a);return u&&Object.defineProperty(f,"signal",{writable:!1,enumerable:!1,configurable:!0,value:u}),f},i.prototype=r.prototype);const s=t;return{fetch:(h,c)=>{const a=i&&i.prototype.isPrototypeOf(h)?h.signal:c?c.signal:void 0;if(a){let u;try{u=new DOMException("Aborted","AbortError")}catch(v){u=new Error("Aborted"),u.name="AbortError"}if(a.aborted)return Promise.reject(u);const f=new Promise((v,g)=>{a.addEventListener("abort",()=>g(u),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([f,s(h,c)])}return s(h,c)},Request:i}}const yt=dn({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),hn=yt?Au({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,gr=yt?hn.fetch:window.fetch;yt?hn.Request:window.Request;class Pu{constructor(t){this.params=t,this.apiKey=t.apiKey,this.apiEnv=t.config.apiEnv,this.apiBaseUrl=vr[this.apiEnv],this.timeSynchronisation=t.timeSynchronisation,this.isApiBaseUrlFetched=!1}async resolveApiBaseUrl(){var t;if(this.apiEnv!==exports.ApiEnv.AUTO||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{const r=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=await(await gr(r,{method:"GET",mode:"cors",cache:"no-cache"})).json(),i=(t=o==null?void 0:o.Answer[0])===null||t===void 0?void 0:t.data;if(!i)throw new Error("Wrong DNS response");return i}catch(r){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:l.ErrorCategory.NETWORK,message:"Unhandled resolve api base url error",thrown:r}),vr[exports.ApiEnv.VK_ALIAS]}finally{this.isApiBaseUrlFetched=!0}}sendBeacon(t,r,n){if(!window.Blob||!window.navigator.sendBeacon)return!1;const o=this._prepareQueryParams({method:t,queryParams:r,sessionKey:n}),i=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,i)}catch(s){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:l.ErrorCategory.NETWORK,message:"Unhandled beacon error",thrown:s,data:{method:t,params:r}})}return!1}async sendRequest(t,r,n){const o=l.now(),i=s=>{if(s instanceof TypeError&&["Failed to fetch","NetworkError when attempting to fetch resource."].includes(s.message)){this.params.error$.next({id:"Network",category:l.ErrorCategory.NETWORK,message:"Request failed",thrown:s});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:l.ErrorCategory.NETWORK,message:"Unhandled request error",thrown:s,data:{method:t,params:r,sessionKey:n,time:l.now()-o}})};return this.apiBaseUrl=await this.resolveApiBaseUrl(),gr(`${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 d,h;const c=Number(s.headers.get("content-length"))===0,a=new Date((d=s.headers.get("date"))!==null&&d!==void 0?d:"").getTime(),u=l.now()-o;if(isFinite(a)&&((h=this.timeSynchronisation)===null||h===void 0||h.addServerTime(a,u)),!c)return s.json().then(f=>Object.prototype.hasOwnProperty.call(f,"error_msg")?Promise.reject(f):f,i)},i)}_prepareQueryParams(t){const r=new URLSearchParams({format:"JSON",method:t.method,application_key:this.apiKey});return t.sessionKey!==void 0&&r.append("session_key",t.sessionKey),Object.entries(t.queryParams).forEach(([n,o])=>r.append(n,typeof o=="string"?o:JSON.stringify(o))),r}}const oe="onestat_events",Ge=e=>t=>t.timestamp+e>=l.now();class Iu{constructor(t){this.unsaltedStorage=[],this.isPaused=!1,this.isUrgent=n=>{const{operation:o}=n;return["action_play","watch_coverage_record","watch_coverage_live"].includes(o)},this.params=t,this.api=t.api,this.error$=t.error$,this.userSalt=t.userSalt,this.loggerDebugLog=t.debugLogger.createComponentLog("stat logger"),this.firstFlush=l.debounceFn(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});const r=l.safeStorage.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=l.debounceFn(()=>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:l.ErrorCategory.WTF,message:(t=String(r))!==null&&t!==void 0?t:"Unknown logger error",thrown:r})}}readFromStorage(){const t=l.safeStorage.get(oe);try{return t?JSON.parse(t):{}}catch(r){}return{}}addToStorage(t){var r;if(!this.userSalt){this.unsaltedStorage.push(t);return}const n=this.readFromStorage(),i=((r=n[this.userSalt])!==null&&r!==void 0?r:[]).filter(Ge(this.params.config.storageExpiration));l.safeStorage.set(oe,JSON.stringify({...n,[this.userSalt]:[...i,t]}))}getFromStorage(){var t;return this.userSalt?((t=this.readFromStorage()[this.userSalt])!==null&&t!==void 0?t:[]).filter(Ge(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}const t=this.readFromStorage();delete t[this.userSalt],l.safeStorage.set(oe,JSON.stringify(t))}housekeepStorage(){const t=this.readFromStorage();for(const[r,n]of Object.entries(t)){const o=n.filter(Ge(this.params.config.storageExpiration));o.length?t[r]=o:delete t[r],this.loggerDebugLog({message:`${n.length} retrieved from storage, ${o.length} of them actual`})}l.safeStorage.set(oe,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.loggerDebugLog({message:`Flushing ${r.length} events through beacon`}),this.api.logBeacon(r)):(this.loggerDebugLog({message:`Flushing ${r.length} events`}),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 Ru=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],br=e=>e&&{[p.HttpConnectionType.HTTP1]:exports.ConnectionType.HTTP1,[p.HttpConnectionType.HTTP2]:exports.ConnectionType.HTTP2,[p.HttpConnectionType.QUIC]:exports.ConnectionType.HTTP3}[e],Cu=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 l.assertNever(e)}},Ke=e=>{if(e!==void 0)switch(e){case p.Surface.NONE:case p.Surface.INLINE:return;case p.Surface.FULLSCREEN:return x.FULLSCREEN;case p.Surface.SECOND_SCREEN:return x.CHROMECAST;case p.Surface.PIP:return x.PIP;default:return l.assertNever(e)}},Nu=e=>{switch(e){case"slow-2g":return G.POOR;case"2g":return G.POOR;case"3g":return G.GOOD;case"4g":return G.EXCELLENT}};class Lu{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 xu=()=>Math.floor(Math.random()*2**32).toString(36).padStart(8,"0"),ju=(e,t)=>new l.Observable(r=>{const n=new l.Subscription,o=l.merge(l.fromEvent(window,"beforeunload"),e.events.willDestruct$),i=new l.ValueSubject(void 0);let s;n.add(e.info.isLive$.pipe(l.filterChanged()).subscribe(N=>{s&&(s.unsubscribe(),i.next(void 0)),N?s=e.info.liveTime$.pipe(l.map(ye=>ye&&ye/1e3)).subscribe(i):s=e.info.position$.subscribe(i),n.add(s)}));const{playing$:d,paused$:h}=e.events,c=e.events.willSeek$.pipe(l.filter(()=>e.info.playbackState$.getValue()===p.PlaybackState.PLAYING)),a=e.events.seeked$.pipe(l.filter(()=>e.info.playbackState$.getValue()===p.PlaybackState.PLAYING));let u=!1;const f=new l.Subject;n.add(c.subscribe(()=>{u||f.next(),u=!0})),n.add(a.subscribe(()=>u=!1));const v=new l.Subject,g=new l.Subject,b=l.merge(d,a,v),m=l.merge(h,f,o,e.events.looped$,g);let y;const S=()=>y=i.getValue(),vn=()=>{const N=i.getValue();l.isNullable(y)||y===N||l.isNullable(N)||(r.next({from:y,to:N}),y=void 0)},pn=()=>{g.next(),v.next()};if(n.add(b.subscribe(S)),n.add(m.subscribe(vn)),t.forceInterval&&isFinite(t.forceInterval)){let N=0;n.add(b.subscribe(()=>N=window.setTimeout(pn,t.forceInterval))),n.add(m.subscribe(()=>window.clearTimeout(N)))}return n}),ku="_one-stat_",He=`${ku}uuid`,We=()=>{const e=new l.Subscription;return{subscription:e,subscribe:(t,r)=>{t&&e.add(t.subscribe(r))}}};class Du{constructor(t,r){var n,o;this.subscription=new l.Subscription,this.debugLogger=new l.Logger,this.oneStatDebugLog=this.debugLogger.createComponentLog("onestat"),this.loopCounter=0,this.disabled=!1,this.vsid$=new l.ValueSubject(void 0),this.seekAction$=new l.ValueSubject(exports.SeekAction.UNKNOWN),this.statContext=t,this.config=Ii((n=r.config)!==null&&n!==void 0?n:{}),l.isNonNullable(r.apiEnv)&&(this.config.apiEnv=r.apiEnv),this.config.synchronizeTime&&(this.timeSynchronisation=new Lu);const i=new l.Subject;this.experimental={error$:i};const s=l.safeStorage.get(He);s?s.startsWith('"')&&s.endsWith('"')?(this.uuid=Ti(s,'"',""),l.safeStorage.set(He,this.uuid)):this.uuid=s:(this.uuid=Ri(),l.safeStorage.set(He,this.uuid)),r.vsid?this.vsid$.next(r.vsid):this.resetViewSession();const d=new Pu({apiKey:_u,config:this.config,error$:i,timeSynchronisation:this.timeSynchronisation});this.api=new Ou({config:this.config,apiTransport:d,refreshAuthToken:r.refreshAuthToken,mobile:(o=this.statContext.mobile)!==null&&o!==void 0?o:!1,uuid:this.uuid,error$:i}),this.logger=new Iu({config:this.config,debugLogger:this.debugLogger,api:this.api,error$:i,userSalt:r.userSalt});const{isEmbed:h,host:c}=l.detectEmbed();this.isEmbed=h,this.embedParent=c,this.subscribe()}updateContext(t){this.statContext={...this.statContext,...t}}attachTo(t){const r=new l.Subscription,n=(a,u)=>r.add(a.subscribe(u));n(t.events.willStart$,()=>{const a=t.info.position$.getValue();this.logActionPlay({position:a}),this.statContext.projectId&&this.logActionPlayWithProjectId({position:a})}),n(t.events.looped$,()=>{this.resetViewSession(),++this.loopCounter>this.config.maxLoops&&(this.disabled=!0),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(ju(t,{forceInterval:this.config.watchCoverageInterval}),a=>{const u=t.info.isLive$.getValue(),f={start:parseFloat(a.from.toFixed(3)),end:parseFloat(a.to.toFixed(3))};u?this.logWatchCoverageLive(f):this.logWatchCoverageRecord(f)});let o;n(t.info.isStalled$,a=>{a?o=l.now():(l.isNonNullable(o)&&this.logEmptyBuffer({duration:l.now()-o}),o=void 0)});let i=!1;r.add(t.events.fatalError$.pipe(l.once()).subscribe(()=>i=!0)),n(t.events.willStop$,()=>{if(t.info.isStalled$.getValue()){const u=l.isNonNullable(o)?l.now()-o:void 0;this.logCloseAtEmptyBuffer({duration:u!=null?u:0}),o=void 0}else i||this.logActionStop()}),n(t.events.managedError$,({id:a})=>{this.logError({fatal:!1,errorType:a})}),n(t.events.fatalError$,({id:a})=>{this.logError({fatal:!0,errorType:a})});let s,d,h=!1;n(t.events.firstBytes$,a=>{s=l.now(),this.logFirstBytes({time:a})}),n(t.events.willStart$,()=>d=l.now()),n(t.info.currentBuffer$,a=>{!h&&a&&a.end-a.start>0&&l.isNonNullable(s)&&(this.logPlayerReady({duration:l.now()-s}),h=!0)}),n(t.events.firstFrame$,()=>{l.isNonNullable(s)&&!h&&(this.logPlayerReady({duration:l.now()-s}),h=!0),l.isNonNullable(d)&&this.logFirstFrame({time:l.now()-d})}),n(t.info.atLiveEdge$,a=>this.updateContext({liveEdge:a})),n(l.combine({muted:t.info.muted$,volume:t.info.volume$}),({muted:a,volume:u})=>this.updateContext({audible:!a&&u>0})),n(t.info.currentQuality$,a=>this.updateContext({quality:Ru(a)})),n(t.info.isAutoQualityEnabled$,a=>this.updateContext({autoQuality:a})),n(t.info.currentFormat$,a=>this.updateContext({contentType:Cu(a)})),n(t.info.currentPlaybackRate$,a=>this.updateContext({rate:a})),n(t.info.is3DVideo$,a=>this.updateContext({is3d:a}));let c;return n(t.info.hostname$,a=>{this.updateContext({cdnHostname:a,failover:c!==void 0&&c!==a}),c=a}),n(t.info.throughputEstimation$,a=>this.updateContext({downloadSpeed:a})),n(t.info.httpConnectionType$,a=>{this.statContext.firstConnectionType||this.updateContext({firstConnectionType:br(a)}),this.updateContext({connectionType:br(a)})}),n(t.info.httpConnectionReused$,a=>{l.isNullable(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:a}),this.updateContext({connectionReused:a})}),n(t.info.surface$,a=>this.updateContext({mode:Ke(a)})),n(l.combine({current:t.info.currentTextTrack$,available:t.info.availableTextTracks$}),({current:a,available:u})=>{const f=u.find(({id:g})=>g===a),v=f&&(f.isAuto?`${f.language}_auto`:f.language);this.updateContext({subtitles:v})}),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}=We();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 i;const s=o?x.PIP:Ke((i=this.player)===null||i===void 0?void 0:i.info.surface$.getValue());this.updateContext({mode:s})}),n(t.inFullscreen$,o=>{var i;const s=o?x.FULLSCREEN:Ke((i=this.player)===null||i===void 0?void 0:i.info.surface$.getValue());this.updateContext({mode:s})}),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}=We();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}=We();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(),this.oneStatDebugLog({message:"paused"})}resume(){this.logger.resume(),this.oneStatDebugLog({message:"resumed"})}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.oneStatDebugLog({message:"VSID reset"}),this.vsid$.next(xu())}getDeviceId(){return this.uuid}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,i=t.start+o,s=t.end+o;this.log({operation:"watch_coverage_live",param:`${i}-${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(l.merge(l.fromEvent(t,"change"),l.observableFrom(["init"])).subscribe(()=>this.updateContext({network:Nu(t.effectiveType)}))),this.config.debugLog&&this.debugLogger.log$.subscribe(r=>{console.debug("%c stat ","background:#fa6470;",`component: ${r.component}.`,r.message)})}resubscribeBeforeunload(){var t;(t=this.beforeunloadSubscription)===null||t===void 0||t.unsubscribe(),this.beforeunloadSubscription=l.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))})}logActionPlayWithProjectId(t){this.statContext.projectId&&this.log({operation:"action_play",param:String(Math.round(t.position))},{vid:this.statContext.projectId})}logCloseAtEmptyBuffer(t){this.log({operation:"close_at_empty_buffer",param:String(Math.round(t.duration))})}logActionStop(){this.log({operation:"action_stop"})}log(t,r={}){if(this.disabled){this.oneStatDebugLog({message:`operation ${t.operation} but statistics is disabled`});return}if(this.config.disabledOperations.includes(t.operation)){this.oneStatDebugLog({message:`operation ${t.operation} but it is disabled`});return}this.oneStatDebugLog({message:`operation ${t.operation} ${t.param}`});const n=this.createLogItem(t,r);this.logger.log(n)}createLogItem({operation:t,param:r,time:n},o={}){var i,s;const d=(s=(i=this.timeSynchronisation)===null||i===void 0?void 0:i.now())!==null&&s!==void 0?s:l.now(),h=this.vsid$.getValue();l.assertNonNullable(h);const c=t==="empty_buffer"||t==="close_at_empty_buffer"?this.statContext.connectionType:this.statContext.firstConnectionType,a=this.statContext.firstConnectionReused;let u,f;if(this.isEmbed){u=this.embedParent;const g=[...new URLSearchParams(location.search).entries()].filter(([b,m])=>this.config.embedUrlParams.includes(b));f=new URLSearchParams(g).toString()}else this.statContext.place==="direct"&&(document.referrer&&(u=new URL(document.referrer).hostname),f=location.href.substring(0,1024));const v={vsid:h,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?ue.AUTO:this.statContext.autoplay===!1?ue.MANUAL:void 0,param:r,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode,connection_type:c,connection_reused:a===!0?w.YES:a===!1?w.NO:void 0,cached_data:this.statContext.cached===!0?w.YES:this.statContext.cached===!1?w.NO:void 0,live:this.statContext.liveEdge?w.YES:void 0,muted:this.statContext.audible===!1?w.YES:void 0,mode:this.statContext.mode,subtitles:this.statContext.subtitles,download_speed:this.statContext.downloadSpeed,manual_quality:this.statContext.autoQuality?void 0:w.YES,ref_domain:u,direct_url:f,rate:this.statContext.rate===1||l.isNullable(this.statContext.rate)?void 0:this.statContext.rate.toFixed(2),view_360:this.statContext.is3d?1:void 0,aid:this.statContext.albumId,vk_playlist_id:this.statContext.vkPlaylistId,...o};for(const g of this.config.disabledCustomFields)delete v[g];return{operation:t,type:1,time:n,network:this.statContext.network,timestamp:d,custom:v}}}exports.OneStat=Du;exports.VERSION=rt;
6
+ "use strict";var l=require("@vkontakte/videoplayer-shared/es2018.cjs.js"),p=require("@vkontakte/videoplayer-core/es2018.cjs.js"),me=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function yr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Y=function(e){return e&&e.Math==Math&&e},T=Y(typeof globalThis=="object"&&globalThis)||Y(typeof window=="object"&&window)||Y(typeof self=="object"&&self)||Y(typeof me=="object"&&me)||function(){return this}()||me||Function("return this")(),P=function(e){try{return!!e()}catch(t){return!0}},gn=P,de=!gn(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),bn=de,mr=Function.prototype,mt=mr.apply,St=mr.call,yn=typeof Reflect=="object"&&Reflect.apply||(bn?St.bind(mt):function(){return St.apply(mt,arguments)}),Sr=de,$r=Function.prototype,qe=$r.call,mn=Sr&&$r.bind.bind(qe,qe),I=Sr?mn:function(e){return function(){return qe.apply(e,arguments)}},Er=I,Sn=Er({}.toString),$n=Er("".slice),he=function(e){return $n(Sn(e),8,-1)},En=he,Tn=I,Tr=function(e){if(En(e)==="Function")return Tn(e)},Qe=typeof document=="object"&&document.all,_n=typeof Qe=="undefined"&&Qe!==void 0,_r={all:Qe,IS_HTMLDDA:_n},Or=_r,On=Or.all,$=Or.IS_HTMLDDA?function(e){return typeof e=="function"||e===On}:function(e){return typeof e=="function"},wr={},wn=P,k=!wn(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),An=de,X=Function.prototype.call,R=An?X.bind(X):function(){return X.apply(X,arguments)},Ar={},Pr={}.propertyIsEnumerable,Ir=Object.getOwnPropertyDescriptor,Pn=Ir&&!Pr.call({1:2},1);Ar.f=Pn?function(t){var r=Ir(this,t);return!!r&&r.enumerable}:Pr;var ve=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},In=I,Rn=P,Cn=he,Se=Object,Nn=In("".split),Ln=Rn(function(){return!Se("z").propertyIsEnumerable(0)})?function(e){return Cn(e)=="String"?Nn(e,""):Se(e)}:Se,pe=function(e){return e==null},xn=pe,kn=TypeError,nt=function(e){if(xn(e))throw kn("Can't call method on "+e);return e},jn=Ln,Dn=nt,q=function(e){return jn(Dn(e))},$t=$,Rr=_r,Fn=Rr.all,j=Rr.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:$t(e)||e===Fn}:function(e){return typeof e=="object"?e!==null:$t(e)},ot={},$e=ot,Ee=T,Mn=$,Et=function(e){return Mn(e)?e:void 0},at=function(e,t){return arguments.length<2?Et($e[e])||Et(Ee[e]):$e[e]&&$e[e][t]||Ee[e]&&Ee[e][t]},Bn=I,it=Bn({}.isPrototypeOf),Un=typeof navigator!="undefined"&&String(navigator.userAgent)||"",Cr=T,Te=Un,Tt=Cr.process,_t=Cr.Deno,Ot=Tt&&Tt.versions||_t&&_t.version,wt=Ot&&Ot.v8,E,le;wt&&(E=wt.split("."),le=E[0]>0&&E[0]<4?1:+(E[0]+E[1]));!le&&Te&&(E=Te.match(/Edge\/(\d+)/),(!E||E[1]>=74)&&(E=Te.match(/Chrome\/(\d+)/),E&&(le=+E[1])));var Vn=le,At=Vn,Gn=P,Kn=T,Wn=Kn.String,Nr=!!Object.getOwnPropertySymbols&&!Gn(function(){var e=Symbol();return!Wn(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&At&&At<41}),Hn=Nr,Lr=Hn&&!Symbol.sham&&typeof Symbol.iterator=="symbol",qn=at,Qn=$,zn=it,Yn=Lr,Xn=Object,xr=Yn?function(e){return typeof e=="symbol"}:function(e){var t=qn("Symbol");return Qn(t)&&zn(t.prototype,Xn(e))},Jn=String,st=function(e){try{return Jn(e)}catch(t){return"Object"}},Zn=$,eo=st,to=TypeError,lt=function(e){if(Zn(e))return e;throw to(eo(e)+" is not a function")},ro=lt,no=pe,ge=function(e,t){var r=e[t];return no(r)?void 0:ro(r)},_e=R,Oe=$,we=j,oo=TypeError,ao=function(e,t){var r,n;if(t==="string"&&Oe(r=e.toString)&&!we(n=_e(r,e))||Oe(r=e.valueOf)&&!we(n=_e(r,e))||t!=="string"&&Oe(r=e.toString)&&!we(n=_e(r,e)))return n;throw oo("Can't convert object to primitive value")},kr={exports:{}},Pt=T,io=Object.defineProperty,so=function(e,t){try{io(Pt,e,{value:t,configurable:!0,writable:!0})}catch(r){Pt[e]=t}return t},lo=T,uo=so,It="__core-js_shared__",co=lo[It]||uo(It,{}),jr=co,Rt=jr;(kr.exports=function(e,t){return Rt[e]||(Rt[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 Dr=kr.exports,fo=nt,ho=Object,ut=function(e){return ho(fo(e))},vo=I,po=ut,go=vo({}.hasOwnProperty),C=Object.hasOwn||function(t,r){return go(po(t),r)},bo=I,yo=0,mo=Math.random(),So=bo(1 .toString),Fr=function(e){return"Symbol("+(e===void 0?"":e)+")_"+So(++yo+mo,36)},$o=T,Eo=Dr,Ct=C,To=Fr,_o=Nr,Oo=Lr,V=$o.Symbol,Ae=Eo("wks"),wo=Oo?V.for||V:V&&V.withoutSetter||To,_=function(e){return Ct(Ae,e)||(Ae[e]=_o&&Ct(V,e)?V[e]:wo("Symbol."+e)),Ae[e]},Ao=R,Nt=j,Lt=xr,Po=ge,Io=ao,Ro=_,Co=TypeError,No=Ro("toPrimitive"),Lo=function(e,t){if(!Nt(e)||Lt(e))return e;var r=Po(e,No),n;if(r){if(t===void 0&&(t="default"),n=Ao(r,e,t),!Nt(n)||Lt(n))return n;throw Co("Can't convert object to primitive value")}return t===void 0&&(t="number"),Io(e,t)},xo=Lo,ko=xr,ct=function(e){var t=xo(e,"string");return ko(t)?t:t+""},jo=T,xt=j,ze=jo.document,Do=xt(ze)&&xt(ze.createElement),Mr=function(e){return Do?ze.createElement(e):{}},Fo=k,Mo=P,Bo=Mr,Br=!Fo&&!Mo(function(){return Object.defineProperty(Bo("div"),"a",{get:function(){return 7}}).a!=7}),Uo=k,Vo=R,Go=Ar,Ko=ve,Wo=q,Ho=ct,qo=C,Qo=Br,kt=Object.getOwnPropertyDescriptor;wr.f=Uo?kt:function(t,r){if(t=Wo(t),r=Ho(r),Qo)try{return kt(t,r)}catch(n){}if(qo(t,r))return Ko(!Vo(Go.f,t,r),t[r])};var zo=P,Yo=$,Xo=/#|\.prototype\./,Q=function(e,t){var r=Zo[Jo(e)];return r==ta?!0:r==ea?!1:Yo(t)?zo(t):!!t},Jo=Q.normalize=function(e){return String(e).replace(Xo,".").toLowerCase()},Zo=Q.data={},ea=Q.NATIVE="N",ta=Q.POLYFILL="P",ra=Q,jt=Tr,na=lt,oa=de,aa=jt(jt.bind),Ur=function(e,t){return na(e),t===void 0?e:oa?aa(e,t):function(){return e.apply(t,arguments)}},K={},ia=k,sa=P,Vr=ia&&sa(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),la=j,ua=String,ca=TypeError,D=function(e){if(la(e))return e;throw ca(ua(e)+" is not an object")},fa=k,da=Br,ha=Vr,J=D,Dt=ct,va=TypeError,Pe=Object.defineProperty,pa=Object.getOwnPropertyDescriptor,Ie="enumerable",Re="configurable",Ce="writable";K.f=fa?ha?function(t,r,n){if(J(t),r=Dt(r),J(n),typeof t=="function"&&r==="prototype"&&"value"in n&&Ce in n&&!n[Ce]){var o=pa(t,r);o&&o[Ce]&&(t[r]=n.value,n={configurable:Re in n?n[Re]:o[Re],enumerable:Ie in n?n[Ie]:o[Ie],writable:!1})}return Pe(t,r,n)}:Pe:function(t,r,n){if(J(t),r=Dt(r),J(n),da)try{return Pe(t,r,n)}catch(o){}if("get"in n||"set"in n)throw va("Accessors not supported");return"value"in n&&(t[r]=n.value),t};var ga=k,ba=K,ya=ve,z=ga?function(e,t,r){return ba.f(e,t,ya(1,r))}:function(e,t,r){return e[t]=r,e},Z=T,ma=yn,Sa=Tr,$a=$,Ea=wr.f,Ta=ra,F=ot,_a=Ur,M=z,Ft=C,Oa=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 ma(e,this,arguments)};return t.prototype=e.prototype,t},ft=function(e,t){var r=e.target,n=e.global,o=e.stat,i=e.proto,s=n?Z:o?Z[r]:(Z[r]||{}).prototype,d=n?F:F[r]||M(F,r,{})[r],h=d.prototype,c,a,u,f,v,g,b,m,y;for(f in t)c=Ta(n?f:r+(o?".":"#")+f,e.forced),a=!c&&s&&Ft(s,f),g=d[f],a&&(e.dontCallGetSet?(y=Ea(s,f),b=y&&y.value):b=s[f]),v=a&&b?b:t[f],!(a&&typeof g==typeof v)&&(e.bind&&a?m=_a(v,Z):e.wrap&&a?m=Oa(v):i&&$a(v)?m=Sa(v):m=v,(e.sham||v&&v.sham||g&&g.sham)&&M(m,"sham",!0),M(d,f,m),i&&(u=r+"Prototype",Ft(F,u)||M(F,u,{}),M(F[u],f,v),e.real&&h&&(c||!h[f])&&M(h,f,v)))},wa=j,Aa=he,Pa=_,Ia=Pa("match"),Ra=function(e){var t;return wa(e)&&((t=e[Ia])!==void 0?!!t:Aa(e)=="RegExp")},Ca=_,Na=Ca("toStringTag"),Gr={};Gr[Na]="z";var dt=String(Gr)==="[object z]",La=dt,xa=$,ae=he,ka=_,ja=ka("toStringTag"),Da=Object,Fa=ae(function(){return arguments}())=="Arguments",Ma=function(e,t){try{return e[t]}catch(r){}},be=La?ae:function(e){var t,r,n;return e===void 0?"Undefined":e===null?"Null":typeof(r=Ma(t=Da(e),ja))=="string"?r:Fa?ae(t):(n=ae(t))=="Object"&&xa(t.callee)?"Arguments":n},Ba=be,Ua=String,Va=function(e){if(Ba(e)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return Ua(e)},Ga=D,Ka=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},Wa=R,Ha=C,qa=it,Qa=Ka,Mt=RegExp.prototype,za=function(e){var t=e.flags;return t===void 0&&!("flags"in Mt)&&!Ha(e,"flags")&&qa(Mt,e)?Wa(Qa,e):t},ht=I,Ya=ut,Xa=Math.floor,Ne=ht("".charAt),Ja=ht("".replace),Le=ht("".slice),Za=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,ei=/\$([$&'`]|\d{1,2})/g,ti=function(e,t,r,n,o,i){var s=r+e.length,d=n.length,h=ei;return o!==void 0&&(o=Ya(o),h=Za),Ja(i,h,function(c,a){var u;switch(Ne(a,0)){case"$":return"$";case"&":return e;case"`":return Le(t,0,r);case"'":return Le(t,s);case"<":u=o[Le(a,1,-1)];break;default:var f=+a;if(f===0)return c;if(f>d){var v=Xa(f/10);return v===0?c:v<=d?n[v-1]===void 0?Ne(a,1):n[v-1]+Ne(a,1):c}u=n[f-1]}return u===void 0?"":u})},ri=ft,ni=R,vt=I,Bt=nt,oi=$,ai=pe,ii=Ra,B=Va,si=ge,li=za,ui=ti,ci=_,fi=ci("replace"),di=TypeError,Kr=vt("".indexOf),hi=vt("".replace),Ut=vt("".slice),vi=Math.max,Vt=function(e,t,r){return r>e.length?-1:t===""?r:Kr(e,t,r)};ri({target:"String",proto:!0},{replaceAll:function(t,r){var n=Bt(this),o,i,s,d,h,c,a,u,f,v=0,g=0,b="";if(!ai(t)){if(o=ii(t),o&&(i=B(Bt(li(t))),!~Kr(i,"g")))throw di("`.replaceAll` does not allow non-global regexes");if(s=si(t,fi),s)return ni(s,t,n,r);if(o)return hi(B(n),t,r)}for(d=B(n),h=B(t),c=oi(r),c||(r=B(r)),a=h.length,u=vi(1,a),v=Vt(d,h,0);v!==-1;)f=c?B(r(h,v,d)):ui(h,d,v,[],void 0,r),b+=Ut(d,g,v)+f,g=v+a,v=Vt(d,h,v+u);return g<d.length&&(b+=Ut(d,g)),b}});var pi=at,gi=pi,bi=gi,yi=bi("String","replaceAll"),mi=yi,Si=mi,$i=Si,Ei=$i,Ti=yr(Ei);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 ue;(function(e){e.AUTO="auto",e.MANUAL=""})(ue||(ue={}));exports.ConnectionType=void 0;(function(e){e.HTTP1="http1",e.HTTP2="http2",e.HTTP3="http3"})(exports.ConnectionType||(exports.ConnectionType={}));var w;(function(e){e[e.YES=1]="YES",e[e.NO=0]="NO"})(w||(w={}));var G;(function(e){e.EXCELLENT="excellent",e.GOOD="good",e.POOR="poor"})(G||(G={}));var x;(function(e){e.PIP="pip",e.FULLSCREEN="fullscreen",e.EXTERNAL="external",e.PREFETCH="prefetch",e.AIRPLAY="airplay",e.CHROMECAST="chromecast",e.INVISIBLE="invisible"})(x||(x={}));exports.SeekAction=void 0;(function(e){e.SLIDER="slider",e.DOUBLE_TAP="double_tap",e.TIME_CODE="time_code",e.EPISODE="episode",e.REWIND="rewind",e.LIVE="live",e.UNKNOWN="unknown"})(exports.SeekAction||(exports.SeekAction={}));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 _i={action_play:"ap",first_bytes:"fb",player_ready:"pr",first_frame:"ff",seek:"sk",watch_coverage_record:"wr",watch_coverage_live:"wl",empty_buffer:"eb",action_stop:"as",close_at_empty_buffer:"cb",content_error:"er",player_interface_click:"pc",next_movie:"nm",track_switch:"ts"},Oi={vsid:"si",vid:"vi",place:"pl",quality:"qt",cdn_host:"ch",stat_type:"st",param:"pm",vk_app_id:"va",track_code:"tc",connection_type:"cnt",connection_reused:"cr",cached_data:"cd",live:"lv",muted:"mu",mode:"mo",subtitles:"sb",failover:"fo",download_speed:"ds",manual_quality:"mq",ref_domain:"rd",direct_url:"du"},wi={unknown:"un",mobile:"m",lowest:"ls",low:"l",medium:"md",high:"h",fullhd:"f",quadhd:"q",ultrahd:"u"},Ai={pip:"pi",fullscreen:"fs",external:"ex",prefetch:"pr",airplay:"ap",chromecast:"cc",invisible:"iv"},Pi={apiEnv:exports.ApiEnv.VK_ALIAS,requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageInterval:15e3,disabledOperations:[],disabledCustomFields:[],shorten:!0,maxLoops:100,embedUrlParams:[],useBeacon:!0,synchronizeTime:!0,debugLog:!1,backoff:{start:1e3,factor:1.5,max:5*60*1e3,random:.1}},Ii=e=>l.fillWithDefault(e,Pi);function Ri(){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),t=new Array(36);let r=0,n,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?t[o]="-":o===14?t[o]="4":(r<=2&&(r=33554432+Math.random()*16777216|0),n=r&15,r=r>>4,t[o]=e[o===19?n&3|8:n]);return t.join("")}var W={},Ci=T,Ni=$,Gt=Ci.WeakMap,Li=Ni(Gt)&&/native code/.test(String(Gt)),xi=Dr,ki=Fr,Kt=xi("keys"),pt=function(e){return Kt[e]||(Kt[e]=ki(e))},gt={},ji=Li,Wr=T,Di=j,Fi=z,xe=C,ke=jr,Mi=pt,Bi=gt,Wt="Object already initialized",Ye=Wr.TypeError,Ui=Wr.WeakMap,ce,H,fe,Vi=function(e){return fe(e)?H(e):ce(e,{})},Gi=function(e){return function(t){var r;if(!Di(t)||(r=H(t)).type!==e)throw Ye("Incompatible receiver, "+e+" required");return r}};if(ji||ke.state){var O=ke.state||(ke.state=new Ui);O.get=O.get,O.has=O.has,O.set=O.set,ce=function(e,t){if(O.has(e))throw Ye(Wt);return t.facade=e,O.set(e,t),t},H=function(e){return O.get(e)||{}},fe=function(e){return O.has(e)}}else{var U=Mi("state");Bi[U]=!0,ce=function(e,t){if(xe(e,U))throw Ye(Wt);return t.facade=e,Fi(e,U,t),t},H=function(e){return xe(e,U)?e[U]:{}},fe=function(e){return xe(e,U)}}var Ki={set:ce,get:H,has:fe,enforce:Vi,getterFor:Gi},Xe=k,Wi=C,Hr=Function.prototype,Hi=Xe&&Object.getOwnPropertyDescriptor,bt=Wi(Hr,"name"),qi=bt&&function(){}.name==="something",Qi=bt&&(!Xe||Xe&&Hi(Hr,"name").configurable),zi={EXISTS:bt,PROPER:qi,CONFIGURABLE:Qi},qr={},Yi=Math.ceil,Xi=Math.floor,Ji=Math.trunc||function(t){var r=+t;return(r>0?Xi:Yi)(r)},Zi=Ji,Qr=function(e){var t=+e;return t!==t||t===0?0:Zi(t)},es=Qr,ts=Math.max,rs=Math.min,ns=function(e,t){var r=es(e);return r<0?ts(r+t,0):rs(r,t)},os=Qr,as=Math.min,is=function(e){return e>0?as(os(e),9007199254740991):0},ss=is,zr=function(e){return ss(e.length)},ls=q,us=ns,cs=zr,Ht=function(e){return function(t,r,n){var o=ls(t),i=cs(o),s=us(n,i),d;if(e&&r!=r){for(;i>s;)if(d=o[s++],d!=d)return!0}else for(;i>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},fs={includes:Ht(!0),indexOf:Ht(!1)},ds=I,je=C,hs=q,vs=fs.indexOf,ps=gt,qt=ds([].push),gs=function(e,t){var r=hs(e),n=0,o=[],i;for(i in r)!je(ps,i)&&je(r,i)&&qt(o,i);for(;t.length>n;)je(r,i=t[n++])&&(~vs(o,i)||qt(o,i));return o},Yr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],bs=gs,ys=Yr,ms=Object.keys||function(t){return bs(t,ys)},Ss=k,$s=Vr,Es=K,Ts=D,_s=q,Os=ms;qr.f=Ss&&!$s?Object.defineProperties:function(t,r){Ts(t);for(var n=_s(r),o=Os(r),i=o.length,s=0,d;i>s;)Es.f(t,d=o[s++],n[d]);return t};var ws=at,As=ws("document","documentElement"),Ps=D,Is=qr,Qt=Yr,Rs=gt,Cs=As,Ns=Mr,Ls=pt,zt=">",Yt="<",Je="prototype",Ze="script",Xr=Ls("IE_PROTO"),De=function(){},Jr=function(e){return Yt+Ze+zt+e+Yt+"/"+Ze+zt},Xt=function(e){e.write(Jr("")),e.close();var t=e.parentWindow.Object;return e=null,t},xs=function(){var e=Ns("iframe"),t="java"+Ze+":",r;return e.style.display="none",Cs.appendChild(e),e.src=String(t),r=e.contentWindow.document,r.open(),r.write(Jr("document.F=Object")),r.close(),r.F},ee,ie=function(){try{ee=new ActiveXObject("htmlfile")}catch(t){}ie=typeof document!="undefined"?document.domain&&ee?Xt(ee):xs():Xt(ee);for(var e=Qt.length;e--;)delete ie[Je][Qt[e]];return ie()};Rs[Xr]=!0;var Zr=Object.create||function(t,r){var n;return t!==null?(De[Je]=Ps(t),n=new De,De[Je]=null,n[Xr]=t):n=ie(),r===void 0?n:Is.f(n,r)},ks=P,js=!ks(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),Ds=C,Fs=$,Ms=ut,Bs=pt,Us=js,Jt=Bs("IE_PROTO"),et=Object,Vs=et.prototype,en=Us?et.getPrototypeOf:function(e){var t=Ms(e);if(Ds(t,Jt))return t[Jt];var r=t.constructor;return Fs(r)&&t instanceof r?r.prototype:t instanceof et?Vs:null},Gs=z,tn=function(e,t,r,n){return n&&n.enumerable?e[t]=r:Gs(e,t,r),e},Ks=P,Ws=$,Hs=j,qs=Zr,Zt=en,Qs=tn,zs=_,tt=zs("iterator"),rn=!1,A,Fe,Me;[].keys&&(Me=[].keys(),"next"in Me?(Fe=Zt(Zt(Me)),Fe!==Object.prototype&&(A=Fe)):rn=!0);var Ys=!Hs(A)||Ks(function(){var e={};return A[tt].call(e)!==e});Ys?A={}:A=qs(A);Ws(A[tt])||Qs(A,tt,function(){return this});var nn={IteratorPrototype:A,BUGGY_SAFARI_ITERATORS:rn},Xs=dt,Js=be,Zs=Xs?{}.toString:function(){return"[object "+Js(this)+"]"},el=dt,tl=K.f,rl=z,nl=C,ol=Zs,al=_,er=al("toStringTag"),on=function(e,t,r,n){if(e){var o=r?e:e.prototype;nl(o,er)||tl(o,er,{configurable:!0,value:t}),n&&!el&&rl(o,"toString",ol)}},il=nn.IteratorPrototype,sl=Zr,ll=ve,ul=on,cl=W,fl=function(){return this},dl=function(e,t,r,n){var o=t+" Iterator";return e.prototype=sl(il,{next:ll(+!n,r)}),ul(e,o,!1,!0),cl[o]=fl,e},hl=ft,vl=R,an=zi,pl=dl,gl=en,bl=on,tr=tn,yl=_,rr=W,sn=nn,ml=an.PROPER;an.CONFIGURABLE;sn.IteratorPrototype;var te=sn.BUGGY_SAFARI_ITERATORS,Be=yl("iterator"),nr="keys",re="values",or="entries",Sl=function(){return this},$l=function(e,t,r,n,o,i,s){pl(r,t,n);var d=function(y){if(y===o&&f)return f;if(!te&&y in a)return a[y];switch(y){case nr:return function(){return new r(this,y)};case re:return function(){return new r(this,y)};case or:return function(){return new r(this,y)}}return function(){return new r(this)}},h=t+" Iterator",c=!1,a=e.prototype,u=a[Be]||a["@@iterator"]||o&&a[o],f=!te&&u||d(o),v=t=="Array"&&a.entries||u,g,b,m;if(v&&(g=gl(v.call(new e)),g!==Object.prototype&&g.next&&(bl(g,h,!0,!0),rr[h]=Sl)),ml&&o==re&&u&&u.name!==re&&(c=!0,f=function(){return vl(u,this)}),o)if(b={values:d(re),keys:i?f:d(nr),entries:d(or)},s)for(m in b)(te||c||!(m in a))&&tr(a,m,b[m]);else hl({target:t,proto:!0,forced:te||c},b);return s&&a[Be]!==f&&tr(a,Be,f,{name:o}),rr[t]=f,b},El=function(e,t){return{value:e,done:t}},Tl=q,ar=W,ln=Ki;K.f;var _l=$l,ne=El,un="Array Iterator",Ol=ln.set,wl=ln.getterFor(un);_l(Array,"Array",function(e,t){Ol(this,{type:un,target:Tl(e),index:0,kind:t})},function(){var e=wl(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,ne(void 0,!0)):r=="keys"?ne(n,!1):r=="values"?ne(t[n],!1):ne([n,t[n]],!1)},"values");ar.Arguments=ar.Array;var Al=_,Pl=W,Il=Al("iterator"),Rl=Array.prototype,Cl=function(e){return e!==void 0&&(Pl.Array===e||Rl[Il]===e)},Nl=be,ir=ge,Ll=pe,xl=W,kl=_,jl=kl("iterator"),cn=function(e){if(!Ll(e))return ir(e,jl)||ir(e,"@@iterator")||xl[Nl(e)]},Dl=R,Fl=lt,Ml=D,Bl=st,Ul=cn,Vl=TypeError,Gl=function(e,t){var r=arguments.length<2?Ul(e):t;if(Fl(r))return Ml(Dl(r,e));throw Vl(Bl(e)+" is not iterable")},Kl=R,sr=D,Wl=ge,Hl=function(e,t,r){var n,o;sr(e);try{if(n=Wl(e,"return"),!n){if(t==="throw")throw r;return r}n=Kl(n,e)}catch(i){o=!0,n=i}if(t==="throw")throw r;if(o)throw n;return sr(n),r},ql=Ur,Ql=R,zl=D,Yl=st,Xl=Cl,Jl=zr,lr=it,Zl=Gl,eu=cn,ur=Hl,tu=TypeError,se=function(e,t){this.stopped=e,this.result=t},cr=se.prototype,ru=function(e,t,r){var n=r&&r.that,o=!!(r&&r.AS_ENTRIES),i=!!(r&&r.IS_RECORD),s=!!(r&&r.IS_ITERATOR),d=!!(r&&r.INTERRUPTED),h=ql(t,n),c,a,u,f,v,g,b,m=function(S){return c&&ur(c,"normal",S),new se(!0,S)},y=function(S){return o?(zl(S),d?h(S[0],S[1],m):h(S[0],S[1])):d?h(S,m):h(S)};if(i)c=e.iterator;else if(s)c=e;else{if(a=eu(e),!a)throw tu(Yl(e)+" is not iterable");if(Xl(a)){for(u=0,f=Jl(e);f>u;u++)if(v=y(e[u]),v&&lr(cr,v))return v;return new se(!1)}c=Zl(e,a)}for(g=i?e.next:c.next;!(b=Ql(g,c)).done;){try{v=y(b.value)}catch(S){ur(c,"throw",S)}if(typeof v=="object"&&v&&lr(cr,v))return v}return new se(!1)},nu=ct,ou=K,au=ve,iu=function(e,t,r){var n=nu(t);n in e?ou.f(e,n,au(0,r)):e[n]=r},su=ft,lu=ru,uu=iu;su({target:"Object",stat:!0},{fromEntries:function(t){var r={};return lu(t,function(n,o){uu(r,n,o)},{AS_ENTRIES:!0}),r}});var cu=ot,fu=cu.Object.fromEntries,du={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},hu=du,vu=T,pu=be,gu=z,fr=W,bu=_,dr=bu("toStringTag");for(var Ue in hu){var hr=vu[Ue],Ve=hr&&hr.prototype;Ve&&pu(Ve)!==dr&&gu(Ve,dr,Ue),fr[Ue]=fr.Array}var yu=fu,mu=yu,Su=mu,$u=Su,Eu=yr($u);const Tu=e=>{var t;const{operation:r,custom:n}=e,o=Eu(Object.entries(n).map(([i,s])=>{var d,h,c;const a=(d=Oi[i])!==null&&d!==void 0?d:i;let u=s;return s&&(i==="mode"?u=(h=Ai[s])!==null&&h!==void 0?h:s:i==="quality"&&(u=(c=wi[s])!==null&&c!==void 0?c:s)),[a,u]}));return{...e,operation:(t=_i[r])!==null&&t!==void 0?t:r,custom:o}},rt="1.0.46",_u="CIOPGQJGDIHBABABA",vr={[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]:""};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 Ou{constructor(t){this.consequentAuthErrors=0,this.authorized$=new l.ValueSubject(!1),this.params=t}async authorize(t){return this.authToken=t!=null?t:await 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)}async logRequest(t){var r;const n="log.externalLog",o=this.createLogParams(t),i=(r=this.sessionKey)!==null&&r!==void 0?r:await this._authorizeWithBackoff();if(!i)return;const s=async(d,h=this.params.config.requestRetryCount)=>{try{return await this.params.apiTransport.sendRequest(n,o,i)}catch(c){if(!c||!("error_code"in c)){this.params.error$.next({id:"logRequestUnknown",category:l.ErrorCategory.NETWORK,message:`Unknown ${n} error`,thrown:c});return}const a=c==null?void 0:c.error_code;switch(a){case L.PARAM_SESSION_EXPIRED:case L.PARAM_SESSION_KEY:case L.PARAM_SIGNATURE:return this.authorized$.next(!1),this.sessionKey=await this._authorizeWithBackoff(),h>0?s(d,h-1):void 0;case L.AUTH_LOGIN:return this.authorized$.next(!1),this.authToken=await this.refreshAuthToken(),this.sessionKey=await this._authorizeWithBackoff(),h>0?s(d,h-1):void 0;default:{this.params.error$.next({id:`LogRequest#${a}`,category:l.ErrorCategory.EXTERNAL_API,message:`${n} error`,data:c});return}}}};return s(t)}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}async refreshAuthToken(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=this.params.refreshAuthToken().finally(()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise}createLogParams(t){return{collector:"ok.mobile.apps.video",data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${rt}`,platform:this.params.mobile?"M_WEB":"WEB",items:this.params.config.shorten?t.map(Tu):t})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();const t=l.getExponentialDelay(this.consequentAuthErrors,this.params.config.backoff);return new Promise(r=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{this._authorize().then(r).catch(n=>this.params.error$.next({id:"AuthorizeBackoff",category:l.ErrorCategory.NETWORK,message:"Otherwise unhandled error in authorization",thrown:n})).finally(()=>this.backoffTimeoutId=0)},t))})}async _authorize(){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.params.uuid,client_version:rt.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=this.params.apiTransport.sendRequest(t,r).then(n=>{var o;return(!n||!n.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:l.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(async n=>{this.sessionKey=void 0;const o=n==null?void 0:n.error_code;switch(o){case L.AUTH_LOGIN:return this.authToken=await this.refreshAuthToken(),this._authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:l.ErrorCategory.EXTERNAL_API,message:"authorize error",data:n}):this.params.error$.next({id:"AuthorizeUnknown",category:l.ErrorCategory.NETWORK,message:"authorize error",thrown:n})}).finally(()=>{this.authorizePromise=void 0,this.consequentAuthErrors=this.sessionKey?0:this.consequentAuthErrors+1,this.authorized$.next(this.sessionKey!==void 0)}),this.authorizePromise}}class pr{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(t,r,n){t in this.listeners||(this.listeners[t]=[]),this.listeners[t].push({callback:r,options:n})}removeEventListener(t,r){if(!(t in this.listeners))return;const n=this.listeners[t];for(let o=0,i=n.length;o<i;o++)if(n[o].callback===r){n.splice(o,1);return}}dispatchEvent(t){if(!(t.type in this.listeners))return;const n=this.listeners[t.type].slice();for(let o=0,i=n.length;o<i;o++){const s=n[o];try{s.callback.call(this,t)}catch(d){Promise.resolve().then(()=>{throw d})}s.options&&s.options.once&&this.removeEventListener(t.type,s.callback)}return!t.defaultPrevented}}class fn extends pr{constructor(){super(),this.listeners||pr.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 wu{constructor(){Object.defineProperty(this,"signal",{value:new fn,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&&(wu.prototype[Symbol.toStringTag]="AbortController",fn.prototype[Symbol.toStringTag]="AbortSignal");function dn(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 Au(e){typeof e=="function"&&(e={fetch:e});const{fetch:t,Request:r=t.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=e;if(!dn({fetch:t,Request:r,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o}))return{fetch:t,Request:i};let i=r;(i&&!i.prototype.hasOwnProperty("signal")||o)&&(i=function(c,a){let u;a&&a.signal&&(u=a.signal,delete a.signal);const f=new r(c,a);return u&&Object.defineProperty(f,"signal",{writable:!1,enumerable:!1,configurable:!0,value:u}),f},i.prototype=r.prototype);const s=t;return{fetch:(h,c)=>{const a=i&&i.prototype.isPrototypeOf(h)?h.signal:c?c.signal:void 0;if(a){let u;try{u=new DOMException("Aborted","AbortError")}catch(v){u=new Error("Aborted"),u.name="AbortError"}if(a.aborted)return Promise.reject(u);const f=new Promise((v,g)=>{a.addEventListener("abort",()=>g(u),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([f,s(h,c)])}return s(h,c)},Request:i}}const yt=dn({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),hn=yt?Au({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,gr=yt?hn.fetch:window.fetch;yt?hn.Request:window.Request;class Pu{constructor(t){this.params=t,this.apiKey=t.apiKey,this.apiEnv=t.config.apiEnv,this.apiBaseUrl=vr[this.apiEnv],this.timeSynchronisation=t.timeSynchronisation,this.isApiBaseUrlFetched=!1}async resolveApiBaseUrl(){var t;if(this.apiEnv!==exports.ApiEnv.AUTO||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{const r=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=await(await gr(r,{method:"GET",mode:"cors",cache:"no-cache"})).json(),i=(t=o==null?void 0:o.Answer[0])===null||t===void 0?void 0:t.data;if(!i)throw new Error("Wrong DNS response");return i}catch(r){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:l.ErrorCategory.NETWORK,message:"Unhandled resolve api base url error",thrown:r}),vr[exports.ApiEnv.VK_ALIAS]}finally{this.isApiBaseUrlFetched=!0}}sendBeacon(t,r,n){if(!window.Blob||!window.navigator.sendBeacon)return!1;const o=this._prepareQueryParams({method:t,queryParams:r,sessionKey:n}),i=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,i)}catch(s){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:l.ErrorCategory.NETWORK,message:"Unhandled beacon error",thrown:s,data:{method:t,params:r}})}return!1}async sendRequest(t,r,n){const o=l.now(),i=s=>{if(s instanceof TypeError&&["Failed to fetch","NetworkError when attempting to fetch resource."].includes(s.message)){this.params.error$.next({id:"Network",category:l.ErrorCategory.NETWORK,message:"Request failed",thrown:s});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:l.ErrorCategory.NETWORK,message:"Unhandled request error",thrown:s,data:{method:t,params:r,sessionKey:n,time:l.now()-o}})};return this.apiBaseUrl=await this.resolveApiBaseUrl(),gr(`${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 d,h;const c=Number(s.headers.get("content-length"))===0,a=new Date((d=s.headers.get("date"))!==null&&d!==void 0?d:"").getTime(),u=l.now()-o;if(isFinite(a)&&((h=this.timeSynchronisation)===null||h===void 0||h.addServerTime(a,u)),!c)return s.json().then(f=>Object.prototype.hasOwnProperty.call(f,"error_msg")?Promise.reject(f):f,i)},i)}_prepareQueryParams(t){const r=new URLSearchParams({format:"JSON",method:t.method,application_key:this.apiKey});return t.sessionKey!==void 0&&r.append("session_key",t.sessionKey),Object.entries(t.queryParams).forEach(([n,o])=>r.append(n,typeof o=="string"?o:JSON.stringify(o))),r}}const oe="onestat_events",Ge=e=>t=>t.timestamp+e>=l.now();class Iu{constructor(t){this.unsaltedStorage=[],this.isPaused=!1,this.isUrgent=n=>{const{operation:o}=n;return["action_play","watch_coverage_record","watch_coverage_live"].includes(o)},this.params=t,this.api=t.api,this.error$=t.error$,this.userSalt=t.userSalt,this.loggerDebugLog=t.debugLogger.createComponentLog("stat logger"),this.firstFlush=l.debounceFn(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});const r=l.safeStorage.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=l.debounceFn(()=>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:l.ErrorCategory.WTF,message:(t=String(r))!==null&&t!==void 0?t:"Unknown logger error",thrown:r})}}readFromStorage(){const t=l.safeStorage.get(oe);try{return t?JSON.parse(t):{}}catch(r){}return{}}addToStorage(t){var r;if(!this.userSalt){this.unsaltedStorage.push(t);return}const n=this.readFromStorage(),i=((r=n[this.userSalt])!==null&&r!==void 0?r:[]).filter(Ge(this.params.config.storageExpiration));l.safeStorage.set(oe,JSON.stringify({...n,[this.userSalt]:[...i,t]}))}getFromStorage(){var t;return this.userSalt?((t=this.readFromStorage()[this.userSalt])!==null&&t!==void 0?t:[]).filter(Ge(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}const t=this.readFromStorage();delete t[this.userSalt],l.safeStorage.set(oe,JSON.stringify(t))}housekeepStorage(){const t=this.readFromStorage();for(const[r,n]of Object.entries(t)){const o=n.filter(Ge(this.params.config.storageExpiration));o.length?t[r]=o:delete t[r],this.loggerDebugLog({message:`${n.length} retrieved from storage, ${o.length} of them actual`})}l.safeStorage.set(oe,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.loggerDebugLog({message:`Flushing ${r.length} events through beacon`}),this.api.logBeacon(r)):(this.loggerDebugLog({message:`Flushing ${r.length} events`}),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 Ru=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],br=e=>e&&{[p.HttpConnectionType.HTTP1]:exports.ConnectionType.HTTP1,[p.HttpConnectionType.HTTP2]:exports.ConnectionType.HTTP2,[p.HttpConnectionType.QUIC]:exports.ConnectionType.HTTP3}[e],Cu=e=>{if(e!==void 0)switch(e){case p.VideoFormat.MPEG:return exports.ContentType.MP4;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 l.assertNever(e)}},Ke=e=>{if(e!==void 0)switch(e){case p.Surface.NONE:case p.Surface.INLINE:return;case p.Surface.FULLSCREEN:return x.FULLSCREEN;case p.Surface.SECOND_SCREEN:return x.CHROMECAST;case p.Surface.PIP:return x.PIP;default:return l.assertNever(e)}},Nu=e=>{switch(e){case"slow-2g":return G.POOR;case"2g":return G.POOR;case"3g":return G.GOOD;case"4g":return G.EXCELLENT}};class Lu{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 xu=()=>Math.floor(Math.random()*2**32).toString(36).padStart(8,"0"),ku=(e,t)=>new l.Observable(r=>{const n=new l.Subscription,o=l.merge(l.fromEvent(window,"beforeunload"),e.events.willDestruct$),i=new l.ValueSubject(void 0);let s;n.add(e.info.isLive$.pipe(l.filterChanged()).subscribe(N=>{s&&(s.unsubscribe(),i.next(void 0)),N?s=e.info.liveTime$.pipe(l.map(ye=>ye&&ye/1e3)).subscribe(i):s=e.info.position$.subscribe(i),n.add(s)}));const{playing$:d,paused$:h}=e.events,c=e.events.willSeek$.pipe(l.filter(()=>e.info.playbackState$.getValue()===p.PlaybackState.PLAYING)),a=e.events.seeked$.pipe(l.filter(()=>e.info.playbackState$.getValue()===p.PlaybackState.PLAYING));let u=!1;const f=new l.Subject;n.add(c.subscribe(()=>{u||f.next(),u=!0})),n.add(a.subscribe(()=>u=!1));const v=new l.Subject,g=new l.Subject,b=l.merge(d,a,v),m=l.merge(h,f,o,e.events.looped$,g);let y;const S=()=>y=i.getValue(),vn=()=>{const N=i.getValue();l.isNullable(y)||y===N||l.isNullable(N)||(r.next({from:y,to:N}),y=void 0)},pn=()=>{g.next(),v.next()};if(n.add(b.subscribe(S)),n.add(m.subscribe(vn)),t.forceInterval&&isFinite(t.forceInterval)){let N=0;n.add(b.subscribe(()=>N=window.setTimeout(pn,t.forceInterval))),n.add(m.subscribe(()=>window.clearTimeout(N)))}return n}),ju="_one-stat_",We=`${ju}uuid`,He=()=>{const e=new l.Subscription;return{subscription:e,subscribe:(t,r)=>{t&&e.add(t.subscribe(r))}}};class Du{constructor(t,r){var n,o;this.subscription=new l.Subscription,this.debugLogger=new l.Logger,this.oneStatDebugLog=this.debugLogger.createComponentLog("onestat"),this.loopCounter=0,this.disabled=!1,this.vsid$=new l.ValueSubject(void 0),this.seekAction$=new l.ValueSubject(exports.SeekAction.UNKNOWN),this.statContext=t,this.config=Ii((n=r.config)!==null&&n!==void 0?n:{}),l.isNonNullable(r.apiEnv)&&(this.config.apiEnv=r.apiEnv),this.config.synchronizeTime&&(this.timeSynchronisation=new Lu);const i=new l.Subject;this.experimental={error$:i};const s=l.safeStorage.get(We);s?s.startsWith('"')&&s.endsWith('"')?(this.uuid=Ti(s,'"',""),l.safeStorage.set(We,this.uuid)):this.uuid=s:(this.uuid=Ri(),l.safeStorage.set(We,this.uuid)),r.vsid?this.vsid$.next(r.vsid):this.resetViewSession();const d=new Pu({apiKey:_u,config:this.config,error$:i,timeSynchronisation:this.timeSynchronisation});this.api=new Ou({config:this.config,apiTransport:d,refreshAuthToken:r.refreshAuthToken,mobile:(o=this.statContext.mobile)!==null&&o!==void 0?o:!1,uuid:this.uuid,error$:i}),this.logger=new Iu({config:this.config,debugLogger:this.debugLogger,api:this.api,error$:i,userSalt:r.userSalt});const{isEmbed:h,host:c}=l.detectEmbed();this.isEmbed=h,this.embedParent=c,this.subscribe()}updateContext(t){this.statContext={...this.statContext,...t}}attachTo(t){const r=new l.Subscription,n=(a,u)=>r.add(a.subscribe(u));n(t.events.willStart$,()=>{const a=t.info.position$.getValue();this.logActionPlay({position:a}),this.statContext.projectId&&this.logActionPlayWithProjectId({position:a})}),n(t.events.looped$,()=>{this.resetViewSession(),++this.loopCounter>this.config.maxLoops&&(this.disabled=!0),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(ku(t,{forceInterval:this.config.watchCoverageInterval}),a=>{const u=t.info.isLive$.getValue(),f={start:parseFloat(a.from.toFixed(3)),end:parseFloat(a.to.toFixed(3))};u?this.logWatchCoverageLive(f):this.logWatchCoverageRecord(f)});let o;n(t.info.isStalled$,a=>{a?o=l.now():(l.isNonNullable(o)&&this.logEmptyBuffer({duration:l.now()-o}),o=void 0)});let i=!1;r.add(t.events.fatalError$.pipe(l.once()).subscribe(()=>i=!0)),n(t.events.willStop$,()=>{if(t.info.isStalled$.getValue()){const u=l.isNonNullable(o)?l.now()-o:void 0;this.logCloseAtEmptyBuffer({duration:u!=null?u:0}),o=void 0}else i||this.logActionStop()}),n(t.events.managedError$,({id:a})=>{this.logError({fatal:!1,errorType:a})}),n(t.events.fatalError$,({id:a})=>{this.logError({fatal:!0,errorType:a})});let s,d,h=!1;n(t.events.firstBytes$,a=>{s=l.now(),this.logFirstBytes({time:a})}),n(t.events.willStart$,()=>d=l.now()),n(t.info.currentBuffer$,a=>{!h&&a&&a.end-a.start>0&&l.isNonNullable(s)&&(this.logPlayerReady({duration:l.now()-s}),h=!0)}),n(t.events.firstFrame$,()=>{l.isNonNullable(s)&&!h&&(this.logPlayerReady({duration:l.now()-s}),h=!0),l.isNonNullable(d)&&this.logFirstFrame({time:l.now()-d})}),n(t.info.atLiveEdge$,a=>this.updateContext({liveEdge:a})),n(l.combine({muted:t.info.muted$,volume:t.info.volume$}),({muted:a,volume:u})=>this.updateContext({audible:!a&&u>0})),n(t.info.currentQuality$,a=>this.updateContext({quality:Ru(a)})),n(t.info.isAutoQualityEnabled$,a=>this.updateContext({autoQuality:a})),n(t.info.currentFormat$,a=>this.updateContext({contentType:Cu(a)})),n(t.info.currentPlaybackRate$,a=>this.updateContext({rate:a})),n(t.info.is3DVideo$,a=>this.updateContext({is3d:a}));let c;return n(t.info.hostname$,a=>{this.updateContext({cdnHostname:a,failover:c!==void 0&&c!==a}),c=a}),n(t.info.throughputEstimation$,a=>this.updateContext({downloadSpeed:a})),n(t.info.httpConnectionType$,a=>{this.statContext.firstConnectionType||this.updateContext({firstConnectionType:br(a)}),this.updateContext({connectionType:br(a)})}),n(t.info.httpConnectionReused$,a=>{l.isNullable(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:a}),this.updateContext({connectionReused:a})}),n(t.info.surface$,a=>this.updateContext({mode:Ke(a)})),n(l.combine({current:t.info.currentTextTrack$,available:t.info.availableTextTracks$}),({current:a,available:u})=>{const f=u.find(({id:g})=>g===a),v=f&&(f.isAuto?`${f.language}_auto`:f.language);this.updateContext({subtitles:v})}),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}=He();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 i;const s=o?x.PIP:Ke((i=this.player)===null||i===void 0?void 0:i.info.surface$.getValue());this.updateContext({mode:s})}),n(t.inFullscreen$,o=>{var i;const s=o?x.FULLSCREEN:Ke((i=this.player)===null||i===void 0?void 0:i.info.surface$.getValue());this.updateContext({mode:s})}),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}=He();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}=He();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(),this.oneStatDebugLog({message:"paused"})}resume(){this.logger.resume(),this.oneStatDebugLog({message:"resumed"})}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.oneStatDebugLog({message:"VSID reset"}),this.vsid$.next(xu())}getDeviceId(){return this.uuid}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,i=t.start+o,s=t.end+o;this.log({operation:"watch_coverage_live",param:`${i}-${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(l.merge(l.fromEvent(t,"change"),l.observableFrom(["init"])).subscribe(()=>this.updateContext({network:Nu(t.effectiveType)}))),this.config.debugLog&&this.debugLogger.log$.subscribe(r=>{console.debug("%c stat ","background:#fa6470;",`component: ${r.component}.`,r.message)})}resubscribeBeforeunload(){var t;(t=this.beforeunloadSubscription)===null||t===void 0||t.unsubscribe(),this.beforeunloadSubscription=l.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))})}logActionPlayWithProjectId(t){this.statContext.projectId&&this.log({operation:"action_play",param:String(Math.round(t.position))},{vid:this.statContext.projectId})}logCloseAtEmptyBuffer(t){this.log({operation:"close_at_empty_buffer",param:String(Math.round(t.duration))})}logActionStop(){this.log({operation:"action_stop"})}log(t,r={}){if(this.disabled){this.oneStatDebugLog({message:`operation ${t.operation} but statistics is disabled`});return}if(this.config.disabledOperations.includes(t.operation)){this.oneStatDebugLog({message:`operation ${t.operation} but it is disabled`});return}this.oneStatDebugLog({message:`operation ${t.operation} ${t.param}`});const n=this.createLogItem(t,r);this.logger.log(n)}createLogItem({operation:t,param:r,time:n},o={}){var i,s;const d=(s=(i=this.timeSynchronisation)===null||i===void 0?void 0:i.now())!==null&&s!==void 0?s:l.now(),h=this.vsid$.getValue();l.assertNonNullable(h);const c=t==="empty_buffer"||t==="close_at_empty_buffer"?this.statContext.connectionType:this.statContext.firstConnectionType,a=this.statContext.firstConnectionReused;let u,f;if(this.isEmbed){u=this.embedParent;const g=[...new URLSearchParams(location.search).entries()].filter(([b,m])=>this.config.embedUrlParams.includes(b));f=new URLSearchParams(g).toString()}else this.statContext.place==="direct"&&(document.referrer&&(u=new URL(document.referrer).hostname),f=location.href.substring(0,1024));const v={vsid:h,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?ue.AUTO:this.statContext.autoplay===!1?ue.MANUAL:void 0,param:r,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode,connection_type:c,connection_reused:a===!0?w.YES:a===!1?w.NO:void 0,cached_data:this.statContext.cached===!0?w.YES:this.statContext.cached===!1?w.NO:void 0,live:this.statContext.liveEdge?w.YES:void 0,muted:this.statContext.audible===!1?w.YES:void 0,mode:this.statContext.mode,subtitles:this.statContext.subtitles,download_speed:this.statContext.downloadSpeed,manual_quality:this.statContext.autoQuality?void 0:w.YES,ref_domain:u,direct_url:f,rate:this.statContext.rate===1||l.isNullable(this.statContext.rate)?void 0:this.statContext.rate.toFixed(2),view_360:this.statContext.is3d?1:void 0,aid:this.statContext.albumId,vk_playlist_id:this.statContext.vkPlaylistId,...o};for(const g of this.config.disabledCustomFields)delete v[g];return{operation:t,type:1,time:n,network:this.statContext.network,timestamp:d,custom:v}}}exports.OneStat=Du;exports.VERSION=rt;