@vkontakte/videoplayer-shared 1.0.11 → 1.0.13-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es2015.cjs.js +4 -4
- package/es2015.esm.js +4 -4
- package/es2018.cjs.js +4 -4
- package/es2018.esm.js +4 -4
- package/esnext.cjs.js +4 -4
- package/esnext.esm.js +4 -4
- package/package.json +1 -1
- package/utils/abortable.d.ts +3 -0
- package/utils/index.d.ts +1 -0
package/es2015.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.
|
|
3
|
-
*
|
|
4
|
-
* https://st.mycdn.me/static/playersdk/1-0-
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.13-beta.0
|
|
3
|
+
* Thu, 14 Jul 2022 09:56:30 GMT
|
|
4
|
+
* https://st.mycdn.me/static/playersdk/1-0-13/doc/
|
|
5
5
|
*/
|
|
6
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:!0});class t{constructor(){this.subscriptions=[]}unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach((t=>'function'==typeof t?t():t.unsubscribe()))}add(t){return this.subscriptions.push(t),this}}const e=t=>{throw new Error(`${t} is value of unexpected type`)},r=()=>{};class s{constructor(t){t&&(this._subscribe=t)}subscribe(s,n){let i;i=n?'function'==typeof n?{next:n,error:r}:{next:t=>n.next(t),error:t=>{var e;return null===(e=n.error)||void 0===e?void 0:e.call(n,t)}}:{next:r,error:r};const o='function'==typeof s?{next:t=>{try{s(t)}catch(t){i.next(t)}},error:t=>i.next(t)}:{next:t=>s.next(t),error:t=>s.error?s.error(t):i.next(t)},c=this._subscribe(o);return(new t).add((()=>{switch(o.next=r,o.error=r,typeof c){case'function':return void c();case'object':return void c.unsubscribe();case'undefined':return;default:return e(c)}}))}pipe(...t){return t.reduce(((t,e)=>e(t)),this)}_subscribe(t){}}class n extends s{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(t){this.subscribers.forEach((e=>e.next(t)))}error(t){this.subscribers.forEach((e=>{var r;return null===(r=e.error)||void 0===r?void 0:r.call(e,t)}))}_subscribe(e){const r=this.keyCounter++;return this.subscribers.set(r,e),(new t).add((()=>this.subscribers.delete(r)))}}function i(t){return null!=t}function o(t){return null==t}var c;const u='function'==typeof(null===(c=window.performance)||void 0===c?void 0:c.now)?()=>window.performance.now():()=>Date.now();
|
|
6
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:!0});class t{constructor(){this.subscriptions=[]}unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach((t=>'function'==typeof t?t():t.unsubscribe()))}add(t){return this.subscriptions.push(t),this}}const e=t=>{throw new Error(`${t} is value of unexpected type`)},r=()=>{};class s{constructor(t){t&&(this._subscribe=t)}subscribe(s,n){let i;i=n?'function'==typeof n?{next:n,error:r}:{next:t=>n.next(t),error:t=>{var e;return null===(e=n.error)||void 0===e?void 0:e.call(n,t)}}:{next:r,error:r};const o='function'==typeof s?{next:t=>{try{s(t)}catch(t){i.next(t)}},error:t=>i.next(t)}:{next:t=>s.next(t),error:t=>s.error?s.error(t):i.next(t)},c=this._subscribe(o);return(new t).add((()=>{switch(o.next=r,o.error=r,typeof c){case'function':return void c();case'object':return void c.unsubscribe();case'undefined':return;default:return e(c)}}))}pipe(...t){return t.reduce(((t,e)=>e(t)),this)}_subscribe(t){}}class n extends s{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(t){this.subscribers.forEach((e=>e.next(t)))}error(t){this.subscribers.forEach((e=>{var r;return null===(r=e.error)||void 0===r?void 0:r.call(e,t)}))}_subscribe(e){const r=this.keyCounter++;return this.subscribers.set(r,e),(new t).add((()=>this.subscribers.delete(r)))}}function i(t){return null!=t}function o(t){return null==t}var c;const u='function'==typeof(null===(c=window.performance)||void 0===c?void 0:c.now)?()=>window.performance.now():()=>Date.now();function a(t,e,r,s){return new(r||(r=Promise))((function(n,i){function o(t){try{u(s.next(t))}catch(t){i(t)}}function c(t){try{u(s.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,c)}u((s=s.apply(t,e||[])).next())}))}const l={leading:!1,trailing:!0};class h{constructor(t,e,r){this.destination=t,this.time=e,this.config=r}next(t){this.lastValue=t,i(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(t){if(!this.destination.error)throw t;this.destination.error(t)}this.timeout=void 0}),this.time)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}const d={leading:!0,trailing:!1};class b{constructor(t,e,r){this.destination=t,this.time=e,this.config=r}next(t){this.lastValue=t,o(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 e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}class p{constructor(t,e){this.destination=t,this.predicate=e}next(t){let e;try{e=this.predicate(t)}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}const x={};class w{constructor(t,e){this.destination=t,this.predicate=e,this.lastValue=x}next(t){let e;try{e=this.lastValue===x||!this.predicate(this.lastValue,t),this.lastValue=t}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function v(t){return e=>new s((r=>e.subscribe(new f(r,t))))}class f{constructor(t,e){this.destination=t,this.mapper=e}next(t){let e;try{e=this.mapper(t)}catch(t){throw this.error(t),t}this.destination.next(e)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}class m{constructor(t){this.destination=t,this.hasLast=!1}next(t){const e=this.last;this.last=t,this.hasLast?this.destination.next([e,t]):this.hasLast=!0}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}class g{constructor(t,e){this.destination=t,this.effect=e}next(t){try{this.effect(t)}catch(t){throw this.error(t),t}this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}exports.Logger=class{constructor(){this.log$=new n,this.logs=[],this.log=t=>{const e=Object.assign(Object.assign({},t),{timestamp:Date.now()});this.logs.push(e),this.log$.next(e)},this.getAllLogs=()=>this.logs}createCustomLog(t){return(...e)=>{let r;try{r=t(...e)}catch(t){r={message:'error in `createCustomLog`',component:'Logger'}}this.log(r)}}createComponentLog(t){return this.createCustomLog((e=>Object.assign({component:t},e)))}},exports.Observable=s,exports.Subject=n,exports.Subscription=t,exports.ValueSubject=class extends n{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 e=super._subscribe(t);return t.next(this.value),e}},exports.abortable=(t,e)=>(...r)=>a(void 0,void 0,void 0,(function*(){var s;const n=e(...r);let i,o=t.aborted;for(;!o&&!t.aborted;){const t=yield n.next(i);o=null!==(s=t.done)&&void 0!==s&&s,i=t.value}return i})),exports.addScript=(t,e,r)=>new Promise(((s,n)=>{e.addEventListener('abort',(()=>{c(),a.remove()}));const i=()=>{c(),n()},o=()=>{c(),s()},c=()=>{u&&clearTimeout(u),a.removeEventListener('load',o),a.removeEventListener('error',i)};let u;r&&(u=window.setTimeout(i,r));const a=document.createElement('script');a.addEventListener('load',o),a.addEventListener('error',i),a.src=t,document.head.appendChild(a)})),exports.assertNever=e,exports.assertNonNullable=function(t,e='Assertion "value is not nullable" failed'){if(null==t)throw new Error(e)},exports.assertNullable=function(t,e='Assertion "value is nullable" failed'){if(null!=t)throw new Error(e)},exports.checkNever=t=>{},exports.combine=function(e){return new s((r=>{const s={};let n=Object.keys(e).length;return Object.entries(e).reduce(((t,[e,i])=>t.add(i.subscribe((t=>e=>{t in s||n--,s[t]=e,0===n&&r.next(s)})(e)))),new t)}))},exports.debounce=function(t,e=l){return r=>new s((s=>r.subscribe(new h(s,t,e))))},exports.filter=function(t){return e=>new s((r=>e.subscribe(new p(r,t))))},exports.filterChanged=function(t=((t,e)=>t===e)){return e=>new s((r=>e.subscribe(new w(r,t))))},exports.fromEvent=(t,e)=>new s((r=>{const s=t=>r.next(t);return t.addEventListener(e,s),()=>t.removeEventListener(e,s)})),exports.interval=t=>new s((e=>{const r=window.setInterval((()=>e.next()),t);return()=>window.clearInterval(r)})),exports.isNonNullable=i,exports.isNullable=o,exports.map=v,exports.mapTo=function(t){return v((()=>t))},exports.merge=function(...e){return new s((r=>e.reduce(((t,e)=>t.add(e.subscribe(r))),new t)))},exports.noop=r,exports.now=u,exports.observableFrom=t=>new s((e=>{t.forEach((t=>e.next(t)))})),exports.once=function(){return t=>new s((e=>{let r=!1,s=!1;const n=t.subscribe((t=>{r||(r=!0,e.next(t)),s&&n.unsubscribe()}),(t=>{var i;r=!0,null===(i=e.error)||void 0===i||i.call(e,t),s&&n.unsubscribe()}));return s=!0,r&&n.unsubscribe(),n}))},exports.pairwise=function(){return t=>new s((e=>t.subscribe(new m(e))))},exports.tap=function(t){return e=>new s((r=>e.subscribe(new g(r,t))))},exports.throttle=function(t,e=d){return r=>new s((s=>r.subscribe(new b(s,t,e))))},exports.timeout=t=>new s((e=>{const r=window.setTimeout((()=>e.next()),t);return()=>window.clearTimeout(r)}));
|
package/es2015.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.
|
|
3
|
-
*
|
|
4
|
-
* https://st.mycdn.me/static/playersdk/1-0-
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.13-beta.0
|
|
3
|
+
* Thu, 14 Jul 2022 09:56:30 GMT
|
|
4
|
+
* https://st.mycdn.me/static/playersdk/1-0-13/doc/
|
|
5
5
|
*/
|
|
6
|
-
class t{constructor(){this.subscriptions=[]}unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach((t=>'function'==typeof t?t():t.unsubscribe()))}add(t){return this.subscriptions.push(t),this}}const e=t=>{throw new Error(`${t} is value of unexpected type`)},
|
|
6
|
+
class t{constructor(){this.subscriptions=[]}unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach((t=>'function'==typeof t?t():t.unsubscribe()))}add(t){return this.subscriptions.push(t),this}}const e=t=>{throw new Error(`${t} is value of unexpected type`)},n=t=>{},r=()=>{};class s{constructor(t){t&&(this._subscribe=t)}subscribe(n,s){let i;i=s?'function'==typeof s?{next:s,error:r}:{next:t=>s.next(t),error:t=>{var e;return null===(e=s.error)||void 0===e?void 0:e.call(s,t)}}:{next:r,error:r};const o='function'==typeof n?{next:t=>{try{n(t)}catch(t){i.next(t)}},error:t=>i.next(t)}:{next:t=>n.next(t),error:t=>n.error?n.error(t):i.next(t)},c=this._subscribe(o);return(new t).add((()=>{switch(o.next=r,o.error=r,typeof c){case'function':return void c();case'object':return void c.unsubscribe();case'undefined':return;default:return e(c)}}))}pipe(...t){return t.reduce(((t,e)=>e(t)),this)}_subscribe(t){}}class i extends s{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(t){this.subscribers.forEach((e=>e.next(t)))}error(t){this.subscribers.forEach((e=>{var n;return null===(n=e.error)||void 0===n?void 0:n.call(e,t)}))}_subscribe(e){const n=this.keyCounter++;return this.subscribers.set(n,e),(new t).add((()=>this.subscribers.delete(n)))}}class o{constructor(){this.log$=new i,this.logs=[],this.log=t=>{const e=Object.assign(Object.assign({},t),{timestamp:Date.now()});this.logs.push(e),this.log$.next(e)},this.getAllLogs=()=>this.logs}createCustomLog(t){return(...e)=>{let n;try{n=t(...e)}catch(t){n={message:'error in `createCustomLog`',component:'Logger'}}this.log(n)}}createComponentLog(t){return this.createCustomLog((e=>Object.assign({component:t},e)))}}function c(t,e='Assertion "value is not nullable" failed'){if(null==t)throw new Error(e)}function u(t,e='Assertion "value is nullable" failed'){if(null!=t)throw new Error(e)}function a(t){return null!=t}function l(t){return null==t}const h=(t,e,n)=>new Promise(((r,s)=>{e.addEventListener('abort',(()=>{c(),a.remove()}));const i=()=>{c(),s()},o=()=>{c(),r()},c=()=>{u&&clearTimeout(u),a.removeEventListener('load',o),a.removeEventListener('error',i)};let u;n&&(u=window.setTimeout(i,n));const a=document.createElement('script');a.addEventListener('load',o),a.addEventListener('error',i),a.src=t,document.head.appendChild(a)}));var d;const b='function'==typeof(null===(d=window.performance)||void 0===d?void 0:d.now)?()=>window.performance.now():()=>Date.now();function w(t,e,n,r){return new(n||(n=Promise))((function(s,i){function o(t){try{u(r.next(t))}catch(t){i(t)}}function c(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,c)}u((r=r.apply(t,e||[])).next())}))}const v=(t,e)=>(...n)=>w(void 0,void 0,void 0,(function*(){var r;const s=e(...n);let i,o=t.aborted;for(;!o&&!t.aborted;){const t=yield s.next(i);o=null!==(r=t.done)&&void 0!==r&&r,i=t.value}return i}));class f 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 e=super._subscribe(t);return t.next(this.value),e}}function x(e){return new s((n=>{const r={};let s=Object.keys(e).length;return Object.entries(e).reduce(((t,[e,i])=>t.add(i.subscribe((t=>e=>{t in r||s--,r[t]=e,0===s&&n.next(r)})(e)))),new t)}))}function p(...e){return new s((n=>e.reduce(((t,e)=>t.add(e.subscribe(n))),new t)))}var m=t=>new s((e=>{const n=window.setTimeout((()=>e.next()),t);return()=>window.clearTimeout(n)})),g=t=>new s((e=>{const n=window.setInterval((()=>e.next()),t);return()=>window.clearInterval(n)})),y=t=>new s((e=>{t.forEach((t=>e.next(t)))})),L=(t,e)=>new s((n=>{const r=t=>n.next(t);return t.addEventListener(e,r),()=>t.removeEventListener(e,r)}));const E={leading:!1,trailing:!0};function V(t,e=E){return n=>new s((r=>n.subscribe(new C(r,t,e))))}class C{constructor(t,e,n){this.destination=t,this.time=e,this.config=n}next(t){this.lastValue=t,a(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(t){if(!this.destination.error)throw t;this.destination.error(t)}this.timeout=void 0}),this.time)}error(t){var e,n;null===(n=(e=this.destination).error)||void 0===n||n.call(e,t)}}const T={leading:!0,trailing:!1};function j(t,e=T){return n=>new s((r=>n.subscribe(new _(r,t,e))))}class _{constructor(t,e,n){this.destination=t,this.time=e,this.config=n}next(t){this.lastValue=t,l(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 e,n;null===(n=(e=this.destination).error)||void 0===n||n.call(e,t)}}function O(t){return e=>new s((n=>e.subscribe(new k(n,t))))}class k{constructor(t,e){this.destination=t,this.predicate=e}next(t){let e;try{e=this.predicate(t)}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){var e,n;null===(n=(e=this.destination).error)||void 0===n||n.call(e,t)}}function A(t=((t,e)=>t===e)){return e=>new s((n=>e.subscribe(new D(n,t))))}const $={};class D{constructor(t,e){this.destination=t,this.predicate=e,this.lastValue=$}next(t){let e;try{e=this.lastValue===$||!this.predicate(this.lastValue,t),this.lastValue=t}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){var e,n;null===(n=(e=this.destination).error)||void 0===n||n.call(e,t)}}function I(t){return e=>new s((n=>e.subscribe(new P(n,t))))}class P{constructor(t,e){this.destination=t,this.mapper=e}next(t){let e;try{e=this.mapper(t)}catch(t){throw this.error(t),t}this.destination.next(e)}error(t){var e,n;null===(n=(e=this.destination).error)||void 0===n||n.call(e,t)}}function M(t){return I((()=>t))}function q(){return t=>new s((e=>{let n=!1,r=!1;const s=t.subscribe((t=>{n||(n=!0,e.next(t)),r&&s.unsubscribe()}),(t=>{var i;n=!0,null===(i=e.error)||void 0===i||i.call(e,t),r&&s.unsubscribe()}));return r=!0,n&&s.unsubscribe(),s}))}function z(){return t=>new s((e=>t.subscribe(new B(e))))}class B{constructor(t){this.destination=t,this.hasLast=!1}next(t){const e=this.last;this.last=t,this.hasLast?this.destination.next([e,t]):this.hasLast=!0}error(t){var e,n;null===(n=(e=this.destination).error)||void 0===n||n.call(e,t)}}function F(t){return e=>new s((n=>e.subscribe(new G(n,t))))}class G{constructor(t,e){this.destination=t,this.effect=e}next(t){try{this.effect(t)}catch(t){throw this.error(t),t}this.destination.next(t)}error(t){var e,n;null===(n=(e=this.destination).error)||void 0===n||n.call(e,t)}}export{o as Logger,s as Observable,i as Subject,t as Subscription,f as ValueSubject,v as abortable,h as addScript,e as assertNever,c as assertNonNullable,u as assertNullable,n as checkNever,x as combine,V as debounce,O as filter,A as filterChanged,L as fromEvent,g as interval,a as isNonNullable,l as isNullable,I as map,M as mapTo,p as merge,r as noop,b as now,y as observableFrom,q as once,z as pairwise,F as tap,j as throttle,m as timeout};
|
package/es2018.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.
|
|
3
|
-
*
|
|
4
|
-
* https://st.mycdn.me/static/playersdk/1-0-
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.13-beta.0
|
|
3
|
+
* Thu, 14 Jul 2022 09:56:30 GMT
|
|
4
|
+
* https://st.mycdn.me/static/playersdk/1-0-13/doc/
|
|
5
5
|
*/
|
|
6
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:!0});class t{constructor(){this.subscriptions=[]}unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach((t=>'function'==typeof t?t():t.unsubscribe()))}add(t){return this.subscriptions.push(t),this}}const e=t=>{throw new Error(`${t} is value of unexpected type`)},r=()=>{};class s{constructor(t){t&&(this._subscribe=t)}subscribe(s,n){let i;i=n?'function'==typeof n?{next:n,error:r}:{next:t=>n.next(t),error:t=>{var e;return null===(e=n.error)||void 0===e?void 0:e.call(n,t)}}:{next:r,error:r};const o='function'==typeof s?{next:t=>{try{s(t)}catch(t){i.next(t)}},error:t=>i.next(t)}:{next:t=>s.next(t),error:t=>s.error?s.error(t):i.next(t)},c=this._subscribe(o);return(new t).add((()=>{switch(o.next=r,o.error=r,typeof c){case'function':return void c();case'object':return void c.unsubscribe();case'undefined':return;default:return e(c)}}))}pipe(...t){return t.reduce(((t,e)=>e(t)),this)}_subscribe(t){}}class n extends s{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(t){this.subscribers.forEach((e=>e.next(t)))}error(t){this.subscribers.forEach((e=>{var r;return null===(r=e.error)||void 0===r?void 0:r.call(e,t)}))}_subscribe(e){const r=this.keyCounter++;return this.subscribers.set(r,e),(new t).add((()=>this.subscribers.delete(r)))}}function i(t){return null!=t}function o(t){return null==t}var c;const u='function'==typeof(null===(c=window.performance)||void 0===c?void 0:c.now)?()=>window.performance.now():()=>Date.now();const a={leading:!1,trailing:!0};class l{constructor(t,e,r){this.destination=t,this.time=e,this.config=r}next(t){this.lastValue=t,i(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout((()=>{this.config.trailing
|
|
6
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:!0});class t{constructor(){this.subscriptions=[]}unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach((t=>'function'==typeof t?t():t.unsubscribe()))}add(t){return this.subscriptions.push(t),this}}const e=t=>{throw new Error(`${t} is value of unexpected type`)},r=()=>{};class s{constructor(t){t&&(this._subscribe=t)}subscribe(s,n){let i;i=n?'function'==typeof n?{next:n,error:r}:{next:t=>n.next(t),error:t=>{var e;return null===(e=n.error)||void 0===e?void 0:e.call(n,t)}}:{next:r,error:r};const o='function'==typeof s?{next:t=>{try{s(t)}catch(t){i.next(t)}},error:t=>i.next(t)}:{next:t=>s.next(t),error:t=>s.error?s.error(t):i.next(t)},c=this._subscribe(o);return(new t).add((()=>{switch(o.next=r,o.error=r,typeof c){case'function':return void c();case'object':return void c.unsubscribe();case'undefined':return;default:return e(c)}}))}pipe(...t){return t.reduce(((t,e)=>e(t)),this)}_subscribe(t){}}class n extends s{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(t){this.subscribers.forEach((e=>e.next(t)))}error(t){this.subscribers.forEach((e=>{var r;return null===(r=e.error)||void 0===r?void 0:r.call(e,t)}))}_subscribe(e){const r=this.keyCounter++;return this.subscribers.set(r,e),(new t).add((()=>this.subscribers.delete(r)))}}function i(t){return null!=t}function o(t){return null==t}var c;const u='function'==typeof(null===(c=window.performance)||void 0===c?void 0:c.now)?()=>window.performance.now():()=>Date.now();const a={leading:!1,trailing:!0};class l{constructor(t,e,r){this.destination=t,this.time=e,this.config=r}next(t){this.lastValue=t,i(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(t){if(!this.destination.error)throw t;this.destination.error(t)}this.timeout=void 0}),this.time)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}const h={leading:!0,trailing:!1};class d{constructor(t,e,r){this.destination=t,this.time=e,this.config=r}next(t){this.lastValue=t,o(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 e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}class b{constructor(t,e){this.destination=t,this.predicate=e}next(t){let e;try{e=this.predicate(t)}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}const p={};class x{constructor(t,e){this.destination=t,this.predicate=e,this.lastValue=p}next(t){let e;try{e=this.lastValue===p||!this.predicate(this.lastValue,t),this.lastValue=t}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function w(t){return e=>new s((r=>e.subscribe(new v(r,t))))}class v{constructor(t,e){this.destination=t,this.mapper=e}next(t){let e;try{e=this.mapper(t)}catch(t){throw this.error(t),t}this.destination.next(e)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}class f{constructor(t){this.destination=t,this.hasLast=!1}next(t){const e=this.last;this.last=t,this.hasLast?this.destination.next([e,t]):this.hasLast=!0}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}class m{constructor(t,e){this.destination=t,this.effect=e}next(t){try{this.effect(t)}catch(t){throw this.error(t),t}this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}exports.Logger=class{constructor(){this.log$=new n,this.logs=[],this.log=t=>{const e={...t,timestamp:Date.now()};this.logs.push(e),this.log$.next(e)},this.getAllLogs=()=>this.logs}createCustomLog(t){return(...e)=>{let r;try{r=t(...e)}catch(t){r={message:'error in `createCustomLog`',component:'Logger'}}this.log(r)}}createComponentLog(t){return this.createCustomLog((e=>({component:t,...e})))}},exports.Observable=s,exports.Subject=n,exports.Subscription=t,exports.ValueSubject=class extends n{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 e=super._subscribe(t);return t.next(this.value),e}},exports.abortable=(t,e)=>async(...r)=>{var s;const n=e(...r);let i,o=t.aborted;for(;!o&&!t.aborted;){const t=await n.next(i);o=null!==(s=t.done)&&void 0!==s&&s,i=t.value}return i},exports.addScript=(t,e,r)=>new Promise(((s,n)=>{e.addEventListener('abort',(()=>{c(),a.remove()}));const i=()=>{c(),n()},o=()=>{c(),s()},c=()=>{u&&clearTimeout(u),a.removeEventListener('load',o),a.removeEventListener('error',i)};let u;r&&(u=window.setTimeout(i,r));const a=document.createElement('script');a.addEventListener('load',o),a.addEventListener('error',i),a.src=t,document.head.appendChild(a)})),exports.assertNever=e,exports.assertNonNullable=function(t,e='Assertion "value is not nullable" failed'){if(null==t)throw new Error(e)},exports.assertNullable=function(t,e='Assertion "value is nullable" failed'){if(null!=t)throw new Error(e)},exports.checkNever=t=>{},exports.combine=function(e){return new s((r=>{const s={};let n=Object.keys(e).length;return Object.entries(e).reduce(((t,[e,i])=>t.add(i.subscribe((t=>e=>{t in s||n--,s[t]=e,0===n&&r.next(s)})(e)))),new t)}))},exports.debounce=function(t,e=a){return r=>new s((s=>r.subscribe(new l(s,t,e))))},exports.filter=function(t){return e=>new s((r=>e.subscribe(new b(r,t))))},exports.filterChanged=function(t=((t,e)=>t===e)){return e=>new s((r=>e.subscribe(new x(r,t))))},exports.fromEvent=(t,e)=>new s((r=>{const s=t=>r.next(t);return t.addEventListener(e,s),()=>t.removeEventListener(e,s)})),exports.interval=t=>new s((e=>{const r=window.setInterval((()=>e.next()),t);return()=>window.clearInterval(r)})),exports.isNonNullable=i,exports.isNullable=o,exports.map=w,exports.mapTo=function(t){return w((()=>t))},exports.merge=function(...e){return new s((r=>e.reduce(((t,e)=>t.add(e.subscribe(r))),new t)))},exports.noop=r,exports.now=u,exports.observableFrom=t=>new s((e=>{t.forEach((t=>e.next(t)))})),exports.once=function(){return t=>new s((e=>{let r=!1,s=!1;const n=t.subscribe((t=>{r||(r=!0,e.next(t)),s&&n.unsubscribe()}),(t=>{var i;r=!0,null===(i=e.error)||void 0===i||i.call(e,t),s&&n.unsubscribe()}));return s=!0,r&&n.unsubscribe(),n}))},exports.pairwise=function(){return t=>new s((e=>t.subscribe(new f(e))))},exports.tap=function(t){return e=>new s((r=>e.subscribe(new m(r,t))))},exports.throttle=function(t,e=h){return r=>new s((s=>r.subscribe(new d(s,t,e))))},exports.timeout=t=>new s((e=>{const r=window.setTimeout((()=>e.next()),t);return()=>window.clearTimeout(r)}));
|
package/es2018.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.
|
|
3
|
-
*
|
|
4
|
-
* https://st.mycdn.me/static/playersdk/1-0-
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.13-beta.0
|
|
3
|
+
* Thu, 14 Jul 2022 09:56:30 GMT
|
|
4
|
+
* https://st.mycdn.me/static/playersdk/1-0-13/doc/
|
|
5
5
|
*/
|
|
6
|
-
class t{constructor(){this.subscriptions=[]}unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach((t=>'function'==typeof t?t():t.unsubscribe()))}add(t){return this.subscriptions.push(t),this}}const e=t=>{throw new Error(`${t} is value of unexpected type`)},r=t=>{},n=()=>{};class s{constructor(t){t&&(this._subscribe=t)}subscribe(r,s){let i;i=s?'function'==typeof s?{next:s,error:n}:{next:t=>s.next(t),error:t=>{var e;return null===(e=s.error)||void 0===e?void 0:e.call(s,t)}}:{next:n,error:n};const o='function'==typeof r?{next:t=>{try{r(t)}catch(t){i.next(t)}},error:t=>i.next(t)}:{next:t=>r.next(t),error:t=>r.error?r.error(t):i.next(t)},c=this._subscribe(o);return(new t).add((()=>{switch(o.next=n,o.error=n,typeof c){case'function':return void c();case'object':return void c.unsubscribe();case'undefined':return;default:return e(c)}}))}pipe(...t){return t.reduce(((t,e)=>e(t)),this)}_subscribe(t){}}class i extends s{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(t){this.subscribers.forEach((e=>e.next(t)))}error(t){this.subscribers.forEach((e=>{var r;return null===(r=e.error)||void 0===r?void 0:r.call(e,t)}))}_subscribe(e){const r=this.keyCounter++;return this.subscribers.set(r,e),(new t).add((()=>this.subscribers.delete(r)))}}class o{constructor(){this.log$=new i,this.logs=[],this.log=t=>{const e={...t,timestamp:Date.now()};this.logs.push(e),this.log$.next(e)},this.getAllLogs=()=>this.logs}createCustomLog(t){return(...e)=>{let r;try{r=t(...e)}catch(t){r={message:'error in `createCustomLog`',component:'Logger'}}this.log(r)}}createComponentLog(t){return this.createCustomLog((e=>({component:t,...e})))}}function c(t,e='Assertion "value is not nullable" failed'){if(null==t)throw new Error(e)}function u(t,e='Assertion "value is nullable" failed'){if(null!=t)throw new Error(e)}function a(t){return null!=t}function l(t){return null==t}const h=(t,e,r)=>new Promise(((n,s)=>{e.addEventListener('abort',(()=>{c(),a.remove()}));const i=()=>{c(),s()},o=()=>{c(),n()},c=()=>{u&&clearTimeout(u),a.removeEventListener('load',o),a.removeEventListener('error',i)};let u;r&&(u=window.setTimeout(i,r));const a=document.createElement('script');a.addEventListener('load',o),a.addEventListener('error',i),a.src=t,document.head.appendChild(a)}));var d;const b='function'==typeof(null===(d=window.performance)||void 0===d?void 0:d.now)?()=>window.performance.now():()=>Date.now();class
|
|
6
|
+
class t{constructor(){this.subscriptions=[]}unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach((t=>'function'==typeof t?t():t.unsubscribe()))}add(t){return this.subscriptions.push(t),this}}const e=t=>{throw new Error(`${t} is value of unexpected type`)},r=t=>{},n=()=>{};class s{constructor(t){t&&(this._subscribe=t)}subscribe(r,s){let i;i=s?'function'==typeof s?{next:s,error:n}:{next:t=>s.next(t),error:t=>{var e;return null===(e=s.error)||void 0===e?void 0:e.call(s,t)}}:{next:n,error:n};const o='function'==typeof r?{next:t=>{try{r(t)}catch(t){i.next(t)}},error:t=>i.next(t)}:{next:t=>r.next(t),error:t=>r.error?r.error(t):i.next(t)},c=this._subscribe(o);return(new t).add((()=>{switch(o.next=n,o.error=n,typeof c){case'function':return void c();case'object':return void c.unsubscribe();case'undefined':return;default:return e(c)}}))}pipe(...t){return t.reduce(((t,e)=>e(t)),this)}_subscribe(t){}}class i extends s{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(t){this.subscribers.forEach((e=>e.next(t)))}error(t){this.subscribers.forEach((e=>{var r;return null===(r=e.error)||void 0===r?void 0:r.call(e,t)}))}_subscribe(e){const r=this.keyCounter++;return this.subscribers.set(r,e),(new t).add((()=>this.subscribers.delete(r)))}}class o{constructor(){this.log$=new i,this.logs=[],this.log=t=>{const e={...t,timestamp:Date.now()};this.logs.push(e),this.log$.next(e)},this.getAllLogs=()=>this.logs}createCustomLog(t){return(...e)=>{let r;try{r=t(...e)}catch(t){r={message:'error in `createCustomLog`',component:'Logger'}}this.log(r)}}createComponentLog(t){return this.createCustomLog((e=>({component:t,...e})))}}function c(t,e='Assertion "value is not nullable" failed'){if(null==t)throw new Error(e)}function u(t,e='Assertion "value is nullable" failed'){if(null!=t)throw new Error(e)}function a(t){return null!=t}function l(t){return null==t}const h=(t,e,r)=>new Promise(((n,s)=>{e.addEventListener('abort',(()=>{c(),a.remove()}));const i=()=>{c(),s()},o=()=>{c(),n()},c=()=>{u&&clearTimeout(u),a.removeEventListener('load',o),a.removeEventListener('error',i)};let u;r&&(u=window.setTimeout(i,r));const a=document.createElement('script');a.addEventListener('load',o),a.addEventListener('error',i),a.src=t,document.head.appendChild(a)}));var d;const b='function'==typeof(null===(d=window.performance)||void 0===d?void 0:d.now)?()=>window.performance.now():()=>Date.now(),w=(t,e)=>async(...r)=>{var n;const s=e(...r);let i,o=t.aborted;for(;!o&&!t.aborted;){const t=await s.next(i);o=null!==(n=t.done)&&void 0!==n&&n,i=t.value}return i};class v 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 e=super._subscribe(t);return t.next(this.value),e}}function f(e){return new s((r=>{const n={};let s=Object.keys(e).length;return Object.entries(e).reduce(((t,[e,i])=>t.add(i.subscribe((t=>e=>{t in n||s--,n[t]=e,0===s&&r.next(n)})(e)))),new t)}))}function x(...e){return new s((r=>e.reduce(((t,e)=>t.add(e.subscribe(r))),new t)))}var m=t=>new s((e=>{const r=window.setTimeout((()=>e.next()),t);return()=>window.clearTimeout(r)})),p=t=>new s((e=>{const r=window.setInterval((()=>e.next()),t);return()=>window.clearInterval(r)})),g=t=>new s((e=>{t.forEach((t=>e.next(t)))})),y=(t,e)=>new s((r=>{const n=t=>r.next(t);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}));const L={leading:!1,trailing:!0};function E(t,e=L){return r=>new s((n=>r.subscribe(new V(n,t,e))))}class V{constructor(t,e,r){this.destination=t,this.time=e,this.config=r}next(t){this.lastValue=t,a(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(t){if(!this.destination.error)throw t;this.destination.error(t)}this.timeout=void 0}),this.time)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}const C={leading:!0,trailing:!1};function T(t,e=C){return r=>new s((n=>r.subscribe(new _(n,t,e))))}class _{constructor(t,e,r){this.destination=t,this.time=e,this.config=r}next(t){this.lastValue=t,l(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 e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function j(t){return e=>new s((r=>e.subscribe(new k(r,t))))}class k{constructor(t,e){this.destination=t,this.predicate=e}next(t){let e;try{e=this.predicate(t)}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function A(t=((t,e)=>t===e)){return e=>new s((r=>e.subscribe(new D(r,t))))}const $={};class D{constructor(t,e){this.destination=t,this.predicate=e,this.lastValue=$}next(t){let e;try{e=this.lastValue===$||!this.predicate(this.lastValue,t),this.lastValue=t}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function I(t){return e=>new s((r=>e.subscribe(new O(r,t))))}class O{constructor(t,e){this.destination=t,this.mapper=e}next(t){let e;try{e=this.mapper(t)}catch(t){throw this.error(t),t}this.destination.next(e)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function M(t){return I((()=>t))}function P(){return t=>new s((e=>{let r=!1,n=!1;const s=t.subscribe((t=>{r||(r=!0,e.next(t)),n&&s.unsubscribe()}),(t=>{var i;r=!0,null===(i=e.error)||void 0===i||i.call(e,t),n&&s.unsubscribe()}));return n=!0,r&&s.unsubscribe(),s}))}function q(){return t=>new s((e=>t.subscribe(new z(e))))}class z{constructor(t){this.destination=t,this.hasLast=!1}next(t){const e=this.last;this.last=t,this.hasLast?this.destination.next([e,t]):this.hasLast=!0}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function B(t){return e=>new s((r=>e.subscribe(new F(r,t))))}class F{constructor(t,e){this.destination=t,this.effect=e}next(t){try{this.effect(t)}catch(t){throw this.error(t),t}this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}export{o as Logger,s as Observable,i as Subject,t as Subscription,v as ValueSubject,w as abortable,h as addScript,e as assertNever,c as assertNonNullable,u as assertNullable,r as checkNever,f as combine,E as debounce,j as filter,A as filterChanged,y as fromEvent,p as interval,a as isNonNullable,l as isNullable,I as map,M as mapTo,x as merge,n as noop,b as now,g as observableFrom,P as once,q as pairwise,B as tap,T as throttle,m as timeout};
|
package/esnext.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.
|
|
3
|
-
*
|
|
4
|
-
* https://st.mycdn.me/static/playersdk/1-0-
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.13-beta.0
|
|
3
|
+
* Thu, 14 Jul 2022 09:56:30 GMT
|
|
4
|
+
* https://st.mycdn.me/static/playersdk/1-0-13/doc/
|
|
5
5
|
*/
|
|
6
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:!0});class t{subscriptions=[];unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach((t=>'function'==typeof t?t():t.unsubscribe()))}add(t){return this.subscriptions.push(t),this}}const e=t=>{throw new Error(`${t} is value of unexpected type`)},r=()=>{};class s{constructor(t){t&&(this._subscribe=t)}subscribe(s,n){let i;i=n?'function'==typeof n?{next:n,error:r}:{next:t=>n.next(t),error:t=>n.error?.(t)}:{next:r,error:r};const o='function'==typeof s?{next:t=>{try{s(t)}catch(t){i.next(t)}},error:t=>i.next(t)}:{next:t=>s.next(t),error:t=>s.error?s.error(t):i.next(t)},c=this._subscribe(o);return(new t).add((()=>{switch(o.next=r,o.error=r,typeof c){case'function':return void c();case'object':return void c.unsubscribe();case'undefined':return;default:return e(c)}}))}pipe(...t){return t.reduce(((t,e)=>e(t)),this)}_subscribe(t){}}class n extends s{keyCounter=0;subscribers=new Map;constructor(){super()}next(t){this.subscribers.forEach((e=>e.next(t)))}error(t){this.subscribers.forEach((e=>e.error?.(t)))}_subscribe(e){const r=this.keyCounter++;return this.subscribers.set(r,e),(new t).add((()=>this.subscribers.delete(r)))}}function i(t){return null!=t}function o(t){return null==t}const c='function'==typeof window.performance?.now?()=>window.performance.now():()=>Date.now();const
|
|
6
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:!0});class t{subscriptions=[];unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach((t=>'function'==typeof t?t():t.unsubscribe()))}add(t){return this.subscriptions.push(t),this}}const e=t=>{throw new Error(`${t} is value of unexpected type`)},r=()=>{};class s{constructor(t){t&&(this._subscribe=t)}subscribe(s,n){let i;i=n?'function'==typeof n?{next:n,error:r}:{next:t=>n.next(t),error:t=>n.error?.(t)}:{next:r,error:r};const o='function'==typeof s?{next:t=>{try{s(t)}catch(t){i.next(t)}},error:t=>i.next(t)}:{next:t=>s.next(t),error:t=>s.error?s.error(t):i.next(t)},c=this._subscribe(o);return(new t).add((()=>{switch(o.next=r,o.error=r,typeof c){case'function':return void c();case'object':return void c.unsubscribe();case'undefined':return;default:return e(c)}}))}pipe(...t){return t.reduce(((t,e)=>e(t)),this)}_subscribe(t){}}class n extends s{keyCounter=0;subscribers=new Map;constructor(){super()}next(t){this.subscribers.forEach((e=>e.next(t)))}error(t){this.subscribers.forEach((e=>e.error?.(t)))}_subscribe(e){const r=this.keyCounter++;return this.subscribers.set(r,e),(new t).add((()=>this.subscribers.delete(r)))}}function i(t){return null!=t}function o(t){return null==t}const c='function'==typeof window.performance?.now?()=>window.performance.now():()=>Date.now();const a={leading:!1,trailing:!0};class u{destination;time;config;lastValue;timeout;constructor(t,e,r){this.destination=t,this.time=e,this.config=r}next(t){this.lastValue=t,i(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(t){if(!this.destination.error)throw t;this.destination.error(t)}this.timeout=void 0}),this.time)}error(t){this.destination.error?.(t)}}const l={leading:!0,trailing:!1};class h{destination;time;config;lastValue;timeout;constructor(t,e,r){this.destination=t,this.time=e,this.config=r}next(t){this.lastValue=t,o(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)}}class d{destination;predicate;constructor(t,e){this.destination=t,this.predicate=e}next(t){let e;try{e=this.predicate(t)}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){this.destination.error?.(t)}}const b={};class p{destination;predicate;lastValue=b;constructor(t,e){this.destination=t,this.predicate=e}next(t){let e;try{e=this.lastValue===b||!this.predicate(this.lastValue,t),this.lastValue=t}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function x(t){return e=>new s((r=>e.subscribe(new w(r,t))))}class w{destination;mapper;constructor(t,e){this.destination=t,this.mapper=e}next(t){let e;try{e=this.mapper(t)}catch(t){throw this.error(t),t}this.destination.next(e)}error(t){this.destination.error?.(t)}}class f{destination;last;hasLast=!1;constructor(t){this.destination=t}next(t){const e=this.last;this.last=t,this.hasLast?this.destination.next([e,t]):this.hasLast=!0}error(t){this.destination.error?.(t)}}class m{destination;effect;constructor(t,e){this.destination=t,this.effect=e}next(t){try{this.effect(t)}catch(t){throw this.error(t),t}this.destination.next(t)}error(t){this.destination.error?.(t)}}exports.Logger=class{log$=new n;logs=[];log=t=>{const e={...t,timestamp:Date.now()};this.logs.push(e),this.log$.next(e)};createCustomLog(t){return(...e)=>{let r;try{r=t(...e)}catch{r={message:'error in `createCustomLog`',component:'Logger'}}this.log(r)}}createComponentLog(t){return this.createCustomLog((e=>({component:t,...e})))}getAllLogs=()=>this.logs},exports.Observable=s,exports.Subject=n,exports.Subscription=t,exports.ValueSubject=class extends n{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 e=super._subscribe(t);return t.next(this.value),e}},exports.abortable=(t,e)=>async(...r)=>{const s=e(...r);let n,i=t.aborted;for(;!i&&!t.aborted;){const t=await s.next(n);i=t.done??!1,n=t.value}return n},exports.addScript=(t,e,r)=>new Promise(((s,n)=>{e.addEventListener('abort',(()=>{c(),u.remove()}));const i=()=>{c(),n()},o=()=>{c(),s()},c=()=>{a&&clearTimeout(a),u.removeEventListener('load',o),u.removeEventListener('error',i)};let a;r&&(a=window.setTimeout(i,r));const u=document.createElement('script');u.addEventListener('load',o),u.addEventListener('error',i),u.src=t,document.head.appendChild(u)})),exports.assertNever=e,exports.assertNonNullable=function(t,e='Assertion "value is not nullable" failed'){if(null==t)throw new Error(e)},exports.assertNullable=function(t,e='Assertion "value is nullable" failed'){if(null!=t)throw new Error(e)},exports.checkNever=t=>{},exports.combine=function(e){return new s((r=>{const s={};let n=Object.keys(e).length;return Object.entries(e).reduce(((t,[e,i])=>t.add(i.subscribe((t=>e=>{t in s||n--,s[t]=e,0===n&&r.next(s)})(e)))),new t)}))},exports.debounce=function(t,e=a){return r=>new s((s=>r.subscribe(new u(s,t,e))))},exports.filter=function(t){return e=>new s((r=>e.subscribe(new d(r,t))))},exports.filterChanged=function(t=((t,e)=>t===e)){return e=>new s((r=>e.subscribe(new p(r,t))))},exports.fromEvent=(t,e)=>new s((r=>{const s=t=>r.next(t);return t.addEventListener(e,s),()=>t.removeEventListener(e,s)})),exports.interval=t=>new s((e=>{const r=window.setInterval((()=>e.next()),t);return()=>window.clearInterval(r)})),exports.isNonNullable=i,exports.isNullable=o,exports.map=x,exports.mapTo=function(t){return x((()=>t))},exports.merge=function(...e){return new s((r=>e.reduce(((t,e)=>t.add(e.subscribe(r))),new t)))},exports.noop=r,exports.now=c,exports.observableFrom=t=>new s((e=>{t.forEach((t=>e.next(t)))})),exports.once=function(){return t=>new s((e=>{let r=!1,s=!1;const n=t.subscribe((t=>{r||(r=!0,e.next(t)),s&&n.unsubscribe()}),(t=>{r=!0,e.error?.(t),s&&n.unsubscribe()}));return s=!0,r&&n.unsubscribe(),n}))},exports.pairwise=function(){return t=>new s((e=>t.subscribe(new f(e))))},exports.tap=function(t){return e=>new s((r=>e.subscribe(new m(r,t))))},exports.throttle=function(t,e=l){return r=>new s((s=>r.subscribe(new h(s,t,e))))},exports.timeout=t=>new s((e=>{const r=window.setTimeout((()=>e.next()),t);return()=>window.clearTimeout(r)}));
|
package/esnext.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.
|
|
3
|
-
*
|
|
4
|
-
* https://st.mycdn.me/static/playersdk/1-0-
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.13-beta.0
|
|
3
|
+
* Thu, 14 Jul 2022 09:56:30 GMT
|
|
4
|
+
* https://st.mycdn.me/static/playersdk/1-0-13/doc/
|
|
5
5
|
*/
|
|
6
|
-
class t{subscriptions=[];unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach((t=>'function'==typeof t?t():t.unsubscribe()))}add(t){return this.subscriptions.push(t),this}}const e=t=>{throw new Error(`${t} is value of unexpected type`)},n=t=>{},r=()=>{};class s{constructor(t){t&&(this._subscribe=t)}subscribe(n,s){let i;i=s?'function'==typeof s?{next:s,error:r}:{next:t=>s.next(t),error:t=>s.error?.(t)}:{next:r,error:r};const o='function'==typeof n?{next:t=>{try{n(t)}catch(t){i.next(t)}},error:t=>i.next(t)}:{next:t=>n.next(t),error:t=>n.error?n.error(t):i.next(t)},c=this._subscribe(o);return(new t).add((()=>{switch(o.next=r,o.error=r,typeof c){case'function':return void c();case'object':return void c.unsubscribe();case'undefined':return;default:return e(c)}}))}pipe(...t){return t.reduce(((t,e)=>e(t)),this)}_subscribe(t){}}class i extends s{keyCounter=0;subscribers=new Map;constructor(){super()}next(t){this.subscribers.forEach((e=>e.next(t)))}error(t){this.subscribers.forEach((e=>e.error?.(t)))}_subscribe(e){const n=this.keyCounter++;return this.subscribers.set(n,e),(new t).add((()=>this.subscribers.delete(n)))}}class o{log$=new i;logs=[];log=t=>{const e={...t,timestamp:Date.now()};this.logs.push(e),this.log$.next(e)};createCustomLog(t){return(...e)=>{let n;try{n=t(...e)}catch{n={message:'error in `createCustomLog`',component:'Logger'}}this.log(n)}}createComponentLog(t){return this.createCustomLog((e=>({component:t,...e})))}getAllLogs=()=>this.logs}function c(t,e='Assertion "value is not nullable" failed'){if(null==t)throw new Error(e)}function u(t,e='Assertion "value is nullable" failed'){if(null!=t)throw new Error(e)}function a(t){return null!=t}function h(t){return null==t}const l=(t,e,n)=>new Promise(((r,s)=>{e.addEventListener('abort',(()=>{c(),a.remove()}));const i=()=>{c(),s()},o=()=>{c(),r()},c=()=>{u&&clearTimeout(u),a.removeEventListener('load',o),a.removeEventListener('error',i)};let u;n&&(u=window.setTimeout(i,n));const a=document.createElement('script');a.addEventListener('load',o),a.addEventListener('error',i),a.src=t,document.head.appendChild(a)})),d='function'==typeof window.performance?.now?()=>window.performance.now():()=>Date.now();class
|
|
6
|
+
class t{subscriptions=[];unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach((t=>'function'==typeof t?t():t.unsubscribe()))}add(t){return this.subscriptions.push(t),this}}const e=t=>{throw new Error(`${t} is value of unexpected type`)},n=t=>{},r=()=>{};class s{constructor(t){t&&(this._subscribe=t)}subscribe(n,s){let i;i=s?'function'==typeof s?{next:s,error:r}:{next:t=>s.next(t),error:t=>s.error?.(t)}:{next:r,error:r};const o='function'==typeof n?{next:t=>{try{n(t)}catch(t){i.next(t)}},error:t=>i.next(t)}:{next:t=>n.next(t),error:t=>n.error?n.error(t):i.next(t)},c=this._subscribe(o);return(new t).add((()=>{switch(o.next=r,o.error=r,typeof c){case'function':return void c();case'object':return void c.unsubscribe();case'undefined':return;default:return e(c)}}))}pipe(...t){return t.reduce(((t,e)=>e(t)),this)}_subscribe(t){}}class i extends s{keyCounter=0;subscribers=new Map;constructor(){super()}next(t){this.subscribers.forEach((e=>e.next(t)))}error(t){this.subscribers.forEach((e=>e.error?.(t)))}_subscribe(e){const n=this.keyCounter++;return this.subscribers.set(n,e),(new t).add((()=>this.subscribers.delete(n)))}}class o{log$=new i;logs=[];log=t=>{const e={...t,timestamp:Date.now()};this.logs.push(e),this.log$.next(e)};createCustomLog(t){return(...e)=>{let n;try{n=t(...e)}catch{n={message:'error in `createCustomLog`',component:'Logger'}}this.log(n)}}createComponentLog(t){return this.createCustomLog((e=>({component:t,...e})))}getAllLogs=()=>this.logs}function c(t,e='Assertion "value is not nullable" failed'){if(null==t)throw new Error(e)}function u(t,e='Assertion "value is nullable" failed'){if(null!=t)throw new Error(e)}function a(t){return null!=t}function h(t){return null==t}const l=(t,e,n)=>new Promise(((r,s)=>{e.addEventListener('abort',(()=>{c(),a.remove()}));const i=()=>{c(),s()},o=()=>{c(),r()},c=()=>{u&&clearTimeout(u),a.removeEventListener('load',o),a.removeEventListener('error',i)};let u;n&&(u=window.setTimeout(i,n));const a=document.createElement('script');a.addEventListener('load',o),a.addEventListener('error',i),a.src=t,document.head.appendChild(a)})),d='function'==typeof window.performance?.now?()=>window.performance.now():()=>Date.now(),b=(t,e)=>async(...n)=>{const r=e(...n);let s,i=t.aborted;for(;!i&&!t.aborted;){const t=await r.next(s);i=t.done??!1,s=t.value}return s};class w extends i{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 e=super._subscribe(t);return t.next(this.value),e}}function f(e){return new s((n=>{const r={};let s=Object.keys(e).length;return Object.entries(e).reduce(((t,[e,i])=>t.add(i.subscribe((t=>e=>{t in r||s--,r[t]=e,0===s&&n.next(r)})(e)))),new t)}))}function m(...e){return new s((n=>e.reduce(((t,e)=>t.add(e.subscribe(n))),new t)))}var x=t=>new s((e=>{const n=window.setTimeout((()=>e.next()),t);return()=>window.clearTimeout(n)})),p=t=>new s((e=>{const n=window.setInterval((()=>e.next()),t);return()=>window.clearInterval(n)})),g=t=>new s((e=>{t.forEach((t=>e.next(t)))})),v=(t,e)=>new s((n=>{const r=t=>n.next(t);return t.addEventListener(e,r),()=>t.removeEventListener(e,r)}));const y={leading:!1,trailing:!0};function L(t,e=y){return n=>new s((r=>n.subscribe(new E(r,t,e))))}class E{destination;time;config;lastValue;timeout;constructor(t,e,n){this.destination=t,this.time=e,this.config=n}next(t){this.lastValue=t,a(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(t){if(!this.destination.error)throw t;this.destination.error(t)}this.timeout=void 0}),this.time)}error(t){this.destination.error?.(t)}}const V={leading:!0,trailing:!1};function C(t,e=V){return n=>new s((r=>n.subscribe(new T(r,t,e))))}class T{destination;time;config;lastValue;timeout;constructor(t,e,n){this.destination=t,this.time=e,this.config=n}next(t){this.lastValue=t,h(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 _(t){return e=>new s((n=>e.subscribe(new j(n,t))))}class j{destination;predicate;constructor(t,e){this.destination=t,this.predicate=e}next(t){let e;try{e=this.predicate(t)}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function k(t=((t,e)=>t===e)){return e=>new s((n=>e.subscribe(new $(n,t))))}const A={};class ${destination;predicate;lastValue=A;constructor(t,e){this.destination=t,this.predicate=e}next(t){let e;try{e=this.lastValue===A||!this.predicate(this.lastValue,t),this.lastValue=t}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function D(t){return e=>new s((n=>e.subscribe(new I(n,t))))}class I{destination;mapper;constructor(t,e){this.destination=t,this.mapper=e}next(t){let e;try{e=this.mapper(t)}catch(t){throw this.error(t),t}this.destination.next(e)}error(t){this.destination.error?.(t)}}function O(t){return D((()=>t))}function M(){return t=>new s((e=>{let n=!1,r=!1;const s=t.subscribe((t=>{n||(n=!0,e.next(t)),r&&s.unsubscribe()}),(t=>{n=!0,e.error?.(t),r&&s.unsubscribe()}));return r=!0,n&&s.unsubscribe(),s}))}function P(){return t=>new s((e=>t.subscribe(new q(e))))}class q{destination;last;hasLast=!1;constructor(t){this.destination=t}next(t){const e=this.last;this.last=t,this.hasLast?this.destination.next([e,t]):this.hasLast=!0}error(t){this.destination.error?.(t)}}function z(t){return e=>new s((n=>e.subscribe(new B(n,t))))}class B{destination;effect;constructor(t,e){this.destination=t,this.effect=e}next(t){try{this.effect(t)}catch(t){throw this.error(t),t}this.destination.next(t)}error(t){this.destination.error?.(t)}}export{o as Logger,s as Observable,i as Subject,t as Subscription,w as ValueSubject,b as abortable,l as addScript,e as assertNever,c as assertNonNullable,u as assertNullable,n as checkNever,f as combine,L as debounce,_ as filter,k as filterChanged,v as fromEvent,p as interval,a as isNonNullable,h as isNullable,D as map,O as mapTo,m as merge,r as noop,d as now,g as observableFrom,M as once,P as pairwise,z as tap,C as throttle,x as timeout};
|
package/package.json
CHANGED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare type AbortableDecorator = <Params extends unknown[] = void[], Return = void>(signal: AbortSignal, createGenerator: (...param: Params) => AsyncGenerator<unknown, Return, unknown>) => (...param: Params) => Promise<Return | undefined>;
|
|
2
|
+
export declare const abortable: AbortableDecorator;
|
|
3
|
+
export {};
|
package/utils/index.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export { isNonNullable, isNullable, assertNonNullable, assertNullable } from './
|
|
|
4
4
|
export { addScript } from './addScript';
|
|
5
5
|
export type { Milliseconds, bps, Byte, Seconds, Kbps, Mbps } from './semanticTypes';
|
|
6
6
|
export { now } from './now';
|
|
7
|
+
export { abortable } from './abortable';
|