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