@vkontakte/videoplayer-shared 1.0.25 → 1.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es2015.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.25
3
- * Mon, 03 Jul 2023 15:51:34 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-25/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.26
3
+ * Mon, 10 Jul 2023 13:37:00 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-26/doc/
5
5
  */
6
- "use strict";const C="1.0.25";class m{constructor(){this.subscriptions=[]}unsubscribe(){const e=this.subscriptions;this.subscriptions=[],e.forEach(i=>typeof i=="function"?i():i.unsubscribe())}add(e){return this.subscriptions.push(e),this}}const w=t=>{throw new Error(`${t} is value of unexpected type`)},R=t=>{},v=()=>{};class u{constructor(e){e&&(this._subscribe=e)}subscribe(e,i){var n;let o;i?typeof i=="function"?o={next:i,error:v}:o={next:a=>i.next(a),error:a=>{var l;return(l=i.error)===null||l===void 0?void 0:l.call(i,a)}}:o={next:v,error:v};const s=typeof e=="function"?{next:a=>{try{e(a)}catch(l){o.next(l)}},error:a=>o.next(a)}:{next:a=>e.next(a),error:a=>e.error?e.error(a):o.next(a)};let r;try{r=this._subscribe(s)}catch(a){(n=s.error)===null||n===void 0||n.call(s,a)}return new m().add(()=>{switch(s.next=v,s.error=v,typeof r){case"function":r();return;case"object":r.unsubscribe();return;case"undefined":return;default:return w(r)}})}pipe(...e){return e.reduce((i,n)=>n(i),this)}_subscribe(e){}}class x extends u{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(e){this.subscribers.forEach(i=>i.next(e))}error(e){this.subscribers.forEach(i=>{var n;return(n=i.error)===null||n===void 0?void 0:n.call(i,e)})}_subscribe(e){const i=this.keyCounter++;return this.subscribers.set(i,e),new m().add(()=>this.subscribers.delete(i))}}class Q{constructor(){this.log$=new x,this.logs=[],this.log=e=>{const i=Object.assign(Object.assign({},e),{timestamp:Date.now()});this.logs.push(i),this.log$.next(i)},this.getAllLogs=()=>this.logs}createCustomLog(e){return(...i)=>{let n;try{n=e(...i)}catch(o){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(i=>Object.assign({component:e},i))}}function V(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function P(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function I(t){return typeof t!="undefined"&&t!==null}function T(t){return t==null}const M=(t,e,i)=>new Promise((n,o)=>{e.addEventListener("abort",()=>{a(),d.remove()});const s=()=>{a(),o()},r=()=>{a(),n()},a=()=>{l&&clearTimeout(l),d.removeEventListener("load",r),d.removeEventListener("error",s)};let l;i&&(l=window.setTimeout(s,i));const d=document.createElement("script");d.addEventListener("load",r),d.addEventListener("error",s),d.src=t,document.head.appendChild(d)});var E;const D=typeof((E=window.performance)===null||E===void 0?void 0:E.now)=="function"?()=>window.performance.now():()=>Date.now();function G(t,e,i,n){function o(s){return s instanceof i?s:new i(function(r){r(s)})}return new(i||(i=Promise))(function(s,r){function a(b){try{d(n.next(b))}catch(g){r(g)}}function l(b){try{d(n.throw(b))}catch(g){r(g)}}function d(b){b.done?s(b.value):o(b.value).then(a,l)}d((n=n.apply(t,e||[])).next())})}const k=(t,e)=>(...i)=>G(void 0,void 0,void 0,function*(){var n;const o=e(...i);let s=t.aborted,r;for(;!s&&!t.aborted;){const a=yield o.next(r);s=(n=a.done)!==null&&n!==void 0?n:!1,r=a.value}return r});exports.CurrentClientBrowser=void 0;(function(t){t.Unknown="Unknown",t.Yandex="Yandex",t.Chrome="Chrome",t.Chromium="Chromium",t.Firefox="Firefox",t.Safari="Safari",t.Opera="Opera",t.Edge="Edge",t.Rest="Rest"})(exports.CurrentClientBrowser||(exports.CurrentClientBrowser={}));exports.CurrentClientDevice=void 0;(function(t){t.Unknown="Unknown",t.Android="Android",t.iPhone="iPhone",t.iPad="iPad",t.iPod="iPod",t.RestMobile="RestMobile",t.Desktop="Desktop"})(exports.CurrentClientDevice||(exports.CurrentClientDevice={}));const U=()=>{const{userAgent:t}=window.navigator,e=/yabrowser/i.test(t)?exports.CurrentClientBrowser.Yandex:void 0,i=/chrome|crios/i.test(t)?exports.CurrentClientBrowser.Chrome:void 0,n=/chromium/i.test(t)?exports.CurrentClientBrowser.Chromium:void 0,o=/firefox|fxios/i.test(t)?exports.CurrentClientBrowser.Firefox:void 0,s=/webkit|safari|khtml/i.test(t)?exports.CurrentClientBrowser.Safari:void 0,r=/opr\//i.test(t)?exports.CurrentClientBrowser.Opera:void 0,a=/edg/i.test(t)?exports.CurrentClientBrowser.Edge:void 0,l=/android/i.test(t)?exports.CurrentClientDevice.Android:void 0,d=/iphone/i.test(t)?exports.CurrentClientDevice.iPhone:void 0,b=/ipad/i.test(t)?exports.CurrentClientDevice.iPad:void 0,g=/ipod/i.test(t)?exports.CurrentClientDevice.iPod:void 0,N=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?exports.CurrentClientDevice.RestMobile:void 0;return{browser:e||o||r||a||i||n||s||exports.CurrentClientBrowser.Rest,device:l||d||b||g||N||exports.CurrentClientDevice.Desktop}},j=(t,{start:e=0,factor:i=2,max:n=1/0,min:o=e,random:s=0}={})=>{let r=e;return r*=Math.pow(i,t),r*=1+(Math.random()*s*2-s),r=Math.round(r),r=Math.min(r,n),r=Math.max(r,o),r};var c;(function(t){t[t.LOCAL_STORAGE=0]="LOCAL_STORAGE",t[t.SESSION_STORAGE=1]="SESSION_STORAGE",t[t.RUNTIME=2]="RUNTIME"})(c||(c={}));const p=new Map;let h=c.RUNTIME;const _=`vk-videoplayer-dummy-key-${Math.random()}`,F=()=>{try{localStorage.setItem(_,"test"),localStorage.removeItem(_),h=c.LOCAL_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(_),h=c.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)h=c.RUNTIME;else throw e}else throw t}};F();const H=t=>{var e,i;switch(h){case c.LOCAL_STORAGE:return(e=localStorage.getItem(t))!==null&&e!==void 0?e:void 0;case c.SESSION_STORAGE:return(i=sessionStorage.getItem(t))!==null&&i!==void 0?i:void 0;case c.RUNTIME:return p.get(t);default:w(h)}},q=(t,e)=>{switch(h){case c.LOCAL_STORAGE:try{localStorage.setItem(t,e)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case c.SESSION_STORAGE:try{sessionStorage.setItem(t,e)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case c.RUNTIME:return void p.set(t,e);default:w(h)}},B=t=>{switch(h){case c.LOCAL_STORAGE:return t in localStorage;case c.SESSION_STORAGE:return t in sessionStorage;case c.RUNTIME:return p.has(t);default:return w(h),!1}},z=t=>{switch(h){case c.LOCAL_STORAGE:return localStorage.removeItem(t);case c.SESSION_STORAGE:return sessionStorage.removeItem(t);case c.RUNTIME:return void p.delete(t);default:w(h)}},Y=()=>{switch(h){case c.LOCAL_STORAGE:return localStorage.clear();case c.SESSION_STORAGE:return sessionStorage.clear();case c.RUNTIME:return p.clear();default:w(h)}};var $=Object.freeze({__proto__:null,clear:Y,get:H,has:B,remove:z,set:q});exports.VideoQuality=void 0;(function(t){t.INVARIANT="Invariant quality",t.Q_144P="144p",t.Q_240P="240p",t.Q_360P="360p",t.Q_480P="480p",t.Q_720P="720p",t.Q_1080P="1080p",t.Q_1440P="1440p",t.Q_2160P="2160p",t.Q_4320P="4320p"})(exports.VideoQuality||(exports.VideoQuality={}));const f={[exports.VideoQuality.Q_144P]:{width:256,height:144},[exports.VideoQuality.Q_240P]:{width:428,height:240},[exports.VideoQuality.Q_360P]:{width:640,height:360},[exports.VideoQuality.Q_480P]:{width:856,height:480},[exports.VideoQuality.Q_720P]:{width:1280,height:720},[exports.VideoQuality.Q_1080P]:{width:1920,height:1080},[exports.VideoQuality.Q_1440P]:{width:2560,height:1440},[exports.VideoQuality.Q_2160P]:{width:3840,height:2160},[exports.VideoQuality.Q_4320P]:{width:7680,height:4320}},K=(t,e)=>f[t].height>f[e].height,W=(t,e)=>f[t].height>=f[e].height,S=(t,e)=>f[t].height<f[e].height,X=(t,e)=>f[t].height<=f[e].height,J=t=>t.sort((e,i)=>e===i?0:e===exports.VideoQuality.INVARIANT?1:i===exports.VideoQuality.INVARIANT?-1:S(e,i)?1:-1)[0],A=Object.keys(f).sort((t,e)=>S(t,e)?-1:1),Z=(t,e=.02)=>[...A].find(n=>f[n].height*(1+e)>=t),ee=({width:t,height:e})=>{const i=Math.min(t,e),n=Math.max(t,e);return A.find(o=>{const s=f[o];return s.width>=n&&s.height>=i})},te=t=>f[t].height,O=t=>t===exports.VideoQuality.INVARIANT,ie=t=>t.every(e=>!O(e));function ne(t){if(O(t))throw new Error("Expected exact quality")}class re extends x{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){const i=super._subscribe(e);return e.next(this.value),i}}function se(t){return new u(e=>{const i={};let n=Object.keys(t).length;const o=s=>r=>{s in i||n--,i[s]=r,n===0&&e.next(i)};return Object.entries(t).reduce((s,[r,a])=>s.add(a.subscribe(o(r))),new m)})}function oe(...t){return new u(e=>t.reduce((i,n)=>i.add(n.subscribe(e)),new m))}var ae=t=>new u(e=>{const i=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},t);return()=>window.clearTimeout(i)}),ce=t=>new u(e=>{const i=window.setInterval(()=>e.next(),t);return()=>window.clearInterval(i)}),ue=t=>new u(e=>{t.forEach(i=>e.next(i))}),le=(t,e)=>new u(i=>{const n=o=>i.next(o);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});function de(t){return e=>new u(i=>e.subscribe(new he(i,t)))}class he{constructor(e,i){this.destination=e,this.size=i,this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}const fe={leading:!1,trailing:!0};function be(t,e=fe){return i=>new u(n=>i.subscribe(new we(n,t,e)))}class we{constructor(e,i,n){this.destination=e,this.time=i,this.config=n}next(e){this.lastValue=e,I(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(i){if(this.destination.error)this.destination.error(i);else throw i}this.timeout=void 0},this.time)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}const ve={leading:!0,trailing:!1};function ge(t,e=ve){return i=>new u(n=>i.subscribe(new me(n,t,e)))}class me{constructor(e,i,n){this.destination=e,this.time=i,this.config=n}next(e){this.lastValue=e,T(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}function pe(t){return e=>new u(i=>e.subscribe(new Ee(i,t)))}class Ee{constructor(e,i){this.destination=e,this.predicate=i}next(e){let i;try{i=this.predicate(e)}catch(n){throw this.error(n),n}i&&this.destination.next(e)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}function _e(t=(e,i)=>e===i){return e=>new u(i=>e.subscribe(new xe(i,t)))}const y={};class xe{constructor(e,i){this.destination=e,this.predicate=i,this.lastValue=y}next(e){let i;try{i=this.lastValue===y||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}i&&this.destination.next(e)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}function L(t){return e=>new u(i=>e.subscribe(new Se(i,t)))}let Se=class{constructor(e,i){this.destination=e,this.mapper=i}next(e){let i;try{i=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(i)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}};function Oe(t){return L(()=>t)}function ye(){return t=>new u(e=>{let i=!1,n=!1;const o=t.subscribe(s=>{i||(i=!0,e.next(s)),n&&o.unsubscribe()},s=>{var r;i=!0,(r=e.error)===null||r===void 0||r.call(e,s),n&&o.unsubscribe()});return n=!0,i&&o.unsubscribe(),o})}function Ie(){return t=>new u(e=>t.subscribe(new Te(e)))}class Te{constructor(e){this.destination=e,this.hasLast=!1}next(e){const i=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([i,e])}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}function Ae(t){return e=>new u(i=>e.subscribe(new Le(i,t)))}class Le{constructor(e,i){this.destination=e,this.effect=i}next(e){try{this.effect(e)}catch(i){throw this.error(i),i}this.destination.next(e)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}exports.ErrorCategory=void 0;(function(t){t.NETWORK="network",t.VIDEO_PIPELINE="video_pipeline",t.EXTERNAL_API="external_api",t.PARSER="parser",t.DOM="dom",t.WTF="wtf"})(exports.ErrorCategory||(exports.ErrorCategory={}));const Ne=5;exports.ACTIVE_LIVE_VALID_DELAY=Ne;exports.Logger=Q;exports.Observable=u;exports.Subject=x;exports.Subscription=m;exports.VERSION=C;exports.ValueSubject=re;exports.abortable=k;exports.addScript=M;exports.areQualitiesExact=ie;exports.assertNever=w;exports.assertNonNullable=V;exports.assertNullable=P;exports.assertQualityIsExact=ne;exports.buffer=de;exports.checkNever=R;exports.combine=se;exports.debounce=be;exports.filter=pe;exports.filterChanged=_e;exports.fromEvent=le;exports.getCurrentBrowser=U;exports.getExponentialDelay=j;exports.getHighestQuality=J;exports.interval=ce;exports.isHigher=K;exports.isHigherOrEqual=W;exports.isInvariantQuality=O;exports.isLower=S;exports.isLowerOrEqual=X;exports.isNonNullable=I;exports.isNullable=T;exports.map=L;exports.mapTo=Oe;exports.merge=oe;exports.noop=v;exports.now=D;exports.observableFrom=ue;exports.once=ye;exports.pairwise=Ie;exports.safeStorage=$;exports.tap=Ae;exports.throttle=ge;exports.timeout=ae;exports.videoHeightToQuality=Z;exports.videoQualityToHeight=te;exports.videoSizeToQuality=ee;
6
+ "use strict";const R="1.0.26";class E{constructor(){this.subscriptions=[]}unsubscribe(){const e=this.subscriptions;this.subscriptions=[],e.forEach(i=>typeof i=="function"?i():i.unsubscribe())}add(e){return this.subscriptions.push(e),this}}const v=t=>{throw new Error(`${t} is value of unexpected type`)},Q=t=>{},g=()=>{};class u{constructor(e){e&&(this._subscribe=e)}subscribe(e,i){var n;let o;i?typeof i=="function"?o={next:i,error:g}:o={next:a=>i.next(a),error:a=>{var d;return(d=i.error)===null||d===void 0?void 0:d.call(i,a)}}:o={next:g,error:g};const s=typeof e=="function"?{next:a=>{try{e(a)}catch(d){o.next(d)}},error:a=>o.next(a)}:{next:a=>e.next(a),error:a=>e.error?e.error(a):o.next(a)};let r;try{r=this._subscribe(s)}catch(a){(n=s.error)===null||n===void 0||n.call(s,a)}return new E().add(()=>{switch(s.next=g,s.error=g,typeof r){case"function":r();return;case"object":r.unsubscribe();return;case"undefined":return;default:return v(r)}})}pipe(...e){return e.reduce((i,n)=>n(i),this)}_subscribe(e){}}class x extends u{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(e){this.subscribers.forEach(i=>i.next(e))}error(e){this.subscribers.forEach(i=>{var n;return(n=i.error)===null||n===void 0?void 0:n.call(i,e)})}_subscribe(e){const i=this.keyCounter++;return this.subscribers.set(i,e),new E().add(()=>this.subscribers.delete(i))}}class V{constructor(){this.log$=new x,this.logs=[],this.log=e=>{const i=Object.assign(Object.assign({},e),{timestamp:Date.now()});this.logs.push(i),this.log$.next(i)},this.getAllLogs=()=>this.logs}createCustomLog(e){return(...i)=>{let n;try{n=e(...i)}catch(o){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(i=>Object.assign({component:e},i))}}function P(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function M(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function A(t){return typeof t!="undefined"&&t!==null}function T(t){return t==null}const D=(t,e,i)=>new Promise((n,o)=>{e.addEventListener("abort",()=>{a(),h.remove()});const s=()=>{a(),o()},r=()=>{a(),n()},a=()=>{d&&clearTimeout(d),h.removeEventListener("load",r),h.removeEventListener("error",s)};let d;i&&(d=window.setTimeout(s,i));const h=document.createElement("script");h.addEventListener("load",r),h.addEventListener("error",s),h.src=t,document.head.appendChild(h)});var _;const G=typeof((_=window.performance)===null||_===void 0?void 0:_.now)=="function"?()=>window.performance.now():()=>Date.now();function k(t,e,i,n){function o(s){return s instanceof i?s:new i(function(r){r(s)})}return new(i||(i=Promise))(function(s,r){function a(b){try{h(n.next(b))}catch(p){r(p)}}function d(b){try{h(n.throw(b))}catch(p){r(p)}}function h(b){b.done?s(b.value):o(b.value).then(a,d)}h((n=n.apply(t,e||[])).next())})}const U=(t,e)=>(...i)=>k(void 0,void 0,void 0,function*(){var n;const o=e(...i);let s=t.aborted,r;for(;!s&&!t.aborted;){const a=yield o.next(r);s=(n=a.done)!==null&&n!==void 0?n:!1,r=a.value}return r});exports.CurrentClientBrowser=void 0;(function(t){t.Unknown="Unknown",t.Yandex="Yandex",t.Chrome="Chrome",t.Chromium="Chromium",t.Firefox="Firefox",t.Safari="Safari",t.Opera="Opera",t.Edge="Edge",t.Rest="Rest"})(exports.CurrentClientBrowser||(exports.CurrentClientBrowser={}));exports.CurrentClientDevice=void 0;(function(t){t.Unknown="Unknown",t.Android="Android",t.iPhone="iPhone",t.iPad="iPad",t.iPod="iPod",t.RestMobile="RestMobile",t.Desktop="Desktop"})(exports.CurrentClientDevice||(exports.CurrentClientDevice={}));const j=()=>{const{userAgent:t}=window.navigator,e=/yabrowser/i.test(t)?exports.CurrentClientBrowser.Yandex:void 0,i=/chrome|crios/i.test(t)?exports.CurrentClientBrowser.Chrome:void 0,n=/chromium/i.test(t)?exports.CurrentClientBrowser.Chromium:void 0,o=/firefox|fxios/i.test(t)?exports.CurrentClientBrowser.Firefox:void 0,s=/webkit|safari|khtml/i.test(t)?exports.CurrentClientBrowser.Safari:void 0,r=/opr\//i.test(t)?exports.CurrentClientBrowser.Opera:void 0,a=/edg/i.test(t)?exports.CurrentClientBrowser.Edge:void 0,d=/android/i.test(t)?exports.CurrentClientDevice.Android:void 0,h=/iphone/i.test(t)?exports.CurrentClientDevice.iPhone:void 0,b=/ipad/i.test(t)?exports.CurrentClientDevice.iPad:void 0,p=/ipod/i.test(t)?exports.CurrentClientDevice.iPod:void 0,C=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?exports.CurrentClientDevice.RestMobile:void 0;return{browser:e||o||r||a||i||n||s||exports.CurrentClientBrowser.Rest,device:d||h||b||p||C||exports.CurrentClientDevice.Desktop}},F=(t,{start:e=0,factor:i=2,max:n=1/0,min:o=e,random:s=0}={})=>{let r=e;return r*=Math.pow(i,t),r*=1+(Math.random()*s*2-s),r=Math.round(r),r=Math.min(r,n),r=Math.max(r,o),r};var c;(function(t){t[t.LOCAL_STORAGE=0]="LOCAL_STORAGE",t[t.SESSION_STORAGE=1]="SESSION_STORAGE",t[t.RUNTIME=2]="RUNTIME"})(c||(c={}));let l,w;const S=`vk-videoplayer-dummy-key-${Math.random()}`,m=()=>{if(w!==void 0)return w;try{localStorage.setItem(S,"test"),localStorage.removeItem(S),w=c.LOCAL_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(S),w=c.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)w=c.RUNTIME;else throw e}else throw t}return w===c.RUNTIME&&(l=new Map),w},H=()=>m()===c.LOCAL_STORAGE,q=t=>{var e,i;const n=m();switch(n){case c.LOCAL_STORAGE:return(e=localStorage.getItem(t))!==null&&e!==void 0?e:void 0;case c.SESSION_STORAGE:return(i=sessionStorage.getItem(t))!==null&&i!==void 0?i:void 0;case c.RUNTIME:return l==null?void 0:l.get(t);default:v(n)}},B=(t,e)=>{const i=m();switch(i){case c.LOCAL_STORAGE:try{localStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case c.SESSION_STORAGE:try{sessionStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case c.RUNTIME:return void(l==null?void 0:l.set(t,e));default:v(i)}},z=t=>{var e;const i=m();switch(i){case c.LOCAL_STORAGE:return t in localStorage;case c.SESSION_STORAGE:return t in sessionStorage;case c.RUNTIME:return(e=l==null?void 0:l.has(t))!==null&&e!==void 0?e:!1;default:return v(i),!1}},Y=t=>{const e=m();switch(e){case c.LOCAL_STORAGE:return localStorage.removeItem(t);case c.SESSION_STORAGE:return sessionStorage.removeItem(t);case c.RUNTIME:return void(l==null?void 0:l.delete(t));default:v(e)}},$=()=>{const t=m();switch(t){case c.LOCAL_STORAGE:return localStorage.clear();case c.SESSION_STORAGE:return sessionStorage.clear();case c.RUNTIME:return l==null?void 0:l.clear();default:v(t)}};var K=Object.freeze({__proto__:null,clear:$,get:q,has:z,isPersistent:H,remove:Y,set:B});exports.VideoQuality=void 0;(function(t){t.INVARIANT="Invariant quality",t.Q_144P="144p",t.Q_240P="240p",t.Q_360P="360p",t.Q_480P="480p",t.Q_720P="720p",t.Q_1080P="1080p",t.Q_1440P="1440p",t.Q_2160P="2160p",t.Q_4320P="4320p"})(exports.VideoQuality||(exports.VideoQuality={}));const f={[exports.VideoQuality.Q_144P]:{width:256,height:144},[exports.VideoQuality.Q_240P]:{width:428,height:240},[exports.VideoQuality.Q_360P]:{width:640,height:360},[exports.VideoQuality.Q_480P]:{width:856,height:480},[exports.VideoQuality.Q_720P]:{width:1280,height:720},[exports.VideoQuality.Q_1080P]:{width:1920,height:1080},[exports.VideoQuality.Q_1440P]:{width:2560,height:1440},[exports.VideoQuality.Q_2160P]:{width:3840,height:2160},[exports.VideoQuality.Q_4320P]:{width:7680,height:4320}},W=(t,e)=>f[t].height>f[e].height,X=(t,e)=>f[t].height>=f[e].height,O=(t,e)=>f[t].height<f[e].height,J=(t,e)=>f[t].height<=f[e].height,Z=t=>t.sort((e,i)=>e===i?0:e===exports.VideoQuality.INVARIANT?1:i===exports.VideoQuality.INVARIANT?-1:O(e,i)?1:-1)[0],L=Object.keys(f).sort((t,e)=>O(t,e)?-1:1),ee=(t,e=.02)=>[...L].find(n=>f[n].height*(1+e)>=t),te=({width:t,height:e})=>{const i=Math.min(t,e),n=Math.max(t,e);return L.find(o=>{const s=f[o];return s.width>=n&&s.height>=i})},ie=t=>f[t].height,y=t=>t===exports.VideoQuality.INVARIANT,ne=t=>t.every(e=>!y(e));function re(t){if(y(t))throw new Error("Expected exact quality")}class se extends x{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){const i=super._subscribe(e);return e.next(this.value),i}}function oe(t){return new u(e=>{const i={};let n=Object.keys(t).length;const o=s=>r=>{s in i||n--,i[s]=r,n===0&&e.next(i)};return Object.entries(t).reduce((s,[r,a])=>s.add(a.subscribe(o(r))),new E)})}function ae(...t){return new u(e=>t.reduce((i,n)=>i.add(n.subscribe(e)),new E))}var ce=t=>new u(e=>{const i=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},t);return()=>window.clearTimeout(i)}),ue=t=>new u(e=>{const i=window.setInterval(()=>e.next(),t);return()=>window.clearInterval(i)}),le=t=>new u(e=>{t.forEach(i=>e.next(i))}),de=(t,e)=>new u(i=>{const n=o=>i.next(o);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});function he(t){return e=>new u(i=>e.subscribe(new fe(i,t)))}class fe{constructor(e,i){this.destination=e,this.size=i,this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}const be={leading:!1,trailing:!0};function we(t,e=be){return i=>new u(n=>i.subscribe(new ve(n,t,e)))}class ve{constructor(e,i,n){this.destination=e,this.time=i,this.config=n}next(e){this.lastValue=e,A(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(i){if(this.destination.error)this.destination.error(i);else throw i}this.timeout=void 0},this.time)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}const ge={leading:!0,trailing:!1};function me(t,e=ge){return i=>new u(n=>i.subscribe(new pe(n,t,e)))}class pe{constructor(e,i,n){this.destination=e,this.time=i,this.config=n}next(e){this.lastValue=e,T(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}function Ee(t){return e=>new u(i=>e.subscribe(new _e(i,t)))}class _e{constructor(e,i){this.destination=e,this.predicate=i}next(e){let i;try{i=this.predicate(e)}catch(n){throw this.error(n),n}i&&this.destination.next(e)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}function Se(t=(e,i)=>e===i){return e=>new u(i=>e.subscribe(new xe(i,t)))}const I={};class xe{constructor(e,i){this.destination=e,this.predicate=i,this.lastValue=I}next(e){let i;try{i=this.lastValue===I||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}i&&this.destination.next(e)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}function N(t){return e=>new u(i=>e.subscribe(new Oe(i,t)))}let Oe=class{constructor(e,i){this.destination=e,this.mapper=i}next(e){let i;try{i=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(i)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}};function ye(t){return N(()=>t)}function Ie(){return t=>new u(e=>{let i=!1,n=!1;const o=t.subscribe(s=>{i||(i=!0,e.next(s)),n&&o.unsubscribe()},s=>{var r;i=!0,(r=e.error)===null||r===void 0||r.call(e,s),n&&o.unsubscribe()});return n=!0,i&&o.unsubscribe(),o})}function Ae(){return t=>new u(e=>t.subscribe(new Te(e)))}class Te{constructor(e){this.destination=e,this.hasLast=!1}next(e){const i=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([i,e])}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}function Le(t){return e=>new u(i=>e.subscribe(new Ne(i,t)))}class Ne{constructor(e,i){this.destination=e,this.effect=i}next(e){try{this.effect(e)}catch(i){throw this.error(i),i}this.destination.next(e)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}exports.ErrorCategory=void 0;(function(t){t.NETWORK="network",t.VIDEO_PIPELINE="video_pipeline",t.EXTERNAL_API="external_api",t.PARSER="parser",t.DOM="dom",t.WTF="wtf"})(exports.ErrorCategory||(exports.ErrorCategory={}));const Ce=5;exports.ACTIVE_LIVE_VALID_DELAY=Ce;exports.Logger=V;exports.Observable=u;exports.Subject=x;exports.Subscription=E;exports.VERSION=R;exports.ValueSubject=se;exports.abortable=U;exports.addScript=D;exports.areQualitiesExact=ne;exports.assertNever=v;exports.assertNonNullable=P;exports.assertNullable=M;exports.assertQualityIsExact=re;exports.buffer=he;exports.checkNever=Q;exports.combine=oe;exports.debounce=we;exports.filter=Ee;exports.filterChanged=Se;exports.fromEvent=de;exports.getCurrentBrowser=j;exports.getExponentialDelay=F;exports.getHighestQuality=Z;exports.interval=ue;exports.isHigher=W;exports.isHigherOrEqual=X;exports.isInvariantQuality=y;exports.isLower=O;exports.isLowerOrEqual=J;exports.isNonNullable=A;exports.isNullable=T;exports.map=N;exports.mapTo=ye;exports.merge=ae;exports.noop=g;exports.now=G;exports.observableFrom=le;exports.once=Ie;exports.pairwise=Ae;exports.safeStorage=K;exports.tap=Le;exports.throttle=me;exports.timeout=ce;exports.videoHeightToQuality=ee;exports.videoQualityToHeight=ie;exports.videoSizeToQuality=te;
package/es2015.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.25
3
- * Mon, 03 Jul 2023 15:51:34 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-25/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.26
3
+ * Mon, 10 Jul 2023 13:37:00 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-26/doc/
5
5
  */
6
- const Z="1.0.25";class x{constructor(){this.subscriptions=[]}unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach(i=>typeof i=="function"?i():i.unsubscribe())}add(t){return this.subscriptions.push(t),this}}const g=e=>{throw new Error(`${e} is value of unexpected type`)},B=e=>{},E=()=>{};class u{constructor(t){t&&(this._subscribe=t)}subscribe(t,i){var n;let o;i?typeof i=="function"?o={next:i,error:E}:o={next:a=>i.next(a),error:a=>{var h;return(h=i.error)===null||h===void 0?void 0:h.call(i,a)}}:o={next:E,error:E};const r=typeof t=="function"?{next:a=>{try{t(a)}catch(h){o.next(h)}},error:a=>o.next(a)}:{next:a=>t.next(a),error:a=>t.error?t.error(a):o.next(a)};let s;try{s=this._subscribe(r)}catch(a){(n=r.error)===null||n===void 0||n.call(r,a)}return new x().add(()=>{switch(r.next=E,r.error=E,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return g(s)}})}pipe(...t){return t.reduce((i,n)=>n(i),this)}_subscribe(t){}}class T extends u{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(t){this.subscribers.forEach(i=>i.next(t))}error(t){this.subscribers.forEach(i=>{var n;return(n=i.error)===null||n===void 0?void 0:n.call(i,t)})}_subscribe(t){const i=this.keyCounter++;return this.subscribers.set(i,t),new x().add(()=>this.subscribers.delete(i))}}class tt{constructor(){this.log$=new T,this.logs=[],this.log=t=>{const i=Object.assign(Object.assign({},t),{timestamp:Date.now()});this.logs.push(i),this.log$.next(i)},this.getAllLogs=()=>this.logs}createCustomLog(t){return(...i)=>{let n;try{n=t(...i)}catch(o){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(t){return this.createCustomLog(i=>Object.assign({component:t},i))}}function et(e,t='Assertion "value is not nullable" failed'){if(e==null)throw new Error(t)}function it(e,t='Assertion "value is nullable" failed'){if(e!=null)throw new Error(t)}function M(e){return typeof e!="undefined"&&e!==null}function y(e){return e==null}const nt=(e,t,i)=>new Promise((n,o)=>{t.addEventListener("abort",()=>{a(),d.remove()});const r=()=>{a(),o()},s=()=>{a(),n()},a=()=>{h&&clearTimeout(h),d.removeEventListener("load",s),d.removeEventListener("error",r)};let h;i&&(h=window.setTimeout(r,i));const d=document.createElement("script");d.addEventListener("load",s),d.addEventListener("error",r),d.src=e,document.head.appendChild(d)});var S;const st=typeof((S=window.performance)===null||S===void 0?void 0:S.now)=="function"?()=>window.performance.now():()=>Date.now();function Q(e,t,i,n){function o(r){return r instanceof i?r:new i(function(s){s(r)})}return new(i||(i=Promise))(function(r,s){function a(m){try{d(n.next(m))}catch(v){s(v)}}function h(m){try{d(n.throw(m))}catch(v){s(v)}}function d(m){m.done?r(m.value):o(m.value).then(a,h)}d((n=n.apply(e,t||[])).next())})}const rt=(e,t)=>(...i)=>Q(void 0,void 0,void 0,function*(){var n;const o=t(...i);let r=e.aborted,s;for(;!r&&!e.aborted;){const a=yield o.next(s);r=(n=a.done)!==null&&n!==void 0?n:!1,s=a.value}return s});var w;(function(e){e.Unknown="Unknown",e.Yandex="Yandex",e.Chrome="Chrome",e.Chromium="Chromium",e.Firefox="Firefox",e.Safari="Safari",e.Opera="Opera",e.Edge="Edge",e.Rest="Rest"})(w||(w={}));var p;(function(e){e.Unknown="Unknown",e.Android="Android",e.iPhone="iPhone",e.iPad="iPad",e.iPod="iPod",e.RestMobile="RestMobile",e.Desktop="Desktop"})(p||(p={}));const ot=()=>{const{userAgent:e}=window.navigator,t=/yabrowser/i.test(e)?w.Yandex:void 0,i=/chrome|crios/i.test(e)?w.Chrome:void 0,n=/chromium/i.test(e)?w.Chromium:void 0,o=/firefox|fxios/i.test(e)?w.Firefox:void 0,r=/webkit|safari|khtml/i.test(e)?w.Safari:void 0,s=/opr\//i.test(e)?w.Opera:void 0,a=/edg/i.test(e)?w.Edge:void 0,h=/android/i.test(e)?p.Android:void 0,d=/iphone/i.test(e)?p.iPhone:void 0,m=/ipad/i.test(e)?p.iPad:void 0,v=/ipod/i.test(e)?p.iPod:void 0,P=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?p.RestMobile:void 0;return{browser:t||o||s||a||i||n||r||w.Rest,device:h||d||m||v||P||p.Desktop}},at=(e,{start:t=0,factor:i=2,max:n=1/0,min:o=t,random:r=0}={})=>{let s=t;return s*=Math.pow(i,e),s*=1+(Math.random()*r*2-r),s=Math.round(s),s=Math.min(s,n),s=Math.max(s,o),s};var c;(function(e){e[e.LOCAL_STORAGE=0]="LOCAL_STORAGE",e[e.SESSION_STORAGE=1]="SESSION_STORAGE",e[e.RUNTIME=2]="RUNTIME"})(c||(c={}));const _=new Map;let f=c.RUNTIME;const O=`vk-videoplayer-dummy-key-${Math.random()}`,V=()=>{try{localStorage.setItem(O,"test"),localStorage.removeItem(O),f=c.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(O),f=c.SESSION_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)f=c.RUNTIME;else throw t}else throw e}};V();const G=e=>{var t,i;switch(f){case c.LOCAL_STORAGE:return(t=localStorage.getItem(e))!==null&&t!==void 0?t:void 0;case c.SESSION_STORAGE:return(i=sessionStorage.getItem(e))!==null&&i!==void 0?i:void 0;case c.RUNTIME:return _.get(e);default:g(f)}},U=(e,t)=>{switch(f){case c.LOCAL_STORAGE:try{localStorage.setItem(e,t)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case c.SESSION_STORAGE:try{sessionStorage.setItem(e,t)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case c.RUNTIME:return void _.set(e,t);default:g(f)}},k=e=>{switch(f){case c.LOCAL_STORAGE:return e in localStorage;case c.SESSION_STORAGE:return e in sessionStorage;case c.RUNTIME:return _.has(e);default:return g(f),!1}},j=e=>{switch(f){case c.LOCAL_STORAGE:return localStorage.removeItem(e);case c.SESSION_STORAGE:return sessionStorage.removeItem(e);case c.RUNTIME:return void _.delete(e);default:g(f)}},D=()=>{switch(f){case c.LOCAL_STORAGE:return localStorage.clear();case c.SESSION_STORAGE:return sessionStorage.clear();case c.RUNTIME:return _.clear();default:g(f)}};var ct=Object.freeze({__proto__:null,clear:D,get:G,has:k,remove:j,set:U}),l;(function(e){e.INVARIANT="Invariant quality",e.Q_144P="144p",e.Q_240P="240p",e.Q_360P="360p",e.Q_480P="480p",e.Q_720P="720p",e.Q_1080P="1080p",e.Q_1440P="1440p",e.Q_2160P="2160p",e.Q_4320P="4320p"})(l||(l={}));const b={[l.Q_144P]:{width:256,height:144},[l.Q_240P]:{width:428,height:240},[l.Q_360P]:{width:640,height:360},[l.Q_480P]:{width:856,height:480},[l.Q_720P]:{width:1280,height:720},[l.Q_1080P]:{width:1920,height:1080},[l.Q_1440P]:{width:2560,height:1440},[l.Q_2160P]:{width:3840,height:2160},[l.Q_4320P]:{width:7680,height:4320}},ut=(e,t)=>b[e].height>b[t].height,lt=(e,t)=>b[e].height>=b[t].height,L=(e,t)=>b[e].height<b[t].height,ht=(e,t)=>b[e].height<=b[t].height,dt=e=>e.sort((t,i)=>t===i?0:t===l.INVARIANT?1:i===l.INVARIANT?-1:L(t,i)?1:-1)[0],R=Object.keys(b).sort((e,t)=>L(e,t)?-1:1),ft=(e,t=.02)=>[...R].find(n=>b[n].height*(1+t)>=e),bt=({width:e,height:t})=>{const i=Math.min(e,t),n=Math.max(e,t);return R.find(o=>{const r=b[o];return r.width>=n&&r.height>=i})},wt=e=>b[e].height,N=e=>e===l.INVARIANT,mt=e=>e.every(t=>!N(t));function pt(e){if(N(e))throw new Error("Expected exact quality")}class gt extends T{constructor(t){super(),this.value=t}next(t){super.next(this.value=t)}error(t){super.error(this.value=t)}getValue(){return this.value}_subscribe(t){const i=super._subscribe(t);return t.next(this.value),i}}function vt(e){return new u(t=>{const i={};let n=Object.keys(e).length;const o=r=>s=>{r in i||n--,i[r]=s,n===0&&t.next(i)};return Object.entries(e).reduce((r,[s,a])=>r.add(a.subscribe(o(s))),new x)})}function Et(...e){return new u(t=>e.reduce((i,n)=>i.add(n.subscribe(t)),new x))}var _t=e=>new u(t=>{const i=window.setTimeout(()=>{try{t.next()}catch(n){if(t.error)t.error(n);else throw n}},e);return()=>window.clearTimeout(i)}),xt=e=>new u(t=>{const i=window.setInterval(()=>t.next(),e);return()=>window.clearInterval(i)}),St=e=>new u(t=>{e.forEach(i=>t.next(i))}),Ot=(e,t)=>new u(i=>{const n=o=>i.next(o);return e.addEventListener(t,n),()=>e.removeEventListener(t,n)});function At(e){return t=>new u(i=>t.subscribe(new F(i,e)))}class F{constructor(t,i){this.destination=t,this.size=i,this.lastValues=[]}next(t){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(t),this.destination.next(this.lastValues)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}const q={leading:!1,trailing:!0};function It(e,t=q){return i=>new u(n=>i.subscribe(new z(n,e,t)))}class z{constructor(t,i,n){this.destination=t,this.time=i,this.config=n}next(t){this.lastValue=t,M(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(i){if(this.destination.error)this.destination.error(i);else throw i}this.timeout=void 0},this.time)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}const $={leading:!0,trailing:!1};function Tt(e,t=$){return i=>new u(n=>i.subscribe(new H(n,e,t)))}class H{constructor(t,i,n){this.destination=t,this.time=i,this.config=n}next(t){this.lastValue=t,y(this.timeout)&&(this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}function Lt(e){return t=>new u(i=>t.subscribe(new Y(i,e)))}class Y{constructor(t,i){this.destination=t,this.predicate=i}next(t){let i;try{i=this.predicate(t)}catch(n){throw this.error(n),n}i&&this.destination.next(t)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}function Rt(e=(t,i)=>t===i){return t=>new u(i=>t.subscribe(new C(i,e)))}const A={};class C{constructor(t,i){this.destination=t,this.predicate=i,this.lastValue=A}next(t){let i;try{i=this.lastValue===A||!this.predicate(this.lastValue,t),this.lastValue=t}catch(n){throw this.error(n),n}i&&this.destination.next(t)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}function K(e){return t=>new u(i=>t.subscribe(new W(i,e)))}let W=class{constructor(t,i){this.destination=t,this.mapper=i}next(t){let i;try{i=this.mapper(t)}catch(n){throw this.error(n),n}this.destination.next(i)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}};function Pt(e){return K(()=>e)}function Mt(){return e=>new u(t=>{let i=!1,n=!1;const o=e.subscribe(r=>{i||(i=!0,t.next(r)),n&&o.unsubscribe()},r=>{var s;i=!0,(s=t.error)===null||s===void 0||s.call(t,r),n&&o.unsubscribe()});return n=!0,i&&o.unsubscribe(),o})}function yt(){return e=>new u(t=>e.subscribe(new X(t)))}class X{constructor(t){this.destination=t,this.hasLast=!1}next(t){const i=this.last;if(this.last=t,!this.hasLast){this.hasLast=!0;return}this.destination.next([i,t])}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}function Qt(e){return t=>new u(i=>t.subscribe(new J(i,e)))}class J{constructor(t,i){this.destination=t,this.effect=i}next(t){try{this.effect(t)}catch(i){throw this.error(i),i}this.destination.next(t)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}var I;(function(e){e.NETWORK="network",e.VIDEO_PIPELINE="video_pipeline",e.EXTERNAL_API="external_api",e.PARSER="parser",e.DOM="dom",e.WTF="wtf"})(I||(I={}));const Vt=5;export{Vt as ACTIVE_LIVE_VALID_DELAY,w as CurrentClientBrowser,p as CurrentClientDevice,I as ErrorCategory,tt as Logger,u as Observable,T as Subject,x as Subscription,Z as VERSION,gt as ValueSubject,l as VideoQuality,rt as abortable,nt as addScript,mt as areQualitiesExact,g as assertNever,et as assertNonNullable,it as assertNullable,pt as assertQualityIsExact,At as buffer,B as checkNever,vt as combine,It as debounce,Lt as filter,Rt as filterChanged,Ot as fromEvent,ot as getCurrentBrowser,at as getExponentialDelay,dt as getHighestQuality,xt as interval,ut as isHigher,lt as isHigherOrEqual,N as isInvariantQuality,L as isLower,ht as isLowerOrEqual,M as isNonNullable,y as isNullable,K as map,Pt as mapTo,Et as merge,E as noop,st as now,St as observableFrom,Mt as once,yt as pairwise,ct as safeStorage,Qt as tap,Tt as throttle,_t as timeout,ft as videoHeightToQuality,wt as videoQualityToHeight,bt as videoSizeToQuality};
6
+ const B="1.0.26";class S{constructor(){this.subscriptions=[]}unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach(i=>typeof i=="function"?i():i.unsubscribe())}add(t){return this.subscriptions.push(t),this}}const p=e=>{throw new Error(`${e} is value of unexpected type`)},tt=e=>{},x=()=>{};class l{constructor(t){t&&(this._subscribe=t)}subscribe(t,i){var n;let o;i?typeof i=="function"?o={next:i,error:x}:o={next:a=>i.next(a),error:a=>{var h;return(h=i.error)===null||h===void 0?void 0:h.call(i,a)}}:o={next:x,error:x};const r=typeof t=="function"?{next:a=>{try{t(a)}catch(h){o.next(h)}},error:a=>o.next(a)}:{next:a=>t.next(a),error:a=>t.error?t.error(a):o.next(a)};let s;try{s=this._subscribe(r)}catch(a){(n=r.error)===null||n===void 0||n.call(r,a)}return new S().add(()=>{switch(r.next=x,r.error=x,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return p(s)}})}pipe(...t){return t.reduce((i,n)=>n(i),this)}_subscribe(t){}}class L extends l{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(t){this.subscribers.forEach(i=>i.next(t))}error(t){this.subscribers.forEach(i=>{var n;return(n=i.error)===null||n===void 0?void 0:n.call(i,t)})}_subscribe(t){const i=this.keyCounter++;return this.subscribers.set(i,t),new S().add(()=>this.subscribers.delete(i))}}class et{constructor(){this.log$=new L,this.logs=[],this.log=t=>{const i=Object.assign(Object.assign({},t),{timestamp:Date.now()});this.logs.push(i),this.log$.next(i)},this.getAllLogs=()=>this.logs}createCustomLog(t){return(...i)=>{let n;try{n=t(...i)}catch(o){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(t){return this.createCustomLog(i=>Object.assign({component:t},i))}}function it(e,t='Assertion "value is not nullable" failed'){if(e==null)throw new Error(t)}function nt(e,t='Assertion "value is nullable" failed'){if(e!=null)throw new Error(t)}function y(e){return typeof e!="undefined"&&e!==null}function Q(e){return e==null}const st=(e,t,i)=>new Promise((n,o)=>{t.addEventListener("abort",()=>{a(),f.remove()});const r=()=>{a(),o()},s=()=>{a(),n()},a=()=>{h&&clearTimeout(h),f.removeEventListener("load",s),f.removeEventListener("error",r)};let h;i&&(h=window.setTimeout(r,i));const f=document.createElement("script");f.addEventListener("load",s),f.addEventListener("error",r),f.src=e,document.head.appendChild(f)});var O;const rt=typeof((O=window.performance)===null||O===void 0?void 0:O.now)=="function"?()=>window.performance.now():()=>Date.now();function V(e,t,i,n){function o(r){return r instanceof i?r:new i(function(s){s(r)})}return new(i||(i=Promise))(function(r,s){function a(v){try{f(n.next(v))}catch(_){s(_)}}function h(v){try{f(n.throw(v))}catch(_){s(_)}}function f(v){v.done?r(v.value):o(v.value).then(a,h)}f((n=n.apply(e,t||[])).next())})}const ot=(e,t)=>(...i)=>V(void 0,void 0,void 0,function*(){var n;const o=t(...i);let r=e.aborted,s;for(;!r&&!e.aborted;){const a=yield o.next(s);r=(n=a.done)!==null&&n!==void 0?n:!1,s=a.value}return s});var w;(function(e){e.Unknown="Unknown",e.Yandex="Yandex",e.Chrome="Chrome",e.Chromium="Chromium",e.Firefox="Firefox",e.Safari="Safari",e.Opera="Opera",e.Edge="Edge",e.Rest="Rest"})(w||(w={}));var g;(function(e){e.Unknown="Unknown",e.Android="Android",e.iPhone="iPhone",e.iPad="iPad",e.iPod="iPod",e.RestMobile="RestMobile",e.Desktop="Desktop"})(g||(g={}));const at=()=>{const{userAgent:e}=window.navigator,t=/yabrowser/i.test(e)?w.Yandex:void 0,i=/chrome|crios/i.test(e)?w.Chrome:void 0,n=/chromium/i.test(e)?w.Chromium:void 0,o=/firefox|fxios/i.test(e)?w.Firefox:void 0,r=/webkit|safari|khtml/i.test(e)?w.Safari:void 0,s=/opr\//i.test(e)?w.Opera:void 0,a=/edg/i.test(e)?w.Edge:void 0,h=/android/i.test(e)?g.Android:void 0,f=/iphone/i.test(e)?g.iPhone:void 0,v=/ipad/i.test(e)?g.iPad:void 0,_=/ipod/i.test(e)?g.iPod:void 0,M=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?g.RestMobile:void 0;return{browser:t||o||s||a||i||n||r||w.Rest,device:h||f||v||_||M||g.Desktop}},ct=(e,{start:t=0,factor:i=2,max:n=1/0,min:o=t,random:r=0}={})=>{let s=t;return s*=Math.pow(i,e),s*=1+(Math.random()*r*2-r),s=Math.round(s),s=Math.min(s,n),s=Math.max(s,o),s};var c;(function(e){e[e.LOCAL_STORAGE=0]="LOCAL_STORAGE",e[e.SESSION_STORAGE=1]="SESSION_STORAGE",e[e.RUNTIME=2]="RUNTIME"})(c||(c={}));let u,m;const A=`vk-videoplayer-dummy-key-${Math.random()}`,E=()=>{if(m!==void 0)return m;try{localStorage.setItem(A,"test"),localStorage.removeItem(A),m=c.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(A),m=c.SESSION_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)m=c.RUNTIME;else throw t}else throw e}return m===c.RUNTIME&&(u=new Map),m},G=()=>E()===c.LOCAL_STORAGE,U=e=>{var t,i;const n=E();switch(n){case c.LOCAL_STORAGE:return(t=localStorage.getItem(e))!==null&&t!==void 0?t:void 0;case c.SESSION_STORAGE:return(i=sessionStorage.getItem(e))!==null&&i!==void 0?i:void 0;case c.RUNTIME:return u==null?void 0:u.get(e);default:p(n)}},k=(e,t)=>{const i=E();switch(i){case c.LOCAL_STORAGE:try{localStorage.setItem(e,t)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case c.SESSION_STORAGE:try{sessionStorage.setItem(e,t)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case c.RUNTIME:return void(u==null?void 0:u.set(e,t));default:p(i)}},j=e=>{var t;const i=E();switch(i){case c.LOCAL_STORAGE:return e in localStorage;case c.SESSION_STORAGE:return e in sessionStorage;case c.RUNTIME:return(t=u==null?void 0:u.has(e))!==null&&t!==void 0?t:!1;default:return p(i),!1}},D=e=>{const t=E();switch(t){case c.LOCAL_STORAGE:return localStorage.removeItem(e);case c.SESSION_STORAGE:return sessionStorage.removeItem(e);case c.RUNTIME:return void(u==null?void 0:u.delete(e));default:p(t)}},F=()=>{const e=E();switch(e){case c.LOCAL_STORAGE:return localStorage.clear();case c.SESSION_STORAGE:return sessionStorage.clear();case c.RUNTIME:return u==null?void 0:u.clear();default:p(e)}};var ut=Object.freeze({__proto__:null,clear:F,get:U,has:j,isPersistent:G,remove:D,set:k}),d;(function(e){e.INVARIANT="Invariant quality",e.Q_144P="144p",e.Q_240P="240p",e.Q_360P="360p",e.Q_480P="480p",e.Q_720P="720p",e.Q_1080P="1080p",e.Q_1440P="1440p",e.Q_2160P="2160p",e.Q_4320P="4320p"})(d||(d={}));const b={[d.Q_144P]:{width:256,height:144},[d.Q_240P]:{width:428,height:240},[d.Q_360P]:{width:640,height:360},[d.Q_480P]:{width:856,height:480},[d.Q_720P]:{width:1280,height:720},[d.Q_1080P]:{width:1920,height:1080},[d.Q_1440P]:{width:2560,height:1440},[d.Q_2160P]:{width:3840,height:2160},[d.Q_4320P]:{width:7680,height:4320}},lt=(e,t)=>b[e].height>b[t].height,dt=(e,t)=>b[e].height>=b[t].height,R=(e,t)=>b[e].height<b[t].height,ht=(e,t)=>b[e].height<=b[t].height,ft=e=>e.sort((t,i)=>t===i?0:t===d.INVARIANT?1:i===d.INVARIANT?-1:R(t,i)?1:-1)[0],N=Object.keys(b).sort((e,t)=>R(e,t)?-1:1),bt=(e,t=.02)=>[...N].find(n=>b[n].height*(1+t)>=e),wt=({width:e,height:t})=>{const i=Math.min(e,t),n=Math.max(e,t);return N.find(o=>{const r=b[o];return r.width>=n&&r.height>=i})},vt=e=>b[e].height,P=e=>e===d.INVARIANT,gt=e=>e.every(t=>!P(t));function mt(e){if(P(e))throw new Error("Expected exact quality")}class pt extends L{constructor(t){super(),this.value=t}next(t){super.next(this.value=t)}error(t){super.error(this.value=t)}getValue(){return this.value}_subscribe(t){const i=super._subscribe(t);return t.next(this.value),i}}function Et(e){return new l(t=>{const i={};let n=Object.keys(e).length;const o=r=>s=>{r in i||n--,i[r]=s,n===0&&t.next(i)};return Object.entries(e).reduce((r,[s,a])=>r.add(a.subscribe(o(s))),new S)})}function _t(...e){return new l(t=>e.reduce((i,n)=>i.add(n.subscribe(t)),new S))}var xt=e=>new l(t=>{const i=window.setTimeout(()=>{try{t.next()}catch(n){if(t.error)t.error(n);else throw n}},e);return()=>window.clearTimeout(i)}),St=e=>new l(t=>{const i=window.setInterval(()=>t.next(),e);return()=>window.clearInterval(i)}),Ot=e=>new l(t=>{e.forEach(i=>t.next(i))}),At=(e,t)=>new l(i=>{const n=o=>i.next(o);return e.addEventListener(t,n),()=>e.removeEventListener(t,n)});function It(e){return t=>new l(i=>t.subscribe(new q(i,e)))}class q{constructor(t,i){this.destination=t,this.size=i,this.lastValues=[]}next(t){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(t),this.destination.next(this.lastValues)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}const z={leading:!1,trailing:!0};function Tt(e,t=z){return i=>new l(n=>i.subscribe(new $(n,e,t)))}class ${constructor(t,i,n){this.destination=t,this.time=i,this.config=n}next(t){this.lastValue=t,y(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(i){if(this.destination.error)this.destination.error(i);else throw i}this.timeout=void 0},this.time)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}const H={leading:!0,trailing:!1};function Lt(e,t=H){return i=>new l(n=>i.subscribe(new Y(n,e,t)))}class Y{constructor(t,i,n){this.destination=t,this.time=i,this.config=n}next(t){this.lastValue=t,Q(this.timeout)&&(this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}function Rt(e){return t=>new l(i=>t.subscribe(new C(i,e)))}class C{constructor(t,i){this.destination=t,this.predicate=i}next(t){let i;try{i=this.predicate(t)}catch(n){throw this.error(n),n}i&&this.destination.next(t)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}function Nt(e=(t,i)=>t===i){return t=>new l(i=>t.subscribe(new K(i,e)))}const I={};class K{constructor(t,i){this.destination=t,this.predicate=i,this.lastValue=I}next(t){let i;try{i=this.lastValue===I||!this.predicate(this.lastValue,t),this.lastValue=t}catch(n){throw this.error(n),n}i&&this.destination.next(t)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}function W(e){return t=>new l(i=>t.subscribe(new X(i,e)))}let X=class{constructor(t,i){this.destination=t,this.mapper=i}next(t){let i;try{i=this.mapper(t)}catch(n){throw this.error(n),n}this.destination.next(i)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}};function Mt(e){return W(()=>e)}function yt(){return e=>new l(t=>{let i=!1,n=!1;const o=e.subscribe(r=>{i||(i=!0,t.next(r)),n&&o.unsubscribe()},r=>{var s;i=!0,(s=t.error)===null||s===void 0||s.call(t,r),n&&o.unsubscribe()});return n=!0,i&&o.unsubscribe(),o})}function Qt(){return e=>new l(t=>e.subscribe(new J(t)))}class J{constructor(t){this.destination=t,this.hasLast=!1}next(t){const i=this.last;if(this.last=t,!this.hasLast){this.hasLast=!0;return}this.destination.next([i,t])}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}function Vt(e){return t=>new l(i=>t.subscribe(new Z(i,e)))}class Z{constructor(t,i){this.destination=t,this.effect=i}next(t){try{this.effect(t)}catch(i){throw this.error(i),i}this.destination.next(t)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}var T;(function(e){e.NETWORK="network",e.VIDEO_PIPELINE="video_pipeline",e.EXTERNAL_API="external_api",e.PARSER="parser",e.DOM="dom",e.WTF="wtf"})(T||(T={}));const Gt=5;export{Gt as ACTIVE_LIVE_VALID_DELAY,w as CurrentClientBrowser,g as CurrentClientDevice,T as ErrorCategory,et as Logger,l as Observable,L as Subject,S as Subscription,B as VERSION,pt as ValueSubject,d as VideoQuality,ot as abortable,st as addScript,gt as areQualitiesExact,p as assertNever,it as assertNonNullable,nt as assertNullable,mt as assertQualityIsExact,It as buffer,tt as checkNever,Et as combine,Tt as debounce,Rt as filter,Nt as filterChanged,At as fromEvent,at as getCurrentBrowser,ct as getExponentialDelay,ft as getHighestQuality,St as interval,lt as isHigher,dt as isHigherOrEqual,P as isInvariantQuality,R as isLower,ht as isLowerOrEqual,y as isNonNullable,Q as isNullable,W as map,Mt as mapTo,_t as merge,x as noop,rt as now,Ot as observableFrom,yt as once,Qt as pairwise,ut as safeStorage,Vt as tap,Lt as throttle,xt as timeout,bt as videoHeightToQuality,vt as videoQualityToHeight,wt as videoSizeToQuality};
package/es2018.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.25
3
- * Mon, 03 Jul 2023 15:51:34 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-25/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.26
3
+ * Mon, 10 Jul 2023 13:37:00 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-26/doc/
5
5
  */
6
- "use strict";const C="1.0.25";class g{constructor(){this.subscriptions=[]}unsubscribe(){const e=this.subscriptions;this.subscriptions=[],e.forEach(i=>typeof i=="function"?i():i.unsubscribe())}add(e){return this.subscriptions.push(e),this}}const b=t=>{throw new Error(`${t} is value of unexpected type`)},R=t=>{},w=()=>{};class u{constructor(e){e&&(this._subscribe=e)}subscribe(e,i){var r;let o;i?typeof i=="function"?o={next:i,error:w}:o={next:a=>i.next(a),error:a=>{var h;return(h=i.error)===null||h===void 0?void 0:h.call(i,a)}}:o={next:w,error:w};const s=typeof e=="function"?{next:a=>{try{e(a)}catch(h){o.next(h)}},error:a=>o.next(a)}:{next:a=>e.next(a),error:a=>e.error?e.error(a):o.next(a)};let n;try{n=this._subscribe(s)}catch(a){(r=s.error)===null||r===void 0||r.call(s,a)}return new g().add(()=>{switch(s.next=w,s.error=w,typeof n){case"function":n();return;case"object":n.unsubscribe();return;case"undefined":return;default:return b(n)}})}pipe(...e){return e.reduce((i,r)=>r(i),this)}_subscribe(e){}}class p extends u{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(e){this.subscribers.forEach(i=>i.next(e))}error(e){this.subscribers.forEach(i=>{var r;return(r=i.error)===null||r===void 0?void 0:r.call(i,e)})}_subscribe(e){const i=this.keyCounter++;return this.subscribers.set(i,e),new g().add(()=>this.subscribers.delete(i))}}class Q{constructor(){this.log$=new p,this.logs=[],this.log=e=>{const i={...e,timestamp:Date.now()};this.logs.push(i),this.log$.next(i)},this.getAllLogs=()=>this.logs}createCustomLog(e){return(...i)=>{let r;try{r=e(...i)}catch(o){r={message:"error in `createCustomLog`",component:"Logger"}}this.log(r)}}createComponentLog(e){return this.createCustomLog(i=>({component:e,...i}))}}function V(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function P(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function O(t){return typeof t!="undefined"&&t!==null}function I(t){return t==null}const M=(t,e,i)=>new Promise((r,o)=>{e.addEventListener("abort",()=>{a(),f.remove()});const s=()=>{a(),o()},n=()=>{a(),r()},a=()=>{h&&clearTimeout(h),f.removeEventListener("load",n),f.removeEventListener("error",s)};let h;i&&(h=window.setTimeout(s,i));const f=document.createElement("script");f.addEventListener("load",n),f.addEventListener("error",s),f.src=t,document.head.appendChild(f)});var m;const D=typeof((m=window.performance)===null||m===void 0?void 0:m.now)=="function"?()=>window.performance.now():()=>Date.now(),G=(t,e)=>async(...i)=>{var r;const o=e(...i);let s=t.aborted,n;for(;!s&&!t.aborted;){const a=await o.next(n);s=(r=a.done)!==null&&r!==void 0?r:!1,n=a.value}return n};exports.CurrentClientBrowser=void 0;(function(t){t.Unknown="Unknown",t.Yandex="Yandex",t.Chrome="Chrome",t.Chromium="Chromium",t.Firefox="Firefox",t.Safari="Safari",t.Opera="Opera",t.Edge="Edge",t.Rest="Rest"})(exports.CurrentClientBrowser||(exports.CurrentClientBrowser={}));exports.CurrentClientDevice=void 0;(function(t){t.Unknown="Unknown",t.Android="Android",t.iPhone="iPhone",t.iPad="iPad",t.iPod="iPod",t.RestMobile="RestMobile",t.Desktop="Desktop"})(exports.CurrentClientDevice||(exports.CurrentClientDevice={}));const k=()=>{const{userAgent:t}=window.navigator,e=/yabrowser/i.test(t)?exports.CurrentClientBrowser.Yandex:void 0,i=/chrome|crios/i.test(t)?exports.CurrentClientBrowser.Chrome:void 0,r=/chromium/i.test(t)?exports.CurrentClientBrowser.Chromium:void 0,o=/firefox|fxios/i.test(t)?exports.CurrentClientBrowser.Firefox:void 0,s=/webkit|safari|khtml/i.test(t)?exports.CurrentClientBrowser.Safari:void 0,n=/opr\//i.test(t)?exports.CurrentClientBrowser.Opera:void 0,a=/edg/i.test(t)?exports.CurrentClientBrowser.Edge:void 0,h=/android/i.test(t)?exports.CurrentClientDevice.Android:void 0,f=/iphone/i.test(t)?exports.CurrentClientDevice.iPhone:void 0,A=/ipad/i.test(t)?exports.CurrentClientDevice.iPad:void 0,L=/ipod/i.test(t)?exports.CurrentClientDevice.iPod:void 0,N=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?exports.CurrentClientDevice.RestMobile:void 0;return{browser:e||o||n||a||i||r||s||exports.CurrentClientBrowser.Rest,device:h||f||A||L||N||exports.CurrentClientDevice.Desktop}},U=(t,{start:e=0,factor:i=2,max:r=1/0,min:o=e,random:s=0}={})=>{let n=e;return n*=i**t,n*=1+(Math.random()*s*2-s),n=Math.round(n),n=Math.min(n,r),n=Math.max(n,o),n};var c;(function(t){t[t.LOCAL_STORAGE=0]="LOCAL_STORAGE",t[t.SESSION_STORAGE=1]="SESSION_STORAGE",t[t.RUNTIME=2]="RUNTIME"})(c||(c={}));const v=new Map;let l=c.RUNTIME;const E=`vk-videoplayer-dummy-key-${Math.random()}`,F=()=>{try{localStorage.setItem(E,"test"),localStorage.removeItem(E),l=c.LOCAL_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(E),l=c.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)l=c.RUNTIME;else throw e}else throw t}};F();const H=t=>{var e,i;switch(l){case c.LOCAL_STORAGE:return(e=localStorage.getItem(t))!==null&&e!==void 0?e:void 0;case c.SESSION_STORAGE:return(i=sessionStorage.getItem(t))!==null&&i!==void 0?i:void 0;case c.RUNTIME:return v.get(t);default:b(l)}},j=(t,e)=>{switch(l){case c.LOCAL_STORAGE:try{localStorage.setItem(t,e)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case c.SESSION_STORAGE:try{sessionStorage.setItem(t,e)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case c.RUNTIME:return void v.set(t,e);default:b(l)}},q=t=>{switch(l){case c.LOCAL_STORAGE:return t in localStorage;case c.SESSION_STORAGE:return t in sessionStorage;case c.RUNTIME:return v.has(t);default:return b(l),!1}},B=t=>{switch(l){case c.LOCAL_STORAGE:return localStorage.removeItem(t);case c.SESSION_STORAGE:return sessionStorage.removeItem(t);case c.RUNTIME:return void v.delete(t);default:b(l)}},z=()=>{switch(l){case c.LOCAL_STORAGE:return localStorage.clear();case c.SESSION_STORAGE:return sessionStorage.clear();case c.RUNTIME:return v.clear();default:b(l)}};var Y=Object.freeze({__proto__:null,clear:z,get:H,has:q,remove:B,set:j});exports.VideoQuality=void 0;(function(t){t.INVARIANT="Invariant quality",t.Q_144P="144p",t.Q_240P="240p",t.Q_360P="360p",t.Q_480P="480p",t.Q_720P="720p",t.Q_1080P="1080p",t.Q_1440P="1440p",t.Q_2160P="2160p",t.Q_4320P="4320p"})(exports.VideoQuality||(exports.VideoQuality={}));const d={[exports.VideoQuality.Q_144P]:{width:256,height:144},[exports.VideoQuality.Q_240P]:{width:428,height:240},[exports.VideoQuality.Q_360P]:{width:640,height:360},[exports.VideoQuality.Q_480P]:{width:856,height:480},[exports.VideoQuality.Q_720P]:{width:1280,height:720},[exports.VideoQuality.Q_1080P]:{width:1920,height:1080},[exports.VideoQuality.Q_1440P]:{width:2560,height:1440},[exports.VideoQuality.Q_2160P]:{width:3840,height:2160},[exports.VideoQuality.Q_4320P]:{width:7680,height:4320}},$=(t,e)=>d[t].height>d[e].height,K=(t,e)=>d[t].height>=d[e].height,_=(t,e)=>d[t].height<d[e].height,W=(t,e)=>d[t].height<=d[e].height,X=t=>t.sort((e,i)=>e===i?0:e===exports.VideoQuality.INVARIANT?1:i===exports.VideoQuality.INVARIANT?-1:_(e,i)?1:-1)[0],T=Object.keys(d).sort((t,e)=>_(t,e)?-1:1),J=(t,e=.02)=>[...T].find(r=>d[r].height*(1+e)>=t),Z=({width:t,height:e})=>{const i=Math.min(t,e),r=Math.max(t,e);return T.find(o=>{const s=d[o];return s.width>=r&&s.height>=i})},ee=t=>d[t].height,S=t=>t===exports.VideoQuality.INVARIANT,te=t=>t.every(e=>!S(e));function ie(t){if(S(t))throw new Error("Expected exact quality")}class re extends p{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){const i=super._subscribe(e);return e.next(this.value),i}}function ne(t){return new u(e=>{const i={};let r=Object.keys(t).length;const o=s=>n=>{s in i||r--,i[s]=n,r===0&&e.next(i)};return Object.entries(t).reduce((s,[n,a])=>s.add(a.subscribe(o(n))),new g)})}function se(...t){return new u(e=>t.reduce((i,r)=>i.add(r.subscribe(e)),new g))}var oe=t=>new u(e=>{const i=window.setTimeout(()=>{try{e.next()}catch(r){if(e.error)e.error(r);else throw r}},t);return()=>window.clearTimeout(i)}),ae=t=>new u(e=>{const i=window.setInterval(()=>e.next(),t);return()=>window.clearInterval(i)}),ce=t=>new u(e=>{t.forEach(i=>e.next(i))}),ue=(t,e)=>new u(i=>{const r=o=>i.next(o);return t.addEventListener(e,r),()=>t.removeEventListener(e,r)});function le(t){return e=>new u(i=>e.subscribe(new de(i,t)))}class de{constructor(e,i){this.destination=e,this.size=i,this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}}const he={leading:!1,trailing:!0};function fe(t,e=he){return i=>new u(r=>i.subscribe(new be(r,t,e)))}class be{constructor(e,i,r){this.destination=e,this.time=i,this.config=r}next(e){this.lastValue=e,O(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(i){if(this.destination.error)this.destination.error(i);else throw i}this.timeout=void 0},this.time)}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}}const we={leading:!0,trailing:!1};function ge(t,e=we){return i=>new u(r=>i.subscribe(new ve(r,t,e)))}class ve{constructor(e,i,r){this.destination=e,this.time=i,this.config=r}next(e){this.lastValue=e,I(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}}function me(t){return e=>new u(i=>e.subscribe(new Ee(i,t)))}class Ee{constructor(e,i){this.destination=e,this.predicate=i}next(e){let i;try{i=this.predicate(e)}catch(r){throw this.error(r),r}i&&this.destination.next(e)}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}}function pe(t=(e,i)=>e===i){return e=>new u(i=>e.subscribe(new _e(i,t)))}const x={};class _e{constructor(e,i){this.destination=e,this.predicate=i,this.lastValue=x}next(e){let i;try{i=this.lastValue===x||!this.predicate(this.lastValue,e),this.lastValue=e}catch(r){throw this.error(r),r}i&&this.destination.next(e)}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}}function y(t){return e=>new u(i=>e.subscribe(new Se(i,t)))}let Se=class{constructor(e,i){this.destination=e,this.mapper=i}next(e){let i;try{i=this.mapper(e)}catch(r){throw this.error(r),r}this.destination.next(i)}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}};function xe(t){return y(()=>t)}function Oe(){return t=>new u(e=>{let i=!1,r=!1;const o=t.subscribe(s=>{i||(i=!0,e.next(s)),r&&o.unsubscribe()},s=>{var n;i=!0,(n=e.error)===null||n===void 0||n.call(e,s),r&&o.unsubscribe()});return r=!0,i&&o.unsubscribe(),o})}function Ie(){return t=>new u(e=>t.subscribe(new Te(e)))}class Te{constructor(e){this.destination=e,this.hasLast=!1}next(e){const i=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([i,e])}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}}function ye(t){return e=>new u(i=>e.subscribe(new Ae(i,t)))}class Ae{constructor(e,i){this.destination=e,this.effect=i}next(e){try{this.effect(e)}catch(i){throw this.error(i),i}this.destination.next(e)}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}}exports.ErrorCategory=void 0;(function(t){t.NETWORK="network",t.VIDEO_PIPELINE="video_pipeline",t.EXTERNAL_API="external_api",t.PARSER="parser",t.DOM="dom",t.WTF="wtf"})(exports.ErrorCategory||(exports.ErrorCategory={}));const Le=5;exports.ACTIVE_LIVE_VALID_DELAY=Le;exports.Logger=Q;exports.Observable=u;exports.Subject=p;exports.Subscription=g;exports.VERSION=C;exports.ValueSubject=re;exports.abortable=G;exports.addScript=M;exports.areQualitiesExact=te;exports.assertNever=b;exports.assertNonNullable=V;exports.assertNullable=P;exports.assertQualityIsExact=ie;exports.buffer=le;exports.checkNever=R;exports.combine=ne;exports.debounce=fe;exports.filter=me;exports.filterChanged=pe;exports.fromEvent=ue;exports.getCurrentBrowser=k;exports.getExponentialDelay=U;exports.getHighestQuality=X;exports.interval=ae;exports.isHigher=$;exports.isHigherOrEqual=K;exports.isInvariantQuality=S;exports.isLower=_;exports.isLowerOrEqual=W;exports.isNonNullable=O;exports.isNullable=I;exports.map=y;exports.mapTo=xe;exports.merge=se;exports.noop=w;exports.now=D;exports.observableFrom=ce;exports.once=Oe;exports.pairwise=Ie;exports.safeStorage=Y;exports.tap=ye;exports.throttle=ge;exports.timeout=oe;exports.videoHeightToQuality=J;exports.videoQualityToHeight=ee;exports.videoSizeToQuality=Z;
6
+ "use strict";const R="1.0.26";class m{constructor(){this.subscriptions=[]}unsubscribe(){const e=this.subscriptions;this.subscriptions=[],e.forEach(i=>typeof i=="function"?i():i.unsubscribe())}add(e){return this.subscriptions.push(e),this}}const v=t=>{throw new Error(`${t} is value of unexpected type`)},Q=t=>{},w=()=>{};class u{constructor(e){e&&(this._subscribe=e)}subscribe(e,i){var r;let o;i?typeof i=="function"?o={next:i,error:w}:o={next:a=>i.next(a),error:a=>{var h;return(h=i.error)===null||h===void 0?void 0:h.call(i,a)}}:o={next:w,error:w};const s=typeof e=="function"?{next:a=>{try{e(a)}catch(h){o.next(h)}},error:a=>o.next(a)}:{next:a=>e.next(a),error:a=>e.error?e.error(a):o.next(a)};let n;try{n=this._subscribe(s)}catch(a){(r=s.error)===null||r===void 0||r.call(s,a)}return new m().add(()=>{switch(s.next=w,s.error=w,typeof n){case"function":n();return;case"object":n.unsubscribe();return;case"undefined":return;default:return v(n)}})}pipe(...e){return e.reduce((i,r)=>r(i),this)}_subscribe(e){}}class _ extends u{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(e){this.subscribers.forEach(i=>i.next(e))}error(e){this.subscribers.forEach(i=>{var r;return(r=i.error)===null||r===void 0?void 0:r.call(i,e)})}_subscribe(e){const i=this.keyCounter++;return this.subscribers.set(i,e),new m().add(()=>this.subscribers.delete(i))}}class P{constructor(){this.log$=new _,this.logs=[],this.log=e=>{const i={...e,timestamp:Date.now()};this.logs.push(i),this.log$.next(i)},this.getAllLogs=()=>this.logs}createCustomLog(e){return(...i)=>{let r;try{r=e(...i)}catch(o){r={message:"error in `createCustomLog`",component:"Logger"}}this.log(r)}}createComponentLog(e){return this.createCustomLog(i=>({component:e,...i}))}}function V(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function M(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function I(t){return typeof t!="undefined"&&t!==null}function A(t){return t==null}const D=(t,e,i)=>new Promise((r,o)=>{e.addEventListener("abort",()=>{a(),f.remove()});const s=()=>{a(),o()},n=()=>{a(),r()},a=()=>{h&&clearTimeout(h),f.removeEventListener("load",n),f.removeEventListener("error",s)};let h;i&&(h=window.setTimeout(s,i));const f=document.createElement("script");f.addEventListener("load",n),f.addEventListener("error",s),f.src=t,document.head.appendChild(f)});var E;const G=typeof((E=window.performance)===null||E===void 0?void 0:E.now)=="function"?()=>window.performance.now():()=>Date.now(),k=(t,e)=>async(...i)=>{var r;const o=e(...i);let s=t.aborted,n;for(;!s&&!t.aborted;){const a=await o.next(n);s=(r=a.done)!==null&&r!==void 0?r:!1,n=a.value}return n};exports.CurrentClientBrowser=void 0;(function(t){t.Unknown="Unknown",t.Yandex="Yandex",t.Chrome="Chrome",t.Chromium="Chromium",t.Firefox="Firefox",t.Safari="Safari",t.Opera="Opera",t.Edge="Edge",t.Rest="Rest"})(exports.CurrentClientBrowser||(exports.CurrentClientBrowser={}));exports.CurrentClientDevice=void 0;(function(t){t.Unknown="Unknown",t.Android="Android",t.iPhone="iPhone",t.iPad="iPad",t.iPod="iPod",t.RestMobile="RestMobile",t.Desktop="Desktop"})(exports.CurrentClientDevice||(exports.CurrentClientDevice={}));const U=()=>{const{userAgent:t}=window.navigator,e=/yabrowser/i.test(t)?exports.CurrentClientBrowser.Yandex:void 0,i=/chrome|crios/i.test(t)?exports.CurrentClientBrowser.Chrome:void 0,r=/chromium/i.test(t)?exports.CurrentClientBrowser.Chromium:void 0,o=/firefox|fxios/i.test(t)?exports.CurrentClientBrowser.Firefox:void 0,s=/webkit|safari|khtml/i.test(t)?exports.CurrentClientBrowser.Safari:void 0,n=/opr\//i.test(t)?exports.CurrentClientBrowser.Opera:void 0,a=/edg/i.test(t)?exports.CurrentClientBrowser.Edge:void 0,h=/android/i.test(t)?exports.CurrentClientDevice.Android:void 0,f=/iphone/i.test(t)?exports.CurrentClientDevice.iPhone:void 0,y=/ipad/i.test(t)?exports.CurrentClientDevice.iPad:void 0,N=/ipod/i.test(t)?exports.CurrentClientDevice.iPod:void 0,C=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?exports.CurrentClientDevice.RestMobile:void 0;return{browser:e||o||n||a||i||r||s||exports.CurrentClientBrowser.Rest,device:h||f||y||N||C||exports.CurrentClientDevice.Desktop}},F=(t,{start:e=0,factor:i=2,max:r=1/0,min:o=e,random:s=0}={})=>{let n=e;return n*=i**t,n*=1+(Math.random()*s*2-s),n=Math.round(n),n=Math.min(n,r),n=Math.max(n,o),n};var c;(function(t){t[t.LOCAL_STORAGE=0]="LOCAL_STORAGE",t[t.SESSION_STORAGE=1]="SESSION_STORAGE",t[t.RUNTIME=2]="RUNTIME"})(c||(c={}));let l,b;const p=`vk-videoplayer-dummy-key-${Math.random()}`,g=()=>{if(b!==void 0)return b;try{localStorage.setItem(p,"test"),localStorage.removeItem(p),b=c.LOCAL_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(p),b=c.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)b=c.RUNTIME;else throw e}else throw t}return b===c.RUNTIME&&(l=new Map),b},H=()=>g()===c.LOCAL_STORAGE,j=t=>{var e,i;const r=g();switch(r){case c.LOCAL_STORAGE:return(e=localStorage.getItem(t))!==null&&e!==void 0?e:void 0;case c.SESSION_STORAGE:return(i=sessionStorage.getItem(t))!==null&&i!==void 0?i:void 0;case c.RUNTIME:return l==null?void 0:l.get(t);default:v(r)}},q=(t,e)=>{const i=g();switch(i){case c.LOCAL_STORAGE:try{localStorage.setItem(t,e)}catch(r){if(r instanceof DOMException)console.error(r);else throw r}break;case c.SESSION_STORAGE:try{sessionStorage.setItem(t,e)}catch(r){if(r instanceof DOMException)console.error(r);else throw r}break;case c.RUNTIME:return void(l==null?void 0:l.set(t,e));default:v(i)}},B=t=>{var e;const i=g();switch(i){case c.LOCAL_STORAGE:return t in localStorage;case c.SESSION_STORAGE:return t in sessionStorage;case c.RUNTIME:return(e=l==null?void 0:l.has(t))!==null&&e!==void 0?e:!1;default:return v(i),!1}},z=t=>{const e=g();switch(e){case c.LOCAL_STORAGE:return localStorage.removeItem(t);case c.SESSION_STORAGE:return sessionStorage.removeItem(t);case c.RUNTIME:return void(l==null?void 0:l.delete(t));default:v(e)}},Y=()=>{const t=g();switch(t){case c.LOCAL_STORAGE:return localStorage.clear();case c.SESSION_STORAGE:return sessionStorage.clear();case c.RUNTIME:return l==null?void 0:l.clear();default:v(t)}};var $=Object.freeze({__proto__:null,clear:Y,get:j,has:B,isPersistent:H,remove:z,set:q});exports.VideoQuality=void 0;(function(t){t.INVARIANT="Invariant quality",t.Q_144P="144p",t.Q_240P="240p",t.Q_360P="360p",t.Q_480P="480p",t.Q_720P="720p",t.Q_1080P="1080p",t.Q_1440P="1440p",t.Q_2160P="2160p",t.Q_4320P="4320p"})(exports.VideoQuality||(exports.VideoQuality={}));const d={[exports.VideoQuality.Q_144P]:{width:256,height:144},[exports.VideoQuality.Q_240P]:{width:428,height:240},[exports.VideoQuality.Q_360P]:{width:640,height:360},[exports.VideoQuality.Q_480P]:{width:856,height:480},[exports.VideoQuality.Q_720P]:{width:1280,height:720},[exports.VideoQuality.Q_1080P]:{width:1920,height:1080},[exports.VideoQuality.Q_1440P]:{width:2560,height:1440},[exports.VideoQuality.Q_2160P]:{width:3840,height:2160},[exports.VideoQuality.Q_4320P]:{width:7680,height:4320}},K=(t,e)=>d[t].height>d[e].height,W=(t,e)=>d[t].height>=d[e].height,S=(t,e)=>d[t].height<d[e].height,X=(t,e)=>d[t].height<=d[e].height,J=t=>t.sort((e,i)=>e===i?0:e===exports.VideoQuality.INVARIANT?1:i===exports.VideoQuality.INVARIANT?-1:S(e,i)?1:-1)[0],T=Object.keys(d).sort((t,e)=>S(t,e)?-1:1),Z=(t,e=.02)=>[...T].find(r=>d[r].height*(1+e)>=t),ee=({width:t,height:e})=>{const i=Math.min(t,e),r=Math.max(t,e);return T.find(o=>{const s=d[o];return s.width>=r&&s.height>=i})},te=t=>d[t].height,x=t=>t===exports.VideoQuality.INVARIANT,ie=t=>t.every(e=>!x(e));function re(t){if(x(t))throw new Error("Expected exact quality")}class ne extends _{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){const i=super._subscribe(e);return e.next(this.value),i}}function se(t){return new u(e=>{const i={};let r=Object.keys(t).length;const o=s=>n=>{s in i||r--,i[s]=n,r===0&&e.next(i)};return Object.entries(t).reduce((s,[n,a])=>s.add(a.subscribe(o(n))),new m)})}function oe(...t){return new u(e=>t.reduce((i,r)=>i.add(r.subscribe(e)),new m))}var ae=t=>new u(e=>{const i=window.setTimeout(()=>{try{e.next()}catch(r){if(e.error)e.error(r);else throw r}},t);return()=>window.clearTimeout(i)}),ce=t=>new u(e=>{const i=window.setInterval(()=>e.next(),t);return()=>window.clearInterval(i)}),ue=t=>new u(e=>{t.forEach(i=>e.next(i))}),le=(t,e)=>new u(i=>{const r=o=>i.next(o);return t.addEventListener(e,r),()=>t.removeEventListener(e,r)});function de(t){return e=>new u(i=>e.subscribe(new he(i,t)))}class he{constructor(e,i){this.destination=e,this.size=i,this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}}const fe={leading:!1,trailing:!0};function be(t,e=fe){return i=>new u(r=>i.subscribe(new ve(r,t,e)))}class ve{constructor(e,i,r){this.destination=e,this.time=i,this.config=r}next(e){this.lastValue=e,I(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(i){if(this.destination.error)this.destination.error(i);else throw i}this.timeout=void 0},this.time)}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}}const we={leading:!0,trailing:!1};function ge(t,e=we){return i=>new u(r=>i.subscribe(new me(r,t,e)))}class me{constructor(e,i,r){this.destination=e,this.time=i,this.config=r}next(e){this.lastValue=e,A(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}}function Ee(t){return e=>new u(i=>e.subscribe(new pe(i,t)))}class pe{constructor(e,i){this.destination=e,this.predicate=i}next(e){let i;try{i=this.predicate(e)}catch(r){throw this.error(r),r}i&&this.destination.next(e)}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}}function _e(t=(e,i)=>e===i){return e=>new u(i=>e.subscribe(new Se(i,t)))}const O={};class Se{constructor(e,i){this.destination=e,this.predicate=i,this.lastValue=O}next(e){let i;try{i=this.lastValue===O||!this.predicate(this.lastValue,e),this.lastValue=e}catch(r){throw this.error(r),r}i&&this.destination.next(e)}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}}function L(t){return e=>new u(i=>e.subscribe(new xe(i,t)))}let xe=class{constructor(e,i){this.destination=e,this.mapper=i}next(e){let i;try{i=this.mapper(e)}catch(r){throw this.error(r),r}this.destination.next(i)}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}};function Oe(t){return L(()=>t)}function Ie(){return t=>new u(e=>{let i=!1,r=!1;const o=t.subscribe(s=>{i||(i=!0,e.next(s)),r&&o.unsubscribe()},s=>{var n;i=!0,(n=e.error)===null||n===void 0||n.call(e,s),r&&o.unsubscribe()});return r=!0,i&&o.unsubscribe(),o})}function Ae(){return t=>new u(e=>t.subscribe(new Te(e)))}class Te{constructor(e){this.destination=e,this.hasLast=!1}next(e){const i=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([i,e])}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}}function Le(t){return e=>new u(i=>e.subscribe(new ye(i,t)))}class ye{constructor(e,i){this.destination=e,this.effect=i}next(e){try{this.effect(e)}catch(i){throw this.error(i),i}this.destination.next(e)}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}}exports.ErrorCategory=void 0;(function(t){t.NETWORK="network",t.VIDEO_PIPELINE="video_pipeline",t.EXTERNAL_API="external_api",t.PARSER="parser",t.DOM="dom",t.WTF="wtf"})(exports.ErrorCategory||(exports.ErrorCategory={}));const Ne=5;exports.ACTIVE_LIVE_VALID_DELAY=Ne;exports.Logger=P;exports.Observable=u;exports.Subject=_;exports.Subscription=m;exports.VERSION=R;exports.ValueSubject=ne;exports.abortable=k;exports.addScript=D;exports.areQualitiesExact=ie;exports.assertNever=v;exports.assertNonNullable=V;exports.assertNullable=M;exports.assertQualityIsExact=re;exports.buffer=de;exports.checkNever=Q;exports.combine=se;exports.debounce=be;exports.filter=Ee;exports.filterChanged=_e;exports.fromEvent=le;exports.getCurrentBrowser=U;exports.getExponentialDelay=F;exports.getHighestQuality=J;exports.interval=ce;exports.isHigher=K;exports.isHigherOrEqual=W;exports.isInvariantQuality=x;exports.isLower=S;exports.isLowerOrEqual=X;exports.isNonNullable=I;exports.isNullable=A;exports.map=L;exports.mapTo=Oe;exports.merge=oe;exports.noop=w;exports.now=G;exports.observableFrom=ue;exports.once=Ie;exports.pairwise=Ae;exports.safeStorage=$;exports.tap=Le;exports.throttle=ge;exports.timeout=ae;exports.videoHeightToQuality=Z;exports.videoQualityToHeight=te;exports.videoSizeToQuality=ee;
package/es2018.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.25
3
- * Mon, 03 Jul 2023 15:51:34 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-25/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.26
3
+ * Mon, 10 Jul 2023 13:37:00 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-26/doc/
5
5
  */
6
- const J="1.0.25";class E{constructor(){this.subscriptions=[]}unsubscribe(){const e=this.subscriptions;this.subscriptions=[],e.forEach(i=>typeof i=="function"?i():i.unsubscribe())}add(e){return this.subscriptions.push(e),this}}const g=t=>{throw new Error(`${t} is value of unexpected type`)},Z=t=>{},p=()=>{};class u{constructor(e){e&&(this._subscribe=e)}subscribe(e,i){var n;let o;i?typeof i=="function"?o={next:i,error:p}:o={next:a=>i.next(a),error:a=>{var f;return(f=i.error)===null||f===void 0?void 0:f.call(i,a)}}:o={next:p,error:p};const r=typeof e=="function"?{next:a=>{try{e(a)}catch(f){o.next(f)}},error:a=>o.next(a)}:{next:a=>e.next(a),error:a=>e.error?e.error(a):o.next(a)};let s;try{s=this._subscribe(r)}catch(a){(n=r.error)===null||n===void 0||n.call(r,a)}return new E().add(()=>{switch(r.next=p,r.error=p,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return g(s)}})}pipe(...e){return e.reduce((i,n)=>n(i),this)}_subscribe(e){}}class A extends u{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(e){this.subscribers.forEach(i=>i.next(e))}error(e){this.subscribers.forEach(i=>{var n;return(n=i.error)===null||n===void 0?void 0:n.call(i,e)})}_subscribe(e){const i=this.keyCounter++;return this.subscribers.set(i,e),new E().add(()=>this.subscribers.delete(i))}}class B{constructor(){this.log$=new A,this.logs=[],this.log=e=>{const i={...e,timestamp:Date.now()};this.logs.push(i),this.log$.next(i)},this.getAllLogs=()=>this.logs}createCustomLog(e){return(...i)=>{let n;try{n=e(...i)}catch(o){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(i=>({component:e,...i}))}}function ee(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function te(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function M(t){return typeof t!="undefined"&&t!==null}function y(t){return t==null}const ie=(t,e,i)=>new Promise((n,o)=>{e.addEventListener("abort",()=>{a(),w.remove()});const r=()=>{a(),o()},s=()=>{a(),n()},a=()=>{f&&clearTimeout(f),w.removeEventListener("load",s),w.removeEventListener("error",r)};let f;i&&(f=window.setTimeout(r,i));const w=document.createElement("script");w.addEventListener("load",s),w.addEventListener("error",r),w.src=t,document.head.appendChild(w)});var _;const ne=typeof((_=window.performance)===null||_===void 0?void 0:_.now)=="function"?()=>window.performance.now():()=>Date.now(),se=(t,e)=>async(...i)=>{var n;const o=e(...i);let r=t.aborted,s;for(;!r&&!t.aborted;){const a=await o.next(s);r=(n=a.done)!==null&&n!==void 0?n:!1,s=a.value}return s};var b;(function(t){t.Unknown="Unknown",t.Yandex="Yandex",t.Chrome="Chrome",t.Chromium="Chromium",t.Firefox="Firefox",t.Safari="Safari",t.Opera="Opera",t.Edge="Edge",t.Rest="Rest"})(b||(b={}));var m;(function(t){t.Unknown="Unknown",t.Android="Android",t.iPhone="iPhone",t.iPad="iPad",t.iPod="iPod",t.RestMobile="RestMobile",t.Desktop="Desktop"})(m||(m={}));const re=()=>{const{userAgent:t}=window.navigator,e=/yabrowser/i.test(t)?b.Yandex:void 0,i=/chrome|crios/i.test(t)?b.Chrome:void 0,n=/chromium/i.test(t)?b.Chromium:void 0,o=/firefox|fxios/i.test(t)?b.Firefox:void 0,r=/webkit|safari|khtml/i.test(t)?b.Safari:void 0,s=/opr\//i.test(t)?b.Opera:void 0,a=/edg/i.test(t)?b.Edge:void 0,f=/android/i.test(t)?m.Android:void 0,w=/iphone/i.test(t)?m.iPhone:void 0,R=/ipad/i.test(t)?m.iPad:void 0,N=/ipod/i.test(t)?m.iPod:void 0,P=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?m.RestMobile:void 0;return{browser:e||o||s||a||i||n||r||b.Rest,device:f||w||R||N||P||m.Desktop}},oe=(t,{start:e=0,factor:i=2,max:n=1/0,min:o=e,random:r=0}={})=>{let s=e;return s*=i**t,s*=1+(Math.random()*r*2-r),s=Math.round(s),s=Math.min(s,n),s=Math.max(s,o),s};var c;(function(t){t[t.LOCAL_STORAGE=0]="LOCAL_STORAGE",t[t.SESSION_STORAGE=1]="SESSION_STORAGE",t[t.RUNTIME=2]="RUNTIME"})(c||(c={}));const v=new Map;let h=c.RUNTIME;const x=`vk-videoplayer-dummy-key-${Math.random()}`,Q=()=>{try{localStorage.setItem(x,"test"),localStorage.removeItem(x),h=c.LOCAL_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(x),h=c.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)h=c.RUNTIME;else throw e}else throw t}};Q();const V=t=>{var e,i;switch(h){case c.LOCAL_STORAGE:return(e=localStorage.getItem(t))!==null&&e!==void 0?e:void 0;case c.SESSION_STORAGE:return(i=sessionStorage.getItem(t))!==null&&i!==void 0?i:void 0;case c.RUNTIME:return v.get(t);default:g(h)}},G=(t,e)=>{switch(h){case c.LOCAL_STORAGE:try{localStorage.setItem(t,e)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case c.SESSION_STORAGE:try{sessionStorage.setItem(t,e)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case c.RUNTIME:return void v.set(t,e);default:g(h)}},U=t=>{switch(h){case c.LOCAL_STORAGE:return t in localStorage;case c.SESSION_STORAGE:return t in sessionStorage;case c.RUNTIME:return v.has(t);default:return g(h),!1}},k=t=>{switch(h){case c.LOCAL_STORAGE:return localStorage.removeItem(t);case c.SESSION_STORAGE:return sessionStorage.removeItem(t);case c.RUNTIME:return void v.delete(t);default:g(h)}},D=()=>{switch(h){case c.LOCAL_STORAGE:return localStorage.clear();case c.SESSION_STORAGE:return sessionStorage.clear();case c.RUNTIME:return v.clear();default:g(h)}};var ae=Object.freeze({__proto__:null,clear:D,get:V,has:U,remove:k,set:G}),l;(function(t){t.INVARIANT="Invariant quality",t.Q_144P="144p",t.Q_240P="240p",t.Q_360P="360p",t.Q_480P="480p",t.Q_720P="720p",t.Q_1080P="1080p",t.Q_1440P="1440p",t.Q_2160P="2160p",t.Q_4320P="4320p"})(l||(l={}));const d={[l.Q_144P]:{width:256,height:144},[l.Q_240P]:{width:428,height:240},[l.Q_360P]:{width:640,height:360},[l.Q_480P]:{width:856,height:480},[l.Q_720P]:{width:1280,height:720},[l.Q_1080P]:{width:1920,height:1080},[l.Q_1440P]:{width:2560,height:1440},[l.Q_2160P]:{width:3840,height:2160},[l.Q_4320P]:{width:7680,height:4320}},ce=(t,e)=>d[t].height>d[e].height,ue=(t,e)=>d[t].height>=d[e].height,I=(t,e)=>d[t].height<d[e].height,le=(t,e)=>d[t].height<=d[e].height,he=t=>t.sort((e,i)=>e===i?0:e===l.INVARIANT?1:i===l.INVARIANT?-1:I(e,i)?1:-1)[0],T=Object.keys(d).sort((t,e)=>I(t,e)?-1:1),de=(t,e=.02)=>[...T].find(n=>d[n].height*(1+e)>=t),fe=({width:t,height:e})=>{const i=Math.min(t,e),n=Math.max(t,e);return T.find(o=>{const r=d[o];return r.width>=n&&r.height>=i})},be=t=>d[t].height,L=t=>t===l.INVARIANT,we=t=>t.every(e=>!L(e));function me(t){if(L(t))throw new Error("Expected exact quality")}class ge extends A{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){const i=super._subscribe(e);return e.next(this.value),i}}function pe(t){return new u(e=>{const i={};let n=Object.keys(t).length;const o=r=>s=>{r in i||n--,i[r]=s,n===0&&e.next(i)};return Object.entries(t).reduce((r,[s,a])=>r.add(a.subscribe(o(s))),new E)})}function ve(...t){return new u(e=>t.reduce((i,n)=>i.add(n.subscribe(e)),new E))}var Ee=t=>new u(e=>{const i=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},t);return()=>window.clearTimeout(i)}),_e=t=>new u(e=>{const i=window.setInterval(()=>e.next(),t);return()=>window.clearInterval(i)}),xe=t=>new u(e=>{t.forEach(i=>e.next(i))}),Se=(t,e)=>new u(i=>{const n=o=>i.next(o);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});function Oe(t){return e=>new u(i=>e.subscribe(new F(i,t)))}class F{constructor(e,i){this.destination=e,this.size=i,this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}const j={leading:!1,trailing:!0};function Ae(t,e=j){return i=>new u(n=>i.subscribe(new q(n,t,e)))}class q{constructor(e,i,n){this.destination=e,this.time=i,this.config=n}next(e){this.lastValue=e,M(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(i){if(this.destination.error)this.destination.error(i);else throw i}this.timeout=void 0},this.time)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}const z={leading:!0,trailing:!1};function Ie(t,e=z){return i=>new u(n=>i.subscribe(new $(n,t,e)))}class ${constructor(e,i,n){this.destination=e,this.time=i,this.config=n}next(e){this.lastValue=e,y(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}function Te(t){return e=>new u(i=>e.subscribe(new H(i,t)))}class H{constructor(e,i){this.destination=e,this.predicate=i}next(e){let i;try{i=this.predicate(e)}catch(n){throw this.error(n),n}i&&this.destination.next(e)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}function Le(t=(e,i)=>e===i){return e=>new u(i=>e.subscribe(new Y(i,t)))}const S={};class Y{constructor(e,i){this.destination=e,this.predicate=i,this.lastValue=S}next(e){let i;try{i=this.lastValue===S||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}i&&this.destination.next(e)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}function C(t){return e=>new u(i=>e.subscribe(new K(i,t)))}let K=class{constructor(e,i){this.destination=e,this.mapper=i}next(e){let i;try{i=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(i)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}};function Ne(t){return C(()=>t)}function Pe(){return t=>new u(e=>{let i=!1,n=!1;const o=t.subscribe(r=>{i||(i=!0,e.next(r)),n&&o.unsubscribe()},r=>{var s;i=!0,(s=e.error)===null||s===void 0||s.call(e,r),n&&o.unsubscribe()});return n=!0,i&&o.unsubscribe(),o})}function Me(){return t=>new u(e=>t.subscribe(new W(e)))}class W{constructor(e){this.destination=e,this.hasLast=!1}next(e){const i=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([i,e])}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}function ye(t){return e=>new u(i=>e.subscribe(new X(i,t)))}class X{constructor(e,i){this.destination=e,this.effect=i}next(e){try{this.effect(e)}catch(i){throw this.error(i),i}this.destination.next(e)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}var O;(function(t){t.NETWORK="network",t.VIDEO_PIPELINE="video_pipeline",t.EXTERNAL_API="external_api",t.PARSER="parser",t.DOM="dom",t.WTF="wtf"})(O||(O={}));const Qe=5;export{Qe as ACTIVE_LIVE_VALID_DELAY,b as CurrentClientBrowser,m as CurrentClientDevice,O as ErrorCategory,B as Logger,u as Observable,A as Subject,E as Subscription,J as VERSION,ge as ValueSubject,l as VideoQuality,se as abortable,ie as addScript,we as areQualitiesExact,g as assertNever,ee as assertNonNullable,te as assertNullable,me as assertQualityIsExact,Oe as buffer,Z as checkNever,pe as combine,Ae as debounce,Te as filter,Le as filterChanged,Se as fromEvent,re as getCurrentBrowser,oe as getExponentialDelay,he as getHighestQuality,_e as interval,ce as isHigher,ue as isHigherOrEqual,L as isInvariantQuality,I as isLower,le as isLowerOrEqual,M as isNonNullable,y as isNullable,C as map,Ne as mapTo,ve as merge,p as noop,ne as now,xe as observableFrom,Pe as once,Me as pairwise,ae as safeStorage,ye as tap,Ie as throttle,Ee as timeout,de as videoHeightToQuality,be as videoQualityToHeight,fe as videoSizeToQuality};
6
+ const Z="1.0.26";class _{constructor(){this.subscriptions=[]}unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach(i=>typeof i=="function"?i():i.unsubscribe())}add(t){return this.subscriptions.push(t),this}}const m=e=>{throw new Error(`${e} is value of unexpected type`)},B=e=>{},E=()=>{};class l{constructor(t){t&&(this._subscribe=t)}subscribe(t,i){var n;let o;i?typeof i=="function"?o={next:i,error:E}:o={next:a=>i.next(a),error:a=>{var f;return(f=i.error)===null||f===void 0?void 0:f.call(i,a)}}:o={next:E,error:E};const r=typeof t=="function"?{next:a=>{try{t(a)}catch(f){o.next(f)}},error:a=>o.next(a)}:{next:a=>t.next(a),error:a=>t.error?t.error(a):o.next(a)};let s;try{s=this._subscribe(r)}catch(a){(n=r.error)===null||n===void 0||n.call(r,a)}return new _().add(()=>{switch(r.next=E,r.error=E,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return m(s)}})}pipe(...t){return t.reduce((i,n)=>n(i),this)}_subscribe(t){}}class I extends l{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(t){this.subscribers.forEach(i=>i.next(t))}error(t){this.subscribers.forEach(i=>{var n;return(n=i.error)===null||n===void 0?void 0:n.call(i,t)})}_subscribe(t){const i=this.keyCounter++;return this.subscribers.set(i,t),new _().add(()=>this.subscribers.delete(i))}}class tt{constructor(){this.log$=new I,this.logs=[],this.log=t=>{const i={...t,timestamp:Date.now()};this.logs.push(i),this.log$.next(i)},this.getAllLogs=()=>this.logs}createCustomLog(t){return(...i)=>{let n;try{n=t(...i)}catch(o){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(t){return this.createCustomLog(i=>({component:t,...i}))}}function et(e,t='Assertion "value is not nullable" failed'){if(e==null)throw new Error(t)}function it(e,t='Assertion "value is nullable" failed'){if(e!=null)throw new Error(t)}function y(e){return typeof e!="undefined"&&e!==null}function Q(e){return e==null}const nt=(e,t,i)=>new Promise((n,o)=>{t.addEventListener("abort",()=>{a(),w.remove()});const r=()=>{a(),o()},s=()=>{a(),n()},a=()=>{f&&clearTimeout(f),w.removeEventListener("load",s),w.removeEventListener("error",r)};let f;i&&(f=window.setTimeout(r,i));const w=document.createElement("script");w.addEventListener("load",s),w.addEventListener("error",r),w.src=e,document.head.appendChild(w)});var x;const st=typeof((x=window.performance)===null||x===void 0?void 0:x.now)=="function"?()=>window.performance.now():()=>Date.now(),rt=(e,t)=>async(...i)=>{var n;const o=t(...i);let r=e.aborted,s;for(;!r&&!e.aborted;){const a=await o.next(s);r=(n=a.done)!==null&&n!==void 0?n:!1,s=a.value}return s};var b;(function(e){e.Unknown="Unknown",e.Yandex="Yandex",e.Chrome="Chrome",e.Chromium="Chromium",e.Firefox="Firefox",e.Safari="Safari",e.Opera="Opera",e.Edge="Edge",e.Rest="Rest"})(b||(b={}));var v;(function(e){e.Unknown="Unknown",e.Android="Android",e.iPhone="iPhone",e.iPad="iPad",e.iPod="iPod",e.RestMobile="RestMobile",e.Desktop="Desktop"})(v||(v={}));const ot=()=>{const{userAgent:e}=window.navigator,t=/yabrowser/i.test(e)?b.Yandex:void 0,i=/chrome|crios/i.test(e)?b.Chrome:void 0,n=/chromium/i.test(e)?b.Chromium:void 0,o=/firefox|fxios/i.test(e)?b.Firefox:void 0,r=/webkit|safari|khtml/i.test(e)?b.Safari:void 0,s=/opr\//i.test(e)?b.Opera:void 0,a=/edg/i.test(e)?b.Edge:void 0,f=/android/i.test(e)?v.Android:void 0,w=/iphone/i.test(e)?v.iPhone:void 0,P=/ipad/i.test(e)?v.iPad:void 0,N=/ipod/i.test(e)?v.iPod:void 0,M=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?v.RestMobile:void 0;return{browser:t||o||s||a||i||n||r||b.Rest,device:f||w||P||N||M||v.Desktop}},at=(e,{start:t=0,factor:i=2,max:n=1/0,min:o=t,random:r=0}={})=>{let s=t;return s*=i**e,s*=1+(Math.random()*r*2-r),s=Math.round(s),s=Math.min(s,n),s=Math.max(s,o),s};var c;(function(e){e[e.LOCAL_STORAGE=0]="LOCAL_STORAGE",e[e.SESSION_STORAGE=1]="SESSION_STORAGE",e[e.RUNTIME=2]="RUNTIME"})(c||(c={}));let u,g;const S=`vk-videoplayer-dummy-key-${Math.random()}`,p=()=>{if(g!==void 0)return g;try{localStorage.setItem(S,"test"),localStorage.removeItem(S),g=c.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(S),g=c.SESSION_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)g=c.RUNTIME;else throw t}else throw e}return g===c.RUNTIME&&(u=new Map),g},V=()=>p()===c.LOCAL_STORAGE,G=e=>{var t,i;const n=p();switch(n){case c.LOCAL_STORAGE:return(t=localStorage.getItem(e))!==null&&t!==void 0?t:void 0;case c.SESSION_STORAGE:return(i=sessionStorage.getItem(e))!==null&&i!==void 0?i:void 0;case c.RUNTIME:return u==null?void 0:u.get(e);default:m(n)}},U=(e,t)=>{const i=p();switch(i){case c.LOCAL_STORAGE:try{localStorage.setItem(e,t)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case c.SESSION_STORAGE:try{sessionStorage.setItem(e,t)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case c.RUNTIME:return void(u==null?void 0:u.set(e,t));default:m(i)}},k=e=>{var t;const i=p();switch(i){case c.LOCAL_STORAGE:return e in localStorage;case c.SESSION_STORAGE:return e in sessionStorage;case c.RUNTIME:return(t=u==null?void 0:u.has(e))!==null&&t!==void 0?t:!1;default:return m(i),!1}},D=e=>{const t=p();switch(t){case c.LOCAL_STORAGE:return localStorage.removeItem(e);case c.SESSION_STORAGE:return sessionStorage.removeItem(e);case c.RUNTIME:return void(u==null?void 0:u.delete(e));default:m(t)}},F=()=>{const e=p();switch(e){case c.LOCAL_STORAGE:return localStorage.clear();case c.SESSION_STORAGE:return sessionStorage.clear();case c.RUNTIME:return u==null?void 0:u.clear();default:m(e)}};var ct=Object.freeze({__proto__:null,clear:F,get:G,has:k,isPersistent:V,remove:D,set:U}),d;(function(e){e.INVARIANT="Invariant quality",e.Q_144P="144p",e.Q_240P="240p",e.Q_360P="360p",e.Q_480P="480p",e.Q_720P="720p",e.Q_1080P="1080p",e.Q_1440P="1440p",e.Q_2160P="2160p",e.Q_4320P="4320p"})(d||(d={}));const h={[d.Q_144P]:{width:256,height:144},[d.Q_240P]:{width:428,height:240},[d.Q_360P]:{width:640,height:360},[d.Q_480P]:{width:856,height:480},[d.Q_720P]:{width:1280,height:720},[d.Q_1080P]:{width:1920,height:1080},[d.Q_1440P]:{width:2560,height:1440},[d.Q_2160P]:{width:3840,height:2160},[d.Q_4320P]:{width:7680,height:4320}},ut=(e,t)=>h[e].height>h[t].height,lt=(e,t)=>h[e].height>=h[t].height,T=(e,t)=>h[e].height<h[t].height,dt=(e,t)=>h[e].height<=h[t].height,ht=e=>e.sort((t,i)=>t===i?0:t===d.INVARIANT?1:i===d.INVARIANT?-1:T(t,i)?1:-1)[0],L=Object.keys(h).sort((e,t)=>T(e,t)?-1:1),ft=(e,t=.02)=>[...L].find(n=>h[n].height*(1+t)>=e),bt=({width:e,height:t})=>{const i=Math.min(e,t),n=Math.max(e,t);return L.find(o=>{const r=h[o];return r.width>=n&&r.height>=i})},wt=e=>h[e].height,R=e=>e===d.INVARIANT,vt=e=>e.every(t=>!R(t));function gt(e){if(R(e))throw new Error("Expected exact quality")}class mt extends I{constructor(t){super(),this.value=t}next(t){super.next(this.value=t)}error(t){super.error(this.value=t)}getValue(){return this.value}_subscribe(t){const i=super._subscribe(t);return t.next(this.value),i}}function pt(e){return new l(t=>{const i={};let n=Object.keys(e).length;const o=r=>s=>{r in i||n--,i[r]=s,n===0&&t.next(i)};return Object.entries(e).reduce((r,[s,a])=>r.add(a.subscribe(o(s))),new _)})}function Et(...e){return new l(t=>e.reduce((i,n)=>i.add(n.subscribe(t)),new _))}var _t=e=>new l(t=>{const i=window.setTimeout(()=>{try{t.next()}catch(n){if(t.error)t.error(n);else throw n}},e);return()=>window.clearTimeout(i)}),xt=e=>new l(t=>{const i=window.setInterval(()=>t.next(),e);return()=>window.clearInterval(i)}),St=e=>new l(t=>{e.forEach(i=>t.next(i))}),Ot=(e,t)=>new l(i=>{const n=o=>i.next(o);return e.addEventListener(t,n),()=>e.removeEventListener(t,n)});function At(e){return t=>new l(i=>t.subscribe(new j(i,e)))}class j{constructor(t,i){this.destination=t,this.size=i,this.lastValues=[]}next(t){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(t),this.destination.next(this.lastValues)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}const q={leading:!1,trailing:!0};function It(e,t=q){return i=>new l(n=>i.subscribe(new z(n,e,t)))}class z{constructor(t,i,n){this.destination=t,this.time=i,this.config=n}next(t){this.lastValue=t,y(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(i){if(this.destination.error)this.destination.error(i);else throw i}this.timeout=void 0},this.time)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}const $={leading:!0,trailing:!1};function Tt(e,t=$){return i=>new l(n=>i.subscribe(new H(n,e,t)))}class H{constructor(t,i,n){this.destination=t,this.time=i,this.config=n}next(t){this.lastValue=t,Q(this.timeout)&&(this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}function Lt(e){return t=>new l(i=>t.subscribe(new Y(i,e)))}class Y{constructor(t,i){this.destination=t,this.predicate=i}next(t){let i;try{i=this.predicate(t)}catch(n){throw this.error(n),n}i&&this.destination.next(t)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}function Rt(e=(t,i)=>t===i){return t=>new l(i=>t.subscribe(new C(i,e)))}const O={};class C{constructor(t,i){this.destination=t,this.predicate=i,this.lastValue=O}next(t){let i;try{i=this.lastValue===O||!this.predicate(this.lastValue,t),this.lastValue=t}catch(n){throw this.error(n),n}i&&this.destination.next(t)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}function K(e){return t=>new l(i=>t.subscribe(new W(i,e)))}let W=class{constructor(t,i){this.destination=t,this.mapper=i}next(t){let i;try{i=this.mapper(t)}catch(n){throw this.error(n),n}this.destination.next(i)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}};function Nt(e){return K(()=>e)}function Mt(){return e=>new l(t=>{let i=!1,n=!1;const o=e.subscribe(r=>{i||(i=!0,t.next(r)),n&&o.unsubscribe()},r=>{var s;i=!0,(s=t.error)===null||s===void 0||s.call(t,r),n&&o.unsubscribe()});return n=!0,i&&o.unsubscribe(),o})}function yt(){return e=>new l(t=>e.subscribe(new X(t)))}class X{constructor(t){this.destination=t,this.hasLast=!1}next(t){const i=this.last;if(this.last=t,!this.hasLast){this.hasLast=!0;return}this.destination.next([i,t])}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}function Qt(e){return t=>new l(i=>t.subscribe(new J(i,e)))}class J{constructor(t,i){this.destination=t,this.effect=i}next(t){try{this.effect(t)}catch(i){throw this.error(i),i}this.destination.next(t)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}var A;(function(e){e.NETWORK="network",e.VIDEO_PIPELINE="video_pipeline",e.EXTERNAL_API="external_api",e.PARSER="parser",e.DOM="dom",e.WTF="wtf"})(A||(A={}));const Vt=5;export{Vt as ACTIVE_LIVE_VALID_DELAY,b as CurrentClientBrowser,v as CurrentClientDevice,A as ErrorCategory,tt as Logger,l as Observable,I as Subject,_ as Subscription,Z as VERSION,mt as ValueSubject,d as VideoQuality,rt as abortable,nt as addScript,vt as areQualitiesExact,m as assertNever,et as assertNonNullable,it as assertNullable,gt as assertQualityIsExact,At as buffer,B as checkNever,pt as combine,It as debounce,Lt as filter,Rt as filterChanged,Ot as fromEvent,ot as getCurrentBrowser,at as getExponentialDelay,ht as getHighestQuality,xt as interval,ut as isHigher,lt as isHigherOrEqual,R as isInvariantQuality,T as isLower,dt as isLowerOrEqual,y as isNonNullable,Q as isNullable,K as map,Nt as mapTo,Et as merge,E as noop,st as now,St as observableFrom,Mt as once,yt as pairwise,ct as safeStorage,Qt as tap,Tt as throttle,_t as timeout,ft as videoHeightToQuality,wt as videoQualityToHeight,bt as videoSizeToQuality};
package/esnext.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.25
3
- * Mon, 03 Jul 2023 15:51:34 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-25/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.26
3
+ * Mon, 10 Jul 2023 13:37:00 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-26/doc/
5
5
  */
6
- "use strict";const N="1.0.25";class m{subscriptions=[];unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach(i=>typeof i=="function"?i():i.unsubscribe())}add(t){return this.subscriptions.push(t),this}}const f=e=>{throw new Error(`${e} is value of unexpected type`)},C=e=>{},b=()=>{};class c{constructor(t){t&&(this._subscribe=t)}subscribe(t,i){let r;i?typeof i=="function"?r={next:i,error:b}:r={next:n=>i.next(n),error:n=>i.error?.(n)}:r={next:b,error:b};const o=typeof t=="function"?{next:n=>{try{t(n)}catch(h){r.next(h)}},error:n=>r.next(n)}:{next:n=>t.next(n),error:n=>t.error?t.error(n):r.next(n)};let s;try{s=this._subscribe(o)}catch(n){o.error?.(n)}return new m().add(()=>{switch(o.next=b,o.error=b,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return f(s)}})}pipe(...t){return t.reduce((i,r)=>r(i),this)}_subscribe(t){}}class E extends c{keyCounter=0;subscribers=new Map;constructor(){super()}next(t){this.subscribers.forEach(i=>i.next(t))}error(t){this.subscribers.forEach(i=>i.error?.(t))}_subscribe(t){const i=this.keyCounter++;return this.subscribers.set(i,t),new m().add(()=>this.subscribers.delete(i))}}class R{log$=new E;logs=[];log=t=>{const i={...t,timestamp:Date.now()};this.logs.push(i),this.log$.next(i)};createCustomLog(t){return(...i)=>{let r;try{r=t(...i)}catch{r={message:"error in `createCustomLog`",component:"Logger"}}this.log(r)}}createComponentLog(t){return this.createCustomLog(i=>({component:t,...i}))}getAllLogs=()=>this.logs}function Q(e,t='Assertion "value is not nullable" failed'){if(e==null)throw new Error(t)}function V(e,t='Assertion "value is nullable" failed'){if(e!=null)throw new Error(t)}function O(e){return typeof e<"u"&&e!==null}function _(e){return e==null}const P=(e,t,i)=>new Promise((r,o)=>{t.addEventListener("abort",()=>{h(),d.remove()});const s=()=>{h(),o()},n=()=>{h(),r()},h=()=>{w&&clearTimeout(w),d.removeEventListener("load",n),d.removeEventListener("error",s)};let w;i&&(w=window.setTimeout(s,i));const d=document.createElement("script");d.addEventListener("load",n),d.addEventListener("error",s),d.src=e,document.head.appendChild(d)}),M=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),D=(e,t)=>async(...i)=>{const r=t(...i);let o=e.aborted,s;for(;!o&&!e.aborted;){const n=await r.next(s);o=n.done??!1,s=n.value}return s};exports.CurrentClientBrowser=void 0;(function(e){e.Unknown="Unknown",e.Yandex="Yandex",e.Chrome="Chrome",e.Chromium="Chromium",e.Firefox="Firefox",e.Safari="Safari",e.Opera="Opera",e.Edge="Edge",e.Rest="Rest"})(exports.CurrentClientBrowser||(exports.CurrentClientBrowser={}));exports.CurrentClientDevice=void 0;(function(e){e.Unknown="Unknown",e.Android="Android",e.iPhone="iPhone",e.iPad="iPad",e.iPod="iPod",e.RestMobile="RestMobile",e.Desktop="Desktop"})(exports.CurrentClientDevice||(exports.CurrentClientDevice={}));const G=()=>{const{userAgent:e}=window.navigator,t=/yabrowser/i.test(e)?exports.CurrentClientBrowser.Yandex:void 0,i=/chrome|crios/i.test(e)?exports.CurrentClientBrowser.Chrome:void 0,r=/chromium/i.test(e)?exports.CurrentClientBrowser.Chromium:void 0,o=/firefox|fxios/i.test(e)?exports.CurrentClientBrowser.Firefox:void 0,s=/webkit|safari|khtml/i.test(e)?exports.CurrentClientBrowser.Safari:void 0,n=/opr\//i.test(e)?exports.CurrentClientBrowser.Opera:void 0,h=/edg/i.test(e)?exports.CurrentClientBrowser.Edge:void 0,w=/android/i.test(e)?exports.CurrentClientDevice.Android:void 0,d=/iphone/i.test(e)?exports.CurrentClientDevice.iPhone:void 0,y=/ipad/i.test(e)?exports.CurrentClientDevice.iPad:void 0,A=/ipod/i.test(e)?exports.CurrentClientDevice.iPod:void 0,L=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?exports.CurrentClientDevice.RestMobile:void 0;return{browser:t||o||n||h||i||r||s||exports.CurrentClientBrowser.Rest,device:w||d||y||A||L||exports.CurrentClientDevice.Desktop}},k=(e,{start:t=0,factor:i=2,max:r=1/0,min:o=t,random:s=0}={})=>{let n=t;return n*=i**e,n*=1+(Math.random()*s*2-s),n=Math.round(n),n=Math.min(n,r),n=Math.max(n,o),n};var a;(function(e){e[e.LOCAL_STORAGE=0]="LOCAL_STORAGE",e[e.SESSION_STORAGE=1]="SESSION_STORAGE",e[e.RUNTIME=2]="RUNTIME"})(a||(a={}));const g=new Map;let u=a.RUNTIME;const p=`vk-videoplayer-dummy-key-${Math.random()}`,U=()=>{try{localStorage.setItem(p,"test"),localStorage.removeItem(p),u=a.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(p),u=a.SESSION_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)u=a.RUNTIME;else throw t}else throw e}};U();const F=e=>{switch(u){case a.LOCAL_STORAGE:return localStorage.getItem(e)??void 0;case a.SESSION_STORAGE:return sessionStorage.getItem(e)??void 0;case a.RUNTIME:return g.get(e);default:f(u)}},H=(e,t)=>{switch(u){case a.LOCAL_STORAGE:try{localStorage.setItem(e,t)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case a.SESSION_STORAGE:try{sessionStorage.setItem(e,t)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case a.RUNTIME:return void g.set(e,t);default:f(u)}},j=e=>{switch(u){case a.LOCAL_STORAGE:return e in localStorage;case a.SESSION_STORAGE:return e in sessionStorage;case a.RUNTIME:return g.has(e);default:return f(u),!1}},q=e=>{switch(u){case a.LOCAL_STORAGE:return localStorage.removeItem(e);case a.SESSION_STORAGE:return sessionStorage.removeItem(e);case a.RUNTIME:return void g.delete(e);default:f(u)}},z=()=>{switch(u){case a.LOCAL_STORAGE:return localStorage.clear();case a.SESSION_STORAGE:return sessionStorage.clear();case a.RUNTIME:return g.clear();default:f(u)}};var B=Object.freeze({__proto__:null,clear:z,get:F,has:j,remove:q,set:H});exports.VideoQuality=void 0;(function(e){e.INVARIANT="Invariant quality",e.Q_144P="144p",e.Q_240P="240p",e.Q_360P="360p",e.Q_480P="480p",e.Q_720P="720p",e.Q_1080P="1080p",e.Q_1440P="1440p",e.Q_2160P="2160p",e.Q_4320P="4320p"})(exports.VideoQuality||(exports.VideoQuality={}));const l={[exports.VideoQuality.Q_144P]:{width:256,height:144},[exports.VideoQuality.Q_240P]:{width:428,height:240},[exports.VideoQuality.Q_360P]:{width:640,height:360},[exports.VideoQuality.Q_480P]:{width:856,height:480},[exports.VideoQuality.Q_720P]:{width:1280,height:720},[exports.VideoQuality.Q_1080P]:{width:1920,height:1080},[exports.VideoQuality.Q_1440P]:{width:2560,height:1440},[exports.VideoQuality.Q_2160P]:{width:3840,height:2160},[exports.VideoQuality.Q_4320P]:{width:7680,height:4320}},Y=(e,t)=>l[e].height>l[t].height,$=(e,t)=>l[e].height>=l[t].height,S=(e,t)=>l[e].height<l[t].height,K=(e,t)=>l[e].height<=l[t].height,W=e=>e.sort((t,i)=>t===i?0:t===exports.VideoQuality.INVARIANT?1:i===exports.VideoQuality.INVARIANT?-1:S(t,i)?1:-1)[0],I=Object.keys(l).sort((e,t)=>S(e,t)?-1:1),X=(e,t=.02)=>[...I].find(r=>l[r].height*(1+t)>=e),J=({width:e,height:t})=>{const i=Math.min(e,t),r=Math.max(e,t);return I.find(o=>{const s=l[o];return s.width>=r&&s.height>=i})},Z=e=>l[e].height,x=e=>e===exports.VideoQuality.INVARIANT,ee=e=>e.every(t=>!x(t));function te(e){if(x(e))throw new Error("Expected exact quality")}class ie extends E{value;constructor(t){super(),this.value=t}next(t){super.next(this.value=t)}error(t){super.error(this.value=t)}getValue(){return this.value}_subscribe(t){const i=super._subscribe(t);return t.next(this.value),i}}function re(e){return new c(t=>{const i={};let r=Object.keys(e).length;const o=s=>n=>{s in i||r--,i[s]=n,r===0&&t.next(i)};return Object.entries(e).reduce((s,[n,h])=>s.add(h.subscribe(o(n))),new m)})}function ne(...e){return new c(t=>e.reduce((i,r)=>i.add(r.subscribe(t)),new m))}var se=e=>new c(t=>{const i=window.setTimeout(()=>{try{t.next()}catch(r){if(t.error)t.error(r);else throw r}},e);return()=>window.clearTimeout(i)}),oe=e=>new c(t=>{const i=window.setInterval(()=>t.next(),e);return()=>window.clearInterval(i)}),ae=e=>new c(t=>{e.forEach(i=>t.next(i))}),ce=(e,t)=>new c(i=>{const r=o=>i.next(o);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});function ue(e){return t=>new c(i=>t.subscribe(new le(i,e)))}class le{destination;size;lastValues=[];constructor(t,i){this.destination=t,this.size=i}next(t){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(t),this.destination.next(this.lastValues)}error(t){this.destination.error?.(t)}}const he={leading:!1,trailing:!0};function de(e,t=he){return i=>new c(r=>i.subscribe(new fe(r,e,t)))}class fe{destination;time;config;lastValue;timeout;constructor(t,i,r){this.destination=t,this.time=i,this.config=r}next(t){this.lastValue=t,O(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(i){if(this.destination.error)this.destination.error(i);else throw i}this.timeout=void 0},this.time)}error(t){this.destination.error?.(t)}}const be={leading:!0,trailing:!1};function we(e,t=be){return i=>new c(r=>i.subscribe(new me(r,e,t)))}class me{destination;time;config;lastValue;timeout;constructor(t,i,r){this.destination=t,this.time=i,this.config=r}next(t){this.lastValue=t,_(this.timeout)&&(this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(t){this.destination.error?.(t)}}function ge(e){return t=>new c(i=>t.subscribe(new pe(i,e)))}class pe{destination;predicate;constructor(t,i){this.destination=t,this.predicate=i}next(t){let i;try{i=this.predicate(t)}catch(r){throw this.error(r),r}i&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function Ee(e=(t,i)=>t===i){return t=>new c(i=>t.subscribe(new Se(i,e)))}const v={};class Se{destination;predicate;lastValue=v;constructor(t,i){this.destination=t,this.predicate=i}next(t){let i;try{i=this.lastValue===v||!this.predicate(this.lastValue,t),this.lastValue=t}catch(r){throw this.error(r),r}i&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function T(e){return t=>new c(i=>t.subscribe(new xe(i,e)))}let xe=class{destination;mapper;constructor(t,i){this.destination=t,this.mapper=i}next(t){let i;try{i=this.mapper(t)}catch(r){throw this.error(r),r}this.destination.next(i)}error(t){this.destination.error?.(t)}};function ve(e){return T(()=>e)}function Oe(){return e=>new c(t=>{let i=!1,r=!1;const o=e.subscribe(s=>{i||(i=!0,t.next(s)),r&&o.unsubscribe()},s=>{i=!0,t.error?.(s),r&&o.unsubscribe()});return r=!0,i&&o.unsubscribe(),o})}function _e(){return e=>new c(t=>e.subscribe(new Ie(t)))}class Ie{destination;last;hasLast=!1;constructor(t){this.destination=t}next(t){const i=this.last;if(this.last=t,!this.hasLast){this.hasLast=!0;return}this.destination.next([i,t])}error(t){this.destination.error?.(t)}}function Te(e){return t=>new c(i=>t.subscribe(new ye(i,e)))}class ye{destination;effect;constructor(t,i){this.destination=t,this.effect=i}next(t){try{this.effect(t)}catch(i){throw this.error(i),i}this.destination.next(t)}error(t){this.destination.error?.(t)}}exports.ErrorCategory=void 0;(function(e){e.NETWORK="network",e.VIDEO_PIPELINE="video_pipeline",e.EXTERNAL_API="external_api",e.PARSER="parser",e.DOM="dom",e.WTF="wtf"})(exports.ErrorCategory||(exports.ErrorCategory={}));const Ae=5;exports.ACTIVE_LIVE_VALID_DELAY=Ae;exports.Logger=R;exports.Observable=c;exports.Subject=E;exports.Subscription=m;exports.VERSION=N;exports.ValueSubject=ie;exports.abortable=D;exports.addScript=P;exports.areQualitiesExact=ee;exports.assertNever=f;exports.assertNonNullable=Q;exports.assertNullable=V;exports.assertQualityIsExact=te;exports.buffer=ue;exports.checkNever=C;exports.combine=re;exports.debounce=de;exports.filter=ge;exports.filterChanged=Ee;exports.fromEvent=ce;exports.getCurrentBrowser=G;exports.getExponentialDelay=k;exports.getHighestQuality=W;exports.interval=oe;exports.isHigher=Y;exports.isHigherOrEqual=$;exports.isInvariantQuality=x;exports.isLower=S;exports.isLowerOrEqual=K;exports.isNonNullable=O;exports.isNullable=_;exports.map=T;exports.mapTo=ve;exports.merge=ne;exports.noop=b;exports.now=M;exports.observableFrom=ae;exports.once=Oe;exports.pairwise=_e;exports.safeStorage=B;exports.tap=Te;exports.throttle=we;exports.timeout=se;exports.videoHeightToQuality=X;exports.videoQualityToHeight=Z;exports.videoSizeToQuality=J;
6
+ "use strict";const C="1.0.26";class p{subscriptions=[];unsubscribe(){const e=this.subscriptions;this.subscriptions=[],e.forEach(i=>typeof i=="function"?i():i.unsubscribe())}add(e){return this.subscriptions.push(e),this}}const f=t=>{throw new Error(`${t} is value of unexpected type`)},R=t=>{},b=()=>{};class c{constructor(e){e&&(this._subscribe=e)}subscribe(e,i){let r;i?typeof i=="function"?r={next:i,error:b}:r={next:n=>i.next(n),error:n=>i.error?.(n)}:r={next:b,error:b};const o=typeof e=="function"?{next:n=>{try{e(n)}catch(l){r.next(l)}},error:n=>r.next(n)}:{next:n=>e.next(n),error:n=>e.error?e.error(n):r.next(n)};let s;try{s=this._subscribe(o)}catch(n){o.error?.(n)}return new p().add(()=>{switch(o.next=b,o.error=b,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return f(s)}})}pipe(...e){return e.reduce((i,r)=>r(i),this)}_subscribe(e){}}class S extends c{keyCounter=0;subscribers=new Map;constructor(){super()}next(e){this.subscribers.forEach(i=>i.next(e))}error(e){this.subscribers.forEach(i=>i.error?.(e))}_subscribe(e){const i=this.keyCounter++;return this.subscribers.set(i,e),new p().add(()=>this.subscribers.delete(i))}}class Q{log$=new S;logs=[];log=e=>{const i={...e,timestamp:Date.now()};this.logs.push(i),this.log$.next(i)};createCustomLog(e){return(...i)=>{let r;try{r=e(...i)}catch{r={message:"error in `createCustomLog`",component:"Logger"}}this.log(r)}}createComponentLog(e){return this.createCustomLog(i=>({component:e,...i}))}getAllLogs=()=>this.logs}function V(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function P(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function _(t){return typeof t<"u"&&t!==null}function I(t){return t==null}const M=(t,e,i)=>new Promise((r,o)=>{e.addEventListener("abort",()=>{l(),h.remove()});const s=()=>{l(),o()},n=()=>{l(),r()},l=()=>{m&&clearTimeout(m),h.removeEventListener("load",n),h.removeEventListener("error",s)};let m;i&&(m=window.setTimeout(s,i));const h=document.createElement("script");h.addEventListener("load",n),h.addEventListener("error",s),h.src=t,document.head.appendChild(h)}),D=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),G=(t,e)=>async(...i)=>{const r=e(...i);let o=t.aborted,s;for(;!o&&!t.aborted;){const n=await r.next(s);o=n.done??!1,s=n.value}return s};exports.CurrentClientBrowser=void 0;(function(t){t.Unknown="Unknown",t.Yandex="Yandex",t.Chrome="Chrome",t.Chromium="Chromium",t.Firefox="Firefox",t.Safari="Safari",t.Opera="Opera",t.Edge="Edge",t.Rest="Rest"})(exports.CurrentClientBrowser||(exports.CurrentClientBrowser={}));exports.CurrentClientDevice=void 0;(function(t){t.Unknown="Unknown",t.Android="Android",t.iPhone="iPhone",t.iPad="iPad",t.iPod="iPod",t.RestMobile="RestMobile",t.Desktop="Desktop"})(exports.CurrentClientDevice||(exports.CurrentClientDevice={}));const k=()=>{const{userAgent:t}=window.navigator,e=/yabrowser/i.test(t)?exports.CurrentClientBrowser.Yandex:void 0,i=/chrome|crios/i.test(t)?exports.CurrentClientBrowser.Chrome:void 0,r=/chromium/i.test(t)?exports.CurrentClientBrowser.Chromium:void 0,o=/firefox|fxios/i.test(t)?exports.CurrentClientBrowser.Firefox:void 0,s=/webkit|safari|khtml/i.test(t)?exports.CurrentClientBrowser.Safari:void 0,n=/opr\//i.test(t)?exports.CurrentClientBrowser.Opera:void 0,l=/edg/i.test(t)?exports.CurrentClientBrowser.Edge:void 0,m=/android/i.test(t)?exports.CurrentClientDevice.Android:void 0,h=/iphone/i.test(t)?exports.CurrentClientDevice.iPhone:void 0,L=/ipad/i.test(t)?exports.CurrentClientDevice.iPad:void 0,y=/ipod/i.test(t)?exports.CurrentClientDevice.iPod:void 0,N=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?exports.CurrentClientDevice.RestMobile:void 0;return{browser:e||o||n||l||i||r||s||exports.CurrentClientBrowser.Rest,device:m||h||L||y||N||exports.CurrentClientDevice.Desktop}},U=(t,{start:e=0,factor:i=2,max:r=1/0,min:o=e,random:s=0}={})=>{let n=e;return n*=i**t,n*=1+(Math.random()*s*2-s),n=Math.round(n),n=Math.min(n,r),n=Math.max(n,o),n};var a;(function(t){t[t.LOCAL_STORAGE=0]="LOCAL_STORAGE",t[t.SESSION_STORAGE=1]="SESSION_STORAGE",t[t.RUNTIME=2]="RUNTIME"})(a||(a={}));let w,d;const E=`vk-videoplayer-dummy-key-${Math.random()}`,g=()=>{if(d!==void 0)return d;try{localStorage.setItem(E,"test"),localStorage.removeItem(E),d=a.LOCAL_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(E),d=a.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)d=a.RUNTIME;else throw e}else throw t}return d===a.RUNTIME&&(w=new Map),d},F=()=>g()===a.LOCAL_STORAGE,H=t=>{const e=g();switch(e){case a.LOCAL_STORAGE:return localStorage.getItem(t)??void 0;case a.SESSION_STORAGE:return sessionStorage.getItem(t)??void 0;case a.RUNTIME:return w?.get(t);default:f(e)}},j=(t,e)=>{const i=g();switch(i){case a.LOCAL_STORAGE:try{localStorage.setItem(t,e)}catch(r){if(r instanceof DOMException)console.error(r);else throw r}break;case a.SESSION_STORAGE:try{sessionStorage.setItem(t,e)}catch(r){if(r instanceof DOMException)console.error(r);else throw r}break;case a.RUNTIME:return void w?.set(t,e);default:f(i)}},q=t=>{const e=g();switch(e){case a.LOCAL_STORAGE:return t in localStorage;case a.SESSION_STORAGE:return t in sessionStorage;case a.RUNTIME:return w?.has(t)??!1;default:return f(e),!1}},z=t=>{const e=g();switch(e){case a.LOCAL_STORAGE:return localStorage.removeItem(t);case a.SESSION_STORAGE:return sessionStorage.removeItem(t);case a.RUNTIME:return void w?.delete(t);default:f(e)}},B=()=>{const t=g();switch(t){case a.LOCAL_STORAGE:return localStorage.clear();case a.SESSION_STORAGE:return sessionStorage.clear();case a.RUNTIME:return w?.clear();default:f(t)}};var Y=Object.freeze({__proto__:null,clear:B,get:H,has:q,isPersistent:F,remove:z,set:j});exports.VideoQuality=void 0;(function(t){t.INVARIANT="Invariant quality",t.Q_144P="144p",t.Q_240P="240p",t.Q_360P="360p",t.Q_480P="480p",t.Q_720P="720p",t.Q_1080P="1080p",t.Q_1440P="1440p",t.Q_2160P="2160p",t.Q_4320P="4320p"})(exports.VideoQuality||(exports.VideoQuality={}));const u={[exports.VideoQuality.Q_144P]:{width:256,height:144},[exports.VideoQuality.Q_240P]:{width:428,height:240},[exports.VideoQuality.Q_360P]:{width:640,height:360},[exports.VideoQuality.Q_480P]:{width:856,height:480},[exports.VideoQuality.Q_720P]:{width:1280,height:720},[exports.VideoQuality.Q_1080P]:{width:1920,height:1080},[exports.VideoQuality.Q_1440P]:{width:2560,height:1440},[exports.VideoQuality.Q_2160P]:{width:3840,height:2160},[exports.VideoQuality.Q_4320P]:{width:7680,height:4320}},$=(t,e)=>u[t].height>u[e].height,K=(t,e)=>u[t].height>=u[e].height,x=(t,e)=>u[t].height<u[e].height,W=(t,e)=>u[t].height<=u[e].height,X=t=>t.sort((e,i)=>e===i?0:e===exports.VideoQuality.INVARIANT?1:i===exports.VideoQuality.INVARIANT?-1:x(e,i)?1:-1)[0],A=Object.keys(u).sort((t,e)=>x(t,e)?-1:1),J=(t,e=.02)=>[...A].find(r=>u[r].height*(1+e)>=t),Z=({width:t,height:e})=>{const i=Math.min(t,e),r=Math.max(t,e);return A.find(o=>{const s=u[o];return s.width>=r&&s.height>=i})},ee=t=>u[t].height,v=t=>t===exports.VideoQuality.INVARIANT,te=t=>t.every(e=>!v(e));function ie(t){if(v(t))throw new Error("Expected exact quality")}class re extends S{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){const i=super._subscribe(e);return e.next(this.value),i}}function ne(t){return new c(e=>{const i={};let r=Object.keys(t).length;const o=s=>n=>{s in i||r--,i[s]=n,r===0&&e.next(i)};return Object.entries(t).reduce((s,[n,l])=>s.add(l.subscribe(o(n))),new p)})}function se(...t){return new c(e=>t.reduce((i,r)=>i.add(r.subscribe(e)),new p))}var oe=t=>new c(e=>{const i=window.setTimeout(()=>{try{e.next()}catch(r){if(e.error)e.error(r);else throw r}},t);return()=>window.clearTimeout(i)}),ae=t=>new c(e=>{const i=window.setInterval(()=>e.next(),t);return()=>window.clearInterval(i)}),ce=t=>new c(e=>{t.forEach(i=>e.next(i))}),ue=(t,e)=>new c(i=>{const r=o=>i.next(o);return t.addEventListener(e,r),()=>t.removeEventListener(e,r)});function le(t){return e=>new c(i=>e.subscribe(new he(i,t)))}class he{destination;size;lastValues=[];constructor(e,i){this.destination=e,this.size=i}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)}}const de={leading:!1,trailing:!0};function fe(t,e=de){return i=>new c(r=>i.subscribe(new be(r,t,e)))}class be{destination;time;config;lastValue;timeout;constructor(e,i,r){this.destination=e,this.time=i,this.config=r}next(e){this.lastValue=e,_(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(i){if(this.destination.error)this.destination.error(i);else throw i}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}}const we={leading:!0,trailing:!1};function ge(t,e=we){return i=>new c(r=>i.subscribe(new me(r,t,e)))}class me{destination;time;config;lastValue;timeout;constructor(e,i,r){this.destination=e,this.time=i,this.config=r}next(e){this.lastValue=e,I(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}}function pe(t){return e=>new c(i=>e.subscribe(new Ee(i,t)))}class Ee{destination;predicate;constructor(e,i){this.destination=e,this.predicate=i}next(e){let i;try{i=this.predicate(e)}catch(r){throw this.error(r),r}i&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function Se(t=(e,i)=>e===i){return e=>new c(i=>e.subscribe(new xe(i,t)))}const O={};class xe{destination;predicate;lastValue=O;constructor(e,i){this.destination=e,this.predicate=i}next(e){let i;try{i=this.lastValue===O||!this.predicate(this.lastValue,e),this.lastValue=e}catch(r){throw this.error(r),r}i&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function T(t){return e=>new c(i=>e.subscribe(new ve(i,t)))}let ve=class{destination;mapper;constructor(e,i){this.destination=e,this.mapper=i}next(e){let i;try{i=this.mapper(e)}catch(r){throw this.error(r),r}this.destination.next(i)}error(e){this.destination.error?.(e)}};function Oe(t){return T(()=>t)}function _e(){return t=>new c(e=>{let i=!1,r=!1;const o=t.subscribe(s=>{i||(i=!0,e.next(s)),r&&o.unsubscribe()},s=>{i=!0,e.error?.(s),r&&o.unsubscribe()});return r=!0,i&&o.unsubscribe(),o})}function Ie(){return t=>new c(e=>t.subscribe(new Ae(e)))}class Ae{destination;last;hasLast=!1;constructor(e){this.destination=e}next(e){const i=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([i,e])}error(e){this.destination.error?.(e)}}function Te(t){return e=>new c(i=>e.subscribe(new Le(i,t)))}class Le{destination;effect;constructor(e,i){this.destination=e,this.effect=i}next(e){try{this.effect(e)}catch(i){throw this.error(i),i}this.destination.next(e)}error(e){this.destination.error?.(e)}}exports.ErrorCategory=void 0;(function(t){t.NETWORK="network",t.VIDEO_PIPELINE="video_pipeline",t.EXTERNAL_API="external_api",t.PARSER="parser",t.DOM="dom",t.WTF="wtf"})(exports.ErrorCategory||(exports.ErrorCategory={}));const ye=5;exports.ACTIVE_LIVE_VALID_DELAY=ye;exports.Logger=Q;exports.Observable=c;exports.Subject=S;exports.Subscription=p;exports.VERSION=C;exports.ValueSubject=re;exports.abortable=G;exports.addScript=M;exports.areQualitiesExact=te;exports.assertNever=f;exports.assertNonNullable=V;exports.assertNullable=P;exports.assertQualityIsExact=ie;exports.buffer=le;exports.checkNever=R;exports.combine=ne;exports.debounce=fe;exports.filter=pe;exports.filterChanged=Se;exports.fromEvent=ue;exports.getCurrentBrowser=k;exports.getExponentialDelay=U;exports.getHighestQuality=X;exports.interval=ae;exports.isHigher=$;exports.isHigherOrEqual=K;exports.isInvariantQuality=v;exports.isLower=x;exports.isLowerOrEqual=W;exports.isNonNullable=_;exports.isNullable=I;exports.map=T;exports.mapTo=Oe;exports.merge=se;exports.noop=b;exports.now=D;exports.observableFrom=ce;exports.once=_e;exports.pairwise=Ie;exports.safeStorage=Y;exports.tap=Te;exports.throttle=ge;exports.timeout=oe;exports.videoHeightToQuality=J;exports.videoQualityToHeight=ee;exports.videoSizeToQuality=Z;
package/esnext.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.25
3
- * Mon, 03 Jul 2023 15:51:34 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-25/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.26
3
+ * Mon, 10 Jul 2023 13:37:00 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-26/doc/
5
5
  */
6
- const X="1.0.25";class x{subscriptions=[];unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach(i=>typeof i=="function"?i():i.unsubscribe())}add(t){return this.subscriptions.push(t),this}}const w=e=>{throw new Error(`${e} is value of unexpected type`)},J=e=>{},g=()=>{};class c{constructor(t){t&&(this._subscribe=t)}subscribe(t,i){let n;i?typeof i=="function"?n={next:i,error:g}:n={next:s=>i.next(s),error:s=>i.error?.(s)}:n={next:g,error:g};const o=typeof t=="function"?{next:s=>{try{t(s)}catch(f){n.next(f)}},error:s=>n.next(s)}:{next:s=>t.next(s),error:s=>t.error?t.error(s):n.next(s)};let r;try{r=this._subscribe(o)}catch(s){o.error?.(s)}return new x().add(()=>{switch(o.next=g,o.error=g,typeof r){case"function":r();return;case"object":r.unsubscribe();return;case"undefined":return;default:return w(r)}})}pipe(...t){return t.reduce((i,n)=>n(i),this)}_subscribe(t){}}class A extends c{keyCounter=0;subscribers=new Map;constructor(){super()}next(t){this.subscribers.forEach(i=>i.next(t))}error(t){this.subscribers.forEach(i=>i.error?.(t))}_subscribe(t){const i=this.keyCounter++;return this.subscribers.set(i,t),new x().add(()=>this.subscribers.delete(i))}}class Z{log$=new A;logs=[];log=t=>{const i={...t,timestamp:Date.now()};this.logs.push(i),this.log$.next(i)};createCustomLog(t){return(...i)=>{let n;try{n=t(...i)}catch{n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(t){return this.createCustomLog(i=>({component:t,...i}))}getAllLogs=()=>this.logs}function B(e,t='Assertion "value is not nullable" failed'){if(e==null)throw new Error(t)}function ee(e,t='Assertion "value is nullable" failed'){if(e!=null)throw new Error(t)}function P(e){return typeof e<"u"&&e!==null}function M(e){return e==null}const te=(e,t,i)=>new Promise((n,o)=>{t.addEventListener("abort",()=>{f(),b.remove()});const r=()=>{f(),o()},s=()=>{f(),n()},f=()=>{p&&clearTimeout(p),b.removeEventListener("load",s),b.removeEventListener("error",r)};let p;i&&(p=window.setTimeout(r,i));const b=document.createElement("script");b.addEventListener("load",s),b.addEventListener("error",r),b.src=e,document.head.appendChild(b)}),ie=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),ne=(e,t)=>async(...i)=>{const n=t(...i);let o=e.aborted,r;for(;!o&&!e.aborted;){const s=await n.next(r);o=s.done??!1,r=s.value}return r};var l;(function(e){e.Unknown="Unknown",e.Yandex="Yandex",e.Chrome="Chrome",e.Chromium="Chromium",e.Firefox="Firefox",e.Safari="Safari",e.Opera="Opera",e.Edge="Edge",e.Rest="Rest"})(l||(l={}));var m;(function(e){e.Unknown="Unknown",e.Android="Android",e.iPhone="iPhone",e.iPad="iPad",e.iPod="iPod",e.RestMobile="RestMobile",e.Desktop="Desktop"})(m||(m={}));const se=()=>{const{userAgent:e}=window.navigator,t=/yabrowser/i.test(e)?l.Yandex:void 0,i=/chrome|crios/i.test(e)?l.Chrome:void 0,n=/chromium/i.test(e)?l.Chromium:void 0,o=/firefox|fxios/i.test(e)?l.Firefox:void 0,r=/webkit|safari|khtml/i.test(e)?l.Safari:void 0,s=/opr\//i.test(e)?l.Opera:void 0,f=/edg/i.test(e)?l.Edge:void 0,p=/android/i.test(e)?m.Android:void 0,b=/iphone/i.test(e)?m.iPhone:void 0,v=/ipad/i.test(e)?m.iPad:void 0,R=/ipod/i.test(e)?m.iPod:void 0,N=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?m.RestMobile:void 0;return{browser:t||o||s||f||i||n||r||l.Rest,device:p||b||v||R||N||m.Desktop}},re=(e,{start:t=0,factor:i=2,max:n=1/0,min:o=t,random:r=0}={})=>{let s=t;return s*=i**e,s*=1+(Math.random()*r*2-r),s=Math.round(s),s=Math.min(s,n),s=Math.max(s,o),s};var a;(function(e){e[e.LOCAL_STORAGE=0]="LOCAL_STORAGE",e[e.SESSION_STORAGE=1]="SESSION_STORAGE",e[e.RUNTIME=2]="RUNTIME"})(a||(a={}));const E=new Map;let h=a.RUNTIME;const S=`vk-videoplayer-dummy-key-${Math.random()}`,y=()=>{try{localStorage.setItem(S,"test"),localStorage.removeItem(S),h=a.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(S),h=a.SESSION_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)h=a.RUNTIME;else throw t}else throw e}};y();const V=e=>{switch(h){case a.LOCAL_STORAGE:return localStorage.getItem(e)??void 0;case a.SESSION_STORAGE:return sessionStorage.getItem(e)??void 0;case a.RUNTIME:return E.get(e);default:w(h)}},Q=(e,t)=>{switch(h){case a.LOCAL_STORAGE:try{localStorage.setItem(e,t)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case a.SESSION_STORAGE:try{sessionStorage.setItem(e,t)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case a.RUNTIME:return void E.set(e,t);default:w(h)}},G=e=>{switch(h){case a.LOCAL_STORAGE:return e in localStorage;case a.SESSION_STORAGE:return e in sessionStorage;case a.RUNTIME:return E.has(e);default:return w(h),!1}},U=e=>{switch(h){case a.LOCAL_STORAGE:return localStorage.removeItem(e);case a.SESSION_STORAGE:return sessionStorage.removeItem(e);case a.RUNTIME:return void E.delete(e);default:w(h)}},k=()=>{switch(h){case a.LOCAL_STORAGE:return localStorage.clear();case a.SESSION_STORAGE:return sessionStorage.clear();case a.RUNTIME:return E.clear();default:w(h)}};var oe=Object.freeze({__proto__:null,clear:k,get:V,has:G,remove:U,set:Q}),u;(function(e){e.INVARIANT="Invariant quality",e.Q_144P="144p",e.Q_240P="240p",e.Q_360P="360p",e.Q_480P="480p",e.Q_720P="720p",e.Q_1080P="1080p",e.Q_1440P="1440p",e.Q_2160P="2160p",e.Q_4320P="4320p"})(u||(u={}));const d={[u.Q_144P]:{width:256,height:144},[u.Q_240P]:{width:428,height:240},[u.Q_360P]:{width:640,height:360},[u.Q_480P]:{width:856,height:480},[u.Q_720P]:{width:1280,height:720},[u.Q_1080P]:{width:1920,height:1080},[u.Q_1440P]:{width:2560,height:1440},[u.Q_2160P]:{width:3840,height:2160},[u.Q_4320P]:{width:7680,height:4320}},ae=(e,t)=>d[e].height>d[t].height,ce=(e,t)=>d[e].height>=d[t].height,I=(e,t)=>d[e].height<d[t].height,ue=(e,t)=>d[e].height<=d[t].height,he=e=>e.sort((t,i)=>t===i?0:t===u.INVARIANT?1:i===u.INVARIANT?-1:I(t,i)?1:-1)[0],T=Object.keys(d).sort((e,t)=>I(e,t)?-1:1),de=(e,t=.02)=>[...T].find(n=>d[n].height*(1+t)>=e),le=({width:e,height:t})=>{const i=Math.min(e,t),n=Math.max(e,t);return T.find(o=>{const r=d[o];return r.width>=n&&r.height>=i})},fe=e=>d[e].height,L=e=>e===u.INVARIANT,be=e=>e.every(t=>!L(t));function me(e){if(L(e))throw new Error("Expected exact quality")}class we extends A{value;constructor(t){super(),this.value=t}next(t){super.next(this.value=t)}error(t){super.error(this.value=t)}getValue(){return this.value}_subscribe(t){const i=super._subscribe(t);return t.next(this.value),i}}function pe(e){return new c(t=>{const i={};let n=Object.keys(e).length;const o=r=>s=>{r in i||n--,i[r]=s,n===0&&t.next(i)};return Object.entries(e).reduce((r,[s,f])=>r.add(f.subscribe(o(s))),new x)})}function ge(...e){return new c(t=>e.reduce((i,n)=>i.add(n.subscribe(t)),new x))}var Ee=e=>new c(t=>{const i=window.setTimeout(()=>{try{t.next()}catch(n){if(t.error)t.error(n);else throw n}},e);return()=>window.clearTimeout(i)}),xe=e=>new c(t=>{const i=window.setInterval(()=>t.next(),e);return()=>window.clearInterval(i)}),Se=e=>new c(t=>{e.forEach(i=>t.next(i))}),Oe=(e,t)=>new c(i=>{const n=o=>i.next(o);return e.addEventListener(t,n),()=>e.removeEventListener(t,n)});function _e(e){return t=>new c(i=>t.subscribe(new D(i,e)))}class D{destination;size;lastValues=[];constructor(t,i){this.destination=t,this.size=i}next(t){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(t),this.destination.next(this.lastValues)}error(t){this.destination.error?.(t)}}const F={leading:!1,trailing:!0};function Ae(e,t=F){return i=>new c(n=>i.subscribe(new j(n,e,t)))}class j{destination;time;config;lastValue;timeout;constructor(t,i,n){this.destination=t,this.time=i,this.config=n}next(t){this.lastValue=t,P(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(i){if(this.destination.error)this.destination.error(i);else throw i}this.timeout=void 0},this.time)}error(t){this.destination.error?.(t)}}const z={leading:!0,trailing:!1};function Ie(e,t=z){return i=>new c(n=>i.subscribe(new q(n,e,t)))}class q{destination;time;config;lastValue;timeout;constructor(t,i,n){this.destination=t,this.time=i,this.config=n}next(t){this.lastValue=t,M(this.timeout)&&(this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(t){this.destination.error?.(t)}}function Te(e){return t=>new c(i=>t.subscribe(new $(i,e)))}class ${destination;predicate;constructor(t,i){this.destination=t,this.predicate=i}next(t){let i;try{i=this.predicate(t)}catch(n){throw this.error(n),n}i&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function Le(e=(t,i)=>t===i){return t=>new c(i=>t.subscribe(new H(i,e)))}const O={};class H{destination;predicate;lastValue=O;constructor(t,i){this.destination=t,this.predicate=i}next(t){let i;try{i=this.lastValue===O||!this.predicate(this.lastValue,t),this.lastValue=t}catch(n){throw this.error(n),n}i&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function Y(e){return t=>new c(i=>t.subscribe(new C(i,e)))}let C=class{destination;mapper;constructor(t,i){this.destination=t,this.mapper=i}next(t){let i;try{i=this.mapper(t)}catch(n){throw this.error(n),n}this.destination.next(i)}error(t){this.destination.error?.(t)}};function Re(e){return Y(()=>e)}function Ne(){return e=>new c(t=>{let i=!1,n=!1;const o=e.subscribe(r=>{i||(i=!0,t.next(r)),n&&o.unsubscribe()},r=>{i=!0,t.error?.(r),n&&o.unsubscribe()});return n=!0,i&&o.unsubscribe(),o})}function Pe(){return e=>new c(t=>e.subscribe(new K(t)))}class K{destination;last;hasLast=!1;constructor(t){this.destination=t}next(t){const i=this.last;if(this.last=t,!this.hasLast){this.hasLast=!0;return}this.destination.next([i,t])}error(t){this.destination.error?.(t)}}function Me(e){return t=>new c(i=>t.subscribe(new W(i,e)))}class W{destination;effect;constructor(t,i){this.destination=t,this.effect=i}next(t){try{this.effect(t)}catch(i){throw this.error(i),i}this.destination.next(t)}error(t){this.destination.error?.(t)}}var _;(function(e){e.NETWORK="network",e.VIDEO_PIPELINE="video_pipeline",e.EXTERNAL_API="external_api",e.PARSER="parser",e.DOM="dom",e.WTF="wtf"})(_||(_={}));const ye=5;export{ye as ACTIVE_LIVE_VALID_DELAY,l as CurrentClientBrowser,m as CurrentClientDevice,_ as ErrorCategory,Z as Logger,c as Observable,A as Subject,x as Subscription,X as VERSION,we as ValueSubject,u as VideoQuality,ne as abortable,te as addScript,be as areQualitiesExact,w as assertNever,B as assertNonNullable,ee as assertNullable,me as assertQualityIsExact,_e as buffer,J as checkNever,pe as combine,Ae as debounce,Te as filter,Le as filterChanged,Oe as fromEvent,se as getCurrentBrowser,re as getExponentialDelay,he as getHighestQuality,xe as interval,ae as isHigher,ce as isHigherOrEqual,L as isInvariantQuality,I as isLower,ue as isLowerOrEqual,P as isNonNullable,M as isNullable,Y as map,Re as mapTo,ge as merge,g as noop,ie as now,Se as observableFrom,Ne as once,Pe as pairwise,oe as safeStorage,Me as tap,Ie as throttle,Ee as timeout,de as videoHeightToQuality,fe as videoQualityToHeight,le as videoSizeToQuality};
6
+ const J="1.0.26";class S{subscriptions=[];unsubscribe(){const e=this.subscriptions;this.subscriptions=[],e.forEach(s=>typeof s=="function"?s():s.unsubscribe())}add(e){return this.subscriptions.push(e),this}}const w=t=>{throw new Error(`${t} is value of unexpected type`)},Z=t=>{},x=()=>{};class c{constructor(e){e&&(this._subscribe=e)}subscribe(e,s){let i;s?typeof s=="function"?i={next:s,error:x}:i={next:n=>s.next(n),error:n=>s.error?.(n)}:i={next:x,error:x};const o=typeof e=="function"?{next:n=>{try{e(n)}catch(l){i.next(l)}},error:n=>i.next(n)}:{next:n=>e.next(n),error:n=>e.error?e.error(n):i.next(n)};let r;try{r=this._subscribe(o)}catch(n){o.error?.(n)}return new S().add(()=>{switch(o.next=x,o.error=x,typeof r){case"function":r();return;case"object":r.unsubscribe();return;case"undefined":return;default:return w(r)}})}pipe(...e){return e.reduce((s,i)=>i(s),this)}_subscribe(e){}}class I extends c{keyCounter=0;subscribers=new Map;constructor(){super()}next(e){this.subscribers.forEach(s=>s.next(e))}error(e){this.subscribers.forEach(s=>s.error?.(e))}_subscribe(e){const s=this.keyCounter++;return this.subscribers.set(s,e),new S().add(()=>this.subscribers.delete(s))}}class B{log$=new I;logs=[];log=e=>{const s={...e,timestamp:Date.now()};this.logs.push(s),this.log$.next(s)};createCustomLog(e){return(...s)=>{let i;try{i=e(...s)}catch{i={message:"error in `createCustomLog`",component:"Logger"}}this.log(i)}}createComponentLog(e){return this.createCustomLog(s=>({component:e,...s}))}getAllLogs=()=>this.logs}function ee(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function te(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function M(t){return typeof t<"u"&&t!==null}function y(t){return t==null}const se=(t,e,s)=>new Promise((i,o)=>{e.addEventListener("abort",()=>{l(),f.remove()});const r=()=>{l(),o()},n=()=>{l(),i()},l=()=>{E&&clearTimeout(E),f.removeEventListener("load",n),f.removeEventListener("error",r)};let E;s&&(E=window.setTimeout(r,s));const f=document.createElement("script");f.addEventListener("load",n),f.addEventListener("error",r),f.src=t,document.head.appendChild(f)}),ie=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),ne=(t,e)=>async(...s)=>{const i=e(...s);let o=t.aborted,r;for(;!o&&!t.aborted;){const n=await i.next(r);o=n.done??!1,r=n.value}return r};var d;(function(t){t.Unknown="Unknown",t.Yandex="Yandex",t.Chrome="Chrome",t.Chromium="Chromium",t.Firefox="Firefox",t.Safari="Safari",t.Opera="Opera",t.Edge="Edge",t.Rest="Rest"})(d||(d={}));var b;(function(t){t.Unknown="Unknown",t.Android="Android",t.iPhone="iPhone",t.iPad="iPad",t.iPod="iPod",t.RestMobile="RestMobile",t.Desktop="Desktop"})(b||(b={}));const re=()=>{const{userAgent:t}=window.navigator,e=/yabrowser/i.test(t)?d.Yandex:void 0,s=/chrome|crios/i.test(t)?d.Chrome:void 0,i=/chromium/i.test(t)?d.Chromium:void 0,o=/firefox|fxios/i.test(t)?d.Firefox:void 0,r=/webkit|safari|khtml/i.test(t)?d.Safari:void 0,n=/opr\//i.test(t)?d.Opera:void 0,l=/edg/i.test(t)?d.Edge:void 0,E=/android/i.test(t)?b.Android:void 0,f=/iphone/i.test(t)?b.iPhone:void 0,R=/ipad/i.test(t)?b.iPad:void 0,P=/ipod/i.test(t)?b.iPod:void 0,N=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?b.RestMobile:void 0;return{browser:e||o||n||l||s||i||r||d.Rest,device:E||f||R||P||N||b.Desktop}},oe=(t,{start:e=0,factor:s=2,max:i=1/0,min:o=e,random:r=0}={})=>{let n=e;return n*=s**t,n*=1+(Math.random()*r*2-r),n=Math.round(n),n=Math.min(n,i),n=Math.max(n,o),n};var a;(function(t){t[t.LOCAL_STORAGE=0]="LOCAL_STORAGE",t[t.SESSION_STORAGE=1]="SESSION_STORAGE",t[t.RUNTIME=2]="RUNTIME"})(a||(a={}));let g,m;const O=`vk-videoplayer-dummy-key-${Math.random()}`,p=()=>{if(m!==void 0)return m;try{localStorage.setItem(O,"test"),localStorage.removeItem(O),m=a.LOCAL_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(O),m=a.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)m=a.RUNTIME;else throw e}else throw t}return m===a.RUNTIME&&(g=new Map),m},V=()=>p()===a.LOCAL_STORAGE,Q=t=>{const e=p();switch(e){case a.LOCAL_STORAGE:return localStorage.getItem(t)??void 0;case a.SESSION_STORAGE:return sessionStorage.getItem(t)??void 0;case a.RUNTIME:return g?.get(t);default:w(e)}},G=(t,e)=>{const s=p();switch(s){case a.LOCAL_STORAGE:try{localStorage.setItem(t,e)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case a.SESSION_STORAGE:try{sessionStorage.setItem(t,e)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case a.RUNTIME:return void g?.set(t,e);default:w(s)}},U=t=>{const e=p();switch(e){case a.LOCAL_STORAGE:return t in localStorage;case a.SESSION_STORAGE:return t in sessionStorage;case a.RUNTIME:return g?.has(t)??!1;default:return w(e),!1}},k=t=>{const e=p();switch(e){case a.LOCAL_STORAGE:return localStorage.removeItem(t);case a.SESSION_STORAGE:return sessionStorage.removeItem(t);case a.RUNTIME:return void g?.delete(t);default:w(e)}},D=()=>{const t=p();switch(t){case a.LOCAL_STORAGE:return localStorage.clear();case a.SESSION_STORAGE:return sessionStorage.clear();case a.RUNTIME:return g?.clear();default:w(t)}};var ae=Object.freeze({__proto__:null,clear:D,get:Q,has:U,isPersistent:V,remove:k,set:G}),u;(function(t){t.INVARIANT="Invariant quality",t.Q_144P="144p",t.Q_240P="240p",t.Q_360P="360p",t.Q_480P="480p",t.Q_720P="720p",t.Q_1080P="1080p",t.Q_1440P="1440p",t.Q_2160P="2160p",t.Q_4320P="4320p"})(u||(u={}));const h={[u.Q_144P]:{width:256,height:144},[u.Q_240P]:{width:428,height:240},[u.Q_360P]:{width:640,height:360},[u.Q_480P]:{width:856,height:480},[u.Q_720P]:{width:1280,height:720},[u.Q_1080P]:{width:1920,height:1080},[u.Q_1440P]:{width:2560,height:1440},[u.Q_2160P]:{width:3840,height:2160},[u.Q_4320P]:{width:7680,height:4320}},ce=(t,e)=>h[t].height>h[e].height,ue=(t,e)=>h[t].height>=h[e].height,T=(t,e)=>h[t].height<h[e].height,he=(t,e)=>h[t].height<=h[e].height,de=t=>t.sort((e,s)=>e===s?0:e===u.INVARIANT?1:s===u.INVARIANT?-1:T(e,s)?1:-1)[0],L=Object.keys(h).sort((t,e)=>T(t,e)?-1:1),le=(t,e=.02)=>[...L].find(i=>h[i].height*(1+e)>=t),fe=({width:t,height:e})=>{const s=Math.min(t,e),i=Math.max(t,e);return L.find(o=>{const r=h[o];return r.width>=i&&r.height>=s})},be=t=>h[t].height,v=t=>t===u.INVARIANT,me=t=>t.every(e=>!v(e));function we(t){if(v(t))throw new Error("Expected exact quality")}class ge extends I{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){const s=super._subscribe(e);return e.next(this.value),s}}function pe(t){return new c(e=>{const s={};let i=Object.keys(t).length;const o=r=>n=>{r in s||i--,s[r]=n,i===0&&e.next(s)};return Object.entries(t).reduce((r,[n,l])=>r.add(l.subscribe(o(n))),new S)})}function Ee(...t){return new c(e=>t.reduce((s,i)=>s.add(i.subscribe(e)),new S))}var xe=t=>new c(e=>{const s=window.setTimeout(()=>{try{e.next()}catch(i){if(e.error)e.error(i);else throw i}},t);return()=>window.clearTimeout(s)}),Se=t=>new c(e=>{const s=window.setInterval(()=>e.next(),t);return()=>window.clearInterval(s)}),Oe=t=>new c(e=>{t.forEach(s=>e.next(s))}),_e=(t,e)=>new c(s=>{const i=o=>s.next(o);return t.addEventListener(e,i),()=>t.removeEventListener(e,i)});function Ae(t){return e=>new c(s=>e.subscribe(new F(s,t)))}class F{destination;size;lastValues=[];constructor(e,s){this.destination=e,this.size=s}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)}}const j={leading:!1,trailing:!0};function Ie(t,e=j){return s=>new c(i=>s.subscribe(new z(i,t,e)))}class z{destination;time;config;lastValue;timeout;constructor(e,s,i){this.destination=e,this.time=s,this.config=i}next(e){this.lastValue=e,M(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(s){if(this.destination.error)this.destination.error(s);else throw s}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}}const q={leading:!0,trailing:!1};function Te(t,e=q){return s=>new c(i=>s.subscribe(new $(i,t,e)))}class ${destination;time;config;lastValue;timeout;constructor(e,s,i){this.destination=e,this.time=s,this.config=i}next(e){this.lastValue=e,y(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}}function Le(t){return e=>new c(s=>e.subscribe(new H(s,t)))}class H{destination;predicate;constructor(e,s){this.destination=e,this.predicate=s}next(e){let s;try{s=this.predicate(e)}catch(i){throw this.error(i),i}s&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function ve(t=(e,s)=>e===s){return e=>new c(s=>e.subscribe(new Y(s,t)))}const _={};class Y{destination;predicate;lastValue=_;constructor(e,s){this.destination=e,this.predicate=s}next(e){let s;try{s=this.lastValue===_||!this.predicate(this.lastValue,e),this.lastValue=e}catch(i){throw this.error(i),i}s&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function C(t){return e=>new c(s=>e.subscribe(new K(s,t)))}let K=class{destination;mapper;constructor(e,s){this.destination=e,this.mapper=s}next(e){let s;try{s=this.mapper(e)}catch(i){throw this.error(i),i}this.destination.next(s)}error(e){this.destination.error?.(e)}};function Pe(t){return C(()=>t)}function Ne(){return t=>new c(e=>{let s=!1,i=!1;const o=t.subscribe(r=>{s||(s=!0,e.next(r)),i&&o.unsubscribe()},r=>{s=!0,e.error?.(r),i&&o.unsubscribe()});return i=!0,s&&o.unsubscribe(),o})}function Me(){return t=>new c(e=>t.subscribe(new W(e)))}class W{destination;last;hasLast=!1;constructor(e){this.destination=e}next(e){const s=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([s,e])}error(e){this.destination.error?.(e)}}function ye(t){return e=>new c(s=>e.subscribe(new X(s,t)))}class X{destination;effect;constructor(e,s){this.destination=e,this.effect=s}next(e){try{this.effect(e)}catch(s){throw this.error(s),s}this.destination.next(e)}error(e){this.destination.error?.(e)}}var A;(function(t){t.NETWORK="network",t.VIDEO_PIPELINE="video_pipeline",t.EXTERNAL_API="external_api",t.PARSER="parser",t.DOM="dom",t.WTF="wtf"})(A||(A={}));const Ve=5;export{Ve as ACTIVE_LIVE_VALID_DELAY,d as CurrentClientBrowser,b as CurrentClientDevice,A as ErrorCategory,B as Logger,c as Observable,I as Subject,S as Subscription,J as VERSION,ge as ValueSubject,u as VideoQuality,ne as abortable,se as addScript,me as areQualitiesExact,w as assertNever,ee as assertNonNullable,te as assertNullable,we as assertQualityIsExact,Ae as buffer,Z as checkNever,pe as combine,Ie as debounce,Le as filter,ve as filterChanged,_e as fromEvent,re as getCurrentBrowser,oe as getExponentialDelay,de as getHighestQuality,Se as interval,ce as isHigher,ue as isHigherOrEqual,v as isInvariantQuality,T as isLower,he as isLowerOrEqual,M as isNonNullable,y as isNullable,C as map,Pe as mapTo,Ee as merge,x as noop,ie as now,Oe as observableFrom,Ne as once,Me as pairwise,ae as safeStorage,ye as tap,Te as throttle,xe as timeout,le as videoHeightToQuality,be as videoQualityToHeight,fe as videoSizeToQuality};
package/evergreen.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.25
3
- * Mon, 03 Jul 2023 15:51:34 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-25/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.26
3
+ * Mon, 10 Jul 2023 13:37:00 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-26/doc/
5
5
  */
6
- const X="1.0.25";class x{subscriptions=[];unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach(i=>typeof i=="function"?i():i.unsubscribe())}add(t){return this.subscriptions.push(t),this}}const w=e=>{throw new Error(`${e} is value of unexpected type`)},J=e=>{},g=()=>{};class c{constructor(t){t&&(this._subscribe=t)}subscribe(t,i){let n;i?typeof i=="function"?n={next:i,error:g}:n={next:s=>i.next(s),error:s=>i.error?.(s)}:n={next:g,error:g};const o=typeof t=="function"?{next:s=>{try{t(s)}catch(f){n.next(f)}},error:s=>n.next(s)}:{next:s=>t.next(s),error:s=>t.error?t.error(s):n.next(s)};let r;try{r=this._subscribe(o)}catch(s){o.error?.(s)}return new x().add(()=>{switch(o.next=g,o.error=g,typeof r){case"function":r();return;case"object":r.unsubscribe();return;case"undefined":return;default:return w(r)}})}pipe(...t){return t.reduce((i,n)=>n(i),this)}_subscribe(t){}}class A extends c{keyCounter=0;subscribers=new Map;constructor(){super()}next(t){this.subscribers.forEach(i=>i.next(t))}error(t){this.subscribers.forEach(i=>i.error?.(t))}_subscribe(t){const i=this.keyCounter++;return this.subscribers.set(i,t),new x().add(()=>this.subscribers.delete(i))}}class Z{log$=new A;logs=[];log=t=>{const i={...t,timestamp:Date.now()};this.logs.push(i),this.log$.next(i)};createCustomLog(t){return(...i)=>{let n;try{n=t(...i)}catch{n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(t){return this.createCustomLog(i=>({component:t,...i}))}getAllLogs=()=>this.logs}function B(e,t='Assertion "value is not nullable" failed'){if(e==null)throw new Error(t)}function ee(e,t='Assertion "value is nullable" failed'){if(e!=null)throw new Error(t)}function P(e){return typeof e<"u"&&e!==null}function M(e){return e==null}const te=(e,t,i)=>new Promise((n,o)=>{t.addEventListener("abort",()=>{f(),b.remove()});const r=()=>{f(),o()},s=()=>{f(),n()},f=()=>{p&&clearTimeout(p),b.removeEventListener("load",s),b.removeEventListener("error",r)};let p;i&&(p=window.setTimeout(r,i));const b=document.createElement("script");b.addEventListener("load",s),b.addEventListener("error",r),b.src=e,document.head.appendChild(b)}),ie=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),ne=(e,t)=>async(...i)=>{const n=t(...i);let o=e.aborted,r;for(;!o&&!e.aborted;){const s=await n.next(r);o=s.done??!1,r=s.value}return r};var l;(function(e){e.Unknown="Unknown",e.Yandex="Yandex",e.Chrome="Chrome",e.Chromium="Chromium",e.Firefox="Firefox",e.Safari="Safari",e.Opera="Opera",e.Edge="Edge",e.Rest="Rest"})(l||(l={}));var m;(function(e){e.Unknown="Unknown",e.Android="Android",e.iPhone="iPhone",e.iPad="iPad",e.iPod="iPod",e.RestMobile="RestMobile",e.Desktop="Desktop"})(m||(m={}));const se=()=>{const{userAgent:e}=window.navigator,t=/yabrowser/i.test(e)?l.Yandex:void 0,i=/chrome|crios/i.test(e)?l.Chrome:void 0,n=/chromium/i.test(e)?l.Chromium:void 0,o=/firefox|fxios/i.test(e)?l.Firefox:void 0,r=/webkit|safari|khtml/i.test(e)?l.Safari:void 0,s=/opr\//i.test(e)?l.Opera:void 0,f=/edg/i.test(e)?l.Edge:void 0,p=/android/i.test(e)?m.Android:void 0,b=/iphone/i.test(e)?m.iPhone:void 0,v=/ipad/i.test(e)?m.iPad:void 0,R=/ipod/i.test(e)?m.iPod:void 0,N=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?m.RestMobile:void 0;return{browser:t||o||s||f||i||n||r||l.Rest,device:p||b||v||R||N||m.Desktop}},re=(e,{start:t=0,factor:i=2,max:n=1/0,min:o=t,random:r=0}={})=>{let s=t;return s*=i**e,s*=1+(Math.random()*r*2-r),s=Math.round(s),s=Math.min(s,n),s=Math.max(s,o),s};var a;(function(e){e[e.LOCAL_STORAGE=0]="LOCAL_STORAGE",e[e.SESSION_STORAGE=1]="SESSION_STORAGE",e[e.RUNTIME=2]="RUNTIME"})(a||(a={}));const E=new Map;let h=a.RUNTIME;const S=`vk-videoplayer-dummy-key-${Math.random()}`,y=()=>{try{localStorage.setItem(S,"test"),localStorage.removeItem(S),h=a.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(S),h=a.SESSION_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)h=a.RUNTIME;else throw t}else throw e}};y();const V=e=>{switch(h){case a.LOCAL_STORAGE:return localStorage.getItem(e)??void 0;case a.SESSION_STORAGE:return sessionStorage.getItem(e)??void 0;case a.RUNTIME:return E.get(e);default:w(h)}},Q=(e,t)=>{switch(h){case a.LOCAL_STORAGE:try{localStorage.setItem(e,t)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case a.SESSION_STORAGE:try{sessionStorage.setItem(e,t)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case a.RUNTIME:return void E.set(e,t);default:w(h)}},G=e=>{switch(h){case a.LOCAL_STORAGE:return e in localStorage;case a.SESSION_STORAGE:return e in sessionStorage;case a.RUNTIME:return E.has(e);default:return w(h),!1}},U=e=>{switch(h){case a.LOCAL_STORAGE:return localStorage.removeItem(e);case a.SESSION_STORAGE:return sessionStorage.removeItem(e);case a.RUNTIME:return void E.delete(e);default:w(h)}},k=()=>{switch(h){case a.LOCAL_STORAGE:return localStorage.clear();case a.SESSION_STORAGE:return sessionStorage.clear();case a.RUNTIME:return E.clear();default:w(h)}};var oe=Object.freeze({__proto__:null,clear:k,get:V,has:G,remove:U,set:Q}),u;(function(e){e.INVARIANT="Invariant quality",e.Q_144P="144p",e.Q_240P="240p",e.Q_360P="360p",e.Q_480P="480p",e.Q_720P="720p",e.Q_1080P="1080p",e.Q_1440P="1440p",e.Q_2160P="2160p",e.Q_4320P="4320p"})(u||(u={}));const d={[u.Q_144P]:{width:256,height:144},[u.Q_240P]:{width:428,height:240},[u.Q_360P]:{width:640,height:360},[u.Q_480P]:{width:856,height:480},[u.Q_720P]:{width:1280,height:720},[u.Q_1080P]:{width:1920,height:1080},[u.Q_1440P]:{width:2560,height:1440},[u.Q_2160P]:{width:3840,height:2160},[u.Q_4320P]:{width:7680,height:4320}},ae=(e,t)=>d[e].height>d[t].height,ce=(e,t)=>d[e].height>=d[t].height,I=(e,t)=>d[e].height<d[t].height,ue=(e,t)=>d[e].height<=d[t].height,he=e=>e.sort((t,i)=>t===i?0:t===u.INVARIANT?1:i===u.INVARIANT?-1:I(t,i)?1:-1)[0],T=Object.keys(d).sort((e,t)=>I(e,t)?-1:1),de=(e,t=.02)=>[...T].find(n=>d[n].height*(1+t)>=e),le=({width:e,height:t})=>{const i=Math.min(e,t),n=Math.max(e,t);return T.find(o=>{const r=d[o];return r.width>=n&&r.height>=i})},fe=e=>d[e].height,L=e=>e===u.INVARIANT,be=e=>e.every(t=>!L(t));function me(e){if(L(e))throw new Error("Expected exact quality")}class we extends A{value;constructor(t){super(),this.value=t}next(t){super.next(this.value=t)}error(t){super.error(this.value=t)}getValue(){return this.value}_subscribe(t){const i=super._subscribe(t);return t.next(this.value),i}}function pe(e){return new c(t=>{const i={};let n=Object.keys(e).length;const o=r=>s=>{r in i||n--,i[r]=s,n===0&&t.next(i)};return Object.entries(e).reduce((r,[s,f])=>r.add(f.subscribe(o(s))),new x)})}function ge(...e){return new c(t=>e.reduce((i,n)=>i.add(n.subscribe(t)),new x))}var Ee=e=>new c(t=>{const i=window.setTimeout(()=>{try{t.next()}catch(n){if(t.error)t.error(n);else throw n}},e);return()=>window.clearTimeout(i)}),xe=e=>new c(t=>{const i=window.setInterval(()=>t.next(),e);return()=>window.clearInterval(i)}),Se=e=>new c(t=>{e.forEach(i=>t.next(i))}),Oe=(e,t)=>new c(i=>{const n=o=>i.next(o);return e.addEventListener(t,n),()=>e.removeEventListener(t,n)});function _e(e){return t=>new c(i=>t.subscribe(new D(i,e)))}class D{destination;size;lastValues=[];constructor(t,i){this.destination=t,this.size=i}next(t){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(t),this.destination.next(this.lastValues)}error(t){this.destination.error?.(t)}}const F={leading:!1,trailing:!0};function Ae(e,t=F){return i=>new c(n=>i.subscribe(new j(n,e,t)))}class j{destination;time;config;lastValue;timeout;constructor(t,i,n){this.destination=t,this.time=i,this.config=n}next(t){this.lastValue=t,P(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(i){if(this.destination.error)this.destination.error(i);else throw i}this.timeout=void 0},this.time)}error(t){this.destination.error?.(t)}}const z={leading:!0,trailing:!1};function Ie(e,t=z){return i=>new c(n=>i.subscribe(new q(n,e,t)))}class q{destination;time;config;lastValue;timeout;constructor(t,i,n){this.destination=t,this.time=i,this.config=n}next(t){this.lastValue=t,M(this.timeout)&&(this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(t){this.destination.error?.(t)}}function Te(e){return t=>new c(i=>t.subscribe(new $(i,e)))}class ${destination;predicate;constructor(t,i){this.destination=t,this.predicate=i}next(t){let i;try{i=this.predicate(t)}catch(n){throw this.error(n),n}i&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function Le(e=(t,i)=>t===i){return t=>new c(i=>t.subscribe(new H(i,e)))}const O={};class H{destination;predicate;lastValue=O;constructor(t,i){this.destination=t,this.predicate=i}next(t){let i;try{i=this.lastValue===O||!this.predicate(this.lastValue,t),this.lastValue=t}catch(n){throw this.error(n),n}i&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function Y(e){return t=>new c(i=>t.subscribe(new C(i,e)))}let C=class{destination;mapper;constructor(t,i){this.destination=t,this.mapper=i}next(t){let i;try{i=this.mapper(t)}catch(n){throw this.error(n),n}this.destination.next(i)}error(t){this.destination.error?.(t)}};function Re(e){return Y(()=>e)}function Ne(){return e=>new c(t=>{let i=!1,n=!1;const o=e.subscribe(r=>{i||(i=!0,t.next(r)),n&&o.unsubscribe()},r=>{i=!0,t.error?.(r),n&&o.unsubscribe()});return n=!0,i&&o.unsubscribe(),o})}function Pe(){return e=>new c(t=>e.subscribe(new K(t)))}class K{destination;last;hasLast=!1;constructor(t){this.destination=t}next(t){const i=this.last;if(this.last=t,!this.hasLast){this.hasLast=!0;return}this.destination.next([i,t])}error(t){this.destination.error?.(t)}}function Me(e){return t=>new c(i=>t.subscribe(new W(i,e)))}class W{destination;effect;constructor(t,i){this.destination=t,this.effect=i}next(t){try{this.effect(t)}catch(i){throw this.error(i),i}this.destination.next(t)}error(t){this.destination.error?.(t)}}var _;(function(e){e.NETWORK="network",e.VIDEO_PIPELINE="video_pipeline",e.EXTERNAL_API="external_api",e.PARSER="parser",e.DOM="dom",e.WTF="wtf"})(_||(_={}));const ye=5;export{ye as ACTIVE_LIVE_VALID_DELAY,l as CurrentClientBrowser,m as CurrentClientDevice,_ as ErrorCategory,Z as Logger,c as Observable,A as Subject,x as Subscription,X as VERSION,we as ValueSubject,u as VideoQuality,ne as abortable,te as addScript,be as areQualitiesExact,w as assertNever,B as assertNonNullable,ee as assertNullable,me as assertQualityIsExact,_e as buffer,J as checkNever,pe as combine,Ae as debounce,Te as filter,Le as filterChanged,Oe as fromEvent,se as getCurrentBrowser,re as getExponentialDelay,he as getHighestQuality,xe as interval,ae as isHigher,ce as isHigherOrEqual,L as isInvariantQuality,I as isLower,ue as isLowerOrEqual,P as isNonNullable,M as isNullable,Y as map,Re as mapTo,ge as merge,g as noop,ie as now,Se as observableFrom,Ne as once,Pe as pairwise,oe as safeStorage,Me as tap,Ie as throttle,Ee as timeout,de as videoHeightToQuality,fe as videoQualityToHeight,le as videoSizeToQuality};
6
+ const J="1.0.26";class S{subscriptions=[];unsubscribe(){const e=this.subscriptions;this.subscriptions=[],e.forEach(s=>typeof s=="function"?s():s.unsubscribe())}add(e){return this.subscriptions.push(e),this}}const w=t=>{throw new Error(`${t} is value of unexpected type`)},Z=t=>{},x=()=>{};class c{constructor(e){e&&(this._subscribe=e)}subscribe(e,s){let i;s?typeof s=="function"?i={next:s,error:x}:i={next:n=>s.next(n),error:n=>s.error?.(n)}:i={next:x,error:x};const o=typeof e=="function"?{next:n=>{try{e(n)}catch(l){i.next(l)}},error:n=>i.next(n)}:{next:n=>e.next(n),error:n=>e.error?e.error(n):i.next(n)};let r;try{r=this._subscribe(o)}catch(n){o.error?.(n)}return new S().add(()=>{switch(o.next=x,o.error=x,typeof r){case"function":r();return;case"object":r.unsubscribe();return;case"undefined":return;default:return w(r)}})}pipe(...e){return e.reduce((s,i)=>i(s),this)}_subscribe(e){}}class I extends c{keyCounter=0;subscribers=new Map;constructor(){super()}next(e){this.subscribers.forEach(s=>s.next(e))}error(e){this.subscribers.forEach(s=>s.error?.(e))}_subscribe(e){const s=this.keyCounter++;return this.subscribers.set(s,e),new S().add(()=>this.subscribers.delete(s))}}class B{log$=new I;logs=[];log=e=>{const s={...e,timestamp:Date.now()};this.logs.push(s),this.log$.next(s)};createCustomLog(e){return(...s)=>{let i;try{i=e(...s)}catch{i={message:"error in `createCustomLog`",component:"Logger"}}this.log(i)}}createComponentLog(e){return this.createCustomLog(s=>({component:e,...s}))}getAllLogs=()=>this.logs}function ee(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function te(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function M(t){return typeof t<"u"&&t!==null}function y(t){return t==null}const se=(t,e,s)=>new Promise((i,o)=>{e.addEventListener("abort",()=>{l(),f.remove()});const r=()=>{l(),o()},n=()=>{l(),i()},l=()=>{E&&clearTimeout(E),f.removeEventListener("load",n),f.removeEventListener("error",r)};let E;s&&(E=window.setTimeout(r,s));const f=document.createElement("script");f.addEventListener("load",n),f.addEventListener("error",r),f.src=t,document.head.appendChild(f)}),ie=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),ne=(t,e)=>async(...s)=>{const i=e(...s);let o=t.aborted,r;for(;!o&&!t.aborted;){const n=await i.next(r);o=n.done??!1,r=n.value}return r};var d;(function(t){t.Unknown="Unknown",t.Yandex="Yandex",t.Chrome="Chrome",t.Chromium="Chromium",t.Firefox="Firefox",t.Safari="Safari",t.Opera="Opera",t.Edge="Edge",t.Rest="Rest"})(d||(d={}));var b;(function(t){t.Unknown="Unknown",t.Android="Android",t.iPhone="iPhone",t.iPad="iPad",t.iPod="iPod",t.RestMobile="RestMobile",t.Desktop="Desktop"})(b||(b={}));const re=()=>{const{userAgent:t}=window.navigator,e=/yabrowser/i.test(t)?d.Yandex:void 0,s=/chrome|crios/i.test(t)?d.Chrome:void 0,i=/chromium/i.test(t)?d.Chromium:void 0,o=/firefox|fxios/i.test(t)?d.Firefox:void 0,r=/webkit|safari|khtml/i.test(t)?d.Safari:void 0,n=/opr\//i.test(t)?d.Opera:void 0,l=/edg/i.test(t)?d.Edge:void 0,E=/android/i.test(t)?b.Android:void 0,f=/iphone/i.test(t)?b.iPhone:void 0,R=/ipad/i.test(t)?b.iPad:void 0,P=/ipod/i.test(t)?b.iPod:void 0,N=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?b.RestMobile:void 0;return{browser:e||o||n||l||s||i||r||d.Rest,device:E||f||R||P||N||b.Desktop}},oe=(t,{start:e=0,factor:s=2,max:i=1/0,min:o=e,random:r=0}={})=>{let n=e;return n*=s**t,n*=1+(Math.random()*r*2-r),n=Math.round(n),n=Math.min(n,i),n=Math.max(n,o),n};var a;(function(t){t[t.LOCAL_STORAGE=0]="LOCAL_STORAGE",t[t.SESSION_STORAGE=1]="SESSION_STORAGE",t[t.RUNTIME=2]="RUNTIME"})(a||(a={}));let g,m;const O=`vk-videoplayer-dummy-key-${Math.random()}`,p=()=>{if(m!==void 0)return m;try{localStorage.setItem(O,"test"),localStorage.removeItem(O),m=a.LOCAL_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(O),m=a.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)m=a.RUNTIME;else throw e}else throw t}return m===a.RUNTIME&&(g=new Map),m},V=()=>p()===a.LOCAL_STORAGE,Q=t=>{const e=p();switch(e){case a.LOCAL_STORAGE:return localStorage.getItem(t)??void 0;case a.SESSION_STORAGE:return sessionStorage.getItem(t)??void 0;case a.RUNTIME:return g?.get(t);default:w(e)}},G=(t,e)=>{const s=p();switch(s){case a.LOCAL_STORAGE:try{localStorage.setItem(t,e)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case a.SESSION_STORAGE:try{sessionStorage.setItem(t,e)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case a.RUNTIME:return void g?.set(t,e);default:w(s)}},U=t=>{const e=p();switch(e){case a.LOCAL_STORAGE:return t in localStorage;case a.SESSION_STORAGE:return t in sessionStorage;case a.RUNTIME:return g?.has(t)??!1;default:return w(e),!1}},k=t=>{const e=p();switch(e){case a.LOCAL_STORAGE:return localStorage.removeItem(t);case a.SESSION_STORAGE:return sessionStorage.removeItem(t);case a.RUNTIME:return void g?.delete(t);default:w(e)}},D=()=>{const t=p();switch(t){case a.LOCAL_STORAGE:return localStorage.clear();case a.SESSION_STORAGE:return sessionStorage.clear();case a.RUNTIME:return g?.clear();default:w(t)}};var ae=Object.freeze({__proto__:null,clear:D,get:Q,has:U,isPersistent:V,remove:k,set:G}),u;(function(t){t.INVARIANT="Invariant quality",t.Q_144P="144p",t.Q_240P="240p",t.Q_360P="360p",t.Q_480P="480p",t.Q_720P="720p",t.Q_1080P="1080p",t.Q_1440P="1440p",t.Q_2160P="2160p",t.Q_4320P="4320p"})(u||(u={}));const h={[u.Q_144P]:{width:256,height:144},[u.Q_240P]:{width:428,height:240},[u.Q_360P]:{width:640,height:360},[u.Q_480P]:{width:856,height:480},[u.Q_720P]:{width:1280,height:720},[u.Q_1080P]:{width:1920,height:1080},[u.Q_1440P]:{width:2560,height:1440},[u.Q_2160P]:{width:3840,height:2160},[u.Q_4320P]:{width:7680,height:4320}},ce=(t,e)=>h[t].height>h[e].height,ue=(t,e)=>h[t].height>=h[e].height,T=(t,e)=>h[t].height<h[e].height,he=(t,e)=>h[t].height<=h[e].height,de=t=>t.sort((e,s)=>e===s?0:e===u.INVARIANT?1:s===u.INVARIANT?-1:T(e,s)?1:-1)[0],L=Object.keys(h).sort((t,e)=>T(t,e)?-1:1),le=(t,e=.02)=>[...L].find(i=>h[i].height*(1+e)>=t),fe=({width:t,height:e})=>{const s=Math.min(t,e),i=Math.max(t,e);return L.find(o=>{const r=h[o];return r.width>=i&&r.height>=s})},be=t=>h[t].height,v=t=>t===u.INVARIANT,me=t=>t.every(e=>!v(e));function we(t){if(v(t))throw new Error("Expected exact quality")}class ge extends I{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){const s=super._subscribe(e);return e.next(this.value),s}}function pe(t){return new c(e=>{const s={};let i=Object.keys(t).length;const o=r=>n=>{r in s||i--,s[r]=n,i===0&&e.next(s)};return Object.entries(t).reduce((r,[n,l])=>r.add(l.subscribe(o(n))),new S)})}function Ee(...t){return new c(e=>t.reduce((s,i)=>s.add(i.subscribe(e)),new S))}var xe=t=>new c(e=>{const s=window.setTimeout(()=>{try{e.next()}catch(i){if(e.error)e.error(i);else throw i}},t);return()=>window.clearTimeout(s)}),Se=t=>new c(e=>{const s=window.setInterval(()=>e.next(),t);return()=>window.clearInterval(s)}),Oe=t=>new c(e=>{t.forEach(s=>e.next(s))}),_e=(t,e)=>new c(s=>{const i=o=>s.next(o);return t.addEventListener(e,i),()=>t.removeEventListener(e,i)});function Ae(t){return e=>new c(s=>e.subscribe(new F(s,t)))}class F{destination;size;lastValues=[];constructor(e,s){this.destination=e,this.size=s}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)}}const j={leading:!1,trailing:!0};function Ie(t,e=j){return s=>new c(i=>s.subscribe(new z(i,t,e)))}class z{destination;time;config;lastValue;timeout;constructor(e,s,i){this.destination=e,this.time=s,this.config=i}next(e){this.lastValue=e,M(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(s){if(this.destination.error)this.destination.error(s);else throw s}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}}const q={leading:!0,trailing:!1};function Te(t,e=q){return s=>new c(i=>s.subscribe(new $(i,t,e)))}class ${destination;time;config;lastValue;timeout;constructor(e,s,i){this.destination=e,this.time=s,this.config=i}next(e){this.lastValue=e,y(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}}function Le(t){return e=>new c(s=>e.subscribe(new H(s,t)))}class H{destination;predicate;constructor(e,s){this.destination=e,this.predicate=s}next(e){let s;try{s=this.predicate(e)}catch(i){throw this.error(i),i}s&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function ve(t=(e,s)=>e===s){return e=>new c(s=>e.subscribe(new Y(s,t)))}const _={};class Y{destination;predicate;lastValue=_;constructor(e,s){this.destination=e,this.predicate=s}next(e){let s;try{s=this.lastValue===_||!this.predicate(this.lastValue,e),this.lastValue=e}catch(i){throw this.error(i),i}s&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function C(t){return e=>new c(s=>e.subscribe(new K(s,t)))}let K=class{destination;mapper;constructor(e,s){this.destination=e,this.mapper=s}next(e){let s;try{s=this.mapper(e)}catch(i){throw this.error(i),i}this.destination.next(s)}error(e){this.destination.error?.(e)}};function Pe(t){return C(()=>t)}function Ne(){return t=>new c(e=>{let s=!1,i=!1;const o=t.subscribe(r=>{s||(s=!0,e.next(r)),i&&o.unsubscribe()},r=>{s=!0,e.error?.(r),i&&o.unsubscribe()});return i=!0,s&&o.unsubscribe(),o})}function Me(){return t=>new c(e=>t.subscribe(new W(e)))}class W{destination;last;hasLast=!1;constructor(e){this.destination=e}next(e){const s=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([s,e])}error(e){this.destination.error?.(e)}}function ye(t){return e=>new c(s=>e.subscribe(new X(s,t)))}class X{destination;effect;constructor(e,s){this.destination=e,this.effect=s}next(e){try{this.effect(e)}catch(s){throw this.error(s),s}this.destination.next(e)}error(e){this.destination.error?.(e)}}var A;(function(t){t.NETWORK="network",t.VIDEO_PIPELINE="video_pipeline",t.EXTERNAL_API="external_api",t.PARSER="parser",t.DOM="dom",t.WTF="wtf"})(A||(A={}));const Ve=5;export{Ve as ACTIVE_LIVE_VALID_DELAY,d as CurrentClientBrowser,b as CurrentClientDevice,A as ErrorCategory,B as Logger,c as Observable,I as Subject,S as Subscription,J as VERSION,ge as ValueSubject,u as VideoQuality,ne as abortable,se as addScript,me as areQualitiesExact,w as assertNever,ee as assertNonNullable,te as assertNullable,we as assertQualityIsExact,Ae as buffer,Z as checkNever,pe as combine,Ie as debounce,Le as filter,ve as filterChanged,_e as fromEvent,re as getCurrentBrowser,oe as getExponentialDelay,de as getHighestQuality,Se as interval,ce as isHigher,ue as isHigherOrEqual,v as isInvariantQuality,T as isLower,he as isLowerOrEqual,M as isNonNullable,y as isNullable,C as map,Pe as mapTo,Ee as merge,x as noop,ie as now,Oe as observableFrom,Ne as once,Me as pairwise,ae as safeStorage,ye as tap,Te as throttle,xe as timeout,le as videoHeightToQuality,be as videoQualityToHeight,fe as videoSizeToQuality};
package/index.d.ts CHANGED
@@ -1,159 +1,161 @@
1
1
  declare const VERSION: string;
2
2
 
3
- type IUnsubscriber = () => void;
4
- interface ISubscription {
5
- unsubscribe: IUnsubscriber;
6
- add(item: ISubscription | IUnsubscriber): ISubscription;
7
- }
8
- interface IObservable<T> {
9
- subscribe(listener: IListener<T>, error?: IListener<Error | unknown>): ISubscription;
10
- pipe<T1>(op1: IOperator<T, T1>): IObservable<T1>;
11
- pipe<T1, T2>(op1: IOperator<T, T1>, op2: IOperator<T1, T2>): IObservable<T2>;
12
- pipe<T1, T2, T3>(op1: IOperator<T, T1>, op2: IOperator<T1, T2>, op3: IOperator<T2, T3>): IObservable<T3>;
13
- pipe<T1, T2, T3, T4>(op1: IOperator<T, T1>, op2: IOperator<T1, T2>, op3: IOperator<T2, T3>, op4: IOperator<T3, T4>): IObservable<T4>;
14
- pipe<T1, T2, T3, T4, T5>(op1: IOperator<T, T1>, op2: IOperator<T1, T2>, op3: IOperator<T2, T3>, op4: IOperator<T3, T4>, op5: IOperator<T4, T5>): IObservable<T5>;
15
- }
16
- interface IValue<T> {
17
- getValue(): T;
18
- }
19
- interface IEmitter<T> {
20
- next(value: T): void;
21
- error?(value: Error | unknown): void;
22
- }
23
- interface IValueObservable<T> extends IObservable<T>, IValue<T> {
24
- }
25
- interface ISubject<T> extends IEmitter<T>, IObservable<T> {
26
- }
27
- interface IValueSubject<T> extends IEmitter<T>, IObservable<T>, IValue<T> {
28
- }
29
- type IListener<T> = IEmitter<T> | ((value: T) => void);
30
- type IOperator<TInput, TOutput = TInput> = (input: IObservable<TInput>) => IObservable<TOutput>;
3
+ type IUnsubscriber = () => void;
4
+ interface ISubscription {
5
+ unsubscribe: IUnsubscriber;
6
+ add(item: ISubscription | IUnsubscriber): ISubscription;
7
+ }
8
+ interface IObservable<T> {
9
+ subscribe(listener: IListener<T>, error?: IListener<Error | unknown>): ISubscription;
10
+ pipe<T1>(op1: IOperator<T, T1>): IObservable<T1>;
11
+ pipe<T1, T2>(op1: IOperator<T, T1>, op2: IOperator<T1, T2>): IObservable<T2>;
12
+ pipe<T1, T2, T3>(op1: IOperator<T, T1>, op2: IOperator<T1, T2>, op3: IOperator<T2, T3>): IObservable<T3>;
13
+ pipe<T1, T2, T3, T4>(op1: IOperator<T, T1>, op2: IOperator<T1, T2>, op3: IOperator<T2, T3>, op4: IOperator<T3, T4>): IObservable<T4>;
14
+ pipe<T1, T2, T3, T4, T5>(op1: IOperator<T, T1>, op2: IOperator<T1, T2>, op3: IOperator<T2, T3>, op4: IOperator<T3, T4>, op5: IOperator<T4, T5>): IObservable<T5>;
15
+ }
16
+ interface IValue<T> {
17
+ getValue(): T;
18
+ }
19
+ interface IEmitter<T> {
20
+ next(value: T): void;
21
+ error?(value: Error | unknown): void;
22
+ }
23
+ interface IValueObservable<T> extends IObservable<T>, IValue<T> {
24
+ }
25
+ interface ISubject<T> extends IEmitter<T>, IObservable<T> {
26
+ }
27
+ interface IValueSubject<T> extends IEmitter<T>, IObservable<T>, IValue<T> {
28
+ }
29
+ type IListener<T> = IEmitter<T> | ((value: T) => void);
30
+ type IOperator<TInput, TOutput = TInput> = (input: IObservable<TInput>) => IObservable<TOutput>;
31
31
  type TypeOfObservable<TObservable> = TObservable extends IObservable<infer TType> ? TType : never;
32
32
 
33
- declare class Observable<T> implements IObservable<T> {
34
- constructor(subscribe?: (emitter: IEmitter<T>) => IUnsubscriber | ISubscription | void);
35
- subscribe(listener: IListener<T>, error?: IListener<Error | unknown>): ISubscription;
36
- pipe(...operators: IOperator<unknown, unknown>[]): IObservable<unknown>;
37
- protected _subscribe(_emitter: IEmitter<T>): IUnsubscriber | ISubscription | void;
33
+ declare class Observable<T> implements IObservable<T> {
34
+ constructor(subscribe?: (emitter: IEmitter<T>) => IUnsubscriber | ISubscription | void);
35
+ subscribe(listener: IListener<T>, error?: IListener<Error | unknown>): ISubscription;
36
+ pipe(...operators: IOperator<unknown, unknown>[]): IObservable<unknown>;
37
+ protected _subscribe(_emitter: IEmitter<T>): IUnsubscriber | ISubscription | void;
38
38
  }
39
39
 
40
- declare class Subject<T> extends Observable<T> implements ISubject<T> {
41
- private keyCounter;
42
- private subscribers;
43
- constructor();
44
- next(value: T): void;
45
- error(value: T): void;
46
- protected _subscribe(emitter: IEmitter<T>): IUnsubscriber | ISubscription | void;
40
+ declare class Subject<T> extends Observable<T> implements ISubject<T> {
41
+ private keyCounter;
42
+ private subscribers;
43
+ constructor();
44
+ next(value: T): void;
45
+ error(value: T): void;
46
+ protected _subscribe(emitter: IEmitter<T>): IUnsubscriber | ISubscription | void;
47
47
  }
48
48
 
49
- interface ILogger {
50
- log: (entry: ILogInputEntry) => void;
51
- createCustomLog: <TArgs extends unknown[]>(transform: (...args: TArgs) => ILogInputEntry) => (...args: TArgs) => void;
52
- createComponentLog: (component: string) => IComponentLogger;
53
- getAllLogs: () => ILogEntry[];
54
- log$: IObservable<ILogEntry>;
55
- }
56
- interface ILogEntry {
57
- /**
58
- * Сообщение.
59
- */
60
- message: string;
61
- /**
62
- * Компонент, в котором залогировано событие. (модуль, класс или функция)
63
- */
64
- component: string;
65
- /**
66
- * Время, в которое случилось логируемое событие
67
- */
68
- timestamp: number;
69
- }
70
- type IComponentLogger = (entry: IComponentLogEntry) => void;
71
- type ILogInputEntry = Omit<ILogEntry, 'timestamp'>;
72
- interface IComponentLogEntry extends Omit<ILogInputEntry, 'component'>, IOptionalComponent {
73
- }
74
- interface IOptionalComponent {
75
- component?: ILogInputEntry['component'];
49
+ interface ILogger {
50
+ log: (entry: ILogInputEntry) => void;
51
+ createCustomLog: <TArgs extends unknown[]>(transform: (...args: TArgs) => ILogInputEntry) => (...args: TArgs) => void;
52
+ createComponentLog: (component: string) => IComponentLogger;
53
+ getAllLogs: () => ILogEntry[];
54
+ log$: IObservable<ILogEntry>;
55
+ }
56
+ interface ILogEntry {
57
+ /**
58
+ * Сообщение.
59
+ */
60
+ message: string;
61
+ /**
62
+ * Компонент, в котором залогировано событие. (модуль, класс или функция)
63
+ */
64
+ component: string;
65
+ /**
66
+ * Время, в которое случилось логируемое событие
67
+ */
68
+ timestamp: number;
69
+ }
70
+ type IComponentLogger = (entry: IComponentLogEntry) => void;
71
+ type ILogInputEntry = Omit<ILogEntry, 'timestamp'>;
72
+ interface IComponentLogEntry extends Omit<ILogInputEntry, 'component'>, IOptionalComponent {
73
+ }
74
+ interface IOptionalComponent {
75
+ component?: ILogInputEntry['component'];
76
76
  }
77
77
 
78
- declare class Logger implements ILogger {
79
- log$: Subject<ILogEntry>;
80
- private logs;
81
- log: (inputEntry: ILogInputEntry) => void;
82
- createCustomLog<TArgs extends unknown[]>(transform: (...args: TArgs) => ILogInputEntry): (...args: TArgs) => void;
83
- createComponentLog(component: string): IComponentLogger;
84
- getAllLogs: () => ILogEntry[];
78
+ declare class Logger implements ILogger {
79
+ log$: Subject<ILogEntry>;
80
+ private logs;
81
+ log: (inputEntry: ILogInputEntry) => void;
82
+ createCustomLog<TArgs extends unknown[]>(transform: (...args: TArgs) => ILogInputEntry): (...args: TArgs) => void;
83
+ createComponentLog(component: string): IComponentLogger;
84
+ getAllLogs: () => ILogEntry[];
85
85
  }
86
86
 
87
87
  declare const noop: () => void;
88
88
 
89
- declare const assertNever: (x: never) => never;
89
+ declare const assertNever: (x: never) => never;
90
90
  declare const checkNever: (_x: never) => void;
91
91
 
92
- declare function assertNonNullable<T>(value: T, failMessage?: string): asserts value is NonNullable<T>;
93
- declare function assertNullable<T extends INullable = INullable>(value: unknown, failMessage?: string): asserts value is T;
94
- declare function isNonNullable<T>(value: T): value is NonNullable<T>;
95
- declare function isNullable<T extends INullable = INullable>(value: unknown): value is T;
92
+ declare function assertNonNullable<T>(value: T, failMessage?: string): asserts value is NonNullable<T>;
93
+ declare function assertNullable<T extends INullable = INullable>(value: unknown, failMessage?: string): asserts value is T;
94
+ declare function isNonNullable<T>(value: T): value is NonNullable<T>;
95
+ declare function isNullable<T extends INullable = INullable>(value: unknown): value is T;
96
96
  type INullable = null | undefined;
97
97
 
98
98
  declare const addScript: (scriptSrc: string, abortSignal: AbortSignal, timeout?: number) => Promise<void>;
99
99
 
100
- type Seconds = number;
101
- type Milliseconds = number;
102
- type bps = number;
103
- type Kbps = number;
104
- type Mbps = number;
105
- type Byte = number;
100
+ type Seconds = number;
101
+ type Milliseconds = number;
102
+ type bps = number;
103
+ type Kbps = number;
104
+ type Mbps = number;
105
+ type Byte = number;
106
106
  type Percentage = number;
107
107
 
108
108
  declare const now: () => Milliseconds;
109
109
 
110
- type AbortableDecorator = <Params extends unknown[] = void[], Return = void>(signal: AbortSignal, createGenerator: (...param: Params) => AsyncGenerator<unknown, Return, unknown>) => (...param: Params) => Promise<Return | undefined>;
110
+ type AbortableDecorator = <Params extends unknown[] = void[], Return = void>(signal: AbortSignal, createGenerator: (...param: Params) => AsyncGenerator<unknown, Return, unknown>) => (...param: Params) => Promise<Return | undefined>;
111
111
  declare const abortable: AbortableDecorator;
112
112
 
113
- declare enum CurrentClientBrowser {
114
- Unknown = "Unknown",
115
- Yandex = "Yandex",
116
- Chrome = "Chrome",
117
- Chromium = "Chromium",
118
- Firefox = "Firefox",
119
- Safari = "Safari",
120
- Opera = "Opera",
121
- Edge = "Edge",
122
- Rest = "Rest"
123
- }
124
- declare enum CurrentClientDevice {
125
- Unknown = "Unknown",
126
- Android = "Android",
127
- iPhone = "iPhone",
128
- iPad = "iPad",
129
- iPod = "iPod",
130
- RestMobile = "RestMobile",
131
- Desktop = "Desktop"
132
- }
133
- type ICurrentBrowserInfo = {
134
- browser: CurrentClientBrowser;
135
- device: CurrentClientDevice;
136
- };
113
+ declare enum CurrentClientBrowser {
114
+ Unknown = "Unknown",
115
+ Yandex = "Yandex",
116
+ Chrome = "Chrome",
117
+ Chromium = "Chromium",
118
+ Firefox = "Firefox",
119
+ Safari = "Safari",
120
+ Opera = "Opera",
121
+ Edge = "Edge",
122
+ Rest = "Rest"
123
+ }
124
+ declare enum CurrentClientDevice {
125
+ Unknown = "Unknown",
126
+ Android = "Android",
127
+ iPhone = "iPhone",
128
+ iPad = "iPad",
129
+ iPod = "iPod",
130
+ RestMobile = "RestMobile",
131
+ Desktop = "Desktop"
132
+ }
133
+ type ICurrentBrowserInfo = {
134
+ browser: CurrentClientBrowser;
135
+ device: CurrentClientDevice;
136
+ };
137
137
  declare const getCurrentBrowser: () => ICurrentBrowserInfo;
138
138
 
139
- type ExponentialBackoffConfig = Partial<{
140
- start: Milliseconds;
141
- factor: number;
142
- min: Milliseconds;
143
- max: Milliseconds;
144
- random: number;
145
- }>;
139
+ type ExponentialBackoffConfig = Partial<{
140
+ start: Milliseconds;
141
+ factor: number;
142
+ min: Milliseconds;
143
+ max: Milliseconds;
144
+ random: number;
145
+ }>;
146
146
  declare const getExponentialDelay: (errorsCount: number, { start, factor, max, min, random }?: ExponentialBackoffConfig) => Milliseconds;
147
147
 
148
- declare const get: (key: string) => string | undefined;
149
- declare const set: (key: string, value: string) => void;
150
- declare const has: (key: string) => boolean;
151
- declare const remove: (key: string) => void;
148
+ declare const isPersistent: () => boolean;
149
+ declare const get: (key: string) => string | undefined;
150
+ declare const set: (key: string, value: string) => void;
151
+ declare const has: (key: string) => boolean;
152
+ declare const remove: (key: string) => void;
152
153
  declare const clear: () => void;
153
154
 
154
155
  declare const iframeSafeStorage_d_clear: typeof clear;
155
156
  declare const iframeSafeStorage_d_get: typeof get;
156
157
  declare const iframeSafeStorage_d_has: typeof has;
158
+ declare const iframeSafeStorage_d_isPersistent: typeof isPersistent;
157
159
  declare const iframeSafeStorage_d_remove: typeof remove;
158
160
  declare const iframeSafeStorage_d_set: typeof set;
159
161
  declare namespace iframeSafeStorage_d {
@@ -161,122 +163,137 @@ declare namespace iframeSafeStorage_d {
161
163
  iframeSafeStorage_d_clear as clear,
162
164
  iframeSafeStorage_d_get as get,
163
165
  iframeSafeStorage_d_has as has,
166
+ iframeSafeStorage_d_isPersistent as isPersistent,
164
167
  iframeSafeStorage_d_remove as remove,
165
168
  iframeSafeStorage_d_set as set,
166
169
  };
167
170
  }
168
171
 
169
- declare enum VideoQuality {
170
- INVARIANT = "Invariant quality",
171
- Q_144P = "144p",
172
- Q_240P = "240p",
173
- Q_360P = "360p",
174
- Q_480P = "480p",
175
- Q_720P = "720p",
176
- Q_1080P = "1080p",
177
- Q_1440P = "1440p",
178
- Q_2160P = "2160p",
179
- Q_4320P = "4320p"
180
- }
181
- type ExactVideoQuality = Exclude<VideoQuality, VideoQuality.INVARIANT>;
182
- /**
183
- * Лимиты трактуются включительно
184
- * Значение undefined снимает лимит
185
- */
186
- type QualityLimits = {
187
- max?: ExactVideoQuality;
188
- min?: ExactVideoQuality;
172
+ declare enum VideoQuality {
173
+ INVARIANT = "Invariant quality",
174
+ Q_144P = "144p",
175
+ Q_240P = "240p",
176
+ Q_360P = "360p",
177
+ Q_480P = "480p",
178
+ Q_720P = "720p",
179
+ Q_1080P = "1080p",
180
+ Q_1440P = "1440p",
181
+ Q_2160P = "2160p",
182
+ Q_4320P = "4320p"
183
+ }
184
+ type ExactVideoQuality = Exclude<VideoQuality, VideoQuality.INVARIANT>;
185
+ /**
186
+ * Лимиты трактуются включительно
187
+ * Значение undefined снимает лимит
188
+ */
189
+ type QualityLimits = {
190
+ max?: ExactVideoQuality;
191
+ min?: ExactVideoQuality;
189
192
  };
190
193
 
191
- interface IError {
192
- /**
193
- * Код или другой идентификатор для статистики
194
- */
195
- id: string;
196
- category: ErrorCategory;
197
- /**
198
- * Сообщение по которому можно разобрать что случилось
199
- */
200
- message: string;
201
- /**
202
- * Данные, полезные для отладки
203
- */
204
- data?: any;
205
- /**
206
- * Возникшее исключение
207
- */
208
- thrown?: Error | unknown;
209
- }
210
- declare enum ErrorCategory {
211
- NETWORK = "network",
212
- VIDEO_PIPELINE = "video_pipeline",
213
- EXTERNAL_API = "external_api",
214
- PARSER = "parser",
215
- DOM = "dom",
216
- WTF = "wtf"
217
- }
218
- interface IRange<Unit extends number = number> {
219
- from: Unit;
220
- to: Unit;
221
- }
222
- interface IRectangle<Unit extends number = number> {
223
- width: Unit;
224
- height: Unit;
194
+ interface IError {
195
+ /**
196
+ * Код или другой идентификатор для статистики
197
+ */
198
+ id: string;
199
+ category: ErrorCategory;
200
+ /**
201
+ * Сообщение по которому можно разобрать что случилось
202
+ */
203
+ message: string;
204
+ /**
205
+ * Данные, полезные для отладки
206
+ */
207
+ data?: any;
208
+ /**
209
+ * Возникшее исключение
210
+ */
211
+ thrown?: Error | unknown;
212
+ }
213
+ interface IWarning {
214
+ /**
215
+ * Код или другой идентификатор для статистики
216
+ */
217
+ id: string;
218
+ /**
219
+ * Сообщение по которому можно разобрать что случилось
220
+ */
221
+ message: string;
222
+ /**
223
+ * Данные, полезные для отладки
224
+ */
225
+ data?: any;
226
+ }
227
+ declare enum ErrorCategory {
228
+ NETWORK = "network",
229
+ VIDEO_PIPELINE = "video_pipeline",
230
+ EXTERNAL_API = "external_api",
231
+ PARSER = "parser",
232
+ DOM = "dom",
233
+ WTF = "wtf"
234
+ }
235
+ interface IRange<Unit extends number = number> {
236
+ from: Unit;
237
+ to: Unit;
238
+ }
239
+ interface IRectangle<Unit extends number = number> {
240
+ width: Unit;
241
+ height: Unit;
225
242
  }
226
243
 
227
- declare const isHigher: (a: ExactVideoQuality, b: ExactVideoQuality) => boolean;
228
- declare const isHigherOrEqual: (a: ExactVideoQuality, b: ExactVideoQuality) => boolean;
229
- declare const isLower: (a: ExactVideoQuality, b: ExactVideoQuality) => boolean;
230
- declare const isLowerOrEqual: (a: ExactVideoQuality, b: ExactVideoQuality) => boolean;
231
- declare const getHighestQuality: (qualities: VideoQuality[]) => VideoQuality | undefined;
232
- /**
233
- * Выбирает качество, наиболее близкое к указанной высоте кадра, но не менее её.
234
- * @param tolerance позволяет выбрать качество менее заданной высоты на величину погрешности (в процентах)
235
- */
236
- declare const videoHeightToQuality: (height: number, tolerance?: number) => ExactVideoQuality | undefined;
237
- /**
238
- * Выбирает качество описывающее заданные размеры видео потока, т.е. не меньше его.
239
- */
240
- declare const videoSizeToQuality: ({ width, height }: IRectangle) => ExactVideoQuality | undefined;
241
- declare const videoQualityToHeight: (quality: ExactVideoQuality) => number;
242
- declare const isInvariantQuality: (quality: VideoQuality) => quality is VideoQuality.INVARIANT;
243
- declare const areQualitiesExact: (qualities: VideoQuality[]) => qualities is ExactVideoQuality[];
244
+ declare const isHigher: (a: ExactVideoQuality, b: ExactVideoQuality) => boolean;
245
+ declare const isHigherOrEqual: (a: ExactVideoQuality, b: ExactVideoQuality) => boolean;
246
+ declare const isLower: (a: ExactVideoQuality, b: ExactVideoQuality) => boolean;
247
+ declare const isLowerOrEqual: (a: ExactVideoQuality, b: ExactVideoQuality) => boolean;
248
+ declare const getHighestQuality: (qualities: VideoQuality[]) => VideoQuality | undefined;
249
+ /**
250
+ * Выбирает качество, наиболее близкое к указанной высоте кадра, но не менее её.
251
+ * @param tolerance позволяет выбрать качество менее заданной высоты на величину погрешности (в процентах)
252
+ */
253
+ declare const videoHeightToQuality: (height: number, tolerance?: number) => ExactVideoQuality | undefined;
254
+ /**
255
+ * Выбирает качество описывающее заданные размеры видео потока, т.е. не меньше его.
256
+ */
257
+ declare const videoSizeToQuality: ({ width, height }: IRectangle) => ExactVideoQuality | undefined;
258
+ declare const videoQualityToHeight: (quality: ExactVideoQuality) => number;
259
+ declare const isInvariantQuality: (quality: VideoQuality) => quality is VideoQuality.INVARIANT;
260
+ declare const areQualitiesExact: (qualities: VideoQuality[]) => qualities is ExactVideoQuality[];
244
261
  declare function assertQualityIsExact(quality: VideoQuality): asserts quality is ExactVideoQuality;
245
262
 
246
- declare class Subscription implements ISubscription {
247
- private subscriptions;
248
- unsubscribe(): void;
249
- add(item: ISubscription | IUnsubscriber): ISubscription;
263
+ declare class Subscription implements ISubscription {
264
+ private subscriptions;
265
+ unsubscribe(): void;
266
+ add(item: ISubscription | IUnsubscriber): ISubscription;
250
267
  }
251
268
 
252
- declare class ValueSubject<T> extends Subject<T> implements IValueSubject<T> {
253
- private value;
254
- constructor(initialValue: T);
255
- next(value: T): void;
256
- error(value: T): void;
257
- getValue(): T;
258
- protected _subscribe(emitter: IEmitter<T>): IUnsubscriber | ISubscription | void;
269
+ declare class ValueSubject<T> extends Subject<T> implements IValueSubject<T> {
270
+ private value;
271
+ constructor(initialValue: T);
272
+ next(value: T): void;
273
+ error(value: T): void;
274
+ getValue(): T;
275
+ protected _subscribe(emitter: IEmitter<T>): IUnsubscriber | ISubscription | void;
259
276
  }
260
277
 
261
- /**
262
- * Создаёт Observable, который состоит из объектов, ключами которых являются последние значения исходных Observable.
263
- * Первое событие возникает тогда, когда каждый исходный Observable выдал хотя бы одно значение.
264
- */
265
- type CombineObservables<T extends Record<string, IObservable<unknown>>> = {
266
- [key in keyof T]: TypeOfObservable<T[key]>;
267
- };
278
+ /**
279
+ * Создаёт Observable, который состоит из объектов, ключами которых являются последние значения исходных Observable.
280
+ * Первое событие возникает тогда, когда каждый исходный Observable выдал хотя бы одно значение.
281
+ */
282
+ type CombineObservables<T extends Record<string, IObservable<unknown>>> = {
283
+ [key in keyof T]: TypeOfObservable<T[key]>;
284
+ };
268
285
  declare function combine<T extends Record<string, IObservable<unknown>>>(observables: T): IObservable<CombineObservables<T>>;
269
286
 
270
- declare function merge<T1, T2>(v1: IObservable<T1>, v2: IObservable<T2>): IObservable<T1 | T2>;
271
- declare function merge<T1, T2, T3>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>): IObservable<T1 | T2 | T3>;
272
- declare function merge<T1, T2, T3, T4>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>): IObservable<T1 | T2 | T3 | T4>;
273
- declare function merge<T1, T2, T3, T4, T5>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>): IObservable<T1 | T2 | T3 | T4 | T5>;
274
- declare function merge<T1, T2, T3, T4, T5, T6>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>): IObservable<T1 | T2 | T3 | T4 | T5 | T6>;
275
- declare function merge<T1, T2, T3, T4, T5, T6>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>): IObservable<T1 | T2 | T3 | T4 | T5 | T6>;
276
- declare function merge<T1, T2, T3, T4, T5, T6, T7>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>, v7: IObservable<T7>): IObservable<T1 | T2 | T3 | T4 | T5 | T6 | T7>;
277
- declare function merge<T1, T2, T3, T4, T5, T6, T7, T8>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>, v7: IObservable<T7>, v8: IObservable<T8>): IObservable<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8>;
278
- declare function merge<T1, T2, T3, T4, T5, T6, T7, T8, T9>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>, v7: IObservable<T7>, v8: IObservable<T8>, v9: IObservable<T9>): IObservable<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9>;
279
- declare function merge<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>, v7: IObservable<T7>, v8: IObservable<T8>, v9: IObservable<T9>, v10: IObservable<T10>): IObservable<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10>;
287
+ declare function merge<T1, T2>(v1: IObservable<T1>, v2: IObservable<T2>): IObservable<T1 | T2>;
288
+ declare function merge<T1, T2, T3>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>): IObservable<T1 | T2 | T3>;
289
+ declare function merge<T1, T2, T3, T4>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>): IObservable<T1 | T2 | T3 | T4>;
290
+ declare function merge<T1, T2, T3, T4, T5>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>): IObservable<T1 | T2 | T3 | T4 | T5>;
291
+ declare function merge<T1, T2, T3, T4, T5, T6>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>): IObservable<T1 | T2 | T3 | T4 | T5 | T6>;
292
+ declare function merge<T1, T2, T3, T4, T5, T6>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>): IObservable<T1 | T2 | T3 | T4 | T5 | T6>;
293
+ declare function merge<T1, T2, T3, T4, T5, T6, T7>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>, v7: IObservable<T7>): IObservable<T1 | T2 | T3 | T4 | T5 | T6 | T7>;
294
+ declare function merge<T1, T2, T3, T4, T5, T6, T7, T8>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>, v7: IObservable<T7>, v8: IObservable<T8>): IObservable<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8>;
295
+ declare function merge<T1, T2, T3, T4, T5, T6, T7, T8, T9>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>, v7: IObservable<T7>, v8: IObservable<T8>, v9: IObservable<T9>): IObservable<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9>;
296
+ declare function merge<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>, v7: IObservable<T7>, v8: IObservable<T8>, v9: IObservable<T9>, v10: IObservable<T10>): IObservable<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10>;
280
297
  declare function merge<R>(...observables: IObservable<unknown>[]): IObservable<R>;
281
298
 
282
299
  declare const _default$3: (time: Milliseconds) => IObservable<void>;
@@ -285,46 +302,46 @@ declare const _default$2: (time: Milliseconds) => IObservable<void>;
285
302
 
286
303
  declare const _default$1: <T>(values: T[]) => IObservable<T>;
287
304
 
288
- interface IEventTarget {
289
- addEventListener(type: string, handler: (...params: any[]) => void): void;
290
- removeEventListener(type: string, handler: (...params: any[]) => void): void;
291
- }
305
+ interface IEventTarget {
306
+ addEventListener(type: string, handler: (...params: any[]) => void): void;
307
+ removeEventListener(type: string, handler: (...params: any[]) => void): void;
308
+ }
292
309
  declare const _default: <T>(target: IEventTarget, eventName: string) => IObservable<T>;
293
310
 
294
311
  declare function buffer<T>(size: number): IOperator<T, T[]>;
295
312
 
296
- declare function debounce<T>(time: Milliseconds, config?: {
297
- leading: boolean;
298
- trailing: boolean;
313
+ declare function debounce<T>(time: Milliseconds, config?: {
314
+ leading: boolean;
315
+ trailing: boolean;
299
316
  }): IOperator<T>;
300
317
 
301
- declare function throttle<T>(time: number, config?: {
302
- leading: boolean;
303
- trailing: boolean;
318
+ declare function throttle<T>(time: number, config?: {
319
+ leading: boolean;
320
+ trailing: boolean;
304
321
  }): IOperator<T>;
305
322
 
306
- declare function filter<T, S extends T>(predicate: (value: T) => value is S): IOperator<T, S>;
323
+ declare function filter<T, S extends T>(predicate: (value: T) => value is S): IOperator<T, S>;
307
324
  declare function filter<T>(predicate: (value: T) => boolean): IOperator<T>;
308
325
 
309
- /**
310
- * Пропускает только события, содержащие значения, отличные от предыдущего
311
- */
326
+ /**
327
+ * Пропускает только события, содержащие значения, отличные от предыдущего
328
+ */
312
329
  declare function filterChanged<T>(equal?: (prev: T, next: T) => boolean): IOperator<T>;
313
330
 
314
331
  declare function map<T, S>(mapper: (value: T) => S): IOperator<T, S>;
315
332
 
316
333
  declare function mapTo<T, S>(value: S): IOperator<T, S>;
317
334
 
318
- /**
319
- * Отписывается от исходного потока после получения первого события.
320
- */
335
+ /**
336
+ * Отписывается от исходного потока после получения первого события.
337
+ */
321
338
  declare function once<T>(): IOperator<T>;
322
339
 
323
- type IPair<T> = [previous: T, current: T];
340
+ type IPair<T> = [previous: T, current: T];
324
341
  declare function pairwise<T>(): IOperator<T, IPair<T>>;
325
342
 
326
343
  declare function tap<T>(effect: (value: T) => void): IOperator<T>;
327
344
 
328
345
  declare const ACTIVE_LIVE_VALID_DELAY = 5;
329
346
 
330
- export { ACTIVE_LIVE_VALID_DELAY, Byte, CurrentClientBrowser, CurrentClientDevice, ErrorCategory, ExactVideoQuality, ExponentialBackoffConfig, IComponentLogEntry, IComponentLogger, ICurrentBrowserInfo, IEmitter, IError, IListener, ILogEntry, ILogInputEntry, ILogger, IObservable, IOperator, IRange, IRectangle, ISubject, ISubscription, IUnsubscriber, IValue, IValueObservable, IValueSubject, Kbps, Logger, Mbps, Milliseconds, Observable, Percentage, QualityLimits, Seconds, Subject, Subscription, VERSION, ValueSubject, VideoQuality, abortable, addScript, areQualitiesExact, assertNever, assertNonNullable, assertNullable, assertQualityIsExact, bps, buffer, checkNever, combine, debounce, filter, filterChanged, _default as fromEvent, getCurrentBrowser, getExponentialDelay, getHighestQuality, _default$2 as interval, isHigher, isHigherOrEqual, isInvariantQuality, isLower, isLowerOrEqual, isNonNullable, isNullable, map, mapTo, merge, noop, now, _default$1 as observableFrom, once, pairwise, iframeSafeStorage_d as safeStorage, tap, throttle, _default$3 as timeout, videoHeightToQuality, videoQualityToHeight, videoSizeToQuality };
347
+ export { ACTIVE_LIVE_VALID_DELAY, Byte, CurrentClientBrowser, CurrentClientDevice, ErrorCategory, ExactVideoQuality, ExponentialBackoffConfig, IComponentLogEntry, IComponentLogger, ICurrentBrowserInfo, IEmitter, IError, IListener, ILogEntry, ILogInputEntry, ILogger, IObservable, IOperator, IRange, IRectangle, ISubject, ISubscription, IUnsubscriber, IValue, IValueObservable, IValueSubject, IWarning, Kbps, Logger, Mbps, Milliseconds, Observable, Percentage, QualityLimits, Seconds, Subject, Subscription, VERSION, ValueSubject, VideoQuality, abortable, addScript, areQualitiesExact, assertNever, assertNonNullable, assertNullable, assertQualityIsExact, bps, buffer, checkNever, combine, debounce, filter, filterChanged, _default as fromEvent, getCurrentBrowser, getExponentialDelay, getHighestQuality, _default$2 as interval, isHigher, isHigherOrEqual, isInvariantQuality, isLower, isLowerOrEqual, isNonNullable, isNullable, map, mapTo, merge, noop, now, _default$1 as observableFrom, once, pairwise, iframeSafeStorage_d as safeStorage, tap, throttle, _default$3 as timeout, videoHeightToQuality, videoQualityToHeight, videoSizeToQuality };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer-shared",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "author": "vk.com",
5
5
  "description": "Shared code for vk.com videoplayer",
6
6
  "homepage": "https://vk.com",