@vkontakte/videoplayer-shared 1.0.90-dev.58f425a02.0 → 1.0.90-dev.c6e9376db.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 +3 -3
- package/es2015.esm.js +3 -3
- package/esnext.cjs +3 -3
- package/esnext.esm.js +3 -3
- package/evergreen.esm.js +3 -3
- package/package.json +1 -1
- package/types/di/container.d.ts +2 -0
- package/types/di/index.d.ts +2 -0
- package/types/di/types.d.ts +46 -0
- package/types/index.d.ts +1 -0
package/es2015.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.90-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.90-dev.c6e9376db.0
|
|
3
|
+
* Wed, 13 May 2026 13:37:01 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-90/doc/
|
|
5
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:()=>O,videoSizeToQuality:()=>Ce,videoQualityToHeight:()=>we,videoHeightToQuality:()=>Se,urlCanParsePolyfilled:()=>zn,timeout:()=>Ie,timeCodeToString:()=>ke,throttleFn:()=>je,throttle:()=>Je,tap:()=>st,suppressAbort:()=>xt,stringTrimStart:()=>Dn,stringTrimRight:()=>An,stringTrimLeft:()=>kn,stringTrimEnd:()=>On,stringReplaceAll:()=>En,stringPadStart:()=>Tn,stringPadEnd:()=>wn,stringMatchAll:()=>Cn,stringAt:()=>$,skip:()=>lt,shareReplay:()=>dt,safeStorage:()=>ce,requestIdleCallbackPolyfilled:()=>In,promiseWithResolvers:()=>un,promiseTry:()=>ln,promiseFinally:()=>cn,promiseAny:()=>sn,promiseAllSettled:()=>on,pairwise:()=>at,once:()=>it,observeElementSize:()=>pt,observableFrom:()=>ze,objectValues:()=>an,objectHasOwn:()=>rn,objectFromEntries:()=>tn,objectEntries:()=>en,nowInt:()=>ae,now:()=>ie,noop:()=>v,merge:()=>Fe,mapTo:()=>rt,map:()=>B,loadVKLangPack:()=>Ot,isValidURL:()=>ht,isNullable:()=>D,isNonNullable:()=>E,isLowerOrEqual:()=>ye,isLower:()=>F,isInvariantQuality:()=>I,isIntersecting:()=>gt,isHigherOrEqual:()=>ve,isHigher:()=>_e,isBrowserWindow:()=>ne,isAbortError:()=>H,interval:()=>Le,interpolate:()=>yt,includesPolyfilled:()=>Rn,globalThisPolyfill:()=>$t,getWindow:()=>k,getVideoQualityLabel:()=>De,getTraceSubscriptionMethod:()=>St,getRangeAroundIndex:()=>bt,getPlayerId:()=>vt,getHighestQuality:()=>be,getExponentialDelay:()=>se,fromEvent:()=>Be,flattenObject:()=>V,filterChanged:()=>et,filter:()=>Xe,fillWithDefault:()=>Oe,fetchPolyfilled:()=>yn,devNull:()=>Nt,detectEmbed:()=>he,debounceFn:()=>Ae,debounce:()=>Ge,combine:()=>Pe,cloneDeepWith:()=>L,cloneDeep:()=>Me,clearVideoElement:()=>mt,checkNever:()=>_,cancelIdleCallbackPolyfilled:()=>Ln,buffer:()=>He,atPolyfilled:()=>jn,assertQualityIsExact:()=>Ee,assertNullable:()=>T,assertNotEmptyArray:()=>ee,assertNonNullable:()=>w,assertNever:()=>g,assertEmptyArray:()=>te,arrayWith:()=>Qt,arrayToSpliced:()=>Zt,arrayToSorted:()=>Xt,arrayToReversed:()=>Yt,arrayIncludes:()=>Jt,arrayFlatMap:()=>qt,arrayFlat:()=>Kt,arrayFindLastIndex:()=>Gt,arrayFindLast:()=>Wt,arrayAt:()=>Ut,areQualitiesExact:()=>Te,addScript:()=>re,abortable:()=>oe,VideoQuality:()=>ge,ValueSubject:()=>Ne,VKNumericLanguage:()=>Et,VERSION:()=>m,TracerFactory:()=>wt,SubscriptionRemovable:()=>Ve,Subscription:()=>h,Subject:()=>S,RequestPolyfilled:()=>bn,ReplaySubject:()=>R,Observable:()=>x,Logger:()=>C,InternalsExposure:()=>Mt,InterfaceLanguage:()=>jt,INTERNAL_EXPOSE_GLOBAL_KEY:()=>K,ErrorCategory:()=>Tt,AppTracer:()=>J,AbortSignalPolyfilled:()=>Sn,AbortControllerPolyfilled:()=>xn}),module.exports=c(p);var m=`1.0.90-dev.58f425a02.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 C{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 w(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function T(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function E(e){return e!=null}function D(e){return e==null}var O=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>E(t)));function ee(e,t){if(!e?.length)throw Error(t)}function te(e,t){if(e?.length)throw Error(t)}var k=()=>globalThis,ne=(e=k())=>!!(e.window&&e.screen),re=(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=k().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)}),ie=typeof k().performance?.now==`function`?()=>k().performance.now():()=>Date.now(),ae=()=>Math.trunc(ie()),oe=(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}),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={};f(ce,{set:()=>de,remove:()=>pe,isPersistent:()=>le,has:()=>fe,get:()=>ue,clear:()=>me});var A,j,M=`vk-videoplayer-dummy-key-${Math.random()}`,N=()=>{if(j!==void 0)return j;try{localStorage.setItem(M,`test`),localStorage.removeItem(M),j=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(M),j=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)j=2;else throw e}else throw e}return j===2&&(A=new Map),j},le=()=>N()===0,ue=e=>{let t=N();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return A?.get(e);default:g(t)}},de=(e,t)=>{let n=N();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:A?.set(e,t);return;default:g(n)}},fe=e=>{let t=N();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return A?.has(e)??!1;default:return g(t),!1}},pe=e=>{let t=N();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:A?.delete(e);return;default:g(t)}},me=()=>{let e=N();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return A?.clear();default:g(e)}},he=()=>{let e,t=[],n=k();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)}},ge;(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`})(ge||={});var P={"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}},_e=(e,t)=>P[e].height>P[t].height,ve=(e,t)=>P[e].height>=P[t].height,F=(e,t)=>P[e].height<P[t].height,ye=(e,t)=>P[e].height<=P[t].height,be=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:F(e,t)?1:-1)[0],xe=Object.keys(P).sort((e,t)=>F(e,t)?-1:1),Se=(e,t=.02)=>[...xe].find(n=>P[n].height*(1+t)>=e),Ce=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return xe.find(e=>{let t=P[e];return t.width>=r&&t.height>=n})},we=e=>P[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``}},Oe=(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]=Oe(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},ke=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 Ae(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof k().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&&k().cancelAnimationFrame(s),k().requestAnimationFrame(e)):setTimeout(e,t)}function g(e){if(p){k().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 C(){return s===void 0?o:x(Date.now())}function w(){return s!==void 0}function T(...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 T.cancel=S,T.flush=C,T.pending=w,T}var je=(e,n=0,r)=>Ae(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},Me=e=>L(e);class R 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 Ne 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 Pe(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 Fe(...e){return new x(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new h))}var Ie=e=>new x(t=>{let n=k().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>k().clearTimeout(n)}),Le=e=>new x(t=>{let n=k(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function Re(e){return new x(t=>{if(e instanceof Promise){let n=!1;return e.then(e=>{n||t.next(e)}).catch(e=>{n||t.error?.call(t,e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var ze=Re,Be=(e,t)=>new x(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Ve extends h{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function He(e){return t=>new x(n=>t.subscribe(new Ue(n,e)))}class Ue{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 We={leading:!1,trailing:!0};function Ge(e,t=We){return n=>new x(r=>n.subscribe(new Ke(r,e,t)))}class Ke{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=k();E(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 qe={leading:!0,trailing:!1};function Je(e,t=qe){return n=>new x(r=>n.subscribe(new Ye(r,e,t)))}class Ye{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,D(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=k().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 Xe(e){return t=>new x(n=>t.subscribe(new Ze(n,e)))}class Ze{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 Qe=(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)},$e=(e,t)=>e instanceof Object&&t instanceof Object?Qe(e,t):e===t;function et(e=$e){return t=>new x(n=>t.subscribe(new tt(n,e)))}var z={};class tt{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 x(n=>t.subscribe(new nt(n,e)))}class nt{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 rt(e){return B(()=>e)}function it(){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 at(){return e=>new x(t=>e.subscribe(new ot(t)))}class ot{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 st(e){return t=>new x(n=>t.subscribe(new ct(n,e)))}class ct{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 lt(e){return t=>new x(n=>t.subscribe(new ut(n,e)))}class ut{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 dt(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 x(e=>(n++,a(r.subscribe(e))))}}var ft=300,pt=(e,t=ft)=>new x(n=>{let r=k(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!ne(r))return;let o=new r.ResizeObserver(je(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),E(r)&&E(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},mt=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},ht=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},gt=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),_t=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),vt=e=>e!==void 0&&e!==``?e:_t().toString();function yt(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 bt(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),xt=e=>{if(!H(e))throw e},St=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){let{opentelemetryApi:r}=W.dynamicImports,{context:i,trace:a}=r;this.span=W.rootTracer.startSpan(e,{startTime:n},t?.()),this.context=a.setSpan(i.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`),import(`@opentelemetry/resources`),import(`@opentelemetry/semantic-conventions`)]),[r,i,a,o,s]=yield Promise.race([n,t]);W.dynamicImports={opentelemetryApi:r,opentelemetrySdk:i,tracer:a,opentelemetryResources:o,opentelemetrySemanticConventions:s},W.dynamicImportStatus=`completed`}catch{W.dynamicImportStatus=`failed`}}})()}isComponentTracerNotInitialized(){return D(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 Ct extends W{constructor(){super({name:`Root`})}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=W.dynamicImports,{TracerUploadSpanExporter:s}=r,{WebTracerProvider:c,BatchSpanProcessor:l}=a,{resourceFromAttributes:u}=i,{ATTR_SERVICE_NAME:d}=o,f=new c({resource:u({[d]:`videoplayer-sdk-web`}),spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0},spanProcessors:[new l(new s({appToken:`L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb`}))]});f.register(),W.rootTracer=f.getTracer(`sdk-videoplayer-tracer`),super.init({name:e,getParentContext:t},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}}class G{constructor(t){e(this,`fakeTraceId`,void 0)}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new G({name:e})}end(){}getTraceId(){return this.fakeTraceId}}class wt{static createRootTracer(e=!1){return e?new Ct:new G}}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 K=`__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[K])==null||(e=e[t])==null?void 0:e[n])??{}}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 Nt={};f(Nt,{subscribe:()=>Lt,push:()=>It,destroy:()=>Ft,create:()=>Pt});var q=new Map,Pt=(e,t)=>q.set(e,t??[]),Ft=e=>q.delete(e),It=(e,t)=>{let n=q.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Lt=(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)}},Rt=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`,zt=e=>O({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=>{let t=e.thrown instanceof Error&&!Object.isFrozen(e.thrown)?e.thrown:Error(e.message);return t.name=e.id,t},Ht=()=>{try{var e;let{origin:n,pathname:r,search:i,hostname:a}=((e=k())==null||(e=e.document)==null?void 0:e.location)??{};return!a||a===`localhost`?void 0:t({url:n+r},new URLSearchParams(i).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{}))}catch{}};class J{constructor(n,r,i,a){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),e(this,`isEmbed`,void 0),e(this,`embedParent`,void 0),this.componentName=n,this.options=r,this.envParams=i,this.context=t({},a);let{isEmbed:o,topOrigin:s}=he();this.isEmbed=o,this.embedParent=s?new URL(s).hostname:void 0,this.options.enabled&&(this.loadModule(),this.init())}updateContext(e){Object.assign(this.context,e)}error(e,n){let{blackErrorCategoryList:r,blackErrorIdList:i,sampleRate:a,whiteErrorCategoryList:o,whiteErrorIdList:s}=this.options,{id:c,category:l}=e;if(r.length&&r.includes(l)||i.length&&i.includes(c)||o.length&&!o.includes(l)||s.length&&!s.includes(c)||Math.random()>=a)return;let u=J.tracerErrorMap.get(this.componentName);try{let r=Vt(e);u?.error(r,{crashIdSource:r.name,severity:n?.severity??(e.traceAsLog?`debug`:void 0),keys:t(t(t(t({},this.context),zt(e)),Ht()),this.isEmbed&&this.embedParent&&{iframe_host:this.embedParent})})}catch(e){console.error(e)}}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}init(){var e=this;return n(function*(){try{if(yield J.loadPromise,J.tracerErrorMap.has(e.componentName)||D(J.appTracerModule))return;let{appTracerModule:t}=J,{initTracerError:n,initTracerErrorUploader:r,getTracerModules:i}=t,a=i(e.componentName),o=!a.error,s=a.error??n(e.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});E(e.options.userId)&&s.setUserId(e.options.userId),o&&r(e.componentName,{appToken:Rt,environment:e.envParams.env,versionCode:1,versionName:e.envParams.version}),J.tracerErrorMap.set(e.componentName,s)}catch(e){console.error(e)}})()}loadModule(){var e=this;E(J.loadPromise)||(J.loadPromise=function(){var t=n(function*(){try{let t=new Promise((t,n)=>k().setTimeout(n,e.dynamicImportTimeout));J.appTracerModule=yield Promise.race([t,import(`@apptracer/sdk/lite`)])}catch(e){J.loadPromise=null,console.error(e)}});return function(){return t.apply(this,arguments)}}()())}}e(J,`tracerErrorMap`,new Map),e(J,`appTracerModule`,null),e(J,`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 Y 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 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=mn(e),n=pn(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 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 Z=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window,Q=`fetch`in Z&&gn({fetch:Z.fetch,Request:Z.Request,AbortController:Z.AbortController}),vn=Q?_n({fetch:Z.fetch,Request:Z.Request,AbortController:Z.AbortController}):void 0,yn=Q?vn.fetch:Z.fetch,bn=Q?vn.Request:Z.Request,xn=Q?X:Z.AbortController,Sn=Q?Y:Z.AbortSignal,$=(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*Cn(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 wn=(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)},Tn=(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},En=(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)},Dn=e=>e.replace(/^\s+/,``),On=e=>e.replace(/\s+$/,``),kn=Dn,An=On,jn=(e,t)=>typeof e==`string`?$(e,t):Ut(e,t),Mn=(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)},Nn=e=>Z.clearTimeout(e),Pn=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),Fn=!Pn(Z.requestIdleCallback)||!Pn(Z.cancelIdleCallback),In=Fn?Mn:Z.requestIdleCallback,Ln=Fn?Nn:Z.cancelIdleCallback,Rn=(e,t,n)=>typeof e==`string`?e.includes(t,n):Jt(e,t,n),zn=(e,t,n)=>{if(typeof e.canParse==`function`)return e.canParse(t,n);try{return new e(t,n),!0}catch{return!1}};
|
|
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:()=>D,videoSizeToQuality:()=>we,videoQualityToHeight:()=>Te,videoHeightToQuality:()=>Ce,urlCanParsePolyfilled:()=>Gn,timeout:()=>Re,timeCodeToString:()=>Ae,throttleFn:()=>Me,throttle:()=>Xe,tap:()=>ut,suppressAbort:()=>wt,stringTrimStart:()=>Pn,stringTrimRight:()=>In,stringTrimLeft:()=>Fn,stringTrimEnd:()=>$,stringReplaceAll:()=>Nn,stringPadStart:()=>Mn,stringPadEnd:()=>jn,stringMatchAll:()=>An,stringAt:()=>kn,skip:()=>ft,shareReplay:()=>mt,safeStorage:()=>le,requestIdleCallbackPolyfilled:()=>Hn,promiseWithResolvers:()=>gn,promiseTry:()=>hn,promiseFinally:()=>mn,promiseAny:()=>pn,promiseAllSettled:()=>fn,pairwise:()=>ct,once:()=>st,observeElementSize:()=>gt,observableFrom:()=>Ve,objectValues:()=>dn,objectHasOwn:()=>un,objectFromEntries:()=>cn,objectEntries:()=>sn,nowInt:()=>oe,now:()=>ae,noop:()=>v,merge:()=>Le,mapTo:()=>ot,map:()=>L,loadVKLangPack:()=>jt,isValidURL:()=>vt,isNullable:()=>E,isNonNullable:()=>T,isLowerOrEqual:()=>be,isLower:()=>P,isInvariantQuality:()=>F,isIntersecting:()=>yt,isHigherOrEqual:()=>ye,isHigher:()=>ve,isBrowserWindow:()=>re,isAbortError:()=>z,interval:()=>ze,interpolate:()=>St,includesPolyfilled:()=>Wn,globalThisPolyfill:()=>on,getWindow:()=>O,getVideoQualityLabel:()=>Oe,getTraceSubscriptionMethod:()=>Tt,getRangeAroundIndex:()=>Ct,getPlayerId:()=>xt,getHighestQuality:()=>xe,getExponentialDelay:()=>ce,fromEvent:()=>He,flattenObject:()=>R,filterChanged:()=>nt,filter:()=>Qe,fillWithDefault:()=>ke,fetchPolyfilled:()=>Tn,diContainer:()=>Jt,devNull:()=>It,detectEmbed:()=>ge,debounceFn:()=>je,debounce:()=>qe,combine:()=>Ie,cloneDeepWith:()=>I,cloneDeep:()=>Ne,clearVideoElement:()=>_t,checkNever:()=>_,cancelIdleCallbackPolyfilled:()=>Un,buffer:()=>We,atPolyfilled:()=>Ln,assertQualityIsExact:()=>De,assertNullable:()=>w,assertNotEmptyArray:()=>te,assertNonNullable:()=>C,assertNever:()=>g,assertEmptyArray:()=>ne,arrayWith:()=>an,arrayToSpliced:()=>rn,arrayToSorted:()=>nn,arrayToReversed:()=>tn,arrayIncludes:()=>en,arrayFlatMap:()=>$t,arrayFlat:()=>Qt,arrayFindLastIndex:()=>Zt,arrayFindLast:()=>Xt,arrayAt:()=>Yt,areQualitiesExact:()=>Ee,addScript:()=>ie,abortable:()=>se,VideoQuality:()=>_e,ValueSubject:()=>Fe,VKNumericLanguage:()=>kt,VERSION:()=>m,TracerFactory:()=>Dt,SubscriptionRemovable:()=>Ue,Subscription:()=>h,Subject:()=>S,RequestPolyfilled:()=>En,ReplaySubject:()=>Pe,Observable:()=>x,Logger:()=>ee,InternalsExposure:()=>Ft,InterfaceLanguage:()=>Pt,InjectionToken:()=>Kt,INTERNAL_EXPOSE_GLOBAL_KEY:()=>U,ErrorCategory:()=>Ot,AppTracer:()=>G,AbortSignalPolyfilled:()=>On,AbortControllerPolyfilled:()=>Dn}),module.exports=c(p);var m=`1.0.90-dev.c6e9376db.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 C(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function w(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function T(e){return e!=null}function E(e){return e==null}var D=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>T(t)));function te(e,t){if(!e?.length)throw Error(t)}function ne(e,t){if(e?.length)throw Error(t)}var O=()=>globalThis,re=(e=O())=>!!(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=O().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)}),ae=typeof O().performance?.now==`function`?()=>O().performance.now():()=>Date.now(),oe=()=>Math.trunc(ae()),se=(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}),ce=(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},le={};f(le,{set:()=>fe,remove:()=>me,isPersistent:()=>ue,has:()=>pe,get:()=>de,clear:()=>he});var k,A,j=`vk-videoplayer-dummy-key-${Math.random()}`,M=()=>{if(A!==void 0)return A;try{localStorage.setItem(j,`test`),localStorage.removeItem(j),A=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(j),A=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)A=2;else throw e}else throw e}return A===2&&(k=new Map),A},ue=()=>M()===0,de=e=>{let t=M();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return k?.get(e);default:g(t)}},fe=(e,t)=>{let n=M();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:k?.set(e,t);return;default:g(n)}},pe=e=>{let t=M();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return k?.has(e)??!1;default:return g(t),!1}},me=e=>{let t=M();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:k?.delete(e);return;default:g(t)}},he=()=>{let e=M();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return k?.clear();default:g(e)}},ge=()=>{let e,t=[],n=O();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)}},_e;(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`})(_e||={});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],Se=Object.keys(N).sort((e,t)=>P(e,t)?-1:1),Ce=(e,t=.02)=>[...Se].find(n=>N[n].height*(1+t)>=e),we=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return Se.find(e=>{let t=N[e];return t.width>=r&&t.height>=n})},Te=e=>N[e].height,F=e=>e===`Invariant quality`,Ee=e=>e.every(e=>!F(e));function De(e){if(F(e))throw Error(`Expected exact quality`)}var Oe=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``}},ke=(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]=ke(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},Ae=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 je(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof O().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&&O().cancelAnimationFrame(s),O().requestAnimationFrame(e)):setTimeout(e,t)}function g(e){if(p){O().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 C(){return s!==void 0}function w(...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 w.cancel=S,w.flush=ee,w.pending=C,w}var Me=(e,n=0,r)=>je(e,n,t(t(t({},{leading:!0,trailing:!0}),r),{},{maxWait:n})),I=(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]=I(e[r],t):n[r]=e[r]}return n},Ne=e=>I(e);class Pe 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 Fe 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 Ie(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 Le(...e){return new x(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new h))}var Re=e=>new x(t=>{let n=O().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>O().clearTimeout(n)}),ze=e=>new x(t=>{let n=O(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function Be(e){return new x(t=>{if(e instanceof Promise){let n=!1;return e.then(e=>{n||t.next(e)}).catch(e=>{n||t.error?.call(t,e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var Ve=Be,He=(e,t)=>new x(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Ue extends h{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function We(e){return t=>new x(n=>t.subscribe(new Ge(n,e)))}class Ge{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 Ke={leading:!1,trailing:!0};function qe(e,t=Ke){return n=>new x(r=>n.subscribe(new Je(r,e,t)))}class Je{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=O();T(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 Ye={leading:!0,trailing:!1};function Xe(e,t=Ye){return n=>new x(r=>n.subscribe(new Ze(r,e,t)))}class Ze{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,E(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=O().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 Qe(e){return t=>new x(n=>t.subscribe(new $e(n,e)))}class $e{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 et=(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)},tt=(e,t)=>e instanceof Object&&t instanceof Object?et(e,t):e===t;function nt(e=tt){return t=>new x(n=>t.subscribe(new it(n,e)))}var rt={};class it{constructor(t,n){e(this,`destination`,void 0),e(this,`predicate`,void 0),e(this,`lastValue`,rt),this.destination=t,this.predicate=n}next(e){let n;try{n=this.lastValue===rt||!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 L(e){return t=>new x(n=>t.subscribe(new at(n,e)))}class at{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 ot(e){return L(()=>e)}function st(){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 ct(){return e=>new x(t=>e.subscribe(new lt(t)))}class lt{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 ut(e){return t=>new x(n=>t.subscribe(new dt(n,e)))}class dt{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 ft(e){return t=>new x(n=>t.subscribe(new pt(n,e)))}class pt{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 mt(e=0){return t=>{let n=0,r=new Pe(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new x(e=>(n++,a(r.subscribe(e))))}}var ht=300,gt=(e,t=ht)=>new x(n=>{let r=O(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!re(r))return;let o=new r.ResizeObserver(Me(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),T(r)&&T(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},_t=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},vt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},yt=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),bt=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),xt=e=>e!==void 0&&e!==``?e:bt().toString();function St(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 Ct(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),wt=e=>{if(!z(e))throw e},Tt=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{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),V.dynamicImportStatus===`not_started`&&(V.dynamicImportPromise=this.loadOpentelemetry());let r=Date.now();this.initPromise=V.dynamicImportPromise.then(e=>{V.dynamicImportStatus===`completed`&&this.init({name:t,getParentContext:n},r)})}init({name:e,getParentContext:t},n){let{opentelemetryApi:r}=V.dynamicImports,{context:i,trace:a}=r;this.span=V.rootTracer.startSpan(e,{startTime:n},t?.()),this.context=a.setSpan(i.active(),this.span)}loadOpentelemetry(){var e=this;return n(function*(){if(V.dynamicImportStatus===`not_started`){V.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`),import(`@opentelemetry/resources`),import(`@opentelemetry/semantic-conventions`)]),[r,i,a,o,s]=yield Promise.race([n,t]);V.dynamicImports={opentelemetryApi:r,opentelemetrySdk:i,tracer:a,opentelemetryResources:o,opentelemetrySemanticConventions:s},V.dynamicImportStatus=`completed`}catch{V.dynamicImportStatus=`failed`}}})()}isComponentTracerNotInitialized(){return E(this.span)||V.dynamicImportStatus===`failed`}log(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},B(n)),{},{type:`log`}),r)})}error(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},B(n)),{},{type:`error`}),r)})}critical(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},B(n)),{},{type:`critical`}),r)})}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())})}}e(V,`rootTracer`,void 0),e(V,`dynamicImportStatus`,`not_started`),e(V,`dynamicImports`,void 0),e(V,`dynamicImportPromise`,void 0);class Et extends V{constructor(){super({name:`Root`})}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=V.dynamicImports,{TracerUploadSpanExporter:s}=r,{WebTracerProvider:c,BatchSpanProcessor:l}=a,{resourceFromAttributes:u}=i,{ATTR_SERVICE_NAME:d}=o,f=new c({resource:u({[d]:`videoplayer-sdk-web`}),spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0},spanProcessors:[new l(new s({appToken:`L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb`}))]});f.register(),V.rootTracer=f.getTracer(`sdk-videoplayer-tracer`),super.init({name:e,getParentContext:t},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}}class H{constructor(t){e(this,`fakeTraceId`,void 0)}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new H({name:e})}end(){}getTraceId(){return this.fakeTraceId}}class Dt{static createRootTracer(e=!1){return e?new Et:new H}}var Ot;(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`})(Ot||={});var kt;(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`})(kt||={});var At=`vk.com`,jt=function(){var e=n(function*(e,t,n){let r=new URL(`https://${At}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),Mt(yield(yield fetch(r.toString())).json(),n)});return function(t,n,r){return e.apply(this,arguments)}}(),Mt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),Nt(n)])),Nt=e=>Array.isArray(e)?e[0]:e,Pt;(e=>{e.RU=`ru`,e.EN=`en`})(Pt||={});var U=`__vk_vp_internals_exposure`;class Ft{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[U])==null||(e=e[t])==null?void 0:e[n])??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[U]||(window[U]={}),window[U][e]||(window[U][e]={}),window[U][e][t]||(window[U][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[U]&&window[U][e]&&window[U][e][t]&&(delete window[U][e][t],Object.keys(window[U][e]).length||delete window[U][e],Object.keys(window[U]).length||delete window[U])}}var It={};f(It,{subscribe:()=>Bt,push:()=>zt,destroy:()=>Rt,create:()=>Lt});var W=new Map,Lt=(e,t)=>W.set(e,t??[]),Rt=e=>W.delete(e),zt=(e,t)=>{let n=W.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Bt=(e,t)=>{let n=W.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);W.set(e,t)}},Vt=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`,Ht=e=>D({id:e.id,message:e.message,category:e.category,data:Ut(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Ut(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Wt=e=>{let t=e.thrown instanceof Error&&!Object.isFrozen(e.thrown)?e.thrown:Error(e.message);return t.name=e.id,t},Gt=()=>{try{var e;let{origin:n,pathname:r,search:i,hostname:a}=((e=O())==null||(e=e.document)==null?void 0:e.location)??{};return!a||a===`localhost`?void 0:t({url:n+r},new URLSearchParams(i).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{}))}catch{}};class G{constructor(n,r,i,a){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),e(this,`isEmbed`,void 0),e(this,`embedParent`,void 0),this.componentName=n,this.options=r,this.envParams=i,this.context=t({},a);let{isEmbed:o,topOrigin:s}=ge();this.isEmbed=o,this.embedParent=s?new URL(s).hostname:void 0,this.options.enabled&&(this.loadModule(),this.init())}updateContext(e){Object.assign(this.context,e)}error(e,n){let{blackErrorCategoryList:r,blackErrorIdList:i,sampleRate:a,whiteErrorCategoryList:o,whiteErrorIdList:s}=this.options,{id:c,category:l}=e;if(r.length&&r.includes(l)||i.length&&i.includes(c)||o.length&&!o.includes(l)||s.length&&!s.includes(c)||Math.random()>=a)return;let u=G.tracerErrorMap.get(this.componentName);try{let r=Wt(e);u?.error(r,{crashIdSource:r.name,severity:n?.severity??(e.traceAsLog?`debug`:void 0),keys:t(t(t(t({},this.context),Ht(e)),Gt()),this.isEmbed&&this.embedParent&&{iframe_host:this.embedParent})})}catch(e){console.error(e)}}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}init(){var e=this;return n(function*(){try{if(yield G.loadPromise,G.tracerErrorMap.has(e.componentName)||E(G.appTracerModule))return;let{appTracerModule:t}=G,{initTracerError:n,initTracerErrorUploader:r,getTracerModules:i}=t,a=i(e.componentName),o=!a.error,s=a.error??n(e.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});T(e.options.userId)&&s.setUserId(e.options.userId),o&&r(e.componentName,{appToken:Vt,environment:e.envParams.env,versionCode:1,versionName:e.envParams.version}),G.tracerErrorMap.set(e.componentName,s)}catch(e){console.error(e)}})()}loadModule(){var e=this;T(G.loadPromise)||(G.loadPromise=function(){var t=n(function*(){try{let t=new Promise((t,n)=>O().setTimeout(n,e.dynamicImportTimeout));G.appTracerModule=yield Promise.race([t,import(`@apptracer/sdk/lite`)])}catch(e){G.loadPromise=null,console.error(e)}});return function(){return t.apply(this,arguments)}}()())}}e(G,`tracerErrorMap`,new Map),e(G,`appTracerModule`,null),e(G,`loadPromise`,null);class Kt{constructor(t,n){e(this,`options`,void 0),e(this,`symbol`,void 0),this.options=n,this.symbol=Symbol(t)}}var K=new Map,q=new Map,qt=new Map,J=new Map,Jt={resolve(e){if(!J.has(e)){let t=qt.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);J.set(e,new t)}return J.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){J.forEach((t,n)=>{t instanceof e&&J.delete(n)}),qt.set(e,t)},getToken(e){if(K.has(e.symbol))return K.get(e.symbol);if(q.has(e.symbol)){let t=q.get(e.symbol)();return K.set(e.symbol,t),t}if(e.options?.factory){let t=e.options.factory();return K.set(e.symbol,t),t}throw Error(`No value registered in DI container for token "${e.symbol.description}"`)},registerToken(e,t){K.set(e.symbol,t)},registerFactory(e,t){q.set(e.symbol,t)},hasToken(e){return K.has(e.symbol)||q.has(e.symbol)||!!e.options?.factory},clear(){K.clear(),q.clear()}},Yt=(e,t)=>{let n=e.length,r=t>=0?t:n+t;return r>=0&&r<n?e[r]:void 0},Xt=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}},Zt=(e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n],n,e))return n;return-1},Qt=(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},$t=(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},en=(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},tn=e=>{let t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=e[t-1-r];return n},nn=(e,t)=>{let n=e.slice();return t?n.sort(t):n.sort()},rn=(e,t,n,...r)=>{let i=e.slice();return n===void 0?i.splice(t):i.splice(t,n,...r),i},an=(e,t,n)=>{let r=e.length,i=t>=0?t:r+t,a=e.slice();return a[i]=n,a},on=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:Function(`return this`)(),sn=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},cn=e=>{let t={};for(let[n,r]of e)t[n]=r;return t},ln=Object.prototype.hasOwnProperty,un=(e,t)=>ln.call(e,t),dn=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},fn=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}))))},pn=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`))})})})},mn=(e,t)=>e.then(e=>Promise.resolve(t()).then(()=>e),e=>Promise.resolve(t()).then(()=>{throw e})),hn=e=>{try{return Promise.resolve(e())}catch(e){return Promise.reject(e)}},gn=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},{NativeAbortSignal:_n,NativeAbortController:vn}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function yn(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 bn(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 xn{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 xn{constructor(){super(),this.listeners||xn.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=bn(e),n=yn(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 Sn(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 Cn(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!Sn({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&&Sn({fetch:Z.fetch,Request:Z.Request,AbortController:Z.AbortController}),wn=Q?Cn({fetch:Z.fetch,Request:Z.Request,AbortController:Z.AbortController}):void 0,Tn=Q?wn.fetch:Z.fetch,En=Q?wn.Request:Z.Request,Dn=Q?X:Z.AbortController,On=Q?Y:Z.AbortSignal,kn=(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*An(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 jn=(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)},Mn=(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},Nn=(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)},Pn=e=>e.replace(/^\s+/,``),$=e=>e.replace(/\s+$/,``),Fn=Pn,In=$,Ln=(e,t)=>typeof e==`string`?kn(e,t):Yt(e,t),Rn=(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)},zn=e=>Z.clearTimeout(e),Bn=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),Vn=!Bn(Z.requestIdleCallback)||!Bn(Z.cancelIdleCallback),Hn=Vn?Rn:Z.requestIdleCallback,Un=Vn?zn:Z.cancelIdleCallback,Wn=(e,t,n)=>typeof e==`string`?e.includes(t,n):en(e,t,n),Gn=(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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.90-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.90-dev.c6e9376db.0
|
|
3
|
+
* Wed, 13 May 2026 13:37:01 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-90/doc/
|
|
5
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.90-dev.58f425a02.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 g{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 _(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function ee(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function v(e){return e!=null}function y(e){return e==null}var b=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>v(t)));function te(e,t){if(!e?.length)throw Error(t)}function ne(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(),re=()=>Math.trunc(w()),ie=(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}),ae=(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},oe={};o(oe,{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=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)}},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],ve=Object.keys(A).sort((e,t)=>j(e,t)?-1:1),ye=(e,t=.02)=>[...ve].find(n=>A[n].height*(1+t)>=e),be=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return ve.find(e=>{let t=A[e];return t.width>=r&&t.height>=n})},xe=e=>A[e].height,M=e=>e===`Invariant quality`,Se=e=>e.every(e=>!M(e));function Ce(e){if(M(e))throw Error(`Expected exact quality`)}var we=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``}},N=(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]=N(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},Te=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 P(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(y,t),u?m(e):o}function ee(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,ee(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 ne(){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 _(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=ne,C.pending=S,C}var Ee=(e,n=0,r)=>P(e,n,t(t(t({},{leading:!0,trailing:!0}),r),{},{maxWait:n})),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},De=e=>F(e);class I 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 Oe 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 ke(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 Ae(...e){return new m(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new c))}var je=e=>new m(t=>{let n=x().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>x().clearTimeout(n)}),Me=e=>new m(t=>{let n=x(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function Ne(e){return new m(t=>{if(e instanceof Promise){let n=!1;return e.then(e=>{n||t.next(e)}).catch(e=>{n||t.error?.call(t,e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var Pe=Ne,Fe=(e,t)=>new m(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Ie extends c{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Le(e){return t=>new m(n=>t.subscribe(new Re(n,e)))}class Re{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 ze={leading:!1,trailing:!0};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;let t=x();v(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 He={leading:!0,trailing:!1};function Ue(e,t=He){return n=>new m(r=>n.subscribe(new We(r,e,t)))}class We{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,y(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){var t;(t=this.destination).error?.call(t,e)}}function Ge(e){return t=>new m(n=>t.subscribe(new Ke(n,e)))}class Ke{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 qe=(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)},Je=(e,t)=>e instanceof Object&&t instanceof Object?qe(e,t):e===t;function Ye(e=Je){return t=>new m(n=>t.subscribe(new Xe(n,e)))}var L={};class Xe{constructor(t,n){e(this,`destination`,void 0),e(this,`predicate`,void 0),e(this,`lastValue`,L),this.destination=t,this.predicate=n}next(e){let n;try{n=this.lastValue===L||!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 R(e){return t=>new m(n=>t.subscribe(new Ze(n,e)))}class Ze{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 Qe(e){return R(()=>e)}function $e(){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 et(){return e=>new m(t=>e.subscribe(new tt(t)))}class tt{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 nt(e){return t=>new m(n=>t.subscribe(new rt(n,e)))}class rt{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 it(e){return t=>new m(n=>t.subscribe(new at(n,e)))}class at{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 ot(e=0){return t=>{let n=0,r=new I(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new m(e=>(n++,a(r.subscribe(e))))}}var st=300,ct=(e,t=st)=>new m(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(Ee(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),v(r)&&v(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),z=(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=z(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},lt=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},ut=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},dt=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),ft=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),pt=e=>e!==void 0&&e!==``?e:ft().toString();function mt(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 ht(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 B=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),gt=e=>{if(!B(e))throw e},_t=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?z(n):{value:n})},V=(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 H{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),H.dynamicImportStatus===`not_started`&&(H.dynamicImportPromise=this.loadOpentelemetry());let r=Date.now();this.initPromise=H.dynamicImportPromise.then(e=>{H.dynamicImportStatus===`completed`&&this.init({name:t,getParentContext:n},r)})}init({name:e,getParentContext:t},n){let{opentelemetryApi:r}=H.dynamicImports,{context:i,trace:a}=r;this.span=H.rootTracer.startSpan(e,{startTime:n},t?.()),this.context=a.setSpan(i.active(),this.span)}loadOpentelemetry(){var e=this;return n(function*(){if(H.dynamicImportStatus===`not_started`){H.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`),import(`@opentelemetry/resources`),import(`@opentelemetry/semantic-conventions`)]),[r,i,a,o,s]=yield Promise.race([n,t]);H.dynamicImports={opentelemetryApi:r,opentelemetrySdk:i,tracer:a,opentelemetryResources:o,opentelemetrySemanticConventions:s},H.dynamicImportStatus=`completed`}catch{H.dynamicImportStatus=`failed`}}})()}isComponentTracerNotInitialized(){return y(this.span)||H.dynamicImportStatus===`failed`}log(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},V(n)),{},{type:`log`}),r)})}error(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},V(n)),{},{type:`error`}),r)})}critical(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},V(n)),{},{type:`critical`}),r)})}createComponentTracer(e){let t=new H({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(H,`rootTracer`,void 0),e(H,`dynamicImportStatus`,`not_started`),e(H,`dynamicImports`,void 0),e(H,`dynamicImportPromise`,void 0);class vt extends H{constructor(){super({name:`Root`})}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=H.dynamicImports,{TracerUploadSpanExporter:s}=r,{WebTracerProvider:c,BatchSpanProcessor:l}=a,{resourceFromAttributes:u}=i,{ATTR_SERVICE_NAME:d}=o,f=new c({resource:u({[d]:`videoplayer-sdk-web`}),spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0},spanProcessors:[new l(new s({appToken:`L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb`}))]});f.register(),H.rootTracer=f.getTracer(`sdk-videoplayer-tracer`),super.init({name:e,getParentContext:t},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}}class U{constructor(t){e(this,`fakeTraceId`,void 0)}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new U({name:e})}end(){}getTraceId(){return this.fakeTraceId}}class yt{static createRootTracer(e=!1){return e?new vt:new U}}var W;(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`})(W||={});var G;(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`})(G||={});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,K;(e=>{e.RU=`ru`,e.EN=`en`})(K||={});var q=`__vk_vp_internals_exposure`;class wt{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[q])==null||(e=e[t])==null?void 0:e[n])??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[q]||(window[q]={}),window[q][e]||(window[q][e]={}),window[q][e][t]||(window[q][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[q]&&window[q][e]&&window[q][e][t]&&(delete window[q][e][t],Object.keys(window[q][e]).length||delete window[q][e],Object.keys(window[q]).length||delete window[q])}}var Tt={};o(Tt,{subscribe:()=>kt,push:()=>Ot,destroy:()=>Dt,create:()=>Et});var J=new Map,Et=(e,t)=>J.set(e,t??[]),Dt=e=>J.delete(e),Ot=(e,t)=>{let n=J.get(e);n&&(typeof n==`function`?n(t):n.push(t))},kt=(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)}},At=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`,jt=e=>b({id:e.id,message:e.message,category:e.category,data:Mt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Mt(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Nt=e=>{let t=e.thrown instanceof Error&&!Object.isFrozen(e.thrown)?e.thrown:Error(e.message);return t.name=e.id,t},Pt=()=>{try{var e;let{origin:n,pathname:r,search:i,hostname:a}=((e=x())==null||(e=e.document)==null?void 0:e.location)??{};return!a||a===`localhost`?void 0:t({url:n+r},new URLSearchParams(i).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{}))}catch{}};class Y{constructor(n,r,i,a){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),e(this,`isEmbed`,void 0),e(this,`embedParent`,void 0),this.componentName=n,this.options=r,this.envParams=i,this.context=t({},a);let{isEmbed:o,topOrigin:s}=pe();this.isEmbed=o,this.embedParent=s?new URL(s).hostname:void 0,this.options.enabled&&(this.loadModule(),this.init())}updateContext(e){Object.assign(this.context,e)}error(e,n){let{blackErrorCategoryList:r,blackErrorIdList:i,sampleRate:a,whiteErrorCategoryList:o,whiteErrorIdList:s}=this.options,{id:c,category:l}=e;if(r.length&&r.includes(l)||i.length&&i.includes(c)||o.length&&!o.includes(l)||s.length&&!s.includes(c)||Math.random()>=a)return;let u=Y.tracerErrorMap.get(this.componentName);try{let r=Nt(e);u?.error(r,{crashIdSource:r.name,severity:n?.severity??(e.traceAsLog?`debug`:void 0),keys:t(t(t(t({},this.context),jt(e)),Pt()),this.isEmbed&&this.embedParent&&{iframe_host:this.embedParent})})}catch(e){console.error(e)}}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}init(){var e=this;return n(function*(){try{if(yield Y.loadPromise,Y.tracerErrorMap.has(e.componentName)||y(Y.appTracerModule))return;let{appTracerModule:t}=Y,{initTracerError:n,initTracerErrorUploader:r,getTracerModules:i}=t,a=i(e.componentName),o=!a.error,s=a.error??n(e.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});v(e.options.userId)&&s.setUserId(e.options.userId),o&&r(e.componentName,{appToken:At,environment:e.envParams.env,versionCode:1,versionName:e.envParams.version}),Y.tracerErrorMap.set(e.componentName,s)}catch(e){console.error(e)}})()}loadModule(){var e=this;v(Y.loadPromise)||(Y.loadPromise=function(){var t=n(function*(){try{let t=new Promise((t,n)=>x().setTimeout(n,e.dynamicImportTimeout));Y.appTracerModule=yield Promise.race([t,import(`@apptracer/sdk/lite`)])}catch(e){Y.loadPromise=null,console.error(e)}});return function(){return t.apply(this,arguments)}}()())}}e(Y,`tracerErrorMap`,new Map),e(Y,`appTracerModule`,null),e(Y,`loadPromise`,null);var Ft=(e,t)=>{let n=e.length,r=t>=0?t:n+t;return r>=0&&r<n?e[r]:void 0},It=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}},Lt=(e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n],n,e))return n;return-1},Rt=(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},zt=(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},Bt=(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},Vt=e=>{let t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=e[t-1-r];return n},Ht=(e,t)=>{let n=e.slice();return t?n.sort(t):n.sort()},Ut=(e,t,n,...r)=>{let i=e.slice();return n===void 0?i.splice(t):i.splice(t,n,...r),i},Wt=(e,t,n)=>{let r=e.length,i=t>=0?t:r+t,a=e.slice();return a[i]=n,a},Gt=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:Function(`return this`)(),Kt=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},qt=e=>{let t={};for(let[n,r]of e)t[n]=r;return t},Jt=Object.prototype.hasOwnProperty,Yt=(e,t)=>Jt.call(e,t),Xt=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},Zt=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}))))},Qt=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`))})})})},$t=(e,t)=>e.then(e=>Promise.resolve(t()).then(()=>e),e=>Promise.resolve(t()).then(()=>{throw e})),en=e=>{try{return Promise.resolve(e())}catch(e){return Promise.reject(e)}},tn=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},{NativeAbortSignal:nn,NativeAbortController:rn}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function an(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 on(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 sn{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 sn{constructor(){super(),this.listeners||sn.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=on(e),n=an(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 cn(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 ln(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!cn({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&&cn({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}),un=$?ln({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,dn=$?un.fetch:Q.fetch,fn=$?un.Request:Q.Request,pn=$?Z:Q.AbortController,mn=$?X:Q.AbortSignal,hn=(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*gn(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 _n=(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)},vn=(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},yn=(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)},bn=e=>e.replace(/^\s+/,``),xn=e=>e.replace(/\s+$/,``),Sn=bn,Cn=xn,wn=(e,t)=>typeof e==`string`?hn(e,t):Ft(e,t),Tn=(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)},En=e=>Q.clearTimeout(e),Dn=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),On=!Dn(Q.requestIdleCallback)||!Dn(Q.cancelIdleCallback),kn=On?Tn:Q.requestIdleCallback,An=On?En:Q.cancelIdleCallback,jn=(e,t,n)=>typeof e==`string`?e.includes(t,n):Bt(e,t,n),Mn=(e,t,n)=>{if(typeof e.canParse==`function`)return e.canParse(t,n);try{return new e(t,n),!0}catch{return!1}};export{b as withoutNullable,be as videoSizeToQuality,xe as videoQualityToHeight,ye as videoHeightToQuality,Mn as urlCanParsePolyfilled,je as timeout,Te as timeCodeToString,Ee as throttleFn,Ue as throttle,nt as tap,gt as suppressAbort,bn as stringTrimStart,Cn as stringTrimRight,Sn as stringTrimLeft,xn as stringTrimEnd,yn as stringReplaceAll,vn as stringPadStart,_n as stringPadEnd,gn as stringMatchAll,hn as stringAt,it as skip,ot as shareReplay,oe as safeStorage,kn as requestIdleCallbackPolyfilled,tn as promiseWithResolvers,en as promiseTry,$t as promiseFinally,Qt as promiseAny,Zt as promiseAllSettled,et as pairwise,$e as once,ct as observeElementSize,Pe as observableFrom,Xt as objectValues,Yt as objectHasOwn,qt as objectFromEntries,Kt as objectEntries,re as nowInt,w as now,d as noop,Ae as merge,Qe as mapTo,R as map,xt as loadVKLangPack,ut as isValidURL,y as isNullable,v as isNonNullable,ge as isLowerOrEqual,j as isLower,M as isInvariantQuality,dt as isIntersecting,he as isHigherOrEqual,me as isHigher,S as isBrowserWindow,B as isAbortError,Me as interval,mt as interpolate,jn as includesPolyfilled,Gt as globalThisPolyfill,x as getWindow,we as getVideoQualityLabel,_t as getTraceSubscriptionMethod,ht as getRangeAroundIndex,pt as getPlayerId,_e as getHighestQuality,ae as getExponentialDelay,Fe as fromEvent,z as flattenObject,Ye as filterChanged,Ge as filter,N as fillWithDefault,dn as fetchPolyfilled,Tt as devNull,pe as detectEmbed,P as debounceFn,Be as debounce,ke as combine,F as cloneDeepWith,De as cloneDeep,lt as clearVideoElement,u as checkNever,An as cancelIdleCallbackPolyfilled,Le as buffer,wn as atPolyfilled,Ce as assertQualityIsExact,ee as assertNullable,te as assertNotEmptyArray,_ as assertNonNullable,l as assertNever,ne as assertEmptyArray,Wt as arrayWith,Ut as arrayToSpliced,Ht as arrayToSorted,Vt as arrayToReversed,Bt as arrayIncludes,zt as arrayFlatMap,Rt as arrayFlat,Lt as arrayFindLastIndex,It as arrayFindLast,Ft as arrayAt,Se as areQualitiesExact,C as addScript,ie as abortable,k as VideoQuality,Oe as ValueSubject,G as VKNumericLanguage,s as VERSION,yt as TracerFactory,Ie as SubscriptionRemovable,c as Subscription,h as Subject,fn as RequestPolyfilled,I as ReplaySubject,m as Observable,g as Logger,wt as InternalsExposure,K as InterfaceLanguage,q as INTERNAL_EXPOSE_GLOBAL_KEY,W as ErrorCategory,Y as AppTracer,mn as AbortSignalPolyfilled,pn as AbortControllerPolyfilled};
|
|
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.90-dev.c6e9376db.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 ne(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 re(e,t){if(!e?.length)throw Error(t)}function ie(e,t){if(e?.length)throw Error(t)}var y=()=>globalThis,b=(e=y())=>!!(e.window&&e.screen),x=(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=y().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)}),S=typeof y().performance?.now==`function`?()=>y().performance.now():()=>Date.now(),ae=()=>Math.trunc(S()),oe=(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}),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={};o(ce,{set:()=>de,remove:()=>pe,isPersistent:()=>le,has:()=>fe,get:()=>ue,clear:()=>me});var C,w,T=`vk-videoplayer-dummy-key-${Math.random()}`,E=()=>{if(w!==void 0)return w;try{localStorage.setItem(T,`test`),localStorage.removeItem(T),w=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(T),w=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)w=2;else throw e}else throw e}return w===2&&(C=new Map),w},le=()=>E()===0,ue=e=>{let t=E();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return C?.get(e);default:l(t)}},de=(e,t)=>{let n=E();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:C?.set(e,t);return;default:l(n)}},fe=e=>{let t=E();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return C?.has(e)??!1;default:return l(t),!1}},pe=e=>{let t=E();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:C?.delete(e);return;default:l(t)}},me=()=>{let e=E();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return C?.clear();default:l(e)}},he=()=>{let e,t=[],n=y();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)}},ge;(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`})(ge||={});var D={"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}},_e=(e,t)=>D[e].height>D[t].height,ve=(e,t)=>D[e].height>=D[t].height,O=(e,t)=>D[e].height<D[t].height,ye=(e,t)=>D[e].height<=D[t].height,be=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:O(e,t)?1:-1)[0],k=Object.keys(D).sort((e,t)=>O(e,t)?-1:1),xe=(e,t=.02)=>[...k].find(n=>D[n].height*(1+t)>=e),Se=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return k.find(e=>{let t=D[e];return t.width>=r&&t.height>=n})},Ce=e=>D[e].height,A=e=>e===`Invariant quality`,we=e=>e.every(e=>!A(e));function Te(e){if(A(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``}},j=(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]=j(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},De=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 M(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof y().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&&y().cancelAnimationFrame(s),y().requestAnimationFrame(e)):setTimeout(e,t)}function ee(e){if(p){y().cancelAnimationFrame(e);return}clearTimeout(e)}function te(e){return l=e,s=h(_,t),u?m(e):o}function ne(e){let n=e-c,r=e-l,i=t-n;return d?Math.min(i,a-r):i}function g(e){let n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function _(){let e=Date.now();if(g(e))return v(e);s=h(_,ne(e))}function v(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function re(){s!==void 0&&ee(s),l=0,r=c=i=s=void 0}function ie(){return s===void 0?o:v(Date.now())}function b(){return s!==void 0}function x(...e){let n=Date.now(),a=g(n);if(r=e,i=this,c=n,a){if(s===void 0)return te(c);if(d)return s=h(_,t),m(c)}return s===void 0&&(s=h(_,t)),o}return x.cancel=re,x.flush=ie,x.pending=b,x}var N=(e,n=0,r)=>M(e,n,t(t(t({},{leading:!0,trailing:!0}),r),{},{maxWait:n})),P=(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]=P(e[r],t):n[r]=e[r]}return n},Oe=e=>P(e);class F 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 ke 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 Ae(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 je(...e){return new m(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new c))}var Me=e=>new m(t=>{let n=y().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>y().clearTimeout(n)}),Ne=e=>new m(t=>{let n=y(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function Pe(e){return new m(t=>{if(e instanceof Promise){let n=!1;return e.then(e=>{n||t.next(e)}).catch(e=>{n||t.error?.call(t,e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var Fe=Pe,Ie=(e,t)=>new m(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Le extends c{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Re(e){return t=>new m(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 m(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=y();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){var t;(t=this.destination).error?.call(t,e)}}var Ue={leading:!0,trailing:!1};function We(e,t=Ue){return n=>new m(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,_(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=y().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 m(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 m(n=>t.subscribe(new Ze(n,e)))}var I={};class Ze{constructor(t,n){e(this,`destination`,void 0),e(this,`predicate`,void 0),e(this,`lastValue`,I),this.destination=t,this.predicate=n}next(e){let n;try{n=this.lastValue===I||!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 L(e){return t=>new m(n=>t.subscribe(new Qe(n,e)))}class Qe{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 $e(e){return L(()=>e)}function et(){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 tt(){return e=>new m(t=>e.subscribe(new nt(t)))}class nt{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 rt(e){return t=>new m(n=>t.subscribe(new it(n,e)))}class it{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 at(e){return t=>new m(n=>t.subscribe(new ot(n,e)))}class ot{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 st(e=0){return t=>{let n=0,r=new F(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new m(e=>(n++,a(r.subscribe(e))))}}var ct=300,lt=(e,t=ct)=>new m(n=>{let r=y(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!b(r))return;let o=new r.ResizeObserver(N(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},ut=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},dt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},ft=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),pt=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),mt=e=>e!==void 0&&e!==``?e:pt().toString();function ht(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 gt(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),_t=e=>{if(!z(e))throw e},vt=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{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),V.dynamicImportStatus===`not_started`&&(V.dynamicImportPromise=this.loadOpentelemetry());let r=Date.now();this.initPromise=V.dynamicImportPromise.then(e=>{V.dynamicImportStatus===`completed`&&this.init({name:t,getParentContext:n},r)})}init({name:e,getParentContext:t},n){let{opentelemetryApi:r}=V.dynamicImports,{context:i,trace:a}=r;this.span=V.rootTracer.startSpan(e,{startTime:n},t?.()),this.context=a.setSpan(i.active(),this.span)}loadOpentelemetry(){var e=this;return n(function*(){if(V.dynamicImportStatus===`not_started`){V.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`),import(`@opentelemetry/resources`),import(`@opentelemetry/semantic-conventions`)]),[r,i,a,o,s]=yield Promise.race([n,t]);V.dynamicImports={opentelemetryApi:r,opentelemetrySdk:i,tracer:a,opentelemetryResources:o,opentelemetrySemanticConventions:s},V.dynamicImportStatus=`completed`}catch{V.dynamicImportStatus=`failed`}}})()}isComponentTracerNotInitialized(){return _(this.span)||V.dynamicImportStatus===`failed`}log(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},B(n)),{},{type:`log`}),r)})}error(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},B(n)),{},{type:`error`}),r)})}critical(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},B(n)),{},{type:`critical`}),r)})}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())})}}e(V,`rootTracer`,void 0),e(V,`dynamicImportStatus`,`not_started`),e(V,`dynamicImports`,void 0),e(V,`dynamicImportPromise`,void 0);class yt extends V{constructor(){super({name:`Root`})}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=V.dynamicImports,{TracerUploadSpanExporter:s}=r,{WebTracerProvider:c,BatchSpanProcessor:l}=a,{resourceFromAttributes:u}=i,{ATTR_SERVICE_NAME:d}=o,f=new c({resource:u({[d]:`videoplayer-sdk-web`}),spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0},spanProcessors:[new l(new s({appToken:`L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb`}))]});f.register(),V.rootTracer=f.getTracer(`sdk-videoplayer-tracer`),super.init({name:e,getParentContext:t},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}}class bt{constructor(t){e(this,`fakeTraceId`,void 0)}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new bt({name:e})}end(){}getTraceId(){return this.fakeTraceId}}class xt{static createRootTracer(e=!1){return e?new yt:new bt}}var St;(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`})(St||={});var Ct;(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`})(Ct||={});var wt=`vk.com`,Tt=function(){var e=n(function*(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(yield(yield fetch(r.toString())).json(),n)});return function(t,n,r){return e.apply(this,arguments)}}(),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,Ot;(e=>{e.RU=`ru`,e.EN=`en`})(Ot||={});var H=`__vk_vp_internals_exposure`;class kt{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[H])==null||(e=e[t])==null?void 0:e[n])??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[H]||(window[H]={}),window[H][e]||(window[H][e]={}),window[H][e][t]||(window[H][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[H]&&window[H][e]&&window[H][e][t]&&(delete window[H][e][t],Object.keys(window[H][e]).length||delete window[H][e],Object.keys(window[H]).length||delete window[H])}}var At={};o(At,{subscribe:()=>Pt,push:()=>Nt,destroy:()=>Mt,create:()=>jt});var U=new Map,jt=(e,t)=>U.set(e,t??[]),Mt=e=>U.delete(e),Nt=(e,t)=>{let n=U.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Pt=(e,t)=>{let n=U.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);U.set(e,t)}},Ft=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`,It=e=>v({id:e.id,message:e.message,category:e.category,data:Lt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Lt(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Rt=e=>{let t=e.thrown instanceof Error&&!Object.isFrozen(e.thrown)?e.thrown:Error(e.message);return t.name=e.id,t},zt=()=>{try{var e;let{origin:n,pathname:r,search:i,hostname:a}=((e=y())==null||(e=e.document)==null?void 0:e.location)??{};return!a||a===`localhost`?void 0:t({url:n+r},new URLSearchParams(i).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{}))}catch{}};class W{constructor(n,r,i,a){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),e(this,`isEmbed`,void 0),e(this,`embedParent`,void 0),this.componentName=n,this.options=r,this.envParams=i,this.context=t({},a);let{isEmbed:o,topOrigin:s}=he();this.isEmbed=o,this.embedParent=s?new URL(s).hostname:void 0,this.options.enabled&&(this.loadModule(),this.init())}updateContext(e){Object.assign(this.context,e)}error(e,n){let{blackErrorCategoryList:r,blackErrorIdList:i,sampleRate:a,whiteErrorCategoryList:o,whiteErrorIdList:s}=this.options,{id:c,category:l}=e;if(r.length&&r.includes(l)||i.length&&i.includes(c)||o.length&&!o.includes(l)||s.length&&!s.includes(c)||Math.random()>=a)return;let u=W.tracerErrorMap.get(this.componentName);try{let r=Rt(e);u?.error(r,{crashIdSource:r.name,severity:n?.severity??(e.traceAsLog?`debug`:void 0),keys:t(t(t(t({},this.context),It(e)),zt()),this.isEmbed&&this.embedParent&&{iframe_host:this.embedParent})})}catch(e){console.error(e)}}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}init(){var e=this;return n(function*(){try{if(yield W.loadPromise,W.tracerErrorMap.has(e.componentName)||_(W.appTracerModule))return;let{appTracerModule:t}=W,{initTracerError:n,initTracerErrorUploader:r,getTracerModules:i}=t,a=i(e.componentName),o=!a.error,s=a.error??n(e.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});g(e.options.userId)&&s.setUserId(e.options.userId),o&&r(e.componentName,{appToken:Ft,environment:e.envParams.env,versionCode:1,versionName:e.envParams.version}),W.tracerErrorMap.set(e.componentName,s)}catch(e){console.error(e)}})()}loadModule(){var e=this;g(W.loadPromise)||(W.loadPromise=function(){var t=n(function*(){try{let t=new Promise((t,n)=>y().setTimeout(n,e.dynamicImportTimeout));W.appTracerModule=yield Promise.race([t,import(`@apptracer/sdk/lite`)])}catch(e){W.loadPromise=null,console.error(e)}});return function(){return t.apply(this,arguments)}}()())}}e(W,`tracerErrorMap`,new Map),e(W,`appTracerModule`,null),e(W,`loadPromise`,null);class Bt{constructor(t,n){e(this,`options`,void 0),e(this,`symbol`,void 0),this.options=n,this.symbol=Symbol(t)}}var G=new Map,K=new Map,Vt=new Map,q=new Map,Ht={resolve(e){if(!q.has(e)){let t=Vt.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);q.set(e,new t)}return q.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){q.forEach((t,n)=>{t instanceof e&&q.delete(n)}),Vt.set(e,t)},getToken(e){if(G.has(e.symbol))return G.get(e.symbol);if(K.has(e.symbol)){let t=K.get(e.symbol)();return G.set(e.symbol,t),t}if(e.options?.factory){let t=e.options.factory();return G.set(e.symbol,t),t}throw Error(`No value registered in DI container for token "${e.symbol.description}"`)},registerToken(e,t){G.set(e.symbol,t)},registerFactory(e,t){K.set(e.symbol,t)},hasToken(e){return G.has(e.symbol)||K.has(e.symbol)||!!e.options?.factory},clear(){G.clear(),K.clear()}},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}};export{v as withoutNullable,Se as videoSizeToQuality,Ce as videoQualityToHeight,xe as videoHeightToQuality,Rn as urlCanParsePolyfilled,Me as timeout,De as timeCodeToString,N as throttleFn,We as throttle,rt as tap,_t as suppressAbort,Q as stringTrimStart,An as stringTrimRight,kn as stringTrimLeft,On as stringTrimEnd,Dn as stringReplaceAll,En as stringPadStart,Tn as stringPadEnd,wn as stringMatchAll,Cn as stringAt,at as skip,st as shareReplay,ce as safeStorage,Fn as requestIdleCallbackPolyfilled,un as promiseWithResolvers,ln as promiseTry,cn as promiseFinally,sn as promiseAny,on as promiseAllSettled,tt as pairwise,et as once,lt as observeElementSize,Fe as observableFrom,an as objectValues,rn as objectHasOwn,tn as objectFromEntries,en as objectEntries,ae as nowInt,S as now,d as noop,je as merge,$e as mapTo,L as map,Tt as loadVKLangPack,dt as isValidURL,_ as isNullable,g as isNonNullable,ye as isLowerOrEqual,O as isLower,A as isInvariantQuality,ft as isIntersecting,ve as isHigherOrEqual,_e as isHigher,b as isBrowserWindow,z as isAbortError,Ne as interval,ht as interpolate,Ln as includesPolyfilled,$t as globalThisPolyfill,y as getWindow,Ee as getVideoQualityLabel,vt as getTraceSubscriptionMethod,gt as getRangeAroundIndex,mt as getPlayerId,be as getHighestQuality,se as getExponentialDelay,Ie as fromEvent,R as flattenObject,Xe as filterChanged,Ke as filter,j as fillWithDefault,yn as fetchPolyfilled,Ht as diContainer,At as devNull,he as detectEmbed,M as debounceFn,Ve as debounce,Ae as combine,P as cloneDeepWith,Oe as cloneDeep,ut as clearVideoElement,u as checkNever,In as cancelIdleCallbackPolyfilled,Re as buffer,jn as atPolyfilled,Te as assertQualityIsExact,ne as assertNullable,re as assertNotEmptyArray,te as assertNonNullable,l as assertNever,ie as assertEmptyArray,Qt as arrayWith,Zt as arrayToSpliced,Xt as arrayToSorted,Yt as arrayToReversed,Jt as arrayIncludes,qt as arrayFlatMap,Kt as arrayFlat,Gt as arrayFindLastIndex,Wt as arrayFindLast,Ut as arrayAt,we as areQualitiesExact,x as addScript,oe as abortable,ge as VideoQuality,ke as ValueSubject,Ct as VKNumericLanguage,s as VERSION,xt as TracerFactory,Le as SubscriptionRemovable,c as Subscription,h as Subject,bn as RequestPolyfilled,F as ReplaySubject,m as Observable,ee as Logger,kt as InternalsExposure,Ot as InterfaceLanguage,Bt as InjectionToken,H as INTERNAL_EXPOSE_GLOBAL_KEY,St as ErrorCategory,W as AppTracer,Sn as AbortSignalPolyfilled,xn as AbortControllerPolyfilled};
|
package/esnext.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.90-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.90-dev.c6e9376db.0
|
|
3
|
+
* Wed, 13 May 2026 13:37:01 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-90/doc/
|
|
5
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:()=>be,videoQualityToHeight:()=>xe,videoHeightToQuality:()=>ye,urlCanParsePolyfilled:()=>rn,timeout:()=>Ae,timeCodeToString:()=>Te,throttleFn:()=>z,throttle:()=>He,tap:()=>rt,suppressAbort:()=>vt,skip:()=>at,shareReplay:()=>st,safeStorage:()=>ce,requestIdleCallbackPolyfilled:()=>tn,pairwise:()=>tt,once:()=>et,observeElementSize:()=>lt,observableFrom:()=>Ne,nowInt:()=>ae,now:()=>E,noop:()=>h,merge:()=>ke,mapTo:()=>$e,map:()=>Ze,loadVKLangPack:()=>Et,isValidURL:()=>dt,isNullable:()=>S,isNonNullable:()=>x,isLowerOrEqual:()=>_e,isLower:()=>P,isInvariantQuality:()=>I,isIntersecting:()=>ft,isHigherOrEqual:()=>ge,isHigher:()=>he,isBrowserWindow:()=>T,isAbortError:()=>_t,interval:()=>je,interpolate:()=>ht,getWindow:()=>w,getVideoQualityLabel:()=>we,getTraceSubscriptionMethod:()=>yt,getRangeAroundIndex:()=>gt,getPlayerId:()=>mt,getHighestQuality:()=>ve,getExponentialDelay:()=>se,fromEvent:()=>Pe,flattenObject:()=>H,filterChanged:()=>Je,filter:()=>We,fillWithDefault:()=>L,fetchPolyfilled:()=>Jt,devNull:()=>jt,detectEmbed:()=>j,debounceFn:()=>R,debounce:()=>ze,combine:()=>Oe,cloneDeepWith:()=>B,cloneDeep:()=>Ee,clearVideoElement:()=>ut,checkNever:()=>m,cancelIdleCallbackPolyfilled:()=>nn,buffer:()=>Ie,assertQualityIsExact:()=>Ce,assertNullable:()=>te,assertNotEmptyArray:()=>ne,assertNonNullable:()=>b,assertNever:()=>p,assertEmptyArray:()=>re,areQualitiesExact:()=>Se,addScript:()=>ie,abortable:()=>oe,VideoQuality:()=>M,ValueSubject:()=>De,VKNumericLanguage:()=>wt,VERSION:()=>d,TracerFactory:()=>St,SubscriptionRemovable:()=>Fe,Subscription:()=>f,Subject:()=>v,RequestPolyfilled:()=>Yt,ReplaySubject:()=>V,Observable:()=>_,Logger:()=>y,InternalsExposure:()=>At,InterfaceLanguage:()=>kt,INTERNAL_EXPOSE_GLOBAL_KEY:()=>G,ErrorCategory:()=>Ct,AppTracer:()=>q,AbortSignalPolyfilled:()=>Zt,AbortControllerPolyfilled:()=>Xt}),module.exports=a(u);var d=`1.0.90-dev.58f425a02.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)}},j=()=>{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)}},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}},he=(e,t)=>N[e].height>N[t].height,ge=(e,t)=>N[e].height>=N[t].height,P=(e,t)=>N[e].height<N[t].height,_e=(e,t)=>N[e].height<=N[t].height,ve=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),ye=(e,t=.02)=>[...F].find(n=>N[n].height*(1+t)>=e),be=({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})},xe=e=>N[e].height,I=e=>e===`Invariant quality`,Se=e=>e.every(e=>!I(e));function Ce(e){if(I(e))throw Error(`Expected exact quality`)}var we=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},Te=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 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 z=(e,t=0,n)=>R(e,t,{leading:!0,trailing:!0,...n,maxWait:t}),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},Ee=e=>B(e);class V 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 De 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 Oe(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 ke(...e){return new _(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new f))}var Ae=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)}),je=e=>new _(t=>{let n=w(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function Me(e){return new _(t=>{if(e instanceof Promise){let n=!1;return e.then(e=>{n||t.next(e)}).catch(e=>{n||t.error?.(e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var Ne=Me,Pe=(e,t)=>new _(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Fe extends f{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Ie(e){return t=>new _(n=>t.subscribe(new Le(n,e)))}class Le{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 Re={leading:!1,trailing:!0};function ze(e,t=Re){return n=>new _(r=>n.subscribe(new Be(r,e,t)))}class Be{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 Ve={leading:!0,trailing:!1};function He(e,t=Ve){return n=>new _(r=>n.subscribe(new Ue(r,e,t)))}class Ue{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 We(e){return t=>new _(n=>t.subscribe(new Ge(n,e)))}class Ge{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 Ke=(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?Ke(e,t):e===t;function Je(e=qe){return t=>new _(n=>t.subscribe(new Xe(n,e)))}var Ye={};class Xe{destination;predicate;lastValue=Ye;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===Ye||!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 Ze(e){return t=>new _(n=>t.subscribe(new Qe(n,e)))}class Qe{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 $e(e){return Ze(()=>e)}function et(){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 tt(){return e=>new _(t=>e.subscribe(new nt(t)))}class nt{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 rt(e){return t=>new _(n=>t.subscribe(new it(n,e)))}class it{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 at(e){return t=>new _(n=>t.subscribe(new ot(n,e)))}class ot{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 st(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 _(e=>(n++,a(r.subscribe(e))))}}var ct=300,lt=(e,t=ct)=>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(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),x(r)&&x(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},ut=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},dt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},ft=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),pt=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),mt=e=>e!==void 0&&e!==``?e:pt().toString();function ht(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 gt(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 _t=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),vt=e=>{if(!_t(e))throw e},yt=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{dynamicImportTimeout=5e3;span;context;childTracers=[];initPromise;static rootTracer;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t}){W.dynamicImportStatus===`not_started`&&(W.dynamicImportPromise=this.loadOpentelemetry());let n=Date.now();this.initPromise=W.dynamicImportPromise.then(r=>{W.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t},n)})}init({name:e,getParentContext:t},n){let{opentelemetryApi:r}=W.dynamicImports,{context:i,trace:a}=r;this.span=W.rootTracer.startSpan(e,{startTime:n},t?.()),this.context=a.setSpan(i.active(),this.span)}async loadOpentelemetry(){if(W.dynamicImportStatus===`not_started`){W.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`),import(`@opentelemetry/resources`),import(`@opentelemetry/semantic-conventions`)]),[n,r,i,a,o]=await Promise.race([t,e]);W.dynamicImports={opentelemetryApi:n,opentelemetrySdk:r,tracer:i,opentelemetryResources:a,opentelemetrySemanticConventions:o},W.dynamicImportStatus=`completed`}catch{W.dynamicImportStatus=`failed`}}}isComponentTracerNotInitialized(){return S(this.span)||W.dynamicImportStatus===`failed`}log(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...U(t),type:`log`},n)})}error(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...U(t),type:`error`},n)})}critical(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...U(t),type:`critical`},n)})}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())})}}class bt extends W{constructor(){super({name:`Root`})}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=W.dynamicImports,{TracerUploadSpanExporter:s}=r,{WebTracerProvider:c,BatchSpanProcessor:l}=a,{resourceFromAttributes:u}=i,{ATTR_SERVICE_NAME:d}=o,f=new c({resource:u({[d]:`videoplayer-sdk-web`}),spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0},spanProcessors:[new l(new s({appToken:`L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb`}))]});f.register(),W.rootTracer=f.getTracer(`sdk-videoplayer-tracer`),super.init({name:e,getParentContext:t},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}}class xt{fakeTraceId;constructor(e){}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new xt({name:e})}end(){}getTraceId(){return this.fakeTraceId}}class St{static createRootTracer(e=!1){return e?new bt:new xt}}var Ct;(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`})(Ct||={});var wt;(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`})(wt||={});var Tt=`vk.com`,Et=async(e,t,n)=>{let r=new URL(`https://${Tt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),Dt(await(await fetch(r.toString())).json(),n)},Dt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),Ot(n)])),Ot=e=>Array.isArray(e)?e[0]:e,kt;(e=>{e.RU=`ru`,e.EN=`en`})(kt||={});var G=`__vk_vp_internals_exposure`;class At{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[G]?.[e]?.[t]??{}}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 jt={};l(jt,{subscribe:()=>Ft,push:()=>Pt,destroy:()=>Nt,create:()=>Mt});var K=new Map,Mt=(e,t)=>K.set(e,t??[]),Nt=e=>K.delete(e),Pt=(e,t)=>{let n=K.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Ft=(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)}},It=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`,Lt=e=>C({id:e.id,message:e.message,category:e.category,data:Rt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Rt(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var zt=e=>{let t=e.thrown instanceof Error&&!Object.isFrozen(e.thrown)?e.thrown:Error(e.message);return t.name=e.id,t},Bt=()=>{try{let{origin:e,pathname:t,search:n,hostname:r}=w()?.document?.location??{};return!r||r===`localhost`?void 0:{url:e+t,...new URLSearchParams(n).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{})}}catch{}};class q{static tracerErrorMap=new Map;static appTracerModule=null;static loadPromise=null;dynamicImportTimeout=5e3;componentName;subscription=new f;options;envParams;context;isEmbed;embedParent;constructor(e,t,n,r){this.componentName=e,this.options=t,this.envParams=n,this.context={...r};let{isEmbed:i,topOrigin:a}=j();this.isEmbed=i,this.embedParent=a?new URL(a).hostname:void 0,this.options.enabled&&(this.loadModule(),this.init())}updateContext(e){Object.assign(this.context,e)}error(e,t){let{blackErrorCategoryList:n,blackErrorIdList:r,sampleRate:i,whiteErrorCategoryList:a,whiteErrorIdList:o}=this.options,{id:s,category:c}=e;if(n.length&&n.includes(c)||r.length&&r.includes(s)||a.length&&!a.includes(c)||o.length&&!o.includes(s)||Math.random()>=i)return;let l=q.tracerErrorMap.get(this.componentName);try{let n=zt(e);l?.error(n,{crashIdSource:n.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...Lt(e),...Bt(),...this.isEmbed&&this.embedParent&&{iframe_host:this.embedParent}}})}catch(e){console.error(e)}}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}async init(){try{if(await q.loadPromise,q.tracerErrorMap.has(this.componentName)||S(q.appTracerModule))return;let{appTracerModule:e}=q,{initTracerError:t,initTracerErrorUploader:n,getTracerModules:r}=e,i=r(this.componentName),a=!i.error,o=i.error??t(this.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});x(this.options.userId)&&o.setUserId(this.options.userId),a&&n(this.componentName,{appToken:It,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),q.tracerErrorMap.set(this.componentName,o)}catch(e){console.error(e)}}loadModule(){x(q.loadPromise)||(q.loadPromise=(async()=>{try{let e=new Promise((e,t)=>w().setTimeout(t,this.dynamicImportTimeout));q.appTracerModule=await Promise.race([e,import(`@apptracer/sdk/lite`)])}catch(e){q.loadPromise=null,console.error(e)}})())}}var{NativeAbortSignal:Vt,NativeAbortController:Ht}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function Ut(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 Wt(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 Gt{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 Gt{constructor(){super(),this.listeners||Gt.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=Wt(e),n=Ut(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 Kt(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 qt(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!Kt({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&&Kt({fetch:X.fetch,Request:X.Request,AbortController:X.AbortController}),Q=Z?qt({fetch:X.fetch,Request:X.Request,AbortController:X.AbortController}):void 0,Jt=Z?Q.fetch:X.fetch,Yt=Z?Q.Request:X.Request,Xt=Z?Y:X.AbortController,Zt=Z?J:X.AbortSignal,Qt=(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)},$t=e=>X.clearTimeout(e),en=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),$=!en(X.requestIdleCallback)||!en(X.cancelIdleCallback),tn=$?Qt:X.requestIdleCallback,nn=$?$t:X.cancelIdleCallback,rn=(e,t,n)=>{if(typeof e.canParse==`function`)return e.canParse(t,n);try{return new e(t,n),!0}catch{return!1}};
|
|
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:()=>w,videoSizeToQuality:()=>Se,videoQualityToHeight:()=>Ce,videoHeightToQuality:()=>xe,urlCanParsePolyfilled:()=>un,timeout:()=>Ne,timeCodeToString:()=>Oe,throttleFn:()=>I,throttle:()=>Ge,tap:()=>it,suppressAbort:()=>yt,skip:()=>ot,shareReplay:()=>ct,safeStorage:()=>le,requestIdleCallbackPolyfilled:()=>cn,pairwise:()=>nt,once:()=>tt,observeElementSize:()=>ut,observableFrom:()=>Ie,nowInt:()=>oe,now:()=>ae,noop:()=>h,merge:()=>Me,mapTo:()=>et,map:()=>B,loadVKLangPack:()=>Dt,isValidURL:()=>ft,isNullable:()=>C,isNonNullable:()=>S,isLowerOrEqual:()=>ve,isLower:()=>N,isInvariantQuality:()=>P,isIntersecting:()=>pt,isHigherOrEqual:()=>_e,isHigher:()=>ge,isBrowserWindow:()=>re,isAbortError:()=>vt,interval:()=>Pe,interpolate:()=>gt,getWindow:()=>T,getVideoQualityLabel:()=>Ee,getTraceSubscriptionMethod:()=>bt,getRangeAroundIndex:()=>_t,getPlayerId:()=>ht,getHighestQuality:()=>ye,getExponentialDelay:()=>ce,fromEvent:()=>Le,flattenObject:()=>V,filterChanged:()=>Ze,filter:()=>qe,fillWithDefault:()=>De,fetchPolyfilled:()=>$t,diContainer:()=>Wt,devNull:()=>Mt,detectEmbed:()=>A,debounceFn:()=>F,debounce:()=>He,combine:()=>je,cloneDeepWith:()=>L,cloneDeep:()=>ke,clearVideoElement:()=>dt,checkNever:()=>m,cancelIdleCallbackPolyfilled:()=>ln,buffer:()=>ze,assertQualityIsExact:()=>Te,assertNullable:()=>x,assertNotEmptyArray:()=>te,assertNonNullable:()=>b,assertNever:()=>p,assertEmptyArray:()=>ne,areQualitiesExact:()=>we,addScript:()=>ie,abortable:()=>se,VideoQuality:()=>j,ValueSubject:()=>Ae,VKNumericLanguage:()=>Tt,VERSION:()=>d,TracerFactory:()=>Ct,SubscriptionRemovable:()=>Re,Subscription:()=>f,Subject:()=>v,RequestPolyfilled:()=>en,ReplaySubject:()=>R,Observable:()=>_,Logger:()=>y,InternalsExposure:()=>jt,InterfaceLanguage:()=>At,InjectionToken:()=>Ht,INTERNAL_EXPOSE_GLOBAL_KEY:()=>W,ErrorCategory:()=>wt,AppTracer:()=>K,AbortSignalPolyfilled:()=>nn,AbortControllerPolyfilled:()=>tn}),module.exports=a(u);var d=`1.0.90-dev.c6e9376db.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 x(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function S(e){return e!=null}function C(e){return e==null}var w=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>S(t)));function te(e,t){if(!e?.length)throw Error(t)}function ne(e,t){if(e?.length)throw Error(t)}var T=()=>globalThis,re=(e=T())=>!!(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=T().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)}),ae=typeof T().performance?.now==`function`?()=>T().performance.now():()=>Date.now(),oe=()=>Math.trunc(ae()),se=(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},ce=(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},le={};l(le,{set:()=>fe,remove:()=>me,isPersistent:()=>ue,has:()=>pe,get:()=>de,clear:()=>he});var E,D,O=`vk-videoplayer-dummy-key-${Math.random()}`,k=()=>{if(D!==void 0)return D;try{localStorage.setItem(O,`test`),localStorage.removeItem(O),D=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(O),D=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)D=2;else throw e}else throw e}return D===2&&(E=new Map),D},ue=()=>k()===0,de=e=>{let t=k();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return E?.get(e);default:p(t)}},fe=(e,t)=>{let n=k();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:E?.set(e,t);return;default:p(n)}},pe=e=>{let t=k();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return E?.has(e)??!1;default:return p(t),!1}},me=e=>{let t=k();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:E?.delete(e);return;default:p(t)}},he=()=>{let e=k();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return E?.clear();default:p(e)}},A=()=>{let e,t=[],n=T();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 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 T().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&&T().cancelAnimationFrame(s),T().requestAnimationFrame(e)):setTimeout(e,t)}function g(e){if(p){T().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 x(){s!==void 0&&g(s),l=0,r=c=i=s=void 0}function S(){return s===void 0?o:b(Date.now())}function C(){return s!==void 0}function w(...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 w.cancel=x,w.flush=S,w.pending=C,w}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},ke=e=>L(e);class R 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 Ae 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 je(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 Me(...e){return new _(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new f))}var Ne=e=>new _(t=>{let n=T().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>T().clearTimeout(n)}),Pe=e=>new _(t=>{let n=T(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function Fe(e){return new _(t=>{if(e instanceof Promise){let n=!1;return e.then(e=>{n||t.next(e)}).catch(e=>{n||t.error?.(e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var Ie=Fe,Le=(e,t)=>new _(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Re extends f{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function ze(e){return t=>new _(n=>t.subscribe(new Be(n,e)))}class Be{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 Ve={leading:!1,trailing:!0};function He(e,t=Ve){return n=>new _(r=>n.subscribe(new Ue(r,e,t)))}class Ue{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=T();S(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 We={leading:!0,trailing:!1};function Ge(e,t=We){return n=>new _(r=>n.subscribe(new Ke(r,e,t)))}class Ke{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,C(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=T().setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}}function qe(e){return t=>new _(n=>t.subscribe(new Je(n,e)))}class Je{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 Ye=(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)},Xe=(e,t)=>e instanceof Object&&t instanceof Object?Ye(e,t):e===t;function Ze(e=Xe){return t=>new _(n=>t.subscribe(new Qe(n,e)))}var z={};class Qe{destination;predicate;lastValue=z;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===z||!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 B(e){return t=>new _(n=>t.subscribe(new $e(n,e)))}class $e{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 et(e){return B(()=>e)}function tt(){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 nt(){return e=>new _(t=>e.subscribe(new rt(t)))}class rt{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 it(e){return t=>new _(n=>t.subscribe(new at(n,e)))}class at{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 ot(e){return t=>new _(n=>t.subscribe(new st(n,e)))}class st{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 ct(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 _(e=>(n++,a(r.subscribe(e))))}}var lt=300,ut=(e,t=lt)=>new _(n=>{let r=T(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!re(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),S(r)&&S(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},dt=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},ft=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},pt=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),mt=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),ht=e=>e!==void 0&&e!==``?e:mt().toString();function gt(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 _t(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 vt=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),yt=e=>{if(!vt(e))throw e},bt=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?V(n):{value:n})},H=(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 U{dynamicImportTimeout=5e3;span;context;childTracers=[];initPromise;static rootTracer;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t}){U.dynamicImportStatus===`not_started`&&(U.dynamicImportPromise=this.loadOpentelemetry());let n=Date.now();this.initPromise=U.dynamicImportPromise.then(r=>{U.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t},n)})}init({name:e,getParentContext:t},n){let{opentelemetryApi:r}=U.dynamicImports,{context:i,trace:a}=r;this.span=U.rootTracer.startSpan(e,{startTime:n},t?.()),this.context=a.setSpan(i.active(),this.span)}async loadOpentelemetry(){if(U.dynamicImportStatus===`not_started`){U.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`),import(`@opentelemetry/resources`),import(`@opentelemetry/semantic-conventions`)]),[n,r,i,a,o]=await Promise.race([t,e]);U.dynamicImports={opentelemetryApi:n,opentelemetrySdk:r,tracer:i,opentelemetryResources:a,opentelemetrySemanticConventions:o},U.dynamicImportStatus=`completed`}catch{U.dynamicImportStatus=`failed`}}}isComponentTracerNotInitialized(){return C(this.span)||U.dynamicImportStatus===`failed`}log(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...H(t),type:`log`},n)})}error(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...H(t),type:`error`},n)})}critical(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...H(t),type:`critical`},n)})}createComponentTracer(e){let t=new U({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 xt extends U{constructor(){super({name:`Root`})}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=U.dynamicImports,{TracerUploadSpanExporter:s}=r,{WebTracerProvider:c,BatchSpanProcessor:l}=a,{resourceFromAttributes:u}=i,{ATTR_SERVICE_NAME:d}=o,f=new c({resource:u({[d]:`videoplayer-sdk-web`}),spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0},spanProcessors:[new l(new s({appToken:`L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb`}))]});f.register(),U.rootTracer=f.getTracer(`sdk-videoplayer-tracer`),super.init({name:e,getParentContext:t},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}}class St{fakeTraceId;constructor(e){}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new St({name:e})}end(){}getTraceId(){return this.fakeTraceId}}class Ct{static createRootTracer(e=!1){return e?new xt:new St}}var wt;(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`})(wt||={});var Tt;(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`})(Tt||={});var Et=`vk.com`,Dt=async(e,t,n)=>{let r=new URL(`https://${Et}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),Ot(await(await fetch(r.toString())).json(),n)},Ot=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),kt(n)])),kt=e=>Array.isArray(e)?e[0]:e,At;(e=>{e.RU=`ru`,e.EN=`en`})(At||={});var W=`__vk_vp_internals_exposure`;class jt{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[W]?.[e]?.[t]??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[W]||(window[W]={}),window[W][e]||(window[W][e]={}),window[W][e][t]||(window[W][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[W]&&window[W][e]&&window[W][e][t]&&(delete window[W][e][t],Object.keys(window[W][e]).length||delete window[W][e],Object.keys(window[W]).length||delete window[W])}}var Mt={};l(Mt,{subscribe:()=>It,push:()=>Ft,destroy:()=>Pt,create:()=>Nt});var G=new Map,Nt=(e,t)=>G.set(e,t??[]),Pt=e=>G.delete(e),Ft=(e,t)=>{let n=G.get(e);n&&(typeof n==`function`?n(t):n.push(t))},It=(e,t)=>{let n=G.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);G.set(e,t)}},Lt=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`,Rt=e=>w({id:e.id,message:e.message,category:e.category,data:zt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function zt(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Bt=e=>{let t=e.thrown instanceof Error&&!Object.isFrozen(e.thrown)?e.thrown:Error(e.message);return t.name=e.id,t},Vt=()=>{try{let{origin:e,pathname:t,search:n,hostname:r}=T()?.document?.location??{};return!r||r===`localhost`?void 0:{url:e+t,...new URLSearchParams(n).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{})}}catch{}};class K{static tracerErrorMap=new Map;static appTracerModule=null;static loadPromise=null;dynamicImportTimeout=5e3;componentName;subscription=new f;options;envParams;context;isEmbed;embedParent;constructor(e,t,n,r){this.componentName=e,this.options=t,this.envParams=n,this.context={...r};let{isEmbed:i,topOrigin:a}=A();this.isEmbed=i,this.embedParent=a?new URL(a).hostname:void 0,this.options.enabled&&(this.loadModule(),this.init())}updateContext(e){Object.assign(this.context,e)}error(e,t){let{blackErrorCategoryList:n,blackErrorIdList:r,sampleRate:i,whiteErrorCategoryList:a,whiteErrorIdList:o}=this.options,{id:s,category:c}=e;if(n.length&&n.includes(c)||r.length&&r.includes(s)||a.length&&!a.includes(c)||o.length&&!o.includes(s)||Math.random()>=i)return;let l=K.tracerErrorMap.get(this.componentName);try{let n=Bt(e);l?.error(n,{crashIdSource:n.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...Rt(e),...Vt(),...this.isEmbed&&this.embedParent&&{iframe_host:this.embedParent}}})}catch(e){console.error(e)}}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}async init(){try{if(await K.loadPromise,K.tracerErrorMap.has(this.componentName)||C(K.appTracerModule))return;let{appTracerModule:e}=K,{initTracerError:t,initTracerErrorUploader:n,getTracerModules:r}=e,i=r(this.componentName),a=!i.error,o=i.error??t(this.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});S(this.options.userId)&&o.setUserId(this.options.userId),a&&n(this.componentName,{appToken:Lt,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),K.tracerErrorMap.set(this.componentName,o)}catch(e){console.error(e)}}loadModule(){S(K.loadPromise)||(K.loadPromise=(async()=>{try{let e=new Promise((e,t)=>T().setTimeout(t,this.dynamicImportTimeout));K.appTracerModule=await Promise.race([e,import(`@apptracer/sdk/lite`)])}catch(e){K.loadPromise=null,console.error(e)}})())}}class Ht{options;symbol;constructor(e,t){this.options=t,this.symbol=Symbol(e)}}var q=new Map,J=new Map,Ut=new Map,Y=new Map,Wt={resolve(e){if(!Y.has(e)){let t=Ut.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);Y.set(e,new t)}return Y.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){Y.forEach((t,n)=>{t instanceof e&&Y.delete(n)}),Ut.set(e,t)},getToken(e){if(q.has(e.symbol))return q.get(e.symbol);if(J.has(e.symbol)){let t=J.get(e.symbol)();return q.set(e.symbol,t),t}if(e.options?.factory){let t=e.options.factory();return q.set(e.symbol,t),t}throw Error(`No value registered in DI container for token "${e.symbol.description}"`)},registerToken(e,t){q.set(e.symbol,t)},registerFactory(e,t){J.set(e.symbol,t)},hasToken(e){return q.has(e.symbol)||J.has(e.symbol)||!!e.options?.factory},clear(){q.clear(),J.clear()}},{NativeAbortSignal:Gt,NativeAbortController:Kt}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function qt(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 Jt(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 Yt{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 Yt{constructor(){super(),this.listeners||Yt.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=Jt(e),n=qt(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 Xt(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 Zt(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!Xt({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&&Xt({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}),Qt=$?Zt({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,$t=$?Qt.fetch:Q.fetch,en=$?Qt.Request:Q.Request,tn=$?Z:Q.AbortController,nn=$?X:Q.AbortSignal,rn=(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)},an=e=>Q.clearTimeout(e),on=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),sn=!on(Q.requestIdleCallback)||!on(Q.cancelIdleCallback),cn=sn?rn:Q.requestIdleCallback,ln=sn?an:Q.cancelIdleCallback,un=(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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.90-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.90-dev.c6e9376db.0
|
|
3
|
+
* Wed, 13 May 2026 13:37:01 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-90/doc/
|
|
5
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.90-dev.58f425a02.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(),ee=()=>Math.trunc(w()),T=(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},te=(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},E={};r(E,{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``}},F=(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]=F(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},be=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 I(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 ee(){return s!==void 0}function T(...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 T.cancel=C,T.flush=w,T.pending=ee,T}var L=(e,t=0,n)=>I(e,t,{leading:!0,trailing:!0,...n,maxWait:t}),R=(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]=R(e[r],t):n[r]=e[r]}return n},xe=e=>R(e);class z 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 Se 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 Ce(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 we(...e){return new d(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new a))}var Te=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)}),Ee=e=>new d(t=>{let n=x(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function De(e){return new d(t=>{if(e instanceof Promise){let n=!1;return e.then(e=>{n||t.next(e)}).catch(e=>{n||t.error?.(e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var Oe=De,ke=(e,t)=>new d(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Ae extends a{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function je(e){return t=>new d(n=>t.subscribe(new Me(n,e)))}class Me{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 Ne={leading:!1,trailing:!0};function Pe(e,t=Ne){return n=>new d(r=>n.subscribe(new Fe(r,e,t)))}class Fe{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 Ie={leading:!0,trailing:!1};function Le(e,t=Ie){return n=>new d(r=>n.subscribe(new Re(r,e,t)))}class Re{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 ze(e){return t=>new d(n=>t.subscribe(new Be(n,e)))}class Be{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 Ve=(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)},He=(e,t)=>e instanceof Object&&t instanceof Object?Ve(e,t):e===t;function Ue(e=He){return t=>new d(n=>t.subscribe(new We(n,e)))}var B={};class We{destination;predicate;lastValue=B;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===B||!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 V(e){return t=>new d(n=>t.subscribe(new Ge(n,e)))}class Ge{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 Ke(e){return V(()=>e)}function qe(){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 Je(){return e=>new d(t=>e.subscribe(new Ye(t)))}class Ye{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 Xe(e){return t=>new d(n=>t.subscribe(new Ze(n,e)))}class Ze{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 Qe(e){return t=>new d(n=>t.subscribe(new $e(n,e)))}class $e{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 et(e=0){return t=>{let n=0,r=new z(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new d(e=>(n++,a(r.subscribe(e))))}}var tt=300,nt=(e,t=tt)=>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(L(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()}),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},rt=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},it=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},at=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),ot=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),st=e=>e!==void 0&&e!==``?e:ot().toString();function ct(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 lt(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 ut=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),dt=e=>{if(!ut(e))throw e},ft=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{dynamicImportTimeout=5e3;span;context;childTracers=[];initPromise;static rootTracer;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t}){W.dynamicImportStatus===`not_started`&&(W.dynamicImportPromise=this.loadOpentelemetry());let n=Date.now();this.initPromise=W.dynamicImportPromise.then(r=>{W.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t},n)})}init({name:e,getParentContext:t},n){let{opentelemetryApi:r}=W.dynamicImports,{context:i,trace:a}=r;this.span=W.rootTracer.startSpan(e,{startTime:n},t?.()),this.context=a.setSpan(i.active(),this.span)}async loadOpentelemetry(){if(W.dynamicImportStatus===`not_started`){W.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`),import(`@opentelemetry/resources`),import(`@opentelemetry/semantic-conventions`)]),[n,r,i,a,o]=await Promise.race([t,e]);W.dynamicImports={opentelemetryApi:n,opentelemetrySdk:r,tracer:i,opentelemetryResources:a,opentelemetrySemanticConventions:o},W.dynamicImportStatus=`completed`}catch{W.dynamicImportStatus=`failed`}}}isComponentTracerNotInitialized(){return _(this.span)||W.dynamicImportStatus===`failed`}log(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...U(t),type:`log`},n)})}error(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...U(t),type:`error`},n)})}critical(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...U(t),type:`critical`},n)})}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())})}}class pt extends W{constructor(){super({name:`Root`})}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=W.dynamicImports,{TracerUploadSpanExporter:s}=r,{WebTracerProvider:c,BatchSpanProcessor:l}=a,{resourceFromAttributes:u}=i,{ATTR_SERVICE_NAME:d}=o,f=new c({resource:u({[d]:`videoplayer-sdk-web`}),spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0},spanProcessors:[new l(new s({appToken:`L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb`}))]});f.register(),W.rootTracer=f.getTracer(`sdk-videoplayer-tracer`),super.init({name:e,getParentContext:t},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}}class mt{fakeTraceId;constructor(e){}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new mt({name:e})}end(){}getTraceId(){return this.fakeTraceId}}class ht{static createRootTracer(e=!1){return e?new pt:new mt}}var gt;(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`})(gt||={});var _t;(e=>{e.Armenian=`58`,e.Azerbaijani=`57`,e.Belarusian=`114`,e.English=`3`,e.Kazakh=`97`,e.Portuguese=`73`,e.Russian=`0`,e.Spanish=`4`,e.Ukrainian=`1`,e.Uzbek=`65`,e.Vietnamese=`75`})(_t||={});var vt=`vk.com`,yt=async(e,t,n)=>{let r=new URL(`https://${vt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),bt(await(await fetch(r.toString())).json(),n)},bt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),xt(n)])),xt=e=>Array.isArray(e)?e[0]:e,St;(e=>{e.RU=`ru`,e.EN=`en`})(St||={});var G=`__vk_vp_internals_exposure`;class Ct{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[G]?.[e]?.[t]??{}}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 wt={};r(wt,{subscribe:()=>Ot,push:()=>Dt,destroy:()=>Et,create:()=>Tt});var K=new Map,Tt=(e,t)=>K.set(e,t??[]),Et=e=>K.delete(e),Dt=(e,t)=>{let n=K.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Ot=(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)}},kt=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`,At=e=>v({id:e.id,message:e.message,category:e.category,data:jt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function jt(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Mt=e=>{let t=e.thrown instanceof Error&&!Object.isFrozen(e.thrown)?e.thrown:Error(e.message);return t.name=e.id,t},Nt=()=>{try{let{origin:e,pathname:t,search:n,hostname:r}=x()?.document?.location??{};return!r||r===`localhost`?void 0:{url:e+t,...new URLSearchParams(n).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{})}}catch{}};class q{static tracerErrorMap=new Map;static appTracerModule=null;static loadPromise=null;dynamicImportTimeout=5e3;componentName;subscription=new a;options;envParams;context;isEmbed;embedParent;constructor(e,t,n,r){this.componentName=e,this.options=t,this.envParams=n,this.context={...r};let{isEmbed:i,topOrigin:a}=ce();this.isEmbed=i,this.embedParent=a?new URL(a).hostname:void 0,this.options.enabled&&(this.loadModule(),this.init())}updateContext(e){Object.assign(this.context,e)}error(e,t){let{blackErrorCategoryList:n,blackErrorIdList:r,sampleRate:i,whiteErrorCategoryList:a,whiteErrorIdList:o}=this.options,{id:s,category:c}=e;if(n.length&&n.includes(c)||r.length&&r.includes(s)||a.length&&!a.includes(c)||o.length&&!o.includes(s)||Math.random()>=i)return;let l=q.tracerErrorMap.get(this.componentName);try{let n=Mt(e);l?.error(n,{crashIdSource:n.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...At(e),...Nt(),...this.isEmbed&&this.embedParent&&{iframe_host:this.embedParent}}})}catch(e){console.error(e)}}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}async init(){try{if(await q.loadPromise,q.tracerErrorMap.has(this.componentName)||_(q.appTracerModule))return;let{appTracerModule:e}=q,{initTracerError:t,initTracerErrorUploader:n,getTracerModules:r}=e,i=r(this.componentName),a=!i.error,o=i.error??t(this.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});g(this.options.userId)&&o.setUserId(this.options.userId),a&&n(this.componentName,{appToken:kt,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),q.tracerErrorMap.set(this.componentName,o)}catch(e){console.error(e)}}loadModule(){g(q.loadPromise)||(q.loadPromise=(async()=>{try{let e=new Promise((e,t)=>x().setTimeout(t,this.dynamicImportTimeout));q.appTracerModule=await Promise.race([e,import(`@apptracer/sdk/lite`)])}catch(e){q.loadPromise=null,console.error(e)}})())}}var{NativeAbortSignal:Pt,NativeAbortController:Ft}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function It(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 Lt(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 Rt{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 Rt{constructor(){super(),this.listeners||Rt.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=Lt(e),n=It(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 zt(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 Bt(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!zt({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&&zt({fetch:X.fetch,Request:X.Request,AbortController:X.AbortController}),Q=Z?Bt({fetch:X.fetch,Request:X.Request,AbortController:X.AbortController}):void 0,Vt=Z?Q.fetch:X.fetch,Ht=Z?Q.Request:X.Request,Ut=Z?Y:X.AbortController,Wt=Z?J:X.AbortSignal,Gt=(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)},Kt=e=>X.clearTimeout(e),qt=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),$=!qt(X.requestIdleCallback)||!qt(X.cancelIdleCallback),Jt=$?Gt:X.requestIdleCallback,Yt=$?Kt:X.cancelIdleCallback,Xt=(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,Xt as urlCanParsePolyfilled,Te as timeout,be as timeCodeToString,L as throttleFn,Le as throttle,Xe as tap,dt as suppressAbort,Qe as skip,et as shareReplay,E as safeStorage,Jt as requestIdleCallbackPolyfilled,Je as pairwise,qe as once,nt as observeElementSize,Oe as observableFrom,ee as nowInt,w as now,c as noop,we as merge,Ke as mapTo,V as map,yt as loadVKLangPack,it as isValidURL,_ as isNullable,g as isNonNullable,fe as isLowerOrEqual,M as isLower,P as isInvariantQuality,at as isIntersecting,de as isHigherOrEqual,ue as isHigher,S as isBrowserWindow,ut as isAbortError,Ee as interval,ct as interpolate,x as getWindow,ye as getVideoQualityLabel,ft as getTraceSubscriptionMethod,lt as getRangeAroundIndex,st as getPlayerId,pe as getHighestQuality,te as getExponentialDelay,ke as fromEvent,H as flattenObject,Ue as filterChanged,ze as filter,F as fillWithDefault,Vt as fetchPolyfilled,wt as devNull,ce as detectEmbed,I as debounceFn,Pe as debounce,Ce as combine,R as cloneDeepWith,xe as cloneDeep,rt as clearVideoElement,s as checkNever,Yt as cancelIdleCallbackPolyfilled,je 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,T as abortable,le as VideoQuality,Se as ValueSubject,_t as VKNumericLanguage,i as VERSION,ht as TracerFactory,Ae as SubscriptionRemovable,a as Subscription,f as Subject,Ht as RequestPolyfilled,z as ReplaySubject,d as Observable,p as Logger,Ct as InternalsExposure,St as InterfaceLanguage,G as INTERNAL_EXPOSE_GLOBAL_KEY,gt as ErrorCategory,q as AppTracer,Wt as AbortSignalPolyfilled,Ut as AbortControllerPolyfilled};
|
|
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.90-dev.c6e9376db.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),ee=(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)}),C=typeof x().performance?.now==`function`?()=>x().performance.now():()=>Date.now(),te=()=>Math.trunc(C()),w=(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},ne=(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},T={};r(T,{set:()=>ae,remove:()=>se,isPersistent:()=>re,has:()=>oe,get:()=>ie,clear:()=>ce});var E,D,O=`vk-videoplayer-dummy-key-${Math.random()}`,k=()=>{if(D!==void 0)return D;try{localStorage.setItem(O,`test`),localStorage.removeItem(O),D=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(O),D=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)D=2;else throw e}else throw e}return D===2&&(E=new Map),D},re=()=>k()===0,ie=e=>{let t=k();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return E?.get(e);default:o(t)}},ae=(e,t)=>{let n=k();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:E?.set(e,t);return;default:o(n)}},oe=e=>{let t=k();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return E?.has(e)??!1;default:return o(t),!1}},se=e=>{let t=k();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:E?.delete(e);return;default:o(t)}},ce=()=>{let e=k();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return E?.clear();default:o(e)}},A=()=>{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],me=Object.keys(j).sort((e,t)=>M(e,t)?-1:1),he=(e,t=.02)=>[...me].find(n=>j[n].height*(1+t)>=e),ge=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return me.find(e=>{let t=j[e];return t.width>=r&&t.height>=n})},_e=e=>j[e].height,N=e=>e===`Invariant quality`,ve=e=>e.every(e=>!N(e));function ye(e){if(N(e))throw Error(`Expected exact quality`)}var be=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},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 ee(){s!==void 0&&g(s),l=0,r=c=i=s=void 0}function C(){return s===void 0?o:S(Date.now())}function te(){return s!==void 0}function w(...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 w.cancel=ee,w.flush=C,w.pending=te,w}var Se=(e,t=0,n)=>F(e,t,{leading:!0,trailing:!0,...n,maxWait:t}),I=(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]=I(e[r],t):n[r]=e[r]}return n},Ce=e=>I(e);class we 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 Te 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 Ee(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 De(...e){return new d(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new a))}var Oe=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)}),ke=e=>new d(t=>{let n=x(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function Ae(e){return new d(t=>{if(e instanceof Promise){let n=!1;return e.then(e=>{n||t.next(e)}).catch(e=>{n||t.error?.(e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var je=Ae,Me=(e,t)=>new d(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Ne extends a{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Pe(e){return t=>new d(n=>t.subscribe(new Fe(n,e)))}class Fe{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 Ie={leading:!1,trailing:!0};function Le(e,t=Ie){return n=>new d(r=>n.subscribe(new Re(r,e,t)))}class Re{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 ze={leading:!0,trailing:!1};function Be(e,t=ze){return n=>new d(r=>n.subscribe(new Ve(r,e,t)))}class Ve{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 He(e){return t=>new d(n=>t.subscribe(new Ue(n,e)))}class Ue{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 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 d(n=>t.subscribe(new Je(n,e)))}var qe={};class Je{destination;predicate;lastValue=qe;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===qe||!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 Ye(e){return t=>new d(n=>t.subscribe(new Xe(n,e)))}class Xe{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 Ze(e){return Ye(()=>e)}function Qe(){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 $e(){return e=>new d(t=>e.subscribe(new et(t)))}class et{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 tt(e){return t=>new d(n=>t.subscribe(new nt(n,e)))}class nt{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 rt(e){return t=>new d(n=>t.subscribe(new it(n,e)))}class it{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 at(e=0){return t=>{let n=0,r=new we(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new d(e=>(n++,a(r.subscribe(e))))}}var ot=300,st=(e,t=ot)=>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(Se(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()}),L=(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=L(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},ct=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},lt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},ut=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),dt=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),ft=e=>e!==void 0&&e!==``?e:dt().toString();function pt(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 mt(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 ht=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),gt=e=>{if(!ht(e))throw e},_t=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?L(n):{value:n})},R=(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 z{dynamicImportTimeout=5e3;span;context;childTracers=[];initPromise;static rootTracer;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t}){z.dynamicImportStatus===`not_started`&&(z.dynamicImportPromise=this.loadOpentelemetry());let n=Date.now();this.initPromise=z.dynamicImportPromise.then(r=>{z.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t},n)})}init({name:e,getParentContext:t},n){let{opentelemetryApi:r}=z.dynamicImports,{context:i,trace:a}=r;this.span=z.rootTracer.startSpan(e,{startTime:n},t?.()),this.context=a.setSpan(i.active(),this.span)}async loadOpentelemetry(){if(z.dynamicImportStatus===`not_started`){z.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`),import(`@opentelemetry/resources`),import(`@opentelemetry/semantic-conventions`)]),[n,r,i,a,o]=await Promise.race([t,e]);z.dynamicImports={opentelemetryApi:n,opentelemetrySdk:r,tracer:i,opentelemetryResources:a,opentelemetrySemanticConventions:o},z.dynamicImportStatus=`completed`}catch{z.dynamicImportStatus=`failed`}}}isComponentTracerNotInitialized(){return _(this.span)||z.dynamicImportStatus===`failed`}log(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...R(t),type:`log`},n)})}error(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...R(t),type:`error`},n)})}critical(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...R(t),type:`critical`},n)})}createComponentTracer(e){let t=new z({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 vt extends z{constructor(){super({name:`Root`})}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=z.dynamicImports,{TracerUploadSpanExporter:s}=r,{WebTracerProvider:c,BatchSpanProcessor:l}=a,{resourceFromAttributes:u}=i,{ATTR_SERVICE_NAME:d}=o,f=new c({resource:u({[d]:`videoplayer-sdk-web`}),spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0},spanProcessors:[new l(new s({appToken:`L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb`}))]});f.register(),z.rootTracer=f.getTracer(`sdk-videoplayer-tracer`),super.init({name:e,getParentContext:t},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}}class B{fakeTraceId;constructor(e){}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new B({name:e})}end(){}getTraceId(){return this.fakeTraceId}}class yt{static createRootTracer(e=!1){return e?new vt:new B}}var V;(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`})(V||={});var H;(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`})(H||={});var bt=`vk.com`,xt=async(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(await(await fetch(r.toString())).json(),n)},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,U;(e=>{e.RU=`ru`,e.EN=`en`})(U||={});var W=`__vk_vp_internals_exposure`;class wt{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[W]?.[e]?.[t]??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[W]||(window[W]={}),window[W][e]||(window[W][e]={}),window[W][e][t]||(window[W][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[W]&&window[W][e]&&window[W][e][t]&&(delete window[W][e][t],Object.keys(window[W][e]).length||delete window[W][e],Object.keys(window[W]).length||delete window[W])}}var Tt={};r(Tt,{subscribe:()=>kt,push:()=>Ot,destroy:()=>Dt,create:()=>Et});var G=new Map,Et=(e,t)=>G.set(e,t??[]),Dt=e=>G.delete(e),Ot=(e,t)=>{let n=G.get(e);n&&(typeof n==`function`?n(t):n.push(t))},kt=(e,t)=>{let n=G.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);G.set(e,t)}},At=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`,jt=e=>v({id:e.id,message:e.message,category:e.category,data:Mt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Mt(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Nt=e=>{let t=e.thrown instanceof Error&&!Object.isFrozen(e.thrown)?e.thrown:Error(e.message);return t.name=e.id,t},Pt=()=>{try{let{origin:e,pathname:t,search:n,hostname:r}=x()?.document?.location??{};return!r||r===`localhost`?void 0:{url:e+t,...new URLSearchParams(n).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{})}}catch{}};class K{static tracerErrorMap=new Map;static appTracerModule=null;static loadPromise=null;dynamicImportTimeout=5e3;componentName;subscription=new a;options;envParams;context;isEmbed;embedParent;constructor(e,t,n,r){this.componentName=e,this.options=t,this.envParams=n,this.context={...r};let{isEmbed:i,topOrigin:a}=A();this.isEmbed=i,this.embedParent=a?new URL(a).hostname:void 0,this.options.enabled&&(this.loadModule(),this.init())}updateContext(e){Object.assign(this.context,e)}error(e,t){let{blackErrorCategoryList:n,blackErrorIdList:r,sampleRate:i,whiteErrorCategoryList:a,whiteErrorIdList:o}=this.options,{id:s,category:c}=e;if(n.length&&n.includes(c)||r.length&&r.includes(s)||a.length&&!a.includes(c)||o.length&&!o.includes(s)||Math.random()>=i)return;let l=K.tracerErrorMap.get(this.componentName);try{let n=Nt(e);l?.error(n,{crashIdSource:n.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...jt(e),...Pt(),...this.isEmbed&&this.embedParent&&{iframe_host:this.embedParent}}})}catch(e){console.error(e)}}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}async init(){try{if(await K.loadPromise,K.tracerErrorMap.has(this.componentName)||_(K.appTracerModule))return;let{appTracerModule:e}=K,{initTracerError:t,initTracerErrorUploader:n,getTracerModules:r}=e,i=r(this.componentName),a=!i.error,o=i.error??t(this.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});g(this.options.userId)&&o.setUserId(this.options.userId),a&&n(this.componentName,{appToken:At,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),K.tracerErrorMap.set(this.componentName,o)}catch(e){console.error(e)}}loadModule(){g(K.loadPromise)||(K.loadPromise=(async()=>{try{let e=new Promise((e,t)=>x().setTimeout(t,this.dynamicImportTimeout));K.appTracerModule=await Promise.race([e,import(`@apptracer/sdk/lite`)])}catch(e){K.loadPromise=null,console.error(e)}})())}}class Ft{options;symbol;constructor(e,t){this.options=t,this.symbol=Symbol(e)}}var q=new Map,J=new Map,It=new Map,Y=new Map,Lt={resolve(e){if(!Y.has(e)){let t=It.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);Y.set(e,new t)}return Y.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){Y.forEach((t,n)=>{t instanceof e&&Y.delete(n)}),It.set(e,t)},getToken(e){if(q.has(e.symbol))return q.get(e.symbol);if(J.has(e.symbol)){let t=J.get(e.symbol)();return q.set(e.symbol,t),t}if(e.options?.factory){let t=e.options.factory();return q.set(e.symbol,t),t}throw Error(`No value registered in DI container for token "${e.symbol.description}"`)},registerToken(e,t){q.set(e.symbol,t)},registerFactory(e,t){J.set(e.symbol,t)},hasToken(e){return q.has(e.symbol)||J.has(e.symbol)||!!e.options?.factory},clear(){q.clear(),J.clear()}},{NativeAbortSignal:Rt,NativeAbortController:zt}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function Bt(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 Vt(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 Ht{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 Ht{constructor(){super(),this.listeners||Ht.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=Vt(e),n=Bt(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 Ut(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 Wt(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!Ut({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&&Ut({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}),Gt=$?Wt({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,Kt=$?Gt.fetch:Q.fetch,qt=$?Gt.Request:Q.Request,Jt=$?Z:Q.AbortController,Yt=$?X:Q.AbortSignal,Xt=(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)},Zt=e=>Q.clearTimeout(e),Qt=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),$t=!Qt(Q.requestIdleCallback)||!Qt(Q.cancelIdleCallback),en=$t?Xt:Q.requestIdleCallback,tn=$t?Zt:Q.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}};export{v as withoutNullable,ge as videoSizeToQuality,_e as videoQualityToHeight,he as videoHeightToQuality,nn as urlCanParsePolyfilled,Oe as timeout,xe as timeCodeToString,Se as throttleFn,Be as throttle,tt as tap,gt as suppressAbort,rt as skip,at as shareReplay,T as safeStorage,en as requestIdleCallbackPolyfilled,$e as pairwise,Qe as once,st as observeElementSize,je as observableFrom,te as nowInt,C as now,c as noop,De as merge,Ze as mapTo,Ye as map,xt as loadVKLangPack,lt as isValidURL,_ as isNullable,g as isNonNullable,fe as isLowerOrEqual,M as isLower,N as isInvariantQuality,ut as isIntersecting,de as isHigherOrEqual,ue as isHigher,S as isBrowserWindow,ht as isAbortError,ke as interval,pt as interpolate,x as getWindow,be as getVideoQualityLabel,_t as getTraceSubscriptionMethod,mt as getRangeAroundIndex,ft as getPlayerId,pe as getHighestQuality,ne as getExponentialDelay,Me as fromEvent,L as flattenObject,Ke as filterChanged,He as filter,P as fillWithDefault,Kt as fetchPolyfilled,Lt as diContainer,Tt as devNull,A as detectEmbed,F as debounceFn,Le as debounce,Ee as combine,I as cloneDeepWith,Ce as cloneDeep,ct as clearVideoElement,s as checkNever,tn as cancelIdleCallbackPolyfilled,Pe as buffer,ye as assertQualityIsExact,h as assertNullable,y as assertNotEmptyArray,m as assertNonNullable,o as assertNever,b as assertEmptyArray,ve as areQualitiesExact,ee as addScript,w as abortable,le as VideoQuality,Te as ValueSubject,H as VKNumericLanguage,i as VERSION,yt as TracerFactory,Ne as SubscriptionRemovable,a as Subscription,f as Subject,qt as RequestPolyfilled,we as ReplaySubject,d as Observable,p as Logger,wt as InternalsExposure,U as InterfaceLanguage,Ft as InjectionToken,W as INTERNAL_EXPOSE_GLOBAL_KEY,V as ErrorCategory,K as AppTracer,Yt as AbortSignalPolyfilled,Jt as AbortControllerPolyfilled};
|
package/evergreen.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.90-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.90-dev.c6e9376db.0
|
|
3
|
+
* Wed, 13 May 2026 13:37:01 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-90/doc/
|
|
5
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.90-dev.58f425a02.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),ee=(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)}),C=typeof x().performance?.now==`function`?()=>x().performance.now():()=>Date.now(),w=()=>Math.trunc(C()),T=(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},te=(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},ne={};r(ne,{set:()=>ae,remove:()=>se,isPersistent:()=>re,has:()=>oe,get:()=>ie,clear:()=>ce});var E,D,O=`vk-videoplayer-dummy-key-${Math.random()}`,k=()=>{if(D!==void 0)return D;try{localStorage.setItem(O,`test`),localStorage.removeItem(O),D=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(O),D=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)D=2;else throw e}else throw e}return D===2&&(E=new Map),D},re=()=>k()===0,ie=e=>{let t=k();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return E?.get(e);default:o(t)}},ae=(e,t)=>{let n=k();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:E?.set(e,t);return;default:o(n)}},oe=e=>{let t=k();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return E?.has(e)??!1;default:return o(t),!1}},se=e=>{let t=k();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:E?.delete(e);return;default:o(t)}},ce=()=>{let e=k();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return E?.clear();default:o(e)}},A=()=>{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)}},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}},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 ee(){s!==void 0&&g(s),l=0,r=c=i=s=void 0}function C(){return s===void 0?o:S(Date.now())}function w(){return s!==void 0}function T(...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 T.cancel=ee,T.flush=C,T.pending=w,T}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)}});function Ee(e){return new d(t=>{if(e instanceof Promise){let n=!1;return e.then(e=>{n||t.next(e)}).catch(e=>{n||t.error?.(e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var De=Ee,Oe=(e,t)=>new d(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class ke extends a{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Ae(e){return t=>new d(n=>t.subscribe(new je(n,e)))}class je{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 Me={leading:!1,trailing:!0};function Ne(e,t=Me){return n=>new d(r=>n.subscribe(new Pe(r,e,t)))}class Pe{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 Fe={leading:!0,trailing:!1};function Ie(e,t=Fe){return n=>new d(r=>n.subscribe(new Le(r,e,t)))}class Le{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 Re(e){return t=>new d(n=>t.subscribe(new ze(n,e)))}class ze{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 Be=(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)},Ve=(e,t)=>e instanceof Object&&t instanceof Object?Be(e,t):e===t;function He(e=Ve){return t=>new d(n=>t.subscribe(new Ue(n,e)))}var V={};class Ue{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 We(n,e)))}class We{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 Ge(e){return H(()=>e)}function Ke(){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 qe(){return e=>new d(t=>e.subscribe(new Je(t)))}class Je{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 Ye(e){return t=>new d(n=>t.subscribe(new Xe(n,e)))}class Xe{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 Ze(e){return t=>new d(n=>t.subscribe(new Qe(n,e)))}class Qe{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 $e(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 et=300,tt=(e,t=et)=>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},nt=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},rt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},it=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),at=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),ot=e=>e!==void 0&&e!==``?e:at().toString();function st(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 ct(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),lt=e=>{if(!W(e))throw e},ut=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){let{opentelemetryApi:r}=K.dynamicImports,{context:i,trace:a}=r;this.span=K.rootTracer.startSpan(e,{startTime:n},t?.()),this.context=a.setSpan(i.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`),import(`@opentelemetry/resources`),import(`@opentelemetry/semantic-conventions`)]),[n,r,i,a,o]=await Promise.race([t,e]);K.dynamicImports={opentelemetryApi:n,opentelemetrySdk:r,tracer:i,opentelemetryResources:a,opentelemetrySemanticConventions:o},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 dt extends K{constructor(){super({name:`Root`})}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=K.dynamicImports,{TracerUploadSpanExporter:s}=r,{WebTracerProvider:c,BatchSpanProcessor:l}=a,{resourceFromAttributes:u}=i,{ATTR_SERVICE_NAME:d}=o,f=new c({resource:u({[d]:`videoplayer-sdk-web`}),spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0},spanProcessors:[new l(new s({appToken:`L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb`}))]});f.register(),K.rootTracer=f.getTracer(`sdk-videoplayer-tracer`),super.init({name:e,getParentContext:t},n)}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(){}getTraceId(){return this.fakeTraceId}}class ft{static createRootTracer(e=!1){return e?new dt: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 pt=`vk.com`,mt=async(e,t,n)=>{let r=new URL(`https://${pt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),ht(await(await fetch(r.toString())).json(),n)},ht=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),gt(n)])),gt=e=>Array.isArray(e)?e[0]:e,X;(e=>{e.RU=`ru`,e.EN=`en`})(X||={});var Z=`__vk_vp_internals_exposure`;class _t{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 vt={};r(vt,{subscribe:()=>St,push:()=>xt,destroy:()=>bt,create:()=>yt});var Q=new Map,yt=(e,t)=>Q.set(e,t??[]),bt=e=>Q.delete(e),xt=(e,t)=>{let n=Q.get(e);n&&(typeof n==`function`?n(t):n.push(t))},St=(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)}},Ct=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`,wt=e=>v({id:e.id,message:e.message,category:e.category,data:Tt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Tt(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Et=e=>{let t=e.thrown instanceof Error&&!Object.isFrozen(e.thrown)?e.thrown:Error(e.message);return t.name=e.id,t},Dt=()=>{try{let{origin:e,pathname:t,search:n,hostname:r}=x()?.document?.location??{};return!r||r===`localhost`?void 0:{url:e+t,...new URLSearchParams(n).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{})}}catch{}};class ${static tracerErrorMap=new Map;static appTracerModule=null;static loadPromise=null;dynamicImportTimeout=5e3;componentName;subscription=new a;options;envParams;context;isEmbed;embedParent;constructor(e,t,n,r){this.componentName=e,this.options=t,this.envParams=n,this.context={...r};let{isEmbed:i,topOrigin:a}=A();this.isEmbed=i,this.embedParent=a?new URL(a).hostname:void 0,this.options.enabled&&(this.loadModule(),this.init())}updateContext(e){Object.assign(this.context,e)}error(e,t){let{blackErrorCategoryList:n,blackErrorIdList:r,sampleRate:i,whiteErrorCategoryList:a,whiteErrorIdList:o}=this.options,{id:s,category:c}=e;if(n.length&&n.includes(c)||r.length&&r.includes(s)||a.length&&!a.includes(c)||o.length&&!o.includes(s)||Math.random()>=i)return;let l=$.tracerErrorMap.get(this.componentName);try{let n=Et(e);l?.error(n,{crashIdSource:n.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...wt(e),...Dt(),...this.isEmbed&&this.embedParent&&{iframe_host:this.embedParent}}})}catch(e){console.error(e)}}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,getTracerModules:r}=e,i=r(this.componentName),a=!i.error,o=i.error??t(this.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});g(this.options.userId)&&o.setUserId(this.options.userId),a&&n(this.componentName,{appToken:Ct,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),$.tracerErrorMap.set(this.componentName,o)}catch(e){console.error(e)}}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(e){$.loadPromise=null,console.error(e)}})())}}export{v as withoutNullable,me as videoSizeToQuality,he as videoQualityToHeight,pe as videoHeightToQuality,we as timeout,ye as timeCodeToString,R as throttleFn,Ie as throttle,Ye as tap,lt as suppressAbort,Ze as skip,$e as shareReplay,ne as safeStorage,qe as pairwise,Ke as once,tt as observeElementSize,De as observableFrom,w as nowInt,C as now,c as noop,Ce as merge,Ge as mapTo,H as map,mt as loadVKLangPack,rt as isValidURL,_ as isNullable,g as isNonNullable,de as isLowerOrEqual,N as isLower,F as isInvariantQuality,it as isIntersecting,ue as isHigherOrEqual,le as isHigher,S as isBrowserWindow,W as isAbortError,Te as interval,st as interpolate,x as getWindow,ve as getVideoQualityLabel,ut as getTraceSubscriptionMethod,ct as getRangeAroundIndex,ot as getPlayerId,fe as getHighestQuality,te as getExponentialDelay,Oe as fromEvent,U as flattenObject,He as filterChanged,Re as filter,I as fillWithDefault,vt as devNull,A as detectEmbed,L as debounceFn,Ne as debounce,Se as combine,z as cloneDeepWith,be as cloneDeep,nt as clearVideoElement,s as checkNever,Ae as buffer,_e as assertQualityIsExact,h as assertNullable,y as assertNotEmptyArray,m as assertNonNullable,o as assertNever,b as assertEmptyArray,ge as areQualitiesExact,ee as addScript,T as abortable,j as VideoQuality,xe as ValueSubject,Y as VKNumericLanguage,i as VERSION,ft as TracerFactory,ke as SubscriptionRemovable,a as Subscription,f as Subject,B as ReplaySubject,d as Observable,p as Logger,_t as InternalsExposure,X as InterfaceLanguage,Z as INTERNAL_EXPOSE_GLOBAL_KEY,J as ErrorCategory,$ as AppTracer};
|
|
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.90-dev.c6e9376db.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)}},M=()=>{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)}},se;(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`})(se||={});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}},ce=(e,t)=>N[e].height>N[t].height,le=(e,t)=>N[e].height>=N[t].height,P=(e,t)=>N[e].height<N[t].height,ue=(e,t)=>N[e].height<=N[t].height,de=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),fe=(e,t=.02)=>[...F].find(n=>N[n].height*(1+t)>=e),pe=({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})},me=e=>N[e].height,I=e=>e===`Invariant quality`,he=e=>e.every(e=>!I(e));function ge(e){if(I(e))throw Error(`Expected exact quality`)}var _e=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},ve=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 ye(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 be=(e,t=0,n)=>ye(e,t,{leading:!0,trailing:!0,...n,maxWait:t}),R=(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]=R(e[r],t):n[r]=e[r]}return n},xe=e=>R(e);class Se 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 Ce 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 we(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 Te(...e){return new d(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new a))}var Ee=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)}),De=e=>new d(t=>{let n=x(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function Oe(e){return new d(t=>{if(e instanceof Promise){let n=!1;return e.then(e=>{n||t.next(e)}).catch(e=>{n||t.error?.(e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var ke=Oe,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 Se(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(be(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()}),z=(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=z(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 B=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),pt=e=>{if(!B(e))throw e},mt=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?z(n):{value:n})},V=(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 H{dynamicImportTimeout=5e3;span;context;childTracers=[];initPromise;static rootTracer;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t}){H.dynamicImportStatus===`not_started`&&(H.dynamicImportPromise=this.loadOpentelemetry());let n=Date.now();this.initPromise=H.dynamicImportPromise.then(r=>{H.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t},n)})}init({name:e,getParentContext:t},n){let{opentelemetryApi:r}=H.dynamicImports,{context:i,trace:a}=r;this.span=H.rootTracer.startSpan(e,{startTime:n},t?.()),this.context=a.setSpan(i.active(),this.span)}async loadOpentelemetry(){if(H.dynamicImportStatus===`not_started`){H.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`),import(`@opentelemetry/resources`),import(`@opentelemetry/semantic-conventions`)]),[n,r,i,a,o]=await Promise.race([t,e]);H.dynamicImports={opentelemetryApi:n,opentelemetrySdk:r,tracer:i,opentelemetryResources:a,opentelemetrySemanticConventions:o},H.dynamicImportStatus=`completed`}catch{H.dynamicImportStatus=`failed`}}}isComponentTracerNotInitialized(){return _(this.span)||H.dynamicImportStatus===`failed`}log(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...V(t),type:`log`},n)})}error(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...V(t),type:`error`},n)})}critical(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...V(t),type:`critical`},n)})}createComponentTracer(e){let t=new H({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 H{constructor(){super({name:`Root`})}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=H.dynamicImports,{TracerUploadSpanExporter:s}=r,{WebTracerProvider:c,BatchSpanProcessor:l}=a,{resourceFromAttributes:u}=i,{ATTR_SERVICE_NAME:d}=o,f=new c({resource:u({[d]:`videoplayer-sdk-web`}),spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0},spanProcessors:[new l(new s({appToken:`L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb`}))]});f.register(),H.rootTracer=f.getTracer(`sdk-videoplayer-tracer`),super.init({name:e,getParentContext:t},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}}class U{fakeTraceId;constructor(e){}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new U({name:e})}end(){}getTraceId(){return this.fakeTraceId}}class gt{static createRootTracer(e=!1){return e?new ht:new U}}var W;(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`})(W||={});var G;(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`})(G||={});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,K;(e=>{e.RU=`ru`,e.EN=`en`})(K||={});var q=`__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[q]?.[e]?.[t]??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[q]||(window[q]={}),window[q][e]||(window[q][e]={}),window[q][e][t]||(window[q][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[q]&&window[q][e]&&window[q][e][t]&&(delete window[q][e][t],Object.keys(window[q][e]).length||delete window[q][e],Object.keys(window[q]).length||delete window[q])}}var J={};r(J,{subscribe:()=>Tt,push:()=>wt,destroy:()=>Ct,create:()=>St});var Y=new Map,St=(e,t)=>Y.set(e,t??[]),Ct=e=>Y.delete(e),wt=(e,t)=>{let n=Y.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Tt=(e,t)=>{let n=Y.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);Y.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=>{let t=e.thrown instanceof Error&&!Object.isFrozen(e.thrown)?e.thrown: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||r===`localhost`?void 0:{url:e+t,...new URLSearchParams(n).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{})}}catch{}};class X{static tracerErrorMap=new Map;static appTracerModule=null;static loadPromise=null;dynamicImportTimeout=5e3;componentName;subscription=new a;options;envParams;context;isEmbed;embedParent;constructor(e,t,n,r){this.componentName=e,this.options=t,this.envParams=n,this.context={...r};let{isEmbed:i,topOrigin:a}=M();this.isEmbed=i,this.embedParent=a?new URL(a).hostname:void 0,this.options.enabled&&(this.loadModule(),this.init())}updateContext(e){Object.assign(this.context,e)}error(e,t){let{blackErrorCategoryList:n,blackErrorIdList:r,sampleRate:i,whiteErrorCategoryList:a,whiteErrorIdList:o}=this.options,{id:s,category:c}=e;if(n.length&&n.includes(c)||r.length&&r.includes(s)||a.length&&!a.includes(c)||o.length&&!o.includes(s)||Math.random()>=i)return;let l=X.tracerErrorMap.get(this.componentName);try{let n=kt(e);l?.error(n,{crashIdSource:n.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...Dt(e),...At(),...this.isEmbed&&this.embedParent&&{iframe_host:this.embedParent}}})}catch(e){console.error(e)}}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}async init(){try{if(await X.loadPromise,X.tracerErrorMap.has(this.componentName)||_(X.appTracerModule))return;let{appTracerModule:e}=X,{initTracerError:t,initTracerErrorUploader:n,getTracerModules:r}=e,i=r(this.componentName),a=!i.error,o=i.error??t(this.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});g(this.options.userId)&&o.setUserId(this.options.userId),a&&n(this.componentName,{appToken:Et,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),X.tracerErrorMap.set(this.componentName,o)}catch(e){console.error(e)}}loadModule(){g(X.loadPromise)||(X.loadPromise=(async()=>{try{let e=new Promise((e,t)=>x().setTimeout(t,this.dynamicImportTimeout));X.appTracerModule=await Promise.race([e,import(`@apptracer/sdk/lite`)])}catch(e){X.loadPromise=null,console.error(e)}})())}}class jt{options;symbol;constructor(e,t){this.options=t,this.symbol=Symbol(e)}}var Z=new Map,Q=new Map,Mt=new Map,$=new Map,Nt={resolve(e){if(!$.has(e)){let t=Mt.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);$.set(e,new t)}return $.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){$.forEach((t,n)=>{t instanceof e&&$.delete(n)}),Mt.set(e,t)},getToken(e){if(Z.has(e.symbol))return Z.get(e.symbol);if(Q.has(e.symbol)){let t=Q.get(e.symbol)();return Z.set(e.symbol,t),t}if(e.options?.factory){let t=e.options.factory();return Z.set(e.symbol,t),t}throw Error(`No value registered in DI container for token "${e.symbol.description}"`)},registerToken(e,t){Z.set(e.symbol,t)},registerFactory(e,t){Q.set(e.symbol,t)},hasToken(e){return Z.has(e.symbol)||Q.has(e.symbol)||!!e.options?.factory},clear(){Z.clear(),Q.clear()}};export{v as withoutNullable,pe as videoSizeToQuality,me as videoQualityToHeight,fe as videoHeightToQuality,Ee as timeout,ve as timeCodeToString,be as throttleFn,Re as throttle,$e as tap,pt as suppressAbort,tt as skip,rt as shareReplay,D as safeStorage,Ze as pairwise,Xe as once,at as observeElementSize,ke as observableFrom,T as nowInt,w as now,c as noop,Te as merge,Ye as mapTo,qe as map,vt as loadVKLangPack,st as isValidURL,_ as isNullable,g as isNonNullable,ue as isLowerOrEqual,P as isLower,I as isInvariantQuality,ct as isIntersecting,le as isHigherOrEqual,ce as isHigher,S as isBrowserWindow,B as isAbortError,De as interval,dt as interpolate,x as getWindow,_e as getVideoQualityLabel,mt as getTraceSubscriptionMethod,ft as getRangeAroundIndex,ut as getPlayerId,de as getHighestQuality,ee as getExponentialDelay,Ae as fromEvent,z as flattenObject,We as filterChanged,Be as filter,L as fillWithDefault,Nt as diContainer,J as devNull,M as detectEmbed,ye as debounceFn,Fe as debounce,we as combine,R as cloneDeepWith,xe as cloneDeep,ot as clearVideoElement,s as checkNever,Me as buffer,ge as assertQualityIsExact,h as assertNullable,y as assertNotEmptyArray,m as assertNonNullable,o as assertNever,b as assertEmptyArray,he as areQualitiesExact,C as addScript,E as abortable,se as VideoQuality,Ce as ValueSubject,G as VKNumericLanguage,i as VERSION,gt as TracerFactory,je as SubscriptionRemovable,a as Subscription,f as Subject,Se as ReplaySubject,d as Observable,p as Logger,xt as InternalsExposure,K as InterfaceLanguage,jt as InjectionToken,q as INTERNAL_EXPOSE_GLOBAL_KEY,W as ErrorCategory,X as AppTracer};
|
package/package.json
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DI контейнер для библиотеки
|
|
3
|
+
*
|
|
4
|
+
* Используется для внедрения зависимостей в stores и другие компоненты.
|
|
5
|
+
*/
|
|
6
|
+
import type { AnyConstructor, Constructor } from "../types";
|
|
7
|
+
/**
|
|
8
|
+
* Токен для внедрения зависимостей.
|
|
9
|
+
* Используется для регистрации и получения значений из DI контейнера.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const SUBSCRIPTION = new InjectionToken<Subscription>('Subscription');
|
|
14
|
+
* diContainer.registerToken(SUBSCRIPTION, subscription);
|
|
15
|
+
* const sub = diContainer.getToken(SUBSCRIPTION);
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare class InjectionToken<T = unknown> {
|
|
19
|
+
readonly options?: {
|
|
20
|
+
/** Фабрика для создания значения по умолчанию */
|
|
21
|
+
factory?: () => T;
|
|
22
|
+
} | undefined;
|
|
23
|
+
/** Уникальный символ для идентификации токена */
|
|
24
|
+
readonly symbol: symbol;
|
|
25
|
+
constructor(description: string, options?: {
|
|
26
|
+
factory?: () => T;
|
|
27
|
+
} | undefined);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Интерфейс DI контейнера
|
|
31
|
+
*/
|
|
32
|
+
export interface IDIContainer {
|
|
33
|
+
resolve<T>(token: AnyConstructor<T>): T;
|
|
34
|
+
resolveOptional<T>(token: AnyConstructor<T>): T | undefined;
|
|
35
|
+
replace<T>(token: AnyConstructor<T>, ClassConstructor: Constructor<T>): void;
|
|
36
|
+
/** Получить значение по токену */
|
|
37
|
+
getToken<T>(token: InjectionToken<T>): T;
|
|
38
|
+
/** Зарегистрировать значение для токена */
|
|
39
|
+
registerToken<T>(token: InjectionToken<T>, value: T): void;
|
|
40
|
+
/** Зарегистрировать фабрику для токена */
|
|
41
|
+
registerFactory<T>(token: InjectionToken<T>, factory: () => T): void;
|
|
42
|
+
/** Проверить наличие токена */
|
|
43
|
+
hasToken(token: InjectionToken<unknown>): boolean;
|
|
44
|
+
/** Очистить контейнер */
|
|
45
|
+
clear(): void;
|
|
46
|
+
}
|