@vkontakte/videoplayer-shared 1.0.95-dev.02230ed18.0 → 1.0.95-dev.1022d4dbd.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/index.d.ts +1 -0
- package/types/reactive/combineLatest.d.ts +6 -0
- package/types/reactive/index.d.ts +1 -0
- package/types/types/DebugData.d.ts +25 -0
package/es2015.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.95-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.95-dev.1022d4dbd.0
|
|
3
|
+
* Tue, 14 Jul 2026 18:23:25 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-95/doc/
|
|
5
5
|
*/
|
|
6
|
-
function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}var t=e;function n(e,n){if(t(e)!=`object`||!e)return e;var r=e[Symbol._oxc_toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(t(i)!=`object`)return i;throw TypeError(`@@_oxc_toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}var t=e,r=n;function i(e){var n=r(e,`string`);return t(n)==`symbol`?n:n+``}var a=i;function o(e,t,n){return(t=a(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var s=o;function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?c(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function d(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){u(a,r,i,o,s,`next`,e)}function s(e){u(a,r,i,o,s,`throw`,e)}o(void 0)})}}var f=l,p=d;let m;var h=Object.defineProperty,g=Object.getOwnPropertyNames,_=Object.getOwnPropertyDescriptor,ee=Object.prototype.hasOwnProperty;function v(e){return this[e]}var y=e=>{var t=(b??=new WeakMap).get(e),n;if(t)return t;if(t=h({},`__esModule`,{value:!0}),e&&typeof e==`object`||typeof e==`function`)for(var r of g(e))ee.call(t,r)||h(t,r,{get:v.bind(e,r),enumerable:!(n=_(e,r))||n.enumerable});return b.set(e,t),t},b,te=e=>e;function x(e,t){this[e]=te.bind(null,t)}var S=(e,t)=>{for(var n in t)h(e,n,{get:t[n],enumerable:!0,configurable:!0,set:x.bind(t,n)})},C={};S(C,{withoutNullable:()=>le,videoSizeToQuality:()=>je,videoQualityToHeight:()=>Me,videoHeightToQuality:()=>Ae,urlCanParsePolyfilled:()=>ir,timeout:()=>Ge,timeCodeToString:()=>Le,throttleFn:()=>ze,throttle:()=>rt,tap:()=>_t,suppressAbort:()=>Mt,stringTrimStart:()=>Kn,stringTrimRight:()=>Yn,stringTrimLeft:()=>Jn,stringTrimEnd:()=>qn,stringReplaceAll:()=>Gn,stringPadStart:()=>Wn,stringPadEnd:()=>Un,stringMatchAll:()=>Hn,stringAt:()=>Vn,skip:()=>yt,shareReplay:()=>xt,safeStorage:()=>ve,requestIdleCallbackPolyfilled:()=>tr,promiseWithResolvers:()=>On,promiseTry:()=>Dn,promiseFinally:()=>En,promiseAny:()=>Tn,promiseAllSettled:()=>wn,pairwise:()=>ht,once:()=>mt,observeElementSize:()=>Ct,observableFrom:()=>Je,objectValues:()=>Cn,objectHasOwn:()=>Sn,objectFromEntries:()=>bn,objectEntries:()=>yn,nowInt:()=>he,now:()=>me,noop:()=>E,merge:()=>We,mapTo:()=>pt,map:()=>H,loadVKLangPack:()=>Gt,isValidURL:()=>Tt,isNullable:()=>A,isNonNullable:()=>k,isLowerOrEqual:()=>De,isLower:()=>z,isInvariantQuality:()=>B,isIntersecting:()=>Et,isHigherOrEqual:()=>Ee,isHigher:()=>Te,isBrowserWindow:()=>fe,isAbortError:()=>jt,interval:()=>Ke,interpolate:()=>kt,includesPolyfilled:()=>rr,globalThisPolyfill:()=>vn,getWindow:()=>j,getVideoQualityLabel:()=>Fe,getTraceSubscriptionMethod:()=>Ft,getRangeAroundIndex:()=>At,getPlayerId:()=>Ot,getMessageFromError:()=>Nt,getHighestQuality:()=>Oe,getExponentialDelay:()=>_e,fromEvent:()=>Ye,flattenObject:()=>U,filterChanged:()=>lt,filter:()=>at,fillWithDefault:()=>Ie,fetchPolyfilled:()=>Ln,devNull:()=>Xt,detectEmbed:()=>I,debounceFn:()=>Re,debounce:()=>et,createDIContainer:()=>sn,combine:()=>Ue,cloneDeepWith:()=>V,cloneDeep:()=>Be,clearVideoElement:()=>wt,checkNever:()=>re,cancelIdleCallbackPolyfilled:()=>nr,buffer:()=>Ze,atPolyfilled:()=>Xn,assertQualityIsExact:()=>Pe,assertNullable:()=>ce,assertNotEmptyArray:()=>ue,assertNonNullable:()=>se,assertNever:()=>T,assertEmptyArray:()=>de,arrayWith:()=>_n,arrayToSpliced:()=>gn,arrayToSorted:()=>hn,arrayToReversed:()=>mn,arrayIncludes:()=>pn,arrayFlatMap:()=>fn,arrayFlat:()=>dn,arrayFindLastIndex:()=>un,arrayFindLast:()=>ln,arrayAt:()=>cn,areQualitiesExact:()=>Ne,addScript:()=>pe,abortable:()=>ge,VideoQuality:()=>L,ValueSubject:()=>He,VKNumericLanguage:()=>Ut,VERSION:()=>ne,TracerFactory:()=>Vt,SubscriptionRemovable:()=>Xe,Subscription:()=>w,Subject:()=>O,RequestPolyfilled:()=>Rn,ReplaySubject:()=>Ve,Observable:()=>D,Logger:()=>oe,InternalsExposure:()=>Yt,InterfaceLanguage:()=>Jt,InjectionToken:()=>on,INTERNAL_EXPOSE_GLOBAL_KEY:()=>q,ErrorCategory:()=>Ht,CircularBuffer:()=>Pt,AppTracer:()=>Y,AbortSignalPolyfilled:()=>Bn,AbortControllerPolyfilled:()=>zn}),module.exports=y(C);var ne=`1.0.95-dev.02230ed18.0`;class w{constructor(){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 T=e=>{throw Error(`${e} is value of unexpected type`)},re=e=>{},E=()=>{},ie=e=>{throw console.error(e),e},ae=e=>{console.error(e)};class D{constructor(e){this.suppressErrors=!1,e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?ae:ie,r;r=t?typeof t==`function`?{next:t,error:E}:{next:e=>t.next(e),error:e=>t.error?.call(t,e)}:{next:n,error:E};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 w().add(()=>{switch(i.next=E,i.error=E,typeof a){case`function`:a();return;case`object`:a.unsubscribe();return;case`undefined`:return;default:return T(a)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class O extends D{constructor(){super(),this.keyCounter=0,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 w().add(()=>this.subscribers.delete(t))}}class oe{constructor(){this.log$=new O,this.logs=[],this.log=e=>{let t=f(f({},e),{},{timestamp:Date.now()});this.logs.push(t),this.log$.next(t)},this.getAllLogs=()=>this.logs}createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch{n={message:"error in `createCustomLog`",component:`Logger`}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>f({component:e},t))}}function se(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function ce(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function k(e){return e!=null}function A(e){return e==null}var le=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>k(t)));function ue(e,t){if(!e?.length)throw Error(t)}function de(e,t){if(e?.length)throw Error(t)}var j=()=>globalThis,fe=(e=j())=>!!(e.window&&e.screen),pe=(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=j().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)}),me=typeof j().performance?.now==`function`?()=>j().performance.now():()=>Date.now(),he=()=>Math.trunc(me()),ge=(e,t)=>p(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}),_e=(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},ve={};S(ve,{set:()=>xe,remove:()=>Ce,isPersistent:()=>ye,has:()=>Se,get:()=>be,clear:()=>we});var M,N,P=`vk-videoplayer-dummy-key-${Math.random()}`,F=()=>{if(N!==void 0)return N;try{localStorage.setItem(P,`test`),localStorage.removeItem(P),N=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(P),N=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)N=2;else throw e}else throw e}return N===2&&(M=new Map),N},ye=()=>F()===0,be=e=>{let t=F();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return M?.get(e);default:T(t)}},xe=(e,t)=>{let n=F();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:M?.set(e,t);return;default:T(n)}},Se=e=>{let t=F();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return M?.has(e)??!1;default:return T(t),!1}},Ce=e=>{let t=F();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:M?.delete(e);return;default:T(t)}},we=()=>{let e=F();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return M?.clear();default:T(e)}},I=()=>{let e,t=[],n=j();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)}},L;(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`})(L||={});var R={"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}},Te=(e,t)=>R[e].height>R[t].height,Ee=(e,t)=>R[e].height>=R[t].height,z=(e,t)=>R[e].height<R[t].height,De=(e,t)=>R[e].height<=R[t].height,Oe=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:z(e,t)?1:-1)[0],ke=Object.keys(R).sort((e,t)=>z(e,t)?-1:1),Ae=(e,t=.02)=>[...ke].find(n=>R[n].height*(1+t)>=e),je=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return ke.find(e=>{let t=R[e];return t.width>=r&&t.height>=n})},Me=e=>R[e].height,B=e=>e===`Invariant quality`,Ne=e=>e.every(e=>!B(e));function Pe(e){if(B(e))throw Error(`Expected exact quality`)}var Fe=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``}},Ie=(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]=Ie(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},Le=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 Re(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof j().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&&j().cancelAnimationFrame(s),j().requestAnimationFrame(e)):setTimeout(e,t)}function g(e){if(p){j().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 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 _(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 ze=(e,t=0,n)=>Re(e,t,f(f(f({},{leading:!0,trailing:!0}),n),{},{maxWait:t})),V=(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]=V(e[r],t):n[r]=e[r]}return n},Be=e=>V(e);class Ve extends O{constructor(e){super(),this.bufferSize=void 0,this.buffer=[],this.cursorEnd=-1,this.cursorStart=0,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 w().add(()=>this.subscribers.delete(t))}}class He extends O{constructor(e){super(),this.value=void 0,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 Ue(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 w)})}function We(...e){return new D(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new w))}var Ge=e=>new D(t=>{let n=j().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>j().clearTimeout(n)}),Ke=e=>new D(t=>{let n=j(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function qe(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?.call(t,e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var Je=qe,Ye=(e,t)=>new D(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Xe extends w{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Ze(e){return t=>new D(n=>t.subscribe(new Qe(n,e)))}class Qe{constructor(e,t){this.destination=void 0,this.size=void 0,this.lastValues=[],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){var t;(t=this.destination).error?.call(t,e)}}var $e={leading:!1,trailing:!0};function et(e,t=$e){return n=>new D(r=>n.subscribe(new tt(r,e,t)))}class tt{constructor(e,t,n){this.destination=void 0,this.time=void 0,this.config=void 0,this.lastValue=void 0,this.timeout=void 0,this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e;let t=j();k(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 nt={leading:!0,trailing:!1};function rt(e,t=nt){return n=>new D(r=>n.subscribe(new it(r,e,t)))}class it{constructor(e,t,n){this.destination=void 0,this.time=void 0,this.config=void 0,this.lastValue=void 0,this.timeout=void 0,this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,A(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=j().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 at(e){return t=>new D(n=>t.subscribe(new ot(n,e)))}class ot{constructor(e,t){this.destination=void 0,this.predicate=void 0,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){var t;(t=this.destination).error?.call(t,e)}}var st=(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)},ct=(e,t)=>e instanceof Object&&t instanceof Object?st(e,t):e===t;function lt(e=ct){return t=>new D(n=>t.subscribe(new dt(n,e)))}var ut={};class dt{constructor(e,t){this.destination=void 0,this.predicate=void 0,this.lastValue=ut,this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===ut||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?f({},e):e}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){var t;(t=this.destination).error?.call(t,e)}}function H(e){return t=>new D(n=>t.subscribe(new ft(n,e)))}class ft{constructor(e,t){this.destination=void 0,this.mapper=void 0,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){var t;(t=this.destination).error?.call(t,e)}}function pt(e){return H(()=>e)}function mt(){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?.call(t,e),r&&i.unsubscribe()});return r=!0,n&&i.unsubscribe(),i})}function ht(){return e=>new D(t=>e.subscribe(new gt(t)))}class gt{constructor(e){this.destination=void 0,this.last=void 0,this.hasLast=!1,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){var t;(t=this.destination).error?.call(t,e)}}function _t(e){return t=>new D(n=>t.subscribe(new vt(n,e)))}class vt{constructor(e,t){this.destination=void 0,this.effect=void 0,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){var t;(t=this.destination).error?.call(t,e)}}function yt(e){return t=>new D(n=>t.subscribe(new bt(n,e)))}class bt{constructor(e,t){if(this.destination=void 0,this.count=void 0,this.destination=e,this.count=t,t<0){var n;(n=this.destination).error?.call(n,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 xt(e=0){return t=>{let n=0,r=new Ve(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new D(e=>(n++,a(r.subscribe(e))))}}var St=300,Ct=(e,t=St)=>new D(n=>{let r=j(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!fe(r))return;let o=new r.ResizeObserver(ze(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),k(r)&&k(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},wt=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},Tt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},Et=(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}})(),Ot=e=>e!==void 0&&e!==``?e:Dt().toString();function kt(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 At(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 jt=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),Mt=e=>{if(!jt(e))throw e};function Nt(e){if(e&&typeof e==`object`){if(`message`in e)return String(e.message);try{return JSON.stringify(e)}catch{return`object serialization error`}}return String(e)}m=Symbol.iterator;class Pt{constructor(e){if(this.buffer=void 0,this.writeIndex=0,this.count=0,this.capacity=void 0,e<=0)throw Error(`Capacity must be greater than 0`);this.capacity=e,this.buffer=Array.from({length:e}).fill(null)}add(e){this.buffer[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.count<this.capacity&&this.count++}*[m](){if(this.count===0)return;let e=this.count<this.capacity?0:this.writeIndex;for(let t=0;t<this.count;t++){let t=this.buffer[e];k(t)&&(yield t),e=(e+1)%this.capacity}}clear(){this.buffer.fill(null),this.writeIndex=0,this.count=0}get size(){return this.count}get maxCapacity(){return this.capacity}}var Ft=e=>(t,n=!1)=>r=>{let i=typeof r==`object`;r==null||i&&!Object.keys(r).length||e(t,i?U(r):{value:r},n)},W=(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 G{constructor({name:e,getParentContext:t,getRootTracerContext:n,eventsBufferSize:r}){this.dynamicImportTimeout=5e3,this.subscription=new w,this.span=void 0,this.context=void 0,this.childTracers=[],this.initPromise=void 0,this.getRootTracerContext=void 0,this.eventsBuffer=null,k(r)&&r>0&&(this.eventsBuffer=new Pt(r)),G.dynamicImportStatus===`not_started`&&(G.dynamicImportPromise=this.loadOpentelemetry());let i=Date.now();this.initPromise=G.dynamicImportPromise.then(r=>{G.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t,getRootTracerContext:n},i)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(A(i))return;let{opentelemetryApi:a}=G.dynamicImports,{context:o,trace:s}=a,{tracer:c,attributes$:l}=i;this.span=c.startSpan(e,{startTime:r},t?.()),this.context=s.setSpan(o.active(),this.span),this.getRootTracerContext=n,this.subscription.add(l.subscribe(e=>{k(e)&&this.span.setAttributes(e)}))}loadOpentelemetry(){var e=this;return p(function*(){if(G.dynamicImportStatus===`not_started`){G.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]);G.dynamicImports={opentelemetryApi:r,opentelemetrySdk:i,tracer:a,opentelemetryResources:o,opentelemetrySemanticConventions:s},G.dynamicImportStatus=`completed`}catch{G.dynamicImportStatus=`failed`}}})()}isComponentTracerNotInitialized(){return A(this.span)||G.dynamicImportStatus===`failed`}addEventToBuffer(e,t,n,r){k(this.eventsBuffer)&&this.eventsBuffer.add({name:e,attributes:t,type:n,timestamp:r})}addEventToSpan(e,t,n,r){this.span.addEvent(e,f(f({},W(t)),{},{type:n}),r)}log(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`log`,r)}):this.addEventToBuffer(e,t,`log`,r)}error(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`error`,r)}):this.addEventToBuffer(e,t,`error`,r)}critical(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`critical`,r)}):this.addEventToBuffer(e,t,`critical`,r)}createComponentTracer(e){let t=new G({name:e,getParentContext:()=>this.context,getRootTracerContext:()=>this.getRootTracerContext?.call(this),eventsBufferSize:this.eventsBuffer?.maxCapacity});return this.childTracers.push(t),t}setSpanAttributes(e){this.span.setAttributes(W(e))}end(){this.initPromise.then(e=>{if(!this.isComponentTracerNotInitialized()){if(k(this.eventsBuffer))for(let e of this.eventsBuffer)this.addEventToSpan(e.name,e.attributes,e.type,e.timestamp);this.childTracers.forEach(e=>e.end()),this.span.end(),this.subscription.unsubscribe()}})}}G.dynamicImportStatus=`not_started`,G.dynamicImports=void 0,G.dynamicImportPromise=void 0;var It=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`;class Lt extends G{constructor(e){super({name:`Root`,eventsBufferSize:e}),this.attributes$=new He(null)}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=G.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:It}))]});f.register();let p=f.getTracer(`sdk-videoplayer-tracer`);super.init({name:e,getParentContext:t,getRootTracerContext:()=>({tracer:p,attributes$:this.attributes$})},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}setSpanAttributes(e){this.attributes$.next(f(f({},this.attributes$.getValue()),W(e)))}addSubscription(e){this.subscription.add(e)}}class Rt{constructor(e){this.fakeTraceId=void 0}log(e,t,n){}error(e,t,n){}critical(e,t,n){}createComponentTracer(e){return new Rt({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}}var zt=()=>!0,K={level:0,filter:zt,name:`Noname Tracer`,outputMethod:`log`};class Bt{constructor({name:e,level:t,filter:n,outputMethod:r}={}){this.name=void 0,this.filter=zt,this.level=K.level,this.outputMethod=K.outputMethod,this.childTracers=[],this.filter=n??this.filter,this.level=t??this.level,this.outputMethod=r??this.outputMethod,this.name=e??K.name}log(e,t,n){this.logDebug(e,t)}error(e,t,n){this.logError(e,t)}critical(e,t,n){this.logError(e,t)}createComponentTracer(e){let t=new Bt({filter:this.filter,level:this.level,name:`${this.name}/ ${e}`,outputMethod:this.outputMethod});return this.childTracers.push(t),t}end(){this.childTracers.forEach(e=>e.end()),this.childTracers=[]}setLevel(e){this.level=e,this.childTracers.forEach(t=>t.setLevel(e))}setOtputMethod(e){this.outputMethod=e,this.childTracers.forEach(t=>t.setOtputMethod(e))}setFilter(e){this.filter=e,this.childTracers.forEach(t=>t.setFilter(e))}getFinishedSpans(){}getTraceId(){return`debug_trace`}get verbose(){return this.level===0}createMessage(e,t){return[this.name,e,JSON.stringify(t)].join(`: `)}logDebug(e,t){!this.verbose||!this.filter(e,t)||j().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&j().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}}class Vt{static createRootTracer(e=`fake`,t){switch(e){case`real`:return new Lt(t);case`debug`:return new Bt;default:return new Rt}}}var Ht;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.UI=`ui`,e.CALL_FROM_EXTERNAL=`call_from_external`,e.FATAL=`fatal`})(Ht||={});var Ut;(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`})(Ut||={});var Wt=`vk.com`,Gt=function(){var e=p(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),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),qt(n)])),qt=e=>Array.isArray(e)?e[0]:e,Jt;(e=>{e.RU=`ru`,e.EN=`en`})(Jt||={});var q=`__vk_vp_internals_exposure`;class Yt{constructor(e,t){this.playerId=void 0,this.type=void 0,this.playerId=t,this.type=e,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 Xt={};S(Xt,{subscribe:()=>en,push:()=>$t,destroy:()=>Qt,create:()=>Zt});var J=new Map,Zt=(e,t)=>J.set(e,t??[]),Qt=e=>J.delete(e),$t=(e,t)=>{let n=J.get(e);n&&(typeof n==`function`?n(t):n.push(t))},en=(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)}},tn=e=>le({id:e.id,message:e.message,category:e.category,data:nn(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function nn(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var rn=e=>{let t=e.thrown instanceof Error?e.thrown:Error(e.message),n=e.id.length>10240?e.id.substring(0,10240):e.id;try{t.name=n}catch{t=Error(e.message),t.name=n}return t},an=()=>{try{var e;let{origin:t,pathname:n,search:r,hostname:i}=((e=j())==null||(e=e.document)==null?void 0:e.location)??{};return!i||i===`localhost`?void 0:f({url:t+n},new URLSearchParams(r).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{}))}catch{}};class Y{constructor(e,t,n,r){this.dynamicImportTimeout=5e3,this.componentName=void 0,this.subscription=new w,this.options=void 0,this.envParams=void 0,this.context=void 0,this.isEmbed=void 0,this.embedParent=void 0,this.beforeInitErrors=[],this.componentName=e,this.options=t,this.envParams=n,this.context=f({},r);let{isEmbed:i,topOrigin:a}=I();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 n=Y.tracerErrorMap.get(this.componentName);if(!n){this.beforeInitErrors.push([e,t]);return}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))try{let r=rn(e);n?.error(r,{crashIdSource:r.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:f(f(f(f({},this.context),tn(e)),an()),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 p(function*(){try{if(yield Y.loadPromise,Y.tracerErrorMap.has(e.componentName)||A(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});k(e.options.userId)&&s.setUserId(e.options.userId),o&&r(e.componentName,{appToken:It,environment:e.envParams.env,versionCode:1,versionName:e.envParams.version}),Y.tracerErrorMap.set(e.componentName,s),e.beforeInitErrors.forEach(t=>e.error.apply(e,t)),e.beforeInitErrors=[]}catch(e){console.error(e)}})()}loadModule(){var e=this;k(Y.loadPromise)||(Y.loadPromise=function(){var t=p(function*(){try{let t=new Promise((t,n)=>j().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)}}()())}}Y.tracerErrorMap=new Map,Y.appTracerModule=null,Y.loadPromise=null;class on{constructor(e,t){this.options=void 0,this.symbol=void 0,this.options=t,this.symbol=Symbol(e)}}var sn=()=>{let e=new Map,t=new Map,n=new Map,r=new Map,i=new Set;return{resolve(e){if(!r.has(e)){let t=n.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);r.set(e,new t)}return r.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){r.forEach((t,n)=>{t instanceof e&&r.delete(n)}),n.set(e,t)},getToken(n){if(e.has(n.symbol))return e.get(n.symbol);if(t.has(n.symbol)){let r=t.get(n.symbol)();return e.set(n.symbol,r),r}if(n.options?.factory){let t=n.options.factory();return e.set(n.symbol,t),t}throw Error(`No value registered in DI container for token "${n.symbol.description}"`)},registerToken(t,n){e.set(t.symbol,n)},registerFactory(e,n){t.set(e.symbol,n)},hasToken(n){return e.has(n.symbol)||t.has(n.symbol)||!!n.options?.factory},registerCleanup(e){i.add(e)},clear(){i.forEach(e=>e()),i.clear(),e.clear(),t.clear(),r.clear(),n.clear()}}},cn=(e,t)=>{let n=e.length,r=t>=0?t:n+t;return r>=0&&r<n?e[r]:void 0},ln=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}},un=(e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n],n,e))return n;return-1},dn=(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},fn=(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},pn=(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},mn=e=>{let t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=e[t-1-r];return n},hn=(e,t)=>{let n=e.slice();return t?n.sort(t):n.sort()},gn=(e,t,n,...r)=>{let i=e.slice();return n===void 0?i.splice(t):i.splice(t,n,...r),i},_n=(e,t,n)=>{let r=e.length,i=t>=0?t:r+t,a=e.slice();return a[i]=n,a},vn=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:Function(`return this`)(),yn=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},bn=e=>{let t={};for(let[n,r]of e)t[n]=r;return t},xn=Object.prototype.hasOwnProperty,Sn=(e,t)=>xn.call(e,t),Cn=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},wn=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}))))},Tn=e=>{let t=Array.from(e);return t.length===0?Promise.reject(AggregateError([],`All promises were rejected`)):new Promise((e,n)=>{let r=Array(t.length),i=t.length;t.forEach((t,a)=>{Promise.resolve(t).then(e,e=>{r[a]=e,--i,i===0&&n(AggregateError(r,`All promises were rejected`))})})})},En=(e,t)=>e.then(e=>Promise.resolve(t()).then(()=>e),e=>Promise.resolve(t()).then(()=>{throw e})),Dn=e=>{try{return Promise.resolve(e())}catch(e){return Promise.reject(e)}},On=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},{NativeAbortSignal:kn,NativeAbortController:An}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function jn(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 Nn{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 Nn{constructor(){super(),this.listeners||Nn.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=Mn(e),n=jn(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 Pn(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 Fn(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!Pn({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&&Pn({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}),In=$?Fn({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,Ln=$?In.fetch:Q.fetch,Rn=$?In.Request:Q.Request,zn=$?Z:Q.AbortController,Bn=$?X:Q.AbortSignal,Vn=(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*Hn(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 Un=(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)},Wn=(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},Gn=(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)},Kn=e=>e.replace(/^\s+/,``),qn=e=>e.replace(/\s+$/,``),Jn=Kn,Yn=qn,Xn=(e,t)=>typeof e==`string`?Vn(e,t):cn(e,t),Zn=(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)},Qn=e=>Q.clearTimeout(e),$n=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),er=!$n(Q.requestIdleCallback)||!$n(Q.cancelIdleCallback),tr=er?Zn:Q.requestIdleCallback,nr=er?Qn:Q.cancelIdleCallback,rr=(e,t,n)=>typeof e==`string`?e.includes(t,n):pn(e,t,n),ir=(e,t,n)=>{if(typeof e.canParse==`function`)return e.canParse(t,n);try{return new e(t,n),!0}catch{return!1}};
|
|
6
|
+
function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}var t=e;function n(e,n){if(t(e)!=`object`||!e)return e;var r=e[Symbol._oxc_toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(t(i)!=`object`)return i;throw TypeError(`@@_oxc_toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}var t=e,r=n;function i(e){var n=r(e,`string`);return t(n)==`symbol`?n:n+``}var a=i;function o(e,t,n){return(t=a(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var s=o;function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?c(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function d(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){u(a,r,i,o,s,`next`,e)}function s(e){u(a,r,i,o,s,`throw`,e)}o(void 0)})}}var f=l,p=d;let m;var h=Object.defineProperty,g=Object.getOwnPropertyNames,ee=Object.getOwnPropertyDescriptor,te=Object.prototype.hasOwnProperty;function _(e){return this[e]}var v=e=>{var t=(y??=new WeakMap).get(e),n;if(t)return t;if(t=h({},`__esModule`,{value:!0}),e&&typeof e==`object`||typeof e==`function`)for(var r of g(e))te.call(t,r)||h(t,r,{get:_.bind(e,r),enumerable:!(n=ee(e,r))||n.enumerable});return y.set(e,t),t},y,ne=e=>e;function re(e,t){this[e]=ne.bind(null,t)}var b=(e,t)=>{for(var n in t)h(e,n,{get:t[n],enumerable:!0,configurable:!0,set:re.bind(t,n)})},x={};b(x,{withoutNullable:()=>de,videoSizeToQuality:()=>Fe,videoQualityToHeight:()=>Ie,videoHeightToQuality:()=>Pe,urlCanParsePolyfilled:()=>ar,timeout:()=>qe,timeCodeToString:()=>Ve,throttleFn:()=>Ue,throttle:()=>ot,tap:()=>yt,suppressAbort:()=>Pt,stringTrimStart:()=>qn,stringTrimRight:()=>Xn,stringTrimLeft:()=>Yn,stringTrimEnd:()=>Jn,stringReplaceAll:()=>Kn,stringPadStart:()=>Gn,stringPadEnd:()=>Wn,stringMatchAll:()=>Un,stringAt:()=>Hn,skip:()=>xt,shareReplay:()=>Ct,safeStorage:()=>be,requestIdleCallbackPolyfilled:()=>nr,promiseWithResolvers:()=>kn,promiseTry:()=>On,promiseFinally:()=>Dn,promiseAny:()=>En,promiseAllSettled:()=>Tn,pairwise:()=>_t,once:()=>gt,observeElementSize:()=>Tt,observableFrom:()=>Xe,objectValues:()=>wn,objectHasOwn:()=>Cn,objectFromEntries:()=>xn,objectEntries:()=>bn,nowInt:()=>_e,now:()=>ge,noop:()=>w,merge:()=>Ke,mapTo:()=>ht,map:()=>V,loadVKLangPack:()=>Kt,isValidURL:()=>Dt,isNullable:()=>O,isNonNullable:()=>D,isLowerOrEqual:()=>je,isLower:()=>F,isInvariantQuality:()=>I,isIntersecting:()=>Ot,isHigherOrEqual:()=>Ae,isHigher:()=>ke,isBrowserWindow:()=>me,isAbortError:()=>Nt,interval:()=>Je,interpolate:()=>jt,includesPolyfilled:()=>ir,globalThisPolyfill:()=>yn,getWindow:()=>k,getVideoQualityLabel:()=>ze,getTraceSubscriptionMethod:()=>Lt,getRangeAroundIndex:()=>Mt,getPlayerId:()=>At,getMessageFromError:()=>Ft,getHighestQuality:()=>Me,getExponentialDelay:()=>ye,fromEvent:()=>Ze,flattenObject:()=>H,filterChanged:()=>ft,filter:()=>ct,fillWithDefault:()=>Be,fetchPolyfilled:()=>Rn,devNull:()=>Zt,detectEmbed:()=>De,debounceFn:()=>He,debounce:()=>rt,createDIContainer:()=>cn,combineLatest:()=>$e,combine:()=>Ge,cloneDeepWith:()=>L,cloneDeep:()=>We,clearVideoElement:()=>Et,checkNever:()=>ae,cancelIdleCallbackPolyfilled:()=>rr,buffer:()=>et,atPolyfilled:()=>Zn,assertQualityIsExact:()=>Re,assertNullable:()=>ue,assertNotEmptyArray:()=>fe,assertNonNullable:()=>le,assertNever:()=>C,assertEmptyArray:()=>pe,arrayWith:()=>vn,arrayToSpliced:()=>_n,arrayToSorted:()=>gn,arrayToReversed:()=>hn,arrayIncludes:()=>mn,arrayFlatMap:()=>pn,arrayFlat:()=>fn,arrayFindLastIndex:()=>dn,arrayFindLast:()=>un,arrayAt:()=>ln,areQualitiesExact:()=>Le,addScript:()=>he,abortable:()=>ve,VideoQuality:()=>Oe,ValueSubject:()=>z,VKNumericLanguage:()=>Wt,VERSION:()=>ie,TracerFactory:()=>Ht,SubscriptionRemovable:()=>Qe,Subscription:()=>S,Subject:()=>E,RequestPolyfilled:()=>zn,ReplaySubject:()=>R,Observable:()=>T,Logger:()=>ce,InternalsExposure:()=>Xt,InterfaceLanguage:()=>Yt,InjectionToken:()=>sn,INTERNAL_EXPOSE_GLOBAL_KEY:()=>q,ErrorCategory:()=>Ut,CircularBuffer:()=>It,AppTracer:()=>Y,AbortSignalPolyfilled:()=>Vn,AbortControllerPolyfilled:()=>Bn}),module.exports=v(x);var ie=`1.0.95-dev.1022d4dbd.0`;class S{constructor(){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 C=e=>{throw Error(`${e} is value of unexpected type`)},ae=e=>{},w=()=>{},oe=e=>{throw console.error(e),e},se=e=>{console.error(e)};class T{constructor(e){this.suppressErrors=!1,e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?se:oe,r;r=t?typeof t==`function`?{next:t,error:w}:{next:e=>t.next(e),error:e=>t.error?.call(t,e)}:{next:n,error:w};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 S().add(()=>{switch(i.next=w,i.error=w,typeof a){case`function`:a();return;case`object`:a.unsubscribe();return;case`undefined`:return;default:return C(a)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class E extends T{constructor(){super(),this.keyCounter=0,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 S().add(()=>this.subscribers.delete(t))}}class ce{constructor(){this.log$=new E,this.logs=[],this.log=e=>{let t=f(f({},e),{},{timestamp:Date.now()});this.logs.push(t),this.log$.next(t)},this.getAllLogs=()=>this.logs}createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch{n={message:"error in `createCustomLog`",component:`Logger`}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>f({component:e},t))}}function le(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function ue(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function D(e){return e!=null}function O(e){return e==null}var de=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>D(t)));function fe(e,t){if(!e?.length)throw Error(t)}function pe(e,t){if(e?.length)throw Error(t)}var k=()=>globalThis,me=(e=k())=>!!(e.window&&e.screen),he=(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)}),ge=typeof k().performance?.now==`function`?()=>k().performance.now():()=>Date.now(),_e=()=>Math.trunc(ge()),ve=(e,t)=>p(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}),ye=(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},be={};b(be,{set:()=>Ce,remove:()=>Te,isPersistent:()=>xe,has:()=>we,get:()=>Se,clear:()=>Ee});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},xe=()=>N()===0,Se=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:C(t)}},Ce=(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:C(n)}},we=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 C(t),!1}},Te=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:C(t)}},Ee=()=>{let e=N();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return A?.clear();default:C(e)}},De=()=>{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)}},Oe;(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`})(Oe||={});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}},ke=(e,t)=>P[e].height>P[t].height,Ae=(e,t)=>P[e].height>=P[t].height,F=(e,t)=>P[e].height<P[t].height,je=(e,t)=>P[e].height<=P[t].height,Me=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:F(e,t)?1:-1)[0],Ne=Object.keys(P).sort((e,t)=>F(e,t)?-1:1),Pe=(e,t=.02)=>[...Ne].find(n=>P[n].height*(1+t)>=e),Fe=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return Ne.find(e=>{let t=P[e];return t.width>=r&&t.height>=n})},Ie=e=>P[e].height,I=e=>e===`Invariant quality`,Le=e=>e.every(e=>!I(e));function Re(e){if(I(e))throw Error(`Expected exact quality`)}var ze=e=>{switch(e){case`4320p`:return`8K`;case`2160p`:return`4K`;case`1440p`:return`QHD`;case`1080p`:return`FHD`;case`720p`:return`HD`;default:return``}},Be=(e,t)=>{let n={};for(let r of Object.keys(t)){let i=t[r],a=e[r];Array.isArray(i)?n[r]=Array.isArray(a)?a:i:typeof i==`object`&&i?typeof a==`object`&&a&&!Array.isArray(a)?n[r]=Be(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},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 He(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 ee(e){return l=e,s=h(v,t),u?m(e):o}function te(e){let n=e-c,r=e-l,i=t-n;return d?Math.min(i,a-r):i}function _(e){let n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function v(){let e=Date.now();if(_(e))return y(e);s=h(v,te(e))}function y(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function ne(){s!==void 0&&g(s),l=0,r=c=i=s=void 0}function re(){return s===void 0?o:y(Date.now())}function b(){return s!==void 0}function x(...e){let n=Date.now(),a=_(n);if(r=e,i=this,c=n,a){if(s===void 0)return ee(c);if(d)return s=h(v,t),m(c)}return s===void 0&&(s=h(v,t)),o}return x.cancel=ne,x.flush=re,x.pending=b,x}var Ue=(e,t=0,n)=>He(e,t,f(f(f({},{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},We=e=>L(e);class R extends E{constructor(e){super(),this.bufferSize=void 0,this.buffer=[],this.cursorEnd=-1,this.cursorStart=0,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 S().add(()=>this.subscribers.delete(t))}}class z extends E{constructor(e){super(),this.value=void 0,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 Ge(e){return new T(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 S)})}function Ke(...e){return new T(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new S))}var qe=e=>new T(t=>{let n=k().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>k().clearTimeout(n)}),Je=e=>new T(t=>{let n=k(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function Ye(e){return new T(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 Xe=Ye,Ze=(e,t)=>new T(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Qe extends S{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function $e(e){return new T(t=>{let n=Array(e.length),r=e=>r=>{n[e]=r,t.next([...n])};return e.reduce((e,t,n)=>e.add(t.subscribe(r(n))),new S)})}function et(e){return t=>new T(n=>t.subscribe(new tt(n,e)))}class tt{constructor(e,t){this.destination=void 0,this.size=void 0,this.lastValues=[],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){var t;(t=this.destination).error?.call(t,e)}}var nt={leading:!1,trailing:!0};function rt(e,t=nt){return n=>new T(r=>n.subscribe(new it(r,e,t)))}class it{constructor(e,t,n){this.destination=void 0,this.time=void 0,this.config=void 0,this.lastValue=void 0,this.timeout=void 0,this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e;let t=k();D(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 at={leading:!0,trailing:!1};function ot(e,t=at){return n=>new T(r=>n.subscribe(new st(r,e,t)))}class st{constructor(e,t,n){this.destination=void 0,this.time=void 0,this.config=void 0,this.lastValue=void 0,this.timeout=void 0,this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,O(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 ct(e){return t=>new T(n=>t.subscribe(new lt(n,e)))}class lt{constructor(e,t){this.destination=void 0,this.predicate=void 0,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){var t;(t=this.destination).error?.call(t,e)}}var ut=(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)},dt=(e,t)=>e instanceof Object&&t instanceof Object?ut(e,t):e===t;function ft(e=dt){return t=>new T(n=>t.subscribe(new pt(n,e)))}var B={};class pt{constructor(e,t){this.destination=void 0,this.predicate=void 0,this.lastValue=B,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)?f({},e):e}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){var t;(t=this.destination).error?.call(t,e)}}function V(e){return t=>new T(n=>t.subscribe(new mt(n,e)))}class mt{constructor(e,t){this.destination=void 0,this.mapper=void 0,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){var t;(t=this.destination).error?.call(t,e)}}function ht(e){return V(()=>e)}function gt(){return e=>new T(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 _t(){return e=>new T(t=>e.subscribe(new vt(t)))}class vt{constructor(e){this.destination=void 0,this.last=void 0,this.hasLast=!1,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){var t;(t=this.destination).error?.call(t,e)}}function yt(e){return t=>new T(n=>t.subscribe(new bt(n,e)))}class bt{constructor(e,t){this.destination=void 0,this.effect=void 0,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){var t;(t=this.destination).error?.call(t,e)}}function xt(e){return t=>new T(n=>t.subscribe(new St(n,e)))}class St{constructor(e,t){if(this.destination=void 0,this.count=void 0,this.destination=e,this.count=t,t<0){var n;(n=this.destination).error?.call(n,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 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 T(e=>(n++,a(r.subscribe(e))))}}var wt=300,Tt=(e,t=wt)=>new T(n=>{let r=k(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!me(r))return;let o=new r.ResizeObserver(Ue(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),D(r)&&D(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},Et=(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:`},Ot=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),kt=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),At=e=>e!==void 0&&e!==``?e:kt().toString();function jt(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 Nt=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),Pt=e=>{if(!Nt(e))throw e};function Ft(e){if(e&&typeof e==`object`){if(`message`in e)return String(e.message);try{return JSON.stringify(e)}catch{return`object serialization error`}}return String(e)}m=Symbol.iterator;class It{constructor(e){if(this.buffer=void 0,this.writeIndex=0,this.count=0,this.capacity=void 0,e<=0)throw Error(`Capacity must be greater than 0`);this.capacity=e,this.buffer=Array.from({length:e}).fill(null)}add(e){this.buffer[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.count<this.capacity&&this.count++}*[m](){if(this.count===0)return;let e=this.count<this.capacity?0:this.writeIndex;for(let t=0;t<this.count;t++){let t=this.buffer[e];D(t)&&(yield t),e=(e+1)%this.capacity}}clear(){this.buffer.fill(null),this.writeIndex=0,this.count=0}get size(){return this.count}get maxCapacity(){return this.capacity}}var Lt=e=>(t,n=!1)=>r=>{let i=typeof r==`object`;r==null||i&&!Object.keys(r).length||e(t,i?H(r):{value:r},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:e,getParentContext:t,getRootTracerContext:n,eventsBufferSize:r}){this.dynamicImportTimeout=5e3,this.subscription=new S,this.span=void 0,this.context=void 0,this.childTracers=[],this.initPromise=void 0,this.getRootTracerContext=void 0,this.eventsBuffer=null,D(r)&&r>0&&(this.eventsBuffer=new It(r)),W.dynamicImportStatus===`not_started`&&(W.dynamicImportPromise=this.loadOpentelemetry());let i=Date.now();this.initPromise=W.dynamicImportPromise.then(r=>{W.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t,getRootTracerContext:n},i)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(O(i))return;let{opentelemetryApi:a}=W.dynamicImports,{context:o,trace:s}=a,{tracer:c,attributes$:l}=i;this.span=c.startSpan(e,{startTime:r},t?.()),this.context=s.setSpan(o.active(),this.span),this.getRootTracerContext=n,this.subscription.add(l.subscribe(e=>{D(e)&&this.span.setAttributes(e)}))}loadOpentelemetry(){var e=this;return p(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 O(this.span)||W.dynamicImportStatus===`failed`}addEventToBuffer(e,t,n,r){D(this.eventsBuffer)&&this.eventsBuffer.add({name:e,attributes:t,type:n,timestamp:r})}addEventToSpan(e,t,n,r){this.span.addEvent(e,f(f({},U(t)),{},{type:n}),r)}log(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`log`,r)}):this.addEventToBuffer(e,t,`log`,r)}error(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`error`,r)}):this.addEventToBuffer(e,t,`error`,r)}critical(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`critical`,r)}):this.addEventToBuffer(e,t,`critical`,r)}createComponentTracer(e){let t=new W({name:e,getParentContext:()=>this.context,getRootTracerContext:()=>this.getRootTracerContext?.call(this),eventsBufferSize:this.eventsBuffer?.maxCapacity});return this.childTracers.push(t),t}setSpanAttributes(e){this.span.setAttributes(U(e))}end(){this.initPromise.then(e=>{if(!this.isComponentTracerNotInitialized()){if(D(this.eventsBuffer))for(let e of this.eventsBuffer)this.addEventToSpan(e.name,e.attributes,e.type,e.timestamp);this.childTracers.forEach(e=>e.end()),this.span.end(),this.subscription.unsubscribe()}})}}W.dynamicImportStatus=`not_started`,W.dynamicImports=void 0,W.dynamicImportPromise=void 0;var G=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`;class Rt extends W{constructor(e){super({name:`Root`,eventsBufferSize:e}),this.attributes$=new z(null)}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:G}))]});f.register();let p=f.getTracer(`sdk-videoplayer-tracer`);super.init({name:e,getParentContext:t,getRootTracerContext:()=>({tracer:p,attributes$:this.attributes$})},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}setSpanAttributes(e){this.attributes$.next(f(f({},this.attributes$.getValue()),U(e)))}addSubscription(e){this.subscription.add(e)}}class zt{constructor(e){this.fakeTraceId=void 0}log(e,t,n){}error(e,t,n){}critical(e,t,n){}createComponentTracer(e){return new zt({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}}var Bt=()=>!0,K={level:0,filter:Bt,name:`Noname Tracer`,outputMethod:`log`};class Vt{constructor({name:e,level:t,filter:n,outputMethod:r}={}){this.name=void 0,this.filter=Bt,this.level=K.level,this.outputMethod=K.outputMethod,this.childTracers=[],this.filter=n??this.filter,this.level=t??this.level,this.outputMethod=r??this.outputMethod,this.name=e??K.name}log(e,t,n){this.logDebug(e,t)}error(e,t,n){this.logError(e,t)}critical(e,t,n){this.logError(e,t)}createComponentTracer(e){let t=new Vt({filter:this.filter,level:this.level,name:`${this.name}/ ${e}`,outputMethod:this.outputMethod});return this.childTracers.push(t),t}end(){this.childTracers.forEach(e=>e.end()),this.childTracers=[]}setLevel(e){this.level=e,this.childTracers.forEach(t=>t.setLevel(e))}setOtputMethod(e){this.outputMethod=e,this.childTracers.forEach(t=>t.setOtputMethod(e))}setFilter(e){this.filter=e,this.childTracers.forEach(t=>t.setFilter(e))}getFinishedSpans(){}getTraceId(){return`debug_trace`}get verbose(){return this.level===0}createMessage(e,t){return[this.name,e,JSON.stringify(t)].join(`: `)}logDebug(e,t){!this.verbose||!this.filter(e,t)||k().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&k().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}}class Ht{static createRootTracer(e=`fake`,t){switch(e){case`real`:return new Rt(t);case`debug`:return new Vt;default:return new zt}}}var Ut;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.UI=`ui`,e.CALL_FROM_EXTERNAL=`call_from_external`,e.FATAL=`fatal`})(Ut||={});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 Gt=`vk.com`,Kt=function(){var e=p(function*(e,t,n){let r=new URL(`https://${Gt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),qt(yield(yield fetch(r.toString())).json(),n)});return function(t,n,r){return e.apply(this,arguments)}}(),qt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),Jt(n)])),Jt=e=>Array.isArray(e)?e[0]:e,Yt;(e=>{e.RU=`ru`,e.EN=`en`})(Yt||={});var q=`__vk_vp_internals_exposure`;class Xt{constructor(e,t){this.playerId=void 0,this.type=void 0,this.playerId=t,this.type=e,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 Zt={};b(Zt,{subscribe:()=>tn,push:()=>en,destroy:()=>$t,create:()=>Qt});var J=new Map,Qt=(e,t)=>J.set(e,t??[]),$t=e=>J.delete(e),en=(e,t)=>{let n=J.get(e);n&&(typeof n==`function`?n(t):n.push(t))},tn=(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)}},nn=e=>de({id:e.id,message:e.message,category:e.category,data:rn(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function rn(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var an=e=>{let t=e.thrown instanceof Error?e.thrown:Error(e.message),n=e.id.length>10240?e.id.substring(0,10240):e.id;try{t.name=n}catch{t=Error(e.message),t.name=n}return t},on=()=>{try{var e;let{origin:t,pathname:n,search:r,hostname:i}=((e=k())==null||(e=e.document)==null?void 0:e.location)??{};return!i||i===`localhost`?void 0:f({url:t+n},new URLSearchParams(r).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{}))}catch{}};class Y{constructor(e,t,n,r){this.dynamicImportTimeout=5e3,this.componentName=void 0,this.subscription=new S,this.options=void 0,this.envParams=void 0,this.context=void 0,this.isEmbed=void 0,this.embedParent=void 0,this.beforeInitErrors=[],this.componentName=e,this.options=t,this.envParams=n,this.context=f({},r);let{isEmbed:i,topOrigin:a}=De();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 n=Y.tracerErrorMap.get(this.componentName);if(!n){this.beforeInitErrors.push([e,t]);return}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))try{let r=an(e);n?.error(r,{crashIdSource:r.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:f(f(f(f({},this.context),nn(e)),on()),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 p(function*(){try{if(yield Y.loadPromise,Y.tracerErrorMap.has(e.componentName)||O(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});D(e.options.userId)&&s.setUserId(e.options.userId),o&&r(e.componentName,{appToken:G,environment:e.envParams.env,versionCode:1,versionName:e.envParams.version}),Y.tracerErrorMap.set(e.componentName,s),e.beforeInitErrors.forEach(t=>e.error.apply(e,t)),e.beforeInitErrors=[]}catch(e){console.error(e)}})()}loadModule(){var e=this;D(Y.loadPromise)||(Y.loadPromise=function(){var t=p(function*(){try{let t=new Promise((t,n)=>k().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)}}()())}}Y.tracerErrorMap=new Map,Y.appTracerModule=null,Y.loadPromise=null;class sn{constructor(e,t){this.options=void 0,this.symbol=void 0,this.options=t,this.symbol=Symbol(e)}}var cn=()=>{let e=new Map,t=new Map,n=new Map,r=new Map,i=new Set;return{resolve(e){if(!r.has(e)){let t=n.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);r.set(e,new t)}return r.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){r.forEach((t,n)=>{t instanceof e&&r.delete(n)}),n.set(e,t)},getToken(n){if(e.has(n.symbol))return e.get(n.symbol);if(t.has(n.symbol)){let r=t.get(n.symbol)();return e.set(n.symbol,r),r}if(n.options?.factory){let t=n.options.factory();return e.set(n.symbol,t),t}throw Error(`No value registered in DI container for token "${n.symbol.description}"`)},registerToken(t,n){e.set(t.symbol,n)},registerFactory(e,n){t.set(e.symbol,n)},hasToken(n){return e.has(n.symbol)||t.has(n.symbol)||!!n.options?.factory},registerCleanup(e){i.add(e)},clear(){i.forEach(e=>e()),i.clear(),e.clear(),t.clear(),r.clear(),n.clear()}}},ln=(e,t)=>{let n=e.length,r=t>=0?t:n+t;return r>=0&&r<n?e[r]:void 0},un=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}},dn=(e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n],n,e))return n;return-1},fn=(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},pn=(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},mn=(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},hn=e=>{let t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=e[t-1-r];return n},gn=(e,t)=>{let n=e.slice();return t?n.sort(t):n.sort()},_n=(e,t,n,...r)=>{let i=e.slice();return n===void 0?i.splice(t):i.splice(t,n,...r),i},vn=(e,t,n)=>{let r=e.length,i=t>=0?t:r+t,a=e.slice();return a[i]=n,a},yn=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:Function(`return this`)(),bn=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},xn=e=>{let t={};for(let[n,r]of e)t[n]=r;return t},Sn=Object.prototype.hasOwnProperty,Cn=(e,t)=>Sn.call(e,t),wn=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},Tn=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}))))},En=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`))})})})},Dn=(e,t)=>e.then(e=>Promise.resolve(t()).then(()=>e),e=>Promise.resolve(t()).then(()=>{throw e})),On=e=>{try{return Promise.resolve(e())}catch(e){return Promise.reject(e)}},kn=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},{NativeAbortSignal:An,NativeAbortController:jn}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function Mn(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 Nn(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 Pn{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 Pn{constructor(){super(),this.listeners||Pn.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=Nn(e),n=Mn(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 Fn(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 In(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!Fn({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&&Fn({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}),Ln=$?In({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,Rn=$?Ln.fetch:Q.fetch,zn=$?Ln.Request:Q.Request,Bn=$?Z:Q.AbortController,Vn=$?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*Un(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)},Gn=(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},Kn=(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)},qn=e=>e.replace(/^\s+/,``),Jn=e=>e.replace(/\s+$/,``),Yn=qn,Xn=Jn,Zn=(e,t)=>typeof e==`string`?Hn(e,t):ln(e,t),Qn=(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)},$n=e=>Q.clearTimeout(e),er=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),tr=!er(Q.requestIdleCallback)||!er(Q.cancelIdleCallback),nr=tr?Qn:Q.requestIdleCallback,rr=tr?$n:Q.cancelIdleCallback,ir=(e,t,n)=>typeof e==`string`?e.includes(t,n):mn(e,t,n),ar=(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.95-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.95-dev.1022d4dbd.0
|
|
3
|
+
* Tue, 14 Jul 2026 18:23:25 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-95/doc/
|
|
5
5
|
*/
|
|
6
|
-
var _oxcModlhrvr9=function(){function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}var t=e;function n(e,n){if(t(e)!=`object`||!e)return e;var r=e[Symbol._oxc_toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(t(i)!=`object`)return i;throw TypeError(`@@_oxc_toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}var t=e,r=n;function i(e){var n=r(e,`string`);return t(n)==`symbol`?n:n+``}var a=i;function o(e,t,n){return(t=a(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var s=o;function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?c(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function d(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){u(a,r,i,o,s,`next`,e)}function s(e){u(a,r,i,o,s,`throw`,e)}o(void 0)})}}var f=l,p=d;let m;var h=Object.defineProperty,ee=e=>e;function te(e,t){this[e]=ee.bind(null,t)}var g=(e,t)=>{for(var n in t)h(e,n,{get:t[n],enumerable:!0,configurable:!0,set:te.bind(t,n)})},_=`1.0.95-dev.02230ed18.0`;class v{constructor(){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 y=e=>{throw Error(`${e} is value of unexpected type`)},ne=e=>{},b=()=>{},re=e=>{throw console.error(e),e},x=e=>{console.error(e)};class S{constructor(e){this.suppressErrors=!1,e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?x:re,r;r=t?typeof t==`function`?{next:t,error:b}:{next:e=>t.next(e),error:e=>t.error?.call(t,e)}:{next:n,error:b};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 v().add(()=>{switch(i.next=b,i.error=b,typeof a){case`function`:a();return;case`object`:a.unsubscribe();return;case`undefined`:return;default:return y(a)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class C extends S{constructor(){super(),this.keyCounter=0,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 v().add(()=>this.subscribers.delete(t))}}class ie{constructor(){this.log$=new C,this.logs=[],this.log=e=>{let t=f(f({},e),{},{timestamp:Date.now()});this.logs.push(t),this.log$.next(t)},this.getAllLogs=()=>this.logs}createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch{n={message:"error in `createCustomLog`",component:`Logger`}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>f({component:e},t))}}function ae(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function oe(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function w(e){return e!=null}function T(e){return e==null}var se=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>w(t)));function ce(e,t){if(!e?.length)throw Error(t)}function le(e,t){if(e?.length)throw Error(t)}var E=()=>globalThis,ue=(e=E())=>!!(e.window&&e.screen),de=(e,t,n)=>new Promise((r,i)=>{t.addEventListener(`abort`,()=>{s(),l.remove()});let a=()=>{s(),i(`error`)},o=()=>{s(),r()},s=()=>{c&&clearTimeout(c),l.removeEventListener(`load`,o),l.removeEventListener(`error`,a)},c;n&&(c=E().setTimeout(()=>{s(),i(`timeout`)},n));let l=document.createElement(`script`);l.addEventListener(`load`,o),l.addEventListener(`error`,a),l.src=e,document.head.appendChild(l)}),fe=typeof E().performance?.now==`function`?()=>E().performance.now():()=>Date.now(),pe=()=>Math.trunc(fe()),me=(e,t)=>p(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}),he=(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},ge={};g(ge,{set:()=>ye,remove:()=>xe,isPersistent:()=>_e,has:()=>be,get:()=>ve,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},_e=()=>A()===0,ve=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:y(t)}},ye=(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:y(n)}},be=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 y(t),!1}},xe=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:y(t)}},Se=()=>{let e=A();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return D?.clear();default:y(e)}},Ce=()=>{let e,t=[],n=E();try{e=n.self!==n.top}catch(t){t instanceof DOMException&&t.name===`SecurityError`?e=!0:(e=!1,console.error(t))}try{n.location?.ancestorOrigins&&(t=[...n.location.ancestorOrigins])}catch(e){console.error(e)}try{!t.length&&n.document.referrer&&(t=[new URL(n.document.referrer).origin])}catch(e){console.error(e)}return t=t.filter(e=>URL.canParse(e)),{isEmbed:e,origins:t,topOrigin:t.at(-1),immediateOrigin:t.at(0)}},we;(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`})(we||={});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}},Te=(e,t)=>j[e].height>j[t].height,Ee=(e,t)=>j[e].height>=j[t].height,M=(e,t)=>j[e].height<j[t].height,De=(e,t)=>j[e].height<=j[t].height,Oe=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),ke=(e,t=.02)=>[...N].find(n=>j[n].height*(1+t)>=e),Ae=({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})},je=e=>j[e].height,P=e=>e===`Invariant quality`,Me=e=>e.every(e=>!P(e));function Ne(e){if(P(e))throw Error(`Expected exact quality`)}var Pe=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``}},Fe=(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]=Fe(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},Ie=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 Le(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof E().requestAnimationFrame==`function`;n&&(u=!!n.leading,d=`maxWait`in n,a=n?.maxWait?Math.max(+n?.maxWait||0,t):a,f=`trailing`in n?!!n.trailing:f);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(s&&E().cancelAnimationFrame(s),E().requestAnimationFrame(e)):setTimeout(e,t)}function ee(e){if(p){E().cancelAnimationFrame(e);return}clearTimeout(e)}function te(e){return l=e,s=h(v,t),u?m(e):o}function g(e){let n=e-c,r=e-l,i=t-n;return d?Math.min(i,a-r):i}function _(e){let n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function v(){let e=Date.now();if(_(e))return y(e);s=h(v,g(e))}function y(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function ne(){s!==void 0&&ee(s),l=0,r=c=i=s=void 0}function b(){return s===void 0?o:y(Date.now())}function re(){return s!==void 0}function x(...e){let n=Date.now(),a=_(n);if(r=e,i=this,c=n,a){if(s===void 0)return te(c);if(d)return s=h(v,t),m(c)}return s===void 0&&(s=h(v,t)),o}return x.cancel=ne,x.flush=b,x.pending=re,x}var Re=(e,t=0,n)=>Le(e,t,f(f(f({},{leading:!0,trailing:!0}),n),{},{maxWait:t})),F=(e,t)=>{if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let r in e){if(typeof t==`function`){let i=t(e[r],r,e,n);if(i!==void 0){n[r]=i;continue}}typeof e[r]==`object`?n[r]=F(e[r],t):n[r]=e[r]}return n},ze=e=>F(e);class I extends C{constructor(e){super(),this.bufferSize=void 0,this.buffer=[],this.cursorEnd=-1,this.cursorStart=0,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 v().add(()=>this.subscribers.delete(t))}}class L extends C{constructor(e){super(),this.value=void 0,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 Be(e){return new S(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 v)})}function Ve(...e){return new S(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new v))}var He=e=>new S(t=>{let n=E().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>E().clearTimeout(n)}),Ue=e=>new S(t=>{let n=E(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function We(e){return new S(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 Ge=We,Ke=(e,t)=>new S(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class qe extends v{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Je(e){return t=>new S(n=>t.subscribe(new Ye(n,e)))}class Ye{constructor(e,t){this.destination=void 0,this.size=void 0,this.lastValues=[],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){var t;(t=this.destination).error?.call(t,e)}}var Xe={leading:!1,trailing:!0};function Ze(e,t=Xe){return n=>new S(r=>n.subscribe(new Qe(r,e,t)))}class Qe{constructor(e,t,n){this.destination=void 0,this.time=void 0,this.config=void 0,this.lastValue=void 0,this.timeout=void 0,this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e;let t=E();w(this.timeout)?t.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=t.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(e){if(this.destination.error)this.destination.error(e);else throw e}this.timeout=void 0},this.time)}error(e){var t;(t=this.destination).error?.call(t,e)}}var $e={leading:!0,trailing:!1};function et(e,t=$e){return n=>new S(r=>n.subscribe(new tt(r,e,t)))}class tt{constructor(e,t,n){this.destination=void 0,this.time=void 0,this.config=void 0,this.lastValue=void 0,this.timeout=void 0,this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,T(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=E().setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){var t;(t=this.destination).error?.call(t,e)}}function nt(e){return t=>new S(n=>t.subscribe(new rt(n,e)))}class rt{constructor(e,t){this.destination=void 0,this.predicate=void 0,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){var t;(t=this.destination).error?.call(t,e)}}var it=(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)},at=(e,t)=>e instanceof Object&&t instanceof Object?it(e,t):e===t;function ot(e=at){return t=>new S(n=>t.subscribe(new st(n,e)))}var R={};class st{constructor(e,t){this.destination=void 0,this.predicate=void 0,this.lastValue=R,this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===R||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?f({},e):e}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){var t;(t=this.destination).error?.call(t,e)}}function z(e){return t=>new S(n=>t.subscribe(new ct(n,e)))}class ct{constructor(e,t){this.destination=void 0,this.mapper=void 0,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){var t;(t=this.destination).error?.call(t,e)}}function lt(e){return z(()=>e)}function ut(){return e=>new S(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 dt(){return e=>new S(t=>e.subscribe(new ft(t)))}class ft{constructor(e){this.destination=void 0,this.last=void 0,this.hasLast=!1,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){var t;(t=this.destination).error?.call(t,e)}}function pt(e){return t=>new S(n=>t.subscribe(new mt(n,e)))}class mt{constructor(e,t){this.destination=void 0,this.effect=void 0,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){var t;(t=this.destination).error?.call(t,e)}}function ht(e){return t=>new S(n=>t.subscribe(new gt(n,e)))}class gt{constructor(e,t){if(this.destination=void 0,this.count=void 0,this.destination=e,this.count=t,t<0){var n;(n=this.destination).error?.call(n,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 _t(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 S(e=>(n++,a(r.subscribe(e))))}}var vt=300,yt=(e,t=vt)=>new S(n=>{let r=E(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!ue(r))return;let o=new r.ResizeObserver(Re(e=>{let t=e[0];if(!t)return;let r,i;t.contentBoxSize&&t.contentBoxSize[0]?(i=t.contentBoxSize[0].blockSize,r=t.contentBoxSize[0].inlineSize):t.contentRect&&(r=t.contentRect.width,i=t.contentRect.height),w(r)&&w(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),B=(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=B(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},bt=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},xt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},St=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),Ct=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),wt=e=>e!==void 0&&e!==``?e:Ct().toString();function Tt(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 Et(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 V=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),Dt=e=>{if(!V(e))throw e};function Ot(e){if(e&&typeof e==`object`){if(`message`in e)return String(e.message);try{return JSON.stringify(e)}catch{return`object serialization error`}}return String(e)}m=Symbol.iterator;class H{constructor(e){if(this.buffer=void 0,this.writeIndex=0,this.count=0,this.capacity=void 0,e<=0)throw Error(`Capacity must be greater than 0`);this.capacity=e,this.buffer=Array.from({length:e}).fill(null)}add(e){this.buffer[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.count<this.capacity&&this.count++}*[m](){if(this.count===0)return;let e=this.count<this.capacity?0:this.writeIndex;for(let t=0;t<this.count;t++){let t=this.buffer[e];w(t)&&(yield t),e=(e+1)%this.capacity}}clear(){this.buffer.fill(null),this.writeIndex=0,this.count=0}get size(){return this.count}get maxCapacity(){return this.capacity}}var kt=e=>(t,n=!1)=>r=>{let i=typeof r==`object`;r==null||i&&!Object.keys(r).length||e(t,i?B(r):{value:r},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:e,getParentContext:t,getRootTracerContext:n,eventsBufferSize:r}){this.dynamicImportTimeout=5e3,this.subscription=new v,this.span=void 0,this.context=void 0,this.childTracers=[],this.initPromise=void 0,this.getRootTracerContext=void 0,this.eventsBuffer=null,w(r)&&r>0&&(this.eventsBuffer=new H(r)),W.dynamicImportStatus===`not_started`&&(W.dynamicImportPromise=this.loadOpentelemetry());let i=Date.now();this.initPromise=W.dynamicImportPromise.then(r=>{W.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t,getRootTracerContext:n},i)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(T(i))return;let{opentelemetryApi:a}=W.dynamicImports,{context:o,trace:s}=a,{tracer:c,attributes$:l}=i;this.span=c.startSpan(e,{startTime:r},t?.()),this.context=s.setSpan(o.active(),this.span),this.getRootTracerContext=n,this.subscription.add(l.subscribe(e=>{w(e)&&this.span.setAttributes(e)}))}loadOpentelemetry(){var e=this;return p(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 T(this.span)||W.dynamicImportStatus===`failed`}addEventToBuffer(e,t,n,r){w(this.eventsBuffer)&&this.eventsBuffer.add({name:e,attributes:t,type:n,timestamp:r})}addEventToSpan(e,t,n,r){this.span.addEvent(e,f(f({},U(t)),{},{type:n}),r)}log(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`log`,r)}):this.addEventToBuffer(e,t,`log`,r)}error(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`error`,r)}):this.addEventToBuffer(e,t,`error`,r)}critical(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`critical`,r)}):this.addEventToBuffer(e,t,`critical`,r)}createComponentTracer(e){let t=new W({name:e,getParentContext:()=>this.context,getRootTracerContext:()=>this.getRootTracerContext?.call(this),eventsBufferSize:this.eventsBuffer?.maxCapacity});return this.childTracers.push(t),t}setSpanAttributes(e){this.span.setAttributes(U(e))}end(){this.initPromise.then(e=>{if(!this.isComponentTracerNotInitialized()){if(w(this.eventsBuffer))for(let e of this.eventsBuffer)this.addEventToSpan(e.name,e.attributes,e.type,e.timestamp);this.childTracers.forEach(e=>e.end()),this.span.end(),this.subscription.unsubscribe()}})}}W.dynamicImportStatus=`not_started`,W.dynamicImports=void 0,W.dynamicImportPromise=void 0;var G=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`;class At extends W{constructor(e){super({name:`Root`,eventsBufferSize:e}),this.attributes$=new L(null)}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:G}))]});f.register();let p=f.getTracer(`sdk-videoplayer-tracer`);super.init({name:e,getParentContext:t,getRootTracerContext:()=>({tracer:p,attributes$:this.attributes$})},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}setSpanAttributes(e){this.attributes$.next(f(f({},this.attributes$.getValue()),U(e)))}addSubscription(e){this.subscription.add(e)}}class jt{constructor(e){this.fakeTraceId=void 0}log(e,t,n){}error(e,t,n){}critical(e,t,n){}createComponentTracer(e){return new jt({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}}var Mt=()=>!0,K={level:0,filter:Mt,name:`Noname Tracer`,outputMethod:`log`};class Nt{constructor({name:e,level:t,filter:n,outputMethod:r}={}){this.name=void 0,this.filter=Mt,this.level=K.level,this.outputMethod=K.outputMethod,this.childTracers=[],this.filter=n??this.filter,this.level=t??this.level,this.outputMethod=r??this.outputMethod,this.name=e??K.name}log(e,t,n){this.logDebug(e,t)}error(e,t,n){this.logError(e,t)}critical(e,t,n){this.logError(e,t)}createComponentTracer(e){let t=new Nt({filter:this.filter,level:this.level,name:`${this.name}/ ${e}`,outputMethod:this.outputMethod});return this.childTracers.push(t),t}end(){this.childTracers.forEach(e=>e.end()),this.childTracers=[]}setLevel(e){this.level=e,this.childTracers.forEach(t=>t.setLevel(e))}setOtputMethod(e){this.outputMethod=e,this.childTracers.forEach(t=>t.setOtputMethod(e))}setFilter(e){this.filter=e,this.childTracers.forEach(t=>t.setFilter(e))}getFinishedSpans(){}getTraceId(){return`debug_trace`}get verbose(){return this.level===0}createMessage(e,t){return[this.name,e,JSON.stringify(t)].join(`: `)}logDebug(e,t){!this.verbose||!this.filter(e,t)||E().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&E().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}}class Pt{static createRootTracer(e=`fake`,t){switch(e){case`real`:return new At(t);case`debug`:return new Nt;default:return new jt}}}var Ft;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.UI=`ui`,e.CALL_FROM_EXTERNAL=`call_from_external`,e.FATAL=`fatal`})(Ft||={});var It;(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`})(It||={});var Lt=`vk.com`,Rt=function(){var e=p(function*(e,t,n){let r=new URL(`https://${Lt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),zt(yield(yield fetch(r.toString())).json(),n)});return function(t,n,r){return e.apply(this,arguments)}}(),zt=(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,Vt;(e=>{e.RU=`ru`,e.EN=`en`})(Vt||={});var q=`__vk_vp_internals_exposure`;class Ht{constructor(e,t){this.playerId=void 0,this.type=void 0,this.playerId=t,this.type=e,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 Ut={};g(Ut,{subscribe:()=>qt,push:()=>Kt,destroy:()=>Gt,create:()=>Wt});var J=new Map,Wt=(e,t)=>J.set(e,t??[]),Gt=e=>J.delete(e),Kt=(e,t)=>{let n=J.get(e);n&&(typeof n==`function`?n(t):n.push(t))},qt=(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)}},Jt=e=>se({id:e.id,message:e.message,category:e.category,data:Yt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Yt(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Xt=e=>{let t=e.thrown instanceof Error?e.thrown:Error(e.message),n=e.id.length>10240?e.id.substring(0,10240):e.id;try{t.name=n}catch{t=Error(e.message),t.name=n}return t},Zt=()=>{try{var e;let{origin:t,pathname:n,search:r,hostname:i}=((e=E())==null||(e=e.document)==null?void 0:e.location)??{};return!i||i===`localhost`?void 0:f({url:t+n},new URLSearchParams(r).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{}))}catch{}};class Y{constructor(e,t,n,r){this.dynamicImportTimeout=5e3,this.componentName=void 0,this.subscription=new v,this.options=void 0,this.envParams=void 0,this.context=void 0,this.isEmbed=void 0,this.embedParent=void 0,this.beforeInitErrors=[],this.componentName=e,this.options=t,this.envParams=n,this.context=f({},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 n=Y.tracerErrorMap.get(this.componentName);if(!n){this.beforeInitErrors.push([e,t]);return}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))try{let r=Xt(e);n?.error(r,{crashIdSource:r.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:f(f(f(f({},this.context),Jt(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 p(function*(){try{if(yield Y.loadPromise,Y.tracerErrorMap.has(e.componentName)||T(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});w(e.options.userId)&&s.setUserId(e.options.userId),o&&r(e.componentName,{appToken:G,environment:e.envParams.env,versionCode:1,versionName:e.envParams.version}),Y.tracerErrorMap.set(e.componentName,s),e.beforeInitErrors.forEach(t=>e.error.apply(e,t)),e.beforeInitErrors=[]}catch(e){console.error(e)}})()}loadModule(){var e=this;w(Y.loadPromise)||(Y.loadPromise=function(){var t=p(function*(){try{let t=new Promise((t,n)=>E().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)}}()())}}Y.tracerErrorMap=new Map,Y.appTracerModule=null,Y.loadPromise=null;class Qt{constructor(e,t){this.options=void 0,this.symbol=void 0,this.options=t,this.symbol=Symbol(e)}}var $t=()=>{let e=new Map,t=new Map,n=new Map,r=new Map,i=new Set;return{resolve(e){if(!r.has(e)){let t=n.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);r.set(e,new t)}return r.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){r.forEach((t,n)=>{t instanceof e&&r.delete(n)}),n.set(e,t)},getToken(n){if(e.has(n.symbol))return e.get(n.symbol);if(t.has(n.symbol)){let r=t.get(n.symbol)();return e.set(n.symbol,r),r}if(n.options?.factory){let t=n.options.factory();return e.set(n.symbol,t),t}throw Error(`No value registered in DI container for token "${n.symbol.description}"`)},registerToken(t,n){e.set(t.symbol,n)},registerFactory(e,n){t.set(e.symbol,n)},hasToken(n){return e.has(n.symbol)||t.has(n.symbol)||!!n.options?.factory},registerCleanup(e){i.add(e)},clear(){i.forEach(e=>e()),i.clear(),e.clear(),t.clear(),r.clear(),n.clear()}}},en=(e,t)=>{let n=e.length,r=t>=0?t:n+t;return r>=0&&r<n?e[r]:void 0},tn=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}},nn=(e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n],n,e))return n;return-1},rn=(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},an=(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},on=(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},sn=e=>{let t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=e[t-1-r];return n},cn=(e,t)=>{let n=e.slice();return t?n.sort(t):n.sort()},ln=(e,t,n,...r)=>{let i=e.slice();return n===void 0?i.splice(t):i.splice(t,n,...r),i},un=(e,t,n)=>{let r=e.length,i=t>=0?t:r+t,a=e.slice();return a[i]=n,a},dn=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:Function(`return this`)(),fn=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},pn=e=>{let t={};for(let[n,r]of e)t[n]=r;return t},mn=Object.prototype.hasOwnProperty,hn=(e,t)=>mn.call(e,t),gn=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},_n=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}))))},vn=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`))})})})},yn=(e,t)=>e.then(e=>Promise.resolve(t()).then(()=>e),e=>Promise.resolve(t()).then(()=>{throw e})),bn=e=>{try{return Promise.resolve(e())}catch(e){return Promise.reject(e)}},xn=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},{NativeAbortSignal:Sn,NativeAbortController:Cn}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function wn(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 Tn(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 En{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 En{constructor(){super(),this.listeners||En.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=Tn(e),n=wn(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 Dn(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 On(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!Dn({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&&Dn({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}),kn=$?On({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,An=$?kn.fetch:Q.fetch,jn=$?kn.Request:Q.Request,Mn=$?Z:Q.AbortController,Nn=$?X:Q.AbortSignal,Pn=(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*Fn(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 In=(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)},Ln=(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},Rn=(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)},zn=e=>e.replace(/^\s+/,``),Bn=e=>e.replace(/\s+$/,``),Vn=zn,Hn=Bn,Un=(e,t)=>typeof e==`string`?Pn(e,t):en(e,t),Wn=(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)},Gn=e=>Q.clearTimeout(e),Kn=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),qn=!Kn(Q.requestIdleCallback)||!Kn(Q.cancelIdleCallback),Jn=qn?Wn:Q.requestIdleCallback,Yn=qn?Gn:Q.cancelIdleCallback,Xn=(e,t,n)=>typeof e==`string`?e.includes(t,n):on(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}};;return{se,Ae,je,ke,Zn,He,Ie,Re,et,pt,Dt,zn,Hn,Vn,Bn,Rn,Ln,In,Fn,Pn,ht,_t,ge,Jn,xn,bn,yn,vn,_n,dt,ut,yt,Ge,gn,hn,pn,fn,pe,fe,b,Ve,lt,z,Rt,xt,T,w,De,M,P,St,Ee,Te,ue,V,Ue,Tt,Xn,dn,E,Pe,kt,Et,wt,Ot,Oe,he,Ke,B,ot,nt,Fe,An,Ut,Ce,Le,Ze,$t,Be,F,ze,bt,ne,Yn,Je,Un,Ne,oe,ce,ae,y,le,un,ln,cn,sn,on,an,rn,nn,tn,en,Me,de,me,we,L,It,_,Pt,qe,v,C,jn,I,S,ie,Ht,Vt,Qt,q,Ft,H,Y,Nn,Mn};}();var{se:_oxcModlhrvr9_se,Ae:_oxcModlhrvr9_Ae,je:_oxcModlhrvr9_je,ke:_oxcModlhrvr9_ke,Zn:_oxcModlhrvr9_Zn,He:_oxcModlhrvr9_He,Ie:_oxcModlhrvr9_Ie,Re:_oxcModlhrvr9_Re,et:_oxcModlhrvr9_et,pt:_oxcModlhrvr9_pt,Dt:_oxcModlhrvr9_Dt,zn:_oxcModlhrvr9_zn,Hn:_oxcModlhrvr9_Hn,Vn:_oxcModlhrvr9_Vn,Bn:_oxcModlhrvr9_Bn,Rn:_oxcModlhrvr9_Rn,Ln:_oxcModlhrvr9_Ln,In:_oxcModlhrvr9_In,Fn:_oxcModlhrvr9_Fn,Pn:_oxcModlhrvr9_Pn,ht:_oxcModlhrvr9_ht,_t:_oxcModlhrvr9__t,ge:_oxcModlhrvr9_ge,Jn:_oxcModlhrvr9_Jn,xn:_oxcModlhrvr9_xn,bn:_oxcModlhrvr9_bn,yn:_oxcModlhrvr9_yn,vn:_oxcModlhrvr9_vn,_n:_oxcModlhrvr9__n,dt:_oxcModlhrvr9_dt,ut:_oxcModlhrvr9_ut,yt:_oxcModlhrvr9_yt,Ge:_oxcModlhrvr9_Ge,gn:_oxcModlhrvr9_gn,hn:_oxcModlhrvr9_hn,pn:_oxcModlhrvr9_pn,fn:_oxcModlhrvr9_fn,pe:_oxcModlhrvr9_pe,fe:_oxcModlhrvr9_fe,b:_oxcModlhrvr9_b,Ve:_oxcModlhrvr9_Ve,lt:_oxcModlhrvr9_lt,z:_oxcModlhrvr9_z,Rt:_oxcModlhrvr9_Rt,xt:_oxcModlhrvr9_xt,T:_oxcModlhrvr9_T,w:_oxcModlhrvr9_w,De:_oxcModlhrvr9_De,M:_oxcModlhrvr9_M,P:_oxcModlhrvr9_P,St:_oxcModlhrvr9_St,Ee:_oxcModlhrvr9_Ee,Te:_oxcModlhrvr9_Te,ue:_oxcModlhrvr9_ue,V:_oxcModlhrvr9_V,Ue:_oxcModlhrvr9_Ue,Tt:_oxcModlhrvr9_Tt,Xn:_oxcModlhrvr9_Xn,dn:_oxcModlhrvr9_dn,E:_oxcModlhrvr9_E,Pe:_oxcModlhrvr9_Pe,kt:_oxcModlhrvr9_kt,Et:_oxcModlhrvr9_Et,wt:_oxcModlhrvr9_wt,Ot:_oxcModlhrvr9_Ot,Oe:_oxcModlhrvr9_Oe,he:_oxcModlhrvr9_he,Ke:_oxcModlhrvr9_Ke,B:_oxcModlhrvr9_B,ot:_oxcModlhrvr9_ot,nt:_oxcModlhrvr9_nt,Fe:_oxcModlhrvr9_Fe,An:_oxcModlhrvr9_An,Ut:_oxcModlhrvr9_Ut,Ce:_oxcModlhrvr9_Ce,Le:_oxcModlhrvr9_Le,Ze:_oxcModlhrvr9_Ze,$t:_oxcModlhrvr9_$t,Be:_oxcModlhrvr9_Be,F:_oxcModlhrvr9_F,ze:_oxcModlhrvr9_ze,bt:_oxcModlhrvr9_bt,ne:_oxcModlhrvr9_ne,Yn:_oxcModlhrvr9_Yn,Je:_oxcModlhrvr9_Je,Un:_oxcModlhrvr9_Un,Ne:_oxcModlhrvr9_Ne,oe:_oxcModlhrvr9_oe,ce:_oxcModlhrvr9_ce,ae:_oxcModlhrvr9_ae,y:_oxcModlhrvr9_y,le:_oxcModlhrvr9_le,un:_oxcModlhrvr9_un,ln:_oxcModlhrvr9_ln,cn:_oxcModlhrvr9_cn,sn:_oxcModlhrvr9_sn,on:_oxcModlhrvr9_on,an:_oxcModlhrvr9_an,rn:_oxcModlhrvr9_rn,nn:_oxcModlhrvr9_nn,tn:_oxcModlhrvr9_tn,en:_oxcModlhrvr9_en,Me:_oxcModlhrvr9_Me,de:_oxcModlhrvr9_de,me:_oxcModlhrvr9_me,we:_oxcModlhrvr9_we,L:_oxcModlhrvr9_L,It:_oxcModlhrvr9_It,_:_oxcModlhrvr9__,Pt:_oxcModlhrvr9_Pt,qe:_oxcModlhrvr9_qe,v:_oxcModlhrvr9_v,C:_oxcModlhrvr9_C,jn:_oxcModlhrvr9_jn,I:_oxcModlhrvr9_I,S:_oxcModlhrvr9_S,ie:_oxcModlhrvr9_ie,Ht:_oxcModlhrvr9_Ht,Vt:_oxcModlhrvr9_Vt,Qt:_oxcModlhrvr9_Qt,q:_oxcModlhrvr9_q,Ft:_oxcModlhrvr9_Ft,H:_oxcModlhrvr9_H,Y:_oxcModlhrvr9_Y,Nn:_oxcModlhrvr9_Nn,Mn:_oxcModlhrvr9_Mn}=_oxcModlhrvr9;export{_oxcModlhrvr9_se as withoutNullable,_oxcModlhrvr9_Ae as videoSizeToQuality,_oxcModlhrvr9_je as videoQualityToHeight,_oxcModlhrvr9_ke as videoHeightToQuality,_oxcModlhrvr9_Zn as urlCanParsePolyfilled,_oxcModlhrvr9_He as timeout,_oxcModlhrvr9_Ie as timeCodeToString,_oxcModlhrvr9_Re as throttleFn,_oxcModlhrvr9_et as throttle,_oxcModlhrvr9_pt as tap,_oxcModlhrvr9_Dt as suppressAbort,_oxcModlhrvr9_zn as stringTrimStart,_oxcModlhrvr9_Hn as stringTrimRight,_oxcModlhrvr9_Vn as stringTrimLeft,_oxcModlhrvr9_Bn as stringTrimEnd,_oxcModlhrvr9_Rn as stringReplaceAll,_oxcModlhrvr9_Ln as stringPadStart,_oxcModlhrvr9_In as stringPadEnd,_oxcModlhrvr9_Fn as stringMatchAll,_oxcModlhrvr9_Pn as stringAt,_oxcModlhrvr9_ht as skip,_oxcModlhrvr9__t as shareReplay,_oxcModlhrvr9_ge as safeStorage,_oxcModlhrvr9_Jn as requestIdleCallbackPolyfilled,_oxcModlhrvr9_xn as promiseWithResolvers,_oxcModlhrvr9_bn as promiseTry,_oxcModlhrvr9_yn as promiseFinally,_oxcModlhrvr9_vn as promiseAny,_oxcModlhrvr9__n as promiseAllSettled,_oxcModlhrvr9_dt as pairwise,_oxcModlhrvr9_ut as once,_oxcModlhrvr9_yt as observeElementSize,_oxcModlhrvr9_Ge as observableFrom,_oxcModlhrvr9_gn as objectValues,_oxcModlhrvr9_hn as objectHasOwn,_oxcModlhrvr9_pn as objectFromEntries,_oxcModlhrvr9_fn as objectEntries,_oxcModlhrvr9_pe as nowInt,_oxcModlhrvr9_fe as now,_oxcModlhrvr9_b as noop,_oxcModlhrvr9_Ve as merge,_oxcModlhrvr9_lt as mapTo,_oxcModlhrvr9_z as map,_oxcModlhrvr9_Rt as loadVKLangPack,_oxcModlhrvr9_xt as isValidURL,_oxcModlhrvr9_T as isNullable,_oxcModlhrvr9_w as isNonNullable,_oxcModlhrvr9_De as isLowerOrEqual,_oxcModlhrvr9_M as isLower,_oxcModlhrvr9_P as isInvariantQuality,_oxcModlhrvr9_St as isIntersecting,_oxcModlhrvr9_Ee as isHigherOrEqual,_oxcModlhrvr9_Te as isHigher,_oxcModlhrvr9_ue as isBrowserWindow,_oxcModlhrvr9_V as isAbortError,_oxcModlhrvr9_Ue as interval,_oxcModlhrvr9_Tt as interpolate,_oxcModlhrvr9_Xn as includesPolyfilled,_oxcModlhrvr9_dn as globalThisPolyfill,_oxcModlhrvr9_E as getWindow,_oxcModlhrvr9_Pe as getVideoQualityLabel,_oxcModlhrvr9_kt as getTraceSubscriptionMethod,_oxcModlhrvr9_Et as getRangeAroundIndex,_oxcModlhrvr9_wt as getPlayerId,_oxcModlhrvr9_Ot as getMessageFromError,_oxcModlhrvr9_Oe as getHighestQuality,_oxcModlhrvr9_he as getExponentialDelay,_oxcModlhrvr9_Ke as fromEvent,_oxcModlhrvr9_B as flattenObject,_oxcModlhrvr9_ot as filterChanged,_oxcModlhrvr9_nt as filter,_oxcModlhrvr9_Fe as fillWithDefault,_oxcModlhrvr9_An as fetchPolyfilled,_oxcModlhrvr9_Ut as devNull,_oxcModlhrvr9_Ce as detectEmbed,_oxcModlhrvr9_Le as debounceFn,_oxcModlhrvr9_Ze as debounce,_oxcModlhrvr9_$t as createDIContainer,_oxcModlhrvr9_Be as combine,_oxcModlhrvr9_F as cloneDeepWith,_oxcModlhrvr9_ze as cloneDeep,_oxcModlhrvr9_bt as clearVideoElement,_oxcModlhrvr9_ne as checkNever,_oxcModlhrvr9_Yn as cancelIdleCallbackPolyfilled,_oxcModlhrvr9_Je as buffer,_oxcModlhrvr9_Un as atPolyfilled,_oxcModlhrvr9_Ne as assertQualityIsExact,_oxcModlhrvr9_oe as assertNullable,_oxcModlhrvr9_ce as assertNotEmptyArray,_oxcModlhrvr9_ae as assertNonNullable,_oxcModlhrvr9_y as assertNever,_oxcModlhrvr9_le as assertEmptyArray,_oxcModlhrvr9_un as arrayWith,_oxcModlhrvr9_ln as arrayToSpliced,_oxcModlhrvr9_cn as arrayToSorted,_oxcModlhrvr9_sn as arrayToReversed,_oxcModlhrvr9_on as arrayIncludes,_oxcModlhrvr9_an as arrayFlatMap,_oxcModlhrvr9_rn as arrayFlat,_oxcModlhrvr9_nn as arrayFindLastIndex,_oxcModlhrvr9_tn as arrayFindLast,_oxcModlhrvr9_en as arrayAt,_oxcModlhrvr9_Me as areQualitiesExact,_oxcModlhrvr9_de as addScript,_oxcModlhrvr9_me as abortable,_oxcModlhrvr9_we as VideoQuality,_oxcModlhrvr9_L as ValueSubject,_oxcModlhrvr9_It as VKNumericLanguage,_oxcModlhrvr9__ as VERSION,_oxcModlhrvr9_Pt as TracerFactory,_oxcModlhrvr9_qe as SubscriptionRemovable,_oxcModlhrvr9_v as Subscription,_oxcModlhrvr9_C as Subject,_oxcModlhrvr9_jn as RequestPolyfilled,_oxcModlhrvr9_I as ReplaySubject,_oxcModlhrvr9_S as Observable,_oxcModlhrvr9_ie as Logger,_oxcModlhrvr9_Ht as InternalsExposure,_oxcModlhrvr9_Vt as InterfaceLanguage,_oxcModlhrvr9_Qt as InjectionToken,_oxcModlhrvr9_q as INTERNAL_EXPOSE_GLOBAL_KEY,_oxcModlhrvr9_Ft as ErrorCategory,_oxcModlhrvr9_H as CircularBuffer,_oxcModlhrvr9_Y as AppTracer,_oxcModlhrvr9_Nn as AbortSignalPolyfilled,_oxcModlhrvr9_Mn as AbortControllerPolyfilled};
|
|
6
|
+
var _oxcModk1nyxl=function(){function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}var t=e;function n(e,n){if(t(e)!=`object`||!e)return e;var r=e[Symbol._oxc_toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(t(i)!=`object`)return i;throw TypeError(`@@_oxc_toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}var t=e,r=n;function i(e){var n=r(e,`string`);return t(n)==`symbol`?n:n+``}var a=i;function o(e,t,n){return(t=a(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var s=o;function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?c(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function d(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){u(a,r,i,o,s,`next`,e)}function s(e){u(a,r,i,o,s,`throw`,e)}o(void 0)})}}var f=l,p=d;let m;var h=Object.defineProperty,ee=e=>e;function te(e,t){this[e]=ee.bind(null,t)}var g=(e,t)=>{for(var n in t)h(e,n,{get:t[n],enumerable:!0,configurable:!0,set:te.bind(t,n)})},_=`1.0.95-dev.1022d4dbd.0`;class v{constructor(){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 y=e=>{throw Error(`${e} is value of unexpected type`)},ne=e=>{},b=()=>{},re=e=>{throw console.error(e),e},x=e=>{console.error(e)};class S{constructor(e){this.suppressErrors=!1,e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?x:re,r;r=t?typeof t==`function`?{next:t,error:b}:{next:e=>t.next(e),error:e=>t.error?.call(t,e)}:{next:n,error:b};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 v().add(()=>{switch(i.next=b,i.error=b,typeof a){case`function`:a();return;case`object`:a.unsubscribe();return;case`undefined`:return;default:return y(a)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class C extends S{constructor(){super(),this.keyCounter=0,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 v().add(()=>this.subscribers.delete(t))}}class ie{constructor(){this.log$=new C,this.logs=[],this.log=e=>{let t=f(f({},e),{},{timestamp:Date.now()});this.logs.push(t),this.log$.next(t)},this.getAllLogs=()=>this.logs}createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch{n={message:"error in `createCustomLog`",component:`Logger`}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>f({component:e},t))}}function ae(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function oe(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function w(e){return e!=null}function T(e){return e==null}var se=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>w(t)));function ce(e,t){if(!e?.length)throw Error(t)}function le(e,t){if(e?.length)throw Error(t)}var E=()=>globalThis,ue=(e=E())=>!!(e.window&&e.screen),de=(e,t,n)=>new Promise((r,i)=>{t.addEventListener(`abort`,()=>{s(),l.remove()});let a=()=>{s(),i(`error`)},o=()=>{s(),r()},s=()=>{c&&clearTimeout(c),l.removeEventListener(`load`,o),l.removeEventListener(`error`,a)},c;n&&(c=E().setTimeout(()=>{s(),i(`timeout`)},n));let l=document.createElement(`script`);l.addEventListener(`load`,o),l.addEventListener(`error`,a),l.src=e,document.head.appendChild(l)}),fe=typeof E().performance?.now==`function`?()=>E().performance.now():()=>Date.now(),pe=()=>Math.trunc(fe()),me=(e,t)=>p(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}),he=(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},ge={};g(ge,{set:()=>ye,remove:()=>xe,isPersistent:()=>_e,has:()=>be,get:()=>ve,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},_e=()=>A()===0,ve=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:y(t)}},ye=(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:y(n)}},be=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 y(t),!1}},xe=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:y(t)}},Se=()=>{let e=A();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return D?.clear();default:y(e)}},Ce=()=>{let e,t=[],n=E();try{e=n.self!==n.top}catch(t){t instanceof DOMException&&t.name===`SecurityError`?e=!0:(e=!1,console.error(t))}try{n.location?.ancestorOrigins&&(t=[...n.location.ancestorOrigins])}catch(e){console.error(e)}try{!t.length&&n.document.referrer&&(t=[new URL(n.document.referrer).origin])}catch(e){console.error(e)}return t=t.filter(e=>URL.canParse(e)),{isEmbed:e,origins:t,topOrigin:t.at(-1),immediateOrigin:t.at(0)}},we;(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`})(we||={});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}},Te=(e,t)=>j[e].height>j[t].height,Ee=(e,t)=>j[e].height>=j[t].height,M=(e,t)=>j[e].height<j[t].height,De=(e,t)=>j[e].height<=j[t].height,Oe=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),ke=(e,t=.02)=>[...N].find(n=>j[n].height*(1+t)>=e),Ae=({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})},je=e=>j[e].height,P=e=>e===`Invariant quality`,Me=e=>e.every(e=>!P(e));function Ne(e){if(P(e))throw Error(`Expected exact quality`)}var Pe=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``}},Fe=(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]=Fe(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},Ie=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 Le(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof E().requestAnimationFrame==`function`;n&&(u=!!n.leading,d=`maxWait`in n,a=n?.maxWait?Math.max(+n?.maxWait||0,t):a,f=`trailing`in n?!!n.trailing:f);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(s&&E().cancelAnimationFrame(s),E().requestAnimationFrame(e)):setTimeout(e,t)}function ee(e){if(p){E().cancelAnimationFrame(e);return}clearTimeout(e)}function te(e){return l=e,s=h(v,t),u?m(e):o}function g(e){let n=e-c,r=e-l,i=t-n;return d?Math.min(i,a-r):i}function _(e){let n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function v(){let e=Date.now();if(_(e))return y(e);s=h(v,g(e))}function y(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function ne(){s!==void 0&&ee(s),l=0,r=c=i=s=void 0}function b(){return s===void 0?o:y(Date.now())}function re(){return s!==void 0}function x(...e){let n=Date.now(),a=_(n);if(r=e,i=this,c=n,a){if(s===void 0)return te(c);if(d)return s=h(v,t),m(c)}return s===void 0&&(s=h(v,t)),o}return x.cancel=ne,x.flush=b,x.pending=re,x}var Re=(e,t=0,n)=>Le(e,t,f(f(f({},{leading:!0,trailing:!0}),n),{},{maxWait:t})),F=(e,t)=>{if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let r in e){if(typeof t==`function`){let i=t(e[r],r,e,n);if(i!==void 0){n[r]=i;continue}}typeof e[r]==`object`?n[r]=F(e[r],t):n[r]=e[r]}return n},ze=e=>F(e);class I extends C{constructor(e){super(),this.bufferSize=void 0,this.buffer=[],this.cursorEnd=-1,this.cursorStart=0,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 v().add(()=>this.subscribers.delete(t))}}class L extends C{constructor(e){super(),this.value=void 0,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 Be(e){return new S(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 v)})}function Ve(...e){return new S(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new v))}var He=e=>new S(t=>{let n=E().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>E().clearTimeout(n)}),Ue=e=>new S(t=>{let n=E(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function We(e){return new S(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 Ge=We,Ke=(e,t)=>new S(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class qe extends v{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Je(e){return new S(t=>{let n=Array(e.length),r=e=>r=>{n[e]=r,t.next([...n])};return e.reduce((e,t,n)=>e.add(t.subscribe(r(n))),new v)})}function Ye(e){return t=>new S(n=>t.subscribe(new Xe(n,e)))}class Xe{constructor(e,t){this.destination=void 0,this.size=void 0,this.lastValues=[],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){var t;(t=this.destination).error?.call(t,e)}}var Ze={leading:!1,trailing:!0};function Qe(e,t=Ze){return n=>new S(r=>n.subscribe(new $e(r,e,t)))}class $e{constructor(e,t,n){this.destination=void 0,this.time=void 0,this.config=void 0,this.lastValue=void 0,this.timeout=void 0,this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e;let t=E();w(this.timeout)?t.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=t.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(e){if(this.destination.error)this.destination.error(e);else throw e}this.timeout=void 0},this.time)}error(e){var t;(t=this.destination).error?.call(t,e)}}var et={leading:!0,trailing:!1};function tt(e,t=et){return n=>new S(r=>n.subscribe(new nt(r,e,t)))}class nt{constructor(e,t,n){this.destination=void 0,this.time=void 0,this.config=void 0,this.lastValue=void 0,this.timeout=void 0,this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,T(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=E().setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){var t;(t=this.destination).error?.call(t,e)}}function rt(e){return t=>new S(n=>t.subscribe(new it(n,e)))}class it{constructor(e,t){this.destination=void 0,this.predicate=void 0,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){var t;(t=this.destination).error?.call(t,e)}}var at=(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)},ot=(e,t)=>e instanceof Object&&t instanceof Object?at(e,t):e===t;function st(e=ot){return t=>new S(n=>t.subscribe(new ct(n,e)))}var R={};class ct{constructor(e,t){this.destination=void 0,this.predicate=void 0,this.lastValue=R,this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===R||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?f({},e):e}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){var t;(t=this.destination).error?.call(t,e)}}function z(e){return t=>new S(n=>t.subscribe(new lt(n,e)))}class lt{constructor(e,t){this.destination=void 0,this.mapper=void 0,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){var t;(t=this.destination).error?.call(t,e)}}function ut(e){return z(()=>e)}function dt(){return e=>new S(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 ft(){return e=>new S(t=>e.subscribe(new pt(t)))}class pt{constructor(e){this.destination=void 0,this.last=void 0,this.hasLast=!1,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){var t;(t=this.destination).error?.call(t,e)}}function mt(e){return t=>new S(n=>t.subscribe(new ht(n,e)))}class ht{constructor(e,t){this.destination=void 0,this.effect=void 0,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){var t;(t=this.destination).error?.call(t,e)}}function gt(e){return t=>new S(n=>t.subscribe(new _t(n,e)))}class _t{constructor(e,t){if(this.destination=void 0,this.count=void 0,this.destination=e,this.count=t,t<0){var n;(n=this.destination).error?.call(n,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 vt(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 S(e=>(n++,a(r.subscribe(e))))}}var yt=300,bt=(e,t=yt)=>new S(n=>{let r=E(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!ue(r))return;let o=new r.ResizeObserver(Re(e=>{let t=e[0];if(!t)return;let r,i;t.contentBoxSize&&t.contentBoxSize[0]?(i=t.contentBoxSize[0].blockSize,r=t.contentBoxSize[0].inlineSize):t.contentRect&&(r=t.contentRect.width,i=t.contentRect.height),w(r)&&w(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),B=(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=B(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},xt=(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),wt=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),Tt=e=>e!==void 0&&e!==``?e:wt().toString();function Et(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 Dt(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 V=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),Ot=e=>{if(!V(e))throw e};function kt(e){if(e&&typeof e==`object`){if(`message`in e)return String(e.message);try{return JSON.stringify(e)}catch{return`object serialization error`}}return String(e)}m=Symbol.iterator;class H{constructor(e){if(this.buffer=void 0,this.writeIndex=0,this.count=0,this.capacity=void 0,e<=0)throw Error(`Capacity must be greater than 0`);this.capacity=e,this.buffer=Array.from({length:e}).fill(null)}add(e){this.buffer[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.count<this.capacity&&this.count++}*[m](){if(this.count===0)return;let e=this.count<this.capacity?0:this.writeIndex;for(let t=0;t<this.count;t++){let t=this.buffer[e];w(t)&&(yield t),e=(e+1)%this.capacity}}clear(){this.buffer.fill(null),this.writeIndex=0,this.count=0}get size(){return this.count}get maxCapacity(){return this.capacity}}var At=e=>(t,n=!1)=>r=>{let i=typeof r==`object`;r==null||i&&!Object.keys(r).length||e(t,i?B(r):{value:r},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:e,getParentContext:t,getRootTracerContext:n,eventsBufferSize:r}){this.dynamicImportTimeout=5e3,this.subscription=new v,this.span=void 0,this.context=void 0,this.childTracers=[],this.initPromise=void 0,this.getRootTracerContext=void 0,this.eventsBuffer=null,w(r)&&r>0&&(this.eventsBuffer=new H(r)),W.dynamicImportStatus===`not_started`&&(W.dynamicImportPromise=this.loadOpentelemetry());let i=Date.now();this.initPromise=W.dynamicImportPromise.then(r=>{W.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t,getRootTracerContext:n},i)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(T(i))return;let{opentelemetryApi:a}=W.dynamicImports,{context:o,trace:s}=a,{tracer:c,attributes$:l}=i;this.span=c.startSpan(e,{startTime:r},t?.()),this.context=s.setSpan(o.active(),this.span),this.getRootTracerContext=n,this.subscription.add(l.subscribe(e=>{w(e)&&this.span.setAttributes(e)}))}loadOpentelemetry(){var e=this;return p(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 T(this.span)||W.dynamicImportStatus===`failed`}addEventToBuffer(e,t,n,r){w(this.eventsBuffer)&&this.eventsBuffer.add({name:e,attributes:t,type:n,timestamp:r})}addEventToSpan(e,t,n,r){this.span.addEvent(e,f(f({},U(t)),{},{type:n}),r)}log(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`log`,r)}):this.addEventToBuffer(e,t,`log`,r)}error(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`error`,r)}):this.addEventToBuffer(e,t,`error`,r)}critical(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`critical`,r)}):this.addEventToBuffer(e,t,`critical`,r)}createComponentTracer(e){let t=new W({name:e,getParentContext:()=>this.context,getRootTracerContext:()=>this.getRootTracerContext?.call(this),eventsBufferSize:this.eventsBuffer?.maxCapacity});return this.childTracers.push(t),t}setSpanAttributes(e){this.span.setAttributes(U(e))}end(){this.initPromise.then(e=>{if(!this.isComponentTracerNotInitialized()){if(w(this.eventsBuffer))for(let e of this.eventsBuffer)this.addEventToSpan(e.name,e.attributes,e.type,e.timestamp);this.childTracers.forEach(e=>e.end()),this.span.end(),this.subscription.unsubscribe()}})}}W.dynamicImportStatus=`not_started`,W.dynamicImports=void 0,W.dynamicImportPromise=void 0;var G=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`;class jt extends W{constructor(e){super({name:`Root`,eventsBufferSize:e}),this.attributes$=new L(null)}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:G}))]});f.register();let p=f.getTracer(`sdk-videoplayer-tracer`);super.init({name:e,getParentContext:t,getRootTracerContext:()=>({tracer:p,attributes$:this.attributes$})},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}setSpanAttributes(e){this.attributes$.next(f(f({},this.attributes$.getValue()),U(e)))}addSubscription(e){this.subscription.add(e)}}class Mt{constructor(e){this.fakeTraceId=void 0}log(e,t,n){}error(e,t,n){}critical(e,t,n){}createComponentTracer(e){return new Mt({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}}var Nt=()=>!0,K={level:0,filter:Nt,name:`Noname Tracer`,outputMethod:`log`};class Pt{constructor({name:e,level:t,filter:n,outputMethod:r}={}){this.name=void 0,this.filter=Nt,this.level=K.level,this.outputMethod=K.outputMethod,this.childTracers=[],this.filter=n??this.filter,this.level=t??this.level,this.outputMethod=r??this.outputMethod,this.name=e??K.name}log(e,t,n){this.logDebug(e,t)}error(e,t,n){this.logError(e,t)}critical(e,t,n){this.logError(e,t)}createComponentTracer(e){let t=new Pt({filter:this.filter,level:this.level,name:`${this.name}/ ${e}`,outputMethod:this.outputMethod});return this.childTracers.push(t),t}end(){this.childTracers.forEach(e=>e.end()),this.childTracers=[]}setLevel(e){this.level=e,this.childTracers.forEach(t=>t.setLevel(e))}setOtputMethod(e){this.outputMethod=e,this.childTracers.forEach(t=>t.setOtputMethod(e))}setFilter(e){this.filter=e,this.childTracers.forEach(t=>t.setFilter(e))}getFinishedSpans(){}getTraceId(){return`debug_trace`}get verbose(){return this.level===0}createMessage(e,t){return[this.name,e,JSON.stringify(t)].join(`: `)}logDebug(e,t){!this.verbose||!this.filter(e,t)||E().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&E().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}}class Ft{static createRootTracer(e=`fake`,t){switch(e){case`real`:return new jt(t);case`debug`:return new Pt;default:return new Mt}}}var It;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.UI=`ui`,e.CALL_FROM_EXTERNAL=`call_from_external`,e.FATAL=`fatal`})(It||={});var Lt;(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`})(Lt||={});var Rt=`vk.com`,zt=function(){var e=p(function*(e,t,n){let r=new URL(`https://${Rt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),Bt(yield(yield fetch(r.toString())).json(),n)});return function(t,n,r){return e.apply(this,arguments)}}(),Bt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),Vt(n)])),Vt=e=>Array.isArray(e)?e[0]:e,Ht;(e=>{e.RU=`ru`,e.EN=`en`})(Ht||={});var q=`__vk_vp_internals_exposure`;class Ut{constructor(e,t){this.playerId=void 0,this.type=void 0,this.playerId=t,this.type=e,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 Wt={};g(Wt,{subscribe:()=>Jt,push:()=>qt,destroy:()=>Kt,create:()=>Gt});var J=new Map,Gt=(e,t)=>J.set(e,t??[]),Kt=e=>J.delete(e),qt=(e,t)=>{let n=J.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Jt=(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)}},Yt=e=>se({id:e.id,message:e.message,category:e.category,data:Xt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Xt(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?e.thrown:Error(e.message),n=e.id.length>10240?e.id.substring(0,10240):e.id;try{t.name=n}catch{t=Error(e.message),t.name=n}return t},Qt=()=>{try{var e;let{origin:t,pathname:n,search:r,hostname:i}=((e=E())==null||(e=e.document)==null?void 0:e.location)??{};return!i||i===`localhost`?void 0:f({url:t+n},new URLSearchParams(r).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{}))}catch{}};class Y{constructor(e,t,n,r){this.dynamicImportTimeout=5e3,this.componentName=void 0,this.subscription=new v,this.options=void 0,this.envParams=void 0,this.context=void 0,this.isEmbed=void 0,this.embedParent=void 0,this.beforeInitErrors=[],this.componentName=e,this.options=t,this.envParams=n,this.context=f({},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 n=Y.tracerErrorMap.get(this.componentName);if(!n){this.beforeInitErrors.push([e,t]);return}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))try{let r=Zt(e);n?.error(r,{crashIdSource:r.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:f(f(f(f({},this.context),Yt(e)),Qt()),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 p(function*(){try{if(yield Y.loadPromise,Y.tracerErrorMap.has(e.componentName)||T(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});w(e.options.userId)&&s.setUserId(e.options.userId),o&&r(e.componentName,{appToken:G,environment:e.envParams.env,versionCode:1,versionName:e.envParams.version}),Y.tracerErrorMap.set(e.componentName,s),e.beforeInitErrors.forEach(t=>e.error.apply(e,t)),e.beforeInitErrors=[]}catch(e){console.error(e)}})()}loadModule(){var e=this;w(Y.loadPromise)||(Y.loadPromise=function(){var t=p(function*(){try{let t=new Promise((t,n)=>E().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)}}()())}}Y.tracerErrorMap=new Map,Y.appTracerModule=null,Y.loadPromise=null;class $t{constructor(e,t){this.options=void 0,this.symbol=void 0,this.options=t,this.symbol=Symbol(e)}}var en=()=>{let e=new Map,t=new Map,n=new Map,r=new Map,i=new Set;return{resolve(e){if(!r.has(e)){let t=n.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);r.set(e,new t)}return r.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){r.forEach((t,n)=>{t instanceof e&&r.delete(n)}),n.set(e,t)},getToken(n){if(e.has(n.symbol))return e.get(n.symbol);if(t.has(n.symbol)){let r=t.get(n.symbol)();return e.set(n.symbol,r),r}if(n.options?.factory){let t=n.options.factory();return e.set(n.symbol,t),t}throw Error(`No value registered in DI container for token "${n.symbol.description}"`)},registerToken(t,n){e.set(t.symbol,n)},registerFactory(e,n){t.set(e.symbol,n)},hasToken(n){return e.has(n.symbol)||t.has(n.symbol)||!!n.options?.factory},registerCleanup(e){i.add(e)},clear(){i.forEach(e=>e()),i.clear(),e.clear(),t.clear(),r.clear(),n.clear()}}},tn=(e,t)=>{let n=e.length,r=t>=0?t:n+t;return r>=0&&r<n?e[r]:void 0},nn=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}},rn=(e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n],n,e))return n;return-1},an=(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},on=(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},sn=(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},cn=e=>{let t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=e[t-1-r];return n},ln=(e,t)=>{let n=e.slice();return t?n.sort(t):n.sort()},un=(e,t,n,...r)=>{let i=e.slice();return n===void 0?i.splice(t):i.splice(t,n,...r),i},dn=(e,t,n)=>{let r=e.length,i=t>=0?t:r+t,a=e.slice();return a[i]=n,a},fn=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:Function(`return this`)(),pn=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},mn=e=>{let t={};for(let[n,r]of e)t[n]=r;return t},hn=Object.prototype.hasOwnProperty,gn=(e,t)=>hn.call(e,t),_n=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},vn=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}))))},yn=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`))})})})},bn=(e,t)=>e.then(e=>Promise.resolve(t()).then(()=>e),e=>Promise.resolve(t()).then(()=>{throw e})),xn=e=>{try{return Promise.resolve(e())}catch(e){return Promise.reject(e)}},Sn=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},{NativeAbortSignal:Cn,NativeAbortController:wn}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function Tn(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 En(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 Dn{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 Dn{constructor(){super(),this.listeners||Dn.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=En(e),n=Tn(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 On(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 kn(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!On({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&&On({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}),An=$?kn({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,jn=$?An.fetch:Q.fetch,Mn=$?An.Request:Q.Request,Nn=$?Z:Q.AbortController,Pn=$?X:Q.AbortSignal,Fn=(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*In(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 Ln=(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)},Rn=(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},zn=(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+/,``),Vn=e=>e.replace(/\s+$/,``),Hn=Bn,Un=Vn,Wn=(e,t)=>typeof e==`string`?Fn(e,t):tn(e,t),Gn=(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)},Kn=e=>Q.clearTimeout(e),qn=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),Jn=!qn(Q.requestIdleCallback)||!qn(Q.cancelIdleCallback),Yn=Jn?Gn:Q.requestIdleCallback,Xn=Jn?Kn:Q.cancelIdleCallback,Zn=(e,t,n)=>typeof e==`string`?e.includes(t,n):sn(e,t,n),Qn=(e,t,n)=>{if(typeof e.canParse==`function`)return e.canParse(t,n);try{return new e(t,n),!0}catch{return!1}};;return{se,Ae,je,ke,Qn,He,Ie,Re,tt,mt,Ot,Bn,Un,Hn,Vn,zn,Rn,Ln,In,Fn,gt,vt,ge,Yn,Sn,xn,bn,yn,vn,ft,dt,bt,Ge,_n,gn,mn,pn,pe,fe,b,Ve,ut,z,zt,St,T,w,De,M,P,Ct,Ee,Te,ue,V,Ue,Et,Zn,fn,E,Pe,At,Dt,Tt,kt,Oe,he,Ke,B,st,rt,Fe,jn,Wt,Ce,Le,Qe,en,Je,Be,F,ze,xt,ne,Xn,Ye,Wn,Ne,oe,ce,ae,y,le,dn,un,ln,cn,sn,on,an,rn,nn,tn,Me,de,me,we,L,Lt,_,Ft,qe,v,C,Mn,I,S,ie,Ut,Ht,$t,q,It,H,Y,Pn,Nn};}();var{se:_oxcModk1nyxl_se,Ae:_oxcModk1nyxl_Ae,je:_oxcModk1nyxl_je,ke:_oxcModk1nyxl_ke,Qn:_oxcModk1nyxl_Qn,He:_oxcModk1nyxl_He,Ie:_oxcModk1nyxl_Ie,Re:_oxcModk1nyxl_Re,tt:_oxcModk1nyxl_tt,mt:_oxcModk1nyxl_mt,Ot:_oxcModk1nyxl_Ot,Bn:_oxcModk1nyxl_Bn,Un:_oxcModk1nyxl_Un,Hn:_oxcModk1nyxl_Hn,Vn:_oxcModk1nyxl_Vn,zn:_oxcModk1nyxl_zn,Rn:_oxcModk1nyxl_Rn,Ln:_oxcModk1nyxl_Ln,In:_oxcModk1nyxl_In,Fn:_oxcModk1nyxl_Fn,gt:_oxcModk1nyxl_gt,vt:_oxcModk1nyxl_vt,ge:_oxcModk1nyxl_ge,Yn:_oxcModk1nyxl_Yn,Sn:_oxcModk1nyxl_Sn,xn:_oxcModk1nyxl_xn,bn:_oxcModk1nyxl_bn,yn:_oxcModk1nyxl_yn,vn:_oxcModk1nyxl_vn,ft:_oxcModk1nyxl_ft,dt:_oxcModk1nyxl_dt,bt:_oxcModk1nyxl_bt,Ge:_oxcModk1nyxl_Ge,_n:_oxcModk1nyxl__n,gn:_oxcModk1nyxl_gn,mn:_oxcModk1nyxl_mn,pn:_oxcModk1nyxl_pn,pe:_oxcModk1nyxl_pe,fe:_oxcModk1nyxl_fe,b:_oxcModk1nyxl_b,Ve:_oxcModk1nyxl_Ve,ut:_oxcModk1nyxl_ut,z:_oxcModk1nyxl_z,zt:_oxcModk1nyxl_zt,St:_oxcModk1nyxl_St,T:_oxcModk1nyxl_T,w:_oxcModk1nyxl_w,De:_oxcModk1nyxl_De,M:_oxcModk1nyxl_M,P:_oxcModk1nyxl_P,Ct:_oxcModk1nyxl_Ct,Ee:_oxcModk1nyxl_Ee,Te:_oxcModk1nyxl_Te,ue:_oxcModk1nyxl_ue,V:_oxcModk1nyxl_V,Ue:_oxcModk1nyxl_Ue,Et:_oxcModk1nyxl_Et,Zn:_oxcModk1nyxl_Zn,fn:_oxcModk1nyxl_fn,E:_oxcModk1nyxl_E,Pe:_oxcModk1nyxl_Pe,At:_oxcModk1nyxl_At,Dt:_oxcModk1nyxl_Dt,Tt:_oxcModk1nyxl_Tt,kt:_oxcModk1nyxl_kt,Oe:_oxcModk1nyxl_Oe,he:_oxcModk1nyxl_he,Ke:_oxcModk1nyxl_Ke,B:_oxcModk1nyxl_B,st:_oxcModk1nyxl_st,rt:_oxcModk1nyxl_rt,Fe:_oxcModk1nyxl_Fe,jn:_oxcModk1nyxl_jn,Wt:_oxcModk1nyxl_Wt,Ce:_oxcModk1nyxl_Ce,Le:_oxcModk1nyxl_Le,Qe:_oxcModk1nyxl_Qe,en:_oxcModk1nyxl_en,Je:_oxcModk1nyxl_Je,Be:_oxcModk1nyxl_Be,F:_oxcModk1nyxl_F,ze:_oxcModk1nyxl_ze,xt:_oxcModk1nyxl_xt,ne:_oxcModk1nyxl_ne,Xn:_oxcModk1nyxl_Xn,Ye:_oxcModk1nyxl_Ye,Wn:_oxcModk1nyxl_Wn,Ne:_oxcModk1nyxl_Ne,oe:_oxcModk1nyxl_oe,ce:_oxcModk1nyxl_ce,ae:_oxcModk1nyxl_ae,y:_oxcModk1nyxl_y,le:_oxcModk1nyxl_le,dn:_oxcModk1nyxl_dn,un:_oxcModk1nyxl_un,ln:_oxcModk1nyxl_ln,cn:_oxcModk1nyxl_cn,sn:_oxcModk1nyxl_sn,on:_oxcModk1nyxl_on,an:_oxcModk1nyxl_an,rn:_oxcModk1nyxl_rn,nn:_oxcModk1nyxl_nn,tn:_oxcModk1nyxl_tn,Me:_oxcModk1nyxl_Me,de:_oxcModk1nyxl_de,me:_oxcModk1nyxl_me,we:_oxcModk1nyxl_we,L:_oxcModk1nyxl_L,Lt:_oxcModk1nyxl_Lt,_:_oxcModk1nyxl__,Ft:_oxcModk1nyxl_Ft,qe:_oxcModk1nyxl_qe,v:_oxcModk1nyxl_v,C:_oxcModk1nyxl_C,Mn:_oxcModk1nyxl_Mn,I:_oxcModk1nyxl_I,S:_oxcModk1nyxl_S,ie:_oxcModk1nyxl_ie,Ut:_oxcModk1nyxl_Ut,Ht:_oxcModk1nyxl_Ht,$t:_oxcModk1nyxl_$t,q:_oxcModk1nyxl_q,It:_oxcModk1nyxl_It,H:_oxcModk1nyxl_H,Y:_oxcModk1nyxl_Y,Pn:_oxcModk1nyxl_Pn,Nn:_oxcModk1nyxl_Nn}=_oxcModk1nyxl;export{_oxcModk1nyxl_se as withoutNullable,_oxcModk1nyxl_Ae as videoSizeToQuality,_oxcModk1nyxl_je as videoQualityToHeight,_oxcModk1nyxl_ke as videoHeightToQuality,_oxcModk1nyxl_Qn as urlCanParsePolyfilled,_oxcModk1nyxl_He as timeout,_oxcModk1nyxl_Ie as timeCodeToString,_oxcModk1nyxl_Re as throttleFn,_oxcModk1nyxl_tt as throttle,_oxcModk1nyxl_mt as tap,_oxcModk1nyxl_Ot as suppressAbort,_oxcModk1nyxl_Bn as stringTrimStart,_oxcModk1nyxl_Un as stringTrimRight,_oxcModk1nyxl_Hn as stringTrimLeft,_oxcModk1nyxl_Vn as stringTrimEnd,_oxcModk1nyxl_zn as stringReplaceAll,_oxcModk1nyxl_Rn as stringPadStart,_oxcModk1nyxl_Ln as stringPadEnd,_oxcModk1nyxl_In as stringMatchAll,_oxcModk1nyxl_Fn as stringAt,_oxcModk1nyxl_gt as skip,_oxcModk1nyxl_vt as shareReplay,_oxcModk1nyxl_ge as safeStorage,_oxcModk1nyxl_Yn as requestIdleCallbackPolyfilled,_oxcModk1nyxl_Sn as promiseWithResolvers,_oxcModk1nyxl_xn as promiseTry,_oxcModk1nyxl_bn as promiseFinally,_oxcModk1nyxl_yn as promiseAny,_oxcModk1nyxl_vn as promiseAllSettled,_oxcModk1nyxl_ft as pairwise,_oxcModk1nyxl_dt as once,_oxcModk1nyxl_bt as observeElementSize,_oxcModk1nyxl_Ge as observableFrom,_oxcModk1nyxl__n as objectValues,_oxcModk1nyxl_gn as objectHasOwn,_oxcModk1nyxl_mn as objectFromEntries,_oxcModk1nyxl_pn as objectEntries,_oxcModk1nyxl_pe as nowInt,_oxcModk1nyxl_fe as now,_oxcModk1nyxl_b as noop,_oxcModk1nyxl_Ve as merge,_oxcModk1nyxl_ut as mapTo,_oxcModk1nyxl_z as map,_oxcModk1nyxl_zt as loadVKLangPack,_oxcModk1nyxl_St as isValidURL,_oxcModk1nyxl_T as isNullable,_oxcModk1nyxl_w as isNonNullable,_oxcModk1nyxl_De as isLowerOrEqual,_oxcModk1nyxl_M as isLower,_oxcModk1nyxl_P as isInvariantQuality,_oxcModk1nyxl_Ct as isIntersecting,_oxcModk1nyxl_Ee as isHigherOrEqual,_oxcModk1nyxl_Te as isHigher,_oxcModk1nyxl_ue as isBrowserWindow,_oxcModk1nyxl_V as isAbortError,_oxcModk1nyxl_Ue as interval,_oxcModk1nyxl_Et as interpolate,_oxcModk1nyxl_Zn as includesPolyfilled,_oxcModk1nyxl_fn as globalThisPolyfill,_oxcModk1nyxl_E as getWindow,_oxcModk1nyxl_Pe as getVideoQualityLabel,_oxcModk1nyxl_At as getTraceSubscriptionMethod,_oxcModk1nyxl_Dt as getRangeAroundIndex,_oxcModk1nyxl_Tt as getPlayerId,_oxcModk1nyxl_kt as getMessageFromError,_oxcModk1nyxl_Oe as getHighestQuality,_oxcModk1nyxl_he as getExponentialDelay,_oxcModk1nyxl_Ke as fromEvent,_oxcModk1nyxl_B as flattenObject,_oxcModk1nyxl_st as filterChanged,_oxcModk1nyxl_rt as filter,_oxcModk1nyxl_Fe as fillWithDefault,_oxcModk1nyxl_jn as fetchPolyfilled,_oxcModk1nyxl_Wt as devNull,_oxcModk1nyxl_Ce as detectEmbed,_oxcModk1nyxl_Le as debounceFn,_oxcModk1nyxl_Qe as debounce,_oxcModk1nyxl_en as createDIContainer,_oxcModk1nyxl_Je as combineLatest,_oxcModk1nyxl_Be as combine,_oxcModk1nyxl_F as cloneDeepWith,_oxcModk1nyxl_ze as cloneDeep,_oxcModk1nyxl_xt as clearVideoElement,_oxcModk1nyxl_ne as checkNever,_oxcModk1nyxl_Xn as cancelIdleCallbackPolyfilled,_oxcModk1nyxl_Ye as buffer,_oxcModk1nyxl_Wn as atPolyfilled,_oxcModk1nyxl_Ne as assertQualityIsExact,_oxcModk1nyxl_oe as assertNullable,_oxcModk1nyxl_ce as assertNotEmptyArray,_oxcModk1nyxl_ae as assertNonNullable,_oxcModk1nyxl_y as assertNever,_oxcModk1nyxl_le as assertEmptyArray,_oxcModk1nyxl_dn as arrayWith,_oxcModk1nyxl_un as arrayToSpliced,_oxcModk1nyxl_ln as arrayToSorted,_oxcModk1nyxl_cn as arrayToReversed,_oxcModk1nyxl_sn as arrayIncludes,_oxcModk1nyxl_on as arrayFlatMap,_oxcModk1nyxl_an as arrayFlat,_oxcModk1nyxl_rn as arrayFindLastIndex,_oxcModk1nyxl_nn as arrayFindLast,_oxcModk1nyxl_tn as arrayAt,_oxcModk1nyxl_Me as areQualitiesExact,_oxcModk1nyxl_de as addScript,_oxcModk1nyxl_me as abortable,_oxcModk1nyxl_we as VideoQuality,_oxcModk1nyxl_L as ValueSubject,_oxcModk1nyxl_Lt as VKNumericLanguage,_oxcModk1nyxl__ as VERSION,_oxcModk1nyxl_Ft as TracerFactory,_oxcModk1nyxl_qe as SubscriptionRemovable,_oxcModk1nyxl_v as Subscription,_oxcModk1nyxl_C as Subject,_oxcModk1nyxl_Mn as RequestPolyfilled,_oxcModk1nyxl_I as ReplaySubject,_oxcModk1nyxl_S as Observable,_oxcModk1nyxl_ie as Logger,_oxcModk1nyxl_Ut as InternalsExposure,_oxcModk1nyxl_Ht as InterfaceLanguage,_oxcModk1nyxl_$t as InjectionToken,_oxcModk1nyxl_q as INTERNAL_EXPOSE_GLOBAL_KEY,_oxcModk1nyxl_It as ErrorCategory,_oxcModk1nyxl_H as CircularBuffer,_oxcModk1nyxl_Y as AppTracer,_oxcModk1nyxl_Pn as AbortSignalPolyfilled,_oxcModk1nyxl_Nn as AbortControllerPolyfilled};
|
package/esnext.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.95-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.95-dev.1022d4dbd.0
|
|
3
|
+
* Tue, 14 Jul 2026 18:23:25 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-95/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:()=>w,videoSizeToQuality:()=>xe,videoQualityToHeight:()=>Se,videoHeightToQuality:()=>be,urlCanParsePolyfilled:()=>dn,timeout:()=>je,timeCodeToString:()=>De,throttleFn:()=>L,throttle:()=>Ue,tap:()=>nt,suppressAbort:()=>_t,skip:()=>it,shareReplay:()=>ot,safeStorage:()=>E,requestIdleCallbackPolyfilled:()=>ln,pairwise:()=>et,once:()=>$e,observeElementSize:()=>ct,observableFrom:()=>Pe,nowInt:()=>oe,now:()=>ae,noop:()=>h,merge:()=>Ae,mapTo:()=>Qe,map:()=>H,loadVKLangPack:()=>At,isValidURL:()=>ut,isNullable:()=>C,isNonNullable:()=>S,isLowerOrEqual:()=>ve,isLower:()=>N,isInvariantQuality:()=>F,isIntersecting:()=>dt,isHigherOrEqual:()=>_e,isHigher:()=>ge,isBrowserWindow:()=>re,isAbortError:()=>gt,interval:()=>Me,interpolate:()=>mt,getWindow:()=>T,getVideoQualityLabel:()=>Te,getTraceSubscriptionMethod:()=>bt,getRangeAroundIndex:()=>ht,getPlayerId:()=>pt,getMessageFromError:()=>vt,getHighestQuality:()=>ye,getExponentialDelay:()=>ce,fromEvent:()=>Fe,flattenObject:()=>U,filterChanged:()=>Ye,filter:()=>Ge,fillWithDefault:()=>Ee,fetchPolyfilled:()=>en,devNull:()=>Ft,detectEmbed:()=>j,debounceFn:()=>I,debounce:()=>Be,createDIContainer:()=>Gt,combine:()=>ke,cloneDeepWith:()=>R,cloneDeep:()=>Oe,clearVideoElement:()=>lt,checkNever:()=>m,cancelIdleCallbackPolyfilled:()=>un,buffer:()=>Le,assertQualityIsExact:()=>we,assertNullable:()=>ee,assertNotEmptyArray:()=>te,assertNonNullable:()=>x,assertNever:()=>p,assertEmptyArray:()=>ne,areQualitiesExact:()=>Ce,addScript:()=>ie,abortable:()=>se,VideoQuality:()=>he,ValueSubject:()=>B,VKNumericLanguage:()=>Ot,VERSION:()=>d,TracerFactory:()=>Et,SubscriptionRemovable:()=>Ie,Subscription:()=>f,Subject:()=>y,RequestPolyfilled:()=>tn,ReplaySubject:()=>z,Observable:()=>v,Logger:()=>b,InternalsExposure:()=>Pt,InterfaceLanguage:()=>Nt,InjectionToken:()=>Wt,INTERNAL_EXPOSE_GLOBAL_KEY:()=>q,ErrorCategory:()=>Dt,CircularBuffer:()=>yt,AppTracer:()=>Y,AbortSignalPolyfilled:()=>rn,AbortControllerPolyfilled:()=>nn}),module.exports=a(u);var d=`1.0.95-dev.02230ed18.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},_=e=>{console.error(e)};class v{suppressErrors=!1;constructor(e){e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?_: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 y extends v{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 b{log$=new y;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 x(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 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},E={};l(E,{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=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)}},he;(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`})(he||={});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],P=Object.keys(M).sort((e,t)=>N(e,t)?-1:1),be=(e,t=.02)=>[...P].find(n=>M[n].height*(1+t)>=e),xe=({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})},Se=e=>M[e].height,F=e=>e===`Invariant quality`,Ce=e=>e.every(e=>!F(e));function we(e){if(F(e))throw Error(`Expected exact quality`)}var Te=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``}},Ee=(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]=Ee(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 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 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 _(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 ee(){s!==void 0&&g(s),l=0,r=c=i=s=void 0}function S(){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=ee,w.flush=S,w.pending=C,w}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},Oe=e=>R(e);class z extends y{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 B extends y{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 ke(e){return new v(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 Ae(...e){return new v(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new f))}var je=e=>new v(t=>{let n=T().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>T().clearTimeout(n)}),Me=e=>new v(t=>{let n=T(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function Ne(e){return new v(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 Pe=Ne,Fe=(e,t)=>new v(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Ie extends f{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Le(e){return t=>new v(n=>t.subscribe(new Re(n,e)))}class Re{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 ze={leading:!1,trailing:!0};function Be(e,t=ze){return n=>new v(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;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 He={leading:!0,trailing:!1};function Ue(e,t=He){return n=>new v(r=>n.subscribe(new We(r,e,t)))}class We{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 Ge(e){return t=>new v(n=>t.subscribe(new Ke(n,e)))}class Ke{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 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 v(n=>t.subscribe(new Xe(n,e)))}var V={};class Xe{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 v(n=>t.subscribe(new Ze(n,e)))}class Ze{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 Qe(e){return H(()=>e)}function $e(){return e=>new v(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 et(){return e=>new v(t=>e.subscribe(new tt(t)))}class tt{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 nt(e){return t=>new v(n=>t.subscribe(new rt(n,e)))}class rt{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 it(e){return t=>new v(n=>t.subscribe(new at(n,e)))}class at{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 ot(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 v(e=>(n++,a(r.subscribe(e))))}}var st=300,ct=(e,t=st)=>new v(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(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),S(r)&&S(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},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 gt=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),_t=e=>{if(!gt(e))throw e};function vt(e){if(e&&typeof e==`object`){if(`message`in e)return String(e.message);try{return JSON.stringify(e)}catch{return`object serialization error`}}return String(e)}class yt{buffer;writeIndex=0;count=0;capacity;constructor(e){if(e<=0)throw Error(`Capacity must be greater than 0`);this.capacity=e,this.buffer=Array.from({length:e}).fill(null)}add(e){this.buffer[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.count<this.capacity&&this.count++}*[Symbol.iterator](){if(this.count===0)return;let e=this.count<this.capacity?0:this.writeIndex;for(let t=0;t<this.count;t++){let t=this.buffer[e];S(t)&&(yield t),e=(e+1)%this.capacity}}clear(){this.buffer.fill(null),this.writeIndex=0,this.count=0}get size(){return this.count}get maxCapacity(){return this.capacity}}var bt=e=>(t,n=!1)=>r=>{let i=typeof r==`object`;r==null||i&&!Object.keys(r).length||e(t,i?U(r):{value:r},n)},W=(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 G{dynamicImportTimeout=5e3;subscription=new f;span;context;childTracers=[];initPromise;getRootTracerContext;eventsBuffer=null;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t,getRootTracerContext:n,eventsBufferSize:r}){S(r)&&r>0&&(this.eventsBuffer=new yt(r)),G.dynamicImportStatus===`not_started`&&(G.dynamicImportPromise=this.loadOpentelemetry());let i=Date.now();this.initPromise=G.dynamicImportPromise.then(r=>{G.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t,getRootTracerContext:n},i)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(C(i))return;let{opentelemetryApi:a}=G.dynamicImports,{context:o,trace:s}=a,{tracer:c,attributes$:l}=i;this.span=c.startSpan(e,{startTime:r},t?.()),this.context=s.setSpan(o.active(),this.span),this.getRootTracerContext=n,this.subscription.add(l.subscribe(e=>{S(e)&&this.span.setAttributes(e)}))}async loadOpentelemetry(){if(G.dynamicImportStatus===`not_started`){G.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]);G.dynamicImports={opentelemetryApi:n,opentelemetrySdk:r,tracer:i,opentelemetryResources:a,opentelemetrySemanticConventions:o},G.dynamicImportStatus=`completed`}catch{G.dynamicImportStatus=`failed`}}}isComponentTracerNotInitialized(){return C(this.span)||G.dynamicImportStatus===`failed`}addEventToBuffer(e,t,n,r){S(this.eventsBuffer)&&this.eventsBuffer.add({name:e,attributes:t,type:n,timestamp:r})}addEventToSpan(e,t,n,r){this.span.addEvent(e,{...W(t),type:n},r)}log(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`log`,r)}):this.addEventToBuffer(e,t,`log`,r)}error(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`error`,r)}):this.addEventToBuffer(e,t,`error`,r)}critical(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`critical`,r)}):this.addEventToBuffer(e,t,`critical`,r)}createComponentTracer(e){let t=new G({name:e,getParentContext:()=>this.context,getRootTracerContext:()=>this.getRootTracerContext?.(),eventsBufferSize:this.eventsBuffer?.maxCapacity});return this.childTracers.push(t),t}setSpanAttributes(e){this.span.setAttributes(W(e))}end(){this.initPromise.then(e=>{if(!this.isComponentTracerNotInitialized()){if(S(this.eventsBuffer))for(let e of this.eventsBuffer)this.addEventToSpan(e.name,e.attributes,e.type,e.timestamp);this.childTracers.forEach(e=>e.end()),this.span.end(),this.subscription.unsubscribe()}})}}var xt=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`;class St extends G{attributes$=new B(null);constructor(e){super({name:`Root`,eventsBufferSize:e})}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=G.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:xt}))]});f.register();let p=f.getTracer(`sdk-videoplayer-tracer`);super.init({name:e,getParentContext:t,getRootTracerContext:()=>({tracer:p,attributes$:this.attributes$})},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}setSpanAttributes(e){this.attributes$.next({...this.attributes$.getValue(),...W(e)})}addSubscription(e){this.subscription.add(e)}}class Ct{fakeTraceId;constructor(e){}log(e,t,n){}error(e,t,n){}critical(e,t,n){}createComponentTracer(e){return new Ct({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}}var wt=()=>!0,K={level:0,filter:wt,name:`Noname Tracer`,outputMethod:`log`};class Tt{name;filter=wt;level=K.level;outputMethod=K.outputMethod;childTracers=[];constructor({name:e,level:t,filter:n,outputMethod:r}={}){this.filter=n??this.filter,this.level=t??this.level,this.outputMethod=r??this.outputMethod,this.name=e??K.name}log(e,t,n){this.logDebug(e,t)}error(e,t,n){this.logError(e,t)}critical(e,t,n){this.logError(e,t)}createComponentTracer(e){let t=new Tt({filter:this.filter,level:this.level,name:`${this.name}/ ${e}`,outputMethod:this.outputMethod});return this.childTracers.push(t),t}end(){this.childTracers.forEach(e=>e.end()),this.childTracers=[]}setLevel(e){this.level=e,this.childTracers.forEach(t=>t.setLevel(e))}setOtputMethod(e){this.outputMethod=e,this.childTracers.forEach(t=>t.setOtputMethod(e))}setFilter(e){this.filter=e,this.childTracers.forEach(t=>t.setFilter(e))}getFinishedSpans(){}getTraceId(){return`debug_trace`}get verbose(){return this.level===0}createMessage(e,t){return[this.name,e,JSON.stringify(t)].join(`: `)}logDebug(e,t){!this.verbose||!this.filter(e,t)||T().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&T().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}}class Et{static createRootTracer(e=`fake`,t){switch(e){case`real`:return new St(t);case`debug`:return new Tt;default:return new Ct}}}var Dt;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.UI=`ui`,e.CALL_FROM_EXTERNAL=`call_from_external`,e.FATAL=`fatal`})(Dt||={});var Ot;(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`})(Ot||={});var kt=`vk.com`,At=async(e,t,n)=>{let r=new URL(`https://${kt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),jt(await(await fetch(r.toString())).json(),n)},jt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),Mt(n)])),Mt=e=>Array.isArray(e)?e[0]:e,Nt;(e=>{e.RU=`ru`,e.EN=`en`})(Nt||={});var q=`__vk_vp_internals_exposure`;class Pt{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 Ft={};l(Ft,{subscribe:()=>zt,push:()=>Rt,destroy:()=>Lt,create:()=>It});var J=new Map,It=(e,t)=>J.set(e,t??[]),Lt=e=>J.delete(e),Rt=(e,t)=>{let n=J.get(e);n&&(typeof n==`function`?n(t):n.push(t))},zt=(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)}},Bt=e=>w({id:e.id,message:e.message,category:e.category,data:Vt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Vt(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Ht=e=>{let t=e.thrown instanceof Error?e.thrown:Error(e.message),n=e.id.length>10240?e.id.substring(0,10240):e.id;try{t.name=n}catch{t=Error(e.message),t.name=n}return t},Ut=()=>{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 Y{static tracerErrorMap=new Map;static appTracerModule=null;static loadPromise=null;dynamicImportTimeout=5e3;componentName;subscription=new f;options;envParams;context;isEmbed;embedParent;beforeInitErrors=[];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 n=Y.tracerErrorMap.get(this.componentName);if(!n){this.beforeInitErrors.push([e,t]);return}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))try{let r=Ht(e);n?.error(r,{crashIdSource:r.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...Bt(e),...Ut(),...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 Y.loadPromise,Y.tracerErrorMap.has(this.componentName)||C(Y.appTracerModule))return;let{appTracerModule:e}=Y,{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:xt,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),Y.tracerErrorMap.set(this.componentName,o),this.beforeInitErrors.forEach(e=>this.error.apply(this,e)),this.beforeInitErrors=[]}catch(e){console.error(e)}}loadModule(){S(Y.loadPromise)||(Y.loadPromise=(async()=>{try{let e=new Promise((e,t)=>T().setTimeout(t,this.dynamicImportTimeout));Y.appTracerModule=await Promise.race([e,import(`@apptracer/sdk/lite`)])}catch(e){Y.loadPromise=null,console.error(e)}})())}}class Wt{options;symbol;constructor(e,t){this.options=t,this.symbol=Symbol(e)}}var Gt=()=>{let e=new Map,t=new Map,n=new Map,r=new Map,i=new Set;return{resolve(e){if(!r.has(e)){let t=n.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);r.set(e,new t)}return r.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){r.forEach((t,n)=>{t instanceof e&&r.delete(n)}),n.set(e,t)},getToken(n){if(e.has(n.symbol))return e.get(n.symbol);if(t.has(n.symbol)){let r=t.get(n.symbol)();return e.set(n.symbol,r),r}if(n.options?.factory){let t=n.options.factory();return e.set(n.symbol,t),t}throw Error(`No value registered in DI container for token "${n.symbol.description}"`)},registerToken(t,n){e.set(t.symbol,n)},registerFactory(e,n){t.set(e.symbol,n)},hasToken(n){return e.has(n.symbol)||t.has(n.symbol)||!!n.options?.factory},registerCleanup(e){i.add(e)},clear(){i.forEach(e=>e()),i.clear(),e.clear(),t.clear(),r.clear(),n.clear()}}},{NativeAbortSignal:Kt,NativeAbortController:qt}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function Jt(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 Yt(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 Xt{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 Xt{constructor(){super(),this.listeners||Xt.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=Yt(e),n=Jt(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 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 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(!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 Q=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window,$=`fetch`in Q&&Zt({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}),$t=$?Qt({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,en=$?$t.fetch:Q.fetch,tn=$?$t.Request:Q.Request,nn=$?Z:Q.AbortController,rn=$?X:Q.AbortSignal,an=(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)},on=e=>Q.clearTimeout(e),sn=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),cn=!sn(Q.requestIdleCallback)||!sn(Q.cancelIdleCallback),ln=cn?an:Q.requestIdleCallback,un=cn?on:Q.cancelIdleCallback,dn=(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:()=>C,videoSizeToQuality:()=>be,videoQualityToHeight:()=>xe,videoHeightToQuality:()=>ye,urlCanParsePolyfilled:()=>fn,timeout:()=>je,timeCodeToString:()=>Te,throttleFn:()=>z,throttle:()=>We,tap:()=>at,suppressAbort:()=>bt,skip:()=>st,shareReplay:()=>lt,safeStorage:()=>ce,requestIdleCallbackPolyfilled:()=>un,pairwise:()=>rt,once:()=>nt,observeElementSize:()=>dt,observableFrom:()=>Pe,nowInt:()=>ae,now:()=>E,noop:()=>h,merge:()=>Ae,mapTo:()=>tt,map:()=>$e,loadVKLangPack:()=>Nt,isValidURL:()=>pt,isNullable:()=>S,isNonNullable:()=>x,isLowerOrEqual:()=>_e,isLower:()=>P,isInvariantQuality:()=>I,isIntersecting:()=>mt,isHigherOrEqual:()=>ge,isHigher:()=>he,isBrowserWindow:()=>T,isAbortError:()=>yt,interval:()=>Me,interpolate:()=>_t,getWindow:()=>w,getVideoQualityLabel:()=>we,getTraceSubscriptionMethod:()=>Ct,getRangeAroundIndex:()=>vt,getPlayerId:()=>gt,getMessageFromError:()=>xt,getHighestQuality:()=>ve,getExponentialDelay:()=>se,fromEvent:()=>Fe,flattenObject:()=>V,filterChanged:()=>Xe,filter:()=>Ke,fillWithDefault:()=>L,fetchPolyfilled:()=>nn,devNull:()=>Rt,detectEmbed:()=>j,debounceFn:()=>R,debounce:()=>Ve,createDIContainer:()=>Jt,combineLatest:()=>Le,combine:()=>ke,cloneDeepWith:()=>B,cloneDeep:()=>Ee,clearVideoElement:()=>ft,checkNever:()=>m,cancelIdleCallbackPolyfilled:()=>dn,buffer:()=>Re,assertQualityIsExact:()=>Ce,assertNullable:()=>te,assertNotEmptyArray:()=>ne,assertNonNullable:()=>b,assertNever:()=>p,assertEmptyArray:()=>re,areQualitiesExact:()=>Se,addScript:()=>ie,abortable:()=>oe,VideoQuality:()=>M,ValueSubject:()=>Oe,VKNumericLanguage:()=>jt,VERSION:()=>d,TracerFactory:()=>kt,SubscriptionRemovable:()=>Ie,Subscription:()=>f,Subject:()=>v,RequestPolyfilled:()=>rn,ReplaySubject:()=>De,Observable:()=>_,Logger:()=>y,InternalsExposure:()=>Lt,InterfaceLanguage:()=>It,InjectionToken:()=>qt,INTERNAL_EXPOSE_GLOBAL_KEY:()=>G,ErrorCategory:()=>At,CircularBuffer:()=>St,AppTracer:()=>q,AbortSignalPolyfilled:()=>on,AbortControllerPolyfilled:()=>an}),module.exports=a(u);var d=`1.0.95-dev.1022d4dbd.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 De 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 Oe 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 ke(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 Ae(...e){return new _(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new f))}var je=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)}),Me=e=>new _(t=>{let n=w(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function Ne(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 Pe=Ne,Fe=(e,t)=>new _(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Ie extends f{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Le(e){return new _(t=>{let n=Array(e.length),r=e=>r=>{n[e]=r,t.next([...n])};return e.reduce((e,t,n)=>e.add(t.subscribe(r(n))),new f)})}function Re(e){return t=>new _(n=>t.subscribe(new ze(n,e)))}class ze{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 Be={leading:!1,trailing:!0};function Ve(e,t=Be){return n=>new _(r=>n.subscribe(new He(r,e,t)))}class He{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 Ue={leading:!0,trailing:!1};function We(e,t=Ue){return n=>new _(r=>n.subscribe(new Ge(r,e,t)))}class Ge{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,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 Ke(e){return t=>new _(n=>t.subscribe(new qe(n,e)))}class qe{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 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 _(n=>t.subscribe(new Qe(n,e)))}var Ze={};class Qe{destination;predicate;lastValue=Ze;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===Ze||!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 $e(e){return t=>new _(n=>t.subscribe(new et(n,e)))}class et{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 tt(e){return $e(()=>e)}function nt(){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 rt(){return e=>new _(t=>e.subscribe(new it(t)))}class it{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 at(e){return t=>new _(n=>t.subscribe(new ot(n,e)))}class ot{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 st(e){return t=>new _(n=>t.subscribe(new ct(n,e)))}class ct{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 lt(e=0){return t=>{let n=0,r=new De(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new _(e=>(n++,a(r.subscribe(e))))}}var ut=300,dt=(e,t=ut)=>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()}),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},ft=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},pt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},mt=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),ht=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),gt=e=>e!==void 0&&e!==``?e:ht().toString();function _t(e,t,n){if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];let r=1;for(;r<t.length&&t[r]<e;)r++;r>=t.length&&(r=t.length-1);let i=t[r-1],a=t[r],o=n[r-1],s=n[r];return e===i?o:e===a?s:o+(e-i)/(a-i)*(s-o)}function vt(e,t,n){if(e<=0||n<0)return[];let r=[],i=Math.floor((e-1)/2),a=Math.floor(e/2),o=t-i,s=t+a;o<0&&(s+=Math.abs(o),o=0),s>n&&(o-=s-n,s=n),o=Math.max(0,o),s=Math.min(n,s);for(let e=o;e<=s;e++)r.push(e);return r}var yt=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),bt=e=>{if(!yt(e))throw e};function xt(e){if(e&&typeof e==`object`){if(`message`in e)return String(e.message);try{return JSON.stringify(e)}catch{return`object serialization error`}}return String(e)}class St{buffer;writeIndex=0;count=0;capacity;constructor(e){if(e<=0)throw Error(`Capacity must be greater than 0`);this.capacity=e,this.buffer=Array.from({length:e}).fill(null)}add(e){this.buffer[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.count<this.capacity&&this.count++}*[Symbol.iterator](){if(this.count===0)return;let e=this.count<this.capacity?0:this.writeIndex;for(let t=0;t<this.count;t++){let t=this.buffer[e];x(t)&&(yield t),e=(e+1)%this.capacity}}clear(){this.buffer.fill(null),this.writeIndex=0,this.count=0}get size(){return this.count}get maxCapacity(){return this.capacity}}var Ct=e=>(t,n=!1)=>r=>{let i=typeof r==`object`;r==null||i&&!Object.keys(r).length||e(t,i?V(r):{value:r},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;subscription=new f;span;context;childTracers=[];initPromise;getRootTracerContext;eventsBuffer=null;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t,getRootTracerContext:n,eventsBufferSize:r}){x(r)&&r>0&&(this.eventsBuffer=new St(r)),U.dynamicImportStatus===`not_started`&&(U.dynamicImportPromise=this.loadOpentelemetry());let i=Date.now();this.initPromise=U.dynamicImportPromise.then(r=>{U.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t,getRootTracerContext:n},i)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(S(i))return;let{opentelemetryApi:a}=U.dynamicImports,{context:o,trace:s}=a,{tracer:c,attributes$:l}=i;this.span=c.startSpan(e,{startTime:r},t?.()),this.context=s.setSpan(o.active(),this.span),this.getRootTracerContext=n,this.subscription.add(l.subscribe(e=>{x(e)&&this.span.setAttributes(e)}))}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 S(this.span)||U.dynamicImportStatus===`failed`}addEventToBuffer(e,t,n,r){x(this.eventsBuffer)&&this.eventsBuffer.add({name:e,attributes:t,type:n,timestamp:r})}addEventToSpan(e,t,n,r){this.span.addEvent(e,{...H(t),type:n},r)}log(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`log`,r)}):this.addEventToBuffer(e,t,`log`,r)}error(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`error`,r)}):this.addEventToBuffer(e,t,`error`,r)}critical(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`critical`,r)}):this.addEventToBuffer(e,t,`critical`,r)}createComponentTracer(e){let t=new U({name:e,getParentContext:()=>this.context,getRootTracerContext:()=>this.getRootTracerContext?.(),eventsBufferSize:this.eventsBuffer?.maxCapacity});return this.childTracers.push(t),t}setSpanAttributes(e){this.span.setAttributes(H(e))}end(){this.initPromise.then(e=>{if(!this.isComponentTracerNotInitialized()){if(x(this.eventsBuffer))for(let e of this.eventsBuffer)this.addEventToSpan(e.name,e.attributes,e.type,e.timestamp);this.childTracers.forEach(e=>e.end()),this.span.end(),this.subscription.unsubscribe()}})}}var wt=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`;class Tt extends U{attributes$=new Oe(null);constructor(e){super({name:`Root`,eventsBufferSize:e})}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:wt}))]});f.register();let p=f.getTracer(`sdk-videoplayer-tracer`);super.init({name:e,getParentContext:t,getRootTracerContext:()=>({tracer:p,attributes$:this.attributes$})},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}setSpanAttributes(e){this.attributes$.next({...this.attributes$.getValue(),...H(e)})}addSubscription(e){this.subscription.add(e)}}class Et{fakeTraceId;constructor(e){}log(e,t,n){}error(e,t,n){}critical(e,t,n){}createComponentTracer(e){return new Et({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}}var Dt=()=>!0,W={level:0,filter:Dt,name:`Noname Tracer`,outputMethod:`log`};class Ot{name;filter=Dt;level=W.level;outputMethod=W.outputMethod;childTracers=[];constructor({name:e,level:t,filter:n,outputMethod:r}={}){this.filter=n??this.filter,this.level=t??this.level,this.outputMethod=r??this.outputMethod,this.name=e??W.name}log(e,t,n){this.logDebug(e,t)}error(e,t,n){this.logError(e,t)}critical(e,t,n){this.logError(e,t)}createComponentTracer(e){let t=new Ot({filter:this.filter,level:this.level,name:`${this.name}/ ${e}`,outputMethod:this.outputMethod});return this.childTracers.push(t),t}end(){this.childTracers.forEach(e=>e.end()),this.childTracers=[]}setLevel(e){this.level=e,this.childTracers.forEach(t=>t.setLevel(e))}setOtputMethod(e){this.outputMethod=e,this.childTracers.forEach(t=>t.setOtputMethod(e))}setFilter(e){this.filter=e,this.childTracers.forEach(t=>t.setFilter(e))}getFinishedSpans(){}getTraceId(){return`debug_trace`}get verbose(){return this.level===0}createMessage(e,t){return[this.name,e,JSON.stringify(t)].join(`: `)}logDebug(e,t){!this.verbose||!this.filter(e,t)||w().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&w().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}}class kt{static createRootTracer(e=`fake`,t){switch(e){case`real`:return new Tt(t);case`debug`:return new Ot;default:return new Et}}}var At;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.UI=`ui`,e.CALL_FROM_EXTERNAL=`call_from_external`,e.FATAL=`fatal`})(At||={});var jt;(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`})(jt||={});var Mt=`vk.com`,Nt=async(e,t,n)=>{let r=new URL(`https://${Mt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),Pt(await(await fetch(r.toString())).json(),n)},Pt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),Ft(n)])),Ft=e=>Array.isArray(e)?e[0]:e,It;(e=>{e.RU=`ru`,e.EN=`en`})(It||={});var G=`__vk_vp_internals_exposure`;class Lt{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 Rt={};l(Rt,{subscribe:()=>Ht,push:()=>Vt,destroy:()=>Bt,create:()=>zt});var K=new Map,zt=(e,t)=>K.set(e,t??[]),Bt=e=>K.delete(e),Vt=(e,t)=>{let n=K.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Ht=(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)}},Ut=e=>C({id:e.id,message:e.message,category:e.category,data:Wt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Wt(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Gt=e=>{let t=e.thrown instanceof Error?e.thrown:Error(e.message),n=e.id.length>10240?e.id.substring(0,10240):e.id;try{t.name=n}catch{t=Error(e.message),t.name=n}return t},Kt=()=>{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;beforeInitErrors=[];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 n=q.tracerErrorMap.get(this.componentName);if(!n){this.beforeInitErrors.push([e,t]);return}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))try{let r=Gt(e);n?.error(r,{crashIdSource:r.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...Ut(e),...Kt(),...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:wt,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),q.tracerErrorMap.set(this.componentName,o),this.beforeInitErrors.forEach(e=>this.error.apply(this,e)),this.beforeInitErrors=[]}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)}})())}}class qt{options;symbol;constructor(e,t){this.options=t,this.symbol=Symbol(e)}}var Jt=()=>{let e=new Map,t=new Map,n=new Map,r=new Map,i=new Set;return{resolve(e){if(!r.has(e)){let t=n.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);r.set(e,new t)}return r.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){r.forEach((t,n)=>{t instanceof e&&r.delete(n)}),n.set(e,t)},getToken(n){if(e.has(n.symbol))return e.get(n.symbol);if(t.has(n.symbol)){let r=t.get(n.symbol)();return e.set(n.symbol,r),r}if(n.options?.factory){let t=n.options.factory();return e.set(n.symbol,t),t}throw Error(`No value registered in DI container for token "${n.symbol.description}"`)},registerToken(t,n){e.set(t.symbol,n)},registerFactory(e,n){t.set(e.symbol,n)},hasToken(n){return e.has(n.symbol)||t.has(n.symbol)||!!n.options?.factory},registerCleanup(e){i.add(e)},clear(){i.forEach(e=>e()),i.clear(),e.clear(),t.clear(),r.clear(),n.clear()}}},{NativeAbortSignal:Yt,NativeAbortController:Xt}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function Zt(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 Qt(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 J{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 J{constructor(){super(),this.listeners||J.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=Qt(e),n=Zt(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 $t(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 en(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!$t({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&&$t({fetch:Z.fetch,Request:Z.Request,AbortController:Z.AbortController}),tn=Q?en({fetch:Z.fetch,Request:Z.Request,AbortController:Z.AbortController}):void 0,nn=Q?tn.fetch:Z.fetch,rn=Q?tn.Request:Z.Request,an=Q?X:Z.AbortController,on=Q?Y:Z.AbortSignal,sn=(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)},cn=e=>Z.clearTimeout(e),ln=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),$=!ln(Z.requestIdleCallback)||!ln(Z.cancelIdleCallback),un=$?sn:Z.requestIdleCallback,dn=$?cn:Z.cancelIdleCallback,fn=(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.95-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.95-dev.1022d4dbd.0
|
|
3
|
+
* Tue, 14 Jul 2026 18:23:25 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-95/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.95-dev.02230ed18.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)}},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 xe(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 Se=(e,t=0,n)=>xe(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 L extends f{value;constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let t=super._subscribe(e);return e.next(this.value),t}}function Te(e){return new d(t=>{let n={},r=Object.keys(e).length,i=e=>i=>{e in n||r--,n[e]=i,r===0&&t.next(n)};return Object.entries(e).reduce((e,[t,n])=>e.add(n.subscribe(i(t))),new a)})}function Ee(...e){return new d(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new a))}var De=e=>new d(t=>{let n=x().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>x().clearTimeout(n)}),Oe=e=>new d(t=>{let n=x(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function ke(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 Ae=ke,je=(e,t)=>new d(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Me extends a{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Ne(e){return t=>new d(n=>t.subscribe(new Pe(n,e)))}class Pe{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 Fe={leading:!1,trailing:!0};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;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 Re={leading:!0,trailing:!1};function ze(e,t=Re){return n=>new d(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,_(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 Ve(e){return t=>new d(n=>t.subscribe(new He(n,e)))}class He{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 Ue=(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)},We=(e,t)=>e instanceof Object&&t instanceof Object?Ue(e,t):e===t;function Ge(e=We){return t=>new d(n=>t.subscribe(new Ke(n,e)))}var R={};class Ke{destination;predicate;lastValue=R;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===R||!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 z(e){return t=>new d(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 Je(e){return z(()=>e)}function Ye(){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 Xe(){return e=>new d(t=>e.subscribe(new Ze(t)))}class Ze{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 Qe(e){return t=>new d(n=>t.subscribe(new $e(n,e)))}class $e{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 et(e){return t=>new d(n=>t.subscribe(new tt(n,e)))}class tt{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 nt(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 rt=300,it=(e,t=rt)=>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()}),B=(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=B(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},at=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},ot=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},st=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),ct=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),lt=e=>e!==void 0&&e!==``?e:ct().toString();function ut(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 dt(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 V=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),ft=e=>{if(!V(e))throw e};function pt(e){if(e&&typeof e==`object`){if(`message`in e)return String(e.message);try{return JSON.stringify(e)}catch{return`object serialization error`}}return String(e)}class H{buffer;writeIndex=0;count=0;capacity;constructor(e){if(e<=0)throw Error(`Capacity must be greater than 0`);this.capacity=e,this.buffer=Array.from({length:e}).fill(null)}add(e){this.buffer[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.count<this.capacity&&this.count++}*[Symbol.iterator](){if(this.count===0)return;let e=this.count<this.capacity?0:this.writeIndex;for(let t=0;t<this.count;t++){let t=this.buffer[e];g(t)&&(yield t),e=(e+1)%this.capacity}}clear(){this.buffer.fill(null),this.writeIndex=0,this.count=0}get size(){return this.count}get maxCapacity(){return this.capacity}}var mt=e=>(t,n=!1)=>r=>{let i=typeof r==`object`;r==null||i&&!Object.keys(r).length||e(t,i?B(r):{value:r},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;subscription=new a;span;context;childTracers=[];initPromise;getRootTracerContext;eventsBuffer=null;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t,getRootTracerContext:n,eventsBufferSize:r}){g(r)&&r>0&&(this.eventsBuffer=new H(r)),W.dynamicImportStatus===`not_started`&&(W.dynamicImportPromise=this.loadOpentelemetry());let i=Date.now();this.initPromise=W.dynamicImportPromise.then(r=>{W.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t,getRootTracerContext:n},i)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(_(i))return;let{opentelemetryApi:a}=W.dynamicImports,{context:o,trace:s}=a,{tracer:c,attributes$:l}=i;this.span=c.startSpan(e,{startTime:r},t?.()),this.context=s.setSpan(o.active(),this.span),this.getRootTracerContext=n,this.subscription.add(l.subscribe(e=>{g(e)&&this.span.setAttributes(e)}))}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`}addEventToBuffer(e,t,n,r){g(this.eventsBuffer)&&this.eventsBuffer.add({name:e,attributes:t,type:n,timestamp:r})}addEventToSpan(e,t,n,r){this.span.addEvent(e,{...U(t),type:n},r)}log(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`log`,r)}):this.addEventToBuffer(e,t,`log`,r)}error(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`error`,r)}):this.addEventToBuffer(e,t,`error`,r)}critical(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`critical`,r)}):this.addEventToBuffer(e,t,`critical`,r)}createComponentTracer(e){let t=new W({name:e,getParentContext:()=>this.context,getRootTracerContext:()=>this.getRootTracerContext?.(),eventsBufferSize:this.eventsBuffer?.maxCapacity});return this.childTracers.push(t),t}setSpanAttributes(e){this.span.setAttributes(U(e))}end(){this.initPromise.then(e=>{if(!this.isComponentTracerNotInitialized()){if(g(this.eventsBuffer))for(let e of this.eventsBuffer)this.addEventToSpan(e.name,e.attributes,e.type,e.timestamp);this.childTracers.forEach(e=>e.end()),this.span.end(),this.subscription.unsubscribe()}})}}var ht=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`;class gt extends W{attributes$=new L(null);constructor(e){super({name:`Root`,eventsBufferSize:e})}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:ht}))]});f.register();let p=f.getTracer(`sdk-videoplayer-tracer`);super.init({name:e,getParentContext:t,getRootTracerContext:()=>({tracer:p,attributes$:this.attributes$})},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}setSpanAttributes(e){this.attributes$.next({...this.attributes$.getValue(),...U(e)})}addSubscription(e){this.subscription.add(e)}}class _t{fakeTraceId;constructor(e){}log(e,t,n){}error(e,t,n){}critical(e,t,n){}createComponentTracer(e){return new _t({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}}var vt=()=>!0,G={level:0,filter:vt,name:`Noname Tracer`,outputMethod:`log`};class yt{name;filter=vt;level=G.level;outputMethod=G.outputMethod;childTracers=[];constructor({name:e,level:t,filter:n,outputMethod:r}={}){this.filter=n??this.filter,this.level=t??this.level,this.outputMethod=r??this.outputMethod,this.name=e??G.name}log(e,t,n){this.logDebug(e,t)}error(e,t,n){this.logError(e,t)}critical(e,t,n){this.logError(e,t)}createComponentTracer(e){let t=new yt({filter:this.filter,level:this.level,name:`${this.name}/ ${e}`,outputMethod:this.outputMethod});return this.childTracers.push(t),t}end(){this.childTracers.forEach(e=>e.end()),this.childTracers=[]}setLevel(e){this.level=e,this.childTracers.forEach(t=>t.setLevel(e))}setOtputMethod(e){this.outputMethod=e,this.childTracers.forEach(t=>t.setOtputMethod(e))}setFilter(e){this.filter=e,this.childTracers.forEach(t=>t.setFilter(e))}getFinishedSpans(){}getTraceId(){return`debug_trace`}get verbose(){return this.level===0}createMessage(e,t){return[this.name,e,JSON.stringify(t)].join(`: `)}logDebug(e,t){!this.verbose||!this.filter(e,t)||x().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&x().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}}class bt{static createRootTracer(e=`fake`,t){switch(e){case`real`:return new gt(t);case`debug`:return new yt;default:return new _t}}}var xt;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.UI=`ui`,e.CALL_FROM_EXTERNAL=`call_from_external`,e.FATAL=`fatal`})(xt||={});var St;(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`})(St||={});var Ct=`vk.com`,wt=async(e,t,n)=>{let r=new URL(`https://${Ct}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),Tt(await(await fetch(r.toString())).json(),n)},Tt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),Et(n)])),Et=e=>Array.isArray(e)?e[0]:e,Dt;(e=>{e.RU=`ru`,e.EN=`en`})(Dt||={});var K=`__vk_vp_internals_exposure`;class Ot{playerId;type;constructor(e,t){this.playerId=t,this.type=e,this.initWindowObjects()}getWindowObject(){if(typeof window>`u`)return{};let e=this.playerId,t=this.type;return window[K]?.[e]?.[t]??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[K]||(window[K]={}),window[K][e]||(window[K][e]={}),window[K][e][t]||(window[K][e][t]={})}expose(e){typeof window>`u`||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[K]&&window[K][e]&&window[K][e][t]&&(delete window[K][e][t],Object.keys(window[K][e]).length||delete window[K][e],Object.keys(window[K]).length||delete window[K])}}var kt={};r(kt,{subscribe:()=>Nt,push:()=>Mt,destroy:()=>jt,create:()=>At});var q=new Map,At=(e,t)=>q.set(e,t??[]),jt=e=>q.delete(e),Mt=(e,t)=>{let n=q.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Nt=(e,t)=>{let n=q.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);q.set(e,t)}},Pt=e=>v({id:e.id,message:e.message,category:e.category,data:Ft(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Ft(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var It=e=>{let t=e.thrown instanceof Error?e.thrown:Error(e.message),n=e.id.length>10240?e.id.substring(0,10240):e.id;try{t.name=n}catch{t=Error(e.message),t.name=n}return t},Lt=()=>{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 J{static tracerErrorMap=new Map;static appTracerModule=null;static loadPromise=null;dynamicImportTimeout=5e3;componentName;subscription=new a;options;envParams;context;isEmbed;embedParent;beforeInitErrors=[];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 n=J.tracerErrorMap.get(this.componentName);if(!n){this.beforeInitErrors.push([e,t]);return}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))try{let r=It(e);n?.error(r,{crashIdSource:r.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...Pt(e),...Lt(),...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 J.loadPromise,J.tracerErrorMap.has(this.componentName)||_(J.appTracerModule))return;let{appTracerModule:e}=J,{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:ht,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),J.tracerErrorMap.set(this.componentName,o),this.beforeInitErrors.forEach(e=>this.error.apply(this,e)),this.beforeInitErrors=[]}catch(e){console.error(e)}}loadModule(){g(J.loadPromise)||(J.loadPromise=(async()=>{try{let e=new Promise((e,t)=>x().setTimeout(t,this.dynamicImportTimeout));J.appTracerModule=await Promise.race([e,import(`@apptracer/sdk/lite`)])}catch(e){J.loadPromise=null,console.error(e)}})())}}class Rt{options;symbol;constructor(e,t){this.options=t,this.symbol=Symbol(e)}}var zt=()=>{let e=new Map,t=new Map,n=new Map,r=new Map,i=new Set;return{resolve(e){if(!r.has(e)){let t=n.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);r.set(e,new t)}return r.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){r.forEach((t,n)=>{t instanceof e&&r.delete(n)}),n.set(e,t)},getToken(n){if(e.has(n.symbol))return e.get(n.symbol);if(t.has(n.symbol)){let r=t.get(n.symbol)();return e.set(n.symbol,r),r}if(n.options?.factory){let t=n.options.factory();return e.set(n.symbol,t),t}throw Error(`No value registered in DI container for token "${n.symbol.description}"`)},registerToken(t,n){e.set(t.symbol,n)},registerFactory(e,n){t.set(e.symbol,n)},hasToken(n){return e.has(n.symbol)||t.has(n.symbol)||!!n.options?.factory},registerCleanup(e){i.add(e)},clear(){i.forEach(e=>e()),i.clear(),e.clear(),t.clear(),r.clear(),n.clear()}}},{NativeAbortSignal:Bt,NativeAbortController:Vt}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function Ht(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 Ut(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 Wt{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 Wt{constructor(){super(),this.listeners||Wt.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=Ut(e),n=Ht(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 Gt(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 Kt(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!Gt({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&&Gt({fetch:Z.fetch,Request:Z.Request,AbortController:Z.AbortController}),qt=Q?Kt({fetch:Z.fetch,Request:Z.Request,AbortController:Z.AbortController}):void 0,Jt=Q?qt.fetch:Z.fetch,Yt=Q?qt.Request:Z.Request,Xt=Q?X:Z.AbortController,Zt=Q?Y:Z.AbortSignal,Qt=(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)},$t=e=>Z.clearTimeout(e),en=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),$=!en(Z.requestIdleCallback)||!en(Z.cancelIdleCallback),tn=$?Qt:Z.requestIdleCallback,nn=$?$t:Z.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}};export{v as withoutNullable,he as videoSizeToQuality,ge as videoQualityToHeight,me as videoHeightToQuality,rn as urlCanParsePolyfilled,De as timeout,be as timeCodeToString,Se as throttleFn,ze as throttle,Qe as tap,ft as suppressAbort,et as skip,nt as shareReplay,ne as safeStorage,tn as requestIdleCallbackPolyfilled,Xe as pairwise,Ye as once,it as observeElementSize,Ae as observableFrom,w as nowInt,C as now,c as noop,Ee as merge,Je as mapTo,z as map,wt as loadVKLangPack,ot as isValidURL,_ as isNullable,g as isNonNullable,fe as isLowerOrEqual,M as isLower,P as isInvariantQuality,st as isIntersecting,de as isHigherOrEqual,ue as isHigher,S as isBrowserWindow,V as isAbortError,Oe as interval,ut as interpolate,x as getWindow,ye as getVideoQualityLabel,mt as getTraceSubscriptionMethod,dt as getRangeAroundIndex,lt as getPlayerId,pt as getMessageFromError,pe as getHighestQuality,te as getExponentialDelay,je as fromEvent,B as flattenObject,Ge as filterChanged,Ve as filter,F as fillWithDefault,Jt as fetchPolyfilled,kt as devNull,A as detectEmbed,xe as debounceFn,Ie as debounce,zt as createDIContainer,Te as combine,I as cloneDeepWith,Ce as cloneDeep,at as clearVideoElement,s as checkNever,nn as cancelIdleCallbackPolyfilled,Ne as buffer,ve as assertQualityIsExact,h as assertNullable,y as assertNotEmptyArray,m as assertNonNullable,o as assertNever,b as assertEmptyArray,_e as areQualitiesExact,ee as addScript,T as abortable,le as VideoQuality,L as ValueSubject,St as VKNumericLanguage,i as VERSION,bt as TracerFactory,Me as SubscriptionRemovable,a as Subscription,f as Subject,Yt as RequestPolyfilled,we as ReplaySubject,d as Observable,p as Logger,Ot as InternalsExposure,Dt as InterfaceLanguage,Rt as InjectionToken,K as INTERNAL_EXPOSE_GLOBAL_KEY,xt as ErrorCategory,H as CircularBuffer,J as AppTracer,Zt as AbortSignalPolyfilled,Xt 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.95-dev.1022d4dbd.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)}},le=()=>{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)}},ue;(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`})(ue||={});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}},de=(e,t)=>A[e].height>A[t].height,fe=(e,t)=>A[e].height>=A[t].height,j=(e,t)=>A[e].height<A[t].height,pe=(e,t)=>A[e].height<=A[t].height,me=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:j(e,t)?1:-1)[0],M=Object.keys(A).sort((e,t)=>j(e,t)?-1:1),he=(e,t=.02)=>[...M].find(n=>A[n].height*(1+t)>=e),ge=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return M.find(e=>{let t=A[e];return t.width>=r&&t.height>=n})},_e=e=>A[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 I=(e,t=0,n)=>F(e,t,{leading:!0,trailing:!0,...n,maxWait:t}),L=(e,t)=>{if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let r in e){if(typeof t==`function`){let i=t(e[r],r,e,n);if(i!==void 0){n[r]=i;continue}}typeof e[r]==`object`?n[r]=L(e[r],t):n[r]=e[r]}return n},Se=e=>L(e);class R 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 z 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 new d(t=>{let n=Array(e.length),r=e=>r=>{n[e]=r,t.next([...n])};return e.reduce((e,t,n)=>e.add(t.subscribe(r(n))),new a)})}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 Ge(n,e)))}var B={};class Ge{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 Ke(e){return t=>new d(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 Je(e){return Ke(()=>e)}function Ye(){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 Xe(){return e=>new d(t=>e.subscribe(new Ze(t)))}class Ze{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 Qe(e){return t=>new d(n=>t.subscribe(new $e(n,e)))}class $e{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 et(e){return t=>new d(n=>t.subscribe(new tt(n,e)))}class tt{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 nt(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 d(e=>(n++,a(r.subscribe(e))))}}var rt=300,it=(e,t=rt)=>new d(n=>{let r=x(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!S(r))return;let o=new r.ResizeObserver(I(e=>{let t=e[0];if(!t)return;let r,i;t.contentBoxSize&&t.contentBoxSize[0]?(i=t.contentBoxSize[0].blockSize,r=t.contentBoxSize[0].inlineSize):t.contentRect&&(r=t.contentRect.width,i=t.contentRect.height),g(r)&&g(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),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},at=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},ot=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},st=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),ct=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),lt=e=>e!==void 0&&e!==``?e:ct().toString();function ut(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 dt(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 ft=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),pt=e=>{if(!ft(e))throw e};function mt(e){if(e&&typeof e==`object`){if(`message`in e)return String(e.message);try{return JSON.stringify(e)}catch{return`object serialization error`}}return String(e)}class ht{buffer;writeIndex=0;count=0;capacity;constructor(e){if(e<=0)throw Error(`Capacity must be greater than 0`);this.capacity=e,this.buffer=Array.from({length:e}).fill(null)}add(e){this.buffer[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.count<this.capacity&&this.count++}*[Symbol.iterator](){if(this.count===0)return;let e=this.count<this.capacity?0:this.writeIndex;for(let t=0;t<this.count;t++){let t=this.buffer[e];g(t)&&(yield t),e=(e+1)%this.capacity}}clear(){this.buffer.fill(null),this.writeIndex=0,this.count=0}get size(){return this.count}get maxCapacity(){return this.capacity}}var gt=e=>(t,n=!1)=>r=>{let i=typeof r==`object`;r==null||i&&!Object.keys(r).length||e(t,i?V(r):{value:r},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;subscription=new a;span;context;childTracers=[];initPromise;getRootTracerContext;eventsBuffer=null;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t,getRootTracerContext:n,eventsBufferSize:r}){g(r)&&r>0&&(this.eventsBuffer=new ht(r)),U.dynamicImportStatus===`not_started`&&(U.dynamicImportPromise=this.loadOpentelemetry());let i=Date.now();this.initPromise=U.dynamicImportPromise.then(r=>{U.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t,getRootTracerContext:n},i)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(_(i))return;let{opentelemetryApi:a}=U.dynamicImports,{context:o,trace:s}=a,{tracer:c,attributes$:l}=i;this.span=c.startSpan(e,{startTime:r},t?.()),this.context=s.setSpan(o.active(),this.span),this.getRootTracerContext=n,this.subscription.add(l.subscribe(e=>{g(e)&&this.span.setAttributes(e)}))}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 _(this.span)||U.dynamicImportStatus===`failed`}addEventToBuffer(e,t,n,r){g(this.eventsBuffer)&&this.eventsBuffer.add({name:e,attributes:t,type:n,timestamp:r})}addEventToSpan(e,t,n,r){this.span.addEvent(e,{...H(t),type:n},r)}log(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`log`,r)}):this.addEventToBuffer(e,t,`log`,r)}error(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`error`,r)}):this.addEventToBuffer(e,t,`error`,r)}critical(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`critical`,r)}):this.addEventToBuffer(e,t,`critical`,r)}createComponentTracer(e){let t=new U({name:e,getParentContext:()=>this.context,getRootTracerContext:()=>this.getRootTracerContext?.(),eventsBufferSize:this.eventsBuffer?.maxCapacity});return this.childTracers.push(t),t}setSpanAttributes(e){this.span.setAttributes(H(e))}end(){this.initPromise.then(e=>{if(!this.isComponentTracerNotInitialized()){if(g(this.eventsBuffer))for(let e of this.eventsBuffer)this.addEventToSpan(e.name,e.attributes,e.type,e.timestamp);this.childTracers.forEach(e=>e.end()),this.span.end(),this.subscription.unsubscribe()}})}}var _t=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`;class vt extends U{attributes$=new z(null);constructor(e){super({name:`Root`,eventsBufferSize:e})}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:_t}))]});f.register();let p=f.getTracer(`sdk-videoplayer-tracer`);super.init({name:e,getParentContext:t,getRootTracerContext:()=>({tracer:p,attributes$:this.attributes$})},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}setSpanAttributes(e){this.attributes$.next({...this.attributes$.getValue(),...H(e)})}addSubscription(e){this.subscription.add(e)}}class yt{fakeTraceId;constructor(e){}log(e,t,n){}error(e,t,n){}critical(e,t,n){}createComponentTracer(e){return new yt({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}}var bt=()=>!0,W={level:0,filter:bt,name:`Noname Tracer`,outputMethod:`log`};class xt{name;filter=bt;level=W.level;outputMethod=W.outputMethod;childTracers=[];constructor({name:e,level:t,filter:n,outputMethod:r}={}){this.filter=n??this.filter,this.level=t??this.level,this.outputMethod=r??this.outputMethod,this.name=e??W.name}log(e,t,n){this.logDebug(e,t)}error(e,t,n){this.logError(e,t)}critical(e,t,n){this.logError(e,t)}createComponentTracer(e){let t=new xt({filter:this.filter,level:this.level,name:`${this.name}/ ${e}`,outputMethod:this.outputMethod});return this.childTracers.push(t),t}end(){this.childTracers.forEach(e=>e.end()),this.childTracers=[]}setLevel(e){this.level=e,this.childTracers.forEach(t=>t.setLevel(e))}setOtputMethod(e){this.outputMethod=e,this.childTracers.forEach(t=>t.setOtputMethod(e))}setFilter(e){this.filter=e,this.childTracers.forEach(t=>t.setFilter(e))}getFinishedSpans(){}getTraceId(){return`debug_trace`}get verbose(){return this.level===0}createMessage(e,t){return[this.name,e,JSON.stringify(t)].join(`: `)}logDebug(e,t){!this.verbose||!this.filter(e,t)||x().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&x().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}}class St{static createRootTracer(e=`fake`,t){switch(e){case`real`:return new vt(t);case`debug`:return new xt;default:return new yt}}}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.UI=`ui`,e.CALL_FROM_EXTERNAL=`call_from_external`,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={};r(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=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?e.thrown:Error(e.message),n=e.id.length>10240?e.id.substring(0,10240):e.id;try{t.name=n}catch{t=Error(e.message),t.name=n}return t},zt=()=>{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;beforeInitErrors=[];constructor(e,t,n,r){this.componentName=e,this.options=t,this.envParams=n,this.context={...r};let{isEmbed:i,topOrigin:a}=le();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 n=q.tracerErrorMap.get(this.componentName);if(!n){this.beforeInitErrors.push([e,t]);return}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))try{let r=Rt(e);n?.error(r,{crashIdSource:r.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...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()}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:_t,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),q.tracerErrorMap.set(this.componentName,o),this.beforeInitErrors.forEach(e=>this.error.apply(this,e)),this.beforeInitErrors=[]}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)}})())}}class Bt{options;symbol;constructor(e,t){this.options=t,this.symbol=Symbol(e)}}var Vt=()=>{let e=new Map,t=new Map,n=new Map,r=new Map,i=new Set;return{resolve(e){if(!r.has(e)){let t=n.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);r.set(e,new t)}return r.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){r.forEach((t,n)=>{t instanceof e&&r.delete(n)}),n.set(e,t)},getToken(n){if(e.has(n.symbol))return e.get(n.symbol);if(t.has(n.symbol)){let r=t.get(n.symbol)();return e.set(n.symbol,r),r}if(n.options?.factory){let t=n.options.factory();return e.set(n.symbol,t),t}throw Error(`No value registered in DI container for token "${n.symbol.description}"`)},registerToken(t,n){e.set(t.symbol,n)},registerFactory(e,n){t.set(e.symbol,n)},hasToken(n){return e.has(n.symbol)||t.has(n.symbol)||!!n.options?.factory},registerCleanup(e){i.add(e)},clear(){i.forEach(e=>e()),i.clear(),e.clear(),t.clear(),r.clear(),n.clear()}}},{NativeAbortSignal:Ht,NativeAbortController:Ut}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function Wt(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 Gt(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 J{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 J{constructor(){super(),this.listeners||J.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=Gt(e),n=Wt(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 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 Z=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window,Q=`fetch`in Z&&Kt({fetch:Z.fetch,Request:Z.Request,AbortController:Z.AbortController}),Jt=Q?qt({fetch:Z.fetch,Request:Z.Request,AbortController:Z.AbortController}):void 0,Yt=Q?Jt.fetch:Z.fetch,Xt=Q?Jt.Request:Z.Request,Zt=Q?X:Z.AbortController,Qt=Q?Y:Z.AbortSignal,$t=(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)},en=e=>Z.clearTimeout(e),tn=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),$=!tn(Z.requestIdleCallback)||!tn(Z.cancelIdleCallback),nn=$?$t:Z.requestIdleCallback,rn=$?en:Z.cancelIdleCallback,an=(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,an as urlCanParsePolyfilled,Te as timeout,xe as timeCodeToString,I as throttleFn,Re as throttle,Qe as tap,pt as suppressAbort,et as skip,nt as shareReplay,T as safeStorage,nn as requestIdleCallbackPolyfilled,Xe as pairwise,Ye as once,it as observeElementSize,Oe as observableFrom,te as nowInt,C as now,c as noop,we as merge,Je as mapTo,Ke as map,Et as loadVKLangPack,ot as isValidURL,_ as isNullable,g as isNonNullable,pe as isLowerOrEqual,j as isLower,N as isInvariantQuality,st as isIntersecting,fe as isHigherOrEqual,de as isHigher,S as isBrowserWindow,ft as isAbortError,Ee as interval,ut as interpolate,x as getWindow,be as getVideoQualityLabel,gt as getTraceSubscriptionMethod,dt as getRangeAroundIndex,lt as getPlayerId,mt as getMessageFromError,me as getHighestQuality,ne as getExponentialDelay,ke as fromEvent,V as flattenObject,We as filterChanged,Be as filter,P as fillWithDefault,Yt as fetchPolyfilled,jt as devNull,le as detectEmbed,F as debounceFn,Fe as debounce,Vt as createDIContainer,je as combineLatest,Ce as combine,L as cloneDeepWith,Se as cloneDeep,at as clearVideoElement,s as checkNever,rn as cancelIdleCallbackPolyfilled,Me 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,ue as VideoQuality,z as ValueSubject,wt as VKNumericLanguage,i as VERSION,St as TracerFactory,Ae as SubscriptionRemovable,a as Subscription,f as Subject,Xt as RequestPolyfilled,R as ReplaySubject,d as Observable,p as Logger,At as InternalsExposure,kt as InterfaceLanguage,Bt as InjectionToken,G as INTERNAL_EXPOSE_GLOBAL_KEY,Ct as ErrorCategory,ht as CircularBuffer,q as AppTracer,Qt as AbortSignalPolyfilled,Zt as AbortControllerPolyfilled};
|
package/evergreen.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.95-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.95-dev.1022d4dbd.0
|
|
3
|
+
* Tue, 14 Jul 2026 18:23:25 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-95/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.95-dev.02230ed18.0`;class a{subscriptions=[];unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(e=>{typeof e==`function`?e():e.unsubscribe()})}add(e){return this.subscriptions.push(e),this}}var o=e=>{throw Error(`${e} is value of unexpected type`)},s=e=>{},c=()=>{},l=e=>{throw console.error(e),e},u=e=>{console.error(e)};class d{suppressErrors=!1;constructor(e){e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?u:l,r;r=t?typeof t==`function`?{next:t,error:c}:{next:e=>t.next(e),error:e=>t.error?.(e)}:{next:n,error:c};let i=typeof e==`function`?{next:t=>{try{let n=e(t);n instanceof Promise&&n.catch(e=>r.next(e))}catch(e){r.next(e)}},error:e=>r.next(e)}:{next:t=>e.next(t),error:t=>e.error?e.error(t):r.next(t)},s;try{s=this._subscribe(i)}catch(e){i.error?.(e)}return new a().add(()=>{switch(i.next=c,i.error=c,typeof s){case`function`:s();return;case`object`:s.unsubscribe();return;case`undefined`:return;default:return o(s)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class f extends d{keyCounter=0;subscribers=new Map;constructor(){super()}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>t.error?.(e))}_subscribe(e){let t=this.keyCounter++;return this.subscribers.set(t,e),new a().add(()=>this.subscribers.delete(t))}}class p{log$=new f;logs=[];log=e=>{let t={...e,timestamp:Date.now()};this.logs.push(t),this.log$.next(t)};createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch{n={message:"error in `createCustomLog`",component:`Logger`}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>({component:e,...t}))}getAllLogs=()=>this.logs}function m(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function h(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function g(e){return e!=null}function _(e){return e==null}var v=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>g(t)));function y(e,t){if(!e?.length)throw Error(t)}function b(e,t){if(e?.length)throw Error(t)}var x=()=>globalThis,S=(e=x())=>!!(e.window&&e.screen),C=(e,t,n)=>new Promise((r,i)=>{t.addEventListener(`abort`,()=>{s(),l.remove()});let a=()=>{s(),i(`error`)},o=()=>{s(),r()},s=()=>{c&&clearTimeout(c),l.removeEventListener(`load`,o),l.removeEventListener(`error`,a)},c;n&&(c=x().setTimeout(()=>{s(),i(`timeout`)},n));let l=document.createElement(`script`);l.addEventListener(`load`,o),l.addEventListener(`error`,a),l.src=e,document.head.appendChild(l)}),w=typeof x().performance?.now==`function`?()=>x().performance.now():()=>Date.now(),T=()=>Math.trunc(w()),E=(e,t)=>async(...n)=>{let r=t(...n),i=e.aborted,a;for(;!i&&!e.aborted;)try{let e=await r.next(a);i=e.done??!1,a=e.value}catch(e){await r.throw(e)}return a},ee=(e,{start:t=0,factor:n=2,max:r=1/0,min:i=t,random:a=0}={})=>{let o=t;return o*=n**e,o*=1+(Math.random()*a*2-a),o=Math.round(o),o=Math.min(o,r),o=Math.max(o,i),o},D={};r(D,{set:()=>re,remove:()=>ae,isPersistent:()=>te,has:()=>ie,get:()=>ne,clear:()=>oe});var O,k,A=`vk-videoplayer-dummy-key-${Math.random()}`,j=()=>{if(k!==void 0)return k;try{localStorage.setItem(A,`test`),localStorage.removeItem(A),k=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(A),k=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)k=2;else throw e}else throw e}return k===2&&(O=new Map),k},te=()=>j()===0,ne=e=>{let t=j();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return O?.get(e);default:o(t)}},re=(e,t)=>{let n=j();switch(n){case 0:try{localStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 1:try{sessionStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 2:O?.set(e,t);return;default:o(n)}},ie=e=>{let t=j();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return O?.has(e)??!1;default:return o(t),!1}},ae=e=>{let t=j();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:O?.delete(e);return;default:o(t)}},oe=()=>{let e=j();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return O?.clear();default:o(e)}},se=()=>{let e,t=[],n=x();try{e=n.self!==n.top}catch(t){t instanceof DOMException&&t.name===`SecurityError`?e=!0:(e=!1,console.error(t))}try{n.location?.ancestorOrigins&&(t=[...n.location.ancestorOrigins])}catch(e){console.error(e)}try{!t.length&&n.document.referrer&&(t=[new URL(n.document.referrer).origin])}catch(e){console.error(e)}return t=t.filter(e=>URL.canParse(e)),{isEmbed:e,origins:t,topOrigin:t.at(-1),immediateOrigin:t.at(0)}},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}},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 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 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 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},ye=e=>B(e);class V 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 H 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 be(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 xe(...e){return new d(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new a))}var Se=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)}),Ce=e=>new d(t=>{let n=x(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function we(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 Te=we,Ee=(e,t)=>new d(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class De extends a{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Oe(e){return t=>new d(n=>t.subscribe(new ke(n,e)))}class ke{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 Ae={leading:!1,trailing:!0};function je(e,t=Ae){return n=>new d(r=>n.subscribe(new Me(r,e,t)))}class Me{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 Ne={leading:!0,trailing:!1};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,_(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 Ie(e){return t=>new d(n=>t.subscribe(new Le(n,e)))}class Le{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 Re=(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)},ze=(e,t)=>e instanceof Object&&t instanceof Object?Re(e,t):e===t;function Be(e=ze){return t=>new d(n=>t.subscribe(new Ve(n,e)))}var U={};class Ve{destination;predicate;lastValue=U;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===U||!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 W(e){return t=>new d(n=>t.subscribe(new He(n,e)))}class He{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 Ue(e){return W(()=>e)}function We(){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 Ge(){return e=>new d(t=>e.subscribe(new Ke(t)))}class Ke{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 qe(e){return t=>new d(n=>t.subscribe(new Je(n,e)))}class Je{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 Ye(e){return t=>new d(n=>t.subscribe(new Xe(n,e)))}class Xe{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 Ze(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 d(e=>(n++,a(r.subscribe(e))))}}var Qe=300,$e=(e,t=Qe)=>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(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),g(r)&&g(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),G=(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=G(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},et=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},tt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},nt=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),rt=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),it=e=>e!==void 0&&e!==``?e:rt().toString();function at(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 ot(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 K=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),st=e=>{if(!K(e))throw e};function ct(e){if(e&&typeof e==`object`){if(`message`in e)return String(e.message);try{return JSON.stringify(e)}catch{return`object serialization error`}}return String(e)}class lt{buffer;writeIndex=0;count=0;capacity;constructor(e){if(e<=0)throw Error(`Capacity must be greater than 0`);this.capacity=e,this.buffer=Array.from({length:e}).fill(null)}add(e){this.buffer[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.count<this.capacity&&this.count++}*[Symbol.iterator](){if(this.count===0)return;let e=this.count<this.capacity?0:this.writeIndex;for(let t=0;t<this.count;t++){let t=this.buffer[e];g(t)&&(yield t),e=(e+1)%this.capacity}}clear(){this.buffer.fill(null),this.writeIndex=0,this.count=0}get size(){return this.count}get maxCapacity(){return this.capacity}}var ut=e=>(t,n=!1)=>r=>{let i=typeof r==`object`;r==null||i&&!Object.keys(r).length||e(t,i?G(r):{value:r},n)},q=(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 J{dynamicImportTimeout=5e3;subscription=new a;span;context;childTracers=[];initPromise;getRootTracerContext;eventsBuffer=null;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t,getRootTracerContext:n,eventsBufferSize:r}){g(r)&&r>0&&(this.eventsBuffer=new lt(r)),J.dynamicImportStatus===`not_started`&&(J.dynamicImportPromise=this.loadOpentelemetry());let i=Date.now();this.initPromise=J.dynamicImportPromise.then(r=>{J.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t,getRootTracerContext:n},i)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(_(i))return;let{opentelemetryApi:a}=J.dynamicImports,{context:o,trace:s}=a,{tracer:c,attributes$:l}=i;this.span=c.startSpan(e,{startTime:r},t?.()),this.context=s.setSpan(o.active(),this.span),this.getRootTracerContext=n,this.subscription.add(l.subscribe(e=>{g(e)&&this.span.setAttributes(e)}))}async loadOpentelemetry(){if(J.dynamicImportStatus===`not_started`){J.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]);J.dynamicImports={opentelemetryApi:n,opentelemetrySdk:r,tracer:i,opentelemetryResources:a,opentelemetrySemanticConventions:o},J.dynamicImportStatus=`completed`}catch{J.dynamicImportStatus=`failed`}}}isComponentTracerNotInitialized(){return _(this.span)||J.dynamicImportStatus===`failed`}addEventToBuffer(e,t,n,r){g(this.eventsBuffer)&&this.eventsBuffer.add({name:e,attributes:t,type:n,timestamp:r})}addEventToSpan(e,t,n,r){this.span.addEvent(e,{...q(t),type:n},r)}log(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`log`,r)}):this.addEventToBuffer(e,t,`log`,r)}error(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`error`,r)}):this.addEventToBuffer(e,t,`error`,r)}critical(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`critical`,r)}):this.addEventToBuffer(e,t,`critical`,r)}createComponentTracer(e){let t=new J({name:e,getParentContext:()=>this.context,getRootTracerContext:()=>this.getRootTracerContext?.(),eventsBufferSize:this.eventsBuffer?.maxCapacity});return this.childTracers.push(t),t}setSpanAttributes(e){this.span.setAttributes(q(e))}end(){this.initPromise.then(e=>{if(!this.isComponentTracerNotInitialized()){if(g(this.eventsBuffer))for(let e of this.eventsBuffer)this.addEventToSpan(e.name,e.attributes,e.type,e.timestamp);this.childTracers.forEach(e=>e.end()),this.span.end(),this.subscription.unsubscribe()}})}}var dt=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`;class ft extends J{attributes$=new H(null);constructor(e){super({name:`Root`,eventsBufferSize:e})}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=J.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:dt}))]});f.register();let p=f.getTracer(`sdk-videoplayer-tracer`);super.init({name:e,getParentContext:t,getRootTracerContext:()=>({tracer:p,attributes$:this.attributes$})},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}setSpanAttributes(e){this.attributes$.next({...this.attributes$.getValue(),...q(e)})}addSubscription(e){this.subscription.add(e)}}class pt{fakeTraceId;constructor(e){}log(e,t,n){}error(e,t,n){}critical(e,t,n){}createComponentTracer(e){return new pt({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}}var mt=()=>!0,Y={level:0,filter:mt,name:`Noname Tracer`,outputMethod:`log`};class X{name;filter=mt;level=Y.level;outputMethod=Y.outputMethod;childTracers=[];constructor({name:e,level:t,filter:n,outputMethod:r}={}){this.filter=n??this.filter,this.level=t??this.level,this.outputMethod=r??this.outputMethod,this.name=e??Y.name}log(e,t,n){this.logDebug(e,t)}error(e,t,n){this.logError(e,t)}critical(e,t,n){this.logError(e,t)}createComponentTracer(e){let t=new X({filter:this.filter,level:this.level,name:`${this.name}/ ${e}`,outputMethod:this.outputMethod});return this.childTracers.push(t),t}end(){this.childTracers.forEach(e=>e.end()),this.childTracers=[]}setLevel(e){this.level=e,this.childTracers.forEach(t=>t.setLevel(e))}setOtputMethod(e){this.outputMethod=e,this.childTracers.forEach(t=>t.setOtputMethod(e))}setFilter(e){this.filter=e,this.childTracers.forEach(t=>t.setFilter(e))}getFinishedSpans(){}getTraceId(){return`debug_trace`}get verbose(){return this.level===0}createMessage(e,t){return[this.name,e,JSON.stringify(t)].join(`: `)}logDebug(e,t){!this.verbose||!this.filter(e,t)||x().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&x().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}}class ht{static createRootTracer(e=`fake`,t){switch(e){case`real`:return new ft(t);case`debug`:return new X;default:return new pt}}}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.UI=`ui`,e.CALL_FROM_EXTERNAL=`call_from_external`,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 Z=`__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[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 wt={};r(wt,{subscribe:()=>Ot,push:()=>Dt,destroy:()=>Et,create:()=>Tt});var Q=new Map,Tt=(e,t)=>Q.set(e,t??[]),Et=e=>Q.delete(e),Dt=(e,t)=>{let n=Q.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Ot=(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)}},kt=e=>v({id:e.id,message:e.message,category:e.category,data:At(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function At(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var jt=e=>{let t=e.thrown instanceof Error?e.thrown:Error(e.message),n=e.id.length>10240?e.id.substring(0,10240):e.id;try{t.name=n}catch{t=Error(e.message),t.name=n}return t},Mt=()=>{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;beforeInitErrors=[];constructor(e,t,n,r){this.componentName=e,this.options=t,this.envParams=n,this.context={...r};let{isEmbed:i,topOrigin:a}=se();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 n=$.tracerErrorMap.get(this.componentName);if(!n){this.beforeInitErrors.push([e,t]);return}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))try{let r=jt(e);n?.error(r,{crashIdSource:r.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...kt(e),...Mt(),...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:dt,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),$.tracerErrorMap.set(this.componentName,o),this.beforeInitErrors.forEach(e=>this.error.apply(this,e)),this.beforeInitErrors=[]}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)}})())}}class Nt{options;symbol;constructor(e,t){this.options=t,this.symbol=Symbol(e)}}var Pt=()=>{let e=new Map,t=new Map,n=new Map,r=new Map,i=new Set;return{resolve(e){if(!r.has(e)){let t=n.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);r.set(e,new t)}return r.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){r.forEach((t,n)=>{t instanceof e&&r.delete(n)}),n.set(e,t)},getToken(n){if(e.has(n.symbol))return e.get(n.symbol);if(t.has(n.symbol)){let r=t.get(n.symbol)();return e.set(n.symbol,r),r}if(n.options?.factory){let t=n.options.factory();return e.set(n.symbol,t),t}throw Error(`No value registered in DI container for token "${n.symbol.description}"`)},registerToken(t,n){e.set(t.symbol,n)},registerFactory(e,n){t.set(e.symbol,n)},hasToken(n){return e.has(n.symbol)||t.has(n.symbol)||!!n.options?.factory},registerCleanup(e){i.add(e)},clear(){i.forEach(e=>e()),i.clear(),e.clear(),t.clear(),r.clear(),n.clear()}}};export{v as withoutNullable,pe as videoSizeToQuality,me as videoQualityToHeight,fe as videoHeightToQuality,Se as timeout,ve as timeCodeToString,z as throttleFn,Pe as throttle,qe as tap,st as suppressAbort,Ye as skip,Ze as shareReplay,D as safeStorage,Ge as pairwise,We as once,$e as observeElementSize,Te as observableFrom,T as nowInt,w as now,c as noop,xe as merge,Ue as mapTo,W as map,yt as loadVKLangPack,tt as isValidURL,_ as isNullable,g as isNonNullable,ue as isLowerOrEqual,P as isLower,I as isInvariantQuality,nt as isIntersecting,le as isHigherOrEqual,ce as isHigher,S as isBrowserWindow,K as isAbortError,Ce as interval,at as interpolate,x as getWindow,_e as getVideoQualityLabel,ut as getTraceSubscriptionMethod,ot as getRangeAroundIndex,it as getPlayerId,ct as getMessageFromError,de as getHighestQuality,ee as getExponentialDelay,Ee as fromEvent,G as flattenObject,Be as filterChanged,Ie as filter,L as fillWithDefault,wt as devNull,se as detectEmbed,R as debounceFn,je as debounce,Pt as createDIContainer,be as combine,B as cloneDeepWith,ye as cloneDeep,et as clearVideoElement,s as checkNever,Oe 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,M as VideoQuality,H as ValueSubject,_t as VKNumericLanguage,i as VERSION,ht as TracerFactory,De as SubscriptionRemovable,a as Subscription,f as Subject,V as ReplaySubject,d as Observable,p as Logger,Ct as InternalsExposure,St as InterfaceLanguage,Nt as InjectionToken,Z as INTERNAL_EXPOSE_GLOBAL_KEY,gt as ErrorCategory,lt as CircularBuffer,$ 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.95-dev.1022d4dbd.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)}},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``}},ye=(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]=ye(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 xe(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 Se=(e,t=0,n)=>xe(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 L 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 R 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 new d(t=>{let n=Array(e.length),r=e=>r=>{n[e]=r,t.next([...n])};return e.reduce((e,t,n)=>e.add(t.subscribe(r(n))),new a)})}function Ne(e){return t=>new d(n=>t.subscribe(new Pe(n,e)))}class Pe{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 Fe={leading:!1,trailing:!0};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;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 Re={leading:!0,trailing:!1};function ze(e,t=Re){return n=>new d(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,_(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 Ve(e){return t=>new d(n=>t.subscribe(new He(n,e)))}class He{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 Ue=(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)},We=(e,t)=>e instanceof Object&&t instanceof Object?Ue(e,t):e===t;function Ge(e=We){return t=>new d(n=>t.subscribe(new Ke(n,e)))}var z={};class Ke{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 d(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 Je(e){return B(()=>e)}function Ye(){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 Xe(){return e=>new d(t=>e.subscribe(new Ze(t)))}class Ze{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 Qe(e){return t=>new d(n=>t.subscribe(new $e(n,e)))}class $e{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 et(e){return t=>new d(n=>t.subscribe(new tt(n,e)))}class tt{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 nt(e=0){return t=>{let n=0,r=new L(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new d(e=>(n++,a(r.subscribe(e))))}}var rt=300,it=(e,t=rt)=>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()}),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},at=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},ot=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},st=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),ct=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),lt=e=>e!==void 0&&e!==``?e:ct().toString();function ut(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 dt(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),ft=e=>{if(!H(e))throw e};function pt(e){if(e&&typeof e==`object`){if(`message`in e)return String(e.message);try{return JSON.stringify(e)}catch{return`object serialization error`}}return String(e)}class U{buffer;writeIndex=0;count=0;capacity;constructor(e){if(e<=0)throw Error(`Capacity must be greater than 0`);this.capacity=e,this.buffer=Array.from({length:e}).fill(null)}add(e){this.buffer[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.count<this.capacity&&this.count++}*[Symbol.iterator](){if(this.count===0)return;let e=this.count<this.capacity?0:this.writeIndex;for(let t=0;t<this.count;t++){let t=this.buffer[e];g(t)&&(yield t),e=(e+1)%this.capacity}}clear(){this.buffer.fill(null),this.writeIndex=0,this.count=0}get size(){return this.count}get maxCapacity(){return this.capacity}}var mt=e=>(t,n=!1)=>r=>{let i=typeof r==`object`;r==null||i&&!Object.keys(r).length||e(t,i?V(r):{value:r},n)},W=(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 G{dynamicImportTimeout=5e3;subscription=new a;span;context;childTracers=[];initPromise;getRootTracerContext;eventsBuffer=null;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t,getRootTracerContext:n,eventsBufferSize:r}){g(r)&&r>0&&(this.eventsBuffer=new U(r)),G.dynamicImportStatus===`not_started`&&(G.dynamicImportPromise=this.loadOpentelemetry());let i=Date.now();this.initPromise=G.dynamicImportPromise.then(r=>{G.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t,getRootTracerContext:n},i)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(_(i))return;let{opentelemetryApi:a}=G.dynamicImports,{context:o,trace:s}=a,{tracer:c,attributes$:l}=i;this.span=c.startSpan(e,{startTime:r},t?.()),this.context=s.setSpan(o.active(),this.span),this.getRootTracerContext=n,this.subscription.add(l.subscribe(e=>{g(e)&&this.span.setAttributes(e)}))}async loadOpentelemetry(){if(G.dynamicImportStatus===`not_started`){G.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]);G.dynamicImports={opentelemetryApi:n,opentelemetrySdk:r,tracer:i,opentelemetryResources:a,opentelemetrySemanticConventions:o},G.dynamicImportStatus=`completed`}catch{G.dynamicImportStatus=`failed`}}}isComponentTracerNotInitialized(){return _(this.span)||G.dynamicImportStatus===`failed`}addEventToBuffer(e,t,n,r){g(this.eventsBuffer)&&this.eventsBuffer.add({name:e,attributes:t,type:n,timestamp:r})}addEventToSpan(e,t,n,r){this.span.addEvent(e,{...W(t),type:n},r)}log(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`log`,r)}):this.addEventToBuffer(e,t,`log`,r)}error(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`error`,r)}):this.addEventToBuffer(e,t,`error`,r)}critical(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`critical`,r)}):this.addEventToBuffer(e,t,`critical`,r)}createComponentTracer(e){let t=new G({name:e,getParentContext:()=>this.context,getRootTracerContext:()=>this.getRootTracerContext?.(),eventsBufferSize:this.eventsBuffer?.maxCapacity});return this.childTracers.push(t),t}setSpanAttributes(e){this.span.setAttributes(W(e))}end(){this.initPromise.then(e=>{if(!this.isComponentTracerNotInitialized()){if(g(this.eventsBuffer))for(let e of this.eventsBuffer)this.addEventToSpan(e.name,e.attributes,e.type,e.timestamp);this.childTracers.forEach(e=>e.end()),this.span.end(),this.subscription.unsubscribe()}})}}var K=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`;class ht extends G{attributes$=new R(null);constructor(e){super({name:`Root`,eventsBufferSize:e})}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=G.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:K}))]});f.register();let p=f.getTracer(`sdk-videoplayer-tracer`);super.init({name:e,getParentContext:t,getRootTracerContext:()=>({tracer:p,attributes$:this.attributes$})},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}setSpanAttributes(e){this.attributes$.next({...this.attributes$.getValue(),...W(e)})}addSubscription(e){this.subscription.add(e)}}class q{fakeTraceId;constructor(e){}log(e,t,n){}error(e,t,n){}critical(e,t,n){}createComponentTracer(e){return new q({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}}var J=()=>!0,Y={level:0,filter:J,name:`Noname Tracer`,outputMethod:`log`};class gt{name;filter=J;level=Y.level;outputMethod=Y.outputMethod;childTracers=[];constructor({name:e,level:t,filter:n,outputMethod:r}={}){this.filter=n??this.filter,this.level=t??this.level,this.outputMethod=r??this.outputMethod,this.name=e??Y.name}log(e,t,n){this.logDebug(e,t)}error(e,t,n){this.logError(e,t)}critical(e,t,n){this.logError(e,t)}createComponentTracer(e){let t=new gt({filter:this.filter,level:this.level,name:`${this.name}/ ${e}`,outputMethod:this.outputMethod});return this.childTracers.push(t),t}end(){this.childTracers.forEach(e=>e.end()),this.childTracers=[]}setLevel(e){this.level=e,this.childTracers.forEach(t=>t.setLevel(e))}setOtputMethod(e){this.outputMethod=e,this.childTracers.forEach(t=>t.setOtputMethod(e))}setFilter(e){this.filter=e,this.childTracers.forEach(t=>t.setFilter(e))}getFinishedSpans(){}getTraceId(){return`debug_trace`}get verbose(){return this.level===0}createMessage(e,t){return[this.name,e,JSON.stringify(t)].join(`: `)}logDebug(e,t){!this.verbose||!this.filter(e,t)||x().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&x().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}}class _t{static createRootTracer(e=`fake`,t){switch(e){case`real`:return new ht(t);case`debug`:return new gt;default:return new q}}}var vt;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.UI=`ui`,e.CALL_FROM_EXTERNAL=`call_from_external`,e.FATAL=`fatal`})(vt||={});var X;(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`})(X||={});var yt=`vk.com`,bt=async(e,t,n)=>{let r=new URL(`https://${yt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),xt(await(await fetch(r.toString())).json(),n)},xt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),St(n)])),St=e=>Array.isArray(e)?e[0]:e,Ct;(e=>{e.RU=`ru`,e.EN=`en`})(Ct||={});var Z=`__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[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 Tt={};r(Tt,{subscribe:()=>kt,push:()=>Ot,destroy:()=>Dt,create:()=>Et});var Q=new Map,Et=(e,t)=>Q.set(e,t??[]),Dt=e=>Q.delete(e),Ot=(e,t)=>{let n=Q.get(e);n&&(typeof n==`function`?n(t):n.push(t))},kt=(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)}},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?e.thrown:Error(e.message),n=e.id.length>10240?e.id.substring(0,10240):e.id;try{t.name=n}catch{t=Error(e.message),t.name=n}return 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 ${static tracerErrorMap=new Map;static appTracerModule=null;static loadPromise=null;dynamicImportTimeout=5e3;componentName;subscription=new a;options;envParams;context;isEmbed;embedParent;beforeInitErrors=[];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 n=$.tracerErrorMap.get(this.componentName);if(!n){this.beforeInitErrors.push([e,t]);return}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))try{let r=Mt(e);n?.error(r,{crashIdSource:r.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 $.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:K,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),$.tracerErrorMap.set(this.componentName,o),this.beforeInitErrors.forEach(e=>this.error.apply(this,e)),this.beforeInitErrors=[]}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)}})())}}class Pt{options;symbol;constructor(e,t){this.options=t,this.symbol=Symbol(e)}}var Ft=()=>{let e=new Map,t=new Map,n=new Map,r=new Map,i=new Set;return{resolve(e){if(!r.has(e)){let t=n.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);r.set(e,new t)}return r.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){r.forEach((t,n)=>{t instanceof e&&r.delete(n)}),n.set(e,t)},getToken(n){if(e.has(n.symbol))return e.get(n.symbol);if(t.has(n.symbol)){let r=t.get(n.symbol)();return e.set(n.symbol,r),r}if(n.options?.factory){let t=n.options.factory();return e.set(n.symbol,t),t}throw Error(`No value registered in DI container for token "${n.symbol.description}"`)},registerToken(t,n){e.set(t.symbol,n)},registerFactory(e,n){t.set(e.symbol,n)},hasToken(n){return e.has(n.symbol)||t.has(n.symbol)||!!n.options?.factory},registerCleanup(e){i.add(e)},clear(){i.forEach(e=>e()),i.clear(),e.clear(),t.clear(),r.clear(),n.clear()}}};export{v as withoutNullable,me as videoSizeToQuality,he as videoQualityToHeight,pe as videoHeightToQuality,Ee as timeout,be as timeCodeToString,Se as throttleFn,ze as throttle,Qe as tap,ft as suppressAbort,et as skip,nt as shareReplay,E as safeStorage,Xe as pairwise,Ye as once,it as observeElementSize,ke as observableFrom,ee as nowInt,w as now,c as noop,Te as merge,Je as mapTo,B as map,bt as loadVKLangPack,ot as isValidURL,_ as isNullable,g as isNonNullable,de as isLowerOrEqual,N as isLower,F as isInvariantQuality,st as isIntersecting,ue as isHigherOrEqual,le as isHigher,S as isBrowserWindow,H as isAbortError,De as interval,ut as interpolate,x as getWindow,ve as getVideoQualityLabel,mt as getTraceSubscriptionMethod,dt as getRangeAroundIndex,lt as getPlayerId,pt as getMessageFromError,fe as getHighestQuality,te as getExponentialDelay,Ae as fromEvent,V as flattenObject,Ge as filterChanged,Ve as filter,ye as fillWithDefault,Tt as devNull,ce as detectEmbed,xe as debounceFn,Ie as debounce,Ft as createDIContainer,Me as combineLatest,we as combine,I as cloneDeepWith,Ce as cloneDeep,at as clearVideoElement,s as checkNever,Ne as buffer,_e as assertQualityIsExact,h as assertNullable,y as assertNotEmptyArray,m as assertNonNullable,o as assertNever,b as assertEmptyArray,ge as areQualitiesExact,C as addScript,T as abortable,j as VideoQuality,R as ValueSubject,X as VKNumericLanguage,i as VERSION,_t as TracerFactory,je as SubscriptionRemovable,a as Subscription,f as Subject,L as ReplaySubject,d as Observable,p as Logger,wt as InternalsExposure,Ct as InterfaceLanguage,Pt as InjectionToken,Z as INTERNAL_EXPOSE_GLOBAL_KEY,vt as ErrorCategory,U as CircularBuffer,$ as AppTracer};
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IObservable } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Создаёт Observable, который состоит из объектов, ключами которых являются последние значения исходных Observable.
|
|
4
|
+
* Первое событие возникает тогда, когда каждый исходный Observable выдал хотя бы одно значение.
|
|
5
|
+
*/
|
|
6
|
+
export default function combineLatest(observables: Array<IObservable<unknown>>): IObservable<unknown[]>;
|
|
@@ -10,6 +10,7 @@ export { default as interval } from "./interval";
|
|
|
10
10
|
export { default as observableFrom } from "./observableFrom";
|
|
11
11
|
export { default as fromEvent } from "./fromEvent";
|
|
12
12
|
export { default as SubscriptionRemovable } from "./SubscriptionRemovable";
|
|
13
|
+
export { default as combineLatest } from "./combineLatest";
|
|
13
14
|
export { default as buffer } from "./operators/buffer";
|
|
14
15
|
export { default as debounce } from "./operators/debounce";
|
|
15
16
|
export { default as throttle } from "./operators/throttle";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type DebugData = {
|
|
2
|
+
version?: string;
|
|
3
|
+
viewport?: string;
|
|
4
|
+
provider?: string;
|
|
5
|
+
cdn?: string;
|
|
6
|
+
id?: number;
|
|
7
|
+
volume: number;
|
|
8
|
+
muted: boolean;
|
|
9
|
+
videoSize?: string;
|
|
10
|
+
videoBuffer?: number;
|
|
11
|
+
audioBuffer?: number;
|
|
12
|
+
nativeVideoBuffer?: number;
|
|
13
|
+
nativeAudioBuffer?: number;
|
|
14
|
+
position?: number;
|
|
15
|
+
speed?: number;
|
|
16
|
+
bitrate?: number;
|
|
17
|
+
liveLatency?: number;
|
|
18
|
+
currentVideoSegmentLength?: number;
|
|
19
|
+
currentAudioSegmentLength?: number;
|
|
20
|
+
vsid?: string;
|
|
21
|
+
videoCodec?: string;
|
|
22
|
+
audioCodec?: string;
|
|
23
|
+
hdr?: boolean;
|
|
24
|
+
audioLanguage?: string;
|
|
25
|
+
};
|