Z.get().streaming.buffer.stallThreshold;if(d.getIsBufferingCompleted()&&!t)return d.prepareForNonReplacementTrackSwitch(i.codec).then((function(){R.trigger(l.a.BUFFERING_COMPLETED,{},{streamId:N.id,mediaType:F})})).catch((function(){R.trigger(l.a.BUFFERING_COMPLETED,{},{streamId:N.id,mediaType:F})})),void e();h.clearScheduleTimer(),h.setSwitchTrack(!0),t?(R.trigger(l.a.BUFFER_REPLACEMENT_STARTED,{mediaType:F,streamId:N.id},{mediaType:F,streamId:N.id}),V.abortRequests(),d.prepareForReplacementTrackSwitch(i.codec).then((function(){var e=Se();return d.updateBufferTimestampOffset(e)})).then((function(){Re(),e()})).catch((function(){Re(),e()}))):d.prepareForNonReplacementTrackSwitch(i.codec).then((function(){we(),e()})).catch((function(){we(),e()}))}))},prepareQualityChange:function(e){n.debug("Preparing quality switch for type ".concat(F));var t=e.newQuality;_=!0,h.clearScheduleTimer();var r=Se(t);h.setCurrentRepresentation(r),g.prepareQualityChange(t),V.abortRequests(),d.updateBufferTimestampOffset(r).then((function(){e.reason&&e.reason.forceReplace?(R.trigger(l.a.BUFFER_REPLACEMENT_STARTED,{mediaType:F,streamId:N.id},{mediaType:F,streamId:N.id}),d.prepareForReplacementQualitySwitch().then((function(){Re(),_=!1})).catch((function(){Re(),_=!1}))):Z.get().streaming.buffer.fastSwitchEnabled?function(e){var t=z.getTime(),n=1.5*(isNaN(e.fragmentDuration)?1:e.fragmentDuration),r=V.getRequests({state:p.a.FRAGMENT_MODEL_EXECUTED,time:t+n,threshold:0})[0];if(r&&!ne()){var i=d.getBufferLevel(),a=K.getAbandonmentStateFor(N.id,F);if(r.quality=n&&a!==s.a.ABANDON_LOAD)Ce(t+n),h.setCheckPlaybackQuality(!1),h.startScheduleTimer();else ge()}else h.startScheduleTimer();_=!1}(r):ge(),Q.pushPlayListTraceMetrics(new Date,U.REPRESENTATION_SWITCH_STOP_REASON),Q.createPlaylistTraceMetrics(r.id,1e3*z.getTime(),z.getPlaybackRate())}))},getMediaInfo:function(){return i},getMediaSource:function(){return d.getMediaSource()},setMediaSource:function(e){d.setMediaSource(e)},getBuffer:_e,setExplicitBufferingTime:Ce,finalisePlayList:function(e,t){Q.pushPlayListTraceMetrics(e,t)},probeNextRequest:function(){var e=Se(),t=g&&e?g.getRepresentationForQuality(e.quality):null;return T.getNextSegmentRequestIdempotent(i,t)},prepareInnerPeriodPlaybackSeeking:function(e){return new Promise((function(t){h.clearScheduleTimer(),V.abortRequests(),d.prepareForPlaybackSeek().then((function(){var t=d.getAllRangesWithSafetyFactor(e.seekTime);return d.clearBuffers(t)})).then((function(){var n=d.getContinuousBufferTimeForTargetTime(e.seekTime);if(!isNaN(n)&&!isNaN(N.duration)&&isFinite(N.duration)&&n>=N.start+N.duration)d.setIsBufferingCompleted(!0),t();else{var r=isNaN(n)?e.seekTime:n;Ce(r),d.setSeekTarget(r);var i=[];i.push(d.updateAppendWindow());var a=Se();i.push(d.updateBufferTimestampOffset(a)),Promise.all(i).then((function(){h.setInitSegmentRequired(!0),h.setCheckPlaybackQuality(!1),h.startScheduleTimer(),t()}))}})).catch((function(e){n.error(e)}))}))},prepareOuterPeriodPlaybackSeeking:function(){return new Promise((function(e,t){try{h.clearScheduleTimer(),V.abortRequests(),d.prepareForPlaybackSeek().then((function(){return d.pruneAllSafely()})).then((function(){e()}))}catch(e){t(e)}}))},reset:function(e,n){T&&T.reset(),d&&(d.reset(e,n),d=null),h&&(h.reset(),h=null),g&&(g.reset(),g=null),b&&(b=null),K&&K.unRegisterStreamType(ee(),F),R.off(l.a.DATA_UPDATE_COMPLETED,ce,t),R.off(l.a.INIT_FRAGMENT_NEEDED,ie,t),R.off(l.a.MEDIA_FRAGMENT_NEEDED,ae,t),R.off(l.a.MEDIA_FRAGMENT_LOADED,Ie,t),R.off(l.a.BUFFER_LEVEL_STATE_CHANGED,fe,t),R.off(l.a.BUFFER_CLEARED,de,t),R.off(l.a.SEEK_TARGET,Ne,t),R.off(l.a.FRAGMENT_LOADING_ABANDONED,pe,t),R.off(l.a.FRAGMENT_LOADING_COMPLETED,me,t),R.off(l.a.SET_FRAGMENTED_TEXT_AFTER_DISABLED,ye,t),R.off(l.a.SET_NON_FRAGMENTED_TEXT,Ee,t),R.off(l.a.QUOTA_EXCEEDED,ve,t),R.off(l.a.SOURCE_BUFFER_ERROR,he,t),re(),F=null,N=null}},n=Object(f.a)(A).getInstance().getLogger(t),re(),R.on(l.a.DATA_UPDATE_COMPLETED,ce,t,{priority:u.a.EVENT_PRIORITY_HIGH}),R.on(l.a.INIT_FRAGMENT_NEEDED,ie,t),R.on(l.a.MEDIA_FRAGMENT_NEEDED,ae,t),R.on(l.a.MEDIA_FRAGMENT_LOADED,Ie,t),R.on(l.a.BUFFER_LEVEL_STATE_CHANGED,fe,t),R.on(l.a.BUFFER_CLEARED,de,t),R.on(l.a.SEEK_TARGET,Ne,t),R.on(l.a.FRAGMENT_LOADING_ABANDONED,pe,t),R.on(l.a.FRAGMENT_LOADING_COMPLETED,me,t),R.on(l.a.QUOTA_EXCEEDED,ve,t),R.on(l.a.SET_FRAGMENTED_TEXT_AFTER_DISABLED,ye,t),R.on(l.a.SET_NON_FRAGMENTED_TEXT,Ee,t),R.on(l.a.SOURCE_BUFFER_ERROR,he,t),t}G.__dashjs_factory_name="StreamProcessor";var j=c.a.getClassFactory(G),Y=n(65),q=n(68);function H(e){e=e||{};var t,n,r,i=this.context,o=Object(u.a)(i).getInstance(),s=e.errHandler,c=e.mediaPlayerModel,h=e.dashMetrics,g=Object(f.a)(i).getInstance(),m=e.streamInfo;function E(){return m.id}function v(){for(var e in r)r[e].reset();r={}}function _(e){if(e.sender){var t=e.request,r=e.response,i=t.isInitializationRequest(),s=t.mediaInfo.streamInfo;if(e.error&&(t.mediaType===a.a.AUDIO||t.mediaType===a.a.VIDEO||t.mediaType===a.a.TEXT&&t.mediaInfo.isFragmented)&&o.trigger(l.a.SERVICE_LOCATION_BLACKLIST_ADD,{entry:e.request.serviceLocation}),r&&s){var u=function(e,t,n,r){var i=new Y.a;return i.streamId=n,i.mediaInfo=t.mediaInfo,i.segmentType=t.type,i.start=t.startTime,i.duration=t.duration,i.end=i.start+i.duration,i.bytes=e,i.index=t.index,i.quality=t.quality,i.representationId=t.representationId,i.endFragment=r,i}(r,t,m.id,e.type!==l.a.FRAGMENT_LOADING_PROGRESS);o.trigger(i?l.a.INIT_FRAGMENT_LOADED:l.a.MEDIA_FRAGMENT_LOADED,{chunk:u,request:t},{streamId:s.id,mediaType:t.mediaType})}else n.warn("No "+t.mediaType+" bytes to push or stream is inactive.")}}return t={getStreamId:E,getModel:function(t){var n=r[t];return n||(n=Object(p.a)(i).create({streamInfo:m,type:t,dashMetrics:h,fragmentLoader:Object(q.a)(i).create({dashMetrics:h,mediaPlayerModel:c,errHandler:s,requestModifier:Object(P.a)(i).getInstance(),settings:e.settings,boxParser:e.boxParser,eventBus:o,events:l.a,errors:y.a,dashConstants:e.dashConstants,urlUtils:e.urlUtils,streamId:E()}),debug:g,eventBus:o,events:l.a}),r[t]=n),n},reset:function(){o.off(d.a.FRAGMENT_LOADING_COMPLETED,_,this),o.off(d.a.FRAGMENT_LOADING_PROGRESS,_,this),v()}},n=g.getLogger(t),v(),o.on(d.a.FRAGMENT_LOADING_COMPLETED,_,t),o.on(d.a.FRAGMENT_LOADING_PROGRESS,_,t),t}H.__dashjs_factory_name="FragmentController";var V=c.a.getClassFactory(H);var K=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.url=null,this.width=null,this.height=null,this.x=null,this.y=null},z=n(35);var W=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.mediaType=null,this.bitrate=null,this.width=null,this.height=null,this.scanType=null,this.qualityIndex=NaN},X=n(12);function Q(e){var t,n,r=this.context,i=e.streamInfo;function o(e){n.setTrackByIndex(e)}function s(){n&&n.reset()}return t={getStreamId:function(){return i.id},initialize:function(){n.addTracks();var e=n.getTracks();e&&e.length>0&&o(0)},provide:function(e,t){if("function"==typeof t){var r,i,a=n.getCurrentTrack();if(!a||a.segmentDuration<=0||null==e)t(null);else{(i=n.getThumbnailRequestForTime(e))&&(a.segmentDuration=i.duration),r=e%a.segmentDuration;var o=Math.floor(r*a.tilesHor*a.tilesVert/a.segmentDuration),s=new K;if(s.width=Math.floor(a.widthPerTile),s.height=Math.floor(a.heightPerTile),s.x=Math.floor(o%a.tilesHor)*a.widthPerTile,s.y=Math.floor(o/a.tilesHor)*a.heightPerTile,"readThumbnail"in a)return a.readThumbnail(e,(function(e){s.url=e,t(s)}));if(i)s.url=i.url,a.segmentDuration=NaN;else{var u=Math.floor(e/a.segmentDuration);s.url=function(e,t){var n=t+e.startNumber,r=Object(X.d)(e.templateUrl,"Number",n);return r=Object(X.d)(r,"Time",(n-1)*e.segmentDuration*e.timescale),r=Object(X.d)(r,"Bandwidth",e.bandwidth),Object(X.e)(r)}(a,u)}t(s)}}},setTrackByIndex:o,getCurrentTrackIndex:function(){return n.getCurrentTrackIndex()},getBitrateList:function(){var e=n.getTracks(),t=0;return e.map((function(e){var n=new W;return n.mediaType=a.a.IMAGE,n.qualityIndex=t++,n.bitrate=e.bitrate,n.width=e.width,n.height=e.height,n}))},reset:s},s(),n=Object(z.b)(r).create({streamInfo:i,adapter:e.adapter,baseURLController:e.baseURLController,timelineConverter:e.timelineConverter,debug:e.debug,eventBus:e.eventBus,events:e.events,dashConstants:e.dashConstants,dashMetrics:e.dashMetrics,segmentBaseController:e.segmentBaseController}),t}Q.__dashjs_factory_name="ThumbnailController";var Z=c.a.getClassFactory(Q);function $(e){var t;e=e||{};var n=[],r=Object(u.a)(this.context).getInstance(),i=e.updateEventName,a=e.addBlacklistEventName;function o(e){-1===n.indexOf(e)&&(n.push(e),r.trigger(i,{entry:e}))}function s(e){o(e.entry)}return t={add:o,contains:function(e){return!!(n.length&&e&&e.length)&&-1!==n.indexOf(e)},reset:function(){n=[]}},a&&r.on(a,s,t),t}$.__dashjs_factory_name="BlackListController";var J=c.a.getClassFactory($),ee=[a.a.VIDEO,a.a.AUDIO,a.a.TEXT,a.a.MUXED,a.a.IMAGE];function te(e){e=e||{};var t,n,r,i,s,c,d,h,g,p,E,v,_,T,b,S,A,I,R=this.context,w=Object(u.a)(R).getInstance(),N=Object(L.a)(R).getInstance(),C=e.manifestModel,D=e.mediaPlayerModel,O=e.dashMetrics,M=e.manifestUpdater,P=e.adapter,F=e.timelineConverter,k=e.capabilities,U=e.errHandler,B=e.abrController,G=e.playbackController,Y=e.eventController,q=e.mediaController,H=e.protectionController,K=e.textController,z=e.videoModel,W=e.streamInfo,X=e.settings;function Q(t,i){return new Promise((function(s,u){se(),p=!0,le();var c,f=z.getElement();ee.forEach((function(i){(i!==a.a.VIDEO||!f||f&&/^VIDEO$/i.test(f.nodeName))&&function(t,i){var s,u=P.getAllMediaInfoForType(W,t),c=[],f=null;if(!u||0===u.length)return void n.info("No "+t+" data.");t===a.a.VIDEO&&(d=!0);t===a.a.AUDIO&&(h=!0);for(var g=0,p=u.length;g0&&(q.setInitialMediaSettingsForType(t,W),K.addMediaInfosToBuffer(W,t,c));if(0===(u=u.filter((function(e){return!e.isEmbedded}))).length)return;if(t===a.a.IMAGE)return void(v=Z(R).create({streamInfo:W,adapter:P,baseURLController:e.baseURLController,timelineConverter:e.timelineConverter,debug:S,eventBus:w,events:l.a,dashConstants:o.a,dashMetrics:e.dashMetrics,segmentBaseController:e.segmentBaseController})).initialize();w.trigger(l.a.STREAM_INITIALIZING,{streamInfo:W,mediaInfo:f}),q.setInitialMediaSettingsForType(t,W);var m=function(t,n){var i=t&&t.length>0?t[0]:null,o=E.getModel(i?i.type:null),s=i?i.type:null,u=i?i.mimeType:null,l=i?i.isFragmented:null,c=j(R).create({streamInfo:W,type:s,mimeType:u,timelineConverter:F,adapter:P,manifestModel:C,mediaPlayerModel:D,fragmentModel:o,dashMetrics:e.dashMetrics,baseURLController:e.baseURLController,segmentBaseController:e.segmentBaseController,abrController:B,playbackController:G,mediaController:q,textController:K,errHandler:U,settings:X,boxParser:b,segmentBlacklistController:_});c.initialize(n,d,l),r.push(c);for(var f=0;f0&&Y.addInlineEvents(e,W.id)}}function ce(){for(var e=r.length,t=!!g.audio||!!g.video?new m.a(y.a.DATA_UPDATE_FAILED_ERROR_CODE,y.a.DATA_UPDATE_FAILED_ERROR_MESSAGE):null,n=0;n0&&e.Representation[0].ContentProtection)}function ve(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e||!e.hasOwnProperty("getStreamInfo"))return!1;var r=e.getStreamInfo(),i=n?n.getStreamInfo():oe();if(!r||!i)return!1;var a=P.getAdaptationForType(r.index,t,r),o=P.getAdaptationForType(i.index,t,i);if(!a||!o)return!a&&!o;var s=a&&o&&a.mimeType===o.mimeType,u=o.Representation_asArray.map((function(e){return e.codecs})),l=a.Representation_asArray.map((function(e){return e.codecs})),c=l.some((function(e){return u.indexOf(e)>-1})),f=l.some((function(e){return u.some((function(t){return k.codecRootCompatibleWithCodec(t,e)}))}));return c||f&&s}function _e(e){T=e}function Te(){return T}return t={initialize:function(){w.on(l.a.BUFFERING_COMPLETED,fe,t),w.on(l.a.DATA_UPDATE_COMPLETED,de,t),w.on(l.a.INBAND_EVENTS,he,t),H&&(w.on(l.a.KEY_ERROR,ue,t),w.on(l.a.SERVER_CERTIFICATE_UPDATED,ue,t),w.on(l.a.LICENSE_REQUEST_COMPLETE,ue,t),w.on(l.a.KEY_SYSTEM_SELECTED,ue,t),w.on(l.a.KEY_SESSION_CREATED,ue,t),w.on(l.a.KEY_STATUSES_CHANGED,ue,t)),K.initializeForStream(W),w.trigger(l.a.STREAM_UPDATED,{streamInfo:W})},getStreamId:function(){return W?W.id:null},activate:function(e,t){return new Promise((function(n,r){if(!s)return Te()?(s=!0,w.trigger(l.a.STREAM_ACTIVATED,{streamInfo:W}),void n(t)):void function(e,t){return Q(e,t)}(e,t).then((function(e){s=!0,w.trigger(l.a.STREAM_ACTIVATED,{streamInfo:W}),n(e)})).catch((function(e){r(e)}));n(t)}))},deactivate:te,getIsActive:function(){return s},getDuration:function(){return W?W.duration:NaN},getStartTime:ie,getId:ae,getStreamInfo:oe,getHasAudioTrack:function(){return h},getHasVideoTrack:function(){return d},startPreloading:function(e,t){return new Promise((function(i,a){Te()?a():(n.info("[startPreloading] Preloading next stream with id ".concat(ae())),_e(!0),Q(e,t).then((function(){for(var e=0;e0;){var e=I.pop(),t=e.newMediaInfo,r=ge(e.oldMediaInfo);if(!r)return;n.push(r.prepareTrackSwitch()),r.selectMediaInfo(t)}return Promise.all(n)})).then((function(){p=!1,ce(),w.trigger(l.a.STREAM_UPDATED,{streamInfo:W}),t()}))}))},reset:function(e){E&&(E.reset(),E=null),B&&W&&B.clearDataForStream(W.id),_&&(_.reset(),_=null),ne(e),W=null,w.off(l.a.DATA_UPDATE_COMPLETED,de,t),w.off(l.a.BUFFERING_COMPLETED,fe,t),w.off(l.a.INBAND_EVENTS,he,t),H&&(w.off(l.a.KEY_ERROR,ue,t),w.off(l.a.SERVER_CERTIFICATE_UPDATED,ue,t),w.off(l.a.LICENSE_REQUEST_COMPLETE,ue,t),w.off(l.a.KEY_SYSTEM_SELECTED,ue,t),w.off(l.a.KEY_SESSION_CREATED,ue,t),w.off(l.a.KEY_STATUSES_CHANGED,ue,t))},getProcessors:me,setMediaSource:function(e){for(var t=0;t1&&void 0!==arguments[1]?arguments[1]:null;return ve(e,a.a.VIDEO,t)&&ve(e,a.a.AUDIO,t)},isProtectionCompatible:function(e){return!e||ye(a.a.VIDEO,e)&&ye(a.a.AUDIO,e)},getPreloaded:Te,getIsEndedEventSignaled:function(){return A},setIsEndedEventSignaled:re,getAdapter:function(){return P},getHasFinishedBuffering:function(){return c},setPreloaded:_e,startScheduleControllers:function(){for(var e=r.length,t=0;t0&&void 0!==arguments[0]&&arguments[0];s=!0;var t=h.getValue(),n=t.url,r=g.getPatchLocation(t),i=g.getLocation(t);r&&!e?n=r:i&&(n=i),_.isRelative(n)&&(n=_.resolve(n,t.url)),c.load(n)}function I(e){if(e){if(g.getIsPatch(e)){var r=e;e=h.getValue();var u=g.isPatchValid(e,r),c=u;if(u){var f=g.getPublishTime(e);c=g.applyPatchToManifest(e,r);var d=g.getPublishTime(e);c=f.getTime()!=d.getTime()}if(!c)return t.debug("Patch provided is invalid, performing full manifest refresh"),void A(!0);e.loadedTime=new Date}}else(e=h.getValue()).loadedTime=new Date;if(h.getValue()&&h.getValue().type===o.a.DYNAMIC&&e.type===o.a.STATIC)return v.trigger(l.a.DYNAMIC_TO_STATIC),s=!1,void(a=!0);h.setValue(e);var p=new Date,m=(p.getTime()-e.loadedTime.getTime())/1e3;1e3*(n=g.getManifestUpdatePeriod(e,m))>2147483647&&(n=2147483.647),v.trigger(l.a.MANIFEST_UPDATED,{manifest:e}),t.info("Manifest has been refreshed at "+p+"["+p.getTime()/1e3+"] "),i||S()}function R(){i||(s?S(m.get().streaming.manifestUpdateRetryInterval):A())}function w(e){e.error?e.error.code===y.a.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE&&p.error(e.error):I(e.manifest)}function N(){i=!1,S()}function C(){(i=!m.get().streaming.scheduling.scheduleWhilePaused)&&b()}function D(){s=!1}return e={initialize:function(){T(),v.on(l.a.STREAMS_COMPOSED,D,this),v.on(d.a.PLAYBACK_STARTED,N,this),v.on(d.a.PLAYBACK_PAUSED,C,this),v.on(l.a.INTERNAL_MANIFEST_LOADED,w,this)},setManifest:function(e){I(e)},refreshManifest:A,getIsUpdating:function(){return s},setConfig:function(e){e&&(e.manifestModel&&(h=e.manifestModel),e.adapter&&(g=e.adapter),e.manifestLoader&&(c=e.manifestLoader),e.errHandler&&(p=e.errHandler),e.settings&&(m=e.settings))},reset:function(){v.off(d.a.PLAYBACK_STARTED,N,this),v.off(d.a.PLAYBACK_PAUSED,C,this),v.off(l.a.STREAMS_COMPOSED,D,this),v.off(l.a.INTERNAL_MANIFEST_LOADED,w,this),T()}},t=Object(f.a)(E).getInstance().getLogger(e),e}re.__dashjs_factory_name="ManifestUpdater";var ie=c.a.getClassFactory(re);function ae(){var e,t,n,r,i,a,o,s,c,d,h,g,p,E,_,T,b=this.context,S=Object(u.a)(b).getInstance(),A=Object(L.a)(b).getInstance();function I(){s=[],c=[],d=null,h=null,p=null,g=NaN,n=!1,r=!1,E=i.get().streaming.utcSynchronization.timeBetweenSyncAttempts}function R(){i.get().streaming.utcSynchronization.enabled&&!n&&!r&&p&&p.value&&p.schemeIdUri&&!isNaN(g)&&!isNaN(i.get().streaming.utcSynchronization.backgroundAttempts)&&(h&&(Date.now()-h)/1e3<30||(s=[],r=!0,function e(t){try{if(t<=0)return void B();var n=Date.now();a[p.schemeIdUri](p.value,(function(r){var i=Date.now(),a=w(n,i,r);s.push(a),e(t-1)}),(function(){B()}))}catch(e){B()}}(isNaN(i.get().streaming.utcSynchronization.backgroundAttempts)?2:i.get().streaming.utcSynchronization.backgroundAttempts)))}function w(e,t,n){return n-(t-(t-e)/2)}function N(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NaN,t=isNaN(e);t&&i.get().streaming.utcSynchronization.useManifestDateHeaderTimeSource?k():U(t,e)}function C(e){var t=Date.parse(e);return isNaN(t)&&(t=function(e){var t,n,r=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2})(?::([0-9]*)(\.[0-9]*)?)?(?:([+\-])([0-9]{2})([0-9]{2}))?/.exec(e);return t=Date.UTC(parseInt(r[1],10),parseInt(r[2],10)-1,parseInt(r[3],10),parseInt(r[4],10),parseInt(r[5],10),r[6]&&(parseInt(r[6],10)||0),r[7]&&1e3*parseFloat(r[7])||0),r[9]&&r[10]&&(n=60*parseInt(r[9],10)+parseInt(r[10],10),t+=("+"===r[8]?-1:1)*n*60*1e3),new Date(t).getTime()}(e)),t}function D(e){return Date.parse(e)}function O(e){return Date.parse(e)}function M(e,t,n){n()}function P(e,t,n){var r=C(e);isNaN(r)?n():t(r)}function x(e,t,n,r,i){var a,o,s=!1,u=new XMLHttpRequest,l=i?v.a.HEAD:v.a.GET,c=t.match(/\S+/g);if(t=c.shift(),a=function(){s||(s=!0,c.length?x(e,c.join(" "),n,r,i):r())},o=function(){var t,r;200===u.status&&(t=i?u.getResponseHeader("Date"):u.response,r=e(t),isNaN(r)||(n(r),s=!0))},A.isRelative(t)){var f=T.resolve();f&&(t=A.resolve(t,f.url))}u.open(l,t),u.timeout=5e3,u.onload=o,u.onloadend=a,u.send()}function F(e,t,n){x(O,e,t,n,!0)}function k(){var e=o.getLatestMPDRequestHeaderValueByID("Date"),t=null!==e?new Date(e).getTime():Number.NaN;isNaN(t)?U(!0):U(!1,t-Date.now())}function U(e,r){if(isNaN(g)||isNaN(r)||e||function(e){try{var n,r=G(e),a=isNaN(E)?30:E,o=isNaN(i.get().streaming.utcSynchronization.timeBetweenSyncAttemptsAdjustmentFactor)?2:i.get().streaming.utcSynchronization.timeBetweenSyncAttemptsAdjustmentFactor,s=isNaN(i.get().streaming.utcSynchronization.maximumTimeBetweenSyncAttempts)?600:i.get().streaming.utcSynchronization.maximumTimeBetweenSyncAttempts,u=isNaN(i.get().streaming.utcSynchronization.minimumTimeBetweenSyncAttempts)?2:i.get().streaming.utcSynchronization.minimumTimeBetweenSyncAttempts;r?(n=Math.min(a*o,s),t.debug("Increasing timeBetweenSyncAttempts to ".concat(n))):(n=Math.max(a/o,u),t.debug("Decreasing timeBetweenSyncAttempts to ".concat(n))),E=n}catch(e){}}(r),!e&&!isNaN(r)){d=Date.now(),n=!1;var a=isNaN(g);g=r,a&&R(),t.debug("Completed UTC sync. Setting client - server offset to ".concat(r))}e&&(p=null,n=!1,_.error(new m.a(y.a.TIME_SYNC_FAILED_ERROR_CODE,y.a.TIME_SYNC_FAILED_ERROR_MESSAGE))),S.trigger(l.a.UPDATE_TIME_SYNC_OFFSET,{offset:r}),S.trigger(l.a.TIME_SYNCHRONIZATION_COMPLETED)}function B(){if(s&&0!==s.length){var e=s.reduce((function(e,t){return e+t}),0)/s.length;G(e)?t.debug("Completed background UTC sync. Offset is within allowed threshold and is not adjusted."):(t.debug("Completed background UTC sync. Setting client - server offset to ".concat(e)),g=e,S.trigger(l.a.UPDATE_TIME_SYNC_OFFSET,{offset:g})),r=!1,h=Date.now()}}function G(e){try{if(isNaN(g))return!0;var t=i.get().streaming.utcSynchronization.maximumAllowedDrift&&!isNaN(i.get().streaming.utcSynchronization.maximumAllowedDrift)?i.get().streaming.utcSynchronization.maximumAllowedDrift:100;return e>=g-t&&e<=g+t}catch(e){return!0}}return e={initialize:function(){I(),a={"urn:mpeg:dash:utc:http-head:2014":F,"urn:mpeg:dash:utc:http-xsdate:2014":x.bind(null,C),"urn:mpeg:dash:utc:http-iso:2014":x.bind(null,D),"urn:mpeg:dash:utc:direct:2014":P,"urn:mpeg:dash:utc:http-head:2012":F,"urn:mpeg:dash:utc:http-xsdate:2012":x.bind(null,C),"urn:mpeg:dash:utc:http-iso:2012":x.bind(null,D),"urn:mpeg:dash:utc:direct:2012":P,"urn:mpeg:dash:utc:http-ntp:2014":M,"urn:mpeg:dash:utc:ntp:2014":M,"urn:mpeg:dash:utc:sntp:2014":M}},attemptSync:function(e,t){c=e,n||(!function(e){try{if(!e||!i.get().streaming.utcSynchronization.enabled)return!1;var t=isNaN(E)?30:E;return!(d&&t&&!isNaN(t))||(Date.now()-d)/1e3>=t}catch(e){return!0}}(t)?S.trigger(l.a.TIME_SYNCHRONIZATION_COMPLETED):(n=!0,function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=t||0;if(!c||0===c.length||n>=c.length)return void N();var r=c[n];if(r)if(a.hasOwnProperty(r.schemeIdUri)){var i=(new Date).getTime();a[r.schemeIdUri](r.value,(function(e){var t=(new Date).getTime(),n=w(i,t,e);p=r,N(n)}),(function(){e(n+1)}))}else e(n+1);else N()}()))},setConfig:function(e){e&&(e.dashMetrics&&(o=e.dashMetrics),e.baseURLController&&(T=e.baseURLController),e.errHandler&&(_=e.errHandler),e.settings&&(i=e.settings))},reset:function(){I(),S.off(l.a.ATTEMPT_BACKGROUND_SYNC,R,e)}},t=Object(f.a)(b).getInstance().getLogger(e),S.on(l.a.ATTEMPT_BACKGROUND_SYNC,R,e),e}ae.__dashjs_factory_name="TimeSyncController";var oe=c.a.getSingletonFactory(ae);oe.HTTP_TIMEOUT_MS=5e3,c.a.updateSingletonFactory(ae.__dashjs_factory_name,oe);var se=oe;function ue(){var e,t,n,r=this.context;return e={createMediaSource:function(){var e="WebKitMediaSource"in window;return"MediaSource"in window?t=new MediaSource:e&&(t=new WebKitMediaSource),t},attachMediaSource:function(e){var n=window.URL.createObjectURL(t);return e.setSource(n),n},detachMediaSource:function(e){e.setSource(null)},setDuration:function e(r){t&&"open"===t.readyState&&(null===r&&isNaN(r)||t.duration!==r&&(!function(e){for(var t=e.sourceBuffers,n=0;n=0&&e0?Math.max(0,i):0,S(r,i,e),S(n,i,e),A(r),A(n),a=e,c=!1}}catch(e){c=!1,t.error(e)}}function S(e,n,r){try{N(e,(function(i){if(void 0!==i){var a=isNaN(i.duration)?0:i.duration;i.calculatedPresentationTime<=r&&i.calculatedPresentationTime+n+a>=r?D(i,d.a.EVENT_MODE_ON_START):(C(r,a+n,i.calculatedPresentationTime)||function(e){try{var n=e.eventStream.period.start+e.eventStream.period.duration;return e.calculatedPresentationTime>n}catch(e){return t.error(e),!1}}(i))&&(t.debug("Removing event ".concat(i.id," from period ").concat(i.eventStream.period.id," as it is expired or invalid")),function(e,n){try{var r=n.eventStream.schemeIdUri,i=n.eventStream.period.id,a=n.eventStream.value,o=n.id;e[i][r]=e[i][r].filter((function(e){return a&&e.eventStream.value&&e.eventStream.value!==a||e.id!==o})),0===e[i][r].length&&delete e[i][r]}catch(e){t.error(e)}}(e,i))}}))}catch(e){t.error(e)}}function A(e){try{for(var n in e)e.hasOwnProperty(n)&&0===Object.keys(e[n]).length&&delete e[n]}catch(e){t.error(e)}}function I(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.eventStream.schemeIdUri,i=e.eventStream.value,a=e.id,o=g;t[r]||(t[r]=[]);var s=t[r].findIndex((function(e){return(!i||e.eventStream.value&&e.eventStream.value===i)&&e.id===a}));if(-1===s)t[r].push(e),e.triggeredReceivedEvent=!1,e.triggeredStartEvent=!1,o=m;else if(n){var u=t[r][s];e.triggeredReceivedEvent=u.triggeredReceivedEvent,e.triggeredStartEvent=u.triggeredStartEvent,t[r][s]=e,o=p}return o}function R(e){try{if(1==e.eventStream.value){var n,r=e.calculatedPresentationTime;n=4294967295==e.calculatedPresentationTime?NaN:e.calculatedPresentationTime+e.duration,E.trigger(d.a.MANIFEST_VALIDITY_CHANGED,{id:e.id,validUntil:r,newDuration:n,newManifestValidAfter:NaN},{mode:d.a.EVENT_MODE_ON_START})}}catch(e){t.error(e)}}function w(e){try{var n=s.getTime();N(e,(function(e){var t=e.eventStream&&e.eventStream.period&&!isNaN(e.eventStream.period.duration)?e.eventStream.period.duration:NaN,r=e.eventStream&&e.eventStream.period&&!isNaN(e.eventStream.period.start)?e.eventStream.period.start:NaN;if(!isNaN(t)&&!isNaN(r)){var i=e.calculatedPresentationTime;Math.abs(i-n)<300&&D(e,d.a.EVENT_MODE_ON_START)}}))}catch(e){t.error(e)}}function N(e,n){try{if(e)for(var r=Object.keys(e),i=0;ir}catch(e){return t.error(e),!1}}function D(e,n){try{var r=s.getTime(),i=e.id;if(n===d.a.EVENT_MODE_ON_RECEIVE&&!e.triggeredReceivedEvent)return t.debug("Received event ".concat(i)),e.triggeredReceivedEvent=!0,void E.trigger(e.eventStream.schemeIdUri,{event:e},{mode:n});e.triggeredStartEvent||("urn:mpeg:dash:event:2012"===e.eventStream.schemeIdUri&&1==e.eventStream.value?0===e.duration&&0===e.presentationTimeDelta||(t.debug("Starting manifest refresh event ".concat(i," at ").concat(r)),function(){try{v(),o.refreshManifest()}catch(e){t.error(e)}}()):"urn:mpeg:dash:event:callback:2015"===e.eventStream.schemeIdUri&&1==e.eventStream.value?(t.debug("Starting callback event ".concat(i," at ").concat(r)),function(e){try{Object(ce.a)(y).create({}).load({method:"get",url:e,request:{responseType:"arraybuffer"}})}catch(e){t.error(e)}}(e.messageData)):(t.debug("Starting event ".concat(i," from period ").concat(e.eventStream.period.id," at ").concat(r)),E.trigger(e.eventStream.schemeIdUri,{event:e},{mode:n})),e.triggeredStartEvent=!0)}catch(e){t.error(e)}}return e={addInlineEvents:function(e,r){try{if(v(),n[r]||(n[r]={}),e)for(var i=0;ie.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&g.updateManifestUpdateInfo({currentTime:V.getTime(),buffered:H.getBufferRange(),presentationStartTime:e[0].start,clientTimeOffset:D.getClientTimeOffset()}),O.length>0&&function(e){if(0===e.length)return void t.warn("No periods included in the current manifest. Skipping the filtering of outdated stream objects.");O=O.filter((function(n){var r=e.filter((function(e){return e.id===n.getId()})).length>0||n.getId()===M.getId();return r||(t.debug("Removing stream ".concat(n.getId())),n.reset(!0)),r}))}(e);for(var n=[],r=0,i=e.length;r0&&t[n[0]].getBuffer().changeType&&(te=!0),J=t}isNaN(e)||(pe.trigger(l.a.SEEK_TARGET,{time:e},{streamId:M.getId()}),V.seek(e,!1,!0),M.startScheduleControllers()),G=!1,pe.trigger(l.a.PERIOD_SWITCH_COMPLETED,{toStreamInfo:et()})}))}function Ae(e){var t=V.getTime(),n=e.seekTime,r=De(n);r&&r!==M?r&&r!==M&&(Ie(t,n,r),function(e,t){var n=e&&!isNaN(e.seekTime)?e.seekTime:NaN,r=M.getProcessors().map((function(t){return t.prepareOuterPeriodPlaybackSeeking(e)}));Promise.all(r).then((function(){Te(t,M,n)})).catch((function(e){C.error(e)}))}(e,r)):(Ie(t,n),function(e){M.getProcessors().forEach((function(t){return t.prepareInnerPeriodPlaybackSeeking(e)})),Ze(U.USER_REQUEST_STOP_REASON)}(e)),$e(k.SEEK_START_REASON)}function Ie(e,t){Re()}function Re(){ee&&ee.length>0&&(ee.forEach((function(e){e.deactivate(!0)})),ee=[])}function we(e){e.newMediaInfo.streamInfo.id===M.getId()&&(Re(),M.prepareTrackChange(e))}function Ne(e,t){try{return re.get().streaming.buffer.reuseExistingSourceBuffers&&(t.isProtectionCompatible(e)||ae)&&(te||t.isMediaCodecCompatible(e,t))}catch(e){return!1}}function Ce(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(q&&!e.getPreloaded()){var n=Ne(e,t);n&&e.startPreloading(q,J).then((function(){ee.push(e)}))}}function De(e){if(isNaN(e))return null;for(var t=O.length,n=0;nV.getLiveDelay())&&(Q=!1,$e(k.INITIAL_PLAYOUT_START_REASON),V.play())}e&&e.mediaType&&g.addBufferLevel(e.mediaType,new Date,1e3*e.bufferLevel)}function Pe(e){e.streamInfo.id===M.getId()&&e.reason&&e.reason.forceReplace&&Re(),tt(e.streamInfo.id).prepareQualityChange(e)}function Le(){if(h.getIsDynamic()&&0!==V.getOriginalLiveDelay()){var e=h.getStreamsInfo();if(e.length>0){var t=e[0].manifestInfo,n=ze(e,t);V.computeAndSetLiveDelay(n,t)}}}function xe(){if(Xe()){var e=H.getPlaybackQuality();e&&g.addDroppedFrames(e)}}function Fe(){t.debug("[onPlaybackStarted]"),!Q&&X&&$e(k.RESUME_FROM_PAUSE_START_REASON),Q&&(Q=!1),Z&&(Z=!1,re.get().streaming.applyContentSteering&&!v.shouldQueryBeforeStart()&&v.loadSteeringData()),X=!1}function ke(e){t.debug("[onPlaybackPaused]"),e.ended||(X=!0,Ze(U.USER_REQUEST_STOP_REASON))}function Ue(e){t.debug("Stream with id ".concat(e.streamInfo.id," finished buffering"));var n=e.streamInfo.isLast;q&&n?(t.info("[onStreamBufferingCompleted] calls signalEndOfStream of mediaSourceController."),p.signalEndOfStream(q)):Be()}function Be(){if(M&&M.getHasFinishedBuffering())for(var e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;try{var t=e||(M||null);if(t){var n=t.getStreamInfo();return O.filter((function(e){var t=e.getStreamInfo();return t.start>n.start&&n.id!==t.id}))}}catch(e){return[]}}(M),t=0;t0&&void 0!==arguments[0]?arguments[0]:null,t=e||(M||null);if(!t)return null;var n=t.getStreamInfo(),r=n.start,i=0,a=-1,o=NaN;for(;i0&&(isNaN(o)||l=0)return O[a];return null}();n?(t.debug("StreamController onEnded, found next stream with id ".concat(n.getStreamInfo().id,". Switching from ").concat(M.getStreamInfo().id," to ").concat(n.getStreamInfo().id)),Te(n,M,NaN)):(t.debug("StreamController no next stream found"),M.setIsEndedEventSignaled(!1)),Ze(n?U.END_OF_PERIOD_STOP_REASON:U.END_OF_CONTENT_STOP_REASON)}e&&e.isLast&&(Ge(),v.stopSteeringRequestTimer())}function qe(e){var t=e||et().manifestInfo.duration;p.setDuration(t)}function He(e){var t=b.getURIFragmentData();if(!t||!t.t)return NaN;var n=ot()[0].getStreamInfo().start;return t.t=t.t.split(",")[0],Ke(e,t.t,n)}function Ve(e,t){var n=0;e||(n=ot()[0].getStreamInfo().start);return Ke(e,t,n)}function Ke(e,t,n){var r=h.getRegularPeriods()[0],i=t.toString(),a=-1!==i.indexOf("posix:")?"now"===i.substring(6)?Date.now()/1e3:parseFloat(i.substring(6)):NaN;return e&&!isNaN(a)?D.calcPresentationTimeFromWallTime(new Date(1e3*a),r):parseFloat(i)+n}function ze(e,t){try{var n=NaN;if(t&&!isNaN(t.maxFragmentDuration)&&isFinite(t.maxFragmentDuration))return t.maxFragmentDuration;if(e&&1===e.length){var r=e[0],i=[a.a.VIDEO,a.a.AUDIO,a.a.TEXT].reduce((function(e,t){var n=h.getMediaInfoForType(r,t);return n&&!1!==n.isFragmented&&e.push(n),e}),[]).reduce((function(e,t){var n=h.getVoRepresentations(t);return n&&n.length>0&&n.forEach((function(t){t&&e.push(t)})),e}),[]).reduce((function(e,t){var n=h.convertRepresentationToRepresentationInfo(t);return n&&n.fragmentDuration&&!isNaN(n.fragmentDuration)&&e.push(n.fragmentDuration),e}),[]);n=Math.max.apply(Math,ge(i))}return isFinite(n)?n:NaN}catch(e){return NaN}}function We(e){if(e.error)Y=!0,it();else{t.info("Manifest updated... updating data system wide.");var n=e.manifest;h.updatePeriods(n);var i=h.getUTCTimingSources();!h.getIsDynamic()||i&&0!==i.length||pe.trigger(d.a.CONFORMANCE_VIOLATION,{level:he.LEVELS.WARNING,event:he.EVENTS.NO_UTC_TIMING_ELEMENT});var a=h.getIsDynamic()?i.concat(W.getUTCTimingSources()):i,o=N.isHTTPS(e.manifest.url);a.forEach((function(e){e.value.replace(/.*?:\/\//g,"")===re.get().streaming.utcSynchronization.defaultTimingSource.value.replace(/.*?:\/\//g,"")&&(e.value=e.value.replace(o?new RegExp(/^(http:)?\/\//i):new RegExp(/^(https:)?\/\//i),o?"https://":"http://"),t.debug("Matching default timing source protocol to manifest protocol: ",e.value))})),r.filterUnsupportedFeatures(n).then((function(){_.initialize(n),E.attemptSync(a,h.getIsDynamic())}))}}function Xe(){return!!M&&M.getHasVideoTrack()}function Qe(){return!!M&&M.getHasAudioTrack()}function Ze(e,t){t=t||new Date,je().forEach((function(n){n.finalisePlayList(t,e)})),g.addPlayList()}function $e(e){g.createPlaylistMetrics(1e3*V.getTime(),e)}function Je(e){if(e.error){var n="";switch(e.error.code){case 1:n="MEDIA_ERR_ABORTED";break;case 2:n="MEDIA_ERR_NETWORK";break;case 3:n="MEDIA_ERR_DECODE",ce.counts.mediaErrorDecode+=1;break;case 4:n="MEDIA_ERR_SRC_NOT_SUPPORTED";break;case 5:n="MEDIA_ERR_ENCRYPTED";break;default:n="UNKNOWN"}"MEDIA_ERR_DECODE"===n&&re.get().errors.recoverAttempts.mediaErrorDecode>=ce.counts.mediaErrorDecode?function(){t.warn("A MEDIA_ERR_DECODE occured: Resetting the MediaSource");var e=V.getTime();M.deactivate(!1),t.warn("MediaSource has been resetted. Resuming playback from time ".concat(e)),be(e,!1)}():(j=!0,e.error.message&&(n+=" ("+e.error.message+")"),e.error.msExtendedCode&&(n+=" (0x"+(e.error.msExtendedCode>>>0).toString(16).toUpperCase()+")"),t.fatal("Video Element Error: "+n),e.error&&t.fatal(e.error),C.error(new m.a(e.error.code,n)),it())}}function et(){return M?M.getStreamInfo():null}function tt(e){for(var t=0,n=O.length;t1&&void 0!==arguments[1]?arguments[1]:NaN;me(),ue=t,o.load(e)},loadWithManifest:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:NaN;ye(),ue=t,i.setManifest(e)},getActiveStreamProcessors:je,setConfig:function(e){e&&(e.capabilities&&(n=e.capabilities),e.capabilitiesFilter&&(r=e.capabilitiesFilter),e.manifestLoader&&(o=e.manifestLoader),e.manifestModel&&(c=e.manifestModel),e.mediaPlayerModel&&(z=e.mediaPlayerModel),e.customParametersModel&&(W=e.customParametersModel),e.protectionController&&(P=e.protectionController),e.adapter&&(h=e.adapter),e.dashMetrics&&(g=e.dashMetrics),e.errHandler&&(C=e.errHandler),e.timelineConverter&&(D=e.timelineConverter),e.videoModel&&(H=e.videoModel),e.playbackController&&(V=e.playbackController),e.serviceDescriptionController&&(K=e.serviceDescriptionController),e.contentSteeringController&&(v=e.contentSteeringController),e.textController&&(x=e.textController),e.abrController&&(A=e.abrController),e.mediaController&&(I=e.mediaController),e.settings&&(re=e.settings),e.baseURLController&&(_=e.baseURLController),e.uriFragmentModel&&(b=e.uriFragmentModel),e.segmentBaseController&&(T=e.segmentBaseController))},setProtectionData:function(e){F=e,P&&P.setProtectionData(F)},getIsStreamSwitchInProgress:function(){return G},switchToVideoElement:function(e){M&&(V.initialize(et()),be(e,!1))},getHasMediaOrInitialisationError:function(){return j||Y},getStreams:ot,getActiveStream:function(){return M},getInitialPlayback:function(){return Q},getAutoPlay:function(){return B},reset:it},t=Object(f.a)(fe).getInstance().getLogger(e),E=se(fe).getInstance(),p=le(fe).getInstance(),w=S(fe).getInstance(),N=Object(L.a)(fe).getInstance(),rt(),e}me.__dashjs_factory_name="StreamController";var ye=c.a.getSingletonFactory(me);function Ee(){var e,t,n,r,i,o,s,c,d,h,g,p,m=this.context,y=Object(u.a)(m).getInstance();function E(){p.debug("Stopping the gap controller"),i&&(clearInterval(i),i=null),function(){y.off(l.a.WALLCLOCK_TIME_UPDATED,S,this),y.off(l.a.INITIAL_STREAM_SWITCH,b,this),y.off(l.a.PLAYBACK_SEEKING,v,this),y.off(l.a.BUFFER_REPLACEMENT_STARTED,_,e),y.off(l.a.TRACK_CHANGE_RENDERED,T,e)}(),i=null,o=NaN,r=0,h=null,g={}}function v(){h&&(clearTimeout(h),h=null)}function _(e){try{if(e.streamId!==c.getActiveStreamInfo().id||e.mediaType!==a.a.VIDEO&&e.mediaType!==a.a.AUDIO)return;e.streamId===c.getActiveStreamInfo().id&&(g[e.mediaType]=!0)}catch(e){p.error(e)}}function T(e){e&&e.mediaType&&(g[e.mediaType]=!1)}function b(){i||function(){try{i||(p.debug("Starting the gap controller"),i=setInterval((function(){A()&&N(s.getTime())}),100))}catch(e){}}()}function S(){if(A(n.get().streaming.gaps.enableSeekFix)&&++r>=10){var e=s.getTime();t===e?N(e,!0):(t=e,o=NaN),r=0}}function A(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!c.getActiveStream())return!1;var t=Object.keys(g).some((function(e){return g[e]})),r=!!e&&I();return!t&&n.get().streaming.gaps.jumpGaps&&c.getActiveStreamProcessors().length>0&&(!s.isSeeking()||r)&&!s.isPaused()&&!c.getIsStreamSwitchInProgress()&&!c.getHasMediaOrInitialisationError()}function I(){var e=c.getActiveStream(),t=parseFloat((e.getStartTime()+e.getDuration()).toFixed(5));return s.getTime()+n.get().streaming.gaps.threshold>=t}function R(e,t){try{if(!e||e.length<=1&&t>0)return NaN;for(var r=NaN,i=0;isNaN(r)&&i0?e.end(i-1):0;t=e.start(n)&&t<=e.end(n))return!0;return!1}function N(e){var t,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=n.get().streaming.gaps.enableStallFix,a=n.get().streaming.gaps.stallSeek,u=n.get().streaming.gaps.smallGapLimit,l=n.get().streaming.gaps.jumpLargeGaps,f=d.getBufferRange(),g=NaN,m=!1;if(t=R(f,e),!isNaN(t)){var y=f.start(t),E=y-e;E>0&&(E<=u||l)&&(g=y)}var v=s.getTimeToStreamEnd();if(isNaN(g)&&r&&isFinite(v)&&!isNaN(v)&&v0&&o!==g&&g>e&&!h){var _=g-e;if(m){var T=c.getStreamForTime(g),b=T&&!!T.getPreloaded();p.warn("Jumping to end of stream because of gap from ".concat(e," to ").concat(g,". Gap duration: ").concat(_)),s.seek(g,!0,b)}else{var S=s.getIsDynamic(),A=t>0?f.end(t-1):e,I=S?1e3*Math.max(0,_-.1):0;h=window.setTimeout((function(){s.seek(g,!0,!0),p.warn("Jumping gap occuring in period ".concat(c.getActiveStream().getStreamId()," starting at ").concat(A," and ending at ").concat(g,". Jumping by: ").concat(g-A)),h=null}),I)}o=g}}return e={reset:E,setConfig:function(e){e&&(e.settings&&(n=e.settings),e.playbackController&&(s=e.playbackController),e.streamController&&(c=e.streamController),e.videoModel&&(d=e.videoModel))},initialize:function(){!function(){y.on(l.a.WALLCLOCK_TIME_UPDATED,S,this),y.on(l.a.INITIAL_STREAM_SWITCH,b,this),y.on(l.a.PLAYBACK_SEEKING,v,this),y.on(l.a.BUFFER_REPLACEMENT_STARTED,_,e),y.on(l.a.TRACK_CHANGE_RENDERED,T,e)}()}},p=Object(f.a)(m).getInstance().getLogger(e),E(),e}Ee.__dashjs_factory_name="GapController";var ve=c.a.getSingletonFactory(Ee),_e=n(14);function Te(){var e,t,n,r,i,o,c,h,g,p,m=this.context,y=Object(u.a)(m).getInstance();function E(){t=!1;var e=_e.a.parseUserAgent();n=e&&e.browser&&e.browser.name&&"safari"===e.browser.name.toLowerCase()}function v(){t=!1}function _(e){if(e.streamId===o.getActiveStreamInfo().id&&g){var t=c.getLiveDelay();c.getBufferLevel()>t/2&&(g=!1)}}function T(e){e.streamId===o.getActiveStreamInfo().id&&(g=e.state===s.a.BUFFER_EMPTY)}function b(){h.getCatchupModeEnabled()||r.setPlaybackRate(1)}function S(){c.getIsDynamic()&&h.getCatchupModeEnabled()&&(h.getCatchupPlaybackRates().max>0||h.getCatchupPlaybackRates().min<0)&&!c.isPaused()&&!c.isSeeking()&&function(){try{if(!c.getTime()>0||t)return!1;if(I()===a.a.LIVE_CATCHUP_MODE_LOLP){var e=c.getBufferLevel(),n=i.get().streaming.liveCatchup.playbackBufferMin;return function(e,t){try{return Math.abs(A())>0||e0}catch(e){return!1}}()}catch(e){return!1}}()&&function(){if(t)return;if(r){var e,o=r.getPlaybackRate(),s=h.getCatchupPlaybackRates(),u=c.getBufferLevel(),l=A(),f=h.getCatchupMaxDrift();if(!isNaN(f)&&f>0&&l>f)p.info("[CatchupController]: Low Latency catchup mechanism. Latency too high, doing a seek to live point"),t=!0,c.seekToCurrentLive(!0,!1);else{var d=c.getCurrentLiveLatency(),m=c.getLiveDelay();if(I()===a.a.LIVE_CATCHUP_MODE_LOLP){var y=i.get().streaming.liveCatchup.playbackBufferMin;e=function(e,t,n,r,i){var a;if(i0&&(u=1);return u}(s,d,m,u);var E=n?.25:.02/(.5/s.max);e&&Math.abs(o-e)>=E&&(p.debug("[CatchupController]: Setting playback rate to ".concat(e)),r.setPlaybackRate(e))}}}()}function A(){return c.getCurrentLiveLatency()-c.getLiveDelay()}function I(){var e=i.get().streaming.liveCatchup.playbackBufferMin;return i.get().streaming.liveCatchup.mode!==a.a.LIVE_CATCHUP_MODE_LOLP||null===e||isNaN(e)?a.a.LIVE_CATCHUP_MODE_DEFAULT:a.a.LIVE_CATCHUP_MODE_LOLP}function R(){h.getCatchupPlaybackRates(!0)}return e={reset:function(){y.off(d.a.BUFFER_LEVEL_UPDATED,_,e),y.off(d.a.BUFFER_LEVEL_STATE_CHANGED,T,e),y.off(d.a.PLAYBACK_PROGRESS,S,e),y.off(d.a.PLAYBACK_TIME_UPDATED,S,e),y.off(d.a.PLAYBACK_SEEKED,S,e),y.off(l.a.SETTING_UPDATED_CATCHUP_ENABLED,b,e),y.off(l.a.SETTING_UPDATED_PLAYBACK_RATE_MIN,R,e),y.off(l.a.SETTING_UPDATED_PLAYBACK_RATE_MAX,R,e),y.off(d.a.STREAM_INITIALIZED,R,e),E(),r.setPlaybackRate(1,!0)},setConfig:function(e){e&&(e.settings&&(i=e.settings),e.videoModel&&(r=e.videoModel),e.streamController&&(o=e.streamController),e.playbackController&&(c=e.playbackController),e.mediaPlayerModel&&(h=e.mediaPlayerModel))},initialize:function(){y.on(d.a.BUFFER_LEVEL_UPDATED,_,e),y.on(d.a.BUFFER_LEVEL_STATE_CHANGED,T,e),y.on(d.a.PLAYBACK_PROGRESS,S,e),y.on(d.a.PLAYBACK_TIME_UPDATED,S,e),y.on(d.a.PLAYBACK_SEEKED,v,e),y.on(l.a.SETTING_UPDATED_CATCHUP_ENABLED,b,e),y.on(l.a.SETTING_UPDATED_PLAYBACK_RATE_MIN,R,e),y.on(l.a.SETTING_UPDATED_PLAYBACK_RATE_MAX,R,e),y.on(d.a.STREAM_INITIALIZED,R,e),R()}},p=Object(f.a)(m).getInstance().getLogger(e),E(),e}Te.__dashjs_factory_name="CatchupController";var be=c.a.getSingletonFactory(Te),Se=[a.a.SERVICE_DESCRIPTION_DVB_LL_SCHEME],Ae="video",Ie="audio",Re="any",we="all";function Ne(){var e,t,n,r,i,s=this.context;function u(){t={liveDelay:NaN,liveCatchup:{maxDrift:NaN,playbackRate:{min:NaN,max:NaN}},minBitrate:{},maxBitrate:{},initialBitrate:{}},n=[]}function l(e,n,i){try{t[e][n]=i/1e3}catch(e){r.error(e)}}return e={getServiceDescriptionSettings:function(){return t},getProducerReferenceTimeOffsets:function(){return n},calculateProducerReferenceTimeOffsets:function(e){try{var t=[];if(e&&e.length>0){var s=[a.a.VIDEO,a.a.AUDIO,a.a.TEXT],u=i.getAvailabilityStartTime()/1e3;e.forEach((function(e){var n=s.reduce((function(t,n){return t=t.concat(i.getAllMediaInfoForType(e,n))}),[]).reduce((function(t,n){return i.getProducerReferenceTimes(e,n).forEach((function(r){var a=i.getVoRepresentations(n);if(a&&a.length>0&&a[0].adaptation&&a[0].segmentInfoType===o.a.SEGMENT_TEMPLATE){var s=a[0],l=new Date(r[o.a.WALL_CLOCK_TIME]).getTime()/1e3-(r[o.a.PRESENTATION_TIME]/s[o.a.TIMESCALE]-s[o.a.PRESENTATION_TIME_OFFSET]+e.start),c=u-l;t.push({id:r[o.a.ID],to:c})}})),t}),[]);t=t.concat(n)}))}n=t}catch(e){r.error(e),n=[]}},applyServiceDescription:function(e){if(e&&e.serviceDescriptions){var i=e.serviceDescriptions.filter((function(e){return Se.includes(e.schemeIdUri)})),o=e.serviceDescriptions.filter((function(e){return null==e.schemeIdUri})),s=i.length>0?i[i.length-1]:o[o.length-1];s&&(s.latency&&s.latency.target>0&&function(e){var i;i=e.schemeIdUri===a.a.SERVICE_DESCRIPTION_DVB_LL_SCHEME?function(e){var t=e.latency.target/1e3,n=!isNaN(e.latency.max)&&e.latency.max>e.latency.target?(e.latency.max-e.latency.target+500)/1e3:NaN,r=e.latency.referenceId||NaN;return{liveDelay:t,maxDrift:n,referenceId:r}}(e):function(e){var t=e.latency.target/1e3,n=!isNaN(e.latency.max)&&e.latency.max>e.latency.target?(e.latency.max-e.latency.target+500)/1e3:NaN,r=e.latency.referenceId||NaN;return{liveDelay:t,maxDrift:n,referenceId:r}}(e);if(n.length>0){var o=function(e){var t,r=0,i=n.filter((function(t){return t.id===e.referenceId}));0===i.length?(r=n.length>0?n[0].to:0,t=n[0].id||NaN):(r=i[0].to||0,t=i[0].id||NaN);return{to:r,id:t}}(i),s=o.to,u=o.id;t.liveDelay=i.liveDelay-s,t.liveCatchup.maxDrift=i.maxDrift,r.debug("\n Found latency properties coming from service description. Applied time offset of ".concat(s," from ProducerReferenceTime element with id ").concat(u,".\n Live Delay: ").concat(i.liveDelay-s,", Live catchup max drift: ").concat(i.maxDrift,"\n "))}else t.liveDelay=i.liveDelay,t.liveCatchup.maxDrift=i.maxDrift,r.debug("Found latency properties coming from service description: Live Delay: ".concat(i.liveDelay,", Live catchup max drift: ").concat(i.maxDrift))}(s),s.playbackRate&&function(e){var n=e.playbackRate.min?Math.round(1e3*(e.playbackRate.min-1))/1e3:NaN,i=e.playbackRate.max?Math.round(1e3*(e.playbackRate.max-1))/1e3:NaN;t.liveCatchup.playbackRate.min=n,t.liveCatchup.playbackRate.max=i,r.debug("Found latency properties coming from service description: Live catchup min playback rate: ".concat(n)),r.debug("Found latency properties coming from service description: Live catchup max playback rate: ".concat(i))}(s),s.operatingQuality,s.operatingBandwidth&&function(e){if(!e||!e.operatingBandwidth||!e.operatingBandwidth.mediaType||e.operatingBandwidth.mediaType===we)return;var t={};t.minBandwidth=e.operatingBandwidth.min,t.maxBandwidth=e.operatingBandwidth.max,t.targetBandwidth=e.operatingBandwidth.target;var n=[];e.operatingBandwidth.mediaType===Ae||e.operatingBandwidth.mediaType===Ie?n.push(e.operatingBandwidth.mediaType):e.operatingBandwidth.mediaType===Re&&(n.push(Ie),n.push(Ae));n.forEach((function(e){isNaN(t.minBandwidth)||l("minBitrate",e,t.minBandwidth),isNaN(t.maxBandwidth)||l("maxBitrate",e,t.maxBandwidth),isNaN(t.targetBandwidth)||l("initialBitrate",e,t.targetBandwidth)}))}(s))}},reset:function(){u()},setConfig:function(e){e&&e.adapter&&(i=e.adapter)}},r=Object(f.a)(s).getInstance().getLogger(e),u(),e}Ne.__dashjs_factory_name="ServiceDescriptionController";var Ce=c.a.getSingletonFactory(Ne),De=n(22);var Oe=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.url=t||null,this.type=v.a.CONTENT_STEERING_TYPE,this.responseType="json"};var Me=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.version=null,this.ttl=300,this.reloadUri=null,this.serviceLocationPriority=[]},Pe="_DASH_throughput",Le="_DASH_pathway",xe="url";function Fe(){var e,t,n,r,i,s,u,c,h,g,p,m,E,v,_,T=this.context,b=Object(L.a)(T).getInstance();function S(e){e&&e.toStreamInfo&&(r=e.toStreamInfo)}function A(e){e&&e.request&&e.request.serviceLocation&&(i=e.request.serviceLocation)}function I(){var e=p.getValue();return _.getContentSteering(e)}function R(){return new Promise((function(e){try{var s=I();if(!s||!s.serverUrl)return void e();var l=function(e){var t=e.proxyServerUrl?e.proxyServerUrl:e.serverUrl;n&&n.reloadUri&&(t=b.isRelative(n.reloadUri)?b.resolve(n.reloadUri,e.serverUrl):n.reloadUri);var o=[];if(r){var s=_.getIsDynamic(),u=_.getAllMediaInfoForType(r,a.a.VIDEO).length>0?a.a.VIDEO:a.a.AUDIO,l=E.getThroughputHistory(),c=l?l.getAverageThroughput(u,s):NaN;isNaN(c)||o.push({key:Pe,value:1e3*c})}i&&o.push({key:Le,value:i});e.proxyServerUrl&&e.proxyServerUrl===t&&e.serverUrl&&o.push({key:xe,value:encodeURI(e.serverUrl)});return t=_e.a.addAditionalQueryParameterToUrl(t,o)}(s),c=new Oe(l);u.load({request:c,success:function(t){!function(e){if(!e||!e[o.a.CONTENT_STEERING_RESPONSE.VERSION]||1!==parseInt(e[o.a.CONTENT_STEERING_RESPONSE.VERSION]))return;(n=new Me).version=e[o.a.CONTENT_STEERING_RESPONSE.VERSION],e[o.a.CONTENT_STEERING_RESPONSE.TTL]&&!isNaN(e[o.a.CONTENT_STEERING_RESPONSE.TTL])&&(n.ttl=e[o.a.CONTENT_STEERING_RESPONSE.TTL]);e[o.a.CONTENT_STEERING_RESPONSE.RELOAD_URI]&&(n.reloadUri=e[o.a.CONTENT_STEERING_RESPONSE.RELOAD_URI]);e[o.a.CONTENT_STEERING_RESPONSE.SERVICE_LOCATION_PRIORITY]&&(n.serviceLocationPriority=e[o.a.CONTENT_STEERING_RESPONSE.SERVICE_LOCATION_PRIORITY]);w()}(t),v.trigger(d.a.CONTENT_STEERING_REQUEST_COMPLETED,{currentSteeringResponseData:n,url:l}),e()},error:function(n){!function(e){t.warn("Error fetching data from content steering server",e),w()}(n),e(n)}})}catch(t){e(t)}}))}function w(){n&&n.ttl&&!isNaN(n.ttl)&&(s&&clearTimeout(s),s=setTimeout((function(){R()}),1e3*n.ttl))}function N(){s&&clearTimeout(s),s=null}function C(){n=null,r=null,i=null,N()}return e={reset:function(){C(),v.off(d.a.PERIOD_SWITCH_COMPLETED,S,e),v.off(l.a.FRAGMENT_LOADING_STARTED,A,e)},setConfig:function(e){e&&(e.adapter&&(_=e.adapter),e.errHandler&&(c=e.errHandler),e.dashMetrics&&(h=e.dashMetrics),e.mediaPlayerModel&&(g=e.mediaPlayerModel),e.requestModifier&&(m=e.requestModifier),e.manifestModel&&(p=e.manifestModel),e.abrController&&(E=e.abrController),e.eventBus&&(v=e.eventBus))},loadSteeringData:R,getCurrentSteeringResponseData:function(){return n},shouldQueryBeforeStart:function(){var e=I();return e&&e.queryBeforeStart},getSteeringDataFromManifest:I,stopSteeringRequestTimer:N,initialize:function(){u=Object(De.a)(T).create({errHandler:c,dashMetrics:h,mediaPlayerModel:g,requestModifier:m,errors:y.a}),v.on(d.a.PERIOD_SWITCH_COMPLETED,S,e),v.on(l.a.FRAGMENT_LOADING_STARTED,A,e)}},t=Object(f.a)(T).getInstance().getLogger(e),C(),e}Fe.__dashjs_factory_name="ContentSteeringController";var ke=c.a.getSingletonFactory(Fe),Ue=n(30),Be=n.n(Ue),Ge=n(50);function je(){var e,t,n,r,i,o,s,c,d=this.context,h=Object(u.a)(d).getInstance();function g(e,t){return e&&n[t]&&n[t][e]?n[t][e].list:[]}function p(e,t){return e&&n[t]&&n[t][e]?n[t][e].current:null}function m(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e&&e.streamInfo){var i=e.type,s=e.streamInfo,u=s.id,f=p(i,u);if(n[u]&&n[u][i]&&(n[u][i].current=e,n[u][i].current&&(i!==a.a.TEXT&&!v(e,f)||i===a.a.TEXT&&e.isFragmented)&&h.trigger(l.a.CURRENT_TRACK_CHANGED,{oldMediaInfo:f,newMediaInfo:e,switchMode:r.get().streaming.trackSwitchMode[i]},{streamId:u}),!t)){var d=T(e);if(!d||!n[u][i].storeLastSettings)return;d.roles&&(d.role=d.roles[0],delete d.roles),d.accessibility&&(d.accessibility=d.accessibility[0]),d.audioChannelConfiguration&&(d.audioChannelConfiguration=d.audioChannelConfiguration[0]),o[i]=d,c.setSavedMediaSettings(i,d)}}}function y(e,t){e&&t&&(i[e]=t)}function E(e){return e?i[e]:null}function v(e,t){if(!e&&!t)return!0;if(!e||!t)return!1;var n=e.id===t.id,r=e.viewpoint===t.viewpoint,i=e.lang===t.lang,a=e.codec===t.codec,o=e.roles.toString()===t.roles.toString(),s=e.accessibility.toString()===t.accessibility.toString(),u=e.audioChannelConfiguration.toString()===t.audioChannelConfiguration.toString();return n&&a&&r&&i&&o&&s&&u}function _(){n={},o={},i={audio:null,video:null,text:null}}function T(e){var t={lang:e.lang,viewpoint:e.viewpoint,roles:e.roles,accessibility:e.accessibility,audioChannelConfiguration:e.audioChannelConfiguration};return t.lang||t.viewpoint||t.role&&t.role.length>0||t.accessibility&&t.accessibility.length>0||t.audioChannelConfiguration&&t.audioChannelConfiguration.length>0?t:null}function b(e,t,n){var r=[];return e.forEach((function(e){t(n,e)&&r.push(e)})),0!==r.length?r:e}function S(e,t){return!e.lang||e.lang instanceof RegExp?t.lang.match(e.lang):""!==t.lang&&Object(Ge.extendedFilter)(t.lang,Be()(e.lang)).length>0}function A(e,t){return void 0===e.index||null===e.index||t.index===e.index}function I(e,t){return!e.viewpoint||e.viewpoint===t.viewpoint}function R(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=!e.role||!!t.roles.filter((function(t){return t===e.role}))[0];return r||t.type===a.a.AUDIO&&n}function w(e,t){return e.accessibility?!!t.accessibility.filter((function(t){return t===e.accessibility}))[0]:!t.accessibility.length}function N(e,t){return!e.audioChannelConfiguration||!!t.audioChannelConfiguration.filter((function(t){return t===e.audioChannelConfiguration}))[0]}function C(e){var t,n=0,r=[];return e.forEach((function(e){(t=Math.max.apply(Math,e.bitrateList.map((function(e){return e.bandwidth}))))>n?(n=t,r=[e]):t===n&&r.push(e)})),r}function D(e){var t,n=1/0,r=[];return e.forEach((function(e){var i=e.bitrateList.reduce((function(e,t){var n=Math.max(1,t.width*t.height);return e+t.bandwidth/n}),0);(t=i/e.bitrateList.length)n?(n=t,r=[e]):t===n&&r.push(e)})),r}function M(e,n){if(e===a.a.TEXT)return n[0];var i,o=r.get().streaming.selectionModeForInitialTrack,u=s.getCustomInitialTrackSelectionFunction();if(u&&"function"==typeof u)i=u(n);else switch(o){case a.a.TRACK_SELECTION_MODE_HIGHEST_SELECTION_PRIORITY:i=function(e){var t=(n=e,r=0,i=[],n.forEach((function(e){isNaN(e.selectionPriority)||(e.selectionPriority>r?(r=e.selectionPriority,i=[e]):e.selectionPriority===r&&i.push(e))})),i);var n,r,i;t.length>1&&(t=C(t));t.length>1&&(t=O(t));return t}(n);break;case a.a.TRACK_SELECTION_MODE_HIGHEST_BITRATE:i=function(e){var t=C(e);t.length>1&&(t=O(t));return t}(n);break;case a.a.TRACK_SELECTION_MODE_FIRST_TRACK:i=P(n);break;case a.a.TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY:i=function(e){var t=D(e);t.length>1&&(t=C(t));return t}(n);break;case a.a.TRACK_SELECTION_MODE_WIDEST_RANGE:i=function(e){var t=O(e);t.length>1&&(t=C(e));return t}(n);break;default:t.warn("Track selection mode ".concat(o," is not supported. Falling back to TRACK_SELECTION_MODE_FIRST_TRACK")),i=P(n)}return i.length>0?i[0]:n[0]}function P(e){return e[0]}return e={setInitialMediaSettingsForType:function(e,t){var n=o[e]||E(e),r=g(e,t.id),i=[];n||y(e,n=c.getSavedMediaSettings(e)),r&&0!==r.length&&(n&&(i=b(i=Array.from(r),S,n),i=b(i,A,n),i=b(i,I,n),e===a.a.AUDIO&&o[e]||(i=b(i,R,n)),i=b(i,w,n),i=b(i,N,n)),0===i.length?m(M(e,r),!0):i.length>1?m(M(e,i,o[e])):m(i[0]))},addTrack:function(e){if(e){var t=e.type;if((r=t)===a.a.AUDIO||r===a.a.VIDEO||r===a.a.TEXT||r===a.a.IMAGE){var r,i=e.streamInfo.id;n[i]||(n[i]={audio:{list:[],storeLastSettings:!0,current:null},video:{list:[],storeLastSettings:!0,current:null},text:{list:[],storeLastSettings:!0,current:null},image:{list:[],storeLastSettings:!0,current:null}});for(var o=n[i][t].list,s=0,u=o.length;s2&&void 0!==arguments[2]&&arguments[2];try{var r=!1;if(e.lang){if(e.lang instanceof RegExp)r=t.lang.match(e.lang);else if(""!==t.lang){var i=Be()(e.lang);i&&(r=Object(Ge.extendedFilter)(t.lang,i).length>0)}}else r=!0;var o=void 0===e.index||null===e.index||t.index===e.index,s=!e.viewpoint||e.viewpoint===t.viewpoint,u=!e.role||!!t.roles.filter((function(t){return t===e.role}))[0],l=!e.accessibility||!!t.accessibility.filter((function(t){return t===e.accessibility}))[0],c=!e.audioChannelConfiguration||!!t.audioChannelConfiguration.filter((function(t){return t===e.audioChannelConfiguration}))[0];return r&&o&&s&&(u||t.type===a.a.AUDIO&&n)&&l&&c}catch(e){return!1}},matchSettingsLang:S,matchSettingsIndex:A,matchSettingsViewPoint:I,matchSettingsRole:R,matchSettingsAccessibility:w,matchSettingsAudioChannelConfig:N,saveTextSettingsDisabled:function(){c.setSavedMediaSettings(a.a.TEXT,null)},setConfig:function(e){e&&(e.domStorage&&(c=e.domStorage),e.settings&&(r=e.settings),e.customParametersModel&&(s=e.customParametersModel))},reset:_},t=Object(f.a)(d).getInstance().getLogger(e),_(),e}je.__dashjs_factory_name="MediaController";var Ye=c.a.getSingletonFactory(je);c.a.updateSingletonFactory(je.__dashjs_factory_name,Ye);var qe=Ye,He=n(46);var Ve=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.data={baseUrls:t||null,selectedIdx:n||NaN},this.children=[]};function Ke(){var e,t,n,r=this.context,i=Object(He.a)(r).getInstance();function a(e,t,r){var a=n.getBaseURLsFromElement(r);e[t]?i.areEqual(a,e[t].data.baseUrls)||(e[t].data.baseUrls=a,e[t].data.selectedIdx=NaN):e[t]=new Ve(a)}function o(e){!function(){if(!n||!n.hasOwnProperty("getBaseURLsFromElement")||!n.hasOwnProperty("getRepresentationSortFunction"))throw new Error("setConfig function has to be called previously")}();var r=n.getBaseURLsFromElement(e);i.areEqual(r,t.data.baseUrls)||(t.data.baseUrls=r,t.data.selectedIdx=NaN),e&&e.Period_asArray&&e.Period_asArray.forEach((function(e,r){a(t.children,r,e),e.AdaptationSet_asArray&&e.AdaptationSet_asArray.forEach((function(e,i){a(t.children[r].children,i,e),e.Representation_asArray&&e.Representation_asArray.sort(n.getRepresentationSortFunction()).forEach((function(e,n){a(t.children[r].children[i].children,n,e)}))}))}))}function s(){t=new Ve}return e={reset:s,update:function(e){o(e)},getForPath:function(e){var n=t,r=[n.data];return e&&e.forEach((function(e){(n=n.children[e])&&r.push(n.data)})),r.filter((function(e){return e.baseUrls.length}))},invalidateSelectedIndexes:function(e){!function e(n,r){var i=r||t;n(i.data),i.children&&i.children.forEach((function(t){return e(n,t)}))}((function(t){isNaN(t.selectedIdx)||e===t.baseUrls[t.selectedIdx].serviceLocation&&(t.selectedIdx=NaN)}))},setConfig:function(e){e.adapter&&(n=e.adapter)}},s(),e}Ke.__dashjs_factory_name="BaseURLTreeModel";var ze=c.a.getClassFactory(Ke);function We(e){var t=(e=e||{}).blacklistController;return{select:function(e){return e&&function(e){var t,n,r=0,i=[],a=0;if((n=e.sort((function(e,t){var n=e.dvb_priority-t.dvb_priority;return isNaN(n)?0:n})).filter((function(e,t,n){return!t||n[0].dvb_priority&&e.dvb_priority&&n[0].dvb_priority===e.dvb_priority}))).length)return n.length>1&&(n.forEach((function(e){r+=e.dvb_weight,i.push(r)})),t=Math.floor(Math.random()*(r-1)),i.every((function(e,n){return a=n,!(t0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=0,i=NaN,a=function(){var a=e[r],o=t.findIndex((function(e){return e.serviceLocation&&e.serviceLocation===a}));if(-1!==o&&!n.contains(t[o].serviceLocation))return i=o,"break";r+=1};r")+2),r=t.resolvedContent.substr(0,i)+""+t.resolvedContent.substr(i)+"",t.resolvedContent=a.xml_str2json(r)}(function(e){var t;for(t=0;t=0;o--){if(t=e.elements[o],n=t.type+"_asArray",t.resolvedContent){if(t.resolvedContent)for(s=0;s0&&r.run(i)}(e),"onActuate"===e.resolveType&&f.trigger(l.a.XLINK_READY,{manifest:i}),"onLoad"===e.resolveType)switch(e.type){case o.a.PERIOD:for(t=0;t=0;a--)(i=e[a]).hasOwnProperty("xlink:href")&&"urn:mpeg:dash:resolve-to-zero:2013"===i["xlink:href"]&&e.splice(a,1);for(a=0;a-1?(p&&(t=p.createMssParser(),p.registerEvents()),t):e.indexOf("MPD")>-1||e.indexOf("Patch")>-1?Object(yt.a)(c).create({debug:f}):t}(t)),null!==s){i.setMatchers(s.getMatchers()),i.setIron(s.getIron());try{v=s.parse(t)}catch(t){return void h.trigger(l.a.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new m.a(y.a.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,y.a.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+"".concat(e))})}if(v){if(v.url=u||e,v.originalUrl||(v.originalUrl=v.url),v.hasOwnProperty(a.a.LOCATION)&&(E=g.parseBaseUrl(v.Location_asArray[0]),n.debug("BaseURI set by Location to: "+E)),d&&d.get().streaming.enableManifestDurationMismatchFix&&v.mediaPresentationDuration&&v.Period_asArray.length>1){var _=v.Period_asArray.reduce((function(e,t){return e+t.duration}),0);!isNaN(_)&&v.mediaPresentationDuration>_&&(n.warn("Media presentation duration greater than duration of all periods. Setting duration to total period duration"),v.mediaPresentationDuration=_)}v.baseUri=E,v.loadedTime=new Date,i.resolveManifestOnLoad(v),h.trigger(l.a.ORIGINAL_MANIFEST_LOADED,{originalManifest:t})}else h.trigger(l.a.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new m.a(y.a.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,y.a.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+"".concat(e))})}else h.trigger(l.a.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new m.a(y.a.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,y.a.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+"".concat(e))});else h.trigger(l.a.INTERNAL_MANIFEST_LOADED,{manifest:null})},error:function(t,n,r){h.trigger(l.a.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new m.a(y.a.MANIFEST_LOADER_LOADING_FAILURE_ERROR_CODE,y.a.MANIFEST_LOADER_LOADING_FAILURE_ERROR_MESSAGE+"".concat(e,", ").concat(r))})}})},reset:function(){h.off(l.a.XLINK_READY,_,t),p&&p.reset(),i&&(i.reset(),i=null),r&&(r.abort(),r=null)}},n=f.getLogger(t),h.on(l.a.XLINK_READY,_,t),r=Object(De.a)(c).create({errHandler:e.errHandler,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,urlUtils:g,constants:a.a,dashConstants:o.a,errors:y.a,requestTimeout:e.settings.get().streaming.manifestRequestTimeout}),i=mt(c).create({errHandler:E,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,settings:e.settings}),s=null,t}Et.__dashjs_factory_name="ManifestLoader";var vt=c.a.getClassFactory(Et);function _t(){var e=this.context,t=Object(u.a)(e).getInstance();return{error:function(e){t.trigger(l.a.ERROR,{error:e})}}}_t.__dashjs_factory_name="ErrorHandler";var Tt=c.a.getSingletonFactory(_t),bt=n(53);function St(){var e,t,n,r,i,o,s=this.context,c=Object(u.a)(s).getInstance();function d(e,r){if(!r||!r.Period_asArray||0===r.Period_asArray.length)return Promise.resolve();var i=[];return r.Period_asArray.forEach((function(r){i.push(function(e,r){return new Promise((function(i){if(e&&e.AdaptationSet_asArray&&0!==e.AdaptationSet_asArray.length){var s=[];e.AdaptationSet_asArray.forEach((function(e){t.getIsTypeOf(e,r)&&s.push(function(e,r){return new Promise((function(i){if(e.Representation_asArray&&0!==e.Representation_asArray.length){var s=[],u=[];e.Representation_asArray.forEach((function(i,o){var l=t.getCodec(e,o,!1),c=function(e,t,n){switch(e){case a.a.VIDEO:return function(e,t){var n=e.width||null,r=e.height||null,i=e.frameRate||null,a=e.bandwidth||null;return{codec:t,width:n,height:r,framerate:i,bitrate:a}}(t,n);case a.a.AUDIO:return function(e,t){var n=e.audioSamplingRate||null,r=e.bandwidth||null;return{codec:t,bitrate:r,samplerate:n}}(t,n);default:return null}}(r,i,l);u.push(c),s.push(n.supportsCodec(c,r))})),Promise.all(s).then((function(t){e.Representation_asArray=e.Representation_asArray.filter((function(e,n){return t[n]||o.debug("[Stream] Codec ".concat(u[n].codec," not supported ")),t[n]})),i()})).catch((function(){i()}))}else i()}))}(e,r))})),Promise.all(s).then((function(){e.AdaptationSet_asArray=e.AdaptationSet_asArray.filter((function(e){var t=e.Representation_asArray&&e.Representation_asArray.length>0;return t||(c.trigger(l.a.ADAPTATION_SET_REMOVED_NO_CAPABILITIES,{adaptationSet:e}),o.warn("AdaptationSet has been removed because of no supported Representation")),t})),i()})).catch((function(){i()}))}else i()}))}(r,e))})),Promise.all(i)}return e={setConfig:function(e){e&&(e.adapter&&(t=e.adapter),e.capabilities&&(n=e.capabilities),e.settings&&(r=e.settings),e.customParametersModel&&(i=e.customParametersModel))},filterUnsupportedFeatures:function(e){return new Promise((function(s){var u=[];u.push(d(a.a.VIDEO,e)),u.push(d(a.a.AUDIO,e)),Promise.all(u).then((function(){r.get().streaming.capabilities.filterUnsupportedEssentialProperties&&function(e){if(!e||!e.Period_asArray||0===e.Period_asArray.length)return;e.Period_asArray.forEach((function(e){e.AdaptationSet_asArray=e.AdaptationSet_asArray.filter((function(e){return!e.Representation_asArray||0===e.Representation_asArray.length||(e.Representation_asArray=e.Representation_asArray.filter((function(e){var r=t.getEssentialPropertiesForRepresentation(e);if(r&&r.length>0)for(var i=0;i0)}))}))}(e),function(e){var t=i.getCustomCapabilitiesFilters();if(!t||0===t.length||!e||!e.Period_asArray||0===e.Period_asArray.length)return;e.Period_asArray.forEach((function(e){e.AdaptationSet_asArray=e.AdaptationSet_asArray.filter((function(e){return!e.Representation_asArray||0===e.Representation_asArray.length||(e.Representation_asArray=e.Representation_asArray.filter((function(e){return!t.some((function(t){return!t(e)}))})),e.Representation_asArray&&e.Representation_asArray.length>0)}))}))}(e),s()})).catch((function(){s()}))}))}},o=Object(f.a)(s).getInstance().getLogger(e),e}St.__dashjs_factory_name="CapabilitiesFilter";var At=c.a.getSingletonFactory(St);var It=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.t=null,this.xywh=null,this.track=null,this.id=null,this.s=null,this.r=null};function Rt(){var e;return{initialize:function(t){if(e=new It,!t)return null;var n=t.indexOf("#");if(-1!==n)for(var r=t.substr(n+1).split("&"),i=0,a=r.length;i0?(n&&t.warn("Supplied minimum playback rate is a positive value when it should be negative or 0. The supplied rate will not be applied and set to 0: 100% playback speed."),0):e<-.5?(n&&t.warn("Supplied minimum playback rate is out of range and will be limited to ".concat(-.5,": ").concat(-50,"% playback speed.")),-.5):e}function s(e,n){return isNaN(e)?0:e<0?(n&&t.warn("Supplied maximum playback rate is a negative value when it should be negative or 0. The supplied rate will not be applied and set to 0: 100% playback speed."),0):e>1?(n&&t.warn("Supplied maximum playback rate is out of range and will be limited to ".concat(1,": ").concat(200,"% playback speed.")),1):e}function u(){var e=a.get().streaming.buffer.stableBufferTime>0?a.get().streaming.buffer.stableBufferTime:a.get().streaming.buffer.fastSwitchEnabled?20:12,t=n.getLiveDelay();return!isNaN(t)&&t>0?Math.min(e,t):e}return e={getCatchupMaxDrift:function(){if(!isNaN(a.get().streaming.liveCatchup.maxDrift)&&a.get().streaming.liveCatchup.maxDrift>0)return a.get().streaming.liveCatchup.maxDrift;var e=r.getServiceDescriptionSettings();return e&&e.liveCatchup&&!isNaN(e.liveCatchup.maxDrift)&&e.liveCatchup.maxDrift>0?e.liveCatchup.maxDrift:12},getCatchupModeEnabled:function(){return null!==a.get().streaming.liveCatchup.enabled?a.get().streaming.liveCatchup.enabled:n.getInitialCatchupModeActivated()},getStableBufferTime:u,getInitialBufferLevel:function(){var e=a.get().streaming.buffer.initialBufferLevel;return isNaN(e)||e<0?0:Math.min(u(),e)},getRetryAttemptsForType:function(e){var t=isNaN(a.get().streaming.retryAttempts.lowLatencyMultiplyFactor)?5:a.get().streaming.retryAttempts.lowLatencyMultiplyFactor;return n.getLowLatencyModeEnabled()?a.get().streaming.retryAttempts[e]*t:a.get().streaming.retryAttempts[e]},getRetryIntervalsForType:function(e){var t=isNaN(a.get().streaming.retryIntervals.lowLatencyReductionFactor)?10:a.get().streaming.retryIntervals.lowLatencyReductionFactor;return n.getLowLatencyModeEnabled()?a.get().streaming.retryIntervals[e]/t:a.get().streaming.retryIntervals[e]},getCatchupPlaybackRates:function(e){var t=a.get().streaming.liveCatchup.playbackRate;if(!isNaN(t.min)||!isNaN(t.max))return{min:o(t.min,e),max:s(t.max,e)};var n=r.getServiceDescriptionSettings();if(n&&n.liveCatchup&&(!isNaN(n.liveCatchup.playbackRate.min)||!isNaN(n.liveCatchup.playbackRate.max))){var i=n.liveCatchup.playbackRate;return{min:o(i.min,e),max:s(i.max,e)}}return{min:-.5,max:.5}},getAbrBitrateParameter:function(e,t){try{var n=a.get().streaming.abr[e][t];if(!isNaN(n)&&-1!==n)return n;var i=r.getServiceDescriptionSettings();return i&&i[e]&&!isNaN(i[e][t])?i[e][t]:-1}catch(e){return-1}},setConfig:function(e){e.playbackController&&(n=e.playbackController),e.serviceDescriptionController&&(r=e.serviceDescriptionController)},reset:function(){}},t=Object(f.a)(i).getInstance().getLogger(e),e}Dt.__dashjs_factory_name="MediaPlayerModel";var Ot=c.a.getSingletonFactory(Dt),Mt=n(27);function Pt(e){var t=(e=e||{}).abrController,n=e.switchHistory,r=e.droppedFramesHistory,i=e.currentRequest,a=e.useBufferOccupancyABR,o=e.useL2AABR,s=e.useLoLPABR,u=e.streamProcessor?e.streamProcessor.getScheduleController():null,l=e.streamProcessor?e.streamProcessor.getRepresentationInfo():null,c=e.videoModel?e.videoModel:null;function f(){return l?l.mediaInfo:null}return{getMediaType:function(){var e=f();return e?e.type:null},getMediaInfo:f,getDroppedFramesHistory:function(){return r},getCurrentRequest:function(){return i},getSwitchHistory:function(){return n},getStreamInfo:function(){var e=f();return e?e.streamInfo:null},getScheduleController:function(){return u},getAbrController:function(){return t},getRepresentationInfo:function(){return l},useBufferOccupancyABR:function(){return a},useL2AABR:function(){return o},useLoLPABR:function(){return s},getVideoModel:function(){return c}}}Pt.__dashjs_factory_name="RulesContext";var Lt=c.a.getClassFactory(Pt),xt=n(8);function Ft(){var e=[],t=[];return{push:function(n){n.newValue===xt.a.NO_CHANGE&&(n.newValue=n.oldValue),e[n.oldValue]||(e[n.oldValue]={noDrops:0,drops:0,dropSize:0});var r=n.newValue-n.oldValue,i=r<0?1:0,a=i?-r:0,o=i?0:1;if(e[n.oldValue].drops+=i,e[n.oldValue].dropSize+=a,e[n.oldValue].noDrops+=o,t.push({idx:n.oldValue,noDrop:o,drop:i,dropSize:a}),t.length>8){var s=t.shift();e[s.idx].drops-=s.drop,e[s.idx].dropSize-=s.dropSize,e[s.idx].noDrops-=s.noDrop}},getSwitchRequests:function(){return e},reset:function(){e=[],t=[]}}}Ft.__dashjs_factory_name="SwitchRequestHistory";var kt=c.a.getClassFactory(Ft);function Ut(){var e={},t={},n={};return{push:function(r,i,a){if(i){e[r]||(e[r]=[],t[r]=0,n[r]=0);var o=a&&a.droppedVideoFrames?a.droppedVideoFrames:0,s=a&&a.totalVideoFrames?a.totalVideoFrames:0,u=o-t[r];t[r]=o;var l=s-n[r];n[r]=s;var c=e[r];isNaN(i)||(c[i]?(c[i].droppedVideoFrames+=u,c[i].totalVideoFrames+=l):c[i]={droppedVideoFrames:u,totalVideoFrames:l})}},getFrameHistory:function(t){return e[t]},clearForStream:function(r){try{delete e[r],delete t[r],delete n[r]}catch(e){}},reset:function(){e={},t={},n={}}}}Ut.__dashjs_factory_name="DroppedFramesHistory";var Bt=c.a.getClassFactory(Ut);function Gt(e){var t,n,r,i,o,s=(e=e||{}).settings;function u(e,t,n,r){var i=Math.pow(.5,n/r.fast);e.fastEstimate=(1-i)*t+i*e.fastEstimate;var a=Math.pow(.5,n/r.slow);e.slowEstimate=(1-a)*t+a*e.slowEstimate,e.totalWeight+=n}function l(e,u,l){return s.get().streaming.abr.movingAverageMethod!==a.a.MOVING_AVERAGE_SLIDING_WINDOW?function(e,t){var n=e?o.throughputHalfLife:o.latencyHalfLife,a=e?r[t]:i[t];if(!a||a.totalWeight<=0)return NaN;var s=a.fastEstimate/(1-Math.pow(.5,a.totalWeight/n.fast)),u=a.slowEstimate/(1-Math.pow(.5,a.totalWeight/n.slow));return e?Math.min(s,u):Math.max(s,u)}(e,u):function(e,r,i){var a=function(e,r,i){var a,o;if(e?(a=t[r],o=i?3:4):(a=n[r],o=4),a){if(o>=a.length)o=a.length;else if(e)for(var s=1;s=1.3||u<=1/1.3)&&(o+=1)===a.length)break}}else o=0;return o}(e,r,i),o=(e?t:n)[r];if(0===a||!o||0===o.length)return NaN;return(o=o.slice(-a)).reduce((function(e,t){return e+t}))/o.length}(e,u,l)}function c(e,t){return l(!0,e,t)}function f(e){t[e]=t[e]||[],n[e]=n[e]||[],r[e]=r[e]||{fastEstimate:0,slowEstimate:0,totalWeight:0},i[e]=i[e]||{fastEstimate:0,slowEstimate:0,totalWeight:0}}function d(){t={},n={},r={},i={}}var h={push:function(e,l,c){if(l.trace&&l.trace.length){var d=l.tresponse.getTime()-l.trequest.getTime()||1,h=l._tfinish.getTime()-l.tresponse.getTime()||1,g=l.trace.reduce((function(e,t){return e+t.b[0]}),0),p=0,m=0;if(0!==(p=l._fileLoaderType&&l._fileLoaderType===a.a.FILE_LOADER_TYPES.FETCH?l.trace.reduce((function(e,t){return e+t.d}),0):c?h:d+h)&&(m=Math.round(8*g/p)),f(e),function(e,t,n){return e===a.a.VIDEO?n0&&!t[e].hasCachedEntries)return;t[e].hasCachedEntries=!0}else t[e]&&t[e].hasCachedEntries&&function(e){delete t[e],delete n[e],delete r[e],delete i[e],f(e)}(e);t[e].push(m),t[e].length>20&&t[e].shift(),n[e].push(d),n[e].length>20&&n[e].shift(),u(r[e],m,.001*h,o.throughputHalfLife),u(i[e],d,1,o.latencyHalfLife)}},getAverageThroughput:c,getSafeAverageThroughput:function(e,t){var n=c(e,t);return isNaN(n)||(n*=s.get().streaming.abr.bandwidthSafetyFactor),n},getAverageLatency:function(e){return l(!1,e)},reset:d};return o={throughputHalfLife:{fast:3,slow:8},latencyHalfLife:{fast:1,slow:2}},d(),h}Gt.__dashjs_factory_name="ThroughputHistory";var jt=c.a.getClassFactory(Gt);function Yt(){var e,t,n,r,i,o,c,h,g,m,y,E,_,T,b,S,A,I,R,w,N,C,D,M,P,L,x=this.context,F=Object(f.a)(x).getInstance(),k=Object(u.a)(x).getInstance();function U(){i={},o={},h={},c={},R={},C={},D={},M={},void 0===m&&(m=!1),w&&w.reset(),I=void 0,w=void 0,N=void 0,clearTimeout(g),g=null}function B(t){var i=t.request.mediaType,a=t.streamId;if(i&&a&&c[a]&&L.get().streaming.abr.autoSwitchBitrate[i]){var o=c[a][i];if(o){var u=Lt(x).create({abrController:e,streamProcessor:o,currentRequest:t.request,useBufferOccupancyABR:C[i],useL2AABR:D[i],useLoLPABR:M[i],videoModel:T}),l=n.shouldAbandonFragment(u,a);if(l.quality>xt.a.NO_CHANGE)o.getFragmentModel().getRequests({state:p.a.FRAGMENT_MODEL_LOADING,index:t.request.index})[0]&&(h[a][i].state=s.a.ABANDON_LOAD,R[a][i].reset(),R[a][i].push({oldValue:H(i,a),newValue:l.quality,confidence:1,reason:l.reason}),V(i,r.getActiveStreamInfo(),l.quality,l.reason),clearTimeout(g),g=setTimeout((function(){h[a][i].state=s.a.ALLOW_LOAD,g=null}),L.get().streaming.abandonLoadTimeout))}}}function G(e){e.mediaType===a.a.VIDEO&&(void 0!==I&&w.push(e.streamId,I,T.getPlaybackQuality()),I=e.newQuality)}function j(e){var n,r;e.metric!==s.a.HTTP_REQUEST||!e.value||e.value.type!==v.a.MEDIA_SEGMENT_TYPE||e.mediaType!==a.a.AUDIO&&e.mediaType!==a.a.VIDEO||N.push(e.mediaType,e.value,L.get().streaming.abr.useDeadTimeLatency),e.metric!==s.a.BUFFER_LEVEL||e.mediaType!==a.a.AUDIO&&e.mediaType!==a.a.VIDEO||(n=e.mediaType,r=.001*e.value.level,L.get().streaming.abr.ABRStrategy===a.a.ABR_STRATEGY_DYNAMIC&&function(e,n){try{var r=b.getStableBufferTime(),i=r,a=.5*r,o=C[e],s=n>(o?a:i);C[e]=s,s!==o&&(s?t.info("["+e+"] switching from throughput to buffer occupancy ABR rule (buffer: "+n.toFixed(3)+")."):t.info("["+e+"] switching from buffer occupancy to throughput ABR rule (buffer: "+n.toFixed(3)+")."))}catch(e){t.error(e)}}(n,r))}function Y(e,t){try{return i[t]=i[t]||{},i[t].hasOwnProperty(e)||(i[t][e]=0),function(e,t,n){if(t!==a.a.VIDEO||!L.get().streaming.abr.limitBitrateByPortal||!c[n]||!c[n][t])return e;m||Q();var r=c[n][t].getStreamInfo(),i=_.getAdaptationForType(r.index,t,r).Representation_asArray,o=e;if(y>0&&E>0){for(;o>0&&i[o]&&y=1||a<0)return e;return Math.min(e,Math.round(r*a))}(function(e,t){var n=i[t][e],r=n;if(!c[t]||!c[t][e])return r;var a=q(e,t);void 0!==a&&(r=Math.max(n,a));var o=function(e,t){try{var n=b.getAbrBitrateParameter("maxBitrate",e);return n>-1?z(c[t][e].getMediaInfo(),n,t):void 0}catch(e){return}}(e,t);void 0!==o&&(r=Math.min(r,o));return r}(e,t),e,t),e,t)}catch(e){return}}function q(e,t){try{return function(e,t){try{var n=b.getAbrBitrateParameter("minBitrate",e);if(n>-1){var r=c[t][e].getMediaInfo(),i=X(r),a=z(r,n,t);return i[a]&&a1&&void 0!==arguments[1]?arguments[1]:null;try{if(t||(t=r.getActiveStreamInfo().id),e&&c[t]&&c[t][e])if(t)return o[t]=o[t]||{},o[t].hasOwnProperty(e)||(o[t][e]=0),o[t][e];return 0}catch(e){return 0}}function V(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t&&t.id&&e){var i=t.id,a=H(e,i);Object(O.a)(n);var o=Y(e,i);n!==a&&n>=0&&n<=o&&K(e,a,n,o,r,i)}}function K(e,n,r,i,a,s){if(e&&c[s]&&c[s][e]){var u=c[s][e].getStreamInfo(),f=u&&u.manifestInfo&&u.manifestInfo.isDynamic,d=P.getCurrentBufferLevel(e);t.info("Stream ID: "+s+" ["+e+"] switch from "+n+" to "+r+"/"+i+" (buffer: "+d+") "+(a?JSON.stringify(a):".")),o[s]=o[s]||{},o[s][e]=r;var h=function(e,t,n){if(t&&c&&c[e]&&c[e][t]){var r=X(c[e][t].getMediaInfo());return r[n]?r[n]:null}return null}(s,e,r);k.trigger(l.a.QUALITY_CHANGE_REQUESTED,{oldQuality:n,newQuality:r,reason:a,streamInfo:u,bitrateInfo:h,maxIdx:i,mediaType:e},{streamId:u.id,mediaType:e});var g=N.getAverageThroughput(e,f);isNaN(g)||A.setSavedBitrateSettings(e,g)}}function z(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=e&&e.type?c[n][e.type].getRepresentationInfo():null;if(L.get().streaming.abr.useDeadTimeLatency&&r&&i&&i.fragmentDuration){r/=1e3;var a=i.fragmentDuration;if(r>a)return 0;var o=r/a;t*=1-o}for(var s=X(e),u=s.length-1;u>=0;u--){var l=s[u];if(1e3*t>=l.bitrate)return u}return 0}function X(e){var t=[];if(!e||!e.bitrateList)return t;for(var n,r=e.bitrateList,i=e.type,a=0,o=r.length;a1&&void 0!==arguments[1]?arguments[1]:null;if(t||(t=r.getActiveStreamInfo().id),e&&c&&c[t]&&c[t][e]){var n=Y(e,t),i=X(c[t][e].getMediaInfo());return i[n]?i[n]:null}return null},getMinAllowedIndexFor:q,getMaxAllowedIndexFor:Y,getInitialBitrateFor:function(e,t){if(function(){if(!A||!A.hasOwnProperty("getSavedBitrateSettings"))throw new Error(a.a.MISSING_CONFIG_ERROR)}(),e===a.a.TEXT)return NaN;var n=A.getSavedBitrateSettings(e),r=b.getAbrBitrateParameter("initialBitrate",e),i=L.get().streaming.abr.initialRepresentationRatio[e];if(-1===r)if(i>-1){var o=c[t][e].getStreamInfo(),s=_.getAdaptationForType(o.index,e,o).Representation_asArray;if(Array.isArray(s))r=s[Math.max(Math.round(s.length*i)-1,0)].bandwidth/1e3;else r=0}else r=isNaN(n)?e===a.a.VIDEO?1e3:100:n;return r},getQualityFor:H,getAbandonmentStateFor:function(e,t){return h[e]&&h[e][t]?h[e][t].state:null},setPlaybackQuality:V,checkPlaybackQuality:function(t,r){try{if(!(t&&c&&c[r]&&c[r][t]))return!1;if(w){var i=T.getPlaybackQuality();i&&w.push(r,I,i)}if(!L.get().streaming.abr.autoSwitchBitrate[t])return!1;var a=H(t,r),o=Lt(x).create({abrController:e,switchHistory:R[r][t],droppedFramesHistory:w,streamProcessor:c[r][t],currentValue:a,useBufferOccupancyABR:C[t],useL2AABR:D[t],useLoLPABR:M[t],videoModel:T}),u=q(t,r),l=Y(t,r),f=n.getMaxQuality(o),d=f.quality;return void 0!==u&&(d>xt.a.NO_CHANGE?d:a)l&&(d=l),R[r][t].push({oldValue:a,newValue:d}),d>xt.a.NO_CHANGE&&d!==a&&(h[r][t].state===s.a.ALLOW_LOAD||d0}function g(){if(n&&h()&&0===n.playbackRate){var e=document.createEvent("Event");e.initEvent("waiting",!0,!1),n.dispatchEvent(e)}}function p(e,t){n&&n.addEventListener(e,t)}function m(e,t){n&&n.removeEventListener(e,t)}function y(){return n?n.readyState:NaN}function E(){return n?n.buffered:null}function v(e,t,r,i,a){if(n)for(var o=0;o=e?t():function(e,t){p(e,(function n(){m(e,n),t(e)}))}(Kt.get(e),t)}return e={initialize:function(){s.on(l.a.PLAYBACK_PLAYING,g,this)},setCurrentTime:function(e,t){r=e,_(a.a.VIDEO_ELEMENT_READY_STATES.HAVE_METADATA,(function(){if(n){if(n.currentTime===r)return void(r=NaN);try{r=t?function(e){var t=E(),n=e,r=9999999999;if(t)for(var i=0;i=a&&e<=o)return e;s1&&void 0!==arguments[1]&&arguments[1];n&&(!t&&n.readyState<=2&&e>0?n.addEventListener("canplay",d):n.playbackRate=e)},getPlayedRanges:function(){return n?n.played:null},getEnded:function(){return n?n.ended:null},setStallState:function(e,t){!function(e,t){t?function(e){if(null===e||!n||n.seeking||-1!==c.indexOf(e))return;c.push(e)}(e):function(e){var t=c.indexOf(e);if(null===e)return;-1!==t&&c.splice(t,1)}(e)}(e,t)},getElement:function(){return n},setElement:function(e){if(!(null==e||e&&/^(VIDEO|AUDIO)$/i.test(e.nodeName)))throw"element is not video or audio DOM type!";(n=e)&&(n.preload="auto")},setSource:function(e){n&&(e?n.src=e:(n.removeAttribute("src"),n.load()))},getSource:function(){return n?n.src:null},getTTMLRenderingDiv:function(){return i},setTTMLRenderingDiv:function(e){(i=e).style.position="absolute",i.style.display="flex",i.style.overflow="hidden",i.style.pointerEvents="none",i.style.top=0,i.style.left=0},getPlaybackQuality:function(){if(!n)return null;var e="webkitDroppedFrameCount"in n&&"webkitDecodedFrameCount"in n,t=null;return"getVideoPlaybackQuality"in n?t=n.getVideoPlaybackQuality():e&&(t={droppedVideoFrames:n.webkitDroppedFrameCount,totalVideoFrames:n.webkitDroppedFrameCount+n.webkitDecodedFrameCount,creationTime:new Date}),t},addEventListener:p,removeEventListener:m,getReadyState:y,getBufferRange:E,getClientWidth:function(){return n?n.clientWidth:NaN},getClientHeight:function(){return n?n.clientHeight:NaN},getTextTracks:function(){return n?n.textTracks:[]},getTextTrack:v,addTextTrack:function(e,t,r,i,a){if(!n)return null;var o=v(e,t,r,i,a);return o||((o=n.addTextTrack(e,t,r)).isEmbedded=a,o.isTTML=i),o},appendChild:function(e){n&&(n.appendChild(e),void 0!==e.isTTML&&(n.textTracks[n.textTracks.length-1].isTTML=e.isTTML,n.textTracks[n.textTracks.length-1].isEmbedded=e.isEmbedded))},removeChild:function(e){n&&n.removeChild(e)},getVideoWidth:function(){return n?n.videoWidth:NaN},getVideoHeight:function(){return n?n.videoHeight:NaN},getVideoRelativeOffsetTop:function(){var e=n.parentNode.host||n.parentNode;return e?n.getBoundingClientRect().top-e.getBoundingClientRect().top:NaN},getVideoRelativeOffsetLeft:function(){var e=n.parentNode.host||n.parentNode;return e?n.getBoundingClientRect().left-e.getBoundingClientRect().left:NaN},waitForReadyState:_,reset:function(){s.off(l.a.PLAYBACK_PLAYING,g,this)}},t=Object(f.a)(o).getInstance().getLogger(e),r=NaN,e}zt.__dashjs_factory_name="VideoModel";var Wt=c.a.getSingletonFactory(zt),Xt=n(44),Qt=[{oldKey:"dashjs_vbitrate",newKey:"dashjs_video_bitrate"},{oldKey:"dashjs_abitrate",newKey:"dashjs_audio_bitrate"},{oldKey:"dashjs_vsettings",newKey:"dashjs_video_settings"},{oldKey:"dashjs_asettings",newKey:"dashjs_audio_settings"}];function Zt(e){e=e||{};var t,n,r,i=this.context,o=e.settings;function s(e){if(void 0!==r)return r;r=!1;var t;try{"undefined"!=typeof window&&(t=window[e])}catch(e){return n.warn("DOMStorage access denied: "+e.message),r}if(!t||"localStorage"!==e&&"sessionStorage"!==e)return r;try{t.setItem("1","1"),t.removeItem("1"),r=!0}catch(e){n.warn("DOMStorage is supported, but cannot be used: "+e.message)}return r}function u(){return 6e5*Math.round((new Date).getTime()/6e5)}function l(e,t){return s(e)&&o.get().streaming[t+"CachingInfo"].enabled}function c(){if(!o)throw new Error(a.a.MISSING_CONFIG_ERROR)}return t={getSavedBitrateSettings:function(e){if(c(),!o.get().streaming.lastBitrateCachingInfo.enabled)return NaN;var t=NaN;if(l("localStorage","lastBitrate")){var r="dashjs_?_bitrate".replace(/\?/,e);try{var i=JSON.parse(localStorage.getItem(r))||{},a=(new Date).getTime()-parseInt(i.timestamp,10)>=o.get().streaming.lastBitrateCachingInfo.ttl||!1,s=parseFloat(i.bitrate);isNaN(s)||a?a&&localStorage.removeItem(r):(t=s,n.debug("Last saved bitrate for "+e+" was "+s))}catch(e){return null}}return t},setSavedBitrateSettings:function(e,t){if(l("localStorage","lastBitrate")&&t){var r="dashjs_?_bitrate".replace(/\?/,e);try{localStorage.setItem(r,JSON.stringify({bitrate:t.toFixed(3),timestamp:u()}))}catch(e){n.error(e.message)}}},getSavedMediaSettings:function(e){if(c(),!o.get().streaming.lastMediaSettingsCachingInfo.enabled)return null;var t=null;if(l("localStorage","lastMediaSettings")){var n="dashjs_?_settings".replace(/\?/,e);try{var r=JSON.parse(localStorage.getItem(n))||{},i=(new Date).getTime()-parseInt(r.timestamp,10)>=o.get().streaming.lastMediaSettingsCachingInfo.ttl||!1;t=r.settings,i&&(localStorage.removeItem(n),t=null)}catch(e){return null}}return t},setSavedMediaSettings:function(e,t){if(l("localStorage","lastMediaSettings")){var r="dashjs_?_settings".replace(/\?/,e);try{localStorage.setItem(r,JSON.stringify({settings:t,timestamp:u()}))}catch(e){n.error(e.message)}}}},n=Object(f.a)(i).getInstance().getLogger(t),s("localStorage")&&Qt.forEach((function(e){var t=localStorage.getItem(e.oldKey);if(t){localStorage.removeItem(e.oldKey);try{localStorage.setItem(e.newKey,t)}catch(e){n.error(e.message)}}})),t}Zt.__dashjs_factory_name="DOMStorage";var $t=c.a.getSingletonFactory(Zt),Jt=n(59),en=n(33);function tn(){var e,t,n,r,i,a,o,s,u,l,c,f,d,h=this.context;function g(e,t,n){n({segments:e,representation:t,error:e?void 0:new m.a(u.SEGMENT_BASE_LOADER_ERROR_CODE,u.SEGMENT_BASE_LOADER_ERROR_MESSAGE)})}function p(e){if(e.url){var t=new at.a;return t.setInfo(e),t}}return e={setConfig:function(s){s.baseURLController&&(d=s.baseURLController),s.dashMetrics&&(a=s.dashMetrics),s.mediaPlayerModel&&(o=s.mediaPlayerModel),s.errHandler&&(n=s.errHandler),s.boxParser&&(r=s.boxParser),s.debug&&(t=s.debug.getLogger(e)),s.requestModifier&&(i=s.requestModifier),s.errors&&(u=s.errors),s.urlUtils&&(f=s.urlUtils),s.constants&&(l=s.constants),s.dashConstants&&(c=s.dashConstants)},initialize:function(){s=Object(De.a)(h).create({errHandler:n,dashMetrics:a,mediaPlayerModel:o,requestModifier:i,boxParser:r,errors:u,urlUtils:f,constants:l,dashConstants:c})},loadInitialization:function(e,n){return new Promise((function(i){!function e(n,i,a,o){var u=null,l=n?d.resolve(n.path):null,c=o||{init:!0,url:l?l.url:void 0,range:{start:0,end:1500},searching:!1,bytesLoaded:0,bytesToLoad:1500,mediaType:i};t.debug("Start searching for initialization.");var f=p(c),h=function(t){if(c.bytesLoaded=c.range.end,!(u=r.findInitRange(t)))return c.range.end=c.bytesLoaded+c.bytesToLoad,e(n,i,a,c);n.range=u,a(n)};s.load({request:f,success:h,error:function(){a(n)}}),t.debug("Perform init search: "+c.url)}(e,n,i)}))},loadSegments:function(e,n,i){return new Promise((function(a){!function e(n,i,a,o,u,l){if(a&&(void 0===a.start||void 0===a.end)){var c=a?a.toString().split("-"):null;a=c?{start:parseFloat(c[0]),end:parseFloat(c[1])}:null}u=u||g;var f=null,h=null,m=!!a,y=n?d.resolve(n.path):null,E={init:!1,url:y?y.url:void 0,range:m?a:{start:0,end:1500},searching:!m,bytesLoaded:l?l.bytesLoaded:0,bytesToLoad:1500,mediaType:i},v=p(E),_=function(a){var s=E.bytesToLoad,l=a.byteLength;if(E.bytesLoaded=E.range.end-E.range.start,f=r.parse(a),(h=f.getBox("sidx"))&&h.isComplete){var c,d,g=h.references;if(null!=g&&g.length>0&&(c=1===g[0].reference_type),c){var p,m,y,v;t.debug("Initiate multiple SIDX load."),E.range.end=E.range.start+h.size;var _=[],T=0,b=(h.offset||E.range.start)+h.size,S=function(e){e?(_=_.concat(e),++T>=m&&(_.sort((function(e,t){return e.startTime-t.startTime<0?-1:0})),u(_,n,o))):u(null,n,o)};for(p=0,m=g.length;p16777215?(n.getUint32(r)!==e.tag&&(i=!1),a=4):e.tag>65535?(256*n.getUint16(r)+n.getUint8(r+2)!==e.tag&&(i=!1),a=3):e.tag>255?(n.getUint16(r)!==e.tag&&(i=!1),a=2):(n.getUint8(r)!==e.tag&&(i=!1),a=1),!i&&e.required&&!t)throw new Error("required tag not found");return i&&(r+=a),i}function a(e){var t=1,i=128,a=-1,o=0,s=n.getUint8(r),u=0;for(u=0;u<8;u+=1){if((s&i)===i){o=void 0===e?s&~i:s,a=u;break}i>>=1}for(u=0;u1&&a){var l=d(a,n);if(i[a.id]&&i[a.id][n])for(var f=0,h=u.length;f0))return u;s=r[0].mpd.manifest}var l=E(e,o),c=t.getAdaptationsForType(s,e?e.index:null,n);return u=f(s,l,e,c,n),n===a.TEXT&&(c=t.getAdaptationsForType(s,e?e.index:null,a.VIDEO),u=u.concat(f(s,l,e,c,n,!0))),u}function h(e){var n=g(e);return t.getRegularPeriods(n)}function g(e){var n=m(e);return t.getMpd(n)}function p(){r=[],i={}}function m(e){return e||(r.length>0?r[0].mpd.manifest:null)}function y(e){try{var n=E(e.streamInfo,r),i=t.getAdaptationsForPeriod(n);return e&&e.streamInfo&&void 0!==e.streamInfo.id&&i?i[e.index]:null}catch(e){return null}}function E(e,t){for(var n=t.length,r=0;r=0&&void 0!==s&&(n=t?"cea-608:"+t:"cea-608",r.embeddedCaptions=!0),n})),r.audioChannelConfiguration=t.getAudioChannelConfigurationForAdaptation(i).map((function(e){return e.value})),0===r.audioChannelConfiguration.length&&Array.isArray(i.Representation_asArray)&&i.Representation_asArray.length>0&&(r.audioChannelConfiguration=t.getAudioChannelConfigurationForRepresentation(i.Representation_asArray[0]).map((function(e){return e.value}))),r.roles=t.getRolesForAdaptation(i).map((function(e){return e.value})),r.codec=t.getCodec(i),r.mimeType=t.getMimeType(i),r.contentProtection=t.getContentProtectionData(i),r.bitrateList=t.getBitrateListForAdaptation(i),r.selectionPriority=t.getSelectionPriority(i),r.contentProtection){var a=r.contentProtection.map((function(e){return t.getKID(e)})).filter((function(e){return null!==e}));if(a.length){var o=a[0];r.contentProtection.forEach((function(e){e.keyId=o}))}}return r.isText=t.getIsText(i),r.supplementalProperties=t.getSupplementalProperties(i),r.isFragmented=t.getIsFragmented(i),r.isEmbedded=!1,r}function _(e,t,n){e.id=t,e.index=100+parseInt(t.substring(2,3)),e.type=a.TEXT,e.codec="cea-608-in-SEI",e.isEmbedded=!0,e.isFragmented=!1,e.lang=Be()(n),e.roles=["caption"]}function T(e){var n,r,i=new dn;return i.id=e.id,i.index=e.index,i.start=e.start,i.duration=e.duration,i.manifestInfo=(n=e.mpd,(r=new hn).dvrWindowSize=n.timeShiftBufferDepth,r.loadedTime=n.manifest.loadedTime,r.availableFrom=n.availabilityStartTime,r.minBufferTime=n.manifest.minBufferTime,r.maxFragmentDuration=n.maxSegmentDuration,r.duration=t.getDuration(n.manifest),r.isDynamic=t.getIsDynamic(n.manifest),r.serviceDescriptions=t.getServiceDescriptions(n.manifest),r.protocol=n.manifest.protocol,r),i.isLast=1===e.mpd.manifest.Period_asArray.length||Math.abs(i.start+i.duration-i.manifestInfo.duration)<1,i}function b(){if(!a)throw new Error("setConfig function has to be called previously")}function S(e){return r.length>0?r[0].mpd.manifest.Period_asArray[e]:null}function A(e,t,n){var r,i,a,o,s;if(e)for(r=e.AdaptationSet_asArray,o=0;o0?e.segments[0].duration:NaN),n.MSETimeOffset=e.MSETimeOffset,n.mediaInfo=v(e.adaptation),n}return null},getStreamsInfo:function(e,t){var n=[],i=r;if(e&&(b(),i=h(e)),i.length>0){(!t||t>i.length)&&(t=i.length);for(var a=0;a0&&o&&(a=i?t.getAdaptationForId(i,r[0].mpd.manifest,o.index):t.getAdaptationForIndex(n?n.index:null,r[0].mpd.manifest,o.index)),a},getProducerReferenceTimes:function(e,n){var i,a,o=E(e,r);return i=n?n.id:null,r.length>0&&o&&(a=i?t.getAdaptationForId(i,r[0].mpd.manifest,o.index):t.getAdaptationForIndex(n?n.index:null,r[0].mpd.manifest,o.index)),a?t.getProducerReferenceTimesForAdaptation(a):[]},getRealPeriodByIndex:function(e){return t.getRealPeriodForIndex(e,r[0].mpd.manifest)},getEssentialPropertiesForRepresentation:function(e){try{return t.getEssentialPropertiesForRepresentation(e)}catch(e){return[]}},getVoRepresentations:function(e){var n=y(e);return t.getRepresentationsForAdaptation(n)},getEventsFor:function(e,n,i){var a=[];if(r.length>0){var o=r[0].mpd.manifest;if(e instanceof dn){var s=E(e,r);a=t.getEventsForPeriod(s)}else if(e instanceof fn){var u=E(i,r);a=t.getEventStreamForAdaptationSet(o,y(e),u)}else if(e instanceof cn){var l=E(i,r);a=t.getEventStreamForRepresentation(o,n,l)}}return a},getEvent:function(e,t,n,r){try{if(!e||!t||isNaN(n)||!r)return null;var i=e.scheme_id_uri,a=e.value;if(!t[i+"/"+a])return null;var o,s=new gn.a,u=e.timescale||1,l=r.adaptation.period.start,c=t[i+"/"+a],f=isNaN(r.presentationTimeOffset)?isNaN(c.presentationTimeOffset)?0:c.presentationTimeOffset:r.presentationTimeOffset,d=e.presentation_time_delta/u;o=0===e.version?l+n-f+d:l-f+d;var h=e.event_duration/u,g=e.id,p=e.message_data;return s.eventStream=c,s.eventStream.value=a,s.eventStream.timescale=u,s.duration=h,s.id=g,s.calculatedPresentationTime=o,s.messageData=p,s.presentationTimeDelta=d,s}catch(e){return null}},getMpd:g,setConfig:function(e){e&&(e.constants&&(a=e.constants),e.cea608parser&&(s=e.cea608parser),e.errHandler&&t.setConfig({errHandler:e.errHandler}),e.BASE64&&t.setConfig({BASE64:e.BASE64}))},updatePeriods:function(e){if(!e)return null;b(),r=h(e)},getIsTextTrack:function(e){return t.getIsText(e)},getUTCTimingSources:function(){var e=m();return t.getUTCTimingSources(e)},getSuggestedPresentationDelay:function(){var e=r.length>0?r[0].mpd:null;return t.getSuggestedPresentationDelay(e)},getAvailabilityStartTime:function(e){var n=g(e);return t.getAvailabilityStartTime(n)},getIsTypeOf:function(e,n){return t.getIsTypeOf(e,n)},getIsDynamic:function(e){var n=m(e);return t.getIsDynamic(n)},getDuration:function(e){var n=m(e);return t.getDuration(n)},getRegularPeriods:h,getContentSteering:function(e){return t.getContentSteering(e)},getLocation:function(e){return t.getLocation(e)},getPatchLocation:function(e){var n=t.getPatchLocation(e),r=t.getPublishTime(e);if(!n||!r)return null;if(n.hasOwnProperty("ttl")&&r){var i=1e3*parseFloat(n.ttl);if(r.getTime()+i<=(new Date).getTime())return null}return n.__text},getManifestUpdatePeriod:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.getManifestUpdatePeriod(e,n)},getPublishTime:function(e){return t.getPublishTime(e)},getIsDVB:function(e){return t.hasProfile(e,"urn:dvb:dash:profile:dvb-dash:2014")},getIsPatch:function(e){return n.getIsPatch(e)},getBaseURLsFromElement:function(e){return t.getBaseURLsFromElement(e)},getRepresentationSortFunction:function(){return t.getRepresentationSortFunction()},getCodec:function(e,n,r){return t.getCodec(e,n,r)},getPeriodById:function(e){if(!e||0===r.length)return null;var t=r.filter((function(t){return t.id===e}));return t&&t.length>0?t[0]:null},setCurrentMediaInfo:function(e,t,n){i[e]=i[e]||{},i[e][t]=i[e][t]||{},i[e][t]=n},isPatchValid:function(e,r){var i=t.getId(e),a=n.getMpdId(r),o=t.getPublishTime(e),s=n.getPublishTime(r),u=n.getOriginalPublishTime(r);return!!(i&&a&&i==a&&o&&u&&o.getTime()==u.getTime()&&s&&o.getTime()1?i[r]=u:1==u.length?i[r]=u[0]:delete i[r+"_asArray"]}"add"!==t.action&&"replace"!==t.action||Object.keys(t.value).forEach((function(e){var n=t.value[e],a=i[e+"_asArray"]||[];if(0===a.length&&i[e]&&a.push(i[e]),0===a.length)a=n;else{var u=a.length;u=e==r&&-1!=o?o+(s?0:1)+("replace"==t.action?-1:0):s?0:a.length,a.splice.apply(a,[u,0].concat(n))}i[e+"_asArray"]=a,i[e]=1==a.length?a[0]:a}))}}}))},areMediaInfosEqual:c,reset:p},t=Object(pn.a)(u).getInstance(),n=Tn(u).getInstance(),p(),e}bn.__dashjs_factory_name="DashAdapter";var Sn=c.a.getSingletonFactory(bn);function An(e,t){for(var n=0;nr.get().streaming.metrics.maxListDepth&&i[t].shift())}function m(e,t,n){p(e,t,n),h(e,t,n)}return t={clearCurrentMetricsForType:function(e){delete n[e],f(e)},clearAllCurrentMetrics:function(){n={},c()},getMetricsFor:g,addHttpRequest:function e(t,n,r,i,a,o,u,l,c,f,d,h,g,p,y,E){var _=new v.a;o&&o!==i&&(e(t,null,r,i,a,null,null,l,c,null,null,null,g,null,null,E),_.actualurl=o),_.tcpid=n,_.type=r,_.url=i,_.range=l,_.trequest=c,_.tresponse=f,_.responsecode=h,_._tfinish=d,_._stream=t,_._mediaduration=g,_._quality=a,_._responseHeaders=p,_._serviceLocation=u,_._fileLoaderType=E,y?y.forEach((function(e){!function(e,t,n,r){var i=new v.b;i.s=t,i.d=n,i.b=r,e.trace.push(i),e.interval||(e.interval=0),e.interval+=n}(_,e.s,e.d,e.b)})):(delete _.interval,delete _.trace),m(t,s.a.HTTP_REQUEST,_)},addRepresentationSwitch:function(e,t,n,r,i){var a=new wn;a.t=t,a.mt=n,a.to=r,i?a.lto=i:delete a.lto,m(e,s.a.TRACK_SWITCH,a)},addBufferLevel:function(e,t,n){var r=new Nn;r.t=t,r.level=n,m(e,s.a.BUFFER_LEVEL,r)},addBufferState:function(e,t,n){var r=new Cn;r.target=n,r.state=t,m(e,s.a.BUFFER_STATE,r)},addDVRInfo:function(e,t,n,r){var i=new Dn;i.time=t,i.range=r,i.manifestInfo=n,m(e,s.a.DVR_INFO,i)},addDroppedFrames:function(e,t){var n=new On,r=g(e).DroppedFrames;t&&(n.time=t.creationTime,n.droppedFrames=t.droppedVideoFrames,r.length>0&&r[r.length-1]==n||m(e,s.a.DROPPED_FRAMES,n))},addSchedulingInfo:function(e,t,n,r,i,a,o,u,l){var c=new Fn;c.mediaType=e,c.t=t,c.type=n,c.startTime=r,c.availabilityStartTime=i,c.duration=a,c.quality=o,c.range=u,c.state=l,m(e,s.a.SCHEDULING_INFO,c)},addRequestsQueue:function(e,t,n){var r=new kn;r.loadingRequests=t,r.executedRequests=n,g(e).RequestsQueue=r,h(e,s.a.REQUESTS_QUEUE,r)},addManifestUpdate:function(e,t,n,r,i,o,u,l,c,f){var d=new Pn;d.mediaType=e,d.type=t,d.requestTime=n,d.fetchTime=r,d.availabilityStartTime=i,d.presentationStartTime=o,d.clientTimeOffset=u,d.currentTime=l,d.buffered=c,d.latency=f,p(a.a.STREAM,s.a.MANIFEST_UPDATE,d),h(e,s.a.MANIFEST_UPDATE,d)},updateManifestUpdateInfo:function(e,t){if(e){for(var n in t)e[n]=t[n];d(e.mediaType,s.a.MANIFEST_UPDATE,e)}},addManifestUpdateStreamInfo:function(e,t,n,r,i){if(e){var a=new Ln;a.id=t,a.index=n,a.start=r,a.duration=i,e.streamInfo.push(a),d(e.mediaType,s.a.MANIFEST_UPDATE_STREAM_INFO,e)}},addManifestUpdateRepresentationInfo:function(e,t,n,r,i,a,o,u){if(e&&e.representationInfo){var l=new xn;l.id=t,l.index=n,l.streamIndex=r,l.mediaType=i,l.startNumber=o,l.fragmentInfoType=u,l.presentationTimeOffset=a,e.representationInfo.push(l),d(e.mediaType,s.a.MANIFEST_UPDATE_TRACK_INFO,e)}},addPlayList:function(e){e.trace&&Array.isArray(e.trace)?e.trace.forEach((function(e){e.hasOwnProperty("subreplevel")&&!e.subreplevel&&delete e.subreplevel})):delete e.trace,m(a.a.STREAM,s.a.PLAY_LIST,e)},addDVBErrors:function(e){m(a.a.STREAM,s.a.DVB_ERRORS,e)}},n={},t}Un.__dashjs_factory_name="MetricsModel";var Bn=c.a.getSingletonFactory(Un);function Gn(e){e=e||{};var t,n,r,i,o=this.context,u=e.metricsModel;function l(e){var t=u.getMetricsFor(e,!0);if(!t)return null;var n,r=t.HttpList,i=null;if(!r||r.length<=0)return null;for(n=r.length-1;n>=0;){if(r[n].responsecode){i=r[n];break}n--}return i}function c(e){var t=u.getMetricsFor(e,!0);return t&&t.HttpList?t.HttpList:[]}function f(e,t){if(!e)return null;var n=e[t];return n&&0!==n.length?n[n.length-1]:null}return t={getCurrentRepresentationSwitch:function(e){return f(u.getMetricsFor(e,!0),s.a.TRACK_SWITCH)},getCurrentBufferState:function(e){return f(u.getMetricsFor(e,!0),s.a.BUFFER_STATE)},getCurrentBufferLevel:function(e){var t=f(u.getMetricsFor(e,!0),s.a.BUFFER_LEVEL);return t?In.round10(t.level/1e3,-3):0},getCurrentHttpRequest:l,getHttpRequests:c,getCurrentDroppedFrames:function(){return f(u.getMetricsFor(a.a.VIDEO,!0),s.a.DROPPED_FRAMES)},getCurrentSchedulingInfo:function(e){return f(u.getMetricsFor(e,!0),s.a.SCHEDULING_INFO)},getCurrentDVRInfo:function(e){return f(e?u.getMetricsFor(e,!0):u.getMetricsFor(a.a.VIDEO,!0)||u.getMetricsFor(a.a.AUDIO,!0),s.a.DVR_INFO)},getCurrentManifestUpdate:function(){return f(u.getMetricsFor(a.a.STREAM),s.a.MANIFEST_UPDATE)},getLatestFragmentRequestHeaderValueByID:function(e,t){if(!t)return null;var n={},r=l(e);r&&(n=_e.a.parseHttpHeaders(r._responseHeaders));var i=n[t.toLowerCase()];return void 0===i?null:i},getLatestMPDRequestHeaderValueByID:function(e){if(!e)return null;var t,n,r,i={};for(r=(t=c(a.a.STREAM)).length-1;r>=0;r--)if((n=t[r]).type===v.a.MPD_TYPE){i=_e.a.parseHttpHeaders(n._responseHeaders);break}var o=i[e.toLowerCase()];return void 0===o?null:o},addRepresentationSwitch:function(e,t,n,r,i){u.addRepresentationSwitch(e,t,n,r,i)},addDVRInfo:function(e,t,n,r){u.addDVRInfo(e,t,n,r)},updateManifestUpdateInfo:function(e){var t=this.getCurrentManifestUpdate();u.updateManifestUpdateInfo(t,e)},addManifestUpdateStreamInfo:function(e){if(e){var t=this.getCurrentManifestUpdate();u.addManifestUpdateStreamInfo(t,e.id,e.index,e.start,e.duration)}},addManifestUpdateRepresentationInfo:function(e,t){if(e){var n=this.getCurrentManifestUpdate();u.addManifestUpdateRepresentationInfo(n,e.id,e.index,e.streamIndex,t,e.presentationTimeOffset,e.startNumber,e.fragmentInfoType)}},addManifestUpdate:function(e){u.addManifestUpdate(a.a.STREAM,e.type,e.requestStartDate,e.requestEndDate)},addHttpRequest:function(e,t,n,r,i){u.addHttpRequest(e.mediaType,null,e.type,e.url,e.quality,t,e.serviceLocation||null,e.range||null,e.requestStartDate,e.firstByteDate,e.requestEndDate,n,e.duration,r,i,e.fileLoaderType)},addSchedulingInfo:function(e,t){u.addSchedulingInfo(e.mediaType,new Date,e.type,e.startTime,e.availabilityStartTime,e.duration,e.quality,e.range,t)},addRequestsQueue:function(e,t,n){u.addRequestsQueue(e,t,n)},addBufferLevel:function(e,t,n){u.addBufferLevel(e,t,n)},addBufferState:function(e,t,n){u.addBufferState(e,t,n)},addDroppedFrames:function(e){u.addDroppedFrames(a.a.VIDEO,e)},addPlayList:function(){i&&(u.addPlayList(i),i=null)},addDVBErrors:function(e){u.addDVBErrors(e)},createPlaylistMetrics:function(e,t){(i=new k).start=new Date,i.mstart=e,i.starttype=t},createPlaylistTraceMetrics:function(e,t,i){!0===n&&(n=!1,(r=new U).representationid=e,r.start=new Date,r.mstart=t,r.playbackspeed=null!==i?i.toString():null)},updatePlayListTraceMetrics:function(e){if(r)for(var t in r)r[t]=e[t]},pushPlayListTraceMetrics:function(e,t){if(!1===n&&i&&r&&r.start){var a=r.start,o=e.getTime()-a.getTime();r.duration=o,r.stopreason=t,i.trace.push(r),n=!0}},clearAllCurrentMetrics:function(){u.clearAllCurrentMetrics()}},u=u||Bn(o).getInstance({settings:e.settings}),n=!0,r=null,i=null,t}Gn.__dashjs_factory_name="DashMetrics";var jn=c.a.getSingletonFactory(Gn);function Yn(){var e,t,n,r,i=this.context,s=Object(u.a)(i).getInstance(),c=Object(E.a)(i).getInstance();function f(e){r=e}function h(e,t,n,r){var i,a=t.adaptation.period.mpd,o=a.availabilityStartTime;if(r)i=n&&a.timeShiftBufferDepth!==Number.POSITIVE_INFINITY?new Date(o.getTime()+1e3*(e+a.timeShiftBufferDepth)):a.availabilityEndTime;else if(n){var s=t.availabilityTimeOffset;i=new Date(o.getTime()+1e3*(e-s))}else i=o;return i}function g(e,t){return(e.getTime()-t.mpd.availabilityStartTime.getTime()+1e3*r)/1e3}function p(e,t){return e+(t.adaptation.period.start-t.presentationTimeOffset)}function m(e){var n={start:NaN,end:NaN},r=e[0].getAdapter().getRegularPeriods()[0],i=g(new Date,r);if(!e||0===e.length)return{range:n,now:i};e.forEach((function(e){var r=e.getAdapter(),s=r.getMediaInfoForType(e.getStreamInfo(),a.a.VIDEO)||r.getMediaInfoForType(e.getStreamInfo(),a.a.AUDIO),u=r.getVoRepresentations(s)[0],l={start:NaN,end:NaN};if(u)if(u.segmentInfoType===o.a.SEGMENT_TIMELINE)l=function(e){var n,r,i,a,o=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index],s=t.getRepresentationFor(e.index,o),u=s.SegmentTemplate.SegmentTimeline,l=s.SegmentTemplate.timescale,c=u.S_asArray,f={start:0,end:0},d=0;for(f.start=p(c[0].t/l,e),i=0,a=c.length;il.start)&&(n.start=l.start),!isNaN(l.end)&&(isNaN(n.end)||n.end2&&void 0!==arguments[2]&&arguments[2];try{for(var r=0,i=!1,a=NaN;!i&&r=t)?(a=t,i=!0):!n&&o.start>t&&(isNaN(a)||o.starta)&&(a=o.start+o.duration),r+=1}return a}catch(e){return t}}function _(e){void 0===e.offset||isNaN(e.offset)||f(e.offset/1e3)}function T(){r=0,n=0}function b(){s.off(l.a.UPDATE_TIME_SYNC_OFFSET,_,this),T()}return e={initialize:function(){T(),s.on(l.a.UPDATE_TIME_SYNC_OFFSET,_,this)},getClientTimeOffset:function(){return r},setClientTimeOffset:f,getClientReferenceTime:function(){return Date.now()-1e3*n+1e3*r},calcAvailabilityStartTimeFromPresentationTime:function(e,t,n){return h(e,t,n)},calcAvailabilityEndTimeFromPresentationTime:function(e,t,n){return h(e,t,n,!0)},calcPresentationTimeFromWallTime:g,calcPresentationTimeFromMediaTime:p,calcPeriodRelativeTimeFromMpdRelativeTime:function(e,t){return t-e.adaptation.period.start},calcMediaTimeFromPresentationTime:function(e,t){return e-t.adaptation.period.start+t.presentationTimeOffset},calcWallTimeForSegment:function(e,t){var n,r,i;return t&&(n=e.representation.adaptation.period.mpd.suggestedPresentationDelay,r=e.presentationStartTime+n,i=new Date(e.availabilityStartTime.getTime()+1e3*r)),i},calcTimeShiftBufferWindow:function(e,t){if(!t)return function(e){var t={start:NaN,end:NaN},n=0,r=NaN;return e.forEach((function(e){var t=e.getStreamInfo();n+=t.duration,(isNaN(r)||t.start0&&(p.spans.push({name:m,line:T,row:c}),T="");var w="style_cea608_"+R.foreground+"_"+R.background;R.underline&&(w+="_underline"),R.italics&&(w+="_italics"),E.hasOwnProperty(w)||(E[w]=JSON.parse(JSON.stringify(R))),b=R,m=w}T+=I.uchar}T.trim().length>0&&p.spans.push({name:m,line:T,row:c}),h=!0,g=S}else h=!1,g=-1,d&&(d.p.push(p),p={start:s,end:u,spans:[]},d.y2=c,d.name="region_"+d.x+"_"+d.y1+"_"+d.y2,!1===y.hasOwnProperty(d.name)?(v.push(d),y[d.name]=d):y[d.name].p.contat(d.p),d=null)}d&&(d.p.push(p),d.y2=c+1,d.name="region_"+d.x+"_"+d.y1+"_"+d.y2,!1===y.hasOwnProperty(d.name)?(v.push(d),y[d.name]=d):y[d.name].p.contat(d.p),d=null);var N=[];for(c=0;c0){if(0!==f&&k!=U.row){var B=document.createElement("br");B.className="lineBreak",L.appendChild(B)}var G=!1;k===U.row&&(G=!0),k=U.row;var j=E[U.name],Y=document.createElement("span");Y.className="spanPadding "+U.name+" customSpanColor",Y.style.cssText=i(r,j),0!==f&&G?f===F.spans.length-1?Y.textContent=o(U.line):Y.textContent=U.line:F.spans.length>1&&f1&&e.isEmbedded?t=e.id&&e.id===a.a.CC1:1===_.length?e.id&&"string"==typeof e.id&&"CC"===e.id.substring(0,2)&&(t=!0):0===_.length&&(t=e.index===s[0].index);return t}(e),t.isFragmented=e.isFragmented,t.isEmbedded=!!e.isEmbedded,t.isTTML=function(e){return e.codec&&e.codec.search(a.a.STPP)>=0||e.mimeType&&e.mimeType.search(a.a.TTML)>=0}(e),t.kind=function(e,t){var n=e.roles&&e.roles.length>0?t[e.roles[0]]:t.caption;return n=n===t.caption||n===t.subtitle?n:t.caption}(e,{subtitle:"subtitles",caption:"captions"}),C.addTextTrack(t)}function B(e){var t=e.chunk;t.mediaInfo.embeddedCaptions&&j(t.bytes,t)}function G(e){E=e}function j(e,s){var u=s.mediaInfo,l=u.type,f=u.mimeType,g=u.codec||f;g?-1!==u.codec.indexOf("application/mp4")?function(e,i,s){var u,l;if("InitializationSegment"===i.segmentType)d=!0,h=r.getMediaTimescaleFromMoov(e);else{if(!d)return;l=r.getSamplesInfo(e),(u=l.sampleList).length>0&&(p=u[0].cts-i.start*h),s.search(a.a.STPP)>=0?function(e,r,i){var s,u;for(o=null!==o?o:H(i),s=0;s0&&C.addCaptions(E,0,s)}(e,u)}}(e,s,g):l===a.a.VIDEO?function(e,t){var a,o;if(t.segmentType===v.a.INIT_SEGMENT_TYPE)0===T&&(T=r.getMediaTimescaleFromMoov(e));else if(t.segmentType===v.a.MEDIA_SEGMENT_TYPE){if(0===T)return void n.warn("CEA-608: No timescale for embeddedTextTrack yet");var s=(o=r.getSamplesInfo(e)).lastSequenceNumber;if(S[0]||S[1]||function(){for(var e,t=0;t<_.length;t++){if(-1===(e=C.getTrackIdxForId(_[t].id)))return void n.warn("CEA-608: data before track is ready.");var r=Y(e);S[t]=new i.a.Cea608Parser(t+1,{newCue:r},null)}}(),T){if(null!==b&&s!==b+o.numSequences)for(a=0;a0){o.cts!==u?l=0:l+=1;var h=q();n.fields[d].push([o.cts+h*T,f[d],l]),u=o.cts}return n.fields.forEach((function(e){e.sort((function(e,t){return e[0]===t[0]?e[2]-t[2]:e[0]-t[0]}))})),n}(e,o.sampleList),l=0;l=0?t=D:(e.search(a.a.TTML)>=0||e.search(a.a.STPP)>=0)&&(t=O),t}function V(e){_.forEach((function(t){var n=C.getTrackIdxForId(t.id);n>=0&&C.deleteCuesFromTrackIdx(n,e.from,e.to)}))}return t={initialize:function(){F||(_=[],E=null,T=0,S=[],b=null,F=!0,A=nr(P).getInstance(),L.on(l.a.VIDEO_CHUNK_RECEIVED,B,t),L.on(l.a.BUFFER_CLEARED,V,t))},addMediaInfos:function(e,n,r){if(s=s.concat(n),e===a.a.TEXT&&n[0].isFragmented&&!n[0].isEmbedded){c=r,t.buffered=Object(er.a)(P).create(),g=w.getTracksFor(a.a.TEXT,M.id).filter((function(e){return e.isFragmented}));for(var i=w.getCurrentTrackFor(a.a.TEXT,M.id),o=0;on/r?o=(s=t)/r*n:s=(o=e)/n*r;var u,l,c=0,f=0;return o/s>i?(f=s,c=s*i):(c=o,f=o/i),u=(e-c)/2,l=(t-f)/2,a?{x:u+.1*c,y:l+.1*f,w:.8*c,h:.8*f}:{x:u,y:l,w:c,h:f}}function N(e,t){var n=I.getClientWidth(),r=I.getClientHeight(),i=I.getVideoWidth(),a=I.getVideoHeight(),o=I.getVideoRelativeOffsetTop(),s=I.getVideoRelativeOffsetLeft();if(0!==i&&0!==a){var u=i/a,l=!1;e.isFromCEA608&&(u=3.5/3,l=!0);var f=w.call(this,n,r,i,a,u,l),y=f.w,_=f.h,b=f.x,S=f.y;if(y!=g||_!=p||b!=c||S!=h||t){if(c=b+s,h=S+o,g=y,p=_,m){var R=m.style;R&&(R.left=c+"px",R.top=h+"px",R.width=g+"px",R.height=p+"px",R.zIndex=E&&document[E]||v?T:null,A.trigger(d.a.CAPTION_CONTAINER_RESIZE))}var N=e.activeCues;if(N)for(var C=N.length,D=0;D=0&&i[e]?I.getTextTrack(i[e].kind,i[e].id,i[e].lang,i[e].isTTML,i[e].isEmbedded):null}function P(e){var t=this;if(e!==s){var n=M(s=e);L.call(this,n),y&&(clearInterval(y),y=null),n&&"html"===n.renderingType&&(N.call(this,n,!0),window.ResizeObserver?(b=new window.ResizeObserver((function(){N.call(t,n,!0)}))).observe(I.getElement()):y=setInterval(N.bind(this,n),500))}}function L(e){G.call(this),e&&"html"===e.renderingType?U.call(this):B.call(this)}function x(e,t){if(!e.cues)return!1;for(var n=0;n3&&void 0!==arguments[3])||arguments[3];return(isNaN(t)||(r?e.startTime:e.endTime)>=t)&&(isNaN(n)||(r?e.endTime:e.startTime)<=n)}function k(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(e.cues)for(var i=e.cues,a=i.length-1,o=a;o>=0;o--)F(i[o],t,n,r)&&(i[o].onexit&&i[o].onexit(),e.removeCue(i[o]))}function U(){var e=document.getElementById("native-cue-style");if(!e){(e=document.createElement("style")).id="native-cue-style",document.head.appendChild(e);var t=e.sheet,r=I.getElement();try{r&&(r.id?t.insertRule("#"+r.id+"::cue {background: transparent}",0):0!==r.classList.length?t.insertRule("."+r.className+"::cue {background: transparent}",0):t.insertRule("video::cue {background: transparent}",0))}catch(e){n.info(""+e.message)}}}function B(){var e=document.getElementById("native-cue-style");e&&document.head.removeChild(e)}function G(){if(m)for(;m.firstChild;)m.removeChild(m.firstChild)}return t={initialize:function(){"undefined"!=typeof window&&"undefined"!=typeof navigator&&(r=window.VTTCue||window.TextTrackCue,i=[],o=[],s=-1,c=0,h=0,g=0,p=0,m=null,y=null,v=!1,T=2147483647,_=null,void 0!==document.fullscreenElement?E="fullscreenElement":void 0!==document.webkitIsFullScreen?E="webkitIsFullScreen":document.msFullscreenElement?E="msFullscreenElement":document.mozFullScreen&&(E="mozFullScreen"))},getStreamId:function(){return R.id},addTextTrack:function(e){i.push(e)},addCaptions:O,createTracks:function(){i.sort((function(e,t){return e.index-t.index})),m=I.getTTMLRenderingDiv();for(var e,t,n,r,u,c,f=-1,h=0;h=0){A.on(d.a.PLAYBACK_METADATA_LOADED,(function e(){var t=M(f);t&&"html"===t.renderingType&&N.call(this,t,!0),A.off(d.a.PLAYBACK_METADATA_LOADED,e,this)}),this);for(var y=0;y1){var n=e.split(/:/)[1];n&&-1!=n.search(/%/)&&(n=parseInt(n.replace(/%/,""),10)),(e.match(/align/)||e.match(/A/))&&(t.align=n),(e.match(/line/)||e.match(/L/))&&(t.line=n),(e.match(/position/)||e.match(/P/))&&(t.position=n),(e.match(/size/)||e.match(/S/))&&(t.size=n)}})),t}function c(e,t){for(var n,i=t,a="",o="";""!==e[i]&&i1)for(var s=0;s0&&"WEBVTT"!==d&&d.match(r)){var h=u(d),g=h.cuePoints,p=h.styles,m=c(e,f+1),y=s(g[0].replace(i,"")),E=s(g[1].replace(i,""));!isNaN(y)&&!isNaN(E)&&y>=o&&E>y?""!==m?(o=y,l.push({start:y,end:E,data:m,styles:p})):t.error("Skipping cue due to empty/malformed cue text"):t.error("Skipping cue due to incorrect cue timing")}}return l}},t=Object(f.a)(o).getInstance().getLogger(e),n=/(?:\r\n|\r|\n)/gm,r=/-->/,i=/(^[\s]+|[\s]+$)/g,a=/\s\b/g,e}ur.__dashjs_factory_name="VTTParser";var lr=c.a.getSingletonFactory(ur);function cr(){var e,t,n=this.context,r=Object(u.a)(n).getInstance(),i=0;return e={parse:function(e,n,a,o,s){var u,c,f,h="",g=[],p={},m={},y="",E="",v={onOpenTag:function(e,n,i){if(i[" imagetype"]&&!i[" imageType"]&&(r.trigger(d.a.CONFORMANCE_VIOLATION,{level:he.LEVELS.ERROR,event:he.EVENTS.NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE}),i[" imageType"]=i[" imagetype"]),"image"===n&&("http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt"===e||"http://www.smpte-ra.org/schemas/2052-1/2013/smpte-tt"===e)){if(!i[" imageType"]||"PNG"!==i[" imageType"].value)return void t.warn("smpte-tt imageType != PNG. Discarded");y=i["http://www.w3.org/XML/1998/namespace id"].value}},onCloseTag:function(){y&&(m[y]=E.trim()),E="",y=""},onText:function(e){y&&(E+=e)}};if(!e)throw h="no ttml data to parse",new Error(h);p.data=e,r.trigger(l.a.TTML_TO_PARSE,p);var _=Object(ar.fromXML)(p.data,(function(e){h=e}),v);r.trigger(l.a.TTML_PARSED,{ttmlString:p.data,ttmlDoc:_});var T,b=_.getMediaTimeEvents();for(f=0;fo?o:b[f+1]+n)&&g.push({start:u,end:c,type:"html",cueID:(T=void 0,T="cue_TTML_"+i,i++,T),isd:S,images:s,embeddedImages:m})}if(""!==h)throw t.error(h),new Error(h);return g}},t=Object(f.a)(n).getInstance().getLogger(e),e}cr.__dashjs_factory_name="TTMLParser";var fr=c.a.getSingletonFactory(cr);function dr(e){var t,n,r,i,o,s,c,f,h,g,p,m=this.context,y=e.adapter,E=e.errHandler,v=e.manifestModel,_=e.mediaController,T=e.videoModel,b=e.settings;function S(e){var t=e.tracks,r=e.index,i=e.streamId;if(!1===b.get().streaming.text.defaultEnabled&&!A()||p)I(i,-1);else{var o=_.getCurrentTrackFor(a.a.TEXT,i);if(o){var s={lang:o.lang,role:o.roles[0],index:o.index,codec:o.codec,accessibility:o.accessibility[0]};t.some((function(e,t){if(_.matchSettings(s,e))return I(i,t),r=t,!0}))}f=!1}n[i].lastEnabledIndex=r,c.trigger(d.a.TEXT_TRACKS_ADDED,{enabled:A(),index:r,tracks:t,streamId:i}),g=!0}function A(){var e=!0;return f&&!h&&(e=!1),e}function I(e,t){(f=-1===t)&&_&&_.saveTextSettingsDisabled();var n=R(e);if(n!==t&&i[e]){i[e].setModeForTrackIdx(n,a.a.TEXT_HIDDEN),i[e].setCurrentTrackIdx(t),i[e].setModeForTrackIdx(t,a.a.TEXT_SHOWING);var o=i[e].getCurrentTrackInfo();o&&o.isFragmented&&!o.isEmbedded?function(e,t,n){if(!r[e])return;for(var o=r[e].getConfig().fragmentedTracks,s=0;s3&&void 0!==arguments[3]?arguments[3]:null,a=e.id;r[a]&&r[a].addMediaInfos(t,n,i)},reset:function(){w(),c.off(l.a.TEXT_TRACKS_QUEUE_INITIALIZED,S,t),Object.keys(r).forEach((function(e){r[e].resetEmbedded(),r[e].reset()}))}},h=!1,g=!1,p=!1,o=lr(m).getInstance(),s=fr(m).getInstance(),c=Object(u.a)(m).getInstance(),w(),t}dr.__dashjs_factory_name="TextController";var hr=c.a.getClassFactory(dr),gr=n(32);function pr(){var e,t,n,r,h,p,_,T,b,S,A,I,R,w,N,C,D,M,F,k,U,B,G,j,Y,q,H,V,K,z,W,X,Q,Z,$,J,ee,te="You must first call initialize() and set a source before calling this method",ne="You must first call initialize() and set a valid source and view before calling this method",re="You must first call attachView() to set the video element before calling this method",ae=this.context,oe=Object(u.a)(ae).getInstance(),se=Object(E.a)(ae).getInstance(),ue=Object(f.a)(ae).getInstance({settings:se});function le(){Re(null),Ae(null),r=null,R&&(R.reset(),R=null),w&&(w.reset(),w=null),F&&F.reset(),se.reset(),C&&(C.reset(),C=null)}function ce(){return!!n&&!!Z.getElement()}function fe(){return Object(Jt.a)()}function de(){if(!_)throw ne;return H.isPaused()}function he(){if(!_)throw ne;return H.getIsDynamic()}function ge(e){var t=j&&j.hasVideoTrack()?a.a.VIDEO:a.a.AUDIO,n=W.getCurrentDVRInfo(t);if(!n)return 0;var r=H.getOriginalLiveDelay(),i=n.range.start+e;return i>n.range.end-r&&(i=n.range.end-r),i}function pe(e){if(!_)throw ne;var t=Se().currentTime;if(void 0!==e)t=j.getTimeRelativeToStreamId(t,e);else if(H.getIsDynamic()){var n=j&&j.hasVideoTrack()?a.a.VIDEO:a.a.AUDIO,r=W.getCurrentDVRInfo(n);t=null===r||0===t?0:Math.max(0,t-r.range.start)}return t}function me(){if(!_)throw ne;var e=Se().duration;if(H.getIsDynamic()){var t=j&&j.hasVideoTrack()?a.a.VIDEO:a.a.AUDIO,n=W.getCurrentDVRInfo(t);e=n?n.range.end-n.range.start:0}return e}function Ee(e){Object(O.b)(e,"boolean"),T=e}function _e(){F.restoreDefaultUTCTimingSources()}function Te(){return W}function Se(){if(!Z.getElement())throw re;return Z.getElement()}function Ae(e){if(!h)throw"MediaPlayer not initialized!";Z.setElement(e),e&&(Me(),function(){if(w)return;var e=dashjs.MetricsReporting;if("function"==typeof e){var t=e(ae).create();w=t.createMetricsReporting({debug:ue,eventBus:oe,mediaElement:Se(),adapter:D,dashMetrics:W,mediaPlayerModel:M,events:l.a,constants:a.a,metricsConstants:s.a})}}(),function(){if(N)return;var e=dashjs.MssHandler;"function"==typeof e&&(y.a.extend(e.errors),N=e(ae).create({eventBus:oe,mediaPlayerModel:M,dashMetrics:W,manifestModel:X,playbackController:H,streamController:j,protectionController:R,baseURLController:U,errHandler:k,events:l.a,constants:a.a,debug:ue,initSegmentType:v.a.INIT_SEGMENT_TYPE,BASE64:Vn.a,ISOBoxer:zn.a,settings:se}))}(),j&&j.switchToVideoElement()),_&&Ne(),xe()}function Ie(e){if(!p)throw te;var t=j.getActiveStreamInfo();return t?I.getTracksFor(e,t.id):[]}function Re(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:NaN;if(!h)throw"MediaPlayer not initialized!";"string"==typeof e&&$.initialize(e),n=e,(p||_)&&Ne(),ce()&&xe(t)}function we(){if(!p)throw te;var e=j.getActiveStreamInfo();return e?j.getStreamById(e.id):null}function Ne(){_=!1,p=!1,D.reset(),j.reset(),q.reset(),z.reset(),H.reset(),V.reset(),K.reset(),b.reset(),I.reset(),ee.reset(),R&&(se.get().streaming.protection.keepProtectionMediaKeys?R.stop():(R.reset(),R=null,Me())),Y.reset(),Q.reset()}function De(){var e=Oe();j||(j=ye(ae).getInstance()),Y||(Y=hr(ae).create({errHandler:k,manifestModel:X,adapter:D,mediaController:I,videoModel:Z,settings:se})),G.setConfig({capabilities:B,customParametersModel:F,adapter:D,settings:se,manifestModel:X,errHandler:k}),j.setConfig({capabilities:B,capabilitiesFilter:G,manifestLoader:e,manifestModel:X,mediaPlayerModel:M,customParametersModel:F,protectionController:R,textController:Y,adapter:D,dashMetrics:W,errHandler:k,timelineConverter:A,videoModel:Z,playbackController:H,serviceDescriptionController:V,contentSteeringController:K,abrController:b,mediaController:I,settings:se,baseURLController:U,uriFragmentModel:$,segmentBaseController:ee}),q.setConfig({settings:se,playbackController:H,streamController:j,videoModel:Z,timelineConverter:A,adapter:D}),H.setConfig({streamController:j,serviceDescriptionController:V,dashMetrics:W,adapter:D,videoModel:Z,timelineConverter:A,settings:se}),z.setConfig({streamController:j,playbackController:H,mediaPlayerModel:M,videoModel:Z,settings:se}),b.setConfig({streamController:j,domStorage:J,mediaPlayerModel:M,customParametersModel:F,dashMetrics:W,adapter:D,videoModel:Z,settings:se}),Q.setConfig({abrController:b,dashMetrics:W,playbackController:H}),K.setConfig({adapter:D,errHandler:k,dashMetrics:W,mediaPlayerModel:M,manifestModel:X,abrController:b,eventBus:oe,requestModifier:Object(P.a)(ae).getInstance()}),b.initialize(),j.initialize(T,r),Y.initialize(),q.initialize(),z.initialize(),Q.initialize(),K.initialize(),ee.initialize()}function Oe(){return vt(ae).create({debug:ue,errHandler:k,dashMetrics:W,mediaPlayerModel:M,requestModifier:Object(P.a)(ae).getInstance(),mssHandler:N,settings:se})}function Me(){if(R)return R;var e=dashjs.Protection;if("function"==typeof e){var t=e(ae).create();return l.a.extend(e.events),d.a.extend(e.events,{publicOnly:!0}),y.a.extend(e.errors),B||(B=Object(bt.a)(ae).getInstance()),R=t.createProtectionSystem({debug:ue,errHandler:k,videoModel:Z,customParametersModel:F,capabilities:B,eventBus:oe,events:l.a,BASE64:Vn.a,constants:a.a,cmcdModel:Q,settings:se})}return null}function Pe(){if(!h)throw"MediaPlayer not initialized!";if(C)return C;var e=dashjs.OfflineController;if("function"==typeof e){l.a.extend(e.events),d.a.extend(e.events,{publicOnly:!0}),y.a.extend(e.errors);var t=Oe(),n=ie(ae).create();return n.setConfig({manifestModel:X,adapter:D,manifestLoader:t,errHandler:k}),C=e(ae).create({debug:ue,manifestUpdater:n,baseURLController:U,manifestLoader:t,manifestModel:X,mediaPlayerModel:M,abrController:b,playbackController:H,adapter:D,errHandler:k,dashMetrics:W,timelineConverter:A,segmentBaseController:ee,schemeLoaderFactory:S,eventBus:oe,events:l.a,errors:y.a,constants:a.a,settings:se,dashConstants:o.a,urlUtils:Object(L.a)(ae).getInstance()})}return null}function Le(e){var t=j&&j.hasVideoTrack()?a.a.VIDEO:a.a.AUDIO,n=W.getCurrentDVRInfo(t);return n?e+(n.manifestInfo.availableFrom.getTime()/1e3+n.range.start):0}function xe(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NaN;C&&C.resetRecords(),!p&&n&&(p=!0,t.info("Streaming Initialized"),De(),"string"==typeof n?j.load(n,e):j.loadWithManifest(n,e)),!_&&ce()&&(_=!0,t.info("Playback Initialized"))}return e={initialize:function(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:NaN;B||(B=Object(bt.a)(ae).getInstance()).setConfig({settings:se}),k||(k=Tt(ae).getInstance()),B.supportsMediaSource()?(h||(h=!0,A=qn(ae).getInstance(),b||(b=Ht(ae).getInstance()).setConfig({settings:se}),S||(S=Object(Vt.a)(ae).getInstance()),H||(H=g(ae).getInstance()),I||(I=qe(ae).getInstance()),j||(j=ye(ae).getInstance()),q||(q=ve(ae).getInstance()),z||(z=be(ae).getInstance()),V||(V=Ce(ae).getInstance()),K||(K=ke(ae).getInstance()),G||(G=At(ae).getInstance()),D=Sn(ae).getInstance(),X=Ct(ae).getInstance(),Q=Object(Xt.a)(ae).getInstance(),W=jn(ae).getInstance({settings:se}),J=$t(ae).getInstance({settings:se}),D.setConfig({constants:a.a,cea608parser:i.a,errHandler:k,BASE64:Vn.a}),U||(U=it(ae).create()),U.setConfig({adapter:D}),V.setConfig({adapter:D}),ee||(ee=ln(ae).getInstance({dashMetrics:W,mediaPlayerModel:M,errHandler:k,baseURLController:U,events:l.a,eventBus:oe,debug:ue,boxParser:Object(x.a)(ae).getInstance(),requestModifier:Object(P.a)(ae).getInstance(),errors:y.a})),I.setConfig({domStorage:J,settings:se,customParametersModel:F}),M.setConfig({playbackController:H,serviceDescriptionController:V}),_e(),Ee(void 0===r||r),Pe()),e&&Ae(e),n&&Re(n,o),t.info("[dash.js "+fe()+"] MediaPlayer has been initialized")):k.error(new m.a(y.a.CAPABILITY_MEDIASOURCE_ERROR_CODE,y.a.CAPABILITY_MEDIASOURCE_ERROR_MESSAGE))},setConfig:function(e){e&&(e.capabilities&&(B=e.capabilities),e.capabilitiesFilter&&(G=e.capabilitiesFilter),e.streamController&&(j=e.streamController),e.textController&&(Y=e.textController),e.gapController&&(q=e.gapController),e.playbackController&&(H=e.playbackController),e.serviceDescriptionController&&(V=e.serviceDescriptionController),e.contentSteeringController&&(K=e.contentSteeringController),e.catchupController&&(z=e.catchupController),e.mediaPlayerModel&&(M=e.mediaPlayerModel),e.customParametersModel&&(F=e.customParametersModel),e.abrController&&(b=e.abrController),e.schemeLoaderFactory&&(S=e.schemeLoaderFactory),e.mediaController&&(I=e.mediaController),e.settings&&(se=e.settings))},on:function(e,t,n,r){oe.on(e,t,n,r)},off:function(e,t,n){oe.off(e,t,n)},extend:function(e,t,n){c.a.extend(e,t,n,ae)},attachView:Ae,attachSource:Re,isReady:ce,play:function(){if(!_)throw ne;(!T||de()&&_)&&H.play(!0)},isPaused:de,pause:function(){if(!_)throw ne;H.pause()},isSeeking:function(){if(!_)throw ne;return H.isSeeking()},isDynamic:he,getLowLatencyModeEnabled:function(){if(!_)throw ne;return H.getLowLatencyModeEnabled()},seek:function(e){if(!_)throw ne;if(Object(O.b)(e,"number"),isNaN(e))throw a.a.BAD_ARGUMENT_ERROR;var t=H.getIsDynamic()?ge(e):e,n=Se();!H.getIsDynamic()&&n.duration&&(t=Math.min(n.duration,t)),H.seek(t,!1,!1,!0)},seekToOriginalLive:function(){_&&he()&&H.seekToOriginalLive()},setPlaybackRate:function(e){Se().playbackRate=e},getPlaybackRate:function(){return Se().playbackRate},setMute:function(e){Object(O.b)(e,"boolean"),Se().muted=e},isMuted:function(){return Se().muted},setVolume:function(e){if("number"!=typeof e||isNaN(e)||e<0||e>1)throw a.a.BAD_ARGUMENT_ERROR;Se().volume=e},getVolume:function(){return Se().volume},time:pe,duration:me,timeAsUTC:function(){if(!_)throw ne;return pe()<0?NaN:Le(pe())},durationAsUTC:function(){if(!_)throw ne;return Le(me())},getActiveStream:we,getDVRWindowSize:function(){var e=j&&j.hasVideoTrack()?a.a.VIDEO:a.a.AUDIO,t=W.getCurrentDVRInfo(e);return t?t.manifestInfo.dvrWindowSize:0},getDVRSeekOffset:ge,getTargetLiveDelay:function(){if(!_)throw ne;return H.getOriginalLiveDelay()},convertToTimeCode:function(e){e=Math.max(e,0);var t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%3600%60);return(0===t?"":t<10?"0"+t.toString()+":":t.toString()+":")+(n<10?"0"+n.toString():n.toString())+":"+(r<10?"0"+r.toString():r.toString())},formatUTC:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=new Date(1e3*e),a=i.toLocaleDateString(t),o=i.toLocaleTimeString(t,{hour12:n});return r?o+" "+a:o},getVersion:fe,getDebug:function(){return ue},getBufferLength:function(e){var n=[a.a.VIDEO,a.a.AUDIO,a.a.TEXT];if(e){if(-1!==n.indexOf(e)){var r=Te().getCurrentBufferLevel(e);return r||NaN}return t.warn("getBufferLength requested for invalid type"),NaN}var i=n.map((function(e){return Ie(e).length>0?Te().getCurrentBufferLevel(e):Number.MAX_VALUE})).reduce((function(e,t){return Math.min(e,t)}));return i===Number.MAX_VALUE?NaN:i},getTTMLRenderingDiv:function(){return Z?Z.getTTMLRenderingDiv():null},getVideoElement:Se,getSource:function(){if(!n)throw"You must first call attachSource() with a valid source before calling this method";return n},updateSource:function(e){n=e,j.load(n)},getCurrentLiveLatency:function(){if(!h)throw"MediaPlayer not initialized!";return _?H.getCurrentLiveLatency():NaN},getTopBitrateInfoFor:function(e){if(!p)throw te;return b.getTopBitrateInfoFor(e)},setAutoPlay:Ee,getAutoPlay:function(){return T},getDashMetrics:Te,getQualityFor:function(e){if(!p)throw te;if(e===a.a.IMAGE){var t=we();if(!t)return-1;var n=t.getThumbnailController();return n?n.getCurrentTrackIndex():-1}return b.getQualityFor(e)},setQualityFor:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!p)throw te;if(e===a.a.IMAGE){var r=we();if(!r)return;var i=r.getThumbnailController();i&&i.setTrackByIndex(t)}b.setPlaybackQuality(e,j.getActiveStreamInfo(),t,{forceReplace:n})},updatePortalSize:function(){b.setElementSize(),b.setWindowResizeEventCalled(!0)},enableText:function(e){var t=j.getActiveStreamInfo();return!(!t||!Y)&&Y.enableText(t.id,e)},enableForcedTextStreaming:function(e){return!(!j.getActiveStreamInfo()||!Y)&&Y.enableForcedTextStreaming(e)},isTextEnabled:function(){var e=j.getActiveStreamInfo();return!(!e||!Y)&&Y.isTextEnabled(e)},setTextTrack:function(e){if(!_)throw ne;var t=j.getActiveStreamInfo();t&&Y&&Y.setTextTrack(t.id,e)},getBitrateInfoListFor:function(e){if(!p)throw te;var t=we();return t?t.getBitrateListFor(e):[]},getStreamsFromManifest:function(e){if(!p)throw te;return D.getStreamsInfo(e)},getTracksFor:Ie,getTracksForTypeFromManifest:function(e,t,n){if(!p)throw te;return(n=n||D.getStreamsInfo(t,1)[0])?D.getAllMediaInfoForType(n,e,t):[]},getCurrentTrackFor:function(e){if(!p)throw te;var t=j.getActiveStreamInfo();return I.getCurrentTrackFor(e,t.id)},setInitialMediaSettingsFor:function(e,t){if(!h)throw"MediaPlayer not initialized!";I.setInitialSettings(e,t)},getInitialMediaSettingsFor:function(e){if(!h)throw"MediaPlayer not initialized!";return I.getInitialSettings(e)},setCurrentTrack:function(e){if(!p)throw te;I.setTrack(e)},addABRCustomRule:function(e,t,n){F.addAbrCustomRule(e,t,n)},removeABRCustomRule:function(e){F.removeAbrCustomRule(e)},removeAllABRCustomRule:function(){F.removeAllAbrCustomRule()},getABRCustomRules:function(){return F.getAbrCustomRules()},getAverageThroughput:function(e){var t=b.getThroughputHistory(),n=H.getIsDynamic();return t?t.getAverageThroughput(e,n):0},retrieveManifest:function(e,t){var n=Oe(),r=this;oe.on(l.a.INTERNAL_MANIFEST_LOADED,(function e(i){i.error?t(null,i.error):t(i.manifest),oe.off(l.a.INTERNAL_MANIFEST_LOADED,e,r),n.reset()}),r),$.initialize(e),n.load(e)},addUTCTimingSource:function(e,t){F.addUTCTimingSource(e,t)},removeUTCTimingSource:function(e,t){F.removeUTCTimingSource(e,t)},clearDefaultUTCTimingSources:function(){F.clearDefaultUTCTimingSources()},restoreDefaultUTCTimingSources:_e,setXHRWithCredentialsForType:function(e,t){F.setXHRWithCredentialsForType(e,t)},getXHRWithCredentialsForType:function(e){return F.getXHRWithCredentialsForType(e)},getProtectionController:function(){return Me()},attachProtectionController:function(e){R=e},setProtectionData:function(e){r=e,j&&j.setProtectionData(r)},registerLicenseRequestFilter:function(e){F.registerLicenseRequestFilter(e)},registerLicenseResponseFilter:function(e){F.registerLicenseResponseFilter(e)},unregisterLicenseRequestFilter:function(e){F.unregisterLicenseRequestFilter(e)},unregisterLicenseResponseFilter:function(e){F.unregisterLicenseResponseFilter(e)},registerCustomCapabilitiesFilter:function(e){F.registerCustomCapabilitiesFilter(e)},unregisterCustomCapabilitiesFilter:function(e){F.unregisterCustomCapabilitiesFilter(e)},setCustomInitialTrackSelectionFunction:function(e){F.setCustomInitialTrackSelectionFunction(e)},resetCustomInitialTrackSelectionFunction:function(){F.resetCustomInitialTrackSelectionFunction(null)},attachTTMLRenderingDiv:function(e){if(!Z.getElement())throw re;Z.setTTMLRenderingDiv(e)},getCurrentTextTrackIndex:function(){var e=j.getActiveStreamInfo();if(e&&Y)return Y.getCurrentTrackIdx(e.id)},provideThumbnail:function(e,t){if("function"==typeof t)if(e<0)t(null);else{var n=H.getIsDynamic()?ge(e):e,r=j.getStreamForTime(n);if(null!==r){var i=r.getThumbnailController();if(i)return i.provide(n,t);t(null)}else t(null)}},getDashAdapter:function(){return D},getOfflineController:function(){return Pe()},triggerSteeringRequest:function(){if(K)return K.loadSteeringData()},getCurrentSteeringResponseData:function(){if(K)return K.getCurrentSteeringResponseData()},getSettings:function(){return se.get()},updateSettings:function(e){se.update(e)},resetSettings:function(){se.reset()},reset:le,destroy:function(){le(),c.a.deleteSingletonInstances(ae)}},t=ue.getLogger(e),h=!1,_=!1,p=!1,T=!0,R=null,C=null,r=null,D=null,ee=null,l.a.extend(d.a),M=Ot(ae).getInstance(),F=Object(gr.a)(ae).getInstance(),Z=Wt(ae).getInstance(),$=wt(ae).getInstance(),e}pr.__dashjs_factory_name="MediaPlayer";var mr=c.a.getClassFactory(pr);mr.events=d.a,mr.errors=y.a,c.a.updateClassFactory(pr.__dashjs_factory_name,mr);t.a=mr},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));function r(){return"4.5.1"}},function(e,t,n){var r,i,o,u,l,c={encode:function(e){for(var t=[],n=0;n>6),t.push(128|63&r)):r<65536?(t.push(224|r>>12),t.push(128|63&r>>6),t.push(128|63&r)):(t.push(240|r>>18),t.push(128|63&r>>12),t.push(128|63&r>>6),t.push(128|63&r))}return t},decode:function(e){for(var t=[],n=0;n>18)),n.push(r.charAt(63&a>>12)),n.push(r.charAt(63&a>>6)),n.push(r.charAt(63&a))}return 2==e.length-t?(a=(e[t]<<16)+(e[t+1]<<8),n.push(r.charAt(63&a>>18)),n.push(r.charAt(63&a>>12)),n.push(r.charAt(63&a>>6)),n.push("=")):1==e.length-t&&(a=e[t]<<16,n.push(r.charAt(63&a>>18)),n.push(r.charAt(63&a>>12)),n.push("==")),n.join("")},o=function(){for(var e=[],t=0;t>16),n.push(255&i>>8),n.push(255&i),t+=4}return n&&("="==e.charAt(t-2)?(n.pop(),n.pop()):"="==e.charAt(t-1)&&n.pop()),n},l={encode:function(e){for(var t=[],n=0;n=97&&t<=122||t>=65&&t<=90}},function(e,t,n){"use strict";e.exports=function(e){var t="string"==typeof e?e.charCodeAt(0):e;return t>=48&&t<=57}},function(e,t,n){"use strict";var r=n(1),i=n(3),a=n(4),o=n(12);function s(e){var t,n,i,s,u,l=(e=e||{}).eventBus,c=e.events,f=e.abrController,d=e.dashMetrics,h=e.playbackController,g=e.timelineConverter,p=e.type,m=e.streamInfo,y=e.dashConstants,E=e.segmentsController,v=e.isDynamic;function _(){return p}function T(){if(!(f&&d&&h&&g))throw new Error(r.a.MISSING_CONFIG_ERROR)}function b(){return i}function S(){return u}function A(){n=null,i=!0,s=[]}function I(e){return new Promise((function(t,n){var r=e.hasInitialization(),i=e.hasSegments(),a=[];a.push(E.updateInitData(e,r)),a.push(E.updateSegmentData(e,i)),Promise.all(a).then((function(n){var r;n[0]&&!n[0].error&&(e=function(e,t){if(!t||t.error||!t.representation)return e;return t.representation}(e,n[0])),n[1]&&!n[1].error&&(e=function(e,t){if(!t||t.error)return;var n,r,i,a,s=t.segments,u=[],l=0;for(n=0,r=s?s.length:0;n0&&(e.segments=u);return e}(e,n[1])),(r=e).mediaFinishedInformation=E.getMediaFinishedInformation(r),function(e){if(!b())return;var t,n=d.getCurrentManifestUpdate(),r=!1;if(n){for(var i=0;i=s.length?null:s[e]}function N(e){i=!1,l.trigger(c.DATA_UPDATE_COMPLETED,{data:n,currentRepresentation:u,error:e},{streamId:m.id,mediaType:p})}function C(e){u=e}function D(e){if(e.newDuration){var t=S();if(t&&t.adaptation.period)t.adaptation.period.duration=e.newDuration}}return t={getStreamId:function(){return m.id},getType:_,getData:function(){return n},isUpdating:b,updateData:function(e,t,a,o,u){if(T(),i=!0,s=t,C(w(u)),n=e,a!==r.a.VIDEO&&a!==r.a.AUDIO&&(a!==r.a.TEXT||!o))return N(),Promise.resolve();for(var l=[],c=0,f=s.length;c=0}return!1}),(function(e){return String(e)}))}return n}(l),E=n(1);function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _(e,t){return(_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function T(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=S(e);if(t){var i=S(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return b(this,n)}}function b(e,t){return!t||"object"!==v(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var A=/^([-])?P(([\d.]*)Y)?(([\d.]*)M)?(([\d.]*)D)?T?(([\d.]*)H)?(([\d.]*)M)?(([\d.]*)S)?/,I=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_(e,t)}(n,e);var t=T(n);function n(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t.call(this,(function(e){for(var t=[c.a.MIN_BUFFER_TIME,c.a.MEDIA_PRESENTATION_DURATION,c.a.MINIMUM_UPDATE_PERIOD,c.a.TIMESHIFT_BUFFER_DEPTH,c.a.MAX_SEGMENT_DURATION,c.a.MAX_SUBSEGMENT_DURATION,c.a.SUGGESTED_PRESENTATION_DELAY,c.a.START,E.a.START_TIME,c.a.DURATION],n=t.length,r=0;r=0}return!1}),(function(e){var t=j()(e);return void 0!==t?t:String(e)}))}return n}(l);function X(e,t){for(var n=0;n4)return null;var r=[];for(var i in t){var a=n.parseLength(t[i]);if(!a)return null;r.push(a)}return r}),(function(t,n,r,i,a){var o;if(1===i.length)o=[i[0],i[0],i[0],i[0]];else if(2===i.length)o=[i[0],i[1],i[0],i[1]];else if(3===i.length)o=[i[0],i[1],i[2],i[1]];else{if(4!==i.length)return null;o=[i[0],i[1],i[2],i[3]]}var s=r.styleAttrs[e.byName.writingMode.qname];if("lrtb"===s||"lr"===s)o=[o[0],o[3],o[2],o[1]];else if("rltb"===s||"rl"===s)o=[o[0],o[1],o[2],o[3]];else if("tblr"===s)o=[o[3],o[0],o[1],o[2]];else{if("tbrl"!==s&&"tb"!==s)return null;o=[o[3],o[2],o[1],o[0]]}var u=[];for(var l in o)if(0===o[l].value)u[l]=0;else if("%"===o[l].unit)u[l]="0"===l||"2"===l?r.styleAttrs[e.byName.extent.qname].h*o[l].value/100:r.styleAttrs[e.byName.extent.qname].w*o[l].value/100;else if("em"===o[l].unit)u[l]=r.styleAttrs[e.byName.fontSize.qname]*o[l].value;else if("c"===o[l].unit)u[l]=o[l].value/t.cellResolution.h;else{if("px"!==o[l].unit)return null;u[l]="0"===l||"2"===l?o[l].value/t.pxDimensions.h:o[l].value/t.pxDimensions.w}return u})),new r(t.ns_tts,"showBackground","always",["region"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"textAlign","start",["p"],!0,!0,(function(e){return e}),(function(e,t,n,r,i){return"left"===r?"start":"right"===r?"end":r})),new r(t.ns_tts,"textDecoration","none",["span"],!0,!0,(function(e){return e.split(" ")}),null),new r(t.ns_tts,"textOutline","none",["span"],!0,!0,(function(e){if("none"===e)return e;var t={},r=e.split(" ");if(0===r.length||r.length>2)return null;var i=n.parseColor(r[0]);if(t.color=i,null!==i&&r.shift(),1!==r.length)return null;var a=n.parseLength(r[0]);return a?(t.thickness=a,t):null}),(function(t,n,r,i,a){if("none"===i)return i;var o={};if(null===i.color?o.color=r.styleAttrs[e.byName.color.qname]:o.color=i.color,"%"===i.thickness.unit)o.thickness=r.styleAttrs[e.byName.fontSize.qname]*i.thickness.value/100;else if("em"===i.thickness.unit)o.thickness=r.styleAttrs[e.byName.fontSize.qname]*i.thickness.value;else if("c"===i.thickness.unit)o.thickness=i.thickness.value/t.cellResolution.h;else{if("px"!==i.thickness.unit)return null;o.thickness=i.thickness.value/t.pxDimensions.h}return o})),new r(t.ns_tts,"unicodeBidi","normal",["span","p"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"visibility","visible",["body","div","p","region","span"],!0,!0,(function(e){return e}),null),new r(t.ns_tts,"wrapOption","wrap",["span"],!0,!0,(function(e){return e}),null),new r(t.ns_tts,"writingMode","lrtb",["region"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"zIndex","auto",["region"],!1,!0,(function(e){var t;return"auto"===e?t=e:(t=parseInt(e),isNaN(t)&&(t=null)),t}),null),new r(t.ns_ebutts,"linePadding","0c",["p"],!0,!1,n.parseLength,(function(e,t,n,r,i){return"c"===r.unit?r.value/e.cellResolution.h:null})),new r(t.ns_ebutts,"multiRowAlign","auto",["p"],!0,!1,(function(e){return e}),null),new r(t.ns_smpte,"backgroundImage",null,["div"],!1,!1,(function(e){return e}),null),new r(t.ns_itts,"forcedDisplay","false",["body","div","p","region","span"],!0,!0,(function(e){return"true"===e}),null),new r(t.ns_itts,"fillLineGap","false",["p"],!0,!0,(function(e){return"true"===e}),null)],e.byQName={},e.all)e.byQName[e.all[i].qname]=e.all[i];for(var a in e.byName={},e.all)e.byName[e.all[a].name]=e.all[a]}(t,"undefined"==typeof imscNames?n(55):imscNames,"undefined"==typeof imscUtils?n(86):imscUtils)},function(e,t,n){"use strict";(function(e){
+/*!
+ * The buffer module from node.js, for the browser.
+ *
+ * @author Feross Aboukhadijeh
+ * @license MIT
+ */
+var r=n(98),i=n(99),a=n(87);function o(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function g(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return j(e).length;default:if(r)return G(e).length;t=(""+t).toLowerCase(),r=!0}}function p(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,n);case"utf8":case"utf-8":return R(this,t,n);case"ascii":return w(this,t,n);case"latin1":case"binary":return N(this,t,n);case"base64":return I(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:E(e,t,n,r,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):E(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function E(e,t,n,r,i){var a,o=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,u/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(a=n;as&&(n=s-u),a=n;a>=0;a--){for(var f=!0,d=0;di&&(r=i):r=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");r>a/2&&(r=a/2);for(var o=0;o>8,i=n%256,a.push(i),a.push(r);return a}(t,e.length-n),e,n,r)}function I(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function R(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:l>223?3:l>191?2:1;if(i+f<=n)switch(f){case 1:l<128&&(c=l);break;case 2:128==(192&(a=e[i+1]))&&(u=(31&l)<<6|63&a)>127&&(c=u);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(u=(15&l)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(u=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},u.prototype.compare=function(e,t,n,r,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(r>>>=0),o=(n>>>=0)-(t>>>=0),s=Math.min(a,o),l=this.slice(r,i),c=e.slice(t,n),f=0;fi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return v(this,e,t,n);case"utf8":case"utf-8":return _(this,e,t,n);case"ascii":return T(this,e,t,n);case"latin1":case"binary":return b(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function w(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",a=t;an)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,n,r,i,a){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function P(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function L(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function x(e,t,n,r,i,a){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function F(e,t,n,r,a){return a||x(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function k(e,t,n,r,a){return a||x(e,0,n,8),i.write(e,t,n,r,52,8),n+8}u.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},u.prototype.readUInt8=function(e,t){return t||O(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||O(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||O(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var r=this[e],i=1,a=0;++a=(i*=128)&&(r-=Math.pow(2,8*t)),r},u.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},u.prototype.readInt8=function(e,t){return t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||O(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(e,t){t||O(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(e,t){return t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||O(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||O(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||O(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||O(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||M(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,a=0;for(this[t]=255&e;++a=0&&(a*=256);)this[t+i]=e/a&255;return t+n},u.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):L(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);M(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a>0)-s&255;return t+n},u.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);M(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):L(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,n){return F(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return F(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return k(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return k(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(a<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function j(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(U,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Y(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(24))},function(e,t,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,a=i&&"function"==typeof i.apply?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}y(e,t,a,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&y(e,"error",t,n)}(e,i,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var u=10;function l(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function f(e,t,n,r){var i,a,o,s;if(l(n),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),a=e._events),o=a[t]),void 0===o)o=a[t]=n,++e._eventsCount;else if("function"==typeof o?o=a[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=c(e))>0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,s=u,console&&console.warn&&console.warn(s)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=d.bind(r);return i.listener=n,r.wrapFn=i,i}function g(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)a(u,this,t);else{var l=u.length,c=m(u,l);for(n=0;n=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return g(this,e,!0)},s.prototype.rawListeners=function(e){return g(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},s.prototype.listenerCount=p,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){(t=e.exports=n(88)).Stream=t,t.Readable=t,t.Writable=n(73),t.Duplex=n(36),t.Transform=n(91),t.PassThrough=n(107)},function(e,t,n){"use strict";(function(t,r,i){var a=n(56);function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=E;var s,u=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?r:a.nextTick;E.WritableState=y;var l=n(49);l.inherits=n(42);var c={deprecate:n(106)},f=n(89),d=n(57).Buffer,h=i.Uint8Array||function(){};var g,p=n(90);function m(){}function y(e,t){s=s||n(36),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,l=e.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(l||0===l)?l:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===e.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(a.nextTick(i,r),a.nextTick(A,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(i(r),e._writableState.errorEmitted=!0,e.emit("error",r),A(e,t))}(e,n,r,t,i);else{var o=b(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||T(e,n),r?u(_,e,n,o,i):_(e,n,o,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function E(e){if(s=s||n(36),!(g.call(E,this)||this instanceof s))return new E(e);this._writableState=new y(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function v(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function _(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),A(e,t)}function T(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),a=t.corkedRequestsFree;a.entry=n;for(var s=0,u=!0;n;)i[s]=n,n.isBuf||(u=!1),n=n.next,s+=1;i.allBuffers=u,v(e,t,!0,t.length,i,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,c=n.encoding,f=n.callback;if(v(e,t,!1,t.objectMode?1:l.length,l,c,f),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function b(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function S(e,t){e._final((function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),A(e,t)}))}function A(e,t){var n=b(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,a.nextTick(S,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}l.inherits(E,f),y.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(y.prototype,"buffer",{get:c.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(g=Function.prototype[Symbol.hasInstance],Object.defineProperty(E,Symbol.hasInstance,{value:function(e){return!!g.call(this,e)||this===E&&(e&&e._writableState instanceof y)}})):g=function(e){return e instanceof this},E.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},E.prototype.write=function(e,t,n){var r,i=this._writableState,o=!1,s=!i.objectMode&&(r=e,d.isBuffer(r)||r instanceof h);return s&&!d.isBuffer(e)&&(e=function(e){return d.from(e)}(e)),"function"==typeof t&&(n=t,t=null),s?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=m),i.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),a.nextTick(t,n)}(this,n):(s||function(e,t,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),a.nextTick(r,o),i=!1),i}(this,i,e,n))&&(i.pendingcb++,o=function(e,t,n,r,i,a){if(!n){var o=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=d.from(t,n));return t}(t,r,i);r!==o&&(n=!0,i="buffer",r=o)}var s=t.objectMode?1:r.length;t.length+=s;var u=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(E.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),E.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},E.prototype._writev=null,E.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,A(e,t),n&&(t.finished?a.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(E.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),E.prototype.destroy=p.destroy,E.prototype._undestroy=p.undestroy,E.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(26),n(104).setImmediate,n(24))},function(e,t,n){"use strict";var r=n(57).Buffer,i=r.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function a(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=l,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=c,this.end=f,t=3;break;default:return this.write=d,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function l(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function c(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function d(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}t.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return i>0&&(e.lastNeed=i-1),i;if(--r=0)return i>0&&(e.lastNeed=i-2),i;if(--r=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,n){"use strict";var r=n(76),i=n(50),a=n(82),o=n(83),s=n(84),u=n(85);e.exports=function(e,t){var n,c=t||{},m=r.parse(String(e||"").toLowerCase(),c),y=r.stringify(m),E=-1;if(!y)return y;for(;++E-1||!e[i]||!e[i].length)&&g(e,i,o[i])}function h(e,t,n){var r,i,a,o,s=!1;if(n){if(i=r=e[t],r&&"object"==typeof r)for(i=[],a=-1;++a1&&m<9){if(h.language=g.slice(0,m),m<4)for(c=0;45===p.charCodeAt(m)&&i(p.charCodeAt(m+1))&&i(p.charCodeAt(m+2))&&i(p.charCodeAt(m+3))&&!i(p.charCodeAt(m+4));){if(c>2)return y(m,3,"Too many extended language subtags, expected at most 3 subtags");h.extendedLanguageSubtags.push(g.slice(m+1,m+4)),m+=4,c++}for(45===p.charCodeAt(m)&&i(p.charCodeAt(m+1))&&i(p.charCodeAt(m+2))&&i(p.charCodeAt(m+3))&&i(p.charCodeAt(m+4))&&!i(p.charCodeAt(m+5))&&(h.script=g.slice(m+1,m+5),m+=5),45===p.charCodeAt(m)&&(i(p.charCodeAt(m+1))&&i(p.charCodeAt(m+2))&&!i(p.charCodeAt(m+3))?(h.region=g.slice(m+1,m+3),m+=3):a(p.charCodeAt(m+1))&&a(p.charCodeAt(m+2))&&a(p.charCodeAt(m+3))&&!a(p.charCodeAt(m+4))&&(h.region=g.slice(m+1,m+4),m+=4));45===p.charCodeAt(m);){for(f=l=m+1;r(p.charCodeAt(f));){if(f-l>7)return y(f,1,"Too long variant, expected at most 8 characters");f++}if(!(f-l>4||f-l>3&&a(p.charCodeAt(l))))break;h.variants.push(g.slice(l,f)),m=f}for(;45===p.charCodeAt(m)&&120!==p.charCodeAt(m+1)&&r(p.charCodeAt(m+1))&&45===p.charCodeAt(m+2)&&r(p.charCodeAt(m+3));){for(f=m+2,c=0;45===p.charCodeAt(f)&&r(p.charCodeAt(f+1))&&r(p.charCodeAt(f+2));)for(f=(l=f+1)+2,c++;r(p.charCodeAt(f));){if(f-l>7)return y(f,2,"Too long extension, expected at most 8 characters");f++}if(!c)return y(f,4,"Empty extension, extensions must have at least 2 characters of content");h.extensions.push({singleton:g.charAt(m+1),extensions:g.slice(m+3,f).split("-")}),m=f}}else m=0;if(0===m&&120===p.charCodeAt(m)||45===p.charCodeAt(m)&&120===p.charCodeAt(m+1))for(f=m=m?m+2:1;45===p.charCodeAt(f)&&r(p.charCodeAt(f+1));){for(f=l=m+1;r(p.charCodeAt(f));){if(f-l>7)return y(f,5,"Too long private-use area, expected at most 8 characters");f++}h.privateuse.push(g.slice(m+1,f)),m=f}if(m!==g.length)return y(m,6,"Found superfluous content after tag");return h;function y(e,t,n){return d.warning&&d.warning(n,t,e),d.forgiving?h:{language:null,extendedLanguageSubtags:[],script:null,region:null,variants:[],extensions:[],privateuse:[],irregular:null,regular:null}}};var u={}.hasOwnProperty},function(e,t,n){"use strict";var r=n(62),i=n(63);e.exports=function(e){return r(e)||i(e)}},function(e){e.exports=JSON.parse('["art-lojban","cel-gaulish","no-bok","no-nyn","zh-guoyu","zh-hakka","zh-min","zh-min-nan","zh-xiang"]')},function(e){e.exports=JSON.parse('{"en-gb-oed":"en-GB-oxendict","i-ami":"ami","i-bnn":"bnn","i-default":null,"i-enochian":null,"i-hak":"hak","i-klingon":"tlh","i-lux":"lb","i-mingo":null,"i-navajo":"nv","i-pwn":"pwn","i-tao":"tao","i-tay":"tay","i-tsu":"tsu","sgn-be-fr":"sfb","sgn-be-nl":"vgt","sgn-ch-de":"sgg","art-lojban":"jbo","cel-gaulish":null,"no-bok":"nb","no-nyn":"nn","zh-guoyu":"cmn","zh-hakka":"hak","zh-min":null,"zh-min-nan":"nan","zh-xiang":"hsn"}')},function(e,t,n){"use strict";e.exports=function(e){var t,n,r,i=e||{},a=[];if(i.irregular||i.regular)return i.irregular||i.regular;if(i.language)for(a=a.concat(i.language,i.extendedLanguageSubtags||[],i.script||[],i.region||[],i.variants||[]),t=i.extensions||[],n=-1;++n0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===l.prototype||(t=function(e){return l.from(e)}(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):T(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?T(e,o,t,!1):I(e,o)):T(e,o,t,!1))):r||(o.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function S(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(h("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(A,e):A(e))}function A(e){h("emit readable"),e.emit("readable"),C(e)}function I(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(R,e,t))}function R(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;ea.length?a.length:e;if(o===a.length?i+=a:i+=a.slice(0,e),0===(e-=o)){o===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(o));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=l.allocUnsafe(e),r=t.head,i=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var a=r.data,o=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,o),0===(e-=o)){o===a.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(o));break}++i}return t.length-=i,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function O(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(M,t,e))}function M(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function P(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return h("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?O(this):S(this),null;if(0===(e=b(e,t))&&t.ended)return 0===t.length&&O(this),null;var r,i=t.needReadable;return h("need readable",i),(0===t.length||t.length-e0?D(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&O(this)),null!==r&&this.emit("data",r),r},v.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},v.prototype.pipe=function(e,t){var n=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,h("pipe count=%d opts=%j",a.pipesCount,t);var u=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?c:v;function l(t,r){h("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,h("cleanup"),e.removeListener("close",y),e.removeListener("finish",E),e.removeListener("drain",f),e.removeListener("error",m),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",v),n.removeListener("data",p),d=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function c(){h("onend"),e.end()}a.endEmitted?i.nextTick(u):n.once("end",u),e.on("unpipe",l);var f=function(e){return function(){var t=e._readableState;h("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,C(e))}}(n);e.on("drain",f);var d=!1;var g=!1;function p(t){h("ondata"),g=!1,!1!==e.write(t)||g||((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==P(a.pipes,e))&&!d&&(h("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,g=!0),n.pause())}function m(t){h("onerror",t),v(),e.removeListener("error",m),0===s(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",E),v()}function E(){h("onfinish"),e.removeListener("close",y),v()}function v(){h("unpipe"),n.unpipe(e)}return n.on("data",p),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",m),e.once("close",y),e.once("finish",E),e.emit("pipe",n),a.flowing||(h("pipe resume"),n.resume()),e},v.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a0&&(t+=4+16*n.getUint32(t)),t+=4,e.slice(t)}},{key:"getPSSHForKeySystem",value:function(t,n){var r=e.parsePSSHList(n);return t&&r.hasOwnProperty(t.uuid.toLowerCase())?r[t.uuid.toLowerCase()]:null}},{key:"parseInitDataFromContentProtection",value:function(e,t){return"pssh"in e?(e.pssh.__text=e.pssh.__text.replace(/\r?\n|\r/g,"").replace(/\s+/g,""),t.decodeArray(e.pssh.__text).buffer):null}},{key:"parsePSSHList",value:function(e){if(null==e)return[];for(var t=new DataView(e.buffer||e),n={},r=0;;){var i,a,o=void 0,s=r;if(r>=t.buffer.byteLength)break;if(i=r+t.getUint32(r),r+=4,1886614376===t.getUint32(r))if(r+=4,0===(a=t.getUint8(r))||1===a){r++,r+=3,o="";var u=void 0,l=void 0;for(u=0;u<4;u++)o+=1===(l=t.getUint8(r+u).toString(16)).length?"0"+l:l;for(r+=4,o+="-",u=0;u<2;u++)o+=1===(l=t.getUint8(r+u).toString(16)).length?"0"+l:l;for(r+=2,o+="-",u=0;u<2;u++)o+=1===(l=t.getUint8(r+u).toString(16)).length?"0"+l:l;for(r+=2,o+="-",u=0;u<2;u++)o+=1===(l=t.getUint8(r+u).toString(16)).length?"0"+l:l;for(r+=2,o+="-",u=0;u<6;u++)o+=1===(l=t.getUint8(r+u).toString(16)).length?"0"+l:l;r+=6,r+=4,n[o=o.toLowerCase()]=t.buffer.slice(s,i),r=i}else r=i;else r=i}return n}},{key:"getLicenseServerUrlFromMediaInfo",value:function(e,t){try{if(!e||0===e.length)return null;for(var n=0,r=null;n0){var o=a.contentProtection.filter((function(e){return e.schemeIdUri&&e.schemeIdUri===t}));if(o&&o.length>0)for(var s=0;s=0?u[t.ks.systemString].priority:e.length)-(u&&u[n.ks.systemString]&&u[n.ks.systemString].priority>=0?u[n.ks.systemString].priority:e.length)}));for(var a=0;a0&&A.setServerCertificate(N.decodeArray(t.serverCertificate).buffer),F()}})).catch((function(e){f=null,d=!1,t||I.trigger(R.KEY_SYSTEM_SELECTED,{data:null,error:new g.a(h.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE,h.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE+"Error selecting key system! -- "+e.error)})}))}}(e,t)}function F(){for(var e,t=0;t0?t.audioRobustness:c,u=t&&t.videoRobustness&&t.videoRobustness.length>0?t.videoRobustness:c,l=e.sessionType,f=t&&t.distinctiveIdentifier?t.distinctiveIdentifier:"optional",d=t&&t.persistentState?t.persistentState:"temporary"===l?"optional":"required";return i.forEach((function(e){e.type===C.AUDIO?n.push(new o(e.codec,a)):e.type===C.VIDEO&&r.push(new o(e.codec,u))})),new s(n,r,f,d,[l])}function H(e){e.error?I.trigger(R.KEY_STATUSES_CHANGED,{data:null,error:e.error}):n.debug("DRM: key status = "+e.status)}function V(e){n.debug("DRM: onKeyMessage");var t=e.data;I.trigger(R.KEY_MESSAGE,{data:t});var r=t.messageType?t.messageType:"license-request",o=t.message,s=t.sessionToken,u=G(f),l=S.getLicenseServerModelInstance(f,u,r),c={sessionToken:s,messageType:r};if(o&&0!==o.byteLength){if(!l)return n.debug("DRM: License server request not required for this message (type = "+e.data.messageType+"). Session ID = "+s.getSessionId()),void K(c);if(S.isClearKey(f)){var d=S.processClearKeyLicenseRequest(f,u,o);if(d&&d.keyPairs&&d.keyPairs.length>0)return n.debug("DRM: ClearKey license request handled by application!"),K(c),void A.updateKeySession(s,d)}!function(e,t,r){var o=e.sessionToken,s=e.messageType?e.messageType:"license-request",u={sessionToken:o,messageType:s},l=f?f.systemString:null,c=function(e,t,n,r,o){var s=null,u=r.message;if(e&&e.serverURL){var l=e.serverURL;"string"==typeof l&&""!==l?s=l:"object"===T(l)&&l.hasOwnProperty(t)&&(s=l[t])}else if(e&&e.laURL&&""!==e.laURL)s=e.laURL;else if(!(s=a.getLicenseServerUrlFromMediaInfo(i,f.schemeIdURI))&&!S.isClearKey(f)){var c=a.getPSSHData(n.initData);(s=f.getLicenseServerURLFromInitData(c))||(s=r.laURL)}return s=o.getServerURLFromMessage(s,u,t)}(r,s,o,e,t);if(!c)return void K(u,new g.a(h.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE,h.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE));var d={},w=!1;r&&W(d,r.httpRequestHeaders);var N=e.message,C=f.getRequestHeadersFromMessage(N);W(d,C),Object.keys(d).forEach((function(e){"authorization"===e.toLowerCase()&&(w=!0)})),r&&"boolean"==typeof r.withCredentials&&(w=r.withCredentials);var D=function(e){if(A)if(e.status>=200&&e.status<=299){var n=E.a.parseHttpHeaders(e.getAllResponseHeaders?e.getAllResponseHeaders():null),r=new m(e.responseURL,n,e.response);Q(P.getLicenseResponseFilters(),r).then((function(){var n=t.getLicenseMessage(r.data,l,s);null!==n?(K(u),A.updateKeySession(o,n)):X(e,u,l,s,t)}))}else X(e,u,l,s,t)},L=function(e){K(u,new g.a(h.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,h.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+l+' update, XHR aborted. status is "'+e.statusText+'" ('+e.status+"), readyState is "+e.readyState))},x=function(e){K(u,new g.a(h.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,h.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+l+' update, XHR error. status is "'+e.statusText+'" ('+e.status+"), readyState is "+e.readyState))},F=f.getLicenseRequestFromMessage(N),k=t.getHTTPMethod(s),U=t.getResponseType(l,s),B=r&&!isNaN(r.httpTimeout)?r.httpTimeout:8e3,G=o.getSessionId()||null,j=new p(c,k,U,d,w,s,G,F),Y=isNaN(M.get().streaming.retryAttempts[y.a.LICENSE])?3:M.get().streaming.retryAttempts[y.a.LICENSE];Q(P.getLicenseRequestFilters(),j).then((function(){!function e(t,r,i,a,o,s){var u=new XMLHttpRequest;if(M.get().streaming.cmcd&&M.get().streaming.cmcd.enabled){if(M.get().streaming.cmcd.mode===v.a.CMCD_MODE_QUERY){var l=O.getQueryParameter({url:t.url,type:y.a.LICENSE});l&&(t.url=E.a.addAditionalQueryParameterToUrl(t.url,[l]))}}u.open(t.method,t.url,!0),u.responseType=t.responseType,u.withCredentials=t.withCredentials,i>0&&(u.timeout=i);for(var c in t.headers)u.setRequestHeader(c,t.headers[c]);if(M.get().streaming.cmcd&&M.get().streaming.cmcd.enabled){if(M.get().streaming.cmcd.mode===v.a.CMCD_MODE_HEADER){var f=O.getHeaderParameters({url:t.url,type:y.a.LICENSE});if(f)for(var d in f){var h=f[d];h&&u.setRequestHeader(d,h)}}}var g=function(){r--;var n=isNaN(M.get().streaming.retryIntervals[y.a.LICENSE])?1e3:M.get().streaming.retryIntervals[y.a.LICENSE];b=setTimeout((function(){e(t,r,i,a,o,s)}),n)};u.onload=function(){_=null,this.status>=200&&this.status<=299||r<=0?a(this):(n.warn("License request failed ("+this.status+"). Retrying it... Pending retries: "+r),g())},u.ontimeout=u.onerror=function(){_=null,r<=0?s(this):(n.warn("License request network request failed . Retrying it... Pending retries: "+r),g())},u.onabort=function(){o(this)},I.trigger(R.LICENSE_REQUEST_SENDING,{url:t.url,headers:t.headers,payload:t.data,sessionId:t.sessionId}),_=u,u.send(t.data)}(j,Y,B,D,L,x)}))}(t,l,u)}else K(c,new g.a(h.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE,h.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE))}function K(e,t){I.trigger(R.LICENSE_REQUEST_COMPLETE,{data:e,error:t})}function z(){_&&(_.onloadend=_.onerror=_.onprogress=void 0,_.abort(),_=null),b&&(clearTimeout(b),b=null)}function W(e,t){if(t)for(var n in t)e[n]=t[n]}function X(e,t,n,r,i){var a="NONE",o=null;e.response&&(a=i.getErrorResponse(e.response,n,r),o={serverResponse:e.response||null,responseCode:e.status||null,responseText:e.statusText||null}),K(t,new g.a(h.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,h.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+n+' update, XHR complete. status is "'+e.statusText+'" ('+e.status+"), readyState is "+e.readyState+". Response is "+a,o))}function Q(e,t){return e?e.reduce((function(e,n){return e.then((function(){return n(t)}))}),Promise.resolve()):Promise.resolve()}function Z(e,t){if(!M.get().streaming.protection.ignoreEmeEncryptedEvent){if(n.debug("DRM: onNeedKey"),"cenc"!==e.key.initDataType)return void n.warn("DRM: Only 'cenc' initData is supported! Ignoring initData of type: "+e.key.initDataType);if(0===i.length&&(n.warn("DRM: onNeedKey called before initializeForMedia, wait until initialized"),(t=void 0===t?1:t+1)<5))return void D.push(setTimeout((function(){Z(e,t)}),500));var o=e.key.initData;if(ArrayBuffer.isView(o)&&(o=o.buffer),f){var s=a.getPSSHForKeySystem(f,o);if(s&&j(s))return}n.debug("DRM: initData:",String.fromCharCode.apply(null,new Uint8Array(o)));var c=S.getSupportedKeySystemsFromSegmentPssh(o,u,l);if(0===c.length)return void n.debug("DRM: Received needkey event with initData, but we don't support any of the key systems!");!function(e){r.push(e),x(e,!1)}(c)}}return t={initializeForMedia:function(e){if(!e)throw new Error("mediaInfo can not be null or undefined");L(),i.push(e)},clearMediaInfoArray:function(){i=[]},handleKeySystemFromManifest:function(){if(i&&0!==i.length){var e=[];i.forEach((function(t){var n=S.getSupportedKeySystemsFromContentProtection(t.contentProtection,u,l);n.length>0&&(0===e.length&&(e=n),r.push(n))})),e&&e.length>0&&x(e,!0)}},createKeySession:B,loadKeySession:U,removeKeySession:function(e){L(),A.removeKeySession(e)},closeKeySession:function(e){L(),A.closeKeySession(e)},setServerCertificate:function(e){L(),A.setServerCertificate(e)},setMediaElement:Y,setSessionType:function(e){l=e},setRobustnessLevel:function(e){c=e},setProtectionData:function(e){u=e,S.setProtectionData(e)},getSupportedKeySystemsFromContentProtection:function(e){return L(),S.getSupportedKeySystemsFromContentProtection(e,u,l)},getKeySystems:function(){return S?S.getKeySystems():[]},setKeySystems:function(e){S&&S.setKeySystems(e)},stop:function(){z(),A&&A.stop()},reset:function(){I.off(R.INTERNAL_KEY_MESSAGE,V,t),I.off(R.INTERNAL_KEY_STATUS_CHANGED,H,t),L(),z(),Y(null),f=null,d=!1,A&&(A.reset(),A=null),D.forEach((function(e){return clearTimeout(e)})),D=[],i=[],r=[]}},n=w.getLogger(t),r=[],i=[],l="temporary",c="",_=null,b=null,I.on(R.INTERNAL_KEY_MESSAGE,V,t),I.on(R.INTERNAL_KEY_STATUS_CHANGED,H,t),t}b.__dashjs_factory_name="ProtectionController";var S=_.a.getClassFactory(b);var A=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.keyID=t,this.key=n};function I(e,t){for(var n=0;n%CUSTOMDATA%'.replace("%CUSTOMDATA%",t),a=[],o=0;o0&&(e[0]&&("string"==typeof e[0]?t=e[0]:n=e[0]),e[1]&&("string"==typeof e[1]?t=e[1]:n=e[1])),{status:t,keyId:n}}function E(e,t){var r={session:e,keyId:t.keyId,initData:t.initData,sessionId:t.sessionId,sessionType:t.sessionType,handleEvent:function(e){switch(e.type){case"keystatuseschange":c.trigger(f.KEY_STATUSES_CHANGED,{data:this}),e.target.keyStatuses.forEach((function(){var e=y(arguments);switch(e.status){case"expired":c.trigger(f.INTERNAL_KEY_STATUS_CHANGED,{error:new g.a(h.KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE,h.KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE)});break;default:c.trigger(f.INTERNAL_KEY_STATUS_CHANGED,e)}}));break;case"message":var t=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;c.trigger(f.INTERNAL_KEY_MESSAGE,{data:new ae(this,t,void 0,e.messageType)})}},getKeyId:function(){return this.keyId},getSessionId:function(){return e.sessionId},getSessionType:function(){return this.sessionType},getExpirationTime:function(){return e.expiration},getKeyStatuses:function(){return e.keyStatuses},getUsable:function(){var t=!1;return e.keyStatuses.forEach((function(){var e=y(arguments);"usable"===e.status&&(t=!0)})),t}};return e.addEventListener("keystatuseschange",r),e.addEventListener("message",r),e.closed.then((function(){m(r),n.debug("DRM: Session closed. SessionID = "+r.getSessionId()),c.trigger(f.KEY_SESSION_CLOSED,{data:r.getSessionId()})})),o.push(r),r}return t={getAllInitData:function(){for(var e=[],t=0;t=1?t():(e=t.bind(this),r.addEventListener("loadedmetadata",e))}return t={getAllInitData:function(){for(var e=[],t=0;t0&&(t=o.ksConfiguration.videoCapabilities[0]),null===t&&o.ksConfiguration.audioCapabilities&&o.ksConfiguration.audioCapabilities.length>0&&(t=o.ksConfiguration.audioCapabilities[0]),null===t)throw new Error("Can not create sessions for unknown content types.");var r=t.contentType,s=a.createSession(r,new Uint8Array(e.initData),e.cdmData?new Uint8Array(e.cdmData):null),l=function(e,t){return{session:e,keyId:t.keyId,initData:t.initData,getKeyId:function(){return this.keyId},getSessionId:function(){return this.session.sessionId},getExpirationTime:function(){return NaN},getSessionType:function(){return"temporary"},handleEvent:function(e){switch(e.type){case y.error:d.trigger(p.KEY_ERROR,{error:new g.a(h.MEDIA_KEYERR_CODE,"KeyError",this)});break;case y.message:var t=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;d.trigger(p.INTERNAL_KEY_MESSAGE,{data:new ae(this,t,e.destinationURL)});break;case y.ready:n.debug("DRM: Key added."),d.trigger(p.KEY_ADDED);break;case y.close:n.debug("DRM: Session closed. SessionID = "+this.getSessionId()),d.trigger(p.KEY_SESSION_CLOSED,{data:this.getSessionId()})}}}}(s,e);s.addEventListener(y.error,l),s.addEventListener(y.message,l),s.addEventListener(y.ready,l),s.addEventListener(y.close,l),u.push(l),n.debug("DRM: Session created. SessionID = "+l.getSessionId()),d.trigger(p.KEY_SESSION_CREATED,{data:l})},updateKeySession:function(e,t){var n=e.session;c.isClearKey(i)?n.update(new Uint8Array(t.toJWK())):n.update(new Uint8Array(t)),d.trigger(p.KEY_SESSION_UPDATED)},closeKeySession:v,setServerCertificate:function(){},loadKeySession:function(){},removeKeySession:function(){},stop:E,reset:E},n=m.getLogger(t),r=null,i=null,a=null,o=null,u=[],c=Z(f).getInstance(),l={handleEvent:function(e){switch(e.type){case y.needkey:if(e.initData){var t=ArrayBuffer.isView(e.initData)?e.initData.buffer:e.initData;d.trigger(p.NEED_KEY,{key:new ie(t,"cenc")})}}}},t}ce.__dashjs_factory_name="ProtectionModel_3Feb2014";var fe=dashjs.FactoryMaker.getClassFactory(ce);function de(e){e=e||{};var t,n,r,i,a,o,u,l,c,f=this.context,d=e.eventBus,p=e.events,m=e.debug,y=e.api,E=e.errHandler;function v(){r&&b();for(var e=0;e0&&(t=o.shift(),u.push(t),t.sessionId=e.sessionId,d.trigger(p.KEY_SESSION_CREATED,{data:t})):o.length>0&&(t=o.shift(),u.push(t),0!==o.length&&E.error(new g.a(h.MEDIA_KEY_MESSAGE_ERROR_CODE,h.MEDIA_KEY_MESSAGE_ERROR_MESSAGE))),t){var s=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;t.keyMessage=s,d.trigger(p.INTERNAL_KEY_MESSAGE,{data:new ae(t,s,e.defaultURL)})}else n.warn("No session token found for key message")}}},t}de.__dashjs_factory_name="ProtectionModel_01b";var he=dashjs.FactoryMaker.getClassFactory(de),ge=[{generateKeyRequest:"generateKeyRequest",addKey:"addKey",cancelKeyRequest:"cancelKeyRequest",needkey:"needkey",keyerror:"keyerror",keyadded:"keyadded",keymessage:"keymessage"},{generateKeyRequest:"webkitGenerateKeyRequest",addKey:"webkitAddKey",cancelKeyRequest:"webkitCancelKeyRequest",needkey:"webkitneedkey",keyerror:"webkitkeyerror",keyadded:"webkitkeyadded",keymessage:"webkitkeymessage"}],pe=[{setMediaKeys:"setMediaKeys",MediaKeys:"MediaKeys",release:"close",needkey:"needkey",error:"keyerror",message:"keymessage",ready:"keyadded",close:"keyclose"},{setMediaKeys:"msSetMediaKeys",MediaKeys:"MSMediaKeys",release:"close",needkey:"msneedkey",error:"mskeyerror",message:"mskeymessage",ready:"mskeyadded",close:"mskeyclose"}];function me(){var e,t=this.context;function n(e,t){for(var n=0;n=400||t.responsecode<100||t.responsecode>=600)&&l({errorcode:t.responsecode||i.CONNECTION_ERROR,url:t.url,terror:t.tresponse,servicelocation:t._serviceLocation})}var t}function g(e){var t;switch(e.error?e.error.code:0){case MediaError.MEDIA_ERR_NETWORK:t=i.CONNECTION_ERROR;break;case MediaError.MEDIA_ERR_DECODE:t=i.CORRUPT_MEDIA_OTHER;break;default:return}l({errorcode:t})}return t={initialise:function(){r.on(u.MANIFEST_UPDATED,c,t),r.on(u.SERVICE_LOCATION_BLACKLIST_CHANGED,f,t),r.on(u.METRIC_ADDED,h,t),r.on(u.METRIC_UPDATED,h,t),r.on(u.PLAYBACK_ERROR,g,t),r.on(a.a.BECAME_REPORTING_PLAYER,d,t)},reset:function(){r.off(u.MANIFEST_UPDATED,c,t),r.off(u.SERVICE_LOCATION_BLACKLIST_CHANGED,f,t),r.off(u.METRIC_ADDED,h,t),r.off(u.METRIC_UPDATED,h,t),r.off(u.PLAYBACK_ERROR,g,t),r.off(a.a.BECAME_REPORTING_PLAYER,d,t)}}}o.__dashjs_factory_name="DVBErrorsTranslator";var s=dashjs.FactoryMaker.getSingletonFactory(o),u=n(52);function l(e){e=e||{};var t,n,r=!1,i=this.context,a=e.mediaElement;return t={initialize:function(e){e&&e.length&&(e.forEach((function(e){var t=e.starttime,r=t+e.duration;n.add(t,r)})),r=!!e[0]._useWallClockTime)},reset:function(){n.clear()},isEnabled:function(){var e,t=n.length;if(!t)return!0;e=r?(new Date).getTime()/1e3:a.currentTime;for(var i=0;i=200&&i.status<300?t&&t():n&&n())};c.push(i);try{i.open("GET",e),i.onloadend=a,i.onerror=a,i.send()}catch(e){i.onerror()}}(i="".concat(s,"?").concat(i),null,(function(){o=!1}))}))},initialize:function(e,t){var n;if(u=t,!(s=e.dvb_reportingUrl))throw new Error("required parameter missing (dvb:reportingUrl)");a||((n=e.dvb_probability)&&(1e3===n||n/1e3>=i.random())&&(o=!0),a=!0)},reset:function(){h()}},n=d(l).getInstance(),i=g(l).getInstance(),r=Object(p.a)(l).getInstance(),h(),t}m.__dashjs_factory_name="DVBReporting";var y=dashjs.FactoryMaker.getClassFactory(m);function E(e){e=e||{};var t,n={"urn:dvb:dash:reporting:2014":y},r=this.context,i=e.debug?e.debug.getLogger(t):{},a=e.metricsConstants,o=e.mediaPlayerModel||{};return t={create:function(e,t){var s;try{(s=n[e.schemeIdUri](r).create({metricsConstants:a,mediaPlayerModel:o})).initialize(e,t)}catch(t){s=null,i.error("ReportingFactory: could not create Reporting with schemeIdUri ".concat(e.schemeIdUri," (").concat(t.message,")"))}return s},register:function(e,t){n[e]=t},unregister:function(e){delete n[e]}}}E.__dashjs_factory_name="ReportingFactory";var v=dashjs.FactoryMaker.getSingletonFactory(E);function _(e){var t=[],n=v(this.context).getInstance(e);return{initialize:function(e,r){e.some((function(e){var i=n.create(e,r);if(i)return t.push(i),!0}))},reset:function(){t.forEach((function(e){return e.reset()})),t=[]},report:function(e,n){t.forEach((function(t){return t.report(e,n)}))}}}_.__dashjs_factory_name="ReportingController";var T=dashjs.FactoryMaker.getClassFactory(_);function b(){return{reconstructFullMetricName:function(e,t,n){var r=e;return t&&(r+="("+t,n&&n.length&&(r+=","+n),r+=")"),r},validateN:function(e){if(!e)throw new Error("missing n");if(isNaN(e))throw new Error("n is NaN");if(e<0)throw new Error("n must be positive");return e}}}b.__dashjs_factory_name="HandlerHelpers";var S=dashjs.FactoryMaker.getSingletonFactory(b);function A(e){var t,n,r,i,a;e=e||{};var o=this.context,s=S(o).getInstance(),u=[],l=e.metricsConstants;function c(){var e=function(){try{return Object.keys(u).map((function(e){return u[e]})).reduce((function(e,t){return e.level=c.end)return null;var h="regionID"in c&&""!==c.regionID?c.regionID:l;if(null!==u&&h!==i.id&&(!("contents"in c)||"contents"in c&&0===c.contents.length||""!==h))return null;var g=new a(c);for(var p in c.sets)t=c.sets[p].end||(g.styleAttrs[c.sets[p].qname]=c.sets[p].value);var m,y={};for(var E in g.styleAttrs)if(y[E]=!0,E===n.byName.writingMode.qname&&!(n.byName.direction.qname in g.styleAttrs)){var v=g.styleAttrs[E];"lrtb"===v||"lr"===v?g.styleAttrs[n.byName.direction.qname]="ltr":"rltb"!==v&&"rl"!==v||(g.styleAttrs[n.byName.direction.qname]="rtl")}if(null!==u)for(var _ in n.all){var T=n.all[_];if(T.qname===n.byName.textDecoration.qname){var b=u.styleAttrs[T.qname],S=g.styleAttrs[T.qname],A=[];void 0===S?A=b:-1===S.indexOf("none")?((-1===S.indexOf("noUnderline")&&-1!==b.indexOf("underline")||-1!==S.indexOf("underline"))&&A.push("underline"),(-1===S.indexOf("noLineThrough")&&-1!==b.indexOf("lineThrough")||-1!==S.indexOf("lineThrough"))&&A.push("lineThrough"),(-1===S.indexOf("noOverline")&&-1!==b.indexOf("overline")||-1!==S.indexOf("overline"))&&A.push("overline")):A.push("none"),g.styleAttrs[T.qname]=A}else T.inherit&&T.qname in u.styleAttrs&&!(T.qname in g.styleAttrs)&&(g.styleAttrs[T.qname]=u.styleAttrs[T.qname])}for(var I in n.all){var R=n.all[I];R.qname in g.styleAttrs||("region"===g.kind||!1===R.inherit&&null!==R.initial)&&(g.styleAttrs[R.qname]=R.parse(R.initial),y[R.qname]=!0)}for(var w in n.all){var N=n.all[w];if(N.qname in y&&null!==N.compute){var C=N.compute(e,u,g,g.styleAttrs[N.qname],d);null!==C?g.styleAttrs[N.qname]=C:o(f,"Style '"+N.qname+"' on element '"+g.kind+"' cannot be computed")}}if("none"===g.styleAttrs[n.byName.display.qname])return null;for(var D in null===u?m=null===s?[]:[s]:"contents"in c&&(m=c.contents),m){var O=r(e,t,i,s,g,h,m[D],f,d);null!==O&&g.contents.push(O.element)}for(var M in g.styleAttrs){-1===n.byQName[M].applies.indexOf(g.kind)&&delete g.styleAttrs[M]}if("span"===g.kind&&g.text&&"default"===g.space){var P=g.text.replace(/\s+/g," ");g.text=P}if("p"===g.kind){var L=[];!function e(t,n){if("contents"in t)for(var r in t.contents)e(t.contents[r],n);else n.push(t)}(g,L);for(var x=0,F="after_br",k=0;;)if("after_br"===F)x>=L.length||"br"===L[x].kind?(F="before_br",k=x,x--):("preserve"!==L[x].space&&(L[x].text=L[x].text.replace(/^\s+/g,"")),L[x].text.length>0?(F="looking_br",x++):L.splice(x,1));else if("before_br"===F)if(x<0||"br"===L[x].kind){if(F="after_br",(x=k+1)>=L.length)break}else if("preserve"!==L[x].space&&(L[x].text=L[x].text.replace(/\s+$/g,"")),L[x].text.length>0){if(F="after_br",(x=k+1)>=L.length)break}else L.splice(x,1),x--;else x>=L.length||"br"===L[x].kind?(F="before_br",k=x,x--):x++;!function e(t){if("br"===t.kind)return!1;if("text"in t)return 0===t.text.length;if("contents"in t){for(var n=t.contents.length;n--;)e(t.contents[n])&&t.contents.splice(n,1);return 0===t.contents.length}}(g)}return"div"===g.kind&&n.byName.backgroundImage.qname in g.styleAttrs||"br"===g.kind||"contents"in g&&g.contents.length>0||"span"===g.kind&&null!==g.text||"region"===g.kind&&"always"===g.styleAttrs[n.byName.showBackground.qname]?{region_id:h,element:g}:null}function i(e){this.contents=[],this.aspectRatio=e.aspectRatio}function a(e){for(var t in this.kind=e.kind||"region",e.id&&(this.id=e.id),this.styleAttrs={},e.styleAttrs)this.styleAttrs[t]=e.styleAttrs[t];"text"in e?this.text=e.text:"br"!==e.kind&&(this.contents=[]),"space"in e&&(this.space=e.space)}function o(e,t){if(e&&e.error&&e.error(t))throw t}e.generateISD=function(e,t,n){var a=new i(e),o={};for(var s in e.head.layout.regions){var u=r(e,t,e.head.layout.regions[s],e.body,null,"",e.head.layout.regions[s],n,o);null!==u&&a.contents.push(u.element)}return a}}(t,"undefined"==typeof imscNames?n(55):imscNames,"undefined"==typeof imscStyles?n(69):imscStyles)},function(e,t,n){!function(e,t,n,r,i){function a(e,t,n,r){var i=r&&"seq"===r.timeContainer,o=0;r&&(o=i&&n?n.end:r.begin),t.begin=t.explicit_begin?t.explicit_begin+o:o;var s=t.begin,u=null;for(var l in t.sets)a(e,t.sets[l],u,t),s="seq"===t.timeContainer?t.sets[l].end:Math.max(s,t.sets[l].end),u=t.sets[l];if("contents"in t)for(var c in t.contents)a(e,t.contents[c],u,t),s="seq"===t.timeContainer?t.contents[c].end:Math.max(s,t.contents[c].end),u=t.contents[c];else s=i?t.begin:Number.POSITIVE_INFINITY;null!==t.explicit_end&&null!==t.explicit_dur?t.end=Math.min(t.begin+t.explicit_dur,o+t.explicit_end):null===t.explicit_end&&null!==t.explicit_dur?t.end=t.begin+t.explicit_dur:null!==t.explicit_end&&null===t.explicit_dur?t.end=o+t.explicit_end:t.end=s,delete t.explicit_begin,delete t.explicit_dur,delete t.explicit_end,e._registerEvent(t)}function o(e){this.node=e}function s(){this.events=[],this.head=null,this.body=null}function u(){this.styling=null,this.layout=null}function l(){this.styles={}}function c(){this.id=null,this.styleAttrs=null,this.styleRefs=null}function f(){this.regions={}}function d(e){this.kind=e}function h(e){this.id=e}function g(e){this.regionID=e}function p(e){this.styleAttrs=e}function m(e){this.sets=e}function y(e){this.contents=e}function E(e,t,n){this.explicit_begin=e,this.explicit_end=t,this.explicit_dur=n}function v(){d.call(this,"body")}function _(){d.call(this,"div")}function T(){d.call(this,"p")}function b(){d.call(this,"span")}function S(){d.call(this,"span")}function A(){d.call(this,"br")}function I(){}function R(){}function w(e){return e&&"xml:id"in e.attributes&&e.attributes["xml:id"].value||null}function N(e){return e&&"style"in e.attributes?e.attributes.style.value.split(" "):[]}function C(e,t){var n={};if(null!==e)for(var i in e.attributes){var a=e.attributes[i].uri+" "+e.attributes[i].local,o=r.byQName[a];if(void 0!==o){var s=o.parse(e.attributes[i].value);null!==s?(n[a]=s,o===r.byName.zIndex&&x(t,"zIndex attribute present but not used by IMSC1 since regions do not overlap")):F(t,"Cannot parse styling attribute "+a+" --\x3e "+e.attributes[i].value)}}return n}function D(e,t,n){for(var r in e.attributes)if(e.attributes[r].uri===t&&e.attributes[r].local===n)return e.attributes[r].value;return null}function O(e,t,n){var r,i=null;return null!==(r=/^(\d+(?:\.\d+)?)f$/.exec(n))?null!==t&&(i=parseFloat(r[1])/t):null!==(r=/^(\d+(?:\.\d+)?)t$/.exec(n))?null!==e&&(i=parseFloat(r[1])/e):null!==(r=/^(\d+(?:\.\d+)?)ms$/.exec(n))?i=parseFloat(r[1])/1e3:null!==(r=/^(\d+(?:\.\d+)?)s$/.exec(n))?i=parseFloat(r[1]):null!==(r=/^(\d+(?:\.\d+)?)h$/.exec(n))?i=3600*parseFloat(r[1]):null!==(r=/^(\d+(?:\.\d+)?)m$/.exec(n))?i=60*parseFloat(r[1]):null!==(r=/^(\d{2,}):(\d\d):(\d\d(?:\.\d+)?)$/.exec(n))?i=3600*parseInt(r[1])+60*parseInt(r[2])+parseFloat(r[3]):null!==(r=/^(\d{2,}):(\d\d):(\d\d)\:(\d{2,})$/.exec(n))&&null!==t&&(i=3600*parseInt(r[1])+60*parseInt(r[2])+parseInt(r[3])+(null===r[4]?0:parseInt(r[4])/t)),i}function M(e,t,n){for(;t.styleRefs.length>0;){var r=t.styleRefs.pop();r in e.styles?(M(e,e.styles[r],n),L(e.styles[r].styleAttrs,t.styleAttrs)):F(n,"Non-existant style id referenced")}}function P(e,t,n,r){for(var i=t.length-1;i>=0;i--){var a=t[i];a in e.styles?L(e.styles[a].styleAttrs,n):F(r,"Non-existant style id referenced")}}function L(e,t){for(var n in e)n in t||(t[n]=e[n])}function x(e,t){if(e&&e.warn&&e.warn(t))throw t}function F(e,t){if(e&&e.error&&e.error(t))throw t}function k(e,t){throw e&&e.fatal&&e.fatal(t),t}function U(e,t){for(var n,r=0,i=e.length-1;r<=i;){var a=e[n=Math.floor((r+i)/2)];if(at))return{found:!0,index:n};i=n-1}}return{found:!1,index:r}}e.fromXML=function(e,r,i){var d=t.parser(!0,{xmlns:!0}),h=[],g=[],p=[],m=0,y=null;d.onclosetag=function(e){if(h[0]instanceof l)for(var t in h[0].styles)M(h[0],h[0].styles[t],r);else if(h[0]instanceof T||h[0]instanceof b){if(h[0].contents.length>1){var a,s=[h[0].contents[0]];for(a=1;a0&&i&&"onCloseTag"in i&&i.onCloseTag());p.shift(),g.shift(),h.shift()},d.ontext=function(e){if(void 0===h[0]);else if(h[0]instanceof b||h[0]instanceof T){var t=new S;t.initFromText(y,h[0],e,p[0],r),h[0].contents.push(t)}else h[0]instanceof o&&m>0&&i&&"onText"in i&&i.onText(e)},d.onopentag=function(e){var t=e.attributes["xml:space"];t?p.unshift(t.value):0===p.length?p.unshift("default"):p.unshift(p[0]);var a=e.attributes["xml:lang"];if(a?g.unshift(a.value):0===g.length?g.unshift(""):g.unshift(g[0]),e.uri===n.ns_tt)if("tt"===e.local)null!==y&&k(r,"Two elements at ("+this.line+","+this.column+")"),(y=new s).initFromNode(e,r),h.unshift(y);else if("head"===e.local)h[0]instanceof s||k(r,"Parent of element is not at ("+this.line+","+this.column+")"),null!==y.head&&k("Second element at ("+this.line+","+this.column+")"),y.head=new u,h.unshift(y.head);else if("styling"===e.local)h[0]instanceof u||k(r,"Parent of element is not at ("+this.line+","+this.column+")"),null!==y.head.styling&&k("Second element at ("+this.line+","+this.column+")"),y.head.styling=new l,h.unshift(y.head.styling);else if("style"===e.local){var d;h[0]instanceof l?((d=new c).initFromNode(e,r),d.id?y.head.styling.styles[d.id]=d:F(r,"
diff --git a/src/views/workflow/category/index.vue b/src/views/workflows/category/index.vue
similarity index 96%
rename from src/views/workflow/category/index.vue
rename to src/views/workflows/category/index.vue
index cd6984e..53a285a 100644
--- a/src/views/workflow/category/index.vue
+++ b/src/views/workflows/category/index.vue
@@ -18,7 +18,7 @@
- 新增
+ 新增
展开/折叠
@@ -41,13 +41,13 @@
-
+
-
+
-
+
diff --git a/src/views/workflow/leave/index.vue b/src/views/workflows/leave/index.vue
similarity index 91%
rename from src/views/workflow/leave/index.vue
rename to src/views/workflows/leave/index.vue
index 608cf05..861ae6f 100644
--- a/src/views/workflow/leave/index.vue
+++ b/src/views/workflows/leave/index.vue
@@ -22,10 +22,10 @@
- 新增
+ 新增
- 导出
+ 导出
@@ -60,12 +60,12 @@
- 修改
- 删除
@@ -167,7 +167,7 @@ const handleSelectionChange = (selection: LeaveVO[]) => {
const handleAdd = () => {
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
- path: `/workflow/leaveEdit/index`,
+ path: `/workflows/leaveEdit/index`,
query: {
type: 'add'
}
@@ -178,7 +178,7 @@ const handleAdd = () => {
const handleUpdate = (row?: LeaveVO) => {
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
- path: `/workflow/leaveEdit/index`,
+ path: `/workflows/leaveEdit/index`,
query: {
id: row.id,
type: 'update'
@@ -190,7 +190,7 @@ const handleUpdate = (row?: LeaveVO) => {
const handleView = (row?: LeaveVO) => {
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
- path: `/workflow/leaveEdit/index`,
+ path: `/workflows/leaveEdit/index`,
query: {
id: row.id,
type: 'view'
@@ -210,7 +210,7 @@ const handleDelete = async (row?: LeaveVO) => {
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
- 'workflow/leave/export',
+ 'workflows/leave/export',
{
...queryParams.value
},
diff --git a/src/views/workflow/leave/leaveEdit.vue b/src/views/workflows/leave/leaveEdit.vue
similarity index 100%
rename from src/views/workflow/leave/leaveEdit.vue
rename to src/views/workflows/leave/leaveEdit.vue
diff --git a/src/views/workflow/processDefinition/design.vue b/src/views/workflows/processDefinition/design.vue
similarity index 91%
rename from src/views/workflow/processDefinition/design.vue
rename to src/views/workflows/processDefinition/design.vue
index 428ab6f..791b624 100644
--- a/src/views/workflow/processDefinition/design.vue
+++ b/src/views/workflows/processDefinition/design.vue
@@ -23,14 +23,14 @@ const iframeLoaded = () => {
}
};
};
-//baseUrl +
+//baseUrl +
const open = async (definitionId, disabled) => {
const url = `/warm-flow-ui/index.html?id=${definitionId}&disabled=${disabled}`;
iframeUrl.value = url + '&Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID;
};
/** 关闭按钮 */
function close() {
- const obj = { path: '/workflow/processDefinition', query: { activeName: proxy.$route.query.activeName } };
+ const obj = { path: '/workflows/processDefinition', query: { activeName: proxy.$route.query.activeName } };
proxy.$tab.closeOpenPage(obj);
}
diff --git a/src/views/workflow/processDefinition/index.vue b/src/views/workflows/processDefinition/index.vue
similarity index 98%
rename from src/views/workflow/processDefinition/index.vue
rename to src/views/workflows/processDefinition/index.vue
index 1339e3b..92e74d6 100644
--- a/src/views/workflow/processDefinition/index.vue
+++ b/src/views/workflows/processDefinition/index.vue
@@ -10,13 +10,13 @@
class="mt-2"
node-key="id"
:data="categoryOptions"
- :props="{ label: 'label', children: 'children' } as any"
+ :props="{ label: 'label', children: 'children' }"
:expand-on-click-node="false"
:filter-node-method="filterNode"
highlight-current
default-expand-all
@node-click="handleNodeClick"
- >
+ />
@@ -132,7 +132,7 @@
- {{ currentProject.id }}
+ {{ currentProject.id }}
@@ -442,7 +442,7 @@ const handlerImportDefinition = (data: UploadRequestOptions): XMLHttpRequest =>
*/
const design = async (row: FlowDefinitionVo) => {
proxy.$router.push({
- path: `/workflow/design/index`,
+ path: `/workflows/design/index`,
query: {
definitionId: row.id,
disabled: false,
@@ -456,13 +456,10 @@ const design = async (row: FlowDefinitionVo) => {
* @param row
*/
const designView = async (row: FlowDefinitionVo) => {
- proxy.$router.push({
- path: `/workflow/design/index`,
- query: {
- definitionId: row.id,
- disabled: true,
- activeName: activeName.value
- }
+ proxy.$tab.openPage(`/workflows/design/index`, '', {
+ definitionId: row.id,
+ disabled: true,
+ activeName: activeName.value
});
};
/** 表单重置 */
diff --git a/src/views/workflow/processInstance/index.vue b/src/views/workflows/processInstance/index.vue
similarity index 100%
rename from src/views/workflow/processInstance/index.vue
rename to src/views/workflows/processInstance/index.vue
diff --git a/src/views/workflow/task/allTaskWaiting.vue b/src/views/workflows/task/allTaskWaiting.vue
similarity index 100%
rename from src/views/workflow/task/allTaskWaiting.vue
rename to src/views/workflows/task/allTaskWaiting.vue
diff --git a/src/views/workflow/task/myDocument.vue b/src/views/workflows/task/myDocument.vue
similarity index 100%
rename from src/views/workflow/task/myDocument.vue
rename to src/views/workflows/task/myDocument.vue
diff --git a/src/views/workflow/task/taskCopyList.vue b/src/views/workflows/task/taskCopyList.vue
similarity index 100%
rename from src/views/workflow/task/taskCopyList.vue
rename to src/views/workflows/task/taskCopyList.vue
diff --git a/src/views/workflow/task/taskFinish.vue b/src/views/workflows/task/taskFinish.vue
similarity index 100%
rename from src/views/workflow/task/taskFinish.vue
rename to src/views/workflows/task/taskFinish.vue
diff --git a/src/views/workflow/task/taskWaiting.vue b/src/views/workflows/task/taskWaiting.vue
similarity index 100%
rename from src/views/workflow/task/taskWaiting.vue
rename to src/views/workflows/task/taskWaiting.vue