@vkontakte/videoplayer-statistics 1.0.41-beta.3 → 1.0.41
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 +3 -3
- package/es2015.esm.js +3 -3
- package/es2018.cjs.js +3 -3
- package/es2018.esm.js +3 -3
- package/esnext.cjs.js +3 -3
- package/esnext.esm.js +3 -3
- package/evergreen.esm.js +3 -3
- package/package.json +3 -3
package/es2015.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-statistics v1.0.41
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-statistics v1.0.41
|
|
3
|
+
* Mon, 16 Oct 2023 13:03:33 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-41/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}},Ta=P,Ue=!Ta(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),_a=Ue,eo=Function.prototype,Cr=eo.apply,Nr=eo.call,to=typeof Reflect=="object"&&Reflect.apply||(_a?Nr.bind(Cr):function(){return Nr.apply(Cr,arguments)}),ro=Ue,no=Function.prototype,Ft=no.call,Pa=ro&&no.bind.bind(Ft,Ft),w=ro?Pa:function(e){return function(){return Ft.apply(e,arguments)}},oo=w,wa=oo({}.toString),Ia=oo("".slice),fe=function(e){return Ia(wa(e),8,-1)},Ra=fe,Aa=w,ao=function(e){if(Ra(e)==="Function")return Aa(e)},Mt=typeof document=="object"&&document.all,Ca=typeof Mt=="undefined"&&Mt!==void 0,io={all:Mt,IS_HTMLDDA:Ca},so=io,Na=so.all,$=so.IS_HTMLDDA?function(e){return typeof e=="function"||e===Na}:function(e){return typeof e=="function"},ir={},La=P,M=!La(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),xa=Ue,$e=Function.prototype.call,_=xa?$e.bind($e):function(){return $e.apply($e,arguments)},co={},uo={}.propertyIsEnumerable,lo=Object.getOwnPropertyDescriptor,Da=lo&&!uo.call({1:2},1);co.f=Da?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}},ja=w,ka=P,Fa=fe,Xe=Object,Ma=ja("".split),Ba=ka(function(){return!Xe("z").propertyIsEnumerable(0)})?function(e){return Fa(e)=="String"?Ma(e,""):Xe(e)}:Xe,ve=function(e){return e==null},Ua=ve,Va=TypeError,sr=function(e){if(Ua(e))throw Va("Can't call method on "+e);return e},Ga=Ba,Ka=sr,de=function(e){return Ga(Ka(e))},Lr=$,fo=io,Ha=fo.all,x=fo.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:Lr(e)||e===Ha}:function(e){return typeof e=="object"?e!==null:Lr(e)},cr={},Ze=cr,et=E,Wa=$,xr=function(e){return Wa(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]},qa=w,Ge=qa({}.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,Qa=P,za=E,Ya=za.String,po=!!Object.getOwnPropertySymbols&&!Qa(function(){var e=Symbol();return!Ya(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Mr&&Mr<41}),Ja=po,go=Ja&&!Symbol.sham&&typeof Symbol.iterator=="symbol",Xa=K,Za=$,ei=Ge,ti=go,ri=Object,yo=ti?function(e){return typeof e=="symbol"}:function(e){var t=Xa("Symbol");return Za(t)&&ei(t.prototype,ri(e))},ni=String,He=function(e){try{return ni(e)}catch(t){return"Object"}},oi=$,ai=He,ii=TypeError,H=function(e){if(oi(e))return e;throw ii(ai(e)+" is not a function")},si=H,ci=ve,We=function(e,t){var r=e[t];return ci(r)?void 0:si(r)},rt=_,nt=$,ot=x,ui=TypeError,li=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 ui("Can't convert object to primitive value")},bo={exports:{}},fi=!0,Br=E,vi=Object.defineProperty,di=function(e,t){try{vi(Br,e,{value:t,configurable:!0,writable:!0})}catch(r){Br[e]=t}return t},hi=E,pi=di,Ur="__core-js_shared__",gi=hi[Ur]||pi(Ur,{}),ur=gi,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,yi=sr,bi=Object,lr=function(e){return bi(yi(e))},mi=w,$i=lr,Si=mi({}.hasOwnProperty),A=Object.hasOwn||function(t,r){return Si($i(t),r)},Ei=w,Oi=0,Ti=Math.random(),_i=Ei(1 .toString),$o=function(e){return"Symbol("+(e===void 0?"":e)+")_"+_i(++Oi+Ti,36)},Pi=E,wi=mo,Gr=A,Ii=$o,Ri=po,Ai=go,X=Pi.Symbol,at=wi("wks"),Ci=Ai?X.for||X:X&&X.withoutSetter||Ii,O=function(e){return Gr(at,e)||(at[e]=Ri&&Gr(X,e)?X[e]:Ci("Symbol."+e)),at[e]},Ni=_,Kr=x,Hr=yo,Li=We,xi=li,Di=O,ji=TypeError,ki=Di("toPrimitive"),Fi=function(e,t){if(!Kr(e)||Hr(e))return e;var r=Li(e,ki),n;if(r){if(t===void 0&&(t="default"),n=Ni(r,e,t),!Kr(n)||Hr(n))return n;throw ji("Can't convert object to primitive value")}return t===void 0&&(t="number"),xi(e,t)},Mi=Fi,Bi=yo,fr=function(e){var t=Mi(e,"string");return Bi(t)?t:t+""},Ui=E,Wr=x,Bt=Ui.document,Vi=Wr(Bt)&&Wr(Bt.createElement),vr=function(e){return Vi?Bt.createElement(e):{}},Gi=M,Ki=P,Hi=vr,So=!Gi&&!Ki(function(){return Object.defineProperty(Hi("div"),"a",{get:function(){return 7}}).a!=7}),Wi=M,qi=_,Qi=co,zi=Ve,Yi=de,Ji=fr,Xi=A,Zi=So,qr=Object.getOwnPropertyDescriptor;ir.f=Wi?qr:function(t,r){if(t=Yi(t),r=Ji(r),Zi)try{return qr(t,r)}catch(n){}if(Xi(t,r))return zi(!qi(Qi.f,t,r),t[r])};var es=P,ts=$,rs=/#|\.prototype\./,he=function(e,t){var r=os[ns(e)];return r==is?!0:r==as?!1:ts(t)?es(t):!!t},ns=he.normalize=function(e){return String(e).replace(rs,".").toLowerCase()},os=he.data={},as=he.NATIVE="N",is=he.POLYFILL="P",Eo=he,Qr=ao,ss=H,cs=Ue,us=Qr(Qr.bind),qe=function(e,t){return ss(e),t===void 0?e:cs?us(e,t):function(){return e.apply(t,arguments)}},W={},ls=M,fs=P,Oo=ls&&fs(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),vs=x,ds=String,hs=TypeError,D=function(e){if(vs(e))return e;throw hs(ds(e)+" is not an object")},ps=M,gs=So,ys=Oo,Se=D,zr=fr,bs=TypeError,it=Object.defineProperty,ms=Object.getOwnPropertyDescriptor,st="enumerable",ct="configurable",ut="writable";W.f=ps?ys?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=ms(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),gs)try{return it(t,r,n)}catch(o){}if("get"in n||"set"in n)throw bs("Accessors not supported");return"value"in n&&(t[r]=n.value),t};var $s=M,Ss=W,Es=Ve,pe=$s?function(e,t,r){return Ss.f(e,t,Es(1,r))}:function(e,t,r){return e[t]=r,e},Ee=E,Os=to,Ts=ao,_s=$,Ps=ir.f,ws=Eo,q=cr,Is=qe,Q=pe,Yr=A,Rs=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 Os(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,b,m;for(d in t)f=ws(n?d:r+(o?".":"#")+d,e.forced),a=!f&&s&&Yr(s,d),g=l[d],a&&(e.dontCallGetSet?(m=Ps(s,d),y=m&&m.value):y=s[d]),h=a&&y?y:t[d],!(a&&typeof g==typeof h)&&(e.bind&&a?b=Is(h,Ee):e.wrap&&a?b=Rs(h):i&&_s(h)?b=Ts(h):b=h,(e.sham||h&&h.sham||g&&g.sham)&&Q(b,"sham",!0),Q(l,d,b),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)))},As=x,Cs=fe,Ns=O,Ls=Ns("match"),xs=function(e){var t;return As(e)&&((t=e[Ls])!==void 0?!!t:Cs(e)=="RegExp")},Ds=O,js=Ds("toStringTag"),To={};To[js]="z";var dr=String(To)==="[object z]",ks=dr,Fs=$,Le=fe,Ms=O,Bs=Ms("toStringTag"),Us=Object,Vs=Le(function(){return arguments}())=="Arguments",Gs=function(e,t){try{return e[t]}catch(r){}},ge=ks?Le:function(e){var t,r,n;return e===void 0?"Undefined":e===null?"Null":typeof(r=Gs(t=Us(e),Bs))=="string"?r:Vs?Le(t):(n=Le(t))=="Object"&&Fs(t.callee)?"Arguments":n},Ks=ge,Hs=String,Ws=function(e){if(Ks(e)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return Hs(e)},qs=D,Qs=function(){var e=qs(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},zs=_,Ys=A,Js=Ge,Xs=Qs,Jr=RegExp.prototype,Zs=function(e){var t=e.flags;return t===void 0&&!("flags"in Jr)&&!Ys(e,"flags")&&Js(Jr,e)?zs(Xs,e):t},hr=w,ec=lr,tc=Math.floor,lt=hr("".charAt),rc=hr("".replace),ft=hr("".slice),nc=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,oc=/\$([$&'`]|\d{1,2})/g,ac=function(e,t,r,n,o,i){var s=r+e.length,l=n.length,v=oc;return o!==void 0&&(o=ec(o),v=nc),rc(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=tc(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})},ic=C,sc=_,pr=w,Xr=sr,cc=$,uc=ve,lc=xs,z=Ws,fc=We,vc=Zs,dc=ac,hc=O,pc=hc("replace"),gc=TypeError,_o=pr("".indexOf),yc=pr("".replace),Zr=pr("".slice),bc=Math.max,en=function(e,t,r){return r>e.length?-1:t===""?r:_o(e,t,r)};ic({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(!uc(t)){if(o=lc(t),o&&(i=z(Xr(vc(t))),!~_o(i,"g")))throw gc("`.replaceAll` does not allow non-global regexes");if(s=fc(t,pc),s)return sc(s,t,n,r);if(o)return yc(z(n),t,r)}for(l=z(n),v=z(t),f=cc(r),f||(r=z(r)),a=v.length,u=bc(1,a),h=en(l,v,0);h!==-1;)d=f?z(r(v,h,l)):dc(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 mc=K,Po=mc,$c=Po,Sc=$c("String","replaceAll"),Ec=Sc,Oc=Ec,Tc=Oc,_c=Tc,Pc=ar(_c);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 wc={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"},Ic={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"},Rc={unknown:"un",mobile:"m",lowest:"ls",low:"l",medium:"md",high:"h",fullhd:"f",quadhd:"q",ultrahd:"u"},Ac={pip:"pi",fullscreen:"fs",external:"ex",prefetch:"pr",airplay:"ap",chromecast:"cc",invisible:"iv"},Cc={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}},Nc=e=>c.fillWithDefault(e,Cc);function Lc(){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 xc=fe,Qe=typeof process!="undefined"&&xc(process)=="process",Dc=pe,gr=function(e,t,r,n){return n&&n.enumerable?e[t]=r:Dc(e,t,r),e},jc=dr,kc=ge,Fc=jc?{}.toString:function(){return"[object "+kc(this)+"]"},Mc=dr,Bc=W.f,Uc=pe,Vc=A,Gc=Fc,Kc=O,tn=Kc("toStringTag"),yr=function(e,t,r,n){if(e){var o=r?e:e.prototype;Vc(o,tn)||Bc(o,tn,{configurable:!0,value:t}),n&&!Mc&&Uc(o,"toString",Gc)}},Hc=W,Wc=function(e,t,r){return Hc.f(e,t,r)},qc=K,Qc=Wc,zc=O,Yc=M,rn=zc("species"),Jc=function(e){var t=qc(e);Yc&&t&&!t[rn]&&Qc(t,rn,{configurable:!0,get:function(){return this}})},Xc=Ge,Zc=TypeError,eu=function(e,t){if(Xc(t,e))return e;throw Zc("Incorrect invocation")},tu=w,ru=$,Ut=ur,nu=tu(Function.toString);ru(Ut.inspectSource)||(Ut.inspectSource=function(e){return nu(e)});var wo=Ut.inspectSource,ou=w,au=P,Io=$,iu=ge,su=K,cu=wo,Ro=function(){},uu=[],Ao=su("Reflect","construct"),br=/^\s*(?:class|function)\b/,lu=ou(br.exec),fu=!br.exec(Ro),ie=function(t){if(!Io(t))return!1;try{return Ao(Ro,uu,t),!0}catch(r){return!1}},Co=function(t){if(!Io(t))return!1;switch(iu(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return fu||!!lu(br,cu(t))}catch(r){return!0}};Co.sham=!0;var vu=!Ao||au(function(){var e;return ie(ie.call)||!ie(Object)||!ie(function(){e=!0})||e})?Co:ie,du=vu,hu=He,pu=TypeError,gu=function(e){if(du(e))return e;throw pu(hu(e)+" is not a constructor")},nn=D,yu=gu,bu=ve,mu=O,$u=mu("species"),No=function(e,t){var r=nn(e).constructor,n;return r===void 0||bu(n=nn(r)[$u])?t:yu(n)},Su=K,Lo=Su("document","documentElement"),Eu=w,Ou=Eu([].slice),Tu=TypeError,_u=function(e,t){if(e<t)throw Tu("Not enough arguments");return e},Pu=Ke,xo=/(?:ipad|iphone|ipod).*applewebkit/i.test(Pu),T=E,wu=to,Iu=qe,on=$,Ru=A,Do=P,an=Lo,Au=Ou,sn=vr,Cu=_u,Nu=xo,Lu=Qe,Vt=T.setImmediate,Gt=T.clearImmediate,xu=T.process,vt=T.Dispatch,Du=T.Function,cn=T.MessageChannel,ju=T.String,dt=0,se={},un="onreadystatechange",ue,B,ht,pt;Do(function(){ue=T.location});var mr=function(e){if(Ru(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(ju(e),ue.protocol+"//"+ue.host)};(!Vt||!Gt)&&(Vt=function(t){Cu(arguments.length,1);var r=on(t)?t:Du(t),n=Au(arguments,1);return se[++dt]=function(){wu(r,void 0,n)},B(dt),dt},Gt=function(t){delete se[t]},Lu?B=function(e){xu.nextTick(gt(e))}:vt&&vt.now?B=function(e){vt.now(gt(e))}:cn&&!Nu?(ht=new cn,pt=ht.port2,ht.port1.onmessage=ln,B=Iu(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,ku=Ke,Fu=/ipad|iphone|ipod/i.test(ku)&&typeof Pebble!="undefined",Mu=Ke,Bu=/web0s(?!.*chrome)/i.test(Mu),G=E,vn=qe,Uu=ir.f,yt=jo.set,Vu=Fo,Gu=xo,Ku=Fu,Hu=Bu,bt=Qe,dn=G.MutationObserver||G.WebKitMutationObserver,hn=G.document,pn=G.process,Oe=G.Promise,gn=Uu(G,"queueMicrotask"),Kt=gn&&gn.value,Y,mt,$t,Te,yn;if(!Kt){var _e=new Vu,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()};!Gu&&!bt&&!Hu&&dn&&hn?(mt=!0,$t=hn.createTextNode(""),new dn(Pe).observe($t,{characterData:!0}),Y=function(){$t.data=mt=!mt}):!Ku&&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 Wu=Kt,qu=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}}},Qu=E,zu=$,bn=Qu.WeakMap,Yu=zu(bn)&&/native code/.test(String(bn)),Ju=mo,Xu=$o,mn=Ju("keys"),Sr=function(e){return mn[e]||(mn[e]=Xu(e))},Er={},Zu=Yu,Mo=E,el=x,tl=pe,St=A,Et=ur,rl=Sr,nl=Er,$n="Object already initialized",Ht=Mo.TypeError,ol=Mo.WeakMap,Fe,le,Me,al=function(e){return Me(e)?le(e):Fe(e,{})},il=function(e){return function(t){var r;if(!el(t)||(r=le(t)).type!==e)throw Ht("Incompatible receiver, "+e+" required");return r}};if(Zu||Et.state){var R=Et.state||(Et.state=new ol);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=rl("state");nl[J]=!0,Fe=function(e,t){if(St(e,J))throw Ht($n);return t.facade=e,tl(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:al,getterFor:il},sl=E,ne=sl.Promise,Uo=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",cl=Uo,ul=Qe,ll=!cl&&!ul&&typeof window=="object"&&typeof document=="object",fl=E,ce=ne,vl=$,dl=Eo,hl=wo,pl=O,gl=ll,yl=Uo,Ot=ho,Sn=ce&&ce.prototype,bl=pl("species"),Wt=!1,Vo=vl(fl.PromiseRejectionEvent),ml=dl("Promise",function(){var e=hl(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[bl]=n,Wt=r.then(function(){})instanceof n,!Wt)return!0}return!t&&(gl||yl)&&!Vo}),ye={CONSTRUCTOR:ml,REJECTION_EVENT:Vo,SUBCLASSING:Wt},oe={},En=H,$l=TypeError,Sl=function(e){var t,r;this.promise=new e(function(n,o){if(t!==void 0||r!==void 0)throw $l("Bad Promise constructor");t=n,r=o}),this.resolve=En(t),this.reject=En(r)};oe.f=function(e){return new Sl(e)};var El=C,Be=Qe,F=E,be=_,Ol=gr,Tl=yr,_l=Jc,Pl=H,qt=$,wl=x,Il=eu,Rl=No,Go=jo.set,Or=Wu,Al=qu,Cl=$r,Nl=Fo,Ko=Bo,Qt=ne,Tr=ye,Ho=oe,ze="Promise",Wo=Tr.CONSTRUCTOR,Ll=Tr.REJECTION_EVENT;Tr.SUBCLASSING;var Tt=Ko.getterFor(ze),xl=Ko.set,Dl=Qt&&Qt.prototype,ee=Qt,_t=Dl,qo=F.TypeError,zt=F.document,_r=F.process,Yt=Ho.f,jl=Yt,kl=!!(zt&&zt.createEvent&&F.dispatchEvent),Qo="unhandledrejection",Fl="rejectionhandled",On=0,zo=1,Ml=2,Pr=1,Yo=2,we,Tn,Bl,Jo=function(e){var t;return wl(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&&Vl(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&&Ul(e)}))},ea=function(e,t,r){var n,o;kl?(n=zt.createEvent("Event"),n.promise=t,n.reason=r,n.initEvent(e,!1,!0),F.dispatchEvent(n)):n={promise:t,reason:r},!Ll&&(o=F["on"+e])?o(n):e===Qo&&Al("Unhandled promise rejection",r)},Ul=function(e){be(Go,F,function(){var t=e.facade,r=e.value,n=_n(e),o;if(n&&(o=Cl(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},Vl=function(e){be(Go,F,function(){var t=e.facade;Be?_r.emit("rejectionHandled",t):ea(Fl,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=Ml,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){Il(this,_t),Pl(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){xl(this,{type:ze,done:!1,notified:!1,parent:!1,reactions:new Nl,rejection:!1,state:On,value:void 0})},we.prototype=Ol(_t,"then",function(t,r){var n=Tt(this),o=Yt(Rl(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===Bl?new Tn(e):jl(e)});El({global:!0,constructor:!0,wrap:!0,forced:Wo},{Promise:ee});Tl(ee,ze,!1,!0);_l(ze);var ae={},Gl=O,Kl=ae,Hl=Gl("iterator"),Wl=Array.prototype,ql=function(e){return e!==void 0&&(Kl.Array===e||Wl[Hl]===e)},Ql=Math.ceil,zl=Math.floor,Yl=Math.trunc||function(t){var r=+t;return(r>0?zl:Ql)(r)},Jl=Yl,ta=function(e){var t=+e;return t!==t||t===0?0:Jl(t)},Xl=ta,Zl=Math.min,ef=function(e){return e>0?Zl(Xl(e),9007199254740991):0},tf=ef,ra=function(e){return tf(e.length)},rf=ge,Pn=We,nf=ve,of=ae,af=O,sf=af("iterator"),na=function(e){if(!nf(e))return Pn(e,sf)||Pn(e,"@@iterator")||of[rf(e)]},cf=_,uf=H,lf=D,ff=He,vf=na,df=TypeError,hf=function(e,t){var r=arguments.length<2?vf(e):t;if(uf(r))return lf(cf(r,e));throw df(ff(e)+" is not iterable")},pf=_,wn=D,gf=We,yf=function(e,t,r){var n,o;wn(e);try{if(n=gf(e,"return"),!n){if(t==="throw")throw r;return r}n=pf(n,e)}catch(i){o=!0,n=i}if(t==="throw")throw r;if(o)throw n;return wn(n),r},bf=qe,mf=_,$f=D,Sf=He,Ef=ql,Of=ra,In=Ge,Tf=hf,_f=na,Rn=yf,Pf=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=bf(t,n),f,a,u,d,h,g,y,b=function(S){return f&&Rn(f,"normal",S),new xe(!0,S)},m=function(S){return o?($f(S),l?v(S[0],S[1],b):v(S[0],S[1])):l?v(S,b):v(S)};if(i)f=e.iterator;else if(s)f=e;else{if(a=_f(e),!a)throw Pf(Sf(e)+" is not iterable");if(Ef(a)){for(u=0,d=Of(e);d>u;u++)if(h=m(e[u]),h&&In(An,h))return h;return new xe(!1)}f=Tf(e,a)}for(g=i?e.next:f.next;!(y=mf(g,f)).done;){try{h=m(y.value)}catch(S){Rn(f,"throw",S)}if(typeof h=="object"&&h&&In(An,h))return h}return new xe(!1)},wf=O,oa=wf("iterator"),aa=!1;try{var If=0,Cn={next:function(){return{done:!!If++}},return:function(){aa=!0}};Cn[oa]=function(){return this},Array.from(Cn,function(){throw 2})}catch(e){}var Rf=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},Af=ne,Cf=Rf,Nf=ye.CONSTRUCTOR,ia=Nf||!Cf(function(e){Af.all(e).then(void 0,function(){})}),Lf=C,xf=_,Df=H,jf=oe,kf=$r,Ff=wr,Mf=ia;Lf({target:"Promise",stat:!0,forced:Mf},{all:function(t){var r=this,n=jf.f(r),o=n.resolve,i=n.reject,s=kf(function(){var l=Df(r.resolve),v=[],f=0,a=1;Ff(t,function(u){var d=f++,h=!1;a++,xf(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 Bf=C,Uf=ye.CONSTRUCTOR,Nn=ne;Nn&&Nn.prototype;Bf({target:"Promise",proto:!0,forced:Uf,real:!0},{catch:function(e){return this.then(void 0,e)}});var Vf=C,Gf=_,Kf=H,Hf=oe,Wf=$r,qf=wr,Qf=ia;Vf({target:"Promise",stat:!0,forced:Qf},{race:function(t){var r=this,n=Hf.f(r),o=n.reject,i=Wf(function(){var s=Kf(r.resolve);qf(t,function(l){Gf(s,r,l).then(n.resolve,o)})});return i.error&&o(i.value),n.promise}});var zf=C,Yf=_,Jf=oe,Xf=ye.CONSTRUCTOR;zf({target:"Promise",stat:!0,forced:Xf},{reject:function(t){var r=Jf.f(this);return Yf(r.reject,void 0,t),r.promise}});var Zf=D,ev=x,tv=oe,sa=function(e,t){if(Zf(e),ev(t)&&t.constructor===e)return t;var r=tv.f(e),n=r.resolve;return n(t),r.promise},rv=C,nv=K,ov=fi,av=ne,iv=ye.CONSTRUCTOR,sv=sa,cv=nv("Promise"),uv=!iv;rv({target:"Promise",stat:!0,forced:ov},{resolve:function(t){return sv(uv&&this===cv?av:this,t)}});var lv=C,Xt=ne,fv=P,vv=K,dv=$,hv=No,Ln=sa,pv=Xt&&Xt.prototype,gv=!!Xt&&fv(function(){pv.finally.call({then:function(){}},function(){})});lv({target:"Promise",proto:!0,real:!0,forced:gv},{finally:function(e){var t=hv(this,vv("Promise")),r=dv(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 yv=Po,bv=yv("Promise","finally"),mv=bv,$v=mv,Sv=$v,Ev=Sv,Pt=ar(Ev),Zt=M,Ov=A,ca=Function.prototype,Tv=Zt&&Object.getOwnPropertyDescriptor,Ir=Ov(ca,"name"),_v=Ir&&function(){}.name==="something",Pv=Ir&&(!Zt||Zt&&Tv(ca,"name").configurable),wv={EXISTS:Ir,PROPER:_v,CONFIGURABLE:Pv},ua={},Iv=ta,Rv=Math.max,Av=Math.min,Cv=function(e,t){var r=Iv(e);return r<0?Rv(r+t,0):Av(r,t)},Nv=de,Lv=Cv,xv=ra,xn=function(e){return function(t,r,n){var o=Nv(t),i=xv(o),s=Lv(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}},Dv={includes:xn(!0),indexOf:xn(!1)},jv=w,wt=A,kv=de,Fv=Dv.indexOf,Mv=Er,Dn=jv([].push),Bv=function(e,t){var r=kv(e),n=0,o=[],i;for(i in r)!wt(Mv,i)&&wt(r,i)&&Dn(o,i);for(;t.length>n;)wt(r,i=t[n++])&&(~Fv(o,i)||Dn(o,i));return o},la=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Uv=Bv,Vv=la,Gv=Object.keys||function(t){return Uv(t,Vv)},Kv=M,Hv=Oo,Wv=W,qv=D,Qv=de,zv=Gv;ua.f=Kv&&!Hv?Object.defineProperties:function(t,r){qv(t);for(var n=Qv(r),o=zv(r),i=o.length,s=0,l;i>s;)Wv.f(t,l=o[s++],n[l]);return t};var Yv=D,Jv=ua,jn=la,Xv=Er,Zv=Lo,ed=vr,td=Sr,kn=">",Fn="<",er="prototype",tr="script",fa=td("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},rd=function(){var e=ed("iframe"),t="java"+tr+":",r;return e.style.display="none",Zv.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):rd():Mn(Ie);for(var e=jn.length;e--;)delete De[er][jn[e]];return De()};Xv[fa]=!0;var da=Object.create||function(t,r){var n;return t!==null?(It[er]=Yv(t),n=new It,It[er]=null,n[fa]=t):n=De(),r===void 0?n:Jv.f(n,r)},nd=P,od=!nd(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),ad=A,id=$,sd=lr,cd=Sr,ud=od,Bn=cd("IE_PROTO"),rr=Object,ld=rr.prototype,ha=ud?rr.getPrototypeOf:function(e){var t=sd(e);if(ad(t,Bn))return t[Bn];var r=t.constructor;return id(r)&&t instanceof r?r.prototype:t instanceof rr?ld:null},fd=P,vd=$,dd=x,hd=da,Un=ha,pd=gr,gd=O,nr=gd("iterator"),pa=!1,L,Rt,At;[].keys&&(At=[].keys(),"next"in At?(Rt=Un(Un(At)),Rt!==Object.prototype&&(L=Rt)):pa=!0);var yd=!dd(L)||fd(function(){var e={};return L[nr].call(e)!==e});yd?L={}:L=hd(L);vd(L[nr])||pd(L,nr,function(){return this});var ga={IteratorPrototype:L,BUGGY_SAFARI_ITERATORS:pa},bd=ga.IteratorPrototype,md=da,$d=Ve,Sd=yr,Ed=ae,Od=function(){return this},Td=function(e,t,r,n){var o=t+" Iterator";return e.prototype=md(bd,{next:$d(+!n,r)}),Sd(e,o,!1,!0),Ed[o]=Od,e},_d=C,Pd=_,ya=wv,wd=Td,Id=ha,Rd=yr,Vn=gr,Ad=O,Gn=ae,ba=ga,Cd=ya.PROPER;ya.CONFIGURABLE;ba.IteratorPrototype;var Re=ba.BUGGY_SAFARI_ITERATORS,Ct=Ad("iterator"),Kn="keys",Ae="values",Hn="entries",Nd=function(){return this},Ld=function(e,t,r,n,o,i,s){wd(r,t,n);var l=function(m){if(m===o&&d)return d;if(!Re&&m in a)return a[m];switch(m){case Kn:return function(){return new r(this,m)};case Ae:return function(){return new r(this,m)};case Hn:return function(){return new r(this,m)}}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,b;if(h&&(g=Id(h.call(new e)),g!==Object.prototype&&g.next&&(Rd(g,v,!0,!0),Gn[v]=Nd)),Cd&&o==Ae&&u&&u.name!==Ae&&(f=!0,d=function(){return Pd(u,this)}),o)if(y={values:l(Ae),keys:i?d:l(Kn),entries:l(Hn)},s)for(b in y)(Re||f||!(b in a))&&Vn(a,b,y[b]);else _d({target:t,proto:!0,forced:Re||f},y);return s&&a[Ct]!==d&&Vn(a,Ct,d,{name:o}),Gn[t]=d,y},xd=function(e,t){return{value:e,done:t}},Dd=de,Wn=ae,ma=Bo;W.f;var jd=Ld,Ce=xd,$a="Array Iterator",kd=ma.set,Fd=ma.getterFor($a);jd(Array,"Array",function(e,t){kd(this,{type:$a,target:Dd(e),index:0,kind:t})},function(){var e=Fd(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 Md=fr,Bd=W,Ud=Ve,Vd=function(e,t,r){var n=Md(t);n in e?Bd.f(e,n,Ud(0,r)):e[n]=r},Gd=C,Kd=wr,Hd=Vd;Gd({target:"Object",stat:!0},{fromEntries:function(t){var r={};return Kd(t,function(n,o){Hd(r,n,o)},{AS_ENTRIES:!0}),r}});var Wd=cr,qd=Wd.Object.fromEntries,Qd={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},zd=Qd,Yd=E,Jd=ge,Xd=pe,qn=ae,Zd=O,Qn=Zd("toStringTag");for(var Nt in zd){var zn=Yd[Nt],Lt=zn&&zn.prototype;Lt&&Jd(Lt)!==Qn&&Xd(Lt,Qn,Nt),qn[Nt]=qn.Array}var eh=qd,th=eh,rh=th,nh=rh,oh=ar(nh);const ah=e=>{var t;const{operation:r,custom:n}=e,o=oh(Object.entries(n).map(([i,s])=>{var l,v,f;const a=(l=Ic[i])!==null&&l!==void 0?l:i;let u=s;return s&&(i==="mode"?u=(v=Ac[s])!==null&&v!==void 0?v:s:i==="quality"&&(u=(f=Rc[s])!==null&&f!==void 0?f:s)),[a,u]}));return Object.assign(Object.assign({},e),{operation:(t=wc[r])!==null&&t!==void 0?t:r,custom:o})},or="1.0.41-beta.3",ih="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 sh{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(ah):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 ch{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&&(ch.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 uh(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?uh({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,Xn=Rr?Oa.fetch:window.fetch;Rr?Oa.Request:window.Request;class lh{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 fh{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 vh=()=>{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}},dh=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],hh=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)}},ph=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 gh{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 yh=()=>Math.floor(Math.random()*Math.pow(2,32)).toString(36).padStart(8,"0"),bh=(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=c.merge(l,a),g=c.merge(v,d,o,e.events.looped$);let y;const b=()=>y=i.getValue(),m=()=>{const j=i.getValue();c.isNullable(y)||y===j||c.isNullable(j)||(r.next({from:y,to:j}),y=void 0)},S=()=>{m(),b()};if(n.add(h.subscribe(b)),n.add(g.subscribe(m)),t.forceInterval&&isFinite(t.forceInterval)){let j=0;n.add(h.subscribe(()=>j=window.setTimeout(S,t.forceInterval))),n.add(g.subscribe(()=>window.clearTimeout(j)))}return n}),mh="_one-stat_",jt=`${mh}uuid`,kt=()=>{const e=new c.Subscription;return{subscription:e,subscribe:(t,r)=>{t&&e.add(t.subscribe(r))}}};class $h{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=Nc((n=r.config)!==null&&n!==void 0?n:{}),c.isNonNullable(r.apiEnv)&&(this.config.apiEnv=r.apiEnv),this.config.synchronizeTime&&(this.timeSynchronisation=new gh);const i=new c.Subject;this.experimental={error$:i};const s=c.safeStorage.get(jt);s?s.startsWith('"')&&s.endsWith('"')?(this.uuid=Pc(s,'"',""),c.safeStorage.set(jt,this.uuid)):this.uuid=s:(this.uuid=Lc(),c.safeStorage.set(jt,this.uuid)),this.resetViewSession();const l=new lh({apiKey:ih,config:this.config,error$:i,timeSynchronisation:this.timeSynchronisation});this.api=new sh({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 fh({config:this.config,debugLogger:this.debugLogger,api:this.api,error$:i,userSalt:r.userSalt});const{isEmbed:v,host:f}=vh();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(bh(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:dh(a)})),n(t.info.isAutoQualityEnabled$,a=>this.updateContext({autoQuality:a})),n(t.info.currentFormat$,a=>this.updateContext({contentType:hh(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:h})=>h===a);this.updateContext({subtitles:d==null?void 0:d.language})}),this.player=t,this.uiEvents&&this.attachToUi(this.uiEvents),this.resubscribeBeforeunload(),this.subscription.add(r),r}attachToUi(t){this.uiEvents=t;const{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(yh())}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:ph(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,b])=>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=$h;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}},Ta=P,Ue=!Ta(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),_a=Ue,eo=Function.prototype,Cr=eo.apply,Nr=eo.call,to=typeof Reflect=="object"&&Reflect.apply||(_a?Nr.bind(Cr):function(){return Nr.apply(Cr,arguments)}),ro=Ue,no=Function.prototype,Ft=no.call,Pa=ro&&no.bind.bind(Ft,Ft),w=ro?Pa:function(e){return function(){return Ft.apply(e,arguments)}},oo=w,wa=oo({}.toString),Ia=oo("".slice),fe=function(e){return Ia(wa(e),8,-1)},Ra=fe,Aa=w,ao=function(e){if(Ra(e)==="Function")return Aa(e)},Mt=typeof document=="object"&&document.all,Ca=typeof Mt=="undefined"&&Mt!==void 0,io={all:Mt,IS_HTMLDDA:Ca},so=io,Na=so.all,$=so.IS_HTMLDDA?function(e){return typeof e=="function"||e===Na}:function(e){return typeof e=="function"},ir={},La=P,M=!La(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),xa=Ue,$e=Function.prototype.call,_=xa?$e.bind($e):function(){return $e.apply($e,arguments)},co={},uo={}.propertyIsEnumerable,lo=Object.getOwnPropertyDescriptor,Da=lo&&!uo.call({1:2},1);co.f=Da?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}},ja=w,ka=P,Fa=fe,Xe=Object,Ma=ja("".split),Ba=ka(function(){return!Xe("z").propertyIsEnumerable(0)})?function(e){return Fa(e)=="String"?Ma(e,""):Xe(e)}:Xe,ve=function(e){return e==null},Ua=ve,Va=TypeError,sr=function(e){if(Ua(e))throw Va("Can't call method on "+e);return e},Ga=Ba,Ka=sr,de=function(e){return Ga(Ka(e))},Lr=$,fo=io,Ha=fo.all,x=fo.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:Lr(e)||e===Ha}:function(e){return typeof e=="object"?e!==null:Lr(e)},cr={},Ze=cr,et=E,Wa=$,xr=function(e){return Wa(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]},qa=w,Ge=qa({}.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,Qa=P,za=E,Ya=za.String,po=!!Object.getOwnPropertySymbols&&!Qa(function(){var e=Symbol();return!Ya(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Mr&&Mr<41}),Ja=po,go=Ja&&!Symbol.sham&&typeof Symbol.iterator=="symbol",Xa=K,Za=$,ei=Ge,ti=go,ri=Object,yo=ti?function(e){return typeof e=="symbol"}:function(e){var t=Xa("Symbol");return Za(t)&&ei(t.prototype,ri(e))},ni=String,He=function(e){try{return ni(e)}catch(t){return"Object"}},oi=$,ai=He,ii=TypeError,H=function(e){if(oi(e))return e;throw ii(ai(e)+" is not a function")},si=H,ci=ve,We=function(e,t){var r=e[t];return ci(r)?void 0:si(r)},rt=_,nt=$,ot=x,ui=TypeError,li=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 ui("Can't convert object to primitive value")},bo={exports:{}},fi=!0,Br=E,vi=Object.defineProperty,di=function(e,t){try{vi(Br,e,{value:t,configurable:!0,writable:!0})}catch(r){Br[e]=t}return t},hi=E,pi=di,Ur="__core-js_shared__",gi=hi[Ur]||pi(Ur,{}),ur=gi,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,yi=sr,bi=Object,lr=function(e){return bi(yi(e))},mi=w,$i=lr,Si=mi({}.hasOwnProperty),A=Object.hasOwn||function(t,r){return Si($i(t),r)},Ei=w,Oi=0,Ti=Math.random(),_i=Ei(1 .toString),$o=function(e){return"Symbol("+(e===void 0?"":e)+")_"+_i(++Oi+Ti,36)},Pi=E,wi=mo,Gr=A,Ii=$o,Ri=po,Ai=go,X=Pi.Symbol,at=wi("wks"),Ci=Ai?X.for||X:X&&X.withoutSetter||Ii,O=function(e){return Gr(at,e)||(at[e]=Ri&&Gr(X,e)?X[e]:Ci("Symbol."+e)),at[e]},Ni=_,Kr=x,Hr=yo,Li=We,xi=li,Di=O,ji=TypeError,ki=Di("toPrimitive"),Fi=function(e,t){if(!Kr(e)||Hr(e))return e;var r=Li(e,ki),n;if(r){if(t===void 0&&(t="default"),n=Ni(r,e,t),!Kr(n)||Hr(n))return n;throw ji("Can't convert object to primitive value")}return t===void 0&&(t="number"),xi(e,t)},Mi=Fi,Bi=yo,fr=function(e){var t=Mi(e,"string");return Bi(t)?t:t+""},Ui=E,Wr=x,Bt=Ui.document,Vi=Wr(Bt)&&Wr(Bt.createElement),vr=function(e){return Vi?Bt.createElement(e):{}},Gi=M,Ki=P,Hi=vr,So=!Gi&&!Ki(function(){return Object.defineProperty(Hi("div"),"a",{get:function(){return 7}}).a!=7}),Wi=M,qi=_,Qi=co,zi=Ve,Yi=de,Ji=fr,Xi=A,Zi=So,qr=Object.getOwnPropertyDescriptor;ir.f=Wi?qr:function(t,r){if(t=Yi(t),r=Ji(r),Zi)try{return qr(t,r)}catch(n){}if(Xi(t,r))return zi(!qi(Qi.f,t,r),t[r])};var es=P,ts=$,rs=/#|\.prototype\./,he=function(e,t){var r=os[ns(e)];return r==is?!0:r==as?!1:ts(t)?es(t):!!t},ns=he.normalize=function(e){return String(e).replace(rs,".").toLowerCase()},os=he.data={},as=he.NATIVE="N",is=he.POLYFILL="P",Eo=he,Qr=ao,ss=H,cs=Ue,us=Qr(Qr.bind),qe=function(e,t){return ss(e),t===void 0?e:cs?us(e,t):function(){return e.apply(t,arguments)}},W={},ls=M,fs=P,Oo=ls&&fs(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),vs=x,ds=String,hs=TypeError,D=function(e){if(vs(e))return e;throw hs(ds(e)+" is not an object")},ps=M,gs=So,ys=Oo,Se=D,zr=fr,bs=TypeError,it=Object.defineProperty,ms=Object.getOwnPropertyDescriptor,st="enumerable",ct="configurable",ut="writable";W.f=ps?ys?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=ms(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),gs)try{return it(t,r,n)}catch(o){}if("get"in n||"set"in n)throw bs("Accessors not supported");return"value"in n&&(t[r]=n.value),t};var $s=M,Ss=W,Es=Ve,pe=$s?function(e,t,r){return Ss.f(e,t,Es(1,r))}:function(e,t,r){return e[t]=r,e},Ee=E,Os=to,Ts=ao,_s=$,Ps=ir.f,ws=Eo,q=cr,Is=qe,Q=pe,Yr=A,Rs=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 Os(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,b,m;for(d in t)f=ws(n?d:r+(o?".":"#")+d,e.forced),a=!f&&s&&Yr(s,d),g=l[d],a&&(e.dontCallGetSet?(m=Ps(s,d),y=m&&m.value):y=s[d]),h=a&&y?y:t[d],!(a&&typeof g==typeof h)&&(e.bind&&a?b=Is(h,Ee):e.wrap&&a?b=Rs(h):i&&_s(h)?b=Ts(h):b=h,(e.sham||h&&h.sham||g&&g.sham)&&Q(b,"sham",!0),Q(l,d,b),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)))},As=x,Cs=fe,Ns=O,Ls=Ns("match"),xs=function(e){var t;return As(e)&&((t=e[Ls])!==void 0?!!t:Cs(e)=="RegExp")},Ds=O,js=Ds("toStringTag"),To={};To[js]="z";var dr=String(To)==="[object z]",ks=dr,Fs=$,Le=fe,Ms=O,Bs=Ms("toStringTag"),Us=Object,Vs=Le(function(){return arguments}())=="Arguments",Gs=function(e,t){try{return e[t]}catch(r){}},ge=ks?Le:function(e){var t,r,n;return e===void 0?"Undefined":e===null?"Null":typeof(r=Gs(t=Us(e),Bs))=="string"?r:Vs?Le(t):(n=Le(t))=="Object"&&Fs(t.callee)?"Arguments":n},Ks=ge,Hs=String,Ws=function(e){if(Ks(e)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return Hs(e)},qs=D,Qs=function(){var e=qs(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},zs=_,Ys=A,Js=Ge,Xs=Qs,Jr=RegExp.prototype,Zs=function(e){var t=e.flags;return t===void 0&&!("flags"in Jr)&&!Ys(e,"flags")&&Js(Jr,e)?zs(Xs,e):t},hr=w,ec=lr,tc=Math.floor,lt=hr("".charAt),rc=hr("".replace),ft=hr("".slice),nc=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,oc=/\$([$&'`]|\d{1,2})/g,ac=function(e,t,r,n,o,i){var s=r+e.length,l=n.length,v=oc;return o!==void 0&&(o=ec(o),v=nc),rc(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=tc(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})},ic=C,sc=_,pr=w,Xr=sr,cc=$,uc=ve,lc=xs,z=Ws,fc=We,vc=Zs,dc=ac,hc=O,pc=hc("replace"),gc=TypeError,_o=pr("".indexOf),yc=pr("".replace),Zr=pr("".slice),bc=Math.max,en=function(e,t,r){return r>e.length?-1:t===""?r:_o(e,t,r)};ic({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(!uc(t)){if(o=lc(t),o&&(i=z(Xr(vc(t))),!~_o(i,"g")))throw gc("`.replaceAll` does not allow non-global regexes");if(s=fc(t,pc),s)return sc(s,t,n,r);if(o)return yc(z(n),t,r)}for(l=z(n),v=z(t),f=cc(r),f||(r=z(r)),a=v.length,u=bc(1,a),h=en(l,v,0);h!==-1;)d=f?z(r(v,h,l)):dc(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 mc=K,Po=mc,$c=Po,Sc=$c("String","replaceAll"),Ec=Sc,Oc=Ec,Tc=Oc,_c=Tc,Pc=ar(_c);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 wc={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"},Ic={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"},Rc={unknown:"un",mobile:"m",lowest:"ls",low:"l",medium:"md",high:"h",fullhd:"f",quadhd:"q",ultrahd:"u"},Ac={pip:"pi",fullscreen:"fs",external:"ex",prefetch:"pr",airplay:"ap",chromecast:"cc",invisible:"iv"},Cc={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}},Nc=e=>c.fillWithDefault(e,Cc);function Lc(){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 xc=fe,Qe=typeof process!="undefined"&&xc(process)=="process",Dc=pe,gr=function(e,t,r,n){return n&&n.enumerable?e[t]=r:Dc(e,t,r),e},jc=dr,kc=ge,Fc=jc?{}.toString:function(){return"[object "+kc(this)+"]"},Mc=dr,Bc=W.f,Uc=pe,Vc=A,Gc=Fc,Kc=O,tn=Kc("toStringTag"),yr=function(e,t,r,n){if(e){var o=r?e:e.prototype;Vc(o,tn)||Bc(o,tn,{configurable:!0,value:t}),n&&!Mc&&Uc(o,"toString",Gc)}},Hc=W,Wc=function(e,t,r){return Hc.f(e,t,r)},qc=K,Qc=Wc,zc=O,Yc=M,rn=zc("species"),Jc=function(e){var t=qc(e);Yc&&t&&!t[rn]&&Qc(t,rn,{configurable:!0,get:function(){return this}})},Xc=Ge,Zc=TypeError,eu=function(e,t){if(Xc(t,e))return e;throw Zc("Incorrect invocation")},tu=w,ru=$,Ut=ur,nu=tu(Function.toString);ru(Ut.inspectSource)||(Ut.inspectSource=function(e){return nu(e)});var wo=Ut.inspectSource,ou=w,au=P,Io=$,iu=ge,su=K,cu=wo,Ro=function(){},uu=[],Ao=su("Reflect","construct"),br=/^\s*(?:class|function)\b/,lu=ou(br.exec),fu=!br.exec(Ro),ie=function(t){if(!Io(t))return!1;try{return Ao(Ro,uu,t),!0}catch(r){return!1}},Co=function(t){if(!Io(t))return!1;switch(iu(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return fu||!!lu(br,cu(t))}catch(r){return!0}};Co.sham=!0;var vu=!Ao||au(function(){var e;return ie(ie.call)||!ie(Object)||!ie(function(){e=!0})||e})?Co:ie,du=vu,hu=He,pu=TypeError,gu=function(e){if(du(e))return e;throw pu(hu(e)+" is not a constructor")},nn=D,yu=gu,bu=ve,mu=O,$u=mu("species"),No=function(e,t){var r=nn(e).constructor,n;return r===void 0||bu(n=nn(r)[$u])?t:yu(n)},Su=K,Lo=Su("document","documentElement"),Eu=w,Ou=Eu([].slice),Tu=TypeError,_u=function(e,t){if(e<t)throw Tu("Not enough arguments");return e},Pu=Ke,xo=/(?:ipad|iphone|ipod).*applewebkit/i.test(Pu),T=E,wu=to,Iu=qe,on=$,Ru=A,Do=P,an=Lo,Au=Ou,sn=vr,Cu=_u,Nu=xo,Lu=Qe,Vt=T.setImmediate,Gt=T.clearImmediate,xu=T.process,vt=T.Dispatch,Du=T.Function,cn=T.MessageChannel,ju=T.String,dt=0,se={},un="onreadystatechange",ue,B,ht,pt;Do(function(){ue=T.location});var mr=function(e){if(Ru(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(ju(e),ue.protocol+"//"+ue.host)};(!Vt||!Gt)&&(Vt=function(t){Cu(arguments.length,1);var r=on(t)?t:Du(t),n=Au(arguments,1);return se[++dt]=function(){wu(r,void 0,n)},B(dt),dt},Gt=function(t){delete se[t]},Lu?B=function(e){xu.nextTick(gt(e))}:vt&&vt.now?B=function(e){vt.now(gt(e))}:cn&&!Nu?(ht=new cn,pt=ht.port2,ht.port1.onmessage=ln,B=Iu(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,ku=Ke,Fu=/ipad|iphone|ipod/i.test(ku)&&typeof Pebble!="undefined",Mu=Ke,Bu=/web0s(?!.*chrome)/i.test(Mu),G=E,vn=qe,Uu=ir.f,yt=jo.set,Vu=Fo,Gu=xo,Ku=Fu,Hu=Bu,bt=Qe,dn=G.MutationObserver||G.WebKitMutationObserver,hn=G.document,pn=G.process,Oe=G.Promise,gn=Uu(G,"queueMicrotask"),Kt=gn&&gn.value,Y,mt,$t,Te,yn;if(!Kt){var _e=new Vu,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()};!Gu&&!bt&&!Hu&&dn&&hn?(mt=!0,$t=hn.createTextNode(""),new dn(Pe).observe($t,{characterData:!0}),Y=function(){$t.data=mt=!mt}):!Ku&&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 Wu=Kt,qu=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}}},Qu=E,zu=$,bn=Qu.WeakMap,Yu=zu(bn)&&/native code/.test(String(bn)),Ju=mo,Xu=$o,mn=Ju("keys"),Sr=function(e){return mn[e]||(mn[e]=Xu(e))},Er={},Zu=Yu,Mo=E,el=x,tl=pe,St=A,Et=ur,rl=Sr,nl=Er,$n="Object already initialized",Ht=Mo.TypeError,ol=Mo.WeakMap,Fe,le,Me,al=function(e){return Me(e)?le(e):Fe(e,{})},il=function(e){return function(t){var r;if(!el(t)||(r=le(t)).type!==e)throw Ht("Incompatible receiver, "+e+" required");return r}};if(Zu||Et.state){var R=Et.state||(Et.state=new ol);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=rl("state");nl[J]=!0,Fe=function(e,t){if(St(e,J))throw Ht($n);return t.facade=e,tl(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:al,getterFor:il},sl=E,ne=sl.Promise,Uo=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",cl=Uo,ul=Qe,ll=!cl&&!ul&&typeof window=="object"&&typeof document=="object",fl=E,ce=ne,vl=$,dl=Eo,hl=wo,pl=O,gl=ll,yl=Uo,Ot=ho,Sn=ce&&ce.prototype,bl=pl("species"),Wt=!1,Vo=vl(fl.PromiseRejectionEvent),ml=dl("Promise",function(){var e=hl(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[bl]=n,Wt=r.then(function(){})instanceof n,!Wt)return!0}return!t&&(gl||yl)&&!Vo}),ye={CONSTRUCTOR:ml,REJECTION_EVENT:Vo,SUBCLASSING:Wt},oe={},En=H,$l=TypeError,Sl=function(e){var t,r;this.promise=new e(function(n,o){if(t!==void 0||r!==void 0)throw $l("Bad Promise constructor");t=n,r=o}),this.resolve=En(t),this.reject=En(r)};oe.f=function(e){return new Sl(e)};var El=C,Be=Qe,F=E,be=_,Ol=gr,Tl=yr,_l=Jc,Pl=H,qt=$,wl=x,Il=eu,Rl=No,Go=jo.set,Or=Wu,Al=qu,Cl=$r,Nl=Fo,Ko=Bo,Qt=ne,Tr=ye,Ho=oe,ze="Promise",Wo=Tr.CONSTRUCTOR,Ll=Tr.REJECTION_EVENT;Tr.SUBCLASSING;var Tt=Ko.getterFor(ze),xl=Ko.set,Dl=Qt&&Qt.prototype,ee=Qt,_t=Dl,qo=F.TypeError,zt=F.document,_r=F.process,Yt=Ho.f,jl=Yt,kl=!!(zt&&zt.createEvent&&F.dispatchEvent),Qo="unhandledrejection",Fl="rejectionhandled",On=0,zo=1,Ml=2,Pr=1,Yo=2,we,Tn,Bl,Jo=function(e){var t;return wl(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&&Vl(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&&Ul(e)}))},ea=function(e,t,r){var n,o;kl?(n=zt.createEvent("Event"),n.promise=t,n.reason=r,n.initEvent(e,!1,!0),F.dispatchEvent(n)):n={promise:t,reason:r},!Ll&&(o=F["on"+e])?o(n):e===Qo&&Al("Unhandled promise rejection",r)},Ul=function(e){be(Go,F,function(){var t=e.facade,r=e.value,n=_n(e),o;if(n&&(o=Cl(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},Vl=function(e){be(Go,F,function(){var t=e.facade;Be?_r.emit("rejectionHandled",t):ea(Fl,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=Ml,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){Il(this,_t),Pl(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){xl(this,{type:ze,done:!1,notified:!1,parent:!1,reactions:new Nl,rejection:!1,state:On,value:void 0})},we.prototype=Ol(_t,"then",function(t,r){var n=Tt(this),o=Yt(Rl(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===Bl?new Tn(e):jl(e)});El({global:!0,constructor:!0,wrap:!0,forced:Wo},{Promise:ee});Tl(ee,ze,!1,!0);_l(ze);var ae={},Gl=O,Kl=ae,Hl=Gl("iterator"),Wl=Array.prototype,ql=function(e){return e!==void 0&&(Kl.Array===e||Wl[Hl]===e)},Ql=Math.ceil,zl=Math.floor,Yl=Math.trunc||function(t){var r=+t;return(r>0?zl:Ql)(r)},Jl=Yl,ta=function(e){var t=+e;return t!==t||t===0?0:Jl(t)},Xl=ta,Zl=Math.min,ef=function(e){return e>0?Zl(Xl(e),9007199254740991):0},tf=ef,ra=function(e){return tf(e.length)},rf=ge,Pn=We,nf=ve,of=ae,af=O,sf=af("iterator"),na=function(e){if(!nf(e))return Pn(e,sf)||Pn(e,"@@iterator")||of[rf(e)]},cf=_,uf=H,lf=D,ff=He,vf=na,df=TypeError,hf=function(e,t){var r=arguments.length<2?vf(e):t;if(uf(r))return lf(cf(r,e));throw df(ff(e)+" is not iterable")},pf=_,wn=D,gf=We,yf=function(e,t,r){var n,o;wn(e);try{if(n=gf(e,"return"),!n){if(t==="throw")throw r;return r}n=pf(n,e)}catch(i){o=!0,n=i}if(t==="throw")throw r;if(o)throw n;return wn(n),r},bf=qe,mf=_,$f=D,Sf=He,Ef=ql,Of=ra,In=Ge,Tf=hf,_f=na,Rn=yf,Pf=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=bf(t,n),f,a,u,d,h,g,y,b=function(S){return f&&Rn(f,"normal",S),new xe(!0,S)},m=function(S){return o?($f(S),l?v(S[0],S[1],b):v(S[0],S[1])):l?v(S,b):v(S)};if(i)f=e.iterator;else if(s)f=e;else{if(a=_f(e),!a)throw Pf(Sf(e)+" is not iterable");if(Ef(a)){for(u=0,d=Of(e);d>u;u++)if(h=m(e[u]),h&&In(An,h))return h;return new xe(!1)}f=Tf(e,a)}for(g=i?e.next:f.next;!(y=mf(g,f)).done;){try{h=m(y.value)}catch(S){Rn(f,"throw",S)}if(typeof h=="object"&&h&&In(An,h))return h}return new xe(!1)},wf=O,oa=wf("iterator"),aa=!1;try{var If=0,Cn={next:function(){return{done:!!If++}},return:function(){aa=!0}};Cn[oa]=function(){return this},Array.from(Cn,function(){throw 2})}catch(e){}var Rf=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},Af=ne,Cf=Rf,Nf=ye.CONSTRUCTOR,ia=Nf||!Cf(function(e){Af.all(e).then(void 0,function(){})}),Lf=C,xf=_,Df=H,jf=oe,kf=$r,Ff=wr,Mf=ia;Lf({target:"Promise",stat:!0,forced:Mf},{all:function(t){var r=this,n=jf.f(r),o=n.resolve,i=n.reject,s=kf(function(){var l=Df(r.resolve),v=[],f=0,a=1;Ff(t,function(u){var d=f++,h=!1;a++,xf(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 Bf=C,Uf=ye.CONSTRUCTOR,Nn=ne;Nn&&Nn.prototype;Bf({target:"Promise",proto:!0,forced:Uf,real:!0},{catch:function(e){return this.then(void 0,e)}});var Vf=C,Gf=_,Kf=H,Hf=oe,Wf=$r,qf=wr,Qf=ia;Vf({target:"Promise",stat:!0,forced:Qf},{race:function(t){var r=this,n=Hf.f(r),o=n.reject,i=Wf(function(){var s=Kf(r.resolve);qf(t,function(l){Gf(s,r,l).then(n.resolve,o)})});return i.error&&o(i.value),n.promise}});var zf=C,Yf=_,Jf=oe,Xf=ye.CONSTRUCTOR;zf({target:"Promise",stat:!0,forced:Xf},{reject:function(t){var r=Jf.f(this);return Yf(r.reject,void 0,t),r.promise}});var Zf=D,ev=x,tv=oe,sa=function(e,t){if(Zf(e),ev(t)&&t.constructor===e)return t;var r=tv.f(e),n=r.resolve;return n(t),r.promise},rv=C,nv=K,ov=fi,av=ne,iv=ye.CONSTRUCTOR,sv=sa,cv=nv("Promise"),uv=!iv;rv({target:"Promise",stat:!0,forced:ov},{resolve:function(t){return sv(uv&&this===cv?av:this,t)}});var lv=C,Xt=ne,fv=P,vv=K,dv=$,hv=No,Ln=sa,pv=Xt&&Xt.prototype,gv=!!Xt&&fv(function(){pv.finally.call({then:function(){}},function(){})});lv({target:"Promise",proto:!0,real:!0,forced:gv},{finally:function(e){var t=hv(this,vv("Promise")),r=dv(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 yv=Po,bv=yv("Promise","finally"),mv=bv,$v=mv,Sv=$v,Ev=Sv,Pt=ar(Ev),Zt=M,Ov=A,ca=Function.prototype,Tv=Zt&&Object.getOwnPropertyDescriptor,Ir=Ov(ca,"name"),_v=Ir&&function(){}.name==="something",Pv=Ir&&(!Zt||Zt&&Tv(ca,"name").configurable),wv={EXISTS:Ir,PROPER:_v,CONFIGURABLE:Pv},ua={},Iv=ta,Rv=Math.max,Av=Math.min,Cv=function(e,t){var r=Iv(e);return r<0?Rv(r+t,0):Av(r,t)},Nv=de,Lv=Cv,xv=ra,xn=function(e){return function(t,r,n){var o=Nv(t),i=xv(o),s=Lv(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}},Dv={includes:xn(!0),indexOf:xn(!1)},jv=w,wt=A,kv=de,Fv=Dv.indexOf,Mv=Er,Dn=jv([].push),Bv=function(e,t){var r=kv(e),n=0,o=[],i;for(i in r)!wt(Mv,i)&&wt(r,i)&&Dn(o,i);for(;t.length>n;)wt(r,i=t[n++])&&(~Fv(o,i)||Dn(o,i));return o},la=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Uv=Bv,Vv=la,Gv=Object.keys||function(t){return Uv(t,Vv)},Kv=M,Hv=Oo,Wv=W,qv=D,Qv=de,zv=Gv;ua.f=Kv&&!Hv?Object.defineProperties:function(t,r){qv(t);for(var n=Qv(r),o=zv(r),i=o.length,s=0,l;i>s;)Wv.f(t,l=o[s++],n[l]);return t};var Yv=D,Jv=ua,jn=la,Xv=Er,Zv=Lo,ed=vr,td=Sr,kn=">",Fn="<",er="prototype",tr="script",fa=td("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},rd=function(){var e=ed("iframe"),t="java"+tr+":",r;return e.style.display="none",Zv.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):rd():Mn(Ie);for(var e=jn.length;e--;)delete De[er][jn[e]];return De()};Xv[fa]=!0;var da=Object.create||function(t,r){var n;return t!==null?(It[er]=Yv(t),n=new It,It[er]=null,n[fa]=t):n=De(),r===void 0?n:Jv.f(n,r)},nd=P,od=!nd(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),ad=A,id=$,sd=lr,cd=Sr,ud=od,Bn=cd("IE_PROTO"),rr=Object,ld=rr.prototype,ha=ud?rr.getPrototypeOf:function(e){var t=sd(e);if(ad(t,Bn))return t[Bn];var r=t.constructor;return id(r)&&t instanceof r?r.prototype:t instanceof rr?ld:null},fd=P,vd=$,dd=x,hd=da,Un=ha,pd=gr,gd=O,nr=gd("iterator"),pa=!1,L,Rt,At;[].keys&&(At=[].keys(),"next"in At?(Rt=Un(Un(At)),Rt!==Object.prototype&&(L=Rt)):pa=!0);var yd=!dd(L)||fd(function(){var e={};return L[nr].call(e)!==e});yd?L={}:L=hd(L);vd(L[nr])||pd(L,nr,function(){return this});var ga={IteratorPrototype:L,BUGGY_SAFARI_ITERATORS:pa},bd=ga.IteratorPrototype,md=da,$d=Ve,Sd=yr,Ed=ae,Od=function(){return this},Td=function(e,t,r,n){var o=t+" Iterator";return e.prototype=md(bd,{next:$d(+!n,r)}),Sd(e,o,!1,!0),Ed[o]=Od,e},_d=C,Pd=_,ya=wv,wd=Td,Id=ha,Rd=yr,Vn=gr,Ad=O,Gn=ae,ba=ga,Cd=ya.PROPER;ya.CONFIGURABLE;ba.IteratorPrototype;var Re=ba.BUGGY_SAFARI_ITERATORS,Ct=Ad("iterator"),Kn="keys",Ae="values",Hn="entries",Nd=function(){return this},Ld=function(e,t,r,n,o,i,s){wd(r,t,n);var l=function(m){if(m===o&&d)return d;if(!Re&&m in a)return a[m];switch(m){case Kn:return function(){return new r(this,m)};case Ae:return function(){return new r(this,m)};case Hn:return function(){return new r(this,m)}}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,b;if(h&&(g=Id(h.call(new e)),g!==Object.prototype&&g.next&&(Rd(g,v,!0,!0),Gn[v]=Nd)),Cd&&o==Ae&&u&&u.name!==Ae&&(f=!0,d=function(){return Pd(u,this)}),o)if(y={values:l(Ae),keys:i?d:l(Kn),entries:l(Hn)},s)for(b in y)(Re||f||!(b in a))&&Vn(a,b,y[b]);else _d({target:t,proto:!0,forced:Re||f},y);return s&&a[Ct]!==d&&Vn(a,Ct,d,{name:o}),Gn[t]=d,y},xd=function(e,t){return{value:e,done:t}},Dd=de,Wn=ae,ma=Bo;W.f;var jd=Ld,Ce=xd,$a="Array Iterator",kd=ma.set,Fd=ma.getterFor($a);jd(Array,"Array",function(e,t){kd(this,{type:$a,target:Dd(e),index:0,kind:t})},function(){var e=Fd(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 Md=fr,Bd=W,Ud=Ve,Vd=function(e,t,r){var n=Md(t);n in e?Bd.f(e,n,Ud(0,r)):e[n]=r},Gd=C,Kd=wr,Hd=Vd;Gd({target:"Object",stat:!0},{fromEntries:function(t){var r={};return Kd(t,function(n,o){Hd(r,n,o)},{AS_ENTRIES:!0}),r}});var Wd=cr,qd=Wd.Object.fromEntries,Qd={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},zd=Qd,Yd=E,Jd=ge,Xd=pe,qn=ae,Zd=O,Qn=Zd("toStringTag");for(var Nt in zd){var zn=Yd[Nt],Lt=zn&&zn.prototype;Lt&&Jd(Lt)!==Qn&&Xd(Lt,Qn,Nt),qn[Nt]=qn.Array}var eh=qd,th=eh,rh=th,nh=rh,oh=ar(nh);const ah=e=>{var t;const{operation:r,custom:n}=e,o=oh(Object.entries(n).map(([i,s])=>{var l,v,f;const a=(l=Ic[i])!==null&&l!==void 0?l:i;let u=s;return s&&(i==="mode"?u=(v=Ac[s])!==null&&v!==void 0?v:s:i==="quality"&&(u=(f=Rc[s])!==null&&f!==void 0?f:s)),[a,u]}));return Object.assign(Object.assign({},e),{operation:(t=wc[r])!==null&&t!==void 0?t:r,custom:o})},or="1.0.41",ih="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 sh{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(ah):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 ch{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&&(ch.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 uh(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?uh({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,Xn=Rr?Oa.fetch:window.fetch;Rr?Oa.Request:window.Request;class lh{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 fh{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 vh=()=>{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}},dh=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],hh=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)}},ph=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 gh{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 yh=()=>Math.floor(Math.random()*Math.pow(2,32)).toString(36).padStart(8,"0"),bh=(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=c.merge(l,a),g=c.merge(v,d,o,e.events.looped$);let y;const b=()=>y=i.getValue(),m=()=>{const j=i.getValue();c.isNullable(y)||y===j||c.isNullable(j)||(r.next({from:y,to:j}),y=void 0)},S=()=>{m(),b()};if(n.add(h.subscribe(b)),n.add(g.subscribe(m)),t.forceInterval&&isFinite(t.forceInterval)){let j=0;n.add(h.subscribe(()=>j=window.setTimeout(S,t.forceInterval))),n.add(g.subscribe(()=>window.clearTimeout(j)))}return n}),mh="_one-stat_",jt=`${mh}uuid`,kt=()=>{const e=new c.Subscription;return{subscription:e,subscribe:(t,r)=>{t&&e.add(t.subscribe(r))}}};class $h{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=Nc((n=r.config)!==null&&n!==void 0?n:{}),c.isNonNullable(r.apiEnv)&&(this.config.apiEnv=r.apiEnv),this.config.synchronizeTime&&(this.timeSynchronisation=new gh);const i=new c.Subject;this.experimental={error$:i};const s=c.safeStorage.get(jt);s?s.startsWith('"')&&s.endsWith('"')?(this.uuid=Pc(s,'"',""),c.safeStorage.set(jt,this.uuid)):this.uuid=s:(this.uuid=Lc(),c.safeStorage.set(jt,this.uuid)),this.resetViewSession();const l=new lh({apiKey:ih,config:this.config,error$:i,timeSynchronisation:this.timeSynchronisation});this.api=new sh({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 fh({config:this.config,debugLogger:this.debugLogger,api:this.api,error$:i,userSalt:r.userSalt});const{isEmbed:v,host:f}=vh();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(bh(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:dh(a)})),n(t.info.isAutoQualityEnabled$,a=>this.updateContext({autoQuality:a})),n(t.info.currentFormat$,a=>this.updateContext({contentType:hh(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:h})=>h===a);this.updateContext({subtitles:d==null?void 0:d.language})}),this.player=t,this.uiEvents&&this.attachToUi(this.uiEvents),this.resubscribeBeforeunload(),this.subscription.add(r),r}attachToUi(t){this.uiEvents=t;const{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(yh())}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:ph(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,b])=>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=$h;exports.VERSION=or;
|