@vkontakte/videoplayer 1.1.44-dev.63a413bf.0 → 1.1.44-dev.871d1572.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es2015.esm.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
- * @vkontakte/videoplayer v1.1.44-dev.63a413bf.0
3
- * Tue, 17 Sep 2024 05:40:47 GMT
2
+ * @vkontakte/videoplayer v1.1.44-dev.871d1572.0
3
+ * Tue, 17 Sep 2024 06:14:45 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-1-44/doc/
5
5
  */
6
- var y_=Object.defineProperty,w_=Object.defineProperties;var k_=Object.getOwnPropertyDescriptors;var Rc=Object.getOwnPropertySymbols;var C_=Object.prototype.hasOwnProperty,S_=Object.prototype.propertyIsEnumerable;var hs=(i,e,t)=>e in i?y_(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,lt=(i,e)=>{for(var t in e||(e={}))C_.call(e,t)&&hs(i,t,e[t]);if(Rc)for(var t of Rc(e))S_.call(e,t)&&hs(i,t,e[t]);return i},Vt=(i,e)=>w_(i,k_(e));var zi=(i,e,t)=>hs(i,typeof e!="symbol"?e+"":e,t);var pt=(i,e,t)=>new Promise((n,o)=>{var r=s=>{try{a(t.next(s))}catch(u){o(u)}},l=s=>{try{a(t.throw(s))}catch(u){o(u)}},a=s=>s.done?n(s.value):Promise.resolve(s.value).then(r,l);a((t=t.apply(i,e)).next())});function Se(){}function ue(i,e){for(let t in e)i[t]=e[t];return i}function gs(i){return i()}function Yl(){return Object.create(null)}function nt(i){i.forEach(gs)}function Ai(i){return typeof i=="function"}function U(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}var Ql;function bs(i,e){return i===e?!0:(Ql||(Ql=document.createElement("a")),Ql.href=e,i===Ql.href)}function Bc(i){return Object.keys(i).length===0}function Yt(i,...e){if(i==null){for(let n of e)n(void 0);return Se}let t=i.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function $e(i){let e;return Yt(i,t=>e=t)(),e}function H(i,e,t){i.$$.on_destroy.push(Yt(e,t))}function Ae(i,e,t,n){if(i){let o=qc(i,e,t,n);return i[0](o)}}function qc(i,e,t,n){return i[1]&&n?ue(t.ctx.slice(),i[1](n(e))):t.ctx}function Me(i,e,t,n){if(i[2]&&n){let o=i[2](n(t));if(e.dirty===void 0)return o;if(typeof o=="object"){let r=[],l=Math.max(e.dirty.length,o.length);for(let a=0;a<l;a+=1)r[a]=e.dirty[a]|o[a];return r}return e.dirty|o}return e.dirty}function Ve(i,e,t,n,o,r){if(o){let l=qc(e,t,n,r);i.p(l,o)}}function Re(i){if(i.ctx.length>32){let e=[],t=i.ctx.length/32;for(let n=0;n<t;n++)e[n]=-1;return e}return-1}function ye(i){let e={};for(let t in i)t[0]!=="$"&&(e[t]=i[t]);return e}function Dc(i){return i==null?"":i}var Lo=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global;var Zl=class i{constructor(e){zi(this,"_listeners","WeakMap"in Lo?new WeakMap:void 0);zi(this,"_observer");zi(this,"options");this.options=e}observe(e,t){return this._listeners.set(e,t),this._getObserver().observe(e,this.options),()=>{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){var e;return(e=this._observer)!=null?e:this._observer=new ResizeObserver(t=>{var n;for(let o of t)i.entries.set(o.target,o),(n=this._listeners.get(o.target))==null||n(o)})}};Zl.entries="WeakMap"in Lo?new WeakMap:void 0;var Nc=!1;function Oc(){Nc=!0}function Fc(){Nc=!1}function p(i,e){i.appendChild(e)}function Ie(i,e,t){let n=Hc(i);if(!n.getElementById(e)){let o=T("style");o.id=e,o.textContent=t,I_(n,o)}}function Hc(i){if(!i)return document;let e=i.getRootNode?i.getRootNode():i.ownerDocument;return e&&e.host?e:i.ownerDocument}function I_(i,e){return p(i.head||i,e),e.sheet}function S(i,e,t){i.insertBefore(e,t||null)}function k(i){i.parentNode&&i.parentNode.removeChild(i)}function Mi(i,e){for(let t=0;t<i.length;t+=1)i[t]&&i[t].d(e)}function T(i){return document.createElement(i)}function D(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function Ne(i){return document.createTextNode(i)}function B(){return Ne(" ")}function mt(){return Ne("")}function pe(i,e,t,n){return i.addEventListener(e,t,n),()=>i.removeEventListener(e,t,n)}function Zt(i){return function(e){return e.preventDefault(),i.call(this,e)}}function at(i){return function(e){return e.stopPropagation(),i.call(this,e)}}function c(i,e,t){t==null?i.removeAttribute(e):i.getAttribute(e)!==t&&i.setAttribute(e,t)}function we(i,e){for(let t in e)c(i,t,e[t])}function zc(i){return Array.from(i.childNodes)}function Qe(i,e){e=""+e,i.data!==e&&(i.data=e)}function yi(i,e,t,n){t==null?i.style.removeProperty(e):i.style.setProperty(e,t,n?"important":"")}var Xl;function E_(){if(Xl===void 0){Xl=!1;try{typeof window!="undefined"&&window.parent&&window.parent.document}catch(i){Xl=!0}}return Xl}function tl(i,e){getComputedStyle(i).position==="static"&&(i.style.position="relative");let n=T("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;let o=E_(),r;return o?(n.src="data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}<\/script>",r=pe(window,"message",l=>{l.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{r=pe(n.contentWindow,"resize",e),e()}),p(i,n),()=>{(o||r&&n.contentWindow)&&r(),k(n)}}function N(i,e,t){i.classList.toggle(e,!!t)}function Uc(i){let e={};return i.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}function Ln(i,e){return new i(e)}var mo;function no(i){mo=i}function il(){if(!mo)throw new Error("Function called outside component initialization");return mo}function Dt(i){il().$$.on_mount.push(i)}function Gn(i){il().$$.on_destroy.push(i)}function nl(i,e){return il().$$.context.set(i,e),e}function ol(i){return il().$$.context.get(i)}function Al(){return il().$$.context}function qn(i,e){let t=i.$$.callbacks[e.type];t&&t.slice().forEach(n=>n.call(this,e))}var Ao=[];var ge=[],rl=[],ys=[],Wc=Promise.resolve(),ws=!1;function ks(){ws||(ws=!0,Wc.then(Jl))}function Qn(){return ks(),Wc}function Yn(i){rl.push(i)}function He(i){ys.push(i)}var vs=new Set,ll=0;function Jl(){if(ll!==0)return;let i=mo;do{try{for(;ll<Ao.length;){let e=Ao[ll];ll++,no(e),B_(e.$$)}}catch(e){throw Ao.length=0,ll=0,e}for(no(null),Ao.length=0,ll=0;ge.length;)ge.pop()();for(let e=0;e<rl.length;e+=1){let t=rl[e];vs.has(t)||(vs.add(t),t())}rl.length=0}while(Ao.length);for(;ys.length;)ys.pop()();ws=!1,vs.clear(),no(i)}function B_(i){if(i.fragment!==null){i.update(),nt(i.before_update);let e=i.dirty;i.dirty=[-1],i.fragment&&i.fragment.p(i.ctx,e),i.after_update.forEach(Yn)}}function jc(i){let e=[],t=[];rl.forEach(n=>i.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),rl=e}var xl=new Set,Mo;function fe(){Mo={r:0,c:[],p:Mo}}function de(){Mo.r||nt(Mo.c),Mo=Mo.p}function d(i,e){i&&i.i&&(xl.delete(i),i.i(e))}function _(i,e,t,n){if(i&&i.o){if(xl.has(i))return;xl.add(i),Mo.c.push(()=>{xl.delete(i),n&&(t&&i.d(1),n())}),i.o(e)}else n&&n()}function Lt(i){return(i==null?void 0:i.length)!==void 0?i:Array.from(i)}function Oe(i,e){let t={},n={},o={$$scope:1},r=i.length;for(;r--;){let l=i[r],a=e[r];if(a){for(let s in l)s in a||(n[s]=1);for(let s in a)o[s]||(t[s]=a[s],o[s]=1);i[r]=a}else for(let s in l)o[s]=1}for(let l in n)l in t||(t[l]=void 0);return t}function Gc(i){return typeof i=="object"&&i!==null?i:{}}var q_=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],D_=new Set([...q_]);function ze(i,e,t){let n=i.$$.props[e];n!==void 0&&(i.$$.bound[n]=t,t(i.$$.ctx[n]))}function q(i){i&&i.c()}function V(i,e,t){let{fragment:n,after_update:o}=i.$$;n&&n.m(e,t),Yn(()=>{let r=i.$$.on_mount.map(gs).filter(Ai);i.$$.on_destroy?i.$$.on_destroy.push(...r):nt(r),i.$$.on_mount=[]}),o.forEach(Yn)}function R(i,e){let t=i.$$;t.fragment!==null&&(jc(t.after_update),nt(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function O_(i,e){i.$$.dirty[0]===-1&&(Ao.push(i),ks(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<<e%31}function j(i,e,t,n,o,r,l=null,a=[-1]){let s=mo;no(i);let u=i.$$={fragment:null,ctx:[],props:r,update:Se,not_equal:o,bound:Yl(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(s?s.$$.context:[])),callbacks:Yl(),dirty:a,skip_bound:!1,root:e.target||s.$$.root};l&&l(u.root);let f=!1;if(u.ctx=t?t(i,e.props||{},(m,h,...w)=>{let g=w.length?w[0]:h;return u.ctx&&o(u.ctx[m],u.ctx[m]=g)&&(!u.skip_bound&&u.bound[m]&&u.bound[m](g),f&&O_(i,m)),h}):[],u.update(),f=!0,nt(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){Oc();let m=zc(e.target);u.fragment&&u.fragment.l(m),m.forEach(k)}else u.fragment&&u.fragment.c();e.intro&&d(i.$$.fragment),V(i,e.target,e.anchor),Fc(),Jl()}no(s)}var F_;typeof HTMLElement=="function"&&(F_=class extends HTMLElement{constructor(e,t,n){super();zi(this,"$$ctor");zi(this,"$$s");zi(this,"$$c");zi(this,"$$cn",!1);zi(this,"$$d",{});zi(this,"$$r",!1);zi(this,"$$p_d",{});zi(this,"$$l",{});zi(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=t,n&&this.attachShadow({mode:"open"})}addEventListener(e,t,n){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){let o=this.$$c.$on(e,t);this.$$l_u.set(t,o)}super.addEventListener(e,t,n)}removeEventListener(e,t,n){if(super.removeEventListener(e,t,n),this.$$c){let o=this.$$l_u.get(t);o&&(o(),this.$$l_u.delete(t))}}connectedCallback(){return pt(this,null,function*(){if(this.$$cn=!0,!this.$$c){let t=function(l){return()=>{let a;return{c:function(){a=T("slot"),l!=="default"&&c(a,"name",l)},m:function(f,m){S(f,a,m)},d:function(f){f&&k(a)}}}};var e=t;if(yield Promise.resolve(),!this.$$cn||this.$$c)return;let n={},o=Uc(this);for(let l of this.$$s)l in o&&(n[l]=[t(l)]);for(let l of this.attributes){let a=this.$$g_p(l.name);a in this.$$d||(this.$$d[a]=Cs(a,l.value,this.$$p_d,"toProp"))}for(let l in this.$$p_d)!(l in this.$$d)&&this[l]!==void 0&&(this.$$d[l]=this[l],delete this[l]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:Vt(lt({},this.$$d),{$$slots:n,$$scope:{ctx:[]}})});let r=()=>{this.$$r=!0;for(let l in this.$$p_d)if(this.$$d[l]=this.$$c.$$.ctx[this.$$c.$$.props[l]],this.$$p_d[l].reflect){let a=Cs(l,this.$$d[l],this.$$p_d,"toAttribute");a==null?this.removeAttribute(this.$$p_d[l].attribute||l):this.setAttribute(this.$$p_d[l].attribute||l,a)}this.$$r=!1};this.$$c.$$.after_update.push(r),r();for(let l in this.$$l)for(let a of this.$$l[l]){let s=this.$$c.$on(l,a);this.$$l_u.set(a,s)}this.$$l={}}})}attributeChangedCallback(e,t,n){var o;this.$$r||(e=this.$$g_p(e),this.$$d[e]=Cs(e,n,this.$$p_d,"toProp"),(o=this.$$c)==null||o.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function Cs(i,e,t,n){var r;let o=(r=t[i])==null?void 0:r.type;if(e=o==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!t[i])return e;if(n==="toAttribute")switch(o){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e==null?null:e;default:return e}else switch(o){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}var W=class{constructor(){zi(this,"$$");zi(this,"$$set")}$destroy(){R(this,1),this.$destroy=Se}$on(e,t){if(!Ai(t))return Se;let n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{let o=n.indexOf(t);o!==-1&&n.splice(o,1)}}$set(e){this.$$set&&!Bc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};var Qc="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Qc);import"@vkontakte/videoplayer-core";import{noop as Sl,safeStorage as Y6,throttleFn as Z6}from"@vkontakte/videoplayer-shared";import{SeekAction as X6}from"@vkontakte/videoplayer-statistics";import{InterfaceLanguage as H_,fillWithDefault as z_,VideoQuality as U_}from"@vkontakte/videoplayer-shared";var K_={isMobile:void 0,defaultLanguage:H_.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:"vk_video",volumeDefault:1,volumeMinRestore:.05,loaderDelay:500,minSubtitlesFontSize:13,autoSubtitlesTimeout:2e3,allowChangingFullscreenTarget:!0,trafficSavingLimit:U_.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,annotationsInside:!1,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,interactiveTimeIndicator:!0,thumbTimer:!0,hotKeyMapModal:!0,hotKeyHelpers:!0,saveDebugInfoToFile:!1,saveTraceInfoToFile:!1,additionalButtons:!0,contextMenuButton:!0,audioLanguages:!1,saveRate:!1,fullscreenInternalTargetPlayerContainer:!1},controls:{showOnStartupAtAutoplay:!0,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,runtimeTimeout:5e3,slot:void 0,preview:void 0},interactive:{historyMaxLength:100,noInteractionEventTimeout:3e4}},Yc=i=>z_(i,K_),Zc=i=>nl("ui-config",i),zt=()=>ol("ui-config");var Ml="vk_player_debug_panel_opened";var Xc="videoplayer",Jc="videoplayer";var xn={KeyF:"f",KeyK:"k",KeyC:"c",KeyM:"m"},xc=new Set(["ArrowLeft","ArrowRight","KeyL","KeyJ"]),$c=new Set(["Tab","Space","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"]),ef=new Set(["ShiftRight","ShiftLeft"]);var tf=["TIMELINE"],Vl=[...tf,"GRAPH_BUTTON"],Ss=[...tf,"PLAY_BUTTON"],$l=[...Vl,"PLAY_BUTTON"];var Ro=(r=>(r.XS="xs",r.S="s",r.M="m",r.L="l",r.XL="xl",r))(Ro||{}),Bo={xs:0,s:1,m:2,l:3,xl:4};var sl=[];function Un(i,e){return{subscribe:Fe(i,e).subscribe}}function Fe(i,e=Se){let t,n=new Set;function o(a){if(U(i,a)&&(i=a,t)){let s=!sl.length;for(let u of n)u[1](),sl.push(u,i);if(s){for(let u=0;u<sl.length;u+=2)sl[u][0](sl[u+1]);sl.length=0}}}function r(a){o(a(i))}function l(a,s=Se){let u=[a,s];return n.add(u),n.size===1&&(t=e(o,r)||Se),a(i),()=>{n.delete(u),n.size===0&&t&&(t(),t=null)}}return{set:o,update:r,subscribe:l}}function Vi(i,e,t){let n=!Array.isArray(i),o=n?[i]:i;if(!o.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");let r=e.length<2;return Un(t,(l,a)=>{let s=!1,u=[],f=0,m=Se,h=()=>{if(f)return;m();let g=e(n?u[0]:u,l,a);r?l(g):m=Ai(g)?g:Se},w=o.map((g,C)=>Yt(g,v=>{u[C]=v,f&=~(1<<C),s&&h()},()=>{f|=1<<C}));return s=!0,h(),function(){nt(w),m(),s=!1}})}import{assertNonNullable as nf,VERSION as W_}from"@vkontakte/videoplayer-shared";import{VERSION as j_}from"@vkontakte/videoplayer-core";import{VERSION as G_}from"@vkontakte/videoplayer-statistics";var er="prod",al="1.1.44-dev.63a413bf.0";var qo=(i,e,t)=>{let n=document.createElement("a");n.href=i,n.download=`${e}.${t}`,n.style.display="none",n.click()};var of=Symbol("storeContext"),lf=Symbol("microStoresContext"),rf=(i,e)=>{nl(of,i),nl(lf,e),er==="dev"&&(window.app={store:i,microStores:e})},st=()=>{let i=ol(of);return nf(i,"Store context is empty!"),i},Kn=()=>{let i=ol(lf);return nf(i,"MicroStores context is empty!"),i},Pt=(i,e)=>Ts(i,i.getValue(),e),Ts=(i,e,t)=>Un(e,n=>{let o=i.subscribe(r=>{n(r),t==null||t(r)});return()=>o.unsubscribe()}),sf=(i,e,t)=>{var E,y,b,P,A,M;let n=i.info,{width:o,height:r}=$e(t.ui.playerSize),l=(y=(E=n.throughputEstimation$.getValue())==null?void 0:E.toFixed(0))!=null?y:0,a=(P=(b=n.rttEstimation$.getValue())==null?void 0:b.toFixed(0))!=null?P:0,s=n.isAutoQualityEnabled$.getValue()?"auto":"manual",u=`${al} (core: ${j_}, stat: ${G_}, shared: ${W_})`,f=$e(t.state.errorLog$),m=f.length?`
6
+ var y_=Object.defineProperty,w_=Object.defineProperties;var k_=Object.getOwnPropertyDescriptors;var Rc=Object.getOwnPropertySymbols;var C_=Object.prototype.hasOwnProperty,S_=Object.prototype.propertyIsEnumerable;var hs=(i,e,t)=>e in i?y_(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,lt=(i,e)=>{for(var t in e||(e={}))C_.call(e,t)&&hs(i,t,e[t]);if(Rc)for(var t of Rc(e))S_.call(e,t)&&hs(i,t,e[t]);return i},Vt=(i,e)=>w_(i,k_(e));var zi=(i,e,t)=>hs(i,typeof e!="symbol"?e+"":e,t);var pt=(i,e,t)=>new Promise((n,o)=>{var r=s=>{try{a(t.next(s))}catch(u){o(u)}},l=s=>{try{a(t.throw(s))}catch(u){o(u)}},a=s=>s.done?n(s.value):Promise.resolve(s.value).then(r,l);a((t=t.apply(i,e)).next())});function Se(){}function ue(i,e){for(let t in e)i[t]=e[t];return i}function gs(i){return i()}function Yl(){return Object.create(null)}function nt(i){i.forEach(gs)}function Ai(i){return typeof i=="function"}function U(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}var Ql;function bs(i,e){return i===e?!0:(Ql||(Ql=document.createElement("a")),Ql.href=e,i===Ql.href)}function Bc(i){return Object.keys(i).length===0}function Yt(i,...e){if(i==null){for(let n of e)n(void 0);return Se}let t=i.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function $e(i){let e;return Yt(i,t=>e=t)(),e}function H(i,e,t){i.$$.on_destroy.push(Yt(e,t))}function Ae(i,e,t,n){if(i){let o=qc(i,e,t,n);return i[0](o)}}function qc(i,e,t,n){return i[1]&&n?ue(t.ctx.slice(),i[1](n(e))):t.ctx}function Me(i,e,t,n){if(i[2]&&n){let o=i[2](n(t));if(e.dirty===void 0)return o;if(typeof o=="object"){let r=[],l=Math.max(e.dirty.length,o.length);for(let a=0;a<l;a+=1)r[a]=e.dirty[a]|o[a];return r}return e.dirty|o}return e.dirty}function Ve(i,e,t,n,o,r){if(o){let l=qc(e,t,n,r);i.p(l,o)}}function Re(i){if(i.ctx.length>32){let e=[],t=i.ctx.length/32;for(let n=0;n<t;n++)e[n]=-1;return e}return-1}function ye(i){let e={};for(let t in i)t[0]!=="$"&&(e[t]=i[t]);return e}function Dc(i){return i==null?"":i}var Lo=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global;var Zl=class i{constructor(e){zi(this,"_listeners","WeakMap"in Lo?new WeakMap:void 0);zi(this,"_observer");zi(this,"options");this.options=e}observe(e,t){return this._listeners.set(e,t),this._getObserver().observe(e,this.options),()=>{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){var e;return(e=this._observer)!=null?e:this._observer=new ResizeObserver(t=>{var n;for(let o of t)i.entries.set(o.target,o),(n=this._listeners.get(o.target))==null||n(o)})}};Zl.entries="WeakMap"in Lo?new WeakMap:void 0;var Nc=!1;function Oc(){Nc=!0}function Fc(){Nc=!1}function p(i,e){i.appendChild(e)}function Ie(i,e,t){let n=Hc(i);if(!n.getElementById(e)){let o=T("style");o.id=e,o.textContent=t,I_(n,o)}}function Hc(i){if(!i)return document;let e=i.getRootNode?i.getRootNode():i.ownerDocument;return e&&e.host?e:i.ownerDocument}function I_(i,e){return p(i.head||i,e),e.sheet}function S(i,e,t){i.insertBefore(e,t||null)}function k(i){i.parentNode&&i.parentNode.removeChild(i)}function Mi(i,e){for(let t=0;t<i.length;t+=1)i[t]&&i[t].d(e)}function T(i){return document.createElement(i)}function D(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function Ne(i){return document.createTextNode(i)}function B(){return Ne(" ")}function mt(){return Ne("")}function pe(i,e,t,n){return i.addEventListener(e,t,n),()=>i.removeEventListener(e,t,n)}function Zt(i){return function(e){return e.preventDefault(),i.call(this,e)}}function at(i){return function(e){return e.stopPropagation(),i.call(this,e)}}function c(i,e,t){t==null?i.removeAttribute(e):i.getAttribute(e)!==t&&i.setAttribute(e,t)}function we(i,e){for(let t in e)c(i,t,e[t])}function zc(i){return Array.from(i.childNodes)}function Qe(i,e){e=""+e,i.data!==e&&(i.data=e)}function yi(i,e,t,n){t==null?i.style.removeProperty(e):i.style.setProperty(e,t,n?"important":"")}var Xl;function E_(){if(Xl===void 0){Xl=!1;try{typeof window!="undefined"&&window.parent&&window.parent.document}catch(i){Xl=!0}}return Xl}function tl(i,e){getComputedStyle(i).position==="static"&&(i.style.position="relative");let n=T("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;let o=E_(),r;return o?(n.src="data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}<\/script>",r=pe(window,"message",l=>{l.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{r=pe(n.contentWindow,"resize",e),e()}),p(i,n),()=>{(o||r&&n.contentWindow)&&r(),k(n)}}function N(i,e,t){i.classList.toggle(e,!!t)}function Uc(i){let e={};return i.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}function Ln(i,e){return new i(e)}var mo;function no(i){mo=i}function il(){if(!mo)throw new Error("Function called outside component initialization");return mo}function Dt(i){il().$$.on_mount.push(i)}function Gn(i){il().$$.on_destroy.push(i)}function nl(i,e){return il().$$.context.set(i,e),e}function ol(i){return il().$$.context.get(i)}function Al(){return il().$$.context}function qn(i,e){let t=i.$$.callbacks[e.type];t&&t.slice().forEach(n=>n.call(this,e))}var Ao=[];var ge=[],rl=[],ys=[],Wc=Promise.resolve(),ws=!1;function ks(){ws||(ws=!0,Wc.then(Jl))}function Qn(){return ks(),Wc}function Yn(i){rl.push(i)}function He(i){ys.push(i)}var vs=new Set,ll=0;function Jl(){if(ll!==0)return;let i=mo;do{try{for(;ll<Ao.length;){let e=Ao[ll];ll++,no(e),B_(e.$$)}}catch(e){throw Ao.length=0,ll=0,e}for(no(null),Ao.length=0,ll=0;ge.length;)ge.pop()();for(let e=0;e<rl.length;e+=1){let t=rl[e];vs.has(t)||(vs.add(t),t())}rl.length=0}while(Ao.length);for(;ys.length;)ys.pop()();ws=!1,vs.clear(),no(i)}function B_(i){if(i.fragment!==null){i.update(),nt(i.before_update);let e=i.dirty;i.dirty=[-1],i.fragment&&i.fragment.p(i.ctx,e),i.after_update.forEach(Yn)}}function jc(i){let e=[],t=[];rl.forEach(n=>i.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),rl=e}var xl=new Set,Mo;function fe(){Mo={r:0,c:[],p:Mo}}function de(){Mo.r||nt(Mo.c),Mo=Mo.p}function d(i,e){i&&i.i&&(xl.delete(i),i.i(e))}function _(i,e,t,n){if(i&&i.o){if(xl.has(i))return;xl.add(i),Mo.c.push(()=>{xl.delete(i),n&&(t&&i.d(1),n())}),i.o(e)}else n&&n()}function Lt(i){return(i==null?void 0:i.length)!==void 0?i:Array.from(i)}function Oe(i,e){let t={},n={},o={$$scope:1},r=i.length;for(;r--;){let l=i[r],a=e[r];if(a){for(let s in l)s in a||(n[s]=1);for(let s in a)o[s]||(t[s]=a[s],o[s]=1);i[r]=a}else for(let s in l)o[s]=1}for(let l in n)l in t||(t[l]=void 0);return t}function Gc(i){return typeof i=="object"&&i!==null?i:{}}var q_=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],D_=new Set([...q_]);function ze(i,e,t){let n=i.$$.props[e];n!==void 0&&(i.$$.bound[n]=t,t(i.$$.ctx[n]))}function q(i){i&&i.c()}function V(i,e,t){let{fragment:n,after_update:o}=i.$$;n&&n.m(e,t),Yn(()=>{let r=i.$$.on_mount.map(gs).filter(Ai);i.$$.on_destroy?i.$$.on_destroy.push(...r):nt(r),i.$$.on_mount=[]}),o.forEach(Yn)}function R(i,e){let t=i.$$;t.fragment!==null&&(jc(t.after_update),nt(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function O_(i,e){i.$$.dirty[0]===-1&&(Ao.push(i),ks(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<<e%31}function j(i,e,t,n,o,r,l=null,a=[-1]){let s=mo;no(i);let u=i.$$={fragment:null,ctx:[],props:r,update:Se,not_equal:o,bound:Yl(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(s?s.$$.context:[])),callbacks:Yl(),dirty:a,skip_bound:!1,root:e.target||s.$$.root};l&&l(u.root);let f=!1;if(u.ctx=t?t(i,e.props||{},(m,h,...w)=>{let g=w.length?w[0]:h;return u.ctx&&o(u.ctx[m],u.ctx[m]=g)&&(!u.skip_bound&&u.bound[m]&&u.bound[m](g),f&&O_(i,m)),h}):[],u.update(),f=!0,nt(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){Oc();let m=zc(e.target);u.fragment&&u.fragment.l(m),m.forEach(k)}else u.fragment&&u.fragment.c();e.intro&&d(i.$$.fragment),V(i,e.target,e.anchor),Fc(),Jl()}no(s)}var F_;typeof HTMLElement=="function"&&(F_=class extends HTMLElement{constructor(e,t,n){super();zi(this,"$$ctor");zi(this,"$$s");zi(this,"$$c");zi(this,"$$cn",!1);zi(this,"$$d",{});zi(this,"$$r",!1);zi(this,"$$p_d",{});zi(this,"$$l",{});zi(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=t,n&&this.attachShadow({mode:"open"})}addEventListener(e,t,n){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){let o=this.$$c.$on(e,t);this.$$l_u.set(t,o)}super.addEventListener(e,t,n)}removeEventListener(e,t,n){if(super.removeEventListener(e,t,n),this.$$c){let o=this.$$l_u.get(t);o&&(o(),this.$$l_u.delete(t))}}connectedCallback(){return pt(this,null,function*(){if(this.$$cn=!0,!this.$$c){let t=function(l){return()=>{let a;return{c:function(){a=T("slot"),l!=="default"&&c(a,"name",l)},m:function(f,m){S(f,a,m)},d:function(f){f&&k(a)}}}};var e=t;if(yield Promise.resolve(),!this.$$cn||this.$$c)return;let n={},o=Uc(this);for(let l of this.$$s)l in o&&(n[l]=[t(l)]);for(let l of this.attributes){let a=this.$$g_p(l.name);a in this.$$d||(this.$$d[a]=Cs(a,l.value,this.$$p_d,"toProp"))}for(let l in this.$$p_d)!(l in this.$$d)&&this[l]!==void 0&&(this.$$d[l]=this[l],delete this[l]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:Vt(lt({},this.$$d),{$$slots:n,$$scope:{ctx:[]}})});let r=()=>{this.$$r=!0;for(let l in this.$$p_d)if(this.$$d[l]=this.$$c.$$.ctx[this.$$c.$$.props[l]],this.$$p_d[l].reflect){let a=Cs(l,this.$$d[l],this.$$p_d,"toAttribute");a==null?this.removeAttribute(this.$$p_d[l].attribute||l):this.setAttribute(this.$$p_d[l].attribute||l,a)}this.$$r=!1};this.$$c.$$.after_update.push(r),r();for(let l in this.$$l)for(let a of this.$$l[l]){let s=this.$$c.$on(l,a);this.$$l_u.set(a,s)}this.$$l={}}})}attributeChangedCallback(e,t,n){var o;this.$$r||(e=this.$$g_p(e),this.$$d[e]=Cs(e,n,this.$$p_d,"toProp"),(o=this.$$c)==null||o.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function Cs(i,e,t,n){var r;let o=(r=t[i])==null?void 0:r.type;if(e=o==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!t[i])return e;if(n==="toAttribute")switch(o){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e==null?null:e;default:return e}else switch(o){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}var W=class{constructor(){zi(this,"$$");zi(this,"$$set")}$destroy(){R(this,1),this.$destroy=Se}$on(e,t){if(!Ai(t))return Se;let n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{let o=n.indexOf(t);o!==-1&&n.splice(o,1)}}$set(e){this.$$set&&!Bc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};var Qc="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Qc);import"@vkontakte/videoplayer-core";import{noop as Sl,safeStorage as Y6,throttleFn as Z6}from"@vkontakte/videoplayer-shared";import{SeekAction as X6}from"@vkontakte/videoplayer-statistics";import{InterfaceLanguage as H_,fillWithDefault as z_,VideoQuality as U_}from"@vkontakte/videoplayer-shared";var K_={isMobile:void 0,defaultLanguage:H_.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:"vk_video",volumeDefault:1,volumeMinRestore:.05,loaderDelay:500,minSubtitlesFontSize:13,autoSubtitlesTimeout:2e3,allowChangingFullscreenTarget:!0,trafficSavingLimit:U_.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,annotationsInside:!1,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,interactiveTimeIndicator:!0,thumbTimer:!0,hotKeyMapModal:!0,hotKeyHelpers:!0,saveDebugInfoToFile:!1,saveTraceInfoToFile:!1,additionalButtons:!0,contextMenuButton:!0,audioLanguages:!1,saveRate:!1,fullscreenInternalTargetPlayerContainer:!1},controls:{showOnStartupAtAutoplay:!0,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,runtimeTimeout:5e3,slot:void 0,preview:void 0},interactive:{historyMaxLength:100,noInteractionEventTimeout:3e4}},Yc=i=>z_(i,K_),Zc=i=>nl("ui-config",i),zt=()=>ol("ui-config");var Ml="vk_player_debug_panel_opened";var Xc="videoplayer",Jc="videoplayer";var xn={KeyF:"f",KeyK:"k",KeyC:"c",KeyM:"m"},xc=new Set(["ArrowLeft","ArrowRight","KeyL","KeyJ"]),$c=new Set(["Tab","Space","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"]),ef=new Set(["ShiftRight","ShiftLeft"]);var tf=["TIMELINE"],Vl=[...tf,"GRAPH_BUTTON"],Ss=[...tf,"PLAY_BUTTON"],$l=[...Vl,"PLAY_BUTTON"];var Ro=(r=>(r.XS="xs",r.S="s",r.M="m",r.L="l",r.XL="xl",r))(Ro||{}),Bo={xs:0,s:1,m:2,l:3,xl:4};var sl=[];function Un(i,e){return{subscribe:Fe(i,e).subscribe}}function Fe(i,e=Se){let t,n=new Set;function o(a){if(U(i,a)&&(i=a,t)){let s=!sl.length;for(let u of n)u[1](),sl.push(u,i);if(s){for(let u=0;u<sl.length;u+=2)sl[u][0](sl[u+1]);sl.length=0}}}function r(a){o(a(i))}function l(a,s=Se){let u=[a,s];return n.add(u),n.size===1&&(t=e(o,r)||Se),a(i),()=>{n.delete(u),n.size===0&&t&&(t(),t=null)}}return{set:o,update:r,subscribe:l}}function Vi(i,e,t){let n=!Array.isArray(i),o=n?[i]:i;if(!o.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");let r=e.length<2;return Un(t,(l,a)=>{let s=!1,u=[],f=0,m=Se,h=()=>{if(f)return;m();let g=e(n?u[0]:u,l,a);r?l(g):m=Ai(g)?g:Se},w=o.map((g,C)=>Yt(g,v=>{u[C]=v,f&=~(1<<C),s&&h()},()=>{f|=1<<C}));return s=!0,h(),function(){nt(w),m(),s=!1}})}import{assertNonNullable as nf,VERSION as W_}from"@vkontakte/videoplayer-shared";import{VERSION as j_}from"@vkontakte/videoplayer-core";import{VERSION as G_}from"@vkontakte/videoplayer-statistics";var er="prod",al="1.1.44-dev.871d1572.0";var qo=(i,e,t)=>{let n=document.createElement("a");n.href=i,n.download=`${e}.${t}`,n.style.display="none",n.click()};var of=Symbol("storeContext"),lf=Symbol("microStoresContext"),rf=(i,e)=>{nl(of,i),nl(lf,e),er==="dev"&&(window.app={store:i,microStores:e})},st=()=>{let i=ol(of);return nf(i,"Store context is empty!"),i},Kn=()=>{let i=ol(lf);return nf(i,"MicroStores context is empty!"),i},Pt=(i,e)=>Ts(i,i.getValue(),e),Ts=(i,e,t)=>Un(e,n=>{let o=i.subscribe(r=>{n(r),t==null||t(r)});return()=>o.unsubscribe()}),sf=(i,e,t)=>{var E,y,b,P,A,M;let n=i.info,{width:o,height:r}=$e(t.ui.playerSize),l=(y=(E=n.throughputEstimation$.getValue())==null?void 0:E.toFixed(0))!=null?y:0,a=(P=(b=n.rttEstimation$.getValue())==null?void 0:b.toFixed(0))!=null?P:0,s=n.isAutoQualityEnabled$.getValue()?"auto":"manual",u=`${al} (core: ${j_}, stat: ${G_}, shared: ${W_})`,f=$e(t.state.errorLog$),m=f.length?`
7
7
  `+f.map((O,te)=>{var se;let _e=`${te}) Type: ${O.id}
8
8
  `,Z=`Message: ${O.message} (${O.thrown})
9
9
  `,x=`Trace: ${(se=O.thrown)==null?void 0:se.stack}
@@ -50,4 +50,4 @@ var y_=Object.defineProperty,w_=Object.defineProperties;var k_=Object.getOwnProp
50
50
  rgba(0, 0, 0, 0.99) 93.33%,
51
51
  #000 100%
52
52
  );--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;--controls-container-z-index:1;--ads-container-z-index:1;--mobile-settings-menu-z-index:1;--thumb-timer-z-index:2;--debug-panel-z-index:2;--context-menu-z-index:3;--hot-key-helpers-container-z-index:3;--overlay-container-z-index:4;--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)}*{-webkit-tap-highlight-color:transparent}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:var(--overlay-container-z-index)}.out-of-view{position:absolute !important;left:-1000vh !important}`)}function x6(i){let e,t,n;function o(l){i[61](l)}let r={store:i[0],uiConfig:i[35],title:i[1],thumbUrl:i[2],interactiveContainer:i[3],live:i[4],autoplay:i[5],canRewindLive:i[6],showAds:i[7],adsSlotId:i[8],adsParams:i[9],adsPreviewParam:i[10],duration:i[11],logoClickable:i[12],logoHidden:i[13],logoTargetUrl:i[36],showNextPrevButtons:i[15],nextButtonActive:i[16],prevButtonActive:i[17],endScreenVideoTitle:i[18],endScreenVideoThumb:i[19],isOneVideoPlaylist:i[20],supportLink:i[21],shadowRootContainer:i[22],outerContainerRef:i[23],fullScreenTarget:i[24],showMiniTimer:i[25],playerStarted:i[34],playNextVideo:i[26],playPrevVideo:i[27],repeatPlaylist:i[28],seekToInteractive:i[29],toggleGraph:i[30],playPrevChapter:i[31],firstStart:i[38]};return i[33]!==void 0&&(r.videoContainer=i[33]),e=new pp({props:r}),ge.push(()=>ze(e,"videoContainer",o)),{c(){q(e.$$.fragment)},m(l,a){V(e,l,a),n=!0},p(l,a){let s={};a[0]&1&&(s.store=l[0]),a[0]&2&&(s.title=l[1]),a[0]&4&&(s.thumbUrl=l[2]),a[0]&8&&(s.interactiveContainer=l[3]),a[0]&16&&(s.live=l[4]),a[0]&32&&(s.autoplay=l[5]),a[0]&64&&(s.canRewindLive=l[6]),a[0]&128&&(s.showAds=l[7]),a[0]&256&&(s.adsSlotId=l[8]),a[0]&512&&(s.adsParams=l[9]),a[0]&1024&&(s.adsPreviewParam=l[10]),a[0]&2048&&(s.duration=l[11]),a[0]&4096&&(s.logoClickable=l[12]),a[0]&8192&&(s.logoHidden=l[13]),a[0]&32768&&(s.showNextPrevButtons=l[15]),a[0]&65536&&(s.nextButtonActive=l[16]),a[0]&131072&&(s.prevButtonActive=l[17]),a[0]&262144&&(s.endScreenVideoTitle=l[18]),a[0]&524288&&(s.endScreenVideoThumb=l[19]),a[0]&1048576&&(s.isOneVideoPlaylist=l[20]),a[0]&2097152&&(s.supportLink=l[21]),a[0]&4194304&&(s.shadowRootContainer=l[22]),a[0]&8388608&&(s.outerContainerRef=l[23]),a[0]&16777216&&(s.fullScreenTarget=l[24]),a[0]&33554432&&(s.showMiniTimer=l[25]),a[1]&8&&(s.playerStarted=l[34]),a[0]&67108864&&(s.playNextVideo=l[26]),a[0]&134217728&&(s.playPrevVideo=l[27]),a[0]&268435456&&(s.repeatPlaylist=l[28]),a[0]&536870912&&(s.seekToInteractive=l[29]),a[0]&1073741824&&(s.toggleGraph=l[30]),a[1]&1&&(s.playPrevChapter=l[31]),!t&&a[1]&4&&(t=!0,s.videoContainer=l[33],He(()=>t=!1)),e.$set(s)},i(l){n||(d(e.$$.fragment,l),n=!0)},o(l){_(e.$$.fragment,l),n=!1},d(l){R(e,l)}}}function $6(i){let e,t,n;function o(l){i[60](l)}let r={store:i[0],uiConfig:i[35],thumbUrl:i[2],interactiveContainer:i[3],live:i[4],autoplay:i[5],canRewindLive:i[6],showAds:i[7],adsSlotId:i[8],adsParams:i[9],adsPreviewParam:i[10],duration:i[11],logoClickable:i[12],logoHidden:i[13],logoTargetUrl:i[36],showNextPrevButtons:i[15],nextButtonActive:i[16],prevButtonActive:i[17],endScreenVideoTitle:i[18],endScreenVideoThumb:i[19],isOneVideoPlaylist:i[20],supportLink:i[21],shadowRootContainer:i[22],outerContainerRef:i[23],fullScreenTarget:i[24],showMiniTimer:i[25],playerStarted:i[34],playNextVideo:i[26],playPrevVideo:i[27],repeatPlaylist:i[28],seekToInteractive:i[29],toggleGraph:i[30],playPrevChapter:i[31],firstStart:i[38],seekTime:i[32]};return i[33]!==void 0&&(r.videoContainer=i[33]),e=new Rp({props:r}),ge.push(()=>ze(e,"videoContainer",o)),{c(){q(e.$$.fragment)},m(l,a){V(e,l,a),n=!0},p(l,a){let s={};a[0]&1&&(s.store=l[0]),a[0]&4&&(s.thumbUrl=l[2]),a[0]&8&&(s.interactiveContainer=l[3]),a[0]&16&&(s.live=l[4]),a[0]&32&&(s.autoplay=l[5]),a[0]&64&&(s.canRewindLive=l[6]),a[0]&128&&(s.showAds=l[7]),a[0]&256&&(s.adsSlotId=l[8]),a[0]&512&&(s.adsParams=l[9]),a[0]&1024&&(s.adsPreviewParam=l[10]),a[0]&2048&&(s.duration=l[11]),a[0]&4096&&(s.logoClickable=l[12]),a[0]&8192&&(s.logoHidden=l[13]),a[0]&32768&&(s.showNextPrevButtons=l[15]),a[0]&65536&&(s.nextButtonActive=l[16]),a[0]&131072&&(s.prevButtonActive=l[17]),a[0]&262144&&(s.endScreenVideoTitle=l[18]),a[0]&524288&&(s.endScreenVideoThumb=l[19]),a[0]&1048576&&(s.isOneVideoPlaylist=l[20]),a[0]&2097152&&(s.supportLink=l[21]),a[0]&4194304&&(s.shadowRootContainer=l[22]),a[0]&8388608&&(s.outerContainerRef=l[23]),a[0]&16777216&&(s.fullScreenTarget=l[24]),a[0]&33554432&&(s.showMiniTimer=l[25]),a[1]&8&&(s.playerStarted=l[34]),a[0]&67108864&&(s.playNextVideo=l[26]),a[0]&134217728&&(s.playPrevVideo=l[27]),a[0]&268435456&&(s.repeatPlaylist=l[28]),a[0]&536870912&&(s.seekToInteractive=l[29]),a[0]&1073741824&&(s.toggleGraph=l[30]),a[1]&1&&(s.playPrevChapter=l[31]),!t&&a[1]&4&&(t=!0,s.videoContainer=l[33],He(()=>t=!1)),e.$set(s)},i(l){n||(d(e.$$.fragment,l),n=!0)},o(l){_(e.$$.fragment,l),n=!1},d(l){R(e,l)}}}function e8(i){let e,t,n,o,r=[$6,x6],l=[];function a(s,u){return s[14]?0:1}return t=a(i,[-1,-1,-1]),n=l[t]=r[t](i),{c(){e=T("div"),n.c(),c(e,"class","root svelte-1tl3een")},m(s,u){S(s,e,u),l[t].m(e,null),o=!0},p(s,u){let f=t;t=a(s,u),t===f?l[t].p(s,u):(fe(),_(l[f],1,1,()=>{l[f]=null}),de(),n=l[t],n?n.p(s,u):(n=l[t]=r[t](s),n.c()),d(n,1),n.m(e,null))},i(s){o||(d(n),o=!0)},o(s){_(n),o=!1},d(s){s&&k(e),l[t].d()}}}function t8(i,e,t){let n,{sources:o}=e,{store:r}=e,{microStoresRoot:l}=e,{videoConfig:a}=e,{uiConfig:s}=e,{title:u}=e,{thumbUrl:f}=e,{interactiveContainer:m}=e,{subtitles:h}=e,{live:w}=e,{preload:g}=e,{autoplay:C}=e,{volume:v=void 0}=e,{muted:E=void 0}=e,{fromTime:y}=e,{canRewindLive:b}=e,{showAds:P}=e,{adsSlotId:A=void 0}=e,{adsParams:M=void 0}=e,{adsPreviewParam:O=void 0}=e,{duration:te=void 0}=e,{logoClickable:_e}=e,{logoHidden:Z}=e,{isMobile:x}=e,{showNextPrevButtons:se=!1}=e,{nextButtonActive:L=!1}=e,{prevButtonActive:K=!1}=e,{endScreenVideoTitle:J=void 0}=e,{endScreenVideoThumb:Y=void 0}=e,{isOneVideoPlaylist:F=!1}=e,{supportLink:G}=e,{shadowRootContainer:X=void 0}=e,{outerContainerRef:le=void 0}=e,{fullScreenTarget:qe=void 0}=e,{failoverHosts:Xe=void 0}=e,{showMiniTimer:Ee=!1}=e,{saveRate:Be}=e,{playNextVideo:De=Sl}=e,{playPrevVideo:xe=Sl}=e,{repeatPlaylist:ae=Sl}=e,{seekToInteractive:he=Sl}=e,{toggleGraph:ut=Sl}=e,{playPrevChapter:Ce=Sl}=e,{volumeMultiplier:Ke}=e,{subscribers:_t,stores:Ye}=l;Zc(s);let Ge=zt(),Ze=s.logoLink,et=r.ui.debugPanelVisible,ce=r.ui.playerSize,Pe=r.state.isLive$;H(i,Pe,be=>t(63,n=be));let We,re=null,Te=!1;r.getAdmanWrapper().init({switchFromAdsToVideo:r.actions.internal.switchFromAdsToVideo,switchFromVideoToAds:r.actions.internal.switchFromVideoToAds,setMuted:r.actions.external.setMuted},r.ads,{isMobile:r.ui.isMobile,mobileUnmuteButtonVisible:r.ui.mobileUnmuteButtonVisible,vsid:r.vsid}),rf(r,Ye);let ht=(be=!1)=>{t(34,Te=!0),be?r.actions.external.firstStart(P):r.actions.internal.firstStart(P)};function Le(be){var pi;let Je=o||be;Je&&r.initVideo({container:We,sources:Je,failoverHosts:Xe,subtitles:h,volumeMultiplier:Ke});let gt=Y6.get(Ml)==="true";et.set(gt),y>0&&r.actions.external.seekTime(y);let Ht=x?Ge.volumeDefault:(pi=v!=null?v:tr())!=null?pi:Ge.volumeDefault,wt=E!=null?E:yf();if(r.actions.external.setVolume(Ht),r.actions.external.setMuted(wt),r.getAdmanWrapper().setInitialVolume(wt?0:Ht),Ge.features.trafficSaving){let Mt=kf();Mt&&r.actions.internal.setTrafficSavingEnabled(Mt)}if(Ge.features.saveRate&&Be){let Mt=Tf();Mt&&!n&&r.actions.internal.setPlaybackRate(Mt)}let Jt=gf(r.videoId);Jt&&r.actions.internal.setQuality(Jt),r.ui.isAutoplay.set(C),C?ht():g&&Ge.features.preload&&r.actions.internal.preload()}let ct=be=>{if(window.ResizeObserver){let Je,gt;re=new ResizeObserver(Z6(Ht=>{let wt=Ht[0];if(wt){if(wt.contentBoxSize){let Jt=Array.isArray(wt.contentBoxSize)?wt.contentBoxSize[0]:wt.contentBoxSize;Je=Jt.inlineSize,gt=Jt.blockSize}else wt.contentRect&&(Je=wt.contentRect.width,gt=wt.contentRect.height);ce.set({width:Je,height:gt})}},300)),re.observe(be)}ce.set({width:be.clientWidth,height:be.clientHeight})};Dt(()=>{ct(We);let be=_t.map(gt=>gt.init({store:r,microStores:Ye,config:a}));if((w==null?void 0:w.status)==="upcoming"){r.actions.internal.setLiveWaitingStart(!0);return}if((w==null?void 0:w.status)==="waiting"){r.actions.internal.setLiveWaitingRecover(!0);return}if(((w==null?void 0:w.status)==="finished"||(w==null?void 0:w.status)==="postlive")&&!Object.keys(o||[]).length){r.actions.internal.setLiveWaitingRecord(!0);return}return Le(),()=>{re==null||re.disconnect(),be.forEach(gt=>gt.unsubscribe()),r.destroy()}});function me(){Te?r.actions.external.play():ht(!0)}function tt(){r.actions.external.pause()}function St(be){x||r.actions.external.setMuted(be)}function vt(be){x||be>=0&&be<=1&&r.actions.external.setVolume(be)}function Ue(be){r.actions.internal.seekTime(be,X6.UNKNOWN)}function Ft(be){r.actions.external.seekEpisodeStartTime(be)}function Rt(){r.actions.external.returnFocusToEpisodes()}function Tt(be){r.actions.external.setPlaybackRate(be)}function oi(be){r.actions.external.setAutoQualityLimits(be)}function ft(be){We=be,t(33,We)}function rt(be){We=be,t(33,We)}return i.$$set=be=>{"sources"in be&&t(39,o=be.sources),"store"in be&&t(0,r=be.store),"microStoresRoot"in be&&t(40,l=be.microStoresRoot),"videoConfig"in be&&t(41,a=be.videoConfig),"uiConfig"in be&&t(42,s=be.uiConfig),"title"in be&&t(1,u=be.title),"thumbUrl"in be&&t(2,f=be.thumbUrl),"interactiveContainer"in be&&t(3,m=be.interactiveContainer),"subtitles"in be&&t(43,h=be.subtitles),"live"in be&&t(4,w=be.live),"preload"in be&&t(44,g=be.preload),"autoplay"in be&&t(5,C=be.autoplay),"volume"in be&&t(45,v=be.volume),"muted"in be&&t(46,E=be.muted),"fromTime"in be&&t(47,y=be.fromTime),"canRewindLive"in be&&t(6,b=be.canRewindLive),"showAds"in be&&t(7,P=be.showAds),"adsSlotId"in be&&t(8,A=be.adsSlotId),"adsParams"in be&&t(9,M=be.adsParams),"adsPreviewParam"in be&&t(10,O=be.adsPreviewParam),"duration"in be&&t(11,te=be.duration),"logoClickable"in be&&t(12,_e=be.logoClickable),"logoHidden"in be&&t(13,Z=be.logoHidden),"isMobile"in be&&t(14,x=be.isMobile),"showNextPrevButtons"in be&&t(15,se=be.showNextPrevButtons),"nextButtonActive"in be&&t(16,L=be.nextButtonActive),"prevButtonActive"in be&&t(17,K=be.prevButtonActive),"endScreenVideoTitle"in be&&t(18,J=be.endScreenVideoTitle),"endScreenVideoThumb"in be&&t(19,Y=be.endScreenVideoThumb),"isOneVideoPlaylist"in be&&t(20,F=be.isOneVideoPlaylist),"supportLink"in be&&t(21,G=be.supportLink),"shadowRootContainer"in be&&t(22,X=be.shadowRootContainer),"outerContainerRef"in be&&t(23,le=be.outerContainerRef),"fullScreenTarget"in be&&t(24,qe=be.fullScreenTarget),"failoverHosts"in be&&t(48,Xe=be.failoverHosts),"showMiniTimer"in be&&t(25,Ee=be.showMiniTimer),"saveRate"in be&&t(49,Be=be.saveRate),"playNextVideo"in be&&t(26,De=be.playNextVideo),"playPrevVideo"in be&&t(27,xe=be.playPrevVideo),"repeatPlaylist"in be&&t(28,ae=be.repeatPlaylist),"seekToInteractive"in be&&t(29,he=be.seekToInteractive),"toggleGraph"in be&&t(30,ut=be.toggleGraph),"playPrevChapter"in be&&t(31,Ce=be.playPrevChapter),"volumeMultiplier"in be&&t(50,Ke=be.volumeMultiplier)},i.$$.update=()=>{i.$$.dirty[0]&16385&&r.ui.isMobile.set(x)},[r,u,f,m,w,C,b,P,A,M,O,te,_e,Z,x,se,L,K,J,Y,F,G,X,le,qe,Ee,De,xe,ae,he,ut,Ce,Ue,We,Te,Ge,Ze,Pe,ht,o,l,a,s,h,g,v,E,y,Xe,Be,Ke,Le,me,tt,St,vt,Ft,Rt,Tt,oi,ft,rt]}var kc=class extends W{constructor(e){super(),j(this,e,t8,e8,U,{sources:39,store:0,microStoresRoot:40,videoConfig:41,uiConfig:42,title:1,thumbUrl:2,interactiveContainer:3,subtitles:43,live:4,preload:44,autoplay:5,volume:45,muted:46,fromTime:47,canRewindLive:6,showAds:7,adsSlotId:8,adsParams:9,adsPreviewParam:10,duration:11,logoClickable:12,logoHidden:13,isMobile:14,showNextPrevButtons:15,nextButtonActive:16,prevButtonActive:17,endScreenVideoTitle:18,endScreenVideoThumb:19,isOneVideoPlaylist:20,supportLink:21,shadowRootContainer:22,outerContainerRef:23,fullScreenTarget:24,failoverHosts:48,showMiniTimer:25,saveRate:49,playNextVideo:26,playPrevVideo:27,repeatPlaylist:28,seekToInteractive:29,toggleGraph:30,playPrevChapter:31,volumeMultiplier:50,initVideo:51,play:52,pause:53,setMuted:54,setVolume:55,seekTime:32,seekEpisodeStartTime:56,returnFocusToEpisodes:57,setPlaybackRate:58,setAutoQualityLimits:59},J6,[-1,-1,-1])}get initVideo(){return this.$$.ctx[51]}get play(){return this.$$.ctx[52]}get pause(){return this.$$.ctx[53]}get setMuted(){return this.$$.ctx[54]}get setVolume(){return this.$$.ctx[55]}get seekTime(){return this.$$.ctx[32]}get seekEpisodeStartTime(){return this.$$.ctx[56]}get returnFocusToEpisodes(){return this.$$.ctx[57]}get setPlaybackRate(){return this.$$.ctx[58]}get setAutoQualityLimits(){return this.$$.ctx[59]}},Bp=kc;function i8(i){let e,t,n,o=i[2].default,r=Ae(o,i,i[1],null),l=[{xmlns:"http://www.w3.org/2000/svg"},{width:"57"},{height:"60"},{fill:"none"},{"aria-hidden":"true"},{"data-testid":"stub-icon"},{role:"img"},i[0]],a={};for(let s=0;s<l.length;s+=1)a=ue(a,l[s]);return{c(){e=D("svg"),r&&r.c(),t=D("path"),c(t,"fill","currentColor"),c(t,"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 6zm.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.9.9 0 0 1 .377.378c.088.163.134.324.134.77v1.436c0 .446-.046.607-.134.77a.9.9 0 0 1-.378.378c-.162.088-.324.134-.77.134h-1.436c-.446 0-.608-.046-.77-.134a.9.9 0 0 1-.378-.378c-.088-.163-.134-.324-.134-.77v-1.436c0-.446.046-.607.134-.77a.9.9 0 0 1 .378-.378c.162-.088.324-.134.77-.134h1.436zm20 0c.445 0 .606.046.77.134a.9.9 0 0 1 .377.378c.088.163.134.324.134.77v1.436c0 .446-.046.607-.134.77a.9.9 0 0 1-.378.378c-.163.088-.324.134-.77.134h-1.436c-.446 0-.607-.046-.77-.134a.9.9 0 0 1-.378-.378c-.088-.163-.134-.324-.134-.77v-1.436c0-.446.046-.607.134-.77a.9.9 0 0 1 .378-.378c.163-.088.324-.134.77-.134zm-20-8c.445 0 .607.046.77.134a.9.9 0 0 1 .377.378c.088.162.134.324.134.77v1.436c0 .446-.046.607-.134.77a.9.9 0 0 1-.378.378c-.162.088-.324.134-.77.134h-1.436c-.446 0-.608-.046-.77-.134a.9.9 0 0 1-.378-.378c-.088-.163-.134-.324-.134-.77v-1.436c0-.446.046-.608.134-.77a.9.9 0 0 1 .378-.378c.162-.088.324-.134.77-.134h1.436zm20 0c.445 0 .606.046.77.134a.9.9 0 0 1 .377.378c.088.162.134.324.134.77v1.436c0 .446-.046.607-.134.77a.9.9 0 0 1-.378.378c-.163.088-.324.134-.77.134h-1.436c-.446 0-.607-.046-.77-.134a.9.9 0 0 1-.378-.378c-.088-.163-.134-.324-.134-.77v-1.436c0-.446.046-.608.134-.77a.9.9 0 0 1 .378-.378c.163-.088.324-.134.77-.134zm-20-8c.445 0 .607.046.77.134a.9.9 0 0 1 .377.378c.088.162.134.324.134.77v1.436c0 .446-.046.608-.134.77a.9.9 0 0 1-.378.378c-.162.088-.324.134-.77.134h-1.436c-.446 0-.608-.046-.77-.134a.9.9 0 0 1-.378-.378c-.088-.162-.134-.324-.134-.77v-1.436c0-.446.046-.608.134-.77a.9.9 0 0 1 .378-.378c.162-.088.324-.134.77-.134h1.436zm20 0c.445 0 .606.046.77.134a.9.9 0 0 1 .377.378c.088.162.134.324.134.77v1.436c0 .446-.046.608-.134.77a.9.9 0 0 1-.378.378c-.163.088-.324.134-.77.134h-1.436c-.446 0-.607-.046-.77-.134a.9.9 0 0 1-.378-.378c-.088-.162-.134-.324-.134-.77v-1.436c0-.446.046-.608.134-.77a.9.9 0 0 1 .378-.378c.163-.088.324-.134.77-.134zm-20-8c.445 0 .607.046.77.134a.9.9 0 0 1 .377.378c.088.162.134.324.134.77v1.436c0 .446-.046.608-.134.77a.9.9 0 0 1-.378.378c-.162.088-.324.134-.77.134h-1.436c-.446 0-.608-.046-.77-.134a.9.9 0 0 1-.378-.378c-.088-.162-.134-.324-.134-.77v-1.436c0-.446.046-.607.134-.77a.9.9 0 0 1 .378-.378c.162-.088.324-.134.77-.134h1.436zm20 0c.445 0 .606.046.77.134a.9.9 0 0 1 .377.378c.088.162.134.324.134.77v1.436c0 .446-.046.608-.134.77a.9.9 0 0 1-.378.378c-.163.088-.324.134-.77.134h-1.436c-.446 0-.607-.046-.77-.134a.9.9 0 0 1-.378-.378c-.088-.162-.134-.324-.134-.77v-1.436c0-.446.046-.607.134-.77a.9.9 0 0 1 .378-.378c.163-.088.324-.134.77-.134z"),we(e,a)},m(s,u){S(s,e,u),r&&r.m(e,null),p(e,t),n=!0},p(s,[u]){r&&r.p&&(!n||u&2)&&Ve(r,o,s,s[1],n?Me(o,s[1],u,null):Re(s[1]),null),we(e,a=Oe(l,[{xmlns:"http://www.w3.org/2000/svg"},{width:"57"},{height:"60"},{fill:"none"},{"aria-hidden":"true"},{"data-testid":"stub-icon"},{role:"img"},u&1&&s[0]]))},i(s){n||(d(r,s),n=!0)},o(s){_(r,s),n=!1},d(s){s&&k(e),r&&r.d(s)}}}function n8(i,e,t){let{$$slots:n={},$$scope:o}=e;return i.$$set=r=>{t(0,e=ue(ue({},e),ye(r))),"$$scope"in r&&t(1,o=r.$$scope)},e=ye(e),[e,o,n]}var Cc=class extends W{constructor(e){super(),j(this,e,n8,i8,U,{})}},qp=Cc;function o8(i){let e,t;return e=new qp({props:{style:i[0]}}),{c(){q(e.$$.fragment)},m(n,o){V(e,n,o),t=!0},p(n,[o]){let r={};o&1&&(r.style=n[0]),e.$set(r)},i(n){t||(d(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){R(e,n)}}}function l8(i,e,t){let n,{isWhite:o=!1}=e;return i.$$set=r=>{"isWhite"in r&&t(1,o=r.isWhite)},i.$$.update=()=>{i.$$.dirty&2&&t(0,n=o?"color: #fff;":"color: #909499;")},[n,o]}var Sc=class extends W{constructor(e){super(),j(this,e,l8,o8,U,{isWhite:1})}},Dp=Sc;function r8(i){Ie(i,"svelte-1y9fytq",".playerStub.svelte-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.svelte-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 Np(i){let e,t;return{c(){e=T("div"),t=Ne(i[0]),c(e,"class","title svelte-1y9fytq")},m(n,o){S(n,e,o),p(e,t)},p(n,o){o&1&&Qe(t,n[0])},d(n){n&&k(e)}}}function Op(i){let e,t;return e=new Dp({props:{isWhite:!!i[1]}}),{c(){q(e.$$.fragment)},m(n,o){V(e,n,o),t=!0},p(n,o){let r={};o&2&&(r.isWhite=!!n[1]),e.$set(r)},i(n){t||(d(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){R(e,n)}}}function s8(i){let e,t,n,o,r=i[0]&&Np(i),l=(!i[0]||!i[1])&&Op(i);return{c(){e=T("div"),r&&r.c(),t=B(),l&&l.c(),c(e,"class","playerStub svelte-1y9fytq"),c(e,"style",n=i[1]?`background-image: url('${i[1]}')`:"")},m(a,s){S(a,e,s),r&&r.m(e,null),p(e,t),l&&l.m(e,null),o=!0},p(a,[s]){a[0]?r?r.p(a,s):(r=Np(a),r.c(),r.m(e,t)):r&&(r.d(1),r=null),!a[0]||!a[1]?l?(l.p(a,s),s&3&&d(l,1)):(l=Op(a),l.c(),d(l,1),l.m(e,null)):l&&(fe(),_(l,1,1,()=>{l=null}),de()),(!o||s&2&&n!==(n=a[1]?`background-image: url('${a[1]}')`:""))&&c(e,"style",n)},i(a){o||(d(l),o=!0)},o(a){_(l),o=!1},d(a){a&&k(e),r&&r.d(),l&&l.d()}}}function a8(i,e,t){let{title:n}=e,{thumbUrl:o}=e;return i.$$set=r=>{"title"in r&&t(0,n=r.title),"thumbUrl"in r&&t(1,o=r.thumbUrl)},[n,o]}var Tc=class extends W{constructor(e){super(),j(this,e,a8,s8,U,{title:0,thumbUrl:1},r8)}},Fp=Tc;import{cloneDeepWith as I8,InterfaceLanguage as E8,clientChecker as L8,isMobile as A8,isNonNullable as Ac,Logger as M8,Subscription as V8}from"@vkontakte/videoplayer-shared";import"@vkontakte/videoplayer-core";import{OneStat as R8}from"@vkontakte/videoplayer-statistics";import{Subscription as u8}from"@vkontakte/videoplayer-shared";var us=class{constructor(){this.subscription=new u8}isSupported(){return"mediaSession"in navigator}setMetaData({title:e,artist:t="",thumbUrl:n=""}){this.isSupported()&&(navigator.mediaSession.metadata=new MediaMetadata({title:e,artist:t,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(){let e=[["play",null],["pause",null],["stop",null],["nexttrack",null],["previoustrack",null],["seekto",t=>null],["seekbackward",t=>null],["seekforward",t=>null]];this.setActionHandlers(e)}setActionHandlers(e){if(this.isSupported())for(let[t,n]of e)try{navigator.mediaSession.setActionHandler(t,n)}catch(o){throw new Error(`The media session action "${t}" is not supported yet.`)}}attachToStore(e){!this.isSupported()||!e||this.subscription.add(e.state.positionExact$.subscribe(t=>{let n=$e(e.state.currentPlaybackRate$),o=$e(e.state.duration$);!isFinite(t)||!isFinite(o)||navigator.mediaSession.setPositionState({position:t,playbackRate:n,duration:o})}))}clearSubscriptions(){this.subscription.unsubscribe()}destroy(){this.resetActionHandlers(),this.clearSubscriptions()}};import{ValueSubject as _8,clientChecker as h8,detectEmbed as g8}from"@vkontakte/videoplayer-shared";function c8(i){let e,t,n,o,r,l=i[2].default,a=Ae(l,i,i[1],null),s=[{xmlns:"http://www.w3.org/2000/svg"},{width:"57"},{height:"56"},{fill:"none"},{"aria-label":"dummy-image"},{"data-testid":"pip-dummy-icon"},{role:"img"},i[0]],u={};for(let f=0;f<s.length;f+=1)u=ue(u,s[f]);return{c(){e=D("svg"),a&&a.c(),t=D("g"),n=D("path"),o=D("path"),c(n,"d","m30.744 4 .744.005c2.981.046 4.526.385 6.127 1.24a8.77 8.77 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.77 5.77 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.77 8.77 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.77 8.77 0 0 1 3.347-3.475l.312-.174.292-.15c1.472-.731 3.016-1.036 5.803-1.08L22.256 4z"),c(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.2z"),c(t,"fill","#fff"),we(e,u)},m(f,m){S(f,e,m),a&&a.m(e,null),p(e,t),p(t,n),p(t,o),r=!0},p(f,[m]){a&&a.p&&(!r||m&2)&&Ve(a,l,f,f[1],r?Me(l,f[1],m,null):Re(f[1]),null),we(e,u=Oe(s,[{xmlns:"http://www.w3.org/2000/svg"},{width:"57"},{height:"56"},{fill:"none"},{"aria-label":"dummy-image"},{"data-testid":"pip-dummy-icon"},{role:"img"},m&1&&f[0]]))},i(f){r||(d(a,f),r=!0)},o(f){_(a,f),r=!1},d(f){f&&k(e),a&&a.d(f)}}}function f8(i,e,t){let{$$slots:n={},$$scope:o}=e;return i.$$set=r=>{t(0,e=ue(ue({},e),ye(r))),"$$scope"in r&&t(1,o=r.$$scope)},e=ye(e),[e,o,n]}var Pc=class extends W{constructor(e){super(),j(this,e,f8,c8,U,{})}},Hp=Pc;function d8(i){Ie(i,"svelte-1pbsod4",".player-pip-dummy.svelte-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.svelte-1pbsod4{position:relative}.dummy-image.svelte-1pbsod4 svg{transform:scale(1.07143)}.dummy-image.desktop.svelte-1pbsod4{transform:scale(1.07143) rotate(-90deg) rotateY(180deg)}.title.svelte-1pbsod4{font-size:16px;color:#fff;padding:18px 20px 10px;text-align:center}")}function m8(i){let e,t,n,o,r,l,a;return n=new Hp({}),{c(){e=T("div"),t=T("div"),q(n.$$.fragment),o=B(),r=T("span"),l=Ne(i[0]),c(t,"class","dummy-image svelte-1pbsod4"),N(t,"desktop",!i[1]),c(r,"class","title svelte-1pbsod4"),c(e,"class","player-pip-dummy svelte-1pbsod4"),N(e,"is-pip-api",i[2])},m(s,u){S(s,e,u),p(e,t),V(n,t,null),p(e,o),p(e,r),p(r,l),a=!0},p(s,[u]){(!a||u&2)&&N(t,"desktop",!s[1]),(!a||u&1)&&Qe(l,s[0])},i(s){a||(d(n.$$.fragment,s),a=!0)},o(s){_(n.$$.fragment,s),a=!1},d(s){s&&k(e),R(n)}}}function p8(i,e,t){let n,o,r=st(),l=!!r.webApi.pictureInPictureApi,a=r.interfaceLanguage$;H(i,a,f=>t(5,n=f));let s=r.ui.isMobile;H(i,s,f=>t(1,o=f));let u;return i.$$.update=()=>{i.$$.dirty&32&&t(0,u=n&&z("pip_dummy_title"))},[u,o,l,a,s,n]}var Ic=class extends W{constructor(e){super(),j(this,e,p8,m8,U,{},d8)}},zp=Ic;var b8=460,v8=280,zl=class{constructor(){this.info={isActive$:new _8(!1),type:1}}isSupported(){let{isEmbed:e}=g8();return"documentPictureInPicture"in window&&!h8.isYandex&&!e}isActive(){return this.isSupported()&&!!documentPictureInPicture.window}setPlayerDomElement(e,t){this.playerDomElement=e,this.playerParentShadowRoot=t}setContext(e){this.svelteContext=e}request(){return pt(this,null,function*(){var r,l;if(!this.isSupported()||!this.playerDomElement||!this.playerParentShadowRoot)return;this.pipWindow=yield documentPictureInPicture.requestWindow({width:b8,height:v8,copyStyleSheets:!0}),this.pipWindow.document.body.style.margin="0";let e=[...this.playerParentShadowRoot.styleSheets].map(a=>[...a.cssRules].map(s=>s.cssText).join(" ")).filter(Boolean).join(`
53
- `),t=document.createElement("style");t.textContent=e;let n=this.createStretchedContainer(),o=n.attachShadow({mode:"open"});o.append(t),o.append(this.playerDomElement),this.playerDummyElement=new zp({target:this.playerParentShadowRoot,context:this.svelteContext}),(r=this.pipWindow)==null||r.document.body.append(n),this.info.isActive$.next(!0),(l=this.pipWindow)==null||l.addEventListener("unload",a=>{!this.playerDomElement||!this.playerParentShadowRoot||!this.playerDummyElement||(this.playerDummyElement.$destroy(),this.playerParentShadowRoot.append(this.playerDomElement),this.info.isActive$.next(!1))})})}remove(){return pt(this,null,function*(){return new Promise(e=>{var t;(t=documentPictureInPicture.window)==null||t.close(),e()})})}dispose(){return pt(this,null,function*(){yield this.remove()})}createStretchedContainer(){let e=document.createElement("div");return e.style.width="100%",e.style.height="100%",e}};function Up(i){return i instanceof zl}var cs=class{static getLatestSupportedVersion(){let e=new No,t=new zl;if(t.isSupported())return t;if(e.isSupported())return e}};function fs(i,e){var o,r;let t=new Set([...Object.keys(i),...Object.keys(e)]),n={};for(let l of t)n[l]=(r=(o=e[l])!=null?o:i[l])!=null?r:void 0;return n}var Kp="Inner error. Unexpectedly root annotation container null reference exception",Wp="Annotation with such name already exists",jp="Annotation with such name does not exist";var Tl=class extends Error{constructor(e){super(e),this.name="AnnotationError"}};import{observeElementSize as y8,Subscription as w8,throttleFn as k8}from"@vkontakte/videoplayer-shared";var C8="1",S8=100,ds=class{constructor(){this.annotations=new Map;this.subscriptions=new w8}init(e){this.rootAnnotationsContainer=e;let t=k8(()=>{for(let n of this.annotations.values())this.isElementExceedsBoundaries(n,this.playerSize.width,this.playerSize.height)?n.style.visibility="hidden":n.style.visibility="visible"},S8);this.subscriptions.add(y8(this.rootAnnotationsContainer).subscribe(({width:n,height:o})=>{this.playerSize={width:n,height:o},t()})),this.mutationObserver=new MutationObserver(t),this.mutationObserver.observe(this.rootAnnotationsContainer,{attributes:!0,childList:!0,subtree:!0,characterData:!0})}add(e,t){var n;if(!this.rootAnnotationsContainer)throw new Tl(Kp);if(this.annotations.has(e))throw new Tl(Wp);t.style.zIndex=(n=t.style.zIndex)!=null?n:C8,t.style.position="absolute",this.rootAnnotationsContainer.append(t),this.annotations.set(e,t)}get(e){let t=this.annotations.get(e);if(!t)throw new Tl(jp);return t}remove(e){let t=this.get(e);this.annotations.delete(e)&&t.remove()}clear(){for(let e in this.annotations.keys())this.remove(e)}destroy(){this.annotations.clear(),this.subscriptions.unsubscribe(),this.mutationObserver.disconnect(),this.rootAnnotationsContainer=null}isElementExceedsBoundaries(e,t,n){let o=e.offsetTop,r=e.offsetLeft,l=e.offsetWidth,a=e.offsetHeight;return o<0||r<0||r+l>t||o+a>n}registryRootContainer(e){}addLayer(e){return document.createElement("div")}getLayer(e){}removeLayer(e){}clearLayer(e){}detach(){}reattach(){}};import{assertNonNullable as Ec,Subscription as T8}from"@vkontakte/videoplayer-shared";var $n=class{init({store:e,microStores:t,config:n}){return Ec(e),Ec(t),Ec(n),this.subscription=new T8,this.subscription}};var Ul=class extends $n{constructor(){super(...arguments);this.stateName="fakeIsPlaying$";this.state$=Vt(lt({},Fe(null)),{toggle:()=>this.state$.update(t=>!t)})}init(t){let n=super.init(t),{isInteractiveExpectation$:o}=t.store.state;return n.add(o.subscribe(r=>{this.state$.set(r?!0:null)})),n}};var Kl=class extends $n{constructor(){super(...arguments);this.stateName="interactiveControlsOpacity$";this.state$=Vt(lt({},Fe(null)),{toggle:()=>this.state$.update(t=>!t)})}init(t){let n=super.init(t),{microStores:o,store:r}=t,{fakeIsPlaying$:l}=o,{isInteractiveExpectation$:a,isPlaying$:s}=r.state,{controlsVisible:u,isMobile:f}=r.ui,m=$e(f),h=()=>m&&$e(u);return n.add(u.subscribe(w=>{if(!m)return;let g=$e(l);$e(s)?this.state$.set(w):g!==null&&this.state$.set(!g||w)})),n.add(s.subscribe(w=>{this.state$.set(!w||h())})),n.add(l.subscribe(w=>{if(w===null)return;let g=$e(a);if(h()){this.state$.set(!0);return}g&&this.state$.set(!w)})),n}};var Wl=class extends $n{constructor(){super(...arguments);this.stateName="seekToInteractiveDisabledTooltip$";this.state$=Fe("tooltip_chapter_without_interactive")}init(t){let n=super.init(t),{store:o}=t;return n.add(o.state.interactiveEpisodes$.subscribe(r=>{r.length&&(r.every(l=>l.completed)?this.state$.set("tooltip_interactive_of_chapter_completed"):this.state$.set("tooltip_disabled_when_interactive"))})),n}};import{combine as P8}from"@vkontakte/videoplayer-shared";var Lc=Fe(!1),ms=null,jl=class extends $n{constructor(){super(...arguments);this.stateName="showInteractiveTimeIndicatorTooltip$";this.state$=Vt(lt({},Lc),{set:(t,n=!1)=>{t!==$e(Lc)&&(this.clearTimeout(),Lc.set(t),!t&&ms&&(ms=!1),t&&n&&(this.timeout=setTimeout(()=>{this.state$.set(!1)},3e3)))},clearTimeout:()=>this.clearTimeout()})}init(t){let n=super.init(t),{store:o,config:r}=t,{isInteractiveTime$:l,isPlaying$:a}=o.state,s=o.ui.controlsVisible,{interactiveTimeIndicator:u}=o.ui.controls;n.add(s.subscribe(m=>{$e(l)&&m&&this.state$.set(!1)}));let f=(r==null?void 0:r.interactiveData)||{tooltipHelpHintActive:!1};return n.add(P8({isPlaying$:a,isInteractiveTime$:l,interactiveTimeIndicator:u}).subscribe(({isPlaying$:m,isInteractiveTime$:h,interactiveTimeIndicator:w})=>{var g,C;if(!(!m||!(w!=null&&w.isDisplayed))){if(!h)return this.state$.set(!1);f.tooltipHelpHintActive&&ms===null&&(ms=!0,f.tooltipHelpHintActive=!1,this.state$.set(!0),(C=(g=o.callbacks)==null?void 0:g.onInteractiveTimeIndicatorHintDeactivated)==null||C.call(g))}})),n}clearTimeout(){window.clearTimeout(this.timeout)}};var Gp=()=>[Ul,Kl,Wl,jl].reduce(({subscribers:i,stores:e},t)=>{let n=new t;return{subscribers:[...i,n],stores:Vt(lt({},e),{[n.stateName]:n.state$})}},{subscribers:[],stores:{}});var B8={preload:!0,autoplay:!1,repeat:!1,fromTime:0,canRewindLive:!0,showAds:!1,interfaceLanguage:E8.RU,isCyrillicRelatedInterface:!0,logoClickable:!1,logoHidden:!1,isMobile:A8(),isMediaSessionEnabled:!0,isPictureInPictureEnabled:!0,isAudioDisabled:!1,callbacks:{uiInfo:{}},tuningConfig:{configName:[]},saveRate:!0,volumeMultiplier:1},ps=class extends HTMLElement{constructor(){var t;super();this.currentPlayingVideoIndex=0;this.needToRepeatPlaylist=!1;this.videoConfig=void 0;this.pictureInPictureApi=void 0;this.mediaSessionApi=void 0;this.unsubscribePlayerPhaseSubscription=void 0;this.annotationsApi=void 0;this.prevIsid=void 0;this.isInited=!1;this.createOneStat=(t,n={})=>{var y,b;let{albumId:o,statPlace:r,statUserSalt:l,statTrackCode:a,refreshStatAuthToken:s,autoplay:u,isMobile:f,refDomain:m,deviceId:h,interactiveData:w}=fs(this.videoConfig,n),g=(y=w==null?void 0:w.projectInfo)==null?void 0:y.pid,{unitedVideoId:C,isClip:v=!1}=t;if(this.uiConfig.features.statistics&&C)return new R8(lt({movieId:C,albumId:o,place:r,trackCode:a,autoplay:(b=u&&!this.interactiveController)!=null?b:!1,mobile:f,clip:v,refDomain:m,deviceId:h},g&&!this.isInited&&{projectId:Number(g)}),lt({refreshAuthToken:s,userSalt:l,config:this.statisticsConfig},this.interactiveController&&{useIsid:!0,isid:this.prevIsid}))};this.logger=new M8,this.log=this.logger.createComponentLog("VKVideoPlayer"),this.subscription=new V8,this.graphMadePause=!1,(t=window==null?void 0:window.videoPlayerConfig)!=null&&t.debugLogs&&this.subscription.add(this.logger.log$.subscribe(n=>{console.log("%c player web component ","background:#77dd77;",`${n.component}`,n.message)}))}connectedCallback(){var o,r;if(this.isInited)return;this.initPlayerRootContainers();let t=(o=this.getAttribute("stub-title"))!=null?o:void 0,n=(r=this.getAttribute("stub-thumb-url"))!=null?r:void 0;this.svelteStubComponent=new Fp({target:this.playerContainer,props:{title:t,thumbUrl:n}})}disconnectedCallback(){var t,n,o,r,l,a;(t=this.annotationsApi)==null||t.destroy(),(n=this.mediaSessionApi)==null||n.destroy(),(o=this.svelteRootComponent)==null||o.$destroy(),(r=this.svelteStubComponent)==null||r.$destroy(),this.subscription.unsubscribe(),(l=this.unsubscribePlayerPhaseSubscription)==null||l.call(this),(a=this.interactiveController)==null||a.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%",this.shadowRootContainer=document.createElement("div"),this.shadowRootContainer.style.position="absolute",this.shadowRootContainer.className="shadow-root-container",this.shadowRootContainer.style.width="100%",this.shadowRootContainer.style.height="100%",this._shadowRoot=this.shadowRootContainer.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(this.shadowRootContainer),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(t){var o;let n=(o=this.store)==null?void 0:o.ui.controls.disabledControls$;return(n==null?void 0:n.includes(t))||!1}getNextVideoInfo(){if(!this.videoConfig)return{nextVideoTitle:void 0,nextVideoThumb:void 0};let t=this.videoConfig.videos[this.currentPlayingVideoIndex+1]||{};return{nextVideoTitle:t.title,nextVideoThumb:t.thumbUrl}}createPlayer(t,n={},o){var Le,ct,me,tt,St,vt,Ue,Ft,Rt,Tt,oi;if(!this.videoConfig)return;let{albumId:r,statPlace:l,statAuthToken:a,preload:s,autoplay:u,volume:f,muted:m,fromTime:h,canRewindLive:w,supportLink:g,showAds:C,adsSlotId:v,adsParams:E={},adsPreviewParam:y,interfaceLanguage:b,isCyrillicRelatedInterface:P,logoClickable:A,logoHidden:M,isMobile:O,isAudioDisabled:te,isLiveCatchUpMode:_e,fullScreenTarget:Z,failoverHosts:x,canDownload:se,callbacks:L,interactiveData:K,showThumbTimer:J,additionalButtons:Y=[],repeat:F,saveRate:G,volumeMultiplier:X}=fs(this.videoConfig,n),{sources:le,title:qe,thumbUrl:Xe,unitedVideoId:Ee,isClip:Be=!1,duration:De,adsParams:xe={},videoEpisodes:ae,previewThumbsData:he,subtitles:ut,live:Ce}=t,Ke=lt(lt({},E),xe),_t=this.getNextVideoInfo(),Ye={sources:le,title:qe,thumbUrl:Xe,subtitles:ut,unitedVideoId:Ee,isClip:Be,live:Ce,albumId:r,statPlace:l,autoplay:u,muted:m,volume:f,fromTime:h,canRewindLive:w,showAds:C,adsSlotId:v,adsParams:Ke,adsPreviewParam:y,duration:De,logoClickable:A,logoHidden:M,isMobile:O,repeat:F,showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive(),endScreenVideoTitle:_t.nextVideoTitle,endScreenVideoThumb:_t.nextVideoThumb,isOneVideoPlaylist:this.isOneVideoPlaylist()},Ge={pictureInPictureApi:this.pictureInPictureApi,annotationsApi:this.annotationsApi};this.log({message:`create player, props: ${JSON.stringify(Ye)}`});let Ze=(Le=this.interactiveController)==null?void 0:Le.state.statistics$.getValue(),et=(Ze==null?void 0:Ze.oneStat)||this.createOneStat(t,n);et&&(this.statistics=new Zr(et,Ze==null?void 0:Ze.statSubscription)),this.uiConfig.features.sentry&&this.uiConfig.sentry.dsn&&new Do(this.uiConfig.sentry,{version:al,env:er},{movieId:Ee,albumId:r,place:l,autoplay:(ct=u&&!this.interactiveController)!=null?ct:!1,mobile:O,clip:Be}),this.interactiveController&&((tt=this.prevIsid)!=null||(this.prevIsid=(me=this.statistics)==null?void 0:me.oneStat.isid$.getValue())),this.sentry=lt(lt({},this.sentry),Do.getInstance());let Pe=!!K,We=[],re="tooltip_interactive_go_back_disabled_first";if(Pe&&this.interactiveController){let ft=this.interactiveController.state.isInitialChapter$.getValue(),rt=this.interactiveController.getHistoryState();ft&&We.push("REPLAY_BUTTON"),this.interactiveController.getIsSeekable().getValue()||We.push("SEEK_TO_INTERACTIVE_BUTTON"),rt.hasPrevChapter$.getValue()||(We.push("PLAY_PREV_CHAPTER_BUTTON"),ft||(rt.isGoBackLimited$.getValue()?re="tooltip_interactive_go_back_disabled_limit":re="tooltip_interactive_go_back_disabled"))}let Te=()=>{var rt;this.isInited=!1,this.prevIsid=void 0;let ft=(o==null?void 0:o.info.isEnded$.getValue())&&((rt=this.interactiveController)==null?void 0:rt.state.isEndChapter$.getValue());L.onReplayInteractiveVideo&&!ft?L.onReplayInteractiveVideo():this.replayInteractiveVideo()};this.store=gm({player:o,interfaceLanguage:b,isCyrillicRelatedInterface:P,videoId:Ee,isClip:Be,isLiveCatchUpMode:_e,isAudioDisabled:te,statAuthToken:a,callbacks:L,webApi:Ge,videoEpisodes:ae,previewThumbsData:he,canDownload:se,uiConfig:this.uiConfig,coreConfig:this.coreConfig,disabledControls:We,isInteractive:Pe,saveRate:G,interactiveRanges$:(St=this.interactiveController)==null?void 0:St.state.interactiveRanges$,isInteractiveTime$:(vt=this.interactiveController)==null?void 0:vt.state.isInteractiveTime$,replayInteractive:Te,playPrevChapterDisabledTooltip:re,hasInteractiveBranches:!!((Ft=(Ue=this.interactiveController)==null?void 0:Ue.getChapterBranches())!=null&&Ft.length),additionalButtons:this.uiConfig.features.additionalButtons?Y:[],looped:F&&this.videoConfig.videos.length===1,statistics:this.statistics});let{stores:ht}=this.microStoresRoot=Gp();this.subscription.add(this.store.state.currentFormat$.subscribe(ft=>{var rt;return(rt=L==null?void 0:L.onCurrentFormatChanged)==null?void 0:rt.call(L,ft)})),this.subscription.add(ht.interactiveControlsOpacity$.subscribe(ft=>{var rt;ft!==null&&((rt=this==null?void 0:this.interactiveController)==null||rt.setDisabledControls(ft))})),this.subscription.add(this.store.state.throughputEstimation$.subscribe(ft=>{var rt;return(rt=L==null?void 0:L.onThroughputEstimationChanged)==null?void 0:rt.call(L,ft)})),this.subscription.add(this.store.state.trafficSavingEnabled$.subscribe(ft=>{var rt;return(rt=L==null?void 0:L.onTrafficSavingEnabledChanged)==null?void 0:rt.call(L,ft)})),this.subscription.add(this.store.state.currentPlaybackRate$.subscribe(ft=>{var rt;return(rt=L==null?void 0:L.onCurrentPlaybackRateChanged)==null?void 0:rt.call(L,ft)})),this.subscription.add(this.store.state.volume$.subscribe(ft=>{var rt;return(rt=L==null?void 0:L.onVolumeChange)==null?void 0:rt.call(L,ft)})),this.subscription.add(this.store.state.muted$.subscribe(ft=>{var rt,be;return ft?(rt=L==null?void 0:L.onMute)==null?void 0:rt.call(L):(be=L==null?void 0:L.onUnmute)==null?void 0:be.call(L)})),this.subscription.add(this.store.state.videoBitrate$.subscribe(ft=>{var rt;return(rt=L==null?void 0:L.onVideoBitrateChanged)==null?void 0:rt.call(L,ft)})),this.subscription.add(this.store.state.isInteractiveTime$.subscribe(ft=>{var be;let rt=(be=this.store)==null?void 0:be.ui.controls.disabledControls$;rt&&(ft&&!rt.includes(Vl)&&rt.add(Vl),ft||rt.remove(Vl))})),this.subscription.add(this.store.ui.isFullscreen.subscribe(ft=>pt(this,null,function*(){var be;if(!L8.isSamsungBrowser||!ft||!this.interactiveController)return;document.fullscreenElement===this.shadowRootContainer&&(yield this.replayInteractiveChapter((be=this.videoConfig)==null?void 0:be.callbacks.onExternalFullscreenExit))}))),this.statistics&&this.subscription.add(this.statistics.oneStat.vsid$.subscribe(ft=>{var rt;return(rt=L==null?void 0:L.onVSIDChanged)==null?void 0:rt.call(L,ft)})),this.initMediaSession(),this.svelteRootComponent=new Bp({target:this.playerContainer,props:{interactiveContainer:this.interactiveContainer,sources:le,store:this.store,microStoresRoot:this.microStoresRoot,videoConfig:this.videoConfig,uiConfig:this.uiConfig,title:qe,thumbUrl:Xe,subtitles:ut,live:Ce,preload:s,autoplay:u,muted:m,volume:f,fromTime:h,canRewindLive:w,supportLink:g,showAds:C,adsSlotId:v,adsParams:Ke,adsPreviewParam:y,duration:De,logoClickable:A,logoHidden:M,isMobile:O,failoverHosts:x,fullScreenTarget:Z,saveRate:G,shadowRootContainer:this.shadowRootContainer,showMiniTimer:J,outerContainerRef:this.rootContainer,showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive(),endScreenVideoTitle:_t.nextVideoTitle,endScreenVideoThumb:_t.nextVideoThumb,isOneVideoPlaylist:this.isOneVideoPlaylist(),playNextVideo:()=>this.playNextVideo(),playPrevVideo:()=>this.playPrevVideo(),repeatPlaylist:()=>this.repeatPlaylist(),playPrevChapter:()=>this.playPrevChapter(),seekToInteractive:()=>this.seekToInteractive(),toggleGraph:()=>this.toggleGraph(),volumeMultiplier:X}}),this.addPlayerInfoSubscriptions(),this.isInited||(this.isInited=!0,(oi=(Tt=(Rt=this.videoConfig)==null?void 0:Rt.callbacks)==null?void 0:Tt.onInited)==null||oi.call(Tt))}addPlayerInfoSubscriptions(){var r;let t=this.store;if(!t)return;let n=(r=this.videoConfig)==null?void 0:r.callbacks;n&&this.subscription.add(t.playerPhase.subscribe(l=>{var a;return(a=n.onPlayerPhaseChanged)==null?void 0:a.call(n,l)})).add(t.state.playbackState$.subscribe(l=>{var a;return(a=n.onPlaybackStateChanged)==null?void 0:a.call(n,l)})).add(t.state.isLive$.subscribe(l=>{var a;return(a=n.onIsLiveChanged)==null?void 0:a.call(n,l)})).add(t.state.isActiveLive$.subscribe(l=>{var a;return(a=n.onIsActiveLiveChanged)==null?void 0:a.call(n,l)})).add(t.state.isAudioAvailable$.subscribe(l=>{var a;return(a=n.onIsAudioAvailableChanged)==null?void 0:a.call(n,l)})).add(t.state.currentQuality$.subscribe(l=>{var a;return(a=n.onCurrentQualityChanged)==null?void 0:a.call(n,l)})).add(t.state.availableQualities$.subscribe(l=>{var a;return(a=n.onAvailableQualitiesChanged)==null?void 0:a.call(n,l.map(({value:s})=>s).filter(s=>s!=="auto"))})).add(t.state.availableAudioStreams$.subscribe(l=>{l.length>1&&n.onAudioLanguagesAvailable&&n.onAudioLanguagesAvailable()})).add(t.ui.isPictureInPictureActive$.subscribe(l=>{var a,s;return l?(a=n.onPiPEnter)==null?void 0:a.call(n):(s=n.onPiPExit)==null?void 0:s.call(n)}));let o=n==null?void 0:n.uiInfo;o&&this.subscription.add(t.ui.controlsVisible.subscribe(l=>{var a;return(a=o.onControlsVisibleChanged)==null?void 0:a.call(o,l)})).add(t.ui.isMobile.subscribe(l=>{var a;return(a=o.onIsMobileChanged)==null?void 0:a.call(o,l)})).add(t.ui.playerSize.subscribe(l=>{var a;return(a=o.onPlayerSizeChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.prevButton.subscribe(l=>{var a;return(a=o.onPrevButtonChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.playButton.subscribe(l=>{var a;return(a=o.onPlayButtonChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.replayButton.subscribe(l=>{var a;return(a=o.onReplayButtonChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.nextButton.subscribe(l=>{var a;return(a=o.onNextButtonChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.playPrevChapterButton.subscribe(l=>{var a;return(a=o.onPlayPrevChapterChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.seekToInteractiveButton.subscribe(l=>{var a;return(a=o.onSeekToInteractiveButtonChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.interactiveGraphButton.subscribe(l=>{var a;return(a=o.onGraphButtonChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.liveButton.subscribe(l=>{var a;return(a=o.onLiveButtonChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.time.subscribe(l=>{var a;return(a=o.onTimeUpdateChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.episodes.subscribe(l=>{var a;return(a=o.onEpisodesChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.subtitles.subscribe(l=>{var a;return(a=o.onSubtitlesChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.settings.subscribe(l=>{var a;return(a=o.onSettingsChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.fullscreen.subscribe(l=>{var a;return(a=o.onFullscreenChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.chromecast.subscribe(l=>{var a;return(a=o.onChromecastChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.pip.subscribe(l=>{var a;return(a=o.onPipChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.vkLogo.subscribe(l=>{var a;return(a=o.onVkLogoChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.interactiveTimeIndicator.subscribe(l=>{var a;return(a=o.onInteractiveTimeIndicatorChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.timeline.subscribe(l=>{var a;return(a=o.onTimelineChanged)==null?void 0:a.call(o,l)}))}playNextVideo(){var n;if(!this.videoConfig)return;let t=!0;if((n=this.videoConfig.callbacks)!=null&&n.onNextVideoClick)try{t=this.videoConfig.callbacks.onNextVideoClick()}catch(o){this.log({message:"onNextVideoClick callback failed to execute"})}t&&(this.currentPlayingVideoIndex++,this.currentPlayingVideoIndex>=this.videoConfig.videos.length&&(this.currentPlayingVideoIndex=0),this.log({message:`play next video, index: ${this.currentPlayingVideoIndex}`}),this.createPlayerWithCurrentVideo())}playPrevVideo(){var n;if(!this.videoConfig)return;let t=!0;if((n=this.videoConfig.callbacks)!=null&&n.onPrevVideoClick)try{t=this.videoConfig.callbacks.onPrevVideoClick()}catch(o){this.log({message:"onPrevVideoClick callback failed to execute"})}t&&(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(t,n=!0){var r;if(!this.videoConfig)return;let o=this.videoConfig.videos[this.currentPlayingVideoIndex];if(!o){this.log({message:"no next video"});return}this.isInited&&Ac(o.unitedVideoId)&&this.store.actions.internal.nextMovie(o.unitedVideoId),(r=this.svelteRootComponent)==null||r.$destroy(),this.createPlayer(o,{autoplay:n,fromTime:0},t)}playPrevChapter(){var t;(t=this.interactiveController)==null||t.playPrevChapter()}seekToInteractive(){var n;let t=(n=this.interactiveController)==null?void 0:n.getNextInteractiveStartTime();typeof t=="number"&&this.seekTime(t/1e3)}toggleGraph(){var f,m;if(!this.isInited)return;let t=this.store,{isEnded$:n,playbackState$:o,graphIsOpened$:r}=t.state,{disabledControls$:l}=t.ui.controls,a=$e(n),s=$e(o);$e(r)?(r.set(!1),(f=this.interactiveController)==null||f.toggleGraphView(!1),l.remove(Ss),!a&&this.graphMadePause&&this.play()):(this.graphMadePause=s==="playing",r.set(!0),(m=this.interactiveController)==null||m.toggleGraphView(!0),l.add(Ss),!a&&this.graphMadePause&&this.pause())}initInteractives(){return pt(this,null,function*(){var t,n,o,r;if((t=this.videoConfig)!=null&&t.interactiveData)try{let{Interactives:l,EVENT_NAMES:a,CustomError:s}=yield import("@vkontakte/videoplayer-interactive");this.interactiveContainer=document.createElement("div"),this.interactiveContainer.classList.add("interactiveContainer");let u=(n=this.store)==null?void 0:n.interfaceLanguage$,f=u?$e(u):this.videoConfig.interfaceLanguage,{projectInfo:m,initChapterId:h,historyApi:w,videoLoader:g}=this.videoConfig.interactiveData;this.interactiveController=new l({parentElement:this.interactiveContainer,fullscreenTargetElement:this.playerContainer,lang:f,graph:this.uiConfig.features.interactiveGraph,projectInfo:m,initChapterId:h,historyApi:w,vkVideoLoader:g,lastFrame:this.uiConfig.features.interactiveLastFrame,permanentTextControls:this.uiConfig.features.interactiveTextPermanent,initSeamless:!0,config:this.uiConfig.interactive,coreConfig:this.coreConfig,createOneStat:this.createOneStat});let{isInteractiveExpectation$:C}=this.interactiveController.state;if(this.uiConfig.features.seekToInteractive&&this.subscription.add(this.interactiveController.getIsSeekable().subscribe(v=>{if(!this.isInited)return;let E=this.store;v?E.ui.controls.disabledControls$.remove("SEEK_TO_INTERACTIVE_BUTTON"):E.ui.controls.disabledControls$.add("SEEK_TO_INTERACTIVE_BUTTON")})),this.subscription.add(C.subscribe(v=>{this.store&&this.store.state.isInteractiveExpectation$.set(v)})),this.interactiveController.on(a.playerChanged,v=>{var b;if(!this.videoConfig)return;let E=((b=this.interactiveController)==null?void 0:b.state.isFirstChapter$.getValue())||!0;this.videoConfig.videos[this.currentPlayingVideoIndex]=Vt(lt({},v.config),{title:(m==null?void 0:m.title)||v.config.title});let y=E?this.videoConfig.autoplay:!0;this.createPlayerWithCurrentVideo(v.player,y)}),this.interactiveController.on(a.interactives,({type:v,actionType:E})=>{var b,P,A,M;if(!this.store)return;let y=C.getValue();if(v==="action-choice"&&E==="setRandomBranch"&&(this.store.state.graphIsOpened$.set(!1),this.store.ui.controls.disabledControls$.remove($l)),v==="action-choice-canceled"){let O=$e(this.store.state.isPlaying$)||y;if((b=this.videoConfig)!=null&&b.isMobile&&O){this.store.ui.interactiveHideMobileControls.set(!0);return}(M=(P=this.videoConfig)==null?void 0:(A=P.callbacks).onDisabledInteractiveClick)==null||M.call(A)}}),yield this.interactiveController.setManifest(this.videoConfig.interactiveData.manifest),(r=(o=this.videoConfig)==null?void 0:o.callbacks)!=null&&r.onInteractiveHistoryChanged){let v=this.interactiveController.getHistoryState();this.subscription.add(v.history$.subscribe(E=>{var y,b,P;E.length&&((P=(b=(y=this.videoConfig)==null?void 0:y.callbacks)==null?void 0:b.onInteractiveHistoryChanged)==null||P.call(b,E))}))}this.uiConfig.features.interactiveTimeIndicator&&this.subscription.add(this.interactiveController.events.noInteraction$.subscribe(()=>{var v,E,y,b;(v=this.microStoresRoot)==null||v.stores.showInteractiveTimeIndicatorTooltip$.set(!0,!0),(b=(E=this.videoConfig)==null?void 0:(y=E.callbacks).onInteractiveTimeIndicatorClick)==null||b.call(y)})),this.interactiveController.on(a.errors,v=>{this.log({message:v.toString()})})}catch(l){this.log({message:l.message})}})}initPlayer(t,n={}){var o,r,l,a,s,u,f,m,h,w,g,C,v,E,y,b,P,A,M;if(!Array.isArray(t.videos)||t.videos.length===0&&!t.interactiveData)throw new Error("empty videos");this.videoConfig=fs(B8,I8(t,O=>O instanceof HTMLElement?O:void 0)),this.uiConfig=Yc((o=n.ui)!=null?o:{}),this.coreConfig=(r=n.core)!=null?r:{configName:[]},this.statisticsConfig=(l=n.statistics)!=null?l:{},this.sentry={config:(a=this.uiConfig.sentry)!=null?a:{}},Ac(this.videoConfig.isMediaSessionEnabled)&&(this.uiConfig.features.mediaSession=(s=this.videoConfig.isMediaSessionEnabled)!=null?s:!0),Ac(this.videoConfig.isPictureInPictureEnabled)&&(this.uiConfig.features.pip=(f=(u=this.uiConfig.features.pip)!=null?u:this.videoConfig.isPictureInPictureEnabled)!=null?f:!0,this.uiConfig.features.dpip=(h=(m=this.uiConfig.features.dpip)!=null?m:this.videoConfig.isPictureInPictureEnabled)!=null?h:!0),this.videoConfig.isMobile=(w=this.uiConfig.isMobile)!=null?w:this.videoConfig.isMobile,(g=this.videoConfig).autoplay&&(g.autoplay=this.uiConfig.features.autoplay),this.videoConfig.showAds=(C=this.uiConfig.ads.enable)!=null?C:this.videoConfig.showAds,this.videoConfig.adsSlotId=(v=this.uiConfig.ads.slot)!=null?v:this.videoConfig.adsSlotId,this.videoConfig.adsPreviewParam=(E=this.uiConfig.ads.preview)!=null?E:this.videoConfig.adsPreviewParam,this.videoConfig.logoHidden=!((y=this.uiConfig.showLogo)!=null?y:!this.videoConfig.logoHidden),(b=this.videoConfig).canRewindLive&&(b.canRewindLive=this.uiConfig.features.liveRewind),this.videoConfig.supportLink=(P=this.videoConfig.supportLink)!=null?P:this.uiConfig.supportLink,this.currentPlayingVideoIndex=0,this.needToRepeatPlaylist=this.videoConfig.repeat,this.uiConfig.features.pip&&(this.uiConfig.features.dpip?this.pictureInPictureApi=cs.getLatestSupportedVersion():this.pictureInPictureApi=new No),this.mediaSessionApi=this.uiConfig.features.mediaSession?new us:void 0,this.annotationsApi=this.uiConfig.features.annotations?new ds:void 0,this.annotationsApi&&!this.uiConfig.features.annotationsInside&&this.annotationsApi.init(this.rootContainer),(A=this.svelteStubComponent)==null||A.$destroy(),(M=this.svelteRootComponent)==null||M.$destroy(),this.isInited=!1,this.prevIsid=void 0,this.interactiveController&&(this.interactiveController.destroy(),this.interactiveController=void 0),t.interactiveData?this.initInteractives():this.createPlayer(t.videos[0]),Up(this.pictureInPictureApi)&&this.pictureInPictureApi.setPlayerDomElement(this.playerContainer,this._shadowRoot)}isOneVideoPlaylist(){return this.videoConfig?this.videoConfig.videos.length===1:!1}updateNextVideos(t){var o;if(!this.videoConfig)return;this.log({message:`update next videos, videos: ${JSON.stringify(t)}`}),this.videoConfig.videos.splice(this.currentPlayingVideoIndex+1),this.videoConfig.videos.push(...t);let n=this.getNextVideoInfo();(o=this.svelteRootComponent)==null||o.$set({showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive(),endScreenVideoTitle:n.nextVideoTitle,endScreenVideoThumb:n.nextVideoThumb,isOneVideoPlaylist:this.isOneVideoPlaylist()})}initMediaSession(){var t,n;this.mediaSessionApi&&((t=this.unsubscribePlayerPhaseSubscription)==null||t.call(this),this.mediaSessionApi.clearSubscriptions(),this.unsubscribePlayerPhaseSubscription=(n=this.store)==null?void 0:n.playerPhase.subscribe(o=>{o==="video"?this.setupMediaSessionForVideo():o==="ads"&&this.setupMediaSessionForAds()}))}setupMediaSessionForVideo(){if(!(!this.videoConfig||!this.mediaSessionApi))try{let{title:t,thumbUrl:n}=lt({},this.videoConfig.videos[this.currentPlayingVideoIndex]),o=[["play",()=>this.play()],["pause",()=>this.pause()],["seekto",r=>this.seekTime(r.seekTime)]];this.videoConfig.videos.length>1&&(this.currentPlayingVideoIndex<this.videoConfig.videos.length-1&&o.push(["nexttrack",()=>this.playNextVideo()]),this.currentPlayingVideoIndex>0&&o.push(["previoustrack",()=>this.playPrevVideo()])),this.mediaSessionApi.setMetaData({title:t,thumbUrl:n}),this.mediaSessionApi.updateActionHandlers(o),this.mediaSessionApi.attachToStore(this.store)}catch(t){this.log({message:t.message})}}setupMediaSessionForAds(){if(!(!this.videoConfig||!this.mediaSessionApi))try{let t="\u0420\u0435\u043A\u043B\u0430\u043C\u0430",n=[["play",()=>this.play()],["pause",()=>this.pause()]];this.mediaSessionApi.setMetaData({title:t}),this.mediaSessionApi.updateActionHandlers(n),this.mediaSessionApi.attachToStore(this.store)}catch(t){this.log({message:t.message})}}play(){var t,n,o,r;this.isControlDisabled("PLAY_BUTTON")||(t=this.store)!=null&&t.playerPhase.is("LiveWaitingStart")||(n=this.store)!=null&&n.playerPhase.is("LiveWaitingRecover")||(o=this.store)!=null&&o.playerPhase.is("LiveWaitingRecord")||(this.log({message:"play"}),(r=this.svelteRootComponent)==null||r.play())}pause(){var t;this.log({message:"pause"}),(t=this.svelteRootComponent)==null||t.pause()}stop(){var n,o,r;if(!this.videoConfig)return;this.log({message:"stop"}),(n=this.svelteStubComponent)==null||n.$destroy(),(o=this.mediaSessionApi)==null||o.destroy();let t=this.videoConfig.videos[0];t&&((r=this.svelteRootComponent)==null||r.$destroy(),this.createPlayer(t))}setMuted(t){var n;this.log({message:`set muted, muted: ${t}`}),(n=this.svelteRootComponent)==null||n.setMuted(t)}setVolume(t){var n;this.log({message:`set volume, volume: ${t}`}),(n=this.svelteRootComponent)==null||n.setVolume(t)}setRepeat(t){var n;this.log({message:`set repeat, repeat: ${t}`}),this.needToRepeatPlaylist=t,(n=this.svelteRootComponent)==null||n.$set({needToRepeatPlaylist:this.needToRepeatPlaylist,showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive()})}seekTime(t){var n;this.isControlDisabled("TIMELINE")||(this.log({message:`seek time, time: ${t}`}),(n=this.svelteRootComponent)==null||n.seekTime(t))}seekEpisodeStartTime(t){var n;this.log({message:`seek episode start time, time: ${t}`}),(n=this.svelteRootComponent)==null||n.seekEpisodeStartTime(t)}returnFocusToEpisodes(){var t;this.log({message:"return focus to episodes button"}),(t=this.svelteRootComponent)==null||t.returnFocusToEpisodes()}setPlaybackRate(t){var n;this.log({message:`set playback rate to: ${t}`}),(n=this.svelteRootComponent)==null||n.setPlaybackRate(t)}setAutoQualityLimits(t){var n,o,r;this.log({message:`set auto quality limitation. Max: ${(n=t.max)!=null?n:"none"}. Min: ${(o=t.min)!=null?o:"none"}`}),(r=this.svelteRootComponent)==null||r.setAutoQualityLimits(t)}addLanguage(t){var n;(n=this.store)==null||n.actions.internal.addLanguage(t)}setLanguage(t){return pt(this,null,function*(){var n;yield(n=this.store)==null?void 0:n.actions.internal.setLanguage(t)})}setLiveStart(t){var n,o,r;this.log({message:"live started"}),(n=this.store)==null||n.actions.internal.setLiveWaitingRecover(!1),(o=this.store)==null||o.actions.internal.setLiveWaitingStart(!1),(r=this.svelteRootComponent)==null||r.$destroy(),this.createPlayer(t,{autoplay:!0})}setLiveWaitingRecover(){var t,n;this.log({message:"live waiting"}),(t=this.store)==null||t.actions.internal.setLiveWaitingRecover(!0),(n=this.store)==null||n.destroy()}setLiveWaitingRecord(){var t,n;this.log({message:"post live"}),(t=this.store)==null||t.actions.internal.setLiveWaitingRecord(!0),(n=this.store)==null||n.destroy()}setLiveEnd(t){var n,o,r;this.log({message:"live ended"}),(n=this.store)==null||n.actions.internal.setLiveWaitingRecover(!1),(o=this.store)==null||o.actions.internal.setLiveWaitingRecord(!1),(r=this.svelteRootComponent)==null||r.$destroy(),this.createPlayer(t,{autoplay:!1})}getDeviceId(){var t,n;return(n=(t=this.statistics)==null?void 0:t.oneStat.getDeviceId())!=null?n:void 0}replayInteractiveVideo(){this.interactiveController&&this.interactiveController.setChapter()}replayInteractiveChapter(t){return pt(this,null,function*(){var n;if(this.interactiveController&&((n=this.store)!=null&&n.state.positionExact$)){let{EVENT_NAMES:o}=yield import("@vkontakte/videoplayer-interactive"),r=$e(this.store.state.positionExact$),a=$e(this.store.state.interactiveEpisodes$).find(u=>!u.completed);this.interactiveController.once(o.playerChanged,()=>{a&&r>=a.time?this.seekTime(a.time):this.seekTime(r),t==null||t()});let s=this.interactiveController.getCurrentChapter();yield this.interactiveController.setChapter({chapterId:s.chapter.id,pushToHistory:!1})}})}showInteractiveIndicatorTooltip(t,n=!1){var o;(o=this.microStoresRoot)==null||o.stores.showInteractiveTimeIndicatorTooltip$.set(t,n)}switchToActiveLive(){var t;(t=this.store)==null||t.actions.internal.switchToActiveLive()}updateStatContext(t){this.statistics&&this.statistics.oneStat.updateContext(t)}};import{InterfaceLanguage as HO,VKNumericLanguage as zO,loadVKLangPack as UO}from"@vkontakte/videoplayer-shared";import{VideoQuality as WO,VideoFormat as jO}from"@vkontakte/videoplayer-core";var DO=()=>{window.customElements.define("vk-video-player",ps)};export{Ro as GridTypes,HO as InterfaceLanguage,al as VERSION,zO as VKNumericLanguage,jO as VideoFormat,WO as VideoQuality,UO as loadVKLangPack,DO as registerPlayerWebComponent};
53
+ `),t=document.createElement("style");t.textContent=e;let n=this.createStretchedContainer(),o=n.attachShadow({mode:"open"});o.append(t),o.append(this.playerDomElement),this.playerDummyElement=new zp({target:this.playerParentShadowRoot,context:this.svelteContext}),(r=this.pipWindow)==null||r.document.body.append(n),this.info.isActive$.next(!0),(l=this.pipWindow)==null||l.addEventListener("unload",a=>{!this.playerDomElement||!this.playerParentShadowRoot||!this.playerDummyElement||(this.playerDummyElement.$destroy(),this.playerParentShadowRoot.append(this.playerDomElement),this.info.isActive$.next(!1))})})}remove(){return pt(this,null,function*(){return new Promise(e=>{var t;(t=documentPictureInPicture.window)==null||t.close(),e()})})}dispose(){return pt(this,null,function*(){yield this.remove()})}createStretchedContainer(){let e=document.createElement("div");return e.style.width="100%",e.style.height="100%",e}};function Up(i){return i instanceof zl}var cs=class{static getLatestSupportedVersion(){let e=new No,t=new zl;if(t.isSupported())return t;if(e.isSupported())return e}};function fs(i,e){var o,r;let t=new Set([...Object.keys(i),...Object.keys(e)]),n={};for(let l of t)n[l]=(r=(o=e[l])!=null?o:i[l])!=null?r:void 0;return n}var Kp="Inner error. Unexpectedly root annotation container null reference exception",Wp="Annotation with such name already exists",jp="Annotation with such name does not exist";var Tl=class extends Error{constructor(e){super(e),this.name="AnnotationError"}};import{observeElementSize as y8,Subscription as w8,throttleFn as k8}from"@vkontakte/videoplayer-shared";var C8="1",S8=100,ds=class{constructor(){this.annotations=new Map;this.subscriptions=new w8}init(e){this.rootAnnotationsContainer=e;let t=k8(()=>{for(let n of this.annotations.values())this.isElementExceedsBoundaries(n,this.playerSize.width,this.playerSize.height)?n.style.visibility="hidden":n.style.visibility="visible"},S8);this.subscriptions.add(y8(this.rootAnnotationsContainer).subscribe(({width:n,height:o})=>{this.playerSize={width:n,height:o},t()})),this.mutationObserver=new MutationObserver(t),this.mutationObserver.observe(this.rootAnnotationsContainer,{attributes:!0,childList:!0,subtree:!0,characterData:!0})}add(e,t){var n;if(!this.rootAnnotationsContainer)throw new Tl(Kp);if(this.annotations.has(e))throw new Tl(Wp);t.style.zIndex=(n=t.style.zIndex)!=null?n:C8,t.style.position="absolute",this.rootAnnotationsContainer.append(t),this.annotations.set(e,t)}get(e){let t=this.annotations.get(e);if(!t)throw new Tl(jp);return t}remove(e){let t=this.get(e);this.annotations.delete(e)&&t.remove()}clear(){for(let e in this.annotations.keys())this.remove(e)}destroy(){this.annotations.clear(),this.subscriptions.unsubscribe(),this.mutationObserver.disconnect(),this.rootAnnotationsContainer=null}isElementExceedsBoundaries(e,t,n){let o=e.offsetTop,r=e.offsetLeft,l=e.offsetWidth,a=e.offsetHeight;return o<0||r<0||r+l>t||o+a>n}registryRootContainer(e){}addLayer(e){return document.createElement("div")}getLayer(e){}removeLayer(e){}clearLayer(e){}detach(){}reattach(){}};import{assertNonNullable as Ec,Subscription as T8}from"@vkontakte/videoplayer-shared";var $n=class{init({store:e,microStores:t,config:n}){return Ec(e),Ec(t),Ec(n),this.subscription=new T8,this.subscription}};var Ul=class extends $n{constructor(){super(...arguments);this.stateName="fakeIsPlaying$";this.state$=Vt(lt({},Fe(null)),{toggle:()=>this.state$.update(t=>!t)})}init(t){let n=super.init(t),{isInteractiveExpectation$:o}=t.store.state;return n.add(o.subscribe(r=>{this.state$.set(r?!0:null)})),n}};var Kl=class extends $n{constructor(){super(...arguments);this.stateName="interactiveControlsOpacity$";this.state$=Vt(lt({},Fe(null)),{toggle:()=>this.state$.update(t=>!t)})}init(t){let n=super.init(t),{microStores:o,store:r}=t,{fakeIsPlaying$:l}=o,{isInteractiveExpectation$:a,isPlaying$:s}=r.state,{controlsVisible:u,isMobile:f}=r.ui,m=$e(f),h=()=>m&&$e(u);return n.add(u.subscribe(w=>{if(!m)return;let g=$e(l);$e(s)?this.state$.set(w):g!==null&&this.state$.set(!g||w)})),n.add(s.subscribe(w=>{this.state$.set(!w||h())})),n.add(l.subscribe(w=>{if(w===null)return;let g=$e(a);if(h()){this.state$.set(!0);return}g&&this.state$.set(!w)})),n}};var Wl=class extends $n{constructor(){super(...arguments);this.stateName="seekToInteractiveDisabledTooltip$";this.state$=Fe("tooltip_chapter_without_interactive")}init(t){let n=super.init(t),{store:o}=t;return n.add(o.state.interactiveEpisodes$.subscribe(r=>{r.length&&(r.every(l=>l.completed)?this.state$.set("tooltip_interactive_of_chapter_completed"):this.state$.set("tooltip_disabled_when_interactive"))})),n}};import{combine as P8}from"@vkontakte/videoplayer-shared";var Lc=Fe(!1),ms=null,jl=class extends $n{constructor(){super(...arguments);this.stateName="showInteractiveTimeIndicatorTooltip$";this.state$=Vt(lt({},Lc),{set:(t,n=!1)=>{t!==$e(Lc)&&(this.clearTimeout(),Lc.set(t),!t&&ms&&(ms=!1),t&&n&&(this.timeout=setTimeout(()=>{this.state$.set(!1)},3e3)))},clearTimeout:()=>this.clearTimeout()})}init(t){let n=super.init(t),{store:o,config:r}=t,{isInteractiveTime$:l,isPlaying$:a}=o.state,s=o.ui.controlsVisible,{interactiveTimeIndicator:u}=o.ui.controls;n.add(s.subscribe(m=>{$e(l)&&m&&this.state$.set(!1)}));let f=(r==null?void 0:r.interactiveData)||{tooltipHelpHintActive:!1};return n.add(P8({isPlaying$:a,isInteractiveTime$:l,interactiveTimeIndicator:u}).subscribe(({isPlaying$:m,isInteractiveTime$:h,interactiveTimeIndicator:w})=>{var g,C;if(!(!m||!(w!=null&&w.isDisplayed))){if(!h)return this.state$.set(!1);f.tooltipHelpHintActive&&ms===null&&(ms=!0,f.tooltipHelpHintActive=!1,this.state$.set(!0),(C=(g=o.callbacks)==null?void 0:g.onInteractiveTimeIndicatorHintDeactivated)==null||C.call(g))}})),n}clearTimeout(){window.clearTimeout(this.timeout)}};var Gp=()=>[Ul,Kl,Wl,jl].reduce(({subscribers:i,stores:e},t)=>{let n=new t;return{subscribers:[...i,n],stores:Vt(lt({},e),{[n.stateName]:n.state$})}},{subscribers:[],stores:{}});var B8={preload:!0,autoplay:!1,repeat:!1,fromTime:0,canRewindLive:!0,showAds:!1,interfaceLanguage:E8.RU,isCyrillicRelatedInterface:!0,logoClickable:!1,logoHidden:!1,isMobile:A8(),isMediaSessionEnabled:!0,isPictureInPictureEnabled:!0,isAudioDisabled:!1,callbacks:{uiInfo:{}},tuningConfig:{configName:[]},saveRate:!0,volumeMultiplier:1},ps=class extends HTMLElement{constructor(){var t;super();this.currentPlayingVideoIndex=0;this.needToRepeatPlaylist=!1;this.videoConfig=void 0;this.pictureInPictureApi=void 0;this.mediaSessionApi=void 0;this.unsubscribePlayerPhaseSubscription=void 0;this.annotationsApi=void 0;this.prevIsid=void 0;this.isInited=!1;this.createOneStat=(t,n={})=>{var y,b;let{albumId:o,statPlace:r,statUserSalt:l,statTrackCode:a,refreshStatAuthToken:s,autoplay:u,isMobile:f,refDomain:m,deviceId:h,interactiveData:w}=fs(this.videoConfig,n),g=(y=w==null?void 0:w.projectInfo)==null?void 0:y.pid,{unitedVideoId:C,isClip:v=!1}=t;if(this.uiConfig.features.statistics&&C)return new R8(lt({movieId:C,albumId:o,place:r,trackCode:a,autoplay:(b=u&&!this.interactiveController)!=null?b:!1,mobile:f,clip:v,refDomain:m,deviceId:h},g&&!this.isInited&&{projectId:Number(g)}),lt({refreshAuthToken:s,userSalt:l,config:this.statisticsConfig},this.interactiveController&&{useIsid:!0,isid:this.prevIsid}))};this.logger=new M8,this.log=this.logger.createComponentLog("VKVideoPlayer"),this.subscription=new V8,this.graphMadePause=!1,(t=window==null?void 0:window.videoPlayerConfig)!=null&&t.debugLogs&&this.subscription.add(this.logger.log$.subscribe(n=>{console.log("%c player web component ","background:#77dd77;",`${n.component}`,n.message)}))}connectedCallback(){var o,r;if(this.isInited)return;this.initPlayerRootContainers();let t=(o=this.getAttribute("stub-title"))!=null?o:void 0,n=(r=this.getAttribute("stub-thumb-url"))!=null?r:void 0;this.svelteStubComponent=new Fp({target:this.playerContainer,props:{title:t,thumbUrl:n}})}disconnectedCallback(){var t,n,o,r,l,a;(t=this.annotationsApi)==null||t.destroy(),(n=this.mediaSessionApi)==null||n.destroy(),(o=this.svelteRootComponent)==null||o.$destroy(),(r=this.svelteStubComponent)==null||r.$destroy(),this.subscription.unsubscribe(),(l=this.unsubscribePlayerPhaseSubscription)==null||l.call(this),(a=this.interactiveController)==null||a.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%",this.shadowRootContainer=document.createElement("div"),this.shadowRootContainer.style.position="absolute",this.shadowRootContainer.className="shadow-root-container",this.shadowRootContainer.style.width="100%",this.shadowRootContainer.style.height="100%",this._shadowRoot=this.shadowRootContainer.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(this.shadowRootContainer),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(t){var o;let n=(o=this.store)==null?void 0:o.ui.controls.disabledControls$;return(n==null?void 0:n.includes(t))||!1}getNextVideoInfo(){if(!this.videoConfig)return{nextVideoTitle:void 0,nextVideoThumb:void 0};let t=this.videoConfig.videos[this.currentPlayingVideoIndex+1]||{};return{nextVideoTitle:t.title,nextVideoThumb:t.thumbUrl}}createPlayer(t,n={},o){var Le,ct,me,tt,St,vt,Ue,Ft,Rt,Tt,oi;if(!this.videoConfig)return;let{albumId:r,statPlace:l,statAuthToken:a,preload:s,autoplay:u,volume:f,muted:m,fromTime:h,canRewindLive:w,supportLink:g,showAds:C,adsSlotId:v,adsParams:E={},adsPreviewParam:y,interfaceLanguage:b,isCyrillicRelatedInterface:P,logoClickable:A,logoHidden:M,isMobile:O,isAudioDisabled:te,isLiveCatchUpMode:_e,fullScreenTarget:Z,failoverHosts:x,canDownload:se,callbacks:L,interactiveData:K,showThumbTimer:J,additionalButtons:Y=[],repeat:F,saveRate:G,volumeMultiplier:X}=fs(this.videoConfig,n),{sources:le,title:qe,thumbUrl:Xe,unitedVideoId:Ee,isClip:Be=!1,duration:De,adsParams:xe={},videoEpisodes:ae,previewThumbsData:he,subtitles:ut,live:Ce}=t,Ke=lt(lt({},E),xe),_t=this.getNextVideoInfo(),Ye={sources:le,title:qe,thumbUrl:Xe,subtitles:ut,unitedVideoId:Ee,isClip:Be,live:Ce,albumId:r,statPlace:l,autoplay:u,muted:m,volume:f,fromTime:h,canRewindLive:w,showAds:C,adsSlotId:v,adsParams:Ke,adsPreviewParam:y,duration:De,logoClickable:A,logoHidden:M,isMobile:O,repeat:F,showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive(),endScreenVideoTitle:_t.nextVideoTitle,endScreenVideoThumb:_t.nextVideoThumb,isOneVideoPlaylist:this.isOneVideoPlaylist()},Ge={pictureInPictureApi:this.pictureInPictureApi,annotationsApi:this.annotationsApi};this.log({message:`create player, props: ${JSON.stringify(Ye)}`});let Ze=(Le=this.interactiveController)==null?void 0:Le.state.statistics$.getValue(),et=(Ze==null?void 0:Ze.oneStat)||this.createOneStat(t,n);et&&(this.statistics=new Zr(et,Ze==null?void 0:Ze.statSubscription)),this.uiConfig.features.sentry&&this.uiConfig.sentry.dsn&&new Do(this.uiConfig.sentry,{version:al,env:er},{movieId:Ee,albumId:r,place:l,autoplay:(ct=u&&!this.interactiveController)!=null?ct:!1,mobile:O,clip:Be}),this.interactiveController&&((tt=this.prevIsid)!=null||(this.prevIsid=(me=this.statistics)==null?void 0:me.oneStat.isid$.getValue())),this.sentry=lt(lt({},this.sentry),Do.getInstance());let Pe=!!K,We=[],re="tooltip_interactive_go_back_disabled_first";if(Pe&&this.interactiveController){let ft=this.interactiveController.state.isInitialChapter$.getValue(),rt=this.interactiveController.getHistoryState();ft&&We.push("REPLAY_BUTTON"),this.interactiveController.getIsSeekable().getValue()||We.push("SEEK_TO_INTERACTIVE_BUTTON"),rt.hasPrevChapter$.getValue()||(We.push("PLAY_PREV_CHAPTER_BUTTON"),ft||(rt.isGoBackLimited$.getValue()?re="tooltip_interactive_go_back_disabled_limit":re="tooltip_interactive_go_back_disabled"))}let Te=()=>{var rt;this.isInited=!1,this.prevIsid=void 0;let ft=(o==null?void 0:o.info.isEnded$.getValue())&&((rt=this.interactiveController)==null?void 0:rt.state.isEndChapter$.getValue());L.onReplayInteractiveVideo&&!ft?L.onReplayInteractiveVideo():this.replayInteractiveVideo()};this.store=gm({player:o,interfaceLanguage:b,isCyrillicRelatedInterface:P,videoId:Ee,isClip:Be,isLiveCatchUpMode:_e,isAudioDisabled:te,statAuthToken:a,callbacks:L,webApi:Ge,videoEpisodes:ae,previewThumbsData:he,canDownload:se,uiConfig:this.uiConfig,coreConfig:this.coreConfig,disabledControls:We,isInteractive:Pe,saveRate:G,interactiveRanges$:(St=this.interactiveController)==null?void 0:St.state.interactiveRanges$,isInteractiveTime$:(vt=this.interactiveController)==null?void 0:vt.state.isInteractiveTime$,replayInteractive:Te,playPrevChapterDisabledTooltip:re,hasInteractiveBranches:!!((Ft=(Ue=this.interactiveController)==null?void 0:Ue.getChapterBranches())!=null&&Ft.length),additionalButtons:this.uiConfig.features.additionalButtons?Y:[],looped:F&&this.videoConfig.videos.length===1,statistics:this.statistics});let{stores:ht}=this.microStoresRoot=Gp();this.subscription.add(this.store.state.currentFormat$.subscribe(ft=>{var rt;return(rt=L==null?void 0:L.onCurrentFormatChanged)==null?void 0:rt.call(L,ft)})),this.subscription.add(ht.interactiveControlsOpacity$.subscribe(ft=>{var rt;ft!==null&&((rt=this==null?void 0:this.interactiveController)==null||rt.setDisabledControls(ft))})),this.subscription.add(this.store.state.throughputEstimation$.subscribe(ft=>{var rt;return(rt=L==null?void 0:L.onThroughputEstimationChanged)==null?void 0:rt.call(L,ft)})),this.subscription.add(this.store.state.trafficSavingEnabled$.subscribe(ft=>{var rt;return(rt=L==null?void 0:L.onTrafficSavingEnabledChanged)==null?void 0:rt.call(L,ft)})),this.subscription.add(this.store.state.currentPlaybackRate$.subscribe(ft=>{var rt;return(rt=L==null?void 0:L.onCurrentPlaybackRateChanged)==null?void 0:rt.call(L,ft)})),this.subscription.add(this.store.state.volume$.subscribe(ft=>{var rt;return(rt=L==null?void 0:L.onVolumeChange)==null?void 0:rt.call(L,ft)})),this.subscription.add(this.store.state.muted$.subscribe(ft=>{var rt,be;return ft?(rt=L==null?void 0:L.onMute)==null?void 0:rt.call(L):(be=L==null?void 0:L.onUnmute)==null?void 0:be.call(L)})),this.subscription.add(this.store.state.videoBitrate$.subscribe(ft=>{var rt;return(rt=L==null?void 0:L.onVideoBitrateChanged)==null?void 0:rt.call(L,ft)})),this.subscription.add(this.store.state.isInteractiveTime$.subscribe(ft=>{var be;let rt=(be=this.store)==null?void 0:be.ui.controls.disabledControls$;rt&&(ft&&!rt.includes(Vl)&&rt.add(Vl),ft||rt.remove(Vl))})),this.subscription.add(this.store.ui.isFullscreen.subscribe(ft=>pt(this,null,function*(){var be;if(!L8.isSamsungBrowser||!ft||!this.interactiveController)return;document.fullscreenElement===this.shadowRootContainer&&(yield this.replayInteractiveChapter((be=this.videoConfig)==null?void 0:be.callbacks.onExternalFullscreenExit))}))),this.statistics&&this.subscription.add(this.statistics.oneStat.vsid$.subscribe(ft=>{var rt;return(rt=L==null?void 0:L.onVSIDChanged)==null?void 0:rt.call(L,ft)})),this.initMediaSession(),this.svelteRootComponent=new Bp({target:this.playerContainer,props:{interactiveContainer:this.interactiveContainer,sources:le,store:this.store,microStoresRoot:this.microStoresRoot,videoConfig:this.videoConfig,uiConfig:this.uiConfig,title:qe,thumbUrl:Xe,subtitles:ut,live:Ce,preload:s,autoplay:u,muted:m,volume:f,fromTime:h,canRewindLive:w,supportLink:g,showAds:C,adsSlotId:v,adsParams:Ke,adsPreviewParam:y,duration:De,logoClickable:A,logoHidden:M,isMobile:O,failoverHosts:x,fullScreenTarget:Z,saveRate:G,shadowRootContainer:this.shadowRootContainer,showMiniTimer:J,outerContainerRef:this.rootContainer,showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive(),endScreenVideoTitle:_t.nextVideoTitle,endScreenVideoThumb:_t.nextVideoThumb,isOneVideoPlaylist:this.isOneVideoPlaylist(),playNextVideo:()=>this.playNextVideo(),playPrevVideo:()=>this.playPrevVideo(),repeatPlaylist:()=>this.repeatPlaylist(),playPrevChapter:()=>this.playPrevChapter(),seekToInteractive:()=>this.seekToInteractive(),toggleGraph:()=>this.toggleGraph(),volumeMultiplier:X}}),this.addPlayerInfoSubscriptions(),this.isInited||(this.isInited=!0,(oi=(Tt=(Rt=this.videoConfig)==null?void 0:Rt.callbacks)==null?void 0:Tt.onInited)==null||oi.call(Tt))}addPlayerInfoSubscriptions(){var r;let t=this.store;if(!t)return;let n=(r=this.videoConfig)==null?void 0:r.callbacks;n&&this.subscription.add(t.playerPhase.subscribe(l=>{var a;return(a=n.onPlayerPhaseChanged)==null?void 0:a.call(n,l)})).add(t.state.playbackState$.subscribe(l=>{var a;return(a=n.onPlaybackStateChanged)==null?void 0:a.call(n,l)})).add(t.state.isLive$.subscribe(l=>{var a;return(a=n.onIsLiveChanged)==null?void 0:a.call(n,l)})).add(t.state.isActiveLive$.subscribe(l=>{var a;return(a=n.onIsActiveLiveChanged)==null?void 0:a.call(n,l)})).add(t.state.isAudioAvailable$.subscribe(l=>{var a;return(a=n.onIsAudioAvailableChanged)==null?void 0:a.call(n,l)})).add(t.state.currentQuality$.subscribe(l=>{var a;return(a=n.onCurrentQualityChanged)==null?void 0:a.call(n,l)})).add(t.state.availableQualities$.subscribe(l=>{var a;return(a=n.onAvailableQualitiesChanged)==null?void 0:a.call(n,l.map(({value:s})=>s).filter(s=>s!=="auto"))})).add(t.state.availableAudioStreams$.subscribe(l=>{l.length>1&&n.onAudioLanguagesAvailable&&n.onAudioLanguagesAvailable()})).add(t.ui.isPictureInPictureActive$.subscribe(l=>{var a,s;return l?(a=n.onPiPEnter)==null?void 0:a.call(n):(s=n.onPiPExit)==null?void 0:s.call(n)}));let o=n==null?void 0:n.uiInfo;o&&this.subscription.add(t.ui.controlsVisible.subscribe(l=>{var a;return(a=o.onControlsVisibleChanged)==null?void 0:a.call(o,l)})).add(t.ui.isMobile.subscribe(l=>{var a;return(a=o.onIsMobileChanged)==null?void 0:a.call(o,l)})).add(t.ui.playerSize.subscribe(l=>{var a;return(a=o.onPlayerSizeChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.prevButton.subscribe(l=>{var a;return(a=o.onPrevButtonChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.playButton.subscribe(l=>{var a;return(a=o.onPlayButtonChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.replayButton.subscribe(l=>{var a;return(a=o.onReplayButtonChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.nextButton.subscribe(l=>{var a;return(a=o.onNextButtonChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.playPrevChapterButton.subscribe(l=>{var a;return(a=o.onPlayPrevChapterChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.seekToInteractiveButton.subscribe(l=>{var a;return(a=o.onSeekToInteractiveButtonChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.interactiveGraphButton.subscribe(l=>{var a;return(a=o.onGraphButtonChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.liveButton.subscribe(l=>{var a;return(a=o.onLiveButtonChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.time.subscribe(l=>{var a;return(a=o.onTimeUpdateChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.episodes.subscribe(l=>{var a;return(a=o.onEpisodesChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.subtitles.subscribe(l=>{var a;return(a=o.onSubtitlesChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.settings.subscribe(l=>{var a;return(a=o.onSettingsChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.fullscreen.subscribe(l=>{var a;return(a=o.onFullscreenChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.chromecast.subscribe(l=>{var a;return(a=o.onChromecastChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.pip.subscribe(l=>{var a;return(a=o.onPipChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.vkLogo.subscribe(l=>{var a;return(a=o.onVkLogoChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.interactiveTimeIndicator.subscribe(l=>{var a;return(a=o.onInteractiveTimeIndicatorChanged)==null?void 0:a.call(o,l)})).add(t.ui.controls.timeline.subscribe(l=>{var a;return(a=o.onTimelineChanged)==null?void 0:a.call(o,l)}))}playNextVideo(){var n;if(!this.videoConfig)return;let t=!0;if((n=this.videoConfig.callbacks)!=null&&n.onNextVideoClick)try{t=this.videoConfig.callbacks.onNextVideoClick()}catch(o){this.log({message:"onNextVideoClick callback failed to execute"})}t&&(this.currentPlayingVideoIndex++,this.currentPlayingVideoIndex>=this.videoConfig.videos.length&&(this.currentPlayingVideoIndex=0),this.log({message:`play next video, index: ${this.currentPlayingVideoIndex}`}),this.createPlayerWithCurrentVideo())}playPrevVideo(){var n;if(!this.videoConfig)return;let t=!0;if((n=this.videoConfig.callbacks)!=null&&n.onPrevVideoClick)try{t=this.videoConfig.callbacks.onPrevVideoClick()}catch(o){this.log({message:"onPrevVideoClick callback failed to execute"})}t&&(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(t,n=!0){var r;if(!this.videoConfig)return;let o=this.videoConfig.videos[this.currentPlayingVideoIndex];if(!o){this.log({message:"no next video"});return}this.isInited&&Ac(o.unitedVideoId)&&this.store.actions.internal.nextMovie(o.unitedVideoId),(r=this.svelteRootComponent)==null||r.$destroy(),this.createPlayer(o,{autoplay:n,fromTime:0},t)}playPrevChapter(){var t;(t=this.interactiveController)==null||t.playPrevChapter()}seekToInteractive(){var n;let t=(n=this.interactiveController)==null?void 0:n.getNextInteractiveStartTime();typeof t=="number"&&this.seekTime(t/1e3)}toggleGraph(){var f,m;if(!this.isInited)return;let t=this.store,{isEnded$:n,playbackState$:o,graphIsOpened$:r}=t.state,{disabledControls$:l}=t.ui.controls,a=$e(n),s=$e(o);$e(r)?(r.set(!1),(f=this.interactiveController)==null||f.toggleGraphView(!1),l.remove(Ss),!a&&this.graphMadePause&&this.play()):(this.graphMadePause=s==="playing",r.set(!0),(m=this.interactiveController)==null||m.toggleGraphView(!0),l.add(Ss),!a&&this.graphMadePause&&this.pause())}initInteractives(){return pt(this,null,function*(){var t,n,o,r;if((t=this.videoConfig)!=null&&t.interactiveData)try{let{Interactives:l,EVENT_NAMES:a,CustomError:s}=yield import("@vkontakte/videoplayer-interactive");this.interactiveContainer=document.createElement("div"),this.interactiveContainer.classList.add("interactiveContainer");let u=(n=this.store)==null?void 0:n.interfaceLanguage$,f=u?$e(u):this.videoConfig.interfaceLanguage,{projectInfo:m,initChapterId:h,historyApi:w,videoLoader:g}=this.videoConfig.interactiveData;this.interactiveController=new l({parentElement:this.interactiveContainer,fullscreenTargetElement:this.playerContainer,lang:f,graph:this.uiConfig.features.interactiveGraph,projectInfo:m,initChapterId:h,historyApi:w,vkVideoLoader:g,lastFrame:this.uiConfig.features.interactiveLastFrame,permanentTextControls:this.uiConfig.features.interactiveTextPermanent,initSeamless:!0,config:this.uiConfig.interactive,coreConfig:this.coreConfig,createOneStat:this.createOneStat});let{isInteractiveExpectation$:C}=this.interactiveController.state;if(this.uiConfig.features.seekToInteractive&&this.subscription.add(this.interactiveController.getIsSeekable().subscribe(v=>{if(!this.isInited)return;let E=this.store;v?E.ui.controls.disabledControls$.remove("SEEK_TO_INTERACTIVE_BUTTON"):E.ui.controls.disabledControls$.add("SEEK_TO_INTERACTIVE_BUTTON")})),this.subscription.add(C.subscribe(v=>{this.store&&this.store.state.isInteractiveExpectation$.set(v)})),this.interactiveController.on(a.playerChanged,v=>{var b,P;if(!this.videoConfig)return;let E=(P=(b=this.interactiveController)==null?void 0:b.state.isFirstChapter$.getValue())!=null?P:!0;this.videoConfig.videos[this.currentPlayingVideoIndex]=Vt(lt({},v.config),{title:(m==null?void 0:m.title)||v.config.title});let y=E?this.videoConfig.autoplay:!0;this.createPlayerWithCurrentVideo(v.player,y)}),this.interactiveController.on(a.interactives,({type:v,actionType:E})=>{var b,P,A,M;if(!this.store)return;let y=C.getValue();if(v==="action-choice"&&E==="setRandomBranch"&&(this.store.state.graphIsOpened$.set(!1),this.store.ui.controls.disabledControls$.remove($l)),v==="action-choice-canceled"){let O=$e(this.store.state.isPlaying$)||y;if((b=this.videoConfig)!=null&&b.isMobile&&O){this.store.ui.interactiveHideMobileControls.set(!0);return}(M=(P=this.videoConfig)==null?void 0:(A=P.callbacks).onDisabledInteractiveClick)==null||M.call(A)}}),yield this.interactiveController.setManifest(this.videoConfig.interactiveData.manifest),(r=(o=this.videoConfig)==null?void 0:o.callbacks)!=null&&r.onInteractiveHistoryChanged){let v=this.interactiveController.getHistoryState();this.subscription.add(v.history$.subscribe(E=>{var y,b,P;E.length&&((P=(b=(y=this.videoConfig)==null?void 0:y.callbacks)==null?void 0:b.onInteractiveHistoryChanged)==null||P.call(b,E))}))}this.uiConfig.features.interactiveTimeIndicator&&this.subscription.add(this.interactiveController.events.noInteraction$.subscribe(()=>{var v,E,y,b;(v=this.microStoresRoot)==null||v.stores.showInteractiveTimeIndicatorTooltip$.set(!0,!0),(b=(E=this.videoConfig)==null?void 0:(y=E.callbacks).onInteractiveTimeIndicatorClick)==null||b.call(y)})),this.interactiveController.on(a.errors,v=>{this.log({message:v.toString()})})}catch(l){this.log({message:l.message})}})}initPlayer(t,n={}){var o,r,l,a,s,u,f,m,h,w,g,C,v,E,y,b,P,A,M;if(!Array.isArray(t.videos)||t.videos.length===0&&!t.interactiveData)throw new Error("empty videos");this.videoConfig=fs(B8,I8(t,O=>O instanceof HTMLElement?O:void 0)),this.uiConfig=Yc((o=n.ui)!=null?o:{}),this.coreConfig=(r=n.core)!=null?r:{configName:[]},this.statisticsConfig=(l=n.statistics)!=null?l:{},this.sentry={config:(a=this.uiConfig.sentry)!=null?a:{}},Ac(this.videoConfig.isMediaSessionEnabled)&&(this.uiConfig.features.mediaSession=(s=this.videoConfig.isMediaSessionEnabled)!=null?s:!0),Ac(this.videoConfig.isPictureInPictureEnabled)&&(this.uiConfig.features.pip=(f=(u=this.uiConfig.features.pip)!=null?u:this.videoConfig.isPictureInPictureEnabled)!=null?f:!0,this.uiConfig.features.dpip=(h=(m=this.uiConfig.features.dpip)!=null?m:this.videoConfig.isPictureInPictureEnabled)!=null?h:!0),this.videoConfig.isMobile=(w=this.uiConfig.isMobile)!=null?w:this.videoConfig.isMobile,(g=this.videoConfig).autoplay&&(g.autoplay=this.uiConfig.features.autoplay),this.videoConfig.showAds=(C=this.uiConfig.ads.enable)!=null?C:this.videoConfig.showAds,this.videoConfig.adsSlotId=(v=this.uiConfig.ads.slot)!=null?v:this.videoConfig.adsSlotId,this.videoConfig.adsPreviewParam=(E=this.uiConfig.ads.preview)!=null?E:this.videoConfig.adsPreviewParam,this.videoConfig.logoHidden=!((y=this.uiConfig.showLogo)!=null?y:!this.videoConfig.logoHidden),(b=this.videoConfig).canRewindLive&&(b.canRewindLive=this.uiConfig.features.liveRewind),this.videoConfig.supportLink=(P=this.videoConfig.supportLink)!=null?P:this.uiConfig.supportLink,this.currentPlayingVideoIndex=0,this.needToRepeatPlaylist=this.videoConfig.repeat,this.uiConfig.features.pip&&(this.uiConfig.features.dpip?this.pictureInPictureApi=cs.getLatestSupportedVersion():this.pictureInPictureApi=new No),this.mediaSessionApi=this.uiConfig.features.mediaSession?new us:void 0,this.annotationsApi=this.uiConfig.features.annotations?new ds:void 0,this.annotationsApi&&!this.uiConfig.features.annotationsInside&&this.annotationsApi.init(this.rootContainer),(A=this.svelteStubComponent)==null||A.$destroy(),(M=this.svelteRootComponent)==null||M.$destroy(),this.isInited=!1,this.prevIsid=void 0,this.interactiveController&&(this.interactiveController.destroy(),this.interactiveController=void 0),t.interactiveData?this.initInteractives():this.createPlayer(t.videos[0]),Up(this.pictureInPictureApi)&&this.pictureInPictureApi.setPlayerDomElement(this.playerContainer,this._shadowRoot)}isOneVideoPlaylist(){return this.videoConfig?this.videoConfig.videos.length===1:!1}updateNextVideos(t){var o;if(!this.videoConfig)return;this.log({message:`update next videos, videos: ${JSON.stringify(t)}`}),this.videoConfig.videos.splice(this.currentPlayingVideoIndex+1),this.videoConfig.videos.push(...t);let n=this.getNextVideoInfo();(o=this.svelteRootComponent)==null||o.$set({showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive(),endScreenVideoTitle:n.nextVideoTitle,endScreenVideoThumb:n.nextVideoThumb,isOneVideoPlaylist:this.isOneVideoPlaylist()})}initMediaSession(){var t,n;this.mediaSessionApi&&((t=this.unsubscribePlayerPhaseSubscription)==null||t.call(this),this.mediaSessionApi.clearSubscriptions(),this.unsubscribePlayerPhaseSubscription=(n=this.store)==null?void 0:n.playerPhase.subscribe(o=>{o==="video"?this.setupMediaSessionForVideo():o==="ads"&&this.setupMediaSessionForAds()}))}setupMediaSessionForVideo(){if(!(!this.videoConfig||!this.mediaSessionApi))try{let{title:t,thumbUrl:n}=lt({},this.videoConfig.videos[this.currentPlayingVideoIndex]),o=[["play",()=>this.play()],["pause",()=>this.pause()],["seekto",r=>this.seekTime(r.seekTime)]];this.videoConfig.videos.length>1&&(this.currentPlayingVideoIndex<this.videoConfig.videos.length-1&&o.push(["nexttrack",()=>this.playNextVideo()]),this.currentPlayingVideoIndex>0&&o.push(["previoustrack",()=>this.playPrevVideo()])),this.mediaSessionApi.setMetaData({title:t,thumbUrl:n}),this.mediaSessionApi.updateActionHandlers(o),this.mediaSessionApi.attachToStore(this.store)}catch(t){this.log({message:t.message})}}setupMediaSessionForAds(){if(!(!this.videoConfig||!this.mediaSessionApi))try{let t="\u0420\u0435\u043A\u043B\u0430\u043C\u0430",n=[["play",()=>this.play()],["pause",()=>this.pause()]];this.mediaSessionApi.setMetaData({title:t}),this.mediaSessionApi.updateActionHandlers(n),this.mediaSessionApi.attachToStore(this.store)}catch(t){this.log({message:t.message})}}play(){var t,n,o,r;this.isControlDisabled("PLAY_BUTTON")||(t=this.store)!=null&&t.playerPhase.is("LiveWaitingStart")||(n=this.store)!=null&&n.playerPhase.is("LiveWaitingRecover")||(o=this.store)!=null&&o.playerPhase.is("LiveWaitingRecord")||(this.log({message:"play"}),(r=this.svelteRootComponent)==null||r.play())}pause(){var t;this.log({message:"pause"}),(t=this.svelteRootComponent)==null||t.pause()}stop(){var n,o,r;if(!this.videoConfig)return;this.log({message:"stop"}),(n=this.svelteStubComponent)==null||n.$destroy(),(o=this.mediaSessionApi)==null||o.destroy();let t=this.videoConfig.videos[0];t&&((r=this.svelteRootComponent)==null||r.$destroy(),this.createPlayer(t))}setMuted(t){var n;this.log({message:`set muted, muted: ${t}`}),(n=this.svelteRootComponent)==null||n.setMuted(t)}setVolume(t){var n;this.log({message:`set volume, volume: ${t}`}),(n=this.svelteRootComponent)==null||n.setVolume(t)}setRepeat(t){var n;this.log({message:`set repeat, repeat: ${t}`}),this.needToRepeatPlaylist=t,(n=this.svelteRootComponent)==null||n.$set({needToRepeatPlaylist:this.needToRepeatPlaylist,showNextPrevButtons:this.needToShowNextPrevButtons(),nextButtonActive:this.isNextButtonActive(),prevButtonActive:this.isPrevButtonActive()})}seekTime(t){var n;this.isControlDisabled("TIMELINE")||(this.log({message:`seek time, time: ${t}`}),(n=this.svelteRootComponent)==null||n.seekTime(t))}seekEpisodeStartTime(t){var n;this.log({message:`seek episode start time, time: ${t}`}),(n=this.svelteRootComponent)==null||n.seekEpisodeStartTime(t)}returnFocusToEpisodes(){var t;this.log({message:"return focus to episodes button"}),(t=this.svelteRootComponent)==null||t.returnFocusToEpisodes()}setPlaybackRate(t){var n;this.log({message:`set playback rate to: ${t}`}),(n=this.svelteRootComponent)==null||n.setPlaybackRate(t)}setAutoQualityLimits(t){var n,o,r;this.log({message:`set auto quality limitation. Max: ${(n=t.max)!=null?n:"none"}. Min: ${(o=t.min)!=null?o:"none"}`}),(r=this.svelteRootComponent)==null||r.setAutoQualityLimits(t)}addLanguage(t){var n;(n=this.store)==null||n.actions.internal.addLanguage(t)}setLanguage(t){return pt(this,null,function*(){var n;yield(n=this.store)==null?void 0:n.actions.internal.setLanguage(t)})}setLiveStart(t){var n,o,r;this.log({message:"live started"}),(n=this.store)==null||n.actions.internal.setLiveWaitingRecover(!1),(o=this.store)==null||o.actions.internal.setLiveWaitingStart(!1),(r=this.svelteRootComponent)==null||r.$destroy(),this.createPlayer(t,{autoplay:!0})}setLiveWaitingRecover(){var t,n;this.log({message:"live waiting"}),(t=this.store)==null||t.actions.internal.setLiveWaitingRecover(!0),(n=this.store)==null||n.destroy()}setLiveWaitingRecord(){var t,n;this.log({message:"post live"}),(t=this.store)==null||t.actions.internal.setLiveWaitingRecord(!0),(n=this.store)==null||n.destroy()}setLiveEnd(t){var n,o,r;this.log({message:"live ended"}),(n=this.store)==null||n.actions.internal.setLiveWaitingRecover(!1),(o=this.store)==null||o.actions.internal.setLiveWaitingRecord(!1),(r=this.svelteRootComponent)==null||r.$destroy(),this.createPlayer(t,{autoplay:!1})}getDeviceId(){var t,n;return(n=(t=this.statistics)==null?void 0:t.oneStat.getDeviceId())!=null?n:void 0}replayInteractiveVideo(){this.interactiveController&&this.interactiveController.setChapter()}replayInteractiveChapter(t){return pt(this,null,function*(){var n;if(this.interactiveController&&((n=this.store)!=null&&n.state.positionExact$)){let{EVENT_NAMES:o}=yield import("@vkontakte/videoplayer-interactive"),r=$e(this.store.state.positionExact$),a=$e(this.store.state.interactiveEpisodes$).find(u=>!u.completed);this.interactiveController.once(o.playerChanged,()=>{a&&r>=a.time?this.seekTime(a.time):this.seekTime(r),t==null||t()});let s=this.interactiveController.getCurrentChapter();yield this.interactiveController.setChapter({chapterId:s.chapter.id,pushToHistory:!1})}})}showInteractiveIndicatorTooltip(t,n=!1){var o;(o=this.microStoresRoot)==null||o.stores.showInteractiveTimeIndicatorTooltip$.set(t,n)}switchToActiveLive(){var t;(t=this.store)==null||t.actions.internal.switchToActiveLive()}updateStatContext(t){this.statistics&&this.statistics.oneStat.updateContext(t)}};import{InterfaceLanguage as HO,VKNumericLanguage as zO,loadVKLangPack as UO}from"@vkontakte/videoplayer-shared";import{VideoQuality as WO,VideoFormat as jO}from"@vkontakte/videoplayer-core";var DO=()=>{window.customElements.define("vk-video-player",ps)};export{Ro as GridTypes,HO as InterfaceLanguage,al as VERSION,zO as VKNumericLanguage,jO as VideoFormat,WO as VideoQuality,UO as loadVKLangPack,DO as registerPlayerWebComponent};