@vkontakte/videoplayer-shared 1.0.27 → 1.0.28

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.27
3
- * Fri, 18 Aug 2023 12:34:43 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-27/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.28
3
+ * Tue, 29 Aug 2023 12:41:47 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-28/doc/
5
5
  */
6
- "use strict";const Q="1.0.27";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 w=t=>{throw new Error(`${t} is value of unexpected type`)},P=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 r=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 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=g,r.error=g,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return w(s)}})}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 M{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 D(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function T(t){return typeof t!="undefined"&&t!==null}function I(t){return t==null}const G=(t,e,i)=>new Promise((n,o)=>{e.addEventListener("abort",()=>{a(),h.remove()});const r=()=>{a(),o()},s=()=>{a(),n()},a=()=>{d&&clearTimeout(d),h.removeEventListener("load",s),h.removeEventListener("error",r)};let d;i&&(d=window.setTimeout(r,i));const h=document.createElement("script");h.addEventListener("load",s),h.addEventListener("error",r),h.src=t,document.head.appendChild(h)});var _;const j=typeof((_=window.performance)===null||_===void 0?void 0:_.now)=="function"?()=>window.performance.now():()=>Date.now();function k(t,e,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(b){try{h(n.next(b))}catch(m){s(m)}}function d(b){try{h(n.throw(b))}catch(m){s(m)}}function h(b){b.done?r(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 r=t.aborted,s;for(;!r&&!t.aborted;){const a=yield o.next(s);r=(n=a.done)!==null&&n!==void 0?n:!1,s=a.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 F=()=>{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,r=/webkit|safari|khtml/i.test(t)?exports.CurrentClientBrowser.Safari:void 0,s=/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,m=/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||s||a||i||n||r||exports.CurrentClientBrowser.Rest,device:d||h||b||m||C||exports.CurrentClientDevice.Desktop}},H=(t,{start:e=0,factor:i=2,max:n=1/0,min:o=e,random:r=0}={})=>{let s=e;return s*=Math.pow(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={}));let l,v;const S=`vk-videoplayer-dummy-key-${Math.random()}`,p=()=>{if(v!==void 0)return v;try{localStorage.setItem(S,"test"),localStorage.removeItem(S),v=c.LOCAL_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(S),v=c.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)v=c.RUNTIME;else throw e}else throw t}return v===c.RUNTIME&&(l=new Map),v},q=()=>p()===c.LOCAL_STORAGE,B=t=>{var e,i;const n=p();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:w(n)}},z=(t,e)=>{const i=p();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:w(i)}},$=t=>{var e;const i=p();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 w(i),!1}},W=t=>{const e=p();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:w(e)}},Y=()=>{const t=p();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:w(t)}};var K=Object.freeze({__proto__:null,clear:Y,get:B,has:$,isPersistent:q,remove:W,set:z});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}},X=(t,e)=>f[t].height>f[e].height,J=(t,e)=>f[t].height>=f[e].height,O=(t,e)=>f[t].height<f[e].height,Z=(t,e)=>f[t].height<=f[e].height,ee=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),te=(t,e=.02)=>[...L].find(n=>f[n].height*(1+e)>=t),ie=({width:t,height:e})=>{const i=Math.min(t,e),n=Math.max(t,e);return L.find(o=>{const r=f[o];return r.width>=n&&r.height>=i})},ne=t=>f[t].height,y=t=>t===exports.VideoQuality.INVARIANT,re=t=>t.every(e=>!y(e));function se(t){if(y(t))throw new Error("Expected exact quality")}const N=(t,e)=>{const i={};for(const n of Object.keys(e)){const o=e[n],r=t[n];Array.isArray(o)&&Array.isArray(r)?i[n]=r:typeof o=="object"&&typeof r=="object"?i[n]=N(r,o):i[n]=n in t?r:o}return i};class oe 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 ae(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 ce(...t){return new u(e=>t.reduce((i,n)=>i.add(n.subscribe(e)),new E))}var ue=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)}),le=t=>new u(e=>{const i=window.setInterval(()=>e.next(),t);return()=>window.clearInterval(i)}),de=t=>new u(e=>{t.forEach(i=>e.next(i))}),he=(t,e)=>new u(i=>{const n=o=>i.next(o);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});function fe(t){return e=>new u(i=>e.subscribe(new be(i,t)))}class be{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 ve={leading:!1,trailing:!0};function we(t,e=ve){return i=>new u(n=>i.subscribe(new ge(n,t,e)))}class ge{constructor(e,i,n){this.destination=e,this.time=i,this.config=n}next(e){this.lastValue=e,T(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 pe={leading:!0,trailing:!1};function me(t,e=pe){return i=>new u(n=>i.subscribe(new Ee(n,t,e)))}class Ee{constructor(e,i,n){this.destination=e,this.time=i,this.config=n}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,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}function _e(t){return e=>new u(i=>e.subscribe(new Se(i,t)))}class Se{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 xe(t=(e,i)=>e===i){return e=>new u(i=>e.subscribe(new Oe(i,t)))}const A={};class Oe{constructor(e,i){this.destination=e,this.predicate=i,this.lastValue=A}next(e){let i;try{i=this.lastValue===A||!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 R(t){return e=>new u(i=>e.subscribe(new ye(i,t)))}let ye=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 Ae(t){return R(()=>t)}function Te(){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 Ie(){return t=>new u(e=>t.subscribe(new Le(e)))}class Le{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 Ne(t){return e=>new u(i=>e.subscribe(new Re(i,t)))}class Re{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={}));exports.Logger=M;exports.Observable=u;exports.Subject=x;exports.Subscription=E;exports.VERSION=Q;exports.ValueSubject=oe;exports.abortable=U;exports.addScript=G;exports.areQualitiesExact=re;exports.assertNever=w;exports.assertNonNullable=V;exports.assertNullable=D;exports.assertQualityIsExact=se;exports.buffer=fe;exports.checkNever=P;exports.combine=ae;exports.debounce=we;exports.fillWithDefault=N;exports.filter=_e;exports.filterChanged=xe;exports.fromEvent=he;exports.getCurrentBrowser=F;exports.getExponentialDelay=H;exports.getHighestQuality=ee;exports.interval=le;exports.isHigher=X;exports.isHigherOrEqual=J;exports.isInvariantQuality=y;exports.isLower=O;exports.isLowerOrEqual=Z;exports.isNonNullable=T;exports.isNullable=I;exports.map=R;exports.mapTo=Ae;exports.merge=ce;exports.noop=g;exports.now=j;exports.observableFrom=de;exports.once=Te;exports.pairwise=Ie;exports.safeStorage=K;exports.tap=Ne;exports.throttle=me;exports.timeout=ue;exports.videoHeightToQuality=te;exports.videoQualityToHeight=ne;exports.videoSizeToQuality=ie;
6
+ "use strict";const sn="1.0.28";class Y{constructor(){this.subscriptions=[]}unsubscribe(){const r=this.subscriptions;this.subscriptions=[],r.forEach(t=>typeof t=="function"?t():t.unsubscribe())}add(r){return this.subscriptions.push(r),this}}const L=e=>{throw new Error(`${e} is value of unexpected type`)},ln=e=>{},G=()=>{};class b{constructor(r){r&&(this._subscribe=r)}subscribe(r,t){var n;let a;t?typeof t=="function"?a={next:t,error:G}:a={next:s=>t.next(s),error:s=>{var v;return(v=t.error)===null||v===void 0?void 0:v.call(t,s)}}:a={next:G,error:G};const o=typeof r=="function"?{next:s=>{try{r(s)}catch(v){a.next(v)}},error:s=>a.next(s)}:{next:s=>r.next(s),error:s=>r.error?r.error(s):a.next(s)};let i;try{i=this._subscribe(o)}catch(s){(n=o.error)===null||n===void 0||n.call(o,s)}return new Y().add(()=>{switch(o.next=G,o.error=G,typeof i){case"function":i();return;case"object":i.unsubscribe();return;case"undefined":return;default:return L(i)}})}pipe(...r){return r.reduce((t,n)=>n(t),this)}_subscribe(r){}}class qe extends b{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(r){this.subscribers.forEach(t=>t.next(r))}error(r){this.subscribers.forEach(t=>{var n;return(n=t.error)===null||n===void 0?void 0:n.call(t,r)})}_subscribe(r){const t=this.keyCounter++;return this.subscribers.set(t,r),new Y().add(()=>this.subscribers.delete(t))}}class cn{constructor(){this.log$=new qe,this.logs=[],this.log=r=>{const t=Object.assign(Object.assign({},r),{timestamp:Date.now()});this.logs.push(t),this.log$.next(t)},this.getAllLogs=()=>this.logs}createCustomLog(r){return(...t)=>{let n;try{n=r(...t)}catch(a){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(r){return this.createCustomLog(t=>Object.assign({component:r},t))}}function un(e,r='Assertion "value is not nullable" failed'){if(e==null)throw new Error(r)}function vn(e,r='Assertion "value is nullable" failed'){if(e!=null)throw new Error(r)}function rt(e){return typeof e!="undefined"&&e!==null}function tt(e){return e==null}const fn=(e,r,t)=>new Promise((n,a)=>{r.addEventListener("abort",()=>{s(),c.remove()});const o=()=>{s(),a()},i=()=>{s(),n()},s=()=>{v&&clearTimeout(v),c.removeEventListener("load",i),c.removeEventListener("error",o)};let v;t&&(v=window.setTimeout(o,t));const c=document.createElement("script");c.addEventListener("load",i),c.addEventListener("error",o),c.src=e,document.head.appendChild(c)});var de;const dn=typeof((de=window.performance)===null||de===void 0?void 0:de.now)=="function"?()=>window.performance.now():()=>Date.now();function nt(e,r,t,n){function a(o){return o instanceof t?o:new t(function(i){i(o)})}return new(t||(t=Promise))(function(o,i){function s(l){try{c(n.next(l))}catch(u){i(u)}}function v(l){try{c(n.throw(l))}catch(u){i(u)}}function c(l){l.done?o(l.value):a(l.value).then(s,v)}c((n=n.apply(e,r||[])).next())})}const hn=(e,r)=>(...t)=>nt(void 0,void 0,void 0,function*(){var n;const a=r(...t);let o=e.aborted,i;for(;!o&&!e.aborted;){const s=yield a.next(i);o=(n=s.done)!==null&&n!==void 0?n:!1,i=s.value}return i});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 at=()=>{const{userAgent:e}=window.navigator,r=/yabrowser/i.test(e)?exports.CurrentClientBrowser.Yandex:void 0,t=/chrome|crios/i.test(e)?exports.CurrentClientBrowser.Chrome:void 0,n=/chromium/i.test(e)?exports.CurrentClientBrowser.Chromium:void 0,a=/firefox|fxios/i.test(e)?exports.CurrentClientBrowser.Firefox:void 0,o=/webkit|safari|khtml/i.test(e)?exports.CurrentClientBrowser.Safari:void 0,i=/opr\//i.test(e)?exports.CurrentClientBrowser.Opera:void 0,s=/edg/i.test(e)?exports.CurrentClientBrowser.Edge:void 0,v=/android/i.test(e)?exports.CurrentClientDevice.Android:void 0,c=/iphone/i.test(e)?exports.CurrentClientDevice.iPhone:void 0,l=/ipad/i.test(e)?exports.CurrentClientDevice.iPad:void 0,u=/ipod/i.test(e)?exports.CurrentClientDevice.iPod:void 0,f=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?exports.CurrentClientDevice.RestMobile:void 0;return{browser:r||a||i||s||t||n||o||exports.CurrentClientBrowser.Rest,device:v||c||l||u||f||exports.CurrentClientDevice.Desktop}},bn=()=>[exports.CurrentClientDevice.iPhone,exports.CurrentClientDevice.iPad,exports.CurrentClientDevice.iPod].includes(at().device),pn=(e,{start:r=0,factor:t=2,max:n=1/0,min:a=r,random:o=0}={})=>{let i=r;return i*=Math.pow(t,e),i*=1+(Math.random()*o*2-o),i=Math.round(i),i=Math.min(i,n),i=Math.max(i,a),i};var h;(function(e){e[e.LOCAL_STORAGE=0]="LOCAL_STORAGE",e[e.SESSION_STORAGE=1]="SESSION_STORAGE",e[e.RUNTIME=2]="RUNTIME"})(h||(h={}));let p,j;const he=`vk-videoplayer-dummy-key-${Math.random()}`,k=()=>{if(j!==void 0)return j;try{localStorage.setItem(he,"test"),localStorage.removeItem(he),j=h.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(he),j=h.SESSION_STORAGE}catch(r){if(r instanceof DOMException||r instanceof TypeError)j=h.RUNTIME;else throw r}else throw e}return j===h.RUNTIME&&(p=new Map),j},yn=()=>k()===h.LOCAL_STORAGE,gn=e=>{var r,t;const n=k();switch(n){case h.LOCAL_STORAGE:return(r=localStorage.getItem(e))!==null&&r!==void 0?r:void 0;case h.SESSION_STORAGE:return(t=sessionStorage.getItem(e))!==null&&t!==void 0?t:void 0;case h.RUNTIME:return p==null?void 0:p.get(e);default:L(n)}},On=(e,r)=>{const t=k();switch(t){case h.LOCAL_STORAGE:try{localStorage.setItem(e,r)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case h.SESSION_STORAGE:try{sessionStorage.setItem(e,r)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case h.RUNTIME:return void(p==null?void 0:p.set(e,r));default:L(t)}},wn=e=>{var r;const t=k();switch(t){case h.LOCAL_STORAGE:return e in localStorage;case h.SESSION_STORAGE:return e in sessionStorage;case h.RUNTIME:return(r=p==null?void 0:p.has(e))!==null&&r!==void 0?r:!1;default:return L(t),!1}},$n=e=>{const r=k();switch(r){case h.LOCAL_STORAGE:return localStorage.removeItem(e);case h.SESSION_STORAGE:return sessionStorage.removeItem(e);case h.RUNTIME:return void(p==null?void 0:p.delete(e));default:L(r)}},mn=()=>{const e=k();switch(e){case h.LOCAL_STORAGE:return localStorage.clear();case h.SESSION_STORAGE:return sessionStorage.clear();case h.RUNTIME:return p==null?void 0:p.clear();default:L(e)}};var En=Object.freeze({__proto__:null,clear:mn,get:gn,has:wn,isPersistent:yn,remove:$n,set:On});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 m={[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}},Sn=(e,r)=>m[e].height>m[r].height,Tn=(e,r)=>m[e].height>=m[r].height,Ye=(e,r)=>m[e].height<m[r].height,In=(e,r)=>m[e].height<=m[r].height,Rn=e=>e.sort((r,t)=>r===t?0:r===exports.VideoQuality.INVARIANT?1:t===exports.VideoQuality.INVARIANT?-1:Ye(r,t)?1:-1)[0],ot=Object.keys(m).sort((e,r)=>Ye(e,r)?-1:1),_n=(e,r=.02)=>[...ot].find(n=>m[n].height*(1+r)>=e),Pn=({width:e,height:r})=>{const t=Math.min(e,r),n=Math.max(e,r);return ot.find(a=>{const o=m[a];return o.width>=n&&o.height>=t})},An=e=>m[e].height,He=e=>e===exports.VideoQuality.INVARIANT,jn=e=>e.every(r=>!He(r));function Ln(e){if(He(e))throw new Error("Expected exact quality")}const it=(e,r)=>{const t={};for(const n of Object.keys(r)){const a=r[n],o=e[n];Array.isArray(a)&&Array.isArray(o)?t[n]=o:typeof a=="object"&&typeof o=="object"?t[n]=it(o,a):t[n]=n in e?o:a}return t};class Cn extends qe{constructor(r){super(),this.value=r}next(r){super.next(this.value=r)}error(r){super.error(this.value=r)}getValue(){return this.value}_subscribe(r){const t=super._subscribe(r);return r.next(this.value),t}}function xn(e){return new b(r=>{const t={};let n=Object.keys(e).length;const a=o=>i=>{o in t||n--,t[o]=i,n===0&&r.next(t)};return Object.entries(e).reduce((o,[i,s])=>o.add(s.subscribe(a(i))),new Y)})}function Nn(...e){return new b(r=>e.reduce((t,n)=>t.add(n.subscribe(r)),new Y))}var Mn=e=>new b(r=>{const t=window.setTimeout(()=>{try{r.next()}catch(n){if(r.error)r.error(n);else throw n}},e);return()=>window.clearTimeout(t)}),Dn=e=>new b(r=>{const t=window.setInterval(()=>r.next(),e);return()=>window.clearInterval(t)}),Fn=e=>new b(r=>{e.forEach(t=>r.next(t))}),Gn=(e,r)=>new b(t=>{const n=a=>t.next(a);return e.addEventListener(r,n),()=>e.removeEventListener(r,n)});function Vn(e){return r=>new b(t=>r.subscribe(new kn(t,e)))}class kn{constructor(r,t){this.destination=r,this.size=t,this.lastValues=[]}next(r){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(r),this.destination.next(this.lastValues)}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}}const Bn={leading:!1,trailing:!0};function Un(e,r=Bn){return t=>new b(n=>t.subscribe(new Qn(n,e,r)))}class Qn{constructor(r,t,n){this.destination=r,this.time=t,this.config=n}next(r){this.lastValue=r,rt(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(r),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(t){if(this.destination.error)this.destination.error(t);else throw t}this.timeout=void 0},this.time)}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}}const Kn={leading:!0,trailing:!1};function qn(e,r=Kn){return t=>new b(n=>t.subscribe(new Yn(n,e,r)))}class Yn{constructor(r,t,n){this.destination=r,this.time=t,this.config=n}next(r){this.lastValue=r,tt(this.timeout)&&(this.config.leading&&this.destination.next(r),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}}function Hn(e){return r=>new b(t=>r.subscribe(new zn(t,e)))}class zn{constructor(r,t){this.destination=r,this.predicate=t}next(r){let t;try{t=this.predicate(r)}catch(n){throw this.error(n),n}t&&this.destination.next(r)}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}}function Wn(e=(r,t)=>r===t){return r=>new b(t=>r.subscribe(new Xn(t,e)))}const lr={};class Xn{constructor(r,t){this.destination=r,this.predicate=t,this.lastValue=lr}next(r){let t;try{t=this.lastValue===lr||!this.predicate(this.lastValue,r),this.lastValue=r}catch(n){throw this.error(n),n}t&&this.destination.next(r)}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}}function st(e){return r=>new b(t=>r.subscribe(new Jn(t,e)))}let Jn=class{constructor(r,t){this.destination=r,this.mapper=t}next(r){let t;try{t=this.mapper(r)}catch(n){throw this.error(n),n}this.destination.next(t)}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}};function Zn(e){return st(()=>e)}function ea(){return e=>new b(r=>{let t=!1,n=!1;const a=e.subscribe(o=>{t||(t=!0,r.next(o)),n&&a.unsubscribe()},o=>{var i;t=!0,(i=r.error)===null||i===void 0||i.call(r,o),n&&a.unsubscribe()});return n=!0,t&&a.unsubscribe(),a})}function ra(){return e=>new b(r=>e.subscribe(new ta(r)))}class ta{constructor(r){this.destination=r,this.hasLast=!1}next(r){const t=this.last;if(this.last=r,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,r])}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}}function na(e){return r=>new b(t=>r.subscribe(new aa(t,e)))}class aa{constructor(r,t){this.destination=r,this.effect=t}next(r){try{this.effect(r)}catch(t){throw this.error(t),t}this.destination.next(r)}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}}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={}));class cr{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(r,t,n){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:t,options:n})}removeEventListener(r,t){if(!(r in this.listeners))return;const n=this.listeners[r];for(let a=0,o=n.length;a<o;a++)if(n[a].callback===t){n.splice(a,1);return}}dispatchEvent(r){if(!(r.type in this.listeners))return;const n=this.listeners[r.type].slice();for(let a=0,o=n.length;a<o;a++){const i=n[a];try{i.callback.call(this,r)}catch(s){Promise.resolve().then(()=>{throw s})}i.options&&i.options.once&&this.removeEventListener(r.type,i.callback)}return!r.defaultPrevented}}class lt extends cr{constructor(){super(),this.listeners||cr.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(r){r.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,r)),super.dispatchEvent(r)}}class oa{constructor(){Object.defineProperty(this,"signal",{value:new lt,writable:!0,configurable:!0})}abort(r){let t;try{t=new Event("abort")}catch(a){typeof document!="undefined"?document.createEvent?(t=document.createEvent("Event"),t.initEvent("abort",!1,!1)):(t=document.createEventObject(),t.type="abort"):t={type:"abort",bubbles:!1,cancelable:!1}}let n=r;if(n===void 0)if(typeof document=="undefined")n=new Error("This operation was aborted"),n.name="AbortError";else try{n=new DOMException("signal is aborted without reason")}catch(a){n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(t)}toString(){return"[object AbortController]"}}typeof Symbol!="undefined"&&Symbol.toStringTag&&(oa.prototype[Symbol.toStringTag]="AbortController",lt.prototype[Symbol.toStringTag]="AbortSignal");function ct(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function ia(e){typeof e=="function"&&(e={fetch:e});const{fetch:r,Request:t=r.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a=!1}=e;if(!ct({fetch:r,Request:t,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a}))return{fetch:r,Request:o};let o=t;(o&&!o.prototype.hasOwnProperty("signal")||a)&&(o=function(c,l){let u;l&&l.signal&&(u=l.signal,delete l.signal);const f=new t(c,l);return u&&Object.defineProperty(f,"signal",{writable:!1,enumerable:!1,configurable:!0,value:u}),f},o.prototype=t.prototype);const i=r;return{fetch:(v,c)=>{const l=o&&o.prototype.isPrototypeOf(v)?v.signal:c?c.signal:void 0;if(l){let u;try{u=new DOMException("Aborted","AbortError")}catch(d){u=new Error("Aborted"),u.name="AbortError"}if(l.aborted)return Promise.reject(u);const f=new Promise((d,O)=>{l.addEventListener("abort",()=>O(u),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([f,i(v,c)])}return i(v,c)},Request:o}}const ze=ct({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),ut=ze?ia({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,sa=ze?ut.fetch:window.fetch;ze?ut.Request:window.Request;var be=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function la(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _=function(e){try{return!!e()}catch(r){return!0}},ca=_,ve=!ca(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),vt=ve,ft=Function.prototype,De=ft.call,ua=vt&&ft.bind.bind(De,De),C=vt?ua:function(e){return function(){return De.apply(e,arguments)}},dt=C,va=dt({}.toString),fa=dt("".slice),We=function(e){return fa(va(e),8,-1)},da=C,ha=_,ba=We,pe=Object,pa=da("".split),ya=ha(function(){return!pe("z").propertyIsEnumerable(0)})?function(e){return ba(e)=="String"?pa(e,""):pe(e)}:pe,Xe=function(e){return e==null},ga=Xe,Oa=TypeError,ht=function(e){if(ga(e))throw Oa("Can't call method on "+e);return e},wa=ya,$a=ht,H=function(e){return wa($a(e))},B={},X=function(e){return e&&e.Math==Math&&e},S=X(typeof globalThis=="object"&&globalThis)||X(typeof window=="object"&&window)||X(typeof self=="object"&&self)||X(typeof be=="object"&&be)||function(){return this}()||be||Function("return this")(),Fe=typeof document=="object"&&document.all,ma=typeof Fe=="undefined"&&Fe!==void 0,bt={all:Fe,IS_HTMLDDA:ma},pt=bt,Ea=pt.all,T=pt.IS_HTMLDDA?function(e){return typeof e=="function"||e===Ea}:function(e){return typeof e=="function"},Sa=S,Ta=T,ur=Sa.WeakMap,Ia=Ta(ur)&&/native code/.test(String(ur)),vr=T,yt=bt,Ra=yt.all,U=yt.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:vr(e)||e===Ra}:function(e){return typeof e=="object"?e!==null:vr(e)},_a=_,x=!_a(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),Q={},Pa=S,fr=U,Ge=Pa.document,Aa=fr(Ge)&&fr(Ge.createElement),gt=function(e){return Aa?Ge.createElement(e):{}},ja=x,La=_,Ca=gt,Ot=!ja&&!La(function(){return Object.defineProperty(Ca("div"),"a",{get:function(){return 7}}).a!=7}),xa=x,Na=_,wt=xa&&Na(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),Ma=U,Da=String,Fa=TypeError,K=function(e){if(Ma(e))return e;throw Fa(Da(e)+" is not an object")},Ga=ve,J=Function.prototype.call,N=Ga?J.bind(J):function(){return J.apply(J,arguments)},Je={},ye=Je,ge=S,Va=T,dr=function(e){return Va(e)?e:void 0},$t=function(e,r){return arguments.length<2?dr(ye[e])||dr(ge[e]):ye[e]&&ye[e][r]||ge[e]&&ge[e][r]},ka=C,mt=ka({}.isPrototypeOf),Ba=typeof navigator!="undefined"&&String(navigator.userAgent)||"",Et=S,Oe=Ba,hr=Et.process,br=Et.Deno,pr=hr&&hr.versions||br&&br.version,yr=pr&&pr.v8,E,le;yr&&(E=yr.split("."),le=E[0]>0&&E[0]<4?1:+(E[0]+E[1]));!le&&Oe&&(E=Oe.match(/Edge\/(\d+)/),(!E||E[1]>=74)&&(E=Oe.match(/Chrome\/(\d+)/),E&&(le=+E[1])));var Ua=le,gr=Ua,Qa=_,Ka=S,qa=Ka.String,St=!!Object.getOwnPropertySymbols&&!Qa(function(){var e=Symbol();return!qa(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&gr&&gr<41}),Ya=St,Tt=Ya&&!Symbol.sham&&typeof Symbol.iterator=="symbol",Ha=$t,za=T,Wa=mt,Xa=Tt,Ja=Object,It=Xa?function(e){return typeof e=="symbol"}:function(e){var r=Ha("Symbol");return za(r)&&Wa(r.prototype,Ja(e))},Za=String,Ze=function(e){try{return Za(e)}catch(r){return"Object"}},eo=T,ro=Ze,to=TypeError,er=function(e){if(eo(e))return e;throw to(ro(e)+" is not a function")},no=er,ao=Xe,rr=function(e,r){var t=e[r];return ao(t)?void 0:no(t)},we=N,$e=T,me=U,oo=TypeError,io=function(e,r){var t,n;if(r==="string"&&$e(t=e.toString)&&!me(n=we(t,e))||$e(t=e.valueOf)&&!me(n=we(t,e))||r!=="string"&&$e(t=e.toString)&&!me(n=we(t,e)))return n;throw oo("Can't convert object to primitive value")},Rt={exports:{}},Or=S,so=Object.defineProperty,lo=function(e,r){try{so(Or,e,{value:r,configurable:!0,writable:!0})}catch(t){Or[e]=r}return r},co=S,uo=lo,wr="__core-js_shared__",vo=co[wr]||uo(wr,{}),_t=vo,$r=_t;(Rt.exports=function(e,r){return $r[e]||($r[e]=r!==void 0?r:{})})("versions",[]).push({version:"3.31.0",mode:"pure",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.0/LICENSE",source:"https://github.com/zloirock/core-js"});var Pt=Rt.exports,fo=ht,ho=Object,At=function(e){return ho(fo(e))},bo=C,po=At,yo=bo({}.hasOwnProperty),A=Object.hasOwn||function(r,t){return yo(po(r),t)},go=C,Oo=0,wo=Math.random(),$o=go(1 .toString),jt=function(e){return"Symbol("+(e===void 0?"":e)+")_"+$o(++Oo+wo,36)},mo=S,Eo=Pt,mr=A,So=jt,To=St,Io=Tt,V=mo.Symbol,Ee=Eo("wks"),Ro=Io?V.for||V:V&&V.withoutSetter||So,P=function(e){return mr(Ee,e)||(Ee[e]=To&&mr(V,e)?V[e]:Ro("Symbol."+e)),Ee[e]},_o=N,Er=U,Sr=It,Po=rr,Ao=io,jo=P,Lo=TypeError,Co=jo("toPrimitive"),xo=function(e,r){if(!Er(e)||Sr(e))return e;var t=Po(e,Co),n;if(t){if(r===void 0&&(r="default"),n=_o(t,e,r),!Er(n)||Sr(n))return n;throw Lo("Can't convert object to primitive value")}return r===void 0&&(r="number"),Ao(e,r)},No=xo,Mo=It,tr=function(e){var r=No(e,"string");return Mo(r)?r:r+""},Do=x,Fo=Ot,Go=wt,Z=K,Tr=tr,Vo=TypeError,Se=Object.defineProperty,ko=Object.getOwnPropertyDescriptor,Te="enumerable",Ie="configurable",Re="writable";Q.f=Do?Go?function(r,t,n){if(Z(r),t=Tr(t),Z(n),typeof r=="function"&&t==="prototype"&&"value"in n&&Re in n&&!n[Re]){var a=ko(r,t);a&&a[Re]&&(r[t]=n.value,n={configurable:Ie in n?n[Ie]:a[Ie],enumerable:Te in n?n[Te]:a[Te],writable:!1})}return Se(r,t,n)}:Se:function(r,t,n){if(Z(r),t=Tr(t),Z(n),Fo)try{return Se(r,t,n)}catch(a){}if("get"in n||"set"in n)throw Vo("Accessors not supported");return"value"in n&&(r[t]=n.value),r};var fe=function(e,r){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:r}},Bo=x,Uo=Q,Qo=fe,z=Bo?function(e,r,t){return Uo.f(e,r,Qo(1,t))}:function(e,r,t){return e[r]=t,e},Ko=Pt,qo=jt,Ir=Ko("keys"),nr=function(e){return Ir[e]||(Ir[e]=qo(e))},ar={},Yo=Ia,Lt=S,Ho=U,zo=z,_e=A,Pe=_t,Wo=nr,Xo=ar,Rr="Object already initialized",Ve=Lt.TypeError,Jo=Lt.WeakMap,ce,q,ue,Zo=function(e){return ue(e)?q(e):ce(e,{})},ei=function(e){return function(r){var t;if(!Ho(r)||(t=q(r)).type!==e)throw Ve("Incompatible receiver, "+e+" required");return t}};if(Yo||Pe.state){var I=Pe.state||(Pe.state=new Jo);I.get=I.get,I.has=I.has,I.set=I.set,ce=function(e,r){if(I.has(e))throw Ve(Rr);return r.facade=e,I.set(e,r),r},q=function(e){return I.get(e)||{}},ue=function(e){return I.has(e)}}else{var M=Wo("state");Xo[M]=!0,ce=function(e,r){if(_e(e,M))throw Ve(Rr);return r.facade=e,zo(e,M,r),r},q=function(e){return _e(e,M)?e[M]:{}},ue=function(e){return _e(e,M)}}var ri={set:ce,get:q,has:ue,enforce:Zo,getterFor:ei},ti=ve,Ct=Function.prototype,_r=Ct.apply,Pr=Ct.call,ni=typeof Reflect=="object"&&Reflect.apply||(ti?Pr.bind(_r):function(){return Pr.apply(_r,arguments)}),ai=We,oi=C,xt=function(e){if(ai(e)==="Function")return oi(e)},Nt={},Mt={},Dt={}.propertyIsEnumerable,Ft=Object.getOwnPropertyDescriptor,ii=Ft&&!Dt.call({1:2},1);Mt.f=ii?function(r){var t=Ft(this,r);return!!t&&t.enumerable}:Dt;var si=x,li=N,ci=Mt,ui=fe,vi=H,fi=tr,di=A,hi=Ot,Ar=Object.getOwnPropertyDescriptor;Nt.f=si?Ar:function(r,t){if(r=vi(r),t=fi(t),hi)try{return Ar(r,t)}catch(n){}if(di(r,t))return ui(!li(ci.f,r,t),r[t])};var bi=_,pi=T,yi=/#|\.prototype\./,W=function(e,r){var t=Oi[gi(e)];return t==$i?!0:t==wi?!1:pi(r)?bi(r):!!r},gi=W.normalize=function(e){return String(e).replace(yi,".").toLowerCase()},Oi=W.data={},wi=W.NATIVE="N",$i=W.POLYFILL="P",mi=W,jr=xt,Ei=er,Si=ve,Ti=jr(jr.bind),Gt=function(e,r){return Ei(e),r===void 0?e:Si?Ti(e,r):function(){return e.apply(r,arguments)}},ee=S,Ii=ni,Ri=xt,_i=T,Pi=Nt.f,Ai=mi,D=Je,ji=Gt,F=z,Lr=A,Li=function(e){var r=function(t,n,a){if(this instanceof r){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,a)}return Ii(e,this,arguments)};return r.prototype=e.prototype,r},Vt=function(e,r){var t=e.target,n=e.global,a=e.stat,o=e.proto,i=n?ee:a?ee[t]:(ee[t]||{}).prototype,s=n?D:D[t]||F(D,t,{})[t],v=s.prototype,c,l,u,f,d,O,$,w,y;for(f in r)c=Ai(n?f:t+(a?".":"#")+f,e.forced),l=!c&&i&&Lr(i,f),O=s[f],l&&(e.dontCallGetSet?(y=Pi(i,f),$=y&&y.value):$=i[f]),d=l&&$?$:r[f],!(l&&typeof O==typeof d)&&(e.bind&&l?w=ji(d,ee):e.wrap&&l?w=Li(d):o&&_i(d)?w=Ri(d):w=d,(e.sham||d&&d.sham||O&&O.sham)&&F(w,"sham",!0),F(s,f,w),o&&(u=t+"Prototype",Lr(D,u)||F(D,u,{}),F(D[u],f,d),e.real&&v&&(c||!v[f])&&F(v,f,d)))},ke=x,Ci=A,kt=Function.prototype,xi=ke&&Object.getOwnPropertyDescriptor,or=Ci(kt,"name"),Ni=or&&function(){}.name==="something",Mi=or&&(!ke||ke&&xi(kt,"name").configurable),Di={EXISTS:or,PROPER:Ni,CONFIGURABLE:Mi},Bt={},Fi=Math.ceil,Gi=Math.floor,Vi=Math.trunc||function(r){var t=+r;return(t>0?Gi:Fi)(t)},ki=Vi,Ut=function(e){var r=+e;return r!==r||r===0?0:ki(r)},Bi=Ut,Ui=Math.max,Qi=Math.min,Ki=function(e,r){var t=Bi(e);return t<0?Ui(t+r,0):Qi(t,r)},qi=Ut,Yi=Math.min,Hi=function(e){return e>0?Yi(qi(e),9007199254740991):0},zi=Hi,Qt=function(e){return zi(e.length)},Wi=H,Xi=Ki,Ji=Qt,Cr=function(e){return function(r,t,n){var a=Wi(r),o=Ji(a),i=Xi(n,o),s;if(e&&t!=t){for(;o>i;)if(s=a[i++],s!=s)return!0}else for(;o>i;i++)if((e||i in a)&&a[i]===t)return e||i||0;return!e&&-1}},Zi={includes:Cr(!0),indexOf:Cr(!1)},es=C,Ae=A,rs=H,ts=Zi.indexOf,ns=ar,xr=es([].push),as=function(e,r){var t=rs(e),n=0,a=[],o;for(o in t)!Ae(ns,o)&&Ae(t,o)&&xr(a,o);for(;r.length>n;)Ae(t,o=r[n++])&&(~ts(a,o)||xr(a,o));return a},Kt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],os=as,is=Kt,ss=Object.keys||function(r){return os(r,is)},ls=x,cs=wt,us=Q,vs=K,fs=H,ds=ss;Bt.f=ls&&!cs?Object.defineProperties:function(r,t){vs(r);for(var n=fs(t),a=ds(t),o=a.length,i=0,s;o>i;)us.f(r,s=a[i++],n[s]);return r};var hs=$t,bs=hs("document","documentElement"),ps=K,ys=Bt,Nr=Kt,gs=ar,Os=bs,ws=gt,$s=nr,Mr=">",Dr="<",Be="prototype",Ue="script",qt=$s("IE_PROTO"),je=function(){},Yt=function(e){return Dr+Ue+Mr+e+Dr+"/"+Ue+Mr},Fr=function(e){e.write(Yt("")),e.close();var r=e.parentWindow.Object;return e=null,r},ms=function(){var e=ws("iframe"),r="java"+Ue+":",t;return e.style.display="none",Os.appendChild(e),e.src=String(r),t=e.contentWindow.document,t.open(),t.write(Yt("document.F=Object")),t.close(),t.F},re,oe=function(){try{re=new ActiveXObject("htmlfile")}catch(r){}oe=typeof document!="undefined"?document.domain&&re?Fr(re):ms():Fr(re);for(var e=Nr.length;e--;)delete oe[Be][Nr[e]];return oe()};gs[qt]=!0;var Ht=Object.create||function(r,t){var n;return r!==null?(je[Be]=ps(r),n=new je,je[Be]=null,n[qt]=r):n=oe(),t===void 0?n:ys.f(n,t)},Es=_,Ss=!Es(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),Ts=A,Is=T,Rs=At,_s=nr,Ps=Ss,Gr=_s("IE_PROTO"),Qe=Object,As=Qe.prototype,zt=Ps?Qe.getPrototypeOf:function(e){var r=Rs(e);if(Ts(r,Gr))return r[Gr];var t=r.constructor;return Is(t)&&r instanceof t?t.prototype:r instanceof Qe?As:null},js=z,Wt=function(e,r,t,n){return n&&n.enumerable?e[r]=t:js(e,r,t),e},Ls=_,Cs=T,xs=U,Ns=Ht,Vr=zt,Ms=Wt,Ds=P,Ke=Ds("iterator"),Xt=!1,R,Le,Ce;[].keys&&(Ce=[].keys(),"next"in Ce?(Le=Vr(Vr(Ce)),Le!==Object.prototype&&(R=Le)):Xt=!0);var Fs=!xs(R)||Ls(function(){var e={};return R[Ke].call(e)!==e});Fs?R={}:R=Ns(R);Cs(R[Ke])||Ms(R,Ke,function(){return this});var Jt={IteratorPrototype:R,BUGGY_SAFARI_ITERATORS:Xt},Gs=P,Vs=Gs("toStringTag"),Zt={};Zt[Vs]="z";var ir=String(Zt)==="[object z]",ks=ir,Bs=T,ie=We,Us=P,Qs=Us("toStringTag"),Ks=Object,qs=ie(function(){return arguments}())=="Arguments",Ys=function(e,r){try{return e[r]}catch(t){}},sr=ks?ie:function(e){var r,t,n;return e===void 0?"Undefined":e===null?"Null":typeof(t=Ys(r=Ks(e),Qs))=="string"?t:qs?ie(r):(n=ie(r))=="Object"&&Bs(r.callee)?"Arguments":n},Hs=ir,zs=sr,Ws=Hs?{}.toString:function(){return"[object "+zs(this)+"]"},Xs=ir,Js=Q.f,Zs=z,el=A,rl=Ws,tl=P,kr=tl("toStringTag"),en=function(e,r,t,n){if(e){var a=t?e:e.prototype;el(a,kr)||Js(a,kr,{configurable:!0,value:r}),n&&!Xs&&Zs(a,"toString",rl)}},nl=Jt.IteratorPrototype,al=Ht,ol=fe,il=en,sl=B,ll=function(){return this},cl=function(e,r,t,n){var a=r+" Iterator";return e.prototype=al(nl,{next:ol(+!n,t)}),il(e,a,!1,!0),sl[a]=ll,e},ul=Vt,vl=N,rn=Di,fl=cl,dl=zt,hl=en,Br=Wt,bl=P,Ur=B,tn=Jt,pl=rn.PROPER;rn.CONFIGURABLE;tn.IteratorPrototype;var te=tn.BUGGY_SAFARI_ITERATORS,xe=bl("iterator"),Qr="keys",ne="values",Kr="entries",yl=function(){return this},gl=function(e,r,t,n,a,o,i){fl(t,r,n);var s=function(y){if(y===a&&f)return f;if(!te&&y in l)return l[y];switch(y){case Qr:return function(){return new t(this,y)};case ne:return function(){return new t(this,y)};case Kr:return function(){return new t(this,y)}}return function(){return new t(this)}},v=r+" Iterator",c=!1,l=e.prototype,u=l[xe]||l["@@iterator"]||a&&l[a],f=!te&&u||s(a),d=r=="Array"&&l.entries||u,O,$,w;if(d&&(O=dl(d.call(new e)),O!==Object.prototype&&O.next&&(hl(O,v,!0,!0),Ur[v]=yl)),pl&&a==ne&&u&&u.name!==ne&&(c=!0,f=function(){return vl(u,this)}),a)if($={values:s(ne),keys:o?f:s(Qr),entries:s(Kr)},i)for(w in $)(te||c||!(w in l))&&Br(l,w,$[w]);else ul({target:r,proto:!0,forced:te||c},$);return i&&l[xe]!==f&&Br(l,xe,f,{name:a}),Ur[r]=f,$},Ol=function(e,r){return{value:e,done:r}},wl=H,qr=B,nn=ri;Q.f;var $l=gl,ae=Ol,an="Array Iterator",ml=nn.set,El=nn.getterFor(an);$l(Array,"Array",function(e,r){ml(this,{type:an,target:wl(e),index:0,kind:r})},function(){var e=El(this),r=e.target,t=e.kind,n=e.index++;return!r||n>=r.length?(e.target=void 0,ae(void 0,!0)):t=="keys"?ae(n,!1):t=="values"?ae(r[n],!1):ae([n,r[n]],!1)},"values");qr.Arguments=qr.Array;var Sl=P,Tl=B,Il=Sl("iterator"),Rl=Array.prototype,_l=function(e){return e!==void 0&&(Tl.Array===e||Rl[Il]===e)},Pl=sr,Yr=rr,Al=Xe,jl=B,Ll=P,Cl=Ll("iterator"),on=function(e){if(!Al(e))return Yr(e,Cl)||Yr(e,"@@iterator")||jl[Pl(e)]},xl=N,Nl=er,Ml=K,Dl=Ze,Fl=on,Gl=TypeError,Vl=function(e,r){var t=arguments.length<2?Fl(e):r;if(Nl(t))return Ml(xl(t,e));throw Gl(Dl(e)+" is not iterable")},kl=N,Hr=K,Bl=rr,Ul=function(e,r,t){var n,a;Hr(e);try{if(n=Bl(e,"return"),!n){if(r==="throw")throw t;return t}n=kl(n,e)}catch(o){a=!0,n=o}if(r==="throw")throw t;if(a)throw n;return Hr(n),t},Ql=Gt,Kl=N,ql=K,Yl=Ze,Hl=_l,zl=Qt,zr=mt,Wl=Vl,Xl=on,Wr=Ul,Jl=TypeError,se=function(e,r){this.stopped=e,this.result=r},Xr=se.prototype,Zl=function(e,r,t){var n=t&&t.that,a=!!(t&&t.AS_ENTRIES),o=!!(t&&t.IS_RECORD),i=!!(t&&t.IS_ITERATOR),s=!!(t&&t.INTERRUPTED),v=Ql(r,n),c,l,u,f,d,O,$,w=function(g){return c&&Wr(c,"normal",g),new se(!0,g)},y=function(g){return a?(ql(g),s?v(g[0],g[1],w):v(g[0],g[1])):s?v(g,w):v(g)};if(o)c=e.iterator;else if(i)c=e;else{if(l=Xl(e),!l)throw Jl(Yl(e)+" is not iterable");if(Hl(l)){for(u=0,f=zl(e);f>u;u++)if(d=y(e[u]),d&&zr(Xr,d))return d;return new se(!1)}c=Wl(e,l)}for(O=o?e.next:c.next;!($=Kl(O,c)).done;){try{d=y($.value)}catch(g){Wr(c,"throw",g)}if(typeof d=="object"&&d&&zr(Xr,d))return d}return new se(!1)},ec=tr,rc=Q,tc=fe,nc=function(e,r,t){var n=ec(r);n in e?rc.f(e,n,tc(0,t)):e[n]=t},ac=Vt,oc=Zl,ic=nc;ac({target:"Object",stat:!0},{fromEntries:function(r){var t={};return oc(r,function(n,a){ic(t,n,a)},{AS_ENTRIES:!0}),t}});var sc=Je,lc=sc.Object.fromEntries,cc={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},uc=cc,vc=S,fc=sr,dc=z,Jr=B,hc=P,Zr=hc("toStringTag");for(var Ne in uc){var et=vc[Ne],Me=et&&et.prototype;Me&&fc(Me)!==Zr&&dc(Me,Zr,Ne),Jr[Ne]=Jr.Array}var bc=lc,pc=bc,yc=pc,gc=yc,Oc=la(gc);exports.VKNumericLanguage=void 0;(function(e){e.Armenian="58",e.Azerbaijani="57",e.Belarusian="114",e.English="3",e.Kazakh="97",e.Portuguese="73",e.Russian="0",e.Spanish="4",e.Ukrainian="1",e.Uzbek="65",e.Vietnamese="75"})(exports.VKNumericLanguage||(exports.VKNumericLanguage={}));const wc="vk.com",$c=(e,r,t)=>nt(void 0,void 0,void 0,function*(){const n=new URL(`https://${wc}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",r),e!==void 0&&n.searchParams.set("lang",e);const o=yield(yield sa(n.toString())).json();return mc(o,t)}),mc=(e,r)=>Oc(Object.entries(e.keys).map(([t,n])=>[t.substring(`${r}_`.length),Ec(n)])),Ec=e=>Array.isArray(e)?e[0]:e;exports.InterfaceLanguage=void 0;(function(e){e.RU="ru",e.EN="en"})(exports.InterfaceLanguage||(exports.InterfaceLanguage={}));exports.Logger=cn;exports.Observable=b;exports.Subject=qe;exports.Subscription=Y;exports.VERSION=sn;exports.ValueSubject=Cn;exports.abortable=hn;exports.addScript=fn;exports.areQualitiesExact=jn;exports.assertNever=L;exports.assertNonNullable=un;exports.assertNullable=vn;exports.assertQualityIsExact=Ln;exports.buffer=Vn;exports.checkNever=ln;exports.combine=xn;exports.debounce=Un;exports.fillWithDefault=it;exports.filter=Hn;exports.filterChanged=Wn;exports.fromEvent=Gn;exports.getCurrentBrowser=at;exports.getExponentialDelay=pn;exports.getHighestQuality=Rn;exports.interval=Dn;exports.isHigher=Sn;exports.isHigherOrEqual=Tn;exports.isIOS=bn;exports.isInvariantQuality=He;exports.isLower=Ye;exports.isLowerOrEqual=In;exports.isNonNullable=rt;exports.isNullable=tt;exports.loadVKLangPack=$c;exports.map=st;exports.mapTo=Zn;exports.merge=Nn;exports.noop=G;exports.now=dn;exports.observableFrom=Fn;exports.once=ea;exports.pairwise=ra;exports.safeStorage=En;exports.tap=na;exports.throttle=qn;exports.timeout=Mn;exports.videoHeightToQuality=_n;exports.videoQualityToHeight=An;exports.videoSizeToQuality=Pn;
package/es2015.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.27
3
- * Fri, 18 Aug 2023 12:34:43 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-27/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.28
3
+ * Tue, 29 Aug 2023 12:41:47 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-28/doc/
5
5
  */
6
- const tt="1.0.27";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 m=e=>{throw new Error(`${e} is value of unexpected type`)},et=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 s=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 r;try{r=this._subscribe(s)}catch(a){(n=s.error)===null||n===void 0||n.call(s,a)}return new S().add(()=>{switch(s.next=x,s.error=x,typeof r){case"function":r();return;case"object":r.unsubscribe();return;case"undefined":return;default:return m(r)}})}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 it{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 nt(e,t='Assertion "value is not nullable" failed'){if(e==null)throw new Error(t)}function st(e,t='Assertion "value is nullable" failed'){if(e!=null)throw new Error(t)}function M(e){return typeof e!="undefined"&&e!==null}function Q(e){return e==null}const rt=(e,t,i)=>new Promise((n,o)=>{t.addEventListener("abort",()=>{a(),f.remove()});const s=()=>{a(),o()},r=()=>{a(),n()},a=()=>{h&&clearTimeout(h),f.removeEventListener("load",r),f.removeEventListener("error",s)};let h;i&&(h=window.setTimeout(s,i));const f=document.createElement("script");f.addEventListener("load",r),f.addEventListener("error",s),f.src=e,document.head.appendChild(f)});var O;const ot=typeof((O=window.performance)===null||O===void 0?void 0:O.now)=="function"?()=>window.performance.now():()=>Date.now();function G(e,t,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(v){try{f(n.next(v))}catch(_){r(_)}}function h(v){try{f(n.throw(v))}catch(_){r(_)}}function f(v){v.done?s(v.value):o(v.value).then(a,h)}f((n=n.apply(e,t||[])).next())})}const at=(e,t)=>(...i)=>G(void 0,void 0,void 0,function*(){var n;const o=t(...i);let s=e.aborted,r;for(;!s&&!e.aborted;){const a=yield o.next(r);s=(n=a.done)!==null&&n!==void 0?n:!1,r=a.value}return r});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 ct=()=>{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,s=/webkit|safari|khtml/i.test(e)?w.Safari:void 0,r=/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,P=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?g.RestMobile:void 0;return{browser:t||o||r||a||i||n||s||w.Rest,device:h||f||v||_||P||g.Desktop}},ut=(e,{start:t=0,factor:i=2,max:n=1/0,min:o=t,random:s=0}={})=>{let r=t;return r*=Math.pow(i,e),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(e){e[e.LOCAL_STORAGE=0]="LOCAL_STORAGE",e[e.SESSION_STORAGE=1]="SESSION_STORAGE",e[e.RUNTIME=2]="RUNTIME"})(c||(c={}));let u,p;const A=`vk-videoplayer-dummy-key-${Math.random()}`,E=()=>{if(p!==void 0)return p;try{localStorage.setItem(A,"test"),localStorage.removeItem(A),p=c.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(A),p=c.SESSION_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)p=c.RUNTIME;else throw t}else throw e}return p===c.RUNTIME&&(u=new Map),p},V=()=>E()===c.LOCAL_STORAGE,k=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:m(n)}},U=(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:m(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 m(i),!1}},F=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:m(t)}},D=()=>{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:m(e)}};var lt=Object.freeze({__proto__:null,clear:D,get:k,has:j,isPersistent:V,remove:F,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 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}},dt=(e,t)=>b[e].height>b[t].height,ht=(e,t)=>b[e].height>=b[t].height,R=(e,t)=>b[e].height<b[t].height,ft=(e,t)=>b[e].height<=b[t].height,bt=e=>e.sort((t,i)=>t===i?0:t===d.INVARIANT?1:i===d.INVARIANT?-1:R(t,i)?1:-1)[0],y=Object.keys(b).sort((e,t)=>R(e,t)?-1:1),wt=(e,t=.02)=>[...y].find(n=>b[n].height*(1+t)>=e),vt=({width:e,height:t})=>{const i=Math.min(e,t),n=Math.max(e,t);return y.find(o=>{const s=b[o];return s.width>=n&&s.height>=i})},gt=e=>b[e].height,N=e=>e===d.INVARIANT,pt=e=>e.every(t=>!N(t));function mt(e){if(N(e))throw new Error("Expected exact quality")}const q=(e,t)=>{const i={};for(const n of Object.keys(t)){const o=t[n],s=e[n];Array.isArray(o)&&Array.isArray(s)?i[n]=s:typeof o=="object"&&typeof s=="object"?i[n]=q(s,o):i[n]=n in e?s:o}return i};class Et 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 _t(e){return new l(t=>{const i={};let n=Object.keys(e).length;const o=s=>r=>{s in i||n--,i[s]=r,n===0&&t.next(i)};return Object.entries(e).reduce((s,[r,a])=>s.add(a.subscribe(o(r))),new S)})}function xt(...e){return new l(t=>e.reduce((i,n)=>i.add(n.subscribe(t)),new S))}var St=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)}),Ot=e=>new l(t=>{const i=window.setInterval(()=>t.next(),e);return()=>window.clearInterval(i)}),At=e=>new l(t=>{e.forEach(i=>t.next(i))}),Tt=(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 z(i,e)))}class z{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 $={leading:!1,trailing:!0};function Lt(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,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 Y={leading:!0,trailing:!1};function Rt(e,t=Y){return i=>new l(n=>i.subscribe(new K(n,e,t)))}class K{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 yt(e){return t=>new l(i=>t.subscribe(new W(i,e)))}class W{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 C(i,e)))}const T={};class C{constructor(t,i){this.destination=t,this.predicate=i,this.lastValue=T}next(t){let i;try{i=this.lastValue===T||!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 X(e){return t=>new l(i=>t.subscribe(new J(i,e)))}let J=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 X(()=>e)}function Qt(){return e=>new l(t=>{let i=!1,n=!1;const o=e.subscribe(s=>{i||(i=!0,t.next(s)),n&&o.unsubscribe()},s=>{var r;i=!0,(r=t.error)===null||r===void 0||r.call(t,s),n&&o.unsubscribe()});return n=!0,i&&o.unsubscribe(),o})}function Gt(){return e=>new l(t=>e.subscribe(new Z(t)))}class Z{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 B(i,e)))}class B{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={}));export{w as CurrentClientBrowser,g as CurrentClientDevice,I as ErrorCategory,it as Logger,l as Observable,L as Subject,S as Subscription,tt as VERSION,Et as ValueSubject,d as VideoQuality,at as abortable,rt as addScript,pt as areQualitiesExact,m as assertNever,nt as assertNonNullable,st as assertNullable,mt as assertQualityIsExact,It as buffer,et as checkNever,_t as combine,Lt as debounce,q as fillWithDefault,yt as filter,Nt as filterChanged,Tt as fromEvent,ct as getCurrentBrowser,ut as getExponentialDelay,bt as getHighestQuality,Ot as interval,dt as isHigher,ht as isHigherOrEqual,N as isInvariantQuality,R as isLower,ft as isLowerOrEqual,M as isNonNullable,Q as isNullable,X as map,Mt as mapTo,xt as merge,x as noop,ot as now,At as observableFrom,Qt as once,Gt as pairwise,lt as safeStorage,Vt as tap,Rt as throttle,St as timeout,wt as videoHeightToQuality,gt as videoQualityToHeight,vt as videoSizeToQuality};
6
+ const zc="1.0.28";class dr{constructor(){this.subscriptions=[]}unsubscribe(){const e=this.subscriptions;this.subscriptions=[],e.forEach(t=>typeof t=="function"?t():t.unsubscribe())}add(e){return this.subscriptions.push(e),this}}const V=r=>{throw new Error(`${r} is value of unexpected type`)},Qc=r=>{},Q=()=>{};class b{constructor(e){e&&(this._subscribe=e)}subscribe(e,t){var n;let a;t?typeof t=="function"?a={next:t,error:Q}:a={next:s=>t.next(s),error:s=>{var v;return(v=t.error)===null||v===void 0?void 0:v.call(t,s)}}:a={next:Q,error:Q};const o=typeof e=="function"?{next:s=>{try{e(s)}catch(v){a.next(v)}},error:s=>a.next(s)}:{next:s=>e.next(s),error:s=>e.error?e.error(s):a.next(s)};let i;try{i=this._subscribe(o)}catch(s){(n=o.error)===null||n===void 0||n.call(o,s)}return new dr().add(()=>{switch(o.next=Q,o.error=Q,typeof i){case"function":i();return;case"object":i.unsubscribe();return;case"undefined":return;default:return V(i)}})}pipe(...e){return e.reduce((t,n)=>n(t),this)}_subscribe(e){}}class at extends b{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>{var n;return(n=t.error)===null||n===void 0?void 0:n.call(t,e)})}_subscribe(e){const t=this.keyCounter++;return this.subscribers.set(t,e),new dr().add(()=>this.subscribers.delete(t))}}class Wc{constructor(){this.log$=new at,this.logs=[],this.log=e=>{const t=Object.assign(Object.assign({},e),{timestamp:Date.now()});this.logs.push(t),this.log$.next(t)},this.getAllLogs=()=>this.logs}createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch(a){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>Object.assign({component:e},t))}}function Hc(r,e='Assertion "value is not nullable" failed'){if(r==null)throw new Error(e)}function Xc(r,e='Assertion "value is nullable" failed'){if(r!=null)throw new Error(e)}function cn(r){return typeof r!="undefined"&&r!==null}function ln(r){return r==null}const Jc=(r,e,t)=>new Promise((n,a)=>{e.addEventListener("abort",()=>{s(),l.remove()});const o=()=>{s(),a()},i=()=>{s(),n()},s=()=>{v&&clearTimeout(v),l.removeEventListener("load",i),l.removeEventListener("error",o)};let v;t&&(v=window.setTimeout(o,t));const l=document.createElement("script");l.addEventListener("load",i),l.addEventListener("error",o),l.src=r,document.head.appendChild(l)});var br;const Zc=typeof((br=window.performance)===null||br===void 0?void 0:br.now)=="function"?()=>window.performance.now():()=>Date.now();function ot(r,e,t,n){function a(o){return o instanceof t?o:new t(function(i){i(o)})}return new(t||(t=Promise))(function(o,i){function s(c){try{l(n.next(c))}catch(u){i(u)}}function v(c){try{l(n.throw(c))}catch(u){i(u)}}function l(c){c.done?o(c.value):a(c.value).then(s,v)}l((n=n.apply(r,e||[])).next())})}const rl=(r,e)=>(...t)=>ot(void 0,void 0,void 0,function*(){var n;const a=e(...t);let o=r.aborted,i;for(;!o&&!r.aborted;){const s=yield a.next(i);o=(n=s.done)!==null&&n!==void 0?n:!1,i=s.value}return i});var P;(function(r){r.Unknown="Unknown",r.Yandex="Yandex",r.Chrome="Chrome",r.Chromium="Chromium",r.Firefox="Firefox",r.Safari="Safari",r.Opera="Opera",r.Edge="Edge",r.Rest="Rest"})(P||(P={}));var S;(function(r){r.Unknown="Unknown",r.Android="Android",r.iPhone="iPhone",r.iPad="iPad",r.iPod="iPod",r.RestMobile="RestMobile",r.Desktop="Desktop"})(S||(S={}));const un=()=>{const{userAgent:r}=window.navigator,e=/yabrowser/i.test(r)?P.Yandex:void 0,t=/chrome|crios/i.test(r)?P.Chrome:void 0,n=/chromium/i.test(r)?P.Chromium:void 0,a=/firefox|fxios/i.test(r)?P.Firefox:void 0,o=/webkit|safari|khtml/i.test(r)?P.Safari:void 0,i=/opr\//i.test(r)?P.Opera:void 0,s=/edg/i.test(r)?P.Edge:void 0,v=/android/i.test(r)?S.Android:void 0,l=/iphone/i.test(r)?S.iPhone:void 0,c=/ipad/i.test(r)?S.iPad:void 0,u=/ipod/i.test(r)?S.iPod:void 0,f=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(r)?S.RestMobile:void 0;return{browser:e||a||i||s||t||n||o||P.Rest,device:v||l||c||u||f||S.Desktop}},el=()=>[S.iPhone,S.iPad,S.iPod].includes(un().device),tl=(r,{start:e=0,factor:t=2,max:n=1/0,min:a=e,random:o=0}={})=>{let i=e;return i*=Math.pow(t,r),i*=1+(Math.random()*o*2-o),i=Math.round(i),i=Math.min(i,n),i=Math.max(i,a),i};var h;(function(r){r[r.LOCAL_STORAGE=0]="LOCAL_STORAGE",r[r.SESSION_STORAGE=1]="SESSION_STORAGE",r[r.RUNTIME=2]="RUNTIME"})(h||(h={}));let p,M;const yr=`vk-videoplayer-dummy-key-${Math.random()}`,B=()=>{if(M!==void 0)return M;try{localStorage.setItem(yr,"test"),localStorage.removeItem(yr),M=h.LOCAL_STORAGE}catch(r){if(r instanceof DOMException||r instanceof TypeError)try{sessionStorage.getItem(yr),M=h.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)M=h.RUNTIME;else throw e}else throw r}return M===h.RUNTIME&&(p=new Map),M},vn=()=>B()===h.LOCAL_STORAGE,fn=r=>{var e,t;const n=B();switch(n){case h.LOCAL_STORAGE:return(e=localStorage.getItem(r))!==null&&e!==void 0?e:void 0;case h.SESSION_STORAGE:return(t=sessionStorage.getItem(r))!==null&&t!==void 0?t:void 0;case h.RUNTIME:return p==null?void 0:p.get(r);default:V(n)}},dn=(r,e)=>{const t=B();switch(t){case h.LOCAL_STORAGE:try{localStorage.setItem(r,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case h.SESSION_STORAGE:try{sessionStorage.setItem(r,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case h.RUNTIME:return void(p==null?void 0:p.set(r,e));default:V(t)}},hn=r=>{var e;const t=B();switch(t){case h.LOCAL_STORAGE:return r in localStorage;case h.SESSION_STORAGE:return r in sessionStorage;case h.RUNTIME:return(e=p==null?void 0:p.has(r))!==null&&e!==void 0?e:!1;default:return V(t),!1}},pn=r=>{const e=B();switch(e){case h.LOCAL_STORAGE:return localStorage.removeItem(r);case h.SESSION_STORAGE:return sessionStorage.removeItem(r);case h.RUNTIME:return void(p==null?void 0:p.delete(r));default:V(e)}},bn=()=>{const r=B();switch(r){case h.LOCAL_STORAGE:return localStorage.clear();case h.SESSION_STORAGE:return sessionStorage.clear();case h.RUNTIME:return p==null?void 0:p.clear();default:V(r)}};var nl=Object.freeze({__proto__:null,clear:bn,get:fn,has:hn,isPersistent:vn,remove:pn,set:dn}),m;(function(r){r.INVARIANT="Invariant quality",r.Q_144P="144p",r.Q_240P="240p",r.Q_360P="360p",r.Q_480P="480p",r.Q_720P="720p",r.Q_1080P="1080p",r.Q_1440P="1440p",r.Q_2160P="2160p",r.Q_4320P="4320p"})(m||(m={}));const E={[m.Q_144P]:{width:256,height:144},[m.Q_240P]:{width:428,height:240},[m.Q_360P]:{width:640,height:360},[m.Q_480P]:{width:856,height:480},[m.Q_720P]:{width:1280,height:720},[m.Q_1080P]:{width:1920,height:1080},[m.Q_1440P]:{width:2560,height:1440},[m.Q_2160P]:{width:3840,height:2160},[m.Q_4320P]:{width:7680,height:4320}},al=(r,e)=>E[r].height>E[e].height,ol=(r,e)=>E[r].height>=E[e].height,it=(r,e)=>E[r].height<E[e].height,il=(r,e)=>E[r].height<=E[e].height,sl=r=>r.sort((e,t)=>e===t?0:e===m.INVARIANT?1:t===m.INVARIANT?-1:it(e,t)?1:-1)[0],st=Object.keys(E).sort((r,e)=>it(r,e)?-1:1),cl=(r,e=.02)=>[...st].find(n=>E[n].height*(1+e)>=r),ll=({width:r,height:e})=>{const t=Math.min(r,e),n=Math.max(r,e);return st.find(a=>{const o=E[a];return o.width>=n&&o.height>=t})},ul=r=>E[r].height,ct=r=>r===m.INVARIANT,vl=r=>r.every(e=>!ct(e));function fl(r){if(ct(r))throw new Error("Expected exact quality")}const yn=(r,e)=>{const t={};for(const n of Object.keys(e)){const a=e[n],o=r[n];Array.isArray(a)&&Array.isArray(o)?t[n]=o:typeof a=="object"&&typeof o=="object"?t[n]=yn(o,a):t[n]=n in r?o:a}return t};class dl extends at{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 t=super._subscribe(e);return e.next(this.value),t}}function hl(r){return new b(e=>{const t={};let n=Object.keys(r).length;const a=o=>i=>{o in t||n--,t[o]=i,n===0&&e.next(t)};return Object.entries(r).reduce((o,[i,s])=>o.add(s.subscribe(a(i))),new dr)})}function pl(...r){return new b(e=>r.reduce((t,n)=>t.add(n.subscribe(e)),new dr))}var bl=r=>new b(e=>{const t=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},r);return()=>window.clearTimeout(t)}),yl=r=>new b(e=>{const t=window.setInterval(()=>e.next(),r);return()=>window.clearInterval(t)}),gl=r=>new b(e=>{r.forEach(t=>e.next(t))}),Ol=(r,e)=>new b(t=>{const n=a=>t.next(a);return r.addEventListener(e,n),()=>r.removeEventListener(e,n)});function $l(r){return e=>new b(t=>e.subscribe(new gn(t,r)))}class gn{constructor(e,t){this.destination=e,this.size=t,this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}const On={leading:!1,trailing:!0};function ml(r,e=On){return t=>new b(n=>t.subscribe(new $n(n,r,e)))}class $n{constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,cn(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(t){if(this.destination.error)this.destination.error(t);else throw t}this.timeout=void 0},this.time)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}const mn={leading:!0,trailing:!1};function wl(r,e=mn){return t=>new b(n=>t.subscribe(new wn(n,r,e)))}class wn{constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,ln(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 t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}function El(r){return e=>new b(t=>e.subscribe(new En(t,r)))}class En{constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(n){throw this.error(n),n}t&&this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}function Sl(r=(e,t)=>e===t){return e=>new b(t=>e.subscribe(new Sn(t,r)))}const ce={};class Sn{constructor(e,t){this.destination=e,this.predicate=t,this.lastValue=ce}next(e){let t;try{t=this.lastValue===ce||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}t&&this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}function Tn(r){return e=>new b(t=>e.subscribe(new In(t,r)))}let In=class{constructor(e,t){this.destination=e,this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(t)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}};function Il(r){return Tn(()=>r)}function Rl(){return r=>new b(e=>{let t=!1,n=!1;const a=r.subscribe(o=>{t||(t=!0,e.next(o)),n&&a.unsubscribe()},o=>{var i;t=!0,(i=e.error)===null||i===void 0||i.call(e,o),n&&a.unsubscribe()});return n=!0,t&&a.unsubscribe(),a})}function _l(){return r=>new b(e=>r.subscribe(new Rn(e)))}class Rn{constructor(e){this.destination=e,this.hasLast=!1}next(e){const t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}function Pl(r){return e=>new b(t=>e.subscribe(new _n(t,r)))}class _n{constructor(e,t){this.destination=e,this.effect=t}next(e){try{this.effect(e)}catch(t){throw this.error(t),t}this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}var le;(function(r){r.NETWORK="network",r.VIDEO_PIPELINE="video_pipeline",r.EXTERNAL_API="external_api",r.PARSER="parser",r.DOM="dom",r.WTF="wtf"})(le||(le={}));class ue{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(e,t,n){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:t,options:n})}removeEventListener(e,t){if(!(e in this.listeners))return;const n=this.listeners[e];for(let a=0,o=n.length;a<o;a++)if(n[a].callback===t){n.splice(a,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;const n=this.listeners[e.type].slice();for(let a=0,o=n.length;a<o;a++){const i=n[a];try{i.callback.call(this,e)}catch(s){Promise.resolve().then(()=>{throw s})}i.options&&i.options.once&&this.removeEventListener(e.type,i.callback)}return!e.defaultPrevented}}class lt extends ue{constructor(){super(),this.listeners||ue.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(e){e.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,e)),super.dispatchEvent(e)}}class Pn{constructor(){Object.defineProperty(this,"signal",{value:new lt,writable:!0,configurable:!0})}abort(e){let t;try{t=new Event("abort")}catch(a){typeof document!="undefined"?document.createEvent?(t=document.createEvent("Event"),t.initEvent("abort",!1,!1)):(t=document.createEventObject(),t.type="abort"):t={type:"abort",bubbles:!1,cancelable:!1}}let n=e;if(n===void 0)if(typeof document=="undefined")n=new Error("This operation was aborted"),n.name="AbortError";else try{n=new DOMException("signal is aborted without reason")}catch(a){n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(t)}toString(){return"[object AbortController]"}}typeof Symbol!="undefined"&&Symbol.toStringTag&&(Pn.prototype[Symbol.toStringTag]="AbortController",lt.prototype[Symbol.toStringTag]="AbortSignal");function ut(r){return r.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof r.Request=="function"&&!r.Request.prototype.hasOwnProperty("signal")||!r.AbortController}function An(r){typeof r=="function"&&(r={fetch:r});const{fetch:e,Request:t=e.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a=!1}=r;if(!ut({fetch:e,Request:t,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a}))return{fetch:e,Request:o};let o=t;(o&&!o.prototype.hasOwnProperty("signal")||a)&&(o=function(l,c){let u;c&&c.signal&&(u=c.signal,delete c.signal);const f=new t(l,c);return u&&Object.defineProperty(f,"signal",{writable:!1,enumerable:!1,configurable:!0,value:u}),f},o.prototype=t.prototype);const i=e;return{fetch:(v,l)=>{const c=o&&o.prototype.isPrototypeOf(v)?v.signal:l?l.signal:void 0;if(c){let u;try{u=new DOMException("Aborted","AbortError")}catch(d){u=new Error("Aborted"),u.name="AbortError"}if(c.aborted)return Promise.reject(u);const f=new Promise((d,O)=>{c.addEventListener("abort",()=>O(u),{once:!0})});return l&&l.signal&&delete l.signal,Promise.race([f,i(v,l)])}return i(v,l)},Request:o}}const Wr=ut({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),vt=Wr?An({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,jn=Wr?vt.fetch:window.fetch;Wr?vt.Request:window.Request;var gr=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Ln(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var j=function(r){try{return!!r()}catch(e){return!0}},xn=j,hr=!xn(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")}),ft=hr,dt=Function.prototype,kr=dt.call,Mn=ft&&dt.bind.bind(kr,kr),N=ft?Mn:function(r){return function(){return kr.apply(r,arguments)}},ht=N,Nn=ht({}.toString),Cn=ht("".slice),Hr=function(r){return Cn(Nn(r),8,-1)},Gn=N,Fn=j,Dn=Hr,Or=Object,kn=Gn("".split),Un=Fn(function(){return!Or("z").propertyIsEnumerable(0)})?function(r){return Dn(r)=="String"?kn(r,""):Or(r)}:Or,Xr=function(r){return r==null},Vn=Xr,Bn=TypeError,pt=function(r){if(Vn(r))throw Bn("Can't call method on "+r);return r},Kn=Un,qn=pt,H=function(r){return Kn(qn(r))},K={},Z=function(r){return r&&r.Math==Math&&r},I=Z(typeof globalThis=="object"&&globalThis)||Z(typeof window=="object"&&window)||Z(typeof self=="object"&&self)||Z(typeof gr=="object"&&gr)||function(){return this}()||gr||Function("return this")(),Ur=typeof document=="object"&&document.all,Yn=typeof Ur=="undefined"&&Ur!==void 0,bt={all:Ur,IS_HTMLDDA:Yn},yt=bt,zn=yt.all,R=yt.IS_HTMLDDA?function(r){return typeof r=="function"||r===zn}:function(r){return typeof r=="function"},Qn=I,Wn=R,ve=Qn.WeakMap,Hn=Wn(ve)&&/native code/.test(String(ve)),fe=R,gt=bt,Xn=gt.all,q=gt.IS_HTMLDDA?function(r){return typeof r=="object"?r!==null:fe(r)||r===Xn}:function(r){return typeof r=="object"?r!==null:fe(r)},Jn=j,C=!Jn(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),Y={},Zn=I,de=q,Vr=Zn.document,ra=de(Vr)&&de(Vr.createElement),Ot=function(r){return ra?Vr.createElement(r):{}},ea=C,ta=j,na=Ot,$t=!ea&&!ta(function(){return Object.defineProperty(na("div"),"a",{get:function(){return 7}}).a!=7}),aa=C,oa=j,mt=aa&&oa(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),ia=q,sa=String,ca=TypeError,z=function(r){if(ia(r))return r;throw ca(sa(r)+" is not an object")},la=hr,rr=Function.prototype.call,G=la?rr.bind(rr):function(){return rr.apply(rr,arguments)},Jr={},$r=Jr,mr=I,ua=R,he=function(r){return ua(r)?r:void 0},wt=function(r,e){return arguments.length<2?he($r[r])||he(mr[r]):$r[r]&&$r[r][e]||mr[r]&&mr[r][e]},va=N,Et=va({}.isPrototypeOf),fa=typeof navigator!="undefined"&&String(navigator.userAgent)||"",St=I,wr=fa,pe=St.process,be=St.Deno,ye=pe&&pe.versions||be&&be.version,ge=ye&&ye.v8,T,ur;ge&&(T=ge.split("."),ur=T[0]>0&&T[0]<4?1:+(T[0]+T[1]));!ur&&wr&&(T=wr.match(/Edge\/(\d+)/),(!T||T[1]>=74)&&(T=wr.match(/Chrome\/(\d+)/),T&&(ur=+T[1])));var da=ur,Oe=da,ha=j,pa=I,ba=pa.String,Tt=!!Object.getOwnPropertySymbols&&!ha(function(){var r=Symbol();return!ba(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&Oe&&Oe<41}),ya=Tt,It=ya&&!Symbol.sham&&typeof Symbol.iterator=="symbol",ga=wt,Oa=R,$a=Et,ma=It,wa=Object,Rt=ma?function(r){return typeof r=="symbol"}:function(r){var e=ga("Symbol");return Oa(e)&&$a(e.prototype,wa(r))},Ea=String,Zr=function(r){try{return Ea(r)}catch(e){return"Object"}},Sa=R,Ta=Zr,Ia=TypeError,re=function(r){if(Sa(r))return r;throw Ia(Ta(r)+" is not a function")},Ra=re,_a=Xr,ee=function(r,e){var t=r[e];return _a(t)?void 0:Ra(t)},Er=G,Sr=R,Tr=q,Pa=TypeError,Aa=function(r,e){var t,n;if(e==="string"&&Sr(t=r.toString)&&!Tr(n=Er(t,r))||Sr(t=r.valueOf)&&!Tr(n=Er(t,r))||e!=="string"&&Sr(t=r.toString)&&!Tr(n=Er(t,r)))return n;throw Pa("Can't convert object to primitive value")},_t={exports:{}},$e=I,ja=Object.defineProperty,La=function(r,e){try{ja($e,r,{value:e,configurable:!0,writable:!0})}catch(t){$e[r]=e}return e},xa=I,Ma=La,me="__core-js_shared__",Na=xa[me]||Ma(me,{}),Pt=Na,we=Pt;(_t.exports=function(r,e){return we[r]||(we[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.31.0",mode:"pure",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.0/LICENSE",source:"https://github.com/zloirock/core-js"});var At=_t.exports,Ca=pt,Ga=Object,jt=function(r){return Ga(Ca(r))},Fa=N,Da=jt,ka=Fa({}.hasOwnProperty),x=Object.hasOwn||function(e,t){return ka(Da(e),t)},Ua=N,Va=0,Ba=Math.random(),Ka=Ua(1 .toString),Lt=function(r){return"Symbol("+(r===void 0?"":r)+")_"+Ka(++Va+Ba,36)},qa=I,Ya=At,Ee=x,za=Lt,Qa=Tt,Wa=It,U=qa.Symbol,Ir=Ya("wks"),Ha=Wa?U.for||U:U&&U.withoutSetter||za,L=function(r){return Ee(Ir,r)||(Ir[r]=Qa&&Ee(U,r)?U[r]:Ha("Symbol."+r)),Ir[r]},Xa=G,Se=q,Te=Rt,Ja=ee,Za=Aa,ro=L,eo=TypeError,to=ro("toPrimitive"),no=function(r,e){if(!Se(r)||Te(r))return r;var t=Ja(r,to),n;if(t){if(e===void 0&&(e="default"),n=Xa(t,r,e),!Se(n)||Te(n))return n;throw eo("Can't convert object to primitive value")}return e===void 0&&(e="number"),Za(r,e)},ao=no,oo=Rt,te=function(r){var e=ao(r,"string");return oo(e)?e:e+""},io=C,so=$t,co=mt,er=z,Ie=te,lo=TypeError,Rr=Object.defineProperty,uo=Object.getOwnPropertyDescriptor,_r="enumerable",Pr="configurable",Ar="writable";Y.f=io?co?function(e,t,n){if(er(e),t=Ie(t),er(n),typeof e=="function"&&t==="prototype"&&"value"in n&&Ar in n&&!n[Ar]){var a=uo(e,t);a&&a[Ar]&&(e[t]=n.value,n={configurable:Pr in n?n[Pr]:a[Pr],enumerable:_r in n?n[_r]:a[_r],writable:!1})}return Rr(e,t,n)}:Rr:function(e,t,n){if(er(e),t=Ie(t),er(n),so)try{return Rr(e,t,n)}catch(a){}if("get"in n||"set"in n)throw lo("Accessors not supported");return"value"in n&&(e[t]=n.value),e};var pr=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}},vo=C,fo=Y,ho=pr,X=vo?function(r,e,t){return fo.f(r,e,ho(1,t))}:function(r,e,t){return r[e]=t,r},po=At,bo=Lt,Re=po("keys"),ne=function(r){return Re[r]||(Re[r]=bo(r))},ae={},yo=Hn,xt=I,go=q,Oo=X,jr=x,Lr=Pt,$o=ne,mo=ae,_e="Object already initialized",Br=xt.TypeError,wo=xt.WeakMap,vr,W,fr,Eo=function(r){return fr(r)?W(r):vr(r,{})},So=function(r){return function(e){var t;if(!go(e)||(t=W(e)).type!==r)throw Br("Incompatible receiver, "+r+" required");return t}};if(yo||Lr.state){var _=Lr.state||(Lr.state=new wo);_.get=_.get,_.has=_.has,_.set=_.set,vr=function(r,e){if(_.has(r))throw Br(_e);return e.facade=r,_.set(r,e),e},W=function(r){return _.get(r)||{}},fr=function(r){return _.has(r)}}else{var F=$o("state");mo[F]=!0,vr=function(r,e){if(jr(r,F))throw Br(_e);return e.facade=r,Oo(r,F,e),e},W=function(r){return jr(r,F)?r[F]:{}},fr=function(r){return jr(r,F)}}var To={set:vr,get:W,has:fr,enforce:Eo,getterFor:So},Io=hr,Mt=Function.prototype,Pe=Mt.apply,Ae=Mt.call,Ro=typeof Reflect=="object"&&Reflect.apply||(Io?Ae.bind(Pe):function(){return Ae.apply(Pe,arguments)}),_o=Hr,Po=N,Nt=function(r){if(_o(r)==="Function")return Po(r)},Ct={},Gt={},Ft={}.propertyIsEnumerable,Dt=Object.getOwnPropertyDescriptor,Ao=Dt&&!Ft.call({1:2},1);Gt.f=Ao?function(e){var t=Dt(this,e);return!!t&&t.enumerable}:Ft;var jo=C,Lo=G,xo=Gt,Mo=pr,No=H,Co=te,Go=x,Fo=$t,je=Object.getOwnPropertyDescriptor;Ct.f=jo?je:function(e,t){if(e=No(e),t=Co(t),Fo)try{return je(e,t)}catch(n){}if(Go(e,t))return Mo(!Lo(xo.f,e,t),e[t])};var Do=j,ko=R,Uo=/#|\.prototype\./,J=function(r,e){var t=Bo[Vo(r)];return t==qo?!0:t==Ko?!1:ko(e)?Do(e):!!e},Vo=J.normalize=function(r){return String(r).replace(Uo,".").toLowerCase()},Bo=J.data={},Ko=J.NATIVE="N",qo=J.POLYFILL="P",Yo=J,Le=Nt,zo=re,Qo=hr,Wo=Le(Le.bind),kt=function(r,e){return zo(r),e===void 0?r:Qo?Wo(r,e):function(){return r.apply(e,arguments)}},tr=I,Ho=Ro,Xo=Nt,Jo=R,Zo=Ct.f,ri=Yo,D=Jr,ei=kt,k=X,xe=x,ti=function(r){var e=function(t,n,a){if(this instanceof e){switch(arguments.length){case 0:return new r;case 1:return new r(t);case 2:return new r(t,n)}return new r(t,n,a)}return Ho(r,this,arguments)};return e.prototype=r.prototype,e},Ut=function(r,e){var t=r.target,n=r.global,a=r.stat,o=r.proto,i=n?tr:a?tr[t]:(tr[t]||{}).prototype,s=n?D:D[t]||k(D,t,{})[t],v=s.prototype,l,c,u,f,d,O,w,$,y;for(f in e)l=ri(n?f:t+(a?".":"#")+f,r.forced),c=!l&&i&&xe(i,f),O=s[f],c&&(r.dontCallGetSet?(y=Zo(i,f),w=y&&y.value):w=i[f]),d=c&&w?w:e[f],!(c&&typeof O==typeof d)&&(r.bind&&c?$=ei(d,tr):r.wrap&&c?$=ti(d):o&&Jo(d)?$=Xo(d):$=d,(r.sham||d&&d.sham||O&&O.sham)&&k($,"sham",!0),k(s,f,$),o&&(u=t+"Prototype",xe(D,u)||k(D,u,{}),k(D[u],f,d),r.real&&v&&(l||!v[f])&&k(v,f,d)))},Kr=C,ni=x,Vt=Function.prototype,ai=Kr&&Object.getOwnPropertyDescriptor,oe=ni(Vt,"name"),oi=oe&&function(){}.name==="something",ii=oe&&(!Kr||Kr&&ai(Vt,"name").configurable),si={EXISTS:oe,PROPER:oi,CONFIGURABLE:ii},Bt={},ci=Math.ceil,li=Math.floor,ui=Math.trunc||function(e){var t=+e;return(t>0?li:ci)(t)},vi=ui,Kt=function(r){var e=+r;return e!==e||e===0?0:vi(e)},fi=Kt,di=Math.max,hi=Math.min,pi=function(r,e){var t=fi(r);return t<0?di(t+e,0):hi(t,e)},bi=Kt,yi=Math.min,gi=function(r){return r>0?yi(bi(r),9007199254740991):0},Oi=gi,qt=function(r){return Oi(r.length)},$i=H,mi=pi,wi=qt,Me=function(r){return function(e,t,n){var a=$i(e),o=wi(a),i=mi(n,o),s;if(r&&t!=t){for(;o>i;)if(s=a[i++],s!=s)return!0}else for(;o>i;i++)if((r||i in a)&&a[i]===t)return r||i||0;return!r&&-1}},Ei={includes:Me(!0),indexOf:Me(!1)},Si=N,xr=x,Ti=H,Ii=Ei.indexOf,Ri=ae,Ne=Si([].push),_i=function(r,e){var t=Ti(r),n=0,a=[],o;for(o in t)!xr(Ri,o)&&xr(t,o)&&Ne(a,o);for(;e.length>n;)xr(t,o=e[n++])&&(~Ii(a,o)||Ne(a,o));return a},Yt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Pi=_i,Ai=Yt,ji=Object.keys||function(e){return Pi(e,Ai)},Li=C,xi=mt,Mi=Y,Ni=z,Ci=H,Gi=ji;Bt.f=Li&&!xi?Object.defineProperties:function(e,t){Ni(e);for(var n=Ci(t),a=Gi(t),o=a.length,i=0,s;o>i;)Mi.f(e,s=a[i++],n[s]);return e};var Fi=wt,Di=Fi("document","documentElement"),ki=z,Ui=Bt,Ce=Yt,Vi=ae,Bi=Di,Ki=Ot,qi=ne,Ge=">",Fe="<",qr="prototype",Yr="script",zt=qi("IE_PROTO"),Mr=function(){},Qt=function(r){return Fe+Yr+Ge+r+Fe+"/"+Yr+Ge},De=function(r){r.write(Qt("")),r.close();var e=r.parentWindow.Object;return r=null,e},Yi=function(){var r=Ki("iframe"),e="java"+Yr+":",t;return r.style.display="none",Bi.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(Qt("document.F=Object")),t.close(),t.F},nr,sr=function(){try{nr=new ActiveXObject("htmlfile")}catch(e){}sr=typeof document!="undefined"?document.domain&&nr?De(nr):Yi():De(nr);for(var r=Ce.length;r--;)delete sr[qr][Ce[r]];return sr()};Vi[zt]=!0;var Wt=Object.create||function(e,t){var n;return e!==null?(Mr[qr]=ki(e),n=new Mr,Mr[qr]=null,n[zt]=e):n=sr(),t===void 0?n:Ui.f(n,t)},zi=j,Qi=!zi(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype}),Wi=x,Hi=R,Xi=jt,Ji=ne,Zi=Qi,ke=Ji("IE_PROTO"),zr=Object,rs=zr.prototype,Ht=Zi?zr.getPrototypeOf:function(r){var e=Xi(r);if(Wi(e,ke))return e[ke];var t=e.constructor;return Hi(t)&&e instanceof t?t.prototype:e instanceof zr?rs:null},es=X,Xt=function(r,e,t,n){return n&&n.enumerable?r[e]=t:es(r,e,t),r},ts=j,ns=R,as=q,os=Wt,Ue=Ht,is=Xt,ss=L,Qr=ss("iterator"),Jt=!1,A,Nr,Cr;[].keys&&(Cr=[].keys(),"next"in Cr?(Nr=Ue(Ue(Cr)),Nr!==Object.prototype&&(A=Nr)):Jt=!0);var cs=!as(A)||ts(function(){var r={};return A[Qr].call(r)!==r});cs?A={}:A=os(A);ns(A[Qr])||is(A,Qr,function(){return this});var Zt={IteratorPrototype:A,BUGGY_SAFARI_ITERATORS:Jt},ls=L,us=ls("toStringTag"),rn={};rn[us]="z";var ie=String(rn)==="[object z]",vs=ie,fs=R,cr=Hr,ds=L,hs=ds("toStringTag"),ps=Object,bs=cr(function(){return arguments}())=="Arguments",ys=function(r,e){try{return r[e]}catch(t){}},se=vs?cr:function(r){var e,t,n;return r===void 0?"Undefined":r===null?"Null":typeof(t=ys(e=ps(r),hs))=="string"?t:bs?cr(e):(n=cr(e))=="Object"&&fs(e.callee)?"Arguments":n},gs=ie,Os=se,$s=gs?{}.toString:function(){return"[object "+Os(this)+"]"},ms=ie,ws=Y.f,Es=X,Ss=x,Ts=$s,Is=L,Ve=Is("toStringTag"),en=function(r,e,t,n){if(r){var a=t?r:r.prototype;Ss(a,Ve)||ws(a,Ve,{configurable:!0,value:e}),n&&!ms&&Es(a,"toString",Ts)}},Rs=Zt.IteratorPrototype,_s=Wt,Ps=pr,As=en,js=K,Ls=function(){return this},xs=function(r,e,t,n){var a=e+" Iterator";return r.prototype=_s(Rs,{next:Ps(+!n,t)}),As(r,a,!1,!0),js[a]=Ls,r},Ms=Ut,Ns=G,tn=si,Cs=xs,Gs=Ht,Fs=en,Be=Xt,Ds=L,Ke=K,nn=Zt,ks=tn.PROPER;tn.CONFIGURABLE;nn.IteratorPrototype;var ar=nn.BUGGY_SAFARI_ITERATORS,Gr=Ds("iterator"),qe="keys",or="values",Ye="entries",Us=function(){return this},Vs=function(r,e,t,n,a,o,i){Cs(t,e,n);var s=function(y){if(y===a&&f)return f;if(!ar&&y in c)return c[y];switch(y){case qe:return function(){return new t(this,y)};case or:return function(){return new t(this,y)};case Ye:return function(){return new t(this,y)}}return function(){return new t(this)}},v=e+" Iterator",l=!1,c=r.prototype,u=c[Gr]||c["@@iterator"]||a&&c[a],f=!ar&&u||s(a),d=e=="Array"&&c.entries||u,O,w,$;if(d&&(O=Gs(d.call(new r)),O!==Object.prototype&&O.next&&(Fs(O,v,!0,!0),Ke[v]=Us)),ks&&a==or&&u&&u.name!==or&&(l=!0,f=function(){return Ns(u,this)}),a)if(w={values:s(or),keys:o?f:s(qe),entries:s(Ye)},i)for($ in w)(ar||l||!($ in c))&&Be(c,$,w[$]);else Ms({target:e,proto:!0,forced:ar||l},w);return i&&c[Gr]!==f&&Be(c,Gr,f,{name:a}),Ke[e]=f,w},Bs=function(r,e){return{value:r,done:e}},Ks=H,ze=K,an=To;Y.f;var qs=Vs,ir=Bs,on="Array Iterator",Ys=an.set,zs=an.getterFor(on);qs(Array,"Array",function(r,e){Ys(this,{type:on,target:Ks(r),index:0,kind:e})},function(){var r=zs(this),e=r.target,t=r.kind,n=r.index++;return!e||n>=e.length?(r.target=void 0,ir(void 0,!0)):t=="keys"?ir(n,!1):t=="values"?ir(e[n],!1):ir([n,e[n]],!1)},"values");ze.Arguments=ze.Array;var Qs=L,Ws=K,Hs=Qs("iterator"),Xs=Array.prototype,Js=function(r){return r!==void 0&&(Ws.Array===r||Xs[Hs]===r)},Zs=se,Qe=ee,rc=Xr,ec=K,tc=L,nc=tc("iterator"),sn=function(r){if(!rc(r))return Qe(r,nc)||Qe(r,"@@iterator")||ec[Zs(r)]},ac=G,oc=re,ic=z,sc=Zr,cc=sn,lc=TypeError,uc=function(r,e){var t=arguments.length<2?cc(r):e;if(oc(t))return ic(ac(t,r));throw lc(sc(r)+" is not iterable")},vc=G,We=z,fc=ee,dc=function(r,e,t){var n,a;We(r);try{if(n=fc(r,"return"),!n){if(e==="throw")throw t;return t}n=vc(n,r)}catch(o){a=!0,n=o}if(e==="throw")throw t;if(a)throw n;return We(n),t},hc=kt,pc=G,bc=z,yc=Zr,gc=Js,Oc=qt,He=Et,$c=uc,mc=sn,Xe=dc,wc=TypeError,lr=function(r,e){this.stopped=r,this.result=e},Je=lr.prototype,Ec=function(r,e,t){var n=t&&t.that,a=!!(t&&t.AS_ENTRIES),o=!!(t&&t.IS_RECORD),i=!!(t&&t.IS_ITERATOR),s=!!(t&&t.INTERRUPTED),v=hc(e,n),l,c,u,f,d,O,w,$=function(g){return l&&Xe(l,"normal",g),new lr(!0,g)},y=function(g){return a?(bc(g),s?v(g[0],g[1],$):v(g[0],g[1])):s?v(g,$):v(g)};if(o)l=r.iterator;else if(i)l=r;else{if(c=mc(r),!c)throw wc(yc(r)+" is not iterable");if(gc(c)){for(u=0,f=Oc(r);f>u;u++)if(d=y(r[u]),d&&He(Je,d))return d;return new lr(!1)}l=$c(r,c)}for(O=o?r.next:l.next;!(w=pc(O,l)).done;){try{d=y(w.value)}catch(g){Xe(l,"throw",g)}if(typeof d=="object"&&d&&He(Je,d))return d}return new lr(!1)},Sc=te,Tc=Y,Ic=pr,Rc=function(r,e,t){var n=Sc(e);n in r?Tc.f(r,n,Ic(0,t)):r[n]=t},_c=Ut,Pc=Ec,Ac=Rc;_c({target:"Object",stat:!0},{fromEntries:function(e){var t={};return Pc(e,function(n,a){Ac(t,n,a)},{AS_ENTRIES:!0}),t}});var jc=Jr,Lc=jc.Object.fromEntries,xc={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Mc=xc,Nc=I,Cc=se,Gc=X,Ze=K,Fc=L,rt=Fc("toStringTag");for(var Fr in Mc){var et=Nc[Fr],Dr=et&&et.prototype;Dr&&Cc(Dr)!==rt&&Gc(Dr,rt,Fr),Ze[Fr]=Ze.Array}var Dc=Lc,kc=Dc,Uc=kc,Vc=Uc,Bc=Ln(Vc),tt;(function(r){r.Armenian="58",r.Azerbaijani="57",r.Belarusian="114",r.English="3",r.Kazakh="97",r.Portuguese="73",r.Russian="0",r.Spanish="4",r.Ukrainian="1",r.Uzbek="65",r.Vietnamese="75"})(tt||(tt={}));const Kc="vk.com",Al=(r,e,t)=>ot(void 0,void 0,void 0,function*(){const n=new URL(`https://${Kc}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),r!==void 0&&n.searchParams.set("lang",r);const o=yield(yield jn(n.toString())).json();return qc(o,t)}),qc=(r,e)=>Bc(Object.entries(r.keys).map(([t,n])=>[t.substring(`${e}_`.length),Yc(n)])),Yc=r=>Array.isArray(r)?r[0]:r;var nt;(function(r){r.RU="ru",r.EN="en"})(nt||(nt={}));export{P as CurrentClientBrowser,S as CurrentClientDevice,le as ErrorCategory,nt as InterfaceLanguage,Wc as Logger,b as Observable,at as Subject,dr as Subscription,zc as VERSION,tt as VKNumericLanguage,dl as ValueSubject,m as VideoQuality,rl as abortable,Jc as addScript,vl as areQualitiesExact,V as assertNever,Hc as assertNonNullable,Xc as assertNullable,fl as assertQualityIsExact,$l as buffer,Qc as checkNever,hl as combine,ml as debounce,yn as fillWithDefault,El as filter,Sl as filterChanged,Ol as fromEvent,un as getCurrentBrowser,tl as getExponentialDelay,sl as getHighestQuality,yl as interval,al as isHigher,ol as isHigherOrEqual,el as isIOS,ct as isInvariantQuality,it as isLower,il as isLowerOrEqual,cn as isNonNullable,ln as isNullable,Al as loadVKLangPack,Tn as map,Il as mapTo,pl as merge,Q as noop,Zc as now,gl as observableFrom,Rl as once,_l as pairwise,nl as safeStorage,Pl as tap,wl as throttle,bl as timeout,cl as videoHeightToQuality,ul as videoQualityToHeight,ll as videoSizeToQuality};
package/es2018.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.27
3
- * Fri, 18 Aug 2023 12:34:43 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-27/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.28
3
+ * Tue, 29 Aug 2023 12:41:47 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-28/doc/
5
5
  */
6
- "use strict";const Q="1.0.27";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`)},P=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 n=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 s;try{s=this._subscribe(n)}catch(a){(r=n.error)===null||r===void 0||r.call(n,a)}return new m().add(()=>{switch(n.next=w,n.error=w,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return v(s)}})}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 V{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 M(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function D(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function y(t){return typeof t!="undefined"&&t!==null}function A(t){return t==null}const G=(t,e,i)=>new Promise((r,o)=>{e.addEventListener("abort",()=>{a(),f.remove()});const n=()=>{a(),o()},s=()=>{a(),r()},a=()=>{h&&clearTimeout(h),f.removeEventListener("load",s),f.removeEventListener("error",n)};let h;i&&(h=window.setTimeout(n,i));const f=document.createElement("script");f.addEventListener("load",s),f.addEventListener("error",n),f.src=t,document.head.appendChild(f)});var p;const k=typeof((p=window.performance)===null||p===void 0?void 0:p.now)=="function"?()=>window.performance.now():()=>Date.now(),U=(t,e)=>async(...i)=>{var r;const o=e(...i);let n=t.aborted,s;for(;!n&&!t.aborted;){const a=await o.next(s);n=(r=a.done)!==null&&r!==void 0?r:!1,s=a.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 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,r=/chromium/i.test(t)?exports.CurrentClientBrowser.Chromium:void 0,o=/firefox|fxios/i.test(t)?exports.CurrentClientBrowser.Firefox:void 0,n=/webkit|safari|khtml/i.test(t)?exports.CurrentClientBrowser.Safari:void 0,s=/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,N=/ipad/i.test(t)?exports.CurrentClientDevice.iPad:void 0,R=/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||s||a||i||r||n||exports.CurrentClientBrowser.Rest,device:h||f||N||R||C||exports.CurrentClientDevice.Desktop}},F=(t,{start:e=0,factor:i=2,max:r=1/0,min:o=e,random:n=0}={})=>{let s=e;return s*=i**t,s*=1+(Math.random()*n*2-n),s=Math.round(s),s=Math.min(s,r),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={}));let l,b;const E=`vk-videoplayer-dummy-key-${Math.random()}`,g=()=>{if(b!==void 0)return b;try{localStorage.setItem(E,"test"),localStorage.removeItem(E),b=c.LOCAL_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(E),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,q=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)}},B=(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)}},z=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}},$=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)}},W=()=>{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 Y=Object.freeze({__proto__:null,clear:W,get:q,has:z,isPersistent:H,remove:$,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 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,X=(t,e)=>d[t].height>=d[e].height,S=(t,e)=>d[t].height<d[e].height,J=(t,e)=>d[t].height<=d[e].height,Z=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),ee=(t,e=.02)=>[...T].find(r=>d[r].height*(1+e)>=t),te=({width:t,height:e})=>{const i=Math.min(t,e),r=Math.max(t,e);return T.find(o=>{const n=d[o];return n.width>=r&&n.height>=i})},ie=t=>d[t].height,x=t=>t===exports.VideoQuality.INVARIANT,re=t=>t.every(e=>!x(e));function ne(t){if(x(t))throw new Error("Expected exact quality")}const I=(t,e)=>{const i={};for(const r of Object.keys(e)){const o=e[r],n=t[r];Array.isArray(o)&&Array.isArray(n)?i[r]=n:typeof o=="object"&&typeof n=="object"?i[r]=I(n,o):i[r]=r in t?n:o}return i};class se 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 oe(t){return new u(e=>{const i={};let r=Object.keys(t).length;const o=n=>s=>{n in i||r--,i[n]=s,r===0&&e.next(i)};return Object.entries(t).reduce((n,[s,a])=>n.add(a.subscribe(o(s))),new m)})}function ae(...t){return new u(e=>t.reduce((i,r)=>i.add(r.subscribe(e)),new m))}var ce=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)}),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 r=o=>i.next(o);return t.addEventListener(e,r),()=>t.removeEventListener(e,r)});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,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}}const be={leading:!1,trailing:!0};function ve(t,e=be){return i=>new u(r=>i.subscribe(new we(r,t,e)))}class we{constructor(e,i,r){this.destination=e,this.time=i,this.config=r}next(e){this.lastValue=e,y(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 ge={leading:!0,trailing:!1};function me(t,e=ge){return i=>new u(r=>i.subscribe(new pe(r,t,e)))}class pe{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 _e(i,t)))}class _e{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 Se(t=(e,i)=>e===i){return e=>new u(i=>e.subscribe(new xe(i,t)))}const O={};class xe{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 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(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 ye(t){return L(()=>t)}function Ae(){return t=>new u(e=>{let i=!1,r=!1;const o=t.subscribe(n=>{i||(i=!0,e.next(n)),r&&o.unsubscribe()},n=>{var s;i=!0,(s=e.error)===null||s===void 0||s.call(e,n),r&&o.unsubscribe()});return r=!0,i&&o.unsubscribe(),o})}function Te(){return t=>new u(e=>t.subscribe(new Ie(e)))}class Ie{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 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,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={}));exports.Logger=V;exports.Observable=u;exports.Subject=_;exports.Subscription=m;exports.VERSION=Q;exports.ValueSubject=se;exports.abortable=U;exports.addScript=G;exports.areQualitiesExact=re;exports.assertNever=v;exports.assertNonNullable=M;exports.assertNullable=D;exports.assertQualityIsExact=ne;exports.buffer=he;exports.checkNever=P;exports.combine=oe;exports.debounce=ve;exports.fillWithDefault=I;exports.filter=Ee;exports.filterChanged=Se;exports.fromEvent=de;exports.getCurrentBrowser=j;exports.getExponentialDelay=F;exports.getHighestQuality=Z;exports.interval=ue;exports.isHigher=K;exports.isHigherOrEqual=X;exports.isInvariantQuality=x;exports.isLower=S;exports.isLowerOrEqual=J;exports.isNonNullable=y;exports.isNullable=A;exports.map=L;exports.mapTo=ye;exports.merge=ae;exports.noop=w;exports.now=k;exports.observableFrom=le;exports.once=Ae;exports.pairwise=Te;exports.safeStorage=Y;exports.tap=Le;exports.throttle=me;exports.timeout=ce;exports.videoHeightToQuality=ee;exports.videoQualityToHeight=ie;exports.videoSizeToQuality=te;
6
+ "use strict";const on="1.0.28";class Y{constructor(){this.subscriptions=[]}unsubscribe(){const r=this.subscriptions;this.subscriptions=[],r.forEach(t=>typeof t=="function"?t():t.unsubscribe())}add(r){return this.subscriptions.push(r),this}}const L=e=>{throw new Error(`${e} is value of unexpected type`)},sn=e=>{},G=()=>{};class b{constructor(r){r&&(this._subscribe=r)}subscribe(r,t){var n;let a;t?typeof t=="function"?a={next:t,error:G}:a={next:s=>t.next(s),error:s=>{var v;return(v=t.error)===null||v===void 0?void 0:v.call(t,s)}}:a={next:G,error:G};const o=typeof r=="function"?{next:s=>{try{r(s)}catch(v){a.next(v)}},error:s=>a.next(s)}:{next:s=>r.next(s),error:s=>r.error?r.error(s):a.next(s)};let i;try{i=this._subscribe(o)}catch(s){(n=o.error)===null||n===void 0||n.call(o,s)}return new Y().add(()=>{switch(o.next=G,o.error=G,typeof i){case"function":i();return;case"object":i.unsubscribe();return;case"undefined":return;default:return L(i)}})}pipe(...r){return r.reduce((t,n)=>n(t),this)}_subscribe(r){}}class qe extends b{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(r){this.subscribers.forEach(t=>t.next(r))}error(r){this.subscribers.forEach(t=>{var n;return(n=t.error)===null||n===void 0?void 0:n.call(t,r)})}_subscribe(r){const t=this.keyCounter++;return this.subscribers.set(t,r),new Y().add(()=>this.subscribers.delete(t))}}class ln{constructor(){this.log$=new qe,this.logs=[],this.log=r=>{const t={...r,timestamp:Date.now()};this.logs.push(t),this.log$.next(t)},this.getAllLogs=()=>this.logs}createCustomLog(r){return(...t)=>{let n;try{n=r(...t)}catch(a){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(r){return this.createCustomLog(t=>({component:r,...t}))}}function cn(e,r='Assertion "value is not nullable" failed'){if(e==null)throw new Error(r)}function un(e,r='Assertion "value is nullable" failed'){if(e!=null)throw new Error(r)}function rt(e){return typeof e!="undefined"&&e!==null}function tt(e){return e==null}const vn=(e,r,t)=>new Promise((n,a)=>{r.addEventListener("abort",()=>{s(),l.remove()});const o=()=>{s(),a()},i=()=>{s(),n()},s=()=>{v&&clearTimeout(v),l.removeEventListener("load",i),l.removeEventListener("error",o)};let v;t&&(v=window.setTimeout(o,t));const l=document.createElement("script");l.addEventListener("load",i),l.addEventListener("error",o),l.src=e,document.head.appendChild(l)});var de;const fn=typeof((de=window.performance)===null||de===void 0?void 0:de.now)=="function"?()=>window.performance.now():()=>Date.now(),dn=(e,r)=>async(...t)=>{var n;const a=r(...t);let o=e.aborted,i;for(;!o&&!e.aborted;){const s=await a.next(i);o=(n=s.done)!==null&&n!==void 0?n:!1,i=s.value}return i};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 nt=()=>{const{userAgent:e}=window.navigator,r=/yabrowser/i.test(e)?exports.CurrentClientBrowser.Yandex:void 0,t=/chrome|crios/i.test(e)?exports.CurrentClientBrowser.Chrome:void 0,n=/chromium/i.test(e)?exports.CurrentClientBrowser.Chromium:void 0,a=/firefox|fxios/i.test(e)?exports.CurrentClientBrowser.Firefox:void 0,o=/webkit|safari|khtml/i.test(e)?exports.CurrentClientBrowser.Safari:void 0,i=/opr\//i.test(e)?exports.CurrentClientBrowser.Opera:void 0,s=/edg/i.test(e)?exports.CurrentClientBrowser.Edge:void 0,v=/android/i.test(e)?exports.CurrentClientDevice.Android:void 0,l=/iphone/i.test(e)?exports.CurrentClientDevice.iPhone:void 0,c=/ipad/i.test(e)?exports.CurrentClientDevice.iPad:void 0,f=/ipod/i.test(e)?exports.CurrentClientDevice.iPod:void 0,u=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?exports.CurrentClientDevice.RestMobile:void 0;return{browser:r||a||i||s||t||n||o||exports.CurrentClientBrowser.Rest,device:v||l||c||f||u||exports.CurrentClientDevice.Desktop}},hn=()=>[exports.CurrentClientDevice.iPhone,exports.CurrentClientDevice.iPad,exports.CurrentClientDevice.iPod].includes(nt().device),bn=(e,{start:r=0,factor:t=2,max:n=1/0,min:a=r,random:o=0}={})=>{let i=r;return i*=t**e,i*=1+(Math.random()*o*2-o),i=Math.round(i),i=Math.min(i,n),i=Math.max(i,a),i};var h;(function(e){e[e.LOCAL_STORAGE=0]="LOCAL_STORAGE",e[e.SESSION_STORAGE=1]="SESSION_STORAGE",e[e.RUNTIME=2]="RUNTIME"})(h||(h={}));let p,j;const he=`vk-videoplayer-dummy-key-${Math.random()}`,k=()=>{if(j!==void 0)return j;try{localStorage.setItem(he,"test"),localStorage.removeItem(he),j=h.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(he),j=h.SESSION_STORAGE}catch(r){if(r instanceof DOMException||r instanceof TypeError)j=h.RUNTIME;else throw r}else throw e}return j===h.RUNTIME&&(p=new Map),j},pn=()=>k()===h.LOCAL_STORAGE,yn=e=>{var r,t;const n=k();switch(n){case h.LOCAL_STORAGE:return(r=localStorage.getItem(e))!==null&&r!==void 0?r:void 0;case h.SESSION_STORAGE:return(t=sessionStorage.getItem(e))!==null&&t!==void 0?t:void 0;case h.RUNTIME:return p==null?void 0:p.get(e);default:L(n)}},gn=(e,r)=>{const t=k();switch(t){case h.LOCAL_STORAGE:try{localStorage.setItem(e,r)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case h.SESSION_STORAGE:try{sessionStorage.setItem(e,r)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case h.RUNTIME:return void(p==null?void 0:p.set(e,r));default:L(t)}},On=e=>{var r;const t=k();switch(t){case h.LOCAL_STORAGE:return e in localStorage;case h.SESSION_STORAGE:return e in sessionStorage;case h.RUNTIME:return(r=p==null?void 0:p.has(e))!==null&&r!==void 0?r:!1;default:return L(t),!1}},wn=e=>{const r=k();switch(r){case h.LOCAL_STORAGE:return localStorage.removeItem(e);case h.SESSION_STORAGE:return sessionStorage.removeItem(e);case h.RUNTIME:return void(p==null?void 0:p.delete(e));default:L(r)}},$n=()=>{const e=k();switch(e){case h.LOCAL_STORAGE:return localStorage.clear();case h.SESSION_STORAGE:return sessionStorage.clear();case h.RUNTIME:return p==null?void 0:p.clear();default:L(e)}};var mn=Object.freeze({__proto__:null,clear:$n,get:yn,has:On,isPersistent:pn,remove:wn,set:gn});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 m={[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}},En=(e,r)=>m[e].height>m[r].height,Sn=(e,r)=>m[e].height>=m[r].height,Ye=(e,r)=>m[e].height<m[r].height,Tn=(e,r)=>m[e].height<=m[r].height,In=e=>e.sort((r,t)=>r===t?0:r===exports.VideoQuality.INVARIANT?1:t===exports.VideoQuality.INVARIANT?-1:Ye(r,t)?1:-1)[0],at=Object.keys(m).sort((e,r)=>Ye(e,r)?-1:1),Rn=(e,r=.02)=>[...at].find(n=>m[n].height*(1+r)>=e),Pn=({width:e,height:r})=>{const t=Math.min(e,r),n=Math.max(e,r);return at.find(a=>{const o=m[a];return o.width>=n&&o.height>=t})},_n=e=>m[e].height,He=e=>e===exports.VideoQuality.INVARIANT,An=e=>e.every(r=>!He(r));function jn(e){if(He(e))throw new Error("Expected exact quality")}const ot=(e,r)=>{const t={};for(const n of Object.keys(r)){const a=r[n],o=e[n];Array.isArray(a)&&Array.isArray(o)?t[n]=o:typeof a=="object"&&typeof o=="object"?t[n]=ot(o,a):t[n]=n in e?o:a}return t};class Ln extends qe{constructor(r){super(),this.value=r}next(r){super.next(this.value=r)}error(r){super.error(this.value=r)}getValue(){return this.value}_subscribe(r){const t=super._subscribe(r);return r.next(this.value),t}}function Cn(e){return new b(r=>{const t={};let n=Object.keys(e).length;const a=o=>i=>{o in t||n--,t[o]=i,n===0&&r.next(t)};return Object.entries(e).reduce((o,[i,s])=>o.add(s.subscribe(a(i))),new Y)})}function xn(...e){return new b(r=>e.reduce((t,n)=>t.add(n.subscribe(r)),new Y))}var Nn=e=>new b(r=>{const t=window.setTimeout(()=>{try{r.next()}catch(n){if(r.error)r.error(n);else throw n}},e);return()=>window.clearTimeout(t)}),Mn=e=>new b(r=>{const t=window.setInterval(()=>r.next(),e);return()=>window.clearInterval(t)}),Dn=e=>new b(r=>{e.forEach(t=>r.next(t))}),Fn=(e,r)=>new b(t=>{const n=a=>t.next(a);return e.addEventListener(r,n),()=>e.removeEventListener(r,n)});function Gn(e){return r=>new b(t=>r.subscribe(new Vn(t,e)))}class Vn{constructor(r,t){this.destination=r,this.size=t,this.lastValues=[]}next(r){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(r),this.destination.next(this.lastValues)}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}}const kn={leading:!1,trailing:!0};function Bn(e,r=kn){return t=>new b(n=>t.subscribe(new Un(n,e,r)))}class Un{constructor(r,t,n){this.destination=r,this.time=t,this.config=n}next(r){this.lastValue=r,rt(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(r),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(t){if(this.destination.error)this.destination.error(t);else throw t}this.timeout=void 0},this.time)}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}}const Qn={leading:!0,trailing:!1};function Kn(e,r=Qn){return t=>new b(n=>t.subscribe(new qn(n,e,r)))}class qn{constructor(r,t,n){this.destination=r,this.time=t,this.config=n}next(r){this.lastValue=r,tt(this.timeout)&&(this.config.leading&&this.destination.next(r),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}}function Yn(e){return r=>new b(t=>r.subscribe(new Hn(t,e)))}class Hn{constructor(r,t){this.destination=r,this.predicate=t}next(r){let t;try{t=this.predicate(r)}catch(n){throw this.error(n),n}t&&this.destination.next(r)}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}}function zn(e=(r,t)=>r===t){return r=>new b(t=>r.subscribe(new Wn(t,e)))}const lr={};class Wn{constructor(r,t){this.destination=r,this.predicate=t,this.lastValue=lr}next(r){let t;try{t=this.lastValue===lr||!this.predicate(this.lastValue,r),this.lastValue=r}catch(n){throw this.error(n),n}t&&this.destination.next(r)}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}}function it(e){return r=>new b(t=>r.subscribe(new Xn(t,e)))}let Xn=class{constructor(r,t){this.destination=r,this.mapper=t}next(r){let t;try{t=this.mapper(r)}catch(n){throw this.error(n),n}this.destination.next(t)}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}};function Jn(e){return it(()=>e)}function Zn(){return e=>new b(r=>{let t=!1,n=!1;const a=e.subscribe(o=>{t||(t=!0,r.next(o)),n&&a.unsubscribe()},o=>{var i;t=!0,(i=r.error)===null||i===void 0||i.call(r,o),n&&a.unsubscribe()});return n=!0,t&&a.unsubscribe(),a})}function ea(){return e=>new b(r=>e.subscribe(new ra(r)))}class ra{constructor(r){this.destination=r,this.hasLast=!1}next(r){const t=this.last;if(this.last=r,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,r])}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}}function ta(e){return r=>new b(t=>r.subscribe(new na(t,e)))}class na{constructor(r,t){this.destination=r,this.effect=t}next(r){try{this.effect(r)}catch(t){throw this.error(t),t}this.destination.next(r)}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}}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={}));class cr{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(r,t,n){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:t,options:n})}removeEventListener(r,t){if(!(r in this.listeners))return;const n=this.listeners[r];for(let a=0,o=n.length;a<o;a++)if(n[a].callback===t){n.splice(a,1);return}}dispatchEvent(r){if(!(r.type in this.listeners))return;const n=this.listeners[r.type].slice();for(let a=0,o=n.length;a<o;a++){const i=n[a];try{i.callback.call(this,r)}catch(s){Promise.resolve().then(()=>{throw s})}i.options&&i.options.once&&this.removeEventListener(r.type,i.callback)}return!r.defaultPrevented}}class st extends cr{constructor(){super(),this.listeners||cr.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(r){r.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,r)),super.dispatchEvent(r)}}class aa{constructor(){Object.defineProperty(this,"signal",{value:new st,writable:!0,configurable:!0})}abort(r){let t;try{t=new Event("abort")}catch(a){typeof document!="undefined"?document.createEvent?(t=document.createEvent("Event"),t.initEvent("abort",!1,!1)):(t=document.createEventObject(),t.type="abort"):t={type:"abort",bubbles:!1,cancelable:!1}}let n=r;if(n===void 0)if(typeof document=="undefined")n=new Error("This operation was aborted"),n.name="AbortError";else try{n=new DOMException("signal is aborted without reason")}catch(a){n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(t)}toString(){return"[object AbortController]"}}typeof Symbol!="undefined"&&Symbol.toStringTag&&(aa.prototype[Symbol.toStringTag]="AbortController",st.prototype[Symbol.toStringTag]="AbortSignal");function lt(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function oa(e){typeof e=="function"&&(e={fetch:e});const{fetch:r,Request:t=r.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a=!1}=e;if(!lt({fetch:r,Request:t,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a}))return{fetch:r,Request:o};let o=t;(o&&!o.prototype.hasOwnProperty("signal")||a)&&(o=function(l,c){let f;c&&c.signal&&(f=c.signal,delete c.signal);const u=new t(l,c);return f&&Object.defineProperty(u,"signal",{writable:!1,enumerable:!1,configurable:!0,value:f}),u},o.prototype=t.prototype);const i=r;return{fetch:(v,l)=>{const c=o&&o.prototype.isPrototypeOf(v)?v.signal:l?l.signal:void 0;if(c){let f;try{f=new DOMException("Aborted","AbortError")}catch(d){f=new Error("Aborted"),f.name="AbortError"}if(c.aborted)return Promise.reject(f);const u=new Promise((d,O)=>{c.addEventListener("abort",()=>O(f),{once:!0})});return l&&l.signal&&delete l.signal,Promise.race([u,i(v,l)])}return i(v,l)},Request:o}}const ze=lt({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),ct=ze?oa({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,ia=ze?ct.fetch:window.fetch;ze?ct.Request:window.Request;var be=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function sa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var P=function(e){try{return!!e()}catch(r){return!0}},la=P,ve=!la(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),ut=ve,vt=Function.prototype,De=vt.call,ca=ut&&vt.bind.bind(De,De),C=ut?ca:function(e){return function(){return De.apply(e,arguments)}},ft=C,ua=ft({}.toString),va=ft("".slice),We=function(e){return va(ua(e),8,-1)},fa=C,da=P,ha=We,pe=Object,ba=fa("".split),pa=da(function(){return!pe("z").propertyIsEnumerable(0)})?function(e){return ha(e)=="String"?ba(e,""):pe(e)}:pe,Xe=function(e){return e==null},ya=Xe,ga=TypeError,dt=function(e){if(ya(e))throw ga("Can't call method on "+e);return e},Oa=pa,wa=dt,H=function(e){return Oa(wa(e))},B={},X=function(e){return e&&e.Math==Math&&e},S=X(typeof globalThis=="object"&&globalThis)||X(typeof window=="object"&&window)||X(typeof self=="object"&&self)||X(typeof be=="object"&&be)||function(){return this}()||be||Function("return this")(),Fe=typeof document=="object"&&document.all,$a=typeof Fe=="undefined"&&Fe!==void 0,ht={all:Fe,IS_HTMLDDA:$a},bt=ht,ma=bt.all,T=bt.IS_HTMLDDA?function(e){return typeof e=="function"||e===ma}:function(e){return typeof e=="function"},Ea=S,Sa=T,ur=Ea.WeakMap,Ta=Sa(ur)&&/native code/.test(String(ur)),vr=T,pt=ht,Ia=pt.all,U=pt.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:vr(e)||e===Ia}:function(e){return typeof e=="object"?e!==null:vr(e)},Ra=P,x=!Ra(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),Q={},Pa=S,fr=U,Ge=Pa.document,_a=fr(Ge)&&fr(Ge.createElement),yt=function(e){return _a?Ge.createElement(e):{}},Aa=x,ja=P,La=yt,gt=!Aa&&!ja(function(){return Object.defineProperty(La("div"),"a",{get:function(){return 7}}).a!=7}),Ca=x,xa=P,Ot=Ca&&xa(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),Na=U,Ma=String,Da=TypeError,K=function(e){if(Na(e))return e;throw Da(Ma(e)+" is not an object")},Fa=ve,J=Function.prototype.call,N=Fa?J.bind(J):function(){return J.apply(J,arguments)},Je={},ye=Je,ge=S,Ga=T,dr=function(e){return Ga(e)?e:void 0},wt=function(e,r){return arguments.length<2?dr(ye[e])||dr(ge[e]):ye[e]&&ye[e][r]||ge[e]&&ge[e][r]},Va=C,$t=Va({}.isPrototypeOf),ka=typeof navigator!="undefined"&&String(navigator.userAgent)||"",mt=S,Oe=ka,hr=mt.process,br=mt.Deno,pr=hr&&hr.versions||br&&br.version,yr=pr&&pr.v8,E,le;yr&&(E=yr.split("."),le=E[0]>0&&E[0]<4?1:+(E[0]+E[1]));!le&&Oe&&(E=Oe.match(/Edge\/(\d+)/),(!E||E[1]>=74)&&(E=Oe.match(/Chrome\/(\d+)/),E&&(le=+E[1])));var Ba=le,gr=Ba,Ua=P,Qa=S,Ka=Qa.String,Et=!!Object.getOwnPropertySymbols&&!Ua(function(){var e=Symbol();return!Ka(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&gr&&gr<41}),qa=Et,St=qa&&!Symbol.sham&&typeof Symbol.iterator=="symbol",Ya=wt,Ha=T,za=$t,Wa=St,Xa=Object,Tt=Wa?function(e){return typeof e=="symbol"}:function(e){var r=Ya("Symbol");return Ha(r)&&za(r.prototype,Xa(e))},Ja=String,Ze=function(e){try{return Ja(e)}catch(r){return"Object"}},Za=T,eo=Ze,ro=TypeError,er=function(e){if(Za(e))return e;throw ro(eo(e)+" is not a function")},to=er,no=Xe,rr=function(e,r){var t=e[r];return no(t)?void 0:to(t)},we=N,$e=T,me=U,ao=TypeError,oo=function(e,r){var t,n;if(r==="string"&&$e(t=e.toString)&&!me(n=we(t,e))||$e(t=e.valueOf)&&!me(n=we(t,e))||r!=="string"&&$e(t=e.toString)&&!me(n=we(t,e)))return n;throw ao("Can't convert object to primitive value")},It={exports:{}},Or=S,io=Object.defineProperty,so=function(e,r){try{io(Or,e,{value:r,configurable:!0,writable:!0})}catch(t){Or[e]=r}return r},lo=S,co=so,wr="__core-js_shared__",uo=lo[wr]||co(wr,{}),Rt=uo,$r=Rt;(It.exports=function(e,r){return $r[e]||($r[e]=r!==void 0?r:{})})("versions",[]).push({version:"3.31.0",mode:"pure",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.0/LICENSE",source:"https://github.com/zloirock/core-js"});var Pt=It.exports,vo=dt,fo=Object,_t=function(e){return fo(vo(e))},ho=C,bo=_t,po=ho({}.hasOwnProperty),A=Object.hasOwn||function(r,t){return po(bo(r),t)},yo=C,go=0,Oo=Math.random(),wo=yo(1 .toString),At=function(e){return"Symbol("+(e===void 0?"":e)+")_"+wo(++go+Oo,36)},$o=S,mo=Pt,mr=A,Eo=At,So=Et,To=St,V=$o.Symbol,Ee=mo("wks"),Io=To?V.for||V:V&&V.withoutSetter||Eo,_=function(e){return mr(Ee,e)||(Ee[e]=So&&mr(V,e)?V[e]:Io("Symbol."+e)),Ee[e]},Ro=N,Er=U,Sr=Tt,Po=rr,_o=oo,Ao=_,jo=TypeError,Lo=Ao("toPrimitive"),Co=function(e,r){if(!Er(e)||Sr(e))return e;var t=Po(e,Lo),n;if(t){if(r===void 0&&(r="default"),n=Ro(t,e,r),!Er(n)||Sr(n))return n;throw jo("Can't convert object to primitive value")}return r===void 0&&(r="number"),_o(e,r)},xo=Co,No=Tt,tr=function(e){var r=xo(e,"string");return No(r)?r:r+""},Mo=x,Do=gt,Fo=Ot,Z=K,Tr=tr,Go=TypeError,Se=Object.defineProperty,Vo=Object.getOwnPropertyDescriptor,Te="enumerable",Ie="configurable",Re="writable";Q.f=Mo?Fo?function(r,t,n){if(Z(r),t=Tr(t),Z(n),typeof r=="function"&&t==="prototype"&&"value"in n&&Re in n&&!n[Re]){var a=Vo(r,t);a&&a[Re]&&(r[t]=n.value,n={configurable:Ie in n?n[Ie]:a[Ie],enumerable:Te in n?n[Te]:a[Te],writable:!1})}return Se(r,t,n)}:Se:function(r,t,n){if(Z(r),t=Tr(t),Z(n),Do)try{return Se(r,t,n)}catch(a){}if("get"in n||"set"in n)throw Go("Accessors not supported");return"value"in n&&(r[t]=n.value),r};var fe=function(e,r){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:r}},ko=x,Bo=Q,Uo=fe,z=ko?function(e,r,t){return Bo.f(e,r,Uo(1,t))}:function(e,r,t){return e[r]=t,e},Qo=Pt,Ko=At,Ir=Qo("keys"),nr=function(e){return Ir[e]||(Ir[e]=Ko(e))},ar={},qo=Ta,jt=S,Yo=U,Ho=z,Pe=A,_e=Rt,zo=nr,Wo=ar,Rr="Object already initialized",Ve=jt.TypeError,Xo=jt.WeakMap,ce,q,ue,Jo=function(e){return ue(e)?q(e):ce(e,{})},Zo=function(e){return function(r){var t;if(!Yo(r)||(t=q(r)).type!==e)throw Ve("Incompatible receiver, "+e+" required");return t}};if(qo||_e.state){var I=_e.state||(_e.state=new Xo);I.get=I.get,I.has=I.has,I.set=I.set,ce=function(e,r){if(I.has(e))throw Ve(Rr);return r.facade=e,I.set(e,r),r},q=function(e){return I.get(e)||{}},ue=function(e){return I.has(e)}}else{var M=zo("state");Wo[M]=!0,ce=function(e,r){if(Pe(e,M))throw Ve(Rr);return r.facade=e,Ho(e,M,r),r},q=function(e){return Pe(e,M)?e[M]:{}},ue=function(e){return Pe(e,M)}}var ei={set:ce,get:q,has:ue,enforce:Jo,getterFor:Zo},ri=ve,Lt=Function.prototype,Pr=Lt.apply,_r=Lt.call,ti=typeof Reflect=="object"&&Reflect.apply||(ri?_r.bind(Pr):function(){return _r.apply(Pr,arguments)}),ni=We,ai=C,Ct=function(e){if(ni(e)==="Function")return ai(e)},xt={},Nt={},Mt={}.propertyIsEnumerable,Dt=Object.getOwnPropertyDescriptor,oi=Dt&&!Mt.call({1:2},1);Nt.f=oi?function(r){var t=Dt(this,r);return!!t&&t.enumerable}:Mt;var ii=x,si=N,li=Nt,ci=fe,ui=H,vi=tr,fi=A,di=gt,Ar=Object.getOwnPropertyDescriptor;xt.f=ii?Ar:function(r,t){if(r=ui(r),t=vi(t),di)try{return Ar(r,t)}catch(n){}if(fi(r,t))return ci(!si(li.f,r,t),r[t])};var hi=P,bi=T,pi=/#|\.prototype\./,W=function(e,r){var t=gi[yi(e)];return t==wi?!0:t==Oi?!1:bi(r)?hi(r):!!r},yi=W.normalize=function(e){return String(e).replace(pi,".").toLowerCase()},gi=W.data={},Oi=W.NATIVE="N",wi=W.POLYFILL="P",$i=W,jr=Ct,mi=er,Ei=ve,Si=jr(jr.bind),Ft=function(e,r){return mi(e),r===void 0?e:Ei?Si(e,r):function(){return e.apply(r,arguments)}},ee=S,Ti=ti,Ii=Ct,Ri=T,Pi=xt.f,_i=$i,D=Je,Ai=Ft,F=z,Lr=A,ji=function(e){var r=function(t,n,a){if(this instanceof r){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,a)}return Ti(e,this,arguments)};return r.prototype=e.prototype,r},Gt=function(e,r){var t=e.target,n=e.global,a=e.stat,o=e.proto,i=n?ee:a?ee[t]:(ee[t]||{}).prototype,s=n?D:D[t]||F(D,t,{})[t],v=s.prototype,l,c,f,u,d,O,$,w,y;for(u in r)l=_i(n?u:t+(a?".":"#")+u,e.forced),c=!l&&i&&Lr(i,u),O=s[u],c&&(e.dontCallGetSet?(y=Pi(i,u),$=y&&y.value):$=i[u]),d=c&&$?$:r[u],!(c&&typeof O==typeof d)&&(e.bind&&c?w=Ai(d,ee):e.wrap&&c?w=ji(d):o&&Ri(d)?w=Ii(d):w=d,(e.sham||d&&d.sham||O&&O.sham)&&F(w,"sham",!0),F(s,u,w),o&&(f=t+"Prototype",Lr(D,f)||F(D,f,{}),F(D[f],u,d),e.real&&v&&(l||!v[u])&&F(v,u,d)))},ke=x,Li=A,Vt=Function.prototype,Ci=ke&&Object.getOwnPropertyDescriptor,or=Li(Vt,"name"),xi=or&&function(){}.name==="something",Ni=or&&(!ke||ke&&Ci(Vt,"name").configurable),Mi={EXISTS:or,PROPER:xi,CONFIGURABLE:Ni},kt={},Di=Math.ceil,Fi=Math.floor,Gi=Math.trunc||function(r){var t=+r;return(t>0?Fi:Di)(t)},Vi=Gi,Bt=function(e){var r=+e;return r!==r||r===0?0:Vi(r)},ki=Bt,Bi=Math.max,Ui=Math.min,Qi=function(e,r){var t=ki(e);return t<0?Bi(t+r,0):Ui(t,r)},Ki=Bt,qi=Math.min,Yi=function(e){return e>0?qi(Ki(e),9007199254740991):0},Hi=Yi,Ut=function(e){return Hi(e.length)},zi=H,Wi=Qi,Xi=Ut,Cr=function(e){return function(r,t,n){var a=zi(r),o=Xi(a),i=Wi(n,o),s;if(e&&t!=t){for(;o>i;)if(s=a[i++],s!=s)return!0}else for(;o>i;i++)if((e||i in a)&&a[i]===t)return e||i||0;return!e&&-1}},Ji={includes:Cr(!0),indexOf:Cr(!1)},Zi=C,Ae=A,es=H,rs=Ji.indexOf,ts=ar,xr=Zi([].push),ns=function(e,r){var t=es(e),n=0,a=[],o;for(o in t)!Ae(ts,o)&&Ae(t,o)&&xr(a,o);for(;r.length>n;)Ae(t,o=r[n++])&&(~rs(a,o)||xr(a,o));return a},Qt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],as=ns,os=Qt,is=Object.keys||function(r){return as(r,os)},ss=x,ls=Ot,cs=Q,us=K,vs=H,fs=is;kt.f=ss&&!ls?Object.defineProperties:function(r,t){us(r);for(var n=vs(t),a=fs(t),o=a.length,i=0,s;o>i;)cs.f(r,s=a[i++],n[s]);return r};var ds=wt,hs=ds("document","documentElement"),bs=K,ps=kt,Nr=Qt,ys=ar,gs=hs,Os=yt,ws=nr,Mr=">",Dr="<",Be="prototype",Ue="script",Kt=ws("IE_PROTO"),je=function(){},qt=function(e){return Dr+Ue+Mr+e+Dr+"/"+Ue+Mr},Fr=function(e){e.write(qt("")),e.close();var r=e.parentWindow.Object;return e=null,r},$s=function(){var e=Os("iframe"),r="java"+Ue+":",t;return e.style.display="none",gs.appendChild(e),e.src=String(r),t=e.contentWindow.document,t.open(),t.write(qt("document.F=Object")),t.close(),t.F},re,oe=function(){try{re=new ActiveXObject("htmlfile")}catch(r){}oe=typeof document!="undefined"?document.domain&&re?Fr(re):$s():Fr(re);for(var e=Nr.length;e--;)delete oe[Be][Nr[e]];return oe()};ys[Kt]=!0;var Yt=Object.create||function(r,t){var n;return r!==null?(je[Be]=bs(r),n=new je,je[Be]=null,n[Kt]=r):n=oe(),t===void 0?n:ps.f(n,t)},ms=P,Es=!ms(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),Ss=A,Ts=T,Is=_t,Rs=nr,Ps=Es,Gr=Rs("IE_PROTO"),Qe=Object,_s=Qe.prototype,Ht=Ps?Qe.getPrototypeOf:function(e){var r=Is(e);if(Ss(r,Gr))return r[Gr];var t=r.constructor;return Ts(t)&&r instanceof t?t.prototype:r instanceof Qe?_s:null},As=z,zt=function(e,r,t,n){return n&&n.enumerable?e[r]=t:As(e,r,t),e},js=P,Ls=T,Cs=U,xs=Yt,Vr=Ht,Ns=zt,Ms=_,Ke=Ms("iterator"),Wt=!1,R,Le,Ce;[].keys&&(Ce=[].keys(),"next"in Ce?(Le=Vr(Vr(Ce)),Le!==Object.prototype&&(R=Le)):Wt=!0);var Ds=!Cs(R)||js(function(){var e={};return R[Ke].call(e)!==e});Ds?R={}:R=xs(R);Ls(R[Ke])||Ns(R,Ke,function(){return this});var Xt={IteratorPrototype:R,BUGGY_SAFARI_ITERATORS:Wt},Fs=_,Gs=Fs("toStringTag"),Jt={};Jt[Gs]="z";var ir=String(Jt)==="[object z]",Vs=ir,ks=T,ie=We,Bs=_,Us=Bs("toStringTag"),Qs=Object,Ks=ie(function(){return arguments}())=="Arguments",qs=function(e,r){try{return e[r]}catch(t){}},sr=Vs?ie:function(e){var r,t,n;return e===void 0?"Undefined":e===null?"Null":typeof(t=qs(r=Qs(e),Us))=="string"?t:Ks?ie(r):(n=ie(r))=="Object"&&ks(r.callee)?"Arguments":n},Ys=ir,Hs=sr,zs=Ys?{}.toString:function(){return"[object "+Hs(this)+"]"},Ws=ir,Xs=Q.f,Js=z,Zs=A,el=zs,rl=_,kr=rl("toStringTag"),Zt=function(e,r,t,n){if(e){var a=t?e:e.prototype;Zs(a,kr)||Xs(a,kr,{configurable:!0,value:r}),n&&!Ws&&Js(a,"toString",el)}},tl=Xt.IteratorPrototype,nl=Yt,al=fe,ol=Zt,il=B,sl=function(){return this},ll=function(e,r,t,n){var a=r+" Iterator";return e.prototype=nl(tl,{next:al(+!n,t)}),ol(e,a,!1,!0),il[a]=sl,e},cl=Gt,ul=N,en=Mi,vl=ll,fl=Ht,dl=Zt,Br=zt,hl=_,Ur=B,rn=Xt,bl=en.PROPER;en.CONFIGURABLE;rn.IteratorPrototype;var te=rn.BUGGY_SAFARI_ITERATORS,xe=hl("iterator"),Qr="keys",ne="values",Kr="entries",pl=function(){return this},yl=function(e,r,t,n,a,o,i){vl(t,r,n);var s=function(y){if(y===a&&u)return u;if(!te&&y in c)return c[y];switch(y){case Qr:return function(){return new t(this,y)};case ne:return function(){return new t(this,y)};case Kr:return function(){return new t(this,y)}}return function(){return new t(this)}},v=r+" Iterator",l=!1,c=e.prototype,f=c[xe]||c["@@iterator"]||a&&c[a],u=!te&&f||s(a),d=r=="Array"&&c.entries||f,O,$,w;if(d&&(O=fl(d.call(new e)),O!==Object.prototype&&O.next&&(dl(O,v,!0,!0),Ur[v]=pl)),bl&&a==ne&&f&&f.name!==ne&&(l=!0,u=function(){return ul(f,this)}),a)if($={values:s(ne),keys:o?u:s(Qr),entries:s(Kr)},i)for(w in $)(te||l||!(w in c))&&Br(c,w,$[w]);else cl({target:r,proto:!0,forced:te||l},$);return i&&c[xe]!==u&&Br(c,xe,u,{name:a}),Ur[r]=u,$},gl=function(e,r){return{value:e,done:r}},Ol=H,qr=B,tn=ei;Q.f;var wl=yl,ae=gl,nn="Array Iterator",$l=tn.set,ml=tn.getterFor(nn);wl(Array,"Array",function(e,r){$l(this,{type:nn,target:Ol(e),index:0,kind:r})},function(){var e=ml(this),r=e.target,t=e.kind,n=e.index++;return!r||n>=r.length?(e.target=void 0,ae(void 0,!0)):t=="keys"?ae(n,!1):t=="values"?ae(r[n],!1):ae([n,r[n]],!1)},"values");qr.Arguments=qr.Array;var El=_,Sl=B,Tl=El("iterator"),Il=Array.prototype,Rl=function(e){return e!==void 0&&(Sl.Array===e||Il[Tl]===e)},Pl=sr,Yr=rr,_l=Xe,Al=B,jl=_,Ll=jl("iterator"),an=function(e){if(!_l(e))return Yr(e,Ll)||Yr(e,"@@iterator")||Al[Pl(e)]},Cl=N,xl=er,Nl=K,Ml=Ze,Dl=an,Fl=TypeError,Gl=function(e,r){var t=arguments.length<2?Dl(e):r;if(xl(t))return Nl(Cl(t,e));throw Fl(Ml(e)+" is not iterable")},Vl=N,Hr=K,kl=rr,Bl=function(e,r,t){var n,a;Hr(e);try{if(n=kl(e,"return"),!n){if(r==="throw")throw t;return t}n=Vl(n,e)}catch(o){a=!0,n=o}if(r==="throw")throw t;if(a)throw n;return Hr(n),t},Ul=Ft,Ql=N,Kl=K,ql=Ze,Yl=Rl,Hl=Ut,zr=$t,zl=Gl,Wl=an,Wr=Bl,Xl=TypeError,se=function(e,r){this.stopped=e,this.result=r},Xr=se.prototype,Jl=function(e,r,t){var n=t&&t.that,a=!!(t&&t.AS_ENTRIES),o=!!(t&&t.IS_RECORD),i=!!(t&&t.IS_ITERATOR),s=!!(t&&t.INTERRUPTED),v=Ul(r,n),l,c,f,u,d,O,$,w=function(g){return l&&Wr(l,"normal",g),new se(!0,g)},y=function(g){return a?(Kl(g),s?v(g[0],g[1],w):v(g[0],g[1])):s?v(g,w):v(g)};if(o)l=e.iterator;else if(i)l=e;else{if(c=Wl(e),!c)throw Xl(ql(e)+" is not iterable");if(Yl(c)){for(f=0,u=Hl(e);u>f;f++)if(d=y(e[f]),d&&zr(Xr,d))return d;return new se(!1)}l=zl(e,c)}for(O=o?e.next:l.next;!($=Ql(O,l)).done;){try{d=y($.value)}catch(g){Wr(l,"throw",g)}if(typeof d=="object"&&d&&zr(Xr,d))return d}return new se(!1)},Zl=tr,ec=Q,rc=fe,tc=function(e,r,t){var n=Zl(r);n in e?ec.f(e,n,rc(0,t)):e[n]=t},nc=Gt,ac=Jl,oc=tc;nc({target:"Object",stat:!0},{fromEntries:function(r){var t={};return ac(r,function(n,a){oc(t,n,a)},{AS_ENTRIES:!0}),t}});var ic=Je,sc=ic.Object.fromEntries,lc={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},cc=lc,uc=S,vc=sr,fc=z,Jr=B,dc=_,Zr=dc("toStringTag");for(var Ne in cc){var et=uc[Ne],Me=et&&et.prototype;Me&&vc(Me)!==Zr&&fc(Me,Zr,Ne),Jr[Ne]=Jr.Array}var hc=sc,bc=hc,pc=bc,yc=pc,gc=sa(yc);exports.VKNumericLanguage=void 0;(function(e){e.Armenian="58",e.Azerbaijani="57",e.Belarusian="114",e.English="3",e.Kazakh="97",e.Portuguese="73",e.Russian="0",e.Spanish="4",e.Ukrainian="1",e.Uzbek="65",e.Vietnamese="75"})(exports.VKNumericLanguage||(exports.VKNumericLanguage={}));const Oc="vk.com",wc=async(e,r,t)=>{const n=new URL(`https://${Oc}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",r),e!==void 0&&n.searchParams.set("lang",e);const o=await(await ia(n.toString())).json();return $c(o,t)},$c=(e,r)=>gc(Object.entries(e.keys).map(([t,n])=>[t.substring(`${r}_`.length),mc(n)])),mc=e=>Array.isArray(e)?e[0]:e;exports.InterfaceLanguage=void 0;(function(e){e.RU="ru",e.EN="en"})(exports.InterfaceLanguage||(exports.InterfaceLanguage={}));exports.Logger=ln;exports.Observable=b;exports.Subject=qe;exports.Subscription=Y;exports.VERSION=on;exports.ValueSubject=Ln;exports.abortable=dn;exports.addScript=vn;exports.areQualitiesExact=An;exports.assertNever=L;exports.assertNonNullable=cn;exports.assertNullable=un;exports.assertQualityIsExact=jn;exports.buffer=Gn;exports.checkNever=sn;exports.combine=Cn;exports.debounce=Bn;exports.fillWithDefault=ot;exports.filter=Yn;exports.filterChanged=zn;exports.fromEvent=Fn;exports.getCurrentBrowser=nt;exports.getExponentialDelay=bn;exports.getHighestQuality=In;exports.interval=Mn;exports.isHigher=En;exports.isHigherOrEqual=Sn;exports.isIOS=hn;exports.isInvariantQuality=He;exports.isLower=Ye;exports.isLowerOrEqual=Tn;exports.isNonNullable=rt;exports.isNullable=tt;exports.loadVKLangPack=wc;exports.map=it;exports.mapTo=Jn;exports.merge=xn;exports.noop=G;exports.now=fn;exports.observableFrom=Dn;exports.once=Zn;exports.pairwise=ea;exports.safeStorage=mn;exports.tap=ta;exports.throttle=Kn;exports.timeout=Nn;exports.videoHeightToQuality=Rn;exports.videoQualityToHeight=_n;exports.videoSizeToQuality=Pn;
package/es2018.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.27
3
- * Fri, 18 Aug 2023 12:34:43 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-27/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.28
3
+ * Tue, 29 Aug 2023 12:41:47 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-28/doc/
5
5
  */
6
- const B="1.0.27";class _{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 m=t=>{throw new Error(`${t} is value of unexpected type`)},ee=t=>{},E=()=>{};class l{constructor(e){e&&(this._subscribe=e)}subscribe(e,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 s=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 r;try{r=this._subscribe(s)}catch(a){(n=s.error)===null||n===void 0||n.call(s,a)}return new _().add(()=>{switch(s.next=E,s.error=E,typeof r){case"function":r();return;case"object":r.unsubscribe();return;case"undefined":return;default:return m(r)}})}pipe(...e){return e.reduce((i,n)=>n(i),this)}_subscribe(e){}}class T extends l{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 _().add(()=>this.subscribers.delete(i))}}class te{constructor(){this.log$=new T,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 ie(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function ne(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function M(t){return typeof t!="undefined"&&t!==null}function Q(t){return t==null}const se=(t,e,i)=>new Promise((n,o)=>{e.addEventListener("abort",()=>{a(),w.remove()});const s=()=>{a(),o()},r=()=>{a(),n()},a=()=>{f&&clearTimeout(f),w.removeEventListener("load",r),w.removeEventListener("error",s)};let f;i&&(f=window.setTimeout(s,i));const w=document.createElement("script");w.addEventListener("load",r),w.addEventListener("error",s),w.src=t,document.head.appendChild(w)});var x;const re=typeof((x=window.performance)===null||x===void 0?void 0:x.now)=="function"?()=>window.performance.now():()=>Date.now(),oe=(t,e)=>async(...i)=>{var n;const o=e(...i);let s=t.aborted,r;for(;!s&&!t.aborted;){const a=await o.next(r);s=(n=a.done)!==null&&n!==void 0?n:!1,r=a.value}return r};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 v;(function(t){t.Unknown="Unknown",t.Android="Android",t.iPhone="iPhone",t.iPad="iPad",t.iPod="iPod",t.RestMobile="RestMobile",t.Desktop="Desktop"})(v||(v={}));const ae=()=>{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,s=/webkit|safari|khtml/i.test(t)?b.Safari:void 0,r=/opr\//i.test(t)?b.Opera:void 0,a=/edg/i.test(t)?b.Edge:void 0,f=/android/i.test(t)?v.Android:void 0,w=/iphone/i.test(t)?v.iPhone:void 0,P=/ipad/i.test(t)?v.iPad:void 0,y=/ipod/i.test(t)?v.iPod:void 0,N=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?v.RestMobile:void 0;return{browser:e||o||r||a||i||n||s||b.Rest,device:f||w||P||y||N||v.Desktop}},ce=(t,{start:e=0,factor:i=2,max:n=1/0,min:o=e,random:s=0}={})=>{let r=e;return r*=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 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(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(S),g=c.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)g=c.RUNTIME;else throw e}else throw t}return g===c.RUNTIME&&(u=new Map),g},G=()=>p()===c.LOCAL_STORAGE,V=t=>{var e,i;const n=p();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 u==null?void 0:u.get(t);default:m(n)}},k=(t,e)=>{const i=p();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(u==null?void 0:u.set(t,e));default:m(i)}},U=t=>{var e;const i=p();switch(i){case c.LOCAL_STORAGE:return t in localStorage;case c.SESSION_STORAGE:return t in sessionStorage;case c.RUNTIME:return(e=u==null?void 0:u.has(t))!==null&&e!==void 0?e:!1;default:return m(i),!1}},j=t=>{const e=p();switch(e){case c.LOCAL_STORAGE:return localStorage.removeItem(t);case c.SESSION_STORAGE:return sessionStorage.removeItem(t);case c.RUNTIME:return void(u==null?void 0:u.delete(t));default:m(e)}},F=()=>{const t=p();switch(t){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(t)}};var ue=Object.freeze({__proto__:null,clear:F,get:V,has:U,isPersistent:G,remove:j,set:k}),d;(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"})(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}},le=(t,e)=>h[t].height>h[e].height,de=(t,e)=>h[t].height>=h[e].height,I=(t,e)=>h[t].height<h[e].height,he=(t,e)=>h[t].height<=h[e].height,fe=t=>t.sort((e,i)=>e===i?0:e===d.INVARIANT?1:i===d.INVARIANT?-1:I(e,i)?1:-1)[0],L=Object.keys(h).sort((t,e)=>I(t,e)?-1:1),be=(t,e=.02)=>[...L].find(n=>h[n].height*(1+e)>=t),we=({width:t,height:e})=>{const i=Math.min(t,e),n=Math.max(t,e);return L.find(o=>{const s=h[o];return s.width>=n&&s.height>=i})},ve=t=>h[t].height,R=t=>t===d.INVARIANT,ge=t=>t.every(e=>!R(e));function me(t){if(R(t))throw new Error("Expected exact quality")}const D=(t,e)=>{const i={};for(const n of Object.keys(e)){const o=e[n],s=t[n];Array.isArray(o)&&Array.isArray(s)?i[n]=s:typeof o=="object"&&typeof s=="object"?i[n]=D(s,o):i[n]=n in t?s:o}return i};class pe extends T{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 Ee(t){return new l(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 _)})}function _e(...t){return new l(e=>t.reduce((i,n)=>i.add(n.subscribe(e)),new _))}var xe=t=>new l(e=>{const i=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},t);return()=>window.clearTimeout(i)}),Se=t=>new l(e=>{const i=window.setInterval(()=>e.next(),t);return()=>window.clearInterval(i)}),Oe=t=>new l(e=>{t.forEach(i=>e.next(i))}),Ae=(t,e)=>new l(i=>{const n=o=>i.next(o);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});function Te(t){return e=>new l(i=>e.subscribe(new q(i,t)))}class q{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 z={leading:!1,trailing:!0};function Ie(t,e=z){return i=>new l(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,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 H={leading:!0,trailing:!1};function Le(t,e=H){return i=>new l(n=>i.subscribe(new Y(n,t,e)))}class Y{constructor(e,i,n){this.destination=e,this.time=i,this.config=n}next(e){this.lastValue=e,Q(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 Re(t){return e=>new l(i=>e.subscribe(new K(i,t)))}class K{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 Pe(t=(e,i)=>e===i){return e=>new l(i=>e.subscribe(new W(i,t)))}const O={};class W{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(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 l(i=>e.subscribe(new X(i,t)))}let X=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 Me(){return t=>new l(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 Qe(){return t=>new l(e=>t.subscribe(new J(e)))}class J{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 Ge(t){return e=>new l(i=>e.subscribe(new Z(i,t)))}class Z{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 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={}));export{b as CurrentClientBrowser,v as CurrentClientDevice,A as ErrorCategory,te as Logger,l as Observable,T as Subject,_ as Subscription,B as VERSION,pe as ValueSubject,d as VideoQuality,oe as abortable,se as addScript,ge as areQualitiesExact,m as assertNever,ie as assertNonNullable,ne as assertNullable,me as assertQualityIsExact,Te as buffer,ee as checkNever,Ee as combine,Ie as debounce,D as fillWithDefault,Re as filter,Pe as filterChanged,Ae as fromEvent,ae as getCurrentBrowser,ce as getExponentialDelay,fe as getHighestQuality,Se as interval,le as isHigher,de as isHigherOrEqual,R as isInvariantQuality,I as isLower,he as isLowerOrEqual,M as isNonNullable,Q as isNullable,C as map,Ne as mapTo,_e as merge,E as noop,re as now,Oe as observableFrom,Me as once,Qe as pairwise,ue as safeStorage,Ge as tap,Le as throttle,xe as timeout,be as videoHeightToQuality,ve as videoQualityToHeight,we as videoSizeToQuality};
6
+ const Yc="1.0.28";class dr{constructor(){this.subscriptions=[]}unsubscribe(){const e=this.subscriptions;this.subscriptions=[],e.forEach(t=>typeof t=="function"?t():t.unsubscribe())}add(e){return this.subscriptions.push(e),this}}const V=r=>{throw new Error(`${r} is value of unexpected type`)},zc=r=>{},Q=()=>{};class b{constructor(e){e&&(this._subscribe=e)}subscribe(e,t){var n;let a;t?typeof t=="function"?a={next:t,error:Q}:a={next:s=>t.next(s),error:s=>{var v;return(v=t.error)===null||v===void 0?void 0:v.call(t,s)}}:a={next:Q,error:Q};const o=typeof e=="function"?{next:s=>{try{e(s)}catch(v){a.next(v)}},error:s=>a.next(s)}:{next:s=>e.next(s),error:s=>e.error?e.error(s):a.next(s)};let i;try{i=this._subscribe(o)}catch(s){(n=o.error)===null||n===void 0||n.call(o,s)}return new dr().add(()=>{switch(o.next=Q,o.error=Q,typeof i){case"function":i();return;case"object":i.unsubscribe();return;case"undefined":return;default:return V(i)}})}pipe(...e){return e.reduce((t,n)=>n(t),this)}_subscribe(e){}}class at extends b{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>{var n;return(n=t.error)===null||n===void 0?void 0:n.call(t,e)})}_subscribe(e){const t=this.keyCounter++;return this.subscribers.set(t,e),new dr().add(()=>this.subscribers.delete(t))}}class Qc{constructor(){this.log$=new at,this.logs=[],this.log=e=>{const t={...e,timestamp:Date.now()};this.logs.push(t),this.log$.next(t)},this.getAllLogs=()=>this.logs}createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch(a){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>({component:e,...t}))}}function Wc(r,e='Assertion "value is not nullable" failed'){if(r==null)throw new Error(e)}function Hc(r,e='Assertion "value is nullable" failed'){if(r!=null)throw new Error(e)}function sn(r){return typeof r!="undefined"&&r!==null}function cn(r){return r==null}const Xc=(r,e,t)=>new Promise((n,a)=>{e.addEventListener("abort",()=>{s(),c.remove()});const o=()=>{s(),a()},i=()=>{s(),n()},s=()=>{v&&clearTimeout(v),c.removeEventListener("load",i),c.removeEventListener("error",o)};let v;t&&(v=window.setTimeout(o,t));const c=document.createElement("script");c.addEventListener("load",i),c.addEventListener("error",o),c.src=r,document.head.appendChild(c)});var br;const Jc=typeof((br=window.performance)===null||br===void 0?void 0:br.now)=="function"?()=>window.performance.now():()=>Date.now(),Zc=(r,e)=>async(...t)=>{var n;const a=e(...t);let o=r.aborted,i;for(;!o&&!r.aborted;){const s=await a.next(i);o=(n=s.done)!==null&&n!==void 0?n:!1,i=s.value}return i};var _;(function(r){r.Unknown="Unknown",r.Yandex="Yandex",r.Chrome="Chrome",r.Chromium="Chromium",r.Firefox="Firefox",r.Safari="Safari",r.Opera="Opera",r.Edge="Edge",r.Rest="Rest"})(_||(_={}));var S;(function(r){r.Unknown="Unknown",r.Android="Android",r.iPhone="iPhone",r.iPad="iPad",r.iPod="iPod",r.RestMobile="RestMobile",r.Desktop="Desktop"})(S||(S={}));const ln=()=>{const{userAgent:r}=window.navigator,e=/yabrowser/i.test(r)?_.Yandex:void 0,t=/chrome|crios/i.test(r)?_.Chrome:void 0,n=/chromium/i.test(r)?_.Chromium:void 0,a=/firefox|fxios/i.test(r)?_.Firefox:void 0,o=/webkit|safari|khtml/i.test(r)?_.Safari:void 0,i=/opr\//i.test(r)?_.Opera:void 0,s=/edg/i.test(r)?_.Edge:void 0,v=/android/i.test(r)?S.Android:void 0,c=/iphone/i.test(r)?S.iPhone:void 0,l=/ipad/i.test(r)?S.iPad:void 0,f=/ipod/i.test(r)?S.iPod:void 0,u=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(r)?S.RestMobile:void 0;return{browser:e||a||i||s||t||n||o||_.Rest,device:v||c||l||f||u||S.Desktop}},rl=()=>[S.iPhone,S.iPad,S.iPod].includes(ln().device),el=(r,{start:e=0,factor:t=2,max:n=1/0,min:a=e,random:o=0}={})=>{let i=e;return i*=t**r,i*=1+(Math.random()*o*2-o),i=Math.round(i),i=Math.min(i,n),i=Math.max(i,a),i};var h;(function(r){r[r.LOCAL_STORAGE=0]="LOCAL_STORAGE",r[r.SESSION_STORAGE=1]="SESSION_STORAGE",r[r.RUNTIME=2]="RUNTIME"})(h||(h={}));let p,N;const yr=`vk-videoplayer-dummy-key-${Math.random()}`,B=()=>{if(N!==void 0)return N;try{localStorage.setItem(yr,"test"),localStorage.removeItem(yr),N=h.LOCAL_STORAGE}catch(r){if(r instanceof DOMException||r instanceof TypeError)try{sessionStorage.getItem(yr),N=h.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)N=h.RUNTIME;else throw e}else throw r}return N===h.RUNTIME&&(p=new Map),N},un=()=>B()===h.LOCAL_STORAGE,vn=r=>{var e,t;const n=B();switch(n){case h.LOCAL_STORAGE:return(e=localStorage.getItem(r))!==null&&e!==void 0?e:void 0;case h.SESSION_STORAGE:return(t=sessionStorage.getItem(r))!==null&&t!==void 0?t:void 0;case h.RUNTIME:return p==null?void 0:p.get(r);default:V(n)}},fn=(r,e)=>{const t=B();switch(t){case h.LOCAL_STORAGE:try{localStorage.setItem(r,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case h.SESSION_STORAGE:try{sessionStorage.setItem(r,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case h.RUNTIME:return void(p==null?void 0:p.set(r,e));default:V(t)}},dn=r=>{var e;const t=B();switch(t){case h.LOCAL_STORAGE:return r in localStorage;case h.SESSION_STORAGE:return r in sessionStorage;case h.RUNTIME:return(e=p==null?void 0:p.has(r))!==null&&e!==void 0?e:!1;default:return V(t),!1}},hn=r=>{const e=B();switch(e){case h.LOCAL_STORAGE:return localStorage.removeItem(r);case h.SESSION_STORAGE:return sessionStorage.removeItem(r);case h.RUNTIME:return void(p==null?void 0:p.delete(r));default:V(e)}},pn=()=>{const r=B();switch(r){case h.LOCAL_STORAGE:return localStorage.clear();case h.SESSION_STORAGE:return sessionStorage.clear();case h.RUNTIME:return p==null?void 0:p.clear();default:V(r)}};var tl=Object.freeze({__proto__:null,clear:pn,get:vn,has:dn,isPersistent:un,remove:hn,set:fn}),m;(function(r){r.INVARIANT="Invariant quality",r.Q_144P="144p",r.Q_240P="240p",r.Q_360P="360p",r.Q_480P="480p",r.Q_720P="720p",r.Q_1080P="1080p",r.Q_1440P="1440p",r.Q_2160P="2160p",r.Q_4320P="4320p"})(m||(m={}));const E={[m.Q_144P]:{width:256,height:144},[m.Q_240P]:{width:428,height:240},[m.Q_360P]:{width:640,height:360},[m.Q_480P]:{width:856,height:480},[m.Q_720P]:{width:1280,height:720},[m.Q_1080P]:{width:1920,height:1080},[m.Q_1440P]:{width:2560,height:1440},[m.Q_2160P]:{width:3840,height:2160},[m.Q_4320P]:{width:7680,height:4320}},nl=(r,e)=>E[r].height>E[e].height,al=(r,e)=>E[r].height>=E[e].height,ot=(r,e)=>E[r].height<E[e].height,ol=(r,e)=>E[r].height<=E[e].height,il=r=>r.sort((e,t)=>e===t?0:e===m.INVARIANT?1:t===m.INVARIANT?-1:ot(e,t)?1:-1)[0],it=Object.keys(E).sort((r,e)=>ot(r,e)?-1:1),sl=(r,e=.02)=>[...it].find(n=>E[n].height*(1+e)>=r),cl=({width:r,height:e})=>{const t=Math.min(r,e),n=Math.max(r,e);return it.find(a=>{const o=E[a];return o.width>=n&&o.height>=t})},ll=r=>E[r].height,st=r=>r===m.INVARIANT,ul=r=>r.every(e=>!st(e));function vl(r){if(st(r))throw new Error("Expected exact quality")}const bn=(r,e)=>{const t={};for(const n of Object.keys(e)){const a=e[n],o=r[n];Array.isArray(a)&&Array.isArray(o)?t[n]=o:typeof a=="object"&&typeof o=="object"?t[n]=bn(o,a):t[n]=n in r?o:a}return t};class fl extends at{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 t=super._subscribe(e);return e.next(this.value),t}}function dl(r){return new b(e=>{const t={};let n=Object.keys(r).length;const a=o=>i=>{o in t||n--,t[o]=i,n===0&&e.next(t)};return Object.entries(r).reduce((o,[i,s])=>o.add(s.subscribe(a(i))),new dr)})}function hl(...r){return new b(e=>r.reduce((t,n)=>t.add(n.subscribe(e)),new dr))}var pl=r=>new b(e=>{const t=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},r);return()=>window.clearTimeout(t)}),bl=r=>new b(e=>{const t=window.setInterval(()=>e.next(),r);return()=>window.clearInterval(t)}),yl=r=>new b(e=>{r.forEach(t=>e.next(t))}),gl=(r,e)=>new b(t=>{const n=a=>t.next(a);return r.addEventListener(e,n),()=>r.removeEventListener(e,n)});function Ol(r){return e=>new b(t=>e.subscribe(new yn(t,r)))}class yn{constructor(e,t){this.destination=e,this.size=t,this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}const gn={leading:!1,trailing:!0};function $l(r,e=gn){return t=>new b(n=>t.subscribe(new On(n,r,e)))}class On{constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,sn(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(t){if(this.destination.error)this.destination.error(t);else throw t}this.timeout=void 0},this.time)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}const $n={leading:!0,trailing:!1};function ml(r,e=$n){return t=>new b(n=>t.subscribe(new mn(n,r,e)))}class mn{constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,cn(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 t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}function wl(r){return e=>new b(t=>e.subscribe(new wn(t,r)))}class wn{constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(n){throw this.error(n),n}t&&this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}function El(r=(e,t)=>e===t){return e=>new b(t=>e.subscribe(new En(t,r)))}const ce={};class En{constructor(e,t){this.destination=e,this.predicate=t,this.lastValue=ce}next(e){let t;try{t=this.lastValue===ce||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}t&&this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}function Sn(r){return e=>new b(t=>e.subscribe(new Tn(t,r)))}let Tn=class{constructor(e,t){this.destination=e,this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(t)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}};function Tl(r){return Sn(()=>r)}function Il(){return r=>new b(e=>{let t=!1,n=!1;const a=r.subscribe(o=>{t||(t=!0,e.next(o)),n&&a.unsubscribe()},o=>{var i;t=!0,(i=e.error)===null||i===void 0||i.call(e,o),n&&a.unsubscribe()});return n=!0,t&&a.unsubscribe(),a})}function Rl(){return r=>new b(e=>r.subscribe(new In(e)))}class In{constructor(e){this.destination=e,this.hasLast=!1}next(e){const t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}function Pl(r){return e=>new b(t=>e.subscribe(new Rn(t,r)))}class Rn{constructor(e,t){this.destination=e,this.effect=t}next(e){try{this.effect(e)}catch(t){throw this.error(t),t}this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}var le;(function(r){r.NETWORK="network",r.VIDEO_PIPELINE="video_pipeline",r.EXTERNAL_API="external_api",r.PARSER="parser",r.DOM="dom",r.WTF="wtf"})(le||(le={}));class ue{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(e,t,n){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:t,options:n})}removeEventListener(e,t){if(!(e in this.listeners))return;const n=this.listeners[e];for(let a=0,o=n.length;a<o;a++)if(n[a].callback===t){n.splice(a,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;const n=this.listeners[e.type].slice();for(let a=0,o=n.length;a<o;a++){const i=n[a];try{i.callback.call(this,e)}catch(s){Promise.resolve().then(()=>{throw s})}i.options&&i.options.once&&this.removeEventListener(e.type,i.callback)}return!e.defaultPrevented}}class ct extends ue{constructor(){super(),this.listeners||ue.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(e){e.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,e)),super.dispatchEvent(e)}}class Pn{constructor(){Object.defineProperty(this,"signal",{value:new ct,writable:!0,configurable:!0})}abort(e){let t;try{t=new Event("abort")}catch(a){typeof document!="undefined"?document.createEvent?(t=document.createEvent("Event"),t.initEvent("abort",!1,!1)):(t=document.createEventObject(),t.type="abort"):t={type:"abort",bubbles:!1,cancelable:!1}}let n=e;if(n===void 0)if(typeof document=="undefined")n=new Error("This operation was aborted"),n.name="AbortError";else try{n=new DOMException("signal is aborted without reason")}catch(a){n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(t)}toString(){return"[object AbortController]"}}typeof Symbol!="undefined"&&Symbol.toStringTag&&(Pn.prototype[Symbol.toStringTag]="AbortController",ct.prototype[Symbol.toStringTag]="AbortSignal");function lt(r){return r.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof r.Request=="function"&&!r.Request.prototype.hasOwnProperty("signal")||!r.AbortController}function _n(r){typeof r=="function"&&(r={fetch:r});const{fetch:e,Request:t=e.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a=!1}=r;if(!lt({fetch:e,Request:t,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:a}))return{fetch:e,Request:o};let o=t;(o&&!o.prototype.hasOwnProperty("signal")||a)&&(o=function(c,l){let f;l&&l.signal&&(f=l.signal,delete l.signal);const u=new t(c,l);return f&&Object.defineProperty(u,"signal",{writable:!1,enumerable:!1,configurable:!0,value:f}),u},o.prototype=t.prototype);const i=e;return{fetch:(v,c)=>{const l=o&&o.prototype.isPrototypeOf(v)?v.signal:c?c.signal:void 0;if(l){let f;try{f=new DOMException("Aborted","AbortError")}catch(d){f=new Error("Aborted"),f.name="AbortError"}if(l.aborted)return Promise.reject(f);const u=new Promise((d,O)=>{l.addEventListener("abort",()=>O(f),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([u,i(v,c)])}return i(v,c)},Request:o}}const Wr=lt({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),ut=Wr?_n({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,An=Wr?ut.fetch:window.fetch;Wr?ut.Request:window.Request;var gr=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function jn(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var j=function(r){try{return!!r()}catch(e){return!0}},Ln=j,hr=!Ln(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")}),vt=hr,ft=Function.prototype,kr=ft.call,xn=vt&&ft.bind.bind(kr,kr),M=vt?xn:function(r){return function(){return kr.apply(r,arguments)}},dt=M,Nn=dt({}.toString),Mn=dt("".slice),Hr=function(r){return Mn(Nn(r),8,-1)},Cn=M,Gn=j,Fn=Hr,Or=Object,Dn=Cn("".split),kn=Gn(function(){return!Or("z").propertyIsEnumerable(0)})?function(r){return Fn(r)=="String"?Dn(r,""):Or(r)}:Or,Xr=function(r){return r==null},Un=Xr,Vn=TypeError,ht=function(r){if(Un(r))throw Vn("Can't call method on "+r);return r},Bn=kn,Kn=ht,H=function(r){return Bn(Kn(r))},K={},Z=function(r){return r&&r.Math==Math&&r},I=Z(typeof globalThis=="object"&&globalThis)||Z(typeof window=="object"&&window)||Z(typeof self=="object"&&self)||Z(typeof gr=="object"&&gr)||function(){return this}()||gr||Function("return this")(),Ur=typeof document=="object"&&document.all,qn=typeof Ur=="undefined"&&Ur!==void 0,pt={all:Ur,IS_HTMLDDA:qn},bt=pt,Yn=bt.all,R=bt.IS_HTMLDDA?function(r){return typeof r=="function"||r===Yn}:function(r){return typeof r=="function"},zn=I,Qn=R,ve=zn.WeakMap,Wn=Qn(ve)&&/native code/.test(String(ve)),fe=R,yt=pt,Hn=yt.all,q=yt.IS_HTMLDDA?function(r){return typeof r=="object"?r!==null:fe(r)||r===Hn}:function(r){return typeof r=="object"?r!==null:fe(r)},Xn=j,C=!Xn(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),Y={},Jn=I,de=q,Vr=Jn.document,Zn=de(Vr)&&de(Vr.createElement),gt=function(r){return Zn?Vr.createElement(r):{}},ra=C,ea=j,ta=gt,Ot=!ra&&!ea(function(){return Object.defineProperty(ta("div"),"a",{get:function(){return 7}}).a!=7}),na=C,aa=j,$t=na&&aa(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),oa=q,ia=String,sa=TypeError,z=function(r){if(oa(r))return r;throw sa(ia(r)+" is not an object")},ca=hr,rr=Function.prototype.call,G=ca?rr.bind(rr):function(){return rr.apply(rr,arguments)},Jr={},$r=Jr,mr=I,la=R,he=function(r){return la(r)?r:void 0},mt=function(r,e){return arguments.length<2?he($r[r])||he(mr[r]):$r[r]&&$r[r][e]||mr[r]&&mr[r][e]},ua=M,wt=ua({}.isPrototypeOf),va=typeof navigator!="undefined"&&String(navigator.userAgent)||"",Et=I,wr=va,pe=Et.process,be=Et.Deno,ye=pe&&pe.versions||be&&be.version,ge=ye&&ye.v8,T,ur;ge&&(T=ge.split("."),ur=T[0]>0&&T[0]<4?1:+(T[0]+T[1]));!ur&&wr&&(T=wr.match(/Edge\/(\d+)/),(!T||T[1]>=74)&&(T=wr.match(/Chrome\/(\d+)/),T&&(ur=+T[1])));var fa=ur,Oe=fa,da=j,ha=I,pa=ha.String,St=!!Object.getOwnPropertySymbols&&!da(function(){var r=Symbol();return!pa(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&Oe&&Oe<41}),ba=St,Tt=ba&&!Symbol.sham&&typeof Symbol.iterator=="symbol",ya=mt,ga=R,Oa=wt,$a=Tt,ma=Object,It=$a?function(r){return typeof r=="symbol"}:function(r){var e=ya("Symbol");return ga(e)&&Oa(e.prototype,ma(r))},wa=String,Zr=function(r){try{return wa(r)}catch(e){return"Object"}},Ea=R,Sa=Zr,Ta=TypeError,re=function(r){if(Ea(r))return r;throw Ta(Sa(r)+" is not a function")},Ia=re,Ra=Xr,ee=function(r,e){var t=r[e];return Ra(t)?void 0:Ia(t)},Er=G,Sr=R,Tr=q,Pa=TypeError,_a=function(r,e){var t,n;if(e==="string"&&Sr(t=r.toString)&&!Tr(n=Er(t,r))||Sr(t=r.valueOf)&&!Tr(n=Er(t,r))||e!=="string"&&Sr(t=r.toString)&&!Tr(n=Er(t,r)))return n;throw Pa("Can't convert object to primitive value")},Rt={exports:{}},$e=I,Aa=Object.defineProperty,ja=function(r,e){try{Aa($e,r,{value:e,configurable:!0,writable:!0})}catch(t){$e[r]=e}return e},La=I,xa=ja,me="__core-js_shared__",Na=La[me]||xa(me,{}),Pt=Na,we=Pt;(Rt.exports=function(r,e){return we[r]||(we[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.31.0",mode:"pure",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.0/LICENSE",source:"https://github.com/zloirock/core-js"});var _t=Rt.exports,Ma=ht,Ca=Object,At=function(r){return Ca(Ma(r))},Ga=M,Fa=At,Da=Ga({}.hasOwnProperty),x=Object.hasOwn||function(e,t){return Da(Fa(e),t)},ka=M,Ua=0,Va=Math.random(),Ba=ka(1 .toString),jt=function(r){return"Symbol("+(r===void 0?"":r)+")_"+Ba(++Ua+Va,36)},Ka=I,qa=_t,Ee=x,Ya=jt,za=St,Qa=Tt,U=Ka.Symbol,Ir=qa("wks"),Wa=Qa?U.for||U:U&&U.withoutSetter||Ya,L=function(r){return Ee(Ir,r)||(Ir[r]=za&&Ee(U,r)?U[r]:Wa("Symbol."+r)),Ir[r]},Ha=G,Se=q,Te=It,Xa=ee,Ja=_a,Za=L,ro=TypeError,eo=Za("toPrimitive"),to=function(r,e){if(!Se(r)||Te(r))return r;var t=Xa(r,eo),n;if(t){if(e===void 0&&(e="default"),n=Ha(t,r,e),!Se(n)||Te(n))return n;throw ro("Can't convert object to primitive value")}return e===void 0&&(e="number"),Ja(r,e)},no=to,ao=It,te=function(r){var e=no(r,"string");return ao(e)?e:e+""},oo=C,io=Ot,so=$t,er=z,Ie=te,co=TypeError,Rr=Object.defineProperty,lo=Object.getOwnPropertyDescriptor,Pr="enumerable",_r="configurable",Ar="writable";Y.f=oo?so?function(e,t,n){if(er(e),t=Ie(t),er(n),typeof e=="function"&&t==="prototype"&&"value"in n&&Ar in n&&!n[Ar]){var a=lo(e,t);a&&a[Ar]&&(e[t]=n.value,n={configurable:_r in n?n[_r]:a[_r],enumerable:Pr in n?n[Pr]:a[Pr],writable:!1})}return Rr(e,t,n)}:Rr:function(e,t,n){if(er(e),t=Ie(t),er(n),io)try{return Rr(e,t,n)}catch(a){}if("get"in n||"set"in n)throw co("Accessors not supported");return"value"in n&&(e[t]=n.value),e};var pr=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}},uo=C,vo=Y,fo=pr,X=uo?function(r,e,t){return vo.f(r,e,fo(1,t))}:function(r,e,t){return r[e]=t,r},ho=_t,po=jt,Re=ho("keys"),ne=function(r){return Re[r]||(Re[r]=po(r))},ae={},bo=Wn,Lt=I,yo=q,go=X,jr=x,Lr=Pt,Oo=ne,$o=ae,Pe="Object already initialized",Br=Lt.TypeError,mo=Lt.WeakMap,vr,W,fr,wo=function(r){return fr(r)?W(r):vr(r,{})},Eo=function(r){return function(e){var t;if(!yo(e)||(t=W(e)).type!==r)throw Br("Incompatible receiver, "+r+" required");return t}};if(bo||Lr.state){var P=Lr.state||(Lr.state=new mo);P.get=P.get,P.has=P.has,P.set=P.set,vr=function(r,e){if(P.has(r))throw Br(Pe);return e.facade=r,P.set(r,e),e},W=function(r){return P.get(r)||{}},fr=function(r){return P.has(r)}}else{var F=Oo("state");$o[F]=!0,vr=function(r,e){if(jr(r,F))throw Br(Pe);return e.facade=r,go(r,F,e),e},W=function(r){return jr(r,F)?r[F]:{}},fr=function(r){return jr(r,F)}}var So={set:vr,get:W,has:fr,enforce:wo,getterFor:Eo},To=hr,xt=Function.prototype,_e=xt.apply,Ae=xt.call,Io=typeof Reflect=="object"&&Reflect.apply||(To?Ae.bind(_e):function(){return Ae.apply(_e,arguments)}),Ro=Hr,Po=M,Nt=function(r){if(Ro(r)==="Function")return Po(r)},Mt={},Ct={},Gt={}.propertyIsEnumerable,Ft=Object.getOwnPropertyDescriptor,_o=Ft&&!Gt.call({1:2},1);Ct.f=_o?function(e){var t=Ft(this,e);return!!t&&t.enumerable}:Gt;var Ao=C,jo=G,Lo=Ct,xo=pr,No=H,Mo=te,Co=x,Go=Ot,je=Object.getOwnPropertyDescriptor;Mt.f=Ao?je:function(e,t){if(e=No(e),t=Mo(t),Go)try{return je(e,t)}catch(n){}if(Co(e,t))return xo(!jo(Lo.f,e,t),e[t])};var Fo=j,Do=R,ko=/#|\.prototype\./,J=function(r,e){var t=Vo[Uo(r)];return t==Ko?!0:t==Bo?!1:Do(e)?Fo(e):!!e},Uo=J.normalize=function(r){return String(r).replace(ko,".").toLowerCase()},Vo=J.data={},Bo=J.NATIVE="N",Ko=J.POLYFILL="P",qo=J,Le=Nt,Yo=re,zo=hr,Qo=Le(Le.bind),Dt=function(r,e){return Yo(r),e===void 0?r:zo?Qo(r,e):function(){return r.apply(e,arguments)}},tr=I,Wo=Io,Ho=Nt,Xo=R,Jo=Mt.f,Zo=qo,D=Jr,ri=Dt,k=X,xe=x,ei=function(r){var e=function(t,n,a){if(this instanceof e){switch(arguments.length){case 0:return new r;case 1:return new r(t);case 2:return new r(t,n)}return new r(t,n,a)}return Wo(r,this,arguments)};return e.prototype=r.prototype,e},kt=function(r,e){var t=r.target,n=r.global,a=r.stat,o=r.proto,i=n?tr:a?tr[t]:(tr[t]||{}).prototype,s=n?D:D[t]||k(D,t,{})[t],v=s.prototype,c,l,f,u,d,O,w,$,y;for(u in e)c=Zo(n?u:t+(a?".":"#")+u,r.forced),l=!c&&i&&xe(i,u),O=s[u],l&&(r.dontCallGetSet?(y=Jo(i,u),w=y&&y.value):w=i[u]),d=l&&w?w:e[u],!(l&&typeof O==typeof d)&&(r.bind&&l?$=ri(d,tr):r.wrap&&l?$=ei(d):o&&Xo(d)?$=Ho(d):$=d,(r.sham||d&&d.sham||O&&O.sham)&&k($,"sham",!0),k(s,u,$),o&&(f=t+"Prototype",xe(D,f)||k(D,f,{}),k(D[f],u,d),r.real&&v&&(c||!v[u])&&k(v,u,d)))},Kr=C,ti=x,Ut=Function.prototype,ni=Kr&&Object.getOwnPropertyDescriptor,oe=ti(Ut,"name"),ai=oe&&function(){}.name==="something",oi=oe&&(!Kr||Kr&&ni(Ut,"name").configurable),ii={EXISTS:oe,PROPER:ai,CONFIGURABLE:oi},Vt={},si=Math.ceil,ci=Math.floor,li=Math.trunc||function(e){var t=+e;return(t>0?ci:si)(t)},ui=li,Bt=function(r){var e=+r;return e!==e||e===0?0:ui(e)},vi=Bt,fi=Math.max,di=Math.min,hi=function(r,e){var t=vi(r);return t<0?fi(t+e,0):di(t,e)},pi=Bt,bi=Math.min,yi=function(r){return r>0?bi(pi(r),9007199254740991):0},gi=yi,Kt=function(r){return gi(r.length)},Oi=H,$i=hi,mi=Kt,Ne=function(r){return function(e,t,n){var a=Oi(e),o=mi(a),i=$i(n,o),s;if(r&&t!=t){for(;o>i;)if(s=a[i++],s!=s)return!0}else for(;o>i;i++)if((r||i in a)&&a[i]===t)return r||i||0;return!r&&-1}},wi={includes:Ne(!0),indexOf:Ne(!1)},Ei=M,xr=x,Si=H,Ti=wi.indexOf,Ii=ae,Me=Ei([].push),Ri=function(r,e){var t=Si(r),n=0,a=[],o;for(o in t)!xr(Ii,o)&&xr(t,o)&&Me(a,o);for(;e.length>n;)xr(t,o=e[n++])&&(~Ti(a,o)||Me(a,o));return a},qt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Pi=Ri,_i=qt,Ai=Object.keys||function(e){return Pi(e,_i)},ji=C,Li=$t,xi=Y,Ni=z,Mi=H,Ci=Ai;Vt.f=ji&&!Li?Object.defineProperties:function(e,t){Ni(e);for(var n=Mi(t),a=Ci(t),o=a.length,i=0,s;o>i;)xi.f(e,s=a[i++],n[s]);return e};var Gi=mt,Fi=Gi("document","documentElement"),Di=z,ki=Vt,Ce=qt,Ui=ae,Vi=Fi,Bi=gt,Ki=ne,Ge=">",Fe="<",qr="prototype",Yr="script",Yt=Ki("IE_PROTO"),Nr=function(){},zt=function(r){return Fe+Yr+Ge+r+Fe+"/"+Yr+Ge},De=function(r){r.write(zt("")),r.close();var e=r.parentWindow.Object;return r=null,e},qi=function(){var r=Bi("iframe"),e="java"+Yr+":",t;return r.style.display="none",Vi.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(zt("document.F=Object")),t.close(),t.F},nr,sr=function(){try{nr=new ActiveXObject("htmlfile")}catch(e){}sr=typeof document!="undefined"?document.domain&&nr?De(nr):qi():De(nr);for(var r=Ce.length;r--;)delete sr[qr][Ce[r]];return sr()};Ui[Yt]=!0;var Qt=Object.create||function(e,t){var n;return e!==null?(Nr[qr]=Di(e),n=new Nr,Nr[qr]=null,n[Yt]=e):n=sr(),t===void 0?n:ki.f(n,t)},Yi=j,zi=!Yi(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype}),Qi=x,Wi=R,Hi=At,Xi=ne,Ji=zi,ke=Xi("IE_PROTO"),zr=Object,Zi=zr.prototype,Wt=Ji?zr.getPrototypeOf:function(r){var e=Hi(r);if(Qi(e,ke))return e[ke];var t=e.constructor;return Wi(t)&&e instanceof t?t.prototype:e instanceof zr?Zi:null},rs=X,Ht=function(r,e,t,n){return n&&n.enumerable?r[e]=t:rs(r,e,t),r},es=j,ts=R,ns=q,as=Qt,Ue=Wt,os=Ht,is=L,Qr=is("iterator"),Xt=!1,A,Mr,Cr;[].keys&&(Cr=[].keys(),"next"in Cr?(Mr=Ue(Ue(Cr)),Mr!==Object.prototype&&(A=Mr)):Xt=!0);var ss=!ns(A)||es(function(){var r={};return A[Qr].call(r)!==r});ss?A={}:A=as(A);ts(A[Qr])||os(A,Qr,function(){return this});var Jt={IteratorPrototype:A,BUGGY_SAFARI_ITERATORS:Xt},cs=L,ls=cs("toStringTag"),Zt={};Zt[ls]="z";var ie=String(Zt)==="[object z]",us=ie,vs=R,cr=Hr,fs=L,ds=fs("toStringTag"),hs=Object,ps=cr(function(){return arguments}())=="Arguments",bs=function(r,e){try{return r[e]}catch(t){}},se=us?cr:function(r){var e,t,n;return r===void 0?"Undefined":r===null?"Null":typeof(t=bs(e=hs(r),ds))=="string"?t:ps?cr(e):(n=cr(e))=="Object"&&vs(e.callee)?"Arguments":n},ys=ie,gs=se,Os=ys?{}.toString:function(){return"[object "+gs(this)+"]"},$s=ie,ms=Y.f,ws=X,Es=x,Ss=Os,Ts=L,Ve=Ts("toStringTag"),rn=function(r,e,t,n){if(r){var a=t?r:r.prototype;Es(a,Ve)||ms(a,Ve,{configurable:!0,value:e}),n&&!$s&&ws(a,"toString",Ss)}},Is=Jt.IteratorPrototype,Rs=Qt,Ps=pr,_s=rn,As=K,js=function(){return this},Ls=function(r,e,t,n){var a=e+" Iterator";return r.prototype=Rs(Is,{next:Ps(+!n,t)}),_s(r,a,!1,!0),As[a]=js,r},xs=kt,Ns=G,en=ii,Ms=Ls,Cs=Wt,Gs=rn,Be=Ht,Fs=L,Ke=K,tn=Jt,Ds=en.PROPER;en.CONFIGURABLE;tn.IteratorPrototype;var ar=tn.BUGGY_SAFARI_ITERATORS,Gr=Fs("iterator"),qe="keys",or="values",Ye="entries",ks=function(){return this},Us=function(r,e,t,n,a,o,i){Ms(t,e,n);var s=function(y){if(y===a&&u)return u;if(!ar&&y in l)return l[y];switch(y){case qe:return function(){return new t(this,y)};case or:return function(){return new t(this,y)};case Ye:return function(){return new t(this,y)}}return function(){return new t(this)}},v=e+" Iterator",c=!1,l=r.prototype,f=l[Gr]||l["@@iterator"]||a&&l[a],u=!ar&&f||s(a),d=e=="Array"&&l.entries||f,O,w,$;if(d&&(O=Cs(d.call(new r)),O!==Object.prototype&&O.next&&(Gs(O,v,!0,!0),Ke[v]=ks)),Ds&&a==or&&f&&f.name!==or&&(c=!0,u=function(){return Ns(f,this)}),a)if(w={values:s(or),keys:o?u:s(qe),entries:s(Ye)},i)for($ in w)(ar||c||!($ in l))&&Be(l,$,w[$]);else xs({target:e,proto:!0,forced:ar||c},w);return i&&l[Gr]!==u&&Be(l,Gr,u,{name:a}),Ke[e]=u,w},Vs=function(r,e){return{value:r,done:e}},Bs=H,ze=K,nn=So;Y.f;var Ks=Us,ir=Vs,an="Array Iterator",qs=nn.set,Ys=nn.getterFor(an);Ks(Array,"Array",function(r,e){qs(this,{type:an,target:Bs(r),index:0,kind:e})},function(){var r=Ys(this),e=r.target,t=r.kind,n=r.index++;return!e||n>=e.length?(r.target=void 0,ir(void 0,!0)):t=="keys"?ir(n,!1):t=="values"?ir(e[n],!1):ir([n,e[n]],!1)},"values");ze.Arguments=ze.Array;var zs=L,Qs=K,Ws=zs("iterator"),Hs=Array.prototype,Xs=function(r){return r!==void 0&&(Qs.Array===r||Hs[Ws]===r)},Js=se,Qe=ee,Zs=Xr,rc=K,ec=L,tc=ec("iterator"),on=function(r){if(!Zs(r))return Qe(r,tc)||Qe(r,"@@iterator")||rc[Js(r)]},nc=G,ac=re,oc=z,ic=Zr,sc=on,cc=TypeError,lc=function(r,e){var t=arguments.length<2?sc(r):e;if(ac(t))return oc(nc(t,r));throw cc(ic(r)+" is not iterable")},uc=G,We=z,vc=ee,fc=function(r,e,t){var n,a;We(r);try{if(n=vc(r,"return"),!n){if(e==="throw")throw t;return t}n=uc(n,r)}catch(o){a=!0,n=o}if(e==="throw")throw t;if(a)throw n;return We(n),t},dc=Dt,hc=G,pc=z,bc=Zr,yc=Xs,gc=Kt,He=wt,Oc=lc,$c=on,Xe=fc,mc=TypeError,lr=function(r,e){this.stopped=r,this.result=e},Je=lr.prototype,wc=function(r,e,t){var n=t&&t.that,a=!!(t&&t.AS_ENTRIES),o=!!(t&&t.IS_RECORD),i=!!(t&&t.IS_ITERATOR),s=!!(t&&t.INTERRUPTED),v=dc(e,n),c,l,f,u,d,O,w,$=function(g){return c&&Xe(c,"normal",g),new lr(!0,g)},y=function(g){return a?(pc(g),s?v(g[0],g[1],$):v(g[0],g[1])):s?v(g,$):v(g)};if(o)c=r.iterator;else if(i)c=r;else{if(l=$c(r),!l)throw mc(bc(r)+" is not iterable");if(yc(l)){for(f=0,u=gc(r);u>f;f++)if(d=y(r[f]),d&&He(Je,d))return d;return new lr(!1)}c=Oc(r,l)}for(O=o?r.next:c.next;!(w=hc(O,c)).done;){try{d=y(w.value)}catch(g){Xe(c,"throw",g)}if(typeof d=="object"&&d&&He(Je,d))return d}return new lr(!1)},Ec=te,Sc=Y,Tc=pr,Ic=function(r,e,t){var n=Ec(e);n in r?Sc.f(r,n,Tc(0,t)):r[n]=t},Rc=kt,Pc=wc,_c=Ic;Rc({target:"Object",stat:!0},{fromEntries:function(e){var t={};return Pc(e,function(n,a){_c(t,n,a)},{AS_ENTRIES:!0}),t}});var Ac=Jr,jc=Ac.Object.fromEntries,Lc={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},xc=Lc,Nc=I,Mc=se,Cc=X,Ze=K,Gc=L,rt=Gc("toStringTag");for(var Fr in xc){var et=Nc[Fr],Dr=et&&et.prototype;Dr&&Mc(Dr)!==rt&&Cc(Dr,rt,Fr),Ze[Fr]=Ze.Array}var Fc=jc,Dc=Fc,kc=Dc,Uc=kc,Vc=jn(Uc),tt;(function(r){r.Armenian="58",r.Azerbaijani="57",r.Belarusian="114",r.English="3",r.Kazakh="97",r.Portuguese="73",r.Russian="0",r.Spanish="4",r.Ukrainian="1",r.Uzbek="65",r.Vietnamese="75"})(tt||(tt={}));const Bc="vk.com",_l=async(r,e,t)=>{const n=new URL(`https://${Bc}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),r!==void 0&&n.searchParams.set("lang",r);const o=await(await An(n.toString())).json();return Kc(o,t)},Kc=(r,e)=>Vc(Object.entries(r.keys).map(([t,n])=>[t.substring(`${e}_`.length),qc(n)])),qc=r=>Array.isArray(r)?r[0]:r;var nt;(function(r){r.RU="ru",r.EN="en"})(nt||(nt={}));export{_ as CurrentClientBrowser,S as CurrentClientDevice,le as ErrorCategory,nt as InterfaceLanguage,Qc as Logger,b as Observable,at as Subject,dr as Subscription,Yc as VERSION,tt as VKNumericLanguage,fl as ValueSubject,m as VideoQuality,Zc as abortable,Xc as addScript,ul as areQualitiesExact,V as assertNever,Wc as assertNonNullable,Hc as assertNullable,vl as assertQualityIsExact,Ol as buffer,zc as checkNever,dl as combine,$l as debounce,bn as fillWithDefault,wl as filter,El as filterChanged,gl as fromEvent,ln as getCurrentBrowser,el as getExponentialDelay,il as getHighestQuality,bl as interval,nl as isHigher,al as isHigherOrEqual,rl as isIOS,st as isInvariantQuality,ot as isLower,ol as isLowerOrEqual,sn as isNonNullable,cn as isNullable,_l as loadVKLangPack,Sn as map,Tl as mapTo,hl as merge,Q as noop,Jc as now,yl as observableFrom,Il as once,Rl as pairwise,tl as safeStorage,Pl as tap,ml as throttle,pl as timeout,sl as videoHeightToQuality,ll as videoQualityToHeight,cl as videoSizeToQuality};
package/esnext.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.27
3
- * Fri, 18 Aug 2023 12:34:43 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-27/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.28
3
+ * Tue, 29 Aug 2023 12:41:47 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-28/doc/
5
5
  */
6
- "use strict";const C="1.0.27";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`)},Q=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:s=>i.next(s),error:s=>i.error?.(s)}:r={next:b,error:b};const o=typeof e=="function"?{next:s=>{try{e(s)}catch(l){r.next(l)}},error:s=>r.next(s)}:{next:s=>e.next(s),error:s=>e.error?e.error(s):r.next(s)};let n;try{n=this._subscribe(o)}catch(s){o.error?.(s)}return new p().add(()=>{switch(o.next=b,o.error=b,typeof n){case"function":n();return;case"object":n.unsubscribe();return;case"undefined":return;default:return f(n)}})}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 P{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 M(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function y(t){return typeof t<"u"&&t!==null}function A(t){return t==null}const D=(t,e,i)=>new Promise((r,o)=>{e.addEventListener("abort",()=>{l(),h.remove()});const n=()=>{l(),o()},s=()=>{l(),r()},l=()=>{m&&clearTimeout(m),h.removeEventListener("load",s),h.removeEventListener("error",n)};let m;i&&(m=window.setTimeout(n,i));const h=document.createElement("script");h.addEventListener("load",s),h.addEventListener("error",n),h.src=t,document.head.appendChild(h)}),G=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),k=(t,e)=>async(...i)=>{const r=e(...i);let o=t.aborted,n;for(;!o&&!t.aborted;){const s=await r.next(n);o=s.done??!1,n=s.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,n=/webkit|safari|khtml/i.test(t)?exports.CurrentClientBrowser.Safari:void 0,s=/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,N=/ipod/i.test(t)?exports.CurrentClientDevice.iPod:void 0,R=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?exports.CurrentClientDevice.RestMobile:void 0;return{browser:e||o||s||l||i||r||n||exports.CurrentClientBrowser.Rest,device:m||h||L||N||R||exports.CurrentClientDevice.Desktop}},j=(t,{start:e=0,factor:i=2,max:r=1/0,min:o=e,random:n=0}={})=>{let s=e;return s*=i**t,s*=1+(Math.random()*n*2-n),s=Math.round(s),s=Math.min(s,r),s=Math.max(s,o),s};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)}},q=(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)}},z=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}},B=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)}},$=()=>{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 W=Object.freeze({__proto__:null,clear:$,get:H,has:z,isPersistent:F,remove:B,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 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}},Y=(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,X=(t,e)=>u[t].height<=u[e].height,J=t=>t.sort((e,i)=>e===i?0:e===exports.VideoQuality.INVARIANT?1:i===exports.VideoQuality.INVARIANT?-1:x(e,i)?1:-1)[0],T=Object.keys(u).sort((t,e)=>x(t,e)?-1:1),Z=(t,e=.02)=>[...T].find(r=>u[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 n=u[o];return n.width>=r&&n.height>=i})},te=t=>u[t].height,v=t=>t===exports.VideoQuality.INVARIANT,ie=t=>t.every(e=>!v(e));function re(t){if(v(t))throw new Error("Expected exact quality")}const _=(t,e)=>{const i={};for(const r of Object.keys(e)){const o=e[r],n=t[r];Array.isArray(o)&&Array.isArray(n)?i[r]=n:typeof o=="object"&&typeof n=="object"?i[r]=_(n,o):i[r]=r in t?n:o}return i};class ne 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 se(t){return new c(e=>{const i={};let r=Object.keys(t).length;const o=n=>s=>{n in i||r--,i[n]=s,r===0&&e.next(i)};return Object.entries(t).reduce((n,[s,l])=>n.add(l.subscribe(o(s))),new p)})}function oe(...t){return new c(e=>t.reduce((i,r)=>i.add(r.subscribe(e)),new p))}var ae=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)}),ce=t=>new c(e=>{const i=window.setInterval(()=>e.next(),t);return()=>window.clearInterval(i)}),ue=t=>new c(e=>{t.forEach(i=>e.next(i))}),le=(t,e)=>new c(i=>{const r=o=>i.next(o);return t.addEventListener(e,r),()=>t.removeEventListener(e,r)});function he(t){return e=>new c(i=>e.subscribe(new de(i,t)))}class de{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 fe={leading:!1,trailing:!0};function be(t,e=fe){return i=>new c(r=>i.subscribe(new we(r,t,e)))}class we{destination;time;config;lastValue;timeout;constructor(e,i,r){this.destination=e,this.time=i,this.config=r}next(e){this.lastValue=e,y(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 ge={leading:!0,trailing:!1};function me(t,e=ge){return i=>new c(r=>i.subscribe(new pe(r,t,e)))}class pe{destination;time;config;lastValue;timeout;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){this.destination.error?.(e)}}function Ee(t){return e=>new c(i=>e.subscribe(new Se(i,t)))}class Se{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 xe(t=(e,i)=>e===i){return e=>new c(i=>e.subscribe(new ve(i,t)))}const O={};class ve{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 I(t){return e=>new c(i=>e.subscribe(new Oe(i,t)))}let Oe=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 ye(t){return I(()=>t)}function Ae(){return t=>new c(e=>{let i=!1,r=!1;const o=t.subscribe(n=>{i||(i=!0,e.next(n)),r&&o.unsubscribe()},n=>{i=!0,e.error?.(n),r&&o.unsubscribe()});return r=!0,i&&o.unsubscribe(),o})}function Te(){return t=>new c(e=>t.subscribe(new _e(e)))}class _e{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 Ie(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={}));exports.Logger=P;exports.Observable=c;exports.Subject=S;exports.Subscription=p;exports.VERSION=C;exports.ValueSubject=ne;exports.abortable=k;exports.addScript=D;exports.areQualitiesExact=ie;exports.assertNever=f;exports.assertNonNullable=V;exports.assertNullable=M;exports.assertQualityIsExact=re;exports.buffer=he;exports.checkNever=Q;exports.combine=se;exports.debounce=be;exports.fillWithDefault=_;exports.filter=Ee;exports.filterChanged=xe;exports.fromEvent=le;exports.getCurrentBrowser=U;exports.getExponentialDelay=j;exports.getHighestQuality=J;exports.interval=ce;exports.isHigher=Y;exports.isHigherOrEqual=K;exports.isInvariantQuality=v;exports.isLower=x;exports.isLowerOrEqual=X;exports.isNonNullable=y;exports.isNullable=A;exports.map=I;exports.mapTo=ye;exports.merge=oe;exports.noop=b;exports.now=G;exports.observableFrom=ue;exports.once=Ae;exports.pairwise=Te;exports.safeStorage=W;exports.tap=Ie;exports.throttle=me;exports.timeout=ae;exports.videoHeightToQuality=Z;exports.videoQualityToHeight=te;exports.videoSizeToQuality=ee;
6
+ "use strict";const q="1.0.28";class S{subscriptions=[];unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach(r=>typeof r=="function"?r():r.unsubscribe())}add(t){return this.subscriptions.push(t),this}}const p=e=>{throw new Error(`${e} is value of unexpected type`)},F=e=>{},m=()=>{};class l{constructor(t){t&&(this._subscribe=t)}subscribe(t,r){let n;r?typeof r=="function"?n={next:r,error:m}:n={next:o=>r.next(o),error:o=>r.error?.(o)}:n={next:m,error:m};const s=typeof t=="function"?{next:o=>{try{t(o)}catch(u){n.next(u)}},error:o=>n.next(o)}:{next:o=>t.next(o),error:o=>t.error?t.error(o):n.next(o)};let i;try{i=this._subscribe(s)}catch(o){s.error?.(o)}return new S().add(()=>{switch(s.next=m,s.error=m,typeof i){case"function":i();return;case"object":i.unsubscribe();return;case"undefined":return;default:return p(i)}})}pipe(...t){return t.reduce((r,n)=>n(r),this)}_subscribe(t){}}class v extends l{keyCounter=0;subscribers=new Map;constructor(){super()}next(t){this.subscribers.forEach(r=>r.next(t))}error(t){this.subscribers.forEach(r=>r.error?.(t))}_subscribe(t){const r=this.keyCounter++;return this.subscribers.set(r,t),new S().add(()=>this.subscribers.delete(r))}}class U{log$=new v;logs=[];log=t=>{const r={...t,timestamp:Date.now()};this.logs.push(r),this.log$.next(r)};createCustomLog(t){return(...r)=>{let n;try{n=t(...r)}catch{n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(t){return this.createCustomLog(r=>({component:t,...r}))}getAllLogs=()=>this.logs}function G(e,t='Assertion "value is not nullable" failed'){if(e==null)throw new Error(t)}function B(e,t='Assertion "value is nullable" failed'){if(e!=null)throw new Error(t)}function C(e){return typeof e<"u"&&e!==null}function P(e){return e==null}const z=(e,t,r)=>new Promise((n,s)=>{t.addEventListener("abort",()=>{u(),c.remove()});const i=()=>{u(),s()},o=()=>{u(),n()},u=()=>{h&&clearTimeout(h),c.removeEventListener("load",o),c.removeEventListener("error",i)};let h;r&&(h=window.setTimeout(i,r));const c=document.createElement("script");c.addEventListener("load",o),c.addEventListener("error",i),c.src=e,document.head.appendChild(c)}),H=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),$=(e,t)=>async(...r)=>{const n=t(...r);let s=e.aborted,i;for(;!s&&!e.aborted;){const o=await n.next(i);s=o.done??!1,i=o.value}return i};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 T=()=>{const{userAgent:e}=window.navigator,t=/yabrowser/i.test(e)?exports.CurrentClientBrowser.Yandex:void 0,r=/chrome|crios/i.test(e)?exports.CurrentClientBrowser.Chrome:void 0,n=/chromium/i.test(e)?exports.CurrentClientBrowser.Chromium:void 0,s=/firefox|fxios/i.test(e)?exports.CurrentClientBrowser.Firefox:void 0,i=/webkit|safari|khtml/i.test(e)?exports.CurrentClientBrowser.Safari:void 0,o=/opr\//i.test(e)?exports.CurrentClientBrowser.Opera:void 0,u=/edg/i.test(e)?exports.CurrentClientBrowser.Edge:void 0,h=/android/i.test(e)?exports.CurrentClientDevice.Android:void 0,c=/iphone/i.test(e)?exports.CurrentClientDevice.iPhone:void 0,f=/ipad/i.test(e)?exports.CurrentClientDevice.iPad:void 0,b=/ipod/i.test(e)?exports.CurrentClientDevice.iPod:void 0,g=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?exports.CurrentClientDevice.RestMobile:void 0;return{browser:t||s||o||u||r||n||i||exports.CurrentClientBrowser.Rest,device:h||c||f||b||g||exports.CurrentClientDevice.Desktop}},Y=()=>[exports.CurrentClientDevice.iPhone,exports.CurrentClientDevice.iPad,exports.CurrentClientDevice.iPod].includes(T().device),W=(e,{start:t=0,factor:r=2,max:n=1/0,min:s=t,random:i=0}={})=>{let o=t;return o*=r**e,o*=1+(Math.random()*i*2-i),o=Math.round(o),o=Math.min(o,n),o=Math.max(o,s),o};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={}));let E,w;const O=`vk-videoplayer-dummy-key-${Math.random()}`,y=()=>{if(w!==void 0)return w;try{localStorage.setItem(O,"test"),localStorage.removeItem(O),w=a.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(O),w=a.SESSION_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)w=a.RUNTIME;else throw t}else throw e}return w===a.RUNTIME&&(E=new Map),w},K=()=>y()===a.LOCAL_STORAGE,X=e=>{const t=y();switch(t){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:p(t)}},J=(e,t)=>{const r=y();switch(r){case a.LOCAL_STORAGE:try{localStorage.setItem(e,t)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case a.SESSION_STORAGE:try{sessionStorage.setItem(e,t)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case a.RUNTIME:return void E?.set(e,t);default:p(r)}},Z=e=>{const t=y();switch(t){case a.LOCAL_STORAGE:return e in localStorage;case a.SESSION_STORAGE:return e in sessionStorage;case a.RUNTIME:return E?.has(e)??!1;default:return p(t),!1}},ee=e=>{const t=y();switch(t){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:p(t)}},te=()=>{const e=y();switch(e){case a.LOCAL_STORAGE:return localStorage.clear();case a.SESSION_STORAGE:return sessionStorage.clear();case a.RUNTIME:return E?.clear();default:p(e)}};var re=Object.freeze({__proto__:null,clear:te,get:X,has:Z,isPersistent:K,remove:ee,set:J});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 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}},ne=(e,t)=>d[e].height>d[t].height,ie=(e,t)=>d[e].height>=d[t].height,A=(e,t)=>d[e].height<d[t].height,se=(e,t)=>d[e].height<=d[t].height,oe=e=>e.sort((t,r)=>t===r?0:t===exports.VideoQuality.INVARIANT?1:r===exports.VideoQuality.INVARIANT?-1:A(t,r)?1:-1)[0],I=Object.keys(d).sort((e,t)=>A(e,t)?-1:1),ae=(e,t=.02)=>[...I].find(n=>d[n].height*(1+t)>=e),ce=({width:e,height:t})=>{const r=Math.min(e,t),n=Math.max(e,t);return I.find(s=>{const i=d[s];return i.width>=n&&i.height>=r})},le=e=>d[e].height,x=e=>e===exports.VideoQuality.INVARIANT,ue=e=>e.every(t=>!x(t));function de(e){if(x(e))throw new Error("Expected exact quality")}const N=(e,t)=>{const r={};for(const n of Object.keys(t)){const s=t[n],i=e[n];Array.isArray(s)&&Array.isArray(i)?r[n]=i:typeof s=="object"&&typeof i=="object"?r[n]=N(i,s):r[n]=n in e?i:s}return r};class he extends v{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 r=super._subscribe(t);return t.next(this.value),r}}function fe(e){return new l(t=>{const r={};let n=Object.keys(e).length;const s=i=>o=>{i in r||n--,r[i]=o,n===0&&t.next(r)};return Object.entries(e).reduce((i,[o,u])=>i.add(u.subscribe(s(o))),new S)})}function be(...e){return new l(t=>e.reduce((r,n)=>r.add(n.subscribe(t)),new S))}var we=e=>new l(t=>{const r=window.setTimeout(()=>{try{t.next()}catch(n){if(t.error)t.error(n);else throw n}},e);return()=>window.clearTimeout(r)}),pe=e=>new l(t=>{const r=window.setInterval(()=>t.next(),e);return()=>window.clearInterval(r)}),ge=e=>new l(t=>{e.forEach(r=>t.next(r))}),me=(e,t)=>new l(r=>{const n=s=>r.next(s);return e.addEventListener(t,n),()=>e.removeEventListener(t,n)});function Ee(e){return t=>new l(r=>t.subscribe(new ye(r,e)))}class ye{destination;size;lastValues=[];constructor(t,r){this.destination=t,this.size=r}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 Se={leading:!1,trailing:!0};function Oe(e,t=Se){return r=>new l(n=>r.subscribe(new ve(n,e,t)))}class ve{destination;time;config;lastValue;timeout;constructor(t,r,n){this.destination=t,this.time=r,this.config=n}next(t){this.lastValue=t,C(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(r){if(this.destination.error)this.destination.error(r);else throw r}this.timeout=void 0},this.time)}error(t){this.destination.error?.(t)}}const Ae={leading:!0,trailing:!1};function xe(e,t=Ae){return r=>new l(n=>r.subscribe(new Re(n,e,t)))}class Re{destination;time;config;lastValue;timeout;constructor(t,r,n){this.destination=t,this.time=r,this.config=n}next(t){this.lastValue=t,P(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 Le(e){return t=>new l(r=>t.subscribe(new _e(r,e)))}class _e{destination;predicate;constructor(t,r){this.destination=t,this.predicate=r}next(t){let r;try{r=this.predicate(t)}catch(n){throw this.error(n),n}r&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function Ce(e=(t,r)=>t===r){return t=>new l(r=>t.subscribe(new Pe(r,e)))}const L={};class Pe{destination;predicate;lastValue=L;constructor(t,r){this.destination=t,this.predicate=r}next(t){let r;try{r=this.lastValue===L||!this.predicate(this.lastValue,t),this.lastValue=t}catch(n){throw this.error(n),n}r&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function Q(e){return t=>new l(r=>t.subscribe(new Te(r,e)))}let Te=class{destination;mapper;constructor(t,r){this.destination=t,this.mapper=r}next(t){let r;try{r=this.mapper(t)}catch(n){throw this.error(n),n}this.destination.next(r)}error(t){this.destination.error?.(t)}};function Ie(e){return Q(()=>e)}function Ne(){return e=>new l(t=>{let r=!1,n=!1;const s=e.subscribe(i=>{r||(r=!0,t.next(i)),n&&s.unsubscribe()},i=>{r=!0,t.error?.(i),n&&s.unsubscribe()});return n=!0,r&&s.unsubscribe(),s})}function Qe(){return e=>new l(t=>e.subscribe(new Me(t)))}class Me{destination;last;hasLast=!1;constructor(t){this.destination=t}next(t){const r=this.last;if(this.last=t,!this.hasLast){this.hasLast=!0;return}this.destination.next([r,t])}error(t){this.destination.error?.(t)}}function Ve(e){return t=>new l(r=>t.subscribe(new je(r,e)))}class je{destination;effect;constructor(t,r){this.destination=t,this.effect=r}next(t){try{this.effect(t)}catch(r){throw this.error(r),r}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={}));class _{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(t,r,n){t in this.listeners||(this.listeners[t]=[]),this.listeners[t].push({callback:r,options:n})}removeEventListener(t,r){if(!(t in this.listeners))return;const n=this.listeners[t];for(let s=0,i=n.length;s<i;s++)if(n[s].callback===r){n.splice(s,1);return}}dispatchEvent(t){if(!(t.type in this.listeners))return;const n=this.listeners[t.type].slice();for(let s=0,i=n.length;s<i;s++){const o=n[s];try{o.callback.call(this,t)}catch(u){Promise.resolve().then(()=>{throw u})}o.options&&o.options.once&&this.removeEventListener(t.type,o.callback)}return!t.defaultPrevented}}class M extends _{constructor(){super(),this.listeners||_.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(t){t.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,t)),super.dispatchEvent(t)}}class ke{constructor(){Object.defineProperty(this,"signal",{value:new M,writable:!0,configurable:!0})}abort(t){let r;try{r=new Event("abort")}catch{typeof document<"u"?document.createEvent?(r=document.createEvent("Event"),r.initEvent("abort",!1,!1)):(r=document.createEventObject(),r.type="abort"):r={type:"abort",bubbles:!1,cancelable:!1}}let n=t;if(n===void 0)if(typeof document>"u")n=new Error("This operation was aborted"),n.name="AbortError";else try{n=new DOMException("signal is aborted without reason")}catch{n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(r)}toString(){return"[object AbortController]"}}typeof Symbol<"u"&&Symbol.toStringTag&&(ke.prototype[Symbol.toStringTag]="AbortController",M.prototype[Symbol.toStringTag]="AbortSignal");function V(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function De(e){typeof e=="function"&&(e={fetch:e});const{fetch:t,Request:r=t.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:s=!1}=e;if(!V({fetch:t,Request:r,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:s}))return{fetch:t,Request:i};let i=r;(i&&!i.prototype.hasOwnProperty("signal")||s)&&(i=function(c,f){let b;f&&f.signal&&(b=f.signal,delete f.signal);const g=new r(c,f);return b&&Object.defineProperty(g,"signal",{writable:!1,enumerable:!1,configurable:!0,value:b}),g},i.prototype=r.prototype);const o=t;return{fetch:(h,c)=>{const f=i&&i.prototype.isPrototypeOf(h)?h.signal:c?c.signal:void 0;if(f){let b;try{b=new DOMException("Aborted","AbortError")}catch{b=new Error("Aborted"),b.name="AbortError"}if(f.aborted)return Promise.reject(b);const g=new Promise((k,D)=>{f.addEventListener("abort",()=>D(b),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([g,o(h,c)])}return o(h,c)},Request:i}}const R=V({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),j=R?De({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,qe=R?j.fetch:window.fetch;R?j.Request:window.Request;exports.VKNumericLanguage=void 0;(function(e){e.Armenian="58",e.Azerbaijani="57",e.Belarusian="114",e.English="3",e.Kazakh="97",e.Portuguese="73",e.Russian="0",e.Spanish="4",e.Ukrainian="1",e.Uzbek="65",e.Vietnamese="75"})(exports.VKNumericLanguage||(exports.VKNumericLanguage={}));const Fe="vk.com",Ue=async(e,t,r)=>{const n=new URL(`https://${Fe}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",t),e!==void 0&&n.searchParams.set("lang",e);const i=await(await qe(n.toString())).json();return Ge(i,r)},Ge=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([r,n])=>[r.substring(`${t}_`.length),Be(n)])),Be=e=>Array.isArray(e)?e[0]:e;exports.InterfaceLanguage=void 0;(function(e){e.RU="ru",e.EN="en"})(exports.InterfaceLanguage||(exports.InterfaceLanguage={}));exports.Logger=U;exports.Observable=l;exports.Subject=v;exports.Subscription=S;exports.VERSION=q;exports.ValueSubject=he;exports.abortable=$;exports.addScript=z;exports.areQualitiesExact=ue;exports.assertNever=p;exports.assertNonNullable=G;exports.assertNullable=B;exports.assertQualityIsExact=de;exports.buffer=Ee;exports.checkNever=F;exports.combine=fe;exports.debounce=Oe;exports.fillWithDefault=N;exports.filter=Le;exports.filterChanged=Ce;exports.fromEvent=me;exports.getCurrentBrowser=T;exports.getExponentialDelay=W;exports.getHighestQuality=oe;exports.interval=pe;exports.isHigher=ne;exports.isHigherOrEqual=ie;exports.isIOS=Y;exports.isInvariantQuality=x;exports.isLower=A;exports.isLowerOrEqual=se;exports.isNonNullable=C;exports.isNullable=P;exports.loadVKLangPack=Ue;exports.map=Q;exports.mapTo=Ie;exports.merge=be;exports.noop=m;exports.now=H;exports.observableFrom=ge;exports.once=Ne;exports.pairwise=Qe;exports.safeStorage=re;exports.tap=Ve;exports.throttle=xe;exports.timeout=we;exports.videoHeightToQuality=ae;exports.videoQualityToHeight=le;exports.videoSizeToQuality=ce;
package/esnext.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.27
3
- * Fri, 18 Aug 2023 12:34:43 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-27/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.28
3
+ * Tue, 29 Aug 2023 12:41:47 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-28/doc/
5
5
  */
6
- const Z="1.0.27";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`)},B=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:r=>s.next(r),error:r=>s.error?.(r)}:i={next:x,error:x};const o=typeof e=="function"?{next:r=>{try{e(r)}catch(l){i.next(l)}},error:r=>i.next(r)}:{next:r=>e.next(r),error:r=>e.error?e.error(r):i.next(r)};let n;try{n=this._subscribe(o)}catch(r){o.error?.(r)}return new S().add(()=>{switch(o.next=x,o.error=x,typeof n){case"function":n();return;case"object":n.unsubscribe();return;case"undefined":return;default:return w(n)}})}pipe(...e){return e.reduce((s,i)=>i(s),this)}_subscribe(e){}}class T 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 ee{log$=new T;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 te(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function se(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function N(t){return typeof t<"u"&&t!==null}function M(t){return t==null}const ie=(t,e,s)=>new Promise((i,o)=>{e.addEventListener("abort",()=>{l(),f.remove()});const n=()=>{l(),o()},r=()=>{l(),i()},l=()=>{E&&clearTimeout(E),f.removeEventListener("load",r),f.removeEventListener("error",n)};let E;s&&(E=window.setTimeout(n,s));const f=document.createElement("script");f.addEventListener("load",r),f.addEventListener("error",n),f.src=t,document.head.appendChild(f)}),ne=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),re=(t,e)=>async(...s)=>{const i=e(...s);let o=t.aborted,n;for(;!o&&!t.aborted;){const r=await i.next(n);o=r.done??!1,n=r.value}return n};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 oe=()=>{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,n=/webkit|safari|khtml/i.test(t)?d.Safari:void 0,r=/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,y=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?b.RestMobile:void 0;return{browser:e||o||r||l||s||i||n||d.Rest,device:E||f||R||P||y||b.Desktop}},ae=(t,{start:e=0,factor:s=2,max:i=1/0,min:o=e,random:n=0}={})=>{let r=e;return r*=s**t,r*=1+(Math.random()*n*2-n),r=Math.round(r),r=Math.min(r,i),r=Math.max(r,o),r};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)}},k=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}},U=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)}},j=()=>{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 ce=Object.freeze({__proto__:null,clear:j,get:Q,has:k,isPersistent:V,remove:U,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}},ue=(t,e)=>h[t].height>h[e].height,he=(t,e)=>h[t].height>=h[e].height,I=(t,e)=>h[t].height<h[e].height,de=(t,e)=>h[t].height<=h[e].height,le=t=>t.sort((e,s)=>e===s?0:e===u.INVARIANT?1:s===u.INVARIANT?-1:I(e,s)?1:-1)[0],v=Object.keys(h).sort((t,e)=>I(t,e)?-1:1),fe=(t,e=.02)=>[...v].find(i=>h[i].height*(1+e)>=t),be=({width:t,height:e})=>{const s=Math.min(t,e),i=Math.max(t,e);return v.find(o=>{const n=h[o];return n.width>=i&&n.height>=s})},me=t=>h[t].height,L=t=>t===u.INVARIANT,we=t=>t.every(e=>!L(e));function ge(t){if(L(t))throw new Error("Expected exact quality")}const F=(t,e)=>{const s={};for(const i of Object.keys(e)){const o=e[i],n=t[i];Array.isArray(o)&&Array.isArray(n)?s[i]=n:typeof o=="object"&&typeof n=="object"?s[i]=F(n,o):s[i]=i in t?n:o}return s};class pe extends T{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 Ee(t){return new c(e=>{const s={};let i=Object.keys(t).length;const o=n=>r=>{n in s||i--,s[n]=r,i===0&&e.next(s)};return Object.entries(t).reduce((n,[r,l])=>n.add(l.subscribe(o(r))),new S)})}function xe(...t){return new c(e=>t.reduce((s,i)=>s.add(i.subscribe(e)),new S))}var Se=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)}),Oe=t=>new c(e=>{const s=window.setInterval(()=>e.next(),t);return()=>window.clearInterval(s)}),Ae=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 Te(t){return e=>new c(s=>e.subscribe(new D(s,t)))}class D{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 z={leading:!1,trailing:!0};function Ie(t,e=z){return s=>new c(i=>s.subscribe(new q(i,t,e)))}class q{destination;time;config;lastValue;timeout;constructor(e,s,i){this.destination=e,this.time=s,this.config=i}next(e){this.lastValue=e,N(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 $={leading:!0,trailing:!1};function ve(t,e=$){return s=>new c(i=>s.subscribe(new H(i,t,e)))}class H{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)&&(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 Y(s,t)))}class Y{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 Re(t=(e,s)=>e===s){return e=>new c(s=>e.subscribe(new K(s,t)))}const A={};class K{destination;predicate;lastValue=A;constructor(e,s){this.destination=e,this.predicate=s}next(e){let s;try{s=this.lastValue===A||!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 W(t){return e=>new c(s=>e.subscribe(new C(s,t)))}let C=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 ye(t){return W(()=>t)}function Ne(){return t=>new c(e=>{let s=!1,i=!1;const o=t.subscribe(n=>{s||(s=!0,e.next(n)),i&&o.unsubscribe()},n=>{s=!0,e.error?.(n),i&&o.unsubscribe()});return i=!0,s&&o.unsubscribe(),o})}function Me(){return t=>new c(e=>t.subscribe(new X(e)))}class X{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 Ve(t){return e=>new c(s=>e.subscribe(new J(s,t)))}class J{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 _;(function(t){t.NETWORK="network",t.VIDEO_PIPELINE="video_pipeline",t.EXTERNAL_API="external_api",t.PARSER="parser",t.DOM="dom",t.WTF="wtf"})(_||(_={}));export{d as CurrentClientBrowser,b as CurrentClientDevice,_ as ErrorCategory,ee as Logger,c as Observable,T as Subject,S as Subscription,Z as VERSION,pe as ValueSubject,u as VideoQuality,re as abortable,ie as addScript,we as areQualitiesExact,w as assertNever,te as assertNonNullable,se as assertNullable,ge as assertQualityIsExact,Te as buffer,B as checkNever,Ee as combine,Ie as debounce,F as fillWithDefault,Le as filter,Re as filterChanged,_e as fromEvent,oe as getCurrentBrowser,ae as getExponentialDelay,le as getHighestQuality,Oe as interval,ue as isHigher,he as isHigherOrEqual,L as isInvariantQuality,I as isLower,de as isLowerOrEqual,N as isNonNullable,M as isNullable,W as map,ye as mapTo,xe as merge,x as noop,ne as now,Ae as observableFrom,Ne as once,Me as pairwise,ce as safeStorage,Ve as tap,ve as throttle,Se as timeout,fe as videoHeightToQuality,me as videoQualityToHeight,be as videoSizeToQuality};
6
+ const be="1.0.28";class x{subscriptions=[];unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach(r=>typeof r=="function"?r():r.unsubscribe())}add(t){return this.subscriptions.push(t),this}}const O=e=>{throw new Error(`${e} is value of unexpected type`)},pe=e=>{},y=()=>{};class l{constructor(t){t&&(this._subscribe=t)}subscribe(t,r){let n;r?typeof r=="function"?n={next:r,error:y}:n={next:o=>r.next(o),error:o=>r.error?.(o)}:n={next:y,error:y};const i=typeof t=="function"?{next:o=>{try{t(o)}catch(h){n.next(h)}},error:o=>n.next(o)}:{next:o=>t.next(o),error:o=>t.error?t.error(o):n.next(o)};let s;try{s=this._subscribe(i)}catch(o){i.error?.(o)}return new x().add(()=>{switch(i.next=y,i.error=y,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return O(s)}})}pipe(...t){return t.reduce((r,n)=>n(r),this)}_subscribe(t){}}class N extends l{keyCounter=0;subscribers=new Map;constructor(){super()}next(t){this.subscribers.forEach(r=>r.next(t))}error(t){this.subscribers.forEach(r=>r.error?.(t))}_subscribe(t){const r=this.keyCounter++;return this.subscribers.set(r,t),new x().add(()=>this.subscribers.delete(r))}}class we{log$=new N;logs=[];log=t=>{const r={...t,timestamp:Date.now()};this.logs.push(r),this.log$.next(r)};createCustomLog(t){return(...r)=>{let n;try{n=t(...r)}catch{n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(t){return this.createCustomLog(r=>({component:t,...r}))}getAllLogs=()=>this.logs}function me(e,t='Assertion "value is not nullable" failed'){if(e==null)throw new Error(t)}function ge(e,t='Assertion "value is nullable" failed'){if(e!=null)throw new Error(t)}function G(e){return typeof e<"u"&&e!==null}function V(e){return e==null}const Ee=(e,t,r)=>new Promise((n,i)=>{t.addEventListener("abort",()=>{h(),c.remove()});const s=()=>{h(),i()},o=()=>{h(),n()},h=()=>{f&&clearTimeout(f),c.removeEventListener("load",o),c.removeEventListener("error",s)};let f;r&&(f=window.setTimeout(s,r));const c=document.createElement("script");c.addEventListener("load",o),c.addEventListener("error",s),c.src=e,document.head.appendChild(c)}),Oe=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),Se=(e,t)=>async(...r)=>{const n=t(...r);let i=e.aborted,s;for(;!i&&!e.aborted;){const o=await n.next(s);i=o.done??!1,s=o.value}return s};var m;(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"})(m||(m={}));var w;(function(e){e.Unknown="Unknown",e.Android="Android",e.iPhone="iPhone",e.iPad="iPad",e.iPod="iPod",e.RestMobile="RestMobile",e.Desktop="Desktop"})(w||(w={}));const D=()=>{const{userAgent:e}=window.navigator,t=/yabrowser/i.test(e)?m.Yandex:void 0,r=/chrome|crios/i.test(e)?m.Chrome:void 0,n=/chromium/i.test(e)?m.Chromium:void 0,i=/firefox|fxios/i.test(e)?m.Firefox:void 0,s=/webkit|safari|khtml/i.test(e)?m.Safari:void 0,o=/opr\//i.test(e)?m.Opera:void 0,h=/edg/i.test(e)?m.Edge:void 0,f=/android/i.test(e)?w.Android:void 0,c=/iphone/i.test(e)?w.iPhone:void 0,b=/ipad/i.test(e)?w.iPad:void 0,p=/ipod/i.test(e)?w.iPod:void 0,E=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?w.RestMobile:void 0;return{browser:t||i||o||h||r||n||s||m.Rest,device:f||c||b||p||E||w.Desktop}},Ae=()=>[w.iPhone,w.iPad,w.iPod].includes(D().device),ye=(e,{start:t=0,factor:r=2,max:n=1/0,min:i=t,random:s=0}={})=>{let o=t;return o*=r**e,o*=1+(Math.random()*s*2-s),o=Math.round(o),o=Math.min(o,n),o=Math.max(o,i),o};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={}));let S,g;const R=`vk-videoplayer-dummy-key-${Math.random()}`,A=()=>{if(g!==void 0)return g;try{localStorage.setItem(R,"test"),localStorage.removeItem(R),g=a.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(R),g=a.SESSION_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)g=a.RUNTIME;else throw t}else throw e}return g===a.RUNTIME&&(S=new Map),g},z=()=>A()===a.LOCAL_STORAGE,$=e=>{const t=A();switch(t){case a.LOCAL_STORAGE:return localStorage.getItem(e)??void 0;case a.SESSION_STORAGE:return sessionStorage.getItem(e)??void 0;case a.RUNTIME:return S?.get(e);default:O(t)}},Y=(e,t)=>{const r=A();switch(r){case a.LOCAL_STORAGE:try{localStorage.setItem(e,t)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case a.SESSION_STORAGE:try{sessionStorage.setItem(e,t)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case a.RUNTIME:return void S?.set(e,t);default:O(r)}},H=e=>{const t=A();switch(t){case a.LOCAL_STORAGE:return e in localStorage;case a.SESSION_STORAGE:return e in sessionStorage;case a.RUNTIME:return S?.has(e)??!1;default:return O(t),!1}},W=e=>{const t=A();switch(t){case a.LOCAL_STORAGE:return localStorage.removeItem(e);case a.SESSION_STORAGE:return sessionStorage.removeItem(e);case a.RUNTIME:return void S?.delete(e);default:O(t)}},B=()=>{const e=A();switch(e){case a.LOCAL_STORAGE:return localStorage.clear();case a.SESSION_STORAGE:return sessionStorage.clear();case a.RUNTIME:return S?.clear();default:O(e)}};var xe=Object.freeze({__proto__:null,clear:B,get:$,has:H,isPersistent:z,remove:W,set:Y}),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}},Re=(e,t)=>d[e].height>d[t].height,_e=(e,t)=>d[e].height>=d[t].height,M=(e,t)=>d[e].height<d[t].height,ve=(e,t)=>d[e].height<=d[t].height,Le=e=>e.sort((t,r)=>t===r?0:t===u.INVARIANT?1:r===u.INVARIANT?-1:M(t,r)?1:-1)[0],j=Object.keys(d).sort((e,t)=>M(e,t)?-1:1),Pe=(e,t=.02)=>[...j].find(n=>d[n].height*(1+t)>=e),Te=({width:e,height:t})=>{const r=Math.min(e,t),n=Math.max(e,t);return j.find(i=>{const s=d[i];return s.width>=n&&s.height>=r})},Ie=e=>d[e].height,k=e=>e===u.INVARIANT,Ne=e=>e.every(t=>!k(t));function Me(e){if(k(e))throw new Error("Expected exact quality")}const X=(e,t)=>{const r={};for(const n of Object.keys(t)){const i=t[n],s=e[n];Array.isArray(i)&&Array.isArray(s)?r[n]=s:typeof i=="object"&&typeof s=="object"?r[n]=X(s,i):r[n]=n in e?s:i}return r};class je 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 r=super._subscribe(t);return t.next(this.value),r}}function ke(e){return new l(t=>{const r={};let n=Object.keys(e).length;const i=s=>o=>{s in r||n--,r[s]=o,n===0&&t.next(r)};return Object.entries(e).reduce((s,[o,h])=>s.add(h.subscribe(i(o))),new x)})}function qe(...e){return new l(t=>e.reduce((r,n)=>r.add(n.subscribe(t)),new x))}var Ce=e=>new l(t=>{const r=window.setTimeout(()=>{try{t.next()}catch(n){if(t.error)t.error(n);else throw n}},e);return()=>window.clearTimeout(r)}),Fe=e=>new l(t=>{const r=window.setInterval(()=>t.next(),e);return()=>window.clearInterval(r)}),Qe=e=>new l(t=>{e.forEach(r=>t.next(r))}),Ue=(e,t)=>new l(r=>{const n=i=>r.next(i);return e.addEventListener(t,n),()=>e.removeEventListener(t,n)});function Ge(e){return t=>new l(r=>t.subscribe(new J(r,e)))}class J{destination;size;lastValues=[];constructor(t,r){this.destination=t,this.size=r}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 Z={leading:!1,trailing:!0};function Ve(e,t=Z){return r=>new l(n=>r.subscribe(new K(n,e,t)))}class K{destination;time;config;lastValue;timeout;constructor(t,r,n){this.destination=t,this.time=r,this.config=n}next(t){this.lastValue=t,G(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(r){if(this.destination.error)this.destination.error(r);else throw r}this.timeout=void 0},this.time)}error(t){this.destination.error?.(t)}}const ee={leading:!0,trailing:!1};function De(e,t=ee){return r=>new l(n=>r.subscribe(new te(n,e,t)))}class te{destination;time;config;lastValue;timeout;constructor(t,r,n){this.destination=t,this.time=r,this.config=n}next(t){this.lastValue=t,V(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 ze(e){return t=>new l(r=>t.subscribe(new re(r,e)))}class re{destination;predicate;constructor(t,r){this.destination=t,this.predicate=r}next(t){let r;try{r=this.predicate(t)}catch(n){throw this.error(n),n}r&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function $e(e=(t,r)=>t===r){return t=>new l(r=>t.subscribe(new ne(r,e)))}const v={};class ne{destination;predicate;lastValue=v;constructor(t,r){this.destination=t,this.predicate=r}next(t){let r;try{r=this.lastValue===v||!this.predicate(this.lastValue,t),this.lastValue=t}catch(n){throw this.error(n),n}r&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function se(e){return t=>new l(r=>t.subscribe(new ie(r,e)))}let ie=class{destination;mapper;constructor(t,r){this.destination=t,this.mapper=r}next(t){let r;try{r=this.mapper(t)}catch(n){throw this.error(n),n}this.destination.next(r)}error(t){this.destination.error?.(t)}};function He(e){return se(()=>e)}function We(){return e=>new l(t=>{let r=!1,n=!1;const i=e.subscribe(s=>{r||(r=!0,t.next(s)),n&&i.unsubscribe()},s=>{r=!0,t.error?.(s),n&&i.unsubscribe()});return n=!0,r&&i.unsubscribe(),i})}function Be(){return e=>new l(t=>e.subscribe(new oe(t)))}class oe{destination;last;hasLast=!1;constructor(t){this.destination=t}next(t){const r=this.last;if(this.last=t,!this.hasLast){this.hasLast=!0;return}this.destination.next([r,t])}error(t){this.destination.error?.(t)}}function Xe(e){return t=>new l(r=>t.subscribe(new ae(r,e)))}class ae{destination;effect;constructor(t,r){this.destination=t,this.effect=r}next(t){try{this.effect(t)}catch(r){throw this.error(r),r}this.destination.next(t)}error(t){this.destination.error?.(t)}}var L;(function(e){e.NETWORK="network",e.VIDEO_PIPELINE="video_pipeline",e.EXTERNAL_API="external_api",e.PARSER="parser",e.DOM="dom",e.WTF="wtf"})(L||(L={}));class P{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(t,r,n){t in this.listeners||(this.listeners[t]=[]),this.listeners[t].push({callback:r,options:n})}removeEventListener(t,r){if(!(t in this.listeners))return;const n=this.listeners[t];for(let i=0,s=n.length;i<s;i++)if(n[i].callback===r){n.splice(i,1);return}}dispatchEvent(t){if(!(t.type in this.listeners))return;const n=this.listeners[t.type].slice();for(let i=0,s=n.length;i<s;i++){const o=n[i];try{o.callback.call(this,t)}catch(h){Promise.resolve().then(()=>{throw h})}o.options&&o.options.once&&this.removeEventListener(t.type,o.callback)}return!t.defaultPrevented}}class q extends P{constructor(){super(),this.listeners||P.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(t){t.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,t)),super.dispatchEvent(t)}}class ce{constructor(){Object.defineProperty(this,"signal",{value:new q,writable:!0,configurable:!0})}abort(t){let r;try{r=new Event("abort")}catch{typeof document<"u"?document.createEvent?(r=document.createEvent("Event"),r.initEvent("abort",!1,!1)):(r=document.createEventObject(),r.type="abort"):r={type:"abort",bubbles:!1,cancelable:!1}}let n=t;if(n===void 0)if(typeof document>"u")n=new Error("This operation was aborted"),n.name="AbortError";else try{n=new DOMException("signal is aborted without reason")}catch{n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(r)}toString(){return"[object AbortController]"}}typeof Symbol<"u"&&Symbol.toStringTag&&(ce.prototype[Symbol.toStringTag]="AbortController",q.prototype[Symbol.toStringTag]="AbortSignal");function C(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function le(e){typeof e=="function"&&(e={fetch:e});const{fetch:t,Request:r=t.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!C({fetch:t,Request:r,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i}))return{fetch:t,Request:s};let s=r;(s&&!s.prototype.hasOwnProperty("signal")||i)&&(s=function(c,b){let p;b&&b.signal&&(p=b.signal,delete b.signal);const E=new r(c,b);return p&&Object.defineProperty(E,"signal",{writable:!1,enumerable:!1,configurable:!0,value:p}),E},s.prototype=r.prototype);const o=t;return{fetch:(f,c)=>{const b=s&&s.prototype.isPrototypeOf(f)?f.signal:c?c.signal:void 0;if(b){let p;try{p=new DOMException("Aborted","AbortError")}catch{p=new Error("Aborted"),p.name="AbortError"}if(b.aborted)return Promise.reject(p);const E=new Promise((Q,U)=>{b.addEventListener("abort",()=>U(p),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([E,o(f,c)])}return o(f,c)},Request:s}}const _=C({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),F=_?le({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,ue=_?F.fetch:window.fetch;_?F.Request:window.Request;var T;(function(e){e.Armenian="58",e.Azerbaijani="57",e.Belarusian="114",e.English="3",e.Kazakh="97",e.Portuguese="73",e.Russian="0",e.Spanish="4",e.Ukrainian="1",e.Uzbek="65",e.Vietnamese="75"})(T||(T={}));const he="vk.com",Je=async(e,t,r)=>{const n=new URL(`https://${he}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",t),e!==void 0&&n.searchParams.set("lang",e);const s=await(await ue(n.toString())).json();return de(s,r)},de=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([r,n])=>[r.substring(`${t}_`.length),fe(n)])),fe=e=>Array.isArray(e)?e[0]:e;var I;(function(e){e.RU="ru",e.EN="en"})(I||(I={}));export{m as CurrentClientBrowser,w as CurrentClientDevice,L as ErrorCategory,I as InterfaceLanguage,we as Logger,l as Observable,N as Subject,x as Subscription,be as VERSION,T as VKNumericLanguage,je as ValueSubject,u as VideoQuality,Se as abortable,Ee as addScript,Ne as areQualitiesExact,O as assertNever,me as assertNonNullable,ge as assertNullable,Me as assertQualityIsExact,Ge as buffer,pe as checkNever,ke as combine,Ve as debounce,X as fillWithDefault,ze as filter,$e as filterChanged,Ue as fromEvent,D as getCurrentBrowser,ye as getExponentialDelay,Le as getHighestQuality,Fe as interval,Re as isHigher,_e as isHigherOrEqual,Ae as isIOS,k as isInvariantQuality,M as isLower,ve as isLowerOrEqual,G as isNonNullable,V as isNullable,Je as loadVKLangPack,se as map,He as mapTo,qe as merge,y as noop,Oe as now,Qe as observableFrom,We as once,Be as pairwise,xe as safeStorage,Xe as tap,De as throttle,Ce as timeout,Pe as videoHeightToQuality,Ie as videoQualityToHeight,Te as videoSizeToQuality};
package/evergreen.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.27
3
- * Fri, 18 Aug 2023 12:34:43 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-27/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.28
3
+ * Tue, 29 Aug 2023 12:41:47 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-28/doc/
5
5
  */
6
- const Z="1.0.27";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`)},B=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:r=>s.next(r),error:r=>s.error?.(r)}:i={next:x,error:x};const o=typeof e=="function"?{next:r=>{try{e(r)}catch(l){i.next(l)}},error:r=>i.next(r)}:{next:r=>e.next(r),error:r=>e.error?e.error(r):i.next(r)};let n;try{n=this._subscribe(o)}catch(r){o.error?.(r)}return new S().add(()=>{switch(o.next=x,o.error=x,typeof n){case"function":n();return;case"object":n.unsubscribe();return;case"undefined":return;default:return w(n)}})}pipe(...e){return e.reduce((s,i)=>i(s),this)}_subscribe(e){}}class T 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 ee{log$=new T;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 te(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function se(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function N(t){return typeof t<"u"&&t!==null}function M(t){return t==null}const ie=(t,e,s)=>new Promise((i,o)=>{e.addEventListener("abort",()=>{l(),f.remove()});const n=()=>{l(),o()},r=()=>{l(),i()},l=()=>{E&&clearTimeout(E),f.removeEventListener("load",r),f.removeEventListener("error",n)};let E;s&&(E=window.setTimeout(n,s));const f=document.createElement("script");f.addEventListener("load",r),f.addEventListener("error",n),f.src=t,document.head.appendChild(f)}),ne=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),re=(t,e)=>async(...s)=>{const i=e(...s);let o=t.aborted,n;for(;!o&&!t.aborted;){const r=await i.next(n);o=r.done??!1,n=r.value}return n};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 oe=()=>{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,n=/webkit|safari|khtml/i.test(t)?d.Safari:void 0,r=/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,y=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?b.RestMobile:void 0;return{browser:e||o||r||l||s||i||n||d.Rest,device:E||f||R||P||y||b.Desktop}},ae=(t,{start:e=0,factor:s=2,max:i=1/0,min:o=e,random:n=0}={})=>{let r=e;return r*=s**t,r*=1+(Math.random()*n*2-n),r=Math.round(r),r=Math.min(r,i),r=Math.max(r,o),r};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)}},k=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}},U=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)}},j=()=>{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 ce=Object.freeze({__proto__:null,clear:j,get:Q,has:k,isPersistent:V,remove:U,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}},ue=(t,e)=>h[t].height>h[e].height,he=(t,e)=>h[t].height>=h[e].height,I=(t,e)=>h[t].height<h[e].height,de=(t,e)=>h[t].height<=h[e].height,le=t=>t.sort((e,s)=>e===s?0:e===u.INVARIANT?1:s===u.INVARIANT?-1:I(e,s)?1:-1)[0],v=Object.keys(h).sort((t,e)=>I(t,e)?-1:1),fe=(t,e=.02)=>[...v].find(i=>h[i].height*(1+e)>=t),be=({width:t,height:e})=>{const s=Math.min(t,e),i=Math.max(t,e);return v.find(o=>{const n=h[o];return n.width>=i&&n.height>=s})},me=t=>h[t].height,L=t=>t===u.INVARIANT,we=t=>t.every(e=>!L(e));function ge(t){if(L(t))throw new Error("Expected exact quality")}const F=(t,e)=>{const s={};for(const i of Object.keys(e)){const o=e[i],n=t[i];Array.isArray(o)&&Array.isArray(n)?s[i]=n:typeof o=="object"&&typeof n=="object"?s[i]=F(n,o):s[i]=i in t?n:o}return s};class pe extends T{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 Ee(t){return new c(e=>{const s={};let i=Object.keys(t).length;const o=n=>r=>{n in s||i--,s[n]=r,i===0&&e.next(s)};return Object.entries(t).reduce((n,[r,l])=>n.add(l.subscribe(o(r))),new S)})}function xe(...t){return new c(e=>t.reduce((s,i)=>s.add(i.subscribe(e)),new S))}var Se=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)}),Oe=t=>new c(e=>{const s=window.setInterval(()=>e.next(),t);return()=>window.clearInterval(s)}),Ae=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 Te(t){return e=>new c(s=>e.subscribe(new D(s,t)))}class D{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 z={leading:!1,trailing:!0};function Ie(t,e=z){return s=>new c(i=>s.subscribe(new q(i,t,e)))}class q{destination;time;config;lastValue;timeout;constructor(e,s,i){this.destination=e,this.time=s,this.config=i}next(e){this.lastValue=e,N(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 $={leading:!0,trailing:!1};function ve(t,e=$){return s=>new c(i=>s.subscribe(new H(i,t,e)))}class H{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)&&(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 Y(s,t)))}class Y{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 Re(t=(e,s)=>e===s){return e=>new c(s=>e.subscribe(new K(s,t)))}const A={};class K{destination;predicate;lastValue=A;constructor(e,s){this.destination=e,this.predicate=s}next(e){let s;try{s=this.lastValue===A||!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 W(t){return e=>new c(s=>e.subscribe(new C(s,t)))}let C=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 ye(t){return W(()=>t)}function Ne(){return t=>new c(e=>{let s=!1,i=!1;const o=t.subscribe(n=>{s||(s=!0,e.next(n)),i&&o.unsubscribe()},n=>{s=!0,e.error?.(n),i&&o.unsubscribe()});return i=!0,s&&o.unsubscribe(),o})}function Me(){return t=>new c(e=>t.subscribe(new X(e)))}class X{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 Ve(t){return e=>new c(s=>e.subscribe(new J(s,t)))}class J{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 _;(function(t){t.NETWORK="network",t.VIDEO_PIPELINE="video_pipeline",t.EXTERNAL_API="external_api",t.PARSER="parser",t.DOM="dom",t.WTF="wtf"})(_||(_={}));export{d as CurrentClientBrowser,b as CurrentClientDevice,_ as ErrorCategory,ee as Logger,c as Observable,T as Subject,S as Subscription,Z as VERSION,pe as ValueSubject,u as VideoQuality,re as abortable,ie as addScript,we as areQualitiesExact,w as assertNever,te as assertNonNullable,se as assertNullable,ge as assertQualityIsExact,Te as buffer,B as checkNever,Ee as combine,Ie as debounce,F as fillWithDefault,Le as filter,Re as filterChanged,_e as fromEvent,oe as getCurrentBrowser,ae as getExponentialDelay,le as getHighestQuality,Oe as interval,ue as isHigher,he as isHigherOrEqual,L as isInvariantQuality,I as isLower,de as isLowerOrEqual,N as isNonNullable,M as isNullable,W as map,ye as mapTo,xe as merge,x as noop,ne as now,Ae as observableFrom,Ne as once,Me as pairwise,ce as safeStorage,Ve as tap,ve as throttle,Se as timeout,fe as videoHeightToQuality,me as videoQualityToHeight,be as videoSizeToQuality};
6
+ const ie="1.0.28";class x{subscriptions=[];unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach(s=>typeof s=="function"?s():s.unsubscribe())}add(t){return this.subscriptions.push(t),this}}const m=e=>{throw new Error(`${e} is value of unexpected type`)},re=e=>{},S=()=>{};class c{constructor(t){t&&(this._subscribe=t)}subscribe(t,s){let n;s?typeof s=="function"?n={next:s,error:S}:n={next:r=>s.next(r),error:r=>s.error?.(r)}:n={next:S,error:S};const o=typeof t=="function"?{next:r=>{try{t(r)}catch(f){n.next(f)}},error:r=>n.next(r)}:{next:r=>t.next(r),error:r=>t.error?t.error(r):n.next(r)};let i;try{i=this._subscribe(o)}catch(r){o.error?.(r)}return new x().add(()=>{switch(o.next=S,o.error=S,typeof i){case"function":i();return;case"object":i.unsubscribe();return;case"undefined":return;default:return m(i)}})}pipe(...t){return t.reduce((s,n)=>n(s),this)}_subscribe(t){}}class R extends c{keyCounter=0;subscribers=new Map;constructor(){super()}next(t){this.subscribers.forEach(s=>s.next(t))}error(t){this.subscribers.forEach(s=>s.error?.(t))}_subscribe(t){const s=this.keyCounter++;return this.subscribers.set(s,t),new x().add(()=>this.subscribers.delete(s))}}class oe{log$=new R;logs=[];log=t=>{const s={...t,timestamp:Date.now()};this.logs.push(s),this.log$.next(s)};createCustomLog(t){return(...s)=>{let n;try{n=t(...s)}catch{n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(t){return this.createCustomLog(s=>({component:t,...s}))}getAllLogs=()=>this.logs}function ae(e,t='Assertion "value is not nullable" failed'){if(e==null)throw new Error(t)}function ce(e,t='Assertion "value is nullable" failed'){if(e!=null)throw new Error(t)}function k(e){return typeof e<"u"&&e!==null}function Q(e){return e==null}const ue=(e,t,s)=>new Promise((n,o)=>{t.addEventListener("abort",()=>{f(),b.remove()});const i=()=>{f(),o()},r=()=>{f(),n()},f=()=>{E&&clearTimeout(E),b.removeEventListener("load",r),b.removeEventListener("error",i)};let E;s&&(E=window.setTimeout(i,s));const b=document.createElement("script");b.addEventListener("load",r),b.addEventListener("error",i),b.src=e,document.head.appendChild(b)}),he=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),de=(e,t)=>async(...s)=>{const n=t(...s);let o=e.aborted,i;for(;!o&&!e.aborted;){const r=await n.next(i);o=r.done??!1,i=r.value}return i};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 d;(function(e){e.Unknown="Unknown",e.Android="Android",e.iPhone="iPhone",e.iPad="iPad",e.iPod="iPod",e.RestMobile="RestMobile",e.Desktop="Desktop"})(d||(d={}));const U=()=>{const{userAgent:e}=window.navigator,t=/yabrowser/i.test(e)?l.Yandex:void 0,s=/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,i=/webkit|safari|khtml/i.test(e)?l.Safari:void 0,r=/opr\//i.test(e)?l.Opera:void 0,f=/edg/i.test(e)?l.Edge:void 0,E=/android/i.test(e)?d.Android:void 0,b=/iphone/i.test(e)?d.iPhone:void 0,L=/ipad/i.test(e)?d.iPad:void 0,M=/ipod/i.test(e)?d.iPod:void 0,N=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?d.RestMobile:void 0;return{browser:t||o||r||f||s||n||i||l.Rest,device:E||b||L||M||N||d.Desktop}},le=()=>[d.iPhone,d.iPad,d.iPod].includes(U().device),fe=(e,{start:t=0,factor:s=2,max:n=1/0,min:o=t,random:i=0}={})=>{let r=t;return r*=s**e,r*=1+(Math.random()*i*2-i),r=Math.round(r),r=Math.min(r,n),r=Math.max(r,o),r};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={}));let w,p;const O=`vk-videoplayer-dummy-key-${Math.random()}`,g=()=>{if(p!==void 0)return p;try{localStorage.setItem(O,"test"),localStorage.removeItem(O),p=a.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(O),p=a.SESSION_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)p=a.RUNTIME;else throw t}else throw e}return p===a.RUNTIME&&(w=new Map),p},j=()=>g()===a.LOCAL_STORAGE,G=e=>{const t=g();switch(t){case a.LOCAL_STORAGE:return localStorage.getItem(e)??void 0;case a.SESSION_STORAGE:return sessionStorage.getItem(e)??void 0;case a.RUNTIME:return w?.get(e);default:m(t)}},V=(e,t)=>{const s=g();switch(s){case a.LOCAL_STORAGE:try{localStorage.setItem(e,t)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case a.SESSION_STORAGE:try{sessionStorage.setItem(e,t)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case a.RUNTIME:return void w?.set(e,t);default:m(s)}},z=e=>{const t=g();switch(t){case a.LOCAL_STORAGE:return e in localStorage;case a.SESSION_STORAGE:return e in sessionStorage;case a.RUNTIME:return w?.has(e)??!1;default:return m(t),!1}},D=e=>{const t=g();switch(t){case a.LOCAL_STORAGE:return localStorage.removeItem(e);case a.SESSION_STORAGE:return sessionStorage.removeItem(e);case a.RUNTIME:return void w?.delete(e);default:m(t)}},F=()=>{const e=g();switch(e){case a.LOCAL_STORAGE:return localStorage.clear();case a.SESSION_STORAGE:return sessionStorage.clear();case a.RUNTIME:return w?.clear();default:m(e)}};var be=Object.freeze({__proto__:null,clear:F,get:G,has:z,isPersistent:j,remove:D,set:V}),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 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}},pe=(e,t)=>h[e].height>h[t].height,me=(e,t)=>h[e].height>=h[t].height,T=(e,t)=>h[e].height<h[t].height,we=(e,t)=>h[e].height<=h[t].height,ge=e=>e.sort((t,s)=>t===s?0:t===u.INVARIANT?1:s===u.INVARIANT?-1:T(t,s)?1:-1)[0],P=Object.keys(h).sort((e,t)=>T(e,t)?-1:1),Ee=(e,t=.02)=>[...P].find(n=>h[n].height*(1+t)>=e),Se=({width:e,height:t})=>{const s=Math.min(e,t),n=Math.max(e,t);return P.find(o=>{const i=h[o];return i.width>=n&&i.height>=s})},xe=e=>h[e].height,y=e=>e===u.INVARIANT,Oe=e=>e.every(t=>!y(t));function Ae(e){if(y(e))throw new Error("Expected exact quality")}const $=(e,t)=>{const s={};for(const n of Object.keys(t)){const o=t[n],i=e[n];Array.isArray(o)&&Array.isArray(i)?s[n]=i:typeof o=="object"&&typeof i=="object"?s[n]=$(i,o):s[n]=n in e?i:o}return s};class _e extends R{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 s=super._subscribe(t);return t.next(this.value),s}}function Ie(e){return new c(t=>{const s={};let n=Object.keys(e).length;const o=i=>r=>{i in s||n--,s[i]=r,n===0&&t.next(s)};return Object.entries(e).reduce((i,[r,f])=>i.add(f.subscribe(o(r))),new x)})}function ve(...e){return new c(t=>e.reduce((s,n)=>s.add(n.subscribe(t)),new x))}var Re=e=>new c(t=>{const s=window.setTimeout(()=>{try{t.next()}catch(n){if(t.error)t.error(n);else throw n}},e);return()=>window.clearTimeout(s)}),Te=e=>new c(t=>{const s=window.setInterval(()=>t.next(),e);return()=>window.clearInterval(s)}),Pe=e=>new c(t=>{e.forEach(s=>t.next(s))}),ye=(e,t)=>new c(s=>{const n=o=>s.next(o);return e.addEventListener(t,n),()=>e.removeEventListener(t,n)});function Le(e){return t=>new c(s=>t.subscribe(new q(s,e)))}class q{destination;size;lastValues=[];constructor(t,s){this.destination=t,this.size=s}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 H={leading:!1,trailing:!0};function Me(e,t=H){return s=>new c(n=>s.subscribe(new Y(n,e,t)))}class Y{destination;time;config;lastValue;timeout;constructor(t,s,n){this.destination=t,this.time=s,this.config=n}next(t){this.lastValue=t,k(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(s){if(this.destination.error)this.destination.error(s);else throw s}this.timeout=void 0},this.time)}error(t){this.destination.error?.(t)}}const W={leading:!0,trailing:!1};function Ne(e,t=W){return s=>new c(n=>s.subscribe(new C(n,e,t)))}class C{destination;time;config;lastValue;timeout;constructor(t,s,n){this.destination=t,this.time=s,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){this.destination.error?.(t)}}function ke(e){return t=>new c(s=>t.subscribe(new X(s,e)))}class X{destination;predicate;constructor(t,s){this.destination=t,this.predicate=s}next(t){let s;try{s=this.predicate(t)}catch(n){throw this.error(n),n}s&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function Qe(e=(t,s)=>t===s){return t=>new c(s=>t.subscribe(new J(s,e)))}const A={};class J{destination;predicate;lastValue=A;constructor(t,s){this.destination=t,this.predicate=s}next(t){let s;try{s=this.lastValue===A||!this.predicate(this.lastValue,t),this.lastValue=t}catch(n){throw this.error(n),n}s&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function Z(e){return t=>new c(s=>t.subscribe(new B(s,e)))}let B=class{destination;mapper;constructor(t,s){this.destination=t,this.mapper=s}next(t){let s;try{s=this.mapper(t)}catch(n){throw this.error(n),n}this.destination.next(s)}error(t){this.destination.error?.(t)}};function je(e){return Z(()=>e)}function Ge(){return e=>new c(t=>{let s=!1,n=!1;const o=e.subscribe(i=>{s||(s=!0,t.next(i)),n&&o.unsubscribe()},i=>{s=!0,t.error?.(i),n&&o.unsubscribe()});return n=!0,s&&o.unsubscribe(),o})}function Ve(){return e=>new c(t=>e.subscribe(new K(t)))}class K{destination;last;hasLast=!1;constructor(t){this.destination=t}next(t){const s=this.last;if(this.last=t,!this.hasLast){this.hasLast=!0;return}this.destination.next([s,t])}error(t){this.destination.error?.(t)}}function ze(e){return t=>new c(s=>t.subscribe(new ee(s,e)))}class ee{destination;effect;constructor(t,s){this.destination=t,this.effect=s}next(t){try{this.effect(t)}catch(s){throw this.error(s),s}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"})(_||(_={}));var I;(function(e){e.Armenian="58",e.Azerbaijani="57",e.Belarusian="114",e.English="3",e.Kazakh="97",e.Portuguese="73",e.Russian="0",e.Spanish="4",e.Ukrainian="1",e.Uzbek="65",e.Vietnamese="75"})(I||(I={}));const te="vk.com",De=async(e,t,s)=>{const n=new URL(`https://${te}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",t),e!==void 0&&n.searchParams.set("lang",e);const i=await(await fetch(n.toString())).json();return se(i,s)},se=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([s,n])=>[s.substring(`${t}_`.length),ne(n)])),ne=e=>Array.isArray(e)?e[0]:e;var v;(function(e){e.RU="ru",e.EN="en"})(v||(v={}));export{l as CurrentClientBrowser,d as CurrentClientDevice,_ as ErrorCategory,v as InterfaceLanguage,oe as Logger,c as Observable,R as Subject,x as Subscription,ie as VERSION,I as VKNumericLanguage,_e as ValueSubject,u as VideoQuality,de as abortable,ue as addScript,Oe as areQualitiesExact,m as assertNever,ae as assertNonNullable,ce as assertNullable,Ae as assertQualityIsExact,Le as buffer,re as checkNever,Ie as combine,Me as debounce,$ as fillWithDefault,ke as filter,Qe as filterChanged,ye as fromEvent,U as getCurrentBrowser,fe as getExponentialDelay,ge as getHighestQuality,Te as interval,pe as isHigher,me as isHigherOrEqual,le as isIOS,y as isInvariantQuality,T as isLower,we as isLowerOrEqual,k as isNonNullable,Q as isNullable,De as loadVKLangPack,Z as map,je as mapTo,ve as merge,S as noop,he as now,Pe as observableFrom,Ge as once,Ve as pairwise,be as safeStorage,ze as tap,Ne as throttle,Re as timeout,Ee as videoHeightToQuality,xe as videoQualityToHeight,Se as videoSizeToQuality};
package/index.d.ts CHANGED
@@ -135,6 +135,7 @@ type ICurrentBrowserInfo = {
135
135
  device: CurrentClientDevice;
136
136
  };
137
137
  declare const getCurrentBrowser: () => ICurrentBrowserInfo;
138
+ declare const isIOS: () => boolean;
138
139
 
139
140
  type ExponentialBackoffConfig = Partial<{
140
141
  start: Milliseconds;
@@ -347,4 +348,26 @@ declare function pairwise<T>(): IOperator<T, IPair<T>>;
347
348
 
348
349
  declare function tap<T>(effect: (value: T) => void): IOperator<T>;
349
350
 
350
- export { 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, RecursivePartial, Seconds, Subject, Subscription, VERSION, ValueSubject, VideoQuality, abortable, addScript, areQualitiesExact, assertNever, assertNonNullable, assertNullable, assertQualityIsExact, bps, buffer, checkNever, combine, debounce, fillWithDefault, 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 };
351
+ declare enum InterfaceLanguage {
352
+ RU = "ru",
353
+ EN = "en"
354
+ }
355
+ type StringRecord = Record<string, string>;
356
+
357
+ declare enum VKNumericLanguage {
358
+ Armenian = "58",
359
+ Azerbaijani = "57",
360
+ Belarusian = "114",
361
+ English = "3",
362
+ Kazakh = "97",
363
+ Portuguese = "73",
364
+ Russian = "0",
365
+ Spanish = "4",
366
+ Ukrainian = "1",
367
+ Uzbek = "65",
368
+ Vietnamese = "75"
369
+ }
370
+ type VKLanguage = VKNumericLanguage | string;
371
+ declare const loadVKLangPack: <T extends StringRecord>(language: VKLanguage, packName: string, packPrefix: string) => Promise<T>;
372
+
373
+ export { 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, InterfaceLanguage, Kbps, Logger, Mbps, Milliseconds, Observable, Percentage, QualityLimits, RecursivePartial, Seconds, StringRecord, Subject, Subscription, VERSION, VKLanguage, VKNumericLanguage, ValueSubject, VideoQuality, abortable, addScript, areQualitiesExact, assertNever, assertNonNullable, assertNullable, assertQualityIsExact, bps, buffer, checkNever, combine, debounce, fillWithDefault, filter, filterChanged, _default as fromEvent, getCurrentBrowser, getExponentialDelay, getHighestQuality, _default$2 as interval, isHigher, isHigherOrEqual, isIOS, isInvariantQuality, isLower, isLowerOrEqual, isNonNullable, isNullable, loadVKLangPack, 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.27",
3
+ "version": "1.0.28",
4
4
  "author": "vk.com",
5
5
  "description": "Shared code for vk.com videoplayer",
6
6
  "homepage": "https://vk.com",