@vkontakte/videoplayer-shared 1.0.86-dev.fcdd1bac.0 → 1.0.87-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es2015.cjs +6 -0
- package/es2015.esm.js +6 -0
- package/esnext.cjs +6 -0
- package/esnext.esm.js +6 -0
- package/evergreen.esm.js +6 -0
- package/package.json +17 -6
- package/types/AppTracer/AppTracer.d.ts +25 -0
- package/types/AppTracer/constants.d.ts +1 -0
- package/types/AppTracer/index.d.ts +2 -0
- package/types/AppTracer/types.d.ts +19 -0
- package/types/AppTracer/utils.d.ts +5 -0
- package/types/InternalsExposure/index.d.ts +28 -0
- package/types/Logger/Logger.d.ts +10 -0
- package/types/Logger/index.d.ts +2 -0
- package/types/Logger/types.d.ts +29 -0
- package/types/Tracer/FakeTracer.d.ts +13 -0
- package/types/Tracer/RootTracer.d.ts +10 -0
- package/types/Tracer/Tracer.d.ts +25 -0
- package/types/Tracer/TracerFactory.d.ts +4 -0
- package/types/Tracer/index.d.ts +3 -0
- package/types/Tracer/types.d.ts +39 -0
- package/types/Tracer/utils.d.ts +3 -0
- package/types/__polyfills/array.d.ts +10 -0
- package/types/__polyfills/global.d.ts +1 -0
- package/types/__polyfills/index.es2015.d.ts +10 -0
- package/types/__polyfills/index.esnext.d.ts +3 -0
- package/types/__polyfills/index.evergreen.d.ts +1 -0
- package/types/__polyfills/object.d.ts +4 -0
- package/types/__polyfills/promise.d.ts +32 -0
- package/types/__polyfills/runtime/abortableFetch.d.ts +4 -0
- package/types/__polyfills/runtime/at.d.ts +1 -0
- package/types/__polyfills/runtime/idleCallback.d.ts +3 -0
- package/types/__polyfills/runtime/includes.d.ts +1 -0
- package/types/__polyfills/runtime/url.canParse.d.ts +3 -0
- package/types/__polyfills/runtime/window.d.ts +1 -0
- package/types/__polyfills/string.d.ts +9 -0
- package/types/devNull.d.ts +14 -0
- package/types/env.d.ts +1 -0
- package/types/index.d.ts +13 -0
- package/types/reactive/Observable.d.ts +14 -0
- package/types/reactive/ReplaySubject.d.ts +12 -0
- package/types/reactive/Subject.d.ts +10 -0
- package/types/reactive/Subscription.d.ts +6 -0
- package/types/reactive/SubscriptionRemovable.d.ts +5 -0
- package/types/reactive/ValueSubject.d.ts +10 -0
- package/types/reactive/combine.d.ts +7 -0
- package/types/reactive/fromEvent.d.ts +7 -0
- package/types/reactive/index.d.ts +25 -0
- package/types/reactive/interval.d.ts +4 -0
- package/types/reactive/merge.d.ts +82 -0
- package/types/reactive/observableFrom.d.ts +3 -0
- package/types/reactive/operators/buffer.d.ts +2 -0
- package/types/reactive/operators/debounce.d.ts +7 -0
- package/types/reactive/operators/filter.d.ts +6 -0
- package/types/reactive/operators/filterChanged.d.ts +5 -0
- package/types/reactive/operators/map.d.ts +5 -0
- package/types/reactive/operators/mapTo.d.ts +5 -0
- package/types/reactive/operators/once.d.ts +5 -0
- package/types/reactive/operators/pairwise.d.ts +3 -0
- package/types/reactive/operators/shareReplay.d.ts +2 -0
- package/types/reactive/operators/skip.d.ts +6 -0
- package/types/reactive/operators/tap.d.ts +2 -0
- package/types/reactive/operators/throttle.d.ts +6 -0
- package/types/reactive/timeout.d.ts +4 -0
- package/types/reactive/types.d.ts +53 -0
- package/types/translation/index.d.ts +2 -0
- package/types/translation/loadVKLangPack.d.ts +16 -0
- package/types/translation/types.d.ts +5 -0
- package/types/types/index.d.ts +71 -0
- package/types/utils/abortable.d.ts +6 -0
- package/types/utils/addScript.d.ts +1 -0
- package/types/utils/browser.d.ts +2 -0
- package/types/utils/clearVideoElement.d.ts +1 -0
- package/types/utils/cloneDeep.d.ts +1 -0
- package/types/utils/cloneDeepWith.d.ts +3 -0
- package/types/utils/config.d.ts +2 -0
- package/types/utils/debounceFn.d.ts +13 -0
- package/types/utils/detectEmbed.d.ts +8 -0
- package/types/utils/empty.d.ts +2 -0
- package/types/utils/exponentialBackoff.d.ts +9 -0
- package/types/utils/flattenObject.d.ts +9 -0
- package/types/utils/getPlayerId.d.ts +1 -0
- package/types/utils/getRangeAroundIndex.d.ts +7 -0
- package/types/utils/iframeSafeStorage.d.ts +6 -0
- package/types/utils/index.d.ts +34 -0
- package/types/utils/interpolate.d.ts +12 -0
- package/types/utils/isIntersecting.d.ts +6 -0
- package/types/utils/isValidURL.d.ts +1 -0
- package/types/utils/never.d.ts +2 -0
- package/types/utils/noop.d.ts +1 -0
- package/types/utils/now.d.ts +4 -0
- package/types/utils/nullable.d.ts +8 -0
- package/types/utils/observeElementSize.d.ts +4 -0
- package/types/utils/quality/index.d.ts +21 -0
- package/types/utils/quality/types.d.ts +22 -0
- package/types/utils/semanticTypes.d.ts +7 -0
- package/types/utils/suppressAbort.d.ts +2 -0
- package/types/utils/throttleFn.d.ts +6 -0
- package/types/utils/timecode.d.ts +1 -0
package/es2015.cjs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.87-beta.0
|
|
3
|
+
* Thu, 02 Apr 2026 11:34:58 GMT
|
|
4
|
+
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-87/doc/
|
|
5
|
+
*/
|
|
6
|
+
var e=require(`@oxc-project/runtime/helpers/defineProperty`),t=require(`@oxc-project/runtime/helpers/objectSpread2`),n=require(`@oxc-project/runtime/helpers/asyncToGenerator`),r=Object.defineProperty,i=Object.getOwnPropertyNames,a=Object.getOwnPropertyDescriptor,o=Object.prototype.hasOwnProperty;function s(e){return this[e]}var c=e=>{var t=(l??=new WeakMap).get(e),n;if(t)return t;if(t=r({},`__esModule`,{value:!0}),e&&typeof e==`object`||typeof e==`function`)for(var c of i(e))o.call(t,c)||r(t,c,{get:s.bind(e,c),enumerable:!(n=a(e,c))||n.enumerable});return l.set(e,t),t},l,u=e=>e;function d(e,t){this[e]=u.bind(null,t)}var f=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0,configurable:!0,set:d.bind(t,n)})},p={};f(p,{withoutNullable:()=>ne,videoSizeToQuality:()=>Ce,videoQualityToHeight:()=>we,videoHeightToQuality:()=>Se,urlCanParsePolyfilled:()=>Rn,timeout:()=>Ne,timeCodeToString:()=>Oe,throttleFn:()=>z,throttle:()=>We,tap:()=>at,suppressAbort:()=>bt,stringTrimStart:()=>Q,stringTrimRight:()=>An,stringTrimLeft:()=>kn,stringTrimEnd:()=>On,stringReplaceAll:()=>Dn,stringPadStart:()=>En,stringPadEnd:()=>Tn,stringMatchAll:()=>wn,stringAt:()=>Cn,skip:()=>st,shareReplay:()=>lt,safeStorage:()=>ue,requestIdleCallbackPolyfilled:()=>Fn,promiseWithResolvers:()=>un,promiseTry:()=>ln,promiseFinally:()=>cn,promiseAny:()=>sn,promiseAllSettled:()=>on,pairwise:()=>rt,once:()=>nt,observeElementSize:()=>dt,observableFrom:()=>Fe,objectValues:()=>an,objectHasOwn:()=>rn,objectFromEntries:()=>tn,objectEntries:()=>en,nowInt:()=>se,now:()=>oe,noop:()=>v,merge:()=>Me,mapTo:()=>tt,map:()=>$e,loadVKLangPack:()=>Ot,isValidURL:()=>pt,isNullable:()=>T,isNonNullable:()=>w,isLowerOrEqual:()=>be,isLower:()=>P,isInvariantQuality:()=>I,isIntersecting:()=>mt,isHigherOrEqual:()=>ye,isHigher:()=>ve,isBrowserWindow:()=>D,isAbortError:()=>yt,interval:()=>Pe,interpolate:()=>_t,includesPolyfilled:()=>Ln,globalThisPolyfill:()=>$t,getWindow:()=>E,getVideoQualityLabel:()=>De,getTraceSubscriptionMethod:()=>xt,getRangeAroundIndex:()=>vt,getPlayerId:()=>gt,getHighestQuality:()=>xe,getExponentialDelay:()=>le,fromEvent:()=>Ie,flattenObject:()=>H,filterChanged:()=>Xe,filter:()=>Ke,fillWithDefault:()=>L,fetchPolyfilled:()=>yn,devNull:()=>Nt,detectEmbed:()=>_e,debounceFn:()=>R,debounce:()=>Ve,combine:()=>je,cloneDeepWith:()=>B,cloneDeep:()=>ke,clearVideoElement:()=>ft,checkNever:()=>_,cancelIdleCallbackPolyfilled:()=>In,buffer:()=>Re,atPolyfilled:()=>jn,assertQualityIsExact:()=>Ee,assertNullable:()=>C,assertNotEmptyArray:()=>re,assertNonNullable:()=>te,assertNever:()=>g,assertEmptyArray:()=>ie,arrayWith:()=>Qt,arrayToSpliced:()=>Zt,arrayToSorted:()=>Xt,arrayToReversed:()=>Yt,arrayIncludes:()=>Jt,arrayFlatMap:()=>qt,arrayFlat:()=>Kt,arrayFindLastIndex:()=>Gt,arrayFindLast:()=>Wt,arrayAt:()=>Ut,areQualitiesExact:()=>Te,addScript:()=>ae,abortable:()=>ce,VideoQuality:()=>M,ValueSubject:()=>Ae,VKNumericLanguage:()=>Et,VERSION:()=>m,TracerFactory:()=>wt,SubscriptionRemovable:()=>Le,Subscription:()=>h,Subject:()=>S,RequestPolyfilled:()=>bn,ReplaySubject:()=>V,Observable:()=>x,Logger:()=>ee,InternalsExposure:()=>Mt,InterfaceLanguage:()=>jt,INTERNAL_EXPOSE_GLOBAL_KEY:()=>G,ErrorCategory:()=>Tt,AppTracer:()=>q,AbortSignalPolyfilled:()=>Sn,AbortControllerPolyfilled:()=>xn}),module.exports=c(p);var m=`1.0.87-beta.0`;class h{constructor(){e(this,`subscriptions`,[])}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(e=>{typeof e==`function`?e():e.unsubscribe()})}add(e){return this.subscriptions.push(e),this}}var g=e=>{throw Error(`${e} is value of unexpected type`)},_=e=>{},v=()=>{},y=e=>{throw console.error(e),e},b=e=>{console.error(e)};class x{constructor(t){e(this,`suppressErrors`,!1),t&&(this._subscribe=t)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?b:y,r;r=t?typeof t==`function`?{next:t,error:v}:{next:e=>t.next(e),error:e=>t.error?.call(t,e)}:{next:n,error:v};let i=typeof e==`function`?{next:t=>{try{let n=e(t);n instanceof Promise&&n.catch(e=>r.next(e))}catch(e){r.next(e)}},error:e=>r.next(e)}:{next:t=>e.next(t),error:t=>e.error?e.error(t):r.next(t)},a;try{a=this._subscribe(i)}catch(e){i.error?.call(i,e)}return new h().add(()=>{switch(i.next=v,i.error=v,typeof a){case`function`:a();return;case`object`:a.unsubscribe();return;case`undefined`:return;default:return g(a)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class S extends x{constructor(){super(),e(this,`keyCounter`,0),e(this,`subscribers`,new Map)}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>t.error?.call(t,e))}_subscribe(e){let t=this.keyCounter++;return this.subscribers.set(t,e),new h().add(()=>this.subscribers.delete(t))}}class ee{constructor(){e(this,`log$`,new S),e(this,`logs`,[]),e(this,`log`,e=>{let n=t(t({},e),{},{timestamp:Date.now()});this.logs.push(n),this.log$.next(n)}),e(this,`getAllLogs`,()=>this.logs)}createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch{n={message:"error in `createCustomLog`",component:`Logger`}}this.log(n)}}createComponentLog(e){return this.createCustomLog(n=>t({component:e},n))}}function te(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function C(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function w(e){return e!=null}function T(e){return e==null}var ne=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>w(t)));function re(e,t){if(!e?.length)throw Error(t)}function ie(e,t){if(e?.length)throw Error(t)}var E=()=>globalThis,D=(e=E())=>!!(e.window&&e.screen),ae=(e,t,n)=>new Promise((r,i)=>{t.addEventListener(`abort`,()=>{s(),l.remove()});let a=()=>{s(),i(`error`)},o=()=>{s(),r()},s=()=>{c&&clearTimeout(c),l.removeEventListener(`load`,o),l.removeEventListener(`error`,a)},c;n&&(c=E().setTimeout(()=>{s(),i(`timeout`)},n));let l=document.createElement(`script`);l.addEventListener(`load`,o),l.addEventListener(`error`,a),l.src=e,document.head.appendChild(l)}),oe=typeof E().performance?.now==`function`?()=>E().performance.now():()=>Date.now(),se=()=>Math.trunc(oe()),ce=(e,t)=>n(function*(...n){let r=t(...n),i=e.aborted,a;for(;!i&&!e.aborted;)try{let e=yield r.next(a);i=e.done??!1,a=e.value}catch(e){yield r.throw(e)}return a}),le=(e,{start:t=0,factor:n=2,max:r=1/0,min:i=t,random:a=0}={})=>{let o=t;return o*=n**+e,o*=1+(Math.random()*a*2-a),o=Math.round(o),o=Math.min(o,r),o=Math.max(o,i),o},ue={};f(ue,{set:()=>pe,remove:()=>he,isPersistent:()=>de,has:()=>me,get:()=>fe,clear:()=>ge});var O,k,A=`vk-videoplayer-dummy-key-${Math.random()}`,j=()=>{if(k!==void 0)return k;try{localStorage.setItem(A,`test`),localStorage.removeItem(A),k=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(A),k=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)k=2;else throw e}else throw e}return k===2&&(O=new Map),k},de=()=>j()===0,fe=e=>{let t=j();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return O?.get(e);default:g(t)}},pe=(e,t)=>{let n=j();switch(n){case 0:try{localStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 1:try{sessionStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 2:O?.set(e,t);return;default:g(n)}},me=e=>{let t=j();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return O?.has(e)??!1;default:return g(t),!1}},he=e=>{let t=j();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:O?.delete(e);return;default:g(t)}},ge=()=>{let e=j();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return O?.clear();default:g(e)}},_e=()=>{let e,t=[],n=E();try{e=n.self!==n.top}catch(t){t instanceof DOMException&&t.name===`SecurityError`?e=!0:(e=!1,console.error(t))}try{n.location?.ancestorOrigins&&(t=[...n.location.ancestorOrigins])}catch(e){console.error(e)}try{!t.length&&n.document.referrer&&(t=[new URL(n.document.referrer).origin])}catch(e){console.error(e)}return t=t.filter(e=>URL.canParse(e)),{isEmbed:e,origins:t,topOrigin:t.at(-1),immediateOrigin:t.at(0)}},M;(e=>{e.INVARIANT=`Invariant quality`,e.Q_144P=`144p`,e.Q_240P=`240p`,e.Q_360P=`360p`,e.Q_480P=`480p`,e.Q_576P=`576p`,e.Q_720P=`720p`,e.Q_1080P=`1080p`,e.Q_1440P=`1440p`,e.Q_2160P=`2160p`,e.Q_4320P=`4320p`})(M||={});var N={"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}},ve=(e,t)=>N[e].height>N[t].height,ye=(e,t)=>N[e].height>=N[t].height,P=(e,t)=>N[e].height<N[t].height,be=(e,t)=>N[e].height<=N[t].height,xe=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:P(e,t)?1:-1)[0],F=Object.keys(N).sort((e,t)=>P(e,t)?-1:1),Se=(e,t=.02)=>[...F].find(n=>N[n].height*(1+t)>=e),Ce=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return F.find(e=>{let t=N[e];return t.width>=r&&t.height>=n})},we=e=>N[e].height,I=e=>e===`Invariant quality`,Te=e=>e.every(e=>!I(e));function Ee(e){if(I(e))throw Error(`Expected exact quality`)}var De=e=>{switch(e){case`4320p`:return`8K`;case`2160p`:return`4K`;case`1440p`:return`QHD`;case`1080p`:return`FHD`;case`720p`:return`HD`;default:return``}},L=(e,t)=>{let n={};for(let r of Object.keys(t)){let i=t[r],a=e[r];Array.isArray(i)?n[r]=Array.isArray(a)?a:i:typeof i==`object`&&i?typeof a==`object`&&a&&!Array.isArray(a)?n[r]=L(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},Oe=e=>{let t=``;return e>=3600&&(t+=Math.floor(e/3600)+`h`,e%=3600),e>=60&&(t+=Math.floor(e/60)+`m`,e%=60),e>0&&(t+=Math.floor(e)+`s`),t};function R(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof E().requestAnimationFrame==`function`;n&&(u=!!n.leading,d=`maxWait`in n,a=n?.maxWait?Math.max(+n?.maxWait||0,t):a,f=`trailing`in n?!!n.trailing:f);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(s&&E().cancelAnimationFrame(s),E().requestAnimationFrame(e)):setTimeout(e,t)}function g(e){if(p){E().cancelAnimationFrame(e);return}clearTimeout(e)}function _(e){return l=e,s=h(b,t),u?m(e):o}function v(e){let n=e-c,r=e-l,i=t-n;return d?Math.min(i,a-r):i}function y(e){let n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function b(){let e=Date.now();if(y(e))return x(e);s=h(b,v(e))}function x(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function S(){s!==void 0&&g(s),l=0,r=c=i=s=void 0}function ee(){return s===void 0?o:x(Date.now())}function te(){return s!==void 0}function C(...e){let n=Date.now(),a=y(n);if(r=e,i=this,c=n,a){if(s===void 0)return _(c);if(d)return s=h(b,t),m(c)}return s===void 0&&(s=h(b,t)),o}return C.cancel=S,C.flush=ee,C.pending=te,C}var z=(e,n=0,r)=>R(e,n,t(t(t({},{leading:!0,trailing:!0}),r),{},{maxWait:n})),B=(e,t)=>{if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let r in e){if(typeof t==`function`){let i=t(e[r],r,e,n);if(i!==void 0){n[r]=i;continue}}typeof e[r]==`object`?n[r]=B(e[r],t):n[r]=e[r]}return n},ke=e=>B(e);class V extends S{constructor(t){super(),e(this,`bufferSize`,void 0),e(this,`buffer`,[]),e(this,`cursorEnd`,-1),e(this,`cursorStart`,0),this.bufferSize=t,this.buffer=Array(t)}next(e){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=e,this.subscribers.forEach(t=>t.next(e))}_subscribe(e){for(let t=this.cursorStart;t<=this.cursorEnd;t++)e.next(this.buffer[t%this.bufferSize]);let t=this.keyCounter++;return this.subscribers.set(t,e),new h().add(()=>this.subscribers.delete(t))}}class Ae extends S{constructor(t){super(),e(this,`value`,void 0),this.value=t}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let t=super._subscribe(e);return e.next(this.value),t}}function je(e){return new x(t=>{let n={},r=Object.keys(e).length,i=e=>i=>{e in n||r--,n[e]=i,r===0&&t.next(n)};return Object.entries(e).reduce((e,[t,n])=>e.add(n.subscribe(i(t))),new h)})}function Me(...e){return new x(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new h))}var Ne=e=>new x(t=>{let n=E().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>E().clearTimeout(n)}),Pe=e=>new x(t=>{let n=E(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}}),Fe=e=>new x(t=>{e.forEach(e=>t.next(e))}),Ie=(e,t)=>new x(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Le extends h{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Re(e){return t=>new x(n=>t.subscribe(new ze(n,e)))}class ze{constructor(t,n){e(this,`destination`,void 0),e(this,`size`,void 0),e(this,`lastValues`,[]),this.destination=t,this.size=n}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var t;(t=this.destination).error?.call(t,e)}}var Be={leading:!1,trailing:!0};function Ve(e,t=Be){return n=>new x(r=>n.subscribe(new He(r,e,t)))}class He{constructor(t,n,r){e(this,`destination`,void 0),e(this,`time`,void 0),e(this,`config`,void 0),e(this,`lastValue`,void 0),e(this,`timeout`,void 0),this.destination=t,this.time=n,this.config=r}next(e){this.lastValue=e;let t=E();w(this.timeout)?t.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=t.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(e){if(this.destination.error)this.destination.error(e);else throw e}this.timeout=void 0},this.time)}error(e){var t;(t=this.destination).error?.call(t,e)}}var Ue={leading:!0,trailing:!1};function We(e,t=Ue){return n=>new x(r=>n.subscribe(new Ge(r,e,t)))}class Ge{constructor(t,n,r){e(this,`destination`,void 0),e(this,`time`,void 0),e(this,`config`,void 0),e(this,`lastValue`,void 0),e(this,`timeout`,void 0),this.destination=t,this.time=n,this.config=r}next(e){this.lastValue=e,T(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=E().setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){var t;(t=this.destination).error?.call(t,e)}}function Ke(e){return t=>new x(n=>t.subscribe(new qe(n,e)))}class qe{constructor(t,n){e(this,`destination`,void 0),e(this,`predicate`,void 0),this.destination=t,this.predicate=n}next(e){let t;try{t=this.predicate(e)}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){var t;(t=this.destination).error?.call(t,e)}}var Je=(e,t)=>{let n=(e,t)=>{let n=Object.keys(e);for(let r in t)if(!n.includes(r)||t[r]!==e[r])return!1;return!0};return n(e,t)&&n(t,e)},Ye=(e,t)=>e instanceof Object&&t instanceof Object?Je(e,t):e===t;function Xe(e=Ye){return t=>new x(n=>t.subscribe(new Qe(n,e)))}var Ze={};class Qe{constructor(t,n){e(this,`destination`,void 0),e(this,`predicate`,void 0),e(this,`lastValue`,Ze),this.destination=t,this.predicate=n}next(e){let n;try{n=this.lastValue===Ze||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?t({},e):e}catch(e){throw this.error(e),e}n&&this.destination.next(e)}error(e){var t;(t=this.destination).error?.call(t,e)}}function $e(e){return t=>new x(n=>t.subscribe(new et(n,e)))}class et{constructor(t,n){e(this,`destination`,void 0),e(this,`mapper`,void 0),this.destination=t,this.mapper=n}next(e){let t;try{t=this.mapper(e)}catch(e){throw this.error(e),e}this.destination.next(t)}error(e){var t;(t=this.destination).error?.call(t,e)}}function tt(e){return $e(()=>e)}function nt(){return e=>new x(t=>{let n=!1,r=!1,i=e.subscribe(e=>{n||(n=!0,t.next(e)),r&&i.unsubscribe()},e=>{n=!0,t.error?.call(t,e),r&&i.unsubscribe()});return r=!0,n&&i.unsubscribe(),i})}function rt(){return e=>new x(t=>e.subscribe(new it(t)))}class it{constructor(t){e(this,`destination`,void 0),e(this,`last`,void 0),e(this,`hasLast`,!1),this.destination=t}next(e){let t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){var t;(t=this.destination).error?.call(t,e)}}function at(e){return t=>new x(n=>t.subscribe(new ot(n,e)))}class ot{constructor(t,n){e(this,`destination`,void 0),e(this,`effect`,void 0),this.destination=t,this.effect=n}next(e){try{this.effect(e)}catch(e){throw this.error(e),e}this.destination.next(e)}error(e){var t;(t=this.destination).error?.call(t,e)}}function st(e){return t=>new x(n=>t.subscribe(new ct(n,e)))}class ct{constructor(t,n){if(e(this,`destination`,void 0),e(this,`count`,void 0),this.destination=t,this.count=n,n<0){var r;(r=this.destination).error?.call(r,Error(`Count can not be less than zero`))}}next(e){this.count===0?this.destination.next(e):this.count--}error(e){var t;(t=this.destination).error?.call(t,e)}}function lt(e=0){return t=>{let n=0,r=new V(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new x(e=>(n++,a(r.subscribe(e))))}}var ut=300,dt=(e,t=ut)=>new x(n=>{let r=E(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!D(r))return;let o=new r.ResizeObserver(z(e=>{let t=e[0];if(!t)return;let r,i;t.contentBoxSize&&t.contentBoxSize[0]?(i=t.contentBoxSize[0].blockSize,r=t.contentBoxSize[0].inlineSize):t.contentRect&&(r=t.contentRect.width,i=t.contentRect.height),w(r)&&w(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),H=(e,t=6,n=`.`)=>{let r={};for(let i in e)if(!(!e.hasOwnProperty(i)||e[i]instanceof HTMLElement||!t))if(typeof e[i]==`object`&&e[i]!==null){let a=H(e[i],t-1);for(let e in a)a.hasOwnProperty(e)&&(r[i+n+e]=a[e])}else r[i]=e[i];return r},ft=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},pt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},mt=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),ht=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),gt=e=>e!==void 0&&e!==``?e:ht().toString();function _t(e,t,n){if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];let r=1;for(;r<t.length&&t[r]<e;)r++;r>=t.length&&(r=t.length-1);let i=t[r-1],a=t[r],o=n[r-1],s=n[r];return e===i?o:e===a?s:o+(e-i)/(a-i)*(s-o)}function vt(e,t,n){if(e<=0||n<0)return[];let r=[],i=Math.floor((e-1)/2),a=Math.floor(e/2),o=t-i,s=t+a;o<0&&(s+=Math.abs(o),o=0),s>n&&(o-=s-n,s=n),o=Math.max(0,o),s=Math.min(n,s);for(let e=o;e<=s;e++)r.push(e);return r}var yt=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),bt=e=>{if(!yt(e))throw e},xt=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?H(n):{value:n})},U=(e={})=>{let t=e=>{let t=e;return e===void 0?t=`undefined`:e===null?t=`null`:(typeof e==`number`||typeof e==`boolean`)&&(t=e.toString()),t},n={};for(let r in e)Array.isArray(e[r])?n[r]=e[r].map(t):n[r]=t(e[r]);return n};class W{constructor({name:t,getParentContext:n}){e(this,`dynamicImportTimeout`,5e3),e(this,`span`,void 0),e(this,`context`,void 0),e(this,`childTracers`,[]),e(this,`initPromise`,void 0),W.dynamicImportStatus===`not_started`&&(W.dynamicImportPromise=this.loadOpentelemetry());let r=Date.now();this.initPromise=W.dynamicImportPromise.then(e=>{W.dynamicImportStatus===`completed`&&this.init({name:t,getParentContext:n},r)})}init({name:e,getParentContext:t},n){this.span=W.rootTracer.startSpan(e,{startTime:n},t?.()),this.context=W.dynamicImports.opentelemetryApi.trace.setSpan(W.dynamicImports.opentelemetryApi.context.active(),this.span)}loadOpentelemetry(){var e=this;return n(function*(){if(W.dynamicImportStatus===`not_started`){W.dynamicImportStatus=`in_progress`;try{let t=new Promise((t,n)=>setTimeout(n,e.dynamicImportTimeout)),n=Promise.all([import(`@opentelemetry/api`),import(`@opentelemetry/sdk-trace-web`),import(`@apptracer/opentelemetry`)]),[r,i,a]=yield Promise.race([n,t]);W.dynamicImports={opentelemetryApi:r,opentelemetrySdk:i,tracer:a},W.dynamicImportStatus=`completed`}catch{W.dynamicImportStatus=`failed`}}})()}isComponentTracerNotInitialized(){return T(this.span)||W.dynamicImportStatus===`failed`}log(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},U(n)),{},{type:`log`}),r)})}error(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},U(n)),{},{type:`error`}),r)})}critical(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},U(n)),{},{type:`critical`}),r)})}createComponentTracer(e){let t=new W({name:e,getParentContext:()=>this.context});return this.childTracers.push(t),t}end(){this.initPromise.then(e=>{this.isComponentTracerNotInitialized()||(this.childTracers.forEach(e=>e.end()),this.span.end())})}}e(W,`rootTracer`,void 0),e(W,`dynamicImportStatus`,`not_started`),e(W,`dynamicImports`,void 0),e(W,`dynamicImportPromise`,void 0);class St extends W{constructor(){super({name:`Root`}),e(this,`spanExporter`,void 0)}init({name:e,getParentContext:t},n){let r=W.dynamicImports.tracer.initTracerOpenTelemetry({serviceName:`videoplayer-sdk-web`,appToken:`L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb`,spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0}}).getProvider(),i=new W.dynamicImports.tracer.TracerMemorySpanExporter;this.spanExporter=i,r.addSpanProcessor(new W.dynamicImports.tracer.TracerAllSpansProcessor({startedSpansExporter:i})),W.rootTracer=r.getTracer(`sdk-videoplayer-tracer`),super.init({name:e,getParentContext:t},n)}getFinishedSpans(){if(!this.isComponentTracerNotInitialized())return this.spanExporter?.getJsonData()}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}}class Ct{constructor(t){e(this,`fakeTraceId`,void 0)}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new Ct({name:e})}end(){}getFinishedSpans(){}getTraceId(){return this.fakeTraceId}}class wt{static createRootTracer(e=!1){return e?new St:new Ct}}var Tt;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.FATAL=`fatal`})(Tt||={});var Et;(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`})(Et||={});var Dt=`vk.com`,Ot=function(){var e=n(function*(e,t,n){let r=new URL(`https://${Dt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),kt(yield(yield fetch(r.toString())).json(),n)});return function(t,n,r){return e.apply(this,arguments)}}(),kt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),At(n)])),At=e=>Array.isArray(e)?e[0]:e,jt;(e=>{e.RU=`ru`,e.EN=`en`})(jt||={});var G=`__vk_vp_internals_exposure`;class Mt{constructor(t,n){e(this,`playerId`,void 0),e(this,`type`,void 0),this.playerId=n,this.type=t,this.initWindowObjects()}getWindowObject(){var e;if(typeof window>`u`)return{};let t=this.playerId,n=this.type;return((e=window[G])==null||(e=e[t])==null?void 0:e[n])??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[G]||(window[G]={}),window[G][e]||(window[G][e]={}),window[G][e][t]||(window[G][e][t]={})}expose(e){typeof window>`u`||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[G]&&window[G][e]&&window[G][e][t]&&(delete window[G][e][t],Object.keys(window[G][e]).length||delete window[G][e],Object.keys(window[G]).length||delete window[G])}}var Nt={};f(Nt,{subscribe:()=>Lt,push:()=>It,destroy:()=>Ft,create:()=>Pt});var K=new Map,Pt=(e,t)=>K.set(e,t??[]),Ft=e=>K.delete(e),It=(e,t)=>{let n=K.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Lt=(e,t)=>{let n=K.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);K.set(e,t)}},Rt=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`,zt=e=>ne({id:e.id,message:e.message,category:e.category,data:Bt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Bt(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Vt=e=>{if(e.thrown instanceof Error)return e.thrown.name=e.id,e.thrown;let t=Error(e.message);return t.name=e.id,t},Ht=()=>{try{let{origin:e,pathname:n,search:r,hostname:i}=E().document.location;return i===`localhost`?void 0:t({url:e+n},new URLSearchParams(r).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{}))}catch(e){console.error(e)}};class q{constructor(t,n,r,i){e(this,`dynamicImportTimeout`,5e3),e(this,`componentName`,void 0),e(this,`subscription`,new h),e(this,`options`,void 0),e(this,`envParams`,void 0),e(this,`context`,void 0),this.componentName=t,this.options=n,this.envParams=r,this.context=i,this.options.enabled&&(this.loadModule(),this.init())}error(e,n){let{blackErrorCategoryList:r,blackErrorIdList:i,sampleRate:a,whiteErrorCategoryList:o,whiteErrorIdList:s}=this.options,{id:c,category:l}=e;r.length&&r.includes(l)||i.length&&i.includes(c)||o.length&&!o.includes(l)||s.length&&!s.includes(c)||Math.random()>=a||q.tracerErrorMap.get(this.componentName)?.error(Vt(e),{severity:n?.severity??(e.traceAsLog?`debug`:void 0),keys:t(t(t({},this.context),zt(e)),Ht())})}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}init(){var e=this;return n(function*(){try{if(yield q.loadPromise,q.tracerErrorMap.has(e.componentName)||T(q.appTracerModule))return;let{appTracerModule:t}=q,{initTracerError:n,initTracerErrorUploader:r,addTracerPlugin:i,getTracerModules:a}=t,o=a(e.componentName),s=!o.error,c=o.error??n(e.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});s&&r(e.componentName,{appToken:Rt,environment:e.envParams.env,versionCode:1,versionName:e.envParams.version}),i(e.componentName,{name:`addedCategory`,errorBeforeAdd(e){let t=e.keys?.category??`wtf`;if(typeof t==`string`)return{issueKey:t}}}),q.tracerErrorMap.set(e.componentName,c)}catch{}})()}loadModule(){var e=this;w(q.loadPromise)||(q.loadPromise=function(){var t=n(function*(){try{let t=new Promise((t,n)=>E().setTimeout(n,e.dynamicImportTimeout));q.appTracerModule=yield Promise.race([t,import(`@apptracer/sdk/lite`)])}catch{q.loadPromise=null}});return function(){return t.apply(this,arguments)}}()())}}e(q,`tracerErrorMap`,new Map),e(q,`appTracerModule`,null),e(q,`loadPromise`,null);var Ut=(e,t)=>{let n=e.length,r=t>=0?t:n+t;return r>=0&&r<n?e[r]:void 0},Wt=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}},Gt=(e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n],n,e))return n;return-1},Kt=(e,t=1)=>{let n=[],r=(e,t)=>{for(let i=0;i<e.length;i++){if(!(i in e))continue;let a=e[i];t>0&&Array.isArray(a)?r(a,t-1):n.push(a)}};return r(e,t),n},qt=(e,t)=>{let n=[];for(let r=0;r<e.length;r++){let i=t(e[r],r,e);if(Array.isArray(i))for(let e=0;e<i.length;e++)n.push(i[e]);else n.push(i)}return n},Jt=(e,t,n=0)=>{let r=e.length,i=n>=0?n:Math.max(r+n,0);for(;i<r;i++){let n=e[i];if(n===t||n!==n&&t!==t)return!0}return!1},Yt=e=>{let t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=e[t-1-r];return n},Xt=(e,t)=>{let n=e.slice();return t?n.sort(t):n.sort()},Zt=(e,t,n,...r)=>{let i=e.slice();return n===void 0?i.splice(t):i.splice(t,n,...r),i},Qt=(e,t,n)=>{let r=e.length,i=t>=0?t:r+t,a=e.slice();return a[i]=n,a},$t=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:Function(`return this`)(),en=e=>{let t=[],n=Object.keys(e);for(let r=0;r<n.length;r++){let i=n[r];t.push([i,e[i]])}return t},tn=e=>{let t={};for(let[n,r]of e)t[n]=r;return t},nn=Object.prototype.hasOwnProperty,rn=(e,t)=>nn.call(e,t),an=e=>{let t=Object.keys(e),n=Array(t.length);for(let r=0;r<t.length;r++)n[r]=e[t[r]];return n},on=e=>{let t=Array.from(e);return t.length===0?Promise.resolve([]):Promise.all(t.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))},sn=e=>{let t=Array.from(e);return t.length===0?Promise.reject(AggregateError([],`All promises were rejected`)):new Promise((e,n)=>{let r=Array(t.length),i=t.length;t.forEach((t,a)=>{Promise.resolve(t).then(e,e=>{r[a]=e,--i,i===0&&n(AggregateError(r,`All promises were rejected`))})})})},cn=(e,t)=>e.then(e=>Promise.resolve(t()).then(()=>e),e=>Promise.resolve(t()).then(()=>{throw e})),ln=e=>{try{return Promise.resolve(e())}catch(e){return Promise.reject(e)}},un=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},{NativeAbortSignal:dn,NativeAbortController:fn}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function pn(e){let t;try{t=new Event(`abort`)}catch{typeof document<`u`?document.createEvent?(t=document.createEvent(`Event`),t.initEvent(`abort`,!1,!1)):(t=document.createEventObject(),t.type=`abort`):t={type:`abort`,bubbles:!1,cancelable:!1}}return t.reason=e,t}function mn(e){if(e===void 0)if(typeof document>`u`)e=Error(`This operation was aborted`),e.name=`AbortError`;else try{e=new DOMException(`signal is aborted without reason`),Object.defineProperty(e,`name`,{value:`AbortError`})}catch{e=Error(`This operation was aborted`),e.name=`AbortError`}return e}class hn{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;let n=this.listeners[e];for(let e=0,r=n.length;e<r;e++)if(n[e].callback===t){n.splice(e,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let t=this.listeners[e.type].slice();for(let n=0,r=t.length;n<r;n++){let r=t[n];try{r.callback.call(this,e)}catch(e){Promise.resolve().then(()=>{throw e})}r.options&&r.options.once&&this.removeEventListener(e.type,r.callback)}return!e.defaultPrevented}}class J extends hn{constructor(){super(),this.listeners||hn.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)}throwIfAborted(){let{aborted:e,reason:t=`Aborted`}=this;if(e)throw t}static timeout(e){let t=new Y;return setTimeout(()=>t.abort(new DOMException(`This signal is timeout in ${e}ms`,`TimeoutError`)),e),t.signal}static any(e){let t=new Y;function n(){t.abort(this.reason),r()}function r(){for(let t of e)t.removeEventListener(`abort`,n)}for(let r of e)if(r.aborted){t.abort(r.reason);break}else r.addEventListener(`abort`,n);return t.signal}}class Y{constructor(){Object.defineProperty(this,`signal`,{value:new J,writable:!0,configurable:!0})}abort(e){let t=mn(e),n=pn(t);this.signal.reason=t,this.signal.dispatchEvent(n)}toString(){return`[object AbortController]`}}typeof Symbol<`u`&&Symbol.toStringTag&&(Y.prototype[Symbol.toStringTag]=`AbortController`,J.prototype[Symbol.toStringTag]=`AbortSignal`);function gn(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 _n(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!gn({fetch:t,Request:n,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i}))return{fetch:t,Request:a};let a=n;(a&&!a.prototype.hasOwnProperty(`signal`)||i)&&(a=function(e,t){let r;t&&t.signal&&(r=t.signal,delete t.signal);let i=new n(e,t);return r&&Object.defineProperty(i,`signal`,{writable:!1,enumerable:!1,configurable:!0,value:r}),i},a.prototype=n.prototype);let o=t;return{fetch:(e,t)=>{let n=a&&a.prototype.isPrototypeOf(e)?e.signal:t?t.signal:void 0;if(n){let r;try{r=new DOMException(`Aborted`,`AbortError`)}catch{r=Error(`Aborted`),r.name=`AbortError`}if(n.aborted)return Promise.reject(r);let i=new Promise((e,t)=>{n.addEventListener(`abort`,()=>t(r),{once:!0})});return t&&t.signal&&delete t.signal,Promise.race([i,o(e,t)])}return o(e,t)},Request:a}}var X=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window,Z=`fetch`in X&&gn({fetch:X.fetch,Request:X.Request,AbortController:X.AbortController}),vn=Z?_n({fetch:X.fetch,Request:X.Request,AbortController:X.AbortController}):void 0,yn=Z?vn.fetch:X.fetch,bn=Z?vn.Request:X.Request,xn=Z?Y:X.AbortController,Sn=Z?J:X.AbortSignal,Cn=(e,t)=>{let n=e.length,r=t>=0?t:n+t;if(r<0||r>=n)return;let i=e.charCodeAt(r);if(i>=55296&&i<=56319&&r+1<n){let t=e.charCodeAt(r+1);if(t>=56320&&t<=57343)return e[r]+e[r+1]}return e[r]};function*wn(e,t){let n=t.flags.includes(`g`)?t.flags:t.flags+`g`,r=new RegExp(t.source,n),i;for(;(i=r.exec(e))!==null;)yield i,i[0].length===0&&r.lastIndex++}var Tn=(e,t,n=` `)=>{if(n===``||e.length>=t)return e;let r=t-e.length;return e+n.repeat(Math.ceil(r/n.length)).slice(0,r)},En=(e,t,n=` `)=>{if(n===``||e.length>=t)return e;let r=t-e.length;return n.repeat(Math.ceil(r/n.length)).slice(0,r)+e},Dn=(e,t,n)=>{if(typeof t==`string`){if(typeof n==`string`)return t===``?n+e.split(``).join(n)+n:e.split(t).join(n);let r=[],i=0,a=e.indexOf(t,i);for(;a!==-1;)r.push(e.slice(i,a)),r.push(n(t,a,e)),i=a+t.length,a=e.indexOf(t,i);return r.push(e.slice(i)),r.join(``)}let r=t.flags.includes(`g`)?t.flags:t.flags+`g`,i=new RegExp(t.source,r);return e.replace(i,n)},Q=e=>e.replace(/^\s+/,``),On=e=>e.replace(/\s+$/,``),kn=Q,An=On,jn=(e,t)=>typeof e==`string`?Cn(e,t):Ut(e,t),Mn=(e,t={})=>{let n=t.timeout||1,r=performance.now();return X.setTimeout(()=>{e({get didTimeout(){return t.timeout?!1:performance.now()-r-1>n},timeRemaining(){return Math.max(0,1+(performance.now()-r))}})},1)},Nn=e=>X.clearTimeout(e),Pn=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),$=!Pn(X.requestIdleCallback)||!Pn(X.cancelIdleCallback),Fn=$?Mn:X.requestIdleCallback,In=$?Nn:X.cancelIdleCallback,Ln=(e,t,n)=>typeof e==`string`?e.includes(t,n):Jt(e,t,n),Rn=(e,t,n)=>{if(typeof e.canParse==`function`)return e.canParse(t,n);try{return new e(t,n),!0}catch{return!1}};
|
package/es2015.esm.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.87-beta.0
|
|
3
|
+
* Thu, 02 Apr 2026 11:34:58 GMT
|
|
4
|
+
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-87/doc/
|
|
5
|
+
*/
|
|
6
|
+
import e from"@oxc-project/runtime/helpers/defineProperty";import t from"@oxc-project/runtime/helpers/objectSpread2";import n from"@oxc-project/runtime/helpers/asyncToGenerator";var r=Object.defineProperty,i=e=>e;function a(e,t){this[e]=i.bind(null,t)}var o=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0,configurable:!0,set:a.bind(t,n)})},s=`1.0.87-beta.0`;class c{constructor(){e(this,`subscriptions`,[])}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(e=>{typeof e==`function`?e():e.unsubscribe()})}add(e){return this.subscriptions.push(e),this}}var l=e=>{throw Error(`${e} is value of unexpected type`)},u=e=>{},d=()=>{},f=e=>{throw console.error(e),e},p=e=>{console.error(e)};class m{constructor(t){e(this,`suppressErrors`,!1),t&&(this._subscribe=t)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?p:f,r;r=t?typeof t==`function`?{next:t,error:d}:{next:e=>t.next(e),error:e=>t.error?.call(t,e)}:{next:n,error:d};let i=typeof e==`function`?{next:t=>{try{let n=e(t);n instanceof Promise&&n.catch(e=>r.next(e))}catch(e){r.next(e)}},error:e=>r.next(e)}:{next:t=>e.next(t),error:t=>e.error?e.error(t):r.next(t)},a;try{a=this._subscribe(i)}catch(e){i.error?.call(i,e)}return new c().add(()=>{switch(i.next=d,i.error=d,typeof a){case`function`:a();return;case`object`:a.unsubscribe();return;case`undefined`:return;default:return l(a)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class h extends m{constructor(){super(),e(this,`keyCounter`,0),e(this,`subscribers`,new Map)}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>t.error?.call(t,e))}_subscribe(e){let t=this.keyCounter++;return this.subscribers.set(t,e),new c().add(()=>this.subscribers.delete(t))}}class ee{constructor(){e(this,`log$`,new h),e(this,`logs`,[]),e(this,`log`,e=>{let n=t(t({},e),{},{timestamp:Date.now()});this.logs.push(n),this.log$.next(n)}),e(this,`getAllLogs`,()=>this.logs)}createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch{n={message:"error in `createCustomLog`",component:`Logger`}}this.log(n)}}createComponentLog(e){return this.createCustomLog(n=>t({component:e},n))}}function te(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function g(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function _(e){return e!=null}function v(e){return e==null}var y=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>_(t)));function ne(e,t){if(!e?.length)throw Error(t)}function re(e,t){if(e?.length)throw Error(t)}var b=()=>globalThis,x=(e=b())=>!!(e.window&&e.screen),S=(e,t,n)=>new Promise((r,i)=>{t.addEventListener(`abort`,()=>{s(),l.remove()});let a=()=>{s(),i(`error`)},o=()=>{s(),r()},s=()=>{c&&clearTimeout(c),l.removeEventListener(`load`,o),l.removeEventListener(`error`,a)},c;n&&(c=b().setTimeout(()=>{s(),i(`timeout`)},n));let l=document.createElement(`script`);l.addEventListener(`load`,o),l.addEventListener(`error`,a),l.src=e,document.head.appendChild(l)}),C=typeof b().performance?.now==`function`?()=>b().performance.now():()=>Date.now(),ie=()=>Math.trunc(C()),ae=(e,t)=>n(function*(...n){let r=t(...n),i=e.aborted,a;for(;!i&&!e.aborted;)try{let e=yield r.next(a);i=e.done??!1,a=e.value}catch(e){yield r.throw(e)}return a}),oe=(e,{start:t=0,factor:n=2,max:r=1/0,min:i=t,random:a=0}={})=>{let o=t;return o*=n**+e,o*=1+(Math.random()*a*2-a),o=Math.round(o),o=Math.min(o,r),o=Math.max(o,i),o},w={};o(w,{set:()=>le,remove:()=>de,isPersistent:()=>se,has:()=>ue,get:()=>ce,clear:()=>fe});var T,E,D=`vk-videoplayer-dummy-key-${Math.random()}`,O=()=>{if(E!==void 0)return E;try{localStorage.setItem(D,`test`),localStorage.removeItem(D),E=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(D),E=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)E=2;else throw e}else throw e}return E===2&&(T=new Map),E},se=()=>O()===0,ce=e=>{let t=O();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return T?.get(e);default:l(t)}},le=(e,t)=>{let n=O();switch(n){case 0:try{localStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 1:try{sessionStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 2:T?.set(e,t);return;default:l(n)}},ue=e=>{let t=O();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return T?.has(e)??!1;default:return l(t),!1}},de=e=>{let t=O();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:T?.delete(e);return;default:l(t)}},fe=()=>{let e=O();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return T?.clear();default:l(e)}},pe=()=>{let e,t=[],n=b();try{e=n.self!==n.top}catch(t){t instanceof DOMException&&t.name===`SecurityError`?e=!0:(e=!1,console.error(t))}try{n.location?.ancestorOrigins&&(t=[...n.location.ancestorOrigins])}catch(e){console.error(e)}try{!t.length&&n.document.referrer&&(t=[new URL(n.document.referrer).origin])}catch(e){console.error(e)}return t=t.filter(e=>URL.canParse(e)),{isEmbed:e,origins:t,topOrigin:t.at(-1),immediateOrigin:t.at(0)}},k;(e=>{e.INVARIANT=`Invariant quality`,e.Q_144P=`144p`,e.Q_240P=`240p`,e.Q_360P=`360p`,e.Q_480P=`480p`,e.Q_576P=`576p`,e.Q_720P=`720p`,e.Q_1080P=`1080p`,e.Q_1440P=`1440p`,e.Q_2160P=`2160p`,e.Q_4320P=`4320p`})(k||={});var A={"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}},me=(e,t)=>A[e].height>A[t].height,he=(e,t)=>A[e].height>=A[t].height,j=(e,t)=>A[e].height<A[t].height,ge=(e,t)=>A[e].height<=A[t].height,_e=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:j(e,t)?1:-1)[0],M=Object.keys(A).sort((e,t)=>j(e,t)?-1:1),ve=(e,t=.02)=>[...M].find(n=>A[n].height*(1+t)>=e),ye=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return M.find(e=>{let t=A[e];return t.width>=r&&t.height>=n})},be=e=>A[e].height,N=e=>e===`Invariant quality`,xe=e=>e.every(e=>!N(e));function Se(e){if(N(e))throw Error(`Expected exact quality`)}var Ce=e=>{switch(e){case`4320p`:return`8K`;case`2160p`:return`4K`;case`1440p`:return`QHD`;case`1080p`:return`FHD`;case`720p`:return`HD`;default:return``}},P=(e,t)=>{let n={};for(let r of Object.keys(t)){let i=t[r],a=e[r];Array.isArray(i)?n[r]=Array.isArray(a)?a:i:typeof i==`object`&&i?typeof a==`object`&&a&&!Array.isArray(a)?n[r]=P(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},we=e=>{let t=``;return e>=3600&&(t+=Math.floor(e/3600)+`h`,e%=3600),e>=60&&(t+=Math.floor(e/60)+`m`,e%=60),e>0&&(t+=Math.floor(e)+`s`),t};function F(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof b().requestAnimationFrame==`function`;n&&(u=!!n.leading,d=`maxWait`in n,a=n?.maxWait?Math.max(+n?.maxWait||0,t):a,f=`trailing`in n?!!n.trailing:f);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(s&&b().cancelAnimationFrame(s),b().requestAnimationFrame(e)):setTimeout(e,t)}function ee(e){if(p){b().cancelAnimationFrame(e);return}clearTimeout(e)}function te(e){return l=e,s=h(v,t),u?m(e):o}function g(e){let n=e-c,r=e-l,i=t-n;return d?Math.min(i,a-r):i}function _(e){let n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function v(){let e=Date.now();if(_(e))return y(e);s=h(v,g(e))}function y(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function ne(){s!==void 0&&ee(s),l=0,r=c=i=s=void 0}function re(){return s===void 0?o:y(Date.now())}function x(){return s!==void 0}function S(...e){let n=Date.now(),a=_(n);if(r=e,i=this,c=n,a){if(s===void 0)return te(c);if(d)return s=h(v,t),m(c)}return s===void 0&&(s=h(v,t)),o}return S.cancel=ne,S.flush=re,S.pending=x,S}var I=(e,n=0,r)=>F(e,n,t(t(t({},{leading:!0,trailing:!0}),r),{},{maxWait:n})),L=(e,t)=>{if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let r in e){if(typeof t==`function`){let i=t(e[r],r,e,n);if(i!==void 0){n[r]=i;continue}}typeof e[r]==`object`?n[r]=L(e[r],t):n[r]=e[r]}return n},Te=e=>L(e);class R extends h{constructor(t){super(),e(this,`bufferSize`,void 0),e(this,`buffer`,[]),e(this,`cursorEnd`,-1),e(this,`cursorStart`,0),this.bufferSize=t,this.buffer=Array(t)}next(e){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=e,this.subscribers.forEach(t=>t.next(e))}_subscribe(e){for(let t=this.cursorStart;t<=this.cursorEnd;t++)e.next(this.buffer[t%this.bufferSize]);let t=this.keyCounter++;return this.subscribers.set(t,e),new c().add(()=>this.subscribers.delete(t))}}class Ee extends h{constructor(t){super(),e(this,`value`,void 0),this.value=t}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let t=super._subscribe(e);return e.next(this.value),t}}function De(e){return new m(t=>{let n={},r=Object.keys(e).length,i=e=>i=>{e in n||r--,n[e]=i,r===0&&t.next(n)};return Object.entries(e).reduce((e,[t,n])=>e.add(n.subscribe(i(t))),new c)})}function Oe(...e){return new m(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new c))}var ke=e=>new m(t=>{let n=b().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>b().clearTimeout(n)}),Ae=e=>new m(t=>{let n=b(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}}),je=e=>new m(t=>{e.forEach(e=>t.next(e))}),Me=(e,t)=>new m(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Ne extends c{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Pe(e){return t=>new m(n=>t.subscribe(new Fe(n,e)))}class Fe{constructor(t,n){e(this,`destination`,void 0),e(this,`size`,void 0),e(this,`lastValues`,[]),this.destination=t,this.size=n}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var t;(t=this.destination).error?.call(t,e)}}var Ie={leading:!1,trailing:!0};function Le(e,t=Ie){return n=>new m(r=>n.subscribe(new Re(r,e,t)))}class Re{constructor(t,n,r){e(this,`destination`,void 0),e(this,`time`,void 0),e(this,`config`,void 0),e(this,`lastValue`,void 0),e(this,`timeout`,void 0),this.destination=t,this.time=n,this.config=r}next(e){this.lastValue=e;let t=b();_(this.timeout)?t.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=t.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(e){if(this.destination.error)this.destination.error(e);else throw e}this.timeout=void 0},this.time)}error(e){var t;(t=this.destination).error?.call(t,e)}}var ze={leading:!0,trailing:!1};function Be(e,t=ze){return n=>new m(r=>n.subscribe(new Ve(r,e,t)))}class Ve{constructor(t,n,r){e(this,`destination`,void 0),e(this,`time`,void 0),e(this,`config`,void 0),e(this,`lastValue`,void 0),e(this,`timeout`,void 0),this.destination=t,this.time=n,this.config=r}next(e){this.lastValue=e,v(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=b().setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){var t;(t=this.destination).error?.call(t,e)}}function He(e){return t=>new m(n=>t.subscribe(new Ue(n,e)))}class Ue{constructor(t,n){e(this,`destination`,void 0),e(this,`predicate`,void 0),this.destination=t,this.predicate=n}next(e){let t;try{t=this.predicate(e)}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){var t;(t=this.destination).error?.call(t,e)}}var We=(e,t)=>{let n=(e,t)=>{let n=Object.keys(e);for(let r in t)if(!n.includes(r)||t[r]!==e[r])return!1;return!0};return n(e,t)&&n(t,e)},Ge=(e,t)=>e instanceof Object&&t instanceof Object?We(e,t):e===t;function Ke(e=Ge){return t=>new m(n=>t.subscribe(new qe(n,e)))}var z={};class qe{constructor(t,n){e(this,`destination`,void 0),e(this,`predicate`,void 0),e(this,`lastValue`,z),this.destination=t,this.predicate=n}next(e){let n;try{n=this.lastValue===z||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?t({},e):e}catch(e){throw this.error(e),e}n&&this.destination.next(e)}error(e){var t;(t=this.destination).error?.call(t,e)}}function B(e){return t=>new m(n=>t.subscribe(new Je(n,e)))}class Je{constructor(t,n){e(this,`destination`,void 0),e(this,`mapper`,void 0),this.destination=t,this.mapper=n}next(e){let t;try{t=this.mapper(e)}catch(e){throw this.error(e),e}this.destination.next(t)}error(e){var t;(t=this.destination).error?.call(t,e)}}function Ye(e){return B(()=>e)}function Xe(){return e=>new m(t=>{let n=!1,r=!1,i=e.subscribe(e=>{n||(n=!0,t.next(e)),r&&i.unsubscribe()},e=>{n=!0,t.error?.call(t,e),r&&i.unsubscribe()});return r=!0,n&&i.unsubscribe(),i})}function Ze(){return e=>new m(t=>e.subscribe(new Qe(t)))}class Qe{constructor(t){e(this,`destination`,void 0),e(this,`last`,void 0),e(this,`hasLast`,!1),this.destination=t}next(e){let t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){var t;(t=this.destination).error?.call(t,e)}}function $e(e){return t=>new m(n=>t.subscribe(new et(n,e)))}class et{constructor(t,n){e(this,`destination`,void 0),e(this,`effect`,void 0),this.destination=t,this.effect=n}next(e){try{this.effect(e)}catch(e){throw this.error(e),e}this.destination.next(e)}error(e){var t;(t=this.destination).error?.call(t,e)}}function tt(e){return t=>new m(n=>t.subscribe(new nt(n,e)))}class nt{constructor(t,n){if(e(this,`destination`,void 0),e(this,`count`,void 0),this.destination=t,this.count=n,n<0){var r;(r=this.destination).error?.call(r,Error(`Count can not be less than zero`))}}next(e){this.count===0?this.destination.next(e):this.count--}error(e){var t;(t=this.destination).error?.call(t,e)}}function rt(e=0){return t=>{let n=0,r=new R(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new m(e=>(n++,a(r.subscribe(e))))}}var it=300,at=(e,t=it)=>new m(n=>{let r=b(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!x(r))return;let o=new r.ResizeObserver(I(e=>{let t=e[0];if(!t)return;let r,i;t.contentBoxSize&&t.contentBoxSize[0]?(i=t.contentBoxSize[0].blockSize,r=t.contentBoxSize[0].inlineSize):t.contentRect&&(r=t.contentRect.width,i=t.contentRect.height),_(r)&&_(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),V=(e,t=6,n=`.`)=>{let r={};for(let i in e)if(!(!e.hasOwnProperty(i)||e[i]instanceof HTMLElement||!t))if(typeof e[i]==`object`&&e[i]!==null){let a=V(e[i],t-1);for(let e in a)a.hasOwnProperty(e)&&(r[i+n+e]=a[e])}else r[i]=e[i];return r},ot=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},st=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},ct=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),lt=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),ut=e=>e!==void 0&&e!==``?e:lt().toString();function dt(e,t,n){if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];let r=1;for(;r<t.length&&t[r]<e;)r++;r>=t.length&&(r=t.length-1);let i=t[r-1],a=t[r],o=n[r-1],s=n[r];return e===i?o:e===a?s:o+(e-i)/(a-i)*(s-o)}function ft(e,t,n){if(e<=0||n<0)return[];let r=[],i=Math.floor((e-1)/2),a=Math.floor(e/2),o=t-i,s=t+a;o<0&&(s+=Math.abs(o),o=0),s>n&&(o-=s-n,s=n),o=Math.max(0,o),s=Math.min(n,s);for(let e=o;e<=s;e++)r.push(e);return r}var H=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),pt=e=>{if(!H(e))throw e},mt=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?V(n):{value:n})},U=(e={})=>{let t=e=>{let t=e;return e===void 0?t=`undefined`:e===null?t=`null`:(typeof e==`number`||typeof e==`boolean`)&&(t=e.toString()),t},n={};for(let r in e)Array.isArray(e[r])?n[r]=e[r].map(t):n[r]=t(e[r]);return n};class W{constructor({name:t,getParentContext:n}){e(this,`dynamicImportTimeout`,5e3),e(this,`span`,void 0),e(this,`context`,void 0),e(this,`childTracers`,[]),e(this,`initPromise`,void 0),W.dynamicImportStatus===`not_started`&&(W.dynamicImportPromise=this.loadOpentelemetry());let r=Date.now();this.initPromise=W.dynamicImportPromise.then(e=>{W.dynamicImportStatus===`completed`&&this.init({name:t,getParentContext:n},r)})}init({name:e,getParentContext:t},n){this.span=W.rootTracer.startSpan(e,{startTime:n},t?.()),this.context=W.dynamicImports.opentelemetryApi.trace.setSpan(W.dynamicImports.opentelemetryApi.context.active(),this.span)}loadOpentelemetry(){var e=this;return n(function*(){if(W.dynamicImportStatus===`not_started`){W.dynamicImportStatus=`in_progress`;try{let t=new Promise((t,n)=>setTimeout(n,e.dynamicImportTimeout)),n=Promise.all([import(`@opentelemetry/api`),import(`@opentelemetry/sdk-trace-web`),import(`@apptracer/opentelemetry`)]),[r,i,a]=yield Promise.race([n,t]);W.dynamicImports={opentelemetryApi:r,opentelemetrySdk:i,tracer:a},W.dynamicImportStatus=`completed`}catch{W.dynamicImportStatus=`failed`}}})()}isComponentTracerNotInitialized(){return v(this.span)||W.dynamicImportStatus===`failed`}log(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},U(n)),{},{type:`log`}),r)})}error(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},U(n)),{},{type:`error`}),r)})}critical(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},U(n)),{},{type:`critical`}),r)})}createComponentTracer(e){let t=new W({name:e,getParentContext:()=>this.context});return this.childTracers.push(t),t}end(){this.initPromise.then(e=>{this.isComponentTracerNotInitialized()||(this.childTracers.forEach(e=>e.end()),this.span.end())})}}e(W,`rootTracer`,void 0),e(W,`dynamicImportStatus`,`not_started`),e(W,`dynamicImports`,void 0),e(W,`dynamicImportPromise`,void 0);class ht extends W{constructor(){super({name:`Root`}),e(this,`spanExporter`,void 0)}init({name:e,getParentContext:t},n){let r=W.dynamicImports.tracer.initTracerOpenTelemetry({serviceName:`videoplayer-sdk-web`,appToken:`L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb`,spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0}}).getProvider(),i=new W.dynamicImports.tracer.TracerMemorySpanExporter;this.spanExporter=i,r.addSpanProcessor(new W.dynamicImports.tracer.TracerAllSpansProcessor({startedSpansExporter:i})),W.rootTracer=r.getTracer(`sdk-videoplayer-tracer`),super.init({name:e,getParentContext:t},n)}getFinishedSpans(){if(!this.isComponentTracerNotInitialized())return this.spanExporter?.getJsonData()}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}}class gt{constructor(t){e(this,`fakeTraceId`,void 0)}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new gt({name:e})}end(){}getFinishedSpans(){}getTraceId(){return this.fakeTraceId}}class _t{static createRootTracer(e=!1){return e?new ht:new gt}}var vt;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.FATAL=`fatal`})(vt||={});var yt;(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`})(yt||={});var bt=`vk.com`,xt=function(){var e=n(function*(e,t,n){let r=new URL(`https://${bt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),St(yield(yield fetch(r.toString())).json(),n)});return function(t,n,r){return e.apply(this,arguments)}}(),St=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),Ct(n)])),Ct=e=>Array.isArray(e)?e[0]:e,wt;(e=>{e.RU=`ru`,e.EN=`en`})(wt||={});var G=`__vk_vp_internals_exposure`;class Tt{constructor(t,n){e(this,`playerId`,void 0),e(this,`type`,void 0),this.playerId=n,this.type=t,this.initWindowObjects()}getWindowObject(){var e;if(typeof window>`u`)return{};let t=this.playerId,n=this.type;return((e=window[G])==null||(e=e[t])==null?void 0:e[n])??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[G]||(window[G]={}),window[G][e]||(window[G][e]={}),window[G][e][t]||(window[G][e][t]={})}expose(e){typeof window>`u`||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[G]&&window[G][e]&&window[G][e][t]&&(delete window[G][e][t],Object.keys(window[G][e]).length||delete window[G][e],Object.keys(window[G]).length||delete window[G])}}var Et={};o(Et,{subscribe:()=>At,push:()=>kt,destroy:()=>Ot,create:()=>Dt});var K=new Map,Dt=(e,t)=>K.set(e,t??[]),Ot=e=>K.delete(e),kt=(e,t)=>{let n=K.get(e);n&&(typeof n==`function`?n(t):n.push(t))},At=(e,t)=>{let n=K.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);K.set(e,t)}},jt=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`,Mt=e=>y({id:e.id,message:e.message,category:e.category,data:Nt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Nt(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Pt=e=>{if(e.thrown instanceof Error)return e.thrown.name=e.id,e.thrown;let t=Error(e.message);return t.name=e.id,t},Ft=()=>{try{let{origin:e,pathname:n,search:r,hostname:i}=b().document.location;return i===`localhost`?void 0:t({url:e+n},new URLSearchParams(r).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{}))}catch(e){console.error(e)}};class q{constructor(t,n,r,i){e(this,`dynamicImportTimeout`,5e3),e(this,`componentName`,void 0),e(this,`subscription`,new c),e(this,`options`,void 0),e(this,`envParams`,void 0),e(this,`context`,void 0),this.componentName=t,this.options=n,this.envParams=r,this.context=i,this.options.enabled&&(this.loadModule(),this.init())}error(e,n){let{blackErrorCategoryList:r,blackErrorIdList:i,sampleRate:a,whiteErrorCategoryList:o,whiteErrorIdList:s}=this.options,{id:c,category:l}=e;r.length&&r.includes(l)||i.length&&i.includes(c)||o.length&&!o.includes(l)||s.length&&!s.includes(c)||Math.random()>=a||q.tracerErrorMap.get(this.componentName)?.error(Pt(e),{severity:n?.severity??(e.traceAsLog?`debug`:void 0),keys:t(t(t({},this.context),Mt(e)),Ft())})}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}init(){var e=this;return n(function*(){try{if(yield q.loadPromise,q.tracerErrorMap.has(e.componentName)||v(q.appTracerModule))return;let{appTracerModule:t}=q,{initTracerError:n,initTracerErrorUploader:r,addTracerPlugin:i,getTracerModules:a}=t,o=a(e.componentName),s=!o.error,c=o.error??n(e.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});s&&r(e.componentName,{appToken:jt,environment:e.envParams.env,versionCode:1,versionName:e.envParams.version}),i(e.componentName,{name:`addedCategory`,errorBeforeAdd(e){let t=e.keys?.category??`wtf`;if(typeof t==`string`)return{issueKey:t}}}),q.tracerErrorMap.set(e.componentName,c)}catch{}})()}loadModule(){var e=this;_(q.loadPromise)||(q.loadPromise=function(){var t=n(function*(){try{let t=new Promise((t,n)=>b().setTimeout(n,e.dynamicImportTimeout));q.appTracerModule=yield Promise.race([t,import(`@apptracer/sdk/lite`)])}catch{q.loadPromise=null}});return function(){return t.apply(this,arguments)}}()())}}e(q,`tracerErrorMap`,new Map),e(q,`appTracerModule`,null),e(q,`loadPromise`,null);var It=(e,t)=>{let n=e.length,r=t>=0?t:n+t;return r>=0&&r<n?e[r]:void 0},Lt=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}},Rt=(e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n],n,e))return n;return-1},zt=(e,t=1)=>{let n=[],r=(e,t)=>{for(let i=0;i<e.length;i++){if(!(i in e))continue;let a=e[i];t>0&&Array.isArray(a)?r(a,t-1):n.push(a)}};return r(e,t),n},Bt=(e,t)=>{let n=[];for(let r=0;r<e.length;r++){let i=t(e[r],r,e);if(Array.isArray(i))for(let e=0;e<i.length;e++)n.push(i[e]);else n.push(i)}return n},Vt=(e,t,n=0)=>{let r=e.length,i=n>=0?n:Math.max(r+n,0);for(;i<r;i++){let n=e[i];if(n===t||n!==n&&t!==t)return!0}return!1},Ht=e=>{let t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=e[t-1-r];return n},Ut=(e,t)=>{let n=e.slice();return t?n.sort(t):n.sort()},Wt=(e,t,n,...r)=>{let i=e.slice();return n===void 0?i.splice(t):i.splice(t,n,...r),i},Gt=(e,t,n)=>{let r=e.length,i=t>=0?t:r+t,a=e.slice();return a[i]=n,a},Kt=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:Function(`return this`)(),qt=e=>{let t=[],n=Object.keys(e);for(let r=0;r<n.length;r++){let i=n[r];t.push([i,e[i]])}return t},Jt=e=>{let t={};for(let[n,r]of e)t[n]=r;return t},Yt=Object.prototype.hasOwnProperty,Xt=(e,t)=>Yt.call(e,t),Zt=e=>{let t=Object.keys(e),n=Array(t.length);for(let r=0;r<t.length;r++)n[r]=e[t[r]];return n},Qt=e=>{let t=Array.from(e);return t.length===0?Promise.resolve([]):Promise.all(t.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))},$t=e=>{let t=Array.from(e);return t.length===0?Promise.reject(AggregateError([],`All promises were rejected`)):new Promise((e,n)=>{let r=Array(t.length),i=t.length;t.forEach((t,a)=>{Promise.resolve(t).then(e,e=>{r[a]=e,--i,i===0&&n(AggregateError(r,`All promises were rejected`))})})})},en=(e,t)=>e.then(e=>Promise.resolve(t()).then(()=>e),e=>Promise.resolve(t()).then(()=>{throw e})),tn=e=>{try{return Promise.resolve(e())}catch(e){return Promise.reject(e)}},nn=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},{NativeAbortSignal:rn,NativeAbortController:an}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function on(e){let t;try{t=new Event(`abort`)}catch{typeof document<`u`?document.createEvent?(t=document.createEvent(`Event`),t.initEvent(`abort`,!1,!1)):(t=document.createEventObject(),t.type=`abort`):t={type:`abort`,bubbles:!1,cancelable:!1}}return t.reason=e,t}function sn(e){if(e===void 0)if(typeof document>`u`)e=Error(`This operation was aborted`),e.name=`AbortError`;else try{e=new DOMException(`signal is aborted without reason`),Object.defineProperty(e,`name`,{value:`AbortError`})}catch{e=Error(`This operation was aborted`),e.name=`AbortError`}return e}class cn{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;let n=this.listeners[e];for(let e=0,r=n.length;e<r;e++)if(n[e].callback===t){n.splice(e,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let t=this.listeners[e.type].slice();for(let n=0,r=t.length;n<r;n++){let r=t[n];try{r.callback.call(this,e)}catch(e){Promise.resolve().then(()=>{throw e})}r.options&&r.options.once&&this.removeEventListener(e.type,r.callback)}return!e.defaultPrevented}}class J extends cn{constructor(){super(),this.listeners||cn.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)}throwIfAborted(){let{aborted:e,reason:t=`Aborted`}=this;if(e)throw t}static timeout(e){let t=new Y;return setTimeout(()=>t.abort(new DOMException(`This signal is timeout in ${e}ms`,`TimeoutError`)),e),t.signal}static any(e){let t=new Y;function n(){t.abort(this.reason),r()}function r(){for(let t of e)t.removeEventListener(`abort`,n)}for(let r of e)if(r.aborted){t.abort(r.reason);break}else r.addEventListener(`abort`,n);return t.signal}}class Y{constructor(){Object.defineProperty(this,`signal`,{value:new J,writable:!0,configurable:!0})}abort(e){let t=sn(e),n=on(t);this.signal.reason=t,this.signal.dispatchEvent(n)}toString(){return`[object AbortController]`}}typeof Symbol<`u`&&Symbol.toStringTag&&(Y.prototype[Symbol.toStringTag]=`AbortController`,J.prototype[Symbol.toStringTag]=`AbortSignal`);function ln(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 un(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!ln({fetch:t,Request:n,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i}))return{fetch:t,Request:a};let a=n;(a&&!a.prototype.hasOwnProperty(`signal`)||i)&&(a=function(e,t){let r;t&&t.signal&&(r=t.signal,delete t.signal);let i=new n(e,t);return r&&Object.defineProperty(i,`signal`,{writable:!1,enumerable:!1,configurable:!0,value:r}),i},a.prototype=n.prototype);let o=t;return{fetch:(e,t)=>{let n=a&&a.prototype.isPrototypeOf(e)?e.signal:t?t.signal:void 0;if(n){let r;try{r=new DOMException(`Aborted`,`AbortError`)}catch{r=Error(`Aborted`),r.name=`AbortError`}if(n.aborted)return Promise.reject(r);let i=new Promise((e,t)=>{n.addEventListener(`abort`,()=>t(r),{once:!0})});return t&&t.signal&&delete t.signal,Promise.race([i,o(e,t)])}return o(e,t)},Request:a}}var X=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window,Z=`fetch`in X&&ln({fetch:X.fetch,Request:X.Request,AbortController:X.AbortController}),dn=Z?un({fetch:X.fetch,Request:X.Request,AbortController:X.AbortController}):void 0,fn=Z?dn.fetch:X.fetch,pn=Z?dn.Request:X.Request,mn=Z?Y:X.AbortController,hn=Z?J:X.AbortSignal,gn=(e,t)=>{let n=e.length,r=t>=0?t:n+t;if(r<0||r>=n)return;let i=e.charCodeAt(r);if(i>=55296&&i<=56319&&r+1<n){let t=e.charCodeAt(r+1);if(t>=56320&&t<=57343)return e[r]+e[r+1]}return e[r]};function*_n(e,t){let n=t.flags.includes(`g`)?t.flags:t.flags+`g`,r=new RegExp(t.source,n),i;for(;(i=r.exec(e))!==null;)yield i,i[0].length===0&&r.lastIndex++}var vn=(e,t,n=` `)=>{if(n===``||e.length>=t)return e;let r=t-e.length;return e+n.repeat(Math.ceil(r/n.length)).slice(0,r)},yn=(e,t,n=` `)=>{if(n===``||e.length>=t)return e;let r=t-e.length;return n.repeat(Math.ceil(r/n.length)).slice(0,r)+e},bn=(e,t,n)=>{if(typeof t==`string`){if(typeof n==`string`)return t===``?n+e.split(``).join(n)+n:e.split(t).join(n);let r=[],i=0,a=e.indexOf(t,i);for(;a!==-1;)r.push(e.slice(i,a)),r.push(n(t,a,e)),i=a+t.length,a=e.indexOf(t,i);return r.push(e.slice(i)),r.join(``)}let r=t.flags.includes(`g`)?t.flags:t.flags+`g`,i=new RegExp(t.source,r);return e.replace(i,n)},Q=e=>e.replace(/^\s+/,``),xn=e=>e.replace(/\s+$/,``),Sn=Q,Cn=xn,wn=(e,t)=>typeof e==`string`?gn(e,t):It(e,t),Tn=(e,t={})=>{let n=t.timeout||1,r=performance.now();return X.setTimeout(()=>{e({get didTimeout(){return t.timeout?!1:performance.now()-r-1>n},timeRemaining(){return Math.max(0,1+(performance.now()-r))}})},1)},En=e=>X.clearTimeout(e),Dn=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),$=!Dn(X.requestIdleCallback)||!Dn(X.cancelIdleCallback),On=$?Tn:X.requestIdleCallback,kn=$?En:X.cancelIdleCallback,An=(e,t,n)=>typeof e==`string`?e.includes(t,n):Vt(e,t,n),jn=(e,t,n)=>{if(typeof e.canParse==`function`)return e.canParse(t,n);try{return new e(t,n),!0}catch{return!1}};export{y as withoutNullable,ye as videoSizeToQuality,be as videoQualityToHeight,ve as videoHeightToQuality,jn as urlCanParsePolyfilled,ke as timeout,we as timeCodeToString,I as throttleFn,Be as throttle,$e as tap,pt as suppressAbort,Q as stringTrimStart,Cn as stringTrimRight,Sn as stringTrimLeft,xn as stringTrimEnd,bn as stringReplaceAll,yn as stringPadStart,vn as stringPadEnd,_n as stringMatchAll,gn as stringAt,tt as skip,rt as shareReplay,w as safeStorage,On as requestIdleCallbackPolyfilled,nn as promiseWithResolvers,tn as promiseTry,en as promiseFinally,$t as promiseAny,Qt as promiseAllSettled,Ze as pairwise,Xe as once,at as observeElementSize,je as observableFrom,Zt as objectValues,Xt as objectHasOwn,Jt as objectFromEntries,qt as objectEntries,ie as nowInt,C as now,d as noop,Oe as merge,Ye as mapTo,B as map,xt as loadVKLangPack,st as isValidURL,v as isNullable,_ as isNonNullable,ge as isLowerOrEqual,j as isLower,N as isInvariantQuality,ct as isIntersecting,he as isHigherOrEqual,me as isHigher,x as isBrowserWindow,H as isAbortError,Ae as interval,dt as interpolate,An as includesPolyfilled,Kt as globalThisPolyfill,b as getWindow,Ce as getVideoQualityLabel,mt as getTraceSubscriptionMethod,ft as getRangeAroundIndex,ut as getPlayerId,_e as getHighestQuality,oe as getExponentialDelay,Me as fromEvent,V as flattenObject,Ke as filterChanged,He as filter,P as fillWithDefault,fn as fetchPolyfilled,Et as devNull,pe as detectEmbed,F as debounceFn,Le as debounce,De as combine,L as cloneDeepWith,Te as cloneDeep,ot as clearVideoElement,u as checkNever,kn as cancelIdleCallbackPolyfilled,Pe as buffer,wn as atPolyfilled,Se as assertQualityIsExact,g as assertNullable,ne as assertNotEmptyArray,te as assertNonNullable,l as assertNever,re as assertEmptyArray,Gt as arrayWith,Wt as arrayToSpliced,Ut as arrayToSorted,Ht as arrayToReversed,Vt as arrayIncludes,Bt as arrayFlatMap,zt as arrayFlat,Rt as arrayFindLastIndex,Lt as arrayFindLast,It as arrayAt,xe as areQualitiesExact,S as addScript,ae as abortable,k as VideoQuality,Ee as ValueSubject,yt as VKNumericLanguage,s as VERSION,_t as TracerFactory,Ne as SubscriptionRemovable,c as Subscription,h as Subject,pn as RequestPolyfilled,R as ReplaySubject,m as Observable,ee as Logger,Tt as InternalsExposure,wt as InterfaceLanguage,G as INTERNAL_EXPOSE_GLOBAL_KEY,vt as ErrorCategory,q as AppTracer,hn as AbortSignalPolyfilled,mn as AbortControllerPolyfilled};
|
package/esnext.cjs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.87-beta.0
|
|
3
|
+
* Thu, 02 Apr 2026 11:34:58 GMT
|
|
4
|
+
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-87/doc/
|
|
5
|
+
*/
|
|
6
|
+
var e=Object.defineProperty,t=Object.getOwnPropertyNames,n=Object.getOwnPropertyDescriptor,r=Object.prototype.hasOwnProperty;function i(e){return this[e]}var a=a=>{var s=(o??=new WeakMap).get(a),c;if(s)return s;if(s=e({},`__esModule`,{value:!0}),a&&typeof a==`object`||typeof a==`function`)for(var l of t(a))r.call(s,l)||e(s,l,{get:i.bind(a,l),enumerable:!(c=n(a,l))||c.enumerable});return o.set(a,s),s},o,s=e=>e;function c(e,t){this[e]=s.bind(null,t)}var l=(t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0,configurable:!0,set:c.bind(n,r)})},u={};l(u,{withoutNullable:()=>C,videoSizeToQuality:()=>Se,videoQualityToHeight:()=>Ce,videoHeightToQuality:()=>xe,urlCanParsePolyfilled:()=>nn,timeout:()=>Ie,timeCodeToString:()=>Oe,throttleFn:()=>Ae,throttle:()=>qe,tap:()=>ot,suppressAbort:()=>bt,skip:()=>ct,shareReplay:()=>ut,safeStorage:()=>ce,requestIdleCallbackPolyfilled:()=>en,pairwise:()=>it,once:()=>rt,observeElementSize:()=>ft,observableFrom:()=>Re,nowInt:()=>ae,now:()=>E,noop:()=>h,merge:()=>Fe,mapTo:()=>nt,map:()=>L,loadVKLangPack:()=>Tt,isValidURL:()=>mt,isNullable:()=>S,isNonNullable:()=>x,isLowerOrEqual:()=>ve,isLower:()=>N,isInvariantQuality:()=>P,isIntersecting:()=>ht,isHigherOrEqual:()=>_e,isHigher:()=>ge,isBrowserWindow:()=>T,isAbortError:()=>z,interval:()=>Le,interpolate:()=>vt,getWindow:()=>w,getVideoQualityLabel:()=>Ee,getTraceSubscriptionMethod:()=>xt,getRangeAroundIndex:()=>yt,getPlayerId:()=>_t,getHighestQuality:()=>ye,getExponentialDelay:()=>se,fromEvent:()=>ze,flattenObject:()=>R,filterChanged:()=>$e,filter:()=>Ye,fillWithDefault:()=>De,fetchPolyfilled:()=>Kt,devNull:()=>kt,detectEmbed:()=>he,debounceFn:()=>ke,debounce:()=>We,combine:()=>Pe,cloneDeepWith:()=>F,cloneDeep:()=>je,clearVideoElement:()=>pt,checkNever:()=>m,cancelIdleCallbackPolyfilled:()=>tn,buffer:()=>Ve,assertQualityIsExact:()=>Te,assertNullable:()=>te,assertNotEmptyArray:()=>ne,assertNonNullable:()=>b,assertNever:()=>p,assertEmptyArray:()=>re,areQualitiesExact:()=>we,addScript:()=>ie,abortable:()=>oe,VideoQuality:()=>j,ValueSubject:()=>Ne,VKNumericLanguage:()=>W,VERSION:()=>d,TracerFactory:()=>Ct,SubscriptionRemovable:()=>Be,Subscription:()=>f,Subject:()=>v,RequestPolyfilled:()=>qt,ReplaySubject:()=>Me,Observable:()=>_,Logger:()=>y,InternalsExposure:()=>Ot,InterfaceLanguage:()=>G,INTERNAL_EXPOSE_GLOBAL_KEY:()=>K,ErrorCategory:()=>U,AppTracer:()=>J,AbortSignalPolyfilled:()=>Yt,AbortControllerPolyfilled:()=>Jt}),module.exports=a(u);var d=`1.0.87-beta.0`;class f{subscriptions=[];unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(e=>{typeof e==`function`?e():e.unsubscribe()})}add(e){return this.subscriptions.push(e),this}}var p=e=>{throw Error(`${e} is value of unexpected type`)},m=e=>{},h=()=>{},g=e=>{throw console.error(e),e},ee=e=>{console.error(e)};class _{suppressErrors=!1;constructor(e){e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?ee:g,r;r=t?typeof t==`function`?{next:t,error:h}:{next:e=>t.next(e),error:e=>t.error?.(e)}:{next:n,error:h};let i=typeof e==`function`?{next:t=>{try{let n=e(t);n instanceof Promise&&n.catch(e=>r.next(e))}catch(e){r.next(e)}},error:e=>r.next(e)}:{next:t=>e.next(t),error:t=>e.error?e.error(t):r.next(t)},a;try{a=this._subscribe(i)}catch(e){i.error?.(e)}return new f().add(()=>{switch(i.next=h,i.error=h,typeof a){case`function`:a();return;case`object`:a.unsubscribe();return;case`undefined`:return;default:return p(a)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class v extends _{keyCounter=0;subscribers=new Map;constructor(){super()}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>t.error?.(e))}_subscribe(e){let t=this.keyCounter++;return this.subscribers.set(t,e),new f().add(()=>this.subscribers.delete(t))}}class y{log$=new v;logs=[];log=e=>{let t={...e,timestamp:Date.now()};this.logs.push(t),this.log$.next(t)};createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch{n={message:"error in `createCustomLog`",component:`Logger`}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>({component:e,...t}))}getAllLogs=()=>this.logs}function b(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function te(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function x(e){return e!=null}function S(e){return e==null}var C=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>x(t)));function ne(e,t){if(!e?.length)throw Error(t)}function re(e,t){if(e?.length)throw Error(t)}var w=()=>globalThis,T=(e=w())=>!!(e.window&&e.screen),ie=(e,t,n)=>new Promise((r,i)=>{t.addEventListener(`abort`,()=>{s(),l.remove()});let a=()=>{s(),i(`error`)},o=()=>{s(),r()},s=()=>{c&&clearTimeout(c),l.removeEventListener(`load`,o),l.removeEventListener(`error`,a)},c;n&&(c=w().setTimeout(()=>{s(),i(`timeout`)},n));let l=document.createElement(`script`);l.addEventListener(`load`,o),l.addEventListener(`error`,a),l.src=e,document.head.appendChild(l)}),E=typeof w().performance?.now==`function`?()=>w().performance.now():()=>Date.now(),ae=()=>Math.trunc(E()),oe=(e,t)=>async(...n)=>{let r=t(...n),i=e.aborted,a;for(;!i&&!e.aborted;)try{let e=await r.next(a);i=e.done??!1,a=e.value}catch(e){await r.throw(e)}return a},se=(e,{start:t=0,factor:n=2,max:r=1/0,min:i=t,random:a=0}={})=>{let o=t;return o*=n**e,o*=1+(Math.random()*a*2-a),o=Math.round(o),o=Math.min(o,r),o=Math.max(o,i),o},ce={};l(ce,{set:()=>de,remove:()=>pe,isPersistent:()=>le,has:()=>fe,get:()=>ue,clear:()=>me});var D,O,k=`vk-videoplayer-dummy-key-${Math.random()}`,A=()=>{if(O!==void 0)return O;try{localStorage.setItem(k,`test`),localStorage.removeItem(k),O=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(k),O=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)O=2;else throw e}else throw e}return O===2&&(D=new Map),O},le=()=>A()===0,ue=e=>{let t=A();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return D?.get(e);default:p(t)}},de=(e,t)=>{let n=A();switch(n){case 0:try{localStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 1:try{sessionStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 2:D?.set(e,t);return;default:p(n)}},fe=e=>{let t=A();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return D?.has(e)??!1;default:return p(t),!1}},pe=e=>{let t=A();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:D?.delete(e);return;default:p(t)}},me=()=>{let e=A();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return D?.clear();default:p(e)}},he=()=>{let e,t=[],n=w();try{e=n.self!==n.top}catch(t){t instanceof DOMException&&t.name===`SecurityError`?e=!0:(e=!1,console.error(t))}try{n.location?.ancestorOrigins&&(t=[...n.location.ancestorOrigins])}catch(e){console.error(e)}try{!t.length&&n.document.referrer&&(t=[new URL(n.document.referrer).origin])}catch(e){console.error(e)}return t=t.filter(e=>URL.canParse(e)),{isEmbed:e,origins:t,topOrigin:t.at(-1),immediateOrigin:t.at(0)}},j;(e=>{e.INVARIANT=`Invariant quality`,e.Q_144P=`144p`,e.Q_240P=`240p`,e.Q_360P=`360p`,e.Q_480P=`480p`,e.Q_576P=`576p`,e.Q_720P=`720p`,e.Q_1080P=`1080p`,e.Q_1440P=`1440p`,e.Q_2160P=`2160p`,e.Q_4320P=`4320p`})(j||={});var M={"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}},ge=(e,t)=>M[e].height>M[t].height,_e=(e,t)=>M[e].height>=M[t].height,N=(e,t)=>M[e].height<M[t].height,ve=(e,t)=>M[e].height<=M[t].height,ye=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:N(e,t)?1:-1)[0],be=Object.keys(M).sort((e,t)=>N(e,t)?-1:1),xe=(e,t=.02)=>[...be].find(n=>M[n].height*(1+t)>=e),Se=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return be.find(e=>{let t=M[e];return t.width>=r&&t.height>=n})},Ce=e=>M[e].height,P=e=>e===`Invariant quality`,we=e=>e.every(e=>!P(e));function Te(e){if(P(e))throw Error(`Expected exact quality`)}var Ee=e=>{switch(e){case`4320p`:return`8K`;case`2160p`:return`4K`;case`1440p`:return`QHD`;case`1080p`:return`FHD`;case`720p`:return`HD`;default:return``}},De=(e,t)=>{let n={};for(let r of Object.keys(t)){let i=t[r],a=e[r];Array.isArray(i)?n[r]=Array.isArray(a)?a:i:typeof i==`object`&&i?typeof a==`object`&&a&&!Array.isArray(a)?n[r]=De(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},Oe=e=>{let t=``;return e>=3600&&(t+=Math.floor(e/3600)+`h`,e%=3600),e>=60&&(t+=Math.floor(e/60)+`m`,e%=60),e>0&&(t+=Math.floor(e)+`s`),t};function ke(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof w().requestAnimationFrame==`function`;n&&(u=!!n.leading,d=`maxWait`in n,a=n?.maxWait?Math.max(+n?.maxWait||0,t):a,f=`trailing`in n?!!n.trailing:f);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(s&&w().cancelAnimationFrame(s),w().requestAnimationFrame(e)):setTimeout(e,t)}function g(e){if(p){w().cancelAnimationFrame(e);return}clearTimeout(e)}function ee(e){return l=e,s=h(y,t),u?m(e):o}function _(e){let n=e-c,r=e-l,i=t-n;return d?Math.min(i,a-r):i}function v(e){let n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function y(){let e=Date.now();if(v(e))return b(e);s=h(y,_(e))}function b(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function te(){s!==void 0&&g(s),l=0,r=c=i=s=void 0}function x(){return s===void 0?o:b(Date.now())}function S(){return s!==void 0}function C(...e){let n=Date.now(),a=v(n);if(r=e,i=this,c=n,a){if(s===void 0)return ee(c);if(d)return s=h(y,t),m(c)}return s===void 0&&(s=h(y,t)),o}return C.cancel=te,C.flush=x,C.pending=S,C}var Ae=(e,t=0,n)=>ke(e,t,{leading:!0,trailing:!0,...n,maxWait:t}),F=(e,t)=>{if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let r in e){if(typeof t==`function`){let i=t(e[r],r,e,n);if(i!==void 0){n[r]=i;continue}}typeof e[r]==`object`?n[r]=F(e[r],t):n[r]=e[r]}return n},je=e=>F(e);class Me extends v{bufferSize;buffer=[];cursorEnd=-1;cursorStart=0;constructor(e){super(),this.bufferSize=e,this.buffer=Array(e)}next(e){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=e,this.subscribers.forEach(t=>t.next(e))}_subscribe(e){for(let t=this.cursorStart;t<=this.cursorEnd;t++)e.next(this.buffer[t%this.bufferSize]);let t=this.keyCounter++;return this.subscribers.set(t,e),new f().add(()=>this.subscribers.delete(t))}}class Ne extends v{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){let t=super._subscribe(e);return e.next(this.value),t}}function Pe(e){return new _(t=>{let n={},r=Object.keys(e).length,i=e=>i=>{e in n||r--,n[e]=i,r===0&&t.next(n)};return Object.entries(e).reduce((e,[t,n])=>e.add(n.subscribe(i(t))),new f)})}function Fe(...e){return new _(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new f))}var Ie=e=>new _(t=>{let n=w().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>w().clearTimeout(n)}),Le=e=>new _(t=>{let n=w(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}}),Re=e=>new _(t=>{e.forEach(e=>t.next(e))}),ze=(e,t)=>new _(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Be extends f{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Ve(e){return t=>new _(n=>t.subscribe(new He(n,e)))}class He{destination;size;lastValues=[];constructor(e,t){this.destination=e,this.size=t}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 Ue={leading:!1,trailing:!0};function We(e,t=Ue){return n=>new _(r=>n.subscribe(new Ge(r,e,t)))}class Ge{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e;let t=w();x(this.timeout)?t.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=t.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(e){if(this.destination.error)this.destination.error(e);else throw e}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}}var Ke={leading:!0,trailing:!1};function qe(e,t=Ke){return n=>new _(r=>n.subscribe(new Je(r,e,t)))}class Je{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,S(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=w().setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}}function Ye(e){return t=>new _(n=>t.subscribe(new Xe(n,e)))}class Xe{destination;predicate;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}var Ze=(e,t)=>{let n=(e,t)=>{let n=Object.keys(e);for(let r in t)if(!n.includes(r)||t[r]!==e[r])return!1;return!0};return n(e,t)&&n(t,e)},Qe=(e,t)=>e instanceof Object&&t instanceof Object?Ze(e,t):e===t;function $e(e=Qe){return t=>new _(n=>t.subscribe(new et(n,e)))}var I={};class et{destination;predicate;lastValue=I;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===I||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?{...e}:e}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function L(e){return t=>new _(n=>t.subscribe(new tt(n,e)))}class tt{destination;mapper;constructor(e,t){this.destination=e,this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(e){throw this.error(e),e}this.destination.next(t)}error(e){this.destination.error?.(e)}}function nt(e){return L(()=>e)}function rt(){return e=>new _(t=>{let n=!1,r=!1,i=e.subscribe(e=>{n||(n=!0,t.next(e)),r&&i.unsubscribe()},e=>{n=!0,t.error?.(e),r&&i.unsubscribe()});return r=!0,n&&i.unsubscribe(),i})}function it(){return e=>new _(t=>e.subscribe(new at(t)))}class at{destination;last;hasLast=!1;constructor(e){this.destination=e}next(e){let t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){this.destination.error?.(e)}}function ot(e){return t=>new _(n=>t.subscribe(new st(n,e)))}class st{destination;effect;constructor(e,t){this.destination=e,this.effect=t}next(e){try{this.effect(e)}catch(e){throw this.error(e),e}this.destination.next(e)}error(e){this.destination.error?.(e)}}function ct(e){return t=>new _(n=>t.subscribe(new lt(n,e)))}class lt{destination;count;constructor(e,t){this.destination=e,this.count=t,t<0&&this.destination.error?.(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 ut(e=0){return t=>{let n=0,r=new Me(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new _(e=>(n++,a(r.subscribe(e))))}}var dt=300,ft=(e,t=dt)=>new _(n=>{let r=w(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!T(r))return;let o=new r.ResizeObserver(Ae(e=>{let t=e[0];if(!t)return;let r,i;t.contentBoxSize&&t.contentBoxSize[0]?(i=t.contentBoxSize[0].blockSize,r=t.contentBoxSize[0].inlineSize):t.contentRect&&(r=t.contentRect.width,i=t.contentRect.height),x(r)&&x(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),R=(e,t=6,n=`.`)=>{let r={};for(let i in e)if(!(!e.hasOwnProperty(i)||e[i]instanceof HTMLElement||!t))if(typeof e[i]==`object`&&e[i]!==null){let a=R(e[i],t-1);for(let e in a)a.hasOwnProperty(e)&&(r[i+n+e]=a[e])}else r[i]=e[i];return r},pt=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},mt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},ht=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),gt=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),_t=e=>e!==void 0&&e!==``?e:gt().toString();function vt(e,t,n){if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];let r=1;for(;r<t.length&&t[r]<e;)r++;r>=t.length&&(r=t.length-1);let i=t[r-1],a=t[r],o=n[r-1],s=n[r];return e===i?o:e===a?s:o+(e-i)/(a-i)*(s-o)}function yt(e,t,n){if(e<=0||n<0)return[];let r=[],i=Math.floor((e-1)/2),a=Math.floor(e/2),o=t-i,s=t+a;o<0&&(s+=Math.abs(o),o=0),s>n&&(o-=s-n,s=n),o=Math.max(0,o),s=Math.min(n,s);for(let e=o;e<=s;e++)r.push(e);return r}var z=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),bt=e=>{if(!z(e))throw e},xt=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?R(n):{value:n})},B=(e={})=>{let t=e=>{let t=e;return e===void 0?t=`undefined`:e===null?t=`null`:(typeof e==`number`||typeof e==`boolean`)&&(t=e.toString()),t},n={};for(let r in e)Array.isArray(e[r])?n[r]=e[r].map(t):n[r]=t(e[r]);return n};class V{dynamicImportTimeout=5e3;span;context;childTracers=[];initPromise;static rootTracer;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t}){V.dynamicImportStatus===`not_started`&&(V.dynamicImportPromise=this.loadOpentelemetry());let n=Date.now();this.initPromise=V.dynamicImportPromise.then(r=>{V.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t},n)})}init({name:e,getParentContext:t},n){this.span=V.rootTracer.startSpan(e,{startTime:n},t?.()),this.context=V.dynamicImports.opentelemetryApi.trace.setSpan(V.dynamicImports.opentelemetryApi.context.active(),this.span)}async loadOpentelemetry(){if(V.dynamicImportStatus===`not_started`){V.dynamicImportStatus=`in_progress`;try{let e=new Promise((e,t)=>setTimeout(t,this.dynamicImportTimeout)),t=Promise.all([import(`@opentelemetry/api`),import(`@opentelemetry/sdk-trace-web`),import(`@apptracer/opentelemetry`)]),[n,r,i]=await Promise.race([t,e]);V.dynamicImports={opentelemetryApi:n,opentelemetrySdk:r,tracer:i},V.dynamicImportStatus=`completed`}catch{V.dynamicImportStatus=`failed`}}}isComponentTracerNotInitialized(){return S(this.span)||V.dynamicImportStatus===`failed`}log(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...B(t),type:`log`},n)})}error(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...B(t),type:`error`},n)})}critical(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...B(t),type:`critical`},n)})}createComponentTracer(e){let t=new V({name:e,getParentContext:()=>this.context});return this.childTracers.push(t),t}end(){this.initPromise.then(e=>{this.isComponentTracerNotInitialized()||(this.childTracers.forEach(e=>e.end()),this.span.end())})}}class St extends V{spanExporter;constructor(){super({name:`Root`})}init({name:e,getParentContext:t},n){let r=V.dynamicImports.tracer.initTracerOpenTelemetry({serviceName:`videoplayer-sdk-web`,appToken:`L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb`,spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0}}).getProvider(),i=new V.dynamicImports.tracer.TracerMemorySpanExporter;this.spanExporter=i,r.addSpanProcessor(new V.dynamicImports.tracer.TracerAllSpansProcessor({startedSpansExporter:i})),V.rootTracer=r.getTracer(`sdk-videoplayer-tracer`),super.init({name:e,getParentContext:t},n)}getFinishedSpans(){if(!this.isComponentTracerNotInitialized())return this.spanExporter?.getJsonData()}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}}class H{fakeTraceId;constructor(e){}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new H({name:e})}end(){}getFinishedSpans(){}getTraceId(){return this.fakeTraceId}}class Ct{static createRootTracer(e=!1){return e?new St:new H}}var U;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.FATAL=`fatal`})(U||={});var W;(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`})(W||={});var wt=`vk.com`,Tt=async(e,t,n)=>{let r=new URL(`https://${wt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),Et(await(await fetch(r.toString())).json(),n)},Et=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),Dt(n)])),Dt=e=>Array.isArray(e)?e[0]:e,G;(e=>{e.RU=`ru`,e.EN=`en`})(G||={});var K=`__vk_vp_internals_exposure`;class Ot{playerId;type;constructor(e,t){this.playerId=t,this.type=e,this.initWindowObjects()}getWindowObject(){if(typeof window>`u`)return{};let e=this.playerId,t=this.type;return window[K]?.[e]?.[t]??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[K]||(window[K]={}),window[K][e]||(window[K][e]={}),window[K][e][t]||(window[K][e][t]={})}expose(e){typeof window>`u`||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[K]&&window[K][e]&&window[K][e][t]&&(delete window[K][e][t],Object.keys(window[K][e]).length||delete window[K][e],Object.keys(window[K]).length||delete window[K])}}var kt={};l(kt,{subscribe:()=>Nt,push:()=>Mt,destroy:()=>jt,create:()=>At});var q=new Map,At=(e,t)=>q.set(e,t??[]),jt=e=>q.delete(e),Mt=(e,t)=>{let n=q.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Nt=(e,t)=>{let n=q.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);q.set(e,t)}},Pt=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`,Ft=e=>C({id:e.id,message:e.message,category:e.category,data:It(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function It(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Lt=e=>{if(e.thrown instanceof Error)return e.thrown.name=e.id,e.thrown;let t=Error(e.message);return t.name=e.id,t},Rt=()=>{try{let{origin:e,pathname:t,search:n,hostname:r}=w().document.location;return r===`localhost`?void 0:{url:e+t,...new URLSearchParams(n).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{})}}catch(e){console.error(e)}};class J{static tracerErrorMap=new Map;static appTracerModule=null;static loadPromise=null;dynamicImportTimeout=5e3;componentName;subscription=new f;options;envParams;context;constructor(e,t,n,r){this.componentName=e,this.options=t,this.envParams=n,this.context=r,this.options.enabled&&(this.loadModule(),this.init())}error(e,t){let{blackErrorCategoryList:n,blackErrorIdList:r,sampleRate:i,whiteErrorCategoryList:a,whiteErrorIdList:o}=this.options,{id:s,category:c}=e;n.length&&n.includes(c)||r.length&&r.includes(s)||a.length&&!a.includes(c)||o.length&&!o.includes(s)||Math.random()>=i||J.tracerErrorMap.get(this.componentName)?.error(Lt(e),{severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...Ft(e),...Rt()}})}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}async init(){try{if(await J.loadPromise,J.tracerErrorMap.has(this.componentName)||S(J.appTracerModule))return;let{appTracerModule:e}=J,{initTracerError:t,initTracerErrorUploader:n,addTracerPlugin:r,getTracerModules:i}=e,a=i(this.componentName),o=!a.error,s=a.error??t(this.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});o&&n(this.componentName,{appToken:Pt,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),r(this.componentName,{name:`addedCategory`,errorBeforeAdd(e){let t=e.keys?.category??`wtf`;if(typeof t==`string`)return{issueKey:t}}}),J.tracerErrorMap.set(this.componentName,s)}catch{}}loadModule(){x(J.loadPromise)||(J.loadPromise=(async()=>{try{let e=new Promise((e,t)=>w().setTimeout(t,this.dynamicImportTimeout));J.appTracerModule=await Promise.race([e,import(`@apptracer/sdk/lite`)])}catch{J.loadPromise=null}})())}}var{NativeAbortSignal:zt,NativeAbortController:Bt}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function Vt(e){let t;try{t=new Event(`abort`)}catch{typeof document<`u`?document.createEvent?(t=document.createEvent(`Event`),t.initEvent(`abort`,!1,!1)):(t=document.createEventObject(),t.type=`abort`):t={type:`abort`,bubbles:!1,cancelable:!1}}return t.reason=e,t}function Ht(e){if(e===void 0)if(typeof document>`u`)e=Error(`This operation was aborted`),e.name=`AbortError`;else try{e=new DOMException(`signal is aborted without reason`),Object.defineProperty(e,`name`,{value:`AbortError`})}catch{e=Error(`This operation was aborted`),e.name=`AbortError`}return e}class Ut{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;let n=this.listeners[e];for(let e=0,r=n.length;e<r;e++)if(n[e].callback===t){n.splice(e,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let t=this.listeners[e.type].slice();for(let n=0,r=t.length;n<r;n++){let r=t[n];try{r.callback.call(this,e)}catch(e){Promise.resolve().then(()=>{throw e})}r.options&&r.options.once&&this.removeEventListener(e.type,r.callback)}return!e.defaultPrevented}}class Y extends Ut{constructor(){super(),this.listeners||Ut.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)}throwIfAborted(){let{aborted:e,reason:t=`Aborted`}=this;if(e)throw t}static timeout(e){let t=new X;return setTimeout(()=>t.abort(new DOMException(`This signal is timeout in ${e}ms`,`TimeoutError`)),e),t.signal}static any(e){let t=new X;function n(){t.abort(this.reason),r()}function r(){for(let t of e)t.removeEventListener(`abort`,n)}for(let r of e)if(r.aborted){t.abort(r.reason);break}else r.addEventListener(`abort`,n);return t.signal}}class X{constructor(){Object.defineProperty(this,`signal`,{value:new Y,writable:!0,configurable:!0})}abort(e){let t=Ht(e),n=Vt(t);this.signal.reason=t,this.signal.dispatchEvent(n)}toString(){return`[object AbortController]`}}typeof Symbol<`u`&&Symbol.toStringTag&&(X.prototype[Symbol.toStringTag]=`AbortController`,Y.prototype[Symbol.toStringTag]=`AbortSignal`);function Wt(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 Gt(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!Wt({fetch:t,Request:n,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i}))return{fetch:t,Request:a};let a=n;(a&&!a.prototype.hasOwnProperty(`signal`)||i)&&(a=function(e,t){let r;t&&t.signal&&(r=t.signal,delete t.signal);let i=new n(e,t);return r&&Object.defineProperty(i,`signal`,{writable:!1,enumerable:!1,configurable:!0,value:r}),i},a.prototype=n.prototype);let o=t;return{fetch:(e,t)=>{let n=a&&a.prototype.isPrototypeOf(e)?e.signal:t?t.signal:void 0;if(n){let r;try{r=new DOMException(`Aborted`,`AbortError`)}catch{r=Error(`Aborted`),r.name=`AbortError`}if(n.aborted)return Promise.reject(r);let i=new Promise((e,t)=>{n.addEventListener(`abort`,()=>t(r),{once:!0})});return t&&t.signal&&delete t.signal,Promise.race([i,o(e,t)])}return o(e,t)},Request:a}}var Z=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window,Q=`fetch`in Z&&Wt({fetch:Z.fetch,Request:Z.Request,AbortController:Z.AbortController}),$=Q?Gt({fetch:Z.fetch,Request:Z.Request,AbortController:Z.AbortController}):void 0,Kt=Q?$.fetch:Z.fetch,qt=Q?$.Request:Z.Request,Jt=Q?X:Z.AbortController,Yt=Q?Y:Z.AbortSignal,Xt=(e,t={})=>{let n=t.timeout||1,r=performance.now();return Z.setTimeout(()=>{e({get didTimeout(){return t.timeout?!1:performance.now()-r-1>n},timeRemaining(){return Math.max(0,1+(performance.now()-r))}})},1)},Zt=e=>Z.clearTimeout(e),Qt=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),$t=!Qt(Z.requestIdleCallback)||!Qt(Z.cancelIdleCallback),en=$t?Xt:Z.requestIdleCallback,tn=$t?Zt:Z.cancelIdleCallback,nn=(e,t,n)=>{if(typeof e.canParse==`function`)return e.canParse(t,n);try{return new e(t,n),!0}catch{return!1}};
|
package/esnext.esm.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.87-beta.0
|
|
3
|
+
* Thu, 02 Apr 2026 11:34:58 GMT
|
|
4
|
+
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-87/doc/
|
|
5
|
+
*/
|
|
6
|
+
var e=Object.defineProperty,t=e=>e;function n(e,n){this[e]=t.bind(null,n)}var r=(t,r)=>{for(var i in r)e(t,i,{get:r[i],enumerable:!0,configurable:!0,set:n.bind(r,i)})},i=`1.0.87-beta.0`;class a{subscriptions=[];unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(e=>{typeof e==`function`?e():e.unsubscribe()})}add(e){return this.subscriptions.push(e),this}}var o=e=>{throw Error(`${e} is value of unexpected type`)},s=e=>{},c=()=>{},l=e=>{throw console.error(e),e},u=e=>{console.error(e)};class d{suppressErrors=!1;constructor(e){e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?u:l,r;r=t?typeof t==`function`?{next:t,error:c}:{next:e=>t.next(e),error:e=>t.error?.(e)}:{next:n,error:c};let i=typeof e==`function`?{next:t=>{try{let n=e(t);n instanceof Promise&&n.catch(e=>r.next(e))}catch(e){r.next(e)}},error:e=>r.next(e)}:{next:t=>e.next(t),error:t=>e.error?e.error(t):r.next(t)},s;try{s=this._subscribe(i)}catch(e){i.error?.(e)}return new a().add(()=>{switch(i.next=c,i.error=c,typeof s){case`function`:s();return;case`object`:s.unsubscribe();return;case`undefined`:return;default:return o(s)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class f extends d{keyCounter=0;subscribers=new Map;constructor(){super()}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>t.error?.(e))}_subscribe(e){let t=this.keyCounter++;return this.subscribers.set(t,e),new a().add(()=>this.subscribers.delete(t))}}class p{log$=new f;logs=[];log=e=>{let t={...e,timestamp:Date.now()};this.logs.push(t),this.log$.next(t)};createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch{n={message:"error in `createCustomLog`",component:`Logger`}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>({component:e,...t}))}getAllLogs=()=>this.logs}function m(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function h(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function g(e){return e!=null}function _(e){return e==null}var v=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>g(t)));function y(e,t){if(!e?.length)throw Error(t)}function b(e,t){if(e?.length)throw Error(t)}var x=()=>globalThis,S=(e=x())=>!!(e.window&&e.screen),C=(e,t,n)=>new Promise((r,i)=>{t.addEventListener(`abort`,()=>{s(),l.remove()});let a=()=>{s(),i(`error`)},o=()=>{s(),r()},s=()=>{c&&clearTimeout(c),l.removeEventListener(`load`,o),l.removeEventListener(`error`,a)},c;n&&(c=x().setTimeout(()=>{s(),i(`timeout`)},n));let l=document.createElement(`script`);l.addEventListener(`load`,o),l.addEventListener(`error`,a),l.src=e,document.head.appendChild(l)}),w=typeof x().performance?.now==`function`?()=>x().performance.now():()=>Date.now(),T=()=>Math.trunc(w()),E=(e,t)=>async(...n)=>{let r=t(...n),i=e.aborted,a;for(;!i&&!e.aborted;)try{let e=await r.next(a);i=e.done??!1,a=e.value}catch(e){await r.throw(e)}return a},ee=(e,{start:t=0,factor:n=2,max:r=1/0,min:i=t,random:a=0}={})=>{let o=t;return o*=n**e,o*=1+(Math.random()*a*2-a),o=Math.round(o),o=Math.min(o,r),o=Math.max(o,i),o},te={};r(te,{set:()=>ie,remove:()=>oe,isPersistent:()=>ne,has:()=>ae,get:()=>re,clear:()=>se});var D,O,k=`vk-videoplayer-dummy-key-${Math.random()}`,A=()=>{if(O!==void 0)return O;try{localStorage.setItem(k,`test`),localStorage.removeItem(k),O=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(k),O=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)O=2;else throw e}else throw e}return O===2&&(D=new Map),O},ne=()=>A()===0,re=e=>{let t=A();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return D?.get(e);default:o(t)}},ie=(e,t)=>{let n=A();switch(n){case 0:try{localStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 1:try{sessionStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 2:D?.set(e,t);return;default:o(n)}},ae=e=>{let t=A();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return D?.has(e)??!1;default:return o(t),!1}},oe=e=>{let t=A();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:D?.delete(e);return;default:o(t)}},se=()=>{let e=A();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return D?.clear();default:o(e)}},ce=()=>{let e,t=[],n=x();try{e=n.self!==n.top}catch(t){t instanceof DOMException&&t.name===`SecurityError`?e=!0:(e=!1,console.error(t))}try{n.location?.ancestorOrigins&&(t=[...n.location.ancestorOrigins])}catch(e){console.error(e)}try{!t.length&&n.document.referrer&&(t=[new URL(n.document.referrer).origin])}catch(e){console.error(e)}return t=t.filter(e=>URL.canParse(e)),{isEmbed:e,origins:t,topOrigin:t.at(-1),immediateOrigin:t.at(0)}},le;(e=>{e.INVARIANT=`Invariant quality`,e.Q_144P=`144p`,e.Q_240P=`240p`,e.Q_360P=`360p`,e.Q_480P=`480p`,e.Q_576P=`576p`,e.Q_720P=`720p`,e.Q_1080P=`1080p`,e.Q_1440P=`1440p`,e.Q_2160P=`2160p`,e.Q_4320P=`4320p`})(le||={});var j={"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}},ue=(e,t)=>j[e].height>j[t].height,de=(e,t)=>j[e].height>=j[t].height,M=(e,t)=>j[e].height<j[t].height,fe=(e,t)=>j[e].height<=j[t].height,pe=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:M(e,t)?1:-1)[0],N=Object.keys(j).sort((e,t)=>M(e,t)?-1:1),me=(e,t=.02)=>[...N].find(n=>j[n].height*(1+t)>=e),he=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return N.find(e=>{let t=j[e];return t.width>=r&&t.height>=n})},ge=e=>j[e].height,P=e=>e===`Invariant quality`,_e=e=>e.every(e=>!P(e));function ve(e){if(P(e))throw Error(`Expected exact quality`)}var ye=e=>{switch(e){case`4320p`:return`8K`;case`2160p`:return`4K`;case`1440p`:return`QHD`;case`1080p`:return`FHD`;case`720p`:return`HD`;default:return``}},be=(e,t)=>{let n={};for(let r of Object.keys(t)){let i=t[r],a=e[r];Array.isArray(i)?n[r]=Array.isArray(a)?a:i:typeof i==`object`&&i?typeof a==`object`&&a&&!Array.isArray(a)?n[r]=be(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},xe=e=>{let t=``;return e>=3600&&(t+=Math.floor(e/3600)+`h`,e%=3600),e>=60&&(t+=Math.floor(e/60)+`m`,e%=60),e>0&&(t+=Math.floor(e)+`s`),t};function F(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof x().requestAnimationFrame==`function`;n&&(u=!!n.leading,d=`maxWait`in n,a=n?.maxWait?Math.max(+n?.maxWait||0,t):a,f=`trailing`in n?!!n.trailing:f);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(s&&x().cancelAnimationFrame(s),x().requestAnimationFrame(e)):setTimeout(e,t)}function g(e){if(p){x().cancelAnimationFrame(e);return}clearTimeout(e)}function _(e){return l=e,s=h(b,t),u?m(e):o}function v(e){let n=e-c,r=e-l,i=t-n;return d?Math.min(i,a-r):i}function y(e){let n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function b(){let e=Date.now();if(y(e))return S(e);s=h(b,v(e))}function S(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function C(){s!==void 0&&g(s),l=0,r=c=i=s=void 0}function w(){return s===void 0?o:S(Date.now())}function T(){return s!==void 0}function E(...e){let n=Date.now(),a=y(n);if(r=e,i=this,c=n,a){if(s===void 0)return _(c);if(d)return s=h(b,t),m(c)}return s===void 0&&(s=h(b,t)),o}return E.cancel=C,E.flush=w,E.pending=T,E}var I=(e,t=0,n)=>F(e,t,{leading:!0,trailing:!0,...n,maxWait:t}),L=(e,t)=>{if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let r in e){if(typeof t==`function`){let i=t(e[r],r,e,n);if(i!==void 0){n[r]=i;continue}}typeof e[r]==`object`?n[r]=L(e[r],t):n[r]=e[r]}return n},Se=e=>L(e);class Ce extends f{bufferSize;buffer=[];cursorEnd=-1;cursorStart=0;constructor(e){super(),this.bufferSize=e,this.buffer=Array(e)}next(e){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=e,this.subscribers.forEach(t=>t.next(e))}_subscribe(e){for(let t=this.cursorStart;t<=this.cursorEnd;t++)e.next(this.buffer[t%this.bufferSize]);let t=this.keyCounter++;return this.subscribers.set(t,e),new a().add(()=>this.subscribers.delete(t))}}class we extends f{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){let t=super._subscribe(e);return e.next(this.value),t}}function Te(e){return new d(t=>{let n={},r=Object.keys(e).length,i=e=>i=>{e in n||r--,n[e]=i,r===0&&t.next(n)};return Object.entries(e).reduce((e,[t,n])=>e.add(n.subscribe(i(t))),new a)})}function Ee(...e){return new d(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new a))}var De=e=>new d(t=>{let n=x().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>x().clearTimeout(n)}),Oe=e=>new d(t=>{let n=x(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}}),ke=e=>new d(t=>{e.forEach(e=>t.next(e))}),Ae=(e,t)=>new d(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class je extends a{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Me(e){return t=>new d(n=>t.subscribe(new Ne(n,e)))}class Ne{destination;size;lastValues=[];constructor(e,t){this.destination=e,this.size=t}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 Pe={leading:!1,trailing:!0};function Fe(e,t=Pe){return n=>new d(r=>n.subscribe(new Ie(r,e,t)))}class Ie{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e;let t=x();g(this.timeout)?t.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=t.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(e){if(this.destination.error)this.destination.error(e);else throw e}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}}var Le={leading:!0,trailing:!1};function Re(e,t=Le){return n=>new d(r=>n.subscribe(new ze(r,e,t)))}class ze{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,_(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=x().setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}}function Be(e){return t=>new d(n=>t.subscribe(new Ve(n,e)))}class Ve{destination;predicate;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}var He=(e,t)=>{let n=(e,t)=>{let n=Object.keys(e);for(let r in t)if(!n.includes(r)||t[r]!==e[r])return!1;return!0};return n(e,t)&&n(t,e)},Ue=(e,t)=>e instanceof Object&&t instanceof Object?He(e,t):e===t;function We(e=Ue){return t=>new d(n=>t.subscribe(new Ke(n,e)))}var Ge={};class Ke{destination;predicate;lastValue=Ge;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===Ge||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?{...e}:e}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function qe(e){return t=>new d(n=>t.subscribe(new Je(n,e)))}class Je{destination;mapper;constructor(e,t){this.destination=e,this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(e){throw this.error(e),e}this.destination.next(t)}error(e){this.destination.error?.(e)}}function Ye(e){return qe(()=>e)}function Xe(){return e=>new d(t=>{let n=!1,r=!1,i=e.subscribe(e=>{n||(n=!0,t.next(e)),r&&i.unsubscribe()},e=>{n=!0,t.error?.(e),r&&i.unsubscribe()});return r=!0,n&&i.unsubscribe(),i})}function Ze(){return e=>new d(t=>e.subscribe(new Qe(t)))}class Qe{destination;last;hasLast=!1;constructor(e){this.destination=e}next(e){let t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){this.destination.error?.(e)}}function $e(e){return t=>new d(n=>t.subscribe(new et(n,e)))}class et{destination;effect;constructor(e,t){this.destination=e,this.effect=t}next(e){try{this.effect(e)}catch(e){throw this.error(e),e}this.destination.next(e)}error(e){this.destination.error?.(e)}}function tt(e){return t=>new d(n=>t.subscribe(new nt(n,e)))}class nt{destination;count;constructor(e,t){this.destination=e,this.count=t,t<0&&this.destination.error?.(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 rt(e=0){return t=>{let n=0,r=new Ce(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new d(e=>(n++,a(r.subscribe(e))))}}var it=300,at=(e,t=it)=>new d(n=>{let r=x(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!S(r))return;let o=new r.ResizeObserver(I(e=>{let t=e[0];if(!t)return;let r,i;t.contentBoxSize&&t.contentBoxSize[0]?(i=t.contentBoxSize[0].blockSize,r=t.contentBoxSize[0].inlineSize):t.contentRect&&(r=t.contentRect.width,i=t.contentRect.height),g(r)&&g(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),R=(e,t=6,n=`.`)=>{let r={};for(let i in e)if(!(!e.hasOwnProperty(i)||e[i]instanceof HTMLElement||!t))if(typeof e[i]==`object`&&e[i]!==null){let a=R(e[i],t-1);for(let e in a)a.hasOwnProperty(e)&&(r[i+n+e]=a[e])}else r[i]=e[i];return r},ot=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},st=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},ct=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),lt=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),ut=e=>e!==void 0&&e!==``?e:lt().toString();function dt(e,t,n){if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];let r=1;for(;r<t.length&&t[r]<e;)r++;r>=t.length&&(r=t.length-1);let i=t[r-1],a=t[r],o=n[r-1],s=n[r];return e===i?o:e===a?s:o+(e-i)/(a-i)*(s-o)}function ft(e,t,n){if(e<=0||n<0)return[];let r=[],i=Math.floor((e-1)/2),a=Math.floor(e/2),o=t-i,s=t+a;o<0&&(s+=Math.abs(o),o=0),s>n&&(o-=s-n,s=n),o=Math.max(0,o),s=Math.min(n,s);for(let e=o;e<=s;e++)r.push(e);return r}var z=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),pt=e=>{if(!z(e))throw e},mt=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?R(n):{value:n})},B=(e={})=>{let t=e=>{let t=e;return e===void 0?t=`undefined`:e===null?t=`null`:(typeof e==`number`||typeof e==`boolean`)&&(t=e.toString()),t},n={};for(let r in e)Array.isArray(e[r])?n[r]=e[r].map(t):n[r]=t(e[r]);return n};class V{dynamicImportTimeout=5e3;span;context;childTracers=[];initPromise;static rootTracer;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t}){V.dynamicImportStatus===`not_started`&&(V.dynamicImportPromise=this.loadOpentelemetry());let n=Date.now();this.initPromise=V.dynamicImportPromise.then(r=>{V.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t},n)})}init({name:e,getParentContext:t},n){this.span=V.rootTracer.startSpan(e,{startTime:n},t?.()),this.context=V.dynamicImports.opentelemetryApi.trace.setSpan(V.dynamicImports.opentelemetryApi.context.active(),this.span)}async loadOpentelemetry(){if(V.dynamicImportStatus===`not_started`){V.dynamicImportStatus=`in_progress`;try{let e=new Promise((e,t)=>setTimeout(t,this.dynamicImportTimeout)),t=Promise.all([import(`@opentelemetry/api`),import(`@opentelemetry/sdk-trace-web`),import(`@apptracer/opentelemetry`)]),[n,r,i]=await Promise.race([t,e]);V.dynamicImports={opentelemetryApi:n,opentelemetrySdk:r,tracer:i},V.dynamicImportStatus=`completed`}catch{V.dynamicImportStatus=`failed`}}}isComponentTracerNotInitialized(){return _(this.span)||V.dynamicImportStatus===`failed`}log(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...B(t),type:`log`},n)})}error(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...B(t),type:`error`},n)})}critical(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...B(t),type:`critical`},n)})}createComponentTracer(e){let t=new V({name:e,getParentContext:()=>this.context});return this.childTracers.push(t),t}end(){this.initPromise.then(e=>{this.isComponentTracerNotInitialized()||(this.childTracers.forEach(e=>e.end()),this.span.end())})}}class ht extends V{spanExporter;constructor(){super({name:`Root`})}init({name:e,getParentContext:t},n){let r=V.dynamicImports.tracer.initTracerOpenTelemetry({serviceName:`videoplayer-sdk-web`,appToken:`L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb`,spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0}}).getProvider(),i=new V.dynamicImports.tracer.TracerMemorySpanExporter;this.spanExporter=i,r.addSpanProcessor(new V.dynamicImports.tracer.TracerAllSpansProcessor({startedSpansExporter:i})),V.rootTracer=r.getTracer(`sdk-videoplayer-tracer`),super.init({name:e,getParentContext:t},n)}getFinishedSpans(){if(!this.isComponentTracerNotInitialized())return this.spanExporter?.getJsonData()}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}}class H{fakeTraceId;constructor(e){}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new H({name:e})}end(){}getFinishedSpans(){}getTraceId(){return this.fakeTraceId}}class gt{static createRootTracer(e=!1){return e?new ht:new H}}var U;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.FATAL=`fatal`})(U||={});var W;(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`})(W||={});var _t=`vk.com`,vt=async(e,t,n)=>{let r=new URL(`https://${_t}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),yt(await(await fetch(r.toString())).json(),n)},yt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),bt(n)])),bt=e=>Array.isArray(e)?e[0]:e,G;(e=>{e.RU=`ru`,e.EN=`en`})(G||={});var K=`__vk_vp_internals_exposure`;class xt{playerId;type;constructor(e,t){this.playerId=t,this.type=e,this.initWindowObjects()}getWindowObject(){if(typeof window>`u`)return{};let e=this.playerId,t=this.type;return window[K]?.[e]?.[t]??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[K]||(window[K]={}),window[K][e]||(window[K][e]={}),window[K][e][t]||(window[K][e][t]={})}expose(e){typeof window>`u`||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[K]&&window[K][e]&&window[K][e][t]&&(delete window[K][e][t],Object.keys(window[K][e]).length||delete window[K][e],Object.keys(window[K]).length||delete window[K])}}var q={};r(q,{subscribe:()=>Tt,push:()=>wt,destroy:()=>Ct,create:()=>St});var J=new Map,St=(e,t)=>J.set(e,t??[]),Ct=e=>J.delete(e),wt=(e,t)=>{let n=J.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Tt=(e,t)=>{let n=J.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);J.set(e,t)}},Et=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`,Dt=e=>v({id:e.id,message:e.message,category:e.category,data:Ot(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Ot(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var kt=e=>{if(e.thrown instanceof Error)return e.thrown.name=e.id,e.thrown;let t=Error(e.message);return t.name=e.id,t},At=()=>{try{let{origin:e,pathname:t,search:n,hostname:r}=x().document.location;return r===`localhost`?void 0:{url:e+t,...new URLSearchParams(n).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{})}}catch(e){console.error(e)}};class Y{static tracerErrorMap=new Map;static appTracerModule=null;static loadPromise=null;dynamicImportTimeout=5e3;componentName;subscription=new a;options;envParams;context;constructor(e,t,n,r){this.componentName=e,this.options=t,this.envParams=n,this.context=r,this.options.enabled&&(this.loadModule(),this.init())}error(e,t){let{blackErrorCategoryList:n,blackErrorIdList:r,sampleRate:i,whiteErrorCategoryList:a,whiteErrorIdList:o}=this.options,{id:s,category:c}=e;n.length&&n.includes(c)||r.length&&r.includes(s)||a.length&&!a.includes(c)||o.length&&!o.includes(s)||Math.random()>=i||Y.tracerErrorMap.get(this.componentName)?.error(kt(e),{severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...Dt(e),...At()}})}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}async init(){try{if(await Y.loadPromise,Y.tracerErrorMap.has(this.componentName)||_(Y.appTracerModule))return;let{appTracerModule:e}=Y,{initTracerError:t,initTracerErrorUploader:n,addTracerPlugin:r,getTracerModules:i}=e,a=i(this.componentName),o=!a.error,s=a.error??t(this.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});o&&n(this.componentName,{appToken:Et,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),r(this.componentName,{name:`addedCategory`,errorBeforeAdd(e){let t=e.keys?.category??`wtf`;if(typeof t==`string`)return{issueKey:t}}}),Y.tracerErrorMap.set(this.componentName,s)}catch{}}loadModule(){g(Y.loadPromise)||(Y.loadPromise=(async()=>{try{let e=new Promise((e,t)=>x().setTimeout(t,this.dynamicImportTimeout));Y.appTracerModule=await Promise.race([e,import(`@apptracer/sdk/lite`)])}catch{Y.loadPromise=null}})())}}var{NativeAbortSignal:jt,NativeAbortController:Mt}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function Nt(e){let t;try{t=new Event(`abort`)}catch{typeof document<`u`?document.createEvent?(t=document.createEvent(`Event`),t.initEvent(`abort`,!1,!1)):(t=document.createEventObject(),t.type=`abort`):t={type:`abort`,bubbles:!1,cancelable:!1}}return t.reason=e,t}function Pt(e){if(e===void 0)if(typeof document>`u`)e=Error(`This operation was aborted`),e.name=`AbortError`;else try{e=new DOMException(`signal is aborted without reason`),Object.defineProperty(e,`name`,{value:`AbortError`})}catch{e=Error(`This operation was aborted`),e.name=`AbortError`}return e}class Ft{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;let n=this.listeners[e];for(let e=0,r=n.length;e<r;e++)if(n[e].callback===t){n.splice(e,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let t=this.listeners[e.type].slice();for(let n=0,r=t.length;n<r;n++){let r=t[n];try{r.callback.call(this,e)}catch(e){Promise.resolve().then(()=>{throw e})}r.options&&r.options.once&&this.removeEventListener(e.type,r.callback)}return!e.defaultPrevented}}class X extends Ft{constructor(){super(),this.listeners||Ft.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)}throwIfAborted(){let{aborted:e,reason:t=`Aborted`}=this;if(e)throw t}static timeout(e){let t=new Z;return setTimeout(()=>t.abort(new DOMException(`This signal is timeout in ${e}ms`,`TimeoutError`)),e),t.signal}static any(e){let t=new Z;function n(){t.abort(this.reason),r()}function r(){for(let t of e)t.removeEventListener(`abort`,n)}for(let r of e)if(r.aborted){t.abort(r.reason);break}else r.addEventListener(`abort`,n);return t.signal}}class Z{constructor(){Object.defineProperty(this,`signal`,{value:new X,writable:!0,configurable:!0})}abort(e){let t=Pt(e),n=Nt(t);this.signal.reason=t,this.signal.dispatchEvent(n)}toString(){return`[object AbortController]`}}typeof Symbol<`u`&&Symbol.toStringTag&&(Z.prototype[Symbol.toStringTag]=`AbortController`,X.prototype[Symbol.toStringTag]=`AbortSignal`);function It(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 Lt(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!It({fetch:t,Request:n,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i}))return{fetch:t,Request:a};let a=n;(a&&!a.prototype.hasOwnProperty(`signal`)||i)&&(a=function(e,t){let r;t&&t.signal&&(r=t.signal,delete t.signal);let i=new n(e,t);return r&&Object.defineProperty(i,`signal`,{writable:!1,enumerable:!1,configurable:!0,value:r}),i},a.prototype=n.prototype);let o=t;return{fetch:(e,t)=>{let n=a&&a.prototype.isPrototypeOf(e)?e.signal:t?t.signal:void 0;if(n){let r;try{r=new DOMException(`Aborted`,`AbortError`)}catch{r=Error(`Aborted`),r.name=`AbortError`}if(n.aborted)return Promise.reject(r);let i=new Promise((e,t)=>{n.addEventListener(`abort`,()=>t(r),{once:!0})});return t&&t.signal&&delete t.signal,Promise.race([i,o(e,t)])}return o(e,t)},Request:a}}var Q=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window,$=`fetch`in Q&&It({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}),Rt=$?Lt({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,zt=$?Rt.fetch:Q.fetch,Bt=$?Rt.Request:Q.Request,Vt=$?Z:Q.AbortController,Ht=$?X:Q.AbortSignal,Ut=(e,t={})=>{let n=t.timeout||1,r=performance.now();return Q.setTimeout(()=>{e({get didTimeout(){return t.timeout?!1:performance.now()-r-1>n},timeRemaining(){return Math.max(0,1+(performance.now()-r))}})},1)},Wt=e=>Q.clearTimeout(e),Gt=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),Kt=!Gt(Q.requestIdleCallback)||!Gt(Q.cancelIdleCallback),qt=Kt?Ut:Q.requestIdleCallback,Jt=Kt?Wt:Q.cancelIdleCallback,Yt=(e,t,n)=>{if(typeof e.canParse==`function`)return e.canParse(t,n);try{return new e(t,n),!0}catch{return!1}};export{v as withoutNullable,he as videoSizeToQuality,ge as videoQualityToHeight,me as videoHeightToQuality,Yt as urlCanParsePolyfilled,De as timeout,xe as timeCodeToString,I as throttleFn,Re as throttle,$e as tap,pt as suppressAbort,tt as skip,rt as shareReplay,te as safeStorage,qt as requestIdleCallbackPolyfilled,Ze as pairwise,Xe as once,at as observeElementSize,ke as observableFrom,T as nowInt,w as now,c as noop,Ee as merge,Ye as mapTo,qe as map,vt as loadVKLangPack,st as isValidURL,_ as isNullable,g as isNonNullable,fe as isLowerOrEqual,M as isLower,P as isInvariantQuality,ct as isIntersecting,de as isHigherOrEqual,ue as isHigher,S as isBrowserWindow,z as isAbortError,Oe as interval,dt as interpolate,x as getWindow,ye as getVideoQualityLabel,mt as getTraceSubscriptionMethod,ft as getRangeAroundIndex,ut as getPlayerId,pe as getHighestQuality,ee as getExponentialDelay,Ae as fromEvent,R as flattenObject,We as filterChanged,Be as filter,be as fillWithDefault,zt as fetchPolyfilled,q as devNull,ce as detectEmbed,F as debounceFn,Fe as debounce,Te as combine,L as cloneDeepWith,Se as cloneDeep,ot as clearVideoElement,s as checkNever,Jt as cancelIdleCallbackPolyfilled,Me as buffer,ve as assertQualityIsExact,h as assertNullable,y as assertNotEmptyArray,m as assertNonNullable,o as assertNever,b as assertEmptyArray,_e as areQualitiesExact,C as addScript,E as abortable,le as VideoQuality,we as ValueSubject,W as VKNumericLanguage,i as VERSION,gt as TracerFactory,je as SubscriptionRemovable,a as Subscription,f as Subject,Bt as RequestPolyfilled,Ce as ReplaySubject,d as Observable,p as Logger,xt as InternalsExposure,G as InterfaceLanguage,K as INTERNAL_EXPOSE_GLOBAL_KEY,U as ErrorCategory,Y as AppTracer,Ht as AbortSignalPolyfilled,Vt as AbortControllerPolyfilled};
|
package/evergreen.esm.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.87-beta.0
|
|
3
|
+
* Thu, 02 Apr 2026 11:34:58 GMT
|
|
4
|
+
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-87/doc/
|
|
5
|
+
*/
|
|
6
|
+
var e=Object.defineProperty,t=e=>e;function n(e,n){this[e]=t.bind(null,n)}var r=(t,r)=>{for(var i in r)e(t,i,{get:r[i],enumerable:!0,configurable:!0,set:n.bind(r,i)})},i=`1.0.87-beta.0`;class a{subscriptions=[];unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(e=>{typeof e==`function`?e():e.unsubscribe()})}add(e){return this.subscriptions.push(e),this}}var o=e=>{throw Error(`${e} is value of unexpected type`)},s=e=>{},c=()=>{},l=e=>{throw console.error(e),e},u=e=>{console.error(e)};class d{suppressErrors=!1;constructor(e){e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?u:l,r;r=t?typeof t==`function`?{next:t,error:c}:{next:e=>t.next(e),error:e=>t.error?.(e)}:{next:n,error:c};let i=typeof e==`function`?{next:t=>{try{let n=e(t);n instanceof Promise&&n.catch(e=>r.next(e))}catch(e){r.next(e)}},error:e=>r.next(e)}:{next:t=>e.next(t),error:t=>e.error?e.error(t):r.next(t)},s;try{s=this._subscribe(i)}catch(e){i.error?.(e)}return new a().add(()=>{switch(i.next=c,i.error=c,typeof s){case`function`:s();return;case`object`:s.unsubscribe();return;case`undefined`:return;default:return o(s)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class f extends d{keyCounter=0;subscribers=new Map;constructor(){super()}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>t.error?.(e))}_subscribe(e){let t=this.keyCounter++;return this.subscribers.set(t,e),new a().add(()=>this.subscribers.delete(t))}}class p{log$=new f;logs=[];log=e=>{let t={...e,timestamp:Date.now()};this.logs.push(t),this.log$.next(t)};createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch{n={message:"error in `createCustomLog`",component:`Logger`}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>({component:e,...t}))}getAllLogs=()=>this.logs}function m(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function h(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function g(e){return e!=null}function _(e){return e==null}var v=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>g(t)));function y(e,t){if(!e?.length)throw Error(t)}function b(e,t){if(e?.length)throw Error(t)}var x=()=>globalThis,S=(e=x())=>!!(e.window&&e.screen),C=(e,t,n)=>new Promise((r,i)=>{t.addEventListener(`abort`,()=>{s(),l.remove()});let a=()=>{s(),i(`error`)},o=()=>{s(),r()},s=()=>{c&&clearTimeout(c),l.removeEventListener(`load`,o),l.removeEventListener(`error`,a)},c;n&&(c=x().setTimeout(()=>{s(),i(`timeout`)},n));let l=document.createElement(`script`);l.addEventListener(`load`,o),l.addEventListener(`error`,a),l.src=e,document.head.appendChild(l)}),w=typeof x().performance?.now==`function`?()=>x().performance.now():()=>Date.now(),T=()=>Math.trunc(w()),E=(e,t)=>async(...n)=>{let r=t(...n),i=e.aborted,a;for(;!i&&!e.aborted;)try{let e=await r.next(a);i=e.done??!1,a=e.value}catch(e){await r.throw(e)}return a},ee=(e,{start:t=0,factor:n=2,max:r=1/0,min:i=t,random:a=0}={})=>{let o=t;return o*=n**e,o*=1+(Math.random()*a*2-a),o=Math.round(o),o=Math.min(o,r),o=Math.max(o,i),o},D={};r(D,{set:()=>re,remove:()=>ae,isPersistent:()=>te,has:()=>ie,get:()=>ne,clear:()=>oe});var O,k,A=`vk-videoplayer-dummy-key-${Math.random()}`,j=()=>{if(k!==void 0)return k;try{localStorage.setItem(A,`test`),localStorage.removeItem(A),k=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(A),k=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)k=2;else throw e}else throw e}return k===2&&(O=new Map),k},te=()=>j()===0,ne=e=>{let t=j();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return O?.get(e);default:o(t)}},re=(e,t)=>{let n=j();switch(n){case 0:try{localStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 1:try{sessionStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 2:O?.set(e,t);return;default:o(n)}},ie=e=>{let t=j();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return O?.has(e)??!1;default:return o(t),!1}},ae=e=>{let t=j();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:O?.delete(e);return;default:o(t)}},oe=()=>{let e=j();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return O?.clear();default:o(e)}},se=()=>{let e,t=[],n=x();try{e=n.self!==n.top}catch(t){t instanceof DOMException&&t.name===`SecurityError`?e=!0:(e=!1,console.error(t))}try{n.location?.ancestorOrigins&&(t=[...n.location.ancestorOrigins])}catch(e){console.error(e)}try{!t.length&&n.document.referrer&&(t=[new URL(n.document.referrer).origin])}catch(e){console.error(e)}return t=t.filter(e=>URL.canParse(e)),{isEmbed:e,origins:t,topOrigin:t.at(-1),immediateOrigin:t.at(0)}},ce;(e=>{e.INVARIANT=`Invariant quality`,e.Q_144P=`144p`,e.Q_240P=`240p`,e.Q_360P=`360p`,e.Q_480P=`480p`,e.Q_576P=`576p`,e.Q_720P=`720p`,e.Q_1080P=`1080p`,e.Q_1440P=`1440p`,e.Q_2160P=`2160p`,e.Q_4320P=`4320p`})(ce||={});var M={"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}},le=(e,t)=>M[e].height>M[t].height,ue=(e,t)=>M[e].height>=M[t].height,N=(e,t)=>M[e].height<M[t].height,de=(e,t)=>M[e].height<=M[t].height,fe=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:N(e,t)?1:-1)[0],P=Object.keys(M).sort((e,t)=>N(e,t)?-1:1),pe=(e,t=.02)=>[...P].find(n=>M[n].height*(1+t)>=e),me=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return P.find(e=>{let t=M[e];return t.width>=r&&t.height>=n})},he=e=>M[e].height,F=e=>e===`Invariant quality`,ge=e=>e.every(e=>!F(e));function _e(e){if(F(e))throw Error(`Expected exact quality`)}var ve=e=>{switch(e){case`4320p`:return`8K`;case`2160p`:return`4K`;case`1440p`:return`QHD`;case`1080p`:return`FHD`;case`720p`:return`HD`;default:return``}},I=(e,t)=>{let n={};for(let r of Object.keys(t)){let i=t[r],a=e[r];Array.isArray(i)?n[r]=Array.isArray(a)?a:i:typeof i==`object`&&i?typeof a==`object`&&a&&!Array.isArray(a)?n[r]=I(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},ye=e=>{let t=``;return e>=3600&&(t+=Math.floor(e/3600)+`h`,e%=3600),e>=60&&(t+=Math.floor(e/60)+`m`,e%=60),e>0&&(t+=Math.floor(e)+`s`),t};function L(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof x().requestAnimationFrame==`function`;n&&(u=!!n.leading,d=`maxWait`in n,a=n?.maxWait?Math.max(+n?.maxWait||0,t):a,f=`trailing`in n?!!n.trailing:f);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(s&&x().cancelAnimationFrame(s),x().requestAnimationFrame(e)):setTimeout(e,t)}function g(e){if(p){x().cancelAnimationFrame(e);return}clearTimeout(e)}function _(e){return l=e,s=h(b,t),u?m(e):o}function v(e){let n=e-c,r=e-l,i=t-n;return d?Math.min(i,a-r):i}function y(e){let n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function b(){let e=Date.now();if(y(e))return S(e);s=h(b,v(e))}function S(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function C(){s!==void 0&&g(s),l=0,r=c=i=s=void 0}function w(){return s===void 0?o:S(Date.now())}function T(){return s!==void 0}function E(...e){let n=Date.now(),a=y(n);if(r=e,i=this,c=n,a){if(s===void 0)return _(c);if(d)return s=h(b,t),m(c)}return s===void 0&&(s=h(b,t)),o}return E.cancel=C,E.flush=w,E.pending=T,E}var R=(e,t=0,n)=>L(e,t,{leading:!0,trailing:!0,...n,maxWait:t}),z=(e,t)=>{if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let r in e){if(typeof t==`function`){let i=t(e[r],r,e,n);if(i!==void 0){n[r]=i;continue}}typeof e[r]==`object`?n[r]=z(e[r],t):n[r]=e[r]}return n},be=e=>z(e);class B extends f{bufferSize;buffer=[];cursorEnd=-1;cursorStart=0;constructor(e){super(),this.bufferSize=e,this.buffer=Array(e)}next(e){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=e,this.subscribers.forEach(t=>t.next(e))}_subscribe(e){for(let t=this.cursorStart;t<=this.cursorEnd;t++)e.next(this.buffer[t%this.bufferSize]);let t=this.keyCounter++;return this.subscribers.set(t,e),new a().add(()=>this.subscribers.delete(t))}}class xe extends f{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){let t=super._subscribe(e);return e.next(this.value),t}}function Se(e){return new d(t=>{let n={},r=Object.keys(e).length,i=e=>i=>{e in n||r--,n[e]=i,r===0&&t.next(n)};return Object.entries(e).reduce((e,[t,n])=>e.add(n.subscribe(i(t))),new a)})}function Ce(...e){return new d(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new a))}var we=e=>new d(t=>{let n=x().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>x().clearTimeout(n)}),Te=e=>new d(t=>{let n=x(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}}),Ee=e=>new d(t=>{e.forEach(e=>t.next(e))}),De=(e,t)=>new d(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Oe extends a{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function ke(e){return t=>new d(n=>t.subscribe(new Ae(n,e)))}class Ae{destination;size;lastValues=[];constructor(e,t){this.destination=e,this.size=t}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 je={leading:!1,trailing:!0};function Me(e,t=je){return n=>new d(r=>n.subscribe(new Ne(r,e,t)))}class Ne{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e;let t=x();g(this.timeout)?t.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=t.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(e){if(this.destination.error)this.destination.error(e);else throw e}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}}var Pe={leading:!0,trailing:!1};function Fe(e,t=Pe){return n=>new d(r=>n.subscribe(new Ie(r,e,t)))}class Ie{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,_(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=x().setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}}function Le(e){return t=>new d(n=>t.subscribe(new Re(n,e)))}class Re{destination;predicate;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}var ze=(e,t)=>{let n=(e,t)=>{let n=Object.keys(e);for(let r in t)if(!n.includes(r)||t[r]!==e[r])return!1;return!0};return n(e,t)&&n(t,e)},Be=(e,t)=>e instanceof Object&&t instanceof Object?ze(e,t):e===t;function Ve(e=Be){return t=>new d(n=>t.subscribe(new He(n,e)))}var V={};class He{destination;predicate;lastValue=V;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===V||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?{...e}:e}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function H(e){return t=>new d(n=>t.subscribe(new Ue(n,e)))}class Ue{destination;mapper;constructor(e,t){this.destination=e,this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(e){throw this.error(e),e}this.destination.next(t)}error(e){this.destination.error?.(e)}}function We(e){return H(()=>e)}function Ge(){return e=>new d(t=>{let n=!1,r=!1,i=e.subscribe(e=>{n||(n=!0,t.next(e)),r&&i.unsubscribe()},e=>{n=!0,t.error?.(e),r&&i.unsubscribe()});return r=!0,n&&i.unsubscribe(),i})}function Ke(){return e=>new d(t=>e.subscribe(new qe(t)))}class qe{destination;last;hasLast=!1;constructor(e){this.destination=e}next(e){let t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){this.destination.error?.(e)}}function Je(e){return t=>new d(n=>t.subscribe(new Ye(n,e)))}class Ye{destination;effect;constructor(e,t){this.destination=e,this.effect=t}next(e){try{this.effect(e)}catch(e){throw this.error(e),e}this.destination.next(e)}error(e){this.destination.error?.(e)}}function Xe(e){return t=>new d(n=>t.subscribe(new Ze(n,e)))}class Ze{destination;count;constructor(e,t){this.destination=e,this.count=t,t<0&&this.destination.error?.(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 Qe(e=0){return t=>{let n=0,r=new B(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new d(e=>(n++,a(r.subscribe(e))))}}var $e=300,et=(e,t=$e)=>new d(n=>{let r=x(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!S(r))return;let o=new r.ResizeObserver(R(e=>{let t=e[0];if(!t)return;let r,i;t.contentBoxSize&&t.contentBoxSize[0]?(i=t.contentBoxSize[0].blockSize,r=t.contentBoxSize[0].inlineSize):t.contentRect&&(r=t.contentRect.width,i=t.contentRect.height),g(r)&&g(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),U=(e,t=6,n=`.`)=>{let r={};for(let i in e)if(!(!e.hasOwnProperty(i)||e[i]instanceof HTMLElement||!t))if(typeof e[i]==`object`&&e[i]!==null){let a=U(e[i],t-1);for(let e in a)a.hasOwnProperty(e)&&(r[i+n+e]=a[e])}else r[i]=e[i];return r},tt=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},nt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},rt=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),it=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),at=e=>e!==void 0&&e!==``?e:it().toString();function ot(e,t,n){if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];let r=1;for(;r<t.length&&t[r]<e;)r++;r>=t.length&&(r=t.length-1);let i=t[r-1],a=t[r],o=n[r-1],s=n[r];return e===i?o:e===a?s:o+(e-i)/(a-i)*(s-o)}function st(e,t,n){if(e<=0||n<0)return[];let r=[],i=Math.floor((e-1)/2),a=Math.floor(e/2),o=t-i,s=t+a;o<0&&(s+=Math.abs(o),o=0),s>n&&(o-=s-n,s=n),o=Math.max(0,o),s=Math.min(n,s);for(let e=o;e<=s;e++)r.push(e);return r}var W=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),ct=e=>{if(!W(e))throw e},lt=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?U(n):{value:n})},G=(e={})=>{let t=e=>{let t=e;return e===void 0?t=`undefined`:e===null?t=`null`:(typeof e==`number`||typeof e==`boolean`)&&(t=e.toString()),t},n={};for(let r in e)Array.isArray(e[r])?n[r]=e[r].map(t):n[r]=t(e[r]);return n};class K{dynamicImportTimeout=5e3;span;context;childTracers=[];initPromise;static rootTracer;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t}){K.dynamicImportStatus===`not_started`&&(K.dynamicImportPromise=this.loadOpentelemetry());let n=Date.now();this.initPromise=K.dynamicImportPromise.then(r=>{K.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t},n)})}init({name:e,getParentContext:t},n){this.span=K.rootTracer.startSpan(e,{startTime:n},t?.()),this.context=K.dynamicImports.opentelemetryApi.trace.setSpan(K.dynamicImports.opentelemetryApi.context.active(),this.span)}async loadOpentelemetry(){if(K.dynamicImportStatus===`not_started`){K.dynamicImportStatus=`in_progress`;try{let e=new Promise((e,t)=>setTimeout(t,this.dynamicImportTimeout)),t=Promise.all([import(`@opentelemetry/api`),import(`@opentelemetry/sdk-trace-web`),import(`@apptracer/opentelemetry`)]),[n,r,i]=await Promise.race([t,e]);K.dynamicImports={opentelemetryApi:n,opentelemetrySdk:r,tracer:i},K.dynamicImportStatus=`completed`}catch{K.dynamicImportStatus=`failed`}}}isComponentTracerNotInitialized(){return _(this.span)||K.dynamicImportStatus===`failed`}log(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...G(t),type:`log`},n)})}error(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...G(t),type:`error`},n)})}critical(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...G(t),type:`critical`},n)})}createComponentTracer(e){let t=new K({name:e,getParentContext:()=>this.context});return this.childTracers.push(t),t}end(){this.initPromise.then(e=>{this.isComponentTracerNotInitialized()||(this.childTracers.forEach(e=>e.end()),this.span.end())})}}class ut extends K{spanExporter;constructor(){super({name:`Root`})}init({name:e,getParentContext:t},n){let r=K.dynamicImports.tracer.initTracerOpenTelemetry({serviceName:`videoplayer-sdk-web`,appToken:`L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb`,spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0}}).getProvider(),i=new K.dynamicImports.tracer.TracerMemorySpanExporter;this.spanExporter=i,r.addSpanProcessor(new K.dynamicImports.tracer.TracerAllSpansProcessor({startedSpansExporter:i})),K.rootTracer=r.getTracer(`sdk-videoplayer-tracer`),super.init({name:e,getParentContext:t},n)}getFinishedSpans(){if(!this.isComponentTracerNotInitialized())return this.spanExporter?.getJsonData()}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}}class q{fakeTraceId;constructor(e){}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new q({name:e})}end(){}getFinishedSpans(){}getTraceId(){return this.fakeTraceId}}class dt{static createRootTracer(e=!1){return e?new ut:new q}}var J;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.FATAL=`fatal`})(J||={});var Y;(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`})(Y||={});var ft=`vk.com`,pt=async(e,t,n)=>{let r=new URL(`https://${ft}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),mt(await(await fetch(r.toString())).json(),n)},mt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),ht(n)])),ht=e=>Array.isArray(e)?e[0]:e,X;(e=>{e.RU=`ru`,e.EN=`en`})(X||={});var Z=`__vk_vp_internals_exposure`;class gt{playerId;type;constructor(e,t){this.playerId=t,this.type=e,this.initWindowObjects()}getWindowObject(){if(typeof window>`u`)return{};let e=this.playerId,t=this.type;return window[Z]?.[e]?.[t]??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[Z]||(window[Z]={}),window[Z][e]||(window[Z][e]={}),window[Z][e][t]||(window[Z][e][t]={})}expose(e){typeof window>`u`||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[Z]&&window[Z][e]&&window[Z][e][t]&&(delete window[Z][e][t],Object.keys(window[Z][e]).length||delete window[Z][e],Object.keys(window[Z]).length||delete window[Z])}}var _t={};r(_t,{subscribe:()=>xt,push:()=>bt,destroy:()=>yt,create:()=>vt});var Q=new Map,vt=(e,t)=>Q.set(e,t??[]),yt=e=>Q.delete(e),bt=(e,t)=>{let n=Q.get(e);n&&(typeof n==`function`?n(t):n.push(t))},xt=(e,t)=>{let n=Q.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);Q.set(e,t)}},St=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`,Ct=e=>v({id:e.id,message:e.message,category:e.category,data:wt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function wt(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Tt=e=>{if(e.thrown instanceof Error)return e.thrown.name=e.id,e.thrown;let t=Error(e.message);return t.name=e.id,t},Et=()=>{try{let{origin:e,pathname:t,search:n,hostname:r}=x().document.location;return r===`localhost`?void 0:{url:e+t,...new URLSearchParams(n).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{})}}catch(e){console.error(e)}};class ${static tracerErrorMap=new Map;static appTracerModule=null;static loadPromise=null;dynamicImportTimeout=5e3;componentName;subscription=new a;options;envParams;context;constructor(e,t,n,r){this.componentName=e,this.options=t,this.envParams=n,this.context=r,this.options.enabled&&(this.loadModule(),this.init())}error(e,t){let{blackErrorCategoryList:n,blackErrorIdList:r,sampleRate:i,whiteErrorCategoryList:a,whiteErrorIdList:o}=this.options,{id:s,category:c}=e;n.length&&n.includes(c)||r.length&&r.includes(s)||a.length&&!a.includes(c)||o.length&&!o.includes(s)||Math.random()>=i||$.tracerErrorMap.get(this.componentName)?.error(Tt(e),{severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...Ct(e),...Et()}})}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}async init(){try{if(await $.loadPromise,$.tracerErrorMap.has(this.componentName)||_($.appTracerModule))return;let{appTracerModule:e}=$,{initTracerError:t,initTracerErrorUploader:n,addTracerPlugin:r,getTracerModules:i}=e,a=i(this.componentName),o=!a.error,s=a.error??t(this.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});o&&n(this.componentName,{appToken:St,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),r(this.componentName,{name:`addedCategory`,errorBeforeAdd(e){let t=e.keys?.category??`wtf`;if(typeof t==`string`)return{issueKey:t}}}),$.tracerErrorMap.set(this.componentName,s)}catch{}}loadModule(){g($.loadPromise)||($.loadPromise=(async()=>{try{let e=new Promise((e,t)=>x().setTimeout(t,this.dynamicImportTimeout));$.appTracerModule=await Promise.race([e,import(`@apptracer/sdk/lite`)])}catch{$.loadPromise=null}})())}}export{v as withoutNullable,me as videoSizeToQuality,he as videoQualityToHeight,pe as videoHeightToQuality,we as timeout,ye as timeCodeToString,R as throttleFn,Fe as throttle,Je as tap,ct as suppressAbort,Xe as skip,Qe as shareReplay,D as safeStorage,Ke as pairwise,Ge as once,et as observeElementSize,Ee as observableFrom,T as nowInt,w as now,c as noop,Ce as merge,We as mapTo,H as map,pt as loadVKLangPack,nt as isValidURL,_ as isNullable,g as isNonNullable,de as isLowerOrEqual,N as isLower,F as isInvariantQuality,rt as isIntersecting,ue as isHigherOrEqual,le as isHigher,S as isBrowserWindow,W as isAbortError,Te as interval,ot as interpolate,x as getWindow,ve as getVideoQualityLabel,lt as getTraceSubscriptionMethod,st as getRangeAroundIndex,at as getPlayerId,fe as getHighestQuality,ee as getExponentialDelay,De as fromEvent,U as flattenObject,Ve as filterChanged,Le as filter,I as fillWithDefault,_t as devNull,se as detectEmbed,L as debounceFn,Me as debounce,Se as combine,z as cloneDeepWith,be as cloneDeep,tt as clearVideoElement,s as checkNever,ke as buffer,_e as assertQualityIsExact,h as assertNullable,y as assertNotEmptyArray,m as assertNonNullable,o as assertNever,b as assertEmptyArray,ge as areQualitiesExact,C as addScript,E as abortable,ce as VideoQuality,xe as ValueSubject,Y as VKNumericLanguage,i as VERSION,dt as TracerFactory,Oe as SubscriptionRemovable,a as Subscription,f as Subject,B as ReplaySubject,d as Observable,p as Logger,gt as InternalsExposure,X as InterfaceLanguage,Z as INTERNAL_EXPOSE_GLOBAL_KEY,J as ErrorCategory,$ as AppTracer};
|
package/package.json
CHANGED
|
@@ -1,32 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/videoplayer-shared",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.87-beta.0",
|
|
4
4
|
"author": "vk.com",
|
|
5
5
|
"description": "Shared code for vk.com videoplayer",
|
|
6
6
|
"homepage": "https://vk.com",
|
|
7
7
|
"license": "GPL-3.0",
|
|
8
|
+
"main": "./esnext.cjs",
|
|
8
9
|
"module": "./esnext.esm.js",
|
|
9
10
|
"types": "./types/index.d.ts",
|
|
10
11
|
"type": "module",
|
|
11
12
|
"exports": {
|
|
12
13
|
".": {
|
|
13
14
|
"types": "./types/index.d.ts",
|
|
14
|
-
"import": "./esnext.esm.js"
|
|
15
|
+
"import": "./esnext.esm.js",
|
|
16
|
+
"require": "./esnext.cjs"
|
|
15
17
|
},
|
|
16
18
|
"./evergreen": {
|
|
17
19
|
"types": "./types/index.d.ts",
|
|
18
|
-
"import": "./evergreen.esm.js"
|
|
20
|
+
"import": "./evergreen.esm.js",
|
|
21
|
+
"require": "./evergreen.cjs"
|
|
19
22
|
},
|
|
20
23
|
"./esnext": {
|
|
21
24
|
"types": "./types/index.d.ts",
|
|
22
|
-
"import": "./esnext.esm.js"
|
|
25
|
+
"import": "./esnext.esm.js",
|
|
26
|
+
"require": "./esnext.cjs"
|
|
23
27
|
},
|
|
24
28
|
"./es2015": {
|
|
25
29
|
"types": "./types/index.d.ts",
|
|
26
|
-
"import": "./es2015.esm.js"
|
|
27
|
-
|
|
30
|
+
"import": "./es2015.esm.js",
|
|
31
|
+
"require": "./es2015.cjs"
|
|
32
|
+
},
|
|
33
|
+
"./evergreen.esm.js": "./evergeen.esm.js",
|
|
34
|
+
"./esnext.esm.js": "./esnext.esm.js",
|
|
35
|
+
"./esnext.cjs": "./esnext.cjs",
|
|
36
|
+
"./es2015.esm.js": "./es2015.esm.js",
|
|
37
|
+
"./es2015.cjs": "./es2015.cjs"
|
|
28
38
|
},
|
|
29
39
|
"files": [
|
|
40
|
+
"*.cjs",
|
|
30
41
|
"*.esm.js",
|
|
31
42
|
"**/*.d.ts"
|
|
32
43
|
],
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ISubscription } from "../reactive";
|
|
2
|
+
import type { ITracerError, ITracerErrorData } from "@apptracer/sdk/lite";
|
|
3
|
+
import type { AppTracerSdk, IAppTracerContext, IAppTracerEnvParams, IAppTracerOptions, IComponentName } from "./types";
|
|
4
|
+
import type { IError } from "../types";
|
|
5
|
+
export declare class AppTracer {
|
|
6
|
+
protected static readonly tracerErrorMap: Map<IComponentName, ITracerError>;
|
|
7
|
+
protected static appTracerModule: typeof AppTracerSdk | null;
|
|
8
|
+
protected static loadPromise: Promise<unknown> | null;
|
|
9
|
+
private readonly dynamicImportTimeout;
|
|
10
|
+
private readonly componentName;
|
|
11
|
+
private readonly subscription;
|
|
12
|
+
private readonly options;
|
|
13
|
+
private readonly envParams;
|
|
14
|
+
private readonly context?;
|
|
15
|
+
/**
|
|
16
|
+
* на каждый `componentName` создаётся 1 уникальный экземпляр трейсера.
|
|
17
|
+
* пересоздать его уже будет нельзя
|
|
18
|
+
*/
|
|
19
|
+
constructor(componentName: IComponentName, options: IAppTracerOptions, envParams: IAppTracerEnvParams, context?: IAppTracerContext);
|
|
20
|
+
error(error: IError, errorData?: Partial<Pick<ITracerErrorData, "severity">>): void;
|
|
21
|
+
addSubscription(item: Parameters<ISubscription["add"]>[0]): void;
|
|
22
|
+
destroy(): void;
|
|
23
|
+
private init;
|
|
24
|
+
private loadModule;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const APP_TOKEN = "gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ErrorCategory } from "../types";
|
|
2
|
+
import type * as AppTracerSdk from "@apptracer/sdk/lite";
|
|
3
|
+
import type { ITracerError, ITracerErrorData, ITracerUploaderConfig } from "@apptracer/sdk/lite";
|
|
4
|
+
export type { AppTracerSdk };
|
|
5
|
+
export type IComponentName = string & {};
|
|
6
|
+
export interface IAppTracerOptions {
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
sampleRate: number;
|
|
9
|
+
whiteErrorCategoryList: ErrorCategory[];
|
|
10
|
+
blackErrorCategoryList: ErrorCategory[];
|
|
11
|
+
whiteErrorIdList: string[];
|
|
12
|
+
blackErrorIdList: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface IAppTracerEnvParams {
|
|
15
|
+
version: ITracerUploaderConfig["versionName"];
|
|
16
|
+
env: ITracerUploaderConfig["environment"];
|
|
17
|
+
}
|
|
18
|
+
export type IAppTracerContext = Parameters<ITracerError["setErrorKeys"]>[0];
|
|
19
|
+
export type IAppTracerErrorDataKeys = ITracerErrorData["keys"];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IError } from "../types";
|
|
2
|
+
import type { IAppTracerErrorDataKeys } from "./types";
|
|
3
|
+
export declare const mapIErrorToAppTracerErrorKeys: (error: IError) => IAppTracerErrorDataKeys;
|
|
4
|
+
export declare const mapIErrorThrownToError: (error: IError) => Error;
|
|
5
|
+
export declare const mapLocationData: () => Record<string, string> | undefined;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ILogger } from "../Logger";
|
|
2
|
+
export declare const INTERNAL_EXPOSE_GLOBAL_KEY = "__vk_vp_internals_exposure";
|
|
3
|
+
export type ExposeType = "ui" | "core";
|
|
4
|
+
type InternalsExposureItem = {
|
|
5
|
+
logger?: ILogger;
|
|
6
|
+
[k: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
export type InternalsExposureData = {
|
|
9
|
+
[playerId: string]: {
|
|
10
|
+
ui?: InternalsExposureItem;
|
|
11
|
+
core?: InternalsExposureItem;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
declare global {
|
|
15
|
+
interface Window {
|
|
16
|
+
[INTERNAL_EXPOSE_GLOBAL_KEY]?: InternalsExposureData;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export declare class InternalsExposure {
|
|
20
|
+
private readonly playerId;
|
|
21
|
+
private readonly type;
|
|
22
|
+
constructor(type: ExposeType, playerId: string);
|
|
23
|
+
private getWindowObject;
|
|
24
|
+
private initWindowObjects;
|
|
25
|
+
expose(data: Record<string, unknown>): void;
|
|
26
|
+
destroy(): void;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Subject from "../reactive/Subject";
|
|
2
|
+
import type { ILogger, ILogInputEntry, IComponentLogger, ILogEntry } from "./types";
|
|
3
|
+
export declare class Logger implements ILogger {
|
|
4
|
+
log$: Subject<ILogEntry>;
|
|
5
|
+
private logs;
|
|
6
|
+
log: (inputEntry: ILogInputEntry) => void;
|
|
7
|
+
createCustomLog<TArgs extends unknown[]>(transform: (...args: TArgs) => ILogInputEntry): (...args: TArgs) => void;
|
|
8
|
+
createComponentLog(component: string): IComponentLogger;
|
|
9
|
+
getAllLogs: () => ILogEntry[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { IObservable } from "../reactive/types";
|
|
2
|
+
export interface ILogger {
|
|
3
|
+
log: (entry: ILogInputEntry) => void;
|
|
4
|
+
createCustomLog: <TArgs extends unknown[]>(transform: (...args: TArgs) => ILogInputEntry) => (...args: TArgs) => void;
|
|
5
|
+
createComponentLog: (component: string) => IComponentLogger;
|
|
6
|
+
getAllLogs: () => ILogEntry[];
|
|
7
|
+
log$: IObservable<ILogEntry>;
|
|
8
|
+
}
|
|
9
|
+
export interface ILogEntry {
|
|
10
|
+
/**
|
|
11
|
+
* Сообщение.
|
|
12
|
+
*/
|
|
13
|
+
message: string;
|
|
14
|
+
/**
|
|
15
|
+
* Компонент, в котором залогировано событие. (модуль, класс или функция)
|
|
16
|
+
*/
|
|
17
|
+
component: string;
|
|
18
|
+
/**
|
|
19
|
+
* Время, в которое случилось логируемое событие
|
|
20
|
+
*/
|
|
21
|
+
timestamp: number;
|
|
22
|
+
}
|
|
23
|
+
export type IComponentLogger = (entry: IComponentLogEntry) => void;
|
|
24
|
+
export type ILogInputEntry = Omit<ILogEntry, "timestamp">;
|
|
25
|
+
export interface IComponentLogEntry extends Omit<ILogInputEntry, "component">, IOptionalComponent {}
|
|
26
|
+
interface IOptionalComponent {
|
|
27
|
+
component?: ILogInputEntry["component"];
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IRootTracer, ITracer, ITracerParams } from "./types";
|
|
2
|
+
import type { Attributes } from "@opentelemetry/api";
|
|
3
|
+
export declare class FakeTracer implements IRootTracer {
|
|
4
|
+
private readonly fakeTraceId;
|
|
5
|
+
constructor(params?: Partial<ITracerParams>);
|
|
6
|
+
log(name: string, attributes?: Attributes): void;
|
|
7
|
+
error(name: string, attributes?: Attributes): void;
|
|
8
|
+
critical(name: string, attributes?: Attributes): void;
|
|
9
|
+
createComponentTracer(name: string): ITracer;
|
|
10
|
+
end(): void;
|
|
11
|
+
getFinishedSpans(): any | undefined;
|
|
12
|
+
getTraceId(): string;
|
|
13
|
+
}
|