@vkontakte/videoplayer-interactive 1.0.39-dev.e16aeacb.0 → 1.0.39-dev.f4da114d.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 +111 -10
- package/es2015.esm.js +111 -10
- package/es2018.cjs.js +111 -10
- package/es2018.esm.js +111 -10
- package/es2024.cjs.js +111 -10
- package/es2024.esm.js +111 -10
- package/esnext.cjs.js +111 -10
- package/esnext.esm.js +111 -10
- package/evergreen.esm.js +111 -10
- package/package.json +4 -4
- package/types/modules/Interactives/Interactives.d.ts +8 -4
- package/types/modules/Interactives/containers/ChoiceContainer.d.ts +9 -6
- package/types/modules/Interactives/containers/Container.d.ts +4 -0
- package/types/modules/Interactives/containers/types.d.ts +2 -1
- package/types/modules/Interactives/controls/AreaControl.d.ts +3 -1
- package/types/modules/Interactives/controls/ButtonControl.d.ts +8 -2
- package/types/modules/Interactives/controls/Control.d.ts +9 -4
- package/types/modules/Interactives/controls/TextControl.d.ts +2 -1
- package/types/modules/Interactives/controls/types.d.ts +1 -1
- package/types/modules/Interactives/index.d.ts +20 -5
- package/types/modules/Interactives/types.d.ts +3 -0
- package/types/modules/Interactives/utils/ControlFillAnimation/ControlFillAnimation.d.ts +34 -0
- package/types/modules/Interactives/utils/ControlFillAnimation/index.d.ts +1 -0
- package/types/modules/Interactives/utils/ControlFillAnimation/utils.d.ts +12 -0
- package/types/modules/Interactives/utils/GameController.d.ts +11 -4
- package/types/modules/Interactives/utils/angleUtils.d.ts +23 -0
- package/types/modules/Interactives/utils/emitOnError.d.ts +13 -0
- package/types/modules/Interactives/utils/gameUtils.d.ts +1 -0
package/es2015.cjs.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-interactive v1.0.39-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-interactive v1.0.39-dev.f4da114d.0
|
|
3
|
+
* Mon, 23 Jun 2025 13:02:02 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-39/doc/
|
|
5
5
|
*/
|
|
6
|
-
"use strict";var ol=Object.create;var Be=Object.defineProperty,al=Object.defineProperties,sl=Object.getOwnPropertyDescriptor,ll=Object.getOwnPropertyDescriptors,cl=Object.getOwnPropertyNames,vt=Object.getOwnPropertySymbols,ul=Object.getPrototypeOf,or=Object.prototype.hasOwnProperty,On=Object.prototype.propertyIsEnumerable;var Pn=r=>{throw TypeError(r)};var kn=(r,e,t)=>e in r?Be(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)&&kn(r,t,e[t]);if(vt)for(var t of vt(e))On.call(e,t)&&kn(r,t,e[t]);return r},T=(r,e)=>al(r,ll(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&&vt)for(var n of vt(r))e.indexOf(n)<0&&On.call(r,n)&&(t[n]=r[n]);return t};var h=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),pl=(r,e)=>{for(var t in e)Be(r,t,{get:e[t],enumerable:!0})},Vn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of cl(e))!or.call(r,i)&&i!==t&&Be(r,i,{get:()=>e[i],enumerable:!(n=sl(e,i))||n.enumerable});return r};var Q=(r,e,t)=>(t=r!=null?ol(ul(r)):{},Vn(e||!r||!r.__esModule?Be(t,"default",{value:r,enumerable:!0}):t,r)),hl=r=>Vn(Be({},"__esModule",{value:!0}),r);var Mn=(r,e,t)=>e.has(r)||Pn("Cannot "+t);var k=(r,e,t)=>(Mn(r,e,"read from private field"),t?t.call(r):e.get(r)),U=(r,e,t)=>e.has(r)?Pn("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),$=(r,e,t,n)=>(Mn(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);var Ln=(r,e,t,n)=>({set _(i){$(r,e,i,t)},get _(){return k(r,e,n)}});var O=(r,e,t)=>new Promise((n,i)=>{var o=s=>{try{l(t.next(s))}catch(c){i(c)}},a=s=>{try{l(t.throw(s))}catch(c){i(c)}},l=s=>s.done?n(s.value):Promise.resolve(s.value).then(o,a);l((t=t.apply(r,e)).next())});var ne=h((gr,zn)=>{"use strict";var Ue=function(r){return r&&r.Math===Math&&r};zn.exports=Ue(typeof globalThis=="object"&&globalThis)||Ue(typeof window=="object"&&window)||Ue(typeof self=="object"&&self)||Ue(typeof global=="object"&&global)||Ue(typeof gr=="object"&&gr)||function(){return this}()||Function("return this")()});var G=h((Kd,Wn)=>{"use strict";Wn.exports=function(r){try{return!!r()}catch(e){return!0}}});var Ge=h((Qd,Kn)=>{"use strict";var fl=G();Kn.exports=!fl(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var Jn=h((Xd,Zn)=>{"use strict";var vl=Ge(),Yn=Function.prototype,Qn=Yn.apply,Xn=Yn.call;Zn.exports=typeof Reflect=="object"&&Reflect.apply||(vl?Xn.bind(Qn):function(){return Xn.apply(Qn,arguments)})});var X=h((Yd,ri)=>{"use strict";var ei=Ge(),ti=Function.prototype,Er=ti.call,yl=ei&&ti.bind.bind(Er,Er);ri.exports=ei?yl:function(r){return function(){return Er.apply(r,arguments)}}});var ze=h((Zd,ii)=>{"use strict";var ni=X(),bl=ni({}.toString),Cl=ni("".slice);ii.exports=function(r){return Cl(bl(r),8,-1)}});var Ir=h((Jd,oi)=>{"use strict";var gl=ze(),El=X();oi.exports=function(r){if(gl(r)==="Function")return El(r)}});var z=h((em,ai)=>{"use strict";var xr=typeof document=="object"&&document.all;ai.exports=typeof xr=="undefined"&&xr!==void 0?function(r){return typeof r=="function"||r===xr}:function(r){return typeof r=="function"}});var ye=h((tm,si)=>{"use strict";var Il=G();si.exports=!Il(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var Vt=h((rm,li)=>{"use strict";var xl=Ge(),Pt=Function.prototype.call;li.exports=xl?Pt.bind(Pt):function(){return Pt.apply(Pt,arguments)}});var Tr=h(pi=>{"use strict";var ci={}.propertyIsEnumerable,ui=Object.getOwnPropertyDescriptor,Tl=ui&&!ci.call({1:2},1);pi.f=Tl?function(e){var t=ui(this,e);return!!t&&t.enumerable}:ci});var Sr=h((im,hi)=>{"use strict";hi.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var mi=h((om,di)=>{"use strict";var Sl=X(),wl=G(),Al=ze(),wr=Object,Rl=Sl("".split);di.exports=wl(function(){return!wr("z").propertyIsEnumerable(0)})?function(r){return Al(r)==="String"?Rl(r,""):wr(r)}:wr});var Ar=h((am,fi)=>{"use strict";fi.exports=function(r){return r==null}});var Rr=h((sm,vi)=>{"use strict";var kl=Ar(),Ol=TypeError;vi.exports=function(r){if(kl(r))throw new Ol("Can't call method on "+r);return r}});var We=h((lm,yi)=>{"use strict";var Pl=mi(),Vl=Rr();yi.exports=function(r){return Pl(Vl(r))}});var ke=h((cm,bi)=>{"use strict";var Ml=z();bi.exports=function(r){return typeof r=="object"?r!==null:Ml(r)}});var Mt=h((um,Ci)=>{"use strict";Ci.exports={}});var Lt=h((pm,Ei)=>{"use strict";var kr=Mt(),Or=ne(),Ll=z(),gi=function(r){return Ll(r)?r:void 0};Ei.exports=function(r,e){return arguments.length<2?gi(kr[r])||gi(Or[r]):kr[r]&&kr[r][e]||Or[r]&&Or[r][e]}});var xi=h((hm,Ii)=>{"use strict";var Nl=X();Ii.exports=Nl({}.isPrototypeOf)});var Ai=h((dm,wi)=>{"use strict";var jl=ne(),Ti=jl.navigator,Si=Ti&&Ti.userAgent;wi.exports=Si?String(Si):""});var Li=h((mm,Mi)=>{"use strict";var Vi=ne(),Pr=Ai(),Ri=Vi.process,ki=Vi.Deno,Oi=Ri&&Ri.versions||ki&&ki.version,Pi=Oi&&Oi.v8,Y,Nt;Pi&&(Y=Pi.split("."),Nt=Y[0]>0&&Y[0]<4?1:+(Y[0]+Y[1]));!Nt&&Pr&&(Y=Pr.match(/Edge\/(\d+)/),(!Y||Y[1]>=74)&&(Y=Pr.match(/Chrome\/(\d+)/),Y&&(Nt=+Y[1])));Mi.exports=Nt});var Vr=h((fm,ji)=>{"use strict";var Ni=Li(),_l=G(),$l=ne(),Fl=$l.String;ji.exports=!!Object.getOwnPropertySymbols&&!_l(function(){var r=Symbol("symbol detection");return!Fl(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&Ni&&Ni<41})});var Mr=h((vm,_i)=>{"use strict";var Bl=Vr();_i.exports=Bl&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Lr=h((ym,$i)=>{"use strict";var ql=Lt(),Dl=z(),Hl=xi(),Ul=Mr(),Gl=Object;$i.exports=Ul?function(r){return typeof r=="symbol"}:function(r){var e=ql("Symbol");return Dl(e)&&Hl(e.prototype,Gl(r))}});var Bi=h((bm,Fi)=>{"use strict";var zl=String;Fi.exports=function(r){try{return zl(r)}catch(e){return"Object"}}});var Nr=h((Cm,qi)=>{"use strict";var Wl=z(),Kl=Bi(),Ql=TypeError;qi.exports=function(r){if(Wl(r))return r;throw new Ql(Kl(r)+" is not a function")}});var Hi=h((gm,Di)=>{"use strict";var Xl=Nr(),Yl=Ar();Di.exports=function(r,e){var t=r[e];return Yl(t)?void 0:Xl(t)}});var Gi=h((Em,Ui)=>{"use strict";var jr=Vt(),_r=z(),$r=ke(),Zl=TypeError;Ui.exports=function(r,e){var t,n;if(e==="string"&&_r(t=r.toString)&&!$r(n=jr(t,r))||_r(t=r.valueOf)&&!$r(n=jr(t,r))||e!=="string"&&_r(t=r.toString)&&!$r(n=jr(t,r)))return n;throw new Zl("Can't convert object to primitive value")}});var Wi=h((Im,zi)=>{"use strict";zi.exports=!0});var Xi=h((xm,Qi)=>{"use strict";var Ki=ne(),Jl=Object.defineProperty;Qi.exports=function(r,e){try{Jl(Ki,r,{value:e,configurable:!0,writable:!0})}catch(t){Ki[r]=e}return e}});var jt=h((Tm,Ji)=>{"use strict";var ec=Wi(),tc=ne(),rc=Xi(),Yi="__core-js_shared__",Zi=Ji.exports=tc[Yi]||rc(Yi,{});(Zi.versions||(Zi.versions=[])).push({version:"3.38.0",mode:ec?"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 Fr=h((Sm,to)=>{"use strict";var eo=jt();to.exports=function(r,e){return eo[r]||(eo[r]=e||{})}});var Ke=h((wm,ro)=>{"use strict";var nc=Rr(),ic=Object;ro.exports=function(r){return ic(nc(r))}});var Oe=h((Am,no)=>{"use strict";var oc=X(),ac=Ke(),sc=oc({}.hasOwnProperty);no.exports=Object.hasOwn||function(e,t){return sc(ac(e),t)}});var Br=h((Rm,io)=>{"use strict";var lc=X(),cc=0,uc=Math.random(),pc=lc(1 .toString);io.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+pc(++cc+uc,36)}});var Qe=h((km,ao)=>{"use strict";var hc=ne(),dc=Fr(),oo=Oe(),mc=Br(),fc=Vr(),vc=Mr(),Pe=hc.Symbol,qr=dc("wks"),yc=vc?Pe.for||Pe:Pe&&Pe.withoutSetter||mc;ao.exports=function(r){return oo(qr,r)||(qr[r]=fc&&oo(Pe,r)?Pe[r]:yc("Symbol."+r)),qr[r]}});var uo=h((Om,co)=>{"use strict";var bc=Vt(),so=ke(),lo=Lr(),Cc=Hi(),gc=Gi(),Ec=Qe(),Ic=TypeError,xc=Ec("toPrimitive");co.exports=function(r,e){if(!so(r)||lo(r))return r;var t=Cc(r,xc),n;if(t){if(e===void 0&&(e="default"),n=bc(t,r,e),!so(n)||lo(n))return n;throw new Ic("Can't convert object to primitive value")}return e===void 0&&(e="number"),gc(r,e)}});var Dr=h((Pm,po)=>{"use strict";var Tc=uo(),Sc=Lr();po.exports=function(r){var e=Tc(r,"string");return Sc(e)?e:e+""}});var fo=h((Vm,mo)=>{"use strict";var wc=ne(),ho=ke(),Hr=wc.document,Ac=ho(Hr)&&ho(Hr.createElement);mo.exports=function(r){return Ac?Hr.createElement(r):{}}});var Ur=h((Mm,vo)=>{"use strict";var Rc=ye(),kc=G(),Oc=fo();vo.exports=!Rc&&!kc(function(){return Object.defineProperty(Oc("div"),"a",{get:function(){return 7}}).a!==7})});var Co=h(bo=>{"use strict";var Pc=ye(),Vc=Vt(),Mc=Tr(),Lc=Sr(),Nc=We(),jc=Dr(),_c=Oe(),$c=Ur(),yo=Object.getOwnPropertyDescriptor;bo.f=Pc?yo:function(e,t){if(e=Nc(e),t=jc(t),$c)try{return yo(e,t)}catch(n){}if(_c(e,t))return Lc(!Vc(Mc.f,e,t),e[t])}});var Eo=h((Nm,go)=>{"use strict";var Fc=G(),Bc=z(),qc=/#|\.prototype\./,Xe=function(r,e){var t=Hc[Dc(r)];return t===Gc?!0:t===Uc?!1:Bc(e)?Fc(e):!!e},Dc=Xe.normalize=function(r){return String(r).replace(qc,".").toLowerCase()},Hc=Xe.data={},Uc=Xe.NATIVE="N",Gc=Xe.POLYFILL="P";go.exports=Xe});var Gr=h((jm,xo)=>{"use strict";var Io=Ir(),zc=Nr(),Wc=Ge(),Kc=Io(Io.bind);xo.exports=function(r,e){return zc(r),e===void 0?r:Wc?Kc(r,e):function(){return r.apply(e,arguments)}}});var So=h((_m,To)=>{"use strict";var Qc=ye(),Xc=G();To.exports=Qc&&Xc(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var Ao=h(($m,wo)=>{"use strict";var Yc=ke(),Zc=String,Jc=TypeError;wo.exports=function(r){if(Yc(r))return r;throw new Jc(Zc(r)+" is not an object")}});var Oo=h(ko=>{"use strict";var eu=ye(),tu=Ur(),ru=So(),_t=Ao(),Ro=Dr(),nu=TypeError,zr=Object.defineProperty,iu=Object.getOwnPropertyDescriptor,Wr="enumerable",Kr="configurable",Qr="writable";ko.f=eu?ru?function(e,t,n){if(_t(e),t=Ro(t),_t(n),typeof e=="function"&&t==="prototype"&&"value"in n&&Qr in n&&!n[Qr]){var i=iu(e,t);i&&i[Qr]&&(e[t]=n.value,n={configurable:Kr in n?n[Kr]:i[Kr],enumerable:Wr in n?n[Wr]:i[Wr],writable:!1})}return zr(e,t,n)}:zr:function(e,t,n){if(_t(e),t=Ro(t),_t(n),tu)try{return zr(e,t,n)}catch(i){}if("get"in n||"set"in n)throw new nu("Accessors not supported");return"value"in n&&(e[t]=n.value),e}});var Vo=h((Bm,Po)=>{"use strict";var ou=ye(),au=Oo(),su=Sr();Po.exports=ou?function(r,e,t){return au.f(r,e,su(1,t))}:function(r,e,t){return r[e]=t,r}});var Ze=h((qm,Lo)=>{"use strict";var Ye=ne(),lu=Jn(),cu=Ir(),uu=z(),pu=Co().f,hu=Eo(),Ve=Mt(),du=Gr(),Me=Vo(),Mo=Oe();jt();var mu=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 lu(r,this,arguments)};return e.prototype=r.prototype,e};Lo.exports=function(r,e){var t=r.target,n=r.global,i=r.stat,o=r.proto,a=n?Ye:i?Ye[t]:Ye[t]&&Ye[t].prototype,l=n?Ve:Ve[t]||Me(Ve,t,{})[t],s=l.prototype,c,m,v,y,g,R,I,f,u;for(y in e)c=hu(n?y:t+(i?".":"#")+y,r.forced),m=!c&&a&&Mo(a,y),R=l[y],m&&(r.dontCallGetSet?(u=pu(a,y),I=u&&u.value):I=a[y]),g=m&&I?I:e[y],!(!c&&!o&&typeof R==typeof g)&&(r.bind&&m?f=du(g,Ye):r.wrap&&m?f=mu(g):o&&uu(g)?f=cu(g):f=g,(r.sham||g&&g.sham||R&&R.sham)&&Me(f,"sham",!0),Me(l,y,f),o&&(v=t+"Prototype",Mo(Ve,v)||Me(Ve,v,{}),Me(Ve[v],y,g),r.real&&s&&(c||!s[y])&&Me(s,y,g)))}});var jo=h((Dm,No)=>{"use strict";var fu=Math.ceil,vu=Math.floor;No.exports=Math.trunc||function(e){var t=+e;return(t>0?vu:fu)(t)}});var Je=h((Hm,_o)=>{"use strict";var yu=jo();_o.exports=function(r){var e=+r;return e!==e||e===0?0:yu(e)}});var Fo=h((Um,$o)=>{"use strict";var bu=Je(),Cu=Math.min;$o.exports=function(r){var e=bu(r);return e>0?Cu(e,9007199254740991):0}});var et=h((Gm,Bo)=>{"use strict";var gu=Fo();Bo.exports=function(r){return gu(r.length)}});var $t=h((zm,qo)=>{"use strict";qo.exports=function(){}});var Do=h(()=>{"use strict";var Eu=Ze(),Iu=Ke(),xu=et(),Tu=Je(),Su=$t();Eu({target:"Array",proto:!0},{at:function(e){var t=Iu(this),n=xu(t),i=Tu(e),o=i>=0?i:n+i;return o<0||o>=n?void 0:t[o]}});Su("at")});var Ft=h((Qm,Ho)=>{"use strict";var wu=Lt();Ho.exports=wu});var Go=h((Xm,Uo)=>{"use strict";Do();var Au=Ft();Uo.exports=Au("Array","at")});var Wo=h((Ym,zo)=>{"use strict";var Ru=Go();zo.exports=Ru});var Xr=h((Zm,Ko)=>{"use strict";var ku=Wo();Ko.exports=ku});var na=h((Df,ra)=>{"use strict";var Du=Je(),Hu=Math.max,Uu=Math.min;ra.exports=function(r,e){var t=Du(r);return t<0?Hu(t+e,0):Uu(t,e)}});var nn=h((Hf,oa)=>{"use strict";var Gu=We(),zu=na(),Wu=et(),ia=function(r){return function(e,t,n){var i=Gu(e),o=Wu(i);if(o===0)return!r&&-1;var a=zu(n,o),l;if(r&&t!==t){for(;o>a;)if(l=i[a++],l!==l)return!0}else for(;o>a;a++)if((r||a in i)&&i[a]===t)return r||a||0;return!r&&-1}};oa.exports={includes:ia(!0),indexOf:ia(!1)}});var aa=h(()=>{"use strict";var Ku=Ze(),Qu=nn().includes,Xu=G(),Yu=$t(),Zu=Xu(function(){return!Array(1).includes()});Ku({target:"Array",proto:!0,forced:Zu},{includes:function(e){return Qu(this,e,arguments.length>1?arguments[1]:void 0)}});Yu("includes")});var la=h((zf,sa)=>{"use strict";aa();var Ju=Ft();sa.exports=Ju("Array","includes")});var ua=h((Wf,ca)=>{"use strict";var ep=la();ca.exports=ep});var lt=h((Kf,pa)=>{"use strict";var tp=ua();pa.exports=tp});var Ca=h((ov,ba)=>{"use strict";var np=Fr(),ip=Br(),ya=np("keys");ba.exports=function(r){return ya[r]||(ya[r]=ip(r))}});var Ea=h((av,ga)=>{"use strict";var op=G();ga.exports=!op(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var Ta=h((sv,xa)=>{"use strict";var ap=Oe(),sp=z(),lp=Ke(),cp=Ca(),up=Ea(),Ia=cp("IE_PROTO"),sn=Object,pp=sn.prototype;xa.exports=up?sn.getPrototypeOf:function(r){var e=lp(r);if(ap(e,Ia))return e[Ia];var t=e.constructor;return sp(t)&&e instanceof t?t.prototype:e instanceof sn?pp:null}});var wa=h((lv,Sa)=>{"use strict";Sa.exports={}});var ka=h((cv,Ra)=>{"use strict";var hp=X(),ln=Oe(),dp=We(),mp=nn().indexOf,fp=wa(),Aa=hp([].push);Ra.exports=function(r,e){var t=dp(r),n=0,i=[],o;for(o in t)!ln(fp,o)&&ln(t,o)&&Aa(i,o);for(;e.length>n;)ln(t,o=e[n++])&&(~mp(i,o)||Aa(i,o));return i}});var Pa=h((uv,Oa)=>{"use strict";Oa.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Ma=h((pv,Va)=>{"use strict";var vp=ka(),yp=Pa();Va.exports=Object.keys||function(e){return vp(e,yp)}});var Fa=h((hv,$a)=>{"use strict";var Na=ye(),bp=G(),ja=X(),Cp=Ta(),gp=Ma(),Ep=We(),Ip=Tr().f,_a=ja(Ip),xp=ja([].push),Tp=Na&&bp(function(){var r=Object.create(null);return r[2]=2,!_a(r,2)}),La=function(r){return function(e){for(var t=Ep(e),n=gp(t),i=Tp&&Cp(t)===null,o=n.length,a=0,l=[],s;o>a;)s=n[a++],(!Na||(i?s in t:_a(t,s)))&&xp(l,r?[s,t[s]]:t[s]);return l}};$a.exports={entries:La(!0),values:La(!1)}});var Ba=h(()=>{"use strict";var Sp=Ze(),wp=Fa().values;Sp({target:"Object",stat:!0},{values:function(e){return wp(e)}})});var Da=h((fv,qa)=>{"use strict";Ba();var Ap=Mt();qa.exports=Ap.Object.values});var Ua=h((vv,Ha)=>{"use strict";var Rp=Da();Ha.exports=Rp});var Xt=h((yv,Ga)=>{"use strict";var kp=Ua();Ga.exports=kp});var dn=h((Dv,es)=>{"use strict";var Pp=ze();es.exports=Array.isArray||function(e){return Pp(e)==="Array"}});var rs=h((Hv,ts)=>{"use strict";var Vp=TypeError,Mp=9007199254740991;ts.exports=function(r){if(r>Mp)throw Vp("Maximum allowed index exceeded");return r}});var os=h((Uv,is)=>{"use strict";var Lp=dn(),Np=et(),jp=rs(),_p=Gr(),ns=function(r,e,t,n,i,o,a,l){for(var s=i,c=0,m=a?_p(a,l):!1,v,y;c<n;)c in t&&(v=m?m(t[c],c,e):t[c],o>0&&Lp(v)?(y=Np(v),s=ns(r,e,v,y,s,o-1)-1):(jp(s+1),r[s]=v),s++),c++;return s};is.exports=ns});var ls=h((Gv,ss)=>{"use strict";var $p=Qe(),Fp=$p("toStringTag"),as={};as[Fp]="z";ss.exports=String(as)==="[object z]"});var us=h((zv,cs)=>{"use strict";var Bp=ls(),qp=z(),Zt=ze(),Dp=Qe(),Hp=Dp("toStringTag"),Up=Object,Gp=Zt(function(){return arguments}())==="Arguments",zp=function(r,e){try{return r[e]}catch(t){}};cs.exports=Bp?Zt:function(r){var e,t,n;return r===void 0?"Undefined":r===null?"Null":typeof(t=zp(e=Up(r),Hp))=="string"?t:Gp?Zt(e):(n=Zt(e))==="Object"&&qp(e.callee)?"Arguments":n}});var hs=h((Wv,ps)=>{"use strict";var Wp=X(),Kp=z(),mn=jt(),Qp=Wp(Function.toString);Kp(mn.inspectSource)||(mn.inspectSource=function(r){return Qp(r)});ps.exports=mn.inspectSource});var bs=h((Kv,ys)=>{"use strict";var Xp=X(),Yp=G(),ds=z(),Zp=us(),Jp=Lt(),eh=hs(),ms=function(){},fs=Jp("Reflect","construct"),fn=/^\s*(?:class|function)\b/,th=Xp(fn.exec),rh=!fn.test(ms),ht=function(e){if(!ds(e))return!1;try{return fs(ms,[],e),!0}catch(t){return!1}},vs=function(e){if(!ds(e))return!1;switch(Zp(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return rh||!!th(fn,eh(e))}catch(t){return!0}};vs.sham=!0;ys.exports=!fs||Yp(function(){var r;return ht(ht.call)||!ht(Object)||!ht(function(){r=!0})||r})?vs:ht});var Is=h((Qv,Es)=>{"use strict";var Cs=dn(),nh=bs(),ih=ke(),oh=Qe(),ah=oh("species"),gs=Array;Es.exports=function(r){var e;return Cs(r)&&(e=r.constructor,nh(e)&&(e===gs||Cs(e.prototype))?e=void 0:ih(e)&&(e=e[ah],e===null&&(e=void 0))),e===void 0?gs:e}});var Ts=h((Xv,xs)=>{"use strict";var sh=Is();xs.exports=function(r,e){return new(sh(r))(e===0?0:e)}});var Ss=h(()=>{"use strict";var lh=Ze(),ch=os(),uh=Ke(),ph=et(),hh=Je(),dh=Ts();lh({target:"Array",proto:!0},{flat:function(){var e=arguments.length?arguments[0]:void 0,t=uh(this),n=ph(t),i=dh(t,0);return i.length=ch(i,t,t,n,0,e===void 0?1:hh(e)),i}})});var ws=h(()=>{"use strict";var mh=$t();mh("flat")});var Rs=h((ty,As)=>{"use strict";Ss();ws();var fh=Ft();As.exports=fh("Array","flat")});var Os=h((ry,ks)=>{"use strict";var vh=Rs();ks.exports=vh});var Vs=h((ny,Ps)=>{"use strict";var yh=Os();Ps.exports=yh});var Ah={};pl(Ah,{ContainerTypes:()=>E.ContainerTypes,ControlTypes:()=>E.ControlTypes,CustomError:()=>B,EVENT_NAMES:()=>P,EventActionTypes:()=>E.EventActionTypes,EventTypes:()=>E.EventTypes,Interactives:()=>mt,ManifestController:()=>ge,SDKInfo:()=>wh,chapterIdsToVKVideoIds:()=>er,compareVersions:()=>zt,containerTypes:()=>Mu,controlTypes:()=>Lu,eventActionTypes:()=>Zr,eventTypes:()=>Nu,getChapterIdByVkVideoId:()=>Xs,getVKVideoIdByMedia:()=>bn,getVideoRawIdByMedia:()=>Ks,graphEventTypes:()=>je,hasEndTemplate:()=>ct,interactivesEventTypes:()=>N,isAreaControl:()=>Vu,isButtonControl:()=>Pu,isLastChapter:()=>Z,isOneTextCtrlContainer:()=>Ce,isSupportedManifest:()=>E.isSupportedManifest,isTextControl:()=>it,isVKVariantItem:()=>Qs,isValidManifest:()=>Yr,migrateManifestToLatestVersion:()=>E.migrateManifestToLatestVersion,utils:()=>nl,vkVideoIdsToChapterIds:()=>Cn});module.exports=hl(Ah);var Nn="1.0.39-dev.e16aeacb.0";var kt=require("@vkontakte/videoplayer-shared/es2015");var ar=class{constructor(e){this.layout=e}},yt=class extends ar{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} + ${2e-4}))`,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 jn(r){return"features"in r}var we=class{constructor(e,t){this.container=e,this.options=t,this.factories=new Map,this.controls=[],this.setControls()}featureIsEnabled(e){return this.options&&jn(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 a=o(n,this.options);if(a)return[...t,a]}return[...t]},[]))||[]}};var fe=require("@vkontakte/videoplayer-shared/es2015");var ce=(r,e)=>Object.prototype.toString.call(r)===`[object ${e}]`,ue=r=>ce(r,"Object"),bt=r=>ce(r,"String"),Ct=r=>ce(r,"Array"),gt=r=>ce(r,"Number"),_n=r=>ce(r,"Function"),$n=r=>ce(r,"Boolean"),sr=r=>gt(r)&&!isNaN(r);var de=r=>ue(r)&&Object.keys(r).length===0,lr=r=>Ct(r)&&!r.length;var qe=(r,e)=>bt(r)&&(e?r.trim():r).length;function De(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 Fn="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},Bn=(n=>(n.top="flex-start",n.bottom="flex-end",n.center="center",n))(Bn||{}),qn=(n=>(n.start="flex-start",n.end="flex-end",n.center="center",n))(qn||{}),Dn=(n=>(n.start="left",n.end="right",n.center="center",n))(Dn||{}),Et=({target:r,props:e})=>{var t,n,i;r.style.alignItems=(t=(e==null?void 0:e.gravityVertical)&&Bn[e.gravityVertical])!=null?t:"center",r.style.justifyContent=(n=(e==null?void 0:e.gravityHorizontal)&&qn[e.gravityHorizontal])!=null?n:"center",r.style.textAlign=(i=(e==null?void 0:e.alignment)&&Dn[e.alignment])!=null?i:"center"},It=({target:r,props:e,fallback:t,dependsOn:n})=>{var i,o,a,l,s,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=(a=e==null?void 0:e.text)==null?void 0:a.size)!=null?l:t.textSize})`,r.textContent=(c=(s=e==null?void 0:e.text)==null?void 0:s.value)!=null?c:t.textContent},xt=({target:r,props:e,fallback:t})=>{var n,i,o,a;r.style.backgroundColor=De((i=(n=e==null?void 0:e.background)==null?void 0:n.color)!=null?i:t.backgroundColor,(a=(o=e==null?void 0:e.background)==null?void 0:o.alpha)!=null?a:t.backgroundAlpha)},He=({target:r,props:e,fallback:t,dependsOn:n,useRawValues:i=!1})=>{var l,s,c,m,v,y,g,R,I,f,u;let o=i?t.borderWidthRawValue:`calc(${n.height} * ${(c=(s=(l=e==null?void 0:e.shape)==null?void 0:l.border)==null?void 0:s.width)!=null?c:t.borderWidth})`,a=i?t.roundCornersRawValue:`calc(${n.height} * ${(v=(m=e==null?void 0:e.shape)==null?void 0:m.roundCorners)!=null?v:t.roundCorners})`;r.style.borderWidth=o,r.style.borderStyle="solid",r.style.borderColor=De(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=(f=(I=e==null?void 0:e.shape)==null?void 0:I.border)==null?void 0:f.alpha)!=null?u:t.borderAlpha),r.style.borderRadius=a},Hn=({target:r,isDark:e,baseDimension:t,fallback:n})=>{let a=De(n.shadowColorLight,n.shadowColorAlpha),l=De(n.shadowColorDark,n.shadowColorAlpha),s=`calc(${t} * ${.25})`,c=`calc(${t} * ${.11})`,m=`0px 0px ${s} ${c} ${e?l:a}`;r.style.boxShadow=m},Ae=({target:r,layoutParams:e,fallback:t})=>{var i;let n=(i=e.angle)!=null?i:t.angle;n=n&&n*-1,r.style.transform=`rotate(${n}rad)`};var re=require("@vkontakte/videoplayer-shared/es2015");var cr="interactive-control-tap",Re={common:cr,animation:`${cr}-animation`,visible:`${cr}-visible`};var dl=60,Tt=class{constructor({controlRotateAngleRad:e,clickCancelCondition:t,circleDiameterPx:n=dl,useDimensionsBasedSize:i=!1}){this.onElementClick=e=>{if(!e.target||!e.currentTarget||this.clickCancelCondition())return;let t=e.currentTarget.parentElement;if(!t)return;let n=t.getBoundingClientRect(),i={width:this.useDimensionsBasedSize?t.offsetWidth:this.circleDiameterPx,height:this.useDimensionsBasedSize?t.offsetHeight:this.circleDiameterPx},o=Math.min(i.width,i.height),a=n.left+n.width/2,l=n.top+n.height/2,s=e.clientX-a,c=e.clientY-l,m=ml(s,c,this.controlRotateAngleRad);this.element.style.width=o+"px",this.element.style.left=m.x+n.width/2-o/2+"px",this.element.style.top=m.y+n.height/2-o/2+"px",this.element.classList.add(Re.visible,Re.animation)};this.onAnimationEnd=e=>{!e.target||!e.currentTarget||e.target===e.currentTarget&&this.element.classList.remove(Re.visible,Re.animation)};let o=document.createElement("div");o.classList.add(Re.common),this.controlRotateAngleRad=e,this.element=o,this.clickCancelCondition=t,this.circleDiameterPx=n,this.useDimensionsBasedSize=i}};function ml(r,e,t){return{x:r*Math.cos(t)-e*Math.sin(t),y:r*Math.sin(t)+e*Math.cos(t)}}var ur="int",me=(n=>(n.AREA=`${ur}_area`,n.TEXT=`${ur}_text`,n.BUTTON=`${ur}_bttn`,n))(me||{});function pr(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`},Un=40;var B=class{constructor(e,t,...n){this.severity=e;this.category=t;this.data=n}toString(){return`Interactive SDK error ${JSON.stringify(this,null," ")}`}};var pe=class{constructor(e,t){this.control=e;this.options=t;this.container=null;this.controlElement=null;this.subscriptions=new re.Subscription;this.error$=new re.Subject;this.isInteracted$=new re.ValueSubject(!1)}onError(e="",t){let n=new B(1,1,{message:e,error:t,details:{id:this.control.id}});this.error$.next(n)}addControlTap(e){var t;if(this.featureIsEnabled("controlsTapPlace")&&this.container){let n=(t=this.control.layoutParams.angle)!=null?t:_.angle;this.controlTap=new Tt({controlRotateAngleRad:n,clickCancelCondition:this.container.isManifestContainerDisabled,circleDiameterPx:this.isTouch()?Un:void 0}),this.subscriptions.add((0,re.fromEvent)(e,"click").subscribe(this.controlTap.onElementClick,i=>this.onError("Control click tap animation error",i))).add((0,re.fromEvent)(this.controlTap.element,"animationend").subscribe(this.controlTap.onAnimationEnd,i=>this.onError("Tap animationend error",i))),this.container.element.append(this.controlTap.element)}}createContainerElement(e){var o;let t=document.createElement("div");t.classList.add(M.wrapper),e.setControlLayout(t,this.control.layoutParams);let n=((o=this.control.layoutParams.innerSizesDependOn)!=null?o:_.innerSizesDependOn)==="self"?{height:t.style.height,width:t.style.width}:{height:"var(--interactive-content-height)",width:"var(--interactive-content-width)"},i=()=>{var a,l;return(l=(a=e.isContainerDisabled)==null?void 0:a.call(e))!=null?l:!1};this.container={element:t,dimensions:n,isManifestContainerDisabled:i}}createClickListener(e){return t=>{t.stopPropagation(),this.isInteracted$.next(!0),e()}}featureIsEnabled(e){return this.options&&pr(this.options)&&this.options.features[e]}isTouch(){return this.options&&pr(this.options)&&this.options.isTouch}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,re.fromEvent)(this.container.element,"click").subscribe(this.createClickListener(()=>e({action:t.action,controlId:this.control.id,controlType:this.control.type})),i=>this.onError("Error happened on control interaction",i)));break}default:break}})}removeListeners(){this.subscriptions.unsubscribe()}};var mr="interactive-blink-anim-reference",q={common:mr,animation:`${mr}-animation`,disabled:`${mr}-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 fr="interactive-container",D={common:fr,hidden:`${fr}-hidden`,disabled:`${fr}-disabled`};var wt=(r,e)=>{if(r.type.trim().toLowerCase()==="area")return new vr(r,e)},vr=class extends pe{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",me.AREA),xt({target:n,props:this.control.props,fallback:T(d({},_),{backgroundColor:"transparent"})}),Ae({target:n,layoutParams:this.control.layoutParams,fallback:_}),this.addControlTap(n),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,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}updateShadowStyles(e){var t,n,i;if(!(!this.container||!this.controlElement))if($n(e)){let o=Math.min(this.controlElement.offsetWidth,this.controlElement.offsetHeight)+"px";Hn({target:this.controlElement,props:this.control.props,fallback:_,isDark:e,baseDimension:o}),He({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 He({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,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.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)})}onProgress(){}onResize(){}};var ve=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 yr(r,e)},yr=class extends pe{constructor(e,t){super(e,t)}createView({parentElement:e,callbacks:t}){var a;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",me.BUTTON),Ae({target:n,layoutParams:this.control.layoutParams,fallback:_}),xt({target:n,props:this.control.props,fallback:_}),He({target:n,props:this.control.props,fallback:_,dependsOn:this.container.dimensions}),Et({target:n,props:T(d({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let i=At(this.control.type.trim().toLowerCase()),o=(a=i.firstElementChild)!=null?a:i;It({target:o,props:this.control.props,fallback:_,dependsOn:this.container.dimensions}),this.addControlTap(n),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,ve.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,ve.fromEvent)(this.controlElement,"mouseenter").subscribe(()=>{e.classList.contains(D.disabled)||this.onBlinkHovering()},n=>this.onError("Error happened in mouseenter callback",n))).add((0,ve.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,ve.fromEvent)(e,"animationiteration").pipe((0,ve.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)})}onProgress(){}onResize(){}updateShadowStyles(){}};var Gn=(r,e)=>{if(r.type.trim().toLowerCase()==="text")return new br(r,e)},br=class extends pe{constructor(e,t){super(e,t)}createView({parentElement:e,callbacks:t}){var a;if(super.createContainerElement(t),!this.container)return;let n=document.createElement("div");n.classList.add(M.common,M.text),n.setAttribute("data-testid",me.TEXT),Ae({target:n,layoutParams:this.control.layoutParams,fallback:_}),Et({target:n,props:T(d({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let i=At(this.control.type.trim().toLowerCase()),o=(a=i.firstElementChild)!=null?a:i;It({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 Cr(r,e,t)},Cr=class extends we{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 yt(this.container.layout),this.isRemoved=!1,this.isDisabled=!1,this.addControlFactory("button",Rt),this.addControlFactory("text",Gn),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,isContainerDisabled:()=>this.isDisabled}}),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 tl=Q(Xr(),1),w=require("@vkontakte/videoplayer-shared/es2015"),Fe=require("@vkontakte/videoplayer-statistics/es2015");var Zo=require("@vkontakte/videoplayer-shared/es2015");function tt(r,e){let t;return(...n)=>{clearTimeout(t),t=setTimeout(()=>r(...n),e)}}var Qo="video_interactive",Xo="videoint";var Yo=250,rt=class{constructor(e){this.handleZoomChange=tt(e=>{this.lastZoomInfo=e},Yo);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,!gt(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=Ou(e),this.resizeObserver=new ResizeObserver(tt(this.onResize,Yo)),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,Zo.loadVKLangPack)(this.lang,Qo,Xo)}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",a=>{var l=a,{name:i}=l,o=ee(l,["name"]);var s;i==="openPreview"&&"chapterId"in o&&((s=this.onOpenPreviewClick)==null||s.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 Ou(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 nt=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 a=o.startTime-e;if(a<=i&&(o.endTime&&i<=o.endTime||o.endTime===null)){n=!0;break}i<a&&(t=t===-1?a:Math.min(t,a))}return!n&&t!==-1?t:null}}};var E=require("@interactiveplatform/movika-manifest");var Jo={metadata:"Object",chapters:"Array"},Yr=r=>{if(!ue(r))return!1;for(let e in Jo)if(!r[e]||!ce(r[e],Jo[e]))return!1;return(0,E.isSupportedManifest)(r.metadata.version)},it=r=>r.type===E.ControlTypes.Text,Pu=r=>r.type===E.ControlTypes.Button,Vu=r=>r.type===E.ControlTypes.Area,Mu={Choice:"Choice",TextInput:"TextInput"},Lu={Button:"Button",Area:"Area",Text:"Text"},Nu={onClick:"onClick",onSuspense:"onSuspense"},Zr={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 va=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 ju(...this.loaders[e])(t)})}};function ju(...r){return function(t){return O(this,null,function*(){let n=[...r];for(;n.length>0;)t=yield n.shift()(t);return t})}}function ot(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 a=r.getManifest();if(a){let l=r.getChapter(a.chapters,t);if(l){let s=r.getMedia(a.media,l.videoId),c=r.getGraph(a.graph,l.id);return s?T(d({},n),{actions:r,errors:e,result:{chapter:l,media:s,graph:c}}):T(d({},n),{errors:ot(e,Ht.name,"Could not find media"),actions:r})}}}return T(d({},n),{errors:ot(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 a=n[i];try{a.callback.call(this,e)}catch(l){Promise.resolve().then(()=>{throw l})}a.options&&a.options.once&&this.removeEventListener(e.type,a.callback)}return!e.defaultPrevented}},Le=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 Le,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",Le.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 Jr(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,m){let v;m&&m.signal&&(v=m.signal,delete m.signal);let y=new t(c,m);return v&&Object.defineProperty(y,"signal",{writable:!1,enumerable:!1,configurable:!0,value:v}),y},o.prototype=t.prototype);let a=e;return{fetch:(s,c)=>{let m=o&&o.prototype.isPrototypeOf(s)?s.signal:c?c.signal:void 0;if(m){let v;try{v=new DOMException("Aborted","AbortError")}catch(g){v=new Error("Aborted"),v.name="AbortError"}if(m.aborted)return Promise.reject(v);let y=new Promise((g,R)=>{m.addEventListener("abort",()=>R(v),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([y,a(s,c)])}return a(s,c)},Request:o}}var _u=()=>"fetch"in window,st=_u()&&Gt({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),ea=st?Jr({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,en=st?ea.fetch:window.fetch,Pf=st?ea.Request:window.Request,Vf=st?at:window.AbortController,Mf=st?Le: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 $u=r=>O(void 0,null,function*(){try{let e={},t;if(bt(r)){t=new URL(r).href;let i=yield en(t);if(!i.ok)return{};e=yield i.json()}else if(ue(r))e=r;else return{};if(!Yr(e))return{};let n=e.metadata.media;if(bt(n)&&!("media"in e))try{let i;t?i=new URL(n,t).href:(i=new URL(n).href,t=i);let o=yield en(i);if(!o.ok)throw new Error;e.metadata.media=yield o.json()}catch(i){return qu(e.metadata.version)?{manifest:e}:{}}return{manifest:e,manifestURL:t}}catch(e){return{}}});function ta(r){return O(this,null,function*(){let{manifest:e,manifestURL:t}=yield $u(r);if(!e)throw new Error("Failed on fetch");let n=(0,E.migrateManifestToLatestVersion)(e);return n.media=Fu(n.media,t),delete n.metadata.media,n})}function Wt(r,e){if(e)return r.find(t=>t.id===e)}function tn(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 rn(r,e){return r.videos.find(t=>t.id===e)}function Fu(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=Bu(i,e);return T(d({},n),{url:o||i})})}))})}function Bu(r="",e){try{return new URL(r,e).href}catch(t){return""}}function qu(r){return zt(r,"3.2.0")>=0}var ha=Q(lt(),1);var Kt=r=>Ct(r)&&!lr(r),Z=r=>r.order==="end",ct=r=>Ct(r.containers)&&!lr(r.containers)&&Z(r),da=(r,e)=>{var n;let t=r*1e3;return Kt(e.controls)&&t<((n=e.startTime)!=null?n:0)},on=(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 be=(r=[])=>r.some(e=>e.action.type==="expect"),an=(r=[])=>r.find(e=>e.action.type==="expect"),rp=r=>(r==null?void 0:r.length)===1,Ce=r=>rp(r)&&it(r[0]);function ma(r=[],e=1/0,t=[]){return r.filter(({container:n})=>!(0,ha.default)(t,n.container.id)&&be(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),ma(r,i.container.container.endTime,[i.container.container.id]).forEach(a=>{n(a)});break}}var fa=(r,e)=>{let t=I=>{let f=e.find(({container:u})=>u.container.id===I);return f==null?void 0:f.container.isRemoved},n=be(r.events)&&!t(r.id),i=(I,f=!1,u=!1)=>{let p=u?"every":"some";return I.controls[p](b=>{var A;let x=f?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)===Zr.openURI}))&&x})},o=I=>I.some(({container:f})=>i(f.container,!0,!1)&&!f.isRemoved),a=I=>I.every(({container:f})=>f.isRemoved?!0:i(f.container,!0,!0)),l=ma(e,r.endTime,[r.id]).length,s=I=>I.controls.some(f=>{var u;return(u=f.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,m=o(e),v=i(r),y=a(e),g=n?!1:l>0,R=s(r);return{isExpectTime:c,hasOtherExpect:l>0,hasOpenURIEvent:m,hasOpenURIEventInCurrentContainer:v,isAllOpenURIEventsValid:y,isExpectEventForCurrentContainer:g,hasShouldOpenNowEvent:R}};var ge=class extends Dt{constructor(t,n){super(t);this.manifest=null;this.chapter=null;this.media=null;this.graph=null;this.prevChapter$=new va.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:ot},result:null,errors:null,source:t});return n.errors&&this.errorHandler(n.errors),this.manifest=yield ta((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:tn,getChapter:Wt,getMedia:rn,getByBranches:this.getByBranches.bind(this),addErrorMessage:ot},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=rn(this.manifest.media,i.videoId),a=tn(this.manifest.graph,i.id);if(o)return{chapter:i,media:o,graph:a}}return null}getBranches(t=(n=>(n=this.chapter)==null?void 0:n.id)()){var i,o,a;if(t===((i=this.chapter)==null?void 0:i.id))return this.getByBranches((o=this.chapter)==null?void 0:o.branches);{let l=Wt(((a=this.manifest)==null?void 0:a.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 Ka=Q(Xt(),1),Qa=require("@vkontakte/videoplayer-core/es2015"),he=require("@vkontakte/videoplayer-shared/es2015");var za=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 Wa=Q(Xt(),1);function cn(){let r=new Map;function e(s){var c=s,{listId:o=Math.random().toString(),itemId:a=Math.random().toString()}=c,l=ee(c,["listId","itemId"]);let m=r.get(o),v=d({},l);return m?m[a]=v:r.set(o,{[a]:v}),d({listId:o,itemId:a},l)}function t(o){var a,l;o.player.destroy(),o.container.remove(),o.subscription.unsubscribe(),(a=o.statistics)==null||a.oneStat.destroy(),(l=o.statistics)==null||l.statSubscription.unsubscribe()}function n(o,a){let l=r.get(o);if(!l)throw Error("Can't remove. Not find.");if(a){let s=l[a];s&&t(s),delete l[a],Object.keys(l).length||r.delete(o)}else{for(let s of(0,Wa.default)(l))t(s);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(lt(),1);function un(r,e=[]){var o,a,l;let t={},n,i=!e.length;for(let s of r.variants)if(!n&&"cover"in s&&(n=s.cover),"url"in s)switch(s.type.toLowerCase()){case"mp4":(i||(0,Ne.default)(e,"mp4"))&&(t.MPEG=T(d({},t.MPEG),{[(o=s.standard)!=null?o:"Invariant quality"]:s.url}));break;case"mpeg":(i||(0,Ne.default)(e,"mpeg"))&&(t.MPEG=T(d({},t.MPEG),{[(a=s.standard)!=null?a:"Invariant quality"]:s.url}));break;case"hls":(i||(0,Ne.default)(e,"hls"))&&(t=T(d({},t),{HLS:{type:"url",url:s.url}}));break;case"dash":(i||(0,Ne.default)(e,"dash"))&&(t=T(d({},t),{DASH_SEP:{compatibilityMode:!0,type:"url",url:s.url}}));break;default:break}return{sources:t,thumbUrl:n,title:(l=r.title)!=null?l:""}}var ut=(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 Op=2;function pn(r){let e=cn(),t=new he.Subscription,n={},i=null,o=!1,a,l=new he.ValueSubject(null);r&&s(r);function s(f){i=f}function c(f,u,p){var A;if(!i)throw Error("need to set interactive controller");if(!i.options)return;let x=((A=e.map.get(f))!=null?A:{})[u];if(x){n=d({chapterId:p,listId:f,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 j of e.map)(0,Ka.default)(j[1]).forEach(({player:L})=>{ut(L,S)})})).add(C.events.started$.subscribe(()=>{m(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 m(f){return O(this,null,function*(){if(!i)throw Error("need to set interactive controller");if(de(n)||f!==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:f},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 j of e.map)if(j[0]===u.id&&!i.state.isReplay$.getValue()){let L=Object.keys(j[1]);for(let F of L)F===n.itemId?(L.length<Op||(V=!0),e.removePlayer(j[0],F)):(V=!0,c(j[0],F,f),H?ut(n.player,x):n.player.setAutoQuality(!0),n.player.setVolume(C),n.player.setMuted(b),n.player.setPlaybackRate(S))}else e.removePlayer(j[0]);V||(yield y({media:u,chapterId:f,setAsActive:!0,playbackRate:S}),H?ut(n.player,x):n.player.setAutoQuality(!0),n.player.setVolume(C),n.player.setMuted(b))})}function y(H){return O(this,arguments,function*({media:f,chapterId:u,prefetch:p=!0,setAsActive:b=!0,autoplay:x=!1,preferredExt:A,title:C,playbackRate:S}){var xn,Tn,Sn,wn,An;let V=Math.random().toString(),j=document.createElement("div");a.append(j);let L;if((xn=i==null?void 0:i.options)!=null&&xn.vkVideoLoader){let ft=za(f);ft.length&&(L=yield i.options.vkVideoLoader(...ft))}let F=((Tn=i==null?void 0:i.options)==null?void 0:Tn.coreConfig)||void 0,Te=T(d({},F),{configName:[...(Sn=F==null?void 0:F.configName)!=null?Sn:[],"interactive"]}),oe=T(d({container:j},((wn=L==null?void 0:L.videos)==null?void 0:wn[0])||{sources:un(f,A).sources}),{title:C,failoverHosts:(L==null?void 0:L.failoverHosts)||[]}),J=new Qa.Player(Te,he.Tracer.createRootTracer());J.initVideo(oe);let En=null;if(L!=null&&L.videos&&(i!=null&&i.options.createOneStat)){let ft=L.videos[0],ir=i.options.createOneStat(ft),Rn=new he.Subscription;ir&&(Rn.add(ir.attachTo(J)),En={oneStat:ir,statSubscription:Rn})}let In=new he.Subscription,il=(An=n==null?void 0:n.player)==null?void 0:An.info.isAutoQualityEnabled$.getValue();In.add(J.events.canplay$.subscribe(function(){il||ut(J,n.player.info.currentQuality$.getValue()),S&&J.setPlaybackRate(S)}));let Se=e.createPlayer({listId:f.id,itemId:V,player:J,container:j,sources:un(f,A).sources,config:oe,subscription:In,statistics:En});return b&&c(f.id,Se.itemId,u),x&&Se.player.play(),p&&!x&&Se.player.prepare(),{player:Se.player,config:Se.config,statistics:Se.statistics}})}function g(){R(),i=null,a.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(),a=document.createElement("div");let{media:f,chapter:u}=i.getCurrentChapter();f&&u?(t.add(i.events.chapterChanged$.subscribe(v)),yield y({media:f,chapterId:u.id,title:u.label})):console.error("not found")})}return T(d({},e),{init:I,setInteractiveController:s,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"},je={visibility:"visibility",watchAgainClicked:"watchAgainClicked"},N={actionChoiceCanceled:"action-choice-canceled",actionChoice:"action-choice",actionExecution:"action-execution",visibility:"visibility",containerRemoved:"container-removed",rangeEnded:"range-ended"};var Ya=Q(lt(),1),Za=require("@vkontakte/videoplayer-shared/es2015");function hn(r){return function(...t){return r(...t.reverse())}}function pt(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:a,globalEventEmitter:l,getContainerEventState:s,permanentTextControls:c,interactiveTimeOpenUri:m,disabledControls$:v,onRemove:y,onError:g}){this.hide=()=>{setTimeout(()=>{var e,t;this.gameState!==4&&(be(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:a}=this.getContainerEventState();if((n=(t=this.container).show)==null||n.call(t),this.interactiveTimeOpenUri&&a)return;this.emitContainerVisibilityEvent(!0,!1)}else{let a={isDisabled:()=>this.container.isDisabled,branches:this.branches,containerId:this.container.container.id,onDetachContainer:()=>{this.removeView(),this.emitContainerVisibilityEvent(!1)},onEvent:(s,c)=>{let{isExpectTime:m,hasOtherExpect:v,hasOpenURIEvent:y,hasOpenURIEventInCurrentContainer:g,isAllOpenURIEventsValid:R,hasShouldOpenNowEvent:I}=this.getContainerEventState(),f=this.interactiveTimeOpenUri&&!g,u=this.interactiveTimeOpenUri&&g;if((!this.interactiveTimeOpenUri||f)&&(this.isSelectedControlEvent=!0),s!==!1){if(!this.selectBranches.state.isExpect&&(!this.interactiveTimeOpenUri||f)){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)(m,v,R,this.isSelectedContainerEvent);this.fakeRemoveView(b)}else this.removeView(),this.emitContainerVisibilityEvent(!1);(!m||!v||!I)&&(this.selectBranches.stopExpect(),c())}},isEOV:()=>this.gameState===4},l=pt(this.selectBranches.onControlEvent,a);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,m,v;let e=this.player.experimental.element$.getValue(),n=e instanceof HTMLVideoElement?e.readyState:void 0,i=[6,5];if(!n||(0,Ya.default)(i,this.gameState)&&!this.isPermanentText)return;let o=this.player.getExactTime();if(da(o,this.container.container))this.gameState!==1&&(this.gameState=1,this.onBeforeStartTime());else if(on(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"&&((m=(c=this.container).hide)==null||m.call(c)),this.container.isRemoved||this.fakeRemoveView())}!this.isPermanentText&&!R&&this.removeView()}let a=on(o,this.container.container),l=this.container.container.startTime?[this.container.container.startTime,(v=this.container.container.endTime)!=null?v:1/0]:[],s={subjectId:this.container.container.id,subjectName:"container",range:l,currentTime:o,isInteractiveTime:a};this.container.onProgress(o*1e3,a),this.globalEventEmitter.emit(P.eachTick,s),this.globalEvents.eachTick$.next(s)};this.container=t,this.branches=n,this.selectBranches=i,this.subscription=new Za.Subscription,this.player=e,this.interactiveEvents=o,this.getContainerEventState=s,this.isPermanentText=c&&Ce(t.container.controls),this.interactiveTimeOpenUri=m,this.disabledControls$=v,this.onRemove=y,this.globalEventEmitter=l,this.gameState=0,this.globalEvents=a,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:N.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:N.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:be(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:N.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 Ja=(r=[])=>r.reduce((e,t,n)=>{var o,a,l;let i=((o=t==null?void 0:t.controls)!=null?o:[]).filter(s=>!it(s));if(Kt(i)){let s=[(a=t.startTime)!=null?a:0,(l=t.endTime)!=null?l:1/0],c={id:t.id,isRemoved:!1};if(!n)e.push({subjects:[c],range:s});else{let m=[],v=-1/0,y=1/0,g=[],R=[];for(let I=0;I<e.length;I++){let f=e[I];if(R.push(...f.subjects),f.range[0]<y&&(y=f.range[0]),f.range[1]>v&&(v=f.range[1]),s[0]>=f.range[0]&&s[1]<=f.range[1])return e[I].subjects.push(c),e;s[0]<f.range[0]&&s[1]>f.range[0]&&(m.push(I),g=g.concat(f.subjects)),s[0]>=f.range[0]&&s[0]<=f.range[1]&&(m.push(I),g=g.concat(f.subjects),s[0]=f.range[0]),s[1]>=f.range[0]&&s[1]<=f.range[1]&&(m.push(I),g=g.concat(f.subjects),s[1]=f.range[1])}if(R.push(c),s[0]<=y&&s[1]>=v)return[{subjects:R,range:s}];m.length&&m.reverse().forEach(I=>{e.splice(I,1)}),e.push({subjects:g.concat([c]),range:s})}}return e},[]).sort((e,t)=>e.range[0]-t.range[0]);var Ls=Q(lt(),1),vn=Q(Xt(),1),Ns=Q(Vs(),1);function Ms(){let r={};function e(){for(let l in r)Object.prototype.hasOwnProperty.call(r,l)&&delete r[l]}function t(l){let s={};for(let c in r)+c<=l&&(s[c]=r[c]);return s}function n(l){let s={};for(let c in r)+c>=l&&(s[c]=r[c]);return s}function i({timestamp:l,priority:s,initiator:c}){var m;if(sr(l)){let v=(m=r[l])!=null?m:null;if(v&&s&&qe(s,!0)){let y={},g=v[s];if(g&&(y=d(d({},y),g)),y=de(y)?null:y,y&&qe(c,!0)){let R=y[c];return R!=null?R:null}return y}return v}return null}function o({timestamp:l,priority:s,initiator:c}){if(sr(l))if(r[l]){if(s&&qe(s,!0))if(r[l][s]){if(c&&qe(c,!0))if(r[l][s][c]){if(delete r[l][s][c],!de(r[l][s]))return!0}else return!1;if(delete r[l][s],!de(r[l]))return!0}else return!1;return delete r[l]}else return!1;return!1}function a(v){var y=v,{timestamp:l,priority:s,initiator:c}=y,m=ee(y,["timestamp","priority","initiator"]);var g,R,I;(R=(g=r[l])==null?void 0:g[s])!=null&&R[c]?r[l][s][c].push(d({},m)):(I=r[l])!=null&&I[s]?r[l][s]=T(d({},r[l][s]),{[c]:[d({},m)]}):r[l]?r[l]=T(d({},r[l]),{[s]:{[c]:[d({},m)]}}):r[l]={[s]:{[c]:[d({},m)]}}}return{map:r,remove:o,add:a,removeAll:e,get:i,getLte:t,getGte:n}}var bh=[E.EventActionTypes.expect,E.EventActionTypes.setNextBranch],Ch=1/0;function js(r,e){let t=r,n,i=gh(e),o=Ms(),a,l=()=>{g(),u()},s=p=>{o.add.call(void 0,p),R()},c=(p=[])=>{for(let b of p)if(b.action(),(0,Ls.default)(bh,b.actionType))break},m=(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(m(p))},y=()=>{var p;c([...Jt((p=o.get({timestamp:1/0,priority:"chapter"}))!=null?p:{})])},g=()=>{n&&(a==null||a.unsubscribe(),n=void 0)},R=()=>{n||(n=()=>setTimeout(()=>{v(1/0)}),a=t.events.ended$.subscribe(n))},I=p=>{g(),t=p},f=p=>{p.priority==="container"&&i.resetCalled(p.timestamp),o.remove(p)},u=()=>{i.release(),o.removeAll()};return{setPlayer:I,add:s,remove:f,exec:v,execEndOfVideo:y,listen:R,unlisten:g,release:l,containersEventsCallState:i,getPreparedToExecActions:m}}function gh(r){let e=new Map;return{setCalled:({timestamp:l,id:s})=>{let c=e.get(l);c&&c[s]!==void 0&&(c[s]=!0)},setData:(l=[])=>{var s;for(let c of l){let m=(s=c.endTime)!=null?s:Ch,v=e.get(m);e.set(m,T(d({},v),{[c.id]:!1}))}},resetCalled:l=>{let s=e.get(l);if(s)for(let c in s)s[c]=!1},isReady:l=>{let s=e.get(l);if(!s)return!0;let c=(0,vn.default)(s);return r?c.some(v=>v):!c.some(v=>!v)},release:()=>e.clear()}}function Jt(r){return(0,Ns.default)((0,vn.default)(r)).sort(e=>e.actionType===E.EventActionTypes.expect?-1:1)}var _s={videoContentHeight:0,videoContentWidth:0},$s=r=>{let{height:e,width:t}=r.info.intrinsicVideoSize$.getValue()||{};if(!(e&&t))return _s;let{clientHeight:n,clientWidth:i}=r.experimental.element$.getValue()||{};if(!(n&&i))return _s;let o=e/t,a=n/i,l,s;return a>o?(s=i,l=i*o):a<o?(s=n/o,l=n):(s=i,l=n),{videoContentWidth:s,videoContentHeight:l}};var Eh=250;function Fs(r){let e,t=new ResizeObserver(l=>{o(l),e=o.bind(null,l)});function n(l){let{parentElement:s,player:c}=r();if(s&&c){let{videoContentWidth:m,videoContentHeight:v}=$s(c);s.style.setProperty("--interactive-content-width",`${m}px`),s.style.setProperty("--interactive-content-height",`${v}px`),s.style.setProperty("--interactive-width",`${l[0].contentRect.width}px`),s.style.setProperty("--interactive-height",`${l[0].contentRect.height}px`)}}function i(){let{parentElement:l}=r();l.removeAttribute("style")}let o=tt(l=>{let{fns:s=[]}=r();n(l);for(let c of s)c()},Eh);function a(){e=void 0,t.disconnect(),i()}return{resizeObserver:t,calc:()=>{e==null||e()},release:a}}var Ih=r=>Math.floor(Math.random()*r),qs=r=>{var i;let e=r.length,t=1/0,n=null;for(;e--;){let o=r[e],a=(i=o.weight)!=null?i:1;a<t&&(t=a,n=o)}return n},Ds=r=>{var i;let e=r.length,t=-1/0,n=null;for(;e--;){let o=r[e],a=(i=o.weight)!=null?i:0;a>t&&(t=a,n=o)}return n};var Hs=r=>{let e=r.length,t=Ih(e);return r[t]},Bs=1,Us=r=>{var n,i;let e=0;for(let o=0;o<r.length;++o)e+=(n=r[o].weight)!=null?n:Bs;let t=Math.random()*e;e=0;for(let o=0;o<r.length-1;++o)if(e+=(i=r[o].weight)!=null?i:Bs,e>=t)return r[o];return r[r.length-1]};var Gs={shouldOpenNow:!0,isDetachContainer:!0},zs="after-expect",yn=(r,e=!1)=>T(d({},r),{args:e?d(d({},r.args),Gs):d(d({},Gs),r.args)}),Ws=({globalEventEmitter:r,globalEvents:e,player:t,interactiveEvents:n})=>{let i={isExpect:!1},o=()=>{i.isExpect&&(i.isExpect=!1)},a=({action:u,controlType:p,controlId:b,containerId:x,branches:A=[],onEvent:C,isEOV:S=()=>!1,isDisabled:H=()=>!1})=>{let V=yn(u,S()),j={timestamp:1/0,priority:"control",initiator:b,actionType:V.type},L=H(),F=r.emit.bind(r,P.interactives,{subjectId:b,subjectType:p,subjectName:"control",type:L?N.actionChoiceCanceled:N.actionChoice,actionType:u.type,payload:d({invokeImmediately:V.args.shouldOpenNow,containerId:x},V.args)}),Te=()=>{e.interactiveActionChoice$.next({subjectId:b,subjectType:p,subjectName:"control",type:L?"action-choice-canceled":"action-choice",actionType:u.type,payload:d({invokeImmediately:V.args.shouldOpenNow,containerId:x},V.args)})};if(L){F(),Te();return}switch(V.type.trim().toLowerCase()){case E.EventActionTypes.setNextBranch.trim().toLowerCase():{let oe=A.find(J=>J.id===V.args.branchId);if(!oe)return;C(V.args.isDetachContainer,g.bind(null,{subjectId:b,subjectName:"control"})),F(),Te(),V.args.shouldOpenNow?I({subjectId:b,subjectName:"control",subjectType:p,action:V,payload:{chapterId:oe.chapterId,autoSelect:!1}}):n.add(T(d({},j),{action:I.bind(null,{subjectId:b,subjectName:"control",subjectType:p,action:V,payload:{chapterId:oe.chapterId,autoSelect:!1}})}));return}case E.EventActionTypes.continuePlayback.trim().toLowerCase():{C(V.args.isDetachContainer,g.bind(null,{subjectId:b,subjectName:"control"})),F(),Te(),V.args.shouldOpenNow?R({subjectId:b,subjectName:"control",subjectType:p,action:u}):n.add(T(d({},j),{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"})),F(),Te(),V.args.shouldOpenNow?f({subjectId:b,subjectName:"control",subjectType:p,action:V,payload:{URI:u.args.uri}}):n.add(T(d({},j),{action:f.bind(null,{subjectId:b,subjectName:"control",subjectType:p,action:V,payload:{URI:u.args.uri}})}));return}default:{let oe="Unexpected control event",J=new B(1,1,{message:oe});m(J,oe);return}}},l=({action:u,container:{id:p,endTime:b},branches:x=[],isEOV:A=!1,autoSelected:C=!1})=>{let S=yn(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:N.actionChoice,actionType:S.type,payload:d({invokeImmediately:S.args.shouldOpenNow},S.args)}),j=()=>{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 L=x.find(F=>F.id===S.args.branchId);if(!L)return;V(),j(),n.add(T(d({},H),{action:I.bind(null,{subjectId:p,subjectName:"container",action:S,payload:{chapterId:L.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(),j(),n.add(T(d({},H),{action:R.bind(null,{subjectId:p,subjectName:"container",action:S})}));return}case E.EventActionTypes.openURI.trim().toLowerCase():{V(),j(),n.add(T(d({},H),{action:f.bind(null,{subjectId:p,subjectName:"container",action:S,payload:{URI:u.args.uri}})}));return}default:{let L="Unexpected container event",F=new B(1,1,{message:L});m(F,L);return}}};function s({container:u,branches:p,isEOV:b=!1}){var A,C;let x=an(u.events);if(x){let S=yn(x.action,b);r.emit(P.interactives,{subjectId:u.id,subjectName:"container",type:N.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:N.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=Hs(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=Us(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=Ds(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=qs(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(),f.bind(null,{subjectId:u,subjectName:"chapter",action:p,payload:{URI:p.args.uri}});default:{let C="Unexpected chapter event",S=new B(1,1,{message:C});m(S,C);return}}};function m(u,p){console.error(p),e.error$.next(u),r.emit(P.errors,u)}function v(u){var b;let p=an(u.events);if(p){if(Z(u))return;r.emit(P.interactives,{subjectId:u.id,subjectName:"chapter",type:N.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:N.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:N.actionExecution,actionType:zs}),e.interactiveActionExecution$.next({subjectId:u,subjectName:p,type:"action-execution",actionType:zs})},R=({subjectId:u,subjectName:p,subjectType:b,action:x})=>{r.emit(P.interactives,{subjectId:u,subjectName:p,subjectType:b,type:N.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:N.actionExecution,actionType:x.type,payload:A}),e.interactiveActionExecution$.next({subjectId:u,subjectName:p,subjectType:b,type:"action-execution",actionType:x.type,payload:A})},f=({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:N.actionExecution,actionType:x.type}),e.interactiveActionExecution$.next({subjectId:u,subjectName:p,subjectType:b,type:"action-execution",actionType:x.type})};return{onControlEvent:a,onContainerEvent:l,onChapterEvent:c,onExpectEvent:y,expectEventHandler:g,setManifestChapterEvents:v,setManifestContainerEvents:s,stopExpect:o,state:i}};var gn=Q(Xr(),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(a=>a.id===n);if(!i)return null;let o=e.media.videos.find(a=>i.videoId===a.id);if(!o)return null;t[n]=bn(o)}return t[n]}).filter(Boolean)},Ks=r=>{for(let e of r.variants)if(Qs(e)&&e.payload)return e.payload.id},Qs=r=>!!(r.type==="custom"&&r.payload&&r.payload.type==="vk"),bn=r=>{let e=Ks(r);if(!e)return null;let t=e.split("_").pop();return t?parseInt(t,10):null},Xs=(r,e)=>{for(let t of r.media.videos)if(e===bn(t)){for(let n of r.chapters)if(n.videoId===t.id)return n.id;return}},Cn=(r,e)=>r.reduce((t,n)=>{let i=Xs(e,n);return i?[...t,i]:t},[]);var ae,Ee,Ie,W,tr,se,le,ie,xe,_e,$e,dt=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,ae,null);U(this,Ee);U(this,Ie,!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,le,null);U(this,ie,null);U(this,xe,new K.Subscription);U(this,_e,!1);U(this,$e,0);var a;$(this,se,t),$(this,ie,e),$(this,le,n),$(this,ae,i),$(this,Ee,o),this.state.history$&&k(this,xe)&&((a=k(this,xe))==null||a.add(this.state.history$.subscribe(l=>{var s,c;this.state.prevChapter$.next((0,gn.default)(l,-2)||null),this.state.hasPrevChapter$.next(l.length>1),this.state.isInitialChapter$.next(this.getInitialChapterId()===((c=(s=k(this,W))==null?void 0:s.metadata)==null?void 0:c.initChapterId)),this.state.isGoBackLimited$.next(k(this,$e)===k(this,Ee).maxLength-1)})))}setManifest(e){return O(this,null,function*(){if(!k(this,le)||!k(this,ie))return;$(this,W,e),yield this.getProjectHistory();let t=this.getInitialChapterId();yield k(this,le).setChapter({chapterId:t,pushToHistory:!1}),k(this,Ie)||($(this,Ie,!0),this.events.inited$.next({initChapterId:t}))})}get inited(){return k(this,Ie)}updateHistory(e,t=!0){return O(this,null,function*(){var l;if(!k(this,W))return;k(this,_e)?($(this,_e,!1),Ln(this,$e)._++):$(this,$e,0);let n=k(this,W),i=e.length-k(this,Ee).maxLength,o=i>0?e.slice(i):e,a=er(o,n);if($(this,tr,a),this.state.history$.next(o),!(!t||!k(this,ae)||!k(this,se)))try{yield k(this,ae).save(k(this,se),a)}catch(s){let c=new B(1,5,"Unable to save interactive history");this.events.error$.next(c),(l=k(this,ie))==null||l.emit(P.errors,c)}})}goBack(){return O(this,null,function*(){var n;if(!this.state||!k(this,le)){let i=new B(1,5,"Unable to save interactive history");return this.events.error$.next(i),(n=k(this,ie))==null?void 0:n.emit(P.errors,i)}$(this,_e,!0);let e=this.state.history$.getValue().slice(0,-1),t=e.pop();this.state.history$.next(e),yield k(this,le).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,ae))try{let o=yield k(this,ae).get(k(this,se));o.length&&(t=o)}catch(o){let a=new B(1,5,"Error while trying to fetch data");this.events.error$.next(a),(i=k(this,ie))==null||i.emit(P.errors,a)}let n=Cn(t,e);this.state.history$.next(n)})}getInitialChapterId(){var t;let e=this.state.history$.getValue();return(0,gn.default)(e,-1)||k(this,Ee).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;$(this,se,null),$(this,ae,null),$(this,le,null),(e=k(this,xe))==null||e.unsubscribe(),$(this,xe,null),$(this,Ie,!1),(t=k(this,ie))==null||t.emit(P.historyDestroyed),this.events.destroyed$.next(),$(this,ie,null)}};ae=new WeakMap,Ee=new WeakMap,Ie=new WeakMap,W=new WeakMap,tr=new WeakMap,se=new WeakMap,le=new WeakMap,ie=new WeakMap,xe=new WeakMap,_e=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 El=Object.create;var He=Object.defineProperty,Tl=Object.defineProperties,Il=Object.getOwnPropertyDescriptor,xl=Object.getOwnPropertyDescriptors,Al=Object.getOwnPropertyNames,yt=Object.getOwnPropertySymbols,wl=Object.getPrototypeOf,pr=Object.prototype.hasOwnProperty,Vi=Object.prototype.propertyIsEnumerable;var Mi=r=>{throw TypeError(r)};var Fi=(r,e,t)=>e in r?He(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,f=(r,e)=>{for(var t in e||(e={}))pr.call(e,t)&&Fi(r,t,e[t]);if(yt)for(var t of yt(e))Vi.call(e,t)&&Fi(r,t,e[t]);return r},w=(r,e)=>Tl(r,xl(e));var ee=(r,e)=>{var t={};for(var i in r)pr.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&yt)for(var i of yt(r))e.indexOf(i)<0&&Vi.call(r,i)&&(t[i]=r[i]);return t};var p=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Sl=(r,e)=>{for(var t in e)He(r,t,{get:e[t],enumerable:!0})},Ni=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Al(e))!pr.call(r,n)&&n!==t&&He(r,n,{get:()=>e[n],enumerable:!(i=Il(e,n))||i.enumerable});return r};var te=(r,e,t)=>(t=r!=null?El(wl(r)):{},Ni(e||!r||!r.__esModule?He(t,"default",{value:r,enumerable:!0}):t,r)),Rl=r=>Ni(He({},"__esModule",{value:!0}),r);var $i=(r,e,t)=>e.has(r)||Mi("Cannot "+t);var O=(r,e,t)=>($i(r,e,"read from private field"),t?t.call(r):e.get(r)),G=(r,e,t)=>e.has(r)?Mi("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),$=(r,e,t,i)=>($i(r,e,"write to private field"),i?i.call(r,t):e.set(r,t),t);var ji=(r,e,t,i)=>({set _(n){$(r,e,n,t)},get _(){return O(r,e,i)}});var k=(r,e,t)=>new Promise((i,n)=>{var o=s=>{try{l(t.next(s))}catch(c){n(c)}},a=s=>{try{l(t.throw(s))}catch(c){n(c)}},l=s=>s.done?i(s.value):Promise.resolve(s.value).then(o,a);l((t=t.apply(r,e)).next())});var ie=p((Cr,Yi)=>{"use strict";var We=function(r){return r&&r.Math===Math&&r};Yi.exports=We(typeof globalThis=="object"&&globalThis)||We(typeof window=="object"&&window)||We(typeof self=="object"&&self)||We(typeof global=="object"&&global)||We(typeof Cr=="object"&&Cr)||function(){return this}()||Function("return this")()});var z=p((Cd,Zi)=>{"use strict";Zi.exports=function(r){try{return!!r()}catch(e){return!0}}});var Ke=p((Ed,Ji)=>{"use strict";var Pl=z();Ji.exports=!Pl(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var on=p((Td,nn)=>{"use strict";var _l=Ke(),rn=Function.prototype,en=rn.apply,tn=rn.call;nn.exports=typeof Reflect=="object"&&Reflect.apply||(_l?tn.bind(en):function(){return tn.apply(en,arguments)})});var X=p((Id,ln)=>{"use strict";var an=Ke(),sn=Function.prototype,Er=sn.call,Ll=an&&sn.bind.bind(Er,Er);ln.exports=an?Ll:function(r){return function(){return Er.apply(r,arguments)}}});var Qe=p((xd,un)=>{"use strict";var cn=X(),Fl=cn({}.toString),Vl=cn("".slice);un.exports=function(r){return Vl(Fl(r),8,-1)}});var Tr=p((Ad,pn)=>{"use strict";var Ml=Qe(),Nl=X();pn.exports=function(r){if(Ml(r)==="Function")return Nl(r)}});var W=p((wd,hn)=>{"use strict";var Ir=typeof document=="object"&&document.all;hn.exports=typeof Ir=="undefined"&&Ir!==void 0?function(r){return typeof r=="function"||r===Ir}:function(r){return typeof r=="function"}});var ge=p((Sd,dn)=>{"use strict";var $l=z();dn.exports=!$l(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var Ot=p((Rd,mn)=>{"use strict";var jl=Ke(),Rt=Function.prototype.call;mn.exports=jl?Rt.bind(Rt):function(){return Rt.apply(Rt,arguments)}});var xr=p(bn=>{"use strict";var fn={}.propertyIsEnumerable,vn=Object.getOwnPropertyDescriptor,Bl=vn&&!fn.call({1:2},1);bn.f=Bl?function(e){var t=vn(this,e);return!!t&&t.enumerable}:fn});var Ar=p((kd,yn)=>{"use strict";yn.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var Cn=p((Pd,gn)=>{"use strict";var ql=X(),Dl=z(),Hl=Qe(),wr=Object,Ul=ql("".split);gn.exports=Dl(function(){return!wr("z").propertyIsEnumerable(0)})?function(r){return Hl(r)==="String"?Ul(r,""):wr(r)}:wr});var Sr=p((_d,En)=>{"use strict";En.exports=function(r){return r==null}});var Rr=p((Ld,Tn)=>{"use strict";var Gl=Sr(),zl=TypeError;Tn.exports=function(r){if(Gl(r))throw new zl("Can't call method on "+r);return r}});var Xe=p((Fd,In)=>{"use strict";var Wl=Cn(),Kl=Rr();In.exports=function(r){return Wl(Kl(r))}});var _e=p((Vd,xn)=>{"use strict";var Ql=W();xn.exports=function(r){return typeof r=="object"?r!==null:Ql(r)}});var kt=p((Md,An)=>{"use strict";An.exports={}});var Pt=p((Nd,Sn)=>{"use strict";var Or=kt(),kr=ie(),Xl=W(),wn=function(r){return Xl(r)?r:void 0};Sn.exports=function(r,e){return arguments.length<2?wn(Or[r])||wn(kr[r]):Or[r]&&Or[r][e]||kr[r]&&kr[r][e]}});var On=p(($d,Rn)=>{"use strict";var Yl=X();Rn.exports=Yl({}.isPrototypeOf)});var Ln=p((jd,_n)=>{"use strict";var Zl=ie(),kn=Zl.navigator,Pn=kn&&kn.userAgent;_n.exports=Pn?String(Pn):""});var Bn=p((Bd,jn)=>{"use strict";var $n=ie(),Pr=Ln(),Fn=$n.process,Vn=$n.Deno,Mn=Fn&&Fn.versions||Vn&&Vn.version,Nn=Mn&&Mn.v8,Y,_t;Nn&&(Y=Nn.split("."),_t=Y[0]>0&&Y[0]<4?1:+(Y[0]+Y[1]));!_t&&Pr&&(Y=Pr.match(/Edge\/(\d+)/),(!Y||Y[1]>=74)&&(Y=Pr.match(/Chrome\/(\d+)/),Y&&(_t=+Y[1])));jn.exports=_t});var _r=p((qd,Dn)=>{"use strict";var qn=Bn(),Jl=z(),ec=ie(),tc=ec.String;Dn.exports=!!Object.getOwnPropertySymbols&&!Jl(function(){var r=Symbol("symbol detection");return!tc(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&qn&&qn<41})});var Lr=p((Dd,Hn)=>{"use strict";var rc=_r();Hn.exports=rc&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Fr=p((Hd,Un)=>{"use strict";var ic=Pt(),nc=W(),oc=On(),ac=Lr(),sc=Object;Un.exports=ac?function(r){return typeof r=="symbol"}:function(r){var e=ic("Symbol");return nc(e)&&oc(e.prototype,sc(r))}});var zn=p((Ud,Gn)=>{"use strict";var lc=String;Gn.exports=function(r){try{return lc(r)}catch(e){return"Object"}}});var Vr=p((Gd,Wn)=>{"use strict";var cc=W(),uc=zn(),pc=TypeError;Wn.exports=function(r){if(cc(r))return r;throw new pc(uc(r)+" is not a function")}});var Qn=p((zd,Kn)=>{"use strict";var hc=Vr(),dc=Sr();Kn.exports=function(r,e){var t=r[e];return dc(t)?void 0:hc(t)}});var Yn=p((Wd,Xn)=>{"use strict";var Mr=Ot(),Nr=W(),$r=_e(),mc=TypeError;Xn.exports=function(r,e){var t,i;if(e==="string"&&Nr(t=r.toString)&&!$r(i=Mr(t,r))||Nr(t=r.valueOf)&&!$r(i=Mr(t,r))||e!=="string"&&Nr(t=r.toString)&&!$r(i=Mr(t,r)))return i;throw new mc("Can't convert object to primitive value")}});var Jn=p((Kd,Zn)=>{"use strict";Zn.exports=!0});var ro=p((Qd,to)=>{"use strict";var eo=ie(),fc=Object.defineProperty;to.exports=function(r,e){try{fc(eo,r,{value:e,configurable:!0,writable:!0})}catch(t){eo[r]=e}return e}});var Lt=p((Xd,oo)=>{"use strict";var vc=Jn(),bc=ie(),yc=ro(),io="__core-js_shared__",no=oo.exports=bc[io]||yc(io,{});(no.versions||(no.versions=[])).push({version:"3.43.0",mode:vc?"pure":"global",copyright:"\xA9 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.43.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var jr=p((Yd,so)=>{"use strict";var ao=Lt();so.exports=function(r,e){return ao[r]||(ao[r]=e||{})}});var Ye=p((Zd,lo)=>{"use strict";var gc=Rr(),Cc=Object;lo.exports=function(r){return Cc(gc(r))}});var Le=p((Jd,co)=>{"use strict";var Ec=X(),Tc=Ye(),Ic=Ec({}.hasOwnProperty);co.exports=Object.hasOwn||function(e,t){return Ic(Tc(e),t)}});var Br=p((em,uo)=>{"use strict";var xc=X(),Ac=0,wc=Math.random(),Sc=xc(1.1.toString);uo.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+Sc(++Ac+wc,36)}});var Ze=p((tm,ho)=>{"use strict";var Rc=ie(),Oc=jr(),po=Le(),kc=Br(),Pc=_r(),_c=Lr(),Fe=Rc.Symbol,qr=Oc("wks"),Lc=_c?Fe.for||Fe:Fe&&Fe.withoutSetter||kc;ho.exports=function(r){return po(qr,r)||(qr[r]=Pc&&po(Fe,r)?Fe[r]:Lc("Symbol."+r)),qr[r]}});var bo=p((rm,vo)=>{"use strict";var Fc=Ot(),mo=_e(),fo=Fr(),Vc=Qn(),Mc=Yn(),Nc=Ze(),$c=TypeError,jc=Nc("toPrimitive");vo.exports=function(r,e){if(!mo(r)||fo(r))return r;var t=Vc(r,jc),i;if(t){if(e===void 0&&(e="default"),i=Fc(t,r,e),!mo(i)||fo(i))return i;throw new $c("Can't convert object to primitive value")}return e===void 0&&(e="number"),Mc(r,e)}});var Dr=p((im,yo)=>{"use strict";var Bc=bo(),qc=Fr();yo.exports=function(r){var e=Bc(r,"string");return qc(e)?e:e+""}});var Eo=p((nm,Co)=>{"use strict";var Dc=ie(),go=_e(),Hr=Dc.document,Hc=go(Hr)&&go(Hr.createElement);Co.exports=function(r){return Hc?Hr.createElement(r):{}}});var Ur=p((om,To)=>{"use strict";var Uc=ge(),Gc=z(),zc=Eo();To.exports=!Uc&&!Gc(function(){return Object.defineProperty(zc("div"),"a",{get:function(){return 7}}).a!==7})});var Ao=p(xo=>{"use strict";var Wc=ge(),Kc=Ot(),Qc=xr(),Xc=Ar(),Yc=Xe(),Zc=Dr(),Jc=Le(),eu=Ur(),Io=Object.getOwnPropertyDescriptor;xo.f=Wc?Io:function(e,t){if(e=Yc(e),t=Zc(t),eu)try{return Io(e,t)}catch(i){}if(Jc(e,t))return Xc(!Kc(Qc.f,e,t),e[t])}});var So=p((sm,wo)=>{"use strict";var tu=z(),ru=W(),iu=/#|\.prototype\./,Je=function(r,e){var t=ou[nu(r)];return t===su?!0:t===au?!1:ru(e)?tu(e):!!e},nu=Je.normalize=function(r){return String(r).replace(iu,".").toLowerCase()},ou=Je.data={},au=Je.NATIVE="N",su=Je.POLYFILL="P";wo.exports=Je});var Gr=p((lm,Oo)=>{"use strict";var Ro=Tr(),lu=Vr(),cu=Ke(),uu=Ro(Ro.bind);Oo.exports=function(r,e){return lu(r),e===void 0?r:cu?uu(r,e):function(){return r.apply(e,arguments)}}});var Po=p((cm,ko)=>{"use strict";var pu=ge(),hu=z();ko.exports=pu&&hu(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var Lo=p((um,_o)=>{"use strict";var du=_e(),mu=String,fu=TypeError;_o.exports=function(r){if(du(r))return r;throw new fu(mu(r)+" is not an object")}});var Mo=p(Vo=>{"use strict";var vu=ge(),bu=Ur(),yu=Po(),Ft=Lo(),Fo=Dr(),gu=TypeError,zr=Object.defineProperty,Cu=Object.getOwnPropertyDescriptor,Wr="enumerable",Kr="configurable",Qr="writable";Vo.f=vu?yu?function(e,t,i){if(Ft(e),t=Fo(t),Ft(i),typeof e=="function"&&t==="prototype"&&"value"in i&&Qr in i&&!i[Qr]){var n=Cu(e,t);n&&n[Qr]&&(e[t]=i.value,i={configurable:Kr in i?i[Kr]:n[Kr],enumerable:Wr in i?i[Wr]:n[Wr],writable:!1})}return zr(e,t,i)}:zr:function(e,t,i){if(Ft(e),t=Fo(t),Ft(i),bu)try{return zr(e,t,i)}catch(n){}if("get"in i||"set"in i)throw new gu("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var $o=p((hm,No)=>{"use strict";var Eu=ge(),Tu=Mo(),Iu=Ar();No.exports=Eu?function(r,e,t){return Tu.f(r,e,Iu(1,t))}:function(r,e,t){return r[e]=t,r}});var tt=p((dm,Bo)=>{"use strict";var et=ie(),xu=on(),Au=Tr(),wu=W(),Su=Ao().f,Ru=So(),Ve=kt(),Ou=Gr(),Me=$o(),jo=Le();Lt();var ku=function(r){var e=function(t,i,n){if(this instanceof e){switch(arguments.length){case 0:return new r;case 1:return new r(t);case 2:return new r(t,i)}return new r(t,i,n)}return xu(r,this,arguments)};return e.prototype=r.prototype,e};Bo.exports=function(r,e){var t=r.target,i=r.global,n=r.stat,o=r.proto,a=i?et:n?et[t]:et[t]&&et[t].prototype,l=i?Ve:Ve[t]||Me(Ve,t,{})[t],s=l.prototype,c,d,v,b,g,T,I,m,u;for(b in e)c=Ru(i?b:t+(n?".":"#")+b,r.forced),d=!c&&a&&jo(a,b),T=l[b],d&&(r.dontCallGetSet?(u=Su(a,b),I=u&&u.value):I=a[b]),g=d&&I?I:e[b],!(!c&&!o&&typeof T==typeof g)&&(r.bind&&d?m=Ou(g,et):r.wrap&&d?m=ku(g):o&&wu(g)?m=Au(g):m=g,(r.sham||g&&g.sham||T&&T.sham)&&Me(m,"sham",!0),Me(l,b,m),o&&(v=t+"Prototype",jo(Ve,v)||Me(Ve,v,{}),Me(Ve[v],b,g),r.real&&s&&(c||!s[b])&&Me(s,b,g)))}});var Do=p((mm,qo)=>{"use strict";var Pu=Math.ceil,_u=Math.floor;qo.exports=Math.trunc||function(e){var t=+e;return(t>0?_u:Pu)(t)}});var rt=p((fm,Ho)=>{"use strict";var Lu=Do();Ho.exports=function(r){var e=+r;return e!==e||e===0?0:Lu(e)}});var Go=p((vm,Uo)=>{"use strict";var Fu=rt(),Vu=Math.max,Mu=Math.min;Uo.exports=function(r,e){var t=Fu(r);return t<0?Vu(t+e,0):Mu(t,e)}});var Wo=p((bm,zo)=>{"use strict";var Nu=rt(),$u=Math.min;zo.exports=function(r){var e=Nu(r);return e>0?$u(e,9007199254740991):0}});var it=p((ym,Ko)=>{"use strict";var ju=Wo();Ko.exports=function(r){return ju(r.length)}});var Xr=p((gm,Xo)=>{"use strict";var Bu=Xe(),qu=Go(),Du=it(),Qo=function(r){return function(e,t,i){var n=Bu(e),o=Du(n);if(o===0)return!r&&-1;var a=qu(i,o),l;if(r&&t!==t){for(;o>a;)if(l=n[a++],l!==l)return!0}else for(;o>a;a++)if((r||a in n)&&n[a]===t)return r||a||0;return!r&&-1}};Xo.exports={includes:Qo(!0),indexOf:Qo(!1)}});var Vt=p((Cm,Yo)=>{"use strict";Yo.exports=function(){}});var Zo=p(()=>{"use strict";var Hu=tt(),Uu=Xr().includes,Gu=z(),zu=Vt(),Wu=Gu(function(){return!Array(1).includes()});Hu({target:"Array",proto:!0,forced:Wu},{includes:function(e){return Uu(this,e,arguments.length>1?arguments[1]:void 0)}});zu("includes")});var Mt=p((Im,Jo)=>{"use strict";var Ku=Pt();Jo.exports=Ku});var ta=p((xm,ea)=>{"use strict";Zo();var Qu=Mt();ea.exports=Qu("Array","includes")});var ia=p((Am,ra)=>{"use strict";var Xu=ta();ra.exports=Xu});var Nt=p((wm,na)=>{"use strict";var Yu=ia();na.exports=Yu});var ga=p(()=>{"use strict";var lp=tt(),cp=Ye(),up=it(),pp=rt(),hp=Vt();lp({target:"Array",proto:!0},{at:function(e){var t=cp(this),i=up(t),n=pp(e),o=n>=0?n:i+n;return o<0||o>=i?void 0:t[o]}});hp("at")});var Ea=p((zf,Ca)=>{"use strict";ga();var dp=Mt();Ca.exports=dp("Array","at")});var Ia=p((Wf,Ta)=>{"use strict";var mp=Ea();Ta.exports=mp});var si=p((Kf,xa)=>{"use strict";var fp=Ia();xa.exports=fp});var Ma=p((Dv,Va)=>{"use strict";var Ip=jr(),xp=Br(),Fa=Ip("keys");Va.exports=function(r){return Fa[r]||(Fa[r]=xp(r))}});var $a=p((Hv,Na)=>{"use strict";var Ap=z();Na.exports=!Ap(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var qa=p((Uv,Ba)=>{"use strict";var wp=Le(),Sp=W(),Rp=Ye(),Op=Ma(),kp=$a(),ja=Op("IE_PROTO"),hi=Object,Pp=hi.prototype;Ba.exports=kp?hi.getPrototypeOf:function(r){var e=Rp(r);if(wp(e,ja))return e[ja];var t=e.constructor;return Sp(t)&&e instanceof t?t.prototype:e instanceof hi?Pp:null}});var Ha=p((Gv,Da)=>{"use strict";Da.exports={}});var za=p((zv,Ga)=>{"use strict";var _p=X(),di=Le(),Lp=Xe(),Fp=Xr().indexOf,Vp=Ha(),Ua=_p([].push);Ga.exports=function(r,e){var t=Lp(r),i=0,n=[],o;for(o in t)!di(Vp,o)&&di(t,o)&&Ua(n,o);for(;e.length>i;)di(t,o=e[i++])&&(~Fp(n,o)||Ua(n,o));return n}});var Ka=p((Wv,Wa)=>{"use strict";Wa.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Xa=p((Kv,Qa)=>{"use strict";var Mp=za(),Np=Ka();Qa.exports=Object.keys||function(e){return Mp(e,Np)}});var rs=p((Qv,ts)=>{"use strict";var Za=ge(),$p=z(),Ja=X(),jp=qa(),Bp=Xa(),qp=Xe(),Dp=xr().f,es=Ja(Dp),Hp=Ja([].push),Up=Za&&$p(function(){var r=Object.create(null);return r[2]=2,!es(r,2)}),Ya=function(r){return function(e){for(var t=qp(e),i=Bp(t),n=Up&&jp(t)===null,o=i.length,a=0,l=[],s;o>a;)s=i[a++],(!Za||(n?s in t:es(t,s)))&&Hp(l,r?[s,t[s]]:t[s]);return l}};ts.exports={entries:Ya(!0),values:Ya(!1)}});var is=p(()=>{"use strict";var Gp=tt(),zp=rs().values;Gp({target:"Object",stat:!0},{values:function(e){return zp(e)}})});var os=p((Zv,ns)=>{"use strict";is();var Wp=kt();ns.exports=Wp.Object.values});var ss=p((Jv,as)=>{"use strict";var Kp=os();as.exports=Kp});var rr=p((eb,ls)=>{"use strict";var Qp=ss();ls.exports=Qp});var yi=p((Ab,vs)=>{"use strict";var Yp=Qe();vs.exports=Array.isArray||function(e){return Yp(e)==="Array"}});var ys=p((wb,bs)=>{"use strict";var Zp=TypeError,Jp=9007199254740991;bs.exports=function(r){if(r>Jp)throw Zp("Maximum allowed index exceeded");return r}});var Es=p((Sb,Cs)=>{"use strict";var eh=yi(),th=it(),rh=ys(),ih=Gr(),gs=function(r,e,t,i,n,o,a,l){for(var s=n,c=0,d=a?ih(a,l):!1,v,b;c<i;)c in t&&(v=d?d(t[c],c,e):t[c],o>0&&eh(v)?(b=th(v),s=gs(r,e,v,b,s,o-1)-1):(rh(s+1),r[s]=v),s++),c++;return s};Cs.exports=gs});var xs=p((Rb,Is)=>{"use strict";var nh=Ze(),oh=nh("toStringTag"),Ts={};Ts[oh]="z";Is.exports=String(Ts)==="[object z]"});var ws=p((Ob,As)=>{"use strict";var ah=xs(),sh=W(),nr=Qe(),lh=Ze(),ch=lh("toStringTag"),uh=Object,ph=nr(function(){return arguments}())==="Arguments",hh=function(r,e){try{return r[e]}catch(t){}};As.exports=ah?nr:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=hh(e=uh(r),ch))=="string"?t:ph?nr(e):(i=nr(e))==="Object"&&sh(e.callee)?"Arguments":i}});var Rs=p((kb,Ss)=>{"use strict";var dh=X(),mh=W(),gi=Lt(),fh=dh(Function.toString);mh(gi.inspectSource)||(gi.inspectSource=function(r){return fh(r)});Ss.exports=gi.inspectSource});var Fs=p((Pb,Ls)=>{"use strict";var vh=X(),bh=z(),Os=W(),yh=ws(),gh=Pt(),Ch=Rs(),ks=function(){},Ps=gh("Reflect","construct"),Ci=/^\s*(?:class|function)\b/,Eh=vh(Ci.exec),Th=!Ci.test(ks),mt=function(e){if(!Os(e))return!1;try{return Ps(ks,[],e),!0}catch(t){return!1}},_s=function(e){if(!Os(e))return!1;switch(yh(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Th||!!Eh(Ci,Ch(e))}catch(t){return!0}};_s.sham=!0;Ls.exports=!Ps||bh(function(){var r;return mt(mt.call)||!mt(Object)||!mt(function(){r=!0})||r})?_s:mt});var $s=p((_b,Ns)=>{"use strict";var Vs=yi(),Ih=Fs(),xh=_e(),Ah=Ze(),wh=Ah("species"),Ms=Array;Ns.exports=function(r){var e;return Vs(r)&&(e=r.constructor,Ih(e)&&(e===Ms||Vs(e.prototype))?e=void 0:xh(e)&&(e=e[wh],e===null&&(e=void 0))),e===void 0?Ms:e}});var Bs=p((Lb,js)=>{"use strict";var Sh=$s();js.exports=function(r,e){return new(Sh(r))(e===0?0:e)}});var qs=p(()=>{"use strict";var Rh=tt(),Oh=Es(),kh=Ye(),Ph=it(),_h=rt(),Lh=Bs();Rh({target:"Array",proto:!0},{flat:function(){var e=arguments.length?arguments[0]:void 0,t=kh(this),i=Ph(t),n=Lh(t,0);return n.length=Oh(n,t,t,i,0,e===void 0?1:_h(e)),n}})});var Ds=p(()=>{"use strict";var Fh=Vt();Fh("flat")});var Us=p(($b,Hs)=>{"use strict";qs();Ds();var Vh=Mt();Hs.exports=Vh("Array","flat")});var zs=p((jb,Gs)=>{"use strict";var Mh=Us();Gs.exports=Mh});var Ks=p((Bb,Ws)=>{"use strict";var Nh=zs();Ws.exports=Nh});var Wh={};Sl(Wh,{ContainerTypes:()=>E.ContainerTypes,ControlTypes:()=>E.ControlTypes,CustomError:()=>B,EVENT_NAMES:()=>_,EventActionTypes:()=>E.EventActionTypes,EventTypes:()=>E.EventTypes,Interactives:()=>vt,ManifestController:()=>Ie,SDKInfo:()=>zh,chapterIdsToVKVideoIds:()=>ar,compareVersions:()=>er,containerTypes:()=>ep,controlTypes:()=>tp,eventActionTypes:()=>ip,eventTypes:()=>rp,getChapterIdByVkVideoId:()=>hl,getVKVideoIdByMedia:()=>Ii,getVideoRawIdByMedia:()=>ul,graphEventTypes:()=>je,hasEndTemplate:()=>ot,interactivesEventTypes:()=>N,isAreaControl:()=>Ju,isButtonControl:()=>Zu,isLastChapter:()=>Z,isOneTextCtrlContainer:()=>Ee,isSupportedManifest:()=>E.isSupportedManifest,isTextControl:()=>nt,isVKVariantItem:()=>pl,isValidManifest:()=>Yr,migrateManifestToLatestVersion:()=>E.migrateManifestToLatestVersion,utils:()=>gl,vkVideoIdsToChapterIds:()=>xi});module.exports=Rl(Wh);var Bi="1.0.39-dev.f4da114d.0";var at=require("@vkontakte/videoplayer-shared/es2015");var hr=class{constructor(e){this.layout=e}},gt=class extends hr{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} + ${2e-4}))`,e.style.height=`calc(var(--interactive-content-height) * ${t.height})`,e.style.left=`calc(var(--interactive-content-width) * ${t.x} + ((var(--interactive-width) - var(--interactive-content-width)) / 2))`,e.style.top=`calc(var(--interactive-content-height) * ${t.y} + ((var(--interactive-height) - var(--interactive-content-height)) / 2))`}};var Di=require("@vkontakte/videoplayer-shared/es2015");function qi(r){return"features"in r}var B=class{constructor(e,t,...i){this.severity=e;this.category=t;this.data=i}toString(){return`Interactive SDK error ${JSON.stringify(this,null," ")}`}};function Ct({emitter$:r,error:e,subjectId:t,message:i="",severity:n=1,category:o=1}){let a=new B(n,o,{message:i,error:e,details:{id:t}});r.next(a)}var Oe=class{constructor(e,t){this.error$=new Di.Subject;this.container=e,this.options=t,this.factories=new Map,this.controls=[],this.setControls()}featureIsEnabled(e){return this.options&&qi(this.options)&&this.options.features[e]}onError(e="",t){Ct({emitter$:this.error$,error:t,message:e,subjectId:this.container.id})}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,i)=>{let n=i.type.trim().toLowerCase(),o=this.factories.get(n);if(o){let a=o(i,this.options);if(a)return[...t,a]}return[...t]},[]))||[]}};var se=require("@vkontakte/videoplayer-shared/es2015");var de=(r,e)=>Object.prototype.toString.call(r)===`[object ${e}]`,me=r=>de(r,"Object"),Et=r=>de(r,"String"),Tt=r=>de(r,"Array"),It=r=>de(r,"Number"),Hi=r=>de(r,"Function"),Ui=r=>de(r,"Boolean"),fr=r=>It(r)&&!isNaN(r);var be=r=>me(r)&&Object.keys(r).length===0,vr=r=>Tt(r)&&!r.length;var Ue=(r,e)=>Et(r)&&(e?r.trim():r).length;function Ge(r,e=1){let t="0",i="0",n="0";return r.length===4?(t="0x"+r[1]+r[1],i="0x"+r[2]+r[2],n="0x"+r[3]+r[3]):r.length===7&&(t="0x"+r[1]+r[2],i="0x"+r[3]+r[4],n="0x"+r[5]+r[6]),`rgba(${+t},${+i},${+n},${e})`}var Gi="interactive",M={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},zi=(i=>(i.top="flex-start",i.bottom="flex-end",i.center="center",i))(zi||{}),Wi=(i=>(i.start="flex-start",i.end="flex-end",i.center="center",i))(Wi||{}),Ki=(i=>(i.start="left",i.end="right",i.center="center",i))(Ki||{}),xt=({target:r,props:e})=>{var t,i,n;r.style.alignItems=(t=(e==null?void 0:e.gravityVertical)&&zi[e.gravityVertical])!=null?t:"center",r.style.justifyContent=(i=(e==null?void 0:e.gravityHorizontal)&&Wi[e.gravityHorizontal])!=null?i:"center",r.style.textAlign=(n=(e==null?void 0:e.alignment)&&Ki[e.alignment])!=null?n:"center"},At=({target:r,props:e,fallback:t,dependsOn:i})=>{var n,o,a,l,s,c;r.style.color=(o=(n=e==null?void 0:e.text)==null?void 0:n.color)!=null?o:t.textColor,r.style.fontSize=`calc(${i.height} * ${(l=(a=e==null?void 0:e.text)==null?void 0:a.size)!=null?l:t.textSize})`,r.textContent=(c=(s=e==null?void 0:e.text)==null?void 0:s.value)!=null?c:t.textContent},wt=({target:r,props:e,fallback:t})=>{var i,n,o,a;r.style.backgroundColor=Ge((n=(i=e==null?void 0:e.background)==null?void 0:i.color)!=null?n:t.backgroundColor,(a=(o=e==null?void 0:e.background)==null?void 0:o.alpha)!=null?a:t.backgroundAlpha)},ze=({target:r,props:e,fallback:t,dependsOn:i,useRawValues:n=!1})=>{var l,s,c,d,v,b,g,T,I,m,u;let o=n?t.borderWidthRawValue:`calc(${i.height} * ${(c=(s=(l=e==null?void 0:e.shape)==null?void 0:l.border)==null?void 0:s.width)!=null?c:t.borderWidth})`,a=n?t.roundCornersRawValue:`calc(${i.height} * ${(v=(d=e==null?void 0:e.shape)==null?void 0:d.roundCorners)!=null?v:t.roundCorners})`;r.style.borderWidth=o,r.style.borderStyle="solid",r.style.borderColor=Ge(n?t.borderColor:(T=(g=(b=e==null?void 0:e.shape)==null?void 0:b.border)==null?void 0:g.color)!=null?T:t.borderColor,n?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=a},Qi=({target:r,isDark:e,baseDimension:t,fallback:i})=>{let a=Ge(i.shadowColorLight,i.shadowColorAlpha),l=Ge(i.shadowColorDark,i.shadowColorAlpha),s=`calc(${t} * ${.25})`,c=`calc(${t} * ${.11})`,d=`0px 0px ${s} ${c} ${e?l:a}`;r.style.boxShadow=d},ke=({target:r,layoutParams:e,fallback:t})=>{var n;let i=(n=e.angle)!=null?n:t.angle;i=i&&i*-1,r.style.transform=`rotate(${i}rad)`};var ne=require("@vkontakte/videoplayer-shared/es2015");var br="interactive-control-tap",Pe={common:br,animation:`${br}-animation`,visible:`${br}-visible`};var Ol=60,St=class{constructor({controlRotateAngleRad:e,clickCancelCondition:t,circleDiameterPx:i=Ol,useDimensionsBasedSize:n=!1}){this.onElementClick=e=>{if(!e.target||!e.currentTarget||this.clickCancelCondition())return;let t=e.currentTarget.parentElement;if(!t)return;let i=t.getBoundingClientRect(),n={width:this.useDimensionsBasedSize?t.offsetWidth:this.circleDiameterPx,height:this.useDimensionsBasedSize?t.offsetHeight:this.circleDiameterPx},o=Math.min(n.width,n.height),a=i.left+i.width/2,l=i.top+i.height/2,s=e.clientX-a,c=e.clientY-l,d=kl(s,c,this.controlRotateAngleRad);this.element.style.width=o+"px",this.element.style.left=d.x+i.width/2-o/2+"px",this.element.style.top=d.y+i.height/2-o/2+"px",this.element.classList.add(Pe.visible,Pe.animation)};this.onAnimationEnd=e=>{e.stopPropagation(),!(!e.target||!e.currentTarget)&&e.target===e.currentTarget&&this.element.classList.remove(Pe.visible,Pe.animation)};let o=document.createElement("div");o.classList.add(Pe.common),this.controlRotateAngleRad=e,this.element=o,this.clickCancelCondition=t,this.circleDiameterPx=i,this.useDimensionsBasedSize=n}};function kl(r,e,t){return{x:r*Math.cos(t)-e*Math.sin(t),y:r*Math.sin(t)+e*Math.cos(t)}}var yr="int",ye=(i=>(i.AREA=`${yr}_area`,i.TEXT=`${yr}_text`,i.BUTTON=`${yr}_bttn`,i))(ye||{});function gr(r){return"features"in r}var re="interactive-control",L={common:re,selected:`${re}-selected`,wrapper:`${re}-wrapper`,disabled:`${re}-disabled`,button:`${re}-button`,area:`${re}-area`,text:`${re}-text`,blinkAnim:`${re}-blink-anim`,blinkAnimButton:`${re}-blink-anim-button`,blinkAnimArea:`${re}-blink-anim-area`},Xi=40;var aa=te(Nt(),1);var E=require("@interactiveplatform/movika-manifest");var oa={metadata:"Object",chapters:"Array"},Yr=r=>{if(!me(r))return!1;for(let e in oa)if(!r[e]||!de(r[e],oa[e]))return!1;return(0,E.isSupportedManifest)(r.metadata.version)},nt=r=>r.type===E.ControlTypes.Text,Zu=r=>r.type===E.ControlTypes.Button,Ju=r=>r.type===E.ControlTypes.Area,ep={Choice:"Choice",TextInput:"TextInput"},tp={Button:"Button",Area:"Area",Text:"Text"},rp={onClick:"onClick",onSuspense:"onSuspense"},ip={openURI:"openURI",setNextBranch:"setNextBranch",setWeightlessRandomBranch:"setWeightlessRandomBranch",setRandomBranch:"setRandomBranch",setMaxWeightBranch:"setMaxWeightBranch",setMinWeightBranch:"setMinWeightBranch",setDefaultBranch:"setDefaultBranch",continuePlayback:"continuePlayback",expect:"expect"};var $t=r=>Tt(r)&&!vr(r),Z=r=>r.order==="end",ot=r=>Tt(r.containers)&&!vr(r.containers)&&Z(r),sa=(r,e)=>{var i;let t=r*1e3;return $t(e.controls)&&t<((i=e.startTime)!=null?i:0)},Zr=(r,e)=>{var i,n;let t=r*1e3;return $t(e.controls)&&t>=((i=e.startTime)!=null?i:0)&&t<=((n=e.endTime)!=null?n:1/0)};var Ce=(r=[])=>r.some(e=>e.action.type==="expect"),Jr=(r=[])=>r.find(e=>e.action.type==="expect"),np=r=>(r==null?void 0:r.length)===1,Ee=r=>np(r)&&nt(r[0]);function la(r=[],e=1/0,t=[]){return r.filter(({container:i})=>!(0,aa.default)(t,i.container.id)&&Ce(i.container.events)&&i.container.endTime===e&&!i.isRemoved&&!i.willRemoved)}function jt({gameControllers:r=[],subjectName:e,subjectId:t,execFn:i}){for(let n of r)if(e==="container"&&n.container.container.id===t){i(n),la(r,n.container.container.endTime,[n.container.container.id]).forEach(a=>{i(a)});break}}function ca(r){for(let e of r.events)if(e.action.type==="openURI")return!0;return!1}var ua=(r,e)=>{let t=I=>{let m=e.find(({container:u})=>u.container.id===I);return m==null?void 0:m.container.isRemoved},i=Ce(r.events)&&!t(r.id),n=(I,m=!1,u=!1)=>{let h=u?"every":"some";return I.controls[h](y=>{var R;let x=m?I.endTime===r.endTime:!0;return((R=y.events)==null?void 0:R[h](C=>{var A;return((A=C.action)==null?void 0:A.type)===E.EventActionTypes.openURI}))&&x})},o=I=>I.some(({container:m})=>n(m.container,!0,!1)&&!m.isRemoved),a=I=>I.every(({container:m})=>m.isRemoved||m.willRemoved?!0:n(m.container,!0,!0)),l=la(e,r.endTime,[r.id]).length,s=I=>I.controls.some(m=>{var u;return(u=m.events)==null?void 0:u.some(h=>{var y,x;return(x=(y=h.action)==null?void 0:y.args)==null?void 0:x.shouldOpenNow})}),c=i||l>0,d=o(e),v=n(r),b=a(e),g=i?!1:l>0,T=s(r);return{isExpectTime:c,hasOtherExpect:l>0,hasOpenURIEvent:d,hasOpenURIEventInCurrentContainer:v,isAllOpenURIEventsValid:b,isExpectEventForCurrentContainer:g,hasShouldOpenNowEvent:T}};var fe=class r{constructor(e,t){this.control=e;this.options=t;this.container=null;this.controlElement=null;this.subscriptions=new ne.Subscription;this.error$=new ne.Subject;this.isInteracted=!1;this.isRemoved=!1;this.onControlSelect=()=>{var e,t,i;(e=this.container)!=null&&e.isManifestContainerDisabled()||ca(this.control)||(i=(t=this.container)==null?void 0:t.element)==null||i.classList.add("interactive-control-wrapper-selected")};this.onTransitionEnd=e=>{e.stopPropagation(),!(!e.target||!e.currentTarget)&&e.target===e.currentTarget&&this.removeView()}}removeView(e=!1){let t=this.getElement();if(t){if(e){if(t.classList.contains("interactive-control-before-remove"))return;t.classList.add("interactive-control-before-remove"),this.subscriptions.add((0,ne.fromEvent)(t,"transitionend").subscribe(this.onTransitionEnd,n=>this.onError(`${r.name} remove view transition error`,n))).add((0,ne.fromEvent)(t,"transitioncancel").subscribe(this.onTransitionEnd,n=>this.onError(`${r.name} remove view transition error`,n)));return}this.removeListeners(),t.remove(),this.isRemoved=!0}}onError(e="",t){Ct({emitter$:this.error$,error:t,message:e,subjectId:this.control.id})}addControlTap(e){var t;if(this.featureIsEnabled("controlsTapPlace")&&this.container){let i=(t=this.control.layoutParams.angle)!=null?t:M.angle;this.controlTap=new St({controlRotateAngleRad:i,clickCancelCondition:this.container.isManifestContainerDisabled,circleDiameterPx:this.isTouch()?Xi:void 0}),this.subscriptions.add((0,ne.fromEvent)(e,"click").subscribe(this.controlTap.onElementClick,n=>this.onError("Control click tap animation error",n))).add((0,ne.fromEvent)(this.controlTap.element,"animationend").subscribe(this.controlTap.onAnimationEnd,n=>this.onError("Tap animationend error",n))),this.container.element.append(this.controlTap.element)}}createContainerElement(e){var o;let t=document.createElement("div");t.classList.add(L.wrapper),e.setControlLayout(t,this.control.layoutParams);let i=((o=this.control.layoutParams.innerSizesDependOn)!=null?o:M.innerSizesDependOn)==="self"?{height:t.style.height,width:t.style.width}:{height:"var(--interactive-content-height)",width:"var(--interactive-content-width)"},n=()=>{var a,l;return(l=(a=e.isContainerDisabled)==null?void 0:a.call(e))!=null?l:!1};this.container={element:t,dimensions:i,isManifestContainerDisabled:n}}createClickListener(e){return t=>{t.stopPropagation(),this.isInteracted=!0,e()}}featureIsEnabled(e){return this.options&&gr(this.options)&&this.options.features[e]}isTouch(){return this.options&&gr(this.options)&&this.options.isTouch}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,ne.fromEvent)(this.container.element,"click").subscribe(this.createClickListener(()=>e({action:t.action,controlId:this.control.id,controlType:this.control.type})),n=>this.onError("Error happened on control interaction",n)));break}default:break}})}removeListeners(){this.subscriptions.unsubscribe()}};var ei="interactive-blink-anim-reference",D={common:ei,animation:`${ei}-animation`,disabled:`${ei}-disabled`},Bt=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(D.common,D.animation),this._element=e}restart(){this._element&&(this._element.classList.add(D.disabled),this.cleanupRAF(),this._RAFId=requestAnimationFrame(()=>{this._element&&(this._element.classList.remove(D.disabled),this.cleanupRAF())}))}cleanupRAF(){this._RAFId&&(cancelAnimationFrame(this._RAFId),this._RAFId=0)}destroy(){this.cleanupRAF(),this._element=void 0}};var ti="interactive-container",H={common:ti,hidden:`${ti}-hidden`,disabled:`${ti}-disabled`};var qt=(r,e)=>{if(r.type.trim().toLowerCase()==="area")return new ri(r,e)},ri=class extends fe{constructor(e,t){super(e,t)}createView({parentElement:e,callbacks:t}){if(super.createContainerElement(t),!this.container)return;this.isInteracted=!1,this.isRemoved=!1;let i=document.createElement("button");i.type="button",i.classList.add(L.common,L.area),i.setAttribute("data-testid",ye.AREA),wt({target:i,props:this.control.props,fallback:w(f({},M),{backgroundColor:"transparent"})}),ke({target:i,layoutParams:this.control.layoutParams,fallback:M}),this.addControlTap(i),this.subscriptions.add((0,se.fromEvent)(this.container.element,"click").pipe((0,se.once)()).subscribe(this.onControlSelect,n=>this.onError("Control click handler error",n))),this.container.element.append(i),e.append(this.container.element),this.controlElement=i,this.updateShadowStyles(),this.registerBlinkAnimationEvents()}registerBlinkAnimationEvents(){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,se.fromEvent)(this.controlElement,"mouseleave").subscribe(()=>{if(e.classList.contains(H.disabled))return;let i=e.parentElement;if(i){let n=i.querySelector(`.${D.common}`);n&&this.syncBlinkAnimation(n)}},i=>this.onError("Error happened in mouseleave callback",i))),this.subscriptions.add((0,se.fromEvent)(this.controlElement,"mouseenter").subscribe(()=>{e.classList.contains(H.disabled)||this.onBlinkHovering()},i=>this.onError("Error happened in mouseenter callback",i))).add((0,se.fromEvent)(this.controlElement,"mouseleave").subscribe(()=>{this.controlElement&&(this.controlElement.style.animation="")},i=>this.onError("Error happened in mouseleave callback",i))))}disable(){this.controlElement&&this.controlElement.classList.add(L.disabled)}enable(){this.controlElement&&this.controlElement.classList.remove(L.disabled)}getElement(){return this.controlElement}updateShadowStyles(e){var t,i,n;if(!(!this.container||!this.controlElement))if(Ui(e)){let o=Math.min(this.controlElement.offsetWidth,this.controlElement.offsetHeight)+"px";Qi({target:this.controlElement,props:this.control.props,fallback:M,isDark:e,baseDimension:o}),ze({target:this.controlElement,props:this.control.props,fallback:w(f({},M),{borderColor:e?M.shadowColorDark:M.shadowColorLight,borderAlpha:1,borderWidthRawValue:"0.1px",roundCornersRawValue:`calc(${this.container.dimensions.height} * ${(n=(i=(t=this.control.props)==null?void 0:t.shape)==null?void 0:i.roundCorners)!=null?n:M.roundCorners})`}),dependsOn:this.container.dimensions,useRawValues:!0})}else ze({target:this.controlElement,props:this.control.props,fallback:w(f({},M),{borderAlpha:0}),dependsOn:this.container.dimensions})}toggleBlinkAnimation(e){var t,i;(t=this.controlElement)==null||t.classList.toggle(L.blinkAnim,e),(i=this.controlElement)==null||i.classList.toggle(L.blinkAnimArea,e)}syncBlinkAnimation(e){this.controlElement&&(!this.controlElement.classList.contains(`${L.blinkAnimArea}`)||this.controlElement.classList.contains(L.selected)||this.controlElement.classList.contains(D.disabled)||(this.controlElement.classList.add(D.disabled),this.subscriptions.add((0,se.fromEvent)(e,"animationiteration").pipe((0,se.once)()).subscribe(()=>{this.controlElement&&this.controlElement.classList.remove(D.disabled)},t=>this.onError("Error happened in animationiteration callback",t)))))}onBlinkHovering(){if(!this.controlElement||!this.controlElement.classList.contains(`${L.blinkAnimArea}`)||this.controlElement.classList.contains(L.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)})}setShowTimeRange(){}updateFillAnimationDimensions(){}onProgress(){}onResize(){}};var ce=require("@vkontakte/videoplayer-shared/es2015");var Dt=r=>{let e=document.createElement("span");switch(r){case"Button":case"button":{let t=document.createElement("div"),i={overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center"};Object.assign(t.style,i),t.append(e);let n={display:"inline-block",whiteSpace:"pre",textOverflow:"ellipsis",maxWidth:"initial",maxHeight:"100%",wordBreak:"normal"};return Object.assign(e.style,n),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 Ht=Math.PI,ii=2*Ht,Ut=Ht/2,pa=3*Ut,op=0,ap=[op,Ut,Ht,pa];function ha(r){return r===Ut}function da(r){return r===Ht}function ma(r){return r===pa}function fa(r){return(r%ii+ii)%ii}function sp(r){for(let e of ap)if(r===e)return e}function va(r){if(sp(r))return null;let t=Math.floor(r/Ut)+1;return[1,2,3,4][t-1]}function ba(r){return r*180/Math.PI}var le="interactive-control-fill-animation",U={common:le,fillerWrapper:`${le}-filler-wrapper`,filler:`${le}-filler`,fillHeight:`${le}-fill-height`,fillWidth:`${le}-fill-width`,fromTop:`${le}-from-top`,fromBottom:`${le}-from-bottom`,fromLeft:`${le}-from-left`,fromRight:`${le}-from-right`};var Gt=class r{constructor(e){this.widthExpansionCoef=0;var m;let t=document.createElement("div");t.classList.add(U.common);let i=document.createElement("div");i.classList.add(U.fillerWrapper);let n=document.createElement("div");n.classList.add(U.filler),i.append(n),t.append(i);let o=fa(e.rotateAngle),a=va(o),l=a!==null,c=a===2||!l&&da(o)||a===3,d=!l&&ha(o),v=!l&&ma(o),b=!c&&!d&&!v,g=d||v,T=l&&!g,I=T?o:0;t.style.borderRadius=e.borderRadius,i.style.transform=`skew(${I*-1}rad)`,g?(n.classList.add(U.fillHeight,d?U.fromTop:U.fromBottom),i.classList.add(U.fillHeight,d?U.fromTop:U.fromBottom)):(n.classList.add(U.fillWidth,b?U.fromLeft:U.fromRight),i.classList.add(U.fillWidth)),e.debug&&console.log(`[interactive ${r.name}]`,{widthExpansionCoef:this.widthExpansionCoef,opts:e,shouldFillHeight:g,rotateAngleRad:o,rotateAngelDeg:ba(o),rotateAngleRaw:e.rotateAngle,fromRight:c,fromTop:d,fromBottom:v,fromLeft:b}),this.useSkew=T,this.fromLeft=b,this.rotateAngle=o,this.fillAnimationElement=t,this.fillAnimationFillerElement=n,this.fillAnimationFillerWrapperElement=i,this.startTime=e.startTime,this.endTime=e.endTime,this.shouldFillHeight=g,this.isDebug=(m=e.debug)!=null?m:!1}updateDimension(e){this.fillAnimationElement.style.top=`${e.borderWidth*-1}px`,this.fillAnimationElement.style.left=`${e.borderWidth*-1}px`,this.fillAnimationElement.style.width=`${e.width}px`,this.fillAnimationElement.style.height=`${e.height}px`;let t=this.calcWidthExpansionCoef({rotateAngle:this.rotateAngle,isSkewed:this.useSkew,initWidth:e.width,initHeight:e.height});!this.shouldFillHeight&&(this.fillAnimationFillerWrapperElement.style.width=100*t+100+"%",this.fillAnimationFillerWrapperElement.style[`${this.fromLeft?"left":"right"}`]=`calc((${t} * 100%) / 2 * -1)`),this.widthExpansionCoef=t}updateAnimation(e){if((o=>o<this.startTime||o>this.endTime)(e))return;let i=this.endTime-this.startTime,n=Math.min(Math.max((e-this.startTime)/i,0),1);this.shouldFillHeight?this.fillAnimationFillerElement.style.transform=`scaleY(${n})`:this.fillAnimationFillerElement.style.transform=`scaleX(${n})`}calcWidthExpansionCoef({rotateAngle:e,isSkewed:t=!1,initWidth:i,initHeight:n}){return t?(i+n*Math.abs(Math.tan(e)))/i-1:0}};var zt=(r,e)=>{if(r.type.trim().toLowerCase()==="button")return new ni(r,e)},ni=class extends fe{constructor(e,t){super(e,t)}createView({parentElement:e,callbacks:t}){var a,l,s,c,d,v;if(super.createContainerElement(t),!this.container)return;this.isInteracted=!1,this.isRemoved=!1;let i=document.createElement("button");i.type="button",i.classList.add(L.common,L.button),i.setAttribute("data-testid",ye.BUTTON),ke({target:i,layoutParams:this.control.layoutParams,fallback:M}),wt({target:i,props:this.control.props,fallback:M}),ze({target:i,props:this.control.props,fallback:M,dependsOn:this.container.dimensions}),xt({target:i,props:w(f({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let n=Dt(this.control.type.trim().toLowerCase()),o=(a=n.firstElementChild)!=null?a:n;At({target:o,props:this.control.props,fallback:M,dependsOn:this.container.dimensions}),this.addControlTap(i),this.startTime!==void 0&&this.endTime!==void 0&&this.featureIsEnabled("controlsFillAnimation")&&(this.controlFillAnimation=new Gt({startTime:this.startTime,endTime:this.endTime,rotateAngle:(l=this.control.layoutParams.angle)!=null?l:M.angle,borderRadius:i.style.borderRadius})),this.subscriptions.add((0,ce.fromEvent)(i,"click").pipe((0,ce.once)()).subscribe(this.onControlSelect,b=>this.onError("Control click handler error",b))),i.append(n,(c=(s=this.controlFillAnimation)==null?void 0:s.fillAnimationElement)!=null?c:""),this.container.element.append((v=(d=this.controlTap)==null?void 0:d.element)!=null?v:"",i),e.append(this.container.element),this.controlElement=i,this.registerBlinkAnimationEvents()}registerBlinkAnimationEvents(){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,ce.fromEvent)(this.controlElement,"mouseleave").subscribe(()=>{if(e.classList.contains(H.disabled))return;let i=e.parentElement;if(i){let n=i.querySelector(`.${D.common}`);n&&this.syncBlinkAnimation(n)}},i=>this.onError("Error happened in mouseleave callback",i))),this.subscriptions.add((0,ce.fromEvent)(this.controlElement,"mouseenter").subscribe(()=>{e.classList.contains(H.disabled)||this.onBlinkHovering()},i=>this.onError("Error happened in mouseenter callback",i))).add((0,ce.fromEvent)(this.controlElement,"mouseleave").subscribe(()=>{this.controlElement&&(this.controlElement.style.animation="")},i=>this.onError("Error happened in mouseleave callback",i))))}disable(){this.controlElement&&this.controlElement.classList.add(L.disabled)}enable(){this.controlElement&&this.controlElement.classList.remove(L.disabled)}getElement(){return this.controlElement}toggleBlinkAnimation(e){var t,i;(t=this.controlElement)==null||t.classList.toggle(L.blinkAnim,e),(i=this.controlElement)==null||i.classList.toggle(L.blinkAnimButton,e)}syncBlinkAnimation(e){this.controlElement&&(!this.controlElement.classList.contains(`${L.blinkAnimButton}`)||this.controlElement.classList.contains(L.selected)||this.controlElement.classList.contains(D.disabled)||(this.controlElement.classList.add(D.disabled),this.subscriptions.add((0,ce.fromEvent)(e,"animationiteration").pipe((0,ce.once)()).subscribe(()=>{this.controlElement&&this.controlElement.classList.remove(D.disabled)},t=>this.onError("Error happened in animationiteration callback",t)))))}onBlinkHovering(){if(!this.controlElement||!this.controlElement.classList.contains(`${L.blinkAnimButton}`)||this.controlElement.classList.contains(L.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)})}updateFillAnimationDimensions(){if(!this.container||!this.controlElement||!this.controlFillAnimation)return;let e=getComputedStyle(this.controlElement),t={width:parseFloat(e.width),height:parseFloat(e.height),borderWidth:parseFloat(e.borderWidth)||0};this.controlFillAnimation.updateDimension(t)}setShowTimeRange(e,t){this.startTime=e,this.endTime=t}onProgress(e){var t;(t=this.controlFillAnimation)==null||t.updateAnimation(e)}onResize(){this.updateFillAnimationDimensions()}updateShadowStyles(){}};var ya=(r,e)=>{if(r.type.trim().toLowerCase()==="text")return new oi(r,e)},oi=class extends fe{constructor(e,t){super(e,t)}createView({parentElement:e,callbacks:t}){var a;if(super.createContainerElement(t),!this.container)return;this.isInteracted=!1,this.isRemoved=!1;let i=document.createElement("div");i.classList.add(L.common,L.text),i.setAttribute("data-testid",ye.TEXT),ke({target:i,layoutParams:this.control.layoutParams,fallback:M}),xt({target:i,props:w(f({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let n=Dt(this.control.type.trim().toLowerCase()),o=(a=n.firstElementChild)!=null?a:n;At({target:o,props:this.control.props,fallback:M,dependsOn:this.container.dimensions}),i.append(n),this.container.element.append(i),e.append(this.container.element),this.controlElement=i}getElement(){return this.controlElement}disable(){}enable(){}onProgress(){}onResize(){}updateShadowStyles(){}toggleBlinkAnimation(){}setShowTimeRange(){}updateFillAnimationDimensions(){}};var Wt=(r,e,t)=>{if(r.type.trim().toLowerCase()==="choice")return new ai(r,e,t)},ai=class r extends Oe{constructor(t,i,n){super(t,n);this.containerElement=null;this.subscriptions=new at.Subscription;this.onTransitionEnd=t=>{t.stopPropagation(),!(!t.target||!t.currentTarget)&&t.target===t.currentTarget&&this.removeView()};this.rootElement=i,this.layout=new gt(this.container.layout),this.isRemoved=!1,this.isDisabled=!1,this.addControlFactory("button",zt),this.addControlFactory("text",ya),this.addControlFactory("area",qt)}createView({eventCallback:t,videoDurationMs:i}){let n=document.createElement("div");return n.classList.add(H.common,H.disabled),requestAnimationFrame(()=>{n.classList.remove(H.disabled)}),this.layout.setContainerLayout(n),this.controls.forEach(o=>{var a;o.setShowTimeRange(this.container.startTime,(a=this.container.endTime)!=null?a:i),o.createView({parentElement:n,callbacks:{setControlLayout:this.layout.setControlLayout,isContainerDisabled:()=>this.isDisabled}}),o.setEvents(t),this.subscriptions.add(o.error$.subscribe(this.error$))}),this.rootElement.append(n),this.isRemoved=!1,this.willRemoved=!1,this.containerElement=n,this.updateControlsFillAnimationDimensions(),n}updateControlsFillAnimationDimensions(){for(let t of this.controls)t.updateFillAnimationDimensions()}hide(){let t=this.getElement();t&&t.classList.add(H.hidden)}show(){let t=this.getElement();t&&t.classList.remove(H.hidden)}enable(){let t=this.getElement();t&&(t.classList.remove(H.disabled),this.controls.forEach(i=>i.enable()),this.isDisabled=!1)}disable(){let t=this.getElement();t&&(t.classList.add(H.disabled),this.controls.forEach(i=>i.disable()),this.isDisabled=!0)}removeView(t=!1,i=!1){let n=this.getElement();if(n){if(t){if(this.willRemoved)return;this.willRemoved=!0,i&&n.classList.add("interactive-container-before-remove-delay"),n.classList.add("interactive-container-before-remove"),this.subscriptions.add((0,at.fromEvent)(n,"transitionend").subscribe(this.onTransitionEnd,a=>this.onError(`${r.name} remove view transition error`,a))).add((0,at.fromEvent)(n,"transitioncancel").subscribe(this.onTransitionEnd,a=>this.onError(`${r.name} remove view transition error`,a)));return}this.subscriptions.unsubscribe(),this.removeAllControls(),n.remove(),this.isRemoved=!0,this.willRemoved=!1,this.containerElement=null}}removeAllControls(t=!1){this.controls.forEach(i=>i.removeView(t))}removeNonInteractedControls(t=!1){this.controls.forEach(i=>{i.isInteracted||i.removeView(t)})}isInteracted(){return this.controls.some(t=>t.isInteracted)}fakeRemove(){this.isRemoved||(this.isRemoved=!0)}getElement(){return this.containerElement}onProgress(t,i){i&&this.controls.forEach(n=>{n.onProgress(t)})}onResize(t){t&&this.controls.forEach(i=>{i.onResize()})}updateControlsShadowStyles(t){this.controls.forEach(i=>i.updateShadowStyles(t))}toggleBlinkAnimation(t){this.controls.forEach(i=>i.toggleBlinkAnimation(t))}};var bl=te(si(),1),S=require("@vkontakte/videoplayer-shared/es2015"),De=require("@vkontakte/videoplayer-statistics/es2015");var Ra=require("@vkontakte/videoplayer-shared/es2015");function st(r,e){let t;return(...i)=>{clearTimeout(t),t=setTimeout(()=>r(...i),e)}}var Aa="video_interactive",wa="videoint";var Sa=250,lt=class{constructor(e){this.handleZoomChange=st(e=>{this.lastZoomInfo=e},Sa);this.onResize=e=>{var i;if(!this.isReady||this.isHidden||!e[0].contentRect.width||!e[0].contentRect.height)return;let t=this.getNextPoint();t&&((i=this.ngEditor)==null||i.zoomTo(t,void 0,{isFromCenter:!0})),this.ngEditorSize={width:e[0].contentRect.width,height:e[0].contentRect.height}};this.handleChapterChange=e=>{var t,i,n;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),(i=this.ngEditor)==null||i.selectChapter(e.id),(n=this.ngEditor)==null||n.setVisitedChapters(Array.from(this.visitedChapterIds)),this.currentChapterId=e.id,this.lastZoomInfo=null}};this.handleManifestChange=(e,t=[])=>{var i;if(this.isReady=!1,!It(e.graph.edit.chapters[0].x)){(i=this.onError)==null||i.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:i,lang:n,visitedChapters:o=[]}){this.isReady=!1,this.isHidden=!0,this.manifest=null,this.visitedChapterIds=new Set(o),this.onOpenPreviewClick=t,this.onError=i,this.lang=n!=null?n:"ru",this.zoom=.7,this.lastZoomInfo=null,this.currentManifestId=null,this.currentChapterId=null,this.ngEditor=null,this.ngEditorSize=null,this.graphWrapperElement=vp(e),this.resizeObserver=new ResizeObserver(st(this.onResize,Sa)),this.resizeObserver.observe(this.graphWrapperElement)}getNextPoint(e=this.ngEditorSize){return!this.lastZoomInfo||!e?null:[(this.lastZoomInfo.x-e.width/2)/this.lastZoomInfo.value*-1,(this.lastZoomInfo.y-e.height/2)/this.lastZoomInfo.value*-1]}setVisitedChapters(e){var t;this.visitedChapterIds=new Set([...this.visitedChapterIds,...e]),(t=this.ngEditor)==null||t.setVisitedChapters(Array.from(this.visitedChapterIds))}updateVideosInfo(e){var t;(t=this.ngEditor)==null||t.updateVideosInfo(e)}show(){return k(this,null,function*(){var e;this.manifest&&(this.ngEditor||(yield this.initNgEditor()),this.graphWrapperElement.style.display="block",!this.lastZoomInfo&&this.currentChapterId&&((e=this.ngEditor)==null||e.focusChapter(this.currentChapterId)),this.isHidden=!1)})}initNgEditor(){return k(this,null,function*(){var i;if(!this.manifest)return;let e;try{e=yield(0,Ra.loadVKLangPack)(this.lang,Aa,wa)}catch(n){(i=this.onError)==null||i.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",a=>{var l=a,{name:n}=l,o=ee(l,["name"]);var s;n==="openPreview"&&"chapterId"in o&&((s=this.onOpenPreviewClick)==null||s.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 vp(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 ct=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,i=!1,n=Math.round(this._player.info.position$.getValue()*1e3);for(let o of this._containers){let a=o.startTime-e;if(a<=n&&(o.endTime&&n<=o.endTime||o.endTime===null)){i=!0;break}n<a&&(t=t===-1?a:Math.min(t,a))}return!i&&t!==-1?t:null}}};var Kt=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 i=()=>{t(),this.off(e,i)};return this.listeners[e].push(i),this}off(e,t){return this.removeListener(e,t)}reset(){this.listeners={}}removeListener(e,t){let i=this.listeners[e]||[];for(let n=i.length;n>0;n--)if(i[n]===t){i.splice(n,1);break}return this}emit(e,...t){let i=this.listeners[e];return i?(i.forEach(n=>{n(...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)=>{Hi(e)&&(this.fns.push(e),t&&this.updateFn())};this.removeFn=(e,t=!1)=>{this.fns=this.fns.filter(i=>i!==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 La=require("@vkontakte/videoplayer-shared/es2015");var Xt=class{constructor(e){var t,i;this.loaders={chapterLoaders:(t=e==null?void 0:e.chapterLoaders)!=null?t:[],manifestLoaders:(i=e==null?void 0:e.manifestLoaders)!=null?i:[]}}exec(e,t){return k(this,null,function*(){return bp(...this.loaders[e])(t)})}};function bp(...r){return function(t){return k(this,null,function*(){let i=[...r];for(;i.length>0;)t=yield i.shift()(t);return t})}}function ut(r,e,t){return r?w(f({},r),{[e]:r[e]?[t,...r[e]]:[t]}):{[e]:[t]}}function Yt(n){var o=n,{actions:r,errors:e,chapterId:t}=o,i=ee(o,["actions","errors","chapterId"]);if(t){let a=r.getManifest();if(a){let l=r.getChapter(a.chapters,t);if(l){let s=r.getMedia(a.media,l.videoId),c=r.getGraph(a.graph,l.id);return s?w(f({},i),{actions:r,errors:e,result:{chapter:l,media:s,graph:c}}):w(f({},i),{errors:ut(e,Yt.name,"Could not find media"),actions:r})}}}return w(f({},i),{errors:ut(e,Yt.name,"Could not find chapter"),actions:r})}var{NativeAbortSignal:dv,NativeAbortController:mv}=function(r){return{NativeAbortSignal:r.AbortSignal,NativeAbortController:r.AbortController}}(typeof self!="undefined"?self:global);function Oa(r){let e;try{e=new Event("abort")}catch(t){typeof document!="undefined"?document.createEvent?(e=document.createEvent("Event"),e.initEvent("abort",!1,!1)):(e=document.createEventObject(),e.type="abort"):e={type:"abort",bubbles:!1,cancelable:!1}}return e.reason=r,e}function ka(r){if(r===void 0)if(typeof document=="undefined")r=new Error("This operation was aborted"),r.name="AbortError";else try{r=new DOMException("signal is aborted without reason"),Object.defineProperty(r,"name",{value:"AbortError"})}catch(e){r=new Error("This operation was aborted"),r.name="AbortError"}return r}var Zt=class{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(e,t,i){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:t,options:i})}removeEventListener(e,t){if(!(e in this.listeners))return;let i=this.listeners[e];for(let n=0,o=i.length;n<o;n++)if(i[n].callback===t){i.splice(n,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let i=this.listeners[e.type].slice();for(let n=0,o=i.length;n<o;n++){let a=i[n];try{a.callback.call(this,e)}catch(l){Promise.resolve().then(()=>{throw l})}a.options&&a.options.once&&this.removeEventListener(e.type,a.callback)}return!e.defaultPrevented}},Ne=class extends Zt{constructor(){super(),this.listeners||Zt.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)}throwIfAborted(){let{aborted:e,reason:t="Aborted"}=this;if(e)throw t}static timeout(e){let t=new Te;return setTimeout(()=>t.abort(new DOMException(`This signal is timeout in ${e}ms`,"TimeoutError")),e),t.signal}static any(e){let t=new Te;function i(){t.abort(this.reason),n()}function n(){for(let o of e)o.removeEventListener("abort",i)}for(let o of e)if(o.aborted){t.abort(o.reason);break}else o.addEventListener("abort",i);return t.signal}},Te=class{constructor(){Object.defineProperty(this,"signal",{value:new Ne,writable:!0,configurable:!0})}abort(e){let t=ka(e),i=Oa(t);this.signal.reason=t,this.signal.dispatchEvent(i)}toString(){return"[object AbortController]"}};typeof Symbol!="undefined"&&Symbol.toStringTag&&(Te.prototype[Symbol.toStringTag]="AbortController",Ne.prototype[Symbol.toStringTag]="AbortSignal");function Jt(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 li(r){typeof r=="function"&&(r={fetch:r});let{fetch:e,Request:t=e.Request,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:n=!1}=r;if(!Jt({fetch:e,Request:t,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:n}))return{fetch:e,Request:o};let o=t;(o&&!o.prototype.hasOwnProperty("signal")||n)&&(o=function(c,d){let v;d&&d.signal&&(v=d.signal,delete d.signal);let b=new t(c,d);return v&&Object.defineProperty(b,"signal",{writable:!1,enumerable:!1,configurable:!0,value:v}),b},o.prototype=t.prototype);let a=e;return{fetch:(s,c)=>{let d=o&&o.prototype.isPrototypeOf(s)?s.signal:c?c.signal:void 0;if(d){let v;try{v=new DOMException("Aborted","AbortError")}catch(g){v=new Error("Aborted"),v.name="AbortError"}if(d.aborted)return Promise.reject(v);let b=new Promise((g,T)=>{d.addEventListener("abort",()=>T(v),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([b,a(s,c)])}return a(s,c)},Request:o}}var yp=()=>"fetch"in window,pt=yp()&&Jt({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),Pa=pt?li({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,ci=pt?Pa.fetch:window.fetch,xv=pt?Pa.Request:window.Request,Av=pt?Te:window.AbortController,wv=pt?Ne:window.AbortSignal;var er=(r="",e="")=>{let t=r.split("."),i=e.split("."),n=0;for(let o=0;o<Math.max(t.length,i.length)&&!n;o++)t[o]>i[o]?n=1:t[o]<i[o]?n=-1:n=0;return n};var gp=r=>k(null,null,function*(){try{let e={},t;if(Et(r)){t=new URL(r).href;let n=yield ci(t);if(!n.ok)return{};e=yield n.json()}else if(me(r))e=r;else return{};if(!Yr(e))return{};let i=e.metadata.media;if(Et(i)&&!("media"in e))try{let n;t?n=new URL(i,t).href:(n=new URL(i).href,t=n);let o=yield ci(n);if(!o.ok)throw new Error;e.metadata.media=yield o.json()}catch(n){return Tp(e.metadata.version)?{manifest:e}:{}}return{manifest:e,manifestURL:t}}catch(e){return{}}});function _a(r){return k(this,null,function*(){let{manifest:e,manifestURL:t}=yield gp(r);if(!e)throw new Error("Failed on fetch");let i=(0,E.migrateManifestToLatestVersion)(e);return i.media=Cp(i.media,t),delete i.metadata.media,i})}function tr(r,e){if(e)return r.find(t=>t.id===e)}function ui(r,e){var t,i;return(t=r.edit)!=null&&t.chapters?r.edit.chapters.find(n=>n.id===e):(i=r.view)!=null&&i.chapters?r.view.chapters.find(n=>n.id===e):void 0}function pi(r,e){return r.videos.find(t=>t.id===e)}function Cp(r,e){return w(f({},r),{videos:r.videos.map(t=>w(f({},t),{variants:t.variants.map(i=>{let n="url"in i?i.url:"",o=Ep(n,e);return w(f({},i),{url:o||n})})}))})}function Ep(r="",e){try{return new URL(r,e).href}catch(t){return""}}function Tp(r){return er(r,"3.2.0")>=0}var Ie=class extends Xt{constructor(t,i){super(t);this.manifest=null;this.chapter=null;this.media=null;this.graph=null;this.prevChapter$=new La.ValueSubject(null);this.onError=i,this.release()}release(){return this.manifest=null,this.chapter=null,this.media=null,this.graph=null,this.prevChapter$.next(null),this}setManifest(t){return k(this,null,function*(){var n;this.release();let i=yield this.exec("manifestLoaders",{actions:{addErrorMessage:ut},result:null,errors:null,source:t});return i.errors&&this.errorHandler(i.errors),this.manifest=yield _a((n=i.result)!=null?n:t),this})}setInitial(){return k(this,null,function*(){return this.setNext()})}setNext(){return k(this,arguments,function*(t=(i=>(i=this.manifest)==null?void 0:i.metadata.initChapterId)()){if(!t)return this;this.prevChapter$.next(this.chapter);let n=yield this.exec("chapterLoaders",Yt({actions:{getManifest:()=>this.manifest,getCurrent:this.getCurrent,getGraph:ui,getChapter:tr,getMedia:pi,getByBranches:this.getByBranches.bind(this),addErrorMessage:ut},result:null,errors:null,chapterId:t}));return n.errors&&this.errorHandler(n.errors),n.result&&(this.chapter=n.result.chapter,this.media=n.result.media,this.graph=n.result.graph),this})}errorHandler(t){this.onError(t),console.error("Something went wrong with loaders",{errors:t})}getInitial(){var i;return this.getByChapterId((i=this.manifest)==null?void 0:i.metadata.initChapterId)||null}getByChapterId(t=(i=>(i=this.manifest)==null?void 0:i.metadata.initChapterId)()){if(!t||!this.manifest)return null;let n=tr(this.manifest.chapters,t);if(n){let o=pi(this.manifest.media,n.videoId),a=ui(this.manifest.graph,n.id);if(o)return{chapter:n,media:o,graph:a}}return null}getBranches(t=(i=>(i=this.chapter)==null?void 0:i.id)()){var n,o,a;if(t===((n=this.chapter)==null?void 0:n.id))return this.getByBranches((o=this.chapter)==null?void 0:o.branches);{let l=tr(((a=this.manifest)==null?void 0:a.chapters)||[],t);return this.getByBranches(l==null?void 0:l.branches)}}getByBranches(t=[]){return t.reduce((i,n)=>{let o=this.getByChapterId(n.chapterId);return o&&i.push(o),i},[])}getCurrent(){return{chapter:this.chapter,media:this.media,graph:this.graph}}isInitialChapter(){var t,i;return((t=this.chapter)==null?void 0:t.id)===((i=this.manifest)==null?void 0:i.metadata.initChapterId)}isEndChapter(){return this.chapter?Z(this.chapter):!1}};var ps=te(rr(),1),hs=require("@vkontakte/videoplayer-core/es2015"),ve=require("@vkontakte/videoplayer-shared/es2015");var cs=r=>{let e=r.variants.find(t=>{var i;return((i=t.payload)==null?void 0:i.type)==="vk"});if(e&&e.payload){let[t,i]=e.payload.id.split("_");return[t,i]}return[]};var us=te(rr(),1);function mi(){let r=new Map;function e(s){var c=s,{listId:o=Math.random().toString(),itemId:a=Math.random().toString()}=c,l=ee(c,["listId","itemId"]);let d=r.get(o),v=f({},l);return d?d[a]=v:r.set(o,{[a]:v}),f({listId:o,itemId:a},l)}function t(o){var a,l;o.player.destroy(),o.container.remove(),o.subscription.unsubscribe(),(a=o.statistics)==null||a.oneStat.destroy(),(l=o.statistics)==null||l.statSubscription.unsubscribe()}function i(o,a){let l=r.get(o);if(!l)throw Error("Can't remove. Not find.");if(a){let s=l[a];s&&t(s),delete l[a],Object.keys(l).length||r.delete(o)}else{for(let s of(0,us.default)(l))t(s);r.delete(o)}}function n(){for(let o of r)i(o[0])}return{createPlayer:e,removePlayer:i,map:r,removeAll:n}}var $e=te(Nt(),1);function fi(r,e=[]){var o,a,l;let t={},i,n=!e.length;for(let s of r.variants)if(!i&&"cover"in s&&(i=s.cover),"url"in s)switch(s.type.toLowerCase()){case"mp4":(n||(0,$e.default)(e,"mp4"))&&(t.MPEG=w(f({},t.MPEG),{[(o=s.standard)!=null?o:"Invariant quality"]:s.url}));break;case"mpeg":(n||(0,$e.default)(e,"mpeg"))&&(t.MPEG=w(f({},t.MPEG),{[(a=s.standard)!=null?a:"Invariant quality"]:s.url}));break;case"hls":(n||(0,$e.default)(e,"hls"))&&(t=w(f({},t),{HLS:{type:"url",url:s.url}}));break;case"dash":(n||(0,$e.default)(e,"dash"))&&(t=w(f({},t),{DASH_SEP:{compatibilityMode:!0,type:"url",url:s.url}}));break;default:break}return{sources:t,thumbUrl:i,title:(l=r.title)!=null?l:""}}var ht=(r,e)=>{let t=r.info.currentQuality$.getValue(),i=r.info.availableQualities$.getValue();t!==e&&(0,$e.default)(i,e)&&(r.setQuality(e),r.setAutoQuality(!1))};var Xp=2;function vi(r){let e=mi(),t=new ve.Subscription,i={},n=null,o=!1,a,l=new ve.ValueSubject(null);r&&s(r);function s(m){n=m}function c(m,u,h){var R;if(!n)throw Error("need to set interactive controller");if(!n.options)return;let x=((R=e.map.get(m))!=null?R:{})[u];if(x){i=f({chapterId:h,listId:m,itemId:u},x);let C=i.player;i.subscription.add(C.info.currentQuality$.subscribe(A=>{let q=C.info.position$.getValue(),P=C.info.isAutoQualityEnabled$.getValue();if(!(!A||!q||P))for(let V of e.map)(0,ps.default)(V[1]).forEach(({player:F})=>{ht(F,A)})})).add(C.events.started$.subscribe(()=>{d(u)})),x.container.remove(),n.setPlayer(x.player),o||(n.init(),o=!0),l.next({player:i.player,config:i.config,statistics:i.statistics});return}throw Error("Can't set. Not find.")}function d(m){return k(this,null,function*(){if(!n)throw Error("need to set interactive controller");if(be(i)||m!==i.itemId)return;let u=n.getChapterBranches(),h=new Set;for(let y of u)h.has(y.media.id)||(yield b({media:y.media,chapterId:y.chapter.id,setAsActive:!1,title:y.chapter.label}),h.add(y.media.id))})}function v(h){return k(this,arguments,function*({chapter:{id:m},manifestVideo:u}){if(be(i)||!n)return;let y=i.player.info.muted$.getValue(),x=i.player.info.currentQuality$.getValue(),R=i.player.info.isAutoQualityEnabled$.getValue(),C=i.player.info.volume$.getValue(),A=i.player.info.currentPlaybackRate$.getValue(),q=!R,P=!1;for(let V of e.map)if(V[0]===u.id&&!n.state.isReplay$.getValue()){let F=Object.keys(V[1]);for(let j of F)j===i.itemId?(F.length<Xp||(P=!0),e.removePlayer(V[0],j)):(P=!0,c(V[0],j,m),q?ht(i.player,x):i.player.setAutoQuality(!0),i.player.setVolume(C),i.player.setMuted(y),i.player.setPlaybackRate(A))}else e.removePlayer(V[0]);P||(yield b({media:u,chapterId:m,setAsActive:!0,playbackRate:A}),q?ht(i.player,x):i.player.setAutoQuality(!0),i.player.setVolume(C),i.player.setMuted(y))})}function b(q){return k(this,arguments,function*({media:m,chapterId:u,prefetch:h=!0,setAsActive:y=!0,autoplay:x=!1,preferredExt:R,title:C,playbackRate:A}){var Ri,Oi,ki,Pi,_i;let P=Math.random().toString(),V=document.createElement("div");a.append(V);let F;if((Ri=n==null?void 0:n.options)!=null&&Ri.vkVideoLoader){let bt=cs(m);bt.length&&(F=yield n.options.vkVideoLoader(...bt))}let j=((Oi=n==null?void 0:n.options)==null?void 0:Oi.coreConfig)||void 0,Se=w(f({},j),{configName:[...(ki=j==null?void 0:j.configName)!=null?ki:[],"interactive"]}),ae=w(f({container:V},((Pi=F==null?void 0:F.videos)==null?void 0:Pi[0])||{sources:fi(m,R).sources}),{title:C,failoverHosts:(F==null?void 0:F.failoverHosts)||[]}),J=new hs.Player(Se,ve.TracerFactory.createRootTracer());J.initVideo(ae);let wi=null;if(F!=null&&F.videos&&(n!=null&&n.options.createOneStat)){let bt=F.videos[0],ur=n.options.createOneStat(bt),Li=new ve.Subscription;ur&&(Li.add(ur.attachTo(J)),wi={oneStat:ur,statSubscription:Li})}let Si=new ve.Subscription,Cl=(_i=i==null?void 0:i.player)==null?void 0:_i.info.isAutoQualityEnabled$.getValue();Si.add(J.events.canplay$.subscribe(function(){Cl||ht(J,i.player.info.currentQuality$.getValue()),A&&J.setPlaybackRate(A)}));let Re=e.createPlayer({listId:m.id,itemId:P,player:J,container:V,sources:fi(m,R).sources,config:ae,subscription:Si,statistics:wi});return y&&c(m.id,Re.itemId,u),x&&Re.player.play(),h&&!x&&Re.player.prepare(),{player:Re.player,config:Re.config,statistics:Re.statistics}})}function g(){T(),n=null,a.remove()}function T(){t.unsubscribe(),e.removeAll(),i={},o=!1}function I(){return k(this,null,function*(){if(!n)throw Error("need to set interactive controller");T(),a=document.createElement("div");let{media:m,chapter:u}=n.getCurrentChapter();m&&u?(t.add(n.events.chapterChanged$.subscribe(v)),yield b({media:m,chapterId:u.id,title:u.label})):console.error("not found")})}return w(f({},e),{init:I,setInteractiveController:s,createPlayer:b,removeAll:g,getActivePlayer:function(){return i},activePlayerChanged:l})}var _={graph:"graph",interactives:"interactives",chapterChanged:"chapter-changed",playerChanged:"player-changed",manifestChanged:"manifest-changed",errors:"errors",eachTick:"eachTick",historyInited:"history-inited",historyDestroyed:"history-destroyed"},je={visibility:"visibility",watchAgainClicked:"watchAgainClicked"},N={actionChoiceCanceled:"action-choice-canceled",actionChoice:"action-choice",actionExecution:"action-execution",visibility:"visibility",containerRemoved:"container-removed",rangeEnded:"range-ended"};var ms=require("@vkontakte/videoplayer-shared/es2015");function bi(r){return function(...t){return r(...t.reverse())}}function dt(r,...e){return(...t)=>me(e[0])&&me(t[0])?r(f(f({},e[0]),t[0])):r(...e,...t)}var ir=class{constructor({player:e,container:t,branches:i,selectBranches:n,interactiveEvents:o,globalEvents:a,globalEventEmitter:l,getContainerEventState:s,permanentTextControls:c,interactiveTimeOpenUri:d,disabledControls$:v,onRemove:b,onError:g,disableTextControlContainerVisibilityEvents:T=!1,features:I}){this.hide=()=>{setTimeout(()=>{var e,t;this.gameState!==4&&(Ce(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,i,n,o,a,l;if(this.gameState!==2||this.isSelectedControlEvent)return;if(this.container.getElement()){let{hasOpenURIEventInCurrentContainer:s}=this.getContainerEventState();if((i=(t=this.container).show)==null||i.call(t),this.interactiveTimeOpenUri&&s||this.disableTextControlContainerVisibilityEvents)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:(v,b)=>{let{isExpectTime:g,hasOtherExpect:T,hasOpenURIEvent:I,hasOpenURIEventInCurrentContainer:m,isAllOpenURIEventsValid:u,hasShouldOpenNowEvent:h}=this.getContainerEventState(),y=this.interactiveTimeOpenUri&&!m,x=this.interactiveTimeOpenUri&&m;if((!this.interactiveTimeOpenUri||y)&&(this.isSelectedControlEvent=!0),v!==!1){if(!this.selectBranches.state.isExpect&&(!this.interactiveTimeOpenUri||y)){if(this.interactiveTimeOpenUri){let R=!T&&!u&&m;R&&this.globalEvents.interactiveContainerFakeRemoved$.next({subjectId:this.container.container.id,subjectName:"container",type:"container-fake-removed",removeAllOpenURI:R})}this.removeView()}this.emitContainerVisibilityEvent(!1)}if(this.gameState===4||this.gameState===3||this.selectBranches.state.isExpect||this.interactiveTimeOpenUri&&I&&this.gameState!==5){if(x){let C=((A,q,P,V)=>!A&&!q&&P||A&&!q&&P&&!V||A&&!q&&P&&V)(g,T,u,this.isSelectedContainerEvent);this.fakeRemoveView(C)}else this.removeView(),this.emitContainerVisibilityEvent(!1);(!g||!T||!h)&&(this.selectBranches.stopExpect(),b())}},isEOV:()=>this.gameState===4},c=dt(this.selectBranches.onControlEvent,s),d=((o=(n=this.player)==null?void 0:n.info.duration$.getValue())!=null?o:1/0)*1e3;this.container.createView({eventCallback:c,videoDurationMs:d}),this.disableTextControlContainerVisibilityEvents||this.emitContainerVisibilityEvent(!0,!0),this.disabledControls$.getValue()&&((l=(a=this.container).disable)==null||l.call(a))}};this.onEndOfVideo=()=>{this.gameState=4,this.selectContainerEvent(!0)};this.whilePlaying=()=>{var s,c,d;let e=this.player.experimental.element$.getValue();if(!(e instanceof HTMLVideoElement?e.readyState:void 0)||this.isRemovedOrDestroyed()&&!this.isPermanentText)return;let n=this.player.getExactTime();if(sa(n,this.container.container))this.gameState!==1&&(this.gameState=1,this.onBeforeStartTime());else if(Zr(n,this.container.container))this.gameState!==2&&(this.gameState=2,this.onStartTime());else if(this.gameState!==3){let v=this.gameState;this.gameState=3,v===2&&this.onEndTime()}else{let{hasOpenURIEventInCurrentContainer:v}=this.getContainerEventState(),b=this.selectBranches.state.isExpect,g=this.interactiveTimeOpenUri&&v;if(g&&!b){let T=this.container.getElement();T&&(T.style.visibility!=="hidden"&&((c=(s=this.container).hide)==null||c.call(s)),this.container.isRemoved||this.fakeRemoveView())}!this.isPermanentText&&!g&&this.removeView()}let o=Zr(n,this.container.container),a=this.container.container.startTime?[this.container.container.startTime,(d=this.container.container.endTime)!=null?d:1/0]:[],l={subjectId:this.container.container.id,subjectName:"container",range:a,currentTime:n,isInteractiveTime:o};this.container.onProgress(n*1e3,o),this.globalEventEmitter.emit(_.eachTick,l),this.globalEvents.eachTick$.next(l)};this.container=t,this.branches=i,this.selectBranches=n,this.subscription=new ms.Subscription,this.player=e,this.interactiveEvents=o,this.getContainerEventState=s;let m=Ee(t.container.controls);this.isPermanentText=c&&m,this.disableTextControlContainerVisibilityEvents=T&&m,this.interactiveTimeOpenUri=d,this.disabledControls$=v,this.onRemove=b,this.globalEventEmitter=l,this.gameState=0,this.globalEvents=a,this.onError=g,this.features=I,this.isSelectedControlEvent=!1,this.isSelectedContainerEvent=!1,this.registerEvents()}emitContainerVisibilityEvent(e,t=!1){e?(this.globalEventEmitter.emit(_.interactives,{subjectId:this.container.container.id,subjectName:"container",type:N.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(_.interactives,{subjectId:this.container.container.id,subjectName:"container",type:N.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,i,n,o;e?(i=(t=this.container).disable)==null||i.call(t):(o=(n=this.container).enable)==null||o.call(n)})),this.subscription.add(this.container.error$.subscribe(this.onError))}selectContainerEvent(e=!1){var i,n;let{isExpectEventForCurrentContainer:t}=this.getContainerEventState();this.interactiveEvents.containersEventsCallState.setCalled({timestamp:e?1/0:(i=this.container.container.endTime)!=null?i: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((n=this.container.container.endTime)!=null?n:1/0))}onStartTime(){this.show()}onEndTime(){this.selectContainerEvent(!1);let{isExpectTime:e,hasOpenURIEventInCurrentContainer:t}=this.getContainerEventState(),i=this.interactiveTimeOpenUri?e||t:Ce(this.container.container.events)||e;(this.isSelectedControlEvent||!i)&&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(e=this.features.controlsHideAnimation){var t;if(e){if(this.isRemovedOrDestroyed())return;this.container.removeNonInteractedControls(!0),this.container.removeView(!0,!0)}else this.container.removeView();this.globalEventEmitter.emit(_.interactives,{subjectId:this.container.container.id,subjectName:"container",type:N.containerRemoved,visibility:!1}),this.globalEvents.interactiveContainerRemoved$.next({subjectId:this.container.container.id,subjectName:"container",type:"container-removed"}),this.gameState=5,(t=this.onRemove)==null||t.call(this)}fakeRemoveView(e=!1){this.container.isRemoved||this.globalEvents.interactiveContainerFakeRemoved$.next({subjectId:this.container.container.id,subjectName:"container",type:"container-fake-removed",removeAllOpenURI:e}),this.container.fakeRemove()}updateControlsShadowStyles(e){this.container.updateControlsShadowStyles(e)}toggleBlinkAnimation(e){this.container.toggleBlinkAnimation(e)}isInteracted(){return this.container.isInteracted()}isRemovedOrDestroyed(e=!0){let t=e?this.container.willRemoved:!1;return this.gameState===5||t||this.gameState===6}destroy(e=!1){var t;this.reset(),this.removeView(e),this.gameState=6,this.subscription.unsubscribe(),this.branches=[],this.interactiveEvents.containersEventsCallState.setCalled({timestamp:(t=this.container.container.endTime)!=null?t:1/0,id:this.container.container.id})}};var fs=(r=[])=>r.reduce((e,t,i)=>{var o,a,l;let n=((o=t==null?void 0:t.controls)!=null?o:[]).filter(s=>!nt(s));if($t(n)){let s=[(a=t.startTime)!=null?a:0,(l=t.endTime)!=null?l:1/0],c={id:t.id,isRemoved:!1};if(!i)e.push({subjects:[c],range:s});else{let d=[],v=-1/0,b=1/0,g=[],T=[];for(let I=0;I<e.length;I++){let m=e[I];if(T.push(...m.subjects),m.range[0]<b&&(b=m.range[0]),m.range[1]>v&&(v=m.range[1]),s[0]>=m.range[0]&&s[1]<=m.range[1])return e[I].subjects.push(c),e;s[0]<m.range[0]&&s[1]>m.range[0]&&(d.push(I),g=g.concat(m.subjects)),s[0]>=m.range[0]&&s[0]<=m.range[1]&&(d.push(I),g=g.concat(m.subjects),s[0]=m.range[0]),s[1]>=m.range[0]&&s[1]<=m.range[1]&&(d.push(I),g=g.concat(m.subjects),s[1]=m.range[1])}if(T.push(c),s[0]<=b&&s[1]>=v)return[{subjects:T,range:s}];d.length&&d.reverse().forEach(I=>{e.splice(I,1)}),e.push({subjects:g.concat([c]),range:s})}}return e},[]).sort((e,t)=>e.range[0]-t.range[0]);var Xs=te(Nt(),1),Ei=te(rr(),1),Ys=te(Ks(),1);function Qs(){let r={};function e(){for(let l in r)Object.prototype.hasOwnProperty.call(r,l)&&delete r[l]}function t(l){let s={};for(let c in r)+c<=l&&(s[c]=r[c]);return s}function i(l){let s={};for(let c in r)+c>=l&&(s[c]=r[c]);return s}function n({timestamp:l,priority:s,initiator:c}){var d;if(fr(l)){let v=(d=r[l])!=null?d:null;if(v&&s&&Ue(s,!0)){let b={},g=v[s];if(g&&(b=f(f({},b),g)),b=be(b)?null:b,b&&Ue(c,!0)){let T=b[c];return T!=null?T:null}return b}return v}return null}function o({timestamp:l,priority:s,initiator:c}){if(fr(l))if(r[l]){if(s&&Ue(s,!0))if(r[l][s]){if(c&&Ue(c,!0))if(r[l][s][c]){if(delete r[l][s][c],!be(r[l][s]))return!0}else return!1;if(delete r[l][s],!be(r[l]))return!0}else return!1;return delete r[l]}else return!1;return!1}function a(v){var b=v,{timestamp:l,priority:s,initiator:c}=b,d=ee(b,["timestamp","priority","initiator"]);var g,T,I;(T=(g=r[l])==null?void 0:g[s])!=null&&T[c]?r[l][s][c].push(f({},d)):(I=r[l])!=null&&I[s]?r[l][s]=w(f({},r[l][s]),{[c]:[f({},d)]}):r[l]?r[l]=w(f({},r[l]),{[s]:{[c]:[f({},d)]}}):r[l]={[s]:{[c]:[f({},d)]}}}return{map:r,remove:o,add:a,removeAll:e,get:n,getLte:t,getGte:i}}var $h=[E.EventActionTypes.expect,E.EventActionTypes.setNextBranch],jh=1/0;function Zs(r,e){let t=r,i,n=Bh(e),o=Qs(),a,l=()=>{g(),u()},s=h=>{o.add.call(void 0,h),T()},c=(h=[])=>{for(let y of h)if(y.action(),(0,Xs.default)($h,y.actionType))break},d=(h=1/0)=>{var C,A,q;let y=or((C=o.get({timestamp:h,priority:"control"}))!=null?C:{}),x=or((A=o.get({timestamp:h,priority:"container"}))!=null?A:{}),R=or((q=o.get({timestamp:h,priority:"chapter"}))!=null?q:{});return[...y,...x,...R]},v=h=>{n.isReady(h)&&c(d(h))},b=()=>{var h;c([...or((h=o.get({timestamp:1/0,priority:"chapter"}))!=null?h:{})])},g=()=>{i&&(a==null||a.unsubscribe(),i=void 0)},T=()=>{i||(i=()=>setTimeout(()=>{v(1/0)}),a=t.events.ended$.subscribe(i))},I=h=>{g(),t=h},m=h=>{h.priority==="container"&&n.resetCalled(h.timestamp),o.remove(h)},u=()=>{n.release(),o.removeAll()};return{setPlayer:I,add:s,remove:m,exec:v,execEndOfVideo:b,listen:T,unlisten:g,release:l,containersEventsCallState:n,getPreparedToExecActions:d}}function Bh(r){let e=new Map;return{setCalled:({timestamp:l,id:s})=>{let c=e.get(l);c&&c[s]!==void 0&&(c[s]=!0)},setData:(l=[])=>{var s;for(let c of l){let d=(s=c.endTime)!=null?s:jh,v=e.get(d);e.set(d,w(f({},v),{[c.id]:!1}))}},resetCalled:l=>{let s=e.get(l);if(s)for(let c in s)s[c]=!1},isReady:l=>{let s=e.get(l);if(!s)return!0;let c=(0,Ei.default)(s);return r?c.some(v=>v):!c.some(v=>!v)},release:()=>e.clear()}}function or(r){return(0,Ys.default)((0,Ei.default)(r)).sort(e=>e.actionType===E.EventActionTypes.expect?-1:1)}var Js={videoContentHeight:0,videoContentWidth:0},el=r=>{let{height:e,width:t}=r.info.intrinsicVideoSize$.getValue()||{};if(!(e&&t))return Js;let{clientHeight:i,clientWidth:n}=r.experimental.element$.getValue()||{};if(!(i&&n))return Js;let o=e/t,a=i/n,l,s;return a>o?(s=n,l=n*o):a<o?(s=i/o,l=i):(s=n,l=i),{videoContentWidth:s,videoContentHeight:l}};var qh=250;function tl(r){let e,t=new ResizeObserver(l=>{o(l),e=o.bind(null,l)});function i(l){let{parentElement:s,player:c}=r();if(s&&c){let{videoContentWidth:d,videoContentHeight:v}=el(c);s.style.setProperty("--interactive-content-width",`${d}px`),s.style.setProperty("--interactive-content-height",`${v}px`),s.style.setProperty("--interactive-width",`${l[0].contentRect.width}px`),s.style.setProperty("--interactive-height",`${l[0].contentRect.height}px`)}}function n(){let{parentElement:l}=r();l.removeAttribute("style")}let o=st(l=>{let{fns:s=[]}=r();i(l);for(let c of s)c()},qh);function a(){e=void 0,t.disconnect(),n()}return{resizeObserver:t,calc:()=>{e==null||e()},release:a}}var Dh=r=>Math.floor(Math.random()*r),il=r=>{var n;let e=r.length,t=1/0,i=null;for(;e--;){let o=r[e],a=(n=o.weight)!=null?n:1;a<t&&(t=a,i=o)}return i},nl=r=>{var n;let e=r.length,t=-1/0,i=null;for(;e--;){let o=r[e],a=(n=o.weight)!=null?n:0;a>t&&(t=a,i=o)}return i};var ol=r=>{let e=r.length,t=Dh(e);return r[t]},rl=1,al=r=>{var i,n;let e=0;for(let o=0;o<r.length;++o)e+=(i=r[o].weight)!=null?i:rl;let t=Math.random()*e;e=0;for(let o=0;o<r.length-1;++o)if(e+=(n=r[o].weight)!=null?n:rl,e>=t)return r[o];return r[r.length-1]};var sl={shouldOpenNow:!0,isDetachContainer:!0},ll="after-expect",Ti=(r,e=!1)=>w(f({},r),{args:e?f(f({},r.args),sl):f(f({},sl),r.args)}),cl=({globalEventEmitter:r,globalEvents:e,player:t,interactiveEvents:i})=>{let n={isExpect:!1},o=()=>{n.isExpect&&(n.isExpect=!1)},a=({action:u,controlType:h,controlId:y,containerId:x,branches:R=[],onEvent:C,isEOV:A=()=>!1,isDisabled:q=()=>!1})=>{let P=Ti(u,A()),V={timestamp:1/0,priority:"control",initiator:y,actionType:P.type},F=q(),j=r.emit.bind(r,_.interactives,{subjectId:y,subjectType:h,subjectName:"control",type:F?N.actionChoiceCanceled:N.actionChoice,actionType:u.type,payload:f({invokeImmediately:P.args.shouldOpenNow,containerId:x},P.args)}),Se=()=>{e.interactiveActionChoice$.next({subjectId:y,subjectType:h,subjectName:"control",type:F?"action-choice-canceled":"action-choice",actionType:u.type,payload:f({invokeImmediately:P.args.shouldOpenNow,containerId:x},P.args)})};if(F){j(),Se();return}switch(P.type.trim().toLowerCase()){case E.EventActionTypes.setNextBranch.trim().toLowerCase():{let ae=R.find(J=>J.id===P.args.branchId);if(!ae)return;C(P.args.isDetachContainer,g.bind(null,{subjectId:y,subjectName:"control"})),j(),Se(),P.args.shouldOpenNow?I({subjectId:y,subjectName:"control",subjectType:h,action:P,payload:{chapterId:ae.chapterId,autoSelect:!1}}):i.add(w(f({},V),{action:I.bind(null,{subjectId:y,subjectName:"control",subjectType:h,action:P,payload:{chapterId:ae.chapterId,autoSelect:!1}})}));return}case E.EventActionTypes.continuePlayback.trim().toLowerCase():{C(P.args.isDetachContainer,g.bind(null,{subjectId:y,subjectName:"control"})),j(),Se(),P.args.shouldOpenNow?T({subjectId:y,subjectName:"control",subjectType:h,action:u}):i.add(w(f({},V),{action:T.bind(null,{subjectId:y,subjectName:"control",subjectType:h,action:u})}));return}case E.EventActionTypes.openURI.trim().toLowerCase():{C(P.args.isDetachContainer,g.bind(null,{subjectId:y,subjectName:"control"})),j(),Se(),P.args.shouldOpenNow?m({subjectId:y,subjectName:"control",subjectType:h,action:P,payload:{URI:u.args.uri}}):i.add(w(f({},V),{action:m.bind(null,{subjectId:y,subjectName:"control",subjectType:h,action:P,payload:{URI:u.args.uri}})}));return}default:{let ae="Unexpected control event",J=new B(1,1,{message:ae});d(J,ae);return}}},l=({action:u,container:{id:h,endTime:y},branches:x=[],isEOV:R=!1,autoSelected:C=!1})=>{let A=Ti(u,R),q={timestamp:!A.args.shouldOpenNow||R?1/0:y!=null?y:1/0,priority:"container",initiator:h,actionType:A.type},P=r.emit.bind(r,_.interactives,{subjectId:h,subjectName:"container",type:N.actionChoice,actionType:A.type,payload:f({invokeImmediately:A.args.shouldOpenNow},A.args)}),V=()=>{e.interactiveActionChoice$.next({subjectId:h,subjectName:"container",type:"action-choice",actionType:A.type,payload:f({invokeImmediately:A.args.shouldOpenNow},A.args)})};switch(A.type.trim().toLowerCase()){case E.EventActionTypes.setNextBranch.trim().toLowerCase():{let F=x.find(j=>j.id===A.args.branchId);if(!F)return;P(),V(),i.add(w(f({},q),{action:I.bind(null,{subjectId:h,subjectName:"container",action:A,payload:{chapterId:F.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():{P(),V(),i.add(w(f({},q),{action:T.bind(null,{subjectId:h,subjectName:"container",action:A})}));return}case E.EventActionTypes.openURI.trim().toLowerCase():{P(),V(),i.add(w(f({},q),{action:m.bind(null,{subjectId:h,subjectName:"container",action:A,payload:{URI:u.args.uri}})}));return}default:{let F="Unexpected container event",j=new B(1,1,{message:F});d(j,F);return}}};function s({container:u,branches:h,isEOV:y=!1}){var R,C;let x=Jr(u.events);if(x){let A=Ti(x.action,y);r.emit(_.interactives,{subjectId:u.id,subjectName:"container",type:N.actionChoice,actionType:A.type,payload:f({invokeImmediately:A.args.shouldOpenNow},A.args)}),e.interactiveActionChoice$.next({subjectId:u.id,subjectName:"container",type:"action-choice",actionType:A.type,payload:f({invokeImmediately:A.args.shouldOpenNow},A.args)}),i.add({timestamp:y?1/0:(R=u.endTime)!=null?R:1/0,priority:"container",initiator:u.id,actionType:E.EventActionTypes.expect,action:b.bind(null,{subjectId:u.id,subjectName:"container"})}),n.isExpect=!0}else for(let A of(C=u.events)!=null?C:[])l({action:A.action,container:u,branches:h,isEOV:y})}let c=({chapterId:u,action:h,branches:y=[]})=>{let x=r.emit.bind(r,_.interactives,{subjectId:u,subjectName:"chapter",type:N.actionChoice,actionType:h.type,payload:h.args}),R=()=>{e.interactiveActionChoice$.next({subjectId:u,subjectName:"chapter",type:"action-choice",actionType:h.type,payload:h.args})};switch(h.type.trim().toLowerCase()){case E.EventActionTypes.setNextBranch.trim().toLowerCase():{let C=y.find(A=>A.id===h.args.branchId);return C!=null&&C.chapterId?(x(),R(),I.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case E.EventActionTypes.setWeightlessRandomBranch.trim().toLowerCase():{let C=ol(y);return C!=null&&C.chapterId?(x(),R(),I.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case E.EventActionTypes.setRandomBranch.trim().toLowerCase():{let C=al(y);return C!=null&&C.chapterId?(x(),R(),I.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case E.EventActionTypes.setMaxWeightBranch.trim().toLowerCase():{let C=nl(y);return C!=null&&C.chapterId?(x(),R(),I.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case E.EventActionTypes.setMinWeightBranch.trim().toLowerCase():{let C=il(y);return C!=null&&C.chapterId?(x(),R(),I.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case E.EventActionTypes.continuePlayback.trim().toLowerCase():return x(),R(),T.bind(null,{subjectId:u,subjectName:"chapter",action:h});case E.EventActionTypes.openURI.trim().toLowerCase():return x(),R(),m.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{URI:h.args.uri}});default:{let C="Unexpected chapter event",A=new B(1,1,{message:C});d(A,C);return}}};function d(u,h){console.error(h),e.error$.next(u),r.emit(_.errors,u)}function v(u){var y;let h=Jr(u.events);if(h){if(Z(u))return;r.emit(_.interactives,{subjectId:u.id,subjectName:"chapter",type:N.actionChoice,actionType:h.action.type,payload:h.action.args}),e.interactiveActionChoice$.next({subjectId:u.id,subjectName:"chapter",type:"action-choice",actionType:h.action.type,payload:h.action.args}),i.add({timestamp:1/0,priority:"chapter",initiator:u.id,actionType:E.EventActionTypes.expect,action:b.bind(null,{subjectId:u.id,subjectName:"chapter"})})}else(y=u.events)==null||y.forEach(x=>{let R=c({chapterId:u.id,action:x.action,branches:u.branches});R&&i.add({timestamp:1/0,priority:"chapter",initiator:u.id,actionType:x.action.type,action:R})})}let b=({subjectId:u,subjectName:h})=>{t.pause(),r.emit(_.interactives,{subjectId:u,subjectName:h,type:N.actionExecution,actionType:E.EventActionTypes.expect}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,type:"action-execution",actionType:E.EventActionTypes.expect})},g=({subjectId:u,subjectName:h})=>{t.info.isEnded$.getValue()?i.execEndOfVideo():t.play(),r.emit(_.interactives,{subjectId:u,subjectName:h,type:N.actionExecution,actionType:ll}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,type:"action-execution",actionType:ll})},T=({subjectId:u,subjectName:h,subjectType:y,action:x})=>{r.emit(_.interactives,{subjectId:u,subjectName:h,subjectType:y,type:N.actionExecution,actionType:x.type}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,subjectType:y,type:"action-execution",actionType:x.type})},I=({subjectId:u,subjectName:h,subjectType:y,action:x,payload:R})=>{R.behaviour="change-chapter",r.emit(_.interactives,{subjectId:u,subjectName:h,subjectType:y,type:N.actionExecution,actionType:x.type,payload:R}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,subjectType:y,type:"action-execution",actionType:x.type,payload:R})},m=({subjectId:u,subjectName:h,subjectType:y,action:x,payload:R})=>{if(!R.URI)return;let C=window.open(R.URI,"_blank","noopener,noreferrer");C&&(C.opener=null),r.emit(_.interactives,{subjectId:u,subjectName:h,subjectType:y,type:N.actionExecution,actionType:x.type}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,subjectType:y,type:"action-execution",actionType:x.type})};return{onControlEvent:a,onContainerEvent:l,onChapterEvent:c,onExpectEvent:b,expectEventHandler:g,setManifestChapterEvents:v,setManifestContainerEvents:s,stopExpect:o,state:n}};var Ai=te(si(),1),Q=require("@vkontakte/videoplayer-shared/es2015");var ar=(r,e)=>{let t={};return r.map(i=>{if(!t[i]){let n=e.chapters.find(a=>a.id===i);if(!n)return null;let o=e.media.videos.find(a=>n.videoId===a.id);if(!o)return null;t[i]=Ii(o)}return t[i]}).filter(Boolean)},ul=r=>{for(let e of r.variants)if(pl(e)&&e.payload)return e.payload.id},pl=r=>!!(r.type==="custom"&&r.payload&&r.payload.type==="vk"),Ii=r=>{let e=ul(r);if(!e)return null;let t=e.split("_").pop();return t?parseInt(t,10):null},hl=(r,e)=>{for(let t of r.media.videos)if(e===Ii(t)){for(let i of r.chapters)if(i.videoId===t.id)return i.id;return}},xi=(r,e)=>r.reduce((t,i)=>{let n=hl(e,i);return n?[...t,n]:t},[]);var ue,xe,Ae,K,sr,pe,he,oe,we,Be,qe,ft=class{constructor({globalEventEmitter:e,videoId:t,interactiveController:i,historyApi:n,settings:o}){this.state={history$:new Q.ValueSubject([]),hasPrevChapter$:new Q.ValueSubject(!1),prevChapter$:new Q.ValueSubject(null),isInitialChapter$:new Q.ValueSubject(!1),isGoBackLimited$:new Q.ValueSubject(!1)};G(this,ue,null);G(this,xe);G(this,Ae,!1);G(this,K,null);G(this,sr,null);this.events={inited$:new Q.Subject,destroyed$:new Q.Subject,error$:new Q.Subject};G(this,pe,null);G(this,he,null);G(this,oe,null);G(this,we,new Q.Subscription);G(this,Be,!1);G(this,qe,0);var a;$(this,pe,t),$(this,oe,e),$(this,he,i),$(this,ue,n),$(this,xe,o),this.state.history$&&O(this,we)&&((a=O(this,we))==null||a.add(this.state.history$.subscribe(l=>{var s,c;this.state.prevChapter$.next((0,Ai.default)(l,-2)||null),this.state.hasPrevChapter$.next(l.length>1),this.state.isInitialChapter$.next(this.getInitialChapterId()===((c=(s=O(this,K))==null?void 0:s.metadata)==null?void 0:c.initChapterId)),this.state.isGoBackLimited$.next(O(this,qe)===O(this,xe).maxLength-1)})))}setManifest(e){return k(this,null,function*(){if(!O(this,he)||!O(this,oe))return;$(this,K,e),yield this.getProjectHistory();let t=this.getInitialChapterId();yield O(this,he).setChapter({chapterId:t,pushToHistory:!1}),O(this,Ae)||($(this,Ae,!0),this.events.inited$.next({initChapterId:t}))})}get inited(){return O(this,Ae)}updateHistory(e,t=!0){return k(this,null,function*(){var l;if(!O(this,K))return;O(this,Be)?($(this,Be,!1),ji(this,qe)._++):$(this,qe,0);let i=O(this,K),n=e.length-O(this,xe).maxLength,o=n>0?e.slice(n):e,a=ar(o,i);if($(this,sr,a),this.state.history$.next(o),!(!t||!O(this,ue)||!O(this,pe)))try{yield O(this,ue).save(O(this,pe),a)}catch(s){let c=new B(1,5,"Unable to save interactive history");this.events.error$.next(c),(l=O(this,oe))==null||l.emit(_.errors,c)}})}goBack(){return k(this,null,function*(){var i;if(!this.state||!O(this,he)){let n=new B(1,5,"Unable to save interactive history");return this.events.error$.next(n),(i=O(this,oe))==null?void 0:i.emit(_.errors,n)}$(this,Be,!0);let e=this.state.history$.getValue().slice(0,-1),t=e.pop();this.state.history$.next(e),yield O(this,he).setChapter({chapterId:t,playPrev:!0})})}getProjectHistory(){return k(this,null,function*(){var n;if(!O(this,K)||!O(this,pe))return;let e=O(this,K),t=[this.getInitialVideoId()];if(O(this,ue))try{let o=yield O(this,ue).get(O(this,pe));o.length&&(t=o)}catch(o){let a=new B(1,5,"Error while trying to fetch data");this.events.error$.next(a),(n=O(this,oe))==null||n.emit(_.errors,a)}let i=xi(t,e);this.state.history$.next(i)})}getInitialChapterId(){var t;let e=this.state.history$.getValue();return(0,Ai.default)(e,-1)||O(this,xe).initChapterId||((t=O(this,K))==null?void 0:t.metadata.initChapterId)}getInitialVideoId(){if(O(this,K)){let e=this.getInitialChapterId();return ar([e],O(this,K)).pop()}return null}destroy(){var e,t;$(this,pe,null),$(this,ue,null),$(this,he,null),(e=O(this,we))==null||e.unsubscribe(),$(this,we,null),$(this,Ae,!1),(t=O(this,oe))==null||t.emit(_.historyDestroyed),this.events.destroyed$.next(),$(this,oe,null)}};ue=new WeakMap,xe=new WeakMap,Ae=new WeakMap,K=new WeakMap,sr=new WeakMap,pe=new WeakMap,he=new WeakMap,oe=new WeakMap,we=new WeakMap,Be=new WeakMap,qe=new WeakMap;var lr=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 n;let e=(n=this.rootElement.getContext("2d"))==null?void 0:n.getImageData(0,0,this.rootElement.width,this.rootElement.height);if(!e)return!1;let t=e.data,i=t.length;for(let o=3;o<i;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 k(this,null,function*(){let i=e.width+e.height;if(this._prevSizeId===i)return;let n;t&&(n=yield this.save()),this.rootElement.width=e.width,this.rootElement.height=e.height,t&&n&&this.restore(n),this._prevSizeId=i})}save(){return k(this,null,function*(){let e=this.rootElement.toDataURL("image/jpeg",1),t=new Image;return t.crossOrigin="anonymous",t.src=e,yield t.decode(),t})}restore(e){var t;this.rootElement&&((t=this.rootElement.getContext("2d"))==null||t.drawImage(e,0,0,this.rootElement.width,this.rootElement.height))}};var cr=class{constructor({parentElement:e,endOffsetMs:t=250,onError:i}){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,i=this.isChapterEndTime(t);if(this.isContainerTime(t))this._endTimeFrameReceived=!1,this._containerTimeFrameShouldReceived=!0,this._shouldCallSkip=!0;else if(i)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;
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
height: var(--interactive-height);
|
|
12
12
|
background-color: var(--black);
|
|
13
13
|
visibility: hidden;
|
|
14
|
-
`,this.lastFrameCanvas=new
|
|
14
|
+
`,this.lastFrameCanvas=new lr,this.endOffsetMs=t,this._callbacks={onError:i},this.lastFrameCanvas.rootElement.style.cssText=`
|
|
15
15
|
position: absolute;
|
|
16
16
|
top: 50%;
|
|
17
17
|
left: 50%;
|
|
18
18
|
transform: translate(-50%, -50%);
|
|
19
|
-
`,this.rootElement.prepend(this.lastFrameCanvas.rootElement),e.prepend(this.rootElement)}destroy(){this.hide(),this.reset(),this._callbacks=void 0,this.lastFrameCanvas.destroy(),this.rootElement.remove()}setVideoDuration(e){this.currentVideoDurationMs=e}setVideoElement(e){this.lastFrameCanvas.setCanvasImageSource(e)}setCurrentChapter(e){this.currentChapter=e}show(){this.rootElement.style.visibility="visible"}hide(){this.rootElement.style.visibility="hidden"}updateCanvasDimensions(e=!1){return
|
|
19
|
+
`,this.rootElement.prepend(this.lastFrameCanvas.rootElement),e.prepend(this.rootElement)}destroy(){this.hide(),this.reset(),this._callbacks=void 0,this.lastFrameCanvas.destroy(),this.rootElement.remove()}setVideoDuration(e){this.currentVideoDurationMs=e}setVideoElement(e){this.lastFrameCanvas.setCanvasImageSource(e)}setCurrentChapter(e){this.currentChapter=e}show(){this.rootElement.style.visibility="visible"}hide(){this.rootElement.style.visibility="hidden"}updateCanvasDimensions(e=!1){return k(this,null,function*(){this._containerTimeFrameShouldReceived||this._endTimeFrameReceived||(e=!1);let t=getComputedStyle(this.rootElement),i={width:parseInt(t.getPropertyValue("--interactive-content-width"),10),height:parseInt(t.getPropertyValue("--interactive-content-height"),10)};try{this.lastFrameCanvas.updateCanvasDimensions(i,e)}catch(n){this._onError(n)}})}draw(){(this._containerTimeFrameShouldReceived||!this._containerTimeFrameShouldReceived&&!this._endTimeFrameReceived)&&this.lastFrameCanvas.draw()}isChapterEndTime(e){return this.currentVideoDurationMs&&e>=this.currentVideoDurationMs-this.endOffsetMs}isContainerTime(e){if(this.currentChapter)return this.currentChapter.containers.some(t=>{var i,n,o;return((i=t.controls)==null?void 0:i.length)&&e>=((n=t.startTime)!=null?n:0)&&e<=Math.min((o=t.endTime)!=null?o:1/0,this.currentVideoDurationMs-this.endOffsetMs)})}reset(){this._endTimeFrameReceived=!1,this._containerTimeFrameShouldReceived=!1,this._shouldCallSkip=!1}_onError(e){var t,i;(i=(t=this._callbacks)==null?void 0:t.onError)==null||i.call(t,e)}};function dl(r=0){return new Promise(e=>{setTimeout(()=>{e(0)},r)})}var ml=`/* interactive-container */
|
|
20
20
|
.interactive-container {
|
|
21
21
|
opacity: 1;
|
|
22
22
|
visibility: visible;
|
|
@@ -31,6 +31,16 @@
|
|
|
31
31
|
visibility: hidden;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
.interactive-container.interactive-container-before-remove.interactive-container-before-remove-delay {
|
|
35
|
+
transition-delay: var(--interactive-remove-delay);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.interactive-container.interactive-container-before-remove {
|
|
39
|
+
transition: opacity var(--interactive-transition-1);
|
|
40
|
+
opacity: 0;
|
|
41
|
+
pointer-events: none;
|
|
42
|
+
}
|
|
43
|
+
|
|
34
44
|
/* blink-anim */
|
|
35
45
|
.interactive-control-blink-anim {
|
|
36
46
|
animation-duration: 2001ms;
|
|
@@ -131,9 +141,14 @@
|
|
|
131
141
|
--interactive-bg-color-1: rgba(255, 255, 255, 0.08);
|
|
132
142
|
--interactive-button-hover-opacity: 0.8;
|
|
133
143
|
--interactive-area-hover-opacity: 0;
|
|
144
|
+
--interactive-remove-delay: 300ms;
|
|
134
145
|
}
|
|
135
146
|
|
|
136
147
|
/* interactive-control */
|
|
148
|
+
.interactive-control-wrapper-selected {
|
|
149
|
+
pointer-events: none;
|
|
150
|
+
}
|
|
151
|
+
|
|
137
152
|
.interactive-control {
|
|
138
153
|
display: flex;
|
|
139
154
|
width: 100%;
|
|
@@ -165,20 +180,106 @@
|
|
|
165
180
|
transition: border-color var(--interactive-transition-1), box-shadow var(--interactive-transition-1), opacity var(--interactive-transition-2);
|
|
166
181
|
}
|
|
167
182
|
|
|
183
|
+
.interactive-control-wrapper-selected > .interactive-control-button {
|
|
184
|
+
transition: opacity var(--interactive-transition-1);
|
|
185
|
+
opacity: 0.5;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.interactive-control-wrapper-selected > .interactive-control-area {
|
|
189
|
+
transition: opacity var(--interactive-transition-1);
|
|
190
|
+
opacity: 0;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
.interactive-control.interactive-control-before-remove {
|
|
195
|
+
transition: opacity var(--interactive-transition-1);
|
|
196
|
+
opacity: 0;
|
|
197
|
+
pointer-events: none;
|
|
198
|
+
}
|
|
199
|
+
|
|
168
200
|
.interactive-container.interactive-container-disabled .interactive-control-button,
|
|
169
201
|
.interactive-container.interactive-container-disabled .interactive-control-area {
|
|
170
202
|
animation: none;
|
|
171
203
|
}
|
|
172
204
|
|
|
173
|
-
.interactive-container:not(.interactive-container-disabled) .interactive-control-
|
|
174
|
-
.interactive-container:not(.interactive-container-disabled) .interactive-control-
|
|
205
|
+
.interactive-container:not(.interactive-container-disabled) .interactive-control-wrapper:not(.interactive-control-wrapper-selected) > .interactive-control-button:not(.interactive-control-blink-anim):hover,
|
|
206
|
+
.interactive-container:not(.interactive-container-disabled) .interactive-control-wrapper:not(.interactive-control-wrapper-selected) > .interactive-control-button:not(.interactive-control-blink-anim):focus-visible {
|
|
175
207
|
opacity: var(--interactive-button-hover-opacity);
|
|
176
208
|
animation: none;
|
|
177
209
|
}
|
|
178
210
|
|
|
179
|
-
.interactive-container:not(.interactive-container-disabled) .interactive-control-
|
|
180
|
-
.interactive-container:not(.interactive-container-disabled) .interactive-control-
|
|
211
|
+
.interactive-container:not(.interactive-container-disabled) .interactive-control-wrapper:not(.interactive-control-wrapper-selected) > .interactive-control-area:not(.interactive-control-blink-anim):hover,
|
|
212
|
+
.interactive-container:not(.interactive-container-disabled) .interactive-control-wrapper:not(.interactive-control-wrapper-selected) > .interactive-control-area:not(.interactive-control-blink-anim):focus-visible {
|
|
181
213
|
opacity: var(--interactive-area-hover-opacity);
|
|
182
214
|
animation: none;
|
|
183
215
|
}
|
|
184
|
-
`;var Js=r=>{let e=document.createElement("style");e.textContent=Zs,r.prepend(e)};var rl=require("@vkontakte/videoplayer-core/es2015");var el=Object.freeze({lang:w.InterfaceLanguage.RU,loaders:{},graph:!1,initSeamless:!1,lastFrame:!1,permanentTextControls:!0,interactiveTimeOpenUri:!1,config:{historyMaxLength:100,noInteractionEventTimeout:3e4},isTouch:!1,animationsFeatureToggles:{areaControlShadow:!1,controlsExpectTimeBlinkAnimation:!1,controlsTapPlace:!1}});function Sh(){let r=document.createElement("div");return r.classList.add("interactive-chapter"),r}var mt=class{constructor(e){this.playerSubscriptions=new w.Subscription;this.subscriptions=new w.Subscription;this.globalEventEmitter=new Bt;this.animation=new qt;this.seekToInteractiveController=new nt;this.endedRanges=new Set;this.gameControllers=[];this.rootElement=Sh();this.factories=new Map([["choice",Ot]]);this.isFirstChapterFetched=!1;this.player=null;this.interactiveEvents=null;this.selectBranches=null;this.seamlessController=null;this.seamlessControllerSubs=new w.Subscription;this.graph=null;this.lastFrame=null;this.blinkAnimationRef=null;this.appState=0;this.state={prevChapter$:new w.ValueSubject(null),isInitialChapter$:new w.ValueSubject(!1),isFirstChapter$:new w.ValueSubject(!0),isEndChapter$:new w.ValueSubject(!1),isInteractiveExpectation$:new w.ValueSubject(!1),isReplay$:new w.ValueSubject(!1),calledByInteractive$:new w.ValueSubject(!1),lastChapterChangeWasInitiatedByInteractive$:new w.ValueSubject(!1),disabledControls$:new w.ValueSubject(!1),interactiveRanges$:new w.ValueSubject([]),isInteractiveTime$:new w.ValueSubject(!1),statistics$:new w.ValueSubject(null),isSeekable$:new w.ValueSubject(!1)};this.events={noInteraction$:new w.Subject,graphVisibilityChanged$:new w.Subject,watchAgainIsClicked$:new w.Subject,chapterChanged$:new w.Subject,playerChanged$:new w.Subject,error$:new w.Subject,eachTick$:new w.Subject,manifestChanged$:new w.Subject,interactiveRangeEnded$:new w.Subject,interactiveContainerRemoved$:new w.Subject,interactiveContainerFakeRemoved$:new w.Subject,interactiveActionExecution$:new w.Subject,interactiveActionChoice$:new w.Subject,interactiveVisibilityChanged$:new w.Subject};this.emitErrorEvent=e=>{this.events.error$.next(e),this.globalEventEmitter.emit(P.errors,e)};this.clearHistoryIfEnded=()=>{var i;let e=(i=this.player)==null?void 0:i.info.isEnded$.getValue(),t=this.state.isInteractiveExpectation$.getValue(),{chapter:n}=this.getCurrentChapter();e&&n&&Z(n)&&!t&&this.historyController.updateHistory([]),window.removeEventListener("beforeunload",this.clearHistoryIfEnded)};this.handleSeamlessPlayerChanged=e=>{if(!e)return;let i=e,{statistics:t}=i,n=ee(i,["statistics"]);if(t){let{statSubscription:o,oneStat:a}=t;o.add(a.attachToInteractive(this.getStatEvents())),this.state.statistics$.next(t)}this.state.isReplay$.getValue()&&this.state.isReplay$.next(!1),this.events.playerChanged$.next(n),this.globalEventEmitter.emit(P.playerChanged,n)};this.onPlaybackStarted=()=>{var e;(e=this.resizeManager)==null||e.calc(),this.animation.requestAnimation()};this.destroyGameControllers=(e=!0)=>{this.gameControllers.forEach(t=>{!e&&t.isPermanentText||(this.animation.removeFn(t.whilePlaying),t.destroy())})};this.completeInteractiveRange=e=>{let{interactiveRanges$:t}=this.state,i=t.getValue().map(o=>T(d({},o),{subjects:o.subjects.filter(a=>a.id!==e)}));t.next(i)};this.clearNoInteractionTimeout=()=>{this.noInteractionTimeout&&(clearTimeout(this.noInteractionTimeout),this.noInteractionTimeout=void 0)};var i,o;if(this._options=T(d(d({},el),e),{config:d(d({},el.config),e.config)}),(i=this._options.animationsFeatureToggles)==null?void 0:i.controlsExpectTimeBlinkAnimation){this.blinkAnimationRef=new St,this.blinkAnimationRef.create();let a=this.blinkAnimationRef.element;a&&this.rootElement.append(a)}this._options.parentElement.append(this.rootElement),this.historyController=new dt({interactiveController:this,globalEventEmitter:this.globalEventEmitter,videoId:(o=this._options.projectInfo)==null?void 0:o.videoId,historyApi:this._options.historyApi,settings:{maxLength:this._options.config.historyMaxLength,initChapterId:this._options.initChapterId}}),this._options.lastFrame&&(this.lastFrame=new nr({parentElement:this._options.parentElement,onError:a=>{let l=new B(1,6,a);this.emitErrorEvent(l)}})),Js(this._options.parentElement),this.subscriptions.add((0,w.fromEvent)(this.rootElement,"mousedown").subscribe(a=>a.stopPropagation())).add((0,w.fromEvent)(this.rootElement,"mouseup").subscribe(a=>a.stopPropagation())),this.manifestController=new ge(this._options.loaders,a=>{let l=new B(1,3,a);this.emitErrorEvent(l)});let n=[];this._options.lastFrame&&n.push(()=>{var a;(a=this.lastFrame)==null||a.updateCanvasDimensions(!0)}),n.push(()=>{let a=this.state.isInteractiveTime$.getValue();for(let l of this.gameControllers)l.onResize(a)}),this.resizeManager=Fs(()=>({player:this.player,parentElement:this._options.parentElement,fns:n})),this._options.graph&&(this.graph=new rt({root:this._options.parentElement,lang:this._options.lang,onOpenPreviewClick:a=>{this.setChapter({chapterId:a}),this.globalEventEmitter.emit(P.graph,{type:je.watchAgainClicked,chapterId:a}),this.events.watchAgainIsClicked$.next(a)},onError:a=>{let l=new B(1,2,{message:a});this.emitErrorEvent(l)}})),this.initSubscriptions()}initSubscriptions(){this.playerSubscriptions.add(this.historyController.events.inited$.subscribe(t=>O(this,[t],function*({videosInfo:e=[]}){this._options.initSeamless&&(yield this.initSeamless(),this.updateGraphVideosInfo(e))}))),this.subscriptions.add(this.events.interactiveContainerRemoved$.subscribe(({subjectId:e})=>{this.completeInteractiveRange(e)})).add(this.events.interactiveContainerFakeRemoved$.subscribe(({subjectId:e,removeAllOpenURI:t})=>{this.handleFakeRemoval(e,t)})).add(this.events.interactiveActionExecution$.subscribe(e=>{var t,n;if(this.state.calledByInteractive$.next(!0),this.state.lastChapterChangeWasInitiatedByInteractive$.next(!0),((t=e.payload)==null?void 0:t.behaviour)==="change-chapter"){let{chapterId:i}=e.payload;this.setChapter({chapterId:i}),this.state.isFirstChapter$.getValue()&&this.state.isFirstChapter$.next(!1)}else if(((n=e.payload)==null?void 0:n.behaviour)==="change-manifest"){let{manifestURL:i}=e.payload;i&&this.setManifest(i)}e.actionType==="expect"?(this.state.isInteractiveExpectation$.next(!0),this.updateControlsShadowStyles({subjectName:e.subjectName,subjectId:e.subjectId,isExpect:!0}),this.toggleBlinkAnimation({subjectName:e.subjectName,subjectId:e.subjectId,isExpect:!0})):e.actionType==="after-expect"&&(this.state.isInteractiveExpectation$.next(!1),this.updateControlsShadowStyles({subjectName:e.subjectName,subjectId:e.subjectId,isExpect:!1}),this.toggleBlinkAnimation({subjectName:e.subjectName,subjectId:e.subjectId,isExpect:!1}))})).add(this.events.manifestChanged$.subscribe(()=>{this.state.calledByInteractive$.next(!1),this.state.lastChapterChangeWasInitiatedByInteractive$.next(!1)})).add(this.events.interactiveActionChoice$.subscribe(({type:e,subjectName:t,payload:n})=>{e!=="action-choice"||t==="chapter"||"invokeImmediately"in n&&n.invokeImmediately||this.destroyGameControllers(!1)}))}initSeamless(){return O(this,null,function*(){this.seamlessController=pn(this),this.seamlessControllerSubs.add(this.seamlessController.activePlayerChanged.subscribe(this.handleSeamlessPlayerChanged)),yield this.seamlessController.init()})}handlePositionChange(e){(!this.graph||this.graph.isHidden)&&this.checkIfSeekable();let t=e*1e3,i=this.getInteractiveRanges().reverse().find(({range:o})=>t>=o[1]);if(i){let o=i.range.join("-");this.endedRanges.has(o)||(this.endedRanges.add(o),this.globalEventEmitter.emit(P.interactives,{type:N.rangeEnded,payload:i,visibility:!0}),this.events.interactiveRangeEnded$.next({type:"range-ended",payload:i}))}}registerVideoEvents(){this.player&&(window.removeEventListener("beforeunload",this.clearHistoryIfEnded),this.playerSubscriptions.unsubscribe(),window.addEventListener("beforeunload",this.clearHistoryIfEnded),this.playerSubscriptions.add(this.player.events.started$.pipe((0,w.once)()).subscribe(this.onPlaybackStarted)).add(this.player.events.playing$.subscribe(this.animation.requestAnimation)).add(this.player.events.willPause$.subscribe(this.animation.cancelAnimation)).add(this.player.info.position$.subscribe(this.handlePositionChange.bind(this))).add(this.manifestController.prevChapter$.subscribe(e=>this.state.prevChapter$.next(e))).add((0,w.combine)({position:this.player.info.position$,interactiveRanges:this.state.interactiveRanges$,isInteractiveExpectation:this.state.isInteractiveExpectation$}).subscribe(({position:e,interactiveRanges:t,isInteractiveExpectation:n})=>{var s;let i;if(n)i=!0;else{let c=e*1e3;i=!!t.find(({range:[v,y],subjects:g})=>v<c&&c<y&&g.some(R=>!R.isRemoved)&&g.length)}i!==this.state.isInteractiveTime$.getValue()&&this.state.isInteractiveTime$.next(i);let o=!!this.noInteractionTimeout,l=((s=this.player)==null?void 0:s.info.playbackState$.getValue())==="playing"||n;i&&!o&&l?this.noInteractionTimeout=window.setTimeout(()=>{this.events.noInteraction$.next()},this._options.config.noInteractionEventTimeout):o&&!l&&this.clearNoInteractionTimeout()})),this.playerSubscriptions.add(this.historyController.events.error$.subscribe(this.events.error$)),this._options.lastFrame&&this.playerSubscriptions.add(this.player.info.duration$.subscribe(e=>{var t;(t=this.lastFrame)==null||t.setVideoDuration(e*1e3)})).add(this.player.experimental.element$.subscribe(e=>{var t;e&&((t=this.lastFrame)==null||t.setVideoElement(e))})).add(this.player.events.firstFrame$.subscribe(()=>{var e;(e=this.lastFrame)==null||e.reset(),setTimeout(()=>{var t,n;(t=this.lastFrame)==null||t.hide(),(n=this.lastFrame)==null||n.lastFrameCanvas.clear()},50)})).add(this.player.events.seeked$.subscribe(this.lastFrame.onSeek)))}setGameControllers(){var t,n;let e=this.manifestController.chapter;e&&this.appState===1&&((t=this.selectBranches)==null||t.setManifestChapterEvents(e),this.gameControllers=this.getGameControllers(e),(n=this.interactiveEvents)==null||n.containersEventsCallState.setData(e.containers),this.seekToInteractiveController.setContainers(this.gameControllers.map(i=>i.container.container).filter(i=>!Ce(i.controls))),this._options.lastFrame&&this.animation.addFn(()=>{var i;this.player&&((i=this.lastFrame)==null||i.onEachTick(this.player.info.position$.getValue()*1e3))},!0),this.state.interactiveRanges$.next(this.getInteractiveRanges()),this.appState=2)}getGameControllers(e){let t=[];return e.containers.forEach(n=>{var l,s,c,m;let i=n.type.trim().toLowerCase(),o=this.factories.get(i),a=o==null?void 0:o(n,this.rootElement,{isTouch:(s=(l=this._options)==null?void 0:l.isTouch)!=null?s:!1,features:{controlsExpectTimeBlinkAnimation:(c=this._options.animationsFeatureToggles)==null?void 0:c.controlsExpectTimeBlinkAnimation,controlsTapPlace:(m=this._options.animationsFeatureToggles)==null?void 0:m.controlsTapPlace}});if(a&&this.selectBranches&&this.interactiveEvents&&this.player){let v=new Yt({player:this.player,container:a,branches:e.branches,selectBranches:this.selectBranches,interactiveEvents:this.interactiveEvents,globalEvents:this.events,globalEventEmitter:this.globalEventEmitter,getContainerEventState:()=>fa(n,this.gameControllers),permanentTextControls:this._options.permanentTextControls,interactiveTimeOpenUri:this._options.interactiveTimeOpenUri,disabledControls$:this.state.disabledControls$,onRemove:()=>{this.seekToInteractiveController.deleteContainer(n.id)},onError:this.emitErrorEvent});this.animation.addFn(v.whilePlaying,!0),t.push(v)}}),t}checkIfSeekable(){if(this.state.isInteractiveExpectation$.getValue()){this.state.isSeekable$.next(!1);return}let t=this.state.isSeekable$.getValue(),n=!!this.seekToInteractiveController.getNextInteractiveTime();(n&&!t||!n&&t)&&this.state.isSeekable$.next(!t)}updateLastEventInfo(){this.state.calledByInteractive$.getValue()?this.state.calledByInteractive$.next(!1):this.state.lastChapterChangeWasInitiatedByInteractive$.next(!1)}pushChapterToHistory(e){var l,s;if(this.updateLastEventInfo(),!this.historyController.inited)return;let t=this.state.lastChapterChangeWasInitiatedByInteractive$.getValue(),n=this.state.prevChapter$.getValue(),i=(l=n&&Z(n)&&ct(n))!=null?l:!1,o=((s=this.manifestController.manifest)==null?void 0:s.metadata.initChapterId)===e,a=this.historyController.state.history$.getValue();if(o||i&&t){this.historyController.updateHistory([e]);return}(0,tl.default)(a,-1)!==e&&this.historyController.updateHistory([...a,e])}handleFakeRemoval(e,t){let{interactiveRanges$:n}=this.state,o=n.getValue().map(a=>{let l=a.subjects.some(c=>c.id===e),s=a.subjects.map(c=>t&&l||c.id===e?T(d({},c),{isRemoved:!0}):c);return T(d({},a),{subjects:s})});n.next(o)}reset(){var e;this.appState===2&&(this.destroyGameControllers(),this.gameControllers=[],this.animation.release(),(e=this.interactiveEvents)==null||e.release(),this.appState=1,this.state.isSeekable$.next(!1),this.clearNoInteractionTimeout())}toggleBlinkAnimation(e){var n,i;if(!((n=this._options.animationsFeatureToggles)!=null&&n.controlsExpectTimeBlinkAnimation))return;let t=(o,a)=>{o.toggleBlinkAnimation(a)};Qt(T(d({},e),{gameControllers:this.gameControllers,execFn:pt(hn(t),e.isExpect)})),e.isExpect&&((i=this.blinkAnimationRef)==null||i.restart())}updateControlsShadowStyles(e){var n;if(!((n=this._options.animationsFeatureToggles)!=null&&n.areaControlShadow))return;let t=(i,o)=>{i.updateControlsShadowStyles(o)};e.isExpect?Qt(T(d({},e),{gameControllers:this.gameControllers,execFn:pt(hn(t),!1)})):Qt(T(d({},e),{gameControllers:this.gameControllers,execFn:t}))}get options(){return this._options}init(){var e;this.manifestController.chapter&&this._options.parentElement&&this.player&&this._options.fullscreenTargetElement&&this.appState===0&&((e=this.resizeManager)==null||e.resizeObserver.observe(this._options.fullscreenTargetElement),this.registerVideoEvents(),this.appState=1,this.setGameControllers())}setManifest(e){return O(this,null,function*(){this.reset(),this.isFirstChapterFetched=!1;let t=yield this.manifestController.setManifest(e);if(t.manifest)return this.graph&&this.graph.handleManifestChange(t.manifest),yield this.historyController.setManifest(t.manifest),this.events.manifestChanged$.next(t.manifest),this.globalEventEmitter.emit(P.manifestChanged,{manifest:t.manifest}),this.setGameControllers(),t.manifest})}setPlayer(e){this.reset(),this.player=e,this.seekToInteractiveController.setPlayer(this.player),this.interactiveEvents?this.interactiveEvents.setPlayer(this.player):this.interactiveEvents=js(this.player,this._options.interactiveTimeOpenUri),this.selectBranches=Ws({player:this.player,interactiveEvents:this.interactiveEvents,globalEvents:this.events,globalEventEmitter:this.globalEventEmitter}),this.appState===1&&(this.registerVideoEvents(),this.setGameControllers())}setChapter(){return O(this,arguments,function*({chapterId:e,pushToHistory:t=!0,playPrev:n=!1}={}){var s,c;this.reset(),this.lastFrame&&this.isFirstChapterFetched&&(this.lastFrame.draw(),this.lastFrame.show()),this.lastFrame&&rl.clientChecker.browser.isSafari&&(yield Ys(35));let i=!n&&this.state.isEndChapter$.getValue()&&((s=this.getCurrentManifest())==null?void 0:s.metadata.initChapterId)===e;this.state.isReplay$.next(i);let{chapter:o,media:a,graph:l}=yield e?this.manifestController.setNext(e):this.manifestController.setInitial();(!e||i)&&this.state.isFirstChapter$.next(!0),!(!o||!a)&&(t&&this.pushChapterToHistory(o.id),this.state.isInitialChapter$.next(this.manifestController.isInitialChapter()),this.state.isEndChapter$.next(this.manifestController.isEndChapter()),this.graph&&this.graph.handleChapterChange(o),(c=this.lastFrame)==null||c.setCurrentChapter(o),this.events.chapterChanged$.next({chapter:o,manifestVideo:a}),this.globalEventEmitter.emit(P.chapterChanged,{chapter:o,media:a,graph:l}),this.setGameControllers(),this.endedRanges=new Set,this.isFirstChapterFetched=!0)})}getStatEvents(){return{click$:new w.Observable(e=>{this.subscriptions.add(this.events.graphVisibilityChanged$.subscribe(t=>{e.next(t?Fe.InteractiveInterfaceClick.GRAPH_SHOW:Fe.InteractiveInterfaceClick.GRAPH_HIDE)})).add(this.events.watchAgainIsClicked$.subscribe(()=>{e.next(Fe.InteractiveInterfaceClick.WATCH_AGAIN)})).add(this.events.interactiveActionChoice$.subscribe(({type:t,subjectName:n,subjectType:i})=>{t!=="action-choice"||n!=="control"||(i==="Button"&&e.next(Fe.InteractiveInterfaceClick.NEXT_BUTTON),i==="Area"&&e.next(Fe.InteractiveInterfaceClick.NEXT_AREA))}))}),nextMovie$:new w.Observable(e=>{this.events.playerChanged$.subscribe(({config:t})=>{t!=null&&t.unitedVideoId&&!this.state.isFirstChapter$.getValue()&&e.next(t.unitedVideoId)})})}}toggleGraphView(e=!0){return O(this,null,function*(){this.graph&&(e?(yield this.graph.show(),this.state.isSeekable$.next(!1)):(this.graph.hide(),this.checkIfSeekable()),this.globalEventEmitter.emit(P.graph,{type:je.visibility,visibility:e}),this.events.graphVisibilityChanged$.next(e))})}setVisitedChapters(e){var t;Array.isArray(e)&&((t=this.graph)==null||t.setVisitedChapters(e))}updateGraphVideosInfo(e){var t;Array.isArray(e)&&((t=this.graph)==null||t.updateVideosInfo(e))}deadEndCheck(){var n;return!(((n=this.interactiveEvents)==null?void 0:n.getPreparedToExecActions())||[]).some(i=>i.actionType===E.EventActionTypes.setNextBranch)}allControlsAreRemoved(){return!this.gameControllers.some(t=>!t.container.isRemoved)}isEndedExpectation(){if(!this.player||!this.gameControllers)return!1;let e=this.player.info.position$.getValue(),t=this.player.info.duration$.getValue();return e===t&&this.gameControllers.some(n=>{let i=n.container.container;return!n.container.isRemoved&&i.endTime===null&&be(i.events)})}playPrevChapter(){this.historyController.goBack()}setDisabledControls(e){this.state.disabledControls$.next(e)}isSupport(e=this.manifestController.manifest){return!!e&&(0,E.isSupportedManifest)(e.metadata.version)}getInitialVideoInfo(){return{videoId:this.historyController.getInitialVideoId(),chapterId:this.historyController.getInitialChapterId()}}getHistoryState(){return this.historyController.state}getIsSeekable(){return this.state.isSeekable$}getInteractiveRanges(){var e;return Ja((e=this.manifestController.chapter)==null?void 0:e.containers)}getNextInteractiveStartTime(e){return this.seekToInteractiveController.getNextInteractiveTime(e)}getChapterBranches(e){return this.manifestController.getBranches(e)}getCurrentChapter(){return this.manifestController.getCurrent()}getCurrentManifest(){return this.manifestController.manifest}on(e,t){return this.globalEventEmitter.on(e,t),this}off(e,t){return this.globalEventEmitter.off(e,t),this}once(e,t){return this.globalEventEmitter.once(e,t),this}destroy(){var e,t,n,i,o,a;this.clearHistoryIfEnded(),(e=this.blinkAnimationRef)==null||e.destroy(),this.destroyGameControllers(),this.gameControllers=[],(t=this.graph)==null||t.destroy(),this.seamlessControllerSubs.unsubscribe(),(n=this.seamlessController)==null||n.removeAll(),(i=this.resizeManager)==null||i.release(),this.animation.release(),(o=this.interactiveEvents)==null||o.release(),this.manifestController.release(),this.playerSubscriptions.unsubscribe(),this.subscriptions.unsubscribe(),this.globalEventEmitter.reset(),(a=this.lastFrame)==null||a.destroy(),this.rootElement.remove(),this.historyController.destroy(),this.isFirstChapterFetched=!1,this.appState=3}};var nl={Container:we,createChoiceContainer:Ot,createAreaControl:wt,createButtonControl:Rt,classnamesPrefix:Fn};var wh={version:Nn};
|
|
216
|
+
|
|
217
|
+
/* fill animation */
|
|
218
|
+
.interactive-control-fill-animation {
|
|
219
|
+
position: absolute;
|
|
220
|
+
overflow: hidden;
|
|
221
|
+
z-index: -1;
|
|
222
|
+
pointer-events: none;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.interactive-control-fill-animation-filler-wrapper {
|
|
226
|
+
position: absolute;
|
|
227
|
+
width: 100%;
|
|
228
|
+
height: 100%;
|
|
229
|
+
transform-origin: center;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.interactive-control-fill-animation-filler-wrapper.interactive-control-fill-animation-fill-width {
|
|
233
|
+
top: 0;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.interactive-control-fill-animation-filler-wrapper.interactive-control-fill-animation-fill-height {
|
|
237
|
+
left: 0;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.interactive-control-fill-animation-filler-wrapper.interactive-control-fill-animation-from-right {
|
|
241
|
+
right: 0;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.interactive-control-fill-animation-filler-wrapper.interactive-control-fill-animation-from-left {
|
|
245
|
+
left: 0;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.interactive-control-fill-animation-filler-wrapper.interactive-control-fill-animation-from-top {
|
|
249
|
+
top: 0;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.interactive-control-fill-animation-filler-wrapper.interactive-control-fill-animation-from-bottom {
|
|
253
|
+
bottom: 0;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.interactive-control-fill-animation-filler {
|
|
257
|
+
width: 100%;
|
|
258
|
+
height: 100%;
|
|
259
|
+
background-color: rgba(173, 211, 255, 0.32);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.interactive-control-fill-animation-filler.interactive-control-fill-animation-fill-width {
|
|
263
|
+
transform: scaleX(0);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.interactive-control-fill-animation-filler.interactive-control-fill-animation-fill-height {
|
|
267
|
+
transform: scaleY(0);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.interactive-control-fill-animation-filler.interactive-control-fill-animation-from-right {
|
|
271
|
+
transform-origin: right;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.interactive-control-fill-animation-filler.interactive-control-fill-animation-from-left {
|
|
275
|
+
transform-origin: left;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.interactive-control-fill-animation-filler.interactive-control-fill-animation-from-top {
|
|
279
|
+
transform-origin: top;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.interactive-control-fill-animation-filler.interactive-control-fill-animation-from-bottom {
|
|
283
|
+
transform-origin: bottom;
|
|
284
|
+
}
|
|
285
|
+
`;var fl=r=>{let e=document.createElement("style");e.textContent=ml,r.prepend(e)};var yl=require("@vkontakte/videoplayer-core/es2015");var vl=Object.freeze({lang:S.InterfaceLanguage.RU,loaders:{},graph:!1,initSeamless:!1,lastFrame:!1,permanentTextControls:!0,interactiveTimeOpenUri:!1,config:{historyMaxLength:100,noInteractionEventTimeout:3e4},isTouch:!1,disableTextControlContainerVisibilityEvents:!1,animationsFeatureToggles:{areaControlShadow:!1,controlsExpectTimeBlinkAnimation:!1,controlsTapPlace:!1,controlsFillAnimation:!1,controlsHideAnimation:!1}});function Gh(){let r=document.createElement("div");return r.classList.add("interactive-chapter"),r}var vt=class{constructor(e){this.playerSubscriptions=new S.Subscription;this.subscriptions=new S.Subscription;this.globalEventEmitter=new Kt;this.animation=new Qt;this.seekToInteractiveController=new ct;this.endedRanges=new Set;this.gameControllers=[];this.rootElement=Gh();this.factories=new Map([["choice",Wt]]);this.isFirstChapterFetched=!1;this.player=null;this.interactiveEvents=null;this.selectBranches=null;this.seamlessController=null;this.seamlessControllerSubs=new S.Subscription;this.graph=null;this.lastFrame=null;this.blinkAnimationRef=null;this.appState=0;this.state={prevChapter$:new S.ValueSubject(null),isInitialChapter$:new S.ValueSubject(!1),isFirstChapter$:new S.ValueSubject(!0),isEndChapter$:new S.ValueSubject(!1),isInteractiveExpectation$:new S.ValueSubject(!1),isReplay$:new S.ValueSubject(!1),calledByInteractive$:new S.ValueSubject(!1),lastChapterChangeWasInitiatedByInteractive$:new S.ValueSubject(!1),disabledControls$:new S.ValueSubject(!1),interactiveRanges$:new S.ValueSubject([]),isInteractiveTime$:new S.ValueSubject(!1),statistics$:new S.ValueSubject(null),isSeekable$:new S.ValueSubject(!1)};this.events={noInteraction$:new S.Subject,graphVisibilityChanged$:new S.Subject,watchAgainIsClicked$:new S.Subject,chapterChanged$:new S.Subject,playerChanged$:new S.Subject,error$:new S.Subject,eachTick$:new S.Subject,manifestChanged$:new S.Subject,interactiveRangeEnded$:new S.Subject,interactiveContainerRemoved$:new S.Subject,interactiveContainerFakeRemoved$:new S.Subject,interactiveActionExecution$:new S.Subject,interactiveActionChoice$:new S.Subject,interactiveVisibilityChanged$:new S.Subject};this.emitErrorEvent=e=>{this.events.error$.next(e),this.globalEventEmitter.emit(_.errors,e)};this.clearHistoryIfEnded=()=>{var n;let e=(n=this.player)==null?void 0:n.info.isEnded$.getValue(),t=this.state.isInteractiveExpectation$.getValue(),{chapter:i}=this.getCurrentChapter();e&&i&&Z(i)&&!t&&this.historyController.updateHistory([]),window.removeEventListener("beforeunload",this.clearHistoryIfEnded)};this.handleSeamlessPlayerChanged=e=>{if(!e)return;let n=e,{statistics:t}=n,i=ee(n,["statistics"]);if(t){let{statSubscription:o,oneStat:a}=t;o.add(a.attachToInteractive(this.getStatEvents())),this.state.statistics$.next(t)}this.state.isReplay$.getValue()&&this.state.isReplay$.next(!1),this.events.playerChanged$.next(i),this.globalEventEmitter.emit(_.playerChanged,i)};this.onPlaybackStarted=()=>{var e;(e=this.resizeManager)==null||e.calc(),this.animation.requestAnimation()};this.destroyGameControllers=({removeTextControls:e=!0,withTransition:t=!1}={})=>{for(let i of this.gameControllers)!e&&i.isPermanentText||(this.animation.removeFn(i.whilePlaying),i.destroy(t))};this.completeInteractiveRange=e=>{let{interactiveRanges$:t}=this.state,n=t.getValue().map(o=>w(f({},o),{subjects:o.subjects.filter(a=>a.id!==e)}));t.next(n)};this.clearNoInteractionTimeout=()=>{this.noInteractionTimeout&&(clearTimeout(this.noInteractionTimeout),this.noInteractionTimeout=void 0)};var n,o;if(this._options=w(f(f({},vl),e),{config:f(f({},vl.config),e.config)}),(n=this._options.animationsFeatureToggles)==null?void 0:n.controlsExpectTimeBlinkAnimation){this.blinkAnimationRef=new Bt,this.blinkAnimationRef.create();let a=this.blinkAnimationRef.element;a&&this.rootElement.append(a)}this._options.parentElement.append(this.rootElement),this.historyController=new ft({interactiveController:this,globalEventEmitter:this.globalEventEmitter,videoId:(o=this._options.projectInfo)==null?void 0:o.videoId,historyApi:this._options.historyApi,settings:{maxLength:this._options.config.historyMaxLength,initChapterId:this._options.initChapterId}}),this._options.lastFrame&&(this.lastFrame=new cr({parentElement:this._options.parentElement,onError:a=>{let l=new B(1,6,a);this.emitErrorEvent(l)}})),fl(this._options.parentElement),this.subscriptions.add((0,S.fromEvent)(this.rootElement,"mousedown").subscribe(a=>a.stopPropagation())).add((0,S.fromEvent)(this.rootElement,"mouseup").subscribe(a=>a.stopPropagation())),this.manifestController=new Ie(this._options.loaders,a=>{let l=new B(1,3,a);this.emitErrorEvent(l)});let i=[];this._options.lastFrame&&i.push(()=>{var a;(a=this.lastFrame)==null||a.updateCanvasDimensions(!0)}),i.push(()=>{let a=this.state.isInteractiveTime$.getValue();for(let l of this.gameControllers)l.onResize(a)}),this.resizeManager=tl(()=>({player:this.player,parentElement:this._options.parentElement,fns:i})),this._options.graph&&(this.graph=new lt({root:this._options.parentElement,lang:this._options.lang,onOpenPreviewClick:a=>{this.setChapter({chapterId:a}),this.globalEventEmitter.emit(_.graph,{type:je.watchAgainClicked,chapterId:a}),this.events.watchAgainIsClicked$.next(a)},onError:a=>{let l=new B(1,2,{message:a});this.emitErrorEvent(l)}})),this.initSubscriptions()}initSubscriptions(){this.playerSubscriptions.add(this.historyController.events.inited$.subscribe(t=>k(this,[t],function*({videosInfo:e=[]}){this._options.initSeamless&&(yield this.initSeamless(),this.updateGraphVideosInfo(e))}))),this.subscriptions.add(this.events.interactiveContainerRemoved$.subscribe(({subjectId:e})=>{this.completeInteractiveRange(e)})).add(this.events.interactiveContainerFakeRemoved$.subscribe(({subjectId:e,removeAllOpenURI:t})=>{this.handleFakeRemoval(e,t)})).add(this.events.interactiveActionExecution$.subscribe(e=>{var t,i;if(this.state.calledByInteractive$.next(!0),this.state.lastChapterChangeWasInitiatedByInteractive$.next(!0),((t=e.payload)==null?void 0:t.behaviour)==="change-chapter"){let{chapterId:n}=e.payload;this.setChapter({chapterId:n}),this.state.isFirstChapter$.getValue()&&this.state.isFirstChapter$.next(!1)}else if(((i=e.payload)==null?void 0:i.behaviour)==="change-manifest"){let{manifestURL:n}=e.payload;n&&this.setManifest(n)}e.actionType==="expect"?(this.state.isInteractiveExpectation$.next(!0),this.updateControlsShadowStyles({subjectName:e.subjectName,subjectId:e.subjectId,isExpect:!0}),this.toggleBlinkAnimation({subjectName:e.subjectName,subjectId:e.subjectId,isExpect:!0})):e.actionType==="after-expect"&&(this.state.isInteractiveExpectation$.next(!1),this.updateControlsShadowStyles({subjectName:e.subjectName,subjectId:e.subjectId,isExpect:!1}),this.toggleBlinkAnimation({subjectName:e.subjectName,subjectId:e.subjectId,isExpect:!1}))})).add(this.events.manifestChanged$.subscribe(()=>{this.state.calledByInteractive$.next(!1),this.state.lastChapterChangeWasInitiatedByInteractive$.next(!1)})).add(this.events.interactiveActionChoice$.subscribe(({type:e,subjectName:t,payload:i})=>{var n;e!=="action-choice"||t==="chapter"||"invokeImmediately"in i&&i.invokeImmediately||this.destroyGameControllers({removeTextControls:!1,withTransition:(n=this._options.animationsFeatureToggles)==null?void 0:n.controlsHideAnimation})}))}initSeamless(){return k(this,null,function*(){this.seamlessController=vi(this),this.seamlessControllerSubs.add(this.seamlessController.activePlayerChanged.subscribe(this.handleSeamlessPlayerChanged)),yield this.seamlessController.init()})}handlePositionChange(e){(!this.graph||this.graph.isHidden)&&this.checkIfSeekable();let t=e*1e3,n=this.getInteractiveRanges().reverse().find(({range:o})=>t>=o[1]);if(n){let o=n.range.join("-");this.endedRanges.has(o)||(this.endedRanges.add(o),this.globalEventEmitter.emit(_.interactives,{type:N.rangeEnded,payload:n,visibility:!0}),this.events.interactiveRangeEnded$.next({type:"range-ended",payload:n}))}}registerVideoEvents(){this.player&&(window.removeEventListener("beforeunload",this.clearHistoryIfEnded),this.playerSubscriptions.unsubscribe(),window.addEventListener("beforeunload",this.clearHistoryIfEnded),this.playerSubscriptions.add(this.player.events.started$.pipe((0,S.once)()).subscribe(this.onPlaybackStarted)).add(this.player.events.playing$.subscribe(this.animation.requestAnimation)).add(this.player.events.willPause$.subscribe(this.animation.cancelAnimation)).add(this.player.info.position$.subscribe(this.handlePositionChange.bind(this))).add(this.manifestController.prevChapter$.subscribe(e=>this.state.prevChapter$.next(e))).add((0,S.combine)({position:this.player.info.position$,interactiveRanges:this.state.interactiveRanges$,isInteractiveExpectation:this.state.isInteractiveExpectation$}).subscribe(({position:e,interactiveRanges:t,isInteractiveExpectation:i})=>{var s;let n;if(i)n=!0;else{let c=e*1e3;n=!!t.find(({range:[v,b],subjects:g})=>v<c&&c<b&&g.some(T=>!T.isRemoved)&&g.length)}n!==this.state.isInteractiveTime$.getValue()&&this.state.isInteractiveTime$.next(n);let o=!!this.noInteractionTimeout,l=((s=this.player)==null?void 0:s.info.playbackState$.getValue())==="playing"||i;n&&!o&&l?this.noInteractionTimeout=window.setTimeout(()=>{this.events.noInteraction$.next()},this._options.config.noInteractionEventTimeout):o&&!l&&this.clearNoInteractionTimeout()})),this.playerSubscriptions.add(this.historyController.events.error$.subscribe(this.events.error$)),this._options.lastFrame&&this.playerSubscriptions.add(this.player.info.duration$.subscribe(e=>{var t;(t=this.lastFrame)==null||t.setVideoDuration(e*1e3)})).add(this.player.experimental.element$.subscribe(e=>{var t;e&&((t=this.lastFrame)==null||t.setVideoElement(e))})).add(this.player.events.firstFrame$.subscribe(()=>{var e;(e=this.lastFrame)==null||e.reset(),setTimeout(()=>{var t,i;(t=this.lastFrame)==null||t.hide(),(i=this.lastFrame)==null||i.lastFrameCanvas.clear()},50)})).add(this.player.events.seeked$.subscribe(this.lastFrame.onSeek)))}setGameControllers(){var t,i;let e=this.manifestController.chapter;e&&this.appState===1&&((t=this.selectBranches)==null||t.setManifestChapterEvents(e),this.gameControllers=this.getGameControllers(e),(i=this.interactiveEvents)==null||i.containersEventsCallState.setData(e.containers),this.seekToInteractiveController.setContainers(this.gameControllers.map(n=>n.container.container).filter(n=>!Ee(n.controls))),this._options.lastFrame&&this.animation.addFn(()=>{var n;this.player&&((n=this.lastFrame)==null||n.onEachTick(this.player.info.position$.getValue()*1e3))},!0),this.state.interactiveRanges$.next(this.getInteractiveRanges()),this.appState=2)}getGameControllers(e){let t=[];return e.containers.forEach(i=>{var l,s,c,d,v,b,g;let n=i.type.trim().toLowerCase(),o=this.factories.get(n),a=o==null?void 0:o(i,this.rootElement,{isTouch:(s=(l=this._options)==null?void 0:l.isTouch)!=null?s:!1,features:{controlsExpectTimeBlinkAnimation:(c=this._options.animationsFeatureToggles)==null?void 0:c.controlsExpectTimeBlinkAnimation,controlsTapPlace:(d=this._options.animationsFeatureToggles)==null?void 0:d.controlsTapPlace,controlsFillAnimation:(v=this._options.animationsFeatureToggles)==null?void 0:v.controlsFillAnimation}});if(a&&this.selectBranches&&this.interactiveEvents&&this.player){let T=new ir({player:this.player,container:a,branches:e.branches,selectBranches:this.selectBranches,interactiveEvents:this.interactiveEvents,globalEvents:this.events,globalEventEmitter:this.globalEventEmitter,getContainerEventState:()=>ua(i,this.gameControllers),permanentTextControls:this._options.permanentTextControls,interactiveTimeOpenUri:this._options.interactiveTimeOpenUri,disabledControls$:this.state.disabledControls$,onRemove:()=>{this.seekToInteractiveController.deleteContainer(i.id)},onError:this.emitErrorEvent,disableTextControlContainerVisibilityEvents:(b=this.options.disableTextControlContainerVisibilityEvents)!=null?b:!1,features:{controlsHideAnimation:(g=this._options.animationsFeatureToggles)==null?void 0:g.controlsHideAnimation}});this.animation.addFn(T.whilePlaying,!0),t.push(T)}}),t}checkIfSeekable(){if(this.state.isInteractiveExpectation$.getValue()){this.state.isSeekable$.next(!1);return}let t=this.state.isSeekable$.getValue(),i=!!this.seekToInteractiveController.getNextInteractiveTime();(i&&!t||!i&&t)&&this.state.isSeekable$.next(!t)}updateLastEventInfo(){this.state.calledByInteractive$.getValue()?this.state.calledByInteractive$.next(!1):this.state.lastChapterChangeWasInitiatedByInteractive$.next(!1)}pushChapterToHistory(e){var l,s;if(this.updateLastEventInfo(),!this.historyController.inited)return;let t=this.state.lastChapterChangeWasInitiatedByInteractive$.getValue(),i=this.state.prevChapter$.getValue(),n=(l=i&&Z(i)&&ot(i))!=null?l:!1,o=((s=this.manifestController.manifest)==null?void 0:s.metadata.initChapterId)===e,a=this.historyController.state.history$.getValue();if(o||n&&t){this.historyController.updateHistory([e]);return}(0,bl.default)(a,-1)!==e&&this.historyController.updateHistory([...a,e])}handleFakeRemoval(e,t){let{interactiveRanges$:i}=this.state,o=i.getValue().map(a=>{let l=a.subjects.some(c=>c.id===e),s=a.subjects.map(c=>t&&l||c.id===e?w(f({},c),{isRemoved:!0}):c);return w(f({},a),{subjects:s})});i.next(o)}reset(){var e;this.appState===2&&(this.destroyGameControllers(),this.gameControllers=[],this.animation.release(),(e=this.interactiveEvents)==null||e.release(),this.appState=1,this.state.isSeekable$.next(!1),this.clearNoInteractionTimeout())}toggleBlinkAnimation(e){var i,n;if(!((i=this._options.animationsFeatureToggles)!=null&&i.controlsExpectTimeBlinkAnimation))return;let t=(o,a)=>{o.toggleBlinkAnimation(a)};jt(w(f({},e),{gameControllers:this.gameControllers,execFn:dt(bi(t),e.isExpect)})),e.isExpect&&((n=this.blinkAnimationRef)==null||n.restart())}updateControlsShadowStyles(e){var i;if(!((i=this._options.animationsFeatureToggles)!=null&&i.areaControlShadow))return;let t=(n,o)=>{n.updateControlsShadowStyles(o)};e.isExpect?jt(w(f({},e),{gameControllers:this.gameControllers,execFn:dt(bi(t),!1)})):jt(w(f({},e),{gameControllers:this.gameControllers,execFn:t}))}get options(){return this._options}init(){var e;this.manifestController.chapter&&this._options.parentElement&&this.player&&this._options.fullscreenTargetElement&&this.appState===0&&((e=this.resizeManager)==null||e.resizeObserver.observe(this._options.fullscreenTargetElement),this.registerVideoEvents(),this.appState=1,this.setGameControllers())}setManifest(e){return k(this,null,function*(){this.reset(),this.isFirstChapterFetched=!1;let t=yield this.manifestController.setManifest(e);if(t.manifest)return this.graph&&this.graph.handleManifestChange(t.manifest),yield this.historyController.setManifest(t.manifest),this.events.manifestChanged$.next(t.manifest),this.globalEventEmitter.emit(_.manifestChanged,{manifest:t.manifest}),this.setGameControllers(),t.manifest})}setPlayer(e){this.reset(),this.player=e,this.seekToInteractiveController.setPlayer(this.player),this.interactiveEvents?this.interactiveEvents.setPlayer(this.player):this.interactiveEvents=Zs(this.player,this._options.interactiveTimeOpenUri),this.selectBranches=cl({player:this.player,interactiveEvents:this.interactiveEvents,globalEvents:this.events,globalEventEmitter:this.globalEventEmitter}),this.appState===1&&(this.registerVideoEvents(),this.setGameControllers())}setChapter(){return k(this,arguments,function*({chapterId:e,pushToHistory:t=!0,playPrev:i=!1}={}){var s,c;this.reset(),this.lastFrame&&this.isFirstChapterFetched&&(this.lastFrame.draw(),this.lastFrame.show()),this.lastFrame&&yl.clientChecker.browser.isSafari&&(yield dl(35));let n=!i&&this.state.isEndChapter$.getValue()&&((s=this.getCurrentManifest())==null?void 0:s.metadata.initChapterId)===e;this.state.isReplay$.next(n);let{chapter:o,media:a,graph:l}=yield e?this.manifestController.setNext(e):this.manifestController.setInitial();(!e||n)&&this.state.isFirstChapter$.next(!0),!(!o||!a)&&(t&&this.pushChapterToHistory(o.id),this.state.isInitialChapter$.next(this.manifestController.isInitialChapter()),this.state.isEndChapter$.next(this.manifestController.isEndChapter()),this.graph&&this.graph.handleChapterChange(o),(c=this.lastFrame)==null||c.setCurrentChapter(o),this.events.chapterChanged$.next({chapter:o,manifestVideo:a}),this.globalEventEmitter.emit(_.chapterChanged,{chapter:o,media:a,graph:l}),this.setGameControllers(),this.endedRanges=new Set,this.isFirstChapterFetched=!0)})}getStatEvents(){return{click$:new S.Observable(e=>{this.subscriptions.add(this.events.graphVisibilityChanged$.subscribe(t=>{e.next(t?De.InteractiveInterfaceClick.GRAPH_SHOW:De.InteractiveInterfaceClick.GRAPH_HIDE)})).add(this.events.watchAgainIsClicked$.subscribe(()=>{e.next(De.InteractiveInterfaceClick.WATCH_AGAIN)})).add(this.events.interactiveActionChoice$.subscribe(({type:t,subjectName:i,subjectType:n})=>{t!=="action-choice"||i!=="control"||(n==="Button"&&e.next(De.InteractiveInterfaceClick.NEXT_BUTTON),n==="Area"&&e.next(De.InteractiveInterfaceClick.NEXT_AREA))}))}),nextMovie$:new S.Observable(e=>{this.events.playerChanged$.subscribe(({config:t})=>{t!=null&&t.unitedVideoId&&!this.state.isFirstChapter$.getValue()&&e.next(t.unitedVideoId)})})}}toggleGraphView(e=!0){return k(this,null,function*(){this.graph&&(e?(yield this.graph.show(),this.state.isSeekable$.next(!1)):(this.graph.hide(),this.checkIfSeekable()),this.globalEventEmitter.emit(_.graph,{type:je.visibility,visibility:e}),this.events.graphVisibilityChanged$.next(e))})}setVisitedChapters(e){var t;Array.isArray(e)&&((t=this.graph)==null||t.setVisitedChapters(e))}updateGraphVideosInfo(e){var t;Array.isArray(e)&&((t=this.graph)==null||t.updateVideosInfo(e))}deadEndCheck(){var i;return!(((i=this.interactiveEvents)==null?void 0:i.getPreparedToExecActions())||[]).some(n=>n.actionType===E.EventActionTypes.setNextBranch)}allControlsAreRemoved(e=!0){return!this.gameControllers.some(i=>{var o;let n=e&&((o=this._options.animationsFeatureToggles)!=null&&o.controlsHideAnimation)?i.container.willRemoved:!0;return!i.container.isRemoved||!n})}isEndedExpectation(){if(!this.player||!this.gameControllers)return!1;let e=this.player.info.position$.getValue(),t=this.player.info.duration$.getValue();return e===t&&this.gameControllers.some(i=>{let n=i.container.container;return!i.container.isRemoved&&!i.container.willRemoved&&n.endTime===null&&Ce(n.events)})}playPrevChapter(){this.historyController.goBack()}setDisabledControls(e){this.state.disabledControls$.next(e)}isSupport(e=this.manifestController.manifest){return!!e&&(0,E.isSupportedManifest)(e.metadata.version)}getInitialVideoInfo(){return{videoId:this.historyController.getInitialVideoId(),chapterId:this.historyController.getInitialChapterId()}}getHistoryState(){return this.historyController.state}getIsSeekable(){return this.state.isSeekable$}getInteractiveRanges(){var e;return fs((e=this.manifestController.chapter)==null?void 0:e.containers)}getNextInteractiveStartTime(e){return this.seekToInteractiveController.getNextInteractiveTime(e)}getChapterBranches(e){return this.manifestController.getBranches(e)}getCurrentChapter(){return this.manifestController.getCurrent()}getCurrentManifest(){return this.manifestController.manifest}on(e,t){return this.globalEventEmitter.on(e,t),this}off(e,t){return this.globalEventEmitter.off(e,t),this}once(e,t){return this.globalEventEmitter.once(e,t),this}destroy(){var e,t,i,n,o,a;this.clearHistoryIfEnded(),(e=this.blinkAnimationRef)==null||e.destroy(),this.destroyGameControllers(),this.gameControllers=[],(t=this.graph)==null||t.destroy(),this.seamlessControllerSubs.unsubscribe(),(i=this.seamlessController)==null||i.removeAll(),(n=this.resizeManager)==null||n.release(),this.animation.release(),(o=this.interactiveEvents)==null||o.release(),this.manifestController.release(),this.playerSubscriptions.unsubscribe(),this.subscriptions.unsubscribe(),this.globalEventEmitter.reset(),(a=this.lastFrame)==null||a.destroy(),this.rootElement.remove(),this.historyController.destroy(),this.isFirstChapterFetched=!1,this.appState=3}};var gl={Container:Oe,createChoiceContainer:Wt,createAreaControl:qt,createButtonControl:zt,classnamesPrefix:Gi};var zh={version:Bi};
|