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