@vkontakte/videoplayer-interactive 1.0.31-dev.208aaafc.0 → 1.0.31-dev.4feba7d1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es2015.cjs.js +4 -4
- package/es2015.esm.js +4 -4
- package/es2018.cjs.js +4 -4
- package/es2018.esm.js +4 -4
- package/esnext.cjs.js +5 -5
- package/esnext.esm.js +5 -5
- package/evergreen.esm.js +3 -3
- package/package.json +4 -4
package/evergreen.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-interactive v1.0.31-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-interactive v1.0.31-dev.4feba7d1.0
|
|
3
|
+
* Thu, 13 Feb 2025 17:09:31 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-31/doc/
|
|
5
5
|
*/
|
|
6
|
-
var lt="1.0.31-dev.208aaafc.0";function Fe(i,e=1){let t="0",n="0",r="0";return i.length===4?(t="0x"+i[1]+i[1],n="0x"+i[2]+i[2],r="0x"+i[3]+i[3]):i.length===7&&(t="0x"+i[1]+i[2],n="0x"+i[3]+i[4],r="0x"+i[5]+i[6]),`rgba(${+t},${+n},${+r},${e})`}var M="interactive",Zt="interactive-controls-container",pe=()=>document.querySelector(`.${Zt}`),ct=.4,V={textColor:"#000",textSize:.4,textContent:"",roundCorners:0,borderWidth:0,borderColor:"#000",borderAlpha:1,backgroundColor:"#fff",backgroundAlpha:1,innerSizesDependOn:"self",angle:0},pt=(n=>(n.top="flex-start",n.bottom="flex-end",n.center="center",n))(pt||{}),ht=(n=>(n.start="flex-start",n.end="flex-end",n.center="center",n))(ht||{}),dt=(n=>(n.start="left",n.end="right",n.center="center",n))(dt||{}),he=({target:i,props:e})=>{i.style.alignItems=(e?.gravityVertical&&pt[e.gravityVertical])??"center",i.style.justifyContent=(e?.gravityHorizontal&&ht[e.gravityHorizontal])??"center",i.style.textAlign=(e?.alignment&&dt[e.alignment])??"center"},de=({target:i,props:e,fallback:t,dependsOn:n})=>{i.style.color=e?.text?.color??t.textColor,i.style.fontSize=`calc(${n.height} * ${e?.text?.size??t.textSize})`,i.textContent=e?.text?.value??t.textContent},ue=({target:i,props:e,fallback:t})=>{i.style.backgroundColor=Fe(e?.background?.color??t.backgroundColor,e?.background?.alpha??t.backgroundAlpha)},me=({target:i,props:e,fallback:t,dependsOn:n})=>{i.style.border=`calc(${n.height} * ${e?.shape?.border?.width??t.borderWidth}) solid ${Fe(e?.shape?.border?.color??t.borderColor,e?.shape?.border?.alpha??t.borderAlpha)}`,i.style.borderRadius=`calc(${n.height} * ${e?.shape?.roundCorners??t.roundCorners})`},K=({target:i,layoutParams:e,fallback:t})=>{let n=e.angle??t.angle;n=n&&n*-1,i.style.transform=`rotate(${n}rad)`};var H=class{constructor(e){this.control=e;this.container=null;this.controlElement=null;this.clickListener=null}createContainerElement(e){let t=document.createElement("div");t.classList.add(`${M}-control-container-${this.control.id}`),e(t,this.control.layoutParams);let n=(this.control.layoutParams.innerSizesDependOn??V.innerSizesDependOn)==="self"?{height:t.style.height,width:t.style.width}:{height:"var(--interactive-content-height)",width:"var(--interactive-content-width)"};this.container={element:t,dimensions:n}}createClickListener(e){return t=>{t.stopPropagation(),e()}}setEvents(e){!this.container||!this.control.events||this.control.events.forEach(t=>{switch(t.type.trim().toLowerCase()){case"onclick":this.clickListener=this.createClickListener(()=>e({action:t.action,controlId:this.control.id,controlType:this.control.type})),this.container?.element.addEventListener("click",this.clickListener);break;default:break}})}removeListeners(){this.container?.element&&this.clickListener&&this.container?.element.removeEventListener("click",this.clickListener)}};var _e="int",D=(n=>(n.AREA=`${_e}_area`,n.TEXT=`${_e}_text`,n.BUTTON=`${_e}_bttn`,n))(D||{});var fe=i=>{if(i.type.trim().toLowerCase()==="area")return new He(i)},He=class extends H{constructor(e){super(e)}createView({parentElement:e,layoutCallback:t}){if(super.createContainerElement(t),!this.container)return;let n=document.createElement("button");n.type="button",n.classList.add(`${M}-${this.control.id}`),n.setAttribute("data-testid",D.AREA),n.style.display="flex",n.style.width="100%",n.style.height="100%",n.style.cursor="pointer",ue({target:n,props:this.control.props,fallback:{...V,backgroundColor:"transparent"}}),me({target:n,props:this.control.props,fallback:{...V,borderAlpha:0},dependsOn:this.container.dimensions}),K({target:n,layoutParams:this.control.layoutParams,fallback:V}),this.container.element.append(n),e.append(this.container.element),this.controlElement=n}disable(){this.controlElement&&(this.controlElement.style.cursor="default")}enable(){this.controlElement&&(this.controlElement.style.cursor="pointer")}getElement(){return this.controlElement}};var ye=i=>{let e=document.createElement("span");switch(i){case"Button":case"button":{let t=document.createElement("div"),n={overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center"};Object.assign(t.style,n),t.append(e);let r={display:"inline-block",whiteSpace:"pre",textOverflow:"ellipsis",maxWidth:"initial",maxHeight:"100%",wordBreak:"normal"};return Object.assign(e.style,r),t}default:{let t={display:"inline-block",whiteSpace:"break-spaces",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",maxHeight:"100%",wordBreak:"break-all"};return Object.assign(e.style,t),e}}};var Ce=i=>{if(i.type.trim().toLowerCase()==="button")return new De(i)},De=class extends H{constructor(e){super(e)}createView({parentElement:e,layoutCallback:t}){if(super.createContainerElement(t),!this.container)return;let n=document.createElement("button");n.type="button",n.classList.add(`${M}-${this.control.id}`),n.setAttribute("data-testid",D.BUTTON),n.style.display="flex",n.style.width="100%",n.style.height="100%",n.style.cursor="pointer",n.style.fontFamily="inherit",K({target:n,layoutParams:this.control.layoutParams,fallback:V}),ue({target:n,props:this.control.props,fallback:V}),me({target:n,props:this.control.props,fallback:V,dependsOn:this.container.dimensions}),he({target:n,props:{...this.control.props.text,alignment:this.control.layoutParams.alignment}});let r=ye(this.control.type.trim().toLowerCase()),s=r.firstElementChild??r;de({target:s,props:this.control.props,fallback:V,dependsOn:this.container.dimensions}),n.append(r),this.container.element.append(n),e.append(this.container.element),this.controlElement=n}disable(){this.controlElement&&(this.controlElement.style.cursor="default")}enable(){this.controlElement&&(this.controlElement.style.cursor="pointer")}getElement(){return this.controlElement}};var ut=i=>{if(i.type.trim().toLowerCase()==="text")return new Ge(i)},Ge=class extends H{constructor(e){super(e)}createView({parentElement:e,layoutCallback:t}){if(super.createContainerElement(t),!this.container)return;let n=document.createElement("div");n.classList.add(`${M}-${this.control.id}`),n.setAttribute("data-testid",D.TEXT),n.style.display="flex",n.style.width="100%",n.style.height="100%",n.style.fontFamily="inherit",K({target:n,layoutParams:this.control.layoutParams,fallback:V}),he({target:n,props:{...this.control.props.text,alignment:this.control.layoutParams.alignment}});let r=ye(this.control.type.trim().toLowerCase()),s=r.firstElementChild??r;de({target:s,props:this.control.props,fallback:V,dependsOn:this.container.dimensions}),n.append(r),this.container.element.append(n),e.append(this.container.element),this.controlElement=n}disable(){}enable(){}getElement(){return this.controlElement}};var Ue=class{constructor(e){this.layout=e}},ve=class extends Ue{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 X=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(){return this.container.controls?.reduce((e,t)=>{let n=t.type.trim().toLowerCase(),r=this.factories.get(n);if(r){let s=r(t);if(s)return[...e,s]}return[...e]},[])||[]}};var ge=(i,e)=>{if(i.type.trim().toLowerCase()==="choice")return new ze(i,e)},ze=class extends X{constructor(e,t){super(e),this.rootElement=t??pe(),this.layout=new ve(this.container.layout),this.isRemoved=!1,this.isDisabled=!1,this.addControlFactory("button",Ce),this.addControlFactory("text",ut),this.addControlFactory("area",fe)}createView(e){let t=document.createElement("div");return t.classList.add(`${M}-${this.container.id}`),this.layout.setContainerLayout(t),this.controls.forEach(n=>{n.createView({parentElement:t,layoutCallback:this.layout.setControlLayout}),n.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=`${ct}`,this.isDisabled=!0)}removeView(){this.isRemoved||(this.controls.forEach(e=>e.removeListeners()),this.getElement()?.remove(),this.isRemoved=!0)}getElement(){return this.rootElement.querySelector(`.${M}-${this.container.id}`)}};import{clientChecker as In,combine as Tn,InterfaceLanguage as xn,Observable as Wt,once as Sn,Subject as P,Subscription as at,ValueSubject as $,fromEvent as Qt}from"@vkontakte/videoplayer-shared/evergreen";import{InteractiveInterfaceClick as le}from"@vkontakte/videoplayer-statistics/evergreen";import{loadVKLangPack as qt}from"@vkontakte/videoplayer-shared/evergreen";function Y(i,e){let t;return(...n)=>{clearTimeout(t),t=setTimeout(()=>i(...n),e)}}var G=(i,e)=>Object.prototype.toString.call(i)===`[object ${e}]`,J=i=>G(i,"Object"),be=i=>G(i,"String"),Ee=i=>G(i,"Array"),Ie=i=>G(i,"Number"),mt=i=>G(i,"Function");var We=i=>Ie(i)&&!isNaN(i);var U=i=>J(i)&&Object.keys(i).length===0,Qe=i=>Ee(i)&&!i.length;var ee=(i,e)=>be(i)&&(e?i.trim():i).length;var ft="video_interactive",yt="videoint";var Ct=250,te=class{constructor(e){this.handleZoomChange=Y(e=>{this.lastZoomInfo=e},Ct);this.onResize=e=>{if(!this.isReady||this.isHidden||!e[0].contentRect.width||!e[0].contentRect.height)return;let t=this.getNextPoint();t&&this.ngEditor?.zoomTo(t),this.ngEditorSize={width:e[0].contentRect.width,height:e[0].contentRect.height}};this.handleChapterChange=e=>{if(this.manifest){if(this.isHidden||this.hide(),!e?.id){this.onError?.("Id is not found"),console.error("Id is not found");return}this.visitedChapterIds.add(e.id),this.ngEditor?.selectChapter(e.id),this.ngEditor?.setVisitedChapters(Array.from(this.visitedChapterIds)),this.currentChapterId=e.id,this.lastZoomInfo=null}};this.handleManifestChange=(e,t=[])=>{if(this.isReady=!1,!Ie(e.graph.edit.chapters[0].x)){this.onError?.("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:n,lang:r,visitedChapters:s=[]}){this.isReady=!1,this.isHidden=!0,this.manifest=null,this.visitedChapterIds=new Set(s),this.onOpenPreviewClick=t,this.onError=n,this.lang=r??"ru",this.zoom=.7,this.lastZoomInfo=null,this.currentManifestId=null,this.currentChapterId=null,this.ngEditor=null,this.ngEditorSize=null,this.graphWrapperElement=Yt(e),this.resizeObserver=new ResizeObserver(Y(this.onResize,Ct)),this.resizeObserver.observe(this.graphWrapperElement)}getNextPoint(e=this.ngEditorSize){return!this.lastZoomInfo||!e?null:[(this.lastZoomInfo.x-e.width/2)/this.lastZoomInfo.value*-1,(this.lastZoomInfo.y-e.height/2)/this.lastZoomInfo.value*-1]}setVisitedChapters(e){this.visitedChapterIds=new Set([...this.visitedChapterIds,...e]),this.ngEditor?.setVisitedChapters(Array.from(this.visitedChapterIds))}updateVideosInfo(e){this.ngEditor?.updateVideosInfo(e)}async show(){this.manifest&&(this.ngEditor||await this.initNgEditor(),this.graphWrapperElement.style.display="block",!this.lastZoomInfo&&this.currentChapterId&&this.ngEditor?.focusChapter(this.currentChapterId),this.isHidden=!1)}async initNgEditor(){if(!this.manifest)return;let e;try{e=await qt(this.lang,ft,yt)}catch{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:n,...r})=>{n==="openPreview"&&"chapterId"in r&&this.onOpenPreviewClick?.(r.chapterId)}),this.ngEditor.on("zoom",this.handleZoomChange),this.isReady=!0}hide(){this.graphWrapperElement.style.display="none",this.isHidden=!0}destroy(){this.hide(),this.manifest=null,this.resizeObserver.disconnect(),this.ngEditor?.setVisitedChapters([]),this.onOpenPreviewClick=void 0,this.ngEditor?.dispose(),this.graphWrapperElement.remove(),this.isReady=!1}};function Yt(i){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",i.append(e),e}var ne=class{constructor(){this._containers=[];this._player=null;this.setPlayer=e=>{this._player=e};this.setContainers=e=>{this._containers=e};this.deleteContainer=e=>{this._containers=this._containers.filter(t=>t.id!==e)};this.getNextInteractiveTime=(e=3e3)=>{if(!this._containers.length||this._player===null)return null;let t=-1,n=!1,r=Math.round(this._player.info.position$.getValue()*1e3);for(let s of this._containers){let p=s.startTime-e;if(p<=r&&(s.endTime&&r<=s.endTime||s.endTime===null)){n=!0;break}r<p&&(t=t===-1?p:Math.min(t,p))}return!n&&t!==-1?t:null}}};import{isSupportedManifest as xe,ContainerTypes as Bi,ControlTypes as Se,EventActionTypes as g,EventTypes as Fi,migrateManifestToLatestVersion as bt,compareVersions as _i}from"@interactiveplatform/movika-manifest";var vt={metadata:"Object",chapters:"Array"},gt=i=>{if(!J(i))return!1;for(let e in vt)if(!i[e]||!G(i[e],vt[e]))return!1;return xe(i.metadata.version)},Te=i=>i.type===Se.Text,Ri=i=>i.type===Se.Button,Vi=i=>i.type===Se.Area,Mi={Choice:"Choice",TextInput:"TextInput"},Pi={Button:"Button",Area:"Area",Text:"Text"},$i={onClick:"onClick",onSuspense:"onSuspense"},Ni={openURI:"openURI",setNextBranch:"setNextBranch",setWeightlessRandomBranch:"setWeightlessRandomBranch",setRandomBranch:"setRandomBranch",setMaxWeightBranch:"setMaxWeightBranch",setMinWeightBranch:"setMinWeightBranch",setDefaultBranch:"setDefaultBranch",continuePlayback:"continuePlayback",expect:"expect"};var R=class{constructor(e,t,...n){this.severity=e;this.category=t;this.data=n}toString(){return`Interactive SDK error ${JSON.stringify(this,null," ")}`}};var we=class{constructor(){this.listeners={}}addListener(e,t){return this.listeners[e]=this.listeners[e]||[],this.listeners[e].push(t),this}on(e,t){return this.addListener(e,t)}once(e,t){this.listeners[e]=this.listeners[e]||[];let n=()=>{t(),this.off(e,n)};return this.listeners[e].push(n),this}off(e,t){return this.removeListener(e,t)}reset(){this.listeners={}}removeListener(e,t){let n=this.listeners[e]||[];for(let r=n.length;r>0;r--)if(n[r]===t){n.splice(r,1);break}return this}emit(e,...t){let n=this.listeners[e];return n?(n.forEach(r=>{r(...t)}),!0):!1}listenerCount(e){return this.rawListeners(e).length}rawListeners(e){return this.listeners[e]||[]}};var Ae=class{constructor(e){this.fns=[];this.addFn=(e,t=!1)=>{mt(e)&&(this.fns.push(e),t&&this.updateFn())};this.removeFn=(e,t=!1)=>{this.fns=this.fns.filter(n=>n!==e),t&&this.updateFn()};this.updateFn=()=>{this.fn=()=>{this.fns.forEach(e=>e()),this.raf&&this.forceRequestAnimation()}};this.forceRequestAnimation=()=>{this.fn&&(this.raf=requestAnimationFrame(this.fn))};this.requestAnimation=()=>{this.raf||this.forceRequestAnimation()};this.cancelAnimation=()=>{this.raf&&(cancelAnimationFrame(this.raf),this.raf=void 0)};e&&(this.fn=e,this.addFn(e))}release(){this.cancelAnimation(),this.fn=void 0,this.fns=[]}};import{ValueSubject as an}from"@vkontakte/videoplayer-shared/evergreen";var ke=class{constructor(e){this.loaders={chapterLoaders:e?.chapterLoaders??[],manifestLoaders:e?.manifestLoaders??[]}}async exec(e,t){return Jt(...this.loaders[e])(t)}};function Jt(...i){return async function(t){let n=[...i];for(;n.length>0;)t=await n.shift()(t);return t}}function ie(i,e,t){return i?{...i,[e]:i[e]?[t,...i[e]]:[t]}:{[e]:[t]}}function Re({actions:i,errors:e,chapterId:t,...n}){if(t){let r=i.getManifest();if(r){let s=i.getChapter(r.chapters,t);if(s){let p=i.getMedia(r.media,s.videoId),a=i.getGraph(r.graph,s.id);return p?{...n,actions:i,errors:e,result:{chapter:s,media:p,graph:a}}:{...n,errors:ie(e,Re.name,"Could not find media"),actions:i}}}}return{...n,errors:ie(e,Re.name,"Could not find chapter"),actions:i}}var Ke=(i="",e="")=>{let t=i.split("."),n=e.split("."),r=0;for(let s=0;s<Math.max(t.length,n.length)&&!r;s++)t[s]>n[s]?r=1:t[s]<n[s]?r=-1:r=0;return r};var en=async i=>{try{let e={},t;if(be(i)){t=new URL(i).href;let r=await fetch(t);if(!r.ok)return{};e=await r.json()}else if(J(i))e=i;else return{};if(!gt(e))return{};let n=e.metadata.media;if(be(n)&&!("media"in e))try{let r;t?r=new URL(n,t).href:(r=new URL(n).href,t=r);let s=await fetch(r);if(!s.ok)throw new Error;e.metadata.media=await s.json()}catch{return rn(e.metadata.version)?{manifest:e}:{}}return{manifest:e,manifestURL:t}}catch{return{}}};async function Et(i){let{manifest:e,manifestURL:t}=await en(i);if(!e)throw new Error("Failed on fetch");let n=bt(e);return n.media=tn(n.media,t),delete n.metadata.media,n}function Ve(i,e){if(e)return i.find(t=>t.id===e)}function Xe(i,e){return i.edit?.chapters?i.edit.chapters.find(t=>t.id===e):i.view?.chapters?i.view.chapters.find(t=>t.id===e):void 0}function Ze(i,e){return i.videos.find(t=>t.id===e)}function tn(i,e){return{...i,videos:i.videos.map(t=>({...t,variants:t.variants.map(n=>{let r="url"in n?n.url:"",s=nn(r,e);return{...n,url:s||r}})}))}}function nn(i="",e){try{return new URL(i,e).href}catch{return""}}function rn(i){return Ke(i,"3.2.0")>=0}var Me=i=>Ee(i)&&!Qe(i),F=i=>i.order==="end",Pe=i=>Ee(i.containers)&&!Qe(i.containers)&&F(i),It=(i,e)=>{let t=i*1e3;return Me(e.controls)&&t<(e.startTime??0)},qe=(i,e)=>{let t=i*1e3;return Me(e.controls)&&t>=(e.startTime??0)&&t<=(e.endTime??1/0)};var z=(i=[])=>i.some(e=>e.action.type==="expect"),Ye=(i=[])=>i.find(e=>e.action.type==="expect"),sn=i=>i?.length===1,Z=i=>sn(i)&&Te(i[0]);function Tt(i,...e){return t=>typeof e[0]=="object"&&typeof t=="object"?i({...e[0],...t}):i(...e,...t)}var xt=(i,e)=>z(i.events)?!1:e.some(({container:t})=>t.container.id!==i.id&&z(t.container.events)&&t.container.endTime===i.endTime&&!t.isRemoved);var q=class extends ke{constructor(t,n){super(t);this.manifest=null;this.chapter=null;this.media=null;this.graph=null;this.prevChapter$=new an(null);this.onError=n,this.release()}release(){return this.manifest=null,this.chapter=null,this.media=null,this.graph=null,this.prevChapter$.next(null),this}async setManifest(t){this.release();let n=await this.exec("manifestLoaders",{actions:{addErrorMessage:ie},result:null,errors:null,source:t});return n.errors&&this.errorHandler(n.errors),this.manifest=await Et(n.result??t),this}async setInitial(){return this.setNext()}async setNext(t=this.manifest?.metadata.initChapterId){if(!t)return this;this.prevChapter$.next(this.chapter);let n=await this.exec("chapterLoaders",Re({actions:{getManifest:()=>this.manifest,getCurrent:this.getCurrent,getGraph:Xe,getChapter:Ve,getMedia:Ze,getByBranches:this.getByBranches.bind(this),addErrorMessage:ie},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(){return this.getByChapterId(this.manifest?.metadata.initChapterId)||null}getByChapterId(t=this.manifest?.metadata.initChapterId){if(!t||!this.manifest)return null;let n=Ve(this.manifest.chapters,t);if(n){let r=Ze(this.manifest.media,n.videoId),s=Xe(this.manifest.graph,n.id);if(r)return{chapter:n,media:r,graph:s}}return null}getBranches(t=this.chapter?.id){if(t===this.chapter?.id)return this.getByBranches(this.chapter?.branches);{let n=Ve(this.manifest?.chapters||[],t);return this.getByBranches(n?.branches)}}getByBranches(t=[]){return t.reduce((n,r)=>{let s=this.getByChapterId(r.chapterId);return s&&n.push(s),n},[])}getCurrent(){return{chapter:this.chapter,media:this.media,graph:this.graph}}isInitialChapter(){return this.chapter?.id===this.manifest?.metadata.initChapterId}isEndChapter(){return this.chapter?F(this.chapter):!1}};import{Player as on}from"@vkontakte/videoplayer-core/evergreen";import{Subscription as tt,Tracer as ln,ValueSubject as cn}from"@vkontakte/videoplayer-shared/evergreen";var St=i=>{let e=i.variants.find(t=>t.payload?.type==="vk");if(e&&e.payload){let[t,n]=e.payload.id.split("_");return[t,n]}return[]};function Je(){let i=new Map;function e({listId:s=Math.random().toString(),itemId:p=Math.random().toString(),...a}){let l=i.get(s),h={...a};return l?l[p]=h:i.set(s,{[p]:h}),{listId:s,itemId:p,...a}}function t(s){s.player.destroy(),s.container.remove(),s.subscription.unsubscribe(),s.statistics?.oneStat.destroy(),s.statistics?.statSubscription.unsubscribe()}function n(s,p){let a=i.get(s);if(!a)throw Error("Can't remove. Not find.");if(p){let l=a[p];l&&t(l),delete a[p],Object.keys(a).length||i.delete(s)}else{for(let l of Object.values(a))t(l);i.delete(s)}}function r(){for(let s of i)n(s[0])}return{createPlayer:e,removePlayer:n,map:i,removeAll:r}}function et(i,e=[]){let t={},n,r=!e.length;for(let s of i.variants)if(!n&&"cover"in s&&(n=s.cover),"url"in s)switch(s.type.toLowerCase()){case"mp4":(r||e.includes("mp4"))&&(t.MPEG={...t.MPEG,[s.standard??"Invariant quality"]:s.url});break;case"mpeg":(r||e.includes("mpeg"))&&(t.MPEG={...t.MPEG,[s.standard??"Invariant quality"]:s.url});break;case"hls":(r||e.includes("hls"))&&(t={...t,HLS:{type:"url",url:s.url}});break;case"dash":(r||e.includes("dash"))&&(t={...t,DASH_SEP:{compatibilityMode:!0,type:"url",url:s.url}});break;default:break}return{sources:t,thumbUrl:n,title:i.title??""}}var re=(i,e)=>{let t=i.info.currentQuality$.getValue(),n=i.info.availableQualities$.getValue();t!==e&&n.includes(e)&&(i.setQuality(e),i.setAutoQuality(!1))};var pn=2;function nt(i){let e=Je(),t=new tt,n={},r=null,s=!1,p,a=new cn(null);i&&l(i);function l(x){r=x}function h(x,S,o){if(!r)throw Error("need to set interactive controller");if(!r.options)return;let d=(e.map.get(x)??{})[S];if(d){n={chapterId:o,listId:x,itemId:S,...d};let u=n.player;n.subscription.add(u.info.currentQuality$.subscribe(m=>{let f=u.info.position$.getValue(),I=u.info.isAutoQualityEnabled$.getValue();if(!(!m||!f||I))for(let A of e.map)Object.values(A[1]).forEach(({player:C})=>{re(C,m)})})).add(u.events.started$.subscribe(()=>{v(S)})),d.container.remove(),r.setPlayer(d.player),s||(r.init(),s=!0),a.next({player:n.player,config:n.config,statistics:n.statistics});return}throw Error("Can't set. Not find.")}async function v(x){if(!r)throw Error("need to set interactive controller");if(U(n)||x!==n.itemId)return;let S=r.getChapterBranches(),o=new Set;for(let c of S)o.has(c.media.id)||(await b({media:c.media,chapterId:c.chapter.id,setAsActive:!1,title:c.chapter.label}),o.add(c.media.id))}async function T({chapter:{id:x},manifestVideo:S}){if(U(n)||!r)return;let o=n.player.info.muted$.getValue(),c=n.player.info.currentQuality$.getValue(),d=n.player.info.isAutoQualityEnabled$.getValue(),u=n.player.info.volume$.getValue(),m=n.player.info.currentPlaybackRate$.getValue(),f=!d,I=!1;for(let A of e.map)if(A[0]===S.id&&!r.state.isReplay$.getValue()){let C=Object.keys(A[1]);for(let k of C)k===n.itemId?(C.length<pn||(I=!0),e.removePlayer(A[0],k)):(I=!0,h(A[0],k,x),f?re(n.player,c):n.player.setAutoQuality(!0),n.player.setVolume(u),n.player.setMuted(o),n.player.setPlaybackRate(m))}else e.removePlayer(A[0]);I||(await b({media:S,chapterId:x,setAsActive:!0,playbackRate:m}),f?re(n.player,c):n.player.setAutoQuality(!0),n.player.setVolume(u),n.player.setMuted(o))}async function b({media:x,chapterId:S,prefetch:o=!0,setAsActive:c=!0,autoplay:d=!1,preferredExt:u,title:m,playbackRate:f}){let I=Math.random().toString(),A=document.createElement("div");p.append(A);let C;if(r?.options?.vkVideoLoader){let ce=St(x);ce.length&&(C=await r.options.vkVideoLoader(...ce))}let k=r?.options?.coreConfig||void 0,L={...k,configName:[...k?.configName??[],"interactive"]},O={container:A,...C?.videos?.[0]||{sources:et(x,u).sources},title:m,failoverHosts:C?.failoverHosts||[]},j=new on(L,ln.createRootTracer());j.initVideo(O);let _=null;if(C?.videos&&r?.options.createOneStat){let ce=C.videos[0],Be=r.options.createOneStat(ce),ot=new tt;Be&&(ot.add(Be.attachTo(j)),_={oneStat:Be,statSubscription:ot})}let W=new tt,Xt=n?.player?.info.isAutoQualityEnabled$.getValue();W.add(j.events.canplay$.subscribe(function(){Xt||re(j,n.player.info.currentQuality$.getValue()),f&&j.setPlaybackRate(f)}));let Q=e.createPlayer({listId:x.id,itemId:I,player:j,container:A,sources:et(x,u).sources,config:O,subscription:W,statistics:_});return c&&h(x.id,Q.itemId,S),d&&Q.player.play(),o&&!d&&Q.player.prepare(),{player:Q.player,config:Q.config,statistics:Q.statistics}}function E(){B(),r=null,p.remove()}function B(){t.unsubscribe(),e.removeAll(),n={},s=!1}async function N(){if(!r)throw Error("need to set interactive controller");B(),p=document.createElement("div");let{media:x,chapter:S}=r.getCurrentChapter();x&&S?(t.add(r.events.chapterChanged$.subscribe(T)),await b({media:x,chapterId:S.id,title:S.label})):console.error("not found")}return{...e,init:N,setInteractiveController:l,createPlayer:b,removeAll:E,getActivePlayer:function(){return n},activePlayerChanged:a}}var y={graph:"graph",interactives:"interactives",chapterChanged:"chapter-changed",playerChanged:"player-changed",manifestChanged:"manifest-changed",errors:"errors",eachTick:"eachTick",historyInited:"history-inited",historyDestroyed:"history-destroyed"},se={visibility:"visibility",watchAgainClicked:"watchAgainClicked"},w={actionChoiceCanceled:"action-choice-canceled",actionChoice:"action-choice",actionExecution:"action-execution",visibility:"visibility",containerRemoved:"container-removed",rangeEnded:"range-ended"};import{Subscription as hn}from"@vkontakte/videoplayer-shared/evergreen";var $e=class{constructor({player:e,container:t,branches:n,selectBranches:r,interactiveEvents:s,globalEvents:p,globalEventEmitter:a,ignoreContainerEvent:l,permanentTextControls:h,disabledControls$:v,onRemove:T}){this.hide=()=>{setTimeout(()=>{this.gameState!==4&&(z(this.container.container.events)&&this.gameState===3||this.selectBranches.state.isExpect||(this.gameState!==2&&this.container.hide?.(),this.emitContainerVisibilityEvent(!1)))})};this.show=()=>{if(this.gameState!==2||this.isSelectedControlEvent)return;if(this.container.getElement())this.container.show?.(),this.emitContainerVisibilityEvent(!0,!1);else{let t={isDisabled:()=>this.container.isDisabled,branches:this.branches,containerId:this.container.container.id,onDetachContainer:()=>{this.removeView(),this.emitContainerVisibilityEvent(!1)},onEvent:(r,s)=>{this.isSelectedControlEvent=!0,r!==!1&&(this.removeView(),this.emitContainerVisibilityEvent(!1)),(this.gameState===4||this.gameState===3||this.selectBranches.state.isExpect)&&(this.selectBranches.stopExpect(),s(),this.removeView(),this.emitContainerVisibilityEvent(!1))},isEOV:()=>this.gameState===4},n=Tt(this.selectBranches.onControlEvent,t);this.container.createView(n),this.emitContainerVisibilityEvent(!0,!0),this.disabledControls$.getValue()&&this.container.disable?.()}};this.onEndOfVideo=()=>{this.gameState=4,this.selectContainerEvent(!0)};this.whilePlaying=()=>{let e=this.player.experimental.element$.getValue(),n=e instanceof HTMLVideoElement?e.readyState:void 0,r=[6,5];if(!n||r.includes(this.gameState)&&!this.isPermanentText)return;let s=this.player.getExactTime();if(It(s,this.container.container))this.gameState!==1&&(this.gameState=1,this.onBeforeStartTime());else if(qe(s,this.container.container))this.gameState!==2&&(this.gameState=2,this.onStartTime());else if(this.gameState!==3){let h=this.gameState;this.gameState=3,h===2&&this.onEndTime()}else this.isPermanentText||this.removeView();let p=qe(s,this.container.container),a=this.container.container.startTime?[this.container.container.startTime,this.container.container.endTime??1/0]:[],l={subjectId:this.container.container.id,subjectName:"container",range:a,currentTime:s,isInteractiveTime:p};this.globalEventEmitter.emit(y.eachTick,l),this.globalEvents.eachTick$.next(l)};this.container=t,this.branches=n,this.selectBranches=r,this.subscription=new hn,this.player=e,this.interactiveEvents=s,this.ignoreContainerEvent=l,this.isPermanentText=h&&Z(t.container.controls),this.disabledControls$=v,this.onRemove=T,this.globalEventEmitter=a,this.gameState=0,this.globalEvents=p,this.isSelectedControlEvent=!1,this.isSelectedContainerEvent=!1,this.registerEvents()}emitContainerVisibilityEvent(e,t=!1){e?(this.globalEventEmitter.emit(y.interactives,{subjectId:this.container.container.id,subjectName:"container",type:w.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(y.interactives,{subjectId:this.container.container.id,subjectName:"container",type:w.visibility,visibility:!1}),this.globalEvents.interactiveVisibilityChanged$.next({subjectId:this.container.container.id,subjectName:"container",type:"visibility",visibility:e}))}registerEvents(){this.subscription.add(this.player.events.playing$.subscribe(this.show)).add(this.player.events.paused$.subscribe(this.hide)).add(this.player.events.ended$.subscribe(this.onEndOfVideo)).add(this.disabledControls$.subscribe(e=>{e?this.container.disable?.():this.container.enable?.()}))}selectContainerEvent(e=!1){this.interactiveEvents.containersEventsCallState.setCalled({timestamp:e?1/0:this.container.container.endTime??1/0,id:this.container.container.id}),!(this.isSelectedControlEvent||this.isSelectedContainerEvent)&&(this.isSelectedContainerEvent=!0,this.ignoreContainerEvent()||this.selectBranches.setManifestContainerEvents({container:this.container.container,branches:this.branches,isEOV:e}),!e&&this.interactiveEvents.exec(this.container.container.endTime??1/0))}onStartTime(){this.show()}onEndTime(){this.selectContainerEvent(!1);let e=z(this.container.container.events)||this.ignoreContainerEvent();(this.isSelectedControlEvent||!e)&&this.removeView()}onBeforeStartTime(){this.container.hide?.(),this.emitContainerVisibilityEvent(!1)}reset(){this.isSelectedControlEvent=!1,this.isSelectedContainerEvent=!1,this.gameState=1}removeView(){this.container.removeView(),this.globalEventEmitter.emit(y.interactives,{subjectId:this.container.container.id,subjectName:"container",type:w.containerRemoved,visibility:!1}),this.globalEvents.interactiveContainerRemoved$.next({subjectId:this.container.container.id,subjectName:"container",type:"container-removed"}),this.gameState=5,this.onRemove?.()}destroy(){this.reset(),this.removeView(),this.gameState=6,this.subscription.unsubscribe(),this.branches=[],this.interactiveEvents.containersEventsCallState.setCalled({timestamp:this.container.container.endTime??1/0,id:this.container.container.id})}};var At=(i=[])=>i.reduce((e,t,n)=>{let r=(t?.controls??[]).filter(s=>!Te(s));if(Me(r)){let s=[t.startTime??0,t.endTime??1/0],p=t.id;if(!n)e.push({subjects:[p],range:s});else{let a=[],l=-1/0,h=1/0,v=[],T=[];for(let b=0;b<e.length;b++){let E=e[b];if(T.push(...E.subjects),E.range[0]<h&&(h=E.range[0]),E.range[1]>l&&(l=E.range[1]),s[0]>=E.range[0]&&s[1]<=E.range[1])return e[b].subjects.push(p),e;s[0]<E.range[0]&&s[1]>E.range[0]&&(a.push(b),v=v.concat(E.subjects)),s[0]>=E.range[0]&&s[0]<=E.range[1]&&(a.push(b),v=v.concat(E.subjects),s[0]=E.range[0]),s[1]>=E.range[0]&&s[1]<=E.range[1]&&(a.push(b),v=v.concat(E.subjects),s[1]=E.range[1])}if(T.push(p),s[0]<=h&&s[1]>=l)return[{subjects:T,range:s}];a.length&&a.reverse().forEach(b=>{e.splice(b,1)}),e.push({subjects:v.concat([p]),range:s})}}return e},[]).sort((e,t)=>e.range[0]-t.range[0]);function kt(){let i={};function e(){for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&delete i[a]}function t(a){let l={};for(let h in i)+h<=a&&(l[h]=i[h]);return l}function n(a){let l={};for(let h in i)+h>=a&&(l[h]=i[h]);return l}function r({timestamp:a,priority:l,initiator:h}){if(We(a)){let v=i[a]??null;if(v&&l&&ee(l,!0)){let T={},b=v[l];return b&&(T={...T,...b}),T=U(T)?null:T,T&&ee(h,!0)?T[h]??null:T}return v}return null}function s({timestamp:a,priority:l,initiator:h}){if(We(a))if(i[a]){if(l&&ee(l,!0))if(i[a][l]){if(h&&ee(h,!0))if(i[a][l][h]){if(delete i[a][l][h],!U(i[a][l]))return!0}else return!1;if(delete i[a][l],!U(i[a]))return!0}else return!1;return delete i[a]}else return!1;return!1}function p({timestamp:a,priority:l,initiator:h,...v}){i[a]?.[l]?.[h]?i[a][l][h].push({...v}):i[a]?.[l]?i[a][l]={...i[a][l],[h]:[{...v}]}:i[a]?i[a]={...i[a],[l]:{[h]:[{...v}]}}:i[a]={[l]:{[h]:[{...v}]}}}return{map:i,remove:s,add:p,removeAll:e,get:r,getLte:t,getGte:n}}var dn=[g.expect,g.setNextBranch],un=1/0;function Rt(i){let e=i,t,n=mn(),r=kt(),s,p=()=>{b(),S()},a=o=>{r.add.call(void 0,o),B()},l=(o=[])=>{for(let c of o)if(c.action(),dn.includes(c.actionType))break},h=(o=1/0)=>{let c=Ne(r.get({timestamp:o,priority:"control"})??{}),d=Ne(r.get({timestamp:o,priority:"container"})??{}),u=Ne(r.get({timestamp:o,priority:"chapter"})??{});return[...c,...d,...u]},v=o=>{n.isReady(o)&&l(h(o))},T=()=>{l([...Ne(r.get({timestamp:1/0,priority:"chapter"})??{})])},b=()=>{t&&(s?.unsubscribe(),t=void 0)},E=o=>{},B=()=>{t||(t=()=>setTimeout(()=>{v(1/0)}),s=e.events.ended$.subscribe(t))},N=o=>{b(),e=o},x=o=>{o.priority==="container"&&n.resetCalled(o.timestamp),r.remove(o)},S=()=>{n.release(),r.removeAll()};return{setPlayer:N,add:a,remove:x,exec:v,execEndOfVideo:T,listen:B,unlisten:b,release:p,containersEventsCallState:n,getPreparedToExecActions:h}}function mn(){let i=new Map;return{setCalled:({timestamp:p,id:a})=>{let l=i.get(p);l&&l[a]!==void 0&&(l[a]=!0)},setData:(p=[])=>{for(let a of p){let l=a.endTime??un,h=i.get(l);i.set(l,{...h,[a.id]:!1})}},resetCalled:p=>{let a=i.get(p);if(a)for(let l in a)a[l]=!1},isReady:p=>{let a=i.get(p);return a?!Object.values(a).some(l=>!l):!0},release:()=>i.clear()}}function Ne(i){return Object.values(i).flat().sort(e=>e.actionType===g.expect?-1:1)}var Vt={videoContentHeight:0,videoContentWidth:0},Mt=(i,e)=>{let{height:t,width:n}=e.info.intrinsicVideoSize$.getValue()||{};if(!(t&&n))return Vt;let{clientHeight:r,clientWidth:s}=e.experimental.element$.getValue()||{};if(!(r&&s))return Vt;let p=t/n,a=r/s,l,h;return a>p?(h=s,l=s*p):a<p?(h=r/p,l=r):(h=s,l=r),{videoContentWidth:h,videoContentHeight:l}};var fn=250;function Pt(i){let e=()=>{},t=new ResizeObserver(a=>{s(a),e=s.bind(null,a)});function n(a){let{parentElement:l,player:h}=i();if(l&&h){let{videoContentWidth:v,videoContentHeight:T}=Mt(l,h);l.style.setProperty("--interactive-content-width",`${v}px`),l.style.setProperty("--interactive-content-height",`${T}px`),l.style.setProperty("--interactive-width",`${a[0].contentRect.width}px`),l.style.setProperty("--interactive-height",`${a[0].contentRect.height}px`)}}function r(){let{parentElement:a}=i();a.removeAttribute("style")}let s=Y(a=>{let{fns:l=[]}=i();n(a);for(let h of l)h()},fn);function p(){e=void 0,t.disconnect(),r()}return{resizeObserver:t,calc:()=>{e?.()},release:p}}var yn=i=>Math.floor(Math.random()*i),Nt=i=>{let e=i.length,t=1/0,n=null;for(;e--;){let r=i[e],s=r.weight??1;s<t&&(t=s,n=r)}return n},Lt=i=>{let e=i.length,t=-1/0,n=null;for(;e--;){let r=i[e],s=r.weight??0;s>t&&(t=s,n=r)}return n};var Ot=i=>{let e=i.length,t=yn(e);return i[t]},$t=1,jt=i=>{let e=0;for(let n=0;n<i.length;++n)e+=i[n].weight??$t;let t=Math.random()*e;e=0;for(let n=0;n<i.length-1;++n)if(e+=i[n].weight??$t,e>=t)return i[n];return i[i.length-1]};var Bt={shouldOpenNow:!0,isDetachContainer:!0},Ft="after-expect";var it=(i,e=!1)=>({...i,args:e?{...i.args,...Bt}:{...Bt,...i.args}}),Dt=({globalEventEmitter:i,globalEvents:e,player:t,interactiveEvents:n})=>{let r={isExpect:!1},s=()=>{r.isExpect&&(r.isExpect=!1)},p=({action:o,controlType:c,controlId:d,containerId:u,branches:m=[],onEvent:f,isEOV:I=()=>!1,isDisabled:A=()=>!1})=>{let C=it(o,I()),k={timestamp:1/0,priority:"control",initiator:d,actionType:C.type},L=A(),O=i.emit.bind(i,y.interactives,{subjectId:d,subjectType:c,subjectName:"control",type:L?w.actionChoiceCanceled:w.actionChoice,actionType:o.type,payload:{invokeImmediately:C.args.shouldOpenNow,containerId:u,...C.args}}),j=()=>{e.interactiveActionChoice$.next({subjectId:d,subjectType:c,subjectName:"control",type:L?"action-choice-canceled":"action-choice",actionType:o.type,payload:{invokeImmediately:C.args.shouldOpenNow,containerId:u,...C.args}})};if(L){O(),j();return}switch(C.type.trim().toLowerCase()){case g.setNextBranch.trim().toLowerCase():{let _=m.find(W=>W.id===C.args.branchId);if(!_)return;f(C.args.isDetachContainer,E.bind(null,{subjectId:d,subjectName:"control"})),O(),j(),C.args.shouldOpenNow?N({subjectId:d,subjectName:"control",subjectType:c,action:C,payload:{chapterId:_.chapterId,autoSelect:!1}}):n.add({...k,action:N.bind(null,{subjectId:d,subjectName:"control",subjectType:c,action:C,payload:{chapterId:_.chapterId,autoSelect:!1}})});return}case g.continuePlayback.trim().toLowerCase():{f(C.args.isDetachContainer,E.bind(null,{subjectId:d,subjectName:"control"})),O(),j(),C.args.shouldOpenNow?B({subjectId:d,subjectName:"control",subjectType:c,action:o}):n.add({...k,action:B.bind(null,{subjectId:d,subjectName:"control",subjectType:c,action:o})});return}case g.openURI.trim().toLowerCase():{f(C.args.isDetachContainer,E.bind(null,{subjectId:d,subjectName:"control"})),O(),j(),C.args.shouldOpenNow?S({subjectId:d,subjectName:"control",subjectType:c,action:C,payload:{URI:o.args.uri}}):n.add({...k,action:S.bind(null,{subjectId:d,subjectName:"control",subjectType:c,action:C,payload:{URI:o.args.uri}})});return}default:{let _="Unexpected control event",W=new R(1,1,{message:_});v(W,_);return}}},a=({action:o,container:{id:c,endTime:d},branches:u=[],isEOV:m=!1,autoSelected:f=!1})=>{let I=it(o,m),A={timestamp:!I.args.shouldOpenNow||m?1/0:d??1/0,priority:"container",initiator:c,actionType:I.type},C=i.emit.bind(i,y.interactives,{subjectId:c,subjectName:"container",type:w.actionChoice,actionType:I.type,payload:{invokeImmediately:I.args.shouldOpenNow,...I.args}}),k=()=>{e.interactiveActionChoice$.next({subjectId:c,subjectName:"container",type:"action-choice",actionType:I.type,payload:{invokeImmediately:I.args.shouldOpenNow,...I.args}})};switch(I.type.trim().toLowerCase()){case g.setNextBranch.trim().toLowerCase():{let L=u.find(O=>O.id===I.args.branchId);if(!L)return;C(),k(),n.add({...A,action:N.bind(null,{subjectId:c,subjectName:"container",action:I,payload:{chapterId:L.chapterId,autoSelect:f}})});return}case g.setMaxWeightBranch.trim().toLowerCase():return;case g.setMinWeightBranch.trim().toLowerCase():return;case g.setRandomBranch.trim().toLowerCase():return;case g.setWeightlessRandomBranch.trim().toLowerCase():return;case g.continuePlayback.trim().toLowerCase():{C(),k(),n.add({...A,action:B.bind(null,{subjectId:c,subjectName:"container",action:I})});return}case g.openURI.trim().toLowerCase():{C(),k(),n.add({...A,action:S.bind(null,{subjectId:c,subjectName:"container",action:I,payload:{URI:o.args.uri}})});return}default:{let L="Unexpected container event",O=new R(1,1,{message:L});v(O,L);return}}};function l({container:o,branches:c,isEOV:d=!1}){let u=Ye(o.events);if(u){let m=it(u.action,d);i.emit(y.interactives,{subjectId:o.id,subjectName:"container",type:w.actionChoice,actionType:m.type,payload:{invokeImmediately:m.args.shouldOpenNow,...m.args}}),e.interactiveActionChoice$.next({subjectId:o.id,subjectName:"container",type:"action-choice",actionType:m.type,payload:{invokeImmediately:m.args.shouldOpenNow,...m.args}}),n.add({timestamp:d?1/0:o.endTime??1/0,priority:"container",initiator:o.id,actionType:g.expect,action:b.bind(null,{subjectId:o.id,subjectName:"container"})}),r.isExpect=!0}else for(let m of o.events??[])a({action:m.action,container:o,branches:c,isEOV:d})}let h=({chapterId:o,action:c,branches:d=[]})=>{let u=i.emit.bind(i,y.interactives,{subjectId:o,subjectName:"chapter",type:w.actionChoice,actionType:c.type,payload:c.args}),m=()=>{e.interactiveActionChoice$.next({subjectId:o,subjectName:"chapter",type:"action-choice",actionType:c.type,payload:c.args})};switch(c.type.trim().toLowerCase()){case g.setNextBranch.trim().toLowerCase():{let f=d.find(I=>I.id===c.args.branchId);return f?.chapterId?(u(),m(),N.bind(null,{subjectId:o,subjectName:"chapter",action:c,payload:{chapterId:f.chapterId,autoSelect:!0}})):void 0}case g.setWeightlessRandomBranch.trim().toLowerCase():{let f=Ot(d);return f?.chapterId?(u(),m(),N.bind(null,{subjectId:o,subjectName:"chapter",action:c,payload:{chapterId:f.chapterId,autoSelect:!0}})):void 0}case g.setRandomBranch.trim().toLowerCase():{let f=jt(d);return f?.chapterId?(u(),m(),N.bind(null,{subjectId:o,subjectName:"chapter",action:c,payload:{chapterId:f.chapterId,autoSelect:!0}})):void 0}case g.setMaxWeightBranch.trim().toLowerCase():{let f=Lt(d);return f?.chapterId?(u(),m(),N.bind(null,{subjectId:o,subjectName:"chapter",action:c,payload:{chapterId:f.chapterId,autoSelect:!0}})):void 0}case g.setMinWeightBranch.trim().toLowerCase():{let f=Nt(d);return f?.chapterId?(u(),m(),N.bind(null,{subjectId:o,subjectName:"chapter",action:c,payload:{chapterId:f.chapterId,autoSelect:!0}})):void 0}case g.continuePlayback.trim().toLowerCase():return u(),m(),B.bind(null,{subjectId:o,subjectName:"chapter",action:c});case g.openURI.trim().toLowerCase():return u(),m(),S.bind(null,{subjectId:o,subjectName:"chapter",action:c,payload:{URI:c.args.uri}});default:{let f="Unexpected chapter event",I=new R(1,1,{message:f});v(I,f);return}}};function v(o,c){console.error(c),e.error$.next(o),i.emit(y.errors,o)}function T(o){let c=Ye(o.events);if(c){if(F(o))return;i.emit(y.interactives,{subjectId:o.id,subjectName:"chapter",type:w.actionChoice,actionType:c.action.type,payload:c.action.args}),e.interactiveActionChoice$.next({subjectId:o.id,subjectName:"chapter",type:"action-choice",actionType:c.action.type,payload:c.action.args}),n.add({timestamp:1/0,priority:"chapter",initiator:o.id,actionType:g.expect,action:b.bind(null,{subjectId:o.id,subjectName:"chapter"})})}else o.events?.forEach(d=>{let u=h({chapterId:o.id,action:d.action,branches:o.branches});u&&n.add({timestamp:1/0,priority:"chapter",initiator:o.id,actionType:d.action.type,action:u})})}let b=({subjectId:o,subjectName:c})=>{t.pause(),i.emit(y.interactives,{subjectId:o,subjectName:c,type:w.actionExecution,actionType:g.expect}),e.interactiveActionExecution$.next({subjectId:o,subjectName:c,type:"action-execution",actionType:g.expect})},E=({subjectId:o,subjectName:c})=>{t.info.isEnded$.getValue()?n.execEndOfVideo():t.play(),i.emit(y.interactives,{subjectId:o,subjectName:c,type:w.actionExecution,actionType:Ft}),e.interactiveActionExecution$.next({subjectId:o,subjectName:c,type:"action-execution",actionType:Ft})},B=({subjectId:o,subjectName:c,subjectType:d,action:u})=>{i.emit(y.interactives,{subjectId:o,subjectName:c,subjectType:d,type:w.actionExecution,actionType:u.type}),e.interactiveActionExecution$.next({subjectId:o,subjectName:c,subjectType:d,type:"action-execution",actionType:u.type})},N=({subjectId:o,subjectName:c,subjectType:d,action:u,payload:m})=>{m.behaviour="change-chapter",i.emit(y.interactives,{subjectId:o,subjectName:c,subjectType:d,type:w.actionExecution,actionType:u.type,payload:m}),e.interactiveActionExecution$.next({subjectId:o,subjectName:c,subjectType:d,type:"action-execution",actionType:u.type,payload:m})},x=({subjectId:o,subjectName:c,subjectType:d,action:u,payload:m})=>{m.behaviour="change-manifest",i.emit(y.interactives,{subjectId:o,subjectName:c,subjectType:d,type:w.actionExecution,actionType:u.type,payload:m}),e.interactiveActionExecution$.next({subjectId:o,subjectName:c,subjectType:d,type:"action-execution",actionType:u.type,payload:m})},S=({subjectId:o,subjectName:c,subjectType:d,action:u,payload:m})=>{if(!m.URI)return;let f=window.open(m.URI,"_blank","noopener,noreferrer");f&&(f.opener=null),i.emit(y.interactives,{subjectId:o,subjectName:c,subjectType:d,type:w.actionExecution,actionType:u.type}),e.interactiveActionExecution$.next({subjectId:o,subjectName:c,subjectType:d,type:"action-execution",actionType:u.type})};return{onControlEvent:p,onContainerEvent:a,onChapterEvent:h,onExpectEvent:b,expectEventHandler:E,setManifestChapterEvents:T,setManifestContainerEvents:l,stopExpect:s,state:r}};import{Subscription as En,Subject as st,ValueSubject as ae}from"@vkontakte/videoplayer-shared/evergreen";var rt=(i,e)=>{let t={};return i.map(n=>{if(!t[n]){let r=e.chapters.find(p=>p.id===n);if(!r)return null;let s=e.media.videos.find(p=>r.videoId===p.id);if(!s)return null;t[n]=Gt(s)}return t[n]}).filter(Boolean)},vn=i=>{for(let e of i.variants)if(gn(e)&&e.payload)return e.payload.id},gn=i=>!!(i.type==="custom"&&i.payload&&i.payload.type==="vk"),Gt=i=>{let e=vn(i);if(!e)return null;let t=e.split("_").pop();return t?parseInt(t,10):null},bn=(i,e)=>{for(let t of i.media.videos)if(e===Gt(t)){for(let n of i.chapters)if(n.videoId===t.id)return n.id;return}},Ut=(i,e)=>i.reduce((t,n)=>{let r=bn(e,n);return r?[...t,r]:t},[]);var oe=class{constructor({globalEventEmitter:e,videoId:t,interactiveController:n,historyApi:r,settings:s}){this.state={history$:new ae([]),hasPrevChapter$:new ae(!1),prevChapter$:new ae(null),isInitialChapter$:new ae(!1),isGoBackLimited$:new ae(!1)};this.#n=null;this.#a=!1;this.#e=null;this.#p=null;this.events={inited$:new st,destroyed$:new st,error$:new st};this.#i=null;this.#r=null;this.#t=null;this.#o=new En;this.#l=!1;this.#c=0;this.#i=t,this.#t=e,this.#r=n,this.#n=r,this.#s=s,this.state.history$&&this.#o&&this.#o?.add(this.state.history$.subscribe(p=>{this.state.prevChapter$.next(p.at(-2)||null),this.state.hasPrevChapter$.next(p.length>1),this.state.isInitialChapter$.next(this.getInitialChapterId()===this.#e?.metadata?.initChapterId),this.state.isGoBackLimited$.next(this.#c===this.#s.maxLength-1)}))}#n;#s;#a;#e;#p;#i;#r;#t;#o;#l;#c;async setManifest(e){if(!this.#r||!this.#t)return;this.#e=e,await this.getProjectHistory();let t=this.getInitialChapterId();await this.#r.setChapter({chapterId:t,pushToHistory:!1}),this.#a||(this.#a=!0,this.events.inited$.next({initChapterId:t}))}get inited(){return this.#a}async updateHistory(e,t=!0){if(!this.#e)return;this.#l?(this.#l=!1,this.#c++):this.#c=0;let n=this.#e,r=e.length-this.#s.maxLength,s=r>0?e.slice(r):e,p=rt(s,n);if(this.#p=p,this.state.history$.next(s),!(!t||!this.#n||!this.#i))try{await this.#n.save(this.#i,p)}catch{let l=new R(1,5,"Unable to save interactive history");this.events.error$.next(l),this.#t?.emit(y.errors,l)}}async goBack(){if(!this.state||!this.#r){let n=new R(1,5,"Unable to save interactive history");return this.events.error$.next(n),this.#t?.emit(y.errors,n)}this.#l=!0;let e=this.state.history$.getValue().slice(0,-1),t=e.pop();this.state.history$.next(e),await this.#r.setChapter({chapterId:t,playPrev:!0})}async getProjectHistory(){if(!this.#e||!this.#i)return;let e=this.#e,t=[this.getInitialVideoId()];if(this.#n)try{let r=await this.#n.get(this.#i);r.length&&(t=r)}catch{let s=new R(1,5,"Error while trying to fetch data");this.events.error$.next(s),this.#t?.emit(y.errors,s)}let n=Ut(t,e);this.state.history$.next(n)}getInitialChapterId(){return this.state.history$.getValue()?.at(-1)||this.#s.initChapterId||this.#e?.metadata.initChapterId}getInitialVideoId(){if(this.#e){let e=this.getInitialChapterId();return rt([e],this.#e).pop()}return null}destroy(){this.#i=null,this.#n=null,this.#r=null,this.#o?.unsubscribe(),this.#o=null,this.#a=!1,this.#t?.emit(y.historyDestroyed),this.events.destroyed$.next(),this.#t=null}};var Le=class{constructor(){this._prevSizeId=0;this.rootElement=document.createElement("canvas")}clear(){this.rootElement.getContext("2d")?.clearRect(0,0,this.rootElement.width,this.rootElement.height)}isImageDrawn(){let e=this.rootElement.getContext("2d")?.getImageData(0,0,this.rootElement.width,this.rootElement.height);if(!e)return!1;let t=e.data,n=t.length;for(let r=3;r<n;r+=40)if(t[r]!==0)return!0;return!1}destroy(){this.rootElement.remove()}show(){this.rootElement.style.visibility="visible"}hide(){this.rootElement.style.visibility="hidden"}setCanvasImageSource(e){this.canvasImgSrc=e}draw(){this.canvasImgSrc&&this.rootElement.getContext("2d")?.drawImage(this.canvasImgSrc,0,0,this.rootElement.width,this.rootElement.height)}async updateCanvasDimensions(e,t=!1){let n=e.width+e.height;if(this._prevSizeId===n)return;let r;t&&(r=await this.save()),this.rootElement.width=e.width,this.rootElement.height=e.height,t&&r&&this.restore(r),this._prevSizeId=n}async save(){let e=this.rootElement.toDataURL("image/jpeg",1),t=new Image;return t.crossOrigin="anonymous",t.src=e,await t.decode(),t}restore(e){this.rootElement&&this.rootElement.getContext("2d")?.drawImage(e,0,0,this.rootElement.width,this.rootElement.height)}};var Oe=class{constructor({parentElement:e,endOffsetMs:t=250,onError:n}){this.currentVideoDurationMs=1/0;this._containerTimeFrameShouldReceived=!1;this._endTimeFrameReceived=!1;this._shouldCallSkip=!1;this.onEachTick=e=>{let t=e??this.lastFrameCanvas.canvasImgSrc.currentTime*1e3,n=this.isChapterEndTime(t);if(this.isContainerTime(t))this._endTimeFrameReceived=!1,this._containerTimeFrameShouldReceived=!0,this._shouldCallSkip=!0;else if(n)this._containerTimeFrameShouldReceived=!1,this._shouldCallSkip=!1,this._endTimeFrameReceived||(this.draw(),this._endTimeFrameReceived=!0,this.show());else{if(this._shouldCallSkip){this._shouldCallSkip=!1;return}this.reset()}};this.onSeek=()=>{this.onEachTick(),!this._containerTimeFrameShouldReceived&&!this._endTimeFrameReceived&&(this.hide(),this.lastFrameCanvas.clear())};this.rootElement=document.createElement("div"),this.rootElement.style.cssText=`
|
|
6
|
+
var lt="1.0.31-dev.4feba7d1.0";function Fe(i,e=1){let t="0",n="0",r="0";return i.length===4?(t="0x"+i[1]+i[1],n="0x"+i[2]+i[2],r="0x"+i[3]+i[3]):i.length===7&&(t="0x"+i[1]+i[2],n="0x"+i[3]+i[4],r="0x"+i[5]+i[6]),`rgba(${+t},${+n},${+r},${e})`}var M="interactive",Zt="interactive-controls-container",pe=()=>document.querySelector(`.${Zt}`),ct=.4,V={textColor:"#000",textSize:.4,textContent:"",roundCorners:0,borderWidth:0,borderColor:"#000",borderAlpha:1,backgroundColor:"#fff",backgroundAlpha:1,innerSizesDependOn:"self",angle:0},pt=(n=>(n.top="flex-start",n.bottom="flex-end",n.center="center",n))(pt||{}),ht=(n=>(n.start="flex-start",n.end="flex-end",n.center="center",n))(ht||{}),dt=(n=>(n.start="left",n.end="right",n.center="center",n))(dt||{}),he=({target:i,props:e})=>{i.style.alignItems=(e?.gravityVertical&&pt[e.gravityVertical])??"center",i.style.justifyContent=(e?.gravityHorizontal&&ht[e.gravityHorizontal])??"center",i.style.textAlign=(e?.alignment&&dt[e.alignment])??"center"},de=({target:i,props:e,fallback:t,dependsOn:n})=>{i.style.color=e?.text?.color??t.textColor,i.style.fontSize=`calc(${n.height} * ${e?.text?.size??t.textSize})`,i.textContent=e?.text?.value??t.textContent},ue=({target:i,props:e,fallback:t})=>{i.style.backgroundColor=Fe(e?.background?.color??t.backgroundColor,e?.background?.alpha??t.backgroundAlpha)},me=({target:i,props:e,fallback:t,dependsOn:n})=>{i.style.border=`calc(${n.height} * ${e?.shape?.border?.width??t.borderWidth}) solid ${Fe(e?.shape?.border?.color??t.borderColor,e?.shape?.border?.alpha??t.borderAlpha)}`,i.style.borderRadius=`calc(${n.height} * ${e?.shape?.roundCorners??t.roundCorners})`},K=({target:i,layoutParams:e,fallback:t})=>{let n=e.angle??t.angle;n=n&&n*-1,i.style.transform=`rotate(${n}rad)`};var H=class{constructor(e){this.control=e;this.container=null;this.controlElement=null;this.clickListener=null}createContainerElement(e){let t=document.createElement("div");t.classList.add(`${M}-control-container-${this.control.id}`),e(t,this.control.layoutParams);let n=(this.control.layoutParams.innerSizesDependOn??V.innerSizesDependOn)==="self"?{height:t.style.height,width:t.style.width}:{height:"var(--interactive-content-height)",width:"var(--interactive-content-width)"};this.container={element:t,dimensions:n}}createClickListener(e){return t=>{t.stopPropagation(),e()}}setEvents(e){!this.container||!this.control.events||this.control.events.forEach(t=>{switch(t.type.trim().toLowerCase()){case"onclick":this.clickListener=this.createClickListener(()=>e({action:t.action,controlId:this.control.id,controlType:this.control.type})),this.container?.element.addEventListener("click",this.clickListener);break;default:break}})}removeListeners(){this.container?.element&&this.clickListener&&this.container?.element.removeEventListener("click",this.clickListener)}};var _e="int",D=(n=>(n.AREA=`${_e}_area`,n.TEXT=`${_e}_text`,n.BUTTON=`${_e}_bttn`,n))(D||{});var fe=i=>{if(i.type.trim().toLowerCase()==="area")return new He(i)},He=class extends H{constructor(e){super(e)}createView({parentElement:e,layoutCallback:t}){if(super.createContainerElement(t),!this.container)return;let n=document.createElement("button");n.type="button",n.classList.add(`${M}-${this.control.id}`),n.setAttribute("data-testid",D.AREA),n.style.display="flex",n.style.width="100%",n.style.height="100%",n.style.cursor="pointer",ue({target:n,props:this.control.props,fallback:{...V,backgroundColor:"transparent"}}),me({target:n,props:this.control.props,fallback:{...V,borderAlpha:0},dependsOn:this.container.dimensions}),K({target:n,layoutParams:this.control.layoutParams,fallback:V}),this.container.element.append(n),e.append(this.container.element),this.controlElement=n}disable(){this.controlElement&&(this.controlElement.style.cursor="default")}enable(){this.controlElement&&(this.controlElement.style.cursor="pointer")}getElement(){return this.controlElement}};var ye=i=>{let e=document.createElement("span");switch(i){case"Button":case"button":{let t=document.createElement("div"),n={overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center"};Object.assign(t.style,n),t.append(e);let r={display:"inline-block",whiteSpace:"pre",textOverflow:"ellipsis",maxWidth:"initial",maxHeight:"100%",wordBreak:"normal"};return Object.assign(e.style,r),t}default:{let t={display:"inline-block",whiteSpace:"break-spaces",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",maxHeight:"100%",wordBreak:"break-all"};return Object.assign(e.style,t),e}}};var Ce=i=>{if(i.type.trim().toLowerCase()==="button")return new De(i)},De=class extends H{constructor(e){super(e)}createView({parentElement:e,layoutCallback:t}){if(super.createContainerElement(t),!this.container)return;let n=document.createElement("button");n.type="button",n.classList.add(`${M}-${this.control.id}`),n.setAttribute("data-testid",D.BUTTON),n.style.display="flex",n.style.width="100%",n.style.height="100%",n.style.cursor="pointer",n.style.fontFamily="inherit",K({target:n,layoutParams:this.control.layoutParams,fallback:V}),ue({target:n,props:this.control.props,fallback:V}),me({target:n,props:this.control.props,fallback:V,dependsOn:this.container.dimensions}),he({target:n,props:{...this.control.props.text,alignment:this.control.layoutParams.alignment}});let r=ye(this.control.type.trim().toLowerCase()),s=r.firstElementChild??r;de({target:s,props:this.control.props,fallback:V,dependsOn:this.container.dimensions}),n.append(r),this.container.element.append(n),e.append(this.container.element),this.controlElement=n}disable(){this.controlElement&&(this.controlElement.style.cursor="default")}enable(){this.controlElement&&(this.controlElement.style.cursor="pointer")}getElement(){return this.controlElement}};var ut=i=>{if(i.type.trim().toLowerCase()==="text")return new Ge(i)},Ge=class extends H{constructor(e){super(e)}createView({parentElement:e,layoutCallback:t}){if(super.createContainerElement(t),!this.container)return;let n=document.createElement("div");n.classList.add(`${M}-${this.control.id}`),n.setAttribute("data-testid",D.TEXT),n.style.display="flex",n.style.width="100%",n.style.height="100%",n.style.fontFamily="inherit",K({target:n,layoutParams:this.control.layoutParams,fallback:V}),he({target:n,props:{...this.control.props.text,alignment:this.control.layoutParams.alignment}});let r=ye(this.control.type.trim().toLowerCase()),s=r.firstElementChild??r;de({target:s,props:this.control.props,fallback:V,dependsOn:this.container.dimensions}),n.append(r),this.container.element.append(n),e.append(this.container.element),this.controlElement=n}disable(){}enable(){}getElement(){return this.controlElement}};var Ue=class{constructor(e){this.layout=e}},ve=class extends Ue{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 X=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(){return this.container.controls?.reduce((e,t)=>{let n=t.type.trim().toLowerCase(),r=this.factories.get(n);if(r){let s=r(t);if(s)return[...e,s]}return[...e]},[])||[]}};var ge=(i,e)=>{if(i.type.trim().toLowerCase()==="choice")return new ze(i,e)},ze=class extends X{constructor(e,t){super(e),this.rootElement=t??pe(),this.layout=new ve(this.container.layout),this.isRemoved=!1,this.isDisabled=!1,this.addControlFactory("button",Ce),this.addControlFactory("text",ut),this.addControlFactory("area",fe)}createView(e){let t=document.createElement("div");return t.classList.add(`${M}-${this.container.id}`),this.layout.setContainerLayout(t),this.controls.forEach(n=>{n.createView({parentElement:t,layoutCallback:this.layout.setControlLayout}),n.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=`${ct}`,this.isDisabled=!0)}removeView(){this.isRemoved||(this.controls.forEach(e=>e.removeListeners()),this.getElement()?.remove(),this.isRemoved=!0)}getElement(){return this.rootElement.querySelector(`.${M}-${this.container.id}`)}};import{clientChecker as In,combine as Tn,InterfaceLanguage as xn,Observable as Wt,once as Sn,Subject as P,Subscription as at,ValueSubject as $,fromEvent as Qt}from"@vkontakte/videoplayer-shared/evergreen";import{InteractiveInterfaceClick as le}from"@vkontakte/videoplayer-statistics/evergreen";import{loadVKLangPack as qt}from"@vkontakte/videoplayer-shared/evergreen";function Y(i,e){let t;return(...n)=>{clearTimeout(t),t=setTimeout(()=>i(...n),e)}}var G=(i,e)=>Object.prototype.toString.call(i)===`[object ${e}]`,J=i=>G(i,"Object"),be=i=>G(i,"String"),Ee=i=>G(i,"Array"),Ie=i=>G(i,"Number"),mt=i=>G(i,"Function");var We=i=>Ie(i)&&!isNaN(i);var U=i=>J(i)&&Object.keys(i).length===0,Qe=i=>Ee(i)&&!i.length;var ee=(i,e)=>be(i)&&(e?i.trim():i).length;var ft="video_interactive",yt="videoint";var Ct=250,te=class{constructor(e){this.handleZoomChange=Y(e=>{this.lastZoomInfo=e},Ct);this.onResize=e=>{if(!this.isReady||this.isHidden||!e[0].contentRect.width||!e[0].contentRect.height)return;let t=this.getNextPoint();t&&this.ngEditor?.zoomTo(t),this.ngEditorSize={width:e[0].contentRect.width,height:e[0].contentRect.height}};this.handleChapterChange=e=>{if(this.manifest){if(this.isHidden||this.hide(),!e?.id){this.onError?.("Id is not found"),console.error("Id is not found");return}this.visitedChapterIds.add(e.id),this.ngEditor?.selectChapter(e.id),this.ngEditor?.setVisitedChapters(Array.from(this.visitedChapterIds)),this.currentChapterId=e.id,this.lastZoomInfo=null}};this.handleManifestChange=(e,t=[])=>{if(this.isReady=!1,!Ie(e.graph.edit.chapters[0].x)){this.onError?.("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:n,lang:r,visitedChapters:s=[]}){this.isReady=!1,this.isHidden=!0,this.manifest=null,this.visitedChapterIds=new Set(s),this.onOpenPreviewClick=t,this.onError=n,this.lang=r??"ru",this.zoom=.7,this.lastZoomInfo=null,this.currentManifestId=null,this.currentChapterId=null,this.ngEditor=null,this.ngEditorSize=null,this.graphWrapperElement=Yt(e),this.resizeObserver=new ResizeObserver(Y(this.onResize,Ct)),this.resizeObserver.observe(this.graphWrapperElement)}getNextPoint(e=this.ngEditorSize){return!this.lastZoomInfo||!e?null:[(this.lastZoomInfo.x-e.width/2)/this.lastZoomInfo.value*-1,(this.lastZoomInfo.y-e.height/2)/this.lastZoomInfo.value*-1]}setVisitedChapters(e){this.visitedChapterIds=new Set([...this.visitedChapterIds,...e]),this.ngEditor?.setVisitedChapters(Array.from(this.visitedChapterIds))}updateVideosInfo(e){this.ngEditor?.updateVideosInfo(e)}async show(){this.manifest&&(this.ngEditor||await this.initNgEditor(),this.graphWrapperElement.style.display="block",!this.lastZoomInfo&&this.currentChapterId&&this.ngEditor?.focusChapter(this.currentChapterId),this.isHidden=!1)}async initNgEditor(){if(!this.manifest)return;let e;try{e=await qt(this.lang,ft,yt)}catch{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:n,...r})=>{n==="openPreview"&&"chapterId"in r&&this.onOpenPreviewClick?.(r.chapterId)}),this.ngEditor.on("zoom",this.handleZoomChange),this.isReady=!0}hide(){this.graphWrapperElement.style.display="none",this.isHidden=!0}destroy(){this.hide(),this.manifest=null,this.resizeObserver.disconnect(),this.ngEditor?.setVisitedChapters([]),this.onOpenPreviewClick=void 0,this.ngEditor?.dispose(),this.graphWrapperElement.remove(),this.isReady=!1}};function Yt(i){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",i.append(e),e}var ne=class{constructor(){this._containers=[];this._player=null;this.setPlayer=e=>{this._player=e};this.setContainers=e=>{this._containers=e};this.deleteContainer=e=>{this._containers=this._containers.filter(t=>t.id!==e)};this.getNextInteractiveTime=(e=3e3)=>{if(!this._containers.length||this._player===null)return null;let t=-1,n=!1,r=Math.round(this._player.info.position$.getValue()*1e3);for(let s of this._containers){let p=s.startTime-e;if(p<=r&&(s.endTime&&r<=s.endTime||s.endTime===null)){n=!0;break}r<p&&(t=t===-1?p:Math.min(t,p))}return!n&&t!==-1?t:null}}};import{isSupportedManifest as xe,ContainerTypes as Bi,ControlTypes as Se,EventActionTypes as g,EventTypes as Fi,migrateManifestToLatestVersion as bt,compareVersions as _i}from"@interactiveplatform/movika-manifest";var vt={metadata:"Object",chapters:"Array"},gt=i=>{if(!J(i))return!1;for(let e in vt)if(!i[e]||!G(i[e],vt[e]))return!1;return xe(i.metadata.version)},Te=i=>i.type===Se.Text,Ri=i=>i.type===Se.Button,Vi=i=>i.type===Se.Area,Mi={Choice:"Choice",TextInput:"TextInput"},Pi={Button:"Button",Area:"Area",Text:"Text"},$i={onClick:"onClick",onSuspense:"onSuspense"},Ni={openURI:"openURI",setNextBranch:"setNextBranch",setWeightlessRandomBranch:"setWeightlessRandomBranch",setRandomBranch:"setRandomBranch",setMaxWeightBranch:"setMaxWeightBranch",setMinWeightBranch:"setMinWeightBranch",setDefaultBranch:"setDefaultBranch",continuePlayback:"continuePlayback",expect:"expect"};var R=class{constructor(e,t,...n){this.severity=e;this.category=t;this.data=n}toString(){return`Interactive SDK error ${JSON.stringify(this,null," ")}`}};var we=class{constructor(){this.listeners={}}addListener(e,t){return this.listeners[e]=this.listeners[e]||[],this.listeners[e].push(t),this}on(e,t){return this.addListener(e,t)}once(e,t){this.listeners[e]=this.listeners[e]||[];let n=()=>{t(),this.off(e,n)};return this.listeners[e].push(n),this}off(e,t){return this.removeListener(e,t)}reset(){this.listeners={}}removeListener(e,t){let n=this.listeners[e]||[];for(let r=n.length;r>0;r--)if(n[r]===t){n.splice(r,1);break}return this}emit(e,...t){let n=this.listeners[e];return n?(n.forEach(r=>{r(...t)}),!0):!1}listenerCount(e){return this.rawListeners(e).length}rawListeners(e){return this.listeners[e]||[]}};var Ae=class{constructor(e){this.fns=[];this.addFn=(e,t=!1)=>{mt(e)&&(this.fns.push(e),t&&this.updateFn())};this.removeFn=(e,t=!1)=>{this.fns=this.fns.filter(n=>n!==e),t&&this.updateFn()};this.updateFn=()=>{this.fn=()=>{this.fns.forEach(e=>e()),this.raf&&this.forceRequestAnimation()}};this.forceRequestAnimation=()=>{this.fn&&(this.raf=requestAnimationFrame(this.fn))};this.requestAnimation=()=>{this.raf||this.forceRequestAnimation()};this.cancelAnimation=()=>{this.raf&&(cancelAnimationFrame(this.raf),this.raf=void 0)};e&&(this.fn=e,this.addFn(e))}release(){this.cancelAnimation(),this.fn=void 0,this.fns=[]}};import{ValueSubject as an}from"@vkontakte/videoplayer-shared/evergreen";var ke=class{constructor(e){this.loaders={chapterLoaders:e?.chapterLoaders??[],manifestLoaders:e?.manifestLoaders??[]}}async exec(e,t){return Jt(...this.loaders[e])(t)}};function Jt(...i){return async function(t){let n=[...i];for(;n.length>0;)t=await n.shift()(t);return t}}function ie(i,e,t){return i?{...i,[e]:i[e]?[t,...i[e]]:[t]}:{[e]:[t]}}function Re({actions:i,errors:e,chapterId:t,...n}){if(t){let r=i.getManifest();if(r){let s=i.getChapter(r.chapters,t);if(s){let p=i.getMedia(r.media,s.videoId),a=i.getGraph(r.graph,s.id);return p?{...n,actions:i,errors:e,result:{chapter:s,media:p,graph:a}}:{...n,errors:ie(e,Re.name,"Could not find media"),actions:i}}}}return{...n,errors:ie(e,Re.name,"Could not find chapter"),actions:i}}var Ke=(i="",e="")=>{let t=i.split("."),n=e.split("."),r=0;for(let s=0;s<Math.max(t.length,n.length)&&!r;s++)t[s]>n[s]?r=1:t[s]<n[s]?r=-1:r=0;return r};var en=async i=>{try{let e={},t;if(be(i)){t=new URL(i).href;let r=await fetch(t);if(!r.ok)return{};e=await r.json()}else if(J(i))e=i;else return{};if(!gt(e))return{};let n=e.metadata.media;if(be(n)&&!("media"in e))try{let r;t?r=new URL(n,t).href:(r=new URL(n).href,t=r);let s=await fetch(r);if(!s.ok)throw new Error;e.metadata.media=await s.json()}catch{return rn(e.metadata.version)?{manifest:e}:{}}return{manifest:e,manifestURL:t}}catch{return{}}};async function Et(i){let{manifest:e,manifestURL:t}=await en(i);if(!e)throw new Error("Failed on fetch");let n=bt(e);return n.media=tn(n.media,t),delete n.metadata.media,n}function Ve(i,e){if(e)return i.find(t=>t.id===e)}function Xe(i,e){return i.edit?.chapters?i.edit.chapters.find(t=>t.id===e):i.view?.chapters?i.view.chapters.find(t=>t.id===e):void 0}function Ze(i,e){return i.videos.find(t=>t.id===e)}function tn(i,e){return{...i,videos:i.videos.map(t=>({...t,variants:t.variants.map(n=>{let r="url"in n?n.url:"",s=nn(r,e);return{...n,url:s||r}})}))}}function nn(i="",e){try{return new URL(i,e).href}catch{return""}}function rn(i){return Ke(i,"3.2.0")>=0}var Me=i=>Ee(i)&&!Qe(i),F=i=>i.order==="end",Pe=i=>Ee(i.containers)&&!Qe(i.containers)&&F(i),It=(i,e)=>{let t=i*1e3;return Me(e.controls)&&t<(e.startTime??0)},qe=(i,e)=>{let t=i*1e3;return Me(e.controls)&&t>=(e.startTime??0)&&t<=(e.endTime??1/0)};var z=(i=[])=>i.some(e=>e.action.type==="expect"),Ye=(i=[])=>i.find(e=>e.action.type==="expect"),sn=i=>i?.length===1,Z=i=>sn(i)&&Te(i[0]);function Tt(i,...e){return t=>typeof e[0]=="object"&&typeof t=="object"?i({...e[0],...t}):i(...e,...t)}var xt=(i,e)=>z(i.events)?!1:e.some(({container:t})=>t.container.id!==i.id&&z(t.container.events)&&t.container.endTime===i.endTime&&!t.isRemoved);var q=class extends ke{constructor(t,n){super(t);this.manifest=null;this.chapter=null;this.media=null;this.graph=null;this.prevChapter$=new an(null);this.onError=n,this.release()}release(){return this.manifest=null,this.chapter=null,this.media=null,this.graph=null,this.prevChapter$.next(null),this}async setManifest(t){this.release();let n=await this.exec("manifestLoaders",{actions:{addErrorMessage:ie},result:null,errors:null,source:t});return n.errors&&this.errorHandler(n.errors),this.manifest=await Et(n.result??t),this}async setInitial(){return this.setNext()}async setNext(t=this.manifest?.metadata.initChapterId){if(!t)return this;this.prevChapter$.next(this.chapter);let n=await this.exec("chapterLoaders",Re({actions:{getManifest:()=>this.manifest,getCurrent:this.getCurrent,getGraph:Xe,getChapter:Ve,getMedia:Ze,getByBranches:this.getByBranches.bind(this),addErrorMessage:ie},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(){return this.getByChapterId(this.manifest?.metadata.initChapterId)||null}getByChapterId(t=this.manifest?.metadata.initChapterId){if(!t||!this.manifest)return null;let n=Ve(this.manifest.chapters,t);if(n){let r=Ze(this.manifest.media,n.videoId),s=Xe(this.manifest.graph,n.id);if(r)return{chapter:n,media:r,graph:s}}return null}getBranches(t=this.chapter?.id){if(t===this.chapter?.id)return this.getByBranches(this.chapter?.branches);{let n=Ve(this.manifest?.chapters||[],t);return this.getByBranches(n?.branches)}}getByBranches(t=[]){return t.reduce((n,r)=>{let s=this.getByChapterId(r.chapterId);return s&&n.push(s),n},[])}getCurrent(){return{chapter:this.chapter,media:this.media,graph:this.graph}}isInitialChapter(){return this.chapter?.id===this.manifest?.metadata.initChapterId}isEndChapter(){return this.chapter?F(this.chapter):!1}};import{Player as on}from"@vkontakte/videoplayer-core/evergreen";import{Subscription as tt,Tracer as ln,ValueSubject as cn}from"@vkontakte/videoplayer-shared/evergreen";var St=i=>{let e=i.variants.find(t=>t.payload?.type==="vk");if(e&&e.payload){let[t,n]=e.payload.id.split("_");return[t,n]}return[]};function Je(){let i=new Map;function e({listId:s=Math.random().toString(),itemId:p=Math.random().toString(),...a}){let l=i.get(s),h={...a};return l?l[p]=h:i.set(s,{[p]:h}),{listId:s,itemId:p,...a}}function t(s){s.player.destroy(),s.container.remove(),s.subscription.unsubscribe(),s.statistics?.oneStat.destroy(),s.statistics?.statSubscription.unsubscribe()}function n(s,p){let a=i.get(s);if(!a)throw Error("Can't remove. Not find.");if(p){let l=a[p];l&&t(l),delete a[p],Object.keys(a).length||i.delete(s)}else{for(let l of Object.values(a))t(l);i.delete(s)}}function r(){for(let s of i)n(s[0])}return{createPlayer:e,removePlayer:n,map:i,removeAll:r}}function et(i,e=[]){let t={},n,r=!e.length;for(let s of i.variants)if(!n&&"cover"in s&&(n=s.cover),"url"in s)switch(s.type.toLowerCase()){case"mp4":(r||e.includes("mp4"))&&(t.MPEG={...t.MPEG,[s.standard??"Invariant quality"]:s.url});break;case"mpeg":(r||e.includes("mpeg"))&&(t.MPEG={...t.MPEG,[s.standard??"Invariant quality"]:s.url});break;case"hls":(r||e.includes("hls"))&&(t={...t,HLS:{type:"url",url:s.url}});break;case"dash":(r||e.includes("dash"))&&(t={...t,DASH_SEP:{compatibilityMode:!0,type:"url",url:s.url}});break;default:break}return{sources:t,thumbUrl:n,title:i.title??""}}var re=(i,e)=>{let t=i.info.currentQuality$.getValue(),n=i.info.availableQualities$.getValue();t!==e&&n.includes(e)&&(i.setQuality(e),i.setAutoQuality(!1))};var pn=2;function nt(i){let e=Je(),t=new tt,n={},r=null,s=!1,p,a=new cn(null);i&&l(i);function l(x){r=x}function h(x,S,o){if(!r)throw Error("need to set interactive controller");if(!r.options)return;let d=(e.map.get(x)??{})[S];if(d){n={chapterId:o,listId:x,itemId:S,...d};let u=n.player;n.subscription.add(u.info.currentQuality$.subscribe(m=>{let f=u.info.position$.getValue(),I=u.info.isAutoQualityEnabled$.getValue();if(!(!m||!f||I))for(let A of e.map)Object.values(A[1]).forEach(({player:C})=>{re(C,m)})})).add(u.events.started$.subscribe(()=>{v(S)})),d.container.remove(),r.setPlayer(d.player),s||(r.init(),s=!0),a.next({player:n.player,config:n.config,statistics:n.statistics});return}throw Error("Can't set. Not find.")}async function v(x){if(!r)throw Error("need to set interactive controller");if(U(n)||x!==n.itemId)return;let S=r.getChapterBranches(),o=new Set;for(let c of S)o.has(c.media.id)||(await b({media:c.media,chapterId:c.chapter.id,setAsActive:!1,title:c.chapter.label}),o.add(c.media.id))}async function T({chapter:{id:x},manifestVideo:S}){if(U(n)||!r)return;let o=n.player.info.muted$.getValue(),c=n.player.info.currentQuality$.getValue(),d=n.player.info.isAutoQualityEnabled$.getValue(),u=n.player.info.volume$.getValue(),m=n.player.info.currentPlaybackRate$.getValue(),f=!d,I=!1;for(let A of e.map)if(A[0]===S.id&&!r.state.isReplay$.getValue()){let C=Object.keys(A[1]);for(let k of C)k===n.itemId?(C.length<pn||(I=!0),e.removePlayer(A[0],k)):(I=!0,h(A[0],k,x),f?re(n.player,c):n.player.setAutoQuality(!0),n.player.setVolume(u),n.player.setMuted(o),n.player.setPlaybackRate(m))}else e.removePlayer(A[0]);I||(await b({media:S,chapterId:x,setAsActive:!0,playbackRate:m}),f?re(n.player,c):n.player.setAutoQuality(!0),n.player.setVolume(u),n.player.setMuted(o))}async function b({media:x,chapterId:S,prefetch:o=!0,setAsActive:c=!0,autoplay:d=!1,preferredExt:u,title:m,playbackRate:f}){let I=Math.random().toString(),A=document.createElement("div");p.append(A);let C;if(r?.options?.vkVideoLoader){let ce=St(x);ce.length&&(C=await r.options.vkVideoLoader(...ce))}let k=r?.options?.coreConfig||void 0,L={...k,configName:[...k?.configName??[],"interactive"]},O={container:A,...C?.videos?.[0]||{sources:et(x,u).sources},title:m,failoverHosts:C?.failoverHosts||[]},j=new on(L,ln.createRootTracer());j.initVideo(O);let _=null;if(C?.videos&&r?.options.createOneStat){let ce=C.videos[0],Be=r.options.createOneStat(ce),ot=new tt;Be&&(ot.add(Be.attachTo(j)),_={oneStat:Be,statSubscription:ot})}let W=new tt,Xt=n?.player?.info.isAutoQualityEnabled$.getValue();W.add(j.events.canplay$.subscribe(function(){Xt||re(j,n.player.info.currentQuality$.getValue()),f&&j.setPlaybackRate(f)}));let Q=e.createPlayer({listId:x.id,itemId:I,player:j,container:A,sources:et(x,u).sources,config:O,subscription:W,statistics:_});return c&&h(x.id,Q.itemId,S),d&&Q.player.play(),o&&!d&&Q.player.prepare(),{player:Q.player,config:Q.config,statistics:Q.statistics}}function E(){B(),r=null,p.remove()}function B(){t.unsubscribe(),e.removeAll(),n={},s=!1}async function N(){if(!r)throw Error("need to set interactive controller");B(),p=document.createElement("div");let{media:x,chapter:S}=r.getCurrentChapter();x&&S?(t.add(r.events.chapterChanged$.subscribe(T)),await b({media:x,chapterId:S.id,title:S.label})):console.error("not found")}return{...e,init:N,setInteractiveController:l,createPlayer:b,removeAll:E,getActivePlayer:function(){return n},activePlayerChanged:a}}var y={graph:"graph",interactives:"interactives",chapterChanged:"chapter-changed",playerChanged:"player-changed",manifestChanged:"manifest-changed",errors:"errors",eachTick:"eachTick",historyInited:"history-inited",historyDestroyed:"history-destroyed"},se={visibility:"visibility",watchAgainClicked:"watchAgainClicked"},w={actionChoiceCanceled:"action-choice-canceled",actionChoice:"action-choice",actionExecution:"action-execution",visibility:"visibility",containerRemoved:"container-removed",rangeEnded:"range-ended"};import{Subscription as hn}from"@vkontakte/videoplayer-shared/evergreen";var $e=class{constructor({player:e,container:t,branches:n,selectBranches:r,interactiveEvents:s,globalEvents:p,globalEventEmitter:a,ignoreContainerEvent:l,permanentTextControls:h,disabledControls$:v,onRemove:T}){this.hide=()=>{setTimeout(()=>{this.gameState!==4&&(z(this.container.container.events)&&this.gameState===3||this.selectBranches.state.isExpect||(this.gameState!==2&&this.container.hide?.(),this.emitContainerVisibilityEvent(!1)))})};this.show=()=>{if(this.gameState!==2||this.isSelectedControlEvent)return;if(this.container.getElement())this.container.show?.(),this.emitContainerVisibilityEvent(!0,!1);else{let t={isDisabled:()=>this.container.isDisabled,branches:this.branches,containerId:this.container.container.id,onDetachContainer:()=>{this.removeView(),this.emitContainerVisibilityEvent(!1)},onEvent:(r,s)=>{this.isSelectedControlEvent=!0,r!==!1&&(this.removeView(),this.emitContainerVisibilityEvent(!1)),(this.gameState===4||this.gameState===3||this.selectBranches.state.isExpect)&&(this.selectBranches.stopExpect(),s(),this.removeView(),this.emitContainerVisibilityEvent(!1))},isEOV:()=>this.gameState===4},n=Tt(this.selectBranches.onControlEvent,t);this.container.createView(n),this.emitContainerVisibilityEvent(!0,!0),this.disabledControls$.getValue()&&this.container.disable?.()}};this.onEndOfVideo=()=>{this.gameState=4,this.selectContainerEvent(!0)};this.whilePlaying=()=>{let e=this.player.experimental.element$.getValue(),n=e instanceof HTMLVideoElement?e.readyState:void 0,r=[6,5];if(!n||r.includes(this.gameState)&&!this.isPermanentText)return;let s=this.player.getExactTime();if(It(s,this.container.container))this.gameState!==1&&(this.gameState=1,this.onBeforeStartTime());else if(qe(s,this.container.container))this.gameState!==2&&(this.gameState=2,this.onStartTime());else if(this.gameState!==3){let h=this.gameState;this.gameState=3,h===2&&this.onEndTime()}else this.isPermanentText||this.removeView();let p=qe(s,this.container.container),a=this.container.container.startTime?[this.container.container.startTime,this.container.container.endTime??1/0]:[],l={subjectId:this.container.container.id,subjectName:"container",range:a,currentTime:s,isInteractiveTime:p};this.globalEventEmitter.emit(y.eachTick,l),this.globalEvents.eachTick$.next(l)};this.container=t,this.branches=n,this.selectBranches=r,this.subscription=new hn,this.player=e,this.interactiveEvents=s,this.ignoreContainerEvent=l,this.isPermanentText=h&&Z(t.container.controls),this.disabledControls$=v,this.onRemove=T,this.globalEventEmitter=a,this.gameState=0,this.globalEvents=p,this.isSelectedControlEvent=!1,this.isSelectedContainerEvent=!1,this.registerEvents()}emitContainerVisibilityEvent(e,t=!1){e?(this.globalEventEmitter.emit(y.interactives,{subjectId:this.container.container.id,subjectName:"container",type:w.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(y.interactives,{subjectId:this.container.container.id,subjectName:"container",type:w.visibility,visibility:!1}),this.globalEvents.interactiveVisibilityChanged$.next({subjectId:this.container.container.id,subjectName:"container",type:"visibility",visibility:e}))}registerEvents(){this.subscription.add(this.player.events.playing$.subscribe(this.show)).add(this.player.events.paused$.subscribe(this.hide)).add(this.player.events.ended$.subscribe(this.onEndOfVideo)).add(this.disabledControls$.subscribe(e=>{e?this.container.disable?.():this.container.enable?.()}))}selectContainerEvent(e=!1){this.interactiveEvents.containersEventsCallState.setCalled({timestamp:e?1/0:this.container.container.endTime??1/0,id:this.container.container.id}),!(this.isSelectedControlEvent||this.isSelectedContainerEvent)&&(this.isSelectedContainerEvent=!0,this.ignoreContainerEvent()||this.selectBranches.setManifestContainerEvents({container:this.container.container,branches:this.branches,isEOV:e}),!e&&this.interactiveEvents.exec(this.container.container.endTime??1/0))}onStartTime(){this.show()}onEndTime(){this.selectContainerEvent(!1);let e=z(this.container.container.events)||this.ignoreContainerEvent();(this.isSelectedControlEvent||!e)&&this.removeView()}onBeforeStartTime(){this.container.hide?.(),this.emitContainerVisibilityEvent(!1)}reset(){this.isSelectedControlEvent=!1,this.isSelectedContainerEvent=!1,this.gameState=1}removeView(){this.container.removeView(),this.globalEventEmitter.emit(y.interactives,{subjectId:this.container.container.id,subjectName:"container",type:w.containerRemoved,visibility:!1}),this.globalEvents.interactiveContainerRemoved$.next({subjectId:this.container.container.id,subjectName:"container",type:"container-removed"}),this.gameState=5,this.onRemove?.()}destroy(){this.reset(),this.removeView(),this.gameState=6,this.subscription.unsubscribe(),this.branches=[],this.interactiveEvents.containersEventsCallState.setCalled({timestamp:this.container.container.endTime??1/0,id:this.container.container.id})}};var At=(i=[])=>i.reduce((e,t,n)=>{let r=(t?.controls??[]).filter(s=>!Te(s));if(Me(r)){let s=[t.startTime??0,t.endTime??1/0],p=t.id;if(!n)e.push({subjects:[p],range:s});else{let a=[],l=-1/0,h=1/0,v=[],T=[];for(let b=0;b<e.length;b++){let E=e[b];if(T.push(...E.subjects),E.range[0]<h&&(h=E.range[0]),E.range[1]>l&&(l=E.range[1]),s[0]>=E.range[0]&&s[1]<=E.range[1])return e[b].subjects.push(p),e;s[0]<E.range[0]&&s[1]>E.range[0]&&(a.push(b),v=v.concat(E.subjects)),s[0]>=E.range[0]&&s[0]<=E.range[1]&&(a.push(b),v=v.concat(E.subjects),s[0]=E.range[0]),s[1]>=E.range[0]&&s[1]<=E.range[1]&&(a.push(b),v=v.concat(E.subjects),s[1]=E.range[1])}if(T.push(p),s[0]<=h&&s[1]>=l)return[{subjects:T,range:s}];a.length&&a.reverse().forEach(b=>{e.splice(b,1)}),e.push({subjects:v.concat([p]),range:s})}}return e},[]).sort((e,t)=>e.range[0]-t.range[0]);function kt(){let i={};function e(){for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&delete i[a]}function t(a){let l={};for(let h in i)+h<=a&&(l[h]=i[h]);return l}function n(a){let l={};for(let h in i)+h>=a&&(l[h]=i[h]);return l}function r({timestamp:a,priority:l,initiator:h}){if(We(a)){let v=i[a]??null;if(v&&l&&ee(l,!0)){let T={},b=v[l];return b&&(T={...T,...b}),T=U(T)?null:T,T&&ee(h,!0)?T[h]??null:T}return v}return null}function s({timestamp:a,priority:l,initiator:h}){if(We(a))if(i[a]){if(l&&ee(l,!0))if(i[a][l]){if(h&&ee(h,!0))if(i[a][l][h]){if(delete i[a][l][h],!U(i[a][l]))return!0}else return!1;if(delete i[a][l],!U(i[a]))return!0}else return!1;return delete i[a]}else return!1;return!1}function p({timestamp:a,priority:l,initiator:h,...v}){i[a]?.[l]?.[h]?i[a][l][h].push({...v}):i[a]?.[l]?i[a][l]={...i[a][l],[h]:[{...v}]}:i[a]?i[a]={...i[a],[l]:{[h]:[{...v}]}}:i[a]={[l]:{[h]:[{...v}]}}}return{map:i,remove:s,add:p,removeAll:e,get:r,getLte:t,getGte:n}}var dn=[g.expect,g.setNextBranch],un=1/0;function Rt(i){let e=i,t,n=mn(),r=kt(),s,p=()=>{b(),S()},a=o=>{r.add.call(void 0,o),B()},l=(o=[])=>{for(let c of o)if(c.action(),dn.includes(c.actionType))break},h=(o=1/0)=>{let c=Ne(r.get({timestamp:o,priority:"control"})??{}),d=Ne(r.get({timestamp:o,priority:"container"})??{}),u=Ne(r.get({timestamp:o,priority:"chapter"})??{});return[...c,...d,...u]},v=o=>{n.isReady(o)&&l(h(o))},T=()=>{l([...Ne(r.get({timestamp:1/0,priority:"chapter"})??{})])},b=()=>{t&&(s?.unsubscribe(),t=void 0)},E=o=>{},B=()=>{t||(t=()=>setTimeout(()=>{v(1/0)}),s=e.events.ended$.subscribe(t))},N=o=>{b(),e=o},x=o=>{o.priority==="container"&&n.resetCalled(o.timestamp),r.remove(o)},S=()=>{n.release(),r.removeAll()};return{setPlayer:N,add:a,remove:x,exec:v,execEndOfVideo:T,listen:B,unlisten:b,release:p,containersEventsCallState:n,getPreparedToExecActions:h}}function mn(){let i=new Map;return{setCalled:({timestamp:p,id:a})=>{let l=i.get(p);l&&l[a]!==void 0&&(l[a]=!0)},setData:(p=[])=>{for(let a of p){let l=a.endTime??un,h=i.get(l);i.set(l,{...h,[a.id]:!1})}},resetCalled:p=>{let a=i.get(p);if(a)for(let l in a)a[l]=!1},isReady:p=>{let a=i.get(p);return a?!Object.values(a).some(l=>!l):!0},release:()=>i.clear()}}function Ne(i){return Object.values(i).flat().sort(e=>e.actionType===g.expect?-1:1)}var Vt={videoContentHeight:0,videoContentWidth:0},Mt=(i,e)=>{let{height:t,width:n}=e.info.intrinsicVideoSize$.getValue()||{};if(!(t&&n))return Vt;let{clientHeight:r,clientWidth:s}=e.experimental.element$.getValue()||{};if(!(r&&s))return Vt;let p=t/n,a=r/s,l,h;return a>p?(h=s,l=s*p):a<p?(h=r/p,l=r):(h=s,l=r),{videoContentWidth:h,videoContentHeight:l}};var fn=250;function Pt(i){let e=()=>{},t=new ResizeObserver(a=>{s(a),e=s.bind(null,a)});function n(a){let{parentElement:l,player:h}=i();if(l&&h){let{videoContentWidth:v,videoContentHeight:T}=Mt(l,h);l.style.setProperty("--interactive-content-width",`${v}px`),l.style.setProperty("--interactive-content-height",`${T}px`),l.style.setProperty("--interactive-width",`${a[0].contentRect.width}px`),l.style.setProperty("--interactive-height",`${a[0].contentRect.height}px`)}}function r(){let{parentElement:a}=i();a.removeAttribute("style")}let s=Y(a=>{let{fns:l=[]}=i();n(a);for(let h of l)h()},fn);function p(){e=void 0,t.disconnect(),r()}return{resizeObserver:t,calc:()=>{e?.()},release:p}}var yn=i=>Math.floor(Math.random()*i),Nt=i=>{let e=i.length,t=1/0,n=null;for(;e--;){let r=i[e],s=r.weight??1;s<t&&(t=s,n=r)}return n},Lt=i=>{let e=i.length,t=-1/0,n=null;for(;e--;){let r=i[e],s=r.weight??0;s>t&&(t=s,n=r)}return n};var Ot=i=>{let e=i.length,t=yn(e);return i[t]},$t=1,jt=i=>{let e=0;for(let n=0;n<i.length;++n)e+=i[n].weight??$t;let t=Math.random()*e;e=0;for(let n=0;n<i.length-1;++n)if(e+=i[n].weight??$t,e>=t)return i[n];return i[i.length-1]};var Bt={shouldOpenNow:!0,isDetachContainer:!0},Ft="after-expect";var it=(i,e=!1)=>({...i,args:e?{...i.args,...Bt}:{...Bt,...i.args}}),Dt=({globalEventEmitter:i,globalEvents:e,player:t,interactiveEvents:n})=>{let r={isExpect:!1},s=()=>{r.isExpect&&(r.isExpect=!1)},p=({action:o,controlType:c,controlId:d,containerId:u,branches:m=[],onEvent:f,isEOV:I=()=>!1,isDisabled:A=()=>!1})=>{let C=it(o,I()),k={timestamp:1/0,priority:"control",initiator:d,actionType:C.type},L=A(),O=i.emit.bind(i,y.interactives,{subjectId:d,subjectType:c,subjectName:"control",type:L?w.actionChoiceCanceled:w.actionChoice,actionType:o.type,payload:{invokeImmediately:C.args.shouldOpenNow,containerId:u,...C.args}}),j=()=>{e.interactiveActionChoice$.next({subjectId:d,subjectType:c,subjectName:"control",type:L?"action-choice-canceled":"action-choice",actionType:o.type,payload:{invokeImmediately:C.args.shouldOpenNow,containerId:u,...C.args}})};if(L){O(),j();return}switch(C.type.trim().toLowerCase()){case g.setNextBranch.trim().toLowerCase():{let _=m.find(W=>W.id===C.args.branchId);if(!_)return;f(C.args.isDetachContainer,E.bind(null,{subjectId:d,subjectName:"control"})),O(),j(),C.args.shouldOpenNow?N({subjectId:d,subjectName:"control",subjectType:c,action:C,payload:{chapterId:_.chapterId,autoSelect:!1}}):n.add({...k,action:N.bind(null,{subjectId:d,subjectName:"control",subjectType:c,action:C,payload:{chapterId:_.chapterId,autoSelect:!1}})});return}case g.continuePlayback.trim().toLowerCase():{f(C.args.isDetachContainer,E.bind(null,{subjectId:d,subjectName:"control"})),O(),j(),C.args.shouldOpenNow?B({subjectId:d,subjectName:"control",subjectType:c,action:o}):n.add({...k,action:B.bind(null,{subjectId:d,subjectName:"control",subjectType:c,action:o})});return}case g.openURI.trim().toLowerCase():{f(C.args.isDetachContainer,E.bind(null,{subjectId:d,subjectName:"control"})),O(),j(),C.args.shouldOpenNow?S({subjectId:d,subjectName:"control",subjectType:c,action:C,payload:{URI:o.args.uri}}):n.add({...k,action:S.bind(null,{subjectId:d,subjectName:"control",subjectType:c,action:C,payload:{URI:o.args.uri}})});return}default:{let _="Unexpected control event",W=new R(1,1,{message:_});v(W,_);return}}},a=({action:o,container:{id:c,endTime:d},branches:u=[],isEOV:m=!1,autoSelected:f=!1})=>{let I=it(o,m),A={timestamp:!I.args.shouldOpenNow||m?1/0:d??1/0,priority:"container",initiator:c,actionType:I.type},C=i.emit.bind(i,y.interactives,{subjectId:c,subjectName:"container",type:w.actionChoice,actionType:I.type,payload:{invokeImmediately:I.args.shouldOpenNow,...I.args}}),k=()=>{e.interactiveActionChoice$.next({subjectId:c,subjectName:"container",type:"action-choice",actionType:I.type,payload:{invokeImmediately:I.args.shouldOpenNow,...I.args}})};switch(I.type.trim().toLowerCase()){case g.setNextBranch.trim().toLowerCase():{let L=u.find(O=>O.id===I.args.branchId);if(!L)return;C(),k(),n.add({...A,action:N.bind(null,{subjectId:c,subjectName:"container",action:I,payload:{chapterId:L.chapterId,autoSelect:f}})});return}case g.setMaxWeightBranch.trim().toLowerCase():return;case g.setMinWeightBranch.trim().toLowerCase():return;case g.setRandomBranch.trim().toLowerCase():return;case g.setWeightlessRandomBranch.trim().toLowerCase():return;case g.continuePlayback.trim().toLowerCase():{C(),k(),n.add({...A,action:B.bind(null,{subjectId:c,subjectName:"container",action:I})});return}case g.openURI.trim().toLowerCase():{C(),k(),n.add({...A,action:S.bind(null,{subjectId:c,subjectName:"container",action:I,payload:{URI:o.args.uri}})});return}default:{let L="Unexpected container event",O=new R(1,1,{message:L});v(O,L);return}}};function l({container:o,branches:c,isEOV:d=!1}){let u=Ye(o.events);if(u){let m=it(u.action,d);i.emit(y.interactives,{subjectId:o.id,subjectName:"container",type:w.actionChoice,actionType:m.type,payload:{invokeImmediately:m.args.shouldOpenNow,...m.args}}),e.interactiveActionChoice$.next({subjectId:o.id,subjectName:"container",type:"action-choice",actionType:m.type,payload:{invokeImmediately:m.args.shouldOpenNow,...m.args}}),n.add({timestamp:d?1/0:o.endTime??1/0,priority:"container",initiator:o.id,actionType:g.expect,action:b.bind(null,{subjectId:o.id,subjectName:"container"})}),r.isExpect=!0}else for(let m of o.events??[])a({action:m.action,container:o,branches:c,isEOV:d})}let h=({chapterId:o,action:c,branches:d=[]})=>{let u=i.emit.bind(i,y.interactives,{subjectId:o,subjectName:"chapter",type:w.actionChoice,actionType:c.type,payload:c.args}),m=()=>{e.interactiveActionChoice$.next({subjectId:o,subjectName:"chapter",type:"action-choice",actionType:c.type,payload:c.args})};switch(c.type.trim().toLowerCase()){case g.setNextBranch.trim().toLowerCase():{let f=d.find(I=>I.id===c.args.branchId);return f?.chapterId?(u(),m(),N.bind(null,{subjectId:o,subjectName:"chapter",action:c,payload:{chapterId:f.chapterId,autoSelect:!0}})):void 0}case g.setWeightlessRandomBranch.trim().toLowerCase():{let f=Ot(d);return f?.chapterId?(u(),m(),N.bind(null,{subjectId:o,subjectName:"chapter",action:c,payload:{chapterId:f.chapterId,autoSelect:!0}})):void 0}case g.setRandomBranch.trim().toLowerCase():{let f=jt(d);return f?.chapterId?(u(),m(),N.bind(null,{subjectId:o,subjectName:"chapter",action:c,payload:{chapterId:f.chapterId,autoSelect:!0}})):void 0}case g.setMaxWeightBranch.trim().toLowerCase():{let f=Lt(d);return f?.chapterId?(u(),m(),N.bind(null,{subjectId:o,subjectName:"chapter",action:c,payload:{chapterId:f.chapterId,autoSelect:!0}})):void 0}case g.setMinWeightBranch.trim().toLowerCase():{let f=Nt(d);return f?.chapterId?(u(),m(),N.bind(null,{subjectId:o,subjectName:"chapter",action:c,payload:{chapterId:f.chapterId,autoSelect:!0}})):void 0}case g.continuePlayback.trim().toLowerCase():return u(),m(),B.bind(null,{subjectId:o,subjectName:"chapter",action:c});case g.openURI.trim().toLowerCase():return u(),m(),S.bind(null,{subjectId:o,subjectName:"chapter",action:c,payload:{URI:c.args.uri}});default:{let f="Unexpected chapter event",I=new R(1,1,{message:f});v(I,f);return}}};function v(o,c){console.error(c),e.error$.next(o),i.emit(y.errors,o)}function T(o){let c=Ye(o.events);if(c){if(F(o))return;i.emit(y.interactives,{subjectId:o.id,subjectName:"chapter",type:w.actionChoice,actionType:c.action.type,payload:c.action.args}),e.interactiveActionChoice$.next({subjectId:o.id,subjectName:"chapter",type:"action-choice",actionType:c.action.type,payload:c.action.args}),n.add({timestamp:1/0,priority:"chapter",initiator:o.id,actionType:g.expect,action:b.bind(null,{subjectId:o.id,subjectName:"chapter"})})}else o.events?.forEach(d=>{let u=h({chapterId:o.id,action:d.action,branches:o.branches});u&&n.add({timestamp:1/0,priority:"chapter",initiator:o.id,actionType:d.action.type,action:u})})}let b=({subjectId:o,subjectName:c})=>{t.pause(),i.emit(y.interactives,{subjectId:o,subjectName:c,type:w.actionExecution,actionType:g.expect}),e.interactiveActionExecution$.next({subjectId:o,subjectName:c,type:"action-execution",actionType:g.expect})},E=({subjectId:o,subjectName:c})=>{t.info.isEnded$.getValue()?n.execEndOfVideo():t.play(),i.emit(y.interactives,{subjectId:o,subjectName:c,type:w.actionExecution,actionType:Ft}),e.interactiveActionExecution$.next({subjectId:o,subjectName:c,type:"action-execution",actionType:Ft})},B=({subjectId:o,subjectName:c,subjectType:d,action:u})=>{i.emit(y.interactives,{subjectId:o,subjectName:c,subjectType:d,type:w.actionExecution,actionType:u.type}),e.interactiveActionExecution$.next({subjectId:o,subjectName:c,subjectType:d,type:"action-execution",actionType:u.type})},N=({subjectId:o,subjectName:c,subjectType:d,action:u,payload:m})=>{m.behaviour="change-chapter",i.emit(y.interactives,{subjectId:o,subjectName:c,subjectType:d,type:w.actionExecution,actionType:u.type,payload:m}),e.interactiveActionExecution$.next({subjectId:o,subjectName:c,subjectType:d,type:"action-execution",actionType:u.type,payload:m})},x=({subjectId:o,subjectName:c,subjectType:d,action:u,payload:m})=>{m.behaviour="change-manifest",i.emit(y.interactives,{subjectId:o,subjectName:c,subjectType:d,type:w.actionExecution,actionType:u.type,payload:m}),e.interactiveActionExecution$.next({subjectId:o,subjectName:c,subjectType:d,type:"action-execution",actionType:u.type,payload:m})},S=({subjectId:o,subjectName:c,subjectType:d,action:u,payload:m})=>{if(!m.URI)return;let f=window.open(m.URI,"_blank","noopener,noreferrer");f&&(f.opener=null),i.emit(y.interactives,{subjectId:o,subjectName:c,subjectType:d,type:w.actionExecution,actionType:u.type}),e.interactiveActionExecution$.next({subjectId:o,subjectName:c,subjectType:d,type:"action-execution",actionType:u.type})};return{onControlEvent:p,onContainerEvent:a,onChapterEvent:h,onExpectEvent:b,expectEventHandler:E,setManifestChapterEvents:T,setManifestContainerEvents:l,stopExpect:s,state:r}};import{Subscription as En,Subject as st,ValueSubject as ae}from"@vkontakte/videoplayer-shared/evergreen";var rt=(i,e)=>{let t={};return i.map(n=>{if(!t[n]){let r=e.chapters.find(p=>p.id===n);if(!r)return null;let s=e.media.videos.find(p=>r.videoId===p.id);if(!s)return null;t[n]=Gt(s)}return t[n]}).filter(Boolean)},vn=i=>{for(let e of i.variants)if(gn(e)&&e.payload)return e.payload.id},gn=i=>!!(i.type==="custom"&&i.payload&&i.payload.type==="vk"),Gt=i=>{let e=vn(i);if(!e)return null;let t=e.split("_").pop();return t?parseInt(t,10):null},bn=(i,e)=>{for(let t of i.media.videos)if(e===Gt(t)){for(let n of i.chapters)if(n.videoId===t.id)return n.id;return}},Ut=(i,e)=>i.reduce((t,n)=>{let r=bn(e,n);return r?[...t,r]:t},[]);var oe=class{constructor({globalEventEmitter:e,videoId:t,interactiveController:n,historyApi:r,settings:s}){this.state={history$:new ae([]),hasPrevChapter$:new ae(!1),prevChapter$:new ae(null),isInitialChapter$:new ae(!1),isGoBackLimited$:new ae(!1)};this.#n=null;this.#a=!1;this.#e=null;this.#p=null;this.events={inited$:new st,destroyed$:new st,error$:new st};this.#i=null;this.#r=null;this.#t=null;this.#o=new En;this.#l=!1;this.#c=0;this.#i=t,this.#t=e,this.#r=n,this.#n=r,this.#s=s,this.state.history$&&this.#o&&this.#o?.add(this.state.history$.subscribe(p=>{this.state.prevChapter$.next(p.at(-2)||null),this.state.hasPrevChapter$.next(p.length>1),this.state.isInitialChapter$.next(this.getInitialChapterId()===this.#e?.metadata?.initChapterId),this.state.isGoBackLimited$.next(this.#c===this.#s.maxLength-1)}))}#n;#s;#a;#e;#p;#i;#r;#t;#o;#l;#c;async setManifest(e){if(!this.#r||!this.#t)return;this.#e=e,await this.getProjectHistory();let t=this.getInitialChapterId();await this.#r.setChapter({chapterId:t,pushToHistory:!1}),this.#a||(this.#a=!0,this.events.inited$.next({initChapterId:t}))}get inited(){return this.#a}async updateHistory(e,t=!0){if(!this.#e)return;this.#l?(this.#l=!1,this.#c++):this.#c=0;let n=this.#e,r=e.length-this.#s.maxLength,s=r>0?e.slice(r):e,p=rt(s,n);if(this.#p=p,this.state.history$.next(s),!(!t||!this.#n||!this.#i))try{await this.#n.save(this.#i,p)}catch{let l=new R(1,5,"Unable to save interactive history");this.events.error$.next(l),this.#t?.emit(y.errors,l)}}async goBack(){if(!this.state||!this.#r){let n=new R(1,5,"Unable to save interactive history");return this.events.error$.next(n),this.#t?.emit(y.errors,n)}this.#l=!0;let e=this.state.history$.getValue().slice(0,-1),t=e.pop();this.state.history$.next(e),await this.#r.setChapter({chapterId:t,playPrev:!0})}async getProjectHistory(){if(!this.#e||!this.#i)return;let e=this.#e,t=[this.getInitialVideoId()];if(this.#n)try{let r=await this.#n.get(this.#i);r.length&&(t=r)}catch{let s=new R(1,5,"Error while trying to fetch data");this.events.error$.next(s),this.#t?.emit(y.errors,s)}let n=Ut(t,e);this.state.history$.next(n)}getInitialChapterId(){return this.state.history$.getValue()?.at(-1)||this.#s.initChapterId||this.#e?.metadata.initChapterId}getInitialVideoId(){if(this.#e){let e=this.getInitialChapterId();return rt([e],this.#e).pop()}return null}destroy(){this.#i=null,this.#n=null,this.#r=null,this.#o?.unsubscribe(),this.#o=null,this.#a=!1,this.#t?.emit(y.historyDestroyed),this.events.destroyed$.next(),this.#t=null}};var Le=class{constructor(){this._prevSizeId=0;this.rootElement=document.createElement("canvas")}clear(){this.rootElement.getContext("2d")?.clearRect(0,0,this.rootElement.width,this.rootElement.height)}isImageDrawn(){let e=this.rootElement.getContext("2d")?.getImageData(0,0,this.rootElement.width,this.rootElement.height);if(!e)return!1;let t=e.data,n=t.length;for(let r=3;r<n;r+=40)if(t[r]!==0)return!0;return!1}destroy(){this.rootElement.remove()}show(){this.rootElement.style.visibility="visible"}hide(){this.rootElement.style.visibility="hidden"}setCanvasImageSource(e){this.canvasImgSrc=e}draw(){this.canvasImgSrc&&this.rootElement.getContext("2d")?.drawImage(this.canvasImgSrc,0,0,this.rootElement.width,this.rootElement.height)}async updateCanvasDimensions(e,t=!1){let n=e.width+e.height;if(this._prevSizeId===n)return;let r;t&&(r=await this.save()),this.rootElement.width=e.width,this.rootElement.height=e.height,t&&r&&this.restore(r),this._prevSizeId=n}async save(){let e=this.rootElement.toDataURL("image/jpeg",1),t=new Image;return t.crossOrigin="anonymous",t.src=e,await t.decode(),t}restore(e){this.rootElement&&this.rootElement.getContext("2d")?.drawImage(e,0,0,this.rootElement.width,this.rootElement.height)}};var Oe=class{constructor({parentElement:e,endOffsetMs:t=250,onError:n}){this.currentVideoDurationMs=1/0;this._containerTimeFrameShouldReceived=!1;this._endTimeFrameReceived=!1;this._shouldCallSkip=!1;this.onEachTick=e=>{let t=e??this.lastFrameCanvas.canvasImgSrc.currentTime*1e3,n=this.isChapterEndTime(t);if(this.isContainerTime(t))this._endTimeFrameReceived=!1,this._containerTimeFrameShouldReceived=!0,this._shouldCallSkip=!0;else if(n)this._containerTimeFrameShouldReceived=!1,this._shouldCallSkip=!1,this._endTimeFrameReceived||(this.draw(),this._endTimeFrameReceived=!0,this.show());else{if(this._shouldCallSkip){this._shouldCallSkip=!1;return}this.reset()}};this.onSeek=()=>{this.onEachTick(),!this._containerTimeFrameShouldReceived&&!this._endTimeFrameReceived&&(this.hide(),this.lastFrameCanvas.clear())};this.rootElement=document.createElement("div"),this.rootElement.style.cssText=`
|
|
7
7
|
position: absolute;
|
|
8
8
|
top: 0;
|
|
9
9
|
left: 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/videoplayer-interactive",
|
|
3
|
-
"version": "1.0.31-dev.
|
|
3
|
+
"version": "1.0.31-dev.4feba7d1.0",
|
|
4
4
|
"author": "vk.com",
|
|
5
5
|
"description": "Movika interactive SDK",
|
|
6
6
|
"homepage": "https://vk.com",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@interactiveplatform/movika-graph-editor": "1.11.0",
|
|
53
53
|
"@interactiveplatform/movika-manifest": "^1.0.0",
|
|
54
|
-
"@vkontakte/videoplayer-core": "2.0.126-dev.
|
|
55
|
-
"@vkontakte/videoplayer-shared": "1.0.54-dev.
|
|
56
|
-
"@vkontakte/videoplayer-statistics": "1.0.71-dev.
|
|
54
|
+
"@vkontakte/videoplayer-core": "2.0.126-dev.f43374ac.0",
|
|
55
|
+
"@vkontakte/videoplayer-shared": "1.0.54-dev.727a9ff3.0",
|
|
56
|
+
"@vkontakte/videoplayer-statistics": "1.0.71-dev.34a9c41c.0"
|
|
57
57
|
}
|
|
58
58
|
}
|