@vkontakte/videoplayer-shared 1.0.55-dev.5974155b.0 → 1.0.55-dev.92192b59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es2015.cjs.js +3 -3
- package/es2015.esm.js +3 -3
- package/es2018.cjs.js +3 -3
- package/es2018.esm.js +3 -3
- package/esnext.cjs.js +3 -3
- package/esnext.esm.js +3 -3
- package/evergreen.esm.js +3 -3
- package/package.json +1 -1
package/evergreen.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.55-dev.
|
|
3
|
-
* Tue, 25 Feb 2025
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.55-dev.92192b59.0
|
|
3
|
+
* Tue, 25 Feb 2025 10:48:47 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-55/doc/
|
|
5
5
|
*/
|
|
6
|
-
var Pe=Object.defineProperty;var oe=(t,e)=>{for(var r in e)Pe(t,r,{get:e[r],enumerable:!0})};var Le="1.0.55-dev.5974155b.0";var b=class{constructor(){this.subscriptions=[]}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(r=>typeof r=="function"?r():r.unsubscribe())}add(e){return this.subscriptions.push(e),this}};var T=t=>{throw new Error(`${t} is value of unexpected type`)},Me=t=>{};var g=()=>{};var c=class{constructor(e){e&&(this._subscribe=e)}subscribe(e,r){let n;r?typeof r=="function"?n={next:r,error:g}:n={next:o=>r.next(o),error:o=>r.error?.(o)}:n={next:g,error:g};let i=typeof e=="function"?{next:o=>{try{let a=e(o);a instanceof Promise&&a.catch(p=>n.next(p))}catch(a){n.next(a)}},error:o=>n.next(o)}:{next:o=>e.next(o),error:o=>e.error?e.error(o):n.next(o)},s;try{s=this._subscribe(i)}catch(o){i.error?.(o)}return new b().add(()=>{switch(i.next=g,i.error=g,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return T(s)}})}pipe(...e){return e.reduce((r,n)=>n(r),this)}_subscribe(e){}};var v=class extends c{constructor(){super();this.keyCounter=0;this.subscribers=new Map}next(r){this.subscribers.forEach(n=>n.next(r))}error(r){this.subscribers.forEach(n=>n.error?.(r))}_subscribe(r){let n=this.keyCounter++;return this.subscribers.set(n,r),new b().add(()=>this.subscribers.delete(n))}};var V=class{constructor(){this.log$=new v;this.logs=[];this.log=e=>{let r={...e,timestamp:Date.now()};this.logs.push(r),this.log$.next(r)};this.getAllLogs=()=>this.logs}createCustomLog(e){return(...r)=>{let n;try{n=e(...r)}catch{n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(r=>({component:e,...r}))}};import{trace as Ve,context as _e}from"@opentelemetry/api";import{TracerAllSpansProcessor as Ne,TracerMemorySpanExporter as se,initTracerOpenTelemetry as De}from"@tracer/opentelemetry";var _=class t{constructor({name:e}){}log(e,r){}error(e,r){}critical(e,r){}createComponentTracer(e){return new t({name:e})}end(){}getFinishedSpans(){}getTraceId(){return this.fakeTraceId}},N=class t{constructor({name:e,parentContext:r,tracer:n}){this.childTracers=[];let i=!n;if(i){let o=De({serviceName:"videoplayer-sdk-web",appToken:"L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb",spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0}}).getProvider(),a=new se,p=new se;this.spanExporter=a,o.addSpanProcessor(new Ne({startedSpansExporter:a,endedSpansExporter:p})),this.tracer=o.getTracer("sdk-videoplayer-tracer")}else this.tracer=n;this.span=this.tracer.startSpan(e,{root:i},r),this.context=Ve.setSpan(_e.active(),this.span)}log(e,r){this.span.addEvent(e,{...r,type:"log"})}error(e,r){this.span.addEvent(e,{...r,type:"error"})}critical(e,r){this.span.addEvent(e,{...r,type:"critical"})}static createRootTracer(e=!1){return e?new t({name:"Root"}):new _({name:"Root"})}createComponentTracer(e){let r=new t({name:e,parentContext:this.context,tracer:this.tracer});return this.childTracers.push(r),r}end(){this.childTracers.forEach(e=>e.end()),this.span.end()}getFinishedSpans(){return this.spanExporter?.getJsonData()}getTraceId(){return this.span.spanContext().traceId}};function Qe(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function Ue(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function x(t){return typeof t<"u"&&t!==null}function D(t){return t==null}function je(t,e){if(!t?.length)throw new Error(e)}function Be(t,e){if(t?.length)throw new Error(e)}var Fe=(t,e,r)=>new Promise((n,i)=>{e.addEventListener("abort",()=>{a(),d.remove()});let s=()=>{a(),i("error")},o=()=>{a(),n()},a=()=>{p&&clearTimeout(p),d.removeEventListener("load",o),d.removeEventListener("error",s)},p;r&&(p=window.setTimeout(()=>{a(),i("timeout")},r));let d=document.createElement("script");d.addEventListener("load",o),d.addEventListener("error",s),d.src=t,document.head.appendChild(d)});var We=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now();var ze=(t,e)=>async(...r)=>{let n=e(...r),i=t.aborted,s;for(;!i&&!t.aborted;)try{let o=await n.next(s);i=o.done??!1,s=o.value}catch(o){await n.throw(o)}return s};var ae=()=>/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.appVersion??navigator.userAgent)||navigator?.userAgentData?.mobile,Q=class{constructor(){this.detect()}get browser(){return this._currentBrowser}get device(){return this._currentDevice}get isTouch(){return this._maxTouchPoints>0}get isIOS(){return["iPhone","iPad","iPod"].includes(this.device)}get isMac(){return this.device==="Mac"}get isApple(){return this.isIOS||this.isMac}get isIphoneOrOldIpad(){if(!this.isApple||!this.isTouch)return!1;let e=this.device==="iPad"||window?.screen.width>700,r=this._iosVersion;return!e||e&&!!r&&r<16}get isAndroid(){return this.device==="Android"}get isMobile(){return this._isMobile}get iOSVersion(){return this._iosVersion}get macVersion(){return this._macVersion}get isYandex(){return this.browser==="Yandex"}get isSafari(){return this.browser==="Safari"}get isSamsungBrowser(){return this.browser==="SamsungBrowser"}get isHDR(){return this._isHdr}detect(){let{userAgent:e,maxTouchPoints:r}=navigator;try{this._maxTouchPoints=r,this._isHdr=!!matchMedia("(dynamic-range: high)")?.matches}catch(n){console.error(n)}try{this._isMobile=ae()}catch(n){console.error(n)}this.detectBrowser(e),this.detectDevice(e),this.isIOS&&this.detectIOSVersion(),this.isMac&&this.detectMacVersion()}detectBrowser(e){try{let r=/yabrowser/i.test(e)?"Yandex":void 0,n=/samsungbrowser/i.test(e)?"SamsungBrowser":void 0,i=/chrome|crios/i.test(e)?"Chrome":void 0,s=/chromium/i.test(e)?"Chromium":void 0,o=/firefox|fxios/i.test(e)?"Firefox":void 0,a=/webkit|safari|khtml/i.test(e)?"Safari":void 0,p=/opr\//i.test(e)?"Opera":void 0,d=/edg/i.test(e)?"Edge":void 0;this._currentBrowser=r||n||o||p||d||i||s||a||"Rest"}catch(r){console.error(r)}}detectDevice(e){try{let r=/android/i.test(e)?"Android":void 0,n=/iphone/i.test(e)?"iPhone":void 0,i=/ipad/i.test(e)?"iPad":void 0,s=/ipod/i.test(e)?"iPod":void 0,o=/mac/i.test(e)?"Mac":void 0,a=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?"RestMobile":void 0;this._currentDevice=r||n||i||s||a||o||"Desktop"}catch(r){console.error(r)}}detectIOSVersion(){try{let{userAgent:e}=window.navigator,r=e.match(/Version\/(\d+(\.\d+)?)/i);if(!r)return;let n=r[1],i=parseFloat(n);if(isNaN(i))return;this._iosVersion=i}catch(e){console.error(e)}}detectMacVersion(){try{let{userAgent:e}=window.navigator,r=e.match(/Version\/(\d+)/);if(!r)return;let n=r[1],i=parseInt(n,10);if(isNaN(i))return;this._macVersion=i}catch(e){console.error(e)}}},Ge=new Q;var Ke=(t,{start:e=0,factor:r=2,max:n=1/0,min:i=e,random:s=0}={})=>{let o=e;return o*=r**t,o*=1+(Math.random()*s*2-s),o=Math.round(o),o=Math.min(o,n),o=Math.max(o,i),o};var ce={};oe(ce,{clear:()=>Je,get:()=>qe,has:()=>$e,isPersistent:()=>He,remove:()=>Xe,set:()=>Ye});var y,I,U=`vk-videoplayer-dummy-key-${Math.random()}`,O=()=>{if(I!==void 0)return I;try{localStorage.setItem(U,"test"),localStorage.removeItem(U),I=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(U),I=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)I=2;else throw e}else throw t}return I===2&&(y=new Map),I},He=()=>O()===0,qe=t=>{let e=O();switch(e){case 0:return localStorage.getItem(t)??void 0;case 1:return sessionStorage.getItem(t)??void 0;case 2:return y?.get(t);default:T(e)}},Ye=(t,e)=>{let r=O();switch(r){case 0:try{localStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 1:try{sessionStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 2:y?.set(t,e);return;default:T(r)}},$e=t=>{let e=O();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return y?.has(t)??!1;default:return T(e),!1}},Xe=t=>{let e=O();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:y?.delete(t);return;default:T(e)}},Je=()=>{let t=O();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return y?.clear();default:T(t)}};var Ze=()=>{let t,e=[];try{t=window.self!==window.top}catch(r){r instanceof DOMException&&r.name==="SecurityError"?t=!0:(t=!1,console.error(r))}try{window.location.ancestorOrigins&&(e=[...window.location.ancestorOrigins])}catch(r){console.error(r)}try{!e.length&&document.referrer&&(e=[new URL(document.referrer).origin])}catch(r){console.error(r)}return{isEmbed:t,origins:e,topOrigin:e.at(-1),immediateOrigin:e.at(0)}};var j=(l=>(l.INVARIANT="Invariant quality",l.Q_144P="144p",l.Q_240P="240p",l.Q_360P="360p",l.Q_480P="480p",l.Q_576P="576p",l.Q_720P="720p",l.Q_1080P="1080p",l.Q_1440P="1440p",l.Q_2160P="2160p",l.Q_4320P="4320p",l))(j||{});var f={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"576p":{width:1024,height:576},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},et=(t,e)=>f[t].height>f[e].height,tt=(t,e)=>f[t].height>=f[e].height,B=(t,e)=>f[t].height<f[e].height,rt=(t,e)=>f[t].height<=f[e].height,nt=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:B(e,r)?1:-1)[0],le=Object.keys(f).sort((t,e)=>B(t,e)?-1:1),it=(t,e=.02)=>[...le].find(n=>f[n].height*(1+e)>=t),ot=({width:t,height:e})=>{let r=Math.min(t,e),n=Math.max(t,e);return le.find(i=>{let s=f[i];return s.width>=n&&s.height>=r})},st=t=>f[t].height,F=t=>t==="Invariant quality",at=t=>t.every(e=>!F(e));function ct(t){if(F(t))throw new Error("Expected exact quality")}var lt=(t,e)=>{let r={};for(let n of Object.keys(e)){let i=e[n],s=t[n];Array.isArray(i)&&Array.isArray(s)?r[n]=s:typeof i=="object"&&typeof s=="object"?r[n]=lt(s,i):r[n]=n in t?s:i}return r};var xr=t=>{let e="";return t>=3600&&(e+=Math.floor(t/3600)+"h",t=t%3600),t>=60&&(e+=Math.floor(t/60)+"m",t=t%60),t>0&&(e+=Math.floor(t)+"s"),e};function W(t,e=0,r){let n,i,s,o,a,p,d=0,ee=!1,l=!1,L=!0,te=!e&&e!==0&&typeof window.requestAnimationFrame=="function";r&&(ee=!!r.leading,l="maxWait"in r,s=r?.maxWait?Math.max(+r?.maxWait||0,e):s,L="trailing"in r?!!r.trailing:L);function M(u){let m=n,h=i;return n=i=void 0,d=u,o=t.apply(h,m),o}function E(u,m){return te?(a&&window.cancelAnimationFrame(a),window.requestAnimationFrame(u)):setTimeout(u,m)}function Ee(u){if(te){window.cancelAnimationFrame(u);return}clearTimeout(u)}function Se(u){return d=u,a=E(S,e),ee?M(u):o}function Re(u){let m=u-p,h=u-d,ie=e-m;return l?Math.min(ie,s-h):ie}function re(u){let m=u-p,h=u-d;return p===void 0||m>=e||m<0||l&&h>=s}function S(){let u=Date.now();if(re(u))return ne(u);a=E(S,Re(u))}function ne(u){return a=void 0,L&&n?M(u):(n=i=void 0,o)}function ke(){a!==void 0&&Ee(a),d=0,n=p=i=a=void 0}function Ae(){return a===void 0?o:ne(Date.now())}function Ce(){return a!==void 0}function R(...u){let m=Date.now(),h=re(m);if(n=u,i=this,p=m,h){if(a===void 0)return Se(p);if(l)return a=E(S,e),M(p)}return a===void 0&&(a=E(S,e)),o}return R.cancel=ke,R.flush=Ae,R.pending=Ce,R}var z=(t,e=0,r)=>W(t,e,{...{leading:!0,trailing:!0},...r,maxWait:e});var k=(t,e)=>{if(t===null||typeof t!="object")return t;let r=Array.isArray(t)?[]:{};for(let n in t){if(typeof e=="function"){let i=e(t[n],n,t,r);if(i!==void 0){r[n]=i;continue}}typeof t[n]=="object"?r[n]=k(t[n],e):r[n]=t[n]}return r};var ut=t=>k(t);var pt=300,dt=(t,e=pt)=>new c(r=>{let{width:n,height:i}=t.getBoundingClientRect();if(r.next({width:n,height:i}),!window.ResizeObserver)return;let s=new ResizeObserver(z(o=>{let a=o[0];if(!a)return;let p,d;a.contentBoxSize&&a.contentBoxSize[0]?(d=a.contentBoxSize[0].blockSize,p=a.contentBoxSize[0].inlineSize):a.contentRect&&(p=a.contentRect.width,d=a.contentRect.height),x(p)&&x(d)&&r.next({width:p,height:d})},e));return s.observe(t),()=>s.disconnect()});var A=(t,e=6,r=".")=>{let n={};for(let i in t)if(!(!t.hasOwnProperty(i)||t[i]instanceof HTMLElement||!e))if(typeof t[i]=="object"&&t[i]!==null){let s=A(t[i],e-1);for(let o in s)s.hasOwnProperty(o)&&(n[i+r+o]=s[o])}else n[i]=t[i];return n};var bt=t=>{t.removeAttribute("src"),t.load()};var Vr=t=>{let e;try{e=new URL(t)}catch{return!1}return e.protocol==="https:"};var Nr=t=>{try{return new URL(t)}catch{return null}};var ft=t=>e=>r=>{let n=typeof r=="object";r==null||n&&!Object.keys(r).length||t(e,n?A(r):{value:r})};var C=class extends v{constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let r=super._subscribe(e);return e.next(this.value),r}};function ue(t){return new c(e=>{let r={},n=Object.keys(t).length,i=s=>o=>{s in r||n--,r[s]=o,n===0&&e.next(r)};return Object.entries(t).reduce((s,[o,a])=>s.add(a.subscribe(i(o))),new b)})}function pe(...t){return new c(e=>t.reduce((r,n)=>r.add(n.subscribe(e)),new b))}var mt=t=>new c(e=>{let r=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},t);return()=>window.clearTimeout(r)});var Tt=t=>new c(e=>{let r=window.setInterval(()=>e.next(),t);return()=>{r&&(window.clearInterval(r),r=void 0)}});var vt=t=>new c(e=>{t.forEach(r=>e.next(r))});var ht=(t,e)=>new c(r=>{let n=i=>r.next(i);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});function de(t){return e=>new c(r=>e.subscribe(new G(r,t)))}var G=class{constructor(e,r){this.destination=e;this.size=r;this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){this.destination.error?.(e)}};var gt={leading:!1,trailing:!0};function be(t,e=gt){return r=>new c(n=>r.subscribe(new K(n,t,e)))}var K=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,x(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(r){if(this.destination.error)this.destination.error(r);else throw r}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}};var It={leading:!0,trailing:!1};function fe(t,e=It){return r=>new c(n=>r.subscribe(new H(n,t,e)))}var H=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,D(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 me(t){return e=>new c(r=>e.subscribe(new q(r,t)))}var q=class{constructor(e,r){this.destination=e;this.predicate=r}next(e){let r;try{r=this.predicate(e)}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};var xt=(t,e)=>{let r=(n,i)=>{let s=Object.keys(n);for(let o in i)if(!s.includes(o)||i[o]!==n[o])return!1;return!0};return r(t,e)&&r(e,t)},yt=(t,e)=>t instanceof Object&&e instanceof Object?xt(t,e):t===e;function ve(t=yt){return e=>new c(r=>e.subscribe(new Y(r,t)))}var Te={},Y=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=Te}next(e){let r;try{r=this.lastValue===Te||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object?{...e}:e}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function P(t){return e=>new c(r=>e.subscribe(new $(r,t)))}var $=class{constructor(e,r){this.destination=e;this.mapper=r}next(e){let r;try{r=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(r)}error(e){this.destination.error?.(e)}};function he(t){return P(()=>t)}function ge(){return t=>new c(e=>{let r=!1,n=!1,i=t.subscribe(s=>{r||(r=!0,e.next(s)),n&&i.unsubscribe()},s=>{r=!0,e.error?.(s),n&&i.unsubscribe()});return n=!0,r&&i.unsubscribe(),i})}function Ie(){return t=>new c(e=>t.subscribe(new X(e)))}var X=class{constructor(e){this.destination=e;this.hasLast=!1}next(e){let r=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([r,e])}error(e){this.destination.error?.(e)}};function xe(t){return e=>new c(r=>e.subscribe(new J(r,t)))}var J=class{constructor(e,r){this.destination=e;this.effect=r}next(e){try{this.effect(e)}catch(r){throw this.error(r),r}this.destination.next(e)}error(e){this.destination.error?.(e)}};function ye(t){return e=>new c(r=>e.subscribe(new Z(r,t)))}var Z=class{constructor(e,r){this.destination=e;this.count=r;r<0&&this.destination.error?.(new Error("Count can not be less than zero"))}next(e){this.count===0?this.destination.next(e):this.count--}error(e){this.destination.error?.(e)}};var Ot=(a=>(a.NETWORK="network",a.VIDEO_PIPELINE="video_pipeline",a.EXTERNAL_API="external_api",a.PARSER="parser",a.DOM="dom",a.WTF="wtf",a.FATAL="fatal",a))(Ot||{});var wt=(l=>(l.Armenian="58",l.Azerbaijani="57",l.Belarusian="114",l.English="3",l.Kazakh="97",l.Portuguese="73",l.Russian="0",l.Spanish="4",l.Ukrainian="1",l.Uzbek="65",l.Vietnamese="75",l))(wt||{}),Et="vk.com",Pi=async(t,e,r)=>{let n=new URL(`https://${Et}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),t!==void 0&&n.searchParams.set("lang",t);let s=await(await fetch(n.toString())).json();return St(s,r)},St=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,n])=>[r.substring(`${e}_`.length),Rt(n)])),Rt=t=>Array.isArray(t)?t[0]:t;var kt=(r=>(r.RU="ru",r.EN="en",r))(kt||{});var At={UI:"__vkVideoPlayer",CORE:"__vkVideoCore"},Ct=(()=>{let t=0;return()=>{let e=t;return t=(t+1)%Number.MAX_SAFE_INTEGER,e}})(),Oe=class{constructor(e){this.id=Ct();this.type=e,this.initWindowObjects()}getWindowObject(){let e=this.key();return window[e]?.[this.id]??{}}initWindowObjects(){let e=this.key();window[e]||(window[e]={}),window[e][this.id]={}}expose(e){Object.assign(this.getWindowObject(),e)}destroy(){let e=this.key();window&&window[e]&&window[e][this.id]&&(delete window[e][this.id],Object.keys(window[e]).length||delete window[e])}key(){let{type:e}=this;return At[e]}};var we={};oe(we,{create:()=>Pt,destroy:()=>Lt,push:()=>Mt,subscribe:()=>Vt});var w=new Map,Pt=(t,e)=>w.set(t,e??[]),Lt=t=>w.delete(t),Mt=(t,e)=>{let r=w.get(t);r&&(typeof r=="function"?r(e):r.push(e))},Vt=(t,e)=>{let r=w.get(t);if(r){if(r&&Array.isArray(r))for(let n of r)e(n);w.set(t,e)}};export{Ot as ErrorCategory,kt as InterfaceLanguage,Oe as InternalsExposure,V as Logger,c as Observable,v as Subject,b as Subscription,N as Tracer,Le as VERSION,wt as VKNumericLanguage,C as ValueSubject,j as VideoQuality,ze as abortable,Fe as addScript,at as areQualitiesExact,Be as assertEmptyArray,T as assertNever,Qe as assertNonNullable,je as assertNotEmptyArray,Ue as assertNullable,ct as assertQualityIsExact,de as buffer,Me as checkNever,bt as clearVideoElement,Ge as clientChecker,ut as cloneDeep,k as cloneDeepWith,ue as combine,Nr as createURL,be as debounce,W as debounceFn,Ze as detectEmbed,we as devNull,lt as fillWithDefault,me as filter,ve as filterChanged,A as flattenObject,ht as fromEvent,Ke as getExponentialDelay,nt as getHighestQuality,ft as getTraceSubscriptionMethod,Tt as interval,et as isHigher,tt as isHigherOrEqual,F as isInvariantQuality,B as isLower,rt as isLowerOrEqual,ae as isMobile,x as isNonNullable,D as isNullable,Vr as isValidURL,Pi as loadVKLangPack,P as map,he as mapTo,pe as merge,g as noop,We as now,vt as observableFrom,dt as observeElementSize,ge as once,Ie as pairwise,ce as safeStorage,ye as skip,xe as tap,fe as throttle,z as throttleFn,xr as timeCodeToString,mt as timeout,it as videoHeightToQuality,st as videoQualityToHeight,ot as videoSizeToQuality};
|
|
6
|
+
var Pe=Object.defineProperty;var oe=(t,e)=>{for(var r in e)Pe(t,r,{get:e[r],enumerable:!0})};var Le="1.0.55-dev.92192b59.0";var b=class{constructor(){this.subscriptions=[]}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(r=>typeof r=="function"?r():r.unsubscribe())}add(e){return this.subscriptions.push(e),this}};var T=t=>{throw new Error(`${t} is value of unexpected type`)},Me=t=>{};var g=()=>{};var c=class{constructor(e){e&&(this._subscribe=e)}subscribe(e,r){let n;r?typeof r=="function"?n={next:r,error:g}:n={next:o=>r.next(o),error:o=>r.error?.(o)}:n={next:g,error:g};let i=typeof e=="function"?{next:o=>{try{let a=e(o);a instanceof Promise&&a.catch(p=>n.next(p))}catch(a){n.next(a)}},error:o=>n.next(o)}:{next:o=>e.next(o),error:o=>e.error?e.error(o):n.next(o)},s;try{s=this._subscribe(i)}catch(o){i.error?.(o)}return new b().add(()=>{switch(i.next=g,i.error=g,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return T(s)}})}pipe(...e){return e.reduce((r,n)=>n(r),this)}_subscribe(e){}};var v=class extends c{constructor(){super();this.keyCounter=0;this.subscribers=new Map}next(r){this.subscribers.forEach(n=>n.next(r))}error(r){this.subscribers.forEach(n=>n.error?.(r))}_subscribe(r){let n=this.keyCounter++;return this.subscribers.set(n,r),new b().add(()=>this.subscribers.delete(n))}};var V=class{constructor(){this.log$=new v;this.logs=[];this.log=e=>{let r={...e,timestamp:Date.now()};this.logs.push(r),this.log$.next(r)};this.getAllLogs=()=>this.logs}createCustomLog(e){return(...r)=>{let n;try{n=e(...r)}catch{n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(r=>({component:e,...r}))}};import{trace as Ve,context as _e}from"@opentelemetry/api";import{TracerAllSpansProcessor as Ne,TracerMemorySpanExporter as se,initTracerOpenTelemetry as De}from"@tracer/opentelemetry";var _=class t{constructor({name:e}){}log(e,r){}error(e,r){}critical(e,r){}createComponentTracer(e){return new t({name:e})}end(){}getFinishedSpans(){}getTraceId(){return this.fakeTraceId}},N=class t{constructor({name:e,parentContext:r,tracer:n}){this.childTracers=[];let i=!n;if(i){let o=De({serviceName:"videoplayer-sdk-web",appToken:"L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb",spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0}}).getProvider(),a=new se,p=new se;this.spanExporter=a,o.addSpanProcessor(new Ne({startedSpansExporter:a,endedSpansExporter:p})),this.tracer=o.getTracer("sdk-videoplayer-tracer")}else this.tracer=n;this.span=this.tracer.startSpan(e,{root:i},r),this.context=Ve.setSpan(_e.active(),this.span)}log(e,r){this.span.addEvent(e,{...r,type:"log"})}error(e,r){this.span.addEvent(e,{...r,type:"error"})}critical(e,r){this.span.addEvent(e,{...r,type:"critical"})}static createRootTracer(e=!1){return e?new t({name:"Root"}):new _({name:"Root"})}createComponentTracer(e){let r=new t({name:e,parentContext:this.context,tracer:this.tracer});return this.childTracers.push(r),r}end(){this.childTracers.forEach(e=>e.end()),this.span.end()}getFinishedSpans(){return this.spanExporter?.getJsonData()}getTraceId(){return this.span.spanContext().traceId}};function Qe(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function Ue(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function x(t){return typeof t<"u"&&t!==null}function D(t){return t==null}function je(t,e){if(!t?.length)throw new Error(e)}function Be(t,e){if(t?.length)throw new Error(e)}var Fe=(t,e,r)=>new Promise((n,i)=>{e.addEventListener("abort",()=>{a(),d.remove()});let s=()=>{a(),i("error")},o=()=>{a(),n()},a=()=>{p&&clearTimeout(p),d.removeEventListener("load",o),d.removeEventListener("error",s)},p;r&&(p=window.setTimeout(()=>{a(),i("timeout")},r));let d=document.createElement("script");d.addEventListener("load",o),d.addEventListener("error",s),d.src=t,document.head.appendChild(d)});var We=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now();var ze=(t,e)=>async(...r)=>{let n=e(...r),i=t.aborted,s;for(;!i&&!t.aborted;)try{let o=await n.next(s);i=o.done??!1,s=o.value}catch(o){await n.throw(o)}return s};var ae=()=>/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.appVersion??navigator.userAgent)||navigator?.userAgentData?.mobile,Q=class{constructor(){this.detect()}get browser(){return this._currentBrowser}get device(){return this._currentDevice}get isTouch(){return this._maxTouchPoints>0}get isIOS(){return["iPhone","iPad","iPod"].includes(this.device)}get isMac(){return this.device==="Mac"}get isApple(){return this.isIOS||this.isMac}get isIphoneOrOldIpad(){if(!this.isApple||!this.isTouch)return!1;let e=this.device==="iPad"||window?.screen.width>700,r=this._iosVersion;return!e||e&&!!r&&r<16}get isAndroid(){return this.device==="Android"}get isMobile(){return this._isMobile}get iOSVersion(){return this._iosVersion}get macVersion(){return this._macVersion}get isYandex(){return this.browser==="Yandex"}get isSafari(){return this.browser==="Safari"}get isSamsungBrowser(){return this.browser==="SamsungBrowser"}get isHDR(){return this._isHdr}detect(){let{userAgent:e,maxTouchPoints:r}=navigator;try{this._maxTouchPoints=r,this._isHdr=!!matchMedia("(dynamic-range: high)")?.matches}catch(n){console.error(n)}try{this._isMobile=ae()}catch(n){console.error(n)}this.detectBrowser(e),this.detectDevice(e),this.isIOS&&this.detectIOSVersion(),this.isMac&&this.detectMacVersion()}detectBrowser(e){try{let r=/yabrowser/i.test(e)?"Yandex":void 0,n=/samsungbrowser/i.test(e)?"SamsungBrowser":void 0,i=/chrome|crios/i.test(e)?"Chrome":void 0,s=/chromium/i.test(e)?"Chromium":void 0,o=/firefox|fxios/i.test(e)?"Firefox":void 0,a=/webkit|safari|khtml/i.test(e)?"Safari":void 0,p=/opr\//i.test(e)?"Opera":void 0,d=/edg/i.test(e)?"Edge":void 0;this._currentBrowser=r||n||o||p||d||i||s||a||"Rest"}catch(r){console.error(r)}}detectDevice(e){try{let r=/android/i.test(e)?"Android":void 0,n=/iphone/i.test(e)?"iPhone":void 0,i=/ipad/i.test(e)?"iPad":void 0,s=/ipod/i.test(e)?"iPod":void 0,o=/mac/i.test(e)?"Mac":void 0,a=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?"RestMobile":void 0;this._currentDevice=r||n||i||s||a||o||"Desktop"}catch(r){console.error(r)}}detectIOSVersion(){try{let{userAgent:e}=window.navigator,r=e.match(/Version\/(\d+(\.\d+)?)/i);if(!r)return;let n=r[1],i=parseFloat(n);if(isNaN(i))return;this._iosVersion=i}catch(e){console.error(e)}}detectMacVersion(){try{let{userAgent:e}=window.navigator,r=e.match(/Version\/(\d+)/);if(!r)return;let n=r[1],i=parseInt(n,10);if(isNaN(i))return;this._macVersion=i}catch(e){console.error(e)}}},Ge=new Q;var Ke=(t,{start:e=0,factor:r=2,max:n=1/0,min:i=e,random:s=0}={})=>{let o=e;return o*=r**t,o*=1+(Math.random()*s*2-s),o=Math.round(o),o=Math.min(o,n),o=Math.max(o,i),o};var ce={};oe(ce,{clear:()=>Je,get:()=>qe,has:()=>$e,isPersistent:()=>He,remove:()=>Xe,set:()=>Ye});var y,I,U=`vk-videoplayer-dummy-key-${Math.random()}`,O=()=>{if(I!==void 0)return I;try{localStorage.setItem(U,"test"),localStorage.removeItem(U),I=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(U),I=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)I=2;else throw e}else throw t}return I===2&&(y=new Map),I},He=()=>O()===0,qe=t=>{let e=O();switch(e){case 0:return localStorage.getItem(t)??void 0;case 1:return sessionStorage.getItem(t)??void 0;case 2:return y?.get(t);default:T(e)}},Ye=(t,e)=>{let r=O();switch(r){case 0:try{localStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 1:try{sessionStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 2:y?.set(t,e);return;default:T(r)}},$e=t=>{let e=O();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return y?.has(t)??!1;default:return T(e),!1}},Xe=t=>{let e=O();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:y?.delete(t);return;default:T(e)}},Je=()=>{let t=O();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return y?.clear();default:T(t)}};var Ze=()=>{let t,e=[];try{t=window.self!==window.top}catch(r){r instanceof DOMException&&r.name==="SecurityError"?t=!0:(t=!1,console.error(r))}try{window.location.ancestorOrigins&&(e=[...window.location.ancestorOrigins])}catch(r){console.error(r)}try{!e.length&&document.referrer&&(e=[new URL(document.referrer).origin])}catch(r){console.error(r)}return{isEmbed:t,origins:e,topOrigin:e.at(-1),immediateOrigin:e.at(0)}};var j=(l=>(l.INVARIANT="Invariant quality",l.Q_144P="144p",l.Q_240P="240p",l.Q_360P="360p",l.Q_480P="480p",l.Q_576P="576p",l.Q_720P="720p",l.Q_1080P="1080p",l.Q_1440P="1440p",l.Q_2160P="2160p",l.Q_4320P="4320p",l))(j||{});var f={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"576p":{width:1024,height:576},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},et=(t,e)=>f[t].height>f[e].height,tt=(t,e)=>f[t].height>=f[e].height,B=(t,e)=>f[t].height<f[e].height,rt=(t,e)=>f[t].height<=f[e].height,nt=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:B(e,r)?1:-1)[0],le=Object.keys(f).sort((t,e)=>B(t,e)?-1:1),it=(t,e=.02)=>[...le].find(n=>f[n].height*(1+e)>=t),ot=({width:t,height:e})=>{let r=Math.min(t,e),n=Math.max(t,e);return le.find(i=>{let s=f[i];return s.width>=n&&s.height>=r})},st=t=>f[t].height,F=t=>t==="Invariant quality",at=t=>t.every(e=>!F(e));function ct(t){if(F(t))throw new Error("Expected exact quality")}var lt=(t,e)=>{let r={};for(let n of Object.keys(e)){let i=e[n],s=t[n];Array.isArray(i)&&Array.isArray(s)?r[n]=s:typeof i=="object"&&typeof s=="object"?r[n]=lt(s,i):r[n]=n in t?s:i}return r};var xr=t=>{let e="";return t>=3600&&(e+=Math.floor(t/3600)+"h",t=t%3600),t>=60&&(e+=Math.floor(t/60)+"m",t=t%60),t>0&&(e+=Math.floor(t)+"s"),e};function W(t,e=0,r){let n,i,s,o,a,p,d=0,ee=!1,l=!1,L=!0,te=!e&&e!==0&&typeof window.requestAnimationFrame=="function";r&&(ee=!!r.leading,l="maxWait"in r,s=r?.maxWait?Math.max(+r?.maxWait||0,e):s,L="trailing"in r?!!r.trailing:L);function M(u){let m=n,h=i;return n=i=void 0,d=u,o=t.apply(h,m),o}function E(u,m){return te?(a&&window.cancelAnimationFrame(a),window.requestAnimationFrame(u)):setTimeout(u,m)}function Ee(u){if(te){window.cancelAnimationFrame(u);return}clearTimeout(u)}function Se(u){return d=u,a=E(S,e),ee?M(u):o}function Re(u){let m=u-p,h=u-d,ie=e-m;return l?Math.min(ie,s-h):ie}function re(u){let m=u-p,h=u-d;return p===void 0||m>=e||m<0||l&&h>=s}function S(){let u=Date.now();if(re(u))return ne(u);a=E(S,Re(u))}function ne(u){return a=void 0,L&&n?M(u):(n=i=void 0,o)}function ke(){a!==void 0&&Ee(a),d=0,n=p=i=a=void 0}function Ae(){return a===void 0?o:ne(Date.now())}function Ce(){return a!==void 0}function R(...u){let m=Date.now(),h=re(m);if(n=u,i=this,p=m,h){if(a===void 0)return Se(p);if(l)return a=E(S,e),M(p)}return a===void 0&&(a=E(S,e)),o}return R.cancel=ke,R.flush=Ae,R.pending=Ce,R}var z=(t,e=0,r)=>W(t,e,{...{leading:!0,trailing:!0},...r,maxWait:e});var k=(t,e)=>{if(t===null||typeof t!="object")return t;let r=Array.isArray(t)?[]:{};for(let n in t){if(typeof e=="function"){let i=e(t[n],n,t,r);if(i!==void 0){r[n]=i;continue}}typeof t[n]=="object"?r[n]=k(t[n],e):r[n]=t[n]}return r};var ut=t=>k(t);var pt=300,dt=(t,e=pt)=>new c(r=>{let{width:n,height:i}=t.getBoundingClientRect();if(r.next({width:n,height:i}),!window.ResizeObserver)return;let s=new ResizeObserver(z(o=>{let a=o[0];if(!a)return;let p,d;a.contentBoxSize&&a.contentBoxSize[0]?(d=a.contentBoxSize[0].blockSize,p=a.contentBoxSize[0].inlineSize):a.contentRect&&(p=a.contentRect.width,d=a.contentRect.height),x(p)&&x(d)&&r.next({width:p,height:d})},e));return s.observe(t),()=>s.disconnect()});var A=(t,e=6,r=".")=>{let n={};for(let i in t)if(!(!t.hasOwnProperty(i)||t[i]instanceof HTMLElement||!e))if(typeof t[i]=="object"&&t[i]!==null){let s=A(t[i],e-1);for(let o in s)s.hasOwnProperty(o)&&(n[i+r+o]=s[o])}else n[i]=t[i];return n};var bt=t=>{t.removeAttribute("src"),t.load()};var Vr=t=>{let e;try{e=new URL(t)}catch{return!1}return e.protocol==="https:"};var Nr=t=>{try{return new URL(t)}catch{return null}};var ft=t=>e=>r=>{let n=typeof r=="object";r==null||n&&!Object.keys(r).length||t(e,n?A(r):{value:r})};var C=class extends v{constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let r=super._subscribe(e);return e.next(this.value),r}};function ue(t){return new c(e=>{let r={},n=Object.keys(t).length,i=s=>o=>{s in r||n--,r[s]=o,n===0&&e.next(r)};return Object.entries(t).reduce((s,[o,a])=>s.add(a.subscribe(i(o))),new b)})}function pe(...t){return new c(e=>t.reduce((r,n)=>r.add(n.subscribe(e)),new b))}var mt=t=>new c(e=>{let r=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},t);return()=>window.clearTimeout(r)});var Tt=t=>new c(e=>{let r=window.setInterval(()=>e.next(),t);return()=>{r&&(window.clearInterval(r),r=void 0)}});var vt=t=>new c(e=>{t.forEach(r=>e.next(r))});var ht=(t,e)=>new c(r=>{let n=i=>r.next(i);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});function de(t){return e=>new c(r=>e.subscribe(new G(r,t)))}var G=class{constructor(e,r){this.destination=e;this.size=r;this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){this.destination.error?.(e)}};var gt={leading:!1,trailing:!0};function be(t,e=gt){return r=>new c(n=>r.subscribe(new K(n,t,e)))}var K=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,x(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(r){if(this.destination.error)this.destination.error(r);else throw r}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}};var It={leading:!0,trailing:!1};function fe(t,e=It){return r=>new c(n=>r.subscribe(new H(n,t,e)))}var H=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,D(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 me(t){return e=>new c(r=>e.subscribe(new q(r,t)))}var q=class{constructor(e,r){this.destination=e;this.predicate=r}next(e){let r;try{r=this.predicate(e)}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};var xt=(t,e)=>{let r=(n,i)=>{let s=Object.keys(n);for(let o in i)if(!s.includes(o)||i[o]!==n[o])return!1;return!0};return r(t,e)&&r(e,t)},yt=(t,e)=>t instanceof Object&&e instanceof Object?xt(t,e):t===e;function ve(t=yt){return e=>new c(r=>e.subscribe(new Y(r,t)))}var Te={},Y=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=Te}next(e){let r;try{r=this.lastValue===Te||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object?{...e}:e}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function P(t){return e=>new c(r=>e.subscribe(new $(r,t)))}var $=class{constructor(e,r){this.destination=e;this.mapper=r}next(e){let r;try{r=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(r)}error(e){this.destination.error?.(e)}};function he(t){return P(()=>t)}function ge(){return t=>new c(e=>{let r=!1,n=!1,i=t.subscribe(s=>{r||(r=!0,e.next(s)),n&&i.unsubscribe()},s=>{r=!0,e.error?.(s),n&&i.unsubscribe()});return n=!0,r&&i.unsubscribe(),i})}function Ie(){return t=>new c(e=>t.subscribe(new X(e)))}var X=class{constructor(e){this.destination=e;this.hasLast=!1}next(e){let r=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([r,e])}error(e){this.destination.error?.(e)}};function xe(t){return e=>new c(r=>e.subscribe(new J(r,t)))}var J=class{constructor(e,r){this.destination=e;this.effect=r}next(e){try{this.effect(e)}catch(r){throw this.error(r),r}this.destination.next(e)}error(e){this.destination.error?.(e)}};function ye(t){return e=>new c(r=>e.subscribe(new Z(r,t)))}var Z=class{constructor(e,r){this.destination=e;this.count=r;r<0&&this.destination.error?.(new Error("Count can not be less than zero"))}next(e){this.count===0?this.destination.next(e):this.count--}error(e){this.destination.error?.(e)}};var Ot=(a=>(a.NETWORK="network",a.VIDEO_PIPELINE="video_pipeline",a.EXTERNAL_API="external_api",a.PARSER="parser",a.DOM="dom",a.WTF="wtf",a.FATAL="fatal",a))(Ot||{});var wt=(l=>(l.Armenian="58",l.Azerbaijani="57",l.Belarusian="114",l.English="3",l.Kazakh="97",l.Portuguese="73",l.Russian="0",l.Spanish="4",l.Ukrainian="1",l.Uzbek="65",l.Vietnamese="75",l))(wt||{}),Et="vk.com",Pi=async(t,e,r)=>{let n=new URL(`https://${Et}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),t!==void 0&&n.searchParams.set("lang",t);let s=await(await fetch(n.toString())).json();return St(s,r)},St=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,n])=>[r.substring(`${e}_`.length),Rt(n)])),Rt=t=>Array.isArray(t)?t[0]:t;var kt=(r=>(r.RU="ru",r.EN="en",r))(kt||{});var At={UI:"__vkVideoPlayer",CORE:"__vkVideoCore"},Ct=(()=>{let t=0;return()=>{let e=t;return t=(t+1)%Number.MAX_SAFE_INTEGER,e}})(),Oe=class{constructor(e){this.id=Ct();this.type=e,this.initWindowObjects()}getWindowObject(){let e=this.key();return window[e]?.[this.id]??{}}initWindowObjects(){let e=this.key();window[e]||(window[e]={}),window[e][this.id]={}}expose(e){Object.assign(this.getWindowObject(),e)}destroy(){let e=this.key();window&&window[e]&&window[e][this.id]&&(delete window[e][this.id],Object.keys(window[e]).length||delete window[e])}key(){let{type:e}=this;return At[e]}};var we={};oe(we,{create:()=>Pt,destroy:()=>Lt,push:()=>Mt,subscribe:()=>Vt});var w=new Map,Pt=(t,e)=>w.set(t,e??[]),Lt=t=>w.delete(t),Mt=(t,e)=>{let r=w.get(t);r&&(typeof r=="function"?r(e):r.push(e))},Vt=(t,e)=>{let r=w.get(t);if(r){if(r&&Array.isArray(r))for(let n of r)e(n);w.set(t,e)}};export{Ot as ErrorCategory,kt as InterfaceLanguage,Oe as InternalsExposure,V as Logger,c as Observable,v as Subject,b as Subscription,N as Tracer,Le as VERSION,wt as VKNumericLanguage,C as ValueSubject,j as VideoQuality,ze as abortable,Fe as addScript,at as areQualitiesExact,Be as assertEmptyArray,T as assertNever,Qe as assertNonNullable,je as assertNotEmptyArray,Ue as assertNullable,ct as assertQualityIsExact,de as buffer,Me as checkNever,bt as clearVideoElement,Ge as clientChecker,ut as cloneDeep,k as cloneDeepWith,ue as combine,Nr as createURL,be as debounce,W as debounceFn,Ze as detectEmbed,we as devNull,lt as fillWithDefault,me as filter,ve as filterChanged,A as flattenObject,ht as fromEvent,Ke as getExponentialDelay,nt as getHighestQuality,ft as getTraceSubscriptionMethod,Tt as interval,et as isHigher,tt as isHigherOrEqual,F as isInvariantQuality,B as isLower,rt as isLowerOrEqual,ae as isMobile,x as isNonNullable,D as isNullable,Vr as isValidURL,Pi as loadVKLangPack,P as map,he as mapTo,pe as merge,g as noop,We as now,vt as observableFrom,dt as observeElementSize,ge as once,Ie as pairwise,ce as safeStorage,ye as skip,xe as tap,fe as throttle,z as throttleFn,xr as timeCodeToString,mt as timeout,it as videoHeightToQuality,st as videoQualityToHeight,ot as videoSizeToQuality};
|