(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[47487],{82093:function(e,t,r){"use strict";r.d(t,{Z:function(){return H}});var n=function(){function e(e){var t=this;this._insertTag=function(e){var r;r=0===t.tags.length?t.insertionPoint?t.insertionPoint.nextSibling:t.prepend?t.container.firstChild:t.before:t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(e,r),t.tags.push(e)},this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(e){e.forEach(this._insertTag)},t.insert=function(e){if(this.ctr%(this.isSpeedy?65e3:1)==0){var t;this._insertTag(((t=document.createElement("style")).setAttribute("data-emotion",this.key),void 0!==this.nonce&&t.setAttribute("nonce",this.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t))}var r=this.tags[this.tags.length-1];if(this.isSpeedy){var n=function(e){if(e.sheet)return e.sheet;for(var t=0;t0?m[S]+" "+w:s(w,/&\f/g,m[S])).trim())&&(d[b++]=E);return _(e,t,r,0===o?D:l,d,p,f)}function N(e,t,r,n){return _(e,t,r,A,c(e,0,n),c(e,n+1,-1),n)}var B=function(e,t,r){for(var n=0,i=0;n=i,i=w(),38===n&&12===i&&(t[r]=1),!E(i);)S();return c(y,e,v)},L=function(e,t){var r=-1,n=44;do switch(E(n)){case 0:38===n&&12===w()&&(t[r]=1),e[r]+=B(v-1,t,r);break;case 2:e[r]+=T(n);break;case 4:if(44===n){e[++r]=58===w()?"&\f":"",t[r]=e[r].length;break}default:e[r]+=o(n)}while(n=S());return e},F=function(e,t){var r;return r=L(x(e),t),y="",r},U=new WeakMap,j=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,r=e.parent,n=e.column===r.column&&e.line===r.line;"rule"!==r.type;)if(!(r=r.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||U.get(r))&&!n){U.set(e,!0);for(var i=[],o=F(t,i),a=r.props,s=0,u=0;s-1&&!e.return)switch(e.type){case A:e.return=function e(t,r){switch(45^l(t,0)?(((r<<2^l(t,0))<<2^l(t,1))<<2^l(t,2))<<2^l(t,3):0){case 5103:return M+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return M+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return M+t+C+t+P+t+t;case 6828:case 4268:return M+t+P+t+t;case 6165:return M+t+P+"flex-"+t+t;case 5187:return M+t+s(t,/(\w+).+(:[^]+)/,M+"box-$1$2"+P+"flex-$1$2")+t;case 5443:return M+t+P+"flex-item-"+s(t,/flex-|-self/,"")+t;case 4675:return M+t+P+"flex-line-pack"+s(t,/align-content|flex-|-self/,"")+t;case 5548:return M+t+P+s(t,"shrink","negative")+t;case 5292:return M+t+P+s(t,"basis","preferred-size")+t;case 6060:return M+"box-"+s(t,"-grow","")+M+t+P+s(t,"grow","positive")+t;case 4554:return M+s(t,/([^-])(transform)/g,"$1"+M+"$2")+t;case 6187:return s(s(s(t,/(zoom-|grab)/,M+"$1"),/(image-set)/,M+"$1"),t,"")+t;case 5495:case 3959:return s(t,/(image-set\([^]*)/,M+"$1$`$1");case 4968:return s(s(t,/(.+:)(flex-)?(.*)/,M+"box-pack:$3"+P+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+M+t+t;case 4095:case 3583:case 4068:case 2532:return s(t,/(.+)-inline(.+)/,M+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(d(t)-1-r>6)switch(l(t,r+1)){case 109:if(45!==l(t,r+4))break;case 102:return s(t,/(.+:)(.+)-([^]+)/,"$1"+M+"$2-$3$1"+C+(108==l(t,r+3)?"$3":"$2-$3"))+t;case 115:return~u(t,"stretch")?e(s(t,"stretch","fill-available"),r)+t:t}break;case 4949:if(115!==l(t,r+1))break;case 6444:switch(l(t,d(t)-3-(~u(t,"!important")&&10))){case 107:return s(t,":",":"+M)+t;case 101:return s(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+M+(45===l(t,14)?"inline-":"")+"box$3$1"+M+"$2$3$1"+P+"$2box$3")+t}break;case 5936:switch(l(t,r+11)){case 114:return M+t+P+s(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return M+t+P+s(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return M+t+P+s(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return M+t+P+t+t}return t}(e.value,e.length);break;case R:return O([b(e,{value:s(e.value,"@","@"+M)})],n);case D:if(e.length){var i,o;return i=e.props,o=function(t){var r;switch(r=t,(r=/(::plac\w+|:read-\w+)/.exec(r))?r[0]:r){case":read-only":case":read-write":return O([b(e,{props:[s(t,/:(read-\w+)/,":"+C+"$1")]})],n);case"::placeholder":return O([b(e,{props:[s(t,/:(plac\w+)/,":"+M+"input-$1")]}),b(e,{props:[s(t,/:(plac\w+)/,":"+C+"$1")]}),b(e,{props:[s(t,/:(plac\w+)/,P+"input-$1")]})],n)}return""},i.map(o).join("")}}}],H=function(e){var t,r,i,a,m,b,P=e.key;if("css"===P){var C=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(C,function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))})}var M=e.stylisPlugins||W,D={},A=[];a=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+P+' "]'),function(e){for(var t=e.getAttribute("data-emotion").split(" "),r=1;r2||E(g)>3?"":" "}(I);break;case 92:q+=function(e,t){for(var r;--t&&S()&&!(g<48)&&!(g>102)&&(!(g>57)||!(g<65))&&(!(g>70)||!(g<97)););return r=v+(t<6&&32==w()&&32==S()),c(y,e,r)}(v-1,7);continue;case 47:switch(w()){case 42:case 47:p(_(C=function(e,t){for(;S();)if(e+g===57)break;else if(e+g===84&&47===w())break;return"/*"+c(y,t,v-1)+"*"+o(47===e?e:S())}(S(),v),r,n,k,o(g),c(C,2,-2),0),P);break;default:q+="/"}break;case 123*B:x[M++]=d(q)*F;case 125*B:case 59:case 0:switch(U){case 0:case 125:L=0;case 59+D:-1==F&&(q=s(q,/\f/g,"")),O>0&&d(q)-A&&p(O>32?N(q+";",i,n,A-1):N(s(q," ","")+";",i,n,A-2),P);break;case 59:q+=";";default:if(p(H=Z(q,r,n,M,D,a,x,j,V=[],W=[],A),m),123===U){if(0===D)e(q,r,H,H,V,m,A,x,W);else switch(99===R&&110===l(q,3)?100:R){case 100:case 108:case 109:case 115:e(t,H,H,i&&p(Z(t,H,H,0,0,a,x,j,a,V=[],A),W),a,W,A,x,i?V:W);break;default:e(q,H,H,H,[""],W,0,x,W)}}}M=D=O=0,B=F=1,j=q="",A=b;break;case 58:A=1+d(q),O=I;default:if(B<1){if(123==U)--B;else if(125==U&&0==B++&&125==(g=v>0?l(y,--v):0,h--,10===g&&(h=1,f--),g))continue}switch(q+=o(U),U*B){case 38:F=D>0?1:(q+="\f",-1);break;case 44:x[M++]=(d(q)-1)*F,F=1;break;case 64:45===w()&&(q+=T(S())),R=w(),D=A=d(j=q+=function(e){for(;!E(w());)S();return c(y,e,v)}(v)),U++;break;case 45:45===I&&2==d(q)&&(B=0)}}return m}("",null,null,null,[""],t=x(t=e),0,[0],t),y="",r),R)};m=function(e,t,r,n){b=r,B(e?e+"{"+t.styles+"}":t.styles),n&&(L.inserted[t.name]=!0)};var L={key:P,sheet:new n({key:P,container:a,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:D,registered:{},insert:m};return L.sheet.hydrate(A),L}},59287:function(e,t,r){"use strict";r.d(t,{T:function(){return u},i:function(){return o},w:function(){return s}});var n=r(72163),i=r(82093);r(52153),r(90490);var o=!0,a=n.createContext("undefined"!=typeof HTMLElement?(0,i.Z)({key:"css"}):null);a.Provider;var s=function(e){return(0,n.forwardRef)(function(t,r){return e(t,(0,n.useContext)(a),r)})};o||(s=function(e){return function(t){var r=(0,n.useContext)(a);return null===r?(r=(0,i.Z)({key:"css"}),n.createElement(a.Provider,{value:r},e(t,r))):e(t,r)}});var u=n.createContext({})},40181:function(e,t,r){"use strict";r.d(t,{F4:function(){return c},iv:function(){return l},xB:function(){return u}});var n=r(59287),i=r(72163),o=r(40528),a=r(90490),s=r(52153);r(82093),r(23186);var u=(0,n.w)(function(e,t){var r=e.styles,u=(0,s.O)([r],void 0,i.useContext(n.T));if(!n.i){for(var l,c=u.name,d=u.styles,p=u.next;void 0!==p;)c+=" "+p.name,d+=p.styles,p=p.next;var f=!0===t.compat,h=t.insert("",{name:c,styles:d},t.sheet,f);return f?null:i.createElement("style",((l={})["data-emotion"]=t.key+"-global "+c,l.dangerouslySetInnerHTML={__html:h},l.nonce=t.sheet.nonce,l))}var m=i.useRef();return(0,a.j)(function(){var e=t.key+"-global",r=new t.sheet.constructor({key:e,nonce:t.sheet.nonce,container:t.sheet.container,speedy:t.sheet.isSpeedy}),n=!1,i=document.querySelector('style[data-emotion="'+e+" "+u.name+'"]');return t.sheet.tags.length&&(r.before=t.sheet.tags[0]),null!==i&&(n=!0,i.setAttribute("data-emotion",e),r.hydrate([i])),m.current=[r,n],function(){r.flush()}},[t]),(0,a.j)(function(){var e=m.current,r=e[0];if(e[1]){e[1]=!1;return}if(void 0!==u.next&&(0,o.My)(t,u.next,!0),r.tags.length){var n=r.tags[r.tags.length-1].nextElementSibling;r.before=n,r.flush()}t.insert("",u,r,!1)},[t,u.name]),null});function l(){for(var e=arguments.length,t=Array(e),r=0;r=4;++n,i-=4)t=(65535&(t=255&e.charCodeAt(n)|(255&e.charCodeAt(++n))<<8|(255&e.charCodeAt(++n))<<16|(255&e.charCodeAt(++n))<<24))*1540483477+((t>>>16)*59797<<16),t^=t>>>24,r=(65535&t)*1540483477+((t>>>16)*59797<<16)^(65535&r)*1540483477+((r>>>16)*59797<<16);switch(i){case 3:r^=(255&e.charCodeAt(n+2))<<16;case 2:r^=(255&e.charCodeAt(n+1))<<8;case 1:r^=255&e.charCodeAt(n),r=(65535&r)*1540483477+((r>>>16)*59797<<16)}return r^=r>>>13,(((r=(65535&r)*1540483477+((r>>>16)*59797<<16))^r>>>15)>>>0).toString(36)}(a)+l,styles:a,next:o}}},67402:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});var n={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1}},90490:function(e,t,r){"use strict";r.d(t,{L:function(){return a},j:function(){return s}});var n,i=r(72163),o=!!(n||(n=r.t(i,2))).useInsertionEffect&&(n||(n=r.t(i,2))).useInsertionEffect,a=o||function(e){return e()},s=o||i.useLayoutEffect},40528:function(e,t,r){"use strict";function n(e,t,r){var n="";return r.split(" ").forEach(function(r){void 0!==e[r]?t.push(e[r]+";"):n+=r+" "}),n}r.d(t,{My:function(){return o},fp:function(){return n},hC:function(){return i}});var i=function(e,t,r){var n=e.key+"-"+t.name;!1===r&&void 0===e.registered[n]&&(e.registered[n]=t.styles)},o=function(e,t,r){i(e,t,r);var n=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var o=t;do e.insert(t===o?"."+n:"",o,e.sheet,!0),o=o.next;while(void 0!==o)}}},75863:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GLUON_VERSION=void 0,t.GLUON_VERSION="5.6.0"},13369:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseAsyncDetail=void 0;var n=r(91261),i=r(93218),o=r(86485),a=function(){function e(e){this._getDetails=e,this._incrementingId=new o.IncrementingId,this._currentId=this._incrementingId.getNext()}return e.prototype.getCachedDetails=function(){return this._details},e.prototype.clearCachedDetails=function(){this._currentId=this._incrementingId.getNext(),this._details=void 0,this._detailsPromise=void 0},e.prototype.getDetails=function(){return void 0!==this._details?this._details:this._getDetailsSyncOrAsync()},e.prototype._getDetailsSyncOrAsync=function(){var e=this;if(void 0===this._detailsPromise&&(this._detailsPromise=this._getDetails()),this._detailsPromise instanceof Promise){var t=this._currentId;return this._getDetailsAsync(this._detailsPromise).then(function(r){return t===e._currentId&&(e._details=r),r})}return this._details=this._detailsPromise,this._details},e.prototype._getDetailsAsync=function(e){return n.__awaiter(this,void 0,void 0,function(){var t;return n.__generator(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,e];case 1:return[2,r.sent()];case 2:throw t=r.sent(),this._details=void 0,this._detailsPromise=void 0,i.WrappedError.wrap(t,"AsyncDetailsError");case 3:return[2]}})})},e}();t.BaseAsyncDetail=a},8771:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseManifestMaker=void 0;var n=r(91261),i=r(20217),o=r(34167),a=function(){function e(){this._wasEverDynamic=!1}return e.prototype.getManifestLoad=function(e){var t=this;return this._wasEverDynamic||void 0===e.dynamicInfo||(this._wasEverDynamic=!0),{getManifest:function(){return e},getImage:function(r){return t.getImage(e,r)},refresh:function(e){return t.refresh(e)},onWarning:new i.Emitter}},e.prototype.getImage=function(e,t){return n.__awaiter(this,void 0,void 0,function(){var r,i,a;return n.__generator(this,function(n){switch(n.label){case 0:if(void 0===(r=o.PlayerUtil.getPeriodForTime(e.periods,t.timeSeconds))||void 0===(i=o.PlayerUtil.getClosestSizeStream(r.image,t.targetWidth,t.targetHeight)))return[2];return[4,i.getDetails()];case 1:return a=n.sent(),[2,o.PlayerUtil.getSegmentByTime(a.segments,t.timeSeconds)]}})})},e}();t.BaseManifestMaker=a},45e3:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContainerConstants=void 0;var r=function(){function e(){}return e.DEFAULT_TEXT_MIME_TYPE="text/vtt",e.DEFAULT_TEXT_CODECS="",e.DEFAULT_IMAGE_MIME_TYPE="image/jpeg",e.DEFAULT_IMAGE_CODECS="jpeg",e}();t.ContainerConstants=r},86485:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IncrementingId=void 0;var r=function(){function e(){this._current=0}return e.prototype.getNext=function(){return this._current++},e}();t.IncrementingId=r},88086:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentCollection=void 0;var n=r(91261),i=r(8339),o=r(86485),a=r(34167),s=function(){function e(t,r,n,i){this._logger=t,this._raw=r,this._periodRange=n,this._isDynamic=i,this.id=e._incrementingId.getNext(),this._dummySegment={timing:{startScaled:r.getPresentationTimeOffsetScaled(),endScaled:r.getPresentationTimeOffsetScaled()},segment:{id:"".concat(this.id,"-dummy"),position:0,keyId:void 0,createUri:"",initSegment:void 0}},this._subViewToPeriod()}return Object.defineProperty(e.prototype,"length",{get:function(){var e=this._mapLength();return 0===e?1:e},enumerable:!1,configurable:!0}),e.prototype.setSubView=function(e,t){var r=this.length;if(void 0!==e&&(e<0||e>=r))throw new i.InvalidOperationError("Invalid subview start start=".concat(e," end=").concat(t," with length=").concat(this.length," (subview ").concat(this._subViewStart,"-").concat(this._subViewEnd,")"));if(void 0!==t&&(t<0||t>r||(null!=e?e:0)>t))throw new i.InvalidOperationError("Invalid subview end start=".concat(e," end=").concat(t," with length=").concat(this.length," (subview ").concat(this._subViewStart,"-").concat(this._subViewEnd,")"));var n=void 0===e?this._subViewStart:this._mapIndex(e),o=void 0===t?this._subViewEnd:this._mapIndex(t);this._subViewStart=n,this._subViewEnd=o},e.prototype.refresh=function(e){this._subViewStart=e._subViewStart,this._subViewEnd=e._subViewEnd,this._periodRange=e._periodRange,this._isDynamic=e._isDynamic,this._raw.refresh(e._raw)},e.prototype.getTiming=function(e){var t=this.tryGetTiming(e);if(void 0===t)throw new i.InvalidOperationError("Unable to get segment range at idx=".concat(e," length=").concat(this.length," (subview ").concat(this._subViewStart,"-").concat(this._subViewEnd,")"));return t},e.prototype.tryGetTiming=function(e){if(0===e&&this._isDummySegmentCollection())return this._getDummySegment();if(!(e<0)&&!(e>=this.length)){var t=this._mapIndex(e),r=this._raw.tryGetTiming(t);if(void 0!==r)return this._mapTiming(r,e)}},e.prototype.getSegment=function(e){var t=this.tryGetSegment(e);if(void 0===t)throw new i.InvalidOperationError("Unable to get segment at idx=".concat(e," length=").concat(this.length," (subview ").concat(this._subViewStart,"-").concat(this._subViewEnd,")"));return t},e.prototype.tryGetSegment=function(e){if(0===e&&this._isDummySegmentCollection())return this._getDummySegment();if(!(e<0)&&!(e>=this.length)){var t=this._mapIndex(e),r=this._raw.tryGetSegment(t);if(void 0!==r){var i=this._mapTiming(r.timing,e);return n.__assign(n.__assign({},r.segment),i)}}},e.prototype._getDummySegment=function(){var e=this._mapTiming(this._dummySegment.timing,0);return n.__assign(n.__assign(n.__assign({},this._dummySegment.segment),e),{end:e.start})},e.prototype._mapLength=function(){var e=this._raw.getLength();return void 0!==this._subViewEnd&&this._subViewEnd0?n[n.length-1]:void 0)||this;return i.originalErrors=n,i}return n.__extends(t,e),t.prototype.toString=function(){for(var e=i.WrappedError.getStandardMessage(this),t=0;t nodes found in manifest ".concat(this._url.toString()),a);for(v=0,u=t.getDynamicInformation(i),this._useLiveManifestOptions=void 0!==u,d=this._getStreamInfs(i,void 0!==u,e),p=[],f=this._getManifestOptions(),h=new l.IncrementingId,m=new s.DashManifestVariantParser(this._system,f),g=d;v0&&(c=null===(o=e.template.segmentTimes)||void 0===o?void 0:o.getTime(0),p=null===(a=e.template.segmentTimes)||void 0===a?void 0:a.getTime(e.template.segmentTimes.length-1)),(null!==(u=null===(s=t.template.segmentTimes)||void 0===s?void 0:s.length)&&void 0!==u?u:0)>0&&(d=null===(l=t.template.segmentTimes)||void 0===l?void 0:l.getTime(0)),"audio"===r||"video"===r)?e.template.uriTemplate===t.template.uriTemplate&&e.template.timescale===t.template.timescale&&void 0!==c&&void 0!==d&&void 0!==p&&d.position===p.position+1&&t.template.presentationTimeOffsetScaled===e.template.presentationTimeOffsetScaled+(p.endScaled-c.startScaled):(void 0===c||void 0===d||c.position<=d.position)&&e.template.durationBasedSegments===t.template.durationBasedSegments&&(!e.template.durationBasedSegments||void 0!==e.template.totalDurationSeconds&&void 0!==t.template.totalDurationSeconds&&e.template.presentationTimeOffsetScaled===t.template.presentationTimeOffsetScaled&&e.template.timescale===t.template.timescale&&this._compareTemplateSegmentTimes(e.template.segmentTimes,t.template.segmentTimes))&&e.template.uriTemplate===t.template.uriTemplate&&e.template.timescale===t.template.timescale}return void 0!==e.base&&void 0!==t.base&&e.base.uri===t.base.uri&&e.base.indexRange[0]===t.base.indexRange[0]&&e.base.indexRange[1]===t.base.indexRange[1]&&e.base.initializationRange[0]===t.base.initializationRange[0]&&e.base.initializationRange[1]===t.base.initializationRange[1]},t._compareTemplateSegmentTimes=function(e,t){var r=null==e?void 0:e.getTime(0),n=null==t?void 0:t.getTime(0);return void 0===r||void 0===n||r.endScaled-r.startScaled==n.endScaled-n.startScaled},t._compareStreamsDrm=function(e,t){return e.drm.length===t.drm.length&&e.drm.every(function(e,r){return e.keyId===t.drm[r].keyId})},t._isStreamsMatch=function(e,t){return!!(e.audio.length===t.audio.length&&e.video.length===t.video.length&&e.text.length===t.text.length&&e.image.length===t.image.length&&this._areStreamsMergeable(e.audio,t.audio,this._compareAudioStreams)&&this._areStreamsMergeable(e.video,t.video,this._compareVideoStreams)&&this._areStreamsMergeable(e.image,t.image,this._compareImageStreams)&&this._areStreamsMergeable(e.text,t.text,this._compareTextStreams))},t._extendStream=function(e,t,r){for(var i,o,s,u,l=[{to:t.audio,from:r.audio},{to:t.video,from:r.video},{to:t.text,from:r.text},{to:t.image,from:r.image}],c=0;c0&&h.length>0&&void 0!==f[0].template&&void 0!==h[0].template)for(var m=0;m0&&(null===(i=g.segmentTimes)||void 0===i?void 0:i.length)>0){if(v.durationBasedSegments){if(void 0===v.totalDurationSeconds||void 0===g.totalDurationSeconds)throw new d.ManifestProcessingError("Failed to flatten periods, missing duration on duration based segments");var y=null!==(s=null===(o=v.segmentTimes)||void 0===o?void 0:o.getTime(0))&&void 0!==s?s:null===(u=g.segmentTimes)||void 0===u?void 0:u.getTime(0);if(void 0===y)break;var _=y.endScaled-y.startScaled,b=v.totalDurationSeconds+g.totalDurationSeconds;f[m].template=n.__assign(n.__assign({},v),{totalDurationSeconds:b,segmentTimes:a.DashManifestPeriodParser.getTemplateSegmentTimes(v.timescale,b,y.position,_,v.presentationTimeOffsetScaled)})}else f[m].template=n.__assign(n.__assign({},v),{segmentTimes:a.DashManifestPeriodParser.combineTemplateSegmentTimes(v.segmentTimes,g.segmentTimes)})}}}void 0!==t.periodDuration&&void 0!==r.periodDuration&&(t.periodDuration=e.performSecondsAddition(t.periodDuration,r.periodDuration))},t._areStreamsMergeable=function(e,t,r){for(var n=new u.HashMap,i=0;i0&&!n)throw new i.ManifestParserError("Found non-zero period time ".concat(e," at index ").concat(o));t=this.performSecondsAddition(t,u),r=""}else{var l=","===a?".":a;if(void 0===this._allowedNumberCharactersMap[l])throw new i.ManifestParserError("Found invalid number character ".concat(a," at index ").concat(o));r+=l}}}return t},t.prototype.parseRange=function(e){var t=e.split("-",2),r=parseInt(t[0]),n=parseInt(t[1]);if(!isFinite(r)||!isFinite(n))throw Error("Failed to parse range with input '".concat(e,"'"));return[r,n]},t.prototype.parseAudioDescription=function(e){for(var t=!1,r=!1,n=0,i=e.attributes;n0?r:void 0},t.prototype.parseDolbyAtmos=function(e){for(var t=!1,r=!1,n=0,i=e.attributes;n0?this.stream.drm[0].keyId:void 0,i=this.stream.initSegment;return{segment:{id:"".concat(this.stream.id,"-").concat(e),position:e,createUri:this.uri,keyId:n,initSegment:i,startByte:t.startByte,endByte:t.endByte},timing:r}}},e.prototype.tryGetTiming=function(e){var t=this.base[e];if(void 0!==t)return{startScaled:t.start,endScaled:t.end}},e}();t.DashSegmentBaseCollection=r},76690:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DashSegmentListCollection=void 0;var r=function(){function e(e,t){this.stream=e,this.list=t}return e.prototype.refresh=function(e){this.list.duration=e.list.duration,this.list.initializationUri=e.list.initializationUri,this.list.items=e.list.items.slice(),this.list.timescale=e.list.timescale},e.prototype.getStreamInf=function(){return this.stream},e.prototype.getTimescale=function(){return this.list.timescale},e.prototype.getPresentationTimeOffsetScaled=function(){return 0},e.prototype.getLength=function(){return this.list.items.length},e.prototype.tryGetSegment=function(e){var t=this.list.items[e],r=this.tryGetTiming(e);if(void 0!==t&&void 0!==r)return{segment:{id:"".concat(this.stream.id,"-").concat(e),position:e,keyId:void 0,createUri:t.mediaUri,initSegment:this.stream.initSegment},timing:r}},e.prototype.tryGetTiming=function(e){if(void 0!==this.list.items[e]){var t=this.list.duration,r=t*e;return{startScaled:r,endScaled:r+t}}},e}();t.DashSegmentListCollection=r},57031:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DashSegmentSingleFileCollection=void 0;var r=function(){function e(e,t,r){this.stream=e,this.singleFile=t,this._maxDuration=r}return e.prototype.refresh=function(e){this.singleFile.uri=e.singleFile.uri,this._maxDuration=e._maxDuration},e.prototype.getStreamInf=function(){return this.stream},e.prototype.getTimescale=function(){return 1},e.prototype.getPresentationTimeOffsetScaled=function(){return 0},e.prototype.getLength=function(){return 1},e.prototype.tryGetSegment=function(e){if(0===e){var t=this.tryGetTiming(e);if(void 0!==t)return{segment:{id:"".concat(this.stream.id,"-single-file"),position:0,keyId:void 0,createUri:this.singleFile.uri,initSegment:void 0},timing:t}}},e.prototype.tryGetTiming=function(e){if(0===e)return{startScaled:0,endScaled:this._maxDuration}},e}();t.DashSegmentSingleFileCollection=r},6133:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DashSegmentTemplateCollection=void 0;var n=r(77630),i=function(){function e(e,t){this.stream=e,this.template=t,this._dashUtil=new n.DashUtil}return e.prototype.refresh=function(e){this.template.durationBasedSegments=e.template.durationBasedSegments,this.template.finalizationData=e.template.finalizationData,this.template.initializationUri=e.template.initializationUri,this.template.presentationTimeOffsetScaled=e.template.presentationTimeOffsetScaled,this.template.segmentTimes=e.template.segmentTimes,this.template.timescale=e.template.timescale,this.template.totalDurationSeconds=e.template.totalDurationSeconds,this.template.uriTemplate=e.template.uriTemplate},e.prototype.getStreamInf=function(){return this.stream},e.prototype.getTimescale=function(){return this.template.timescale},e.prototype.getPresentationTimeOffsetScaled=function(){return this.template.presentationTimeOffsetScaled},e.prototype.getLength=function(){var e,t;return null!==(t=null===(e=this.template.segmentTimes)||void 0===e?void 0:e.length)&&void 0!==t?t:0},e.prototype.tryGetSegment=function(e){var t,r=null===(t=this.template.segmentTimes)||void 0===t?void 0:t.getTime(e),n=this.tryGetTiming(e);if(void 0!==r&&void 0!==n){var i=this.stream.drm.length>0?this.stream.drm[0].keyId:void 0,o=this._dashUtil.getUriFromTemplate(this.template.uriTemplate,r.position,r.startScaled,this.stream.representationId);return{segment:{id:"".concat(this.stream.id,"-").concat(r.position),position:r.position,keyId:i,createUri:o,initSegment:this.stream.initSegment},timing:n}}},e.prototype.tryGetTiming=function(e){var t,r=null===(t=this.template.segmentTimes)||void 0===t?void 0:t.getTime(e);if(void 0!==r)return{startScaled:r.startScaled,endScaled:r.endScaled}},e}();t.DashSegmentTemplateCollection=i},68137:function(e,t){"use strict";var r,n;(n=r||(r={})).BANDWIDTH="bandwidth",n.BUFFER="buffer",n.HYBRID="hybrid",n.RANDOM="random"},42380:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OptimalBitrateForecaster=void 0;var n=r(91261),i=r(37602),o=r(93851),a=r(11625),s=r(22e3),u=function(){function e(t,r){var n,s,u,l;this._bufferStabilityAnalyzer=new o.BufferStabilityAnalyzer,this._ratioAnalyzer=new a.DownloadRatioAnalyzer,this._bufferPrimed=!1,this._bufferCapacitySec=0,this._bufferLevelSec=0,this._segmentDurationSec=0,this._initialBitrateForecastPolicy=null!==(n=null==r?void 0:r.bandwidthForecastPolicy)&&void 0!==n?n:0,this._initialBandwidth=null!==(s=null==r?void 0:r.initialBandwidth)&&void 0!==s?s:0,this._maxBandwidth=null==r?void 0:r.maxBandwidth,this._abrProtocol=null!==(u=null==r?void 0:r.protocol)&&void 0!==u?u:e.DEFAULT_ABR_PROTOCOL,this._avoidDownshiftBufferLevelSeconds=null!==(l=null==r?void 0:r.avoidDownshiftBufferLevelSeconds)&&void 0!==l?l:0,this._bandwidthAnalyzer=new i.BandwidthQualityAnalyzer(t,null==r?void 0:r.grandMeanSampleSize),this._systemInterface=t,this._systemInterface.logInfo("Using ".concat(this._abrProtocol," ABR protocol.")),this._logAbrDebug("bandwidthForecastPolicy=".concat(this._initialBitrateForecastPolicy," initialBandwidth=").concat(this._initialBandwidth,"bps maxBandwidth=").concat(this._maxBandwidth,"bps"))}return Object.defineProperty(e.prototype,"currentBitrate",{get:function(){return void 0===this._currentBitrate?0:this._currentBitrate},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"protocol",{set:function(e){this._abrProtocol=e,this._systemInterface.logInfo("Using ".concat(this._abrProtocol," ABR protocol."))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"override",{set:function(e){this._abrOverride=e,this._logAbrDebug("set abrOverride to ".concat(this._abrOverride,"bps"))},enumerable:!1,configurable:!0}),e.prototype.forecast=function(e){if(0!==e.length){if(void 0!==this._maxBandwidth){var t,r=this._maxBandwidth,n=e.filter(function(e){return e.bandwidth<=r});if(0===n.length){var i=e.getFirst();return this._logAbrDebug("forecast: the specified max bandwidth of ".concat(r,"bps is lower than all available variants, returning lowest variant (").concat(i.bandwidth,"bps)")),i}n.length!==e.length&&this._logAbrDebug("forecast: applied max bandwidth of ".concat(r,"bps, top variant bitrate is now ").concat(n.getLast().bandwidth,"bps instead of ").concat(e.getLast().bandwidth,"bps")),e=n}if(this._bufferStabilityAnalyzer.adjustPlaybackUtility(e),this._bufferStabilityAnalyzer.adjustAncillaryValues(e.getLast().bandwidth),void 0!==this._abrOverride){var o=this._closestItem(e,this._abrOverride);if(void 0!==o)return this._logAbrDebug("forecast: applied override of ".concat(this._abrOverride,"bps to pick ").concat(o.bandwidth,"bps variant")),o;this._logAbrDebug("forecast: could not apply override of ".concat(this._abrOverride,"bps because it is smaller than lowest variant (").concat(e.getFirst().bandwidth,"bps)"))}switch(this._abrProtocol){case"bandwidth":t=this._bandwidthAbrForecast(e);break;case"buffer":t=this._bufferAbrForecast(e);break;case"hybrid":t=this._hybridAbrForecast(e);break;case"random":t=this._randomAbrForecast(e)}if(void 0!==(t=null!=t?t:this._defaultVariant(e)))return this._currentBitrate!==t.bandwidth&&this._logAbrDebug("forecast: shifted variant from ".concat(this._currentBitrate,"bps to ").concat(t.bandwidth,"bps")),this._currentBitrate=t.bandwidth,t}},e.prototype.getTopBitrateVariant=function(e){var t;return void 0===this._maxBandwidth?e.tryGetLast():null!==(t=this._closestItem(e,this._maxBandwidth))&&void 0!==t?t:e.tryGetFirst()},e.prototype.getCurrentBandwidthEstimate=function(){return this._projectBandwidth()},e.prototype.handlePlaybackStateChange=function(e){"SEEKING"===e&&(this._logAbrDebug("playback state is ".concat(e," so setting buffer to not be primed")),this._bufferPrimed=!1)},e.prototype.handleSegmentRetry=function(){this._bandwidthAnalyzer.handleSegmentRetry(),this._ratioAnalyzer.handleSegmentRetry()},e.prototype.onSegmentDownloaded=function(e,t,r,n){this._bandwidthAnalyzer.processValue(e,t,r),void 0!==n&&this._ratioAnalyzer.processValue(t,r,1e3*(n.end-n.start))},e.prototype.setBufferCapacitySec=function(e){this._bufferCapacitySec=e,this._bufferStabilityAnalyzer.setBufferCapacitySec(e),this._logAbrDebug("set buffer capacity to ".concat(e,"s"))},e.prototype.setBufferLevelSec=function(e){this._bufferLevelSec=e,this._bufferStabilityAnalyzer.setBufferLevelSec(e),this._logAbrDebug("set buffer level to ".concat(e,"s"))},e.prototype.setSegmentDurationSec=function(e){this._segmentDurationSec=e,this._bufferStabilityAnalyzer.setSegmentDurationSec(e),this._logAbrDebug("set segment duration to ".concat(e,"s"))},e.prototype.setManifest=function(e){this._manifest=e},e.prototype._defaultVariant=function(e){if(0!==e.length){if(0!==this._initialBandwidth){var t=this._closestItem(e,this._initialBandwidth);if(void 0!==t)return this._logAbrDebug("forecast: applied initial bandwidth of ".concat(this._initialBandwidth,"bps to pick ").concat(t.bandwidth,"bps variant")),t;this._logAbrDebug("forecast: could not apply initial bandwidth of ".concat(this._initialBandwidth,"bps because it is smaller than lowest variant (").concat(e.getFirst().bandwidth,"bps)"))}var r=0;switch(this._initialBitrateForecastPolicy){case 3:r=Math.floor((e.length-1)/4);break;case 1:r=Math.floor(e.length/2),e.length%2==0&&(r-=1);break;case 2:r=e.length-1}var n=e.getAt(r);return this._logAbrDebug("forecast: applied bitrate policy of ".concat(this._initialBitrateForecastPolicy," to pick ").concat(n.bandwidth,"bps variant")),n}},e.prototype._hybridAbrForecast=function(e){if((null===(t=this._manifest)||void 0===t?void 0:t.dynamicInfo)!==void 0)return this._logAbrDebug("forecast: hybrid: using bandwidth forecast for live"),this._bandwidthAbrForecast(e);var t,r,n=this._bufferAbrForecast(e);if(this._bufferPrimed)return this._logAbrDebug("forecast: hybrid: buffer primed so using buffer forecast of ".concat(null==n?void 0:n.bandwidth,"bps")),n;var i=this._bandwidthAbrForecast(e);if(void 0===n||void 0===i)return this._logAbrDebug("forecast: hybrid: buffer not primed and undefined buffer or bandwidth forecast so using bandwidth forecast of ".concat(null==i?void 0:i.bandwidth,"bps")),i;var o=this._bufferCapacitySec>=s.PlayerConstants.DEFAULT_RELATIVE_BUFFER_END&&(n.bandwidth>i.bandwidth||n===e.tryGetLast());return(this._logAbrDebug("forecast: hybrid: primed=".concat(o," bufferCapacity=").concat(this._bufferCapacitySec,"s threshold=").concat(s.PlayerConstants.DEFAULT_RELATIVE_BUFFER_END,"s bufferForecast=").concat(n.bandwidth,"bps bandwidthForecast=").concat(i.bandwidth,"bps max=").concat(null===(r=e.tryGetLast())||void 0===r?void 0:r.bandwidth,"bps")),o)?(this._bufferPrimed=!0,this._logAbrDebug("forecast: hybrid: buffer primed so using buffer forecast of ".concat(n.bandwidth,"bps")),n):(this._logAbrDebug("forecast: hybrid: buffer not primed so using bandwidth forecast of ".concat(i.bandwidth,"bps")),i)},e.prototype._projectBandwidth=function(){return this._bandwidthAnalyzer.projectBandwidth()},e.prototype._bandwidthAbrForecast=function(e){var t,r=this._projectBandwidth();if(0===r){this._logAbrDebug("forecast: bandwidth: no bandwidth projection available yet");return}if(void 0!==this._currentBitrate&&r=this._avoidDownshiftBufferLevelSeconds)&&(this._logAbrDebug("forecast: bandwidth: ignoring bandwidth projection of ".concat(r,"bps because we think we can avoid a downshift (avoidDownshiftBufferLevel=").concat(this._avoidDownshiftBufferLevelSeconds,"s bufferLevel=").concat(this._bufferLevelSec,"s ratioAnalyzer.shouldConsiderDownshift()=").concat(n,")")),r=this._currentBitrate)}var i=null!==(t=this._closestItem(e,r))&&void 0!==t?t:e.getFirst();return this._logAbrDebug("forecast: bandwidth: used bandwidth projection of ".concat(r,"bps to pick ").concat(i.bandwidth,"bps variant")),i},e.prototype._bufferAbrForecast=function(e){var t=this._bufferStabilityAnalyzer.forecast(e);return this._logAbrDebug("forecast: buffer: used bufferCapacity=".concat(this._bufferCapacitySec,"s bufferLevel=").concat(this._bufferLevelSec,"s segmentDuration=").concat(this._segmentDurationSec,"s to pick ").concat(null==t?void 0:t.bandwidth,"bps variant")),t},e.prototype._randomAbrForecast=function(e){return e.getAt(Math.floor(Math.random()*e.length))},e.prototype._closestItemIndex=function(e,t){var r=e.find({bandwidth:t});if(r<0){var n=Math.abs(r)-2;return n<0?-1:n}return r},e.prototype._closestItem=function(e,t){var r=this._closestItemIndex(e,t);if(-1!==r)return e.getAt(r)},e.prototype._logAbrDebug=function(e){for(var t,r=[],i=1;i=e.MINIMUM_BYTE_SAMPLE_SIZE&&this._logAbrDebug("processValue: reached minimum sample size (".concat(this._bytesSampled," bytes)"))),r0&&this._normalizeValueUsingStandardScore(n,this._metrics.latencyStatistics)},e.prototype.projectBandwidth=function(){var t=0;return this._bytesSampled0&&e.hasCachedValues&&(this._logAbrDebug("processValue: resetting metrics upon receipt of valid fragment"),this._resetBandwidthStatistics(e))},e.prototype._handleInvalidFragment=function(e){0!==e.montgomery.length&&e.hasCachedValues||(this._logAbrDebug("processValue: setting hasCachedValues to true upon receipt of invalid fragment"),e.hasCachedValues=!0)},e.prototype._resetBandwidthStatistics=function(e){e.mean=0,e.montgomery=[],e.hasCachedValues=!1,e.variance=0},e.prototype._reset=function(){this._bytesSampled=0,this._resetBandwidthStatistics(this._metrics.bandwidthStatistics),this._resetBandwidthStatistics(this._metrics.latencyStatistics)},e.prototype._enforceAccumulatorCapacity=function(t){t.splice(0,Math.max(0,t.length-e.HISTORY_RETENTION_CAP))},e.prototype._normalizeValueUsingStandardScore=function(t,r){var n,i=this._delta(t,r),o=this._lambda(r),a=this._ema(o,i,r.mean),s=this._emaVariance(o,i,r.variance),u=Math.sqrt(s),l=this._standardScore(t,a,u);this._logAbrDebug("normalize: value=".concat(t," delta=").concat(i," lambda=").concat(o," ema=").concat(a," variance=").concat(s," standardDeviation=").concat(u," standardScore=").concat(l)),l<0&&Math.abs(l)>=e.DECREASING_Z_SCORE?n="decreased":l>0&&Math.abs(l)>=e.INCREASING_Z_SCORE&&(n="increased"),void 0!==n?(this._logAbrDebug("normalize: bandwidth ".concat(n," by a lot so resetting stats")),this._resetBandwidthStatistics(r),this._normalizeValueUsingStandardScore(t,r)):(r.variance=s,r.mean=a,r.montgomery.push(a),this._enforceAccumulatorCapacity(r.montgomery),this._logAbrDebug("normalize: new bandwidth projection is ".concat(this.projectBandwidth(),"bps")))},e.prototype._standardScore=function(e,t,r){return 0===r?0:(e-t)/r},e.prototype._emaVariance=function(e,t,r){return(1-e)*(r+e*Math.pow(t,2))},e.prototype._ema=function(e,t,r){return e*t+r},e.prototype._lambda=function(e){return 1-Math.pow(.5,2/Math.max(e.montgomery.length,1))},e.prototype._delta=function(e,t){return e-t.mean},e.prototype._getAverage=function(e){var t=void 0!==this._grandMeanSampleSize&&this._grandMeanSampleSize>0?Math.min(this._grandMeanSampleSize,e.length):e.length;if(0===t)return 0;for(var r=0,n=0;ne})},e.prototype._totalDurationMS=function(){return this._downloadRatios.reduce(function(e,t){return e+t.durationMS},0)},e.prototype._enforceRetention=function(){for(var t,r;this._totalDurationMS()>=e.HISTORY_RETENTION_MS+(null!==(r=null===(t=this._downloadRatios[0])||void 0===t?void 0:t.durationMS)&&void 0!==r?r:0);)this._downloadRatios.shift()},e.prototype._getThreshold=function(){return e.MIN_THRESHOLD+(e.MAX_THRESHOLD-e.MIN_THRESHOLD)*Math.min(this._totalDurationMS(),e.HISTORY_RETENTION_MS)/e.HISTORY_RETENTION_MS},e.prototype._reset=function(){this._downloadRatios=[]},e.HISTORY_RETENTION_MS=2e4,e.MIN_THRESHOLD=.5,e.MAX_THRESHOLD=.75,e}();t.DownloadRatioAnalyzer=r},61970:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BufferOptimization=void 0;var r=function(){function e(){}return e.prototype.lyapunov=function(t,r,n,i,o){return(t*o+o*e.GAMMA-n/i)/r},e.prototype.calculateControlParameter=function(t,r,n){if(0!==r&&void 0!==t&&0!==n)return Math.round((n/r-1)/(t+e.GAMMA))},e.GAMMA=5,e}();t.BufferOptimization=r},93851:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BufferStabilityAnalyzer=void 0;var n=r(8125),i=r(61970),o=function(){function e(){this._bufferOptimizer=new i.BufferOptimization,this._segmentDurationSec=0,this._bufferCapacitySec=0,this._bufferLevelSec=0}return e.prototype.adjustAncillaryValues=function(e){void 0!==e&&void 0===this._controlCoefficient&&void 0!==this._utilityMap&&(this._controlCoefficient=this._bufferOptimizer.calculateControlParameter(this._utilityMap.tryGet(e),this._segmentDurationSec,this._bufferCapacitySec))},e.prototype.adjustPlaybackUtility=function(e){var t=this._utilityMap=new n.Map,r=e.getFirst().bandwidth;0!==r&&e.forEach(function(e){t.contains(e.bandwidth)||t.set(e.bandwidth,Math.log(e.bandwidth/r))})},e.prototype.forecast=function(e){for(var t,r=0,n=0;nr)&&(t=i,r=o)}return t},e.prototype.setBufferCapacitySec=function(e){this._bufferCapacitySec=e},e.prototype.setBufferLevelSec=function(e){this._bufferLevelSec=e},e.prototype.setSegmentDurationSec=function(e){this._segmentDurationSec=e},e.prototype._getScore=function(t){if(void 0===this._utilityMap)return 0;var r,n=this._utilityMap.tryGet(t);if(void 0===n||0===this._segmentDurationSec)return 0;var i=this._segmentDurationSec*t,o=null!==(r=this._controlCoefficient)&&void 0!==r?r:e.CONTROL_DEFAULT;return this._bufferOptimizer.lyapunov(n,i,this._bufferLevelSec,this._segmentDurationSec,o)},e.CONTROL_DEFAULT=.93,e}();t.BufferStabilityAnalyzer=o},58699:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncWorker=void 0;var n=r(3191),i=r(20217),o=r(8125),a=r(28813),s=r(93218),u=r(30617),l=function(){function e(t,r){var u=this;this.onWorkCompleted=new i.Emitter,this.onWorkStalled=new i.Emitter,this.onError=new i.Emitter,this.perTickDelay=e.DEFAULT_DELAY_SECONDS,this.postAsyncDelay=e.POSTASYNC_DELAY_SECONDS,this.concurrentLimit=e.CONCURRENT_LIMIT,this.batchLimit=e.DEFAULT_BATCH_LIMIT,this._workerRunning=!1,this._workerStalled=!1,this._runningWork=new a.Set,this._runningWorkPromises=new o.Map,this._haltedWork=new a.Set,this._handleWorkerTick=function(){var e;try{var t=u._workerStalled;u._workerStalled=!0;for(var r=0,n=!1;u._workerRunning&&u._runningWork.size<=u.concurrentLimit&&r++0},e.prototype.halt=function(e){this._runningWork.has(e)&&this._haltedWork.add(e)},e.prototype._ensureTick=function(e){var t=this;u.PromiseUtil.catchRejection(function(){return t._workerTick.tickAfter(e)},function(e){t.onError.emit({error:s.WrappedError.wrap(e)})})},e.prototype._startWorkItem=function(e){var t=this;void 0!==this._workerFeeder.prepareWorkItem&&this._workerFeeder.prepareWorkItem(e),this._runningWork.add(e);var r=this._workerFeeder.handleWorkItem(e);this._runningWorkPromises.set(e,r.catch(function(r){var n=s.WrappedError.wrap(r,"AsyncWorkError");t.onError.emit({item:e,error:n})}).then(function(){void 0!==t._workerFeeder.completeWorkItem&&t._workerFeeder.completeWorkItem(e),t._runningWork.delete(e),t._runningWorkPromises.delete(e),t._haltedWork.delete(e),t.onWorkCompleted.emit(e),t._ensureTick(t.postAsyncDelay)}))},e.DEFAULT_DELAY_SECONDS=0,e.POSTASYNC_DELAY_SECONDS=0,e.CONCURRENT_LIMIT=Number.POSITIVE_INFINITY,e.DEFAULT_BATCH_LIMIT=10,e}();t.AsyncWorker=l},3191:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncDelayedTick=t.SyncDelayedTick=t._DelayedTick=void 0;var n=r(91261),i=r(30617),o=function(){function e(e,t){this._system=e,this._onTick=t,this._outstandingTicks=[]}return e.prototype.tickAfter=function(e){var t=this;this.requestStop();var r=!0,i=this._system.postTimeout(e),o=this._createTick(function(e){return n.__awaiter(t,void 0,void 0,function(){var t,o,a;return n.__generator(this,function(n){switch(n.label){case 0:n.trys.push([0,,7,8]),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,i.timeout];case 2:return n.sent(),[3,4];case 3:if(t=n.sent(),r)throw t;return[3,4];case 4:if(!r||!((o=this._onTick())instanceof Promise))return[3,6];return[4,o];case 5:n.sent(),n.label=6;case 6:return[3,8];case 7:return(a=this._outstandingTicks.indexOf(e))>=0&&this._outstandingTicks.splice(a,1),[7];case 8:return[2]}})})},function(){r=!1,i.cancel()});return this._outstandingTicks.push(o),o.promise},e.prototype.requestStop=function(){for(var e=0,t=this._outstandingTicks;e0}}),this._worker.concurrentLimit=0}return Object.defineProperty(e.prototype,"tasks",{get:function(){return this._tasks},enumerable:!1,configurable:!0}),e.prototype._run=function(e,t,r){var i=this,o=new Promise(function(o,a){var s,u,l=!1,c={request:e,returnType:t,performAction:function(){return n.__awaiter(i,void 0,void 0,function(){return n.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,r(c.request)];case 1:return s=e.sent(),l=!0,[3,3];case 2:return u=e.sent(),[3,3];case 3:return[2]}})})},actionCompleted:function(){l?o(s):a(u)},reject:a,promise:Promise.resolve()};i._tasks.push(c)});return this._tasks[this._tasks.length-1].promise=o,this._worker.flush(),o},e.prototype.runWithReturn=function(e,t){return this._run(e,"value",t)},e.prototype.runWithoutReturn=function(e,t){return this._run(e,"void",t)},e.prototype.runReplace=function(e,t,r){if(this._tasks.length>0){var n=this._tasks[this._tasks.length-1];if("void"===n.returnType&&n.request.type===e.type){if(!(1===this._tasks.length&&this._worker.isRunning()))return this._system.logInfo("".concat(s,": replacing old ").concat(e.type," request with new one")),n.request=e,n.promise;if(t(n.request,e))return this._system.logInfo("".concat(s,": ignoring duplicate ").concat(e.type," request")),n.promise}}return this.runWithoutReturn(e,r)},e.prototype.destroy=function(){this._worker.stop(),this._worker.destroy()},e}();t.SequentialTaskRunner=u},68302:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncTimer=t.SyncTimer=t._Timer=void 0;var n=r(91261),i=r(3191),o=r(20217),a=r(93218),s=r(30617),u=function(){function e(t,r){this.onError=new o.Emitter,this.onTickComplete=new o.Emitter,this._system=t,this._onTick=r,this._outstandingTicks=[],void 0!==e.global_on_created&&e.global_on_created(this,r)}return e.prototype.tickNow=function(){return this._requestStop(),this._onTick()},e.prototype.tickAfter=function(e){this._createTimerTick(e,!1)},e.prototype.tickEvery=function(e){this._createTimerTick(e,!0)},e.prototype._createTimerTick=function(e,t){var r=this;this._requestStop();var n=new d(this._createTicker(),e,t,function(e){return r.onError.emit(e)},function(e){var t=r._outstandingTicks.indexOf(e);t>=0&&r._outstandingTicks.splice(t,1),r.onTickComplete.emit()});this._outstandingTicks.push(n)},e.prototype._requestStop=function(){for(var e=0,t=this._outstandingTicks;e=32&&r[1]<48&&(r[0]&=254),e.ccType){case 0:return this._fieldDecoders[0].decode(r,"CC1"===t?0:"CC2"===t?1:void 0);case 1:return this._fieldDecoders[1].decode(r,"CC3"===t?0:"CC4"===t?1:void 0);default:return}},e.prototype.getDisplay=function(e){switch(e){case"CC1":return this._fieldDecoders[0].getDisplay(0);case"CC2":return this._fieldDecoders[0].getDisplay(1);case"CC3":return this._fieldDecoders[1].getDisplay(0);case"CC4":return this._fieldDecoders[1].getDisplay(1)}},e}();t.Cta608Decoder=v;var g=function(){function e(){var e;this._channelDecoders=((e={})[0]=new P,e[1]=new P,e)}return e.prototype.decode=function(t,r){var n;if(void 0!==this._expectedRedundantControlCode&&(0,h.pairEquals)(t,this._expectedRedundantControlCode)){this._expectedRedundantControlCode=void 0;return}switch(t[0]>=16&&t[0]<32?this._expectedRedundantControlCode=d.__spreadArray([],t,!0):this._expectedRedundantControlCode=void 0,this._currentDataChannel=null!==(n=e._classify(t))&&void 0!==n?n:this._currentDataChannel,(t=d.__spreadArray([],t,!0))[0]>=16&&t[0]<32&&(t[0]&=247),this._currentDataChannel){case 0:case 1:var i=this._channelDecoders[this._currentDataChannel].decode(t);return this._currentDataChannel===r?i:void 0;default:return}},e.prototype.getDisplay=function(e){return this._channelDecoders[e].getDisplay()},e._classify=function(e){return e[0]>0&&e[0]<16?2:e[0]>=16&&e[0]<32?(8&e[0])==0?0:1:void 0},e}(),y=[20,32],_=[20,37],b=[20,38],S=[20,39],w=[20,41],E=[20,42],x=[20,43],T=[20,47],P=function(){function e(){this._rollUpRowDepth=3,this._displayedMemory=new C,this._nonDisplayedMemory=new C,this._activeMemory=this._displayedMemory}return e.prototype.decode=function(t){var r=e._classify(t),n=r[0],i=r[1];if(this._currentDataType=null!=n?n:this._currentDataType,0===this._currentDataType){var o=!1;return this._currentCaptionStyle!==i&&(o=this._switchStyles(i)||o),(o=t[0]>=16&&t[0]<32?this._control(t)||o:this._character(t)||o)?this.getDisplay():void 0}},e.prototype.getDisplay=function(){return this._displayedMemory.getDisplay()},e._classify=function(e){return[y,T].some(function(t){return(0,h.pairEquals)(e,t)})?[0,0]:(0,h.pairEquals)(e,w)?[0,1]:[_,b,S].some(function(t){return(0,h.pairEquals)(e,t)})?[0,2]:[E,x].some(function(t){return(0,h.pairEquals)(e,t)})?[1,void 0]:[void 0,void 0]},e.prototype._switchStyles=function(e){var t=!1;return void 0===e||e===this._currentCaptionStyle||(2===e&&(this._nonDisplayedMemory.erase(),t=this._displayedMemory.erase()||t),this._currentCaptionStyle=e),t},e.prototype._character=function(t){for(var r,n=!1,i=0;i=32&&e[1]<48?this._midRowCode():17===e[0]&&e[1]>=48&&e[1]<64?this._specialCharacter(e):(18===e[0]||19===e[0])&&e[1]>=32&&e[1]<64?this._extendedCharacter(e):e[1]>=64&&(16!==e[0]||e[1]<96)?this._preambleAddressCode(e):23===e[0]&&e[1]>=33&&e[1]<=35?this._tabOffset(e):20===e[0]&&!!(e[1]>=32)&&!!(e[1]<48)&&this._misc(e)},e.prototype._midRowCode=function(){return this._activeMemory.append(" ")&&this._activeMemory===this._displayedMemory},e.prototype._specialCharacter=function(t){return this._activeMemory.append(e._specialCharacters.get(t[1]))&&this._activeMemory===this._displayedMemory},e.prototype._extendedCharacter=function(t){var r=18===t[0]?e._extendedCharacters1:e._extendedCharacters2,n=this._activeMemory.backspace();return(n=this._activeMemory.append(r.get(t[1]))||n)&&this._activeMemory===this._displayedMemory},e.prototype._preambleAddressCode=function(t){var r=e._pacRowTable.get(t[0]);t[1]>=96&&++r;var n=0;return(16&t[1])!=0&&(n=(t[1]>>1&7)*4),this._activeMemory.setCursorPosition(r,n,2===this._currentCaptionStyle)&&this._activeMemory===this._displayedMemory},e.prototype._tabOffset=function(e){return this._activeMemory.tabOffset(e[1]-33+1,2===this._currentCaptionStyle)&&this._activeMemory===this._displayedMemory},e.prototype._misc=function(e){var t,r=!1;switch(e[1]){case y[1]:this._activeMemory=this._nonDisplayedMemory;break;case 33:r=this._activeMemory.backspace()&&this._activeMemory===this._displayedMemory;break;case _[1]:case b[1]:case S[1]:this._activeMemory=this._displayedMemory,this._rollUpRowDepth=e[1]-_[1]+2;break;case w[1]:this._activeMemory=this._displayedMemory;break;case 44:r=this._displayedMemory.erase();break;case 45:2===this._currentCaptionStyle&&(r=this._activeMemory.scroll(this._rollUpRowDepth)&&this._activeMemory===this._displayedMemory);break;case 46:this._nonDisplayedMemory.erase();break;case T[1]:t=[this._nonDisplayedMemory,this._displayedMemory],this._displayedMemory=t[0],this._nonDisplayedMemory=t[1],this._activeMemory=this._nonDisplayedMemory,r=!this._displayedMemory.displayIsBlank()||!this._nonDisplayedMemory.displayIsBlank()}return r},e._remappedAsciiCodes=new p.Map([[39,"’"],[42,"\xe1"],[92,"\xe9"],[94,"\xed"],[95,"\xf3"],[96,"\xfa"],[123,"\xe7"],[124,"\xf7"],[125,"\xd1"],[126,"\xf1"],[127,"■"]]),e._specialCharacters=new p.Map([[48,"\xae"],[49,"\xb0"],[50,"\xbd"],[51,"\xbf"],[52,"™"],[53,"\xa2"],[54,"\xa3"],[55,"♪"],[56,"\xe0"],[57," "],[58,"\xe8"],[59,"\xe2"],[60,"\xea"],[61,"\xee"],[62,"\xf4"],[63,"\xfb"]]),e._extendedCharacters1=new p.Map([[32,"\xc1"],[33,"\xc9"],[34,"\xd3"],[35,"\xda"],[36,"\xdc"],[37,"\xfc"],[38,"‘"],[39,"\xa1"],[40,"*"],[41,"'"],[42,"—"],[43,"\xa9"],[44,"℠"],[45,"•"],[46,"“"],[47,"”"],[48,"\xc0"],[49,"\xc2"],[50,"\xc7"],[51,"\xc8"],[52,"\xca"],[53,"\xcb"],[54,"\xeb"],[55,"\xce"],[56,"\xcf"],[57,"\xef"],[58,"\xd4"],[59,"\xd9"],[60,"\xf9"],[61,"\xdb"],[62,"\xab"],[63,"\xbb"]]),e._extendedCharacters2=new p.Map([[32,"\xc3"],[33,"\xe3"],[34,"\xcd"],[35,"\xcc"],[36,"\xec"],[37,"\xd2"],[38,"\xf2"],[39,"\xd5"],[40,"\xf5"],[41,"{"],[42,"}"],[43,"\\"],[44,"^"],[45,"_"],[46,"|"],[47,"~"],[48,"\xc4"],[49,"\xe4"],[50,"\xd6"],[51,"\xf6"],[52,"\xdf"],[53,"\xa5"],[54,"\xa4"],[55,"│"],[56,"\xc5"],[57,"\xe5"],[58,"\xd8"],[59,"\xf8"],[60,"┌"],[61,"┐"],[62,"└"],[63,"┘"]]),e._pacRowTable=new p.Map([[17,1],[18,3],[21,5],[22,7],[23,9],[16,11],[19,12],[20,14]]),e}(),C=function(){function e(){this._chunks=[]}return e.prototype.setCursorPosition=function(e,t,r){var n=!1;if(r&&void 0!==this._cursorRow){var i=e-this._cursorRow;if(0!==i)for(var o=0,a=this._chunks;oe&&this._chunks.splice(0,this._chunks.length-e),this._activeChunk=o,t},e.prototype.backspace=function(){var e=!1;return void 0!==this._activeChunk?this._activeChunk.text.length>0?(this._activeChunk.text=this._activeChunk.text.substring(0,this._activeChunk.text.length-1),e=!0):this._activeChunk.indent>0&&--this._activeChunk.indent:void 0!==this._cursorIndent&&this._cursorIndent>0&&--this._cursorIndent,e},e.prototype.erase=function(){var e=this.displayIsBlank();return this._chunks=[],this._activeChunk=void 0,this._cursorRow=void 0,this._cursorIndent=void 0,!e},e.prototype.displayIsBlank=function(){return f.Cta608Util.isDisplayBlank({chunks:this._chunks})},e.prototype.getDisplay=function(){return{chunks:this._chunks}},e}()},2347:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EmbeddedCaptionSourceBuffer=void 0;var n=r(20217),i=r(58380),o=r(91635),a=r(91037),s=r(95480),u=r(6724),l=function(){function e(){var e;this._embeddedCaptionDecoder=new o.Cta608Decoder,this._embeddedCaptionState=((e={}).CC1={prevDisplay:{chunks:[]},prevDisplayPts:0,decodedText:new s.SortedIntervalCollection,lastSetId:0},e.CC2={prevDisplay:{chunks:[]},prevDisplayPts:0,decodedText:new s.SortedIntervalCollection,lastSetId:0},e.CC3={prevDisplay:{chunks:[]},prevDisplayPts:0,decodedText:new s.SortedIntervalCollection,lastSetId:0},e.CC4={prevDisplay:{chunks:[]},prevDisplayPts:0,decodedText:new s.SortedIntervalCollection,lastSetId:0},e),this.onTextChange=new n.Emitter,this.onWarning=new n.Emitter}return e.prototype.append=function(e){if(void 0!==this._lastAppendedSegmentEndTime){var t=e.start-this._lastAppendedSegmentEndTime;Math.abs(t)>.05&&(this.onWarning.emit(new a.WarningError("Resetting embedded caption decoder due to discontinuity from ".concat(this._lastAppendedSegmentEndTime," to ").concat(e.start," (diff=").concat(t,")"))),this._resetEmbeddedCaptionDecoder())}this._lastAppendedSegmentEndTime=e.end;for(var r=0,n=e.captionFrames;re.start&&t.end<=e.end}),i.decodedText.length!==o&&this.onTextChange.emit({source:n,text:i.decodedText,id:i.lastSetId++})}},e.prototype._resetEmbeddedCaptionDecoder=function(){this._embeddedCaptionDecoder=new o.Cta608Decoder;for(var e=0,t=this._getAllCta608Services();e=e.length))return{value:r+=e[t++],newIndex:t}},e.H264_NAL_UNIT_TYPE=6,e.H265_PREFIX_SEI_NUT=39,e.H265_SUFFIX_SEI_NUT=40,e.H265_PAYLOAD_TYPE_USER_DATA_UNREGISTERED=5,e.X265_USER_DATA_UNREGISTERED_UUID=[44,162,222,9,181,23,71,219,187,85,164,254,127,194,252,78],e}();t.SeiParser=r},70445:function(e,t,r){"use strict";t.bi=t.cW=void 0;var n=r(91261),i=r(72949),o=r(63306),a=r(6724);t.cW={"CMCD-Request":["bl","mtp","nor","nrr"],"CMCD-Object":["br","d","ot","tb"],"CMCD-Status":["bs"],"CMCD-Session":["cid","sf","sid","st"]};var s=new i.HashSet(["ot","sf","st"]),u=function(){function e(e){var t;this._options=e,this._rebuffering=!1,this._bufferStarved=((t={}).audio=!1,t.video=!1,t)}return e.prototype.modifyNetworkRequest=function(e){var t=this._generatePayload(e);switch(this._options.transmissionMode){case"header":var r=this._serializeToHeaders(t);Object.keys(r).length>0&&(e.headers=n.__assign(n.__assign({},e.headers),r));break;case"query":var i=this._serializeToQueryParam(t);if(i.length>0){var a=new o.Uri(e.resource),s=a.getQueryData();a.setQueryData(s.length>0?"".concat(s,"&").concat(i):i),e.resource=a.toString()}}},e.prototype.setIsLive=function(e){this._isLive=e},e.prototype.setRebuffering=function(e){if(e!==this._rebuffering&&(this._rebuffering=e,e))for(var t=0,r=(0,a.stringKeys)(this._bufferStarved);t0&&(r.mtp=this._round(s/1e3,2)),void 0!==u&&u>0&&(r.bl=this._round(1e3*u,2)),void 0!==l&&l>0&&(r.tb=this._round(l/1e3)),void 0!==c&&c>0&&(r.br=this._round(c/1e3)),void 0!==d){var p=new o.Uri(d.createUri).relativeUri(new o.Uri(e.resource)).toString();p.length>0&&(r.nor=encodeURIComponent(p)),void 0!==d.startByte&&(r.nrr="".concat(d.startByte,"-").concat(null!==(t=d.endByte)&&void 0!==t?t:""))}void 0!==this._isLive&&(r.st=this._isLive?"l":"v"),"text"!==e.type&&(r.bs=this._bufferStarved[e.type],this._bufferStarved[e.type]=this._rebuffering)}return r.sf=this._sf,r},e.prototype._serializeToHeaders=function(e){for(var r={},n=0,i=(0,a.stringKeys)(t.cW);n0&&(r[o]=s)}return r},e.prototype._serializeToQueryParam=function(e){var t=this._serializeKeyValuePairs(e);return t.length>0?"CMCD=".concat(encodeURIComponent(t)):""},e.prototype._serializeKeyValuePairs=function(e,t){void 0===t&&(t=(0,a.stringKeys)(e).sort());for(var r="",n=0,i=t;n0&&(r+=","),r+=this._serializeKeyValuePair(o,s))}return r},e.prototype._serializeKeyValuePair=function(e,t){switch(typeof t){case"string":return s.has(e)?"".concat(e,"=").concat(t):"".concat(e,"=").concat(this._quoteString(t));case"number":return"".concat(e,"=").concat(t);case"boolean":return e}},e.prototype._quoteString=function(e){return'"'.concat(e.replace(/["\\]/g,function(e){return"\\".concat(e)}),'"')},e.prototype._round=function(e,t){void 0===t&&(t=0);var r=Math.pow(10,t);return Math.round(e/r)*r},e}();t.bi=u},51777:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClearkeyHandler=void 0;var n=r(91261),i=r(71760),o=r(91037),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.__extends(t,e),t.prototype._processKeySession=function(e,t,r){var i,a;return n.__awaiter(this,void 0,void 0,function(){var s,u,l,c,d;return n.__generator(this,function(n){switch(n.label){case 0:return(s=this._sessionHelper.waitForMessageOrNonPendingStatus(e,t.keyId)).catch(function(){}),this._system.logVerbose("calling to generateRequest for clearkey"),[4,e.generateRequest(t.initDataType,r,t)];case 1:if(n.sent(),!this._sessionHelper.hasSession(e))return this.onWarning.emit(new o.WarningError("lost session while generating request")),[2];return this._system.logVerbose("waiting for license request or key status from CDM"),[4,s];case 2:if(void 0!==(u=n.sent()).nonPendingStatus)return this._system.logInfo("".concat(t.keyId," already has non-pending status '").concat(u.nonPendingStatus.status,"', ignoring session processing")),[2];if(!1===u.result||!this._sessionHelper.hasSession(e))return this.onWarning.emit(new o.WarningError("lost session preparing to wait for message")),[2];return l=u.result,this._system.logVerbose("making request for license"),null===(i=this._playerVitals)||void 0===i||i.add("LICENSE_REQUEST_STARTED"),[4,this._getUpdateData(e,l,t,"license")];case 3:if(c=n.sent(),null===(a=this._playerVitals)||void 0===a||a.add("LICENSE_REQUEST_ENDED"),!this._sessionHelper.hasSession(e))return this.onWarning.emit(new o.WarningError("lost session while making license request")),[2];return d=this._sessionHelper.waitForKeyStatusChangeOrNonPendingStatus(e,t.keyId),this._system.logVerbose("updating session with license"),[4,e.update(c,"license",l.sessionId)];case 4:if(n.sent(),!this._sessionHelper.hasSession(e))return[2];return this._system.logVerbose("waiting for key status change"),[4,d];case 5:return n.sent(),[2]}})})},t}(i.CommonDrmHandler);t.ClearkeyHandler=a},71760:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CommonDrmHandler=void 0;var n=r(91261),i=r(20217),o=r(90348),a=r(26528),s=r(93218),u=r(26503),l=r(91037),c=r(63306),d=r(96798),p=r(72949),f=r(536),h=r(30617),m=r(68302),v=function(){function e(e,t,r){this._sessionRefreshMap=new d.HashMap,this._sessionRefreshTimers=new d.HashMap,this._pendingSessions=new d.HashMap,this._appliedServerCerts=new p.HashSet,this.onDrmStatusChange=new i.Emitter,this.onError=new i.Emitter,this.onWarning=new i.Emitter,this._keySystem=t,this._keyFormat=r,this._network=new a.NetworkUtil(e),this._sessionHelper=new o.KeySessionHelper(e),this._system=e}return e.prototype.addKeyStatus=function(e,t){this._sessionHelper.addKeyStatus(e,t)},e.prototype.getStreamDrm=function(e){var t=this;return e.drmInfo.filter(function(e){return e.keySystem===t._keySystem&&e.keyFormat===t._keyFormat&&void 0!==e.licenseServerUri})},e.prototype.configure=function(t,r){var n,i,o,a,s,u;if(this._options=t,this._mediaKeys=r,void 0!==t){var l=e.DEFAULT_TIMEOUT_MS;this._licenseRequestTimeoutMs=null!==(i=null===(n=t.licenseRequest)||void 0===n?void 0:n.timeoutMS)&&void 0!==i?i:l,this._licenseRequestRetryCount=null===(o=t.licenseRequest)||void 0===o?void 0:o.retryCount,this._certificateRequestTimeoutMs=null!==(s=null===(a=t.certificateRequest)||void 0===a?void 0:a.timeoutMS)&&void 0!==s?s:l,this._certificateRequestRetryCount=null===(u=t.certificateRequest)||void 0===u?void 0:u.retryCount}this._sessionHelper.configure(t)},e.prototype.register=function(e){return n.__awaiter(this,void 0,void 0,function(){var t,r,i,o,a,s,u,l,c,d,f,m,v,g,y,_,b=this;return n.__generator(this,function(n){switch(n.label){case 0:if(void 0===this._mediaKeys)throw Error("DrmHandler not configured");if(0===e.drmInfo.length)throw Error("Registering drm on a stream without encrypted segments");for(i=0,t=e.drmInfo.map(function(e){return e.serverCertificate}),r=[],o=t;i0))return[3,2];return[4,h.PromiseUtil.waitAll(r)];case 1:n.sent(),n.label=2;case 2:for(this._sessionHelper.onError.off(this),this._sessionHelper.onError.on(this,function(e){return b.onError.emit(e)}),this._sessionHelper.onWarning.off(this),this._sessionHelper.onWarning.on(this,function(e){return b.onWarning.emit(e)}),this._sessionHelper.onDrmStatusChange.off(this),this._sessionHelper.onDrmStatusChange.on(this,function(){b.onDrmStatusChange.emit(b._sessionHelper.getDrmStatus())}),u=new p.HashSet,l=0,c=e.drmInfo;lc&&l-c<=e.DRM_REFRESH_MAXIMUM){var d=c-e.DRM_REFRESH_OFFSET,p=new m.AsyncTimer(this._system,function(){return n.__awaiter(a,void 0,void 0,function(){var e;return n.__generator(this,function(n){switch(n.label){case 0:this._system.logInfo("Media Key Session has expired, attempting to regenerate key session with info: ",r),r.onMessage.off(this),n.label=1;case 1:return n.trys.push([1,4,,5]),[4,this._sessionHelper.closeSession(r)];case 2:return n.sent(),[4,this._registerNewKeySession(t)];case 3:return n.sent(),[3,5];case 4:return e=n.sent(),this.onError.emit(s.WrappedError.wrap(e)),[3,5];case 5:return[2]}})})});p.onError.on(this,function(e){return a.onError.emit(e)}),p.onTickComplete.on(this,function(){return a._removeTimer(r.sessionId)}),this._sessionRefreshTimers.set(r.sessionId,p),p.tickAfter(d>l?(l-d)/1e3:(l-c)/1e3)}}},e.prototype._getSessionType=function(e){return"required"===e.persistentState?"persistent-license":"temporary"},e.prototype._applyServerCertificate=function(e,t){var r,i;return n.__awaiter(this,void 0,void 0,function(){var o,a,u;return n.__generator(this,function(n){switch(n.label){case 0:if(!(t instanceof c.Uri))return[3,6];a=this._network.makeNetworkClient({resource:t.toString(),method:"GET",type:"other",timeoutMS:this._certificateRequestTimeoutMs,retryCount:this._certificateRequestRetryCount,otherContext:{type:"certificate"}}),null===(r=this._playerVitals)||void 0===r||r.add("CERTIFICATE_REQUEST_STARTED"),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,a.payloadBuffer()];case 2:return o=new Uint8Array(n.sent().data),[3,5];case 3:throw u=n.sent(),new f.LicenseRequestError("failed to download certificate",s.WrappedError.wrap(u));case 4:return null===(i=this._playerVitals)||void 0===i||i.add("CERTIFICATE_REQUEST_ENDED"),[7];case 5:return[3,7];case 6:o=t,n.label=7;case 7:return[4,e.setServerCertificate(o)];case 8:return n.sent(),[2]}})})},e.prototype._getUpdateData=function(e,t,r,i){return n.__awaiter(this,void 0,void 0,function(){var o,a,u,l,c;return n.__generator(this,function(n){switch(n.label){case 0:if(void 0===r.licenseServerUri)throw Error("No license server found for drm info");return u=(a=this._network).makeNetworkClient,c={},[4,r.licenseServerUri()];case 1:o=u.apply(a,[(c.resource=n.sent(),c.method="POST",c.headers={},c.body=new Uint8Array(t.message),c.type="license",c.timeoutMS=this._licenseRequestTimeoutMs,c.retryCount=this._licenseRequestRetryCount,c.licenseContext={type:i},c)]),n.label=2;case 2:return n.trys.push([2,4,,6]),[4,o.payloadBuffer()];case 3:return[2,n.sent().data];case 4:return l=n.sent(),[4,e.close()];case 5:throw n.sent(),new f.LicenseRequestError("Did not get a valid response from license server",s.WrappedError.wrap(l));case 6:return[2]}})})},e.DRM_REFRESH_OFFSET=6e4,e.DRM_REFRESH_MAXIMUM=2147483647,e.MAX_REFRESH_COUNT=2,e.DEFAULT_TIMEOUT_MS=1e3*o.KeySessionHelper.TIMEOUT_SECONDS,e}();t.CommonDrmHandler=v},2574:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CommonEncryptionUtil=void 0;var n=r(98453),i=r(86046),o=r(31684),a=r(57497),s=r(41145),u=r(96798),l=r(89855),c=r(85359),d=r(59133),p=r(18516),f=r(30437),h=r(78072),m=function(){function e(){this._nodeUtil=new c.NodeUtil}return e.prototype.isPlayReadySystemId=function(t){return a.ArrayUtil.areEqual(e.PLAYREADY_SYSTEM_ID,t)},e.prototype.isWidevineSystemId=function(t){return a.ArrayUtil.areEqual(e.WIDEVINE_SYSTEM_ID,t)},e.prototype._getPlayreadyPssh=function(t){var r=this.getSingleKeyPlayreadyPSSHData(t),n=32+r.length,i=new Uint8Array(new ArrayBuffer(n)),o=new DataView(i.buffer);return o.setUint32(0,n),i.set([112,115,115,104,0],4),i.set(e.PLAYREADY_SYSTEM_ID,12),o.setUint32(28,r.length),i.set(r,32),i},e.prototype._getWidevinePssh=function(t){var r=new Uint8Array(new ArrayBuffer(50)),n=new DataView(r.buffer);return n.setUint32(0,50),r.set([112,115,115,104,0],4),r.set(e.WIDEVINE_SYSTEM_ID,12),n.setUint32(28,18),r.set(e.WIDEVINE_V0_SEPARATOR,32),r.set(t,34),r},e.prototype.getKeysFromMp4Boxes=function(e){for(var t=new i.Mp4Parser().parse(e),r=new u.HashMap,n=0;n')}return t+="",this._getPlayreadyPSSHFromXml(t)},e.prototype.getSingleKeyPlayreadyPSSHData=function(e){var t='AESCTR16';return t+="".concat(this.toEncodedPlayreadyKeyId(e),"")+"http://jSam",this._getPlayreadyPSSHFromXml(t)},e.prototype.rewriteInitDataKeys=function(t,r,n){void 0===n&&(n=1===this.getVersion(t));var i,o=1===this.getVersion(t);i=28;var a=this.getKeyFormat(t);n&&(i+=4+16*r.length),i+=4;var s=new Uint8Array(0),u=new Uint8Array(0);if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===a){var l=new DataView(t.buffer),c=28;if(o){var d=l.getUint32(c);c+=4+16*d}if(c0,a=0,u=n.getRecursiveChildrenByType("KID");a0&&this.onWarning.emit(new p.WarningError("DRM not supported on text streams"));var h=f.length>0,v=d.length>0;if(void 0!==e.audio&&void 0!==e.video&&(h||v)){var g=h?u.CodecUtil.getAudioGroup(this._getMimeCodec(e.audio)):void 0,y=v?u.CodecUtil.getVideoGroup(this._getMimeCodec(e.video)):void 0,_=this._getMediaKeyOption(n.__spreadArray(n.__spreadArray([],f,!0),d,!0),g,y);return this._systemInterface.supportsMultiCodecMediaKeys()||void 0===_||(_=n.__assign(n.__assign({},_),{audio:[null!==(l=m.ArrayUtil.find(_.audio,function(e){return e.codec===g}))&&void 0!==l?l:_.audio[0]],video:[null!==(c=m.ArrayUtil.find(_.video,function(e){return e.codec===y}))&&void 0!==c?c:_.video[0]]})),void 0===_&&this.onWarning.emit(new p.WarningError("Could not find a media key option for drm protected variant")),_}}},e.prototype._chooseMediaKey=function(e){return n.__awaiter(this,void 0,void 0,function(){var t,r,i=this;return n.__generator(this,function(n){switch(n.label){case 0:if(!(void 0!==e))return[3,3];return this._systemInterface.logInfo("creating MediaKeys with ".concat(this.getMediaKeyOptionString(e))),[4,this._systemInterface.makeMediaKeySystemAccess(e)];case 1:return[4,n.sent().createMediaKeys()];case 2:(t=n.sent()).onError.on(this,function(e){return i.onError.emit(e)}),t.onWarning.on(this,function(e){return i.onWarning.emit(e)}),(r=this._handlerFactory.create(this._systemInterface,e.keySystem)).onDrmStatusChange.on(this,function(e){return i._onDrmStatusChange(e)}),r.onError.on(this,function(e){return i.onError.emit(new l.DigitalRightsError(e))}),r.onWarning.on(this,function(e){return i.onWarning.emit(e)}),r.configure(this.options,t),n.label=3;case 3:return[2,{mediaKeys:t,chosenOption:e,drmHandler:r}]}})})},e.prototype._getMediaKeyOption=function(e,t,r){for(var n=0,i=this.supportedMediaKeys;ne.reason&&(e.reason=t,e.drm=[]),e.reason===t&&e.drm.push(r)},e.prototype.aggregateRejectedData=function(e){var t=this,r=new f.HashMap;e.forEach(function(e,n){var i;switch(n.reason){case 0:i="no key systems found on platform";break;case 1:i="codec not supported by platform: ".concat(u.CodecUtil.getCodecGroup(t._getMimeCodec(e)));break;case 2:i="codec not compatible with media keys: ".concat(u.CodecUtil.getCodecGroup(t._getMimeCodec(e)));break;case 3:i="encryption scheme not supported by platform: ".concat(new h.HashSet(n.drm.map(function(e){return e.scheme})).values().sort().join(", "));break;case 4:i="key system not supported by platform: ".concat(new h.HashSet(n.drm.map(function(e){return e.keySystem})).values().sort().join(", "));break;case 5:i="supported key system not requested: ".concat(new h.HashSet(n.drm.map(function(e){return e.keySystem})).values().sort().join(", "));break;case 6:i="persistent state not allowed: ".concat(new h.HashSet(n.drm.map(function(e){return"".concat(e.persistentState)})).values().sort().join(", "));break;case 7:i="unique keys='[".concat(t._getUniqueKeysString(),"]', found key not allowed: ").concat(new h.HashSet(n.drm.map(function(e){return"".concat(e.keyId)})).values().sort().join(", "));break;case 8:i="all keys are restricted"}r.contains(i)||r.set(i,[]),r.get(i).push(e)});var n=[];return r.forEach(function(e,t){n.push("filtered streams ".concat(t.map(function(e){return e.id}).join(", "),": ").concat(e))}),n},e.prototype._getUniqueKeysString=function(){var e=new h.HashSet;return this._singleKeyRestrictions.forEach(function(t,r){r.forEach(function(t,r){e.add(r)})}),e.values().join(", ")},e}();t.DigitalRightsManagement=g},13466:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DrmHandlerFactory=void 0;var n=r(51777),i=r(87091),o=r(19908),a=r(42691),s=function(){function e(){}return e.prototype.create=function(e,t){switch(t){case"com.apple.fps.2_0":return new i.FairPlayHandler(e,t,"com.apple.streamingkeydelivery");case"com.widevine.alpha":return new a.WidevineHandler(e,t,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed");case"org.w3.clearkey":return new n.ClearkeyHandler(e,t,"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b");case"com.microsoft.playready":case"com.microsoft.playready.recommendation":return new o.PlayReadyHandler(e,t,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95")}},e}();t.DrmHandlerFactory=s},87091:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FairPlayHandler=void 0;var n=r(91261),i=r(41145),o=r(71760),a=r(536),s=r(93218),u=r(55353),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.__extends(t,e),t.prototype.getStreamDrm=function(t){return e.prototype.getStreamDrm.call(this,t).filter(function(e){return void 0!==e.serverCertificate})},t.prototype._processKeySession=function(e,t,r){return n.__awaiter(this,void 0,void 0,function(){var i,o,a,s,u;return n.__generator(this,function(n){switch(n.label){case 0:return(i=this._sessionHelper.waitForMessageOrNonPendingStatus(e,t.keyId)).catch(function(){}),[4,e.generateRequest(t.initDataType,r,t)];case 1:if(n.sent(),!this._sessionHelper.hasSession(e))return[2];return[4,i];case 2:if(void 0!==(o=n.sent()).nonPendingStatus)return this._system.logInfo("".concat(t.keyId," already has non-pending status '").concat(o.nonPendingStatus.status,"', ignoring session processing")),[2];if(!1===(a=o.result)||!this._sessionHelper.hasSession(e))return[2];return[4,this._getUpdateData(e,a,t,"license")];case 3:if(s=n.sent(),!this._sessionHelper.hasSession(e))return[2];return u=this._sessionHelper.waitForKeyStatusChangeOrNonPendingStatus(e,t.keyId),[4,e.update(s,"license")];case 4:if(n.sent(),!this._sessionHelper.hasSession(e))return[2];return[4,u];case 5:return n.sent(),[2]}})})},t.prototype._getUpdateData=function(e,t,r,o){var l,c,d,p;return n.__awaiter(this,void 0,void 0,function(){var f,h,m,v,g,y,_,b,S;return n.__generator(this,function(n){switch(n.label){case 0:if(void 0===r.licenseServerUri)throw Error("Invalid drmInfo for FairPlay, missing license uri");return f=i.StringUtil.toStandardBase64(i.StringUtil.fromCharCode(new Uint8Array(t.message))),h={"Content-Type":"application/json"},g=(v=this._network).makeNetworkClient,S={},[4,r.licenseServerUri()];case 1:m=g.apply(v,[(S.resource=n.sent(),S.method="POST",S.headers=h,S.body=i.StringUtil.toUTF8(JSON.stringify({assetId:r.keyId,spc:f})),S.type="license",S.timeoutMS=this._licenseRequestTimeoutMs,S.retryCount=null===(c=null===(l=this._options)||void 0===l?void 0:l.licenseRequest)||void 0===c?void 0:c.retryCount,S.licenseContext={type:o},S)]),null===(d=this._playerVitals)||void 0===d||d.add("LICENSE_REQUEST_STARTED"),n.label=2;case 2:return n.trys.push([2,4,6,7]),[4,m.payloadString()];case 3:return y=n.sent(),[3,7];case 4:return _=n.sent(),[4,e.close()];case 5:throw n.sent(),new a.LicenseRequestError("Did not receive a valid license response from server",s.WrappedError.wrap(_));case 6:return null===(p=this._playerVitals)||void 0===p||p.add("LICENSE_REQUEST_ENDED"),[7];case 7:if(b=JSON.parse(y.data),!this._responseIsValid(b))throw new u.LicenseResponseFormatError("License response is not expected format: ".concat(y.data));return[2,i.StringUtil.toCharCode(i.StringUtil.fromStandardBase64(b.ckc)).buffer]}})})},t.prototype._responseIsValid=function(e){return"object"==typeof e&&null!==e&&"ckc"in e&&"string"==typeof e.ckc},t}(o.CommonDrmHandler);t.FairPlayHandler=l},90348:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KeySessionHelper=void 0;var n=r(91261),i=r(20217),o=r(96798),a=r(35451),s=r(30617),u=r(28813),l=r(68302),c=function(){function e(t){this._keySessions=new u.Set,this._keyStatusOverrides=new o.HashMap,this._drmStatus=new o.HashMap,this._messageTimeout=e.TIMEOUT_SECONDS,this._keyStatusesChangeTimeout=e.TIMEOUT_SECONDS,this.onDrmStatusChange=new i.Emitter,this.onError=new i.Emitter,this.onWarning=new i.Emitter,this._system=t}return e.prototype.configure=function(e){var t,r;(null===(t=null==e?void 0:e.messageEvent)||void 0===t?void 0:t.timeoutSeconds)!==void 0&&(this._messageTimeout=e.messageEvent.timeoutSeconds),(null===(r=null==e?void 0:e.keyStatusesChangeEvent)||void 0===r?void 0:r.timeoutSeconds)!==void 0&&(this._keyStatusesChangeTimeout=e.keyStatusesChangeEvent.timeoutSeconds)},e.prototype.hasKey=function(e){return this._drmStatus.contains(e)},e.prototype.hasSession=function(e){return this._keySessions.has(e)},e.prototype.getDrmStatus=function(){return this._drmStatus},e.prototype.addKeyStatus=function(e,t){this._keyStatusOverrides.set(e,t),this._drmStatus=this._getDrmStatusMap(),this.onDrmStatusChange.emit()},e.prototype.forEachSession=function(e){this._keySessions.forEach(function(t){e(t)})},e.prototype.addSession=function(e){var t=this;this._keySessions.add(e),e.onError.on(this,function(e){return t.onError.emit(e)}),e.onWarning.on(this,function(e){return t.onWarning.emit(e)}),e.onKeyStatusesChange.on(this,function(){t._drmStatus=t._getDrmStatusMap(),t.onDrmStatusChange.emit()}),this._drmStatus=this._getDrmStatusMap()},e.prototype.closeSession=function(e){if(e.onMessage.off(this),e.onError.off(this),e.onWarning.off(this),this._keySessions.delete(e))return e.onKeyStatusesChange.off(this),this._drmStatus=this._getDrmStatusMap(),e.close()},e.prototype.close=function(){var e=this,t=[];return this.forEachSession(function(r){r.onKeyStatusesChange.off(e),t.push(e.closeSession(r))}),s.PromiseUtil.waitAll(t)},e.prototype._waitFor=function(e,t,r,n,i,o){var s,u=this,c={};return Promise.race([e.then(function(){return null==s||s.stop(),t.off(c),!1}),new Promise(function(e,d){(s=new l.SyncTimer(u._system,function(){t.off(c),null==s||s.stop(),d(new a.KeySessionError("Timed out waiting for "+n(),u.getDrmStatus(),r,o))})).tickAfter(i),t.once(c,function(t){null==s||s.stop(),e(t)})})])},e.prototype._waitForPromiseOrNonPendingStatus=function(e,t){return n.__awaiter(this,void 0,void 0,function(){var r,i,o,a,s,u=this;return n.__generator(this,function(n){switch(n.label){case 0:r={},i=!1,a=e.then(function(e){i=e}),s=new Promise(function(e){var n=function(){var r=u._drmStatus.tryGet(t);void 0!==r&&"status-pending"!==r.status&&(o=r,e())};u.onDrmStatusChange.on(r,n),n()}),n.label=1;case 1:return n.trys.push([1,,3,4]),[4,Promise.race([a,s])];case 2:return n.sent(),[3,4];case 3:return this.onDrmStatusChange.off(r),[7];case 4:return[2,{result:i,nonPendingStatus:o}]}})})},e.prototype.waitForMessageOrNonPendingStatus=function(e,t,r){return void 0===r&&(r="generateRequest"),n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(n){return[2,this._waitForPromiseOrNonPendingStatus(this.waitForMessage(e,r),t)]})})},e.prototype.waitForMessage=function(e,t){return this._waitFor(e.closed,e.onMessage,e,function(){return"message"},this._messageTimeout,t)},e.prototype.waitForKeyStatusChangeOrNonPendingStatus=function(e,t,r){return void 0===r&&(r="update_with_license"),this._waitForPromiseOrNonPendingStatus(this._waitFor(e.closed,e.onKeyStatusesChange,e,function(){return"key status change"},this._keyStatusesChangeTimeout,r),t)},e.prototype._getDrmStatusMap=function(){var e=new o.HashMap;return this.forEachSession(function(t){t.getMediaKeyStatusMap().forEach(function(r,n){e.set(r,{sessionId:t.sessionId,keyId:r,status:n,expiration:t.expiration})})}),this._keyStatusOverrides.forEach(function(t,r){e.set(t,{sessionId:"system-session",keyId:t,status:r,expiration:NaN})}),e},e.TIMEOUT_SECONDS=30,e}();t.KeySessionHelper=c},19908:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PlayReadyHandler=void 0;var n=r(91261),i=r(41145),o=r(71760),a=r(26503),s=r(536),u=r(93218),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.__extends(t,e),t.prototype._processKeySession=function(e,t,r){return n.__awaiter(this,void 0,void 0,function(){var i,o,a,s,u;return n.__generator(this,function(n){switch(n.label){case 0:return(i=this._sessionHelper.waitForMessageOrNonPendingStatus(e,t.keyId)).catch(function(){}),[4,e.generateRequest(t.initDataType,r,t)];case 1:if(n.sent(),!this._sessionHelper.hasSession(e))return[2];return[4,i];case 2:if(void 0!==(o=n.sent()).nonPendingStatus)return this._system.logInfo("".concat(t.keyId," already has non-pending status '").concat(o.nonPendingStatus.status,"', ignoring session processing")),[2];if(!1===(a=o.result)||!this._sessionHelper.hasSession(e))return[2];return[4,this._getUpdateData(e,a,t,"license")];case 3:if(s=n.sent(),!this._sessionHelper.hasSession(e))return[2];return u=this._sessionHelper.waitForKeyStatusChangeOrNonPendingStatus(e,t.keyId),[4,e.update(s,"license")];case 4:if(n.sent(),!this._sessionHelper.hasSession(e))return[2];return[4,u];case 5:return n.sent(),[2]}})})},t.prototype._getUpdateData=function(e,t,r,o){var l,c;return n.__awaiter(this,void 0,void 0,function(){var d,p,f,h,m,v,g,y,_,b,S;return n.__generator(this,function(n){switch(n.label){case 0:if(void 0===r.licenseServerUri)throw Error("No license server found for drm info");if(p=new Uint8Array(t.message)[0],f=new Uint8Array(t.message)[1],0===t.message.byteLength)throw new a.NonFatalError;return 60===p&&63===f?d=new Uint8Array(t.message):(h=i.StringUtil.fromUTF16(t.message,!0),m=this._getChallengeFromXml(h),d=i.StringUtil.toUTF8(i.StringUtil.fromStandardBase64(m))),v={"Content-Type":"text/xml; charset=utf-8",SOAPAction:"http://schemas.microsoft.com/DRM/2007/03/protocols/AcquireLicense"},_=(y=this._network).makeNetworkClient,S={},[4,r.licenseServerUri()];case 1:g=_.apply(y,[(S.resource=n.sent(),S.method="POST",S.headers=v,S.body=d,S.type="license",S.timeoutMS=this._licenseRequestTimeoutMs,S.retryCount=this._licenseRequestRetryCount,S.licenseContext={type:o},S)]),null===(l=this._playerVitals)||void 0===l||l.add("LICENSE_REQUEST_STARTED"),n.label=2;case 2:return n.trys.push([2,4,6,7]),[4,g.payloadBuffer()];case 3:return[2,n.sent().data];case 4:return b=n.sent(),[4,e.close()];case 5:throw n.sent(),new s.LicenseRequestError("Did not get a valid response from license server",u.WrappedError.wrap(b));case 6:return null===(c=this._playerVitals)||void 0===c||c.add("LICENSE_REQUEST_ENDED"),[7];case 7:return[2]}})})},t.prototype._getChallengeFromXml=function(e){var t=e.indexOf("",t);if(-1===r)throw Error("Could not find challenge in license XML");var n=e.indexOf("",r);if(-1===n)throw Error("Could not find challenge end in license XML");return e.substring(r+1,n)},t}(o.CommonDrmHandler);t.PlayReadyHandler=l},42691:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WidevineHandler=void 0;var n=r(91261),i=r(71760),o=r(91037),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.__extends(t,e),t.prototype._processKeySession=function(e,t,r){var i,a,s,u;return n.__awaiter(this,void 0,void 0,function(){var l,c,d,p,f,h,m,v;return n.__generator(this,function(n){switch(n.label){case 0:return(l=this._sessionHelper.waitForMessageOrNonPendingStatus(e,t.keyId)).catch(function(){}),this._system.logVerbose("calling to generateRequest for widevine"),[4,e.generateRequest(t.initDataType,r,t)];case 1:if(n.sent(),!this._sessionHelper.hasSession(e))return this.onWarning.emit(new o.WarningError("lost session while generating request")),[2];return this._system.logVerbose("waiting for certificate or license request from CDM"),[4,l];case 2:if(void 0!==(c=n.sent()).nonPendingStatus)return this._system.logInfo("".concat(t.keyId," already has non-pending status '").concat(c.nonPendingStatus.status,"', ignoring session processing")),[2];if(!1===(d=c.result)||!this._sessionHelper.hasSession(e))return this.onWarning.emit(new o.WarningError("lost session preparing to wait for message")),[2];if(2!==(p=d).message.byteLength)return[3,8];if(f=void 0,void 0!==t.individualizationRequest)return[3,4];return this._system.logVerbose("making request for certificate"),null===(i=this._playerVitals)||void 0===i||i.add("CERTIFICATE_REQUEST_STARTED"),[4,this._getUpdateData(e,d,t,"certificate")];case 3:return f=n.sent(),null===(a=this._playerVitals)||void 0===a||a.add("CERTIFICATE_REQUEST_ENDED"),[3,5];case 4:this._system.logVerbose("retrieving cached individualization request"),f=t.individualizationRequest.buffer,n.label=5;case 5:if(!this._sessionHelper.hasSession(e))return this.onWarning.emit(new o.WarningError("lost session while getting certificate")),[2];return(h=this._sessionHelper.waitForMessage(e,"update_with_certificate")).catch(function(){}),this._system.logVerbose("updating session with certificate"),[4,e.update(f,"certificate",p.sessionId)];case 6:if(n.sent(),!this._sessionHelper.hasSession(e))return this.onWarning.emit(new o.WarningError("lost session while waiting for certificate-request")),[2];return this._system.logVerbose("waiting for license request from CDM"),[4,h];case 7:if(!1===(p=n.sent())||!this._sessionHelper.hasSession(e))return[2];n.label=8;case 8:if("license-request"!==p.type&&"licenserequest"!==p.type)throw Error("Unexpected message type '".concat(p.type,"' for license request"));return this._system.logVerbose("making request for license"),null===(s=this._playerVitals)||void 0===s||s.add("LICENSE_REQUEST_STARTED"),[4,this._getUpdateData(e,p,t,"license")];case 9:if(m=n.sent(),null===(u=this._playerVitals)||void 0===u||u.add("LICENSE_REQUEST_ENDED"),!this._sessionHelper.hasSession(e))return this.onWarning.emit(new o.WarningError("lost session while making license request")),[2];return v=this._sessionHelper.waitForKeyStatusChangeOrNonPendingStatus(e,t.keyId),this._system.logVerbose("updating session with license"),[4,e.update(m,"license",p.sessionId)];case 10:if(n.sent(),!this._sessionHelper.hasSession(e))return[2];return this._system.logVerbose("waiting for key status change"),[4,v];case 11:return n.sent(),[2]}})})},t}(i.CommonDrmHandler);t.WidevineHandler=a},21730:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BufferError=void 0;var n=r(91261),i=r(93218),o=function(e){function t(r){var n=e.call(this,t.NAME,"Failure to process buffer items in pipeline",r.pipelineState.error)||this;return n.item=r,n}return n.__extends(t,e),t.prototype.toString=function(){return i.WrappedError.getStandardMessage(this)+t.getItemLocationMessage(this)+t.getItemUrlMessage(this)+i.WrappedError.getCauseMessage(this)},t.getItemLocationMessage=function(e){return"\nat segment time=(".concat(e.item.pipelineState.start," - ").concat(e.item.pipelineState.end,")")},t.getItemUrlMessage=function(e){var t,r,n="";return(void 0!==e.item.pipelineState.segment.startByte||void 0!==e.item.pipelineState.segment.endByte)&&(n="bytes=[".concat(null!==(t=e.item.pipelineState.segment.startByte)&&void 0!==t?t:"*","-").concat(null!==(r=e.item.pipelineState.segment.endByte)&&void 0!==r?r:"*","]")),"\nat segment ".concat(n," url=").concat(e.item.pipelineState.segment.createUri)},t.NAME="Buffer",t}(i.WrappedError);t.BufferError=o},5200:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BufferUpdateError=void 0;var n=r(91261),i=function(e){function t(r,n,i){return e.call(this,t.NAME,r,n,i)||this}return n.__extends(t,e),t.NAME="BufferUpdate",t}(r(93218).WrappedError);t.BufferUpdateError=i},78746:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BufferVariantError=void 0;var n=r(91261),i=function(e){function t(r,n,i,o){var a=e.call(this,t.NAME,null!=n?n:"Failed to find suitable variant",i,o)||this;return a._context=r,a}return n.__extends(t,e),t.prototype.toString=function(){return e.prototype.toString.call(this)+"\nCodec Group Contextual Info:\n"+this._getCodecMapFilterString(this._context).split("\n").map(function(e){return" ".concat(e)}).join("\n")},t.prototype._getCodecMapFilterString=function(e){var t=[];return e.filterCodecMap.forEach(function(r,n){var i=[];n.forEach(function(e){i.push(e)}),t.push("".concat(r,": ").concat(i.join(",")," (filtered to ").concat(e.filterMap.tryGet(r),")"))}),t.join("\n")},t.NAME="BufferVariant",t}(r(93218).WrappedError);t.BufferVariantError=i},28452:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CopyProtectionError=void 0;var n=r(91261),i=function(e){function t(r,n,i){return e.call(this,t.NAME,null!=r?r:"HDCP Error",n,i)||this}return n.__extends(t,e),t.NAME="CopyProtection",t}(r(93218).WrappedError);t.CopyProtectionError=i},23658:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DigitalRightsError=void 0;var n=r(91261),i=function(e){function t(r){return e.call(this,t.NAME,"Failure during digital rights acquisition",r)||this}return n.__extends(t,e),t.NAME="DigitalRights",t}(r(93218).WrappedError);t.DigitalRightsError=i},59863:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExpiredKeysError=void 0;var n=r(91261),i=function(e){function t(r,n){for(var i="All keys have expired. Current time: ".concat(Date.now()),o=0,a=r.values();o").concat(i.status)}return t},t.NAME="KeySession",t}(r(93218).WrappedError);t.KeySessionError=i},536:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LicenseRequestError=void 0;var n=r(91261),i=function(e){function t(r,n){return e.call(this,t.NAME,r,n)||this}return n.__extends(t,e),t.NAME="LicenseRequest",t}(r(93218).WrappedError);t.LicenseRequestError=i},55353:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LicenseResponseFormatError=void 0;var n=r(91261),i=function(e){function t(r,n){return e.call(this,t.NAME,r,n)||this}return n.__extends(t,e),t.NAME="LicenseResponseFormat",t}(r(93218).WrappedError);t.LicenseResponseFormatError=i},31532:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MediaOperationStateError=void 0;var n=r(91261),i=function(e){function t(r,n,i){return e.call(this,t.NAME,r,n,i)||this}return n.__extends(t,e),t.NAME="MediaOperationStateError",t}(r(93218).WrappedError);t.MediaOperationStateError=i},25674:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NoKeySystemAvailableError=void 0;var n=r(91261),i=function(e){function t(r,n){return e.call(this,t.NAME,"No key system available on device",r,n)||this}return n.__extends(t,e),t.NAME="NoKeySystemAvailable",t}(r(93218).WrappedError);t.NoKeySystemAvailableError=i},13542:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NoUsableKeysError=void 0;var n=r(91261),i=function(e){function t(r,n){return e.call(this,t.NAME,"No usable keys found.",r,n)||this}return n.__extends(t,e),t.NAME="NoUsableKeys",t}(r(93218).WrappedError);t.NoUsableKeysError=i},26503:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NonFatalError=void 0;var n=r(91261),i=function(e){function t(r){return e.call(this,t.NAME,"Non-fatal error",r)||this}return n.__extends(t,e),t.NAME="NonFatal",t}(r(93218).WrappedError);t.NonFatalError=i},24286:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OutputRestrictedError=void 0;var n=r(91261),i=function(e){function t(r,n){return e.call(this,t.NAME,"Content previously appended is output restricted",r,n)||this}return n.__extends(t,e),t.NAME="OutputRestricted",t}(r(93218).WrappedError);t.OutputRestrictedError=i},91552:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PlayerError=void 0;var n=r(91261),i=function(e){function t(r,n){return e.call(this,t.NAME,r,n)||this}return n.__extends(t,e),t.NAME="PlayerError",t}(r(93218).WrappedError);t.PlayerError=i},46258:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PlayerLoadError=void 0;var n=r(91261),i=function(e){function t(r,n){return e.call(this,t.NAME,r,n)||this}return n.__extends(t,e),t.NAME="PlayerLoad",t}(r(93218).WrappedError);t.PlayerLoadError=i},63662:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PlayerNotLoadedError=void 0;var n=r(91261),i=function(e){function t(r,n){return e.call(this,t.NAME,r,n)||this}return n.__extends(t,e),t.NAME="PlayerNotLoaded",t}(r(93218).WrappedError);t.PlayerNotLoadedError=i},76760:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RetryableError=void 0;var n=r(91261),i=function(e){function t(r,n){var i=e.call(this,t.NAME,"wrapping ".concat(r.name,", see original error for details"),r)||this;return i.original=r,i._retry=n,i}return n.__extends(t,e),t.prototype.retry=function(e,t){return this._retry(e,t)},t.NAME="RetryableError",t}(r(93218).WrappedError);t.RetryableError=i},37289:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentDownloadFailedError=void 0;var n=r(91261),i=function(e){function t(r,n,i){return e.call(this,t.NAME,r,n,i)||this}return n.__extends(t,e),t.NAME="SegmentDownloadFailed",t}(r(93218).WrappedError);t.SegmentDownloadFailedError=i},96102:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentRetryFailedError=void 0;var n=r(91261),i=function(e){function t(r,n,i){return e.call(this,t.NAME,r,n,i)||this}return n.__extends(t,e),t.NAME="SegmentRetryFailed",t}(r(93218).WrappedError);t.SegmentRetryFailedError=i},81008:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SkipSegmentError=void 0;var n=r(91261),i=function(e){function t(r,n,i,o){var a=e.call(this,t.NAME,r,i,o)||this;return a.timeToJump=n,a}return n.__extends(t,e),t.NAME="SkipSegmentError",t}(r(93218).WrappedError);t.SkipSegmentError=i},42463:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TextEncodingError=void 0;var n=r(91261),i=function(e){function t(r,n){return e.call(this,t.NAME,r,n)||this}return n.__extends(t,e),t.NAME="TextEncoding",t}(r(93218).WrappedError);t.TextEncodingError=i},90033:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnsupportedKeySystemError=void 0;var n=r(91261),i=function(e){function t(r,n,i){return e.call(this,t.NAME,"Key system not supported. Possible triggers include Gluon being instructed to use the wrong key system, misconfigured to use prefixed EME, or the app not running in a secure context (isSecureContext=".concat(r,")."),n,i)||this}return n.__extends(t,e),t.NAME="UnsupportedKeySystem",t}(r(93218).WrappedError);t.UnsupportedKeySystemError=i},5809:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VideoElementError=void 0;var n=r(91261),i=r(93218),o=r(81428),a=r(41145),s=function(e){function t(r,n){var i=e.call(this,t.NAME,"Error on video element with code=".concat(r.code).concat(void 0!==r.msExtendedCode?" (msExtendedCode=0x".concat(a.StringUtil.signed32BitIntegerToHexString(r.msExtendedCode),")"):"",": ").concat(r.message))||this;return i.error=r,i._audioValidationString="no issues found",i._audioInitCodecString="no init segment",i._audioLastWasInit=!1,i._videoValidationString="no issues found",i._videoInitCodecString="no init segment",i._videoLastWasInit=!1,i._data=n,i._parseDetailsFromContext(),i}return n.__extends(t,e),t.prototype.updateData=function(e){this._data=n.__assign(n.__assign({},this._data),e)},t.prototype._parseDetailsFromContext=function(){if(void 0!==this._data){var e=this.getSourceBuffer("audio",this._data.sourceBuffers);this._audioCodecs=null==e?void 0:e.codecs,this._audioLastWasInit=(null==e?void 0:e.lastAppendedSegmentWasInit)===!0;var t=null==e?void 0:e.getInitSegment();if(void 0!==t){var r=o.Mp4Util.determineCodec("audio",new Uint8Array(t));this._audioInitCodecString="init segment had codec: ".concat(r)}var n=null==e?void 0:e.getLastSegment();void 0!==n&&(this._audioValidationString=o.Mp4Util.runBasicSegmentValidation("audio",new Uint8Array(n)).join(","));var i=this.getSourceBuffer("video",this._data.sourceBuffers);this._videoCodecs=null==i?void 0:i.codecs,this._videoLastWasInit=(null==i?void 0:i.lastAppendedSegmentWasInit)===!0;var a=null==i?void 0:i.getInitSegment();if(void 0!==a){var s=o.Mp4Util.determineCodec("video",new Uint8Array(a));this._videoInitCodecString="init segment had codec: ".concat(s)}var u=null==i?void 0:i.getLastSegment();void 0!==u&&(this._videoValidationString=o.Mp4Util.runBasicSegmentValidation("video",new Uint8Array(u)).join(","))}},t.prototype.toString=function(){var t,r,n="".concat(e.prototype.toString.call(this));if(void 0===this._data)return n;if(n+="\nbufferForPlaybackSeconds=".concat(this._data.bufferForPlaybackSeconds),(null===(t=this._data.variantData)||void 0===t?void 0:t.audio)!==void 0&&(n+="\ncodec of audio source buffer: ".concat(this._audioCodecs,", attempting to append ").concat(this._audioLastWasInit?"init":"data"," segment with codec: ").concat(this._data.variantData.audio.codecs,", ").concat(this._audioInitCodecString)),(null===(r=this._data.variantData)||void 0===r?void 0:r.video)!==void 0&&(n+="\ncodec of video source buffer: ".concat(this._videoCodecs,", attempting to append ").concat(this._videoLastWasInit?"init":"data"," segment with codec: ").concat(this._data.variantData.video.codecs,", ").concat(this._videoInitCodecString)),void 0!==this._audioValidationString&&(n+="\naudio validation results: ".concat(this._audioValidationString)),void 0!==this._videoValidationString&&(n+="\nvideo validation results: ".concat(this._videoValidationString)),void 0!==this._data.videoState){var i=this._data.videoState;n+="\nVideoStateData:\n currentTime=".concat(i.currentTime,"\n playbackRate=").concat(i.playbackRate,"\n readyState=").concat(i.readyState,"\n size=").concat(JSON.stringify(i.size),"\n buffered=").concat(JSON.stringify(i.buffered),"\n droppedVideoFrames=").concat(i.droppedVideoFrames,"\n totalVideoFrames=").concat(i.totalVideoFrames)}var o=this._getMessagesContextString(this._data.mediaSourceMessages);void 0!==o&&(n+="\nMedia Source Messages (t=".concat(Date.now(),"):\n")+o);var a=this._getMessagesContextString(this._data.sourceBufferMessages);return void 0!==a&&(n+="\nSource Buffer Messages (t=".concat(Date.now(),"):\n")+a),n},t.prototype.getSourceBuffer=function(e,t){return null==t?void 0:t.tryGet(e)},t.prototype._getMessagesContextString=function(e){if(void 0!==e&&e.length>0)return e.map(function(e){return" ".concat(e.time,": ").concat(e.message)}).join("\n")},t.NAME="VideoElement",t}(i.WrappedError);t.VideoElementError=s},41112:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VideoStalledError=void 0;var n=r(91261),i=function(e){function t(r,n,i){return void 0!==n&&(r+="\nAttempted ".concat(n.length," stall mitigation").concat(1===n.length?"":"s").concat(n.length>0?" at ".concat(JSON.stringify(n)):"",".")),e.call(this,t.NAME,r,i)||this}return n.__extends(t,e),t.NAME="VideoStalled",t}(r(93218).WrappedError);t.VideoStalledError=i},86507:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MediaObjectQueue=void 0;var n=r(91261),i=r(20217),o=r(8125),a=r(93678),s=r(93218),u=r(58699),l=r(31532),c=r(96798),d=r(23239),p=function(){function e(e,t,r){this._system=e,this.onError=new i.Emitter,this.onSourceBufferUpdateEnd=new i.Emitter,this.mediaSourceMessages=new d.MessageList,this.sourceBufferMessages=new d.MessageList,this._opSequence=0,this._sourceBufferObjects=new o.Map,this._mediaSourceVerify=t,this._sourceBufferVerify=r}return e.prototype.trackMediaSource=function(e){var t=this;this.untrackMediaSource();var r=new u.AsyncWorker(this._system,{getNextWorkItem:function(){return t._getNextMediaSourceWorkItem()},handleWorkItem:function(e){return t._handleMediaSourceWorkItem(e)},hasWorkItem:function(){return t._hasNextMediaSourceWorkItem()}});r.onError.on(this,function(e){return t.onError.emit(e.error)}),r.onWorkCompleted.on(this,function(){return t.flush()}),r.concurrentLimit=0;var n=this._makeMediaObject(r,e);this._mediaSourceObject=n},e.prototype.trackSourceBuffer=function(e){var t=this;this.untrackSourceBuffer(e);var r=new u.AsyncWorker(this._system,{getNextWorkItem:function(){return t._getNextSourceBufferWorkItem(e)},handleWorkItem:function(r){return t._handleSourceBufferWorkItem(e,r)},hasWorkItem:function(){return t._hasNextSourceBufferWorkItem(e)}});r.onError.on(this,function(e){return t.onError.emit(e.error)}),r.onWorkCompleted.on(this,function(){return t.flush()}),r.concurrentLimit=0;var n=this._makeMediaObject(r,e);this._sourceBufferObjects.set(e,n),e.onUpdateEnd.on(this,function(){t.flush(),t.onSourceBufferUpdateEnd.emit()})},e.prototype.untrackMediaSource=function(){var e;null===(e=this._mediaSourceObject)||void 0===e||e.destroy(),this._mediaSourceObject=void 0},e.prototype.untrackSourceBuffer=function(e){var t=this._sourceBufferObjects.tryGet(e);null==t||t.mediaObject.onUpdateEnd.off(this),null==t||t.destroy(),this._sourceBufferObjects.delete(e)},e.prototype.reset=function(){var e=this;this.untrackMediaSource(),this._sourceBufferObjects.forEach(function(t){return e.untrackSourceBuffer(t)})},e.prototype.flush=function(){var e;null===(e=this._mediaSourceObject)||void 0===e||e.worker.flush(),this._sourceBufferObjects.forEach(function(e,t){return t.worker.flush()})},e.prototype.queueMediaSource=function(e,t,r){var i=this;return new Promise(function(o,s){if(void 0===i._mediaSourceObject){s(new l.MediaOperationStateError("Attempting to queue ".concat(e," without a tracking media source")));return}i._opSequence++,i._mediaSourceObject.queue.push({name:e,sequence:i._opSequence,run:function(){return n.__awaiter(i,void 0,void 0,function(){return n.__generator(this,function(e){switch(e.label){case 0:return[4,t()];case 1:return o(e.sent()),[2]}})})},reject:function(t){if(!(t instanceof a.OperationCanceledError)||"addSourceBuffer"===e||"openSource"===e){s(t);return}i._system.logWarn("ignoring cancelation ".concat(e)),o(void 0)},canRun:null!=r?r:function(){return!0}}),i.flush()})},e.prototype.queueSourceBuffer=function(e,t,r,i){var o=this;return new Promise(function(a,s){var u=o._sourceBufferObjects.tryGet(e);if(void 0===u){s(new l.MediaOperationStateError("Attempting to queue ".concat(t," without a tracking source buffer")));return}o._opSequence++,u.queue.push({name:t,sequence:o._opSequence,run:function(){return n.__awaiter(o,void 0,void 0,function(){return n.__generator(this,function(e){switch(e.label){case 0:return[4,r()];case 1:return a(e.sent()),[2]}})})},reject:s,canRun:null!=i?i:function(){return!0}}),o.flush()})},e.prototype.hasRunningSourceBuffer=function(){var e=!1;return this._sourceBufferObjects.forEach(function(t,r){(t.updating||r.worker.isRunning())&&(e=!0)}),e},e.prototype.hasRunningMediaSource=function(){return void 0!==this._mediaSourceObject&&this._mediaSourceObject.worker.isRunning()},e.prototype.getSourceBuffers=function(){var e=new c.HashMap;return this._sourceBufferObjects.forEach(function(t){e.set(t.streamType,t)}),e},e.prototype._makeMediaObject=function(e,t){var r=this,n={worker:e,mediaObject:t,queue:[],destroy:function(){e.stop(),e.destroy(),r._cancelQueue(n.queue)}};return n},e.prototype._cancelQueue=function(e){for(var t=0;t0&&this._times[0]0&&n>=s[s.length-1].start&&n<=s[s.length-1].end&&r.playbackRate>0&&Math.abs(s[s.length-1].end-i.end)<=e.SMALL_PERIOD_DURATION_SECONDS&&a._haveAppendedToEnd()&&(!a._inject.isLive()||!a._isLastPeriod()))try{a.endOfStream.emit()}catch(e){a.onError.emit(new o.UnsupportedError("Error emitting endOfStream."))}}}},this._inject=r,this._timer=new n.SyncTimer(t,this._onTimerUpdate)}return e.prototype.start=function(){this._timer.tickEvery(e.TIMER_UPDATE_SECONDS)},e.prototype.stop=function(){this._timer.stop()},e.prototype._isLastPeriod=function(){var e=this._inject.playbackSession();if(void 0===e)return!1;var t=e.getLoadedBuffer();return void 0!==t&&e.getAppendPeriod()===t.getPeriods()[t.getPeriods().length-1]},e.prototype._haveAppendedLastSegmentInPeriod=function(e,t,r){for(var n=0,i=r.active.getAllRanges();nthis.skipMinBufferSeconds)){var y=Math.abs(g.start-l);(void 0===a||y0&&void 0!==s)return s}},e.GAP_SKIP_MAX_SECONDS=1,e.GAP_SKIP_MAX_SECONDS_LIVE=10,e.GAP_SKIP_MIN_BUFFER_SECONDS=4,e}();t.GapSkippingController=i},19546:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingContentSkippingController=void 0;var n=r(20217),i=r(34167),o=r(22e3),a=function(){function e(e,t,r){var i=this;this.onMissingContentSeek=new n.Emitter,this._onPlayerStateChange=function(e){var t,r=null===(t=e.videoState)||void 0===t?void 0:t.currentTime,n="STALLED"===e.playbackState,o="IDLE"===e.playbackState;if(void 0===r||!n&&!o||n&&"NO_CONTENT_FOUND"!==e.stallReason||i._tryHandleLiveStreamMissingContent(e,r)||i._tryHandleGap(e,r))return},this._stateChange=e,this._system=t,this._inject=r}return e.prototype.start=function(e){this._stateChange.on(this,this._onPlayerStateChange),this._onPlayerStateChange(e)},e.prototype.stop=function(){this._stateChange.off(this)},e.prototype.correctLivePosition=function(e,t){if(this._isOutsideLiveWindow(e,t)){var r=this._isRollingWindow(t.start)||e>=t.end+.001?this._inject.getLiveEdge():this._inject.getLiveStart();if(void 0!==r)return r;this._system.logInfo("Failed to find live edge or live start.")}},e.prototype._isOutsideLiveWindow=function(e,t){return e+.001=t.end+.001},e.prototype._isRollingWindow=function(e){var t=this._inject.getOriginalStartTime();return void 0!==t&&e>t},e.prototype._tryHandleLiveStreamMissingContent=function(e,t){var r=this._inject.getLiveContentRange();if(void 0!==e.videoState&&0!==e.videoState.playbackRate&&void 0!==r){var n=this.correctLivePosition(t,r);if(void 0!==n)return this._system.logWarn("Outside live window. Current time: ".concat(t,". Live window: ").concat(r.start," - ").concat(r.end,". Attempting jump to ").concat(n,".")),this.onMissingContentSeek.emit({currentTime:t,nextContentTime:n,outsideLiveWindow:!0}),!0}return!1},e.prototype._tryHandleGap=function(e,t){var r,n,o,a,s=this._inject.getCurrentPeriod();if(void 0===s||(null===(r=e.variant)||void 0===r?void 0:r.audio)!==void 0&&-1===s.audio.indexOf(e.variant.audio)||(null===(n=e.variant)||void 0===n?void 0:n.video)!==void 0&&-1===s.video.indexOf(e.variant.video))return!1;if(void 0===e.variant){var u=i.PlayerUtil.getRangeOfPeriod(s,"intersection");if(void 0!==u&&t=0)){var a=-n-1;if(!(a>=e.segments.length)){for(var s=a;s0){r=s;break}}if(void 0!==r)return e.segments.getTiming(r).start}}}},e}();t.MissingContentSkippingController=a},50324:function(e,t){"use strict";var r,n;t.q=void 0,(n=r||(t.q=r={})).IDLE="IDLE",n.READY="READY",n.STALLED="STALLED",n.SEEKING="SEEKING",n.ENDED="ENDED"},22e3:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PlayerConstants=void 0;var r=function(){function e(){}return e.SIZE_UPDATE_SECONDS=10,e.BUFFER_UPDATE_SECONDS=1,e.PLAYER_UPDATE_SECONDS=.25,e.TEXT_UPDATE_SECONDS=.25,e.DEFAULT_RELATIVE_BUFFER_START=0,e.DEFAULT_RELATIVE_BUFFER_END=30,e.DEFAULT_RELATIVE_APPEND_START=0,e.DEFAULT_RELATIVE_APPEND_END=10,e.DEFAULT_BUFFER_FOR_PLAYBACK_SECONDS=0,e.STALL_SEEK_EPSILON=.01,e.MISSING_CONTENT_EPSILON=1,e.DEFAULT_SEEK_PAST_END_RESTART_SECONDS=.5,e.DEFAULT_STALL_TIME_MITIGATION_THRESHOLD_SECONDS=5,e.DEFAULT_STALL_TIME_ERROR_THRESHOLD_SECONDS=360,e.DEFAULT_ERROR_RECOVERY_MAX_ATTEMPTS=3,e}();t.PlayerConstants=r},68920:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PlayerLoadController=void 0;var n=r(91261),i=r(61142),o=r(57497),a=function(){function e(e,t){this._inject=t,this._worker=new i.SequentialTaskRunner(e),this.onError=this._worker.onError,this.onWarning=this._worker.onWarning}return e.prototype.isReloading=function(){var e;return(null===(e=this._worker.tasks[0])||void 0===e?void 0:e.request.type)==="reload"},e.prototype.attach=function(e){var t=this;return this._worker.runWithoutReturn(n.__assign({type:"attach"},e),function(e){return t._inject.attach(e)})},e.prototype.detach=function(e){var t=this;return this._worker.runWithReturn({type:"detach"},function(){return t._inject.detach(e)})},e.prototype.reload=function(e){var t=this;return this._worker.runReplace(n.__assign({type:"reload"},e),function(e,r){return"reload"===e.type&&t._isReloadRequestEqual(e,r)},function(e){return t._inject.reload(e)})},e.prototype.seek=function(e){var t=this;return this._worker.runReplace(n.__assign({type:"seek"},e),function(e,t){return"seek"===e.type&&e.position===t.position},function(e){return t._inject.seek(e)})},e.prototype._isReloadRequestEqual=function(e,t){return e.sequence===t.sequence&&e.reuseDownloadedSegments===t.reuseDownloadedSegments&&e.useExistingDrm===t.useExistingDrm&&e.position===t.position&&(void 0===e.audioCodecGroups&&void 0===t.audioCodecGroups||void 0!==e.audioCodecGroups&&void 0!==t.audioCodecGroups&&o.ArrayUtil.areEqual(e.audioCodecGroups,t.audioCodecGroups))&&(void 0===e.videoCodecGroups&&void 0===t.videoCodecGroups||void 0!==e.videoCodecGroups&&void 0!==t.videoCodecGroups&&o.ArrayUtil.areEqual(e.videoCodecGroups,t.videoCodecGroups))&&(void 0===e.keySystemDenylist&&void 0===t.keySystemDenylist||void 0!==e.keySystemDenylist&&void 0!==t.keySystemDenylist&&o.ArrayUtil.areEqual(e.keySystemDenylist,t.keySystemDenylist))},e}();t.PlayerLoadController=a},22281:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PlayerStateTracker=void 0;var n=r(91261),i=r(20217),o=r(57999),a=r(57497),s=r(11202),u=function(){function e(){this.onStateChanged=new i.Emitter,this._stallCounter=0,this._safeSeekInProgress=!1,this._playerState={stallReason:"NOT_STALLED",playbackState:"IDLE",bitrate:{},videoState:void 0},this._delayedCallbacks=[]}return e.prototype.getCurrent=function(){return this._playerState},e.prototype.reset=function(e){this._stallCounter=0,void 0!==this._session&&this._session.analytics.removeGroup("playerStateChanged"),this._playerStateAnalytics=void 0,this._session=e,void 0!==this._session&&(this._playerStateAnalytics=this._session.analytics.addGroup("playerStateChanged"),this._playerStateAnalytics.add("IDLE")),this._setPlayerState({stallReason:"NOT_STALLED",playbackState:"IDLE",bitrate:{},videoState:void 0}),this._emitOnStateChanged()},e.prototype.setVolume=function(e){void 0!==this._playerState.videoState&&this._playerState.videoState.volume!==e&&(this._setPlayerState(n.__assign(n.__assign({},this._playerState),{videoState:n.__assign(n.__assign({},this._playerState.videoState),{volume:e})})),this._emitOnStateChanged())},e.prototype.setPosition=function(e){void 0!==this._playerState.videoState&&this._playerState.videoState.currentTime!==e&&(this._setPlayerState(n.__assign(n.__assign({},this._playerState),{stallReason:"NOT_STALLED",playbackState:"SEEKING",videoState:n.__assign(n.__assign({},this._playerState.videoState),{currentTime:e})})),this._emitOnStateChanged())},e.prototype.startSafeSeek=function(){this._safeSeekInProgress=!0,this._setPlayerState(n.__assign(n.__assign({},this._playerState),{stallReason:"NOT_STALLED",playbackState:"SEEKING"})),this._emitOnStateChanged()},e.prototype.endSafeSeek=function(){this._safeSeekInProgress=!1},e.prototype.setRate=function(e){void 0!==this._playerState.videoState&&this._playerState.videoState.playbackRate!==e&&(this._setPlayerState(n.__assign(n.__assign({},this._playerState),{videoState:n.__assign(n.__assign({},this._playerState.videoState),{playbackRate:e})})),this._emitOnStateChanged())},e.prototype.setVideoState=function(e){var t=this._playerState.videoState;this._safeSeekInProgress&&void 0!==t&&(e=n.__assign(n.__assign({},e),{currentTime:t.currentTime})),this._setPlayerState(n.__assign(n.__assign({},this._playerState),{videoState:e})),void 0!==t&&t.currentTime===e.currentTime&&this._mayBeStalled(e)?this._stallCounter++:this._stallCounter=0;var r=this._getBufferItemsFromSession(e.currentTime),i=void 0===t;i=this._applyPlayerStateChanges(e)||i,i=this._applyCurrentBitrate(r)||i,i=this._applyCurrentStreams(r)||i,void 0!==t&&(i||(i=t.currentTime!==e.currentTime||t.volume!==e.volume||t.playbackRate!==e.playbackRate||t.readyState!==e.readyState||this._didBufferedTimeChange(t.buffered,e.buffered))),i&&this._emitOnStateChanged()},e.prototype._setPlayerState=function(e){var t,r=this._playerState;this._playerState=e,this._playerState.playbackState!==r.playbackState&&(void 0!==this._playerStateAnalytics&&this._playerStateAnalytics.add(this._playerState.playbackState),this._delayEmit(null===(t=this._session)||void 0===t?void 0:t.metricBus.playbackStateChange,e))},e.prototype._applyPlayerStateChanges=function(e){var t,r=this._playerState.playbackState;return(null===(t=this._session)||void 0===t?void 0:t.isLive)===!1&&this._isStalledAtEnd(e)?this._setPlayerState(n.__assign(n.__assign({},this._playerState),{stallReason:"NOT_STALLED",playbackState:"ENDED"})):this._isStalled(e)?this._setPlayerState(n.__assign(n.__assign({},this._playerState),{stallReason:this._getReasonForStall(e),playbackState:"STALLED"})):"READY"!==r&&"ENDED"!==r&&e.readyState>=2&&this._setPlayerState(n.__assign(n.__assign({},this._playerState),{stallReason:"NOT_STALLED",playbackState:"READY"})),r!==this._playerState.playbackState},e.prototype._getReasonForStall=function(t){var r,n=this._getBufferItemsFromSession(t.currentTime);void 0!==n&&n.length>0&&t.currentTime>=n[0].pipelineState.end-e.STALLREASON_EPSILON&&(n=this._getBufferItemsFromSession(t.currentTime+e.STALLREASON_EPSILON));var i=n.filter(function(e){return"audio"===e.stream.type}),o=n.filter(function(e){return"video"===e.stream.type});if(0===i.length||0===o.length)return"NO_CONTENT_FOUND";for(var a=0,u=n;a=h&&(p=!0),y.start<=m&&y.end>=m&&(f=!0)}return p&&f?"VIDEO_NOT_PROGRESSING":"NO_BUFFERED_FOUND"},e.prototype._getBufferItemsFromSession=function(e){var t,r,n=null===(t=this._session)||void 0===t?void 0:t.getLoadedBuffer();return null!==(r=null==n?void 0:n.getBufferItems(e))&&void 0!==r?r:[]},e.prototype._applyCurrentBitrate=function(e){for(var t,r=!1,i=this._playerState.bitrate.audio,o=this._playerState.bitrate.video,a=this._playerState.bitrate.text,s=0;s0;return(t||this._isNearOrAfterEnd(e.currentTime))&&r},e.prototype._isStalled=function(t){return this._stallCounter>=e.STALL_DETECTION_TICK_THRESHOLD&&this._mayBeStalled(t)},e.prototype._isStalledAtEnd=function(t){return this._stallCounter>=e.STALL_DETECTION_TICK_THRESHOLD&&t.playbackRate>0&&this._isNearOrAfterEnd(t.currentTime)},e.prototype._isNearOrAfterEnd=function(t){var r,n=null===(r=this._session)||void 0===r?void 0:r.getContentRange();return void 0!==n&&t>=n.end-e.ENDOFSTREAM_EPSILON},e.prototype._delayEmit=function(e,t){void 0!==e&&this._delayedCallbacks.push(function(){return e.emit(t)})},e.prototype._emitOnStateChanged=function(){this.onStateChanged.emit(this._playerState),this._delayedCallbacks.forEach(function(e){return e()}),this._delayedCallbacks=[]},e.ENDOFSTREAM_EPSILON=1,e.STALLREASON_EPSILON=.5,e.STALL_DETECTION_TICK_THRESHOLD=4,e}();t.PlayerStateTracker=u},51417:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RegionController=void 0;var n=r(91261),i=r(20217),o=r(57999),a=r(34167),s=r(91037),u=r(63662),l="RegionController",c=function(){function e(t,r){this.periodEndMaxSeconds=e.PERIOD_END_MAX_SECONDS,this.onPeriodChange=new i.Emitter,this.onWarning=new i.Emitter,this._stateChange=t,this._inject=r}return e.prototype.getPeriodForTime=function(e){var t;return null===(t=this._getResumePeriodForTime(e))||void 0===t?void 0:t.period},e.prototype.start=function(e){var t,r=this;this.stop();var n=null!==(t=this._inject.getPeriods())&&void 0!==t?t:[];if(-1===n.indexOf(e)){var i=n.map(function(e){return e.id}).join(", ");throw new u.PlayerNotLoadedError("Failed to start RegionController, starting period with id=".concat(e.id," not found in [").concat(i,"]"))}this._currentPeriod=e,this._currentPeriodRange=a.PlayerUtil.getRangeOfPeriod(this._currentPeriod),this._stateChange.on(this,function(e){("STALLED"===e.playbackState||"SEEKING"===e.playbackState)&&r.tryUpdatePeriod(e)}),this.tryUpdatePeriod(this._inject.getState())},e.prototype.stop=function(){this._currentTime=void 0,this._currentPeriodRange=void 0,this._buffer=void 0,this._append=void 0,this._stateChange.off(this)},e.prototype.getCurrentPeriodRange=function(){return this._currentPeriodRange},e.prototype.applyBufferRegions=function(t,r,i,u){var c;return n.__awaiter(this,void 0,void 0,function(){var d,p,f,h;return n.__generator(this,function(n){switch(n.label){case 0:if(void 0===this._currentPeriod)return this.onWarning.emit(new s.WarningError("".concat(l," period not defined"))),[2];if(void 0===this._currentPeriodRange)return this.onWarning.emit(new s.WarningError("".concat(l," range not defined"))),[2];if(!(r!==this._currentTime||!this._isEqual(i,this._buffer)||!this._isEqual(u,this._append)||(null===(c=t.getLoadedBuffer())||void 0===c?void 0:c.needsBufferUpdate(this._currentPeriod))===!0))return[3,2];if(d=a.PlayerUtil.getRangeOfPeriod(this._currentPeriod),this._inject.isLive()){if(void 0===d)return this.onWarning.emit(new s.WarningError("".concat(l," live range not defined"))),[2];o.TimeRangeUtil.hasOverlap(this._currentPeriodRange,d)&&(this._currentPeriodRange=d)}return this._currentTime=r,this._buffer=i,this._append=u,p=e.DEFAULT_PADDING,f=void 0!==d?Math.max(d.start,r-p):r-p,h=r+p,t.setBufferRegions([{start:f+i.start,end:h+i.end}]),t.setAppendRegions([{start:f+u.start,end:h+u.end}]),[4,t.applyBufferRegions()];case 1:n.sent(),n.label=2;case 2:return[2]}})})},e.prototype.tryUpdatePeriod=function(e){var t,r=null===(t=e.videoState)||void 0===t?void 0:t.currentTime;if(void 0!==r){var n=this._getResumePeriodForTime(r,this.periodEndMaxSeconds);void 0!==n&&n.period!==this._currentPeriod&&this.onPeriodChange.emit({oldPeriodRange:this._currentPeriodRange,newPeriodRange:n.range,position:n.resumePosition})}},e.prototype._isEqual=function(e,t){return void 0!==t&&o.TimeRangeUtil.isRangeEqual(e,t)},e.prototype._getResumePeriodForTime=function(t,r){void 0===r&&(r=0);var n,i=null!==(n=this._inject.getPeriods())&&void 0!==n?n:[],o=a.PlayerUtil.getPeriodForTime(i,t+r);if(void 0===o&&i.length>0){var s=a.PlayerUtil.getRangeOfPeriod(i[0]),u=a.PlayerUtil.getRangeOfPeriod(i[i.length-1]);void 0!==s&&t<=s.start?o=i[0]:void 0!==u&&t<=u.end&&(o=i[i.length-1])}if(void 0!==o){var l=a.PlayerUtil.getRangeOfPeriod(o);if(void 0!==l)return{period:o,range:l,resumePosition:Math.min(t-l.start0&&(n.lastTimestamp=Date.now(),n.retryCount--,n.attemptedRetries++),this.retryCounts.set(r,n)}},e.prototype._clearStaleRetries=function(){var t=this,r=Date.now();this.retryCounts.forEach(function(n,i){r-i.lastTimestamp>e.RETRY_REPEAT_TIME_MS&&t.retryCounts.delete(n)})},e.prototype._canRetry=function(e){var t=this._getKeyForError(e);if(void 0===t)return!1;var r=this.retryCounts.tryGet(t);if(void 0!==r&&r.retryCount<=0)return!1;var o=i.WrappedError.findFirst(e,n.VideoElementError);if(void 0!==o&&o.error.code<3)return!1;var a=i.WrappedError.findFirst(e,l.MediaSourceAddSourceBufferError);return!(void 0!==a&&("audio"!==a.streamType||["aac","heaac"].some(function(e){return e===a.codecGroup})))},e.prototype._getKeyForError=function(e){return i.WrappedError.causedBy(e,n.VideoElementError.NAME)?n.VideoElementError.NAME:i.WrappedError.causedBy(e,a.MediaKeySessionUpdateError.NAME)?a.MediaKeySessionUpdateError.NAME:i.WrappedError.causedBy(e,s.MediaKeySessionGenerateRequestError.NAME)?s.MediaKeySessionGenerateRequestError.NAME:i.WrappedError.causedBy(e,u.WebKitKeyError.NAME)?u.WebKitKeyError.NAME:i.WrappedError.causedBy(e,l.MediaSourceAddSourceBufferError.NAME)?l.MediaSourceAddSourceBufferError.NAME:void 0},e.prototype._getRetryRestrictions=function(e){switch(this._getKeyForError(e)){case n.VideoElementError.NAME:return{audio:["aac","heaac"],video:["avc"],keySystemDenylist:["com.microsoft.playready.recommendation"]};case a.MediaKeySessionUpdateError.NAME:return{video:["hevc","avc"]};case l.MediaSourceAddSourceBufferError.NAME:return{audio:["aac","heaac"]};case s.MediaKeySessionGenerateRequestError.NAME:case u.WebKitKeyError.NAME:return}},e.RETRY_REPEAT_TIME_MS=3e4,e.RETRY_COUNT=2,e}();t.RetryController=c},80110:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SafeSeeker=void 0;var n=r(91261),i=r(22e3),o=r(30617),a="SafeSeeker",s=function(){function e(e,t,r,n,i){this._system=e,this._buffer=t,this._videoElement=r,this._playerStateTracker=n,this._applyBufferRegions=i}return e.prototype.seek=function(e){return n.__awaiter(this,void 0,void 0,function(){var t;return n.__generator(this,function(r){switch(r.label){case 0:return this._system.logInfo("".concat(a,": initiating seek to ").concat(e)),[4,this._videoElement.getState()];case 1:t=r.sent().playbackRate,r.label=2;case 2:if(r.trys.push([2,,6,9]),this._playerStateTracker.startSafeSeek(),!(t>0))return[3,4];return this._system.logInfo("".concat(a,": pausing video before seek")),[4,this._videoElement.setRateWhenReady(0)];case 3:r.sent(),r.label=4;case 4:return[4,this._seek(e)];case 5:return r.sent(),[3,9];case 6:if(this._playerStateTracker.endSafeSeek(),!(t>0))return[3,8];return this._system.logInfo("".concat(a,": restoring playback rate to ").concat(t," after seek")),[4,this._videoElement.setRateWhenReady(t)];case 7:r.sent(),r.label=8;case 8:return[7];case 9:return this._system.logInfo("".concat(a,": seek to ").concat(e," completed")),[2]}})})},e.prototype._seek=function(e){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(t){switch(t.label){case 0:return[4,this._videoElement.setPositionWhenReady(e)];case 1:return t.sent(),[4,o.PromiseUtil.waitAll([this._buffer.clearAsync("video"),this._buffer.clearAsync("audio")])];case 2:return t.sent(),this._playerStateTracker.setPosition(e),[4,this._applyBufferRegions()];case 3:return t.sent(),[4,this._videoElement.setPositionWhenReady(e+i.PlayerConstants.STALL_SEEK_EPSILON)];case 4:return t.sent(),[2]}})})},e}();t.SafeSeeker=s},73354:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SeekSnapper=void 0;var n=r(91261),i=r(57999),o=r(34167),a=function(){function e(e,t,r){this._seekSnapping=e,this._getPeriods=t,this._getSelectedVideo=r}return e.prototype.snapToSegmentBoundary=function(e){return n.__awaiter(this,void 0,void 0,function(){var t,r,a,s,u,l,c,d,p,f;return n.__generator(this,function(n){switch(n.label){case 0:if(t=this._getPeriods().filter(function(e){return e.video.length>0}),!((r=o.PlayerUtil.binarySearchForIndex(t.length,function(e){return t[e]},e))<0))return[3,2];if(void 0===(a=t[-r-1]))return[2];return[4,this._getSelectedVideo(a)];case 1:return[2,null==(s=n.sent())?void 0:s.segments.getTiming(0).start];case 2:return u=t[r],[4,this._getSelectedVideo(u)];case 3:if(void 0===(l=n.sent()))return[2];if(c=l.segments.getTiming(l.segments.length-1),!(i.TimeRangeUtil.contains([c],e)&&e-c.start>(c.end-c.start)/2))return[3,5];if(void 0===(d=t[r+1]))return[2];return[4,this._getSelectedVideo(d)];case 4:return[2,null==(p=n.sent())?void 0:p.segments.getTiming(0).start];case 5:return[2,null==(f=o.PlayerUtil.getSegmentForSnapping(l.segments,e,this._seekSnapping))?void 0:f.start]}})})},e.prototype.snapToSegmentBoundarySync=function(e,t){var r=o.PlayerUtil.getSegmentForSnapping(t.segments,e,this._seekSnapping);if(void 0!==r&&r.end!==t.segments.getTiming(t.segments.length-1).end)return r.start},e}();t.SeekSnapper=a},89578:function(e,t){"use strict";var r,n;(n=r||(r={})).CLOSEST_VIDEO_SEGMENT_START="CLOSEST_VIDEO_SEGMENT_START",n.PREVIOUS_VIDEO_SEGMENT_START="PREVIOUS_VIDEO_SEGMENT_START",n.NEXT_VIDEO_SEGMENT_START="NEXT_VIDEO_SEGMENT_START"},78063:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StallSkippingController=void 0;var n=r(20217),i=r(68302),o=r(91037),a=function(){function e(t,r,a){var s=this;this.onStallSkip=new n.Emitter,this.onWarning=new n.Emitter,this._onTimerUpdate=function(){var t=s._inject.getPlayerState(),r=null==t?void 0:t.videoState;if(void 0!==s._stallSkipTime&&(null==r?void 0:r.currentTime)!==void 0&&s._stallSkipTime!==r.currentTime&&(s._system.logInfo("no longer stalled at ".concat(s._stallSkipTime," (now at ").concat(r.currentTime,")")),s._stallSkipTime=void 0),void 0===t||void 0===r||0===r.playbackRate||1!==r.readyState&&("stalled"!==s._level||"STALLED"!==t.playbackState)||void 0===r.buffered||r.currentTime===s._stallSkipTime||!s._haveBufferedAhead(r.buffered,r.currentTime)){s._observedStalledTicks=0;return}if(s._observedStalledTicks>=e.STALLED_TICKS_TO_ATTEMPT_MITIGATION){var n=r.currentTime;s.onWarning.emit(new o.WarningError("stalled for ".concat(s._observedStalledTicks," ticks at ").concat(n))),s._stallSkipTime=n,s.onStallSkip.emit({currentTime:n}),s._observedStalledTicks=0}else s._stallSkipTime=void 0,s._observedStalledTicks++},this._system=t,this._level=r,this._observedStalledTicks=0,this._inject=a,this._timer=new i.SyncTimer(t,this._onTimerUpdate)}return e.prototype.start=function(){this._observedStalledTicks=0,this._timer.tickEvery(e.TIMER_UPDATE_SECONDS)},e.prototype.stop=function(){this._timer.stop()},e.prototype.setStalledTime=function(e){this._stallSkipTime=e,this._system.logInfo("setting to stalled at ".concat(this._stallSkipTime))},e.prototype._haveBufferedAhead=function(t,r){var n=this._inject.getCurrentPeriodRange(),i=Math.min(r+e.BUFFERED_AHEAD_THRESHOLD_SECONDS,void 0!==n?Math.max(n.end-.5,0):1/0);return t.some(function(e){return e.start<=r&&e.end>r&&e.start<=i&&e.end>i})},e.TIMER_UPDATE_SECONDS=.5,e.BUFFERED_AHEAD_THRESHOLD_SECONDS=7,e.STALLED_TICKS_TO_ATTEMPT_MITIGATION=5,e}();t.StallSkippingController=a},49328:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StallTrackingController=void 0;var n=r(20217),i=r(68302),o=function(){function e(e,t,r,o){var a=this;this.onStallErrorTimeExceeded=new n.Emitter,this.onStallMitigationTimeExceeded=new n.Emitter,this._mitigationAttempts=[],this._afterStallMitigationThreshold=function(){a._handleAfterStallTimerAction(a.onStallMitigationTimeExceeded,a._stallTimeMitigationThresholdSeconds)},this._afterStallErrorThreshold=function(){a._handleAfterStallTimerAction(a.onStallErrorTimeExceeded,a._stallTimeErrorThresholdSeconds)},this._system=e,this._inject=t,this._stallErrorTimer=new i.SyncTimer(e,function(){return a._afterStallErrorThreshold()}),this._stallMitigationTimer=new i.SyncTimer(e,function(){return a._afterStallMitigationThreshold()}),this._stallTimeErrorThresholdSeconds=r,this._stallTimeMitigationThresholdSeconds=o}return e.prototype.start=function(){var e=this;this._inject.onPlayerStateChange.on(this,function(t){var r;"STALLED"===t.playbackState&&"STALLED"!==e._lastKnownState?(e._startTimers(),e._timeFirstObserved=Date.now(),e._stalledAt=null===(r=t.videoState)||void 0===r?void 0:r.currentTime):"STALLED"!==t.playbackState&&"STALLED"===e._lastKnownState&&e._stopTimers(),e._lastKnownState=t.playbackState})},e.prototype.stop=function(){this._stopTimers(),this._inject.onPlayerStateChange.off(this),this._mitigationAttempts=[]},e.prototype.attemptedMitigationAt=function(e){for(;this._mitigationAttempts.length>=5;)this._mitigationAttempts.shift();this._mitigationAttempts.push(e)},e.prototype.getMitigationAttempts=function(){return this._mitigationAttempts},e.prototype._startTimers=function(){this._stallTimeMitigationThresholdSeconds>0&&this._stallErrorTimer.tickAfter(this._stallTimeErrorThresholdSeconds),this._stallTimeErrorThresholdSeconds>0&&this._stallMitigationTimer.tickAfter(this._stallTimeMitigationThresholdSeconds)},e.prototype._stopTimers=function(){this._stalledAt=void 0,this._stallErrorTimer.stop(),this._stallMitigationTimer.stop()},e.prototype._handleAfterStallTimerAction=function(e,t){var r=this._inject.getPlayerState(),n=null==r?void 0:r.videoState;if((null==r?void 0:r.stallReason)==="NOT_STALLED"&&(null==n?void 0:n.currentTime)!==void 0&&void 0!==this._stalledAt){this._system.logVerbose("No longer stalled at ".concat(this._stalledAt,". Now at ").concat(n.currentTime,"."));return}if(void 0!==r&&void 0!==n&&void 0!==n.buffered&&void 0!==n.currentTime){var i={timeFirstObserved:this._timeFirstObserved,currentTime:Date.now(),stallThreshold:t,videoCurrentTime:n.currentTime,stallReason:r.stallReason};e.emit(i)}},e}();t.StallTrackingController=o},15968:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultBufferLogic=void 0;var n=r(11202),i=r(57999),o=r(93218),a=r(60909),s=r(91110),u=function(){function e(e){void 0===e&&(e=!1),this._probePastFailedSegmentDownload=e}return e.prototype.applyToPipelines=function(e){for(var t=e.getAppendRegions(),r=[],n=0,o=e.getActivePipelines();n=0;t--)if(n.SegmentPipelineWorkerUtil.isDownloaded(e[t]))return e[t]},e.prototype._applySequentialAppend=function(e,t){for(var r=[],n=0;na&&(d=!1)}d&&!n.SegmentPipelineWorkerUtil.isDownloaded(c)&&(s=!0)}else d=!s||"probe_failed"!==l.probeState}d||(s=!1),s&&!n.SegmentPipelineWorkerUtil.isDownloaded(l)&&(l.probeState="probing"),l.allowDownload=d}return s},e.prototype._shouldProbeAfter=function(e){return void 0!==e.lastDownloadError&&!o.WrappedError.causedBy(e.lastDownloadError,a.OperationTimedOutError.NAME)&&!o.WrappedError.causedBy(e.lastDownloadError,s.NoProgressMadeError.NAME)},e.DEFAULT_RUNAWAY_SECONDS=6,e}();t.DefaultBufferLogic=u},86460:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MediaSourceController=void 0;var n=r(91261),i=r(45e3),o=r(20217),a=r(96798),s=r(22553),u=r(30617),l=r(61113),c=r(35838),d=function(){function e(e){this._pipelines=[],this.onTextChange=new o.Emitter,this.onWarning=new o.Emitter,this.onBufferedRangesRemoved=new o.Emitter,this._system=e}return e.cleanDrained=function(e){e.forEach(function(e,t){s.SegmentPipeline.cleanDrained(t)})},e.prototype.destroy=function(){this._pipelines.forEach(function(e){return e.destroy()})},e.prototype.getMediaSource=function(){return this._mediaSource},e.prototype.getPipelines=function(){return this._pipelines},e.prototype.getPipeline=function(e){return this._pipelines.filter(function(t){return t.type===e})[0]},e.prototype.getPipelineItems=function(e){for(var t=[],r=this.getPipelines(),n=0;ne){t.push(a);break}}return t},e.prototype.drainDownloaded=function(){for(var e=new a.HashMap,t=this.getPipelines(),r=0;r").concat(p.length," audio, ")+"".concat(u.length,"->").concat(f.length," video, ")+"".concat(c.length,"->").concat(h.length," text, ")+"".concat(d.length,"->").concat(m.length," image\n")+"currentPeriod@id=".concat(e.id," -> latestPeriod@id=").concat(t.id,"\n")+"current periods: ".concat(this._current.periods.map(function(e){return"".concat(e.id,"@[").concat(e.start,"-").concat(e.end,"]")}).join(", ")," (publishTime=").concat(null===(o=this._current.dynamicInfo)||void 0===o?void 0:o.publishedTime,")\n")+"latest periods: ".concat(r.map(function(e){return"".concat(e.id,"@[").concat(e.start,"-").concat(e.end,"]")}).join(", ")," (publishTime=").concat(null==i?void 0:i.publishedTime,")"));return v=[],e.audio.forEach(function(e,r){var n=t.audio[r];v.push(y._mergeStream(e,n))}),e.video.forEach(function(e,r){var n=t.video[r];v.push(y._mergeStream(e,n))}),e.text.forEach(function(e,r){var n=t.text[r];v.push(y._mergeStream(e,n))}),e.image.forEach(function(e,r){var n=t.image[r];v.push(y._mergeStream(e,n))}),[4,l.PromiseUtil.waitAll(v)];case 1:return _.sent(),(g=e.events).splice.apply(g,n.__spreadArray([0,e.events.length],t.events,!1)),e.start=t.start,e.end=t.end,[2]}})})},e.prototype._addPeriods=function(e){var t;if(0===this._current.periods.length)throw new p.ManifestProcessingError("Attempting to add periods without having existing periods");this._ensureVideoForPeriods(e),(t=this._current.periods).push.apply(t,e)},e.prototype._updatePeriods=function(e){return n.__awaiter(this,void 0,void 0,function(){var t,r,i,o;return n.__generator(this,function(n){switch(n.label){case 0:return t=e.currentFirstPeriod,r=e.previousLastPeriod,i=[],void 0!==t&&((o=d.ArrayUtil.findFirstIndex(this._current.periods,function(e){return e.id===t.id}))>0&&this._current.periods.splice(0,o),i.push(this._updateExistingPeriod(this._current.periods[0],t,e.allPeriods,e.dynamicInfo))),void 0!==r&&t!==r&&i.push(this._updateExistingPeriod(this._current.periods[this._current.periods.length-1],r,e.allPeriods,e.dynamicInfo)),[4,l.PromiseUtil.waitAll(i)];case 1:return n.sent(),e.currentAddedPeriods.length>0&&this._addPeriods(e.currentAddedPeriods),[2]}})})},e.prototype._ensureVideoForPeriods=function(e){for(var t=0;tthis._current.dynamicInfo.publishedTime))return[3,4];return[4,this._updatePeriods(i)];case 3:return n.sent(),this._controller.requireBufferUpdate(),[3,5];case 4:this._system.logWarn("Refresh publish time '".concat(i.dynamicInfo.publishedTime,"' is not newer than current '").concat(this._current.dynamicInfo.publishedTime,"'")),n.label=5;case 5:for(s=0,this._current.dynamicInfo=i.dynamicInfo,l=[i.currentFirstPeriod,i.previousLastPeriod];s0){for(var r=0,n=this._loadedData.init.audioGroupOrder;r=i.start?o:i.start}},e.prototype.getLiveStart=function(){var e,t=null===(e=this._loadedData)||void 0===e?void 0:e.manifest.getManifest().dynamicInfo,r=this.getContentRange("intersection");if(void 0!==t&&void 0!==r)return r.start},e.prototype.getLiveEnd=function(){var e,t,r=this.getContentRange(),n=null===(t=null===(e=this._loadedData)||void 0===e?void 0:e.manifest.getManifest().dynamicInfo)||void 0===t?void 0:t.publishedTime;if(void 0!==n&&void 0!==r)return r.end+(Date.now()/1e3-n)},e.prototype.isLiveEnd=function(e){var t,r=this.getLiveEdge(),n=null===(t=this._loadedData)||void 0===t?void 0:t.manifest.getManifest().dynamicInfo;return void 0!==r&&void 0!==n&&r-e0?t:e.video,audio:e.audio,text:e.text}},e.prototype.destroy=function(){this._quarantine.forEach(function(e,t){t.timer.stop()}),this._retryDataMap.clear(),this._continuouslyFailingStreams.clear(),this._quarantine.clear(),this._positionsToSkip.clear()},Object.defineProperty(e.prototype,"timeoutMS",{get:function(){var e;return null!==(e=this._options.requestTimeoutMS)&&void 0!==e?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"progressTimeoutMS",{get:function(){var e;return null!==(e=this._options.requestProgressTimeoutMS)&&void 0!==e?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"retryData",{get:function(){return this._retryDataMap},set:function(e){this._retryDataMap=e},enumerable:!1,configurable:!0}),e.prototype._overrideDefaultRetryLogic=function(e){void 0!==e.maxRetryTimeMS&&e.maxRetryTimeMS<0&&this._system.logWarn("An invalid retry timeout value of ".concat(e.maxRetryTimeMS," was configured.")),this._options=n.__assign(n.__assign({},this._options),e)},e.prototype.deleteRetryData=function(e){this._retryDataMap.delete(e)},e.prototype.onSegmentDownloadCompleted=function(e){var t,r=null===(t=this._getBufferItem(e))||void 0===t?void 0:t.stream;if(void 0!==r){var n=c.PlayerUtil.getVideoStreamUniqueId(r),i=this._quarantine.tryGet(n);void 0!==i&&(i.timer.stop(),this._quarantine.delete(n)),this._continuouslyFailingStreams.delete(n)}},e.prototype.onSegmentAppendFailed=function(e,t){return void 0===t&&(t=!1),n.__awaiter(this,void 0,void 0,function(){var r;return n.__generator(this,function(n){switch(n.label){case 0:return this._handleRetryGiveUp(e,t,"append"),[4,this._getFallbackSegment(e)];case 1:return r=n.sent(),[2,this._handleAlternativeSegment(e,r,e.appendStartTimesMS[e.appendStartTimesMS.length-1])]}})})},e.prototype.onSegmentDownloadFailed=function(e,t){return void 0===t&&(t=!1),n.__awaiter(this,void 0,void 0,function(){var r;return n.__generator(this,function(n){switch(n.label){case 0:if("probing"===e.probeState)return e.phases.reset(),e.processing=!1,e.error=void 0,e.probeState="probe_failed",e.allowDownload=!1,e.downloadStartTimesMS=[],[2,!1];return this._handleRetryGiveUp(e,t,"download"),[4,this._getFallbackSegment(e)];case 1:return void 0===(r=n.sent())&&(r=this._getRetrySegment(e)),[2,this._handleAlternativeSegment(e,r,e.downloadStartTimesMS[e.downloadStartTimesMS.length-1])]}})})},e.prototype._handleRetryGiveUp=function(e,t,r){var n,i;if(!t&&void 0!==this._options.maxRetryTimeMS&&e.downloadStartTimesMS.length>0&&this._options.maxRetryTimeMS>0&&Date.now()-e.downloadStartTimesMS[0]>=this._options.maxRetryTimeMS){var o=null!==(i=null===(n=this._retryDataMap.tryGet(e))||void 0===n?void 0:n.retryCount)&&void 0!==i?i:0,a="Failed to retry segment (".concat(r,") after ").concat(this._options.maxRetryTimeMS," ms and ").concat(o," retries"),s=this._generateSegmentRetryFailedError(e,a);if(void 0!==s)throw s;throw new p.SegmentRetryFailedError(a)}},e.prototype._handleAlternativeSegment=function(t,r,i){var o,a,s,u;return n.__awaiter(this,void 0,void 0,function(){var l,c,d,p,f;return n.__generator(this,function(h){switch(h.label){case 0:if(void 0===(l=this._getBufferItem(t)))return this._system.logWarn("Buffer item is no longer in current buffer time range."),[2,!1];if(!(void 0!==r))return[3,3];if(this._trackContinuouslyFailingStream(l.stream),c=null!==(o=this._options.retryDelayMS)&&void 0!==o?o:e.DEFAULT_RETRY_DELAY_MS,!(void 0!==(d=void 0===i?void 0:Date.now()-i)&&da){(void 0===n||_.start>n)&&_.phases.has("DownloadCompleted")&&(n=_.start),m.push(y);break}}}if(void 0!==n){var b=!1,S=n;l.forEach(function(e,t){for(var r=0;r=this._options.continuouslyFailingStreamRetryCount&&(this._continuouslyFailingStreams.delete(r),this._addStreamToQuarantine(r,this._options.continuouslyFailingStreamQuarantineSeconds))}},e.prototype._addStreamToQuarantine=function(e,t){var r=this,n=new h.SyncTimer(this._system,function(){r._quarantine.delete(e),r._buffer.invalidateAllVariants([r.id])}),i=Date.now();n.tickAfter(t),this._quarantine.set(e,{timer:n,startTimestamp:i}),this._buffer.invalidateAllVariants([this.id]),this._skipToNextDownloadedSegmentIfStalled()},e.prototype._getRetrySegment=function(e){var t=this._getBufferItem(e);if(void 0!==t)return{segment:t.pipelineState.segment,variant:t.variant,details:t.stream}},e.prototype._getFallbackSegment=function(e){var t;return n.__awaiter(this,void 0,void 0,function(){var r,i,o,a,s,l;return n.__generator(this,function(d){switch(d.label){case 0:if(r=this._getBufferItem(e),v.WrappedError.causedBy(e.error,u.NoProgressMadeError.NAME)&&this._system.logWarn("FallbackDueToNoProgressError: ".concat(null===(t=e.error)||void 0===t?void 0:t.toString())),void 0!==r)return[3,1];throw new p.SegmentRetryFailedError("Failed to get fallback segment, because the buffer item is no longer valid.");case 1:if(void 0===(i=this._getFallbackVariant(e,r,this._getVariants(r.period))))return[2];return o=this._retryDataMap.tryGet(e),this.retryData.set(e,n.__assign(n.__assign({},o),{failedBefore:!0})),c.PlayerUtil.clearCachedDetailsIfFailed(i,r.stream.type),[4,this._getVariantDetails(r.period,i)];case 2:if(a=d.sent(),void 0===(s=c.PlayerUtil.getStream(a,r.stream.type)))return[2];if(void 0!==(l=c.PlayerUtil.getSegmentByTime(s.segments,e.segment.start))&&void 0!==this._getBufferItem(e))return r.allowReplacement=!1,[2,{details:s,variant:a,segment:l}];d.label=3;case 3:return[2]}})})},e.prototype._getFallbackVariant=function(e,t,r){var n=this._retryDataMap.tryGet(e),i=t.variant,o=r.getFirst();if("always_lowest"===this._options.segmentFallbackStrategy)return o.bandwidth0&&c.length>0)return{audio:l,video:c,text:e.text}}return e},e.prototype._getMatchingCodecGroups=function(e,t){var r=[],n=t.tryGet(e);return void 0!==n&&n.forEach(function(e){return r.push(e)}),r},e.prototype._addCodecGroupMap=function(e,t){for(var r=0;r0&&this._lastRejectedStreams.forEach(function(e,t){8===t.reason?u.push(e.id):(4===t.reason||5===t.reason)&&(l=!0)}),u.length>0)?new n.CopyProtectionError("Restricted streams '".concat(u.join(","),"'"),new a.NoUsableKeysError(t,r),r):void 0!==this.buffer.drm&&void 0===i.ArrayUtil.find(this.buffer.drm.supportedMediaKeys,function(e){return"org.w3.clearkey"!==e.keySystem})?new o.NoKeySystemAvailableError(t,r):l?new s.UnsupportedKeySystemError(this._system.isSecureContext(),t,r):t},e.prototype.getContextualInfo=function(e){if(void 0===this.buffer.drm)return"Digital Rights Management object not available.";var t="";void 0!==this._lastRejectedStreams&&this._lastRejectedStreams.getCount()>0&&(t+="Rejected Data:\n"+this.buffer.drm.aggregateRejectedData(this._lastRejectedStreams).map(function(e){return" ".concat(e)}).join("\n")),t.length>0&&(t+="\n");var r=this.buffer.drm.getChosenMediaKeyOptions();void 0===r?t+="No chosen media key options.":t+="Chosen Media Key Options: ".concat(this.buffer.drm.getMediaKeyOptionString(r)),t+="\n";var n=this.buffer.drm.getStatusMap();if(0===n.getCount())t+="No key status information available.";else{for(var i="Available Key Statuses:",o=0,a=n.values();o=0&&this._waitingEventTimes.length>this._options.waitingCountThreshold&&(this._system.logWarn("Filtering '".concat(e,"' due to ").concat(this._waitingEventTimes.length," waiting events in ").concat(this._options.waitingTimeThreshold,"s")),this._streamsToFilter.add(e),this._buffer.invalidateAllVariants([this.id])))}},e.prototype.getDrainData=function(){var e,t=new d;return(e=t.streamsToFilter).push.apply(e,this._streamsToFilter.values()),t},e.prototype.setDrainData=function(e){var t=this;if(e instanceof d)e.streamsToFilter.forEach(function(e){return t._streamsToFilter.add(e)});else throw Error("Wrong drain data passed for SmoothnessTrackerVariantFilter")},e.prototype.filterVariants=function(e){if(0===this._streamsToFilter.size)return e;for(var t=[],r=0,n=e.video;r0?t:e.video,audio:e.audio,text:e.text}},e.prototype.destroy=function(){this._buffer.onBufferLevelChanged.off(this),this._buffer.onBufferCapacityChanged.off(this),this._buffer.metricBus.variantChange.off(this),this._buffer.metricBus.playbackStateChange.off(this),this._streamsToFilter.clear(),this._waitingEventTimes=[],this._timer.stop(),this._bufferCapacitySec=0,this._bufferLevelSec=0,this._currentTrackedStalls=0,this._stallsTotalTimeMS=0,this._currentTrackedStream=void 0,this._lastStallTime=void 0},e.prototype._clearOutOfWindowWaitingEvents=function(){for(var e,t=0,r=null!==(e=this._options.waitingTimeThreshold)&&void 0!==e?e:0,n=this._getCurrentTime()-1e3*r,i=0,o=this._waitingEventTimes;i=n);i++)t++;t>0&&this._waitingEventTimes.splice(0,t)},e.prototype._getCurrentTime=function(){return Date.now()},e.prototype._handlePlayerStateChange=function(e){var t=this;!(0===this._bufferLevelSec||0===this._bufferCapacitySec||void 0===this._currentTrackedStream||this._streamsToFilter.has(s.PlayerUtil.getVideoStreamUniqueId(this._currentTrackedStream)))&&("STALLED"===e.playbackState&&"VIDEO_NOT_PROGRESSING"===e.stallReason?this._isBufferLevelSufficient()&&(this._timer.isStopped()&&u.PromiseUtil.catchRejection(function(){return t._timer.tickAfter(t._options.totalTimeThreshold)},function(e){t.onError.emit(c.WrappedError.wrap(e))}),this._lastStallTime=this._getCurrentTime(),this._currentTrackedStalls++):this._updateTotalStallTime(),this._excludeTrackedStreamIfNotSmooth()&&this._resetTrackingData())},e.prototype._smoothnessTimerHandler=function(){this._updateTotalStallTime(),this._excludeTrackedStreamIfNotSmooth(),this._resetTrackingData()},e.prototype._excludeTrackedStreamIfNotSmooth=function(){var e=this._options.totalTimeThreshold,t=(e-this._currentTrackedStalls)/e,r=(e-this._stallsTotalTimeMS/1e3)/e;return(t<=this._options.smoothnessScoreThreshold||r<=this._options.smoothnessTimeThreshold)&&void 0!==this._currentTrackedStream&&(this._streamsToFilter.add(s.PlayerUtil.getVideoStreamUniqueId(this._currentTrackedStream)),this._buffer.invalidateAllVariants([this.id]),!0)},e.prototype._updateTotalStallTime=function(){void 0!==this._lastStallTime&&(this._stallsTotalTimeMS+=this._getCurrentTime()-this._lastStallTime,this._lastStallTime=void 0)},e.prototype._resetTrackingDataIfBufferNotSufficient=function(){this._isBufferLevelSufficient()||this._resetTrackingData()},e.prototype._isBufferLevelSufficient=function(){return this._bufferLevelSec>0&&this._bufferCapacitySec>0&&this._bufferLevelSec/this._bufferCapacitySec>=this._options.bufferCompletenessThreshold},e.prototype._resetTrackingData=function(){this._timer.stop(),this._currentTrackedStalls=0,this._stallsTotalTimeMS=0,this._waitingEventTimes=[],this._lastStallTime=void 0},e.DEFAULT_TOTAL_TIME_THRESHOLD=60,e.DEFAULT_BUFFER_COMPLETENESS_THRESHOLD=.8,e.DEFAULT_SMOOTHNESS_SCORE_THRESHOLD=.94,e.DEFAULT_SMOOTHNESS_TIME_THRESHOLD=.83,e.DEFAULT_WAITING_TIME_THRESHOLD=60,e.DEFAULT_WAITING_COUNT_THRESHOLD=5,e}();t.SmoothnessTrackerVariantFilter=p},93158:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SupportedVariantFilter=void 0;var n=r(21997),i=r(96798),o=r(73981),a=r(30617),s=function(){function e(e){this.id="Supported Variant Filter",this._system=e}return e.prototype.filterVariants=function(e){var t=this,r=this._system.supportedHdrModes(),n=this._system.canPlayDolbyAtmos(),i=this._system.useSupplementalCodecsOverride();return r instanceof Promise||n instanceof Promise||i instanceof Promise?a.PromiseUtil.waitAll([r,n,i]).then(function(r){var n=r[0],i=r[1],o=r[2];return t._filterVariants(e,n,i,o)}):this._filterVariants(e,r,n,i)},e.prototype._containsAnyNonAtmos=function(e){for(var t=0;t0)return o;if(a.length>0)return a}return this.onWarning.emit(new i.WarningError("Unable to find matches for ".concat(e," preferences, falling back to all streams of this type!"))),t},e.prototype._isMatchingStream=function(e,t,r){var n,i,a=void 0!==t;if(void 0!==t){var s=null!==(n=e.language)&&void 0!==n?n:r;if(void 0!==s&&s.length>0&&a&&(a=o.StringUtil.isEqualCaseInsensitive(t.language,s)),void 0!==e.label&&e.label.length>0&&a&&(a=t.label===e.label),void 0!==e.supplementalProperties)for(var u=0,l=e.supplementalProperties;u0?this._videoElementSize.width:Number.MAX_VALUE),height:Math.min(u,void 0!==this._videoElementSize&&this._videoElementSize.height>0?this._videoElementSize.height:Number.MAX_VALUE)},c=[],d=[],p=0,f=e.video;p0?d:c,audio:e.audio,text:e.text}},e.prototype._filterVariantsByMinSize=function(e){if(void 0===this._minSize||0===this._minSize.width&&0===this._minSize.height)return e;for(var t,r,n=[],i=[],o=0,a=e.video;o=this._minSize.width&&s.height>=this._minSize.height&&i.push(s),0===i.length&&!0===this._fallbackToNearest&&(void 0===t||void 0===r||s.width>t||s.height>r?(t=s.width,r=s.height,n=[s]):s.width===t&&s.height===r&&n.push(s)))}return{video:i.length>0?i:n,audio:e.audio,text:e.text}},e}();t.VideoSizeVariantFilter=i},86876:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentPayloadCache=void 0;var n=r(91261),i=r(58699),o=r(96798),a=r(26528),s=r(93678),u=r(30617),l=r(37289),c=r(86397),d=r(93218),p=function(){function e(t,r,n){var s=this;this._segmentWorkQueue=[],this._segments=new o.HashMap,this._system=t,this._network=new a.NetworkUtil(t),this._requestType=r,this._cmcd=n,this._asyncWorker=new i.AsyncWorker(this._system,{getNextWorkItem:function(){return s._getNextWorkItem()},handleWorkItem:function(e){return s._handleWorkItem(e)},hasWorkItem:function(){return s._segmentWorkQueue.length>0}}),this._asyncWorker.onError.on(this,function(e){void 0!==e.item&&(s._segments.delete(e.item.segment.id),e.item.responseRejecter(e.error))}),this._asyncWorker.concurrentLimit=e.CONCURRENT_DOWNLOAD_LIMIT}return e.prototype.destroy=function(){var e=this;this._segmentWorkQueue=[],this._asyncWorker.onError.off(this),this._segments.forEach(function(t,r){return e.delete(r.segment)}),this._asyncWorker.destroy()},e.prototype.removeCached=function(e){if(this._segments.contains(e.id)){var t=this._segments.get(e.id);if(void 0!==t.resolvedReference)return this._segments.delete(e.id),t}},e.prototype.fillCached=function(e){this._segments.set(e.segment.id,e)},e.prototype.delete=function(e){this._segments.contains(e.id)&&(this._segments.get(e.id).cancel(),this._segments.get(e.id).delete(),this._segments.delete(e.id)),this._segmentWorkQueue=this._segmentWorkQueue.filter(function(t){return t.segment.id!==e.id})},e.prototype.cancel=function(e){this._segments.contains(e.id)&&this._segments.get(e.id).cancel()},e.prototype.getCached=function(e){var t=this._segments.tryGet(e.id);return null==t?void 0:t.resolvedReference},e.prototype.setCached=function(e,t){this._segments.set(e.id,{segment:e,responsePromise:Promise.resolve(t),cancel:function(){},delete:function(){},responseRejecter:function(){},responseResolver:function(){}})},e.prototype.ensure=function(e,t,r,i){return n.__awaiter(this,void 0,void 0,function(){var o,a,s,u,l,c,d;return n.__generator(this,function(n){return this._segments.contains(e.id)||(void 0!==(o=e).data?this._setCachedInit(o,o.data):(a=function(){},s=function(){},u=function(){},l=function(){},c=new Promise(function(e,t){a=e,s=t}),d={segment:e,context:t,timeoutMS:null!=r?r:0,progressTimeoutMS:null!=i?i:0,cancel:u,delete:l,responseRejecter:s,responseResolver:a,responsePromise:c},this._segmentWorkQueue.push(d),this._segments.set(e.id,d),this._asyncWorker.flush())),[2,this._segments.get(e.id).responsePromise]})})},e.prototype._setCachedInit=function(e,t){var r=this,i="".concat(e.createUri,"-").concat(e.startByte,"-").concat(e.endByte),o=this._system.setPayloadReferenceData(i,t);this._segments.set(e.id,{segment:e,responsePromise:Promise.resolve(o),cancel:function(){},delete:function(){u.PromiseUtil.catchRejection(function(){return n.__awaiter(r,void 0,void 0,function(){return n.__generator(this,function(e){switch(e.label){case 0:return[4,o];case 1:return[4,e.sent().deleteFromMemory()];case 2:return e.sent(),[2]}})})},function(){r._system.logError("Failed to delete a cached init payload reference with id ".concat(i))})},responseRejecter:function(){},responseResolver:function(){}})},e.prototype._getNextWorkItem=function(){return this._segmentWorkQueue.shift()},e.prototype._handleWorkItem=function(e){return n.__awaiter(this,void 0,void 0,function(){var t,r,i,o,a,p=this;return n.__generator(this,function(f){switch(f.label){case 0:(t=c.SegmentUtil.getSegmentRequest(e.segment,this._requestType,e.context)).timeoutMS=e.timeoutMS,t.progressTimeoutMS=e.progressTimeoutMS,t.cmcd=this._cmcd,r=this._network.makeNetworkClient(t),e.cancel=function(){return r.cancel()},e.delete=function(){if((null==i?void 0:i.data)!==void 0){var e=i.data;u.PromiseUtil.catchRejection(function(){return n.__awaiter(p,void 0,void 0,function(){return n.__generator(this,function(t){switch(t.label){case 0:return[4,e.deleteFromMemory()];case 1:return t.sent(),[2]}})})},function(){p._system.logError("Failed to delete a payload reference with id ".concat(e.info.id))})}},f.label=1;case 1:return f.trys.push([1,3,,4]),[4,r.payloadReference()];case 2:return i=f.sent(),[3,4];case 3:if(o=f.sent(),e.delete(),o instanceof d.WrappedError&&d.WrappedError.causedBy(o,s.OperationCanceledError.NAME))throw o;throw a=this._network.requestTypeToStreamType(this._requestType),new l.SegmentDownloadFailedError("Failed to download segment",d.WrappedError.wrap(o),a);case 4:return e.resolvedReference=i.data,e.responseResolver(i.data),[2]}})})},e.CONCURRENT_DOWNLOAD_LIMIT=3,e}();t.SegmentPayloadCache=p},61113:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentSourceBuffer=void 0;var n=r(91261),i=r(2347),o=r(20217),a=function(){function e(e,t){this.onTextChange=new o.Emitter,this.onWarning=new o.Emitter,this.onBufferedRangesRemoved=new o.Emitter,this._sourceBuffer=t}return e.prototype.getSourceBuffer=function(){return this._sourceBuffer},e.prototype.attachEmbeddedCaptions=function(){var e=this;this._embeddedCaptionSourceBuffer=new i.EmbeddedCaptionSourceBuffer,this._sourceBuffer.onEmbeddedCaptionsExtracted.on(this,function(t){var r;return null===(r=e._embeddedCaptionSourceBuffer)||void 0===r?void 0:r.append(t)}),this._embeddedCaptionSourceBuffer.onTextChange.on(this,function(t){return e.onTextChange.emit(t)}),this._embeddedCaptionSourceBuffer.onWarning.on(this,function(t){return e.onWarning.emit(t)})},e.prototype.detachEmbeddedCaptions=function(){var e,t;this._sourceBuffer.onEmbeddedCaptionsExtracted.off(this),null===(e=this._embeddedCaptionSourceBuffer)||void 0===e||e.onTextChange.off(this),null===(t=this._embeddedCaptionSourceBuffer)||void 0===t||t.onWarning.off(this)},e.prototype.attachSourceBufferEvents=function(){var e=this;this._sourceBuffer.onBufferedRangesRemoved.on(this,function(t){return e.onBufferedRangesRemoved.emit(t)})},e.prototype.detachSourceBufferEvents=function(){this._sourceBuffer.onBufferedRangesRemoved.off(this)},e.prototype.append=function(e,t,r){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(n){switch(n.label){case 0:if(!(void 0!==r&&(void 0===this._lastInit||this._lastInit.initData!==r||this._lastInit.keyId!==e.keyId)))return[3,2];return this._lastInit={initData:r,keyId:e.keyId},[4,this._sourceBuffer.appendBuffer(r,e,!0)];case 1:n.sent(),n.label=2;case 2:if(!(void 0!==t))return[3,4];return[4,this._sourceBuffer.appendBuffer(t,e,!1)];case 3:n.sent(),n.label=4;case 4:return[2]}})})},e.prototype.remove=function(e){var t;return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(r){switch(r.label){case 0:return[4,this._sourceBuffer.remove(e.start,e.end)];case 1:return r.sent(),null===(t=this._embeddedCaptionSourceBuffer)||void 0===t||t.remove(e),[2]}})})},e.prototype.removeAll=function(){var e;return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(t){switch(t.label){case 0:return[4,this._sourceBuffer.removeAll()];case 1:return t.sent(),null===(e=this._embeddedCaptionSourceBuffer)||void 0===e||e.remove({start:0,end:1/0}),[2]}})})},e}();t.SegmentSourceBuffer=a},22553:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentPipeline=void 0;var n=r(91261),i=r(20217),o=r(86876),a=r(61941),s=r(65070),u=r(11202),l=r(57999),c=function(){function e(e,t,r,n){this.onPipelinePhaseChanged=new i.Emitter,this.onError=new i.Emitter,this.onWarning=new i.Emitter,this.type=t,this._system=e,this._bufferSource=r,this._payloadCache=new o.SegmentPayloadCache(this._system,this._getNetworkTypeFromStreamType(t),n),this._worker=this._makeWorker()}return Object.defineProperty(e.prototype,"active",{get:function(){return this._worker.active},enumerable:!1,configurable:!0}),e.cleanDrained=function(e){e.forEach(function(e){e.segmentData.delete(),e.state.getSourceBuffer=function(){}})},e.prototype.destroy=function(){this._worker.destroy(),this._payloadCache.destroy(),this.onError.off(),this.onWarning.off(),this.onPipelinePhaseChanged.off()},e.prototype.attach=function(){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(e){switch(e.label){case 0:return[4,this._tryCreateSourceBuffer()];case 1:return e.sent(),[2]}})})},e.prototype.detach=function(){this._worker.detach(),void 0!==this._segmentSourceBuffer&&(this._bufferSource.removeSource(this._segmentSourceBuffer),this._segmentSourceBuffer=void 0)},e.prototype.getPayloadCache=function(){return this._payloadCache},e.prototype.setSourceType=function(e){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(t){switch(t.label){case 0:return this._sourceType=e,[4,this._tryCreateSourceBuffer()];case 1:return t.sent(),[2]}})})},e.prototype.getSourceType=function(){return this._sourceType},e.prototype.setStoragePath=function(e){this._worker.storagePath=e},e.prototype.flush=function(){this._worker.flush()},e.prototype.add=function(e,t,r){var n,i,o,s,u=this;void 0===t&&(t={}),void 0===r&&(r={});var c={kind:"segment",segment:e,processing:!1,allowAppend:null===(n=r.allowAppend)||void 0===n||n,allowDownload:null===(i=r.allowDownload)||void 0===i||i,order:void 0===r.order||0===r.order?0:r.order,phases:new a.SegmentPipelinePhases,initOnly:r.initOnly,start:e.start,end:e.end,downloadStartTimesMS:[],appendStartTimesMS:[],segmentTimeoutMS:null!==(o=r.timeoutMS)&&void 0!==o?o:0,segmentProgressTimeoutMS:null!==(s=r.progressTimeoutMS)&&void 0!==s?s:0,context:t,getSourceBuffer:function(){return u._segmentSourceBuffer}},d=l.TimeRangeUtil.DEFAULT_INTERSECT_PERCENT;return this.active.hasIntersect(c,d)||this.active.add(c),this._worker.flush(),c},e.prototype.removeAll=function(){return this._worker.clear()},e.prototype.remove=function(e){return this._worker.clear(e)},e.prototype.clearAsync=function(){var e=this;return this._worker.clearAll(function(){return e._segmentSourceBuffer})},e.prototype.drainDownloaded=function(){for(var e=[],t=this.active.getAllRanges(),r=0;r1?n.onWarning.emit(new p.WarningError("Ignoring QuotaExceededError until further removes",e.item.error)):n._emitIfNotCleared(n.onError,e.item)):null===(r=e.item)||void 0===r||r.rejecter(e.error)})}return e.prototype.clear=function(e){for(var t=void 0===e?this.active.clear():this.active.removeItem(e),r=0;re.start||!u.SegmentPipelineWorkerUtil.hasPhase(t,"AppendQueued")}),o=Date.now(),e.phases.add({phaseName:"RemoveQueued",start:o,end:o}),this._emitIfNotCleared(this.onPipelinePhaseChanged,e),[4,r.remove({start:i?0:e.segment.start,end:e.segment.end})];case 2:n.sent(),a=Date.now(),e.phases.add({phaseName:"RemoveCompleted",start:o,end:a}),n.label=3;case 3:return this._removes.delete(e)||this.onWarning.emit(new p.WarningError("Removing item that was not found in collection, time range ".concat(e.start,"-").concat(e.end))),e.getSourceBuffer=function(){},this._clearQuotaExceededStates(),[2]}})})},e.prototype._handleClear=function(e){return n.__awaiter(this,void 0,void 0,function(){var t,r,i,o,a,s,c,d=this;return n.__generator(this,function(n){switch(n.label){case 0:if(void 0===(t=e.getSourceBuffer()))return[2];for(this.clear(),r=Date.now(),i=new l.Set,o=0,a=this._removes.values();o/g).map(function(e){return t._nodeUtil.unescapeString(t._nodeUtil.stripTags(e)).split("\n").reduce(function(e,t){return(t=t.trim(),e.length>0&&t.length>0)?"".concat(e," ").concat(t):e.length>0?e:t},"")})},e.prototype._emitWarning=function(e){this.onWarning.emit(new a.WarningError("[Mp4TtmlParser] ".concat(e)))},e}();t.Mp4TtmlParser=c},84233:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Mp4VttParser=void 0;var n=r(91261),i=r(59133),o=r(42995),a=r(47392),s=r(1732),u=r(20217),l=r(8339),c=r(96798),d=r(40341),p=r(86046),f=r(31684),h=r(63328),m=r(16702),v=r(84551),g=r(71325),y=r(91037),_=function(e){function t(t){var r=e.call(this)||this;r._defaultSampleDuration=0,r.onWarning=new u.Emitter;var n=new p.Mp4Parser;n.setParsers(new c.HashMap([["moov",i.ContainerParser.getBasicBoxParser()],["trak",i.ContainerParser.getBasicBoxParser()],["mdia",i.ContainerParser.getBasicBoxParser()],["mdhd",d.MediaHeaderBoxParser.getParser()],["minf",i.ContainerParser.getBasicBoxParser()],["stbl",i.ContainerParser.getBasicBoxParser()],["wvtt",i.ContainerParser.getBasicBoxParser()],["stsd",i.ContainerParser.getFullEntriesBoxParser()]]));var o=n.parse(new Uint8Array(t)),a=new f.Mp4Walker(o),s=a.jumpTo("mdhd",!0),h=a.jumpTo("wvtt",!0);if(void 0!==s)r._timescale=s.timescale;else throw new l.InvalidOperationError("Missing timescale for VTT content. It should be located in the MDHD",void 0,"text");if(void 0===h)throw new l.InvalidOperationError("Init segment should have WVTT box, a valid vtt init segment with no actual subtitles",void 0,"text");return r}return n.__extends(t,e),t.prototype.parseMediaSegment=function(e){var t,r,n,o=[],a=new p.Mp4Parser;a.setParsers(new c.HashMap([["moof",i.ContainerParser.getBasicBoxParser()],["traf",i.ContainerParser.getBasicBoxParser()],["tfdt",h.TrackFragmentDecodeTimeBoxParser.getParser()],["tfhd",m.TrackFragmentHeaderBoxParser.getParser()],["trun",v.TrackRunBoxParser.getParser()]]));var u=a.parse(new Uint8Array(e)),l=new f.Mp4Walker(u),d=l.jumpTo("tfdt",!0),g=l.jumpTo("tfhd",!0),y=l.jumpTo("trun",!0),_=l.jumpTo("mdat",!0),b=null!==(t=null==y?void 0:y.samples)&&void 0!==t?t:[],S=null!==(r=null==g?void 0:g.defaultSampleDuration)&&void 0!==r?r:this._defaultSampleDuration,w=null==d?void 0:d.baseDecodeTime;if(void 0===w||void 0===_)return[];for(var E=new DataView(e,_.rangeContentBody.start,_.rangeContentBody.length),x=new s.DataViewReader(E,!1),T=w,P=0;P8&&(O=x.readBytes(A-8)):("vtte"===R||this.emitWarning_("Skipping unknown box ".concat(R)),x.skip(A-8)),void 0!==O){var I=this.parseVTTC_(O,k/this._timescale,T/this._timescale);I.length>0&&(o=o.concat(I))}}while(void 0!==C.size&&D0?this._tryParsePosition(h.settings):{textAlignment:"center",positionAlignment:"center"};i.push({start:t,end:r,text:m.split("\n").map(function(e){return n._sanitizeText(e)}),position:v})}return i},t.prototype.emitWarning_=function(e){this.onWarning.emit(new y.WarningError("[Mp4VttParser] ".concat(e)))},t}(g.VttParserBase);t.Mp4VttParser=_},35838:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TextSourceBuffer=void 0;var n=r(91261),i=r(20217),o=r(18354),a=r(84233),s=r(95480),u=r(41145),l=r(57999),c=r(15883),d=r(91037),p=r(54512),f=function(){function e(e,t){this._lastSet=0,this._text=new s.SortedIntervalCollection,this.onTextChange=new i.Emitter,this.onWarning=new i.Emitter,this.onBufferedRangesRemoved=new i.Emitter,this._system=e,this._codec=t}return e.prototype.append=function(e,t,r){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(n){switch(n.label){case 0:return[4,this._parseAndAppendTextData(e,t,r)];case 1:return n.sent(),[2]}})})},e.prototype.remove=function(e){this._removeTextData(e)},e.prototype.removeAll=function(){this._removeTextData({start:0,end:1/0})},e.prototype._removeTextData=function(e){var t=this._text.length;this._text.removeIf(function(t){return l.TimeRangeUtil.hasOverlap(e,t)}),this._text.length!==t&&this.onTextChange.emit({source:"VTT",text:this._text,id:this._lastSet++})},e.prototype._parseAndAppendTextData=function(e,t,r){return n.__awaiter(this,void 0,void 0,function(){var i,o,a,s,u,l;return n.__generator(this,function(c){switch(c.label){case 0:if(!(void 0!==t))return[3,2];return[4,this._getTextCues(e,t,r)];case 1:if((i=c.sent()).length>0){for(a=0,o=0===this._text.length,s=i;a1)switch(r[1].trim()){case e.VTT_POS_ALIGN_LEFT:return"left";case e.VTT_POS_ALIGN_CENTER:return"center";case e.VTT_POS_ALIGN_RIGHT:return"right"}},e.prototype._parseAlignment=function(e){switch(e){case"left":return"left";case"center":default:return"center";case"right":return"right";case"start":return"start";case"end":return"end"}},e.prototype._parsePercentValue=function(e){var t,r=parseFloat(e);return isFinite(r)&&(t=Math.max(0,Math.min(1,r/100))),t},e.prototype._sanitizeText=function(e){for(var t=e.indexOf("<");t>=0;){var r=e.indexOf(">",t);if(-1===r)break;t=(e=e.substring(0,t)+e.substring(r+1)).indexOf("<")}return(e=e.replace(/&(lt|gt|nbsp|amp);/g,function(e,t){return"lt"===t?"<":"gt"===t?">":"nbsp"===t?" ":"&"})).trim()},e.VTT_LINE="line",e.VTT_POS="position",e.VTT_SIZE="size",e.VTT_ALIGN="align",e.VTT_POS_ALIGN_LEFT="line-left",e.VTT_POS_ALIGN_CENTER="center",e.VTT_POS_ALIGN_RIGHT="line-right",e}();t.VttParserBase=r},54512:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebVttParser=void 0;var n=r(91261),i=r(41145),o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.__extends(t,e),t.prototype.parse=function(e){var t=this,r=[];if(i.StringUtil.startsWith("WEBVTT",e))for(var n=this._skipPastNext(e,"\n\n"),o=-1;-1!==n&&n!==o;){if(o=n,i.StringUtil.startsWith("NOTE",e,n)||i.StringUtil.startsWith("STYLE",e,n)){n=this._skipPastNext(e,"\n\n",n);continue}var a=e.indexOf("\n",n);if(-1===a)break;var s=e.substring(n,a).split("-->");if(2!==s.length){n=a+1;continue}var u=s[0].trim(),l=s[1].trim().split(" "),c=l[0],d=this._tryParsePosition(l),p=a+1,f=e.indexOf("\n\n",a);n=-1===f?f=e.length:f+2,r.push({text:e.substring(p,f).split("\n").map(function(e){return t._sanitizeText(e)}),start:this._parseTimeToSeconds(u),end:this._parseTimeToSeconds(c),position:d})}return r},t.prototype._skipPastNext=function(e,t,r){var n=e.indexOf(t,r);return n<0?n:n+t.length},t.prototype._parseTimeToSeconds=function(e){var t,r,n,i=e.split(":"),o=0;return 3===i.length&&(o+=3600*parseInt(null!==(t=i.shift())&&void 0!==t?t:"0")),Math.round(1e3*(o+=60*parseInt(null!==(r=i.shift())&&void 0!==r?r:"0")+parseFloat(null!==(n=i.shift())&&void 0!==n?n:"0")))/1e3},t}(r(71325).VttParserBase);t.WebVttParser=o},98267:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TimeRangeList=void 0;var n=r(57999),i=function(){function e(){this._normalizedRanges=[]}return e.prototype.getAllRanges=function(){return this._normalizedRanges},e.prototype.count=function(){return this._normalizedRanges.length},e.prototype.first=function(){return this._normalizedRanges[0]},e.prototype.last=function(){return this._normalizedRanges[this._normalizedRanges.length-1]},e.prototype.clear=function(){var e=this._normalizedRanges.slice();return this._normalizedRanges=[],e},e.prototype.hasIntersect=function(e,t){for(var r=this.getInside([e]),i=0;ir},e.getSortCompare=function(e,t){return this.isTimeClose(e.start,t.start)?this.isTimeClose(e.end,t.end)?0:e.end-t.end:e.start-t.start},e.hasOverlap=function(e,t){if(this.isRangeEqual(e,t))return!0;if(e.start===e.end)return this.contains([t],e.start);if(t.start===t.end)return this.contains([e],t.start);if(this.isTimeClose(e.start,e.end)||this.isTimeClose(t.start,t.end))return e.startt.start;var r=Math.min(Math.abs(e.start-t.start),Math.abs(e.end-t.end));return!(r>Math.abs(e.end-t.start)&&this.isTimeClose(e.end,t.start)||r>Math.abs(t.end-e.start)&&this.isTimeClose(t.end,e.start))&&e.end>t.start&&t.end>e.start},e.isTimeClose=function(e,t){return Math.abs(e-t)t.end)&&!(t.start>e.end))return{start:Math.max(e.start,t.start),end:Math.min(e.end,t.end)}},e.sort=function(e){var t=this,r=e.slice();return r.sort(function(r,n){var i=t.getSortCompare(r,n);return 0===i?e.indexOf(r)-e.indexOf(n):i}),r},e.contains=function(e,t){if("number"==typeof t){for(var r=0;r=n.start&&t0},e.getInsideOf=function(e,t){return this._getMatchingRanges(e,t,!0)},e.getOutsideOf=function(e,t){return this._getMatchingRanges(e,t,!1)},e.getInsideOutsideOf=function(e,t){for(var r=[],n=[],i=0;io.end&&!a;void 0===o||s?r.push({start:i.start,end:i.end}):o.end=Math.max(i.end,o.end)}return r},e.sum=function(){for(var e=[],t=0;te.start&&t.starte.start?t.end=0;n--)if(!r(e[n],t[n]))return!1;return!0},e.find=function(e,t){var r=e.find;if(void 0!==r)return r.call(e,t);for(var n=0,i=e.length;ne||o>a)throw Error("invalid bounds passed to binarySearch");for(;o>>1,u=n(r,t(s));if(u<0)a=s;else if(u>0)o=s+1;else switch(i){case"none":return s;case"lower_bound":var l=this.binarySearch(e,t,r,n,i,o,s);return l<0?s:l;case"upper_bound":var l=this.binarySearch(e,t,r,n,i,s+1,a);return l<0?s+1:l}}return-(o+1)},e}();t.ArrayUtil=r},48105:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BitStreamReader=void 0;var n=r(8339),i=function(){function e(){this._bits=[]}return e.prototype.addBytes=function(e){for(var t=0;ti&&o>r},e._groupChunks=function(e){if(0===e.chunks.length)return[];var t=[];t.push([e.chunks[0]]);for(var r=1;r2097151)throw new n.InvalidOperationError("Integer overflow reading Uint64 with low '".concat(e,"' and high '").concat(t,"'"));return this._position+=8,4294967296*t+e},e.prototype.readInt64=function(){var e,t;try{this._littleEndian?(e=this._dataView.getUint32(this._position,!0),t=this._dataView.getInt32(this._position+4,!0)):(t=this._dataView.getInt32(this._position,!1),e=this._dataView.getUint32(this._position+4,!1))}catch(e){throw new n.InvalidOperationError("Failed to parse Uint64 at position '".concat(this._position,"'"))}if(t>2097151)throw new n.InvalidOperationError("Integer overflow reading Uint64 with low '".concat(e,"' and high '").concat(t,"'"));return this._position+=8,4294967296*t+e},e.prototype.readFixed8x8=function(){try{return this.readUInt16()/256}catch(e){throw new n.InvalidOperationError("Unable to read 8x8 fixed point value at '".concat(this._position,"'"))}},e.prototype.readFixed16x16=function(){try{return this.readUInt32()/65536}catch(e){throw new n.InvalidOperationError("Unable to read 16x16 fixed point value at '".concat(this._position,"'"))}},e.prototype.readFixed2x30=function(){try{return this.readUInt32()/1073741824}catch(e){throw new n.InvalidOperationError("Unable to read 2x30 fixed point value at '".concat(this._position,"'"))}},e.prototype.checkRemaining=function(e){if(this._position+e>this._dataView.byteLength)throw new n.InvalidOperationError("Cannot read at position '".concat(this._position+e,"' with length '").concat(this._dataView.byteLength,"'"))},e.prototype.readBytes=function(e){this.checkRemaining(e);var t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._position,e);return this._position+=e,new Uint8Array(t)},e.prototype.skip=function(e){this.checkRemaining(e),this._position+=e},e.prototype.rewind=function(e){if(this._positionthis._dataView.byteLength)throw new n.InvalidOperationError("Index is out of bounds, position '".concat(e,"' with length '").concat(this._dataView.byteLength,"'"));this._position=e},e.prototype.readTerminatedString=function(){for(var e=this._position;this.hasMoreData()&&0!==this._dataView.getUint8(this._position);)this._position+=1;var t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+e,this._position-e);return this._position+=1,i.StringUtil.fromUTF8(t)},e.prototype.readString=function(e){this.checkRemaining(e);for(var t="",r=e;r>0;r--)t+=String.fromCharCode(this._dataView.getUint8(this._position++));return t},e}();t.DataViewReader=o},3904:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DateUtil=void 0;var r=function(){function e(){}return e.parseDate=function(e){/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e)&&(e+="Z");var t=Date.parse(e);return isNaN(t)?void 0:t/1e3},e}();t.DateUtil=r},18035:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.lower=void 0,t.lower=function(e){return e.toLowerCase()}},73981:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MimeUtil=void 0;var n=r(41145),i=function(){function e(){}return e.getFullType=function(e,t){var r=e;return t.length>0&&(r+='; codecs="'.concat(t,'"')),r},e.getFullTypeWithSupplementalCodecsOverride=function(e,t,r){return void 0!==r?this.getFullType(e,r):this.getFullType(e,t)},e.getExtendedType=function(e){var t=Array(e.mimeType);return e.codecs.length>0&&t.push('codecs="'+e.codecs+'"'),"audio"===e.type?t.push('dolbyAtmos="'+!!(2&e.attributes)+'"'):"video"===e.type&&(32&e.attributes)!=0&&t.push('videoRange="PQ"'),"video"===e.type&&void 0!==e.supplementalCodecs&&t.push('supplementalCodecs="'+e.supplementalCodecs+'"'),void 0!==e.frameRate&&e.frameRate>0&&t.push('framerate="'+e.frameRate+'"'),void 0!==e.bandwidth&&e.bandwidth>0&&t.push('bitrate="'+e.bandwidth+'"'),void 0!==e.width&&e.width>0&&t.push('width="'+e.width+'"'),void 0!==e.height&&e.height>0&&t.push('height="'+e.height+'"'),void 0!==e.channelsCount&&e.channelsCount>0&&t.push('channels="'+e.channelsCount+'"'),t.join("; ")},e.getCodecBase=function(e){return this._getCodecParts(e)[0]},e.getStreamTypeFromMimeType=function(e){if(n.StringUtil.startsWith("audio",e))return"audio";if(n.StringUtil.startsWith("video",e))return"video";if(n.StringUtil.startsWith("text",e)||"application/mp4"===e)return"text";if(n.StringUtil.startsWith("image",e))return"image";throw Error("Invalid mimeType string. mimeType: "+e)},e._getCodecParts=function(e){var t=e.split("."),r=t[0];return t.pop(),[r,t.join(".")]},e}();t.MimeUtil=i},51106:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkHelpers=void 0;var n=r(91261),i=r(41145),o=function(){function e(){}return e.addLicenseAuthorization=function(e,t){this.setLicenseHeaderValue(e,"Authorization",t)},e.setLicenseHeaderValue=function(e,t,r){var n;void 0!==r&&"license"===e.type&&(e.headers=null!==(n=e.headers)&&void 0!==n?n:{},e.headers[t]=r)},e.parseRangeHeader=function(e){void 0===e&&(e={});var t,r,n=null!==(r=null===(t=e.Range)||void 0===t?void 0:t.match(/^bytes=([0-9]+)-([0-9]+)?$/))&&void 0!==r?r:[],i=n[1],o=n[2];if(void 0!==i){var a={startByte:parseInt(i)};return void 0!==o&&(a.endByte=parseInt(o)),a}},e.isSuccessfulResponseCode=function(e){return e>=200&&e<300},e.mergeWithNetworkRequestBase=function(e,t){switch(e.type){case"video":case"audio":case"text":return n.__assign({type:e.type,segmentContext:e.segmentContext},t);case"manifest":return n.__assign({type:e.type,manifestContext:e.manifestContext},t);case"license":return n.__assign({type:e.type,licenseContext:e.licenseContext},t);case"other":return n.__assign({type:e.type,otherContext:e.otherContext},t)}},e.getResponseText=function(e){if("string"==typeof e)return e;if(e instanceof ArrayBuffer)try{return i.StringUtil.fromUTF8(new Uint8Array(e))}catch(e){}},e}();t.NetworkHelpers=o},26528:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkUtil=void 0;var n=r(91261),i=r(72949),o=r(51106),a=r(92470),s=r(91110),u=r(93678),l=r(60909),c=r(93218),d=function(){function e(e){this._system=e}return e.prototype._getContext=function(e,t){return o.NetworkHelpers.mergeWithNetworkRequestBase(e,{url:e.resource,responseText:o.NetworkHelpers.getResponseText(null==t?void 0:t.data),statusCode:null==t?void 0:t.status})},e.prototype._getPayload=function(e,t,r,i){return n.__awaiter(this,void 0,void 0,function(){var d,p,f,h,m,v,g,y,_,b;return n.__generator(this,function(n){switch(n.label){case 0:p=t.count,f=[],h=[],m=this.requestTypeToStreamType(e.type),n.label=1;case 1:v=Date.now(),n.label=2;case 2:return n.trys.push([2,4,,5]),[4,r()];case 3:if(d=n.sent(),o.NetworkHelpers.isSuccessfulResponseCode(d.status))return[2,d];return f.push(new a.NetworkRequestError("unsuccessful status from server",this._getContext(e,d),void 0,void 0,m)),[3,5];case 4:if((g=n.sent())instanceof c.WrappedError&&(y=c.WrappedError.causedBy(g,u.OperationCanceledError.NAME),_=c.WrappedError.causedBy(g,l.OperationTimedOutError.NAME)||c.WrappedError.causedBy(g,s.NoProgressMadeError.NAME),b=void 0!==m,y||b&&_))throw g;return f.push(c.WrappedError.wrap(g)),[3,5];case 5:if(!(void 0!==d&&void 0!==i))return[3,7];return[4,i(d)];case 6:n.sent(),n.label=7;case 7:if(h.push({start:v,end:Date.now()}),t.count--,!(t.count>=0))return[3,9];return[4,this._system.postTimeout(t.delay/1e3).timeout];case 8:n.sent(),t.delay*=2,n.label=9;case 9:if(t.count>=0)return[3,1];n.label=10;case 10:throw new a.NetworkRequestError("Failed to get response after ".concat(p," retries: ").concat(this._makeResourceIdentifier(e),"\nRequest type: ").concat(e.type),this._getContext(e,d),f,h,m)}})})},e.prototype.makeNetworkClient=function(t){var r,i,o,a=this;(void 0===t.timeoutMS||0===t.timeoutMS)&&(t=n.__assign(n.__assign({},t),{timeoutMS:e.DEFAULT_TIMEOUT_MS})),null===(r=t.cmcd)||void 0===r||r.modifyNetworkRequest(t);var s=this._system.makeNetworkClient(t),u={count:null!==(i=t.retryCount)&&void 0!==i?i:this._getRetryValues(t.type),delay:null!==(o=t.retryDelay)&&void 0!==o?o:e.DEFAULT_RETRY_DELAY};return{cancel:function(){s.cancel()},payloadReference:function(){return a._getPayload(t,u,function(){return s.payloadReference()},function(e){return e.data.deleteFromMemory()})},payloadBuffer:function(){return a._getPayload(t,u,function(){return s.payloadBuffer()})},payloadString:function(){return a._getPayload(t,u,function(){return s.payloadString()})}}},e.prototype.requestTypeToStreamType=function(e){return"audio"===e?"audio":"video"===e?"video":"text"===e?"text":void 0},e.prototype._makeResourceIdentifier=function(t){var r="";if(void 0!==t.headers){for(var n=[],i=0,o=Object.keys(t.headers);i0}},95649:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pairEquals=void 0,t.pairEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]}},86915:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PerformanceUtil=void 0;var n=r(91261),i=function(){function e(){}return e.wrap=function(e,t,r,i,o){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(n){switch(n.label){case 0:return n.trys.push([0,,2,3]),e.mark(t),[4,o()];case 1:return[2,n.sent()];case 2:return e.mark(r),e.measure(i,t,r),[7];case 3:return[2]}})})},e}();t.PerformanceUtil=i},34167:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PlayerUtil=void 0;var n=r(91261),i=r(57497),o=r(96798),a=r(72949),s=r(21997),u=function(){function e(){}return e.isPeriodEncrypted=function(e){for(var t=0,r=e.video;t0},e.getPeriodForTime=function(e,t){var r=this.binarySearchForIndex(e.length,function(t){return e[t]},t);if(r>=0)return e[r]},e.getClosestSizeStream=function(e,t,r){for(var n,i,o=0;o0},e.getStream=function(e,t){var r;if("audio"===t)r=e.audioDetails;else if("video"===t)r=e.videoDetails;else if("text"===t)r=e.textDetails;else throw Error("Invalid stream type ".concat(t));return r},e.getStreamMetadata=function(e,t){if("image"===t)throw Error("Invalid stream type ".concat(t));return e[t]},e.getStreams=function(e,t){return"text"===t?e.text:"audio"===t?e.audio:"video"===t?e.video:e.image},e.iteratePeriodStreams=function(e,t){for(var r=0,i=n.__spreadArray(n.__spreadArray(n.__spreadArray(n.__spreadArray([],e.audio,!0),e.video,!0),e.text,!0),e.image,!0);r=0)return e.getSegment(r)},e.getSegmentIndicesInRange=function(e,t){if(0===e.length)throw Error("Could not get segments on empty segment list");var r=this.binarySearchForSegmentIndex(e,t.start);r<0&&(r=-r-1);var n=this.binarySearchForSegmentIndex(e,t.end);if(n<0)n=-n-1;else{var i=e.getTiming(n);(t.start===t.end||t.end!==i.start)&&n++}return{startIndex:r,endIndexExclusive:n}},e.getSegmentForSnapping=function(e,t,r){var n,i,o=this.binarySearchForSegmentIndex(e,t);if(o<0){var a=-o-1;a0&&(n=e.tryGetTiming(a-1))}else{if(e.getTiming(o).start===t)return e.getTiming(o);n=e.getTiming(o),o+1=t.end?1:0})},e.isTrackPreferencesEqual=function(e,t){var r=this;return i.ArrayUtil.areEqual(e,t,function(e,t){return r.isTrackPreferenceEqual(e,t)})},e.isTrackPreferenceEqual=function(e,t){return e.streamType===t.streamType&&e.label===t.label&&e.language===t.language&&e.attributes===t.attributes&&(void 0===e.supplementalProperties&&void 0===t.supplementalProperties||void 0!==e.supplementalProperties&&void 0!==t.supplementalProperties&&i.ArrayUtil.areEqual(e.supplementalProperties,t.supplementalProperties,function(e,t){return e.schemeId===t.schemeId&&e.value===t.value}))},e.groupKeyTypesByCodec=function(e,t){for(var r,n=new o.HashMap,i=0;i=e.periods.length)return!1;s=a+1,r=e.periods[s]}var i,a,s,u=null===(i=t.compatiblePeriods)||void 0===i?void 0:i.tryGet(r.id);if(void 0!==u)return u;var l=this._periodsCompatibleWithoutReload(e.periods,t,r,a,s,n);return void 0===t.compatiblePeriods&&(t.compatiblePeriods=new o.HashMap),t.compatiblePeriods.set(r.id,l),l},e}();t.PlayerUtil=u},86397:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentUtil=void 0;var n=r(91261),i=function(){function e(){}return e.getSegmentRequest=function(e,t,r){var i;return i="start"in e?n.__assign(n.__assign({},r),{type:"media",start:e.start,end:e.end}):n.__assign(n.__assign({},r),{type:"init"}),{resource:e.createUri,method:"GET",headers:this._getRangeHeaders(e),type:t,segmentContext:i}},e._getRangeHeaders=function(e){var t,r,n;return void 0!==e.startByte&&((t={}).Range="bytes=".concat(e.startByte,"-").concat(null!==(r=e.endByte)&&void 0!==r?r:""),n=t),n},e}();t.SegmentUtil=i},16406:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SortedCollection=void 0;var n=r(8339),i=r(57497),o=function(){function e(e,t){void 0===t&&(t=[]),this._compareFn=e,this._items=[];for(var r=0,n=t;r=this.length)throw new n.InvalidOperationError("SortedCollection.at: invalid index ".concat(e," (length=").concat(this.length,")"));return this._items[e]},e.prototype.tryGetAt=function(e){return this._items[e]},e.prototype.getFirst=function(){return this.getAt(0)},e.prototype.tryGetFirst=function(){return this.tryGetAt(0)},e.prototype.getLast=function(){return this.getAt(this.length-1)},e.prototype.tryGetLast=function(){return this.tryGetAt(this.length-1)},e.prototype.forEach=function(e){this._items.forEach(e)},e.prototype.add=function(e,t){var r;return r=void 0!==t&&t>=0&&t<=this.length&&(0===t||this._compareFn(e,this._items[t-1])>=0)&&(t===this.length||this._compareFn(this._items[t],e)>=0)?t:this.upperBound(e),this._items.splice(r,0,e),r},e.prototype.removeAt=function(e,t){if(void 0===t&&(t=1),e<0||t<0||e+t>this.length)throw new n.InvalidOperationError("SortedCollection.removeAt: invalid index or count");this._items.splice(e,t)},e.prototype.removeIf=function(e){this._items=this._items.filter(function(t){return!e(t)})},e.prototype.filter=function(t){var r=new e(this._compareFn);return r._items=this._items.filter(t),r},e.prototype.find=function(e){return i.ArrayUtil.binarySearchArray(this._items,e,this._compareFn,"lower_bound")},e.prototype.lowerBound=function(e){var t=i.ArrayUtil.binarySearchArray(this._items,e,this._compareFn,"lower_bound");return t<0?-t-1:t},e.prototype.upperBound=function(e){var t=i.ArrayUtil.binarySearchArray(this._items,e,this._compareFn,"upper_bound");return t<0?-t-1:t},e}();t.SortedCollection=o},95480:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SortedIntervalCollection=void 0;var n=r(16406),i=function(){function e(e){void 0===e&&(e=[]),this._items=new n.SortedCollection(function(e,t){return e.start-t.start},e),this._maxEnd=Array(e.length),this._updateMaxEnd()}return Object.defineProperty(e.prototype,"length",{get:function(){return this._items.length},enumerable:!1,configurable:!0}),e.prototype.toArray=function(){return this._items.toArray()},e.prototype.getAt=function(e){return this._items.getAt(e)},e.prototype.tryGetAt=function(e){return this._items.tryGetAt(e)},e.prototype.add=function(e,t){var r=this._items.add(e,t);return this._maxEnd.splice(r,0,-1/0),this._updateMaxEnd(r,r),r},e.prototype.removeAt=function(e,t){void 0===t&&(t=1),this._items.removeAt(e,t),this._maxEnd.splice(e,t),this._updateMaxEnd(e,e)},e.prototype.removeIf=function(e){this._items.removeIf(e),this._items.length!==this._maxEnd.length&&(this._maxEnd.splice(this._items.length),this._updateMaxEnd())},e.prototype.find=function(e){for(var t=[],r=this.upperBound(e)-1;r>=0&&e=t&&this._maxEnd[n]===i)break;this._maxEnd[n]=i}},e}();t.SortedIntervalCollection=i},41145:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StringUtil=void 0;var n=r(42463),i=r(71203),o=r(93218),a=r(18035),s=function(){function e(){}return e.slice=function(e,t,r,n){return!0===t?("_"+e.slice(r,n)).substring(1):e.slice(r,n)},e.reverse=function(e){return e.split("").reverse().join("")},e.padStart=function(e,t,r){for(;e.length>18&63]+this.TABLE[n>>12&63]+this.TABLE[n>>6&63]+this.TABLE[63&n];return 2===i?(n=(t=e.charCodeAt(a)<<8)+e.charCodeAt(++a),o+=this.TABLE[n>>10]+this.TABLE[n>>4&63]+this.TABLE[n<<2&63]+"="):void 0!==n&&1===i&&(n=e.charCodeAt(a),o+=this.TABLE[n>>2]+this.TABLE[n<<4&63]+"=="),o},e.fromStandardBase64=function(e){var t,r=(e=e.replace(/[\t\n\f\r ]/g,"")).length;if(r%4==0&&(r=(e=e.replace(/==?$/,"")).length),r%4==1||/[^+a-zA-Z0-9/]/.test(e))throw Error("Invalid character: the string to be decoded is not correctly encoded.");for(var n=0,i=0,o="",a=-1;++a>(-2*n&6)));return o},e.replaceAll=function(e,t,r,n){if(0===t.length)return e;for(var i=e.indexOf(t);-1!==i;){var o=i+t.length,a=e.indexOf(r,o);if(-1===a)break;var s=n(e.substring(o,a));i=(e=[e.substring(0,i),s,e.substring(a+r.length)].join("")).indexOf(t,i+s.length)}return e},e.startsWith=function(e,t,r){if(void 0===r&&(r=0),e.length>t.length-r)return!1;for(var n=0;n>>0).toString(16),8,"0").toUpperCase()},e.TABLE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e}();t.StringUtil=s},56378:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TextParser=void 0;var r=function(){function e(e){this._position=0,this._data=e}return e.prototype.isAtEnd=function(){return this._position===this._data.length},e.prototype.readLine=function(){return this._readRegexReturnCapture(/(.*?)(\n|$)/gm,1)},e.prototype.readWord=function(){return this._readRegexReturnCapture(/[^ \t\n]*/gm,0)},e.prototype.skipWhitespace=function(){this.readRegex(/[ \t]+/gm)},e.prototype.readRegex=function(e){var t=[],r=this._indexOf(e);return this.isAtEnd()||void 0===r||r.position!==this._position||(this._position+=r.length,t=r.results),t},e.prototype._readRegexReturnCapture=function(e,t){var r;return this.isAtEnd()||(r=this.readRegex(e)[t]),r},e.prototype._indexOf=function(e){e.lastIndex=this._position;var t,r=e.exec(this._data);return null!==r&&(t={position:r.index,length:r[0].length,results:r}),t},e}();t.TextParser=r},6724:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.numberKeys=t.stringKeys=void 0,t.stringKeys=function(e){return Object.keys(e)},t.numberKeys=function(e){return Object.keys(e).map(Number)}},74165:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VariantUtil=void 0;var n=r(91261),i=r(26643),o=r(30617),a=r(16406),s=r(14603),u=r(93218),l=function(){function e(){}return e.createSortedVariantListFromStreamCollection=function(e){for(var t,r,n,i=this,o=e.audio.length>0?e.audio:[void 0],u=e.video.length>0?e.video:[void 0],l=e.text.length>0?e.text:[void 0],c=Array(o.length*u.length*l.length),d=0,p=0;p=t.pipelineState.start&&n<=t.pipelineState.end&&n>=this._lastRemovedTime&&n-this._lastRemovedTime<=e.TIME_THRESHOLD_SECONDS&&this.getKey(t.stream)!==this._lastRemovedLanguage?(this._system.logInfo("".concat(a,": seeking to current time to reset buffer from ").concat(t.stream.language," ").concat(this._lastRemovedLanguage)),o.PromiseUtil.catchRejection(function(){return r._inject.setPositionWhenReady(n>=e.SEEK_EPSILON?n-e.SEEK_EPSILON:n+e.SEEK_EPSILON)},function(e){r.onError.emit(i.WrappedError.wrap(e))}),this._lastRemovedLanguage=void 0,this._lastRemovedTime=void 0):Math.abs(n-this._lastRemovedTime)>e.TIME_THRESHOLD_SECONDS&&(this._system.logInfo("".concat(a,": resetting checks")),this._lastRemovedLanguage=void 0,this._lastRemovedTime=void 0))}},e.prototype.onRemoveCompleted=function(e){var t=this._inject.getCurrentTime();if(void 0!==t&&t>=e.pipelineState.start&&t<=e.pipelineState.end){if(void 0!==this._lastRemovedTime)return;this._system.logInfo("".concat(a,": removed the segment being played")),this._lastRemovedLanguage=this.getKey(e.stream),this._lastRemovedTime=t}},e.prototype.start=function(){var e=this;this._bufferItemPhaseChange.off(this),this._lastRemovedLanguage=void 0,this._lastRemovedTime=void 0,this._bufferItemPhaseChange.on(this,function(t){if("audio"===t.stream.type){var r=t.pipelineState.phases.getLastPhaseName();"RemoveCompleted"===r?e.onRemoveCompleted(t):"AppendCompleted"===r&&e.onAppendCompleted(t)}})},e.prototype.stop=function(){this._bufferItemPhaseChange.off(this)},e.TIME_THRESHOLD_SECONDS=10,e.SEEK_EPSILON=.01,e}();t.SeekOnTrackChangeWorkaround=s},86046:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Mp4Parser=void 0;var n=r(91261),i=r(96798),o=r(8339),a=r(1732),s=function(){function e(){this._parsers=new i.HashMap,this._done=!1}return e.prototype.setParsers=function(e){this._parsers=e},e.prototype.isDone=function(){return this._done},e.prototype.stop=function(){this._done=!0},e.prototype.processBasicBoxHeader=function(e){return n.__assign({},e.box)},e.prototype.processFullBoxHeader=function(e){var t=e.contentReader.readUInt32();return e.box.version=t>>>24,e.box.flags=16777215&t,n.__assign({},e.box)},e.prototype.parse=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),r=new a.DataViewReader(t,!1);this._done=!1;for(var n=[],i=r.getPosition();r.hasMoreData()&&!this._done;){n.push(this.parseNext(r,0));var s=r.getPosition();if(i>=s)throw new o.InvalidOperationError("Expected reader position to progress from '".concat(s,"'"))}return n},e.prototype.parseNext=function(e,t){var r=e.getPosition(),n=e.readUInt32(),i=e.readString(4);switch(n){case 0:n=e.getLength()-r;break;case 1:n=e.readUInt64()}var s=e.getPosition(),u=n-(s-r),l=this._parsers.tryGet(i),c={name:i,rangeBox:{start:r+t,length:n},rangeContentHead:{start:s+t,length:0},rangeContentBody:{start:s+t,length:u}};if(void 0!==l){var d=r+n;if(d>e.getLength())throw new o.InvalidOperationError("Invalid reader length, trying to read to '".concat(d,"' with length '").concat(e.getLength(),"'"));var p=d-e.getPosition(),f=p>0?e.readBytes(p):new Uint8Array(0),h=new DataView(f.buffer,f.byteOffset,f.byteLength),m=new a.DataViewReader(h,!1),v={parser:this,contentReader:m,box:c};if(v.box=l.processContentHead(v),m.getPosition()>v.box.rangeContentHead.length){var g=m.getPosition();v.box.rangeContentHead.length+=g,v.box.rangeContentBody.start+=g,v.box.rangeContentBody.length-=g,h=new DataView(f.buffer,f.byteOffset+g),v.contentReader=new a.DataViewReader(h,!1)}v.box=l.processContentBody(v),c=v.box}else{var y=Math.min(r+n-e.getPosition(),e.getLength()-e.getPosition());e.skip(y)}return c},e}();t.Mp4Parser=s},81428:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Mp4Util=void 0;var n=r(91261),i=r(31684),o=r(86046),a=r(59133),s=r(98149),u=r(96798),l=r(8125),c=r(90484),d=r(51051),p=r(57497),f=r(78072),h=r(30437),m=r(57623),v=r(1562),g=r(87756),y=r(70309),_=r(46211),b=r(8526),S=r(78541),w=r(63328),E=r(8339),x=r(93218),T=function(){function e(){}return e.stripX265UserData=function(e){var t=new u.HashMap([["moov",a.ContainerParser.getBasicBoxParser()],["trak",a.ContainerParser.getBasicBoxParser()],["mdia",a.ContainerParser.getBasicBoxParser()],["minf",a.ContainerParser.getBasicBoxParser()],["stbl",a.ContainerParser.getBasicBoxParser()],["stsd",a.ContainerParser.getFullEntriesBoxParser()],["hvc1",c.VisualSampleBoxParser.getParser()],["encv",f.EncryptedVideoBoxParser.getParser()],["hvcC",s.HevcConfigurationBoxParser.getParser()]]),r=new o.Mp4Parser;r.setParsers(t);var l=r.parse(e),h=new i.Mp4Walker(l),m=h.jumpTo("hvcC",!0);if(void 0===m)return e;for(var v=[],g=!1,y=0,_=m.arrayRecords;y<_.length;y++){var b=_[y];if(b.nalType!==d.SeiParser.H265_PREFIX_SEI_NUT){v.push(b);continue}var S=n.__assign(n.__assign({},b),{nalUnits:b.nalUnits.filter(function(e){var t=d.SeiParser.parseVariableLengthField(e,2);if((null==t?void 0:t.value)!==d.SeiParser.H265_PAYLOAD_TYPE_USER_DATA_UNREGISTERED)return!0;var r=d.SeiParser.parseVariableLengthField(e,t.newIndex);return void 0===r||r.value0&&v.push(S)}if(!g)return e;var w=s.HevcConfigurationBoxParser.serializeArrayRecords(v),E=e.subarray(0,m.rangeContentBody.start+s.HevcConfigurationBoxParser.ARRAY_RECORDS_OFFSET),x=e.subarray(m.rangeContentBody.start+m.rangeContentBody.length,e.length),T=new Uint8Array(E.length+w.length+x.length);T.set(E),T.set(w,E.length),T.set(x,E.length+w.length);var P=m.rangeContentBody.length-s.HevcConfigurationBoxParser.ARRAY_RECORDS_OFFSET-w.length,C=new DataView(T.buffer);return t.forEach(function(e){var t=h.jumpTo(e,!0);if(void 0!==t){var r=t.rangeBox.length-P;C.setUint32(t.rangeBox.start,r,!1)}}),T},e.stripDolbyVisionBox=function(e,t,r){var n,s,l=new u.HashMap([["moov",a.ContainerParser.getBasicBoxParser()],["trak",a.ContainerParser.getBasicBoxParser()],["mdia",a.ContainerParser.getBasicBoxParser()],["minf",a.ContainerParser.getBasicBoxParser()],["stbl",a.ContainerParser.getBasicBoxParser()],["stsd",a.ContainerParser.getFullEntriesBoxParser()],["encv",f.EncryptedVideoBoxParser.getParser()],["hvc1",c.VisualSampleBoxParser.getParser()]]),d=new o.Mp4Parser;d.setParsers(l);var p=d.parse(e),h=new i.Mp4Walker(p),m=null!==(n=h.jumpTo("encv",!0))&&void 0!==n?n:h.jumpTo("hvc1",!0);if(void 0===m)return e;var v=0,g=[];if(null===(s=m.children)||void 0===s||s.forEach(function(e){var n=!1;t&&("dvcC"===e.name||"dvvC"===e.name)&&(n=!0),r&&("clli"===e.name||"mdcv"===e.name)&&(n=!0),n&&(g.push(e.rangeBox),v+=e.rangeBox.length)}),0===g.length)return e;for(var y=new Uint8Array(e.length-v),_=0,b=0,S=0;S0?"ec-3-atmos":"ec-3"}if("dac3"===e.name)return"ac-3";if("mp4a"===e.name||"esds"===e.name){var n=t.jumpTo("esds",!0);if(void 0!==n)for(var i=n.descriptor.descriptors,o=0;ot.byteLength&&(u=!0,n.push("ERROR box '".concat(c.name,"' should be from bytes ").concat(c.rangeBox.start,"-").concat(c.rangeBox.start+c.rangeBox.length," but only ").concat(t.byteLength," bytes available"))),s++}u||n.push("SUCCESS (".concat(e,"): parsed '").concat(s,"' boxes"))}}catch(t){n.push("ERROR (".concat(e,"): failed to walk over MP4 top level boxes: ").concat(x.WrappedError.wrap(t).toString()))}return n},e.determineCodec=function(e,t){var r,n,s=new l.Map([[5,g.AudioSpecificConfigParser.getParser()],[4,y.DecoderConfigParser.getParser()],[3,v.ESDescriptorParser.getParser()]]),c=new u.HashMap([["moov",a.ContainerParser.getBasicBoxParser()],["trak",a.ContainerParser.getBasicBoxParser()],["mdia",a.ContainerParser.getBasicBoxParser()],["minf",a.ContainerParser.getBasicBoxParser()],["stbl",a.ContainerParser.getBasicBoxParser()],["stsd",a.ContainerParser.getFullEntriesBoxParser()],["encv",f.EncryptedVideoBoxParser.getParser()],["enca",h.EncryptedAudioBoxParser.getParser()],["dec3",m.EC3SpecificBoxParser.getParser()],["mp4a",b.Mp4aBoxParser.getParser()],["esds",_.ObjectDescriptorBoxParser.getParser(s)]]),d=new o.Mp4Parser;d.setParsers(c);var p=d.parse(t),S=new i.Mp4Walker(p);if(void 0!==S.jumpTo("stsd")){if("video"===e){var w=null!==(r=S.jumpTo("encv",!0))&&void 0!==r?r:S.jumpTo("stsd",!0);if(void 0===w)return;var E=S.step();if(void 0===E)return;return this._determineVideoCodec(w,E)}var w=null!==(n=S.jumpTo("enca",!0))&&void 0!==n?n:S.jumpTo("stsd",!0);if(void 0!==w){var E=S.step();if(void 0!==E)return this._determineAudioCodec(E,S)}}},e.getTimescale=function(e){var t=new u.HashMap([["moov",a.ContainerParser.getBasicBoxParser()],["mvhd",S.MovieHeaderBoxParser.getParser()]]),r=new o.Mp4Parser;r.setParsers(t);var n=r.parse(e),s=new i.Mp4Walker(n).jumpTo("mvhd",!0);return null==s?void 0:s.timescale},e.adjustBaseDecodeTime=function(e,t,r){var n=this.getTimescale(t);if(void 0!==n){var s=new u.HashMap([["moof",a.ContainerParser.getBasicBoxParser()],["traf",a.ContainerParser.getBasicBoxParser()],["tfdt",w.TrackFragmentDecodeTimeBoxParser.getParser()]]),l=new o.Mp4Parser;l.setParsers(s);var c=l.parse(e),d=new i.Mp4Walker(c).jumpTo("tfdt",!0);if(void 0!==d){var p=Math.round(r*n),f=d.baseDecodeTime+p,h=new DataView(e.buffer,e.byteOffset,e.byteLength);if(0===d.version){if(f>4294967295)throw new E.InvalidOperationError("Failed to set v0 tfdt baseDecodeTime to value ".concat(f,", value too large"));h.setUint32(d.rangeContentBody.start,f)}else this._setUint64(h,d.rangeContentBody.start,f);return f}}},e._setUint64=function(e,t,r){e.setUint32(t,Math.floor(r/4294967296)),e.setUint32(t+4,r%4294967296)},e}();t.Mp4Util=T},31684:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Mp4Walker=void 0;var n=r(8339),i=function(){function e(t){this._flatIndex=0,this._allBoxes=t,this._flatBoxes=[];for(var r=e.BOX_MAX_COUNT,i=this._allBoxes.slice();i.length>0;){if(this._flatBoxes.length>r)throw new n.InvalidOperationError("Box count larger than max allowed size of '".concat(r,"'"));var o=i.shift();if(void 0!==o&&(this._flatBoxes.push(o),void 0!==o.children))for(var a=o.children.length-1;a>=0;a--)i.unshift(o.children[a])}}return e.prototype.getCurrent=function(){if(void 0===this._lastBox)throw new n.InvalidOperationError("No boxes have been walked.");return this._lastBox},e.prototype.canStep=function(){return this._flatIndex=o)throw new i.InvalidOperationError("Expected child content reader to progress from '".concat(o,"'"))}return t},e}();t.ContainerParser=o},90484:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VisualSampleBoxParser=void 0;var n=r(91261),i=r(59133),o=r(41145),a=function(){function e(){}return e.getParser=function(){return{processContentHead:function(e){return e.parser.processBasicBoxHeader(e)},processContentBody:function(e){var t=e.contentReader;t.skip(6);var r=t.readUInt16();t.skip(16);var a=t.readUInt16(),s=t.readUInt16(),u=t.readFixed16x16(),l=t.readFixed16x16();t.skip(4);var c=t.readUInt16(),d=t.readUInt8(),p=o.StringUtil.fromUTF8(t.readBytes(d)).trim();d<31&&t.skip(31-d);var f=t.readUInt16();t.skip(2);var h=i.ContainerParser.parse(e);return n.__assign(n.__assign({},e.box),{dataIndex:r,width:a,height:s,horizontalResolution:u,verticalResolution:l,frameCount:c,compressorName:p,depth:f,children:h.children})}}},e}();t.VisualSampleBoxParser=a},57623:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EC3SpecificBoxParser=void 0;var n=r(91261),i=r(59133),o=function(){function e(){}return e.getParser=function(){return{processContentHead:function(e){return e.parser.processBasicBoxHeader(e)},processContentBody:function(e){for(var t,r,o,a=e.contentReader,s=a.readUInt16(),u=7&s,l=[],c=0;c>6,f=d>>1&31,h=1&d,m=(d=a.readUInt8())>>7,v=d>>4&7,g=d>>1&7,y=1&d,_=(d=a.readUInt8())>>5,b=d>>1&15,S=1&d,w=void 0,E=void 0;b>0?w=S<<8|(d=a.readUInt8()):E=S;var x={fscod:p,bsid:f,reserved1:h,asvc:m,bsmod:v,acmod:g,lfeon:y,reserved2:_,numDepSub:b,chanLoc:w,reserved3:E};l.push(x)}if(a.hasMoreData()){var d=a.readUInt8();t=d>>1,1==(r=1&d)&&(o=d=a.readUInt8())}for(var T=[];a.hasMoreData();)T.push(a.readUInt8());var P=i.ContainerParser.parse(e);return n.__assign(n.__assign({},P),{dataRate:s>>3,numIndSub:u,indSubs:l,reserved4:t,flagEc3ExtensionTypeA:r,complexityIndexTypeA:o,reservedEnd:T})}}},e}();t.EC3SpecificBoxParser=o},30437:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EncryptedAudioBoxParser=void 0;var n=r(59133),i=function(){function e(){}return e.getParser=function(){return{processContentHead:function(e){return e.parser.processBasicBoxHeader(e)},processContentBody:function(e){return e.contentReader.skip(28),n.ContainerParser.parse(e)}}},e}();t.EncryptedAudioBoxParser=i},78072:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EncryptedVideoBoxParser=void 0;var n=r(59133),i=function(){function e(){}return e.getParser=function(){return{processContentHead:function(e){return e.parser.processBasicBoxHeader(e)},processContentBody:function(e){return e.contentReader.skip(78),n.ContainerParser.parse(e)}}},e}();t.EncryptedVideoBoxParser=i},60081:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FrmaBoxParser=void 0;var n=r(91261),i=r(41145),o=function(){function e(){}return e.getParser=function(){return{processContentHead:function(e){return e.parser.processBasicBoxHeader(e)},processContentBody:function(e){var t=e.contentReader.readBytes(4),r=i.StringUtil.fromCharCode(t);return n.__assign(n.__assign({},e.box),{fourCC:r})}}},e}();t.FrmaBoxParser=o},98149:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HevcConfigurationBoxParser=void 0;var n=r(91261),i=function(){function e(){}return e.getParser=function(){return{processContentHead:function(e){return e.parser.processBasicBoxHeader(e)},processContentBody:function(e){var t=e.contentReader,r=t.readUInt8(),i=t.readUInt8(),o=(240&i)>>6,a=(32&i)>0,s=31&i,u=t.readUInt32(),l=[];l.push(t.readUInt8()),l.push(t.readUInt8()),l.push(t.readUInt8()),l.push(t.readUInt8()),l.push(t.readUInt8()),l.push(t.readUInt8());for(var c=(8&l[0])>0,d=(4&l[0])>0,p=(2&l[0])>0,f=(1&l[0])>0,h=t.readUInt8(),m=(61440&(i=t.readUInt16()))>>12,v=4095&i,g=(252&(i=t.readUInt8()))>>2,y=3&i,_=(252&(i=t.readUInt8()))>>2,b=3&i,S=(248&(i=t.readUInt8()))>>3,w=7&i,E=(248&(i=t.readUInt8()))>>3,x=7&i,T=t.readUInt16(),P=(192&(i=t.readUInt8()))>>6,C=(56&i)>>3,M=(4&i)>0,k=3&i,D=[],A=t.readUInt8(),R=0;R0,I=(64&i)>0,Z=63&i,N=[],B=t.readUInt16(),L=0;L>(2-n)*5&31;r[n]=o+96}return i.StringUtil.fromCharCode(r)},e}();t.MediaHeaderBoxParser=o},8526:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Mp4aBoxParser=void 0;var n=r(91261),i=r(59133),o=function(){function e(){}return e.getParser=function(){return{processContentHead:function(e){return e.parser.processBasicBoxHeader(e)},processContentBody:function(e){var t=e.contentReader;t.skip(6);var r=t.readUInt16(),o=t.readUInt16();t.skip(6);var a=t.readUInt16(),s=t.readUInt16(),u=t.readUInt16(),l=t.readUInt16(),c=t.readFixed16x16();1===o?t.skip(16):2===o&&t.skip(36);var d=i.ContainerParser.parse(e);return n.__assign(n.__assign({},d),{dataIndex:r,soundVersion:o,channelCount:a,sampleSize:s,sampleRate:c,compressionId:u,packetSize:l})}}},e}();t.Mp4aBoxParser=o},78541:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MovieHeaderBoxParser=void 0;var n=r(91261),i=r(13149),o=function(){function e(){}return e.getParser=function(){return{processContentHead:function(e){return e.parser.processFullBoxHeader(e)},processContentBody:function(e){var t,r,o,a,s=e.contentReader;1===e.box.version?(t=s.readUInt64(),r=s.readUInt64(),o=s.readUInt32(),a=s.readInt64()):(t=s.readUInt32(),r=s.readUInt32(),o=s.readUInt32(),a=s.readInt32());var u=s.readFixed16x16(),l=s.readFixed8x8();s.skip(10);var c=i.Matrix.read(s),d=s.readInt32(),p=s.readInt32(),f=s.readInt32(),h=s.readInt32(),m=s.readInt32(),v=s.readInt32(),g=s.readInt32();return n.__assign(n.__assign({},e.box),{creationTime:t,modificationTime:r,timescale:o,duration:a,rate:u,volume:l,matrix:c,nextTrackId:g,previewTime:d,previewDuration:p,posterTime:f,selectionTime:h,selectionDuration:m,currentTime:v})}}},e}();t.MovieHeaderBoxParser=o},25163:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentIndexBoxParser=void 0;var n=r(91261),i=r(49877),o=function(){function e(){}return e.getParser=function(){return{processContentHead:function(e){return e.parser.processFullBoxHeader(e)},processContentBody:function(e){var t,r,o=e.contentReader,a=o.readUInt32(),s=o.readUInt32();0===e.box.version?(t=o.readUInt32(),r=o.readUInt32()):(t=o.readUInt64(),r=o.readUInt64()),o.skip(2);for(var u=[],l=o.readUInt16(),c=0;c>28,deltaTimeOfStreamAccessPoint:268435455&t}},e}();t.SegmentIndexEntry=r},18516:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SinfBoxParser=void 0;var n=r(91261),i=r(59133),o=function(){function e(){}return e.getParser=function(){return{processContentHead:function(e){return e.parser.processBasicBoxHeader(e)},processContentBody:function(e){var t=i.ContainerParser.getBasicBoxParser().processContentBody(e);e.contentReader.rewind(e.contentReader.getPosition());var r=e.contentReader.readBytes(e.contentReader.getLength());return n.__assign(n.__assign({},t),{data:r})}}},e}();t.SinfBoxParser=o},98453:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TrackEncryptionBoxParser=void 0;var n=r(91261),i=function(){function e(){}return e.getParser=function(){var e=this;return{processContentHead:function(e){return e.parser.processFullBoxHeader(e)},processContentBody:function(t){var r=t.contentReader;r.skip(2);var i=1===r.readUInt8(),o=r.readUInt8(),a=r.readBytes(e.DEFAULT_KID_LENGTH);return n.__assign(n.__assign({},t.box),{default_isEncrypted:i,default_IV_size:o,default_KID:a})}}},e.DEFAULT_KID_OFFSET=4,e.DEFAULT_KID_LENGTH=16,e}();t.TrackEncryptionBoxParser=i},63328:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TrackFragmentDecodeTimeBoxParser=void 0;var n=r(91261),i=function(){function e(){}return e.getParser=function(){return{processContentHead:function(e){return e.parser.processFullBoxHeader(e)},processContentBody:function(e){var t,r=e.contentReader;return t=1===e.box.version?r.readUInt64():r.readUInt32(),n.__assign(n.__assign({},e.box),{baseDecodeTime:t})}}},e}();t.TrackFragmentDecodeTimeBoxParser=i},16702:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TrackFragmentHeaderBoxParser=void 0;var n=r(91261),i=function(){function e(){}return e.getParser=function(){return{processContentHead:function(e){return e.parser.processFullBoxHeader(e)},processContentBody:function(e){var t,r=e.contentReader,i=r.readUInt32(),o=null!==(t=e.box.flags)&&void 0!==t?t:0,a=n.__assign(n.__assign({},e.box),{trackId:i});return(1&o)==1&&(a.baseDataOffset=r.readUInt64()),(2&o)==2&&(a.sampleDescriptionIndex=r.readUInt32()),(8&o)==8&&(a.defaultSampleDuration=r.readUInt32()),(16&o)==16&&(a.defaultSampleSize=r.readUInt32()),(32&o)==32&&(a.defaultSampleFlags=r.readUInt32()),(65536&o)==65536&&(a.durationIsEmpty=!0),(131072&o)==131072&&(a.defaultBaseIsMoof=!0),a}}},e}();t.TrackFragmentHeaderBoxParser=i},82711:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TrackExtendsBoxParser=void 0;var n=r(91261),i=function(){function e(){}return e.getParser=function(){return{processContentHead:function(e){return e.parser.processFullBoxHeader(e)},processContentBody:function(e){var t=e.contentReader,r=t.readUInt32(),i=t.readUInt32(),o=t.readUInt32(),a=t.readUInt32(),s=t.readUInt32();return n.__assign(n.__assign({},e.box),{trackId:r,defaultSampleDescriptionIndex:i,defaultSampleDuration:o,defaultSampleSize:a,defaultSampleFlags:s})}}},e}();t.TrackExtendsBoxParser=i},84551:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TrackRunBoxParser=void 0;var n=r(91261),i=r(14540),o=function(){function e(){}return e.getParser=function(){return{processContentHead:function(e){return e.parser.processFullBoxHeader(e)},processContentBody:function(e){var t,r=e.contentReader,o=null!==(t=e.box.flags)&&void 0!==t?t:0,a=r.readUInt32(),s=n.__assign(n.__assign({},e.box),{dataOffset:void 0,firstSampleFlags:void 0,samples:[]});(1&o)==1&&(s.dataOffset=r.readUInt32()),(4&o)==4&&(s.firstSampleFlags=r.readUInt32());for(var u=0;u0)for(var a=new i.TextParser(t),s=a.readWord();void 0!==s;)r.push(s),a.skipWhitespace(),s=a.readWord();return o}}},e}();t.CueSettingsBoxParser=o},46211:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectDescriptorBoxParser=void 0;var n=r(91261),i=r(64147),o=function(){function e(){}return e.getParser=function(e){return{processContentHead:function(e){return e.parser.processFullBoxHeader(e)},processContentBody:function(t){var r=t.contentReader,o=new i.ObjectDescriptorParser(e).parse(r);return n.__assign(n.__assign({},t.box),{descriptor:o})}}},e}();t.ObjectDescriptorBoxParser=o},64147:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectDescriptorParser=void 0;var n=r(1732),i=function(){function e(e){this._parserMap=e}return e.prototype.parse=function(e){for(var t=e.readUInt8(),r=e.readUInt8(),i=127&r;r>>7==1;)i=i<<7|127&(r=e.readUInt8());var o=e.readBytes(i),a=this._parserMap.tryGet(t),s={tag:t,descriptorSize:i,descriptors:[]};if(void 0!==a){var u=new DataView(o.buffer,0,i),l=new n.DataViewReader(u,!1);s=a.processDescriptorBody({parser:this,contentReader:l,descriptor:s})}return s},e}();t.ObjectDescriptorParser=i},87756:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AudioSpecificConfigParser=void 0;var n=r(91261),i=r(48105),o=function(){function e(){}return e.getParser=function(){return{processDescriptorBody:function(e){var t=e.contentReader,r=new i.BitStreamReader;r.addBytes(t.readBytes(2));var o=r.readBits(5);return 31===o&&(o=32+r.readBits(6)),n.__assign(n.__assign({},e.descriptor),{audioObjectType:o})}}},e}();t.AudioSpecificConfigParser=o},70309:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DecoderConfigParser=void 0;var n=r(91261),i=function(){function e(){}return e.getParser=function(){return{processDescriptorBody:function(e){for(var t=e.contentReader,r=t.readUInt8(),i=t.readUInt8(),o=t.readUInt24(),a=t.readInt32(),s=t.readInt32(),u=[];t.hasMoreData();)u.push(e.parser.parse(t));return n.__assign(n.__assign({},e.descriptor),{objectType:r,streamType:i>>2,upstream:(i>>1&1)==1,bufferSizeDB:o,maxBitrate:a,avgBitrate:s,descriptors:u})}}},e}();t.DecoderConfigParser=i},1562:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ESDescriptorParser=void 0;var n=r(91261),i=r(41145),o=function(){function e(){}return e.getParser=function(){return{processDescriptorBody:function(e){var t,r,o,a=e.contentReader,s=a.readUInt16(),u=a.readUInt8();if(0!=(u>>7&1)&&(t=a.readUInt16()),0!=(u>>6&1)){var l=a.readUInt8();o=i.StringUtil.fromUTF8(a.readBytes(l))}0!=(u>>5&1)&&(r=a.readUInt16());for(var c=[];a.hasMoreData();)c.push(e.parser.parse(a));return n.__assign(n.__assign({},e.descriptor),{esId:s,priority:31&u,dependsOnId:t,url:o,ocrId:r,descriptors:c})}}},e}();t.ESDescriptorParser=o},13149:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Matrix=void 0;var r=function(){function e(){}return e.read=function(e){var t=e.readFixed16x16(),r=e.readFixed16x16(),n=e.readFixed2x30(),i=e.readFixed16x16(),o=e.readFixed16x16(),a=e.readFixed2x30(),s=e.readFixed16x16(),u=e.readFixed16x16();return{a:t,b:r,c:i,d:o,u:n,v:a,w:e.readFixed2x30(),tx:s,ty:u}},e}();t.Matrix=r},11643:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EmbeddedCaptionParser=void 0;var n=r(76521),i=r(44215),o=r(51051),a=r(1732),s=r(96798),u=r(59133),l=r(40341),c=r(63328),d=r(16702),p=r(82711),f=r(84551),h=r(86046),m=r(31684),v=function(){function e(e,t){this._codecGroup=t,this._defaultSampleDuration=0,this._defaultSampleSize=0,this._timescale=9e4;var r=new h.Mp4Parser;r.setParsers(new s.HashMap([["moov",u.ContainerParser.getBasicBoxParser()],["mvex",u.ContainerParser.getBasicBoxParser()],["trak",u.ContainerParser.getBasicBoxParser()],["mdia",u.ContainerParser.getBasicBoxParser()],["trex",p.TrackExtendsBoxParser.getParser()],["mdhd",l.MediaHeaderBoxParser.getParser()]]));var n=r.parse(new Uint8Array(e)),i=new m.Mp4Walker(n),o=i.jumpTo("trex",!0),a=i.jumpTo("mdhd",!0);void 0!==o&&(this._defaultSampleDuration=o.defaultSampleDuration,this._defaultSampleSize=o.defaultSampleSize),void 0!==a&&(this._timescale=a.timescale)}return e.prototype.parseMediaSegment=function(e){var t,r,l,p,v,g,y,_,b,S,w,E=new h.Mp4Parser;E.setParsers(new s.HashMap([["moof",u.ContainerParser.getBasicBoxParser()],["traf",u.ContainerParser.getBasicBoxParser()],["trun",f.TrackRunBoxParser.getParser()],["tfhd",d.TrackFragmentHeaderBoxParser.getParser()],["tfdt",c.TrackFragmentDecodeTimeBoxParser.getParser()]]));var x=E.parse(new Uint8Array(e)),T=new m.Mp4Walker(x),P=T.jumpTo("trun",!0),C=T.jumpTo("tfhd",!0),M=T.jumpTo("tfdt",!0),k=T.jumpTo("mdat",!0),D=null!==(t=null==P?void 0:P.samples)&&void 0!==t?t:[],A=null!==(r=null==C?void 0:C.defaultSampleDuration)&&void 0!==r?r:this._defaultSampleDuration,R=null!==(l=null==C?void 0:C.defaultSampleSize)&&void 0!==l?l:this._defaultSampleSize,O=null==M?void 0:M.baseDecodeTime;if(void 0===O||void 0===k)return[];for(var I=new DataView(e,k.rangeContentBody.start,k.rangeContentBody.length),Z=new a.DataViewReader(I,!1),N=0,B=null!==(v=null===(p=D[0])||void 0===p?void 0:p.size)&&void 0!==v?v:R,L=O,F=[];Z.hasMoreData();){var U=Z.readUInt32(),j=void 0,V=void 0;switch(this._codecGroup){case"avc":j=1;var W=31&Z.readUInt8();V=W===o.SeiParser.H264_NAL_UNIT_TYPE;break;case"hevc":case"hevc-hdr":case"dvh":j=2;var W=Z.readUInt16()>>9&63;V=W===o.SeiParser.H265_PREFIX_SEI_NUT||W===o.SeiParser.H265_SUFFIX_SEI_NUT}if(V)for(var H=(L+(null!==(y=null===(g=D[N])||void 0===g?void 0:g.compositionTimeOffset)&&void 0!==y?y:0))/this._timescale,q=i.NalUtils.stripEmulationPreventionBytes(Z.readBytes(U-j)),z=0,K=o.SeiParser.parse(q,n.ItuTT35Parser.PAYLOAD_TYPE);z0&&e!==o._mediaSource.getNativeResource().sourceBuffers.length&&o.onWarning.emit(new h.SafariKeyWarningError("Have only seen one webkitneedkey"))},this._onSafariWebkitNeedKey=function(e){if(void 0!==e&&e.initData instanceof Uint8Array){var t=new c.Mp4Parser;t.setParsers(new d.HashMap([["frma",p.FrmaBoxParser.getParser()]]));var r=l.StringUtil.fromCharCode(e.initData);if("{"===r[0]){var n=JSON.parse(r);if(o._fairPlayInitIsValid(n)&&0!==n.sinf.length){var i=t.parse(l.StringUtil.toCharCode(l.StringUtil.fromStandardBase64(n.sinf[0])));0!==i.length&&(o._appendedKeyFormats[i[0].fourCC]=1)}}}},this._onEnterPictureInPicture=function(){o._system.logInfo("Native `enterpictureinpicture` event was emitted"),o._inPictureInPicture=!0},this._onLeavePictureInPicture=function(){o._system.logInfo("Native `leavepictureinpicture` event was emitted"),o._inPictureInPicture=!1,o.onLeavePictureInPicture.emit()},this._syncVideo=function(){g.PromiseUtil.catchRejection(function(){return n.__awaiter(o,void 0,void 0,function(){return n.__generator(this,function(e){switch(e.label){case 0:return this._syncVideoPosition(),[4,this._syncVideoPlayState()];case 1:return e.sent(),[2]}})})},function(e){return o.onError.emit(u.WrappedError.wrap(e))})},this._system=e,this._htmlVideoElement=r,this._htmlVideoElement.autoplay=!1,this._htmlVideoElement.addEventListener("canplay",this._syncVideo),this._htmlVideoElement.addEventListener("loadedmetadata",this._syncVideo),this._htmlVideoElement.addEventListener("durationchange",this._syncVideo),this._options=t,this._platform.isSafari()&&(this._htmlVideoElement.addEventListener("loadeddata",this._onSafariLoadedData),this._htmlVideoElement.addEventListener("webkitneedkey",this._onSafariWebkitNeedKey)),void 0!==t.disableRemotePlayback&&(this._htmlVideoElement.disableRemotePlayback=t.disableRemotePlayback,this._system.logInfo("".concat(t.disableRemotePlayback?"Disable":"Enable"," Remote Playback API"))),this._htmlVideoElement.addEventListener("pause",this._onVideoPauseEvent),this._htmlVideoElement.addEventListener("ended",this._onVideoEndedEvent),this._htmlVideoElement.addEventListener("play",this._onVideoPlayEvent),this._htmlVideoElement.addEventListener("waiting",this._onVideoWaitingEvent),this._htmlVideoElement.addEventListener("loadeddata",this._onVideoLoadedDataEvent),this._htmlVideoElement.addEventListener("error",this._onVideoErrorEvent),this._htmlVideoElement.addEventListener("enterpictureinpicture",this._onEnterPictureInPicture),this._htmlVideoElement.addEventListener("leavepictureinpicture",this._onLeavePictureInPicture),void 0!==this._htmlVideoElement.getVideoPlaybackQuality&&(this._qualityTimer=new i.SyncTimer(e,function(){return o._cacheQuality()}))}return e.prototype.destroy=function(){this.clearMediaSource(),this._htmlVideoElement.removeEventListener("canplay",this._syncVideo),this._htmlVideoElement.removeEventListener("loadedmetadata",this._syncVideo),this._htmlVideoElement.removeEventListener("durationchange",this._syncVideo),this._htmlVideoElement.removeEventListener("loadeddata",this._onSafariLoadedData),this._htmlVideoElement.removeEventListener("webkitneedkey",this._onSafariWebkitNeedKey),this._htmlVideoElement.removeEventListener("pause",this._onVideoPauseEvent),this._htmlVideoElement.removeEventListener("ended",this._onVideoEndedEvent),this._htmlVideoElement.removeEventListener("play",this._onVideoPlayEvent),this._htmlVideoElement.removeEventListener("waiting",this._onVideoWaitingEvent),this._htmlVideoElement.removeEventListener("loadeddata",this._onVideoLoadedDataEvent),this._htmlVideoElement.removeEventListener("error",this._onVideoErrorEvent),this._htmlVideoElement.removeEventListener("enterpictureinpicture",this._onEnterPictureInPicture),this._htmlVideoElement.removeEventListener("leavepictureinpicture",this._onLeavePictureInPicture),this._qualityTimer=void 0},e.prototype._fairPlayInitIsValid=function(e){return!!("object"==typeof e&&null!==e&&"sinf"in e&&Array.isArray(e.sinf))&&e.sinf.every(function(e){return"string"==typeof e})},e.prototype.getNativeResource=function(){return this._htmlVideoElement},e.prototype.getSize=function(){var e=this._htmlVideoElement.clientHeight,t=this._htmlVideoElement.clientWidth;return void 0!==window.devicePixelRatio&&window.devicePixelRatio>1&&(e*=window.devicePixelRatio,t*=window.devicePixelRatio),{height:e,width:t}},e.prototype.setRateWhenReady=function(e){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(t){switch(t.label){case 0:return this._videoRate=e,[4,this._syncVideoPlayState()];case 1:return t.sent(),[2]}})})},e.prototype.supportsPictureInPicture=function(){return"function"==typeof this._htmlVideoElement.requestPictureInPicture},e.prototype.requestPictureInPicture=function(){return n.__awaiter(this,void 0,void 0,function(){var e=this;return n.__generator(this,function(t){switch(t.label){case 0:if(!this.supportsPictureInPicture())return[3,2];return[4,this._htmlVideoElement.requestPictureInPicture().catch(function(t){e._system.logWarn("Request to Picture in Picture failed.",t)})];case 1:t.sent(),t.label=2;case 2:return[2]}})})},e.prototype.exitPictureInPicture=function(){var e=this;if("function"==typeof document.exitPictureInPicture)return document.exitPictureInPicture().catch(function(t){e._system.logWarn("Failed to exit Picture in Picture",t)})},e.prototype.inPictureInPicture=function(){return this._inPictureInPicture},e.prototype._pauseForBufferPlaybackSeconds=function(){this._bufferForPlaybackSeconds>0&&!this._htmlVideoElement.paused&&void 0===this._pendingPlayPromise&&1===this._videoRate&&this._pause()},e.prototype.setPositionWhenReady=function(e){return n.__awaiter(this,void 0,void 0,function(){var t,r,i=this;return n.__generator(this,function(n){switch(n.label){case 0:if(this._lastSeekPosition=e,void 0!==this._seekPromise)return[2,this._seekPromise.promise];t=new Promise(function(e,r){i._seekPromise={promise:t,resolver:e,rejecter:r}}),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._setPositionWhenReady()];case 2:return n.sent(),[3,4];case 3:return r=n.sent(),this._system.logError("Rejecting seek promise to ".concat(e),r),this._rejectSeekPromise(r),[3,4];case 4:return[2,t]}})})},e.prototype._setPositionWhenReady=function(){var e;return n.__awaiter(this,void 0,void 0,function(){var t;return n.__generator(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,null===(e=this._mediaSource)||void 0===e?void 0:e.openSource()];case 1:return r.sent(),[3,3];case 2:if((t=r.sent())instanceof u.WrappedError&&u.WrappedError.causedBy(t,v.OperationCanceledError.NAME))return this._system.logVerbose("Resolving seek promise to ".concat(this._lastSeekPosition," because openSource was canceled")),this._resolveSeekPromise(),[2];throw t;case 3:return this._syncVideoPosition(),[2]}})})},e.prototype.setVolumeWhenReady=function(e){this._lastVolume=e,this._syncVideoVolume()},e.prototype._getBuffered=function(){for(var e,t,r,n,i,o,a=Array(this._htmlVideoElement.buffered.length),s=this._htmlVideoElement.buffered,u=0;u=this._bufferForPlaybackSeconds},e.prototype._getClosestBufferedRange=function(e){for(var t,r=0,n=this._getBuffered();r0&&this._htmlVideoElement.paused&&!this._htmlVideoElement.ended&&this._haveEnoughBufferedToPlay()))return[3,6];this._mediaSourceHasEverEnded&&this._platform.isPlayStation4()&&(this._system.logVerbose("NudgeWhenUnpausingAfterEndOfStream: nudging the playhead by ".concat(m.PlayerConstants.STALL_SEEK_EPSILON)),this._htmlVideoElement.currentTime+=m.PlayerConstants.STALL_SEEK_EPSILON),e.label=2;case 2:return e.trys.push([2,4,5,6]),this._pendingPlayPromise=this._htmlVideoElement.play(),[4,this._pendingPlayPromise];case 3:return e.sent(),[3,6];case 4:return e.sent(),this._system.logWarn("HTMLVideoElement.play() has failed - this may indicate an autoplay permission issue resulting in paused playback"),this._videoRate=0,[3,6];case 5:return this._pendingPlayPromise=void 0,[7];case 6:return[2]}})})},e.prototype._syncVideoPosition=function(){if(void 0!==this._lastSeekPosition){var e,t,r,n,i,o,a=void 0!==this._mediaSource&&this._htmlVideoElement.readyState>=HTMLMediaElement.HAVE_METADATA,s=null!==(t=null===(e=this._mediaSource)||void 0===e?void 0:e.mediaQueue.hasRunningSourceBuffer())&&void 0!==t&&t;if(!a){void 0!==this._seekPromise&&(this._system.logVerbose("Resolving seek promise to ".concat(this._lastSeekPosition," because HTMLVideoElement isn't ready")),this._resolveSeekPromise());return}if(!s){var u=null!==(i=null===(n=null===(r=this._mediaSource)||void 0===r?void 0:r.timelineOffset)||void 0===n?void 0:n.toNativeValue(this._lastSeekPosition))&&void 0!==i?i:this._lastSeekPosition;0===u&&this._system.requiresDontSeekToZeroWorkaround()&&(u=m.PlayerConstants.STALL_SEEK_EPSILON,this._system.logInfo("DontSeekToZeroWorkaround: seeking to ".concat(u," instead"))),this._htmlVideoElement.currentTime=u,this._system.logVerbose("Set HTMLVideoElement.currentTime to ".concat(this._lastSeekPosition," nativeTime=").concat(u," offset=").concat(null===(o=this._mediaSource)||void 0===o?void 0:o.timelineOffset.getOffset())),this._resolveSeekPromise(),(0===this._lastSeekPosition||0!==this._htmlVideoElement.currentTime)&&(this._lastSeekPosition=void 0)}}},e.prototype._syncVideoVolume=function(){void 0!==this._lastVolume&&(this._htmlVideoElement.volume=this._lastVolume,this._lastVolume=void 0)},e.prototype._resolveSeekPromise=function(){var e;null===(e=this._seekPromise)||void 0===e||e.resolver(),this._seekPromise=void 0},e.prototype._rejectSeekPromise=function(e){var t;null===(t=this._seekPromise)||void 0===t||t.rejecter(e),this._seekPromise=void 0},e.prototype._pause=function(){this._expectingPauseEvent=!this._htmlVideoElement.paused,this._htmlVideoElement.pause()},e.prototype._getExternalReadyState=function(){var e=this._remapNativeReadyState(this._htmlVideoElement.readyState);return e>=2&&this._htmlVideoElement.paused&&!this._haveEnoughBufferedToPlay()?1:e},e.prototype._remapNativeReadyState=function(e){switch(e){case HTMLMediaElement.HAVE_NOTHING:return 0;case HTMLMediaElement.HAVE_METADATA:return 1;case HTMLMediaElement.HAVE_CURRENT_DATA:return 2;case HTMLMediaElement.HAVE_FUTURE_DATA:return 3;case HTMLMediaElement.HAVE_ENOUGH_DATA:return 4}throw Error("Unexpected value for HTMLMediaElement.readyState: ".concat(e))},e.prototype._pokeTheDom=function(){var e,t=this;(null!==(e=this._options.enableVideoElementDomPoke)&&void 0!==e?e:this._platform.isPlayStation4())&&this._requestAnimationFrame(function(){var e=t._htmlVideoElement.style.opacity,r=parseFloat(getComputedStyle(t._htmlVideoElement).opacity);t._htmlVideoElement.style.opacity="".concat(r>=.01?r-.01:r+.01),t._requestAnimationFrame(function(){t._htmlVideoElement.style.opacity=e})})},e.prototype._requestAnimationFrame=function(e){var t=this;if(void 0!==this._pendingAnimationFrame){this._system.logWarn("Ignoring stacked call to requestAnimationFrame");return}this._pendingAnimationFrame=requestAnimationFrame(function(r){t._pendingAnimationFrame=void 0,e(r)})},e.prototype._cancelAnimationFrame=function(){void 0!==this._pendingAnimationFrame&&(cancelAnimationFrame(this._pendingAnimationFrame),this._pendingAnimationFrame=void 0)},e.QUALITY_UPDATE_SECONDS=10,e}();t.BrowserVideoElement=y},14927:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KeySystemWrapper=void 0;var n=r(91261),i=r(97241),o=r(7088),a=r(30617),s=r(93218),u=r(57497),l=r(96798),c=r(21997),d=r(6724),p=r(1427),f=r(26735),h=function(e){function t(t,r,n){var i,a,s=e.call(this)||this;return s._useSonyEnhancedSecurityVideoMode=r,s._system=n,s._platform=new o.Platform,s._audioMimeDefaults=((i={})["ec-3-atmos"]='audio/mp4; codecs="ec-3"',i["ec-3"]='audio/mp4; codecs="ec-3"',i["ac-3"]='audio/mp4; codecs="ac-3"',i.aac='audio/mp4; codecs="mp4a.40.2"',i.heaac='audio/mp4; codecs="mp4a.40.5"',i["unknown-audio"]="audio/mp4",i),s._videoMimeDefaults=((a={}).avc='video/mp4; codecs="avc1.4d400d"',a.hevc='video/mp4; codecs="hvc1.1.6.L60.90"',a["hevc-hdr"]='video/mp4; codecs="hvc1.2.4.L63.90"',a.dvh=s._getPlatformDolbyVisionDefault(),a["unknown-video"]="video/mp4",a),void 0!==t?s._supportedKeySystems=t:s._platform.isSafari()?s._supportedKeySystems=["com.apple.fps.2_0"]:s._supportedKeySystems=["com.microsoft.playready.recommendation","com.microsoft.playready","com.widevine.alpha"],s._supportedKeySystems=s._sanitizeSupportedKeySystems(s._supportedKeySystems),s}return n.__extends(t,e),t.prototype.getContextualInfo=function(){var e=this,r="";if(t._supportedNativeConfigurationMap.getCount()>0){r+="\nsupportedKeySystems: ";var n={};t._supportedNativeConfigurationMap.forEach(function(t,r){n[t]={t:r.timestamp,sc:r.isSecureContext,caps:e._aggregateCapabilitiesSupport(r.configuration)}}),r+=JSON.stringify(n)}if(t._failedNativeConfigurationMap.getCount()>0){r+="\nfailedKeySystems: ";var i={};t._failedNativeConfigurationMap.forEach(function(t,r){i[t]={t:r.timestamp,sc:r.isSecureContext,err:String(r.error),caps:e._aggregateCapabilitiesSupport(r.configuration)}}),r+=JSON.stringify(i)}return r},t.prototype.getMediaKeySupport=function(){return void 0===t._supportedPromise&&(t._supportedPromise=this._getSupport()),t._supportedPromise},t.prototype.makeMediaKeySystemAccess=function(e){return n.__awaiter(this,void 0,void 0,function(){var t;return n.__generator(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this._makeSystemAccess(e)];case 1:return[2,r.sent()];case 2:throw t=r.sent(),new f.RequestMediaKeySystemAccessError("Unable to create system access for ".concat(JSON.stringify(e)," (t=").concat(Date.now()," sc=").concat(this._system.isSecureContext(),")").concat(this.getContextualInfo()),s.WrappedError.wrap(t));case 3:return[2]}})})},t.prototype.setMediaKeys=function(e,t){return a.PromiseUtil.ensurePromiseType(e.getNativeResource().setMediaKeys(t.getNativeResource()))},t.prototype.clearMediaKeys=function(e){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(t){switch(t.label){case 0:return[4,a.PromiseUtil.ensurePromiseType(e.getNativeResource().setMediaKeys(null))];case 1:return t.sent(),[2]}})})},t.prototype._getPlatformDolbyVisionDefault=function(){var e='video/mp4; codecs="';return this._platform.isXbox()?e+="hvc1.2.4.L63.90":e+="dvh1.05.01",e+'"'},t.prototype._sanitizeSupportedKeySystems=function(e){var t=this;return e.filter(function(e){return"com.microsoft.playready.recommendation"!==e||!t._platform.isChromiumEdge()&&!t._platform.isXbox()})},t.prototype._getAllSupportedAudio=function(){var e,t=this,r=["ec-3","ac-3","heaac","aac"].filter(function(e){return t._system.isTypeSupported(t._audioMimeDefaults[e])});if(this._platform.isSafari()){var n=((e={}).aac=1,e.heaac=1,e);this._platform.isSafari(14)&&(n["ac-3"]=1),r=r.filter(function(e){return void 0!==n[e]})}return r},t.prototype._assumeCbcForSafari=function(e,t,r){for(var i=function(t){for(var i=function(r){var i=u.ArrayUtil.find(e,function(e){return"com.apple.fps.2_0"===e.keySystem&&e.video.some(function(e){return e.codec===t})&&e.audio.some(function(e){return e.codec===r})&&"ctr"===e.encryptionScheme&&"optional"===e.persistentState});void 0===i||e.some(function(e){return"com.apple.fps.2_0"===e.keySystem&&e.video.some(function(e){return e.codec===t})&&e.audio.some(function(e){return e.codec===r})&&"cbc"===e.encryptionScheme&&"optional"===e.persistentState})||e.push(n.__assign(n.__assign({},i),{encryptionScheme:"cbc"}))},o=0;o=0&&(a<0||l0?"@".concat(l.robustness):"")),a[d]=p}}return a},t._supportedNativeConfigurationMap=new l.HashMap,t._failedNativeConfigurationMap=new l.HashMap,t._allWidevineRobustnessLevels=["HW_SECURE_ALL","HW_SECURE_DECODE","HW_SECURE_CRYPTO","SW_SECURE_DECODE","SW_SECURE_CRYPTO",""],t}(r(98935).BaseKeySystemWrapper);t.KeySystemWrapper=h},91451:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MediaKeySessionWrapper=void 0;var n=r(91261),i=r(2574),o=r(46661),a=r(30617),s=r(91037),u=r(93218),l=r(96798),c=r(72949),d=r(71203),p=r(11664),f=r(56890),h=r(90348),m=r(41145),v=function(e){function t(t,r,n){var o=e.call(this,!1,r)||this;return o._hasEventHandlers=!1,o._commonEncryptionUtil=new i.CommonEncryptionUtil,o._onKeyStatusesChange=function(){o._keySessionStatusCache=void 0,o.onKeyStatusesChange.emit()},o._onMessage=function(e){o.onMessage.emit({message:e.message,type:e.messageType})},o._mediaKeySession=t,o._system=n,o}return n.__extends(t,e),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._mediaKeySession.sessionId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"expiration",{get:function(){return this._mediaKeySession.expiration},enumerable:!1,configurable:!0}),t.prototype.getMediaKeyStatusMap=function(){var e=this;if(void 0===this._keySessionStatusCache){var t=new l.HashMap;this._keySessionStatusCache=t,this._mediaKeySession.keyStatuses.forEach(function(r,n){if("string"==typeof n){var i=n;n=r,r=i}var o=m.StringUtil.toHex(ArrayBuffer.isView(n)?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n));t.set(e._getKeyIdFromPlatformKeyId(o),e._getStatusFromPlatformStatus(r))})}return this._keySessionStatusCache},t.prototype.load=function(e){return this._addEventHandlersIfNeeded(),a.PromiseUtil.ensurePromiseType(this._mediaKeySession.load(e))},t.prototype.remove=function(){return a.PromiseUtil.ensurePromiseType(this._mediaKeySession.remove())},t.prototype.generateRequest=function(e,t){return n.__awaiter(this,void 0,void 0,function(){var r,i,o,s,l,d;return n.__generator(this,function(n){switch(n.label){case 0:if("com.microsoft.playready"===this._options.keySystem||"com.microsoft.playready.recommendation"===this._options.keySystem)for(void 0===this._requestedPlayReadyKeyIds&&(this._requestedPlayReadyKeyIds=new c.HashSet),r=this._commonEncryptionUtil.getKeysFromInitData(t),i=0,o=r;i0?u.join(", "):"(none)"),o.WrappedError.wrap(i));case 3:return e._stats.set(this.options.keySystem,(null!==(t=e._stats.tryGet(this.options.keySystem))&&void 0!==t?t:0)+1),[2,new s.MediaKeysWrapper(r,this.options,this._system)]}})})},e._stats=new i.HashMap,e}();t.MediaKeySystemAccessWrapper=u},28731:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MediaKeysWrapper=void 0;var n=r(91261),i=r(91451),o=r(20217),a=r(93218),s=r(30617),u=r(83368),l=function(){function e(e,t,r){this.onError=new o.Emitter,this.onWarning=new o.Emitter,this._mediaKeys=e,this._options=t,this._system=r}return e.prototype.getNativeResource=function(){return this._mediaKeys},e.prototype.setServerCertificate=function(e){return n.__awaiter(this,void 0,void 0,function(){var t;return n.__generator(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,s.PromiseUtil.ensurePromiseType(this._mediaKeys.setServerCertificate(e))];case 1:return[2,r.sent()];case 2:throw t=r.sent(),new u.SetServerCertificateError("set server certificate failed",a.WrappedError.wrap(t));case 3:return[2]}})})},e.prototype.createSession=function(e){var t=this._mediaKeys.createSession(e);return new i.MediaKeySessionWrapper(t,this._options,this._system)},e.prototype.getStatusForPolicy=function(e){return n.__awaiter(this,void 0,void 0,function(){var t,r;return n.__generator(this,function(n){switch(n.label){case 0:if(!(void 0!==(t=this._mediaKeys).getStatusForPolicy))return[3,4];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,s.PromiseUtil.ensurePromiseType(t.getStatusForPolicy(e))];case 2:return[2,n.sent()];case 3:return r=n.sent(),this._system.logWarn("call to MediaKeys.getStatusForPolicy failed: ".concat(String(r))),[3,4];case 4:return[2]}})})},e}();t.MediaKeysWrapper=l},7857:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MediaSourceWrapper=void 0;var n=r(91261),i=r(73981),o=r(36597),a=r(7088),s=r(86507),u=r(31532),l=r(5809),c=r(20217),d=r(30617),p=r(93218),f=r(98466),h=r(62090),m=r(21997),v=function(){function e(t,r,i,o,p){var h=this;this._useSonyEnhancedSecurityVideoMode=p,this._platform=new a.Platform,this.onSourceEnded=new c.Emitter,this._onSourceOpen=function(){h._sourceOpenTimestamp=Date.now(),d.PromiseUtil.catchRejection(function(){return n.__awaiter(h,void 0,void 0,function(){return n.__generator(this,function(t){switch(t.label){case 0:if(0!==this._mediaSource.sourceBuffers.length)return[3,2];return[4,this._setDuration(!1,0,e.DEFAULT_DURATION)];case 1:t.sent(),t.label=2;case 2:return[2]}})})},function(e){h._system.logError("MediaSource open duration setting failed",e)},function(){return h._resolveOpenPromise()})},this._onSourceClose=function(){h._resolveOpenPromise(),h._openPromise=new Promise(function(e){h._openResolve=e})},this._onSourceEnded=function(){h._sourceEndedTimestamp=Date.now(),h._system.logVerbose("mediaSource.readyState transitioned to 'ended'"),h._onSourceClose(),h.onSourceEnded.emit()},this._onLoadedMetadata=function(){h._mediaQueue.flush()},this._isMediaSourceValid=function(e,t){var r,n,i=null!==(n=null===(r=h._videoElement)||void 0===r?void 0:r.error)&&void 0!==n?n:void 0;if(void 0!==i){var o={sourceBuffers:h.getSourceBufferInfoMap(),mediaSourceMessages:h.mediaQueue.mediaSourceMessages.getEntries(),sourceBufferMessages:h.mediaQueue.sourceBufferMessages.getEntries()};return new u.MediaOperationStateError("Failed to run ".concat(t.name,": the video element is not in a valid state"),new l.VideoElementError(i,o))}if("closed"===e.getNativeResource().readyState)return new u.MediaOperationStateError("Failed to run ".concat(t.name,": the media source is closed"))},this._isSourceBufferValid=function(e,t){if(void 0===h._getExistingSourceBuffer(e))return new u.MediaOperationStateError("Failed to run ".concat(t.name,": the source buffer is no longer active"),void 0,e.streamType)},this._resolveOpenPromise=function(){void 0!==h._openResolve&&(h._openResolve(),h._openResolve=void 0)},this._system=t,this._options=r,this._mediaQueue=new s.MediaObjectQueue(t,this._isMediaSourceValid,this._isSourceBufferValid),this._mediaQueue.mediaSourceMessages.setMaxEntries(e.DEFAULT_MEDIASOURCE_MAX_MESSAGES),void 0!==r.mediaSourceMessageCount&&this._mediaQueue.mediaSourceMessages.setMaxEntries(r.mediaSourceMessageCount),this._mediaQueue.sourceBufferMessages.setMaxEntries(e.DEFAULT_SOURCEBUFFER_MAX_MESSAGES),void 0!==r.sourceBufferMessageCount&&this._mediaQueue.sourceBufferMessages.setMaxEntries(r.sourceBufferMessageCount),this._mediaSource=i,this.timelineOffset=new f.TimelineOffset(r),this._referenceStore=o,this._openPromise=new Promise(function(e){h._openResolve=e}),this._mediaQueue.trackMediaSource(this)}return Object.defineProperty(e.prototype,"openPromise",{get:function(){return this._openPromise},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mediaQueue",{get:function(){return this._mediaQueue},enumerable:!1,configurable:!0}),e.prototype.getNativeResource=function(){return this._mediaSource},e.prototype.destroy=function(){this.setVideoElement(void 0),this._mediaQueue.mediaSourceMessages.clear(),this._sourceEndedTimestamp=void 0,this._sourceOpenTimestamp=void 0},e.prototype.setVideoElement=function(e){void 0!==this._videoElement&&this._videoElement.removeEventListener("loadedmetadata",this._onLoadedMetadata),this._mediaSource.removeEventListener("sourceopen",this._onSourceOpen),this._mediaSource.removeEventListener("sourceended",this._onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this._onSourceClose),this._videoElement=e,void 0!==this._videoElement?(this._videoElement.addEventListener("loadedmetadata",this._onLoadedMetadata),this._mediaSource.addEventListener("sourceopen",this._onSourceOpen),this._mediaSource.addEventListener("sourceended",this._onSourceEnded),this._mediaSource.addEventListener("sourceclose",this._onSourceClose)):(this._mediaQueue.getSourceBuffers().forEach(function(e,t){return t.destroy()}),this._mediaQueue.reset())},e.prototype.openSource=function(){return n.__awaiter(this,void 0,void 0,function(){var t=this;return n.__generator(this,function(r){switch(r.label){case 0:if(!(this._mediaSource.readyState===e.MEDIA_SOURCE_ENDED&&this._mediaSource.sourceBuffers.length>0))return[3,2];return[4,this._mediaQueue.queueMediaSource("openSource",function(){if(t._mediaSource.readyState===e.MEDIA_SOURCE_ENDED&&t._mediaSource.sourceBuffers.length>0)for(var r=0;r0){for(var t=[],r=0;rn?(r._mediaQueue.sourceBufferMessages.add("SourceBufferWrapper (".concat(r.streamType,") remove ").concat(n,"-").concat(i)),r._sourceBuffer.remove(n,i)):r._system.logWarn("Attempting to remove a segment of 0 or lesser length. start=".concat(e,", end=").concat(t,", s=").concat(n,", e=").concat(i,", streamType=").concat(r.streamType))}catch(e){throw new p.RemoveBufferError("Unable to complete operation 'remove'",h.WrappedError.wrap(e,"RemoveBuffer"),r.streamType)}})},e.prototype.removeAll=function(){var e=this;return this._mediaQueue.queueSourceBuffer(this,"removeAll",function(){e._sourceBuffer.buffered.length>0&&(e._mediaQueue.sourceBufferMessages.add("SourceBufferWrapper (".concat(e.streamType,") removeAll")),e._sourceBuffer.remove(0,1/0))})},e.prototype._parseEmbeddedCaptions=function(e,t,r){var i=this;if(r){var a=o.CodecUtil.getVideoGroup({codecs:this._codec,attributes:0});"unknown-video"!==a?this._embeddedCaptionParser=new s.EmbeddedCaptionParser(t,a):(this._system.logWarn("Ignoring embedded captions in stream with unknown codec group (codec=".concat(this._codec,")")),this._extractEmbeddedCaptions=!1)}else if(void 0!==this._embeddedCaptionParser){var u=this._embeddedCaptionParser.parseMediaSegment(t).map(function(e){return n.__assign(n.__assign({},e),{pts:i.timelineOffset.fromNativeValue(e.pts+i._timestampOffset)})});this.onEmbeddedCaptionsExtracted.emit({start:e.start,end:e.end,captionFrames:u})}},e.prototype._getBuffered=function(){try{for(var e=[],t=0;t1){for(var t="",r=0;r0&&(t+=", "),t+="[".concat(n.start,"-").concat(n.end,"]")}this._system.logWarn("Discontinuous source buffer (".concat(this.streamType,"): [").concat(t,"]"))}},e.prototype._onUpdateStart=function(){this._mediaQueue.sourceBufferMessages.add("SourceBufferWrapper (".concat(this.streamType,") _onUpdateStart")),0!==this._queuedAppends.length&&(this._queuedAppends[0].sawUpdateStart=!0)},e.prototype._onUpdateEnd=function(){this._mediaQueue.sourceBufferMessages.add("SourceBufferWrapper (".concat(this.streamType,") _onUpdateEnd"));var e,t=this._queuedAppends[0];if(void 0!==t&&t.sawUpdateStart){this._queuedAppends.shift();var r=t.segment,n="".concat(r.createUri).concat(void 0!==r.startByte?" bytes=".concat(r.startByte,"-").concat(null!==(e=r.endByte)&&void 0!==e?e:""):""),i=this._getBuffered();if(i.length>0){var o=f.TimeRangeUtil.difference(i,t.prevBuffered);1===o.length&&f.TimeRangeUtil.isTimeClose(o[0].start,r.start)&&f.TimeRangeUtil.isTimeClose(o[0].end,r.end)||this._system.logWarn("".concat(this.streamType," segment range computed from manifest ([").concat(r.start,"-").concat(r.end,"]) does not match buffered range after appending (").concat(o.map(function(e){return"[".concat(e.start,"-").concat(e.end,"]")}).join(", "),"): ").concat(n))}else this._system.logWarn("Nothing in ".concat(this.streamType," source buffer after appending segment with range [").concat(r.start,"-").concat(r.end,"]: ").concat(n))}},e}();t.SourceBufferWrapper=m},98466:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TimelineOffset=void 0;var n=r(7088),i=function(){function e(e){this._platform=new n.Platform,this._options=e}return e.prototype.hasOffset=function(){return void 0!==this._offset},e.prototype.setOffset=function(e){this._offset=e},e.prototype.getOffset=function(){var e;return this.needsTimelineOffset()?null!==(e=this._offset)&&void 0!==e?e:0:void 0},e.prototype.needsDecodeTimeRewrite=function(e){var t=this._options.decodeTimeRewriteLimit;return void 0===t&&this._platform.isClaro()&&(t=2147483.647),void 0!==t&&Math.abs(e)>t},e.prototype.needsTimelineOffset=function(){var e;return null!==(e=this._options.needsTimelineOffset)&&void 0!==e?e:this._platform.isClaro()},e.prototype.fromNativeValue=function(e){var t;return e-(null!==(t=this.getOffset())&&void 0!==t?t:0)},e.prototype.toNativeValue=function(e){var t;return e+(null!==(t=this.getOffset())&&void 0!==t?t:0)},e}();t.TimelineOffset=i},28974:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CreateMediaKeysError=void 0;var n=r(91261),i=function(e){function t(r,n){return e.call(this,t.NAME,r,n)||this}return n.__extends(t,e),t.NAME="CreateMediaKeys",t}(r(93218).WrappedError);t.CreateMediaKeysError=i},56890:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MediaKeySessionGenerateRequestError=void 0;var n=r(91261),i=function(e){function t(r,n){return e.call(this,t.NAME,r,n)||this}return n.__extends(t,e),t.NAME="MediaKeySessionGenerateRequest",t}(r(93218).WrappedError);t.MediaKeySessionGenerateRequestError=i},11664:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MediaKeySessionUpdateError=void 0;var n=r(91261),i=function(e){function t(r,n,i){var o=e.call(this,t.NAME,r,i)||this;return o.updateDataType=n,o}return n.__extends(t,e),t.NAME="MediaKeySessionUpdate",t}(r(93218).WrappedError);t.MediaKeySessionUpdateError=i},62090:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MediaSourceAddSourceBufferError=void 0;var n=r(91261),i=function(e){function t(r,n,i,o){var a=e.call(this,t.NAME,r,i,o)||this;return a.codecGroup=n,a}return n.__extends(t,e),t.NAME="MediaSourceAddSourceBuffer",t}(r(93218).WrappedError);t.MediaSourceAddSourceBufferError=i},95690:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NoPrefixedEmeError=void 0;var n=r(91261),i=function(e){function t(r,n){return e.call(this,t.NAME,r,n)||this}return n.__extends(t,e),t.NAME="NoPrefixedEme",t}(r(93218).WrappedError);t.NoPrefixedEmeError=i},26735:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RequestMediaKeySystemAccessError=void 0;var n=r(91261),i=function(e){function t(r,n){return e.call(this,t.NAME,r,n)||this}return n.__extends(t,e),t.NAME="RequestMediaKeySystemAccess",t}(r(93218).WrappedError);t.RequestMediaKeySystemAccessError=i},83368:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SetServerCertificateError=void 0;var n=r(91261),i=function(e){function t(r,n){return e.call(this,t.NAME,r,n)||this}return n.__extends(t,e),t.NAME="SetServerCertificate",t}(r(93218).WrappedError);t.SetServerCertificateError=i},93452:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebKitKeyError=void 0;var n=r(91261),i=function(e){function t(r,n){return e.call(this,t.NAME,r,n)||this}return n.__extends(t,e),t.NAME="WebKitKey",t}(r(93218).WrappedError);t.WebKitKeyError=i},60251:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkResponseWrapper=void 0;var n=r(91261),i=r(78442),o=r(8339),a=r(51106),s=r(92470),u=r(91110),l=r(93678),c=r(60909),d=r(28813),p=r(8125),f=r(63306),h=function(){function e(e,t,r){this._canceled=!1,this._openXhr=new p.Map,this._openRejects=new d.Set,this._system=e,this._request=t,this._options=r,this._networkProgress=this._system.networkProgressEvent,this._networkResponse=this._system.networkResponseEvent}return e.prototype._handleError=function(e){return!this._canceled||e instanceof l.OperationCanceledError?e:new l.OperationCanceledError("error after canceled")},e.prototype.cancel=function(){var e=this;this._canceled=!0,this._openRejects.forEach(function(t){t(new l.OperationCanceledError("xhr canceled to ".concat(e._request.resource,"\n request header information: ").concat(e._getRequestHeaderString(e._request.headers))))}),this._openXhr.forEach(function(t,r){t.abort();var i=n.__assign(n.__assign({},r),{responseType:"canceled"});e._emitNetworkResponse(i)})},e.prototype.payloadReference=function(){return n.__awaiter(this,void 0,void 0,function(){var t,r,i;return n.__generator(this,function(n){switch(n.label){case 0:return[4,this._payload("arraybuffer")];case 1:return t=n.sent(),r="reference-".concat(e.REFERENCE_ID++),[4,this._system.setPayloadReferenceData(r,t.data)];case 2:return i=n.sent(),[2,{status:t.status,data:i}]}})})},e.prototype.payloadBuffer=function(){return n.__awaiter(this,void 0,void 0,function(){var t;return n.__generator(this,function(r){switch(r.label){case 0:return[4,this._payload("arraybuffer")];case 1:return(t=r.sent()).data.byteLength>e.SERIALIZED_WARN_BYTES&&this._system.logWarn("Large payload serialized (".concat(t.data.byteLength," bytes): ").concat(this._request.resource)),[2,t]}})})},e.prototype.payloadString=function(){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(e){switch(e.label){case 0:return[4,this._payload("text")];case 1:return[2,e.sent()]}})})},e.prototype._payload=function(e){return n.__awaiter(this,void 0,void 0,function(){var t,r,i,o;return n.__generator(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,3,4]),[4,this._getResponse(e)];case 1:return t=(o=n.sent()).xhr,r=o.response,[2,{status:t.status,data:r}];case 2:throw i=n.sent(),this._handleError(i);case 3:return void 0!==t&&this._openXhr.delete(t),[7];case 4:return[2]}})})},e.prototype._getXMLHttpRequest=function(){return new XMLHttpRequest},e.prototype._emitNetworkProgress=function(e,t,r){this._networkProgress.emit(n.__assign(n.__assign({},this._request),{bytes:"string"==typeof r?r.length:r.byteLength,downloadTimeMS:e,latency:t}))},e.prototype._emitNetworkResponse=function(e){this._networkResponse.emit(e)},e.prototype._emitNetworkResponseFailed=function(e){var t={responseType:"failed",error:"Network error",errorCode:"N/A",errorText:"An error occurred.",requestStart:Date.now(),requestHostname:"",requestUrl:""},r=n.__assign(n.__assign({},t),e);this._emitNetworkResponse(r)},e.prototype._getResponse=function(t){var r=this;if(this._canceled)throw new l.OperationCanceledError("response already canceled");return new Promise(function(o,l){var d,p,h,m,v,g=r._getXMLHttpRequest(),y=new Date().getTime(),_=[],b=0;r._openRejects.add(l);var S=new f.Uri(r._request.resource),w={originalRequest:r._request,requestStart:y,requestUrl:r._request.resource,requestHostname:S.getDomain()},E=function(){void 0!==h&&(clearTimeout(h),h=void 0)},x=function(){r._openRejects.delete(l),E()},T=function(){var e,t=null!==(e=r._request.progressTimeoutMS)&&void 0!==e?e:0;E(),t>0&&(h=setTimeout(function(){var e="No network progress was made in ".concat(t," ms, ").concat(r._getErrorContextString(g,_)),i=n.__assign(n.__assign({},w),{responseType:"failed",error:u.NoProgressMadeError.NAME,errorText:e});r._emitNetworkResponseFailed(i),g.abort(),x(),l(new s.NetworkRequestError("Progress timeout expired",r._getContext(g),[new u.NoProgressMadeError(e,void 0,r._getMaxReadyStateBeforeDone.apply(r,n.__spreadArray(n.__spreadArray([],_,!1),[g.readyState],!1)),b)]))},t))};if(r._openXhr.set(g,w),g.onabort=x,g.open(r._request.method,r._request.resource,!0),g.timeout=void 0!==r._request.timeoutMS?r._request.timeoutMS:e.XHR_DEFAULT_TIMEOUT_MS,g.responseType=t,void 0!==r._request.headers){for(var P=0,C=Object.keys(r._request.headers);Pp){var t="received ".concat(e.loaded," bytes but requested only ").concat(p," bytes, ").concat(r._getErrorContextString(g,_,e)),o=n.__assign(n.__assign({},w),{responseType:"failed",error:i.ByteRangeMismatchError.NAME,errorText:t});r._emitNetworkResponseFailed(o),g.abort(),x(),l(new s.NetworkRequestError("Received more bytes during progress event than expected",r._getContext(g),[new i.ByteRangeMismatchError(t)]))}if(void 0!==e.loaded){var u=null!=p?p:e.total;void 0!==u&&0!==u&&(b=Math.floor(e.loaded/u*100))}},g.onerror=function(e){x();var t="Network failure, ".concat(r._getErrorContextString(g,_,e)),i=n.__assign(n.__assign({},w),{responseType:"failed",error:s.NetworkRequestError.NAME,errorText:t});r._emitNetworkResponseFailed(i),l(new s.NetworkRequestError(t,r._getContext(g)))},g.ontimeout=function(e){x();var t="Network response timed out, ".concat(r._getErrorContextString(g,_,e)),i=n.__assign(n.__assign({},w),{responseType:"failed",error:c.OperationTimedOutError.NAME,errorText:t});r._emitNetworkResponseFailed(i),l(new s.NetworkRequestError("XHR ontimeout received",r._getContext(g),[new c.OperationTimedOutError(t,void 0,r._getMaxReadyStateBeforeDone.apply(r,n.__spreadArray(n.__spreadArray([],_,!1),[g.readyState],!1)),b)]))},g.onload=function(e){x(),v=Date.now();var u,c,d,f=r._getTypedResponse(g,t);if(null===f){var h=n.__assign(n.__assign({},w),{responseType:"failed",error:s.NetworkRequestError.NAME,errorText:"Did not receive response."});r._emitNetworkResponseFailed(h),l(new s.NetworkRequestError("did not receive response, visibility=".concat(r._getVisibilityState()),r._getContext(g)));return}var b=parseInt(null!==(u=g.getResponseHeader("Content-Length"))&&void 0!==u?u:""),S=null!==(c=g.getResponseHeader("Content-Type"))&&void 0!==c?c:"";if(void 0===p&&isFinite(b)&&-1!==S.indexOf("mp4")&&(p=b),void 0!==p&&f instanceof ArrayBuffer&&a.NetworkHelpers.isSuccessfulResponseCode(g.status)&&f.byteLengthe)&&(e=i)}return e},e.prototype._getTypedResponse=function(e,t){var r=e.response;if(null===r)return null;if(e.responseType!==t)throw new o.InvalidOperationError('mismatched responseType ("'.concat(e.responseType,'" !== "').concat(t,'")'));switch(t){case"text":if("string"==typeof r)return r;throw new s.NetworkRequestError("response is not string type (".concat(e.responseType,")"),this._getContext(e));case"arraybuffer":if(r instanceof ArrayBuffer)return r;throw new s.NetworkRequestError("response is not ArrayBuffer type (".concat(e.responseType,")"),this._getContext(e))}},e.XHR_DEFAULT_TIMEOUT_MS=0,e.SERIALIZED_WARN_BYTES=1048576,e.REFERENCE_ID=0,e}();t.NetworkResponseWrapper=h},7088:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Platform=void 0;var n,i,o,a,s,u,l,c,d,p,f,h,m,v,g,y,_,b,S,w,E,x,T,P,C,M,k,D,A,R=r(91261),O=new(r(96798)).HashMap,I=function(e,t){return function(r){var n=String(t.name);return void 0!==r&&(n+=r),O.contains(n)||O.set(n,e.call(this,r)),O.get(n)}},Z=(D=[],n=function(){function e(){R.__runInitializers(this,D)}return e.prototype.isLinux=function(){var e=this._getPlatform();return void 0!==e&&-1!==e.indexOf("Linux")},e.prototype.isTizen=function(){var e=this._getUserAgent();return void 0!==e&&-1!==e.indexOf("Tizen")},e.prototype.isVizio=function(){var e=this._getUserAgent();return void 0!==e&&-1!==e.indexOf("VIZIO")},e.prototype.isSagemcom=function(){var e=this._getUserAgent();return void 0!==e&&-1!==e.indexOf("Sagemcom")},e.prototype.isClaro=function(e){var t=this._getUserAgent();if(void 0===t)return!1;var r=-1!==t.indexOf("CrOS ARM");return -1!==t.indexOf("TeleIDEA")&&(void 0===e||e&&r||!e&&!r)},e.prototype.isWebOS=function(){var e=this._getUserAgent();return void 0!==e&&-1!==e.indexOf("Web0S")},e.prototype.isXbox=function(){var e=this._getUserAgent();return void 0!==e&&-1!==e.indexOf("Xbox")||this.isChromiumWebView2()},e.prototype.isChromiumWebView2=function(){return this.isChromiumEdge()&&this._isWebView2Component()},e.prototype.isEnseo=function(){var e=this._getUserAgent();return void 0!==e&&-1!==e.indexOf("Enseo")},e.prototype.isSkyQ=function(){var e=this._getUserAgent();return void 0!==e&&-1!==e.indexOf("Sky_")},e.prototype.isChromecast=function(){var e=this._getUserAgent();return void 0!==e&&-1!==e.indexOf("CrKey")},e.prototype.isComcastSetTopBox=function(){return"undefined"!=typeof XREReceiver},e.parseTizenVersion=function(e){if(void 0!==e){var t=e.match(/Tizen (\d+(\.\d+)?)/);return null==t?void 0:t[1]}},e.prototype._getUserAgent=function(){return navigator.userAgent},e.prototype._getVendor=function(){return navigator.vendor},e.prototype._getPlatform=function(){return navigator.platform},e.prototype._getNavigatorUA=function(){return navigator},e.prototype._getWebOsWindow=function(){return window},e.prototype._hasTizenOnGlobal=function(){return"undefined"!=typeof tizen},e.prototype._hasYouViewOnGlobal=function(){return"undefined"!=typeof youview},e.prototype._logMessage=function(e,t,r){!0===r?console.warn(e,t):void 0!==t?console.error(e,t):console.log(e)},e.prototype._getTizenVersion=function(){if(void 0!==n._cachedTizenVersion)return n._cachedTizenVersion;if(this._hasTizenOnGlobal()){var e=n.parseTizenVersion(this._getUserAgent());if(void 0===e){var t=tizen.systeminfo;if(void 0===t)return;try{return n._cachedTizenVersion=parseFloat(t.getCapability("http://tizen.org/feature/platform.version"))}catch(e){this._logMessage("Failed to get Tizen device capability",e,!0);return}}return n._cachedTizenVersion=parseFloat(e)}},e.prototype.getWebOsVersion=function(){var e,t=this,r=this._getWebOsWindow();if(this.isWebOS()&&void 0!==r.webOS&&void 0!==r.webOS.service)return void 0===n._cachedWebOsMajorVersionPromise&&(n._cachedWebOsMajorVersionPromise=Promise.race([new Promise(function(r){e=setTimeout(function(){t._logMessage("timed out querying webOS version",void 0,!0),r(void 0)},1e4)}),new Promise(function(n){r.webOS.service.request("luna://com.webos.service.config",{method:"getConfigs",parameters:{configNames:["tv.nyx.platformVersion"]},onSuccess:function(r){var i;if(void 0!==r&&void 0!==r.configs&&void 0!==r.configs["tv.nyx.platformVersion"]){var o=parseInt(r.configs["tv.nyx.platformVersion"].split(".")[0]);isFinite(o)&&(i=o)}void 0===i&&t._logMessage("could not find platformVersion config to determine webOS version"),clearTimeout(e),n(i)},onFailure:function(r){t._logMessage("failed to determine webOS version",r),clearTimeout(e),n(void 0)}})})])),n._cachedWebOsMajorVersionPromise},e.prototype._isTizenVersion=function(e,t){var r=this._getTizenVersion();return void 0!==r&&r>=t&&r=e)}return n},e._clearCache=function(){O.clear()},e}(),A="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0,i=[I],o=[I],a=[I],s=[I],u=[I],l=[I],c=[I],d=[I],p=[I],f=[I],h=[I],m=[I],v=[I],g=[I],y=[I],_=[I],b=[I],S=[I],w=[I],E=[I],x=[I],T=[I],P=[I],C=[I],M=[I],k=[I],R.__esDecorate(n,null,i,{kind:"method",name:"isLinux",static:!1,private:!1,access:{has:function(e){return"isLinux"in e},get:function(e){return e.isLinux}},metadata:A},null,D),R.__esDecorate(n,null,o,{kind:"method",name:"isTizen",static:!1,private:!1,access:{has:function(e){return"isTizen"in e},get:function(e){return e.isTizen}},metadata:A},null,D),R.__esDecorate(n,null,a,{kind:"method",name:"isVizio",static:!1,private:!1,access:{has:function(e){return"isVizio"in e},get:function(e){return e.isVizio}},metadata:A},null,D),R.__esDecorate(n,null,s,{kind:"method",name:"isSagemcom",static:!1,private:!1,access:{has:function(e){return"isSagemcom"in e},get:function(e){return e.isSagemcom}},metadata:A},null,D),R.__esDecorate(n,null,u,{kind:"method",name:"isClaro",static:!1,private:!1,access:{has:function(e){return"isClaro"in e},get:function(e){return e.isClaro}},metadata:A},null,D),R.__esDecorate(n,null,l,{kind:"method",name:"isWebOS",static:!1,private:!1,access:{has:function(e){return"isWebOS"in e},get:function(e){return e.isWebOS}},metadata:A},null,D),R.__esDecorate(n,null,c,{kind:"method",name:"isXbox",static:!1,private:!1,access:{has:function(e){return"isXbox"in e},get:function(e){return e.isXbox}},metadata:A},null,D),R.__esDecorate(n,null,d,{kind:"method",name:"isChromiumWebView2",static:!1,private:!1,access:{has:function(e){return"isChromiumWebView2"in e},get:function(e){return e.isChromiumWebView2}},metadata:A},null,D),R.__esDecorate(n,null,p,{kind:"method",name:"isEnseo",static:!1,private:!1,access:{has:function(e){return"isEnseo"in e},get:function(e){return e.isEnseo}},metadata:A},null,D),R.__esDecorate(n,null,f,{kind:"method",name:"isSkyQ",static:!1,private:!1,access:{has:function(e){return"isSkyQ"in e},get:function(e){return e.isSkyQ}},metadata:A},null,D),R.__esDecorate(n,null,h,{kind:"method",name:"isChromecast",static:!1,private:!1,access:{has:function(e){return"isChromecast"in e},get:function(e){return e.isChromecast}},metadata:A},null,D),R.__esDecorate(n,null,m,{kind:"method",name:"isComcastSetTopBox",static:!1,private:!1,access:{has:function(e){return"isComcastSetTopBox"in e},get:function(e){return e.isComcastSetTopBox}},metadata:A},null,D),R.__esDecorate(n,null,v,{kind:"method",name:"_hasTizenOnGlobal",static:!1,private:!1,access:{has:function(e){return"_hasTizenOnGlobal"in e},get:function(e){return e._hasTizenOnGlobal}},metadata:A},null,D),R.__esDecorate(n,null,g,{kind:"method",name:"_hasYouViewOnGlobal",static:!1,private:!1,access:{has:function(e){return"_hasYouViewOnGlobal"in e},get:function(e){return e._hasYouViewOnGlobal}},metadata:A},null,D),R.__esDecorate(n,null,y,{kind:"method",name:"_isWebView2Component",static:!1,private:!1,access:{has:function(e){return"_isWebView2Component"in e},get:function(e){return e._isWebView2Component}},metadata:A},null,D),R.__esDecorate(n,null,_,{kind:"method",name:"isTizen2017",static:!1,private:!1,access:{has:function(e){return"isTizen2017"in e},get:function(e){return e.isTizen2017}},metadata:A},null,D),R.__esDecorate(n,null,b,{kind:"method",name:"isTizen2016",static:!1,private:!1,access:{has:function(e){return"isTizen2016"in e},get:function(e){return e.isTizen2016}},metadata:A},null,D),R.__esDecorate(n,null,S,{kind:"method",name:"isChromiumEdge",static:!1,private:!1,access:{has:function(e){return"isChromiumEdge"in e},get:function(e){return e.isChromiumEdge}},metadata:A},null,D),R.__esDecorate(n,null,w,{kind:"method",name:"isLegacyEdge",static:!1,private:!1,access:{has:function(e){return"isLegacyEdge"in e},get:function(e){return e.isLegacyEdge}},metadata:A},null,D),R.__esDecorate(n,null,E,{kind:"method",name:"isFirefox",static:!1,private:!1,access:{has:function(e){return"isFirefox"in e},get:function(e){return e.isFirefox}},metadata:A},null,D),R.__esDecorate(n,null,x,{kind:"method",name:"isYouView",static:!1,private:!1,access:{has:function(e){return"isYouView"in e},get:function(e){return e.isYouView}},metadata:A},null,D),R.__esDecorate(n,null,T,{kind:"method",name:"isWindows",static:!1,private:!1,access:{has:function(e){return"isWindows"in e},get:function(e){return e.isWindows}},metadata:A},null,D),R.__esDecorate(n,null,P,{kind:"method",name:"isPlayStation",static:!1,private:!1,access:{has:function(e){return"isPlayStation"in e},get:function(e){return e.isPlayStation}},metadata:A},null,D),R.__esDecorate(n,null,C,{kind:"method",name:"isPlayStation4",static:!1,private:!1,access:{has:function(e){return"isPlayStation4"in e},get:function(e){return e.isPlayStation4}},metadata:A},null,D),R.__esDecorate(n,null,M,{kind:"method",name:"isPlayStation5",static:!1,private:!1,access:{has:function(e){return"isPlayStation5"in e},get:function(e){return e.isPlayStation5}},metadata:A},null,D),R.__esDecorate(n,null,k,{kind:"method",name:"isSafari",static:!1,private:!1,access:{has:function(e){return"isSafari"in e},get:function(e){return e.isSafari}},metadata:A},null,D),A&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:A}),n);t.Platform=Z},61572:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PlatformCapabilities=void 0;var n=r(91261),i=r(72949),o=r(7088),a=r(30617),s={type:"media-source",video:{hdrMetadataType:"smpteSt2086",colorGamut:"rec2020",transferFunction:"pq",contentType:"video/mp4; codecs=hvc1.2.4.L120.90",width:3840,height:2160,bitrate:3e7,framerate:24}},u={type:"media-source",video:{hdrMetadataType:"smpteSt2094-10",colorGamut:"rec2020",transferFunction:"pq",contentType:"video/mp4; codecs=dvh1.05.06",width:3840,height:2160,bitrate:3e7,framerate:24}},l={type:"media-source",audio:{contentType:"audio/mp4; codecs=ec-3",spatialRendering:!0}},c=function(){function e(e){this._logger=e,this._platform=new o.Platform}return e.prototype.requireSingleKey=function(){return this._platform.isTizen2016()},e.prototype.requireSingleFramerate=function(){return this._platform.isTizen2016()},e.prototype.useSupplementalCodecsOverride=function(){return!!this._platform.isVizio()||!!this._platform.isWebOS()&&this._webOsUseSupplementalCodecsOverride()},e.prototype._webOsUseSupplementalCodecsOverride=function(){return n.__awaiter(this,void 0,void 0,function(){var e,t;return n.__generator(this,function(r){switch(r.label){case 0:return[4,this._platform.getWebOsVersion()];case 1:return e=r.sent(),[4,this.getWebOsHdrModes()];case 2:return t=r.sent(),[2,void 0!==e&&e>=6&&void 0!==t&&-1!==t.indexOf("dvh")]}})})},e.prototype.getKeyTypesWhichMayBeRestricted=function(){var e=new i.HashSet(["video-fhd"]);return this._platform.isTizen()||this._platform.isWebOS()||this._platform.isVizio()||e.add("video-hd"),e},e.prototype.getSupportedHdrModes=function(){return this._platform.isTizen()?this.getTizenHdrModes():this._platform.isXbox()?this.getXboxHdrModes():this._platform.isPlayStation()?this.getPlayStationHdrModes():this._platform.isWebOS()?this.getWebOsHdrModes():this._platform.isVizio()?this.getVizioHdrModes():this._platform.isChromiumEdge()||this._platform.isSafari()?this.getBrowserHdrModes():[]},e.prototype._canPlayDolbyAtmos=function(){return n.__awaiter(this,void 0,void 0,function(){var e;return n.__generator(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,navigator.mediaCapabilities.decodingInfo(l)];case 1:return[2,(e=t.sent()).supported&&e.smooth];case 2:return console.warn(t.sent()),[2,!1];case 3:return[2]}})})},e.prototype.canPlayDolbyAtmos=function(){return this._platform.isChromiumEdge()||this._platform.isSafari()?this._canPlayDolbyAtmos():!!this._platform.isXbox()&&this._canXboxPlayDolbyAtmos()},e.prototype.supportsExactSeeks=function(){return!this._platform.isClaro(!0)},e.prototype.supportsMediaKeySystemAccessGetConfiguration=function(){return!this._platform.isClaro(!0)&&!this._platform.isComcastSetTopBox()&&!this._platform.isSagemcom()&&!this._platform.isXbox()},e.prototype.supportsMediaKeySystemMediaCapabilityRobustnessProbing=function(){return this._platform.isChromecast()},e.prototype.supportsMultiCodecMediaKeys=function(){return this.supportsMediaKeySystemAccessGetConfiguration()},e.prototype.isTizenDisplay4kHdr=function(){return this.isTizenDisplay4k()&&void 0!==this.getTizenHdrModes()},e.prototype.isTizenDisplay4k=function(){if(!this._platform.isTizen())return!1;if(void 0===this._tizen4k){var e=window;try{void 0!==e.webapis&&e.webapis.productinfo.isUdPanelSupported()?this._tizen4k=!0:this._tizen4k=!1}catch(e){this._tizen4k=void 0}}return!0===this._tizen4k},e.prototype.getTizenHdrModes=function(){if(this._platform.isTizen()){if(void 0===this._tizenHdrModes){var e=window;try{void 0!==e.webapis&&e.webapis.avinfo.isHdrTvSupport()?this._tizenHdrModes=["hevc-hdr"]:this._tizenHdrModes=[]}catch(e){this._tizenHdrModes=void 0}}return this._tizenHdrModes}},e.prototype.getWebOsHdrModes=function(){var e,t=window;if(void 0!==t.webOS&&void 0!==t.webOS.service)return Promise.race([new Promise(function(t){e=setTimeout(function(){console.warn("timed out querying hdr modes"),t(void 0)},1e4)}),new Promise(function(r){t.webOS.service.request("luna://com.webos.service.config",{method:"getConfigs",parameters:{configNames:["tv.model.supportHDR","tv.config.supportDolbyHDRContents","tv.config.supportDolbyTVATMOS"]},onSuccess:function(t){var n=[];(null==t?void 0:t.configs)!==void 0&&(null==t?void 0:t.configs["tv.model.supportHDR"])===!0&&n.push("hevc-hdr"),(null==t?void 0:t.configs)!==void 0&&(null==t?void 0:t.configs["tv.config.supportDolbyHDRContents"])===!0&&n.push("dvh"),clearTimeout(e),r(n)},onFailure:function(t){console.error("failed to determine hdr modes",t),clearTimeout(e),r(void 0)}})})])},e.prototype.isXboxDisplay4k=function(){if(!this._platform.isXbox())return!1;var e=window;try{if(void 0!==e.Windows){var t=e.Windows.Graphics.Display.Core.HdmiDisplayInformation.getForCurrentView().getCurrentDisplayMode();if(3840===t.resolutionWidthInRawPixels&&2160===t.resolutionHeightInRawPixels)return!0}}catch(e){}return!1},e.prototype.getXboxHdrModes=function(){if(this._platform.isXbox()){var e=window;try{if(void 0!==e.Windows){var t=e.Windows.Graphics.Display.Core.HdmiDisplayInformation.getForCurrentView().getCurrentDisplayMode(),r=[];return t.isSmpte2084Supported&&t.is2086MetadataSupported&&r.push("hevc-hdr"),t.isDolbyVisionLowLatencySupported&&r.push("dvh"),r}}catch(e){return}}},e.prototype.getXboxAvailableHdrModes=function(){if(this._platform.isXbox()){var e=window;try{if(void 0!==e.Windows){for(var t=e.Windows.Graphics.Display.Core.HdmiDisplayInformation.getForCurrentView().getSupportedDisplayModes(),r=!1,n=!1,i=0;i=0;o--)(void 0===t||i[o]===t)&&i.splice(o,1);0===i.length&&n.push(r)}}),n.forEach(function(e){r._handlerMap.delete(e)})},e.prototype.once=function(e,t){var r=this,n=function(i){r.off(e,n),t(i)};this.on(e,n)},e.prototype.emit=function(e){this._handlerMap.forEach(function(t,r){n.__spreadArray([],r,!0).forEach(function(t){t(e)})})},e}();t.Emitter=o},96798:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HashMap=void 0;var n=r(8339),i=function(){function e(e){if(this._data={},void 0!==e)for(var t=0;t=0&&(this._keyArray.splice(t,1),this._complexValueArray.splice(t,1),!0)},e.prototype.forEach=function(e){var t=this,r=this._keyArray.slice(),n=this._complexValueArray.slice();r.forEach(function(r,i){return e(n[i],r,t)})},Object.defineProperty(e.prototype,"size",{get:function(){return this._keyArray.length},enumerable:!1,configurable:!0}),e.prototype.clear=function(){this._keyArray=[],this._complexValueArray=[]},e}();t.MapPolyfill=r},28813:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Set=t.SetPolyfill=void 0;var r=function(){function e(e){this._items=[];for(var t=0,r=null!=e?e:[];t0){var u=e.split(String(t));this.setScheme(null!==(r=u[e._componentIndexMap.scheme])&&void 0!==r?r:"",!0),this.setUserInfo(null!==(n=u[e._componentIndexMap.userInfo])&&void 0!==n?n:"",!0),this.setDomain(null!==(i=u[e._componentIndexMap.domain])&&void 0!==i?i:"",!0),this.setPort(Number(u[e._componentIndexMap.port])),this.setPath(null!==(o=u[e._componentIndexMap.path])&&void 0!==o?o:"",!0),this.setQueryData(null!==(a=u[e._componentIndexMap.queryData])&&void 0!==a?a:""),this.setFragment(null!==(s=u[e._componentIndexMap.fragment])&&void 0!==s?s:"",!0)}}return e.split=function(t){var r=[],n=t.match(e._regexMap.split);if(null!==n)for(var i=0;i>4&15).toString(16)+(15&t).toString(16)});return!0===n&&(i=e._removeDoubleEncoding(i)),i},e._removeDoubleEncoding=function(t){return t.replace(e._regexMap.doubleEncode,"%$1")},e.prototype.hasScheme=function(){return!!this._scheme},e.prototype.getScheme=function(){return this._scheme},e.prototype.setScheme=function(t,r){this._scheme=!0===r?e._decodeOrEmpty(t,!0):t,this._scheme.length>0&&(this._scheme=this._scheme.replace(e._regexMap.colonAtEnd,""))},e.prototype.hasUserInfo=function(){return!!this._userInfo},e.prototype.getUserInfo=function(){return this._userInfo},e.prototype.setUserInfo=function(t,r){this._userInfo=!0===r?e._decodeOrEmpty(t):t},e.prototype.hasDomain=function(){return!!this._domain},e.prototype.getDomain=function(){return this._domain},e.prototype.setDomain=function(t,r){this._domain=!0===r?e._decodeOrEmpty(t,!0):t},e.prototype.hasPort=function(){return!!this._port},e.prototype.getPort=function(){return this._port},e.prototype.setPort=function(e){(isNaN(e=Number(e))||e<0)&&(e=0),this._port=e},e.prototype.hasPath=function(){return!!this._path},e.prototype.getPath=function(){return this._path},e.prototype.setPath=function(t,r){this._path=!0===r?e._decodeOrEmpty(t,!0):t},e.prototype.hasQueryData=function(){return""!==this._queryData},e.prototype.getQueryData=function(){return this._queryData},e.prototype.setQueryData=function(e){this._queryData=e},e.prototype.hasFragment=function(){return!!this._fragment},e.prototype.getFragment=function(){return this._fragment},e.prototype.setFragment=function(t,r){this._fragment=!0===r?e._decodeOrEmpty(t):t},e.prototype.toString=function(){var t=[],r=this.getScheme(),n=this.getDomain();if(""!==r&&t.push(e._encodeSpecialChars(r,e._regexMap.disallowedInSchemeOrUserInfo,!0),":"),""!==n){t.push("//");var i=this.getUserInfo();""!==i&&t.push(e._encodeSpecialChars(i,e._regexMap.disallowedInSchemeOrUserInfo,!0),"@"),t.push(e._removeDoubleEncoding(encodeURIComponent(n)));var o=this.getPort();0!==o&&t.push(":",String(o))}return t.push(this.toRelativeString()),t.join("")},e.prototype.toRelativeString=function(){var t=[],r=this.getPath(),n=this.getQueryData(),i=this.getFragment();if(""!==r){var o="/"===r[0];this.hasDomain()&&!o&&t.push("/"),t.push(e._encodeSpecialChars(r,o?e._regexMap.disallowedInAbsolutePath:e._regexMap.disallowedInRelativePath,!0))}return""!==n&&t.push("?",n),""!==i&&t.push("#",e._encodeSpecialChars(i,e._regexMap.disallowedInFragment)),t.join("")},e.prototype.resolve=function(t){var r=new e(this);if("data"===r.getScheme()&&(r=new e),t.hasScheme()&&r.setScheme(t.getScheme()),t.hasUserInfo()&&r.setUserInfo(t.getUserInfo()),t.hasDomain()&&r.setDomain(t.getDomain()),(t.hasPort()||t.hasDomain())&&r.setPort(t.getPort()),t.hasPath()){var n=t.getPath();if("/"!==n[0]){if(this.hasDomain()&&!this.hasPath())n="/"+n;else{var i=r.getPath().lastIndexOf("/");-1!==i&&(n=r.getPath().substring(0,i+1)+n)}}r.setPath(n)}return t.hasQueryData()?r.setQueryData(t.getQueryData()):r.setQueryData(""),t.hasFragment()?r.setFragment(t.getFragment()):r.setFragment(""),r},e.prototype.relativeUri=function(t){if(!this.hasScheme()||!t.hasScheme()||this.getScheme()!==t.getScheme()||this.getUserInfo()!==t.getUserInfo()||this.getDomain()!==t.getDomain()||this.getPort()!==t.getPort())return new e(this);for(var r=this.getPath().split("/"),n=t.getPath().split("/"),i=Math.min(r.length,n.length),o=0;o1)a.push("");else if(o===r.length&&n.length===r.length+1)a.push(".");else for(var s=0;s0&&a.push(r[s-1]),a.push(r[s]);var u=new e;return u.setPath(a.join("/")),u.setQueryData(this.getQueryData()),u.setFragment(this.getFragment()),u},e._componentIndexMap={scheme:1,userInfo:2,domain:3,port:4,path:5,queryData:6,fragment:7},e._regexMap={colonAtEnd:/:$/,doubleEncode:/%25([0-9a-fA-F]{2})/g,disallowedInSchemeOrUserInfo:/[#/?@]/g,disallowedInRelativePath:/[#?:]/g,disallowedInAbsolutePath:/[#?]/g,disallowedInQuery:/[#?@]/g,disallowedInFragment:/#/g,split:RegExp("^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$")},e}();t.Uri=r},43955:function(e,t){"use strict";var r;t.n=void 0,(r||(t.n=r={})).ENTITLEMENT="entitlement"},48679:function(e,t){"use strict";var r,n;(n=r||(r={})).CTR="ctr",n.CBC="cbc"},97437:function(e,t){"use strict";var r,n;t.J=void 0,(n=r||(t.J=r={})).UNKNOWN="unknown",n.AUDIO="audio",n.VIDEO_SD="video-sd",n.VIDEO_HD="video-hd",n.VIDEO_FHD="video-fhd",n.VIDEO_UHD1="video-uhd1",n.VIDEO_UHD2="video-uhd2"},97503:function(e,t){"use strict";var r,n;(n=r||(r={})).OPTIONAL="optional",n.REQUIRED="required",n.NOT_ALLOWED="not-allowed"},74929:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AppendBufferError=void 0;var n=r(91261),i=function(e){function t(r,n,i){return e.call(this,t.NAME,r,n,i)||this}return n.__extends(t,e),t.NAME="AppendBuffer",t}(r(93218).WrappedError);t.AppendBufferError=i},78442:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ByteRangeMismatchError=void 0;var n=r(91261),i=function(e){function t(r,n){return e.call(this,t.NAME,r,n)||this}return n.__extends(t,e),t.NAME="ByteRangeMismatch",t}(r(93218).WrappedError);t.ByteRangeMismatchError=i},8339:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidOperationError=void 0;var n=r(91261),i=function(e){function t(r,n,i){return e.call(this,t.NAME,r,n,i)||this}return n.__extends(t,e),t.NAME="InvalidOperation",t}(r(93218).WrappedError);t.InvalidOperationError=i},92470:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkRequestError=void 0;var n=r(91261),i=r(93218),o=function(e){function t(r,n,i,o,a){void 0===i&&(i=[]),void 0===o&&(o=[]);var s=e.call(this,t.NAME,r,i.length>0?i[i.length-1]:void 0,a)||this;return s.context=n,s.originalErrors=i,s.requestTimes=o,s}return n.__extends(t,e),t.prototype.toString=function(){var e=i.WrappedError.getStandardMessage(this);void 0!==this.context.statusCode&&(e+="\nStatus code: ".concat(this.context.statusCode)),void 0!==this.context.responseText&&(e+="\nResponse body: ".concat(this.context.responseText)),this.requestTimes.length>0&&(e+="\nRequest times: ".concat(JSON.stringify(this.requestTimes)));for(var t=0;t0&&(r+="\nAppended buffer details:\n".concat(o.join("\n"))+"\n Total: ".concat(n," bytes")),r+i.WrappedError.getCauseMessage(this)},t.NAME="QuotaExceeded",t}(i.WrappedError);t.QuotaExceededError=o},46027:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RemoveBufferError=void 0;var n=r(91261),i=function(e){function t(r,n,i){return e.call(this,t.NAME,r,n,i)||this}return n.__extends(t,e),t.NAME="RemoveBuffer",t}(r(93218).WrappedError);t.RemoveBufferError=i},71203:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnsupportedError=void 0;var n=r(91261),i=function(e){function t(r,n){return e.call(this,t.NAME,r,n)||this}return n.__extends(t,e),t.NAME="Unsupported",t}(r(93218).WrappedError);t.UnsupportedError=i},91037:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WarningError=void 0;var n=r(91261),i=function(e){function t(r,n,i){return void 0===i&&(i=t.NAME),e.call(this,i,r,n)||this}return n.__extends(t,e),t.NAME="Warning",t}(r(93218).WrappedError);t.WarningError=i},93218:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WrappedError=void 0;var n=r(28813),i=function(){function e(t,r,n,i){this.name=t,this.message=r,this.streamType=i,void 0!==n&&(this.original=e.wrap(n),void 0===this.streamType&&(this.streamType=this.original.streamType))}return e.causedBy=function(e,t){return void 0!==this.findFirst(e,t)},e.findFirst=function(e,t){for(var r=e,i=new n.Set;void 0!==r&&!i.has(r);){if(i.add(r),"string"==typeof t){if(r.name===t)return r}else if(r instanceof t)return r;r=r.original}},e.wrap=function(t,r){return(void 0===r&&(r="Unknown"),t instanceof e)?t:new e(r,"Unknown error occurred: ".concat(String(t)))},e.prototype.toString=function(){return e.getStandardMessage(this)+e.getCauseMessage(this)},e.getStandardMessage=function(e){return"".concat(e.name,": ").concat(e.message)},e.getCauseMessage=function(e){var t="";return void 0!==e.streamType&&(t+="\nStream type: ".concat(e.streamType)),void 0!==e.original&&(t+="\nCaused by:\n".concat(e.original.toString())),t},e}();t.WrappedError=i},75874:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XmlParserError=void 0;var n=r(91261),i=function(e){function t(r,n){return e.call(this,t.NAME,r,n)||this}return n.__extends(t,e),t.NAME="XmlParser",t}(r(93218).WrappedError);t.XmlParserError=i},35548:function(e,t){"use strict";var r,n;t.i=void 0,(n=r||(t.i=r={}))[n.NONE=0]="NONE",n[n.ERROR=1]="ERROR",n[n.WARN=2]="WARN",n[n.INFO=3]="INFO",n[n.VERBOSE=4]="VERBOSE",n[n.DEBUG=5]="DEBUG"},23239:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessageList=void 0;var r=function(){function e(){this._maxEntries=e.DEFAULT_MAX_ENTRIES,this._entries=[]}return e.prototype.setMaxEntries=function(e){this._maxEntries=e,this.clear()},e.prototype.add=function(e){this._entries.push({message:e,time:Date.now()}),this._entries.length>=this._maxEntries&&this._entries.shift()},e.prototype.clear=function(){this._entries.splice(0,this._entries.length)},e.prototype.getEntries=function(){return this._entries.slice()},e.DEFAULT_MAX_ENTRIES=10,e}();t.MessageList=r},64827:function(e,t){"use strict";var r,n;t.j=void 0,(n=r||(t.j=r={})).AAC="aac",n.HEAAC="heaac",n.AC3="ac-3",n.EC3="ec-3",n.EC3_ATMOS="ec-3-atmos",n.UNKNOWN="unknown-audio"},60570:function(e,t){"use strict";var r,n;t.v=void 0,(n=r||(t.v=r={})).FAIRPLAY_2_0="com.apple.fps.2_0",n.WIDEVINE="com.widevine.alpha",n.PLAYREADY="com.microsoft.playready",n.PLAYREADY_SL3000="com.microsoft.playready.recommendation",n.CLEARKEY="org.w3.clearkey"},5177:function(e,t){"use strict";var r,n;t._=void 0,(n=r||(t._=r={}))[n.NONE=0]="NONE",n[n.AUDIODESCRIPTION=1]="AUDIODESCRIPTION",n[n.AUDIOATMOS=2]="AUDIOATMOS",n[n.TEXTFORCEDSUBTITLE=4]="TEXTFORCEDSUBTITLE",n[n.TEXTCAPTION=8]="TEXTCAPTION",n[n.TEXTEMBEDDEDCAPTION=16]="TEXTEMBEDDEDCAPTION",n[n.VIDEORANGEPQ=32]="VIDEORANGEPQ"},42136:function(e,t){"use strict";var r,n;t.K=void 0,(n=r||(t.K=r={})).DVH="dvh",n.AVC="avc",n.HEVC="hevc",n.HEVC_HDR="hevc-hdr",n.UNKNOWN="unknown-video"},8854:function(e,t){"use strict";var r,n;t.r=void 0,(n=r||(t.r=r={})).SDR="SDR",n.HDR10="HDR10",n.DOLBY_VISION_8_1="Dolby Vision 8.1",n.DOLBY_VISION_5="Dolby Vision 5"},38342:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VitalFactoryError=void 0;var n=r(91261),i=function(e){function t(r){return e.call(this,t.NAME,r)||this}return n.__extends(t,e),t.NAME="VitalFactoryError",t}(r(93218).WrappedError);t.VitalFactoryError=i},8347:function(e,t){"use strict";var r,n;t.p=void 0,(n=r||(t.p=r={})).COMPLETED="completed",n.FAILED="failed",n.CANCELED="canceled"},84634:function(e,t){"use strict";var r,n;t.p=void 0,(n=r||(t.p=r={})).VIDEO="video",n.AUDIO="audio",n.TEXT="text",n.MANIFEST="manifest",n.LICENSE="license",n.OTHER="other"},84980:function(e,t){"use strict";var r,n,i,o;t.Ol=void 0,(i=r||(r={})).SINGLE_PERIOD_EXISTING_DRM="single_period_existing_drm",i.SINGLE_PERIOD_NEW_DRM="single_period_new_drm",(o=n||(t.Ol=n={})).NONE="none",o.STUCK="stuck",o.STALLED="stalled"},30617:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PromiseUtil=void 0;var n=r(91261),i=function(){function e(){}return e.ensurePromiseType=function(e){return e instanceof Promise?e:Promise.resolve(e)},e.catchRejection=function(e,t,r){try{Promise.resolve(e()).catch(t).then(r).catch(t)}catch(e){t(e)}},e.allSettled=function(e){for(var t=[],r=0;r"!==e[r];)r++;return e.substring(t+1,r)},e.prototype._readSingleNode=function(e,t,r){void 0===r&&(r=0);var i=this._indexOfTag(e,t,!0,r);if(-1!==i){var o=i+t.length+1,a=e.indexOf("<",o),s=e.indexOf("/>",o),u=-1===a?-1:this._indexOfTag(e,"/".concat(t,">"),!1,a),l=-1!==s&&(-1===a||a>s),c=l&&(-1===u||s",o);return{type:t,attributes:e.substring(o,d).split(" "),rawBody:e.substring(d+1,u),leftover:u+t.length+3}}if(!l||-1===s)throw new n.XmlParserError("Missing close tag information for tag '".concat(t,"'"));return{type:t,attributes:e.substring(o,s).split(" "),leftover:s+2,rawBody:""}}},e.prototype._indexOfTag=function(e,t,r,n){var i,o;void 0===n&&(n=0);for(var a=this._body.indexOf("<",n);-1!==a;a=this._body.indexOf("<",n)){if(e.substring(a,a+t.length+1)==="<".concat(t)&&(!r||/[> /\t\r\n]/.test(null!==(i=e[a+t.length+1])&&void 0!==i?i:"")))return a;n=null!==(o=this._skipComment(a))&&void 0!==o?o:a+1}return -1},e.prototype._findAllXMLComments=function(e){for(var t=new i.Map,r=e.indexOf("",r+4);if(-1!==o)t.set(r,o+3),r=e.indexOf("