@vkontakte/videoplayer-interactive 1.0.37-dev.6c00e4da.0 → 1.0.37-dev.8109bc71.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 +3 -3
- package/es2015.esm.js +3 -3
- package/es2018.cjs.js +3 -3
- package/es2018.esm.js +3 -3
- package/es2024.cjs.js +3 -3
- package/es2024.esm.js +3 -3
- package/esnext.cjs.js +3 -3
- package/esnext.esm.js +3 -3
- package/evergreen.esm.js +3 -3
- package/package.json +4 -4
package/es2015.cjs.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-interactive v1.0.37-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-interactive v1.0.37-dev.8109bc71.0
|
|
3
|
+
* Wed, 04 Jun 2025 09:45:19 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-37/doc/
|
|
5
5
|
*/
|
|
6
|
-
"use strict";var tl=Object.create;var _e=Object.defineProperty,rl=Object.defineProperties,nl=Object.getOwnPropertyDescriptor,il=Object.getOwnPropertyDescriptors,ol=Object.getOwnPropertyNames,yt=Object.getOwnPropertySymbols,sl=Object.getPrototypeOf,or=Object.prototype.hasOwnProperty,wn=Object.prototype.propertyIsEnumerable;var An=r=>{throw TypeError(r)};var Sn=(r,e,t)=>e in r?_e(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,d=(r,e)=>{for(var t in e||(e={}))or.call(e,t)&&Sn(r,t,e[t]);if(yt)for(var t of yt(e))wn.call(e,t)&&Sn(r,t,e[t]);return r},T=(r,e)=>rl(r,il(e));var ee=(r,e)=>{var t={};for(var n in r)or.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&yt)for(var n of yt(r))e.indexOf(n)<0&&wn.call(r,n)&&(t[n]=r[n]);return t};var h=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),al=(r,e)=>{for(var t in e)_e(r,t,{get:e[t],enumerable:!0})},Rn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ol(e))!or.call(r,i)&&i!==t&&_e(r,i,{get:()=>e[i],enumerable:!(n=nl(e,i))||n.enumerable});return r};var Q=(r,e,t)=>(t=r!=null?tl(sl(r)):{},Rn(e||!r||!r.__esModule?_e(t,"default",{value:r,enumerable:!0}):t,r)),ll=r=>Rn(_e({},"__esModule",{value:!0}),r);var kn=(r,e,t)=>e.has(r)||An("Cannot "+t);var k=(r,e,t)=>(kn(r,e,"read from private field"),t?t.call(r):e.get(r)),U=(r,e,t)=>e.has(r)?An("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),F=(r,e,t,n)=>(kn(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);var On=(r,e,t,n)=>({set _(i){F(r,e,i,t)},get _(){return k(r,e,n)}});var O=(r,e,t)=>new Promise((n,i)=>{var o=a=>{try{l(t.next(a))}catch(c){i(c)}},s=a=>{try{l(t.throw(a))}catch(c){i(c)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(o,s);l((t=t.apply(r,e)).next())});var re=h((vr,Dn)=>{"use strict";var Ge=function(r){return r&&r.Math===Math&&r};Dn.exports=Ge(typeof globalThis=="object"&&globalThis)||Ge(typeof window=="object"&&window)||Ge(typeof self=="object"&&self)||Ge(typeof global=="object"&&global)||Ge(typeof vr=="object"&&vr)||function(){return this}()||Function("return this")()});var G=h((Bd,Hn)=>{"use strict";Hn.exports=function(r){try{return!!r()}catch(e){return!0}}});var ze=h((qd,Un)=>{"use strict";var cl=G();Un.exports=!cl(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var Qn=h((Dd,Kn)=>{"use strict";var ul=ze(),Wn=Function.prototype,Gn=Wn.apply,zn=Wn.call;Kn.exports=typeof Reflect=="object"&&Reflect.apply||(ul?zn.bind(Gn):function(){return zn.apply(Gn,arguments)})});var X=h((Hd,Zn)=>{"use strict";var Xn=ze(),Yn=Function.prototype,yr=Yn.call,pl=Xn&&Yn.bind.bind(yr,yr);Zn.exports=Xn?pl:function(r){return function(){return yr.apply(r,arguments)}}});var We=h((Ud,ei)=>{"use strict";var Jn=X(),hl=Jn({}.toString),dl=Jn("".slice);ei.exports=function(r){return dl(hl(r),8,-1)}});var br=h((Gd,ti)=>{"use strict";var ml=We(),fl=X();ti.exports=function(r){if(ml(r)==="Function")return fl(r)}});var z=h((zd,ri)=>{"use strict";var Cr=typeof document=="object"&&document.all;ri.exports=typeof Cr=="undefined"&&Cr!==void 0?function(r){return typeof r=="function"||r===Cr}:function(r){return typeof r=="function"}});var ve=h((Wd,ni)=>{"use strict";var vl=G();ni.exports=!vl(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var Vt=h((Kd,ii)=>{"use strict";var yl=ze(),Pt=Function.prototype.call;ii.exports=yl?Pt.bind(Pt):function(){return Pt.apply(Pt,arguments)}});var gr=h(ai=>{"use strict";var oi={}.propertyIsEnumerable,si=Object.getOwnPropertyDescriptor,bl=si&&!oi.call({1:2},1);ai.f=bl?function(e){var t=si(this,e);return!!t&&t.enumerable}:oi});var Er=h((Xd,li)=>{"use strict";li.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var ui=h((Yd,ci)=>{"use strict";var Cl=X(),gl=G(),El=We(),Ir=Object,Il=Cl("".split);ci.exports=gl(function(){return!Ir("z").propertyIsEnumerable(0)})?function(r){return El(r)==="String"?Il(r,""):Ir(r)}:Ir});var xr=h((Zd,pi)=>{"use strict";pi.exports=function(r){return r==null}});var Tr=h((Jd,hi)=>{"use strict";var xl=xr(),Tl=TypeError;hi.exports=function(r){if(xl(r))throw new Tl("Can't call method on "+r);return r}});var Ke=h((em,di)=>{"use strict";var Sl=ui(),wl=Tr();di.exports=function(r){return Sl(wl(r))}});var Re=h((tm,mi)=>{"use strict";var Al=z();mi.exports=function(r){return typeof r=="object"?r!==null:Al(r)}});var Mt=h((rm,fi)=>{"use strict";fi.exports={}});var Nt=h((nm,yi)=>{"use strict";var Sr=Mt(),wr=re(),Rl=z(),vi=function(r){return Rl(r)?r:void 0};yi.exports=function(r,e){return arguments.length<2?vi(Sr[r])||vi(wr[r]):Sr[r]&&Sr[r][e]||wr[r]&&wr[r][e]}});var Ci=h((im,bi)=>{"use strict";var kl=X();bi.exports=kl({}.isPrototypeOf)});var xi=h((om,Ii)=>{"use strict";var Ol=re(),gi=Ol.navigator,Ei=gi&&gi.userAgent;Ii.exports=Ei?String(Ei):""});var Oi=h((sm,ki)=>{"use strict";var Ri=re(),Ar=xi(),Ti=Ri.process,Si=Ri.Deno,wi=Ti&&Ti.versions||Si&&Si.version,Ai=wi&&wi.v8,Y,Lt;Ai&&(Y=Ai.split("."),Lt=Y[0]>0&&Y[0]<4?1:+(Y[0]+Y[1]));!Lt&&Ar&&(Y=Ar.match(/Edge\/(\d+)/),(!Y||Y[1]>=74)&&(Y=Ar.match(/Chrome\/(\d+)/),Y&&(Lt=+Y[1])));ki.exports=Lt});var Rr=h((am,Vi)=>{"use strict";var Pi=Oi(),Pl=G(),Vl=re(),Ml=Vl.String;Vi.exports=!!Object.getOwnPropertySymbols&&!Pl(function(){var r=Symbol("symbol detection");return!Ml(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&Pi&&Pi<41})});var kr=h((lm,Mi)=>{"use strict";var Nl=Rr();Mi.exports=Nl&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Or=h((cm,Ni)=>{"use strict";var Ll=Nt(),jl=z(),$l=Ci(),Fl=kr(),_l=Object;Ni.exports=Fl?function(r){return typeof r=="symbol"}:function(r){var e=Ll("Symbol");return jl(e)&&$l(e.prototype,_l(r))}});var ji=h((um,Li)=>{"use strict";var Bl=String;Li.exports=function(r){try{return Bl(r)}catch(e){return"Object"}}});var Pr=h((pm,$i)=>{"use strict";var ql=z(),Dl=ji(),Hl=TypeError;$i.exports=function(r){if(ql(r))return r;throw new Hl(Dl(r)+" is not a function")}});var _i=h((hm,Fi)=>{"use strict";var Ul=Pr(),Gl=xr();Fi.exports=function(r,e){var t=r[e];return Gl(t)?void 0:Ul(t)}});var qi=h((dm,Bi)=>{"use strict";var Vr=Vt(),Mr=z(),Nr=Re(),zl=TypeError;Bi.exports=function(r,e){var t,n;if(e==="string"&&Mr(t=r.toString)&&!Nr(n=Vr(t,r))||Mr(t=r.valueOf)&&!Nr(n=Vr(t,r))||e!=="string"&&Mr(t=r.toString)&&!Nr(n=Vr(t,r)))return n;throw new zl("Can't convert object to primitive value")}});var Hi=h((mm,Di)=>{"use strict";Di.exports=!0});var zi=h((fm,Gi)=>{"use strict";var Ui=re(),Wl=Object.defineProperty;Gi.exports=function(r,e){try{Wl(Ui,r,{value:e,configurable:!0,writable:!0})}catch(t){Ui[r]=e}return e}});var jt=h((vm,Qi)=>{"use strict";var Kl=Hi(),Ql=re(),Xl=zi(),Wi="__core-js_shared__",Ki=Qi.exports=Ql[Wi]||Xl(Wi,{});(Ki.versions||(Ki.versions=[])).push({version:"3.38.0",mode:Kl?"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 Lr=h((ym,Yi)=>{"use strict";var Xi=jt();Yi.exports=function(r,e){return Xi[r]||(Xi[r]=e||{})}});var Qe=h((bm,Zi)=>{"use strict";var Yl=Tr(),Zl=Object;Zi.exports=function(r){return Zl(Yl(r))}});var ke=h((Cm,Ji)=>{"use strict";var Jl=X(),ec=Qe(),tc=Jl({}.hasOwnProperty);Ji.exports=Object.hasOwn||function(e,t){return tc(ec(e),t)}});var jr=h((gm,eo)=>{"use strict";var rc=X(),nc=0,ic=Math.random(),oc=rc(1 .toString);eo.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+oc(++nc+ic,36)}});var Xe=h((Em,ro)=>{"use strict";var sc=re(),ac=Lr(),to=ke(),lc=jr(),cc=Rr(),uc=kr(),Oe=sc.Symbol,$r=ac("wks"),pc=uc?Oe.for||Oe:Oe&&Oe.withoutSetter||lc;ro.exports=function(r){return to($r,r)||($r[r]=cc&&to(Oe,r)?Oe[r]:pc("Symbol."+r)),$r[r]}});var so=h((Im,oo)=>{"use strict";var hc=Vt(),no=Re(),io=Or(),dc=_i(),mc=qi(),fc=Xe(),vc=TypeError,yc=fc("toPrimitive");oo.exports=function(r,e){if(!no(r)||io(r))return r;var t=dc(r,yc),n;if(t){if(e===void 0&&(e="default"),n=hc(t,r,e),!no(n)||io(n))return n;throw new vc("Can't convert object to primitive value")}return e===void 0&&(e="number"),mc(r,e)}});var Fr=h((xm,ao)=>{"use strict";var bc=so(),Cc=Or();ao.exports=function(r){var e=bc(r,"string");return Cc(e)?e:e+""}});var uo=h((Tm,co)=>{"use strict";var gc=re(),lo=Re(),_r=gc.document,Ec=lo(_r)&&lo(_r.createElement);co.exports=function(r){return Ec?_r.createElement(r):{}}});var Br=h((Sm,po)=>{"use strict";var Ic=ve(),xc=G(),Tc=uo();po.exports=!Ic&&!xc(function(){return Object.defineProperty(Tc("div"),"a",{get:function(){return 7}}).a!==7})});var fo=h(mo=>{"use strict";var Sc=ve(),wc=Vt(),Ac=gr(),Rc=Er(),kc=Ke(),Oc=Fr(),Pc=ke(),Vc=Br(),ho=Object.getOwnPropertyDescriptor;mo.f=Sc?ho:function(e,t){if(e=kc(e),t=Oc(t),Vc)try{return ho(e,t)}catch(n){}if(Pc(e,t))return Rc(!wc(Ac.f,e,t),e[t])}});var yo=h((Am,vo)=>{"use strict";var Mc=G(),Nc=z(),Lc=/#|\.prototype\./,Ye=function(r,e){var t=$c[jc(r)];return t===_c?!0:t===Fc?!1:Nc(e)?Mc(e):!!e},jc=Ye.normalize=function(r){return String(r).replace(Lc,".").toLowerCase()},$c=Ye.data={},Fc=Ye.NATIVE="N",_c=Ye.POLYFILL="P";vo.exports=Ye});var qr=h((Rm,Co)=>{"use strict";var bo=br(),Bc=Pr(),qc=ze(),Dc=bo(bo.bind);Co.exports=function(r,e){return Bc(r),e===void 0?r:qc?Dc(r,e):function(){return r.apply(e,arguments)}}});var Eo=h((km,go)=>{"use strict";var Hc=ve(),Uc=G();go.exports=Hc&&Uc(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var xo=h((Om,Io)=>{"use strict";var Gc=Re(),zc=String,Wc=TypeError;Io.exports=function(r){if(Gc(r))return r;throw new Wc(zc(r)+" is not an object")}});var wo=h(So=>{"use strict";var Kc=ve(),Qc=Br(),Xc=Eo(),$t=xo(),To=Fr(),Yc=TypeError,Dr=Object.defineProperty,Zc=Object.getOwnPropertyDescriptor,Hr="enumerable",Ur="configurable",Gr="writable";So.f=Kc?Xc?function(e,t,n){if($t(e),t=To(t),$t(n),typeof e=="function"&&t==="prototype"&&"value"in n&&Gr in n&&!n[Gr]){var i=Zc(e,t);i&&i[Gr]&&(e[t]=n.value,n={configurable:Ur in n?n[Ur]:i[Ur],enumerable:Hr in n?n[Hr]:i[Hr],writable:!1})}return Dr(e,t,n)}:Dr:function(e,t,n){if($t(e),t=To(t),$t(n),Qc)try{return Dr(e,t,n)}catch(i){}if("get"in n||"set"in n)throw new Yc("Accessors not supported");return"value"in n&&(e[t]=n.value),e}});var Ro=h((Vm,Ao)=>{"use strict";var Jc=ve(),eu=wo(),tu=Er();Ao.exports=Jc?function(r,e,t){return eu.f(r,e,tu(1,t))}:function(r,e,t){return r[e]=t,r}});var Je=h((Mm,Oo)=>{"use strict";var Ze=re(),ru=Qn(),nu=br(),iu=z(),ou=fo().f,su=yo(),Pe=Mt(),au=qr(),Ve=Ro(),ko=ke();jt();var lu=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 ru(r,this,arguments)};return e.prototype=r.prototype,e};Oo.exports=function(r,e){var t=r.target,n=r.global,i=r.stat,o=r.proto,s=n?Ze:i?Ze[t]:Ze[t]&&Ze[t].prototype,l=n?Pe:Pe[t]||Ve(Pe,t,{})[t],a=l.prototype,c,f,v,y,g,R,I,m,u;for(y in e)c=su(n?y:t+(i?".":"#")+y,r.forced),f=!c&&s&&ko(s,y),R=l[y],f&&(r.dontCallGetSet?(u=ou(s,y),I=u&&u.value):I=s[y]),g=f&&I?I:e[y],!(!c&&!o&&typeof R==typeof g)&&(r.bind&&f?m=au(g,Ze):r.wrap&&f?m=lu(g):o&&iu(g)?m=nu(g):m=g,(r.sham||g&&g.sham||R&&R.sham)&&Ve(m,"sham",!0),Ve(l,y,m),o&&(v=t+"Prototype",ko(Pe,v)||Ve(Pe,v,{}),Ve(Pe[v],y,g),r.real&&a&&(c||!a[y])&&Ve(a,y,g)))}});var Vo=h((Nm,Po)=>{"use strict";var cu=Math.ceil,uu=Math.floor;Po.exports=Math.trunc||function(e){var t=+e;return(t>0?uu:cu)(t)}});var et=h((Lm,Mo)=>{"use strict";var pu=Vo();Mo.exports=function(r){var e=+r;return e!==e||e===0?0:pu(e)}});var Lo=h((jm,No)=>{"use strict";var hu=et(),du=Math.min;No.exports=function(r){var e=hu(r);return e>0?du(e,9007199254740991):0}});var tt=h(($m,jo)=>{"use strict";var mu=Lo();jo.exports=function(r){return mu(r.length)}});var Ft=h((Fm,$o)=>{"use strict";$o.exports=function(){}});var Fo=h(()=>{"use strict";var fu=Je(),vu=Qe(),yu=tt(),bu=et(),Cu=Ft();fu({target:"Array",proto:!0},{at:function(e){var t=vu(this),n=yu(t),i=bu(e),o=i>=0?i:n+i;return o<0||o>=n?void 0:t[o]}});Cu("at")});var _t=h((qm,_o)=>{"use strict";var gu=Nt();_o.exports=gu});var qo=h((Dm,Bo)=>{"use strict";Fo();var Eu=_t();Bo.exports=Eu("Array","at")});var Ho=h((Hm,Do)=>{"use strict";var Iu=qo();Do.exports=Iu});var zr=h((Um,Uo)=>{"use strict";var xu=Ho();Uo.exports=xu});var Jo=h((Nf,Zo)=>{"use strict";var ju=et(),$u=Math.max,Fu=Math.min;Zo.exports=function(r,e){var t=ju(r);return t<0?$u(t+e,0):Fu(t,e)}});var Jr=h((Lf,ts)=>{"use strict";var _u=Ke(),Bu=Jo(),qu=tt(),es=function(r){return function(e,t,n){var i=_u(e),o=qu(i);if(o===0)return!r&&-1;var s=Bu(n,o),l;if(r&&t!==t){for(;o>s;)if(l=i[s++],l!==l)return!0}else for(;o>s;s++)if((r||s in i)&&i[s]===t)return r||s||0;return!r&&-1}};ts.exports={includes:es(!0),indexOf:es(!1)}});var rs=h(()=>{"use strict";var Du=Je(),Hu=Jr().includes,Uu=G(),Gu=Ft(),zu=Uu(function(){return!Array(1).includes()});Du({target:"Array",proto:!0,forced:zu},{includes:function(e){return Hu(this,e,arguments.length>1?arguments[1]:void 0)}});Gu("includes")});var is=h((Ff,ns)=>{"use strict";rs();var Wu=_t();ns.exports=Wu("Array","includes")});var ss=h((_f,os)=>{"use strict";var Ku=is();os.exports=Ku});var ct=h((Bf,as)=>{"use strict";var Qu=ss();as.exports=Qu});var fs=h((Yf,ms)=>{"use strict";var Yu=Lr(),Zu=jr(),ds=Yu("keys");ms.exports=function(r){return ds[r]||(ds[r]=Zu(r))}});var ys=h((Zf,vs)=>{"use strict";var Ju=G();vs.exports=!Ju(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var gs=h((Jf,Cs)=>{"use strict";var ep=ke(),tp=z(),rp=Qe(),np=fs(),ip=ys(),bs=np("IE_PROTO"),rn=Object,op=rn.prototype;Cs.exports=ip?rn.getPrototypeOf:function(r){var e=rp(r);if(ep(e,bs))return e[bs];var t=e.constructor;return tp(t)&&e instanceof t?t.prototype:e instanceof rn?op:null}});var Is=h((ev,Es)=>{"use strict";Es.exports={}});var Ss=h((tv,Ts)=>{"use strict";var sp=X(),nn=ke(),ap=Ke(),lp=Jr().indexOf,cp=Is(),xs=sp([].push);Ts.exports=function(r,e){var t=ap(r),n=0,i=[],o;for(o in t)!nn(cp,o)&&nn(t,o)&&xs(i,o);for(;e.length>n;)nn(t,o=e[n++])&&(~lp(i,o)||xs(i,o));return i}});var As=h((rv,ws)=>{"use strict";ws.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var ks=h((nv,Rs)=>{"use strict";var up=Ss(),pp=As();Rs.exports=Object.keys||function(e){return up(e,pp)}});var Ls=h((iv,Ns)=>{"use strict";var Ps=ve(),hp=G(),Vs=X(),dp=gs(),mp=ks(),fp=Ke(),vp=gr().f,Ms=Vs(vp),yp=Vs([].push),bp=Ps&&hp(function(){var r=Object.create(null);return r[2]=2,!Ms(r,2)}),Os=function(r){return function(e){for(var t=fp(e),n=mp(t),i=bp&&dp(t)===null,o=n.length,s=0,l=[],a;o>s;)a=n[s++],(!Ps||(i?a in t:Ms(t,a)))&&yp(l,r?[a,t[a]]:t[a]);return l}};Ns.exports={entries:Os(!0),values:Os(!1)}});var js=h(()=>{"use strict";var Cp=Je(),gp=Ls().values;Cp({target:"Object",stat:!0},{values:function(e){return gp(e)}})});var Fs=h((av,$s)=>{"use strict";js();var Ep=Mt();$s.exports=Ep.Object.values});var Bs=h((lv,_s)=>{"use strict";var Ip=Fs();_s.exports=Ip});var Xt=h((cv,qs)=>{"use strict";var xp=Bs();qs.exports=xp});var cn=h((Nv,Xs)=>{"use strict";var Sp=We();Xs.exports=Array.isArray||function(e){return Sp(e)==="Array"}});var Zs=h((Lv,Ys)=>{"use strict";var wp=TypeError,Ap=9007199254740991;Ys.exports=function(r){if(r>Ap)throw wp("Maximum allowed index exceeded");return r}});var ta=h((jv,ea)=>{"use strict";var Rp=cn(),kp=tt(),Op=Zs(),Pp=qr(),Js=function(r,e,t,n,i,o,s,l){for(var a=i,c=0,f=s?Pp(s,l):!1,v,y;c<n;)c in t&&(v=f?f(t[c],c,e):t[c],o>0&&Rp(v)?(y=kp(v),a=Js(r,e,v,y,a,o-1)-1):(Op(a+1),r[a]=v),a++),c++;return a};ea.exports=Js});var ia=h(($v,na)=>{"use strict";var Vp=Xe(),Mp=Vp("toStringTag"),ra={};ra[Mp]="z";na.exports=String(ra)==="[object z]"});var sa=h((Fv,oa)=>{"use strict";var Np=ia(),Lp=z(),Zt=We(),jp=Xe(),$p=jp("toStringTag"),Fp=Object,_p=Zt(function(){return arguments}())==="Arguments",Bp=function(r,e){try{return r[e]}catch(t){}};oa.exports=Np?Zt:function(r){var e,t,n;return r===void 0?"Undefined":r===null?"Null":typeof(t=Bp(e=Fp(r),$p))=="string"?t:_p?Zt(e):(n=Zt(e))==="Object"&&Lp(e.callee)?"Arguments":n}});var la=h((_v,aa)=>{"use strict";var qp=X(),Dp=z(),un=jt(),Hp=qp(Function.toString);Dp(un.inspectSource)||(un.inspectSource=function(r){return Hp(r)});aa.exports=un.inspectSource});var ma=h((Bv,da)=>{"use strict";var Up=X(),Gp=G(),ca=z(),zp=sa(),Wp=Nt(),Kp=la(),ua=function(){},pa=Wp("Reflect","construct"),pn=/^\s*(?:class|function)\b/,Qp=Up(pn.exec),Xp=!pn.test(ua),dt=function(e){if(!ca(e))return!1;try{return pa(ua,[],e),!0}catch(t){return!1}},ha=function(e){if(!ca(e))return!1;switch(zp(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Xp||!!Qp(pn,Kp(e))}catch(t){return!0}};ha.sham=!0;da.exports=!pa||Gp(function(){var r;return dt(dt.call)||!dt(Object)||!dt(function(){r=!0})||r})?ha:dt});var ba=h((qv,ya)=>{"use strict";var fa=cn(),Yp=ma(),Zp=Re(),Jp=Xe(),eh=Jp("species"),va=Array;ya.exports=function(r){var e;return fa(r)&&(e=r.constructor,Yp(e)&&(e===va||fa(e.prototype))?e=void 0:Zp(e)&&(e=e[eh],e===null&&(e=void 0))),e===void 0?va:e}});var ga=h((Dv,Ca)=>{"use strict";var th=ba();Ca.exports=function(r,e){return new(th(r))(e===0?0:e)}});var Ea=h(()=>{"use strict";var rh=Je(),nh=ta(),ih=Qe(),oh=tt(),sh=et(),ah=ga();rh({target:"Array",proto:!0},{flat:function(){var e=arguments.length?arguments[0]:void 0,t=ih(this),n=oh(t),i=ah(t,0);return i.length=nh(i,t,t,n,0,e===void 0?1:sh(e)),i}})});var Ia=h(()=>{"use strict";var lh=Ft();lh("flat")});var Ta=h((Wv,xa)=>{"use strict";Ea();Ia();var ch=_t();xa.exports=ch("Array","flat")});var wa=h((Kv,Sa)=>{"use strict";var uh=Ta();Sa.exports=uh});var Ra=h((Qv,Aa)=>{"use strict";var ph=wa();Aa.exports=ph});var Eh={};al(Eh,{ContainerTypes:()=>E.ContainerTypes,ControlTypes:()=>E.ControlTypes,CustomError:()=>L,EVENT_NAMES:()=>P,EventActionTypes:()=>E.EventActionTypes,EventTypes:()=>E.EventTypes,Interactives:()=>ft,ManifestController:()=>Ce,SDKInfo:()=>gh,chapterIdsToVKVideoIds:()=>er,compareVersions:()=>zt,containerTypes:()=>Au,controlTypes:()=>Ru,eventActionTypes:()=>Kr,eventTypes:()=>ku,getChapterIdByVkVideoId:()=>za,getVKVideoIdByMedia:()=>mn,getVideoRawIdByMedia:()=>Ua,graphEventTypes:()=>Le,hasEndTemplate:()=>ut,interactivesEventTypes:()=>j,isAreaControl:()=>wu,isButtonControl:()=>Su,isLastChapter:()=>Z,isOneTextCtrlContainer:()=>be,isSupportedManifest:()=>E.isSupportedManifest,isTextControl:()=>ot,isVKVariantItem:()=>Ga,isValidManifest:()=>Wr,migrateManifestToLatestVersion:()=>E.migrateManifestToLatestVersion,utils:()=>Ja,vkVideoIdsToChapterIds:()=>fn});module.exports=ll(Eh);var Pn="1.0.37-dev.6c00e4da.0";var kt=require("@vkontakte/videoplayer-shared/es2015");var sr=class{constructor(e){this.layout=e}},bt=class extends sr{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))`}};function Vn(r){return"features"in r}var Se=class{constructor(e,t){this.container=e,this.options=t,this.factories=new Map,this.controls=[],this.setControls()}featureIsEnabled(e){return this.options&&Vn(this.options)&&this.options.features[e]}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(),o=this.factories.get(i);if(o){let s=o(n,this.options);if(s)return[...t,s]}return[...t]},[]))||[]}};var me=require("@vkontakte/videoplayer-shared/es2015");function Be(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 Mn="interactive",_={textColor:"#000",textSize:.4,textContent:"",roundCorners:0,borderWidth:0,borderWidthRawValue:"1px",roundCornersRawValue:"0",borderColor:"#000",borderAlpha:1,backgroundColor:"#fff",backgroundAlpha:1,innerSizesDependOn:"self",angle:0,shadowColorLight:"#fff",shadowColorDark:"#000",shadowColorAlpha:.24},Nn=(n=>(n.top="flex-start",n.bottom="flex-end",n.center="center",n))(Nn||{}),Ln=(n=>(n.start="flex-start",n.end="flex-end",n.center="center",n))(Ln||{}),jn=(n=>(n.start="left",n.end="right",n.center="center",n))(jn||{}),Ct=({target:r,props:e})=>{var t,n,i;r.style.alignItems=(t=(e==null?void 0:e.gravityVertical)&&Nn[e.gravityVertical])!=null?t:"center",r.style.justifyContent=(n=(e==null?void 0:e.gravityHorizontal)&&Ln[e.gravityHorizontal])!=null?n:"center",r.style.textAlign=(i=(e==null?void 0:e.alignment)&&jn[e.alignment])!=null?i:"center"},gt=({target:r,props:e,fallback:t,dependsOn:n})=>{var i,o,s,l,a,c;r.style.color=(o=(i=e==null?void 0:e.text)==null?void 0:i.color)!=null?o:t.textColor,r.style.fontSize=`calc(${n.height} * ${(l=(s=e==null?void 0:e.text)==null?void 0:s.size)!=null?l:t.textSize})`,r.textContent=(c=(a=e==null?void 0:e.text)==null?void 0:a.value)!=null?c:t.textContent},Et=({target:r,props:e,fallback:t})=>{var n,i,o,s;r.style.backgroundColor=Be((i=(n=e==null?void 0:e.background)==null?void 0:n.color)!=null?i:t.backgroundColor,(s=(o=e==null?void 0:e.background)==null?void 0:o.alpha)!=null?s:t.backgroundAlpha)},qe=({target:r,props:e,fallback:t,dependsOn:n,useRawValues:i=!1})=>{var l,a,c,f,v,y,g,R,I,m,u;let o=i?t.borderWidthRawValue:`calc(${n.height} * ${(c=(a=(l=e==null?void 0:e.shape)==null?void 0:l.border)==null?void 0:a.width)!=null?c:t.borderWidth})`,s=i?t.roundCornersRawValue:`calc(${n.height} * ${(v=(f=e==null?void 0:e.shape)==null?void 0:f.roundCorners)!=null?v:t.roundCorners})`;r.style.borderWidth=o,r.style.borderStyle="solid",r.style.borderColor=Be(i?t.borderColor:(R=(g=(y=e==null?void 0:e.shape)==null?void 0:y.border)==null?void 0:g.color)!=null?R:t.borderColor,i?t.borderAlpha:(u=(m=(I=e==null?void 0:e.shape)==null?void 0:I.border)==null?void 0:m.alpha)!=null?u:t.borderAlpha),r.style.borderRadius=s},$n=({target:r,isDark:e,baseDimension:t,fallback:n})=>{let s=Be(n.shadowColorLight,n.shadowColorAlpha),l=Be(n.shadowColorDark,n.shadowColorAlpha),a=`calc(${t} * ${.25})`,c=`calc(${t} * ${.11})`,f=`0px 0px ${a} ${c} ${e?l:s}`;r.style.boxShadow=f},we=({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 Ae=require("@vkontakte/videoplayer-shared/es2015");var ar="int",he=(n=>(n.AREA=`${ar}_area`,n.TEXT=`${ar}_text`,n.BUTTON=`${ar}_bttn`,n))(he||{});function Fn(r){return"features"in r}var te="interactive-control",M={common:te,selected:`${te}-selected`,wrapper:`${te}-wrapper`,disabled:`${te}-disabled`,button:`${te}-button`,area:`${te}-area`,text:`${te}-text`,blinkAnim:`${te}-blink-anim`,blinkAnimButton:`${te}-blink-anim-button`,blinkAnimArea:`${te}-blink-anim-area`};var L=class{constructor(e,t,...n){this.severity=e;this.category=t;this.data=n}toString(){return`Interactive SDK error ${JSON.stringify(this,null," ")}`}};var le=class{constructor(e,t){this.control=e;this.options=t;this.container=null;this.controlElement=null;this.subscriptions=new Ae.Subscription;this.error$=new Ae.Subject}createContainerElement(e){var i;let t=document.createElement("div");t.classList.add(M.wrapper),e.setControlLayout(t,this.control.layoutParams);let n=((i=this.control.layoutParams.innerSizesDependOn)!=null?i:_.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()}}featureIsEnabled(e){return this.options&&Fn(this.options)&&this.options.features[e]}setEvents(e){!this.container||!this.control.events||this.control.events.forEach(t=>{switch(t.type.trim().toLowerCase()){case"onclick":{if(!this.container)break;this.subscriptions.add((0,Ae.fromEvent)(this.container.element,"click").subscribe(this.createClickListener(()=>e({action:t.action,controlId:this.control.id,controlType:this.control.type})),i=>{let o=new L(1,1,{message:"Error happened on control interaction",error:i});this.error$.next(o)}));break}default:break}})}removeListeners(){this.subscriptions.unsubscribe()}};var ce=(r,e)=>Object.prototype.toString.call(r)===`[object ${e}]`,ue=r=>ce(r,"Object"),It=r=>ce(r,"String"),xt=r=>ce(r,"Array"),Tt=r=>ce(r,"Number"),_n=r=>ce(r,"Function"),Bn=r=>ce(r,"Boolean"),lr=r=>Tt(r)&&!isNaN(r);var de=r=>ue(r)&&Object.keys(r).length===0,cr=r=>xt(r)&&!r.length;var Ue=(r,e)=>It(r)&&(e?r.trim():r).length;var ur="interactive-blink-anim-reference",q={common:ur,animation:`${ur}-animation`,disabled:`${ur}-disabled`},St=class{constructor(){this._RAFId=0;this._element=void 0}get element(){return this._element}create(){if(this._element)return;let e=document.createElement("div");e.classList.add(q.common,q.animation),this._element=e}restart(){this._element&&(this._element.classList.add(q.disabled),this.cleanupRAF(),this._RAFId=requestAnimationFrame(()=>{this._element&&(this._element.classList.remove(q.disabled),this.cleanupRAF())}))}cleanupRAF(){this._RAFId&&(cancelAnimationFrame(this._RAFId),this._RAFId=0)}destroy(){this.cleanupRAF(),this._element=void 0}};var pr="interactive-container",D={common:pr,hidden:`${pr}-hidden`,disabled:`${pr}-disabled`};var wt=(r,e)=>{if(r.type.trim().toLowerCase()==="area")return new hr(r,e)},hr=class extends le{constructor(e,t){super(e,t)}createView({parentElement:e,callbacks:t}){if(super.createContainerElement(t),!this.container)return;let n=document.createElement("button");n.type="button",n.classList.add(M.common,M.area),n.setAttribute("data-testid",he.AREA),Et({target:n,props:this.control.props,fallback:T(d({},_),{backgroundColor:"transparent"})}),we({target:n,layoutParams:this.control.layoutParams,fallback:_}),this.container.element.append(n),e.append(this.container.element),this.controlElement=n,this.updateShadowStyles(),this.registerEvents()}registerEvents(){var t;if(!this.featureIsEnabled("controlsExpectTimeBlinkAnimation"))return;let e=(t=this.container)==null?void 0:t.element.parentElement;!e||!this.controlElement||(this.subscriptions.add((0,me.fromEvent)(this.controlElement,"mouseleave").subscribe(()=>{if(e.classList.contains(D.disabled))return;let n=e.parentElement;if(n){let i=n.querySelector(`.${q.common}`);i&&this.syncBlinkAnimation(i)}},n=>this.onError("Error happened in mouseleave callback",n))),this.subscriptions.add((0,me.fromEvent)(this.controlElement,"mouseenter").subscribe(()=>{e.classList.contains(D.disabled)||this.onBlinkHovering()},n=>this.onError("Error happened in mouseenter callback",n))).add((0,me.fromEvent)(this.controlElement,"mouseleave").subscribe(()=>{this.controlElement&&(this.controlElement.style.animation="")},n=>this.onError("Error happened in mouseleave callback",n))))}disable(){this.controlElement&&this.controlElement.classList.add(M.disabled)}enable(){this.controlElement&&this.controlElement.classList.remove(M.disabled)}getElement(){return this.controlElement}updateShadowStyles(e){var t,n,i;if(!(!this.container||!this.controlElement))if(Bn(e)){let o=Math.min(this.controlElement.offsetWidth,this.controlElement.offsetHeight)+"px";$n({target:this.controlElement,props:this.control.props,fallback:_,isDark:e,baseDimension:o}),qe({target:this.controlElement,props:this.control.props,fallback:T(d({},_),{borderColor:e?_.shadowColorDark:_.shadowColorLight,borderAlpha:1,borderWidthRawValue:"0.1px",roundCornersRawValue:`calc(${this.container.dimensions.height} * ${(i=(n=(t=this.control.props)==null?void 0:t.shape)==null?void 0:n.roundCorners)!=null?i:_.roundCorners})`}),dependsOn:this.container.dimensions,useRawValues:!0})}else qe({target:this.controlElement,props:this.control.props,fallback:T(d({},_),{borderAlpha:0}),dependsOn:this.container.dimensions})}toggleBlinkAnimation(e){var t,n;(t=this.controlElement)==null||t.classList.toggle(M.blinkAnim,e),(n=this.controlElement)==null||n.classList.toggle(M.blinkAnimArea,e)}syncBlinkAnimation(e){this.controlElement&&(!this.controlElement.classList.contains(`${M.blinkAnimArea}`)||this.controlElement.classList.contains(M.selected)||this.controlElement.classList.contains(q.disabled)||(this.controlElement.classList.add(q.disabled),this.subscriptions.add((0,me.fromEvent)(e,"animationiteration").pipe((0,me.once)()).subscribe(()=>{this.controlElement&&this.controlElement.classList.remove(q.disabled)},t=>this.onError("Error happened in animationiteration callback",t)))))}onBlinkHovering(){if(!this.controlElement||!this.controlElement.classList.contains(`${M.blinkAnimArea}`)||this.controlElement.classList.contains(M.selected))return;let e=window.getComputedStyle(this.controlElement),t=e.getPropertyValue("--interactive-area-hover-opacity").trim();this.controlElement.style.opacity=e.opacity,this.controlElement.style.animation="none",requestAnimationFrame(()=>{this.controlElement&&(this.controlElement.style.opacity=t)})}onError(e="",t){let n=new L(1,1,{message:e,error:t,details:{id:this.control.id}});this.error$.next(n)}onProgress(){}onResize(){}};var fe=require("@vkontakte/videoplayer-shared/es2015");var At=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 Rt=(r,e)=>{if(r.type.trim().toLowerCase()==="button")return new dr(r,e)},dr=class extends le{constructor(e,t){super(e,t)}createView({parentElement:e,callbacks:t}){var s;if(super.createContainerElement(t),!this.container)return;let n=document.createElement("button");n.type="button",n.classList.add(M.common,M.button),n.setAttribute("data-testid",he.BUTTON),we({target:n,layoutParams:this.control.layoutParams,fallback:_}),Et({target:n,props:this.control.props,fallback:_}),qe({target:n,props:this.control.props,fallback:_,dependsOn:this.container.dimensions}),Ct({target:n,props:T(d({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let i=At(this.control.type.trim().toLowerCase()),o=(s=i.firstElementChild)!=null?s:i;gt({target:o,props:this.control.props,fallback:_,dependsOn:this.container.dimensions}),n.append(i),this.container.element.append(n),e.append(this.container.element),this.controlElement=n,this.registerEvents()}registerEvents(){var t;if(!this.featureIsEnabled("controlsExpectTimeBlinkAnimation"))return;let e=(t=this.container)==null?void 0:t.element.parentElement;!e||!this.controlElement||(this.subscriptions.add((0,fe.fromEvent)(this.controlElement,"mouseleave").subscribe(()=>{if(e.classList.contains(D.disabled))return;let n=e.parentElement;if(n){let i=n.querySelector(`.${q.common}`);i&&this.syncBlinkAnimation(i)}},n=>this.onError("Error happened in mouseleave callback",n))),this.subscriptions.add((0,fe.fromEvent)(this.controlElement,"mouseenter").subscribe(()=>{e.classList.contains(D.disabled)||this.onBlinkHovering()},n=>this.onError("Error happened in mouseenter callback",n))).add((0,fe.fromEvent)(this.controlElement,"mouseleave").subscribe(()=>{this.controlElement&&(this.controlElement.style.animation="")},n=>this.onError("Error happened in mouseleave callback",n))))}disable(){this.controlElement&&this.controlElement.classList.add(M.disabled)}enable(){this.controlElement&&this.controlElement.classList.remove(M.disabled)}getElement(){return this.controlElement}toggleBlinkAnimation(e){var t,n;(t=this.controlElement)==null||t.classList.toggle(M.blinkAnim,e),(n=this.controlElement)==null||n.classList.toggle(M.blinkAnimButton,e)}syncBlinkAnimation(e){this.controlElement&&(!this.controlElement.classList.contains(`${M.blinkAnimButton}`)||this.controlElement.classList.contains(M.selected)||this.controlElement.classList.contains(q.disabled)||(this.controlElement.classList.add(q.disabled),this.subscriptions.add((0,fe.fromEvent)(e,"animationiteration").pipe((0,fe.once)()).subscribe(()=>{this.controlElement&&this.controlElement.classList.remove(q.disabled)},t=>this.onError("Error happened in animationiteration callback",t)))))}onBlinkHovering(){if(!this.controlElement||!this.controlElement.classList.contains(`${M.blinkAnimButton}`)||this.controlElement.classList.contains(M.selected))return;let e=window.getComputedStyle(this.controlElement),t=e.getPropertyValue("--interactive-button-hover-opacity").trim();this.controlElement.style.opacity=e.opacity,this.controlElement.style.animation="none",requestAnimationFrame(()=>{this.controlElement&&(this.controlElement.style.opacity=t)})}onError(e="",t){let n=new L(1,1,{message:e,error:t,details:{id:this.control.id}});this.error$.next(n)}onProgress(){}onResize(){}updateShadowStyles(){}};var qn=(r,e)=>{if(r.type.trim().toLowerCase()==="text")return new mr(r,e)},mr=class extends le{constructor(e,t){super(e,t)}createView({parentElement:e,callbacks:t}){var s;if(super.createContainerElement(t),!this.container)return;let n=document.createElement("div");n.classList.add(M.common,M.text),n.setAttribute("data-testid",he.TEXT),we({target:n,layoutParams:this.control.layoutParams,fallback:_}),Ct({target:n,props:T(d({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let i=At(this.control.type.trim().toLowerCase()),o=(s=i.firstElementChild)!=null?s:i;gt({target:o,props:this.control.props,fallback:_,dependsOn:this.container.dimensions}),n.append(i),this.container.element.append(n),e.append(this.container.element),this.controlElement=n}getElement(){return this.controlElement}disable(){}enable(){}onProgress(){}onResize(){}updateShadowStyles(){}toggleBlinkAnimation(){}onError(){}};var Ot=(r,e,t)=>{if(r.type.trim().toLowerCase()==="choice")return new fr(r,e,t)},fr=class extends Se{constructor(t,n,i){super(t,i);this.containerElement=null;this.controlSubscriptions=new kt.Subscription;this.error$=new kt.Subject;this.rootElement=n,this.layout=new bt(this.container.layout),this.isRemoved=!1,this.isDisabled=!1,this.addControlFactory("button",Rt),this.addControlFactory("text",qn),this.addControlFactory("area",wt)}createView({eventCallback:t}){let n=document.createElement("div");return n.classList.add(D.common,D.disabled),requestAnimationFrame(()=>{n.classList.remove(D.disabled)}),this.layout.setContainerLayout(n),this.controls.forEach(i=>{i.createView({parentElement:n,callbacks:{setControlLayout:this.layout.setControlLayout}}),i.setEvents(t),this.controlSubscriptions.add(i.error$.subscribe(this.error$))}),this.rootElement.append(n),this.isRemoved=!1,this.containerElement=n,n}hide(){let t=this.getElement();t&&t.classList.add(D.hidden)}show(){let t=this.getElement();t&&t.classList.remove(D.hidden)}enable(){let t=this.getElement();t&&(t.classList.remove(D.disabled),this.controls.forEach(n=>n.enable()),this.isDisabled=!1)}disable(){let t=this.getElement();t&&(t.classList.add(D.disabled),this.controls.forEach(n=>n.disable()),this.isDisabled=!0)}removeView(){let t=this.getElement();t&&(this.controlSubscriptions.unsubscribe(),this.controls.forEach(n=>n.removeListeners()),t.remove(),this.isRemoved=!0,this.containerElement=null)}fakeRemove(){this.isRemoved||(this.isRemoved=!0)}getElement(){return this.containerElement}onProgress(t,n){n&&this.controls.forEach(i=>{i.onProgress(t)})}onResize(t){t&&this.controls.forEach(n=>{n.onResize()})}updateControlsShadowStyles(t){this.controls.forEach(n=>n.updateShadowStyles(t))}toggleBlinkAnimation(t){this.controls.forEach(n=>n.toggleBlinkAnimation(t))}};var Ya=Q(zr(),1),w=require("@vkontakte/videoplayer-shared/es2015"),Fe=require("@vkontakte/videoplayer-statistics/es2015");var Ko=require("@vkontakte/videoplayer-shared/es2015");function rt(r,e){let t;return(...n)=>{clearTimeout(t),t=setTimeout(()=>r(...n),e)}}var Go="video_interactive",zo="videoint";var Wo=250,nt=class{constructor(e){this.handleZoomChange=rt(e=>{this.lastZoomInfo=e},Wo);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,void 0,{isFromCenter:!0})),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,"Chapter 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,!Tt(e.graph.edit.chapters[0].x)){(n=this.onError)==null||n.call(this,"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:o=[]}){this.isReady=!1,this.isHidden=!0,this.manifest=null,this.visitedChapterIds=new Set(o),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=Tu(e),this.resizeObserver=new ResizeObserver(rt(this.onResize,Wo)),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 O(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 O(this,null,function*(){var n;if(!this.manifest)return;let e;try{e=yield(0,Ko.loadVKLangPack)(this.lang,Go,zo)}catch(i){(n=this.onError)==null||n.call(this,"Unable to load graph language pack")}let{GraphEditor:t}=yield import("@interactiveplatform/movika-graph-editor");this.ngEditor=new t(this.graphWrapperElement,{mode:"view",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",s=>{var l=s,{name:i}=l,o=ee(l,["name"]);var a;i==="openPreview"&&"chapterId"in o&&((a=this.onOpenPreviewClick)==null||a.call(this,o.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 Tu(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 it=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 o of this._containers){let s=o.startTime-e;if(s<=i&&(o.endTime&&i<=o.endTime||o.endTime===null)){n=!0;break}i<s&&(t=t===-1?s:Math.min(t,s))}return!n&&t!==-1?t:null}}};var E=require("@interactiveplatform/movika-manifest");var Qo={metadata:"Object",chapters:"Array"},Wr=r=>{if(!ue(r))return!1;for(let e in Qo)if(!r[e]||!ce(r[e],Qo[e]))return!1;return(0,E.isSupportedManifest)(r.metadata.version)},ot=r=>r.type===E.ControlTypes.Text,Su=r=>r.type===E.ControlTypes.Button,wu=r=>r.type===E.ControlTypes.Area,Au={Choice:"Choice",TextInput:"TextInput"},Ru={Button:"Button",Area:"Area",Text:"Text"},ku={onClick:"onClick",onSuspense:"onSuspense"},Kr={openURI:"openURI",setNextBranch:"setNextBranch",setWeightlessRandomBranch:"setWeightlessRandomBranch",setRandomBranch:"setRandomBranch",setMaxWeightBranch:"setMaxWeightBranch",setMinWeightBranch:"setMinWeightBranch",setDefaultBranch:"setDefaultBranch",continuePlayback:"continuePlayback",expect:"expect"};var Bt=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 qt=class{constructor(e){this.fns=[];this.addFn=(e,t=!1)=>{_n(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=[]}};var hs=require("@vkontakte/videoplayer-shared/es2015");var Dt=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 O(this,null,function*(){return Ou(...this.loaders[e])(t)})}};function Ou(...r){return function(t){return O(this,null,function*(){let n=[...r];for(;n.length>0;)t=yield n.shift()(t);return t})}}function st(r,e,t){return r?T(d({},r),{[e]:r[e]?[t,...r[e]]:[t]}):{[e]:[t]}}function Ht(i){var o=i,{actions:r,errors:e,chapterId:t}=o,n=ee(o,["actions","errors","chapterId"]);if(t){let s=r.getManifest();if(s){let l=r.getChapter(s.chapters,t);if(l){let a=r.getMedia(s.media,l.videoId),c=r.getGraph(s.graph,l.id);return a?T(d({},n),{actions:r,errors:e,result:{chapter:l,media:a,graph:c}}):T(d({},n),{errors:st(e,Ht.name,"Could not find media"),actions:r})}}}return T(d({},n),{errors:st(e,Ht.name,"Could not find chapter"),actions:r})}var Ut=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,o=n.length;i<o;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,o=n.length;i<o;i++){let s=n[i];try{s.callback.call(this,e)}catch(l){Promise.resolve().then(()=>{throw l})}s.options&&s.options.once&&this.removeEventListener(e.type,s.callback)}return!e.defaultPrevented}},Me=class extends Ut{constructor(){super(),this.listeners||Ut.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)}},at=class{constructor(){Object.defineProperty(this,"signal",{value:new Me,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&&(at.prototype[Symbol.toStringTag]="AbortController",Me.prototype[Symbol.toStringTag]="AbortSignal");function Gt(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 Qr(r){typeof r=="function"&&(r={fetch:r});let{fetch:e,Request:t=e.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=r;if(!Gt({fetch:e,Request:t,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i}))return{fetch:e,Request:o};let o=t;(o&&!o.prototype.hasOwnProperty("signal")||i)&&(o=function(c,f){let v;f&&f.signal&&(v=f.signal,delete f.signal);let y=new t(c,f);return v&&Object.defineProperty(y,"signal",{writable:!1,enumerable:!1,configurable:!0,value:v}),y},o.prototype=t.prototype);let s=e;return{fetch:(a,c)=>{let f=o&&o.prototype.isPrototypeOf(a)?a.signal:c?c.signal:void 0;if(f){let v;try{v=new DOMException("Aborted","AbortError")}catch(g){v=new Error("Aborted"),v.name="AbortError"}if(f.aborted)return Promise.reject(v);let y=new Promise((g,R)=>{f.addEventListener("abort",()=>R(v),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([y,s(a,c)])}return s(a,c)},Request:o}}var Pu=()=>"fetch"in window,lt=Pu()&&Gt({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),Xo=lt?Qr({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,Xr=lt?Xo.fetch:window.fetch,xf=lt?Xo.Request:window.Request,Tf=lt?at:window.AbortController,Sf=lt?Me:window.AbortSignal;var zt=(r="",e="")=>{let t=r.split("."),n=e.split("."),i=0;for(let o=0;o<Math.max(t.length,n.length)&&!i;o++)t[o]>n[o]?i=1:t[o]<n[o]?i=-1:i=0;return i};var Vu=r=>O(void 0,null,function*(){try{let e={},t;if(It(r)){t=new URL(r).href;let i=yield Xr(t);if(!i.ok)return{};e=yield i.json()}else if(ue(r))e=r;else return{};if(!Wr(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 o=yield Xr(i);if(!o.ok)throw new Error;e.metadata.media=yield o.json()}catch(i){return Lu(e.metadata.version)?{manifest:e}:{}}return{manifest:e,manifestURL:t}}catch(e){return{}}});function Yo(r){return O(this,null,function*(){let{manifest:e,manifestURL:t}=yield Vu(r);if(!e)throw new Error("Failed on fetch");let n=(0,E.migrateManifestToLatestVersion)(e);return n.media=Mu(n.media,t),delete n.metadata.media,n})}function Wt(r,e){if(e)return r.find(t=>t.id===e)}function Yr(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 Zr(r,e){return r.videos.find(t=>t.id===e)}function Mu(r,e){return T(d({},r),{videos:r.videos.map(t=>T(d({},t),{variants:t.variants.map(n=>{let i="url"in n?n.url:"",o=Nu(i,e);return T(d({},n),{url:o||i})})}))})}function Nu(r="",e){try{return new URL(r,e).href}catch(t){return""}}function Lu(r){return zt(r,"3.2.0")>=0}var ls=Q(ct(),1);var Kt=r=>xt(r)&&!cr(r),Z=r=>r.order==="end",ut=r=>xt(r.containers)&&!cr(r.containers)&&Z(r),cs=(r,e)=>{var n;let t=r*1e3;return Kt(e.controls)&&t<((n=e.startTime)!=null?n:0)},en=(r,e)=>{var n,i;let t=r*1e3;return Kt(e.controls)&&t>=((n=e.startTime)!=null?n:0)&&t<=((i=e.endTime)!=null?i:1/0)};var ye=(r=[])=>r.some(e=>e.action.type==="expect"),tn=(r=[])=>r.find(e=>e.action.type==="expect"),Xu=r=>(r==null?void 0:r.length)===1,be=r=>Xu(r)&&ot(r[0]);function us(r=[],e=1/0,t=[]){return r.filter(({container:n})=>!(0,ls.default)(t,n.container.id)&&ye(n.container.events)&&n.container.endTime===e&&!n.isRemoved)}function Qt({gameControllers:r=[],subjectName:e,subjectId:t,execFn:n}){for(let i of r)if(e==="container"&&i.container.container.id===t){n(i),us(r,i.container.container.endTime,[i.container.container.id]).forEach(s=>{n(s)});break}}var ps=(r,e)=>{let t=I=>{let m=e.find(({container:u})=>u.container.id===I);return m==null?void 0:m.container.isRemoved},n=ye(r.events)&&!t(r.id),i=(I,m=!1,u=!1)=>{let p=u?"every":"some";return I.controls[p](b=>{var A;let x=m?I.endTime===r.endTime:!0;return((A=b.events)==null?void 0:A[p](C=>{var S;return((S=C.action)==null?void 0:S.type)===Kr.openURI}))&&x})},o=I=>I.some(({container:m})=>i(m.container,!0,!1)&&!m.isRemoved),s=I=>I.every(({container:m})=>m.isRemoved?!0:i(m.container,!0,!0)),l=us(e,r.endTime,[r.id]).length,a=I=>I.controls.some(m=>{var u;return(u=m.events)==null?void 0:u.some(p=>{var b,x;return(x=(b=p.action)==null?void 0:b.args)==null?void 0:x.shouldOpenNow})}),c=n||l>0,f=o(e),v=i(r),y=s(e),g=n?!1:l>0,R=a(r);return{isExpectTime:c,hasOtherExpect:l>0,hasOpenURIEvent:f,hasOpenURIEventInCurrentContainer:v,isAllOpenURIEventsValid:y,isExpectEventForCurrentContainer:g,hasShouldOpenNowEvent:R}};var Ce=class extends Dt{constructor(t,n){super(t);this.manifest=null;this.chapter=null;this.media=null;this.graph=null;this.prevChapter$=new hs.ValueSubject(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 O(this,null,function*(){var i;this.release();let n=yield this.exec("manifestLoaders",{actions:{addErrorMessage:st},result:null,errors:null,source:t});return n.errors&&this.errorHandler(n.errors),this.manifest=yield Yo((i=n.result)!=null?i:t),this})}setInitial(){return O(this,null,function*(){return this.setNext()})}setNext(){return O(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",Ht({actions:{getManifest:()=>this.manifest,getCurrent:this.getCurrent,getGraph:Yr,getChapter:Wt,getMedia:Zr,getByBranches:this.getByBranches.bind(this),addErrorMessage:st},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=Wt(this.manifest.chapters,t);if(i){let o=Zr(this.manifest.media,i.videoId),s=Yr(this.manifest.graph,i.id);if(o)return{chapter:i,media:o,graph:s}}return null}getBranches(t=(n=>(n=this.chapter)==null?void 0:n.id)()){var i,o,s;if(t===((i=this.chapter)==null?void 0:i.id))return this.getByBranches((o=this.chapter)==null?void 0:o.branches);{let l=Wt(((s=this.manifest)==null?void 0:s.chapters)||[],t);return this.getByBranches(l==null?void 0:l.branches)}}getByBranches(t=[]){return t.reduce((n,i)=>{let o=this.getByChapterId(i.chapterId);return o&&n.push(o),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?Z(this.chapter):!1}};var Us=Q(Xt(),1),Gs=require("@vkontakte/videoplayer-core/es2015"),pe=require("@vkontakte/videoplayer-shared/es2015");var Ds=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 Hs=Q(Xt(),1);function on(){let r=new Map;function e(a){var c=a,{listId:o=Math.random().toString(),itemId:s=Math.random().toString()}=c,l=ee(c,["listId","itemId"]);let f=r.get(o),v=d({},l);return f?f[s]=v:r.set(o,{[s]:v}),d({listId:o,itemId:s},l)}function t(o){var s,l;o.player.destroy(),o.container.remove(),o.subscription.unsubscribe(),(s=o.statistics)==null||s.oneStat.destroy(),(l=o.statistics)==null||l.statSubscription.unsubscribe()}function n(o,s){let l=r.get(o);if(!l)throw Error("Can't remove. Not find.");if(s){let a=l[s];a&&t(a),delete l[s],Object.keys(l).length||r.delete(o)}else{for(let a of(0,Hs.default)(l))t(a);r.delete(o)}}function i(){for(let o of r)n(o[0])}return{createPlayer:e,removePlayer:n,map:r,removeAll:i}}var Ne=Q(ct(),1);function sn(r,e=[]){var o,s,l;let t={},n,i=!e.length;for(let a of r.variants)if(!n&&"cover"in a&&(n=a.cover),"url"in a)switch(a.type.toLowerCase()){case"mp4":(i||(0,Ne.default)(e,"mp4"))&&(t.MPEG=T(d({},t.MPEG),{[(o=a.standard)!=null?o:"Invariant quality"]:a.url}));break;case"mpeg":(i||(0,Ne.default)(e,"mpeg"))&&(t.MPEG=T(d({},t.MPEG),{[(s=a.standard)!=null?s:"Invariant quality"]:a.url}));break;case"hls":(i||(0,Ne.default)(e,"hls"))&&(t=T(d({},t),{HLS:{type:"url",url:a.url}}));break;case"dash":(i||(0,Ne.default)(e,"dash"))&&(t=T(d({},t),{DASH_SEP:{compatibilityMode:!0,type:"url",url:a.url}}));break;default:break}return{sources:t,thumbUrl:n,title:(l=r.title)!=null?l:""}}var pt=(r,e)=>{let t=r.info.currentQuality$.getValue(),n=r.info.availableQualities$.getValue();t!==e&&(0,Ne.default)(n,e)&&(r.setQuality(e),r.setAutoQuality(!1))};var Tp=2;function an(r){let e=on(),t=new pe.Subscription,n={},i=null,o=!1,s,l=new pe.ValueSubject(null);r&&a(r);function a(m){i=m}function c(m,u,p){var A;if(!i)throw Error("need to set interactive controller");if(!i.options)return;let x=((A=e.map.get(m))!=null?A:{})[u];if(x){n=d({chapterId:p,listId:m,itemId:u},x);let C=n.player;n.subscription.add(C.info.currentQuality$.subscribe(S=>{let H=C.info.position$.getValue(),V=C.info.isAutoQualityEnabled$.getValue();if(!(!S||!H||V))for(let $ of e.map)(0,Us.default)($[1]).forEach(({player:N})=>{pt(N,S)})})).add(C.events.started$.subscribe(()=>{f(u)})),x.container.remove(),i.setPlayer(x.player),o||(i.init(),o=!0),l.next({player:n.player,config:n.config,statistics:n.statistics});return}throw Error("Can't set. Not find.")}function f(m){return O(this,null,function*(){if(!i)throw Error("need to set interactive controller");if(de(n)||m!==n.itemId)return;let u=i.getChapterBranches(),p=new Set;for(let b of u)p.has(b.media.id)||(yield y({media:b.media,chapterId:b.chapter.id,setAsActive:!1,title:b.chapter.label}),p.add(b.media.id))})}function v(p){return O(this,arguments,function*({chapter:{id:m},manifestVideo:u}){if(de(n)||!i)return;let b=n.player.info.muted$.getValue(),x=n.player.info.currentQuality$.getValue(),A=n.player.info.isAutoQualityEnabled$.getValue(),C=n.player.info.volume$.getValue(),S=n.player.info.currentPlaybackRate$.getValue(),H=!A,V=!1;for(let $ of e.map)if($[0]===u.id&&!i.state.isReplay$.getValue()){let N=Object.keys($[1]);for(let B of N)B===n.itemId?(N.length<Tp||(V=!0),e.removePlayer($[0],B)):(V=!0,c($[0],B,m),H?pt(n.player,x):n.player.setAutoQuality(!0),n.player.setVolume(C),n.player.setMuted(b),n.player.setPlaybackRate(S))}else e.removePlayer($[0]);V||(yield y({media:u,chapterId:m,setAsActive:!0,playbackRate:S}),H?pt(n.player,x):n.player.setAutoQuality(!0),n.player.setVolume(C),n.player.setMuted(b))})}function y(H){return O(this,arguments,function*({media:m,chapterId:u,prefetch:p=!0,setAsActive:b=!0,autoplay:x=!1,preferredExt:A,title:C,playbackRate:S}){var Cn,gn,En,In,xn;let V=Math.random().toString(),$=document.createElement("div");s.append($);let N;if((Cn=i==null?void 0:i.options)!=null&&Cn.vkVideoLoader){let vt=Ds(m);vt.length&&(N=yield i.options.vkVideoLoader(...vt))}let B=((gn=i==null?void 0:i.options)==null?void 0:gn.coreConfig)||void 0,xe=T(d({},B),{configName:[...(En=B==null?void 0:B.configName)!=null?En:[],"interactive"]}),ie=T(d({container:$},((In=N==null?void 0:N.videos)==null?void 0:In[0])||{sources:sn(m,A).sources}),{title:C,failoverHosts:(N==null?void 0:N.failoverHosts)||[]}),J=new Gs.Player(xe,pe.Tracer.createRootTracer());J.initVideo(ie);let yn=null;if(N!=null&&N.videos&&(i!=null&&i.options.createOneStat)){let vt=N.videos[0],ir=i.options.createOneStat(vt),Tn=new pe.Subscription;ir&&(Tn.add(ir.attachTo(J)),yn={oneStat:ir,statSubscription:Tn})}let bn=new pe.Subscription,el=(xn=n==null?void 0:n.player)==null?void 0:xn.info.isAutoQualityEnabled$.getValue();bn.add(J.events.canplay$.subscribe(function(){el||pt(J,n.player.info.currentQuality$.getValue()),S&&J.setPlaybackRate(S)}));let Te=e.createPlayer({listId:m.id,itemId:V,player:J,container:$,sources:sn(m,A).sources,config:ie,subscription:bn,statistics:yn});return b&&c(m.id,Te.itemId,u),x&&Te.player.play(),p&&!x&&Te.player.prepare(),{player:Te.player,config:Te.config,statistics:Te.statistics}})}function g(){R(),i=null,s.remove()}function R(){t.unsubscribe(),e.removeAll(),n={},o=!1}function I(){return O(this,null,function*(){if(!i)throw Error("need to set interactive controller");R(),s=document.createElement("div");let{media:m,chapter:u}=i.getCurrentChapter();m&&u?(t.add(i.events.chapterChanged$.subscribe(v)),yield y({media:m,chapterId:u.id,title:u.label})):console.error("not found")})}return T(d({},e),{init:I,setInteractiveController:a,createPlayer:y,removeAll:g,getActivePlayer:function(){return n},activePlayerChanged:l})}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"},Le={visibility:"visibility",watchAgainClicked:"watchAgainClicked"},j={actionChoiceCanceled:"action-choice-canceled",actionChoice:"action-choice",actionExecution:"action-execution",visibility:"visibility",containerRemoved:"container-removed",rangeEnded:"range-ended"};var Ws=Q(ct(),1),Ks=require("@vkontakte/videoplayer-shared/es2015");function ln(r){return function(...t){return r(...t.reverse())}}function ht(r,...e){return(...t)=>ue(e[0])&&ue(t[0])?r(d(d({},e[0]),t[0])):r(...e,...t)}var Yt=class{constructor({player:e,container:t,branches:n,selectBranches:i,interactiveEvents:o,globalEvents:s,globalEventEmitter:l,getContainerEventState:a,permanentTextControls:c,interactiveTimeOpenUri:f,disabledControls$:v,onRemove:y,onError:g}){this.hide=()=>{setTimeout(()=>{var e,t;this.gameState!==4&&(ye(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,o;if(this.gameState!==2||this.isSelectedControlEvent)return;if(this.container.getElement()){let{hasOpenURIEventInCurrentContainer:s}=this.getContainerEventState();if((n=(t=this.container).show)==null||n.call(t),this.interactiveTimeOpenUri&&s)return;this.emitContainerVisibilityEvent(!0,!1)}else{let s={isDisabled:()=>this.container.isDisabled,branches:this.branches,containerId:this.container.container.id,onDetachContainer:()=>{this.removeView(),this.emitContainerVisibilityEvent(!1)},onEvent:(a,c)=>{let{isExpectTime:f,hasOtherExpect:v,hasOpenURIEvent:y,hasOpenURIEventInCurrentContainer:g,isAllOpenURIEventsValid:R,hasShouldOpenNowEvent:I}=this.getContainerEventState(),m=this.interactiveTimeOpenUri&&!g,u=this.interactiveTimeOpenUri&&g;if((!this.interactiveTimeOpenUri||m)&&(this.isSelectedControlEvent=!0),a!==!1){if(!this.selectBranches.state.isExpect&&(!this.interactiveTimeOpenUri||m)){if(this.interactiveTimeOpenUri){let p=!v&&!R&&g;p&&this.globalEvents.interactiveContainerFakeRemoved$.next({subjectId:this.container.container.id,subjectName:"container",type:"container-fake-removed",removeAllOpenURI:p})}this.removeView()}this.emitContainerVisibilityEvent(!1)}if(this.gameState===4||this.gameState===3||this.selectBranches.state.isExpect||this.interactiveTimeOpenUri&&y&&this.gameState!==5){if(u){let b=((x,A,C,S)=>!x&&!A&&C||x&&!A&&C&&!S||x&&!A&&C&&S)(f,v,R,this.isSelectedContainerEvent);this.fakeRemoveView(b)}else this.removeView(),this.emitContainerVisibilityEvent(!1);(!f||!v||!I)&&(this.selectBranches.stopExpect(),c())}},isEOV:()=>this.gameState===4},l=ht(this.selectBranches.onControlEvent,s);this.container.createView({eventCallback:l}),this.emitContainerVisibilityEvent(!0,!0),this.disabledControls$.getValue()&&((o=(i=this.container).disable)==null||o.call(i))}};this.onEndOfVideo=()=>{this.gameState=4,this.selectContainerEvent(!0)};this.whilePlaying=()=>{var c,f,v;let e=this.player.experimental.element$.getValue(),n=e instanceof HTMLVideoElement?e.readyState:void 0,i=[6,5];if(!n||(0,Ws.default)(i,this.gameState)&&!this.isPermanentText)return;let o=this.player.getExactTime();if(cs(o,this.container.container))this.gameState!==1&&(this.gameState=1,this.onBeforeStartTime());else if(en(o,this.container.container))this.gameState!==2&&(this.gameState=2,this.onStartTime());else if(this.gameState!==3){let y=this.gameState;this.gameState=3,y===2&&this.onEndTime()}else{let{hasOpenURIEventInCurrentContainer:y}=this.getContainerEventState(),g=this.selectBranches.state.isExpect,R=this.interactiveTimeOpenUri&&y;if(R&&!g){let I=this.container.getElement();I&&(I.style.visibility!=="hidden"&&((f=(c=this.container).hide)==null||f.call(c)),this.container.isRemoved||this.fakeRemoveView())}!this.isPermanentText&&!R&&this.removeView()}let s=en(o,this.container.container),l=this.container.container.startTime?[this.container.container.startTime,(v=this.container.container.endTime)!=null?v:1/0]:[],a={subjectId:this.container.container.id,subjectName:"container",range:l,currentTime:o,isInteractiveTime:s};this.container.onProgress(o*1e3,s),this.globalEventEmitter.emit(P.eachTick,a),this.globalEvents.eachTick$.next(a)};this.container=t,this.branches=n,this.selectBranches=i,this.subscription=new Ks.Subscription,this.player=e,this.interactiveEvents=o,this.getContainerEventState=a,this.isPermanentText=c&&be(t.container.controls),this.interactiveTimeOpenUri=f,this.disabledControls$=v,this.onRemove=y,this.globalEventEmitter=l,this.gameState=0,this.globalEvents=s,this.onError=g,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,o;e?(n=(t=this.container).disable)==null||n.call(t):(o=(i=this.container).enable)==null||o.call(i)})),this.subscription.add(this.container.error$.subscribe(this.onError))}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.container.isRemoved&&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:ye(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)}onResize(e){this.container.onResize(e)}reset(){this.isSelectedControlEvent=!1,this.isSelectedContainerEvent=!1,this.gameState=1}removeView(){var e;this.container.removeView(),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,(e=this.onRemove)==null||e.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()}updateControlsShadowStyles(e){this.container.updateControlsShadowStyles(e)}toggleBlinkAnimation(e){this.container.toggleBlinkAnimation(e)}destroy(){var e;this.reset(),this.removeView(),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 Qs=(r=[])=>r.reduce((e,t,n)=>{var o,s,l;let i=((o=t==null?void 0:t.controls)!=null?o:[]).filter(a=>!ot(a));if(Kt(i)){let a=[(s=t.startTime)!=null?s:0,(l=t.endTime)!=null?l:1/0],c={id:t.id,isRemoved:!1};if(!n)e.push({subjects:[c],range:a});else{let f=[],v=-1/0,y=1/0,g=[],R=[];for(let I=0;I<e.length;I++){let m=e[I];if(R.push(...m.subjects),m.range[0]<y&&(y=m.range[0]),m.range[1]>v&&(v=m.range[1]),a[0]>=m.range[0]&&a[1]<=m.range[1])return e[I].subjects.push(c),e;a[0]<m.range[0]&&a[1]>m.range[0]&&(f.push(I),g=g.concat(m.subjects)),a[0]>=m.range[0]&&a[0]<=m.range[1]&&(f.push(I),g=g.concat(m.subjects),a[0]=m.range[0]),a[1]>=m.range[0]&&a[1]<=m.range[1]&&(f.push(I),g=g.concat(m.subjects),a[1]=m.range[1])}if(R.push(c),a[0]<=y&&a[1]>=v)return[{subjects:R,range:a}];f.length&&f.reverse().forEach(I=>{e.splice(I,1)}),e.push({subjects:g.concat([c]),range:a})}}return e},[]).sort((e,t)=>e.range[0]-t.range[0]);var Oa=Q(ct(),1),hn=Q(Xt(),1),Pa=Q(Ra(),1);function ka(){let r={};function e(){for(let l in r)Object.prototype.hasOwnProperty.call(r,l)&&delete r[l]}function t(l){let a={};for(let c in r)+c<=l&&(a[c]=r[c]);return a}function n(l){let a={};for(let c in r)+c>=l&&(a[c]=r[c]);return a}function i({timestamp:l,priority:a,initiator:c}){var f;if(lr(l)){let v=(f=r[l])!=null?f:null;if(v&&a&&Ue(a,!0)){let y={},g=v[a];if(g&&(y=d(d({},y),g)),y=de(y)?null:y,y&&Ue(c,!0)){let R=y[c];return R!=null?R:null}return y}return v}return null}function o({timestamp:l,priority:a,initiator:c}){if(lr(l))if(r[l]){if(a&&Ue(a,!0))if(r[l][a]){if(c&&Ue(c,!0))if(r[l][a][c]){if(delete r[l][a][c],!de(r[l][a]))return!0}else return!1;if(delete r[l][a],!de(r[l]))return!0}else return!1;return delete r[l]}else return!1;return!1}function s(v){var y=v,{timestamp:l,priority:a,initiator:c}=y,f=ee(y,["timestamp","priority","initiator"]);var g,R,I;(R=(g=r[l])==null?void 0:g[a])!=null&&R[c]?r[l][a][c].push(d({},f)):(I=r[l])!=null&&I[a]?r[l][a]=T(d({},r[l][a]),{[c]:[d({},f)]}):r[l]?r[l]=T(d({},r[l]),{[a]:{[c]:[d({},f)]}}):r[l]={[a]:{[c]:[d({},f)]}}}return{map:r,remove:o,add:s,removeAll:e,get:i,getLte:t,getGte:n}}var hh=[E.EventActionTypes.expect,E.EventActionTypes.setNextBranch],dh=1/0;function Va(r,e){let t=r,n,i=mh(e),o=ka(),s,l=()=>{g(),u()},a=p=>{o.add.call(void 0,p),R()},c=(p=[])=>{for(let b of p)if(b.action(),(0,Oa.default)(hh,b.actionType))break},f=(p=1/0)=>{var C,S,H;let b=Jt((C=o.get({timestamp:p,priority:"control"}))!=null?C:{}),x=Jt((S=o.get({timestamp:p,priority:"container"}))!=null?S:{}),A=Jt((H=o.get({timestamp:p,priority:"chapter"}))!=null?H:{});return[...b,...x,...A]},v=p=>{i.isReady(p)&&c(f(p))},y=()=>{var p;c([...Jt((p=o.get({timestamp:1/0,priority:"chapter"}))!=null?p:{})])},g=()=>{n&&(s==null||s.unsubscribe(),n=void 0)},R=()=>{n||(n=()=>setTimeout(()=>{v(1/0)}),s=t.events.ended$.subscribe(n))},I=p=>{g(),t=p},m=p=>{p.priority==="container"&&i.resetCalled(p.timestamp),o.remove(p)},u=()=>{i.release(),o.removeAll()};return{setPlayer:I,add:a,remove:m,exec:v,execEndOfVideo:y,listen:R,unlisten:g,release:l,containersEventsCallState:i,getPreparedToExecActions:f}}function mh(r){let e=new Map;return{setCalled:({timestamp:l,id:a})=>{let c=e.get(l);c&&c[a]!==void 0&&(c[a]=!0)},setData:(l=[])=>{var a;for(let c of l){let f=(a=c.endTime)!=null?a:dh,v=e.get(f);e.set(f,T(d({},v),{[c.id]:!1}))}},resetCalled:l=>{let a=e.get(l);if(a)for(let c in a)a[c]=!1},isReady:l=>{let a=e.get(l);if(!a)return!0;let c=(0,hn.default)(a);return r?c.some(v=>v):!c.some(v=>!v)},release:()=>e.clear()}}function Jt(r){return(0,Pa.default)((0,hn.default)(r)).sort(e=>e.actionType===E.EventActionTypes.expect?-1:1)}var Ma={videoContentHeight:0,videoContentWidth:0},Na=r=>{let{height:e,width:t}=r.info.intrinsicVideoSize$.getValue()||{};if(!(e&&t))return Ma;let{clientHeight:n,clientWidth:i}=r.experimental.element$.getValue()||{};if(!(n&&i))return Ma;let o=e/t,s=n/i,l,a;return s>o?(a=i,l=i*o):s<o?(a=n/o,l=n):(a=i,l=n),{videoContentWidth:a,videoContentHeight:l}};var fh=250;function La(r){let e,t=new ResizeObserver(l=>{o(l),e=o.bind(null,l)});function n(l){let{parentElement:a,player:c}=r();if(a&&c){let{videoContentWidth:f,videoContentHeight:v}=Na(c);a.style.setProperty("--interactive-content-width",`${f}px`),a.style.setProperty("--interactive-content-height",`${v}px`),a.style.setProperty("--interactive-width",`${l[0].contentRect.width}px`),a.style.setProperty("--interactive-height",`${l[0].contentRect.height}px`)}}function i(){let{parentElement:l}=r();l.removeAttribute("style")}let o=rt(l=>{let{fns:a=[]}=r();n(l);for(let c of a)c()},fh);function s(){e=void 0,t.disconnect(),i()}return{resizeObserver:t,calc:()=>{e==null||e()},release:s}}var vh=r=>Math.floor(Math.random()*r),$a=r=>{var i;let e=r.length,t=1/0,n=null;for(;e--;){let o=r[e],s=(i=o.weight)!=null?i:1;s<t&&(t=s,n=o)}return n},Fa=r=>{var i;let e=r.length,t=-1/0,n=null;for(;e--;){let o=r[e],s=(i=o.weight)!=null?i:0;s>t&&(t=s,n=o)}return n};var _a=r=>{let e=r.length,t=vh(e);return r[t]},ja=1,Ba=r=>{var n,i;let e=0;for(let o=0;o<r.length;++o)e+=(n=r[o].weight)!=null?n:ja;let t=Math.random()*e;e=0;for(let o=0;o<r.length-1;++o)if(e+=(i=r[o].weight)!=null?i:ja,e>=t)return r[o];return r[r.length-1]};var qa={shouldOpenNow:!0,isDetachContainer:!0},Da="after-expect",dn=(r,e=!1)=>T(d({},r),{args:e?d(d({},r.args),qa):d(d({},qa),r.args)}),Ha=({globalEventEmitter:r,globalEvents:e,player:t,interactiveEvents:n})=>{let i={isExpect:!1},o=()=>{i.isExpect&&(i.isExpect=!1)},s=({action:u,controlType:p,controlId:b,containerId:x,branches:A=[],onEvent:C,isEOV:S=()=>!1,isDisabled:H=()=>!1})=>{let V=dn(u,S()),$={timestamp:1/0,priority:"control",initiator:b,actionType:V.type},N=H(),B=r.emit.bind(r,P.interactives,{subjectId:b,subjectType:p,subjectName:"control",type:N?j.actionChoiceCanceled:j.actionChoice,actionType:u.type,payload:d({invokeImmediately:V.args.shouldOpenNow,containerId:x},V.args)}),xe=()=>{e.interactiveActionChoice$.next({subjectId:b,subjectType:p,subjectName:"control",type:N?"action-choice-canceled":"action-choice",actionType:u.type,payload:d({invokeImmediately:V.args.shouldOpenNow,containerId:x},V.args)})};if(N){B(),xe();return}switch(V.type.trim().toLowerCase()){case E.EventActionTypes.setNextBranch.trim().toLowerCase():{let ie=A.find(J=>J.id===V.args.branchId);if(!ie)return;C(V.args.isDetachContainer,g.bind(null,{subjectId:b,subjectName:"control"})),B(),xe(),V.args.shouldOpenNow?I({subjectId:b,subjectName:"control",subjectType:p,action:V,payload:{chapterId:ie.chapterId,autoSelect:!1}}):n.add(T(d({},$),{action:I.bind(null,{subjectId:b,subjectName:"control",subjectType:p,action:V,payload:{chapterId:ie.chapterId,autoSelect:!1}})}));return}case E.EventActionTypes.continuePlayback.trim().toLowerCase():{C(V.args.isDetachContainer,g.bind(null,{subjectId:b,subjectName:"control"})),B(),xe(),V.args.shouldOpenNow?R({subjectId:b,subjectName:"control",subjectType:p,action:u}):n.add(T(d({},$),{action:R.bind(null,{subjectId:b,subjectName:"control",subjectType:p,action:u})}));return}case E.EventActionTypes.openURI.trim().toLowerCase():{C(V.args.isDetachContainer,g.bind(null,{subjectId:b,subjectName:"control"})),B(),xe(),V.args.shouldOpenNow?m({subjectId:b,subjectName:"control",subjectType:p,action:V,payload:{URI:u.args.uri}}):n.add(T(d({},$),{action:m.bind(null,{subjectId:b,subjectName:"control",subjectType:p,action:V,payload:{URI:u.args.uri}})}));return}default:{let ie="Unexpected control event",J=new L(1,1,{message:ie});f(J,ie);return}}},l=({action:u,container:{id:p,endTime:b},branches:x=[],isEOV:A=!1,autoSelected:C=!1})=>{let S=dn(u,A),H={timestamp:!S.args.shouldOpenNow||A?1/0:b!=null?b:1/0,priority:"container",initiator:p,actionType:S.type},V=r.emit.bind(r,P.interactives,{subjectId:p,subjectName:"container",type:j.actionChoice,actionType:S.type,payload:d({invokeImmediately:S.args.shouldOpenNow},S.args)}),$=()=>{e.interactiveActionChoice$.next({subjectId:p,subjectName:"container",type:"action-choice",actionType:S.type,payload:d({invokeImmediately:S.args.shouldOpenNow},S.args)})};switch(S.type.trim().toLowerCase()){case E.EventActionTypes.setNextBranch.trim().toLowerCase():{let N=x.find(B=>B.id===S.args.branchId);if(!N)return;V(),$(),n.add(T(d({},H),{action:I.bind(null,{subjectId:p,subjectName:"container",action:S,payload:{chapterId:N.chapterId,autoSelect:C}})}));return}case E.EventActionTypes.setMaxWeightBranch.trim().toLowerCase():return;case E.EventActionTypes.setMinWeightBranch.trim().toLowerCase():return;case E.EventActionTypes.setRandomBranch.trim().toLowerCase():return;case E.EventActionTypes.setWeightlessRandomBranch.trim().toLowerCase():return;case E.EventActionTypes.continuePlayback.trim().toLowerCase():{V(),$(),n.add(T(d({},H),{action:R.bind(null,{subjectId:p,subjectName:"container",action:S})}));return}case E.EventActionTypes.openURI.trim().toLowerCase():{V(),$(),n.add(T(d({},H),{action:m.bind(null,{subjectId:p,subjectName:"container",action:S,payload:{URI:u.args.uri}})}));return}default:{let N="Unexpected container event",B=new L(1,1,{message:N});f(B,N);return}}};function a({container:u,branches:p,isEOV:b=!1}){var A,C;let x=tn(u.events);if(x){let S=dn(x.action,b);r.emit(P.interactives,{subjectId:u.id,subjectName:"container",type:j.actionChoice,actionType:S.type,payload:d({invokeImmediately:S.args.shouldOpenNow},S.args)}),e.interactiveActionChoice$.next({subjectId:u.id,subjectName:"container",type:"action-choice",actionType:S.type,payload:d({invokeImmediately:S.args.shouldOpenNow},S.args)}),n.add({timestamp:b?1/0:(A=u.endTime)!=null?A:1/0,priority:"container",initiator:u.id,actionType:E.EventActionTypes.expect,action:y.bind(null,{subjectId:u.id,subjectName:"container"})}),i.isExpect=!0}else for(let S of(C=u.events)!=null?C:[])l({action:S.action,container:u,branches:p,isEOV:b})}let c=({chapterId:u,action:p,branches:b=[]})=>{let x=r.emit.bind(r,P.interactives,{subjectId:u,subjectName:"chapter",type:j.actionChoice,actionType:p.type,payload:p.args}),A=()=>{e.interactiveActionChoice$.next({subjectId:u,subjectName:"chapter",type:"action-choice",actionType:p.type,payload:p.args})};switch(p.type.trim().toLowerCase()){case E.EventActionTypes.setNextBranch.trim().toLowerCase():{let C=b.find(S=>S.id===p.args.branchId);return C!=null&&C.chapterId?(x(),A(),I.bind(null,{subjectId:u,subjectName:"chapter",action:p,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case E.EventActionTypes.setWeightlessRandomBranch.trim().toLowerCase():{let C=_a(b);return C!=null&&C.chapterId?(x(),A(),I.bind(null,{subjectId:u,subjectName:"chapter",action:p,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case E.EventActionTypes.setRandomBranch.trim().toLowerCase():{let C=Ba(b);return C!=null&&C.chapterId?(x(),A(),I.bind(null,{subjectId:u,subjectName:"chapter",action:p,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case E.EventActionTypes.setMaxWeightBranch.trim().toLowerCase():{let C=Fa(b);return C!=null&&C.chapterId?(x(),A(),I.bind(null,{subjectId:u,subjectName:"chapter",action:p,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case E.EventActionTypes.setMinWeightBranch.trim().toLowerCase():{let C=$a(b);return C!=null&&C.chapterId?(x(),A(),I.bind(null,{subjectId:u,subjectName:"chapter",action:p,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case E.EventActionTypes.continuePlayback.trim().toLowerCase():return x(),A(),R.bind(null,{subjectId:u,subjectName:"chapter",action:p});case E.EventActionTypes.openURI.trim().toLowerCase():return x(),A(),m.bind(null,{subjectId:u,subjectName:"chapter",action:p,payload:{URI:p.args.uri}});default:{let C="Unexpected chapter event",S=new L(1,1,{message:C});f(S,C);return}}};function f(u,p){console.error(p),e.error$.next(u),r.emit(P.errors,u)}function v(u){var b;let p=tn(u.events);if(p){if(Z(u))return;r.emit(P.interactives,{subjectId:u.id,subjectName:"chapter",type:j.actionChoice,actionType:p.action.type,payload:p.action.args}),e.interactiveActionChoice$.next({subjectId:u.id,subjectName:"chapter",type:"action-choice",actionType:p.action.type,payload:p.action.args}),n.add({timestamp:1/0,priority:"chapter",initiator:u.id,actionType:E.EventActionTypes.expect,action:y.bind(null,{subjectId:u.id,subjectName:"chapter"})})}else(b=u.events)==null||b.forEach(x=>{let A=c({chapterId:u.id,action:x.action,branches:u.branches});A&&n.add({timestamp:1/0,priority:"chapter",initiator:u.id,actionType:x.action.type,action:A})})}let y=({subjectId:u,subjectName:p})=>{t.pause(),r.emit(P.interactives,{subjectId:u,subjectName:p,type:j.actionExecution,actionType:E.EventActionTypes.expect}),e.interactiveActionExecution$.next({subjectId:u,subjectName:p,type:"action-execution",actionType:E.EventActionTypes.expect})},g=({subjectId:u,subjectName:p})=>{t.info.isEnded$.getValue()?n.execEndOfVideo():t.play(),r.emit(P.interactives,{subjectId:u,subjectName:p,type:j.actionExecution,actionType:Da}),e.interactiveActionExecution$.next({subjectId:u,subjectName:p,type:"action-execution",actionType:Da})},R=({subjectId:u,subjectName:p,subjectType:b,action:x})=>{r.emit(P.interactives,{subjectId:u,subjectName:p,subjectType:b,type:j.actionExecution,actionType:x.type}),e.interactiveActionExecution$.next({subjectId:u,subjectName:p,subjectType:b,type:"action-execution",actionType:x.type})},I=({subjectId:u,subjectName:p,subjectType:b,action:x,payload:A})=>{A.behaviour="change-chapter",r.emit(P.interactives,{subjectId:u,subjectName:p,subjectType:b,type:j.actionExecution,actionType:x.type,payload:A}),e.interactiveActionExecution$.next({subjectId:u,subjectName:p,subjectType:b,type:"action-execution",actionType:x.type,payload:A})},m=({subjectId:u,subjectName:p,subjectType:b,action:x,payload:A})=>{if(!A.URI)return;let C=window.open(A.URI,"_blank","noopener,noreferrer");C&&(C.opener=null),r.emit(P.interactives,{subjectId:u,subjectName:p,subjectType:b,type:j.actionExecution,actionType:x.type}),e.interactiveActionExecution$.next({subjectId:u,subjectName:p,subjectType:b,type:"action-execution",actionType:x.type})};return{onControlEvent:s,onContainerEvent:l,onChapterEvent:c,onExpectEvent:y,expectEventHandler:g,setManifestChapterEvents:v,setManifestContainerEvents:a,stopExpect:o,state:i}};var vn=Q(zr(),1),K=require("@vkontakte/videoplayer-shared/es2015");var er=(r,e)=>{let t={};return r.map(n=>{if(!t[n]){let i=e.chapters.find(s=>s.id===n);if(!i)return null;let o=e.media.videos.find(s=>i.videoId===s.id);if(!o)return null;t[n]=mn(o)}return t[n]}).filter(Boolean)},Ua=r=>{for(let e of r.variants)if(Ga(e)&&e.payload)return e.payload.id},Ga=r=>!!(r.type==="custom"&&r.payload&&r.payload.type==="vk"),mn=r=>{let e=Ua(r);if(!e)return null;let t=e.split("_").pop();return t?parseInt(t,10):null},za=(r,e)=>{for(let t of r.media.videos)if(e===mn(t)){for(let n of r.chapters)if(n.videoId===t.id)return n.id;return}},fn=(r,e)=>r.reduce((t,n)=>{let i=za(e,n);return i?[...t,i]:t},[]);var oe,ge,Ee,W,tr,se,ae,ne,Ie,je,$e,mt=class{constructor({globalEventEmitter:e,videoId:t,interactiveController:n,historyApi:i,settings:o}){this.state={history$:new K.ValueSubject([]),hasPrevChapter$:new K.ValueSubject(!1),prevChapter$:new K.ValueSubject(null),isInitialChapter$:new K.ValueSubject(!1),isGoBackLimited$:new K.ValueSubject(!1)};U(this,oe,null);U(this,ge);U(this,Ee,!1);U(this,W,null);U(this,tr,null);this.events={inited$:new K.Subject,destroyed$:new K.Subject,error$:new K.Subject};U(this,se,null);U(this,ae,null);U(this,ne,null);U(this,Ie,new K.Subscription);U(this,je,!1);U(this,$e,0);var s;F(this,se,t),F(this,ne,e),F(this,ae,n),F(this,oe,i),F(this,ge,o),this.state.history$&&k(this,Ie)&&((s=k(this,Ie))==null||s.add(this.state.history$.subscribe(l=>{var a,c;this.state.prevChapter$.next((0,vn.default)(l,-2)||null),this.state.hasPrevChapter$.next(l.length>1),this.state.isInitialChapter$.next(this.getInitialChapterId()===((c=(a=k(this,W))==null?void 0:a.metadata)==null?void 0:c.initChapterId)),this.state.isGoBackLimited$.next(k(this,$e)===k(this,ge).maxLength-1)})))}setManifest(e){return O(this,null,function*(){if(!k(this,ae)||!k(this,ne))return;F(this,W,e),yield this.getProjectHistory();let t=this.getInitialChapterId();yield k(this,ae).setChapter({chapterId:t,pushToHistory:!1}),k(this,Ee)||(F(this,Ee,!0),this.events.inited$.next({initChapterId:t}))})}get inited(){return k(this,Ee)}updateHistory(e,t=!0){return O(this,null,function*(){var l;if(!k(this,W))return;k(this,je)?(F(this,je,!1),On(this,$e)._++):F(this,$e,0);let n=k(this,W),i=e.length-k(this,ge).maxLength,o=i>0?e.slice(i):e,s=er(o,n);if(F(this,tr,s),this.state.history$.next(o),!(!t||!k(this,oe)||!k(this,se)))try{yield k(this,oe).save(k(this,se),s)}catch(a){let c=new L(1,5,"Unable to save interactive history");this.events.error$.next(c),(l=k(this,ne))==null||l.emit(P.errors,c)}})}goBack(){return O(this,null,function*(){var n;if(!this.state||!k(this,ae)){let i=new L(1,5,"Unable to save interactive history");return this.events.error$.next(i),(n=k(this,ne))==null?void 0:n.emit(P.errors,i)}F(this,je,!0);let e=this.state.history$.getValue().slice(0,-1),t=e.pop();this.state.history$.next(e),yield k(this,ae).setChapter({chapterId:t,playPrev:!0})})}getProjectHistory(){return O(this,null,function*(){var i;if(!k(this,W)||!k(this,se))return;let e=k(this,W),t=[this.getInitialVideoId()];if(k(this,oe))try{let o=yield k(this,oe).get(k(this,se));o.length&&(t=o)}catch(o){let s=new L(1,5,"Error while trying to fetch data");this.events.error$.next(s),(i=k(this,ne))==null||i.emit(P.errors,s)}let n=fn(t,e);this.state.history$.next(n)})}getInitialChapterId(){var t;let e=this.state.history$.getValue();return(0,vn.default)(e,-1)||k(this,ge).initChapterId||((t=k(this,W))==null?void 0:t.metadata.initChapterId)}getInitialVideoId(){if(k(this,W)){let e=this.getInitialChapterId();return er([e],k(this,W)).pop()}return null}destroy(){var e,t;F(this,se,null),F(this,oe,null),F(this,ae,null),(e=k(this,Ie))==null||e.unsubscribe(),F(this,Ie,null),F(this,Ee,!1),(t=k(this,ne))==null||t.emit(P.historyDestroyed),this.events.destroyed$.next(),F(this,ne,null)}};oe=new WeakMap,ge=new WeakMap,Ee=new WeakMap,W=new WeakMap,tr=new WeakMap,se=new WeakMap,ae=new WeakMap,ne=new WeakMap,Ie=new WeakMap,je=new WeakMap,$e=new WeakMap;var rr=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 o=3;o<n;o+=40)if(t[o]!==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 O(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 O(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 nr=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
|
+
"use strict";var tl=Object.create;var _e=Object.defineProperty,rl=Object.defineProperties,nl=Object.getOwnPropertyDescriptor,il=Object.getOwnPropertyDescriptors,ol=Object.getOwnPropertyNames,yt=Object.getOwnPropertySymbols,sl=Object.getPrototypeOf,or=Object.prototype.hasOwnProperty,wn=Object.prototype.propertyIsEnumerable;var An=r=>{throw TypeError(r)};var Sn=(r,e,t)=>e in r?_e(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,d=(r,e)=>{for(var t in e||(e={}))or.call(e,t)&&Sn(r,t,e[t]);if(yt)for(var t of yt(e))wn.call(e,t)&&Sn(r,t,e[t]);return r},T=(r,e)=>rl(r,il(e));var ee=(r,e)=>{var t={};for(var n in r)or.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&yt)for(var n of yt(r))e.indexOf(n)<0&&wn.call(r,n)&&(t[n]=r[n]);return t};var h=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),al=(r,e)=>{for(var t in e)_e(r,t,{get:e[t],enumerable:!0})},Rn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ol(e))!or.call(r,i)&&i!==t&&_e(r,i,{get:()=>e[i],enumerable:!(n=nl(e,i))||n.enumerable});return r};var Q=(r,e,t)=>(t=r!=null?tl(sl(r)):{},Rn(e||!r||!r.__esModule?_e(t,"default",{value:r,enumerable:!0}):t,r)),ll=r=>Rn(_e({},"__esModule",{value:!0}),r);var kn=(r,e,t)=>e.has(r)||An("Cannot "+t);var k=(r,e,t)=>(kn(r,e,"read from private field"),t?t.call(r):e.get(r)),U=(r,e,t)=>e.has(r)?An("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),F=(r,e,t,n)=>(kn(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);var On=(r,e,t,n)=>({set _(i){F(r,e,i,t)},get _(){return k(r,e,n)}});var O=(r,e,t)=>new Promise((n,i)=>{var o=a=>{try{l(t.next(a))}catch(c){i(c)}},s=a=>{try{l(t.throw(a))}catch(c){i(c)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(o,s);l((t=t.apply(r,e)).next())});var re=h((vr,Dn)=>{"use strict";var Ge=function(r){return r&&r.Math===Math&&r};Dn.exports=Ge(typeof globalThis=="object"&&globalThis)||Ge(typeof window=="object"&&window)||Ge(typeof self=="object"&&self)||Ge(typeof global=="object"&&global)||Ge(typeof vr=="object"&&vr)||function(){return this}()||Function("return this")()});var G=h((Bd,Hn)=>{"use strict";Hn.exports=function(r){try{return!!r()}catch(e){return!0}}});var ze=h((qd,Un)=>{"use strict";var cl=G();Un.exports=!cl(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var Qn=h((Dd,Kn)=>{"use strict";var ul=ze(),Wn=Function.prototype,Gn=Wn.apply,zn=Wn.call;Kn.exports=typeof Reflect=="object"&&Reflect.apply||(ul?zn.bind(Gn):function(){return zn.apply(Gn,arguments)})});var X=h((Hd,Zn)=>{"use strict";var Xn=ze(),Yn=Function.prototype,yr=Yn.call,pl=Xn&&Yn.bind.bind(yr,yr);Zn.exports=Xn?pl:function(r){return function(){return yr.apply(r,arguments)}}});var We=h((Ud,ei)=>{"use strict";var Jn=X(),hl=Jn({}.toString),dl=Jn("".slice);ei.exports=function(r){return dl(hl(r),8,-1)}});var br=h((Gd,ti)=>{"use strict";var ml=We(),fl=X();ti.exports=function(r){if(ml(r)==="Function")return fl(r)}});var z=h((zd,ri)=>{"use strict";var Cr=typeof document=="object"&&document.all;ri.exports=typeof Cr=="undefined"&&Cr!==void 0?function(r){return typeof r=="function"||r===Cr}:function(r){return typeof r=="function"}});var ve=h((Wd,ni)=>{"use strict";var vl=G();ni.exports=!vl(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var Vt=h((Kd,ii)=>{"use strict";var yl=ze(),Pt=Function.prototype.call;ii.exports=yl?Pt.bind(Pt):function(){return Pt.apply(Pt,arguments)}});var gr=h(ai=>{"use strict";var oi={}.propertyIsEnumerable,si=Object.getOwnPropertyDescriptor,bl=si&&!oi.call({1:2},1);ai.f=bl?function(e){var t=si(this,e);return!!t&&t.enumerable}:oi});var Er=h((Xd,li)=>{"use strict";li.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var ui=h((Yd,ci)=>{"use strict";var Cl=X(),gl=G(),El=We(),Ir=Object,Il=Cl("".split);ci.exports=gl(function(){return!Ir("z").propertyIsEnumerable(0)})?function(r){return El(r)==="String"?Il(r,""):Ir(r)}:Ir});var xr=h((Zd,pi)=>{"use strict";pi.exports=function(r){return r==null}});var Tr=h((Jd,hi)=>{"use strict";var xl=xr(),Tl=TypeError;hi.exports=function(r){if(xl(r))throw new Tl("Can't call method on "+r);return r}});var Ke=h((em,di)=>{"use strict";var Sl=ui(),wl=Tr();di.exports=function(r){return Sl(wl(r))}});var Re=h((tm,mi)=>{"use strict";var Al=z();mi.exports=function(r){return typeof r=="object"?r!==null:Al(r)}});var Mt=h((rm,fi)=>{"use strict";fi.exports={}});var Nt=h((nm,yi)=>{"use strict";var Sr=Mt(),wr=re(),Rl=z(),vi=function(r){return Rl(r)?r:void 0};yi.exports=function(r,e){return arguments.length<2?vi(Sr[r])||vi(wr[r]):Sr[r]&&Sr[r][e]||wr[r]&&wr[r][e]}});var Ci=h((im,bi)=>{"use strict";var kl=X();bi.exports=kl({}.isPrototypeOf)});var xi=h((om,Ii)=>{"use strict";var Ol=re(),gi=Ol.navigator,Ei=gi&&gi.userAgent;Ii.exports=Ei?String(Ei):""});var Oi=h((sm,ki)=>{"use strict";var Ri=re(),Ar=xi(),Ti=Ri.process,Si=Ri.Deno,wi=Ti&&Ti.versions||Si&&Si.version,Ai=wi&&wi.v8,Y,Lt;Ai&&(Y=Ai.split("."),Lt=Y[0]>0&&Y[0]<4?1:+(Y[0]+Y[1]));!Lt&&Ar&&(Y=Ar.match(/Edge\/(\d+)/),(!Y||Y[1]>=74)&&(Y=Ar.match(/Chrome\/(\d+)/),Y&&(Lt=+Y[1])));ki.exports=Lt});var Rr=h((am,Vi)=>{"use strict";var Pi=Oi(),Pl=G(),Vl=re(),Ml=Vl.String;Vi.exports=!!Object.getOwnPropertySymbols&&!Pl(function(){var r=Symbol("symbol detection");return!Ml(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&Pi&&Pi<41})});var kr=h((lm,Mi)=>{"use strict";var Nl=Rr();Mi.exports=Nl&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Or=h((cm,Ni)=>{"use strict";var Ll=Nt(),jl=z(),$l=Ci(),Fl=kr(),_l=Object;Ni.exports=Fl?function(r){return typeof r=="symbol"}:function(r){var e=Ll("Symbol");return jl(e)&&$l(e.prototype,_l(r))}});var ji=h((um,Li)=>{"use strict";var Bl=String;Li.exports=function(r){try{return Bl(r)}catch(e){return"Object"}}});var Pr=h((pm,$i)=>{"use strict";var ql=z(),Dl=ji(),Hl=TypeError;$i.exports=function(r){if(ql(r))return r;throw new Hl(Dl(r)+" is not a function")}});var _i=h((hm,Fi)=>{"use strict";var Ul=Pr(),Gl=xr();Fi.exports=function(r,e){var t=r[e];return Gl(t)?void 0:Ul(t)}});var qi=h((dm,Bi)=>{"use strict";var Vr=Vt(),Mr=z(),Nr=Re(),zl=TypeError;Bi.exports=function(r,e){var t,n;if(e==="string"&&Mr(t=r.toString)&&!Nr(n=Vr(t,r))||Mr(t=r.valueOf)&&!Nr(n=Vr(t,r))||e!=="string"&&Mr(t=r.toString)&&!Nr(n=Vr(t,r)))return n;throw new zl("Can't convert object to primitive value")}});var Hi=h((mm,Di)=>{"use strict";Di.exports=!0});var zi=h((fm,Gi)=>{"use strict";var Ui=re(),Wl=Object.defineProperty;Gi.exports=function(r,e){try{Wl(Ui,r,{value:e,configurable:!0,writable:!0})}catch(t){Ui[r]=e}return e}});var jt=h((vm,Qi)=>{"use strict";var Kl=Hi(),Ql=re(),Xl=zi(),Wi="__core-js_shared__",Ki=Qi.exports=Ql[Wi]||Xl(Wi,{});(Ki.versions||(Ki.versions=[])).push({version:"3.38.0",mode:Kl?"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 Lr=h((ym,Yi)=>{"use strict";var Xi=jt();Yi.exports=function(r,e){return Xi[r]||(Xi[r]=e||{})}});var Qe=h((bm,Zi)=>{"use strict";var Yl=Tr(),Zl=Object;Zi.exports=function(r){return Zl(Yl(r))}});var ke=h((Cm,Ji)=>{"use strict";var Jl=X(),ec=Qe(),tc=Jl({}.hasOwnProperty);Ji.exports=Object.hasOwn||function(e,t){return tc(ec(e),t)}});var jr=h((gm,eo)=>{"use strict";var rc=X(),nc=0,ic=Math.random(),oc=rc(1 .toString);eo.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+oc(++nc+ic,36)}});var Xe=h((Em,ro)=>{"use strict";var sc=re(),ac=Lr(),to=ke(),lc=jr(),cc=Rr(),uc=kr(),Oe=sc.Symbol,$r=ac("wks"),pc=uc?Oe.for||Oe:Oe&&Oe.withoutSetter||lc;ro.exports=function(r){return to($r,r)||($r[r]=cc&&to(Oe,r)?Oe[r]:pc("Symbol."+r)),$r[r]}});var so=h((Im,oo)=>{"use strict";var hc=Vt(),no=Re(),io=Or(),dc=_i(),mc=qi(),fc=Xe(),vc=TypeError,yc=fc("toPrimitive");oo.exports=function(r,e){if(!no(r)||io(r))return r;var t=dc(r,yc),n;if(t){if(e===void 0&&(e="default"),n=hc(t,r,e),!no(n)||io(n))return n;throw new vc("Can't convert object to primitive value")}return e===void 0&&(e="number"),mc(r,e)}});var Fr=h((xm,ao)=>{"use strict";var bc=so(),Cc=Or();ao.exports=function(r){var e=bc(r,"string");return Cc(e)?e:e+""}});var uo=h((Tm,co)=>{"use strict";var gc=re(),lo=Re(),_r=gc.document,Ec=lo(_r)&&lo(_r.createElement);co.exports=function(r){return Ec?_r.createElement(r):{}}});var Br=h((Sm,po)=>{"use strict";var Ic=ve(),xc=G(),Tc=uo();po.exports=!Ic&&!xc(function(){return Object.defineProperty(Tc("div"),"a",{get:function(){return 7}}).a!==7})});var fo=h(mo=>{"use strict";var Sc=ve(),wc=Vt(),Ac=gr(),Rc=Er(),kc=Ke(),Oc=Fr(),Pc=ke(),Vc=Br(),ho=Object.getOwnPropertyDescriptor;mo.f=Sc?ho:function(e,t){if(e=kc(e),t=Oc(t),Vc)try{return ho(e,t)}catch(n){}if(Pc(e,t))return Rc(!wc(Ac.f,e,t),e[t])}});var yo=h((Am,vo)=>{"use strict";var Mc=G(),Nc=z(),Lc=/#|\.prototype\./,Ye=function(r,e){var t=$c[jc(r)];return t===_c?!0:t===Fc?!1:Nc(e)?Mc(e):!!e},jc=Ye.normalize=function(r){return String(r).replace(Lc,".").toLowerCase()},$c=Ye.data={},Fc=Ye.NATIVE="N",_c=Ye.POLYFILL="P";vo.exports=Ye});var qr=h((Rm,Co)=>{"use strict";var bo=br(),Bc=Pr(),qc=ze(),Dc=bo(bo.bind);Co.exports=function(r,e){return Bc(r),e===void 0?r:qc?Dc(r,e):function(){return r.apply(e,arguments)}}});var Eo=h((km,go)=>{"use strict";var Hc=ve(),Uc=G();go.exports=Hc&&Uc(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var xo=h((Om,Io)=>{"use strict";var Gc=Re(),zc=String,Wc=TypeError;Io.exports=function(r){if(Gc(r))return r;throw new Wc(zc(r)+" is not an object")}});var wo=h(So=>{"use strict";var Kc=ve(),Qc=Br(),Xc=Eo(),$t=xo(),To=Fr(),Yc=TypeError,Dr=Object.defineProperty,Zc=Object.getOwnPropertyDescriptor,Hr="enumerable",Ur="configurable",Gr="writable";So.f=Kc?Xc?function(e,t,n){if($t(e),t=To(t),$t(n),typeof e=="function"&&t==="prototype"&&"value"in n&&Gr in n&&!n[Gr]){var i=Zc(e,t);i&&i[Gr]&&(e[t]=n.value,n={configurable:Ur in n?n[Ur]:i[Ur],enumerable:Hr in n?n[Hr]:i[Hr],writable:!1})}return Dr(e,t,n)}:Dr:function(e,t,n){if($t(e),t=To(t),$t(n),Qc)try{return Dr(e,t,n)}catch(i){}if("get"in n||"set"in n)throw new Yc("Accessors not supported");return"value"in n&&(e[t]=n.value),e}});var Ro=h((Vm,Ao)=>{"use strict";var Jc=ve(),eu=wo(),tu=Er();Ao.exports=Jc?function(r,e,t){return eu.f(r,e,tu(1,t))}:function(r,e,t){return r[e]=t,r}});var Je=h((Mm,Oo)=>{"use strict";var Ze=re(),ru=Qn(),nu=br(),iu=z(),ou=fo().f,su=yo(),Pe=Mt(),au=qr(),Ve=Ro(),ko=ke();jt();var lu=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 ru(r,this,arguments)};return e.prototype=r.prototype,e};Oo.exports=function(r,e){var t=r.target,n=r.global,i=r.stat,o=r.proto,s=n?Ze:i?Ze[t]:Ze[t]&&Ze[t].prototype,l=n?Pe:Pe[t]||Ve(Pe,t,{})[t],a=l.prototype,c,f,v,y,g,R,I,m,u;for(y in e)c=su(n?y:t+(i?".":"#")+y,r.forced),f=!c&&s&&ko(s,y),R=l[y],f&&(r.dontCallGetSet?(u=ou(s,y),I=u&&u.value):I=s[y]),g=f&&I?I:e[y],!(!c&&!o&&typeof R==typeof g)&&(r.bind&&f?m=au(g,Ze):r.wrap&&f?m=lu(g):o&&iu(g)?m=nu(g):m=g,(r.sham||g&&g.sham||R&&R.sham)&&Ve(m,"sham",!0),Ve(l,y,m),o&&(v=t+"Prototype",ko(Pe,v)||Ve(Pe,v,{}),Ve(Pe[v],y,g),r.real&&a&&(c||!a[y])&&Ve(a,y,g)))}});var Vo=h((Nm,Po)=>{"use strict";var cu=Math.ceil,uu=Math.floor;Po.exports=Math.trunc||function(e){var t=+e;return(t>0?uu:cu)(t)}});var et=h((Lm,Mo)=>{"use strict";var pu=Vo();Mo.exports=function(r){var e=+r;return e!==e||e===0?0:pu(e)}});var Lo=h((jm,No)=>{"use strict";var hu=et(),du=Math.min;No.exports=function(r){var e=hu(r);return e>0?du(e,9007199254740991):0}});var tt=h(($m,jo)=>{"use strict";var mu=Lo();jo.exports=function(r){return mu(r.length)}});var Ft=h((Fm,$o)=>{"use strict";$o.exports=function(){}});var Fo=h(()=>{"use strict";var fu=Je(),vu=Qe(),yu=tt(),bu=et(),Cu=Ft();fu({target:"Array",proto:!0},{at:function(e){var t=vu(this),n=yu(t),i=bu(e),o=i>=0?i:n+i;return o<0||o>=n?void 0:t[o]}});Cu("at")});var _t=h((qm,_o)=>{"use strict";var gu=Nt();_o.exports=gu});var qo=h((Dm,Bo)=>{"use strict";Fo();var Eu=_t();Bo.exports=Eu("Array","at")});var Ho=h((Hm,Do)=>{"use strict";var Iu=qo();Do.exports=Iu});var zr=h((Um,Uo)=>{"use strict";var xu=Ho();Uo.exports=xu});var Jo=h((Nf,Zo)=>{"use strict";var ju=et(),$u=Math.max,Fu=Math.min;Zo.exports=function(r,e){var t=ju(r);return t<0?$u(t+e,0):Fu(t,e)}});var Jr=h((Lf,ts)=>{"use strict";var _u=Ke(),Bu=Jo(),qu=tt(),es=function(r){return function(e,t,n){var i=_u(e),o=qu(i);if(o===0)return!r&&-1;var s=Bu(n,o),l;if(r&&t!==t){for(;o>s;)if(l=i[s++],l!==l)return!0}else for(;o>s;s++)if((r||s in i)&&i[s]===t)return r||s||0;return!r&&-1}};ts.exports={includes:es(!0),indexOf:es(!1)}});var rs=h(()=>{"use strict";var Du=Je(),Hu=Jr().includes,Uu=G(),Gu=Ft(),zu=Uu(function(){return!Array(1).includes()});Du({target:"Array",proto:!0,forced:zu},{includes:function(e){return Hu(this,e,arguments.length>1?arguments[1]:void 0)}});Gu("includes")});var is=h((Ff,ns)=>{"use strict";rs();var Wu=_t();ns.exports=Wu("Array","includes")});var ss=h((_f,os)=>{"use strict";var Ku=is();os.exports=Ku});var ct=h((Bf,as)=>{"use strict";var Qu=ss();as.exports=Qu});var fs=h((Yf,ms)=>{"use strict";var Yu=Lr(),Zu=jr(),ds=Yu("keys");ms.exports=function(r){return ds[r]||(ds[r]=Zu(r))}});var ys=h((Zf,vs)=>{"use strict";var Ju=G();vs.exports=!Ju(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var gs=h((Jf,Cs)=>{"use strict";var ep=ke(),tp=z(),rp=Qe(),np=fs(),ip=ys(),bs=np("IE_PROTO"),rn=Object,op=rn.prototype;Cs.exports=ip?rn.getPrototypeOf:function(r){var e=rp(r);if(ep(e,bs))return e[bs];var t=e.constructor;return tp(t)&&e instanceof t?t.prototype:e instanceof rn?op:null}});var Is=h((ev,Es)=>{"use strict";Es.exports={}});var Ss=h((tv,Ts)=>{"use strict";var sp=X(),nn=ke(),ap=Ke(),lp=Jr().indexOf,cp=Is(),xs=sp([].push);Ts.exports=function(r,e){var t=ap(r),n=0,i=[],o;for(o in t)!nn(cp,o)&&nn(t,o)&&xs(i,o);for(;e.length>n;)nn(t,o=e[n++])&&(~lp(i,o)||xs(i,o));return i}});var As=h((rv,ws)=>{"use strict";ws.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var ks=h((nv,Rs)=>{"use strict";var up=Ss(),pp=As();Rs.exports=Object.keys||function(e){return up(e,pp)}});var Ls=h((iv,Ns)=>{"use strict";var Ps=ve(),hp=G(),Vs=X(),dp=gs(),mp=ks(),fp=Ke(),vp=gr().f,Ms=Vs(vp),yp=Vs([].push),bp=Ps&&hp(function(){var r=Object.create(null);return r[2]=2,!Ms(r,2)}),Os=function(r){return function(e){for(var t=fp(e),n=mp(t),i=bp&&dp(t)===null,o=n.length,s=0,l=[],a;o>s;)a=n[s++],(!Ps||(i?a in t:Ms(t,a)))&&yp(l,r?[a,t[a]]:t[a]);return l}};Ns.exports={entries:Os(!0),values:Os(!1)}});var js=h(()=>{"use strict";var Cp=Je(),gp=Ls().values;Cp({target:"Object",stat:!0},{values:function(e){return gp(e)}})});var Fs=h((av,$s)=>{"use strict";js();var Ep=Mt();$s.exports=Ep.Object.values});var Bs=h((lv,_s)=>{"use strict";var Ip=Fs();_s.exports=Ip});var Xt=h((cv,qs)=>{"use strict";var xp=Bs();qs.exports=xp});var cn=h((Nv,Xs)=>{"use strict";var Sp=We();Xs.exports=Array.isArray||function(e){return Sp(e)==="Array"}});var Zs=h((Lv,Ys)=>{"use strict";var wp=TypeError,Ap=9007199254740991;Ys.exports=function(r){if(r>Ap)throw wp("Maximum allowed index exceeded");return r}});var ta=h((jv,ea)=>{"use strict";var Rp=cn(),kp=tt(),Op=Zs(),Pp=qr(),Js=function(r,e,t,n,i,o,s,l){for(var a=i,c=0,f=s?Pp(s,l):!1,v,y;c<n;)c in t&&(v=f?f(t[c],c,e):t[c],o>0&&Rp(v)?(y=kp(v),a=Js(r,e,v,y,a,o-1)-1):(Op(a+1),r[a]=v),a++),c++;return a};ea.exports=Js});var ia=h(($v,na)=>{"use strict";var Vp=Xe(),Mp=Vp("toStringTag"),ra={};ra[Mp]="z";na.exports=String(ra)==="[object z]"});var sa=h((Fv,oa)=>{"use strict";var Np=ia(),Lp=z(),Zt=We(),jp=Xe(),$p=jp("toStringTag"),Fp=Object,_p=Zt(function(){return arguments}())==="Arguments",Bp=function(r,e){try{return r[e]}catch(t){}};oa.exports=Np?Zt:function(r){var e,t,n;return r===void 0?"Undefined":r===null?"Null":typeof(t=Bp(e=Fp(r),$p))=="string"?t:_p?Zt(e):(n=Zt(e))==="Object"&&Lp(e.callee)?"Arguments":n}});var la=h((_v,aa)=>{"use strict";var qp=X(),Dp=z(),un=jt(),Hp=qp(Function.toString);Dp(un.inspectSource)||(un.inspectSource=function(r){return Hp(r)});aa.exports=un.inspectSource});var ma=h((Bv,da)=>{"use strict";var Up=X(),Gp=G(),ca=z(),zp=sa(),Wp=Nt(),Kp=la(),ua=function(){},pa=Wp("Reflect","construct"),pn=/^\s*(?:class|function)\b/,Qp=Up(pn.exec),Xp=!pn.test(ua),dt=function(e){if(!ca(e))return!1;try{return pa(ua,[],e),!0}catch(t){return!1}},ha=function(e){if(!ca(e))return!1;switch(zp(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Xp||!!Qp(pn,Kp(e))}catch(t){return!0}};ha.sham=!0;da.exports=!pa||Gp(function(){var r;return dt(dt.call)||!dt(Object)||!dt(function(){r=!0})||r})?ha:dt});var ba=h((qv,ya)=>{"use strict";var fa=cn(),Yp=ma(),Zp=Re(),Jp=Xe(),eh=Jp("species"),va=Array;ya.exports=function(r){var e;return fa(r)&&(e=r.constructor,Yp(e)&&(e===va||fa(e.prototype))?e=void 0:Zp(e)&&(e=e[eh],e===null&&(e=void 0))),e===void 0?va:e}});var ga=h((Dv,Ca)=>{"use strict";var th=ba();Ca.exports=function(r,e){return new(th(r))(e===0?0:e)}});var Ea=h(()=>{"use strict";var rh=Je(),nh=ta(),ih=Qe(),oh=tt(),sh=et(),ah=ga();rh({target:"Array",proto:!0},{flat:function(){var e=arguments.length?arguments[0]:void 0,t=ih(this),n=oh(t),i=ah(t,0);return i.length=nh(i,t,t,n,0,e===void 0?1:sh(e)),i}})});var Ia=h(()=>{"use strict";var lh=Ft();lh("flat")});var Ta=h((Wv,xa)=>{"use strict";Ea();Ia();var ch=_t();xa.exports=ch("Array","flat")});var wa=h((Kv,Sa)=>{"use strict";var uh=Ta();Sa.exports=uh});var Ra=h((Qv,Aa)=>{"use strict";var ph=wa();Aa.exports=ph});var Eh={};al(Eh,{ContainerTypes:()=>E.ContainerTypes,ControlTypes:()=>E.ControlTypes,CustomError:()=>L,EVENT_NAMES:()=>P,EventActionTypes:()=>E.EventActionTypes,EventTypes:()=>E.EventTypes,Interactives:()=>ft,ManifestController:()=>Ce,SDKInfo:()=>gh,chapterIdsToVKVideoIds:()=>er,compareVersions:()=>zt,containerTypes:()=>Au,controlTypes:()=>Ru,eventActionTypes:()=>Kr,eventTypes:()=>ku,getChapterIdByVkVideoId:()=>za,getVKVideoIdByMedia:()=>mn,getVideoRawIdByMedia:()=>Ua,graphEventTypes:()=>Le,hasEndTemplate:()=>ut,interactivesEventTypes:()=>j,isAreaControl:()=>wu,isButtonControl:()=>Su,isLastChapter:()=>Z,isOneTextCtrlContainer:()=>be,isSupportedManifest:()=>E.isSupportedManifest,isTextControl:()=>ot,isVKVariantItem:()=>Ga,isValidManifest:()=>Wr,migrateManifestToLatestVersion:()=>E.migrateManifestToLatestVersion,utils:()=>Ja,vkVideoIdsToChapterIds:()=>fn});module.exports=ll(Eh);var Pn="1.0.37-dev.8109bc71.0";var kt=require("@vkontakte/videoplayer-shared/es2015");var sr=class{constructor(e){this.layout=e}},bt=class extends sr{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))`}};function Vn(r){return"features"in r}var Se=class{constructor(e,t){this.container=e,this.options=t,this.factories=new Map,this.controls=[],this.setControls()}featureIsEnabled(e){return this.options&&Vn(this.options)&&this.options.features[e]}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(),o=this.factories.get(i);if(o){let s=o(n,this.options);if(s)return[...t,s]}return[...t]},[]))||[]}};var me=require("@vkontakte/videoplayer-shared/es2015");function Be(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 Mn="interactive",_={textColor:"#000",textSize:.4,textContent:"",roundCorners:0,borderWidth:0,borderWidthRawValue:"1px",roundCornersRawValue:"0",borderColor:"#000",borderAlpha:1,backgroundColor:"#fff",backgroundAlpha:1,innerSizesDependOn:"self",angle:0,shadowColorLight:"#fff",shadowColorDark:"#000",shadowColorAlpha:.24},Nn=(n=>(n.top="flex-start",n.bottom="flex-end",n.center="center",n))(Nn||{}),Ln=(n=>(n.start="flex-start",n.end="flex-end",n.center="center",n))(Ln||{}),jn=(n=>(n.start="left",n.end="right",n.center="center",n))(jn||{}),Ct=({target:r,props:e})=>{var t,n,i;r.style.alignItems=(t=(e==null?void 0:e.gravityVertical)&&Nn[e.gravityVertical])!=null?t:"center",r.style.justifyContent=(n=(e==null?void 0:e.gravityHorizontal)&&Ln[e.gravityHorizontal])!=null?n:"center",r.style.textAlign=(i=(e==null?void 0:e.alignment)&&jn[e.alignment])!=null?i:"center"},gt=({target:r,props:e,fallback:t,dependsOn:n})=>{var i,o,s,l,a,c;r.style.color=(o=(i=e==null?void 0:e.text)==null?void 0:i.color)!=null?o:t.textColor,r.style.fontSize=`calc(${n.height} * ${(l=(s=e==null?void 0:e.text)==null?void 0:s.size)!=null?l:t.textSize})`,r.textContent=(c=(a=e==null?void 0:e.text)==null?void 0:a.value)!=null?c:t.textContent},Et=({target:r,props:e,fallback:t})=>{var n,i,o,s;r.style.backgroundColor=Be((i=(n=e==null?void 0:e.background)==null?void 0:n.color)!=null?i:t.backgroundColor,(s=(o=e==null?void 0:e.background)==null?void 0:o.alpha)!=null?s:t.backgroundAlpha)},qe=({target:r,props:e,fallback:t,dependsOn:n,useRawValues:i=!1})=>{var l,a,c,f,v,y,g,R,I,m,u;let o=i?t.borderWidthRawValue:`calc(${n.height} * ${(c=(a=(l=e==null?void 0:e.shape)==null?void 0:l.border)==null?void 0:a.width)!=null?c:t.borderWidth})`,s=i?t.roundCornersRawValue:`calc(${n.height} * ${(v=(f=e==null?void 0:e.shape)==null?void 0:f.roundCorners)!=null?v:t.roundCorners})`;r.style.borderWidth=o,r.style.borderStyle="solid",r.style.borderColor=Be(i?t.borderColor:(R=(g=(y=e==null?void 0:e.shape)==null?void 0:y.border)==null?void 0:g.color)!=null?R:t.borderColor,i?t.borderAlpha:(u=(m=(I=e==null?void 0:e.shape)==null?void 0:I.border)==null?void 0:m.alpha)!=null?u:t.borderAlpha),r.style.borderRadius=s},$n=({target:r,isDark:e,baseDimension:t,fallback:n})=>{let s=Be(n.shadowColorLight,n.shadowColorAlpha),l=Be(n.shadowColorDark,n.shadowColorAlpha),a=`calc(${t} * ${.25})`,c=`calc(${t} * ${.11})`,f=`0px 0px ${a} ${c} ${e?l:s}`;r.style.boxShadow=f},we=({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 Ae=require("@vkontakte/videoplayer-shared/es2015");var ar="int",he=(n=>(n.AREA=`${ar}_area`,n.TEXT=`${ar}_text`,n.BUTTON=`${ar}_bttn`,n))(he||{});function Fn(r){return"features"in r}var te="interactive-control",M={common:te,selected:`${te}-selected`,wrapper:`${te}-wrapper`,disabled:`${te}-disabled`,button:`${te}-button`,area:`${te}-area`,text:`${te}-text`,blinkAnim:`${te}-blink-anim`,blinkAnimButton:`${te}-blink-anim-button`,blinkAnimArea:`${te}-blink-anim-area`};var L=class{constructor(e,t,...n){this.severity=e;this.category=t;this.data=n}toString(){return`Interactive SDK error ${JSON.stringify(this,null," ")}`}};var le=class{constructor(e,t){this.control=e;this.options=t;this.container=null;this.controlElement=null;this.subscriptions=new Ae.Subscription;this.error$=new Ae.Subject}createContainerElement(e){var i;let t=document.createElement("div");t.classList.add(M.wrapper),e.setControlLayout(t,this.control.layoutParams);let n=((i=this.control.layoutParams.innerSizesDependOn)!=null?i:_.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()}}featureIsEnabled(e){return this.options&&Fn(this.options)&&this.options.features[e]}setEvents(e){!this.container||!this.control.events||this.control.events.forEach(t=>{switch(t.type.trim().toLowerCase()){case"onclick":{if(!this.container)break;this.subscriptions.add((0,Ae.fromEvent)(this.container.element,"click").subscribe(this.createClickListener(()=>e({action:t.action,controlId:this.control.id,controlType:this.control.type})),i=>{let o=new L(1,1,{message:"Error happened on control interaction",error:i});this.error$.next(o)}));break}default:break}})}removeListeners(){this.subscriptions.unsubscribe()}};var ce=(r,e)=>Object.prototype.toString.call(r)===`[object ${e}]`,ue=r=>ce(r,"Object"),It=r=>ce(r,"String"),xt=r=>ce(r,"Array"),Tt=r=>ce(r,"Number"),_n=r=>ce(r,"Function"),Bn=r=>ce(r,"Boolean"),lr=r=>Tt(r)&&!isNaN(r);var de=r=>ue(r)&&Object.keys(r).length===0,cr=r=>xt(r)&&!r.length;var Ue=(r,e)=>It(r)&&(e?r.trim():r).length;var ur="interactive-blink-anim-reference",q={common:ur,animation:`${ur}-animation`,disabled:`${ur}-disabled`},St=class{constructor(){this._RAFId=0;this._element=void 0}get element(){return this._element}create(){if(this._element)return;let e=document.createElement("div");e.classList.add(q.common,q.animation),this._element=e}restart(){this._element&&(this._element.classList.add(q.disabled),this.cleanupRAF(),this._RAFId=requestAnimationFrame(()=>{this._element&&(this._element.classList.remove(q.disabled),this.cleanupRAF())}))}cleanupRAF(){this._RAFId&&(cancelAnimationFrame(this._RAFId),this._RAFId=0)}destroy(){this.cleanupRAF(),this._element=void 0}};var pr="interactive-container",D={common:pr,hidden:`${pr}-hidden`,disabled:`${pr}-disabled`};var wt=(r,e)=>{if(r.type.trim().toLowerCase()==="area")return new hr(r,e)},hr=class extends le{constructor(e,t){super(e,t)}createView({parentElement:e,callbacks:t}){if(super.createContainerElement(t),!this.container)return;let n=document.createElement("button");n.type="button",n.classList.add(M.common,M.area),n.setAttribute("data-testid",he.AREA),Et({target:n,props:this.control.props,fallback:T(d({},_),{backgroundColor:"transparent"})}),we({target:n,layoutParams:this.control.layoutParams,fallback:_}),this.container.element.append(n),e.append(this.container.element),this.controlElement=n,this.updateShadowStyles(),this.registerEvents()}registerEvents(){var t;if(!this.featureIsEnabled("controlsExpectTimeBlinkAnimation"))return;let e=(t=this.container)==null?void 0:t.element.parentElement;!e||!this.controlElement||(this.subscriptions.add((0,me.fromEvent)(this.controlElement,"mouseleave").subscribe(()=>{if(e.classList.contains(D.disabled))return;let n=e.parentElement;if(n){let i=n.querySelector(`.${q.common}`);i&&this.syncBlinkAnimation(i)}},n=>this.onError("Error happened in mouseleave callback",n))),this.subscriptions.add((0,me.fromEvent)(this.controlElement,"mouseenter").subscribe(()=>{e.classList.contains(D.disabled)||this.onBlinkHovering()},n=>this.onError("Error happened in mouseenter callback",n))).add((0,me.fromEvent)(this.controlElement,"mouseleave").subscribe(()=>{this.controlElement&&(this.controlElement.style.animation="")},n=>this.onError("Error happened in mouseleave callback",n))))}disable(){this.controlElement&&this.controlElement.classList.add(M.disabled)}enable(){this.controlElement&&this.controlElement.classList.remove(M.disabled)}getElement(){return this.controlElement}updateShadowStyles(e){var t,n,i;if(!(!this.container||!this.controlElement))if(Bn(e)){let o=Math.min(this.controlElement.offsetWidth,this.controlElement.offsetHeight)+"px";$n({target:this.controlElement,props:this.control.props,fallback:_,isDark:e,baseDimension:o}),qe({target:this.controlElement,props:this.control.props,fallback:T(d({},_),{borderColor:e?_.shadowColorDark:_.shadowColorLight,borderAlpha:1,borderWidthRawValue:"0.1px",roundCornersRawValue:`calc(${this.container.dimensions.height} * ${(i=(n=(t=this.control.props)==null?void 0:t.shape)==null?void 0:n.roundCorners)!=null?i:_.roundCorners})`}),dependsOn:this.container.dimensions,useRawValues:!0})}else qe({target:this.controlElement,props:this.control.props,fallback:T(d({},_),{borderAlpha:0}),dependsOn:this.container.dimensions})}toggleBlinkAnimation(e){var t,n;(t=this.controlElement)==null||t.classList.toggle(M.blinkAnim,e),(n=this.controlElement)==null||n.classList.toggle(M.blinkAnimArea,e)}syncBlinkAnimation(e){this.controlElement&&(!this.controlElement.classList.contains(`${M.blinkAnimArea}`)||this.controlElement.classList.contains(M.selected)||this.controlElement.classList.contains(q.disabled)||(this.controlElement.classList.add(q.disabled),this.subscriptions.add((0,me.fromEvent)(e,"animationiteration").pipe((0,me.once)()).subscribe(()=>{this.controlElement&&this.controlElement.classList.remove(q.disabled)},t=>this.onError("Error happened in animationiteration callback",t)))))}onBlinkHovering(){if(!this.controlElement||!this.controlElement.classList.contains(`${M.blinkAnimArea}`)||this.controlElement.classList.contains(M.selected))return;let e=window.getComputedStyle(this.controlElement),t=e.getPropertyValue("--interactive-area-hover-opacity").trim();this.controlElement.style.opacity=e.opacity,this.controlElement.style.animation="none",requestAnimationFrame(()=>{this.controlElement&&(this.controlElement.style.opacity=t)})}onError(e="",t){let n=new L(1,1,{message:e,error:t,details:{id:this.control.id}});this.error$.next(n)}onProgress(){}onResize(){}};var fe=require("@vkontakte/videoplayer-shared/es2015");var At=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 Rt=(r,e)=>{if(r.type.trim().toLowerCase()==="button")return new dr(r,e)},dr=class extends le{constructor(e,t){super(e,t)}createView({parentElement:e,callbacks:t}){var s;if(super.createContainerElement(t),!this.container)return;let n=document.createElement("button");n.type="button",n.classList.add(M.common,M.button),n.setAttribute("data-testid",he.BUTTON),we({target:n,layoutParams:this.control.layoutParams,fallback:_}),Et({target:n,props:this.control.props,fallback:_}),qe({target:n,props:this.control.props,fallback:_,dependsOn:this.container.dimensions}),Ct({target:n,props:T(d({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let i=At(this.control.type.trim().toLowerCase()),o=(s=i.firstElementChild)!=null?s:i;gt({target:o,props:this.control.props,fallback:_,dependsOn:this.container.dimensions}),n.append(i),this.container.element.append(n),e.append(this.container.element),this.controlElement=n,this.registerEvents()}registerEvents(){var t;if(!this.featureIsEnabled("controlsExpectTimeBlinkAnimation"))return;let e=(t=this.container)==null?void 0:t.element.parentElement;!e||!this.controlElement||(this.subscriptions.add((0,fe.fromEvent)(this.controlElement,"mouseleave").subscribe(()=>{if(e.classList.contains(D.disabled))return;let n=e.parentElement;if(n){let i=n.querySelector(`.${q.common}`);i&&this.syncBlinkAnimation(i)}},n=>this.onError("Error happened in mouseleave callback",n))),this.subscriptions.add((0,fe.fromEvent)(this.controlElement,"mouseenter").subscribe(()=>{e.classList.contains(D.disabled)||this.onBlinkHovering()},n=>this.onError("Error happened in mouseenter callback",n))).add((0,fe.fromEvent)(this.controlElement,"mouseleave").subscribe(()=>{this.controlElement&&(this.controlElement.style.animation="")},n=>this.onError("Error happened in mouseleave callback",n))))}disable(){this.controlElement&&this.controlElement.classList.add(M.disabled)}enable(){this.controlElement&&this.controlElement.classList.remove(M.disabled)}getElement(){return this.controlElement}toggleBlinkAnimation(e){var t,n;(t=this.controlElement)==null||t.classList.toggle(M.blinkAnim,e),(n=this.controlElement)==null||n.classList.toggle(M.blinkAnimButton,e)}syncBlinkAnimation(e){this.controlElement&&(!this.controlElement.classList.contains(`${M.blinkAnimButton}`)||this.controlElement.classList.contains(M.selected)||this.controlElement.classList.contains(q.disabled)||(this.controlElement.classList.add(q.disabled),this.subscriptions.add((0,fe.fromEvent)(e,"animationiteration").pipe((0,fe.once)()).subscribe(()=>{this.controlElement&&this.controlElement.classList.remove(q.disabled)},t=>this.onError("Error happened in animationiteration callback",t)))))}onBlinkHovering(){if(!this.controlElement||!this.controlElement.classList.contains(`${M.blinkAnimButton}`)||this.controlElement.classList.contains(M.selected))return;let e=window.getComputedStyle(this.controlElement),t=e.getPropertyValue("--interactive-button-hover-opacity").trim();this.controlElement.style.opacity=e.opacity,this.controlElement.style.animation="none",requestAnimationFrame(()=>{this.controlElement&&(this.controlElement.style.opacity=t)})}onError(e="",t){let n=new L(1,1,{message:e,error:t,details:{id:this.control.id}});this.error$.next(n)}onProgress(){}onResize(){}updateShadowStyles(){}};var qn=(r,e)=>{if(r.type.trim().toLowerCase()==="text")return new mr(r,e)},mr=class extends le{constructor(e,t){super(e,t)}createView({parentElement:e,callbacks:t}){var s;if(super.createContainerElement(t),!this.container)return;let n=document.createElement("div");n.classList.add(M.common,M.text),n.setAttribute("data-testid",he.TEXT),we({target:n,layoutParams:this.control.layoutParams,fallback:_}),Ct({target:n,props:T(d({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let i=At(this.control.type.trim().toLowerCase()),o=(s=i.firstElementChild)!=null?s:i;gt({target:o,props:this.control.props,fallback:_,dependsOn:this.container.dimensions}),n.append(i),this.container.element.append(n),e.append(this.container.element),this.controlElement=n}getElement(){return this.controlElement}disable(){}enable(){}onProgress(){}onResize(){}updateShadowStyles(){}toggleBlinkAnimation(){}onError(){}};var Ot=(r,e,t)=>{if(r.type.trim().toLowerCase()==="choice")return new fr(r,e,t)},fr=class extends Se{constructor(t,n,i){super(t,i);this.containerElement=null;this.controlSubscriptions=new kt.Subscription;this.error$=new kt.Subject;this.rootElement=n,this.layout=new bt(this.container.layout),this.isRemoved=!1,this.isDisabled=!1,this.addControlFactory("button",Rt),this.addControlFactory("text",qn),this.addControlFactory("area",wt)}createView({eventCallback:t}){let n=document.createElement("div");return n.classList.add(D.common,D.disabled),requestAnimationFrame(()=>{n.classList.remove(D.disabled)}),this.layout.setContainerLayout(n),this.controls.forEach(i=>{i.createView({parentElement:n,callbacks:{setControlLayout:this.layout.setControlLayout}}),i.setEvents(t),this.controlSubscriptions.add(i.error$.subscribe(this.error$))}),this.rootElement.append(n),this.isRemoved=!1,this.containerElement=n,n}hide(){let t=this.getElement();t&&t.classList.add(D.hidden)}show(){let t=this.getElement();t&&t.classList.remove(D.hidden)}enable(){let t=this.getElement();t&&(t.classList.remove(D.disabled),this.controls.forEach(n=>n.enable()),this.isDisabled=!1)}disable(){let t=this.getElement();t&&(t.classList.add(D.disabled),this.controls.forEach(n=>n.disable()),this.isDisabled=!0)}removeView(){let t=this.getElement();t&&(this.controlSubscriptions.unsubscribe(),this.controls.forEach(n=>n.removeListeners()),t.remove(),this.isRemoved=!0,this.containerElement=null)}fakeRemove(){this.isRemoved||(this.isRemoved=!0)}getElement(){return this.containerElement}onProgress(t,n){n&&this.controls.forEach(i=>{i.onProgress(t)})}onResize(t){t&&this.controls.forEach(n=>{n.onResize()})}updateControlsShadowStyles(t){this.controls.forEach(n=>n.updateShadowStyles(t))}toggleBlinkAnimation(t){this.controls.forEach(n=>n.toggleBlinkAnimation(t))}};var Ya=Q(zr(),1),w=require("@vkontakte/videoplayer-shared/es2015"),Fe=require("@vkontakte/videoplayer-statistics/es2015");var Ko=require("@vkontakte/videoplayer-shared/es2015");function rt(r,e){let t;return(...n)=>{clearTimeout(t),t=setTimeout(()=>r(...n),e)}}var Go="video_interactive",zo="videoint";var Wo=250,nt=class{constructor(e){this.handleZoomChange=rt(e=>{this.lastZoomInfo=e},Wo);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,void 0,{isFromCenter:!0})),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,"Chapter 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,!Tt(e.graph.edit.chapters[0].x)){(n=this.onError)==null||n.call(this,"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:o=[]}){this.isReady=!1,this.isHidden=!0,this.manifest=null,this.visitedChapterIds=new Set(o),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=Tu(e),this.resizeObserver=new ResizeObserver(rt(this.onResize,Wo)),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 O(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 O(this,null,function*(){var n;if(!this.manifest)return;let e;try{e=yield(0,Ko.loadVKLangPack)(this.lang,Go,zo)}catch(i){(n=this.onError)==null||n.call(this,"Unable to load graph language pack")}let{GraphEditor:t}=yield import("@interactiveplatform/movika-graph-editor");this.ngEditor=new t(this.graphWrapperElement,{mode:"view",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",s=>{var l=s,{name:i}=l,o=ee(l,["name"]);var a;i==="openPreview"&&"chapterId"in o&&((a=this.onOpenPreviewClick)==null||a.call(this,o.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 Tu(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 it=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 o of this._containers){let s=o.startTime-e;if(s<=i&&(o.endTime&&i<=o.endTime||o.endTime===null)){n=!0;break}i<s&&(t=t===-1?s:Math.min(t,s))}return!n&&t!==-1?t:null}}};var E=require("@interactiveplatform/movika-manifest");var Qo={metadata:"Object",chapters:"Array"},Wr=r=>{if(!ue(r))return!1;for(let e in Qo)if(!r[e]||!ce(r[e],Qo[e]))return!1;return(0,E.isSupportedManifest)(r.metadata.version)},ot=r=>r.type===E.ControlTypes.Text,Su=r=>r.type===E.ControlTypes.Button,wu=r=>r.type===E.ControlTypes.Area,Au={Choice:"Choice",TextInput:"TextInput"},Ru={Button:"Button",Area:"Area",Text:"Text"},ku={onClick:"onClick",onSuspense:"onSuspense"},Kr={openURI:"openURI",setNextBranch:"setNextBranch",setWeightlessRandomBranch:"setWeightlessRandomBranch",setRandomBranch:"setRandomBranch",setMaxWeightBranch:"setMaxWeightBranch",setMinWeightBranch:"setMinWeightBranch",setDefaultBranch:"setDefaultBranch",continuePlayback:"continuePlayback",expect:"expect"};var Bt=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 qt=class{constructor(e){this.fns=[];this.addFn=(e,t=!1)=>{_n(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=[]}};var hs=require("@vkontakte/videoplayer-shared/es2015");var Dt=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 O(this,null,function*(){return Ou(...this.loaders[e])(t)})}};function Ou(...r){return function(t){return O(this,null,function*(){let n=[...r];for(;n.length>0;)t=yield n.shift()(t);return t})}}function st(r,e,t){return r?T(d({},r),{[e]:r[e]?[t,...r[e]]:[t]}):{[e]:[t]}}function Ht(i){var o=i,{actions:r,errors:e,chapterId:t}=o,n=ee(o,["actions","errors","chapterId"]);if(t){let s=r.getManifest();if(s){let l=r.getChapter(s.chapters,t);if(l){let a=r.getMedia(s.media,l.videoId),c=r.getGraph(s.graph,l.id);return a?T(d({},n),{actions:r,errors:e,result:{chapter:l,media:a,graph:c}}):T(d({},n),{errors:st(e,Ht.name,"Could not find media"),actions:r})}}}return T(d({},n),{errors:st(e,Ht.name,"Could not find chapter"),actions:r})}var Ut=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,o=n.length;i<o;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,o=n.length;i<o;i++){let s=n[i];try{s.callback.call(this,e)}catch(l){Promise.resolve().then(()=>{throw l})}s.options&&s.options.once&&this.removeEventListener(e.type,s.callback)}return!e.defaultPrevented}},Me=class extends Ut{constructor(){super(),this.listeners||Ut.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)}},at=class{constructor(){Object.defineProperty(this,"signal",{value:new Me,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&&(at.prototype[Symbol.toStringTag]="AbortController",Me.prototype[Symbol.toStringTag]="AbortSignal");function Gt(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 Qr(r){typeof r=="function"&&(r={fetch:r});let{fetch:e,Request:t=e.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=r;if(!Gt({fetch:e,Request:t,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i}))return{fetch:e,Request:o};let o=t;(o&&!o.prototype.hasOwnProperty("signal")||i)&&(o=function(c,f){let v;f&&f.signal&&(v=f.signal,delete f.signal);let y=new t(c,f);return v&&Object.defineProperty(y,"signal",{writable:!1,enumerable:!1,configurable:!0,value:v}),y},o.prototype=t.prototype);let s=e;return{fetch:(a,c)=>{let f=o&&o.prototype.isPrototypeOf(a)?a.signal:c?c.signal:void 0;if(f){let v;try{v=new DOMException("Aborted","AbortError")}catch(g){v=new Error("Aborted"),v.name="AbortError"}if(f.aborted)return Promise.reject(v);let y=new Promise((g,R)=>{f.addEventListener("abort",()=>R(v),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([y,s(a,c)])}return s(a,c)},Request:o}}var Pu=()=>"fetch"in window,lt=Pu()&&Gt({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),Xo=lt?Qr({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,Xr=lt?Xo.fetch:window.fetch,xf=lt?Xo.Request:window.Request,Tf=lt?at:window.AbortController,Sf=lt?Me:window.AbortSignal;var zt=(r="",e="")=>{let t=r.split("."),n=e.split("."),i=0;for(let o=0;o<Math.max(t.length,n.length)&&!i;o++)t[o]>n[o]?i=1:t[o]<n[o]?i=-1:i=0;return i};var Vu=r=>O(void 0,null,function*(){try{let e={},t;if(It(r)){t=new URL(r).href;let i=yield Xr(t);if(!i.ok)return{};e=yield i.json()}else if(ue(r))e=r;else return{};if(!Wr(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 o=yield Xr(i);if(!o.ok)throw new Error;e.metadata.media=yield o.json()}catch(i){return Lu(e.metadata.version)?{manifest:e}:{}}return{manifest:e,manifestURL:t}}catch(e){return{}}});function Yo(r){return O(this,null,function*(){let{manifest:e,manifestURL:t}=yield Vu(r);if(!e)throw new Error("Failed on fetch");let n=(0,E.migrateManifestToLatestVersion)(e);return n.media=Mu(n.media,t),delete n.metadata.media,n})}function Wt(r,e){if(e)return r.find(t=>t.id===e)}function Yr(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 Zr(r,e){return r.videos.find(t=>t.id===e)}function Mu(r,e){return T(d({},r),{videos:r.videos.map(t=>T(d({},t),{variants:t.variants.map(n=>{let i="url"in n?n.url:"",o=Nu(i,e);return T(d({},n),{url:o||i})})}))})}function Nu(r="",e){try{return new URL(r,e).href}catch(t){return""}}function Lu(r){return zt(r,"3.2.0")>=0}var ls=Q(ct(),1);var Kt=r=>xt(r)&&!cr(r),Z=r=>r.order==="end",ut=r=>xt(r.containers)&&!cr(r.containers)&&Z(r),cs=(r,e)=>{var n;let t=r*1e3;return Kt(e.controls)&&t<((n=e.startTime)!=null?n:0)},en=(r,e)=>{var n,i;let t=r*1e3;return Kt(e.controls)&&t>=((n=e.startTime)!=null?n:0)&&t<=((i=e.endTime)!=null?i:1/0)};var ye=(r=[])=>r.some(e=>e.action.type==="expect"),tn=(r=[])=>r.find(e=>e.action.type==="expect"),Xu=r=>(r==null?void 0:r.length)===1,be=r=>Xu(r)&&ot(r[0]);function us(r=[],e=1/0,t=[]){return r.filter(({container:n})=>!(0,ls.default)(t,n.container.id)&&ye(n.container.events)&&n.container.endTime===e&&!n.isRemoved)}function Qt({gameControllers:r=[],subjectName:e,subjectId:t,execFn:n}){for(let i of r)if(e==="container"&&i.container.container.id===t){n(i),us(r,i.container.container.endTime,[i.container.container.id]).forEach(s=>{n(s)});break}}var ps=(r,e)=>{let t=I=>{let m=e.find(({container:u})=>u.container.id===I);return m==null?void 0:m.container.isRemoved},n=ye(r.events)&&!t(r.id),i=(I,m=!1,u=!1)=>{let p=u?"every":"some";return I.controls[p](b=>{var A;let x=m?I.endTime===r.endTime:!0;return((A=b.events)==null?void 0:A[p](C=>{var S;return((S=C.action)==null?void 0:S.type)===Kr.openURI}))&&x})},o=I=>I.some(({container:m})=>i(m.container,!0,!1)&&!m.isRemoved),s=I=>I.every(({container:m})=>m.isRemoved?!0:i(m.container,!0,!0)),l=us(e,r.endTime,[r.id]).length,a=I=>I.controls.some(m=>{var u;return(u=m.events)==null?void 0:u.some(p=>{var b,x;return(x=(b=p.action)==null?void 0:b.args)==null?void 0:x.shouldOpenNow})}),c=n||l>0,f=o(e),v=i(r),y=s(e),g=n?!1:l>0,R=a(r);return{isExpectTime:c,hasOtherExpect:l>0,hasOpenURIEvent:f,hasOpenURIEventInCurrentContainer:v,isAllOpenURIEventsValid:y,isExpectEventForCurrentContainer:g,hasShouldOpenNowEvent:R}};var Ce=class extends Dt{constructor(t,n){super(t);this.manifest=null;this.chapter=null;this.media=null;this.graph=null;this.prevChapter$=new hs.ValueSubject(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 O(this,null,function*(){var i;this.release();let n=yield this.exec("manifestLoaders",{actions:{addErrorMessage:st},result:null,errors:null,source:t});return n.errors&&this.errorHandler(n.errors),this.manifest=yield Yo((i=n.result)!=null?i:t),this})}setInitial(){return O(this,null,function*(){return this.setNext()})}setNext(){return O(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",Ht({actions:{getManifest:()=>this.manifest,getCurrent:this.getCurrent,getGraph:Yr,getChapter:Wt,getMedia:Zr,getByBranches:this.getByBranches.bind(this),addErrorMessage:st},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=Wt(this.manifest.chapters,t);if(i){let o=Zr(this.manifest.media,i.videoId),s=Yr(this.manifest.graph,i.id);if(o)return{chapter:i,media:o,graph:s}}return null}getBranches(t=(n=>(n=this.chapter)==null?void 0:n.id)()){var i,o,s;if(t===((i=this.chapter)==null?void 0:i.id))return this.getByBranches((o=this.chapter)==null?void 0:o.branches);{let l=Wt(((s=this.manifest)==null?void 0:s.chapters)||[],t);return this.getByBranches(l==null?void 0:l.branches)}}getByBranches(t=[]){return t.reduce((n,i)=>{let o=this.getByChapterId(i.chapterId);return o&&n.push(o),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?Z(this.chapter):!1}};var Us=Q(Xt(),1),Gs=require("@vkontakte/videoplayer-core/es2015"),pe=require("@vkontakte/videoplayer-shared/es2015");var Ds=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 Hs=Q(Xt(),1);function on(){let r=new Map;function e(a){var c=a,{listId:o=Math.random().toString(),itemId:s=Math.random().toString()}=c,l=ee(c,["listId","itemId"]);let f=r.get(o),v=d({},l);return f?f[s]=v:r.set(o,{[s]:v}),d({listId:o,itemId:s},l)}function t(o){var s,l;o.player.destroy(),o.container.remove(),o.subscription.unsubscribe(),(s=o.statistics)==null||s.oneStat.destroy(),(l=o.statistics)==null||l.statSubscription.unsubscribe()}function n(o,s){let l=r.get(o);if(!l)throw Error("Can't remove. Not find.");if(s){let a=l[s];a&&t(a),delete l[s],Object.keys(l).length||r.delete(o)}else{for(let a of(0,Hs.default)(l))t(a);r.delete(o)}}function i(){for(let o of r)n(o[0])}return{createPlayer:e,removePlayer:n,map:r,removeAll:i}}var Ne=Q(ct(),1);function sn(r,e=[]){var o,s,l;let t={},n,i=!e.length;for(let a of r.variants)if(!n&&"cover"in a&&(n=a.cover),"url"in a)switch(a.type.toLowerCase()){case"mp4":(i||(0,Ne.default)(e,"mp4"))&&(t.MPEG=T(d({},t.MPEG),{[(o=a.standard)!=null?o:"Invariant quality"]:a.url}));break;case"mpeg":(i||(0,Ne.default)(e,"mpeg"))&&(t.MPEG=T(d({},t.MPEG),{[(s=a.standard)!=null?s:"Invariant quality"]:a.url}));break;case"hls":(i||(0,Ne.default)(e,"hls"))&&(t=T(d({},t),{HLS:{type:"url",url:a.url}}));break;case"dash":(i||(0,Ne.default)(e,"dash"))&&(t=T(d({},t),{DASH_SEP:{compatibilityMode:!0,type:"url",url:a.url}}));break;default:break}return{sources:t,thumbUrl:n,title:(l=r.title)!=null?l:""}}var pt=(r,e)=>{let t=r.info.currentQuality$.getValue(),n=r.info.availableQualities$.getValue();t!==e&&(0,Ne.default)(n,e)&&(r.setQuality(e),r.setAutoQuality(!1))};var Tp=2;function an(r){let e=on(),t=new pe.Subscription,n={},i=null,o=!1,s,l=new pe.ValueSubject(null);r&&a(r);function a(m){i=m}function c(m,u,p){var A;if(!i)throw Error("need to set interactive controller");if(!i.options)return;let x=((A=e.map.get(m))!=null?A:{})[u];if(x){n=d({chapterId:p,listId:m,itemId:u},x);let C=n.player;n.subscription.add(C.info.currentQuality$.subscribe(S=>{let H=C.info.position$.getValue(),V=C.info.isAutoQualityEnabled$.getValue();if(!(!S||!H||V))for(let $ of e.map)(0,Us.default)($[1]).forEach(({player:N})=>{pt(N,S)})})).add(C.events.started$.subscribe(()=>{f(u)})),x.container.remove(),i.setPlayer(x.player),o||(i.init(),o=!0),l.next({player:n.player,config:n.config,statistics:n.statistics});return}throw Error("Can't set. Not find.")}function f(m){return O(this,null,function*(){if(!i)throw Error("need to set interactive controller");if(de(n)||m!==n.itemId)return;let u=i.getChapterBranches(),p=new Set;for(let b of u)p.has(b.media.id)||(yield y({media:b.media,chapterId:b.chapter.id,setAsActive:!1,title:b.chapter.label}),p.add(b.media.id))})}function v(p){return O(this,arguments,function*({chapter:{id:m},manifestVideo:u}){if(de(n)||!i)return;let b=n.player.info.muted$.getValue(),x=n.player.info.currentQuality$.getValue(),A=n.player.info.isAutoQualityEnabled$.getValue(),C=n.player.info.volume$.getValue(),S=n.player.info.currentPlaybackRate$.getValue(),H=!A,V=!1;for(let $ of e.map)if($[0]===u.id&&!i.state.isReplay$.getValue()){let N=Object.keys($[1]);for(let B of N)B===n.itemId?(N.length<Tp||(V=!0),e.removePlayer($[0],B)):(V=!0,c($[0],B,m),H?pt(n.player,x):n.player.setAutoQuality(!0),n.player.setVolume(C),n.player.setMuted(b),n.player.setPlaybackRate(S))}else e.removePlayer($[0]);V||(yield y({media:u,chapterId:m,setAsActive:!0,playbackRate:S}),H?pt(n.player,x):n.player.setAutoQuality(!0),n.player.setVolume(C),n.player.setMuted(b))})}function y(H){return O(this,arguments,function*({media:m,chapterId:u,prefetch:p=!0,setAsActive:b=!0,autoplay:x=!1,preferredExt:A,title:C,playbackRate:S}){var Cn,gn,En,In,xn;let V=Math.random().toString(),$=document.createElement("div");s.append($);let N;if((Cn=i==null?void 0:i.options)!=null&&Cn.vkVideoLoader){let vt=Ds(m);vt.length&&(N=yield i.options.vkVideoLoader(...vt))}let B=((gn=i==null?void 0:i.options)==null?void 0:gn.coreConfig)||void 0,xe=T(d({},B),{configName:[...(En=B==null?void 0:B.configName)!=null?En:[],"interactive"]}),ie=T(d({container:$},((In=N==null?void 0:N.videos)==null?void 0:In[0])||{sources:sn(m,A).sources}),{title:C,failoverHosts:(N==null?void 0:N.failoverHosts)||[]}),J=new Gs.Player(xe,pe.Tracer.createRootTracer());J.initVideo(ie);let yn=null;if(N!=null&&N.videos&&(i!=null&&i.options.createOneStat)){let vt=N.videos[0],ir=i.options.createOneStat(vt),Tn=new pe.Subscription;ir&&(Tn.add(ir.attachTo(J)),yn={oneStat:ir,statSubscription:Tn})}let bn=new pe.Subscription,el=(xn=n==null?void 0:n.player)==null?void 0:xn.info.isAutoQualityEnabled$.getValue();bn.add(J.events.canplay$.subscribe(function(){el||pt(J,n.player.info.currentQuality$.getValue()),S&&J.setPlaybackRate(S)}));let Te=e.createPlayer({listId:m.id,itemId:V,player:J,container:$,sources:sn(m,A).sources,config:ie,subscription:bn,statistics:yn});return b&&c(m.id,Te.itemId,u),x&&Te.player.play(),p&&!x&&Te.player.prepare(),{player:Te.player,config:Te.config,statistics:Te.statistics}})}function g(){R(),i=null,s.remove()}function R(){t.unsubscribe(),e.removeAll(),n={},o=!1}function I(){return O(this,null,function*(){if(!i)throw Error("need to set interactive controller");R(),s=document.createElement("div");let{media:m,chapter:u}=i.getCurrentChapter();m&&u?(t.add(i.events.chapterChanged$.subscribe(v)),yield y({media:m,chapterId:u.id,title:u.label})):console.error("not found")})}return T(d({},e),{init:I,setInteractiveController:a,createPlayer:y,removeAll:g,getActivePlayer:function(){return n},activePlayerChanged:l})}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"},Le={visibility:"visibility",watchAgainClicked:"watchAgainClicked"},j={actionChoiceCanceled:"action-choice-canceled",actionChoice:"action-choice",actionExecution:"action-execution",visibility:"visibility",containerRemoved:"container-removed",rangeEnded:"range-ended"};var Ws=Q(ct(),1),Ks=require("@vkontakte/videoplayer-shared/es2015");function ln(r){return function(...t){return r(...t.reverse())}}function ht(r,...e){return(...t)=>ue(e[0])&&ue(t[0])?r(d(d({},e[0]),t[0])):r(...e,...t)}var Yt=class{constructor({player:e,container:t,branches:n,selectBranches:i,interactiveEvents:o,globalEvents:s,globalEventEmitter:l,getContainerEventState:a,permanentTextControls:c,interactiveTimeOpenUri:f,disabledControls$:v,onRemove:y,onError:g}){this.hide=()=>{setTimeout(()=>{var e,t;this.gameState!==4&&(ye(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,o;if(this.gameState!==2||this.isSelectedControlEvent)return;if(this.container.getElement()){let{hasOpenURIEventInCurrentContainer:s}=this.getContainerEventState();if((n=(t=this.container).show)==null||n.call(t),this.interactiveTimeOpenUri&&s)return;this.emitContainerVisibilityEvent(!0,!1)}else{let s={isDisabled:()=>this.container.isDisabled,branches:this.branches,containerId:this.container.container.id,onDetachContainer:()=>{this.removeView(),this.emitContainerVisibilityEvent(!1)},onEvent:(a,c)=>{let{isExpectTime:f,hasOtherExpect:v,hasOpenURIEvent:y,hasOpenURIEventInCurrentContainer:g,isAllOpenURIEventsValid:R,hasShouldOpenNowEvent:I}=this.getContainerEventState(),m=this.interactiveTimeOpenUri&&!g,u=this.interactiveTimeOpenUri&&g;if((!this.interactiveTimeOpenUri||m)&&(this.isSelectedControlEvent=!0),a!==!1){if(!this.selectBranches.state.isExpect&&(!this.interactiveTimeOpenUri||m)){if(this.interactiveTimeOpenUri){let p=!v&&!R&&g;p&&this.globalEvents.interactiveContainerFakeRemoved$.next({subjectId:this.container.container.id,subjectName:"container",type:"container-fake-removed",removeAllOpenURI:p})}this.removeView()}this.emitContainerVisibilityEvent(!1)}if(this.gameState===4||this.gameState===3||this.selectBranches.state.isExpect||this.interactiveTimeOpenUri&&y&&this.gameState!==5){if(u){let b=((x,A,C,S)=>!x&&!A&&C||x&&!A&&C&&!S||x&&!A&&C&&S)(f,v,R,this.isSelectedContainerEvent);this.fakeRemoveView(b)}else this.removeView(),this.emitContainerVisibilityEvent(!1);(!f||!v||!I)&&(this.selectBranches.stopExpect(),c())}},isEOV:()=>this.gameState===4},l=ht(this.selectBranches.onControlEvent,s);this.container.createView({eventCallback:l}),this.emitContainerVisibilityEvent(!0,!0),this.disabledControls$.getValue()&&((o=(i=this.container).disable)==null||o.call(i))}};this.onEndOfVideo=()=>{this.gameState=4,this.selectContainerEvent(!0)};this.whilePlaying=()=>{var c,f,v;let e=this.player.experimental.element$.getValue(),n=e instanceof HTMLVideoElement?e.readyState:void 0,i=[6,5];if(!n||(0,Ws.default)(i,this.gameState)&&!this.isPermanentText)return;let o=this.player.getExactTime();if(cs(o,this.container.container))this.gameState!==1&&(this.gameState=1,this.onBeforeStartTime());else if(en(o,this.container.container))this.gameState!==2&&(this.gameState=2,this.onStartTime());else if(this.gameState!==3){let y=this.gameState;this.gameState=3,y===2&&this.onEndTime()}else{let{hasOpenURIEventInCurrentContainer:y}=this.getContainerEventState(),g=this.selectBranches.state.isExpect,R=this.interactiveTimeOpenUri&&y;if(R&&!g){let I=this.container.getElement();I&&(I.style.visibility!=="hidden"&&((f=(c=this.container).hide)==null||f.call(c)),this.container.isRemoved||this.fakeRemoveView())}!this.isPermanentText&&!R&&this.removeView()}let s=en(o,this.container.container),l=this.container.container.startTime?[this.container.container.startTime,(v=this.container.container.endTime)!=null?v:1/0]:[],a={subjectId:this.container.container.id,subjectName:"container",range:l,currentTime:o,isInteractiveTime:s};this.container.onProgress(o*1e3,s),this.globalEventEmitter.emit(P.eachTick,a),this.globalEvents.eachTick$.next(a)};this.container=t,this.branches=n,this.selectBranches=i,this.subscription=new Ks.Subscription,this.player=e,this.interactiveEvents=o,this.getContainerEventState=a,this.isPermanentText=c&&be(t.container.controls),this.interactiveTimeOpenUri=f,this.disabledControls$=v,this.onRemove=y,this.globalEventEmitter=l,this.gameState=0,this.globalEvents=s,this.onError=g,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,o;e?(n=(t=this.container).disable)==null||n.call(t):(o=(i=this.container).enable)==null||o.call(i)})),this.subscription.add(this.container.error$.subscribe(this.onError))}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.container.isRemoved&&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:ye(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)}onResize(e){this.container.onResize(e)}reset(){this.isSelectedControlEvent=!1,this.isSelectedContainerEvent=!1,this.gameState=1}removeView(){var e;this.container.removeView(),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,(e=this.onRemove)==null||e.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()}updateControlsShadowStyles(e){this.container.updateControlsShadowStyles(e)}toggleBlinkAnimation(e){this.container.toggleBlinkAnimation(e)}destroy(){var e;this.reset(),this.removeView(),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 Qs=(r=[])=>r.reduce((e,t,n)=>{var o,s,l;let i=((o=t==null?void 0:t.controls)!=null?o:[]).filter(a=>!ot(a));if(Kt(i)){let a=[(s=t.startTime)!=null?s:0,(l=t.endTime)!=null?l:1/0],c={id:t.id,isRemoved:!1};if(!n)e.push({subjects:[c],range:a});else{let f=[],v=-1/0,y=1/0,g=[],R=[];for(let I=0;I<e.length;I++){let m=e[I];if(R.push(...m.subjects),m.range[0]<y&&(y=m.range[0]),m.range[1]>v&&(v=m.range[1]),a[0]>=m.range[0]&&a[1]<=m.range[1])return e[I].subjects.push(c),e;a[0]<m.range[0]&&a[1]>m.range[0]&&(f.push(I),g=g.concat(m.subjects)),a[0]>=m.range[0]&&a[0]<=m.range[1]&&(f.push(I),g=g.concat(m.subjects),a[0]=m.range[0]),a[1]>=m.range[0]&&a[1]<=m.range[1]&&(f.push(I),g=g.concat(m.subjects),a[1]=m.range[1])}if(R.push(c),a[0]<=y&&a[1]>=v)return[{subjects:R,range:a}];f.length&&f.reverse().forEach(I=>{e.splice(I,1)}),e.push({subjects:g.concat([c]),range:a})}}return e},[]).sort((e,t)=>e.range[0]-t.range[0]);var Oa=Q(ct(),1),hn=Q(Xt(),1),Pa=Q(Ra(),1);function ka(){let r={};function e(){for(let l in r)Object.prototype.hasOwnProperty.call(r,l)&&delete r[l]}function t(l){let a={};for(let c in r)+c<=l&&(a[c]=r[c]);return a}function n(l){let a={};for(let c in r)+c>=l&&(a[c]=r[c]);return a}function i({timestamp:l,priority:a,initiator:c}){var f;if(lr(l)){let v=(f=r[l])!=null?f:null;if(v&&a&&Ue(a,!0)){let y={},g=v[a];if(g&&(y=d(d({},y),g)),y=de(y)?null:y,y&&Ue(c,!0)){let R=y[c];return R!=null?R:null}return y}return v}return null}function o({timestamp:l,priority:a,initiator:c}){if(lr(l))if(r[l]){if(a&&Ue(a,!0))if(r[l][a]){if(c&&Ue(c,!0))if(r[l][a][c]){if(delete r[l][a][c],!de(r[l][a]))return!0}else return!1;if(delete r[l][a],!de(r[l]))return!0}else return!1;return delete r[l]}else return!1;return!1}function s(v){var y=v,{timestamp:l,priority:a,initiator:c}=y,f=ee(y,["timestamp","priority","initiator"]);var g,R,I;(R=(g=r[l])==null?void 0:g[a])!=null&&R[c]?r[l][a][c].push(d({},f)):(I=r[l])!=null&&I[a]?r[l][a]=T(d({},r[l][a]),{[c]:[d({},f)]}):r[l]?r[l]=T(d({},r[l]),{[a]:{[c]:[d({},f)]}}):r[l]={[a]:{[c]:[d({},f)]}}}return{map:r,remove:o,add:s,removeAll:e,get:i,getLte:t,getGte:n}}var hh=[E.EventActionTypes.expect,E.EventActionTypes.setNextBranch],dh=1/0;function Va(r,e){let t=r,n,i=mh(e),o=ka(),s,l=()=>{g(),u()},a=p=>{o.add.call(void 0,p),R()},c=(p=[])=>{for(let b of p)if(b.action(),(0,Oa.default)(hh,b.actionType))break},f=(p=1/0)=>{var C,S,H;let b=Jt((C=o.get({timestamp:p,priority:"control"}))!=null?C:{}),x=Jt((S=o.get({timestamp:p,priority:"container"}))!=null?S:{}),A=Jt((H=o.get({timestamp:p,priority:"chapter"}))!=null?H:{});return[...b,...x,...A]},v=p=>{i.isReady(p)&&c(f(p))},y=()=>{var p;c([...Jt((p=o.get({timestamp:1/0,priority:"chapter"}))!=null?p:{})])},g=()=>{n&&(s==null||s.unsubscribe(),n=void 0)},R=()=>{n||(n=()=>setTimeout(()=>{v(1/0)}),s=t.events.ended$.subscribe(n))},I=p=>{g(),t=p},m=p=>{p.priority==="container"&&i.resetCalled(p.timestamp),o.remove(p)},u=()=>{i.release(),o.removeAll()};return{setPlayer:I,add:a,remove:m,exec:v,execEndOfVideo:y,listen:R,unlisten:g,release:l,containersEventsCallState:i,getPreparedToExecActions:f}}function mh(r){let e=new Map;return{setCalled:({timestamp:l,id:a})=>{let c=e.get(l);c&&c[a]!==void 0&&(c[a]=!0)},setData:(l=[])=>{var a;for(let c of l){let f=(a=c.endTime)!=null?a:dh,v=e.get(f);e.set(f,T(d({},v),{[c.id]:!1}))}},resetCalled:l=>{let a=e.get(l);if(a)for(let c in a)a[c]=!1},isReady:l=>{let a=e.get(l);if(!a)return!0;let c=(0,hn.default)(a);return r?c.some(v=>v):!c.some(v=>!v)},release:()=>e.clear()}}function Jt(r){return(0,Pa.default)((0,hn.default)(r)).sort(e=>e.actionType===E.EventActionTypes.expect?-1:1)}var Ma={videoContentHeight:0,videoContentWidth:0},Na=r=>{let{height:e,width:t}=r.info.intrinsicVideoSize$.getValue()||{};if(!(e&&t))return Ma;let{clientHeight:n,clientWidth:i}=r.experimental.element$.getValue()||{};if(!(n&&i))return Ma;let o=e/t,s=n/i,l,a;return s>o?(a=i,l=i*o):s<o?(a=n/o,l=n):(a=i,l=n),{videoContentWidth:a,videoContentHeight:l}};var fh=250;function La(r){let e,t=new ResizeObserver(l=>{o(l),e=o.bind(null,l)});function n(l){let{parentElement:a,player:c}=r();if(a&&c){let{videoContentWidth:f,videoContentHeight:v}=Na(c);a.style.setProperty("--interactive-content-width",`${f}px`),a.style.setProperty("--interactive-content-height",`${v}px`),a.style.setProperty("--interactive-width",`${l[0].contentRect.width}px`),a.style.setProperty("--interactive-height",`${l[0].contentRect.height}px`)}}function i(){let{parentElement:l}=r();l.removeAttribute("style")}let o=rt(l=>{let{fns:a=[]}=r();n(l);for(let c of a)c()},fh);function s(){e=void 0,t.disconnect(),i()}return{resizeObserver:t,calc:()=>{e==null||e()},release:s}}var vh=r=>Math.floor(Math.random()*r),$a=r=>{var i;let e=r.length,t=1/0,n=null;for(;e--;){let o=r[e],s=(i=o.weight)!=null?i:1;s<t&&(t=s,n=o)}return n},Fa=r=>{var i;let e=r.length,t=-1/0,n=null;for(;e--;){let o=r[e],s=(i=o.weight)!=null?i:0;s>t&&(t=s,n=o)}return n};var _a=r=>{let e=r.length,t=vh(e);return r[t]},ja=1,Ba=r=>{var n,i;let e=0;for(let o=0;o<r.length;++o)e+=(n=r[o].weight)!=null?n:ja;let t=Math.random()*e;e=0;for(let o=0;o<r.length-1;++o)if(e+=(i=r[o].weight)!=null?i:ja,e>=t)return r[o];return r[r.length-1]};var qa={shouldOpenNow:!0,isDetachContainer:!0},Da="after-expect",dn=(r,e=!1)=>T(d({},r),{args:e?d(d({},r.args),qa):d(d({},qa),r.args)}),Ha=({globalEventEmitter:r,globalEvents:e,player:t,interactiveEvents:n})=>{let i={isExpect:!1},o=()=>{i.isExpect&&(i.isExpect=!1)},s=({action:u,controlType:p,controlId:b,containerId:x,branches:A=[],onEvent:C,isEOV:S=()=>!1,isDisabled:H=()=>!1})=>{let V=dn(u,S()),$={timestamp:1/0,priority:"control",initiator:b,actionType:V.type},N=H(),B=r.emit.bind(r,P.interactives,{subjectId:b,subjectType:p,subjectName:"control",type:N?j.actionChoiceCanceled:j.actionChoice,actionType:u.type,payload:d({invokeImmediately:V.args.shouldOpenNow,containerId:x},V.args)}),xe=()=>{e.interactiveActionChoice$.next({subjectId:b,subjectType:p,subjectName:"control",type:N?"action-choice-canceled":"action-choice",actionType:u.type,payload:d({invokeImmediately:V.args.shouldOpenNow,containerId:x},V.args)})};if(N){B(),xe();return}switch(V.type.trim().toLowerCase()){case E.EventActionTypes.setNextBranch.trim().toLowerCase():{let ie=A.find(J=>J.id===V.args.branchId);if(!ie)return;C(V.args.isDetachContainer,g.bind(null,{subjectId:b,subjectName:"control"})),B(),xe(),V.args.shouldOpenNow?I({subjectId:b,subjectName:"control",subjectType:p,action:V,payload:{chapterId:ie.chapterId,autoSelect:!1}}):n.add(T(d({},$),{action:I.bind(null,{subjectId:b,subjectName:"control",subjectType:p,action:V,payload:{chapterId:ie.chapterId,autoSelect:!1}})}));return}case E.EventActionTypes.continuePlayback.trim().toLowerCase():{C(V.args.isDetachContainer,g.bind(null,{subjectId:b,subjectName:"control"})),B(),xe(),V.args.shouldOpenNow?R({subjectId:b,subjectName:"control",subjectType:p,action:u}):n.add(T(d({},$),{action:R.bind(null,{subjectId:b,subjectName:"control",subjectType:p,action:u})}));return}case E.EventActionTypes.openURI.trim().toLowerCase():{C(V.args.isDetachContainer,g.bind(null,{subjectId:b,subjectName:"control"})),B(),xe(),V.args.shouldOpenNow?m({subjectId:b,subjectName:"control",subjectType:p,action:V,payload:{URI:u.args.uri}}):n.add(T(d({},$),{action:m.bind(null,{subjectId:b,subjectName:"control",subjectType:p,action:V,payload:{URI:u.args.uri}})}));return}default:{let ie="Unexpected control event",J=new L(1,1,{message:ie});f(J,ie);return}}},l=({action:u,container:{id:p,endTime:b},branches:x=[],isEOV:A=!1,autoSelected:C=!1})=>{let S=dn(u,A),H={timestamp:!S.args.shouldOpenNow||A?1/0:b!=null?b:1/0,priority:"container",initiator:p,actionType:S.type},V=r.emit.bind(r,P.interactives,{subjectId:p,subjectName:"container",type:j.actionChoice,actionType:S.type,payload:d({invokeImmediately:S.args.shouldOpenNow},S.args)}),$=()=>{e.interactiveActionChoice$.next({subjectId:p,subjectName:"container",type:"action-choice",actionType:S.type,payload:d({invokeImmediately:S.args.shouldOpenNow},S.args)})};switch(S.type.trim().toLowerCase()){case E.EventActionTypes.setNextBranch.trim().toLowerCase():{let N=x.find(B=>B.id===S.args.branchId);if(!N)return;V(),$(),n.add(T(d({},H),{action:I.bind(null,{subjectId:p,subjectName:"container",action:S,payload:{chapterId:N.chapterId,autoSelect:C}})}));return}case E.EventActionTypes.setMaxWeightBranch.trim().toLowerCase():return;case E.EventActionTypes.setMinWeightBranch.trim().toLowerCase():return;case E.EventActionTypes.setRandomBranch.trim().toLowerCase():return;case E.EventActionTypes.setWeightlessRandomBranch.trim().toLowerCase():return;case E.EventActionTypes.continuePlayback.trim().toLowerCase():{V(),$(),n.add(T(d({},H),{action:R.bind(null,{subjectId:p,subjectName:"container",action:S})}));return}case E.EventActionTypes.openURI.trim().toLowerCase():{V(),$(),n.add(T(d({},H),{action:m.bind(null,{subjectId:p,subjectName:"container",action:S,payload:{URI:u.args.uri}})}));return}default:{let N="Unexpected container event",B=new L(1,1,{message:N});f(B,N);return}}};function a({container:u,branches:p,isEOV:b=!1}){var A,C;let x=tn(u.events);if(x){let S=dn(x.action,b);r.emit(P.interactives,{subjectId:u.id,subjectName:"container",type:j.actionChoice,actionType:S.type,payload:d({invokeImmediately:S.args.shouldOpenNow},S.args)}),e.interactiveActionChoice$.next({subjectId:u.id,subjectName:"container",type:"action-choice",actionType:S.type,payload:d({invokeImmediately:S.args.shouldOpenNow},S.args)}),n.add({timestamp:b?1/0:(A=u.endTime)!=null?A:1/0,priority:"container",initiator:u.id,actionType:E.EventActionTypes.expect,action:y.bind(null,{subjectId:u.id,subjectName:"container"})}),i.isExpect=!0}else for(let S of(C=u.events)!=null?C:[])l({action:S.action,container:u,branches:p,isEOV:b})}let c=({chapterId:u,action:p,branches:b=[]})=>{let x=r.emit.bind(r,P.interactives,{subjectId:u,subjectName:"chapter",type:j.actionChoice,actionType:p.type,payload:p.args}),A=()=>{e.interactiveActionChoice$.next({subjectId:u,subjectName:"chapter",type:"action-choice",actionType:p.type,payload:p.args})};switch(p.type.trim().toLowerCase()){case E.EventActionTypes.setNextBranch.trim().toLowerCase():{let C=b.find(S=>S.id===p.args.branchId);return C!=null&&C.chapterId?(x(),A(),I.bind(null,{subjectId:u,subjectName:"chapter",action:p,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case E.EventActionTypes.setWeightlessRandomBranch.trim().toLowerCase():{let C=_a(b);return C!=null&&C.chapterId?(x(),A(),I.bind(null,{subjectId:u,subjectName:"chapter",action:p,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case E.EventActionTypes.setRandomBranch.trim().toLowerCase():{let C=Ba(b);return C!=null&&C.chapterId?(x(),A(),I.bind(null,{subjectId:u,subjectName:"chapter",action:p,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case E.EventActionTypes.setMaxWeightBranch.trim().toLowerCase():{let C=Fa(b);return C!=null&&C.chapterId?(x(),A(),I.bind(null,{subjectId:u,subjectName:"chapter",action:p,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case E.EventActionTypes.setMinWeightBranch.trim().toLowerCase():{let C=$a(b);return C!=null&&C.chapterId?(x(),A(),I.bind(null,{subjectId:u,subjectName:"chapter",action:p,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case E.EventActionTypes.continuePlayback.trim().toLowerCase():return x(),A(),R.bind(null,{subjectId:u,subjectName:"chapter",action:p});case E.EventActionTypes.openURI.trim().toLowerCase():return x(),A(),m.bind(null,{subjectId:u,subjectName:"chapter",action:p,payload:{URI:p.args.uri}});default:{let C="Unexpected chapter event",S=new L(1,1,{message:C});f(S,C);return}}};function f(u,p){console.error(p),e.error$.next(u),r.emit(P.errors,u)}function v(u){var b;let p=tn(u.events);if(p){if(Z(u))return;r.emit(P.interactives,{subjectId:u.id,subjectName:"chapter",type:j.actionChoice,actionType:p.action.type,payload:p.action.args}),e.interactiveActionChoice$.next({subjectId:u.id,subjectName:"chapter",type:"action-choice",actionType:p.action.type,payload:p.action.args}),n.add({timestamp:1/0,priority:"chapter",initiator:u.id,actionType:E.EventActionTypes.expect,action:y.bind(null,{subjectId:u.id,subjectName:"chapter"})})}else(b=u.events)==null||b.forEach(x=>{let A=c({chapterId:u.id,action:x.action,branches:u.branches});A&&n.add({timestamp:1/0,priority:"chapter",initiator:u.id,actionType:x.action.type,action:A})})}let y=({subjectId:u,subjectName:p})=>{t.pause(),r.emit(P.interactives,{subjectId:u,subjectName:p,type:j.actionExecution,actionType:E.EventActionTypes.expect}),e.interactiveActionExecution$.next({subjectId:u,subjectName:p,type:"action-execution",actionType:E.EventActionTypes.expect})},g=({subjectId:u,subjectName:p})=>{t.info.isEnded$.getValue()?n.execEndOfVideo():t.play(),r.emit(P.interactives,{subjectId:u,subjectName:p,type:j.actionExecution,actionType:Da}),e.interactiveActionExecution$.next({subjectId:u,subjectName:p,type:"action-execution",actionType:Da})},R=({subjectId:u,subjectName:p,subjectType:b,action:x})=>{r.emit(P.interactives,{subjectId:u,subjectName:p,subjectType:b,type:j.actionExecution,actionType:x.type}),e.interactiveActionExecution$.next({subjectId:u,subjectName:p,subjectType:b,type:"action-execution",actionType:x.type})},I=({subjectId:u,subjectName:p,subjectType:b,action:x,payload:A})=>{A.behaviour="change-chapter",r.emit(P.interactives,{subjectId:u,subjectName:p,subjectType:b,type:j.actionExecution,actionType:x.type,payload:A}),e.interactiveActionExecution$.next({subjectId:u,subjectName:p,subjectType:b,type:"action-execution",actionType:x.type,payload:A})},m=({subjectId:u,subjectName:p,subjectType:b,action:x,payload:A})=>{if(!A.URI)return;let C=window.open(A.URI,"_blank","noopener,noreferrer");C&&(C.opener=null),r.emit(P.interactives,{subjectId:u,subjectName:p,subjectType:b,type:j.actionExecution,actionType:x.type}),e.interactiveActionExecution$.next({subjectId:u,subjectName:p,subjectType:b,type:"action-execution",actionType:x.type})};return{onControlEvent:s,onContainerEvent:l,onChapterEvent:c,onExpectEvent:y,expectEventHandler:g,setManifestChapterEvents:v,setManifestContainerEvents:a,stopExpect:o,state:i}};var vn=Q(zr(),1),K=require("@vkontakte/videoplayer-shared/es2015");var er=(r,e)=>{let t={};return r.map(n=>{if(!t[n]){let i=e.chapters.find(s=>s.id===n);if(!i)return null;let o=e.media.videos.find(s=>i.videoId===s.id);if(!o)return null;t[n]=mn(o)}return t[n]}).filter(Boolean)},Ua=r=>{for(let e of r.variants)if(Ga(e)&&e.payload)return e.payload.id},Ga=r=>!!(r.type==="custom"&&r.payload&&r.payload.type==="vk"),mn=r=>{let e=Ua(r);if(!e)return null;let t=e.split("_").pop();return t?parseInt(t,10):null},za=(r,e)=>{for(let t of r.media.videos)if(e===mn(t)){for(let n of r.chapters)if(n.videoId===t.id)return n.id;return}},fn=(r,e)=>r.reduce((t,n)=>{let i=za(e,n);return i?[...t,i]:t},[]);var oe,ge,Ee,W,tr,se,ae,ne,Ie,je,$e,mt=class{constructor({globalEventEmitter:e,videoId:t,interactiveController:n,historyApi:i,settings:o}){this.state={history$:new K.ValueSubject([]),hasPrevChapter$:new K.ValueSubject(!1),prevChapter$:new K.ValueSubject(null),isInitialChapter$:new K.ValueSubject(!1),isGoBackLimited$:new K.ValueSubject(!1)};U(this,oe,null);U(this,ge);U(this,Ee,!1);U(this,W,null);U(this,tr,null);this.events={inited$:new K.Subject,destroyed$:new K.Subject,error$:new K.Subject};U(this,se,null);U(this,ae,null);U(this,ne,null);U(this,Ie,new K.Subscription);U(this,je,!1);U(this,$e,0);var s;F(this,se,t),F(this,ne,e),F(this,ae,n),F(this,oe,i),F(this,ge,o),this.state.history$&&k(this,Ie)&&((s=k(this,Ie))==null||s.add(this.state.history$.subscribe(l=>{var a,c;this.state.prevChapter$.next((0,vn.default)(l,-2)||null),this.state.hasPrevChapter$.next(l.length>1),this.state.isInitialChapter$.next(this.getInitialChapterId()===((c=(a=k(this,W))==null?void 0:a.metadata)==null?void 0:c.initChapterId)),this.state.isGoBackLimited$.next(k(this,$e)===k(this,ge).maxLength-1)})))}setManifest(e){return O(this,null,function*(){if(!k(this,ae)||!k(this,ne))return;F(this,W,e),yield this.getProjectHistory();let t=this.getInitialChapterId();yield k(this,ae).setChapter({chapterId:t,pushToHistory:!1}),k(this,Ee)||(F(this,Ee,!0),this.events.inited$.next({initChapterId:t}))})}get inited(){return k(this,Ee)}updateHistory(e,t=!0){return O(this,null,function*(){var l;if(!k(this,W))return;k(this,je)?(F(this,je,!1),On(this,$e)._++):F(this,$e,0);let n=k(this,W),i=e.length-k(this,ge).maxLength,o=i>0?e.slice(i):e,s=er(o,n);if(F(this,tr,s),this.state.history$.next(o),!(!t||!k(this,oe)||!k(this,se)))try{yield k(this,oe).save(k(this,se),s)}catch(a){let c=new L(1,5,"Unable to save interactive history");this.events.error$.next(c),(l=k(this,ne))==null||l.emit(P.errors,c)}})}goBack(){return O(this,null,function*(){var n;if(!this.state||!k(this,ae)){let i=new L(1,5,"Unable to save interactive history");return this.events.error$.next(i),(n=k(this,ne))==null?void 0:n.emit(P.errors,i)}F(this,je,!0);let e=this.state.history$.getValue().slice(0,-1),t=e.pop();this.state.history$.next(e),yield k(this,ae).setChapter({chapterId:t,playPrev:!0})})}getProjectHistory(){return O(this,null,function*(){var i;if(!k(this,W)||!k(this,se))return;let e=k(this,W),t=[this.getInitialVideoId()];if(k(this,oe))try{let o=yield k(this,oe).get(k(this,se));o.length&&(t=o)}catch(o){let s=new L(1,5,"Error while trying to fetch data");this.events.error$.next(s),(i=k(this,ne))==null||i.emit(P.errors,s)}let n=fn(t,e);this.state.history$.next(n)})}getInitialChapterId(){var t;let e=this.state.history$.getValue();return(0,vn.default)(e,-1)||k(this,ge).initChapterId||((t=k(this,W))==null?void 0:t.metadata.initChapterId)}getInitialVideoId(){if(k(this,W)){let e=this.getInitialChapterId();return er([e],k(this,W)).pop()}return null}destroy(){var e,t;F(this,se,null),F(this,oe,null),F(this,ae,null),(e=k(this,Ie))==null||e.unsubscribe(),F(this,Ie,null),F(this,Ee,!1),(t=k(this,ne))==null||t.emit(P.historyDestroyed),this.events.destroyed$.next(),F(this,ne,null)}};oe=new WeakMap,ge=new WeakMap,Ee=new WeakMap,W=new WeakMap,tr=new WeakMap,se=new WeakMap,ae=new WeakMap,ne=new WeakMap,Ie=new WeakMap,je=new WeakMap,$e=new WeakMap;var rr=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 o=3;o<n;o+=40)if(t[o]!==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 O(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 O(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 nr=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;
|