@playkit-js/playkit-js-providers 2.45.1 → 2.45.2

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.
@@ -1,2 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===n(t)?t:String(t)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function s(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,r){return(t=o(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}e.r(t),e.d(t,{NAME:function(){return A},OVPAnalyticsService:function(){return C},OVPConfiguration:function(){return v},RequestBuilder:function(){return l},VERSION:function(){return P}});var c=function(){return{VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:function(){},debug:function(){},enabledFor:function(){},error:function(){},get:function(){},getLevel:function(){},info:function(){},log:function(){},setHandler:function(){},setLevel:function(){},time:function(){},timeEnd:function(){},trace:function(){},useDefaults:function(){},warn:function(){}}};var u=function(e){return c(e)},f=s((function e(t,n,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r(this,e),this.severity=t,this.category=n,this.code=o,this.data=i,e._logger.error("Category:".concat(n," | Code:").concat(o," |"),i)}));a(f,"Severity",{RECOVERABLE:1,CRITICAL:2}),a(f,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),a(f,"Code",{UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,BAD_SERVER_RESPONSE:1005,MULTIREQUEST_API_ERROR:1006,API_RESPONSE_MISMATCH:1007,ERROR:2e3,BLOCK_ACTION:2001,MEDIA_STATUS_NOT_READY:2002,SCHEDULED_RESTRICTED:2003,DELETED_ENTRY:2004,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),a(f,"_logger",u("Error"));var l=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;r(this,e),a(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),a(this,"_attemptCounter",1),this.headers=t}return s(e,[{key:"getUrl",value:function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")}},{key:"doHttpRequest",value:function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t}},{key:"_createXHR",value:function(){var e=this,t=new XMLHttpRequest;t.onreadystatechange=function(){if(4===t.readyState&&200===t.status)try{var r=JSON.parse(t.responseText);return e.responseHeaders=e._getResponseHeaders(t),e._requestPromise.resolve(r)}catch(r){e._requestPromise.reject(e._createError(t,f.Code.BAD_SERVER_RESPONSE,{text:t.responseText}))}},t.open(this.method,this.url,this.retryConfig.async),this.retryConfig.async&&this.retryConfig.timeout&&(t.timeout=this.retryConfig.timeout);var r=performance.now();t.ontimeout=function(){e._handleError(t,f.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,f.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)}},{key:"_getResponseHeaders",value:function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))}},{key:"_handleError",value:function(e,t,r){var n=this._createError(e,t,r);if(e.onreadystatechange=function(){},e.onerror=function(){},e.ontimeout=function(){},e.onabort=function(){},!(this.retryConfig.maxAttempts&&this._attemptCounter<this.retryConfig.maxAttempts))return this._requestPromise.reject(n);this._attemptCounter++,this._createXHR()}},{key:"_createError",value:function(e,t,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(e),attempt:this._attemptCounter}),new f(f.Severity.CRITICAL,f.Category.NETWORK,t,r)}}]),e}(),p=function e(t){var r;return Array.isArray(t)?(r=t.length>0?t.slice(0):[]).forEach((function(t,o){("object"===n(t)||Array.isArray(t)&&t.length>0)&&(r[o]=e(t))})):"object"===n(t)?(r=Object.assign({},t),Object.keys(r).forEach((function(t){("object"===n(r[t])||Array.isArray(r[t])&&r[t].length>0)&&(r[t]=e(r[t]))}))):r=t,r},y={serviceUrl:"https://cdnapisec.kaltura.com/api_v3",cdnUrl:"https://cdnapisec.kaltura.com",serviceParams:{apiVersion:"3.3.0",format:1},useApiCaptions:!0,loadThumbnailWithKs:!1,replaceHostOnlyManifestUrls:!1},v=function(){function e(){r(this,e)}return s(e,null,[{key:"set",value:function(e){null!=e&&e.overrideServiceUrl&&(e.serviceUrl=e.overrideServiceUrl),e&&Object.assign(y,e)}},{key:"get",value:function(){return p(y)}},{key:"serviceUrl",get:function(){return y.serviceUrl}}]),e}();function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}var R=s((function e(t){r(this,e),a(this,"hasError",!1),"KalturaAPIException"===t.objectType?(this.hasError=!0,this.error=new O(t.code,t.message)):t.error&&"KalturaAPIException"===t.error.objectType?(this.hasError=!0,this.error=new O(t.error.code,t.error.message)):this.data=t})),O=s((function e(t,n){r(this,e),this.code=t,this.message=n}));var b=function(e){d(i,e);var t,n,o=(t=i,n=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(e){return!1}}(),function(){var e,r=E(t);if(n){var o=E(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return g(this,e)});function i(){var e;r(this,i);for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return a(m(e=o.call.apply(o,[this].concat(n))),"requests",[]),e}return s(i,[{key:"add",value:function(e){this.requests.push(e);var t={},r={service:e.service,action:e.action};return Object.assign(t,a({},this.requests.length,Object.assign(r,e.params))),Object.assign(t,this.params),this.params=t,this}},{key:"execute",value:function(e,t){var r=this;return new Promise((function(n,o){try{r.params=JSON.stringify(r.params)}catch(e){i._logger.error("".concat(e.message)),o(new f(f.Severity.CRITICAL,f.Category.PROVIDER,f.Code.FAILED_PARSING_REQUEST,{error:e,params:r.params}))}r.doHttpRequest().then((function(i){var s=new _(i,e,t);s.success?n({headers:r.responseHeaders,response:s}):o(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MULTIREQUEST_API_ERROR,{url:r.url,headers:r.responseHeaders,results:s.results}))}),(function(e){o(e)}))}))}}]),i}(l);a(b,"_logger",u("MultiRequestBuilder"));var _=s((function e(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];r(this,e),a(this,"results",[]);var i=t.result?t.result:t,s=(Array.isArray(i)?i:[i]).map((function(e){return new R(e)})),c=s.filter((function(e){return e.hasError}));c.forEach((function(t){e._logger.error("Service returned an error with error code: ".concat(t.error.code," and message: ").concat(t.error.message,"."))})),this.results=s,n&&c.length||c.length===this.results.length?this.success=!1:(o&&(this.results=this.results.filter((function(e){return!e.hasError}))),this.success=!0)}));a(_,"_logger",u("MultiRequestResult"));var T=function(e){var t=[],r=/\[\]$/,o=function(e){return"[object Array]"===Object.prototype.toString.call(e)},i=function(e,r){r="function"==typeof r?r():null==r?"":r,t[t.length]=encodeURIComponent(e)+"="+encodeURIComponent(r)};return function e(s,a){var c,u,f;if(s)if(o(a))for(c=0,u=a.length;c<u;c++)r.test(s)?i(s,a[c]):e(s+":"+("object"===n(a[c])?c:""),a[c]);else if(a&&"[object Object]"===String(a))for(f in a)e(s+":"+f,a[f]);else i(s,a);else if(o(a))for(c=0,u=a.length;c<u;c++)i(a[c].name,a[c].value);else for(f in a)e(f,a[f]);return t}("",e).join("&").replace(/%20/g,"+")};var S="analytics",C=function(e){d(i,e);var t,n,o=(t=i,n=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(e){return!1}}(),function(){var e,r=E(t);if(n){var o=E(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return g(this,e)});function i(){return r(this,i),o.apply(this,arguments)}return s(i,null,[{key:"trackEvent",value:function(e,t,r){return"POST"===r?i._trackEventByPOST(e,t):i._trackEventByGET(e,t)}},{key:"_trackEventByGET",value:function(e,t){var r=v.get(),n={};Object.assign(n,r.serviceParams,t);var o=new l;return o.service=S,o.action="trackEvent",o.method="GET",o.retryConfig.maxAttempts=1,o.tag="analytics-trackEvent",o.params=n,o.url=e+"?service="+o.service+"&action="+o.action+"&"+T(o.params),o}},{key:"_trackEventByPOST",value:function(e,t){var r=v.get(),n={};Object.assign(n,r.serviceParams,t);var o=new Map;o.set("Content-Type","application/json");var i=new l(o),s={eventType:n.eventType,partnerId:n.partnerId,entryId:n.entryId,sessionId:n.sessionId};return["eventType","partnerId","entryId","sessionId"].forEach((function(e){return delete n[e]})),i.service=S,i.action="trackEvent",i.method="POST",i.retryConfig.maxAttempts=1,i.tag="analytics-trackEvent",i.params=JSON.stringify(n),i.url=e+"?service="+i.service+"&action="+i.action+"&"+T(s),i}}]),i}(function(){function e(){r(this,e)}return s(e,null,[{key:"getMultiRequest",value:function(e,t,r){var n=v.get(),o=n.serviceParams;Object.assign(o,{ks:t,clientTag:"html5:v"+e}),r&&Object.assign(o,{partnerId:r});var i=new Map;i.set("Content-Type","application/json");var s=new b(i);return s.method="POST",s.service="multirequest",s.url=s.getUrl(n.serviceUrl),s.params=o,s}}]),e}()),A="@playkit-js/playkit-js-providers-analytics-service",P="2.45.1";return t}()}));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===n(t)?t:String(t)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function s(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,r){return(t=o(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}e.r(t),e.d(t,{NAME:function(){return A},OVPAnalyticsService:function(){return C},OVPConfiguration:function(){return v},RequestBuilder:function(){return l},VERSION:function(){return P}});var c=function(){return{VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:function(){},debug:function(){},enabledFor:function(){},error:function(){},get:function(){},getLevel:function(){},info:function(){},log:function(){},setHandler:function(){},setLevel:function(){},time:function(){},timeEnd:function(){},trace:function(){},useDefaults:function(){},warn:function(){}}};var u=function(e){return c(e)},f=s((function e(t,n,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r(this,e),this.severity=t,this.category=n,this.code=o,this.data=i,e._logger.error("Category:".concat(n," | Code:").concat(o," |"),i)}));a(f,"Severity",{RECOVERABLE:1,CRITICAL:2}),a(f,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),a(f,"Code",{UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,BAD_SERVER_RESPONSE:1005,MULTIREQUEST_API_ERROR:1006,API_RESPONSE_MISMATCH:1007,ERROR:2e3,BLOCK_ACTION:2001,MEDIA_STATUS_NOT_READY:2002,SCHEDULED_RESTRICTED:2003,DELETED_ENTRY:2004,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),a(f,"_logger",u("Error"));var l=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;r(this,e),a(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),a(this,"_attemptCounter",1),this.headers=t}return s(e,[{key:"getUrl",value:function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")}},{key:"doHttpRequest",value:function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t}},{key:"_createXHR",value:function(){var e=this,t=new XMLHttpRequest;t.onreadystatechange=function(){if(4===t.readyState&&200===t.status)try{var r=JSON.parse(t.responseText);return e.responseHeaders=e._getResponseHeaders(t),e._requestPromise.resolve(r)}catch(r){e._requestPromise.reject(e._createError(t,f.Code.BAD_SERVER_RESPONSE,{text:t.responseText}))}},t.open(this.method,this.url,this.retryConfig.async),this.retryConfig.async&&this.retryConfig.timeout&&(t.timeout=this.retryConfig.timeout);var r=performance.now();t.ontimeout=function(){e._handleError(t,f.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,f.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)}},{key:"_getResponseHeaders",value:function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))}},{key:"_handleError",value:function(e,t,r){var n=this._createError(e,t,r);if(e.onreadystatechange=function(){},e.onerror=function(){},e.ontimeout=function(){},e.onabort=function(){},!(this.retryConfig.maxAttempts&&this._attemptCounter<this.retryConfig.maxAttempts))return this._requestPromise.reject(n);this._attemptCounter++,this._createXHR()}},{key:"_createError",value:function(e,t,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(e),attempt:this._attemptCounter}),new f(f.Severity.CRITICAL,f.Category.NETWORK,t,r)}}]),e}(),p=function e(t){var r;return Array.isArray(t)?(r=t.length>0?t.slice(0):[]).forEach((function(t,o){("object"===n(t)||Array.isArray(t)&&t.length>0)&&(r[o]=e(t))})):"object"===n(t)?(r=Object.assign({},t),Object.keys(r).forEach((function(t){("object"===n(r[t])||Array.isArray(r[t])&&r[t].length>0)&&(r[t]=e(r[t]))}))):r=t,r},y={serviceUrl:"https://cdnapisec.kaltura.com/api_v3",cdnUrl:"https://cdnapisec.kaltura.com",serviceParams:{apiVersion:"3.3.0",format:1},useApiCaptions:!0,loadThumbnailWithKs:!1,replaceHostOnlyManifestUrls:!1},v=function(){function e(){r(this,e)}return s(e,null,[{key:"set",value:function(e){null!=e&&e.overrideServiceUrl&&(e.serviceUrl=e.overrideServiceUrl),e&&Object.assign(y,e)}},{key:"get",value:function(){return p(y)}},{key:"serviceUrl",get:function(){return y.serviceUrl}}]),e}();function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}var R=s((function e(t){r(this,e),a(this,"hasError",!1),"KalturaAPIException"===t.objectType?(this.hasError=!0,this.error=new O(t.code,t.message)):t.error&&"KalturaAPIException"===t.error.objectType?(this.hasError=!0,this.error=new O(t.error.code,t.error.message)):this.data=t})),O=s((function e(t,n){r(this,e),this.code=t,this.message=n}));var b=function(e){d(i,e);var t,n,o=(t=i,n=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(e){return!1}}(),function(){var e,r=E(t);if(n){var o=E(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return g(this,e)});function i(){var e;r(this,i);for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return a(m(e=o.call.apply(o,[this].concat(n))),"requests",[]),e}return s(i,[{key:"add",value:function(e){this.requests.push(e);var t={},r={service:e.service,action:e.action};return Object.assign(t,a({},this.requests.length,Object.assign(r,e.params))),Object.assign(t,this.params),this.params=t,this}},{key:"execute",value:function(e,t){var r=this;return new Promise((function(n,o){try{r.params=JSON.stringify(r.params)}catch(e){i._logger.error("".concat(e.message)),o(new f(f.Severity.CRITICAL,f.Category.PROVIDER,f.Code.FAILED_PARSING_REQUEST,{error:e,params:r.params}))}r.doHttpRequest().then((function(i){var s=new _(i,e,t);s.success?n({headers:r.responseHeaders,response:s}):o(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MULTIREQUEST_API_ERROR,{url:r.url,headers:r.responseHeaders,results:s.results}))}),(function(e){o(e)}))}))}}]),i}(l);a(b,"_logger",u("MultiRequestBuilder"));var _=s((function e(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];r(this,e),a(this,"results",[]);var i=t.result?t.result:t,s=(Array.isArray(i)?i:[i]).map((function(e){return new R(e)})),c=s.filter((function(e){return e.hasError}));c.forEach((function(t){e._logger.error("Service returned an error with error code: ".concat(t.error.code," and message: ").concat(t.error.message,"."))})),this.results=s,n&&c.length||c.length===this.results.length?this.success=!1:(o&&(this.results=this.results.filter((function(e){return!e.hasError}))),this.success=!0)}));a(_,"_logger",u("MultiRequestResult"));var T=function(e){var t=[],r=/\[\]$/,o=function(e){return"[object Array]"===Object.prototype.toString.call(e)},i=function(e,r){r="function"==typeof r?r():null==r?"":r,t[t.length]=encodeURIComponent(e)+"="+encodeURIComponent(r)};return function e(s,a){var c,u,f;if(s)if(o(a))for(c=0,u=a.length;c<u;c++)r.test(s)?i(s,a[c]):e(s+":"+("object"===n(a[c])?c:""),a[c]);else if(a&&"[object Object]"===String(a))for(f in a)e(s+":"+f,a[f]);else i(s,a);else if(o(a))for(c=0,u=a.length;c<u;c++)i(a[c].name,a[c].value);else for(f in a)e(f,a[f]);return t}("",e).join("&").replace(/%20/g,"+")};var S="analytics",C=function(e){d(i,e);var t,n,o=(t=i,n=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(e){return!1}}(),function(){var e,r=E(t);if(n){var o=E(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return g(this,e)});function i(){return r(this,i),o.apply(this,arguments)}return s(i,null,[{key:"trackEvent",value:function(e,t,r){return"POST"===r?i._trackEventByPOST(e,t):i._trackEventByGET(e,t)}},{key:"_trackEventByGET",value:function(e,t){var r=v.get(),n={};Object.assign(n,r.serviceParams,t);var o=new l;return o.service=S,o.action="trackEvent",o.method="GET",o.retryConfig.maxAttempts=1,o.tag="analytics-trackEvent",o.params=n,o.url=e+"?service="+o.service+"&action="+o.action+"&"+T(o.params),o}},{key:"_trackEventByPOST",value:function(e,t){var r=v.get(),n={};Object.assign(n,r.serviceParams,t);var o=new Map;o.set("Content-Type","application/json");var i=new l(o),s={eventType:n.eventType,partnerId:n.partnerId,entryId:n.entryId,sessionId:n.sessionId};return["eventType","partnerId","entryId","sessionId"].forEach((function(e){return delete n[e]})),i.service=S,i.action="trackEvent",i.method="POST",i.retryConfig.maxAttempts=1,i.tag="analytics-trackEvent",i.params=JSON.stringify(n),i.url=e+"?service="+i.service+"&action="+i.action+"&"+T(s),i}}]),i}(function(){function e(){r(this,e)}return s(e,null,[{key:"getMultiRequest",value:function(e,t,r){var n=v.get(),o=n.serviceParams;Object.assign(o,{ks:t,clientTag:"html5:v"+e}),r&&Object.assign(o,{partnerId:r});var i=new Map;i.set("Content-Type","application/json");var s=new b(i);return s.method="POST",s.service="multirequest",s.url=s.getUrl(n.serviceUrl),s.params=o,s}}]),e}()),A="@playkit-js/playkit-js-providers-analytics-service",P="2.45.2";return t}()}));
2
2
  //# sourceMappingURL=playkit-analytics-service.js.map
@@ -1,2 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===n(t)?t:String(t)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function a(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t,r){return(t=o(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}e.r(t),e.d(t,{NAME:function(){return S},OTTBookmarkService:function(){return T},OTTConfiguration:function(){return h},RequestBuilder:function(){return l},VERSION:function(){return C}});var u=function(){return{VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:function(){},debug:function(){},enabledFor:function(){},error:function(){},get:function(){},getLevel:function(){},info:function(){},log:function(){},setHandler:function(){},setLevel:function(){},time:function(){},timeEnd:function(){},trace:function(){},useDefaults:function(){},warn:function(){}}};var c=function(e){return u(e)},f=a((function e(t,n,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r(this,e),this.severity=t,this.category=n,this.code=o,this.data=i,e._logger.error("Category:".concat(n," | Code:").concat(o," |"),i)}));s(f,"Severity",{RECOVERABLE:1,CRITICAL:2}),s(f,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),s(f,"Code",{UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,BAD_SERVER_RESPONSE:1005,MULTIREQUEST_API_ERROR:1006,API_RESPONSE_MISMATCH:1007,ERROR:2e3,BLOCK_ACTION:2001,MEDIA_STATUS_NOT_READY:2002,SCHEDULED_RESTRICTED:2003,DELETED_ENTRY:2004,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),s(f,"_logger",c("Error"));var l=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;r(this,e),s(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),s(this,"_attemptCounter",1),this.headers=t}return a(e,[{key:"getUrl",value:function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")}},{key:"doHttpRequest",value:function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t}},{key:"_createXHR",value:function(){var e=this,t=new XMLHttpRequest;t.onreadystatechange=function(){if(4===t.readyState&&200===t.status)try{var r=JSON.parse(t.responseText);return e.responseHeaders=e._getResponseHeaders(t),e._requestPromise.resolve(r)}catch(r){e._requestPromise.reject(e._createError(t,f.Code.BAD_SERVER_RESPONSE,{text:t.responseText}))}},t.open(this.method,this.url,this.retryConfig.async),this.retryConfig.async&&this.retryConfig.timeout&&(t.timeout=this.retryConfig.timeout);var r=performance.now();t.ontimeout=function(){e._handleError(t,f.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,f.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)}},{key:"_getResponseHeaders",value:function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))}},{key:"_handleError",value:function(e,t,r){var n=this._createError(e,t,r);if(e.onreadystatechange=function(){},e.onerror=function(){},e.ontimeout=function(){},e.onabort=function(){},!(this.retryConfig.maxAttempts&&this._attemptCounter<this.retryConfig.maxAttempts))return this._requestPromise.reject(n);this._attemptCounter++,this._createXHR()}},{key:"_createError",value:function(e,t,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(e),attempt:this._attemptCounter}),new f(f.Severity.CRITICAL,f.Category.NETWORK,t,r)}}]),e}(),p=function e(t){var r;return Array.isArray(t)?(r=t.length>0?t.slice(0):[]).forEach((function(t,o){("object"===n(t)||Array.isArray(t)&&t.length>0)&&(r[o]=e(t))})):"object"===n(t)?(r=Object.assign({},t),Object.keys(r).forEach((function(t){("object"===n(r[t])||Array.isArray(r[t])&&r[t].length>0)&&(r[t]=e(r[t]))}))):r=t,r},y={serviceParams:{apiVersion:"7.8.1"}},h=function(){function e(){r(this,e)}return a(e,null,[{key:"set",value:function(e){e&&Object.assign(y,e)}},{key:"get",value:function(){return p(y)}}]),e}();function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}var E=a((function e(t){r(this,e),s(this,"hasError",!1),"KalturaAPIException"===t.objectType?(this.hasError=!0,this.error=new b(t.code,t.message)):t.error&&"KalturaAPIException"===t.error.objectType?(this.hasError=!0,this.error=new b(t.error.code,t.error.message)):this.data=t})),b=a((function e(t,n){r(this,e),this.code=t,this.message=n}));var O=function(e){d(i,e);var t,n,o=(t=i,n=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(e){return!1}}(),function(){var e,r=R(t);if(n){var o=R(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return g(this,e)});function i(){var e;r(this,i);for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return s(m(e=o.call.apply(o,[this].concat(n))),"requests",[]),e}return a(i,[{key:"add",value:function(e){this.requests.push(e);var t={},r={service:e.service,action:e.action};return Object.assign(t,s({},this.requests.length,Object.assign(r,e.params))),Object.assign(t,this.params),this.params=t,this}},{key:"execute",value:function(e,t){var r=this;return new Promise((function(n,o){try{r.params=JSON.stringify(r.params)}catch(e){i._logger.error("".concat(e.message)),o(new f(f.Severity.CRITICAL,f.Category.PROVIDER,f.Code.FAILED_PARSING_REQUEST,{error:e,params:r.params}))}r.doHttpRequest().then((function(i){var a=new _(i,e,t);a.success?n({headers:r.responseHeaders,response:a}):o(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MULTIREQUEST_API_ERROR,{url:r.url,headers:r.responseHeaders,results:a.results}))}),(function(e){o(e)}))}))}}]),i}(l);s(O,"_logger",c("MultiRequestBuilder"));var _=a((function e(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];r(this,e),s(this,"results",[]);var i=t.result?t.result:t,a=(Array.isArray(i)?i:[i]).map((function(e){return new E(e)})),u=a.filter((function(e){return e.hasError}));u.forEach((function(t){e._logger.error("Service returned an error with error code: ".concat(t.error.code," and message: ").concat(t.error.message,"."))})),this.results=a,n&&u.length||u.length===this.results.length?this.success=!1:(o&&(this.results=this.results.filter((function(e){return!e.hasError}))),this.success=!0)}));s(_,"_logger",c("MultiRequestResult"));var T=function(e){d(i,e);var t,n,o=(t=i,n=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(e){return!1}}(),function(){var e,r=R(t);if(n){var o=R(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return g(this,e)});function i(){return r(this,i),o.apply(this,arguments)}return a(i,null,[{key:"add",value:function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var o=new l(n);o.service="bookmark",o.action="add",o.method="POST",o.url=o.getUrl(e);var i={objectType:"KalturaBookmarkPlayerData",action:r.playerData.action,averageBitrate:r.playerData.averageBitrate,totalBitrate:r.playerData.totalBitrate,currentBitrate:r.playerData.currentBitrate,fileId:r.playerData.fileId},a={objectType:"KalturaBookmark",type:r.type,context:r.context,id:r.id,position:r.position,playerData:i};r.programId&&(a.programId=r.programId);var s=h.get().serviceParams;return Object.assign(s,{bookmark:a,ks:t}),o.params=JSON.stringify(s),o}}]),i}(function(){function e(){r(this,e)}return a(e,null,[{key:"getMultiRequest",value:function(e,t){var r=h.get(),n=r.serviceParams;e&&Object.assign(n,{ks:e}),t&&Object.assign(n,{partnerId:t});var o=new Map;o.set("Content-Type","application/json");var i=new O(o);return i.method="POST",i.service="multirequest",i.url=i.getUrl(r.serviceUrl),i.params=n,i}}]),e}()),S="@playkit-js/playkit-js-providers-bookmark-service",C="2.45.1";return t}()}));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===n(t)?t:String(t)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function a(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t,r){return(t=o(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}e.r(t),e.d(t,{NAME:function(){return S},OTTBookmarkService:function(){return T},OTTConfiguration:function(){return h},RequestBuilder:function(){return l},VERSION:function(){return C}});var u=function(){return{VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:function(){},debug:function(){},enabledFor:function(){},error:function(){},get:function(){},getLevel:function(){},info:function(){},log:function(){},setHandler:function(){},setLevel:function(){},time:function(){},timeEnd:function(){},trace:function(){},useDefaults:function(){},warn:function(){}}};var c=function(e){return u(e)},f=a((function e(t,n,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r(this,e),this.severity=t,this.category=n,this.code=o,this.data=i,e._logger.error("Category:".concat(n," | Code:").concat(o," |"),i)}));s(f,"Severity",{RECOVERABLE:1,CRITICAL:2}),s(f,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),s(f,"Code",{UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,BAD_SERVER_RESPONSE:1005,MULTIREQUEST_API_ERROR:1006,API_RESPONSE_MISMATCH:1007,ERROR:2e3,BLOCK_ACTION:2001,MEDIA_STATUS_NOT_READY:2002,SCHEDULED_RESTRICTED:2003,DELETED_ENTRY:2004,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),s(f,"_logger",c("Error"));var l=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;r(this,e),s(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),s(this,"_attemptCounter",1),this.headers=t}return a(e,[{key:"getUrl",value:function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")}},{key:"doHttpRequest",value:function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t}},{key:"_createXHR",value:function(){var e=this,t=new XMLHttpRequest;t.onreadystatechange=function(){if(4===t.readyState&&200===t.status)try{var r=JSON.parse(t.responseText);return e.responseHeaders=e._getResponseHeaders(t),e._requestPromise.resolve(r)}catch(r){e._requestPromise.reject(e._createError(t,f.Code.BAD_SERVER_RESPONSE,{text:t.responseText}))}},t.open(this.method,this.url,this.retryConfig.async),this.retryConfig.async&&this.retryConfig.timeout&&(t.timeout=this.retryConfig.timeout);var r=performance.now();t.ontimeout=function(){e._handleError(t,f.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,f.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)}},{key:"_getResponseHeaders",value:function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))}},{key:"_handleError",value:function(e,t,r){var n=this._createError(e,t,r);if(e.onreadystatechange=function(){},e.onerror=function(){},e.ontimeout=function(){},e.onabort=function(){},!(this.retryConfig.maxAttempts&&this._attemptCounter<this.retryConfig.maxAttempts))return this._requestPromise.reject(n);this._attemptCounter++,this._createXHR()}},{key:"_createError",value:function(e,t,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(e),attempt:this._attemptCounter}),new f(f.Severity.CRITICAL,f.Category.NETWORK,t,r)}}]),e}(),p=function e(t){var r;return Array.isArray(t)?(r=t.length>0?t.slice(0):[]).forEach((function(t,o){("object"===n(t)||Array.isArray(t)&&t.length>0)&&(r[o]=e(t))})):"object"===n(t)?(r=Object.assign({},t),Object.keys(r).forEach((function(t){("object"===n(r[t])||Array.isArray(r[t])&&r[t].length>0)&&(r[t]=e(r[t]))}))):r=t,r},y={serviceParams:{apiVersion:"7.8.1"}},h=function(){function e(){r(this,e)}return a(e,null,[{key:"set",value:function(e){e&&Object.assign(y,e)}},{key:"get",value:function(){return p(y)}}]),e}();function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}var E=a((function e(t){r(this,e),s(this,"hasError",!1),"KalturaAPIException"===t.objectType?(this.hasError=!0,this.error=new b(t.code,t.message)):t.error&&"KalturaAPIException"===t.error.objectType?(this.hasError=!0,this.error=new b(t.error.code,t.error.message)):this.data=t})),b=a((function e(t,n){r(this,e),this.code=t,this.message=n}));var O=function(e){d(i,e);var t,n,o=(t=i,n=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(e){return!1}}(),function(){var e,r=R(t);if(n){var o=R(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return g(this,e)});function i(){var e;r(this,i);for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return s(m(e=o.call.apply(o,[this].concat(n))),"requests",[]),e}return a(i,[{key:"add",value:function(e){this.requests.push(e);var t={},r={service:e.service,action:e.action};return Object.assign(t,s({},this.requests.length,Object.assign(r,e.params))),Object.assign(t,this.params),this.params=t,this}},{key:"execute",value:function(e,t){var r=this;return new Promise((function(n,o){try{r.params=JSON.stringify(r.params)}catch(e){i._logger.error("".concat(e.message)),o(new f(f.Severity.CRITICAL,f.Category.PROVIDER,f.Code.FAILED_PARSING_REQUEST,{error:e,params:r.params}))}r.doHttpRequest().then((function(i){var a=new _(i,e,t);a.success?n({headers:r.responseHeaders,response:a}):o(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MULTIREQUEST_API_ERROR,{url:r.url,headers:r.responseHeaders,results:a.results}))}),(function(e){o(e)}))}))}}]),i}(l);s(O,"_logger",c("MultiRequestBuilder"));var _=a((function e(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];r(this,e),s(this,"results",[]);var i=t.result?t.result:t,a=(Array.isArray(i)?i:[i]).map((function(e){return new E(e)})),u=a.filter((function(e){return e.hasError}));u.forEach((function(t){e._logger.error("Service returned an error with error code: ".concat(t.error.code," and message: ").concat(t.error.message,"."))})),this.results=a,n&&u.length||u.length===this.results.length?this.success=!1:(o&&(this.results=this.results.filter((function(e){return!e.hasError}))),this.success=!0)}));s(_,"_logger",c("MultiRequestResult"));var T=function(e){d(i,e);var t,n,o=(t=i,n=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(e){return!1}}(),function(){var e,r=R(t);if(n){var o=R(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return g(this,e)});function i(){return r(this,i),o.apply(this,arguments)}return a(i,null,[{key:"add",value:function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var o=new l(n);o.service="bookmark",o.action="add",o.method="POST",o.url=o.getUrl(e);var i={objectType:"KalturaBookmarkPlayerData",action:r.playerData.action,averageBitrate:r.playerData.averageBitrate,totalBitrate:r.playerData.totalBitrate,currentBitrate:r.playerData.currentBitrate,fileId:r.playerData.fileId},a={objectType:"KalturaBookmark",type:r.type,context:r.context,id:r.id,position:r.position,playerData:i};r.programId&&(a.programId=r.programId);var s=h.get().serviceParams;return Object.assign(s,{bookmark:a,ks:t}),o.params=JSON.stringify(s),o}}]),i}(function(){function e(){r(this,e)}return a(e,null,[{key:"getMultiRequest",value:function(e,t){var r=h.get(),n=r.serviceParams;e&&Object.assign(n,{ks:e}),t&&Object.assign(n,{partnerId:t});var o=new Map;o.set("Content-Type","application/json");var i=new O(o);return i.method="POST",i.service="multirequest",i.url=i.getUrl(r.serviceUrl),i.params=n,i}}]),e}()),S="@playkit-js/playkit-js-providers-bookmark-service",C="2.45.2";return t}()}));
2
2
  //# sourceMappingURL=playkit-bookmark-service.js.map
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see playkit-ott-provider.js.LICENSE.txt */
2
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(function(){return function(){var e={61:function(e,t,r){var n=r(698).default;function o(){"use strict";e.exports=o=function(){return r},e.exports.__esModule=!0,e.exports.default=e.exports;var t,r={},i=Object.prototype,s=i.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function h(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(t){h=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof E?t:E,i=Object.create(o.prototype),s=new x(n||[]);return a(i,"_invoke",{value:A(e,r,s)}),i}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}r.wrap=p;var y="suspendedStart",v="suspendedYield",g="executing",m="completed",_={};function E(){}function R(){}function T(){}var b={};h(b,c,(function(){return this}));var O=Object.getPrototypeOf,w=O&&O(O(D([])));w&&w!==i&&s.call(w,c)&&(b=w);var k=T.prototype=E.prototype=Object.create(b);function I(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function r(o,i,a,u){var c=d(e[o],e,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==n(f)&&s.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,a,u)}),(function(e){r("throw",e,a,u)})):t.resolve(f).then((function(e){l.value=e,a(l)}),(function(e){return r("throw",e,a,u)}))}u(c.arg)}var o;a(this,"_invoke",{value:function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}})}function A(e,r,n){var o=y;return function(i,s){if(o===g)throw new Error("Generator is already running");if(o===m){if("throw"===i)throw s;return{value:t,done:!0}}for(n.method=i,n.arg=s;;){var a=n.delegate;if(a){var u=C(a,n);if(u){if(u===_)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=g;var c=d(e,r,n);if("normal"===c.type){if(o=n.done?m:v,c.arg===_)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=m,n.method="throw",n.arg=c.arg)}}}function C(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,C(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),_;var i=d(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,_;var s=i.arg;return s?s.done?(r[e.resultName]=s.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,_):s:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,_)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function D(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(s.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(n(e)+" is not iterable")}return R.prototype=T,a(k,"constructor",{value:T,configurable:!0}),a(T,"constructor",{value:R,configurable:!0}),R.displayName=h(T,f,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===R||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,T):(e.__proto__=T,h(e,f,"GeneratorFunction")),e.prototype=Object.create(k),e},r.awrap=function(e){return{__await:e}},I(S.prototype),h(S.prototype,l,(function(){return this})),r.AsyncIterator=S,r.async=function(e,t,n,o,i){void 0===i&&(i=Promise);var s=new S(p(e,t,n,o),i);return r.isGeneratorFunction(t)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},I(k),h(k,f,"Generator"),h(k,c,(function(){return this})),h(k,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},r.values=D,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var r in this)"t"===r.charAt(0)&&s.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=s.call(i,"catchLoc"),c=s.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&s.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,_):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),_},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),_}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:D(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),_}},r}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},698:function(e){function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},687:function(e,t,r){var n=r(61)();e.exports=n;try{regeneratorRuntime=n}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function o(e){var r=function(e,r){if("object"!==t(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,"string");if("object"!==t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===t(r)?r:String(r)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function s(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},a(e,t)}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t)}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e,r){if(r&&("object"===t(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return c(e)}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function h(e,t,r){return(t=o(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.r(n),r.d(n,{ContextType:function(){return de},MediaType:function(){return ye},NAME:function(){return he},Provider:function(){return fe},VERSION:function(){return pe}});var p={get:function(){return{VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:function(){},debug:function(){},enabledFor:function(){},error:function(){},get:function(){},getLevel:function(){},info:function(){},log:function(){},setHandler:function(){},setLevel:function(){},time:function(){},timeEnd:function(){},trace:function(){},useDefaults:function(){},warn:function(){}}}},d={};function y(e){return p.get(e)}var v=y,g=s((function t(r,n,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};e(this,t),this.severity=r,this.category=n,this.code=o,this.data=i,t._logger.error("Category:".concat(n," | Code:").concat(o," |"),i)}));h(g,"Severity",{RECOVERABLE:1,CRITICAL:2}),h(g,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),h(g,"Code",{UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,BAD_SERVER_RESPONSE:1005,MULTIREQUEST_API_ERROR:1006,API_RESPONSE_MISMATCH:1007,ERROR:2e3,BLOCK_ACTION:2001,MEDIA_STATUS_NOT_READY:2002,SCHEDULED_RESTRICTED:2003,DELETED_ENTRY:2004,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),h(g,"_logger",v("Error"));var m=function(){function t(r,n){e(this,t),h(this,"_networkRetryConfig",{async:!0,timeout:0,maxAttempts:4}),function(e){e&&"function"==typeof e.getLogger&&(p.get=e.getLogger),e&&e.LogLevel&&(d=e.LogLevel)}(r.logger),this._partnerId=r.partnerId,this._widgetId=r.widgetId,this._uiConfId=r.uiConfId,this._isAnonymous=!r.ks,this._ks=r.ks||"",this._playerVersion=n,this._referrer=r.referrer}return s(t,[{key:"partnerId",get:function(){return this._partnerId}},{key:"widgetId",get:function(){return this._widgetId||this.defaultWidgetId}},{key:"defaultWidgetId",get:function(){return"_"+this._partnerId}},{key:"uiConfId",get:function(){return this._uiConfId}},{key:"ks",get:function(){return this._ks},set:function(e){this._ks=e}},{key:"playerVersion",get:function(){return this._playerVersion}},{key:"isAnonymous",get:function(){return this._isAnonymous}},{key:"getMediaConfig",value:function(e){return Promise.reject(new g(g.Severity.CRITICAL,g.Category.PROVIDER,g.Code.METHOD_NOT_IMPLEMENTED,{message:"getMediaConfig method must be implement by the derived class"}))}},{key:"getPlaylistConfig",value:function(e){return Promise.reject(new g(g.Severity.CRITICAL,g.Category.PROVIDER,g.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading playlist by id"}))}},{key:"getEntryListConfig",value:function(e){return Promise.reject(new g(g.Severity.CRITICAL,g.Category.PROVIDER,g.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading entry list"}))}},{key:"_verifyHasSources",value:function(e){if(0===e.hls.concat(e.dash,e.progressive,e.image,e.document).length)throw new g(g.Severity.CRITICAL,g.Category.SERVICE,g.Code.MISSING_PLAY_SOURCE,{action:"",messages:"No play source for entry id: ".concat(e.id)})}},{key:"LogLevel",get:function(){return d}},{key:"getLogLevel",value:function(e){return function(e){return y(e).getLevel()}(e)}},{key:"setLogLevel",value:function(e,t){!function(e,t){y(t).setLevel(e)}(e,t)}}]),t}(),_=function e(r){var n;return Array.isArray(r)?(n=r.length>0?r.slice(0):[]).forEach((function(r,o){("object"===t(r)||Array.isArray(r)&&r.length>0)&&(n[o]=e(r))})):"object"===t(r)?(n=Object.assign({},r),Object.keys(n).forEach((function(r){("object"===t(n[r])||Array.isArray(n[r])&&n[r].length>0)&&(n[r]=e(n[r]))}))):n=r,n},E={serviceParams:{apiVersion:"7.8.1"}},R=function(){function t(){e(this,t)}return s(t,null,[{key:"set",value:function(e){e&&Object.assign(E,e)}},{key:"get",value:function(){return _(E)}}]),t}();function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function b(e,t,r,n,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void r(e)}a.done?t(u):Promise.resolve(u).then(n,o)}function O(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function s(e){b(i,n,o,s,a,"next",e)}function a(e){b(i,n,o,s,a,"throw",e)}s(void 0)}))}}var w=r(687),k=r.n(w),I=s((function t(r){e(this,t),h(this,"hasError",!1),"KalturaAPIException"===r.objectType?(this.hasError=!0,this.error=new S(r.code,r.message)):r.error&&"KalturaAPIException"===r.error.objectType?(this.hasError=!0,this.error=new S(r.error.code,r.error.message)):this.data=r})),S=s((function t(r,n){e(this,t),this.code=r,this.message=n}));function A(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return C(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?C(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw i}}}}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function P(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function L(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?P(Object(r),!0).forEach((function(t){h(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):P(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var x=function(){function t(){var r;e(this,t),h(this,"_logger",v("RequestSequenceBuilder")),h(this,"loaders",new Map),h(this,"_globalParams",{apiVersion:null===(r=R.get().serviceParams)||void 0===r?void 0:r.apiVersion})}var r,n,o;return s(t,[{key:"add",value:function(e){var t;this.loaders.set(null===(t=e.requests)||void 0===t||null===(t=t[0])||void 0===t?void 0:t.service,e)}},{key:"_executeRequest",value:(o=O(k().mark((function e(t){var r,n,o,i,s;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.params=JSON.stringify(L(L({},this._globalParams),t.params)),e.prev=1,e.next=4,t.doHttpRequest();case 4:return r=e.sent,(n=new I(r.result||r)).hasError&&(o=n.error,i=o.code,s=o.message,this._logger.error("Service returned an error with error code: ".concat(i," and message: ").concat(s,"."))),e.abrupt("return",n);case 10:throw e.prev=10,e.t0=e.catch(1),new g(g.Severity.CRITICAL,g.Category.NETWORK,g.Code.API_RESPONSE_MISMATCH,{error:e.t0,request:t});case 13:case"end":return e.stop()}}),e,this,[[1,10]])}))),function(e){return o.apply(this,arguments)})},{key:"_executeSequence",value:(n=O(k().mark((function e(t){var r,n,o,i,s,a,u,c,l,f;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=[],n=A(t),e.prev=2,n.s();case 4:if((o=n.n()).done){e.next=18;break}return i=o.value,e.prev=6,e.next=9,this._executeRequest(i);case 9:s=e.sent,r.push(s),e.next=16;break;case 13:e.prev=13,e.t0=e.catch(6),this._logger.error("Request execution failed: ".concat(e.t0.message));case 16:e.next=4;break;case 18:e.next=23;break;case 20:e.prev=20,e.t1=e.catch(2),n.e(e.t1);case 23:return e.prev=23,n.f(),e.finish(23);case 26:if(!(a=new D(r)).success){e.next=31;break}return e.abrupt("return",a);case 31:if(!(u=r.find((function(e){return e.hasError})))){e.next=35;break}throw c=u.error,l=c.message,f=c.code,new g(g.Severity.CRITICAL,g.Category.NETWORK,g.Code.API_RESPONSE_MISMATCH,{error:u.error,errorMessage:"Request returned an error: ".concat(l," (code: ").concat(f,")")});case 35:return e.abrupt("return",a);case 36:case"end":return e.stop()}}),e,this,[[2,20,23,26],[6,13]])}))),function(e){return n.apply(this,arguments)})},{key:"execute",value:(r=O(k().mark((function e(){var t,r,n,o,i;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.loaders.get("ottuser"),r=this.loaders.get("asset"),n="",e.prev=3,!t){e.next=10;break}return e.next=7,this._executeRequest(t.requests[0]);case 7:o=e.sent,t.response=[{data:o.data}],n=o.data.ks||"";case 10:if(!r){e.next=16;break}return r.requests.forEach((function(e){"{1:result:ks}"===e.params.ks&&(e.params.ks=n)})),e.next=14,this._executeSequence(r.requests);case 14:i=e.sent,r.response=i.results;case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(3),this._logger.error("loaders execution failed: ".concat(e.t0.message));case 21:return e.abrupt("return",this.loaders);case 22:case"end":return e.stop()}}),e,this,[[3,18]])}))),function(){return r.apply(this,arguments)})}]),t}(),D=s((function t(r){var n,o=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e(this,t),this.results=function(e){if(Array.isArray(e))return T(e)}(n=r)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||function(e,t){if(e){if("string"==typeof e)return T(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?T(e,t):void 0}}(n)||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.")}();var i,s=this.results.filter((function(e){return e.hasError})),a=A(s);try{for(a.s();!(i=a.n()).done;){var u=i.value.error,c=u.code,l=u.message;t._logger.error("Service returned an error with error code: ".concat(c," and message: ").concat(l,"."))}}catch(e){a.e(e)}finally{a.f()}var f=s.length===this.results.length,h=o&&s.length>0;f||h?this.success=!1:(o||(this.results=this.results.filter((function(e){return!e.hasError}))),this.success=!0)}));h(D,"_logger",v("SingleRequestsResult"));var M=function(){function t(r){e(this,t),h(this,"_loadersResponseMap",new Map),h(this,"_loaders",new Map),this._networkRetryConfig=r,this._singleRequests=new x}return s(t,[{key:"add",value:function(e,t,r){var n=this,o=new e(t);if(o.isValid())if(this._loaders.set(e.id,o),o.disableMultirequest)this._singleRequests.add(o);else{var i=this._multiRequest.requests.length,s=o.requests;this._multiRequest.retryConfig=this._networkRetryConfig,s.forEach((function(e){e.params=e.params||{},e.params.ks=e.params.ks||r,n._multiRequest.add(e)}));var a=Array.from(new Array(s.length),(function(e,t){return t+i}));this._loadersResponseMap.set(e.id,a)}}},{key:"fetchData",value:function(e,t){var r=this;return new Promise((function(n,o){r._singleRequests.loaders.size>0?r._singleRequests.execute().then((function(){return n(r._loaders)})).catch((function(e){return o(e)})):r._multiRequest.execute(e,t).then((function(e){r._multiResponse=e.response,r.prepareData(e.response).success?n(r._loaders):o(new g(g.Severity.CRITICAL,g.Category.NETWORK,g.Code.API_RESPONSE_MISMATCH,{headers:e.headers}))}),(function(e){o(e)}))}))}},{key:"prepareData",value:function(e){var t=this;return this._loaders.forEach((function(r,n){var o=t._loadersResponseMap.get(n);try{o&&o.length>0&&(r.response=e.results.slice(o[0],o[o.length-1]+1))}catch(e){return{success:!1,error:e}}})),{success:!0,data:this._loaders}}}]),t}(),j=function(){function t(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;e(this,t),h(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),h(this,"_attemptCounter",1),this.headers=r}return s(t,[{key:"getUrl",value:function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")}},{key:"doHttpRequest",value:function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new g(g.Severity.CRITICAL,g.Category.NETWORK,g.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t}},{key:"_createXHR",value:function(){var e=this,t=new XMLHttpRequest;t.onreadystatechange=function(){if(4===t.readyState&&200===t.status)try{var r=JSON.parse(t.responseText);return e.responseHeaders=e._getResponseHeaders(t),e._requestPromise.resolve(r)}catch(r){e._requestPromise.reject(e._createError(t,g.Code.BAD_SERVER_RESPONSE,{text:t.responseText}))}},t.open(this.method,this.url,this.retryConfig.async),this.retryConfig.async&&this.retryConfig.timeout&&(t.timeout=this.retryConfig.timeout);var r=performance.now();t.ontimeout=function(){e._handleError(t,g.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,g.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)}},{key:"_getResponseHeaders",value:function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))}},{key:"_handleError",value:function(e,t,r){var n=this._createError(e,t,r);if(e.onreadystatechange=function(){},e.onerror=function(){},e.ontimeout=function(){},e.onabort=function(){},!(this.retryConfig.maxAttempts&&this._attemptCounter<this.retryConfig.maxAttempts))return this._requestPromise.reject(n);this._attemptCounter++,this._createXHR()}},{key:"_createError",value:function(e,t,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(e),attempt:this._attemptCounter}),new g(g.Severity.CRITICAL,g.Category.NETWORK,t,r)}}]),t}();var N=function(t){u(i,t);var r,n,o=(r=i,n=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(e){return!1}}(),function(){var e,t=f(r);if(n){var o=f(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return l(this,e)});function i(){var t;e(this,i);for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return h(c(t=o.call.apply(o,[this].concat(n))),"requests",[]),t}return s(i,[{key:"add",value:function(e){this.requests.push(e);var t={},r={service:e.service,action:e.action};return Object.assign(t,h({},this.requests.length,Object.assign(r,e.params))),Object.assign(t,this.params),this.params=t,this}},{key:"execute",value:function(e,t){var r=this;return new Promise((function(n,o){try{r.params=JSON.stringify(r.params)}catch(e){i._logger.error("".concat(e.message)),o(new g(g.Severity.CRITICAL,g.Category.PROVIDER,g.Code.FAILED_PARSING_REQUEST,{error:e,params:r.params}))}r.doHttpRequest().then((function(i){var s=new q(i,e,t);s.success?n({headers:r.responseHeaders,response:s}):o(new g(g.Severity.CRITICAL,g.Category.NETWORK,g.Code.MULTIREQUEST_API_ERROR,{url:r.url,headers:r.responseHeaders,results:s.results}))}),(function(e){o(e)}))}))}}]),i}(j);h(N,"_logger",v("MultiRequestBuilder"));var q=s((function t(r){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];e(this,t),h(this,"results",[]);var i=r.result?r.result:r,s=(Array.isArray(i)?i:[i]).map((function(e){return new I(e)})),a=s.filter((function(e){return e.hasError}));a.forEach((function(e){t._logger.error("Service returned an error with error code: ".concat(e.error.code," and message: ").concat(e.error.message,"."))})),this.results=s,n&&a.length||a.length===this.results.length?this.success=!1:(o&&(this.results=this.results.filter((function(e){return!e.hasError}))),this.success=!0)}));h(q,"_logger",v("MultiRequestResult"));var B=function(){function t(){e(this,t)}return s(t,null,[{key:"getMultiRequest",value:function(e,t){var r=R.get(),n=r.serviceParams;e&&Object.assign(n,{ks:e}),t&&Object.assign(n,{partnerId:t});var o=new Map;o.set("Content-Type","application/json");var i=new N(o);return i.method="POST",i.service="multirequest",i.url=i.getUrl(r.serviceUrl),i.params=n,i}}]),t}();var U=function(t){u(i,t);var r,n,o=(r=i,n=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(e){return!1}}(),function(){var e,t=f(r);if(n){var o=f(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return l(this,e)});function i(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",s=arguments.length>2?arguments[2]:void 0;return e(this,i),(r=o.call(this,s))._multiRequest=B.getMultiRequest(n,t),r}return s(i)}(M);var V=function(t){u(i,t);var r,n,o=(r=i,n=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(e){return!1}}(),function(){var e,t=f(r);if(n){var o=f(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return l(this,e)});function i(){return e(this,i),o.apply(this,arguments)}return s(i,null,[{key:"anonymousLogin",value:function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var o=new j(n);o.service="ottuser",o.action="anonymousLogin",o.method="POST",o.url=o.getUrl(e);var i={partnerId:t};return r&&Object.assign(i,{udid:r}),o.params=i,o}}]),i}(B),H=function(){function t(r){e(this,t),h(this,"_response",{}),h(this,"_disableMultirequest",R.get().ottDisableMultirequest),this.requests=this.buildRequests(r),this._partnerId=r.partnerId}return s(t,[{key:"requests",get:function(){return this._requests},set:function(e){this._requests=e}},{key:"response",get:function(){return this._response.ks},set:function(e){this._response.ks=e[0].data.ks}},{key:"disableMultirequest",get:function(){return this._disableMultirequest}},{key:"buildRequests",value:function(e){var t=R.get(),r=[];return r.push(V.anonymousLogin(t.serviceUrl,e.partnerId,e.udid)),r}},{key:"isValid",value:function(){return!!this._partnerId}}],[{key:"id",get:function(){return"session"}}]),t}();var F="asset",K=function(t){u(i,t);var r,n,o=(r=i,n=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(e){return!1}}(),function(){var e,t=f(r);if(n){var o=f(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return l(this,e)});function i(){return e(this,i),o.apply(this,arguments)}return s(i,null,[{key:"getPlaybackContext",value:function(e,t,r,n,o){var i=new Map;i.set("Content-Type","application/json");var s=new j(i);s.service=F,s.action="getPlaybackContext",s.method="POST",s.url=s.getUrl(e);var a={objectType:"KalturaPlaybackContextOptions"};return Object.assign(a,o),s.params={assetId:r,assetType:n,contextDataParams:a,ks:t},s}},{key:"get",value:function(e,t,r,n){var o=new Map;o.set("Content-Type","application/json");var i=new j(o);return i.service=F,i.action="get",i.method="POST",i.url=i.getUrl(e),i.params={id:r,assetReferenceType:n,ks:t},i}}]),i}(B),Y=s((function t(r){e(this,t),this.message=r.message,this.code=r.code})),G=s((function t(r){e(this,t),this.type=r.type}));h(G,"Type",{BLOCK:"BLOCK",START_DATE_OFFSET:"START_DATE_OFFSET",END_DATE_OFFSET:"END_DATE_OFFSET",USER_BLOCK:"USER_BLOCK",ALLOW_PLAYBACK:"ALLOW_PLAYBACK",BLOCK_PLAYBACK:"BLOCK_PLAYBACK",APPLY_DISCOUNT_MODULE:"APPLY_DISCOUNT_MODULE"});var W=s((function t(r){e(this,t),this.scheme=r.scheme,this.licenseURL=r.licenseURL,this.certificate=r.certificate}));h(W,"Scheme",{"drm.PLAYREADY_CENC":"com.microsoft.playready","drm.WIDEVINE_CENC":"com.widevine.alpha","fairplay.FAIRPLAY":"com.apple.fairplay",WIDEVINE_CENC:"com.widevine.alpha",PLAYREADY_CENC:"com.microsoft.playready",FAIRPLAY:"com.apple.fairplay"});var J=function(){function t(r){var n=this;e(this,t),h(this,"drm",[]),this.format=r.format,this.adsPolicy=r.adsPolicy,this.adsParam=r.adsParam,this.duration=r.duration,this.url=r.url,this.type=r.type,this.fileId=r.id,this.protocols=r.protocols,r.drm&&r.drm.map((function(e){return n.drm.push(new W(e))}))}return s(t,[{key:"hasDrmData",value:function(){return this.drm&&this.drm.length>0}},{key:"getProtocol",value:function(e){var t="";if(this.protocols&&this.protocols.length>0)this.protocols.split(",").forEach((function(r){r===e&&(t=r)}));else if("http"===e)return e;return t}}]),t}(),X=s((function t(r){e(this,t),this.streamertype=r.streamertype,this.url=r.url}));h(X,"StreamerType",{HLS:"hls",DASH:"dash",PROGRESSIVE:"progressive"});var Q=function(t){u(i,t);var r,n,o=(r=i,n=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(e){return!1}}(),function(){var e,t=f(r);if(n){var o=f(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return l(this,e)});function i(t){var r;if(e(this,i),h(c(r=o.call(this,t)),"sources",[]),h(c(r),"actions",[]),h(c(r),"messages",[]),h(c(r),"plugins",[]),!r.hasError){var n=t.messages;n&&n.map((function(e){return r.messages.push(new Y(e))}));var s=t.actions;s&&s.map((function(e){return r.actions.push(new G(e))}));var a=t.sources;a&&a.map((function(e){return r.sources.push(new J(e))}));var u=t.plugins;u&&u.map((function(e){return r.plugins.push(new X(e))}))}return r}return s(i,[{key:"hasBlockAction",value:function(){return void 0!==this.getBlockAction()}},{key:"getBlockAction",value:function(){return this.actions.find((function(e){return e.type===G.Type.BLOCK}))}},{key:"getErrorMessages",value:function(){return this.messages}}]),i}(I);h(Q,"Type",{DOWNLOAD:"DOWNLOAD",TRAILER:"TRAILER",CATCHUP:"CATCHUP",START_OVER:"START_OVER",PLAYBACK:"PLAYBACK"});var $=function(t){u(i,t);var r,n,o=(r=i,n=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(e){return!1}}(),function(){var e,t=f(r);if(n){var o=f(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return l(this,e)});function i(t){var r;return e(this,i),h(c(r=o.call(this,t)),"name",""),h(c(r),"description",""),h(c(r),"tags",[]),h(c(r),"metas",[]),h(c(r),"pictures",[]),r.hasError||(r.id=t.id,r.name=t.name,r.description=t.description,r.createDate=t.createDate,r.endDate=t.endDate,r.plays=t.plays,r.views=t.views,r.metas=r._formatTagsMetas(t.metas),r.tags=r._formatTagsMetas(t.tags),r.pictures=t.images),r}return s(i,[{key:"_formatTagsMetas",value:function(e){var t=[];return Object.keys(e).forEach((function(r){if(e[r].objects){var n="";e[r].objects.forEach((function(e){n+=e.value+"|"})),t.push({key:r,value:n})}else t.push({key:r,value:e[r].value})})),t}}]),i}(I);h($,"Type",{MEDIA:"media",RECORDING:"recording",EPG:"epg"}),h($,"AssetReferenceType",{MEDIA:"media",EPG_INTERNAL:"epg_internal",EPG_EXTERNAL:"epg_external",NPVR:"nPVR"});var z=function(){function t(r){e(this,t),h(this,"_response",{}),h(this,"_disableMultirequest",R.get().ottDisableMultirequest),this.requests=this.buildRequests(r),this._entryId=r.entryId}return s(t,[{key:"requests",get:function(){return this._requests},set:function(e){this._requests=e}},{key:"response",get:function(){return this._response},set:function(e){this._response.mediaDataResult=new $(e[0].data),this._response.playBackContextResult=new Q(e[1].data)}},{key:"disableMultirequest",get:function(){return this._disableMultirequest}},{key:"buildRequests",value:function(e){var t=R.get(),r=[];return r.push(K.get(t.serviceUrl,e.ks,e.entryId,e.assetReferenceType)),r.push(K.getPlaybackContext(t.serviceUrl,e.ks,e.entryId,e.type,e.playbackContext)),r}},{key:"isValid",value:function(){return!!this._entryId}}],[{key:"id",get:function(){return"asset"}}]),t}(),Z=function(){function t(r){e(this,t),h(this,"_response",{playlistItems:{entries:[]}}),this.requests=this.buildRequests(r),this._entries=r.entries}return s(t,[{key:"requests",get:function(){return this._requests},set:function(e){this._requests=e}},{key:"response",get:function(){return this._response},set:function(e){var t=this;e.forEach((function(e){t._response.playlistItems.entries.push({mediaDataResult:new $(e.data)})}))}},{key:"buildRequests",value:function(e){var t=R.get(),r=[];return e.entries.forEach((function(n){var o=n.assetReferenceType||$.AssetReferenceType.MEDIA;r.push(K.get(t.serviceUrl,e.ks,n.entryId||n,o))})),r}},{key:"isValid",value:function(){return!(!this._entries||!this._entries.length)}}],[{key:"id",get:function(){return"asset_list"}}]),t}(),ee={DASH:{name:"dash",mimeType:"application/dash+xml",pathExt:"mpd"},HLS:{name:"hls",mimeType:"application/x-mpegURL",pathExt:"m3u8"},WVM:{name:"wvm",mimeType:"video/wvm",pathExt:"wvm"},MP4:{name:"mp4",mimeType:"video/mp4",pathExt:"mp4"},MP3:{name:"mp3",mimeType:"audio/mpeg",pathExt:"mp3"}},te=new Map([["mpegdash",ee.DASH],["applehttp",ee.HLS],["url",ee.MP4]]);function re(e){var t=te.get(e);return!!t&&t.name===ee.MP4.name}var ne=function(){function t(){e(this,t),this.progressive=[],this.dash=[],this.hls=[],this.image=[],this.document=[]}return s(t,[{key:"map",value:function(e,t){if(t)switch(t.name){case ee.MP4.name:this.progressive.push(e);break;case ee.DASH.name:this.dash.push(e);break;case ee.HLS.name:this.hls.push(e)}}},{key:"toJSON",value:function(){var e={progressive:[],dash:[],hls:[],image:[],document:[]};return this.progressive.forEach((function(t){return e.progressive.push(t.toJSON())})),this.hls.forEach((function(t){return e.hls.push(t.toJSON())})),this.dash.forEach((function(t){return e.dash.push(t.toJSON())})),e.image=this.image,e.document=this.document,e}}]),t}(),oe=function(){function t(){e(this,t),this.metadata=new Map,this.sources=new ne,this.type=t.Type.UNKNOWN}return s(t,[{key:"toJSON",value:function(){return{id:this.id,name:this.name,sources:this.sources.toJSON(),duration:this.duration,dvrStatus:this.dvrStatus,status:this.status,metadata:this.metadata,type:this.type,poster:this.poster,assetReferenceType:this.assetReferenceType,downloadUrl:this.downloadUrl,rawThumbnailUrl:this.rawThumbnailUrl,rootEntryId:this.rootEntryId,capabilities:this.capabilities}}}]),t}();h(oe,"Type",{VOD:"Vod",LIVE:"Live",IMAGE:"Image",AUDIO:"Audio",UNKNOWN:"Unknown",DOCUMENT:"Document"}),h(oe,"DvrStatus",{ON:1,OFF:0});var ie=function(){function t(r,n,o){e(this,t),this.licenseUrl=r,this.scheme=n,o&&(this.certificate=o)}return s(t,[{key:"toJSON",value:function(){var e={licenseUrl:this.licenseUrl,scheme:this.scheme};return this.certificate&&(e.certificate=this.certificate),e}}]),t}(),se=function(){function t(){e(this,t)}return s(t,[{key:"toJSON",value:function(){var e={id:this.id,url:this.url,mimetype:this.mimetype};return this.bandwidth&&(e.bandwidth=this.bandwidth),this.width&&(e.width=this.width),this.height&&(e.height=this.height),this.label&&(e.label=this.label),this.drmData&&this.drmData.length>0&&(e.drmData=[],this.drmData.forEach((function(t){Array.isArray(e.drmData)&&e.drmData.push(t.toJSON())}))),e}}]),t}(),ae=s((function t(){e(this,t),this.items=[]})),ue=s((function t(r){e(this,t),this.url=r.url,this.clickThroughUrl=r.clickThroughUrl})),ce=h(h(h({},$.Type.MEDIA,h(h({},Q.Type.TRAILER,(function(){return{type:oe.Type.VOD}})),Q.Type.PLAYBACK,(function(e){return"KalturaLiveAsset"===e.objectType?{type:oe.Type.LIVE,dvrStatus:e.enableTrickPlay?oe.DvrStatus.ON:oe.DvrStatus.OFF}:parseInt(e.externalIds)>0?{type:oe.Type.LIVE,dvrStatus:oe.DvrStatus.OFF}:{type:oe.Type.VOD}}))),$.Type.EPG,h(h({},Q.Type.CATCHUP,(function(){return{type:oe.Type.VOD}})),Q.Type.START_OVER,(function(){return{type:oe.Type.LIVE,dvrStatus:oe.DvrStatus.ON}}))),$.Type.RECORDING,h({},Q.Type.PLAYBACK,(function(){return{type:oe.Type.VOD}}))),le=function(){function t(){e(this,t)}return s(t,null,[{key:"getMediaEntry",value:function(e,r){var n=new oe;t._fillBaseData(n,e,r);var o=e.playBackContextResult,i=e.mediaDataResult,s=o.sources,a=t._filterSourcesByFormats(s,r.formats);n.sources=t._getParsedSources(a);var u=t._getMediaType(i.data,r.mediaType,r.contextType);return n.type=u.type,n.dvrStatus=u.dvrStatus,n.duration=Math.max.apply(Math,s.map((function(e){return e.duration}))),n}},{key:"getEntryList",value:function(e,r){var n=new ae;return e.playlistItems.entries.forEach((function(e){var o=new oe,i=r.find((function(t){return t.entryId===e.mediaDataResult.id}));t._fillBaseData(o,e,i),n.items.push(o)})),n}},{key:"getBumper",value:function(e){var t=e.playBackContextResult.plugins.find((function(e){return e.streamertype===X.StreamerType.PROGRESSIVE}));if(t)return new ue(t)}},{key:"_fillBaseData",value:function(e,r,n){var o=r.mediaDataResult,i=t.reconstructMetadata(o);return i.description=o.description,i.name=o.name,o.createDate&&(i.createdAt=o.createDate),o.endDate&&(i.endDate=o.endDate),o.data.entryId&&(i.entryId=o.data.entryId),o.data.epgId&&(i.epgId=o.data.epgId),o.data.recordingId&&(i.recordingId=o.data.recordingId),n&&n.mediaType&&(i.mediaType=n.mediaType),n&&n.contextType&&(i.contextType=n.contextType),e.metadata=i,e.poster=t._getPoster(o.pictures),e.id=o.id,e}},{key:"reconstructMetadata",value:function(e){return{metas:t.addToMetaObject(e.metas),tags:t.addToMetaObject(e.tags)}}},{key:"addToMetaObject",value:function(e){var t={};return e&&e.forEach((function(e){t[e.key]=e.value})),t}},{key:"_getPoster",value:function(e){if(e&&e.length>0){var t=e[0].url;return/.*\/thumbnail\/.*(?:width|height)\/\d+\/(?:height|width)\/\d+/.test(t)?t:e.map((function(e){return{url:e.url,width:e.width,height:e.height}}))}return""}},{key:"_getMediaType",value:function(e,t,r){var n={type:oe.Type.UNKNOWN};return ce[t]&&ce[t][r]&&(n=ce[t][r](e)),n}},{key:"_filterSourcesByFormats",value:function(e,t){return t.length>0&&(e=e.filter((function(e){return t.includes(e.type)}))),e}},{key:"_getParsedSources",value:function(e){var r=new ne,n=function(e){var n=t._parseAdaptiveSource(e);if(n){var o=te.get(e.format);r.map(n,o)}};return e&&e.length>0&&(e.filter((function(e){return!re(e.format)})).forEach(n),e.filter((function(e){return re(e.format)})).forEach(n)),r}},{key:"_parseAdaptiveSource",value:function(e){var r=new se;if(e){var n=e.url,o=te.get(e.format);if(o&&(r.mimetype=o.mimeType),!n)return t._logger.error("failed to create play url from source, discarding source: (".concat(e.fileId,"), ").concat(e.format,".")),null;if(r.url=n,r.id=e.fileId+","+e.format,e.hasDrmData()){var i=[];e.drm.forEach((function(e){i.push(new ie(e.licenseURL,W.Scheme[e.scheme],e.certificate))})),r.drmData=i}}return r}},{key:"hasBlockAction",value:function(e){return e.playBackContextResult.hasBlockAction()}},{key:"getBlockAction",value:function(e){return e.playBackContextResult.getBlockAction()}},{key:"getErrorMessages",value:function(e){return e.playBackContextResult.getErrorMessages()}}]),t}();h(le,"_logger",v("OTTProviderParser"));var fe=function(t){u(i,t);var r,n,o=(r=i,n=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(e){return!1}}(),function(){var e,t=f(r);if(n){var o=f(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return l(this,e)});function i(t,r){var n;return e(this,i),(n=o.call(this,t,r))._logger=v("OTTProvider"),R.set(t.env),n._networkRetryConfig=Object.assign(n._networkRetryConfig,t.networkRetryParameters),n}return s(i,[{key:"env",get:function(){return R.get()}},{key:"getMediaConfig",value:function(e){var t=this;return e.ks&&(this.ks=e.ks,this._isAnonymous=!1),this._dataLoader=new U(this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var o=e.entryId;if(o){var i=t.ks;i||(i="{1:result:ks}",t._dataLoader.add(H,{partnerId:t.partnerId}));var s=e.contextType||Q.Type.PLAYBACK,a=e.mediaType||$.Type.MEDIA,u=e.assetReferenceType||$.AssetReferenceType.MEDIA,c={mediaProtocol:e.protocol,assetFileIds:e.fileIds,context:s};e.streamerType&&(c.streamerType=e.streamerType),e.urlType&&(c.urlType=e.urlType),e.adapterData&&(c.adapterData=e.adapterData),t._dataLoader.add(z,{entryId:o,ks:i,type:a,playbackContext:c,assetReferenceType:u});var l={contextType:s,mediaType:a,formats:e.formats||[]};return t._dataLoader.fetchData().then((function(e){try{r(t._parseDataFromResponse(e,l))}catch(e){n(e)}}),(function(e){n(e)}))}n(new g(g.Severity.CRITICAL,g.Category.PROVIDER,g.Code.MISSING_MANDATORY_PARAMS,{message:"missing entry id"}))}))}},{key:"_parseDataFromResponse",value:function(e,t){this._logger.debug("Data parsing started");var r={session:{isAnonymous:this._isAnonymous,partnerId:this.partnerId},sources:this._getDefaultSourcesObject(),plugins:{}};if(this.uiConfId&&(r.session.uiConfId=this.uiConfId),e){if(e.has(H.id)){var n=e.get(H.id);n&&n.response&&(r.session.ks=n.response)}else r.session.ks=this.ks;if(e.has(z.id)){var o=e.get(z.id);if(o&&o.response&&Object.keys(o.response).length){var i=o.response;if(le.hasBlockAction(i))throw new g(g.Severity.CRITICAL,g.Category.SERVICE,g.Code.BLOCK_ACTION,{action:le.getBlockAction(i),messages:le.getErrorMessages(i)});var s=le.getMediaEntry(i,t);Object.assign(r.sources,this._getSourcesObject(s)),this._verifyHasSources(r.sources);var a=le.getBumper(i);a&&Object.assign(r.plugins,{bumper:a})}}}return this._logger.debug("Data parsing finished",r),r}},{key:"getEntryListConfig",value:function(e){var t=this;return e.ks&&(this.ks=e.ks,this._isAnonymous=!1),this._dataLoader=new U(this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var o=e.entries;if(o&&o.length){var i=t.ks;i||(i="{1:result:ks}",t._dataLoader.add(H,{partnerId:t.partnerId})),t._dataLoader.add(Z,{entries:o,ks:i}),t._dataLoader.fetchData(!1).then((function(e){r(t._parseEntryListDataFromResponse(e,o))}),(function(e){n(e)}))}else n({success:!1,data:"Missing mandatory parameter"})}))}},{key:"_parseEntryListDataFromResponse",value:function(e,t){var r=this;this._logger.debug("Data parsing started");var n={id:"",metadata:{name:"",description:""},poster:"",items:[],playlistLastEntryId:""};if(e&&e.has(Z.id)){var o=e.get(Z.id);o&&o.response&&le.getEntryList(o.response,t).items.forEach((function(e){return n.items.push({sources:r._getSourcesObject(e)})}))}return this._logger.debug("Data parsing finished",n),n}},{key:"_getDefaultSourcesObject",value:function(){return{hls:[],dash:[],progressive:[],image:[],document:[],id:"",duration:0,type:oe.Type.UNKNOWN,poster:"",dvr:!1,vr:null,metadata:{name:"",description:"",tags:""}}}},{key:"_getSourcesObject",value:function(e){var t=this._getDefaultSourcesObject(),r=e.sources.toJSON();return t.hls=r.hls,t.dash=r.dash,t.progressive=r.progressive,t.id=e.id,t.duration=e.duration,t.type=e.type,t.dvr=!!e.dvrStatus,t.poster=e.poster,e.metadata&&e.metadata.metas&&"string"==typeof e.metadata.metas.tags&&e.metadata.metas.tags.indexOf("360")>-1&&(t.vr={}),Object.assign(t.metadata,e.metadata),t}}]),i}(m),he="@playkit-js/playkit-js-providers-ott",pe="2.45.1",de=Q.Type,ye=$.Type}(),n}()}));
2
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(function(){return function(){var e={61:function(e,t,r){var n=r(698).default;function o(){"use strict";e.exports=o=function(){return r},e.exports.__esModule=!0,e.exports.default=e.exports;var t,r={},i=Object.prototype,s=i.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function h(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(t){h=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof E?t:E,i=Object.create(o.prototype),s=new x(n||[]);return a(i,"_invoke",{value:A(e,r,s)}),i}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}r.wrap=p;var y="suspendedStart",v="suspendedYield",g="executing",m="completed",_={};function E(){}function R(){}function T(){}var b={};h(b,c,(function(){return this}));var O=Object.getPrototypeOf,w=O&&O(O(D([])));w&&w!==i&&s.call(w,c)&&(b=w);var k=T.prototype=E.prototype=Object.create(b);function I(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function r(o,i,a,u){var c=d(e[o],e,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==n(f)&&s.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,a,u)}),(function(e){r("throw",e,a,u)})):t.resolve(f).then((function(e){l.value=e,a(l)}),(function(e){return r("throw",e,a,u)}))}u(c.arg)}var o;a(this,"_invoke",{value:function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}})}function A(e,r,n){var o=y;return function(i,s){if(o===g)throw new Error("Generator is already running");if(o===m){if("throw"===i)throw s;return{value:t,done:!0}}for(n.method=i,n.arg=s;;){var a=n.delegate;if(a){var u=C(a,n);if(u){if(u===_)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=g;var c=d(e,r,n);if("normal"===c.type){if(o=n.done?m:v,c.arg===_)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=m,n.method="throw",n.arg=c.arg)}}}function C(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,C(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),_;var i=d(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,_;var s=i.arg;return s?s.done?(r[e.resultName]=s.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,_):s:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,_)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function D(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(s.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(n(e)+" is not iterable")}return R.prototype=T,a(k,"constructor",{value:T,configurable:!0}),a(T,"constructor",{value:R,configurable:!0}),R.displayName=h(T,f,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===R||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,T):(e.__proto__=T,h(e,f,"GeneratorFunction")),e.prototype=Object.create(k),e},r.awrap=function(e){return{__await:e}},I(S.prototype),h(S.prototype,l,(function(){return this})),r.AsyncIterator=S,r.async=function(e,t,n,o,i){void 0===i&&(i=Promise);var s=new S(p(e,t,n,o),i);return r.isGeneratorFunction(t)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},I(k),h(k,f,"Generator"),h(k,c,(function(){return this})),h(k,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},r.values=D,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var r in this)"t"===r.charAt(0)&&s.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=s.call(i,"catchLoc"),c=s.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&s.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,_):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),_},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),_}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:D(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),_}},r}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},698:function(e){function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},687:function(e,t,r){var n=r(61)();e.exports=n;try{regeneratorRuntime=n}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function o(e){var r=function(e,r){if("object"!==t(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,"string");if("object"!==t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===t(r)?r:String(r)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function s(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},a(e,t)}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t)}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e,r){if(r&&("object"===t(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return c(e)}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function h(e,t,r){return(t=o(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.r(n),r.d(n,{ContextType:function(){return de},MediaType:function(){return ye},NAME:function(){return he},Provider:function(){return fe},VERSION:function(){return pe}});var p={get:function(){return{VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:function(){},debug:function(){},enabledFor:function(){},error:function(){},get:function(){},getLevel:function(){},info:function(){},log:function(){},setHandler:function(){},setLevel:function(){},time:function(){},timeEnd:function(){},trace:function(){},useDefaults:function(){},warn:function(){}}}},d={};function y(e){return p.get(e)}var v=y,g=s((function t(r,n,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};e(this,t),this.severity=r,this.category=n,this.code=o,this.data=i,t._logger.error("Category:".concat(n," | Code:").concat(o," |"),i)}));h(g,"Severity",{RECOVERABLE:1,CRITICAL:2}),h(g,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),h(g,"Code",{UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,BAD_SERVER_RESPONSE:1005,MULTIREQUEST_API_ERROR:1006,API_RESPONSE_MISMATCH:1007,ERROR:2e3,BLOCK_ACTION:2001,MEDIA_STATUS_NOT_READY:2002,SCHEDULED_RESTRICTED:2003,DELETED_ENTRY:2004,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),h(g,"_logger",v("Error"));var m=function(){function t(r,n){e(this,t),h(this,"_networkRetryConfig",{async:!0,timeout:0,maxAttempts:4}),function(e){e&&"function"==typeof e.getLogger&&(p.get=e.getLogger),e&&e.LogLevel&&(d=e.LogLevel)}(r.logger),this._partnerId=r.partnerId,this._widgetId=r.widgetId,this._uiConfId=r.uiConfId,this._isAnonymous=!r.ks,this._ks=r.ks||"",this._playerVersion=n,this._referrer=r.referrer}return s(t,[{key:"partnerId",get:function(){return this._partnerId}},{key:"widgetId",get:function(){return this._widgetId||this.defaultWidgetId}},{key:"defaultWidgetId",get:function(){return"_"+this._partnerId}},{key:"uiConfId",get:function(){return this._uiConfId}},{key:"ks",get:function(){return this._ks},set:function(e){this._ks=e}},{key:"playerVersion",get:function(){return this._playerVersion}},{key:"isAnonymous",get:function(){return this._isAnonymous}},{key:"getMediaConfig",value:function(e){return Promise.reject(new g(g.Severity.CRITICAL,g.Category.PROVIDER,g.Code.METHOD_NOT_IMPLEMENTED,{message:"getMediaConfig method must be implement by the derived class"}))}},{key:"getPlaylistConfig",value:function(e){return Promise.reject(new g(g.Severity.CRITICAL,g.Category.PROVIDER,g.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading playlist by id"}))}},{key:"getEntryListConfig",value:function(e){return Promise.reject(new g(g.Severity.CRITICAL,g.Category.PROVIDER,g.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading entry list"}))}},{key:"_verifyHasSources",value:function(e){if(0===e.hls.concat(e.dash,e.progressive,e.image,e.document).length)throw new g(g.Severity.CRITICAL,g.Category.SERVICE,g.Code.MISSING_PLAY_SOURCE,{action:"",messages:"No play source for entry id: ".concat(e.id)})}},{key:"LogLevel",get:function(){return d}},{key:"getLogLevel",value:function(e){return function(e){return y(e).getLevel()}(e)}},{key:"setLogLevel",value:function(e,t){!function(e,t){y(t).setLevel(e)}(e,t)}}]),t}(),_=function e(r){var n;return Array.isArray(r)?(n=r.length>0?r.slice(0):[]).forEach((function(r,o){("object"===t(r)||Array.isArray(r)&&r.length>0)&&(n[o]=e(r))})):"object"===t(r)?(n=Object.assign({},r),Object.keys(n).forEach((function(r){("object"===t(n[r])||Array.isArray(n[r])&&n[r].length>0)&&(n[r]=e(n[r]))}))):n=r,n},E={serviceParams:{apiVersion:"7.8.1"}},R=function(){function t(){e(this,t)}return s(t,null,[{key:"set",value:function(e){e&&Object.assign(E,e)}},{key:"get",value:function(){return _(E)}}]),t}();function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function b(e,t,r,n,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void r(e)}a.done?t(u):Promise.resolve(u).then(n,o)}function O(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function s(e){b(i,n,o,s,a,"next",e)}function a(e){b(i,n,o,s,a,"throw",e)}s(void 0)}))}}var w=r(687),k=r.n(w),I=s((function t(r){e(this,t),h(this,"hasError",!1),"KalturaAPIException"===r.objectType?(this.hasError=!0,this.error=new S(r.code,r.message)):r.error&&"KalturaAPIException"===r.error.objectType?(this.hasError=!0,this.error=new S(r.error.code,r.error.message)):this.data=r})),S=s((function t(r,n){e(this,t),this.code=r,this.message=n}));function A(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return C(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?C(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw i}}}}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function P(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function L(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?P(Object(r),!0).forEach((function(t){h(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):P(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var x=function(){function t(){var r;e(this,t),h(this,"_logger",v("RequestSequenceBuilder")),h(this,"loaders",new Map),h(this,"_globalParams",{apiVersion:null===(r=R.get().serviceParams)||void 0===r?void 0:r.apiVersion})}var r,n,o;return s(t,[{key:"add",value:function(e){var t;this.loaders.set(null===(t=e.requests)||void 0===t||null===(t=t[0])||void 0===t?void 0:t.service,e)}},{key:"_executeRequest",value:(o=O(k().mark((function e(t){var r,n,o,i,s;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.params=JSON.stringify(L(L({},this._globalParams),t.params)),e.prev=1,e.next=4,t.doHttpRequest();case 4:return r=e.sent,(n=new I(r.result||r)).hasError&&(o=n.error,i=o.code,s=o.message,this._logger.error("Service returned an error with error code: ".concat(i," and message: ").concat(s,"."))),e.abrupt("return",n);case 10:throw e.prev=10,e.t0=e.catch(1),new g(g.Severity.CRITICAL,g.Category.NETWORK,g.Code.API_RESPONSE_MISMATCH,{error:e.t0,request:t});case 13:case"end":return e.stop()}}),e,this,[[1,10]])}))),function(e){return o.apply(this,arguments)})},{key:"_executeSequence",value:(n=O(k().mark((function e(t){var r,n,o,i,s,a,u,c,l,f;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=[],n=A(t),e.prev=2,n.s();case 4:if((o=n.n()).done){e.next=18;break}return i=o.value,e.prev=6,e.next=9,this._executeRequest(i);case 9:s=e.sent,r.push(s),e.next=16;break;case 13:e.prev=13,e.t0=e.catch(6),this._logger.error("Request execution failed: ".concat(e.t0.message));case 16:e.next=4;break;case 18:e.next=23;break;case 20:e.prev=20,e.t1=e.catch(2),n.e(e.t1);case 23:return e.prev=23,n.f(),e.finish(23);case 26:if(!(a=new D(r)).success){e.next=31;break}return e.abrupt("return",a);case 31:if(!(u=r.find((function(e){return e.hasError})))){e.next=35;break}throw c=u.error,l=c.message,f=c.code,new g(g.Severity.CRITICAL,g.Category.NETWORK,g.Code.API_RESPONSE_MISMATCH,{error:u.error,errorMessage:"Request returned an error: ".concat(l," (code: ").concat(f,")")});case 35:return e.abrupt("return",a);case 36:case"end":return e.stop()}}),e,this,[[2,20,23,26],[6,13]])}))),function(e){return n.apply(this,arguments)})},{key:"execute",value:(r=O(k().mark((function e(){var t,r,n,o,i;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.loaders.get("ottuser"),r=this.loaders.get("asset"),n="",e.prev=3,!t){e.next=10;break}return e.next=7,this._executeRequest(t.requests[0]);case 7:o=e.sent,t.response=[{data:o.data}],n=o.data.ks||"";case 10:if(!r){e.next=16;break}return r.requests.forEach((function(e){"{1:result:ks}"===e.params.ks&&(e.params.ks=n)})),e.next=14,this._executeSequence(r.requests);case 14:i=e.sent,r.response=i.results;case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(3),this._logger.error("loaders execution failed: ".concat(e.t0.message));case 21:return e.abrupt("return",this.loaders);case 22:case"end":return e.stop()}}),e,this,[[3,18]])}))),function(){return r.apply(this,arguments)})}]),t}(),D=s((function t(r){var n,o=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e(this,t),this.results=function(e){if(Array.isArray(e))return T(e)}(n=r)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||function(e,t){if(e){if("string"==typeof e)return T(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?T(e,t):void 0}}(n)||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.")}();var i,s=this.results.filter((function(e){return e.hasError})),a=A(s);try{for(a.s();!(i=a.n()).done;){var u=i.value.error,c=u.code,l=u.message;t._logger.error("Service returned an error with error code: ".concat(c," and message: ").concat(l,"."))}}catch(e){a.e(e)}finally{a.f()}var f=s.length===this.results.length,h=o&&s.length>0;f||h?this.success=!1:(o||(this.results=this.results.filter((function(e){return!e.hasError}))),this.success=!0)}));h(D,"_logger",v("SingleRequestsResult"));var M=function(){function t(r){e(this,t),h(this,"_loadersResponseMap",new Map),h(this,"_loaders",new Map),this._networkRetryConfig=r,this._singleRequests=new x}return s(t,[{key:"add",value:function(e,t,r){var n=this,o=new e(t);if(o.isValid())if(this._loaders.set(e.id,o),o.disableMultirequest)this._singleRequests.add(o);else{var i=this._multiRequest.requests.length,s=o.requests;this._multiRequest.retryConfig=this._networkRetryConfig,s.forEach((function(e){e.params=e.params||{},e.params.ks=e.params.ks||r,n._multiRequest.add(e)}));var a=Array.from(new Array(s.length),(function(e,t){return t+i}));this._loadersResponseMap.set(e.id,a)}}},{key:"fetchData",value:function(e,t){var r=this;return new Promise((function(n,o){r._singleRequests.loaders.size>0?r._singleRequests.execute().then((function(){return n(r._loaders)})).catch((function(e){return o(e)})):r._multiRequest.execute(e,t).then((function(e){r._multiResponse=e.response,r.prepareData(e.response).success?n(r._loaders):o(new g(g.Severity.CRITICAL,g.Category.NETWORK,g.Code.API_RESPONSE_MISMATCH,{headers:e.headers}))}),(function(e){o(e)}))}))}},{key:"prepareData",value:function(e){var t=this;return this._loaders.forEach((function(r,n){var o=t._loadersResponseMap.get(n);try{o&&o.length>0&&(r.response=e.results.slice(o[0],o[o.length-1]+1))}catch(e){return{success:!1,error:e}}})),{success:!0,data:this._loaders}}}]),t}(),j=function(){function t(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;e(this,t),h(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),h(this,"_attemptCounter",1),this.headers=r}return s(t,[{key:"getUrl",value:function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")}},{key:"doHttpRequest",value:function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new g(g.Severity.CRITICAL,g.Category.NETWORK,g.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t}},{key:"_createXHR",value:function(){var e=this,t=new XMLHttpRequest;t.onreadystatechange=function(){if(4===t.readyState&&200===t.status)try{var r=JSON.parse(t.responseText);return e.responseHeaders=e._getResponseHeaders(t),e._requestPromise.resolve(r)}catch(r){e._requestPromise.reject(e._createError(t,g.Code.BAD_SERVER_RESPONSE,{text:t.responseText}))}},t.open(this.method,this.url,this.retryConfig.async),this.retryConfig.async&&this.retryConfig.timeout&&(t.timeout=this.retryConfig.timeout);var r=performance.now();t.ontimeout=function(){e._handleError(t,g.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,g.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)}},{key:"_getResponseHeaders",value:function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))}},{key:"_handleError",value:function(e,t,r){var n=this._createError(e,t,r);if(e.onreadystatechange=function(){},e.onerror=function(){},e.ontimeout=function(){},e.onabort=function(){},!(this.retryConfig.maxAttempts&&this._attemptCounter<this.retryConfig.maxAttempts))return this._requestPromise.reject(n);this._attemptCounter++,this._createXHR()}},{key:"_createError",value:function(e,t,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(e),attempt:this._attemptCounter}),new g(g.Severity.CRITICAL,g.Category.NETWORK,t,r)}}]),t}();var N=function(t){u(i,t);var r,n,o=(r=i,n=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(e){return!1}}(),function(){var e,t=f(r);if(n){var o=f(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return l(this,e)});function i(){var t;e(this,i);for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return h(c(t=o.call.apply(o,[this].concat(n))),"requests",[]),t}return s(i,[{key:"add",value:function(e){this.requests.push(e);var t={},r={service:e.service,action:e.action};return Object.assign(t,h({},this.requests.length,Object.assign(r,e.params))),Object.assign(t,this.params),this.params=t,this}},{key:"execute",value:function(e,t){var r=this;return new Promise((function(n,o){try{r.params=JSON.stringify(r.params)}catch(e){i._logger.error("".concat(e.message)),o(new g(g.Severity.CRITICAL,g.Category.PROVIDER,g.Code.FAILED_PARSING_REQUEST,{error:e,params:r.params}))}r.doHttpRequest().then((function(i){var s=new q(i,e,t);s.success?n({headers:r.responseHeaders,response:s}):o(new g(g.Severity.CRITICAL,g.Category.NETWORK,g.Code.MULTIREQUEST_API_ERROR,{url:r.url,headers:r.responseHeaders,results:s.results}))}),(function(e){o(e)}))}))}}]),i}(j);h(N,"_logger",v("MultiRequestBuilder"));var q=s((function t(r){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];e(this,t),h(this,"results",[]);var i=r.result?r.result:r,s=(Array.isArray(i)?i:[i]).map((function(e){return new I(e)})),a=s.filter((function(e){return e.hasError}));a.forEach((function(e){t._logger.error("Service returned an error with error code: ".concat(e.error.code," and message: ").concat(e.error.message,"."))})),this.results=s,n&&a.length||a.length===this.results.length?this.success=!1:(o&&(this.results=this.results.filter((function(e){return!e.hasError}))),this.success=!0)}));h(q,"_logger",v("MultiRequestResult"));var B=function(){function t(){e(this,t)}return s(t,null,[{key:"getMultiRequest",value:function(e,t){var r=R.get(),n=r.serviceParams;e&&Object.assign(n,{ks:e}),t&&Object.assign(n,{partnerId:t});var o=new Map;o.set("Content-Type","application/json");var i=new N(o);return i.method="POST",i.service="multirequest",i.url=i.getUrl(r.serviceUrl),i.params=n,i}}]),t}();var U=function(t){u(i,t);var r,n,o=(r=i,n=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(e){return!1}}(),function(){var e,t=f(r);if(n){var o=f(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return l(this,e)});function i(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",s=arguments.length>2?arguments[2]:void 0;return e(this,i),(r=o.call(this,s))._multiRequest=B.getMultiRequest(n,t),r}return s(i)}(M);var V=function(t){u(i,t);var r,n,o=(r=i,n=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(e){return!1}}(),function(){var e,t=f(r);if(n){var o=f(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return l(this,e)});function i(){return e(this,i),o.apply(this,arguments)}return s(i,null,[{key:"anonymousLogin",value:function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var o=new j(n);o.service="ottuser",o.action="anonymousLogin",o.method="POST",o.url=o.getUrl(e);var i={partnerId:t};return r&&Object.assign(i,{udid:r}),o.params=i,o}}]),i}(B),H=function(){function t(r){e(this,t),h(this,"_response",{}),h(this,"_disableMultirequest",R.get().ottDisableMultirequest),this.requests=this.buildRequests(r),this._partnerId=r.partnerId}return s(t,[{key:"requests",get:function(){return this._requests},set:function(e){this._requests=e}},{key:"response",get:function(){return this._response.ks},set:function(e){this._response.ks=e[0].data.ks}},{key:"disableMultirequest",get:function(){return this._disableMultirequest}},{key:"buildRequests",value:function(e){var t=R.get(),r=[];return r.push(V.anonymousLogin(t.serviceUrl,e.partnerId,e.udid)),r}},{key:"isValid",value:function(){return!!this._partnerId}}],[{key:"id",get:function(){return"session"}}]),t}();var F="asset",K=function(t){u(i,t);var r,n,o=(r=i,n=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(e){return!1}}(),function(){var e,t=f(r);if(n){var o=f(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return l(this,e)});function i(){return e(this,i),o.apply(this,arguments)}return s(i,null,[{key:"getPlaybackContext",value:function(e,t,r,n,o){var i=new Map;i.set("Content-Type","application/json");var s=new j(i);s.service=F,s.action="getPlaybackContext",s.method="POST",s.url=s.getUrl(e);var a={objectType:"KalturaPlaybackContextOptions"};return Object.assign(a,o),s.params={assetId:r,assetType:n,contextDataParams:a,ks:t},s}},{key:"get",value:function(e,t,r,n){var o=new Map;o.set("Content-Type","application/json");var i=new j(o);return i.service=F,i.action="get",i.method="POST",i.url=i.getUrl(e),i.params={id:r,assetReferenceType:n,ks:t},i}}]),i}(B),Y=s((function t(r){e(this,t),this.message=r.message,this.code=r.code})),G=s((function t(r){e(this,t),this.type=r.type}));h(G,"Type",{BLOCK:"BLOCK",START_DATE_OFFSET:"START_DATE_OFFSET",END_DATE_OFFSET:"END_DATE_OFFSET",USER_BLOCK:"USER_BLOCK",ALLOW_PLAYBACK:"ALLOW_PLAYBACK",BLOCK_PLAYBACK:"BLOCK_PLAYBACK",APPLY_DISCOUNT_MODULE:"APPLY_DISCOUNT_MODULE"});var W=s((function t(r){e(this,t),this.scheme=r.scheme,this.licenseURL=r.licenseURL,this.certificate=r.certificate}));h(W,"Scheme",{"drm.PLAYREADY_CENC":"com.microsoft.playready","drm.WIDEVINE_CENC":"com.widevine.alpha","fairplay.FAIRPLAY":"com.apple.fairplay",WIDEVINE_CENC:"com.widevine.alpha",PLAYREADY_CENC:"com.microsoft.playready",FAIRPLAY:"com.apple.fairplay"});var J=function(){function t(r){var n=this;e(this,t),h(this,"drm",[]),this.format=r.format,this.adsPolicy=r.adsPolicy,this.adsParam=r.adsParam,this.duration=r.duration,this.url=r.url,this.type=r.type,this.fileId=r.id,this.protocols=r.protocols,r.drm&&r.drm.map((function(e){return n.drm.push(new W(e))}))}return s(t,[{key:"hasDrmData",value:function(){return this.drm&&this.drm.length>0}},{key:"getProtocol",value:function(e){var t="";if(this.protocols&&this.protocols.length>0)this.protocols.split(",").forEach((function(r){r===e&&(t=r)}));else if("http"===e)return e;return t}}]),t}(),X=s((function t(r){e(this,t),this.streamertype=r.streamertype,this.url=r.url}));h(X,"StreamerType",{HLS:"hls",DASH:"dash",PROGRESSIVE:"progressive"});var Q=function(t){u(i,t);var r,n,o=(r=i,n=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(e){return!1}}(),function(){var e,t=f(r);if(n){var o=f(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return l(this,e)});function i(t){var r;if(e(this,i),h(c(r=o.call(this,t)),"sources",[]),h(c(r),"actions",[]),h(c(r),"messages",[]),h(c(r),"plugins",[]),!r.hasError){var n=t.messages;n&&n.map((function(e){return r.messages.push(new Y(e))}));var s=t.actions;s&&s.map((function(e){return r.actions.push(new G(e))}));var a=t.sources;a&&a.map((function(e){return r.sources.push(new J(e))}));var u=t.plugins;u&&u.map((function(e){return r.plugins.push(new X(e))}))}return r}return s(i,[{key:"hasBlockAction",value:function(){return void 0!==this.getBlockAction()}},{key:"getBlockAction",value:function(){return this.actions.find((function(e){return e.type===G.Type.BLOCK}))}},{key:"getErrorMessages",value:function(){return this.messages}}]),i}(I);h(Q,"Type",{DOWNLOAD:"DOWNLOAD",TRAILER:"TRAILER",CATCHUP:"CATCHUP",START_OVER:"START_OVER",PLAYBACK:"PLAYBACK"});var $=function(t){u(i,t);var r,n,o=(r=i,n=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(e){return!1}}(),function(){var e,t=f(r);if(n){var o=f(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return l(this,e)});function i(t){var r;return e(this,i),h(c(r=o.call(this,t)),"name",""),h(c(r),"description",""),h(c(r),"tags",[]),h(c(r),"metas",[]),h(c(r),"pictures",[]),r.hasError||(r.id=t.id,r.name=t.name,r.description=t.description,r.createDate=t.createDate,r.endDate=t.endDate,r.plays=t.plays,r.views=t.views,r.metas=r._formatTagsMetas(t.metas),r.tags=r._formatTagsMetas(t.tags),r.pictures=t.images),r}return s(i,[{key:"_formatTagsMetas",value:function(e){var t=[];return Object.keys(e).forEach((function(r){if(e[r].objects){var n="";e[r].objects.forEach((function(e){n+=e.value+"|"})),t.push({key:r,value:n})}else t.push({key:r,value:e[r].value})})),t}}]),i}(I);h($,"Type",{MEDIA:"media",RECORDING:"recording",EPG:"epg"}),h($,"AssetReferenceType",{MEDIA:"media",EPG_INTERNAL:"epg_internal",EPG_EXTERNAL:"epg_external",NPVR:"nPVR"});var z=function(){function t(r){e(this,t),h(this,"_response",{}),h(this,"_disableMultirequest",R.get().ottDisableMultirequest),this.requests=this.buildRequests(r),this._entryId=r.entryId}return s(t,[{key:"requests",get:function(){return this._requests},set:function(e){this._requests=e}},{key:"response",get:function(){return this._response},set:function(e){this._response.mediaDataResult=new $(e[0].data),this._response.playBackContextResult=new Q(e[1].data)}},{key:"disableMultirequest",get:function(){return this._disableMultirequest}},{key:"buildRequests",value:function(e){var t=R.get(),r=[];return r.push(K.get(t.serviceUrl,e.ks,e.entryId,e.assetReferenceType)),r.push(K.getPlaybackContext(t.serviceUrl,e.ks,e.entryId,e.type,e.playbackContext)),r}},{key:"isValid",value:function(){return!!this._entryId}}],[{key:"id",get:function(){return"asset"}}]),t}(),Z=function(){function t(r){e(this,t),h(this,"_response",{playlistItems:{entries:[]}}),this.requests=this.buildRequests(r),this._entries=r.entries}return s(t,[{key:"requests",get:function(){return this._requests},set:function(e){this._requests=e}},{key:"response",get:function(){return this._response},set:function(e){var t=this;e.forEach((function(e){t._response.playlistItems.entries.push({mediaDataResult:new $(e.data)})}))}},{key:"buildRequests",value:function(e){var t=R.get(),r=[];return e.entries.forEach((function(n){var o=n.assetReferenceType||$.AssetReferenceType.MEDIA;r.push(K.get(t.serviceUrl,e.ks,n.entryId||n,o))})),r}},{key:"isValid",value:function(){return!(!this._entries||!this._entries.length)}}],[{key:"id",get:function(){return"asset_list"}}]),t}(),ee={DASH:{name:"dash",mimeType:"application/dash+xml",pathExt:"mpd"},HLS:{name:"hls",mimeType:"application/x-mpegURL",pathExt:"m3u8"},WVM:{name:"wvm",mimeType:"video/wvm",pathExt:"wvm"},MP4:{name:"mp4",mimeType:"video/mp4",pathExt:"mp4"},MP3:{name:"mp3",mimeType:"audio/mpeg",pathExt:"mp3"}},te=new Map([["mpegdash",ee.DASH],["applehttp",ee.HLS],["url",ee.MP4]]);function re(e){var t=te.get(e);return!!t&&t.name===ee.MP4.name}var ne=function(){function t(){e(this,t),this.progressive=[],this.dash=[],this.hls=[],this.image=[],this.document=[]}return s(t,[{key:"map",value:function(e,t){if(t)switch(t.name){case ee.MP4.name:this.progressive.push(e);break;case ee.DASH.name:this.dash.push(e);break;case ee.HLS.name:this.hls.push(e)}}},{key:"toJSON",value:function(){var e={progressive:[],dash:[],hls:[],image:[],document:[]};return this.progressive.forEach((function(t){return e.progressive.push(t.toJSON())})),this.hls.forEach((function(t){return e.hls.push(t.toJSON())})),this.dash.forEach((function(t){return e.dash.push(t.toJSON())})),e.image=this.image,e.document=this.document,e}}]),t}(),oe=function(){function t(){e(this,t),this.metadata=new Map,this.sources=new ne,this.type=t.Type.UNKNOWN}return s(t,[{key:"toJSON",value:function(){return{id:this.id,name:this.name,sources:this.sources.toJSON(),duration:this.duration,dvrStatus:this.dvrStatus,status:this.status,metadata:this.metadata,type:this.type,poster:this.poster,assetReferenceType:this.assetReferenceType,downloadUrl:this.downloadUrl,rawThumbnailUrl:this.rawThumbnailUrl,rootEntryId:this.rootEntryId,capabilities:this.capabilities}}}]),t}();h(oe,"Type",{VOD:"Vod",LIVE:"Live",IMAGE:"Image",AUDIO:"Audio",UNKNOWN:"Unknown",DOCUMENT:"Document"}),h(oe,"DvrStatus",{ON:1,OFF:0});var ie=function(){function t(r,n,o){e(this,t),this.licenseUrl=r,this.scheme=n,o&&(this.certificate=o)}return s(t,[{key:"toJSON",value:function(){var e={licenseUrl:this.licenseUrl,scheme:this.scheme};return this.certificate&&(e.certificate=this.certificate),e}}]),t}(),se=function(){function t(){e(this,t)}return s(t,[{key:"toJSON",value:function(){var e={id:this.id,url:this.url,mimetype:this.mimetype};return this.bandwidth&&(e.bandwidth=this.bandwidth),this.width&&(e.width=this.width),this.height&&(e.height=this.height),this.label&&(e.label=this.label),this.drmData&&this.drmData.length>0&&(e.drmData=[],this.drmData.forEach((function(t){Array.isArray(e.drmData)&&e.drmData.push(t.toJSON())}))),e}}]),t}(),ae=s((function t(){e(this,t),this.items=[]})),ue=s((function t(r){e(this,t),this.url=r.url,this.clickThroughUrl=r.clickThroughUrl})),ce=h(h(h({},$.Type.MEDIA,h(h({},Q.Type.TRAILER,(function(){return{type:oe.Type.VOD}})),Q.Type.PLAYBACK,(function(e){return"KalturaLiveAsset"===e.objectType?{type:oe.Type.LIVE,dvrStatus:e.enableTrickPlay?oe.DvrStatus.ON:oe.DvrStatus.OFF}:parseInt(e.externalIds)>0?{type:oe.Type.LIVE,dvrStatus:oe.DvrStatus.OFF}:{type:oe.Type.VOD}}))),$.Type.EPG,h(h({},Q.Type.CATCHUP,(function(){return{type:oe.Type.VOD}})),Q.Type.START_OVER,(function(){return{type:oe.Type.LIVE,dvrStatus:oe.DvrStatus.ON}}))),$.Type.RECORDING,h({},Q.Type.PLAYBACK,(function(){return{type:oe.Type.VOD}}))),le=function(){function t(){e(this,t)}return s(t,null,[{key:"getMediaEntry",value:function(e,r){var n=new oe;t._fillBaseData(n,e,r);var o=e.playBackContextResult,i=e.mediaDataResult,s=o.sources,a=t._filterSourcesByFormats(s,r.formats);n.sources=t._getParsedSources(a);var u=t._getMediaType(i.data,r.mediaType,r.contextType);return n.type=u.type,n.dvrStatus=u.dvrStatus,n.duration=Math.max.apply(Math,s.map((function(e){return e.duration}))),n}},{key:"getEntryList",value:function(e,r){var n=new ae;return e.playlistItems.entries.forEach((function(e){var o=new oe,i=r.find((function(t){return t.entryId===e.mediaDataResult.id}));t._fillBaseData(o,e,i),n.items.push(o)})),n}},{key:"getBumper",value:function(e){var t=e.playBackContextResult.plugins.find((function(e){return e.streamertype===X.StreamerType.PROGRESSIVE}));if(t)return new ue(t)}},{key:"_fillBaseData",value:function(e,r,n){var o=r.mediaDataResult,i=t.reconstructMetadata(o);return i.description=o.description,i.name=o.name,o.createDate&&(i.createdAt=o.createDate),o.endDate&&(i.endDate=o.endDate),o.data.entryId&&(i.entryId=o.data.entryId),o.data.epgId&&(i.epgId=o.data.epgId),o.data.recordingId&&(i.recordingId=o.data.recordingId),n&&n.mediaType&&(i.mediaType=n.mediaType),n&&n.contextType&&(i.contextType=n.contextType),e.metadata=i,e.poster=t._getPoster(o.pictures),e.id=o.id,e}},{key:"reconstructMetadata",value:function(e){return{metas:t.addToMetaObject(e.metas),tags:t.addToMetaObject(e.tags)}}},{key:"addToMetaObject",value:function(e){var t={};return e&&e.forEach((function(e){t[e.key]=e.value})),t}},{key:"_getPoster",value:function(e){if(e&&e.length>0){var t=e[0].url;return/.*\/thumbnail\/.*(?:width|height)\/\d+\/(?:height|width)\/\d+/.test(t)?t:e.map((function(e){return{url:e.url,width:e.width,height:e.height}}))}return""}},{key:"_getMediaType",value:function(e,t,r){var n={type:oe.Type.UNKNOWN};return ce[t]&&ce[t][r]&&(n=ce[t][r](e)),n}},{key:"_filterSourcesByFormats",value:function(e,t){return t.length>0&&(e=e.filter((function(e){return t.includes(e.type)}))),e}},{key:"_getParsedSources",value:function(e){var r=new ne,n=function(e){var n=t._parseAdaptiveSource(e);if(n){var o=te.get(e.format);r.map(n,o)}};return e&&e.length>0&&(e.filter((function(e){return!re(e.format)})).forEach(n),e.filter((function(e){return re(e.format)})).forEach(n)),r}},{key:"_parseAdaptiveSource",value:function(e){var r=new se;if(e){var n=e.url,o=te.get(e.format);if(o&&(r.mimetype=o.mimeType),!n)return t._logger.error("failed to create play url from source, discarding source: (".concat(e.fileId,"), ").concat(e.format,".")),null;if(r.url=n,r.id=e.fileId+","+e.format,e.hasDrmData()){var i=[];e.drm.forEach((function(e){i.push(new ie(e.licenseURL,W.Scheme[e.scheme],e.certificate))})),r.drmData=i}}return r}},{key:"hasBlockAction",value:function(e){return e.playBackContextResult.hasBlockAction()}},{key:"getBlockAction",value:function(e){return e.playBackContextResult.getBlockAction()}},{key:"getErrorMessages",value:function(e){return e.playBackContextResult.getErrorMessages()}}]),t}();h(le,"_logger",v("OTTProviderParser"));var fe=function(t){u(i,t);var r,n,o=(r=i,n=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(e){return!1}}(),function(){var e,t=f(r);if(n){var o=f(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return l(this,e)});function i(t,r){var n;return e(this,i),(n=o.call(this,t,r))._logger=v("OTTProvider"),R.set(t.env),n._networkRetryConfig=Object.assign(n._networkRetryConfig,t.networkRetryParameters),n}return s(i,[{key:"env",get:function(){return R.get()}},{key:"getMediaConfig",value:function(e){var t=this;return e.ks&&(this.ks=e.ks,this._isAnonymous=!1),this._dataLoader=new U(this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var o=e.entryId;if(o){var i=t.ks;i||(i="{1:result:ks}",t._dataLoader.add(H,{partnerId:t.partnerId}));var s=e.contextType||Q.Type.PLAYBACK,a=e.mediaType||$.Type.MEDIA,u=e.assetReferenceType||$.AssetReferenceType.MEDIA,c={mediaProtocol:e.protocol,assetFileIds:e.fileIds,context:s};e.streamerType&&(c.streamerType=e.streamerType),e.urlType&&(c.urlType=e.urlType),e.adapterData&&(c.adapterData=e.adapterData),t._dataLoader.add(z,{entryId:o,ks:i,type:a,playbackContext:c,assetReferenceType:u});var l={contextType:s,mediaType:a,formats:e.formats||[]};return t._dataLoader.fetchData().then((function(e){try{r(t._parseDataFromResponse(e,l))}catch(e){n(e)}}),(function(e){n(e)}))}n(new g(g.Severity.CRITICAL,g.Category.PROVIDER,g.Code.MISSING_MANDATORY_PARAMS,{message:"missing entry id"}))}))}},{key:"_parseDataFromResponse",value:function(e,t){this._logger.debug("Data parsing started");var r={session:{isAnonymous:this._isAnonymous,partnerId:this.partnerId},sources:this._getDefaultSourcesObject(),plugins:{}};if(this.uiConfId&&(r.session.uiConfId=this.uiConfId),e){if(e.has(H.id)){var n=e.get(H.id);n&&n.response&&(r.session.ks=n.response)}else r.session.ks=this.ks;if(e.has(z.id)){var o=e.get(z.id);if(o&&o.response&&Object.keys(o.response).length){var i=o.response;if(le.hasBlockAction(i))throw new g(g.Severity.CRITICAL,g.Category.SERVICE,g.Code.BLOCK_ACTION,{action:le.getBlockAction(i),messages:le.getErrorMessages(i)});var s=le.getMediaEntry(i,t);Object.assign(r.sources,this._getSourcesObject(s)),this._verifyHasSources(r.sources);var a=le.getBumper(i);a&&Object.assign(r.plugins,{bumper:a})}}}return this._logger.debug("Data parsing finished",r),r}},{key:"getEntryListConfig",value:function(e){var t=this;return e.ks&&(this.ks=e.ks,this._isAnonymous=!1),this._dataLoader=new U(this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var o=e.entries;if(o&&o.length){var i=t.ks;i||(i="{1:result:ks}",t._dataLoader.add(H,{partnerId:t.partnerId})),t._dataLoader.add(Z,{entries:o,ks:i}),t._dataLoader.fetchData(!1).then((function(e){r(t._parseEntryListDataFromResponse(e,o))}),(function(e){n(e)}))}else n({success:!1,data:"Missing mandatory parameter"})}))}},{key:"_parseEntryListDataFromResponse",value:function(e,t){var r=this;this._logger.debug("Data parsing started");var n={id:"",metadata:{name:"",description:""},poster:"",items:[],playlistLastEntryId:""};if(e&&e.has(Z.id)){var o=e.get(Z.id);o&&o.response&&le.getEntryList(o.response,t).items.forEach((function(e){return n.items.push({sources:r._getSourcesObject(e)})}))}return this._logger.debug("Data parsing finished",n),n}},{key:"_getDefaultSourcesObject",value:function(){return{hls:[],dash:[],progressive:[],image:[],document:[],id:"",duration:0,type:oe.Type.UNKNOWN,poster:"",dvr:!1,vr:null,metadata:{name:"",description:"",tags:""}}}},{key:"_getSourcesObject",value:function(e){var t=this._getDefaultSourcesObject(),r=e.sources.toJSON();return t.hls=r.hls,t.dash=r.dash,t.progressive=r.progressive,t.id=e.id,t.duration=e.duration,t.type=e.type,t.dvr=!!e.dvrStatus,t.poster=e.poster,e.metadata&&e.metadata.metas&&"string"==typeof e.metadata.metas.tags&&e.metadata.metas.tags.indexOf("360")>-1&&(t.vr={}),Object.assign(t.metadata,e.metadata),t}}]),i}(m),he="@playkit-js/playkit-js-providers-ott",pe="2.45.2",de=Q.Type,ye=$.Type}(),n}()}));
3
3
  //# sourceMappingURL=playkit-ott-provider.js.map
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see playkit-ovp-provider.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 r=e();for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(self,(function(){return function(){var t={61:function(t,e,r){var n=r(698).default;function i(){"use strict";t.exports=i=function(){return r},t.exports.__esModule=!0,t.exports.default=t.exports;var e,r={},a=Object.prototype,s=a.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function d(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{d({},"")}catch(e){d=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var i=e&&e.prototype instanceof _?e:_,a=Object.create(i.prototype),s=new D(n||[]);return o(a,"_invoke",{value:O(t,r,s)}),a}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var y="suspendedStart",v="suspendedYield",m="executing",g="completed",E={};function _(){}function R(){}function I(){}var T={};d(T,c,(function(){return this}));var b=Object.getPrototypeOf,w=b&&b(b(x([])));w&&w!==a&&s.call(w,c)&&(T=w);var A=I.prototype=_.prototype=Object.create(T);function k(t){["next","throw","return"].forEach((function(e){d(t,e,(function(t){return this._invoke(e,t)}))}))}function C(t,e){function r(i,a,o,u){var c=p(t[i],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==n(f)&&s.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,o,u)}),(function(t){r("throw",t,o,u)})):e.resolve(f).then((function(t){l.value=t,o(l)}),(function(t){return r("throw",t,o,u)}))}u(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function a(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(a,a):a()}})}function O(t,r,n){var i=y;return function(a,s){if(i===m)throw new Error("Generator is already running");if(i===g){if("throw"===a)throw s;return{value:e,done:!0}}for(n.method=a,n.arg=s;;){var o=n.delegate;if(o){var u=S(o,n);if(u){if(u===E)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===y)throw i=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=m;var c=p(t,r,n);if("normal"===c.type){if(i=n.done?g:v,c.arg===E)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=g,n.method="throw",n.arg=c.arg)}}}function S(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),E;var a=p(i,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,E;var s=a.arg;return s?s.done?(r[t.resultName]=s.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,E):s:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,E)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function x(t){if(t||""===t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,a=function r(){for(;++i<t.length;)if(s.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(n(t)+" is not iterable")}return R.prototype=I,o(A,"constructor",{value:I,configurable:!0}),o(I,"constructor",{value:R,configurable:!0}),R.displayName=d(I,f,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===R||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,I):(t.__proto__=I,d(t,f,"GeneratorFunction")),t.prototype=Object.create(A),t},r.awrap=function(t){return{__await:t}},k(C.prototype),d(C.prototype,l,(function(){return this})),r.AsyncIterator=C,r.async=function(t,e,n,i,a){void 0===a&&(a=Promise);var s=new C(h(t,e,n,i),a);return r.isGeneratorFunction(e)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},k(A),d(A,f,"Generator"),d(A,c,(function(){return this})),d(A,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=x,D.prototype={constructor:D,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&s.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,i){return o.type="throw",o.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=s.call(a,"catchLoc"),c=s.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&s.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,E):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),E},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),E}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;L(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:x(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),E}},r}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},698:function(t){function e(r){return t.exports=e="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.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},687:function(t,e,r){var n=r(61)();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,r),a.exports}r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return function(){"use strict";r.r(n),r.d(n,{NAME:function(){return Ht},Provider:function(){return Ft},ProviderParser:function(){return ct},RequestBuilder:function(){return ft},ResponseTypes:function(){return t},VERSION:function(){return Kt}});var t={};function e(t,e,r,n,i,a,s){try{var o=t[a](s),u=o.value}catch(t){return void r(t)}o.done?e(u):Promise.resolve(u).then(n,i)}function i(t){return function(){var r=this,n=arguments;return new Promise((function(i,a){var s=t.apply(r,n);function o(t){e(s,i,a,o,u,"next",t)}function u(t){e(s,i,a,o,u,"throw",t)}o(void 0)}))}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t){return s="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},s(t)}function o(t){var e=function(t,e){if("object"!==s(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===s(e)?e:String(e)}function u(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,o(n.key),n)}}function c(t,e,r){return e&&u(t.prototype,e),r&&u(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(t,e){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},f(t,e)}function d(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)}function h(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return l(t)}function p(t){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},p(t)}function y(t,e,r){return(e=o(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r.r(t),r.d(t,{BaseServiceResult:function(){return w},KalturaAccessControlMessage:function(){return j},KalturaAccessControlModifyRequestHostRegexAction:function(){return S},KalturaBaseEntryListResponse:function(){return C},KalturaBumper:function(){return D},KalturaDrmPlaybackPluginData:function(){return P},KalturaFlavorAsset:function(){return x},KalturaMediaEntries:function(){return M},KalturaMediaEntry:function(){return k},KalturaMetadata:function(){return U},KalturaMetadataListResponse:function(){return N},KalturaPlaybackContext:function(){return V},KalturaPlaybackSource:function(){return L},KalturaPlaylist:function(){return B},KalturaRuleAction:function(){return O},KalturaUIConfResponse:function(){return q},KalturaUserEntry:function(){return F},KalturaUserEntryListResponse:function(){return H}});var v=r(687),m=r.n(v),g={get:function(){return{VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:function(){},debug:function(){},enabledFor:function(){},error:function(){},get:function(){},getLevel:function(){},info:function(){},log:function(){},setHandler:function(){},setLevel:function(){},time:function(){},timeEnd:function(){},trace:function(){},useDefaults:function(){},warn:function(){}}}},E={};function _(t){return g.get(t)}var R=_,I=function t(e){var r;return Array.isArray(e)?(r=e.length>0?e.slice(0):[]).forEach((function(e,n){("object"===s(e)||Array.isArray(e)&&e.length>0)&&(r[n]=t(e))})):"object"===s(e)?(r=Object.assign({},e),Object.keys(r).forEach((function(e){("object"===s(r[e])||Array.isArray(r[e])&&r[e].length>0)&&(r[e]=t(r[e]))}))):r=e,r},T={serviceUrl:"https://cdnapisec.kaltura.com/api_v3",cdnUrl:"https://cdnapisec.kaltura.com",serviceParams:{apiVersion:"3.3.0",format:1},useApiCaptions:!0,loadThumbnailWithKs:!1,replaceHostOnlyManifestUrls:!1},b=function(){function t(){a(this,t)}return c(t,null,[{key:"set",value:function(t){null!=t&&t.overrideServiceUrl&&(t.serviceUrl=t.overrideServiceUrl),t&&Object.assign(T,t)}},{key:"get",value:function(){return I(T)}},{key:"serviceUrl",get:function(){return T.serviceUrl}}]),t}(),w=c((function t(e){a(this,t),y(this,"hasError",!1),"KalturaAPIException"===e.objectType?(this.hasError=!0,this.error=new A(e.code,e.message)):e.error&&"KalturaAPIException"===e.error.objectType?(this.hasError=!0,this.error=new A(e.error.code,e.error.message)):this.data=e})),A=c((function t(e,r){a(this,t),this.code=e,this.message=r})),k=c((function t(e){a(this,t),this.id=e.id,this.referenceId=e.referenceId,this.externalSourceType=e.externalSourceType,this.name=e.name,this.description=e.description,this.dataUrl=e.dataUrl,this.type=e.type,this.entryType=e.mediaType,this.flavorParamsIds=e.flavorParamsIds,this.duration=e.duration,this.poster=e.thumbnailUrl,this.rawThumbnailUrl=e.thumbnailUrl,this.status=e.status,this.dvrStatus=e.dvrStatus,this.tags=e.tags,this.adminTags=e.adminTags,this.createdAt=e.createdAt,this.updatedAt=e.updatedAt,this.creatorId=e.creatorId,this.userId=e.userId,this.endDate=e.endDate,this.plays=e.plays,this.views=e.views,this.downloadUrl=e.downloadUrl,this.rootEntryId=e.rootEntryId,this.capabilities=e.capabilities}));y(k,"EntryType",{AUTOMATIC:{value:-1},EXTERNAL_MEDIA:{value:"externalMedia.externalMedia"},MEDIA_CLIP:{value:1},MIX:{value:2},PLAYLIST:{value:5},DATA:{value:6},LIVE_STREAM:{value:7},LIVE_CHANNEL:{value:8},DOCUMENT:{value:10}}),y(k,"MediaType",{VIDEO:{value:1},IMAGE:{value:2},AUDIO:{value:5},LIVE_STREAM_FLASH:{value:201},LIVE_STREAM_WINDOWS_MEDIA:{value:202},LIVE_STREAM_REAL_MEDIA:{value:203},LIVE_STREAM_QUICK_TIME:{value:204}}),y(k,"EntryStatus",{ERROR_IMPORTING:-2,ERROR_CONVERTING:-1,SCAN_FAILURE:"virusScan.ScanFailure",IMPORT:0,INFECTED:"virusScan.Infected",PRECONVERT:1,READY:2,DELETED:3,PENDING:4,MODERATE:5,BLOCKED:6,NO_CONTENT:7}),y(k,"EntryModerationStatus",{PENDING_MODERATION:1,APPROVED:2,REJECTED:3,FLAGGED_FOR_REVIEW:4,MODERATE:5,AUTO_APPROVED:6});var C=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(t){var e;return a(this,i),(e=n.call(this,t)).hasError||(e.totalCount=t.totalCount,e.totalCount>0&&(e.entries=[],t.objects.map((function(t){return e.entries.push(new k(t))})))),e}return c(i)}(w),O=c((function t(e){a(this,t),this.type=e.type}));y(O,"Type",{DRM_POLICY:"drm.DRM_POLICY",BLOCK:1,PREVIEW:2,LIMIT_FLAVORS:3,ADD_TO_STORAGE:4,LIMIT_DELIVERY_PROFILES:5,SERVE_FROM_REMOTE_SERVER:6,REQUEST_HOST_REGEX:7,LIMIT_THUMBNAIL_CAPTURE:8,SCHEDULED_RESTRICTED:"SCHEDULED_RESTRICTED"});var S=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(t){var e;return a(this,i),(e=n.call(this,t)).pattern=t.pattern,e.replacement=t.replacement,e.replacmenServerNodeId=t.replacmenServerNodeId,e.checkAliveTimeoutMs=t.checkAliveTimeoutMs,e}return c(i)}(O),P=c((function t(e){a(this,t),this.scheme=e.scheme,this.licenseURL=e.licenseURL,this.certificate=e.certificate}));y(P,"Scheme",{"drm.PLAYREADY_CENC":"com.microsoft.playready","drm.WIDEVINE_CENC":"com.widevine.alpha","fairplay.FAIRPLAY":"com.apple.fairplay",WIDEVINE_CENC:"com.widevine.alpha",PLAYREADY_CENC:"com.microsoft.playready",FAIRPLAY:"com.apple.fairplay"});var L=function(){function t(e){var r=this;a(this,t),y(this,"drm",[]),this.format=e.format,this.deliveryProfileId=e.deliveryProfileId,this.url=e.url,this.protocols=e.protocols,this.flavorIds=e.flavorIds,e.drm&&e.drm.map((function(t){return r.drm.push(new P(t))}))}return c(t,[{key:"hasDrmData",value:function(){return this.drm&&this.drm.length>0}},{key:"hasFlavorIds",value:function(){return!!this.flavorIds&&this.flavorIds.length>0}},{key:"getProtocol",value:function(t){var e="";if(this.protocols&&this.protocols.length>0)this.protocols.split(",").forEach((function(r){r===t&&(e=r)}));else if("http"===t)return t;return e}}]),t}(),D=c((function t(e){a(this,t),this.entryId=e.entryId,this.clickThroughUrl=e.url,this.sources=e.sources?e.sources.map((function(t){return new L(t)})):[]})),x=function(){function t(e){a(this,t),this.id=e.id,this.flavorParamsId=e.flavorParamsId,this.fileExt=e.fileExt,this.bitrate=e.bitrate,this.width=e.width,this.height=e.height,this.id=e.id,this.frameRate=e.frameRate,this.isOriginal=e.isOriginal,this.isWeb=e.isWeb,this.containerFormat=e.containerFormat,this.videoCodecId=e.videoCodecId,this.status=e.status,this.language=e.language,this.label=e.label,this.tags=t.parseTags(e.tags)}return c(t,null,[{key:"parseTags",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(",")}}]),t}();y(x,"Status",{ERROR:-1,QUEUED:0,CONVERTING:1,READY:2,DELETED:3,NOT_APPLICABLE:4,TEMP:5,WAIT_FOR_CONVERT:6,IMPORTING:7,VALIDATING:8,EXPORTING:9});var M=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(t){var e;return a(this,i),(e=n.call(this,t)).hasError||(e.entries=[],t.map((function(t){return e.entries.push(new k(t))}))),e}return c(i)}(w),U=c((function t(e){a(this,t),this.id=e.id,this.metadataProfileId=e.metadataProfileId,this.metadataProfileVersion=e.metadataProfileVersion,this.metadataProfileId=e.metadataProfileId,this.metadataObjectType=e.metadataObjectType,this.objectId=e.objectId,this.version=e.version,this.created=new Date(0),this.created.setUTCSeconds(e.createdAt),this.updated=new Date(0),this.updated.setUTCSeconds(e.updatedAt),this.status=e.status,this.xml=e.xml}));y(U,"ObjectType",{AD_CUE_POINT:"adCuePointMetadata.AdCuePoint",ANNOTATION:"annotationMetadata.Annotation",CODE_CUE_POINT:"codeCuePointMetadata.CodeCuePoint",THUMB_CUE_POINT:"thumbCuePointMetadata.thumbCuePoint",ENTRY:1,CATEGORY:2,USER:3,PARTNER:4,DYNAMIC_OBJECT:5}),y(U,"Status",{VALID:1,INVALID:2,DELETED:3});var N=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(t){var e;return a(this,i),(e=n.call(this,t)).hasError||(e.totalCount=t.totalCount,e.totalCount>0&&(e.metas=[],t.objects.map((function(t){return e.metas.push(new U(t))})))),e}return c(i)}(w),j=c((function t(e){a(this,t),this.message=e.message,this.code=e.code}));var V=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(t){var e;if(a(this,i),y(l(e=n.call(this,t)),"sources",[]),y(l(e),"actions",[]),y(l(e),"messages",[]),y(l(e),"flavorAssets",[]),y(l(e),"bumperData",[]),!e.hasError){var r=t.messages;r&&r.map((function(t){return e.messages.push(new j(t))}));var s=t.actions;s&&s.map((function(t){t.type===O.Type.REQUEST_HOST_REGEX?e.actions.push(new S(t)):e.actions.push(new O(t))}));var o=t.sources;o&&o.map((function(t){return e.sources.push(new L(t))}));var u=t.flavorAssets;u&&u.map((function(t){return e.flavorAssets.push(new x(t))}));var c=t.bumperData;c&&c.map((function(t){return e.bumperData.push(new D(t))})),t.activeLiveStreamTime&&(e.activeLiveStreamTime={startTime:t.activeLiveStreamTime.startTime,endTime:t.activeLiveStreamTime.endTime})}return e}return c(i,[{key:"hasBlockAction",value:function(){return void 0!==this.getBlockAction()}},{key:"getBlockAction",value:function(){return this.actions.find((function(t){return t.type===O.Type.BLOCK}))}},{key:"hasScheduledRestriction",value:function(){return this.messages.some((function(t){return t.code===O.Type.SCHEDULED_RESTRICTED}))}},{key:"getErrorMessages",value:function(){return this.messages}},{key:"getRequestHostRegexAction",value:function(){var t=this.actions.find((function(t){return t.type===O.Type.REQUEST_HOST_REGEX}));if(t instanceof S)return t}}]),i}(w),B=c((function t(e){a(this,t),this.id=e.id,this.name=e.name,this.description=e.description,this.poster=e.thumbnailUrl}));var q=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(t){var e;return a(this,i),(e=n.call(this,t)).hasError||(e.name=t.name,e.description=t.description,e.objTypeAsString=t.objTypeAsString,e.width=t.width,e.height=t.height,e.htmlParams=t.htmlParams,e.swfUrl=t.swfUrl,e.confFilePath=t.confFilePath,e.confFile=t.confFile,e.confFileFeatures=t.confFileFeatures,e.config=t.config,e.confVars=t.confVars,e.useCdn=t.useCdn,e.tags=t.tags,e.swfUrlVersion=t.swfUrlVersion,e.created=new Date(0),e.created.setUTCSeconds(t.createdAt),e.updated=new Date(0),e.updated.setUTCSeconds(t.updatedAt),e.html5Url=t.description,e.version=t.description,e.partnerTags=t.description,e.objType=t.description,e.creationMode=t.description),e}return c(i)}(w);y(q,"Type",{PLAYER:1,CONTRIBUTION_WIZARD:2,SIMPLE_EDITOR:3,ADVANCED_EDITOR:4,PLAYLIST:5,APP_STUDIO:6,KRECORD:7,PLAYER_V3:8,KMC_ACCOUNT:9,KMC_ANALYTICS:10,KMC_CONTENT:11,KMC_DASHBOARD:12,KMC_LOGIN:13,PLAYER_SL:14,CLIENTSIDE_ENCODER:15,KMC_GENERAL:16,KMC_ROLES_AND_PERMISSIONS:17,CLIPPER:18,KSR:19,KUPLOAD:20,WEBCASTING:21}),y(q,"CreationMode",{WIZARD:2,ADVANCED:3});var F=c((function t(e){a(this,t),this.playlistLastEntryId=e.playlistLastEntryId,this.entryId=e.entryId,this.id=e.id,this.userId=e.userId,this.partnerId=e.partnerId,this.status=e.status,this.createdAt=e.createdAt,this.updatedAt=e.updatedAt}));var H=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(t){var e;return a(this,i),(e=n.call(this,t)).hasError||(e.totalCount=t.totalCount,e.entries=[],e.totalCount>0&&t.objects.map((function(t){return e.entries.push(new F(t))}))),e}return c(i)}(w),K=function(){function t(){a(this,t)}return c(t,null,[{key:"build",value:function(t){var e=b.get(),r=e.serviceUrl.substr(0,e.serviceUrl.lastIndexOf("/")),n=t.partnerId,i=t.entryId,a=t.ks,s=t.uiConfId,o=t.format,u=t.protocol,c=t.extension,l=t.flavorIds;if(!r||isNaN(Number.parseInt(n))||!i||!o||!u)return"";var f=r;return r.endsWith("/")||(f+="/"),f+="p/"+n+"/sp/"+n+"00/playManifest/entryId/"+i+"/protocol/"+u+"/format/"+o,l?f+="/flavorIds/"+l:s&&(f+="/uiConfId/"+s),""!==a&&(f+="/ks/"+a),""!==c&&(f+="/a."+c),s&&""!==l&&(f+="?uiConfId="+s),f}}]),t}(),G=function(){function t(){a(this,t)}return c(t,null,[{key:"xmlToJson",value:function(t){var e={};if(1===t.nodeType){if(t.attributes.length>0){e["@attributes"]={};for(var r=0;r<t.attributes.length;r++){var n=t.attributes.item(r);e["@attributes"][n.nodeName]=n.nodeValue}}}else 3===t.nodeType&&(e=t.nodeValue);if(t.hasChildNodes())for(var i=0;i<t.childNodes.length;i++){var a=t.childNodes.item(i),s=a.nodeName;if(void 0===e[s])e[s]=this.xmlToJson(a);else{if(void 0===e[s].push){var o=e[s];e[s]=[],e[s].push(o)}e[s].push(this.xmlToJson(a))}}return e}}]),t}(),W={DASH:{name:"dash",mimeType:"application/dash+xml",pathExt:"mpd"},HLS:{name:"hls",mimeType:"application/x-mpegURL",pathExt:"m3u8"},WVM:{name:"wvm",mimeType:"video/wvm",pathExt:"wvm"},MP4:{name:"mp4",mimeType:"video/mp4",pathExt:"mp4"},MP3:{name:"mp3",mimeType:"audio/mpeg",pathExt:"mp3"}},Y=new Map([["mpegdash",W.DASH],["applehttp",W.HLS],["url",W.MP4]]);function J(t){var e=Y.get(t);return!!e&&e.name===W.MP4.name}var X=function(){function t(){a(this,t),this.progressive=[],this.dash=[],this.hls=[],this.image=[],this.document=[]}return c(t,[{key:"map",value:function(t,e){if(e)switch(e.name){case W.MP4.name:this.progressive.push(t);break;case W.DASH.name:this.dash.push(t);break;case W.HLS.name:this.hls.push(t)}}},{key:"toJSON",value:function(){var t={progressive:[],dash:[],hls:[],image:[],document:[]};return this.progressive.forEach((function(e){return t.progressive.push(e.toJSON())})),this.hls.forEach((function(e){return t.hls.push(e.toJSON())})),this.dash.forEach((function(e){return t.dash.push(e.toJSON())})),t.image=this.image,t.document=this.document,t}}]),t}(),Q=function(){function t(){a(this,t),this.metadata=new Map,this.sources=new X,this.type=t.Type.UNKNOWN}return c(t,[{key:"toJSON",value:function(){return{id:this.id,name:this.name,sources:this.sources.toJSON(),duration:this.duration,dvrStatus:this.dvrStatus,status:this.status,metadata:this.metadata,type:this.type,poster:this.poster,assetReferenceType:this.assetReferenceType,downloadUrl:this.downloadUrl,rawThumbnailUrl:this.rawThumbnailUrl,rootEntryId:this.rootEntryId,capabilities:this.capabilities}}}]),t}();y(Q,"Type",{VOD:"Vod",LIVE:"Live",IMAGE:"Image",AUDIO:"Audio",UNKNOWN:"Unknown",DOCUMENT:"Document"}),y(Q,"DvrStatus",{ON:1,OFF:0});var z=function(){function t(e,r,n){a(this,t),this.licenseUrl=e,this.scheme=r,n&&(this.certificate=n)}return c(t,[{key:"toJSON",value:function(){var t={licenseUrl:this.licenseUrl,scheme:this.scheme};return this.certificate&&(t.certificate=this.certificate),t}}]),t}(),Z=function(){function t(){a(this,t)}return c(t,[{key:"toJSON",value:function(){var t={id:this.id,url:this.url,mimetype:this.mimetype};return this.bandwidth&&(t.bandwidth=this.bandwidth),this.width&&(t.width=this.width),this.height&&(t.height=this.height),this.label&&(t.label=this.label),this.drmData&&this.drmData.length>0&&(t.drmData=[],this.drmData.forEach((function(e){Array.isArray(t.drmData)&&t.drmData.push(e.toJSON())}))),t}}]),t}(),$=c((function t(){a(this,t),this.items=[]})),tt=c((function t(){a(this,t),this.items=[]})),et=c((function t(e){a(this,t),this.url=e.url,this.clickThroughUrl=e.clickThroughUrl})),rt={SRT:"1",DFXP:"2",WEBVTT:"3",CAP:"4"},nt={3:"vtt",1:"srt"},it=function(){function t(){a(this,t)}return c(t,null,[{key:"createConfig",value:function(t,e){return t.map((function(t){var r=t.url,n=nt[t.format];return[rt.DFXP,rt.CAP].includes(t.format)&&(r=t.webVttUrl,n=nt[rt.WEBVTT]),r=ut(r,e),{default:!!t.isDefault,type:n,language:t.languageCode,label:t.label,url:r}}))}}]),t}(),at=function(){function t(e){a(this,t),this.id=e.id,this.url=t.extractBaseThumbnailUrl(e.dataUrl),this.mimetype=""}return c(t,null,[{key:"extractBaseThumbnailUrl",value:function(t){return t.match(".+entry_id/[a-zA-Z0-9_]+/")[0].slice(0,-1)}}]),t}(),st=c((function t(e){a(this,t),this.id=e.id,this.url=e.downloadUrl,this.thumbnailUrl=e.poster,this.mimetype=""})),ot=function(){function t(){a(this,t)}return c(t,null,[{key:"getMediaEntry",value:function(e,r,n,i){var a=new Q,s=i.entry,o=i.playBackContextResult,u=i.metadataListResult,c=o.sources;return a.activeLiveStreamTime=o.activeLiveStreamTime,a.sources=t._getParsedSources(c,e,r,n,s,o),t._fillBaseData(a,s,u,o),a.type!==Q.Type.LIVE&&b.get().useApiCaptions&&o.data.playbackCaptions&&(a.sources.captions=it.createConfig(o.data.playbackCaptions,e)),a}},{key:"addKsToUrl",value:function(t,e){var r;return e?(r=-1!==t.split("?")[0].replace(/^.*[\\/]/,"").indexOf(".")?-1===t.indexOf("?")?"?ks=":"&ks=":"/ks/",t+r+e):t}},{key:"getPlaylist",value:function(e){var r=new $,n=e.playlistData,i=e.playlistItems.entries,a=e.playlistUserEntries.entries;return r.id=n.id,r.name=n.name,r.description=n.description,r.poster=n.poster,r.playlistLastEntryId=a.map((function(t){return t.playlistLastEntryId}))[0],i.forEach((function(e){var n=new Q;t._fillBaseData(n,e),r.items.push(n)})),r}},{key:"getEntryList",value:function(e){var r=new tt;return e.playlistItems.entries.forEach((function(e){var n=new Q;t._fillBaseData(n,e),r.items.push(n)})),r}},{key:"getBumper",value:function(e,r,n){var i=e.playBackContextResult,a=i.bumperData[0];if(a){var s=(a&&a.sources).find((function(t){return J(t.format)}));if(s){var o=t._parseProgressiveSources(s,i,r,n,0,a.entryId);if(o[0])return new et({url:o[0].url,clickThroughUrl:a.clickThroughUrl})}}}},{key:"_fillBaseData",value:function(e,r,n,i){if(e.poster=r.poster,e.rawThumbnailUrl=r.rawThumbnailUrl,e.id=r.id,e.duration=r.duration,e.downloadUrl=r.downloadUrl||"",e.metadata=t._parseMetadata(n),e.metadata.description=r.description||"",e.metadata.entryId=r.id||"",e.metadata.name=r.name||"",r.createdAt&&(e.metadata.createdAt=r.createdAt),r.updatedAt&&(e.metadata.updatedAt=r.updatedAt),r.creatorId&&(e.metadata.creatorId=r.creatorId),r.userId&&(e.metadata.userId=r.userId),r.endDate&&(e.metadata.endDate=r.endDate),r.views&&(e.metadata.views=r.views),r.plays&&(e.metadata.plays=r.plays),e.metadata.tags=r.tags||"",e.metadata.adminTags=r.adminTags||"",e.status=r.status,e.rootEntryId=r.rootEntryId,e.capabilities=r.capabilities?r.capabilities.split(","):[],e.type=t._getEntryType(r.entryType,r.type),e.type===Q.Type.LIVE&&(e.dvrStatus=r.dvrStatus),i&&i.flavorAssets[0]&&i.flavorAssets[0].width&&i.flavorAssets[0].height){var a=i.flavorAssets[0],s=a.height,o=a.width;e.metadata.aspectRatio=+Number(o/s).toFixed(2)}return i&&Array.isArray(i.flavorAssets)&&(e.metadata.audioFlavors=i.flavorAssets.filter((function(t){return t.bitrate&&!t.width&&!t.height}))),e}},{key:"_getEntryType",value:function(t,e){var r=Q.Type.UNKNOWN;switch(t){case k.MediaType.IMAGE.value:r=Q.Type.IMAGE;break;case k.MediaType.AUDIO.value:r=Q.Type.AUDIO;break;default:switch(e){case k.EntryType.MEDIA_CLIP.value:r=Q.Type.VOD;break;case k.EntryType.LIVE_STREAM.value:case k.EntryType.LIVE_CHANNEL.value:r=Q.Type.LIVE;break;case k.EntryType.DOCUMENT.value:r=Q.Type.DOCUMENT;break;default:r=Q.Type.UNKNOWN}}return r}},{key:"_getParsedSources",value:function(e,r,n,i,a,s){var o,u,c=new X;return a.type===k.EntryType.EXTERNAL_MEDIA.value?((u=new Z).mimetype="video/youtube",u.url=a.referenceId,u.id=a.id+"_youtube",c.progressive.push(u)):a.entryType===k.MediaType.IMAGE.value?c.image.push(new at(a)):a.type===k.EntryType.DOCUMENT.value?c.document.push(new st(a)):e&&e.length>0&&(e.filter((function(t){return!J(t.format)})).forEach((function(e){var o=t._parseAdaptiveSource(e,s,r,n,i,a.id);if(o){var u=Y.get(e.format);c.map(o,u)}})),o=e.find((function(e){return J(e.format)&&""!==e.getProtocol(t._getBaseProtocol())})),c.progressive=t._parseProgressiveSources(o,s,r,n,i,a.id)),c}},{key:"_parseAdaptiveSource",value:function(e,r,n,i,a,s){var o=new Z;if(e){var u="",c=Y.get(e.format),l=e.getProtocol(t._getBaseProtocol()),f=e.deliveryProfileId,d=e.format,h="";if(c&&(h=c.pathExt,o.mimetype=c.mimeType),e.hasFlavorIds()?(!h&&r.flavorAssets&&r.flavorAssets.length>0&&(h=r.flavorAssets[0].fileExt),u=K.build({entryId:s,flavorIds:e.flavorIds,format:d,ks:n,partnerId:i,uiConfId:a,extension:h,protocol:l})):u=t.addKsToUrl(e.url,n),!u){var p="failed to create play url from source, discarding source: (".concat(s,"_").concat(f,"), ").concat(d);return t._logger.warn(p),null}if(o.url=u,o.id=s+"_"+f+","+d,e.hasDrmData()){var y=[];e.drm.forEach((function(t){y.push(new z(t.licenseURL,P.Scheme[t.scheme],t.certificate))})),o.drmData=y}}return o}},{key:"_parseProgressiveSources",value:function(e,r,n,i,a,s){var o=[],u=[];if(e){var c=e.getProtocol(t._getBaseProtocol()),l=e.format,f=e.deliveryProfileId,d=f+","+l;r.flavorAssets.map((function(e){var r=new Z;r.id=e.id+d,r.mimetype="mp3"===e.fileExt?"audio/mp3":"video/mp4",r.height=e.height,r.width=e.width,r.bandwidth=1024*e.bitrate,r.label=e.label||e.language;var h=K.build({entryId:s,flavorIds:e.id,format:l,ks:n,partnerId:i,uiConfId:a,extension:e.fileExt,protocol:c});if(""===h)return t._logger.warn("failed to create play url from source, discarding source: (".concat(s,"_").concat(f,"), ").concat(l,".")),null;r.url=h,e.height&&e.width?o.push(r):u.push(r)}))}return u.length&&!o.length?u:o}},{key:"_parseMetadata",value:function(t){var e={};return t&&t.metas&&t.metas.length>0&&t.metas.forEach((function(t){if(t.xml){var r=new DOMParser;t.xml=t.xml.replace(/\r?\n|\r/g,""),t.xml=t.xml.replace(/>\s*/g,">"),t.xml=t.xml.replace(/>\s*/g,">");var n=r.parseFromString(t.xml,"text/xml"),i=G.xmlToJson(n);Object.keys(i.metadata).forEach((function(t){e[t]=i.metadata[t]["#text"]}))}})),e}},{key:"_getBaseProtocol",value:function(){var t=b.get(),e=/^https?:/.exec(t.cdnUrl),r=e?e[0]:document.location.protocol;return"string"==typeof r?r.slice(0,-1):"https"}},{key:"hasBlockAction",value:function(t){return t.playBackContextResult.hasBlockAction()}},{key:"getBlockAction",value:function(t){return t.playBackContextResult.getBlockAction()}},{key:"hasScheduledRestriction",value:function(t){return t.playBackContextResult.hasScheduledRestriction()}},{key:"getErrorMessages",value:function(t){return t.playBackContextResult.getErrorMessages()}}]),t}();y(ot,"_logger",R("OVPProviderParser"));var ut=ot.addKsToUrl,ct=ot,lt=c((function t(e,r,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};a(this,t),this.severity=e,this.category=r,this.code=n,this.data=i,t._logger.error("Category:".concat(r," | Code:").concat(n," |"),i)}));y(lt,"Severity",{RECOVERABLE:1,CRITICAL:2}),y(lt,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),y(lt,"Code",{UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,BAD_SERVER_RESPONSE:1005,MULTIREQUEST_API_ERROR:1006,API_RESPONSE_MISMATCH:1007,ERROR:2e3,BLOCK_ACTION:2001,MEDIA_STATUS_NOT_READY:2002,SCHEDULED_RESTRICTED:2003,DELETED_ENTRY:2004,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),y(lt,"_logger",R("Error"));var ft=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;a(this,t),y(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),y(this,"_attemptCounter",1),this.headers=e}return c(t,[{key:"getUrl",value:function(t){return t+"/service/"+this.service+(this.action?"/action/"+this.action:"")}},{key:"doHttpRequest",value:function(){var t=this,e=new Promise((function(e,r){t._requestPromise={resolve:e,reject:r}}));return this.url||this._requestPromise.reject(new lt(lt.Severity.CRITICAL,lt.Category.NETWORK,lt.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),e}},{key:"_createXHR",value:function(){var t=this,e=new XMLHttpRequest;e.onreadystatechange=function(){if(4===e.readyState&&200===e.status)try{var r=JSON.parse(e.responseText);return t.responseHeaders=t._getResponseHeaders(e),t._requestPromise.resolve(r)}catch(r){t._requestPromise.reject(t._createError(e,lt.Code.BAD_SERVER_RESPONSE,{text:e.responseText}))}},e.open(this.method,this.url,this.retryConfig.async),this.retryConfig.async&&this.retryConfig.timeout&&(e.timeout=this.retryConfig.timeout);var r=performance.now();e.ontimeout=function(){t._handleError(e,lt.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:e.statusText})},e.onerror=e.onabort=function(){t._handleError(e,lt.Code.HTTP_ERROR,{text:e.responseText,statusText:e.statusText})},this.headers.forEach((function(t,r){e.setRequestHeader(r,t)})),e.send(this.params)}},{key:"_getResponseHeaders",value:function(t){return t.getAllResponseHeaders().split("\n").filter((function(t){return 0===t.toLowerCase().indexOf("x-")}))}},{key:"_handleError",value:function(t,e,r){var n=this._createError(t,e,r);if(t.onreadystatechange=function(){},t.onerror=function(){},t.ontimeout=function(){},t.onabort=function(){},!(this.retryConfig.maxAttempts&&this._attemptCounter<this.retryConfig.maxAttempts))return this._requestPromise.reject(n);this._attemptCounter++,this._createXHR()}},{key:"_createError",value:function(t,e,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(t),attempt:this._attemptCounter}),new lt(lt.Severity.CRITICAL,lt.Category.NETWORK,e,r)}}]),t}();var dt=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(){var t;a(this,i);for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return y(l(t=n.call.apply(n,[this].concat(r))),"requests",[]),t}return c(i,[{key:"add",value:function(t){this.requests.push(t);var e={},r={service:t.service,action:t.action};return Object.assign(e,y({},this.requests.length,Object.assign(r,t.params))),Object.assign(e,this.params),this.params=e,this}},{key:"execute",value:function(t,e){var r=this;return new Promise((function(n,a){try{r.params=JSON.stringify(r.params)}catch(t){i._logger.error("".concat(t.message)),a(new lt(lt.Severity.CRITICAL,lt.Category.PROVIDER,lt.Code.FAILED_PARSING_REQUEST,{error:t,params:r.params}))}r.doHttpRequest().then((function(i){var s=new ht(i,t,e);s.success?n({headers:r.responseHeaders,response:s}):a(new lt(lt.Severity.CRITICAL,lt.Category.NETWORK,lt.Code.MULTIREQUEST_API_ERROR,{url:r.url,headers:r.responseHeaders,results:s.results}))}),(function(t){a(t)}))}))}}]),i}(ft);y(dt,"_logger",R("MultiRequestBuilder"));var ht=c((function t(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];a(this,t),y(this,"results",[]);var i=e.result?e.result:e,s=(Array.isArray(i)?i:[i]).map((function(t){return new w(t)})),o=s.filter((function(t){return t.hasError}));o.forEach((function(e){t._logger.error("Service returned an error with error code: ".concat(e.error.code," and message: ").concat(e.error.message,"."))})),this.results=s,r&&o.length||o.length===this.results.length?this.success=!1:(n&&(this.results=this.results.filter((function(t){return!t.hasError}))),this.success=!0)}));y(ht,"_logger",R("MultiRequestResult"));var pt=function(){function t(){a(this,t)}return c(t,null,[{key:"getMultiRequest",value:function(t,e,r){var n=b.get(),i=n.serviceParams;Object.assign(i,{ks:e,clientTag:"html5:v"+t}),r&&Object.assign(i,{partnerId:r});var a=new Map;a.set("Content-Type","application/json");var s=new dt(a);return s.method="POST",s.service="multirequest",s.url=s.getUrl(n.serviceUrl),s.params=i,s}}]),t}(),yt=c((function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,t),this.type=e.type||t.Type.INCLUDE_FIELDS,this.fields=e.fields||"id,referenceId,name,description,thumbnailUrl,dataUrl,duration,msDuration,flavorParamsIds,mediaType,type,tags,dvrStatus,externalSourceType,status,createdAt,updatedAt,endDate,plays,views,downloadUrl,creatorId,userId,rootEntryId,capabilities,adminTags"}));y(yt,"Type",{INCLUDE_FIELDS:1,EXCLUDE_FIELDS:2});var vt="baseEntry",mt=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(){return a(this,i),n.apply(this,arguments)}return c(i,null,[{key:"getPlaybackContext",value:function(t,e,r,n){var i=new Map;i.set("Content-Type","application/json");var a=new ft(i);a.service=vt,a.action="getPlaybackContext",a.method="POST",a.url=a.getUrl(t),a.tag="baseEntry-getPlaybackContext";var s={objectType:"KalturaContextDataParams",flavorTags:"all"};return n&&(s.referrer=n),a.params={entryId:r,ks:e,contextDataParams:s},a}},{key:"list",value:function(t,e,r,n,a){var s=new Map;s.set("Content-Type","application/json");var o=new ft(s);return o.service=vt,o.action="list",o.method="POST",o.url=o.getUrl(t),o.tag="list",o.params=i.getEntryListReqParams(r,e,n,a),o}},{key:"getEntryListReqParams",value:function(t,e,r,n){var i={};return t?i=r?{redirectFromEntryId:t}:{idEqual:t}:n&&(i={objectType:"KalturaBaseEntryFilter",referenceIdEqual:n}),{ks:e,filter:i,responseProfile:new yt}}}]),i}(pt);var gt=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(){return a(this,i),n.apply(this,arguments)}return c(i,null,[{key:"list",value:function(t,e,r){var n=new Map;n.set("Content-Type","application/json");var i=new ft(n);i.service="metadata_metadata",i.action="list",i.method="POST",i.url=i.getUrl(t),i.tag="metadata_metadata-list";var a={objectType:"KalturaMetadataFilter",objectIdEqual:r,metadataObjectTypeEqual:"1"};return i.params={filter:a,ks:e},i}}]),i}(pt),Et=function(){function t(e){a(this,t),y(this,"_response",{}),this.requests=this.buildRequests(e),this._entryId=e.entryId,this._referenceId=e.referenceId}return c(t,[{key:"requests",get:function(){return this._requests},set:function(t){this._requests=t}},{key:"response",get:function(){return this._response},set:function(t){var e=new C(t[0].data);this._response.entry=e.entries[0],this._response.playBackContextResult=new V(t[1].data),this._response.metadataListResult=new N(t[2].data)}},{key:"buildRequests",value:function(t){var e=b.get(),r=[];r.push(mt.list(e.serviceUrl,t.ks,t.entryId,t.redirectFromEntryId,t.referenceId));var n="{1:result:ks}"===t.ks?"{2:result:objects:0:id}":"{1:result:objects:0:id}";return r.push(mt.getPlaybackContext(e.serviceUrl,t.ks,n,t.referrer)),r.push(gt.list(e.serviceUrl,t.ks,n)),r}},{key:"isValid",value:function(){return!(!this._entryId&&!this._referenceId)}}],[{key:"id",get:function(){return"media"}}]),t}();var _t=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(){return a(this,i),n.apply(this,arguments)}return c(i,null,[{key:"anonymousSession",value:function(t,e){var r=new Map;r.set("Content-Type","application/json");var n=new ft(r);return n.service="session",n.action="startWidgetSession",n.method="POST",n.url=n.getUrl(t),n.tag="session-startWidget",n.params={widgetId:e},n}}]),i}(pt),Rt=function(){function t(e){a(this,t),y(this,"_response",{}),this.requests=this.buildRequests(e),this._widgetId=e.widgetId}return c(t,[{key:"requests",get:function(){return this._requests},set:function(t){this._requests=t}},{key:"response",get:function(){return this._response.ks},set:function(t){this._response.ks=t[0].data.ks}},{key:"buildRequests",value:function(t){var e=b.get(),r=[];return r.push(_t.anonymousSession(e.serviceUrl,t.widgetId)),r}},{key:"isValid",value:function(){return!!this._widgetId}}],[{key:"id",get:function(){return"session"}}]),t}();function It(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Tt(t){return function(t){if(Array.isArray(t))return It(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){if("string"==typeof t)return It(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?It(t,e):void 0}}(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.")}()}var bt={serviceParams:{apiVersion:"7.8.1"}},wt=function(){function t(){a(this,t)}return c(t,null,[{key:"set",value:function(t){t&&Object.assign(bt,t)}},{key:"get",value:function(){return I(bt)}}]),t}();function At(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return kt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?kt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){o=!0,a=t},f:function(){try{s||null==r.return||r.return()}finally{if(o)throw a}}}}function kt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Ct(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Ot(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Ct(Object(r),!0).forEach((function(e){y(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ct(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var St=function(){function t(){var e;a(this,t),y(this,"_logger",R("RequestSequenceBuilder")),y(this,"loaders",new Map),y(this,"_globalParams",{apiVersion:null===(e=wt.get().serviceParams)||void 0===e?void 0:e.apiVersion})}var e,r,n;return c(t,[{key:"add",value:function(t){var e;this.loaders.set(null===(e=t.requests)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.service,t)}},{key:"_executeRequest",value:(n=i(m().mark((function t(e){var r,n,i,a,s;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.params=JSON.stringify(Ot(Ot({},this._globalParams),e.params)),t.prev=1,t.next=4,e.doHttpRequest();case 4:return r=t.sent,(n=new w(r.result||r)).hasError&&(i=n.error,a=i.code,s=i.message,this._logger.error("Service returned an error with error code: ".concat(a," and message: ").concat(s,"."))),t.abrupt("return",n);case 10:throw t.prev=10,t.t0=t.catch(1),new lt(lt.Severity.CRITICAL,lt.Category.NETWORK,lt.Code.API_RESPONSE_MISMATCH,{error:t.t0,request:e});case 13:case"end":return t.stop()}}),t,this,[[1,10]])}))),function(t){return n.apply(this,arguments)})},{key:"_executeSequence",value:(r=i(m().mark((function t(e){var r,n,i,a,s,o,u,c,l,f;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=[],n=At(e),t.prev=2,n.s();case 4:if((i=n.n()).done){t.next=18;break}return a=i.value,t.prev=6,t.next=9,this._executeRequest(a);case 9:s=t.sent,r.push(s),t.next=16;break;case 13:t.prev=13,t.t0=t.catch(6),this._logger.error("Request execution failed: ".concat(t.t0.message));case 16:t.next=4;break;case 18:t.next=23;break;case 20:t.prev=20,t.t1=t.catch(2),n.e(t.t1);case 23:return t.prev=23,n.f(),t.finish(23);case 26:if(!(o=new Pt(r)).success){t.next=31;break}return t.abrupt("return",o);case 31:if(!(u=r.find((function(t){return t.hasError})))){t.next=35;break}throw c=u.error,l=c.message,f=c.code,new lt(lt.Severity.CRITICAL,lt.Category.NETWORK,lt.Code.API_RESPONSE_MISMATCH,{error:u.error,errorMessage:"Request returned an error: ".concat(l," (code: ").concat(f,")")});case 35:return t.abrupt("return",o);case 36:case"end":return t.stop()}}),t,this,[[2,20,23,26],[6,13]])}))),function(t){return r.apply(this,arguments)})},{key:"execute",value:(e=i(m().mark((function t(){var e,r,n,i,a;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=this.loaders.get("ottuser"),r=this.loaders.get("asset"),n="",t.prev=3,!e){t.next=10;break}return t.next=7,this._executeRequest(e.requests[0]);case 7:i=t.sent,e.response=[{data:i.data}],n=i.data.ks||"";case 10:if(!r){t.next=16;break}return r.requests.forEach((function(t){"{1:result:ks}"===t.params.ks&&(t.params.ks=n)})),t.next=14,this._executeSequence(r.requests);case 14:a=t.sent,r.response=a.results;case 16:t.next=21;break;case 18:t.prev=18,t.t0=t.catch(3),this._logger.error("loaders execution failed: ".concat(t.t0.message));case 21:return t.abrupt("return",this.loaders);case 22:case"end":return t.stop()}}),t,this,[[3,18]])}))),function(){return e.apply(this,arguments)})}]),t}(),Pt=c((function t(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];a(this,t),this.results=Tt(e);var n,i=this.results.filter((function(t){return t.hasError})),s=At(i);try{for(s.s();!(n=s.n()).done;){var o=n.value.error,u=o.code,c=o.message;t._logger.error("Service returned an error with error code: ".concat(u," and message: ").concat(c,"."))}}catch(t){s.e(t)}finally{s.f()}var l=i.length===this.results.length,f=r&&i.length>0;l||f?this.success=!1:(r||(this.results=this.results.filter((function(t){return!t.hasError}))),this.success=!0)}));y(Pt,"_logger",R("SingleRequestsResult"));var Lt=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(t,e){var r,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3?arguments[3]:void 0;return a(this,i),(r=n.call(this,o))._multiRequest=pt.getMultiRequest(t,s,e),r}return c(i)}(function(){function t(e){a(this,t),y(this,"_loadersResponseMap",new Map),y(this,"_loaders",new Map),this._networkRetryConfig=e,this._singleRequests=new St}return c(t,[{key:"add",value:function(t,e,r){var n=this,i=new t(e);if(i.isValid())if(this._loaders.set(t.id,i),i.disableMultirequest)this._singleRequests.add(i);else{var a=this._multiRequest.requests.length,s=i.requests;this._multiRequest.retryConfig=this._networkRetryConfig,s.forEach((function(t){t.params=t.params||{},t.params.ks=t.params.ks||r,n._multiRequest.add(t)}));var o=Array.from(new Array(s.length),(function(t,e){return e+a}));this._loadersResponseMap.set(t.id,o)}}},{key:"fetchData",value:function(t,e){var r=this;return new Promise((function(n,i){r._singleRequests.loaders.size>0?r._singleRequests.execute().then((function(){return n(r._loaders)})).catch((function(t){return i(t)})):r._multiRequest.execute(t,e).then((function(t){r._multiResponse=t.response,r.prepareData(t.response).success?n(r._loaders):i(new lt(lt.Severity.CRITICAL,lt.Category.NETWORK,lt.Code.API_RESPONSE_MISMATCH,{headers:t.headers}))}),(function(t){i(t)}))}))}},{key:"prepareData",value:function(t){var e=this;return this._loaders.forEach((function(r,n){var i=e._loadersResponseMap.get(n);try{i&&i.length>0&&(r.response=t.results.slice(i[0],i[i.length-1]+1))}catch(t){return{success:!1,error:t}}})),{success:!0,data:this._loaders}}}]),t}());var Dt="playlist",xt=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(){return a(this,i),n.apply(this,arguments)}return c(i,null,[{key:"execute",value:function(t,e,r,n){var i=new Map;i.set("Content-Type","application/json");var a=new ft(i);a.service=Dt,a.action="execute",a.method="POST",a.url=a.getUrl(t),a.tag="".concat(Dt,"-execute");var s=new yt;return n&&(s.fields=s.fields+n),a.params={ks:e,id:r,responseProfile:s},a}},{key:"get",value:function(t,e,r){var n=new Map;n.set("Content-Type","application/json");var i=new ft(n);return i.service=Dt,i.action="get",i.method="POST",i.url=i.getUrl(t),i.tag="".concat(Dt,"-get"),i.params={ks:e,id:r,responseProfile:{fields:"id,name,description,thumbnailUrl",type:1}},i}},{key:"getLastEntryId",value:function(t,e,r){var n=new Map;n.set("Content-Type","application/json");var i=new ft(n);return i.service="userEntry",i.action="list",i.method="POST",i.url=i.getUrl(t),i.tag="userEntry-list",i.params={ks:e,filter:{objectType:"KalturaViewHistoryUserEntry",entryIdEqual:r,userIdEqualCurrent:1},responseProfile:{fields:"playlistLastEntryId",type:1}},i}}]),i}(pt),Mt=function(){function t(e){a(this,t),y(this,"_response",{}),this.requests=this.buildRequests(e),this._playlistId=e.playlistId}return c(t,[{key:"requests",get:function(){return this._requests},set:function(t){this._requests=t}},{key:"response",get:function(){return this._response},set:function(t){this._response.playlistData=new B(t[0].data),this._response.playlistItems=new M(t[1].data),this._response.playlistUserEntries=new H(t[2].data)}},{key:"buildRequests",value:function(t){var e=b.get(),r=[];return r.push(xt.get(e.serviceUrl,t.ks,t.playlistId)),r.push(xt.execute(e.serviceUrl,t.ks,t.playlistId,t.cacheToken)),r.push(xt.getLastEntryId(e.serviceUrl,t.ks,t.playlistId)),r}},{key:"isValid",value:function(){return!!this._playlistId}}],[{key:"id",get:function(){return"playlist"}}]),t}(),Ut=function(){function t(e,r){a(this,t),y(this,"_networkRetryConfig",{async:!0,timeout:0,maxAttempts:4}),function(t){t&&"function"==typeof t.getLogger&&(g.get=t.getLogger),t&&t.LogLevel&&(E=t.LogLevel)}(e.logger),this._partnerId=e.partnerId,this._widgetId=e.widgetId,this._uiConfId=e.uiConfId,this._isAnonymous=!e.ks,this._ks=e.ks||"",this._playerVersion=r,this._referrer=e.referrer}return c(t,[{key:"partnerId",get:function(){return this._partnerId}},{key:"widgetId",get:function(){return this._widgetId||this.defaultWidgetId}},{key:"defaultWidgetId",get:function(){return"_"+this._partnerId}},{key:"uiConfId",get:function(){return this._uiConfId}},{key:"ks",get:function(){return this._ks},set:function(t){this._ks=t}},{key:"playerVersion",get:function(){return this._playerVersion}},{key:"isAnonymous",get:function(){return this._isAnonymous}},{key:"getMediaConfig",value:function(t){return Promise.reject(new lt(lt.Severity.CRITICAL,lt.Category.PROVIDER,lt.Code.METHOD_NOT_IMPLEMENTED,{message:"getMediaConfig method must be implement by the derived class"}))}},{key:"getPlaylistConfig",value:function(t){return Promise.reject(new lt(lt.Severity.CRITICAL,lt.Category.PROVIDER,lt.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading playlist by id"}))}},{key:"getEntryListConfig",value:function(t){return Promise.reject(new lt(lt.Severity.CRITICAL,lt.Category.PROVIDER,lt.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading entry list"}))}},{key:"_verifyHasSources",value:function(t){if(0===t.hls.concat(t.dash,t.progressive,t.image,t.document).length)throw new lt(lt.Severity.CRITICAL,lt.Category.SERVICE,lt.Code.MISSING_PLAY_SOURCE,{action:"",messages:"No play source for entry id: ".concat(t.id)})}},{key:"LogLevel",get:function(){return E}},{key:"getLogLevel",value:function(t){return function(t){return _(t).getLevel()}(t)}},{key:"setLogLevel",value:function(t,e){!function(t,e){_(e).setLevel(t)}(t,e)}}]),t}(),Nt=function(){function t(e){a(this,t),y(this,"_response",{playlistItems:{entries:[]}}),this.requests=this.buildRequests(e),this._entries=e.entries}return c(t,[{key:"requests",get:function(){return this._requests},set:function(t){this._requests=t}},{key:"response",get:function(){return this._response},set:function(t){var e,r=this;t.forEach((function(t){e=new C(t.data),r._response.playlistItems.entries.push(e.entries[0])}))}},{key:"buildRequests",value:function(t){var e=b.get(),r=[];return t.entries.forEach((function(n){r.push(mt.list(e.serviceUrl,t.ks,n.entryId||n,t.redirectFromEntryId,n.referenceId))})),r}},{key:"isValid",value:function(){return!(!this._entries||!this._entries.length)}}],[{key:"id",get:function(){return"entry_list"}}]),t}(),jt=function(){function t(){a(this,t)}return c(t,null,[{key:"_applyRegexAction",value:function(t,e){if(t){var r=new RegExp(t.pattern,"i");if(e.match(r))return e.replace(r,t.replacement+"/")}return e}},{key:"_pingECDNAndReplaceHostUrls",value:function(e,r,n){return new Promise((function(i){var a=n+"/api_v3/service/system/action/ping/format/1",s=new XMLHttpRequest;s.open("GET",a),s.timeout=r.checkAliveTimeoutMs,s.onreadystatechange=function(){4===s.readyState&&(200===s.status&&t._replaceHostUrls(e,r),i(e))},s.ontimeout=function(){t._logger.warn("Got timeout while pinging the ECDN url. the ping url: ".concat(a)),i(e)},s.send()}))}},{key:"handleRegexAction",value:function(e,r){return new Promise((function(n){var i=b.get().cdnUrl,a=t._extractRegexActionFromData(r),s=t._getRegExp(a);i&&a&&s&&i.match(s)?a.checkAliveTimeoutMs>0?(t._logger.debug("executing ping request..."),t._pingECDNAndReplaceHostUrls(e,a,i.replace(s,a.replacement)).then(n)):(t._replaceHostUrls(e,a),n(e)):(t._logger.debug("exiting handleRegexAction - not applying regex action."),n(e))}))}},{key:"_replaceHostUrls",value:function(e,r){t._logger.debug("Starting to modify urls...");var n=e.sources,i=n.hls,a=n.dash,s=n.progressive,o=n.image;[].concat(Tt(i),Tt(a),Tt(s),Tt(o)).forEach((function(e){return e.url=t._applyRegexAction(r,e.url)})),b.get().replaceHostOnlyManifestUrls||(t._logger.debug("replaceHostOnlyManifestUrls flag is off - modifying captions and poster URLs"),n.captions&&n.captions.forEach((function(e){return e.url=t._applyRegexAction(r,e.url)})),"string"==typeof n.poster&&(n.poster=t._applyRegexAction(r,n.poster))),t._logger.debug("Finished modifying urls")}},{key:"_extractRegexActionFromData",value:function(t){var e;return null===(e=t.get(Et.id))||void 0===e||null===(e=e.response)||void 0===e?void 0:e.playBackContextResult.getRequestHostRegexAction()}},{key:"_getRegExp",value:function(t){if(t&&t.pattern&&t.replacement)return new RegExp(t.pattern,"i")}}]),t}();y(jt,"_logger",R("RegexActionHandler"));var Vt=jt;var Bt=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(){return a(this,i),n.apply(this,arguments)}return c(i,null,[{key:"get",value:function(t,e){var r=new Map;r.set("Content-Type","application/json");var n=new ft(r);return n.service="user",n.action="get",n.method="POST",n.url=n.getUrl(t),n.tag="user-get",n.params={ks:e,format:1},n}}]),i}(pt),qt=function(){function t(e){a(this,t),this.id=e.id}return c(t,[{key:"isAnonymous",value:function(){return t.INVALID_IDS.includes(this.id)}}]),t}();y(qt,"INVALID_IDS",["0","",null,void 0]);var Ft=function(t){d(o,t);var e,r,n,s=(r=o,n=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}}(),function(){var t,e=p(r);if(n){var i=p(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return h(this,t)});function o(t,e){var r;return a(this,o),y(l(r=s.call(this,t,e)),"_filterOptionsConfig",{redirectFromEntryId:!0}),y(l(r),"_retryAttempts",0),r._logger=R("OVPProvider"),b.set(t.env),r._setFilterOptionsConfig(t.filterOptions),r._vrTag=t.vrTag||"360",r._networkRetryConfig=Object.assign(r._networkRetryConfig,t.networkRetryParameters),r._useHeaderForKs=t.useHeaderForKs||!1,r._isAnonymous=!r._ks||void 0,void 0===r._isAnonymous&&r.initializeUserResponse(b.serviceUrl,r._ks).then((function(){r._logger.info("User response initialized")})).catch((function(t){r._logger.error("Failed to initialize user response",t)})),r}return c(o,[{key:"env",get:function(){return b.get()}},{key:"initializeUserResponse",value:(e=i(m().mark((function t(e,r){var n,i,a;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(n=Bt.get(e,r)).params=JSON.stringify(n.params),t.next=4,n.doHttpRequest();case 4:i=t.sent,a=new qt(i),this._isAnonymous=a.isAnonymous();case 7:case"end":return t.stop()}}),t,this)}))),function(t,r){return e.apply(this,arguments)})},{key:"getMediaConfig",value:function(t){var e=this;return t.ks&&(this.ks=t.ks),this._dataLoader=new Lt(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var i=t.entryId,a=t.referenceId;if(i||a){var s=e.ks;s||(s="{1:result:ks}",e._dataLoader.add(Rt,{widgetId:e.widgetId}));var o=e._getEntryRedirectFilter(t);return e._dataLoader.add(Et,{entryId:i,ks:s,redirectFromEntryId:o,referenceId:a,referrer:e._referrer}),e._dataLoader.fetchData().then((function(t){try{var i=e._parseDataFromResponse(t);Vt.handleRegexAction(i,t).then(r)}catch(t){n(t)}}),(function(t){var e,r,i=null===(e=t.data)||void 0===e||null===(e=e.results)||void 0===e?void 0:e.find((function(t){var e;return"KalturaBaseEntryListResponse"===(null===(e=t.data)||void 0===e?void 0:e.objectType)}));(null==i||null===(r=i.data)||void 0===r||null===(r=r.objects)||void 0===r?void 0:r[0].status)===k.EntryStatus.DELETED&&(t=new lt(lt.Severity.CRITICAL,lt.Category.SERVICE,lt.Code.DELETED_ENTRY)),n(t)}))}n(new lt(lt.Severity.CRITICAL,lt.Category.PROVIDER,lt.Code.MISSING_MANDATORY_PARAMS,{message:"missing entry id"}))}))}},{key:"doRequest",value:function(t,e,r,n){var i=this,a=e||this.ks,s=new Lt(this.playerVersion,this.partnerId,a,this._networkRetryConfig);return new Promise((function(e,o){return a||s.add(Rt,{widgetId:i.widgetId}),t.forEach((function(t){s.add(t.loader,t.params,a||"{1:result:ks}")})),s.fetchData(r,n).then((function(t){try{e(t)}catch(t){o(t)}}),(function(t){o(t)}))}))}},{key:"_getEntryRedirectFilter",value:function(t){return"boolean"==typeof t.redirectFromEntryId?t.redirectFromEntryId:"boolean"!=typeof this._filterOptionsConfig.redirectFromEntryId||this._filterOptionsConfig.redirectFromEntryId}},{key:"_setFilterOptionsConfig",value:function(t){t&&"boolean"==typeof t.redirectFromEntryId&&(this._filterOptionsConfig.redirectFromEntryId=t.redirectFromEntryId)}},{key:"_parseDataFromResponse",value:function(t){this._logger.debug("Data parsing started");var e={session:{isAnonymous:this._isAnonymous,partnerId:this.partnerId},sources:this._getDefaultSourcesObject(),plugins:{}};if(this.uiConfId&&(e.session.uiConfId=this.uiConfId),t){if(t.has(Rt.id)){var r=t.get(Rt.id);r&&r.response&&(e.session.ks=r.response,this.widgetId!==this.defaultWidgetId&&(this.ks=e.session.ks))}else e.session.ks=this.ks;if(t.has(Et.id)){var n=t.get(Et.id);if(n&&n.response){var i=n.response;if(ct.hasBlockAction(i))throw new lt(lt.Severity.CRITICAL,lt.Category.SERVICE,lt.Code.BLOCK_ACTION,{action:ct.getBlockAction(i),messages:ct.getErrorMessages(i)});if(ct.hasScheduledRestriction(i))throw new lt(lt.Severity.CRITICAL,lt.Category.SERVICE,lt.Code.SCHEDULED_RESTRICTED,{messages:ct.getErrorMessages(i)});var a=ct.getMediaEntry(this._useHeaderForKs?"":this.ks,this.partnerId,this.uiConfId,i);Object.assign(e.sources,this._getSourcesObject(a)),this._verifyMediaStatus(a),this._verifyHasSources(e.sources);var s=ct.getBumper(i,this.ks,this.partnerId);s&&Object.assign(e.plugins,{bumper:s})}}}return this._logger.debug("Data parsing finished",e),e}},{key:"_verifyMediaStatus",value:function(t){if([k.EntryStatus.IMPORT,k.EntryStatus.PRECONVERT].includes(t.status))throw new lt(lt.Severity.CRITICAL,lt.Category.SERVICE,lt.Code.MEDIA_STATUS_NOT_READY,{messages:"Status of entry id ".concat(t.id," is ").concat(t.status," and is still being imported or converted"),data:{status:status}})}},{key:"getPlaylistConfig",value:function(t){var e=this;return t.ks&&(this.ks=t.ks),this._dataLoader=new Lt(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var i=t.playlistId;if(i){var a=e.ks;a||(a="{1:result:ks}",e._dataLoader.add(Rt,{widgetId:e.widgetId})),e._dataLoader.add(Mt,{playlistId:i,ks:a}),e._dataLoader.fetchData().then((function(i){try{e._handlePlaylistResponse(i,r,n,t)}catch(t){n(t)}}),(function(t){n(t)}))}else n({success:!1,data:"Missing mandatory parameter"})}))}},{key:"_handlePlaylistResponse",value:function(t,e,r,n){this._logger.debug("Handling playlist response",{attempt:this._retryAttempts+1,maxAttempts:10});var i=this._parsePlaylistDataFromResponse(t);i.items.length>0?this._handlePlaylistSuccess(i,e):this._handlePlaylistRetry(e,r,n)}},{key:"_handlePlaylistSuccess",value:function(t,e){this._logger.debug("Playlist items found",{itemsCount:t.items.length,totalAttempts:this._retryAttempts+1}),this._retryAttempts=0,e(t)}},{key:"_handlePlaylistRetry",value:function(t,e,r){this._retryAttempts>=10?this._handleMaxRetriesReached(e):(this._retryAttempts++,this._schedulePlaylistRetry(t,e,r))}},{key:"_handleMaxRetriesReached",value:function(t){this._logger.error("Max retry attempts reached - rejecting playlist",{maxAttempts:10}),this._retryAttempts=0,t(this._getPlaylistObject())}},{key:"_schedulePlaylistRetry",value:function(t,e,r){var n=this;setTimeout((function(){n._dataLoader=new Lt(n.playerVersion,n.partnerId,n.ks,n._networkRetryConfig);var i=n.ks;i||(i="{1:result:ks}",n._dataLoader.add(Rt,{widgetId:n.widgetId}));var a={playlistId:r.playlistId,ks:i,cacheToken:",".repeat(n._retryAttempts)};n._dataLoader.add(Mt,a),n._dataLoader.fetchData().then((function(i){n._handlePlaylistResponse(i,t,e,r)}),(function(t){e(t)}))}),1e4)}},{key:"_parsePlaylistDataFromResponse",value:function(t){var e=this;this._logger.debug("Data parsing started");var r=this._getPlaylistObject();if(t&&t.has(Mt.id)){var n=t.get(Mt.id);if(n&&n.response){var i=ct.getPlaylist(n.response);r.id=i.id,r.poster=i.poster,r.metadata.name=i.name,r.metadata.description=i.description,r.playlistLastEntryId=i.playlistLastEntryId,i.items.forEach((function(t){return r.items.push({sources:e._getSourcesObject(t)})}))}}return this._logger.debug("Data parsing finished",r),r}},{key:"getEntryListConfig",value:function(t){var e=this;return t.ks&&(this.ks=t.ks),this._dataLoader=new Lt(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var i=t.entries;if(i&&i.length){var a=e.ks;a||(a="{1:result:ks}",e._dataLoader.add(Rt,{widgetId:e.widgetId}));var s=e._getEntryRedirectFilter(t);e._dataLoader.add(Nt,{entries:i,ks:a,redirectFromEntryId:s}),e._dataLoader.fetchData(!1).then((function(t){r(e._parseEntryListDataFromResponse(t))}),(function(t){n(t)}))}else n({success:!1,data:"Missing mandatory parameter"})}))}},{key:"_parseEntryListDataFromResponse",value:function(t){var e=this;this._logger.debug("Data parsing started");var r=this._getPlaylistObject();if(t&&t.has(Nt.id)){var n=t.get(Nt.id);n&&n.response&&ct.getEntryList(n.response).items.forEach((function(t){return r.items.push({sources:e._getSourcesObject(t)})}))}return this._logger.debug("Data parsing finished",r),r}},{key:"_getPlaylistObject",value:function(){return{id:"",metadata:{name:"",description:""},poster:"",playlistLastEntryId:"",items:[]}}},{key:"_getDefaultSourcesObject",value:function(){return{hls:[],dash:[],progressive:[],image:[],document:[],id:"",duration:0,type:Q.Type.UNKNOWN,poster:"",rawThumbnailUrl:"",dvr:!1,vr:null,metadata:{name:"",description:"",tags:""}}}},{key:"_getSourcesObject",value:function(t){var e=this,r=this._getDefaultSourcesObject(),n=t.sources.toJSON();return r.hls=n.hls,r.dash=n.dash,r.progressive=n.progressive,r.image=n.image,r.document=n.document,r.id=t.id,r.duration=t.duration,r.type=t.type,r.dvr=!!t.dvrStatus,r.poster=t.poster,r.rawThumbnailUrl=t.rawThumbnailUrl,r.downloadUrl=t.downloadUrl,r.rootEntryId=t.rootEntryId,r.capabilities=t.capabilities,t.activeLiveStreamTime&&(r.activeLiveStreamTime=t.activeLiveStreamTime),t.sources.captions&&(r.captions=t.sources.captions),t.metadata&&"string"==typeof t.metadata.tags&&t.metadata.tags.split(",").some((function(t){return t.trim()===e._vrTag}))&&(r.vr={}),Object.assign(r.metadata,t.metadata),r}}]),o}(Ut),Ht="@playkit-js/playkit-js-providers-ovp",Kt="2.45.1"}(),n}()}));
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 r=e();for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(self,(function(){return function(){var t={61:function(t,e,r){var n=r(698).default;function i(){"use strict";t.exports=i=function(){return r},t.exports.__esModule=!0,t.exports.default=t.exports;var e,r={},a=Object.prototype,s=a.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function d(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{d({},"")}catch(e){d=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var i=e&&e.prototype instanceof _?e:_,a=Object.create(i.prototype),s=new D(n||[]);return o(a,"_invoke",{value:O(t,r,s)}),a}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var y="suspendedStart",v="suspendedYield",m="executing",g="completed",E={};function _(){}function R(){}function I(){}var T={};d(T,c,(function(){return this}));var b=Object.getPrototypeOf,w=b&&b(b(x([])));w&&w!==a&&s.call(w,c)&&(T=w);var A=I.prototype=_.prototype=Object.create(T);function k(t){["next","throw","return"].forEach((function(e){d(t,e,(function(t){return this._invoke(e,t)}))}))}function C(t,e){function r(i,a,o,u){var c=p(t[i],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==n(f)&&s.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,o,u)}),(function(t){r("throw",t,o,u)})):e.resolve(f).then((function(t){l.value=t,o(l)}),(function(t){return r("throw",t,o,u)}))}u(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function a(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(a,a):a()}})}function O(t,r,n){var i=y;return function(a,s){if(i===m)throw new Error("Generator is already running");if(i===g){if("throw"===a)throw s;return{value:e,done:!0}}for(n.method=a,n.arg=s;;){var o=n.delegate;if(o){var u=S(o,n);if(u){if(u===E)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===y)throw i=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=m;var c=p(t,r,n);if("normal"===c.type){if(i=n.done?g:v,c.arg===E)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=g,n.method="throw",n.arg=c.arg)}}}function S(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),E;var a=p(i,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,E;var s=a.arg;return s?s.done?(r[t.resultName]=s.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,E):s:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,E)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function x(t){if(t||""===t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,a=function r(){for(;++i<t.length;)if(s.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(n(t)+" is not iterable")}return R.prototype=I,o(A,"constructor",{value:I,configurable:!0}),o(I,"constructor",{value:R,configurable:!0}),R.displayName=d(I,f,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===R||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,I):(t.__proto__=I,d(t,f,"GeneratorFunction")),t.prototype=Object.create(A),t},r.awrap=function(t){return{__await:t}},k(C.prototype),d(C.prototype,l,(function(){return this})),r.AsyncIterator=C,r.async=function(t,e,n,i,a){void 0===a&&(a=Promise);var s=new C(h(t,e,n,i),a);return r.isGeneratorFunction(e)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},k(A),d(A,f,"Generator"),d(A,c,(function(){return this})),d(A,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=x,D.prototype={constructor:D,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&s.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,i){return o.type="throw",o.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=s.call(a,"catchLoc"),c=s.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&s.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,E):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),E},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),E}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;L(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:x(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),E}},r}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},698:function(t){function e(r){return t.exports=e="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.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},687:function(t,e,r){var n=r(61)();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,r),a.exports}r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return function(){"use strict";r.r(n),r.d(n,{NAME:function(){return Ht},Provider:function(){return Ft},ProviderParser:function(){return ct},RequestBuilder:function(){return ft},ResponseTypes:function(){return t},VERSION:function(){return Kt}});var t={};function e(t,e,r,n,i,a,s){try{var o=t[a](s),u=o.value}catch(t){return void r(t)}o.done?e(u):Promise.resolve(u).then(n,i)}function i(t){return function(){var r=this,n=arguments;return new Promise((function(i,a){var s=t.apply(r,n);function o(t){e(s,i,a,o,u,"next",t)}function u(t){e(s,i,a,o,u,"throw",t)}o(void 0)}))}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t){return s="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},s(t)}function o(t){var e=function(t,e){if("object"!==s(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===s(e)?e:String(e)}function u(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,o(n.key),n)}}function c(t,e,r){return e&&u(t.prototype,e),r&&u(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(t,e){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},f(t,e)}function d(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)}function h(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return l(t)}function p(t){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},p(t)}function y(t,e,r){return(e=o(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r.r(t),r.d(t,{BaseServiceResult:function(){return w},KalturaAccessControlMessage:function(){return j},KalturaAccessControlModifyRequestHostRegexAction:function(){return S},KalturaBaseEntryListResponse:function(){return C},KalturaBumper:function(){return D},KalturaDrmPlaybackPluginData:function(){return P},KalturaFlavorAsset:function(){return x},KalturaMediaEntries:function(){return M},KalturaMediaEntry:function(){return k},KalturaMetadata:function(){return U},KalturaMetadataListResponse:function(){return N},KalturaPlaybackContext:function(){return V},KalturaPlaybackSource:function(){return L},KalturaPlaylist:function(){return B},KalturaRuleAction:function(){return O},KalturaUIConfResponse:function(){return q},KalturaUserEntry:function(){return F},KalturaUserEntryListResponse:function(){return H}});var v=r(687),m=r.n(v),g={get:function(){return{VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:function(){},debug:function(){},enabledFor:function(){},error:function(){},get:function(){},getLevel:function(){},info:function(){},log:function(){},setHandler:function(){},setLevel:function(){},time:function(){},timeEnd:function(){},trace:function(){},useDefaults:function(){},warn:function(){}}}},E={};function _(t){return g.get(t)}var R=_,I=function t(e){var r;return Array.isArray(e)?(r=e.length>0?e.slice(0):[]).forEach((function(e,n){("object"===s(e)||Array.isArray(e)&&e.length>0)&&(r[n]=t(e))})):"object"===s(e)?(r=Object.assign({},e),Object.keys(r).forEach((function(e){("object"===s(r[e])||Array.isArray(r[e])&&r[e].length>0)&&(r[e]=t(r[e]))}))):r=e,r},T={serviceUrl:"https://cdnapisec.kaltura.com/api_v3",cdnUrl:"https://cdnapisec.kaltura.com",serviceParams:{apiVersion:"3.3.0",format:1},useApiCaptions:!0,loadThumbnailWithKs:!1,replaceHostOnlyManifestUrls:!1},b=function(){function t(){a(this,t)}return c(t,null,[{key:"set",value:function(t){null!=t&&t.overrideServiceUrl&&(t.serviceUrl=t.overrideServiceUrl),t&&Object.assign(T,t)}},{key:"get",value:function(){return I(T)}},{key:"serviceUrl",get:function(){return T.serviceUrl}}]),t}(),w=c((function t(e){a(this,t),y(this,"hasError",!1),"KalturaAPIException"===e.objectType?(this.hasError=!0,this.error=new A(e.code,e.message)):e.error&&"KalturaAPIException"===e.error.objectType?(this.hasError=!0,this.error=new A(e.error.code,e.error.message)):this.data=e})),A=c((function t(e,r){a(this,t),this.code=e,this.message=r})),k=c((function t(e){a(this,t),this.id=e.id,this.referenceId=e.referenceId,this.externalSourceType=e.externalSourceType,this.name=e.name,this.description=e.description,this.dataUrl=e.dataUrl,this.type=e.type,this.entryType=e.mediaType,this.flavorParamsIds=e.flavorParamsIds,this.duration=e.duration,this.poster=e.thumbnailUrl,this.rawThumbnailUrl=e.thumbnailUrl,this.status=e.status,this.dvrStatus=e.dvrStatus,this.tags=e.tags,this.adminTags=e.adminTags,this.createdAt=e.createdAt,this.updatedAt=e.updatedAt,this.creatorId=e.creatorId,this.userId=e.userId,this.endDate=e.endDate,this.plays=e.plays,this.views=e.views,this.downloadUrl=e.downloadUrl,this.rootEntryId=e.rootEntryId,this.capabilities=e.capabilities}));y(k,"EntryType",{AUTOMATIC:{value:-1},EXTERNAL_MEDIA:{value:"externalMedia.externalMedia"},MEDIA_CLIP:{value:1},MIX:{value:2},PLAYLIST:{value:5},DATA:{value:6},LIVE_STREAM:{value:7},LIVE_CHANNEL:{value:8},DOCUMENT:{value:10}}),y(k,"MediaType",{VIDEO:{value:1},IMAGE:{value:2},AUDIO:{value:5},LIVE_STREAM_FLASH:{value:201},LIVE_STREAM_WINDOWS_MEDIA:{value:202},LIVE_STREAM_REAL_MEDIA:{value:203},LIVE_STREAM_QUICK_TIME:{value:204}}),y(k,"EntryStatus",{ERROR_IMPORTING:-2,ERROR_CONVERTING:-1,SCAN_FAILURE:"virusScan.ScanFailure",IMPORT:0,INFECTED:"virusScan.Infected",PRECONVERT:1,READY:2,DELETED:3,PENDING:4,MODERATE:5,BLOCKED:6,NO_CONTENT:7}),y(k,"EntryModerationStatus",{PENDING_MODERATION:1,APPROVED:2,REJECTED:3,FLAGGED_FOR_REVIEW:4,MODERATE:5,AUTO_APPROVED:6});var C=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(t){var e;return a(this,i),(e=n.call(this,t)).hasError||(e.totalCount=t.totalCount,e.totalCount>0&&(e.entries=[],t.objects.map((function(t){return e.entries.push(new k(t))})))),e}return c(i)}(w),O=c((function t(e){a(this,t),this.type=e.type}));y(O,"Type",{DRM_POLICY:"drm.DRM_POLICY",BLOCK:1,PREVIEW:2,LIMIT_FLAVORS:3,ADD_TO_STORAGE:4,LIMIT_DELIVERY_PROFILES:5,SERVE_FROM_REMOTE_SERVER:6,REQUEST_HOST_REGEX:7,LIMIT_THUMBNAIL_CAPTURE:8,SCHEDULED_RESTRICTED:"SCHEDULED_RESTRICTED"});var S=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(t){var e;return a(this,i),(e=n.call(this,t)).pattern=t.pattern,e.replacement=t.replacement,e.replacmenServerNodeId=t.replacmenServerNodeId,e.checkAliveTimeoutMs=t.checkAliveTimeoutMs,e}return c(i)}(O),P=c((function t(e){a(this,t),this.scheme=e.scheme,this.licenseURL=e.licenseURL,this.certificate=e.certificate}));y(P,"Scheme",{"drm.PLAYREADY_CENC":"com.microsoft.playready","drm.WIDEVINE_CENC":"com.widevine.alpha","fairplay.FAIRPLAY":"com.apple.fairplay",WIDEVINE_CENC:"com.widevine.alpha",PLAYREADY_CENC:"com.microsoft.playready",FAIRPLAY:"com.apple.fairplay"});var L=function(){function t(e){var r=this;a(this,t),y(this,"drm",[]),this.format=e.format,this.deliveryProfileId=e.deliveryProfileId,this.url=e.url,this.protocols=e.protocols,this.flavorIds=e.flavorIds,e.drm&&e.drm.map((function(t){return r.drm.push(new P(t))}))}return c(t,[{key:"hasDrmData",value:function(){return this.drm&&this.drm.length>0}},{key:"hasFlavorIds",value:function(){return!!this.flavorIds&&this.flavorIds.length>0}},{key:"getProtocol",value:function(t){var e="";if(this.protocols&&this.protocols.length>0)this.protocols.split(",").forEach((function(r){r===t&&(e=r)}));else if("http"===t)return t;return e}}]),t}(),D=c((function t(e){a(this,t),this.entryId=e.entryId,this.clickThroughUrl=e.url,this.sources=e.sources?e.sources.map((function(t){return new L(t)})):[]})),x=function(){function t(e){a(this,t),this.id=e.id,this.flavorParamsId=e.flavorParamsId,this.fileExt=e.fileExt,this.bitrate=e.bitrate,this.width=e.width,this.height=e.height,this.id=e.id,this.frameRate=e.frameRate,this.isOriginal=e.isOriginal,this.isWeb=e.isWeb,this.containerFormat=e.containerFormat,this.videoCodecId=e.videoCodecId,this.status=e.status,this.language=e.language,this.label=e.label,this.tags=t.parseTags(e.tags)}return c(t,null,[{key:"parseTags",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(",")}}]),t}();y(x,"Status",{ERROR:-1,QUEUED:0,CONVERTING:1,READY:2,DELETED:3,NOT_APPLICABLE:4,TEMP:5,WAIT_FOR_CONVERT:6,IMPORTING:7,VALIDATING:8,EXPORTING:9});var M=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(t){var e;return a(this,i),(e=n.call(this,t)).hasError||(e.entries=[],t.map((function(t){return e.entries.push(new k(t))}))),e}return c(i)}(w),U=c((function t(e){a(this,t),this.id=e.id,this.metadataProfileId=e.metadataProfileId,this.metadataProfileVersion=e.metadataProfileVersion,this.metadataProfileId=e.metadataProfileId,this.metadataObjectType=e.metadataObjectType,this.objectId=e.objectId,this.version=e.version,this.created=new Date(0),this.created.setUTCSeconds(e.createdAt),this.updated=new Date(0),this.updated.setUTCSeconds(e.updatedAt),this.status=e.status,this.xml=e.xml}));y(U,"ObjectType",{AD_CUE_POINT:"adCuePointMetadata.AdCuePoint",ANNOTATION:"annotationMetadata.Annotation",CODE_CUE_POINT:"codeCuePointMetadata.CodeCuePoint",THUMB_CUE_POINT:"thumbCuePointMetadata.thumbCuePoint",ENTRY:1,CATEGORY:2,USER:3,PARTNER:4,DYNAMIC_OBJECT:5}),y(U,"Status",{VALID:1,INVALID:2,DELETED:3});var N=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(t){var e;return a(this,i),(e=n.call(this,t)).hasError||(e.totalCount=t.totalCount,e.totalCount>0&&(e.metas=[],t.objects.map((function(t){return e.metas.push(new U(t))})))),e}return c(i)}(w),j=c((function t(e){a(this,t),this.message=e.message,this.code=e.code}));var V=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(t){var e;if(a(this,i),y(l(e=n.call(this,t)),"sources",[]),y(l(e),"actions",[]),y(l(e),"messages",[]),y(l(e),"flavorAssets",[]),y(l(e),"bumperData",[]),!e.hasError){var r=t.messages;r&&r.map((function(t){return e.messages.push(new j(t))}));var s=t.actions;s&&s.map((function(t){t.type===O.Type.REQUEST_HOST_REGEX?e.actions.push(new S(t)):e.actions.push(new O(t))}));var o=t.sources;o&&o.map((function(t){return e.sources.push(new L(t))}));var u=t.flavorAssets;u&&u.map((function(t){return e.flavorAssets.push(new x(t))}));var c=t.bumperData;c&&c.map((function(t){return e.bumperData.push(new D(t))})),t.activeLiveStreamTime&&(e.activeLiveStreamTime={startTime:t.activeLiveStreamTime.startTime,endTime:t.activeLiveStreamTime.endTime})}return e}return c(i,[{key:"hasBlockAction",value:function(){return void 0!==this.getBlockAction()}},{key:"getBlockAction",value:function(){return this.actions.find((function(t){return t.type===O.Type.BLOCK}))}},{key:"hasScheduledRestriction",value:function(){return this.messages.some((function(t){return t.code===O.Type.SCHEDULED_RESTRICTED}))}},{key:"getErrorMessages",value:function(){return this.messages}},{key:"getRequestHostRegexAction",value:function(){var t=this.actions.find((function(t){return t.type===O.Type.REQUEST_HOST_REGEX}));if(t instanceof S)return t}}]),i}(w),B=c((function t(e){a(this,t),this.id=e.id,this.name=e.name,this.description=e.description,this.poster=e.thumbnailUrl}));var q=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(t){var e;return a(this,i),(e=n.call(this,t)).hasError||(e.name=t.name,e.description=t.description,e.objTypeAsString=t.objTypeAsString,e.width=t.width,e.height=t.height,e.htmlParams=t.htmlParams,e.swfUrl=t.swfUrl,e.confFilePath=t.confFilePath,e.confFile=t.confFile,e.confFileFeatures=t.confFileFeatures,e.config=t.config,e.confVars=t.confVars,e.useCdn=t.useCdn,e.tags=t.tags,e.swfUrlVersion=t.swfUrlVersion,e.created=new Date(0),e.created.setUTCSeconds(t.createdAt),e.updated=new Date(0),e.updated.setUTCSeconds(t.updatedAt),e.html5Url=t.description,e.version=t.description,e.partnerTags=t.description,e.objType=t.description,e.creationMode=t.description),e}return c(i)}(w);y(q,"Type",{PLAYER:1,CONTRIBUTION_WIZARD:2,SIMPLE_EDITOR:3,ADVANCED_EDITOR:4,PLAYLIST:5,APP_STUDIO:6,KRECORD:7,PLAYER_V3:8,KMC_ACCOUNT:9,KMC_ANALYTICS:10,KMC_CONTENT:11,KMC_DASHBOARD:12,KMC_LOGIN:13,PLAYER_SL:14,CLIENTSIDE_ENCODER:15,KMC_GENERAL:16,KMC_ROLES_AND_PERMISSIONS:17,CLIPPER:18,KSR:19,KUPLOAD:20,WEBCASTING:21}),y(q,"CreationMode",{WIZARD:2,ADVANCED:3});var F=c((function t(e){a(this,t),this.playlistLastEntryId=e.playlistLastEntryId,this.entryId=e.entryId,this.id=e.id,this.userId=e.userId,this.partnerId=e.partnerId,this.status=e.status,this.createdAt=e.createdAt,this.updatedAt=e.updatedAt}));var H=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(t){var e;return a(this,i),(e=n.call(this,t)).hasError||(e.totalCount=t.totalCount,e.entries=[],e.totalCount>0&&t.objects.map((function(t){return e.entries.push(new F(t))}))),e}return c(i)}(w),K=function(){function t(){a(this,t)}return c(t,null,[{key:"build",value:function(t){var e=b.get(),r=e.serviceUrl.substr(0,e.serviceUrl.lastIndexOf("/")),n=t.partnerId,i=t.entryId,a=t.ks,s=t.uiConfId,o=t.format,u=t.protocol,c=t.extension,l=t.flavorIds;if(!r||isNaN(Number.parseInt(n))||!i||!o||!u)return"";var f=r;return r.endsWith("/")||(f+="/"),f+="p/"+n+"/sp/"+n+"00/playManifest/entryId/"+i+"/protocol/"+u+"/format/"+o,l?f+="/flavorIds/"+l:s&&(f+="/uiConfId/"+s),""!==a&&(f+="/ks/"+a),""!==c&&(f+="/a."+c),s&&""!==l&&(f+="?uiConfId="+s),f}}]),t}(),G=function(){function t(){a(this,t)}return c(t,null,[{key:"xmlToJson",value:function(t){var e={};if(1===t.nodeType){if(t.attributes.length>0){e["@attributes"]={};for(var r=0;r<t.attributes.length;r++){var n=t.attributes.item(r);e["@attributes"][n.nodeName]=n.nodeValue}}}else 3===t.nodeType&&(e=t.nodeValue);if(t.hasChildNodes())for(var i=0;i<t.childNodes.length;i++){var a=t.childNodes.item(i),s=a.nodeName;if(void 0===e[s])e[s]=this.xmlToJson(a);else{if(void 0===e[s].push){var o=e[s];e[s]=[],e[s].push(o)}e[s].push(this.xmlToJson(a))}}return e}}]),t}(),W={DASH:{name:"dash",mimeType:"application/dash+xml",pathExt:"mpd"},HLS:{name:"hls",mimeType:"application/x-mpegURL",pathExt:"m3u8"},WVM:{name:"wvm",mimeType:"video/wvm",pathExt:"wvm"},MP4:{name:"mp4",mimeType:"video/mp4",pathExt:"mp4"},MP3:{name:"mp3",mimeType:"audio/mpeg",pathExt:"mp3"}},Y=new Map([["mpegdash",W.DASH],["applehttp",W.HLS],["url",W.MP4]]);function J(t){var e=Y.get(t);return!!e&&e.name===W.MP4.name}var X=function(){function t(){a(this,t),this.progressive=[],this.dash=[],this.hls=[],this.image=[],this.document=[]}return c(t,[{key:"map",value:function(t,e){if(e)switch(e.name){case W.MP4.name:this.progressive.push(t);break;case W.DASH.name:this.dash.push(t);break;case W.HLS.name:this.hls.push(t)}}},{key:"toJSON",value:function(){var t={progressive:[],dash:[],hls:[],image:[],document:[]};return this.progressive.forEach((function(e){return t.progressive.push(e.toJSON())})),this.hls.forEach((function(e){return t.hls.push(e.toJSON())})),this.dash.forEach((function(e){return t.dash.push(e.toJSON())})),t.image=this.image,t.document=this.document,t}}]),t}(),Q=function(){function t(){a(this,t),this.metadata=new Map,this.sources=new X,this.type=t.Type.UNKNOWN}return c(t,[{key:"toJSON",value:function(){return{id:this.id,name:this.name,sources:this.sources.toJSON(),duration:this.duration,dvrStatus:this.dvrStatus,status:this.status,metadata:this.metadata,type:this.type,poster:this.poster,assetReferenceType:this.assetReferenceType,downloadUrl:this.downloadUrl,rawThumbnailUrl:this.rawThumbnailUrl,rootEntryId:this.rootEntryId,capabilities:this.capabilities}}}]),t}();y(Q,"Type",{VOD:"Vod",LIVE:"Live",IMAGE:"Image",AUDIO:"Audio",UNKNOWN:"Unknown",DOCUMENT:"Document"}),y(Q,"DvrStatus",{ON:1,OFF:0});var z=function(){function t(e,r,n){a(this,t),this.licenseUrl=e,this.scheme=r,n&&(this.certificate=n)}return c(t,[{key:"toJSON",value:function(){var t={licenseUrl:this.licenseUrl,scheme:this.scheme};return this.certificate&&(t.certificate=this.certificate),t}}]),t}(),Z=function(){function t(){a(this,t)}return c(t,[{key:"toJSON",value:function(){var t={id:this.id,url:this.url,mimetype:this.mimetype};return this.bandwidth&&(t.bandwidth=this.bandwidth),this.width&&(t.width=this.width),this.height&&(t.height=this.height),this.label&&(t.label=this.label),this.drmData&&this.drmData.length>0&&(t.drmData=[],this.drmData.forEach((function(e){Array.isArray(t.drmData)&&t.drmData.push(e.toJSON())}))),t}}]),t}(),$=c((function t(){a(this,t),this.items=[]})),tt=c((function t(){a(this,t),this.items=[]})),et=c((function t(e){a(this,t),this.url=e.url,this.clickThroughUrl=e.clickThroughUrl})),rt={SRT:"1",DFXP:"2",WEBVTT:"3",CAP:"4"},nt={3:"vtt",1:"srt"},it=function(){function t(){a(this,t)}return c(t,null,[{key:"createConfig",value:function(t,e){return t.map((function(t){var r=t.url,n=nt[t.format];return[rt.DFXP,rt.CAP].includes(t.format)&&(r=t.webVttUrl,n=nt[rt.WEBVTT]),r=ut(r,e),{default:!!t.isDefault,type:n,language:t.languageCode,label:t.label,url:r}}))}}]),t}(),at=function(){function t(e){a(this,t),this.id=e.id,this.url=t.extractBaseThumbnailUrl(e.dataUrl),this.mimetype=""}return c(t,null,[{key:"extractBaseThumbnailUrl",value:function(t){return t.match(".+entry_id/[a-zA-Z0-9_]+/")[0].slice(0,-1)}}]),t}(),st=c((function t(e){a(this,t),this.id=e.id,this.url=e.downloadUrl,this.thumbnailUrl=e.poster,this.mimetype=""})),ot=function(){function t(){a(this,t)}return c(t,null,[{key:"getMediaEntry",value:function(e,r,n,i){var a=new Q,s=i.entry,o=i.playBackContextResult,u=i.metadataListResult,c=o.sources;return a.activeLiveStreamTime=o.activeLiveStreamTime,a.sources=t._getParsedSources(c,e,r,n,s,o),t._fillBaseData(a,s,u,o),a.type!==Q.Type.LIVE&&b.get().useApiCaptions&&o.data.playbackCaptions&&(a.sources.captions=it.createConfig(o.data.playbackCaptions,e)),a}},{key:"addKsToUrl",value:function(t,e){var r;return e?(r=-1!==t.split("?")[0].replace(/^.*[\\/]/,"").indexOf(".")?-1===t.indexOf("?")?"?ks=":"&ks=":"/ks/",t+r+e):t}},{key:"getPlaylist",value:function(e){var r=new $,n=e.playlistData,i=e.playlistItems.entries,a=e.playlistUserEntries.entries;return r.id=n.id,r.name=n.name,r.description=n.description,r.poster=n.poster,r.playlistLastEntryId=a.map((function(t){return t.playlistLastEntryId}))[0],i.forEach((function(e){var n=new Q;t._fillBaseData(n,e),r.items.push(n)})),r}},{key:"getEntryList",value:function(e){var r=new tt;return e.playlistItems.entries.forEach((function(e){var n=new Q;t._fillBaseData(n,e),r.items.push(n)})),r}},{key:"getBumper",value:function(e,r,n){var i=e.playBackContextResult,a=i.bumperData[0];if(a){var s=(a&&a.sources).find((function(t){return J(t.format)}));if(s){var o=t._parseProgressiveSources(s,i,r,n,0,a.entryId);if(o[0])return new et({url:o[0].url,clickThroughUrl:a.clickThroughUrl})}}}},{key:"_fillBaseData",value:function(e,r,n,i){if(e.poster=r.poster,e.rawThumbnailUrl=r.rawThumbnailUrl,e.id=r.id,e.duration=r.duration,e.downloadUrl=r.downloadUrl||"",e.metadata=t._parseMetadata(n),e.metadata.description=r.description||"",e.metadata.entryId=r.id||"",e.metadata.name=r.name||"",r.createdAt&&(e.metadata.createdAt=r.createdAt),r.updatedAt&&(e.metadata.updatedAt=r.updatedAt),r.creatorId&&(e.metadata.creatorId=r.creatorId),r.userId&&(e.metadata.userId=r.userId),r.endDate&&(e.metadata.endDate=r.endDate),r.views&&(e.metadata.views=r.views),r.plays&&(e.metadata.plays=r.plays),e.metadata.tags=r.tags||"",e.metadata.adminTags=r.adminTags||"",e.status=r.status,e.rootEntryId=r.rootEntryId,e.capabilities=r.capabilities?r.capabilities.split(","):[],e.type=t._getEntryType(r.entryType,r.type),e.type===Q.Type.LIVE&&(e.dvrStatus=r.dvrStatus),i&&i.flavorAssets[0]&&i.flavorAssets[0].width&&i.flavorAssets[0].height){var a=i.flavorAssets[0],s=a.height,o=a.width;e.metadata.aspectRatio=+Number(o/s).toFixed(2)}return i&&Array.isArray(i.flavorAssets)&&(e.metadata.audioFlavors=i.flavorAssets.filter((function(t){return t.bitrate&&!t.width&&!t.height}))),e}},{key:"_getEntryType",value:function(t,e){var r=Q.Type.UNKNOWN;switch(t){case k.MediaType.IMAGE.value:r=Q.Type.IMAGE;break;case k.MediaType.AUDIO.value:r=Q.Type.AUDIO;break;default:switch(e){case k.EntryType.MEDIA_CLIP.value:r=Q.Type.VOD;break;case k.EntryType.LIVE_STREAM.value:case k.EntryType.LIVE_CHANNEL.value:r=Q.Type.LIVE;break;case k.EntryType.DOCUMENT.value:r=Q.Type.DOCUMENT;break;default:r=Q.Type.UNKNOWN}}return r}},{key:"_getParsedSources",value:function(e,r,n,i,a,s){var o,u,c=new X;return a.type===k.EntryType.EXTERNAL_MEDIA.value?((u=new Z).mimetype="video/youtube",u.url=a.referenceId,u.id=a.id+"_youtube",c.progressive.push(u)):a.entryType===k.MediaType.IMAGE.value?c.image.push(new at(a)):a.type===k.EntryType.DOCUMENT.value?c.document.push(new st(a)):e&&e.length>0&&(e.filter((function(t){return!J(t.format)})).forEach((function(e){var o=t._parseAdaptiveSource(e,s,r,n,i,a.id);if(o){var u=Y.get(e.format);c.map(o,u)}})),o=e.find((function(e){return J(e.format)&&""!==e.getProtocol(t._getBaseProtocol())})),c.progressive=t._parseProgressiveSources(o,s,r,n,i,a.id)),c}},{key:"_parseAdaptiveSource",value:function(e,r,n,i,a,s){var o=new Z;if(e){var u="",c=Y.get(e.format),l=e.getProtocol(t._getBaseProtocol()),f=e.deliveryProfileId,d=e.format,h="";if(c&&(h=c.pathExt,o.mimetype=c.mimeType),e.hasFlavorIds()?(!h&&r.flavorAssets&&r.flavorAssets.length>0&&(h=r.flavorAssets[0].fileExt),u=K.build({entryId:s,flavorIds:e.flavorIds,format:d,ks:n,partnerId:i,uiConfId:a,extension:h,protocol:l})):u=t.addKsToUrl(e.url,n),!u){var p="failed to create play url from source, discarding source: (".concat(s,"_").concat(f,"), ").concat(d);return t._logger.warn(p),null}if(o.url=u,o.id=s+"_"+f+","+d,e.hasDrmData()){var y=[];e.drm.forEach((function(t){y.push(new z(t.licenseURL,P.Scheme[t.scheme],t.certificate))})),o.drmData=y}}return o}},{key:"_parseProgressiveSources",value:function(e,r,n,i,a,s){var o=[],u=[];if(e){var c=e.getProtocol(t._getBaseProtocol()),l=e.format,f=e.deliveryProfileId,d=f+","+l;r.flavorAssets.map((function(e){var r=new Z;r.id=e.id+d,r.mimetype="mp3"===e.fileExt?"audio/mp3":"video/mp4",r.height=e.height,r.width=e.width,r.bandwidth=1024*e.bitrate,r.label=e.label||e.language;var h=K.build({entryId:s,flavorIds:e.id,format:l,ks:n,partnerId:i,uiConfId:a,extension:e.fileExt,protocol:c});if(""===h)return t._logger.warn("failed to create play url from source, discarding source: (".concat(s,"_").concat(f,"), ").concat(l,".")),null;r.url=h,e.height&&e.width?o.push(r):u.push(r)}))}return u.length&&!o.length?u:o}},{key:"_parseMetadata",value:function(t){var e={};return t&&t.metas&&t.metas.length>0&&t.metas.forEach((function(t){if(t.xml){var r=new DOMParser;t.xml=t.xml.replace(/\r?\n|\r/g,""),t.xml=t.xml.replace(/>\s*/g,">"),t.xml=t.xml.replace(/>\s*/g,">");var n=r.parseFromString(t.xml,"text/xml"),i=G.xmlToJson(n);Object.keys(i.metadata).forEach((function(t){e[t]=i.metadata[t]["#text"]}))}})),e}},{key:"_getBaseProtocol",value:function(){var t=b.get(),e=/^https?:/.exec(t.cdnUrl),r=e?e[0]:document.location.protocol;return"string"==typeof r?r.slice(0,-1):"https"}},{key:"hasBlockAction",value:function(t){return t.playBackContextResult.hasBlockAction()}},{key:"getBlockAction",value:function(t){return t.playBackContextResult.getBlockAction()}},{key:"hasScheduledRestriction",value:function(t){return t.playBackContextResult.hasScheduledRestriction()}},{key:"getErrorMessages",value:function(t){return t.playBackContextResult.getErrorMessages()}}]),t}();y(ot,"_logger",R("OVPProviderParser"));var ut=ot.addKsToUrl,ct=ot,lt=c((function t(e,r,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};a(this,t),this.severity=e,this.category=r,this.code=n,this.data=i,t._logger.error("Category:".concat(r," | Code:").concat(n," |"),i)}));y(lt,"Severity",{RECOVERABLE:1,CRITICAL:2}),y(lt,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),y(lt,"Code",{UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,BAD_SERVER_RESPONSE:1005,MULTIREQUEST_API_ERROR:1006,API_RESPONSE_MISMATCH:1007,ERROR:2e3,BLOCK_ACTION:2001,MEDIA_STATUS_NOT_READY:2002,SCHEDULED_RESTRICTED:2003,DELETED_ENTRY:2004,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),y(lt,"_logger",R("Error"));var ft=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;a(this,t),y(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),y(this,"_attemptCounter",1),this.headers=e}return c(t,[{key:"getUrl",value:function(t){return t+"/service/"+this.service+(this.action?"/action/"+this.action:"")}},{key:"doHttpRequest",value:function(){var t=this,e=new Promise((function(e,r){t._requestPromise={resolve:e,reject:r}}));return this.url||this._requestPromise.reject(new lt(lt.Severity.CRITICAL,lt.Category.NETWORK,lt.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),e}},{key:"_createXHR",value:function(){var t=this,e=new XMLHttpRequest;e.onreadystatechange=function(){if(4===e.readyState&&200===e.status)try{var r=JSON.parse(e.responseText);return t.responseHeaders=t._getResponseHeaders(e),t._requestPromise.resolve(r)}catch(r){t._requestPromise.reject(t._createError(e,lt.Code.BAD_SERVER_RESPONSE,{text:e.responseText}))}},e.open(this.method,this.url,this.retryConfig.async),this.retryConfig.async&&this.retryConfig.timeout&&(e.timeout=this.retryConfig.timeout);var r=performance.now();e.ontimeout=function(){t._handleError(e,lt.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:e.statusText})},e.onerror=e.onabort=function(){t._handleError(e,lt.Code.HTTP_ERROR,{text:e.responseText,statusText:e.statusText})},this.headers.forEach((function(t,r){e.setRequestHeader(r,t)})),e.send(this.params)}},{key:"_getResponseHeaders",value:function(t){return t.getAllResponseHeaders().split("\n").filter((function(t){return 0===t.toLowerCase().indexOf("x-")}))}},{key:"_handleError",value:function(t,e,r){var n=this._createError(t,e,r);if(t.onreadystatechange=function(){},t.onerror=function(){},t.ontimeout=function(){},t.onabort=function(){},!(this.retryConfig.maxAttempts&&this._attemptCounter<this.retryConfig.maxAttempts))return this._requestPromise.reject(n);this._attemptCounter++,this._createXHR()}},{key:"_createError",value:function(t,e,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(t),attempt:this._attemptCounter}),new lt(lt.Severity.CRITICAL,lt.Category.NETWORK,e,r)}}]),t}();var dt=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(){var t;a(this,i);for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return y(l(t=n.call.apply(n,[this].concat(r))),"requests",[]),t}return c(i,[{key:"add",value:function(t){this.requests.push(t);var e={},r={service:t.service,action:t.action};return Object.assign(e,y({},this.requests.length,Object.assign(r,t.params))),Object.assign(e,this.params),this.params=e,this}},{key:"execute",value:function(t,e){var r=this;return new Promise((function(n,a){try{r.params=JSON.stringify(r.params)}catch(t){i._logger.error("".concat(t.message)),a(new lt(lt.Severity.CRITICAL,lt.Category.PROVIDER,lt.Code.FAILED_PARSING_REQUEST,{error:t,params:r.params}))}r.doHttpRequest().then((function(i){var s=new ht(i,t,e);s.success?n({headers:r.responseHeaders,response:s}):a(new lt(lt.Severity.CRITICAL,lt.Category.NETWORK,lt.Code.MULTIREQUEST_API_ERROR,{url:r.url,headers:r.responseHeaders,results:s.results}))}),(function(t){a(t)}))}))}}]),i}(ft);y(dt,"_logger",R("MultiRequestBuilder"));var ht=c((function t(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];a(this,t),y(this,"results",[]);var i=e.result?e.result:e,s=(Array.isArray(i)?i:[i]).map((function(t){return new w(t)})),o=s.filter((function(t){return t.hasError}));o.forEach((function(e){t._logger.error("Service returned an error with error code: ".concat(e.error.code," and message: ").concat(e.error.message,"."))})),this.results=s,r&&o.length||o.length===this.results.length?this.success=!1:(n&&(this.results=this.results.filter((function(t){return!t.hasError}))),this.success=!0)}));y(ht,"_logger",R("MultiRequestResult"));var pt=function(){function t(){a(this,t)}return c(t,null,[{key:"getMultiRequest",value:function(t,e,r){var n=b.get(),i=n.serviceParams;Object.assign(i,{ks:e,clientTag:"html5:v"+t}),r&&Object.assign(i,{partnerId:r});var a=new Map;a.set("Content-Type","application/json");var s=new dt(a);return s.method="POST",s.service="multirequest",s.url=s.getUrl(n.serviceUrl),s.params=i,s}}]),t}(),yt=c((function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,t),this.type=e.type||t.Type.INCLUDE_FIELDS,this.fields=e.fields||"id,referenceId,name,description,thumbnailUrl,dataUrl,duration,msDuration,flavorParamsIds,mediaType,type,tags,dvrStatus,externalSourceType,status,createdAt,updatedAt,endDate,plays,views,downloadUrl,creatorId,userId,rootEntryId,capabilities,adminTags"}));y(yt,"Type",{INCLUDE_FIELDS:1,EXCLUDE_FIELDS:2});var vt="baseEntry",mt=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(){return a(this,i),n.apply(this,arguments)}return c(i,null,[{key:"getPlaybackContext",value:function(t,e,r,n){var i=new Map;i.set("Content-Type","application/json");var a=new ft(i);a.service=vt,a.action="getPlaybackContext",a.method="POST",a.url=a.getUrl(t),a.tag="baseEntry-getPlaybackContext";var s={objectType:"KalturaContextDataParams",flavorTags:"all"};return n&&(s.referrer=n),a.params={entryId:r,ks:e,contextDataParams:s},a}},{key:"list",value:function(t,e,r,n,a){var s=new Map;s.set("Content-Type","application/json");var o=new ft(s);return o.service=vt,o.action="list",o.method="POST",o.url=o.getUrl(t),o.tag="list",o.params=i.getEntryListReqParams(r,e,n,a),o}},{key:"getEntryListReqParams",value:function(t,e,r,n){var i={};return t?i=r?{redirectFromEntryId:t}:{idEqual:t}:n&&(i={objectType:"KalturaBaseEntryFilter",referenceIdEqual:n}),{ks:e,filter:i,responseProfile:new yt}}}]),i}(pt);var gt=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(){return a(this,i),n.apply(this,arguments)}return c(i,null,[{key:"list",value:function(t,e,r){var n=new Map;n.set("Content-Type","application/json");var i=new ft(n);i.service="metadata_metadata",i.action="list",i.method="POST",i.url=i.getUrl(t),i.tag="metadata_metadata-list";var a={objectType:"KalturaMetadataFilter",objectIdEqual:r,metadataObjectTypeEqual:"1"};return i.params={filter:a,ks:e},i}}]),i}(pt),Et=function(){function t(e){a(this,t),y(this,"_response",{}),this.requests=this.buildRequests(e),this._entryId=e.entryId,this._referenceId=e.referenceId}return c(t,[{key:"requests",get:function(){return this._requests},set:function(t){this._requests=t}},{key:"response",get:function(){return this._response},set:function(t){var e=new C(t[0].data);this._response.entry=e.entries[0],this._response.playBackContextResult=new V(t[1].data),this._response.metadataListResult=new N(t[2].data)}},{key:"buildRequests",value:function(t){var e=b.get(),r=[];r.push(mt.list(e.serviceUrl,t.ks,t.entryId,t.redirectFromEntryId,t.referenceId));var n="{1:result:ks}"===t.ks?"{2:result:objects:0:id}":"{1:result:objects:0:id}";return r.push(mt.getPlaybackContext(e.serviceUrl,t.ks,n,t.referrer)),r.push(gt.list(e.serviceUrl,t.ks,n)),r}},{key:"isValid",value:function(){return!(!this._entryId&&!this._referenceId)}}],[{key:"id",get:function(){return"media"}}]),t}();var _t=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(){return a(this,i),n.apply(this,arguments)}return c(i,null,[{key:"anonymousSession",value:function(t,e){var r=new Map;r.set("Content-Type","application/json");var n=new ft(r);return n.service="session",n.action="startWidgetSession",n.method="POST",n.url=n.getUrl(t),n.tag="session-startWidget",n.params={widgetId:e},n}}]),i}(pt),Rt=function(){function t(e){a(this,t),y(this,"_response",{}),this.requests=this.buildRequests(e),this._widgetId=e.widgetId}return c(t,[{key:"requests",get:function(){return this._requests},set:function(t){this._requests=t}},{key:"response",get:function(){return this._response.ks},set:function(t){this._response.ks=t[0].data.ks}},{key:"buildRequests",value:function(t){var e=b.get(),r=[];return r.push(_t.anonymousSession(e.serviceUrl,t.widgetId)),r}},{key:"isValid",value:function(){return!!this._widgetId}}],[{key:"id",get:function(){return"session"}}]),t}();function It(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Tt(t){return function(t){if(Array.isArray(t))return It(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){if("string"==typeof t)return It(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?It(t,e):void 0}}(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.")}()}var bt={serviceParams:{apiVersion:"7.8.1"}},wt=function(){function t(){a(this,t)}return c(t,null,[{key:"set",value:function(t){t&&Object.assign(bt,t)}},{key:"get",value:function(){return I(bt)}}]),t}();function At(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return kt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?kt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){o=!0,a=t},f:function(){try{s||null==r.return||r.return()}finally{if(o)throw a}}}}function kt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Ct(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Ot(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Ct(Object(r),!0).forEach((function(e){y(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ct(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var St=function(){function t(){var e;a(this,t),y(this,"_logger",R("RequestSequenceBuilder")),y(this,"loaders",new Map),y(this,"_globalParams",{apiVersion:null===(e=wt.get().serviceParams)||void 0===e?void 0:e.apiVersion})}var e,r,n;return c(t,[{key:"add",value:function(t){var e;this.loaders.set(null===(e=t.requests)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.service,t)}},{key:"_executeRequest",value:(n=i(m().mark((function t(e){var r,n,i,a,s;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.params=JSON.stringify(Ot(Ot({},this._globalParams),e.params)),t.prev=1,t.next=4,e.doHttpRequest();case 4:return r=t.sent,(n=new w(r.result||r)).hasError&&(i=n.error,a=i.code,s=i.message,this._logger.error("Service returned an error with error code: ".concat(a," and message: ").concat(s,"."))),t.abrupt("return",n);case 10:throw t.prev=10,t.t0=t.catch(1),new lt(lt.Severity.CRITICAL,lt.Category.NETWORK,lt.Code.API_RESPONSE_MISMATCH,{error:t.t0,request:e});case 13:case"end":return t.stop()}}),t,this,[[1,10]])}))),function(t){return n.apply(this,arguments)})},{key:"_executeSequence",value:(r=i(m().mark((function t(e){var r,n,i,a,s,o,u,c,l,f;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=[],n=At(e),t.prev=2,n.s();case 4:if((i=n.n()).done){t.next=18;break}return a=i.value,t.prev=6,t.next=9,this._executeRequest(a);case 9:s=t.sent,r.push(s),t.next=16;break;case 13:t.prev=13,t.t0=t.catch(6),this._logger.error("Request execution failed: ".concat(t.t0.message));case 16:t.next=4;break;case 18:t.next=23;break;case 20:t.prev=20,t.t1=t.catch(2),n.e(t.t1);case 23:return t.prev=23,n.f(),t.finish(23);case 26:if(!(o=new Pt(r)).success){t.next=31;break}return t.abrupt("return",o);case 31:if(!(u=r.find((function(t){return t.hasError})))){t.next=35;break}throw c=u.error,l=c.message,f=c.code,new lt(lt.Severity.CRITICAL,lt.Category.NETWORK,lt.Code.API_RESPONSE_MISMATCH,{error:u.error,errorMessage:"Request returned an error: ".concat(l," (code: ").concat(f,")")});case 35:return t.abrupt("return",o);case 36:case"end":return t.stop()}}),t,this,[[2,20,23,26],[6,13]])}))),function(t){return r.apply(this,arguments)})},{key:"execute",value:(e=i(m().mark((function t(){var e,r,n,i,a;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=this.loaders.get("ottuser"),r=this.loaders.get("asset"),n="",t.prev=3,!e){t.next=10;break}return t.next=7,this._executeRequest(e.requests[0]);case 7:i=t.sent,e.response=[{data:i.data}],n=i.data.ks||"";case 10:if(!r){t.next=16;break}return r.requests.forEach((function(t){"{1:result:ks}"===t.params.ks&&(t.params.ks=n)})),t.next=14,this._executeSequence(r.requests);case 14:a=t.sent,r.response=a.results;case 16:t.next=21;break;case 18:t.prev=18,t.t0=t.catch(3),this._logger.error("loaders execution failed: ".concat(t.t0.message));case 21:return t.abrupt("return",this.loaders);case 22:case"end":return t.stop()}}),t,this,[[3,18]])}))),function(){return e.apply(this,arguments)})}]),t}(),Pt=c((function t(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];a(this,t),this.results=Tt(e);var n,i=this.results.filter((function(t){return t.hasError})),s=At(i);try{for(s.s();!(n=s.n()).done;){var o=n.value.error,u=o.code,c=o.message;t._logger.error("Service returned an error with error code: ".concat(u," and message: ").concat(c,"."))}}catch(t){s.e(t)}finally{s.f()}var l=i.length===this.results.length,f=r&&i.length>0;l||f?this.success=!1:(r||(this.results=this.results.filter((function(t){return!t.hasError}))),this.success=!0)}));y(Pt,"_logger",R("SingleRequestsResult"));var Lt=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(t,e){var r,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3?arguments[3]:void 0;return a(this,i),(r=n.call(this,o))._multiRequest=pt.getMultiRequest(t,s,e),r}return c(i)}(function(){function t(e){a(this,t),y(this,"_loadersResponseMap",new Map),y(this,"_loaders",new Map),this._networkRetryConfig=e,this._singleRequests=new St}return c(t,[{key:"add",value:function(t,e,r){var n=this,i=new t(e);if(i.isValid())if(this._loaders.set(t.id,i),i.disableMultirequest)this._singleRequests.add(i);else{var a=this._multiRequest.requests.length,s=i.requests;this._multiRequest.retryConfig=this._networkRetryConfig,s.forEach((function(t){t.params=t.params||{},t.params.ks=t.params.ks||r,n._multiRequest.add(t)}));var o=Array.from(new Array(s.length),(function(t,e){return e+a}));this._loadersResponseMap.set(t.id,o)}}},{key:"fetchData",value:function(t,e){var r=this;return new Promise((function(n,i){r._singleRequests.loaders.size>0?r._singleRequests.execute().then((function(){return n(r._loaders)})).catch((function(t){return i(t)})):r._multiRequest.execute(t,e).then((function(t){r._multiResponse=t.response,r.prepareData(t.response).success?n(r._loaders):i(new lt(lt.Severity.CRITICAL,lt.Category.NETWORK,lt.Code.API_RESPONSE_MISMATCH,{headers:t.headers}))}),(function(t){i(t)}))}))}},{key:"prepareData",value:function(t){var e=this;return this._loaders.forEach((function(r,n){var i=e._loadersResponseMap.get(n);try{i&&i.length>0&&(r.response=t.results.slice(i[0],i[i.length-1]+1))}catch(t){return{success:!1,error:t}}})),{success:!0,data:this._loaders}}}]),t}());var Dt="playlist",xt=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(){return a(this,i),n.apply(this,arguments)}return c(i,null,[{key:"execute",value:function(t,e,r,n){var i=new Map;i.set("Content-Type","application/json");var a=new ft(i);a.service=Dt,a.action="execute",a.method="POST",a.url=a.getUrl(t),a.tag="".concat(Dt,"-execute");var s=new yt;return n&&(s.fields=s.fields+n),a.params={ks:e,id:r,responseProfile:s},a}},{key:"get",value:function(t,e,r){var n=new Map;n.set("Content-Type","application/json");var i=new ft(n);return i.service=Dt,i.action="get",i.method="POST",i.url=i.getUrl(t),i.tag="".concat(Dt,"-get"),i.params={ks:e,id:r,responseProfile:{fields:"id,name,description,thumbnailUrl",type:1}},i}},{key:"getLastEntryId",value:function(t,e,r){var n=new Map;n.set("Content-Type","application/json");var i=new ft(n);return i.service="userEntry",i.action="list",i.method="POST",i.url=i.getUrl(t),i.tag="userEntry-list",i.params={ks:e,filter:{objectType:"KalturaViewHistoryUserEntry",entryIdEqual:r,userIdEqualCurrent:1},responseProfile:{fields:"playlistLastEntryId",type:1}},i}}]),i}(pt),Mt=function(){function t(e){a(this,t),y(this,"_response",{}),this.requests=this.buildRequests(e),this._playlistId=e.playlistId}return c(t,[{key:"requests",get:function(){return this._requests},set:function(t){this._requests=t}},{key:"response",get:function(){return this._response},set:function(t){this._response.playlistData=new B(t[0].data),this._response.playlistItems=new M(t[1].data),this._response.playlistUserEntries=new H(t[2].data)}},{key:"buildRequests",value:function(t){var e=b.get(),r=[];return r.push(xt.get(e.serviceUrl,t.ks,t.playlistId)),r.push(xt.execute(e.serviceUrl,t.ks,t.playlistId,t.cacheToken)),r.push(xt.getLastEntryId(e.serviceUrl,t.ks,t.playlistId)),r}},{key:"isValid",value:function(){return!!this._playlistId}}],[{key:"id",get:function(){return"playlist"}}]),t}(),Ut=function(){function t(e,r){a(this,t),y(this,"_networkRetryConfig",{async:!0,timeout:0,maxAttempts:4}),function(t){t&&"function"==typeof t.getLogger&&(g.get=t.getLogger),t&&t.LogLevel&&(E=t.LogLevel)}(e.logger),this._partnerId=e.partnerId,this._widgetId=e.widgetId,this._uiConfId=e.uiConfId,this._isAnonymous=!e.ks,this._ks=e.ks||"",this._playerVersion=r,this._referrer=e.referrer}return c(t,[{key:"partnerId",get:function(){return this._partnerId}},{key:"widgetId",get:function(){return this._widgetId||this.defaultWidgetId}},{key:"defaultWidgetId",get:function(){return"_"+this._partnerId}},{key:"uiConfId",get:function(){return this._uiConfId}},{key:"ks",get:function(){return this._ks},set:function(t){this._ks=t}},{key:"playerVersion",get:function(){return this._playerVersion}},{key:"isAnonymous",get:function(){return this._isAnonymous}},{key:"getMediaConfig",value:function(t){return Promise.reject(new lt(lt.Severity.CRITICAL,lt.Category.PROVIDER,lt.Code.METHOD_NOT_IMPLEMENTED,{message:"getMediaConfig method must be implement by the derived class"}))}},{key:"getPlaylistConfig",value:function(t){return Promise.reject(new lt(lt.Severity.CRITICAL,lt.Category.PROVIDER,lt.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading playlist by id"}))}},{key:"getEntryListConfig",value:function(t){return Promise.reject(new lt(lt.Severity.CRITICAL,lt.Category.PROVIDER,lt.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading entry list"}))}},{key:"_verifyHasSources",value:function(t){if(0===t.hls.concat(t.dash,t.progressive,t.image,t.document).length)throw new lt(lt.Severity.CRITICAL,lt.Category.SERVICE,lt.Code.MISSING_PLAY_SOURCE,{action:"",messages:"No play source for entry id: ".concat(t.id)})}},{key:"LogLevel",get:function(){return E}},{key:"getLogLevel",value:function(t){return function(t){return _(t).getLevel()}(t)}},{key:"setLogLevel",value:function(t,e){!function(t,e){_(e).setLevel(t)}(t,e)}}]),t}(),Nt=function(){function t(e){a(this,t),y(this,"_response",{playlistItems:{entries:[]}}),this.requests=this.buildRequests(e),this._entries=e.entries}return c(t,[{key:"requests",get:function(){return this._requests},set:function(t){this._requests=t}},{key:"response",get:function(){return this._response},set:function(t){var e,r=this;t.forEach((function(t){e=new C(t.data),r._response.playlistItems.entries.push(e.entries[0])}))}},{key:"buildRequests",value:function(t){var e=b.get(),r=[];return t.entries.forEach((function(n){r.push(mt.list(e.serviceUrl,t.ks,n.entryId||n,t.redirectFromEntryId,n.referenceId))})),r}},{key:"isValid",value:function(){return!(!this._entries||!this._entries.length)}}],[{key:"id",get:function(){return"entry_list"}}]),t}(),jt=function(){function t(){a(this,t)}return c(t,null,[{key:"_applyRegexAction",value:function(t,e){if(t){var r=new RegExp(t.pattern,"i");if(e.match(r))return e.replace(r,t.replacement+"/")}return e}},{key:"_pingECDNAndReplaceHostUrls",value:function(e,r,n){return new Promise((function(i){var a=n+"/api_v3/service/system/action/ping/format/1",s=new XMLHttpRequest;s.open("GET",a),s.timeout=r.checkAliveTimeoutMs,s.onreadystatechange=function(){4===s.readyState&&(200===s.status&&t._replaceHostUrls(e,r),i(e))},s.ontimeout=function(){t._logger.warn("Got timeout while pinging the ECDN url. the ping url: ".concat(a)),i(e)},s.send()}))}},{key:"handleRegexAction",value:function(e,r){return new Promise((function(n){var i=b.get().cdnUrl,a=t._extractRegexActionFromData(r),s=t._getRegExp(a);i&&a&&s&&i.match(s)?a.checkAliveTimeoutMs>0?(t._logger.debug("executing ping request..."),t._pingECDNAndReplaceHostUrls(e,a,i.replace(s,a.replacement)).then(n)):(t._replaceHostUrls(e,a),n(e)):(t._logger.debug("exiting handleRegexAction - not applying regex action."),n(e))}))}},{key:"_replaceHostUrls",value:function(e,r){t._logger.debug("Starting to modify urls...");var n=e.sources,i=n.hls,a=n.dash,s=n.progressive,o=n.image;[].concat(Tt(i),Tt(a),Tt(s),Tt(o)).forEach((function(e){return e.url=t._applyRegexAction(r,e.url)})),b.get().replaceHostOnlyManifestUrls||(t._logger.debug("replaceHostOnlyManifestUrls flag is off - modifying captions and poster URLs"),n.captions&&n.captions.forEach((function(e){return e.url=t._applyRegexAction(r,e.url)})),"string"==typeof n.poster&&(n.poster=t._applyRegexAction(r,n.poster))),t._logger.debug("Finished modifying urls")}},{key:"_extractRegexActionFromData",value:function(t){var e;return null===(e=t.get(Et.id))||void 0===e||null===(e=e.response)||void 0===e?void 0:e.playBackContextResult.getRequestHostRegexAction()}},{key:"_getRegExp",value:function(t){if(t&&t.pattern&&t.replacement)return new RegExp(t.pattern,"i")}}]),t}();y(jt,"_logger",R("RegexActionHandler"));var Vt=jt;var Bt=function(t){d(i,t);var e,r,n=(e=i,r=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}}(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function i(){return a(this,i),n.apply(this,arguments)}return c(i,null,[{key:"get",value:function(t,e){var r=new Map;r.set("Content-Type","application/json");var n=new ft(r);return n.service="user",n.action="get",n.method="POST",n.url=n.getUrl(t),n.tag="user-get",n.params={ks:e,format:1},n}}]),i}(pt),qt=function(){function t(e){a(this,t),this.id=e.id}return c(t,[{key:"isAnonymous",value:function(){return t.INVALID_IDS.includes(this.id)}}]),t}();y(qt,"INVALID_IDS",["0","",null,void 0]);var Ft=function(t){d(o,t);var e,r,n,s=(r=o,n=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}}(),function(){var t,e=p(r);if(n){var i=p(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return h(this,t)});function o(t,e){var r;return a(this,o),y(l(r=s.call(this,t,e)),"_filterOptionsConfig",{redirectFromEntryId:!0}),y(l(r),"_retryAttempts",0),r._logger=R("OVPProvider"),b.set(t.env),r._setFilterOptionsConfig(t.filterOptions),r._vrTag=t.vrTag||"360",r._networkRetryConfig=Object.assign(r._networkRetryConfig,t.networkRetryParameters),r._useHeaderForKs=t.useHeaderForKs||!1,r._isAnonymous=!r._ks||void 0,void 0===r._isAnonymous&&r.initializeUserResponse(b.serviceUrl,r._ks).then((function(){r._logger.info("User response initialized")})).catch((function(t){r._logger.error("Failed to initialize user response",t)})),r}return c(o,[{key:"env",get:function(){return b.get()}},{key:"initializeUserResponse",value:(e=i(m().mark((function t(e,r){var n,i,a;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(n=Bt.get(e,r)).params=JSON.stringify(n.params),t.next=4,n.doHttpRequest();case 4:i=t.sent,a=new qt(i),this._isAnonymous=a.isAnonymous();case 7:case"end":return t.stop()}}),t,this)}))),function(t,r){return e.apply(this,arguments)})},{key:"getMediaConfig",value:function(t){var e=this;return t.ks&&(this.ks=t.ks),this._dataLoader=new Lt(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var i=t.entryId,a=t.referenceId;if(i||a){var s=e.ks;s||(s="{1:result:ks}",e._dataLoader.add(Rt,{widgetId:e.widgetId}));var o=e._getEntryRedirectFilter(t);return e._dataLoader.add(Et,{entryId:i,ks:s,redirectFromEntryId:o,referenceId:a,referrer:e._referrer}),e._dataLoader.fetchData().then((function(t){try{var i=e._parseDataFromResponse(t);Vt.handleRegexAction(i,t).then(r)}catch(t){n(t)}}),(function(t){var e,r,i=null===(e=t.data)||void 0===e||null===(e=e.results)||void 0===e?void 0:e.find((function(t){var e;return"KalturaBaseEntryListResponse"===(null===(e=t.data)||void 0===e?void 0:e.objectType)}));(null==i||null===(r=i.data)||void 0===r||null===(r=r.objects)||void 0===r?void 0:r[0].status)===k.EntryStatus.DELETED&&(t=new lt(lt.Severity.CRITICAL,lt.Category.SERVICE,lt.Code.DELETED_ENTRY)),n(t)}))}n(new lt(lt.Severity.CRITICAL,lt.Category.PROVIDER,lt.Code.MISSING_MANDATORY_PARAMS,{message:"missing entry id"}))}))}},{key:"doRequest",value:function(t,e,r,n){var i=this,a=e||this.ks,s=new Lt(this.playerVersion,this.partnerId,a,this._networkRetryConfig);return new Promise((function(e,o){return a||s.add(Rt,{widgetId:i.widgetId}),t.forEach((function(t){s.add(t.loader,t.params,a||"{1:result:ks}")})),s.fetchData(r,n).then((function(t){try{e(t)}catch(t){o(t)}}),(function(t){o(t)}))}))}},{key:"_getEntryRedirectFilter",value:function(t){return"boolean"==typeof t.redirectFromEntryId?t.redirectFromEntryId:"boolean"!=typeof this._filterOptionsConfig.redirectFromEntryId||this._filterOptionsConfig.redirectFromEntryId}},{key:"_setFilterOptionsConfig",value:function(t){t&&"boolean"==typeof t.redirectFromEntryId&&(this._filterOptionsConfig.redirectFromEntryId=t.redirectFromEntryId)}},{key:"_parseDataFromResponse",value:function(t){this._logger.debug("Data parsing started");var e={session:{isAnonymous:this._isAnonymous,partnerId:this.partnerId},sources:this._getDefaultSourcesObject(),plugins:{}};if(this.uiConfId&&(e.session.uiConfId=this.uiConfId),t){if(t.has(Rt.id)){var r=t.get(Rt.id);r&&r.response&&(e.session.ks=r.response,this.widgetId!==this.defaultWidgetId&&(this.ks=e.session.ks))}else e.session.ks=this.ks;if(t.has(Et.id)){var n=t.get(Et.id);if(n&&n.response){var i=n.response;if(ct.hasBlockAction(i))throw new lt(lt.Severity.CRITICAL,lt.Category.SERVICE,lt.Code.BLOCK_ACTION,{action:ct.getBlockAction(i),messages:ct.getErrorMessages(i)});if(ct.hasScheduledRestriction(i))throw new lt(lt.Severity.CRITICAL,lt.Category.SERVICE,lt.Code.SCHEDULED_RESTRICTED,{messages:ct.getErrorMessages(i)});var a=ct.getMediaEntry(this._useHeaderForKs?"":this.ks,this.partnerId,this.uiConfId,i);Object.assign(e.sources,this._getSourcesObject(a)),this._verifyMediaStatus(a),this._verifyHasSources(e.sources);var s=ct.getBumper(i,this.ks,this.partnerId);s&&Object.assign(e.plugins,{bumper:s})}}}return this._logger.debug("Data parsing finished",e),e}},{key:"_verifyMediaStatus",value:function(t){if([k.EntryStatus.IMPORT,k.EntryStatus.PRECONVERT].includes(t.status))throw new lt(lt.Severity.CRITICAL,lt.Category.SERVICE,lt.Code.MEDIA_STATUS_NOT_READY,{messages:"Status of entry id ".concat(t.id," is ").concat(t.status," and is still being imported or converted"),data:{status:status}})}},{key:"getPlaylistConfig",value:function(t){var e=this;return t.ks&&(this.ks=t.ks),this._dataLoader=new Lt(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var i=t.playlistId;if(i){var a=e.ks;a||(a="{1:result:ks}",e._dataLoader.add(Rt,{widgetId:e.widgetId})),e._dataLoader.add(Mt,{playlistId:i,ks:a}),e._dataLoader.fetchData().then((function(i){try{e._handlePlaylistResponse(i,r,n,t)}catch(t){n(t)}}),(function(t){n(t)}))}else n({success:!1,data:"Missing mandatory parameter"})}))}},{key:"_handlePlaylistResponse",value:function(t,e,r,n){this._logger.debug("Handling playlist response",{attempt:this._retryAttempts+1,maxAttempts:10});var i=this._parsePlaylistDataFromResponse(t);i.items.length>0?this._handlePlaylistSuccess(i,e):this._handlePlaylistRetry(e,r,n)}},{key:"_handlePlaylistSuccess",value:function(t,e){this._logger.debug("Playlist items found",{itemsCount:t.items.length,totalAttempts:this._retryAttempts+1}),this._retryAttempts=0,e(t)}},{key:"_handlePlaylistRetry",value:function(t,e,r){this._retryAttempts>=10?this._handleMaxRetriesReached(e):(this._retryAttempts++,this._schedulePlaylistRetry(t,e,r))}},{key:"_handleMaxRetriesReached",value:function(t){this._logger.error("Max retry attempts reached - rejecting playlist",{maxAttempts:10}),this._retryAttempts=0,t(this._getPlaylistObject())}},{key:"_schedulePlaylistRetry",value:function(t,e,r){var n=this;setTimeout((function(){n._dataLoader=new Lt(n.playerVersion,n.partnerId,n.ks,n._networkRetryConfig);var i=n.ks;i||(i="{1:result:ks}",n._dataLoader.add(Rt,{widgetId:n.widgetId}));var a={playlistId:r.playlistId,ks:i,cacheToken:",".repeat(n._retryAttempts)};n._dataLoader.add(Mt,a),n._dataLoader.fetchData().then((function(i){n._handlePlaylistResponse(i,t,e,r)}),(function(t){e(t)}))}),1e4)}},{key:"_parsePlaylistDataFromResponse",value:function(t){var e=this;this._logger.debug("Data parsing started");var r=this._getPlaylistObject();if(t&&t.has(Mt.id)){var n=t.get(Mt.id);if(n&&n.response){var i=ct.getPlaylist(n.response);r.id=i.id,r.poster=i.poster,r.metadata.name=i.name,r.metadata.description=i.description,r.playlistLastEntryId=i.playlistLastEntryId,i.items.forEach((function(t){return r.items.push({sources:e._getSourcesObject(t)})}))}}return this._logger.debug("Data parsing finished",r),r}},{key:"getEntryListConfig",value:function(t){var e=this;return t.ks&&(this.ks=t.ks),this._dataLoader=new Lt(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var i=t.entries;if(i&&i.length){var a=e.ks;a||(a="{1:result:ks}",e._dataLoader.add(Rt,{widgetId:e.widgetId}));var s=e._getEntryRedirectFilter(t);e._dataLoader.add(Nt,{entries:i,ks:a,redirectFromEntryId:s}),e._dataLoader.fetchData(!1).then((function(t){r(e._parseEntryListDataFromResponse(t))}),(function(t){n(t)}))}else n({success:!1,data:"Missing mandatory parameter"})}))}},{key:"_parseEntryListDataFromResponse",value:function(t){var e=this;this._logger.debug("Data parsing started");var r=this._getPlaylistObject();if(t&&t.has(Nt.id)){var n=t.get(Nt.id);n&&n.response&&ct.getEntryList(n.response).items.forEach((function(t){return r.items.push({sources:e._getSourcesObject(t)})}))}return this._logger.debug("Data parsing finished",r),r}},{key:"_getPlaylistObject",value:function(){return{id:"",metadata:{name:"",description:""},poster:"",playlistLastEntryId:"",items:[]}}},{key:"_getDefaultSourcesObject",value:function(){return{hls:[],dash:[],progressive:[],image:[],document:[],id:"",duration:0,type:Q.Type.UNKNOWN,poster:"",rawThumbnailUrl:"",dvr:!1,vr:null,metadata:{name:"",description:"",tags:""}}}},{key:"_getSourcesObject",value:function(t){var e=this,r=this._getDefaultSourcesObject(),n=t.sources.toJSON();return r.hls=n.hls,r.dash=n.dash,r.progressive=n.progressive,r.image=n.image,r.document=n.document,r.id=t.id,r.duration=t.duration,r.type=t.type,r.dvr=!!t.dvrStatus,r.poster=t.poster,r.rawThumbnailUrl=t.rawThumbnailUrl,r.downloadUrl=t.downloadUrl,r.rootEntryId=t.rootEntryId,r.capabilities=t.capabilities,t.activeLiveStreamTime&&(r.activeLiveStreamTime=t.activeLiveStreamTime),t.sources.captions&&(r.captions=t.sources.captions),t.metadata&&"string"==typeof t.metadata.tags&&t.metadata.tags.split(",").some((function(t){return t.trim()===e._vrTag}))&&(r.vr={}),Object.assign(r.metadata,t.metadata),r}}]),o}(Ut),Ht="@playkit-js/playkit-js-providers-ovp",Kt="2.45.2"}(),n}()}));
3
3
  //# sourceMappingURL=playkit-ovp-provider.js.map
@@ -1,2 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===n(t)?t:String(t)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function s(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e,t,r){return(t=o(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}e.r(t),e.d(t,{NAME:function(){return S},OVPConfiguration:function(){return y},OVPStatsService:function(){return T},RequestBuilder:function(){return l},VERSION:function(){return C}});var a=function(){return{VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:function(){},debug:function(){},enabledFor:function(){},error:function(){},get:function(){},getLevel:function(){},info:function(){},log:function(){},setHandler:function(){},setLevel:function(){},time:function(){},timeEnd:function(){},trace:function(){},useDefaults:function(){},warn:function(){}}};var c=function(e){return a(e)},f=s((function e(t,n,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r(this,e),this.severity=t,this.category=n,this.code=o,this.data=i,e._logger.error("Category:".concat(n," | Code:").concat(o," |"),i)}));u(f,"Severity",{RECOVERABLE:1,CRITICAL:2}),u(f,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),u(f,"Code",{UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,BAD_SERVER_RESPONSE:1005,MULTIREQUEST_API_ERROR:1006,API_RESPONSE_MISMATCH:1007,ERROR:2e3,BLOCK_ACTION:2001,MEDIA_STATUS_NOT_READY:2002,SCHEDULED_RESTRICTED:2003,DELETED_ENTRY:2004,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),u(f,"_logger",c("Error"));var l=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;r(this,e),u(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),u(this,"_attemptCounter",1),this.headers=t}return s(e,[{key:"getUrl",value:function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")}},{key:"doHttpRequest",value:function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t}},{key:"_createXHR",value:function(){var e=this,t=new XMLHttpRequest;t.onreadystatechange=function(){if(4===t.readyState&&200===t.status)try{var r=JSON.parse(t.responseText);return e.responseHeaders=e._getResponseHeaders(t),e._requestPromise.resolve(r)}catch(r){e._requestPromise.reject(e._createError(t,f.Code.BAD_SERVER_RESPONSE,{text:t.responseText}))}},t.open(this.method,this.url,this.retryConfig.async),this.retryConfig.async&&this.retryConfig.timeout&&(t.timeout=this.retryConfig.timeout);var r=performance.now();t.ontimeout=function(){e._handleError(t,f.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,f.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)}},{key:"_getResponseHeaders",value:function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))}},{key:"_handleError",value:function(e,t,r){var n=this._createError(e,t,r);if(e.onreadystatechange=function(){},e.onerror=function(){},e.ontimeout=function(){},e.onabort=function(){},!(this.retryConfig.maxAttempts&&this._attemptCounter<this.retryConfig.maxAttempts))return this._requestPromise.reject(n);this._attemptCounter++,this._createXHR()}},{key:"_createError",value:function(e,t,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(e),attempt:this._attemptCounter}),new f(f.Severity.CRITICAL,f.Category.NETWORK,t,r)}}]),e}(),p=function e(t){var r;return Array.isArray(t)?(r=t.length>0?t.slice(0):[]).forEach((function(t,o){("object"===n(t)||Array.isArray(t)&&t.length>0)&&(r[o]=e(t))})):"object"===n(t)?(r=Object.assign({},t),Object.keys(r).forEach((function(t){("object"===n(r[t])||Array.isArray(r[t])&&r[t].length>0)&&(r[t]=e(r[t]))}))):r=t,r},h={serviceUrl:"https://cdnapisec.kaltura.com/api_v3",cdnUrl:"https://cdnapisec.kaltura.com",serviceParams:{apiVersion:"3.3.0",format:1},useApiCaptions:!0,loadThumbnailWithKs:!1,replaceHostOnlyManifestUrls:!1},y=function(){function e(){r(this,e)}return s(e,null,[{key:"set",value:function(e){null!=e&&e.overrideServiceUrl&&(e.serviceUrl=e.overrideServiceUrl),e&&Object.assign(h,e)}},{key:"get",value:function(){return p(h)}},{key:"serviceUrl",get:function(){return h.serviceUrl}}]),e}();function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}var E=s((function e(t){r(this,e),u(this,"hasError",!1),"KalturaAPIException"===t.objectType?(this.hasError=!0,this.error=new b(t.code,t.message)):t.error&&"KalturaAPIException"===t.error.objectType?(this.hasError=!0,this.error=new b(t.error.code,t.error.message)):this.data=t})),b=s((function e(t,n){r(this,e),this.code=t,this.message=n}));var O=function(e){d(i,e);var t,n,o=(t=i,n=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(e){return!1}}(),function(){var e,r=R(t);if(n){var o=R(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return g(this,e)});function i(){var e;r(this,i);for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return u(m(e=o.call.apply(o,[this].concat(n))),"requests",[]),e}return s(i,[{key:"add",value:function(e){this.requests.push(e);var t={},r={service:e.service,action:e.action};return Object.assign(t,u({},this.requests.length,Object.assign(r,e.params))),Object.assign(t,this.params),this.params=t,this}},{key:"execute",value:function(e,t){var r=this;return new Promise((function(n,o){try{r.params=JSON.stringify(r.params)}catch(e){i._logger.error("".concat(e.message)),o(new f(f.Severity.CRITICAL,f.Category.PROVIDER,f.Code.FAILED_PARSING_REQUEST,{error:e,params:r.params}))}r.doHttpRequest().then((function(i){var s=new _(i,e,t);s.success?n({headers:r.responseHeaders,response:s}):o(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MULTIREQUEST_API_ERROR,{url:r.url,headers:r.responseHeaders,results:s.results}))}),(function(e){o(e)}))}))}}]),i}(l);u(O,"_logger",c("MultiRequestBuilder"));var _=s((function e(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];r(this,e),u(this,"results",[]);var i=t.result?t.result:t,s=(Array.isArray(i)?i:[i]).map((function(e){return new E(e)})),a=s.filter((function(e){return e.hasError}));a.forEach((function(t){e._logger.error("Service returned an error with error code: ".concat(t.error.code," and message: ").concat(t.error.message,"."))})),this.results=s,n&&a.length||a.length===this.results.length?this.success=!1:(o&&(this.results=this.results.filter((function(e){return!e.hasError}))),this.success=!0)}));u(_,"_logger",c("MultiRequestResult"));var T=function(e){d(u,e);var t,o,i=(t=u,o=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(e){return!1}}(),function(){var e,r=R(t);if(o){var n=R(this).constructor;e=Reflect.construct(r,arguments,n)}else e=r.apply(this,arguments);return g(this,e)});function u(){return r(this,u),i.apply(this,arguments)}return s(u,null,[{key:"collect",value:function(e,t,r,o){var i=y.get(),s={};Object.assign(s,i.serviceParams,{ks:t,clientTag:"html5:v"+r},o);var u,a,c,f,p,h=new l;return h.service="stats",h.action="collect",h.method="GET",h.tag="stats-collect",h.params=s,h.url=e+"?service="+h.service+"&action="+h.action+"&"+(u=h.params,a=[],c=/\[\]$/,f=function(e){return"[object Array]"===Object.prototype.toString.call(e)},p=function(e,t){t="function"==typeof t?t():null==t?"":t,a[a.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)},function e(t,r){var o,i,s;if(t)if(f(r))for(o=0,i=r.length;o<i;o++)c.test(t)?p(t,r[o]):e(t+":"+("object"===n(r[o])?o:""),r[o]);else if(r&&"[object Object]"===String(r))for(s in r)e(t+":"+s,r[s]);else p(t,r);else if(f(r))for(o=0,i=r.length;o<i;o++)p(r[o].name,r[o].value);else for(s in r)e(s,r[s]);return a}("",u).join("&").replace(/%20/g,"+")),h}}]),u}(function(){function e(){r(this,e)}return s(e,null,[{key:"getMultiRequest",value:function(e,t,r){var n=y.get(),o=n.serviceParams;Object.assign(o,{ks:t,clientTag:"html5:v"+e}),r&&Object.assign(o,{partnerId:r});var i=new Map;i.set("Content-Type","application/json");var s=new O(i);return s.method="POST",s.service="multirequest",s.url=s.getUrl(n.serviceUrl),s.params=o,s}}]),e}()),S="@playkit-js/playkit-js-providers-stats-service",C="2.45.1";return t}()}));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===n(t)?t:String(t)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function s(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e,t,r){return(t=o(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}e.r(t),e.d(t,{NAME:function(){return S},OVPConfiguration:function(){return y},OVPStatsService:function(){return T},RequestBuilder:function(){return l},VERSION:function(){return C}});var a=function(){return{VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:function(){},debug:function(){},enabledFor:function(){},error:function(){},get:function(){},getLevel:function(){},info:function(){},log:function(){},setHandler:function(){},setLevel:function(){},time:function(){},timeEnd:function(){},trace:function(){},useDefaults:function(){},warn:function(){}}};var c=function(e){return a(e)},f=s((function e(t,n,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r(this,e),this.severity=t,this.category=n,this.code=o,this.data=i,e._logger.error("Category:".concat(n," | Code:").concat(o," |"),i)}));u(f,"Severity",{RECOVERABLE:1,CRITICAL:2}),u(f,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),u(f,"Code",{UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,BAD_SERVER_RESPONSE:1005,MULTIREQUEST_API_ERROR:1006,API_RESPONSE_MISMATCH:1007,ERROR:2e3,BLOCK_ACTION:2001,MEDIA_STATUS_NOT_READY:2002,SCHEDULED_RESTRICTED:2003,DELETED_ENTRY:2004,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),u(f,"_logger",c("Error"));var l=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;r(this,e),u(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),u(this,"_attemptCounter",1),this.headers=t}return s(e,[{key:"getUrl",value:function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")}},{key:"doHttpRequest",value:function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t}},{key:"_createXHR",value:function(){var e=this,t=new XMLHttpRequest;t.onreadystatechange=function(){if(4===t.readyState&&200===t.status)try{var r=JSON.parse(t.responseText);return e.responseHeaders=e._getResponseHeaders(t),e._requestPromise.resolve(r)}catch(r){e._requestPromise.reject(e._createError(t,f.Code.BAD_SERVER_RESPONSE,{text:t.responseText}))}},t.open(this.method,this.url,this.retryConfig.async),this.retryConfig.async&&this.retryConfig.timeout&&(t.timeout=this.retryConfig.timeout);var r=performance.now();t.ontimeout=function(){e._handleError(t,f.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,f.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)}},{key:"_getResponseHeaders",value:function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))}},{key:"_handleError",value:function(e,t,r){var n=this._createError(e,t,r);if(e.onreadystatechange=function(){},e.onerror=function(){},e.ontimeout=function(){},e.onabort=function(){},!(this.retryConfig.maxAttempts&&this._attemptCounter<this.retryConfig.maxAttempts))return this._requestPromise.reject(n);this._attemptCounter++,this._createXHR()}},{key:"_createError",value:function(e,t,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(e),attempt:this._attemptCounter}),new f(f.Severity.CRITICAL,f.Category.NETWORK,t,r)}}]),e}(),p=function e(t){var r;return Array.isArray(t)?(r=t.length>0?t.slice(0):[]).forEach((function(t,o){("object"===n(t)||Array.isArray(t)&&t.length>0)&&(r[o]=e(t))})):"object"===n(t)?(r=Object.assign({},t),Object.keys(r).forEach((function(t){("object"===n(r[t])||Array.isArray(r[t])&&r[t].length>0)&&(r[t]=e(r[t]))}))):r=t,r},h={serviceUrl:"https://cdnapisec.kaltura.com/api_v3",cdnUrl:"https://cdnapisec.kaltura.com",serviceParams:{apiVersion:"3.3.0",format:1},useApiCaptions:!0,loadThumbnailWithKs:!1,replaceHostOnlyManifestUrls:!1},y=function(){function e(){r(this,e)}return s(e,null,[{key:"set",value:function(e){null!=e&&e.overrideServiceUrl&&(e.serviceUrl=e.overrideServiceUrl),e&&Object.assign(h,e)}},{key:"get",value:function(){return p(h)}},{key:"serviceUrl",get:function(){return h.serviceUrl}}]),e}();function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}var E=s((function e(t){r(this,e),u(this,"hasError",!1),"KalturaAPIException"===t.objectType?(this.hasError=!0,this.error=new b(t.code,t.message)):t.error&&"KalturaAPIException"===t.error.objectType?(this.hasError=!0,this.error=new b(t.error.code,t.error.message)):this.data=t})),b=s((function e(t,n){r(this,e),this.code=t,this.message=n}));var O=function(e){d(i,e);var t,n,o=(t=i,n=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(e){return!1}}(),function(){var e,r=R(t);if(n){var o=R(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return g(this,e)});function i(){var e;r(this,i);for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return u(m(e=o.call.apply(o,[this].concat(n))),"requests",[]),e}return s(i,[{key:"add",value:function(e){this.requests.push(e);var t={},r={service:e.service,action:e.action};return Object.assign(t,u({},this.requests.length,Object.assign(r,e.params))),Object.assign(t,this.params),this.params=t,this}},{key:"execute",value:function(e,t){var r=this;return new Promise((function(n,o){try{r.params=JSON.stringify(r.params)}catch(e){i._logger.error("".concat(e.message)),o(new f(f.Severity.CRITICAL,f.Category.PROVIDER,f.Code.FAILED_PARSING_REQUEST,{error:e,params:r.params}))}r.doHttpRequest().then((function(i){var s=new _(i,e,t);s.success?n({headers:r.responseHeaders,response:s}):o(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MULTIREQUEST_API_ERROR,{url:r.url,headers:r.responseHeaders,results:s.results}))}),(function(e){o(e)}))}))}}]),i}(l);u(O,"_logger",c("MultiRequestBuilder"));var _=s((function e(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];r(this,e),u(this,"results",[]);var i=t.result?t.result:t,s=(Array.isArray(i)?i:[i]).map((function(e){return new E(e)})),a=s.filter((function(e){return e.hasError}));a.forEach((function(t){e._logger.error("Service returned an error with error code: ".concat(t.error.code," and message: ").concat(t.error.message,"."))})),this.results=s,n&&a.length||a.length===this.results.length?this.success=!1:(o&&(this.results=this.results.filter((function(e){return!e.hasError}))),this.success=!0)}));u(_,"_logger",c("MultiRequestResult"));var T=function(e){d(u,e);var t,o,i=(t=u,o=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(e){return!1}}(),function(){var e,r=R(t);if(o){var n=R(this).constructor;e=Reflect.construct(r,arguments,n)}else e=r.apply(this,arguments);return g(this,e)});function u(){return r(this,u),i.apply(this,arguments)}return s(u,null,[{key:"collect",value:function(e,t,r,o){var i=y.get(),s={};Object.assign(s,i.serviceParams,{ks:t,clientTag:"html5:v"+r},o);var u,a,c,f,p,h=new l;return h.service="stats",h.action="collect",h.method="GET",h.tag="stats-collect",h.params=s,h.url=e+"?service="+h.service+"&action="+h.action+"&"+(u=h.params,a=[],c=/\[\]$/,f=function(e){return"[object Array]"===Object.prototype.toString.call(e)},p=function(e,t){t="function"==typeof t?t():null==t?"":t,a[a.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)},function e(t,r){var o,i,s;if(t)if(f(r))for(o=0,i=r.length;o<i;o++)c.test(t)?p(t,r[o]):e(t+":"+("object"===n(r[o])?o:""),r[o]);else if(r&&"[object Object]"===String(r))for(s in r)e(t+":"+s,r[s]);else p(t,r);else if(f(r))for(o=0,i=r.length;o<i;o++)p(r[o].name,r[o].value);else for(s in r)e(s,r[s]);return a}("",u).join("&").replace(/%20/g,"+")),h}}]),u}(function(){function e(){r(this,e)}return s(e,null,[{key:"getMultiRequest",value:function(e,t,r){var n=y.get(),o=n.serviceParams;Object.assign(o,{ks:t,clientTag:"html5:v"+e}),r&&Object.assign(o,{partnerId:r});var i=new Map;i.set("Content-Type","application/json");var s=new O(i);return s.method="POST",s.service="multirequest",s.url=s.getUrl(n.serviceUrl),s.params=o,s}}]),e}()),S="@playkit-js/playkit-js-providers-stats-service",C="2.45.2";return t}()}));
2
2
  //# sourceMappingURL=playkit-stats-service.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playkit-js/playkit-js-providers",
3
- "version": "2.45.1",
3
+ "version": "2.45.2",
4
4
  "description": "",
5
5
  "files": [
6
6
  "dist/**/*",