@playkit-js/playkit-js-providers 2.40.1-canary.0-f2a1cb3 → 2.40.2-canary.0-c7a43ae

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.
Files changed (135) hide show
  1. package/dist/index.d.ts +1624 -0
  2. package/dist/playkit-analytics-service.js +1 -1
  3. package/dist/playkit-analytics-service.js.map +1 -1
  4. package/dist/playkit-bookmark-service.js +1 -1
  5. package/dist/playkit-bookmark-service.js.map +1 -1
  6. package/dist/playkit-ott-provider.js +1 -1
  7. package/dist/playkit-ott-provider.js.map +1 -1
  8. package/dist/playkit-ovp-provider.js +1 -1
  9. package/dist/playkit-ovp-provider.js.map +1 -1
  10. package/dist/playkit-stats-service.js +1 -1
  11. package/dist/playkit-stats-service.js.map +1 -1
  12. package/dist/tsdoc-metadata.json +11 -0
  13. package/flow-typed/types/media-config-sources.js +1 -1
  14. package/flow-typed/types/media-sources.js +1 -1
  15. package/package.json +49 -46
  16. package/playkit-analytics-service/package.json +5 -0
  17. package/playkit-bookmark-service/package.json +5 -0
  18. package/playkit-ott-provider/package.json +5 -0
  19. package/playkit-ovp-provider/package.json +5 -0
  20. package/playkit-stats-service/package.json +5 -0
  21. package/src/entities/bumper.ts +21 -0
  22. package/src/entities/drm.ts +47 -0
  23. package/src/entities/entry-list.ts +13 -0
  24. package/src/entities/image-source.ts +36 -0
  25. package/src/entities/media-entry.ts +104 -0
  26. package/src/entities/media-format.ts +47 -0
  27. package/src/entities/media-source.ts +70 -0
  28. package/src/entities/media-sources.ts +79 -0
  29. package/src/entities/playlist.ts +41 -0
  30. package/src/k-provider/common/base-provider-parser.ts +0 -0
  31. package/src/k-provider/common/base-provider.ts +112 -0
  32. package/src/k-provider/common/base-service-result.ts +56 -0
  33. package/src/k-provider/common/data-loader-manager.ts +115 -0
  34. package/src/k-provider/common/multi-request-builder.ts +111 -0
  35. package/src/k-provider/common/response-types/kaltura-access-control-message.ts +21 -0
  36. package/src/k-provider/common/response-types/kaltura-drm-playback-plugin-data.ts +38 -0
  37. package/src/k-provider/ott/config.ts +22 -0
  38. package/src/k-provider/ott/index.ts +14 -0
  39. package/src/k-provider/ott/loaders/asset-list-loader.ts +68 -0
  40. package/src/k-provider/ott/loaders/asset-loader.ts +69 -0
  41. package/src/k-provider/ott/loaders/data-loader-manager.ts +15 -0
  42. package/src/k-provider/ott/loaders/session-loader.ts +62 -0
  43. package/src/k-provider/ott/provider-parser.ts +285 -0
  44. package/src/k-provider/ott/provider.ts +252 -0
  45. package/src/k-provider/ott/response-types/kaltura-asset.ts +105 -0
  46. package/src/k-provider/ott/response-types/kaltura-bumper-playback-plugin-data.ts +27 -0
  47. package/src/k-provider/ott/response-types/kaltura-playback-context.ts +73 -0
  48. package/src/k-provider/ott/response-types/kaltura-playback-source.ts +62 -0
  49. package/src/k-provider/ott/response-types/kaltura-rule-action.ts +25 -0
  50. package/src/k-provider/ott/services/asset-service.ts +50 -0
  51. package/src/k-provider/ott/services/bookmark/bookmark-service.ts +48 -0
  52. package/src/k-provider/ott/services/bookmark/index.ts +11 -0
  53. package/src/k-provider/ott/services/ott-service.ts +33 -0
  54. package/src/k-provider/ott/services/user-service.ts +31 -0
  55. package/src/k-provider/ovp/config.ts +28 -0
  56. package/src/k-provider/ovp/external-captions-builder.ts +37 -0
  57. package/src/k-provider/ovp/index.ts +13 -0
  58. package/src/k-provider/ovp/loaders/data-loader-manager.ts +17 -0
  59. package/src/k-provider/ovp/loaders/entry-list-loader.ts +69 -0
  60. package/src/k-provider/ovp/loaders/media-entry-loader.ts +84 -0
  61. package/src/k-provider/ovp/loaders/playlist-loader.ts +69 -0
  62. package/src/k-provider/ovp/loaders/session-loader.ts +62 -0
  63. package/src/k-provider/ovp/loaders/ui-config-loader.ts +71 -0
  64. package/src/k-provider/ovp/play-source-url-builder.ts +59 -0
  65. package/src/k-provider/ovp/provider-parser.ts +461 -0
  66. package/src/k-provider/ovp/provider.ts +358 -0
  67. package/src/k-provider/ovp/regex-action-handler.ts +149 -0
  68. package/src/k-provider/ovp/request-params/base-entry-response-profile.ts +28 -0
  69. package/src/k-provider/ovp/response-types/index.ts +21 -0
  70. package/src/k-provider/ovp/response-types/kaltura-access-control-modify-request-host-regex-action.ts +35 -0
  71. package/src/k-provider/ovp/response-types/kaltura-base-entry-list-response.ts +30 -0
  72. package/src/k-provider/ovp/response-types/kaltura-bumper.ts +25 -0
  73. package/src/k-provider/ovp/response-types/kaltura-flavor-asset.ts +108 -0
  74. package/src/k-provider/ovp/response-types/kaltura-media-entries.ts +28 -0
  75. package/src/k-provider/ovp/response-types/kaltura-media-entry.ts +189 -0
  76. package/src/k-provider/ovp/response-types/kaltura-metadata-list-response.ts +22 -0
  77. package/src/k-provider/ovp/response-types/kaltura-metadata.ts +50 -0
  78. package/src/k-provider/ovp/response-types/kaltura-playback-context.ts +95 -0
  79. package/src/k-provider/ovp/response-types/kaltura-playback-source.ts +89 -0
  80. package/src/k-provider/ovp/response-types/kaltura-playlist.ts +33 -0
  81. package/src/k-provider/ovp/response-types/kaltura-rule-action.ts +27 -0
  82. package/src/k-provider/ovp/response-types/kaltura-ui-conf-response.ts +89 -0
  83. package/src/k-provider/ovp/response-types/kaltura-user-entry-list-response.ts +30 -0
  84. package/src/k-provider/ovp/response-types/kaltura-user-entry.ts +57 -0
  85. package/src/k-provider/ovp/services/analytics/analytics-service.ts +58 -0
  86. package/src/k-provider/ovp/services/analytics/index.ts +11 -0
  87. package/src/k-provider/ovp/services/base-entry-service.ts +75 -0
  88. package/src/k-provider/ovp/services/meta-data-service.ts +29 -0
  89. package/src/k-provider/ovp/services/ovp-service.ts +32 -0
  90. package/src/k-provider/ovp/services/playlist-service.ts +95 -0
  91. package/src/k-provider/ovp/services/session-service.ts +27 -0
  92. package/src/k-provider/ovp/services/stats/index.ts +11 -0
  93. package/src/k-provider/ovp/services/stats/stats-service.ts +32 -0
  94. package/src/k-provider/ovp/services/ui-conf-service.ts +32 -0
  95. package/src/types/adapter-data-config.ts +1 -0
  96. package/src/types/caption-type.ts +1 -0
  97. package/src/types/drm-data.ts +5 -0
  98. package/src/types/entry-list.ts +6 -0
  99. package/src/types/env-config.ts +7 -0
  100. package/src/types/external-caption-object.ts +7 -0
  101. package/src/types/filter-options.ts +3 -0
  102. package/src/types/index.ts +34 -0
  103. package/src/types/loader.ts +7 -0
  104. package/src/types/media-config-metadata.ts +13 -0
  105. package/src/types/media-config-session.ts +6 -0
  106. package/src/types/media-config-sources.ts +20 -0
  107. package/src/types/media-config.ts +8 -0
  108. package/src/types/media-entry.ts +16 -0
  109. package/src/types/media-format.ts +5 -0
  110. package/src/types/media-info.ts +21 -0
  111. package/src/types/media-source.ts +12 -0
  112. package/src/types/media-sources.ts +11 -0
  113. package/src/types/network-retry-parameters.ts +5 -0
  114. package/src/types/playback-context.ts +10 -0
  115. package/src/types/playlist-info.ts +4 -0
  116. package/src/types/playlist-item.ts +5 -0
  117. package/src/types/playlist-metadata.ts +4 -0
  118. package/src/types/playlist.ts +10 -0
  119. package/src/types/poster.ts +5 -0
  120. package/src/types/provider-options.ts +17 -0
  121. package/src/types/request-loader.ts +6 -0
  122. package/src/util/clone.ts +23 -0
  123. package/src/util/error/category.ts +11 -0
  124. package/src/util/error/code.ts +77 -0
  125. package/src/util/error/error.ts +47 -0
  126. package/src/util/error/severity.ts +21 -0
  127. package/src/util/logger.ts +108 -0
  128. package/src/util/param.ts +45 -0
  129. package/src/util/request-builder.ts +187 -0
  130. package/src/util/xml-parser.ts +39 -0
  131. package/CHANGELOG.md +0 -959
  132. package/samples/ott/bookmark.html +0 -23
  133. package/samples/ott/provider.html +0 -28
  134. package/samples/ovp/provider.html +0 -30
  135. package/samples/ovp/stats.html +0 -17
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ovp=t():(e.playkit=e.playkit||{},e.playkit.providers=e.playkit.providers||{},e.playkit.providers.ovp=t())}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=18)}([function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(2);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var i=function e(t,r,n,a){void 0===a&&(a={}),this.severity=t,this.category=r,this.code=n,this.data=a,e._logger.error("Category:"+r+" | Code:"+n+" |",a)};a(i,"Severity",{RECOVERABLE:1,CRITICAL:2}),a(i,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),a(i,"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,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),a(i,"_logger",Object(n.b)("Error"))},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(8);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var i=function(){function e(){this.metadata=new Map,this.sources=new n.a,this.type=e.Type.UNKNOWN}return e.prototype.toJSON=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}},e}();a(i,"Type",{VOD:"Vod",LIVE:"Live",IMAGE:"Image",AUDIO:"Audio",UNKNOWN:"Unknown"}),a(i,"DvrStatus",{ON:1,OFF:0})},function(e,t,r){"use strict";r.d(t,"c",(function(){return o})),r.d(t,"d",(function(){return u})),r.d(t,"e",(function(){return i})),r.d(t,"a",(function(){return a}));var n={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(){}}}},a={};function i(e){e&&"function"==typeof e.getLogger&&(n.get=e.getLogger),e&&e.LogLevel&&(a=e.LogLevel)}function s(e){return n.get(e)}function o(e){return s(e).getLevel()}function u(e,t){s(t).setLevel(e)}t.b=s},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(0);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var i=function(){function e(e){void 0===e&&(e=new Map),a(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),a(this,"_attemptCounter",1),this.headers=e}var t=e.prototype;return t.getUrl=function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")},t.doHttpRequest=function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new n.a(n.a.Severity.CRITICAL,n.a.Category.NETWORK,n.a.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t},t._createXHR=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,n.a.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,n.a.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,n.a.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)},t._getResponseHeaders=function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))},t._handleError=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()},t._createError=function(e,t,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(e),attempt:this._attemptCounter}),new n.a(n.a.Severity.CRITICAL,n.a.Category.NETWORK,t,r)},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(e){var t,r,n;n=!1,(r="hasError")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,"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=function(e,t){this.code=e,this.message=t}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return a})),r.d(t,"c",(function(){return i}));var n={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"}},a=new Map([["mpegdash",n.DASH],["applehttp",n.HLS],["url",n.MP4]]);function i(e){var t=a.get(e);return!!t&&t.name===n.MP4.name}},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n,a,i,s=function(e){this.scheme=e.scheme,this.licenseURL=e.licenseURL,this.certificate=e.certificate};i={"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"},(a="Scheme")in(n=s)?Object.defineProperty(n,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[a]=i},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(e){this.message=e.message,this.code=e.code}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));r(9);var n=r(5),a=(r(13),function(){function e(){this.progressive=[],this.dash=[],this.hls=[],this.image=[]}var t=e.prototype;return t.map=function(e,t){if(t)switch(t.name){case n.a.MP4.name:this.progressive.push(e);break;case n.a.DASH.name:this.dash.push(e);break;case n.a.HLS.name:this.hls.push(e)}},t.toJSON=function(){var e={progressive:[],dash:[],hls:[],image:[]};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},e}())},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));r(12);var n=function(){function e(){}return e.prototype.toJSON=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},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));r(11);var n=r(0);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var i=function(){function e(e){a(this,"_loadersResponseMap",new Map),a(this,"_loaders",new Map),this._networkRetryConfig=e}var t=e.prototype;return t.add=function(e,t,r){var n=this,a=new e(t);if(a.isValid()){this._loaders.set(e.id,a);var i=this._multiRequest.requests.length,s=a.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 o=Array.from(new Array(s.length),(function(e,t){return t+i}));this._loadersResponseMap.set(e.id,o)}},t.fetchData=function(e){var t=this;return new Promise((function(r,a){t._multiRequest.execute(e).then((function(e){t._multiResponse=e.response,t.prepareData(e.response).success?r(t._loaders):a(new n.a(n.a.Severity.CRITICAL,n.a.Category.NETWORK,n.a.Code.API_RESPONSE_MISMATCH,{headers:e.headers}))}),(function(e){a(e)}))}))},t.prepareData=function(e){var t=this;return this._loaders.forEach((function(r,n){var a=t._loadersResponseMap.get(n);try{a&&a.length>0&&(r.response=e.results.slice(a[0],a[a.length-1]+1))}catch(e){return{success:!1,error:e}}})),{success:!0,data:this._loaders}},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(3),a=r(2),i=r(4),s=r(0);function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var c=function(e){var t,r;function n(){for(var t,r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return u(o(t=e.call.apply(e,[this].concat(n))||this),"requests",[]),t}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var a=n.prototype;return a.add=function(e){var t;this.requests.push(e);var r={},n={service:e.service,action:e.action};return Object.assign(r,((t={})[this.requests.length]=Object.assign(n,e.params),t)),Object.assign(r,this.params),this.params=r,this},a.execute=function(e){var t=this;return new Promise((function(r,a){try{t.params=JSON.stringify(t.params)}catch(e){n._logger.error(""+e.message),a(new s.a(s.a.Severity.CRITICAL,s.a.Category.PROVIDER,s.a.Code.FAILED_PARSING_REQUEST,{error:e,params:t.params}))}t.doHttpRequest().then((function(n){var i=new l(n,e);i.success?r({headers:t.responseHeaders,response:i}):a(new s.a(s.a.Severity.CRITICAL,s.a.Category.NETWORK,s.a.Code.MULTIREQUEST_API_ERROR,{url:t.url,headers:t.responseHeaders,results:i.results}))}),(function(e){a(e)}))}))},n}(n.a);u(c,"_logger",Object(a.b)("MultiRequestBuilder"));var l=function e(t,r){void 0===r&&(r=!0),u(this,"results",[]);var n=t.result?t.result:t,a=(Array.isArray(n)?n:[n]).map((function(e){return new i.a(e)})),s=a.filter((function(e){return e.hasError}));s.forEach((function(t){e._logger.error("Service returned an error with error code: "+t.error.code+" and message: "+t.error.message+".")})),this.results=a,r&&s.length||s.length===this.results.length?this.success=!1:(this.results=this.results.filter((function(e){return!e.hasError})),this.success=!0)};u(l,"_logger",Object(a.b)("MultiRequestResult"))},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(){function e(e,t,r){this.licenseUrl=e,this.scheme=t,r&&(this.certificate=r)}return e.prototype.toJSON=function(){var e={licenseUrl:this.licenseUrl,scheme:this.scheme};return this.certificate&&(e.certificate=this.certificate),e},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(){function e(t){this.id=t.id,this.url=e.extractBaseThumbnailUrl(t.dataUrl),this.mimetype=""}return e.extractBaseThumbnailUrl=function(e){return e.match(".+entry_id/[a-zA-Z0-9_]+/")[0].slice(0,-1)},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(2),a=(r(10),r(0));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,n.key,n)}}function s(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),e}var o=function(){function e(e,t){var r,a,i;i={async:!0,timeout:0,maxAttempts:4},(a="_networkRetryConfig")in(r=this)?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i,Object(n.e)(e.logger),this._partnerId=e.partnerId,this._widgetId=e.widgetId,this._uiConfId=e.uiConfId,this._isAnonymous=!e.ks,this._ks=e.ks||"",this._playerVersion=t}s(e,[{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}}]);var t=e.prototype;return t.getMediaConfig=function(e){return Promise.reject(new a.a(a.a.Severity.CRITICAL,a.a.Category.PROVIDER,a.a.Code.METHOD_NOT_IMPLEMENTED,{message:"getMediaConfig method must be implement by the derived class"}))},t.getPlaylistConfig=function(e){return Promise.reject(new a.a(a.a.Severity.CRITICAL,a.a.Category.PROVIDER,a.a.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading playlist by id"}))},t.getEntryListConfig=function(e){return Promise.reject(new a.a(a.a.Severity.CRITICAL,a.a.Category.PROVIDER,a.a.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading entry list"}))},t._verifyHasSources=function(e){if(0===e.hls.concat(e.dash,e.progressive,e.image).length)throw new a.a(a.a.Severity.CRITICAL,a.a.Category.SERVICE,a.a.Code.MISSING_PLAY_SOURCE,{action:"",messages:"No play source for entry id: "+e.id})},t.getLogLevel=function(e){return Object(n.c)(e)},t.setLogLevel=function(e,t){Object(n.d)(e,t)},s(e,[{key:"LogLevel",get:function(){return n.a}}]),e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function e(t){var r;return Array.isArray(t)?(r=t.length>0?t.slice(0):[]).forEach((function(t,n){("object"==typeof t&&t!=={}||Array.isArray(t)&&t.length>0)&&(r[n]=e(t))})):"object"==typeof t?(r=Object.assign({},t),Object.keys(r).forEach((function(t){("object"==typeof r[t]&&r[t]!=={}||Array.isArray(r[t])&&r[t].length>0)&&(r[t]=e(r[t]))}))):r=t,r}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));r(1);var n=function(){this.items=[]}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(e){this.url=e.url,this.clickThroughUrl=e.clickThroughUrl}},function(e,t,r){"use strict";r.r(t),r.d(t,"Provider",(function(){return Te})),r.d(t,"ProviderParser",(function(){return K})),r.d(t,"NAME",(function(){return Oe})),r.d(t,"VERSION",(function(){return Ae})),r.d(t,"RequestBuilder",(function(){return W.a})),r.d(t,"ResponseTypes",(function(){return n}));var n={};r.r(n),r.d(n,"KalturaBaseEntryListResponse",(function(){return Z})),r.d(n,"KalturaMediaEntry",(function(){return A})),r.d(n,"KalturaAccessControlModifyRequestHostRegexAction",(function(){return g})),r.d(n,"KalturaBumper",(function(){return v})),r.d(n,"KalturaFlavorAsset",(function(){return m})),r.d(n,"KalturaMediaEntries",(function(){return oe})),r.d(n,"KalturaMetadata",(function(){return R})),r.d(n,"KalturaMetadataListResponse",(function(){return T})),r.d(n,"KalturaPlaybackContext",(function(){return I})),r.d(n,"KalturaPlaybackSource",(function(){return d})),r.d(n,"KalturaPlaylist",(function(){return se})),r.d(n,"KalturaRuleAction",(function(){return y})),r.d(n,"KalturaUIConfResponse",(function(){return ve})),r.d(n,"KalturaDrmPlaybackPluginData",(function(){return l.a})),r.d(n,"KalturaAccessControlMessage",(function(){return c.a})),r.d(n,"BaseServiceResult",(function(){return u.a}));var a=r(2),i=r(15),s={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},o=function(){function e(){}return e.set=function(e){e&&Object.assign(s,e)},e.get=function(){return Object(i.a)(s)},e}(),u=r(4),c=r(7),l=r(6);var d=function(){function e(e){var t,r,n,a=this;n=[],(r="drm")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,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(e){return a.drm.push(new l.a(e))}))}var t=e.prototype;return t.hasDrmData=function(){return this.drm&&this.drm.length>0},t.hasFlavorIds=function(){return!!this.flavorIds&&this.flavorIds.length>0},t.getProtocol=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},e}();var p,f,h,y=function(e){this.type=e.type};h={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},(f="Type")in(p=y)?Object.defineProperty(p,f,{value:h,enumerable:!0,configurable:!0,writable:!0}):p[f]=h;var g=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).pattern=t.pattern,r.replacement=t.replacement,r.replacmenServerNodeId=t.replacmenServerNodeId,r.checkAliveTimeoutMs=t.checkAliveTimeoutMs,r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(y);var m=function(e){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};!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(m,"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 v=function(e){this.entryId=e.entryId,this.clickThroughUrl=e.url,this.sources=e.sources?e.sources.map((function(e){return new d(e)})):[]};function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var I=function(e){var t,r;function n(t){var r;if(E(_(r=e.call(this,t)||this),"sources",[]),E(_(r),"actions",[]),E(_(r),"messages",[]),E(_(r),"flavorAssets",[]),E(_(r),"bumperData",[]),!r.hasError){var n=t.messages;n&&n.map((function(e){return r.messages.push(new c.a(e))}));var a=t.actions;a&&a.map((function(e){e.type===y.Type.REQUEST_HOST_REGEX?r.actions.push(new g(e)):r.actions.push(new y(e))}));var i=t.sources;i&&i.map((function(e){return r.sources.push(new d(e))}));var s=t.flavorAssets;s&&s.map((function(e){return r.flavorAssets.push(new m(e))}));var o=t.bumperData;o&&o.map((function(e){return r.bumperData.push(new v(e))}))}return r}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var a=n.prototype;return a.hasBlockAction=function(){return void 0!==this.getBlockAction()},a.getBlockAction=function(){return this.actions.find((function(e){return e.type===y.Type.BLOCK}))},a.getErrorMessages=function(){return this.messages},a.getRequestHostRegexAction=function(){var e=this.actions.find((function(e){return e.type===y.Type.REQUEST_HOST_REGEX}));if(e instanceof g)return e},n}(u.a);function b(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var R=function(e){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};b(R,"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}),b(R,"Status",{VALID:1,INVALID:2,DELETED:3});var T=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).hasError||(r.totalCount=t.totalCount,r.totalCount>0&&(r.metas=[],t.objects.map((function(e){return r.metas.push(new R(e))})))),r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(u.a);function O(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var A=function(e){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.status=e.status,this.dvrStatus=e.dvrStatus,this.tags=e.tags,this.createdAt=e.createdAt,this.updatedAt=e.updatedAt,this.creatorId=e.creatorId,this.endDate=e.endDate,this.plays=e.plays,this.views=e.views,this.downloadUrl=e.downloadUrl};O(A,"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}}),O(A,"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}}),O(A,"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}),O(A,"EntryModerationStatus",{PENDING_MODERATION:1,APPROVED:2,REJECTED:3,FLAGGED_FOR_REVIEW:4,MODERATE:5,AUTO_APPROVED:6});var C=function(e){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},w=function(){function e(){}return e.build=function(e){var t=o.get(),r=t.serviceUrl.substr(0,t.serviceUrl.lastIndexOf("/")),n=e.partnerId,a=e.entryId,i=e.ks,s=e.uiConfId,u=e.format,c=e.protocol,l=e.extension,d=e.flavorIds;if(!r||isNaN(Number.parseInt(n))||!a||!u||!c)return"";var p=r;return r.endsWith("/")||(p+="/"),p+="p/"+n+"/sp/"+n+"00/playManifest/entryId/"+a+"/protocol/"+c+"/format/"+u,d?p+="/flavorIds/"+d:s&&(p+="/uiConfId/"+s),""!==i&&(p+="/ks/"+i),""!==l&&(p+="/a."+l),s&&""!==d&&(p+="?uiConfId="+s),p},e}(),P=function(){function e(){}return e.xmlToJson=function(e){var t={};if(1===e.nodeType){if(e.attributes.length>0){t["@attributes"]={};for(var r=0;r<e.attributes.length;r++){var n=e.attributes.item(r);t["@attributes"][n.nodeName]=n.nodeValue}}}else 3===e.nodeType&&(t=e.nodeValue);if(e.hasChildNodes())for(var a=0;a<e.childNodes.length;a++){var i=e.childNodes.item(a),s=i.nodeName;if(void 0===t[s])t[s]=this.xmlToJson(i);else{if(void 0===t[s].push){var o=t[s];t[s]=[],t[s].push(o)}t[s].push(this.xmlToJson(i))}}return t},e}(),S=r(1),D=r(12),M=r(9),k=r(8),L=r(5),N=function(){this.items=[]},U=r(16),j=r(17),x={SRT:"1",DFXP:"2",WEBVTT:"3",CAP:"4"},V={3:"vtt",1:"srt"},F=function(){function e(){}return e.createConfig=function(e,t){return e.map((function(e){var r=e.url,n=V[e.format];return[x.DFXP,x.CAP].includes(e.format)&&(r=e.webVttUrl,n=V[x.WEBVTT]),r=B(r,t),{default:!!e.isDefault,type:n,language:e.languageCode,label:e.label,url:r}}))},e}(),q=r(13);var H=function(){function e(){}return e.getMediaEntry=function(t,r,n,a){var i=new S.a,s=a.entry,u=a.playBackContextResult,c=a.metadataListResult,l=u.sources;return i.sources=e._getParsedSources(l,t,r,n,s,u),e._fillBaseData(i,s,c),i.type!==S.a.Type.LIVE&&o.get().useApiCaptions&&u.data.playbackCaptions&&(i.sources.captions=F.createConfig(u.data.playbackCaptions,t)),i},e.addKsToUrl=function(e,t){var r;return t?(r=-1!==e.split("?")[0].replace(/^.*[\\/]/,"").indexOf(".")?-1===e.indexOf("?")?"?ks=":"&ks=":"/ks/",e+r+t):e},e.getPlaylist=function(t){var r=new N,n=t.playlistData,a=t.playlistItems.entries,i=t.playlistUserEntries.entries;return r.id=n.id,r.name=n.name,r.description=n.description,r.poster=n.poster,r.playlistLastEntryId=i.map((function(e){return e.playlistLastEntryId}))[0],a.forEach((function(t){var n=new S.a;e._fillBaseData(n,t),r.items.push(n)})),r},e.getEntryList=function(t){var r=new U.a;return t.playlistItems.entries.forEach((function(t){var n=new S.a;e._fillBaseData(n,t),r.items.push(n)})),r},e.getBumper=function(t,r,n){var a=t.playBackContextResult,i=a.bumperData[0];if(i){var s=(i&&i.sources).find((function(e){return Object(L.c)(e.format)}));if(s){var o=e._parseProgressiveSources(s,a,r,n,0,i.entryId);if(o[0])return new j.a({url:o[0].url,clickThroughUrl:i.clickThroughUrl})}}},e._fillBaseData=function(t,r,n){return t.poster=r.poster,t.id=r.id,t.duration=r.duration,t.downloadUrl=r.downloadUrl||"",t.metadata=e._parseMetadata(n),t.metadata.description=r.description||"",t.metadata.entryId=r.id||"",t.metadata.name=r.name||"",r.createdAt&&(t.metadata.createdAt=r.createdAt),r.updatedAt&&(t.metadata.updatedAt=r.updatedAt),r.creatorId&&(t.metadata.creatorId=r.creatorId),r.endDate&&(t.metadata.endDate=r.endDate),r.views&&(t.metadata.views=r.views),r.plays&&(t.metadata.plays=r.plays),t.metadata.tags=r.tags||"",t.status=r.status,t.type=e._getEntryType(r.entryType,r.type),t.type===S.a.Type.LIVE&&(t.dvrStatus=r.dvrStatus),t},e._getEntryType=function(e,t){var r=S.a.Type.UNKNOWN;switch(e){case A.MediaType.IMAGE.value:r=S.a.Type.IMAGE;break;case A.MediaType.AUDIO.value:r=S.a.Type.AUDIO;break;default:switch(t){case A.EntryType.MEDIA_CLIP.value:r=S.a.Type.VOD;break;case A.EntryType.LIVE_STREAM.value:case A.EntryType.LIVE_CHANNEL.value:r=S.a.Type.LIVE;break;default:r=S.a.Type.UNKNOWN}}return r},e._getParsedSources=function(t,r,n,a,i,s){var o,u,c=new k.a,l=function(t){var o=e._parseAdaptiveSource(t,s,r,n,a,i.id);if(o){var u=L.b.get(t.format);c.map(o,u)}};return i.type===A.EntryType.EXTERNAL_MEDIA.value?((u=new M.a).mimetype="video/youtube",u.url=i.referenceId,u.id=i.id+"_youtube",c.progressive.push(u)):i.entryType===A.MediaType.IMAGE.value?c.image.push(new q.a(i)):t&&t.length>0&&(t.filter((function(e){return!Object(L.c)(e.format)})).forEach(l),o=t.find((function(t){return Object(L.c)(t.format)&&""!==t.getProtocol(e._getBaseProtocol())})),c.progressive=e._parseProgressiveSources(o,s,r,n,a,i.id)),c},e._parseAdaptiveSource=function(t,r,n,a,i,s){var o=new M.a;if(t){var u="",c=L.b.get(t.format),d=t.getProtocol(e._getBaseProtocol()),p=t.deliveryProfileId,f=t.format,h="";if(c&&(h=c.pathExt,o.mimetype=c.mimeType),t.hasFlavorIds()?(!h&&r.flavorAssets&&r.flavorAssets.length>0&&(h=r.flavorAssets[0].fileExt),u=w.build({entryId:s,flavorIds:t.flavorIds,format:f,ks:n,partnerId:a,uiConfId:i,extension:h,protocol:d})):u=e.addKsToUrl(t.url,n),!u){var y="failed to create play url from source, discarding source: ("+s+"_"+p+"), "+f;return e._logger.warn(y),null}if(o.url=u,o.id=s+"_"+p+","+f,t.hasDrmData()){var g=[];t.drm.forEach((function(e){g.push(new D.a(e.licenseURL,l.a.Scheme[e.scheme],e.certificate))})),o.drmData=g}}return o},e._parseProgressiveSources=function(t,r,n,a,i,s){var o=[],u=[];if(t){var c=t.getProtocol(e._getBaseProtocol()),l=t.format,d=t.deliveryProfileId,p=d+","+l;r.flavorAssets.map((function(t){var r=new M.a;r.id=t.id+p,r.mimetype="mp3"===t.fileExt?"audio/mp3":"video/mp4",r.height=t.height,r.width=t.width,r.bandwidth=1024*t.bitrate,r.label=t.label||t.language;var f=w.build({entryId:s,flavorIds:t.id,format:l,ks:n,partnerId:a,uiConfId:i,extension:t.fileExt,protocol:c});if(""===f)return e._logger.warn("failed to create play url from source, discarding source: ("+s+"_"+d+"), "+l+"."),null;r.url=f,t.height&&t.width?o.push(r):u.push(r)}))}return u.length&&!o.length?u:o},e._parseMetadata=function(e){var t={};return e&&e.metas&&e.metas.length>0&&e.metas.forEach((function(e){if(e.xml){var r,n=new DOMParser;e.xml=e.xml.replace(/\r?\n|\r/g,""),e.xml=e.xml.replace(/>\s*/g,">"),e.xml=e.xml.replace(/>\s*/g,">"),r=n.parseFromString(e.xml,"text/xml");var a=P.xmlToJson(r);Object.keys(a.metadata).forEach((function(e){t[e]=a.metadata[e]["#text"]}))}})),t},e._getBaseProtocol=function(){var e=o.get(),t=/^https?:/.exec(e.cdnUrl),r=t?t[0]:document.location.protocol;return"string"==typeof r?r.slice(0,-1):"https"},e.hasBlockAction=function(e){return e.playBackContextResult.hasBlockAction()},e.getBlockAction=function(e){return e.playBackContextResult.getBlockAction()},e.getErrorMessages=function(e){return e.playBackContextResult.getErrorMessages()},e}();!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(H,"_logger",Object(a.b)("OVPProviderParser"));var B=H.addKsToUrl,K=H,W=r(3),G=r(11),Y=function(){function e(){}return e.getMultiRequest=function(e,t,r){var n=o.get(),a=n.serviceParams;Object.assign(a,{ks:t,clientTag:"html5:v"+e}),r&&Object.assign(a,{partnerId:r});var i=new Map;i.set("Content-Type","application/json");var s=new G.a(i);return s.method="POST",s.service="multirequest",s.url=s.getUrl(n.serviceUrl),s.params=a,s},e}();var J=function e(t){void 0===t&&(t={}),this.type=t.type||e.Type.INCLUDE_FIELDS,this.fields=t.fields||"id,referenceId,name,description,thumbnailUrl,dataUrl,duration,msDuration,flavorParamsIds,mediaType,type,tags,dvrStatus,externalSourceType,status,createdAt,updatedAt,endDate,plays,views,downloadUrl,creatorId"};!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(J,"Type",{INCLUDE_FIELDS:1,EXCLUDE_FIELDS:2});var X=function(e){var t,r;function n(){return e.apply(this,arguments)||this}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.getPlaybackContext=function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var a=new W.a(n);a.service="baseEntry",a.action="getPlaybackContext",a.method="POST",a.url=a.getUrl(e),a.tag="baseEntry-getPlaybackContext";return a.params={entryId:r,ks:t,contextDataParams:{objectType:"KalturaContextDataParams",flavorTags:"all"}},a},n.list=function(e,t,r,a,i){var s=new Map;s.set("Content-Type","application/json");var o=new W.a(s);return o.service="baseEntry",o.action="list",o.method="POST",o.url=o.getUrl(e),o.tag="list",o.params=n.getEntryListReqParams(r,t,a,i),o},n.getEntryListReqParams=function(e,t,r,n){var a={};return e?a=r?{redirectFromEntryId:e}:{idEqual:e}:n&&(a={objectType:"KalturaBaseEntryFilter",referenceIdEqual:n}),{ks:t,filter:a,responseProfile:new J}},n}(Y);var Q=function(e){var t,r;function n(){return e.apply(this,arguments)||this}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.list=function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var a=new W.a(n);a.service="metadata_metadata",a.action="list",a.method="POST",a.url=a.getUrl(e),a.tag="metadata_metadata-list";var i={objectType:"KalturaMetadataFilter",objectIdEqual:r,metadataObjectTypeEqual:"1"};return a.params={filter:i,ks:t},a},n}(Y);var Z=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).hasError||(r.totalCount=t.totalCount,r.totalCount>0&&(r.entries=[],t.objects.map((function(e){return r.entries.push(new A(e))})))),r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(u.a);function z(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,n.key,n)}}function $(e,t,r){return t&&z(e.prototype,t),r&&z(e,r),e}var ee=function(){function e(e){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"_response",{}),this.requests=this.buildRequests(e),this._entryId=e.entryId,this._referenceId=e.referenceId}$(e,null,[{key:"id",get:function(){return"media"}}]);var t=e.prototype;return t.buildRequests=function(e){var t=o.get(),r=[];r.push(X.list(t.serviceUrl,e.ks,e.entryId,e.redirectFromEntryId,e.referenceId));var n="{1:result:ks}"===e.ks?"{2:result:objects:0:id}":"{1:result:objects:0:id}";return r.push(X.getPlaybackContext(t.serviceUrl,e.ks,n)),r.push(Q.list(t.serviceUrl,e.ks,n)),r},t.isValid=function(){return!(!this._entryId&&!this._referenceId)},$(e,[{key:"requests",set:function(e){this._requests=e},get:function(){return this._requests}},{key:"response",set:function(e){var t=new Z(e[0].data);this._response.entry=t.entries[0],this._response.playBackContextResult=new I(e[1].data),this._response.metadataListResult=new T(e[2].data)},get:function(){return this._response}}]),e}();var te=function(e){var t,r;function n(){return e.apply(this,arguments)||this}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.anonymousSession=function(e,t){var r=new Map;r.set("Content-Type","application/json");var n=new W.a(r);return n.service="session",n.action="startWidgetSession",n.method="POST",n.url=n.getUrl(e),n.tag="session-startWidget",n.params={widgetId:t},n},n}(Y);function re(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,n.key,n)}}var ne=function(){var e,t,r;function n(e){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"_response",{}),this.requests=this.buildRequests(e),this._widgetId=e.widgetId}e=n,r=[{key:"id",get:function(){return"session"}}],(t=[{key:"requests",set:function(e){this._requests=e},get:function(){return this._requests}},{key:"response",set:function(e){this._response.ks=e[0].data.ks},get:function(){return this._response.ks}}])&&re(e.prototype,t),r&&re(e,r);var a=n.prototype;return a.buildRequests=function(e){var t=o.get(),r=[];return r.push(te.anonymousSession(t.serviceUrl,e.widgetId)),r},a.isValid=function(){return!!this._widgetId},n}();var ae=function(e){var t,r;function n(t,r,n,a){var i;return void 0===n&&(n=""),(i=e.call(this,a)||this)._multiRequest=Y.getMultiRequest(t,n,r),i}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(r(10).a);var ie=function(e){var t,r;function n(){return e.apply(this,arguments)||this}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.execute=function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var a=new W.a(n);return a.service="playlist",a.action="execute",a.method="POST",a.url=a.getUrl(e),a.tag="playlist-execute",a.params={ks:t,id:r,responseProfile:new J},a},n.get=function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var a=new W.a(n);return a.service="playlist",a.action="get",a.method="POST",a.url=a.getUrl(e),a.tag="playlist-get",a.params={ks:t,id:r,responseProfile:{fields:"id,name,description,thumbnailUrl",type:1}},a},n.getLastEntryId=function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var a=new W.a(n);return a.service="userEntry",a.action="list",a.method="POST",a.url=a.getUrl(e),a.tag="userEntry-list",a.params={ks:t,filter:{objectType:"KalturaViewHistoryUserEntry",entryIdEqual:r,userIdEqualCurrent:1},responseProfile:{fields:"playlistLastEntryId",type:1}},a},n}(Y),se=function(e){this.id=e.id,this.name=e.name,this.description=e.description,this.poster=e.thumbnailUrl};var oe=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).hasError||(r.entries=[],t.map((function(e){var t=new A(e);t.type!==A.EntryType.DOCUMENT.value&&r.entries.push(t)}))),r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(u.a);var ue=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).hasError||(r.totalCount=t.totalCount,r.entries=[],r.totalCount>0&&t.objects.map((function(e){return r.entries.push(new C(e))}))),r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(u.a);function ce(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,n.key,n)}}function le(e,t,r){return t&&ce(e.prototype,t),r&&ce(e,r),e}var de=function(){function e(e){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"_response",{}),this.requests=this.buildRequests(e),this._playlistId=e.playlistId}le(e,null,[{key:"id",get:function(){return"playlist"}}]);var t=e.prototype;return t.buildRequests=function(e){var t=o.get(),r=[];return r.push(ie.get(t.serviceUrl,e.ks,e.playlistId)),r.push(ie.execute(t.serviceUrl,e.ks,e.playlistId)),r.push(ie.getLastEntryId(t.serviceUrl,e.ks,e.playlistId)),r},t.isValid=function(){return!!this._playlistId},le(e,[{key:"requests",set:function(e){this._requests=e},get:function(){return this._requests}},{key:"response",set:function(e){this._response.playlistData=new se(e[0].data),this._response.playlistItems=new oe(e[1].data),this._response.playlistUserEntries=new ue(e[2].data)},get:function(){return this._response}}]),e}(),pe=r(14);function fe(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,n.key,n)}}function he(e,t,r){return t&&fe(e.prototype,t),r&&fe(e,r),e}var ye=function(){function e(e){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"_response",{playlistItems:{entries:[]}}),this.requests=this.buildRequests(e),this._entries=e.entries}he(e,null,[{key:"id",get:function(){return"entry_list"}}]);var t=e.prototype;return t.buildRequests=function(e){var t=o.get(),r=[];return e.entries.forEach((function(n){r.push(X.list(t.serviceUrl,e.ks,n.entryId||n,e.redirectFromEntryId,n.referenceId))})),r},t.isValid=function(){return!(!this._entries||!this._entries.length)},he(e,[{key:"requests",set:function(e){this._requests=e},get:function(){return this._requests}},{key:"response",set:function(e){var t,r=this;e.forEach((function(e){t=new Z(e.data),r._response.playlistItems.entries.push(t.entries[0])}))},get:function(){return this._response}}]),e}(),ge=r(0);function me(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ve=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).hasError||(r.name=t.name,r.description=t.description,r.objTypeAsString=t.objTypeAsString,r.width=t.width,r.height=t.height,r.htmlParams=t.htmlParams,r.swfUrl=t.swfUrl,r.confFilePath=t.confFilePath,r.confFile=t.confFile,r.confFileFeatures=t.confFileFeatures,r.config=t.config,r.confVars=t.confVars,r.useCdn=t.useCdn,r.tags=t.tags,r.swfUrlVersion=t.swfUrlVersion,r.created=new Date(0),r.created.setUTCSeconds(t.createdAt),r.updated=new Date(0),r.updated.setUTCSeconds(t.updatedAt),r.html5Url=t.description,r.version=t.description,r.partnerTags=t.description,r.objType=t.description,r.creationMode=t.description),r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(u.a);function _e(e,t,r,n,a,i,s){try{var o=e[i](s),u=o.value}catch(e){return void r(e)}o.done?t(u):Promise.resolve(u).then(n,a)}function Ee(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var i=e.apply(t,r);function s(e){_e(i,n,a,s,o,"next",e)}function o(e){_e(i,n,a,s,o,"throw",e)}s(void 0)}))}}me(ve,"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}),me(ve,"CreationMode",{WIZARD:2,ADVANCED:3});var Ie=function(){function e(){}return e._applyRegexAction=function(e,t){if(e){var r=new RegExp(e.pattern,"i");if(t.match(r))return t.replace(r,e.replacement+"/")}return t},e._isECDNUrlAlive=function(){var t=Ee(regeneratorRuntime.mark((function t(r,n){var a,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:a=n+"/api_v3/service/system/action/ping/format/1",(i=new XMLHttpRequest).open("GET",a),i.timeout=r.checkAliveTimeoutMs,i.onreadystatechange=function(){if(4===i.readyState)return 200===i.status},i.ontimeout=function(){return e._logger.warn("Got timeout while pinging the ECDN url. the ping url: "+a),!1},i.send();case 7:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),e.handleRegexAction=function(){var t=Ee(regeneratorRuntime.mark((function t(r,n){var a,i,s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=o.get().cdnUrl,i=e._extractRegexActionFromData(n),s=e._getRegExp(i),t.t0=a&&i&&s&&a.match(s),!t.t0){t.next=11;break}if(t.t1=i.checkAliveTimeoutMs>0,!t.t1){t.next=10;break}return t.next=9,e._isECDNUrlAlive(i,a.replace(s,i.replacement));case 9:t.t1=!t.sent;case 10:t.t0=!t.t1;case 11:if(!t.t0){t.next=14;break}return e._replaceHostUrls(r,i),t.abrupt("return",r);case 14:return e._logger.debug("exiting handleRegexAction - not applying regex action."),t.abrupt("return",r);case 16:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),e._replaceHostUrls=function(t,r){e._logger.debug("Starting to modify urls...");var n=t.sources,a=n.hls,i=n.dash,s=n.progressive,u=n.image;[].concat(a,i,s,u).forEach((function(t){return t.url=e._applyRegexAction(r,t.url)})),o.get().replaceHostOnlyManifestUrls||(e._logger.debug("replaceHostOnlyManifestUrls flag is off - modifying captions and poster URLs"),n.captions&&n.captions.forEach((function(t){return t.url=e._applyRegexAction(r,t.url)})),"string"==typeof n.poster&&(n.poster=e._applyRegexAction(r,n.poster))),e._logger.debug("Finished modifying urls")},e._extractRegexActionFromData=function(e){var t,r;return null==(t=e.get(ee.id))||null==(r=t.response)?void 0:r.playBackContextResult.getRequestHostRegexAction()},e._getRegExp=function(e){if(e&&e.pattern&&e.replacement)return new RegExp(e.pattern,"i")},e}();!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Ie,"_logger",Object(a.b)("RegexActionHandler"));var be=Ie;function Re(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,n.key,n)}}var Te=function(e){var t,r;function n(t,r){var n;return function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n=e.call(this,t,r)||this),"_filterOptionsConfig",{redirectFromEntryId:!0}),n._logger=Object(a.b)("OVPProvider"),o.set(t.env),n._setFilterOptionsConfig(t.filterOptions),n._networkRetryConfig=Object.assign(n._networkRetryConfig,t.networkRetryParameters),n}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var i,s,u,c=n.prototype;return c.getMediaConfig=function(e){var t=this;return e.ks&&(this.ks=e.ks,this._isAnonymous=!1),this.widgetId!==this.defaultWidgetId&&(this._isAnonymous=!1),this._dataLoader=new ae(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var a=e.entryId,i=e.referenceId;if(a||i){var s=t.ks;s||(s="{1:result:ks}",t._dataLoader.add(ne,{widgetId:t.widgetId}));var o=t._getEntryRedirectFilter(e);return t._dataLoader.add(ee,{entryId:a,ks:s,redirectFromEntryId:o,referenceId:i}),t._dataLoader.fetchData().then((function(e){try{var a=t._parseDataFromResponse(e);be.handleRegexAction(a,e).then(r)}catch(e){n(e)}}),(function(e){n(e)}))}n(new ge.a(ge.a.Severity.CRITICAL,ge.a.Category.PROVIDER,ge.a.Code.MISSING_MANDATORY_PARAMS,{message:"missing entry id"}))}))},c.doRequest=function(e,t){var r=this,n=t||this.ks,a=new ae(this.playerVersion,this.partnerId,n,this._networkRetryConfig);return new Promise((function(t,i){return n||a.add(ne,{widgetId:r.widgetId}),e.forEach((function(e){a.add(e.loader,e.params,n||"{1:result:ks}")})),a.fetchData().then((function(e){try{t(e)}catch(e){i(e)}}),(function(e){i(e)}))}))},c._getEntryRedirectFilter=function(e){return"boolean"==typeof e.redirectFromEntryId?e.redirectFromEntryId:"boolean"!=typeof this._filterOptionsConfig.redirectFromEntryId||this._filterOptionsConfig.redirectFromEntryId},c._setFilterOptionsConfig=function(e){e&&"boolean"==typeof e.redirectFromEntryId&&(this._filterOptionsConfig.redirectFromEntryId=e.redirectFromEntryId)},c._parseDataFromResponse=function(e){this._logger.debug("Data parsing started");var t={session:{isAnonymous:this._isAnonymous,partnerId:this.partnerId},sources:this._getDefaultSourcesObject(),plugins:{}};if(this.uiConfId&&(t.session.uiConfId=this.uiConfId),e){if(e.has(ne.id)){var r=e.get(ne.id);r&&r.response&&(t.session.ks=r.response,this.widgetId!==this.defaultWidgetId&&(this.ks=t.session.ks))}else t.session.ks=this.ks;if(e.has(ee.id)){var n=e.get(ee.id);if(n&&n.response){var a=n.response;if(K.hasBlockAction(a))throw new ge.a(ge.a.Severity.CRITICAL,ge.a.Category.SERVICE,ge.a.Code.BLOCK_ACTION,{action:K.getBlockAction(a),messages:K.getErrorMessages(a)});var i=K.getMediaEntry(this.isAnonymous?"":this.ks,this.partnerId,this.uiConfId,a);Object.assign(t.sources,this._getSourcesObject(i)),this._verifyMediaStatus(i),this._verifyHasSources(t.sources);var s=K.getBumper(a,this.isAnonymous?"":this.ks,this.partnerId);s&&Object.assign(t.plugins,{bumper:s})}}}return this._logger.debug("Data parsing finished",t),t},c._verifyMediaStatus=function(e){if([A.EntryStatus.IMPORT,A.EntryStatus.PRECONVERT].includes(e.status))throw new ge.a(ge.a.Severity.CRITICAL,ge.a.Category.SERVICE,ge.a.Code.MEDIA_STATUS_NOT_READY,{messages:"Status of entry id "+e.id+" is "+e.status+" and is still being imported or converted",data:{status:status}})},c.getPlaylistConfig=function(e){var t=this;return e.ks&&(this.ks=e.ks,this._isAnonymous=!1),this.widgetId!==this.defaultWidgetId&&(this._isAnonymous=!1),this._dataLoader=new ae(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var a=e.playlistId;if(a){var i=t.ks;i||(i="{1:result:ks}",t._dataLoader.add(ne,{widgetId:t.widgetId})),t._dataLoader.add(de,{playlistId:a,ks:i}),t._dataLoader.fetchData().then((function(e){r(t._parsePlaylistDataFromResponse(e))}),(function(e){n(e)}))}else n({success:!1,data:"Missing mandatory parameter"})}))},c._parsePlaylistDataFromResponse=function(e){var t=this;this._logger.debug("Data parsing started");var r=this._getPlaylistObject();if(e&&e.has(de.id)){var n=e.get(de.id);if(n&&n.response){var a=K.getPlaylist(n.response);r.id=a.id,r.poster=a.poster,r.metadata.name=a.name,r.metadata.description=a.description,r.playlistLastEntryId=a.playlistLastEntryId,a.items.forEach((function(e){return r.items.push({sources:t._getSourcesObject(e)})}))}}return this._logger.debug("Data parsing finished",r),r},c.getEntryListConfig=function(e){var t=this;return e.ks&&(this.ks=e.ks,this._isAnonymous=!1),this.widgetId!==this.defaultWidgetId&&(this._isAnonymous=!1),this._dataLoader=new ae(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var a=e.entries;if(a&&a.length){var i=t.ks;i||(i="{1:result:ks}",t._dataLoader.add(ne,{widgetId:t.widgetId}));var s=t._getEntryRedirectFilter(e);t._dataLoader.add(ye,{entries:a,ks:i,redirectFromEntryId:s}),t._dataLoader.fetchData(!1).then((function(e){r(t._parseEntryListDataFromResponse(e))}),(function(e){n(e)}))}else n({success:!1,data:"Missing mandatory parameter"})}))},c._parseEntryListDataFromResponse=function(e){var t=this;this._logger.debug("Data parsing started");var r=this._getPlaylistObject();if(e&&e.has(ye.id)){var n=e.get(ye.id);if(n&&n.response)K.getEntryList(n.response).items.forEach((function(e){return r.items.push({sources:t._getSourcesObject(e)})}))}return this._logger.debug("Data parsing finished",r),r},c._getPlaylistObject=function(){return{id:"",metadata:{name:"",description:""},poster:"",playlistLastEntryId:"",items:[]}},c._getDefaultSourcesObject=function(){return{hls:[],dash:[],progressive:[],image:[],id:"",duration:0,type:S.a.Type.UNKNOWN,poster:"",dvr:!1,vr:null,metadata:{name:"",description:"",tags:""}}},c._getSourcesObject=function(e){var t=this._getDefaultSourcesObject(),r=e.sources.toJSON();return t.hls=r.hls,t.dash=r.dash,t.progressive=r.progressive,t.image=r.image,t.id=e.id,t.duration=e.duration,t.type=e.type,t.dvr=!!e.dvrStatus,t.poster=e.poster,t.downloadUrl=e.downloadUrl,e.sources.captions&&(t.captions=e.sources.captions),e.metadata&&"string"==typeof e.metadata.tags&&e.metadata.tags.split(", ").includes("360")&&(t.vr={}),Object.assign(t.metadata,e.metadata),t},i=n,(s=[{key:"env",get:function(){return o.get()}}])&&Re(i.prototype,s),u&&Re(i,u),n}(pe.a),Oe="@playkit-js/playkit-js-providers-ovp",Ae="2.40.1-canary.0-f2a1cb3"}])}));
1
+ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var s=e();for(var r in s)("object"==typeof exports?exports:t)[r]=s[r]}}(self,(()=>(()=>{"use strict";var t={d:(e,s)=>{for(var r in s)t.o(s,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:s[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{NAME:()=>_t,Provider:()=>It,ProviderParser:()=>$,RequestBuilder:()=>Q,ResponseTypes:()=>s,VERSION:()=>Rt});var s={};function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function a(t,e,s){return(e=function(t){var e=function(t,e){if("object"!==r(t)||null===t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var a=s.call(t,"string");if("object"!==r(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===r(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}t.r(s),t.d(s,{BaseServiceResult:()=>h,KalturaAccessControlMessage:()=>v,KalturaAccessControlModifyRequestHostRegexAction:()=>E,KalturaBaseEntryListResponse:()=>m,KalturaBumper:()=>_,KalturaDrmPlaybackPluginData:()=>f,KalturaFlavorAsset:()=>R,KalturaMediaEntries:()=>T,KalturaMediaEntry:()=>g,KalturaMetadata:()=>A,KalturaMetadataListResponse:()=>C,KalturaPlaybackContext:()=>O,KalturaPlaybackSource:()=>I,KalturaPlaylist:()=>S,KalturaRuleAction:()=>y,KalturaUIConfResponse:()=>P,KalturaUserEntry:()=>w,KalturaUserEntryListResponse:()=>D});const i={get:()=>({VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:()=>{},debug:()=>{},enabledFor:()=>{},error:()=>{},get:()=>{},getLevel:()=>{},info:()=>{},log:()=>{},setHandler:()=>{},setLevel:()=>{},time:()=>{},timeEnd:()=>{},trace:()=>{},useDefaults:()=>{},warn:()=>{}})};let o={};function n(t){return i.get(t)}const l=n,c=t=>{let e;return Array.isArray(t)?(e=t.length>0?t.slice(0):[],e.forEach(((t,s)=>{("object"==typeof t||Array.isArray(t)&&t.length>0)&&(e[s]=c(t))}))):"object"==typeof t?(e=Object.assign({},t),Object.keys(e).forEach((t=>{("object"==typeof e[t]||Array.isArray(e[t])&&e[t].length>0)&&(e[t]=c(e[t]))}))):e=t,e},d={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};class u{static set(t){t&&Object.assign(d,t)}static get(){return c(d)}}class h{constructor(t){a(this,"hasError",!1),"KalturaAPIException"===t.objectType?(this.hasError=!0,this.error=new p(t.code,t.message)):t.error&&"KalturaAPIException"===t.error.objectType?(this.hasError=!0,this.error=new p(t.error.code,t.error.message)):this.data=t}}class p{constructor(t,e){this.code=t,this.message=e}}class g{constructor(t){this.id=t.id,this.referenceId=t.referenceId,this.externalSourceType=t.externalSourceType,this.name=t.name,this.description=t.description,this.dataUrl=t.dataUrl,this.type=t.type,this.entryType=t.mediaType,this.flavorParamsIds=t.flavorParamsIds,this.duration=t.duration,this.poster=t.thumbnailUrl,this.status=t.status,this.dvrStatus=t.dvrStatus,this.tags=t.tags,this.createdAt=t.createdAt,this.updatedAt=t.updatedAt,this.creatorId=t.creatorId,this.endDate=t.endDate,this.plays=t.plays,this.views=t.views,this.downloadUrl=t.downloadUrl}}a(g,"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}}),a(g,"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}}),a(g,"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}),a(g,"EntryModerationStatus",{PENDING_MODERATION:1,APPROVED:2,REJECTED:3,FLAGGED_FOR_REVIEW:4,MODERATE:5,AUTO_APPROVED:6});class m extends h{constructor(t){super(t),this.hasError||(this.totalCount=t.totalCount,this.totalCount>0&&(this.entries=[],t.objects.map((t=>this.entries.push(new g(t))))))}}class y{constructor(t){this.type=t.type}}a(y,"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});class E extends y{constructor(t){super(t),this.pattern=t.pattern,this.replacement=t.replacement,this.replacmenServerNodeId=t.replacmenServerNodeId,this.checkAliveTimeoutMs=t.checkAliveTimeoutMs}}class f{constructor(t){this.scheme=t.scheme,this.licenseURL=t.licenseURL,this.certificate=t.certificate}}a(f,"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"});class I{constructor(t){a(this,"drm",[]),this.format=t.format,this.deliveryProfileId=t.deliveryProfileId,this.url=t.url,this.protocols=t.protocols,this.flavorIds=t.flavorIds,t.drm&&t.drm.map((t=>this.drm.push(new f(t))))}hasDrmData(){return this.drm&&this.drm.length>0}hasFlavorIds(){return!!this.flavorIds&&this.flavorIds.length>0}getProtocol(t){let e="";if(this.protocols&&this.protocols.length>0)this.protocols.split(",").forEach((s=>{s===t&&(e=s)}));else if("http"===t)return t;return e}}class _{constructor(t){this.entryId=t.entryId,this.clickThroughUrl=t.url,this.sources=t.sources?t.sources.map((t=>new I(t))):[]}}class R{constructor(t){this.id=t.id,this.flavorParamsId=t.flavorParamsId,this.fileExt=t.fileExt,this.bitrate=t.bitrate,this.width=t.width,this.height=t.height,this.id=t.id,this.frameRate=t.frameRate,this.isOriginal=t.isOriginal,this.isWeb=t.isWeb,this.containerFormat=t.containerFormat,this.videoCodecId=t.videoCodecId,this.status=t.status,this.language=t.language,this.label=t.label}}a(R,"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});class T extends h{constructor(t){super(t),this.hasError||(this.entries=[],t.map((t=>{const e=new g(t);e.type!==g.EntryType.DOCUMENT.value&&this.entries.push(e)})))}}class A{constructor(t){this.id=t.id,this.metadataProfileId=t.metadataProfileId,this.metadataProfileVersion=t.metadataProfileVersion,this.metadataProfileId=t.metadataProfileId,this.metadataObjectType=t.metadataObjectType,this.objectId=t.objectId,this.version=t.version,this.created=new Date(0),this.created.setUTCSeconds(t.createdAt),this.updated=new Date(0),this.updated.setUTCSeconds(t.updatedAt),this.status=t.status,this.xml=t.xml}}a(A,"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}),a(A,"Status",{VALID:1,INVALID:2,DELETED:3});class C extends h{constructor(t){super(t),this.hasError||(this.totalCount=t.totalCount,this.totalCount>0&&(this.metas=[],t.objects.map((t=>this.metas.push(new A(t))))))}}class v{constructor(t){this.message=t.message,this.code=t.code}}class O extends h{constructor(t){if(super(t),a(this,"sources",[]),a(this,"actions",[]),a(this,"messages",[]),a(this,"flavorAssets",[]),a(this,"bumperData",[]),!this.hasError){const e=t.messages;e&&e.map((t=>this.messages.push(new v(t))));const s=t.actions;s&&s.map((t=>{t.type===y.Type.REQUEST_HOST_REGEX?this.actions.push(new E(t)):this.actions.push(new y(t))}));const r=t.sources;r&&r.map((t=>this.sources.push(new I(t))));const a=t.flavorAssets;a&&a.map((t=>this.flavorAssets.push(new R(t))));const i=t.bumperData;i&&i.map((t=>this.bumperData.push(new _(t))))}}hasBlockAction(){return void 0!==this.getBlockAction()}getBlockAction(){return this.actions.find((t=>t.type===y.Type.BLOCK))}getErrorMessages(){return this.messages}getRequestHostRegexAction(){const t=this.actions.find((t=>t.type===y.Type.REQUEST_HOST_REGEX));if(t instanceof E)return t}}class S{constructor(t){this.id=t.id,this.name=t.name,this.description=t.description,this.poster=t.thumbnailUrl}}class P extends h{constructor(t){super(t),this.hasError||(this.name=t.name,this.description=t.description,this.objTypeAsString=t.objTypeAsString,this.width=t.width,this.height=t.height,this.htmlParams=t.htmlParams,this.swfUrl=t.swfUrl,this.confFilePath=t.confFilePath,this.confFile=t.confFile,this.confFileFeatures=t.confFileFeatures,this.config=t.config,this.confVars=t.confVars,this.useCdn=t.useCdn,this.tags=t.tags,this.swfUrlVersion=t.swfUrlVersion,this.created=new Date(0),this.created.setUTCSeconds(t.createdAt),this.updated=new Date(0),this.updated.setUTCSeconds(t.updatedAt),this.html5Url=t.description,this.version=t.description,this.partnerTags=t.description,this.objType=t.description,this.creationMode=t.description)}}a(P,"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}),a(P,"CreationMode",{WIZARD:2,ADVANCED:3});class w{constructor(t){this.playlistLastEntryId=t.playlistLastEntryId,this.entryId=t.entryId,this.id=t.id,this.userId=t.userId,this.partnerId=t.partnerId,this.status=t.status,this.createdAt=t.createdAt,this.updatedAt=t.updatedAt}}class D extends h{constructor(t){super(t),this.hasError||(this.totalCount=t.totalCount,this.entries=[],this.totalCount>0&&t.objects.map((t=>this.entries.push(new w(t)))))}}class b{static build(t){const e=u.get(),s=e.serviceUrl.substr(0,e.serviceUrl.lastIndexOf("/")),{partnerId:r,entryId:a,ks:i,uiConfId:o,format:n,protocol:l,extension:c,flavorIds:d}=t;if(!s||isNaN(Number.parseInt(r))||!a||!n||!l)return"";let h=s;return s.endsWith("/")||(h+="/"),h+="p/"+r+"/sp/"+r+"00/playManifest/entryId/"+a+"/protocol/"+l+"/format/"+n,d?h+="/flavorIds/"+d:o&&(h+="/uiConfId/"+o),""!==i&&(h+="/ks/"+i),""!==c&&(h+="/a."+c),o&&""!==d&&(h+="?uiConfId="+o),h}}class M{static xmlToJson(t){let e={};if(1===t.nodeType){if(t.attributes.length>0){e["@attributes"]={};for(let s=0;s<t.attributes.length;s++){const r=t.attributes.item(s);e["@attributes"][r.nodeName]=r.nodeValue}}}else 3===t.nodeType&&(e=t.nodeValue);if(t.hasChildNodes())for(let s=0;s<t.childNodes.length;s++){const r=t.childNodes.item(s),a=r.nodeName;if(void 0===e[a])e[a]=this.xmlToJson(r);else{if(void 0===e[a].push){const t=e[a];e[a]=[],e[a].push(t)}e[a].push(this.xmlToJson(r))}}return e}}const L={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"}},N=new Map([["mpegdash",L.DASH],["applehttp",L.HLS],["url",L.MP4]]);function U(t){const e=N.get(t);return!!e&&e.name===L.MP4.name}class k{constructor(){this.progressive=[],this.dash=[],this.hls=[],this.image=[]}map(t,e){if(e)switch(e.name){case L.MP4.name:this.progressive.push(t);break;case L.DASH.name:this.dash.push(t);break;case L.HLS.name:this.hls.push(t)}}toJSON(){const t={progressive:[],dash:[],hls:[],image:[]};return this.progressive.forEach((e=>t.progressive.push(e.toJSON()))),this.hls.forEach((e=>t.hls.push(e.toJSON()))),this.dash.forEach((e=>t.dash.push(e.toJSON()))),t.image=this.image,t}}class x{constructor(){this.metadata=new Map,this.sources=new k,this.type=x.Type.UNKNOWN}toJSON(){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}}}a(x,"Type",{VOD:"Vod",LIVE:"Live",IMAGE:"Image",AUDIO:"Audio",UNKNOWN:"Unknown"}),a(x,"DvrStatus",{ON:1,OFF:0});class V{constructor(t,e,s){this.licenseUrl=t,this.scheme=e,s&&(this.certificate=s)}toJSON(){const t={licenseUrl:this.licenseUrl,scheme:this.scheme};return this.certificate&&(t.certificate=this.certificate),t}}class j{toJSON(){const 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((e=>{Array.isArray(t.drmData)&&t.drmData.push(e.toJSON())}))),t}}class F{constructor(){this.items=[]}}class q{constructor(){this.items=[]}}class H{constructor(t){this.url=t.url,this.clickThroughUrl=t.clickThroughUrl}}const B={SRT:"1",DFXP:"2",WEBVTT:"3",CAP:"4"},K={3:"vtt",1:"srt"};class W{static createConfig(t,e){return t.map((t=>{let s=t.url,r=K[t.format];return[B.DFXP,B.CAP].includes(t.format)&&(s=t.webVttUrl,r=K[B.WEBVTT]),s=J(s,e),{default:!!t.isDefault,type:r,language:t.languageCode,label:t.label,url:s}}))}}class G{constructor(t){this.id=t.id,this.url=G.extractBaseThumbnailUrl(t.dataUrl),this.mimetype=""}static extractBaseThumbnailUrl(t){return t.match(".+entry_id/[a-zA-Z0-9_]+/")[0].slice(0,-1)}}class Y{static getMediaEntry(t,e,s,r){const a=new x,i=r.entry,o=r.playBackContextResult,n=r.metadataListResult,l=o.sources;return a.sources=Y._getParsedSources(l,t,e,s,i,o),Y._fillBaseData(a,i,n),a.type!==x.Type.LIVE&&u.get().useApiCaptions&&o.data.playbackCaptions&&(a.sources.captions=W.createConfig(o.data.playbackCaptions,t)),a}static addKsToUrl(t,e){let s;return e?(s=-1!==t.split("?")[0].replace(/^.*[\\/]/,"").indexOf(".")?-1===t.indexOf("?")?"?ks=":"&ks=":"/ks/",t+s+e):t}static getPlaylist(t){const e=new F,s=t.playlistData,r=t.playlistItems.entries,a=t.playlistUserEntries.entries;return e.id=s.id,e.name=s.name,e.description=s.description,e.poster=s.poster,e.playlistLastEntryId=a.map((t=>t.playlistLastEntryId))[0],r.forEach((t=>{const s=new x;Y._fillBaseData(s,t),e.items.push(s)})),e}static getEntryList(t){const e=new q;return t.playlistItems.entries.forEach((t=>{const s=new x;Y._fillBaseData(s,t),e.items.push(s)})),e}static getBumper(t,e,s){const r=t.playBackContextResult,a=r.bumperData[0];if(a){const t=(a&&a.sources).find((t=>U(t.format)));if(t){const i=Y._parseProgressiveSources(t,r,e,s,0,a.entryId);if(i[0])return new H({url:i[0].url,clickThroughUrl:a.clickThroughUrl})}}}static _fillBaseData(t,e,s){return t.poster=e.poster,t.id=e.id,t.duration=e.duration,t.downloadUrl=e.downloadUrl||"",t.metadata=Y._parseMetadata(s),t.metadata.description=e.description||"",t.metadata.entryId=e.id||"",t.metadata.name=e.name||"",e.createdAt&&(t.metadata.createdAt=e.createdAt),e.updatedAt&&(t.metadata.updatedAt=e.updatedAt),e.creatorId&&(t.metadata.creatorId=e.creatorId),e.endDate&&(t.metadata.endDate=e.endDate),e.views&&(t.metadata.views=e.views),e.plays&&(t.metadata.plays=e.plays),t.metadata.tags=e.tags||"",t.status=e.status,t.type=Y._getEntryType(e.entryType,e.type),t.type===x.Type.LIVE&&(t.dvrStatus=e.dvrStatus),t}static _getEntryType(t,e){let s=x.Type.UNKNOWN;switch(t){case g.MediaType.IMAGE.value:s=x.Type.IMAGE;break;case g.MediaType.AUDIO.value:s=x.Type.AUDIO;break;default:switch(e){case g.EntryType.MEDIA_CLIP.value:s=x.Type.VOD;break;case g.EntryType.LIVE_STREAM.value:case g.EntryType.LIVE_CHANNEL.value:s=x.Type.LIVE;break;default:s=x.Type.UNKNOWN}}return s}static _getParsedSources(t,e,s,r,a,i){const o=new k;return a.type===g.EntryType.EXTERNAL_MEDIA.value?(()=>{const t=new j;t.mimetype="video/youtube",t.url=a.referenceId,t.id=a.id+"_youtube",o.progressive.push(t)})():a.entryType===g.MediaType.IMAGE.value?o.image.push(new G(a)):t&&t.length>0&&(t.filter((t=>!U(t.format))).forEach((t=>{const n=Y._parseAdaptiveSource(t,i,e,s,r,a.id);if(n){const e=N.get(t.format);o.map(n,e)}})),(()=>{const n=t.find((t=>U(t.format)&&""!==t.getProtocol(Y._getBaseProtocol())));o.progressive=Y._parseProgressiveSources(n,i,e,s,r,a.id)})()),o}static _parseAdaptiveSource(t,e,s,r,a,i){const o=new j;if(t){let n="";const l=N.get(t.format),c=t.getProtocol(Y._getBaseProtocol()),d=t.deliveryProfileId,u=t.format;let h="";if(l&&(h=l.pathExt,o.mimetype=l.mimeType),t.hasFlavorIds()?(!h&&e.flavorAssets&&e.flavorAssets.length>0&&(h=e.flavorAssets[0].fileExt),n=b.build({entryId:i,flavorIds:t.flavorIds,format:u,ks:s,partnerId:r,uiConfId:a,extension:h,protocol:c})):n=Y.addKsToUrl(t.url,s),!n){const t=`failed to create play url from source, discarding source: (${i}_${d}), ${u}`;return Y._logger.warn(t),null}if(o.url=n,o.id=i+"_"+d+","+u,t.hasDrmData()){const e=[];t.drm.forEach((t=>{e.push(new V(t.licenseURL,f.Scheme[t.scheme],t.certificate))})),o.drmData=e}}return o}static _parseProgressiveSources(t,e,s,r,a,i){const o=[],n=[];if(t){const l=t.getProtocol(Y._getBaseProtocol()),c=t.format,d=t.deliveryProfileId,u=d+","+c;e.flavorAssets.map((t=>{const e=new j;e.id=t.id+u,e.mimetype="mp3"===t.fileExt?"audio/mp3":"video/mp4",e.height=t.height,e.width=t.width,e.bandwidth=1024*t.bitrate,e.label=t.label||t.language;const h=b.build({entryId:i,flavorIds:t.id,format:c,ks:s,partnerId:r,uiConfId:a,extension:t.fileExt,protocol:l});if(""===h)return Y._logger.warn(`failed to create play url from source, discarding source: (${i}_${d}), ${c}.`),null;e.url=h,t.height&&t.width?o.push(e):n.push(e)}))}return n.length&&!o.length?n:o}static _parseMetadata(t){const e={};return t&&t.metas&&t.metas.length>0&&t.metas.forEach((t=>{if(t.xml){const s=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,">");const r=s.parseFromString(t.xml,"text/xml"),a=M.xmlToJson(r);Object.keys(a.metadata).forEach((t=>{e[t]=a.metadata[t]["#text"]}))}})),e}static _getBaseProtocol(){const t=u.get(),e=/^https?:/.exec(t.cdnUrl),s=e?e[0]:document.location.protocol;return"string"==typeof s?s.slice(0,-1):"https"}static hasBlockAction(t){return t.playBackContextResult.hasBlockAction()}static getBlockAction(t){return t.playBackContextResult.getBlockAction()}static getErrorMessages(t){return t.playBackContextResult.getErrorMessages()}}a(Y,"_logger",l("OVPProviderParser"));const J=Y.addKsToUrl,$=Y;class X{constructor(t,e,s,r={}){this.severity=t,this.category=e,this.code=s,this.data=r,X._logger.error(`Category:${e} | Code:${s} |`,r)}}a(X,"Severity",{RECOVERABLE:1,CRITICAL:2}),a(X,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),a(X,"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,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),a(X,"_logger",l("Error"));class Q{constructor(t=new Map){a(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),a(this,"_attemptCounter",1),this.headers=t}getUrl(t){return t+"/service/"+this.service+(this.action?"/action/"+this.action:"")}doHttpRequest(){const t=new Promise(((t,e)=>{this._requestPromise={resolve:t,reject:e}}));return this.url||this._requestPromise.reject(new X(X.Severity.CRITICAL,X.Category.NETWORK,X.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t}_createXHR(){const t=new XMLHttpRequest;t.onreadystatechange=()=>{if(4===t.readyState&&200===t.status)try{const e=JSON.parse(t.responseText);return this.responseHeaders=this._getResponseHeaders(t),this._requestPromise.resolve(e)}catch(e){this._requestPromise.reject(this._createError(t,X.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);const e=performance.now();t.ontimeout=()=>{this._handleError(t,X.Code.TIMEOUT,{timeout:(performance.now()-e)/1e3,statusText:t.statusText})},t.onerror=t.onabort=()=>{this._handleError(t,X.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach(((e,s)=>{t.setRequestHeader(s,e)})),t.send(this.params)}_getResponseHeaders(t){return t.getAllResponseHeaders().split("\n").filter((t=>0===t.toLowerCase().indexOf("x-")))}_handleError(t,e,s){const r=this._createError(t,e,s);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(r);this._attemptCounter++,this._createXHR()}_createError(t,e,s){return Object.assign(s,{url:this.url,headers:this._getResponseHeaders(t),attempt:this._attemptCounter}),new X(X.Severity.CRITICAL,X.Category.NETWORK,e,s)}}class Z extends Q{constructor(...t){super(...t),a(this,"requests",[])}add(t){this.requests.push(t);const e={},s={service:t.service,action:t.action};return Object.assign(e,{[this.requests.length]:Object.assign(s,t.params)}),Object.assign(e,this.params),this.params=e,this}execute(t){return new Promise(((e,s)=>{try{this.params=JSON.stringify(this.params)}catch(t){Z._logger.error(`${t.message}`),s(new X(X.Severity.CRITICAL,X.Category.PROVIDER,X.Code.FAILED_PARSING_REQUEST,{error:t,params:this.params}))}this.doHttpRequest().then((r=>{const a=new z(r,t);a.success?e({headers:this.responseHeaders,response:a}):s(new X(X.Severity.CRITICAL,X.Category.NETWORK,X.Code.MULTIREQUEST_API_ERROR,{url:this.url,headers:this.responseHeaders,results:a.results}))}),(t=>{s(t)}))}))}}a(Z,"_logger",l("MultiRequestBuilder"));class z{constructor(t,e=!0){a(this,"results",[]);const s=t.result?t.result:t,r=(Array.isArray(s)?s:[s]).map((t=>new h(t))),i=r.filter((t=>t.hasError));i.forEach((t=>{z._logger.error(`Service returned an error with error code: ${t.error.code} and message: ${t.error.message}.`)})),this.results=r,e&&i.length||i.length===this.results.length?this.success=!1:(this.results=this.results.filter((t=>!t.hasError)),this.success=!0)}}a(z,"_logger",l("MultiRequestResult"));class tt{static getMultiRequest(t,e,s){const r=u.get(),a=r.serviceParams;Object.assign(a,{ks:e,clientTag:"html5:v"+t}),s&&Object.assign(a,{partnerId:s});const i=new Map;i.set("Content-Type","application/json");const o=new Z(i);return o.method="POST",o.service="multirequest",o.url=o.getUrl(r.serviceUrl),o.params=a,o}}class et{constructor(t={}){this.type=t.type||et.Type.INCLUDE_FIELDS,this.fields=t.fields||"id,referenceId,name,description,thumbnailUrl,dataUrl,duration,msDuration,flavorParamsIds,mediaType,type,tags,dvrStatus,externalSourceType,status,createdAt,updatedAt,endDate,plays,views,downloadUrl,creatorId"}}a(et,"Type",{INCLUDE_FIELDS:1,EXCLUDE_FIELDS:2});const st="baseEntry";class rt extends tt{static getPlaybackContext(t,e,s){const r=new Map;r.set("Content-Type","application/json");const a=new Q(r);return a.service=st,a.action="getPlaybackContext",a.method="POST",a.url=a.getUrl(t),a.tag="baseEntry-getPlaybackContext",a.params={entryId:s,ks:e,contextDataParams:{objectType:"KalturaContextDataParams",flavorTags:"all"}},a}static list(t,e,s,r,a){const i=new Map;i.set("Content-Type","application/json");const o=new Q(i);return o.service=st,o.action="list",o.method="POST",o.url=o.getUrl(t),o.tag="list",o.params=rt.getEntryListReqParams(s,e,r,a),o}static getEntryListReqParams(t,e,s,r){let a={};return t?a=s?{redirectFromEntryId:t}:{idEqual:t}:r&&(a={objectType:"KalturaBaseEntryFilter",referenceIdEqual:r}),{ks:e,filter:a,responseProfile:new et}}}class at extends tt{static list(t,e,s){const r=new Map;r.set("Content-Type","application/json");const a=new Q(r);a.service="metadata_metadata",a.action="list",a.method="POST",a.url=a.getUrl(t),a.tag="metadata_metadata-list";const i={objectType:"KalturaMetadataFilter",objectIdEqual:s,metadataObjectTypeEqual:"1"};return a.params={filter:i,ks:e},a}}class it{static get id(){return"media"}constructor(t){a(this,"_response",{}),this.requests=this.buildRequests(t),this._entryId=t.entryId,this._referenceId=t.referenceId}set requests(t){this._requests=t}get requests(){return this._requests}set response(t){const e=new m(t[0].data);this._response.entry=e.entries[0],this._response.playBackContextResult=new O(t[1].data),this._response.metadataListResult=new C(t[2].data)}get response(){return this._response}buildRequests(t){const e=u.get(),s=[];s.push(rt.list(e.serviceUrl,t.ks,t.entryId,t.redirectFromEntryId,t.referenceId));const r="{1:result:ks}"===t.ks?"{2:result:objects:0:id}":"{1:result:objects:0:id}";return s.push(rt.getPlaybackContext(e.serviceUrl,t.ks,r)),s.push(at.list(e.serviceUrl,t.ks,r)),s}isValid(){return!(!this._entryId&&!this._referenceId)}}class ot extends tt{static anonymousSession(t,e){const s=new Map;s.set("Content-Type","application/json");const r=new Q(s);return r.service="session",r.action="startWidgetSession",r.method="POST",r.url=r.getUrl(t),r.tag="session-startWidget",r.params={widgetId:e},r}}class nt{static get id(){return"session"}set requests(t){this._requests=t}get requests(){return this._requests}set response(t){this._response.ks=t[0].data.ks}get response(){return this._response.ks}constructor(t){a(this,"_response",{}),this.requests=this.buildRequests(t),this._widgetId=t.widgetId}buildRequests(t){const e=u.get(),s=[];return s.push(ot.anonymousSession(e.serviceUrl,t.widgetId)),s}isValid(){return!!this._widgetId}}class lt{constructor(t){a(this,"_loadersResponseMap",new Map),a(this,"_loaders",new Map),this._networkRetryConfig=t}add(t,e,s){const r=new t(e);if(r.isValid()){this._loaders.set(t.id,r);const e=this._multiRequest.requests.length,a=r.requests;this._multiRequest.retryConfig=this._networkRetryConfig,a.forEach((t=>{t.params=t.params||{},t.params.ks=t.params.ks||s,this._multiRequest.add(t)}));const i=Array.from(new Array(a.length),((t,s)=>s+e));this._loadersResponseMap.set(t.id,i)}}fetchData(t){return new Promise(((e,s)=>{this._multiRequest.execute(t).then((t=>{this._multiResponse=t.response,this.prepareData(t.response).success?e(this._loaders):s(new X(X.Severity.CRITICAL,X.Category.NETWORK,X.Code.API_RESPONSE_MISMATCH,{headers:t.headers}))}),(t=>{s(t)}))}))}prepareData(t){return this._loaders.forEach(((e,s)=>{const r=this._loadersResponseMap.get(s);try{r&&r.length>0&&(e.response=t.results.slice(r[0],r[r.length-1]+1))}catch(t){return{success:!1,error:t}}})),{success:!0,data:this._loaders}}}class ct extends lt{constructor(t,e,s="",r){super(r),this._multiRequest=tt.getMultiRequest(t,s,e)}}const dt="playlist";class ut extends tt{static execute(t,e,s){const r=new Map;r.set("Content-Type","application/json");const a=new Q(r);return a.service=dt,a.action="execute",a.method="POST",a.url=a.getUrl(t),a.tag=`${dt}-execute`,a.params={ks:e,id:s,responseProfile:new et},a}static get(t,e,s){const r=new Map;r.set("Content-Type","application/json");const a=new Q(r);return a.service=dt,a.action="get",a.method="POST",a.url=a.getUrl(t),a.tag=`${dt}-get`,a.params={ks:e,id:s,responseProfile:{fields:"id,name,description,thumbnailUrl",type:1}},a}static getLastEntryId(t,e,s){const r=new Map;r.set("Content-Type","application/json");const a=new Q(r);return a.service="userEntry",a.action="list",a.method="POST",a.url=a.getUrl(t),a.tag="userEntry-list",a.params={ks:e,filter:{objectType:"KalturaViewHistoryUserEntry",entryIdEqual:s,userIdEqualCurrent:1},responseProfile:{fields:"playlistLastEntryId",type:1}},a}}class ht{static get id(){return"playlist"}constructor(t){a(this,"_response",{}),this.requests=this.buildRequests(t),this._playlistId=t.playlistId}set requests(t){this._requests=t}get requests(){return this._requests}set response(t){this._response.playlistData=new S(t[0].data),this._response.playlistItems=new T(t[1].data),this._response.playlistUserEntries=new D(t[2].data)}get response(){return this._response}buildRequests(t){const e=u.get(),s=[];return s.push(ut.get(e.serviceUrl,t.ks,t.playlistId)),s.push(ut.execute(e.serviceUrl,t.ks,t.playlistId)),s.push(ut.getLastEntryId(e.serviceUrl,t.ks,t.playlistId)),s}isValid(){return!!this._playlistId}}class pt{get partnerId(){return this._partnerId}get widgetId(){return this._widgetId||this.defaultWidgetId}get defaultWidgetId(){return"_"+this._partnerId}get uiConfId(){return this._uiConfId}get ks(){return this._ks}set ks(t){this._ks=t}get playerVersion(){return this._playerVersion}get isAnonymous(){return this._isAnonymous}constructor(t,e){a(this,"_networkRetryConfig",{async:!0,timeout:0,maxAttempts:4}),function(t){t&&"function"==typeof t.getLogger&&(i.get=t.getLogger),t&&t.LogLevel&&(o=t.LogLevel)}(t.logger),this._partnerId=t.partnerId,this._widgetId=t.widgetId,this._uiConfId=t.uiConfId,this._isAnonymous=!t.ks,this._ks=t.ks||"",this._playerVersion=e}getMediaConfig(t){return Promise.reject(new X(X.Severity.CRITICAL,X.Category.PROVIDER,X.Code.METHOD_NOT_IMPLEMENTED,{message:"getMediaConfig method must be implement by the derived class"}))}getPlaylistConfig(t){return Promise.reject(new X(X.Severity.CRITICAL,X.Category.PROVIDER,X.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading playlist by id"}))}getEntryListConfig(t){return Promise.reject(new X(X.Severity.CRITICAL,X.Category.PROVIDER,X.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading entry list"}))}_verifyHasSources(t){if(0===t.hls.concat(t.dash,t.progressive,t.image).length)throw new X(X.Severity.CRITICAL,X.Category.SERVICE,X.Code.MISSING_PLAY_SOURCE,{action:"",messages:`No play source for entry id: ${t.id}`})}get LogLevel(){return o}getLogLevel(t){return function(t){return n(t).getLevel()}(t)}setLogLevel(t,e){!function(t,e){n(e).setLevel(t)}(t,e)}}class gt{static get id(){return"entry_list"}constructor(t){a(this,"_response",{playlistItems:{entries:[]}}),this.requests=this.buildRequests(t),this._entries=t.entries}set requests(t){this._requests=t}get requests(){return this._requests}set response(t){let e;t.forEach((t=>{e=new m(t.data),this._response.playlistItems.entries.push(e.entries[0])}))}get response(){return this._response}buildRequests(t){const e=u.get(),s=[];return t.entries.forEach((r=>{s.push(rt.list(e.serviceUrl,t.ks,r.entryId||r,t.redirectFromEntryId,r.referenceId))})),s}isValid(){return!(!this._entries||!this._entries.length)}}function mt(t,e,s,r,a,i,o){try{var n=t[i](o),l=n.value}catch(t){return void s(t)}n.done?e(l):Promise.resolve(l).then(r,a)}function yt(t){return function(){var e=this,s=arguments;return new Promise((function(r,a){var i=t.apply(e,s);function o(t){mt(i,r,a,o,n,"next",t)}function n(t){mt(i,r,a,o,n,"throw",t)}o(void 0)}))}}class Et{static _applyRegexAction(t,e){if(t){const s=new RegExp(t.pattern,"i");if(e.match(s))return e.replace(s,t.replacement+"/")}return e}static _isECDNUrlAlive(t,e){return yt((function*(){const s=e+"/api_v3/service/system/action/ping/format/1",r=new XMLHttpRequest;return r.open("GET",s),r.timeout=t.checkAliveTimeoutMs,r.onreadystatechange=()=>4===r.readyState&&200===r.status,r.ontimeout=()=>(Et._logger.warn(`Got timeout while pinging the ECDN url. the ping url: ${s}`),!1),r.send(),!1}))()}static handleRegexAction(t,e){return yt((function*(){const s=u.get().cdnUrl,r=Et._extractRegexActionFromData(e),a=Et._getRegExp(r);return!(s&&r&&a&&s.match(a))||r.checkAliveTimeoutMs>0&&!(yield Et._isECDNUrlAlive(r,s.replace(a,r.replacement)))?(Et._logger.debug("exiting handleRegexAction - not applying regex action."),t):(Et._replaceHostUrls(t,r),t)}))()}static _replaceHostUrls(t,e){Et._logger.debug("Starting to modify urls...");const s=t.sources,{hls:r,dash:a,progressive:i,image:o}=s;[...r,...a,...i,...o].forEach((t=>t.url=Et._applyRegexAction(e,t.url))),u.get().replaceHostOnlyManifestUrls||(Et._logger.debug("replaceHostOnlyManifestUrls flag is off - modifying captions and poster URLs"),s.captions&&s.captions.forEach((t=>t.url=Et._applyRegexAction(e,t.url))),"string"==typeof s.poster&&(s.poster=Et._applyRegexAction(e,s.poster))),Et._logger.debug("Finished modifying urls")}static _extractRegexActionFromData(t){var e;return null===(e=t.get(it.id))||void 0===e||null===(e=e.response)||void 0===e?void 0:e.playBackContextResult.getRequestHostRegexAction()}static _getRegExp(t){if(t&&t.pattern&&t.replacement)return new RegExp(t.pattern,"i")}}a(Et,"_logger",l("RegexActionHandler"));const ft=Et;class It extends pt{constructor(t,e){super(t,e),a(this,"_filterOptionsConfig",{redirectFromEntryId:!0}),this._logger=l("OVPProvider"),u.set(t.env),this._setFilterOptionsConfig(t.filterOptions),this._networkRetryConfig=Object.assign(this._networkRetryConfig,t.networkRetryParameters)}get env(){return u.get()}getMediaConfig(t){return t.ks&&(this.ks=t.ks,this._isAnonymous=!1),this.widgetId!==this.defaultWidgetId&&(this._isAnonymous=!1),this._dataLoader=new ct(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise(((e,s)=>{const r=t.entryId,a=t.referenceId;if(r||a){let i=this.ks;i||(i="{1:result:ks}",this._dataLoader.add(nt,{widgetId:this.widgetId}));const o=this._getEntryRedirectFilter(t);return this._dataLoader.add(it,{entryId:r,ks:i,redirectFromEntryId:o,referenceId:a}),this._dataLoader.fetchData().then((t=>{try{const s=this._parseDataFromResponse(t);ft.handleRegexAction(s,t).then(e)}catch(t){s(t)}}),(t=>{s(t)}))}s(new X(X.Severity.CRITICAL,X.Category.PROVIDER,X.Code.MISSING_MANDATORY_PARAMS,{message:"missing entry id"}))}))}doRequest(t,e){const s=e||this.ks,r=new ct(this.playerVersion,this.partnerId,s,this._networkRetryConfig);return new Promise(((e,a)=>(s||r.add(nt,{widgetId:this.widgetId}),t.forEach((t=>{r.add(t.loader,t.params,s||"{1:result:ks}")})),r.fetchData().then((t=>{try{e(t)}catch(t){a(t)}}),(t=>{a(t)})))))}_getEntryRedirectFilter(t){return"boolean"==typeof t.redirectFromEntryId?t.redirectFromEntryId:"boolean"!=typeof this._filterOptionsConfig.redirectFromEntryId||this._filterOptionsConfig.redirectFromEntryId}_setFilterOptionsConfig(t){t&&"boolean"==typeof t.redirectFromEntryId&&(this._filterOptionsConfig.redirectFromEntryId=t.redirectFromEntryId)}_parseDataFromResponse(t){this._logger.debug("Data parsing started");const e={session:{isAnonymous:this._isAnonymous,partnerId:this.partnerId},sources:this._getDefaultSourcesObject(),plugins:{}};if(this.uiConfId&&(e.session.uiConfId=this.uiConfId),t){if(t.has(nt.id)){const s=t.get(nt.id);s&&s.response&&(e.session.ks=s.response,this.widgetId!==this.defaultWidgetId&&(this.ks=e.session.ks))}else e.session.ks=this.ks;if(t.has(it.id)){const s=t.get(it.id);if(s&&s.response){const t=s.response;if($.hasBlockAction(t))throw new X(X.Severity.CRITICAL,X.Category.SERVICE,X.Code.BLOCK_ACTION,{action:$.getBlockAction(t),messages:$.getErrorMessages(t)});const r=$.getMediaEntry(this.isAnonymous?"":this.ks,this.partnerId,this.uiConfId,t);Object.assign(e.sources,this._getSourcesObject(r)),this._verifyMediaStatus(r),this._verifyHasSources(e.sources);const a=$.getBumper(t,this.isAnonymous?"":this.ks,this.partnerId);a&&Object.assign(e.plugins,{bumper:a})}}}return this._logger.debug("Data parsing finished",e),e}_verifyMediaStatus(t){if([g.EntryStatus.IMPORT,g.EntryStatus.PRECONVERT].includes(t.status))throw new X(X.Severity.CRITICAL,X.Category.SERVICE,X.Code.MEDIA_STATUS_NOT_READY,{messages:`Status of entry id ${t.id} is ${t.status} and is still being imported or converted`,data:{status}})}getPlaylistConfig(t){return t.ks&&(this.ks=t.ks,this._isAnonymous=!1),this.widgetId!==this.defaultWidgetId&&(this._isAnonymous=!1),this._dataLoader=new ct(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise(((e,s)=>{const r=t.playlistId;if(r){let t=this.ks;t||(t="{1:result:ks}",this._dataLoader.add(nt,{widgetId:this.widgetId})),this._dataLoader.add(ht,{playlistId:r,ks:t}),this._dataLoader.fetchData().then((t=>{e(this._parsePlaylistDataFromResponse(t))}),(t=>{s(t)}))}else s({success:!1,data:"Missing mandatory parameter"})}))}_parsePlaylistDataFromResponse(t){this._logger.debug("Data parsing started");const e=this._getPlaylistObject();if(t&&t.has(ht.id)){const s=t.get(ht.id);if(s&&s.response){const t=$.getPlaylist(s.response);e.id=t.id,e.poster=t.poster,e.metadata.name=t.name,e.metadata.description=t.description,e.playlistLastEntryId=t.playlistLastEntryId,t.items.forEach((t=>e.items.push({sources:this._getSourcesObject(t)})))}}return this._logger.debug("Data parsing finished",e),e}getEntryListConfig(t){return t.ks&&(this.ks=t.ks,this._isAnonymous=!1),this.widgetId!==this.defaultWidgetId&&(this._isAnonymous=!1),this._dataLoader=new ct(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise(((e,s)=>{const r=t.entries;if(r&&r.length){let a=this.ks;a||(a="{1:result:ks}",this._dataLoader.add(nt,{widgetId:this.widgetId}));const i=this._getEntryRedirectFilter(t);this._dataLoader.add(gt,{entries:r,ks:a,redirectFromEntryId:i}),this._dataLoader.fetchData(!1).then((t=>{e(this._parseEntryListDataFromResponse(t))}),(t=>{s(t)}))}else s({success:!1,data:"Missing mandatory parameter"})}))}_parseEntryListDataFromResponse(t){this._logger.debug("Data parsing started");const e=this._getPlaylistObject();if(t&&t.has(gt.id)){const s=t.get(gt.id);s&&s.response&&$.getEntryList(s.response).items.forEach((t=>e.items.push({sources:this._getSourcesObject(t)})))}return this._logger.debug("Data parsing finished",e),e}_getPlaylistObject(){return{id:"",metadata:{name:"",description:""},poster:"",playlistLastEntryId:"",items:[]}}_getDefaultSourcesObject(){return{hls:[],dash:[],progressive:[],image:[],id:"",duration:0,type:x.Type.UNKNOWN,poster:"",dvr:!1,vr:null,metadata:{name:"",description:"",tags:""}}}_getSourcesObject(t){const e=this._getDefaultSourcesObject(),s=t.sources.toJSON();return e.hls=s.hls,e.dash=s.dash,e.progressive=s.progressive,e.image=s.image,e.id=t.id,e.duration=t.duration,e.type=t.type,e.dvr=!!t.dvrStatus,e.poster=t.poster,e.downloadUrl=t.downloadUrl,t.sources.captions&&(e.captions=t.sources.captions),t.metadata&&"string"==typeof t.metadata.tags&&t.metadata.tags.split(", ").includes("360")&&(e.vr={}),Object.assign(e.metadata,t.metadata),e}}const _t="@playkit-js/playkit-js-providers-ovp",Rt="2.40.2-canary.0-c7a43ae";return e})()));
2
2
  //# sourceMappingURL=playkit-ovp-provider.js.map