@vkontakte/videoplayer-interactive 1.0.39-dev.3ba6f931.0 → 1.0.39-dev.6edf3cda.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 +4 -4
- package/es2015.esm.js +4 -4
- package/es2018.cjs.js +4 -4
- package/es2018.esm.js +4 -4
- package/es2024.cjs.js +5 -5
- package/es2024.esm.js +4 -4
- package/esnext.cjs.js +5 -5
- package/esnext.esm.js +4 -4
- package/evergreen.esm.js +6 -6
- package/package.json +4 -4
- package/types/modules/Interactives/types.d.ts +1 -0
- package/types/modules/Interactives/utils/GameController.d.ts +3 -1
package/es2015.cjs.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-interactive v1.0.39-dev.
|
|
3
|
-
* Mon, 09 Jun 2025
|
|
2
|
+
* @vkontakte/videoplayer-interactive v1.0.39-dev.6edf3cda.0
|
|
3
|
+
* Mon, 09 Jun 2025 10:20:24 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-39/doc/
|
|
5
5
|
*/
|
|
6
|
-
"use strict";var yl=Object.create;var De=Object.defineProperty,gl=Object.defineProperties,Cl=Object.getOwnPropertyDescriptor,El=Object.getOwnPropertyDescriptors,Tl=Object.getOwnPropertyNames,yt=Object.getOwnPropertySymbols,Il=Object.getPrototypeOf,ur=Object.prototype.hasOwnProperty,Vi=Object.prototype.propertyIsEnumerable;var Ni=r=>{throw TypeError(r)};var Fi=(r,e,t)=>e in r?De(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,f=(r,e)=>{for(var t in e||(e={}))ur.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},S=(r,e)=>gl(r,El(e));var te=(r,e)=>{var t={};for(var i in r)ur.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),xl=(r,e)=>{for(var t in e)De(r,t,{get:e[t],enumerable:!0})},_i=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Tl(e))!ur.call(r,n)&&n!==t&&De(r,n,{get:()=>e[n],enumerable:!(i=Cl(e,n))||i.enumerable});return r};var X=(r,e,t)=>(t=r!=null?yl(Il(r)):{},_i(e||!r||!r.__esModule?De(t,"default",{value:r,enumerable:!0}):t,r)),Sl=r=>_i(De({},"__esModule",{value:!0}),r);var $i=(r,e,t)=>e.has(r)||Ni("Cannot "+t);var k=(r,e,t)=>($i(r,e,"read from private field"),t?t.call(r):e.get(r)),G=(r,e,t)=>e.has(r)?Ni("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 k(r,e,i)}});var O=(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 ne=p((Ar,on)=>{"use strict";var ze=function(r){return r&&r.Math===Math&&r};on.exports=ze(typeof globalThis=="object"&&globalThis)||ze(typeof window=="object"&&window)||ze(typeof self=="object"&&self)||ze(typeof global=="object"&&global)||ze(typeof Ar=="object"&&Ar)||function(){return this}()||Function("return this")()});var z=p((ym,an)=>{"use strict";an.exports=function(r){try{return!!r()}catch(e){return!0}}});var We=p((gm,sn)=>{"use strict";var Pl=z();sn.exports=!Pl(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var hn=p((Cm,pn)=>{"use strict";var Ll=We(),un=Function.prototype,ln=un.apply,cn=un.call;pn.exports=typeof Reflect=="object"&&Reflect.apply||(Ll?cn.bind(ln):function(){return cn.apply(ln,arguments)})});var Y=p((Em,fn)=>{"use strict";var dn=We(),mn=Function.prototype,wr=mn.call,Ml=dn&&mn.bind.bind(wr,wr);fn.exports=dn?Ml:function(r){return function(){return wr.apply(r,arguments)}}});var Ke=p((Tm,bn)=>{"use strict";var vn=Y(),Fl=vn({}.toString),Vl=vn("".slice);bn.exports=function(r){return Vl(Fl(r),8,-1)}});var Rr=p((Im,yn)=>{"use strict";var Nl=Ke(),_l=Y();yn.exports=function(r){if(Nl(r)==="Function")return _l(r)}});var W=p((xm,gn)=>{"use strict";var kr=typeof document=="object"&&document.all;gn.exports=typeof kr=="undefined"&&kr!==void 0?function(r){return typeof r=="function"||r===kr}:function(r){return typeof r=="function"}});var ge=p((Sm,Cn)=>{"use strict";var $l=z();Cn.exports=!$l(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var _t=p((Am,En)=>{"use strict";var jl=We(),Nt=Function.prototype.call;En.exports=jl?Nt.bind(Nt):function(){return Nt.apply(Nt,arguments)}});var Or=p(xn=>{"use strict";var Tn={}.propertyIsEnumerable,In=Object.getOwnPropertyDescriptor,Bl=In&&!Tn.call({1:2},1);xn.f=Bl?function(e){var t=In(this,e);return!!t&&t.enumerable}:Tn});var Pr=p((Rm,Sn)=>{"use strict";Sn.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var wn=p((km,An)=>{"use strict";var ql=Y(),Dl=z(),Hl=Ke(),Lr=Object,Ul=ql("".split);An.exports=Dl(function(){return!Lr("z").propertyIsEnumerable(0)})?function(r){return Hl(r)==="String"?Ul(r,""):Lr(r)}:Lr});var Mr=p((Om,Rn)=>{"use strict";Rn.exports=function(r){return r==null}});var Fr=p((Pm,kn)=>{"use strict";var Gl=Mr(),zl=TypeError;kn.exports=function(r){if(Gl(r))throw new zl("Can't call method on "+r);return r}});var Qe=p((Lm,On)=>{"use strict";var Wl=wn(),Kl=Fr();On.exports=function(r){return Wl(Kl(r))}});var Pe=p((Mm,Pn)=>{"use strict";var Ql=W();Pn.exports=function(r){return typeof r=="object"?r!==null:Ql(r)}});var $t=p((Fm,Ln)=>{"use strict";Ln.exports={}});var jt=p((Vm,Fn)=>{"use strict";var Vr=$t(),Nr=ne(),Xl=W(),Mn=function(r){return Xl(r)?r:void 0};Fn.exports=function(r,e){return arguments.length<2?Mn(Vr[r])||Mn(Nr[r]):Vr[r]&&Vr[r][e]||Nr[r]&&Nr[r][e]}});var Nn=p((Nm,Vn)=>{"use strict";var Yl=Y();Vn.exports=Yl({}.isPrototypeOf)});var Bn=p((_m,jn)=>{"use strict";var Zl=ne(),_n=Zl.navigator,$n=_n&&_n.userAgent;jn.exports=$n?String($n):""});var Wn=p(($m,zn)=>{"use strict";var Gn=ne(),_r=Bn(),qn=Gn.process,Dn=Gn.Deno,Hn=qn&&qn.versions||Dn&&Dn.version,Un=Hn&&Hn.v8,Z,Bt;Un&&(Z=Un.split("."),Bt=Z[0]>0&&Z[0]<4?1:+(Z[0]+Z[1]));!Bt&&_r&&(Z=_r.match(/Edge\/(\d+)/),(!Z||Z[1]>=74)&&(Z=_r.match(/Chrome\/(\d+)/),Z&&(Bt=+Z[1])));zn.exports=Bt});var $r=p((jm,Qn)=>{"use strict";var Kn=Wn(),Jl=z(),ec=ne(),tc=ec.String;Qn.exports=!!Object.getOwnPropertySymbols&&!Jl(function(){var r=Symbol("symbol detection");return!tc(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&Kn&&Kn<41})});var jr=p((Bm,Xn)=>{"use strict";var rc=$r();Xn.exports=rc&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Br=p((qm,Yn)=>{"use strict";var ic=jt(),nc=W(),oc=Nn(),ac=jr(),sc=Object;Yn.exports=ac?function(r){return typeof r=="symbol"}:function(r){var e=ic("Symbol");return nc(e)&&oc(e.prototype,sc(r))}});var Jn=p((Dm,Zn)=>{"use strict";var lc=String;Zn.exports=function(r){try{return lc(r)}catch(e){return"Object"}}});var qr=p((Hm,eo)=>{"use strict";var cc=W(),uc=Jn(),pc=TypeError;eo.exports=function(r){if(cc(r))return r;throw new pc(uc(r)+" is not a function")}});var ro=p((Um,to)=>{"use strict";var hc=qr(),dc=Mr();to.exports=function(r,e){var t=r[e];return dc(t)?void 0:hc(t)}});var no=p((Gm,io)=>{"use strict";var Dr=_t(),Hr=W(),Ur=Pe(),mc=TypeError;io.exports=function(r,e){var t,i;if(e==="string"&&Hr(t=r.toString)&&!Ur(i=Dr(t,r))||Hr(t=r.valueOf)&&!Ur(i=Dr(t,r))||e!=="string"&&Hr(t=r.toString)&&!Ur(i=Dr(t,r)))return i;throw new mc("Can't convert object to primitive value")}});var ao=p((zm,oo)=>{"use strict";oo.exports=!0});var co=p((Wm,lo)=>{"use strict";var so=ne(),fc=Object.defineProperty;lo.exports=function(r,e){try{fc(so,r,{value:e,configurable:!0,writable:!0})}catch(t){so[r]=e}return e}});var qt=p((Km,ho)=>{"use strict";var vc=ao(),bc=ne(),yc=co(),uo="__core-js_shared__",po=ho.exports=bc[uo]||yc(uo,{});(po.versions||(po.versions=[])).push({version:"3.38.0",mode:vc?"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 Gr=p((Qm,fo)=>{"use strict";var mo=qt();fo.exports=function(r,e){return mo[r]||(mo[r]=e||{})}});var Xe=p((Xm,vo)=>{"use strict";var gc=Fr(),Cc=Object;vo.exports=function(r){return Cc(gc(r))}});var Le=p((Ym,bo)=>{"use strict";var Ec=Y(),Tc=Xe(),Ic=Ec({}.hasOwnProperty);bo.exports=Object.hasOwn||function(e,t){return Ic(Tc(e),t)}});var zr=p((Zm,yo)=>{"use strict";var xc=Y(),Sc=0,Ac=Math.random(),wc=xc(1 .toString);yo.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+wc(++Sc+Ac,36)}});var Ye=p((Jm,Co)=>{"use strict";var Rc=ne(),kc=Gr(),go=Le(),Oc=zr(),Pc=$r(),Lc=jr(),Me=Rc.Symbol,Wr=kc("wks"),Mc=Lc?Me.for||Me:Me&&Me.withoutSetter||Oc;Co.exports=function(r){return go(Wr,r)||(Wr[r]=Pc&&go(Me,r)?Me[r]:Mc("Symbol."+r)),Wr[r]}});var xo=p((ef,Io)=>{"use strict";var Fc=_t(),Eo=Pe(),To=Br(),Vc=ro(),Nc=no(),_c=Ye(),$c=TypeError,jc=_c("toPrimitive");Io.exports=function(r,e){if(!Eo(r)||To(r))return r;var t=Vc(r,jc),i;if(t){if(e===void 0&&(e="default"),i=Fc(t,r,e),!Eo(i)||To(i))return i;throw new $c("Can't convert object to primitive value")}return e===void 0&&(e="number"),Nc(r,e)}});var Kr=p((tf,So)=>{"use strict";var Bc=xo(),qc=Br();So.exports=function(r){var e=Bc(r,"string");return qc(e)?e:e+""}});var Ro=p((rf,wo)=>{"use strict";var Dc=ne(),Ao=Pe(),Qr=Dc.document,Hc=Ao(Qr)&&Ao(Qr.createElement);wo.exports=function(r){return Hc?Qr.createElement(r):{}}});var Xr=p((nf,ko)=>{"use strict";var Uc=ge(),Gc=z(),zc=Ro();ko.exports=!Uc&&!Gc(function(){return Object.defineProperty(zc("div"),"a",{get:function(){return 7}}).a!==7})});var Lo=p(Po=>{"use strict";var Wc=ge(),Kc=_t(),Qc=Or(),Xc=Pr(),Yc=Qe(),Zc=Kr(),Jc=Le(),eu=Xr(),Oo=Object.getOwnPropertyDescriptor;Po.f=Wc?Oo:function(e,t){if(e=Yc(e),t=Zc(t),eu)try{return Oo(e,t)}catch(i){}if(Jc(e,t))return Xc(!Kc(Qc.f,e,t),e[t])}});var Fo=p((af,Mo)=>{"use strict";var tu=z(),ru=W(),iu=/#|\.prototype\./,Ze=function(r,e){var t=ou[nu(r)];return t===su?!0:t===au?!1:ru(e)?tu(e):!!e},nu=Ze.normalize=function(r){return String(r).replace(iu,".").toLowerCase()},ou=Ze.data={},au=Ze.NATIVE="N",su=Ze.POLYFILL="P";Mo.exports=Ze});var Yr=p((sf,No)=>{"use strict";var Vo=Rr(),lu=qr(),cu=We(),uu=Vo(Vo.bind);No.exports=function(r,e){return lu(r),e===void 0?r:cu?uu(r,e):function(){return r.apply(e,arguments)}}});var $o=p((lf,_o)=>{"use strict";var pu=ge(),hu=z();_o.exports=pu&&hu(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var Bo=p((cf,jo)=>{"use strict";var du=Pe(),mu=String,fu=TypeError;jo.exports=function(r){if(du(r))return r;throw new fu(mu(r)+" is not an object")}});var Ho=p(Do=>{"use strict";var vu=ge(),bu=Xr(),yu=$o(),Dt=Bo(),qo=Kr(),gu=TypeError,Zr=Object.defineProperty,Cu=Object.getOwnPropertyDescriptor,Jr="enumerable",ei="configurable",ti="writable";Do.f=vu?yu?function(e,t,i){if(Dt(e),t=qo(t),Dt(i),typeof e=="function"&&t==="prototype"&&"value"in i&&ti in i&&!i[ti]){var n=Cu(e,t);n&&n[ti]&&(e[t]=i.value,i={configurable:ei in i?i[ei]:n[ei],enumerable:Jr in i?i[Jr]:n[Jr],writable:!1})}return Zr(e,t,i)}:Zr:function(e,t,i){if(Dt(e),t=qo(t),Dt(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 Go=p((pf,Uo)=>{"use strict";var Eu=ge(),Tu=Ho(),Iu=Pr();Uo.exports=Eu?function(r,e,t){return Tu.f(r,e,Iu(1,t))}:function(r,e,t){return r[e]=t,r}});var et=p((hf,Wo)=>{"use strict";var Je=ne(),xu=hn(),Su=Rr(),Au=W(),wu=Lo().f,Ru=Fo(),Fe=$t(),ku=Yr(),Ve=Go(),zo=Le();qt();var Ou=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};Wo.exports=function(r,e){var t=r.target,i=r.global,n=r.stat,o=r.proto,a=i?Je:n?Je[t]:Je[t]&&Je[t].prototype,l=i?Fe:Fe[t]||Ve(Fe,t,{})[t],s=l.prototype,c,d,v,b,g,A,E,m,u;for(b in e)c=Ru(i?b:t+(n?".":"#")+b,r.forced),d=!c&&a&&zo(a,b),A=l[b],d&&(r.dontCallGetSet?(u=wu(a,b),E=u&&u.value):E=a[b]),g=d&&E?E:e[b],!(!c&&!o&&typeof A==typeof g)&&(r.bind&&d?m=ku(g,Je):r.wrap&&d?m=Ou(g):o&&Au(g)?m=Su(g):m=g,(r.sham||g&&g.sham||A&&A.sham)&&Ve(m,"sham",!0),Ve(l,b,m),o&&(v=t+"Prototype",zo(Fe,v)||Ve(Fe,v,{}),Ve(Fe[v],b,g),r.real&&s&&(c||!s[b])&&Ve(s,b,g)))}});var Qo=p((df,Ko)=>{"use strict";var Pu=Math.ceil,Lu=Math.floor;Ko.exports=Math.trunc||function(e){var t=+e;return(t>0?Lu:Pu)(t)}});var tt=p((mf,Xo)=>{"use strict";var Mu=Qo();Xo.exports=function(r){var e=+r;return e!==e||e===0?0:Mu(e)}});var Zo=p((ff,Yo)=>{"use strict";var Fu=tt(),Vu=Math.min;Yo.exports=function(r){var e=Fu(r);return e>0?Vu(e,9007199254740991):0}});var rt=p((vf,Jo)=>{"use strict";var Nu=Zo();Jo.exports=function(r){return Nu(r.length)}});var Ht=p((bf,ea)=>{"use strict";ea.exports=function(){}});var ta=p(()=>{"use strict";var _u=et(),$u=Xe(),ju=rt(),Bu=tt(),qu=Ht();_u({target:"Array",proto:!0},{at:function(e){var t=$u(this),i=ju(t),n=Bu(e),o=n>=0?n:i+n;return o<0||o>=i?void 0:t[o]}});qu("at")});var Ut=p((Cf,ra)=>{"use strict";var Du=jt();ra.exports=Du});var na=p((Ef,ia)=>{"use strict";ta();var Hu=Ut();ia.exports=Hu("Array","at")});var aa=p((Tf,oa)=>{"use strict";var Uu=na();oa.exports=Uu});var ri=p((If,sa)=>{"use strict";var Gu=aa();sa.exports=Gu});var va=p((hv,fa)=>{"use strict";var np=tt(),op=Math.max,ap=Math.min;fa.exports=function(r,e){var t=np(r);return t<0?op(t+e,0):ap(t,e)}});var ci=p((dv,ya)=>{"use strict";var sp=Qe(),lp=va(),cp=rt(),ba=function(r){return function(e,t,i){var n=sp(e),o=cp(n);if(o===0)return!r&&-1;var a=lp(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}};ya.exports={includes:ba(!0),indexOf:ba(!1)}});var ga=p(()=>{"use strict";var up=et(),pp=ci().includes,hp=z(),dp=Ht(),mp=hp(function(){return!Array(1).includes()});up({target:"Array",proto:!0,forced:mp},{includes:function(e){return pp(this,e,arguments.length>1?arguments[1]:void 0)}});dp("includes")});var Ea=p((vv,Ca)=>{"use strict";ga();var fp=Ut();Ca.exports=fp("Array","includes")});var Ia=p((bv,Ta)=>{"use strict";var vp=Ea();Ta.exports=vp});var ut=p((yv,xa)=>{"use strict";var bp=Ia();xa.exports=bp});var La=p((kv,Pa)=>{"use strict";var gp=Gr(),Cp=zr(),Oa=gp("keys");Pa.exports=function(r){return Oa[r]||(Oa[r]=Cp(r))}});var Fa=p((Ov,Ma)=>{"use strict";var Ep=z();Ma.exports=!Ep(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var _a=p((Pv,Na)=>{"use strict";var Tp=Le(),Ip=W(),xp=Xe(),Sp=La(),Ap=Fa(),Va=Sp("IE_PROTO"),hi=Object,wp=hi.prototype;Na.exports=Ap?hi.getPrototypeOf:function(r){var e=xp(r);if(Tp(e,Va))return e[Va];var t=e.constructor;return Ip(t)&&e instanceof t?t.prototype:e instanceof hi?wp:null}});var ja=p((Lv,$a)=>{"use strict";$a.exports={}});var Da=p((Mv,qa)=>{"use strict";var Rp=Y(),di=Le(),kp=Qe(),Op=ci().indexOf,Pp=ja(),Ba=Rp([].push);qa.exports=function(r,e){var t=kp(r),i=0,n=[],o;for(o in t)!di(Pp,o)&&di(t,o)&&Ba(n,o);for(;e.length>i;)di(t,o=e[i++])&&(~Op(n,o)||Ba(n,o));return n}});var Ua=p((Fv,Ha)=>{"use strict";Ha.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var za=p((Vv,Ga)=>{"use strict";var Lp=Da(),Mp=Ua();Ga.exports=Object.keys||function(e){return Lp(e,Mp)}});var Za=p((Nv,Ya)=>{"use strict";var Ka=ge(),Fp=z(),Qa=Y(),Vp=_a(),Np=za(),_p=Qe(),$p=Or().f,Xa=Qa($p),jp=Qa([].push),Bp=Ka&&Fp(function(){var r=Object.create(null);return r[2]=2,!Xa(r,2)}),Wa=function(r){return function(e){for(var t=_p(e),i=Np(t),n=Bp&&Vp(t)===null,o=i.length,a=0,l=[],s;o>a;)s=i[a++],(!Ka||(n?s in t:Xa(t,s)))&&jp(l,r?[s,t[s]]:t[s]);return l}};Ya.exports={entries:Wa(!0),values:Wa(!1)}});var Ja=p(()=>{"use strict";var qp=et(),Dp=Za().values;qp({target:"Object",stat:!0},{values:function(e){return Dp(e)}})});var ts=p((jv,es)=>{"use strict";Ja();var Hp=$t();es.exports=Hp.Object.values});var is=p((Bv,rs)=>{"use strict";var Up=ts();rs.exports=Up});var tr=p((qv,ns)=>{"use strict";var Gp=is();ns.exports=Gp});var yi=p((hb,ds)=>{"use strict";var Wp=Ke();ds.exports=Array.isArray||function(e){return Wp(e)==="Array"}});var fs=p((db,ms)=>{"use strict";var Kp=TypeError,Qp=9007199254740991;ms.exports=function(r){if(r>Qp)throw Kp("Maximum allowed index exceeded");return r}});var ys=p((mb,bs)=>{"use strict";var Xp=yi(),Yp=rt(),Zp=fs(),Jp=Yr(),vs=function(r,e,t,i,n,o,a,l){for(var s=n,c=0,d=a?Jp(a,l):!1,v,b;c<i;)c in t&&(v=d?d(t[c],c,e):t[c],o>0&&Xp(v)?(b=Yp(v),s=vs(r,e,v,b,s,o-1)-1):(Zp(s+1),r[s]=v),s++),c++;return s};bs.exports=vs});var Es=p((fb,Cs)=>{"use strict";var eh=Ye(),th=eh("toStringTag"),gs={};gs[th]="z";Cs.exports=String(gs)==="[object z]"});var Is=p((vb,Ts)=>{"use strict";var rh=Es(),ih=W(),ir=Ke(),nh=Ye(),oh=nh("toStringTag"),ah=Object,sh=ir(function(){return arguments}())==="Arguments",lh=function(r,e){try{return r[e]}catch(t){}};Ts.exports=rh?ir:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=lh(e=ah(r),oh))=="string"?t:sh?ir(e):(i=ir(e))==="Object"&&ih(e.callee)?"Arguments":i}});var Ss=p((bb,xs)=>{"use strict";var ch=Y(),uh=W(),gi=qt(),ph=ch(Function.toString);uh(gi.inspectSource)||(gi.inspectSource=function(r){return ph(r)});xs.exports=gi.inspectSource});var Ps=p((yb,Os)=>{"use strict";var hh=Y(),dh=z(),As=W(),mh=Is(),fh=jt(),vh=Ss(),ws=function(){},Rs=fh("Reflect","construct"),Ci=/^\s*(?:class|function)\b/,bh=hh(Ci.exec),yh=!Ci.test(ws),mt=function(e){if(!As(e))return!1;try{return Rs(ws,[],e),!0}catch(t){return!1}},ks=function(e){if(!As(e))return!1;switch(mh(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return yh||!!bh(Ci,vh(e))}catch(t){return!0}};ks.sham=!0;Os.exports=!Rs||dh(function(){var r;return mt(mt.call)||!mt(Object)||!mt(function(){r=!0})||r})?ks:mt});var Vs=p((gb,Fs)=>{"use strict";var Ls=yi(),gh=Ps(),Ch=Pe(),Eh=Ye(),Th=Eh("species"),Ms=Array;Fs.exports=function(r){var e;return Ls(r)&&(e=r.constructor,gh(e)&&(e===Ms||Ls(e.prototype))?e=void 0:Ch(e)&&(e=e[Th],e===null&&(e=void 0))),e===void 0?Ms:e}});var _s=p((Cb,Ns)=>{"use strict";var Ih=Vs();Ns.exports=function(r,e){return new(Ih(r))(e===0?0:e)}});var $s=p(()=>{"use strict";var xh=et(),Sh=ys(),Ah=Xe(),wh=rt(),Rh=tt(),kh=_s();xh({target:"Array",proto:!0},{flat:function(){var e=arguments.length?arguments[0]:void 0,t=Ah(this),i=wh(t),n=kh(t,0);return n.length=Sh(n,t,t,i,0,e===void 0?1:Rh(e)),n}})});var js=p(()=>{"use strict";var Oh=Ht();Oh("flat")});var qs=p((Sb,Bs)=>{"use strict";$s();js();var Ph=Ut();Bs.exports=Ph("Array","flat")});var Hs=p((Ab,Ds)=>{"use strict";var Lh=qs();Ds.exports=Lh});var Gs=p((wb,Us)=>{"use strict";var Mh=Hs();Us.exports=Mh});var Hh={};xl(Hh,{ContainerTypes:()=>T.ContainerTypes,ControlTypes:()=>T.ControlTypes,CustomError:()=>B,EVENT_NAMES:()=>L,EventActionTypes:()=>T.EventActionTypes,EventTypes:()=>T.EventTypes,Interactives:()=>vt,ManifestController:()=>Te,SDKInfo:()=>Dh,chapterIdsToVKVideoIds:()=>or,compareVersions:()=>Yt,containerTypes:()=>Qu,controlTypes:()=>Xu,eventActionTypes:()=>ni,eventTypes:()=>Yu,getChapterIdByVkVideoId:()=>cl,getVKVideoIdByMedia:()=>Ii,getVideoRawIdByMedia:()=>sl,graphEventTypes:()=>$e,hasEndTemplate:()=>pt,interactivesEventTypes:()=>_,isAreaControl:()=>Ku,isButtonControl:()=>Wu,isLastChapter:()=>J,isOneTextCtrlContainer:()=>Ee,isSupportedManifest:()=>T.isSupportedManifest,isTextControl:()=>at,isVKVariantItem:()=>ll,isValidManifest:()=>ii,migrateManifestToLatestVersion:()=>T.migrateManifestToLatestVersion,utils:()=>vl,vkVideoIdsToChapterIds:()=>xi});module.exports=Sl(Hh);var Bi="1.0.39-dev.3ba6f931.0";var Ft=require("@vkontakte/videoplayer-shared/es2015");var pr=class{constructor(e){this.layout=e}},gt=class extends pr{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 qi(r){return"features"in r}var Re=class{constructor(e,t){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]}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 be=require("@vkontakte/videoplayer-shared/es2015");var pe=(r,e)=>Object.prototype.toString.call(r)===`[object ${e}]`,he=r=>pe(r,"Object"),Ct=r=>pe(r,"String"),Et=r=>pe(r,"Array"),Tt=r=>pe(r,"Number"),Di=r=>pe(r,"Function"),Hi=r=>pe(r,"Boolean"),hr=r=>Tt(r)&&!isNaN(r);var fe=r=>he(r)&&Object.keys(r).length===0,dr=r=>Et(r)&&!r.length;var He=(r,e)=>Ct(r)&&(e?r.trim():r).length;function Ue(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 Ui="interactive",N={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},Gi=(i=>(i.top="flex-start",i.bottom="flex-end",i.center="center",i))(Gi||{}),zi=(i=>(i.start="flex-start",i.end="flex-end",i.center="center",i))(zi||{}),Wi=(i=>(i.start="left",i.end="right",i.center="center",i))(Wi||{}),It=({target:r,props:e})=>{var t,i,n;r.style.alignItems=(t=(e==null?void 0:e.gravityVertical)&&Gi[e.gravityVertical])!=null?t:"center",r.style.justifyContent=(i=(e==null?void 0:e.gravityHorizontal)&&zi[e.gravityHorizontal])!=null?i:"center",r.style.textAlign=(n=(e==null?void 0:e.alignment)&&Wi[e.alignment])!=null?n:"center"},xt=({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},St=({target:r,props:e,fallback:t})=>{var i,n,o,a;r.style.backgroundColor=Ue((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)},Ge=({target:r,props:e,fallback:t,dependsOn:i,useRawValues:n=!1})=>{var l,s,c,d,v,b,g,A,E,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=Ue(n?t.borderColor:(A=(g=(b=e==null?void 0:e.shape)==null?void 0:b.border)==null?void 0:g.color)!=null?A:t.borderColor,n?t.borderAlpha:(u=(m=(E=e==null?void 0:e.shape)==null?void 0:E.border)==null?void 0:m.alpha)!=null?u:t.borderAlpha),r.style.borderRadius=a},Ki=({target:r,isDark:e,baseDimension:t,fallback:i})=>{let a=Ue(i.shadowColorLight,i.shadowColorAlpha),l=Ue(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 ie=require("@vkontakte/videoplayer-shared/es2015");var mr="interactive-control-tap",Oe={common:mr,animation:`${mr}-animation`,visible:`${mr}-visible`};var Al=60,At=class{constructor({controlRotateAngleRad:e,clickCancelCondition:t,circleDiameterPx:i=Al,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=wl(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(Oe.visible,Oe.animation)};this.onAnimationEnd=e=>{!e.target||!e.currentTarget||e.target===e.currentTarget&&this.element.classList.remove(Oe.visible,Oe.animation)};let o=document.createElement("div");o.classList.add(Oe.common),this.controlRotateAngleRad=e,this.element=o,this.clickCancelCondition=t,this.circleDiameterPx=i,this.useDimensionsBasedSize=n}};function wl(r,e,t){return{x:r*Math.cos(t)-e*Math.sin(t),y:r*Math.sin(t)+e*Math.cos(t)}}var fr="int",ve=(i=>(i.AREA=`${fr}_area`,i.TEXT=`${fr}_text`,i.BUTTON=`${fr}_bttn`,i))(ve||{});function vr(r){return"features"in r}var re="interactive-control",M={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`},Qi=40;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," ")}`}};var de=class{constructor(e,t){this.control=e;this.options=t;this.container=null;this.controlElement=null;this.subscriptions=new ie.Subscription;this.error$=new ie.Subject;this.isInteracted$=new ie.ValueSubject(!1)}onError(e="",t){let i=new B(1,1,{message:e,error:t,details:{id:this.control.id}});this.error$.next(i)}addControlTap(e){var t;if(this.featureIsEnabled("controlsTapPlace")&&this.container){let i=(t=this.control.layoutParams.angle)!=null?t:N.angle;this.controlTap=new At({controlRotateAngleRad:i,clickCancelCondition:this.container.isManifestContainerDisabled,circleDiameterPx:this.isTouch()?Qi:void 0}),this.subscriptions.add((0,ie.fromEvent)(e,"click").subscribe(this.controlTap.onElementClick,n=>this.onError("Control click tap animation error",n))).add((0,ie.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(M.wrapper),e.setControlLayout(t,this.control.layoutParams);let i=((o=this.control.layoutParams.innerSizesDependOn)!=null?o:N.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$.next(!0),e()}}featureIsEnabled(e){return this.options&&vr(this.options)&&this.options.features[e]}isTouch(){return this.options&&vr(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,ie.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 gr="interactive-blink-anim-reference",D={common:gr,animation:`${gr}-animation`,disabled:`${gr}-disabled`},wt=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 Cr="interactive-container",H={common:Cr,hidden:`${Cr}-hidden`,disabled:`${Cr}-disabled`};var Rt=(r,e)=>{if(r.type.trim().toLowerCase()==="area")return new Er(r,e)},Er=class extends de{constructor(e,t){super(e,t)}createView({parentElement:e,callbacks:t}){if(super.createContainerElement(t),!this.container)return;let i=document.createElement("button");i.type="button",i.classList.add(M.common,M.area),i.setAttribute("data-testid",ve.AREA),St({target:i,props:this.control.props,fallback:S(f({},N),{backgroundColor:"transparent"})}),ke({target:i,layoutParams:this.control.layoutParams,fallback:N}),this.addControlTap(i),this.container.element.append(i),e.append(this.container.element),this.controlElement=i,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,be.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,be.fromEvent)(this.controlElement,"mouseenter").subscribe(()=>{e.classList.contains(H.disabled)||this.onBlinkHovering()},i=>this.onError("Error happened in mouseenter callback",i))).add((0,be.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(M.disabled)}enable(){this.controlElement&&this.controlElement.classList.remove(M.disabled)}getElement(){return this.controlElement}updateShadowStyles(e){var t,i,n;if(!(!this.container||!this.controlElement))if(Hi(e)){let o=Math.min(this.controlElement.offsetWidth,this.controlElement.offsetHeight)+"px";Ki({target:this.controlElement,props:this.control.props,fallback:N,isDark:e,baseDimension:o}),Ge({target:this.controlElement,props:this.control.props,fallback:S(f({},N),{borderColor:e?N.shadowColorDark:N.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:N.roundCorners})`}),dependsOn:this.container.dimensions,useRawValues:!0})}else Ge({target:this.controlElement,props:this.control.props,fallback:S(f({},N),{borderAlpha:0}),dependsOn:this.container.dimensions})}toggleBlinkAnimation(e){var t,i;(t=this.controlElement)==null||t.classList.toggle(M.blinkAnim,e),(i=this.controlElement)==null||i.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(D.disabled)||(this.controlElement.classList.add(D.disabled),this.subscriptions.add((0,be.fromEvent)(e,"animationiteration").pipe((0,be.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(`${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)})}setShowTimeRange(){}updateFillAnimationDimensions(){}onProgress(){}onResize(){}};var ye=require("@vkontakte/videoplayer-shared/es2015");var kt=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 Ot=Math.PI,Tr=2*Ot,Pt=Ot/2,Xi=3*Pt,Rl=0,kl=[Rl,Pt,Ot,Xi];function Yi(r){return r===Pt}function Zi(r){return r===Ot}function Ji(r){return r===Xi}function en(r){return(r%Tr+Tr)%Tr}function Ol(r){for(let e of kl)if(r===e)return e}function tn(r){if(Ol(r))return null;let t=Math.floor(r/Pt)+1;return[1,2,3,4][t-1]}function rn(r){return r*180/Math.PI}var se="interactive-control-fill-animation",U={common:se,fillerWrapper:`${se}-filler-wrapper`,filler:`${se}-filler`,fillHeight:`${se}-fill-height`,fillWidth:`${se}-fill-width`,fromTop:`${se}-from-top`,fromBottom:`${se}-from-bottom`,fromLeft:`${se}-from-left`,fromRight:`${se}-from-right`};var Lt=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=en(e.rotateAngle),a=tn(o),l=a!==null,c=a===2||!l&&Zi(o)||a===3,d=!l&&Yi(o),v=!l&&Ji(o),b=!c&&!d&&!v,g=d||v,A=l&&!g,E=A?o:0;t.style.borderRadius=e.borderRadius,i.style.transform=`skew(${E*-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:rn(o),rotateAngleRaw:e.rotateAngle,fromRight:c,fromTop:d,fromBottom:v,fromLeft:b}),this.useSkew=A,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 Mt=(r,e)=>{if(r.type.trim().toLowerCase()==="button")return new Ir(r,e)},Ir=class extends de{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;let i=document.createElement("button");i.type="button",i.classList.add(M.common,M.button),i.setAttribute("data-testid",ve.BUTTON),ke({target:i,layoutParams:this.control.layoutParams,fallback:N}),St({target:i,props:this.control.props,fallback:N}),Ge({target:i,props:this.control.props,fallback:N,dependsOn:this.container.dimensions}),It({target:i,props:S(f({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let n=kt(this.control.type.trim().toLowerCase()),o=(a=n.firstElementChild)!=null?a:n;xt({target:o,props:this.control.props,fallback:N,dependsOn:this.container.dimensions}),this.addControlTap(i),this.startTime!==void 0&&this.endTime!==void 0&&this.featureIsEnabled("controlsFillAnimation")&&(this.controlFillAnimation=new Lt({startTime:this.startTime,endTime:this.endTime,rotateAngle:(l=this.control.layoutParams.angle)!=null?l:N.angle,borderRadius:i.style.borderRadius})),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.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,ye.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,ye.fromEvent)(this.controlElement,"mouseenter").subscribe(()=>{e.classList.contains(H.disabled)||this.onBlinkHovering()},i=>this.onError("Error happened in mouseenter callback",i))).add((0,ye.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(M.disabled)}enable(){this.controlElement&&this.controlElement.classList.remove(M.disabled)}getElement(){return this.controlElement}toggleBlinkAnimation(e){var t,i;(t=this.controlElement)==null||t.classList.toggle(M.blinkAnim,e),(i=this.controlElement)==null||i.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(D.disabled)||(this.controlElement.classList.add(D.disabled),this.subscriptions.add((0,ye.fromEvent)(e,"animationiteration").pipe((0,ye.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(`${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)})}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 nn=(r,e)=>{if(r.type.trim().toLowerCase()==="text")return new xr(r,e)},xr=class extends de{constructor(e,t){super(e,t)}createView({parentElement:e,callbacks:t}){var a;if(super.createContainerElement(t),!this.container)return;let i=document.createElement("div");i.classList.add(M.common,M.text),i.setAttribute("data-testid",ve.TEXT),ke({target:i,layoutParams:this.control.layoutParams,fallback:N}),It({target:i,props:S(f({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let n=kt(this.control.type.trim().toLowerCase()),o=(a=n.firstElementChild)!=null?a:n;xt({target:o,props:this.control.props,fallback:N,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(){}onError(){}};var Vt=(r,e,t)=>{if(r.type.trim().toLowerCase()==="choice")return new Sr(r,e,t)},Sr=class extends Re{constructor(t,i,n){super(t,n);this.containerElement=null;this.controlSubscriptions=new Ft.Subscription;this.error$=new Ft.Subject;this.rootElement=i,this.layout=new gt(this.container.layout),this.isRemoved=!1,this.isDisabled=!1,this.addControlFactory("button",Mt),this.addControlFactory("text",nn),this.addControlFactory("area",Rt)}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.controlSubscriptions.add(o.error$.subscribe(this.error$))}),this.rootElement.append(n),this.isRemoved=!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(){let t=this.getElement();t&&(this.controlSubscriptions.unsubscribe(),this.controls.forEach(i=>i.removeListeners()),t.remove(),this.isRemoved=!0,this.containerElement=null)}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 ml=X(ri(),1),w=require("@vkontakte/videoplayer-shared/es2015"),qe=require("@vkontakte/videoplayer-statistics/es2015");var pa=require("@vkontakte/videoplayer-shared/es2015");function it(r,e){let t;return(...i)=>{clearTimeout(t),t=setTimeout(()=>r(...i),e)}}var la="video_interactive",ca="videoint";var ua=250,nt=class{constructor(e){this.handleZoomChange=it(e=>{this.lastZoomInfo=e},ua);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,!Tt(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=zu(e),this.resizeObserver=new ResizeObserver(it(this.onResize,ua)),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 i;if(!this.manifest)return;let e;try{e=yield(0,pa.loadVKLangPack)(this.lang,la,ca)}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=te(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 zu(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 ot=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 T=require("@interactiveplatform/movika-manifest");var ha={metadata:"Object",chapters:"Array"},ii=r=>{if(!he(r))return!1;for(let e in ha)if(!r[e]||!pe(r[e],ha[e]))return!1;return(0,T.isSupportedManifest)(r.metadata.version)},at=r=>r.type===T.ControlTypes.Text,Wu=r=>r.type===T.ControlTypes.Button,Ku=r=>r.type===T.ControlTypes.Area,Qu={Choice:"Choice",TextInput:"TextInput"},Xu={Button:"Button",Area:"Area",Text:"Text"},Yu={onClick:"onClick",onSuspense:"onSuspense"},ni={openURI:"openURI",setNextBranch:"setNextBranch",setWeightlessRandomBranch:"setWeightlessRandomBranch",setRandomBranch:"setRandomBranch",setMaxWeightBranch:"setMaxWeightBranch",setMinWeightBranch:"setMinWeightBranch",setDefaultBranch:"setDefaultBranch",continuePlayback:"continuePlayback",expect:"expect"};var Gt=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 zt=class{constructor(e){this.fns=[];this.addFn=(e,t=!1)=>{Di(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 ka=require("@vkontakte/videoplayer-shared/es2015");var Wt=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 O(this,null,function*(){return Zu(...this.loaders[e])(t)})}};function Zu(...r){return function(t){return O(this,null,function*(){let i=[...r];for(;i.length>0;)t=yield i.shift()(t);return t})}}function st(r,e,t){return r?S(f({},r),{[e]:r[e]?[t,...r[e]]:[t]}):{[e]:[t]}}function Kt(n){var o=n,{actions:r,errors:e,chapterId:t}=o,i=te(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?S(f({},i),{actions:r,errors:e,result:{chapter:l,media:s,graph:c}}):S(f({},i),{errors:st(e,Kt.name,"Could not find media"),actions:r})}}}return S(f({},i),{errors:st(e,Kt.name,"Could not find chapter"),actions:r})}var Qt=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 Qt{constructor(){super(),this.listeners||Qt.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)}},lt=class{constructor(){Object.defineProperty(this,"signal",{value:new Ne,writable:!0,configurable:!0})}abort(e){let t;try{t=new Event("abort")}catch(n){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 i=e;if(i===void 0)if(typeof document=="undefined")i=new Error("This operation was aborted"),i.name="AbortError";else try{i=new DOMException("signal is aborted without reason")}catch(n){i=new Error("This operation was aborted"),i.name="AbortError"}this.signal.reason=i,this.signal.dispatchEvent(t)}toString(){return"[object AbortController]"}};typeof Symbol!="undefined"&&Symbol.toStringTag&&(lt.prototype[Symbol.toStringTag]="AbortController",Ne.prototype[Symbol.toStringTag]="AbortSignal");function Xt(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 oi(r){typeof r=="function"&&(r={fetch:r});let{fetch:e,Request:t=e.Request,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:n=!1}=r;if(!Xt({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,A)=>{d.addEventListener("abort",()=>A(v),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([b,a(s,c)])}return a(s,c)},Request:o}}var Ju=()=>"fetch"in window,ct=Ju()&&Xt({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),da=ct?oi({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,ai=ct?da.fetch:window.fetch,tv=ct?da.Request:window.Request,rv=ct?lt:window.AbortController,iv=ct?Ne:window.AbortSignal;var Yt=(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 ep=r=>O(void 0,null,function*(){try{let e={},t;if(Ct(r)){t=new URL(r).href;let n=yield ai(t);if(!n.ok)return{};e=yield n.json()}else if(he(r))e=r;else return{};if(!ii(e))return{};let i=e.metadata.media;if(Ct(i)&&!("media"in e))try{let n;t?n=new URL(i,t).href:(n=new URL(i).href,t=n);let o=yield ai(n);if(!o.ok)throw new Error;e.metadata.media=yield o.json()}catch(n){return ip(e.metadata.version)?{manifest:e}:{}}return{manifest:e,manifestURL:t}}catch(e){return{}}});function ma(r){return O(this,null,function*(){let{manifest:e,manifestURL:t}=yield ep(r);if(!e)throw new Error("Failed on fetch");let i=(0,T.migrateManifestToLatestVersion)(e);return i.media=tp(i.media,t),delete i.metadata.media,i})}function Zt(r,e){if(e)return r.find(t=>t.id===e)}function si(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 li(r,e){return r.videos.find(t=>t.id===e)}function tp(r,e){return S(f({},r),{videos:r.videos.map(t=>S(f({},t),{variants:t.variants.map(i=>{let n="url"in i?i.url:"",o=rp(n,e);return S(f({},i),{url:o||n})})}))})}function rp(r="",e){try{return new URL(r,e).href}catch(t){return""}}function ip(r){return Yt(r,"3.2.0")>=0}var Sa=X(ut(),1);var Jt=r=>Et(r)&&!dr(r),J=r=>r.order==="end",pt=r=>Et(r.containers)&&!dr(r.containers)&&J(r),Aa=(r,e)=>{var i;let t=r*1e3;return Jt(e.controls)&&t<((i=e.startTime)!=null?i:0)},ui=(r,e)=>{var i,n;let t=r*1e3;return Jt(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"),pi=(r=[])=>r.find(e=>e.action.type==="expect"),yp=r=>(r==null?void 0:r.length)===1,Ee=r=>yp(r)&&at(r[0]);function wa(r=[],e=1/0,t=[]){return r.filter(({container:i})=>!(0,Sa.default)(t,i.container.id)&&Ce(i.container.events)&&i.container.endTime===e&&!i.isRemoved)}function er({gameControllers:r=[],subjectName:e,subjectId:t,execFn:i}){for(let n of r)if(e==="container"&&n.container.container.id===t){i(n),wa(r,n.container.container.endTime,[n.container.container.id]).forEach(a=>{i(a)});break}}var Ra=(r,e)=>{let t=E=>{let m=e.find(({container:u})=>u.container.id===E);return m==null?void 0:m.container.isRemoved},i=Ce(r.events)&&!t(r.id),n=(E,m=!1,u=!1)=>{let h=u?"every":"some";return E.controls[h](y=>{var R;let I=m?E.endTime===r.endTime:!0;return((R=y.events)==null?void 0:R[h](C=>{var x;return((x=C.action)==null?void 0:x.type)===ni.openURI}))&&I})},o=E=>E.some(({container:m})=>n(m.container,!0,!1)&&!m.isRemoved),a=E=>E.every(({container:m})=>m.isRemoved?!0:n(m.container,!0,!0)),l=wa(e,r.endTime,[r.id]).length,s=E=>E.controls.some(m=>{var u;return(u=m.events)==null?void 0:u.some(h=>{var y,I;return(I=(y=h.action)==null?void 0:y.args)==null?void 0:I.shouldOpenNow})}),c=i||l>0,d=o(e),v=n(r),b=a(e),g=i?!1:l>0,A=s(r);return{isExpectTime:c,hasOtherExpect:l>0,hasOpenURIEvent:d,hasOpenURIEventInCurrentContainer:v,isAllOpenURIEventsValid:b,isExpectEventForCurrentContainer:g,hasShouldOpenNowEvent:A}};var Te=class extends Wt{constructor(t,i){super(t);this.manifest=null;this.chapter=null;this.media=null;this.graph=null;this.prevChapter$=new ka.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 O(this,null,function*(){var n;this.release();let i=yield this.exec("manifestLoaders",{actions:{addErrorMessage:st},result:null,errors:null,source:t});return i.errors&&this.errorHandler(i.errors),this.manifest=yield ma((n=i.result)!=null?n:t),this})}setInitial(){return O(this,null,function*(){return this.setNext()})}setNext(){return O(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",Kt({actions:{getManifest:()=>this.manifest,getCurrent:this.getCurrent,getGraph:si,getChapter:Zt,getMedia:li,getByBranches:this.getByBranches.bind(this),addErrorMessage:st},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=Zt(this.manifest.chapters,t);if(n){let o=li(this.manifest.media,n.videoId),a=si(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=Zt(((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?J(this.chapter):!1}};var ss=X(tr(),1),ls=require("@vkontakte/videoplayer-core/es2015"),me=require("@vkontakte/videoplayer-shared/es2015");var os=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 as=X(tr(),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=te(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,as.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=X(ut(),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=S(f({},t.MPEG),{[(o=s.standard)!=null?o:"Invariant quality"]:s.url}));break;case"mpeg":(n||(0,_e.default)(e,"mpeg"))&&(t.MPEG=S(f({},t.MPEG),{[(a=s.standard)!=null?a:"Invariant quality"]:s.url}));break;case"hls":(n||(0,_e.default)(e,"hls"))&&(t=S(f({},t),{HLS:{type:"url",url:s.url}}));break;case"dash":(n||(0,_e.default)(e,"dash"))&&(t=S(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 zp=2;function vi(r){let e=mi(),t=new me.Subscription,i={},n=null,o=!1,a,l=new me.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 I=((R=e.map.get(m))!=null?R:{})[u];if(I){i=f({chapterId:h,listId:m,itemId:u},I);let C=i.player;i.subscription.add(C.info.currentQuality$.subscribe(x=>{let q=C.info.position$.getValue(),P=C.info.isAutoQualityEnabled$.getValue();if(!(!x||!q||P))for(let V of e.map)(0,ss.default)(V[1]).forEach(({player:F})=>{ht(F,x)})})).add(C.events.started$.subscribe(()=>{d(u)})),I.container.remove(),n.setPlayer(I.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 O(this,null,function*(){if(!n)throw Error("need to set interactive controller");if(fe(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 O(this,arguments,function*({chapter:{id:m},manifestVideo:u}){if(fe(i)||!n)return;let y=i.player.info.muted$.getValue(),I=i.player.info.currentQuality$.getValue(),R=i.player.info.isAutoQualityEnabled$.getValue(),C=i.player.info.volume$.getValue(),x=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<zp||(P=!0),e.removePlayer(V[0],j)):(P=!0,c(V[0],j,m),q?ht(i.player,I):i.player.setAutoQuality(!0),i.player.setVolume(C),i.player.setMuted(y),i.player.setPlaybackRate(x))}else e.removePlayer(V[0]);P||(yield b({media:u,chapterId:m,setAsActive:!0,playbackRate:x}),q?ht(i.player,I):i.player.setAutoQuality(!0),i.player.setVolume(C),i.player.setMuted(y))})}function b(q){return O(this,arguments,function*({media:m,chapterId:u,prefetch:h=!0,setAsActive:y=!0,autoplay:I=!1,preferredExt:R,title:C,playbackRate:x}){var Ri,ki,Oi,Pi,Li;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=os(m);bt.length&&(F=yield n.options.vkVideoLoader(...bt))}let j=((ki=n==null?void 0:n.options)==null?void 0:ki.coreConfig)||void 0,Ae=S(f({},j),{configName:[...(Oi=j==null?void 0:j.configName)!=null?Oi:[],"interactive"]}),ae=S(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)||[]}),ee=new ls.Player(Ae,me.Tracer.createRootTracer());ee.initVideo(ae);let Ai=null;if(F!=null&&F.videos&&(n!=null&&n.options.createOneStat)){let bt=F.videos[0],cr=n.options.createOneStat(bt),Mi=new me.Subscription;cr&&(Mi.add(cr.attachTo(ee)),Ai={oneStat:cr,statSubscription:Mi})}let wi=new me.Subscription,bl=(Li=i==null?void 0:i.player)==null?void 0:Li.info.isAutoQualityEnabled$.getValue();wi.add(ee.events.canplay$.subscribe(function(){bl||ht(ee,i.player.info.currentQuality$.getValue()),x&&ee.setPlaybackRate(x)}));let we=e.createPlayer({listId:m.id,itemId:P,player:ee,container:V,sources:fi(m,R).sources,config:ae,subscription:wi,statistics:Ai});return y&&c(m.id,we.itemId,u),I&&we.player.play(),h&&!I&&we.player.prepare(),{player:we.player,config:we.config,statistics:we.statistics}})}function g(){A(),n=null,a.remove()}function A(){t.unsubscribe(),e.removeAll(),i={},o=!1}function E(){return O(this,null,function*(){if(!n)throw Error("need to set interactive controller");A(),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 S(f({},e),{init:E,setInteractiveController:s,createPlayer:b,removeAll:g,getActivePlayer:function(){return i},activePlayerChanged:l})}var L={graph:"graph",interactives:"interactives",chapterChanged:"chapter-changed",playerChanged:"player-changed",manifestChanged:"manifest-changed",errors:"errors",eachTick:"eachTick",historyInited:"history-inited",historyDestroyed:"history-destroyed"},$e={visibility:"visibility",watchAgainClicked:"watchAgainClicked"},_={actionChoiceCanceled:"action-choice-canceled",actionChoice:"action-choice",actionExecution:"action-execution",visibility:"visibility",containerRemoved:"container-removed",rangeEnded:"range-ended"};var us=X(ut(),1),ps=require("@vkontakte/videoplayer-shared/es2015");function bi(r){return function(...t){return r(...t.reverse())}}function dt(r,...e){return(...t)=>he(e[0])&&he(t[0])?r(f(f({},e[0]),t[0])):r(...e,...t)}var rr=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}){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)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:A,hasOpenURIEvent:E,hasOpenURIEventInCurrentContainer:m,isAllOpenURIEventsValid:u,hasShouldOpenNowEvent:h}=this.getContainerEventState(),y=this.interactiveTimeOpenUri&&!m,I=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=!A&&!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&&E&&this.gameState!==5){if(I){let C=((x,q,P,V)=>!x&&!q&&P||x&&!q&&P&&!V||x&&!q&&P&&V)(g,A,u,this.isSelectedContainerEvent);this.fakeRemoveView(C)}else this.removeView(),this.emitContainerVisibilityEvent(!1);(!g||!A||!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.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 c,d,v;let e=this.player.experimental.element$.getValue(),i=e instanceof HTMLVideoElement?e.readyState:void 0,n=[6,5];if(!i||(0,us.default)(n,this.gameState)&&!this.isPermanentText)return;let o=this.player.getExactTime();if(Aa(o,this.container.container))this.gameState!==1&&(this.gameState=1,this.onBeforeStartTime());else if(ui(o,this.container.container))this.gameState!==2&&(this.gameState=2,this.onStartTime());else if(this.gameState!==3){let b=this.gameState;this.gameState=3,b===2&&this.onEndTime()}else{let{hasOpenURIEventInCurrentContainer:b}=this.getContainerEventState(),g=this.selectBranches.state.isExpect,A=this.interactiveTimeOpenUri&&b;if(A&&!g){let E=this.container.getElement();E&&(E.style.visibility!=="hidden"&&((d=(c=this.container).hide)==null||d.call(c)),this.container.isRemoved||this.fakeRemoveView())}!this.isPermanentText&&!A&&this.removeView()}let a=ui(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(L.eachTick,s),this.globalEvents.eachTick$.next(s)};this.container=t,this.branches=i,this.selectBranches=n,this.subscription=new ps.Subscription,this.player=e,this.interactiveEvents=o,this.getContainerEventState=s,this.isPermanentText=c&&Ee(t.container.controls),this.interactiveTimeOpenUri=d,this.disabledControls$=v,this.onRemove=b,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(L.interactives,{subjectId:this.container.container.id,subjectName:"container",type:_.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(L.interactives,{subjectId:this.container.container.id,subjectName:"container",type:_.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(){var e;this.container.removeView(),this.globalEventEmitter.emit(L.interactives,{subjectId:this.container.container.id,subjectName:"container",type:_.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 hs=(r=[])=>r.reduce((e,t,i)=>{var o,a,l;let n=((o=t==null?void 0:t.controls)!=null?o:[]).filter(s=>!at(s));if(Jt(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=[],A=[];for(let E=0;E<e.length;E++){let m=e[E];if(A.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[E].subjects.push(c),e;s[0]<m.range[0]&&s[1]>m.range[0]&&(d.push(E),g=g.concat(m.subjects)),s[0]>=m.range[0]&&s[0]<=m.range[1]&&(d.push(E),g=g.concat(m.subjects),s[0]=m.range[0]),s[1]>=m.range[0]&&s[1]<=m.range[1]&&(d.push(E),g=g.concat(m.subjects),s[1]=m.range[1])}if(A.push(c),s[0]<=b&&s[1]>=v)return[{subjects:A,range:s}];d.length&&d.reverse().forEach(E=>{e.splice(E,1)}),e.push({subjects:g.concat([c]),range:s})}}return e},[]).sort((e,t)=>e.range[0]-t.range[0]);var Ws=X(ut(),1),Ei=X(tr(),1),Ks=X(Gs(),1);function zs(){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(hr(l)){let v=(d=r[l])!=null?d:null;if(v&&s&&He(s,!0)){let b={},g=v[s];if(g&&(b=f(f({},b),g)),b=fe(b)?null:b,b&&He(c,!0)){let A=b[c];return A!=null?A:null}return b}return v}return null}function o({timestamp:l,priority:s,initiator:c}){if(hr(l))if(r[l]){if(s&&He(s,!0))if(r[l][s]){if(c&&He(c,!0))if(r[l][s][c]){if(delete r[l][s][c],!fe(r[l][s]))return!0}else return!1;if(delete r[l][s],!fe(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=te(b,["timestamp","priority","initiator"]);var g,A,E;(A=(g=r[l])==null?void 0:g[s])!=null&&A[c]?r[l][s][c].push(f({},d)):(E=r[l])!=null&&E[s]?r[l][s]=S(f({},r[l][s]),{[c]:[f({},d)]}):r[l]?r[l]=S(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 Fh=[T.EventActionTypes.expect,T.EventActionTypes.setNextBranch],Vh=1/0;function Qs(r,e){let t=r,i,n=Nh(e),o=zs(),a,l=()=>{g(),u()},s=h=>{o.add.call(void 0,h),A()},c=(h=[])=>{for(let y of h)if(y.action(),(0,Ws.default)(Fh,y.actionType))break},d=(h=1/0)=>{var C,x,q;let y=nr((C=o.get({timestamp:h,priority:"control"}))!=null?C:{}),I=nr((x=o.get({timestamp:h,priority:"container"}))!=null?x:{}),R=nr((q=o.get({timestamp:h,priority:"chapter"}))!=null?q:{});return[...y,...I,...R]},v=h=>{n.isReady(h)&&c(d(h))},b=()=>{var h;c([...nr((h=o.get({timestamp:1/0,priority:"chapter"}))!=null?h:{})])},g=()=>{i&&(a==null||a.unsubscribe(),i=void 0)},A=()=>{i||(i=()=>setTimeout(()=>{v(1/0)}),a=t.events.ended$.subscribe(i))},E=h=>{g(),t=h},m=h=>{h.priority==="container"&&n.resetCalled(h.timestamp),o.remove(h)},u=()=>{n.release(),o.removeAll()};return{setPlayer:E,add:s,remove:m,exec:v,execEndOfVideo:b,listen:A,unlisten:g,release:l,containersEventsCallState:n,getPreparedToExecActions:d}}function Nh(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:Vh,v=e.get(d);e.set(d,S(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 nr(r){return(0,Ks.default)((0,Ei.default)(r)).sort(e=>e.actionType===T.EventActionTypes.expect?-1:1)}var Xs={videoContentHeight:0,videoContentWidth:0},Ys=r=>{let{height:e,width:t}=r.info.intrinsicVideoSize$.getValue()||{};if(!(e&&t))return Xs;let{clientHeight:i,clientWidth:n}=r.experimental.element$.getValue()||{};if(!(i&&n))return Xs;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 _h=250;function Zs(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}=Ys(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=it(l=>{let{fns:s=[]}=r();i(l);for(let c of s)c()},_h);function a(){e=void 0,t.disconnect(),n()}return{resizeObserver:t,calc:()=>{e==null||e()},release:a}}var $h=r=>Math.floor(Math.random()*r),el=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},tl=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 rl=r=>{let e=r.length,t=$h(e);return r[t]},Js=1,il=r=>{var i,n;let e=0;for(let o=0;o<r.length;++o)e+=(i=r[o].weight)!=null?i:Js;let t=Math.random()*e;e=0;for(let o=0;o<r.length-1;++o)if(e+=(n=r[o].weight)!=null?n:Js,e>=t)return r[o];return r[r.length-1]};var nl={shouldOpenNow:!0,isDetachContainer:!0},ol="after-expect",Ti=(r,e=!1)=>S(f({},r),{args:e?f(f({},r.args),nl):f(f({},nl),r.args)}),al=({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:I,branches:R=[],onEvent:C,isEOV:x=()=>!1,isDisabled:q=()=>!1})=>{let P=Ti(u,x()),V={timestamp:1/0,priority:"control",initiator:y,actionType:P.type},F=q(),j=r.emit.bind(r,L.interactives,{subjectId:y,subjectType:h,subjectName:"control",type:F?_.actionChoiceCanceled:_.actionChoice,actionType:u.type,payload:f({invokeImmediately:P.args.shouldOpenNow,containerId:I},P.args)}),Ae=()=>{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:I},P.args)})};if(F){j(),Ae();return}switch(P.type.trim().toLowerCase()){case T.EventActionTypes.setNextBranch.trim().toLowerCase():{let ae=R.find(ee=>ee.id===P.args.branchId);if(!ae)return;C(P.args.isDetachContainer,g.bind(null,{subjectId:y,subjectName:"control"})),j(),Ae(),P.args.shouldOpenNow?E({subjectId:y,subjectName:"control",subjectType:h,action:P,payload:{chapterId:ae.chapterId,autoSelect:!1}}):i.add(S(f({},V),{action:E.bind(null,{subjectId:y,subjectName:"control",subjectType:h,action:P,payload:{chapterId:ae.chapterId,autoSelect:!1}})}));return}case T.EventActionTypes.continuePlayback.trim().toLowerCase():{C(P.args.isDetachContainer,g.bind(null,{subjectId:y,subjectName:"control"})),j(),Ae(),P.args.shouldOpenNow?A({subjectId:y,subjectName:"control",subjectType:h,action:u}):i.add(S(f({},V),{action:A.bind(null,{subjectId:y,subjectName:"control",subjectType:h,action:u})}));return}case T.EventActionTypes.openURI.trim().toLowerCase():{C(P.args.isDetachContainer,g.bind(null,{subjectId:y,subjectName:"control"})),j(),Ae(),P.args.shouldOpenNow?m({subjectId:y,subjectName:"control",subjectType:h,action:P,payload:{URI:u.args.uri}}):i.add(S(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",ee=new B(1,1,{message:ae});d(ee,ae);return}}},l=({action:u,container:{id:h,endTime:y},branches:I=[],isEOV:R=!1,autoSelected:C=!1})=>{let x=Ti(u,R),q={timestamp:!x.args.shouldOpenNow||R?1/0:y!=null?y:1/0,priority:"container",initiator:h,actionType:x.type},P=r.emit.bind(r,L.interactives,{subjectId:h,subjectName:"container",type:_.actionChoice,actionType:x.type,payload:f({invokeImmediately:x.args.shouldOpenNow},x.args)}),V=()=>{e.interactiveActionChoice$.next({subjectId:h,subjectName:"container",type:"action-choice",actionType:x.type,payload:f({invokeImmediately:x.args.shouldOpenNow},x.args)})};switch(x.type.trim().toLowerCase()){case T.EventActionTypes.setNextBranch.trim().toLowerCase():{let F=I.find(j=>j.id===x.args.branchId);if(!F)return;P(),V(),i.add(S(f({},q),{action:E.bind(null,{subjectId:h,subjectName:"container",action:x,payload:{chapterId:F.chapterId,autoSelect:C}})}));return}case T.EventActionTypes.setMaxWeightBranch.trim().toLowerCase():return;case T.EventActionTypes.setMinWeightBranch.trim().toLowerCase():return;case T.EventActionTypes.setRandomBranch.trim().toLowerCase():return;case T.EventActionTypes.setWeightlessRandomBranch.trim().toLowerCase():return;case T.EventActionTypes.continuePlayback.trim().toLowerCase():{P(),V(),i.add(S(f({},q),{action:A.bind(null,{subjectId:h,subjectName:"container",action:x})}));return}case T.EventActionTypes.openURI.trim().toLowerCase():{P(),V(),i.add(S(f({},q),{action:m.bind(null,{subjectId:h,subjectName:"container",action:x,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 I=pi(u.events);if(I){let x=Ti(I.action,y);r.emit(L.interactives,{subjectId:u.id,subjectName:"container",type:_.actionChoice,actionType:x.type,payload:f({invokeImmediately:x.args.shouldOpenNow},x.args)}),e.interactiveActionChoice$.next({subjectId:u.id,subjectName:"container",type:"action-choice",actionType:x.type,payload:f({invokeImmediately:x.args.shouldOpenNow},x.args)}),i.add({timestamp:y?1/0:(R=u.endTime)!=null?R:1/0,priority:"container",initiator:u.id,actionType:T.EventActionTypes.expect,action:b.bind(null,{subjectId:u.id,subjectName:"container"})}),n.isExpect=!0}else for(let x of(C=u.events)!=null?C:[])l({action:x.action,container:u,branches:h,isEOV:y})}let c=({chapterId:u,action:h,branches:y=[]})=>{let I=r.emit.bind(r,L.interactives,{subjectId:u,subjectName:"chapter",type:_.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 T.EventActionTypes.setNextBranch.trim().toLowerCase():{let C=y.find(x=>x.id===h.args.branchId);return C!=null&&C.chapterId?(I(),R(),E.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case T.EventActionTypes.setWeightlessRandomBranch.trim().toLowerCase():{let C=rl(y);return C!=null&&C.chapterId?(I(),R(),E.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case T.EventActionTypes.setRandomBranch.trim().toLowerCase():{let C=il(y);return C!=null&&C.chapterId?(I(),R(),E.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case T.EventActionTypes.setMaxWeightBranch.trim().toLowerCase():{let C=tl(y);return C!=null&&C.chapterId?(I(),R(),E.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case T.EventActionTypes.setMinWeightBranch.trim().toLowerCase():{let C=el(y);return C!=null&&C.chapterId?(I(),R(),E.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case T.EventActionTypes.continuePlayback.trim().toLowerCase():return I(),R(),A.bind(null,{subjectId:u,subjectName:"chapter",action:h});case T.EventActionTypes.openURI.trim().toLowerCase():return I(),R(),m.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{URI:h.args.uri}});default:{let C="Unexpected chapter event",x=new B(1,1,{message:C});d(x,C);return}}};function d(u,h){console.error(h),e.error$.next(u),r.emit(L.errors,u)}function v(u){var y;let h=pi(u.events);if(h){if(J(u))return;r.emit(L.interactives,{subjectId:u.id,subjectName:"chapter",type:_.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:T.EventActionTypes.expect,action:b.bind(null,{subjectId:u.id,subjectName:"chapter"})})}else(y=u.events)==null||y.forEach(I=>{let R=c({chapterId:u.id,action:I.action,branches:u.branches});R&&i.add({timestamp:1/0,priority:"chapter",initiator:u.id,actionType:I.action.type,action:R})})}let b=({subjectId:u,subjectName:h})=>{t.pause(),r.emit(L.interactives,{subjectId:u,subjectName:h,type:_.actionExecution,actionType:T.EventActionTypes.expect}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,type:"action-execution",actionType:T.EventActionTypes.expect})},g=({subjectId:u,subjectName:h})=>{t.info.isEnded$.getValue()?i.execEndOfVideo():t.play(),r.emit(L.interactives,{subjectId:u,subjectName:h,type:_.actionExecution,actionType:ol}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,type:"action-execution",actionType:ol})},A=({subjectId:u,subjectName:h,subjectType:y,action:I})=>{r.emit(L.interactives,{subjectId:u,subjectName:h,subjectType:y,type:_.actionExecution,actionType:I.type}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,subjectType:y,type:"action-execution",actionType:I.type})},E=({subjectId:u,subjectName:h,subjectType:y,action:I,payload:R})=>{R.behaviour="change-chapter",r.emit(L.interactives,{subjectId:u,subjectName:h,subjectType:y,type:_.actionExecution,actionType:I.type,payload:R}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,subjectType:y,type:"action-execution",actionType:I.type,payload:R})},m=({subjectId:u,subjectName:h,subjectType:y,action:I,payload:R})=>{if(!R.URI)return;let C=window.open(R.URI,"_blank","noopener,noreferrer");C&&(C.opener=null),r.emit(L.interactives,{subjectId:u,subjectName:h,subjectType:y,type:_.actionExecution,actionType:I.type}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,subjectType:y,type:"action-execution",actionType:I.type})};return{onControlEvent:a,onContainerEvent:l,onChapterEvent:c,onExpectEvent:b,expectEventHandler:g,setManifestChapterEvents:v,setManifestContainerEvents:s,stopExpect:o,state:n}};var Si=X(ri(),1),Q=require("@vkontakte/videoplayer-shared/es2015");var or=(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)},sl=r=>{for(let e of r.variants)if(ll(e)&&e.payload)return e.payload.id},ll=r=>!!(r.type==="custom"&&r.payload&&r.payload.type==="vk"),Ii=r=>{let e=sl(r);if(!e)return null;let t=e.split("_").pop();return t?parseInt(t,10):null},cl=(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=cl(e,i);return n?[...t,n]:t},[]);var le,Ie,xe,K,ar,ce,ue,oe,Se,je,Be,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,le,null);G(this,Ie);G(this,xe,!1);G(this,K,null);G(this,ar,null);this.events={inited$:new Q.Subject,destroyed$:new Q.Subject,error$:new Q.Subject};G(this,ce,null);G(this,ue,null);G(this,oe,null);G(this,Se,new Q.Subscription);G(this,je,!1);G(this,Be,0);var a;$(this,ce,t),$(this,oe,e),$(this,ue,i),$(this,le,n),$(this,Ie,o),this.state.history$&&k(this,Se)&&((a=k(this,Se))==null||a.add(this.state.history$.subscribe(l=>{var s,c;this.state.prevChapter$.next((0,Si.default)(l,-2)||null),this.state.hasPrevChapter$.next(l.length>1),this.state.isInitialChapter$.next(this.getInitialChapterId()===((c=(s=k(this,K))==null?void 0:s.metadata)==null?void 0:c.initChapterId)),this.state.isGoBackLimited$.next(k(this,Be)===k(this,Ie).maxLength-1)})))}setManifest(e){return O(this,null,function*(){if(!k(this,ue)||!k(this,oe))return;$(this,K,e),yield this.getProjectHistory();let t=this.getInitialChapterId();yield k(this,ue).setChapter({chapterId:t,pushToHistory:!1}),k(this,xe)||($(this,xe,!0),this.events.inited$.next({initChapterId:t}))})}get inited(){return k(this,xe)}updateHistory(e,t=!0){return O(this,null,function*(){var l;if(!k(this,K))return;k(this,je)?($(this,je,!1),ji(this,Be)._++):$(this,Be,0);let i=k(this,K),n=e.length-k(this,Ie).maxLength,o=n>0?e.slice(n):e,a=or(o,i);if($(this,ar,a),this.state.history$.next(o),!(!t||!k(this,le)||!k(this,ce)))try{yield k(this,le).save(k(this,ce),a)}catch(s){let c=new B(1,5,"Unable to save interactive history");this.events.error$.next(c),(l=k(this,oe))==null||l.emit(L.errors,c)}})}goBack(){return O(this,null,function*(){var i;if(!this.state||!k(this,ue)){let n=new B(1,5,"Unable to save interactive history");return this.events.error$.next(n),(i=k(this,oe))==null?void 0:i.emit(L.errors,n)}$(this,je,!0);let e=this.state.history$.getValue().slice(0,-1),t=e.pop();this.state.history$.next(e),yield k(this,ue).setChapter({chapterId:t,playPrev:!0})})}getProjectHistory(){return O(this,null,function*(){var n;if(!k(this,K)||!k(this,ce))return;let e=k(this,K),t=[this.getInitialVideoId()];if(k(this,le))try{let o=yield k(this,le).get(k(this,ce));o.length&&(t=o)}catch(o){let a=new B(1,5,"Error while trying to fetch data");this.events.error$.next(a),(n=k(this,oe))==null||n.emit(L.errors,a)}let i=xi(t,e);this.state.history$.next(i)})}getInitialChapterId(){var t;let e=this.state.history$.getValue();return(0,Si.default)(e,-1)||k(this,Ie).initChapterId||((t=k(this,K))==null?void 0:t.metadata.initChapterId)}getInitialVideoId(){if(k(this,K)){let e=this.getInitialChapterId();return or([e],k(this,K)).pop()}return null}destroy(){var e,t;$(this,ce,null),$(this,le,null),$(this,ue,null),(e=k(this,Se))==null||e.unsubscribe(),$(this,Se,null),$(this,xe,!1),(t=k(this,oe))==null||t.emit(L.historyDestroyed),this.events.destroyed$.next(),$(this,oe,null)}};le=new WeakMap,Ie=new WeakMap,xe=new WeakMap,K=new WeakMap,ar=new WeakMap,ce=new WeakMap,ue=new WeakMap,oe=new WeakMap,Se=new WeakMap,je=new WeakMap,Be=new WeakMap;var sr=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 O(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 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 lr=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=`
|
|
6
|
+
"use strict";var yl=Object.create;var De=Object.defineProperty,gl=Object.defineProperties,Cl=Object.getOwnPropertyDescriptor,El=Object.getOwnPropertyDescriptors,Tl=Object.getOwnPropertyNames,yt=Object.getOwnPropertySymbols,xl=Object.getPrototypeOf,ur=Object.prototype.hasOwnProperty,Fi=Object.prototype.propertyIsEnumerable;var Ni=r=>{throw TypeError(r)};var Mi=(r,e,t)=>e in r?De(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,f=(r,e)=>{for(var t in e||(e={}))ur.call(e,t)&&Mi(r,t,e[t]);if(yt)for(var t of yt(e))Fi.call(e,t)&&Mi(r,t,e[t]);return r},A=(r,e)=>gl(r,El(e));var te=(r,e)=>{var t={};for(var i in r)ur.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&&Fi.call(r,i)&&(t[i]=r[i]);return t};var p=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Il=(r,e)=>{for(var t in e)De(r,t,{get:e[t],enumerable:!0})},_i=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Tl(e))!ur.call(r,n)&&n!==t&&De(r,n,{get:()=>e[n],enumerable:!(i=Cl(e,n))||i.enumerable});return r};var X=(r,e,t)=>(t=r!=null?yl(xl(r)):{},_i(e||!r||!r.__esModule?De(t,"default",{value:r,enumerable:!0}):t,r)),Sl=r=>_i(De({},"__esModule",{value:!0}),r);var $i=(r,e,t)=>e.has(r)||Ni("Cannot "+t);var k=(r,e,t)=>($i(r,e,"read from private field"),t?t.call(r):e.get(r)),G=(r,e,t)=>e.has(r)?Ni("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 k(r,e,i)}});var O=(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 ne=p((Ar,on)=>{"use strict";var ze=function(r){return r&&r.Math===Math&&r};on.exports=ze(typeof globalThis=="object"&&globalThis)||ze(typeof window=="object"&&window)||ze(typeof self=="object"&&self)||ze(typeof global=="object"&&global)||ze(typeof Ar=="object"&&Ar)||function(){return this}()||Function("return this")()});var z=p((ym,an)=>{"use strict";an.exports=function(r){try{return!!r()}catch(e){return!0}}});var We=p((gm,sn)=>{"use strict";var Pl=z();sn.exports=!Pl(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var hn=p((Cm,pn)=>{"use strict";var Vl=We(),un=Function.prototype,ln=un.apply,cn=un.call;pn.exports=typeof Reflect=="object"&&Reflect.apply||(Vl?cn.bind(ln):function(){return cn.apply(ln,arguments)})});var Y=p((Em,fn)=>{"use strict";var dn=We(),mn=Function.prototype,wr=mn.call,Ll=dn&&mn.bind.bind(wr,wr);fn.exports=dn?Ll:function(r){return function(){return wr.apply(r,arguments)}}});var Ke=p((Tm,bn)=>{"use strict";var vn=Y(),Ml=vn({}.toString),Fl=vn("".slice);bn.exports=function(r){return Fl(Ml(r),8,-1)}});var Rr=p((xm,yn)=>{"use strict";var Nl=Ke(),_l=Y();yn.exports=function(r){if(Nl(r)==="Function")return _l(r)}});var W=p((Im,gn)=>{"use strict";var kr=typeof document=="object"&&document.all;gn.exports=typeof kr=="undefined"&&kr!==void 0?function(r){return typeof r=="function"||r===kr}:function(r){return typeof r=="function"}});var ge=p((Sm,Cn)=>{"use strict";var $l=z();Cn.exports=!$l(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var _t=p((Am,En)=>{"use strict";var jl=We(),Nt=Function.prototype.call;En.exports=jl?Nt.bind(Nt):function(){return Nt.apply(Nt,arguments)}});var Or=p(In=>{"use strict";var Tn={}.propertyIsEnumerable,xn=Object.getOwnPropertyDescriptor,Bl=xn&&!Tn.call({1:2},1);In.f=Bl?function(e){var t=xn(this,e);return!!t&&t.enumerable}:Tn});var Pr=p((Rm,Sn)=>{"use strict";Sn.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var wn=p((km,An)=>{"use strict";var ql=Y(),Dl=z(),Hl=Ke(),Vr=Object,Ul=ql("".split);An.exports=Dl(function(){return!Vr("z").propertyIsEnumerable(0)})?function(r){return Hl(r)==="String"?Ul(r,""):Vr(r)}:Vr});var Lr=p((Om,Rn)=>{"use strict";Rn.exports=function(r){return r==null}});var Mr=p((Pm,kn)=>{"use strict";var Gl=Lr(),zl=TypeError;kn.exports=function(r){if(Gl(r))throw new zl("Can't call method on "+r);return r}});var Qe=p((Vm,On)=>{"use strict";var Wl=wn(),Kl=Mr();On.exports=function(r){return Wl(Kl(r))}});var Pe=p((Lm,Pn)=>{"use strict";var Ql=W();Pn.exports=function(r){return typeof r=="object"?r!==null:Ql(r)}});var $t=p((Mm,Vn)=>{"use strict";Vn.exports={}});var jt=p((Fm,Mn)=>{"use strict";var Fr=$t(),Nr=ne(),Xl=W(),Ln=function(r){return Xl(r)?r:void 0};Mn.exports=function(r,e){return arguments.length<2?Ln(Fr[r])||Ln(Nr[r]):Fr[r]&&Fr[r][e]||Nr[r]&&Nr[r][e]}});var Nn=p((Nm,Fn)=>{"use strict";var Yl=Y();Fn.exports=Yl({}.isPrototypeOf)});var Bn=p((_m,jn)=>{"use strict";var Zl=ne(),_n=Zl.navigator,$n=_n&&_n.userAgent;jn.exports=$n?String($n):""});var Wn=p(($m,zn)=>{"use strict";var Gn=ne(),_r=Bn(),qn=Gn.process,Dn=Gn.Deno,Hn=qn&&qn.versions||Dn&&Dn.version,Un=Hn&&Hn.v8,Z,Bt;Un&&(Z=Un.split("."),Bt=Z[0]>0&&Z[0]<4?1:+(Z[0]+Z[1]));!Bt&&_r&&(Z=_r.match(/Edge\/(\d+)/),(!Z||Z[1]>=74)&&(Z=_r.match(/Chrome\/(\d+)/),Z&&(Bt=+Z[1])));zn.exports=Bt});var $r=p((jm,Qn)=>{"use strict";var Kn=Wn(),Jl=z(),ec=ne(),tc=ec.String;Qn.exports=!!Object.getOwnPropertySymbols&&!Jl(function(){var r=Symbol("symbol detection");return!tc(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&Kn&&Kn<41})});var jr=p((Bm,Xn)=>{"use strict";var rc=$r();Xn.exports=rc&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Br=p((qm,Yn)=>{"use strict";var ic=jt(),nc=W(),oc=Nn(),ac=jr(),sc=Object;Yn.exports=ac?function(r){return typeof r=="symbol"}:function(r){var e=ic("Symbol");return nc(e)&&oc(e.prototype,sc(r))}});var Jn=p((Dm,Zn)=>{"use strict";var lc=String;Zn.exports=function(r){try{return lc(r)}catch(e){return"Object"}}});var qr=p((Hm,eo)=>{"use strict";var cc=W(),uc=Jn(),pc=TypeError;eo.exports=function(r){if(cc(r))return r;throw new pc(uc(r)+" is not a function")}});var ro=p((Um,to)=>{"use strict";var hc=qr(),dc=Lr();to.exports=function(r,e){var t=r[e];return dc(t)?void 0:hc(t)}});var no=p((Gm,io)=>{"use strict";var Dr=_t(),Hr=W(),Ur=Pe(),mc=TypeError;io.exports=function(r,e){var t,i;if(e==="string"&&Hr(t=r.toString)&&!Ur(i=Dr(t,r))||Hr(t=r.valueOf)&&!Ur(i=Dr(t,r))||e!=="string"&&Hr(t=r.toString)&&!Ur(i=Dr(t,r)))return i;throw new mc("Can't convert object to primitive value")}});var ao=p((zm,oo)=>{"use strict";oo.exports=!0});var co=p((Wm,lo)=>{"use strict";var so=ne(),fc=Object.defineProperty;lo.exports=function(r,e){try{fc(so,r,{value:e,configurable:!0,writable:!0})}catch(t){so[r]=e}return e}});var qt=p((Km,ho)=>{"use strict";var vc=ao(),bc=ne(),yc=co(),uo="__core-js_shared__",po=ho.exports=bc[uo]||yc(uo,{});(po.versions||(po.versions=[])).push({version:"3.38.0",mode:vc?"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 Gr=p((Qm,fo)=>{"use strict";var mo=qt();fo.exports=function(r,e){return mo[r]||(mo[r]=e||{})}});var Xe=p((Xm,vo)=>{"use strict";var gc=Mr(),Cc=Object;vo.exports=function(r){return Cc(gc(r))}});var Ve=p((Ym,bo)=>{"use strict";var Ec=Y(),Tc=Xe(),xc=Ec({}.hasOwnProperty);bo.exports=Object.hasOwn||function(e,t){return xc(Tc(e),t)}});var zr=p((Zm,yo)=>{"use strict";var Ic=Y(),Sc=0,Ac=Math.random(),wc=Ic(1 .toString);yo.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+wc(++Sc+Ac,36)}});var Ye=p((Jm,Co)=>{"use strict";var Rc=ne(),kc=Gr(),go=Ve(),Oc=zr(),Pc=$r(),Vc=jr(),Le=Rc.Symbol,Wr=kc("wks"),Lc=Vc?Le.for||Le:Le&&Le.withoutSetter||Oc;Co.exports=function(r){return go(Wr,r)||(Wr[r]=Pc&&go(Le,r)?Le[r]:Lc("Symbol."+r)),Wr[r]}});var Io=p((ef,xo)=>{"use strict";var Mc=_t(),Eo=Pe(),To=Br(),Fc=ro(),Nc=no(),_c=Ye(),$c=TypeError,jc=_c("toPrimitive");xo.exports=function(r,e){if(!Eo(r)||To(r))return r;var t=Fc(r,jc),i;if(t){if(e===void 0&&(e="default"),i=Mc(t,r,e),!Eo(i)||To(i))return i;throw new $c("Can't convert object to primitive value")}return e===void 0&&(e="number"),Nc(r,e)}});var Kr=p((tf,So)=>{"use strict";var Bc=Io(),qc=Br();So.exports=function(r){var e=Bc(r,"string");return qc(e)?e:e+""}});var Ro=p((rf,wo)=>{"use strict";var Dc=ne(),Ao=Pe(),Qr=Dc.document,Hc=Ao(Qr)&&Ao(Qr.createElement);wo.exports=function(r){return Hc?Qr.createElement(r):{}}});var Xr=p((nf,ko)=>{"use strict";var Uc=ge(),Gc=z(),zc=Ro();ko.exports=!Uc&&!Gc(function(){return Object.defineProperty(zc("div"),"a",{get:function(){return 7}}).a!==7})});var Vo=p(Po=>{"use strict";var Wc=ge(),Kc=_t(),Qc=Or(),Xc=Pr(),Yc=Qe(),Zc=Kr(),Jc=Ve(),eu=Xr(),Oo=Object.getOwnPropertyDescriptor;Po.f=Wc?Oo:function(e,t){if(e=Yc(e),t=Zc(t),eu)try{return Oo(e,t)}catch(i){}if(Jc(e,t))return Xc(!Kc(Qc.f,e,t),e[t])}});var Mo=p((af,Lo)=>{"use strict";var tu=z(),ru=W(),iu=/#|\.prototype\./,Ze=function(r,e){var t=ou[nu(r)];return t===su?!0:t===au?!1:ru(e)?tu(e):!!e},nu=Ze.normalize=function(r){return String(r).replace(iu,".").toLowerCase()},ou=Ze.data={},au=Ze.NATIVE="N",su=Ze.POLYFILL="P";Lo.exports=Ze});var Yr=p((sf,No)=>{"use strict";var Fo=Rr(),lu=qr(),cu=We(),uu=Fo(Fo.bind);No.exports=function(r,e){return lu(r),e===void 0?r:cu?uu(r,e):function(){return r.apply(e,arguments)}}});var $o=p((lf,_o)=>{"use strict";var pu=ge(),hu=z();_o.exports=pu&&hu(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var Bo=p((cf,jo)=>{"use strict";var du=Pe(),mu=String,fu=TypeError;jo.exports=function(r){if(du(r))return r;throw new fu(mu(r)+" is not an object")}});var Ho=p(Do=>{"use strict";var vu=ge(),bu=Xr(),yu=$o(),Dt=Bo(),qo=Kr(),gu=TypeError,Zr=Object.defineProperty,Cu=Object.getOwnPropertyDescriptor,Jr="enumerable",ei="configurable",ti="writable";Do.f=vu?yu?function(e,t,i){if(Dt(e),t=qo(t),Dt(i),typeof e=="function"&&t==="prototype"&&"value"in i&&ti in i&&!i[ti]){var n=Cu(e,t);n&&n[ti]&&(e[t]=i.value,i={configurable:ei in i?i[ei]:n[ei],enumerable:Jr in i?i[Jr]:n[Jr],writable:!1})}return Zr(e,t,i)}:Zr:function(e,t,i){if(Dt(e),t=qo(t),Dt(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 Go=p((pf,Uo)=>{"use strict";var Eu=ge(),Tu=Ho(),xu=Pr();Uo.exports=Eu?function(r,e,t){return Tu.f(r,e,xu(1,t))}:function(r,e,t){return r[e]=t,r}});var et=p((hf,Wo)=>{"use strict";var Je=ne(),Iu=hn(),Su=Rr(),Au=W(),wu=Vo().f,Ru=Mo(),Me=$t(),ku=Yr(),Fe=Go(),zo=Ve();qt();var Ou=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 Iu(r,this,arguments)};return e.prototype=r.prototype,e};Wo.exports=function(r,e){var t=r.target,i=r.global,n=r.stat,o=r.proto,a=i?Je:n?Je[t]:Je[t]&&Je[t].prototype,l=i?Me:Me[t]||Fe(Me,t,{})[t],s=l.prototype,c,d,v,b,g,x,E,m,u;for(b in e)c=Ru(i?b:t+(n?".":"#")+b,r.forced),d=!c&&a&&zo(a,b),x=l[b],d&&(r.dontCallGetSet?(u=wu(a,b),E=u&&u.value):E=a[b]),g=d&&E?E:e[b],!(!c&&!o&&typeof x==typeof g)&&(r.bind&&d?m=ku(g,Je):r.wrap&&d?m=Ou(g):o&&Au(g)?m=Su(g):m=g,(r.sham||g&&g.sham||x&&x.sham)&&Fe(m,"sham",!0),Fe(l,b,m),o&&(v=t+"Prototype",zo(Me,v)||Fe(Me,v,{}),Fe(Me[v],b,g),r.real&&s&&(c||!s[b])&&Fe(s,b,g)))}});var Qo=p((df,Ko)=>{"use strict";var Pu=Math.ceil,Vu=Math.floor;Ko.exports=Math.trunc||function(e){var t=+e;return(t>0?Vu:Pu)(t)}});var tt=p((mf,Xo)=>{"use strict";var Lu=Qo();Xo.exports=function(r){var e=+r;return e!==e||e===0?0:Lu(e)}});var Zo=p((ff,Yo)=>{"use strict";var Mu=tt(),Fu=Math.min;Yo.exports=function(r){var e=Mu(r);return e>0?Fu(e,9007199254740991):0}});var rt=p((vf,Jo)=>{"use strict";var Nu=Zo();Jo.exports=function(r){return Nu(r.length)}});var Ht=p((bf,ea)=>{"use strict";ea.exports=function(){}});var ta=p(()=>{"use strict";var _u=et(),$u=Xe(),ju=rt(),Bu=tt(),qu=Ht();_u({target:"Array",proto:!0},{at:function(e){var t=$u(this),i=ju(t),n=Bu(e),o=n>=0?n:i+n;return o<0||o>=i?void 0:t[o]}});qu("at")});var Ut=p((Cf,ra)=>{"use strict";var Du=jt();ra.exports=Du});var na=p((Ef,ia)=>{"use strict";ta();var Hu=Ut();ia.exports=Hu("Array","at")});var aa=p((Tf,oa)=>{"use strict";var Uu=na();oa.exports=Uu});var ri=p((xf,sa)=>{"use strict";var Gu=aa();sa.exports=Gu});var va=p((hv,fa)=>{"use strict";var np=tt(),op=Math.max,ap=Math.min;fa.exports=function(r,e){var t=np(r);return t<0?op(t+e,0):ap(t,e)}});var ci=p((dv,ya)=>{"use strict";var sp=Qe(),lp=va(),cp=rt(),ba=function(r){return function(e,t,i){var n=sp(e),o=cp(n);if(o===0)return!r&&-1;var a=lp(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}};ya.exports={includes:ba(!0),indexOf:ba(!1)}});var ga=p(()=>{"use strict";var up=et(),pp=ci().includes,hp=z(),dp=Ht(),mp=hp(function(){return!Array(1).includes()});up({target:"Array",proto:!0,forced:mp},{includes:function(e){return pp(this,e,arguments.length>1?arguments[1]:void 0)}});dp("includes")});var Ea=p((vv,Ca)=>{"use strict";ga();var fp=Ut();Ca.exports=fp("Array","includes")});var xa=p((bv,Ta)=>{"use strict";var vp=Ea();Ta.exports=vp});var ut=p((yv,Ia)=>{"use strict";var bp=xa();Ia.exports=bp});var Va=p((kv,Pa)=>{"use strict";var gp=Gr(),Cp=zr(),Oa=gp("keys");Pa.exports=function(r){return Oa[r]||(Oa[r]=Cp(r))}});var Ma=p((Ov,La)=>{"use strict";var Ep=z();La.exports=!Ep(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var _a=p((Pv,Na)=>{"use strict";var Tp=Ve(),xp=W(),Ip=Xe(),Sp=Va(),Ap=Ma(),Fa=Sp("IE_PROTO"),hi=Object,wp=hi.prototype;Na.exports=Ap?hi.getPrototypeOf:function(r){var e=Ip(r);if(Tp(e,Fa))return e[Fa];var t=e.constructor;return xp(t)&&e instanceof t?t.prototype:e instanceof hi?wp:null}});var ja=p((Vv,$a)=>{"use strict";$a.exports={}});var Da=p((Lv,qa)=>{"use strict";var Rp=Y(),di=Ve(),kp=Qe(),Op=ci().indexOf,Pp=ja(),Ba=Rp([].push);qa.exports=function(r,e){var t=kp(r),i=0,n=[],o;for(o in t)!di(Pp,o)&&di(t,o)&&Ba(n,o);for(;e.length>i;)di(t,o=e[i++])&&(~Op(n,o)||Ba(n,o));return n}});var Ua=p((Mv,Ha)=>{"use strict";Ha.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var za=p((Fv,Ga)=>{"use strict";var Vp=Da(),Lp=Ua();Ga.exports=Object.keys||function(e){return Vp(e,Lp)}});var Za=p((Nv,Ya)=>{"use strict";var Ka=ge(),Mp=z(),Qa=Y(),Fp=_a(),Np=za(),_p=Qe(),$p=Or().f,Xa=Qa($p),jp=Qa([].push),Bp=Ka&&Mp(function(){var r=Object.create(null);return r[2]=2,!Xa(r,2)}),Wa=function(r){return function(e){for(var t=_p(e),i=Np(t),n=Bp&&Fp(t)===null,o=i.length,a=0,l=[],s;o>a;)s=i[a++],(!Ka||(n?s in t:Xa(t,s)))&&jp(l,r?[s,t[s]]:t[s]);return l}};Ya.exports={entries:Wa(!0),values:Wa(!1)}});var Ja=p(()=>{"use strict";var qp=et(),Dp=Za().values;qp({target:"Object",stat:!0},{values:function(e){return Dp(e)}})});var ts=p((jv,es)=>{"use strict";Ja();var Hp=$t();es.exports=Hp.Object.values});var is=p((Bv,rs)=>{"use strict";var Up=ts();rs.exports=Up});var tr=p((qv,ns)=>{"use strict";var Gp=is();ns.exports=Gp});var yi=p((hb,ds)=>{"use strict";var Wp=Ke();ds.exports=Array.isArray||function(e){return Wp(e)==="Array"}});var fs=p((db,ms)=>{"use strict";var Kp=TypeError,Qp=9007199254740991;ms.exports=function(r){if(r>Qp)throw Kp("Maximum allowed index exceeded");return r}});var ys=p((mb,bs)=>{"use strict";var Xp=yi(),Yp=rt(),Zp=fs(),Jp=Yr(),vs=function(r,e,t,i,n,o,a,l){for(var s=n,c=0,d=a?Jp(a,l):!1,v,b;c<i;)c in t&&(v=d?d(t[c],c,e):t[c],o>0&&Xp(v)?(b=Yp(v),s=vs(r,e,v,b,s,o-1)-1):(Zp(s+1),r[s]=v),s++),c++;return s};bs.exports=vs});var Es=p((fb,Cs)=>{"use strict";var eh=Ye(),th=eh("toStringTag"),gs={};gs[th]="z";Cs.exports=String(gs)==="[object z]"});var xs=p((vb,Ts)=>{"use strict";var rh=Es(),ih=W(),ir=Ke(),nh=Ye(),oh=nh("toStringTag"),ah=Object,sh=ir(function(){return arguments}())==="Arguments",lh=function(r,e){try{return r[e]}catch(t){}};Ts.exports=rh?ir:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=lh(e=ah(r),oh))=="string"?t:sh?ir(e):(i=ir(e))==="Object"&&ih(e.callee)?"Arguments":i}});var Ss=p((bb,Is)=>{"use strict";var ch=Y(),uh=W(),gi=qt(),ph=ch(Function.toString);uh(gi.inspectSource)||(gi.inspectSource=function(r){return ph(r)});Is.exports=gi.inspectSource});var Ps=p((yb,Os)=>{"use strict";var hh=Y(),dh=z(),As=W(),mh=xs(),fh=jt(),vh=Ss(),ws=function(){},Rs=fh("Reflect","construct"),Ci=/^\s*(?:class|function)\b/,bh=hh(Ci.exec),yh=!Ci.test(ws),mt=function(e){if(!As(e))return!1;try{return Rs(ws,[],e),!0}catch(t){return!1}},ks=function(e){if(!As(e))return!1;switch(mh(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return yh||!!bh(Ci,vh(e))}catch(t){return!0}};ks.sham=!0;Os.exports=!Rs||dh(function(){var r;return mt(mt.call)||!mt(Object)||!mt(function(){r=!0})||r})?ks:mt});var Fs=p((gb,Ms)=>{"use strict";var Vs=yi(),gh=Ps(),Ch=Pe(),Eh=Ye(),Th=Eh("species"),Ls=Array;Ms.exports=function(r){var e;return Vs(r)&&(e=r.constructor,gh(e)&&(e===Ls||Vs(e.prototype))?e=void 0:Ch(e)&&(e=e[Th],e===null&&(e=void 0))),e===void 0?Ls:e}});var _s=p((Cb,Ns)=>{"use strict";var xh=Fs();Ns.exports=function(r,e){return new(xh(r))(e===0?0:e)}});var $s=p(()=>{"use strict";var Ih=et(),Sh=ys(),Ah=Xe(),wh=rt(),Rh=tt(),kh=_s();Ih({target:"Array",proto:!0},{flat:function(){var e=arguments.length?arguments[0]:void 0,t=Ah(this),i=wh(t),n=kh(t,0);return n.length=Sh(n,t,t,i,0,e===void 0?1:Rh(e)),n}})});var js=p(()=>{"use strict";var Oh=Ht();Oh("flat")});var qs=p((Sb,Bs)=>{"use strict";$s();js();var Ph=Ut();Bs.exports=Ph("Array","flat")});var Hs=p((Ab,Ds)=>{"use strict";var Vh=qs();Ds.exports=Vh});var Gs=p((wb,Us)=>{"use strict";var Lh=Hs();Us.exports=Lh});var Hh={};Il(Hh,{ContainerTypes:()=>T.ContainerTypes,ControlTypes:()=>T.ControlTypes,CustomError:()=>B,EVENT_NAMES:()=>V,EventActionTypes:()=>T.EventActionTypes,EventTypes:()=>T.EventTypes,Interactives:()=>vt,ManifestController:()=>Te,SDKInfo:()=>Dh,chapterIdsToVKVideoIds:()=>or,compareVersions:()=>Yt,containerTypes:()=>Qu,controlTypes:()=>Xu,eventActionTypes:()=>ni,eventTypes:()=>Yu,getChapterIdByVkVideoId:()=>cl,getVKVideoIdByMedia:()=>xi,getVideoRawIdByMedia:()=>sl,graphEventTypes:()=>$e,hasEndTemplate:()=>pt,interactivesEventTypes:()=>_,isAreaControl:()=>Ku,isButtonControl:()=>Wu,isLastChapter:()=>J,isOneTextCtrlContainer:()=>Ee,isSupportedManifest:()=>T.isSupportedManifest,isTextControl:()=>at,isVKVariantItem:()=>ll,isValidManifest:()=>ii,migrateManifestToLatestVersion:()=>T.migrateManifestToLatestVersion,utils:()=>vl,vkVideoIdsToChapterIds:()=>Ii});module.exports=Sl(Hh);var Bi="1.0.39-dev.6edf3cda.0";var Mt=require("@vkontakte/videoplayer-shared/es2015");var pr=class{constructor(e){this.layout=e}},gt=class extends pr{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 qi(r){return"features"in r}var Re=class{constructor(e,t){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]}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 be=require("@vkontakte/videoplayer-shared/es2015");var pe=(r,e)=>Object.prototype.toString.call(r)===`[object ${e}]`,he=r=>pe(r,"Object"),Ct=r=>pe(r,"String"),Et=r=>pe(r,"Array"),Tt=r=>pe(r,"Number"),Di=r=>pe(r,"Function"),Hi=r=>pe(r,"Boolean"),hr=r=>Tt(r)&&!isNaN(r);var fe=r=>he(r)&&Object.keys(r).length===0,dr=r=>Et(r)&&!r.length;var He=(r,e)=>Ct(r)&&(e?r.trim():r).length;function Ue(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 Ui="interactive",N={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},Gi=(i=>(i.top="flex-start",i.bottom="flex-end",i.center="center",i))(Gi||{}),zi=(i=>(i.start="flex-start",i.end="flex-end",i.center="center",i))(zi||{}),Wi=(i=>(i.start="left",i.end="right",i.center="center",i))(Wi||{}),xt=({target:r,props:e})=>{var t,i,n;r.style.alignItems=(t=(e==null?void 0:e.gravityVertical)&&Gi[e.gravityVertical])!=null?t:"center",r.style.justifyContent=(i=(e==null?void 0:e.gravityHorizontal)&&zi[e.gravityHorizontal])!=null?i:"center",r.style.textAlign=(n=(e==null?void 0:e.alignment)&&Wi[e.alignment])!=null?n:"center"},It=({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},St=({target:r,props:e,fallback:t})=>{var i,n,o,a;r.style.backgroundColor=Ue((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)},Ge=({target:r,props:e,fallback:t,dependsOn:i,useRawValues:n=!1})=>{var l,s,c,d,v,b,g,x,E,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=Ue(n?t.borderColor:(x=(g=(b=e==null?void 0:e.shape)==null?void 0:b.border)==null?void 0:g.color)!=null?x:t.borderColor,n?t.borderAlpha:(u=(m=(E=e==null?void 0:e.shape)==null?void 0:E.border)==null?void 0:m.alpha)!=null?u:t.borderAlpha),r.style.borderRadius=a},Ki=({target:r,isDark:e,baseDimension:t,fallback:i})=>{let a=Ue(i.shadowColorLight,i.shadowColorAlpha),l=Ue(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 ie=require("@vkontakte/videoplayer-shared/es2015");var mr="interactive-control-tap",Oe={common:mr,animation:`${mr}-animation`,visible:`${mr}-visible`};var Al=60,At=class{constructor({controlRotateAngleRad:e,clickCancelCondition:t,circleDiameterPx:i=Al,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=wl(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(Oe.visible,Oe.animation)};this.onAnimationEnd=e=>{!e.target||!e.currentTarget||e.target===e.currentTarget&&this.element.classList.remove(Oe.visible,Oe.animation)};let o=document.createElement("div");o.classList.add(Oe.common),this.controlRotateAngleRad=e,this.element=o,this.clickCancelCondition=t,this.circleDiameterPx=i,this.useDimensionsBasedSize=n}};function wl(r,e,t){return{x:r*Math.cos(t)-e*Math.sin(t),y:r*Math.sin(t)+e*Math.cos(t)}}var fr="int",ve=(i=>(i.AREA=`${fr}_area`,i.TEXT=`${fr}_text`,i.BUTTON=`${fr}_bttn`,i))(ve||{});function vr(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`},Qi=40;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," ")}`}};var de=class{constructor(e,t){this.control=e;this.options=t;this.container=null;this.controlElement=null;this.subscriptions=new ie.Subscription;this.error$=new ie.Subject;this.isInteracted$=new ie.ValueSubject(!1)}onError(e="",t){let i=new B(1,1,{message:e,error:t,details:{id:this.control.id}});this.error$.next(i)}addControlTap(e){var t;if(this.featureIsEnabled("controlsTapPlace")&&this.container){let i=(t=this.control.layoutParams.angle)!=null?t:N.angle;this.controlTap=new At({controlRotateAngleRad:i,clickCancelCondition:this.container.isManifestContainerDisabled,circleDiameterPx:this.isTouch()?Qi:void 0}),this.subscriptions.add((0,ie.fromEvent)(e,"click").subscribe(this.controlTap.onElementClick,n=>this.onError("Control click tap animation error",n))).add((0,ie.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:N.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$.next(!0),e()}}featureIsEnabled(e){return this.options&&vr(this.options)&&this.options.features[e]}isTouch(){return this.options&&vr(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,ie.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 gr="interactive-blink-anim-reference",D={common:gr,animation:`${gr}-animation`,disabled:`${gr}-disabled`},wt=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 Cr="interactive-container",H={common:Cr,hidden:`${Cr}-hidden`,disabled:`${Cr}-disabled`};var Rt=(r,e)=>{if(r.type.trim().toLowerCase()==="area")return new Er(r,e)},Er=class extends de{constructor(e,t){super(e,t)}createView({parentElement:e,callbacks:t}){if(super.createContainerElement(t),!this.container)return;let i=document.createElement("button");i.type="button",i.classList.add(L.common,L.area),i.setAttribute("data-testid",ve.AREA),St({target:i,props:this.control.props,fallback:A(f({},N),{backgroundColor:"transparent"})}),ke({target:i,layoutParams:this.control.layoutParams,fallback:N}),this.addControlTap(i),this.container.element.append(i),e.append(this.container.element),this.controlElement=i,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,be.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,be.fromEvent)(this.controlElement,"mouseenter").subscribe(()=>{e.classList.contains(H.disabled)||this.onBlinkHovering()},i=>this.onError("Error happened in mouseenter callback",i))).add((0,be.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(Hi(e)){let o=Math.min(this.controlElement.offsetWidth,this.controlElement.offsetHeight)+"px";Ki({target:this.controlElement,props:this.control.props,fallback:N,isDark:e,baseDimension:o}),Ge({target:this.controlElement,props:this.control.props,fallback:A(f({},N),{borderColor:e?N.shadowColorDark:N.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:N.roundCorners})`}),dependsOn:this.container.dimensions,useRawValues:!0})}else Ge({target:this.controlElement,props:this.control.props,fallback:A(f({},N),{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,be.fromEvent)(e,"animationiteration").pipe((0,be.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 ye=require("@vkontakte/videoplayer-shared/es2015");var kt=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 Ot=Math.PI,Tr=2*Ot,Pt=Ot/2,Xi=3*Pt,Rl=0,kl=[Rl,Pt,Ot,Xi];function Yi(r){return r===Pt}function Zi(r){return r===Ot}function Ji(r){return r===Xi}function en(r){return(r%Tr+Tr)%Tr}function Ol(r){for(let e of kl)if(r===e)return e}function tn(r){if(Ol(r))return null;let t=Math.floor(r/Pt)+1;return[1,2,3,4][t-1]}function rn(r){return r*180/Math.PI}var se="interactive-control-fill-animation",U={common:se,fillerWrapper:`${se}-filler-wrapper`,filler:`${se}-filler`,fillHeight:`${se}-fill-height`,fillWidth:`${se}-fill-width`,fromTop:`${se}-from-top`,fromBottom:`${se}-from-bottom`,fromLeft:`${se}-from-left`,fromRight:`${se}-from-right`};var Vt=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=en(e.rotateAngle),a=tn(o),l=a!==null,c=a===2||!l&&Zi(o)||a===3,d=!l&&Yi(o),v=!l&&Ji(o),b=!c&&!d&&!v,g=d||v,x=l&&!g,E=x?o:0;t.style.borderRadius=e.borderRadius,i.style.transform=`skew(${E*-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:rn(o),rotateAngleRaw:e.rotateAngle,fromRight:c,fromTop:d,fromBottom:v,fromLeft:b}),this.useSkew=x,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 Lt=(r,e)=>{if(r.type.trim().toLowerCase()==="button")return new xr(r,e)},xr=class extends de{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;let i=document.createElement("button");i.type="button",i.classList.add(L.common,L.button),i.setAttribute("data-testid",ve.BUTTON),ke({target:i,layoutParams:this.control.layoutParams,fallback:N}),St({target:i,props:this.control.props,fallback:N}),Ge({target:i,props:this.control.props,fallback:N,dependsOn:this.container.dimensions}),xt({target:i,props:A(f({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let n=kt(this.control.type.trim().toLowerCase()),o=(a=n.firstElementChild)!=null?a:n;It({target:o,props:this.control.props,fallback:N,dependsOn:this.container.dimensions}),this.addControlTap(i),this.startTime!==void 0&&this.endTime!==void 0&&this.featureIsEnabled("controlsFillAnimation")&&(this.controlFillAnimation=new Vt({startTime:this.startTime,endTime:this.endTime,rotateAngle:(l=this.control.layoutParams.angle)!=null?l:N.angle,borderRadius:i.style.borderRadius})),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.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,ye.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,ye.fromEvent)(this.controlElement,"mouseenter").subscribe(()=>{e.classList.contains(H.disabled)||this.onBlinkHovering()},i=>this.onError("Error happened in mouseenter callback",i))).add((0,ye.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,ye.fromEvent)(e,"animationiteration").pipe((0,ye.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 nn=(r,e)=>{if(r.type.trim().toLowerCase()==="text")return new Ir(r,e)},Ir=class extends de{constructor(e,t){super(e,t)}createView({parentElement:e,callbacks:t}){var a;if(super.createContainerElement(t),!this.container)return;let i=document.createElement("div");i.classList.add(L.common,L.text),i.setAttribute("data-testid",ve.TEXT),ke({target:i,layoutParams:this.control.layoutParams,fallback:N}),xt({target:i,props:A(f({},this.control.props.text),{alignment:this.control.layoutParams.alignment})});let n=kt(this.control.type.trim().toLowerCase()),o=(a=n.firstElementChild)!=null?a:n;It({target:o,props:this.control.props,fallback:N,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(){}onError(){}};var Ft=(r,e,t)=>{if(r.type.trim().toLowerCase()==="choice")return new Sr(r,e,t)},Sr=class extends Re{constructor(t,i,n){super(t,n);this.containerElement=null;this.controlSubscriptions=new Mt.Subscription;this.error$=new Mt.Subject;this.rootElement=i,this.layout=new gt(this.container.layout),this.isRemoved=!1,this.isDisabled=!1,this.addControlFactory("button",Lt),this.addControlFactory("text",nn),this.addControlFactory("area",Rt)}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.controlSubscriptions.add(o.error$.subscribe(this.error$))}),this.rootElement.append(n),this.isRemoved=!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(){let t=this.getElement();t&&(this.controlSubscriptions.unsubscribe(),this.controls.forEach(i=>i.removeListeners()),t.remove(),this.isRemoved=!0,this.containerElement=null)}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 ml=X(ri(),1),w=require("@vkontakte/videoplayer-shared/es2015"),qe=require("@vkontakte/videoplayer-statistics/es2015");var pa=require("@vkontakte/videoplayer-shared/es2015");function it(r,e){let t;return(...i)=>{clearTimeout(t),t=setTimeout(()=>r(...i),e)}}var la="video_interactive",ca="videoint";var ua=250,nt=class{constructor(e){this.handleZoomChange=it(e=>{this.lastZoomInfo=e},ua);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,!Tt(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=zu(e),this.resizeObserver=new ResizeObserver(it(this.onResize,ua)),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 i;if(!this.manifest)return;let e;try{e=yield(0,pa.loadVKLangPack)(this.lang,la,ca)}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=te(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 zu(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 ot=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 T=require("@interactiveplatform/movika-manifest");var ha={metadata:"Object",chapters:"Array"},ii=r=>{if(!he(r))return!1;for(let e in ha)if(!r[e]||!pe(r[e],ha[e]))return!1;return(0,T.isSupportedManifest)(r.metadata.version)},at=r=>r.type===T.ControlTypes.Text,Wu=r=>r.type===T.ControlTypes.Button,Ku=r=>r.type===T.ControlTypes.Area,Qu={Choice:"Choice",TextInput:"TextInput"},Xu={Button:"Button",Area:"Area",Text:"Text"},Yu={onClick:"onClick",onSuspense:"onSuspense"},ni={openURI:"openURI",setNextBranch:"setNextBranch",setWeightlessRandomBranch:"setWeightlessRandomBranch",setRandomBranch:"setRandomBranch",setMaxWeightBranch:"setMaxWeightBranch",setMinWeightBranch:"setMinWeightBranch",setDefaultBranch:"setDefaultBranch",continuePlayback:"continuePlayback",expect:"expect"};var Gt=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 zt=class{constructor(e){this.fns=[];this.addFn=(e,t=!1)=>{Di(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 ka=require("@vkontakte/videoplayer-shared/es2015");var Wt=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 O(this,null,function*(){return Zu(...this.loaders[e])(t)})}};function Zu(...r){return function(t){return O(this,null,function*(){let i=[...r];for(;i.length>0;)t=yield i.shift()(t);return t})}}function st(r,e,t){return r?A(f({},r),{[e]:r[e]?[t,...r[e]]:[t]}):{[e]:[t]}}function Kt(n){var o=n,{actions:r,errors:e,chapterId:t}=o,i=te(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?A(f({},i),{actions:r,errors:e,result:{chapter:l,media:s,graph:c}}):A(f({},i),{errors:st(e,Kt.name,"Could not find media"),actions:r})}}}return A(f({},i),{errors:st(e,Kt.name,"Could not find chapter"),actions:r})}var Qt=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 Qt{constructor(){super(),this.listeners||Qt.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)}},lt=class{constructor(){Object.defineProperty(this,"signal",{value:new Ne,writable:!0,configurable:!0})}abort(e){let t;try{t=new Event("abort")}catch(n){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 i=e;if(i===void 0)if(typeof document=="undefined")i=new Error("This operation was aborted"),i.name="AbortError";else try{i=new DOMException("signal is aborted without reason")}catch(n){i=new Error("This operation was aborted"),i.name="AbortError"}this.signal.reason=i,this.signal.dispatchEvent(t)}toString(){return"[object AbortController]"}};typeof Symbol!="undefined"&&Symbol.toStringTag&&(lt.prototype[Symbol.toStringTag]="AbortController",Ne.prototype[Symbol.toStringTag]="AbortSignal");function Xt(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 oi(r){typeof r=="function"&&(r={fetch:r});let{fetch:e,Request:t=e.Request,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:n=!1}=r;if(!Xt({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,x)=>{d.addEventListener("abort",()=>x(v),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([b,a(s,c)])}return a(s,c)},Request:o}}var Ju=()=>"fetch"in window,ct=Ju()&&Xt({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),da=ct?oi({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,ai=ct?da.fetch:window.fetch,tv=ct?da.Request:window.Request,rv=ct?lt:window.AbortController,iv=ct?Ne:window.AbortSignal;var Yt=(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 ep=r=>O(void 0,null,function*(){try{let e={},t;if(Ct(r)){t=new URL(r).href;let n=yield ai(t);if(!n.ok)return{};e=yield n.json()}else if(he(r))e=r;else return{};if(!ii(e))return{};let i=e.metadata.media;if(Ct(i)&&!("media"in e))try{let n;t?n=new URL(i,t).href:(n=new URL(i).href,t=n);let o=yield ai(n);if(!o.ok)throw new Error;e.metadata.media=yield o.json()}catch(n){return ip(e.metadata.version)?{manifest:e}:{}}return{manifest:e,manifestURL:t}}catch(e){return{}}});function ma(r){return O(this,null,function*(){let{manifest:e,manifestURL:t}=yield ep(r);if(!e)throw new Error("Failed on fetch");let i=(0,T.migrateManifestToLatestVersion)(e);return i.media=tp(i.media,t),delete i.metadata.media,i})}function Zt(r,e){if(e)return r.find(t=>t.id===e)}function si(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 li(r,e){return r.videos.find(t=>t.id===e)}function tp(r,e){return A(f({},r),{videos:r.videos.map(t=>A(f({},t),{variants:t.variants.map(i=>{let n="url"in i?i.url:"",o=rp(n,e);return A(f({},i),{url:o||n})})}))})}function rp(r="",e){try{return new URL(r,e).href}catch(t){return""}}function ip(r){return Yt(r,"3.2.0")>=0}var Sa=X(ut(),1);var Jt=r=>Et(r)&&!dr(r),J=r=>r.order==="end",pt=r=>Et(r.containers)&&!dr(r.containers)&&J(r),Aa=(r,e)=>{var i;let t=r*1e3;return Jt(e.controls)&&t<((i=e.startTime)!=null?i:0)},ui=(r,e)=>{var i,n;let t=r*1e3;return Jt(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"),pi=(r=[])=>r.find(e=>e.action.type==="expect"),yp=r=>(r==null?void 0:r.length)===1,Ee=r=>yp(r)&&at(r[0]);function wa(r=[],e=1/0,t=[]){return r.filter(({container:i})=>!(0,Sa.default)(t,i.container.id)&&Ce(i.container.events)&&i.container.endTime===e&&!i.isRemoved)}function er({gameControllers:r=[],subjectName:e,subjectId:t,execFn:i}){for(let n of r)if(e==="container"&&n.container.container.id===t){i(n),wa(r,n.container.container.endTime,[n.container.container.id]).forEach(a=>{i(a)});break}}var Ra=(r,e)=>{let t=E=>{let m=e.find(({container:u})=>u.container.id===E);return m==null?void 0:m.container.isRemoved},i=Ce(r.events)&&!t(r.id),n=(E,m=!1,u=!1)=>{let h=u?"every":"some";return E.controls[h](y=>{var R;let I=m?E.endTime===r.endTime:!0;return((R=y.events)==null?void 0:R[h](C=>{var S;return((S=C.action)==null?void 0:S.type)===ni.openURI}))&&I})},o=E=>E.some(({container:m})=>n(m.container,!0,!1)&&!m.isRemoved),a=E=>E.every(({container:m})=>m.isRemoved?!0:n(m.container,!0,!0)),l=wa(e,r.endTime,[r.id]).length,s=E=>E.controls.some(m=>{var u;return(u=m.events)==null?void 0:u.some(h=>{var y,I;return(I=(y=h.action)==null?void 0:y.args)==null?void 0:I.shouldOpenNow})}),c=i||l>0,d=o(e),v=n(r),b=a(e),g=i?!1:l>0,x=s(r);return{isExpectTime:c,hasOtherExpect:l>0,hasOpenURIEvent:d,hasOpenURIEventInCurrentContainer:v,isAllOpenURIEventsValid:b,isExpectEventForCurrentContainer:g,hasShouldOpenNowEvent:x}};var Te=class extends Wt{constructor(t,i){super(t);this.manifest=null;this.chapter=null;this.media=null;this.graph=null;this.prevChapter$=new ka.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 O(this,null,function*(){var n;this.release();let i=yield this.exec("manifestLoaders",{actions:{addErrorMessage:st},result:null,errors:null,source:t});return i.errors&&this.errorHandler(i.errors),this.manifest=yield ma((n=i.result)!=null?n:t),this})}setInitial(){return O(this,null,function*(){return this.setNext()})}setNext(){return O(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",Kt({actions:{getManifest:()=>this.manifest,getCurrent:this.getCurrent,getGraph:si,getChapter:Zt,getMedia:li,getByBranches:this.getByBranches.bind(this),addErrorMessage:st},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=Zt(this.manifest.chapters,t);if(n){let o=li(this.manifest.media,n.videoId),a=si(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=Zt(((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?J(this.chapter):!1}};var ss=X(tr(),1),ls=require("@vkontakte/videoplayer-core/es2015"),me=require("@vkontakte/videoplayer-shared/es2015");var os=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 as=X(tr(),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=te(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,as.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=X(ut(),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=A(f({},t.MPEG),{[(o=s.standard)!=null?o:"Invariant quality"]:s.url}));break;case"mpeg":(n||(0,_e.default)(e,"mpeg"))&&(t.MPEG=A(f({},t.MPEG),{[(a=s.standard)!=null?a:"Invariant quality"]:s.url}));break;case"hls":(n||(0,_e.default)(e,"hls"))&&(t=A(f({},t),{HLS:{type:"url",url:s.url}}));break;case"dash":(n||(0,_e.default)(e,"dash"))&&(t=A(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 zp=2;function vi(r){let e=mi(),t=new me.Subscription,i={},n=null,o=!1,a,l=new me.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 I=((R=e.map.get(m))!=null?R:{})[u];if(I){i=f({chapterId:h,listId:m,itemId:u},I);let C=i.player;i.subscription.add(C.info.currentQuality$.subscribe(S=>{let q=C.info.position$.getValue(),P=C.info.isAutoQualityEnabled$.getValue();if(!(!S||!q||P))for(let F of e.map)(0,ss.default)(F[1]).forEach(({player:M})=>{ht(M,S)})})).add(C.events.started$.subscribe(()=>{d(u)})),I.container.remove(),n.setPlayer(I.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 O(this,null,function*(){if(!n)throw Error("need to set interactive controller");if(fe(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 O(this,arguments,function*({chapter:{id:m},manifestVideo:u}){if(fe(i)||!n)return;let y=i.player.info.muted$.getValue(),I=i.player.info.currentQuality$.getValue(),R=i.player.info.isAutoQualityEnabled$.getValue(),C=i.player.info.volume$.getValue(),S=i.player.info.currentPlaybackRate$.getValue(),q=!R,P=!1;for(let F of e.map)if(F[0]===u.id&&!n.state.isReplay$.getValue()){let M=Object.keys(F[1]);for(let j of M)j===i.itemId?(M.length<zp||(P=!0),e.removePlayer(F[0],j)):(P=!0,c(F[0],j,m),q?ht(i.player,I):i.player.setAutoQuality(!0),i.player.setVolume(C),i.player.setMuted(y),i.player.setPlaybackRate(S))}else e.removePlayer(F[0]);P||(yield b({media:u,chapterId:m,setAsActive:!0,playbackRate:S}),q?ht(i.player,I):i.player.setAutoQuality(!0),i.player.setVolume(C),i.player.setMuted(y))})}function b(q){return O(this,arguments,function*({media:m,chapterId:u,prefetch:h=!0,setAsActive:y=!0,autoplay:I=!1,preferredExt:R,title:C,playbackRate:S}){var Ri,ki,Oi,Pi,Vi;let P=Math.random().toString(),F=document.createElement("div");a.append(F);let M;if((Ri=n==null?void 0:n.options)!=null&&Ri.vkVideoLoader){let bt=os(m);bt.length&&(M=yield n.options.vkVideoLoader(...bt))}let j=((ki=n==null?void 0:n.options)==null?void 0:ki.coreConfig)||void 0,Ae=A(f({},j),{configName:[...(Oi=j==null?void 0:j.configName)!=null?Oi:[],"interactive"]}),ae=A(f({container:F},((Pi=M==null?void 0:M.videos)==null?void 0:Pi[0])||{sources:fi(m,R).sources}),{title:C,failoverHosts:(M==null?void 0:M.failoverHosts)||[]}),ee=new ls.Player(Ae,me.Tracer.createRootTracer());ee.initVideo(ae);let Ai=null;if(M!=null&&M.videos&&(n!=null&&n.options.createOneStat)){let bt=M.videos[0],cr=n.options.createOneStat(bt),Li=new me.Subscription;cr&&(Li.add(cr.attachTo(ee)),Ai={oneStat:cr,statSubscription:Li})}let wi=new me.Subscription,bl=(Vi=i==null?void 0:i.player)==null?void 0:Vi.info.isAutoQualityEnabled$.getValue();wi.add(ee.events.canplay$.subscribe(function(){bl||ht(ee,i.player.info.currentQuality$.getValue()),S&&ee.setPlaybackRate(S)}));let we=e.createPlayer({listId:m.id,itemId:P,player:ee,container:F,sources:fi(m,R).sources,config:ae,subscription:wi,statistics:Ai});return y&&c(m.id,we.itemId,u),I&&we.player.play(),h&&!I&&we.player.prepare(),{player:we.player,config:we.config,statistics:we.statistics}})}function g(){x(),n=null,a.remove()}function x(){t.unsubscribe(),e.removeAll(),i={},o=!1}function E(){return O(this,null,function*(){if(!n)throw Error("need to set interactive controller");x(),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 A(f({},e),{init:E,setInteractiveController:s,createPlayer:b,removeAll:g,getActivePlayer:function(){return i},activePlayerChanged:l})}var V={graph:"graph",interactives:"interactives",chapterChanged:"chapter-changed",playerChanged:"player-changed",manifestChanged:"manifest-changed",errors:"errors",eachTick:"eachTick",historyInited:"history-inited",historyDestroyed:"history-destroyed"},$e={visibility:"visibility",watchAgainClicked:"watchAgainClicked"},_={actionChoiceCanceled:"action-choice-canceled",actionChoice:"action-choice",actionExecution:"action-execution",visibility:"visibility",containerRemoved:"container-removed",rangeEnded:"range-ended"};var us=X(ut(),1),ps=require("@vkontakte/videoplayer-shared/es2015");function bi(r){return function(...t){return r(...t.reverse())}}function dt(r,...e){return(...t)=>he(e[0])&&he(t[0])?r(f(f({},e[0]),t[0])):r(...e,...t)}var rr=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:x=!1}){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:x,hasOpenURIEvent:E,hasOpenURIEventInCurrentContainer:m,isAllOpenURIEventsValid:u,hasShouldOpenNowEvent:h}=this.getContainerEventState(),y=this.interactiveTimeOpenUri&&!m,I=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=!x&&!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&&E&&this.gameState!==5){if(I){let C=((S,q,P,F)=>!S&&!q&&P||S&&!q&&P&&!F||S&&!q&&P&&F)(g,x,u,this.isSelectedContainerEvent);this.fakeRemoveView(C)}else this.removeView(),this.emitContainerVisibilityEvent(!1);(!g||!x||!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 c,d,v;let e=this.player.experimental.element$.getValue(),i=e instanceof HTMLVideoElement?e.readyState:void 0,n=[6,5];if(!i||(0,us.default)(n,this.gameState)&&!this.isPermanentText)return;let o=this.player.getExactTime();if(Aa(o,this.container.container))this.gameState!==1&&(this.gameState=1,this.onBeforeStartTime());else if(ui(o,this.container.container))this.gameState!==2&&(this.gameState=2,this.onStartTime());else if(this.gameState!==3){let b=this.gameState;this.gameState=3,b===2&&this.onEndTime()}else{let{hasOpenURIEventInCurrentContainer:b}=this.getContainerEventState(),g=this.selectBranches.state.isExpect,x=this.interactiveTimeOpenUri&&b;if(x&&!g){let E=this.container.getElement();E&&(E.style.visibility!=="hidden"&&((d=(c=this.container).hide)==null||d.call(c)),this.container.isRemoved||this.fakeRemoveView())}!this.isPermanentText&&!x&&this.removeView()}let a=ui(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(V.eachTick,s),this.globalEvents.eachTick$.next(s)};this.container=t,this.branches=i,this.selectBranches=n,this.subscription=new ps.Subscription,this.player=e,this.interactiveEvents=o,this.getContainerEventState=s;let E=Ee(t.container.controls);this.isPermanentText=c&&E,this.disableTextControlContainerVisibilityEvents=x&&E,this.interactiveTimeOpenUri=d,this.disabledControls$=v,this.onRemove=b,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(V.interactives,{subjectId:this.container.container.id,subjectName:"container",type:_.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(V.interactives,{subjectId:this.container.container.id,subjectName:"container",type:_.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(){var e;this.container.removeView(),this.globalEventEmitter.emit(V.interactives,{subjectId:this.container.container.id,subjectName:"container",type:_.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 hs=(r=[])=>r.reduce((e,t,i)=>{var o,a,l;let n=((o=t==null?void 0:t.controls)!=null?o:[]).filter(s=>!at(s));if(Jt(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=[],x=[];for(let E=0;E<e.length;E++){let m=e[E];if(x.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[E].subjects.push(c),e;s[0]<m.range[0]&&s[1]>m.range[0]&&(d.push(E),g=g.concat(m.subjects)),s[0]>=m.range[0]&&s[0]<=m.range[1]&&(d.push(E),g=g.concat(m.subjects),s[0]=m.range[0]),s[1]>=m.range[0]&&s[1]<=m.range[1]&&(d.push(E),g=g.concat(m.subjects),s[1]=m.range[1])}if(x.push(c),s[0]<=b&&s[1]>=v)return[{subjects:x,range:s}];d.length&&d.reverse().forEach(E=>{e.splice(E,1)}),e.push({subjects:g.concat([c]),range:s})}}return e},[]).sort((e,t)=>e.range[0]-t.range[0]);var Ws=X(ut(),1),Ei=X(tr(),1),Ks=X(Gs(),1);function zs(){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(hr(l)){let v=(d=r[l])!=null?d:null;if(v&&s&&He(s,!0)){let b={},g=v[s];if(g&&(b=f(f({},b),g)),b=fe(b)?null:b,b&&He(c,!0)){let x=b[c];return x!=null?x:null}return b}return v}return null}function o({timestamp:l,priority:s,initiator:c}){if(hr(l))if(r[l]){if(s&&He(s,!0))if(r[l][s]){if(c&&He(c,!0))if(r[l][s][c]){if(delete r[l][s][c],!fe(r[l][s]))return!0}else return!1;if(delete r[l][s],!fe(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=te(b,["timestamp","priority","initiator"]);var g,x,E;(x=(g=r[l])==null?void 0:g[s])!=null&&x[c]?r[l][s][c].push(f({},d)):(E=r[l])!=null&&E[s]?r[l][s]=A(f({},r[l][s]),{[c]:[f({},d)]}):r[l]?r[l]=A(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 Mh=[T.EventActionTypes.expect,T.EventActionTypes.setNextBranch],Fh=1/0;function Qs(r,e){let t=r,i,n=Nh(e),o=zs(),a,l=()=>{g(),u()},s=h=>{o.add.call(void 0,h),x()},c=(h=[])=>{for(let y of h)if(y.action(),(0,Ws.default)(Mh,y.actionType))break},d=(h=1/0)=>{var C,S,q;let y=nr((C=o.get({timestamp:h,priority:"control"}))!=null?C:{}),I=nr((S=o.get({timestamp:h,priority:"container"}))!=null?S:{}),R=nr((q=o.get({timestamp:h,priority:"chapter"}))!=null?q:{});return[...y,...I,...R]},v=h=>{n.isReady(h)&&c(d(h))},b=()=>{var h;c([...nr((h=o.get({timestamp:1/0,priority:"chapter"}))!=null?h:{})])},g=()=>{i&&(a==null||a.unsubscribe(),i=void 0)},x=()=>{i||(i=()=>setTimeout(()=>{v(1/0)}),a=t.events.ended$.subscribe(i))},E=h=>{g(),t=h},m=h=>{h.priority==="container"&&n.resetCalled(h.timestamp),o.remove(h)},u=()=>{n.release(),o.removeAll()};return{setPlayer:E,add:s,remove:m,exec:v,execEndOfVideo:b,listen:x,unlisten:g,release:l,containersEventsCallState:n,getPreparedToExecActions:d}}function Nh(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:Fh,v=e.get(d);e.set(d,A(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 nr(r){return(0,Ks.default)((0,Ei.default)(r)).sort(e=>e.actionType===T.EventActionTypes.expect?-1:1)}var Xs={videoContentHeight:0,videoContentWidth:0},Ys=r=>{let{height:e,width:t}=r.info.intrinsicVideoSize$.getValue()||{};if(!(e&&t))return Xs;let{clientHeight:i,clientWidth:n}=r.experimental.element$.getValue()||{};if(!(i&&n))return Xs;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 _h=250;function Zs(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}=Ys(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=it(l=>{let{fns:s=[]}=r();i(l);for(let c of s)c()},_h);function a(){e=void 0,t.disconnect(),n()}return{resizeObserver:t,calc:()=>{e==null||e()},release:a}}var $h=r=>Math.floor(Math.random()*r),el=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},tl=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 rl=r=>{let e=r.length,t=$h(e);return r[t]},Js=1,il=r=>{var i,n;let e=0;for(let o=0;o<r.length;++o)e+=(i=r[o].weight)!=null?i:Js;let t=Math.random()*e;e=0;for(let o=0;o<r.length-1;++o)if(e+=(n=r[o].weight)!=null?n:Js,e>=t)return r[o];return r[r.length-1]};var nl={shouldOpenNow:!0,isDetachContainer:!0},ol="after-expect",Ti=(r,e=!1)=>A(f({},r),{args:e?f(f({},r.args),nl):f(f({},nl),r.args)}),al=({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:I,branches:R=[],onEvent:C,isEOV:S=()=>!1,isDisabled:q=()=>!1})=>{let P=Ti(u,S()),F={timestamp:1/0,priority:"control",initiator:y,actionType:P.type},M=q(),j=r.emit.bind(r,V.interactives,{subjectId:y,subjectType:h,subjectName:"control",type:M?_.actionChoiceCanceled:_.actionChoice,actionType:u.type,payload:f({invokeImmediately:P.args.shouldOpenNow,containerId:I},P.args)}),Ae=()=>{e.interactiveActionChoice$.next({subjectId:y,subjectType:h,subjectName:"control",type:M?"action-choice-canceled":"action-choice",actionType:u.type,payload:f({invokeImmediately:P.args.shouldOpenNow,containerId:I},P.args)})};if(M){j(),Ae();return}switch(P.type.trim().toLowerCase()){case T.EventActionTypes.setNextBranch.trim().toLowerCase():{let ae=R.find(ee=>ee.id===P.args.branchId);if(!ae)return;C(P.args.isDetachContainer,g.bind(null,{subjectId:y,subjectName:"control"})),j(),Ae(),P.args.shouldOpenNow?E({subjectId:y,subjectName:"control",subjectType:h,action:P,payload:{chapterId:ae.chapterId,autoSelect:!1}}):i.add(A(f({},F),{action:E.bind(null,{subjectId:y,subjectName:"control",subjectType:h,action:P,payload:{chapterId:ae.chapterId,autoSelect:!1}})}));return}case T.EventActionTypes.continuePlayback.trim().toLowerCase():{C(P.args.isDetachContainer,g.bind(null,{subjectId:y,subjectName:"control"})),j(),Ae(),P.args.shouldOpenNow?x({subjectId:y,subjectName:"control",subjectType:h,action:u}):i.add(A(f({},F),{action:x.bind(null,{subjectId:y,subjectName:"control",subjectType:h,action:u})}));return}case T.EventActionTypes.openURI.trim().toLowerCase():{C(P.args.isDetachContainer,g.bind(null,{subjectId:y,subjectName:"control"})),j(),Ae(),P.args.shouldOpenNow?m({subjectId:y,subjectName:"control",subjectType:h,action:P,payload:{URI:u.args.uri}}):i.add(A(f({},F),{action:m.bind(null,{subjectId:y,subjectName:"control",subjectType:h,action:P,payload:{URI:u.args.uri}})}));return}default:{let ae="Unexpected control event",ee=new B(1,1,{message:ae});d(ee,ae);return}}},l=({action:u,container:{id:h,endTime:y},branches:I=[],isEOV:R=!1,autoSelected:C=!1})=>{let S=Ti(u,R),q={timestamp:!S.args.shouldOpenNow||R?1/0:y!=null?y:1/0,priority:"container",initiator:h,actionType:S.type},P=r.emit.bind(r,V.interactives,{subjectId:h,subjectName:"container",type:_.actionChoice,actionType:S.type,payload:f({invokeImmediately:S.args.shouldOpenNow},S.args)}),F=()=>{e.interactiveActionChoice$.next({subjectId:h,subjectName:"container",type:"action-choice",actionType:S.type,payload:f({invokeImmediately:S.args.shouldOpenNow},S.args)})};switch(S.type.trim().toLowerCase()){case T.EventActionTypes.setNextBranch.trim().toLowerCase():{let M=I.find(j=>j.id===S.args.branchId);if(!M)return;P(),F(),i.add(A(f({},q),{action:E.bind(null,{subjectId:h,subjectName:"container",action:S,payload:{chapterId:M.chapterId,autoSelect:C}})}));return}case T.EventActionTypes.setMaxWeightBranch.trim().toLowerCase():return;case T.EventActionTypes.setMinWeightBranch.trim().toLowerCase():return;case T.EventActionTypes.setRandomBranch.trim().toLowerCase():return;case T.EventActionTypes.setWeightlessRandomBranch.trim().toLowerCase():return;case T.EventActionTypes.continuePlayback.trim().toLowerCase():{P(),F(),i.add(A(f({},q),{action:x.bind(null,{subjectId:h,subjectName:"container",action:S})}));return}case T.EventActionTypes.openURI.trim().toLowerCase():{P(),F(),i.add(A(f({},q),{action:m.bind(null,{subjectId:h,subjectName:"container",action:S,payload:{URI:u.args.uri}})}));return}default:{let M="Unexpected container event",j=new B(1,1,{message:M});d(j,M);return}}};function s({container:u,branches:h,isEOV:y=!1}){var R,C;let I=pi(u.events);if(I){let S=Ti(I.action,y);r.emit(V.interactives,{subjectId:u.id,subjectName:"container",type:_.actionChoice,actionType:S.type,payload:f({invokeImmediately:S.args.shouldOpenNow},S.args)}),e.interactiveActionChoice$.next({subjectId:u.id,subjectName:"container",type:"action-choice",actionType:S.type,payload:f({invokeImmediately:S.args.shouldOpenNow},S.args)}),i.add({timestamp:y?1/0:(R=u.endTime)!=null?R:1/0,priority:"container",initiator:u.id,actionType:T.EventActionTypes.expect,action:b.bind(null,{subjectId:u.id,subjectName:"container"})}),n.isExpect=!0}else for(let S of(C=u.events)!=null?C:[])l({action:S.action,container:u,branches:h,isEOV:y})}let c=({chapterId:u,action:h,branches:y=[]})=>{let I=r.emit.bind(r,V.interactives,{subjectId:u,subjectName:"chapter",type:_.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 T.EventActionTypes.setNextBranch.trim().toLowerCase():{let C=y.find(S=>S.id===h.args.branchId);return C!=null&&C.chapterId?(I(),R(),E.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case T.EventActionTypes.setWeightlessRandomBranch.trim().toLowerCase():{let C=rl(y);return C!=null&&C.chapterId?(I(),R(),E.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case T.EventActionTypes.setRandomBranch.trim().toLowerCase():{let C=il(y);return C!=null&&C.chapterId?(I(),R(),E.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case T.EventActionTypes.setMaxWeightBranch.trim().toLowerCase():{let C=tl(y);return C!=null&&C.chapterId?(I(),R(),E.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case T.EventActionTypes.setMinWeightBranch.trim().toLowerCase():{let C=el(y);return C!=null&&C.chapterId?(I(),R(),E.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{chapterId:C.chapterId,autoSelect:!0}})):void 0}case T.EventActionTypes.continuePlayback.trim().toLowerCase():return I(),R(),x.bind(null,{subjectId:u,subjectName:"chapter",action:h});case T.EventActionTypes.openURI.trim().toLowerCase():return I(),R(),m.bind(null,{subjectId:u,subjectName:"chapter",action:h,payload:{URI:h.args.uri}});default:{let C="Unexpected chapter event",S=new B(1,1,{message:C});d(S,C);return}}};function d(u,h){console.error(h),e.error$.next(u),r.emit(V.errors,u)}function v(u){var y;let h=pi(u.events);if(h){if(J(u))return;r.emit(V.interactives,{subjectId:u.id,subjectName:"chapter",type:_.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:T.EventActionTypes.expect,action:b.bind(null,{subjectId:u.id,subjectName:"chapter"})})}else(y=u.events)==null||y.forEach(I=>{let R=c({chapterId:u.id,action:I.action,branches:u.branches});R&&i.add({timestamp:1/0,priority:"chapter",initiator:u.id,actionType:I.action.type,action:R})})}let b=({subjectId:u,subjectName:h})=>{t.pause(),r.emit(V.interactives,{subjectId:u,subjectName:h,type:_.actionExecution,actionType:T.EventActionTypes.expect}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,type:"action-execution",actionType:T.EventActionTypes.expect})},g=({subjectId:u,subjectName:h})=>{t.info.isEnded$.getValue()?i.execEndOfVideo():t.play(),r.emit(V.interactives,{subjectId:u,subjectName:h,type:_.actionExecution,actionType:ol}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,type:"action-execution",actionType:ol})},x=({subjectId:u,subjectName:h,subjectType:y,action:I})=>{r.emit(V.interactives,{subjectId:u,subjectName:h,subjectType:y,type:_.actionExecution,actionType:I.type}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,subjectType:y,type:"action-execution",actionType:I.type})},E=({subjectId:u,subjectName:h,subjectType:y,action:I,payload:R})=>{R.behaviour="change-chapter",r.emit(V.interactives,{subjectId:u,subjectName:h,subjectType:y,type:_.actionExecution,actionType:I.type,payload:R}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,subjectType:y,type:"action-execution",actionType:I.type,payload:R})},m=({subjectId:u,subjectName:h,subjectType:y,action:I,payload:R})=>{if(!R.URI)return;let C=window.open(R.URI,"_blank","noopener,noreferrer");C&&(C.opener=null),r.emit(V.interactives,{subjectId:u,subjectName:h,subjectType:y,type:_.actionExecution,actionType:I.type}),e.interactiveActionExecution$.next({subjectId:u,subjectName:h,subjectType:y,type:"action-execution",actionType:I.type})};return{onControlEvent:a,onContainerEvent:l,onChapterEvent:c,onExpectEvent:b,expectEventHandler:g,setManifestChapterEvents:v,setManifestContainerEvents:s,stopExpect:o,state:n}};var Si=X(ri(),1),Q=require("@vkontakte/videoplayer-shared/es2015");var or=(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]=xi(o)}return t[i]}).filter(Boolean)},sl=r=>{for(let e of r.variants)if(ll(e)&&e.payload)return e.payload.id},ll=r=>!!(r.type==="custom"&&r.payload&&r.payload.type==="vk"),xi=r=>{let e=sl(r);if(!e)return null;let t=e.split("_").pop();return t?parseInt(t,10):null},cl=(r,e)=>{for(let t of r.media.videos)if(e===xi(t)){for(let i of r.chapters)if(i.videoId===t.id)return i.id;return}},Ii=(r,e)=>r.reduce((t,i)=>{let n=cl(e,i);return n?[...t,n]:t},[]);var le,xe,Ie,K,ar,ce,ue,oe,Se,je,Be,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,le,null);G(this,xe);G(this,Ie,!1);G(this,K,null);G(this,ar,null);this.events={inited$:new Q.Subject,destroyed$:new Q.Subject,error$:new Q.Subject};G(this,ce,null);G(this,ue,null);G(this,oe,null);G(this,Se,new Q.Subscription);G(this,je,!1);G(this,Be,0);var a;$(this,ce,t),$(this,oe,e),$(this,ue,i),$(this,le,n),$(this,xe,o),this.state.history$&&k(this,Se)&&((a=k(this,Se))==null||a.add(this.state.history$.subscribe(l=>{var s,c;this.state.prevChapter$.next((0,Si.default)(l,-2)||null),this.state.hasPrevChapter$.next(l.length>1),this.state.isInitialChapter$.next(this.getInitialChapterId()===((c=(s=k(this,K))==null?void 0:s.metadata)==null?void 0:c.initChapterId)),this.state.isGoBackLimited$.next(k(this,Be)===k(this,xe).maxLength-1)})))}setManifest(e){return O(this,null,function*(){if(!k(this,ue)||!k(this,oe))return;$(this,K,e),yield this.getProjectHistory();let t=this.getInitialChapterId();yield k(this,ue).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,K))return;k(this,je)?($(this,je,!1),ji(this,Be)._++):$(this,Be,0);let i=k(this,K),n=e.length-k(this,xe).maxLength,o=n>0?e.slice(n):e,a=or(o,i);if($(this,ar,a),this.state.history$.next(o),!(!t||!k(this,le)||!k(this,ce)))try{yield k(this,le).save(k(this,ce),a)}catch(s){let c=new B(1,5,"Unable to save interactive history");this.events.error$.next(c),(l=k(this,oe))==null||l.emit(V.errors,c)}})}goBack(){return O(this,null,function*(){var i;if(!this.state||!k(this,ue)){let n=new B(1,5,"Unable to save interactive history");return this.events.error$.next(n),(i=k(this,oe))==null?void 0:i.emit(V.errors,n)}$(this,je,!0);let e=this.state.history$.getValue().slice(0,-1),t=e.pop();this.state.history$.next(e),yield k(this,ue).setChapter({chapterId:t,playPrev:!0})})}getProjectHistory(){return O(this,null,function*(){var n;if(!k(this,K)||!k(this,ce))return;let e=k(this,K),t=[this.getInitialVideoId()];if(k(this,le))try{let o=yield k(this,le).get(k(this,ce));o.length&&(t=o)}catch(o){let a=new B(1,5,"Error while trying to fetch data");this.events.error$.next(a),(n=k(this,oe))==null||n.emit(V.errors,a)}let i=Ii(t,e);this.state.history$.next(i)})}getInitialChapterId(){var t;let e=this.state.history$.getValue();return(0,Si.default)(e,-1)||k(this,xe).initChapterId||((t=k(this,K))==null?void 0:t.metadata.initChapterId)}getInitialVideoId(){if(k(this,K)){let e=this.getInitialChapterId();return or([e],k(this,K)).pop()}return null}destroy(){var e,t;$(this,ce,null),$(this,le,null),$(this,ue,null),(e=k(this,Se))==null||e.unsubscribe(),$(this,Se,null),$(this,Ie,!1),(t=k(this,oe))==null||t.emit(V.historyDestroyed),this.events.destroyed$.next(),$(this,oe,null)}};le=new WeakMap,xe=new WeakMap,Ie=new WeakMap,K=new WeakMap,ar=new WeakMap,ce=new WeakMap,ue=new WeakMap,oe=new WeakMap,Se=new WeakMap,je=new WeakMap,Be=new WeakMap;var sr=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 O(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 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 lr=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;
|
|
@@ -251,4 +251,4 @@
|
|
|
251
251
|
.interactive-control-fill-animation-filler.interactive-control-fill-animation-from-bottom {
|
|
252
252
|
transform-origin: bottom;
|
|
253
253
|
}
|
|
254
|
-
`;var hl=r=>{let e=document.createElement("style");e.textContent=pl,r.prepend(e)};var fl=require("@vkontakte/videoplayer-core/es2015");var dl=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,controlsFillAnimation:!1}});function qh(){let r=document.createElement("div");return r.classList.add("interactive-chapter"),r}var vt=class{constructor(e){this.playerSubscriptions=new w.Subscription;this.subscriptions=new w.Subscription;this.globalEventEmitter=new Gt;this.animation=new zt;this.seekToInteractiveController=new ot;this.endedRanges=new Set;this.gameControllers=[];this.rootElement=qh();this.factories=new Map([["choice",Vt]]);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(L.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&&J(i)&&!t&&this.historyController.updateHistory([]),window.removeEventListener("beforeunload",this.clearHistoryIfEnded)};this.handleSeamlessPlayerChanged=e=>{if(!e)return;let n=e,{statistics:t}=n,i=te(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(L.playerChanged,i)};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,n=t.getValue().map(o=>S(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=S(f(f({},dl),e),{config:f(f({},dl.config),e.config)}),(n=this._options.animationsFeatureToggles)==null?void 0:n.controlsExpectTimeBlinkAnimation){this.blinkAnimationRef=new wt,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 lr({parentElement:this._options.parentElement,onError:a=>{let l=new B(1,6,a);this.emitErrorEvent(l)}})),hl(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 Te(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=Zs(()=>({player:this.player,parentElement:this._options.parentElement,fns:i})),this._options.graph&&(this.graph=new nt({root:this._options.parentElement,lang:this._options.lang,onOpenPreviewClick:a=>{this.setChapter({chapterId:a}),this.globalEventEmitter.emit(L.graph,{type:$e.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,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})=>{e!=="action-choice"||t==="chapter"||"invokeImmediately"in i&&i.invokeImmediately||this.destroyGameControllers(!1)}))}initSeamless(){return O(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(L.interactives,{type:_.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,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: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(A=>!A.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;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 b=new rr({player:this.player,container:a,branches:e.branches,selectBranches:this.selectBranches,interactiveEvents:this.interactiveEvents,globalEvents:this.events,globalEventEmitter:this.globalEventEmitter,getContainerEventState:()=>Ra(i,this.gameControllers),permanentTextControls:this._options.permanentTextControls,interactiveTimeOpenUri:this._options.interactiveTimeOpenUri,disabledControls$:this.state.disabledControls$,onRemove:()=>{this.seekToInteractiveController.deleteContainer(i.id)},onError:this.emitErrorEvent});this.animation.addFn(b.whilePlaying,!0),t.push(b)}}),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&&J(i)&&pt(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,ml.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?S(f({},c),{isRemoved:!0}):c);return S(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)};er(S(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?er(S(f({},e),{gameControllers:this.gameControllers,execFn:dt(bi(t),!1)})):er(S(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 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(L.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=Qs(this.player,this._options.interactiveTimeOpenUri),this.selectBranches=al({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:i=!1}={}){var s,c;this.reset(),this.lastFrame&&this.isFirstChapterFetched&&(this.lastFrame.draw(),this.lastFrame.show()),this.lastFrame&&fl.clientChecker.browser.isSafari&&(yield ul(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(L.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?qe.InteractiveInterfaceClick.GRAPH_SHOW:qe.InteractiveInterfaceClick.GRAPH_HIDE)})).add(this.events.watchAgainIsClicked$.subscribe(()=>{e.next(qe.InteractiveInterfaceClick.WATCH_AGAIN)})).add(this.events.interactiveActionChoice$.subscribe(({type:t,subjectName:i,subjectType:n})=>{t!=="action-choice"||i!=="control"||(n==="Button"&&e.next(qe.InteractiveInterfaceClick.NEXT_BUTTON),n==="Area"&&e.next(qe.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(L.graph,{type:$e.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===T.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(i=>{let n=i.container.container;return!i.container.isRemoved&&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,T.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 hs((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 vl={Container:Re,createChoiceContainer:Vt,createAreaControl:Rt,createButtonControl:Mt,classnamesPrefix:Ui};var Dh={version:Bi};
|
|
254
|
+
`;var hl=r=>{let e=document.createElement("style");e.textContent=pl,r.prepend(e)};var fl=require("@vkontakte/videoplayer-core/es2015");var dl=Object.freeze({lang:w.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}});function qh(){let r=document.createElement("div");return r.classList.add("interactive-chapter"),r}var vt=class{constructor(e){this.playerSubscriptions=new w.Subscription;this.subscriptions=new w.Subscription;this.globalEventEmitter=new Gt;this.animation=new zt;this.seekToInteractiveController=new ot;this.endedRanges=new Set;this.gameControllers=[];this.rootElement=qh();this.factories=new Map([["choice",Ft]]);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(V.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&&J(i)&&!t&&this.historyController.updateHistory([]),window.removeEventListener("beforeunload",this.clearHistoryIfEnded)};this.handleSeamlessPlayerChanged=e=>{if(!e)return;let n=e,{statistics:t}=n,i=te(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(V.playerChanged,i)};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,n=t.getValue().map(o=>A(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=A(f(f({},dl),e),{config:f(f({},dl.config),e.config)}),(n=this._options.animationsFeatureToggles)==null?void 0:n.controlsExpectTimeBlinkAnimation){this.blinkAnimationRef=new wt,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 lr({parentElement:this._options.parentElement,onError:a=>{let l=new B(1,6,a);this.emitErrorEvent(l)}})),hl(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 Te(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=Zs(()=>({player:this.player,parentElement:this._options.parentElement,fns:i})),this._options.graph&&(this.graph=new nt({root:this._options.parentElement,lang:this._options.lang,onOpenPreviewClick:a=>{this.setChapter({chapterId:a}),this.globalEventEmitter.emit(V.graph,{type:$e.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,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})=>{e!=="action-choice"||t==="chapter"||"invokeImmediately"in i&&i.invokeImmediately||this.destroyGameControllers(!1)}))}initSeamless(){return O(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(V.interactives,{type:_.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,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: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(x=>!x.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;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 g=new rr({player:this.player,container:a,branches:e.branches,selectBranches:this.selectBranches,interactiveEvents:this.interactiveEvents,globalEvents:this.events,globalEventEmitter:this.globalEventEmitter,getContainerEventState:()=>Ra(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});this.animation.addFn(g.whilePlaying,!0),t.push(g)}}),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&&J(i)&&pt(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,ml.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?A(f({},c),{isRemoved:!0}):c);return A(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)};er(A(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?er(A(f({},e),{gameControllers:this.gameControllers,execFn:dt(bi(t),!1)})):er(A(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 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(V.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=Qs(this.player,this._options.interactiveTimeOpenUri),this.selectBranches=al({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:i=!1}={}){var s,c;this.reset(),this.lastFrame&&this.isFirstChapterFetched&&(this.lastFrame.draw(),this.lastFrame.show()),this.lastFrame&&fl.clientChecker.browser.isSafari&&(yield ul(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(V.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?qe.InteractiveInterfaceClick.GRAPH_SHOW:qe.InteractiveInterfaceClick.GRAPH_HIDE)})).add(this.events.watchAgainIsClicked$.subscribe(()=>{e.next(qe.InteractiveInterfaceClick.WATCH_AGAIN)})).add(this.events.interactiveActionChoice$.subscribe(({type:t,subjectName:i,subjectType:n})=>{t!=="action-choice"||i!=="control"||(n==="Button"&&e.next(qe.InteractiveInterfaceClick.NEXT_BUTTON),n==="Area"&&e.next(qe.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(V.graph,{type:$e.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===T.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(i=>{let n=i.container.container;return!i.container.isRemoved&&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,T.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 hs((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 vl={Container:Re,createChoiceContainer:Ft,createAreaControl:Rt,createButtonControl:Lt,classnamesPrefix:Ui};var Dh={version:Bi};
|