@vkontakte/videoplayer-shared 1.0.100-dev.881304e5f.0 → 1.0.100-dev.a5a2d3fc3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es2015.cjs +3 -3
- package/es2015.esm.js +3 -3
- package/esnext.cjs +3 -3
- package/esnext.esm.js +3 -3
- package/evergreen.esm.js +3 -3
- package/package.json +1 -1
- package/types/types/index.d.ts +7 -1
package/evergreen.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.100-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.100-dev.a5a2d3fc3.0
|
|
3
|
+
* Mon, 24 Aug 2026 10:05:32 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-100/doc/
|
|
5
5
|
*/
|
|
6
|
-
var e=Object.defineProperty,t=e=>e;function n(e,n){this[e]=t.bind(null,n)}var r=(t,r)=>{for(var i in r)e(t,i,{get:r[i],enumerable:!0,configurable:!0,set:n.bind(r,i)})},i=`1.0.100-dev.881304e5f.0`;class a{subscriptions=[];unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(e=>{typeof e==`function`?e():e.unsubscribe()})}add(e){return this.subscriptions.push(e),this}}var o=e=>{throw Error(`${e} is value of unexpected type`)},s=e=>{},c=()=>{},l=e=>{throw console.error(e),e},u=e=>{console.error(e)};class d{suppressErrors=!1;constructor(e){e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?u:l,r;r=t?typeof t==`function`?{next:t,error:c}:{next:e=>t.next(e),error:e=>t.error?.(e)}:{next:n,error:c};let i=typeof e==`function`?{next:t=>{try{let n=e(t);n instanceof Promise&&n.catch(e=>r.next(e))}catch(e){r.next(e)}},error:e=>r.next(e)}:{next:t=>e.next(t),error:t=>e.error?e.error(t):r.next(t)},s;try{s=this._subscribe(i)}catch(e){i.error?.(e)}return new a().add(()=>{switch(i.next=c,i.error=c,typeof s){case`function`:s();return;case`object`:s.unsubscribe();return;case`undefined`:return;default:return o(s)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class f extends d{keyCounter=0;subscribers=new Map;constructor(){super()}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>t.error?.(e))}_subscribe(e){let t=this.keyCounter++;return this.subscribers.set(t,e),new a().add(()=>this.subscribers.delete(t))}}class p{log$=new f;logs=[];log=e=>{let t={...e,timestamp:Date.now()};this.logs.push(t),this.log$.next(t)};createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch{n={message:"error in `createCustomLog`",component:`Logger`}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>({component:e,...t}))}getAllLogs=()=>this.logs}function m(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function h(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function g(e){return e!=null}function _(e){return e==null}var v=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>g(t)));function y(e,t){if(!e?.length)throw Error(t)}function b(e,t){if(e?.length)throw Error(t)}var x=()=>globalThis,S=()=>globalThis,C=(e=x())=>!!(e.window&&e.screen),w=typeof x().performance?.now==`function`?()=>x().performance.now():()=>Date.now(),ee=()=>Math.trunc(w());function T(){var e=self,t=new Map;e.onmessage=function(n){var r=n.data;if(r.type===`ping`){e.postMessage({type:`ready`});return}if(r.type===`set`){var i=r.id;r.repeat?t.set(i,{repeat:!0,handle:e.setInterval(function(){e.postMessage({type:`tick`,id:i})},r.delay)}):t.set(i,{repeat:!1,handle:e.setTimeout(function(){t.delete(i),e.postMessage({type:`tick`,id:i})},r.delay)});return}var a=t.get(r.id);a&&(a.repeat?e.clearInterval(a.handle):e.clearTimeout(a.handle),t.delete(r.id))}}var te=()=>`'use strict';(${T.toString()})();`;class ne{worker;handlers;records=new Map;ticks=0;constructor(e,t){this.worker=e,this.handlers=t,this.worker.onmessage=this.handleMessage,this.worker.onerror=this.handleError,this.worker.onmessageerror=this.handleError,this.postCommand({type:`ping`})}static create(e){let t=x();if(typeof t.Worker!=`function`||typeof t.Blob!=`function`||_(t.URL?.createObjectURL))return null;let n=t.URL.createObjectURL(new t.Blob([te()],{type:`text/javascript`}));try{return new ne(new t.Worker(n),e)}catch{return null}finally{t.URL.revokeObjectURL(n)}}get activeCount(){return this.records.size}get deliveredTicks(){return this.ticks}set(e,t,n,r){this.records.set(e,{callback:t,repeat:r,delay:n,startedAt:w()}),this.postCommand({type:`set`,id:e,delay:n,repeat:r})}clear(e){this.records.delete(e)&&this.postCommand({type:`clear`,id:e})}destroy(){let e=new Map(this.records);return this.records.clear(),this.worker.onmessage=null,this.worker.onerror=null,this.worker.onmessageerror=null,this.worker.terminate(),e}postCommand(e){this.worker.postMessage(e)}handleMessage=e=>{if(e.data.type===`ready`){this.handlers.onReady();return}let{id:t}=e.data,n=this.records.get(t);_(n)||(this.ticks++,n.repeat||this.records.delete(t),n.callback())};handleError=()=>{this.handlers.onFatalError(this.destroy())}}var re;(e=>{e.SHARED=`shared`,e.CORE=`core`,e.STATISTICS=`statistics`,e.INTERACTIVE=`interactive`,e.UI=`ui`,e.UI_TV=`ui-tv`})(re||={});var ie;(e=>{e.IDLE=`idle`,e.STARTING=`starting`,e.READY=`ready`,e.FAILED=`failed`})(ie||={});var ae=1,E=0,D=`idle`,O=null,k=new Map,A=new Set,oe=e=>{let t=w();for(let[n,r]of e){let e=r.repeat?r.delay:Math.max(0,r.delay-(t-r.startedAt));de(n,r.callback,e,r.repeat)}},se=e=>{D=`failed`,O=null,oe(e)},ce=()=>{_(O)||(oe(O.destroy()),O=null),D=`idle`},le=()=>{D===`idle`&&(D=`starting`,O=ne.create({onReady:()=>{D=`ready`},onFatalError:se}))},ue=e=>A.has(e)?(le(),D===`ready`?O:null):null,de=(e,t,n,r)=>{let i=S();r?k.set(e,{repeat:!0,nativeId:i.setInterval(t,n)}):k.set(e,{repeat:!1,nativeId:i.setTimeout(()=>{k.delete(e),t()},n)})},fe=(e,t,n,r)=>{let i=ae++,a=ue(e);return _(a)?de(i,t,n,r):a.set(i,t,n,r),i},j=e=>{if(_(e))return;let t=k.get(e);if(_(t)){O?.clear(e);return}k.delete(e);let n=S();t.repeat?n.clearInterval(t.nativeId):n.clearTimeout(t.nativeId)},pe=e=>({setTimeout:(t,n=0)=>fe(e,t,n,!1),setInterval:(t,n=0)=>fe(e,t,n,!0),clearTimeout:j,clearInterval:j}),me=e=>{A.clear(),e.forEach(e=>A.add(e)),A.size===0&&ce()},he=e=>{E++,me(e)},ge=()=>{E!==0&&(E--,E===0&&me([]))},_e=()=>({workerModules:[...A],workerState:D,liveConsumers:E,activeWindowTimers:k.size,activeWorkerTimers:O?.activeCount??0,workerTicks:O?.deliveredTicks??0}),M=pe(`shared`),ve=(e,t,n)=>new Promise((r,i)=>{t.addEventListener(`abort`,()=>{s(),l.remove()});let a=()=>{s(),i(`error`)},o=()=>{s(),r()},s=()=>{c&&M.clearTimeout(c),l.removeEventListener(`load`,o),l.removeEventListener(`error`,a)},c;n&&(c=M.setTimeout(()=>{s(),i(`timeout`)},n));let l=document.createElement(`script`);l.addEventListener(`load`,o),l.addEventListener(`error`,a),l.src=e,document.head.appendChild(l)}),ye=(e,t)=>async(...n)=>{let r=t(...n),i=e.aborted,a;for(;!i&&!e.aborted;)try{let e=await r.next(a);i=e.done??!1,a=e.value}catch(e){await r.throw(e)}return a},be=(e,{start:t=0,factor:n=2,max:r=1/0,min:i=t,random:a=0}={})=>{let o=t;return o*=n**e,o*=1+(Math.random()*a*2-a),o=Math.round(o),o=Math.min(o,r),o=Math.max(o,i),o},xe={};r(xe,{set:()=>we,remove:()=>Ee,isPersistent:()=>Se,has:()=>Te,get:()=>Ce,clear:()=>De});var N,P,F=`vk-videoplayer-dummy-key-${Math.random()}`,I=()=>{if(P!==void 0)return P;try{localStorage.setItem(F,`test`),localStorage.removeItem(F),P=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(F),P=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)P=2;else throw e}else throw e}return P===2&&(N=new Map),P},Se=()=>I()===0,Ce=e=>{let t=I();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return N?.get(e);default:o(t)}},we=(e,t)=>{let n=I();switch(n){case 0:try{localStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 1:try{sessionStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 2:N?.set(e,t);return;default:o(n)}},Te=e=>{let t=I();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return N?.has(e)??!1;default:return o(t),!1}},Ee=e=>{let t=I();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:N?.delete(e);return;default:o(t)}},De=()=>{let e=I();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return N?.clear();default:o(e)}},Oe=()=>{let e,t=[],n=x();try{e=n.self!==n.top}catch(t){t instanceof DOMException&&t.name===`SecurityError`?e=!0:(e=!1,console.error(t))}try{n.location?.ancestorOrigins&&(t=[...n.location.ancestorOrigins])}catch(e){console.error(e)}try{!t.length&&n.document.referrer&&(t=[new URL(n.document.referrer).origin])}catch(e){console.error(e)}return t=t.filter(e=>URL.canParse(e)),{isEmbed:e,origins:t,topOrigin:t.at(-1),immediateOrigin:t.at(0)}},ke;(e=>{e.INVARIANT=`Invariant quality`,e.Q_144P=`144p`,e.Q_240P=`240p`,e.Q_360P=`360p`,e.Q_480P=`480p`,e.Q_576P=`576p`,e.Q_720P=`720p`,e.Q_1080P=`1080p`,e.Q_1440P=`1440p`,e.Q_2160P=`2160p`,e.Q_4320P=`4320p`})(ke||={});var L={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"576p":{width:1024,height:576},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},Ae=(e,t)=>L[e].height>L[t].height,je=(e,t)=>L[e].height>=L[t].height,R=(e,t)=>L[e].height<L[t].height,Me=(e,t)=>L[e].height<=L[t].height,Ne=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:R(e,t)?1:-1)[0],Pe=Object.keys(L).sort((e,t)=>R(e,t)?-1:1),Fe=(e,t=.02)=>[...Pe].find(n=>L[n].height*(1+t)>=e),Ie=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return Pe.find(e=>{let t=L[e];return t.width>=r&&t.height>=n})},Le=e=>L[e].height,z=e=>e===`Invariant quality`,Re=e=>e.every(e=>!z(e));function ze(e){if(z(e))throw Error(`Expected exact quality`)}var Be=e=>{switch(e){case`4320p`:return`8K`;case`2160p`:return`4K`;case`1440p`:return`QHD`;case`1080p`:return`FHD`;case`720p`:return`HD`;default:return``}},B=(e,t)=>{let n={};for(let r of Object.keys(t)){let i=t[r],a=e[r];Array.isArray(i)?n[r]=Array.isArray(a)?a:i:typeof i==`object`&&i?typeof a==`object`&&a&&!Array.isArray(a)?n[r]=B(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},Ve=e=>{let t=``;return e>=3600&&(t+=Math.floor(e/3600)+`h`,e%=3600),e>=60&&(t+=Math.floor(e/60)+`m`,e%=60),e>0&&(t+=Math.floor(e)+`s`),t};function V(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof x().requestAnimationFrame==`function`;n&&(u=!!n.leading,d=`maxWait`in n,a=n?.maxWait?Math.max(+n?.maxWait||0,t):a,f=`trailing`in n?!!n.trailing:f);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(s&&x().cancelAnimationFrame(s),x().requestAnimationFrame(e)):M.setTimeout(e,t)}function g(e){if(p){x().cancelAnimationFrame(e);return}M.clearTimeout(e)}function _(e){return l=e,s=h(b,t),u?m(e):o}function v(e){let n=e-c,r=e-l,i=t-n;return d?Math.min(i,a-r):i}function y(e){let n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function b(){let e=Date.now();if(y(e))return S(e);s=h(b,v(e))}function S(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function C(){s!==void 0&&g(s),l=0,r=c=i=s=void 0}function w(){return s===void 0?o:S(Date.now())}function ee(){return s!==void 0}function T(...e){let n=Date.now(),a=y(n);if(r=e,i=this,c=n,a){if(s===void 0)return _(c);if(d)return s=h(b,t),m(c)}return s===void 0&&(s=h(b,t)),o}return T.cancel=C,T.flush=w,T.pending=ee,T}var He=(e,t=0,n)=>V(e,t,{leading:!0,trailing:!0,...n,maxWait:t}),H=(e,t)=>{if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let r in e){if(typeof t==`function`){let i=t(e[r],r,e,n);if(i!==void 0){n[r]=i;continue}}typeof e[r]==`object`?n[r]=H(e[r],t):n[r]=e[r]}return n},Ue=e=>H(e);class We extends f{bufferSize;buffer=[];cursorEnd=-1;cursorStart=0;constructor(e){super(),this.bufferSize=e,this.buffer=Array(e)}next(e){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=e,this.subscribers.forEach(t=>t.next(e))}_subscribe(e){for(let t=this.cursorStart;t<=this.cursorEnd;t++)e.next(this.buffer[t%this.bufferSize]);let t=this.keyCounter++;return this.subscribers.set(t,e),new a().add(()=>this.subscribers.delete(t))}}class U extends f{value;constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let t=super._subscribe(e);return e.next(this.value),t}}function Ge(e){return new d(t=>{let n={},r=Object.keys(e).length,i=e=>i=>{e in n||r--,n[e]=i,r===0&&t.next(n)};return Object.entries(e).reduce((e,[t,n])=>e.add(n.subscribe(i(t))),new a)})}function Ke(...e){return new d(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new a))}var qe=e=>new d(t=>{let n=M.setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>M.clearTimeout(n)}),Je=e=>new d(t=>{let n=M.setInterval(()=>t.next(),e);return()=>{n&&=(M.clearInterval(n),void 0)}});function Ye(e){return new d(t=>{if(e instanceof Promise){let n=!1;return e.then(e=>{n||t.next(e)}).catch(e=>{n||t.error?.(e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var Xe=Ye,Ze=(e,t)=>new d(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Qe extends a{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function $e(e){return t=>new d(n=>t.subscribe(new et(n,e)))}class et{destination;size;lastValues=[];constructor(e,t){this.destination=e,this.size=t}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){this.destination.error?.(e)}}var tt={leading:!1,trailing:!0};function nt(e,t=tt){return n=>new d(r=>n.subscribe(new rt(r,e,t)))}class rt{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,g(this.timeout)?M.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=M.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(e){if(this.destination.error)this.destination.error(e);else throw e}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}}var it={leading:!0,trailing:!1};function at(e,t=it){return n=>new d(r=>n.subscribe(new ot(r,e,t)))}class ot{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,_(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=M.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}}function st(e){return t=>new d(n=>t.subscribe(new ct(n,e)))}class ct{destination;predicate;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}var lt=(e,t)=>{let n=(e,t)=>{let n=Object.keys(e);for(let r in t)if(!n.includes(r)||t[r]!==e[r])return!1;return!0};return n(e,t)&&n(t,e)},ut=(e,t)=>e instanceof Object&&t instanceof Object?lt(e,t):e===t;function dt(e=ut){return t=>new d(n=>t.subscribe(new pt(n,e)))}var ft={};class pt{destination;predicate;lastValue=ft;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===ft||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?{...e}:e}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function mt(e){return t=>new d(n=>t.subscribe(new ht(n,e)))}class ht{destination;mapper;constructor(e,t){this.destination=e,this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(e){throw this.error(e),e}this.destination.next(t)}error(e){this.destination.error?.(e)}}function gt(e){return mt(()=>e)}function _t(){return e=>new d(t=>{let n=!1,r=!1,i=e.subscribe(e=>{n||(n=!0,t.next(e)),r&&i.unsubscribe()},e=>{n=!0,t.error?.(e),r&&i.unsubscribe()});return r=!0,n&&i.unsubscribe(),i})}function vt(){return e=>new d(t=>e.subscribe(new yt(t)))}class yt{destination;last;hasLast=!1;constructor(e){this.destination=e}next(e){let t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){this.destination.error?.(e)}}function bt(e){return t=>new d(n=>t.subscribe(new xt(n,e)))}class xt{destination;effect;constructor(e,t){this.destination=e,this.effect=t}next(e){try{this.effect(e)}catch(e){throw this.error(e),e}this.destination.next(e)}error(e){this.destination.error?.(e)}}function St(e){return t=>new d(n=>t.subscribe(new Ct(n,e)))}class Ct{destination;count;constructor(e,t){this.destination=e,this.count=t,t<0&&this.destination.error?.(Error(`Count can not be less than zero`))}next(e){this.count===0?this.destination.next(e):this.count--}error(e){this.destination.error?.(e)}}function wt(e=0){return t=>{let n=0,r=new We(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new d(e=>(n++,a(r.subscribe(e))))}}var Tt=300,Et=(e,t=Tt)=>new d(n=>{let r=x(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!C(r))return;let o=new r.ResizeObserver(He(e=>{let t=e[0];if(!t)return;let r,i;t.contentBoxSize&&t.contentBoxSize[0]?(i=t.contentBoxSize[0].blockSize,r=t.contentBoxSize[0].inlineSize):t.contentRect&&(r=t.contentRect.width,i=t.contentRect.height),g(r)&&g(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),W=(e,t=6,n=`.`)=>{let r={};for(let i in e)if(!(!e.hasOwnProperty(i)||e[i]instanceof HTMLElement||!t))if(typeof e[i]==`object`&&e[i]!==null){let a=W(e[i],t-1);for(let e in a)a.hasOwnProperty(e)&&(r[i+n+e]=a[e])}else r[i]=e[i];return r},Dt=e=>{e.innerHTML=``,e.removeAttribute(`src`),e.load()},Ot=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},kt=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),At=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),jt=e=>e!==void 0&&e!==``?e:At().toString();function Mt(e,t,n){if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];let r=1;for(;r<t.length&&t[r]<e;)r++;r>=t.length&&(r=t.length-1);let i=t[r-1],a=t[r],o=n[r-1],s=n[r];return e===i?o:e===a?s:o+(e-i)/(a-i)*(s-o)}function Nt(e,t,n){if(e<=0||n<0)return[];let r=[],i=Math.floor((e-1)/2),a=Math.floor(e/2),o=t-i,s=t+a;o<0&&(s+=Math.abs(o),o=0),s>n&&(o-=s-n,s=n),o=Math.max(0,o),s=Math.min(n,s);for(let e=o;e<=s;e++)r.push(e);return r}var Pt=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),Ft=e=>{if(!Pt(e))throw e};function It(e){if(e&&typeof e==`object`){if(`message`in e)return String(e.message);try{return JSON.stringify(e)}catch{return`object serialization error`}}return String(e)}class G{buffer;writeIndex=0;count=0;capacity;constructor(e){if(e<=0)throw Error(`Capacity must be greater than 0`);this.capacity=e,this.buffer=Array.from({length:e}).fill(null)}add(e){this.buffer[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.count<this.capacity&&this.count++}*[Symbol.iterator](){if(this.count===0)return;let e=this.count<this.capacity?0:this.writeIndex;for(let t=0;t<this.count;t++){let t=this.buffer[e];g(t)&&(yield t),e=(e+1)%this.capacity}}clear(){this.buffer.fill(null),this.writeIndex=0,this.count=0}get size(){return this.count}get maxCapacity(){return this.capacity}}var Lt=e=>(t,n=!1)=>r=>{let i=typeof r==`object`;r==null||i&&!Object.keys(r).length||e(t,i?W(r):{value:r},n)},K=(e={})=>{let t=e=>{let t=e;return e===void 0?t=`undefined`:e===null?t=`null`:(typeof e==`number`||typeof e==`boolean`)&&(t=e.toString()),t},n={};for(let r in e)Array.isArray(e[r])?n[r]=e[r].map(t):n[r]=t(e[r]);return n};class q{dynamicImportTimeout=5e3;subscription=new a;options;span;context;childTracers=[];initPromise;getRootTracerContext;eventsBuffer=null;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t,getRootTracerContext:n,options:r}){this.options=r??{};let{tracerEventsBufferSize:i}=this.options;g(i)&&i>0&&(this.eventsBuffer=new G(i)),q.dynamicImportStatus===`not_started`&&(q.dynamicImportPromise=this.loadOpentelemetry());let a=Date.now();this.initPromise=q.dynamicImportPromise.then(r=>{q.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t,getRootTracerContext:n},a)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(_(i))return;let{opentelemetryApi:a}=q.dynamicImports,{context:o,trace:s}=a,{tracer:c,attributes$:l}=i;this.span=c.startSpan(e,{startTime:r},t?.()),this.context=s.setSpan(o.active(),this.span),this.getRootTracerContext=n,this.subscription.add(l.subscribe(e=>{g(e)&&this.span.setAttributes(e)}))}async loadOpentelemetry(){if(q.dynamicImportStatus===`not_started`){q.dynamicImportStatus=`in_progress`;try{let e=new Promise((e,t)=>M.setTimeout(t,this.dynamicImportTimeout)),t=Promise.all([import(`@opentelemetry/api`),import(`@opentelemetry/sdk-trace-web`),import(`@apptracer/opentelemetry`),import(`@opentelemetry/resources`),import(`@opentelemetry/semantic-conventions`)]),[n,r,i,a,o]=await Promise.race([t,e]);q.dynamicImports={opentelemetryApi:n,opentelemetrySdk:r,tracer:i,opentelemetryResources:a,opentelemetrySemanticConventions:o},q.dynamicImportStatus=`completed`}catch{q.dynamicImportStatus=`failed`}}}isComponentTracerNotInitialized(){return _(this.span)||q.dynamicImportStatus===`failed`}addEventToBuffer(e,t,n,r){g(this.eventsBuffer)&&this.eventsBuffer.add({name:e,attributes:t,type:n,timestamp:r})}addEventToSpan(e,t,n,r){this.span.addEvent(e,{...K(t),type:n},r)}log(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`log`,r)}):this.addEventToBuffer(e,t,`log`,r)}error(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`error`,r)}):this.addEventToBuffer(e,t,`error`,r)}critical(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`critical`,r)}):this.addEventToBuffer(e,t,`critical`,r)}createComponentTracer(e){let t=new q({name:e,getParentContext:()=>this.context,getRootTracerContext:()=>this.getRootTracerContext?.(),options:this.options});return this.childTracers.push(t),t}setSpanAttributes(e){this.span.setAttributes(K(e))}end(){this.initPromise.then(e=>{if(!this.isComponentTracerNotInitialized()){if(g(this.eventsBuffer))for(let e of this.eventsBuffer)this.addEventToSpan(e.name,e.attributes,e.type,e.timestamp);this.childTracers.forEach(e=>e.end()),this.span.end(),this.subscription.unsubscribe()}})}pause(){this.getRootTracerContext?.()?.paused$.next(!0)}resume(){this.getRootTracerContext?.()?.paused$.next(!1)}}var Rt=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`,zt=e=>{class t extends e{_isPaused=!1;_pausedSpans;maxExportBatchSize;maxQueueSize;constructor(e,t){super(e,t),this.maxQueueSize=t?.maxQueueSize??2048,this.maxExportBatchSize=t?.maxExportBatchSize??512,this._pausedSpans=new G(this.maxQueueSize)}pause(){this._isPaused=!0}async resume(){if(!this._isPaused)return;this._isPaused=!1;let e=this._pausedSpans;this._pausedSpans=new G(this.maxQueueSize);let t=0;for(let n of e)super.onEnd(n),t+=1,t>=this.maxExportBatchSize&&(await new Promise(e=>M.setTimeout(()=>e(void 0),0)),t=0);e.clear(),await this.forceFlush()}onEnd(e){if(this._isPaused){this._pausedSpans.add(e);return}super.onEnd(e)}}return t};class Bt extends q{attributes$=new U(null);paused$=new U(!1);constructor(e){super({name:`Root`,options:e}),this.paused$.next(!!this.options.tracerPausedAtInit)}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:a,opentelemetrySdk:o,opentelemetrySemanticConventions:s}=q.dynamicImports,{TracerUploadSpanExporter:c}=r,{WebTracerProvider:l,BatchSpanProcessor:u}=o,{resourceFromAttributes:d}=a,{ATTR_SERVICE_NAME:f,ATTR_SERVICE_VERSION:p}=s,m=new(zt(u))(new c({appToken:Rt}));this.subscription.add(this.paused$.subscribe(e=>{e?m.pause():m.resume()}));let h=new l({resource:d({[f]:`videoplayer-sdk-web`,[p]:i}),spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0},spanProcessors:[m]});h.register();let g=h.getTracer(`sdk-videoplayer-tracer`);super.init({name:e,getParentContext:t,getRootTracerContext:()=>({tracer:g,attributes$:this.attributes$,paused$:this.paused$})},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}setSpanAttributes(e){this.attributes$.next({...this.attributes$.getValue(),...K(e)})}addSubscription(e){this.subscription.add(e)}}class Vt{fakeTraceId;constructor(e){}log(e,t,n){}error(e,t,n){}critical(e,t,n){}createComponentTracer(e){return new Vt({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}pause(){}resume(){}}var Ht=()=>!0,J={level:0,filter:Ht,name:`Noname Tracer`,outputMethod:`log`};class Ut{name;filter=Ht;level=J.level;outputMethod=J.outputMethod;childTracers=[];constructor({name:e,level:t,filter:n,outputMethod:r}={}){this.filter=n??this.filter,this.level=t??this.level,this.outputMethod=r??this.outputMethod,this.name=e??J.name}log(e,t,n){this.logDebug(e,t)}error(e,t,n){this.logError(e,t)}critical(e,t,n){this.logError(e,t)}createComponentTracer(e){let t=new Ut({filter:this.filter,level:this.level,name:`${this.name}/ ${e}`,outputMethod:this.outputMethod});return this.childTracers.push(t),t}end(){this.childTracers.forEach(e=>e.end()),this.childTracers=[]}setLevel(e){this.level=e,this.childTracers.forEach(t=>t.setLevel(e))}setOtputMethod(e){this.outputMethod=e,this.childTracers.forEach(t=>t.setOtputMethod(e))}setFilter(e){this.filter=e,this.childTracers.forEach(t=>t.setFilter(e))}getFinishedSpans(){}getTraceId(){return`debug_trace`}get verbose(){return this.level===0}createMessage(e,t){return[this.name,e,JSON.stringify(t)].join(`: `)}logDebug(e,t){!this.verbose||!this.filter(e,t)||x().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&x().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}pause(){}resume(){}}class Wt{static createRootTracer(e=`fake`,t){switch(e){case`real`:return new Bt(t);case`debug`:return new Ut;default:return new Vt}}}var Gt;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.UI=`ui`,e.CALL_FROM_EXTERNAL=`call_from_external`,e.FATAL=`fatal`})(Gt||={});var Y;(e=>{e.Armenian=`58`,e.Azerbaijani=`57`,e.Belarusian=`114`,e.English=`3`,e.Kazakh=`97`,e.Portuguese=`73`,e.Russian=`0`,e.Spanish=`4`,e.Ukrainian=`1`,e.Uzbek=`65`,e.Vietnamese=`75`})(Y||={});var Kt=`vk.ru`,qt=async(e,t,n)=>{let r=new URL(`https://${Kt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),Jt(await(await fetch(r.toString())).json(),n)},Jt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),Yt(n)])),Yt=e=>Array.isArray(e)?e[0]:e,Xt;(e=>{e.RU=`ru`,e.EN=`en`})(Xt||={});var X=`__vk_vp_internals_exposure`;class Zt{playerId;type;constructor(e,t){this.playerId=t,this.type=e,this.initWindowObjects()}getWindowObject(){if(typeof window>`u`)return{};let e=this.playerId,t=this.type;return window[X]?.[e]?.[t]??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[X]||(window[X]={}),window[X][e]||(window[X][e]={}),window[X][e][t]||(window[X][e][t]={})}expose(e){typeof window>`u`||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[X]&&window[X][e]&&window[X][e][t]&&(delete window[X][e][t],Object.keys(window[X][e]).length||delete window[X][e],Object.keys(window[X]).length||delete window[X])}}var Qt={};r(Qt,{subscribe:()=>nn,push:()=>tn,destroy:()=>en,create:()=>$t});var Z=new Map,$t=(e,t)=>Z.set(e,t??[]),en=e=>Z.delete(e),tn=(e,t)=>{let n=Z.get(e);n&&(typeof n==`function`?n(t):n.push(t))},nn=(e,t)=>{let n=Z.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);Z.set(e,t)}},rn=e=>v({id:e.id,message:e.message,category:e.category,data:an(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function an(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var on=e=>{let t=e.thrown instanceof Error?e.thrown:Error(e.message),n=e.id.length>10240?e.id.substring(0,10240):e.id;try{t.name=n}catch{t=Error(e.message),t.name=n}return t},sn=()=>{try{let{origin:e,pathname:t,search:n,hostname:r}=x()?.document?.location??{};return!r||r===`localhost`?void 0:{url:e+t,...new URLSearchParams(n).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{})}}catch{}};class Q{static tracerErrorMap=new Map;static appTracerModule=null;static loadPromise=null;dynamicImportTimeout=5e3;componentName;subscription=new a;options;envParams;context;isEmbed;embedParent;beforeInitErrors=[];constructor(e,t,n,r){this.componentName=e,this.options=t,this.envParams=n,this.context={...r};let{isEmbed:i,topOrigin:a}=Oe();this.isEmbed=i,this.embedParent=a?new URL(a).hostname:void 0,this.options.enabled&&(this.loadModule(),this.init())}updateContext(e){Object.assign(this.context,e)}error(e,t){let n=Q.tracerErrorMap.get(this.componentName);if(!n){this.beforeInitErrors.push([e,t]);return}let{blackErrorCategoryList:r,blackErrorIdList:i,sampleRate:a,whiteErrorCategoryList:o,whiteErrorIdList:s}=this.options,{id:c,category:l}=e;if(!(r.length&&r.includes(l)||i.length&&i.includes(c)||o.length&&!o.includes(l)||s.length&&!s.includes(c)||Math.random()>=a))try{let r=on(e);n?.error(r,{crashIdSource:t?.crashIdSource??r.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),...t?.issueKey?{issueKey:t.issueKey}:{},keys:{...this.context,...rn(e),...sn(),...this.isEmbed&&this.embedParent&&{iframe_host:this.embedParent}}})}catch(e){console.error(e)}}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}async init(){try{if(await Q.loadPromise,Q.tracerErrorMap.has(this.componentName)||_(Q.appTracerModule))return;let{appTracerModule:e}=Q,{initTracerError:t,initTracerErrorUploader:n,getTracerModules:r}=e,i=r(this.componentName),a=!i.error,o=i.error??t(this.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});g(this.options.userId)&&o.setUserId(this.options.userId),a&&n(this.componentName,{appToken:Rt,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),Q.tracerErrorMap.set(this.componentName,o),this.beforeInitErrors.forEach(e=>this.error.apply(this,e)),this.beforeInitErrors=[]}catch(e){console.error(e)}}loadModule(){g(Q.loadPromise)||(Q.loadPromise=(async()=>{try{let e=new Promise((e,t)=>M.setTimeout(t,this.dynamicImportTimeout));Q.appTracerModule=await Promise.race([e,import(`@apptracer/sdk/lite`)])}catch(e){Q.loadPromise=null,console.error(e)}})())}}class cn{options;symbol;constructor(e,t){this.options=t,this.symbol=Symbol(e)}}var ln=()=>{let e=new Map,t=new Map,n=new Map,r=new Map,i=new Set;return{resolve(e){if(!r.has(e)){let t=n.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);r.set(e,new t)}return r.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){r.forEach((t,n)=>{t instanceof e&&r.delete(n)}),n.set(e,t)},getToken(n){if(e.has(n.symbol))return e.get(n.symbol);if(t.has(n.symbol)){let r=t.get(n.symbol)();return e.set(n.symbol,r),r}if(n.options?.factory){let t=n.options.factory();return e.set(n.symbol,t),t}throw Error(`No value registered in DI container for token "${n.symbol.description}"`)},registerToken(t,n){e.set(t.symbol,n)},registerFactory(e,n){t.set(e.symbol,n)},hasToken(n){return e.has(n.symbol)||t.has(n.symbol)||!!n.options?.factory},registerCleanup(e){i.add(e)},clear(){i.forEach(e=>e()),i.clear(),e.clear(),t.clear(),r.clear(),n.clear()}}};class un{_inputNode;_outputNode;_plugins=[];_destination=null;_taps=[];constructor(e){this._inputNode=e.createGain(),this._outputNode=e.createGain()}get input(){return this._inputNode}get plugins(){return this._plugins}connectTo(e){this._destination=e,this.rebuild()}addTap(e){this._taps.push(e),this._outputNode.connect(e)}hasPlugin(e){return this._plugins.some(t=>t.id===e)}addPlugin(e){this.hasPlugin(e.id)||(this._plugins.push(e),this.rebuild())}removePlugin(e){let t=this._plugins.findIndex(t=>t.id===e);t!==-1&&(this._plugins.splice(t,1),this.rebuild())}rebuild(){this._inputNode.disconnect();for(let e of this._plugins)e.outputNode.disconnect();this._outputNode.disconnect();let e=this._inputNode;for(let t of this._plugins)e.connect(t.inputNode),e=t.outputNode;e.connect(this._outputNode),this._destination!==null&&this._outputNode.connect(this._destination);for(let e of this._taps)this._outputNode.connect(e)}}class dn{_pluginChain;_element;_ctx;_sourceNode=null;_isBound=!1;constructor(e,t,n){this._element=e,this._ctx=t,this._pluginChain=new un(t),this._pluginChain.connectTo(n)}get isBound(){return this._isBound}get plugins(){return this._pluginChain.plugins}bind(){this._isBound||=(this._sourceNode===null&&(this._sourceNode=this._ctx.createMediaElementSource(this._element)),this._sourceNode.disconnect(),this._sourceNode.connect(this._pluginChain.input),!0)}unbind(){this._isBound&&=(this._sourceNode?.disconnect(),this._sourceNode?.connect(this._ctx.destination),!1)}addPlugin(e){this._pluginChain.addPlugin(e)}removePlugin(e){this._pluginChain.removePlugin(e)}addAnalyser(e){this._pluginChain.addTap(e)}}class fn{_ctx=null;_masterGain=null;_connections=new Map;_contextEnabled=!1;_boundBeforeDisable=new Set;static isSupported(){let e=x();return g(e.AudioContext??e.webkitAudioContext)}get context(){if(_(this._ctx)){let e=x(),t=e.AudioContext??e.webkitAudioContext;this._ctx=new t}return this._ctx}get contextState(){return this._contextEnabled?this._ctx?.state??`suspended`:`suspended`}async enableContext(){this.ensureContext(),await this._ctx?.resume(),this._contextEnabled=!0;for(let e of this._boundBeforeDisable)this._connections.get(e)?.bind();this._boundBeforeDisable.clear()}async disableContext(){this._contextEnabled=!1;for(let[e,t]of this._connections)t.isBound&&(this._boundBeforeDisable.add(e),t.unbind())}async connectSource(e){this.ensureContext(),this._contextEnabled=!0,await this._ctx?.resume();let t=this._connections.get(e);if(t!==void 0){t.isBound||t.bind();return}let n=new dn(e,this.context,this._masterGain);n.bind(),this._connections.set(e,n)}disconnectSource(e){this._connections.get(e)?.unbind()}isSourceConnected(e){return this._connections.get(e)?.isBound??!1}addPlugin(e,t){let n=this._connections.get(e);if(n===void 0)throw Error(`Source is not connected. Call connectSource() first.`);n.addPlugin(t)}removePlugin(e,t){this._connections.get(e)?.removePlugin(t)}getPlugins(e){return this._connections.get(e)?.plugins??[]}createAnalyser(e){let t=this._connections.get(e);if(t===void 0)return null;let n=this.context.createAnalyser();return n.fftSize=256,n.smoothingTimeConstant=.8,t.addAnalyser(n),n}setMasterVolume(e){this._masterGain!==null&&(this._masterGain.gain.value=e)}getMasterVolume(){return this._masterGain?.gain.value??1}dispose(){this._connections.clear(),this._boundBeforeDisable.clear(),this._masterGain=null,this._contextEnabled=!1,this._ctx?.close(),this._ctx=null}ensureContext(){let e=this.context;_(this._masterGain)&&(this._masterGain=e.createGain(),this._masterGain.gain.value=1,this._masterGain.connect(e.destination))}}class pn{id=`volume-fader`;_gainNode;_duration;_curve;_fade=null;constructor(e,t){this._gainNode=e.createGain(),this._gainNode.gain.value=1,this._duration=t.duration,this._curve=t.curve??this._buildEasingCurve(t.duration/1e3)}get inputNode(){return this._gainNode}get outputNode(){return this._gainNode}get faded(){return this._fade!==null}appear(){this._startFade(0,1)}disappear(){this._startFade(1,0)}pause(){if(this._fade===null)return;let e=this._gainNode.gain,t=this._gainNode.context.currentTime,n=t-this._fade.startTime,r=Math.max(0,this._fade.remaining-n);if(r<=.001){this._finishFade();return}let i=this._sampleIndex(this._fade,t),a=this._fade.curve[i];e.cancelScheduledValues(t),e.setValueAtTime(a,t),this._fade={from:a,target:this._fade.target,startTime:t,remaining:r,curve:this._fade.curve.subarray(i)}}resume(){if(this._fade===null)return;let e=this._gainNode.context.currentTime,{from:t,target:n,remaining:r,curve:i}=this._fade;if(r<=.001||Math.abs(n-t)<.001||i.length<2){this._finishFade();return}this._fade={from:t,target:n,startTime:e,remaining:r,curve:i},this._scheduleCurve(i,t,e,r)}cancel(){this._fade!==null&&this._finishFade()}_finishFade(){if(this._fade===null)return;let e=this._gainNode.gain,t=this._gainNode.context.currentTime;e.cancelScheduledValues(t),e.setValueAtTime(this._fade.target,t),this._fade=null}_startFade(e,t){let n=this._gainNode.gain,r=this._gainNode.context.currentTime,i=this._duration/1e3;if(i<=0){n.cancelScheduledValues(r),n.setValueAtTime(t,r),this._fade=null;return}let a=new Float32Array(this._curve.length);for(let n=0;n<this._curve.length;n++)a[n]=e+(t-e)*this._curve[n];this._fade={from:a[0],target:t,startTime:r,remaining:i,curve:a},this._scheduleCurve(a,a[0],r,i)}_buildEasingCurve(e){let t=Math.max(2,Math.ceil(e*60)),n=new Float32Array(t);for(let e=0;e<t;e++){let r=e/(t-1);n[e]=(1-Math.cos(Math.PI*r))/2}return n}_scheduleCurve(e,t,n,r){let i=this._gainNode.gain;i.cancelScheduledValues(n),i.setValueAtTime(t,n),i.setValueCurveAtTime(e,n,r)}_sampleIndex(e,t){let n=t-e.startTime,r=Math.max(0,Math.min(1,n/e.remaining));return Math.min(Math.round(r*(e.curve.length-1)),e.curve.length-1)}}class mn{_filter;_source;_defaultGain;frequency;constructor(e,t,n,r){this.frequency=t,this._source=n,this._defaultGain=r,this._filter=e.createBiquadFilter(),this._filter.type=`peaking`,this._filter.frequency.value=t,this._filter.gain.value=0,this._filter.Q.value=1,this._source.connect(this._filter.gain)}get value(){return this._source.offset.value}get node(){return this._filter}set(e){this._source.offset.value=e}reset(){this.set(this._defaultGain)}dispose(){this._source.disconnect(this._filter.gain)}}class ${id=`equalizer`;static _sources=new WeakMap;_inputNode;_outputNode;_filterMap=new Map;equalizer;constructor(e,t){this._inputNode=e.createGain(),this._outputNode=e.createGain();let n=Object.entries(t).map(([e,t])=>[Number(e),t]).filter(([e])=>Number.isFinite(e)).sort((e,t)=>e[0]-t[0]),r=$._sources.get(e);_(r)&&(r=new Map,$._sources.set(e,r));for(let[t,i]of n)if(!r.has(t)){let n=e.createConstantSource();n.offset.value=i,n.start(),r.set(t,n)}let i={};for(let[t,a]of n){let n=r.get(t);if(!n)continue;let o=new mn(e,t,n,a);this._filterMap.set(t,o),i[t]=o}this.equalizer=i,this.rebuild()}get inputNode(){return this._inputNode}get outputNode(){return this._outputNode}resetAll(){for(let e of this._filterMap.values())e.reset()}dispose(){for(let e of this._filterMap.values())e.dispose()}rebuild(){this._inputNode.disconnect();for(let e of this._filterMap.values())e.node.disconnect();this._outputNode.disconnect();let e=this._inputNode;for(let t of this._filterMap.values())e.connect(t.node),e=t.node;e.connect(this._outputNode)}}var hn=-14;class gn{id=`normalizer`;_compressor;_gainNode;constructor(e,t){this._compressor=e.createDynamicsCompressor(),this._gainNode=e.createGain(),this.applyConfig(t),this._compressor.connect(this._gainNode)}get inputNode(){return this._compressor}get outputNode(){return this._gainNode}applyConfig(e){if(!Number.isFinite(e.lufs)||!Number.isFinite(e.peak)){this._gainNode.gain.value=1;return}this._compressor.threshold.value=e.peak,this._compressor.knee.value=0,this._compressor.ratio.value=20,this._compressor.attack.value=.003,this._compressor.release.value=.25;let t=(e.targetLufs??hn)-e.lufs;this._gainNode.gain.value=10**(t/20)}}export{v as withoutNullable,Ie as videoSizeToQuality,Le as videoQualityToHeight,Fe as videoHeightToQuality,qe as timeout,Ve as timeCodeToString,He as throttleFn,at as throttle,bt as tap,Ft as suppressAbort,St as skip,wt as shareReplay,xe as safeStorage,he as retainTimers,ge as releaseTimers,vt as pairwise,_t as once,Et as observeElementSize,Xe as observableFrom,ee as nowInt,w as now,c as noop,Ke as merge,gt as mapTo,mt as map,qt as loadVKLangPack,Ot as isValidURL,_ as isNullable,g as isNonNullable,Me as isLowerOrEqual,R as isLower,z as isInvariantQuality,kt as isIntersecting,je as isHigherOrEqual,Ae as isHigher,C as isBrowserWindow,Pt as isAbortError,Je as interval,Mt as interpolate,x as getWindow,Be as getVideoQualityLabel,Lt as getTraceSubscriptionMethod,_e as getTimersDiagnostics,S as getTimerWindow,Nt as getRangeAroundIndex,jt as getPlayerId,It as getMessageFromError,Ne as getHighestQuality,be as getExponentialDelay,Ze as fromEvent,W as flattenObject,dt as filterChanged,st as filter,B as fillWithDefault,Qt as devNull,Oe as detectEmbed,V as debounceFn,nt as debounce,pe as createTimers,ln as createDIContainer,Ge as combine,H as cloneDeepWith,Ue as cloneDeep,Dt as clearVideoElement,s as checkNever,$e as buffer,ze as assertQualityIsExact,h as assertNullable,y as assertNotEmptyArray,m as assertNonNullable,o as assertNever,b as assertEmptyArray,Re as areQualitiesExact,ve as addScript,ye as abortable,ie as WorkerState,pn as VolumeFaderPlugin,ke as VideoQuality,U as ValueSubject,Y as VKNumericLanguage,i as VERSION,Wt as TracerFactory,re as TimerModule,Qe as SubscriptionRemovable,a as Subscription,f as Subject,We as ReplaySubject,d as Observable,gn as NormalizerPlugin,p as Logger,Zt as InternalsExposure,Xt as InterfaceLanguage,cn as InjectionToken,X as INTERNAL_EXPOSE_GLOBAL_KEY,Gt as ErrorCategory,$ as EqualizerPlugin,G as CircularBuffer,fn as AudioGraph,Q as AppTracer};
|
|
6
|
+
var e=Object.defineProperty,t=e=>e;function n(e,n){this[e]=t.bind(null,n)}var r=(t,r)=>{for(var i in r)e(t,i,{get:r[i],enumerable:!0,configurable:!0,set:n.bind(r,i)})},i=`1.0.100-dev.a5a2d3fc3.0`;class a{subscriptions=[];unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(e=>{typeof e==`function`?e():e.unsubscribe()})}add(e){return this.subscriptions.push(e),this}}var o=e=>{throw Error(`${e} is value of unexpected type`)},s=e=>{},c=()=>{},l=e=>{throw console.error(e),e},u=e=>{console.error(e)};class d{suppressErrors=!1;constructor(e){e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?u:l,r;r=t?typeof t==`function`?{next:t,error:c}:{next:e=>t.next(e),error:e=>t.error?.(e)}:{next:n,error:c};let i=typeof e==`function`?{next:t=>{try{let n=e(t);n instanceof Promise&&n.catch(e=>r.next(e))}catch(e){r.next(e)}},error:e=>r.next(e)}:{next:t=>e.next(t),error:t=>e.error?e.error(t):r.next(t)},s;try{s=this._subscribe(i)}catch(e){i.error?.(e)}return new a().add(()=>{switch(i.next=c,i.error=c,typeof s){case`function`:s();return;case`object`:s.unsubscribe();return;case`undefined`:return;default:return o(s)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class f extends d{keyCounter=0;subscribers=new Map;constructor(){super()}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>t.error?.(e))}_subscribe(e){let t=this.keyCounter++;return this.subscribers.set(t,e),new a().add(()=>this.subscribers.delete(t))}}class p{log$=new f;logs=[];log=e=>{let t={...e,timestamp:Date.now()};this.logs.push(t),this.log$.next(t)};createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch{n={message:"error in `createCustomLog`",component:`Logger`}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>({component:e,...t}))}getAllLogs=()=>this.logs}function m(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function h(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function g(e){return e!=null}function _(e){return e==null}var v=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>g(t)));function y(e,t){if(!e?.length)throw Error(t)}function b(e,t){if(e?.length)throw Error(t)}var x=()=>globalThis,S=()=>globalThis,C=(e=x())=>!!(e.window&&e.screen),w=typeof x().performance?.now==`function`?()=>x().performance.now():()=>Date.now(),ee=()=>Math.trunc(w());function T(){var e=self,t=new Map;e.onmessage=function(n){var r=n.data;if(r.type===`ping`){e.postMessage({type:`ready`});return}if(r.type===`set`){var i=r.id;r.repeat?t.set(i,{repeat:!0,handle:e.setInterval(function(){e.postMessage({type:`tick`,id:i})},r.delay)}):t.set(i,{repeat:!1,handle:e.setTimeout(function(){t.delete(i),e.postMessage({type:`tick`,id:i})},r.delay)});return}var a=t.get(r.id);a&&(a.repeat?e.clearInterval(a.handle):e.clearTimeout(a.handle),t.delete(r.id))}}var te=()=>`'use strict';(${T.toString()})();`;class ne{worker;handlers;records=new Map;ticks=0;constructor(e,t){this.worker=e,this.handlers=t,this.worker.onmessage=this.handleMessage,this.worker.onerror=this.handleError,this.worker.onmessageerror=this.handleError,this.postCommand({type:`ping`})}static create(e){let t=x();if(typeof t.Worker!=`function`||typeof t.Blob!=`function`||_(t.URL?.createObjectURL))return null;let n=t.URL.createObjectURL(new t.Blob([te()],{type:`text/javascript`}));try{return new ne(new t.Worker(n),e)}catch{return null}finally{t.URL.revokeObjectURL(n)}}get activeCount(){return this.records.size}get deliveredTicks(){return this.ticks}set(e,t,n,r){this.records.set(e,{callback:t,repeat:r,delay:n,startedAt:w()}),this.postCommand({type:`set`,id:e,delay:n,repeat:r})}clear(e){this.records.delete(e)&&this.postCommand({type:`clear`,id:e})}destroy(){let e=new Map(this.records);return this.records.clear(),this.worker.onmessage=null,this.worker.onerror=null,this.worker.onmessageerror=null,this.worker.terminate(),e}postCommand(e){this.worker.postMessage(e)}handleMessage=e=>{if(e.data.type===`ready`){this.handlers.onReady();return}let{id:t}=e.data,n=this.records.get(t);_(n)||(this.ticks++,n.repeat||this.records.delete(t),n.callback())};handleError=()=>{this.handlers.onFatalError(this.destroy())}}var E;(e=>{e.SHARED=`shared`,e.CORE=`core`,e.STATISTICS=`statistics`,e.INTERACTIVE=`interactive`,e.UI=`ui`,e.UI_TV=`ui-tv`})(E||={});var re;(e=>{e.IDLE=`idle`,e.STARTING=`starting`,e.READY=`ready`,e.FAILED=`failed`})(re||={});var ie=1,D=0,O=`idle`,k=null,A=new Map,j=new Set,ae=e=>{let t=w();for(let[n,r]of e){let e=r.repeat?r.delay:Math.max(0,r.delay-(t-r.startedAt));ue(n,r.callback,e,r.repeat)}},oe=e=>{O=`failed`,k=null,ae(e)},se=()=>{_(k)||(ae(k.destroy()),k=null),O=`idle`},ce=()=>{O===`idle`&&(O=`starting`,k=ne.create({onReady:()=>{O=`ready`},onFatalError:oe}))},le=e=>j.has(e)?(ce(),O===`ready`?k:null):null,ue=(e,t,n,r)=>{let i=S();r?A.set(e,{repeat:!0,nativeId:i.setInterval(t,n)}):A.set(e,{repeat:!1,nativeId:i.setTimeout(()=>{A.delete(e),t()},n)})},de=(e,t,n,r)=>{let i=ie++,a=le(e);return _(a)?ue(i,t,n,r):a.set(i,t,n,r),i},fe=e=>{if(_(e))return;let t=A.get(e);if(_(t)){k?.clear(e);return}A.delete(e);let n=S();t.repeat?n.clearInterval(t.nativeId):n.clearTimeout(t.nativeId)},pe=e=>({setTimeout:(t,n=0)=>de(e,t,n,!1),setInterval:(t,n=0)=>de(e,t,n,!0),clearTimeout:fe,clearInterval:fe}),me=e=>{j.clear(),e.forEach(e=>j.add(e)),j.size===0&&se()},he=e=>{D++,me(e)},ge=()=>{D!==0&&(D--,D===0&&me([]))},_e=()=>({workerModules:[...j],workerState:O,liveConsumers:D,activeWindowTimers:A.size,activeWorkerTimers:k?.activeCount??0,workerTicks:k?.deliveredTicks??0}),M=pe(`shared`),ve=(e,t,n)=>new Promise((r,i)=>{t.addEventListener(`abort`,()=>{s(),l.remove()});let a=()=>{s(),i(`error`)},o=()=>{s(),r()},s=()=>{c&&M.clearTimeout(c),l.removeEventListener(`load`,o),l.removeEventListener(`error`,a)},c;n&&(c=M.setTimeout(()=>{s(),i(`timeout`)},n));let l=document.createElement(`script`);l.addEventListener(`load`,o),l.addEventListener(`error`,a),l.src=e,document.head.appendChild(l)}),ye=(e,t)=>async(...n)=>{let r=t(...n),i=e.aborted,a;for(;!i&&!e.aborted;)try{let e=await r.next(a);i=e.done??!1,a=e.value}catch(e){await r.throw(e)}return a},be=(e,{start:t=0,factor:n=2,max:r=1/0,min:i=t,random:a=0}={})=>{let o=t;return o*=n**e,o*=1+(Math.random()*a*2-a),o=Math.round(o),o=Math.min(o,r),o=Math.max(o,i),o},xe={};r(xe,{set:()=>we,remove:()=>Ee,isPersistent:()=>Se,has:()=>Te,get:()=>Ce,clear:()=>De});var N,P,F=`vk-videoplayer-dummy-key-${Math.random()}`,I=()=>{if(P!==void 0)return P;try{localStorage.setItem(F,`test`),localStorage.removeItem(F),P=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(F),P=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)P=2;else throw e}else throw e}return P===2&&(N=new Map),P},Se=()=>I()===0,Ce=e=>{let t=I();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return N?.get(e);default:o(t)}},we=(e,t)=>{let n=I();switch(n){case 0:try{localStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 1:try{sessionStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 2:N?.set(e,t);return;default:o(n)}},Te=e=>{let t=I();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return N?.has(e)??!1;default:return o(t),!1}},Ee=e=>{let t=I();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:N?.delete(e);return;default:o(t)}},De=()=>{let e=I();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return N?.clear();default:o(e)}},Oe=()=>{let e,t=[],n=x();try{e=n.self!==n.top}catch(t){t instanceof DOMException&&t.name===`SecurityError`?e=!0:(e=!1,console.error(t))}try{n.location?.ancestorOrigins&&(t=[...n.location.ancestorOrigins])}catch(e){console.error(e)}try{!t.length&&n.document.referrer&&(t=[new URL(n.document.referrer).origin])}catch(e){console.error(e)}return t=t.filter(e=>URL.canParse(e)),{isEmbed:e,origins:t,topOrigin:t.at(-1),immediateOrigin:t.at(0)}},ke;(e=>{e.INVARIANT=`Invariant quality`,e.Q_144P=`144p`,e.Q_240P=`240p`,e.Q_360P=`360p`,e.Q_480P=`480p`,e.Q_576P=`576p`,e.Q_720P=`720p`,e.Q_1080P=`1080p`,e.Q_1440P=`1440p`,e.Q_2160P=`2160p`,e.Q_4320P=`4320p`})(ke||={});var L={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"576p":{width:1024,height:576},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},Ae=(e,t)=>L[e].height>L[t].height,je=(e,t)=>L[e].height>=L[t].height,R=(e,t)=>L[e].height<L[t].height,Me=(e,t)=>L[e].height<=L[t].height,Ne=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:R(e,t)?1:-1)[0],Pe=Object.keys(L).sort((e,t)=>R(e,t)?-1:1),Fe=(e,t=.02)=>[...Pe].find(n=>L[n].height*(1+t)>=e),Ie=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return Pe.find(e=>{let t=L[e];return t.width>=r&&t.height>=n})},Le=e=>L[e].height,z=e=>e===`Invariant quality`,Re=e=>e.every(e=>!z(e));function ze(e){if(z(e))throw Error(`Expected exact quality`)}var Be=e=>{switch(e){case`4320p`:return`8K`;case`2160p`:return`4K`;case`1440p`:return`QHD`;case`1080p`:return`FHD`;case`720p`:return`HD`;default:return``}},B=(e,t)=>{let n={};for(let r of Object.keys(t)){let i=t[r],a=e[r];Array.isArray(i)?n[r]=Array.isArray(a)?a:i:typeof i==`object`&&i?typeof a==`object`&&a&&!Array.isArray(a)?n[r]=B(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},Ve=e=>{let t=``;return e>=3600&&(t+=Math.floor(e/3600)+`h`,e%=3600),e>=60&&(t+=Math.floor(e/60)+`m`,e%=60),e>0&&(t+=Math.floor(e)+`s`),t};function V(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof x().requestAnimationFrame==`function`;n&&(u=!!n.leading,d=`maxWait`in n,a=n?.maxWait?Math.max(+n?.maxWait||0,t):a,f=`trailing`in n?!!n.trailing:f);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(s&&x().cancelAnimationFrame(s),x().requestAnimationFrame(e)):M.setTimeout(e,t)}function g(e){if(p){x().cancelAnimationFrame(e);return}M.clearTimeout(e)}function _(e){return l=e,s=h(b,t),u?m(e):o}function v(e){let n=e-c,r=e-l,i=t-n;return d?Math.min(i,a-r):i}function y(e){let n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function b(){let e=Date.now();if(y(e))return S(e);s=h(b,v(e))}function S(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function C(){s!==void 0&&g(s),l=0,r=c=i=s=void 0}function w(){return s===void 0?o:S(Date.now())}function ee(){return s!==void 0}function T(...e){let n=Date.now(),a=y(n);if(r=e,i=this,c=n,a){if(s===void 0)return _(c);if(d)return s=h(b,t),m(c)}return s===void 0&&(s=h(b,t)),o}return T.cancel=C,T.flush=w,T.pending=ee,T}var He=(e,t=0,n)=>V(e,t,{leading:!0,trailing:!0,...n,maxWait:t}),H=(e,t)=>{if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let r in e){if(typeof t==`function`){let i=t(e[r],r,e,n);if(i!==void 0){n[r]=i;continue}}typeof e[r]==`object`?n[r]=H(e[r],t):n[r]=e[r]}return n},Ue=e=>H(e);class We extends f{bufferSize;buffer=[];cursorEnd=-1;cursorStart=0;constructor(e){super(),this.bufferSize=e,this.buffer=Array(e)}next(e){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=e,this.subscribers.forEach(t=>t.next(e))}_subscribe(e){for(let t=this.cursorStart;t<=this.cursorEnd;t++)e.next(this.buffer[t%this.bufferSize]);let t=this.keyCounter++;return this.subscribers.set(t,e),new a().add(()=>this.subscribers.delete(t))}}class U extends f{value;constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let t=super._subscribe(e);return e.next(this.value),t}}function Ge(e){return new d(t=>{let n={},r=Object.keys(e).length,i=e=>i=>{e in n||r--,n[e]=i,r===0&&t.next(n)};return Object.entries(e).reduce((e,[t,n])=>e.add(n.subscribe(i(t))),new a)})}function Ke(...e){return new d(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new a))}var qe=e=>new d(t=>{let n=M.setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>M.clearTimeout(n)}),Je=e=>new d(t=>{let n=M.setInterval(()=>t.next(),e);return()=>{n&&=(M.clearInterval(n),void 0)}});function Ye(e){return new d(t=>{if(e instanceof Promise){let n=!1;return e.then(e=>{n||t.next(e)}).catch(e=>{n||t.error?.(e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var Xe=Ye,Ze=(e,t)=>new d(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Qe extends a{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function $e(e){return t=>new d(n=>t.subscribe(new et(n,e)))}class et{destination;size;lastValues=[];constructor(e,t){this.destination=e,this.size=t}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){this.destination.error?.(e)}}var tt={leading:!1,trailing:!0};function nt(e,t=tt){return n=>new d(r=>n.subscribe(new rt(r,e,t)))}class rt{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,g(this.timeout)?M.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=M.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(e){if(this.destination.error)this.destination.error(e);else throw e}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}}var it={leading:!0,trailing:!1};function at(e,t=it){return n=>new d(r=>n.subscribe(new ot(r,e,t)))}class ot{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,_(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=M.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}}function st(e){return t=>new d(n=>t.subscribe(new ct(n,e)))}class ct{destination;predicate;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}var lt=(e,t)=>{let n=(e,t)=>{let n=Object.keys(e);for(let r in t)if(!n.includes(r)||t[r]!==e[r])return!1;return!0};return n(e,t)&&n(t,e)},ut=(e,t)=>e instanceof Object&&t instanceof Object?lt(e,t):e===t;function dt(e=ut){return t=>new d(n=>t.subscribe(new pt(n,e)))}var ft={};class pt{destination;predicate;lastValue=ft;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===ft||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?{...e}:e}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function W(e){return t=>new d(n=>t.subscribe(new mt(n,e)))}class mt{destination;mapper;constructor(e,t){this.destination=e,this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(e){throw this.error(e),e}this.destination.next(t)}error(e){this.destination.error?.(e)}}function ht(e){return W(()=>e)}function gt(){return e=>new d(t=>{let n=!1,r=!1,i=e.subscribe(e=>{n||(n=!0,t.next(e)),r&&i.unsubscribe()},e=>{n=!0,t.error?.(e),r&&i.unsubscribe()});return r=!0,n&&i.unsubscribe(),i})}function _t(){return e=>new d(t=>e.subscribe(new vt(t)))}class vt{destination;last;hasLast=!1;constructor(e){this.destination=e}next(e){let t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){this.destination.error?.(e)}}function yt(e){return t=>new d(n=>t.subscribe(new bt(n,e)))}class bt{destination;effect;constructor(e,t){this.destination=e,this.effect=t}next(e){try{this.effect(e)}catch(e){throw this.error(e),e}this.destination.next(e)}error(e){this.destination.error?.(e)}}function xt(e){return t=>new d(n=>t.subscribe(new St(n,e)))}class St{destination;count;constructor(e,t){this.destination=e,this.count=t,t<0&&this.destination.error?.(Error(`Count can not be less than zero`))}next(e){this.count===0?this.destination.next(e):this.count--}error(e){this.destination.error?.(e)}}function Ct(e=0){return t=>{let n=0,r=new We(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new d(e=>(n++,a(r.subscribe(e))))}}var wt=300,Tt=(e,t=wt)=>new d(n=>{let r=x(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!C(r))return;let o=new r.ResizeObserver(He(e=>{let t=e[0];if(!t)return;let r,i;t.contentBoxSize&&t.contentBoxSize[0]?(i=t.contentBoxSize[0].blockSize,r=t.contentBoxSize[0].inlineSize):t.contentRect&&(r=t.contentRect.width,i=t.contentRect.height),g(r)&&g(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),G=(e,t=6,n=`.`)=>{let r={};for(let i in e)if(!(!e.hasOwnProperty(i)||e[i]instanceof HTMLElement||!t))if(typeof e[i]==`object`&&e[i]!==null){let a=G(e[i],t-1);for(let e in a)a.hasOwnProperty(e)&&(r[i+n+e]=a[e])}else r[i]=e[i];return r},Et=e=>{e.innerHTML=``,e.removeAttribute(`src`),e.load()},Dt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},Ot=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),kt=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),At=e=>e!==void 0&&e!==``?e:kt().toString();function jt(e,t,n){if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];let r=1;for(;r<t.length&&t[r]<e;)r++;r>=t.length&&(r=t.length-1);let i=t[r-1],a=t[r],o=n[r-1],s=n[r];return e===i?o:e===a?s:o+(e-i)/(a-i)*(s-o)}function Mt(e,t,n){if(e<=0||n<0)return[];let r=[],i=Math.floor((e-1)/2),a=Math.floor(e/2),o=t-i,s=t+a;o<0&&(s+=Math.abs(o),o=0),s>n&&(o-=s-n,s=n),o=Math.max(0,o),s=Math.min(n,s);for(let e=o;e<=s;e++)r.push(e);return r}var Nt=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),Pt=e=>{if(!Nt(e))throw e};function Ft(e){if(e&&typeof e==`object`){if(`message`in e)return String(e.message);try{return JSON.stringify(e)}catch{return`object serialization error`}}return String(e)}class K{buffer;writeIndex=0;count=0;capacity;constructor(e){if(e<=0)throw Error(`Capacity must be greater than 0`);this.capacity=e,this.buffer=Array.from({length:e}).fill(null)}add(e){this.buffer[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.count<this.capacity&&this.count++}*[Symbol.iterator](){if(this.count===0)return;let e=this.count<this.capacity?0:this.writeIndex;for(let t=0;t<this.count;t++){let t=this.buffer[e];g(t)&&(yield t),e=(e+1)%this.capacity}}clear(){this.buffer.fill(null),this.writeIndex=0,this.count=0}get size(){return this.count}get maxCapacity(){return this.capacity}}var It=e=>(t,n=!1)=>r=>{let i=typeof r==`object`;r==null||i&&!Object.keys(r).length||e(t,i?G(r):{value:r},n)},q=(e={})=>{let t=e=>{let t=e;return e===void 0?t=`undefined`:e===null?t=`null`:(typeof e==`number`||typeof e==`boolean`)&&(t=e.toString()),t},n={};for(let r in e)Array.isArray(e[r])?n[r]=e[r].map(t):n[r]=t(e[r]);return n};class J{dynamicImportTimeout=5e3;subscription=new a;options;span;context;childTracers=[];initPromise;getRootTracerContext;eventsBuffer=null;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t,getRootTracerContext:n,options:r}){this.options=r??{};let{tracerEventsBufferSize:i}=this.options;g(i)&&i>0&&(this.eventsBuffer=new K(i)),J.dynamicImportStatus===`not_started`&&(J.dynamicImportPromise=this.loadOpentelemetry());let a=Date.now();this.initPromise=J.dynamicImportPromise.then(r=>{J.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t,getRootTracerContext:n},a)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(_(i))return;let{opentelemetryApi:a}=J.dynamicImports,{context:o,trace:s}=a,{tracer:c,attributes$:l}=i;this.span=c.startSpan(e,{startTime:r},t?.()),this.context=s.setSpan(o.active(),this.span),this.getRootTracerContext=n,this.subscription.add(l.subscribe(e=>{g(e)&&this.span.setAttributes(e)}))}async loadOpentelemetry(){if(J.dynamicImportStatus===`not_started`){J.dynamicImportStatus=`in_progress`;try{let e=new Promise((e,t)=>M.setTimeout(t,this.dynamicImportTimeout)),t=Promise.all([import(`@opentelemetry/api`),import(`@opentelemetry/sdk-trace-web`),import(`@apptracer/opentelemetry`),import(`@opentelemetry/resources`),import(`@opentelemetry/semantic-conventions`)]),[n,r,i,a,o]=await Promise.race([t,e]);J.dynamicImports={opentelemetryApi:n,opentelemetrySdk:r,tracer:i,opentelemetryResources:a,opentelemetrySemanticConventions:o},J.dynamicImportStatus=`completed`}catch{J.dynamicImportStatus=`failed`}}}isComponentTracerNotInitialized(){return _(this.span)||J.dynamicImportStatus===`failed`}addEventToBuffer(e,t,n,r){g(this.eventsBuffer)&&this.eventsBuffer.add({name:e,attributes:t,type:n,timestamp:r})}addEventToSpan(e,t,n,r){this.span.addEvent(e,{...q(t),type:n},r)}log(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`log`,r)}):this.addEventToBuffer(e,t,`log`,r)}error(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`error`,r)}):this.addEventToBuffer(e,t,`error`,r)}critical(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`critical`,r)}):this.addEventToBuffer(e,t,`critical`,r)}createComponentTracer(e){let t=new J({name:e,getParentContext:()=>this.context,getRootTracerContext:()=>this.getRootTracerContext?.(),options:this.options});return this.childTracers.push(t),t}setSpanAttributes(e){this.span.setAttributes(q(e))}end(){this.initPromise.then(e=>{if(!this.isComponentTracerNotInitialized()){if(g(this.eventsBuffer))for(let e of this.eventsBuffer)this.addEventToSpan(e.name,e.attributes,e.type,e.timestamp);this.childTracers.forEach(e=>e.end()),this.span.end(),this.subscription.unsubscribe()}})}pause(){this.getRootTracerContext?.()?.paused$.next(!0)}resume(){this.getRootTracerContext?.()?.paused$.next(!1)}}var Lt=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`,Rt=e=>{class t extends e{_isPaused=!1;_pausedSpans;maxExportBatchSize;maxQueueSize;constructor(e,t){super(e,t),this.maxQueueSize=t?.maxQueueSize??2048,this.maxExportBatchSize=t?.maxExportBatchSize??512,this._pausedSpans=new K(this.maxQueueSize)}pause(){this._isPaused=!0}async resume(){if(!this._isPaused)return;this._isPaused=!1;let e=this._pausedSpans;this._pausedSpans=new K(this.maxQueueSize);let t=0;for(let n of e)super.onEnd(n),t+=1,t>=this.maxExportBatchSize&&(await new Promise(e=>M.setTimeout(()=>e(void 0),0)),t=0);e.clear(),await this.forceFlush()}onEnd(e){if(this._isPaused){this._pausedSpans.add(e);return}super.onEnd(e)}}return t};class zt extends J{attributes$=new U(null);paused$=new U(!1);constructor(e){super({name:`Root`,options:e}),this.paused$.next(!!this.options.tracerPausedAtInit)}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:a,opentelemetrySdk:o,opentelemetrySemanticConventions:s}=J.dynamicImports,{TracerUploadSpanExporter:c}=r,{WebTracerProvider:l,BatchSpanProcessor:u}=o,{resourceFromAttributes:d}=a,{ATTR_SERVICE_NAME:f,ATTR_SERVICE_VERSION:p}=s,m=new(Rt(u))(new c({appToken:Lt}));this.subscription.add(this.paused$.subscribe(e=>{e?m.pause():m.resume()}));let h=new l({resource:d({[f]:`videoplayer-sdk-web`,[p]:i}),spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0},spanProcessors:[m]});h.register();let g=h.getTracer(`sdk-videoplayer-tracer`);super.init({name:e,getParentContext:t,getRootTracerContext:()=>({tracer:g,attributes$:this.attributes$,paused$:this.paused$})},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}setSpanAttributes(e){this.attributes$.next({...this.attributes$.getValue(),...q(e)})}addSubscription(e){this.subscription.add(e)}}class Bt{fakeTraceId;constructor(e){}log(e,t,n){}error(e,t,n){}critical(e,t,n){}createComponentTracer(e){return new Bt({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}pause(){}resume(){}}var Vt=()=>!0,Y={level:0,filter:Vt,name:`Noname Tracer`,outputMethod:`log`};class Ht{name;filter=Vt;level=Y.level;outputMethod=Y.outputMethod;childTracers=[];constructor({name:e,level:t,filter:n,outputMethod:r}={}){this.filter=n??this.filter,this.level=t??this.level,this.outputMethod=r??this.outputMethod,this.name=e??Y.name}log(e,t,n){this.logDebug(e,t)}error(e,t,n){this.logError(e,t)}critical(e,t,n){this.logError(e,t)}createComponentTracer(e){let t=new Ht({filter:this.filter,level:this.level,name:`${this.name}/ ${e}`,outputMethod:this.outputMethod});return this.childTracers.push(t),t}end(){this.childTracers.forEach(e=>e.end()),this.childTracers=[]}setLevel(e){this.level=e,this.childTracers.forEach(t=>t.setLevel(e))}setOtputMethod(e){this.outputMethod=e,this.childTracers.forEach(t=>t.setOtputMethod(e))}setFilter(e){this.filter=e,this.childTracers.forEach(t=>t.setFilter(e))}getFinishedSpans(){}getTraceId(){return`debug_trace`}get verbose(){return this.level===0}createMessage(e,t){return[this.name,e,JSON.stringify(t)].join(`: `)}logDebug(e,t){!this.verbose||!this.filter(e,t)||x().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&x().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}pause(){}resume(){}}class Ut{static createRootTracer(e=`fake`,t){switch(e){case`real`:return new zt(t);case`debug`:return new Ht;default:return new Bt}}}var Wt;(e=>{e.MediaError=`mediaError`,e.SegmentFetcher=`segment_fetcher`,e.SegmentAppend=`segment_append`,e.Hangup=`hangup`,e.Stall=`stall`})(Wt||={});var Gt;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.UI=`ui`,e.CALL_FROM_EXTERNAL=`call_from_external`,e.FATAL=`fatal`})(Gt||={});var Kt;(e=>{e.Armenian=`58`,e.Azerbaijani=`57`,e.Belarusian=`114`,e.English=`3`,e.Kazakh=`97`,e.Portuguese=`73`,e.Russian=`0`,e.Spanish=`4`,e.Ukrainian=`1`,e.Uzbek=`65`,e.Vietnamese=`75`})(Kt||={});var qt=`vk.ru`,Jt=async(e,t,n)=>{let r=new URL(`https://${qt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),Yt(await(await fetch(r.toString())).json(),n)},Yt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),Xt(n)])),Xt=e=>Array.isArray(e)?e[0]:e,Zt;(e=>{e.RU=`ru`,e.EN=`en`})(Zt||={});var X=`__vk_vp_internals_exposure`;class Qt{playerId;type;constructor(e,t){this.playerId=t,this.type=e,this.initWindowObjects()}getWindowObject(){if(typeof window>`u`)return{};let e=this.playerId,t=this.type;return window[X]?.[e]?.[t]??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[X]||(window[X]={}),window[X][e]||(window[X][e]={}),window[X][e][t]||(window[X][e][t]={})}expose(e){typeof window>`u`||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[X]&&window[X][e]&&window[X][e][t]&&(delete window[X][e][t],Object.keys(window[X][e]).length||delete window[X][e],Object.keys(window[X]).length||delete window[X])}}var $t={};r($t,{subscribe:()=>rn,push:()=>nn,destroy:()=>tn,create:()=>en});var Z=new Map,en=(e,t)=>Z.set(e,t??[]),tn=e=>Z.delete(e),nn=(e,t)=>{let n=Z.get(e);n&&(typeof n==`function`?n(t):n.push(t))},rn=(e,t)=>{let n=Z.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);Z.set(e,t)}},an=e=>v({id:e.id,message:e.message,category:e.category,data:on(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function on(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var sn=e=>{let t=e.thrown instanceof Error?e.thrown:Error(e.message),n=e.id.length>10240?e.id.substring(0,10240):e.id;try{t.name=n}catch{t=Error(e.message),t.name=n}return t},cn=()=>{try{let{origin:e,pathname:t,search:n,hostname:r}=x()?.document?.location??{};return!r||r===`localhost`?void 0:{url:e+t,...new URLSearchParams(n).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{})}}catch{}};class Q{static tracerErrorMap=new Map;static appTracerModule=null;static loadPromise=null;dynamicImportTimeout=5e3;componentName;subscription=new a;options;envParams;context;isEmbed;embedParent;beforeInitErrors=[];constructor(e,t,n,r){this.componentName=e,this.options=t,this.envParams=n,this.context={...r};let{isEmbed:i,topOrigin:a}=Oe();this.isEmbed=i,this.embedParent=a?new URL(a).hostname:void 0,this.options.enabled&&(this.loadModule(),this.init())}updateContext(e){Object.assign(this.context,e)}error(e,t){let n=Q.tracerErrorMap.get(this.componentName);if(!n){this.beforeInitErrors.push([e,t]);return}let{blackErrorCategoryList:r,blackErrorIdList:i,sampleRate:a,whiteErrorCategoryList:o,whiteErrorIdList:s}=this.options,{id:c,category:l}=e;if(!(r.length&&r.includes(l)||i.length&&i.includes(c)||o.length&&!o.includes(l)||s.length&&!s.includes(c)||Math.random()>=a))try{let r=sn(e);n?.error(r,{crashIdSource:t?.crashIdSource??r.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),...t?.issueKey?{issueKey:t.issueKey}:{},keys:{...this.context,...an(e),...cn(),...this.isEmbed&&this.embedParent&&{iframe_host:this.embedParent}}})}catch(e){console.error(e)}}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}async init(){try{if(await Q.loadPromise,Q.tracerErrorMap.has(this.componentName)||_(Q.appTracerModule))return;let{appTracerModule:e}=Q,{initTracerError:t,initTracerErrorUploader:n,getTracerModules:r}=e,i=r(this.componentName),a=!i.error,o=i.error??t(this.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});g(this.options.userId)&&o.setUserId(this.options.userId),a&&n(this.componentName,{appToken:Lt,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),Q.tracerErrorMap.set(this.componentName,o),this.beforeInitErrors.forEach(e=>this.error.apply(this,e)),this.beforeInitErrors=[]}catch(e){console.error(e)}}loadModule(){g(Q.loadPromise)||(Q.loadPromise=(async()=>{try{let e=new Promise((e,t)=>M.setTimeout(t,this.dynamicImportTimeout));Q.appTracerModule=await Promise.race([e,import(`@apptracer/sdk/lite`)])}catch(e){Q.loadPromise=null,console.error(e)}})())}}class ln{options;symbol;constructor(e,t){this.options=t,this.symbol=Symbol(e)}}var un=()=>{let e=new Map,t=new Map,n=new Map,r=new Map,i=new Set;return{resolve(e){if(!r.has(e)){let t=n.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);r.set(e,new t)}return r.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){r.forEach((t,n)=>{t instanceof e&&r.delete(n)}),n.set(e,t)},getToken(n){if(e.has(n.symbol))return e.get(n.symbol);if(t.has(n.symbol)){let r=t.get(n.symbol)();return e.set(n.symbol,r),r}if(n.options?.factory){let t=n.options.factory();return e.set(n.symbol,t),t}throw Error(`No value registered in DI container for token "${n.symbol.description}"`)},registerToken(t,n){e.set(t.symbol,n)},registerFactory(e,n){t.set(e.symbol,n)},hasToken(n){return e.has(n.symbol)||t.has(n.symbol)||!!n.options?.factory},registerCleanup(e){i.add(e)},clear(){i.forEach(e=>e()),i.clear(),e.clear(),t.clear(),r.clear(),n.clear()}}};class dn{_inputNode;_outputNode;_plugins=[];_destination=null;_taps=[];constructor(e){this._inputNode=e.createGain(),this._outputNode=e.createGain()}get input(){return this._inputNode}get plugins(){return this._plugins}connectTo(e){this._destination=e,this.rebuild()}addTap(e){this._taps.push(e),this._outputNode.connect(e)}hasPlugin(e){return this._plugins.some(t=>t.id===e)}addPlugin(e){this.hasPlugin(e.id)||(this._plugins.push(e),this.rebuild())}removePlugin(e){let t=this._plugins.findIndex(t=>t.id===e);t!==-1&&(this._plugins.splice(t,1),this.rebuild())}rebuild(){this._inputNode.disconnect();for(let e of this._plugins)e.outputNode.disconnect();this._outputNode.disconnect();let e=this._inputNode;for(let t of this._plugins)e.connect(t.inputNode),e=t.outputNode;e.connect(this._outputNode),this._destination!==null&&this._outputNode.connect(this._destination);for(let e of this._taps)this._outputNode.connect(e)}}class fn{_pluginChain;_element;_ctx;_sourceNode=null;_isBound=!1;constructor(e,t,n){this._element=e,this._ctx=t,this._pluginChain=new dn(t),this._pluginChain.connectTo(n)}get isBound(){return this._isBound}get plugins(){return this._pluginChain.plugins}bind(){this._isBound||=(this._sourceNode===null&&(this._sourceNode=this._ctx.createMediaElementSource(this._element)),this._sourceNode.disconnect(),this._sourceNode.connect(this._pluginChain.input),!0)}unbind(){this._isBound&&=(this._sourceNode?.disconnect(),this._sourceNode?.connect(this._ctx.destination),!1)}addPlugin(e){this._pluginChain.addPlugin(e)}removePlugin(e){this._pluginChain.removePlugin(e)}addAnalyser(e){this._pluginChain.addTap(e)}}class pn{_ctx=null;_masterGain=null;_connections=new Map;_contextEnabled=!1;_boundBeforeDisable=new Set;static isSupported(){let e=x();return g(e.AudioContext??e.webkitAudioContext)}get context(){if(_(this._ctx)){let e=x(),t=e.AudioContext??e.webkitAudioContext;this._ctx=new t}return this._ctx}get contextState(){return this._contextEnabled?this._ctx?.state??`suspended`:`suspended`}async enableContext(){this.ensureContext(),await this._ctx?.resume(),this._contextEnabled=!0;for(let e of this._boundBeforeDisable)this._connections.get(e)?.bind();this._boundBeforeDisable.clear()}async disableContext(){this._contextEnabled=!1;for(let[e,t]of this._connections)t.isBound&&(this._boundBeforeDisable.add(e),t.unbind())}async connectSource(e){this.ensureContext(),this._contextEnabled=!0,await this._ctx?.resume();let t=this._connections.get(e);if(t!==void 0){t.isBound||t.bind();return}let n=new fn(e,this.context,this._masterGain);n.bind(),this._connections.set(e,n)}disconnectSource(e){this._connections.get(e)?.unbind()}isSourceConnected(e){return this._connections.get(e)?.isBound??!1}addPlugin(e,t){let n=this._connections.get(e);if(n===void 0)throw Error(`Source is not connected. Call connectSource() first.`);n.addPlugin(t)}removePlugin(e,t){this._connections.get(e)?.removePlugin(t)}getPlugins(e){return this._connections.get(e)?.plugins??[]}createAnalyser(e){let t=this._connections.get(e);if(t===void 0)return null;let n=this.context.createAnalyser();return n.fftSize=256,n.smoothingTimeConstant=.8,t.addAnalyser(n),n}setMasterVolume(e){this._masterGain!==null&&(this._masterGain.gain.value=e)}getMasterVolume(){return this._masterGain?.gain.value??1}dispose(){this._connections.clear(),this._boundBeforeDisable.clear(),this._masterGain=null,this._contextEnabled=!1,this._ctx?.close(),this._ctx=null}ensureContext(){let e=this.context;_(this._masterGain)&&(this._masterGain=e.createGain(),this._masterGain.gain.value=1,this._masterGain.connect(e.destination))}}class mn{id=`volume-fader`;_gainNode;_duration;_curve;_fade=null;constructor(e,t){this._gainNode=e.createGain(),this._gainNode.gain.value=1,this._duration=t.duration,this._curve=t.curve??this._buildEasingCurve(t.duration/1e3)}get inputNode(){return this._gainNode}get outputNode(){return this._gainNode}get faded(){return this._fade!==null}appear(){this._startFade(0,1)}disappear(){this._startFade(1,0)}pause(){if(this._fade===null)return;let e=this._gainNode.gain,t=this._gainNode.context.currentTime,n=t-this._fade.startTime,r=Math.max(0,this._fade.remaining-n);if(r<=.001){this._finishFade();return}let i=this._sampleIndex(this._fade,t),a=this._fade.curve[i];e.cancelScheduledValues(t),e.setValueAtTime(a,t),this._fade={from:a,target:this._fade.target,startTime:t,remaining:r,curve:this._fade.curve.subarray(i)}}resume(){if(this._fade===null)return;let e=this._gainNode.context.currentTime,{from:t,target:n,remaining:r,curve:i}=this._fade;if(r<=.001||Math.abs(n-t)<.001||i.length<2){this._finishFade();return}this._fade={from:t,target:n,startTime:e,remaining:r,curve:i},this._scheduleCurve(i,t,e,r)}cancel(){this._fade!==null&&this._finishFade()}_finishFade(){if(this._fade===null)return;let e=this._gainNode.gain,t=this._gainNode.context.currentTime;e.cancelScheduledValues(t),e.setValueAtTime(this._fade.target,t),this._fade=null}_startFade(e,t){let n=this._gainNode.gain,r=this._gainNode.context.currentTime,i=this._duration/1e3;if(i<=0){n.cancelScheduledValues(r),n.setValueAtTime(t,r),this._fade=null;return}let a=new Float32Array(this._curve.length);for(let n=0;n<this._curve.length;n++)a[n]=e+(t-e)*this._curve[n];this._fade={from:a[0],target:t,startTime:r,remaining:i,curve:a},this._scheduleCurve(a,a[0],r,i)}_buildEasingCurve(e){let t=Math.max(2,Math.ceil(e*60)),n=new Float32Array(t);for(let e=0;e<t;e++){let r=e/(t-1);n[e]=(1-Math.cos(Math.PI*r))/2}return n}_scheduleCurve(e,t,n,r){let i=this._gainNode.gain;i.cancelScheduledValues(n),i.setValueAtTime(t,n),i.setValueCurveAtTime(e,n,r)}_sampleIndex(e,t){let n=t-e.startTime,r=Math.max(0,Math.min(1,n/e.remaining));return Math.min(Math.round(r*(e.curve.length-1)),e.curve.length-1)}}class hn{_filter;_source;_defaultGain;frequency;constructor(e,t,n,r){this.frequency=t,this._source=n,this._defaultGain=r,this._filter=e.createBiquadFilter(),this._filter.type=`peaking`,this._filter.frequency.value=t,this._filter.gain.value=0,this._filter.Q.value=1,this._source.connect(this._filter.gain)}get value(){return this._source.offset.value}get node(){return this._filter}set(e){this._source.offset.value=e}reset(){this.set(this._defaultGain)}dispose(){this._source.disconnect(this._filter.gain)}}class ${id=`equalizer`;static _sources=new WeakMap;_inputNode;_outputNode;_filterMap=new Map;equalizer;constructor(e,t){this._inputNode=e.createGain(),this._outputNode=e.createGain();let n=Object.entries(t).map(([e,t])=>[Number(e),t]).filter(([e])=>Number.isFinite(e)).sort((e,t)=>e[0]-t[0]),r=$._sources.get(e);_(r)&&(r=new Map,$._sources.set(e,r));for(let[t,i]of n)if(!r.has(t)){let n=e.createConstantSource();n.offset.value=i,n.start(),r.set(t,n)}let i={};for(let[t,a]of n){let n=r.get(t);if(!n)continue;let o=new hn(e,t,n,a);this._filterMap.set(t,o),i[t]=o}this.equalizer=i,this.rebuild()}get inputNode(){return this._inputNode}get outputNode(){return this._outputNode}resetAll(){for(let e of this._filterMap.values())e.reset()}dispose(){for(let e of this._filterMap.values())e.dispose()}rebuild(){this._inputNode.disconnect();for(let e of this._filterMap.values())e.node.disconnect();this._outputNode.disconnect();let e=this._inputNode;for(let t of this._filterMap.values())e.connect(t.node),e=t.node;e.connect(this._outputNode)}}var gn=-14;class _n{id=`normalizer`;_compressor;_gainNode;constructor(e,t){this._compressor=e.createDynamicsCompressor(),this._gainNode=e.createGain(),this.applyConfig(t),this._compressor.connect(this._gainNode)}get inputNode(){return this._compressor}get outputNode(){return this._gainNode}applyConfig(e){if(!Number.isFinite(e.lufs)||!Number.isFinite(e.peak)){this._gainNode.gain.value=1;return}this._compressor.threshold.value=e.peak,this._compressor.knee.value=0,this._compressor.ratio.value=20,this._compressor.attack.value=.003,this._compressor.release.value=.25;let t=(e.targetLufs??gn)-e.lufs;this._gainNode.gain.value=10**(t/20)}}export{v as withoutNullable,Ie as videoSizeToQuality,Le as videoQualityToHeight,Fe as videoHeightToQuality,qe as timeout,Ve as timeCodeToString,He as throttleFn,at as throttle,yt as tap,Pt as suppressAbort,xt as skip,Ct as shareReplay,xe as safeStorage,he as retainTimers,ge as releaseTimers,_t as pairwise,gt as once,Tt as observeElementSize,Xe as observableFrom,ee as nowInt,w as now,c as noop,Ke as merge,ht as mapTo,W as map,Jt as loadVKLangPack,Dt as isValidURL,_ as isNullable,g as isNonNullable,Me as isLowerOrEqual,R as isLower,z as isInvariantQuality,Ot as isIntersecting,je as isHigherOrEqual,Ae as isHigher,C as isBrowserWindow,Nt as isAbortError,Je as interval,jt as interpolate,x as getWindow,Be as getVideoQualityLabel,It as getTraceSubscriptionMethod,_e as getTimersDiagnostics,S as getTimerWindow,Mt as getRangeAroundIndex,At as getPlayerId,Ft as getMessageFromError,Ne as getHighestQuality,be as getExponentialDelay,Ze as fromEvent,G as flattenObject,dt as filterChanged,st as filter,B as fillWithDefault,$t as devNull,Oe as detectEmbed,V as debounceFn,nt as debounce,pe as createTimers,un as createDIContainer,Ge as combine,H as cloneDeepWith,Ue as cloneDeep,Et as clearVideoElement,s as checkNever,$e as buffer,ze as assertQualityIsExact,h as assertNullable,y as assertNotEmptyArray,m as assertNonNullable,o as assertNever,b as assertEmptyArray,Re as areQualitiesExact,ve as addScript,ye as abortable,re as WorkerState,mn as VolumeFaderPlugin,ke as VideoQuality,U as ValueSubject,Kt as VKNumericLanguage,i as VERSION,Ut as TracerFactory,E as TimerModule,Qe as SubscriptionRemovable,a as Subscription,f as Subject,We as ReplaySubject,d as Observable,_n as NormalizerPlugin,p as Logger,Qt as InternalsExposure,Zt as InterfaceLanguage,ln as InjectionToken,X as INTERNAL_EXPOSE_GLOBAL_KEY,Wt as ErrorOrigin,Gt as ErrorCategory,$ as EqualizerPlugin,K as CircularBuffer,pn as AudioGraph,Q as AppTracer};
|
package/package.json
CHANGED
package/types/types/index.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
export type SafeAny = any;
|
|
2
|
-
export
|
|
2
|
+
export declare enum ErrorOrigin {
|
|
3
|
+
MediaError = "mediaError",
|
|
4
|
+
SegmentFetcher = "segment_fetcher",
|
|
5
|
+
SegmentAppend = "segment_append",
|
|
6
|
+
Hangup = "hangup",
|
|
7
|
+
Stall = "stall"
|
|
8
|
+
}
|
|
3
9
|
export interface IError {
|
|
4
10
|
/**
|
|
5
11
|
* Код или другой идентификатор для статистики
|