@vkontakte/videoplayer-interactive 1.0.31-dev.684e92f5.0 → 1.0.31-dev.aa15be9d.0
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 +5 -5
- package/es2015.esm.js +5 -5
- package/es2018.cjs.js +4 -4
- package/es2018.esm.js +4 -4
- package/esnext.cjs.js +4 -4
- package/esnext.esm.js +3 -3
- package/evergreen.esm.js +3 -3
- package/package.json +4 -4
package/es2015.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-interactive v1.0.31-dev.
|
|
3
|
-
* Tue, 11 Feb 2025
|
|
2
|
+
* @vkontakte/videoplayer-interactive v1.0.31-dev.aa15be9d.0
|
|
3
|
+
* Tue, 11 Feb 2025 10:19:27 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-31/doc/
|
|
5
5
|
*/
|
|
6
|
-
var jo=Object.create;var Wt=Object.defineProperty,No=Object.defineProperties,$o=Object.getOwnPropertyDescriptor,Lo=Object.getOwnPropertyDescriptors,_o=Object.getOwnPropertyNames,rt=Object.getOwnPropertySymbols,Fo=Object.getPrototypeOf,Kt=Object.prototype.hasOwnProperty,dn=Object.prototype.propertyIsEnumerable;var fn=r=>{throw TypeError(r)};var hn=(r,e,t)=>e in r?Wt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,d=(r,e)=>{for(var t in e||(e={}))Kt.call(e,t)&&hn(r,t,e[t]);if(rt)for(var t of rt(e))dn.call(e,t)&&hn(r,t,e[t]);return r},x=(r,e)=>No(r,Lo(e));var X=(r,e)=>{var t={};for(var n in r)Kt.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&rt)for(var n of rt(r))e.indexOf(n)<0&&dn.call(r,n)&&(t[n]=r[n]);return t};var p=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var qo=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of _o(e))!Kt.call(r,i)&&i!==t&&Wt(r,i,{get:()=>e[i],enumerable:!(n=$o(e,i))||n.enumerable});return r};var te=(r,e,t)=>(t=r!=null?jo(Fo(r)):{},qo(e||!r||!r.__esModule?Wt(t,"default",{value:r,enumerable:!0}):t,r));var mn=(r,e,t)=>e.has(r)||fn("Cannot "+t);var w=(r,e,t)=>(mn(r,e,"read from private field"),t?t.call(r):e.get(r)),U=(r,e,t)=>e.has(r)?fn("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),$=(r,e,t,n)=>(mn(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);var vn=(r,e,t,n)=>({set _(i){$(r,e,i,t)},get _(){return w(r,e,n)}});var P=(r,e,t)=>new Promise((n,i)=>{var a=s=>{try{c(t.next(s))}catch(l){i(l)}},o=s=>{try{c(t.throw(s))}catch(l){i(l)}},c=s=>s.done?n(s.value):Promise.resolve(s.value).then(a,o);c((t=t.apply(r,e)).next())});var Z=p((rr,Tn)=>{"use strict";var Pe=function(r){return r&&r.Math===Math&&r};Tn.exports=Pe(typeof globalThis=="object"&&globalThis)||Pe(typeof window=="object"&&window)||Pe(typeof self=="object"&&self)||Pe(typeof global=="object"&&global)||Pe(typeof rr=="object"&&rr)||function(){return this}()||Function("return this")()});var G=p((Yh,xn)=>{"use strict";xn.exports=function(r){try{return!!r()}catch(e){return!0}}});var ke=p((Xh,Sn)=>{"use strict";var Do=G();Sn.exports=!Do(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var Pn=p((Zh,On)=>{"use strict";var Ho=ke(),Rn=Function.prototype,wn=Rn.apply,An=Rn.call;On.exports=typeof Reflect=="object"&&Reflect.apply||(Ho?An.bind(wn):function(){return An.apply(wn,arguments)})});var K=p((Jh,Mn)=>{"use strict";var kn=ke(),Vn=Function.prototype,nr=Vn.call,Uo=kn&&Vn.bind.bind(nr,nr);Mn.exports=kn?Uo:function(r){return function(){return nr.apply(r,arguments)}}});var Ve=p((ed,Nn)=>{"use strict";var jn=K(),Go=jn({}.toString),zo=jn("".slice);Nn.exports=function(r){return zo(Go(r),8,-1)}});var ir=p((td,$n)=>{"use strict";var Wo=Ve(),Ko=K();$n.exports=function(r){if(Wo(r)==="Function")return Ko(r)}});var z=p((rd,Ln)=>{"use strict";var ar=typeof document=="object"&&document.all;Ln.exports=typeof ar=="undefined"&&ar!==void 0?function(r){return typeof r=="function"||r===ar}:function(r){return typeof r=="function"}});var ce=p((nd,_n)=>{"use strict";var Qo=G();_n.exports=!Qo(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var ft=p((id,Fn)=>{"use strict";var Yo=ke(),dt=Function.prototype.call;Fn.exports=Yo?dt.bind(dt):function(){return dt.apply(dt,arguments)}});var sr=p(Dn=>{"use strict";var qn={}.propertyIsEnumerable,Bn=Object.getOwnPropertyDescriptor,Xo=Bn&&!qn.call({1:2},1);Dn.f=Xo?function(e){var t=Bn(this,e);return!!t&&t.enumerable}:qn});var or=p((sd,Hn)=>{"use strict";Hn.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var Gn=p((od,Un)=>{"use strict";var Zo=K(),Jo=G(),ec=Ve(),cr=Object,tc=Zo("".split);Un.exports=Jo(function(){return!cr("z").propertyIsEnumerable(0)})?function(r){return ec(r)==="String"?tc(r,""):cr(r)}:cr});var lr=p((cd,zn)=>{"use strict";zn.exports=function(r){return r==null}});var ur=p((ld,Wn)=>{"use strict";var rc=lr(),nc=TypeError;Wn.exports=function(r){if(rc(r))throw new nc("Can't call method on "+r);return r}});var Me=p((ud,Kn)=>{"use strict";var ic=Gn(),ac=ur();Kn.exports=function(r){return ic(ac(r))}});var ge=p((pd,Qn)=>{"use strict";var sc=z();Qn.exports=function(r){return typeof r=="object"?r!==null:sc(r)}});var mt=p((hd,Yn)=>{"use strict";Yn.exports={}});var vt=p((dd,Zn)=>{"use strict";var pr=mt(),hr=Z(),oc=z(),Xn=function(r){return oc(r)?r:void 0};Zn.exports=function(r,e){return arguments.length<2?Xn(pr[r])||Xn(hr[r]):pr[r]&&pr[r][e]||hr[r]&&hr[r][e]}});var ei=p((fd,Jn)=>{"use strict";var cc=K();Jn.exports=cc({}.isPrototypeOf)});var ii=p((md,ni)=>{"use strict";var lc=Z(),ti=lc.navigator,ri=ti&&ti.userAgent;ni.exports=ri?String(ri):""});var pi=p((vd,ui)=>{"use strict";var li=Z(),dr=ii(),ai=li.process,si=li.Deno,oi=ai&&ai.versions||si&&si.version,ci=oi&&oi.v8,Q,yt;ci&&(Q=ci.split("."),yt=Q[0]>0&&Q[0]<4?1:+(Q[0]+Q[1]));!yt&&dr&&(Q=dr.match(/Edge\/(\d+)/),(!Q||Q[1]>=74)&&(Q=dr.match(/Chrome\/(\d+)/),Q&&(yt=+Q[1])));ui.exports=yt});var fr=p((yd,di)=>{"use strict";var hi=pi(),uc=G(),pc=Z(),hc=pc.String;di.exports=!!Object.getOwnPropertySymbols&&!uc(function(){var r=Symbol("symbol detection");return!hc(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&hi&&hi<41})});var mr=p((bd,fi)=>{"use strict";var dc=fr();fi.exports=dc&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var vr=p((gd,mi)=>{"use strict";var fc=vt(),mc=z(),vc=ei(),yc=mr(),bc=Object;mi.exports=yc?function(r){return typeof r=="symbol"}:function(r){var e=fc("Symbol");return mc(e)&&vc(e.prototype,bc(r))}});var yi=p((Cd,vi)=>{"use strict";var gc=String;vi.exports=function(r){try{return gc(r)}catch(e){return"Object"}}});var yr=p((Ed,bi)=>{"use strict";var Cc=z(),Ec=yi(),Ic=TypeError;bi.exports=function(r){if(Cc(r))return r;throw new Ic(Ec(r)+" is not a function")}});var Ci=p((Id,gi)=>{"use strict";var Tc=yr(),xc=lr();gi.exports=function(r,e){var t=r[e];return xc(t)?void 0:Tc(t)}});var Ii=p((Td,Ei)=>{"use strict";var br=ft(),gr=z(),Cr=ge(),Sc=TypeError;Ei.exports=function(r,e){var t,n;if(e==="string"&&gr(t=r.toString)&&!Cr(n=br(t,r))||gr(t=r.valueOf)&&!Cr(n=br(t,r))||e!=="string"&&gr(t=r.toString)&&!Cr(n=br(t,r)))return n;throw new Sc("Can't convert object to primitive value")}});var xi=p((xd,Ti)=>{"use strict";Ti.exports=!0});var Ai=p((Sd,wi)=>{"use strict";var Si=Z(),wc=Object.defineProperty;wi.exports=function(r,e){try{wc(Si,r,{value:e,configurable:!0,writable:!0})}catch(t){Si[r]=e}return e}});var bt=p((wd,Pi)=>{"use strict";var Ac=xi(),Rc=Z(),Oc=Ai(),Ri="__core-js_shared__",Oi=Pi.exports=Rc[Ri]||Oc(Ri,{});(Oi.versions||(Oi.versions=[])).push({version:"3.38.0",mode:Ac?"pure":"global",copyright:"\xA9 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.38.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var Er=p((Ad,Vi)=>{"use strict";var ki=bt();Vi.exports=function(r,e){return ki[r]||(ki[r]=e||{})}});var je=p((Rd,Mi)=>{"use strict";var Pc=ur(),kc=Object;Mi.exports=function(r){return kc(Pc(r))}});var Ce=p((Od,ji)=>{"use strict";var Vc=K(),Mc=je(),jc=Vc({}.hasOwnProperty);ji.exports=Object.hasOwn||function(e,t){return jc(Mc(e),t)}});var Ir=p((Pd,Ni)=>{"use strict";var Nc=K(),$c=0,Lc=Math.random(),_c=Nc(1 .toString);Ni.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+_c(++$c+Lc,36)}});var Ne=p((kd,Li)=>{"use strict";var Fc=Z(),qc=Er(),$i=Ce(),Bc=Ir(),Dc=fr(),Hc=mr(),Ee=Fc.Symbol,Tr=qc("wks"),Uc=Hc?Ee.for||Ee:Ee&&Ee.withoutSetter||Bc;Li.exports=function(r){return $i(Tr,r)||(Tr[r]=Dc&&$i(Ee,r)?Ee[r]:Uc("Symbol."+r)),Tr[r]}});var Bi=p((Vd,qi)=>{"use strict";var Gc=ft(),_i=ge(),Fi=vr(),zc=Ci(),Wc=Ii(),Kc=Ne(),Qc=TypeError,Yc=Kc("toPrimitive");qi.exports=function(r,e){if(!_i(r)||Fi(r))return r;var t=zc(r,Yc),n;if(t){if(e===void 0&&(e="default"),n=Gc(t,r,e),!_i(n)||Fi(n))return n;throw new Qc("Can't convert object to primitive value")}return e===void 0&&(e="number"),Wc(r,e)}});var xr=p((Md,Di)=>{"use strict";var Xc=Bi(),Zc=vr();Di.exports=function(r){var e=Xc(r,"string");return Zc(e)?e:e+""}});var Gi=p((jd,Ui)=>{"use strict";var Jc=Z(),Hi=ge(),Sr=Jc.document,el=Hi(Sr)&&Hi(Sr.createElement);Ui.exports=function(r){return el?Sr.createElement(r):{}}});var wr=p((Nd,zi)=>{"use strict";var tl=ce(),rl=G(),nl=Gi();zi.exports=!tl&&!rl(function(){return Object.defineProperty(nl("div"),"a",{get:function(){return 7}}).a!==7})});var Qi=p(Ki=>{"use strict";var il=ce(),al=ft(),sl=sr(),ol=or(),cl=Me(),ll=xr(),ul=Ce(),pl=wr(),Wi=Object.getOwnPropertyDescriptor;Ki.f=il?Wi:function(e,t){if(e=cl(e),t=ll(t),pl)try{return Wi(e,t)}catch(n){}if(ul(e,t))return ol(!al(sl.f,e,t),e[t])}});var Xi=p((Ld,Yi)=>{"use strict";var hl=G(),dl=z(),fl=/#|\.prototype\./,$e=function(r,e){var t=vl[ml(r)];return t===bl?!0:t===yl?!1:dl(e)?hl(e):!!e},ml=$e.normalize=function(r){return String(r).replace(fl,".").toLowerCase()},vl=$e.data={},yl=$e.NATIVE="N",bl=$e.POLYFILL="P";Yi.exports=$e});var Ar=p((_d,Ji)=>{"use strict";var Zi=ir(),gl=yr(),Cl=ke(),El=Zi(Zi.bind);Ji.exports=function(r,e){return gl(r),e===void 0?r:Cl?El(r,e):function(){return r.apply(e,arguments)}}});var ta=p((Fd,ea)=>{"use strict";var Il=ce(),Tl=G();ea.exports=Il&&Tl(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var na=p((qd,ra)=>{"use strict";var xl=ge(),Sl=String,wl=TypeError;ra.exports=function(r){if(xl(r))return r;throw new wl(Sl(r)+" is not an object")}});var sa=p(aa=>{"use strict";var Al=ce(),Rl=wr(),Ol=ta(),gt=na(),ia=xr(),Pl=TypeError,Rr=Object.defineProperty,kl=Object.getOwnPropertyDescriptor,Or="enumerable",Pr="configurable",kr="writable";aa.f=Al?Ol?function(e,t,n){if(gt(e),t=ia(t),gt(n),typeof e=="function"&&t==="prototype"&&"value"in n&&kr in n&&!n[kr]){var i=kl(e,t);i&&i[kr]&&(e[t]=n.value,n={configurable:Pr in n?n[Pr]:i[Pr],enumerable:Or in n?n[Or]:i[Or],writable:!1})}return Rr(e,t,n)}:Rr:function(e,t,n){if(gt(e),t=ia(t),gt(n),Rl)try{return Rr(e,t,n)}catch(i){}if("get"in n||"set"in n)throw new Pl("Accessors not supported");return"value"in n&&(e[t]=n.value),e}});var ca=p((Dd,oa)=>{"use strict";var Vl=ce(),Ml=sa(),jl=or();oa.exports=Vl?function(r,e,t){return Ml.f(r,e,jl(1,t))}:function(r,e,t){return r[e]=t,r}});var _e=p((Hd,ua)=>{"use strict";var Le=Z(),Nl=Pn(),$l=ir(),Ll=z(),_l=Qi().f,Fl=Xi(),Ie=mt(),ql=Ar(),Te=ca(),la=Ce();bt();var Bl=function(r){var e=function(t,n,i){if(this instanceof e){switch(arguments.length){case 0:return new r;case 1:return new r(t);case 2:return new r(t,n)}return new r(t,n,i)}return Nl(r,this,arguments)};return e.prototype=r.prototype,e};ua.exports=function(r,e){var t=r.target,n=r.global,i=r.stat,a=r.proto,o=n?Le:i?Le[t]:Le[t]&&Le[t].prototype,c=n?Ie:Ie[t]||Te(Ie,t,{})[t],s=c.prototype,l,m,y,b,C,S,E,v,R;for(b in e)l=Fl(n?b:t+(i?".":"#")+b,r.forced),m=!l&&o&&la(o,b),S=c[b],m&&(r.dontCallGetSet?(R=_l(o,b),E=R&&R.value):E=o[b]),C=m&&E?E:e[b],!(!l&&!a&&typeof S==typeof C)&&(r.bind&&m?v=ql(C,Le):r.wrap&&m?v=Bl(C):a&&Ll(C)?v=$l(C):v=C,(r.sham||C&&C.sham||S&&S.sham)&&Te(v,"sham",!0),Te(c,b,v),a&&(y=t+"Prototype",la(Ie,y)||Te(Ie,y,{}),Te(Ie[y],b,C),r.real&&s&&(l||!s[b])&&Te(s,b,C)))}});var ha=p((Ud,pa)=>{"use strict";var Dl=Math.ceil,Hl=Math.floor;pa.exports=Math.trunc||function(e){var t=+e;return(t>0?Hl:Dl)(t)}});var Fe=p((Gd,da)=>{"use strict";var Ul=ha();da.exports=function(r){var e=+r;return e!==e||e===0?0:Ul(e)}});var ma=p((zd,fa)=>{"use strict";var Gl=Fe(),zl=Math.min;fa.exports=function(r){var e=Gl(r);return e>0?zl(e,9007199254740991):0}});var qe=p((Wd,va)=>{"use strict";var Wl=ma();va.exports=function(r){return Wl(r.length)}});var Ct=p((Kd,ya)=>{"use strict";ya.exports=function(){}});var ba=p(()=>{"use strict";var Kl=_e(),Ql=je(),Yl=qe(),Xl=Fe(),Zl=Ct();Kl({target:"Array",proto:!0},{at:function(e){var t=Ql(this),n=Yl(t),i=Xl(e),a=i>=0?i:n+i;return a<0||a>=n?void 0:t[a]}});Zl("at")});var Et=p((Xd,ga)=>{"use strict";var Jl=vt();ga.exports=Jl});var Ea=p((Zd,Ca)=>{"use strict";ba();var eu=Et();Ca.exports=eu("Array","at")});var Ta=p((Jd,Ia)=>{"use strict";var tu=Ea();Ia.exports=tu});var Vr=p((ef,xa)=>{"use strict";var ru=Ta();xa.exports=ru});var qa=p((ym,Fa)=>{"use strict";var hu=Er(),du=Ir(),_a=hu("keys");Fa.exports=function(r){return _a[r]||(_a[r]=du(r))}});var Da=p((bm,Ba)=>{"use strict";var fu=G();Ba.exports=!fu(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var Ga=p((gm,Ua)=>{"use strict";var mu=Ce(),vu=z(),yu=je(),bu=qa(),gu=Da(),Ha=bu("IE_PROTO"),Dr=Object,Cu=Dr.prototype;Ua.exports=gu?Dr.getPrototypeOf:function(r){var e=yu(r);if(mu(e,Ha))return e[Ha];var t=e.constructor;return vu(t)&&e instanceof t?t.prototype:e instanceof Dr?Cu:null}});var Wa=p((Cm,za)=>{"use strict";var Eu=Fe(),Iu=Math.max,Tu=Math.min;za.exports=function(r,e){var t=Eu(r);return t<0?Iu(t+e,0):Tu(t,e)}});var Hr=p((Em,Qa)=>{"use strict";var xu=Me(),Su=Wa(),wu=qe(),Ka=function(r){return function(e,t,n){var i=xu(e),a=wu(i);if(a===0)return!r&&-1;var o=Su(n,a),c;if(r&&t!==t){for(;a>o;)if(c=i[o++],c!==c)return!0}else for(;a>o;o++)if((r||o in i)&&i[o]===t)return r||o||0;return!r&&-1}};Qa.exports={includes:Ka(!0),indexOf:Ka(!1)}});var Xa=p((Im,Ya)=>{"use strict";Ya.exports={}});var es=p((Tm,Ja)=>{"use strict";var Au=K(),Ur=Ce(),Ru=Me(),Ou=Hr().indexOf,Pu=Xa(),Za=Au([].push);Ja.exports=function(r,e){var t=Ru(r),n=0,i=[],a;for(a in t)!Ur(Pu,a)&&Ur(t,a)&&Za(i,a);for(;e.length>n;)Ur(t,a=e[n++])&&(~Ou(i,a)||Za(i,a));return i}});var rs=p((xm,ts)=>{"use strict";ts.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var is=p((Sm,ns)=>{"use strict";var ku=es(),Vu=rs();ns.exports=Object.keys||function(e){return ku(e,Vu)}});var us=p((wm,ls)=>{"use strict";var ss=ce(),Mu=G(),os=K(),ju=Ga(),Nu=is(),$u=Me(),Lu=sr().f,cs=os(Lu),_u=os([].push),Fu=ss&&Mu(function(){var r=Object.create(null);return r[2]=2,!cs(r,2)}),as=function(r){return function(e){for(var t=$u(e),n=Nu(t),i=Fu&&ju(t)===null,a=n.length,o=0,c=[],s;a>o;)s=n[o++],(!ss||(i?s in t:cs(t,s)))&&_u(c,r?[s,t[s]]:t[s]);return c}};ls.exports={entries:as(!0),values:as(!1)}});var ps=p(()=>{"use strict";var qu=_e(),Bu=us().values;qu({target:"Object",stat:!0},{values:function(e){return Bu(e)}})});var ds=p((Om,hs)=>{"use strict";ps();var Du=mt();hs.exports=Du.Object.values});var ms=p((Pm,fs)=>{"use strict";var Hu=ds();fs.exports=Hu});var Lt=p((km,vs)=>{"use strict";var Uu=ms();vs.exports=Uu});var gs=p(()=>{"use strict";var Gu=_e(),zu=Hr().includes,Wu=G(),Ku=Ct(),Qu=Wu(function(){return!Array(1).includes()});Gu({target:"Array",proto:!0,forced:Qu},{includes:function(e){return zu(this,e,arguments.length>1?arguments[1]:void 0)}});Ku("includes")});var Es=p((Lm,Cs)=>{"use strict";gs();var Yu=Et();Cs.exports=Yu("Array","includes")});var Ts=p((_m,Is)=>{"use strict";var Xu=Es();Is.exports=Xu});var _t=p((Fm,xs)=>{"use strict";var Zu=Ts();xs.exports=Zu});var Qr=p((av,Os)=>{"use strict";var ip=Ve();Os.exports=Array.isArray||function(e){return ip(e)==="Array"}});var ks=p((sv,Ps)=>{"use strict";var ap=TypeError,sp=9007199254740991;Ps.exports=function(r){if(r>sp)throw ap("Maximum allowed index exceeded");return r}});var js=p((ov,Ms)=>{"use strict";var op=Qr(),cp=qe(),lp=ks(),up=Ar(),Vs=function(r,e,t,n,i,a,o,c){for(var s=i,l=0,m=o?up(o,c):!1,y,b;l<n;)l in t&&(y=m?m(t[l],l,e):t[l],a>0&&op(y)?(b=cp(y),s=Vs(r,e,y,b,s,a-1)-1):(lp(s+1),r[s]=y),s++),l++;return s};Ms.exports=Vs});var Ls=p((cv,$s)=>{"use strict";var pp=Ne(),hp=pp("toStringTag"),Ns={};Ns[hp]="z";$s.exports=String(Ns)==="[object z]"});var Fs=p((lv,_s)=>{"use strict";var dp=Ls(),fp=z(),qt=Ve(),mp=Ne(),vp=mp("toStringTag"),yp=Object,bp=qt(function(){return arguments}())==="Arguments",gp=function(r,e){try{return r[e]}catch(t){}};_s.exports=dp?qt:function(r){var e,t,n;return r===void 0?"Undefined":r===null?"Null":typeof(t=gp(e=yp(r),vp))=="string"?t:bp?qt(e):(n=qt(e))==="Object"&&fp(e.callee)?"Arguments":n}});var Bs=p((uv,qs)=>{"use strict";var Cp=K(),Ep=z(),Yr=bt(),Ip=Cp(Function.toString);Ep(Yr.inspectSource)||(Yr.inspectSource=function(r){return Ip(r)});qs.exports=Yr.inspectSource});var Ws=p((pv,zs)=>{"use strict";var Tp=K(),xp=G(),Ds=z(),Sp=Fs(),wp=vt(),Ap=Bs(),Hs=function(){},Us=wp("Reflect","construct"),Xr=/^\s*(?:class|function)\b/,Rp=Tp(Xr.exec),Op=!Xr.test(Hs),Xe=function(e){if(!Ds(e))return!1;try{return Us(Hs,[],e),!0}catch(t){return!1}},Gs=function(e){if(!Ds(e))return!1;switch(Sp(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Op||!!Rp(Xr,Ap(e))}catch(t){return!0}};Gs.sham=!0;zs.exports=!Us||xp(function(){var r;return Xe(Xe.call)||!Xe(Object)||!Xe(function(){r=!0})||r})?Gs:Xe});var Xs=p((hv,Ys)=>{"use strict";var Ks=Qr(),Pp=Ws(),kp=ge(),Vp=Ne(),Mp=Vp("species"),Qs=Array;Ys.exports=function(r){var e;return Ks(r)&&(e=r.constructor,Pp(e)&&(e===Qs||Ks(e.prototype))?e=void 0:kp(e)&&(e=e[Mp],e===null&&(e=void 0))),e===void 0?Qs:e}});var Js=p((dv,Zs)=>{"use strict";var jp=Xs();Zs.exports=function(r,e){return new(jp(r))(e===0?0:e)}});var eo=p(()=>{"use strict";var Np=_e(),$p=js(),Lp=je(),_p=qe(),Fp=Fe(),qp=Js();Np({target:"Array",proto:!0},{flat:function(){var e=arguments.length?arguments[0]:void 0,t=Lp(this),n=_p(t),i=qp(t,0);return i.length=$p(i,t,t,n,0,e===void 0?1:Fp(e)),i}})});var to=p(()=>{"use strict";var Bp=Ct();Bp("flat")});var no=p((bv,ro)=>{"use strict";eo();to();var Dp=Et();ro.exports=Dp("Array","flat")});var ao=p((gv,io)=>{"use strict";var Hp=no();io.exports=Hp});var oo=p((Cv,so)=>{"use strict";var Up=ao();so.exports=Up});var yn="1.0.31-dev.684e92f5.0";function Qt(r,e=1){let t="0",n="0",i="0";return r.length===4?(t="0x"+r[1]+r[1],n="0x"+r[2]+r[2],i="0x"+r[3]+r[3]):r.length===7&&(t="0x"+r[1]+r[2],n="0x"+r[3]+r[4],i="0x"+r[5]+r[6]),`rgba(${+t},${+n},${+i},${e})`}var D="interactive",Bo="interactive-controls-container",nt=()=>document.querySelector(`.${Bo}`),bn=.4,F={textColor:"#000",textSize:.4,textContent:"",roundCorners:0,borderWidth:0,borderColor:"#000",borderAlpha:1,backgroundColor:"#fff",backgroundAlpha:1,innerSizesDependOn:"self",angle:0},gn=(n=>(n.top="flex-start",n.bottom="flex-end",n.center="center",n))(gn||{}),Cn=(n=>(n.start="flex-start",n.end="flex-end",n.center="center",n))(Cn||{}),En=(n=>(n.start="left",n.end="right",n.center="center",n))(En||{}),it=({target:r,props:e})=>{var t,n,i;r.style.alignItems=(t=(e==null?void 0:e.gravityVertical)&&gn[e.gravityVertical])!=null?t:"center",r.style.justifyContent=(n=(e==null?void 0:e.gravityHorizontal)&&Cn[e.gravityHorizontal])!=null?n:"center",r.style.textAlign=(i=(e==null?void 0:e.alignment)&&En[e.alignment])!=null?i:"center"},at=({target:r,props:e,fallback:t,dependsOn:n})=>{var i,a,o,c,s,l;r.style.color=(a=(i=e==null?void 0:e.text)==null?void 0:i.color)!=null?a:t.textColor,r.style.fontSize=`calc(${n.height} * ${(c=(o=e==null?void 0:e.text)==null?void 0:o.size)!=null?c:t.textSize})`,r.textContent=(l=(s=e==null?void 0:e.text)==null?void 0:s.value)!=null?l:t.textContent},st=({target:r,props:e,fallback:t})=>{var n,i,a,o;r.style.backgroundColor=Qt((i=(n=e==null?void 0:e.background)==null?void 0:n.color)!=null?i:t.backgroundColor,(o=(a=e==null?void 0:e.background)==null?void 0:a.alpha)!=null?o:t.backgroundAlpha)},ot=({target:r,props:e,fallback:t,dependsOn:n})=>{var i,a,o,c,s,l,m,y,b,C,S;r.style.border=`calc(${n.height} * ${(o=(a=(i=e==null?void 0:e.shape)==null?void 0:i.border)==null?void 0:a.width)!=null?o:t.borderWidth}) solid ${Qt((l=(s=(c=e==null?void 0:e.shape)==null?void 0:c.border)==null?void 0:s.color)!=null?l:t.borderColor,(b=(y=(m=e==null?void 0:e.shape)==null?void 0:m.border)==null?void 0:y.alpha)!=null?b:t.borderAlpha)}`,r.style.borderRadius=`calc(${n.height} * ${(S=(C=e==null?void 0:e.shape)==null?void 0:C.roundCorners)!=null?S:t.roundCorners})`},ye=({target:r,layoutParams:e,fallback:t})=>{var i;let n=(i=e.angle)!=null?i:t.angle;n=n&&n*-1,r.style.transform=`rotate(${n}rad)`};var re=class{constructor(e){this.control=e;this.container=null;this.controlElement=null;this.clickListener=null}createContainerElement(e){var i;let t=document.createElement("div");t.classList.add(`${D}-control-container-${this.control.id}`),e(t,this.control.layoutParams);let n=((i=this.control.layoutParams.innerSizesDependOn)!=null?i:F.innerSizesDependOn)==="self"?{height:t.style.height,width:t.style.width}:{height:"var(--interactive-content-height)",width:"var(--interactive-content-width)"};this.container={element:t,dimensions:n}}createClickListener(e){return t=>{t.stopPropagation(),e()}}setEvents(e){!this.container||!this.control.events||this.control.events.forEach(t=>{var i;switch(t.type.trim().toLowerCase()){case"onclick":this.clickListener=this.createClickListener(()=>e({action:t.action,controlId:this.control.id,controlType:this.control.type})),(i=this.container)==null||i.element.addEventListener("click",this.clickListener);break;default:break}})}removeListeners(){var e,t;(e=this.container)!=null&&e.element&&this.clickListener&&((t=this.container)==null||t.element.removeEventListener("click",this.clickListener))}};var Yt="int",oe=(n=>(n.AREA=`${Yt}_area`,n.TEXT=`${Yt}_text`,n.BUTTON=`${Yt}_bttn`,n))(oe||{});var ct=r=>{if(r.type.trim().toLowerCase()==="area")return new Xt(r)},Xt=class extends re{constructor(e){super(e)}createView({parentElement:e,layoutCallback:t}){if(super.createContainerElement(t),!this.container)return;let n=document.createElement("button");n.type="button",n.classList.add(`${D}-${this.control.id}`),n.setAttribute("data-testid",oe.AREA),n.style.display="flex",n.style.width="100%",n.style.height="100%",n.style.cursor="pointer",st({target:n,props:this.control.props,fallback:x(d({},F),{backgroundColor:"transparent"})}),ot({target:n,props:this.control.props,fallback:x(d({},F),{borderAlpha:0}),dependsOn:this.container.dimensions}),ye({target:n,layoutParams:this.control.layoutParams,fallback:F}),this.container.element.append(n),e.append(this.container.element),this.controlElement=n}disable(){this.controlElement&&(this.controlElement.style.cursor="default")}enable(){this.controlElement&&(this.controlElement.style.cursor="pointer")}getElement(){return this.controlElement}};var lt=r=>{let e=document.createElement("span");switch(r){case"Button":case"button":{let t=document.createElement("div"),n={overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center"};Object.assign(t.style,n),t.append(e);let i={display:"inline-block",whiteSpace:"pre",textOverflow:"ellipsis",maxWidth:"initial",maxHeight:"100%",wordBreak:"normal"};return Object.assign(e.style,i),t}default:{let t={display:"inline-block",whiteSpace:"break-spaces",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",maxHeight:"100%",wordBreak:"break-all"};return Object.assign(e.style,t),e}}};var ut=r=>{if(r.type.trim().toLowerCase()==="button")return new Zt(r)},Zt=class extends re{constructor(e){super(e)}createView({parentElement:e,layoutCallback:t}){var o;if(super.createContainerElement(t),!this.container)return;let n=document.createElement("button");n.type="button",n.classList.add(`${D}-${this.control.id}`),n.setAttribute("data-testid",oe.BUTTON),n.style.display="flex",n.style.width="100%",n.style.height="100%",n.style.cursor="pointer",n.style.fontFamily="inherit",ye({target:n,layoutParams:this.control.layoutParams,fallback:F}),st({target:n,props:this.control.props,fallback:F}),ot({target:n,props:this.control.props,fallback:F,dependsOn:this.container.dimensions}),it({target:n,props:x(d({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let i=lt(this.control.type.trim().toLowerCase()),a=(o=i.firstElementChild)!=null?o:i;at({target:a,props:this.control.props,fallback:F,dependsOn:this.container.dimensions}),n.append(i),this.container.element.append(n),e.append(this.container.element),this.controlElement=n}disable(){this.controlElement&&(this.controlElement.style.cursor="default")}enable(){this.controlElement&&(this.controlElement.style.cursor="pointer")}getElement(){return this.controlElement}};var In=r=>{if(r.type.trim().toLowerCase()==="text")return new Jt(r)},Jt=class extends re{constructor(e){super(e)}createView({parentElement:e,layoutCallback:t}){var o;if(super.createContainerElement(t),!this.container)return;let n=document.createElement("div");n.classList.add(`${D}-${this.control.id}`),n.setAttribute("data-testid",oe.TEXT),n.style.display="flex",n.style.width="100%",n.style.height="100%",n.style.fontFamily="inherit",ye({target:n,layoutParams:this.control.layoutParams,fallback:F}),it({target:n,props:x(d({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let i=lt(this.control.type.trim().toLowerCase()),a=(o=i.firstElementChild)!=null?o:i;at({target:a,props:this.control.props,fallback:F,dependsOn:this.container.dimensions}),n.append(i),this.container.element.append(n),e.append(this.container.element),this.controlElement=n}disable(){}enable(){}getElement(){return this.controlElement}};var er=class{constructor(e){this.layout=e}},pt=class extends er{constructor(e){super(e)}setContainerLayout(e){e.style.position="relative"}setControlLayout(e,t){e.style.position="absolute",e.style.width=`calc(var(--interactive-content-width) * ${t.width})`,e.style.height=`calc(var(--interactive-content-height) * ${t.height})`,e.style.left=`calc(var(--interactive-content-width) * ${t.x} + ((var(--interactive-width) - var(--interactive-content-width)) / 2))`,e.style.top=`calc(var(--interactive-content-height) * ${t.y} + ((var(--interactive-height) - var(--interactive-content-height)) / 2))`}};var be=class{constructor(e){this.container=e,this.factories=new Map,this.controls=[],this.setControls()}addControlFactory(e,t){this.factories.set(e.trim().toLowerCase(),t),this.setControls()}removeControlFactory(e){this.factories.delete(e.trim().toLowerCase()),this.setControls()}setControls(){this.controls=this.chooseControls()}chooseControls(){var e;return((e=this.container.controls)==null?void 0:e.reduce((t,n)=>{let i=n.type.trim().toLowerCase(),a=this.factories.get(i);if(a){let o=a(n);if(o)return[...t,o]}return[...t]},[]))||[]}};var ht=(r,e)=>{if(r.type.trim().toLowerCase()==="choice")return new tr(r,e)},tr=class extends be{constructor(e,t){super(e),this.rootElement=t!=null?t:nt(),this.layout=new pt(this.container.layout),this.isRemoved=!1,this.isDisabled=!1,this.addControlFactory("button",ut),this.addControlFactory("text",In),this.addControlFactory("area",ct)}createView(e){let t=document.createElement("div");return t.classList.add(`${D}-${this.container.id}`),this.layout.setContainerLayout(t),this.controls.forEach(n=>{n.createView({parentElement:t,layoutCallback:this.layout.setControlLayout}),n.setEvents(e)}),this.rootElement.append(t),this.isRemoved=!1,t}hide(){let e=this.getElement();e&&(e.style.visibility="hidden")}show(){let e=this.getElement();e&&(e.style.visibility="visible")}enable(){let e=this.getElement();e&&(this.controls.forEach(t=>t.enable()),e.style.opacity="1",this.isDisabled=!1)}disable(){let e=this.getElement();e&&(this.controls.forEach(t=>t.disable()),e.style.opacity=`${bn}`,this.isDisabled=!0)}removeView(e=!1){var t;(!this.isRemoved||e)&&(this.controls.forEach(n=>n.removeListeners()),(t=this.getElement())==null||t.remove(),this.isRemoved=!0)}fakeRemove(){this.isRemoved||(this.isRemoved=!0)}getElement(){return this.rootElement.querySelector(`.${D}-${this.container.id}`)}};var Vo=te(Vr(),1);import{clientChecker as th,combine as rh,InterfaceLanguage as nh,Observable as Oo,once as ih,Subject as q,Subscription as nn,ValueSubject as H,fromEvent as Po}from"@vkontakte/videoplayer-shared/es2015";import{InteractiveInterfaceClick as et}from"@vkontakte/videoplayer-statistics/es2015";import{loadVKLangPack as nu}from"@vkontakte/videoplayer-shared/es2015";function Be(r,e){let t;return(...n)=>{clearTimeout(t),t=setTimeout(()=>r(...n),e)}}var le=(r,e)=>Object.prototype.toString.call(r)===`[object ${e}]`,De=r=>le(r,"Object"),It=r=>le(r,"String"),Tt=r=>le(r,"Array"),xt=r=>le(r,"Number"),Sa=r=>le(r,"Function");var Mr=r=>xt(r)&&!isNaN(r);var ue=r=>De(r)&&Object.keys(r).length===0,jr=r=>Tt(r)&&!r.length;var He=(r,e)=>It(r)&&(e?r.trim():r).length;var wa="video_interactive",Aa="videoint";var Ra=250,Ue=class{constructor(e){this.handleZoomChange=Be(e=>{this.lastZoomInfo=e},Ra);this.onResize=e=>{var n;if(!this.isReady||this.isHidden||!e[0].contentRect.width||!e[0].contentRect.height)return;let t=this.getNextPoint();t&&((n=this.ngEditor)==null||n.zoomTo(t)),this.ngEditorSize={width:e[0].contentRect.width,height:e[0].contentRect.height}};this.handleChapterChange=e=>{var t,n,i;if(this.manifest){if(this.isHidden||this.hide(),!(e!=null&&e.id)){(t=this.onError)==null||t.call(this,"Id is not found"),console.error("Id is not found");return}this.visitedChapterIds.add(e.id),(n=this.ngEditor)==null||n.selectChapter(e.id),(i=this.ngEditor)==null||i.setVisitedChapters(Array.from(this.visitedChapterIds)),this.currentChapterId=e.id,this.lastZoomInfo=null}};this.handleManifestChange=(e,t=[])=>{var n;if(this.isReady=!1,!xt(e.graph.edit.chapters[0].x)){(n=this.onError)==null||n.call(this,"Can't show graph"),console.error("Can't show graph");return}this.lastZoomInfo=null,this.manifest=e,this.visitedChapterIds=new Set(t),this.ngEditor&&(this.manifest.metadata.id!==this.currentManifestId?(this.ngEditor.update(e),this.currentManifestId=this.manifest.metadata.id):this.ngEditor.setVisitedChapters(Array.from(t)),this.isReady=!0)};this.init(e)}init({root:e,onOpenPreviewClick:t,onError:n,lang:i,visitedChapters:a=[]}){this.isReady=!1,this.isHidden=!0,this.manifest=null,this.visitedChapterIds=new Set(a),this.onOpenPreviewClick=t,this.onError=n,this.lang=i!=null?i:"ru",this.zoom=.7,this.lastZoomInfo=null,this.currentManifestId=null,this.currentChapterId=null,this.ngEditor=null,this.ngEditorSize=null,this.graphWrapperElement=iu(e),this.resizeObserver=new ResizeObserver(Be(this.onResize,Ra)),this.resizeObserver.observe(this.graphWrapperElement)}getNextPoint(e=this.ngEditorSize){return!this.lastZoomInfo||!e?null:[(this.lastZoomInfo.x-e.width/2)/this.lastZoomInfo.value*-1,(this.lastZoomInfo.y-e.height/2)/this.lastZoomInfo.value*-1]}setVisitedChapters(e){var t;this.visitedChapterIds=new Set([...this.visitedChapterIds,...e]),(t=this.ngEditor)==null||t.setVisitedChapters(Array.from(this.visitedChapterIds))}updateVideosInfo(e){var t;(t=this.ngEditor)==null||t.updateVideosInfo(e)}show(){return P(this,null,function*(){var e;this.manifest&&(this.ngEditor||(yield this.initNgEditor()),this.graphWrapperElement.style.display="block",!this.lastZoomInfo&&this.currentChapterId&&((e=this.ngEditor)==null||e.focusChapter(this.currentChapterId)),this.isHidden=!1)})}initNgEditor(){return P(this,null,function*(){if(!this.manifest)return;let e;try{e=yield nu(this.lang,wa,Aa)}catch(n){console.log("Unable to load graph language pack")}let{GraphEditor:t}=yield import("@interactiveplatform/movika-graph-editor");this.ngEditor=new t(this.graphWrapperElement,{mode:"read",lang:this.lang==="ru"?"ru":"en",translation:e}),this.currentManifestId=this.manifest.metadata.id,this.ngEditor.update(this.manifest),this.ngEditor.setVisitedChapters(Array.from(this.visitedChapterIds)),this.currentChapterId&&this.ngEditor.selectChapter(this.currentChapterId),this.ngEditor.on("control",a=>{var o=a,{name:n}=o,i=X(o,["name"]);var c;n==="openPreview"&&"chapterId"in i&&((c=this.onOpenPreviewClick)==null||c.call(this,i.chapterId))}),this.ngEditor.on("zoom",this.handleZoomChange),this.isReady=!0})}hide(){this.graphWrapperElement.style.display="none",this.isHidden=!0}destroy(){var e,t;this.hide(),this.manifest=null,this.resizeObserver.disconnect(),(e=this.ngEditor)==null||e.setVisitedChapters([]),this.onOpenPreviewClick=void 0,(t=this.ngEditor)==null||t.dispose(),this.graphWrapperElement.remove(),this.isReady=!1}};function iu(r){let e=document.createElement("div");return e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.height="100%",e.style.width="100%",e.style.display="none",r.append(e),e}var Ge=class{constructor(){this._containers=[];this._player=null;this.setPlayer=e=>{this._player=e};this.setContainers=e=>{this._containers=e};this.deleteContainer=e=>{this._containers=this._containers.filter(t=>t.id!==e)};this.getNextInteractiveTime=(e=3e3)=>{if(!this._containers.length||this._player===null)return null;let t=-1,n=!1,i=Math.round(this._player.info.position$.getValue()*1e3);for(let a of this._containers){let o=a.startTime-e;if(o<=i&&(a.endTime&&i<=a.endTime||a.endTime===null)){n=!0;break}i<o&&(t=t===-1?o:Math.min(t,o))}return!n&&t!==-1?t:null}}};import{isSupportedManifest as wt,ContainerTypes as Af,ControlTypes as At,EventActionTypes as V,EventTypes as Rf,migrateManifestToLatestVersion as Va,compareVersions as Of}from"@interactiveplatform/movika-manifest";var Oa={metadata:"Object",chapters:"Array"},Pa=r=>{if(!De(r))return!1;for(let e in Oa)if(!r[e]||!le(r[e],Oa[e]))return!1;return wt(r.metadata.version)},St=r=>r.type===At.Text,gf=r=>r.type===At.Button,Cf=r=>r.type===At.Area,Ef={Choice:"Choice",TextInput:"TextInput"},If={Button:"Button",Area:"Area",Text:"Text"},Tf={onClick:"onClick",onSuspense:"onSuspense"},ka={openURI:"openURI",setNextBranch:"setNextBranch",setWeightlessRandomBranch:"setWeightlessRandomBranch",setRandomBranch:"setRandomBranch",setMaxWeightBranch:"setMaxWeightBranch",setMinWeightBranch:"setMinWeightBranch",setDefaultBranch:"setDefaultBranch",continuePlayback:"continuePlayback",expect:"expect"};var _=class{constructor(e,t,...n){this.severity=e;this.category=t;this.data=n}toString(){return`Interactive SDK error ${JSON.stringify(this,null," ")}`}};var Rt=class{constructor(){this.listeners={}}addListener(e,t){return this.listeners[e]=this.listeners[e]||[],this.listeners[e].push(t),this}on(e,t){return this.addListener(e,t)}once(e,t){this.listeners[e]=this.listeners[e]||[];let n=()=>{t(),this.off(e,n)};return this.listeners[e].push(n),this}off(e,t){return this.removeListener(e,t)}reset(){this.listeners={}}removeListener(e,t){let n=this.listeners[e]||[];for(let i=n.length;i>0;i--)if(n[i]===t){n.splice(i,1);break}return this}emit(e,...t){let n=this.listeners[e];return n?(n.forEach(i=>{i(...t)}),!0):!1}listenerCount(e){return this.rawListeners(e).length}rawListeners(e){return this.listeners[e]||[]}};var Ot=class{constructor(e){this.fns=[];this.addFn=(e,t=!1)=>{Sa(e)&&(this.fns.push(e),t&&this.updateFn())};this.removeFn=(e,t=!1)=>{this.fns=this.fns.filter(n=>n!==e),t&&this.updateFn()};this.updateFn=()=>{this.fn=()=>{this.fns.forEach(e=>e()),this.raf&&this.forceRequestAnimation()}};this.forceRequestAnimation=()=>{this.fn&&(this.raf=requestAnimationFrame(this.fn))};this.requestAnimation=()=>{this.raf||this.forceRequestAnimation()};this.cancelAnimation=()=>{this.raf&&(cancelAnimationFrame(this.raf),this.raf=void 0)};e&&(this.fn=e,this.addFn(e))}release(){this.cancelAnimation(),this.fn=void 0,this.fns=[]}};import{ValueSubject as pu}from"@vkontakte/videoplayer-shared/es2015";var Pt=class{constructor(e){var t,n;this.loaders={chapterLoaders:(t=e==null?void 0:e.chapterLoaders)!=null?t:[],manifestLoaders:(n=e==null?void 0:e.manifestLoaders)!=null?n:[]}}exec(e,t){return P(this,null,function*(){return au(...this.loaders[e])(t)})}};function au(...r){return function(t){return P(this,null,function*(){let n=[...r];for(;n.length>0;)t=yield n.shift()(t);return t})}}function ze(r,e,t){return r?x(d({},r),{[e]:r[e]?[t,...r[e]]:[t]}):{[e]:[t]}}function kt(i){var a=i,{actions:r,errors:e,chapterId:t}=a,n=X(a,["actions","errors","chapterId"]);if(t){let o=r.getManifest();if(o){let c=r.getChapter(o.chapters,t);if(c){let s=r.getMedia(o.media,c.videoId),l=r.getGraph(o.graph,c.id);return s?x(d({},n),{actions:r,errors:e,result:{chapter:c,media:s,graph:l}}):x(d({},n),{errors:ze(e,kt.name,"Could not find media"),actions:r})}}}return x(d({},n),{errors:ze(e,kt.name,"Could not find chapter"),actions:r})}var Vt=class{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(e,t,n){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:t,options:n})}removeEventListener(e,t){if(!(e in this.listeners))return;let n=this.listeners[e];for(let i=0,a=n.length;i<a;i++)if(n[i].callback===t){n.splice(i,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let n=this.listeners[e.type].slice();for(let i=0,a=n.length;i<a;i++){let o=n[i];try{o.callback.call(this,e)}catch(c){Promise.resolve().then(()=>{throw c})}o.options&&o.options.once&&this.removeEventListener(e.type,o.callback)}return!e.defaultPrevented}},xe=class extends Vt{constructor(){super(),this.listeners||Vt.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(e){e.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,e)),super.dispatchEvent(e)}},We=class{constructor(){Object.defineProperty(this,"signal",{value:new xe,writable:!0,configurable:!0})}abort(e){let t;try{t=new Event("abort")}catch(i){typeof document!="undefined"?document.createEvent?(t=document.createEvent("Event"),t.initEvent("abort",!1,!1)):(t=document.createEventObject(),t.type="abort"):t={type:"abort",bubbles:!1,cancelable:!1}}let n=e;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(i){n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(t)}toString(){return"[object AbortController]"}};typeof Symbol!="undefined"&&Symbol.toStringTag&&(We.prototype[Symbol.toStringTag]="AbortController",xe.prototype[Symbol.toStringTag]="AbortSignal");function Mt(r){return r.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof r.Request=="function"&&!r.Request.prototype.hasOwnProperty("signal")||!r.AbortController}function Nr(r){typeof r=="function"&&(r={fetch:r});let{fetch:e,Request:t=e.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=r;if(!Mt({fetch:e,Request:t,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i}))return{fetch:e,Request:a};let a=t;(a&&!a.prototype.hasOwnProperty("signal")||i)&&(a=function(l,m){let y;m&&m.signal&&(y=m.signal,delete m.signal);let b=new t(l,m);return y&&Object.defineProperty(b,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),b},a.prototype=t.prototype);let o=e;return{fetch:(s,l)=>{let m=a&&a.prototype.isPrototypeOf(s)?s.signal:l?l.signal:void 0;if(m){let y;try{y=new DOMException("Aborted","AbortError")}catch(C){y=new Error("Aborted"),y.name="AbortError"}if(m.aborted)return Promise.reject(y);let b=new Promise((C,S)=>{m.addEventListener("abort",()=>S(y),{once:!0})});return l&&l.signal&&delete l.signal,Promise.race([b,o(s,l)])}return o(s,l)},Request:a}}var Ke=Mt({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),Ma=Ke?Nr({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,$r=Ke?Ma.fetch:window.fetch,Kf=Ke?Ma.Request:window.Request,Qf=Ke?We:window.AbortController,Yf=Ke?xe:window.AbortSignal;var Lr=(r="",e="")=>{let t=r.split("."),n=e.split("."),i=0;for(let a=0;a<Math.max(t.length,n.length)&&!i;a++)t[a]>n[a]?i=1:t[a]<n[a]?i=-1:i=0;return i};var su=r=>P(void 0,null,function*(){try{let e={},t;if(It(r)){t=new URL(r).href;let i=yield $r(t);if(!i.ok)return{};e=yield i.json()}else if(De(r))e=r;else return{};if(!Pa(e))return{};let n=e.metadata.media;if(It(n)&&!("media"in e))try{let i;t?i=new URL(n,t).href:(i=new URL(n).href,t=i);let a=yield $r(i);if(!a.ok)throw new Error;e.metadata.media=yield a.json()}catch(i){return lu(e.metadata.version)?{manifest:e}:{}}return{manifest:e,manifestURL:t}}catch(e){return{}}});function ja(r){return P(this,null,function*(){let{manifest:e,manifestURL:t}=yield su(r);if(!e)throw new Error("Failed on fetch");let n=Va(e);return n.media=ou(n.media,t),delete n.metadata.media,n})}function jt(r,e){if(e)return r.find(t=>t.id===e)}function _r(r,e){var t,n;return(t=r.edit)!=null&&t.chapters?r.edit.chapters.find(i=>i.id===e):(n=r.view)!=null&&n.chapters?r.view.chapters.find(i=>i.id===e):void 0}function Fr(r,e){return r.videos.find(t=>t.id===e)}function ou(r,e){return x(d({},r),{videos:r.videos.map(t=>x(d({},t),{variants:t.variants.map(n=>{let i="url"in n?n.url:"",a=cu(i,e);return x(d({},n),{url:a||i})})}))})}function cu(r="",e){try{return new URL(r,e).href}catch(t){return""}}function lu(r){return Lr(r,"3.2.0")>=0}var Nt=r=>Tt(r)&&!jr(r),J=r=>r.order==="end",$t=r=>Tt(r.containers)&&!jr(r.containers)&&J(r),Na=(r,e)=>{var n;let t=r*1e3;return Nt(e.controls)&&t<((n=e.startTime)!=null?n:0)},qr=(r,e)=>{var n,i;let t=r*1e3;return Nt(e.controls)&&t>=((n=e.startTime)!=null?n:0)&&t<=((i=e.endTime)!=null?i:1/0)};var pe=(r=[])=>r.some(e=>e.action.type==="expect"),Br=(r=[])=>r.find(e=>e.action.type==="expect"),uu=r=>(r==null?void 0:r.length)===1,Se=r=>uu(r)&&St(r[0]);function $a(r,...e){return t=>typeof e[0]=="object"&&typeof t=="object"?r(d(d({},e[0]),t)):r(...e,...t)}var La=(r,e)=>{let t=E=>{let v=e.find(({container:R})=>R.container.id===E);return v==null?void 0:v.container.isRemoved},n=pe(r.events)&&!t(r.id),i=(E,v=!1,R=!1)=>{let h=R?"every":"some";return E.controls[h](u=>{var I;let f=v?E.endTime===r.endTime:!0;return((I=u.events)==null?void 0:I[h](T=>{var g;return((g=T.action)==null?void 0:g.type)===ka.openURI}))&&f})},a=E=>E.some(({container:v})=>i(v.container,!0,!1)&&!v.isRemoved),o=E=>E.every(({container:v})=>v.isRemoved?!0:i(v.container,!0,!0)),c=e.filter(({container:E})=>E.container.id!==r.id&&pe(E.container.events)&&E.container.endTime===r.endTime&&!E.isRemoved).length,s=E=>E.controls.some(v=>{var R;return(R=v.events)==null?void 0:R.some(h=>{var u,f;return(f=(u=h.action)==null?void 0:u.args)==null?void 0:f.shouldOpenNow})}),l=n||c>0,m=a(e),y=i(r),b=o(e),C=n?!1:c>0,S=s(r);return{isExpectTime:l,hasOtherExpect:c>0,hasOpenURIEvent:m,hasOpenURIEventInCurrentContainer:y,isAllOpenURIEventsValid:b,isExpectEventForCurrentContainer:C,hasShouldOpenNowEvent:S}};var we=class extends Pt{constructor(t,n){super(t);this.manifest=null;this.chapter=null;this.media=null;this.graph=null;this.prevChapter$=new pu(null);this.onError=n,this.release()}release(){return this.manifest=null,this.chapter=null,this.media=null,this.graph=null,this.prevChapter$.next(null),this}setManifest(t){return P(this,null,function*(){var i;this.release();let n=yield this.exec("manifestLoaders",{actions:{addErrorMessage:ze},result:null,errors:null,source:t});return n.errors&&this.errorHandler(n.errors),this.manifest=yield ja((i=n.result)!=null?i:t),this})}setInitial(){return P(this,null,function*(){return this.setNext()})}setNext(){return P(this,arguments,function*(t=(n=>(n=this.manifest)==null?void 0:n.metadata.initChapterId)()){if(!t)return this;this.prevChapter$.next(this.chapter);let i=yield this.exec("chapterLoaders",kt({actions:{getManifest:()=>this.manifest,getCurrent:this.getCurrent,getGraph:_r,getChapter:jt,getMedia:Fr,getByBranches:this.getByBranches.bind(this),addErrorMessage:ze},result:null,errors:null,chapterId:t}));return i.errors&&this.errorHandler(i.errors),i.result&&(this.chapter=i.result.chapter,this.media=i.result.media,this.graph=i.result.graph),this})}errorHandler(t){this.onError(t),console.error("Something went wrong with loaders",{errors:t})}getInitial(){var n;return this.getByChapterId((n=this.manifest)==null?void 0:n.metadata.initChapterId)||null}getByChapterId(t=(n=>(n=this.manifest)==null?void 0:n.metadata.initChapterId)()){if(!t||!this.manifest)return null;let i=jt(this.manifest.chapters,t);if(i){let a=Fr(this.manifest.media,i.videoId),o=_r(this.manifest.graph,i.id);if(a)return{chapter:i,media:a,graph:o}}return null}getBranches(t=(n=>(n=this.chapter)==null?void 0:n.id)()){var i,a,o;if(t===((i=this.chapter)==null?void 0:i.id))return this.getByBranches((a=this.chapter)==null?void 0:a.branches);{let c=jt(((o=this.manifest)==null?void 0:o.chapters)||[],t);return this.getByBranches(c==null?void 0:c.branches)}}getByBranches(t=[]){return t.reduce((n,i)=>{let a=this.getByChapterId(i.chapterId);return a&&n.push(a),n},[])}getCurrent(){return{chapter:this.chapter,media:this.media,graph:this.graph}}isInitialChapter(){var t,n;return((t=this.chapter)==null?void 0:t.id)===((n=this.manifest)==null?void 0:n.metadata.initChapterId)}isEndChapter(){return this.chapter?J(this.chapter):!1}};var Ss=te(Lt(),1);import{Player as Ju}from"@vkontakte/videoplayer-core/es2015";import{Subscription as Wr,Tracer as ep,ValueSubject as tp}from"@vkontakte/videoplayer-shared/es2015";var ys=r=>{let e=r.variants.find(t=>{var n;return((n=t.payload)==null?void 0:n.type)==="vk"});if(e&&e.payload){let[t,n]=e.payload.id.split("_");return[t,n]}return[]};var bs=te(Lt(),1);function Gr(){let r=new Map;function e(s){var l=s,{listId:a=Math.random().toString(),itemId:o=Math.random().toString()}=l,c=X(l,["listId","itemId"]);let m=r.get(a),y=d({},c);return m?m[o]=y:r.set(a,{[o]:y}),d({listId:a,itemId:o},c)}function t(a){var o,c;a.player.destroy(),a.container.remove(),a.subscription.unsubscribe(),(o=a.statistics)==null||o.oneStat.destroy(),(c=a.statistics)==null||c.statSubscription.unsubscribe()}function n(a,o){let c=r.get(a);if(!c)throw Error("Can't remove. Not find.");if(o){let s=c[o];s&&t(s),delete c[o],Object.keys(c).length||r.delete(a)}else{for(let s of(0,bs.default)(c))t(s);r.delete(a)}}function i(){for(let a of r)n(a[0])}return{createPlayer:e,removePlayer:n,map:r,removeAll:i}}var Ae=te(_t(),1);function zr(r,e=[]){var a,o,c;let t={},n,i=!e.length;for(let s of r.variants)if(!n&&"cover"in s&&(n=s.cover),"url"in s)switch(s.type.toLowerCase()){case"mp4":(i||(0,Ae.default)(e,"mp4"))&&(t.MPEG=x(d({},t.MPEG),{[(a=s.standard)!=null?a:"Invariant quality"]:s.url}));break;case"mpeg":(i||(0,Ae.default)(e,"mpeg"))&&(t.MPEG=x(d({},t.MPEG),{[(o=s.standard)!=null?o:"Invariant quality"]:s.url}));break;case"hls":(i||(0,Ae.default)(e,"hls"))&&(t=x(d({},t),{HLS:{type:"url",url:s.url}}));break;case"dash":(i||(0,Ae.default)(e,"dash"))&&(t=x(d({},t),{DASH_SEP:{compatibilityMode:!0,type:"url",url:s.url}}));break;default:break}return{sources:t,thumbUrl:n,title:(c=r.title)!=null?c:""}}var Qe=(r,e)=>{let t=r.info.currentQuality$.getValue(),n=r.info.availableQualities$.getValue();t!==e&&(0,Ae.default)(n,e)&&(r.setQuality(e),r.setAutoQuality(!1))};var rp=2;function Kr(r){let e=Gr(),t=new Wr,n={},i=null,a=!1,o,c=new tp(null);r&&s(r);function s(v){i=v}function l(v,R,h){var I;if(!i)throw Error("need to set interactive controller");if(!i.options)return;let f=((I=e.map.get(v))!=null?I:{})[R];if(f){n=d({chapterId:h,listId:v,itemId:R},f);let T=n.player;n.subscription.add(T.info.currentQuality$.subscribe(g=>{let A=T.info.position$.getValue(),L=T.info.isAutoQualityEnabled$.getValue();if(!(!g||!A||L))for(let O of e.map)(0,Ss.default)(O[1]).forEach(({player:M})=>{Qe(M,g)})})).add(T.events.started$.subscribe(()=>{m(R)})),f.container.remove(),i.setPlayer(f.player),a||(i.init(),a=!0),c.next({player:n.player,config:n.config,statistics:n.statistics});return}throw Error("Can't set. Not find.")}function m(v){return P(this,null,function*(){if(!i)throw Error("need to set interactive controller");if(ue(n)||v!==n.itemId)return;let R=i.getChapterBranches(),h=new Set;for(let u of R)h.has(u.media.id)||(yield b({media:u.media,chapterId:u.chapter.id,setAsActive:!1,title:u.chapter.label}),h.add(u.media.id))})}function y(h){return P(this,arguments,function*({chapter:{id:v},manifestVideo:R}){if(ue(n)||!i)return;let u=n.player.info.muted$.getValue(),f=n.player.info.currentQuality$.getValue(),I=n.player.info.isAutoQualityEnabled$.getValue(),T=n.player.info.volume$.getValue(),g=n.player.info.currentPlaybackRate$.getValue(),A=!I,L=!1;for(let O of e.map)if(O[0]===R.id&&!i.state.isReplay$.getValue()){let M=Object.keys(O[1]);for(let N of M)N===n.itemId?(M.length<rp||(L=!0),e.removePlayer(O[0],N)):(L=!0,l(O[0],N,v),A?Qe(n.player,f):n.player.setAutoQuality(!0),n.player.setVolume(T),n.player.setMuted(u),n.player.setPlaybackRate(g))}else e.removePlayer(O[0]);L||(yield b({media:R,chapterId:v,setAsActive:!0,playbackRate:g}),A?Qe(n.player,f):n.player.setAutoQuality(!0),n.player.setVolume(T),n.player.setMuted(u))})}function b(A){return P(this,arguments,function*({media:v,chapterId:R,prefetch:h=!0,setAsActive:u=!0,autoplay:f=!1,preferredExt:I,title:T,playbackRate:g}){var sn,on,cn,ln,un;let L=Math.random().toString(),O=document.createElement("div");o.append(O);let M;if((sn=i==null?void 0:i.options)!=null&&sn.vkVideoLoader){let tt=ys(v);tt.length&&(M=yield i.options.vkVideoLoader(...tt))}let N=((on=i==null?void 0:i.options)==null?void 0:on.coreConfig)||void 0,Y=x(d({},N),{configName:[...(cn=N==null?void 0:N.configName)!=null?cn:[],"interactive"]}),se=x(d({container:O},((ln=M==null?void 0:M.videos)==null?void 0:ln[0])||{sources:zr(v,I).sources}),{title:T,failoverHosts:(M==null?void 0:M.failoverHosts)||[]}),B=new Ju(Y,ep.createRootTracer());B.initVideo(se);let me=null;if(M!=null&&M.videos&&(i!=null&&i.options.createOneStat)){let tt=M.videos[0],zt=i.options.createOneStat(tt),pn=new Wr;zt&&(pn.add(zt.attachTo(B)),me={oneStat:zt,statSubscription:pn})}let an=new Wr,Mo=(un=n==null?void 0:n.player)==null?void 0:un.info.isAutoQualityEnabled$.getValue();an.add(B.events.canplay$.subscribe(function(){Mo||Qe(B,n.player.info.currentQuality$.getValue()),g&&B.setPlaybackRate(g)}));let ve=e.createPlayer({listId:v.id,itemId:L,player:B,container:O,sources:zr(v,I).sources,config:se,subscription:an,statistics:me});return u&&l(v.id,ve.itemId,R),f&&ve.player.play(),h&&!f&&ve.player.prepare(),{player:ve.player,config:ve.config,statistics:ve.statistics}})}function C(){S(),i=null,o.remove()}function S(){t.unsubscribe(),e.removeAll(),n={},a=!1}function E(){return P(this,null,function*(){if(!i)throw Error("need to set interactive controller");S(),o=document.createElement("div");let{media:v,chapter:R}=i.getCurrentChapter();v&&R?(t.add(i.events.chapterChanged$.subscribe(y)),yield b({media:v,chapterId:R.id,title:R.label})):console.error("not found")})}return x(d({},e),{init:E,setInteractiveController:s,createPlayer:b,removeAll:C,getActivePlayer:function(){return n},activePlayerChanged:c})}var k={graph:"graph",interactives:"interactives",chapterChanged:"chapter-changed",playerChanged:"player-changed",manifestChanged:"manifest-changed",errors:"errors",eachTick:"eachTick",historyInited:"history-inited",historyDestroyed:"history-destroyed"},Ye={visibility:"visibility",watchAgainClicked:"watchAgainClicked"},j={actionChoiceCanceled:"action-choice-canceled",actionChoice:"action-choice",actionExecution:"action-execution",visibility:"visibility",containerRemoved:"container-removed",rangeEnded:"range-ended"};var As=te(_t(),1);import{Subscription as np}from"@vkontakte/videoplayer-shared/es2015";var Ft=class{constructor({player:e,container:t,branches:n,selectBranches:i,interactiveEvents:a,globalEvents:o,globalEventEmitter:c,getContainerEventState:s,permanentTextControls:l,interactiveTimeOpenUri:m,disabledControls$:y,onRemove:b}){this.hide=()=>{setTimeout(()=>{var e,t;this.gameState!==4&&(pe(this.container.container.events)&&this.gameState===3||this.selectBranches.state.isExpect||(this.gameState!==2&&((t=(e=this.container).hide)==null||t.call(e)),this.emitContainerVisibilityEvent(!1)))})};this.show=()=>{var t,n,i,a;if(this.gameState!==2||this.isSelectedControlEvent)return;if(this.container.getElement()){let{hasOpenURIEventInCurrentContainer:o}=this.getContainerEventState();if((n=(t=this.container).show)==null||n.call(t),this.interactiveTimeOpenUri&&o)return;this.emitContainerVisibilityEvent(!0,!1)}else{let o={isDisabled:()=>this.container.isDisabled,branches:this.branches,containerId:this.container.container.id,onDetachContainer:()=>{this.removeView(),this.emitContainerVisibilityEvent(!1)},onEvent:(s,l)=>{let{isExpectTime:m,hasOtherExpect:y,hasOpenURIEvent:b,hasOpenURIEventInCurrentContainer:C,isAllOpenURIEventsValid:S,hasShouldOpenNowEvent:E}=this.getContainerEventState(),v=this.interactiveTimeOpenUri&&!C,R=this.interactiveTimeOpenUri&&C;if((!this.interactiveTimeOpenUri||v)&&(this.isSelectedControlEvent=!0),s!==!1){if(!this.selectBranches.state.isExpect&&(!this.interactiveTimeOpenUri||v)){if(this.interactiveTimeOpenUri){let h=!y&&!S&&C;h&&this.globalEvents.interactiveContainerFakeRemoved$.next({subjectId:this.container.container.id,subjectName:"container",type:"container-fake-removed",removeAllOpenURI:h})}this.removeView()}this.emitContainerVisibilityEvent(!1)}if(this.gameState===4||this.gameState===3||this.selectBranches.state.isExpect||this.interactiveTimeOpenUri&&b&&this.gameState!==5){if(R){let u=((f,I,T,g)=>!f&&!I&&T||f&&!I&&T&&!g||f&&!I&&T&&g)(m,y,S,this.isSelectedContainerEvent);this.fakeRemoveView(u)}else this.removeView(),this.emitContainerVisibilityEvent(!1);(!m||!y||!E)&&(this.selectBranches.stopExpect(),l())}},isEOV:()=>this.gameState===4},c=$a(this.selectBranches.onControlEvent,o);this.container.createView(c),this.emitContainerVisibilityEvent(!0,!0),this.disabledControls$.getValue()&&((a=(i=this.container).disable)==null||a.call(i))}};this.onEndOfVideo=()=>{this.gameState=4,this.selectContainerEvent(!0)};this.whilePlaying=()=>{var l,m,y;let e=this.player.experimental.element$.getValue(),n=e instanceof HTMLVideoElement?e.readyState:void 0,i=[6,5];if(!n||(0,As.default)(i,this.gameState)&&!this.isPermanentText)return;let a=this.player.getExactTime();if(Na(a,this.container.container))this.gameState!==1&&(this.gameState=1,this.onBeforeStartTime());else if(qr(a,this.container.container))this.gameState!==2&&(this.gameState=2,this.onStartTime());else if(this.gameState!==3){let b=this.gameState;this.gameState=3,b===2&&this.onEndTime()}else{let{hasOpenURIEventInCurrentContainer:b}=this.getContainerEventState(),C=this.selectBranches.state.isExpect;if(this.interactiveTimeOpenUri&&b&&!C){let E=this.container.getElement();if(E){if(E.style.visibility==="hidden")return;(m=(l=this.container).hide)==null||m.call(l),this.container.isRemoved||this.fakeRemoveView();return}}this.isPermanentText||this.removeView()}let o=qr(a,this.container.container),c=this.container.container.startTime?[this.container.container.startTime,(y=this.container.container.endTime)!=null?y:1/0]:[],s={subjectId:this.container.container.id,subjectName:"container",range:c,currentTime:a,isInteractiveTime:o};this.globalEventEmitter.emit(k.eachTick,s),this.globalEvents.eachTick$.next(s)};this.container=t,this.branches=n,this.selectBranches=i,this.subscription=new np,this.player=e,this.interactiveEvents=a,this.getContainerEventState=s,this.isPermanentText=l&&Se(t.container.controls),this.interactiveTimeOpenUri=m,this.disabledControls$=y,this.onRemove=b,this.globalEventEmitter=c,this.gameState=0,this.globalEvents=o,this.isSelectedControlEvent=!1,this.isSelectedContainerEvent=!1,this.registerEvents()}emitContainerVisibilityEvent(e,t=!1){e?(this.globalEventEmitter.emit(k.interactives,{subjectId:this.container.container.id,subjectName:"container",type:j.visibility,visibility:e,isFirst:t}),this.globalEvents.interactiveVisibilityChanged$.next({subjectId:this.container.container.id,subjectName:"container",type:"visibility",visibility:e,isFirst:t})):(this.globalEventEmitter.emit(k.interactives,{subjectId:this.container.container.id,subjectName:"container",type:j.visibility,visibility:!1}),this.globalEvents.interactiveVisibilityChanged$.next({subjectId:this.container.container.id,subjectName:"container",type:"visibility",visibility:e}))}registerEvents(){this.subscription.add(this.player.events.playing$.subscribe(this.show)).add(this.player.events.paused$.subscribe(this.hide)).add(this.player.events.ended$.subscribe(this.onEndOfVideo)).add(this.disabledControls$.subscribe(e=>{var t,n,i,a;e?(n=(t=this.container).disable)==null||n.call(t):(a=(i=this.container).enable)==null||a.call(i)}))}selectContainerEvent(e=!1){var n,i;let{isExpectEventForCurrentContainer:t}=this.getContainerEventState();this.interactiveEvents.containersEventsCallState.setCalled({timestamp:e?1/0:(n=this.container.container.endTime)!=null?n:1/0,id:this.container.container.id}),!(this.isSelectedControlEvent||this.isSelectedContainerEvent)&&(this.isSelectedContainerEvent=!0,t||this.selectBranches.setManifestContainerEvents({container:this.container.container,branches:this.branches,isEOV:e}),!e&&this.interactiveEvents.exec((i=this.container.container.endTime)!=null?i:1/0))}onStartTime(){this.show()}onEndTime(){this.selectContainerEvent(!1);let{isExpectTime:e,hasOpenURIEventInCurrentContainer:t}=this.getContainerEventState(),n=this.interactiveTimeOpenUri?e||t:pe(this.container.container.events)||e;(this.isSelectedControlEvent||!n)&&this.removeView()}onBeforeStartTime(){var e,t;(t=(e=this.container).hide)==null||t.call(e),this.emitContainerVisibilityEvent(!1)}reset(){this.isSelectedControlEvent=!1,this.isSelectedContainerEvent=!1,this.gameState=1}removeView(e=!1){var t;this.container.removeView(e),this.globalEventEmitter.emit(k.interactives,{subjectId:this.container.container.id,subjectName:"container",type:j.containerRemoved,visibility:!1}),this.globalEvents.interactiveContainerRemoved$.next({subjectId:this.container.container.id,subjectName:"container",type:"container-removed"}),this.gameState=5,(t=this.onRemove)==null||t.call(this)}fakeRemoveView(e=!1){this.container.isRemoved||this.globalEvents.interactiveContainerFakeRemoved$.next({subjectId:this.container.container.id,subjectName:"container",type:"container-fake-removed",removeAllOpenURI:e}),this.container.fakeRemove()}destroy(){var e;this.reset(),this.removeView(!0),this.gameState=6,this.subscription.unsubscribe(),this.branches=[],this.interactiveEvents.containersEventsCallState.setCalled({timestamp:(e=this.container.container.endTime)!=null?e:1/0,id:this.container.container.id})}};var Rs=(r=[])=>r.reduce((e,t,n)=>{var a,o,c;let i=((a=t==null?void 0:t.controls)!=null?a:[]).filter(s=>!St(s));if(Nt(i)){let s=[(o=t.startTime)!=null?o:0,(c=t.endTime)!=null?c:1/0],l={id:t.id,isRemoved:!1};if(!n)e.push({subjects:[l],range:s});else{let m=[],y=-1/0,b=1/0,C=[],S=[];for(let E=0;E<e.length;E++){let v=e[E];if(S.push(...v.subjects),v.range[0]<b&&(b=v.range[0]),v.range[1]>y&&(y=v.range[1]),s[0]>=v.range[0]&&s[1]<=v.range[1])return e[E].subjects.push(l),e;s[0]<v.range[0]&&s[1]>v.range[0]&&(m.push(E),C=C.concat(v.subjects)),s[0]>=v.range[0]&&s[0]<=v.range[1]&&(m.push(E),C=C.concat(v.subjects),s[0]=v.range[0]),s[1]>=v.range[0]&&s[1]<=v.range[1]&&(m.push(E),C=C.concat(v.subjects),s[1]=v.range[1])}if(S.push(l),s[0]<=b&&s[1]>=y)return[{subjects:S,range:s}];m.length&&m.reverse().forEach(E=>{e.splice(E,1)}),e.push({subjects:C.concat([l]),range:s})}}return e},[]).sort((e,t)=>e.range[0]-t.range[0]);var lo=te(_t(),1),Zr=te(Lt(),1),uo=te(oo(),1);function co(){let r={};function e(){for(let c in r)Object.prototype.hasOwnProperty.call(r,c)&&delete r[c]}function t(c){let s={};for(let l in r)+l<=c&&(s[l]=r[l]);return s}function n(c){let s={};for(let l in r)+l>=c&&(s[l]=r[l]);return s}function i({timestamp:c,priority:s,initiator:l}){var m;if(Mr(c)){let y=(m=r[c])!=null?m:null;if(y&&s&&He(s,!0)){let b={},C=y[s];if(C&&(b=d(d({},b),C)),b=ue(b)?null:b,b&&He(l,!0)){let S=b[l];return S!=null?S:null}return b}return y}return null}function a({timestamp:c,priority:s,initiator:l}){if(Mr(c))if(r[c]){if(s&&He(s,!0))if(r[c][s]){if(l&&He(l,!0))if(r[c][s][l]){if(delete r[c][s][l],!ue(r[c][s]))return!0}else return!1;if(delete r[c][s],!ue(r[c]))return!0}else return!1;return delete r[c]}else return!1;return!1}function o(y){var b=y,{timestamp:c,priority:s,initiator:l}=b,m=X(b,["timestamp","priority","initiator"]);var C,S,E;(S=(C=r[c])==null?void 0:C[s])!=null&&S[l]?r[c][s][l].push(d({},m)):(E=r[c])!=null&&E[s]?r[c][s]=x(d({},r[c][s]),{[l]:[d({},m)]}):r[c]?r[c]=x(d({},r[c]),{[s]:{[l]:[d({},m)]}}):r[c]={[s]:{[l]:[d({},m)]}}}return{map:r,remove:a,add:o,removeAll:e,get:i,getLte:t,getGte:n}}var Gp=[V.expect,V.setNextBranch],zp=1/0;function po(r,e){let t=r,n,i=Wp(e),a=co(),o,c=()=>{C(),h()},s=u=>{a.add.call(void 0,u),E()},l=(u=[])=>{for(let f of u)if(f.action(),(0,lo.default)(Gp,f.actionType))break},m=(u=1/0)=>{var g,A,L;let f=Bt((g=a.get({timestamp:u,priority:"control"}))!=null?g:{}),I=Bt((A=a.get({timestamp:u,priority:"container"}))!=null?A:{}),T=Bt((L=a.get({timestamp:u,priority:"chapter"}))!=null?L:{});return[...f,...I,...T]},y=u=>{i.isReady(u)&&l(m(u))},b=()=>{var u;l([...Bt((u=a.get({timestamp:1/0,priority:"chapter"}))!=null?u:{})])},C=()=>{n&&(o==null||o.unsubscribe(),n=void 0)},S=u=>{},E=()=>{n||(n=()=>setTimeout(()=>{y(1/0)}),o=t.events.ended$.subscribe(n))},v=u=>{C(),t=u},R=u=>{u.priority==="container"&&i.resetCalled(u.timestamp),a.remove(u)},h=()=>{i.release(),a.removeAll()};return{setPlayer:v,add:s,remove:R,exec:y,execEndOfVideo:b,listen:E,unlisten:C,release:c,containersEventsCallState:i,getPreparedToExecActions:m}}function Wp(r){let e=new Map;return{setCalled:({timestamp:c,id:s})=>{let l=e.get(c);l&&l[s]!==void 0&&(l[s]=!0)},setData:(c=[])=>{var s;for(let l of c){let m=(s=l.endTime)!=null?s:zp,y=e.get(m);e.set(m,x(d({},y),{[l.id]:!1}))}},resetCalled:c=>{let s=e.get(c);if(s)for(let l in s)s[l]=!1},isReady:c=>{let s=e.get(c);if(!s)return!0;let l=(0,Zr.default)(s);return r?l.some(y=>y):!l.some(y=>!y)},release:()=>e.clear()}}function Bt(r){return(0,uo.default)((0,Zr.default)(r)).sort(e=>e.actionType===V.expect?-1:1)}var ho={videoContentHeight:0,videoContentWidth:0},fo=(r,e)=>{let{height:t,width:n}=e.info.intrinsicVideoSize$.getValue()||{};if(!(t&&n))return ho;let{clientHeight:i,clientWidth:a}=e.experimental.element$.getValue()||{};if(!(i&&a))return ho;let o=t/n,c=i/a,s,l;return c>o?(l=a,s=a*o):c<o?(l=i/o,s=i):(l=a,s=i),{videoContentWidth:l,videoContentHeight:s}};var Kp=250;function mo(r){let e=()=>{},t=new ResizeObserver(c=>{a(c),e=a.bind(null,c)});function n(c){let{parentElement:s,player:l}=r();if(s&&l){let{videoContentWidth:m,videoContentHeight:y}=fo(s,l);s.style.setProperty("--interactive-content-width",`${m}px`),s.style.setProperty("--interactive-content-height",`${y}px`),s.style.setProperty("--interactive-width",`${c[0].contentRect.width}px`),s.style.setProperty("--interactive-height",`${c[0].contentRect.height}px`)}}function i(){let{parentElement:c}=r();c.removeAttribute("style")}let a=Be(c=>{let{fns:s=[]}=r();n(c);for(let l of s)l()},Kp);function o(){e=void 0,t.disconnect(),i()}return{resizeObserver:t,calc:()=>{e==null||e()},release:o}}var Qp=r=>Math.floor(Math.random()*r),yo=r=>{var i;let e=r.length,t=1/0,n=null;for(;e--;){let a=r[e],o=(i=a.weight)!=null?i:1;o<t&&(t=o,n=a)}return n},bo=r=>{var i;let e=r.length,t=-1/0,n=null;for(;e--;){let a=r[e],o=(i=a.weight)!=null?i:0;o>t&&(t=o,n=a)}return n};var go=r=>{let e=r.length,t=Qp(e);return r[t]},vo=1,Co=r=>{var n,i;let e=0;for(let a=0;a<r.length;++a)e+=(n=r[a].weight)!=null?n:vo;let t=Math.random()*e;e=0;for(let a=0;a<r.length-1;++a)if(e+=(i=r[a].weight)!=null?i:vo,e>=t)return r[a];return r[r.length-1]};var Eo={shouldOpenNow:!0,isDetachContainer:!0},Io="after-expect";var Jr=(r,e=!1)=>x(d({},r),{args:e?d(d({},r.args),Eo):d(d({},Eo),r.args)}),So=({globalEventEmitter:r,globalEvents:e,player:t,interactiveEvents:n})=>{let i={isExpect:!1},a=()=>{i.isExpect&&(i.isExpect=!1)},o=({action:h,controlType:u,controlId:f,containerId:I,branches:T=[],onEvent:g,isEOV:A=()=>!1,isDisabled:L=()=>!1})=>{let O=Jr(h,A()),M={timestamp:1/0,priority:"control",initiator:f,actionType:O.type},N=L(),Y=r.emit.bind(r,k.interactives,{subjectId:f,subjectType:u,subjectName:"control",type:N?j.actionChoiceCanceled:j.actionChoice,actionType:h.type,payload:d({invokeImmediately:O.args.shouldOpenNow,containerId:I},O.args)}),se=()=>{e.interactiveActionChoice$.next({subjectId:f,subjectType:u,subjectName:"control",type:N?"action-choice-canceled":"action-choice",actionType:h.type,payload:d({invokeImmediately:O.args.shouldOpenNow,containerId:I},O.args)})};if(N){Y(),se();return}switch(O.type.trim().toLowerCase()){case V.setNextBranch.trim().toLowerCase():{let B=T.find(me=>me.id===O.args.branchId);if(!B)return;g(O.args.isDetachContainer,C.bind(null,{subjectId:f,subjectName:"control"})),Y(),se(),O.args.shouldOpenNow?E({subjectId:f,subjectName:"control",subjectType:u,action:O,payload:{chapterId:B.chapterId,autoSelect:!1}}):n.add(x(d({},M),{action:E.bind(null,{subjectId:f,subjectName:"control",subjectType:u,action:O,payload:{chapterId:B.chapterId,autoSelect:!1}})}));return}case V.continuePlayback.trim().toLowerCase():{g(O.args.isDetachContainer,C.bind(null,{subjectId:f,subjectName:"control"})),Y(),se(),O.args.shouldOpenNow?S({subjectId:f,subjectName:"control",subjectType:u,action:h}):n.add(x(d({},M),{action:S.bind(null,{subjectId:f,subjectName:"control",subjectType:u,action:h})}));return}case V.openURI.trim().toLowerCase():{g(O.args.isDetachContainer,C.bind(null,{subjectId:f,subjectName:"control"})),Y(),se(),O.args.shouldOpenNow?R({subjectId:f,subjectName:"control",subjectType:u,action:O,payload:{URI:h.args.uri}}):n.add(x(d({},M),{action:R.bind(null,{subjectId:f,subjectName:"control",subjectType:u,action:O,payload:{URI:h.args.uri}})}));return}default:{let B="Unexpected control event",me=new _(1,1,{message:B});m(me,B);return}}},c=({action:h,container:{id:u,endTime:f},branches:I=[],isEOV:T=!1,autoSelected:g=!1})=>{let A=Jr(h,T),L={timestamp:!A.args.shouldOpenNow||T?1/0:f!=null?f:1/0,priority:"container",initiator:u,actionType:A.type},O=r.emit.bind(r,k.interactives,{subjectId:u,subjectName:"container",type:j.actionChoice,actionType:A.type,payload:d({invokeImmediately:A.args.shouldOpenNow},A.args)}),M=()=>{e.interactiveActionChoice$.next({subjectId:u,subjectName:"container",type:"action-choice",actionType:A.type,payload:d({invokeImmediately:A.args.shouldOpenNow},A.args)})};switch(A.type.trim().toLowerCase()){case V.setNextBranch.trim().toLowerCase():{let N=I.find(Y=>Y.id===A.args.branchId);if(!N)return;O(),M(),n.add(x(d({},L),{action:E.bind(null,{subjectId:u,subjectName:"container",action:A,payload:{chapterId:N.chapterId,autoSelect:g}})}));return}case V.setMaxWeightBranch.trim().toLowerCase():return;case V.setMinWeightBranch.trim().toLowerCase():return;case V.setRandomBranch.trim().toLowerCase():return;case V.setWeightlessRandomBranch.trim().toLowerCase():return;case V.continuePlayback.trim().toLowerCase():{O(),M(),n.add(x(d({},L),{action:S.bind(null,{subjectId:u,subjectName:"container",action:A})}));return}case V.openURI.trim().toLowerCase():{O(),M(),n.add(x(d({},L),{action:R.bind(null,{subjectId:u,subjectName:"container",action:A,payload:{URI:h.args.uri}})}));return}default:{let N="Unexpected container event",Y=new _(1,1,{message:N});m(Y,N);return}}};function s({container:h,branches:u,isEOV:f=!1}){var T,g;let I=Br(h.events);if(I){let A=Jr(I.action,f);r.emit(k.interactives,{subjectId:h.id,subjectName:"container",type:j.actionChoice,actionType:A.type,payload:d({invokeImmediately:A.args.shouldOpenNow},A.args)}),e.interactiveActionChoice$.next({subjectId:h.id,subjectName:"container",type:"action-choice",actionType:A.type,payload:d({invokeImmediately:A.args.shouldOpenNow},A.args)}),n.add({timestamp:f?1/0:(T=h.endTime)!=null?T:1/0,priority:"container",initiator:h.id,actionType:V.expect,action:b.bind(null,{subjectId:h.id,subjectName:"container"})}),i.isExpect=!0}else for(let A of(g=h.events)!=null?g:[])c({action:A.action,container:h,branches:u,isEOV:f})}let l=({chapterId:h,action:u,branches:f=[]})=>{let I=r.emit.bind(r,k.interactives,{subjectId:h,subjectName:"chapter",type:j.actionChoice,actionType:u.type,payload:u.args}),T=()=>{e.interactiveActionChoice$.next({subjectId:h,subjectName:"chapter",type:"action-choice",actionType:u.type,payload:u.args})};switch(u.type.trim().toLowerCase()){case V.setNextBranch.trim().toLowerCase():{let g=f.find(A=>A.id===u.args.branchId);return g!=null&&g.chapterId?(I(),T(),E.bind(null,{subjectId:h,subjectName:"chapter",action:u,payload:{chapterId:g.chapterId,autoSelect:!0}})):void 0}case V.setWeightlessRandomBranch.trim().toLowerCase():{let g=go(f);return g!=null&&g.chapterId?(I(),T(),E.bind(null,{subjectId:h,subjectName:"chapter",action:u,payload:{chapterId:g.chapterId,autoSelect:!0}})):void 0}case V.setRandomBranch.trim().toLowerCase():{let g=Co(f);return g!=null&&g.chapterId?(I(),T(),E.bind(null,{subjectId:h,subjectName:"chapter",action:u,payload:{chapterId:g.chapterId,autoSelect:!0}})):void 0}case V.setMaxWeightBranch.trim().toLowerCase():{let g=bo(f);return g!=null&&g.chapterId?(I(),T(),E.bind(null,{subjectId:h,subjectName:"chapter",action:u,payload:{chapterId:g.chapterId,autoSelect:!0}})):void 0}case V.setMinWeightBranch.trim().toLowerCase():{let g=yo(f);return g!=null&&g.chapterId?(I(),T(),E.bind(null,{subjectId:h,subjectName:"chapter",action:u,payload:{chapterId:g.chapterId,autoSelect:!0}})):void 0}case V.continuePlayback.trim().toLowerCase():return I(),T(),S.bind(null,{subjectId:h,subjectName:"chapter",action:u});case V.openURI.trim().toLowerCase():return I(),T(),R.bind(null,{subjectId:h,subjectName:"chapter",action:u,payload:{URI:u.args.uri}});default:{let g="Unexpected chapter event",A=new _(1,1,{message:g});m(A,g);return}}};function m(h,u){console.error(u),e.error$.next(h),r.emit(k.errors,h)}function y(h){var f;let u=Br(h.events);if(u){if(J(h))return;r.emit(k.interactives,{subjectId:h.id,subjectName:"chapter",type:j.actionChoice,actionType:u.action.type,payload:u.action.args}),e.interactiveActionChoice$.next({subjectId:h.id,subjectName:"chapter",type:"action-choice",actionType:u.action.type,payload:u.action.args}),n.add({timestamp:1/0,priority:"chapter",initiator:h.id,actionType:V.expect,action:b.bind(null,{subjectId:h.id,subjectName:"chapter"})})}else(f=h.events)==null||f.forEach(I=>{let T=l({chapterId:h.id,action:I.action,branches:h.branches});T&&n.add({timestamp:1/0,priority:"chapter",initiator:h.id,actionType:I.action.type,action:T})})}let b=({subjectId:h,subjectName:u})=>{t.pause(),r.emit(k.interactives,{subjectId:h,subjectName:u,type:j.actionExecution,actionType:V.expect}),e.interactiveActionExecution$.next({subjectId:h,subjectName:u,type:"action-execution",actionType:V.expect})},C=({subjectId:h,subjectName:u})=>{t.info.isEnded$.getValue()?n.execEndOfVideo():t.play(),r.emit(k.interactives,{subjectId:h,subjectName:u,type:j.actionExecution,actionType:Io}),e.interactiveActionExecution$.next({subjectId:h,subjectName:u,type:"action-execution",actionType:Io})},S=({subjectId:h,subjectName:u,subjectType:f,action:I})=>{r.emit(k.interactives,{subjectId:h,subjectName:u,subjectType:f,type:j.actionExecution,actionType:I.type}),e.interactiveActionExecution$.next({subjectId:h,subjectName:u,subjectType:f,type:"action-execution",actionType:I.type})},E=({subjectId:h,subjectName:u,subjectType:f,action:I,payload:T})=>{T.behaviour="change-chapter",r.emit(k.interactives,{subjectId:h,subjectName:u,subjectType:f,type:j.actionExecution,actionType:I.type,payload:T}),e.interactiveActionExecution$.next({subjectId:h,subjectName:u,subjectType:f,type:"action-execution",actionType:I.type,payload:T})},v=({subjectId:h,subjectName:u,subjectType:f,action:I,payload:T})=>{T.behaviour="change-manifest",r.emit(k.interactives,{subjectId:h,subjectName:u,subjectType:f,type:j.actionExecution,actionType:I.type,payload:T}),e.interactiveActionExecution$.next({subjectId:h,subjectName:u,subjectType:f,type:"action-execution",actionType:I.type,payload:T})},R=({subjectId:h,subjectName:u,subjectType:f,action:I,payload:T})=>{if(!T.URI)return;let g=window.open(T.URI,"_blank","noopener,noreferrer");g&&(g.opener=null),r.emit(k.interactives,{subjectId:h,subjectName:u,subjectType:f,type:j.actionExecution,actionType:I.type}),e.interactiveActionExecution$.next({subjectId:h,subjectName:u,subjectType:f,type:"action-execution",actionType:I.type})};return{onControlEvent:o,onContainerEvent:c,onChapterEvent:l,onExpectEvent:b,expectEventHandler:C,setManifestChapterEvents:y,setManifestContainerEvents:s,stopExpect:a,state:i}};var rn=te(Vr(),1);import{Subscription as eh,Subject as tn,ValueSubject as Ze}from"@vkontakte/videoplayer-shared/es2015";var en=(r,e)=>{let t={};return r.map(n=>{if(!t[n]){let i=e.chapters.find(o=>o.id===n);if(!i)return null;let a=e.media.videos.find(o=>i.videoId===o.id);if(!a)return null;t[n]=wo(a)}return t[n]}).filter(Boolean)},Xp=r=>{for(let e of r.variants)if(Zp(e)&&e.payload)return e.payload.id},Zp=r=>!!(r.type==="custom"&&r.payload&&r.payload.type==="vk"),wo=r=>{let e=Xp(r);if(!e)return null;let t=e.split("_").pop();return t?parseInt(t,10):null},Jp=(r,e)=>{for(let t of r.media.videos)if(e===wo(t)){for(let n of r.chapters)if(n.videoId===t.id)return n.id;return}},Ao=(r,e)=>r.reduce((t,n)=>{let i=Jp(e,n);return i?[...t,i]:t},[]);var ne,he,de,W,Dt,ie,ae,ee,fe,Re,Oe,Je=class{constructor({globalEventEmitter:e,videoId:t,interactiveController:n,historyApi:i,settings:a}){this.state={history$:new Ze([]),hasPrevChapter$:new Ze(!1),prevChapter$:new Ze(null),isInitialChapter$:new Ze(!1),isGoBackLimited$:new Ze(!1)};U(this,ne,null);U(this,he);U(this,de,!1);U(this,W,null);U(this,Dt,null);this.events={inited$:new tn,destroyed$:new tn,error$:new tn};U(this,ie,null);U(this,ae,null);U(this,ee,null);U(this,fe,new eh);U(this,Re,!1);U(this,Oe,0);var o;$(this,ie,t),$(this,ee,e),$(this,ae,n),$(this,ne,i),$(this,he,a),this.state.history$&&w(this,fe)&&((o=w(this,fe))==null||o.add(this.state.history$.subscribe(c=>{var s,l;this.state.prevChapter$.next((0,rn.default)(c,-2)||null),this.state.hasPrevChapter$.next(c.length>1),this.state.isInitialChapter$.next(this.getInitialChapterId()===((l=(s=w(this,W))==null?void 0:s.metadata)==null?void 0:l.initChapterId)),this.state.isGoBackLimited$.next(w(this,Oe)===w(this,he).maxLength-1)})))}setManifest(e){return P(this,null,function*(){if(!w(this,ae)||!w(this,ee))return;$(this,W,e),yield this.getProjectHistory();let t=this.getInitialChapterId();yield w(this,ae).setChapter({chapterId:t,pushToHistory:!1}),w(this,de)||($(this,de,!0),this.events.inited$.next({initChapterId:t}))})}get inited(){return w(this,de)}updateHistory(e,t=!0){return P(this,null,function*(){var c;if(!w(this,W))return;w(this,Re)?($(this,Re,!1),vn(this,Oe)._++):$(this,Oe,0);let n=w(this,W),i=e.length-w(this,he).maxLength,a=i>0?e.slice(i):e,o=en(a,n);if($(this,Dt,o),this.state.history$.next(a),!(!t||!w(this,ne)||!w(this,ie)))try{yield w(this,ne).save(w(this,ie),o)}catch(s){let l=new _(1,5,"Unable to save interactive history");this.events.error$.next(l),(c=w(this,ee))==null||c.emit(k.errors,l)}})}goBack(){return P(this,null,function*(){var n;if(!this.state||!w(this,ae)){let i=new _(1,5,"Unable to save interactive history");return this.events.error$.next(i),(n=w(this,ee))==null?void 0:n.emit(k.errors,i)}$(this,Re,!0);let e=this.state.history$.getValue().slice(0,-1),t=e.pop();this.state.history$.next(e),yield w(this,ae).setChapter({chapterId:t,playPrev:!0})})}getProjectHistory(){return P(this,null,function*(){var i;if(!w(this,W)||!w(this,ie))return;let e=w(this,W),t=[this.getInitialVideoId()];if(w(this,ne))try{let a=yield w(this,ne).get(w(this,ie));a.length&&(t=a)}catch(a){let o=new _(1,5,"Error while trying to fetch data");this.events.error$.next(o),(i=w(this,ee))==null||i.emit(k.errors,o)}let n=Ao(t,e);this.state.history$.next(n)})}getInitialChapterId(){var t;let e=this.state.history$.getValue();return(0,rn.default)(e,-1)||w(this,he).initChapterId||((t=w(this,W))==null?void 0:t.metadata.initChapterId)}getInitialVideoId(){if(w(this,W)){let e=this.getInitialChapterId();return en([e],w(this,W)).pop()}return null}destroy(){var e,t;$(this,ie,null),$(this,ne,null),$(this,ae,null),(e=w(this,fe))==null||e.unsubscribe(),$(this,fe,null),$(this,de,!1),(t=w(this,ee))==null||t.emit(k.historyDestroyed),this.events.destroyed$.next(),$(this,ee,null)}};ne=new WeakMap,he=new WeakMap,de=new WeakMap,W=new WeakMap,Dt=new WeakMap,ie=new WeakMap,ae=new WeakMap,ee=new WeakMap,fe=new WeakMap,Re=new WeakMap,Oe=new WeakMap;var Ht=class{constructor(){this._prevSizeId=0;this.rootElement=document.createElement("canvas")}clear(){var e;(e=this.rootElement.getContext("2d"))==null||e.clearRect(0,0,this.rootElement.width,this.rootElement.height)}isImageDrawn(){var i;let e=(i=this.rootElement.getContext("2d"))==null?void 0:i.getImageData(0,0,this.rootElement.width,this.rootElement.height);if(!e)return!1;let t=e.data,n=t.length;for(let a=3;a<n;a+=40)if(t[a]!==0)return!0;return!1}destroy(){this.rootElement.remove()}show(){this.rootElement.style.visibility="visible"}hide(){this.rootElement.style.visibility="hidden"}setCanvasImageSource(e){this.canvasImgSrc=e}draw(){var e;this.canvasImgSrc&&((e=this.rootElement.getContext("2d"))==null||e.drawImage(this.canvasImgSrc,0,0,this.rootElement.width,this.rootElement.height))}updateCanvasDimensions(e,t=!1){return P(this,null,function*(){let n=e.width+e.height;if(this._prevSizeId===n)return;let i;t&&(i=yield this.save()),this.rootElement.width=e.width,this.rootElement.height=e.height,t&&i&&this.restore(i),this._prevSizeId=n})}save(){return P(this,null,function*(){let e=this.rootElement.toDataURL("image/jpeg",1),t=new Image;return t.crossOrigin="anonymous",t.src=e,yield t.decode(),t})}restore(e){var t;this.rootElement&&((t=this.rootElement.getContext("2d"))==null||t.drawImage(e,0,0,this.rootElement.width,this.rootElement.height))}};var Ut=class{constructor({parentElement:e,endOffsetMs:t=250,onError:n}){this.currentVideoDurationMs=1/0;this._containerTimeFrameShouldReceived=!1;this._endTimeFrameReceived=!1;this._shouldCallSkip=!1;this.onEachTick=e=>{let t=e!=null?e:this.lastFrameCanvas.canvasImgSrc.currentTime*1e3,n=this.isChapterEndTime(t);if(this.isContainerTime(t))this._endTimeFrameReceived=!1,this._containerTimeFrameShouldReceived=!0,this._shouldCallSkip=!0;else if(n)this._containerTimeFrameShouldReceived=!1,this._shouldCallSkip=!1,this._endTimeFrameReceived||(this.draw(),this._endTimeFrameReceived=!0,this.show());else{if(this._shouldCallSkip){this._shouldCallSkip=!1;return}this.reset()}};this.onSeek=()=>{this.onEachTick(),!this._containerTimeFrameShouldReceived&&!this._endTimeFrameReceived&&(this.hide(),this.lastFrameCanvas.clear())};this.rootElement=document.createElement("div"),this.rootElement.style.cssText=`
|
|
6
|
+
var jo=Object.create;var Wt=Object.defineProperty,No=Object.defineProperties,$o=Object.getOwnPropertyDescriptor,Lo=Object.getOwnPropertyDescriptors,_o=Object.getOwnPropertyNames,rt=Object.getOwnPropertySymbols,Fo=Object.getPrototypeOf,Kt=Object.prototype.hasOwnProperty,dn=Object.prototype.propertyIsEnumerable;var fn=r=>{throw TypeError(r)};var hn=(r,e,t)=>e in r?Wt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,d=(r,e)=>{for(var t in e||(e={}))Kt.call(e,t)&&hn(r,t,e[t]);if(rt)for(var t of rt(e))dn.call(e,t)&&hn(r,t,e[t]);return r},x=(r,e)=>No(r,Lo(e));var X=(r,e)=>{var t={};for(var n in r)Kt.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&rt)for(var n of rt(r))e.indexOf(n)<0&&dn.call(r,n)&&(t[n]=r[n]);return t};var p=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var qo=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of _o(e))!Kt.call(r,i)&&i!==t&&Wt(r,i,{get:()=>e[i],enumerable:!(n=$o(e,i))||n.enumerable});return r};var te=(r,e,t)=>(t=r!=null?jo(Fo(r)):{},qo(e||!r||!r.__esModule?Wt(t,"default",{value:r,enumerable:!0}):t,r));var mn=(r,e,t)=>e.has(r)||fn("Cannot "+t);var w=(r,e,t)=>(mn(r,e,"read from private field"),t?t.call(r):e.get(r)),U=(r,e,t)=>e.has(r)?fn("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),$=(r,e,t,n)=>(mn(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);var vn=(r,e,t,n)=>({set _(i){$(r,e,i,t)},get _(){return w(r,e,n)}});var k=(r,e,t)=>new Promise((n,i)=>{var a=s=>{try{c(t.next(s))}catch(l){i(l)}},o=s=>{try{c(t.throw(s))}catch(l){i(l)}},c=s=>s.done?n(s.value):Promise.resolve(s.value).then(a,o);c((t=t.apply(r,e)).next())});var Z=p((rr,Tn)=>{"use strict";var ke=function(r){return r&&r.Math===Math&&r};Tn.exports=ke(typeof globalThis=="object"&&globalThis)||ke(typeof window=="object"&&window)||ke(typeof self=="object"&&self)||ke(typeof global=="object"&&global)||ke(typeof rr=="object"&&rr)||function(){return this}()||Function("return this")()});var G=p((Yh,xn)=>{"use strict";xn.exports=function(r){try{return!!r()}catch(e){return!0}}});var Pe=p((Xh,Sn)=>{"use strict";var Do=G();Sn.exports=!Do(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var kn=p((Zh,On)=>{"use strict";var Ho=Pe(),Rn=Function.prototype,wn=Rn.apply,An=Rn.call;On.exports=typeof Reflect=="object"&&Reflect.apply||(Ho?An.bind(wn):function(){return An.apply(wn,arguments)})});var K=p((Jh,Mn)=>{"use strict";var Pn=Pe(),Vn=Function.prototype,nr=Vn.call,Uo=Pn&&Vn.bind.bind(nr,nr);Mn.exports=Pn?Uo:function(r){return function(){return nr.apply(r,arguments)}}});var Ve=p((ed,Nn)=>{"use strict";var jn=K(),Go=jn({}.toString),zo=jn("".slice);Nn.exports=function(r){return zo(Go(r),8,-1)}});var ir=p((td,$n)=>{"use strict";var Wo=Ve(),Ko=K();$n.exports=function(r){if(Wo(r)==="Function")return Ko(r)}});var z=p((rd,Ln)=>{"use strict";var ar=typeof document=="object"&&document.all;Ln.exports=typeof ar=="undefined"&&ar!==void 0?function(r){return typeof r=="function"||r===ar}:function(r){return typeof r=="function"}});var ce=p((nd,_n)=>{"use strict";var Qo=G();_n.exports=!Qo(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var ft=p((id,Fn)=>{"use strict";var Yo=Pe(),dt=Function.prototype.call;Fn.exports=Yo?dt.bind(dt):function(){return dt.apply(dt,arguments)}});var sr=p(Dn=>{"use strict";var qn={}.propertyIsEnumerable,Bn=Object.getOwnPropertyDescriptor,Xo=Bn&&!qn.call({1:2},1);Dn.f=Xo?function(e){var t=Bn(this,e);return!!t&&t.enumerable}:qn});var or=p((sd,Hn)=>{"use strict";Hn.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var Gn=p((od,Un)=>{"use strict";var Zo=K(),Jo=G(),ec=Ve(),cr=Object,tc=Zo("".split);Un.exports=Jo(function(){return!cr("z").propertyIsEnumerable(0)})?function(r){return ec(r)==="String"?tc(r,""):cr(r)}:cr});var lr=p((cd,zn)=>{"use strict";zn.exports=function(r){return r==null}});var ur=p((ld,Wn)=>{"use strict";var rc=lr(),nc=TypeError;Wn.exports=function(r){if(rc(r))throw new nc("Can't call method on "+r);return r}});var Me=p((ud,Kn)=>{"use strict";var ic=Gn(),ac=ur();Kn.exports=function(r){return ic(ac(r))}});var ge=p((pd,Qn)=>{"use strict";var sc=z();Qn.exports=function(r){return typeof r=="object"?r!==null:sc(r)}});var mt=p((hd,Yn)=>{"use strict";Yn.exports={}});var vt=p((dd,Zn)=>{"use strict";var pr=mt(),hr=Z(),oc=z(),Xn=function(r){return oc(r)?r:void 0};Zn.exports=function(r,e){return arguments.length<2?Xn(pr[r])||Xn(hr[r]):pr[r]&&pr[r][e]||hr[r]&&hr[r][e]}});var ei=p((fd,Jn)=>{"use strict";var cc=K();Jn.exports=cc({}.isPrototypeOf)});var ii=p((md,ni)=>{"use strict";var lc=Z(),ti=lc.navigator,ri=ti&&ti.userAgent;ni.exports=ri?String(ri):""});var pi=p((vd,ui)=>{"use strict";var li=Z(),dr=ii(),ai=li.process,si=li.Deno,oi=ai&&ai.versions||si&&si.version,ci=oi&&oi.v8,Q,yt;ci&&(Q=ci.split("."),yt=Q[0]>0&&Q[0]<4?1:+(Q[0]+Q[1]));!yt&&dr&&(Q=dr.match(/Edge\/(\d+)/),(!Q||Q[1]>=74)&&(Q=dr.match(/Chrome\/(\d+)/),Q&&(yt=+Q[1])));ui.exports=yt});var fr=p((yd,di)=>{"use strict";var hi=pi(),uc=G(),pc=Z(),hc=pc.String;di.exports=!!Object.getOwnPropertySymbols&&!uc(function(){var r=Symbol("symbol detection");return!hc(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&hi&&hi<41})});var mr=p((bd,fi)=>{"use strict";var dc=fr();fi.exports=dc&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var vr=p((gd,mi)=>{"use strict";var fc=vt(),mc=z(),vc=ei(),yc=mr(),bc=Object;mi.exports=yc?function(r){return typeof r=="symbol"}:function(r){var e=fc("Symbol");return mc(e)&&vc(e.prototype,bc(r))}});var yi=p((Cd,vi)=>{"use strict";var gc=String;vi.exports=function(r){try{return gc(r)}catch(e){return"Object"}}});var yr=p((Ed,bi)=>{"use strict";var Cc=z(),Ec=yi(),Ic=TypeError;bi.exports=function(r){if(Cc(r))return r;throw new Ic(Ec(r)+" is not a function")}});var Ci=p((Id,gi)=>{"use strict";var Tc=yr(),xc=lr();gi.exports=function(r,e){var t=r[e];return xc(t)?void 0:Tc(t)}});var Ii=p((Td,Ei)=>{"use strict";var br=ft(),gr=z(),Cr=ge(),Sc=TypeError;Ei.exports=function(r,e){var t,n;if(e==="string"&&gr(t=r.toString)&&!Cr(n=br(t,r))||gr(t=r.valueOf)&&!Cr(n=br(t,r))||e!=="string"&&gr(t=r.toString)&&!Cr(n=br(t,r)))return n;throw new Sc("Can't convert object to primitive value")}});var xi=p((xd,Ti)=>{"use strict";Ti.exports=!0});var Ai=p((Sd,wi)=>{"use strict";var Si=Z(),wc=Object.defineProperty;wi.exports=function(r,e){try{wc(Si,r,{value:e,configurable:!0,writable:!0})}catch(t){Si[r]=e}return e}});var bt=p((wd,ki)=>{"use strict";var Ac=xi(),Rc=Z(),Oc=Ai(),Ri="__core-js_shared__",Oi=ki.exports=Rc[Ri]||Oc(Ri,{});(Oi.versions||(Oi.versions=[])).push({version:"3.38.0",mode:Ac?"pure":"global",copyright:"\xA9 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.38.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var Er=p((Ad,Vi)=>{"use strict";var Pi=bt();Vi.exports=function(r,e){return Pi[r]||(Pi[r]=e||{})}});var je=p((Rd,Mi)=>{"use strict";var kc=ur(),Pc=Object;Mi.exports=function(r){return Pc(kc(r))}});var Ce=p((Od,ji)=>{"use strict";var Vc=K(),Mc=je(),jc=Vc({}.hasOwnProperty);ji.exports=Object.hasOwn||function(e,t){return jc(Mc(e),t)}});var Ir=p((kd,Ni)=>{"use strict";var Nc=K(),$c=0,Lc=Math.random(),_c=Nc(1 .toString);Ni.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+_c(++$c+Lc,36)}});var Ne=p((Pd,Li)=>{"use strict";var Fc=Z(),qc=Er(),$i=Ce(),Bc=Ir(),Dc=fr(),Hc=mr(),Ee=Fc.Symbol,Tr=qc("wks"),Uc=Hc?Ee.for||Ee:Ee&&Ee.withoutSetter||Bc;Li.exports=function(r){return $i(Tr,r)||(Tr[r]=Dc&&$i(Ee,r)?Ee[r]:Uc("Symbol."+r)),Tr[r]}});var Bi=p((Vd,qi)=>{"use strict";var Gc=ft(),_i=ge(),Fi=vr(),zc=Ci(),Wc=Ii(),Kc=Ne(),Qc=TypeError,Yc=Kc("toPrimitive");qi.exports=function(r,e){if(!_i(r)||Fi(r))return r;var t=zc(r,Yc),n;if(t){if(e===void 0&&(e="default"),n=Gc(t,r,e),!_i(n)||Fi(n))return n;throw new Qc("Can't convert object to primitive value")}return e===void 0&&(e="number"),Wc(r,e)}});var xr=p((Md,Di)=>{"use strict";var Xc=Bi(),Zc=vr();Di.exports=function(r){var e=Xc(r,"string");return Zc(e)?e:e+""}});var Gi=p((jd,Ui)=>{"use strict";var Jc=Z(),Hi=ge(),Sr=Jc.document,el=Hi(Sr)&&Hi(Sr.createElement);Ui.exports=function(r){return el?Sr.createElement(r):{}}});var wr=p((Nd,zi)=>{"use strict";var tl=ce(),rl=G(),nl=Gi();zi.exports=!tl&&!rl(function(){return Object.defineProperty(nl("div"),"a",{get:function(){return 7}}).a!==7})});var Qi=p(Ki=>{"use strict";var il=ce(),al=ft(),sl=sr(),ol=or(),cl=Me(),ll=xr(),ul=Ce(),pl=wr(),Wi=Object.getOwnPropertyDescriptor;Ki.f=il?Wi:function(e,t){if(e=cl(e),t=ll(t),pl)try{return Wi(e,t)}catch(n){}if(ul(e,t))return ol(!al(sl.f,e,t),e[t])}});var Xi=p((Ld,Yi)=>{"use strict";var hl=G(),dl=z(),fl=/#|\.prototype\./,$e=function(r,e){var t=vl[ml(r)];return t===bl?!0:t===yl?!1:dl(e)?hl(e):!!e},ml=$e.normalize=function(r){return String(r).replace(fl,".").toLowerCase()},vl=$e.data={},yl=$e.NATIVE="N",bl=$e.POLYFILL="P";Yi.exports=$e});var Ar=p((_d,Ji)=>{"use strict";var Zi=ir(),gl=yr(),Cl=Pe(),El=Zi(Zi.bind);Ji.exports=function(r,e){return gl(r),e===void 0?r:Cl?El(r,e):function(){return r.apply(e,arguments)}}});var ta=p((Fd,ea)=>{"use strict";var Il=ce(),Tl=G();ea.exports=Il&&Tl(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var na=p((qd,ra)=>{"use strict";var xl=ge(),Sl=String,wl=TypeError;ra.exports=function(r){if(xl(r))return r;throw new wl(Sl(r)+" is not an object")}});var sa=p(aa=>{"use strict";var Al=ce(),Rl=wr(),Ol=ta(),gt=na(),ia=xr(),kl=TypeError,Rr=Object.defineProperty,Pl=Object.getOwnPropertyDescriptor,Or="enumerable",kr="configurable",Pr="writable";aa.f=Al?Ol?function(e,t,n){if(gt(e),t=ia(t),gt(n),typeof e=="function"&&t==="prototype"&&"value"in n&&Pr in n&&!n[Pr]){var i=Pl(e,t);i&&i[Pr]&&(e[t]=n.value,n={configurable:kr in n?n[kr]:i[kr],enumerable:Or in n?n[Or]:i[Or],writable:!1})}return Rr(e,t,n)}:Rr:function(e,t,n){if(gt(e),t=ia(t),gt(n),Rl)try{return Rr(e,t,n)}catch(i){}if("get"in n||"set"in n)throw new kl("Accessors not supported");return"value"in n&&(e[t]=n.value),e}});var ca=p((Dd,oa)=>{"use strict";var Vl=ce(),Ml=sa(),jl=or();oa.exports=Vl?function(r,e,t){return Ml.f(r,e,jl(1,t))}:function(r,e,t){return r[e]=t,r}});var _e=p((Hd,ua)=>{"use strict";var Le=Z(),Nl=kn(),$l=ir(),Ll=z(),_l=Qi().f,Fl=Xi(),Ie=mt(),ql=Ar(),Te=ca(),la=Ce();bt();var Bl=function(r){var e=function(t,n,i){if(this instanceof e){switch(arguments.length){case 0:return new r;case 1:return new r(t);case 2:return new r(t,n)}return new r(t,n,i)}return Nl(r,this,arguments)};return e.prototype=r.prototype,e};ua.exports=function(r,e){var t=r.target,n=r.global,i=r.stat,a=r.proto,o=n?Le:i?Le[t]:Le[t]&&Le[t].prototype,c=n?Ie:Ie[t]||Te(Ie,t,{})[t],s=c.prototype,l,m,y,b,C,S,E,v,R;for(b in e)l=Fl(n?b:t+(i?".":"#")+b,r.forced),m=!l&&o&&la(o,b),S=c[b],m&&(r.dontCallGetSet?(R=_l(o,b),E=R&&R.value):E=o[b]),C=m&&E?E:e[b],!(!l&&!a&&typeof S==typeof C)&&(r.bind&&m?v=ql(C,Le):r.wrap&&m?v=Bl(C):a&&Ll(C)?v=$l(C):v=C,(r.sham||C&&C.sham||S&&S.sham)&&Te(v,"sham",!0),Te(c,b,v),a&&(y=t+"Prototype",la(Ie,y)||Te(Ie,y,{}),Te(Ie[y],b,C),r.real&&s&&(l||!s[b])&&Te(s,b,C)))}});var ha=p((Ud,pa)=>{"use strict";var Dl=Math.ceil,Hl=Math.floor;pa.exports=Math.trunc||function(e){var t=+e;return(t>0?Hl:Dl)(t)}});var Fe=p((Gd,da)=>{"use strict";var Ul=ha();da.exports=function(r){var e=+r;return e!==e||e===0?0:Ul(e)}});var ma=p((zd,fa)=>{"use strict";var Gl=Fe(),zl=Math.min;fa.exports=function(r){var e=Gl(r);return e>0?zl(e,9007199254740991):0}});var qe=p((Wd,va)=>{"use strict";var Wl=ma();va.exports=function(r){return Wl(r.length)}});var Ct=p((Kd,ya)=>{"use strict";ya.exports=function(){}});var ba=p(()=>{"use strict";var Kl=_e(),Ql=je(),Yl=qe(),Xl=Fe(),Zl=Ct();Kl({target:"Array",proto:!0},{at:function(e){var t=Ql(this),n=Yl(t),i=Xl(e),a=i>=0?i:n+i;return a<0||a>=n?void 0:t[a]}});Zl("at")});var Et=p((Xd,ga)=>{"use strict";var Jl=vt();ga.exports=Jl});var Ea=p((Zd,Ca)=>{"use strict";ba();var eu=Et();Ca.exports=eu("Array","at")});var Ta=p((Jd,Ia)=>{"use strict";var tu=Ea();Ia.exports=tu});var Vr=p((ef,xa)=>{"use strict";var ru=Ta();xa.exports=ru});var qa=p((ym,Fa)=>{"use strict";var hu=Er(),du=Ir(),_a=hu("keys");Fa.exports=function(r){return _a[r]||(_a[r]=du(r))}});var Da=p((bm,Ba)=>{"use strict";var fu=G();Ba.exports=!fu(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var Ga=p((gm,Ua)=>{"use strict";var mu=Ce(),vu=z(),yu=je(),bu=qa(),gu=Da(),Ha=bu("IE_PROTO"),Dr=Object,Cu=Dr.prototype;Ua.exports=gu?Dr.getPrototypeOf:function(r){var e=yu(r);if(mu(e,Ha))return e[Ha];var t=e.constructor;return vu(t)&&e instanceof t?t.prototype:e instanceof Dr?Cu:null}});var Wa=p((Cm,za)=>{"use strict";var Eu=Fe(),Iu=Math.max,Tu=Math.min;za.exports=function(r,e){var t=Eu(r);return t<0?Iu(t+e,0):Tu(t,e)}});var Hr=p((Em,Qa)=>{"use strict";var xu=Me(),Su=Wa(),wu=qe(),Ka=function(r){return function(e,t,n){var i=xu(e),a=wu(i);if(a===0)return!r&&-1;var o=Su(n,a),c;if(r&&t!==t){for(;a>o;)if(c=i[o++],c!==c)return!0}else for(;a>o;o++)if((r||o in i)&&i[o]===t)return r||o||0;return!r&&-1}};Qa.exports={includes:Ka(!0),indexOf:Ka(!1)}});var Xa=p((Im,Ya)=>{"use strict";Ya.exports={}});var es=p((Tm,Ja)=>{"use strict";var Au=K(),Ur=Ce(),Ru=Me(),Ou=Hr().indexOf,ku=Xa(),Za=Au([].push);Ja.exports=function(r,e){var t=Ru(r),n=0,i=[],a;for(a in t)!Ur(ku,a)&&Ur(t,a)&&Za(i,a);for(;e.length>n;)Ur(t,a=e[n++])&&(~Ou(i,a)||Za(i,a));return i}});var rs=p((xm,ts)=>{"use strict";ts.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var is=p((Sm,ns)=>{"use strict";var Pu=es(),Vu=rs();ns.exports=Object.keys||function(e){return Pu(e,Vu)}});var us=p((wm,ls)=>{"use strict";var ss=ce(),Mu=G(),os=K(),ju=Ga(),Nu=is(),$u=Me(),Lu=sr().f,cs=os(Lu),_u=os([].push),Fu=ss&&Mu(function(){var r=Object.create(null);return r[2]=2,!cs(r,2)}),as=function(r){return function(e){for(var t=$u(e),n=Nu(t),i=Fu&&ju(t)===null,a=n.length,o=0,c=[],s;a>o;)s=n[o++],(!ss||(i?s in t:cs(t,s)))&&_u(c,r?[s,t[s]]:t[s]);return c}};ls.exports={entries:as(!0),values:as(!1)}});var ps=p(()=>{"use strict";var qu=_e(),Bu=us().values;qu({target:"Object",stat:!0},{values:function(e){return Bu(e)}})});var ds=p((Om,hs)=>{"use strict";ps();var Du=mt();hs.exports=Du.Object.values});var ms=p((km,fs)=>{"use strict";var Hu=ds();fs.exports=Hu});var Lt=p((Pm,vs)=>{"use strict";var Uu=ms();vs.exports=Uu});var gs=p(()=>{"use strict";var Gu=_e(),zu=Hr().includes,Wu=G(),Ku=Ct(),Qu=Wu(function(){return!Array(1).includes()});Gu({target:"Array",proto:!0,forced:Qu},{includes:function(e){return zu(this,e,arguments.length>1?arguments[1]:void 0)}});Ku("includes")});var Es=p((Lm,Cs)=>{"use strict";gs();var Yu=Et();Cs.exports=Yu("Array","includes")});var Ts=p((_m,Is)=>{"use strict";var Xu=Es();Is.exports=Xu});var _t=p((Fm,xs)=>{"use strict";var Zu=Ts();xs.exports=Zu});var Qr=p((av,Os)=>{"use strict";var ip=Ve();Os.exports=Array.isArray||function(e){return ip(e)==="Array"}});var Ps=p((sv,ks)=>{"use strict";var ap=TypeError,sp=9007199254740991;ks.exports=function(r){if(r>sp)throw ap("Maximum allowed index exceeded");return r}});var js=p((ov,Ms)=>{"use strict";var op=Qr(),cp=qe(),lp=Ps(),up=Ar(),Vs=function(r,e,t,n,i,a,o,c){for(var s=i,l=0,m=o?up(o,c):!1,y,b;l<n;)l in t&&(y=m?m(t[l],l,e):t[l],a>0&&op(y)?(b=cp(y),s=Vs(r,e,y,b,s,a-1)-1):(lp(s+1),r[s]=y),s++),l++;return s};Ms.exports=Vs});var Ls=p((cv,$s)=>{"use strict";var pp=Ne(),hp=pp("toStringTag"),Ns={};Ns[hp]="z";$s.exports=String(Ns)==="[object z]"});var Fs=p((lv,_s)=>{"use strict";var dp=Ls(),fp=z(),qt=Ve(),mp=Ne(),vp=mp("toStringTag"),yp=Object,bp=qt(function(){return arguments}())==="Arguments",gp=function(r,e){try{return r[e]}catch(t){}};_s.exports=dp?qt:function(r){var e,t,n;return r===void 0?"Undefined":r===null?"Null":typeof(t=gp(e=yp(r),vp))=="string"?t:bp?qt(e):(n=qt(e))==="Object"&&fp(e.callee)?"Arguments":n}});var Bs=p((uv,qs)=>{"use strict";var Cp=K(),Ep=z(),Yr=bt(),Ip=Cp(Function.toString);Ep(Yr.inspectSource)||(Yr.inspectSource=function(r){return Ip(r)});qs.exports=Yr.inspectSource});var Ws=p((pv,zs)=>{"use strict";var Tp=K(),xp=G(),Ds=z(),Sp=Fs(),wp=vt(),Ap=Bs(),Hs=function(){},Us=wp("Reflect","construct"),Xr=/^\s*(?:class|function)\b/,Rp=Tp(Xr.exec),Op=!Xr.test(Hs),Xe=function(e){if(!Ds(e))return!1;try{return Us(Hs,[],e),!0}catch(t){return!1}},Gs=function(e){if(!Ds(e))return!1;switch(Sp(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Op||!!Rp(Xr,Ap(e))}catch(t){return!0}};Gs.sham=!0;zs.exports=!Us||xp(function(){var r;return Xe(Xe.call)||!Xe(Object)||!Xe(function(){r=!0})||r})?Gs:Xe});var Xs=p((hv,Ys)=>{"use strict";var Ks=Qr(),kp=Ws(),Pp=ge(),Vp=Ne(),Mp=Vp("species"),Qs=Array;Ys.exports=function(r){var e;return Ks(r)&&(e=r.constructor,kp(e)&&(e===Qs||Ks(e.prototype))?e=void 0:Pp(e)&&(e=e[Mp],e===null&&(e=void 0))),e===void 0?Qs:e}});var Js=p((dv,Zs)=>{"use strict";var jp=Xs();Zs.exports=function(r,e){return new(jp(r))(e===0?0:e)}});var eo=p(()=>{"use strict";var Np=_e(),$p=js(),Lp=je(),_p=qe(),Fp=Fe(),qp=Js();Np({target:"Array",proto:!0},{flat:function(){var e=arguments.length?arguments[0]:void 0,t=Lp(this),n=_p(t),i=qp(t,0);return i.length=$p(i,t,t,n,0,e===void 0?1:Fp(e)),i}})});var to=p(()=>{"use strict";var Bp=Ct();Bp("flat")});var no=p((bv,ro)=>{"use strict";eo();to();var Dp=Et();ro.exports=Dp("Array","flat")});var ao=p((gv,io)=>{"use strict";var Hp=no();io.exports=Hp});var oo=p((Cv,so)=>{"use strict";var Up=ao();so.exports=Up});var yn="1.0.31-dev.aa15be9d.0";function Qt(r,e=1){let t="0",n="0",i="0";return r.length===4?(t="0x"+r[1]+r[1],n="0x"+r[2]+r[2],i="0x"+r[3]+r[3]):r.length===7&&(t="0x"+r[1]+r[2],n="0x"+r[3]+r[4],i="0x"+r[5]+r[6]),`rgba(${+t},${+n},${+i},${e})`}var D="interactive",Bo="interactive-controls-container",nt=()=>document.querySelector(`.${Bo}`),bn=.4,F={textColor:"#000",textSize:.4,textContent:"",roundCorners:0,borderWidth:0,borderColor:"#000",borderAlpha:1,backgroundColor:"#fff",backgroundAlpha:1,innerSizesDependOn:"self",angle:0},gn=(n=>(n.top="flex-start",n.bottom="flex-end",n.center="center",n))(gn||{}),Cn=(n=>(n.start="flex-start",n.end="flex-end",n.center="center",n))(Cn||{}),En=(n=>(n.start="left",n.end="right",n.center="center",n))(En||{}),it=({target:r,props:e})=>{var t,n,i;r.style.alignItems=(t=(e==null?void 0:e.gravityVertical)&&gn[e.gravityVertical])!=null?t:"center",r.style.justifyContent=(n=(e==null?void 0:e.gravityHorizontal)&&Cn[e.gravityHorizontal])!=null?n:"center",r.style.textAlign=(i=(e==null?void 0:e.alignment)&&En[e.alignment])!=null?i:"center"},at=({target:r,props:e,fallback:t,dependsOn:n})=>{var i,a,o,c,s,l;r.style.color=(a=(i=e==null?void 0:e.text)==null?void 0:i.color)!=null?a:t.textColor,r.style.fontSize=`calc(${n.height} * ${(c=(o=e==null?void 0:e.text)==null?void 0:o.size)!=null?c:t.textSize})`,r.textContent=(l=(s=e==null?void 0:e.text)==null?void 0:s.value)!=null?l:t.textContent},st=({target:r,props:e,fallback:t})=>{var n,i,a,o;r.style.backgroundColor=Qt((i=(n=e==null?void 0:e.background)==null?void 0:n.color)!=null?i:t.backgroundColor,(o=(a=e==null?void 0:e.background)==null?void 0:a.alpha)!=null?o:t.backgroundAlpha)},ot=({target:r,props:e,fallback:t,dependsOn:n})=>{var i,a,o,c,s,l,m,y,b,C,S;r.style.border=`calc(${n.height} * ${(o=(a=(i=e==null?void 0:e.shape)==null?void 0:i.border)==null?void 0:a.width)!=null?o:t.borderWidth}) solid ${Qt((l=(s=(c=e==null?void 0:e.shape)==null?void 0:c.border)==null?void 0:s.color)!=null?l:t.borderColor,(b=(y=(m=e==null?void 0:e.shape)==null?void 0:m.border)==null?void 0:y.alpha)!=null?b:t.borderAlpha)}`,r.style.borderRadius=`calc(${n.height} * ${(S=(C=e==null?void 0:e.shape)==null?void 0:C.roundCorners)!=null?S:t.roundCorners})`},ye=({target:r,layoutParams:e,fallback:t})=>{var i;let n=(i=e.angle)!=null?i:t.angle;n=n&&n*-1,r.style.transform=`rotate(${n}rad)`};var re=class{constructor(e){this.control=e;this.container=null;this.controlElement=null;this.clickListener=null}createContainerElement(e){var i;let t=document.createElement("div");t.classList.add(`${D}-control-container-${this.control.id}`),e(t,this.control.layoutParams);let n=((i=this.control.layoutParams.innerSizesDependOn)!=null?i:F.innerSizesDependOn)==="self"?{height:t.style.height,width:t.style.width}:{height:"var(--interactive-content-height)",width:"var(--interactive-content-width)"};this.container={element:t,dimensions:n}}createClickListener(e){return t=>{t.stopPropagation(),e()}}setEvents(e){!this.container||!this.control.events||this.control.events.forEach(t=>{var i;switch(t.type.trim().toLowerCase()){case"onclick":this.clickListener=this.createClickListener(()=>e({action:t.action,controlId:this.control.id,controlType:this.control.type})),(i=this.container)==null||i.element.addEventListener("click",this.clickListener);break;default:break}})}removeListeners(){var e,t;(e=this.container)!=null&&e.element&&this.clickListener&&((t=this.container)==null||t.element.removeEventListener("click",this.clickListener))}};var Yt="int",oe=(n=>(n.AREA=`${Yt}_area`,n.TEXT=`${Yt}_text`,n.BUTTON=`${Yt}_bttn`,n))(oe||{});var ct=r=>{if(r.type.trim().toLowerCase()==="area")return new Xt(r)},Xt=class extends re{constructor(e){super(e)}createView({parentElement:e,layoutCallback:t}){if(super.createContainerElement(t),!this.container)return;let n=document.createElement("button");n.type="button",n.classList.add(`${D}-${this.control.id}`),n.setAttribute("data-testid",oe.AREA),n.style.display="flex",n.style.width="100%",n.style.height="100%",n.style.cursor="pointer",st({target:n,props:this.control.props,fallback:x(d({},F),{backgroundColor:"transparent"})}),ot({target:n,props:this.control.props,fallback:x(d({},F),{borderAlpha:0}),dependsOn:this.container.dimensions}),ye({target:n,layoutParams:this.control.layoutParams,fallback:F}),this.container.element.append(n),e.append(this.container.element),this.controlElement=n}disable(){this.controlElement&&(this.controlElement.style.cursor="default")}enable(){this.controlElement&&(this.controlElement.style.cursor="pointer")}getElement(){return this.controlElement}};var lt=r=>{let e=document.createElement("span");switch(r){case"Button":case"button":{let t=document.createElement("div"),n={overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center"};Object.assign(t.style,n),t.append(e);let i={display:"inline-block",whiteSpace:"pre",textOverflow:"ellipsis",maxWidth:"initial",maxHeight:"100%",wordBreak:"normal"};return Object.assign(e.style,i),t}default:{let t={display:"inline-block",whiteSpace:"break-spaces",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",maxHeight:"100%",wordBreak:"break-all"};return Object.assign(e.style,t),e}}};var ut=r=>{if(r.type.trim().toLowerCase()==="button")return new Zt(r)},Zt=class extends re{constructor(e){super(e)}createView({parentElement:e,layoutCallback:t}){var o;if(super.createContainerElement(t),!this.container)return;let n=document.createElement("button");n.type="button",n.classList.add(`${D}-${this.control.id}`),n.setAttribute("data-testid",oe.BUTTON),n.style.display="flex",n.style.width="100%",n.style.height="100%",n.style.cursor="pointer",n.style.fontFamily="inherit",ye({target:n,layoutParams:this.control.layoutParams,fallback:F}),st({target:n,props:this.control.props,fallback:F}),ot({target:n,props:this.control.props,fallback:F,dependsOn:this.container.dimensions}),it({target:n,props:x(d({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let i=lt(this.control.type.trim().toLowerCase()),a=(o=i.firstElementChild)!=null?o:i;at({target:a,props:this.control.props,fallback:F,dependsOn:this.container.dimensions}),n.append(i),this.container.element.append(n),e.append(this.container.element),this.controlElement=n}disable(){this.controlElement&&(this.controlElement.style.cursor="default")}enable(){this.controlElement&&(this.controlElement.style.cursor="pointer")}getElement(){return this.controlElement}};var In=r=>{if(r.type.trim().toLowerCase()==="text")return new Jt(r)},Jt=class extends re{constructor(e){super(e)}createView({parentElement:e,layoutCallback:t}){var o;if(super.createContainerElement(t),!this.container)return;let n=document.createElement("div");n.classList.add(`${D}-${this.control.id}`),n.setAttribute("data-testid",oe.TEXT),n.style.display="flex",n.style.width="100%",n.style.height="100%",n.style.fontFamily="inherit",ye({target:n,layoutParams:this.control.layoutParams,fallback:F}),it({target:n,props:x(d({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let i=lt(this.control.type.trim().toLowerCase()),a=(o=i.firstElementChild)!=null?o:i;at({target:a,props:this.control.props,fallback:F,dependsOn:this.container.dimensions}),n.append(i),this.container.element.append(n),e.append(this.container.element),this.controlElement=n}disable(){}enable(){}getElement(){return this.controlElement}};var er=class{constructor(e){this.layout=e}},pt=class extends er{constructor(e){super(e)}setContainerLayout(e){e.style.position="relative"}setControlLayout(e,t){e.style.position="absolute",e.style.width=`calc(var(--interactive-content-width) * ${t.width})`,e.style.height=`calc(var(--interactive-content-height) * ${t.height})`,e.style.left=`calc(var(--interactive-content-width) * ${t.x} + ((var(--interactive-width) - var(--interactive-content-width)) / 2))`,e.style.top=`calc(var(--interactive-content-height) * ${t.y} + ((var(--interactive-height) - var(--interactive-content-height)) / 2))`}};var be=class{constructor(e){this.container=e,this.factories=new Map,this.controls=[],this.setControls()}addControlFactory(e,t){this.factories.set(e.trim().toLowerCase(),t),this.setControls()}removeControlFactory(e){this.factories.delete(e.trim().toLowerCase()),this.setControls()}setControls(){this.controls=this.chooseControls()}chooseControls(){var e;return((e=this.container.controls)==null?void 0:e.reduce((t,n)=>{let i=n.type.trim().toLowerCase(),a=this.factories.get(i);if(a){let o=a(n);if(o)return[...t,o]}return[...t]},[]))||[]}};var ht=(r,e)=>{if(r.type.trim().toLowerCase()==="choice")return new tr(r,e)},tr=class extends be{constructor(e,t){super(e),this.rootElement=t!=null?t:nt(),this.layout=new pt(this.container.layout),this.isRemoved=!1,this.isDisabled=!1,this.addControlFactory("button",ut),this.addControlFactory("text",In),this.addControlFactory("area",ct)}createView(e){let t=document.createElement("div");return t.classList.add(`${D}-${this.container.id}`),this.layout.setContainerLayout(t),this.controls.forEach(n=>{n.createView({parentElement:t,layoutCallback:this.layout.setControlLayout}),n.setEvents(e)}),this.rootElement.append(t),this.isRemoved=!1,t}hide(){let e=this.getElement();e&&(e.style.visibility="hidden")}show(){let e=this.getElement();e&&(e.style.visibility="visible")}enable(){let e=this.getElement();e&&(this.controls.forEach(t=>t.enable()),e.style.opacity="1",this.isDisabled=!1)}disable(){let e=this.getElement();e&&(this.controls.forEach(t=>t.disable()),e.style.opacity=`${bn}`,this.isDisabled=!0)}removeView(e=!1){var t;(!this.isRemoved||e)&&(this.controls.forEach(n=>n.removeListeners()),(t=this.getElement())==null||t.remove(),this.isRemoved=!0)}fakeRemove(){this.isRemoved||(this.isRemoved=!0)}getElement(){return this.rootElement.querySelector(`.${D}-${this.container.id}`)}};var Vo=te(Vr(),1);import{clientChecker as th,combine as rh,InterfaceLanguage as nh,Observable as Oo,once as ih,Subject as q,Subscription as nn,ValueSubject as H,fromEvent as ko}from"@vkontakte/videoplayer-shared/es2015";import{InteractiveInterfaceClick as et}from"@vkontakte/videoplayer-statistics/es2015";import{loadVKLangPack as nu}from"@vkontakte/videoplayer-shared/es2015";function Be(r,e){let t;return(...n)=>{clearTimeout(t),t=setTimeout(()=>r(...n),e)}}var le=(r,e)=>Object.prototype.toString.call(r)===`[object ${e}]`,De=r=>le(r,"Object"),It=r=>le(r,"String"),Tt=r=>le(r,"Array"),xt=r=>le(r,"Number"),Sa=r=>le(r,"Function");var Mr=r=>xt(r)&&!isNaN(r);var ue=r=>De(r)&&Object.keys(r).length===0,jr=r=>Tt(r)&&!r.length;var He=(r,e)=>It(r)&&(e?r.trim():r).length;var wa="video_interactive",Aa="videoint";var Ra=250,Ue=class{constructor(e){this.handleZoomChange=Be(e=>{this.lastZoomInfo=e},Ra);this.onResize=e=>{var n;if(!this.isReady||this.isHidden||!e[0].contentRect.width||!e[0].contentRect.height)return;let t=this.getNextPoint();t&&((n=this.ngEditor)==null||n.zoomTo(t)),this.ngEditorSize={width:e[0].contentRect.width,height:e[0].contentRect.height}};this.handleChapterChange=e=>{var t,n,i;if(this.manifest){if(this.isHidden||this.hide(),!(e!=null&&e.id)){(t=this.onError)==null||t.call(this,"Id is not found"),console.error("Id is not found");return}this.visitedChapterIds.add(e.id),(n=this.ngEditor)==null||n.selectChapter(e.id),(i=this.ngEditor)==null||i.setVisitedChapters(Array.from(this.visitedChapterIds)),this.currentChapterId=e.id,this.lastZoomInfo=null}};this.handleManifestChange=(e,t=[])=>{var n;if(this.isReady=!1,!xt(e.graph.edit.chapters[0].x)){(n=this.onError)==null||n.call(this,"Can't show graph"),console.error("Can't show graph");return}this.lastZoomInfo=null,this.manifest=e,this.visitedChapterIds=new Set(t),this.ngEditor&&(this.manifest.metadata.id!==this.currentManifestId?(this.ngEditor.update(e),this.currentManifestId=this.manifest.metadata.id):this.ngEditor.setVisitedChapters(Array.from(t)),this.isReady=!0)};this.init(e)}init({root:e,onOpenPreviewClick:t,onError:n,lang:i,visitedChapters:a=[]}){this.isReady=!1,this.isHidden=!0,this.manifest=null,this.visitedChapterIds=new Set(a),this.onOpenPreviewClick=t,this.onError=n,this.lang=i!=null?i:"ru",this.zoom=.7,this.lastZoomInfo=null,this.currentManifestId=null,this.currentChapterId=null,this.ngEditor=null,this.ngEditorSize=null,this.graphWrapperElement=iu(e),this.resizeObserver=new ResizeObserver(Be(this.onResize,Ra)),this.resizeObserver.observe(this.graphWrapperElement)}getNextPoint(e=this.ngEditorSize){return!this.lastZoomInfo||!e?null:[(this.lastZoomInfo.x-e.width/2)/this.lastZoomInfo.value*-1,(this.lastZoomInfo.y-e.height/2)/this.lastZoomInfo.value*-1]}setVisitedChapters(e){var t;this.visitedChapterIds=new Set([...this.visitedChapterIds,...e]),(t=this.ngEditor)==null||t.setVisitedChapters(Array.from(this.visitedChapterIds))}updateVideosInfo(e){var t;(t=this.ngEditor)==null||t.updateVideosInfo(e)}show(){return k(this,null,function*(){var e;this.manifest&&(this.ngEditor||(yield this.initNgEditor()),this.graphWrapperElement.style.display="block",!this.lastZoomInfo&&this.currentChapterId&&((e=this.ngEditor)==null||e.focusChapter(this.currentChapterId)),this.isHidden=!1)})}initNgEditor(){return k(this,null,function*(){if(!this.manifest)return;let e;try{e=yield nu(this.lang,wa,Aa)}catch(n){console.log("Unable to load graph language pack")}let{GraphEditor:t}=yield import("@interactiveplatform/movika-graph-editor");this.ngEditor=new t(this.graphWrapperElement,{mode:"read",lang:this.lang==="ru"?"ru":"en",translation:e}),this.currentManifestId=this.manifest.metadata.id,this.ngEditor.update(this.manifest),this.ngEditor.setVisitedChapters(Array.from(this.visitedChapterIds)),this.currentChapterId&&this.ngEditor.selectChapter(this.currentChapterId),this.ngEditor.on("control",a=>{var o=a,{name:n}=o,i=X(o,["name"]);var c;n==="openPreview"&&"chapterId"in i&&((c=this.onOpenPreviewClick)==null||c.call(this,i.chapterId))}),this.ngEditor.on("zoom",this.handleZoomChange),this.isReady=!0})}hide(){this.graphWrapperElement.style.display="none",this.isHidden=!0}destroy(){var e,t;this.hide(),this.manifest=null,this.resizeObserver.disconnect(),(e=this.ngEditor)==null||e.setVisitedChapters([]),this.onOpenPreviewClick=void 0,(t=this.ngEditor)==null||t.dispose(),this.graphWrapperElement.remove(),this.isReady=!1}};function iu(r){let e=document.createElement("div");return e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.height="100%",e.style.width="100%",e.style.display="none",r.append(e),e}var Ge=class{constructor(){this._containers=[];this._player=null;this.setPlayer=e=>{this._player=e};this.setContainers=e=>{this._containers=e};this.deleteContainer=e=>{this._containers=this._containers.filter(t=>t.id!==e)};this.getNextInteractiveTime=(e=3e3)=>{if(!this._containers.length||this._player===null)return null;let t=-1,n=!1,i=Math.round(this._player.info.position$.getValue()*1e3);for(let a of this._containers){let o=a.startTime-e;if(o<=i&&(a.endTime&&i<=a.endTime||a.endTime===null)){n=!0;break}i<o&&(t=t===-1?o:Math.min(t,o))}return!n&&t!==-1?t:null}}};import{isSupportedManifest as wt,ContainerTypes as Af,ControlTypes as At,EventActionTypes as V,EventTypes as Rf,migrateManifestToLatestVersion as Va,compareVersions as Of}from"@interactiveplatform/movika-manifest";var Oa={metadata:"Object",chapters:"Array"},ka=r=>{if(!De(r))return!1;for(let e in Oa)if(!r[e]||!le(r[e],Oa[e]))return!1;return wt(r.metadata.version)},St=r=>r.type===At.Text,gf=r=>r.type===At.Button,Cf=r=>r.type===At.Area,Ef={Choice:"Choice",TextInput:"TextInput"},If={Button:"Button",Area:"Area",Text:"Text"},Tf={onClick:"onClick",onSuspense:"onSuspense"},Pa={openURI:"openURI",setNextBranch:"setNextBranch",setWeightlessRandomBranch:"setWeightlessRandomBranch",setRandomBranch:"setRandomBranch",setMaxWeightBranch:"setMaxWeightBranch",setMinWeightBranch:"setMinWeightBranch",setDefaultBranch:"setDefaultBranch",continuePlayback:"continuePlayback",expect:"expect"};var _=class{constructor(e,t,...n){this.severity=e;this.category=t;this.data=n}toString(){return`Interactive SDK error ${JSON.stringify(this,null," ")}`}};var Rt=class{constructor(){this.listeners={}}addListener(e,t){return this.listeners[e]=this.listeners[e]||[],this.listeners[e].push(t),this}on(e,t){return this.addListener(e,t)}once(e,t){this.listeners[e]=this.listeners[e]||[];let n=()=>{t(),this.off(e,n)};return this.listeners[e].push(n),this}off(e,t){return this.removeListener(e,t)}reset(){this.listeners={}}removeListener(e,t){let n=this.listeners[e]||[];for(let i=n.length;i>0;i--)if(n[i]===t){n.splice(i,1);break}return this}emit(e,...t){let n=this.listeners[e];return n?(n.forEach(i=>{i(...t)}),!0):!1}listenerCount(e){return this.rawListeners(e).length}rawListeners(e){return this.listeners[e]||[]}};var Ot=class{constructor(e){this.fns=[];this.addFn=(e,t=!1)=>{Sa(e)&&(this.fns.push(e),t&&this.updateFn())};this.removeFn=(e,t=!1)=>{this.fns=this.fns.filter(n=>n!==e),t&&this.updateFn()};this.updateFn=()=>{this.fn=()=>{this.fns.forEach(e=>e()),this.raf&&this.forceRequestAnimation()}};this.forceRequestAnimation=()=>{this.fn&&(this.raf=requestAnimationFrame(this.fn))};this.requestAnimation=()=>{this.raf||this.forceRequestAnimation()};this.cancelAnimation=()=>{this.raf&&(cancelAnimationFrame(this.raf),this.raf=void 0)};e&&(this.fn=e,this.addFn(e))}release(){this.cancelAnimation(),this.fn=void 0,this.fns=[]}};import{ValueSubject as pu}from"@vkontakte/videoplayer-shared/es2015";var kt=class{constructor(e){var t,n;this.loaders={chapterLoaders:(t=e==null?void 0:e.chapterLoaders)!=null?t:[],manifestLoaders:(n=e==null?void 0:e.manifestLoaders)!=null?n:[]}}exec(e,t){return k(this,null,function*(){return au(...this.loaders[e])(t)})}};function au(...r){return function(t){return k(this,null,function*(){let n=[...r];for(;n.length>0;)t=yield n.shift()(t);return t})}}function ze(r,e,t){return r?x(d({},r),{[e]:r[e]?[t,...r[e]]:[t]}):{[e]:[t]}}function Pt(i){var a=i,{actions:r,errors:e,chapterId:t}=a,n=X(a,["actions","errors","chapterId"]);if(t){let o=r.getManifest();if(o){let c=r.getChapter(o.chapters,t);if(c){let s=r.getMedia(o.media,c.videoId),l=r.getGraph(o.graph,c.id);return s?x(d({},n),{actions:r,errors:e,result:{chapter:c,media:s,graph:l}}):x(d({},n),{errors:ze(e,Pt.name,"Could not find media"),actions:r})}}}return x(d({},n),{errors:ze(e,Pt.name,"Could not find chapter"),actions:r})}var Vt=class{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(e,t,n){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:t,options:n})}removeEventListener(e,t){if(!(e in this.listeners))return;let n=this.listeners[e];for(let i=0,a=n.length;i<a;i++)if(n[i].callback===t){n.splice(i,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let n=this.listeners[e.type].slice();for(let i=0,a=n.length;i<a;i++){let o=n[i];try{o.callback.call(this,e)}catch(c){Promise.resolve().then(()=>{throw c})}o.options&&o.options.once&&this.removeEventListener(e.type,o.callback)}return!e.defaultPrevented}},xe=class extends Vt{constructor(){super(),this.listeners||Vt.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(e){e.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,e)),super.dispatchEvent(e)}},We=class{constructor(){Object.defineProperty(this,"signal",{value:new xe,writable:!0,configurable:!0})}abort(e){let t;try{t=new Event("abort")}catch(i){typeof document!="undefined"?document.createEvent?(t=document.createEvent("Event"),t.initEvent("abort",!1,!1)):(t=document.createEventObject(),t.type="abort"):t={type:"abort",bubbles:!1,cancelable:!1}}let n=e;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(i){n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(t)}toString(){return"[object AbortController]"}};typeof Symbol!="undefined"&&Symbol.toStringTag&&(We.prototype[Symbol.toStringTag]="AbortController",xe.prototype[Symbol.toStringTag]="AbortSignal");function Mt(r){return r.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof r.Request=="function"&&!r.Request.prototype.hasOwnProperty("signal")||!r.AbortController}function Nr(r){typeof r=="function"&&(r={fetch:r});let{fetch:e,Request:t=e.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=r;if(!Mt({fetch:e,Request:t,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i}))return{fetch:e,Request:a};let a=t;(a&&!a.prototype.hasOwnProperty("signal")||i)&&(a=function(l,m){let y;m&&m.signal&&(y=m.signal,delete m.signal);let b=new t(l,m);return y&&Object.defineProperty(b,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),b},a.prototype=t.prototype);let o=e;return{fetch:(s,l)=>{let m=a&&a.prototype.isPrototypeOf(s)?s.signal:l?l.signal:void 0;if(m){let y;try{y=new DOMException("Aborted","AbortError")}catch(C){y=new Error("Aborted"),y.name="AbortError"}if(m.aborted)return Promise.reject(y);let b=new Promise((C,S)=>{m.addEventListener("abort",()=>S(y),{once:!0})});return l&&l.signal&&delete l.signal,Promise.race([b,o(s,l)])}return o(s,l)},Request:a}}var Ke=Mt({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),Ma=Ke?Nr({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,$r=Ke?Ma.fetch:window.fetch,Kf=Ke?Ma.Request:window.Request,Qf=Ke?We:window.AbortController,Yf=Ke?xe:window.AbortSignal;var Lr=(r="",e="")=>{let t=r.split("."),n=e.split("."),i=0;for(let a=0;a<Math.max(t.length,n.length)&&!i;a++)t[a]>n[a]?i=1:t[a]<n[a]?i=-1:i=0;return i};var su=r=>k(void 0,null,function*(){try{let e={},t;if(It(r)){t=new URL(r).href;let i=yield $r(t);if(!i.ok)return{};e=yield i.json()}else if(De(r))e=r;else return{};if(!ka(e))return{};let n=e.metadata.media;if(It(n)&&!("media"in e))try{let i;t?i=new URL(n,t).href:(i=new URL(n).href,t=i);let a=yield $r(i);if(!a.ok)throw new Error;e.metadata.media=yield a.json()}catch(i){return lu(e.metadata.version)?{manifest:e}:{}}return{manifest:e,manifestURL:t}}catch(e){return{}}});function ja(r){return k(this,null,function*(){let{manifest:e,manifestURL:t}=yield su(r);if(!e)throw new Error("Failed on fetch");let n=Va(e);return n.media=ou(n.media,t),delete n.metadata.media,n})}function jt(r,e){if(e)return r.find(t=>t.id===e)}function _r(r,e){var t,n;return(t=r.edit)!=null&&t.chapters?r.edit.chapters.find(i=>i.id===e):(n=r.view)!=null&&n.chapters?r.view.chapters.find(i=>i.id===e):void 0}function Fr(r,e){return r.videos.find(t=>t.id===e)}function ou(r,e){return x(d({},r),{videos:r.videos.map(t=>x(d({},t),{variants:t.variants.map(n=>{let i="url"in n?n.url:"",a=cu(i,e);return x(d({},n),{url:a||i})})}))})}function cu(r="",e){try{return new URL(r,e).href}catch(t){return""}}function lu(r){return Lr(r,"3.2.0")>=0}var Nt=r=>Tt(r)&&!jr(r),J=r=>r.order==="end",$t=r=>Tt(r.containers)&&!jr(r.containers)&&J(r),Na=(r,e)=>{var n;let t=r*1e3;return Nt(e.controls)&&t<((n=e.startTime)!=null?n:0)},qr=(r,e)=>{var n,i;let t=r*1e3;return Nt(e.controls)&&t>=((n=e.startTime)!=null?n:0)&&t<=((i=e.endTime)!=null?i:1/0)};var pe=(r=[])=>r.some(e=>e.action.type==="expect"),Br=(r=[])=>r.find(e=>e.action.type==="expect"),uu=r=>(r==null?void 0:r.length)===1,Se=r=>uu(r)&&St(r[0]);function $a(r,...e){return t=>typeof e[0]=="object"&&typeof t=="object"?r(d(d({},e[0]),t)):r(...e,...t)}var La=(r,e)=>{let t=E=>{let v=e.find(({container:R})=>R.container.id===E);return v==null?void 0:v.container.isRemoved},n=pe(r.events)&&!t(r.id),i=(E,v=!1,R=!1)=>{let h=R?"every":"some";return E.controls[h](u=>{var I;let f=v?E.endTime===r.endTime:!0;return((I=u.events)==null?void 0:I[h](T=>{var g;return((g=T.action)==null?void 0:g.type)===Pa.openURI}))&&f})},a=E=>E.some(({container:v})=>i(v.container,!0,!1)&&!v.isRemoved),o=E=>E.every(({container:v})=>v.isRemoved?!0:i(v.container,!0,!0)),c=e.filter(({container:E})=>E.container.id!==r.id&&pe(E.container.events)&&E.container.endTime===r.endTime&&!E.isRemoved).length,s=E=>E.controls.some(v=>{var R;return(R=v.events)==null?void 0:R.some(h=>{var u,f;return(f=(u=h.action)==null?void 0:u.args)==null?void 0:f.shouldOpenNow})}),l=n||c>0,m=a(e),y=i(r),b=o(e),C=n?!1:c>0,S=s(r);return{isExpectTime:l,hasOtherExpect:c>0,hasOpenURIEvent:m,hasOpenURIEventInCurrentContainer:y,isAllOpenURIEventsValid:b,isExpectEventForCurrentContainer:C,hasShouldOpenNowEvent:S}};var we=class extends kt{constructor(t,n){super(t);this.manifest=null;this.chapter=null;this.media=null;this.graph=null;this.prevChapter$=new pu(null);this.onError=n,this.release()}release(){return this.manifest=null,this.chapter=null,this.media=null,this.graph=null,this.prevChapter$.next(null),this}setManifest(t){return k(this,null,function*(){var i;this.release();let n=yield this.exec("manifestLoaders",{actions:{addErrorMessage:ze},result:null,errors:null,source:t});return n.errors&&this.errorHandler(n.errors),this.manifest=yield ja((i=n.result)!=null?i:t),this})}setInitial(){return k(this,null,function*(){return this.setNext()})}setNext(){return k(this,arguments,function*(t=(n=>(n=this.manifest)==null?void 0:n.metadata.initChapterId)()){if(!t)return this;this.prevChapter$.next(this.chapter);let i=yield this.exec("chapterLoaders",Pt({actions:{getManifest:()=>this.manifest,getCurrent:this.getCurrent,getGraph:_r,getChapter:jt,getMedia:Fr,getByBranches:this.getByBranches.bind(this),addErrorMessage:ze},result:null,errors:null,chapterId:t}));return i.errors&&this.errorHandler(i.errors),i.result&&(this.chapter=i.result.chapter,this.media=i.result.media,this.graph=i.result.graph),this})}errorHandler(t){this.onError(t),console.error("Something went wrong with loaders",{errors:t})}getInitial(){var n;return this.getByChapterId((n=this.manifest)==null?void 0:n.metadata.initChapterId)||null}getByChapterId(t=(n=>(n=this.manifest)==null?void 0:n.metadata.initChapterId)()){if(!t||!this.manifest)return null;let i=jt(this.manifest.chapters,t);if(i){let a=Fr(this.manifest.media,i.videoId),o=_r(this.manifest.graph,i.id);if(a)return{chapter:i,media:a,graph:o}}return null}getBranches(t=(n=>(n=this.chapter)==null?void 0:n.id)()){var i,a,o;if(t===((i=this.chapter)==null?void 0:i.id))return this.getByBranches((a=this.chapter)==null?void 0:a.branches);{let c=jt(((o=this.manifest)==null?void 0:o.chapters)||[],t);return this.getByBranches(c==null?void 0:c.branches)}}getByBranches(t=[]){return t.reduce((n,i)=>{let a=this.getByChapterId(i.chapterId);return a&&n.push(a),n},[])}getCurrent(){return{chapter:this.chapter,media:this.media,graph:this.graph}}isInitialChapter(){var t,n;return((t=this.chapter)==null?void 0:t.id)===((n=this.manifest)==null?void 0:n.metadata.initChapterId)}isEndChapter(){return this.chapter?J(this.chapter):!1}};var Ss=te(Lt(),1);import{Player as Ju}from"@vkontakte/videoplayer-core/es2015";import{Subscription as Wr,Tracer as ep,ValueSubject as tp}from"@vkontakte/videoplayer-shared/es2015";var ys=r=>{let e=r.variants.find(t=>{var n;return((n=t.payload)==null?void 0:n.type)==="vk"});if(e&&e.payload){let[t,n]=e.payload.id.split("_");return[t,n]}return[]};var bs=te(Lt(),1);function Gr(){let r=new Map;function e(s){var l=s,{listId:a=Math.random().toString(),itemId:o=Math.random().toString()}=l,c=X(l,["listId","itemId"]);let m=r.get(a),y=d({},c);return m?m[o]=y:r.set(a,{[o]:y}),d({listId:a,itemId:o},c)}function t(a){var o,c;a.player.destroy(),a.container.remove(),a.subscription.unsubscribe(),(o=a.statistics)==null||o.oneStat.destroy(),(c=a.statistics)==null||c.statSubscription.unsubscribe()}function n(a,o){let c=r.get(a);if(!c)throw Error("Can't remove. Not find.");if(o){let s=c[o];s&&t(s),delete c[o],Object.keys(c).length||r.delete(a)}else{for(let s of(0,bs.default)(c))t(s);r.delete(a)}}function i(){for(let a of r)n(a[0])}return{createPlayer:e,removePlayer:n,map:r,removeAll:i}}var Ae=te(_t(),1);function zr(r,e=[]){var a,o,c;let t={},n,i=!e.length;for(let s of r.variants)if(!n&&"cover"in s&&(n=s.cover),"url"in s)switch(s.type.toLowerCase()){case"mp4":(i||(0,Ae.default)(e,"mp4"))&&(t.MPEG=x(d({},t.MPEG),{[(a=s.standard)!=null?a:"Invariant quality"]:s.url}));break;case"mpeg":(i||(0,Ae.default)(e,"mpeg"))&&(t.MPEG=x(d({},t.MPEG),{[(o=s.standard)!=null?o:"Invariant quality"]:s.url}));break;case"hls":(i||(0,Ae.default)(e,"hls"))&&(t=x(d({},t),{HLS:{type:"url",url:s.url}}));break;case"dash":(i||(0,Ae.default)(e,"dash"))&&(t=x(d({},t),{DASH_SEP:{compatibilityMode:!0,type:"url",url:s.url}}));break;default:break}return{sources:t,thumbUrl:n,title:(c=r.title)!=null?c:""}}var Qe=(r,e)=>{let t=r.info.currentQuality$.getValue(),n=r.info.availableQualities$.getValue();t!==e&&(0,Ae.default)(n,e)&&(r.setQuality(e),r.setAutoQuality(!1))};var rp=2;function Kr(r){let e=Gr(),t=new Wr,n={},i=null,a=!1,o,c=new tp(null);r&&s(r);function s(v){i=v}function l(v,R,h){var I;if(!i)throw Error("need to set interactive controller");if(!i.options)return;let f=((I=e.map.get(v))!=null?I:{})[R];if(f){n=d({chapterId:h,listId:v,itemId:R},f);let T=n.player;n.subscription.add(T.info.currentQuality$.subscribe(g=>{let A=T.info.position$.getValue(),L=T.info.isAutoQualityEnabled$.getValue();if(!(!g||!A||L))for(let O of e.map)(0,Ss.default)(O[1]).forEach(({player:M})=>{Qe(M,g)})})).add(T.events.started$.subscribe(()=>{m(R)})),f.container.remove(),i.setPlayer(f.player),a||(i.init(),a=!0),c.next({player:n.player,config:n.config,statistics:n.statistics});return}throw Error("Can't set. Not find.")}function m(v){return k(this,null,function*(){if(!i)throw Error("need to set interactive controller");if(ue(n)||v!==n.itemId)return;let R=i.getChapterBranches(),h=new Set;for(let u of R)h.has(u.media.id)||(yield b({media:u.media,chapterId:u.chapter.id,setAsActive:!1,title:u.chapter.label}),h.add(u.media.id))})}function y(h){return k(this,arguments,function*({chapter:{id:v},manifestVideo:R}){if(ue(n)||!i)return;let u=n.player.info.muted$.getValue(),f=n.player.info.currentQuality$.getValue(),I=n.player.info.isAutoQualityEnabled$.getValue(),T=n.player.info.volume$.getValue(),g=n.player.info.currentPlaybackRate$.getValue(),A=!I,L=!1;for(let O of e.map)if(O[0]===R.id&&!i.state.isReplay$.getValue()){let M=Object.keys(O[1]);for(let N of M)N===n.itemId?(M.length<rp||(L=!0),e.removePlayer(O[0],N)):(L=!0,l(O[0],N,v),A?Qe(n.player,f):n.player.setAutoQuality(!0),n.player.setVolume(T),n.player.setMuted(u),n.player.setPlaybackRate(g))}else e.removePlayer(O[0]);L||(yield b({media:R,chapterId:v,setAsActive:!0,playbackRate:g}),A?Qe(n.player,f):n.player.setAutoQuality(!0),n.player.setVolume(T),n.player.setMuted(u))})}function b(A){return k(this,arguments,function*({media:v,chapterId:R,prefetch:h=!0,setAsActive:u=!0,autoplay:f=!1,preferredExt:I,title:T,playbackRate:g}){var sn,on,cn,ln,un;let L=Math.random().toString(),O=document.createElement("div");o.append(O);let M;if((sn=i==null?void 0:i.options)!=null&&sn.vkVideoLoader){let tt=ys(v);tt.length&&(M=yield i.options.vkVideoLoader(...tt))}let N=((on=i==null?void 0:i.options)==null?void 0:on.coreConfig)||void 0,Y=x(d({},N),{configName:[...(cn=N==null?void 0:N.configName)!=null?cn:[],"interactive"]}),se=x(d({container:O},((ln=M==null?void 0:M.videos)==null?void 0:ln[0])||{sources:zr(v,I).sources}),{title:T,failoverHosts:(M==null?void 0:M.failoverHosts)||[]}),B=new Ju(Y,ep.createRootTracer());B.initVideo(se);let me=null;if(M!=null&&M.videos&&(i!=null&&i.options.createOneStat)){let tt=M.videos[0],zt=i.options.createOneStat(tt),pn=new Wr;zt&&(pn.add(zt.attachTo(B)),me={oneStat:zt,statSubscription:pn})}let an=new Wr,Mo=(un=n==null?void 0:n.player)==null?void 0:un.info.isAutoQualityEnabled$.getValue();an.add(B.events.canplay$.subscribe(function(){Mo||Qe(B,n.player.info.currentQuality$.getValue()),g&&B.setPlaybackRate(g)}));let ve=e.createPlayer({listId:v.id,itemId:L,player:B,container:O,sources:zr(v,I).sources,config:se,subscription:an,statistics:me});return u&&l(v.id,ve.itemId,R),f&&ve.player.play(),h&&!f&&ve.player.prepare(),{player:ve.player,config:ve.config,statistics:ve.statistics}})}function C(){S(),i=null,o.remove()}function S(){t.unsubscribe(),e.removeAll(),n={},a=!1}function E(){return k(this,null,function*(){if(!i)throw Error("need to set interactive controller");S(),o=document.createElement("div");let{media:v,chapter:R}=i.getCurrentChapter();v&&R?(t.add(i.events.chapterChanged$.subscribe(y)),yield b({media:v,chapterId:R.id,title:R.label})):console.error("not found")})}return x(d({},e),{init:E,setInteractiveController:s,createPlayer:b,removeAll:C,getActivePlayer:function(){return n},activePlayerChanged:c})}var P={graph:"graph",interactives:"interactives",chapterChanged:"chapter-changed",playerChanged:"player-changed",manifestChanged:"manifest-changed",errors:"errors",eachTick:"eachTick",historyInited:"history-inited",historyDestroyed:"history-destroyed"},Ye={visibility:"visibility",watchAgainClicked:"watchAgainClicked"},j={actionChoiceCanceled:"action-choice-canceled",actionChoice:"action-choice",actionExecution:"action-execution",visibility:"visibility",containerRemoved:"container-removed",rangeEnded:"range-ended"};var As=te(_t(),1);import{Subscription as np}from"@vkontakte/videoplayer-shared/es2015";var Ft=class{constructor({player:e,container:t,branches:n,selectBranches:i,interactiveEvents:a,globalEvents:o,globalEventEmitter:c,getContainerEventState:s,permanentTextControls:l,interactiveTimeOpenUri:m,disabledControls$:y,onRemove:b}){this.hide=()=>{setTimeout(()=>{var e,t;this.gameState!==4&&(pe(this.container.container.events)&&this.gameState===3||this.selectBranches.state.isExpect||(this.gameState!==2&&((t=(e=this.container).hide)==null||t.call(e)),this.emitContainerVisibilityEvent(!1)))})};this.show=()=>{var t,n,i,a;if(this.gameState!==2||this.isSelectedControlEvent)return;if(this.container.getElement()){let{hasOpenURIEventInCurrentContainer:o}=this.getContainerEventState();if((n=(t=this.container).show)==null||n.call(t),this.interactiveTimeOpenUri&&o)return;this.emitContainerVisibilityEvent(!0,!1)}else{let o={isDisabled:()=>this.container.isDisabled,branches:this.branches,containerId:this.container.container.id,onDetachContainer:()=>{this.removeView(),this.emitContainerVisibilityEvent(!1)},onEvent:(s,l)=>{let{isExpectTime:m,hasOtherExpect:y,hasOpenURIEvent:b,hasOpenURIEventInCurrentContainer:C,isAllOpenURIEventsValid:S,hasShouldOpenNowEvent:E}=this.getContainerEventState(),v=this.interactiveTimeOpenUri&&!C,R=this.interactiveTimeOpenUri&&C;if((!this.interactiveTimeOpenUri||v)&&(this.isSelectedControlEvent=!0),s!==!1){if(!this.selectBranches.state.isExpect&&(!this.interactiveTimeOpenUri||v)){if(this.interactiveTimeOpenUri){let h=!y&&!S&&C;h&&this.globalEvents.interactiveContainerFakeRemoved$.next({subjectId:this.container.container.id,subjectName:"container",type:"container-fake-removed",removeAllOpenURI:h})}this.removeView()}this.emitContainerVisibilityEvent(!1)}if(this.gameState===4||this.gameState===3||this.selectBranches.state.isExpect||this.interactiveTimeOpenUri&&b&&this.gameState!==5){if(R){let u=((f,I,T,g)=>!f&&!I&&T||f&&!I&&T&&!g||f&&!I&&T&&g)(m,y,S,this.isSelectedContainerEvent);this.fakeRemoveView(u)}else this.removeView(),this.emitContainerVisibilityEvent(!1);(!m||!y||!E)&&(this.selectBranches.stopExpect(),l())}},isEOV:()=>this.gameState===4},c=$a(this.selectBranches.onControlEvent,o);this.container.createView(c),this.emitContainerVisibilityEvent(!0,!0),this.disabledControls$.getValue()&&((a=(i=this.container).disable)==null||a.call(i))}};this.onEndOfVideo=()=>{this.gameState=4,this.selectContainerEvent(!0)};this.whilePlaying=()=>{var l,m,y;let e=this.player.experimental.element$.getValue(),n=e instanceof HTMLVideoElement?e.readyState:void 0,i=[6,5];if(!n||(0,As.default)(i,this.gameState)&&!this.isPermanentText)return;let a=this.player.getExactTime();if(Na(a,this.container.container))this.gameState!==1&&(this.gameState=1,this.onBeforeStartTime());else if(qr(a,this.container.container))this.gameState!==2&&(this.gameState=2,this.onStartTime());else if(this.gameState!==3){let b=this.gameState;this.gameState=3,b===2&&this.onEndTime()}else{let{hasOpenURIEventInCurrentContainer:b}=this.getContainerEventState(),C=this.selectBranches.state.isExpect;if(this.interactiveTimeOpenUri&&b&&!C){let E=this.container.getElement();if(E){if(E.style.visibility==="hidden")return;(m=(l=this.container).hide)==null||m.call(l),this.container.isRemoved||this.fakeRemoveView();return}}this.isPermanentText||this.removeView()}let o=qr(a,this.container.container),c=this.container.container.startTime?[this.container.container.startTime,(y=this.container.container.endTime)!=null?y:1/0]:[],s={subjectId:this.container.container.id,subjectName:"container",range:c,currentTime:a,isInteractiveTime:o};this.globalEventEmitter.emit(P.eachTick,s),this.globalEvents.eachTick$.next(s)};this.container=t,this.branches=n,this.selectBranches=i,this.subscription=new np,this.player=e,this.interactiveEvents=a,this.getContainerEventState=s,this.isPermanentText=l&&Se(t.container.controls),this.interactiveTimeOpenUri=m,this.disabledControls$=y,this.onRemove=b,this.globalEventEmitter=c,this.gameState=0,this.globalEvents=o,this.isSelectedControlEvent=!1,this.isSelectedContainerEvent=!1,this.registerEvents()}emitContainerVisibilityEvent(e,t=!1){e?(this.globalEventEmitter.emit(P.interactives,{subjectId:this.container.container.id,subjectName:"container",type:j.visibility,visibility:e,isFirst:t}),this.globalEvents.interactiveVisibilityChanged$.next({subjectId:this.container.container.id,subjectName:"container",type:"visibility",visibility:e,isFirst:t})):(this.globalEventEmitter.emit(P.interactives,{subjectId:this.container.container.id,subjectName:"container",type:j.visibility,visibility:!1}),this.globalEvents.interactiveVisibilityChanged$.next({subjectId:this.container.container.id,subjectName:"container",type:"visibility",visibility:e}))}registerEvents(){this.subscription.add(this.player.events.playing$.subscribe(this.show)).add(this.player.events.paused$.subscribe(this.hide)).add(this.player.events.ended$.subscribe(this.onEndOfVideo)).add(this.disabledControls$.subscribe(e=>{var t,n,i,a;e?(n=(t=this.container).disable)==null||n.call(t):(a=(i=this.container).enable)==null||a.call(i)}))}selectContainerEvent(e=!1){var n,i;let{isExpectEventForCurrentContainer:t}=this.getContainerEventState();this.interactiveEvents.containersEventsCallState.setCalled({timestamp:e?1/0:(n=this.container.container.endTime)!=null?n:1/0,id:this.container.container.id}),!(this.isSelectedControlEvent||this.isSelectedContainerEvent)&&(this.isSelectedContainerEvent=!0,t||this.selectBranches.setManifestContainerEvents({container:this.container.container,branches:this.branches,isEOV:e}),!e&&this.interactiveEvents.exec((i=this.container.container.endTime)!=null?i:1/0))}onStartTime(){this.show()}onEndTime(){this.selectContainerEvent(!1);let{isExpectTime:e,hasOpenURIEventInCurrentContainer:t}=this.getContainerEventState(),n=this.interactiveTimeOpenUri?e||t:pe(this.container.container.events)||e;(this.isSelectedControlEvent||!n)&&this.removeView()}onBeforeStartTime(){var e,t;(t=(e=this.container).hide)==null||t.call(e),this.emitContainerVisibilityEvent(!1)}reset(){this.isSelectedControlEvent=!1,this.isSelectedContainerEvent=!1,this.gameState=1}removeView(e=!1){var t;this.container.removeView(e),this.globalEventEmitter.emit(P.interactives,{subjectId:this.container.container.id,subjectName:"container",type:j.containerRemoved,visibility:!1}),this.globalEvents.interactiveContainerRemoved$.next({subjectId:this.container.container.id,subjectName:"container",type:"container-removed"}),this.gameState=5,(t=this.onRemove)==null||t.call(this)}fakeRemoveView(e=!1){this.container.isRemoved||this.globalEvents.interactiveContainerFakeRemoved$.next({subjectId:this.container.container.id,subjectName:"container",type:"container-fake-removed",removeAllOpenURI:e}),this.container.fakeRemove()}destroy(){var e;this.reset(),this.removeView(!0),this.gameState=6,this.subscription.unsubscribe(),this.branches=[],this.interactiveEvents.containersEventsCallState.setCalled({timestamp:(e=this.container.container.endTime)!=null?e:1/0,id:this.container.container.id})}};var Rs=(r=[])=>r.reduce((e,t,n)=>{var a,o,c;let i=((a=t==null?void 0:t.controls)!=null?a:[]).filter(s=>!St(s));if(Nt(i)){let s=[(o=t.startTime)!=null?o:0,(c=t.endTime)!=null?c:1/0],l={id:t.id,isRemoved:!1};if(!n)e.push({subjects:[l],range:s});else{let m=[],y=-1/0,b=1/0,C=[],S=[];for(let E=0;E<e.length;E++){let v=e[E];if(S.push(...v.subjects),v.range[0]<b&&(b=v.range[0]),v.range[1]>y&&(y=v.range[1]),s[0]>=v.range[0]&&s[1]<=v.range[1])return e[E].subjects.push(l),e;s[0]<v.range[0]&&s[1]>v.range[0]&&(m.push(E),C=C.concat(v.subjects)),s[0]>=v.range[0]&&s[0]<=v.range[1]&&(m.push(E),C=C.concat(v.subjects),s[0]=v.range[0]),s[1]>=v.range[0]&&s[1]<=v.range[1]&&(m.push(E),C=C.concat(v.subjects),s[1]=v.range[1])}if(S.push(l),s[0]<=b&&s[1]>=y)return[{subjects:S,range:s}];m.length&&m.reverse().forEach(E=>{e.splice(E,1)}),e.push({subjects:C.concat([l]),range:s})}}return e},[]).sort((e,t)=>e.range[0]-t.range[0]);var lo=te(_t(),1),Zr=te(Lt(),1),uo=te(oo(),1);function co(){let r={};function e(){for(let c in r)Object.prototype.hasOwnProperty.call(r,c)&&delete r[c]}function t(c){let s={};for(let l in r)+l<=c&&(s[l]=r[l]);return s}function n(c){let s={};for(let l in r)+l>=c&&(s[l]=r[l]);return s}function i({timestamp:c,priority:s,initiator:l}){var m;if(Mr(c)){let y=(m=r[c])!=null?m:null;if(y&&s&&He(s,!0)){let b={},C=y[s];if(C&&(b=d(d({},b),C)),b=ue(b)?null:b,b&&He(l,!0)){let S=b[l];return S!=null?S:null}return b}return y}return null}function a({timestamp:c,priority:s,initiator:l}){if(Mr(c))if(r[c]){if(s&&He(s,!0))if(r[c][s]){if(l&&He(l,!0))if(r[c][s][l]){if(delete r[c][s][l],!ue(r[c][s]))return!0}else return!1;if(delete r[c][s],!ue(r[c]))return!0}else return!1;return delete r[c]}else return!1;return!1}function o(y){var b=y,{timestamp:c,priority:s,initiator:l}=b,m=X(b,["timestamp","priority","initiator"]);var C,S,E;(S=(C=r[c])==null?void 0:C[s])!=null&&S[l]?r[c][s][l].push(d({},m)):(E=r[c])!=null&&E[s]?r[c][s]=x(d({},r[c][s]),{[l]:[d({},m)]}):r[c]?r[c]=x(d({},r[c]),{[s]:{[l]:[d({},m)]}}):r[c]={[s]:{[l]:[d({},m)]}}}return{map:r,remove:a,add:o,removeAll:e,get:i,getLte:t,getGte:n}}var Gp=[V.expect,V.setNextBranch],zp=1/0;function po(r,e){let t=r,n,i=Wp(e),a=co(),o,c=()=>{C(),h()},s=u=>{a.add.call(void 0,u),E()},l=(u=[])=>{for(let f of u)if(f.action(),(0,lo.default)(Gp,f.actionType))break},m=(u=1/0)=>{var g,A,L;let f=Bt((g=a.get({timestamp:u,priority:"control"}))!=null?g:{}),I=Bt((A=a.get({timestamp:u,priority:"container"}))!=null?A:{}),T=Bt((L=a.get({timestamp:u,priority:"chapter"}))!=null?L:{});return[...f,...I,...T]},y=u=>{i.isReady(u)&&l(m(u))},b=()=>{var u;l([...Bt((u=a.get({timestamp:1/0,priority:"chapter"}))!=null?u:{})])},C=()=>{n&&(o==null||o.unsubscribe(),n=void 0)},S=u=>{},E=()=>{n||(n=()=>setTimeout(()=>{y(1/0)}),o=t.events.ended$.subscribe(n))},v=u=>{C(),t=u},R=u=>{u.priority==="container"&&i.resetCalled(u.timestamp),a.remove(u)},h=()=>{i.release(),a.removeAll()};return{setPlayer:v,add:s,remove:R,exec:y,execEndOfVideo:b,listen:E,unlisten:C,release:c,containersEventsCallState:i,getPreparedToExecActions:m}}function Wp(r){let e=new Map;return{setCalled:({timestamp:c,id:s})=>{let l=e.get(c);l&&l[s]!==void 0&&(l[s]=!0)},setData:(c=[])=>{var s;for(let l of c){let m=(s=l.endTime)!=null?s:zp,y=e.get(m);e.set(m,x(d({},y),{[l.id]:!1}))}},resetCalled:c=>{let s=e.get(c);if(s)for(let l in s)s[l]=!1},isReady:c=>{let s=e.get(c);if(!s)return!0;let l=(0,Zr.default)(s);return r?l.some(y=>y):!l.some(y=>!y)},release:()=>e.clear()}}function Bt(r){return(0,uo.default)((0,Zr.default)(r)).sort(e=>e.actionType===V.expect?-1:1)}var ho={videoContentHeight:0,videoContentWidth:0},fo=(r,e)=>{let{height:t,width:n}=e.info.intrinsicVideoSize$.getValue()||{};if(!(t&&n))return ho;let{clientHeight:i,clientWidth:a}=e.experimental.element$.getValue()||{};if(!(i&&a))return ho;let o=t/n,c=i/a,s,l;return c>o?(l=a,s=a*o):c<o?(l=i/o,s=i):(l=a,s=i),{videoContentWidth:l,videoContentHeight:s}};var Kp=250;function mo(r){let e=()=>{},t=new ResizeObserver(c=>{a(c),e=a.bind(null,c)});function n(c){let{parentElement:s,player:l}=r();if(s&&l){let{videoContentWidth:m,videoContentHeight:y}=fo(s,l);s.style.setProperty("--interactive-content-width",`${m}px`),s.style.setProperty("--interactive-content-height",`${y}px`),s.style.setProperty("--interactive-width",`${c[0].contentRect.width}px`),s.style.setProperty("--interactive-height",`${c[0].contentRect.height}px`)}}function i(){let{parentElement:c}=r();c.removeAttribute("style")}let a=Be(c=>{let{fns:s=[]}=r();n(c);for(let l of s)l()},Kp);function o(){e=void 0,t.disconnect(),i()}return{resizeObserver:t,calc:()=>{e==null||e()},release:o}}var Qp=r=>Math.floor(Math.random()*r),yo=r=>{var i;let e=r.length,t=1/0,n=null;for(;e--;){let a=r[e],o=(i=a.weight)!=null?i:1;o<t&&(t=o,n=a)}return n},bo=r=>{var i;let e=r.length,t=-1/0,n=null;for(;e--;){let a=r[e],o=(i=a.weight)!=null?i:0;o>t&&(t=o,n=a)}return n};var go=r=>{let e=r.length,t=Qp(e);return r[t]},vo=1,Co=r=>{var n,i;let e=0;for(let a=0;a<r.length;++a)e+=(n=r[a].weight)!=null?n:vo;let t=Math.random()*e;e=0;for(let a=0;a<r.length-1;++a)if(e+=(i=r[a].weight)!=null?i:vo,e>=t)return r[a];return r[r.length-1]};var Eo={shouldOpenNow:!0,isDetachContainer:!0},Io="after-expect";var Jr=(r,e=!1)=>x(d({},r),{args:e?d(d({},r.args),Eo):d(d({},Eo),r.args)}),So=({globalEventEmitter:r,globalEvents:e,player:t,interactiveEvents:n})=>{let i={isExpect:!1},a=()=>{i.isExpect&&(i.isExpect=!1)},o=({action:h,controlType:u,controlId:f,containerId:I,branches:T=[],onEvent:g,isEOV:A=()=>!1,isDisabled:L=()=>!1})=>{let O=Jr(h,A()),M={timestamp:1/0,priority:"control",initiator:f,actionType:O.type},N=L(),Y=r.emit.bind(r,P.interactives,{subjectId:f,subjectType:u,subjectName:"control",type:N?j.actionChoiceCanceled:j.actionChoice,actionType:h.type,payload:d({invokeImmediately:O.args.shouldOpenNow,containerId:I},O.args)}),se=()=>{e.interactiveActionChoice$.next({subjectId:f,subjectType:u,subjectName:"control",type:N?"action-choice-canceled":"action-choice",actionType:h.type,payload:d({invokeImmediately:O.args.shouldOpenNow,containerId:I},O.args)})};if(N){Y(),se();return}switch(O.type.trim().toLowerCase()){case V.setNextBranch.trim().toLowerCase():{let B=T.find(me=>me.id===O.args.branchId);if(!B)return;g(O.args.isDetachContainer,C.bind(null,{subjectId:f,subjectName:"control"})),Y(),se(),O.args.shouldOpenNow?E({subjectId:f,subjectName:"control",subjectType:u,action:O,payload:{chapterId:B.chapterId,autoSelect:!1}}):n.add(x(d({},M),{action:E.bind(null,{subjectId:f,subjectName:"control",subjectType:u,action:O,payload:{chapterId:B.chapterId,autoSelect:!1}})}));return}case V.continuePlayback.trim().toLowerCase():{g(O.args.isDetachContainer,C.bind(null,{subjectId:f,subjectName:"control"})),Y(),se(),O.args.shouldOpenNow?S({subjectId:f,subjectName:"control",subjectType:u,action:h}):n.add(x(d({},M),{action:S.bind(null,{subjectId:f,subjectName:"control",subjectType:u,action:h})}));return}case V.openURI.trim().toLowerCase():{g(O.args.isDetachContainer,C.bind(null,{subjectId:f,subjectName:"control"})),Y(),se(),O.args.shouldOpenNow?R({subjectId:f,subjectName:"control",subjectType:u,action:O,payload:{URI:h.args.uri}}):n.add(x(d({},M),{action:R.bind(null,{subjectId:f,subjectName:"control",subjectType:u,action:O,payload:{URI:h.args.uri}})}));return}default:{let B="Unexpected control event",me=new _(1,1,{message:B});m(me,B);return}}},c=({action:h,container:{id:u,endTime:f},branches:I=[],isEOV:T=!1,autoSelected:g=!1})=>{let A=Jr(h,T),L={timestamp:!A.args.shouldOpenNow||T?1/0:f!=null?f:1/0,priority:"container",initiator:u,actionType:A.type},O=r.emit.bind(r,P.interactives,{subjectId:u,subjectName:"container",type:j.actionChoice,actionType:A.type,payload:d({invokeImmediately:A.args.shouldOpenNow},A.args)}),M=()=>{e.interactiveActionChoice$.next({subjectId:u,subjectName:"container",type:"action-choice",actionType:A.type,payload:d({invokeImmediately:A.args.shouldOpenNow},A.args)})};switch(A.type.trim().toLowerCase()){case V.setNextBranch.trim().toLowerCase():{let N=I.find(Y=>Y.id===A.args.branchId);if(!N)return;O(),M(),n.add(x(d({},L),{action:E.bind(null,{subjectId:u,subjectName:"container",action:A,payload:{chapterId:N.chapterId,autoSelect:g}})}));return}case V.setMaxWeightBranch.trim().toLowerCase():return;case V.setMinWeightBranch.trim().toLowerCase():return;case V.setRandomBranch.trim().toLowerCase():return;case V.setWeightlessRandomBranch.trim().toLowerCase():return;case V.continuePlayback.trim().toLowerCase():{O(),M(),n.add(x(d({},L),{action:S.bind(null,{subjectId:u,subjectName:"container",action:A})}));return}case V.openURI.trim().toLowerCase():{O(),M(),n.add(x(d({},L),{action:R.bind(null,{subjectId:u,subjectName:"container",action:A,payload:{URI:h.args.uri}})}));return}default:{let N="Unexpected container event",Y=new _(1,1,{message:N});m(Y,N);return}}};function s({container:h,branches:u,isEOV:f=!1}){var T,g;let I=Br(h.events);if(I){let A=Jr(I.action,f);r.emit(P.interactives,{subjectId:h.id,subjectName:"container",type:j.actionChoice,actionType:A.type,payload:d({invokeImmediately:A.args.shouldOpenNow},A.args)}),e.interactiveActionChoice$.next({subjectId:h.id,subjectName:"container",type:"action-choice",actionType:A.type,payload:d({invokeImmediately:A.args.shouldOpenNow},A.args)}),n.add({timestamp:f?1/0:(T=h.endTime)!=null?T:1/0,priority:"container",initiator:h.id,actionType:V.expect,action:b.bind(null,{subjectId:h.id,subjectName:"container"})}),i.isExpect=!0}else for(let A of(g=h.events)!=null?g:[])c({action:A.action,container:h,branches:u,isEOV:f})}let l=({chapterId:h,action:u,branches:f=[]})=>{let I=r.emit.bind(r,P.interactives,{subjectId:h,subjectName:"chapter",type:j.actionChoice,actionType:u.type,payload:u.args}),T=()=>{e.interactiveActionChoice$.next({subjectId:h,subjectName:"chapter",type:"action-choice",actionType:u.type,payload:u.args})};switch(u.type.trim().toLowerCase()){case V.setNextBranch.trim().toLowerCase():{let g=f.find(A=>A.id===u.args.branchId);return g!=null&&g.chapterId?(I(),T(),E.bind(null,{subjectId:h,subjectName:"chapter",action:u,payload:{chapterId:g.chapterId,autoSelect:!0}})):void 0}case V.setWeightlessRandomBranch.trim().toLowerCase():{let g=go(f);return g!=null&&g.chapterId?(I(),T(),E.bind(null,{subjectId:h,subjectName:"chapter",action:u,payload:{chapterId:g.chapterId,autoSelect:!0}})):void 0}case V.setRandomBranch.trim().toLowerCase():{let g=Co(f);return g!=null&&g.chapterId?(I(),T(),E.bind(null,{subjectId:h,subjectName:"chapter",action:u,payload:{chapterId:g.chapterId,autoSelect:!0}})):void 0}case V.setMaxWeightBranch.trim().toLowerCase():{let g=bo(f);return g!=null&&g.chapterId?(I(),T(),E.bind(null,{subjectId:h,subjectName:"chapter",action:u,payload:{chapterId:g.chapterId,autoSelect:!0}})):void 0}case V.setMinWeightBranch.trim().toLowerCase():{let g=yo(f);return g!=null&&g.chapterId?(I(),T(),E.bind(null,{subjectId:h,subjectName:"chapter",action:u,payload:{chapterId:g.chapterId,autoSelect:!0}})):void 0}case V.continuePlayback.trim().toLowerCase():return I(),T(),S.bind(null,{subjectId:h,subjectName:"chapter",action:u});case V.openURI.trim().toLowerCase():return I(),T(),R.bind(null,{subjectId:h,subjectName:"chapter",action:u,payload:{URI:u.args.uri}});default:{let g="Unexpected chapter event",A=new _(1,1,{message:g});m(A,g);return}}};function m(h,u){console.error(u),e.error$.next(h),r.emit(P.errors,h)}function y(h){var f;let u=Br(h.events);if(u){if(J(h))return;r.emit(P.interactives,{subjectId:h.id,subjectName:"chapter",type:j.actionChoice,actionType:u.action.type,payload:u.action.args}),e.interactiveActionChoice$.next({subjectId:h.id,subjectName:"chapter",type:"action-choice",actionType:u.action.type,payload:u.action.args}),n.add({timestamp:1/0,priority:"chapter",initiator:h.id,actionType:V.expect,action:b.bind(null,{subjectId:h.id,subjectName:"chapter"})})}else(f=h.events)==null||f.forEach(I=>{let T=l({chapterId:h.id,action:I.action,branches:h.branches});T&&n.add({timestamp:1/0,priority:"chapter",initiator:h.id,actionType:I.action.type,action:T})})}let b=({subjectId:h,subjectName:u})=>{t.pause(),r.emit(P.interactives,{subjectId:h,subjectName:u,type:j.actionExecution,actionType:V.expect}),e.interactiveActionExecution$.next({subjectId:h,subjectName:u,type:"action-execution",actionType:V.expect})},C=({subjectId:h,subjectName:u})=>{t.info.isEnded$.getValue()?n.execEndOfVideo():t.play(),r.emit(P.interactives,{subjectId:h,subjectName:u,type:j.actionExecution,actionType:Io}),e.interactiveActionExecution$.next({subjectId:h,subjectName:u,type:"action-execution",actionType:Io})},S=({subjectId:h,subjectName:u,subjectType:f,action:I})=>{r.emit(P.interactives,{subjectId:h,subjectName:u,subjectType:f,type:j.actionExecution,actionType:I.type}),e.interactiveActionExecution$.next({subjectId:h,subjectName:u,subjectType:f,type:"action-execution",actionType:I.type})},E=({subjectId:h,subjectName:u,subjectType:f,action:I,payload:T})=>{T.behaviour="change-chapter",r.emit(P.interactives,{subjectId:h,subjectName:u,subjectType:f,type:j.actionExecution,actionType:I.type,payload:T}),e.interactiveActionExecution$.next({subjectId:h,subjectName:u,subjectType:f,type:"action-execution",actionType:I.type,payload:T})},v=({subjectId:h,subjectName:u,subjectType:f,action:I,payload:T})=>{T.behaviour="change-manifest",r.emit(P.interactives,{subjectId:h,subjectName:u,subjectType:f,type:j.actionExecution,actionType:I.type,payload:T}),e.interactiveActionExecution$.next({subjectId:h,subjectName:u,subjectType:f,type:"action-execution",actionType:I.type,payload:T})},R=({subjectId:h,subjectName:u,subjectType:f,action:I,payload:T})=>{if(!T.URI)return;let g=window.open(T.URI,"_blank","noopener,noreferrer");g&&(g.opener=null),r.emit(P.interactives,{subjectId:h,subjectName:u,subjectType:f,type:j.actionExecution,actionType:I.type}),e.interactiveActionExecution$.next({subjectId:h,subjectName:u,subjectType:f,type:"action-execution",actionType:I.type})};return{onControlEvent:o,onContainerEvent:c,onChapterEvent:l,onExpectEvent:b,expectEventHandler:C,setManifestChapterEvents:y,setManifestContainerEvents:s,stopExpect:a,state:i}};var rn=te(Vr(),1);import{Subscription as eh,Subject as tn,ValueSubject as Ze}from"@vkontakte/videoplayer-shared/es2015";var en=(r,e)=>{let t={};return r.map(n=>{if(!t[n]){let i=e.chapters.find(o=>o.id===n);if(!i)return null;let a=e.media.videos.find(o=>i.videoId===o.id);if(!a)return null;t[n]=wo(a)}return t[n]}).filter(Boolean)},Xp=r=>{for(let e of r.variants)if(Zp(e)&&e.payload)return e.payload.id},Zp=r=>!!(r.type==="custom"&&r.payload&&r.payload.type==="vk"),wo=r=>{let e=Xp(r);if(!e)return null;let t=e.split("_").pop();return t?parseInt(t,10):null},Jp=(r,e)=>{for(let t of r.media.videos)if(e===wo(t)){for(let n of r.chapters)if(n.videoId===t.id)return n.id;return}},Ao=(r,e)=>r.reduce((t,n)=>{let i=Jp(e,n);return i?[...t,i]:t},[]);var ne,he,de,W,Dt,ie,ae,ee,fe,Re,Oe,Je=class{constructor({globalEventEmitter:e,videoId:t,interactiveController:n,historyApi:i,settings:a}){this.state={history$:new Ze([]),hasPrevChapter$:new Ze(!1),prevChapter$:new Ze(null),isInitialChapter$:new Ze(!1),isGoBackLimited$:new Ze(!1)};U(this,ne,null);U(this,he);U(this,de,!1);U(this,W,null);U(this,Dt,null);this.events={inited$:new tn,destroyed$:new tn,error$:new tn};U(this,ie,null);U(this,ae,null);U(this,ee,null);U(this,fe,new eh);U(this,Re,!1);U(this,Oe,0);var o;$(this,ie,t),$(this,ee,e),$(this,ae,n),$(this,ne,i),$(this,he,a),this.state.history$&&w(this,fe)&&((o=w(this,fe))==null||o.add(this.state.history$.subscribe(c=>{var s,l;this.state.prevChapter$.next((0,rn.default)(c,-2)||null),this.state.hasPrevChapter$.next(c.length>1),this.state.isInitialChapter$.next(this.getInitialChapterId()===((l=(s=w(this,W))==null?void 0:s.metadata)==null?void 0:l.initChapterId)),this.state.isGoBackLimited$.next(w(this,Oe)===w(this,he).maxLength-1)})))}setManifest(e){return k(this,null,function*(){if(!w(this,ae)||!w(this,ee))return;$(this,W,e),yield this.getProjectHistory();let t=this.getInitialChapterId();yield w(this,ae).setChapter({chapterId:t,pushToHistory:!1}),w(this,de)||($(this,de,!0),this.events.inited$.next({initChapterId:t}))})}get inited(){return w(this,de)}updateHistory(e,t=!0){return k(this,null,function*(){var c;if(!w(this,W))return;w(this,Re)?($(this,Re,!1),vn(this,Oe)._++):$(this,Oe,0);let n=w(this,W),i=e.length-w(this,he).maxLength,a=i>0?e.slice(i):e,o=en(a,n);if($(this,Dt,o),this.state.history$.next(a),!(!t||!w(this,ne)||!w(this,ie)))try{yield w(this,ne).save(w(this,ie),o)}catch(s){let l=new _(1,5,"Unable to save interactive history");this.events.error$.next(l),(c=w(this,ee))==null||c.emit(P.errors,l)}})}goBack(){return k(this,null,function*(){var n;if(!this.state||!w(this,ae)){let i=new _(1,5,"Unable to save interactive history");return this.events.error$.next(i),(n=w(this,ee))==null?void 0:n.emit(P.errors,i)}$(this,Re,!0);let e=this.state.history$.getValue().slice(0,-1),t=e.pop();this.state.history$.next(e),yield w(this,ae).setChapter({chapterId:t,playPrev:!0})})}getProjectHistory(){return k(this,null,function*(){var i;if(!w(this,W)||!w(this,ie))return;let e=w(this,W),t=[this.getInitialVideoId()];if(w(this,ne))try{let a=yield w(this,ne).get(w(this,ie));a.length&&(t=a)}catch(a){let o=new _(1,5,"Error while trying to fetch data");this.events.error$.next(o),(i=w(this,ee))==null||i.emit(P.errors,o)}let n=Ao(t,e);this.state.history$.next(n)})}getInitialChapterId(){var t;let e=this.state.history$.getValue();return(0,rn.default)(e,-1)||w(this,he).initChapterId||((t=w(this,W))==null?void 0:t.metadata.initChapterId)}getInitialVideoId(){if(w(this,W)){let e=this.getInitialChapterId();return en([e],w(this,W)).pop()}return null}destroy(){var e,t;$(this,ie,null),$(this,ne,null),$(this,ae,null),(e=w(this,fe))==null||e.unsubscribe(),$(this,fe,null),$(this,de,!1),(t=w(this,ee))==null||t.emit(P.historyDestroyed),this.events.destroyed$.next(),$(this,ee,null)}};ne=new WeakMap,he=new WeakMap,de=new WeakMap,W=new WeakMap,Dt=new WeakMap,ie=new WeakMap,ae=new WeakMap,ee=new WeakMap,fe=new WeakMap,Re=new WeakMap,Oe=new WeakMap;var Ht=class{constructor(){this._prevSizeId=0;this.rootElement=document.createElement("canvas")}clear(){var e;(e=this.rootElement.getContext("2d"))==null||e.clearRect(0,0,this.rootElement.width,this.rootElement.height)}isImageDrawn(){var i;let e=(i=this.rootElement.getContext("2d"))==null?void 0:i.getImageData(0,0,this.rootElement.width,this.rootElement.height);if(!e)return!1;let t=e.data,n=t.length;for(let a=3;a<n;a+=40)if(t[a]!==0)return!0;return!1}destroy(){this.rootElement.remove()}show(){this.rootElement.style.visibility="visible"}hide(){this.rootElement.style.visibility="hidden"}setCanvasImageSource(e){this.canvasImgSrc=e}draw(){var e;this.canvasImgSrc&&((e=this.rootElement.getContext("2d"))==null||e.drawImage(this.canvasImgSrc,0,0,this.rootElement.width,this.rootElement.height))}updateCanvasDimensions(e,t=!1){return k(this,null,function*(){let n=e.width+e.height;if(this._prevSizeId===n)return;let i;t&&(i=yield this.save()),this.rootElement.width=e.width,this.rootElement.height=e.height,t&&i&&this.restore(i),this._prevSizeId=n})}save(){return k(this,null,function*(){let e=this.rootElement.toDataURL("image/jpeg",1),t=new Image;return t.crossOrigin="anonymous",t.src=e,yield t.decode(),t})}restore(e){var t;this.rootElement&&((t=this.rootElement.getContext("2d"))==null||t.drawImage(e,0,0,this.rootElement.width,this.rootElement.height))}};var Ut=class{constructor({parentElement:e,endOffsetMs:t=250,onError:n}){this.currentVideoDurationMs=1/0;this._containerTimeFrameShouldReceived=!1;this._endTimeFrameReceived=!1;this._shouldCallSkip=!1;this.onEachTick=e=>{let t=e!=null?e:this.lastFrameCanvas.canvasImgSrc.currentTime*1e3,n=this.isChapterEndTime(t);if(this.isContainerTime(t))this._endTimeFrameReceived=!1,this._containerTimeFrameShouldReceived=!0,this._shouldCallSkip=!0;else if(n)this._containerTimeFrameShouldReceived=!1,this._shouldCallSkip=!1,this._endTimeFrameReceived||(this.draw(),this._endTimeFrameReceived=!0,this.show());else{if(this._shouldCallSkip){this._shouldCallSkip=!1;return}this.reset()}};this.onSeek=()=>{this.onEachTick(),!this._containerTimeFrameShouldReceived&&!this._endTimeFrameReceived&&(this.hide(),this.lastFrameCanvas.clear())};this.rootElement=document.createElement("div"),this.rootElement.style.cssText=`
|
|
7
7
|
position: absolute;
|
|
8
8
|
top: 0;
|
|
9
9
|
left: 0;
|
|
@@ -16,8 +16,8 @@ var jo=Object.create;var Wt=Object.defineProperty,No=Object.defineProperties,$o=
|
|
|
16
16
|
top: 50%;
|
|
17
17
|
left: 50%;
|
|
18
18
|
transform: translate(-50%, -50%);
|
|
19
|
-
`,this.rootElement.prepend(this.lastFrameCanvas.rootElement),e.prepend(this.rootElement)}destroy(){this.hide(),this.reset(),this._callbacks=void 0,this.lastFrameCanvas.destroy(),this.rootElement.remove()}setVideoDuration(e){this.currentVideoDurationMs=e}setVideoElement(e){this.lastFrameCanvas.setCanvasImageSource(e)}setCurrentChapter(e){this.currentChapter=e}show(){this.rootElement.style.visibility="visible"}hide(){this.rootElement.style.visibility="hidden"}updateCanvasDimensions(e=!1){return
|
|
19
|
+
`,this.rootElement.prepend(this.lastFrameCanvas.rootElement),e.prepend(this.rootElement)}destroy(){this.hide(),this.reset(),this._callbacks=void 0,this.lastFrameCanvas.destroy(),this.rootElement.remove()}setVideoDuration(e){this.currentVideoDurationMs=e}setVideoElement(e){this.lastFrameCanvas.setCanvasImageSource(e)}setCurrentChapter(e){this.currentChapter=e}show(){this.rootElement.style.visibility="visible"}hide(){this.rootElement.style.visibility="hidden"}updateCanvasDimensions(e=!1){return k(this,null,function*(){this._containerTimeFrameShouldReceived||this._endTimeFrameReceived||(e=!1);let t=getComputedStyle(this.rootElement),n={width:parseInt(t.getPropertyValue("--interactive-content-width"),10),height:parseInt(t.getPropertyValue("--interactive-content-height"),10)};try{this.lastFrameCanvas.updateCanvasDimensions(n,e)}catch(i){this._onError(i)}})}draw(){(this._containerTimeFrameShouldReceived||!this._containerTimeFrameShouldReceived&&!this._endTimeFrameReceived)&&this.lastFrameCanvas.draw()}isChapterEndTime(e){return this.currentVideoDurationMs&&e>=this.currentVideoDurationMs-this.endOffsetMs}isContainerTime(e){if(this.currentChapter)return this.currentChapter.containers.some(t=>{var n,i,a;return((n=t.controls)==null?void 0:n.length)&&e>=((i=t.startTime)!=null?i:0)&&e<=Math.min((a=t.endTime)!=null?a:1/0,this.currentVideoDurationMs-this.endOffsetMs)})}reset(){this._endTimeFrameReceived=!1,this._containerTimeFrameShouldReceived=!1,this._shouldCallSkip=!1}_onError(e){var t,n;(n=(t=this._callbacks)==null?void 0:t.onError)==null||n.call(t,e)}};function Ro(r=0){return new Promise(e=>{setTimeout(()=>{e(0)},r)})}var Po=Object.freeze({lang:nh.RU,loaders:{},graph:!1,initSeamless:!1,lastFrame:!1,permanentTextControls:!0,interactiveTimeOpenUri:!1,config:{historyMaxLength:100,noInteractionEventTimeout:3e4}});function ah(){let r=document.createElement("div");return r.style.cssText=`
|
|
20
20
|
position: absolute;
|
|
21
21
|
top: 0;
|
|
22
22
|
left: 0;
|
|
23
|
-
`,r}var Gt=class{constructor(e){this.playerSubscriptions=new nn;this.subscriptions=new nn;this.globalEventEmitter=new Rt;this.animation=new Ot;this.seekToInteractiveController=new Ge;this.endedRanges=new Set;this.gameControllers=[];this.rootElement=ah();this.factories=new Map([["choice",ht]]);this.isFirstChapterFetched=!1;this.player=null;this.interactiveEvents=null;this.selectBranches=null;this.seamlessController=null;this.seamlessControllerSubs=new nn;this.graph=null;this.lastFrame=null;this.appState=0;this.state={prevChapter$:new H(null),isInitialChapter$:new H(!1),isFirstChapter$:new H(!0),isEndChapter$:new H(!1),isInteractiveExpectation$:new H(!1),isReplay$:new H(!1),calledByInteractive$:new H(!1),lastChapterChangeWasInitiatedByInteractive$:new H(!1),disabledControls$:new H(!1),interactiveRanges$:new H([]),isInteractiveTime$:new H(!1),statistics$:new H(null),isSeekable$:new H(!1)};this.events={noInteraction$:new q,graphVisibilityChanged$:new q,watchAgainIsClicked$:new q,chapterChanged$:new q,playerChanged$:new q,error$:new q,eachTick$:new q,manifestChanged$:new q,interactiveRangeEnded$:new q,interactiveContainerRemoved$:new q,interactiveContainerFakeRemoved$:new q,interactiveActionExecution$:new q,interactiveActionChoice$:new q,interactiveVisibilityChanged$:new q};this.emitErrorEvent=e=>{this.events.error$.next(e),this.globalEventEmitter.emit(k.errors,e)};this.clearHistoryIfEnded=()=>{var i;let e=(i=this.player)==null?void 0:i.info.isEnded$.getValue(),t=this.state.isInteractiveExpectation$.getValue(),{chapter:n}=this.getCurrentChapter();e&&n&&J(n)&&!t&&this.historyController.updateHistory([]),window.removeEventListener("beforeunload",this.clearHistoryIfEnded)};this.handleSeamlessPlayerChanged=e=>{if(!e)return;let i=e,{statistics:t}=i,n=X(i,["statistics"]);if(t){let{statSubscription:a,oneStat:o}=t;a.add(o.attachToInteractive(this.getStatEvents())),this.state.statistics$.next(t)}this.state.isReplay$.getValue()&&this.state.isReplay$.next(!1),this.events.playerChanged$.next(n),this.globalEventEmitter.emit(k.playerChanged,n)};this.onPlaybackStarted=()=>{var e;(e=this.resizeManager)==null||e.calc(),this.animation.requestAnimation()};this.removeControllers=(e=!0)=>{this.gameControllers.forEach(t=>{!e&&t.isPermanentText||(this.animation.removeFn(t.whilePlaying),t.destroy())})};this.completeInteractiveRange=e=>{let{interactiveRanges$:t}=this.state,i=t.getValue().map(a=>x(d({},a),{subjects:a.subjects.filter(o=>o.id!==e)}));t.next(i)};this.clearNoInteractionTimeout=()=>{this.noInteractionTimeout&&(clearTimeout(this.noInteractionTimeout),this.noInteractionTimeout=void 0)};var t;this._options=x(d(d({},ko),e),{config:d(d({},ko.config),e.config)}),this._options.parentElement.append(this.rootElement),this.historyController=new Je({interactiveController:this,globalEventEmitter:this.globalEventEmitter,videoId:(t=this._options.projectInfo)==null?void 0:t.videoId,historyApi:this._options.historyApi,settings:{maxLength:this._options.config.historyMaxLength,initChapterId:this._options.initChapterId}}),this._options.lastFrame&&(this.lastFrame=new Ut({parentElement:this._options.parentElement,onError:n=>{let i=new _(1,6,n);this.emitErrorEvent(i)}})),this.subscriptions.add(Po(this.rootElement,"mousedown").subscribe(n=>n.stopPropagation())).add(Po(this.rootElement,"mouseup").subscribe(n=>n.stopPropagation())),this.manifestController=new we(this._options.loaders,n=>{let i=new _(1,3,n);this.emitErrorEvent(i)}),this.resizeManager=mo(()=>{var n,i;return{player:this.player,parentElement:(n=this._options)==null?void 0:n.parentElement,fns:(i=this._options)!=null&&i.lastFrame?[()=>{var a;(a=this.lastFrame)==null||a.updateCanvasDimensions(!0)}]:[]}}),this._options.graph&&(this.graph=new Ue({root:this._options.parentElement,lang:this._options.lang,onOpenPreviewClick:n=>{this.setChapter({chapterId:n}),this.globalEventEmitter.emit(k.graph,{type:Ye.watchAgainClicked,chapterId:n}),this.events.watchAgainIsClicked$.next(n)},onError:n=>{let i=new _(1,4,{message:n});this.emitErrorEvent(i)}})),this.initSubscriptions()}initSubscriptions(){this.playerSubscriptions.add(this.historyController.events.inited$.subscribe(t=>P(this,[t],function*({videosInfo:e=[]}){this._options.initSeamless&&(yield this.initSeamless(),this.updateGraphVideosInfo(e))}))),this.subscriptions.add(this.events.interactiveContainerRemoved$.subscribe(({subjectId:e})=>{this.completeInteractiveRange(e)})).add(this.events.interactiveContainerFakeRemoved$.subscribe(({subjectId:e,removeAllOpenURI:t})=>{this.handleFakeRemoval(e,t)})).add(this.events.interactiveActionExecution$.subscribe(e=>{var t,n;if(this.state.calledByInteractive$.next(!0),this.state.lastChapterChangeWasInitiatedByInteractive$.next(!0),((t=e.payload)==null?void 0:t.behaviour)==="change-chapter"){let{chapterId:i}=e.payload;this.setChapter({chapterId:i}),this.state.isFirstChapter$.getValue()&&this.state.isFirstChapter$.next(!1)}else if(((n=e.payload)==null?void 0:n.behaviour)==="change-manifest"){let{manifestURL:i}=e.payload;i&&this.setManifest(i)}e.actionType==="expect"?this.state.isInteractiveExpectation$.next(!0):e.actionType==="after-expect"&&this.state.isInteractiveExpectation$.next(!1)})).add(this.events.manifestChanged$.subscribe(()=>{this.state.calledByInteractive$.next(!1),this.state.lastChapterChangeWasInitiatedByInteractive$.next(!1)})).add(this.events.interactiveActionChoice$.subscribe(({type:e,subjectName:t,payload:n})=>{e!=="action-choice"||t==="chapter"||"invokeImmediately"in n&&n.invokeImmediately||this.removeControllers(!1)}))}initSeamless(){return P(this,null,function*(){this.seamlessController=Kr(this),this.seamlessControllerSubs.add(this.seamlessController.activePlayerChanged.subscribe(this.handleSeamlessPlayerChanged)),yield this.seamlessController.init()})}handlePositionChange(e){(!this.graph||this.graph.isHidden)&&this.checkIfSeekable();let t=e*1e3,i=this.getInteractiveRanges().reverse().find(({range:a})=>t>=a[1]);if(i){let a=i.range.join("-");this.endedRanges.has(a)||(this.endedRanges.add(a),this.globalEventEmitter.emit(k.interactives,{type:j.rangeEnded,payload:i,visibility:!0}),this.events.interactiveRangeEnded$.next({type:"range-ended",payload:i}))}}registerVideoEvents(){this.player&&(window.removeEventListener("beforeunload",this.clearHistoryIfEnded),this.playerSubscriptions.unsubscribe(),window.addEventListener("beforeunload",this.clearHistoryIfEnded),this.playerSubscriptions.add(this.player.events.started$.pipe(ih()).subscribe(this.onPlaybackStarted)).add(this.player.events.playing$.subscribe(this.animation.requestAnimation)).add(this.player.events.willPause$.subscribe(this.animation.cancelAnimation)).add(this.player.info.position$.subscribe(this.handlePositionChange.bind(this))).add(this.manifestController.prevChapter$.subscribe(e=>this.state.prevChapter$.next(e))).add(rh({position:this.player.info.position$,interactiveRanges:this.state.interactiveRanges$,isInteractiveExpectation:this.state.isInteractiveExpectation$}).subscribe(({position:e,interactiveRanges:t,isInteractiveExpectation:n})=>{var s;let i;if(n)i=!0;else{let l=e*1e3;i=!!t.find(({range:[y,b],subjects:C})=>y<l&&l<b&&C.some(S=>!S.isRemoved)&&C.length)}i!==this.state.isInteractiveTime$.getValue()&&this.state.isInteractiveTime$.next(i);let a=!!this.noInteractionTimeout,c=((s=this.player)==null?void 0:s.info.playbackState$.getValue())==="playing"||n;i&&!a&&c?this.noInteractionTimeout=window.setTimeout(()=>{this.events.noInteraction$.next()},this._options.config.noInteractionEventTimeout):a&&!c&&this.clearNoInteractionTimeout()})),this.playerSubscriptions.add(this.historyController.events.error$.subscribe(this.events.error$)),this._options.lastFrame&&this.playerSubscriptions.add(this.player.info.duration$.subscribe(e=>{var t;(t=this.lastFrame)==null||t.setVideoDuration(e*1e3)})).add(this.player.experimental.element$.subscribe(e=>{var t;e&&((t=this.lastFrame)==null||t.setVideoElement(e))})).add(this.player.events.firstFrame$.subscribe(()=>{var e;(e=this.lastFrame)==null||e.reset(),setTimeout(()=>{var t,n;(t=this.lastFrame)==null||t.hide(),(n=this.lastFrame)==null||n.lastFrameCanvas.clear()},50)})).add(this.player.events.seeked$.subscribe(this.lastFrame.onSeek)))}setGameControllers(){var t,n;let e=this.manifestController.chapter;e&&this.appState===1&&((t=this.selectBranches)==null||t.setManifestChapterEvents(e),this.gameControllers=this.filterGameControllers(e),(n=this.interactiveEvents)==null||n.containersEventsCallState.setData(e.containers),this.seekToInteractiveController.setContainers(this.gameControllers.map(i=>i.container.container).filter(i=>!Se(i.controls))),this._options.lastFrame&&this.animation.addFn(()=>{var i;this.player&&((i=this.lastFrame)==null||i.onEachTick(this.player.info.position$.getValue()*1e3))},!0),this.state.interactiveRanges$.next(this.getInteractiveRanges()),this.appState=2)}filterGameControllers(e){let t=[];return e.containers.forEach(n=>{let i=n.type.trim().toLowerCase(),a=this.factories.get(i),o=a==null?void 0:a(n,this.rootElement);if(o&&this.selectBranches&&this.interactiveEvents&&this.player){let c=new Ft({player:this.player,container:o,branches:e.branches,selectBranches:this.selectBranches,interactiveEvents:this.interactiveEvents,globalEvents:this.events,globalEventEmitter:this.globalEventEmitter,getContainerEventState:()=>La(n,this.gameControllers),permanentTextControls:this._options.permanentTextControls,interactiveTimeOpenUri:this._options.interactiveTimeOpenUri,disabledControls$:this.state.disabledControls$,onRemove:()=>{this.seekToInteractiveController.deleteContainer(n.id)}});this.animation.addFn(c.whilePlaying,!0),t.push(c)}}),t}checkIfSeekable(){if(this.state.isInteractiveExpectation$.getValue()){this.state.isSeekable$.next(!1);return}let t=this.state.isSeekable$.getValue(),n=!!this.seekToInteractiveController.getNextInteractiveTime();(n&&!t||!n&&t)&&this.state.isSeekable$.next(!t)}updateLastEventInfo(){this.state.calledByInteractive$.getValue()?this.state.calledByInteractive$.next(!1):this.state.lastChapterChangeWasInitiatedByInteractive$.next(!1)}pushChapterToHistory(e){var c,s;if(this.updateLastEventInfo(),!this.historyController.inited)return;let t=this.state.lastChapterChangeWasInitiatedByInteractive$.getValue(),n=this.state.prevChapter$.getValue(),i=(c=n&&J(n)&&$t(n))!=null?c:!1,a=((s=this.manifestController.manifest)==null?void 0:s.metadata.initChapterId)===e,o=this.historyController.state.history$.getValue();if(a||i&&t){this.historyController.updateHistory([e]);return}(0,Vo.default)(o,-1)!==e&&this.historyController.updateHistory([...o,e])}handleFakeRemoval(e,t){let{interactiveRanges$:n}=this.state,a=n.getValue().map(o=>{let c=o.subjects.some(l=>l.id===e),s=o.subjects.map(l=>t&&c||l.id===e?x(d({},l),{isRemoved:!0}):l);return x(d({},o),{subjects:s})});n.next(a)}reset(){var e;this.appState===2&&(this.removeControllers(),this.gameControllers=[],this.animation.release(),(e=this.interactiveEvents)==null||e.release(),this.appState=1,this.state.isSeekable$.next(!1),this.clearNoInteractionTimeout())}get options(){return this._options}init(){var e;this.manifestController.chapter&&this._options.parentElement&&this.player&&this._options.fullscreenTargetElement&&this.appState===0&&((e=this.resizeManager)==null||e.resizeObserver.observe(this._options.fullscreenTargetElement),this.registerVideoEvents(),this.appState=1,this.setGameControllers())}setManifest(e){return P(this,null,function*(){this.reset(),this.isFirstChapterFetched=!1;let t=yield this.manifestController.setManifest(e);if(t.manifest)return this.graph&&this.graph.handleManifestChange(t.manifest),yield this.historyController.setManifest(t.manifest),this.events.manifestChanged$.next(t.manifest),this.globalEventEmitter.emit(k.manifestChanged,{manifest:t.manifest}),this.setGameControllers(),t.manifest})}setPlayer(e){this.reset(),this.player=e,this.seekToInteractiveController.setPlayer(this.player),this.interactiveEvents?this.interactiveEvents.setPlayer(this.player):this.interactiveEvents=po(this.player,this._options.interactiveTimeOpenUri),this.selectBranches=So({player:this.player,interactiveEvents:this.interactiveEvents,globalEvents:this.events,globalEventEmitter:this.globalEventEmitter}),this.appState===1&&(this.registerVideoEvents(),this.setGameControllers())}setChapter(){return P(this,arguments,function*({chapterId:e,pushToHistory:t=!0,playPrev:n=!1}={}){var s,l;this.reset(),this.lastFrame&&this.isFirstChapterFetched&&(this.lastFrame.draw(),this.lastFrame.show()),th.isSafari&&(yield Ro(35));let i=!n&&this.state.isEndChapter$.getValue()&&((s=this.getCurrentManifest())==null?void 0:s.metadata.initChapterId)===e;this.state.isReplay$.next(i);let{chapter:a,media:o,graph:c}=yield e?this.manifestController.setNext(e):this.manifestController.setInitial();(!e||i)&&this.state.isFirstChapter$.next(!0),!(!a||!o)&&(t&&this.pushChapterToHistory(a.id),this.state.isInitialChapter$.next(this.manifestController.isInitialChapter()),this.state.isEndChapter$.next(this.manifestController.isEndChapter()),this.graph&&this.graph.handleChapterChange(a),(l=this.lastFrame)==null||l.setCurrentChapter(a),this.events.chapterChanged$.next({chapter:a,manifestVideo:o}),this.globalEventEmitter.emit(k.chapterChanged,{chapter:a,media:o,graph:c}),this.setGameControllers(),this.endedRanges=new Set,this.isFirstChapterFetched=!0)})}getStatEvents(){return{click$:new Oo(e=>{this.subscriptions.add(this.events.graphVisibilityChanged$.subscribe(t=>{e.next(t?et.GRAPH_SHOW:et.GRAPH_HIDE)})).add(this.events.watchAgainIsClicked$.subscribe(()=>{e.next(et.WATCH_AGAIN)})).add(this.events.interactiveActionChoice$.subscribe(({type:t,subjectName:n,subjectType:i})=>{t!=="action-choice"||n!=="control"||(i==="Button"&&e.next(et.NEXT_BUTTON),i==="Area"&&e.next(et.NEXT_AREA))}))}),nextMovie$:new Oo(e=>{this.events.playerChanged$.subscribe(({config:t})=>{t!=null&&t.unitedVideoId&&!this.state.isFirstChapter$.getValue()&&e.next(t.unitedVideoId)})})}}toggleGraphView(e=!0){this.graph&&(e?(this.graph.show(),this.state.isSeekable$.next(!1)):(this.graph.hide(),this.checkIfSeekable()),this.globalEventEmitter.emit(k.graph,{type:Ye.visibility,visibility:e}),this.events.graphVisibilityChanged$.next(e))}setVisitedChapters(e){var t;Array.isArray(e)&&((t=this.graph)==null||t.setVisitedChapters(e))}updateGraphVideosInfo(e){var t;Array.isArray(e)&&((t=this.graph)==null||t.updateVideosInfo(e))}deadEndCheck(){var n;return!(((n=this.interactiveEvents)==null?void 0:n.getPreparedToExecActions())||[]).some(i=>i.actionType===V.setNextBranch)}allControlsAreRemoved(){return!this.gameControllers.some(t=>!t.container.isRemoved)}isEndedExpectation(){if(!this.player||!this.gameControllers)return!1;let e=this.player.info.position$.getValue(),t=this.player.info.duration$.getValue();return e===t&&this.gameControllers.some(n=>{let i=n.container.container;return!n.container.isRemoved&&i.endTime===null&&pe(i.events)})}playPrevChapter(){this.historyController.goBack()}setDisabledControls(e){this.state.disabledControls$.next(e)}isSupport(e=this.manifestController.manifest){return!!e&&wt(e.metadata.version)}getInitialVideoInfo(){return{videoId:this.historyController.getInitialVideoId(),chapterId:this.historyController.getInitialChapterId()}}getHistoryState(){return this.historyController.state}getIsSeekable(){return this.state.isSeekable$}getInteractiveRanges(){var e;return Rs((e=this.manifestController.chapter)==null?void 0:e.containers)}getNextInteractiveStartTime(e){return this.seekToInteractiveController.getNextInteractiveTime(e)}getChapterBranches(e){return this.manifestController.getBranches(e)}getCurrentChapter(){return this.manifestController.getCurrent()}getCurrentManifest(){return this.manifestController.manifest}on(e,t){return this.globalEventEmitter.on(e,t),this}off(e,t){return this.globalEventEmitter.off(e,t),this}once(e,t){return this.globalEventEmitter.once(e,t),this}destroy(){var e,t,n,i,a;this.clearHistoryIfEnded(),this.removeControllers(),this.gameControllers=[],(e=this.graph)==null||e.destroy(),this.seamlessControllerSubs.unsubscribe(),(t=this.seamlessController)==null||t.removeAll(),(n=this.resizeManager)==null||n.release(),this.animation.release(),(i=this.interactiveEvents)==null||i.release(),this.manifestController.release(),this.playerSubscriptions.unsubscribe(),this.subscriptions.unsubscribe(),this.globalEventEmitter.reset(),(a=this.lastFrame)==null||a.destroy(),this.rootElement.remove(),this.historyController.destroy(),this.isFirstChapterFetched=!1,this.appState=3}};var sh={Container:be,createChoiceContainer:ht,createAreaControl:ct,createButtonControl:ut,getRootEl:nt,classnamesPrefix:D};var Ny={version:yn};export{Af as ContainerTypes,At as ControlTypes,_ as CustomError,k as EVENT_NAMES,V as EventActionTypes,Rf as EventTypes,Gt as Interactives,we as ManifestController,Ny as SDKInfo,en as chapterIdsToVKVideoIds,Lr as compareVersions,Ef as containerTypes,If as controlTypes,ka as eventActionTypes,Tf as eventTypes,Jp as getChapterIdByVkVideoId,wo as getVKVideoIdByMedia,Xp as getVideoRawIdByMedia,Ye as graphEventTypes,$t as hasEndTemplate,j as interactivesEventTypes,Cf as isAreaControl,gf as isButtonControl,J as isLastChapter,Se as isOneTextCtrlContainer,wt as isSupportedManifest,St as isTextControl,Zp as isVKVariantItem,Pa as isValidManifest,Va as migrateManifestToLatestVersion,sh as utils,Ao as vkVideoIdsToChapterIds};
|
|
23
|
+
`,r}var Gt=class{constructor(e){this.playerSubscriptions=new nn;this.subscriptions=new nn;this.globalEventEmitter=new Rt;this.animation=new Ot;this.seekToInteractiveController=new Ge;this.endedRanges=new Set;this.gameControllers=[];this.rootElement=ah();this.factories=new Map([["choice",ht]]);this.isFirstChapterFetched=!1;this.player=null;this.interactiveEvents=null;this.selectBranches=null;this.seamlessController=null;this.seamlessControllerSubs=new nn;this.graph=null;this.lastFrame=null;this.appState=0;this.state={prevChapter$:new H(null),isInitialChapter$:new H(!1),isFirstChapter$:new H(!0),isEndChapter$:new H(!1),isInteractiveExpectation$:new H(!1),isReplay$:new H(!1),calledByInteractive$:new H(!1),lastChapterChangeWasInitiatedByInteractive$:new H(!1),disabledControls$:new H(!1),interactiveRanges$:new H([]),isInteractiveTime$:new H(!1),statistics$:new H(null),isSeekable$:new H(!1)};this.events={noInteraction$:new q,graphVisibilityChanged$:new q,watchAgainIsClicked$:new q,chapterChanged$:new q,playerChanged$:new q,error$:new q,eachTick$:new q,manifestChanged$:new q,interactiveRangeEnded$:new q,interactiveContainerRemoved$:new q,interactiveContainerFakeRemoved$:new q,interactiveActionExecution$:new q,interactiveActionChoice$:new q,interactiveVisibilityChanged$:new q};this.emitErrorEvent=e=>{this.events.error$.next(e),this.globalEventEmitter.emit(P.errors,e)};this.clearHistoryIfEnded=()=>{var i;let e=(i=this.player)==null?void 0:i.info.isEnded$.getValue(),t=this.state.isInteractiveExpectation$.getValue(),{chapter:n}=this.getCurrentChapter();e&&n&&J(n)&&!t&&this.historyController.updateHistory([]),window.removeEventListener("beforeunload",this.clearHistoryIfEnded)};this.handleSeamlessPlayerChanged=e=>{if(!e)return;let i=e,{statistics:t}=i,n=X(i,["statistics"]);if(t){let{statSubscription:a,oneStat:o}=t;a.add(o.attachToInteractive(this.getStatEvents())),this.state.statistics$.next(t)}this.state.isReplay$.getValue()&&this.state.isReplay$.next(!1),this.events.playerChanged$.next(n),this.globalEventEmitter.emit(P.playerChanged,n)};this.onPlaybackStarted=()=>{var e;(e=this.resizeManager)==null||e.calc(),this.animation.requestAnimation()};this.removeControllers=(e=!0)=>{this.gameControllers.forEach(t=>{!e&&t.isPermanentText||(this.animation.removeFn(t.whilePlaying),t.destroy())})};this.completeInteractiveRange=e=>{let{interactiveRanges$:t}=this.state,i=t.getValue().map(a=>x(d({},a),{subjects:a.subjects.filter(o=>o.id!==e)}));t.next(i)};this.clearNoInteractionTimeout=()=>{this.noInteractionTimeout&&(clearTimeout(this.noInteractionTimeout),this.noInteractionTimeout=void 0)};var t;this._options=x(d(d({},Po),e),{config:d(d({},Po.config),e.config)}),this._options.parentElement.append(this.rootElement),this.historyController=new Je({interactiveController:this,globalEventEmitter:this.globalEventEmitter,videoId:(t=this._options.projectInfo)==null?void 0:t.videoId,historyApi:this._options.historyApi,settings:{maxLength:this._options.config.historyMaxLength,initChapterId:this._options.initChapterId}}),this._options.lastFrame&&(this.lastFrame=new Ut({parentElement:this._options.parentElement,onError:n=>{let i=new _(1,6,n);this.emitErrorEvent(i)}})),this.subscriptions.add(ko(this.rootElement,"mousedown").subscribe(n=>n.stopPropagation())).add(ko(this.rootElement,"mouseup").subscribe(n=>n.stopPropagation())),this.manifestController=new we(this._options.loaders,n=>{let i=new _(1,3,n);this.emitErrorEvent(i)}),this.resizeManager=mo(()=>{var n,i;return{player:this.player,parentElement:(n=this._options)==null?void 0:n.parentElement,fns:(i=this._options)!=null&&i.lastFrame?[()=>{var a;(a=this.lastFrame)==null||a.updateCanvasDimensions(!0)}]:[]}}),this._options.graph&&(this.graph=new Ue({root:this._options.parentElement,lang:this._options.lang,onOpenPreviewClick:n=>{this.setChapter({chapterId:n}),this.globalEventEmitter.emit(P.graph,{type:Ye.watchAgainClicked,chapterId:n}),this.events.watchAgainIsClicked$.next(n)},onError:n=>{let i=new _(1,4,{message:n});this.emitErrorEvent(i)}})),this.initSubscriptions()}initSubscriptions(){this.playerSubscriptions.add(this.historyController.events.inited$.subscribe(t=>k(this,[t],function*({videosInfo:e=[]}){this._options.initSeamless&&(yield this.initSeamless(),this.updateGraphVideosInfo(e))}))),this.subscriptions.add(this.events.interactiveContainerRemoved$.subscribe(({subjectId:e})=>{this.completeInteractiveRange(e)})).add(this.events.interactiveContainerFakeRemoved$.subscribe(({subjectId:e,removeAllOpenURI:t})=>{this.handleFakeRemoval(e,t)})).add(this.events.interactiveActionExecution$.subscribe(e=>{var t,n;if(this.state.calledByInteractive$.next(!0),this.state.lastChapterChangeWasInitiatedByInteractive$.next(!0),((t=e.payload)==null?void 0:t.behaviour)==="change-chapter"){let{chapterId:i}=e.payload;this.setChapter({chapterId:i}),this.state.isFirstChapter$.getValue()&&this.state.isFirstChapter$.next(!1)}else if(((n=e.payload)==null?void 0:n.behaviour)==="change-manifest"){let{manifestURL:i}=e.payload;i&&this.setManifest(i)}e.actionType==="expect"?this.state.isInteractiveExpectation$.next(!0):e.actionType==="after-expect"&&this.state.isInteractiveExpectation$.next(!1)})).add(this.events.manifestChanged$.subscribe(()=>{this.state.calledByInteractive$.next(!1),this.state.lastChapterChangeWasInitiatedByInteractive$.next(!1)})).add(this.events.interactiveActionChoice$.subscribe(({type:e,subjectName:t,payload:n})=>{e!=="action-choice"||t==="chapter"||"invokeImmediately"in n&&n.invokeImmediately||this.removeControllers(!1)}))}initSeamless(){return k(this,null,function*(){this.seamlessController=Kr(this),this.seamlessControllerSubs.add(this.seamlessController.activePlayerChanged.subscribe(this.handleSeamlessPlayerChanged)),yield this.seamlessController.init()})}handlePositionChange(e){(!this.graph||this.graph.isHidden)&&this.checkIfSeekable();let t=e*1e3,i=this.getInteractiveRanges().reverse().find(({range:a})=>t>=a[1]);if(i){let a=i.range.join("-");this.endedRanges.has(a)||(this.endedRanges.add(a),this.globalEventEmitter.emit(P.interactives,{type:j.rangeEnded,payload:i,visibility:!0}),this.events.interactiveRangeEnded$.next({type:"range-ended",payload:i}))}}registerVideoEvents(){this.player&&(window.removeEventListener("beforeunload",this.clearHistoryIfEnded),this.playerSubscriptions.unsubscribe(),window.addEventListener("beforeunload",this.clearHistoryIfEnded),this.playerSubscriptions.add(this.player.events.started$.pipe(ih()).subscribe(this.onPlaybackStarted)).add(this.player.events.playing$.subscribe(this.animation.requestAnimation)).add(this.player.events.willPause$.subscribe(this.animation.cancelAnimation)).add(this.player.info.position$.subscribe(this.handlePositionChange.bind(this))).add(this.manifestController.prevChapter$.subscribe(e=>this.state.prevChapter$.next(e))).add(rh({position:this.player.info.position$,interactiveRanges:this.state.interactiveRanges$,isInteractiveExpectation:this.state.isInteractiveExpectation$}).subscribe(({position:e,interactiveRanges:t,isInteractiveExpectation:n})=>{var s;let i;if(n)i=!0;else{let l=e*1e3;i=!!t.find(({range:[y,b],subjects:C})=>y<l&&l<b&&C.some(S=>!S.isRemoved)&&C.length)}i!==this.state.isInteractiveTime$.getValue()&&this.state.isInteractiveTime$.next(i);let a=!!this.noInteractionTimeout,c=((s=this.player)==null?void 0:s.info.playbackState$.getValue())==="playing"||n;i&&!a&&c?this.noInteractionTimeout=window.setTimeout(()=>{this.events.noInteraction$.next()},this._options.config.noInteractionEventTimeout):a&&!c&&this.clearNoInteractionTimeout()})),this.playerSubscriptions.add(this.historyController.events.error$.subscribe(this.events.error$)),this._options.lastFrame&&this.playerSubscriptions.add(this.player.info.duration$.subscribe(e=>{var t;(t=this.lastFrame)==null||t.setVideoDuration(e*1e3)})).add(this.player.experimental.element$.subscribe(e=>{var t;e&&((t=this.lastFrame)==null||t.setVideoElement(e))})).add(this.player.events.firstFrame$.subscribe(()=>{var e;(e=this.lastFrame)==null||e.reset(),setTimeout(()=>{var t,n;(t=this.lastFrame)==null||t.hide(),(n=this.lastFrame)==null||n.lastFrameCanvas.clear()},50)})).add(this.player.events.seeked$.subscribe(this.lastFrame.onSeek)))}setGameControllers(){var t,n;let e=this.manifestController.chapter;e&&this.appState===1&&((t=this.selectBranches)==null||t.setManifestChapterEvents(e),this.gameControllers=this.filterGameControllers(e),(n=this.interactiveEvents)==null||n.containersEventsCallState.setData(e.containers),this.seekToInteractiveController.setContainers(this.gameControllers.map(i=>i.container.container).filter(i=>!Se(i.controls))),this._options.lastFrame&&this.animation.addFn(()=>{var i;this.player&&((i=this.lastFrame)==null||i.onEachTick(this.player.info.position$.getValue()*1e3))},!0),this.state.interactiveRanges$.next(this.getInteractiveRanges()),this.appState=2)}filterGameControllers(e){let t=[];return e.containers.forEach(n=>{let i=n.type.trim().toLowerCase(),a=this.factories.get(i),o=a==null?void 0:a(n,this.rootElement);if(o&&this.selectBranches&&this.interactiveEvents&&this.player){let c=new Ft({player:this.player,container:o,branches:e.branches,selectBranches:this.selectBranches,interactiveEvents:this.interactiveEvents,globalEvents:this.events,globalEventEmitter:this.globalEventEmitter,getContainerEventState:()=>La(n,this.gameControllers),permanentTextControls:this._options.permanentTextControls,interactiveTimeOpenUri:this._options.interactiveTimeOpenUri,disabledControls$:this.state.disabledControls$,onRemove:()=>{this.seekToInteractiveController.deleteContainer(n.id)}});this.animation.addFn(c.whilePlaying,!0),t.push(c)}}),t}checkIfSeekable(){if(this.state.isInteractiveExpectation$.getValue()){this.state.isSeekable$.next(!1);return}let t=this.state.isSeekable$.getValue(),n=!!this.seekToInteractiveController.getNextInteractiveTime();(n&&!t||!n&&t)&&this.state.isSeekable$.next(!t)}updateLastEventInfo(){this.state.calledByInteractive$.getValue()?this.state.calledByInteractive$.next(!1):this.state.lastChapterChangeWasInitiatedByInteractive$.next(!1)}pushChapterToHistory(e){var c,s;if(this.updateLastEventInfo(),!this.historyController.inited)return;let t=this.state.lastChapterChangeWasInitiatedByInteractive$.getValue(),n=this.state.prevChapter$.getValue(),i=(c=n&&J(n)&&$t(n))!=null?c:!1,a=((s=this.manifestController.manifest)==null?void 0:s.metadata.initChapterId)===e,o=this.historyController.state.history$.getValue();if(a||i&&t){this.historyController.updateHistory([e]);return}(0,Vo.default)(o,-1)!==e&&this.historyController.updateHistory([...o,e])}handleFakeRemoval(e,t){let{interactiveRanges$:n}=this.state,a=n.getValue().map(o=>{let c=o.subjects.some(l=>l.id===e),s=o.subjects.map(l=>t&&c||l.id===e?x(d({},l),{isRemoved:!0}):l);return x(d({},o),{subjects:s})});n.next(a)}reset(){var e;this.appState===2&&(this.removeControllers(),this.gameControllers=[],this.animation.release(),(e=this.interactiveEvents)==null||e.release(),this.appState=1,this.state.isSeekable$.next(!1),this.clearNoInteractionTimeout())}get options(){return this._options}init(){var e;this.manifestController.chapter&&this._options.parentElement&&this.player&&this._options.fullscreenTargetElement&&this.appState===0&&((e=this.resizeManager)==null||e.resizeObserver.observe(this._options.fullscreenTargetElement),this.registerVideoEvents(),this.appState=1,this.setGameControllers())}setManifest(e){return k(this,null,function*(){this.reset(),this.isFirstChapterFetched=!1;let t=yield this.manifestController.setManifest(e);if(t.manifest)return this.graph&&this.graph.handleManifestChange(t.manifest),yield this.historyController.setManifest(t.manifest),this.events.manifestChanged$.next(t.manifest),this.globalEventEmitter.emit(P.manifestChanged,{manifest:t.manifest}),this.setGameControllers(),t.manifest})}setPlayer(e){this.reset(),this.player=e,this.seekToInteractiveController.setPlayer(this.player),this.interactiveEvents?this.interactiveEvents.setPlayer(this.player):this.interactiveEvents=po(this.player,this._options.interactiveTimeOpenUri),this.selectBranches=So({player:this.player,interactiveEvents:this.interactiveEvents,globalEvents:this.events,globalEventEmitter:this.globalEventEmitter}),this.appState===1&&(this.registerVideoEvents(),this.setGameControllers())}setChapter(){return k(this,arguments,function*({chapterId:e,pushToHistory:t=!0,playPrev:n=!1}={}){var s,l;this.reset(),this.lastFrame&&this.isFirstChapterFetched&&(this.lastFrame.draw(),this.lastFrame.show()),th.isSafari&&(yield Ro(35));let i=!n&&this.state.isEndChapter$.getValue()&&((s=this.getCurrentManifest())==null?void 0:s.metadata.initChapterId)===e;this.state.isReplay$.next(i);let{chapter:a,media:o,graph:c}=yield e?this.manifestController.setNext(e):this.manifestController.setInitial();(!e||i)&&this.state.isFirstChapter$.next(!0),!(!a||!o)&&(t&&this.pushChapterToHistory(a.id),this.state.isInitialChapter$.next(this.manifestController.isInitialChapter()),this.state.isEndChapter$.next(this.manifestController.isEndChapter()),this.graph&&this.graph.handleChapterChange(a),(l=this.lastFrame)==null||l.setCurrentChapter(a),this.events.chapterChanged$.next({chapter:a,manifestVideo:o}),this.globalEventEmitter.emit(P.chapterChanged,{chapter:a,media:o,graph:c}),this.setGameControllers(),this.endedRanges=new Set,this.isFirstChapterFetched=!0)})}getStatEvents(){return{click$:new Oo(e=>{this.subscriptions.add(this.events.graphVisibilityChanged$.subscribe(t=>{e.next(t?et.GRAPH_SHOW:et.GRAPH_HIDE)})).add(this.events.watchAgainIsClicked$.subscribe(()=>{e.next(et.WATCH_AGAIN)})).add(this.events.interactiveActionChoice$.subscribe(({type:t,subjectName:n,subjectType:i})=>{t!=="action-choice"||n!=="control"||(i==="Button"&&e.next(et.NEXT_BUTTON),i==="Area"&&e.next(et.NEXT_AREA))}))}),nextMovie$:new Oo(e=>{this.events.playerChanged$.subscribe(({config:t})=>{t!=null&&t.unitedVideoId&&!this.state.isFirstChapter$.getValue()&&e.next(t.unitedVideoId)})})}}toggleGraphView(e=!0){this.graph&&(e?(this.graph.show(),this.state.isSeekable$.next(!1)):(this.graph.hide(),this.checkIfSeekable()),this.globalEventEmitter.emit(P.graph,{type:Ye.visibility,visibility:e}),this.events.graphVisibilityChanged$.next(e))}setVisitedChapters(e){var t;Array.isArray(e)&&((t=this.graph)==null||t.setVisitedChapters(e))}updateGraphVideosInfo(e){var t;Array.isArray(e)&&((t=this.graph)==null||t.updateVideosInfo(e))}deadEndCheck(){var n;return!(((n=this.interactiveEvents)==null?void 0:n.getPreparedToExecActions())||[]).some(i=>i.actionType===V.setNextBranch)}allControlsAreRemoved(){return!this.gameControllers.some(t=>!t.container.isRemoved)}isEndedExpectation(){if(!this.player||!this.gameControllers)return!1;let e=this.player.info.position$.getValue(),t=this.player.info.duration$.getValue();return e===t&&this.gameControllers.some(n=>{let i=n.container.container;return!n.container.isRemoved&&i.endTime===null&&pe(i.events)})}playPrevChapter(){this.historyController.goBack()}setDisabledControls(e){this.state.disabledControls$.next(e)}isSupport(e=this.manifestController.manifest){return!!e&&wt(e.metadata.version)}getInitialVideoInfo(){return{videoId:this.historyController.getInitialVideoId(),chapterId:this.historyController.getInitialChapterId()}}getHistoryState(){return this.historyController.state}getIsSeekable(){return this.state.isSeekable$}getInteractiveRanges(){var e;return Rs((e=this.manifestController.chapter)==null?void 0:e.containers)}getNextInteractiveStartTime(e){return this.seekToInteractiveController.getNextInteractiveTime(e)}getChapterBranches(e){return this.manifestController.getBranches(e)}getCurrentChapter(){return this.manifestController.getCurrent()}getCurrentManifest(){return this.manifestController.manifest}on(e,t){return this.globalEventEmitter.on(e,t),this}off(e,t){return this.globalEventEmitter.off(e,t),this}once(e,t){return this.globalEventEmitter.once(e,t),this}destroy(){var e,t,n,i,a;this.clearHistoryIfEnded(),this.removeControllers(),this.gameControllers=[],(e=this.graph)==null||e.destroy(),this.seamlessControllerSubs.unsubscribe(),(t=this.seamlessController)==null||t.removeAll(),(n=this.resizeManager)==null||n.release(),this.animation.release(),(i=this.interactiveEvents)==null||i.release(),this.manifestController.release(),this.playerSubscriptions.unsubscribe(),this.subscriptions.unsubscribe(),this.globalEventEmitter.reset(),(a=this.lastFrame)==null||a.destroy(),this.rootElement.remove(),this.historyController.destroy(),this.isFirstChapterFetched=!1,this.appState=3}};var sh={Container:be,createChoiceContainer:ht,createAreaControl:ct,createButtonControl:ut,getRootEl:nt,classnamesPrefix:D};var Ny={version:yn};export{Af as ContainerTypes,At as ControlTypes,_ as CustomError,P as EVENT_NAMES,V as EventActionTypes,Rf as EventTypes,Gt as Interactives,we as ManifestController,Ny as SDKInfo,en as chapterIdsToVKVideoIds,Lr as compareVersions,Ef as containerTypes,If as controlTypes,Pa as eventActionTypes,Tf as eventTypes,Jp as getChapterIdByVkVideoId,wo as getVKVideoIdByMedia,Xp as getVideoRawIdByMedia,Ye as graphEventTypes,$t as hasEndTemplate,j as interactivesEventTypes,Cf as isAreaControl,gf as isButtonControl,J as isLastChapter,Se as isOneTextCtrlContainer,wt as isSupportedManifest,St as isTextControl,Zp as isVKVariantItem,ka as isValidManifest,Va as migrateManifestToLatestVersion,sh as utils,Ao as vkVideoIdsToChapterIds};
|