@vkontakte/videoplayer 1.1.36-dev.55db5eff.0 → 1.1.36-dev.cdb7114a.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esnext.cjs.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
- * @vkontakte/videoplayer v1.1.36-dev.55db5eff.0
3
- * Fri, 31 May 2024 10:58:23 GMT
2
+ * @vkontakte/videoplayer v1.1.36-dev.cdb7114a.0
3
+ * Fri, 31 May 2024 07:45:19 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-1-36/doc/
5
5
  */
6
- "use strict";var sc=Object.create;var ql=Object.defineProperty;var rc=Object.getOwnPropertyDescriptor;var ac=Object.getOwnPropertyNames;var uc=Object.getPrototypeOf,cc=Object.prototype.hasOwnProperty;var fc=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ac(e))!cc.call(t,o)&&o!==i&&ql(t,o,{get:()=>e[o],enumerable:!(n=rc(e,o))||n.enumerable});return t};var jl=(t,e,i)=>(i=t!=null?sc(uc(t)):{},fc(e||!t||!t.__esModule?ql(i,"default",{value:t,enumerable:!0}):i,t));var Je=require("@vkontakte/videoplayer-core/esnext.cjs.js"),te=require("@vkontakte/videoplayer-shared/esnext.cjs.js"),dt=require("@vkontakte/videoplayer-statistics/esnext.cjs.js");require("@vkontakte/videoplayer-interactive/esnext.cjs.js");function j(){}function $a(t,e){for(const i in e)t[i]=e[i];return t}function e1(t){return t()}function Zl(){return Object.create(null)}function it(t){t.forEach(e1)}function bn(t){return typeof t=="function"}function ge(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Io;function Wl(t,e){return Io||(Io=document.createElement("a")),Io.href=e,t===Io.href}function dc(t){return Object.keys(t).length===0}function jt(t,...e){if(t==null){for(const n of e)n(void 0);return j}const i=t.subscribe(...e);return i.unsubscribe?()=>i.unsubscribe():i}function $e(t){let e;return jt(t,i=>e=i)(),e}function D(t,e,i){t.$$.on_destroy.push(jt(e,i))}function Bn(t,e,i,n){if(t){const o=t1(t,e,i,n);return t[0](o)}}function t1(t,e,i,n){return t[1]&&n?$a(i.ctx.slice(),t[1](n(e))):i.ctx}function Nn(t,e,i,n){if(t[2]&&n){const o=t[2](n(i));if(e.dirty===void 0)return o;if(typeof o=="object"){const s=[],l=Math.max(e.dirty.length,o.length);for(let r=0;r<l;r+=1)s[r]=e.dirty[r]|o[r];return s}return e.dirty|o}return e.dirty}function Rn(t,e,i,n,o,s){if(o){const l=t1(e,i,n,s);t.p(l,o)}}function Dn(t){if(t.ctx.length>32){const e=[],i=t.ctx.length/32;for(let n=0;n<i;n++)e[n]=-1;return e}return-1}function mc(t){return t??""}const qo=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function p(t,e){t.appendChild(e)}function Ze(t,e,i){const n=pc(t);if(!n.getElementById(e)){const o=E("style");o.id=e,o.textContent=i,hc(n,o)}}function pc(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function hc(t,e){return p(t.head||t,e),e.sheet}function T(t,e,i){t.insertBefore(e,i||null)}function S(t){t.parentNode&&t.parentNode.removeChild(t)}function gn(t,e){for(let i=0;i<t.length;i+=1)t[i]&&t[i].d(e)}function E(t){return document.createElement(t)}function N(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function ze(t){return document.createTextNode(t)}function R(){return ze(" ")}function ut(){return ze("")}function he(t,e,i,n){return t.addEventListener(e,i,n),()=>t.removeEventListener(e,i,n)}function Wt(t){return function(e){return e.preventDefault(),t.call(this,e)}}function ot(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function u(t,e,i){i==null?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}function bc(t){return Array.from(t.childNodes)}function xe(t,e){e=""+e,t.data!==e&&(t.data=e)}function Pt(t,e,i,n){i==null?t.style.removeProperty(e):t.style.setProperty(e,i,n?"important":"")}let Lo;function gc(){if(Lo===void 0){Lo=!1;try{typeof window<"u"&&window.parent&&window.parent.document}catch{Lo=!0}}return Lo}function bl(t,e){getComputedStyle(t).position==="static"&&(t.style.position="relative");const n=E("iframe");n.setAttribute("style","display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;"),n.setAttribute("aria-hidden","true"),n.tabIndex=-1;const o=gc();let s;return o?(n.src="data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}<\/script>",s=he(window,"message",l=>{l.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{s=he(n.contentWindow,"resize",e),e()}),p(t,n),()=>{(o||s&&n.contentWindow)&&s(),S(n)}}function B(t,e,i){t.classList.toggle(e,!!i)}function Tn(t,e){return new t(e)}let go;function bo(t){go=t}function vo(){if(!go)throw new Error("Function called outside component initialization");return go}function ln(t){vo().$$.on_mount.push(t)}function jo(t){vo().$$.on_destroy.push(t)}function cl(t,e){return vo().$$.context.set(t,e),e}function gl(t){return vo().$$.context.get(t)}function i1(){return vo().$$.context}function so(t,e){const i=t.$$.callbacks[e.type];i&&i.slice().forEach(n=>n.call(this,e))}const io=[],we=[];let oo=[];const fl=[],n1=Promise.resolve();let dl=!1;function o1(){dl||(dl=!0,n1.then(l1))}function ko(){return o1(),n1}function ro(t){oo.push(t)}function Ue(t){fl.push(t)}const el=new Set;let $n=0;function l1(){if($n!==0)return;const t=go;do{try{for(;$n<io.length;){const e=io[$n];$n++,bo(e),_c(e.$$)}}catch(e){throw io.length=0,$n=0,e}for(bo(null),io.length=0,$n=0;we.length;)we.pop()();for(let e=0;e<oo.length;e+=1){const i=oo[e];el.has(i)||(el.add(i),i())}oo.length=0}while(io.length);for(;fl.length;)fl.pop()();dl=!1,el.clear(),bo(t)}function _c(t){if(t.fragment!==null){t.update(),it(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(ro)}}function vc(t){const e=[],i=[];oo.forEach(n=>t.indexOf(n)===-1?e.push(n):i.push(n)),i.forEach(n=>n()),oo=e}const zo=new Set;let Yn;function de(){Yn={r:0,c:[],p:Yn}}function me(){Yn.r||it(Yn.c),Yn=Yn.p}function d(t,e){t&&t.i&&(zo.delete(t),t.i(e))}function b(t,e,i,n){if(t&&t.o){if(zo.has(t))return;zo.add(t),Yn.c.push(()=>{zo.delete(t),n&&(i&&t.d(1),n())}),t.o(e)}else n&&n()}function Nt(t){return t?.length!==void 0?t:Array.from(t)}function kc(t,e){const i={},n={},o={$$scope:1};let s=t.length;for(;s--;){const l=t[s],r=e[s];if(r){for(const a in l)a in r||(n[a]=1);for(const a in r)o[a]||(i[a]=r[a],o[a]=1);t[s]=r}else for(const a in l)o[a]=1}for(const l in n)l in i||(i[l]=void 0);return i}function wc(t){return typeof t=="object"&&t!==null?t:{}}function qe(t,e,i){const n=t.$$.props[e];n!==void 0&&(t.$$.bound[n]=i,i(t.$$.ctx[n]))}function F(t){t&&t.c()}function O(t,e,i){const{fragment:n,after_update:o}=t.$$;n&&n.m(e,i),ro(()=>{const s=t.$$.on_mount.map(e1).filter(bn);t.$$.on_destroy?t.$$.on_destroy.push(...s):it(s),t.$$.on_mount=[]}),o.forEach(ro)}function z(t,e){const i=t.$$;i.fragment!==null&&(vc(i.after_update),it(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])}function yc(t,e){t.$$.dirty[0]===-1&&(io.push(t),o1(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function _e(t,e,i,n,o,s,l,r=[-1]){const a=go;bo(t);const c=t.$$={fragment:null,ctx:[],props:s,update:j,not_equal:o,bound:Zl(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(a?a.$$.context:[])),callbacks:Zl(),dirty:r,skip_bound:!1,root:e.target||a.$$.root};l&&l(c.root);let f=!1;if(c.ctx=i?i(t,e.props||{},(m,h,..._)=>{const g=_.length?_[0]:h;return c.ctx&&o(c.ctx[m],c.ctx[m]=g)&&(!c.skip_bound&&c.bound[m]&&c.bound[m](g),f&&yc(t,m)),h}):[],c.update(),f=!0,it(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const m=bc(e.target);c.fragment&&c.fragment.l(m),m.forEach(S)}else c.fragment&&c.fragment.c();e.intro&&d(t.$$.fragment),O(t,e.target,e.anchor),l1()}bo(a)}class ve{$$=void 0;$$set=void 0;$destroy(){z(this,1),this.$destroy=j}$on(e,i){if(!bn(i))return j;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(i),()=>{const o=n.indexOf(i);o!==-1&&n.splice(o,1)}}$set(e){this.$$set&&!dc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Cc="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Cc);var ao;(function(t){t.VK="vk",t.VK_VIDEO="vk_video"})(ao||(ao={}));const Pc={isMobile:void 0,defaultLanguage:te.InterfaceLanguage.RU,downloadVKLanguages:!0,updateBuiltinLanguages:!0,isSmoothVideoRotate:!0,showSupport:!0,supportLink:"https://vk.com/support?act=new&from=v",showLogo:void 0,logoLink:"https://vk.com/video",logoType:ao.VK_VIDEO,addTimeToLogoLink:!0,volumeDefault:1,volumeMinRestore:.05,loaderDelay:500,minSubtitlesFontSize:13,autoSubtitlesTimeout:2e3,allowChangingFullscreenTarget:!0,trafficSavingLimit:te.VideoQuality.Q_480P,episodeMinWidthPc:8,hideThumbTimerAfterTouch:!0,sentry:{dsn:"https://e349fd23c68f405388980d0868d0ff27@sentry.mvk.com/126",sampleRate:.01,whiteErrorCategoryList:[],blackErrorCategoryList:[],whiteErrorIdList:[],blackErrorIdList:[]},features:{autoplay:!0,statistics:!0,sentry:!0,preload:!0,subtitles:!0,episodes:!0,fullscreen:!0,timelinePreview:!0,mediaSession:!0,annotations:!0,pip:!0,dpip:!0,download:!0,liveRewind:!0,playbackRate:!0,trafficSaving:!0,episodesClustering:!0,copyVideoLink:!0,videoRotate:!0,interactiveGraph:!1,seekToInteractive:!0,interactiveLastFrame:!1,interactiveTextPermanent:!0,interactiveHideTime:!0,interactivePlayPrevChapter:!0,thumbTimer:!0,hotKeyMapModal:!0,hotKeyHelpers:!0,saveDebugInfoToFile:!1,additionalButtons:!0,contextMenuButton:!0},controls:{hideTimeout:500,hideTimeoutMobile:3e3,hideTimeoutInitial:200,hideTimeoutFullscreen:3e3,hideTimeoutCursor:3e3,hideTimeoutTooltips:1e3,collapseMobileUnmute:6e3,hide360IconTimeout:3e3,hideHotKeyHelpers:2e3,playbackRateMin:.25,playbackRateMax:2,playbackRateStep:.25,volumeStepKeyboard:.05,volumeStepWheel:.05,volumeBarTimeout:300,seekStepKeyboard:1e4,seekStepMobile:15e3,seekStepFrame:400},ads:{enable:void 0,initTimeout:2e3,loadTimeout:2e3,slot:void 0,preview:void 0},interactive:{historyMaxLength:100,noInteractionEventTimeout:3e4}},Sc=t=>te.fillWithDefault(t,Pc),Tc=t=>cl("ui-config",t),sn=()=>gl("ui-config"),ml="vk_player_debug_panel_opened",s1=300,Ec=100,Ac="videoplayer",Ic="videoplayer";var Ae;(function(t){t.ArrowLeft="ArrowLeft",t.ArrowUp="ArrowUp",t.ArrowRight="ArrowRight",t.ArrowDown="ArrowDown",t.Comma="Comma",t.Period="Period",t.Space="Space",t.KeyM="KeyM",t.KeyF="KeyF",t.KeyK="KeyK",t.KeyL="KeyL",t.KeyJ="KeyJ",t.KeyC="KeyC",t.KeyI="KeyI",t.Digit1="Digit1",t.Digit2="Digit2",t.Digit3="Digit3",t.Digit4="Digit4",t.Digit5="Digit5",t.Digit6="Digit6",t.Digit7="Digit7",t.Digit8="Digit8",t.Digit9="Digit9",t.Digit0="Digit0",t.Numpad1="Numpad1",t.Numpad2="Numpad2",t.Numpad3="Numpad3",t.Numpad4="Numpad4",t.Numpad5="Numpad5",t.Numpad6="Numpad6",t.Numpad7="Numpad7",t.Numpad8="Numpad8",t.Numpad9="Numpad9",t.Numpad0="Numpad0",t.ShiftLeft="ShiftLeft",t.ShiftRight="ShiftRight",t.Slash="Slash",t.Tab="Tab",t.Escape="Escape",t.Enter="Enter"})(Ae||(Ae={}));const wo={[Ae.KeyF]:"f",[Ae.KeyK]:"k",[Ae.KeyC]:"c",[Ae.KeyM]:"m"},Lc=new Set([Ae.ArrowLeft,Ae.ArrowRight,Ae.KeyL,Ae.KeyJ]),Vc=new Set([Ae.Tab,Ae.Space,Ae.ArrowLeft,Ae.ArrowRight,Ae.ArrowUp,Ae.ArrowDown]),Mc=new Set([Ae.ShiftRight,Ae.ShiftLeft]);var rt;(function(t){t.PLAY_BUTTON="PLAY_BUTTON",t.REPLAY_BUTTON="REPLAY_BUTTON",t.NEXT_BUTTON="NEXT_BUTTON",t.PREV_BUTTON="PREV_BUTTON",t.PICTURE_IN_PICTURE="PICTURE_IN_PICTURE",t.FULLSCREEN_BUTTON="FULLSCREEN_BUTTON",t.SETTINGS_BUTTON="SETTINGS_BUTTON",t.LIVE_BUTTON="LIVE_BUTTON",t.GRAPH_BUTTON="GRAPH_BUTTON",t.PLAY_PREV_CHAPTER_BUTTON="PLAY_PREV_CHAPTER_BUTTON",t.SEEK_TO_INTERACTIVE_BUTTON="SEEK_TO_INTERACTIVE_BUTTON",t.TIMELINE="TIMELINE",t.VOLUME_BAR="VOLUME_BAR",t.MUTE_BUTTON="MUTE_BUTTON",t.SUBTITLES_BUTTON="SUBTITLES_BUTTON",t.CHROMECAST_BUTTON="CHROMECAST_BUTTON",t.VK_BUTTON="VK_BUTTON",t.EPISODE_BUTTON="EPISODE_BUTTON",t.INCREMENT_PLAYBACK_RATE="INCREMENT_PLAYBACK_RATE",t.DECREMENT_PLAYBACK_RATE="DECREMENT_PLAYBACK_RATE"})(rt||(rt={}));const Kl=40,r1=260,Bc=60,Vo=8,a1=[rt.TIMELINE],Ho=[...a1,rt.GRAPH_BUTTON],Gl=[...a1,rt.PLAY_BUTTON],u1=[...Ho,rt.PLAY_BUTTON];var no;(function(t){t[t.XS=320]="XS",t[t.S=509]="S",t[t.M=599]="M",t[t.L=699]="L"})(no||(no={}));exports.GridTypes=void 0;(function(t){t.XS="xs",t.S="s",t.M="m",t.L="l",t.XL="xl"})(exports.GridTypes||(exports.GridTypes={}));const uo={[exports.GridTypes.XS]:0,[exports.GridTypes.S]:1,[exports.GridTypes.M]:2,[exports.GridTypes.L]:3,[exports.GridTypes.XL]:4},eo=[];function Sn(t,e){return{subscribe:Me(t,e).subscribe}}function Me(t,e=j){let i;const n=new Set;function o(r){if(ge(t,r)&&(t=r,i)){const a=!eo.length;for(const c of n)c[1](),eo.push(c,t);if(a){for(let c=0;c<eo.length;c+=2)eo[c][0](eo[c+1]);eo.length=0}}}function s(r){o(r(t))}function l(r,a=j){const c=[r,a];return n.add(c),n.size===1&&(i=e(o,s)||j),r(t),()=>{n.delete(c),n.size===0&&i&&(i(),i=null)}}return{set:o,update:s,subscribe:l}}function Bi(t,e,i){const n=!Array.isArray(t),o=n?[t]:t;if(!o.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const s=e.length<2;return Sn(i,(l,r)=>{let a=!1;const c=[];let f=0,m=j;const h=()=>{if(f)return;m();const g=e(n?c[0]:c,l,r);s?l(g):m=bn(g)?g:j},_=o.map((g,k)=>jt(g,v=>{c[k]=v,f&=~(1<<k),a&&h()},()=>{f|=1<<k}));return a=!0,h(),function(){it(_),m(),a=!1}})}const Nc="prod",Zo="1.1.36-dev.55db5eff.0",c1=(t,e,i)=>{const n=document.createElement("a");n.href=t,n.download=`${e}.${i}`,n.style.display="none",n.click()},f1=Symbol("storeContext"),d1=Symbol("microStoresContext"),Rc=(t,e)=>{cl(f1,t),cl(d1,e)},mt=()=>{const t=gl(f1);return te.assertNonNullable(t,"Store context is empty!"),t},yo=()=>{const t=gl(d1);return te.assertNonNullable(t,"MicroStores context is empty!"),t},ft=(t,e)=>m1(t,t.getValue(),e),m1=(t,e,i)=>Sn(e,n=>{const o=t.subscribe(s=>{n(s),i?.(s)});return()=>o.unsubscribe()}),Dc=(t,e,i)=>{const n=t.info,{width:o,height:s}=$e(i.ui.playerSize),l=n.throughputEstimation$.getValue()?.toFixed(0)??0,r=n.rttEstimation$.getValue()?.toFixed(0)??0,a=n.isAutoQualityEnabled$.getValue()?"auto":"manual",c=`${Zo} (core: ${Je.VERSION}, stat: ${dt.VERSION}, shared: ${te.VERSION})`,f=$e(i.state.errorLog$),m=f.length?`
6
+ "use strict";var sc=Object.create;var ql=Object.defineProperty;var rc=Object.getOwnPropertyDescriptor;var ac=Object.getOwnPropertyNames;var uc=Object.getPrototypeOf,cc=Object.prototype.hasOwnProperty;var fc=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ac(e))!cc.call(t,o)&&o!==i&&ql(t,o,{get:()=>e[o],enumerable:!(n=rc(e,o))||n.enumerable});return t};var jl=(t,e,i)=>(i=t!=null?sc(uc(t)):{},fc(e||!t||!t.__esModule?ql(i,"default",{value:t,enumerable:!0}):i,t));var Je=require("@vkontakte/videoplayer-core/esnext.cjs.js"),te=require("@vkontakte/videoplayer-shared/esnext.cjs.js"),dt=require("@vkontakte/videoplayer-statistics/esnext.cjs.js");require("@vkontakte/videoplayer-interactive/esnext.cjs.js");function j(){}function $a(t,e){for(const i in e)t[i]=e[i];return t}function e1(t){return t()}function Zl(){return Object.create(null)}function it(t){t.forEach(e1)}function bn(t){return typeof t=="function"}function ge(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Io;function Wl(t,e){return Io||(Io=document.createElement("a")),Io.href=e,t===Io.href}function dc(t){return Object.keys(t).length===0}function jt(t,...e){if(t==null){for(const n of e)n(void 0);return j}const i=t.subscribe(...e);return i.unsubscribe?()=>i.unsubscribe():i}function $e(t){let e;return jt(t,i=>e=i)(),e}function D(t,e,i){t.$$.on_destroy.push(jt(e,i))}function Bn(t,e,i,n){if(t){const o=t1(t,e,i,n);return t[0](o)}}function t1(t,e,i,n){return t[1]&&n?$a(i.ctx.slice(),t[1](n(e))):i.ctx}function Nn(t,e,i,n){if(t[2]&&n){const o=t[2](n(i));if(e.dirty===void 0)return o;if(typeof o=="object"){const s=[],l=Math.max(e.dirty.length,o.length);for(let r=0;r<l;r+=1)s[r]=e.dirty[r]|o[r];return s}return e.dirty|o}return e.dirty}function Rn(t,e,i,n,o,s){if(o){const l=t1(e,i,n,s);t.p(l,o)}}function Dn(t){if(t.ctx.length>32){const e=[],i=t.ctx.length/32;for(let n=0;n<i;n++)e[n]=-1;return e}return-1}function mc(t){return t??""}const qo=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function p(t,e){t.appendChild(e)}function Ze(t,e,i){const n=pc(t);if(!n.getElementById(e)){const o=E("style");o.id=e,o.textContent=i,hc(n,o)}}function pc(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function hc(t,e){return p(t.head||t,e),e.sheet}function T(t,e,i){t.insertBefore(e,i||null)}function S(t){t.parentNode&&t.parentNode.removeChild(t)}function gn(t,e){for(let i=0;i<t.length;i+=1)t[i]&&t[i].d(e)}function E(t){return document.createElement(t)}function N(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function ze(t){return document.createTextNode(t)}function R(){return ze(" ")}function ut(){return ze("")}function he(t,e,i,n){return t.addEventListener(e,i,n),()=>t.removeEventListener(e,i,n)}function Wt(t){return function(e){return e.preventDefault(),t.call(this,e)}}function ot(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function u(t,e,i){i==null?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}function bc(t){return Array.from(t.childNodes)}function xe(t,e){e=""+e,t.data!==e&&(t.data=e)}function Pt(t,e,i,n){i==null?t.style.removeProperty(e):t.style.setProperty(e,i,n?"important":"")}let Lo;function gc(){if(Lo===void 0){Lo=!1;try{typeof window<"u"&&window.parent&&window.parent.document}catch{Lo=!0}}return Lo}function bl(t,e){getComputedStyle(t).position==="static"&&(t.style.position="relative");const n=E("iframe");n.setAttribute("style","display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;"),n.setAttribute("aria-hidden","true"),n.tabIndex=-1;const o=gc();let s;return o?(n.src="data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}<\/script>",s=he(window,"message",l=>{l.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{s=he(n.contentWindow,"resize",e),e()}),p(t,n),()=>{(o||s&&n.contentWindow)&&s(),S(n)}}function B(t,e,i){t.classList.toggle(e,!!i)}function Tn(t,e){return new t(e)}let go;function bo(t){go=t}function vo(){if(!go)throw new Error("Function called outside component initialization");return go}function ln(t){vo().$$.on_mount.push(t)}function jo(t){vo().$$.on_destroy.push(t)}function cl(t,e){return vo().$$.context.set(t,e),e}function gl(t){return vo().$$.context.get(t)}function i1(){return vo().$$.context}function so(t,e){const i=t.$$.callbacks[e.type];i&&i.slice().forEach(n=>n.call(this,e))}const io=[],we=[];let oo=[];const fl=[],n1=Promise.resolve();let dl=!1;function o1(){dl||(dl=!0,n1.then(l1))}function ko(){return o1(),n1}function ro(t){oo.push(t)}function Ue(t){fl.push(t)}const el=new Set;let $n=0;function l1(){if($n!==0)return;const t=go;do{try{for(;$n<io.length;){const e=io[$n];$n++,bo(e),_c(e.$$)}}catch(e){throw io.length=0,$n=0,e}for(bo(null),io.length=0,$n=0;we.length;)we.pop()();for(let e=0;e<oo.length;e+=1){const i=oo[e];el.has(i)||(el.add(i),i())}oo.length=0}while(io.length);for(;fl.length;)fl.pop()();dl=!1,el.clear(),bo(t)}function _c(t){if(t.fragment!==null){t.update(),it(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(ro)}}function vc(t){const e=[],i=[];oo.forEach(n=>t.indexOf(n)===-1?e.push(n):i.push(n)),i.forEach(n=>n()),oo=e}const zo=new Set;let Yn;function de(){Yn={r:0,c:[],p:Yn}}function me(){Yn.r||it(Yn.c),Yn=Yn.p}function d(t,e){t&&t.i&&(zo.delete(t),t.i(e))}function b(t,e,i,n){if(t&&t.o){if(zo.has(t))return;zo.add(t),Yn.c.push(()=>{zo.delete(t),n&&(i&&t.d(1),n())}),t.o(e)}else n&&n()}function Nt(t){return t?.length!==void 0?t:Array.from(t)}function kc(t,e){const i={},n={},o={$$scope:1};let s=t.length;for(;s--;){const l=t[s],r=e[s];if(r){for(const a in l)a in r||(n[a]=1);for(const a in r)o[a]||(i[a]=r[a],o[a]=1);t[s]=r}else for(const a in l)o[a]=1}for(const l in n)l in i||(i[l]=void 0);return i}function wc(t){return typeof t=="object"&&t!==null?t:{}}function qe(t,e,i){const n=t.$$.props[e];n!==void 0&&(t.$$.bound[n]=i,i(t.$$.ctx[n]))}function F(t){t&&t.c()}function O(t,e,i){const{fragment:n,after_update:o}=t.$$;n&&n.m(e,i),ro(()=>{const s=t.$$.on_mount.map(e1).filter(bn);t.$$.on_destroy?t.$$.on_destroy.push(...s):it(s),t.$$.on_mount=[]}),o.forEach(ro)}function z(t,e){const i=t.$$;i.fragment!==null&&(vc(i.after_update),it(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])}function yc(t,e){t.$$.dirty[0]===-1&&(io.push(t),o1(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function _e(t,e,i,n,o,s,l,r=[-1]){const a=go;bo(t);const c=t.$$={fragment:null,ctx:[],props:s,update:j,not_equal:o,bound:Zl(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(a?a.$$.context:[])),callbacks:Zl(),dirty:r,skip_bound:!1,root:e.target||a.$$.root};l&&l(c.root);let f=!1;if(c.ctx=i?i(t,e.props||{},(m,h,..._)=>{const g=_.length?_[0]:h;return c.ctx&&o(c.ctx[m],c.ctx[m]=g)&&(!c.skip_bound&&c.bound[m]&&c.bound[m](g),f&&yc(t,m)),h}):[],c.update(),f=!0,it(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const m=bc(e.target);c.fragment&&c.fragment.l(m),m.forEach(S)}else c.fragment&&c.fragment.c();e.intro&&d(t.$$.fragment),O(t,e.target,e.anchor),l1()}bo(a)}class ve{$$=void 0;$$set=void 0;$destroy(){z(this,1),this.$destroy=j}$on(e,i){if(!bn(i))return j;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(i),()=>{const o=n.indexOf(i);o!==-1&&n.splice(o,1)}}$set(e){this.$$set&&!dc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Cc="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Cc);var ao;(function(t){t.VK="vk",t.VK_VIDEO="vk_video"})(ao||(ao={}));const Pc={isMobile:void 0,defaultLanguage:te.InterfaceLanguage.RU,downloadVKLanguages:!0,updateBuiltinLanguages:!0,isSmoothVideoRotate:!0,showSupport:!0,supportLink:"https://vk.com/support?act=new&from=v",showLogo:void 0,logoLink:"https://vk.com/video",logoType:ao.VK_VIDEO,addTimeToLogoLink:!0,volumeDefault:1,volumeMinRestore:.05,loaderDelay:500,minSubtitlesFontSize:13,autoSubtitlesTimeout:2e3,allowChangingFullscreenTarget:!0,trafficSavingLimit:te.VideoQuality.Q_480P,episodeMinWidthPc:8,hideThumbTimerAfterTouch:!0,sentry:{dsn:"https://e349fd23c68f405388980d0868d0ff27@sentry.mvk.com/126",sampleRate:.01,whiteErrorCategoryList:[],blackErrorCategoryList:[],whiteErrorIdList:[],blackErrorIdList:[]},features:{autoplay:!0,statistics:!0,sentry:!0,preload:!0,subtitles:!0,episodes:!0,fullscreen:!0,timelinePreview:!0,mediaSession:!0,annotations:!0,pip:!0,dpip:!0,download:!0,liveRewind:!0,playbackRate:!0,trafficSaving:!0,episodesClustering:!0,copyVideoLink:!0,videoRotate:!0,interactiveGraph:!1,seekToInteractive:!0,interactiveLastFrame:!1,interactiveTextPermanent:!0,interactiveHideTime:!0,interactivePlayPrevChapter:!0,thumbTimer:!0,hotKeyMapModal:!0,hotKeyHelpers:!0,saveDebugInfoToFile:!1,additionalButtons:!0,contextMenuButton:!0},controls:{hideTimeout:500,hideTimeoutMobile:3e3,hideTimeoutInitial:200,hideTimeoutFullscreen:3e3,hideTimeoutCursor:3e3,hideTimeoutTooltips:1e3,collapseMobileUnmute:6e3,hide360IconTimeout:3e3,hideHotKeyHelpers:2e3,playbackRateMin:.25,playbackRateMax:2,playbackRateStep:.25,volumeStepKeyboard:.05,volumeStepWheel:.05,volumeBarTimeout:300,seekStepKeyboard:1e4,seekStepMobile:15e3,seekStepFrame:400},ads:{enable:void 0,initTimeout:2e3,loadTimeout:2e3,slot:void 0,preview:void 0},interactive:{historyMaxLength:100,noInteractionEventTimeout:3e4}},Sc=t=>te.fillWithDefault(t,Pc),Tc=t=>cl("ui-config",t),sn=()=>gl("ui-config"),ml="vk_player_debug_panel_opened",s1=300,Ec=100,Ac="videoplayer",Ic="videoplayer";var Ae;(function(t){t.ArrowLeft="ArrowLeft",t.ArrowUp="ArrowUp",t.ArrowRight="ArrowRight",t.ArrowDown="ArrowDown",t.Comma="Comma",t.Period="Period",t.Space="Space",t.KeyM="KeyM",t.KeyF="KeyF",t.KeyK="KeyK",t.KeyL="KeyL",t.KeyJ="KeyJ",t.KeyC="KeyC",t.KeyI="KeyI",t.Digit1="Digit1",t.Digit2="Digit2",t.Digit3="Digit3",t.Digit4="Digit4",t.Digit5="Digit5",t.Digit6="Digit6",t.Digit7="Digit7",t.Digit8="Digit8",t.Digit9="Digit9",t.Digit0="Digit0",t.Numpad1="Numpad1",t.Numpad2="Numpad2",t.Numpad3="Numpad3",t.Numpad4="Numpad4",t.Numpad5="Numpad5",t.Numpad6="Numpad6",t.Numpad7="Numpad7",t.Numpad8="Numpad8",t.Numpad9="Numpad9",t.Numpad0="Numpad0",t.ShiftLeft="ShiftLeft",t.ShiftRight="ShiftRight",t.Slash="Slash",t.Tab="Tab",t.Escape="Escape",t.Enter="Enter"})(Ae||(Ae={}));const wo={[Ae.KeyF]:"f",[Ae.KeyK]:"k",[Ae.KeyC]:"c",[Ae.KeyM]:"m"},Lc=new Set([Ae.ArrowLeft,Ae.ArrowRight,Ae.KeyL,Ae.KeyJ]),Vc=new Set([Ae.Tab,Ae.Space,Ae.ArrowLeft,Ae.ArrowRight,Ae.ArrowUp,Ae.ArrowDown]),Mc=new Set([Ae.ShiftRight,Ae.ShiftLeft]);var rt;(function(t){t.PLAY_BUTTON="PLAY_BUTTON",t.REPLAY_BUTTON="REPLAY_BUTTON",t.NEXT_BUTTON="NEXT_BUTTON",t.PREV_BUTTON="PREV_BUTTON",t.PICTURE_IN_PICTURE="PICTURE_IN_PICTURE",t.FULLSCREEN_BUTTON="FULLSCREEN_BUTTON",t.SETTINGS_BUTTON="SETTINGS_BUTTON",t.LIVE_BUTTON="LIVE_BUTTON",t.GRAPH_BUTTON="GRAPH_BUTTON",t.PLAY_PREV_CHAPTER_BUTTON="PLAY_PREV_CHAPTER_BUTTON",t.SEEK_TO_INTERACTIVE_BUTTON="SEEK_TO_INTERACTIVE_BUTTON",t.TIMELINE="TIMELINE",t.VOLUME_BAR="VOLUME_BAR",t.MUTE_BUTTON="MUTE_BUTTON",t.SUBTITLES_BUTTON="SUBTITLES_BUTTON",t.CHROMECAST_BUTTON="CHROMECAST_BUTTON",t.VK_BUTTON="VK_BUTTON",t.EPISODE_BUTTON="EPISODE_BUTTON",t.INCREMENT_PLAYBACK_RATE="INCREMENT_PLAYBACK_RATE",t.DECREMENT_PLAYBACK_RATE="DECREMENT_PLAYBACK_RATE"})(rt||(rt={}));const Kl=40,r1=260,Bc=60,Vo=8,a1=[rt.TIMELINE],Ho=[...a1,rt.GRAPH_BUTTON],Gl=[...a1,rt.PLAY_BUTTON],u1=[...Ho,rt.PLAY_BUTTON];var no;(function(t){t[t.XS=320]="XS",t[t.S=509]="S",t[t.M=599]="M",t[t.L=699]="L"})(no||(no={}));exports.GridTypes=void 0;(function(t){t.XS="xs",t.S="s",t.M="m",t.L="l",t.XL="xl"})(exports.GridTypes||(exports.GridTypes={}));const uo={[exports.GridTypes.XS]:0,[exports.GridTypes.S]:1,[exports.GridTypes.M]:2,[exports.GridTypes.L]:3,[exports.GridTypes.XL]:4},eo=[];function Sn(t,e){return{subscribe:Me(t,e).subscribe}}function Me(t,e=j){let i;const n=new Set;function o(r){if(ge(t,r)&&(t=r,i)){const a=!eo.length;for(const c of n)c[1](),eo.push(c,t);if(a){for(let c=0;c<eo.length;c+=2)eo[c][0](eo[c+1]);eo.length=0}}}function s(r){o(r(t))}function l(r,a=j){const c=[r,a];return n.add(c),n.size===1&&(i=e(o,s)||j),r(t),()=>{n.delete(c),n.size===0&&i&&(i(),i=null)}}return{set:o,update:s,subscribe:l}}function Bi(t,e,i){const n=!Array.isArray(t),o=n?[t]:t;if(!o.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const s=e.length<2;return Sn(i,(l,r)=>{let a=!1;const c=[];let f=0,m=j;const h=()=>{if(f)return;m();const g=e(n?c[0]:c,l,r);s?l(g):m=bn(g)?g:j},_=o.map((g,k)=>jt(g,v=>{c[k]=v,f&=~(1<<k),a&&h()},()=>{f|=1<<k}));return a=!0,h(),function(){it(_),m(),a=!1}})}const Nc="prod",Zo="1.1.36-dev.cdb7114a.0",c1=(t,e,i)=>{const n=document.createElement("a");n.href=t,n.download=`${e}.${i}`,n.style.display="none",n.click()},f1=Symbol("storeContext"),d1=Symbol("microStoresContext"),Rc=(t,e)=>{cl(f1,t),cl(d1,e)},mt=()=>{const t=gl(f1);return te.assertNonNullable(t,"Store context is empty!"),t},yo=()=>{const t=gl(d1);return te.assertNonNullable(t,"MicroStores context is empty!"),t},ft=(t,e)=>m1(t,t.getValue(),e),m1=(t,e,i)=>Sn(e,n=>{const o=t.subscribe(s=>{n(s),i?.(s)});return()=>o.unsubscribe()}),Dc=(t,e,i)=>{const n=t.info,{width:o,height:s}=$e(i.ui.playerSize),l=n.throughputEstimation$.getValue()?.toFixed(0)??0,r=n.rttEstimation$.getValue()?.toFixed(0)??0,a=n.isAutoQualityEnabled$.getValue()?"auto":"manual",c=`${Zo} (core: ${Je.VERSION}, stat: ${dt.VERSION}, shared: ${te.VERSION})`,f=$e(i.state.errorLog$),m=f.length?`
7
7
  `+f.map((g,k)=>{const v=`${k}) Type: ${g.id}
8
8
  `,P=`Message: ${g.message} (${g.thrown})
9
9
  `,y=`Trace: ${g.thrown?.stack}
@@ -48,4 +48,4 @@
48
48
  rgba(0, 0, 0, 0.99) 93.33%,
49
49
  #000 100%
50
50
  );--timeline-preview-shadow:rgba(0, 0, 0, 0.08);--timeline-preview-bg:rgba(34, 34, 34, 1);--mobile-settings-bg:#2C2D2E;--button-hover-transition:opacity 0.2s;--video-container-z-index:0;--rotate-transition-duration:0.25s;position:relative;width:100%;height:100%;color:var(--white);font-size:12px;line-height:normal;overflow:hidden;outline:0;user-select:none;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;background:var(--black)}button{border:none;margin:0;padding:0;width:auto;overflow:visible;background:transparent;color:inherit;font:inherit;line-height:normal;-webkit-font-smoothing:inherit;-moz-osx-font-smoothing:inherit;-webkit-appearance:none;cursor:pointer}svg:not(.interactiveContainer svg){pointer-events:none}*:focus, *:focus-visible{outline:none}*:focus-visible{box-shadow:var(--focused-element-shadow)}.hidden{visibility:hidden;opacity:0}.overlay-container{pointer-events:none;top:0;left:0;height:100%;width:100%;position:fixed;z-index:10000}.out-of-view{position:absolute !important;left:-1000vh !important}`)}function dh(t){let e,i,n;function o(l){t[56](l)}let s={store:t[0],uiConfig:t[35],title:t[1],thumbUrl:t[2],videoLogoUrl:t[3],interactiveContainer:t[4],live:t[5],autoplay:t[6],canRewindLive:t[7],showAds:t[8],adsSlotId:t[9],adsParams:t[10],adsPreviewParam:t[11],duration:t[12],logoClickable:t[13],logoHidden:t[14],showNextPrevButtons:t[16],nextButtonActive:t[17],prevButtonActive:t[18],endScreenVideoTitle:t[19],endScreenVideoThumb:t[20],isOneVideoPlaylist:t[21],supportLink:t[22],outerContainerRef:t[23],fullScreenTarget:t[24],showMiniTimer:t[25],playerStarted:t[34],playNextVideo:t[26],playPrevVideo:t[27],repeatPlaylist:t[28],seekToInteractive:t[29],toggleGraph:t[30],playPrevChapter:t[31],firstStart:t[36]};return t[33]!==void 0&&(s.videoContainer=t[33]),e=new $p({props:s}),we.push(()=>qe(e,"videoContainer",o)),{c(){F(e.$$.fragment)},m(l,r){O(e,l,r),n=!0},p(l,r){const a={};r[0]&1&&(a.store=l[0]),r[0]&2&&(a.title=l[1]),r[0]&4&&(a.thumbUrl=l[2]),r[0]&8&&(a.videoLogoUrl=l[3]),r[0]&16&&(a.interactiveContainer=l[4]),r[0]&32&&(a.live=l[5]),r[0]&64&&(a.autoplay=l[6]),r[0]&128&&(a.canRewindLive=l[7]),r[0]&256&&(a.showAds=l[8]),r[0]&512&&(a.adsSlotId=l[9]),r[0]&1024&&(a.adsParams=l[10]),r[0]&2048&&(a.adsPreviewParam=l[11]),r[0]&4096&&(a.duration=l[12]),r[0]&8192&&(a.logoClickable=l[13]),r[0]&16384&&(a.logoHidden=l[14]),r[0]&65536&&(a.showNextPrevButtons=l[16]),r[0]&131072&&(a.nextButtonActive=l[17]),r[0]&262144&&(a.prevButtonActive=l[18]),r[0]&524288&&(a.endScreenVideoTitle=l[19]),r[0]&1048576&&(a.endScreenVideoThumb=l[20]),r[0]&2097152&&(a.isOneVideoPlaylist=l[21]),r[0]&4194304&&(a.supportLink=l[22]),r[0]&8388608&&(a.outerContainerRef=l[23]),r[0]&16777216&&(a.fullScreenTarget=l[24]),r[0]&33554432&&(a.showMiniTimer=l[25]),r[1]&8&&(a.playerStarted=l[34]),r[0]&67108864&&(a.playNextVideo=l[26]),r[0]&134217728&&(a.playPrevVideo=l[27]),r[0]&268435456&&(a.repeatPlaylist=l[28]),r[0]&536870912&&(a.seekToInteractive=l[29]),r[0]&1073741824&&(a.toggleGraph=l[30]),r[1]&1&&(a.playPrevChapter=l[31]),!i&&r[1]&4&&(i=!0,a.videoContainer=l[33],Ue(()=>i=!1)),e.$set(a)},i(l){n||(d(e.$$.fragment,l),n=!0)},o(l){b(e.$$.fragment,l),n=!1},d(l){z(e,l)}}}function mh(t){let e,i,n;function o(l){t[55](l)}let s={store:t[0],uiConfig:t[35],thumbUrl:t[2],videoLogoUrl:t[3],interactiveContainer:t[4],live:t[5],autoplay:t[6],canRewindLive:t[7],showAds:t[8],adsSlotId:t[9],adsParams:t[10],adsPreviewParam:t[11],duration:t[12],logoClickable:t[13],logoHidden:t[14],showNextPrevButtons:t[16],nextButtonActive:t[17],prevButtonActive:t[18],endScreenVideoTitle:t[19],endScreenVideoThumb:t[20],isOneVideoPlaylist:t[21],supportLink:t[22],outerContainerRef:t[23],fullScreenTarget:t[24],showMiniTimer:t[25],playerStarted:t[34],playNextVideo:t[26],playPrevVideo:t[27],repeatPlaylist:t[28],seekToInteractive:t[29],toggleGraph:t[30],playPrevChapter:t[31],firstStart:t[36],seekTime:t[32]};return t[33]!==void 0&&(s.videoContainer=t[33]),e=new ch({props:s}),we.push(()=>qe(e,"videoContainer",o)),{c(){F(e.$$.fragment)},m(l,r){O(e,l,r),n=!0},p(l,r){const a={};r[0]&1&&(a.store=l[0]),r[0]&4&&(a.thumbUrl=l[2]),r[0]&8&&(a.videoLogoUrl=l[3]),r[0]&16&&(a.interactiveContainer=l[4]),r[0]&32&&(a.live=l[5]),r[0]&64&&(a.autoplay=l[6]),r[0]&128&&(a.canRewindLive=l[7]),r[0]&256&&(a.showAds=l[8]),r[0]&512&&(a.adsSlotId=l[9]),r[0]&1024&&(a.adsParams=l[10]),r[0]&2048&&(a.adsPreviewParam=l[11]),r[0]&4096&&(a.duration=l[12]),r[0]&8192&&(a.logoClickable=l[13]),r[0]&16384&&(a.logoHidden=l[14]),r[0]&65536&&(a.showNextPrevButtons=l[16]),r[0]&131072&&(a.nextButtonActive=l[17]),r[0]&262144&&(a.prevButtonActive=l[18]),r[0]&524288&&(a.endScreenVideoTitle=l[19]),r[0]&1048576&&(a.endScreenVideoThumb=l[20]),r[0]&2097152&&(a.isOneVideoPlaylist=l[21]),r[0]&4194304&&(a.supportLink=l[22]),r[0]&8388608&&(a.outerContainerRef=l[23]),r[0]&16777216&&(a.fullScreenTarget=l[24]),r[0]&33554432&&(a.showMiniTimer=l[25]),r[1]&8&&(a.playerStarted=l[34]),r[0]&67108864&&(a.playNextVideo=l[26]),r[0]&134217728&&(a.playPrevVideo=l[27]),r[0]&268435456&&(a.repeatPlaylist=l[28]),r[0]&536870912&&(a.seekToInteractive=l[29]),r[0]&1073741824&&(a.toggleGraph=l[30]),r[1]&1&&(a.playPrevChapter=l[31]),!i&&r[1]&4&&(i=!0,a.videoContainer=l[33],Ue(()=>i=!1)),e.$set(a)},i(l){n||(d(e.$$.fragment,l),n=!0)},o(l){b(e.$$.fragment,l),n=!1},d(l){z(e,l)}}}function ph(t){let e,i,n,o;const s=[mh,dh],l=[];function r(a,c){return a[15]?0:1}return i=r(t),n=l[i]=s[i](t),{c(){e=E("div"),n.c(),u(e,"class","root v-cghoty")},m(a,c){T(a,e,c),l[i].m(e,null),o=!0},p(a,c){let f=i;i=r(a),i===f?l[i].p(a,c):(de(),b(l[f],1,1,()=>{l[f]=null}),me(),n=l[i],n?n.p(a,c):(n=l[i]=s[i](a),n.c()),d(n,1),n.m(e,null))},i(a){o||(d(n),o=!0)},o(a){b(n),o=!1},d(a){a&&S(e),l[i].d()}}}function hh(t,e,i){let{sources:n}=e,{store:o}=e,{microStoresRoot:s}=e,{uiConfig:l}=e,{title:r}=e,{thumbUrl:a}=e,{videoLogoUrl:c}=e,{interactiveContainer:f}=e,{subtitles:m}=e,{live:h}=e,{preload:_}=e,{autoplay:g}=e,{volume:k=void 0}=e,{muted:v=void 0}=e,{fromTime:P}=e,{canRewindLive:y}=e,{showAds:C}=e,{adsSlotId:A=void 0}=e,{adsParams:ne=void 0}=e,{adsPreviewParam:M=void 0}=e,{duration:U=void 0}=e,{logoClickable:re}=e,{logoHidden:x}=e,{isMobile:w}=e,{showNextPrevButtons:$=!1}=e,{nextButtonActive:G=!1}=e,{prevButtonActive:oe=!1}=e,{endScreenVideoTitle:W=void 0}=e,{endScreenVideoThumb:V=void 0}=e,{isOneVideoPlaylist:Y=!1}=e,{supportLink:I}=e,{outerContainerRef:le=void 0}=e,{fullScreenTarget:Ee=void 0}=e,{failoverHosts:Re=void 0}=e,{showMiniTimer:Be=!1}=e,{playNextVideo:De=te.noop}=e,{playPrevVideo:fe=te.noop}=e,{repeatPlaylist:ke=te.noop}=e,{seekToInteractive:Q=te.noop}=e,{toggleGraph:ee=te.noop}=e,{playPrevChapter:ye=te.noop}=e;const{subscribers:ae,stores:He}=s;Tc(l);const Ve=sn(),Ie=o.ui.debugPanelVisible,ce=o.ui.playerSize;let Pe,be=null,se=!1;o.getAdmanWrapper().init({switchFromAdsToVideo:o.actions.internal.switchFromAdsToVideo,switchFromVideoToAds:o.actions.internal.switchFromVideoToAds,setMuted:o.actions.external.setMuted},o.ads,{isMobile:o.ui.isMobile,mobileUnmuteButtonVisible:o.ui.mobileUnmuteButtonVisible,vsid:o.vsid}),Rc(o,He);const Ne=(ie=!1)=>{i(34,se=!0),ie?o.actions.external.firstStart(C):o.actions.internal.firstStart(C)};function pe(ie){const ht=n||ie;ht&&o.initVideo({container:Pe,sources:ht,failoverHosts:Re,subtitles:m});const st=te.safeStorage.get(ml)==="true";Ie.set(st),P>0&&o.actions.external.seekTime(P);const Kt=w?Ve.volumeDefault:k??_1()??Ve.volumeDefault,at=v??Uc();if(o.actions.external.setVolume(Kt),o.actions.external.setMuted(at),o.getAdmanWrapper().setInitialVolume(at?0:Kt),Ve.features.trafficSaving){const Pi=jc();Pi&&o.actions.internal.setTrafficSavingEnabled(Pi)}const kt=Fc(o.videoId);kt&&o.actions.internal.setQuality(kt),o.ui.isAutoplay.set(g),g?Ne():_&&Ve.features.preload&&o.actions.internal.preload()}const Se=ie=>{if(window.ResizeObserver){let ht,st;be=new ResizeObserver(te.throttleFn(Kt=>{const at=Kt[0];if(at){if(at.contentBoxSize){const kt=Array.isArray(at.contentBoxSize)?at.contentBoxSize[0]:at.contentBoxSize;ht=kt.inlineSize,st=kt.blockSize}else at.contentRect&&(ht=at.contentRect.width,st=at.contentRect.height);ce.set({width:ht,height:st})}},s1)),be.observe(ie)}ce.set({width:ie.clientWidth,height:ie.clientHeight})};ln(()=>{Se(Pe);const ie=ae.map(st=>st.init(o,He));if(h?.status==="upcoming"||h?.status==="waiting"){o.actions.internal.setWaitingLive(!0);return}if((h?.status==="finished"||h?.status==="postlive")&&!Object.keys(n||[]).length){o.actions.internal.setWaitingRecord(!0);return}return pe(),()=>{be?.disconnect(),ie.forEach(st=>st.unsubscribe()),o.destroy()}});function Ce(){se?o.actions.external.play():Ne(!0)}function Ke(){o.actions.external.pause()}function nt(ie){w||o.actions.external.setMuted(ie)}function Xe(ie){w||ie>=0&&ie<=1&&o.actions.external.setVolume(ie)}function Ye(ie){o.actions.internal.seekTime(ie,dt.SeekAction.UNKNOWN)}function tt(ie){o.actions.external.seekEpisodeStartTime(ie)}function St(){o.actions.external.returnFocusToEpisodes()}function pt(ie){o.actions.external.setPlaybackRate(ie)}function Ci(ie){o.actions.external.setAutoQualityLimits(ie)}function gt(ie){Pe=ie,i(33,Pe)}function Lt(ie){Pe=ie,i(33,Pe)}return t.$$set=ie=>{"sources"in ie&&i(37,n=ie.sources),"store"in ie&&i(0,o=ie.store),"microStoresRoot"in ie&&i(38,s=ie.microStoresRoot),"uiConfig"in ie&&i(39,l=ie.uiConfig),"title"in ie&&i(1,r=ie.title),"thumbUrl"in ie&&i(2,a=ie.thumbUrl),"videoLogoUrl"in ie&&i(3,c=ie.videoLogoUrl),"interactiveContainer"in ie&&i(4,f=ie.interactiveContainer),"subtitles"in ie&&i(40,m=ie.subtitles),"live"in ie&&i(5,h=ie.live),"preload"in ie&&i(41,_=ie.preload),"autoplay"in ie&&i(6,g=ie.autoplay),"volume"in ie&&i(42,k=ie.volume),"muted"in ie&&i(43,v=ie.muted),"fromTime"in ie&&i(44,P=ie.fromTime),"canRewindLive"in ie&&i(7,y=ie.canRewindLive),"showAds"in ie&&i(8,C=ie.showAds),"adsSlotId"in ie&&i(9,A=ie.adsSlotId),"adsParams"in ie&&i(10,ne=ie.adsParams),"adsPreviewParam"in ie&&i(11,M=ie.adsPreviewParam),"duration"in ie&&i(12,U=ie.duration),"logoClickable"in ie&&i(13,re=ie.logoClickable),"logoHidden"in ie&&i(14,x=ie.logoHidden),"isMobile"in ie&&i(15,w=ie.isMobile),"showNextPrevButtons"in ie&&i(16,$=ie.showNextPrevButtons),"nextButtonActive"in ie&&i(17,G=ie.nextButtonActive),"prevButtonActive"in ie&&i(18,oe=ie.prevButtonActive),"endScreenVideoTitle"in ie&&i(19,W=ie.endScreenVideoTitle),"endScreenVideoThumb"in ie&&i(20,V=ie.endScreenVideoThumb),"isOneVideoPlaylist"in ie&&i(21,Y=ie.isOneVideoPlaylist),"supportLink"in ie&&i(22,I=ie.supportLink),"outerContainerRef"in ie&&i(23,le=ie.outerContainerRef),"fullScreenTarget"in ie&&i(24,Ee=ie.fullScreenTarget),"failoverHosts"in ie&&i(45,Re=ie.failoverHosts),"showMiniTimer"in ie&&i(25,Be=ie.showMiniTimer),"playNextVideo"in ie&&i(26,De=ie.playNextVideo),"playPrevVideo"in ie&&i(27,fe=ie.playPrevVideo),"repeatPlaylist"in ie&&i(28,ke=ie.repeatPlaylist),"seekToInteractive"in ie&&i(29,Q=ie.seekToInteractive),"toggleGraph"in ie&&i(30,ee=ie.toggleGraph),"playPrevChapter"in ie&&i(31,ye=ie.playPrevChapter)},t.$$.update=()=>{t.$$.dirty[0]&32769&&o.ui.isMobile.set(w)},[o,r,a,c,f,h,g,y,C,A,ne,M,U,re,x,w,$,G,oe,W,V,Y,I,le,Ee,Be,De,fe,ke,Q,ee,ye,Ye,Pe,se,Ve,Ne,n,s,l,m,_,k,v,P,Re,pe,Ce,Ke,nt,Xe,tt,St,pt,Ci,gt,Lt]}class bh extends ve{constructor(e){super(),_e(this,e,hh,ph,ge,{sources:37,store:0,microStoresRoot:38,uiConfig:39,title:1,thumbUrl:2,videoLogoUrl:3,interactiveContainer:4,subtitles:40,live:5,preload:41,autoplay:6,volume:42,muted:43,fromTime:44,canRewindLive:7,showAds:8,adsSlotId:9,adsParams:10,adsPreviewParam:11,duration:12,logoClickable:13,logoHidden:14,isMobile:15,showNextPrevButtons:16,nextButtonActive:17,prevButtonActive:18,endScreenVideoTitle:19,endScreenVideoThumb:20,isOneVideoPlaylist:21,supportLink:22,outerContainerRef:23,fullScreenTarget:24,failoverHosts:45,showMiniTimer:25,playNextVideo:26,playPrevVideo:27,repeatPlaylist:28,seekToInteractive:29,toggleGraph:30,playPrevChapter:31,initVideo:46,play:47,pause:48,setMuted:49,setVolume:50,seekTime:32,seekEpisodeStartTime:51,returnFocusToEpisodes:52,setPlaybackRate:53,setAutoQualityLimits:54},fh,[-1,-1,-1])}get initVideo(){return this.$$.ctx[46]}get play(){return this.$$.ctx[47]}get pause(){return this.$$.ctx[48]}get setMuted(){return this.$$.ctx[49]}get setVolume(){return this.$$.ctx[50]}get seekTime(){return this.$$.ctx[32]}get seekEpisodeStartTime(){return this.$$.ctx[51]}get returnFocusToEpisodes(){return this.$$.ctx[52]}get setPlaybackRate(){return this.$$.ctx[53]}get setAutoQualityLimits(){return this.$$.ctx[54]}}function gh(t){let e,i;return{c(){e=N("svg"),i=N("path"),u(i,"fill",t[0]),u(i,"d","M38.245 6c3.566 0 4.859.371 6.162 1.069a7.27 7.27 0 0 1 3.025 3.024c.697 1.303 1.068 2.597 1.068 6.163v23.489c0 3.566-.371 4.859-1.069 6.162a7.27 7.27 0 0 1-3.024 3.025C43.104 49.629 41.811 50 38.245 50h-19.49c-3.565 0-4.859-.371-6.162-1.069a7.27 7.27 0 0 1-3.024-3.024C8.87 44.604 8.5 43.311 8.5 39.745v-23.49c0-3.565.371-4.859 1.069-6.162a7.27 7.27 0 0 1 3.024-3.024C13.896 6.37 15.19 6 18.756 6h19.489zm.314 3H18.756c-2.799 0-3.761.186-4.749.714a4.27 4.27 0 0 0-1.793 1.793c-.508.95-.7 1.876-.713 4.434L11.5 39.744c0 2.799.186 3.761.714 4.749a4.27 4.27 0 0 0 1.793 1.793c.988.528 1.95.714 4.749.714h19.489c2.798 0 3.76-.186 4.748-.714a4.27 4.27 0 0 0 1.793-1.793c.528-.988.714-1.95.714-4.748v-23.49c0-2.798-.186-3.76-.714-4.748a4.27 4.27 0 0 0-1.793-1.793c-.95-.508-1.876-.7-4.434-.713zM19.22 38c.445 0 .607.046.77.134a.91.91 0 0 1 .377.378c.088.163.134.324.134.77v1.436c0 .446-.046.607-.134.77a.908.908 0 0 1-.378.378c-.162.088-.324.134-.77.134h-1.436c-.446 0-.608-.046-.77-.134a.908.908 0 0 1-.378-.378c-.088-.163-.134-.324-.134-.77v-1.436c0-.446.046-.607.134-.77a.908.908 0 0 1 .378-.378c.162-.088.324-.134.77-.134h1.436zm20 0c.445 0 .606.046.77.134a.91.91 0 0 1 .377.378c.088.163.134.324.134.77v1.436c0 .446-.046.607-.134.77a.908.908 0 0 1-.378.378c-.163.088-.324.134-.77.134h-1.436c-.446 0-.607-.046-.77-.134a.908.908 0 0 1-.378-.378c-.088-.163-.134-.324-.134-.77v-1.436c0-.446.046-.607.134-.77a.908.908 0 0 1 .378-.378c.163-.088.324-.134.77-.134h1.436zm-20-8c.445 0 .607.046.77.134a.91.91 0 0 1 .377.378c.088.162.134.324.134.77v1.436c0 .446-.046.607-.134.77a.908.908 0 0 1-.378.378c-.162.088-.324.134-.77.134h-1.436c-.446 0-.608-.046-.77-.134a.908.908 0 0 1-.378-.378c-.088-.163-.134-.324-.134-.77v-1.436c0-.446.046-.608.134-.77a.908.908 0 0 1 .378-.378c.162-.088.324-.134.77-.134h1.436zm20 0c.445 0 .606.046.77.134a.91.91 0 0 1 .377.378c.088.162.134.324.134.77v1.436c0 .446-.046.607-.134.77a.908.908 0 0 1-.378.378c-.163.088-.324.134-.77.134h-1.436c-.446 0-.607-.046-.77-.134a.908.908 0 0 1-.378-.378c-.088-.163-.134-.324-.134-.77v-1.436c0-.446.046-.608.134-.77a.908.908 0 0 1 .378-.378c.163-.088.324-.134.77-.134h1.436zm-20-8c.445 0 .607.046.77.134a.91.91 0 0 1 .377.378c.088.162.134.324.134.77v1.436c0 .446-.046.608-.134.77a.908.908 0 0 1-.378.378c-.162.088-.324.134-.77.134h-1.436c-.446 0-.608-.046-.77-.134a.908.908 0 0 1-.378-.378c-.088-.162-.134-.324-.134-.77v-1.436c0-.446.046-.608.134-.77a.908.908 0 0 1 .378-.378c.162-.088.324-.134.77-.134h1.436zm20 0c.445 0 .606.046.77.134a.91.91 0 0 1 .377.378c.088.162.134.324.134.77v1.436c0 .446-.046.608-.134.77a.908.908 0 0 1-.378.378c-.163.088-.324.134-.77.134h-1.436c-.446 0-.607-.046-.77-.134a.908.908 0 0 1-.378-.378c-.088-.162-.134-.324-.134-.77v-1.436c0-.446.046-.608.134-.77a.908.908 0 0 1 .378-.378c.163-.088.324-.134.77-.134h1.436zm-20-8c.445 0 .607.046.77.134a.91.91 0 0 1 .377.378c.088.162.134.324.134.77v1.436c0 .446-.046.608-.134.77a.908.908 0 0 1-.378.378c-.162.088-.324.134-.77.134h-1.436c-.446 0-.608-.046-.77-.134a.908.908 0 0 1-.378-.378c-.088-.162-.134-.324-.134-.77v-1.436c0-.446.046-.607.134-.77a.908.908 0 0 1 .378-.378c.162-.088.324-.134.77-.134h1.436zm20 0c.445 0 .606.046.77.134a.91.91 0 0 1 .377.378c.088.162.134.324.134.77v1.436c0 .446-.046.608-.134.77a.908.908 0 0 1-.378.378c-.163.088-.324.134-.77.134h-1.436c-.446 0-.607-.046-.77-.134a.908.908 0 0 1-.378-.378c-.088-.162-.134-.324-.134-.77v-1.436c0-.446.046-.607.134-.77a.908.908 0 0 1 .378-.378c.163-.088.324-.134.77-.134h1.436z"),u(e,"width","57"),u(e,"height","60"),u(e,"fill","none"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"aria-hidden","true"),u(e,"data-testid","stub-icon")},m(n,o){T(n,e,o),p(e,i)},p(n,[o]){o&1&&u(i,"fill",n[0])},i:j,o:j,d(n){n&&S(e)}}}function _h(t,e,i){let{isWhite:n=!1}=e,o;return t.$$set=s=>{"isWhite"in s&&i(1,n=s.isWhite)},t.$$.update=()=>{t.$$.dirty&2&&i(0,o=n?"#fff":"#909499")},[o,n]}class vh extends ve{constructor(e){super(),_e(this,e,_h,gh,ge,{isWhite:1})}}function kh(t){Ze(t,"v-1y9fytq",".playerStub.v-1y9fytq{width:100%;height:100%;background-color:#222;display:flex;justify-content:center;align-items:center;position:relative;background-position:center;background-size:cover;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif}.title.v-1y9fytq{position:absolute;left:0;top:0;width:100%;font-size:15px;color:#fff;box-sizing:border-box;padding:18px 20px 10px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}")}function Xa(t){let e,i;return{c(){e=E("div"),i=ze(t[0]),u(e,"class","title v-1y9fytq")},m(n,o){T(n,e,o),p(e,i)},p(n,o){o&1&&xe(i,n[0])},d(n){n&&S(e)}}}function Ja(t){let e,i;return e=new vh({props:{isWhite:!!t[1]}}),{c(){F(e.$$.fragment)},m(n,o){O(e,n,o),i=!0},p(n,o){const s={};o&2&&(s.isWhite=!!n[1]),e.$set(s)},i(n){i||(d(e.$$.fragment,n),i=!0)},o(n){b(e.$$.fragment,n),i=!1},d(n){z(e,n)}}}function wh(t){let e,i,n,o,s=t[0]&&Xa(t),l=(!t[0]||!t[1])&&Ja(t);return{c(){e=E("div"),s&&s.c(),i=R(),l&&l.c(),u(e,"class","playerStub v-1y9fytq"),u(e,"style",n=t[1]?`background-image: url('${t[1]}')`:"")},m(r,a){T(r,e,a),s&&s.m(e,null),p(e,i),l&&l.m(e,null),o=!0},p(r,[a]){r[0]?s?s.p(r,a):(s=Xa(r),s.c(),s.m(e,i)):s&&(s.d(1),s=null),!r[0]||!r[1]?l?(l.p(r,a),a&3&&d(l,1)):(l=Ja(r),l.c(),d(l,1),l.m(e,null)):l&&(de(),b(l,1,1,()=>{l=null}),me()),(!o||a&2&&n!==(n=r[1]?`background-image: url('${r[1]}')`:""))&&u(e,"style",n)},i(r){o||(d(l),o=!0)},o(r){b(l),o=!1},d(r){r&&S(e),s&&s.d(),l&&l.d()}}}function yh(t,e,i){let{title:n}=e,{thumbUrl:o}=e;return t.$$set=s=>{"title"in s&&i(0,n=s.title),"thumbUrl"in s&&i(1,o=s.thumbUrl)},[n,o]}class Ch extends ve{constructor(e){super(),_e(this,e,yh,wh,ge,{title:0,thumbUrl:1},kh)}}class Ph{isSupported(){return"mediaSession"in navigator}setMetaData({title:e,artist:i="",thumbUrl:n=""}){this.isSupported()&&(navigator.mediaSession.metadata=new MediaMetadata({title:e,artist:i,artwork:[{src:n,sizes:"96x96",type:"image/png"},{src:n,sizes:"128x128",type:"image/png"},{src:n,sizes:"192x192",type:"image/png"},{src:n,sizes:"256x256",type:"image/png"},{src:n,sizes:"384x384",type:"image/png"},{src:n,sizes:"512x512",type:"image/png"}]}))}updateActionHandlers(e){this.resetActionHandlers(),this.setActionHandlers(e)}resetActionHandlers(){const e=[["play",null],["pause",null],["stop",null],["nexttrack",null],["previoustrack",null],["seekto",i=>null],["seekbackward",i=>null],["seekforward",i=>null]];this.setActionHandlers(e)}setActionHandlers(e){if(this.isSupported())for(const[i,n]of e)try{navigator.mediaSession.setActionHandler(i,n)}catch{throw new Error(`The media session action "${i}" is not supported yet.`)}}}function Sh(t){let e,i,n,o;return{c(){e=N("svg"),i=N("g"),n=N("path"),o=N("path"),u(n,"d","m30.744 4 .744.005c2.981.046 4.526.385 6.127 1.24a8.766 8.766 0 0 1 3.475 3.347l.174.312.15.292c.772 1.553 1.066 3.18 1.085 6.251v9.045a1.5 1.5 0 0 1-3 .016l-.008-9.651c-.04-2.032-.228-3.12-.627-4.035l-.126-.27-.13-.252A5.77 5.77 0 0 0 36.2 7.891c-1.187-.635-2.339-.873-5.115-.89L22.255 7c-2.737 0-4.003.2-5.071.698l-.133.064-.251.13a5.77 5.77 0 0 0-2.409 2.408c-.635 1.187-.873 2.339-.89 5.114l-.001 20.83c0 2.738.2 4.004.698 5.072l.064.133.13.251a5.769 5.769 0 0 0 2.408 2.409c1.1.588 2.134.825 4.438.88l.323.006 3.695.005H26a1.5 1.5 0 0 1 0 3h-.756l-3.718-.005c-2.989-.047-4.526-.377-6.14-1.24a8.766 8.766 0 0 1-3.476-3.347l-.174-.312-.15-.292c-.731-1.472-1.036-3.016-1.08-5.803l-.006-.756v-20.49l.005-.743c.046-2.981.385-4.526 1.24-6.127a8.765 8.765 0 0 1 3.347-3.475l.312-.174.292-.15c1.472-.731 3.016-1.036 5.803-1.08L22.256 4h8.488Z"),u(o,"d","M30.5 33.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C32.78 29 33.62 29 35.3 29h6.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311c.327.642.327 1.482.327 3.162v13.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C44.22 52 43.38 52 41.7 52h-6.4c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C30.5 49.72 30.5 48.88 30.5 47.2V33.8Z"),u(i,"fill","#fff"),u(e,"width","57"),u(e,"height","56"),u(e,"fill","none"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"aria-label","dummy-image"),u(e,"data-testid","pip-dummy-icon")},m(s,l){T(s,e,l),p(e,i),p(i,n),p(i,o)},p:j,i:j,o:j,d(s){s&&S(e)}}}class Th extends ve{constructor(e){super(),_e(this,e,null,Sh,ge,{})}}function Eh(t){Ze(t,"v-1pbsod4",".player-pip-dummy.v-1pbsod4{width:100%;height:100%;background-color:#19191A;display:flex;flex-direction:column;justify-content:center;align-items:center;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif}.player-pip-dummy.is-pip-api.v-1pbsod4{position:relative}.dummy-image.v-1pbsod4 svg{transform:scale(1.07143)}.dummy-image.desktop.v-1pbsod4{transform:scale(1.07143) rotate(-90deg) rotateY(180deg)}.title.v-1pbsod4{font-size:16px;color:#fff;padding:18px 20px 10px;text-align:center}")}function Ah(t){let e,i,n,o,s,l,r;return n=new Th({}),{c(){e=E("div"),i=E("div"),F(n.$$.fragment),o=R(),s=E("span"),l=ze(t[0]),u(i,"class","dummy-image v-1pbsod4"),B(i,"desktop",!t[1]),u(s,"class","title v-1pbsod4"),u(e,"class","player-pip-dummy v-1pbsod4"),B(e,"is-pip-api",t[2])},m(a,c){T(a,e,c),p(e,i),O(n,i,null),p(e,o),p(e,s),p(s,l),r=!0},p(a,[c]){(!r||c&2)&&B(i,"desktop",!a[1]),(!r||c&1)&&xe(l,a[0])},i(a){r||(d(n.$$.fragment,a),r=!0)},o(a){b(n.$$.fragment,a),r=!1},d(a){a&&S(e),z(n)}}}function Ih(t,e,i){let n,o;const s=mt(),l=!!s.webApi.pictureInPictureApi,r=s.interfaceLanguage$;D(t,r,f=>i(5,n=f));const a=s.ui.isMobile;D(t,a,f=>i(1,o=f));let c;return t.$$.update=()=>{t.$$.dirty&32&&i(0,c=n&&Z("pip_dummy_title"))},[c,o,l,r,a,n]}class Lh extends ve{constructor(e){super(),_e(this,e,Ih,Ah,ge,{},Eh)}}const Vh=460,Mh=280;class Vu{playerDomElement;playerParentShadowRoot;playerDummyElement;svelteContext;pipWindow;info={isActive$:new te.ValueSubject(!1),type:Vn.DocumentPictureInPicture};isSupported(){const e=te.getCurrentBrowser().browser===te.CurrentClientBrowser.Yandex,{isEmbed:i}=te.detectEmbed();return"documentPictureInPicture"in window&&!e&&!i}isActive(){return this.isSupported()&&!!documentPictureInPicture.window}setPlayerDomElement(e,i){this.playerDomElement=e,this.playerParentShadowRoot=i}setContext(e){this.svelteContext=e}async request(){if(!this.isSupported()||!this.playerDomElement||!this.playerParentShadowRoot)return;this.pipWindow=await documentPictureInPicture.requestWindow({width:Vh,height:Mh,copyStyleSheets:!0}),this.pipWindow.document.body.style.margin="0";const e=[...this.playerParentShadowRoot.styleSheets].map(s=>[...s.cssRules].map(l=>l.cssText).join(" ")).filter(Boolean).join(`
51
- `),i=document.createElement("style");i.textContent=e;const n=this.createStretchedContainer(),o=n.attachShadow({mode:"open"});o.append(i),o.append(this.playerDomElement),this.playerDummyElement=new Lh({target:this.playerParentShadowRoot,context:this.svelteContext}),this.pipWindow?.document.body.append(n),this.info.isActive$.next(!0),this.pipWindow?.addEventListener("unload",s=>{!this.playerDomElement||!this.playerParentShadowRoot||!this.playerDummyElement||(this.playerDummyElement.$destroy(),this.playerParentShadowRoot.append(this.playerDomElement),this.info.isActive$.next(!1))})}async remove(){return new Promise(e=>{documentPictureInPicture.window?.close(),e()})}async dispose(){await this.remove()}createStretchedContainer(){const e=document.createElement("div");return e.style.width="100%",e.style.height="100%",e}}function Bh(t){return t instanceof Vu}class Nh{static getLatestSupportedVersion(){const e=new kl,i=new Vu;if(i.isSupported())return i;if(e.isSupported())return e}}function xa(t,e){const i=new Set([...Object.keys(t),...Object.keys(e)]),n={};for(const o of i)n[o]=e[o]??t[o]??void 0;return n}const Rh="Inner error. Unexpectedly root annotation container null reference exception",Dh="Annotation with such name already exists",Oh="Annotation with such name does not exist";class ul extends Error{constructor(e){super(e),this.name="AnnotationError"}}const zh="1",Hh=100;class Fh{rootAnnotationsContainer;annotations=new Map;subscriptions=new te.Subscription;mutationObserver;playerSize;constructor(e){this.rootAnnotationsContainer=e;const i=te.throttleFn(()=>{for(const n of this.annotations.values())this.isElementExceedsBoundaries(n,this.playerSize.width,this.playerSize.height)?n.style.visibility="hidden":n.style.visibility="visible"},Hh);this.subscriptions.add(te.observeElementSize(this.rootAnnotationsContainer).subscribe(({width:n,height:o})=>{this.playerSize={width:n,height:o},i()})),this.mutationObserver=new MutationObserver(i),this.mutationObserver.observe(this.rootAnnotationsContainer,{attributes:!0,childList:!0,subtree:!0,characterData:!0})}add(e,i){if(!this.rootAnnotationsContainer)throw new ul(Rh);if(this.annotations.has(e))throw new ul(Dh);i.style.zIndex=i.style.zIndex??zh,i.style.position="absolute",this.rootAnnotationsContainer.append(i),this.annotations.set(e,i)}get(e){const i=this.annotations.get(e);if(!i)throw new ul(Oh);return i}remove(e){const i=this.get(e);this.annotations.delete(e)&&i.remove()}clear(){for(const e in this.annotations.keys())this.remove(e)}destroy(){this.annotations.clear(),this.subscriptions.unsubscribe(),this.mutationObserver.disconnect(),this.rootAnnotationsContainer=null}isElementExceedsBoundaries(e,i,n){const o=e.offsetTop,s=e.offsetLeft,l=e.offsetWidth,r=e.offsetHeight;return o<0||s<0||s+l>i||o+r>n}registryRootContainer(e){}addLayer(e){return new HTMLElement}getLayer(e){}removeLayer(e){}clearLayer(e){}detach(){}reattach(){}}class Vl{stateName;state$;subscription;init(e,i){return te.assertNonNullable(e),te.assertNonNullable(i),this.subscription=new te.Subscription,this.subscription}}class Uh extends Vl{stateName="fakeIsPlaying$";state$={...Me(null),toggle:()=>this.state$.update(e=>!e)};init(e,i){const n=super.init(e,i),{isInteractiveExpectation$:o}=e.state;return n.add(o.subscribe(s=>{this.state$.set(s?!0:null)})),n}}class qh extends Vl{stateName="interactiveControlsOpacity$";state$={...Me(null),toggle:()=>this.state$.update(e=>!e)};init(e,i){const n=super.init(e,i),{fakeIsPlaying$:o}=i,{isInteractiveExpectation$:s,isPlaying$:l}=e.state,{controlsVisible:r,isMobile:a}=e.ui,c=$e(a),f=()=>c&&$e(r);return n.add(r.subscribe(m=>{if(!c)return;const h=$e(o);$e(l)?this.state$.set(m):h!==null&&this.state$.set(!h||m)})),n.add(l.subscribe(m=>{this.state$.set(!m||f())})),n.add(o.subscribe(m=>{if(m===null)return;const h=$e(s);if(f()){this.state$.set(!0);return}h&&this.state$.set(!m)})),n}}class jh extends Vl{stateName="seekToInteractiveDisabledTooltip$";state$=Me("tooltip_chapter_without_interactive");init(e,i){const n=super.init(e,i);return n.add(e.state.interactiveEpisodes$.subscribe(o=>{o.length&&(o.every(s=>s.completed)?this.state$.set("tooltip_interactive_of_chapter_completed"):this.state$.set("tooltip_disabled_when_interactive"))})),n}}const Zh=()=>[Uh,qh,jh].reduce(({subscribers:t,stores:e},i)=>{const n=new i;return{subscribers:[...t,n],stores:{...e,[n.stateName]:n.state$}}},{subscribers:[],stores:{}}),Wh={preload:!0,autoplay:!1,repeat:!1,fromTime:0,canRewindLive:!0,showAds:!1,interfaceLanguage:te.InterfaceLanguage.RU,logoClickable:!1,logoHidden:!1,isMobile:te.isMobile(),isMediaSessionEnabled:!0,isPictureInPictureEnabled:!0,isAudioDisabled:!1,callbacks:{uiInfo:{}},tuningConfig:{configName:[]}};class Kh extends HTMLElement{svelteStubComponent;svelteRootComponent;store;microStoresRoot;statistics;sentry;_shadowRoot;playerContainer;rootContainer;uiConfig;coreConfig;statisticsConfig;interactiveController;interactiveContainer;graphMadePause;currentPlayingVideoIndex=0;needToRepeatPlaylist=!1;videoConfig=void 0;pictureInPictureApi=void 0;mediaSessionApi=void 0;unsubscribePlayerPhaseSubscription=void 0;logger;log;subscription;annotationsApi=void 0;createPlayerTimeout;prevIsid=void 0;isInited=!1;constructor(){super(),this.logger=new te.Logger,this.log=this.logger.createComponentLog("VKVideoPlayer"),this.subscription=new te.Subscription,this.graphMadePause=!1,window?.videoPlayerConfig?.debugLogs&&this.subscription.add(this.logger.log$.subscribe(e=>{console.log("%c player web component ","background:#77dd77;",`${e.component}`,e.message)}))}connectedCallback(){if(this.isInited)return;this.initPlayerRootContainers();const e=this.getAttribute("stub-title")??void 0,i=this.getAttribute("stub-thumb-url")??void 0;this.svelteStubComponent=new Ch({target:this.playerContainer,props:{title:e,thumbUrl:i}})}disconnectedCallback(){this.annotationsApi?.destroy(),this.svelteRootComponent?.$destroy(),this.svelteStubComponent?.$destroy(),this.subscription.unsubscribe(),this.unsubscribePlayerPhaseSubscription?.(),this.interactiveController?.destroy()}initPlayerRootContainers(){this.rootContainer=document.createElement("div"),this.rootContainer.style.position="relative",this.rootContainer.className="root-container",this.rootContainer.style.width="100%",this.rootContainer.style.height="100%";const e=document.createElement("div");e.style.position="absolute",e.className="shadow-root-container",e.style.width="100%",e.style.height="100%",this._shadowRoot=e.attachShadow({mode:"open"}),this.playerContainer=document.createElement("div"),this.playerContainer.style.all="initial",this.playerContainer.style.display="block",this.playerContainer.style.contain="strict",this.playerContainer.style.width="100%",this.playerContainer.style.height="100%",this._shadowRoot.append(this.playerContainer),this.rootContainer.append(e),this.append(this.rootContainer)}needToShowNextPrevButtons(){return this.videoConfig?this.videoConfig.videos.length>1:!1}isNextButtonActive(){return this.videoConfig?this.needToShowNextPrevButtons()&&(this.currentPlayingVideoIndex<this.videoConfig.videos.length-1||this.needToRepeatPlaylist):!1}isPrevButtonActive(){return this.videoConfig?this.needToShowNextPrevButtons()&&(this.currentPlayingVideoIndex>0||this.needToRepeatPlaylist):!1}isControlDisabled(e){return this.store?.ui.controls.disabledControls$?.includes(e)||!1}getNextVideoInfo(){if(!this.videoConfig)return{nextVideoTitle:void 0,nextVideoThumb:void 0};const e=this.videoConfig.videos[this.currentPlayingVideoIndex+1]||{};return{nextVideoTitle:e.title,nextVideoThumb:e.thumbUrl}}createPlayer(e,i={},n){if(!this.videoConfig)return;const{albumId:o,statPlace:s,statUserSalt:l,statAuthToken:r,statTrackCode:a,refreshStatAuthToken:c,preload:f,autoplay:m,volume:h,muted:_,fromTime:g,canRewindLive:k,supportLink:v,showAds:P,adsSlotId:y,adsParams:C={},adsPreviewParam:A,interfaceLanguage:ne,logoClickable:M,logoHidden:U,isMobile:re,isAudioDisabled:x,isLiveCatchUpMode:w,fullScreenTarget:$,failoverHosts:G,canDownload:oe,callbacks:W,interactiveData:V,showThumbTimer:Y,additionalButtons:I=[],repeat:le}=xa(this.videoConfig,i),{sources:Ee,title:Re,thumbUrl:Be,videoLogoUrl:De,unitedVideoId:fe,isClip:ke=!1,duration:Q,adsParams:ee={},videoEpisodes:ye,previewThumbsData:ae,subtitles:He,live:Ve}=e,Ie={...C,...ee},ce=this.getNextVideoInfo(),Pe={sources:Ee,title:Re,thumbUrl:Be,subtitles:He,unitedVideoId:fe,isClip:ke,live:Ve,albumId:o,statPlace:s,autoplay:m,muted:_,volume:h,fromTime:g,canRewindLive:k,showAds:P,adsSlotId:y,adsParams:Ie,adsPreviewParam:A,duration:Q,logoClickable:M,logoHidden:U,isMobile:re,repeat:le,showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive(),endScreenVideoTitle:ce.nextVideoTitle,endScreenVideoThumb:ce.nextVideoThumb,isOneVideoPlaylist:this.isOneVideoPlaylist()},be={pictureInPictureApi:this.pictureInPictureApi,annotationsApi:this.annotationsApi};this.log({message:`create player, props: ${JSON.stringify(Pe)}`});const se=this.uiConfig.features.statistics&&!!fe,{pid:Ne}=this.videoConfig?.interactiveData?.projectInfo||{};se&&(this.statistics=new L4({movieId:fe,albumId:o,place:s,trackCode:a,autoplay:(m&&!this.interactiveController)??!1,mobile:re,clip:ke,...Ne&&!this.isInited&&{projectId:Number(Ne)}},{refreshAuthToken:c,userSalt:l,config:this.statisticsConfig,...this.interactiveController&&{useIsid:!0,isid:this.prevIsid}})),this.uiConfig.features.sentry&&this.uiConfig.sentry.dsn&&new pl(this.uiConfig.sentry,{version:Zo,env:Nc},{movieId:fe,albumId:o,place:s,autoplay:(m&&!this.interactiveController)??!1,mobile:re,clip:ke}),this.interactiveController&&(this.prevIsid??=this.statistics?.oneStat.isid$.getValue()),this.sentry={...this.sentry,...pl.getInstance()};const Se=!!V,Ce=[];let Ke="tooltip_interactive_go_back_disabled_first";if(Se&&this.interactiveController){const Ye=this.interactiveController.state.isInitialChapter$.getValue(),tt=this.interactiveController.getHistoryState();Ye&&Ce.push(rt.REPLAY_BUTTON),this.interactiveController.getIsSeekable().getValue()||Ce.push(rt.SEEK_TO_INTERACTIVE_BUTTON),tt.hasPrevChapter$.getValue()||(Ce.push(rt.PLAY_PREV_CHAPTER_BUTTON),Ye||(tt.isGoBackLimited$.getValue()?Ke="tooltip_interactive_go_back_disabled_limit":Ke="tooltip_interactive_go_back_disabled"))}const nt=()=>{this.isInited=!1,this.prevIsid=void 0;const Ye=n?.info.isEnded$.getValue()&&this.interactiveController?.state.isEndChapter$.getValue();W.onReplayInteractiveVideo&&!Ye?W.onReplayInteractiveVideo():this.replayInteractiveVideo()};this.store=V4({player:n,interfaceLanguage:ne,videoId:fe,isClip:ke,isLiveCatchUpMode:w,isAudioDisabled:x,statAuthToken:r,callbacks:W,webApi:be,videoEpisodes:ye,previewThumbsData:ae,canDownload:oe,uiConfig:this.uiConfig,coreConfig:this.coreConfig,disabledControls:Ce,isInteractive:Se,interactiveRanges$:this.interactiveController?.state.interactiveRanges$,isInteractiveTime$:this.interactiveController?.state.isInteractiveTime$,replayInteractive:nt,playPrevChapterDisabledTooltip:Ke,hasInteractiveBranches:!!this.interactiveController?.getChapterBranches()?.length,additionalButtons:this.uiConfig.features.additionalButtons?I:[],looped:le&&this.videoConfig.videos.length===1,statistics:this.statistics});const{stores:Xe}=this.microStoresRoot=Zh();this.subscription.add(this.store.state.currentFormat$.subscribe(Ye=>W?.onCurrentFormatChanged?.(Ye))),this.subscription.add(Xe.interactiveControlsOpacity$.subscribe(Ye=>{Ye!==null&&this?.interactiveController?.setDisabledControls(Ye)})),this.subscription.add(this.store.state.throughputEstimation$.subscribe(Ye=>W?.onThroughputEstimationChanged?.(Ye))),this.subscription.add(this.store.state.trafficSavingEnabled$.subscribe(Ye=>W?.onTrafficSavingEnabledChanged?.(Ye))),this.subscription.add(this.store.state.currentPlaybackRate$.subscribe(Ye=>W?.onCurrentPlaybackRateChanged?.(Ye))),this.subscription.add(this.store.state.volume$.subscribe(Ye=>W?.onVolumeChange?.(Ye))),this.subscription.add(this.store.state.muted$.subscribe(Ye=>Ye?W?.onMute?.():W?.onUnmute?.())),this.subscription.add(this.store.state.videoBitrate$.subscribe(Ye=>W?.onVideoBitrateChanged?.(Ye))),this.subscription.add(this.store.state.isInteractiveTime$.subscribe(Ye=>{const tt=this.store?.ui.controls.disabledControls$;tt&&(Ye&&!tt.includes(Ho)&&tt.add(Ho),Ye||tt.remove(Ho))})),this.initMediaSession(),this.interactiveController&&se&&this.initInteractivesStatistics(),this.svelteRootComponent=new bh({target:this.playerContainer,props:{interactiveContainer:this.interactiveContainer,sources:Ee,store:this.store,microStoresRoot:this.microStoresRoot,uiConfig:this.uiConfig,title:Re,thumbUrl:Be,videoLogoUrl:De,subtitles:He,live:Ve,preload:f,autoplay:m,muted:_,volume:h,fromTime:g,canRewindLive:k,supportLink:v,showAds:P,adsSlotId:y,adsParams:Ie,adsPreviewParam:A,duration:Q,logoClickable:M,logoHidden:U,isMobile:re,failoverHosts:G,fullScreenTarget:$,showMiniTimer:Y,outerContainerRef:this.rootContainer,showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive(),endScreenVideoTitle:ce.nextVideoTitle,endScreenVideoThumb:ce.nextVideoThumb,isOneVideoPlaylist:this.isOneVideoPlaylist(),playNextVideo:()=>this.playNextVideo(),playPrevVideo:()=>this.playPrevVideo(),repeatPlaylist:()=>this.repeatPlaylist(),playPrevChapter:()=>this.playPrevChapter(),seekToInteractive:()=>this.seekToInteractive(),toggleGraph:()=>this.toggleGraph()}}),this.addPlayerInfoSubscriptions(),this.isInited||(this.isInited=!0,this.videoConfig?.callbacks?.onInited?.())}addPlayerInfoSubscriptions(){const e=this.store;if(!e)return;const i=this.videoConfig?.callbacks;i&&this.subscription.add(e.playerPhase.subscribe(o=>i.onPlayerPhaseChanged?.(o))).add(e.state.playbackState$.subscribe(o=>i.onPlaybackStateChanged?.(o))).add(e.state.isLive$.subscribe(o=>i.onIsLiveChanged?.(o))).add(e.state.isActiveLive$.subscribe(o=>i.onIsActiveLiveChanged?.(o))).add(e.state.isAudioAvailable$.subscribe(o=>i.onIsAudioAvailableChanged?.(o))).add(e.state.currentQuality$.subscribe(o=>i.onCurrentQualityChanged?.(o))).add(e.state.availableQualities$.subscribe(o=>i.onAvailableQualitiesChanged?.(o.map(({value:s})=>s).filter(s=>s!==lo.AUTO)))).add(e.ui.isPictureInPictureActive$.subscribe(o=>o?i.onPiPEnter?.():i.onPiPExit?.()));const n=i?.uiInfo;n&&this.subscription.add(e.ui.controlsVisible.subscribe(o=>n.onControlsVisibleChanged?.(o))).add(e.ui.isMobile.subscribe(o=>n.onIsMobileChanged?.(o))).add(e.ui.playerSize.subscribe(o=>n.onPlayerSizeChanged?.(o))).add(e.ui.controls.prevButton.subscribe(o=>n.onPrevButtonChanged?.(o))).add(e.ui.controls.playButton.subscribe(o=>n.onPlayButtonChanged?.(o))).add(e.ui.controls.replayButton.subscribe(o=>n.onReplayButtonChanged?.(o))).add(e.ui.controls.nextButton.subscribe(o=>n.onNextButtonChanged?.(o))).add(e.ui.controls.playPrevChapterButton.subscribe(o=>n.onPlayPrevChapterChanged?.(o))).add(e.ui.controls.seekToInteractiveButton.subscribe(o=>n.onSeekToInteractiveButtonChanged?.(o))).add(e.ui.controls.interactiveGraphButton.subscribe(o=>n.onGraphButtonChanged?.(o))).add(e.ui.controls.liveButton.subscribe(o=>n.onLiveButtonChanged?.(o))).add(e.ui.controls.time.subscribe(o=>n.onTimeUpdateChanged?.(o))).add(e.ui.controls.episodes.subscribe(o=>n.onEpisodesChanged?.(o))).add(e.ui.controls.subtitles.subscribe(o=>n.onSubtitlesChanged?.(o))).add(e.ui.controls.settings.subscribe(o=>n.onSettingsChanged?.(o))).add(e.ui.controls.fullscreen.subscribe(o=>n.onFullscreenChanged?.(o))).add(e.ui.controls.chromecast.subscribe(o=>n.onChromecastChanged?.(o))).add(e.ui.controls.pip.subscribe(o=>n.onPipChanged?.(o))).add(e.ui.controls.vkLogo.subscribe(o=>n.onVkLogoChanged?.(o))).add(e.ui.controls.interactiveTimeIcon.subscribe(o=>n.onInteractiveTimeIconChanged?.(o)))}playNextVideo(){if(!this.videoConfig)return;let e=!0;if(this.videoConfig.callbacks?.onNextVideoClick)try{e=this.videoConfig.callbacks.onNextVideoClick()}catch{this.log({message:"onNextVideoClick callback failed to execute"})}e&&(this.currentPlayingVideoIndex++,this.currentPlayingVideoIndex>=this.videoConfig.videos.length&&(this.currentPlayingVideoIndex=0),this.log({message:`play next video, index: ${this.currentPlayingVideoIndex}`}),this.createPlayerWithCurrentVideo())}playPrevVideo(){if(!this.videoConfig)return;let e=!0;if(this.videoConfig.callbacks?.onPrevVideoClick)try{e=this.videoConfig.callbacks.onPrevVideoClick()}catch{this.log({message:"onPrevVideoClick callback failed to execute"})}e&&(this.currentPlayingVideoIndex--,this.currentPlayingVideoIndex<0&&(this.currentPlayingVideoIndex=this.videoConfig.videos.length-1),this.log({message:`play prev video, index: ${this.currentPlayingVideoIndex}`}),this.createPlayerWithCurrentVideo())}repeatPlaylist(){this.currentPlayingVideoIndex=0,this.log({message:"repeat playlist"}),this.createPlayerWithCurrentVideo()}createPlayerWithCurrentVideo(e,i=!0){if(!this.videoConfig)return;const n=this.videoConfig.videos[this.currentPlayingVideoIndex];if(!n){this.log({message:"no next video"});return}this.isInited&&te.isNonNullable(n.unitedVideoId)&&this.store.actions.internal.nextMovie(n.unitedVideoId),this.svelteRootComponent?.$destroy(),this.createPlayer(n,{autoplay:i,fromTime:0},e)}playPrevChapter(){this.interactiveController?.playPrevChapter()}seekToInteractive(){const e=this.interactiveController?.getNextInteractiveStartTime();typeof e=="number"&&this.seekTime(e/1e3)}toggleGraph(){if(!this.isInited)return;const e=this.store,{isEnded$:i,playbackState$:n,graphIsOpened$:o}=e.state,{disabledControls$:s}=e.ui.controls,l=$e(i),r=$e(n);$e(o)?(o.set(!1),this.interactiveController?.toggleGraphView(!1),s.remove(Gl),!l&&this.graphMadePause&&this.play()):(this.graphMadePause=r==="playing",o.set(!0),this.interactiveController?.toggleGraphView(!0),s.add(Gl),!l&&this.graphMadePause&&this.pause())}async initInteractives(){if(this.videoConfig?.interactiveData)try{const{Interactives:e,EVENT_NAMES:i,CustomError:n}=await import("@vkontakte/videoplayer-interactive/esnext.cjs.js");this.interactiveContainer=document.createElement("div"),this.interactiveContainer.classList.add("interactiveContainer");const o=this.store?.interfaceLanguage$,s=o?$e(o):this.videoConfig.interfaceLanguage,{projectInfo:l,initChapterId:r,historyApi:a,videoLoader:c}=this.videoConfig.interactiveData;this.interactiveController=new e({parentElement:this.interactiveContainer,fullscreenTargetElement:this.playerContainer,lang:s,graph:this.uiConfig.features.interactiveGraph,projectInfo:l,initChapterId:r,historyApi:a,vkVideoLoader:c,lastFrame:this.uiConfig.features.interactiveLastFrame,permanentTextControls:this.uiConfig.features.interactiveTextPermanent,initSeamless:!0,config:this.uiConfig.interactive,coreConfig:this.coreConfig}),await this.interactiveController.setManifest(this.videoConfig.interactiveData.manifest);const{isInteractiveExpectation$:f}=this.interactiveController.state;this.uiConfig.features.seekToInteractive&&this.subscription.add(this.interactiveController.getIsSeekable().subscribe(h=>{if(!this.isInited)return;const _=this.store;h?_.ui.controls.disabledControls$.remove(rt.SEEK_TO_INTERACTIVE_BUTTON):_.ui.controls.disabledControls$.add(rt.SEEK_TO_INTERACTIVE_BUTTON)})),this.subscription.add(f.subscribe(h=>{this.store&&this.store.state.isInteractiveExpectation$.set(h)}));let m=!0;if(this.interactiveController.on(i.playerChanged,h=>{if(!this.videoConfig)return;this.videoConfig.videos[this.currentPlayingVideoIndex]={...h.config,title:l?.title||h.config.title};const _=m?this.videoConfig.autoplay:!0;this.createPlayerWithCurrentVideo(h.player,_),m&&(m=!1)}),this.interactiveController.on(i.interactives,({type:h,actionType:_})=>{if(!this.store)return;const g=f.getValue();if(h==="action-choice"&&_==="setRandomBranch"&&(this.store.state.graphIsOpened$.set(!1),this.store.ui.controls.disabledControls$.remove(u1)),h==="action-choice-canceled"){const k=$e(this.store.state.isPlaying$)||g;if(this.videoConfig?.isMobile&&k){this.store.ui.interactiveHideMobileControls.set(!0);return}this.videoConfig?.callbacks.onDisabledInteractiveClick?.()}}),this.videoConfig?.callbacks?.onInteractiveHistoryChanged){const h=this.interactiveController.getHistoryState();this.subscription.add(h.history$.subscribe(_=>{_.length&&this.videoConfig?.callbacks?.onInteractiveHistoryChanged?.(_)}))}this.interactiveController.events.noInteraction$.subscribe(()=>{this.videoConfig?.callbacks.onInteractiveTimeIconClick?.()}),this.interactiveController.on(i.errors,h=>{this.log({message:h.toString()})})}catch(e){this.log({message:e.message})}}async initInteractivesStatistics(){const{statSubscription:e,oneStat:i}=this.statistics;if(!(!e||!i||!this.interactiveController))try{const{INTERACTIVE_CLICK_ACTIONS:n}=await import("@vkontakte/videoplayer-interactive/esnext.cjs.js"),o={[n.GO_NEXT_BUTTON]:dt.InteractiveInterfaceClick.NEXT_BUTTON,[n.GO_NEXT_AREA]:dt.InteractiveInterfaceClick.NEXT_AREA,[n.WATCH_AGAIN]:dt.InteractiveInterfaceClick.WATCH_AGAIN,[n.OPEN_GRAPH]:dt.InteractiveInterfaceClick.GRAPH_SHOW,[n.CLOSE_GRAPH]:dt.InteractiveInterfaceClick.GRAPH_HIDE},{click$:s,nextMovie$:l}=this.interactiveController.getStatEvents(),r=new te.Subject;s.subscribe(a=>{a in o?r.next(o[a]):(i?.logError({errorType:"InteractiveVideosAction",fatal:!1}),this.sentry.report?.(new Error("InteractiveVideosAction"),{errorType:"InteractiveVideosAction",fatal:!1}))}),e.add(i.attachToInteractive({click$:r,nextMovie$:l}))}catch(n){i?.logError({errorType:"InteractiveVideos",fatal:!1}),this.sentry.report?.(n,{errorType:"InteractiveVideosAction",fatal:!1})}}initPlayer(e,i={}){if(!Array.isArray(e.videos)||e.videos.length===0&&!e.interactiveData)throw new Error("empty videos");this.videoConfig=xa(Wh,te.cloneDeepWith(e,n=>n instanceof HTMLElement?n:void 0)),this.uiConfig=Sc(i.ui??{}),this.coreConfig=i.core??{configName:[]},this.statisticsConfig=i.statistics??{},this.sentry={config:this.uiConfig.sentry??{}},te.isNonNullable(this.videoConfig.isMediaSessionEnabled)&&(this.uiConfig.features.mediaSession=this.videoConfig.isMediaSessionEnabled??!0),te.isNonNullable(this.videoConfig.isPictureInPictureEnabled)&&(this.uiConfig.features.pip=this.uiConfig.features.pip??this.videoConfig.isPictureInPictureEnabled??!0,this.uiConfig.features.dpip=this.uiConfig.features.dpip??this.videoConfig.isPictureInPictureEnabled??!0),this.videoConfig.isMobile=this.uiConfig.isMobile??this.videoConfig.isMobile,this.videoConfig.autoplay&&=this.uiConfig.features.autoplay,this.videoConfig.showAds=this.uiConfig.ads.enable??this.videoConfig.showAds,this.videoConfig.adsSlotId=this.uiConfig.ads.slot??this.videoConfig.adsSlotId,this.videoConfig.adsPreviewParam=this.uiConfig.ads.preview??this.videoConfig.adsPreviewParam,this.videoConfig.logoHidden=!(this.uiConfig.showLogo??!this.videoConfig.logoHidden),this.videoConfig.canRewindLive&&=this.uiConfig.features.liveRewind,this.videoConfig.supportLink=this.videoConfig.supportLink??this.uiConfig.supportLink,this.currentPlayingVideoIndex=0,this.needToRepeatPlaylist=this.videoConfig.repeat,this.uiConfig.features.pip&&(this.uiConfig.features.dpip?this.pictureInPictureApi=Nh.getLatestSupportedVersion():this.pictureInPictureApi=new kl),this.mediaSessionApi=this.uiConfig.features.mediaSession?new Ph:void 0,this.annotationsApi=this.uiConfig.features.annotations?new Fh(this.rootContainer):void 0,this.svelteStubComponent?.$destroy(),this.svelteRootComponent?.$destroy(),this.isInited=!1,this.prevIsid=void 0,this.interactiveController&&(this.interactiveController.destroy(),this.interactiveController=void 0),e.interactiveData?this.initInteractives():this.createPlayer(e.videos[0]),Bh(this.pictureInPictureApi)&&this.pictureInPictureApi.setPlayerDomElement(this.playerContainer,this._shadowRoot)}isOneVideoPlaylist(){return this.videoConfig?this.videoConfig.videos.length===1:!1}updateNextVideos(e){if(!this.videoConfig)return;this.log({message:`update next videos, videos: ${JSON.stringify(e)}`}),this.videoConfig.videos.splice(this.currentPlayingVideoIndex+1),this.videoConfig.videos.push(...e);const i=this.getNextVideoInfo();this.svelteRootComponent?.$set({showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive(),endScreenVideoTitle:i.nextVideoTitle,endScreenVideoThumb:i.nextVideoThumb,isOneVideoPlaylist:this.isOneVideoPlaylist()})}initMediaSession(){this.mediaSessionApi&&(this.unsubscribePlayerPhaseSubscription?.(),this.unsubscribePlayerPhaseSubscription=this.store?.playerPhase.subscribe(e=>{e===Oe.Video?this.setupMediaSessionForVideo():e===Oe.Ads&&this.setupMediaSessionForAds()}))}setupMediaSessionForVideo(){if(!(!this.videoConfig||!this.mediaSessionApi))try{const{title:e,thumbUrl:i}={...this.videoConfig.videos[this.currentPlayingVideoIndex]},n=[["play",()=>this.play()],["pause",()=>this.pause()],["seekto",o=>this.seekTime(o.seekTime)]];this.videoConfig.videos.length>1&&(this.currentPlayingVideoIndex<this.videoConfig.videos.length-1&&n.push(["nexttrack",()=>this.playNextVideo()]),this.currentPlayingVideoIndex>0&&n.push(["previoustrack",()=>this.playPrevVideo()])),this.mediaSessionApi.setMetaData({title:e,thumbUrl:i}),this.mediaSessionApi.updateActionHandlers(n)}catch(e){this.log({message:e.message})}}setupMediaSessionForAds(){if(!(!this.videoConfig||!this.mediaSessionApi))try{const e="\u0420\u0435\u043A\u043B\u0430\u043C\u0430",i=[["play",()=>this.play()],["pause",()=>this.pause()]];this.mediaSessionApi.setMetaData({title:e}),this.mediaSessionApi.updateActionHandlers(i)}catch(e){this.log({message:e.message})}}play(){this.isControlDisabled(rt.PLAY_BUTTON)||this.store?.playerPhase.is(Oe.WaitingLive)||(this.log({message:"play"}),this.svelteRootComponent?.play())}pause(){this.log({message:"pause"}),this.svelteRootComponent?.pause()}stop(){if(!this.videoConfig)return;this.log({message:"stop"}),this.svelteStubComponent?.$destroy();const e=this.videoConfig.videos[0];e&&(this.svelteRootComponent?.$destroy(),this.createPlayer(e))}setMuted(e){this.log({message:`set muted, muted: ${e}`}),this.svelteRootComponent?.setMuted(e)}setVolume(e){this.log({message:`set volume, volume: ${e}`}),this.svelteRootComponent?.setVolume(e)}setRepeat(e){this.log({message:`set repeat, repeat: ${e}`}),this.needToRepeatPlaylist=e,this.svelteRootComponent?.$set({needToRepeatPlaylist:this.needToRepeatPlaylist,showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive()})}seekTime(e){this.isControlDisabled(rt.TIMELINE)||(this.log({message:`seek time, time: ${e}`}),this.svelteRootComponent?.seekTime(e))}seekEpisodeStartTime(e){this.log({message:`seek episode start time, time: ${e}`}),this.svelteRootComponent?.seekEpisodeStartTime(e)}returnFocusToEpisodes(){this.log({message:"return focus to episodes button"}),this.svelteRootComponent?.returnFocusToEpisodes()}setPlaybackRate(e){this.log({message:`set playback rate to: ${e}`}),this.svelteRootComponent?.setPlaybackRate(e)}setAutoQualityLimits(e){this.log({message:`set auto quality limitation. Max: ${e.max??"none"}. Min: ${e.min??"none"}`}),this.svelteRootComponent?.setAutoQualityLimits(e)}addLanguage(e){this.store?.actions.internal.addLanguage(e)}async setLanguage(e){await this.store?.actions.internal.setLanguage(e)}setLiveStart(e){this.log({message:"live started"}),this.store?.actions.internal.setWaitingLive(!1),this.svelteRootComponent?.initVideo(e),this.play()}setWaitRecord(){this.log({message:"post live"}),this.store?.actions.internal.setWaitingRecord(!0),this.store?.destroy()}setLiveEnd(e){this.log({message:"live ended"}),this.store?.actions.internal.setWaitingRecord(!1),this.svelteRootComponent?.$destroy(),this.createPlayer(e,{autoplay:!1})}getDeviceId(){return this.statistics?.oneStat.getDeviceId()??void 0}replayInteractiveVideo(){this.interactiveController&&this.interactiveController.setChapter()}}const Gh=()=>{window.customElements.define("vk-video-player",Kh)};Object.defineProperty(exports,"VideoFormat",{enumerable:!0,get:function(){return Je.VideoFormat}});Object.defineProperty(exports,"VideoQuality",{enumerable:!0,get:function(){return Je.VideoQuality}});Object.defineProperty(exports,"InterfaceLanguage",{enumerable:!0,get:function(){return te.InterfaceLanguage}});Object.defineProperty(exports,"VKNumericLanguage",{enumerable:!0,get:function(){return te.VKNumericLanguage}});Object.defineProperty(exports,"loadVKLangPack",{enumerable:!0,get:function(){return te.loadVKLangPack}});exports.VERSION=Zo;exports.registerPlayerWebComponent=Gh;
51
+ `),i=document.createElement("style");i.textContent=e;const n=this.createStretchedContainer(),o=n.attachShadow({mode:"open"});o.append(i),o.append(this.playerDomElement),this.playerDummyElement=new Lh({target:this.playerParentShadowRoot,context:this.svelteContext}),this.pipWindow?.document.body.append(n),this.info.isActive$.next(!0),this.pipWindow?.addEventListener("unload",s=>{!this.playerDomElement||!this.playerParentShadowRoot||!this.playerDummyElement||(this.playerDummyElement.$destroy(),this.playerParentShadowRoot.append(this.playerDomElement),this.info.isActive$.next(!1))})}async remove(){return new Promise(e=>{documentPictureInPicture.window?.close(),e()})}async dispose(){await this.remove()}createStretchedContainer(){const e=document.createElement("div");return e.style.width="100%",e.style.height="100%",e}}function Bh(t){return t instanceof Vu}class Nh{static getLatestSupportedVersion(){const e=new kl,i=new Vu;if(i.isSupported())return i;if(e.isSupported())return e}}function xa(t,e){const i=new Set([...Object.keys(t),...Object.keys(e)]),n={};for(const o of i)n[o]=e[o]??t[o]??void 0;return n}const Rh="Inner error. Unexpectedly root annotation container null reference exception",Dh="Annotation with such name already exists",Oh="Annotation with such name does not exist";class ul extends Error{constructor(e){super(e),this.name="AnnotationError"}}const zh="1",Hh=100;class Fh{rootAnnotationsContainer;annotations=new Map;subscriptions=new te.Subscription;mutationObserver;playerSize;constructor(e){this.rootAnnotationsContainer=e;const i=te.throttleFn(()=>{for(const n of this.annotations.values())this.isElementExceedsBoundaries(n,this.playerSize.width,this.playerSize.height)?n.style.visibility="hidden":n.style.visibility="visible"},Hh);this.subscriptions.add(te.observeElementSize(this.rootAnnotationsContainer).subscribe(({width:n,height:o})=>{this.playerSize={width:n,height:o},i()})),this.mutationObserver=new MutationObserver(i),this.mutationObserver.observe(this.rootAnnotationsContainer,{attributes:!0,childList:!0,subtree:!0,characterData:!0})}add(e,i){if(!this.rootAnnotationsContainer)throw new ul(Rh);if(this.annotations.has(e))throw new ul(Dh);i.style.zIndex=i.style.zIndex??zh,i.style.position="absolute",this.rootAnnotationsContainer.append(i),this.annotations.set(e,i)}get(e){const i=this.annotations.get(e);if(!i)throw new ul(Oh);return i}remove(e){const i=this.get(e);this.annotations.delete(e)&&i.remove()}clear(){for(const e in this.annotations.keys())this.remove(e)}destroy(){this.annotations.clear(),this.subscriptions.unsubscribe(),this.mutationObserver.disconnect(),this.rootAnnotationsContainer=null}isElementExceedsBoundaries(e,i,n){const o=e.offsetTop,s=e.offsetLeft,l=e.offsetWidth,r=e.offsetHeight;return o<0||s<0||s+l>i||o+r>n}registryRootContainer(e){}addLayer(e){return new HTMLElement}getLayer(e){}removeLayer(e){}clearLayer(e){}detach(){}reattach(){}}class Vl{stateName;state$;subscription;init(e,i){return te.assertNonNullable(e),te.assertNonNullable(i),this.subscription=new te.Subscription,this.subscription}}class Uh extends Vl{stateName="fakeIsPlaying$";state$={...Me(null),toggle:()=>this.state$.update(e=>!e)};init(e,i){const n=super.init(e,i),{isInteractiveExpectation$:o}=e.state;return n.add(o.subscribe(s=>{this.state$.set(s?!0:null)})),n}}class qh extends Vl{stateName="interactiveControlsOpacity$";state$={...Me(null),toggle:()=>this.state$.update(e=>!e)};init(e,i){const n=super.init(e,i),{fakeIsPlaying$:o}=i,{isInteractiveExpectation$:s,isPlaying$:l}=e.state,{controlsVisible:r,isMobile:a}=e.ui,c=$e(a),f=()=>c&&$e(r);return n.add(r.subscribe(m=>{if(!c)return;const h=$e(o);$e(l)?this.state$.set(m):h!==null&&this.state$.set(!h||m)})),n.add(l.subscribe(m=>{this.state$.set(!m||f())})),n.add(o.subscribe(m=>{if(m===null)return;const h=$e(s);if(f()){this.state$.set(!0);return}h&&this.state$.set(!m)})),n}}class jh extends Vl{stateName="seekToInteractiveDisabledTooltip$";state$=Me("tooltip_chapter_without_interactive");init(e,i){const n=super.init(e,i);return n.add(e.state.interactiveEpisodes$.subscribe(o=>{o.length&&(o.every(s=>s.completed)?this.state$.set("tooltip_interactive_of_chapter_completed"):this.state$.set("tooltip_disabled_when_interactive"))})),n}}const Zh=()=>[Uh,qh,jh].reduce(({subscribers:t,stores:e},i)=>{const n=new i;return{subscribers:[...t,n],stores:{...e,[n.stateName]:n.state$}}},{subscribers:[],stores:{}}),Wh={preload:!0,autoplay:!1,repeat:!1,fromTime:0,canRewindLive:!0,showAds:!1,interfaceLanguage:te.InterfaceLanguage.RU,logoClickable:!1,logoHidden:!1,isMobile:te.isMobile(),isMediaSessionEnabled:!0,isPictureInPictureEnabled:!0,isAudioDisabled:!1,callbacks:{uiInfo:{}},tuningConfig:{configName:[]}};class Kh extends HTMLElement{svelteStubComponent;svelteRootComponent;store;microStoresRoot;statistics;sentry;_shadowRoot;playerContainer;rootContainer;uiConfig;coreConfig;statisticsConfig;interactiveController;interactiveContainer;graphMadePause;currentPlayingVideoIndex=0;needToRepeatPlaylist=!1;videoConfig=void 0;pictureInPictureApi=void 0;mediaSessionApi=void 0;unsubscribePlayerPhaseSubscription=void 0;logger;log;subscription;annotationsApi=void 0;createPlayerTimeout;prevIsid=void 0;isInited=!1;constructor(){super(),this.logger=new te.Logger,this.log=this.logger.createComponentLog("VKVideoPlayer"),this.subscription=new te.Subscription,this.graphMadePause=!1,window?.videoPlayerConfig?.debugLogs&&this.subscription.add(this.logger.log$.subscribe(e=>{console.log("%c player web component ","background:#77dd77;",`${e.component}`,e.message)}))}connectedCallback(){if(this.isInited)return;this.initPlayerRootContainers();const e=this.getAttribute("stub-title")??void 0,i=this.getAttribute("stub-thumb-url")??void 0;this.svelteStubComponent=new Ch({target:this.playerContainer,props:{title:e,thumbUrl:i}})}disconnectedCallback(){this.annotationsApi?.destroy(),this.svelteRootComponent?.$destroy(),this.svelteStubComponent?.$destroy(),this.subscription.unsubscribe(),this.unsubscribePlayerPhaseSubscription?.(),this.interactiveController?.destroy()}initPlayerRootContainers(){this.rootContainer=document.createElement("div"),this.rootContainer.style.position="relative",this.rootContainer.className="root-container",this.rootContainer.style.width="100%",this.rootContainer.style.height="100%";const e=document.createElement("div");e.style.position="absolute",e.className="shadow-root-container",e.style.width="100%",e.style.height="100%",this._shadowRoot=e.attachShadow({mode:"open"}),this.playerContainer=document.createElement("div"),this.playerContainer.style.all="initial",this.playerContainer.style.display="block",this.playerContainer.style.contain="strict",this.playerContainer.style.width="100%",this.playerContainer.style.height="100%",this._shadowRoot.append(this.playerContainer),this.rootContainer.append(e),this.append(this.rootContainer)}needToShowNextPrevButtons(){return this.videoConfig?this.videoConfig.videos.length>1:!1}isNextButtonActive(){return this.videoConfig?this.needToShowNextPrevButtons()&&(this.currentPlayingVideoIndex<this.videoConfig.videos.length-1||this.needToRepeatPlaylist):!1}isPrevButtonActive(){return this.videoConfig?this.needToShowNextPrevButtons()&&(this.currentPlayingVideoIndex>0||this.needToRepeatPlaylist):!1}isControlDisabled(e){return this.store?.ui.controls.disabledControls$?.includes(e)||!1}getNextVideoInfo(){if(!this.videoConfig)return{nextVideoTitle:void 0,nextVideoThumb:void 0};const e=this.videoConfig.videos[this.currentPlayingVideoIndex+1]||{};return{nextVideoTitle:e.title,nextVideoThumb:e.thumbUrl}}createPlayer(e,i={},n){if(!this.videoConfig)return;const{albumId:o,statPlace:s,statUserSalt:l,statAuthToken:r,statTrackCode:a,refreshStatAuthToken:c,preload:f,autoplay:m,volume:h,muted:_,fromTime:g,canRewindLive:k,supportLink:v,showAds:P,adsSlotId:y,adsParams:C={},adsPreviewParam:A,interfaceLanguage:ne,logoClickable:M,logoHidden:U,isMobile:re,isAudioDisabled:x,isLiveCatchUpMode:w,fullScreenTarget:$,failoverHosts:G,canDownload:oe,callbacks:W,interactiveData:V,showThumbTimer:Y,additionalButtons:I=[],repeat:le}=xa(this.videoConfig,i),{sources:Ee,title:Re,thumbUrl:Be,videoLogoUrl:De,unitedVideoId:fe,isClip:ke=!1,duration:Q,adsParams:ee={},videoEpisodes:ye,previewThumbsData:ae,subtitles:He,live:Ve}=e,Ie={...C,...ee},ce=this.getNextVideoInfo(),Pe={sources:Ee,title:Re,thumbUrl:Be,subtitles:He,unitedVideoId:fe,isClip:ke,live:Ve,albumId:o,statPlace:s,autoplay:m,muted:_,volume:h,fromTime:g,canRewindLive:k,showAds:P,adsSlotId:y,adsParams:Ie,adsPreviewParam:A,duration:Q,logoClickable:M,logoHidden:U,isMobile:re,repeat:le,showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive(),endScreenVideoTitle:ce.nextVideoTitle,endScreenVideoThumb:ce.nextVideoThumb,isOneVideoPlaylist:this.isOneVideoPlaylist()},be={pictureInPictureApi:this.pictureInPictureApi,annotationsApi:this.annotationsApi};this.log({message:`create player, props: ${JSON.stringify(Pe)}`});const se=this.uiConfig.features.statistics&&!!fe,{pid:Ne}=this.videoConfig?.interactiveData?.projectInfo||{};se&&(this.statistics=new L4({movieId:fe,albumId:o,place:s,trackCode:a,autoplay:(m&&!this.interactiveController)??!1,mobile:re,clip:ke,refDomain:this.videoConfig.refDomain,...Ne&&!this.isInited&&{projectId:Number(Ne)}},{refreshAuthToken:c,userSalt:l,config:this.statisticsConfig,...this.interactiveController&&{useIsid:!0,isid:this.prevIsid}})),this.uiConfig.features.sentry&&this.uiConfig.sentry.dsn&&new pl(this.uiConfig.sentry,{version:Zo,env:Nc},{movieId:fe,albumId:o,place:s,autoplay:(m&&!this.interactiveController)??!1,mobile:re,clip:ke}),this.interactiveController&&(this.prevIsid??=this.statistics?.oneStat.isid$.getValue()),this.sentry={...this.sentry,...pl.getInstance()};const Se=!!V,Ce=[];let Ke="tooltip_interactive_go_back_disabled_first";if(Se&&this.interactiveController){const Ye=this.interactiveController.state.isInitialChapter$.getValue(),tt=this.interactiveController.getHistoryState();Ye&&Ce.push(rt.REPLAY_BUTTON),this.interactiveController.getIsSeekable().getValue()||Ce.push(rt.SEEK_TO_INTERACTIVE_BUTTON),tt.hasPrevChapter$.getValue()||(Ce.push(rt.PLAY_PREV_CHAPTER_BUTTON),Ye||(tt.isGoBackLimited$.getValue()?Ke="tooltip_interactive_go_back_disabled_limit":Ke="tooltip_interactive_go_back_disabled"))}const nt=()=>{this.isInited=!1,this.prevIsid=void 0;const Ye=n?.info.isEnded$.getValue()&&this.interactiveController?.state.isEndChapter$.getValue();W.onReplayInteractiveVideo&&!Ye?W.onReplayInteractiveVideo():this.replayInteractiveVideo()};this.store=V4({player:n,interfaceLanguage:ne,videoId:fe,isClip:ke,isLiveCatchUpMode:w,isAudioDisabled:x,statAuthToken:r,callbacks:W,webApi:be,videoEpisodes:ye,previewThumbsData:ae,canDownload:oe,uiConfig:this.uiConfig,coreConfig:this.coreConfig,disabledControls:Ce,isInteractive:Se,interactiveRanges$:this.interactiveController?.state.interactiveRanges$,isInteractiveTime$:this.interactiveController?.state.isInteractiveTime$,replayInteractive:nt,playPrevChapterDisabledTooltip:Ke,hasInteractiveBranches:!!this.interactiveController?.getChapterBranches()?.length,additionalButtons:this.uiConfig.features.additionalButtons?I:[],looped:le&&this.videoConfig.videos.length===1,statistics:this.statistics});const{stores:Xe}=this.microStoresRoot=Zh();this.subscription.add(this.store.state.currentFormat$.subscribe(Ye=>W?.onCurrentFormatChanged?.(Ye))),this.subscription.add(Xe.interactiveControlsOpacity$.subscribe(Ye=>{Ye!==null&&this?.interactiveController?.setDisabledControls(Ye)})),this.subscription.add(this.store.state.throughputEstimation$.subscribe(Ye=>W?.onThroughputEstimationChanged?.(Ye))),this.subscription.add(this.store.state.trafficSavingEnabled$.subscribe(Ye=>W?.onTrafficSavingEnabledChanged?.(Ye))),this.subscription.add(this.store.state.currentPlaybackRate$.subscribe(Ye=>W?.onCurrentPlaybackRateChanged?.(Ye))),this.subscription.add(this.store.state.volume$.subscribe(Ye=>W?.onVolumeChange?.(Ye))),this.subscription.add(this.store.state.muted$.subscribe(Ye=>Ye?W?.onMute?.():W?.onUnmute?.())),this.subscription.add(this.store.state.videoBitrate$.subscribe(Ye=>W?.onVideoBitrateChanged?.(Ye))),this.subscription.add(this.store.state.isInteractiveTime$.subscribe(Ye=>{const tt=this.store?.ui.controls.disabledControls$;tt&&(Ye&&!tt.includes(Ho)&&tt.add(Ho),Ye||tt.remove(Ho))})),this.initMediaSession(),this.interactiveController&&se&&this.initInteractivesStatistics(),this.svelteRootComponent=new bh({target:this.playerContainer,props:{interactiveContainer:this.interactiveContainer,sources:Ee,store:this.store,microStoresRoot:this.microStoresRoot,uiConfig:this.uiConfig,title:Re,thumbUrl:Be,videoLogoUrl:De,subtitles:He,live:Ve,preload:f,autoplay:m,muted:_,volume:h,fromTime:g,canRewindLive:k,supportLink:v,showAds:P,adsSlotId:y,adsParams:Ie,adsPreviewParam:A,duration:Q,logoClickable:M,logoHidden:U,isMobile:re,failoverHosts:G,fullScreenTarget:$,showMiniTimer:Y,outerContainerRef:this.rootContainer,showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive(),endScreenVideoTitle:ce.nextVideoTitle,endScreenVideoThumb:ce.nextVideoThumb,isOneVideoPlaylist:this.isOneVideoPlaylist(),playNextVideo:()=>this.playNextVideo(),playPrevVideo:()=>this.playPrevVideo(),repeatPlaylist:()=>this.repeatPlaylist(),playPrevChapter:()=>this.playPrevChapter(),seekToInteractive:()=>this.seekToInteractive(),toggleGraph:()=>this.toggleGraph()}}),this.addPlayerInfoSubscriptions(),this.isInited||(this.isInited=!0,this.videoConfig?.callbacks?.onInited?.())}addPlayerInfoSubscriptions(){const e=this.store;if(!e)return;const i=this.videoConfig?.callbacks;i&&this.subscription.add(e.playerPhase.subscribe(o=>i.onPlayerPhaseChanged?.(o))).add(e.state.playbackState$.subscribe(o=>i.onPlaybackStateChanged?.(o))).add(e.state.isLive$.subscribe(o=>i.onIsLiveChanged?.(o))).add(e.state.isActiveLive$.subscribe(o=>i.onIsActiveLiveChanged?.(o))).add(e.state.isAudioAvailable$.subscribe(o=>i.onIsAudioAvailableChanged?.(o))).add(e.state.currentQuality$.subscribe(o=>i.onCurrentQualityChanged?.(o))).add(e.state.availableQualities$.subscribe(o=>i.onAvailableQualitiesChanged?.(o.map(({value:s})=>s).filter(s=>s!==lo.AUTO)))).add(e.ui.isPictureInPictureActive$.subscribe(o=>o?i.onPiPEnter?.():i.onPiPExit?.()));const n=i?.uiInfo;n&&this.subscription.add(e.ui.controlsVisible.subscribe(o=>n.onControlsVisibleChanged?.(o))).add(e.ui.isMobile.subscribe(o=>n.onIsMobileChanged?.(o))).add(e.ui.playerSize.subscribe(o=>n.onPlayerSizeChanged?.(o))).add(e.ui.controls.prevButton.subscribe(o=>n.onPrevButtonChanged?.(o))).add(e.ui.controls.playButton.subscribe(o=>n.onPlayButtonChanged?.(o))).add(e.ui.controls.replayButton.subscribe(o=>n.onReplayButtonChanged?.(o))).add(e.ui.controls.nextButton.subscribe(o=>n.onNextButtonChanged?.(o))).add(e.ui.controls.playPrevChapterButton.subscribe(o=>n.onPlayPrevChapterChanged?.(o))).add(e.ui.controls.seekToInteractiveButton.subscribe(o=>n.onSeekToInteractiveButtonChanged?.(o))).add(e.ui.controls.interactiveGraphButton.subscribe(o=>n.onGraphButtonChanged?.(o))).add(e.ui.controls.liveButton.subscribe(o=>n.onLiveButtonChanged?.(o))).add(e.ui.controls.time.subscribe(o=>n.onTimeUpdateChanged?.(o))).add(e.ui.controls.episodes.subscribe(o=>n.onEpisodesChanged?.(o))).add(e.ui.controls.subtitles.subscribe(o=>n.onSubtitlesChanged?.(o))).add(e.ui.controls.settings.subscribe(o=>n.onSettingsChanged?.(o))).add(e.ui.controls.fullscreen.subscribe(o=>n.onFullscreenChanged?.(o))).add(e.ui.controls.chromecast.subscribe(o=>n.onChromecastChanged?.(o))).add(e.ui.controls.pip.subscribe(o=>n.onPipChanged?.(o))).add(e.ui.controls.vkLogo.subscribe(o=>n.onVkLogoChanged?.(o))).add(e.ui.controls.interactiveTimeIcon.subscribe(o=>n.onInteractiveTimeIconChanged?.(o)))}playNextVideo(){if(!this.videoConfig)return;let e=!0;if(this.videoConfig.callbacks?.onNextVideoClick)try{e=this.videoConfig.callbacks.onNextVideoClick()}catch{this.log({message:"onNextVideoClick callback failed to execute"})}e&&(this.currentPlayingVideoIndex++,this.currentPlayingVideoIndex>=this.videoConfig.videos.length&&(this.currentPlayingVideoIndex=0),this.log({message:`play next video, index: ${this.currentPlayingVideoIndex}`}),this.createPlayerWithCurrentVideo())}playPrevVideo(){if(!this.videoConfig)return;let e=!0;if(this.videoConfig.callbacks?.onPrevVideoClick)try{e=this.videoConfig.callbacks.onPrevVideoClick()}catch{this.log({message:"onPrevVideoClick callback failed to execute"})}e&&(this.currentPlayingVideoIndex--,this.currentPlayingVideoIndex<0&&(this.currentPlayingVideoIndex=this.videoConfig.videos.length-1),this.log({message:`play prev video, index: ${this.currentPlayingVideoIndex}`}),this.createPlayerWithCurrentVideo())}repeatPlaylist(){this.currentPlayingVideoIndex=0,this.log({message:"repeat playlist"}),this.createPlayerWithCurrentVideo()}createPlayerWithCurrentVideo(e,i=!0){if(!this.videoConfig)return;const n=this.videoConfig.videos[this.currentPlayingVideoIndex];if(!n){this.log({message:"no next video"});return}this.isInited&&te.isNonNullable(n.unitedVideoId)&&this.store.actions.internal.nextMovie(n.unitedVideoId),this.svelteRootComponent?.$destroy(),this.createPlayer(n,{autoplay:i,fromTime:0},e)}playPrevChapter(){this.interactiveController?.playPrevChapter()}seekToInteractive(){const e=this.interactiveController?.getNextInteractiveStartTime();typeof e=="number"&&this.seekTime(e/1e3)}toggleGraph(){if(!this.isInited)return;const e=this.store,{isEnded$:i,playbackState$:n,graphIsOpened$:o}=e.state,{disabledControls$:s}=e.ui.controls,l=$e(i),r=$e(n);$e(o)?(o.set(!1),this.interactiveController?.toggleGraphView(!1),s.remove(Gl),!l&&this.graphMadePause&&this.play()):(this.graphMadePause=r==="playing",o.set(!0),this.interactiveController?.toggleGraphView(!0),s.add(Gl),!l&&this.graphMadePause&&this.pause())}async initInteractives(){if(this.videoConfig?.interactiveData)try{const{Interactives:e,EVENT_NAMES:i,CustomError:n}=await import("@vkontakte/videoplayer-interactive/esnext.cjs.js");this.interactiveContainer=document.createElement("div"),this.interactiveContainer.classList.add("interactiveContainer");const o=this.store?.interfaceLanguage$,s=o?$e(o):this.videoConfig.interfaceLanguage,{projectInfo:l,initChapterId:r,historyApi:a,videoLoader:c}=this.videoConfig.interactiveData;this.interactiveController=new e({parentElement:this.interactiveContainer,fullscreenTargetElement:this.playerContainer,lang:s,graph:this.uiConfig.features.interactiveGraph,projectInfo:l,initChapterId:r,historyApi:a,vkVideoLoader:c,lastFrame:this.uiConfig.features.interactiveLastFrame,permanentTextControls:this.uiConfig.features.interactiveTextPermanent,initSeamless:!0,config:this.uiConfig.interactive,coreConfig:this.coreConfig}),await this.interactiveController.setManifest(this.videoConfig.interactiveData.manifest);const{isInteractiveExpectation$:f}=this.interactiveController.state;this.uiConfig.features.seekToInteractive&&this.subscription.add(this.interactiveController.getIsSeekable().subscribe(h=>{if(!this.isInited)return;const _=this.store;h?_.ui.controls.disabledControls$.remove(rt.SEEK_TO_INTERACTIVE_BUTTON):_.ui.controls.disabledControls$.add(rt.SEEK_TO_INTERACTIVE_BUTTON)})),this.subscription.add(f.subscribe(h=>{this.store&&this.store.state.isInteractiveExpectation$.set(h)}));let m=!0;if(this.interactiveController.on(i.playerChanged,h=>{if(!this.videoConfig)return;this.videoConfig.videos[this.currentPlayingVideoIndex]={...h.config,title:l?.title||h.config.title};const _=m?this.videoConfig.autoplay:!0;this.createPlayerWithCurrentVideo(h.player,_),m&&(m=!1)}),this.interactiveController.on(i.interactives,({type:h,actionType:_})=>{if(!this.store)return;const g=f.getValue();if(h==="action-choice"&&_==="setRandomBranch"&&(this.store.state.graphIsOpened$.set(!1),this.store.ui.controls.disabledControls$.remove(u1)),h==="action-choice-canceled"){const k=$e(this.store.state.isPlaying$)||g;if(this.videoConfig?.isMobile&&k){this.store.ui.interactiveHideMobileControls.set(!0);return}this.videoConfig?.callbacks.onDisabledInteractiveClick?.()}}),this.videoConfig?.callbacks?.onInteractiveHistoryChanged){const h=this.interactiveController.getHistoryState();this.subscription.add(h.history$.subscribe(_=>{_.length&&this.videoConfig?.callbacks?.onInteractiveHistoryChanged?.(_)}))}this.interactiveController.events.noInteraction$.subscribe(()=>{this.videoConfig?.callbacks.onInteractiveTimeIconClick?.()}),this.interactiveController.on(i.errors,h=>{this.log({message:h.toString()})})}catch(e){this.log({message:e.message})}}async initInteractivesStatistics(){const{statSubscription:e,oneStat:i}=this.statistics;if(!(!e||!i||!this.interactiveController))try{const{INTERACTIVE_CLICK_ACTIONS:n}=await import("@vkontakte/videoplayer-interactive/esnext.cjs.js"),o={[n.GO_NEXT_BUTTON]:dt.InteractiveInterfaceClick.NEXT_BUTTON,[n.GO_NEXT_AREA]:dt.InteractiveInterfaceClick.NEXT_AREA,[n.WATCH_AGAIN]:dt.InteractiveInterfaceClick.WATCH_AGAIN,[n.OPEN_GRAPH]:dt.InteractiveInterfaceClick.GRAPH_SHOW,[n.CLOSE_GRAPH]:dt.InteractiveInterfaceClick.GRAPH_HIDE},{click$:s,nextMovie$:l}=this.interactiveController.getStatEvents(),r=new te.Subject;s.subscribe(a=>{a in o?r.next(o[a]):(i?.logError({errorType:"InteractiveVideosAction",fatal:!1}),this.sentry.report?.(new Error("InteractiveVideosAction"),{errorType:"InteractiveVideosAction",fatal:!1}))}),e.add(i.attachToInteractive({click$:r,nextMovie$:l}))}catch(n){i?.logError({errorType:"InteractiveVideos",fatal:!1}),this.sentry.report?.(n,{errorType:"InteractiveVideosAction",fatal:!1})}}initPlayer(e,i={}){if(!Array.isArray(e.videos)||e.videos.length===0&&!e.interactiveData)throw new Error("empty videos");this.videoConfig=xa(Wh,te.cloneDeepWith(e,n=>n instanceof HTMLElement?n:void 0)),this.uiConfig=Sc(i.ui??{}),this.coreConfig=i.core??{configName:[]},this.statisticsConfig=i.statistics??{},this.sentry={config:this.uiConfig.sentry??{}},te.isNonNullable(this.videoConfig.isMediaSessionEnabled)&&(this.uiConfig.features.mediaSession=this.videoConfig.isMediaSessionEnabled??!0),te.isNonNullable(this.videoConfig.isPictureInPictureEnabled)&&(this.uiConfig.features.pip=this.uiConfig.features.pip??this.videoConfig.isPictureInPictureEnabled??!0,this.uiConfig.features.dpip=this.uiConfig.features.dpip??this.videoConfig.isPictureInPictureEnabled??!0),this.videoConfig.isMobile=this.uiConfig.isMobile??this.videoConfig.isMobile,this.videoConfig.autoplay&&=this.uiConfig.features.autoplay,this.videoConfig.showAds=this.uiConfig.ads.enable??this.videoConfig.showAds,this.videoConfig.adsSlotId=this.uiConfig.ads.slot??this.videoConfig.adsSlotId,this.videoConfig.adsPreviewParam=this.uiConfig.ads.preview??this.videoConfig.adsPreviewParam,this.videoConfig.logoHidden=!(this.uiConfig.showLogo??!this.videoConfig.logoHidden),this.videoConfig.canRewindLive&&=this.uiConfig.features.liveRewind,this.videoConfig.supportLink=this.videoConfig.supportLink??this.uiConfig.supportLink,this.currentPlayingVideoIndex=0,this.needToRepeatPlaylist=this.videoConfig.repeat,this.uiConfig.features.pip&&(this.uiConfig.features.dpip?this.pictureInPictureApi=Nh.getLatestSupportedVersion():this.pictureInPictureApi=new kl),this.mediaSessionApi=this.uiConfig.features.mediaSession?new Ph:void 0,this.annotationsApi=this.uiConfig.features.annotations?new Fh(this.rootContainer):void 0,this.svelteStubComponent?.$destroy(),this.svelteRootComponent?.$destroy(),this.isInited=!1,this.prevIsid=void 0,this.interactiveController&&(this.interactiveController.destroy(),this.interactiveController=void 0),e.interactiveData?this.initInteractives():this.createPlayer(e.videos[0]),Bh(this.pictureInPictureApi)&&this.pictureInPictureApi.setPlayerDomElement(this.playerContainer,this._shadowRoot)}isOneVideoPlaylist(){return this.videoConfig?this.videoConfig.videos.length===1:!1}updateNextVideos(e){if(!this.videoConfig)return;this.log({message:`update next videos, videos: ${JSON.stringify(e)}`}),this.videoConfig.videos.splice(this.currentPlayingVideoIndex+1),this.videoConfig.videos.push(...e);const i=this.getNextVideoInfo();this.svelteRootComponent?.$set({showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive(),endScreenVideoTitle:i.nextVideoTitle,endScreenVideoThumb:i.nextVideoThumb,isOneVideoPlaylist:this.isOneVideoPlaylist()})}initMediaSession(){this.mediaSessionApi&&(this.unsubscribePlayerPhaseSubscription?.(),this.unsubscribePlayerPhaseSubscription=this.store?.playerPhase.subscribe(e=>{e===Oe.Video?this.setupMediaSessionForVideo():e===Oe.Ads&&this.setupMediaSessionForAds()}))}setupMediaSessionForVideo(){if(!(!this.videoConfig||!this.mediaSessionApi))try{const{title:e,thumbUrl:i}={...this.videoConfig.videos[this.currentPlayingVideoIndex]},n=[["play",()=>this.play()],["pause",()=>this.pause()],["seekto",o=>this.seekTime(o.seekTime)]];this.videoConfig.videos.length>1&&(this.currentPlayingVideoIndex<this.videoConfig.videos.length-1&&n.push(["nexttrack",()=>this.playNextVideo()]),this.currentPlayingVideoIndex>0&&n.push(["previoustrack",()=>this.playPrevVideo()])),this.mediaSessionApi.setMetaData({title:e,thumbUrl:i}),this.mediaSessionApi.updateActionHandlers(n)}catch(e){this.log({message:e.message})}}setupMediaSessionForAds(){if(!(!this.videoConfig||!this.mediaSessionApi))try{const e="\u0420\u0435\u043A\u043B\u0430\u043C\u0430",i=[["play",()=>this.play()],["pause",()=>this.pause()]];this.mediaSessionApi.setMetaData({title:e}),this.mediaSessionApi.updateActionHandlers(i)}catch(e){this.log({message:e.message})}}play(){this.isControlDisabled(rt.PLAY_BUTTON)||this.store?.playerPhase.is(Oe.WaitingLive)||(this.log({message:"play"}),this.svelteRootComponent?.play())}pause(){this.log({message:"pause"}),this.svelteRootComponent?.pause()}stop(){if(!this.videoConfig)return;this.log({message:"stop"}),this.svelteStubComponent?.$destroy();const e=this.videoConfig.videos[0];e&&(this.svelteRootComponent?.$destroy(),this.createPlayer(e))}setMuted(e){this.log({message:`set muted, muted: ${e}`}),this.svelteRootComponent?.setMuted(e)}setVolume(e){this.log({message:`set volume, volume: ${e}`}),this.svelteRootComponent?.setVolume(e)}setRepeat(e){this.log({message:`set repeat, repeat: ${e}`}),this.needToRepeatPlaylist=e,this.svelteRootComponent?.$set({needToRepeatPlaylist:this.needToRepeatPlaylist,showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive()})}seekTime(e){this.isControlDisabled(rt.TIMELINE)||(this.log({message:`seek time, time: ${e}`}),this.svelteRootComponent?.seekTime(e))}seekEpisodeStartTime(e){this.log({message:`seek episode start time, time: ${e}`}),this.svelteRootComponent?.seekEpisodeStartTime(e)}returnFocusToEpisodes(){this.log({message:"return focus to episodes button"}),this.svelteRootComponent?.returnFocusToEpisodes()}setPlaybackRate(e){this.log({message:`set playback rate to: ${e}`}),this.svelteRootComponent?.setPlaybackRate(e)}setAutoQualityLimits(e){this.log({message:`set auto quality limitation. Max: ${e.max??"none"}. Min: ${e.min??"none"}`}),this.svelteRootComponent?.setAutoQualityLimits(e)}addLanguage(e){this.store?.actions.internal.addLanguage(e)}async setLanguage(e){await this.store?.actions.internal.setLanguage(e)}setLiveStart(e){this.log({message:"live started"}),this.store?.actions.internal.setWaitingLive(!1),this.svelteRootComponent?.initVideo(e),this.play()}setWaitRecord(){this.log({message:"post live"}),this.store?.actions.internal.setWaitingRecord(!0),this.store?.destroy()}setLiveEnd(e){this.log({message:"live ended"}),this.store?.actions.internal.setWaitingRecord(!1),this.svelteRootComponent?.$destroy(),this.createPlayer(e,{autoplay:!1})}getDeviceId(){return this.statistics?.oneStat.getDeviceId()??void 0}replayInteractiveVideo(){this.interactiveController&&this.interactiveController.setChapter()}}const Gh=()=>{window.customElements.define("vk-video-player",Kh)};Object.defineProperty(exports,"VideoFormat",{enumerable:!0,get:function(){return Je.VideoFormat}});Object.defineProperty(exports,"VideoQuality",{enumerable:!0,get:function(){return Je.VideoQuality}});Object.defineProperty(exports,"InterfaceLanguage",{enumerable:!0,get:function(){return te.InterfaceLanguage}});Object.defineProperty(exports,"VKNumericLanguage",{enumerable:!0,get:function(){return te.VKNumericLanguage}});Object.defineProperty(exports,"loadVKLangPack",{enumerable:!0,get:function(){return te.loadVKLangPack}});exports.VERSION=Zo;exports.registerPlayerWebComponent=Gh;
package/esnext.esm.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
- * @vkontakte/videoplayer v1.1.36-dev.55db5eff.0
3
- * Fri, 31 May 2024 10:58:23 GMT
2
+ * @vkontakte/videoplayer v1.1.36-dev.cdb7114a.0
3
+ * Fri, 31 May 2024 07:45:19 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-1-36/doc/
5
5
  */
6
- import{VERSION as Pc,ChromecastState as Vn,PlaybackState as Nt,VideoQuality as uo,Player as Sc,VideoFormat as Po}from"@vkontakte/videoplayer-core/esnext.esm.js";import{VideoFormat as N5,VideoQuality as D5}from"@vkontakte/videoplayer-core/esnext.esm.js";import{InterfaceLanguage as Io,VideoQuality as Qo,fillWithDefault as Tc,VERSION as Ec,assertNonNullable as ut,safeStorage as wn,isNullable as xo,Subscription as Jn,isNonNullable as vn,isMacLike as ls,debounceFn as Ac,ValueSubject as Il,getCurrentBrowser as Ll,CurrentClientBrowser as h1,noop as je,checkNever as Ic,timeCodeToString as Lc,Subject as cn,addScript as Vc,Logger as g1,merge as Mc,Observable as Bc,map as Rc,loadVKLangPack as Nc,isIOS as Vl,getHighestQuality as Dc,throttleFn as tl,CurrentClientDevice as zc,getIOSVersion as Oc,detectEmbed as Hc,observeElementSize as Fc,isMobile as Uc,cloneDeepWith as qc}from"@vkontakte/videoplayer-shared/esnext.esm.js";import{InterfaceLanguage as O5,VKNumericLanguage as H5,loadVKLangPack as F5}from"@vkontakte/videoplayer-shared/esnext.esm.js";import{VERSION as Zc,SeekAction as It,OneStat as Wc,InteractiveInterfaceClick as So}from"@vkontakte/videoplayer-statistics/esnext.esm.js";import"@vkontakte/videoplayer-interactive/esnext.esm.js";function Z(){}function b1(t,e){for(const i in e)t[i]=e[i];return t}function _1(t){return t()}function ss(){return Object.create(null)}function tt(t){t.forEach(_1)}function kn(t){return typeof t=="function"}function ge(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Fo;function rs(t,e){return Fo||(Fo=document.createElement("a")),Fo.href=e,t===Fo.href}function Kc(t){return Object.keys(t).length===0}function Kt(t,...e){if(t==null){for(const n of e)n(void 0);return Z}const i=t.subscribe(...e);return i.unsubscribe?()=>i.unsubscribe():i}function xe(t){let e;return Kt(t,i=>e=i)(),e}function D(t,e,i){t.$$.on_destroy.push(Kt(e,i))}function Hn(t,e,i,n){if(t){const o=v1(t,e,i,n);return t[0](o)}}function v1(t,e,i,n){return t[1]&&n?b1(i.ctx.slice(),t[1](n(e))):i.ctx}function Fn(t,e,i,n){if(t[2]&&n){const o=t[2](n(i));if(e.dirty===void 0)return o;if(typeof o=="object"){const s=[],l=Math.max(e.dirty.length,o.length);for(let r=0;r<l;r+=1)s[r]=e.dirty[r]|o[r];return s}return e.dirty|o}return e.dirty}function Un(t,e,i,n,o,s){if(o){const l=v1(e,i,n,s);t.p(l,o)}}function qn(t){if(t.ctx.length>32){const e=[],i=t.ctx.length/32;for(let n=0;n<i;n++)e[n]=-1;return e}return-1}function jc(t){return t??""}const il=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function p(t,e){t.appendChild(e)}function Ze(t,e,i){const n=Gc(t);if(!n.getElementById(e)){const o=E("style");o.id=e,o.textContent=i,Yc(n,o)}}function Gc(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function Yc(t,e){return p(t.head||t,e),e.sheet}function T(t,e,i){t.insertBefore(e,i||null)}function S(t){t.parentNode&&t.parentNode.removeChild(t)}function yn(t,e){for(let i=0;i<t.length;i+=1)t[i]&&t[i].d(e)}function E(t){return document.createElement(t)}function R(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function ze(t){return document.createTextNode(t)}function N(){return ze(" ")}function at(){return ze("")}function pe(t,e,i,n){return t.addEventListener(e,i,n),()=>t.removeEventListener(e,i,n)}function Gt(t){return function(e){return e.preventDefault(),t.call(this,e)}}function nt(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function u(t,e,i){i==null?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}function Qc(t){return Array.from(t.childNodes)}function Je(t,e){e=""+e,t.data!==e&&(t.data=e)}function Pt(t,e,i,n){i==null?t.style.removeProperty(e):t.style.setProperty(e,i,n?"important":"")}let Uo;function Xc(){if(Uo===void 0){Uo=!1;try{typeof window<"u"&&window.parent&&window.parent.document}catch{Uo=!0}}return Uo}function Ml(t,e){getComputedStyle(t).position==="static"&&(t.style.position="relative");const n=E("iframe");n.setAttribute("style","display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;"),n.setAttribute("aria-hidden","true"),n.tabIndex=-1;const o=Xc();let s;return o?(n.src="data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}<\/script>",s=pe(window,"message",l=>{l.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{s=pe(n.contentWindow,"resize",e),e()}),p(t,n),()=>{(o||s&&n.contentWindow)&&s(),S(n)}}function B(t,e,i){t.classList.toggle(e,!!i)}function Mn(t,e){return new t(e)}let Eo;function To(t){Eo=t}function Lo(){if(!Eo)throw new Error("Function called outside component initialization");return Eo}function rn(t){Lo().$$.on_mount.push(t)}function nl(t){Lo().$$.on_destroy.push(t)}function Cl(t,e){return Lo().$$.context.set(t,e),e}function Bl(t){return Lo().$$.context.get(t)}function k1(){return Lo().$$.context}function ho(t,e){const i=t.$$.callbacks[e.type];i&&i.slice().forEach(n=>n.call(this,e))}const co=[],ke=[];let mo=[];const Pl=[],w1=Promise.resolve();let Sl=!1;function y1(){Sl||(Sl=!0,w1.then(C1))}function Vo(){return y1(),w1}function go(t){mo.push(t)}function Fe(t){Pl.push(t)}const ml=new Set;let so=0;function C1(){if(so!==0)return;const t=Eo;do{try{for(;so<co.length;){const e=co[so];so++,To(e),Jc(e.$$)}}catch(e){throw co.length=0,so=0,e}for(To(null),co.length=0,so=0;ke.length;)ke.pop()();for(let e=0;e<mo.length;e+=1){const i=mo[e];ml.has(i)||(ml.add(i),i())}mo.length=0}while(co.length);for(;Pl.length;)Pl.pop()();Sl=!1,ml.clear(),To(t)}function Jc(t){if(t.fragment!==null){t.update(),tt(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(go)}}function xc(t){const e=[],i=[];mo.forEach(n=>t.indexOf(n)===-1?e.push(n):i.push(n)),i.forEach(n=>n()),mo=e}const Xo=new Set;let to;function fe(){to={r:0,c:[],p:to}}function de(){to.r||tt(to.c),to=to.p}function d(t,e){t&&t.i&&(Xo.delete(t),t.i(e))}function g(t,e,i,n){if(t&&t.o){if(Xo.has(t))return;Xo.add(t),to.c.push(()=>{Xo.delete(t),n&&(i&&t.d(1),n())}),t.o(e)}else n&&n()}function Dt(t){return t?.length!==void 0?t:Array.from(t)}function $c(t,e){const i={},n={},o={$$scope:1};let s=t.length;for(;s--;){const l=t[s],r=e[s];if(r){for(const a in l)a in r||(n[a]=1);for(const a in r)o[a]||(i[a]=r[a],o[a]=1);t[s]=r}else for(const a in l)o[a]=1}for(const l in n)l in i||(i[l]=void 0);return i}function ef(t){return typeof t=="object"&&t!==null?t:{}}function Ue(t,e,i){const n=t.$$.props[e];n!==void 0&&(t.$$.bound[n]=i,i(t.$$.ctx[n]))}function F(t){t&&t.c()}function z(t,e,i){const{fragment:n,after_update:o}=t.$$;n&&n.m(e,i),go(()=>{const s=t.$$.on_mount.map(_1).filter(kn);t.$$.on_destroy?t.$$.on_destroy.push(...s):tt(s),t.$$.on_mount=[]}),o.forEach(go)}function O(t,e){const i=t.$$;i.fragment!==null&&(xc(i.after_update),tt(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])}function tf(t,e){t.$$.dirty[0]===-1&&(co.push(t),y1(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function be(t,e,i,n,o,s,l,r=[-1]){const a=Eo;To(t);const c=t.$$={fragment:null,ctx:[],props:s,update:Z,not_equal:o,bound:ss(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(a?a.$$.context:[])),callbacks:ss(),dirty:r,skip_bound:!1,root:e.target||a.$$.root};l&&l(c.root);let f=!1;if(c.ctx=i?i(t,e.props||{},(m,h,..._)=>{const b=_.length?_[0]:h;return c.ctx&&o(c.ctx[m],c.ctx[m]=b)&&(!c.skip_bound&&c.bound[m]&&c.bound[m](b),f&&tf(t,m)),h}):[],c.update(),f=!0,tt(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const m=Qc(e.target);c.fragment&&c.fragment.l(m),m.forEach(S)}else c.fragment&&c.fragment.c();e.intro&&d(t.$$.fragment),z(t,e.target,e.anchor),C1()}To(a)}class _e{$$=void 0;$$set=void 0;$destroy(){O(this,1),this.$destroy=Z}$on(e,i){if(!kn(i))return Z;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(i),()=>{const o=n.indexOf(i);o!==-1&&n.splice(o,1)}}$set(e){this.$$set&&!Kc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const nf="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(nf);var bo;(function(t){t.VK="vk",t.VK_VIDEO="vk_video"})(bo||(bo={}));const of={isMobile:void 0,defaultLanguage:Io.RU,downloadVKLanguages:!0,updateBuiltinLanguages:!0,isSmoothVideoRotate:!0,showSupport:!0,supportLink:"https://vk.com/support?act=new&from=v",showLogo:void 0,logoLink:"https://vk.com/video",logoType:bo.VK_VIDEO,addTimeToLogoLink:!0,volumeDefault:1,volumeMinRestore:.05,loaderDelay:500,minSubtitlesFontSize:13,autoSubtitlesTimeout:2e3,allowChangingFullscreenTarget:!0,trafficSavingLimit:Qo.Q_480P,episodeMinWidthPc:8,hideThumbTimerAfterTouch:!0,sentry:{dsn:"https://e349fd23c68f405388980d0868d0ff27@sentry.mvk.com/126",sampleRate:.01,whiteErrorCategoryList:[],blackErrorCategoryList:[],whiteErrorIdList:[],blackErrorIdList:[]},features:{autoplay:!0,statistics:!0,sentry:!0,preload:!0,subtitles:!0,episodes:!0,fullscreen:!0,timelinePreview:!0,mediaSession:!0,annotations:!0,pip:!0,dpip:!0,download:!0,liveRewind:!0,playbackRate:!0,trafficSaving:!0,episodesClustering:!0,copyVideoLink:!0,videoRotate:!0,interactiveGraph:!1,seekToInteractive:!0,interactiveLastFrame:!1,interactiveTextPermanent:!0,interactiveHideTime:!0,interactivePlayPrevChapter:!0,thumbTimer:!0,hotKeyMapModal:!0,hotKeyHelpers:!0,saveDebugInfoToFile:!1,additionalButtons:!0,contextMenuButton:!0},controls:{hideTimeout:500,hideTimeoutMobile:3e3,hideTimeoutInitial:200,hideTimeoutFullscreen:3e3,hideTimeoutCursor:3e3,hideTimeoutTooltips:1e3,collapseMobileUnmute:6e3,hide360IconTimeout:3e3,hideHotKeyHelpers:2e3,playbackRateMin:.25,playbackRateMax:2,playbackRateStep:.25,volumeStepKeyboard:.05,volumeStepWheel:.05,volumeBarTimeout:300,seekStepKeyboard:1e4,seekStepMobile:15e3,seekStepFrame:400},ads:{enable:void 0,initTimeout:2e3,loadTimeout:2e3,slot:void 0,preview:void 0},interactive:{historyMaxLength:100,noInteractionEventTimeout:3e4}},lf=t=>Tc(t,of),sf=t=>Cl("ui-config",t),an=()=>Bl("ui-config"),Tl="vk_player_debug_panel_opened",P1=300,rf=100,af="videoplayer",uf="videoplayer";var Ee;(function(t){t.ArrowLeft="ArrowLeft",t.ArrowUp="ArrowUp",t.ArrowRight="ArrowRight",t.ArrowDown="ArrowDown",t.Comma="Comma",t.Period="Period",t.Space="Space",t.KeyM="KeyM",t.KeyF="KeyF",t.KeyK="KeyK",t.KeyL="KeyL",t.KeyJ="KeyJ",t.KeyC="KeyC",t.KeyI="KeyI",t.Digit1="Digit1",t.Digit2="Digit2",t.Digit3="Digit3",t.Digit4="Digit4",t.Digit5="Digit5",t.Digit6="Digit6",t.Digit7="Digit7",t.Digit8="Digit8",t.Digit9="Digit9",t.Digit0="Digit0",t.Numpad1="Numpad1",t.Numpad2="Numpad2",t.Numpad3="Numpad3",t.Numpad4="Numpad4",t.Numpad5="Numpad5",t.Numpad6="Numpad6",t.Numpad7="Numpad7",t.Numpad8="Numpad8",t.Numpad9="Numpad9",t.Numpad0="Numpad0",t.ShiftLeft="ShiftLeft",t.ShiftRight="ShiftRight",t.Slash="Slash",t.Tab="Tab",t.Escape="Escape",t.Enter="Enter"})(Ee||(Ee={}));const Mo={[Ee.KeyF]:"f",[Ee.KeyK]:"k",[Ee.KeyC]:"c",[Ee.KeyM]:"m"},cf=new Set([Ee.ArrowLeft,Ee.ArrowRight,Ee.KeyL,Ee.KeyJ]),ff=new Set([Ee.Tab,Ee.Space,Ee.ArrowLeft,Ee.ArrowRight,Ee.ArrowUp,Ee.ArrowDown]),df=new Set([Ee.ShiftRight,Ee.ShiftLeft]);var st;(function(t){t.PLAY_BUTTON="PLAY_BUTTON",t.REPLAY_BUTTON="REPLAY_BUTTON",t.NEXT_BUTTON="NEXT_BUTTON",t.PREV_BUTTON="PREV_BUTTON",t.PICTURE_IN_PICTURE="PICTURE_IN_PICTURE",t.FULLSCREEN_BUTTON="FULLSCREEN_BUTTON",t.SETTINGS_BUTTON="SETTINGS_BUTTON",t.LIVE_BUTTON="LIVE_BUTTON",t.GRAPH_BUTTON="GRAPH_BUTTON",t.PLAY_PREV_CHAPTER_BUTTON="PLAY_PREV_CHAPTER_BUTTON",t.SEEK_TO_INTERACTIVE_BUTTON="SEEK_TO_INTERACTIVE_BUTTON",t.TIMELINE="TIMELINE",t.VOLUME_BAR="VOLUME_BAR",t.MUTE_BUTTON="MUTE_BUTTON",t.SUBTITLES_BUTTON="SUBTITLES_BUTTON",t.CHROMECAST_BUTTON="CHROMECAST_BUTTON",t.VK_BUTTON="VK_BUTTON",t.EPISODE_BUTTON="EPISODE_BUTTON",t.INCREMENT_PLAYBACK_RATE="INCREMENT_PLAYBACK_RATE",t.DECREMENT_PLAYBACK_RATE="DECREMENT_PLAYBACK_RATE"})(st||(st={}));const as=40,S1=260,mf=60,qo=8,T1=[st.TIMELINE],Jo=[...T1,st.GRAPH_BUTTON],us=[...T1,st.PLAY_BUTTON],E1=[...Jo,st.PLAY_BUTTON];var fo;(function(t){t[t.XS=320]="XS",t[t.S=509]="S",t[t.M=599]="M",t[t.L=699]="L"})(fo||(fo={}));var vt;(function(t){t.XS="xs",t.S="s",t.M="m",t.L="l",t.XL="xl"})(vt||(vt={}));const _o={[vt.XS]:0,[vt.S]:1,[vt.M]:2,[vt.L]:3,[vt.XL]:4},ro=[];function Ln(t,e){return{subscribe:Ve(t,e).subscribe}}function Ve(t,e=Z){let i;const n=new Set;function o(r){if(ge(t,r)&&(t=r,i)){const a=!ro.length;for(const c of n)c[1](),ro.push(c,t);if(a){for(let c=0;c<ro.length;c+=2)ro[c][0](ro[c+1]);ro.length=0}}}function s(r){o(r(t))}function l(r,a=Z){const c=[r,a];return n.add(c),n.size===1&&(i=e(o,s)||Z),r(t),()=>{n.delete(c),n.size===0&&i&&(i(),i=null)}}return{set:o,update:s,subscribe:l}}function Ni(t,e,i){const n=!Array.isArray(t),o=n?[t]:t;if(!o.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const s=e.length<2;return Ln(i,(l,r)=>{let a=!1;const c=[];let f=0,m=Z;const h=()=>{if(f)return;m();const b=e(n?c[0]:c,l,r);s?l(b):m=kn(b)?b:Z},_=o.map((b,k)=>Kt(b,v=>{c[k]=v,f&=~(1<<k),a&&h()},()=>{f|=1<<k}));return a=!0,h(),function(){tt(_),m(),a=!1}})}const pf="prod",Rl="1.1.36-dev.55db5eff.0",A1=(t,e,i)=>{const n=document.createElement("a");n.href=t,n.download=`${e}.${i}`,n.style.display="none",n.click()},I1=Symbol("storeContext"),L1=Symbol("microStoresContext"),hf=(t,e)=>{Cl(I1,t),Cl(L1,e)},dt=()=>{const t=Bl(I1);return ut(t,"Store context is empty!"),t},Bo=()=>{const t=Bl(L1);return ut(t,"MicroStores context is empty!"),t},ft=(t,e)=>V1(t,t.getValue(),e),V1=(t,e,i)=>Ln(e,n=>{const o=t.subscribe(s=>{n(s),i?.(s)});return()=>o.unsubscribe()}),gf=(t,e,i)=>{const n=t.info,{width:o,height:s}=xe(i.ui.playerSize),l=n.throughputEstimation$.getValue()?.toFixed(0)??0,r=n.rttEstimation$.getValue()?.toFixed(0)??0,a=n.isAutoQualityEnabled$.getValue()?"auto":"manual",c=`${Rl} (core: ${Pc}, stat: ${Zc}, shared: ${Ec})`,f=xe(i.state.errorLog$),m=f.length?`
6
+ import{VERSION as Pc,ChromecastState as Vn,PlaybackState as Nt,VideoQuality as uo,Player as Sc,VideoFormat as Po}from"@vkontakte/videoplayer-core/esnext.esm.js";import{VideoFormat as N5,VideoQuality as D5}from"@vkontakte/videoplayer-core/esnext.esm.js";import{InterfaceLanguage as Io,VideoQuality as Qo,fillWithDefault as Tc,VERSION as Ec,assertNonNullable as ut,safeStorage as wn,isNullable as xo,Subscription as Jn,isNonNullable as vn,isMacLike as ls,debounceFn as Ac,ValueSubject as Il,getCurrentBrowser as Ll,CurrentClientBrowser as h1,noop as je,checkNever as Ic,timeCodeToString as Lc,Subject as cn,addScript as Vc,Logger as g1,merge as Mc,Observable as Bc,map as Rc,loadVKLangPack as Nc,isIOS as Vl,getHighestQuality as Dc,throttleFn as tl,CurrentClientDevice as zc,getIOSVersion as Oc,detectEmbed as Hc,observeElementSize as Fc,isMobile as Uc,cloneDeepWith as qc}from"@vkontakte/videoplayer-shared/esnext.esm.js";import{InterfaceLanguage as O5,VKNumericLanguage as H5,loadVKLangPack as F5}from"@vkontakte/videoplayer-shared/esnext.esm.js";import{VERSION as Zc,SeekAction as It,OneStat as Wc,InteractiveInterfaceClick as So}from"@vkontakte/videoplayer-statistics/esnext.esm.js";import"@vkontakte/videoplayer-interactive/esnext.esm.js";function Z(){}function b1(t,e){for(const i in e)t[i]=e[i];return t}function _1(t){return t()}function ss(){return Object.create(null)}function tt(t){t.forEach(_1)}function kn(t){return typeof t=="function"}function ge(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Fo;function rs(t,e){return Fo||(Fo=document.createElement("a")),Fo.href=e,t===Fo.href}function Kc(t){return Object.keys(t).length===0}function Kt(t,...e){if(t==null){for(const n of e)n(void 0);return Z}const i=t.subscribe(...e);return i.unsubscribe?()=>i.unsubscribe():i}function xe(t){let e;return Kt(t,i=>e=i)(),e}function D(t,e,i){t.$$.on_destroy.push(Kt(e,i))}function Hn(t,e,i,n){if(t){const o=v1(t,e,i,n);return t[0](o)}}function v1(t,e,i,n){return t[1]&&n?b1(i.ctx.slice(),t[1](n(e))):i.ctx}function Fn(t,e,i,n){if(t[2]&&n){const o=t[2](n(i));if(e.dirty===void 0)return o;if(typeof o=="object"){const s=[],l=Math.max(e.dirty.length,o.length);for(let r=0;r<l;r+=1)s[r]=e.dirty[r]|o[r];return s}return e.dirty|o}return e.dirty}function Un(t,e,i,n,o,s){if(o){const l=v1(e,i,n,s);t.p(l,o)}}function qn(t){if(t.ctx.length>32){const e=[],i=t.ctx.length/32;for(let n=0;n<i;n++)e[n]=-1;return e}return-1}function jc(t){return t??""}const il=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function p(t,e){t.appendChild(e)}function Ze(t,e,i){const n=Gc(t);if(!n.getElementById(e)){const o=E("style");o.id=e,o.textContent=i,Yc(n,o)}}function Gc(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function Yc(t,e){return p(t.head||t,e),e.sheet}function T(t,e,i){t.insertBefore(e,i||null)}function S(t){t.parentNode&&t.parentNode.removeChild(t)}function yn(t,e){for(let i=0;i<t.length;i+=1)t[i]&&t[i].d(e)}function E(t){return document.createElement(t)}function R(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function ze(t){return document.createTextNode(t)}function N(){return ze(" ")}function at(){return ze("")}function pe(t,e,i,n){return t.addEventListener(e,i,n),()=>t.removeEventListener(e,i,n)}function Gt(t){return function(e){return e.preventDefault(),t.call(this,e)}}function nt(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function u(t,e,i){i==null?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}function Qc(t){return Array.from(t.childNodes)}function Je(t,e){e=""+e,t.data!==e&&(t.data=e)}function Pt(t,e,i,n){i==null?t.style.removeProperty(e):t.style.setProperty(e,i,n?"important":"")}let Uo;function Xc(){if(Uo===void 0){Uo=!1;try{typeof window<"u"&&window.parent&&window.parent.document}catch{Uo=!0}}return Uo}function Ml(t,e){getComputedStyle(t).position==="static"&&(t.style.position="relative");const n=E("iframe");n.setAttribute("style","display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;"),n.setAttribute("aria-hidden","true"),n.tabIndex=-1;const o=Xc();let s;return o?(n.src="data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}<\/script>",s=pe(window,"message",l=>{l.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{s=pe(n.contentWindow,"resize",e),e()}),p(t,n),()=>{(o||s&&n.contentWindow)&&s(),S(n)}}function B(t,e,i){t.classList.toggle(e,!!i)}function Mn(t,e){return new t(e)}let Eo;function To(t){Eo=t}function Lo(){if(!Eo)throw new Error("Function called outside component initialization");return Eo}function rn(t){Lo().$$.on_mount.push(t)}function nl(t){Lo().$$.on_destroy.push(t)}function Cl(t,e){return Lo().$$.context.set(t,e),e}function Bl(t){return Lo().$$.context.get(t)}function k1(){return Lo().$$.context}function ho(t,e){const i=t.$$.callbacks[e.type];i&&i.slice().forEach(n=>n.call(this,e))}const co=[],ke=[];let mo=[];const Pl=[],w1=Promise.resolve();let Sl=!1;function y1(){Sl||(Sl=!0,w1.then(C1))}function Vo(){return y1(),w1}function go(t){mo.push(t)}function Fe(t){Pl.push(t)}const ml=new Set;let so=0;function C1(){if(so!==0)return;const t=Eo;do{try{for(;so<co.length;){const e=co[so];so++,To(e),Jc(e.$$)}}catch(e){throw co.length=0,so=0,e}for(To(null),co.length=0,so=0;ke.length;)ke.pop()();for(let e=0;e<mo.length;e+=1){const i=mo[e];ml.has(i)||(ml.add(i),i())}mo.length=0}while(co.length);for(;Pl.length;)Pl.pop()();Sl=!1,ml.clear(),To(t)}function Jc(t){if(t.fragment!==null){t.update(),tt(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(go)}}function xc(t){const e=[],i=[];mo.forEach(n=>t.indexOf(n)===-1?e.push(n):i.push(n)),i.forEach(n=>n()),mo=e}const Xo=new Set;let to;function fe(){to={r:0,c:[],p:to}}function de(){to.r||tt(to.c),to=to.p}function d(t,e){t&&t.i&&(Xo.delete(t),t.i(e))}function g(t,e,i,n){if(t&&t.o){if(Xo.has(t))return;Xo.add(t),to.c.push(()=>{Xo.delete(t),n&&(i&&t.d(1),n())}),t.o(e)}else n&&n()}function Dt(t){return t?.length!==void 0?t:Array.from(t)}function $c(t,e){const i={},n={},o={$$scope:1};let s=t.length;for(;s--;){const l=t[s],r=e[s];if(r){for(const a in l)a in r||(n[a]=1);for(const a in r)o[a]||(i[a]=r[a],o[a]=1);t[s]=r}else for(const a in l)o[a]=1}for(const l in n)l in i||(i[l]=void 0);return i}function ef(t){return typeof t=="object"&&t!==null?t:{}}function Ue(t,e,i){const n=t.$$.props[e];n!==void 0&&(t.$$.bound[n]=i,i(t.$$.ctx[n]))}function F(t){t&&t.c()}function z(t,e,i){const{fragment:n,after_update:o}=t.$$;n&&n.m(e,i),go(()=>{const s=t.$$.on_mount.map(_1).filter(kn);t.$$.on_destroy?t.$$.on_destroy.push(...s):tt(s),t.$$.on_mount=[]}),o.forEach(go)}function O(t,e){const i=t.$$;i.fragment!==null&&(xc(i.after_update),tt(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])}function tf(t,e){t.$$.dirty[0]===-1&&(co.push(t),y1(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function be(t,e,i,n,o,s,l,r=[-1]){const a=Eo;To(t);const c=t.$$={fragment:null,ctx:[],props:s,update:Z,not_equal:o,bound:ss(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(a?a.$$.context:[])),callbacks:ss(),dirty:r,skip_bound:!1,root:e.target||a.$$.root};l&&l(c.root);let f=!1;if(c.ctx=i?i(t,e.props||{},(m,h,..._)=>{const b=_.length?_[0]:h;return c.ctx&&o(c.ctx[m],c.ctx[m]=b)&&(!c.skip_bound&&c.bound[m]&&c.bound[m](b),f&&tf(t,m)),h}):[],c.update(),f=!0,tt(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const m=Qc(e.target);c.fragment&&c.fragment.l(m),m.forEach(S)}else c.fragment&&c.fragment.c();e.intro&&d(t.$$.fragment),z(t,e.target,e.anchor),C1()}To(a)}class _e{$$=void 0;$$set=void 0;$destroy(){O(this,1),this.$destroy=Z}$on(e,i){if(!kn(i))return Z;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(i),()=>{const o=n.indexOf(i);o!==-1&&n.splice(o,1)}}$set(e){this.$$set&&!Kc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const nf="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(nf);var bo;(function(t){t.VK="vk",t.VK_VIDEO="vk_video"})(bo||(bo={}));const of={isMobile:void 0,defaultLanguage:Io.RU,downloadVKLanguages:!0,updateBuiltinLanguages:!0,isSmoothVideoRotate:!0,showSupport:!0,supportLink:"https://vk.com/support?act=new&from=v",showLogo:void 0,logoLink:"https://vk.com/video",logoType:bo.VK_VIDEO,addTimeToLogoLink:!0,volumeDefault:1,volumeMinRestore:.05,loaderDelay:500,minSubtitlesFontSize:13,autoSubtitlesTimeout:2e3,allowChangingFullscreenTarget:!0,trafficSavingLimit:Qo.Q_480P,episodeMinWidthPc:8,hideThumbTimerAfterTouch:!0,sentry:{dsn:"https://e349fd23c68f405388980d0868d0ff27@sentry.mvk.com/126",sampleRate:.01,whiteErrorCategoryList:[],blackErrorCategoryList:[],whiteErrorIdList:[],blackErrorIdList:[]},features:{autoplay:!0,statistics:!0,sentry:!0,preload:!0,subtitles:!0,episodes:!0,fullscreen:!0,timelinePreview:!0,mediaSession:!0,annotations:!0,pip:!0,dpip:!0,download:!0,liveRewind:!0,playbackRate:!0,trafficSaving:!0,episodesClustering:!0,copyVideoLink:!0,videoRotate:!0,interactiveGraph:!1,seekToInteractive:!0,interactiveLastFrame:!1,interactiveTextPermanent:!0,interactiveHideTime:!0,interactivePlayPrevChapter:!0,thumbTimer:!0,hotKeyMapModal:!0,hotKeyHelpers:!0,saveDebugInfoToFile:!1,additionalButtons:!0,contextMenuButton:!0},controls:{hideTimeout:500,hideTimeoutMobile:3e3,hideTimeoutInitial:200,hideTimeoutFullscreen:3e3,hideTimeoutCursor:3e3,hideTimeoutTooltips:1e3,collapseMobileUnmute:6e3,hide360IconTimeout:3e3,hideHotKeyHelpers:2e3,playbackRateMin:.25,playbackRateMax:2,playbackRateStep:.25,volumeStepKeyboard:.05,volumeStepWheel:.05,volumeBarTimeout:300,seekStepKeyboard:1e4,seekStepMobile:15e3,seekStepFrame:400},ads:{enable:void 0,initTimeout:2e3,loadTimeout:2e3,slot:void 0,preview:void 0},interactive:{historyMaxLength:100,noInteractionEventTimeout:3e4}},lf=t=>Tc(t,of),sf=t=>Cl("ui-config",t),an=()=>Bl("ui-config"),Tl="vk_player_debug_panel_opened",P1=300,rf=100,af="videoplayer",uf="videoplayer";var Ee;(function(t){t.ArrowLeft="ArrowLeft",t.ArrowUp="ArrowUp",t.ArrowRight="ArrowRight",t.ArrowDown="ArrowDown",t.Comma="Comma",t.Period="Period",t.Space="Space",t.KeyM="KeyM",t.KeyF="KeyF",t.KeyK="KeyK",t.KeyL="KeyL",t.KeyJ="KeyJ",t.KeyC="KeyC",t.KeyI="KeyI",t.Digit1="Digit1",t.Digit2="Digit2",t.Digit3="Digit3",t.Digit4="Digit4",t.Digit5="Digit5",t.Digit6="Digit6",t.Digit7="Digit7",t.Digit8="Digit8",t.Digit9="Digit9",t.Digit0="Digit0",t.Numpad1="Numpad1",t.Numpad2="Numpad2",t.Numpad3="Numpad3",t.Numpad4="Numpad4",t.Numpad5="Numpad5",t.Numpad6="Numpad6",t.Numpad7="Numpad7",t.Numpad8="Numpad8",t.Numpad9="Numpad9",t.Numpad0="Numpad0",t.ShiftLeft="ShiftLeft",t.ShiftRight="ShiftRight",t.Slash="Slash",t.Tab="Tab",t.Escape="Escape",t.Enter="Enter"})(Ee||(Ee={}));const Mo={[Ee.KeyF]:"f",[Ee.KeyK]:"k",[Ee.KeyC]:"c",[Ee.KeyM]:"m"},cf=new Set([Ee.ArrowLeft,Ee.ArrowRight,Ee.KeyL,Ee.KeyJ]),ff=new Set([Ee.Tab,Ee.Space,Ee.ArrowLeft,Ee.ArrowRight,Ee.ArrowUp,Ee.ArrowDown]),df=new Set([Ee.ShiftRight,Ee.ShiftLeft]);var st;(function(t){t.PLAY_BUTTON="PLAY_BUTTON",t.REPLAY_BUTTON="REPLAY_BUTTON",t.NEXT_BUTTON="NEXT_BUTTON",t.PREV_BUTTON="PREV_BUTTON",t.PICTURE_IN_PICTURE="PICTURE_IN_PICTURE",t.FULLSCREEN_BUTTON="FULLSCREEN_BUTTON",t.SETTINGS_BUTTON="SETTINGS_BUTTON",t.LIVE_BUTTON="LIVE_BUTTON",t.GRAPH_BUTTON="GRAPH_BUTTON",t.PLAY_PREV_CHAPTER_BUTTON="PLAY_PREV_CHAPTER_BUTTON",t.SEEK_TO_INTERACTIVE_BUTTON="SEEK_TO_INTERACTIVE_BUTTON",t.TIMELINE="TIMELINE",t.VOLUME_BAR="VOLUME_BAR",t.MUTE_BUTTON="MUTE_BUTTON",t.SUBTITLES_BUTTON="SUBTITLES_BUTTON",t.CHROMECAST_BUTTON="CHROMECAST_BUTTON",t.VK_BUTTON="VK_BUTTON",t.EPISODE_BUTTON="EPISODE_BUTTON",t.INCREMENT_PLAYBACK_RATE="INCREMENT_PLAYBACK_RATE",t.DECREMENT_PLAYBACK_RATE="DECREMENT_PLAYBACK_RATE"})(st||(st={}));const as=40,S1=260,mf=60,qo=8,T1=[st.TIMELINE],Jo=[...T1,st.GRAPH_BUTTON],us=[...T1,st.PLAY_BUTTON],E1=[...Jo,st.PLAY_BUTTON];var fo;(function(t){t[t.XS=320]="XS",t[t.S=509]="S",t[t.M=599]="M",t[t.L=699]="L"})(fo||(fo={}));var vt;(function(t){t.XS="xs",t.S="s",t.M="m",t.L="l",t.XL="xl"})(vt||(vt={}));const _o={[vt.XS]:0,[vt.S]:1,[vt.M]:2,[vt.L]:3,[vt.XL]:4},ro=[];function Ln(t,e){return{subscribe:Ve(t,e).subscribe}}function Ve(t,e=Z){let i;const n=new Set;function o(r){if(ge(t,r)&&(t=r,i)){const a=!ro.length;for(const c of n)c[1](),ro.push(c,t);if(a){for(let c=0;c<ro.length;c+=2)ro[c][0](ro[c+1]);ro.length=0}}}function s(r){o(r(t))}function l(r,a=Z){const c=[r,a];return n.add(c),n.size===1&&(i=e(o,s)||Z),r(t),()=>{n.delete(c),n.size===0&&i&&(i(),i=null)}}return{set:o,update:s,subscribe:l}}function Ni(t,e,i){const n=!Array.isArray(t),o=n?[t]:t;if(!o.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const s=e.length<2;return Ln(i,(l,r)=>{let a=!1;const c=[];let f=0,m=Z;const h=()=>{if(f)return;m();const b=e(n?c[0]:c,l,r);s?l(b):m=kn(b)?b:Z},_=o.map((b,k)=>Kt(b,v=>{c[k]=v,f&=~(1<<k),a&&h()},()=>{f|=1<<k}));return a=!0,h(),function(){tt(_),m(),a=!1}})}const pf="prod",Rl="1.1.36-dev.cdb7114a.0",A1=(t,e,i)=>{const n=document.createElement("a");n.href=t,n.download=`${e}.${i}`,n.style.display="none",n.click()},I1=Symbol("storeContext"),L1=Symbol("microStoresContext"),hf=(t,e)=>{Cl(I1,t),Cl(L1,e)},dt=()=>{const t=Bl(I1);return ut(t,"Store context is empty!"),t},Bo=()=>{const t=Bl(L1);return ut(t,"MicroStores context is empty!"),t},ft=(t,e)=>V1(t,t.getValue(),e),V1=(t,e,i)=>Ln(e,n=>{const o=t.subscribe(s=>{n(s),i?.(s)});return()=>o.unsubscribe()}),gf=(t,e,i)=>{const n=t.info,{width:o,height:s}=xe(i.ui.playerSize),l=n.throughputEstimation$.getValue()?.toFixed(0)??0,r=n.rttEstimation$.getValue()?.toFixed(0)??0,a=n.isAutoQualityEnabled$.getValue()?"auto":"manual",c=`${Rl} (core: ${Pc}, stat: ${Zc}, shared: ${Ec})`,f=xe(i.state.errorLog$),m=f.length?`
7
7
  `+f.map((b,k)=>{const v=`${k}) Type: ${b.id}
8
8
  `,P=`Message: ${b.message} (${b.thrown})
9
9
  `,y=`Trace: ${b.thrown?.stack}
@@ -48,4 +48,4 @@ import{VERSION as Pc,ChromecastState as Vn,PlaybackState as Nt,VideoQuality as u
48
48
  rgba(0, 0, 0, 0.99) 93.33%,
49
49
  #000 100%
50
50
  );--timeline-preview-shadow:rgba(0, 0, 0, 0.08);--timeline-preview-bg:rgba(34, 34, 34, 1);--mobile-settings-bg:#2C2D2E;--button-hover-transition:opacity 0.2s;--video-container-z-index:0;--rotate-transition-duration:0.25s;position:relative;width:100%;height:100%;color:var(--white);font-size:12px;line-height:normal;overflow:hidden;outline:0;user-select:none;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;background:var(--black)}button{border:none;margin:0;padding:0;width:auto;overflow:visible;background:transparent;color:inherit;font:inherit;line-height:normal;-webkit-font-smoothing:inherit;-moz-osx-font-smoothing:inherit;-webkit-appearance:none;cursor:pointer}svg:not(.interactiveContainer svg){pointer-events:none}*:focus, *:focus-visible{outline:none}*:focus-visible{box-shadow:var(--focused-element-shadow)}.hidden{visibility:hidden;opacity:0}.overlay-container{pointer-events:none;top:0;left:0;height:100%;width:100%;position:fixed;z-index:10000}.out-of-view{position:absolute !important;left:-1000vh !important}`)}function Kh(t){let e,i,n;function o(l){t[56](l)}let s={store:t[0],uiConfig:t[35],title:t[1],thumbUrl:t[2],videoLogoUrl:t[3],interactiveContainer:t[4],live:t[5],autoplay:t[6],canRewindLive:t[7],showAds:t[8],adsSlotId:t[9],adsParams:t[10],adsPreviewParam:t[11],duration:t[12],logoClickable:t[13],logoHidden:t[14],showNextPrevButtons:t[16],nextButtonActive:t[17],prevButtonActive:t[18],endScreenVideoTitle:t[19],endScreenVideoThumb:t[20],isOneVideoPlaylist:t[21],supportLink:t[22],outerContainerRef:t[23],fullScreenTarget:t[24],showMiniTimer:t[25],playerStarted:t[34],playNextVideo:t[26],playPrevVideo:t[27],repeatPlaylist:t[28],seekToInteractive:t[29],toggleGraph:t[30],playPrevChapter:t[31],firstStart:t[36]};return t[33]!==void 0&&(s.videoContainer=t[33]),e=new Mh({props:s}),ke.push(()=>Ue(e,"videoContainer",o)),{c(){F(e.$$.fragment)},m(l,r){z(e,l,r),n=!0},p(l,r){const a={};r[0]&1&&(a.store=l[0]),r[0]&2&&(a.title=l[1]),r[0]&4&&(a.thumbUrl=l[2]),r[0]&8&&(a.videoLogoUrl=l[3]),r[0]&16&&(a.interactiveContainer=l[4]),r[0]&32&&(a.live=l[5]),r[0]&64&&(a.autoplay=l[6]),r[0]&128&&(a.canRewindLive=l[7]),r[0]&256&&(a.showAds=l[8]),r[0]&512&&(a.adsSlotId=l[9]),r[0]&1024&&(a.adsParams=l[10]),r[0]&2048&&(a.adsPreviewParam=l[11]),r[0]&4096&&(a.duration=l[12]),r[0]&8192&&(a.logoClickable=l[13]),r[0]&16384&&(a.logoHidden=l[14]),r[0]&65536&&(a.showNextPrevButtons=l[16]),r[0]&131072&&(a.nextButtonActive=l[17]),r[0]&262144&&(a.prevButtonActive=l[18]),r[0]&524288&&(a.endScreenVideoTitle=l[19]),r[0]&1048576&&(a.endScreenVideoThumb=l[20]),r[0]&2097152&&(a.isOneVideoPlaylist=l[21]),r[0]&4194304&&(a.supportLink=l[22]),r[0]&8388608&&(a.outerContainerRef=l[23]),r[0]&16777216&&(a.fullScreenTarget=l[24]),r[0]&33554432&&(a.showMiniTimer=l[25]),r[1]&8&&(a.playerStarted=l[34]),r[0]&67108864&&(a.playNextVideo=l[26]),r[0]&134217728&&(a.playPrevVideo=l[27]),r[0]&268435456&&(a.repeatPlaylist=l[28]),r[0]&536870912&&(a.seekToInteractive=l[29]),r[0]&1073741824&&(a.toggleGraph=l[30]),r[1]&1&&(a.playPrevChapter=l[31]),!i&&r[1]&4&&(i=!0,a.videoContainer=l[33],Fe(()=>i=!1)),e.$set(a)},i(l){n||(d(e.$$.fragment,l),n=!0)},o(l){g(e.$$.fragment,l),n=!1},d(l){O(e,l)}}}function jh(t){let e,i,n;function o(l){t[55](l)}let s={store:t[0],uiConfig:t[35],thumbUrl:t[2],videoLogoUrl:t[3],interactiveContainer:t[4],live:t[5],autoplay:t[6],canRewindLive:t[7],showAds:t[8],adsSlotId:t[9],adsParams:t[10],adsPreviewParam:t[11],duration:t[12],logoClickable:t[13],logoHidden:t[14],showNextPrevButtons:t[16],nextButtonActive:t[17],prevButtonActive:t[18],endScreenVideoTitle:t[19],endScreenVideoThumb:t[20],isOneVideoPlaylist:t[21],supportLink:t[22],outerContainerRef:t[23],fullScreenTarget:t[24],showMiniTimer:t[25],playerStarted:t[34],playNextVideo:t[26],playPrevVideo:t[27],repeatPlaylist:t[28],seekToInteractive:t[29],toggleGraph:t[30],playPrevChapter:t[31],firstStart:t[36],seekTime:t[32]};return t[33]!==void 0&&(s.videoContainer=t[33]),e=new Zh({props:s}),ke.push(()=>Ue(e,"videoContainer",o)),{c(){F(e.$$.fragment)},m(l,r){z(e,l,r),n=!0},p(l,r){const a={};r[0]&1&&(a.store=l[0]),r[0]&4&&(a.thumbUrl=l[2]),r[0]&8&&(a.videoLogoUrl=l[3]),r[0]&16&&(a.interactiveContainer=l[4]),r[0]&32&&(a.live=l[5]),r[0]&64&&(a.autoplay=l[6]),r[0]&128&&(a.canRewindLive=l[7]),r[0]&256&&(a.showAds=l[8]),r[0]&512&&(a.adsSlotId=l[9]),r[0]&1024&&(a.adsParams=l[10]),r[0]&2048&&(a.adsPreviewParam=l[11]),r[0]&4096&&(a.duration=l[12]),r[0]&8192&&(a.logoClickable=l[13]),r[0]&16384&&(a.logoHidden=l[14]),r[0]&65536&&(a.showNextPrevButtons=l[16]),r[0]&131072&&(a.nextButtonActive=l[17]),r[0]&262144&&(a.prevButtonActive=l[18]),r[0]&524288&&(a.endScreenVideoTitle=l[19]),r[0]&1048576&&(a.endScreenVideoThumb=l[20]),r[0]&2097152&&(a.isOneVideoPlaylist=l[21]),r[0]&4194304&&(a.supportLink=l[22]),r[0]&8388608&&(a.outerContainerRef=l[23]),r[0]&16777216&&(a.fullScreenTarget=l[24]),r[0]&33554432&&(a.showMiniTimer=l[25]),r[1]&8&&(a.playerStarted=l[34]),r[0]&67108864&&(a.playNextVideo=l[26]),r[0]&134217728&&(a.playPrevVideo=l[27]),r[0]&268435456&&(a.repeatPlaylist=l[28]),r[0]&536870912&&(a.seekToInteractive=l[29]),r[0]&1073741824&&(a.toggleGraph=l[30]),r[1]&1&&(a.playPrevChapter=l[31]),!i&&r[1]&4&&(i=!0,a.videoContainer=l[33],Fe(()=>i=!1)),e.$set(a)},i(l){n||(d(e.$$.fragment,l),n=!0)},o(l){g(e.$$.fragment,l),n=!1},d(l){O(e,l)}}}function Gh(t){let e,i,n,o;const s=[jh,Kh],l=[];function r(a,c){return a[15]?0:1}return i=r(t),n=l[i]=s[i](t),{c(){e=E("div"),n.c(),u(e,"class","root v-cghoty")},m(a,c){T(a,e,c),l[i].m(e,null),o=!0},p(a,c){let f=i;i=r(a),i===f?l[i].p(a,c):(fe(),g(l[f],1,1,()=>{l[f]=null}),de(),n=l[i],n?n.p(a,c):(n=l[i]=s[i](a),n.c()),d(n,1),n.m(e,null))},i(a){o||(d(n),o=!0)},o(a){g(n),o=!1},d(a){a&&S(e),l[i].d()}}}function Yh(t,e,i){let{sources:n}=e,{store:o}=e,{microStoresRoot:s}=e,{uiConfig:l}=e,{title:r}=e,{thumbUrl:a}=e,{videoLogoUrl:c}=e,{interactiveContainer:f}=e,{subtitles:m}=e,{live:h}=e,{preload:_}=e,{autoplay:b}=e,{volume:k=void 0}=e,{muted:v=void 0}=e,{fromTime:P}=e,{canRewindLive:y}=e,{showAds:C}=e,{adsSlotId:A=void 0}=e,{adsParams:ie=void 0}=e,{adsPreviewParam:M=void 0}=e,{duration:U=void 0}=e,{logoClickable:se}=e,{logoHidden:x}=e,{isMobile:w}=e,{showNextPrevButtons:$=!1}=e,{nextButtonActive:G=!1}=e,{prevButtonActive:ne=!1}=e,{endScreenVideoTitle:K=void 0}=e,{endScreenVideoThumb:V=void 0}=e,{isOneVideoPlaylist:Y=!1}=e,{supportLink:I}=e,{outerContainerRef:oe=void 0}=e,{fullScreenTarget:Te=void 0}=e,{failoverHosts:Re=void 0}=e,{showMiniTimer:Me=!1}=e,{playNextVideo:Ne=je}=e,{playPrevVideo:ce=je}=e,{repeatPlaylist:ve=je}=e,{seekToInteractive:Q=je}=e,{toggleGraph:ee=je}=e,{playPrevChapter:we=je}=e;const{subscribers:re,stores:Oe}=s;sf(l);const Le=an(),Ae=o.ui.debugPanelVisible,ue=o.ui.playerSize;let Ce,he=null,le=!1;o.getAdmanWrapper().init({switchFromAdsToVideo:o.actions.internal.switchFromAdsToVideo,switchFromVideoToAds:o.actions.internal.switchFromVideoToAds,setMuted:o.actions.external.setMuted},o.ads,{isMobile:o.ui.isMobile,mobileUnmuteButtonVisible:o.ui.mobileUnmuteButtonVisible,vsid:o.vsid}),hf(o,Oe);const Be=(te=!1)=>{i(34,le=!0),te?o.actions.external.firstStart(C):o.actions.internal.firstStart(C)};function me(te){const pt=n||te;pt&&o.initVideo({container:Ce,sources:pt,failoverHosts:Re,subtitles:m});const lt=wn.get(Tl)==="true";Ae.set(lt),P>0&&o.actions.external.seekTime(P);const Yt=w?Le.volumeDefault:k??D1()??Le.volumeDefault,rt=v??wf();if(o.actions.external.setVolume(Yt),o.actions.external.setMuted(rt),o.getAdmanWrapper().setInitialVolume(rt?0:Yt),Le.features.trafficSaving){const Ti=Cf();Ti&&o.actions.internal.setTrafficSavingEnabled(Ti)}const kt=kf(o.videoId);kt&&o.actions.internal.setQuality(kt),o.ui.isAutoplay.set(b),b?Be():_&&Le.features.preload&&o.actions.internal.preload()}const Pe=te=>{if(window.ResizeObserver){let pt,lt;he=new ResizeObserver(tl(Yt=>{const rt=Yt[0];if(rt){if(rt.contentBoxSize){const kt=Array.isArray(rt.contentBoxSize)?rt.contentBoxSize[0]:rt.contentBoxSize;pt=kt.inlineSize,lt=kt.blockSize}else rt.contentRect&&(pt=rt.contentRect.width,lt=rt.contentRect.height);ue.set({width:pt,height:lt})}},P1)),he.observe(te)}ue.set({width:te.clientWidth,height:te.clientHeight})};rn(()=>{Pe(Ce);const te=re.map(lt=>lt.init(o,Oe));if(h?.status==="upcoming"||h?.status==="waiting"){o.actions.internal.setWaitingLive(!0);return}if((h?.status==="finished"||h?.status==="postlive")&&!Object.keys(n||[]).length){o.actions.internal.setWaitingRecord(!0);return}return me(),()=>{he?.disconnect(),te.forEach(lt=>lt.unsubscribe()),o.destroy()}});function ye(){le?o.actions.external.play():Be(!0)}function Ke(){o.actions.external.pause()}function it(te){w||o.actions.external.setMuted(te)}function Xe(te){w||te>=0&&te<=1&&o.actions.external.setVolume(te)}function Ye(te){o.actions.internal.seekTime(te,It.UNKNOWN)}function et(te){o.actions.external.seekEpisodeStartTime(te)}function St(){o.actions.external.returnFocusToEpisodes()}function mt(te){o.actions.external.setPlaybackRate(te)}function Si(te){o.actions.external.setAutoQualityLimits(te)}function gt(te){Ce=te,i(33,Ce)}function Vt(te){Ce=te,i(33,Ce)}return t.$$set=te=>{"sources"in te&&i(37,n=te.sources),"store"in te&&i(0,o=te.store),"microStoresRoot"in te&&i(38,s=te.microStoresRoot),"uiConfig"in te&&i(39,l=te.uiConfig),"title"in te&&i(1,r=te.title),"thumbUrl"in te&&i(2,a=te.thumbUrl),"videoLogoUrl"in te&&i(3,c=te.videoLogoUrl),"interactiveContainer"in te&&i(4,f=te.interactiveContainer),"subtitles"in te&&i(40,m=te.subtitles),"live"in te&&i(5,h=te.live),"preload"in te&&i(41,_=te.preload),"autoplay"in te&&i(6,b=te.autoplay),"volume"in te&&i(42,k=te.volume),"muted"in te&&i(43,v=te.muted),"fromTime"in te&&i(44,P=te.fromTime),"canRewindLive"in te&&i(7,y=te.canRewindLive),"showAds"in te&&i(8,C=te.showAds),"adsSlotId"in te&&i(9,A=te.adsSlotId),"adsParams"in te&&i(10,ie=te.adsParams),"adsPreviewParam"in te&&i(11,M=te.adsPreviewParam),"duration"in te&&i(12,U=te.duration),"logoClickable"in te&&i(13,se=te.logoClickable),"logoHidden"in te&&i(14,x=te.logoHidden),"isMobile"in te&&i(15,w=te.isMobile),"showNextPrevButtons"in te&&i(16,$=te.showNextPrevButtons),"nextButtonActive"in te&&i(17,G=te.nextButtonActive),"prevButtonActive"in te&&i(18,ne=te.prevButtonActive),"endScreenVideoTitle"in te&&i(19,K=te.endScreenVideoTitle),"endScreenVideoThumb"in te&&i(20,V=te.endScreenVideoThumb),"isOneVideoPlaylist"in te&&i(21,Y=te.isOneVideoPlaylist),"supportLink"in te&&i(22,I=te.supportLink),"outerContainerRef"in te&&i(23,oe=te.outerContainerRef),"fullScreenTarget"in te&&i(24,Te=te.fullScreenTarget),"failoverHosts"in te&&i(45,Re=te.failoverHosts),"showMiniTimer"in te&&i(25,Me=te.showMiniTimer),"playNextVideo"in te&&i(26,Ne=te.playNextVideo),"playPrevVideo"in te&&i(27,ce=te.playPrevVideo),"repeatPlaylist"in te&&i(28,ve=te.repeatPlaylist),"seekToInteractive"in te&&i(29,Q=te.seekToInteractive),"toggleGraph"in te&&i(30,ee=te.toggleGraph),"playPrevChapter"in te&&i(31,we=te.playPrevChapter)},t.$$.update=()=>{t.$$.dirty[0]&32769&&o.ui.isMobile.set(w)},[o,r,a,c,f,h,b,y,C,A,ie,M,U,se,x,w,$,G,ne,K,V,Y,I,oe,Te,Me,Ne,ce,ve,Q,ee,we,Ye,Ce,le,Le,Be,n,s,l,m,_,k,v,P,Re,me,ye,Ke,it,Xe,et,St,mt,Si,gt,Vt]}class Qh extends _e{constructor(e){super(),be(this,e,Yh,Gh,ge,{sources:37,store:0,microStoresRoot:38,uiConfig:39,title:1,thumbUrl:2,videoLogoUrl:3,interactiveContainer:4,subtitles:40,live:5,preload:41,autoplay:6,volume:42,muted:43,fromTime:44,canRewindLive:7,showAds:8,adsSlotId:9,adsParams:10,adsPreviewParam:11,duration:12,logoClickable:13,logoHidden:14,isMobile:15,showNextPrevButtons:16,nextButtonActive:17,prevButtonActive:18,endScreenVideoTitle:19,endScreenVideoThumb:20,isOneVideoPlaylist:21,supportLink:22,outerContainerRef:23,fullScreenTarget:24,failoverHosts:45,showMiniTimer:25,playNextVideo:26,playPrevVideo:27,repeatPlaylist:28,seekToInteractive:29,toggleGraph:30,playPrevChapter:31,initVideo:46,play:47,pause:48,setMuted:49,setVolume:50,seekTime:32,seekEpisodeStartTime:51,returnFocusToEpisodes:52,setPlaybackRate:53,setAutoQualityLimits:54},Wh,[-1,-1,-1])}get initVideo(){return this.$$.ctx[46]}get play(){return this.$$.ctx[47]}get pause(){return this.$$.ctx[48]}get setMuted(){return this.$$.ctx[49]}get setVolume(){return this.$$.ctx[50]}get seekTime(){return this.$$.ctx[32]}get seekEpisodeStartTime(){return this.$$.ctx[51]}get returnFocusToEpisodes(){return this.$$.ctx[52]}get setPlaybackRate(){return this.$$.ctx[53]}get setAutoQualityLimits(){return this.$$.ctx[54]}}function Xh(t){let e,i;return{c(){e=R("svg"),i=R("path"),u(i,"fill",t[0]),u(i,"d","M38.245 6c3.566 0 4.859.371 6.162 1.069a7.27 7.27 0 0 1 3.025 3.024c.697 1.303 1.068 2.597 1.068 6.163v23.489c0 3.566-.371 4.859-1.069 6.162a7.27 7.27 0 0 1-3.024 3.025C43.104 49.629 41.811 50 38.245 50h-19.49c-3.565 0-4.859-.371-6.162-1.069a7.27 7.27 0 0 1-3.024-3.024C8.87 44.604 8.5 43.311 8.5 39.745v-23.49c0-3.565.371-4.859 1.069-6.162a7.27 7.27 0 0 1 3.024-3.024C13.896 6.37 15.19 6 18.756 6h19.489zm.314 3H18.756c-2.799 0-3.761.186-4.749.714a4.27 4.27 0 0 0-1.793 1.793c-.508.95-.7 1.876-.713 4.434L11.5 39.744c0 2.799.186 3.761.714 4.749a4.27 4.27 0 0 0 1.793 1.793c.988.528 1.95.714 4.749.714h19.489c2.798 0 3.76-.186 4.748-.714a4.27 4.27 0 0 0 1.793-1.793c.528-.988.714-1.95.714-4.748v-23.49c0-2.798-.186-3.76-.714-4.748a4.27 4.27 0 0 0-1.793-1.793c-.95-.508-1.876-.7-4.434-.713zM19.22 38c.445 0 .607.046.77.134a.91.91 0 0 1 .377.378c.088.163.134.324.134.77v1.436c0 .446-.046.607-.134.77a.908.908 0 0 1-.378.378c-.162.088-.324.134-.77.134h-1.436c-.446 0-.608-.046-.77-.134a.908.908 0 0 1-.378-.378c-.088-.163-.134-.324-.134-.77v-1.436c0-.446.046-.607.134-.77a.908.908 0 0 1 .378-.378c.162-.088.324-.134.77-.134h1.436zm20 0c.445 0 .606.046.77.134a.91.91 0 0 1 .377.378c.088.163.134.324.134.77v1.436c0 .446-.046.607-.134.77a.908.908 0 0 1-.378.378c-.163.088-.324.134-.77.134h-1.436c-.446 0-.607-.046-.77-.134a.908.908 0 0 1-.378-.378c-.088-.163-.134-.324-.134-.77v-1.436c0-.446.046-.607.134-.77a.908.908 0 0 1 .378-.378c.163-.088.324-.134.77-.134h1.436zm-20-8c.445 0 .607.046.77.134a.91.91 0 0 1 .377.378c.088.162.134.324.134.77v1.436c0 .446-.046.607-.134.77a.908.908 0 0 1-.378.378c-.162.088-.324.134-.77.134h-1.436c-.446 0-.608-.046-.77-.134a.908.908 0 0 1-.378-.378c-.088-.163-.134-.324-.134-.77v-1.436c0-.446.046-.608.134-.77a.908.908 0 0 1 .378-.378c.162-.088.324-.134.77-.134h1.436zm20 0c.445 0 .606.046.77.134a.91.91 0 0 1 .377.378c.088.162.134.324.134.77v1.436c0 .446-.046.607-.134.77a.908.908 0 0 1-.378.378c-.163.088-.324.134-.77.134h-1.436c-.446 0-.607-.046-.77-.134a.908.908 0 0 1-.378-.378c-.088-.163-.134-.324-.134-.77v-1.436c0-.446.046-.608.134-.77a.908.908 0 0 1 .378-.378c.163-.088.324-.134.77-.134h1.436zm-20-8c.445 0 .607.046.77.134a.91.91 0 0 1 .377.378c.088.162.134.324.134.77v1.436c0 .446-.046.608-.134.77a.908.908 0 0 1-.378.378c-.162.088-.324.134-.77.134h-1.436c-.446 0-.608-.046-.77-.134a.908.908 0 0 1-.378-.378c-.088-.162-.134-.324-.134-.77v-1.436c0-.446.046-.608.134-.77a.908.908 0 0 1 .378-.378c.162-.088.324-.134.77-.134h1.436zm20 0c.445 0 .606.046.77.134a.91.91 0 0 1 .377.378c.088.162.134.324.134.77v1.436c0 .446-.046.608-.134.77a.908.908 0 0 1-.378.378c-.163.088-.324.134-.77.134h-1.436c-.446 0-.607-.046-.77-.134a.908.908 0 0 1-.378-.378c-.088-.162-.134-.324-.134-.77v-1.436c0-.446.046-.608.134-.77a.908.908 0 0 1 .378-.378c.163-.088.324-.134.77-.134h1.436zm-20-8c.445 0 .607.046.77.134a.91.91 0 0 1 .377.378c.088.162.134.324.134.77v1.436c0 .446-.046.608-.134.77a.908.908 0 0 1-.378.378c-.162.088-.324.134-.77.134h-1.436c-.446 0-.608-.046-.77-.134a.908.908 0 0 1-.378-.378c-.088-.162-.134-.324-.134-.77v-1.436c0-.446.046-.607.134-.77a.908.908 0 0 1 .378-.378c.162-.088.324-.134.77-.134h1.436zm20 0c.445 0 .606.046.77.134a.91.91 0 0 1 .377.378c.088.162.134.324.134.77v1.436c0 .446-.046.608-.134.77a.908.908 0 0 1-.378.378c-.163.088-.324.134-.77.134h-1.436c-.446 0-.607-.046-.77-.134a.908.908 0 0 1-.378-.378c-.088-.162-.134-.324-.134-.77v-1.436c0-.446.046-.607.134-.77a.908.908 0 0 1 .378-.378c.163-.088.324-.134.77-.134h1.436z"),u(e,"width","57"),u(e,"height","60"),u(e,"fill","none"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"aria-hidden","true"),u(e,"data-testid","stub-icon")},m(n,o){T(n,e,o),p(e,i)},p(n,[o]){o&1&&u(i,"fill",n[0])},i:Z,o:Z,d(n){n&&S(e)}}}function Jh(t,e,i){let{isWhite:n=!1}=e,o;return t.$$set=s=>{"isWhite"in s&&i(1,n=s.isWhite)},t.$$.update=()=>{t.$$.dirty&2&&i(0,o=n?"#fff":"#909499")},[o,n]}class xh extends _e{constructor(e){super(),be(this,e,Jh,Xh,ge,{isWhite:1})}}function $h(t){Ze(t,"v-1y9fytq",".playerStub.v-1y9fytq{width:100%;height:100%;background-color:#222;display:flex;justify-content:center;align-items:center;position:relative;background-position:center;background-size:cover;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif}.title.v-1y9fytq{position:absolute;left:0;top:0;width:100%;font-size:15px;color:#fff;box-sizing:border-box;padding:18px 20px 10px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}")}function d1(t){let e,i;return{c(){e=E("div"),i=ze(t[0]),u(e,"class","title v-1y9fytq")},m(n,o){T(n,e,o),p(e,i)},p(n,o){o&1&&Je(i,n[0])},d(n){n&&S(e)}}}function m1(t){let e,i;return e=new xh({props:{isWhite:!!t[1]}}),{c(){F(e.$$.fragment)},m(n,o){z(e,n,o),i=!0},p(n,o){const s={};o&2&&(s.isWhite=!!n[1]),e.$set(s)},i(n){i||(d(e.$$.fragment,n),i=!0)},o(n){g(e.$$.fragment,n),i=!1},d(n){O(e,n)}}}function e5(t){let e,i,n,o,s=t[0]&&d1(t),l=(!t[0]||!t[1])&&m1(t);return{c(){e=E("div"),s&&s.c(),i=N(),l&&l.c(),u(e,"class","playerStub v-1y9fytq"),u(e,"style",n=t[1]?`background-image: url('${t[1]}')`:"")},m(r,a){T(r,e,a),s&&s.m(e,null),p(e,i),l&&l.m(e,null),o=!0},p(r,[a]){r[0]?s?s.p(r,a):(s=d1(r),s.c(),s.m(e,i)):s&&(s.d(1),s=null),!r[0]||!r[1]?l?(l.p(r,a),a&3&&d(l,1)):(l=m1(r),l.c(),d(l,1),l.m(e,null)):l&&(fe(),g(l,1,1,()=>{l=null}),de()),(!o||a&2&&n!==(n=r[1]?`background-image: url('${r[1]}')`:""))&&u(e,"style",n)},i(r){o||(d(l),o=!0)},o(r){g(l),o=!1},d(r){r&&S(e),s&&s.d(),l&&l.d()}}}function t5(t,e,i){let{title:n}=e,{thumbUrl:o}=e;return t.$$set=s=>{"title"in s&&i(0,n=s.title),"thumbUrl"in s&&i(1,o=s.thumbUrl)},[n,o]}class i5 extends _e{constructor(e){super(),be(this,e,t5,e5,ge,{title:0,thumbUrl:1},$h)}}class n5{isSupported(){return"mediaSession"in navigator}setMetaData({title:e,artist:i="",thumbUrl:n=""}){this.isSupported()&&(navigator.mediaSession.metadata=new MediaMetadata({title:e,artist:i,artwork:[{src:n,sizes:"96x96",type:"image/png"},{src:n,sizes:"128x128",type:"image/png"},{src:n,sizes:"192x192",type:"image/png"},{src:n,sizes:"256x256",type:"image/png"},{src:n,sizes:"384x384",type:"image/png"},{src:n,sizes:"512x512",type:"image/png"}]}))}updateActionHandlers(e){this.resetActionHandlers(),this.setActionHandlers(e)}resetActionHandlers(){const e=[["play",null],["pause",null],["stop",null],["nexttrack",null],["previoustrack",null],["seekto",i=>null],["seekbackward",i=>null],["seekforward",i=>null]];this.setActionHandlers(e)}setActionHandlers(e){if(this.isSupported())for(const[i,n]of e)try{navigator.mediaSession.setActionHandler(i,n)}catch{throw new Error(`The media session action "${i}" is not supported yet.`)}}}function o5(t){let e,i,n,o;return{c(){e=R("svg"),i=R("g"),n=R("path"),o=R("path"),u(n,"d","m30.744 4 .744.005c2.981.046 4.526.385 6.127 1.24a8.766 8.766 0 0 1 3.475 3.347l.174.312.15.292c.772 1.553 1.066 3.18 1.085 6.251v9.045a1.5 1.5 0 0 1-3 .016l-.008-9.651c-.04-2.032-.228-3.12-.627-4.035l-.126-.27-.13-.252A5.77 5.77 0 0 0 36.2 7.891c-1.187-.635-2.339-.873-5.115-.89L22.255 7c-2.737 0-4.003.2-5.071.698l-.133.064-.251.13a5.77 5.77 0 0 0-2.409 2.408c-.635 1.187-.873 2.339-.89 5.114l-.001 20.83c0 2.738.2 4.004.698 5.072l.064.133.13.251a5.769 5.769 0 0 0 2.408 2.409c1.1.588 2.134.825 4.438.88l.323.006 3.695.005H26a1.5 1.5 0 0 1 0 3h-.756l-3.718-.005c-2.989-.047-4.526-.377-6.14-1.24a8.766 8.766 0 0 1-3.476-3.347l-.174-.312-.15-.292c-.731-1.472-1.036-3.016-1.08-5.803l-.006-.756v-20.49l.005-.743c.046-2.981.385-4.526 1.24-6.127a8.765 8.765 0 0 1 3.347-3.475l.312-.174.292-.15c1.472-.731 3.016-1.036 5.803-1.08L22.256 4h8.488Z"),u(o,"d","M30.5 33.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C32.78 29 33.62 29 35.3 29h6.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311c.327.642.327 1.482.327 3.162v13.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C44.22 52 43.38 52 41.7 52h-6.4c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C30.5 49.72 30.5 48.88 30.5 47.2V33.8Z"),u(i,"fill","#fff"),u(e,"width","57"),u(e,"height","56"),u(e,"fill","none"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"aria-label","dummy-image"),u(e,"data-testid","pip-dummy-icon")},m(s,l){T(s,e,l),p(e,i),p(i,n),p(i,o)},p:Z,i:Z,o:Z,d(s){s&&S(e)}}}class l5 extends _e{constructor(e){super(),be(this,e,null,o5,ge,{})}}function s5(t){Ze(t,"v-1pbsod4",".player-pip-dummy.v-1pbsod4{width:100%;height:100%;background-color:#19191A;display:flex;flex-direction:column;justify-content:center;align-items:center;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif}.player-pip-dummy.is-pip-api.v-1pbsod4{position:relative}.dummy-image.v-1pbsod4 svg{transform:scale(1.07143)}.dummy-image.desktop.v-1pbsod4{transform:scale(1.07143) rotate(-90deg) rotateY(180deg)}.title.v-1pbsod4{font-size:16px;color:#fff;padding:18px 20px 10px;text-align:center}")}function r5(t){let e,i,n,o,s,l,r;return n=new l5({}),{c(){e=E("div"),i=E("div"),F(n.$$.fragment),o=N(),s=E("span"),l=ze(t[0]),u(i,"class","dummy-image v-1pbsod4"),B(i,"desktop",!t[1]),u(s,"class","title v-1pbsod4"),u(e,"class","player-pip-dummy v-1pbsod4"),B(e,"is-pip-api",t[2])},m(a,c){T(a,e,c),p(e,i),z(n,i,null),p(e,o),p(e,s),p(s,l),r=!0},p(a,[c]){(!r||c&2)&&B(i,"desktop",!a[1]),(!r||c&1)&&Je(l,a[0])},i(a){r||(d(n.$$.fragment,a),r=!0)},o(a){g(n.$$.fragment,a),r=!1},d(a){a&&S(e),O(n)}}}function a5(t,e,i){let n,o;const s=dt(),l=!!s.webApi.pictureInPictureApi,r=s.interfaceLanguage$;D(t,r,f=>i(5,n=f));const a=s.ui.isMobile;D(t,a,f=>i(1,o=f));let c;return t.$$.update=()=>{t.$$.dirty&32&&i(0,c=n&&W("pip_dummy_title"))},[c,o,l,r,a,n]}class u5 extends _e{constructor(e){super(),be(this,e,a5,r5,ge,{},s5)}}const c5=460,f5=280;class Qu{playerDomElement;playerParentShadowRoot;playerDummyElement;svelteContext;pipWindow;info={isActive$:new Il(!1),type:zn.DocumentPictureInPicture};isSupported(){const e=Ll().browser===h1.Yandex,{isEmbed:i}=Hc();return"documentPictureInPicture"in window&&!e&&!i}isActive(){return this.isSupported()&&!!documentPictureInPicture.window}setPlayerDomElement(e,i){this.playerDomElement=e,this.playerParentShadowRoot=i}setContext(e){this.svelteContext=e}async request(){if(!this.isSupported()||!this.playerDomElement||!this.playerParentShadowRoot)return;this.pipWindow=await documentPictureInPicture.requestWindow({width:c5,height:f5,copyStyleSheets:!0}),this.pipWindow.document.body.style.margin="0";const e=[...this.playerParentShadowRoot.styleSheets].map(s=>[...s.cssRules].map(l=>l.cssText).join(" ")).filter(Boolean).join(`
51
- `),i=document.createElement("style");i.textContent=e;const n=this.createStretchedContainer(),o=n.attachShadow({mode:"open"});o.append(i),o.append(this.playerDomElement),this.playerDummyElement=new u5({target:this.playerParentShadowRoot,context:this.svelteContext}),this.pipWindow?.document.body.append(n),this.info.isActive$.next(!0),this.pipWindow?.addEventListener("unload",s=>{!this.playerDomElement||!this.playerParentShadowRoot||!this.playerDummyElement||(this.playerDummyElement.$destroy(),this.playerParentShadowRoot.append(this.playerDomElement),this.info.isActive$.next(!1))})}async remove(){return new Promise(e=>{documentPictureInPicture.window?.close(),e()})}async dispose(){await this.remove()}createStretchedContainer(){const e=document.createElement("div");return e.style.width="100%",e.style.height="100%",e}}function d5(t){return t instanceof Qu}class m5{static getLatestSupportedVersion(){const e=new zl,i=new Qu;if(i.isSupported())return i;if(e.isSupported())return e}}function p1(t,e){const i=new Set([...Object.keys(t),...Object.keys(e)]),n={};for(const o of i)n[o]=e[o]??t[o]??void 0;return n}const p5="Inner error. Unexpectedly root annotation container null reference exception",h5="Annotation with such name already exists",g5="Annotation with such name does not exist";class yl extends Error{constructor(e){super(e),this.name="AnnotationError"}}const b5="1",_5=100;class v5{rootAnnotationsContainer;annotations=new Map;subscriptions=new Jn;mutationObserver;playerSize;constructor(e){this.rootAnnotationsContainer=e;const i=tl(()=>{for(const n of this.annotations.values())this.isElementExceedsBoundaries(n,this.playerSize.width,this.playerSize.height)?n.style.visibility="hidden":n.style.visibility="visible"},_5);this.subscriptions.add(Fc(this.rootAnnotationsContainer).subscribe(({width:n,height:o})=>{this.playerSize={width:n,height:o},i()})),this.mutationObserver=new MutationObserver(i),this.mutationObserver.observe(this.rootAnnotationsContainer,{attributes:!0,childList:!0,subtree:!0,characterData:!0})}add(e,i){if(!this.rootAnnotationsContainer)throw new yl(p5);if(this.annotations.has(e))throw new yl(h5);i.style.zIndex=i.style.zIndex??b5,i.style.position="absolute",this.rootAnnotationsContainer.append(i),this.annotations.set(e,i)}get(e){const i=this.annotations.get(e);if(!i)throw new yl(g5);return i}remove(e){const i=this.get(e);this.annotations.delete(e)&&i.remove()}clear(){for(const e in this.annotations.keys())this.remove(e)}destroy(){this.annotations.clear(),this.subscriptions.unsubscribe(),this.mutationObserver.disconnect(),this.rootAnnotationsContainer=null}isElementExceedsBoundaries(e,i,n){const o=e.offsetTop,s=e.offsetLeft,l=e.offsetWidth,r=e.offsetHeight;return o<0||s<0||s+l>i||o+r>n}registryRootContainer(e){}addLayer(e){return new HTMLElement}getLayer(e){}removeLayer(e){}clearLayer(e){}detach(){}reattach(){}}class Yl{stateName;state$;subscription;init(e,i){return ut(e),ut(i),this.subscription=new Jn,this.subscription}}class k5 extends Yl{stateName="fakeIsPlaying$";state$={...Ve(null),toggle:()=>this.state$.update(e=>!e)};init(e,i){const n=super.init(e,i),{isInteractiveExpectation$:o}=e.state;return n.add(o.subscribe(s=>{this.state$.set(s?!0:null)})),n}}class w5 extends Yl{stateName="interactiveControlsOpacity$";state$={...Ve(null),toggle:()=>this.state$.update(e=>!e)};init(e,i){const n=super.init(e,i),{fakeIsPlaying$:o}=i,{isInteractiveExpectation$:s,isPlaying$:l}=e.state,{controlsVisible:r,isMobile:a}=e.ui,c=xe(a),f=()=>c&&xe(r);return n.add(r.subscribe(m=>{if(!c)return;const h=xe(o);xe(l)?this.state$.set(m):h!==null&&this.state$.set(!h||m)})),n.add(l.subscribe(m=>{this.state$.set(!m||f())})),n.add(o.subscribe(m=>{if(m===null)return;const h=xe(s);if(f()){this.state$.set(!0);return}h&&this.state$.set(!m)})),n}}class y5 extends Yl{stateName="seekToInteractiveDisabledTooltip$";state$=Ve("tooltip_chapter_without_interactive");init(e,i){const n=super.init(e,i);return n.add(e.state.interactiveEpisodes$.subscribe(o=>{o.length&&(o.every(s=>s.completed)?this.state$.set("tooltip_interactive_of_chapter_completed"):this.state$.set("tooltip_disabled_when_interactive"))})),n}}const C5=()=>[k5,w5,y5].reduce(({subscribers:t,stores:e},i)=>{const n=new i;return{subscribers:[...t,n],stores:{...e,[n.stateName]:n.state$}}},{subscribers:[],stores:{}}),P5={preload:!0,autoplay:!1,repeat:!1,fromTime:0,canRewindLive:!0,showAds:!1,interfaceLanguage:Io.RU,logoClickable:!1,logoHidden:!1,isMobile:Uc(),isMediaSessionEnabled:!0,isPictureInPictureEnabled:!0,isAudioDisabled:!1,callbacks:{uiInfo:{}},tuningConfig:{configName:[]}};class S5 extends HTMLElement{svelteStubComponent;svelteRootComponent;store;microStoresRoot;statistics;sentry;_shadowRoot;playerContainer;rootContainer;uiConfig;coreConfig;statisticsConfig;interactiveController;interactiveContainer;graphMadePause;currentPlayingVideoIndex=0;needToRepeatPlaylist=!1;videoConfig=void 0;pictureInPictureApi=void 0;mediaSessionApi=void 0;unsubscribePlayerPhaseSubscription=void 0;logger;log;subscription;annotationsApi=void 0;createPlayerTimeout;prevIsid=void 0;isInited=!1;constructor(){super(),this.logger=new g1,this.log=this.logger.createComponentLog("VKVideoPlayer"),this.subscription=new Jn,this.graphMadePause=!1,window?.videoPlayerConfig?.debugLogs&&this.subscription.add(this.logger.log$.subscribe(e=>{console.log("%c player web component ","background:#77dd77;",`${e.component}`,e.message)}))}connectedCallback(){if(this.isInited)return;this.initPlayerRootContainers();const e=this.getAttribute("stub-title")??void 0,i=this.getAttribute("stub-thumb-url")??void 0;this.svelteStubComponent=new i5({target:this.playerContainer,props:{title:e,thumbUrl:i}})}disconnectedCallback(){this.annotationsApi?.destroy(),this.svelteRootComponent?.$destroy(),this.svelteStubComponent?.$destroy(),this.subscription.unsubscribe(),this.unsubscribePlayerPhaseSubscription?.(),this.interactiveController?.destroy()}initPlayerRootContainers(){this.rootContainer=document.createElement("div"),this.rootContainer.style.position="relative",this.rootContainer.className="root-container",this.rootContainer.style.width="100%",this.rootContainer.style.height="100%";const e=document.createElement("div");e.style.position="absolute",e.className="shadow-root-container",e.style.width="100%",e.style.height="100%",this._shadowRoot=e.attachShadow({mode:"open"}),this.playerContainer=document.createElement("div"),this.playerContainer.style.all="initial",this.playerContainer.style.display="block",this.playerContainer.style.contain="strict",this.playerContainer.style.width="100%",this.playerContainer.style.height="100%",this._shadowRoot.append(this.playerContainer),this.rootContainer.append(e),this.append(this.rootContainer)}needToShowNextPrevButtons(){return this.videoConfig?this.videoConfig.videos.length>1:!1}isNextButtonActive(){return this.videoConfig?this.needToShowNextPrevButtons()&&(this.currentPlayingVideoIndex<this.videoConfig.videos.length-1||this.needToRepeatPlaylist):!1}isPrevButtonActive(){return this.videoConfig?this.needToShowNextPrevButtons()&&(this.currentPlayingVideoIndex>0||this.needToRepeatPlaylist):!1}isControlDisabled(e){return this.store?.ui.controls.disabledControls$?.includes(e)||!1}getNextVideoInfo(){if(!this.videoConfig)return{nextVideoTitle:void 0,nextVideoThumb:void 0};const e=this.videoConfig.videos[this.currentPlayingVideoIndex+1]||{};return{nextVideoTitle:e.title,nextVideoThumb:e.thumbUrl}}createPlayer(e,i={},n){if(!this.videoConfig)return;const{albumId:o,statPlace:s,statUserSalt:l,statAuthToken:r,statTrackCode:a,refreshStatAuthToken:c,preload:f,autoplay:m,volume:h,muted:_,fromTime:b,canRewindLive:k,supportLink:v,showAds:P,adsSlotId:y,adsParams:C={},adsPreviewParam:A,interfaceLanguage:ie,logoClickable:M,logoHidden:U,isMobile:se,isAudioDisabled:x,isLiveCatchUpMode:w,fullScreenTarget:$,failoverHosts:G,canDownload:ne,callbacks:K,interactiveData:V,showThumbTimer:Y,additionalButtons:I=[],repeat:oe}=p1(this.videoConfig,i),{sources:Te,title:Re,thumbUrl:Me,videoLogoUrl:Ne,unitedVideoId:ce,isClip:ve=!1,duration:Q,adsParams:ee={},videoEpisodes:we,previewThumbsData:re,subtitles:Oe,live:Le}=e,Ae={...C,...ee},ue=this.getNextVideoInfo(),Ce={sources:Te,title:Re,thumbUrl:Me,subtitles:Oe,unitedVideoId:ce,isClip:ve,live:Le,albumId:o,statPlace:s,autoplay:m,muted:_,volume:h,fromTime:b,canRewindLive:k,showAds:P,adsSlotId:y,adsParams:Ae,adsPreviewParam:A,duration:Q,logoClickable:M,logoHidden:U,isMobile:se,repeat:oe,showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive(),endScreenVideoTitle:ue.nextVideoTitle,endScreenVideoThumb:ue.nextVideoThumb,isOneVideoPlaylist:this.isOneVideoPlaylist()},he={pictureInPictureApi:this.pictureInPictureApi,annotationsApi:this.annotationsApi};this.log({message:`create player, props: ${JSON.stringify(Ce)}`});const le=this.uiConfig.features.statistics&&!!ce,{pid:Be}=this.videoConfig?.interactiveData?.projectInfo||{};le&&(this.statistics=new u3({movieId:ce,albumId:o,place:s,trackCode:a,autoplay:(m&&!this.interactiveController)??!1,mobile:se,clip:ve,...Be&&!this.isInited&&{projectId:Number(Be)}},{refreshAuthToken:c,userSalt:l,config:this.statisticsConfig,...this.interactiveController&&{useIsid:!0,isid:this.prevIsid}})),this.uiConfig.features.sentry&&this.uiConfig.sentry.dsn&&new El(this.uiConfig.sentry,{version:Rl,env:pf},{movieId:ce,albumId:o,place:s,autoplay:(m&&!this.interactiveController)??!1,mobile:se,clip:ve}),this.interactiveController&&(this.prevIsid??=this.statistics?.oneStat.isid$.getValue()),this.sentry={...this.sentry,...El.getInstance()};const Pe=!!V,ye=[];let Ke="tooltip_interactive_go_back_disabled_first";if(Pe&&this.interactiveController){const Ye=this.interactiveController.state.isInitialChapter$.getValue(),et=this.interactiveController.getHistoryState();Ye&&ye.push(st.REPLAY_BUTTON),this.interactiveController.getIsSeekable().getValue()||ye.push(st.SEEK_TO_INTERACTIVE_BUTTON),et.hasPrevChapter$.getValue()||(ye.push(st.PLAY_PREV_CHAPTER_BUTTON),Ye||(et.isGoBackLimited$.getValue()?Ke="tooltip_interactive_go_back_disabled_limit":Ke="tooltip_interactive_go_back_disabled"))}const it=()=>{this.isInited=!1,this.prevIsid=void 0;const Ye=n?.info.isEnded$.getValue()&&this.interactiveController?.state.isEndChapter$.getValue();K.onReplayInteractiveVideo&&!Ye?K.onReplayInteractiveVideo():this.replayInteractiveVideo()};this.store=c3({player:n,interfaceLanguage:ie,videoId:ce,isClip:ve,isLiveCatchUpMode:w,isAudioDisabled:x,statAuthToken:r,callbacks:K,webApi:he,videoEpisodes:we,previewThumbsData:re,canDownload:ne,uiConfig:this.uiConfig,coreConfig:this.coreConfig,disabledControls:ye,isInteractive:Pe,interactiveRanges$:this.interactiveController?.state.interactiveRanges$,isInteractiveTime$:this.interactiveController?.state.isInteractiveTime$,replayInteractive:it,playPrevChapterDisabledTooltip:Ke,hasInteractiveBranches:!!this.interactiveController?.getChapterBranches()?.length,additionalButtons:this.uiConfig.features.additionalButtons?I:[],looped:oe&&this.videoConfig.videos.length===1,statistics:this.statistics});const{stores:Xe}=this.microStoresRoot=C5();this.subscription.add(this.store.state.currentFormat$.subscribe(Ye=>K?.onCurrentFormatChanged?.(Ye))),this.subscription.add(Xe.interactiveControlsOpacity$.subscribe(Ye=>{Ye!==null&&this?.interactiveController?.setDisabledControls(Ye)})),this.subscription.add(this.store.state.throughputEstimation$.subscribe(Ye=>K?.onThroughputEstimationChanged?.(Ye))),this.subscription.add(this.store.state.trafficSavingEnabled$.subscribe(Ye=>K?.onTrafficSavingEnabledChanged?.(Ye))),this.subscription.add(this.store.state.currentPlaybackRate$.subscribe(Ye=>K?.onCurrentPlaybackRateChanged?.(Ye))),this.subscription.add(this.store.state.volume$.subscribe(Ye=>K?.onVolumeChange?.(Ye))),this.subscription.add(this.store.state.muted$.subscribe(Ye=>Ye?K?.onMute?.():K?.onUnmute?.())),this.subscription.add(this.store.state.videoBitrate$.subscribe(Ye=>K?.onVideoBitrateChanged?.(Ye))),this.subscription.add(this.store.state.isInteractiveTime$.subscribe(Ye=>{const et=this.store?.ui.controls.disabledControls$;et&&(Ye&&!et.includes(Jo)&&et.add(Jo),Ye||et.remove(Jo))})),this.initMediaSession(),this.interactiveController&&le&&this.initInteractivesStatistics(),this.svelteRootComponent=new Qh({target:this.playerContainer,props:{interactiveContainer:this.interactiveContainer,sources:Te,store:this.store,microStoresRoot:this.microStoresRoot,uiConfig:this.uiConfig,title:Re,thumbUrl:Me,videoLogoUrl:Ne,subtitles:Oe,live:Le,preload:f,autoplay:m,muted:_,volume:h,fromTime:b,canRewindLive:k,supportLink:v,showAds:P,adsSlotId:y,adsParams:Ae,adsPreviewParam:A,duration:Q,logoClickable:M,logoHidden:U,isMobile:se,failoverHosts:G,fullScreenTarget:$,showMiniTimer:Y,outerContainerRef:this.rootContainer,showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive(),endScreenVideoTitle:ue.nextVideoTitle,endScreenVideoThumb:ue.nextVideoThumb,isOneVideoPlaylist:this.isOneVideoPlaylist(),playNextVideo:()=>this.playNextVideo(),playPrevVideo:()=>this.playPrevVideo(),repeatPlaylist:()=>this.repeatPlaylist(),playPrevChapter:()=>this.playPrevChapter(),seekToInteractive:()=>this.seekToInteractive(),toggleGraph:()=>this.toggleGraph()}}),this.addPlayerInfoSubscriptions(),this.isInited||(this.isInited=!0,this.videoConfig?.callbacks?.onInited?.())}addPlayerInfoSubscriptions(){const e=this.store;if(!e)return;const i=this.videoConfig?.callbacks;i&&this.subscription.add(e.playerPhase.subscribe(o=>i.onPlayerPhaseChanged?.(o))).add(e.state.playbackState$.subscribe(o=>i.onPlaybackStateChanged?.(o))).add(e.state.isLive$.subscribe(o=>i.onIsLiveChanged?.(o))).add(e.state.isActiveLive$.subscribe(o=>i.onIsActiveLiveChanged?.(o))).add(e.state.isAudioAvailable$.subscribe(o=>i.onIsAudioAvailableChanged?.(o))).add(e.state.currentQuality$.subscribe(o=>i.onCurrentQualityChanged?.(o))).add(e.state.availableQualities$.subscribe(o=>i.onAvailableQualitiesChanged?.(o.map(({value:s})=>s).filter(s=>s!==po.AUTO)))).add(e.ui.isPictureInPictureActive$.subscribe(o=>o?i.onPiPEnter?.():i.onPiPExit?.()));const n=i?.uiInfo;n&&this.subscription.add(e.ui.controlsVisible.subscribe(o=>n.onControlsVisibleChanged?.(o))).add(e.ui.isMobile.subscribe(o=>n.onIsMobileChanged?.(o))).add(e.ui.playerSize.subscribe(o=>n.onPlayerSizeChanged?.(o))).add(e.ui.controls.prevButton.subscribe(o=>n.onPrevButtonChanged?.(o))).add(e.ui.controls.playButton.subscribe(o=>n.onPlayButtonChanged?.(o))).add(e.ui.controls.replayButton.subscribe(o=>n.onReplayButtonChanged?.(o))).add(e.ui.controls.nextButton.subscribe(o=>n.onNextButtonChanged?.(o))).add(e.ui.controls.playPrevChapterButton.subscribe(o=>n.onPlayPrevChapterChanged?.(o))).add(e.ui.controls.seekToInteractiveButton.subscribe(o=>n.onSeekToInteractiveButtonChanged?.(o))).add(e.ui.controls.interactiveGraphButton.subscribe(o=>n.onGraphButtonChanged?.(o))).add(e.ui.controls.liveButton.subscribe(o=>n.onLiveButtonChanged?.(o))).add(e.ui.controls.time.subscribe(o=>n.onTimeUpdateChanged?.(o))).add(e.ui.controls.episodes.subscribe(o=>n.onEpisodesChanged?.(o))).add(e.ui.controls.subtitles.subscribe(o=>n.onSubtitlesChanged?.(o))).add(e.ui.controls.settings.subscribe(o=>n.onSettingsChanged?.(o))).add(e.ui.controls.fullscreen.subscribe(o=>n.onFullscreenChanged?.(o))).add(e.ui.controls.chromecast.subscribe(o=>n.onChromecastChanged?.(o))).add(e.ui.controls.pip.subscribe(o=>n.onPipChanged?.(o))).add(e.ui.controls.vkLogo.subscribe(o=>n.onVkLogoChanged?.(o))).add(e.ui.controls.interactiveTimeIcon.subscribe(o=>n.onInteractiveTimeIconChanged?.(o)))}playNextVideo(){if(!this.videoConfig)return;let e=!0;if(this.videoConfig.callbacks?.onNextVideoClick)try{e=this.videoConfig.callbacks.onNextVideoClick()}catch{this.log({message:"onNextVideoClick callback failed to execute"})}e&&(this.currentPlayingVideoIndex++,this.currentPlayingVideoIndex>=this.videoConfig.videos.length&&(this.currentPlayingVideoIndex=0),this.log({message:`play next video, index: ${this.currentPlayingVideoIndex}`}),this.createPlayerWithCurrentVideo())}playPrevVideo(){if(!this.videoConfig)return;let e=!0;if(this.videoConfig.callbacks?.onPrevVideoClick)try{e=this.videoConfig.callbacks.onPrevVideoClick()}catch{this.log({message:"onPrevVideoClick callback failed to execute"})}e&&(this.currentPlayingVideoIndex--,this.currentPlayingVideoIndex<0&&(this.currentPlayingVideoIndex=this.videoConfig.videos.length-1),this.log({message:`play prev video, index: ${this.currentPlayingVideoIndex}`}),this.createPlayerWithCurrentVideo())}repeatPlaylist(){this.currentPlayingVideoIndex=0,this.log({message:"repeat playlist"}),this.createPlayerWithCurrentVideo()}createPlayerWithCurrentVideo(e,i=!0){if(!this.videoConfig)return;const n=this.videoConfig.videos[this.currentPlayingVideoIndex];if(!n){this.log({message:"no next video"});return}this.isInited&&vn(n.unitedVideoId)&&this.store.actions.internal.nextMovie(n.unitedVideoId),this.svelteRootComponent?.$destroy(),this.createPlayer(n,{autoplay:i,fromTime:0},e)}playPrevChapter(){this.interactiveController?.playPrevChapter()}seekToInteractive(){const e=this.interactiveController?.getNextInteractiveStartTime();typeof e=="number"&&this.seekTime(e/1e3)}toggleGraph(){if(!this.isInited)return;const e=this.store,{isEnded$:i,playbackState$:n,graphIsOpened$:o}=e.state,{disabledControls$:s}=e.ui.controls,l=xe(i),r=xe(n);xe(o)?(o.set(!1),this.interactiveController?.toggleGraphView(!1),s.remove(us),!l&&this.graphMadePause&&this.play()):(this.graphMadePause=r==="playing",o.set(!0),this.interactiveController?.toggleGraphView(!0),s.add(us),!l&&this.graphMadePause&&this.pause())}async initInteractives(){if(this.videoConfig?.interactiveData)try{const{Interactives:e,EVENT_NAMES:i,CustomError:n}=await import("@vkontakte/videoplayer-interactive/esnext.esm.js");this.interactiveContainer=document.createElement("div"),this.interactiveContainer.classList.add("interactiveContainer");const o=this.store?.interfaceLanguage$,s=o?xe(o):this.videoConfig.interfaceLanguage,{projectInfo:l,initChapterId:r,historyApi:a,videoLoader:c}=this.videoConfig.interactiveData;this.interactiveController=new e({parentElement:this.interactiveContainer,fullscreenTargetElement:this.playerContainer,lang:s,graph:this.uiConfig.features.interactiveGraph,projectInfo:l,initChapterId:r,historyApi:a,vkVideoLoader:c,lastFrame:this.uiConfig.features.interactiveLastFrame,permanentTextControls:this.uiConfig.features.interactiveTextPermanent,initSeamless:!0,config:this.uiConfig.interactive,coreConfig:this.coreConfig}),await this.interactiveController.setManifest(this.videoConfig.interactiveData.manifest);const{isInteractiveExpectation$:f}=this.interactiveController.state;this.uiConfig.features.seekToInteractive&&this.subscription.add(this.interactiveController.getIsSeekable().subscribe(h=>{if(!this.isInited)return;const _=this.store;h?_.ui.controls.disabledControls$.remove(st.SEEK_TO_INTERACTIVE_BUTTON):_.ui.controls.disabledControls$.add(st.SEEK_TO_INTERACTIVE_BUTTON)})),this.subscription.add(f.subscribe(h=>{this.store&&this.store.state.isInteractiveExpectation$.set(h)}));let m=!0;if(this.interactiveController.on(i.playerChanged,h=>{if(!this.videoConfig)return;this.videoConfig.videos[this.currentPlayingVideoIndex]={...h.config,title:l?.title||h.config.title};const _=m?this.videoConfig.autoplay:!0;this.createPlayerWithCurrentVideo(h.player,_),m&&(m=!1)}),this.interactiveController.on(i.interactives,({type:h,actionType:_})=>{if(!this.store)return;const b=f.getValue();if(h==="action-choice"&&_==="setRandomBranch"&&(this.store.state.graphIsOpened$.set(!1),this.store.ui.controls.disabledControls$.remove(E1)),h==="action-choice-canceled"){const k=xe(this.store.state.isPlaying$)||b;if(this.videoConfig?.isMobile&&k){this.store.ui.interactiveHideMobileControls.set(!0);return}this.videoConfig?.callbacks.onDisabledInteractiveClick?.()}}),this.videoConfig?.callbacks?.onInteractiveHistoryChanged){const h=this.interactiveController.getHistoryState();this.subscription.add(h.history$.subscribe(_=>{_.length&&this.videoConfig?.callbacks?.onInteractiveHistoryChanged?.(_)}))}this.interactiveController.events.noInteraction$.subscribe(()=>{this.videoConfig?.callbacks.onInteractiveTimeIconClick?.()}),this.interactiveController.on(i.errors,h=>{this.log({message:h.toString()})})}catch(e){this.log({message:e.message})}}async initInteractivesStatistics(){const{statSubscription:e,oneStat:i}=this.statistics;if(!(!e||!i||!this.interactiveController))try{const{INTERACTIVE_CLICK_ACTIONS:n}=await import("@vkontakte/videoplayer-interactive/esnext.esm.js"),o={[n.GO_NEXT_BUTTON]:So.NEXT_BUTTON,[n.GO_NEXT_AREA]:So.NEXT_AREA,[n.WATCH_AGAIN]:So.WATCH_AGAIN,[n.OPEN_GRAPH]:So.GRAPH_SHOW,[n.CLOSE_GRAPH]:So.GRAPH_HIDE},{click$:s,nextMovie$:l}=this.interactiveController.getStatEvents(),r=new cn;s.subscribe(a=>{a in o?r.next(o[a]):(i?.logError({errorType:"InteractiveVideosAction",fatal:!1}),this.sentry.report?.(new Error("InteractiveVideosAction"),{errorType:"InteractiveVideosAction",fatal:!1}))}),e.add(i.attachToInteractive({click$:r,nextMovie$:l}))}catch(n){i?.logError({errorType:"InteractiveVideos",fatal:!1}),this.sentry.report?.(n,{errorType:"InteractiveVideosAction",fatal:!1})}}initPlayer(e,i={}){if(!Array.isArray(e.videos)||e.videos.length===0&&!e.interactiveData)throw new Error("empty videos");this.videoConfig=p1(P5,qc(e,n=>n instanceof HTMLElement?n:void 0)),this.uiConfig=lf(i.ui??{}),this.coreConfig=i.core??{configName:[]},this.statisticsConfig=i.statistics??{},this.sentry={config:this.uiConfig.sentry??{}},vn(this.videoConfig.isMediaSessionEnabled)&&(this.uiConfig.features.mediaSession=this.videoConfig.isMediaSessionEnabled??!0),vn(this.videoConfig.isPictureInPictureEnabled)&&(this.uiConfig.features.pip=this.uiConfig.features.pip??this.videoConfig.isPictureInPictureEnabled??!0,this.uiConfig.features.dpip=this.uiConfig.features.dpip??this.videoConfig.isPictureInPictureEnabled??!0),this.videoConfig.isMobile=this.uiConfig.isMobile??this.videoConfig.isMobile,this.videoConfig.autoplay&&=this.uiConfig.features.autoplay,this.videoConfig.showAds=this.uiConfig.ads.enable??this.videoConfig.showAds,this.videoConfig.adsSlotId=this.uiConfig.ads.slot??this.videoConfig.adsSlotId,this.videoConfig.adsPreviewParam=this.uiConfig.ads.preview??this.videoConfig.adsPreviewParam,this.videoConfig.logoHidden=!(this.uiConfig.showLogo??!this.videoConfig.logoHidden),this.videoConfig.canRewindLive&&=this.uiConfig.features.liveRewind,this.videoConfig.supportLink=this.videoConfig.supportLink??this.uiConfig.supportLink,this.currentPlayingVideoIndex=0,this.needToRepeatPlaylist=this.videoConfig.repeat,this.uiConfig.features.pip&&(this.uiConfig.features.dpip?this.pictureInPictureApi=m5.getLatestSupportedVersion():this.pictureInPictureApi=new zl),this.mediaSessionApi=this.uiConfig.features.mediaSession?new n5:void 0,this.annotationsApi=this.uiConfig.features.annotations?new v5(this.rootContainer):void 0,this.svelteStubComponent?.$destroy(),this.svelteRootComponent?.$destroy(),this.isInited=!1,this.prevIsid=void 0,this.interactiveController&&(this.interactiveController.destroy(),this.interactiveController=void 0),e.interactiveData?this.initInteractives():this.createPlayer(e.videos[0]),d5(this.pictureInPictureApi)&&this.pictureInPictureApi.setPlayerDomElement(this.playerContainer,this._shadowRoot)}isOneVideoPlaylist(){return this.videoConfig?this.videoConfig.videos.length===1:!1}updateNextVideos(e){if(!this.videoConfig)return;this.log({message:`update next videos, videos: ${JSON.stringify(e)}`}),this.videoConfig.videos.splice(this.currentPlayingVideoIndex+1),this.videoConfig.videos.push(...e);const i=this.getNextVideoInfo();this.svelteRootComponent?.$set({showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive(),endScreenVideoTitle:i.nextVideoTitle,endScreenVideoThumb:i.nextVideoThumb,isOneVideoPlaylist:this.isOneVideoPlaylist()})}initMediaSession(){this.mediaSessionApi&&(this.unsubscribePlayerPhaseSubscription?.(),this.unsubscribePlayerPhaseSubscription=this.store?.playerPhase.subscribe(e=>{e===De.Video?this.setupMediaSessionForVideo():e===De.Ads&&this.setupMediaSessionForAds()}))}setupMediaSessionForVideo(){if(!(!this.videoConfig||!this.mediaSessionApi))try{const{title:e,thumbUrl:i}={...this.videoConfig.videos[this.currentPlayingVideoIndex]},n=[["play",()=>this.play()],["pause",()=>this.pause()],["seekto",o=>this.seekTime(o.seekTime)]];this.videoConfig.videos.length>1&&(this.currentPlayingVideoIndex<this.videoConfig.videos.length-1&&n.push(["nexttrack",()=>this.playNextVideo()]),this.currentPlayingVideoIndex>0&&n.push(["previoustrack",()=>this.playPrevVideo()])),this.mediaSessionApi.setMetaData({title:e,thumbUrl:i}),this.mediaSessionApi.updateActionHandlers(n)}catch(e){this.log({message:e.message})}}setupMediaSessionForAds(){if(!(!this.videoConfig||!this.mediaSessionApi))try{const e="\u0420\u0435\u043A\u043B\u0430\u043C\u0430",i=[["play",()=>this.play()],["pause",()=>this.pause()]];this.mediaSessionApi.setMetaData({title:e}),this.mediaSessionApi.updateActionHandlers(i)}catch(e){this.log({message:e.message})}}play(){this.isControlDisabled(st.PLAY_BUTTON)||this.store?.playerPhase.is(De.WaitingLive)||(this.log({message:"play"}),this.svelteRootComponent?.play())}pause(){this.log({message:"pause"}),this.svelteRootComponent?.pause()}stop(){if(!this.videoConfig)return;this.log({message:"stop"}),this.svelteStubComponent?.$destroy();const e=this.videoConfig.videos[0];e&&(this.svelteRootComponent?.$destroy(),this.createPlayer(e))}setMuted(e){this.log({message:`set muted, muted: ${e}`}),this.svelteRootComponent?.setMuted(e)}setVolume(e){this.log({message:`set volume, volume: ${e}`}),this.svelteRootComponent?.setVolume(e)}setRepeat(e){this.log({message:`set repeat, repeat: ${e}`}),this.needToRepeatPlaylist=e,this.svelteRootComponent?.$set({needToRepeatPlaylist:this.needToRepeatPlaylist,showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive()})}seekTime(e){this.isControlDisabled(st.TIMELINE)||(this.log({message:`seek time, time: ${e}`}),this.svelteRootComponent?.seekTime(e))}seekEpisodeStartTime(e){this.log({message:`seek episode start time, time: ${e}`}),this.svelteRootComponent?.seekEpisodeStartTime(e)}returnFocusToEpisodes(){this.log({message:"return focus to episodes button"}),this.svelteRootComponent?.returnFocusToEpisodes()}setPlaybackRate(e){this.log({message:`set playback rate to: ${e}`}),this.svelteRootComponent?.setPlaybackRate(e)}setAutoQualityLimits(e){this.log({message:`set auto quality limitation. Max: ${e.max??"none"}. Min: ${e.min??"none"}`}),this.svelteRootComponent?.setAutoQualityLimits(e)}addLanguage(e){this.store?.actions.internal.addLanguage(e)}async setLanguage(e){await this.store?.actions.internal.setLanguage(e)}setLiveStart(e){this.log({message:"live started"}),this.store?.actions.internal.setWaitingLive(!1),this.svelteRootComponent?.initVideo(e),this.play()}setWaitRecord(){this.log({message:"post live"}),this.store?.actions.internal.setWaitingRecord(!0),this.store?.destroy()}setLiveEnd(e){this.log({message:"live ended"}),this.store?.actions.internal.setWaitingRecord(!1),this.svelteRootComponent?.$destroy(),this.createPlayer(e,{autoplay:!1})}getDeviceId(){return this.statistics?.oneStat.getDeviceId()??void 0}replayInteractiveVideo(){this.interactiveController&&this.interactiveController.setChapter()}}const M5=()=>{window.customElements.define("vk-video-player",S5)};export{vt as GridTypes,O5 as InterfaceLanguage,Rl as VERSION,H5 as VKNumericLanguage,N5 as VideoFormat,D5 as VideoQuality,F5 as loadVKLangPack,M5 as registerPlayerWebComponent};
51
+ `),i=document.createElement("style");i.textContent=e;const n=this.createStretchedContainer(),o=n.attachShadow({mode:"open"});o.append(i),o.append(this.playerDomElement),this.playerDummyElement=new u5({target:this.playerParentShadowRoot,context:this.svelteContext}),this.pipWindow?.document.body.append(n),this.info.isActive$.next(!0),this.pipWindow?.addEventListener("unload",s=>{!this.playerDomElement||!this.playerParentShadowRoot||!this.playerDummyElement||(this.playerDummyElement.$destroy(),this.playerParentShadowRoot.append(this.playerDomElement),this.info.isActive$.next(!1))})}async remove(){return new Promise(e=>{documentPictureInPicture.window?.close(),e()})}async dispose(){await this.remove()}createStretchedContainer(){const e=document.createElement("div");return e.style.width="100%",e.style.height="100%",e}}function d5(t){return t instanceof Qu}class m5{static getLatestSupportedVersion(){const e=new zl,i=new Qu;if(i.isSupported())return i;if(e.isSupported())return e}}function p1(t,e){const i=new Set([...Object.keys(t),...Object.keys(e)]),n={};for(const o of i)n[o]=e[o]??t[o]??void 0;return n}const p5="Inner error. Unexpectedly root annotation container null reference exception",h5="Annotation with such name already exists",g5="Annotation with such name does not exist";class yl extends Error{constructor(e){super(e),this.name="AnnotationError"}}const b5="1",_5=100;class v5{rootAnnotationsContainer;annotations=new Map;subscriptions=new Jn;mutationObserver;playerSize;constructor(e){this.rootAnnotationsContainer=e;const i=tl(()=>{for(const n of this.annotations.values())this.isElementExceedsBoundaries(n,this.playerSize.width,this.playerSize.height)?n.style.visibility="hidden":n.style.visibility="visible"},_5);this.subscriptions.add(Fc(this.rootAnnotationsContainer).subscribe(({width:n,height:o})=>{this.playerSize={width:n,height:o},i()})),this.mutationObserver=new MutationObserver(i),this.mutationObserver.observe(this.rootAnnotationsContainer,{attributes:!0,childList:!0,subtree:!0,characterData:!0})}add(e,i){if(!this.rootAnnotationsContainer)throw new yl(p5);if(this.annotations.has(e))throw new yl(h5);i.style.zIndex=i.style.zIndex??b5,i.style.position="absolute",this.rootAnnotationsContainer.append(i),this.annotations.set(e,i)}get(e){const i=this.annotations.get(e);if(!i)throw new yl(g5);return i}remove(e){const i=this.get(e);this.annotations.delete(e)&&i.remove()}clear(){for(const e in this.annotations.keys())this.remove(e)}destroy(){this.annotations.clear(),this.subscriptions.unsubscribe(),this.mutationObserver.disconnect(),this.rootAnnotationsContainer=null}isElementExceedsBoundaries(e,i,n){const o=e.offsetTop,s=e.offsetLeft,l=e.offsetWidth,r=e.offsetHeight;return o<0||s<0||s+l>i||o+r>n}registryRootContainer(e){}addLayer(e){return new HTMLElement}getLayer(e){}removeLayer(e){}clearLayer(e){}detach(){}reattach(){}}class Yl{stateName;state$;subscription;init(e,i){return ut(e),ut(i),this.subscription=new Jn,this.subscription}}class k5 extends Yl{stateName="fakeIsPlaying$";state$={...Ve(null),toggle:()=>this.state$.update(e=>!e)};init(e,i){const n=super.init(e,i),{isInteractiveExpectation$:o}=e.state;return n.add(o.subscribe(s=>{this.state$.set(s?!0:null)})),n}}class w5 extends Yl{stateName="interactiveControlsOpacity$";state$={...Ve(null),toggle:()=>this.state$.update(e=>!e)};init(e,i){const n=super.init(e,i),{fakeIsPlaying$:o}=i,{isInteractiveExpectation$:s,isPlaying$:l}=e.state,{controlsVisible:r,isMobile:a}=e.ui,c=xe(a),f=()=>c&&xe(r);return n.add(r.subscribe(m=>{if(!c)return;const h=xe(o);xe(l)?this.state$.set(m):h!==null&&this.state$.set(!h||m)})),n.add(l.subscribe(m=>{this.state$.set(!m||f())})),n.add(o.subscribe(m=>{if(m===null)return;const h=xe(s);if(f()){this.state$.set(!0);return}h&&this.state$.set(!m)})),n}}class y5 extends Yl{stateName="seekToInteractiveDisabledTooltip$";state$=Ve("tooltip_chapter_without_interactive");init(e,i){const n=super.init(e,i);return n.add(e.state.interactiveEpisodes$.subscribe(o=>{o.length&&(o.every(s=>s.completed)?this.state$.set("tooltip_interactive_of_chapter_completed"):this.state$.set("tooltip_disabled_when_interactive"))})),n}}const C5=()=>[k5,w5,y5].reduce(({subscribers:t,stores:e},i)=>{const n=new i;return{subscribers:[...t,n],stores:{...e,[n.stateName]:n.state$}}},{subscribers:[],stores:{}}),P5={preload:!0,autoplay:!1,repeat:!1,fromTime:0,canRewindLive:!0,showAds:!1,interfaceLanguage:Io.RU,logoClickable:!1,logoHidden:!1,isMobile:Uc(),isMediaSessionEnabled:!0,isPictureInPictureEnabled:!0,isAudioDisabled:!1,callbacks:{uiInfo:{}},tuningConfig:{configName:[]}};class S5 extends HTMLElement{svelteStubComponent;svelteRootComponent;store;microStoresRoot;statistics;sentry;_shadowRoot;playerContainer;rootContainer;uiConfig;coreConfig;statisticsConfig;interactiveController;interactiveContainer;graphMadePause;currentPlayingVideoIndex=0;needToRepeatPlaylist=!1;videoConfig=void 0;pictureInPictureApi=void 0;mediaSessionApi=void 0;unsubscribePlayerPhaseSubscription=void 0;logger;log;subscription;annotationsApi=void 0;createPlayerTimeout;prevIsid=void 0;isInited=!1;constructor(){super(),this.logger=new g1,this.log=this.logger.createComponentLog("VKVideoPlayer"),this.subscription=new Jn,this.graphMadePause=!1,window?.videoPlayerConfig?.debugLogs&&this.subscription.add(this.logger.log$.subscribe(e=>{console.log("%c player web component ","background:#77dd77;",`${e.component}`,e.message)}))}connectedCallback(){if(this.isInited)return;this.initPlayerRootContainers();const e=this.getAttribute("stub-title")??void 0,i=this.getAttribute("stub-thumb-url")??void 0;this.svelteStubComponent=new i5({target:this.playerContainer,props:{title:e,thumbUrl:i}})}disconnectedCallback(){this.annotationsApi?.destroy(),this.svelteRootComponent?.$destroy(),this.svelteStubComponent?.$destroy(),this.subscription.unsubscribe(),this.unsubscribePlayerPhaseSubscription?.(),this.interactiveController?.destroy()}initPlayerRootContainers(){this.rootContainer=document.createElement("div"),this.rootContainer.style.position="relative",this.rootContainer.className="root-container",this.rootContainer.style.width="100%",this.rootContainer.style.height="100%";const e=document.createElement("div");e.style.position="absolute",e.className="shadow-root-container",e.style.width="100%",e.style.height="100%",this._shadowRoot=e.attachShadow({mode:"open"}),this.playerContainer=document.createElement("div"),this.playerContainer.style.all="initial",this.playerContainer.style.display="block",this.playerContainer.style.contain="strict",this.playerContainer.style.width="100%",this.playerContainer.style.height="100%",this._shadowRoot.append(this.playerContainer),this.rootContainer.append(e),this.append(this.rootContainer)}needToShowNextPrevButtons(){return this.videoConfig?this.videoConfig.videos.length>1:!1}isNextButtonActive(){return this.videoConfig?this.needToShowNextPrevButtons()&&(this.currentPlayingVideoIndex<this.videoConfig.videos.length-1||this.needToRepeatPlaylist):!1}isPrevButtonActive(){return this.videoConfig?this.needToShowNextPrevButtons()&&(this.currentPlayingVideoIndex>0||this.needToRepeatPlaylist):!1}isControlDisabled(e){return this.store?.ui.controls.disabledControls$?.includes(e)||!1}getNextVideoInfo(){if(!this.videoConfig)return{nextVideoTitle:void 0,nextVideoThumb:void 0};const e=this.videoConfig.videos[this.currentPlayingVideoIndex+1]||{};return{nextVideoTitle:e.title,nextVideoThumb:e.thumbUrl}}createPlayer(e,i={},n){if(!this.videoConfig)return;const{albumId:o,statPlace:s,statUserSalt:l,statAuthToken:r,statTrackCode:a,refreshStatAuthToken:c,preload:f,autoplay:m,volume:h,muted:_,fromTime:b,canRewindLive:k,supportLink:v,showAds:P,adsSlotId:y,adsParams:C={},adsPreviewParam:A,interfaceLanguage:ie,logoClickable:M,logoHidden:U,isMobile:se,isAudioDisabled:x,isLiveCatchUpMode:w,fullScreenTarget:$,failoverHosts:G,canDownload:ne,callbacks:K,interactiveData:V,showThumbTimer:Y,additionalButtons:I=[],repeat:oe}=p1(this.videoConfig,i),{sources:Te,title:Re,thumbUrl:Me,videoLogoUrl:Ne,unitedVideoId:ce,isClip:ve=!1,duration:Q,adsParams:ee={},videoEpisodes:we,previewThumbsData:re,subtitles:Oe,live:Le}=e,Ae={...C,...ee},ue=this.getNextVideoInfo(),Ce={sources:Te,title:Re,thumbUrl:Me,subtitles:Oe,unitedVideoId:ce,isClip:ve,live:Le,albumId:o,statPlace:s,autoplay:m,muted:_,volume:h,fromTime:b,canRewindLive:k,showAds:P,adsSlotId:y,adsParams:Ae,adsPreviewParam:A,duration:Q,logoClickable:M,logoHidden:U,isMobile:se,repeat:oe,showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive(),endScreenVideoTitle:ue.nextVideoTitle,endScreenVideoThumb:ue.nextVideoThumb,isOneVideoPlaylist:this.isOneVideoPlaylist()},he={pictureInPictureApi:this.pictureInPictureApi,annotationsApi:this.annotationsApi};this.log({message:`create player, props: ${JSON.stringify(Ce)}`});const le=this.uiConfig.features.statistics&&!!ce,{pid:Be}=this.videoConfig?.interactiveData?.projectInfo||{};le&&(this.statistics=new u3({movieId:ce,albumId:o,place:s,trackCode:a,autoplay:(m&&!this.interactiveController)??!1,mobile:se,clip:ve,refDomain:this.videoConfig.refDomain,...Be&&!this.isInited&&{projectId:Number(Be)}},{refreshAuthToken:c,userSalt:l,config:this.statisticsConfig,...this.interactiveController&&{useIsid:!0,isid:this.prevIsid}})),this.uiConfig.features.sentry&&this.uiConfig.sentry.dsn&&new El(this.uiConfig.sentry,{version:Rl,env:pf},{movieId:ce,albumId:o,place:s,autoplay:(m&&!this.interactiveController)??!1,mobile:se,clip:ve}),this.interactiveController&&(this.prevIsid??=this.statistics?.oneStat.isid$.getValue()),this.sentry={...this.sentry,...El.getInstance()};const Pe=!!V,ye=[];let Ke="tooltip_interactive_go_back_disabled_first";if(Pe&&this.interactiveController){const Ye=this.interactiveController.state.isInitialChapter$.getValue(),et=this.interactiveController.getHistoryState();Ye&&ye.push(st.REPLAY_BUTTON),this.interactiveController.getIsSeekable().getValue()||ye.push(st.SEEK_TO_INTERACTIVE_BUTTON),et.hasPrevChapter$.getValue()||(ye.push(st.PLAY_PREV_CHAPTER_BUTTON),Ye||(et.isGoBackLimited$.getValue()?Ke="tooltip_interactive_go_back_disabled_limit":Ke="tooltip_interactive_go_back_disabled"))}const it=()=>{this.isInited=!1,this.prevIsid=void 0;const Ye=n?.info.isEnded$.getValue()&&this.interactiveController?.state.isEndChapter$.getValue();K.onReplayInteractiveVideo&&!Ye?K.onReplayInteractiveVideo():this.replayInteractiveVideo()};this.store=c3({player:n,interfaceLanguage:ie,videoId:ce,isClip:ve,isLiveCatchUpMode:w,isAudioDisabled:x,statAuthToken:r,callbacks:K,webApi:he,videoEpisodes:we,previewThumbsData:re,canDownload:ne,uiConfig:this.uiConfig,coreConfig:this.coreConfig,disabledControls:ye,isInteractive:Pe,interactiveRanges$:this.interactiveController?.state.interactiveRanges$,isInteractiveTime$:this.interactiveController?.state.isInteractiveTime$,replayInteractive:it,playPrevChapterDisabledTooltip:Ke,hasInteractiveBranches:!!this.interactiveController?.getChapterBranches()?.length,additionalButtons:this.uiConfig.features.additionalButtons?I:[],looped:oe&&this.videoConfig.videos.length===1,statistics:this.statistics});const{stores:Xe}=this.microStoresRoot=C5();this.subscription.add(this.store.state.currentFormat$.subscribe(Ye=>K?.onCurrentFormatChanged?.(Ye))),this.subscription.add(Xe.interactiveControlsOpacity$.subscribe(Ye=>{Ye!==null&&this?.interactiveController?.setDisabledControls(Ye)})),this.subscription.add(this.store.state.throughputEstimation$.subscribe(Ye=>K?.onThroughputEstimationChanged?.(Ye))),this.subscription.add(this.store.state.trafficSavingEnabled$.subscribe(Ye=>K?.onTrafficSavingEnabledChanged?.(Ye))),this.subscription.add(this.store.state.currentPlaybackRate$.subscribe(Ye=>K?.onCurrentPlaybackRateChanged?.(Ye))),this.subscription.add(this.store.state.volume$.subscribe(Ye=>K?.onVolumeChange?.(Ye))),this.subscription.add(this.store.state.muted$.subscribe(Ye=>Ye?K?.onMute?.():K?.onUnmute?.())),this.subscription.add(this.store.state.videoBitrate$.subscribe(Ye=>K?.onVideoBitrateChanged?.(Ye))),this.subscription.add(this.store.state.isInteractiveTime$.subscribe(Ye=>{const et=this.store?.ui.controls.disabledControls$;et&&(Ye&&!et.includes(Jo)&&et.add(Jo),Ye||et.remove(Jo))})),this.initMediaSession(),this.interactiveController&&le&&this.initInteractivesStatistics(),this.svelteRootComponent=new Qh({target:this.playerContainer,props:{interactiveContainer:this.interactiveContainer,sources:Te,store:this.store,microStoresRoot:this.microStoresRoot,uiConfig:this.uiConfig,title:Re,thumbUrl:Me,videoLogoUrl:Ne,subtitles:Oe,live:Le,preload:f,autoplay:m,muted:_,volume:h,fromTime:b,canRewindLive:k,supportLink:v,showAds:P,adsSlotId:y,adsParams:Ae,adsPreviewParam:A,duration:Q,logoClickable:M,logoHidden:U,isMobile:se,failoverHosts:G,fullScreenTarget:$,showMiniTimer:Y,outerContainerRef:this.rootContainer,showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive(),endScreenVideoTitle:ue.nextVideoTitle,endScreenVideoThumb:ue.nextVideoThumb,isOneVideoPlaylist:this.isOneVideoPlaylist(),playNextVideo:()=>this.playNextVideo(),playPrevVideo:()=>this.playPrevVideo(),repeatPlaylist:()=>this.repeatPlaylist(),playPrevChapter:()=>this.playPrevChapter(),seekToInteractive:()=>this.seekToInteractive(),toggleGraph:()=>this.toggleGraph()}}),this.addPlayerInfoSubscriptions(),this.isInited||(this.isInited=!0,this.videoConfig?.callbacks?.onInited?.())}addPlayerInfoSubscriptions(){const e=this.store;if(!e)return;const i=this.videoConfig?.callbacks;i&&this.subscription.add(e.playerPhase.subscribe(o=>i.onPlayerPhaseChanged?.(o))).add(e.state.playbackState$.subscribe(o=>i.onPlaybackStateChanged?.(o))).add(e.state.isLive$.subscribe(o=>i.onIsLiveChanged?.(o))).add(e.state.isActiveLive$.subscribe(o=>i.onIsActiveLiveChanged?.(o))).add(e.state.isAudioAvailable$.subscribe(o=>i.onIsAudioAvailableChanged?.(o))).add(e.state.currentQuality$.subscribe(o=>i.onCurrentQualityChanged?.(o))).add(e.state.availableQualities$.subscribe(o=>i.onAvailableQualitiesChanged?.(o.map(({value:s})=>s).filter(s=>s!==po.AUTO)))).add(e.ui.isPictureInPictureActive$.subscribe(o=>o?i.onPiPEnter?.():i.onPiPExit?.()));const n=i?.uiInfo;n&&this.subscription.add(e.ui.controlsVisible.subscribe(o=>n.onControlsVisibleChanged?.(o))).add(e.ui.isMobile.subscribe(o=>n.onIsMobileChanged?.(o))).add(e.ui.playerSize.subscribe(o=>n.onPlayerSizeChanged?.(o))).add(e.ui.controls.prevButton.subscribe(o=>n.onPrevButtonChanged?.(o))).add(e.ui.controls.playButton.subscribe(o=>n.onPlayButtonChanged?.(o))).add(e.ui.controls.replayButton.subscribe(o=>n.onReplayButtonChanged?.(o))).add(e.ui.controls.nextButton.subscribe(o=>n.onNextButtonChanged?.(o))).add(e.ui.controls.playPrevChapterButton.subscribe(o=>n.onPlayPrevChapterChanged?.(o))).add(e.ui.controls.seekToInteractiveButton.subscribe(o=>n.onSeekToInteractiveButtonChanged?.(o))).add(e.ui.controls.interactiveGraphButton.subscribe(o=>n.onGraphButtonChanged?.(o))).add(e.ui.controls.liveButton.subscribe(o=>n.onLiveButtonChanged?.(o))).add(e.ui.controls.time.subscribe(o=>n.onTimeUpdateChanged?.(o))).add(e.ui.controls.episodes.subscribe(o=>n.onEpisodesChanged?.(o))).add(e.ui.controls.subtitles.subscribe(o=>n.onSubtitlesChanged?.(o))).add(e.ui.controls.settings.subscribe(o=>n.onSettingsChanged?.(o))).add(e.ui.controls.fullscreen.subscribe(o=>n.onFullscreenChanged?.(o))).add(e.ui.controls.chromecast.subscribe(o=>n.onChromecastChanged?.(o))).add(e.ui.controls.pip.subscribe(o=>n.onPipChanged?.(o))).add(e.ui.controls.vkLogo.subscribe(o=>n.onVkLogoChanged?.(o))).add(e.ui.controls.interactiveTimeIcon.subscribe(o=>n.onInteractiveTimeIconChanged?.(o)))}playNextVideo(){if(!this.videoConfig)return;let e=!0;if(this.videoConfig.callbacks?.onNextVideoClick)try{e=this.videoConfig.callbacks.onNextVideoClick()}catch{this.log({message:"onNextVideoClick callback failed to execute"})}e&&(this.currentPlayingVideoIndex++,this.currentPlayingVideoIndex>=this.videoConfig.videos.length&&(this.currentPlayingVideoIndex=0),this.log({message:`play next video, index: ${this.currentPlayingVideoIndex}`}),this.createPlayerWithCurrentVideo())}playPrevVideo(){if(!this.videoConfig)return;let e=!0;if(this.videoConfig.callbacks?.onPrevVideoClick)try{e=this.videoConfig.callbacks.onPrevVideoClick()}catch{this.log({message:"onPrevVideoClick callback failed to execute"})}e&&(this.currentPlayingVideoIndex--,this.currentPlayingVideoIndex<0&&(this.currentPlayingVideoIndex=this.videoConfig.videos.length-1),this.log({message:`play prev video, index: ${this.currentPlayingVideoIndex}`}),this.createPlayerWithCurrentVideo())}repeatPlaylist(){this.currentPlayingVideoIndex=0,this.log({message:"repeat playlist"}),this.createPlayerWithCurrentVideo()}createPlayerWithCurrentVideo(e,i=!0){if(!this.videoConfig)return;const n=this.videoConfig.videos[this.currentPlayingVideoIndex];if(!n){this.log({message:"no next video"});return}this.isInited&&vn(n.unitedVideoId)&&this.store.actions.internal.nextMovie(n.unitedVideoId),this.svelteRootComponent?.$destroy(),this.createPlayer(n,{autoplay:i,fromTime:0},e)}playPrevChapter(){this.interactiveController?.playPrevChapter()}seekToInteractive(){const e=this.interactiveController?.getNextInteractiveStartTime();typeof e=="number"&&this.seekTime(e/1e3)}toggleGraph(){if(!this.isInited)return;const e=this.store,{isEnded$:i,playbackState$:n,graphIsOpened$:o}=e.state,{disabledControls$:s}=e.ui.controls,l=xe(i),r=xe(n);xe(o)?(o.set(!1),this.interactiveController?.toggleGraphView(!1),s.remove(us),!l&&this.graphMadePause&&this.play()):(this.graphMadePause=r==="playing",o.set(!0),this.interactiveController?.toggleGraphView(!0),s.add(us),!l&&this.graphMadePause&&this.pause())}async initInteractives(){if(this.videoConfig?.interactiveData)try{const{Interactives:e,EVENT_NAMES:i,CustomError:n}=await import("@vkontakte/videoplayer-interactive/esnext.esm.js");this.interactiveContainer=document.createElement("div"),this.interactiveContainer.classList.add("interactiveContainer");const o=this.store?.interfaceLanguage$,s=o?xe(o):this.videoConfig.interfaceLanguage,{projectInfo:l,initChapterId:r,historyApi:a,videoLoader:c}=this.videoConfig.interactiveData;this.interactiveController=new e({parentElement:this.interactiveContainer,fullscreenTargetElement:this.playerContainer,lang:s,graph:this.uiConfig.features.interactiveGraph,projectInfo:l,initChapterId:r,historyApi:a,vkVideoLoader:c,lastFrame:this.uiConfig.features.interactiveLastFrame,permanentTextControls:this.uiConfig.features.interactiveTextPermanent,initSeamless:!0,config:this.uiConfig.interactive,coreConfig:this.coreConfig}),await this.interactiveController.setManifest(this.videoConfig.interactiveData.manifest);const{isInteractiveExpectation$:f}=this.interactiveController.state;this.uiConfig.features.seekToInteractive&&this.subscription.add(this.interactiveController.getIsSeekable().subscribe(h=>{if(!this.isInited)return;const _=this.store;h?_.ui.controls.disabledControls$.remove(st.SEEK_TO_INTERACTIVE_BUTTON):_.ui.controls.disabledControls$.add(st.SEEK_TO_INTERACTIVE_BUTTON)})),this.subscription.add(f.subscribe(h=>{this.store&&this.store.state.isInteractiveExpectation$.set(h)}));let m=!0;if(this.interactiveController.on(i.playerChanged,h=>{if(!this.videoConfig)return;this.videoConfig.videos[this.currentPlayingVideoIndex]={...h.config,title:l?.title||h.config.title};const _=m?this.videoConfig.autoplay:!0;this.createPlayerWithCurrentVideo(h.player,_),m&&(m=!1)}),this.interactiveController.on(i.interactives,({type:h,actionType:_})=>{if(!this.store)return;const b=f.getValue();if(h==="action-choice"&&_==="setRandomBranch"&&(this.store.state.graphIsOpened$.set(!1),this.store.ui.controls.disabledControls$.remove(E1)),h==="action-choice-canceled"){const k=xe(this.store.state.isPlaying$)||b;if(this.videoConfig?.isMobile&&k){this.store.ui.interactiveHideMobileControls.set(!0);return}this.videoConfig?.callbacks.onDisabledInteractiveClick?.()}}),this.videoConfig?.callbacks?.onInteractiveHistoryChanged){const h=this.interactiveController.getHistoryState();this.subscription.add(h.history$.subscribe(_=>{_.length&&this.videoConfig?.callbacks?.onInteractiveHistoryChanged?.(_)}))}this.interactiveController.events.noInteraction$.subscribe(()=>{this.videoConfig?.callbacks.onInteractiveTimeIconClick?.()}),this.interactiveController.on(i.errors,h=>{this.log({message:h.toString()})})}catch(e){this.log({message:e.message})}}async initInteractivesStatistics(){const{statSubscription:e,oneStat:i}=this.statistics;if(!(!e||!i||!this.interactiveController))try{const{INTERACTIVE_CLICK_ACTIONS:n}=await import("@vkontakte/videoplayer-interactive/esnext.esm.js"),o={[n.GO_NEXT_BUTTON]:So.NEXT_BUTTON,[n.GO_NEXT_AREA]:So.NEXT_AREA,[n.WATCH_AGAIN]:So.WATCH_AGAIN,[n.OPEN_GRAPH]:So.GRAPH_SHOW,[n.CLOSE_GRAPH]:So.GRAPH_HIDE},{click$:s,nextMovie$:l}=this.interactiveController.getStatEvents(),r=new cn;s.subscribe(a=>{a in o?r.next(o[a]):(i?.logError({errorType:"InteractiveVideosAction",fatal:!1}),this.sentry.report?.(new Error("InteractiveVideosAction"),{errorType:"InteractiveVideosAction",fatal:!1}))}),e.add(i.attachToInteractive({click$:r,nextMovie$:l}))}catch(n){i?.logError({errorType:"InteractiveVideos",fatal:!1}),this.sentry.report?.(n,{errorType:"InteractiveVideosAction",fatal:!1})}}initPlayer(e,i={}){if(!Array.isArray(e.videos)||e.videos.length===0&&!e.interactiveData)throw new Error("empty videos");this.videoConfig=p1(P5,qc(e,n=>n instanceof HTMLElement?n:void 0)),this.uiConfig=lf(i.ui??{}),this.coreConfig=i.core??{configName:[]},this.statisticsConfig=i.statistics??{},this.sentry={config:this.uiConfig.sentry??{}},vn(this.videoConfig.isMediaSessionEnabled)&&(this.uiConfig.features.mediaSession=this.videoConfig.isMediaSessionEnabled??!0),vn(this.videoConfig.isPictureInPictureEnabled)&&(this.uiConfig.features.pip=this.uiConfig.features.pip??this.videoConfig.isPictureInPictureEnabled??!0,this.uiConfig.features.dpip=this.uiConfig.features.dpip??this.videoConfig.isPictureInPictureEnabled??!0),this.videoConfig.isMobile=this.uiConfig.isMobile??this.videoConfig.isMobile,this.videoConfig.autoplay&&=this.uiConfig.features.autoplay,this.videoConfig.showAds=this.uiConfig.ads.enable??this.videoConfig.showAds,this.videoConfig.adsSlotId=this.uiConfig.ads.slot??this.videoConfig.adsSlotId,this.videoConfig.adsPreviewParam=this.uiConfig.ads.preview??this.videoConfig.adsPreviewParam,this.videoConfig.logoHidden=!(this.uiConfig.showLogo??!this.videoConfig.logoHidden),this.videoConfig.canRewindLive&&=this.uiConfig.features.liveRewind,this.videoConfig.supportLink=this.videoConfig.supportLink??this.uiConfig.supportLink,this.currentPlayingVideoIndex=0,this.needToRepeatPlaylist=this.videoConfig.repeat,this.uiConfig.features.pip&&(this.uiConfig.features.dpip?this.pictureInPictureApi=m5.getLatestSupportedVersion():this.pictureInPictureApi=new zl),this.mediaSessionApi=this.uiConfig.features.mediaSession?new n5:void 0,this.annotationsApi=this.uiConfig.features.annotations?new v5(this.rootContainer):void 0,this.svelteStubComponent?.$destroy(),this.svelteRootComponent?.$destroy(),this.isInited=!1,this.prevIsid=void 0,this.interactiveController&&(this.interactiveController.destroy(),this.interactiveController=void 0),e.interactiveData?this.initInteractives():this.createPlayer(e.videos[0]),d5(this.pictureInPictureApi)&&this.pictureInPictureApi.setPlayerDomElement(this.playerContainer,this._shadowRoot)}isOneVideoPlaylist(){return this.videoConfig?this.videoConfig.videos.length===1:!1}updateNextVideos(e){if(!this.videoConfig)return;this.log({message:`update next videos, videos: ${JSON.stringify(e)}`}),this.videoConfig.videos.splice(this.currentPlayingVideoIndex+1),this.videoConfig.videos.push(...e);const i=this.getNextVideoInfo();this.svelteRootComponent?.$set({showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive(),endScreenVideoTitle:i.nextVideoTitle,endScreenVideoThumb:i.nextVideoThumb,isOneVideoPlaylist:this.isOneVideoPlaylist()})}initMediaSession(){this.mediaSessionApi&&(this.unsubscribePlayerPhaseSubscription?.(),this.unsubscribePlayerPhaseSubscription=this.store?.playerPhase.subscribe(e=>{e===De.Video?this.setupMediaSessionForVideo():e===De.Ads&&this.setupMediaSessionForAds()}))}setupMediaSessionForVideo(){if(!(!this.videoConfig||!this.mediaSessionApi))try{const{title:e,thumbUrl:i}={...this.videoConfig.videos[this.currentPlayingVideoIndex]},n=[["play",()=>this.play()],["pause",()=>this.pause()],["seekto",o=>this.seekTime(o.seekTime)]];this.videoConfig.videos.length>1&&(this.currentPlayingVideoIndex<this.videoConfig.videos.length-1&&n.push(["nexttrack",()=>this.playNextVideo()]),this.currentPlayingVideoIndex>0&&n.push(["previoustrack",()=>this.playPrevVideo()])),this.mediaSessionApi.setMetaData({title:e,thumbUrl:i}),this.mediaSessionApi.updateActionHandlers(n)}catch(e){this.log({message:e.message})}}setupMediaSessionForAds(){if(!(!this.videoConfig||!this.mediaSessionApi))try{const e="\u0420\u0435\u043A\u043B\u0430\u043C\u0430",i=[["play",()=>this.play()],["pause",()=>this.pause()]];this.mediaSessionApi.setMetaData({title:e}),this.mediaSessionApi.updateActionHandlers(i)}catch(e){this.log({message:e.message})}}play(){this.isControlDisabled(st.PLAY_BUTTON)||this.store?.playerPhase.is(De.WaitingLive)||(this.log({message:"play"}),this.svelteRootComponent?.play())}pause(){this.log({message:"pause"}),this.svelteRootComponent?.pause()}stop(){if(!this.videoConfig)return;this.log({message:"stop"}),this.svelteStubComponent?.$destroy();const e=this.videoConfig.videos[0];e&&(this.svelteRootComponent?.$destroy(),this.createPlayer(e))}setMuted(e){this.log({message:`set muted, muted: ${e}`}),this.svelteRootComponent?.setMuted(e)}setVolume(e){this.log({message:`set volume, volume: ${e}`}),this.svelteRootComponent?.setVolume(e)}setRepeat(e){this.log({message:`set repeat, repeat: ${e}`}),this.needToRepeatPlaylist=e,this.svelteRootComponent?.$set({needToRepeatPlaylist:this.needToRepeatPlaylist,showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive()})}seekTime(e){this.isControlDisabled(st.TIMELINE)||(this.log({message:`seek time, time: ${e}`}),this.svelteRootComponent?.seekTime(e))}seekEpisodeStartTime(e){this.log({message:`seek episode start time, time: ${e}`}),this.svelteRootComponent?.seekEpisodeStartTime(e)}returnFocusToEpisodes(){this.log({message:"return focus to episodes button"}),this.svelteRootComponent?.returnFocusToEpisodes()}setPlaybackRate(e){this.log({message:`set playback rate to: ${e}`}),this.svelteRootComponent?.setPlaybackRate(e)}setAutoQualityLimits(e){this.log({message:`set auto quality limitation. Max: ${e.max??"none"}. Min: ${e.min??"none"}`}),this.svelteRootComponent?.setAutoQualityLimits(e)}addLanguage(e){this.store?.actions.internal.addLanguage(e)}async setLanguage(e){await this.store?.actions.internal.setLanguage(e)}setLiveStart(e){this.log({message:"live started"}),this.store?.actions.internal.setWaitingLive(!1),this.svelteRootComponent?.initVideo(e),this.play()}setWaitRecord(){this.log({message:"post live"}),this.store?.actions.internal.setWaitingRecord(!0),this.store?.destroy()}setLiveEnd(e){this.log({message:"live ended"}),this.store?.actions.internal.setWaitingRecord(!1),this.svelteRootComponent?.$destroy(),this.createPlayer(e,{autoplay:!1})}getDeviceId(){return this.statistics?.oneStat.getDeviceId()??void 0}replayInteractiveVideo(){this.interactiveController&&this.interactiveController.setChapter()}}const M5=()=>{window.customElements.define("vk-video-player",S5)};export{vt as GridTypes,O5 as InterfaceLanguage,Rl as VERSION,H5 as VKNumericLanguage,N5 as VideoFormat,D5 as VideoQuality,F5 as loadVKLangPack,M5 as registerPlayerWebComponent};