npaw-plugin-nwf
Version:
NPAW's Plugin
2 lines • 617 kB
JavaScript
/*! For license information please see NpawPlugin-nwf.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.NpawPlugin=t():e.NpawPlugin=t()}(self,(()=>(()=>{var e={72:(e,t,i)=>{var s=i(7380);const{default:n}=i(3582),{AnalyticsTag:r}=i(9982);var a={getPlayrate:function(){return this.flags.isPaused?0:1},getFramesPerSecond:function(){},getDroppedFrames:function(){},getThroughput:function(){},getRendition:function(){},getTitle2:function(){},getIsLive:function(){},getCdnTraffic:function(){},getP2PTraffic:function(){},getUploadTraffic:function(){},getIsP2PEnabled:function(){},getSegmentDuration:function(){},getHouseholdId:function(){},getLatency:function(){},getPacketLoss:function(){},getPacketSent:function(){},getMetrics:function(){},getAudioCodec:function(){},getVideoCodec:function(){},getURLToParse:function(){},fireSeekBegin:function(e,t,i){if(this._discardFalseBuffers(),!(this.getVideo()&&this.getVideo().getIsLive()&&this.plugin.options["content.isLive.noSeek"])&&this.flags.isJoined&&!this.flags.isSeeking){if(this.flags.isBuffering){if(!1===t)return;n.notice(r,"Converting current buffer to seek"),this.chronos.seek=this.chronos.buffer.clone(),this.chronos.buffer.reset(),this.flags.isBuffering=!1}else this.chronos.seek.start();try{this.fireEventsStruct.seek=[],i?this.fireEventsStruct.seek.push(i):this.fireEventsStruct.seek.push("undefinedEvent")}catch(e){}this.flags.isSeeking=!0,this.emit(s.Event.SEEK_BEGIN,{params:e})}},fireSeekEnd:function(e,t){if(!(this.getVideo()&&this.getVideo().getIsLive()&&this.plugin.options["content.isLive.noSeek"])&&this.flags.isJoined&&this.flags.isSeeking){try{t?this.fireEventsStruct.seek.push(t):this.fireEventsStruct.seek.push("undefinedEvent")}catch(e){}(e=e||{}).triggeredEvents=this.fireEventsStruct.seek,this.cancelSeek(),this.emit(s.Event.SEEK_END,{params:e});try{this.chronos.pause.getDeltaTime(!1)>0&&this.chronos.pause.resume()}catch(e){}}},cancelSeek:function(e){this.flags.isJoined&&this.flags.isSeeking&&(this.flags.isSeeking=!1,this.chronos.seek.stop(),this.monitor&&this.monitor.skipNextTick())},fireEvent:function(e,t,i,n){if("data"===e)this.emit(s.Event.DATA_OBJECT,{params:n});else{var r=n||{};r.name=e||"",r.dimensions=t||{},r.values=i||{},this.emit(s.Event.VIDEO_EVENT,{params:r})}},storeNewRendition:function(e){this.getVideo().triggerUpdateRendition(e)}};e.exports=a},96:(e,t,i)=>{var s=i(8661);const{default:n}=i(99);var r={getFastDataConfig:function(){return this.fastDataTransform.response.msg},getHost:function(){let e=n.getInstance().getOptions().getFastDataHost();return this.fastDataTransform&&this.fastDataTransform.response&&this.fastDataTransform.response.host&&(e=this.fastDataTransform.response.host),s.addProtocol(s.stripProtocol(e),this.options["app.https"])},getFastDataHost:function(){return s.addProtocol(s.stripProtocol(n.getInstance().getOptions().getFastDataHost()),this.options["app.https"])},getSession:function(){var e=n.getInstance().getCoreStorage().getStorages("session");if("undefined"===e&&(e=void 0),!e){var t=this.getStoredData();if(t)try{e=JSON.parse(t).q.c}catch(e){}}return e},getStorageHost:function(){let e=null;const t=this.getStoredData();if(t)try{e=JSON.parse(t).q.h}catch(e){}return e?s.addProtocol(e,this.options["app.https"]):e},getStoredData:function(){return n.getInstance().getCoreStorage().getStorages("data")},getDataTime:function(){return n.getInstance().getCoreStorage().getStorages("dataTime")},setStoredData:function(e){this.storage.setStorages("data",e)},setSession:function(e){this.storage.setStorages("session",e)},setDataTime:function(e){this.storage.setStorages("dataTime",e)}};e.exports=r},99:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>T});var s=i(9794),n=i(9743),r=i(9982),a=i(3582),o=i(9907);class c{constructor(e,t,i,s,n){var r,a,c;this.response={},this._session="",this.sessionExpire=120,this.retries=0,this.isUsingLegacy=!1,this.options=e,this.npawPluginOptions=n,this.accountCode=t,this.coreStorage=i,this.browserStorage=s,this._fastDataHost=this.options.getFastDataHost();const d=null!==(r="true"===o.env.IS_STANDALONE)&&void 0!==r&&r;this.isUsingLegacy=d&&null!==(c=void 0!==(null===(a=null==n?void 0:n.legacyPlugin)||void 0===a?void 0:a.viewTransform))&&void 0!==c&&c,this._createConfigurationInterval()}init(){var e,t;if(this.options&&this.options.offline)return this.response.host="OFFLINE",this.response.code="OFFLINE",this.response.pingTime=60,this.response.beatTime=60,void(this._session=n.default.generateRandomString(15));if(this.isUsingLegacy)return;if(this.browserStorage&&this.browserStorage.isEnabled()&&(new Date).getTime()<1e3*(null!==(e=Number(this.browserStorage.getLocal("sessionExpire")))&&void 0!==e?e:this.sessionExpire)+(Number(this.coreStorage.getDataTime())||0)&&this.coreStorage.getStoredData())return void this.setData(null!==(t=this.coreStorage.getStoredData())&&void 0!==t?t:"");const i=s.A.Service.DATA,o={system:this.accountCode,pluginVersion:T.getPluginVersion(),requestNumber:this.getRequestNumber()};this.loadConfiguration();try{a.default.notice(r.CoreTag,i+" "+o.system),"nicetest"===o.system&&a.default.error(r.CoreTag,"No accountCode has been set. Please set your accountCode inside plugin's options."),this.performRequestToFastData(i,o,this._receiveData.bind(this),this._failedData.bind(this))}catch(e){a.default.error(r.CoreTag,"Error doing get data request to FastData service.")}}updateOptions(e){this.options.updateOptions(e),this.options.offline&&(this.reset(),this.init())}getSessionExpireTime(){return this.sessionExpire}refreshSessionToken(){this._session="",this.browserStorage.removeStorages("data"),this.init()}loadConfiguration(){const e=s.A.Service.CONFIGURATION,t={system:this.accountCode,pluginVersion:T.getPluginVersion(),requestNumber:this.getRequestNumber()};this.performRequestToFastData(e,t,this._receiveConfiguration.bind(this),this._failedConfiguration.bind(this))}getSession(){var e,t;return this.isUsingLegacy?null===(t=null===(e=this.npawPluginOptions)||void 0===e?void 0:e.legacyPlugin)||void 0===t?void 0:t.viewTransform._session:this._session}setSession(e){this._session=e}setHost(e){this.response.host=e}getPingTime(){var e;return null!==(e=this.pingTime)&&void 0!==e?e:5}getBeatTime(){var e;return null!==(e=this.beatTime)&&void 0!==e?e:30}setData(e){try{let t=JSON.parse(e);this.options["parse.fdsResponseHost"]&&(e=e.replace(t.q.h,this.options["parse.fdsResponseHost"](t.q.h)),t=JSON.parse(e)),this.response={msg:e,host:t.q.h,code:t.q.c,pingTime:t.q.pt||5,beatTime:t.q.i&&t.q.i.bt||30,sessionExpire:t.q.st&&t.q.st||120},this._session=this.response.code,this.browserStorage.setLocal("sessionExpire",this.response.sessionExpire),this.browserStorage.setStorages("accCode",this.accountCode),this.browserStorage.setStorages("session",this.response.code),this.coreStorage.setStoredData(this.response.msg),this.coreStorage.setDataTime((new Date).getTime().toString()),this.pingTime=this.response.pingTime,this.beatTime=this.response.beatTime,this.sessionExpire=this.response.sessionExpire}catch(e){a.default.error(r.CoreTag,"Fastdata response is invalid.")}}setConfiguration(e){try{this.response.configurationOptions=JSON.parse(e)}catch(e){a.default.error(r.CoreTag,"Configuration response is invalid.")}}getFastDataResponse(){return this.response}getAccountCode(){return this.accountCode}getRequestNumber(){return Math.random()}reset(){this.coreStorage.removeStoredData(),this.coreStorage.removeSession(),this.browserStorage.removeLocal("sessionExpire"),this.browserStorage.removeStorages("accCode"),this.browserStorage.removeStorages("session")}performRequestToFastData(e,t,i,s){if(this.options.offline)return;t.timemark=(new Date).getTime(),t.outputFormat="json";const r=this,a=new XMLHttpRequest;a.open("GET",`https://${this._fastDataHost}${e}${n.default.toQueryString(t)}`),a.onload=function(e){r.options.offline||(a.status>=200&&a.status<400?i(this,e):s(this,e))},a.onerror=function(e){s(this,e)},a.send()}_createConfigurationInterval(){this.isUsingLegacy||!this.options.isRefreshLMAConfigurationEnabled()||this._refreshInterval||(this._refreshInterval=setInterval(this.loadConfiguration.bind(this),1e3*this.options.refreshLMAConfigurationSeconds()))}_receiveData(e,t){this.setData(e.response)}_receiveConfiguration(e,t){this.setConfiguration(e.response)}_failedData(e,t){a.default.error(r.CoreTag,"Fastdata request has failed."),++this.retries<5&&setTimeout(this.init.bind(this),5e3)}_failedConfiguration(e,t){a.default.error(r.CoreTag,"Fastdata configuration request has failed."),++this.retries<5&&setTimeout(this.init.bind(this),5e3)}}var d=i(668);class l{constructor(){this.offline=!1,this.host="lma.npaw.com",this.disableCookies=!0,this.forceCookies=!1,this.disableStorage=!1,this.authToken=void 0,this.authType="Bearer",this["app.https"]=!0,this["lma.refresh.configuration.enabled"]=!1,this["lma.refresh.configuration.seconds"]=300,this["parse.fdsResponseHost"]=null}updateOptions(e){const t=new d.A;Object.keys(this).forEach((i=>{null==e[i]||Object.keys(t).includes(i)||(this[i]=e[i])}))}setNpawPluginOptions(e){Object.keys(this).forEach((t=>{null!=e[t]&&(this[t]=e[t])}))}isRefreshLMAConfigurationEnabled(){return this["lma.refresh.configuration.enabled"]}refreshLMAConfigurationSeconds(){return this["lma.refresh.configuration.seconds"]}getHost(){return this.host}getFastDataHost(){return this.host}}class u{constructor(e,t,i,s,n,a,o,c){this.method=r.Method.GET,this.headers={},this.xhr=new XMLHttpRequest,this.retries=0,this.hadBody=!1,this.isHttps=e,this.host=t,this.service=i,this.method=s,this.params=n,this.expirationManager=c,this.onSuccessCallback=a,this.onFailCallback=o}performHttps(){return this.isHttps}getHost(){return this.host}getService(){return this.service}getMethod(){return this.method}getParams(){return this.params}getBody(){return this.body}setBody(e){this.body=e}addHeader(e,t){this.headers[e]=t}getExpirationManager(){return this.expirationManager}getRetries(){return this.retries}send(e,t){if(this.params.timemark=Date.now(),this.params.sessionRoot=T.getInstance().getFastDataSessionToken(),this.params.system=T.getInstance().getFastDataService().getAccountCode(),this.body&&(this.hadBody=!0),this.method===r.Method.POST&&!this.body){const e={};e.timemark=this.params.timemark,this.params.code&&(e.code=this.params.code),e.sessionRoot=this.params.sessionRoot,e.system=this.params.system,e.sessionId=this.params.sessionId&&""!=this.params.sessionId?this.params.sessionId:T.getInstance().getFastDataSessionToken(),this.body=JSON.stringify(this.params),this.params=e}try{this.getUrl()}catch(e){console.log(e)}this.xhr.open(this.method,this.getUrl()),this.xhr.onreadystatechange=()=>{4===this.xhr.readyState&&this.xhr.status>=200&&this.xhr.status<400?(t&&t(),this.expirationManager&&this.expirationManager.onRequestSent(),this.onSuccessCallback&&this.onSuccessCallback()):4===this.xhr.readyState&&(this.retries++,!this.hadBody&&this.method===r.Method.POST&&this.body&&(this.params=JSON.parse(this.body),this.body=void 0),e(),this.onFailCallback&&this.onFailCallback())};for(const e in this.headers)this.xhr.setRequestHeader(e,this.headers[e]);this.xhr.send(this.body)}asyncSend(){return e=this,t=void 0,s=function*(){return new Promise(((e,t)=>{this.send(t,e)}))},new((i=void 0)||(i=Promise))((function(n,r){function a(e){try{c(s.next(e))}catch(e){r(e)}}function o(e){try{c(s.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,o)}c((s=s.apply(e,t||[])).next())}));var e,t,i,s}toLocalStorageString(){const e={},t=this.service.split("/");e.request=t[t.length-1],e.unixtime=this.params.timemark;for(const t in this.params)void 0!==this.params[t]&&("sessionId"===t||"sessionRoot"===t?e[t]="":"code"===t?e[t]="CODE_PLACEHOLDER":"object"==typeof this.params[t]?e[t]=JSON.stringify(this.params[t]):e[t]=this.params[t]);return JSON.stringify(e)}getUrl(){return`${this.isHttps?"https":"http"}://${this.host}${this.service}${n.default.toQueryString(this.params)}`}}var h=i(912);const p=[s.A.Service.ERROR,s.A.Service.AD_ERROR];class f{constructor(e,t,i){this.freshRequests=[],this.retryRequests=[],this.databaseSendingInterval=12e4,this.isDestroyed=!1,this.servicesToWait=[s.A.Service.INIT,s.A.Service.START],this.sentStart=!1,this.options=e,this.coreStorage=t,this.fastDataService=i}destroy(){this.freshRequests=[],this.retryRequests=[],this.isDestroyed=!0,this.timeWhenLastSentFromDatabase=(new Date).getTime()}send(e,t,i,s,n,o){var c;if(this.isDestroyed)return;const d=new u(null===(c=this.options["app.https"])||void 0===c||c,this.coreStorage.getHost(),e,t,null!=i?i:{},s,n,o);void 0!==this.options.authToken&&void 0!==this.options.authType&&e!==h.xC.CDN&&(a.default.verbose(r.AnalyticsTag,"Adding Authorization header with type "+this.options.authType),d.addHeader("Authorization",this.options.authType+" "+this.options.authToken)),this.freshRequests.push(d),this._processRequests()}getTimeOfLastSentRequest(){return this.timeOfLastSentRequest}wasStartSent(){return this.sentStart}_processRequests(){return e=this,t=void 0,s=function*(){if(this.isDestroyed)return;const e=this.retryRequests.splice(0,this.retryRequests.length),t=this.freshRequests.splice(0,this.freshRequests.length);e.length>0&&a.default.verbose(r.CoreTag,"Retrying to send these requests:",...e.map((e=>e.getService())));const i=[];let s=!1;for(const t of e)if(s)i.push(t);else try{yield t.asyncSend(),this.timeOfLastSentRequest=(new Date).getTime(),this.coreStorage.setDataTime(this.timeOfLastSentRequest.toString())}catch(e){s=!0,i.push(t)}for(const e of t)try{yield e.asyncSend(),this.servicesToWait.includes(e.getService())&&(this.sentStart=!0),this.timeOfLastSentRequest=(new Date).getTime(),this.coreStorage.setDataTime(this.timeOfLastSentRequest.toString())}catch(t){p.includes(e.getService())&&i.push(e)}this.retryRequests.push(...i.slice(-25))},new((i=void 0)||(i=Promise))((function(n,r){function a(e){try{c(s.next(e))}catch(e){r(e)}}function o(e){try{c(s.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,o)}c((s=s.apply(e,t||[])).next())}));var e,t,i,s}}class g{constructor(e,t,i){this.prefix="npaw",this.disableCookies=e,this.forceCookies=t,this.disabled=i}updateStorageOptions(e,t,i){this.disableCookies=e,this.forceCookies=t,this.disabled=i}isEnabled(){if(this.disabled)return!1;let e=!0;if(!this.forceCookies)try{localStorage.setItem(this.prefix+".test","true"),localStorage.removeItem(this.prefix+".test")}catch(t){e=!1}return e}setLocal(e,t){if(!this.disabled)try{!this.forceCookies&&("undefined"!=typeof localStorage&&localStorage||this.disableCookies)?"undefined"!=typeof localStorage&&localStorage&&localStorage.setItem(this.prefix+"."+e,t):this._setCookie(this.prefix+".local."+e,t)}catch(e){a.default.debug(r.CoreTag,"App Analytics needs localStorage or cookies, not supported by your browser.")}}getLocal(e){if(!this.disabled)return this._localGetRemove("getItem","_getCookie",e)}removeLocal(e){if(!this.disabled)return this._localGetRemove("removeItem","_removeCookie",e)}_localGetRemove(e,t,i){try{if(this.forceCookies||!("undefined"!=typeof localStorage&&localStorage||this.disableCookies))return this[t](this.prefix+".local."+i);if("undefined"!=typeof localStorage&&localStorage)return localStorage[e](this.prefix+"."+i)}catch(e){a.default.debug(r.CoreTag,"App Analytics needs localStorage or cookies, not supported by your browser.")}}setSession(e,t){if(!this.disabled)try{!this.forceCookies&&("undefined"!=typeof sessionStorage&&sessionStorage||this.disableCookies)?"undefined"!=typeof sessionStorage&&sessionStorage&&sessionStorage.setItem(this.prefix+"."+e,t):this._setCookie(this.prefix+".session."+e,t)}catch(e){a.default.debug(r.CoreTag,"App Analytics needs sessionStorage or cookies, not supported by your browser.")}}getSession(e){if(!this.disabled)return this._sessionGetRemove("getItem","_getCookie",e)}removeSession(e){if(!this.disabled)return this._sessionGetRemove("removeItem","_removeCookie",e)}_sessionGetRemove(e,t,i){try{if(this.forceCookies||!("undefined"!=typeof sessionStorage&&sessionStorage||this.disableCookies))return this[t](this.prefix+".session."+i);if("undefined"!=typeof sessionStorage&&sessionStorage)return sessionStorage[e](this.prefix+"."+i)}catch(e){a.default.debug(r.CoreTag,"App Analytics needs sessionStorage or cookies, not supported by your browser.")}}getStorages(e){if(!this.disabled)return this.getSession(e)||this.getLocal(e)}setStorages(e,t){this.disabled||(this.setSession(e,t),this.setLocal(e,t))}removeStorages(e){this.disabled||(this.removeSession(e),this.removeLocal(e))}_setCookie(e,t){if("undefined"!=typeof document){let i=";";"undefined"!=typeof location&&(i+="domain="+location.host.split(".").reverse().splice(0,2).reverse().join(".")+";path=/;"),document.cookie=e+"="+t+i}}_getCookie(e){if("undefined"!=typeof document){let t=e+"=",i=decodeURIComponent(document.cookie).split(";");for(let e=0;e<i.length;e++){let s=i[e];for(;" "===s.charAt(0);)s=s.substring(1);if(0===s.indexOf(t))return s.substring(t.length,s.length)}}return null}_removeCookie(e){this._setCookie(e,"")}}class m{constructor(e,t){this.options=e,this.browserStorage=t}isEnabled(){return this.browserStorage.isEnabled()}setLocal(e,t){this.browserStorage.setLocal(e,t)}getLocal(e){return this.browserStorage.getLocal(e)}removeLocal(e){this.browserStorage.removeLocal(e)}getHost(){let e=this.options.getHost();const t=T.getInstance().getFastDataService();return!T.getInstance().isUsingLegacy()&&t&&t.getFastDataResponse()&&t.getFastDataResponse().host?e=t.getFastDataResponse().host:T.getInstance().isUsingLegacy()&&T.getInstance().getLegacyFastDataHost()&&(e=T.getInstance().getLegacyFastDataHost()),e}getSession(){let e=this.browserStorage.getStorages("session");if("undefined"===e&&(e=void 0),!e){const t=this.getStoredData();if(t)try{e=JSON.parse(t).q.c}catch(e){}}return e}getStorageHost(){let e=null;const t=this.getStoredData();if(t)try{e=JSON.parse(t).q.h}catch(e){}return e}getLocalAccountCode(){return this.browserStorage.getLocal("accCode")}getSessionAccountCode(){return this.browserStorage.getSession("accCode")}getAppAnalyticsRegisteredProperties(){return this.browserStorage.getLocal("appAnalyticsRegisteredProperties")}setAppAnalyticsRegisteredProperties(e){this.browserStorage.setLocal("appAnalyticsRegisteredProperties",e)}removeAppAnalyticsRegisteredProperties(){this.browserStorage.removeLocal("appAnalyticsRegisteredProperties")}getDataTime(){return this.browserStorage.getStorages("dataTime")}setDataTime(e){this.browserStorage.setStorages("dataTime",e)}getLastActive(){let e;return e=void 0===this.browserStorage.getLocal("lastactive")?0:Number(this.browserStorage.getLocal("lastactive")),e}setLastActive(e){this.browserStorage.setLocal("lastactive",e)}removeLastActive(){this.browserStorage.removeLocal("lastactive")}setSession(e){this.browserStorage.setStorages("session",e)}removeSession(){this.browserStorage.removeStorages("session")}getSessionExpire(){return 1e3*Number(this.browserStorage.getLocal("sessionExpire"))}getStoredData(){return this.browserStorage.getStorages("data")}setStoredData(e){this.browserStorage.setStorages("data",e)}removeStoredData(){this.browserStorage.removeStorages("data")}getStorages(e){return t=this,i=void 0,n=function*(){return this.browserStorage.getStorages(e)},new((s=void 0)||(s=Promise))((function(e,r){function a(e){try{c(n.next(e))}catch(e){r(e)}}function o(e){try{c(n.throw(e))}catch(e){r(e)}}function c(t){var i;t.done?e(t.value):(i=t.value,i instanceof s?i:new s((function(e){e(i)}))).then(a,o)}c((n=n.apply(t,i||[])).next())}));var t,i,s,n}}var v=i(6443),y=i(9907);class T{static getInstance(e,t,i){return this._instance&&!i||(this._instance=new T(e||"",t)),this._instance}constructor(e,t){var i,s,n,r;if(this.options=new l,this.sendingOffline=!1,this.isDestroyed=!1,this.usingLegacy=!1,this.commonVariables=new Map,this.registeredPeriodicPushes=new Map,this.coreEventListeners=[],this.pluginOptions=t,this.pluginOptions){this.pluginOptions.host&&this.options.setNpawPluginOptions({host:this.pluginOptions.host});const e=null!==(i="true"===y.env.IS_STANDALONE)&&void 0!==i&&i;this.usingLegacy=e&&null!==(r=void 0!==(null===(n=null===(s=this.pluginOptions)||void 0===s?void 0:s.legacyPlugin)||void 0===n?void 0:n.viewTransform))&&void 0!==r&&r}this.browserStorage=new g(this.options.disableCookies,this.options.forceCookies,this.options.disableStorage),this.coreStorage=new m(this.options,this.browserStorage),this.fastDataService=new c(this.options,e,this.coreStorage,this.browserStorage,this.pluginOptions),this.fastDataService.init(),this.nqsService=new f(this.options,this.coreStorage,this.fastDataService),this.deleteOldOfflineEntries()}destroy(){this.unregisterAllPeriodicPushes(),this.commonVariables.clear(),this.nqsService.destroy(),this.isDestroyed=!0}static getPluginVersion(){return`7.3.9${"true"===y.env.IS_STANDALONE?"-balancer":""}-nwf-js-sdk`}isUsingLegacy(){return this.usingLegacy}wasStartSent(){var e,t,i,s,n,r,a;return this.isUsingLegacy()?(null===(t=null===(e=this.pluginOptions)||void 0===e?void 0:e.legacyPlugin)||void 0===t?void 0:t._comm)&&(null===(s=null===(i=this.pluginOptions)||void 0===i?void 0:i.legacyPlugin)||void 0===s?void 0:s._comm.transforms)?null===(a=!(null===(r=null===(n=this.pluginOptions)||void 0===n?void 0:n.legacyPlugin)||void 0===r?void 0:r._comm.transforms[0]._isBusy))||void 0===a||a:void 0:this.nqsService.wasStartSent()}setLegacyPlugin(e){var t,i,s,n;if(this.pluginOptions){this.pluginOptions.legacyPlugin=e;const r=null!==(t="true"===y.env.IS_STANDALONE)&&void 0!==t&&t;this.usingLegacy=r&&null!==(n=void 0!==(null===(s=null===(i=this.pluginOptions)||void 0===i?void 0:i.legacyPlugin)||void 0===s?void 0:s.viewTransform))&&void 0!==n&&n}}setActiveSwitchingOnLegacy(e){e&&this.pluginOptions&&this.pluginOptions.legacyPlugin&&this.pluginOptions.legacyPlugin.options&&(this.pluginOptions.legacyPlugin.options["content.cdn"]="ACTVSWIT")}getViewCode(){var e;return null===(e=this.pluginOptions)||void 0===e?void 0:e.legacyPlugin.viewTransform.getViewCode()}getLegacyFastDataHost(){var e;return null===(e=this.pluginOptions)||void 0===e?void 0:e.legacyPlugin.viewTransform.response.host}setOptions(e){this.options.updateOptions(e),this.browserStorage.updateStorageOptions(this.options.disableCookies,this.options.forceCookies,this.options.disableStorage),this.fastDataService.updateOptions(e)}getOptions(){return this.options}getCoreStorage(){return this.coreStorage}registerCommonVariable(e,t,i){var s,n;this.commonVariables.has(e)?null===(s=this.commonVariables.get(e))||void 0===s||s.set(t,i):(this.commonVariables.set(e,new Map),null===(n=this.commonVariables.get(e))||void 0===n||n.set(t,i))}unregisterCommonVariable(e,t){var i;null===(i=this.commonVariables.get(e))||void 0===i||i.delete(t)}getCommonVariable(e,t){var i;return null===(i=this.commonVariables.get(e))||void 0===i?void 0:i.get(t)}getFastDataService(){return this.fastDataService}getFastDataSessionToken(){return this.fastDataService.getSession()}getFastDataSessionHost(){return this.coreStorage.getHost()}refreshSessionToken(){return this.usingLegacy?void 0:this.fastDataService.refreshSessionToken()}isSessionTokenExpired(){var e;const t=(new Date).getTime();return!this.usingLegacy&&t-(null!==(e=this.nqsService.getTimeOfLastSentRequest())&&void 0!==e?e:t)>1e3*this.fastDataService.getSessionExpireTime()}pushData(e,t,i,s,n,r){this.handleDataToSend(e,t,i,s,n,r)}pushPeriodicDataFromCallback(e,t,i,s,n,r,a,o,c){const d=setInterval((()=>{const t=r();t&&this.handleDataToSend(e,i,n,t,a,o,c)}),s<1e3?1e3:s);this.registeredPeriodicPushes.has(t)?(clearInterval(this.registeredPeriodicPushes.get(t)),this.registeredPeriodicPushes.set(t,d)):this.registeredPeriodicPushes.set(t,d)}unregisterPeriodicPush(e){clearInterval(this.registeredPeriodicPushes.get(e)),this.registeredPeriodicPushes.delete(e)}unregisterAllPeriodicPushes(){if(0===this.registeredPeriodicPushes.size)return;a.default.debug(r.CoreTag,`Unregistering ${this.registeredPeriodicPushes.size} periodic pushes`);const e=Array.from(this.registeredPeriodicPushes.keys());for(const t of e)clearInterval(this.registeredPeriodicPushes.get(t)),this.registeredPeriodicPushes.delete(t);a.default.debug(r.CoreTag,"Finished unregistering all pushes")}deleteOldOfflineEntries(){var e,t,i,s;const n=null!==(t=null===(e=this.coreStorage.getLocal("offlineViews"))||void 0===e?void 0:e.split(","))&&void 0!==t?t:[];for(const e of n){const t=null!==(s=null===(i=this.coreStorage.getLocal("offlineViews."+e))||void 0===i?void 0:i.split(","))&&void 0!==s?s:[],n=2592e6;t.length>0&&Date.now()-JSON.parse("["+t+"]")[0].timemark>n&&this.deleteViewDataFromLocalStorage(e)}}sendOfflineEvents(){var e,t,i,n,o,c;return i=this,n=void 0,c=function*(){if(this.options.offline)return void a.default.notice(r.AnalyticsTag,"Unable to send offline events because offline option is enabled");if(this.sendingOffline)return;this.sendingOffline=!0;let i=15,n=!1;for(;!n&&i-- >0;)""===this.getFastDataSessionToken()?yield new Promise((e=>setTimeout(e,100))):n=!0;if(i<1)return;const o=(null!==(t=null===(e=this.coreStorage.getLocal("offlineViews"))||void 0===e?void 0:e.split(","))&&void 0!==t?t:[]).map((e=>new Promise(((t,i)=>{var n;let a=null!==(n=this.coreStorage.getLocal("offlineViews."+e))&&void 0!==n?n:"";if(a=a.replace(/CODE_PLACEHOLDER/g,T.getInstance().getFastDataSessionToken()+"_"+e.split("_")[1]),a.length>0){const i=new u(!0,this.coreStorage.getHost(),s.A.Service.OFFLINE_EVENTS,r.Method.POST,{code:T.getInstance().getFastDataSessionToken()+"_"+e.split("_")[1]},(()=>{this.deleteViewDataFromLocalStorage(e),t()}),(()=>t()));i.setBody("["+a+"]"),i.send((function(){}))}}))));yield Promise.all(o).finally((()=>{this.sendingOffline=!1}))},new((o=void 0)||(o=Promise))((function(e,t){function s(e){try{a(c.next(e))}catch(e){t(e)}}function r(e){try{a(c.throw(e))}catch(e){t(e)}}function a(t){var i;t.done?e(t.value):(i=t.value,i instanceof o?i:new o((function(e){e(i)}))).then(s,r)}a((c=c.apply(i,n||[])).next())}))}deleteViewDataFromLocalStorage(e){var t,i;this.coreStorage.removeLocal("offlineViews."+e);const s=null!==(i=null===(t=this.coreStorage.getLocal("offlineViews"))||void 0===t?void 0:t.split(","))&&void 0!==i?i:[],n=s.indexOf(e);-1!=n&&s.splice(n,1),this.coreStorage.setLocal("offlineViews",s.toString())}handleDataToSend(e,t,i,n,r,a,o){if(!this.isDestroyed)switch(e){case v.default.Consumer.NQS:this.nqsService.send(t,i,n,r,a,o);break;case v.default.Consumer.PERSISTENT:if(void 0!==r&&r(),t===s.A.Service.VIDEO_PLUGIN_LOGS)break;if(t===s.A.Service.INIT)break;n.timemark=Date.now();const e=new u(this.options["app.https"],"",t,i,n,r,a),c=this.coreStorage.getLocal("offlineViews");if(c){const e=c.split(",");e.includes(n.code)||(e.push(n.code),this.coreStorage.setLocal("offlineViews",e.toString()))}else this.coreStorage.setLocal("offlineViews",n.code);const d=this.coreStorage.getLocal("offlineViews."+n.code);if(d){const t=d.split(",");t.push(e.toLocalStorageString()),this.coreStorage.setLocal("offlineViews."+n.code,t.toString())}else this.coreStorage.setLocal("offlineViews."+n.code,e.toLocalStorageString());break;case v.default.Consumer.BLACK_HOLE:void 0!==r&&r()}}subscribeListener(e){this.coreEventListeners.push(e)}throwEvent(e){if(!this.isDestroyed)for(const t of this.coreEventListeners)t(e)}}},194:e=>{e.exports={parsers:[{element:"name",headerName:null,regex:/(.+)/},{element:"host",headerName:null,regex:/(.+)/}]}},211:(e,t,i)=>{var s=i(7380),n=i(3598),r={getPosition:function(){return null},getGivenBreaks:function(){return null},getExpectedBreaks:function(){return null},getExpectedPattern:function(){return null},getBreaksTime:function(){return null},getGivenAds:function(){return null},getExpectedAds:function(){return null},getIsVisible:function(){return!0},getAudioEnabled:function(){return null},getIsSkippable:function(){return null},getIsFullscreen:function(){return null},getCampaign:function(){return null},getCreativeId:function(){return null},getProvider:function(){return null},getAdInsertionType:function(){return null},fireClick:function(e){"string"==typeof e&&(e={url:e}),this.emit(s.Event.CLICK,{params:e})},fireQuartile:function(e){this.flags.isStarted&&"number"==typeof e&&e>this.flags.lastQuartileSent&&e<4&&(this.flags.lastQuartileSent++,this.emit(s.Event.QUARTILE,{params:{quartile:e}}))},startChronoView:function(){if(this.getIsVisible()&&this.plugin.backgroundDetector&&!this.plugin.backgroundDetector.isInBackground){var e=this.chronos.viewedMax;0!==e.length&&0===e[e.length-1].stopTime||(e.push(new n),e[e.length-1].start())}},stopChronoView:function(){var e=this.chronos.viewedMax;e[0]&&e.length>0&&0===e[e.length-1].stopTime&&e[e.length-1].stop()},fireManifest:function(e,t){var i={params:e};"string"==typeof e&&(i={params:{errorType:e,errorMessage:t}}),this.emit(s.Event.MANIFEST,i)},fireSkip:function(e){void 0===e&&(e={}),e.skipped=!0,this.fireStop(e)},fireBreakStart:function(e){this.fireAdBreakStart(e)},fireBreakStop:function(e){this.fireAdBreakStop(e)},fireAdBreakStart:function(e){this.emit(s.Event.PODSTART,{params:e})},fireAdBreakStop:function(e){this.emit(s.Event.PODSTOP,{params:e})}};e.exports=r},232:e=>{var t=function(e){var i,s,n=(e=e||window).document,r=function(t){var i=!1;if(t.getBoundingClientRect){var s=t.getBoundingClientRect();(i={top:Math.max(s.top,0),left:Math.max(s.left,0),bottom:Math.min(s.bottom,e.innerHeight||n.documentElement.clientHeight),right:Math.min(s.right,e.innerWidth||n.documentElement.clientWidth)}).bottom<=i.top||i.right<=i.left?i=!1:i.area=(i.bottom-i.top)*(i.right-i.left)}return i},a=function(e,t){if(t){var i=r(e);i&&o.push({url:t,area:i.area,rect:i})}},o=[],c=[];try{var d=e.performance.timing.navigationStart;!function(){for(var i=n.getElementsByTagName("*"),s=/url\(.*(http.*)\)/gi,c=0;c<i.length;c++){var d=i[c],l=e.getComputedStyle(d);if("IMG"===d.tagName&&a(d,d.src),l["background-image"]){s.lastIndex=0;var u=s.exec(l["background-image"]);u&&u.length>1&&a(d,u[1].replace('"',""))}if("IFRAME"===d.tagName)try{var h=r(d);if(h){var p=t(d.contentWindow);p&&o.push({tm:p,area:h.area,rect:h})}}catch(e){}}}(),function(){for(var t={},i=e.performance.getEntriesByType("resource"),s=0;s<i.length;s++)t[i[s].name]=i[s].responseEnd;for(var n=0;n<o.length;n++)"tm"in o[n]||(o[n].tm=void 0!==t[o[n].url]?t[o[n].url]:0)}(),function(){"msFirstPaint"in e.performance.timing&&(i=e.performance.timing.msFirstPaint-d);for(var t=e.performance.getEntriesByType("paint"),s=0;s<t.length;s++)"first-paint"===t[s].name&&(i=t[s].startTime);if(void 0===i||i<0||i>12e4){i=e.performance.timing.responseStart-d;for(var r={},a=n.getElementsByTagName("head")[0].children,o=0;o<a.length;o++){var c=a[o];"SCRIPT"===c.tagName&&c.src&&!c.async&&(r[c.src]=!0),"LINK"===c.tagName&&"stylesheet"===c.rel&&c.href&&(r[c.href]=!0)}for(var l=e.performance.getEntriesByType("resource"),u=!1,h=0;h<l.length;h++)if(u||!r[l[h].name]||"script"!==l[h].initiatorType&&"link"!==l[h].initiatorType)u=!0;else{var p=l[h].responseEnd;(void 0===i||p>i)&&(i=p)}}i=Math.max(i,0)}(),function(){for(var t={0:0},s=0,r=0;r<o.length;r++){var a=i;"tm"in o[r]&&o[r].tm>i&&(a=o[r].tm),void 0===t[a]&&(t[a]=0),t[a]+=o[r].area,s+=o[r].area}var d=Math.max(n.documentElement.clientWidth,e.innerWidth||0)*Math.max(n.documentElement.clientHeight,e.innerHeight||0);if(d>0&&(d=.1*Math.max(d-s,0),void 0===t[i]&&(t[i]=0),t[i]+=d,s+=d),s){for(var l in t)t.hasOwnProperty(l)&&c.push({tm:l,area:t[l]});c.sort((function(e,t){return e.tm-t.tm}));for(var u=0,h=0;h<c.length;h++)u+=c[h].area,c[h].progress=u/s}}(),function(){if(c.length){s=0;for(var e=0,t=0,n=0;n<c.length;n++){var r=c[n].tm-e;r>0&&t<1&&(s+=(1-t)*r),e=c[n].tm,t=c[n].progress}}else s=i}()}catch(e){}return s};e.exports=t},525:(e,t)=>{"use strict";function i(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.freeze?t.freeze(e):e}var s=i({HTML:"text/html",isHTML:function(e){return e===s.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),n=i({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===n.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});t.find=function(e,t,i){if(void 0===i&&(i=Array.prototype),e&&"function"==typeof i.find)return i.find.call(e,t);for(var s=0;s<e.length;s++)if(Object.prototype.hasOwnProperty.call(e,s)){var n=e[s];if(t.call(void 0,n,s,e))return n}},t.freeze=i,t.MIME_TYPE=s,t.NAMESPACE=n},550:(e,t,i)=>{var s=i(1311),n=i(8538),r=function(){};r.prototype={constructor:function(){}},r.extend=function(e,t){var i,r=this;return i=e&&e.hasOwnProperty("constructor")?e.constructor:function(){return r.apply(this,arguments)},s(i,r,t),i.prototype=n(r.prototype),e&&s(i.prototype,e),i.prototype.constructor=i,i.__super__=r.prototype,i},e.exports=r},668:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});class s{constructor(){this.host="lma.npaw.com",this.components={},this.host="lma.npaw.com",this.components={}}}},694:e=>{e.exports={cdnName:"EDGECAST",parsers:[{element:"host",headerName:"Server",regex:/\((.+)\/.+\)/},{element:"type",headerName:"X-Cache",regex:/(.+)/}],parseType:function(e){return"HIT"===e?1:2}}},829:(e,t,i)=>{var s=i(1075);const{default:n}=i(3582),{AnalyticsTag:r}=i(9982);var a=s.extend({constructor:function(e){this.plugin=e,this.videos={}},existsVideo:function(e){return e=e||"default",!!this.videos[e]},getVideo:function(e){if(e=e||"default",this.videos[e])return this.videos[e]},setVideo:function(e){this.videos[this._parseVideoKey(e.getVideoKey())]=e},getVideoKeys:function(){return Object.keys(this.videos)},existsAdapter:function(e){return e=e||"default",!(!this.videos[e]||!this.videos[e]._adapter)},getAdapter:function(e){if(e=e||"default",this.videos[e])return this.videos[e].getAdapter()},setAdapter:function(e,t){t=t||"default",this.videos[t]&&this.videos[t].setAdapter(e,this.plugin)},getAdsAdapter:function(e){if(e=e||"default",this.videos[e])return this.videos[e].getAdsAdapter()},removeAdapter:function(e,t){t=t||"default";try{this.videos[t]&&this.videos[t].removeAdapter()}catch(e){n.error(r,"Is not possible to remove adapter for video: "+t)}},removeAllAdapters:function(){for(const e of Object.keys(this.videos))this.videos[e].removeAdapter(),this.videos[e].removeAdsAdapter()},sendRequest:function(e,t,i,s,a,o,c,d){e=e||"default",this.videos[e]?this.videos._send(this._key,t,i,s,a,o,c,d):n.error(r,"Can't send request for not existent video object")},updateAllOptions:function(e){for(const t in this.videos)for(const i in e)this.videos[t].options[i]=e[i];e["adapters.templates"]&&(this.plugin._setAdapterTemplates(e["adapters.templates"]),this.updateAdapterTemplates(e["adapters.templates"]))},updatePingInterval:function(e){for(var t in this.videos)this.videos[t]._ping.interval=e},updateAdapterTemplates:function(e){if(e&&this.videos)for(var t in this.videos)this.videos[t]._adapter&&this.videos[t]._adapter.updateAdapterTemplates(e)},resetVideo:function(e){e=e||"default",this.video[e]&&this.video[e]._reset()},_parseVideoKey:function(e){return e||"default"}});e.exports=a},859:e=>{e.exports={GET:"GET",POST:"POST"}},912:(e,t,i)=>{"use strict";i.d(t,{CE:()=>y,Ji:()=>w,LI:()=>E,Lg:()=>p,Ow:()=>g,Y4:()=>d,Zq:()=>I,_C:()=>A,b3:()=>T,dR:()=>b,df:()=>c,hj:()=>u,jQ:()=>S,m:()=>f,mH:()=>v,w2:()=>l,wc:()=>_,xC:()=>n,yL:()=>r,yl:()=>a,zU:()=>h});const s=m;!function(e){const t=m,i=e();for(;;)try{if(177842==parseInt(t(154))/1*(parseInt(t(172))/2)+-parseInt(t(130))/3*(parseInt(t(142))/4)+-parseInt(t(178))/5*(-parseInt(t(145))/6)+parseInt(t(173))/7+-parseInt(t(139))/8*(parseInt(t(176))/9)+parseInt(t(143))/10*(-parseInt(t(168))/11)+-parseInt(t(157))/12)break;i.push(i.shift())}catch(e){i.push(i.shift())}}(o);const n={CDN:s(132)},r={Success:"ok",Fail:s(144),Progress:"pr"},a={Updated:s(169),Success:"ok",Fail:s(144)};function o(){const e=["922QclZPR","376908OAxBXn",".srt",".ts","165474VgNLCR",".vtt","243170ffBWdt","CANCEL_SEGMENT_REQUEST","SEGMENT_ABSENT","data",".ssa","564363WcYplF","stage-smartswitchv2.youbora.com","/cdn","/decision",".cmfa","SEGMENTS_MAP","splits",".m4f",".webvtt","64SRZzgN",".mpd",".m4s","4vegxbL","10HrLJKo","nok","42eQAOkR","qa.npaw.com","stage.npaw.com","gnsnpaw.com","ping","optimizedFeedback",".mp4","command","data_spec_key","633wRiGze","pong",".ass","396984WxpvhF","PING",".dash","wss://p2p-tracker.youbora.com/webrtc","qualityPriority","identifier","size","close","PONG",".aac","SEGMENT_REQUEST","1539582CXfjeq","updated","random","keys"];return(o=function(){return e})()}const c={host:s(148),devHost:s(131),devDomains:[s(147),s(146)],service:s(133),decisionCallWaitTime:3e4,decisionReloadIntervalPerManifestMilliseconds:3e4},d=[s(151),s(141),s(175),".cmf",s(159),s(137),".cmfv"],l=[".m3u8",s(140)],u=[s(166),s(134)],h=[s(174),s(177),s(129),s(156),s(138)],p={connect:"connect",close:s(164),error:"error",data:s(181),ping:s(149),pong:s(155)},f={optimizedScore:"optimizedScore",optimizedFeedback:s(150),bestScore:"bestScore",qualityPriority:s(161),cdnPriority:"cdnPriority"},g={max:25e6,min:2e5,default:2e5};function m(e,t){const i=o();return(m=function(e,t){return i[e-=129]})(e,t)}s(170);const v={data:"SEGMENT_DATA",absent:s(180),map:s(135),newSegmentAvailable:"NEW_SEGMENT_AVAILABLE",request:s(167),cancel:s(179),ping:s(158),pong:s(165)},y={command:s(152),id:s(153),size:s(163),storageSize:"ss",map:s(171),identifier:s(162),splits:s(136),time:0,simpleMapKeys:"k",simpleMapSize:"s",dateTime:"dt",createdAt:"ca"},T={bandwidth_test:2,message:1,data:0},E={maxMessageSize:65532,probability:1,timeout:2500,maxConcurrency:6,maxConnectedPeers:40,tracker:s(160),upload:!1},S={version:2},b={expiration:3e5,count:60,safeMaxCount:300},A={retries:5,retryDelay:100,defaultBwThreshold:2e5,connectTimeoutMilliseconds:1e4,readTimeoutMilliseconds:3e3,minRequestSizeForBwEstimateKB:100},w={totalDataInterval:6e4},_={callTimeoutMilliseconds:500,timeBetweenCallsMilliseconds:1e3,timeBetweenBurstsMilliseconds:5e3},I={lastMeasurementWeight:.5,maximumRelativeDeltaForTrial:.2,minimumDurationSinceLastUsedForTrialMilliseconds:3e4,chunkExpirationProbingMs:6e4}},948:(e,t,i)=>{const{default:s}=i(4243);var n=i(5100);const r=i(2839),{default:a}=i(3582);var o=i(8661),c=i(2176);const{AnalyticsTag:d}=i(9982),{default:l}=i(6443),{default:u}=i(99);var h={_startListener:function(e){!this.plugin.options.enableExtraMetricCollection||this.lastKnownLocation||this.isFetchingLocation||this.fetchLocation(),this.isInitiated?0!==this.initChrono.startTime&&(this._adapter.chronos.join.startTime=this.initChrono.startTime):(this._viewIndex||this.plugin.getNextViewIndex(this),this._startPings());var t=e.data.params||{};s.getInstance().addNQSEvent(c.Event.START,t);var i=this.getResource()&&"boolean"==typeof this.getIsLive()&&(this.getIsLive()||"number"==typeof this.getDuration()&&this.getDuration()>0)&&this.getTitle(),r=u.getInstance().getCommonVariable(l.Products.BALANCER,l.BalancerVariables.DECISION_FINISHED);void 0===r&&(r=!0);var o=this.getChronosEventParam()||{};if(o&&Object.keys(o).length>0&&(t.chronos=o),this.plugin.resourceTransform&&this.getResource())try{if(this.plugin.resourceTransform.init(this.getResource()),this.plugin.resourceTransform.isBlocking()){var h=this.plugin.resourceTransform.getWaitParams();if(this.options.waitForMetadata=!0,h&&h.length>0){for(var p=this.options.pendingMetadata||[],f=0;f<h.length;f++)-1===p.indexOf(h[f])&&p.push(h[f]);this.options.pendingMetadata=p}else this.options.pendingMetadata=[]}}catch(e){}(i=!this.options.forceInit&&i&&this._isExtraMetadataReady()&&r&&this._isRequiredMetadataReady())&&!this.isInitiated?(s.getInstance().setTriedSendingNQSStats(!0),this._send(n.WillSendEvent.WILL_SEND_START,n.Service.START,t,void 0,void 0,(()=>{s.getInstance().addNQSRequest(n.Service.START)})),this._adSavedError(),this._adSavedManifest(),a.notice(d,"["+this.getViewCode()+"] (Video Space "+this.getVideoKey()+") "+n.Service.START+", title/res: "+(t.title||t.mediaResource)+(t.triggeredEvents?", eventsTriggered: "+t.triggeredEvents:"")),this.isStarted=!0):this.isInitiated||(this.isInitiated=!0,this._adapter.chronos.join.start(),s.getInstance().setTriedSendingNQSStats(!0),this._send(n.WillSendEvent.WILL_SEND_INIT,n.Service.INIT,t,void 0,void 0,(()=>{s.getInstance().addNQSRequest(n.Service.INIT)})),this._adSavedError(),this._adSavedManifest(),a.notice(d,"["+this.getViewCode()+"] (Video Space "+this.getVideoKey()+") "+n.Service.INIT+", title/res: "+(t.title||t.mediaResource)+(t.triggeredEvents?", eventsTriggered: "+t.triggeredEvents:""))),this.options.enableExtraMetricCollection&&this.shouldStartRenditionTimer()},_retryStart:function(e){var t=u.getInstance().getCommonVariable(l.Products.BALANCER,l.BalancerVariables.DECISION_FINISHED);void 0===t&&(t=!0),this._isExtraMetadataReady()&&t&&this._isRequiredMetadataReady()&&(this._send(n.WillSendEvent.WILL_SEND_START,n.Service.START,{triggeredEvents:["retryStart"]}),this.startDelayed=!1)},_joinListener:function(e){var t={};if(o.assign(t,e.data.params||{}),this._adsAdapter&&this._adsAdapter.flags.isStarted)this._adapter.monitor&&this._adapter.monitor.stop(),this._adapter.flags.isJoined=!1,this._adapter.chronos.join.stopTime=0;else{if(s.getInstance().addNQSEvent(c.Event.JOIN,t),this._adapter&&(this._adapter.chronos.join.startTime=Math.min(this._adapter.chronos.join.startTime+(this._totalPrerollsTime||0),(new Date).getTime()),this._totalPrerollsTime=0),this.isInitiated&&!this.isStarted){var i=u.getInstance().getCommonVariable(l.Products.BALANCER,l.BalancerVariables.DECISION_FINISHED);if(void 0===i&&(i=!0),this._isExtraMetadataReady()&&i&&this._isRequiredMetadataReady()){s.getInstance().setTriedSendingNQSStats(!0);var h=this.getChronosEventParam()||{};h&&Object.keys(h).length>0&&(t.chronos=h),this._send(n.WillSendEvent.WILL_SEND_START,n.Service.START,t,void 0,void 0,(()=>{s.getInstance().addNQSRequest(n.Service.START)}))}else this.startDelayed=!0;this._adSavedError(),this._adSavedManifest(),a.notice(d,"["+this.getViewCode()+"] (Video Space "+this.getVideoKey()+") "+n.Service.START+", title/res: "+(t.title||t.mediaResource)+(t.triggeredEvents?", eventsTriggered: "+t.triggeredEvents:"")),this.isStarted=!0}t=e.data.params||{},s.getInstance().addNQSEvent(r.JOIN_TIME,t),this._adsAdapter&&this.isBreakStarted&&this._adsAdapter.fireAdBreakStop(),s.getInstance().setTriedSendingNQSStats(!0),this._send(n.WillSendEvent.WILL_SEND_JOIN,n.Service.JOIN,t,void 0,void 0,(()=>{s.getInstance().addNQSRequest(n.Service.JOIN)})),this.resetChronos(),a.notice(d,"["+this.getViewCode()+"] (Video Space "+this.getVideoKey()+") "+n.Service.JOIN+", duration: "+t.joinDuration+"ms"+(t.triggeredEvents?", eventsTriggered: "+t.triggeredEvents:""))}},_advancedDataListener:function(e){var t=e.data.params||{};this._send(n.WillSendEvent.WILL_SEND_DATA_OBJECT,n.Service.DATA_OBJECT,t),a.notice(d,"["+this.getViewCode()+"] (Video Space "+this.getVideoKey()+") "+n.Service.DATA_OBJECT+(t.triggeredEvents?", eventsTriggered: "+t.triggeredEvents:""))},_pauseListener:function(e){this._adapter&&(this._adapter.flags.isBuffering||this._adapter.flags.isSeeking||this._adsAdapter&&this._adsAdapter.flags.isStarted)&&this._adapter.chronos.pause.reset();var t=e.data.params||{};s.getInstance().addNQSEvent(c.Event.PAUSE,t),this._send(n.WillSendEvent.WILL_SEND_PAUSE,n.Service.PAUSE,t),a.notice(d,"["+this.getViewCode()+"] (Video Space "+this.getVideoKey()+") "+n.Service.PAUSE+" at "+t.playhead+"s"+(t.triggeredEvents?", eventsTriggered: "+t.triggeredEvents:""))},_resumeListener:function(e){this._adsAdapter&&this.isBreakStarted&&!this._adsAdapter.flags.isStarted&&this._adsAdapter.fireAdBreakStop();var t=e.data.params||{};s.getInstance().addNQSEvent(c.Event.RESUME,t),this._send(n.WillSendEvent.WILL_SEND_RESUME,n.Service.RESUME,t),a.notice(d,"["+this.getViewCode()+"] (Video Space "+this.getVideoKey()+") "+n.Service.RESUME+", duration: "+t.pauseDuration+"ms"+(t.triggeredEvents?", eventsTriggered: "+t.triggeredEvents:"")),this._adapter.chronos.pause.reset()},_seekBufferBeginListener:function(e){this._adapter&&this._adapter.flags.isPaused&&this._adapter.chronos.pause.pause(),e.type&&e.type.includes("buffer")?(s.getInstance().addNQSEvent(c.Event.BUFFER_BEGIN,{}),a.notice(d,"["+this.getViewCode()+"] (Video Space "+this.getVideoKey()+") "+e.type+", eventsTriggered: "+this._adapter.fireEventsStruct.buffer)):(s.getInstance().addNQSEvent(c.Event.SEEK_BEGIN,{}),a.notice(d,"["+this.getViewCode()+"] (Video Space "+this.getVideoKey()+") "+e.type+", eventsTriggered: "+this._adapter.fireEventsStruct.seek))},_seekEndListener:function(e){var t=e.data.params||{};s.getInstance().addNQSEvent(c.Event.SEEK_END,t),this._send(n.WillSendEvent.WILL_SEND_SEEK,n.Service.SEEK,t),a.notice(d,"["+this.getViewCode()+"] (Video Space "+this.getVideoKey()+") "+n.Service.SEEK+" to "+t.playhead+" in "+t.seekDuration+"ms"+(t.triggeredEvents?", eventsTriggered: "+t.triggeredEvents:""))},_bufferEndListener:function(e){var t=e.data.params||{};(t=this.requestBuilder.fetchParams(t,["throughput"],!1,[this,this.plugin],this.options)).entities=this.requestBuilder.getChangedEntities([this,this.plugin],this.options),s.getInstance().addNQSEvent(c.Event.BUFFER_END,t),this._send(n.WillSendEvent.WILL_SEND_BUFFER,n.Service.BUFFER,t),a.notice(d,"["+this.getViewCode()+"] (Video Space "+this.getVideoKey()+") "+n.Service.BUFFER+" to "+t.playhead+" in "+t.bufferDuration+"ms"+(t.triggeredEvents?", eventsTriggered: "+t.triggeredEvents:""))},_errorListener:function(e){this._blockError(e.data.params)||(s.getInstance().addNQSEvent(c.Event.ERROR,e.data.params),this.fireError(e.data.params||{}),this._adSavedError(),this._adSavedManifest())},_blockError:function(e){var t=Date.now();return this._lastErrorParams&&this._lastErrorParams.errorCode===e.errorCode&&this._lastErrorParams.msg===e.msg&&this._lastErrorTime+5e3>t?(this._lastErrorTime=t,!0):(this._lastErrorTime=t,this._lastErrorParams=e,!1)},_stopListener:function(e){s.getInstance().addNQSEvent(c.Event.STOP,e.data.params);try{this.resetChronos(this._viewIndex||0)}catch(e){}this.fireStop(e.data.params||{})},_isStopReady:function(e){let t=!1;if(!this.requestBuilder.lastSent.live&&this._adsAdapter&&this._adapter&&(!this._adapter.getPlayhead()||this._adapter.getPlayhead()>=this.requestBuilder.lastSent.mediaDuration-1)){let e=0;const i=this.options["ad.expectedPattern"];if(i&&i.post&&i.post[0])e=i.post[0];else if(this.requestBuilder.lastSent.breaksTime){if(this.requestBuilder.lastSent.position===n.AdPosition.Postroll&&(e=this.requestBuilder.lastSent.givenAds),!e&&this.requestBuilder.lastSent.breaksTime){const t=this.requestBuilder.lastSent.breaksTime;t.length>0&&this.requestBuilder.lastSent.mediaDuration&&Math.round(t[t.length-1])+1>=this.requestBuilder.lastSent.mediaDuration&&(e=1)}}else t=!0;e<=this.playedPostrolls&&(t=!0)}else t=!0;return t},_videoEventListener:function(e){s.getInstance().addNQSEvent(c.Event.VIDEO_EVENT,e.data.params),this._send(n.WillSendEvent.WILL_SEND_VIDEO_EVENT,n.Service.VIDEO_EVENT,e.data.params)},_isExtraMetadataReady:function(e){if(!this.options.waitForMetadata||this.options.pendingMetadata.length<1)return!0;try{if(this._adapter.chronos.join.startTime>0)if((new Date).getTime()-this._adapter.chronos.join.startTime>=("number"==typeof this.options["waitForMetadata.timeout.milliseconds"]?this.options["waitForMetadata.timeout.milliseconds"]:n.Metadata.REQUIRED_METADATA_TIMEOUT))return!0;const e=this.requestBuilder.getGetters();return this.options.pendingMetadata.map(function(t){if(e.hasOwnProperty(t)){if(this[e[t]])return!!this[e[t]]();if(this.plugin[e[t]])return!!this.plugin[e[t]]()}}.bind(this)).indexOf(!1)<0}catch(e){a.warn("["+this.getViewCode()+"] (Video Space "+this.getVideoKey()+") Error processing isExtraMetadataReady method.")}return!0},_isRequiredMetadataReady:function(){if((new Date).getTime()-this._adapter.chronos.join.startTime<("number"==typeof this.options["waitForMetadata.timeout.milliseconds"]?this.options["waitForMetadata.timeout.milliseconds"]:n.Metadata.REQUIRED_METADATA_TIMEOUT)){try{const e=this.requestBuilder.getGetters();return this.requestBuilder.getRequiredMetadataParams().every(function(t){if(e.hasOwnProperty(t))if("function"==typeof this[e[t]]){const i=this[e[t]]();if(null!=i&&!Number.isNaN(i))return!0}else if(this.plugin&&"function"==typeof this.plugin[e[t]]){const i=this.plugin[e[t]]();if(null!=i&&!Number.isNaN(i))return!0}return!1}.bind(this))}catch(e){a.warn("["+this.getViewCode()+"] (Video Space "+this.getVideoKey()+") Error processing _isRequiredMetadataReady method.")}return!1}return!0}};e.exports=h},1048:(e,t,i)=>{"use strict";const s=i(7991),n=i(9318),r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=c,t.IS=50;const a=2147483647;function o(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,i){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return u(e)}return d(e,t,i)}function d(e,t,i){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const i=0|g(e,t);let s=o(i);const n=s.write(e,t);return n!==i&&(s=s.slice(0,n)),s}(e,t);if(ArrayBuffer.isView(e))return function(e){if(K(e,Uint8Array)){const t=new Uint8Array(e);return p(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer))return p(e,t,i);if("undefined"!=typeof SharedArrayBuffer&&(K(e,SharedArrayBuffer)||e&&K(e.buffer,SharedArrayBuffer)))return p(e,t,i);if("numb