@gumlet/insights-js-core 1.0.1
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.
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see gumlet-insights.min.js.LICENSE.txt */
|
|
2
|
+
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var a=e();for(var i in a)("object"==typeof exports?exports:t)[i]=a[i]}}(self,(()=>(()=>{var t={363:(t,e)=>{var a;a={VERSION:"2.4.0",Result:{SUCCEEDED:1,NOTRANSITION:2,CANCELLED:3,PENDING:4},Error:{INVALID_TRANSITION:100,PENDING_TRANSITION:200,INVALID_CALLBACK:300},WILDCARD:"*",ASYNC:"async",create:function(t,e){var i="string"==typeof t.initial?{state:t.initial}:t.initial,s=t.terminal||t.final,n=e||t.target||{},r=t.events||[],o=t.callbacks||{},l={},u={},E=function(t){var e=Array.isArray(t.from)?t.from:t.from?[t.from]:[a.WILDCARD];l[t.name]=l[t.name]||{};for(var i=0;i<e.length;i++)u[e[i]]=u[e[i]]||[],u[e[i]].push(t.name),l[t.name][e[i]]=t.to||e[i];t.to&&(u[t.to]=u[t.to]||[])};i&&(i.event=i.event||"startup",E({name:i.event,from:"none",to:i.state}));for(var c=0;c<r.length;c++)E(r[c]);for(var h in l)l.hasOwnProperty(h)&&(n[h]=a.buildEvent(h,l[h]));for(var h in o)o.hasOwnProperty(h)&&(n[h]=o[h]);return n.current="none",n.is=function(t){return Array.isArray(t)?t.indexOf(this.current)>=0:this.current===t},n.can=function(t){return!this.transition&&void 0!==l[t]&&(l[t].hasOwnProperty(this.current)||l[t].hasOwnProperty(a.WILDCARD))},n.cannot=function(t){return!this.can(t)},n.transitions=function(){return(u[this.current]||[]).concat(u[a.WILDCARD]||[])},n.isFinished=function(){return this.is(s)},n.error=t.error||function(t,e,a,i,s,n,r){throw r||n},n.states=function(){return Object.keys(u).sort()},i&&!i.defer&&n[i.event](),n},doCallback:function(t,e,i,s,n,r){if(e)try{return e.apply(t,[i,s,n].concat(r))}catch(e){return t.error(i,s,n,r,a.Error.INVALID_CALLBACK,"an exception occurred in a caller-provided callback function",e)}},beforeAnyEvent:function(t,e,i,s,n){return a.doCallback(t,t.onbeforeevent,e,i,s,n)},afterAnyEvent:function(t,e,i,s,n){return a.doCallback(t,t.onafterevent||t.onevent,e,i,s,n)},leaveAnyState:function(t,e,i,s,n){return a.doCallback(t,t.onleavestate,e,i,s,n)},enterAnyState:function(t,e,i,s,n){return a.doCallback(t,t.onenterstate||t.onstate,e,i,s,n)},changeState:function(t,e,i,s,n){return a.doCallback(t,t.onchangestate,e,i,s,n)},beforeThisEvent:function(t,e,i,s,n){return a.doCallback(t,t["onbefore"+e],e,i,s,n)},afterThisEvent:function(t,e,i,s,n){return a.doCallback(t,t["onafter"+e]||t["on"+e],e,i,s,n)},leaveThisState:function(t,e,i,s,n){return a.doCallback(t,t["onleave"+i],e,i,s,n)},enterThisState:function(t,e,i,s,n){return a.doCallback(t,t["onenter"+s]||t["on"+s],e,i,s,n)},beforeEvent:function(t,e,i,s,n){if(!1===a.beforeThisEvent(t,e,i,s,n)||!1===a.beforeAnyEvent(t,e,i,s,n))return!1},afterEvent:function(t,e,i,s,n){a.afterThisEvent(t,e,i,s,n),a.afterAnyEvent(t,e,i,s,n)},leaveState:function(t,e,i,s,n){var r=a.leaveThisState(t,e,i,s,n),o=a.leaveAnyState(t,e,i,s,n);return!1!==r&&!1!==o&&(a.ASYNC===r||a.ASYNC===o?a.ASYNC:void 0)},enterState:function(t,e,i,s,n){a.enterThisState(t,e,i,s,n),a.enterAnyState(t,e,i,s,n)},buildEvent:function(t,e){return function(){var i=this.current,s=e[i]||(e[a.WILDCARD]!=a.WILDCARD?e[a.WILDCARD]:i)||i,n=Array.prototype.slice.call(arguments);if(this.transition)return this.error(t,i,s,n,a.Error.PENDING_TRANSITION,"event "+t+" inappropriate because previous transition did not complete");if(this.cannot(t))return this.error(t,i,s,n,a.Error.INVALID_TRANSITION,"event "+t+" inappropriate in current state "+this.current);if(!1===a.beforeEvent(this,t,i,s,n))return a.Result.CANCELLED;if(i===s)return a.afterEvent(this,t,i,s,n),a.Result.NOTRANSITION;var r=this;this.transition=function(){return r.transition=null,r.current=s,a.enterState(r,t,i,s,n),a.changeState(r,t,i,s,n),a.afterEvent(r,t,i,s,n),a.Result.SUCCEEDED},this.transition.cancel=function(){r.transition=null,a.afterEvent(r,t,i,s,n)};var o=a.leaveState(this,t,i,s,n);return!1===o?(this.transition=null,a.Result.CANCELLED):a.ASYNC===o?a.Result.PENDING:this.transition?this.transition():void 0}}},t.exports&&(e=t.exports=a),e.StateMachine=a}},e={};function a(i){var s=e[i];if(void 0!==s)return s.exports;var n=e[i]={exports:{}};return t[i](n,n.exports,a),n.exports}a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},a.d=(t,e)=>{for(var i in e)a.o(e,i)&&!a.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}a.r(i),a.d(i,{default:()=>je});var e=function(){return(new Date).getTime()},s=function(t,e){var a,i=0;return function(){return i>=e||(a=t.apply(null,arguments),i++),a}};const n={validString:function(t){return null!=t&&"string"==typeof t},validBoolean:function(t){return null!=t&&"boolean"==typeof t},validNumber:function(t){return null!=t&&"number"==typeof t},sanitizePath:function(t){return t.replace(/\/$/g,"")},calculateTime:function(t){return t*=1e3,Math.round(t)},getCurrentTimestamp:e,getDurationFromTimestampToNow:function(t){return e()-t},uuidv4:function(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(t){return(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16).toUpperCase()}))},getCookie:function(t){for(var e=t+"=",a=document.cookie.split(";"),i=0;i<a.length;i++){for(var s=a[i];" "==s.charAt(0);)s=s.substring(1);if(0==s.indexOf(e))return s.substring(e.length,s.length)}return""},noOp:function(){},times:s,once:function(t){return s(t,1)},getHiddenProp:function(){var t=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var e=0;e<t.length;e++)if(t[e]+"Hidden"in document)return t[e]+"Hidden";return null},getCustomDataString:function e(a){return"object"===t(a)?JSON.stringify(a):"function"==typeof a?e(a()):void 0===a?a:"string"!=typeof a?String(a):a},jsonToQueryString:function(t){return"?"+Object.keys(t).map((function(e){return encodeURIComponent(e)+"="+encodeURIComponent(t[e])})).join("&")},currentDateTimeFormatString:function(){return(new Date).toISOString()}};function r(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}const o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,a,i;return e=t,a=[{key:"get",value:function(t,e,a){var i,s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=!1;window.XDomainRequest&&(r=!0),i=r?new window.XDomainRequest:new XMLHttpRequest;var o=function(){if(i.readyState==XMLHttpRequest.DONE){if(i.responseText<=0)return;var t=JSON.parse(i.responseText);a(t)}};r?i.onload=o:i.onreadystatechange=o,e.z=(new Date).getTime()/1e3;var l=[void 0,null,!1];Object.keys(e).forEach((function(t){return-1!==l.indexOf(e[t])&&delete e[t]})),Object.keys(e).forEach((function(t){return e[t]!=e[t]&&delete e[t]}));var u=n.jsonToQueryString(e);t+=u,i.open("GET",t,s),i.send(null)}}],a&&r(e.prototype,a),i&&r(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();var l="urn:x-cast:com.gumlet.ingest.cast",u="https://ingest.gumlytics.com",E=1e4;function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function h(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function S(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function m(t,e){return m=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},m(t,e)}function d(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var a,i=p(t);if(e){var s=p(this).constructor;a=Reflect.construct(i,arguments,s)}else a=i.apply(this,arguments);return f(this,a)}}function f(t,e){if(e&&("object"===c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return A(t)}function A(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function p(t){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},p(t)}function y(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}var N=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&m(t,e)}(n,t);var e,a,i,s=d(n);function n(){var t;S(this,n);for(var e=arguments.length,a=new Array(e),i=0;i<e;i++)a[i]=arguments[i];return y(A(t=s.call.apply(s,[this].concat(a))),"sendRequest",(function(t,e,a,i){var s={key:t,domain:e,analyticsVersion:a};this.get(n.licenseServerUrl,s,i)})),t}return e=n,a&&h(e.prototype,a),i&&h(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}(o);y(N,"licenseServerUrl",u+"/licensing");function _(t){return _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_(t)}function I(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function v(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function T(t,e){return T=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},T(t,e)}function D(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var a,i=P(t);if(e){var s=P(this).constructor;a=Reflect.construct(i,arguments,s)}else a=i.apply(this,arguments);return g(this,a)}}function g(t,e){if(e&&("object"===_(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return U(t)}function U(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function P(t){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},P(t)}function C(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}var G=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&T(t,e)}(n,t);var e,a,i,s=D(n);function n(){var t;v(this,n);for(var e=arguments.length,a=new Array(e),i=0;i<e;i++)a[i]=arguments[i];return C(U(t=s.call.apply(s,[this].concat(a))),"sendRequest",(function(t,e){t.event_family="session_event",this.get(n.analyticsServerUrl,t,e)})),C(U(t),"sendRequestSynchronous",(function(t,e){t.event_family="session_event",this.get(n.analyticsServerUrl,t,e,!1)})),C(U(t),"getAnalyticsServerUrl",(function(){return n.analyticsServerUrl})),t}return e=n,a&&I(e.prototype,a),i&&I(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}(o);C(G,"analyticsServerUrl",u);const b=G;function R(t){return R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R(t)}function L(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function Y(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function F(t,e){return F=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},F(t,e)}function k(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var a,i=M(t);if(e){var s=M(this).constructor;a=Reflect.construct(i,arguments,s)}else a=i.apply(this,arguments);return O(this,a)}}function O(t,e){if(e&&("object"===R(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return w(t)}function w(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function M(t){return M=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},M(t)}function H(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}var K=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&F(t,e)}(n,t);var e,a,i,s=k(n);function n(){var t;Y(this,n);for(var e=arguments.length,a=new Array(e),i=0;i<e;i++)a[i]=arguments[i];return H(w(t=s.call.apply(s,[this].concat(a))),"sendRequest",(function(t,e){t.event_family="session",this.get(n.analyticsServerUrl,t,e)})),H(w(t),"sendRequestSynchronous",(function(t,e){t.event_family="session",this.get(n.analyticsServerUrl,t,e,!1)})),H(w(t),"getAnalyticsServerUrl",(function(){return n.analyticsServerUrl})),t}return e=n,a&&L(e.prototype,a),i&&L(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}(o);H(K,"analyticsServerUrl",u);const V=K;function B(t){return B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B(t)}function j(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function Q(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function W(t,e){return W=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},W(t,e)}function x(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var a,i=z(t);if(e){var s=z(this).constructor;a=Reflect.construct(i,arguments,s)}else a=i.apply(this,arguments);return q(this,a)}}function q(t,e){if(e&&("object"===B(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return J(t)}function J(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function z(t){return z=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},z(t)}function X(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}var Z=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&W(t,e)}(n,t);var e,a,i,s=x(n);function n(){var t;Q(this,n);for(var e=arguments.length,a=new Array(e),i=0;i<e;i++)a[i]=arguments[i];return X(J(t=s.call.apply(s,[this].concat(a))),"sendRequest",(function(t,e){t.event_family="player_init",this.get(n.analyticsServerUrl,t,e)})),X(J(t),"sendRequestSynchronous",(function(t,e){t.event_family="player_init",this.get(n.analyticsServerUrl,t,e,!1)})),X(J(t),"getAnalyticsServerUrl",(function(){return n.analyticsServerUrl})),t}return e=n,a&&j(e.prototype,a),i&&j(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}(o);X(Z,"analyticsServerUrl",u);const $=Z;function tt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function et(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function at(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const it=new(function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];tt(this,t),at(this,"log",(function(t){this.showLogs&&console.log(t)})),at(this,"error",(function(t){this.showLogs&&console.error(t)})),at(this,"warning",(function(t){this.showLogs&&console.warn(t)})),this.showLogs=e}var e,a,i;return e=t,(a=[{key:"setLogging",value:function(t){this.showLogs=t}},{key:"isLogging",value:function(){return this.showLogs}}])&&et(e.prototype,a),i&&et(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}());function st(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function nt(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}var rt=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,a,i;return e=t,i=[{key:"isShaka",value:function(t){return!!window.shaka&&"function"==typeof shaka.Player&&t.constructor===shaka.Player}},{key:"isDashjs",value:function(t){return"function"==typeof t.addABRCustomRule}},{key:"isHlsjs",value:function(t){return!!window.Hls&&"function"==typeof window.Hls&&t.constructor===window.Hls}}],(a=null)&&st(e.prototype,a),i&&st(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();nt(rt,"isBitmovinVersionPre7",(function(t){return!rt.isDashjs(t)&&("function"==typeof t.getVersion&&t.getVersion()<"7")})),nt(rt,"isBitmovinVersion7Plus",(function(t){return"string"==typeof t.version&&t.version>="7"})),nt(rt,"isVideoJs",(function(t){return"function"==typeof videojs&&videojs(t.id_)===t}));const ot=rt;const lt={READY:"ready",STARTUP:"startup",SOURCE_LOADED:"sourceLoaded",PLAY:"play",PAUSE:"pause",TIMECHANGED:"timechanged",SEEK:"seek",SEEKED:"seeked",START_CAST:"startCasting",END_CAST:"endCasting",START_BUFFERING:"startBuffering",END_BUFFERING:"endBuffering",AUDIO_CHANGE:"audioChange",VIDEO_CHANGE:"videoChange",START_FULLSCREEN:"startFullscreen",END_FULLSCREEN:"endFullscreen",START_AD:"adStart",END_AD:"adEnd",MUTE:"mute",UN_MUTE:"unMute",ERROR:"playerError",PLAYBACK_FINISHED:"end",SCREEN_RESIZE:"resize",UNLOAD:"unload",END:"end",METADATA_LOADED:"metadataLoaded",SOURCE_UNLOADED:"sourceUnloaded",PLAYBACK_PLAYING:"playback_playing"};function ut(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}const Et=function(){function t(e,a){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.onBeforeUnLoadEvent=!1,this.player=e,this.eventCallback=a,this.register()}var e,a,i;return e=t,(a=[{key:"register",value:function(){var t=this;this.player.addEventHandler(this.player.EVENT.ON_SOURCE_LOADED,(function(){t.eventCallback(lt.SOURCE_LOADED)})),this.player.addEventHandler(this.player.EVENT.ON_READY,(function(){var e=!1;t.player.getConfig().playback&&t.player.getConfig().playback.autoplay&&(e=t.player.getConfig().playback.autoplay),t.eventCallback(lt.READY,{isLive:t.player.isLive(),version:t.player.getVersion(),type:t.player.getPlayerType(),duration:t.player.getDuration(),streamType:t.player.getStreamType(),videoId:t.player.getConfig().source.videoId,userId:t.player.getConfig().source.userId,mpdUrl:t.player.getConfig().source.dash,m3u8Url:t.player.getConfig().source.hls,progUrl:t.player.getConfig().source.progressive,videoWindowWidth:t.player.getFigure().offsetWidth,videoWindowHeight:t.player.getFigure().offsetHeight,isMuted:t.player.isMuted(),autoplay:e})})),this.player.addEventHandler(this.player.EVENT.ON_CAST_START,(function(){t.eventCallback(lt.START_CAST)})),this.player.addEventHandler(this.player.EVENT.ON_CAST_STOP,(function(){t.eventCallback(lt.END_CAST)})),this.player.addEventHandler(this.player.EVENT.ON_PLAY,(function(){t.eventCallback(lt.PLAY,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames()})})),this.player.addEventHandler(this.player.EVENT.ON_PAUSE,(function(){t.eventCallback(lt.PAUSE,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames()})})),this.player.addEventHandler(this.player.EVENT.ON_TIME_CHANGED,(function(){t.eventCallback(lt.TIMECHANGED,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames()})})),this.player.addEventHandler(this.player.EVENT.ON_SEEK,(function(){t.eventCallback(lt.SEEK,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames()})})),this.player.addEventHandler(this.player.EVENT.ON_SEEKED,(function(){t.eventCallback(lt.SEEKED,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames()})})),this.player.addEventHandler(this.player.EVENT.ON_START_BUFFERING,(function(){t.eventCallback(lt.START_BUFFERING)})),this.player.addEventHandler(this.player.EVENT.ON_STOP_BUFFERING,(function(){t.eventCallback(lt.END_BUFFERING,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames()})})),this.player.addEventHandler(this.player.EVENT.ON_AUDIO_PLAYBACK_QUALITY_CHANGE,(function(){var e=t.player.getPlaybackAudioData();t.eventCallback(lt.AUDIO_CHANGE,{bitrate:e.bitrate,currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames()})})),this.player.addEventHandler(this.player.EVENT.ON_VIDEO_PLAYBACK_QUALITY_CHANGE,(function(){var e=t.player.getPlaybackVideoData();t.eventCallback(lt.VIDEO_CHANGE,{width:e.width,height:e.height,bitrate:e.bitrate,currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames()})})),this.player.addEventHandler(this.player.EVENT.ON_FULLSCREEN_ENTER,(function(){t.eventCallback(lt.START_FULLSCREEN,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames()})})),this.onBeforeUnLoadEvent=!1,this.player.addEventHandler(this.player.EVENT.ON_FULLSCREEN_EXIT,(function(){t.eventCallback(lt.END_FULLSCREEN,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames()})})),this.player.addEventHandler(this.player.EVENT.ON_AD_STARTED,(function(){t.eventCallback(lt.START_AD,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames()})})),this.player.addEventHandler(this.player.EVENT.ON_AD_FINISHED,(function(){t.eventCallback(lt.END_AD,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames()})})),this.player.addEventHandler(this.player.EVENT.ON_MUTE,(function(){t.eventCallback(lt.MUTE,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames()})})),this.player.addEventHandler(this.player.EVENT.ON_UNMUTE,(function(){t.eventCallback(lt.UN_MUTE,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames()})})),this.player.addEventHandler(this.player.EVENT.ON_ERROR,(function(e){t.eventCallback(lt.ERROR,{code:e.code,message:e.message})})),this.player.addEventHandler(this.player.EVENT.ON_PLAYBACK_FINISHED,(function(){t.eventCallback(lt.PLAYBACK_FINISHED,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames()})})),"undefined"!=typeof window?window.onunload=window.onbeforeunload=function(){t.onBeforeUnLoadEvent||(t.onBeforeUnLoadEvent=!0,t.eventCallback(lt.UNLOAD,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames()}))}:this.onBeforeUnLoadEvent||(this.onBeforeUnLoadEvent=!0,this.eventCallback(lt.UNLOAD,{currentTime:this.player.getCurrentTime(),droppedFrames:this.player.getDroppedFrames()}))}}])&&ut(e.prototype,a),i&&ut(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ht(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}const St=function(){function t(e,a){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.onBeforeUnLoadEvent=!1,this.player=e,this.eventCallback=a,this.register()}var e,a,i;return e=t,(a=[{key:"register",value:function(){var t=this,e=function(e){if(!e)return{progUrl:void 0,progBitrate:void 0};if("string"==typeof e)return{progUrl:e,progBitrate:0};if(Array.isArray(e)){var a=t.player.getPlaybackVideoData(),i=parseInt(a.id)||0;return{progUrl:e[i].url,progBitrate:e[i].bitrate||0}}return"object"===ct(e)?{progUrl:e.url,progBitrate:e.bitrate||0}:void 0};this.player.addEventHandler(this.player.EVENT.ON_SOURCE_UNLOADED,(function(e){t.eventCallback(lt.SOURCE_UNLOADED,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames()})})),this.player.addEventHandler(this.player.EVENT.ON_SOURCE_LOADED,(function(a){var i=!1;t.player.getConfig().playback&&t.player.getConfig().playback.autoplay&&(i=t.player.getConfig().playback.autoplay);var s=t.player.getConfig(),n={},r=e(s.source.progressive);s.source&&(n={mpdUrl:s.source.dash,m3u8Url:s.source.hls,progUrl:r.progUrl,progBitrate:r.progBitrate}),t.eventCallback(lt.SOURCE_LOADED,{isLive:t.player.isLive(),version:t.player.version,type:t.player.getPlayerType(),duration:t.player.getDuration(),streamType:t.player.getStreamType(),mpdUrl:n.mpdUrl,m3u8Url:n.m3u8Url,progUrl:n.progUrl,progBitrate:n.progBitrate,videoWindowWidth:t.player.getFigure().offsetWidth,videoWindowHeight:t.player.getFigure().offsetHeight,isMuted:t.player.isMuted(),autoplay:i})})),this.player.addEventHandler(this.player.EVENT.ON_READY,(function(){var a=!1;t.player.getConfig().playback&&t.player.getConfig().playback.autoplay&&(a=t.player.getConfig().playback.autoplay);var i=t.player.getConfig(),s={},n=e(i.source.progressive);i.source&&(s={videoId:i.source.videoId,userId:i.source.userId,mpdUrl:i.source.dash,m3u8Url:i.source.hls,progUrl:n.progUrl,progBitrate:n.progBitrate});var r=!0;null!=t.player.getConfig().adaptation.preload&&"boolean"==typeof t.player.getConfig().adaptation.preload&&(r=t.player.getConfig().adaptation.preload);var o=t.player.getAudio();o||(o="undetected"),t.eventCallback(lt.READY,{isLive:t.player.isLive(),version:t.player.version,type:t.player.getPlayerType(),duration:t.player.getDuration(),streamType:t.player.getStreamType(),videoId:s.videoId,userId:s.userId,mpdUrl:s.mpdUrl,m3u8Url:s.m3u8Url,progUrl:s.progUrl,progBitrate:s.progBitrate,videoWindowWidth:t.player.getFigure().offsetWidth,videoWindowHeight:t.player.getFigure().offsetHeight,isMuted:t.player.isMuted(),preload:r,audioLanguage:o,isFullScreen:t.player.isFullscreen(),autoplay:a})})),this.player.addEventHandler(this.player.EVENT.ON_CAST_STARTED,(function(e){t.eventCallback(lt.START_CAST,e)})),this.player.addEventHandler(this.player.EVENT.ON_CAST_STOPPED,(function(){t.eventCallback(lt.END_CAST,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames(),currentVideoData:t.player.getPlaybackVideoData(),isFullScreen:t.player.isFullscreen(),isCasting:t.player.isCasting()})})),this.player.addEventHandler(this.player.EVENT.ON_PLAY,(function(){t.eventCallback(lt.PLAY,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames(),currentVideoData:t.player.getPlaybackVideoData(),isFullScreen:t.player.isFullscreen(),isCasting:t.player.isCasting()})})),this.player.addEventHandler(this.player.EVENT.ON_PAUSED,(function(){t.eventCallback(lt.PAUSE,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames(),currentVideoData:t.player.getPlaybackVideoData(),isFullScreen:t.player.isFullscreen(),isCasting:t.player.isCasting()})})),this.player.addEventHandler(this.player.EVENT.ON_TIME_CHANGED,(function(){t.eventCallback(lt.TIMECHANGED,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames(),currentVideoData:t.player.getPlaybackVideoData(),isFullScreen:t.player.isFullscreen(),isCasting:t.player.isCasting()})})),this.player.addEventHandler(this.player.EVENT.ON_SEEK,(function(){t.eventCallback(lt.SEEK,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames(),currentVideoData:t.player.getPlaybackVideoData(),isFullScreen:t.player.isFullscreen(),isCasting:t.player.isCasting()})})),this.player.addEventHandler(this.player.EVENT.ON_SEEKED,(function(){t.eventCallback(lt.SEEKED,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames(),currentVideoData:t.player.getPlaybackVideoData(),isFullScreen:t.player.isFullscreen(),isCasting:t.player.isCasting()})})),this.player.addEventHandler(this.player.EVENT.ON_STALL_STARTED,(function(){t.eventCallback(lt.START_BUFFERING,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames(),currentVideoData:t.player.getPlaybackVideoData(),isFullScreen:t.player.isFullscreen(),isCasting:t.player.isCasting()})})),this.player.addEventHandler(this.player.EVENT.ON_STALL_ENDED,(function(){t.eventCallback(lt.END_BUFFERING,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames(),currentVideoData:t.player.getPlaybackVideoData(),isFullScreen:t.player.isFullscreen(),isCasting:t.player.isCasting()})})),this.player.addEventHandler(this.player.EVENT.ON_AUDIO_PLAYBACK_QUALITY_CHANGED,(function(){var e=t.player.getPlaybackAudioData();t.eventCallback(lt.AUDIO_CHANGE,{bitrate:e.bitrate,currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames(),currentVideoData:t.player.getPlaybackVideoData(),isFullScreen:t.player.isFullscreen(),isCasting:t.player.isCasting()})})),this.player.addEventHandler(this.player.EVENT.ON_VIDEO_PLAYBACK_QUALITY_CHANGED,(function(){var e=t.player.getPlaybackVideoData();t.eventCallback(lt.VIDEO_CHANGE,{width:e.width,height:e.height,bitrate:e.bitrate,currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames(),currentVideoData:t.player.getPlaybackVideoData(),isFullScreen:t.player.isFullscreen(),isCasting:t.player.isCasting()})})),this.player.addEventHandler(this.player.EVENT.ON_FULLSCREEN_ENTER,(function(){t.eventCallback(lt.START_FULLSCREEN,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames(),currentVideoData:t.player.getPlaybackVideoData(),isFullScreen:t.player.isFullscreen(),isCasting:t.player.isCasting()})})),this.player.addEventHandler(this.player.EVENT.ON_FULLSCREEN_EXIT,(function(){t.eventCallback(lt.END_FULLSCREEN,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames(),currentVideoData:t.player.getPlaybackVideoData(),isFullScreen:t.player.isFullscreen(),isCasting:t.player.isCasting()})})),this.player.addEventHandler(this.player.EVENT.ON_AD_STARTED,(function(){t.eventCallback(lt.START_AD,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames(),currentVideoData:t.player.getPlaybackVideoData(),isFullScreen:t.player.isFullscreen(),isCasting:t.player.isCasting()})})),this.player.addEventHandler(this.player.EVENT.ON_AD_FINISHED,(function(){t.eventCallback(lt.END_AD,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames(),currentVideoData:t.player.getPlaybackVideoData(),isFullScreen:t.player.isFullscreen(),isCasting:t.player.isCasting()})})),this.player.addEventHandler(this.player.EVENT.ON_MUTED,(function(){t.eventCallback(lt.MUTE,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames(),currentVideoData:t.player.getPlaybackVideoData(),isFullScreen:t.player.isFullscreen(),isCasting:t.player.isCasting()})})),this.player.addEventHandler(this.player.EVENT.ON_UNMUTED,(function(){t.eventCallback(lt.UN_MUTE,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames(),currentVideoData:t.player.getPlaybackVideoData(),isFullScreen:t.player.isFullscreen(),isCasting:t.player.isCasting()})})),this.player.addEventHandler(this.player.EVENT.ON_ERROR,(function(e){t.eventCallback(lt.ERROR,{code:e.code,message:e.message,currentTime:t.player.getCurrentTime()})})),this.player.addEventHandler(this.player.EVENT.ON_PLAYBACK_FINISHED,(function(){t.eventCallback(lt.PLAYBACK_FINISHED,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames()})})),"undefined"!=typeof window?window.onunload=window.onbeforeunload=function(){t.onBeforeUnLoadEvent||(t.onBeforeUnLoadEvent=!0,t.eventCallback(lt.UNLOAD,{currentTime:t.player.getCurrentTime(),droppedFrames:t.player.getDroppedFrames()}))}:this.onBeforeUnLoadEvent||(this.onBeforeUnLoadEvent=!0,this.eventCallback(lt.UNLOAD,{currentTime:this.player.getCurrentTime(),droppedFrames:this.player.getDroppedFrames()}))}}])&&ht(e.prototype,a),i&&ht(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();function mt(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,i)}return a}function dt(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?mt(Object(a),!0).forEach((function(e){ft(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):mt(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}function ft(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function At(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}const pt=function(){function t(e,a,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.onBeforeUnLoadEvent=!1,this.player=e,this.eventCallback=a,this.stateMachine=i,this.register()}var e,a,i;return e=t,(a=[{key:"getStreamType",value:function(t){return t.endsWith(".m3u8")?"hls":t.endsWith(".mpd")?"dash":"progressive"}},{key:"getStreamSources",value:function(t){var e=null,a=null,i=null;switch(this.getStreamType(t)){case"hls":a=t;break;case"dash":e=t;break;default:i=t}return{mpdUrl:e,m3u8Url:a,progUrl:i}}},{key:"getVideoWindowDimensions",value:function(t){return{width:t.el_.clientWidth,height:t.el_.clientHeight}}},{key:"getVideoSourceDimensions",value:function(t){return{videoWidth:t.videoWidth(),videoHeight:t.videoHeight()}}},{key:"getVideojsSourceHandlerMode_",value:function(){var t=this.player.tech({IWillNotUseThisInPlugins:!0});return t.sourceHandler_?t.sourceHandler_.options_.mode:"native"}},{key:"register",value:function(){var t,e,a=this,i=this;this.player.on("loadedmetadata",(function(){var t=i.getStreamType(this.currentSrc()),e=i.getStreamSources(this.currentSrc()),a=i.getVideojsSourceHandlerMode_(),s=dt(dt(dt({isLive:this.duration()===1/0,version:videojs.VERSION,type:a,duration:this.duration(),streamType:t,autoplay:this.autoplay()},e),i.getVideoWindowDimensions(this)),{},{videoWindowWidth:this.videoWidth(),videoWindowHeight:this.videoHeight(),muted:this.muted()});i.stateMachine.updateMetadata(s),i.eventCallback(lt.SOURCE_LOADED,s)})),this.player.on("loadeddata",(function(){console.log("here")})),this.player.ready((function(){var t=i.getStreamType(this.currentSrc()),e=i.getStreamSources(this.currentSrc()),a=i.getVideojsSourceHandlerMode_(),s=i.getVideoWindowDimensions(this),n={width:null,height:null,bitrate:null};if(this.tech_.hls){var r=this.tech_.hls.playlists.media();if(r){var o=r.attributes;n.bitrate=o.BANDWIDTH,n.width=o.RESOLUTION.width,n.height=o.RESOLUTION.height}}var l=dt(dt(dt({isLive:!1,version:videojs.VERSION,type:a,duration:this.duration(),streamType:t,autoplay:this.autoplay()},e),i.getVideoWindowDimensions(this)),{},{videoWindowWidth:s.width,videoWindowHeight:s.height,muted:this.muted(),currentVideoData:n});i.eventCallback(lt.READY,l)})),this.player.on("play",(function(){var t={width:null,height:null,bitrate:null};if(this.tech_.hls){var e=this.tech_.hls.playlists.media();if(e){var a=e.attributes;t.bitrate=a.BANDWIDTH,t.width=a.RESOLUTION.width,t.height=a.RESOLUTION.height}}i.eventCallback(lt.PLAY,{currentTime:this.currentTime(),currentVideoData:t})})),this.player.on("pause",(function(){var t={width:null,height:null,bitrate:null};if(this.tech_.hls){var e=this.tech_.hls.playlists.media();if(e){var a=e.attributes;t.bitrate=a.BANDWIDTH,t.width=a.RESOLUTION.width,t.height=a.RESOLUTION.height}}i.eventCallback(lt.PAUSE,{currentTime:this.currentTime(),currentVideoData:t})})),this.player.on("ended",(function(){var t={width:null,height:null,bitrate:null};if(this.tech_.hls){var e=this.tech_.hls.playlists.media();if(e){var a=e.attributes;t.bitrate=a.BANDWIDTH,t.width=a.RESOLUTION.width,t.height=a.RESOLUTION.height}}i.eventCallback(lt.END,{currentTime:this.currentTime()})})),this.player.on("error",(function(){var t={width:null,height:null,bitrate:null};if(this.tech_.hls){var e=this.tech_.hls.playlists.media();if(e){var a=e.attributes;t.bitrate=a.BANDWIDTH,t.width=a.RESOLUTION.width,t.height=a.RESOLUTION.height}}var s=this.error();i.eventCallback(lt.ERROR,{currentTime:this.currentTime(),code:s.code,message:s.message})})),this.player.on("volumechange",(function(){var t={width:null,height:null,bitrate:null};if(this.tech_.hls){var e=this.tech_.hls.playlists.media();if(e){var a=e.attributes;t.bitrate=a.BANDWIDTH,t.width=a.RESOLUTION.width,t.height=a.RESOLUTION.height}}this.muted()?i.eventCallback(lt.MUTE,{currentTime:this.currentTime(),currentVideoData:t}):i.eventCallback(lt.UN_MUTE,{currentTime:this.currentTime(),currentVideoData:t})})),this.player.on("seeking",(function(){var t={width:null,height:null,bitrate:null};if(this.tech_.hls){var e=this.tech_.hls.playlists.media();if(e){var a=e.attributes;t.bitrate=a.BANDWIDTH,t.width=a.RESOLUTION.width,t.height=a.RESOLUTION.height}}i.eventCallback(lt.SEEK,{currentTime:this.currentTime(),droppedFrames:0,currentVideoData:t})})),this.player.on("seeked",(function(){var t={width:null,height:null,bitrate:null};if(this.tech_.hls){var e=this.tech_.hls.playlists.media();if(e){var a=e.attributes;t.bitrate=a.BANDWIDTH,t.width=a.RESOLUTION.width,t.height=a.RESOLUTION.height}}i.eventCallback(lt.SEEKED,{currentTime:this.currentTime(),droppedFrames:0,currentVideoData:t})})),Date.now();var s=!1;this.player.on("timeupdate",(function(){var a=this;clearTimeout(e),s=!1,Date.now();var n={width:null,height:null,bitrate:null},r=null;if(this.tech_.hls&&(r=this.tech_.hls.playlists.media())){var o=r.attributes;n.bitrate=o.BANDWIDTH,n.width=o.RESOLUTION.width,n.height=o.RESOLUTION.height}if(i.eventCallback(lt.TIMECHANGED,{currentTime:this.currentTime(),currentVideoData:n}),r){var l=r.attributes,u=l.BANDWIDTH,E=l.RESOLUTION.width,c=l.RESOLUTION.height;if(t!==u){var h={width:E,height:c,bitrate:u,currentTime:this.currentTime(),currentVideoData:n};i.eventCallback(lt.VIDEO_CHANGE,h),t=u}if(e=setTimeout((function(){(!a.paused()&&!a.ended()||s)&&i.eventCallback(lt.START_BUFFERING,{currentTime:a.currentTime()})}),1e3),this.tech({IWillNotUseThisInPlugins:!0}).hls){var S=this.tech_.hls;if(!S.playlists||"function"!=typeof S.playlists.media)return;var m=S.playlists.media();if(!m)return;var d=m.attributes,f=d.BANDWIDTH,A=d.RESOLUTION.width,p=d.RESOLUTION.height,y={width:A,height:p,bitrate:f};if(isNaN(t)||t!==f){var N={width:A,height:p,bitrate:f,currentTime:this.currentTime(),currentVideoData:y};i.eventCallback(lt.VIDEO_CHANGE,N),t=f}}}})),this.player.on("stalled",(function(){s=!0})),"undefined"!=typeof window?window.onunload=window.onbeforeunload=function(){a.onBeforeUnLoadEvent||(a.onBeforeUnLoadEvent=!0,console.log(a.player.currentTime()),a.eventCallback(lt.UNLOAD,{currentTime:a.player.currentTime()}))}:this.onBeforeUnLoadEvent||(this.onBeforeUnLoadEvent=!0,this.eventCallback(lt.UNLOAD,{currentTime:this.player.currentTime()}))}}])&&At(e.prototype,a),i&&At(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();var yt,Nt="video/mp4",_t="video/webm",It="application/x-mpegURL",vt="application/dash+xml",Tt=It,Dt=vt;function gt(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}var Ut=_t,Pt=Tt,Ct=Dt,Gt=(gt(yt={},Nt,"progressive"),gt(yt,Ut,"progressive"),gt(yt,Pt,"hls"),gt(yt,Ct,"dash"),yt);var bt={BITMOVIN:"bitmovin",JW:"jw",RADIANT:"radiant",VIDEOJS:"videojs",HLSJS:"hlsjs",SHAKA:"shaka",DASHJS:"dashjs",HTML:"html5",REACTNATIVEVIDEO:"react-native-video"};function Rt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Lt(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var Yt=function(){function t(e,a,i){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;Rt(this,t),this.eventCallback=a,this.playerSoftwareName=s||bt.HTML,this.stateMachine=i,this.mediaEl=e,this.mediaElEventHandlers=[],this.analyticsBitrate_=-1,this.bufferingTimeout_=null,this.isBuffering_=!1,this.isLive_=!1,this.isPaused_=!1,this.previousMediaTime_=null,this.needsReadyEvent_=!0,this.needsFirstPlayIntent_=!0,this.mediaElementSet_=!1,this.playbackReadySet_=!1,e&&this.setMediaElement()}var e,a,i;return e=t,a=[{key:"setMediaElement",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(t&&this.mediaEl&&(this.unregisterMediaElement(),this.mediaElementSet_=!1),t&&(this.mediaEl=t),!this.mediaEl)throw new Error("No media element owned");if(this.mediaElementSet_)throw new Error("Media element already set (only call this once)");this.mediaElementSet_=!0,this.registerMediaElement(),this.onMaybeReady()}},{key:"getCurrentQualityLevelInfo",value:function(){return null}},{key:"isLive",value:function(){return!1}},{key:"getMIMEType",value:function(){var t,e=this.mediaEl,a="";return e||(a=null),a=e&&e.src?e.src:e&&e.querySelector("source")&&e.querySelector("source").src?e.querySelector("source").src:null,(t=(t=a).toLowerCase()).endsWith(".m3u8")?It:t.endsWith(".mp4")||t.endsWith(".m4v")||t.endsWith(".m4a")?Nt:t.endsWith(".webm")?_t:t.endsWith(".mpd")?vt:null}},{key:"getStreamType",value:function(){return t=this.getMIMEType(),Gt[t];var t}},{key:"getPlayerVersion",value:function(){return null}},{key:"getStreamURL",value:function(){var t=this.mediaEl;return t?t&&t.src?t.src:t&&t.querySelector("source")&&t.querySelector("source").src?t.querySelector("source").src:null:null}},{key:"resetMedia",value:function(){this.mediaEl=null,this.mediaElEventHandlers=[]}},{key:"registerMediaElement",value:function(){var t=this,e=this.mediaEl;e&&(this.listenToMediaElementEvent("loadedmetadata",(function(){if(1===e.readyState){t.checkQualityLevelAttributes(!0);var a=e.duration,i=e.autoplay,s=e.videoWidth,n=e.videoHeight,r=e.muted,o=e.clientWidth,l=e.clientHeight,u={type:"html5",isLive:t.isLive(),version:t.getPlayerVersion()||"html5",streamType:t.getStreamType(),streamUrl:t.getStreamURL(),duration:a,autoplay:i,currentVideoData:{height:n,width:s,bitrate:t.analyticsBitrate_},videoWindowWidth:parseInt(o),videoWindowHeight:parseInt(l),muted:r};t.needsFirstPlayIntent_||t.eventCallback(lt.METADATA_LOADED,u)}})),this.listenToMediaElementEvent("canplay",(function(){if(!t.playbackReadySet_){t.playbackReadySet_=!0;var a=e.duration,i=e.autoplay,s=e.videoWidth,n=e.videoHeight,r=e.muted,o=e.clientWidth,l=e.clientHeight,u={type:"html5",isLive:t.isLive(),version:t.getPlayerVersion()||"html5",streamType:t.getStreamType(),streamUrl:t.getStreamURL(),duration:a,autoplay:i,playerSoftware:t.playerSoftwareName,videoWindowWidth:parseInt(o),videoWindowHeight:parseInt(l),currentVideoData:{height:n,width:s,bitrate:t.analyticsBitrate_},muted:r};t.eventCallback(lt.SOURCE_LOADED,u)}})),this.listenToMediaElementEvent("play",(function(){var a=e.currentTime,i=e.videoWidth,s=e.videoHeight;t.needsFirstPlayIntent_=!1,t.eventCallback(lt.PLAY,{currentVideoData:{height:s,width:i,bitrate:t.analyticsBitrate_},currentTime:a})})),this.listenToMediaElementEvent("pause",(function(){t.onPaused()})),this.listenToMediaElementEvent("playing",(function(){var a=e.currentTime,i=e.videoWidth,s=e.videoHeight;t.isPaused_=!1,t.needsFirstPlayIntent_||t.eventCallback(lt.TIMECHANGED,{currentVideoData:{height:s,width:i,bitrate:t.analyticsBitrate_},currentTime:a})})),this.listenToMediaElementEvent("error",(function(){var a=e.currentTime,i=e.error;t.eventCallback(lt.ERROR,{currentTime:a,code:i.code,message:i.message})})),this.listenToMediaElementEvent("volumechange",(function(){var a=e.muted,i=e.currentTime;a?t.eventCallback(lt.MUTE,{currentTime:i}):t.eventCallback(lt.UN_MUTE,{currentTime:i})})),this.listenToMediaElementEvent("seeking",(function(){var a=e.currentTime,i=e.videoWidth,s=e.videoHeight;t.eventCallback(lt.SEEK,{currentVideoData:{height:s,width:i,bitrate:t.analyticsBitrate_},currentTime:a,droppedFrames:0})})),this.listenToMediaElementEvent("seeked",(function(){var a=e.currentTime,i=e.videoWidth,s=e.videoHeight;t.bufferingTimeout_&&clearTimeout(t.bufferingTimeout_),t.eventCallback(lt.SEEKED,{currentVideoData:{height:s,width:i,bitrate:t.analyticsBitrate_},currentTime:a,droppedFrames:0})})),this.listenToMediaElementEvent("ended",(function(){var a=e.currentTime,i=e.videoWidth,s=e.videoHeight;t.eventCallback(lt.END,{currentVideoData:{height:s,width:i,bitrate:t.analyticsBitrate_},currentTime:a})})),this.listenToMediaElementEvent("timeupdate",(function(){var a=e.currentTime,i=e.videoHeight,s=e.videoWidth;t.isBuffering_=!1,t.needsFirstPlayIntent_||(t.isPaused_||t.eventCallback(lt.TIMECHANGED,{currentVideoData:{height:i,width:s,bitrate:t.analyticsBitrate_},currentTime:a}),t.checkQualityLevelAttributes(),t.checkPlayheadProgress(),t.previousMediaTime_=a)})),this.listenToMediaElementEvent("stalled",(function(){})),this.listenToMediaElementEvent("waiting",(function(){t.onBuffering()})))}},{key:"listenToMediaElementEvent",value:function(t,e){if(!this.mediaEl)throw new Error("No media attached");var a=e.bind(this);this.mediaElEventHandlers.push(a),this.mediaEl.addEventListener(t,a,!1)}},{key:"onMaybeReady",value:function(){if(this.needsReadyEvent_&&this.mediaEl){this.needsReadyEvent_=!1;var t=!1,e=this.mediaEl,a=e.duration,i=e.autoplay,s=e.videoWidth,n=e.videoHeight,r=e.muted,o=e.preload,l=this.mediaEl.clientWidth,u=this.mediaEl.clientHeight;"none"!==o&&(t=!0);var E={type:"html5",isLive:this.isLive(),version:this.getPlayerVersion()||"html5",streamType:this.getStreamType(),streamUrl:this.getStreamURL(),duration:a,autoplay:i,preload:t,playerSoftware:this.playerSoftwareName,currentVideoData:{height:n,width:s,bitrate:this.analyticsBitrate_},videoWindowWidth:parseInt(l),videoWindowHeight:parseInt(u),muted:r};this.stateMachine.updateMetadata(E),this.eventCallback(lt.READY,E)}}},{key:"unregisterMediaElement",value:function(){var t=this;if(!this.mediaEl)throw new Error("No media attached");this.mediaElEventHandlers.forEach((function(e){t.mediaEl.removeEventListener(e)})),this.resetMedia()}},{key:"onBuffering",value:function(){var t=this.mediaEl.currentTime;this.isBuffering_||this.isPaused_||(this.eventCallback(lt.START_BUFFERING,{currentTime:t}),this.isBuffering_=!0)}},{key:"onPaused",value:function(){if(!this.isPaused_){var t=this.mediaEl,e=t.currentTime,a=t.videoHeight,i=t.videoWidth;this.eventCallback(lt.PAUSE,{currentVideoData:{height:a,width:i,bitrate:this.analyticsBitrate_},currentTime:e}),this.isPaused_=!0}}},{key:"checkPlayheadProgress",value:function(){var t=this,e=this.mediaEl;e.paused&&this.onPaused(),this.bufferingTimeout_&&clearTimeout(this.bufferingTimeout_),this.bufferingTimeout_=setTimeout((function(){e.paused||e.ended&&!t.isBuffering_||e.currentTime-t.previousMediaTime_<1e3&&t.onBuffering()}),1e3)}},{key:"checkQualityLevelAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.mediaEl,a=this.getCurrentQualityLevelInfo();if(a){var i=a.bitrate,s=a.width,n=a.height,r=this.isLive();if(r!==this.isLive_&&(this.isLive_=r,t||this.stateMachine.updateMetadata({isLive:r})),this.analyticsBitrate_!==i){var o={width:s,height:n,bitrate:i,currentTime:e.currentTime};t||this.eventCallback(lt.VIDEO_CHANGE,o),this.analyticsBitrate_=i}}}}],a&&Lt(e.prototype,a),i&&Lt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Ft(t){return Ft="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ft(t)}function kt(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function Ot(t,e){return Ot=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Ot(t,e)}function wt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var a,i=Ht(t);if(e){var s=Ht(this).constructor;a=Reflect.construct(i,arguments,s)}else a=i.apply(this,arguments);return Mt(this,a)}}function Mt(t,e){if(e&&("object"===Ft(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Ht(t){return Ht=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ht(t)}var Kt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ot(t,e)}(n,t);var e,a,i,s=wt(n);function n(t,e,a){var i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(i=s.call(this,null,e,a,bt.HLSJS)).hls=t,i.playerSoftwareName=bt.HLSJS,i.resetMedia(),i.registerHlsEvents(),i}return e=n,(a=[{key:"getCurrentQualityLevelInfo",value:function(){var t=this.hls,e=t.levels[t.currentLevel];if(e){var a=e.attrs;return{bitrate:parseInt(a.BANDWIDTH,10),width:parseInt(a.RESOLUTION.width,10),height:parseInt(a.RESOLUTION.height,10)}}}},{key:"isLive",value:function(){var t=this.hls;if(t.currentLevel<0)return!1;var e=t.levels[t.currentLevel];return!!e&&e.details.live}},{key:"getPlayerVersion",value:function(){return Hls.version}},{key:"getMIMEType",value:function(){return Tt}},{key:"getStreamURL",value:function(){return this.hls.url}},{key:"registerHlsEvents",value:function(){var t=this.hls;if(!Hls)throw new Error("Hls.js is not defined installed (must be loaded before analytics module)");t.on(Hls.Events.MEDIA_ATTACHING,this.onMediaAttaching.bind(this)),t.on(Hls.Events.MEDIA_DETACHING,this.onMediaDetaching.bind(this)),t.on(Hls.Events.MANIFEST_LOADING,this.onManifestLoading.bind(this)),t.media&&this.onMediaAttaching(),t.url&&this.onManifestLoading()}},{key:"onMediaAttaching",value:function(){this.mediaEl||(this.mediaEl=this.hls.media,this.registerMediaElement(),this.onMaybeReady())}},{key:"onMediaDetaching",value:function(){this.unregisterMediaElement()}},{key:"onManifestLoading",value:function(){this.onMaybeReady()}}])&&kt(e.prototype,a),i&&kt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),n}(Yt);function Vt(t){return Vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vt(t)}function Bt(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function jt(t,e){return jt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},jt(t,e)}function Qt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var a,i=xt(t);if(e){var s=xt(this).constructor;a=Reflect.construct(i,arguments,s)}else a=i.apply(this,arguments);return Wt(this,a)}}function Wt(t,e){if(e&&("object"===Vt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function xt(t){return xt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},xt(t)}var qt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jt(t,e)}(n,t);var e,a,i,s=Qt(n);function n(t,e,a,i){var r;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),r=s.call(this,i,e,a,bt.SHAKA),!shaka)throw new Error("`shaka` lib is not installed (must be loaded before analytics module)");return r.shakaPlayer=t,r.playerSoftwareName=bt.SHAKA,r}return e=n,(a=[{key:"getPlayerVersion",value:function(){return shaka.Player.version}},{key:"isLive",value:function(){return!!this.shakaPlayer&&this.shakaPlayer.isLive()}},{key:"getMIMEType",value:function(){return Dt}},{key:"getStreamURL",value:function(){return this.shakaPlayer?this.shakaPlayer.getAssetUri():null}},{key:"getCurrentQualityLevelInfo",value:function(){var t=this.shakaPlayer.getVariantTracks().filter((function(t){return t.active})).filter((function(t){return t.videoCodec||void 0!==t.videoId}))[0];return t?{bitrate:t.videoBandwidth||t.bandwidth,width:t.width,height:t.height}:null}}])&&Bt(e.prototype,a),i&&Bt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),n}(Yt);function Jt(t){return Jt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jt(t)}function zt(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function Xt(t,e){return Xt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Xt(t,e)}function Zt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var a,i=ee(t);if(e){var s=ee(this).constructor;a=Reflect.construct(i,arguments,s)}else a=i.apply(this,arguments);return $t(this,a)}}function $t(t,e){if(e&&("object"===Jt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return te(t)}function te(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ee(t){return ee=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ee(t)}var ae=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Xt(t,e)}(n,t);var e,a,i,s=Zt(n);function n(t,e,a){var i;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),i=s.call(this,null,e,a,bt.DASHJS);var r=null,o=!1;i.playerSoftwareName=bt.DASHJS;try{r=t.getVideoElement()}catch(t){}return r?i._initialize(t,r):t.on(dashjs.MediaPlayer.events.CAN_PLAY,(function(){o||(r=t.getVideoElement(),o=!0,i._initialize(t,r))}),te(i)),i}return e=n,(a=[{key:"_initialize",value:function(t,e){this.mediaPlayer=t,this.setMediaElement(e)}},{key:"getPlayerVersion",value:function(){return this.mediaPlayer.getVersion()}},{key:"isLive",value:function(){return!1}},{key:"getMIMEType",value:function(){return Dt}},{key:"getStreamURL",value:function(){return this.mediaPlayer?this.mediaPlayer.getSource():null}},{key:"getCurrentQualityLevelInfo",value:function(){if(this.mediaPlayer){var t=this.mediaPlayer.getBitrateInfoListFor("video")[this.mediaPlayer.getQualityFor("video")];return{width:t.width,height:t.height,bitrate:t.bitrate}}return null}}])&&zt(e.prototype,a),i&&zt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),n}(Yt);function ie(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}const se=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,a,i;return e=t,i=[{key:"getAdapter",value:function(t,e,a){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return ot.isBitmovinVersionPre7(t)?new Et(t,e):ot.isBitmovinVersion7Plus(t)?new St(t,e):ot.isVideoJs(t)?new pt(t,e,a):ot.isHlsjs(t)?new Kt(t,e,a):ot.isShaka(t)?new qt(t,e,a,i):ot.isDashjs(t)?new ae(t,e,a):new Yt(t,e,a)}}],(a=null)&&ie(e.prototype,a),i&&ie(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();var ne=a(363),re=a.n(ne);function oe(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function le(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}var ue=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.stateMachineCallbacks=e,this.pausedTimestamp=null,this.seekTimestamp=0,this.seekedTimestamp=0,this.seekedTimeout=0,this.onEnterStateTimestamp=0,this.States={SETUP:"SETUP",STARTUP:"STARTUP",READY:"READY",PLAYING:"PLAYING",REBUFFERING:"REBUFFERING",PAUSE:"PAUSE",QUALITYCHANGE:"QUALITYCHANGE",PAUSED_SEEKING:"PAUSED_SEEKING",PLAY_SEEKING:"PLAY_SEEKING",END_PLAY_SEEKING:"END_PLAY_SEEKING",QUALITYCHANGE_PAUSE:"QUALITYCHANGE_PAUSE",END:"END",ERROR:"ERROR",AD:"AD",MUTING_READY:"MUTING_READY",MUTING_PLAY:"MUTING_PLAY",MUTING_PAUSE:"MUTING_PAUSE"},this.createStateMachine()}var e,a,i;return e=t,i=[{key:"pad",value:function(t,e){return(t+new Array(e).join(" ")).slice(0,e)}}],(a=[{key:"createStateMachine",value:function(){var e=this;this.stateMachine=re().create({initial:this.States.SETUP,error:function(t,e,a,i,s,n,r){it.error(n)},events:[{name:lt.READY,from:[this.States.SETUP,this.States.ERROR],to:this.States.READY},{name:lt.PLAY,from:this.States.READY,to:this.States.STARTUP},{name:lt.START_BUFFERING,from:this.States.STARTUP,to:this.States.STARTUP},{name:lt.END_BUFFERING,from:this.States.STARTUP,to:this.States.STARTUP},{name:lt.TIMECHANGED,from:this.States.STARTUP,to:this.States.PLAYING},{name:lt.TIMECHANGED,from:this.States.PLAYING,to:this.States.PLAYING},{name:lt.END_BUFFERING,from:this.States.PLAYING,to:this.States.PLAYING},{name:lt.START_BUFFERING,from:this.States.PLAYING,to:this.States.REBUFFERING},{name:lt.END_BUFFERING,from:this.States.REBUFFERING,to:this.States.PLAYING},{name:lt.TIMECHANGED,from:this.States.REBUFFERING,to:this.States.REBUFFERING},{name:lt.PAUSE,from:this.States.PLAYING,to:this.States.PAUSE},{name:lt.PAUSE,from:this.States.REBUFFERING,to:this.States.PAUSE},{name:lt.PLAY,from:this.States.PAUSE,to:this.States.PLAYING},{name:lt.VIDEO_CHANGE,from:this.States.PLAYING,to:this.States.QUALITYCHANGE},{name:lt.AUDIO_CHANGE,from:this.States.PLAYING,to:this.States.QUALITYCHANGE},{name:lt.VIDEO_CHANGE,from:this.States.QUALITYCHANGE,to:this.States.QUALITYCHANGE},{name:lt.AUDIO_CHANGE,from:this.States.QUALITYCHANGE,to:this.States.QUALITYCHANGE},{name:"FINISH_QUALITYCHANGE",from:this.States.QUALITYCHANGE,to:this.States.PLAYING},{name:lt.VIDEO_CHANGE,from:this.States.PAUSE,to:this.States.QUALITYCHANGE_PAUSE},{name:lt.AUDIO_CHANGE,from:this.States.PAUSE,to:this.States.QUALITYCHANGE_PAUSE},{name:lt.VIDEO_CHANGE,from:this.States.QUALITYCHANGE_PAUSE,to:this.States.QUALITYCHANGE_PAUSE},{name:lt.AUDIO_CHANGE,from:this.States.QUALITYCHANGE_PAUSE,to:this.States.QUALITYCHANGE_PAUSE},{name:"FINISH_QUALITYCHANGE_PAUSE",from:this.States.QUALITYCHANGE_PAUSE,to:this.States.PAUSE},{name:lt.SEEK,from:this.States.PAUSE,to:this.States.PAUSED_SEEKING},{name:lt.SEEK,from:this.States.PAUSED_SEEKING,to:this.States.PAUSED_SEEKING},{name:lt.AUDIO_CHANGE,from:this.States.PAUSED_SEEKING,to:this.States.PAUSED_SEEKING},{name:lt.VIDEO_CHANGE,from:this.States.PAUSED_SEEKING,to:this.States.PAUSED_SEEKING},{name:lt.START_BUFFERING,from:this.States.PAUSED_SEEKING,to:this.States.PAUSED_SEEKING},{name:lt.END_BUFFERING,from:this.States.PAUSED_SEEKING,to:this.States.PAUSED_SEEKING},{name:lt.SEEKED,from:this.States.PAUSED_SEEKING,to:this.States.PAUSE},{name:lt.PLAY,from:this.States.PAUSED_SEEKING,to:this.States.PLAYING},{name:lt.PAUSE,from:this.States.PAUSED_SEEKING,to:this.States.PAUSE},{name:"PLAY_SEEK",from:this.States.PAUSE,to:this.States.PLAY_SEEKING},{name:"PLAY_SEEK",from:this.States.PAUSED_SEEKING,to:this.States.PLAY_SEEKING},{name:"PLAY_SEEK",from:this.States.PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:lt.SEEK,from:this.States.PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:lt.AUDIO_CHANGE,from:this.States.PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:lt.VIDEO_CHANGE,from:this.States.PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:lt.START_BUFFERING,from:this.States.PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:lt.END_BUFFERING,from:this.States.PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:lt.SEEKED,from:this.States.PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:lt.PLAY,from:this.States.PLAY_SEEKING,to:this.States.END_PLAY_SEEKING},{name:lt.START_BUFFERING,from:this.States.END_PLAY_SEEKING,to:this.States.END_PLAY_SEEKING},{name:lt.END_BUFFERING,from:this.States.END_PLAY_SEEKING,to:this.States.END_PLAY_SEEKING},{name:lt.SEEKED,from:this.States.END_PLAY_SEEKING,to:this.States.END_PLAY_SEEKING},{name:lt.TIMECHANGED,from:this.States.END_PLAY_SEEKING,to:this.States.PLAYING},{name:lt.END,from:this.States.PLAY_SEEKING,to:this.States.END},{name:lt.END,from:this.States.PAUSED_SEEKING,to:this.States.END},{name:lt.END,from:this.States.PLAYING,to:this.States.END},{name:lt.END,from:this.States.PAUSE,to:this.States.END},{name:lt.SEEK,from:this.States.END,to:this.States.END},{name:lt.SEEKED,from:this.States.END,to:this.States.END},{name:lt.TIMECHANGED,from:this.States.END,to:this.States.END},{name:lt.END_BUFFERING,from:this.States.END,to:this.States.END},{name:lt.START_BUFFERING,from:this.States.END,to:this.States.END},{name:lt.END,from:this.States.END,to:this.States.END},{name:lt.PLAY,from:this.States.END,to:this.States.PLAYING},{name:lt.ERROR,from:[this.States.SETUP,this.States.STARTUP,this.States.READY,this.States.PLAYING,this.States.REBUFFERING,this.States.PAUSE,this.States.QUALITYCHANGE,this.States.PAUSED_SEEKING,this.States.PLAY_SEEKING,this.States.END_PLAY_SEEKING,this.States.QUALITYCHANGE_PAUSE,"FINISH_PLAY_SEEKING","PLAY_SEEK","FINISH_QUALITYCHANGE_PAUSE","FINISH_QUALITYCHANGE",this.States.END,this.States.ERROR],to:this.States.ERROR},{name:lt.SEEK,from:this.States.END_PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:"FINISH_PLAY_SEEKING",from:this.States.END_PLAY_SEEKING,to:this.States.PLAYING},{name:lt.UNLOAD,from:[this.States.PLAYING,this.States.PAUSE],to:this.States.END},{name:lt.START_AD,from:this.States.PLAYING,to:this.States.AD},{name:lt.END_AD,from:this.States.AD,to:this.States.PLAYING},{name:lt.MUTE,from:this.States.READY,to:this.States.MUTING_READY},{name:lt.UN_MUTE,from:this.States.READY,to:this.States.MUTING_READY},{name:"FINISH_MUTING",from:this.States.MUTING_READY,to:this.States.READY},{name:lt.MUTE,from:this.States.PLAYING,to:this.States.MUTING_PLAY},{name:lt.UN_MUTE,from:this.States.PLAYING,to:this.States.MUTING_PLAY},{name:"FINISH_MUTING",from:this.States.MUTING_PLAY,to:this.States.PLAYING},{name:lt.MUTE,from:this.States.PAUSE,to:this.States.MUTING_PAUSE},{name:lt.UN_MUTE,from:this.States.PAUSE,to:this.States.MUTING_PAUSE},{name:"FINISH_MUTING",from:this.States.MUTING_PAUSE,to:this.States.PAUSE}],callbacks:{onpause:function(t,a,i,s){a===e.States.PLAYING&&(e.pausedTimestamp=s)},onbeforeevent:function(a,i,s,n,r){return a===lt.SEEK&&i===e.States.PAUSE&&n-e.pausedTimestamp<t.PAUSE_SEEK_DELAY?(e.stateMachine.PLAY_SEEK(n),!1):(a===lt.SEEK&&clearTimeout(e.seekedTimeout),a===lt.SEEKED&&i===e.States.PAUSED_SEEKING?(e.seekedTimestamp=n,e.seekedTimeout=setTimeout((function(){e.stateMachine.pause(n,r)}),t.SEEKED_PAUSE_DELAY),!1):void 0)},onafterevent:function(a,i,s,n){it.log(t.pad(n,20)+"EVENT: "+t.pad(a,20)+" from "+t.pad(i,14)+"-> "+t.pad(s,14)),s===e.States.QUALITYCHANGE_PAUSE&&e.stateMachine.FINISH_QUALITYCHANGE_PAUSE(n),s===e.States.QUALITYCHANGE&&e.stateMachine.FINISH_QUALITYCHANGE(n),s!==e.States.MUTING_READY&&s!==e.States.MUTING_PLAY&&s!==e.States.MUTING_PAUSE||e.stateMachine.FINISH_MUTING(n)},onenterstate:function(t,a,i,s,n){e.onEnterStateTimestamp=s||(new Date).getTime(),it.log("Entering State "+i+" with "+t),n&&i!==e.States.PAUSED_SEEKING&&e.stateMachineCallbacks.setVideoTimeStartFromEvent(n)},onleavestate:function(t,a,i,s,n){if(s){var r=s-e.onEnterStateTimestamp;it.log("State "+a+" was "+r+" ms event:"+t),n&&i!==e.States.PAUSED_SEEKING&&e.stateMachineCallbacks.setVideoTimeEndFromEvent(n);var o=a.toLowerCase();if(a===e.States.END_PLAY_SEEKING||a===e.States.PAUSED_SEEKING){var l=e.seekedTimestamp-e.seekTimestamp;e.stateMachineCallbacks[o](l,o,n),it.log("Seek was "+l+"ms")}else if(t===lt.UNLOAD&&a===e.States.PLAYING)e.stateMachineCallbacks.playingAndBye(r,o,n);else if(a===e.States.PAUSE&&i!==e.States.PAUSED_SEEKING)e.stateMachineCallbacks.setVideoTimeStartFromEvent(t),e.stateMachineCallbacks.pause(r,o,n);else{var u=e.stateMachineCallbacks[o];"function"==typeof u?u(r,o,n):it.error("Could not find callback function for "+o)}n&&i!==e.States.PAUSED_SEEKING&&e.stateMachineCallbacks.setVideoTimeStartFromEvent(n),t===lt.VIDEO_CHANGE?e.stateMachineCallbacks.videoChange(n):t===lt.AUDIO_CHANGE?e.stateMachineCallbacks.audioChange(n):t===lt.MUTE?(it.log("Setting sample to muted"),e.stateMachineCallbacks.mute()):t===lt.UN_MUTE&&(it.log("Setting sample to unmuted"),e.stateMachineCallbacks.unMute())}},onseek:function(t,a,i,s){e.seekTimestamp=s},onseeked:function(t,a,i,s){e.seekedTimestamp=s},ontimechanged:function(t,a,i,s,n){var r=s-e.onEnterStateTimestamp;r>59700&&(e.stateMachineCallbacks.setVideoTimeEndFromEvent(n),it.log("Sending heartbeat"),e.stateMachineCallbacks.heartbeat(r,a.toLowerCase(),n),e.onEnterStateTimestamp=s,e.stateMachineCallbacks.setVideoTimeStartFromEvent(n))},onplayerError:function(t,a,i,s,n){e.stateMachineCallbacks.error(n)}}})}},{key:"callEvent",value:function(t,e,a){var i=this.stateMachine[t];i?i.call(this.stateMachine,a,e):it.log("Ignored Event: "+t)}}])&&oe(e.prototype,a),i&&oe(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Ee(t){return function(t){if(Array.isArray(t))return ce(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return ce(t,e);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return ce(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ce(t,e){(null==e||e>t.length)&&(e=t.length);for(var a=0,i=new Array(e);a<e;a++)i[a]=t[a];return i}function he(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Se(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function me(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}le(ue,"PAUSE_SEEK_DELAY",60),le(ue,"SEEKED_PAUSE_DELAY",120);var de=function(){function t(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};he(this,t),this.stateMachineCallbacks=e,this.pausedTimestamp=null,this.seekTimestamp=0,this.seekedTimestamp=0,this.seekedTimeout=0,this.seekedFrom=0,this.onEnterStateTimestamp=0,this.lastPlayHeadDuration=0,this.States={SETUP:"SETUP",STARTUP:"STARTUP",READY:"READY",PLAYING:"PLAYING",REBUFFERING:"REBUFFERING",PAUSE:"PAUSE",QUALITYCHANGE:"QUALITYCHANGE",PAUSED_SEEKING:"PAUSED_SEEKING",PLAY_SEEKING:"PLAY_SEEKING",END_PLAY_SEEKING:"END_PLAY_SEEKING",QUALITYCHANGE_PAUSE:"QUALITYCHANGE_PAUSE",QUALITYCHANGE_REBUFFERING:"QUALITYCHANGE_REBUFFERING",END:"END",ERROR:"ERROR",AD:"AD",MUTING_READY:"MUTING_READY",MUTING_PLAY:"MUTING_PLAY",MUTING_PAUSE:"MUTING_PAUSE",CASTING:"CASTING",SOURCE_CHANGING:"SOURCE_CHANGING"},this.createStateMachine(a)}var e,a,i;return e=t,a=[{key:"getAllStates",value:function(){var t=this;return[].concat(Ee(Object.keys(this.States).map((function(e){return t.States[e]}))),["FINISH_PLAY_SEEKING","PLAY_SEEK","FINISH_QUALITYCHANGE_PAUSE","FINISH_QUALITYCHANGE","FINISH_QUALITYCHANGE_REBUFFERING"])}},{key:"createStateMachine",value:function(){var e=this,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.stateMachine=re().create({initial:this.States.SETUP,error:function(t,e,a,i,s,n){it.error("Error in statemachine: "+n)},events:[{name:lt.READY,from:[this.States.SETUP,this.States.ERROR],to:this.States.READY},{name:lt.PLAY,from:this.States.READY,to:this.States.STARTUP},{name:lt.START_BUFFERING,from:this.States.STARTUP,to:this.States.STARTUP},{name:lt.END_BUFFERING,from:this.States.STARTUP,to:this.States.STARTUP},{name:lt.VIDEO_CHANGE,from:this.States.STARTUP,to:this.States.STARTUP},{name:lt.AUDIO_CHANGE,from:this.States.STARTUP,to:this.States.STARTUP},{name:lt.TIMECHANGED,from:this.States.STARTUP,to:this.States.PLAYING},{name:lt.TIMECHANGED,from:this.States.PLAYING,to:this.States.PLAYING},{name:lt.END_BUFFERING,from:this.States.PLAYING,to:this.States.PLAYING},{name:lt.START_BUFFERING,from:this.States.PLAYING,to:this.States.REBUFFERING},{name:lt.END_BUFFERING,from:this.States.REBUFFERING,to:this.States.PLAYING},{name:lt.TIMECHANGED,from:this.States.REBUFFERING,to:this.States.REBUFFERING},{name:lt.PAUSE,from:this.States.PLAYING,to:this.States.PAUSE},{name:lt.PAUSE,from:this.States.REBUFFERING,to:this.States.PAUSE},{name:lt.PLAY,from:this.States.PAUSE,to:this.States.PLAYING},{name:lt.VIDEO_CHANGE,from:this.States.PLAYING,to:this.States.QUALITYCHANGE},{name:lt.AUDIO_CHANGE,from:this.States.PLAYING,to:this.States.QUALITYCHANGE},{name:lt.VIDEO_CHANGE,from:this.States.QUALITYCHANGE,to:this.States.QUALITYCHANGE},{name:lt.AUDIO_CHANGE,from:this.States.QUALITYCHANGE,to:this.States.QUALITYCHANGE},{name:"FINISH_QUALITYCHANGE",from:this.States.QUALITYCHANGE,to:this.States.PLAYING},{name:lt.VIDEO_CHANGE,from:this.States.PAUSE,to:this.States.QUALITYCHANGE_PAUSE},{name:lt.AUDIO_CHANGE,from:this.States.PAUSE,to:this.States.QUALITYCHANGE_PAUSE},{name:lt.VIDEO_CHANGE,from:this.States.QUALITYCHANGE_PAUSE,to:this.States.QUALITYCHANGE_PAUSE},{name:lt.AUDIO_CHANGE,from:this.States.QUALITYCHANGE_PAUSE,to:this.States.QUALITYCHANGE_PAUSE},{name:"FINISH_QUALITYCHANGE_PAUSE",from:this.States.QUALITYCHANGE_PAUSE,to:this.States.PAUSE},{name:lt.SEEK,from:this.States.PAUSE,to:this.States.PAUSED_SEEKING},{name:lt.SEEK,from:this.States.PAUSED_SEEKING,to:this.States.PAUSED_SEEKING},{name:lt.AUDIO_CHANGE,from:this.States.PAUSED_SEEKING,to:this.States.PAUSED_SEEKING},{name:lt.VIDEO_CHANGE,from:this.States.PAUSED_SEEKING,to:this.States.PAUSED_SEEKING},{name:lt.START_BUFFERING,from:this.States.PAUSED_SEEKING,to:this.States.PAUSED_SEEKING},{name:lt.END_BUFFERING,from:this.States.PAUSED_SEEKING,to:this.States.PAUSED_SEEKING},{name:lt.SEEKED,from:this.States.PAUSED_SEEKING,to:this.States.PAUSE},{name:lt.PLAY,from:this.States.PAUSED_SEEKING,to:this.States.PLAYING},{name:lt.PAUSE,from:this.States.PAUSED_SEEKING,to:this.States.PAUSE},{name:"PLAY_SEEK",from:this.States.PAUSE,to:this.States.PLAY_SEEKING},{name:"PLAY_SEEK",from:this.States.PAUSED_SEEKING,to:this.States.PLAY_SEEKING},{name:"PLAY_SEEK",from:this.States.PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:lt.SEEK,from:this.States.PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:lt.AUDIO_CHANGE,from:this.States.PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:lt.VIDEO_CHANGE,from:this.States.PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:lt.START_BUFFERING,from:this.States.PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:lt.END_BUFFERING,from:this.States.PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:lt.SEEKED,from:this.States.PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:lt.PLAY,from:this.States.PLAY_SEEKING,to:this.States.END_PLAY_SEEKING},{name:lt.START_BUFFERING,from:this.States.END_PLAY_SEEKING,to:this.States.END_PLAY_SEEKING},{name:lt.END_BUFFERING,from:this.States.END_PLAY_SEEKING,to:this.States.END_PLAY_SEEKING},{name:lt.SEEKED,from:this.States.END_PLAY_SEEKING,to:this.States.END_PLAY_SEEKING},{name:lt.TIMECHANGED,from:this.States.END_PLAY_SEEKING,to:this.States.PLAYING},{name:lt.END,from:this.States.PLAY_SEEKING,to:this.States.END},{name:lt.END,from:this.States.PAUSED_SEEKING,to:this.States.END},{name:lt.END,from:this.States.PLAYING,to:this.States.END},{name:lt.END,from:this.States.PAUSE,to:this.States.END},{name:lt.SEEK,from:this.States.END,to:this.States.END},{name:lt.SEEKED,from:this.States.END,to:this.States.END},{name:lt.TIMECHANGED,from:this.States.END,to:this.States.END},{name:lt.END_BUFFERING,from:this.States.END,to:this.States.END},{name:lt.START_BUFFERING,from:this.States.END,to:this.States.END},{name:lt.END,from:this.States.END,to:this.States.END},{name:lt.PLAY,from:this.States.END,to:this.States.PLAYING},{name:lt.ERROR,from:this.getAllStates(),to:this.States.ERROR},{name:lt.SEEK,from:this.States.END_PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:"FINISH_PLAY_SEEKING",from:this.States.END_PLAY_SEEKING,to:this.States.PLAYING},{name:lt.UNLOAD,from:this.getAllStates(),to:this.States.END},{name:lt.START_AD,from:this.States.PLAYING,to:this.States.AD},{name:lt.END_AD,from:this.States.AD,to:this.States.PLAYING},{name:lt.MUTE,from:this.States.READY,to:this.States.MUTING_READY},{name:lt.UN_MUTE,from:this.States.READY,to:this.States.MUTING_READY},{name:"FINISH_MUTING",from:this.States.MUTING_READY,to:this.States.READY},{name:lt.MUTE,from:this.States.PLAYING,to:this.States.MUTING_PLAY},{name:lt.UN_MUTE,from:this.States.PLAYING,to:this.States.MUTING_PLAY},{name:"FINISH_MUTING",from:this.States.MUTING_PLAY,to:this.States.PLAYING},{name:lt.MUTE,from:this.States.PAUSE,to:this.States.MUTING_PAUSE},{name:lt.UN_MUTE,from:this.States.PAUSE,to:this.States.MUTING_PAUSE},{name:"FINISH_MUTING",from:this.States.MUTING_PAUSE,to:this.States.PAUSE},{name:lt.START_CAST,from:[this.States.READY,this.States.PAUSE],to:this.States.CASTING},{name:lt.PAUSE,from:this.States.CASTING,to:this.States.CASTING},{name:lt.PLAY,from:this.States.CASTING,to:this.States.CASTING},{name:lt.TIMECHANGED,from:this.States.CASTING,to:this.States.CASTING},{name:lt.MUTE,from:this.States.CASTING,to:this.States.CASTING},{name:lt.SEEK,from:this.States.CASTING,to:this.States.CASTING},{name:lt.SEEKED,from:this.States.CASTING,to:this.States.CASTING},{name:lt.END_CAST,from:this.States.CASTING,to:this.States.READY},{name:lt.SEEK,from:this.States.READY,to:this.States.READY},{name:lt.SEEKED,from:this.States.READY,to:this.States.READY},{name:lt.SEEKED,from:this.States.STARTUP,to:this.States.STARTUP},{name:lt.SOURCE_UNLOADED,from:this.getAllStates(),to:this.States.SOURCE_CHANGING},{name:lt.READY,from:this.States.SOURCE_CHANGING,to:this.States.READY},{name:lt.SOURCE_LOADED,from:this.States.SETUP,to:this.States.SETUP},{name:lt.SOURCE_LOADED,from:this.States.READY,to:this.States.READY},{name:lt.VIDEO_CHANGE,from:this.States.REBUFFERING,to:this.States.QUALITYCHANGE_REBUFFERING},{name:lt.AUDIO_CHANGE,from:this.States.REBUFFERING,to:this.States.QUALITYCHANGE_REBUFFERING},{name:lt.VIDEO_CHANGE,from:this.States.QUALITYCHANGE_REBUFFERING,to:this.States.QUALITYCHANGE_REBUFFERING},{name:lt.AUDIO_CHANGE,from:this.States.QUALITYCHANGE_REBUFFERING,to:this.States.QUALITYCHANGE_REBUFFERING},{name:"FINISH_QUALITYCHANGE_REBUFFERING",from:this.States.QUALITYCHANGE_REBUFFERING,to:this.States.REBUFFERING}],callbacks:{onpause:function(t,a,i,s){a===e.States.PLAYING&&(e.pausedTimestamp=s)},onbeforeevent:function(a,i,s,n,r){return a===lt.SEEK&&i===e.States.PAUSE&&(e.seekedFrom=e.lastPlayHeadDuration,e.seekTimestamp=n,n-e.pausedTimestamp<t.PAUSE_SEEK_DELAY)?(e.stateMachine.PLAY_SEEK(n),!1):(a===lt.SEEK&&clearTimeout(e.seekedTimeout),a!==lt.SOURCE_LOADED?a===lt.SEEKED&&i===e.States.PAUSED_SEEKING?(e.seekedTimestamp=n,e.seekedTimeout=setTimeout((function(){e.stateMachine.pause(n,r)}),t.SEEKED_PAUSE_DELAY),!1):(i!==e.States.REBUFFERING||s!==e.States.QUALITYCHANGE_REBUFFERING)&&void(r&&(e.lastPlayHeadDuration=1e3*r.currentTime)):void e.stateMachineCallbacks.loaded(n,e.States.READY,r))},onafterevent:function(t,a,i,s){i===e.States.QUALITYCHANGE_PAUSE&&e.stateMachine.FINISH_QUALITYCHANGE_PAUSE(s),i===e.States.QUALITYCHANGE&&e.stateMachine.FINISH_QUALITYCHANGE(s),i===e.States.QUALITYCHANGE_REBUFFERING&&e.stateMachine.FINISH_QUALITYCHANGE_REBUFFERING(s),i!==e.States.MUTING_READY&&i!==e.States.MUTING_PLAY&&i!==e.States.MUTING_PAUSE||e.stateMachine.FINISH_MUTING(s)},onenterstate:function(t,i,s,n,r){s===e.States.SETUP?e.stateMachineCallbacks.setup(n,e.States.SETUP,r):s===e.States.READY?(r.playerSoftware="Bitmovin",e.stateMachineCallbacks.ready(n,e.States.READY,r)):"play"===t&&s===e.States.STARTUP?e.stateMachineCallbacks.first_play(n,e.States.PLAY,r):"play"===t&&i===e.States.PAUSE?(e.stateMachineCallbacks.play(n,e.States.PLAY,r),e.stateMachineCallbacks.playing(n,e.States.PLAYING,r)):"timechanged"===t&&i===e.States.STARTUP&&s===e.States.PLAYING?(e.stateMachineCallbacks.playing(n,e.States.PLAYING,r),e.stateMachineCallbacks.playback_started(r)):s===e.States.PAUSE&&i===e.States.PLAYING?e.stateMachineCallbacks.pause(n,e.States.PAUSE,r):s===e.States.END?e.stateMachineCallbacks.end(n,e.States.END,r):s===e.States.END?e.stateMachineCallbacks.mute(n,r):t===lt.START_BUFFERING?e.stateMachineCallbacks.start_rebuffer(n,e.States.REBUFFERING,r):t===lt.END_BUFFERING&&e.stateMachineCallbacks.end_rebuffer(n,e.States.REBUFFERING,r),"none"===i&&a.starttime?e.onEnterStateTimestamp=a.starttime:e.onEnterStateTimestamp=n||(new Date).getTime(),r&&s!==e.States.PAUSED_SEEKING&&s!==e.States.PLAY_SEEKING&&s!==e.States.END_PLAY_SEEKING&&e.stateMachineCallbacks.setVideoTimeStartFromEvent(r),"PLAY_SEEK"===t&&s===e.States.PLAY_SEEKING&&s!==e.States.PLAY_SEEKING&&s!==e.States.END_PLAY_SEEKING&&(e.seekTimestamp=e.onEnterStateTimestamp)},onleavestate:function(t,a,i,s,n){if(s){var r=s-e.onEnterStateTimestamp;if(n&&i!==e.States.PAUSED_SEEKING&&i!==e.States.PLAY_SEEKING&&i!==e.States.END_PLAY_SEEKING&&(it.log("Setting video time end to "+n.currentTime+", going to "+i),e.stateMachineCallbacks.setVideoTimeEndFromEvent(n)),"PLAY_SEEK"===t&&a===e.States.PAUSE)return!0;var o=a.toLowerCase();if(a===e.States.END_PLAY_SEEKING||a===e.States.PAUSED_SEEKING){var l=e.seekedTimestamp-e.seekTimestamp;e.stateMachineCallbacks.playback_seeked(e.seekedFrom,1e3*n.currentTime,l,i),it.log("Seek was "+l+"ms")}else t===lt.UNLOAD&&a===e.States.PLAYING?e.stateMachineCallbacks.playingAndBye(r,o,n):a===e.States.PAUSE&&i!==e.States.PAUSED_SEEKING&&e.stateMachineCallbacks.setVideoTimeStartFromEvent(t);t===lt.VIDEO_CHANGE?e.stateMachineCallbacks.videoChange(n):t===lt.AUDIO_CHANGE?e.stateMachineCallbacks.audioChange(n):t===lt.MUTE?(it.log("Setting sample to muted"),e.stateMachineCallbacks.mute()):t===lt.UN_MUTE&&(it.log("Setting sample to unmuted"),e.stateMachineCallbacks.unMute())}},onseek:function(t,a,i,s){e.seekTimestamp=s},onseeked:function(t,a,i,s){e.seekedTimestamp=s},ontimechanged:function(t,a,i,s,n){var r=s-e.onEnterStateTimestamp;r>{HEARTBEAT_THRESHOLD:E}&&(e.stateMachineCallbacks.setVideoTimeEndFromEvent(n),it.log("Sending heartbeat"),e.stateMachineCallbacks.heartbeat(r,a.toLowerCase(),n),e.onEnterStateTimestamp=s,e.stateMachineCallbacks.setVideoTimeStartFromEvent(n))},onplayerError:function(t,a,i,s,n){e.stateMachineCallbacks.error(n)}}})}},{key:"callEvent",value:function(t,e,a){var i=this.stateMachine[t];i?i.call(this.stateMachine,a,e):it.log("Ignored Event: "+t)}}],i=[{key:"pad",value:function(t,e){return(t+new Array(e).join(" ")).slice(0,e)}}],a&&Se(e.prototype,a),i&&Se(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();function fe(t){return function(t){if(Array.isArray(t))return Ae(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Ae(t,e);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return Ae(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ae(t,e){(null==e||e>t.length)&&(e=t.length);for(var a=0,i=new Array(e);a<e;a++)i[a]=t[a];return i}function pe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ye(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function Ne(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}me(de,"PAUSE_SEEK_DELAY",200),me(de,"SEEKED_PAUSE_DELAY",300);var _e=function(){function t(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};pe(this,t),this.stateMachineCallbacks=e,this.pausedTimestamp=null,this.seekTimestamp=0,this.seekedTimestamp=0,this.seekedTimeout=0,this.onEnterStateTimestamp=0,this.lastPlayHeadDuration=0,this.States={SETUP:"SETUP",STARTUP:"STARTUP",READY:"READY",PLAYING:"PLAYING",REBUFFERING:"REBUFFERING",PAUSE:"PAUSE",QUALITYCHANGE:"QUALITYCHANGE",PAUSED_SEEKING:"PAUSED_SEEKING",PLAY_SEEKING:"PLAY_SEEKING",END_PLAY_SEEKING:"END_PLAY_SEEKING",QUALITYCHANGE_PAUSE:"QUALITYCHANGE_PAUSE",QUALITYCHANGE_REBUFFERING:"QUALITYCHANGE_REBUFFERING",END:"END",ERROR:"ERROR",MUTING_READY:"MUTING_READY",MUTING_PLAY:"MUTING_PLAY",MUTING_PAUSE:"MUTING_PAUSE",CASTING:"CASTING"},this.createStateMachine(a)}var e,a,i;return e=t,a=[{key:"getAllStates",value:function(){var t=this;return[].concat(fe(Object.keys(this.States).map((function(e){return t.States[e]}))),["FINISH_PLAY_SEEKING","PLAY_SEEK","FINISH_QUALITYCHANGE_PAUSE","FINISH_QUALITYCHANGE","FINISH_QUALITYCHANGE_REBUFFERING"])}},{key:"createStateMachine",value:function(){var e=this,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.stateMachine=re().create({initial:this.States.SETUP,error:function(t,e,a,i,s,n){it.error("Error in statemachine: "+n)},events:[{name:lt.TIMECHANGED,from:this.States.SETUP,to:this.States.SETUP},{name:lt.READY,from:[this.States.SETUP,this.States.ERROR],to:this.States.READY},{name:lt.PLAY,from:this.States.READY,to:this.States.STARTUP},{name:lt.START_BUFFERING,from:this.States.STARTUP,to:this.States.STARTUP},{name:lt.END_BUFFERING,from:this.States.STARTUP,to:this.States.STARTUP},{name:lt.VIDEO_CHANGE,from:this.States.STARTUP,to:this.States.STARTUP},{name:lt.AUDIO_CHANGE,from:this.States.STARTUP,to:this.States.STARTUP},{name:lt.TIMECHANGED,from:this.States.STARTUP,to:this.States.PLAYING},{name:lt.TIMECHANGED,from:this.States.PLAYING,to:this.States.PLAYING},{name:lt.END_BUFFERING,from:this.States.PLAYING,to:this.States.PLAYING},{name:lt.START_BUFFERING,from:this.States.PLAYING,to:this.States.REBUFFERING},{name:lt.START_BUFFERING,from:this.States.REBUFFERING,to:this.States.REBUFFERING},{name:lt.TIMECHANGED,from:this.States.REBUFFERING,to:this.States.PLAYING},{name:lt.SEEK,from:this.States.STARTUP,to:this.States.STARTUP},{name:lt.SEEK,from:this.States.PLAYING,to:this.States.PLAY_SEEKING},{name:lt.TIMECHANGED,from:this.States.PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:lt.TIMECHANGED,from:this.States.PAUSED_SEEKING,to:this.States.PAUSED_SEEKING},{name:lt.PAUSE,from:this.States.PLAYING,to:this.States.PAUSE},{name:lt.PAUSE,from:this.States.REBUFFERING,to:this.States.PAUSE},{name:lt.TIMECHANGED,from:this.States.PAUSE,to:this.States.PAUSE},{name:lt.PLAY,from:this.States.PAUSE,to:this.States.PLAYING},{name:lt.VIDEO_CHANGE,from:this.States.PLAYING,to:this.States.QUALITYCHANGE},{name:lt.AUDIO_CHANGE,from:this.States.PLAYING,to:this.States.QUALITYCHANGE},{name:lt.VIDEO_CHANGE,from:this.States.QUALITYCHANGE,to:this.States.QUALITYCHANGE},{name:lt.AUDIO_CHANGE,from:this.States.QUALITYCHANGE,to:this.States.QUALITYCHANGE},{name:"FINISH_QUALITYCHANGE",from:this.States.QUALITYCHANGE,to:this.States.PLAYING},{name:lt.VIDEO_CHANGE,from:this.States.PAUSE,to:this.States.QUALITYCHANGE_PAUSE},{name:lt.AUDIO_CHANGE,from:this.States.PAUSE,to:this.States.QUALITYCHANGE_PAUSE},{name:lt.VIDEO_CHANGE,from:this.States.QUALITYCHANGE_PAUSE,to:this.States.QUALITYCHANGE_PAUSE},{name:lt.AUDIO_CHANGE,from:this.States.QUALITYCHANGE_PAUSE,to:this.States.QUALITYCHANGE_PAUSE},{name:"FINISH_QUALITYCHANGE_PAUSE",from:this.States.QUALITYCHANGE_PAUSE,to:this.States.PAUSE},{name:lt.SEEK,from:this.States.PAUSE,to:this.States.PAUSED_SEEKING},{name:lt.SEEK,from:this.States.PAUSED_SEEKING,to:this.States.PAUSED_SEEKING},{name:lt.AUDIO_CHANGE,from:this.States.PAUSED_SEEKING,to:this.States.PAUSED_SEEKING},{name:lt.VIDEO_CHANGE,from:this.States.PAUSED_SEEKING,to:this.States.PAUSED_SEEKING},{name:lt.START_BUFFERING,from:this.States.PAUSED_SEEKING,to:this.States.PAUSED_SEEKING},{name:lt.END_BUFFERING,from:this.States.PAUSED_SEEKING,to:this.States.PAUSED_SEEKING},{name:lt.SEEKED,from:this.States.PAUSED_SEEKING,to:this.States.PAUSE},{name:lt.PLAY,from:this.States.PAUSED_SEEKING,to:this.States.PLAYING},{name:lt.PAUSE,from:this.States.PAUSED_SEEKING,to:this.States.PAUSE},{name:"PLAY_SEEK",from:this.States.PAUSE,to:this.States.PLAY_SEEKING},{name:"PLAY_SEEK",from:this.States.PAUSED_SEEKING,to:this.States.PLAY_SEEKING},{name:"PLAY_SEEK",from:this.States.PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:lt.SEEK,from:this.States.PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:lt.AUDIO_CHANGE,from:this.States.PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:lt.VIDEO_CHANGE,from:this.States.PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:lt.START_BUFFERING,from:this.States.PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:lt.END_BUFFERING,from:this.States.PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:lt.SEEKED,from:this.States.PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:lt.SEEKED,from:this.States.PLAY_SEEKING,to:this.States.END_PLAY_SEEKING},{name:lt.START_BUFFERING,from:this.States.END_PLAY_SEEKING,to:this.States.END_PLAY_SEEKING},{name:lt.END_BUFFERING,from:this.States.END_PLAY_SEEKING,to:this.States.END_PLAY_SEEKING},{name:lt.SEEKED,from:this.States.END_PLAY_SEEKING,to:this.States.END_PLAY_SEEKING},{name:lt.TIMECHANGED,from:this.States.END_PLAY_SEEKING,to:this.States.PLAYING},{name:lt.END,from:this.States.PLAY_SEEKING,to:this.States.END},{name:lt.END,from:this.States.PAUSED_SEEKING,to:this.States.END},{name:lt.END,from:this.States.PLAYING,to:this.States.END},{name:lt.END,from:this.States.PAUSE,to:this.States.END},{name:lt.SEEK,from:this.States.END,to:this.States.END},{name:lt.SEEKED,from:this.States.END,to:this.States.END},{name:lt.TIMECHANGED,from:this.States.END,to:this.States.END},{name:lt.END_BUFFERING,from:this.States.END,to:this.States.END},{name:lt.START_BUFFERING,from:this.States.END,to:this.States.END},{name:lt.END,from:this.States.END,to:this.States.END},{name:lt.SEEKED,from:this.States.PLAYING,to:this.States.PLAYING},{name:lt.PLAY,from:this.States.END,to:this.States.PLAYING},{name:lt.ERROR,from:this.getAllStates(),to:this.States.ERROR},{name:lt.PAUSE,from:this.States.ERROR,to:this.States.ERROR},{name:lt.SEEK,from:this.States.END_PLAY_SEEKING,to:this.States.PLAY_SEEKING},{name:"FINISH_PLAY_SEEKING",from:this.States.END_PLAY_SEEKING,to:this.States.PLAYING},{name:lt.UNLOAD,from:this.getAllStates(),to:this.States.END},{name:lt.START_AD,from:this.States.PLAYING,to:this.States.AD},{name:lt.END_AD,from:this.States.AD,to:this.States.PLAYING},{name:lt.MUTE,from:this.States.READY,to:this.States.MUTING_READY},{name:lt.UN_MUTE,from:this.States.READY,to:this.States.MUTING_READY},{name:"FINISH_MUTING",from:this.States.MUTING_READY,to:this.States.READY},{name:lt.MUTE,from:this.States.PLAYING,to:this.States.MUTING_PLAY},{name:lt.UN_MUTE,from:this.States.PLAYING,to:this.States.MUTING_PLAY},{name:"FINISH_MUTING",from:this.States.MUTING_PLAY,to:this.States.PLAYING},{name:lt.MUTE,from:this.States.PAUSE,to:this.States.MUTING_PAUSE},{name:lt.UN_MUTE,from:this.States.PAUSE,to:this.States.MUTING_PAUSE},{name:"FINISH_MUTING",from:this.States.MUTING_PAUSE,to:this.States.PAUSE},{name:lt.START_CAST,from:[this.States.READY,this.States.PAUSE],to:this.States.CASTING},{name:lt.PAUSE,from:this.States.CASTING,to:this.States.CASTING},{name:lt.PLAY,from:this.States.CASTING,to:this.States.CASTING},{name:lt.TIMECHANGED,from:this.States.CASTING,to:this.States.CASTING},{name:lt.MUTE,from:this.States.CASTING,to:this.States.CASTING},{name:lt.SEEK,from:this.States.CASTING,to:this.States.CASTING},{name:lt.SEEKED,from:this.States.CASTING,to:this.States.CASTING},{name:lt.END_CAST,from:this.States.CASTING,to:this.States.READY},{name:lt.SEEK,from:this.States.READY,to:this.States.READY},{name:lt.SEEKED,from:this.States.READY,to:this.States.READY},{name:lt.SEEKED,from:this.States.STARTUP,to:this.States.STARTUP},{name:lt.SOURCE_LOADED,from:this.getAllStates(),to:this.States.SETUP},{name:lt.SOURCE_LOADED,from:this.States.SETUP,to:this.States.SETUP},{name:lt.SOURCE_LOADED,from:this.States.READY,to:this.States.READY},{name:lt.VIDEO_CHANGE,from:this.States.REBUFFERING,to:this.States.QUALITYCHANGE_REBUFFERING},{name:lt.AUDIO_CHANGE,from:this.States.REBUFFERING,to:this.States.QUALITYCHANGE_REBUFFERING},{name:lt.VIDEO_CHANGE,from:this.States.QUALITYCHANGE_REBUFFERING,to:this.States.QUALITYCHANGE_REBUFFERING},{name:lt.AUDIO_CHANGE,from:this.States.QUALITYCHANGE_REBUFFERING,to:this.States.QUALITYCHANGE_REBUFFERING},{name:"FINISH_QUALITYCHANGE_REBUFFERING",from:this.States.QUALITYCHANGE_REBUFFERING,to:this.States.REBUFFERING}],callbacks:{onpause:function(t,a,i,s){a===e.States.PLAYING&&(e.pausedTimestamp=s)},onbeforeevent:function(a,i,s,n,r){return a===lt.SEEK&&(i===e.States.PAUSE||i===e.States.PLAYING)&&(e.seekedFrom=e.lastPlayHeadDuration,e.seekTimestamp=n,n-e.pausedTimestamp<t.PAUSE_SEEK_DELAY)?(e.stateMachine.PLAY_SEEK(n),!1):(a===lt.SEEK&&clearTimeout(e.seekedTimeout),a!==lt.SOURCE_LOADED?a===lt.SEEKED&&i===e.States.PAUSED_SEEKING?(e.seekedTimestamp=n,e.seekedTimeout=setTimeout((function(){e.stateMachine.pause(n,r)}),t.SEEKED_PAUSE_DELAY),!1):(i!==e.States.REBUFFERING||s!==e.States.QUALITYCHANGE_REBUFFERING)&&void(r&&(e.lastPlayHeadDuration=1e3*r.currentTime)):void e.stateMachineCallbacks.loaded(n,e.States.READY,r))},onenterstate:function(t,i,s,n,r){s===e.States.SETUP?e.stateMachineCallbacks.setup(n,e.States.SETUP,r):s===e.States.READY?(r.playerSoftware=bt.VIDEOJS,e.stateMachineCallbacks.ready(n,e.States.READY,r)):"play"===t&&s===e.States.STARTUP?e.stateMachineCallbacks.first_play(n,e.States.PLAY,r):"play"===t&&i===e.States.PAUSE?(e.stateMachineCallbacks.play(n,e.States.PLAY,r),e.stateMachineCallbacks.playing(n,e.States.PLAYING,r)):"timechanged"===t&&i===e.States.STARTUP&&s===e.States.PLAYING?(e.stateMachineCallbacks.playing(n,e.States.PLAYING,r),e.stateMachineCallbacks.playback_started(r)):s===e.States.PAUSE&&i===e.States.PLAYING?e.stateMachineCallbacks.pause(n,e.States.PAUSE,r):s===e.States.END?e.stateMachineCallbacks.end(n,e.States.END,r):s===e.States.END?e.stateMachineCallbacks.mute(n,r):t===lt.START_BUFFERING?e.stateMachineCallbacks.start_rebuffer(n,e.States.REBUFFERING,r):"timechanged"===t&&i===e.States.REBUFFERING&&s===e.States.PLAYING&&e.stateMachineCallbacks.end_rebuffer(n,e.States.REBUFFERING,r),"none"===i&&a.starttime?e.onEnterStateTimestamp=a.starttime:e.onEnterStateTimestamp=n||(new Date).getTime(),r&&s!==e.States.PAUSED_SEEKING&&s!==e.States.PLAY_SEEKING&&s!==e.States.END_PLAY_SEEKING&&e.stateMachineCallbacks.setVideoTimeStartFromEvent(r),"PLAY_SEEK"===t&&s===e.States.PLAY_SEEKING&&s!==e.States.PLAY_SEEKING&&s!==e.States.END_PLAY_SEEKING&&(e.seekTimestamp=e.onEnterStateTimestamp)},onafterevent:function(t,a,i,s){i===e.States.QUALITYCHANGE&&e.stateMachine.FINISH_QUALITYCHANGE(s),i!==e.States.MUTING_READY&&i!==e.States.MUTING_PLAY&&i!==e.States.MUTING_PAUSE||e.stateMachine.FINISH_MUTING(s)},onleavestate:function(t,a,i,s,n){if(e.stateMachineCallbacks.resetSessionExpiry(),s){var r=s-e.onEnterStateTimestamp;if(n&&i!==e.States.PAUSED_SEEKING&&i!==e.States.PLAY_SEEKING&&i!==e.States.END_PLAY_SEEKING&&(it.log("Setting video time end to "+n.currentTime+", going to "+i),e.stateMachineCallbacks.setVideoTimeEndFromEvent(n)),"PLAY_SEEK"===t&&a===e.States.PAUSE)return!0;var o=a.toLowerCase();if(a===e.States.END_PLAY_SEEKING||a===e.States.PAUSED_SEEKING){var l=e.seekedTimestamp-e.seekTimestamp;e.stateMachineCallbacks.playback_seeked(e.seekedFrom,1e3*n.currentTime,l,i),it.log("Seek was "+l+"ms")}else t===lt.UNLOAD&&a===e.States.PLAYING?e.stateMachineCallbacks.playingAndBye(r,o,n):a===e.States.PAUSE&&i!==e.States.PAUSED_SEEKING&&e.stateMachineCallbacks.setVideoTimeStartFromEvent(t);t===lt.VIDEO_CHANGE?e.stateMachineCallbacks.videoChange(n):t===lt.AUDIO_CHANGE?e.stateMachineCallbacks.audioChange(n):t===lt.MUTE?(it.log("Setting sample to muted"),e.stateMachineCallbacks.mute()):t===lt.UN_MUTE&&(it.log("Setting sample to unmuted"),e.stateMachineCallbacks.unMute())}},onseek:function(t,a,i,s){e.seekTimestamp=s},onseeked:function(t,a,i,s){e.seekedTimestamp=s},ontimechanged:function(t,a,i,s,n){var r=s-e.onEnterStateTimestamp;r>E&&(e.stateMachineCallbacks.setVideoTimeEndFromEvent(n),it.log("Sending heartbeat"),e.stateMachineCallbacks.heartbeat(r,a.toLowerCase(),n),e.onEnterStateTimestamp=s,e.stateMachineCallbacks.setVideoTimeStartFromEvent(n),e.stateMachineCallbacks.resetSessionExpiry())},onplayerError:function(t,a,i,s,n){e.stateMachineCallbacks.error(n)}}})}},{key:"callEvent",value:function(t,e,a){var i=this.stateMachine[t];i?i.call(this.stateMachine,a,e):it.log("Ignored Event: "+t)}},{key:"updateMetadata",value:function(t){this.stateMachineCallbacks.updateSample(t)}}],i=[{key:"pad",value:function(t,e){return(t+new Array(e).join(" ")).slice(0,e)}}],a&&ye(e.prototype,a),i&&ye(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Ie(t){return function(t){if(Array.isArray(t))return ve(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return ve(t,e);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return ve(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ve(t,e){(null==e||e>t.length)&&(e=t.length);for(var a=0,i=new Array(e);a<e;a++)i[a]=t[a];return i}function Te(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function De(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}Ne(_e,"PAUSE_SEEK_DELAY",200),Ne(_e,"SEEKED_PAUSE_DELAY",300);var ge=function(){function t(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Te(this,t),this.stateMachineCallbacks=e,this.pausedTimestamp=null,this.onEnterStateTimestamp=0,this.seekStartedAt=null,this.seekTimestamp=0,this.seekedTimestamp=0,this.seekedFrom=0,this.lastPlayHeadDuration=0,this.playTimeStamp=null,this.States={SETUP:"SETUP",STARTUP:"STARTUP",READY:"READY",PLAYING:"PLAYING",REBUFFERING:"REBUFFERING",PAUSE:"PAUSE",QUALITYCHANGE:"QUALITYCHANGE",PAUSED_SEEKING:"PAUSED_SEEKING",QUALITYCHANGE_PAUSE:"QUALITYCHANGE_PAUSE",QUALITYCHANGE_REBUFFERING:"QUALITYCHANGE_REBUFFERING",END:"END",ERROR:"ERROR",MUTING_READY:"MUTING_READY",MUTING_PLAY:"MUTING_PLAY",MUTING_PAUSE:"MUTING_PAUSE",CASTING:"CASTING"},this.createStateMachine(a)}var e,a,i;return e=t,a=[{key:"getAllStates",value:function(){var t=this;return[].concat(Ie(Object.keys(this.States).map((function(e){return t.States[e]}))),["FINISH_QUALITYCHANGE_PAUSE","FINISH_QUALITYCHANGE","FINISH_QUALITYCHANGE_REBUFFERING"])}},{key:"createStateMachine",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.stateMachine=re().create({initial:this.States.SETUP,error:function(t,e,a,i,s,n){it.error("Error in statemachine: "+n)},events:[{name:lt.TIMECHANGED,from:this.States.SETUP,to:this.States.SETUP},{name:lt.READY,from:[this.States.SETUP,this.States.ERROR],to:this.States.READY},{name:lt.PLAY,from:this.States.READY,to:this.States.STARTUP},{name:lt.START_BUFFERING,from:this.States.STARTUP,to:this.States.STARTUP},{name:lt.END_BUFFERING,from:this.States.STARTUP,to:this.States.STARTUP},{name:lt.VIDEO_CHANGE,from:this.States.STARTUP,to:this.States.STARTUP},{name:lt.AUDIO_CHANGE,from:this.States.STARTUP,to:this.States.STARTUP},{name:lt.TIMECHANGED,from:this.States.STARTUP,to:this.States.PLAYING},{name:lt.TIMECHANGED,from:this.States.PLAYING,to:this.States.PLAYING},{name:lt.TIMECHANGED,from:this.States.PAUSE,to:this.States.PAUSE},{name:lt.SEEKED,from:this.States.PAUSE,to:this.States.PAUSE},{name:lt.END_BUFFERING,from:this.States.PLAYING,to:this.States.PLAYING},{name:lt.START_BUFFERING,from:this.States.PLAYING,to:this.States.REBUFFERING},{name:lt.START_BUFFERING,from:this.States.REBUFFERING,to:this.States.REBUFFERING},{name:lt.PLAY,from:this.States.REBUFFERING,to:this.States.PLAYING},{name:lt.TIMECHANGED,from:this.States.REBUFFERING,to:this.States.PLAYING},{name:lt.SEEK,from:this.States.STARTUP,to:this.States.STARTUP},{name:lt.PLAY,from:this.States.PAUSED_SEEKING,to:this.States.PAUSED_SEEKING},{name:lt.PAUSE,from:this.States.PLAYING,to:this.States.PAUSE},{name:lt.PAUSE,from:this.States.REBUFFERING,to:this.States.PAUSE},{name:lt.PLAY,from:this.States.PAUSE,to:this.States.PLAYING},{name:lt.TIMECHANGED,from:this.States.PAUSE,to:this.States.PLAYING},{name:lt.VIDEO_CHANGE,from:this.States.PLAYING,to:this.States.QUALITYCHANGE},{name:lt.AUDIO_CHANGE,from:this.States.PLAYING,to:this.States.QUALITYCHANGE},{name:lt.VIDEO_CHANGE,from:this.States.QUALITYCHANGE,to:this.States.QUALITYCHANGE},{name:lt.AUDIO_CHANGE,from:this.States.QUALITYCHANGE,to:this.States.QUALITYCHANGE},{name:"FINISH_QUALITYCHANGE",from:this.States.QUALITYCHANGE,to:this.States.PLAYING},{name:lt.VIDEO_CHANGE,from:this.States.PAUSE,to:this.States.QUALITYCHANGE_PAUSE},{name:lt.AUDIO_CHANGE,from:this.States.PAUSE,to:this.States.QUALITYCHANGE_PAUSE},{name:lt.VIDEO_CHANGE,from:this.States.QUALITYCHANGE_PAUSE,to:this.States.QUALITYCHANGE_PAUSE},{name:lt.AUDIO_CHANGE,from:this.States.QUALITYCHANGE_PAUSE,to:this.States.QUALITYCHANGE_PAUSE},{name:"FINISH_QUALITYCHANGE_PAUSE",from:this.States.QUALITYCHANGE_PAUSE,to:this.States.PAUSE},{name:lt.SEEK,from:this.States.PAUSE,to:this.States.PAUSED_SEEKING},{name:lt.SEEK,from:this.States.PAUSED_SEEKING,to:this.States.PAUSED_SEEKING},{name:lt.AUDIO_CHANGE,from:this.States.PAUSED_SEEKING,to:this.States.PAUSED_SEEKING},{name:lt.VIDEO_CHANGE,from:this.States.PAUSED_SEEKING,to:this.States.PAUSED_SEEKING},{name:lt.START_BUFFERING,from:this.States.PAUSED_SEEKING,to:this.States.PAUSED_SEEKING},{name:lt.END_BUFFERING,from:this.States.PAUSED_SEEKING,to:this.States.PAUSED_SEEKING},{name:lt.SEEKED,from:this.States.PAUSED_SEEKING,to:this.States.PAUSE},{name:lt.TIMECHANGED,from:this.States.PAUSED_SEEKING,to:this.States.PLAYING},{name:lt.PAUSE,from:this.States.PAUSED_SEEKING,to:this.States.PAUSE},{name:lt.END,from:this.States.PAUSED_SEEKING,to:this.States.END},{name:lt.END,from:this.States.PLAYING,to:this.States.END},{name:lt.END,from:this.States.PAUSE,to:this.States.END},{name:lt.SEEK,from:this.States.END,to:this.States.END},{name:lt.SEEKED,from:this.States.END,to:this.States.END},{name:lt.TIMECHANGED,from:this.States.END,to:this.States.END},{name:lt.END_BUFFERING,from:this.States.END,to:this.States.END},{name:lt.START_BUFFERING,from:this.States.END,to:this.States.END},{name:lt.END,from:this.States.END,to:this.States.END},{name:lt.SEEKED,from:this.States.PLAYING,to:this.States.PLAYING},{name:lt.PLAY,from:this.States.END,to:this.States.PLAYING},{name:lt.ERROR,from:this.getAllStates(),to:this.States.ERROR},{name:lt.PAUSE,from:this.States.ERROR,to:this.States.ERROR},{name:lt.UNLOAD,from:this.getAllStates(),to:this.States.END},{name:lt.START_AD,from:this.States.PLAYING,to:this.States.AD},{name:lt.END_AD,from:this.States.AD,to:this.States.PLAYING},{name:lt.MUTE,from:this.States.READY,to:this.States.MUTING_READY},{name:lt.UN_MUTE,from:this.States.READY,to:this.States.MUTING_READY},{name:"FINISH_MUTING",from:this.States.MUTING_READY,to:this.States.READY},{name:lt.MUTE,from:this.States.PLAYING,to:this.States.MUTING_PLAY},{name:lt.UN_MUTE,from:this.States.PLAYING,to:this.States.MUTING_PLAY},{name:"FINISH_MUTING",from:this.States.MUTING_PLAY,to:this.States.PLAYING},{name:lt.MUTE,from:this.States.PAUSE,to:this.States.MUTING_PAUSE},{name:lt.UN_MUTE,from:this.States.PAUSE,to:this.States.MUTING_PAUSE},{name:"FINISH_MUTING",from:this.States.MUTING_PAUSE,to:this.States.PAUSE},{name:lt.START_CAST,from:[this.States.READY,this.States.PAUSE],to:this.States.CASTING},{name:lt.PAUSE,from:this.States.CASTING,to:this.States.CASTING},{name:lt.PLAY,from:this.States.CASTING,to:this.States.CASTING},{name:lt.TIMECHANGED,from:this.States.CASTING,to:this.States.CASTING},{name:lt.MUTE,from:this.States.CASTING,to:this.States.CASTING},{name:lt.SEEK,from:this.States.CASTING,to:this.States.CASTING},{name:lt.SEEKED,from:this.States.CASTING,to:this.States.CASTING},{name:lt.END_CAST,from:this.States.CASTING,to:this.States.READY},{name:lt.SEEK,from:this.States.READY,to:this.States.READY},{name:lt.SEEKED,from:this.States.READY,to:this.States.READY},{name:lt.SEEKED,from:this.States.STARTUP,to:this.States.STARTUP},{name:lt.SOURCE_LOADED,from:this.States.SETUP,to:this.States.SETUP},{name:lt.SOURCE_LOADED,from:this.States.READY,to:this.States.READY},{name:lt.SOURCE_LOADED,from:this.States.STARTUP,to:this.States.STARTUP},{name:lt.SOURCE_LOADED,from:this.States.PLAYING,to:this.States.PLAYING},{name:lt.VIDEO_CHANGE,from:this.States.REBUFFERING,to:this.States.QUALITYCHANGE_REBUFFERING},{name:lt.AUDIO_CHANGE,from:this.States.REBUFFERING,to:this.States.QUALITYCHANGE_REBUFFERING},{name:lt.VIDEO_CHANGE,from:this.States.QUALITYCHANGE_REBUFFERING,to:this.States.QUALITYCHANGE_REBUFFERING},{name:lt.AUDIO_CHANGE,from:this.States.QUALITYCHANGE_REBUFFERING,to:this.States.QUALITYCHANGE_REBUFFERING},{name:"FINISH_QUALITYCHANGE_REBUFFERING",from:this.States.QUALITYCHANGE_REBUFFERING,to:this.States.REBUFFERING}],callbacks:{onbeforeevent:function(e,a,i,s,n){if(e===lt.SEEK&&a===t.States.PAUSE&&(t.seekedFrom=t.lastPlayHeadDuration),e!==lt.SOURCE_LOADED)n&&(t.lastPlayHeadDuration=1e3*n.currentTime);else{var r=null;a===t.States.PLAYING&&(r=(new Date).getTime()-t.playTimeStamp.getTime()),t.stateMachineCallbacks.loaded(s,t.States.READY,n,r)}},onenterstate:function(a,i,s,n,r){s===t.States.SETUP?t.stateMachineCallbacks.setup(n,t.States.SETUP,r):s===t.States.READY?t.stateMachineCallbacks.ready(n,t.States.READY,r):"play"===a&&s===t.States.STARTUP?(t.playTimeStamp=new Date,t.stateMachineCallbacks.first_play(n,t.States.PLAY,r)):"play"===a&&i===t.States.PAUSE?(t.stateMachineCallbacks.play(n,t.States.PLAY,r),t.stateMachineCallbacks.playing(n,t.States.PLAYING,r)):"timechanged"===a&&i===t.States.STARTUP&&s===t.States.PLAYING?(t.stateMachineCallbacks.playing(n,t.States.PLAYING,r),t.stateMachineCallbacks.playback_started(r)):"timechanged"===a&&i===t.States.PAUSE&&s===t.States.PLAYING?t.stateMachineCallbacks.playing(n,t.States.PLAYING,r):s===t.States.PAUSE&&i===t.States.PLAYING?t.stateMachineCallbacks.pause(n,t.States.PAUSE,r):s===t.States.END?t.stateMachineCallbacks.end(n,t.States.END,r):a===lt.START_BUFFERING?t.stateMachineCallbacks.start_rebuffer(n,t.States.REBUFFERING,r):"timechanged"===a&&i===t.States.REBUFFERING&&s===t.States.PLAYING&&t.stateMachineCallbacks.end_rebuffer(n,t.States.REBUFFERING,r),"none"===i&&e.starttime?t.onEnterStateTimestamp=e.starttime:t.onEnterStateTimestamp=n||(new Date).getTime(),r&&s!==t.States.PAUSED_SEEKING&&t.stateMachineCallbacks.setVideoTimeStartFromEvent(r)},onafterevent:function(e,a,i,s){i===t.States.QUALITYCHANGE&&t.stateMachine.FINISH_QUALITYCHANGE(s),i!==t.States.MUTING_READY&&i!==t.States.MUTING_PLAY&&i!==t.States.MUTING_PAUSE||t.stateMachine.FINISH_MUTING(s)},onleavestate:function(e,a,i,s,n){if(t.stateMachineCallbacks.resetSessionExpiry(),s){var r=s-t.onEnterStateTimestamp;n&&i!==t.States.PAUSED_SEEKING&&(it.log("Setting video time end to "+n.currentTime+", going to "+i),t.stateMachineCallbacks.setVideoTimeEndFromEvent(n));var o=a.toLowerCase();if(a===t.States.PAUSED_SEEKING){var l=s-t.seekStartedAt;t.seekStartedAt=null,t.stateMachineCallbacks.playback_seeked(t.seekedFrom,1e3*n.currentTime,l,i),it.log("Seek was "+l+"ms")}else e===lt.UNLOAD&&a===t.States.PLAYING?t.stateMachineCallbacks.playingAndBye(r,o,n):a===t.States.PAUSE&&i!==t.States.PAUSED_SEEKING&&i!==t.States.PLAYING&&(t.stateMachineCallbacks.setVideoTimeStartFromEvent(e),t.stateMachineCallbacks.pause(r,o,n));e===lt.VIDEO_CHANGE?t.stateMachineCallbacks.videoChange(n):e===lt.AUDIO_CHANGE?t.stateMachineCallbacks.audioChange(n):e===lt.MUTE?(it.log("Setting sample to muted"),t.stateMachineCallbacks.mute(s,n)):e===lt.UN_MUTE&&(it.log("Setting sample to unmuted"),t.stateMachineCallbacks.unMute(s,n))}},onseek:function(e,a,i,s){t.seekStartedAt=t.seekStartedAt||s},onseeked:function(e,a,i,s){t.seekedTimestamp=s},ontimechanged:function(e,a,i,s,n){var r=s-t.onEnterStateTimestamp;r>E&&(t.stateMachineCallbacks.setVideoTimeEndFromEvent(n),it.log("Sending heartbeat"),t.stateMachineCallbacks.heartbeat(r,a.toLowerCase(),n),t.onEnterStateTimestamp=s,t.stateMachineCallbacks.setVideoTimeStartFromEvent(n),t.stateMachineCallbacks.resetSessionExpiry())},onplayerError:function(e,a,i,s,n){t.stateMachineCallbacks.error(n)}}})}},{key:"callEvent",value:function(t,e,a){var i=this.stateMachine[t];i?i.call(this.stateMachine,a,e):it.log("Ignored Event: "+t)}},{key:"updateMetadata",value:function(t){this.stateMachineCallbacks.updateSample(t)}}],i=[{key:"pad",value:function(t,e){return(t+new Array(e).join(" ")).slice(0,e)}}],a&&De(e.prototype,a),i&&De(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Ue(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}const Pe=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,a,i;return e=t,i=[{key:"getAnalyticsStateMachine",value:function(t,e){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return ot.isBitmovinVersionPre7(t)?new ue(e,a):ot.isBitmovinVersion7Plus(t)?new de(e,a):ot.isVideoJs(t)?new _e(e,a):(ot.isHlsjs(t)||ot.isDashjs(t)||ot.isShaka(t),new ge(e,a))}}],(a=null)&&Ue(e.prototype,a),i&&Ue(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Ce(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}const Ge=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,a,i;return e=t,(a=[{key:"setUp",value:function(){it.log("setting up cast session"),this.castSession=cast.framework.CastContext.getInstance().getCurrentSession(),this.addMessageListener()}},{key:"addMessageListener",value:function(){var t=this,e=this.castSession.getApplicationMetadata();!e||e.namespaces.indexOf(l)<0?it.log("No analytics on chrome cast receiver enabled!"):(it.log("adding message listener"),this.castSession.addMessageListener(l,(function(e,a){it.log("Received: "+e+" "+a);try{var i=JSON.parse(a);t.handleReceiverMessage(i)}catch(t){it.error("Message parsing failed "+a)}})))}},{key:"handleReceiverMessage",value:function(t){it.log(t)}},{key:"sendMessage",value:function(t){var e=this.castSession.getApplicationMetadata();!e||e.namespaces.indexOf(l)<0?it.log("No analytics on chrome cast receiver enabled!"):(it.log("Sending message: "+JSON.stringify(t)),this.castSession.sendMessage(l,t))}}])&&Ce(e.prototype,a),i&&Ce(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();function be(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}const Re=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,a,i;return e=t,(a=[{key:"setUp",value:function(){var t=this,e=cast.receiver.CastReceiverManager.getInstance();this.messageBus=e.getCastMessageBus(l,cast.receiver.CastMessageBus.MessageType.JSON),it.log(this.messageBus),this.messageBus.onMessage=function(e){it.log("Received message from cast client: "+JSON.stringify(e));var a=e.data;t.handleClientMessage(a)}}},{key:"setCallback",value:function(t){this.callback=t}},{key:"handleClientMessage",value:function(t){this.callback(t)}},{key:"sendMessage",value:function(t){this.messageBus.broadcast(t)}}])&&be(e.prototype,a),i&&be(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();const Le={SETUP:"event_setup",PLAYER_READY:"event_player_ready",PLAYBACK_READY:"event_playback_ready",PLAYBACK_STARTED:"event_playback_started",PAUSE:"event_pause",PLAY:"event_play",PLAYING:"event_playing",PLAYBACK_UPDATE:"event_playback_update",END:"event_ended",MUTE:"event_muted",UNMUTE:"event_unmute",SEEKED:"event_seeked",START_REBUFFER:"event_rebuffer_start",END_REBUFFER:"event_rebuffer_end",ERROR:"event_error"};function Ye(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function Fe(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}var ke=function(){function t(e){var a=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Fe(this,"register",(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t)return a.analyticsStateMachine=new ge(a.stateMachineCallbacks,e),a.analyticsStateMachine;e.starttime||(e.starttime=n.getCurrentTimestamp()),a.analyticsStateMachine=Pe.getAnalyticsStateMachine(t,a.stateMachineCallbacks,e),a.adapter=se.getAdapter(t,a.record,a.analyticsStateMachine,e.mediaElement),a.adapter||it.error("Could not detect player.")})),Fe(this,"getCurrentImpressionId",(function(){return a.sample.impressionId})),Fe(this,"record",(function(t,e){e=e||{},a.analyticsStateMachine.callEvent(t,e,n.getCurrentTimestamp())})),Fe(this,"setDroppedFrames",(function(t){})),this.config=e,this.analyticsCall=new b,this.sessionCreationCall=new V,this.playerInitCall=new $,this.castClient=new Ge,this.castReceiver=new Re,this.droppedSampleFrames=0,this.licensing="granted",this.startupTime=0,this.pageLoadType=t.PAGE_LOAD_TYPE.FOREGROUND,this.autoplay=void 0,this.isCastClient=!1,this.isCastReceiver=!1,this.isAllowedToSendSamples=!1,this.samplesQueue=[],this.previousState=void 0,this.previousStateTimeStamp=new Date,this.firstPlayTimestamp=0,this.isMuted=!1,this.isFullScreen=void 0,this.videoWidthPixels=void 0,this.videoHeightPixels=void 0,this.upscalePercentage=void 0,this.downscalePercentage=void 0,this.videoBitrate=void 0,this.currentTime=0;try{this.orientation=screen.orientation.type.match(/\w+/)[0],screen.orientation.onchange=function(){this.orientation=screen.orientation.type.match(/\w+/)[0]}}catch(t){this.orientation="undetected"}this.setConfigParameters(),this.init(),this.setupSample(),this.setupStateMachineCallbacks()}var e,a,i;return e=t,a=[{key:"init",value:function(){if(this.isCastReceiver||""!=this.config.property_id&&n.validString(this.config.property_id)){it.setLogging(this.config.debug||!1),this.propertyId=this.config.property_id,"window"==typeof window&&window?this.pageURL=window.location!=window.parent.location?document.referrer:document.location.href:this.config.page_url?this.pageURL=this.config.page_url:this.pageURL=null;var t=!1;this.config.test&&(t=!0);var e=null;this.config.sessionID&&(e=this.config.sessionID);var a=!0;this.config.hasOwnProperty("sendSessionRequest")&&(a=this.config.sendSessionRequest);var i=null;this.config.userID&&(i=this.config.userID),this.setUserId(t,i),this.setSessionId(t,e,a),this.setPlayerInstanceId(),this.setPlaybackId()}else console.error("Invalid analytics property_id provided")}},{key:"setConfigParameters",value:function(){arguments.length>0&&void 0!==arguments[0]||this.sample;var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.config;this.customData1=n.getCustomDataString(t.customData1),this.customData2=n.getCustomDataString(t.customData2),this.customData3=n.getCustomDataString(t.customData3),this.customData4=n.getCustomDataString(t.customData4),this.customData5=n.getCustomDataString(t.customData5),this.customData6=n.getCustomDataString(t.customData6),this.customData7=n.getCustomDataString(t.customData7),this.customData8=n.getCustomDataString(t.customData8),this.customData9=n.getCustomDataString(t.customData9),this.customData10=n.getCustomDataString(t.customData10),this.customPlayerIntegrationVersion=n.getCustomDataString(t.customPlayerIntegrationVersion),this.customPlayerName=n.getCustomDataString(t.customPlayerName),this.customPageType=n.getCustomDataString(t.customPageType),this.customUserId=n.getCustomDataString(t.userId),this.userName=n.getCustomDataString(t.userName),this.userEMail=n.getCustomDataString(t.userEMail),this.userPhone=n.getCustomDataString(t.userPhone),this.userProfileImage=n.getCustomDataString(t.userProfileImage),this.userAddressLine1=n.getCustomDataString(t.userAddressLine1),this.userAddressLine2=n.getCustomDataString(t.userAddressLine2),this.userCity=n.getCustomDataString(t.userCity),this.userState=n.getCustomDataString(t.userState),this.userCountry=n.getCustomDataString(t.userCountry),this.userZipcode=n.getCustomDataString(t.userZipcode),this.customContentType=n.getCustomDataString(t.customContentType),this.customVideoDurationMillis=n.getCustomDataString(t.customVideoDurationMillis),this.customEncodingVariant=n.getCustomDataString(t.customEncodingVariant),this.customVideoLanguage=n.getCustomDataString(t.customVideoLanguage),this.customVideoId=n.getCustomDataString(t.customVideoId),this.customVideoSeries=n.getCustomDataString(t.customVideoSeries),this.customVideoProducer=n.getCustomDataString(t.customVideoProducer),this.customVideoTitle=n.getCustomDataString(t.customVideoTitle),this.customVideoVariantName=n.getCustomDataString(t.customVideoVariantName),this.customVideoVariant=n.getCustomDataString(t.customVideoVariant),this.SDKVersion="1.0.0",this.experimentName=t.experimentName}},{key:"updateCustomUserData",value:function(t){this.customUserId=n.getCustomDataString(t.userId),this.userName=n.getCustomDataString(t.userName),this.userEMail=n.getCustomDataString(t.userEMail),this.userPhone=n.getCustomDataString(t.userPhone),this.userProfileImage=n.getCustomDataString(t.userProfileImage),this.userAddressLine1=n.getCustomDataString(t.userAddressLine1),this.userAddressLine2=n.getCustomDataString(t.userAddressLine2),this.userCity=n.getCustomDataString(t.userCity),this.userState=n.getCustomDataString(t.userState),this.userCountry=n.getCustomDataString(t.userCountry),this.userZipcode=n.getCustomDataString(t.userZipcode)}},{key:"updateCustomVideoData",value:function(t){this.customContentType=n.getCustomDataString(t.customContentType),this.customVideoDurationMillis=n.getCustomDataString(t.customVideoDurationMillis),this.customEncodingVariant=n.getCustomDataString(t.customEncodingVariant),this.customVideoLanguage=n.getCustomDataString(t.customVideoLanguage),this.customVideoId=n.getCustomDataString(t.customVideoId),this.customVideoSeries=n.getCustomDataString(t.customVideoSeries),this.customVideoProducer=n.getCustomDataString(t.customVideoProducer),this.customVideoTitle=n.getCustomDataString(t.customVideoTitle),this.customVideoVariantName=n.getCustomDataString(t.customVideoVariantName),this.customVideoVariant=n.getCustomDataString(t.customVideoVariant)}},{key:"updateCustomData",value:function(t){this.customData1=n.getCustomDataString(t.customData1),this.customData2=n.getCustomDataString(t.customData2),this.customData3=n.getCustomDataString(t.customData3),this.customData4=n.getCustomDataString(t.customData4),this.customData5=n.getCustomDataString(t.customData5),this.customData6=n.getCustomDataString(t.customData6),this.customData7=n.getCustomDataString(t.customData7),this.customData8=n.getCustomDataString(t.customData8),this.customData9=n.getCustomDataString(t.customData9),this.customData10=n.getCustomDataString(t.customData10)}},{key:"updateCustomPlayerData",value:function(t){this.customPlayerIntegrationVersion=n.getCustomDataString(t.customPlayerIntegrationVersion),this.customPlayerName=n.getCustomDataString(t.customPlayerName),this.customPageType=n.getCustomDataString(t.customPageType)}},{key:"setSessionData",value:function(){this.sessionData={session_id:this.sessionId,property_id:this.propertyId,user_id:this.userId,custom_user_id:this.customUserId,custom_data_1:this.customData1,custom_data_2:this.customData2,custom_data_3:this.customData3,custom_data_4:this.customData4,custom_data_5:this.customData5,custom_data_6:this.customData6,custom_data_7:this.customData7,custom_data_8:this.customData8,custom_data_9:this.customData9,custom_data_10:this.customData10,user_name:this.userName,user_email:this.userEMail,user_phone:this.userPhone,user_profile_image:this.userProfileImage,user_address_line1:this.userAddressLine1,user_address_line2:this.userAddressLine2,user_city:this.userCity,user_state:this.userState,user_country:this.userCountry,user_zipcode:this.userZipcode,viewer_client_version:this.SDKVersion,meta_browser:this.meta_browser,meta_device_manufacturer:this.meta_device_manufacturer,meta_operating_system_version:this.meta_operating_system_version,meta_operating_system:this.meta_operating_system,meta_device_name:this.meta_device_name,meta_browser_version:this.meta_browser_version,meta_device_category:this.meta_device_category,meta_device_architecture:this.meta_device_architecture,meta_device_display_width:this.meta_device_display_width,meta_device_display_height:this.meta_device_display_height,meta_device_is_touchscreen:this.meta_device_is_touchscreen,meta_device_display_dpr:this.meta_device_display_dpr},this.config.deviceData?(this.sessionData.meta_device_name=this.config.deviceData.meta_device_name,this.sessionData.meta_device_manufacturer=this.config.deviceData.meta_device_manufacturer,this.sessionData.meta_operating_system_version=this.config.deviceData.meta_operating_system_version,this.sessionData.meta_operating_system=this.config.deviceData.meta_operating_system,this.sessionData.meta_browser=this.config.deviceData.meta_browser,this.sessionData.meta_device_display_dpr=this.config.deviceData.meta_device_display_dpr,this.sessionData.meta_browser_version=this.config.deviceData.meta_browser_version,this.sessionData.meta_device_category=this.config.deviceData.meta_device_category,this.sessionData.meta_device_architecture=this.config.deviceData.meta_device_architecture,this.sessionData.meta_device_display_width=this.config.deviceData.meta_device_display_width,this.sessionData.meta_device_display_height=this.config.deviceData.meta_device_display_height,this.sessionData.meta_device_is_touchscreen=this.config.deviceData.meta_device_is_touchscreen):(this.sessionData.meta_device_display_width=window.screen.width,this.sessionData.meta_device_display_height=window.screen.height,this.sessionData.meta_device_display_dpr=parseInt(window.devicePixelRatio),"ontouchstart"in document.documentElement&&(this.sessionData.meta_device_is_touchscreen="true"))}},{key:"setPlayerData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.playerData={player_instance_id:this.playerInstanceId,property_id:this.propertyId,session_id:this.sessionId,user_id:this.userId,custom_user_id:this.customUserId,custom_data_1:this.customData1,custom_data_2:this.customData2,custom_data_3:this.customData3,custom_data_4:this.customData4,custom_data_5:this.customData5,custom_data_6:this.customData6,custom_data_7:this.customData7,custom_data_8:this.customData8,custom_data_9:this.customData9,custom_data_10:this.customData10,player_integration_version:this.customPlayerIntegrationVersion,meta_page_type:this.customPageType,meta_page_url:this.pageURL},this.config.deviceData&&(this.playerData.player_preload=this.config.playerData.player_preload,this.playerData.player_autoplay=this.config.playerData.player_autoplay,this.playerData.player_software_version=this.config.playerData.player_software_version,this.playerData.player_integration_version=this.config.playerData.player_integration_version,this.playerData.player_name=this.config.playerData.player_name,this.playerData.player_language_code=this.config.playerData.player_language_code,this.playerData.player_software=this.config.playerData.player_software,this.playerData.meta_page_url=this.config.playerData.meta_page_url,this.playerData.meta_page_type=this.config.playerData.meta_page_type),t&&n.validNumber(t.videoWindowHeight)&&(this.playerData.player_height_pixels=t.videoWindowHeight),t&&n.validNumber(t.videoWindowWidth)&&(this.playerData.player_width_pixels=t.videoWindowWidth),t&&n.validBoolean(t.autoplay)&&(this.playerData.player_autoplay=t.autoplay),t&&n.validBoolean(t.preload)&&(this.playerData.player_preload=t.preload),t&&n.validString(t.version)&&(this.playerData.player_software_version=t.version),t&&n.validString(t.audioLanguage)&&(this.playerData.player_language_code=t.audioLanguage),t&&n.validString(t.playerSoftware)&&(this.playerData.player_software=t.playerSoftware)}},{key:"setUserId",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e)this.userId=e;else if(t)this.userId=n.uuidv4();else{var a=n.getCookie("gumlet_user_id");if(a&&""!==a)this.userId=a;else{var i=new Date;i.setTime(i.getTime()+2592e6),document.cookie="gumlet_user_id="+n.uuidv4()+"; expires="+i.toUTCString()+"; path=/",this.userId=n.getCookie("gumlet_user_id")}}}},{key:"setPlayerInstanceId",value:function(){this.config.getUUID?this.playerInstanceId=this.config.getUUID():this.playerInstanceId=n.uuidv4(),this.setPlayerData()}},{key:"setPlaybackId",value:function(){this.config.getUUID?this.playbackId=this.config.getUUID():this.playbackId=n.uuidv4()}},{key:"setSessionId",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(e)return this.sessionId=e,this.setSessionData(),void(a&&this.sessionCreationCall.sendRequest(this.sessionData,n.noOp));if(t)this.sessionId=n.uuidv4();else{var i=n.getCookie("gumlet_session_id");if(i&&""!==i)this.sessionId=i,this.setSessionData();else{var s=new Date;s.setTime(s.getTime()+18e5),document.cookie="gumlet_session_id="+n.uuidv4()+"; expires="+s.toUTCString()+"; path=/",this.sessionId=n.getCookie("gumlet_session_id"),this.setSessionData(),this.sessionCreationCall.sendRequest(this.sessionData,n.noOp)}}}},{key:"sendAnalyticsSetupCall",value:function(){this.sendAnalyticsRequestAndClearValues(Le.SETUP,{millis_from_previous_event:0}),this.setState(Le.SETUP)}},{key:"getMillisFromPreviousState",value:function(){return(new Date).getTime()-this.previousStateTimeStamp.getTime()}},{key:"setVideoData",value:function(t){t&&n.validNumber(t.duration)&&(this.videoDuration=n.calculateTime(t.duration)),t&&n.validString(t.streamType)&&(this.videoSourceType=t.streamType,"dash"===t.streamType&&n.validString(t.mpdUrl)?(this.videoSourceUrl=t.mpdUrl,this.videoSourceHostname=new URL(this.videoSourceUrl).hostname):"hls"===t.streamType&&n.validString(t.m3u8Url)?(this.videoSourceUrl=t.m3u8Url,this.videoSourceHostname=new URL(this.videoSourceUrl).hostname):"hls"===t.streamType&&n.validString(t.streamUrl)?(this.videoSourceUrl=t.streamUrl,this.videoSourceHostname=new URL(this.videoSourceUrl).hostname):"progressive"===t.streamType&&n.validString(t.progUrl)?(this.videoSourceUrl=t.progUrl,this.videoSourceHostname=new URL(this.videoSourceUrl).hostname):t&&t.streamUrl&&(this.videoSourceUrl=t.streamUrl,this.videoSourceHostname=new URL(this.videoSourceUrl).hostname)),t&&t.streamUrl&&(this.videoSourceUrl=t.streamUrl),t&&t.sourceHostName&&(this.videoSourceHostname=t.sourceHostName),t&&t.hasOwnProperty("muted")&&(this.isMuted=t.muted),t&&t.currentVideoData&&n.validNumber(t.currentVideoData.height)&&t.currentVideoData.height>0&&(this.videoHeightPixels=t.currentVideoData.height),t&&t.currentVideoData&&n.validNumber(t.currentVideoData.width)&&t.currentVideoData.width>0&&(this.videoWidthPixels=t.currentVideoData.width),t&&t.currentVideoData&&n.validNumber(t.currentVideoData.bitrate)&&t.currentVideoData.bitrate>-1&&(this.videoBitrate=t.currentVideoData.bitrate/1e6);var e=0;if(!this.videoWidthPixels||!this.playerData.player_width_pixels)return this.upscalePercentage=void 0,void(this.downscalePercentage=void 0);(e=(this.playerData.player_width_pixels-this.videoWidthPixels)/this.videoWidthPixels)>0?(this.upscalePercentage=100*e,this.downscalePercentage=0):e<0?(this.upscalePercentage=0,this.downscalePercentage=100*e*-1):(this.upscalePercentage=0,this.downscalePercentage=0)}},{key:"setupStateMachineCallbacks",value:function(){var e=this;this.stateMachineCallbacks={setup:function(t,a,i){it.log("Setup Gumlet analytics "+e.analyticsVersion),e.setDuration(t),e.setVideoData(i),e.sendAnalyticsRequestAndClearValues(Le.SETUP,{millis_from_previous_event:0}),e.setState(Le.SETUP)},ready:function(t,a,i){e.setDuration(t),e.setVideoData(i),e.setPlaybackSettingsFromLoadedEvent(i),e.sendAnalyticsRequestAndClearValues(Le.PLAYER_READY),e.setState(Le.PLAYER_READY),e.setPlayerData(i),e.playerInitCall.sendRequest(e.playerData,n.noOp)},loaded:function(t,a,i){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;e.setDuration(t),e.setVideoData(i),e.setPlaybackSettingsFromLoadedEvent(i);var n={};null!==s&&(n={millis_from_previous_event:s,previous_event:Le.PLAYER_READY}),e.sendAnalyticsRequestAndClearValues(Le.PLAYBACK_READY,n),null===s&&e.setState(Le.PLAYBACK_READY)},startup:function(t,a){e.setDuration(t)},first_play:function(t,a,i){e.setDuration(t),e.setVideoData(i),e.setPlaybackSettingsFromLoadedEvent(i),e.sendAnalyticsRequestAndClearValues(Le.PLAY),e.setState(Le.PLAY),e.firstPlayTimestamp=new Date},play:function(t,a,i){e.setDuration(t),e.setVideoData(i),e.setPlaybackSettingsFromLoadedEvent(i),e.sendAnalyticsRequestAndClearValues(Le.PLAY),e.setState(Le.PLAY)},updateSample:function(t){e.setPlaybackSettingsFromLoadedEvent(t)},playing:function(t,a,i){e.setDuration(t),e.setVideoData(i),e.setPlaybackSettingsFromLoadedEvent(i),e.sendAnalyticsRequestAndClearValues(Le.PLAYING),e.setState(Le.PLAYING)},playback_started:function(t,a,i){e.setDuration(t),e.setVideoData(i),e.setPlaybackSettingsFromLoadedEvent(i);var s=(new Date).getTime()-e.firstPlayTimestamp.getTime();e.sendAnalyticsRequestAndClearValues(Le.PLAYBACK_STARTED,{millis_from_previous_event:s}),e.setState(Le.PLAYBACK_STARTED)},playingAndBye:function(t,a,i){e.setDuration(t),e.setDroppedFrames(i),e.sendUnloadRequest()},heartbeat:function(t,a,i){e.setDuration(t),e.setVideoData(i),e.setPlaybackSettingsFromLoadedEvent(i),e.sendAnalyticsRequestAndClearValues(Le.PLAYBACK_UPDATE),e.setState(Le.PLAYBACK_UPDATE)},qualitychange:function(t,a){e.setDuration(t)},qualitychange_pause:function(t,a){e.setDuration(t)},qualitychange_rebuffering:function(t,a){e.setDuration(t)},videoChange:function(t){e.stateMachineCallbacks.setVideoTimeEndFromEvent(t),e.stateMachineCallbacks.setVideoTimeStartFromEvent(t),e.setPlaybackSettingsFromLoadedEvent(t)},audioChange:function(t){e.stateMachineCallbacks.setVideoTimeEndFromEvent(t),e.stateMachineCallbacks.setVideoTimeStartFromEvent(t)},pause:function(t,a,i){e.setDuration(t),e.setVideoData(i),e.setPlaybackSettingsFromLoadedEvent(i),e.sendAnalyticsRequestAndClearValues(Le.PAUSE),e.setState(Le.PAUSE)},start_rebuffer:function(t,a,i){var s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];e.setDuration(t),e.setVideoData(i),e.setPlaybackSettingsFromLoadedEvent(i),s||e.sendAnalyticsRequestAndClearValues(Le.START_REBUFFER),e.setState(Le.START_REBUFFER)},end_rebuffer:function(t,a,i){var s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e.setDuration(t),e.setVideoData(i),e.setPlaybackSettingsFromLoadedEvent(i),s)return e.getSample(Le.END_REBUFFER);e.sendAnalyticsRequestAndClearValues(Le.END_REBUFFER),e.setState(Le.END_REBUFFER)},playback_seeked:function(t,a,i,s){e.setVideoData(event),e.setPlaybackSettingsFromLoadedEvent(event),e.sendAnalyticsRequestAndClearValues(Le.SEEKED,{from:t,to:a}),e.setState(Le.SEEKED),e.setupSample(),"PAUSE"===s?(e.sendAnalyticsRequestAndClearValues(Le.PAUSE,{millis_from_previous_event:i}),e.setState(Le.PAUSE)):"PLAYING"===s&&(e.sendAnalyticsRequestAndClearValues(Le.PLAYING,{millis_from_previous_event:i}),e.setState(Le.PLAYING))},paused_seeking:function(t,a,i){e.setDuration(t)},play_seeking:n.noOp,end_play_seeking:function(t,a,i){e.setDuration(t)},rebuffering:function(t,a,i){e.setDuration(t)},error:function(t){e.stateMachineCallbacks.setVideoTimeEndFromEvent(t),e.stateMachineCallbacks.setVideoTimeStartFromEvent(t),e.sendAnalyticsRequestAndClearValues(Le.ERROR,{error_code:t.code,error:t.message}),e.setState(Le.ERROR),e.setupSample()},end:function(t,a,i){e.setPlaybackId(),e.setDuration(t),e.sendAnalyticsRequestAndClearValues(Le.END),e.setState(Le.END)},ad:function(t,a,i){e.setDuration(t),e.setDroppedFrames(i)},mute:function(t,a){e.isMuted=!0,e.setPlaybackSettingsFromLoadedEvent(a),e.sendAnalyticsRequestAndClearValues(Le.MUTE)},unMute:function(t,a){e.isMuted=!1,e.setPlaybackSettingsFromLoadedEvent(a),e.sendAnalyticsRequestAndClearValues(Le.UNMUTE)},muting_ready:n.noOp,muting_play:n.noOp,muting_pause:n.noOp,setVideoTimeEndFromEvent:function(t){},setVideoTimeStartFromEvent:function(t){},startCasting:function(a,i){if(i&&i.resuming)return e.isAllowedToSendSamples=!1,void it.warning("Player started casting but a session is already casting!");e.isCastClient=!0,e.isAllowedToSendSamples=!1;var s=e.sample,n=s.domain,r=s.path,o=s.language,l=s.userAgent,u=s.userId,E=s.impressionId,c={type:t.CAST_RECEIVER_CONFIG_MESSAGE,data:{config:e.config,userId:u,domain:n,path:r,language:o,userAgent:l,impressionId:E}};e.castClient.setUp(),e.castClient.sendMessage(c)},casting:function(){e.isCastClient=!1,e.samplesQueue=[],e.isAllowedToSendSamples=!0},source_changing:function(){},resetSessionExpiry:function(){var t=!1;if(e.config.test&&(t=!0),!e.config.sessionID){var a=n.getCookie("gumlet_session_id");if(a&&""!==a){var i=new Date;i.setTime(i.getTime()+18e5),"window"==typeof window&&window?document.cookie="gumlet_session_id="+a+"; expires="+i.toUTCString()+"; path=/":i.toUTCString()}else e.setSessionId(t)}}}}},{key:"setDuration",value:function(t){}},{key:"setState",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;t&&(this.previousState=t,this.previousStateTimeStamp=new Date)}},{key:"setPlaybackSettingsFromLoadedEvent",value:function(t){t&&n.validNumber(t.currentTime)&&(this.currentTime=n.calculateTime(t.currentTime)),t&&n.validBoolean(t.isFullScreen)&&(this.isFullScreen=t.isFullScreen),t&&n.validBoolean(t.isCasting)&&(this.isCasting=t.isCasting)}},{key:"setupSample",value:function(){this.sample={property_id:this.propertyId,session_id:this.sessionId,user_id:this.userId,player_instance_id:this.playerInstanceId,playback_id:this.playbackId,from:void 0,to:void 0,playback_time_instant_millis:void 0,bitrate_mbps:this.videoBitrate,error_code:void 0,error:void 0,error_text:void 0,video_cover:void 0,video_cover_reference:void 0,player_remote_played:void 0,video_total_duration_millis:this.videoDuration,video_width_pixels:void 0,video_height_pixels:void 0,video_source_url:void 0,video_source_hostname:void 0,video_source_type:void 0,custom_content_type:this.customContentType,custom_video_duration_millis:this.customVideoDurationMillis,custom_encoding_variant:this.customEncodingVariant,custom_video_language:this.customVideoLanguage,custom_video_id:this.customVideoId,custom_video_series:this.customVideoSeries,custom_video_producer:this.customVideoProducer,custom_video_title:this.customVideoTitle,custom_video_variant_name:this.customVideoVariantName,custom_video_variant:this.customVideoVariant,muted:this.isMuted,casting:void 0,fullscreen:this.isFullScreen,video_downscale_percentage:void 0,video_upscale_percentage:void 0,orientation:void 0,orientation_from:void 0,quality:void 0,quality_from:void 0,previous_event:void 0,millis_from_previous_event:void 0,custom_data_1:this.customData1,custom_data_2:this.customData2,custom_data_3:this.customData3,custom_data_4:this.customData4,custom_data_5:this.customData5,custom_data_6:this.customData6,custom_data_7:this.customData7,custom_data_8:this.customData8,custom_data_9:this.customData9,custom_data_10:this.customData10}}},{key:"getSample",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=this.sample;return a.event=t,this.config.getUUID?a.event_id=this.config.getUUID():a.event_id=n.uuidv4(),a.millis_from_previous_event=this.getMillisFromPreviousState(),a.previous_event=this.previousState,a.fullscreen=this.isFullScreen,a.muted=this.isMuted,a.video_width_pixels=this.videoWidthPixels,a.video_height_pixels=this.videoHeightPixels,a.video_total_duration_millis=this.videoDuration,a.bitrate=this.videoBitrate,a.orientation=this.orientation,a.playback_time_instant_millis=this.currentTime,a.video_source_type=this.videoSourceType,a.video_source_url=this.videoSourceUrl,a.video_upscale_percentage=this.upscalePercentage,a.video_downscale_percentage=this.downscalePercentage,a.video_source_hostname=this.videoSourceHostname,Object.keys(e).forEach((function(t){a[t]=e[t]})),a}},{key:"sendAnalyticsRequest",value:function(t,e){var a=this.getSample(t,e);this.analyticsCall.sendRequest(a,n.noOp)}},{key:"sendAnalyticsRequestAndClearValues",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t)return it.log("event null passed not hitting the injestion API"),False;this.sendAnalyticsRequest(t,e)}},{key:"sendUnloadRequest",value:function(){"denied"!==this.licensing&&(void 0===navigator.sendBeacon?this.sendAnalyticsRequestSynchronous():navigator.sendBeacon(this.analyticsCall.getAnalyticsServerUrl(),JSON.stringify(this.sample))||this.sendAnalyticsRequestSynchronous())}},{key:"sendAnalyticsRequestSynchronous",value:function(){"denied"!==this.licensing&&this.analyticsCall.sendRequestSynchronous(this.sample,n.noOp)}},{key:"clearValues",value:function(){this.sample.ad=0,this.sample.paused=0,this.sample.played=0,this.sample.seeked=0,this.sample.buffered=0,this.sample.playerStartupTime=0,this.sample.videoStartupTime=0,this.sample.startupTime=0,this.sample.duration=0,this.sample.droppedFrames=0,this.sample.pageLoadType=0}},{key:"getDroppedFrames",value:function(t){if(null!=t&&0!=t){var e=t-this.droppedSampleFrames;return this.droppedSampleFrames=t,e}return 0}}],a&&Ye(e.prototype,a),i&&Ye(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();Fe(ke,"PAGE_LOAD_TYPE",{FOREGROUND:1,BACKGROUND:2}),Fe(ke,"LICENSE_CALL_PENDING_TIMEOUT",200),Fe(ke,"PAGE_LOAD_TYPE_TIMEOUT",200),Fe(ke,"CAST_RECEIVER_CONFIG_MESSAGE","CAST_RECEIVER_CONFIG_MESSAGE");const Oe=ke;const we={CLOUDFLARE:"cloudflare",AKAMAI:"akamai",FASTLY:"fastly",MAXCDN:"maxcdn",CLOUDFRONT:"cloudfront",CHINACACHE:"chinacache",BITGRAVITY:"bitgravity"};var Me,He=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Me.register(t,e)},Ke=function(){return Me.getCurrentImpressionId()},Ve=function(){return Me.analyticsStateMachine},Be=function(t){return Me=new Oe(t),{register:He,getCurrentImpressionId:Ke,stateMachine:Ve,setCustomData:Me.setCustomData,setCustomDataOnce:Me.setCustomDataOnce}};Be.Players=bt,Be.CdnProviders=we,"undefined"!=typeof window&&(window.gumlet=window.gumlet||{},window.gumlet.insights=Be,window.gumletInsightsEvents=lt,window.gumletSupportedPlayers=bt);const je=Be})(),i})()));
|
package/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"@gumlet/insights-js-core","version":"1.0.1","description":"Gumlet Insights allows you to collect data from Video playback.","license":"MIT","repository":{"type":"git","url":"https://gitlab.com/gumlet/insights-js-core.git"},"main":"gumlet-insights.min.js","readme":"Please visit: https://docs.gumlet.com/docs/insights-getting-started","author":"Gumlet Pte. Ltd.","homepage":"https://docs.gumlet.com/docs/insights-getting-started","bugs":{"url":"https://www.gumlet.com/contact/"},"maintainers":[{"name":"Gumlet Team","email":"support@gumlet.com"}]}
|