@vkontakte/videoplayer-statistics 1.0.44-beta.1 → 1.0.44

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