@vkontakte/videoplayer-shared 1.0.78-beta.0 → 1.0.78-dev.0c91b20c.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/es2024.cjs.js +3 -3
- package/es2024.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.78-
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.78-dev.0c91b20c.0
|
|
3
|
+
* Fri, 12 Dec 2025 13:54:07 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-78/doc/
|
|
5
5
|
*/
|
|
6
|
-
var Ve=Object.defineProperty;var pe=(t,e)=>{for(var r in e)Ve(t,r,{get:e[r],enumerable:!0})};var Qe="1.0.78-beta.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 I=t=>{throw new Error(`${t} is value of unexpected type`)},_e=t=>{};var x=()=>{};var De=t=>{throw console.error(t),t},Ue=t=>{console.error(t)},c=class{constructor(e){this.suppressErrors=!1;e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,r){let n=this.suppressErrors?Ue:De,o;r?typeof r=="function"?o={next:r,error:x}:o={next:i=>r.next(i),error:i=>r.error?.(i)}:o={next:n,error:x};let a=typeof e=="function"?{next:i=>{try{let p=e(i);p instanceof Promise&&p.catch(m=>o.next(m))}catch(p){o.next(p)}},error:i=>o.next(i)}:{next:i=>e.next(i),error:i=>e.error?e.error(i):o.next(i)},s;try{s=this._subscribe(a)}catch(i){a.error?.(i)}return new b().add(()=>{switch(a.next=x,a.error=x,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return I(s)}})}pipe(...e){return e.reduce((r,n)=>n(r),this)}_subscribe(e){}};var y=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 F=class{constructor(){this.log$=new y;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}))}};function je(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function ze(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function O(t){return typeof t<"u"&&t!==null}function A(t){return t==null}function Fe(t,e){if(!t?.length)throw new Error(e)}function We(t,e){if(t?.length)throw new Error(e)}var Ge=(t,e,r)=>new Promise((n,o)=>{e.addEventListener("abort",()=>{i(),m.remove()});let a=()=>{i(),o("error")},s=()=>{i(),n()},i=()=>{p&&clearTimeout(p),m.removeEventListener("load",s),m.removeEventListener("error",a)},p;r&&(p=window.setTimeout(()=>{i(),o("timeout")},r));let m=document.createElement("script");m.addEventListener("load",s),m.addEventListener("error",a),m.src=t,document.head.appendChild(m)});var Ke=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now();var He=(t,e)=>async(...r)=>{let n=e(...r),o=t.aborted,a;for(;!o&&!t.aborted;)try{let s=await n.next(a);o=s.done??!1,a=s.value}catch(s){await n.throw(s)}return a};var Be=(t,{start:e=0,factor:r=2,max:n=1/0,min:o=e,random:a=0}={})=>{let s=e;return s*=r**t,s*=1+(Math.random()*a*2-a),s=Math.round(s),s=Math.min(s,n),s=Math.max(s,o),s};var ue={};pe(ue,{clear:()=>Ze,get:()=>$e,has:()=>Ye,isPersistent:()=>qe,remove:()=>Je,set:()=>Xe});var w,v,W=`vk-videoplayer-dummy-key-${Math.random()}`,E=()=>{if(v!==void 0)return v;try{localStorage.setItem(W,"test"),localStorage.removeItem(W),v=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(W),v=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)v=2;else throw e}else throw t}return v===2&&(w=new Map),v},qe=()=>E()===0,$e=t=>{let e=E();switch(e){case 0:return localStorage.getItem(t)??void 0;case 1:return sessionStorage.getItem(t)??void 0;case 2:return w?.get(t);default:I(e)}},Xe=(t,e)=>{let r=E();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:w?.set(t,e);return;default:I(r)}},Ye=t=>{let e=E();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return w?.has(t)??!1;default:return I(e),!1}},Je=t=>{let e=E();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:w?.delete(t);return;default:I(e)}},Ze=()=>{let t=E();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return w?.clear();default:I(t)}};var et=()=>{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 e=e.filter(r=>URL.canParse(r)),{isEmbed:t,origins:e,topOrigin:e.at(-1),immediateOrigin:e.at(0)}};var G=(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))(G||{});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}},tt=(t,e)=>f[t].height>f[e].height,rt=(t,e)=>f[t].height>=f[e].height,K=(t,e)=>f[t].height<f[e].height,nt=(t,e)=>f[t].height<=f[e].height,ot=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:K(e,r)?1:-1)[0],me=Object.keys(f).sort((t,e)=>K(t,e)?-1:1),it=(t,e=.02)=>[...me].find(n=>f[n].height*(1+e)>=t),st=({width:t,height:e})=>{let r=Math.min(t,e),n=Math.max(t,e);return me.find(o=>{let a=f[o];return a.width>=n&&a.height>=r})},at=t=>f[t].height,H=t=>t==="Invariant quality",ct=t=>t.every(e=>!H(e));function lt(t){if(H(t))throw new Error("Expected exact quality")}var pt=t=>{switch(t){case"4320p":return"8K";case"2160p":return"4K";case"1440p":return"QHD";case"1080p":return"FHD";case"720p":return"HD";default:return""}};var ut=(t,e)=>{let r={};for(let n of Object.keys(e)){let o=e[n],a=t[n];Array.isArray(o)&&Array.isArray(a)?r[n]=a:typeof o=="object"&&typeof a=="object"?r[n]=ut(a,o):r[n]=n in t?a:o}return r};var fr=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 B(t,e=0,r){let n,o,a,s,i,p,m=0,ie=!1,l=!1,j=!0,se=!e&&e!==0&&typeof window.requestAnimationFrame=="function";r&&(ie=!!r.leading,l="maxWait"in r,a=r?.maxWait?Math.max(+r?.maxWait||0,e):a,j="trailing"in r?!!r.trailing:j);function z(u){let T=n,g=o;return n=o=void 0,m=u,s=t.apply(g,T),s}function k(u,T){return se?(i&&window.cancelAnimationFrame(i),window.requestAnimationFrame(u)):setTimeout(u,T)}function ke(u){if(se){window.cancelAnimationFrame(u);return}clearTimeout(u)}function Re(u){return m=u,i=k(R,e),ie?z(u):s}function Le(u){let T=u-p,g=u-m,le=e-T;return l?Math.min(le,a-g):le}function ae(u){let T=u-p,g=u-m;return p===void 0||T>=e||T<0||l&&g>=a}function R(){let u=Date.now();if(ae(u))return ce(u);i=k(R,Le(u))}function ce(u){return i=void 0,j&&n?z(u):(n=o=void 0,s)}function Ne(){i!==void 0&&ke(i),m=0,n=p=o=i=void 0}function Ce(){return i===void 0?s:ce(Date.now())}function Me(){return i!==void 0}function L(...u){let T=Date.now(),g=ae(T);if(n=u,o=this,p=T,g){if(i===void 0)return Re(p);if(l)return i=k(R,e),z(p)}return i===void 0&&(i=k(R,e)),s}return L.cancel=Ne,L.flush=Ce,L.pending=Me,L}var q=(t,e=0,r)=>B(t,e,{...{leading:!0,trailing:!0},...r,maxWait:e});var N=(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 o=e(t[n],n,t,r);if(o!==void 0){r[n]=o;continue}}typeof t[n]=="object"?r[n]=N(t[n],e):r[n]=t[n]}return r};var mt=t=>N(t);var bt=300,dt=(t,e=bt)=>new c(r=>{let{width:n,height:o}=t.getBoundingClientRect();if(r.next({width:n,height:o}),!window.ResizeObserver)return;let a=new ResizeObserver(q(s=>{let i=s[0];if(!i)return;let p,m;i.contentBoxSize&&i.contentBoxSize[0]?(m=i.contentBoxSize[0].blockSize,p=i.contentBoxSize[0].inlineSize):i.contentRect&&(p=i.contentRect.width,m=i.contentRect.height),O(p)&&O(m)&&r.next({width:p,height:m})},e));return a.observe(t),()=>a.disconnect()});var C=(t,e=6,r=".")=>{let n={};for(let o in t)if(!(!t.hasOwnProperty(o)||t[o]instanceof HTMLElement||!e))if(typeof t[o]=="object"&&t[o]!==null){let a=C(t[o],e-1);for(let s in a)a.hasOwnProperty(s)&&(n[o+r+s]=a[s])}else n[o]=t[o];return n};var ft=t=>{t.removeAttribute("src"),t.load()};var Pr=t=>{let e;try{e=new URL(t)}catch{return!1}return e.protocol==="https:"};var Tt=(t,e)=>!(t.right<e.left||t.left>e.right||t.bottom<e.top||t.top>e.bottom);var yt=(()=>{let t=0;return()=>{let e=t;return t=(t+1)%Number.MAX_SAFE_INTEGER,e}})(),It=t=>t!==void 0&&t!==""?t:yt().toString();function ht(t,e,r){if(t<=e[0])return r[0];if(t>=e[e.length-1])return r[r.length-1];let n=1;for(;n<e.length&&e[n]<t;)n++;n>=e.length&&(n=e.length-1);let o=e[n-1],a=e[n],s=r[n-1],i=r[n];if(t===o)return s;if(t===a)return i;let p=(t-o)/(a-o);return s+p*(i-s)}function gt(t,e,r){if(t<=0||r<0)return[];let n=[],o=Math.floor((t-1)/2),a=Math.floor(t/2),s=e-o,i=e+a;s<0&&(i+=Math.abs(s),s=0),i>r&&(s-=i-r,i=r),s=Math.max(0,s),i=Math.min(r,i);for(let p=s;p<=i;p++)n.push(p);return n}var vt=t=>e=>r=>{let n=typeof r=="object";r==null||n&&!Object.keys(r).length||t(e,n?C(r):{value:r})},M=(t={})=>{let e=n=>{let o=n;return n===void 0?o="undefined":n===null?o="null":(typeof n=="number"||typeof n=="boolean")&&(o=n.toString()),o},r={};for(let n in t)Array.isArray(t[n])?r[n]=t[n].map(e):r[n]=e(t[n]);return r};var h=class t{constructor({name:e,getParentContext:r}){this.dynamicImportTimeout=5e3;this.childTracers=[];t.dynamicImportStatus==="not_started"&&(t.dynamicImportPromise=this.loadOpentelemetry());let n=Date.now();this.initPromise=t.dynamicImportPromise.then(o=>{t.dynamicImportStatus==="completed"&&this.init({name:e,getParentContext:r},n)})}static{this.dynamicImportStatus="not_started"}init({name:e,getParentContext:r},n){this.span=t.rootTracer.startSpan(e,{startTime:n},r?.()),this.context=t.dynamicImports.opentelemetryApi.trace.setSpan(t.dynamicImports.opentelemetryApi.context.active(),this.span)}async loadOpentelemetry(){if(t.dynamicImportStatus==="not_started"){t.dynamicImportStatus="in_progress";try{let e=new Promise((s,i)=>setTimeout(i,this.dynamicImportTimeout)),r=Promise.all([import("@opentelemetry/api"),import("@opentelemetry/sdk-trace-web"),import("@apptracer/opentelemetry")]),[n,o,a]=await Promise.race([r,e]);t.dynamicImports={opentelemetryApi:n,opentelemetrySdk:o,tracer:a},t.dynamicImportStatus="completed"}catch{t.dynamicImportStatus="failed"}}}isComponentTracerNotInitialized(){return A(this.span)||t.dynamicImportStatus==="failed"}log(e,r){let n=Date.now();this.initPromise.then(o=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...M(r),type:"log"},n)})}error(e,r){let n=Date.now();this.initPromise.then(o=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...M(r),type:"error"},n)})}critical(e,r){let n=Date.now();this.initPromise.then(o=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...M(r),type:"critical"},n)})}createComponentTracer(e){let r=new t({name:e,getParentContext:()=>this.context});return this.childTracers.push(r),r}end(){this.initPromise.then(e=>{this.isComponentTracerNotInitialized()||(this.childTracers.forEach(r=>r.end()),this.span.end())})}};var V=class extends h{constructor(){super({name:"Root"})}init({name:e,getParentContext:r},n){let a=h.dynamicImports.tracer.initTracerOpenTelemetry({serviceName:"videoplayer-sdk-web",appToken:"L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb",spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0}}).getProvider(),s=new h.dynamicImports.tracer.TracerMemorySpanExporter;this.spanExporter=s,a.addSpanProcessor(new h.dynamicImports.tracer.TracerAllSpansProcessor({startedSpansExporter:s})),h.rootTracer=a.getTracer("sdk-videoplayer-tracer"),super.init({name:e,getParentContext:r},n)}getFinishedSpans(){if(!this.isComponentTracerNotInitialized())return this.spanExporter?.getJsonData()}getTraceId(){return this.isComponentTracerNotInitialized()?"":this.span.spanContext().traceId}};var Q=class t{constructor(e){}log(e,r){}error(e,r){}critical(e,r){}createComponentTracer(e){return new t({name:e})}end(){}getFinishedSpans(){}getTraceId(){return this.fakeTraceId}};var $=class{static createRootTracer(e=!1){return e?new V:new Q}};var S=class extends y{constructor(r){super();this.buffer=[];this.cursorEnd=-1;this.cursorStart=0;this.bufferSize=r,this.buffer=Array(r)}next(r){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=r,this.subscribers.forEach(n=>n.next(r))}_subscribe(r){for(let o=this.cursorStart;o<=this.cursorEnd;o++)r.next(this.buffer[o%this.bufferSize]);let n=this.keyCounter++;return this.subscribers.set(n,r),new b().add(()=>this.subscribers.delete(n))}};var _=class extends y{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 be(t){return new c(e=>{let r={},n=Object.keys(t).length,o=a=>s=>{a in r||n--,r[a]=s,n===0&&e.next(r)};return Object.entries(t).reduce((a,[s,i])=>a.add(i.subscribe(o(s))),new b)})}function de(...t){return new c(e=>t.reduce((r,n)=>r.add(n.subscribe(e)),new b))}var xt=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 Ot=t=>new c(e=>{let r=window.setInterval(()=>e.next(),t);return()=>{r&&(window.clearInterval(r),r=void 0)}});var wt=t=>new c(e=>{t.forEach(r=>e.next(r))});var Et=(t,e)=>new c(r=>{let n=o=>r.next(o);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});var D=class extends b{remove(e){this.subscriptions=this.subscriptions.filter(r=>r!==e)}};function fe(t){return e=>new c(r=>e.subscribe(new X(r,t)))}var X=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 St={leading:!1,trailing:!0};function Te(t,e=St){return r=>new c(n=>r.subscribe(new Y(n,t,e)))}var Y=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,O(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(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 At={leading:!0,trailing:!1};function ye(t,e=At){return r=>new c(n=>r.subscribe(new J(n,t,e)))}var J=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}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 Ie(t){return e=>new c(r=>e.subscribe(new Z(r,t)))}var Z=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 Pt=(t,e)=>{let r=(n,o)=>{let a=Object.keys(n);for(let s in o)if(!a.includes(s)||o[s]!==n[s])return!1;return!0};return r(t,e)&&r(e,t)},kt=(t,e)=>t instanceof Object&&e instanceof Object?Pt(t,e):t===e;function ge(t=kt){return e=>new c(r=>e.subscribe(new ee(r,t)))}var he={},ee=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=he}next(e){let r;try{r=this.lastValue===he||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?{...e}:e}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function U(t){return e=>new c(r=>e.subscribe(new te(r,t)))}var te=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 ve(t){return U(()=>t)}function xe(){return t=>new c(e=>{let r=!1,n=!1,o=t.subscribe(a=>{r||(r=!0,e.next(a)),n&&o.unsubscribe()},a=>{r=!0,e.error?.(a),n&&o.unsubscribe()});return n=!0,r&&o.unsubscribe(),o})}function Oe(){return t=>new c(e=>t.subscribe(new re(e)))}var re=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 we(t){return e=>new c(r=>e.subscribe(new ne(r,t)))}var ne=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 Ee(t){return e=>new c(r=>e.subscribe(new oe(r,t)))}var oe=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)}};function Se(t=0){return e=>{let r=0,n=new S(t),o=e.subscribe(n),a=s=>()=>{s.unsubscribe(),r--,r===0&&o.unsubscribe()};return new c(s=>(r++,a(n.subscribe(s))))}}var Rt=(i=>(i.NETWORK="network",i.VIDEO_PIPELINE="video_pipeline",i.EXTERNAL_API="external_api",i.PARSER="parser",i.DOM="dom",i.WTF="wtf",i.FATAL="fatal",i))(Rt||{});var Lt=(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))(Lt||{}),Nt="vk.com",li=async(t,e,r)=>{let n=new URL(`https://${Nt}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),t!==void 0&&n.searchParams.set("lang",t);let a=await(await fetch(n.toString())).json();return Ct(a,r)},Ct=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,n])=>[r.substring(`${e}_`.length),Mt(n)])),Mt=t=>Array.isArray(t)?t[0]:t;var Vt=(r=>(r.RU="ru",r.EN="en",r))(Vt||{});var d="__vk_vp_internals_exposure",Ae=class{constructor(e,r){this.playerId=r,this.type=e,this.initWindowObjects()}getWindowObject(){if(typeof window>"u")return{};let e=this.playerId,r=this.type;return window[d]?.[e]?.[r]??{}}initWindowObjects(){if(typeof window>"u")return;let e=this.playerId,r=this.type;window[d]||(window[d]={}),window[d][e]||(window[d][e]={}),window[d][e][r]||(window[d][e][r]={})}expose(e){typeof window>"u"||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>"u")return;let e=this.playerId,r=this.type;window[d]&&window[d][e]&&window[d][e][r]&&(delete window[d][e][r],Object.keys(window[d][e]).length||delete window[d][e],Object.keys(window[d]).length||delete window[d])}};var Pe={};pe(Pe,{create:()=>Qt,destroy:()=>_t,push:()=>Dt,subscribe:()=>Ut});var P=new Map,Qt=(t,e)=>P.set(t,e??[]),_t=t=>P.delete(t),Dt=(t,e)=>{let r=P.get(t);r&&(typeof r=="function"?r(e):r.push(e))},Ut=(t,e)=>{let r=P.get(t);if(r){if(r&&Array.isArray(r))for(let n of r)e(n);P.set(t,e)}};export{Rt as ErrorCategory,d as INTERNAL_EXPOSE_GLOBAL_KEY,Vt as InterfaceLanguage,Ae as InternalsExposure,F as Logger,c as Observable,S as ReplaySubject,y as Subject,b as Subscription,D as SubscriptionRemovable,$ as TracerFactory,Qe as VERSION,Lt as VKNumericLanguage,_ as ValueSubject,G as VideoQuality,He as abortable,Ge as addScript,ct as areQualitiesExact,We as assertEmptyArray,I as assertNever,je as assertNonNullable,Fe as assertNotEmptyArray,ze as assertNullable,lt as assertQualityIsExact,fe as buffer,_e as checkNever,ft as clearVideoElement,mt as cloneDeep,N as cloneDeepWith,be as combine,Te as debounce,B as debounceFn,et as detectEmbed,Pe as devNull,ut as fillWithDefault,Ie as filter,ge as filterChanged,C as flattenObject,Et as fromEvent,Be as getExponentialDelay,ot as getHighestQuality,It as getPlayerId,gt as getRangeAroundIndex,vt as getTraceSubscriptionMethod,pt as getVideoQualityLabel,ht as interpolate,Ot as interval,tt as isHigher,rt as isHigherOrEqual,Tt as isIntersecting,H as isInvariantQuality,K as isLower,nt as isLowerOrEqual,O as isNonNullable,A as isNullable,Pr as isValidURL,li as loadVKLangPack,U as map,ve as mapTo,de as merge,x as noop,Ke as now,wt as observableFrom,dt as observeElementSize,xe as once,Oe as pairwise,ue as safeStorage,Se as shareReplay,Ee as skip,we as tap,ye as throttle,q as throttleFn,fr as timeCodeToString,xt as timeout,it as videoHeightToQuality,at as videoQualityToHeight,st as videoSizeToQuality};
|
|
6
|
+
var Ve=Object.defineProperty;var pe=(t,e)=>{for(var r in e)Ve(t,r,{get:e[r],enumerable:!0})};var Qe="1.0.78-dev.0c91b20c.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 I=t=>{throw new Error(`${t} is value of unexpected type`)},_e=t=>{};var x=()=>{};var De=t=>{throw console.error(t),t},Ue=t=>{console.error(t)},c=class{constructor(e){this.suppressErrors=!1;e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,r){let n=this.suppressErrors?Ue:De,o;r?typeof r=="function"?o={next:r,error:x}:o={next:i=>r.next(i),error:i=>r.error?.(i)}:o={next:n,error:x};let a=typeof e=="function"?{next:i=>{try{let p=e(i);p instanceof Promise&&p.catch(m=>o.next(m))}catch(p){o.next(p)}},error:i=>o.next(i)}:{next:i=>e.next(i),error:i=>e.error?e.error(i):o.next(i)},s;try{s=this._subscribe(a)}catch(i){a.error?.(i)}return new b().add(()=>{switch(a.next=x,a.error=x,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return I(s)}})}pipe(...e){return e.reduce((r,n)=>n(r),this)}_subscribe(e){}};var y=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 F=class{constructor(){this.log$=new y;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}))}};function je(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function ze(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function O(t){return typeof t<"u"&&t!==null}function A(t){return t==null}function Fe(t,e){if(!t?.length)throw new Error(e)}function We(t,e){if(t?.length)throw new Error(e)}var Ge=(t,e,r)=>new Promise((n,o)=>{e.addEventListener("abort",()=>{i(),m.remove()});let a=()=>{i(),o("error")},s=()=>{i(),n()},i=()=>{p&&clearTimeout(p),m.removeEventListener("load",s),m.removeEventListener("error",a)},p;r&&(p=window.setTimeout(()=>{i(),o("timeout")},r));let m=document.createElement("script");m.addEventListener("load",s),m.addEventListener("error",a),m.src=t,document.head.appendChild(m)});var Ke=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now();var He=(t,e)=>async(...r)=>{let n=e(...r),o=t.aborted,a;for(;!o&&!t.aborted;)try{let s=await n.next(a);o=s.done??!1,a=s.value}catch(s){await n.throw(s)}return a};var Be=(t,{start:e=0,factor:r=2,max:n=1/0,min:o=e,random:a=0}={})=>{let s=e;return s*=r**t,s*=1+(Math.random()*a*2-a),s=Math.round(s),s=Math.min(s,n),s=Math.max(s,o),s};var ue={};pe(ue,{clear:()=>Ze,get:()=>$e,has:()=>Ye,isPersistent:()=>qe,remove:()=>Je,set:()=>Xe});var w,g,W=`vk-videoplayer-dummy-key-${Math.random()}`,E=()=>{if(g!==void 0)return g;try{localStorage.setItem(W,"test"),localStorage.removeItem(W),g=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(W),g=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)g=2;else throw e}else throw t}return g===2&&(w=new Map),g},qe=()=>E()===0,$e=t=>{let e=E();switch(e){case 0:return localStorage.getItem(t)??void 0;case 1:return sessionStorage.getItem(t)??void 0;case 2:return w?.get(t);default:I(e)}},Xe=(t,e)=>{let r=E();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:w?.set(t,e);return;default:I(r)}},Ye=t=>{let e=E();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return w?.has(t)??!1;default:return I(e),!1}},Je=t=>{let e=E();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:w?.delete(t);return;default:I(e)}},Ze=()=>{let t=E();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return w?.clear();default:I(t)}};var et=()=>{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 e=e.filter(r=>URL.canParse(r)),{isEmbed:t,origins:e,topOrigin:e.at(-1),immediateOrigin:e.at(0)}};var G=(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))(G||{});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}},tt=(t,e)=>f[t].height>f[e].height,rt=(t,e)=>f[t].height>=f[e].height,K=(t,e)=>f[t].height<f[e].height,nt=(t,e)=>f[t].height<=f[e].height,ot=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:K(e,r)?1:-1)[0],me=Object.keys(f).sort((t,e)=>K(t,e)?-1:1),it=(t,e=.02)=>[...me].find(n=>f[n].height*(1+e)>=t),st=({width:t,height:e})=>{let r=Math.min(t,e),n=Math.max(t,e);return me.find(o=>{let a=f[o];return a.width>=n&&a.height>=r})},at=t=>f[t].height,H=t=>t==="Invariant quality",ct=t=>t.every(e=>!H(e));function lt(t){if(H(t))throw new Error("Expected exact quality")}var pt=t=>{switch(t){case"4320p":return"8K";case"2160p":return"4K";case"1440p":return"QHD";case"1080p":return"FHD";case"720p":return"HD";default:return""}};var ut=(t,e)=>{let r={};for(let n of Object.keys(e)){let o=e[n],a=t[n];Array.isArray(o)&&Array.isArray(a)?r[n]=a:typeof o=="object"&&typeof a=="object"?r[n]=ut(a,o):r[n]=n in t?a:o}return r};var fr=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 B(t,e=0,r){let n,o,a,s,i,p,m=0,ie=!1,l=!1,j=!0,se=!e&&e!==0&&typeof window.requestAnimationFrame=="function";r&&(ie=!!r.leading,l="maxWait"in r,a=r?.maxWait?Math.max(+r?.maxWait||0,e):a,j="trailing"in r?!!r.trailing:j);function z(u){let T=n,v=o;return n=o=void 0,m=u,s=t.apply(v,T),s}function k(u,T){return se?(i&&window.cancelAnimationFrame(i),window.requestAnimationFrame(u)):setTimeout(u,T)}function ke(u){if(se){window.cancelAnimationFrame(u);return}clearTimeout(u)}function Re(u){return m=u,i=k(R,e),ie?z(u):s}function Le(u){let T=u-p,v=u-m,le=e-T;return l?Math.min(le,a-v):le}function ae(u){let T=u-p,v=u-m;return p===void 0||T>=e||T<0||l&&v>=a}function R(){let u=Date.now();if(ae(u))return ce(u);i=k(R,Le(u))}function ce(u){return i=void 0,j&&n?z(u):(n=o=void 0,s)}function Ne(){i!==void 0&&ke(i),m=0,n=p=o=i=void 0}function Ce(){return i===void 0?s:ce(Date.now())}function Me(){return i!==void 0}function L(...u){let T=Date.now(),v=ae(T);if(n=u,o=this,p=T,v){if(i===void 0)return Re(p);if(l)return i=k(R,e),z(p)}return i===void 0&&(i=k(R,e)),s}return L.cancel=Ne,L.flush=Ce,L.pending=Me,L}var q=(t,e=0,r)=>B(t,e,{...{leading:!0,trailing:!0},...r,maxWait:e});var N=(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 o=e(t[n],n,t,r);if(o!==void 0){r[n]=o;continue}}typeof t[n]=="object"?r[n]=N(t[n],e):r[n]=t[n]}return r};var mt=t=>N(t);var bt=300,dt=(t,e=bt)=>new c(r=>{let{width:n,height:o}=t.getBoundingClientRect();if(r.next({width:n,height:o}),!window.ResizeObserver)return;let a=new ResizeObserver(q(s=>{let i=s[0];if(!i)return;let p,m;i.contentBoxSize&&i.contentBoxSize[0]?(m=i.contentBoxSize[0].blockSize,p=i.contentBoxSize[0].inlineSize):i.contentRect&&(p=i.contentRect.width,m=i.contentRect.height),O(p)&&O(m)&&r.next({width:p,height:m})},e));return a.observe(t),()=>a.disconnect()});var C=(t,e=6,r=".")=>{let n={};for(let o in t)if(!(!t.hasOwnProperty(o)||t[o]instanceof HTMLElement||!e))if(typeof t[o]=="object"&&t[o]!==null){let a=C(t[o],e-1);for(let s in a)a.hasOwnProperty(s)&&(n[o+r+s]=a[s])}else n[o]=t[o];return n};var ft=t=>{t.removeAttribute("src"),t.load()};var Pr=t=>{let e;try{e=new URL(t)}catch{return!1}return e.protocol==="https:"};var Tt=(t,e)=>!(t.right<e.left||t.left>e.right||t.bottom<e.top||t.top>e.bottom);var yt=(()=>{let t=0;return()=>{let e=t;return t=(t+1)%Number.MAX_SAFE_INTEGER,e}})(),It=t=>t!==void 0&&t!==""?t:yt().toString();function ht(t,e,r){if(t<=e[0])return r[0];if(t>=e[e.length-1])return r[r.length-1];let n=1;for(;n<e.length&&e[n]<t;)n++;n>=e.length&&(n=e.length-1);let o=e[n-1],a=e[n],s=r[n-1],i=r[n];if(t===o)return s;if(t===a)return i;let p=(t-o)/(a-o);return s+p*(i-s)}function vt(t,e,r){if(t<=0||r<0)return[];let n=[],o=Math.floor((t-1)/2),a=Math.floor(t/2),s=e-o,i=e+a;s<0&&(i+=Math.abs(s),s=0),i>r&&(s-=i-r,i=r),s=Math.max(0,s),i=Math.min(r,i);for(let p=s;p<=i;p++)n.push(p);return n}var gt=t=>e=>r=>{let n=typeof r=="object";r==null||n&&!Object.keys(r).length||t(e,n?C(r):{value:r})},M=(t={})=>{let e=n=>{let o=n;return n===void 0?o="undefined":n===null?o="null":(typeof n=="number"||typeof n=="boolean")&&(o=n.toString()),o},r={};for(let n in t)Array.isArray(t[n])?r[n]=t[n].map(e):r[n]=e(t[n]);return r};var h=class t{constructor({name:e,getParentContext:r}){this.dynamicImportTimeout=5e3;this.childTracers=[];t.dynamicImportStatus==="not_started"&&(t.dynamicImportPromise=this.loadOpentelemetry());let n=Date.now();this.initPromise=t.dynamicImportPromise.then(o=>{t.dynamicImportStatus==="completed"&&this.init({name:e,getParentContext:r},n)})}static{this.dynamicImportStatus="not_started"}init({name:e,getParentContext:r},n){this.span=t.rootTracer.startSpan(e,{startTime:n},r?.()),this.context=t.dynamicImports.opentelemetryApi.trace.setSpan(t.dynamicImports.opentelemetryApi.context.active(),this.span)}async loadOpentelemetry(){if(t.dynamicImportStatus==="not_started"){t.dynamicImportStatus="in_progress";try{let e=new Promise((s,i)=>setTimeout(i,this.dynamicImportTimeout)),r=Promise.all([import("@opentelemetry/api"),import("@opentelemetry/sdk-trace-web"),import("@apptracer/opentelemetry")]),[n,o,a]=await Promise.race([r,e]);t.dynamicImports={opentelemetryApi:n,opentelemetrySdk:o,tracer:a},t.dynamicImportStatus="completed"}catch{t.dynamicImportStatus="failed"}}}isComponentTracerNotInitialized(){return A(this.span)||t.dynamicImportStatus==="failed"}log(e,r){let n=Date.now();this.initPromise.then(o=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...M(r),type:"log"},n)})}error(e,r){let n=Date.now();this.initPromise.then(o=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...M(r),type:"error"},n)})}critical(e,r){let n=Date.now();this.initPromise.then(o=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...M(r),type:"critical"},n)})}createComponentTracer(e){let r=new t({name:e,getParentContext:()=>this.context});return this.childTracers.push(r),r}end(){this.initPromise.then(e=>{this.isComponentTracerNotInitialized()||(this.childTracers.forEach(r=>r.end()),this.span.end())})}};var V=class extends h{constructor(){super({name:"Root"})}init({name:e,getParentContext:r},n){let a=h.dynamicImports.tracer.initTracerOpenTelemetry({serviceName:"videoplayer-sdk-web",appToken:"L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb",spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0}}).getProvider(),s=new h.dynamicImports.tracer.TracerMemorySpanExporter;this.spanExporter=s,a.addSpanProcessor(new h.dynamicImports.tracer.TracerAllSpansProcessor({startedSpansExporter:s})),h.rootTracer=a.getTracer("sdk-videoplayer-tracer"),super.init({name:e,getParentContext:r},n)}getFinishedSpans(){if(!this.isComponentTracerNotInitialized())return this.spanExporter?.getJsonData()}getTraceId(){return this.isComponentTracerNotInitialized()?"":this.span.spanContext().traceId}};var Q=class t{constructor(e){}log(e,r){}error(e,r){}critical(e,r){}createComponentTracer(e){return new t({name:e})}end(){}getFinishedSpans(){}getTraceId(){return this.fakeTraceId}};var $=class{static createRootTracer(e=!1){return e?new V:new Q}};var S=class extends y{constructor(r){super();this.buffer=[];this.cursorEnd=-1;this.cursorStart=0;this.bufferSize=r,this.buffer=Array(r)}next(r){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=r,this.subscribers.forEach(n=>n.next(r))}_subscribe(r){for(let o=this.cursorStart;o<=this.cursorEnd;o++)r.next(this.buffer[o%this.bufferSize]);let n=this.keyCounter++;return this.subscribers.set(n,r),new b().add(()=>this.subscribers.delete(n))}};var _=class extends y{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 be(t){return new c(e=>{let r={},n=Object.keys(t).length,o=a=>s=>{a in r||n--,r[a]=s,n===0&&e.next(r)};return Object.entries(t).reduce((a,[s,i])=>a.add(i.subscribe(o(s))),new b)})}function de(...t){return new c(e=>t.reduce((r,n)=>r.add(n.subscribe(e)),new b))}var xt=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 Ot=t=>new c(e=>{let r=window.setInterval(()=>e.next(),t);return()=>{r&&(window.clearInterval(r),r=void 0)}});var wt=t=>new c(e=>{t.forEach(r=>e.next(r))});var Et=(t,e)=>new c(r=>{let n=o=>r.next(o);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});var D=class extends b{remove(e){this.subscriptions=this.subscriptions.filter(r=>r!==e)}};function fe(t){return e=>new c(r=>e.subscribe(new X(r,t)))}var X=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 St={leading:!1,trailing:!0};function Te(t,e=St){return r=>new c(n=>r.subscribe(new Y(n,t,e)))}var Y=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,O(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(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 At={leading:!0,trailing:!1};function ye(t,e=At){return r=>new c(n=>r.subscribe(new J(n,t,e)))}var J=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}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 Ie(t){return e=>new c(r=>e.subscribe(new Z(r,t)))}var Z=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 Pt=(t,e)=>{let r=(n,o)=>{let a=Object.keys(n);for(let s in o)if(!a.includes(s)||o[s]!==n[s])return!1;return!0};return r(t,e)&&r(e,t)},kt=(t,e)=>t instanceof Object&&e instanceof Object?Pt(t,e):t===e;function ve(t=kt){return e=>new c(r=>e.subscribe(new ee(r,t)))}var he={},ee=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=he}next(e){let r;try{r=this.lastValue===he||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?{...e}:e}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function U(t){return e=>new c(r=>e.subscribe(new te(r,t)))}var te=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 ge(t){return U(()=>t)}function xe(){return t=>new c(e=>{let r=!1,n=!1,o=t.subscribe(a=>{r||(r=!0,e.next(a)),n&&o.unsubscribe()},a=>{r=!0,e.error?.(a),n&&o.unsubscribe()});return n=!0,r&&o.unsubscribe(),o})}function Oe(){return t=>new c(e=>t.subscribe(new re(e)))}var re=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 we(t){return e=>new c(r=>e.subscribe(new ne(r,t)))}var ne=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 Ee(t){return e=>new c(r=>e.subscribe(new oe(r,t)))}var oe=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)}};function Se(t=0){return e=>{let r=0,n=new S(t),o=e.subscribe(n),a=s=>()=>{s.unsubscribe(),r--,r===0&&o.unsubscribe()};return new c(s=>(r++,a(n.subscribe(s))))}}var Rt=(i=>(i.NETWORK="network",i.VIDEO_PIPELINE="video_pipeline",i.EXTERNAL_API="external_api",i.PARSER="parser",i.DOM="dom",i.WTF="wtf",i.FATAL="fatal",i))(Rt||{});var Lt=(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))(Lt||{}),Nt="vk.com",li=async(t,e,r)=>{let n=new URL(`https://${Nt}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),t!==void 0&&n.searchParams.set("lang",t);let a=await(await fetch(n.toString())).json();return Ct(a,r)},Ct=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,n])=>[r.substring(`${e}_`.length),Mt(n)])),Mt=t=>Array.isArray(t)?t[0]:t;var Vt=(r=>(r.RU="ru",r.EN="en",r))(Vt||{});var d="__vk_vp_internals_exposure",Ae=class{constructor(e,r){this.playerId=r,this.type=e,this.initWindowObjects()}getWindowObject(){if(typeof window>"u")return{};let e=this.playerId,r=this.type;return window[d]?.[e]?.[r]??{}}initWindowObjects(){if(typeof window>"u")return;let e=this.playerId,r=this.type;window[d]||(window[d]={}),window[d][e]||(window[d][e]={}),window[d][e][r]||(window[d][e][r]={})}expose(e){typeof window>"u"||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>"u")return;let e=this.playerId,r=this.type;window[d]&&window[d][e]&&window[d][e][r]&&(delete window[d][e][r],Object.keys(window[d][e]).length||delete window[d][e],Object.keys(window[d]).length||delete window[d])}};var Pe={};pe(Pe,{create:()=>Qt,destroy:()=>_t,push:()=>Dt,subscribe:()=>Ut});var P=new Map,Qt=(t,e)=>P.set(t,e??[]),_t=t=>P.delete(t),Dt=(t,e)=>{let r=P.get(t);r&&(typeof r=="function"?r(e):r.push(e))},Ut=(t,e)=>{let r=P.get(t);if(r){if(r&&Array.isArray(r))for(let n of r)e(n);P.set(t,e)}};export{Rt as ErrorCategory,d as INTERNAL_EXPOSE_GLOBAL_KEY,Vt as InterfaceLanguage,Ae as InternalsExposure,F as Logger,c as Observable,S as ReplaySubject,y as Subject,b as Subscription,D as SubscriptionRemovable,$ as TracerFactory,Qe as VERSION,Lt as VKNumericLanguage,_ as ValueSubject,G as VideoQuality,He as abortable,Ge as addScript,ct as areQualitiesExact,We as assertEmptyArray,I as assertNever,je as assertNonNullable,Fe as assertNotEmptyArray,ze as assertNullable,lt as assertQualityIsExact,fe as buffer,_e as checkNever,ft as clearVideoElement,mt as cloneDeep,N as cloneDeepWith,be as combine,Te as debounce,B as debounceFn,et as detectEmbed,Pe as devNull,ut as fillWithDefault,Ie as filter,ve as filterChanged,C as flattenObject,Et as fromEvent,Be as getExponentialDelay,ot as getHighestQuality,It as getPlayerId,vt as getRangeAroundIndex,gt as getTraceSubscriptionMethod,pt as getVideoQualityLabel,ht as interpolate,Ot as interval,tt as isHigher,rt as isHigherOrEqual,Tt as isIntersecting,H as isInvariantQuality,K as isLower,nt as isLowerOrEqual,O as isNonNullable,A as isNullable,Pr as isValidURL,li as loadVKLangPack,U as map,ge as mapTo,de as merge,x as noop,Ke as now,wt as observableFrom,dt as observeElementSize,xe as once,Oe as pairwise,ue as safeStorage,Se as shareReplay,Ee as skip,we as tap,ye as throttle,q as throttleFn,fr as timeCodeToString,xt as timeout,it as videoHeightToQuality,at as videoQualityToHeight,st as videoSizeToQuality};
|