!function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=54)}([function(e,t,n){"use strict";var i=n(16);class r extends i.a{constructor(){super(),this.ATTEMPT_BACKGROUND_SYNC="attemptBackgroundSync",this.BUFFERING_COMPLETED="bufferingCompleted",this.BUFFER_CLEARED="bufferCleared",this.BUFFER_LEVEL_UPDATED="bufferLevelUpdated",this.BYTES_APPENDED="bytesAppended",this.BYTES_APPENDED_END_FRAGMENT="bytesAppendedEndFragment",this.CHECK_FOR_EXISTENCE_COMPLETED="checkForExistenceCompleted",this.CURRENT_TRACK_CHANGED="currentTrackChanged",this.DATA_UPDATE_COMPLETED="dataUpdateCompleted",this.DATA_UPDATE_STARTED="dataUpdateStarted",this.INBAND_EVENTS="inbandEvents",this.INITIALIZATION_LOADED="initializationLoaded",this.INIT_FRAGMENT_LOADED="initFragmentLoaded",this.INIT_FRAGMENT_NEEDED="initFragmentNeeded",this.INTERNAL_MANIFEST_LOADED="internalManifestLoaded",this.ORIGINAL_MANIFEST_LOADED="originalManifestLoaded",this.LIVE_EDGE_SEARCH_COMPLETED="liveEdgeSearchCompleted",this.LOADING_COMPLETED="loadingCompleted",this.LOADING_PROGRESS="loadingProgress",this.LOADING_DATA_PROGRESS="loadingDataProgress",this.LOADING_ABANDONED="loadingAborted",this.MANIFEST_UPDATED="manifestUpdated",this.MEDIA_FRAGMENT_LOADED="mediaFragmentLoaded",this.MEDIA_FRAGMENT_NEEDED="mediaFragmentNeeded",this.QUOTA_EXCEEDED="quotaExceeded",this.REPRESENTATION_UPDATE_STARTED="representationUpdateStarted",this.REPRESENTATION_UPDATE_COMPLETED="representationUpdateCompleted",this.SEGMENTS_LOADED="segmentsLoaded",this.SERVICE_LOCATION_BLACKLIST_ADD="serviceLocationBlacklistAdd",this.SERVICE_LOCATION_BLACKLIST_CHANGED="serviceLocationBlacklistChanged",this.SOURCEBUFFER_REMOVE_COMPLETED="sourceBufferRemoveCompleted",this.STREAMS_COMPOSED="streamsComposed",this.STREAM_BUFFERING_COMPLETED="streamBufferingCompleted",this.STREAM_COMPLETED="streamCompleted",this.TEXT_TRACKS_QUEUE_INITIALIZED="textTracksQueueInitialized",this.TIME_SYNCHRONIZATION_COMPLETED="timeSynchronizationComplete",this.UPDATE_TIME_SYNC_OFFSET="updateTimeSyncOffset",this.URL_RESOLUTION_FAILED="urlResolutionFailed",this.VIDEO_CHUNK_RECEIVED="videoChunkReceived",this.WALLCLOCK_TIME_UPDATED="wallclockTimeUpdated",this.XLINK_ELEMENT_LOADED="xlinkElementLoaded",this.XLINK_READY="xlinkReady",this.SEGMENTBASE_INIT_REQUEST_NEEDED="segmentBaseInitRequestNeeded",this.SEGMENTBASE_SEGMENTSLIST_REQUEST_NEEDED="segmentBaseSegmentsListRequestNeeded",this.SEEK_TARGET="seekTarget"}}var s=r;let a=new class extends s{};t.a=a},function(e,t,n){"use strict";const i=new class{init(){this.STREAM="stream",this.VIDEO="video",this.AUDIO="audio",this.TEXT="text",this.FRAGMENTED_TEXT="fragmentedText",this.EMBEDDED_TEXT="embeddedText",this.MUXED="muxed",this.IMAGE="image",this.MESH="mesh",this.STPP="stpp",this.TTML="ttml",this.VTT="vtt",this.WVTT="wvtt",this.ABR_STRATEGY_DYNAMIC="abrDynamic",this.ABR_STRATEGY_BOLA="abrBola",this.ABR_STRATEGY_L2A="abrL2A",this.ABR_STRATEGY_LoLP="abrLoLP",this.ABR_STRATEGY_THROUGHPUT="abrThroughput",this.ABR_FETCH_THROUGHPUT_CALCULATION_DOWNLOADED_DATA="abrFetchThroughputCalculationDownloadedData",this.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING="abrFetchThroughputCalculationMoofParsing",this.LIVE_CATCHUP_MODE_DEFAULT="liveCatchupModeDefault",this.LIVE_CATCHUP_MODE_LOLP="liveCatchupModeLoLP",this.MOVING_AVERAGE_SLIDING_WINDOW="slidingWindow",this.MOVING_AVERAGE_EWMA="ewma",this.BAD_ARGUMENT_ERROR="Invalid Arguments",this.MISSING_CONFIG_ERROR="Missing config parameter(s)",this.TRACK_SWITCH_MODE_ALWAYS_REPLACE="alwaysReplace",this.TRACK_SWITCH_MODE_NEVER_REPLACE="neverReplace",this.TRACK_SELECTION_MODE_FIRST_TRACK="firstTrack",this.TRACK_SELECTION_MODE_HIGHEST_BITRATE="highestBitrate",this.TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY="highestEfficiency",this.TRACK_SELECTION_MODE_WIDEST_RANGE="widestRange",this.CMCD_MODE_QUERY="query",this.CMCD_MODE_HEADER="header",this.LOCATION="Location",this.INITIALIZE="initialize",this.TEXT_SHOWING="showing",this.TEXT_HIDDEN="hidden",this.CC1="CC1",this.CC3="CC3",this.UTF8="utf-8",this.SCHEME_ID_URI="schemeIdUri",this.START_TIME="starttime",this.SERVICE_DESCRIPTION_LL_SCHEME="urn:dvb:dash:lowlatency:scope:2019",this.SUPPLEMENTAL_PROPERTY_LL_SCHEME="urn:dvb:dash:lowlatency:critical:2019",this.XML="XML",this.ARRAY_BUFFER="ArrayBuffer",this.DVB_REPORTING_URL="dvb:reportingUrl",this.DVB_PROBABILITY="dvb:probability"}constructor(){this.init()}};t.a=i},function(e,t,n){"use strict";let i=new class{init(){this.BASE_URL="BaseURL",this.SEGMENT_BASE="SegmentBase",this.SEGMENT_TEMPLATE="SegmentTemplate",this.SEGMENT_LIST="SegmentList",this.SEGMENT_URL="SegmentURL",this.SEGMENT_TIMELINE="SegmentTimeline",this.SEGMENT_PROFILES="segmentProfiles",this.ADAPTATION_SET="AdaptationSet",this.REPRESENTATION="Representation",this.REPRESENTATION_INDEX="RepresentationIndex",this.SUB_REPRESENTATION="SubRepresentation",this.INITIALIZATION="Initialization",this.INITIALIZATION_MINUS="initialization",this.MPD="MPD",this.PERIOD="Period",this.ASSET_IDENTIFIER="AssetIdentifier",this.EVENT_STREAM="EventStream",this.ID="id",this.PROFILES="profiles",this.SERVICE_LOCATION="serviceLocation",this.RANGE="range",this.INDEX="index",this.MEDIA="media",this.BYTE_RANGE="byteRange",this.INDEX_RANGE="indexRange",this.MEDIA_RANGE="mediaRange",this.VALUE="value",this.CONTENT_TYPE="contentType",this.MIME_TYPE="mimeType",this.BITSTREAM_SWITCHING="BitstreamSwitching",this.BITSTREAM_SWITCHING_MINUS="bitstreamSwitching",this.CODECS="codecs",this.DEPENDENCY_ID="dependencyId",this.MEDIA_STREAM_STRUCTURE_ID="mediaStreamStructureId",this.METRICS="Metrics",this.METRICS_MINUS="metrics",this.REPORTING="Reporting",this.WIDTH="width",this.HEIGHT="height",this.SAR="sar",this.FRAMERATE="frameRate",this.AUDIO_SAMPLING_RATE="audioSamplingRate",this.MAXIMUM_SAP_PERIOD="maximumSAPPeriod",this.START_WITH_SAP="startWithSAP",this.MAX_PLAYOUT_RATE="maxPlayoutRate",this.CODING_DEPENDENCY="codingDependency",this.SCAN_TYPE="scanType",this.FRAME_PACKING="FramePacking",this.AUDIO_CHANNEL_CONFIGURATION="AudioChannelConfiguration",this.CONTENT_PROTECTION="ContentProtection",this.ESSENTIAL_PROPERTY="EssentialProperty",this.SUPPLEMENTAL_PROPERTY="SupplementalProperty",this.INBAND_EVENT_STREAM="InbandEventStream",this.ACCESSIBILITY="Accessibility",this.ROLE="Role",this.RATING="Rating",this.CONTENT_COMPONENT="ContentComponent",this.SUBSET="Subset",this.LANG="lang",this.VIEWPOINT="Viewpoint",this.ROLE_ASARRAY="Role_asArray",this.ACCESSIBILITY_ASARRAY="Accessibility_asArray",this.AUDIOCHANNELCONFIGURATION_ASARRAY="AudioChannelConfiguration_asArray",this.CONTENTPROTECTION_ASARRAY="ContentProtection_asArray",this.MAIN="main",this.DYNAMIC="dynamic",this.STATIC="static",this.MEDIA_PRESENTATION_DURATION="mediaPresentationDuration",this.MINIMUM_UPDATE_PERIOD="minimumUpdatePeriod",this.CODEC_PRIVATE_DATA="codecPrivateData",this.BANDWITH="bandwidth",this.SOURCE_URL="sourceURL",this.TIMESCALE="timescale",this.DURATION="duration",this.START_NUMBER="startNumber",this.PRESENTATION_TIME_OFFSET="presentationTimeOffset",this.AVAILABILITY_START_TIME="availabilityStartTime",this.AVAILABILITY_END_TIME="availabilityEndTime",this.TIMESHIFT_BUFFER_DEPTH="timeShiftBufferDepth",this.MAX_SEGMENT_DURATION="maxSegmentDuration",this.PRESENTATION_TIME="presentationTime",this.MIN_BUFFER_TIME="minBufferTime",this.MAX_SUBSEGMENT_DURATION="maxSubsegmentDuration",this.START="start",this.AVAILABILITY_TIME_OFFSET="availabilityTimeOffset",this.AVAILABILITY_TIME_COMPLETE="availabilityTimeComplete",this.CENC_DEFAULT_KID="cenc:default_KID",this.DVB_PRIORITY="dvb:priority",this.DVB_WEIGHT="dvb:weight",this.SUGGESTED_PRESENTATION_DELAY="suggestedPresentationDelay",this.SERVICE_DESCRIPTION="ServiceDescription",this.SERVICE_DESCRIPTION_SCOPE="Scope",this.SERVICE_DESCRIPTION_LATENCY="Latency",this.SERVICE_DESCRIPTION_PLAYBACK_RATE="PlaybackRate",this.PATCH_LOCATION="PatchLocation",this.PUBLISH_TIME="publishTime",this.ORIGINAL_PUBLISH_TIME="originalPublishTime",this.ORIGINAL_MPD_ID="mpdId"}constructor(){this.init()}};t.a=i},function(e,t,n){"use strict";const i=function(){let e,t=[];const n={},i={};function r(e,n){for(const i in t){const r=t[i];if(r.context===e&&r.name===n)return r.instance}return null}function s(e,t){return t[e]}function a(e,t,n){e in n&&(n[e]=t)}function o(t,n,i){let r;const s=t.__dashjs_factory_name,a=n[s];if(a){let s=a.instance;if(!a.override)return s.apply({context:n,factory:e},i);r=t.apply({context:n},i),s=s.apply({context:n,factory:e,parent:r},i);for(const e in s)r.hasOwnProperty(e)&&(r[e]=s[e])}else r=t.apply({context:n},i);return r.getClassName=function(){return s},r}return e={extend:function(e,t,n,i){!i[e]&&t&&(i[e]={instance:t,override:n})},getSingletonInstance:r,setSingletonInstance:function(e,n,i){for(const r in t){const s=t[r];if(s.context===e&&s.name===n)return void(t[r].instance=i)}t.push({name:n,context:e,instance:i})},deleteSingletonInstances:function(e){t=t.filter(t=>t.context!==e)},getSingletonFactory:function(e){let i=s(e.__dashjs_factory_name,n);return i||(i=function(n){let i;return void 0===n&&(n={}),{getInstance:function(){return i||(i=r(n,e.__dashjs_factory_name)),i||(i=o(e,n,arguments),t.push({name:e.__dashjs_factory_name,context:n,instance:i})),i}}},n[e.__dashjs_factory_name]=i),i},getSingletonFactoryByName:function(e){return s(e,n)},updateSingletonFactory:function(e,t){a(e,t,n)},getClassFactory:function(e){let t=s(e.__dashjs_factory_name,i);return t||(t=function(t){return void 0===t&&(t={}),{create:function(){return o(e,t,arguments)}}},i[e.__dashjs_factory_name]=t),t},getClassFactoryByName:function(e){return s(e,i)},updateClassFactory:function(e,t){a(e,t,i)}},e}();t.a=i},function(e,t,n){"use strict";var i=n(5),r=n(0),s=n(3);function a(e){e=e||{};const t=this.context,n=Object(i.a)(t).getInstance(),s=e.settings,a=[];let o,l,u,c;function d(e){return e&&e.bind?e.bind(window.console):window.console.log.bind(window.console)}function h(...e){_(1,this,...e)}function f(...e){_(2,this,...e)}function p(...e){_(3,this,...e)}function g(...e){_(4,this,...e)}function m(...e){_(5,this,...e)}function _(e,t,...i){let o="",d=null;l&&(d=(new Date).getTime(),o+="["+(d-c)+"]"),u&&t&&t.getClassName&&(o+="["+t.getClassName()+"]",t.getType&&(o+="["+t.getType()+"]")),o.length>0&&(o+=" "),Array.apply(null,i).forEach((function(e){o+=e+" "})),a[e]&&s.get().debug.logLevel>=e&&a[e](o),s&&s.get().debug.dispatchEvent&&n.trigger(r.a.LOG,{message:o,level:e})}return o={getLogger:function(e){return{fatal:h.bind(e),error:f.bind(e),warn:p.bind(e),info:g.bind(e),debug:m.bind(e)}},setLogTimestampVisible:function(e){l=e},setCalleeNameVisible:function(e){u=e}},l=!0,u=!0,c=(new Date).getTime(),"undefined"!=typeof window&&window.console&&(a[1]=d(window.console.error),a[2]=d(window.console.error),a[3]=d(window.console.warn),a[4]=d(window.console.info),a[5]=d(window.console.debug)),o}a.__dashjs_factory_name="Debug";const o=s.a.getSingletonFactory(a);o.LOG_LEVEL_NONE=0,o.LOG_LEVEL_FATAL=1,o.LOG_LEVEL_ERROR=2,o.LOG_LEVEL_WARNING=3,o.LOG_LEVEL_INFO=4,o.LOG_LEVEL_DEBUG=5,s.a.updateSingletonFactory(a.__dashjs_factory_name,o),t.a=o},function(e,t,n){"use strict";var i=n(3),r=n(8);function s(){let e={};function t(t,n,i){let r=-1;return e[t]?(e[t].some((e,t)=>{if(e&&e.callback===n&&(!i||i===e.scope))return r=t,!0}),r):r}return{on:function(n,i,r,s={}){if(!n)throw new Error("event type cannot be null or undefined");if(!i||"function"!=typeof i)throw new Error("listener must be a function: "+i);let a=s.priority||0;if(t(n,i,r)>=0)return;e[n]=e[n]||[];const o={callback:i,scope:r,priority:a};r&&r.getStreamId&&(o.streamId=r.getStreamId()),r&&r.getType&&(o.mediaType=r.getType()),s&&s.mode&&(o.mode=s.mode),e[n].some((t,i)=>{if(t&&a>t.priority)return e[n].splice(i,0,o),!0})||e[n].push(o)},off:function(n,i,r){if(!n||!i||!e[n])return;const s=t(n,i,r);s<0||(e[n][s]=null)},trigger:function(t,n={},i={}){if(t&&e[t]){if((n=n||{}).hasOwnProperty("type"))throw new Error("'type' is a reserved word for event dispatching");n.type=t,i.streamId&&(n.streamId=i.streamId),i.mediaType&&(n.mediaType=i.mediaType),e[t].filter(e=>!!e&&((!i.streamId||!e.streamId||e.streamId===i.streamId)&&((!i.mediaType||!e.mediaType||e.mediaType===i.mediaType)&&!(i.mode&&e.mode&&e.mode!==i.mode||!e.mode&&i.mode&&i.mode===r.a.EVENT_MODE_ON_RECEIVE)))).forEach(e=>e&&e.callback.call(e.scope,n))}},reset:function(){e={}}}}s.__dashjs_factory_name="EventBus";const a=i.a.getSingletonFactory(s);a.EVENT_PRIORITY_LOW=0,a.EVENT_PRIORITY_HIGH=5e3,i.a.updateSingletonFactory(s.__dashjs_factory_name,a),t.a=a},function(e,t,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return r}));class i{constructor(){this.tcpid=null,this.type=null,this.url=null,this.actualurl=null,this.range=null,this.trequest=null,this.tresponse=null,this.responsecode=null,this.interval=null,this.trace=[],this._stream=null,this._tfinish=null,this._mediaduration=null,this._quality=null,this._responseHeaders=null,this._serviceLocation=null}}class r{constructor(){this.s=null,this.d=null,this.b=[]}}i.GET="GET",i.HEAD="HEAD",i.MPD_TYPE="MPD",i.XLINK_EXPANSION_TYPE="XLinkExpansion",i.INIT_SEGMENT_TYPE="InitializationSegment",i.INDEX_SEGMENT_TYPE="IndexSegment",i.MEDIA_SEGMENT_TYPE="MediaSegment",i.BITSTREAM_SWITCHING_SEGMENT_TYPE="BitstreamSwitchingSegment",i.MSS_FRAGMENT_INFO_SEGMENT_TYPE="FragmentInfoSegment",i.LICENSE="license",i.OTHER_TYPE="other"},function(e,t,n){"use strict";t.a=class{constructor(e,t,n){this.code=e||null,this.message=t||null,this.data=n||null}}},function(e,t,n){"use strict";var i=n(16);class r extends i.a{constructor(){super(),this.AST_IN_FUTURE="astInFuture",this.BUFFER_EMPTY="bufferStalled",this.BUFFER_LOADED="bufferLoaded",this.BUFFER_LEVEL_STATE_CHANGED="bufferStateChanged",this.DYNAMIC_TO_STATIC="dynamicToStatic",this.ERROR="error",this.FRAGMENT_LOADING_COMPLETED="fragmentLoadingCompleted",this.FRAGMENT_LOADING_PROGRESS="fragmentLoadingProgress",this.FRAGMENT_LOADING_STARTED="fragmentLoadingStarted",this.FRAGMENT_LOADING_ABANDONED="fragmentLoadingAbandoned",this.LOG="log",this.MANIFEST_LOADED="manifestLoaded",this.METRICS_CHANGED="metricsChanged",this.METRIC_CHANGED="metricChanged",this.METRIC_ADDED="metricAdded",this.METRIC_UPDATED="metricUpdated",this.PERIOD_SWITCH_COMPLETED="periodSwitchCompleted",this.PERIOD_SWITCH_STARTED="periodSwitchStarted",this.QUALITY_CHANGE_REQUESTED="qualityChangeRequested",this.QUALITY_CHANGE_RENDERED="qualityChangeRendered",this.TRACK_CHANGE_RENDERED="trackChangeRendered",this.SOURCE_INITIALIZED="sourceInitialized",this.STREAM_INITIALIZING="streamInitializing",this.STREAM_UPDATED="streamUpdated",this.STREAM_INITIALIZED="streamInitialized",this.STREAM_TEARDOWN_COMPLETE="streamTeardownComplete",this.TEXT_TRACKS_ADDED="allTextTracksAdded",this.TEXT_TRACK_ADDED="textTrackAdded",this.TTML_PARSED="ttmlParsed",this.TTML_TO_PARSE="ttmlToParse",this.CAPTION_RENDERED="captionRendered",this.CAPTION_CONTAINER_RESIZE="captionContainerResize",this.CAN_PLAY="canPlay",this.PLAYBACK_ENDED="playbackEnded",this.PLAYBACK_ERROR="playbackError",this.PLAYBACK_NOT_ALLOWED="playbackNotAllowed",this.PLAYBACK_METADATA_LOADED="playbackMetaDataLoaded",this.PLAYBACK_PAUSED="playbackPaused",this.PLAYBACK_PLAYING="playbackPlaying",this.PLAYBACK_PROGRESS="playbackProgress",this.PLAYBACK_RATE_CHANGED="playbackRateChanged",this.PLAYBACK_SEEKED="playbackSeeked",this.PLAYBACK_SEEKING="playbackSeeking",this.PLAYBACK_SEEK_ASKED="playbackSeekAsked",this.PLAYBACK_STALLED="playbackStalled",this.PLAYBACK_STARTED="playbackStarted",this.PLAYBACK_TIME_UPDATED="playbackTimeUpdated",this.PLAYBACK_WAITING="playbackWaiting",this.MANIFEST_VALIDITY_CHANGED="manifestValidityChanged",this.GAP_CAUSED_SEEK_TO_PERIOD_END="gapCausedSeekToPeriodEnd",this.GAP_CAUSED_INTERNAL_SEEK="gapCausedInternalSeek",this.EVENT_MODE_ON_START="eventModeOnStart",this.EVENT_MODE_ON_RECEIVE="eventModeOnReceive",this.CONFORMANCE_VIOLATION="conformanceViolation"}}let s=new r;t.a=s},function(e,t,n){"use strict";n.d(t,"e",(function(){return s})),n.d(t,"c",(function(){return a})),n.d(t,"d",(function(){return o})),n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return d}));var i=n(22);function r(e,t){for(;e.lengthi&&a=s){if(!i)return!1;if(t.segmentAvailabilityRange&&n.presentationStartTime>=t.segmentAvailabilityRange.end)return!1}return!0}function c(e,t,n,i){let r,s,a;r=n.segmentDuration,isNaN(r)&&(r=n.adaptation.period.duration),s=parseFloat((n.adaptation.period.start+i*r).toFixed(5)),a=parseFloat((s+r).toFixed(5));const o=l(n,r,s,e.calcMediaTimeFromPresentationTime(s,n),e.calcAvailabilityStartTimeFromPresentationTime(s,n.adaptation.period.mpd,t),e,a,t,i);return u(e,n,o,t)?o:null}function d(e,t,n,i,r,s,a,c,d,h){const f=i/s,p=Math.min(r/s,n.adaptation.period.mpd.maxSegmentDuration);let g,m,_;return g=e.calcPresentationTimeFromMediaTime(f,n),m=g+p,_=l(n,p,g,f,n.adaptation.period.mpd.manifest.loadedTime,e,m,t,d),u(e,n,_,t)?(_.replacementTime=h||i,a=o(a,"Number",_.replacementNumber),a=o(a,"Time",_.replacementTime),_.media=a,_.mediaRange=c,_):null}},function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return s}));var i=n(1);function r(e,t){if(typeof e!==t)throw i.a.BAD_ARGUMENT_ERROR}function s(e){if(!(null!==e&&!isNaN(e)&&e%1==0))throw i.a.BAD_ARGUMENT_ERROR+" : argument is not an integer"}},function(e,t,n){"use strict";var i=n(3);function r(){let e;const t=/^[a-z][a-z0-9+\-_.]*:/i,n=/^https?:\/\//i,i=/^https:\/\//i,r=/^([a-z][a-z0-9+\-_.]*:\/\/[^\/]+)\/?/i,s=(e,t)=>{try{return new window.URL(e,t).toString()}catch(t){return e}},a=(e,t)=>{let n=o;if(!t)return e;if(!c(e))return e;d(e)&&(n=l),h(e)&&(n=u);const i=n(t),r="/"!==i.charAt(i.length-1)&&"/"!==e.charAt(0)?"/":"";return[i,e].join(r)};function o(e){const t=e.indexOf("/"),n=e.lastIndexOf("/");return-1!==t?n===t+1?e:(-1!==e.indexOf("?")&&(e=e.substring(0,e.indexOf("?"))),e.substring(0,n+1)):""}function l(e){const t=e.match(r);return t?t[1]:""}function u(e){const n=e.match(t);return n?n[0]:""}function c(e){return!t.test(e)}function d(e){return c(e)&&"/"===e.charAt(0)}function h(e){return 0===e.indexOf("//")}!function(){try{new window.URL("x","http://y");e=s}catch(e){}finally{e=e||a}}();return{parseBaseUrl:o,parseOrigin:l,parseScheme:u,isRelative:c,isPathAbsolute:d,isSchemeRelative:h,isHTTPURL:function(e){return n.test(e)},isHTTPS:function(e){return i.test(e)},removeHostname:function(e){return/^(?:\w+\:\/\/)?([^\/]+)(.*)$/.exec(e)[2].substring(1)},resolve:function(t,n){return e(t,n)}}}r.__dashjs_factory_name="DefaultURLUtils";var s=i.a.getSingletonFactory(r);function a(){let e,t,n=[];const i=this.context;function r(e,i,r){let s=function(e){let i;for(i=0;i{e.key&&e.value&&n.searchParams.set(e.key,e.value)}),n.href}catch(t){return e}}static parseHttpHeaders(e){let t={};if(!e)return t;let n=e.trim().split("\r\n");for(let e=0,i=n.length;e0&&(t[i.substring(0,r)]=i.substring(r+2))}return t}static generateUuid(){let e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){const n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?n:3&n|8).toString(16)}))}static generateHashCode(e){let t=0;if(0===e.length)return t;for(let n=0;n0?e[e.length-1]:null}},e}o.__dashjs_factory_name="IsoFile";var l=a.a.getClassFactory(o),u=n(17),c=n.n(u);var d=class{constructor(e,t,n){this.lastCompletedOffset=e,this.found=t,this.size=n}};function h(){let e,t,n=this.context;function r(e){if(!e)return null;void 0===e.fileStart&&(e.fileStart=0);let t=c.a.parseBuffer(e),i=l(n).create();return i.setData(t),i}function s(e,t){return e[t+3]>>>0|e[t+2]<<8>>>0|e[t+1]<<16>>>0|e[t]<<24>>>0}function a(e,t){return String.fromCharCode(e[t++])+String.fromCharCode(e[t++])+String.fromCharCode(e[t++])+String.fromCharCode(e[t])}return t={parse:r,findLastTopIsoBoxCompleted:function(e,t,n){if(void 0===n&&(n=0),!t||n+8>=t.byteLength)return new d(0,!1);const i=t instanceof ArrayBuffer?new Uint8Array(t):t;let r,o=0;for(;n=0?r=new d(n,!0,t):o=n+t),n+=t}return r||new d(o,!1)},getMediaTimescaleFromMoov:function(e){let t=r(e),n=t?t.getBox("mdhd"):void 0;return n?n.timescale:NaN},getSamplesInfo:function(e){if(!e||0===e.byteLength)return{sampleList:[],lastSequenceNumber:NaN,totalDuration:NaN,numSequences:NaN};let t,n,i,s,a,o,l,u,c,d,h,f,p,g,m,_,E,y=r(e),T=y.getBoxes("moof"),S=y.getBoxes("mfhd");_=y.getBoxes("moof").length,m=S[S.length-1].sequence_number,i=0,o=[];let b=-1,A=-1;for(h=0;hA&&(b++,A+=e.entries[b].sample_delta),u==A){i.subSizes=[];let t=e.entries[b];for(p=0;p=t.byteLength)return new d(0,!1);const i=t instanceof ArrayBuffer?new Uint8Array(t):t;let r,o=0;for(;n=0?r=new d(n,!0,t,l):o=n+t),n+=t}return r||new d(o,!1)}},e=Object(i.a)(n).getInstance().getLogger(t),t}h.__dashjs_factory_name="BoxParser";t.a=a.a.getSingletonFactory(h)},function(e,t,n){"use strict";t.a=class{extend(e,t){if(!e)return;let n=!!t&&t.override,i=!!t&&t.publicOnly;for(const t in e)!e.hasOwnProperty(t)||this[t]&&!n||i&&-1===e[t].indexOf("public_")||(this[t]=e[t])}}},function(e,t,n){ /*! codem-isoboxer v0.3.6 https://github.com/madebyhiro/codem-isoboxer/blob/master/LICENSE.txt */ var i={parseBuffer:function(e){return new r(e).parse()},addBoxProcessor:function(e,t){"string"==typeof e&&"function"==typeof t&&(s.prototype._boxProcessors[e]=t)},createFile:function(){return new r},createBox:function(e,t,n){var i=s.create(e);return t&&t.append(i,n),i},createFullBox:function(e,t,n){var r=i.createBox(e,t,n);return r.version=0,r.flags=0,r},Utils:{}};i.Utils.dataViewToString=function(e,t){var n=t||"utf-8";if("undefined"!=typeof TextDecoder)return new TextDecoder(n).decode(e);var i=[],r=0;if("utf-8"===n)for(;r>6),t.push(128|63&i)):i<65536?(t.push(224|i>>12),t.push(128|63&i>>6),t.push(128|63&i)):(t.push(240|i>>18),t.push(128|63&i>>12),t.push(128|63&i>>6),t.push(128|63&i))}return t},i.Utils.appendBox=function(e,t,n){if(t._offset=e._cursor.offset,t._root=e._root?e._root:e,t._raw=e._raw,t._parent=e,-1!==n)if(null!=n){var i,r=-1;if("number"==typeof n)r=n;else{if("string"==typeof n)i=n;else{if("object"!=typeof n||!n.type)return void e.boxes.push(t);i=n.type}for(var s=0;s>3,t},s.prototype._readUint=function(e){var t,n,i=null,r=this._cursor.offset-this._raw.byteOffset;switch(e){case 8:i=this._raw.getUint8(r);break;case 16:i=this._raw.getUint16(r);break;case 24:i=((t=this._raw.getUint16(r))<<8)+(n=this._raw.getUint8(r+2));break;case 32:i=this._raw.getUint32(r);break;case 64:t=this._raw.getUint32(r),n=this._raw.getUint32(r+4),i=t*Math.pow(2,32)+n}return this._cursor.offset+=e>>3,i},s.prototype._readString=function(e){for(var t="",n=0;n0?e:this._raw.byteLength-(this._cursor.offset-this._offset);if(t>0){var n=new Uint8Array(this._raw.buffer,this._cursor.offset,t);return this._cursor.offset+=t,n}return null},s.prototype._readUTF8String=function(){var e=this._raw.byteLength-(this._cursor.offset-this._offset),t=null;return e>0&&(t=new DataView(this._raw.buffer,this._cursor.offset,e),this._cursor.offset+=e),t?i.Utils.dataViewToString(t):t},s.prototype._parseBox=function(){if(this._parsing=!0,this._cursor.offset=this._offset,this._offset+8>this._raw.buffer.byteLength)this._root._incomplete=!0;else{switch(this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this.size){case 0:this._raw=new DataView(this._raw.buffer,this._offset,this._raw.byteLength-this._cursor.offset+8);break;case 1:this._offset+this.size>this._raw.buffer.byteLength?(this._incomplete=!0,this._root._incomplete=!0):this._raw=new DataView(this._raw.buffer,this._offset,this.largesize);break;default:this._offset+this.size>this._raw.buffer.byteLength?(this._incomplete=!0,this._root._incomplete=!0):this._raw=new DataView(this._raw.buffer,this._offset,this.size)}this._incomplete||(this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type)?this._parseContainerBox():this._data=this._readData())}},s.prototype._parseFullBox=function(){this.version=this._readUint(8),this.flags=this._readUint(24)},s.prototype._parseContainerBox=function(){for(this.boxes=[];this._cursor.offset-this._raw.byteOffset>3}else this.size+=e>>3},s.prototype._writeUint=function(e,t){if(this._rawo){var n,i,r=this._cursor.offset-this._rawo.byteOffset;switch(e){case 8:this._rawo.setUint8(r,t);break;case 16:this._rawo.setUint16(r,t);break;case 24:n=(16776960&t)>>8,i=255&t,this._rawo.setUint16(r,n),this._rawo.setUint8(r+2,i);break;case 32:this._rawo.setUint32(r,t);break;case 64:i=t-(n=Math.floor(t/Math.pow(2,32)))*Math.pow(2,32),this._rawo.setUint32(r,n),this._rawo.setUint32(r+4,i)}this._cursor.offset+=e>>3}else this.size+=e>>3},s.prototype._writeString=function(e,t){for(var n=0;n>10&31),96+(this.language>>5&31),96+(31&this.language))),this._procField("pre_defined","uint",16)},s.prototype._boxProcessors.mehd=function(){this._procFullBox(),this._procField("fragment_duration","uint",1==this.version?64:32)},s.prototype._boxProcessors.mfhd=function(){this._procFullBox(),this._procField("sequence_number","uint",32)},s.prototype._boxProcessors.mfro=function(){this._procFullBox(),this._procField("mfra_size","uint",32)},s.prototype._boxProcessors.mp4a=s.prototype._boxProcessors.enca=function(){this._procFieldArray("reserved1",6,"uint",8),this._procField("data_reference_index","uint",16),this._procFieldArray("reserved2",2,"uint",32),this._procField("channelcount","uint",16),this._procField("samplesize","uint",16),this._procField("pre_defined","uint",16),this._procField("reserved3","uint",16),this._procField("samplerate","template",32),this._procField("esds","data",-1)},s.prototype._boxProcessors.mvhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("timescale","uint",32),this._procField("duration","uint",1==this.version?64:32),this._procField("rate","template",32),this._procField("volume","template",16),this._procField("reserved1","uint",16),this._procFieldArray("reserved2",2,"uint",32),this._procFieldArray("matrix",9,"template",32),this._procFieldArray("pre_defined",6,"uint",32),this._procField("next_track_ID","uint",32)},s.prototype._boxProcessors.payl=function(){this._procField("cue_text","utf8")},s.prototype._boxProcessors.pssh=function(){this._procFullBox(),this._procFieldArray("SystemID",16,"uint",8),this._procField("DataSize","uint",32),this._procFieldArray("Data",this.DataSize,"uint",8)},s.prototype._boxProcessors.schm=function(){this._procFullBox(),this._procField("scheme_type","uint",32),this._procField("scheme_version","uint",32),1&this.flags&&this._procField("scheme_uri","string",-1)},s.prototype._boxProcessors.sdtp=function(){this._procFullBox();var e=-1;this._parsing&&(e=this._raw.byteLength-(this._cursor.offset-this._raw.byteOffset)),this._procFieldArray("sample_dependency_table",e,"uint",8)},s.prototype._boxProcessors.sidx=function(){this._procFullBox(),this._procField("reference_ID","uint",32),this._procField("timescale","uint",32),this._procField("earliest_presentation_time","uint",1==this.version?64:32),this._procField("first_offset","uint",1==this.version?64:32),this._procField("reserved","uint",16),this._procField("reference_count","uint",16),this._procEntries("references",this.reference_count,(function(e){this._parsing||(e.reference=(1&e.reference_type)<<31,e.reference|=2147483647&e.referenced_size,e.sap=(1&e.starts_with_SAP)<<31,e.sap|=(3&e.SAP_type)<<28,e.sap|=268435455&e.SAP_delta_time),this._procEntryField(e,"reference","uint",32),this._procEntryField(e,"subsegment_duration","uint",32),this._procEntryField(e,"sap","uint",32),this._parsing&&(e.reference_type=e.reference>>31&1,e.referenced_size=2147483647&e.reference,e.starts_with_SAP=e.sap>>31&1,e.SAP_type=e.sap>>28&7,e.SAP_delta_time=268435455&e.sap)}))},s.prototype._boxProcessors.smhd=function(){this._procFullBox(),this._procField("balance","uint",16),this._procField("reserved","uint",16)},s.prototype._boxProcessors.ssix=function(){this._procFullBox(),this._procField("subsegment_count","uint",32),this._procEntries("subsegments",this.subsegment_count,(function(e){this._procEntryField(e,"ranges_count","uint",32),this._procSubEntries(e,"ranges",e.ranges_count,(function(e){this._procEntryField(e,"level","uint",8),this._procEntryField(e,"range_size","uint",24)}))}))},s.prototype._boxProcessors.stsd=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procSubBoxes("entries",this.entry_count)},s.prototype._boxProcessors.subs=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,(function(e){this._procEntryField(e,"sample_delta","uint",32),this._procEntryField(e,"subsample_count","uint",16),this._procSubEntries(e,"subsamples",e.subsample_count,(function(e){this._procEntryField(e,"subsample_size","uint",1===this.version?32:16),this._procEntryField(e,"subsample_priority","uint",8),this._procEntryField(e,"discardable","uint",8),this._procEntryField(e,"codec_specific_parameters","uint",32)}))}))},s.prototype._boxProcessors.tenc=function(){this._procFullBox(),this._procField("default_IsEncrypted","uint",24),this._procField("default_IV_size","uint",8),this._procFieldArray("default_KID",16,"uint",8)},s.prototype._boxProcessors.tfdt=function(){this._procFullBox(),this._procField("baseMediaDecodeTime","uint",1==this.version?64:32)},s.prototype._boxProcessors.tfhd=function(){this._procFullBox(),this._procField("track_ID","uint",32),1&this.flags&&this._procField("base_data_offset","uint",64),2&this.flags&&this._procField("sample_description_offset","uint",32),8&this.flags&&this._procField("default_sample_duration","uint",32),16&this.flags&&this._procField("default_sample_size","uint",32),32&this.flags&&this._procField("default_sample_flags","uint",32)},s.prototype._boxProcessors.tfra=function(){this._procFullBox(),this._procField("track_ID","uint",32),this._parsing||(this.reserved=0,this.reserved|=(48&this.length_size_of_traf_num)<<4,this.reserved|=(12&this.length_size_of_trun_num)<<2,this.reserved|=3&this.length_size_of_sample_num),this._procField("reserved","uint",32),this._parsing&&(this.length_size_of_traf_num=(48&this.reserved)>>4,this.length_size_of_trun_num=(12&this.reserved)>>2,this.length_size_of_sample_num=3&this.reserved),this._procField("number_of_entry","uint",32),this._procEntries("entries",this.number_of_entry,(function(e){this._procEntryField(e,"time","uint",1===this.version?64:32),this._procEntryField(e,"moof_offset","uint",1===this.version?64:32),this._procEntryField(e,"traf_number","uint",8*(this.length_size_of_traf_num+1)),this._procEntryField(e,"trun_number","uint",8*(this.length_size_of_trun_num+1)),this._procEntryField(e,"sample_number","uint",8*(this.length_size_of_sample_num+1))}))},s.prototype._boxProcessors.tkhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("track_ID","uint",32),this._procField("reserved1","uint",32),this._procField("duration","uint",1==this.version?64:32),this._procFieldArray("reserved2",2,"uint",32),this._procField("layer","uint",16),this._procField("alternate_group","uint",16),this._procField("volume","template",16),this._procField("reserved3","uint",16),this._procFieldArray("matrix",9,"template",32),this._procField("width","template",32),this._procField("height","template",32)},s.prototype._boxProcessors.trex=function(){this._procFullBox(),this._procField("track_ID","uint",32),this._procField("default_sample_description_index","uint",32),this._procField("default_sample_duration","uint",32),this._procField("default_sample_size","uint",32),this._procField("default_sample_flags","uint",32)},s.prototype._boxProcessors.trun=function(){this._procFullBox(),this._procField("sample_count","uint",32),1&this.flags&&this._procField("data_offset","int",32),4&this.flags&&this._procField("first_sample_flags","uint",32),this._procEntries("samples",this.sample_count,(function(e){256&this.flags&&this._procEntryField(e,"sample_duration","uint",32),512&this.flags&&this._procEntryField(e,"sample_size","uint",32),1024&this.flags&&this._procEntryField(e,"sample_flags","uint",32),2048&this.flags&&this._procEntryField(e,"sample_composition_time_offset",1===this.version?"int":"uint",32)}))},s.prototype._boxProcessors["url "]=s.prototype._boxProcessors["urn "]=function(){this._procFullBox(),"urn "===this.type&&this._procField("name","string",-1),this._procField("location","string",-1)},s.prototype._boxProcessors.vlab=function(){this._procField("source_label","utf8")},s.prototype._boxProcessors.vmhd=function(){this._procFullBox(),this._procField("graphicsmode","uint",16),this._procFieldArray("opcolor",3,"uint",16)},s.prototype._boxProcessors.vttC=function(){this._procField("config","utf8")},s.prototype._boxProcessors.vtte=function(){}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var i=n(34),r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=d;var s=Object.create(n(27));s.inherits=n(20);var a=n(48),o=n(44);s.inherits(d,a);for(var l=r(o.prototype),u=0;uSorry! Your browser does not support watching this hologram.

\n

Plaase try using the latest version of Chrome, Firefox or Safari!

\n ",t.appendChild(n)},scriptPath:i,interfacePath:"https://player.8i.com/interface/1.4",userAgentIs:r}},function(e,t,n){"use strict";t.a=class{constructor(){this.indexRange=null,this.index=null,this.mediaRange=null,this.media=null,this.duration=NaN,this.replacementTime=null,this.replacementNumber=NaN,this.mediaStartTime=NaN,this.presentationStartTime=NaN,this.availabilityStartTime=NaN,this.availabilityEndTime=NaN,this.availabilityIdx=NaN,this.wallStartTime=NaN,this.representation=null}}},function(e,t,n){"use strict";var i=n(3);function r(e){const t=(e=e||{}).requestModifier;let n;return n={load:function(e){const n=new Date,i=e.request;let r=new XMLHttpRequest;if(r.open(e.method,e.url,!0),i.responseType&&(r.responseType=i.responseType),i.range&&r.setRequestHeader("Range","bytes="+i.range),i.requestStartDate||(i.requestStartDate=n),t&&(r=t.modifyRequestHeader(r)),e.headers)for(let t in e.headers){let n=e.headers[t];n&&r.setRequestHeader(t,n)}r.withCredentials=e.withCredentials,r.onload=e.onload,r.onloadend=e.onend,r.onerror=e.onerror,r.onprogress=e.progress,r.onabort=e.onabort,r.ontimeout=e.ontimeout,r.timeout=e.timeout,r.send(),e.response=r},abort:function(e){const t=e.response;t.onloadend=t.onerror=t.onprogress=void 0,t.abort()}},n}r.__dashjs_factory_name="XHRLoader";const s=i.a.getClassFactory(r);t.a=s},function(e,t,n){"use strict";n.d(t,"b",(function(){return a}));var i=n(3),r=n(25);const s=[{codec:"avc1",compatibleCodecs:["avc3"]},{codec:"avc3",compatibleCodecs:["avc1"]}];function a(){let e="WebKitMediaSource"in window,t="MediaSource"in window;return e||t}function o(){let e,t;return e={supportsMediaSource:a,supportsEncryptedMedia:function(){return t},supportsCodec:function(e){return!(!("MediaSource"in window)||!MediaSource.isTypeSupported(e))||!(!("WebKitMediaSource"in window)||!WebKitMediaSource.isTypeSupported(e))},setEncryptedMediaSupported:function(e){t=e},supportsEssentialProperty:function(e){try{return-1!==r.a.indexOf(e.schemeIdUri)}catch(e){return!0}},codecRootCompatibleWithCodec:function(e,t){const n=e.split(".")[0],i=0===t.indexOf(n);let r;for(let e=0;e0===t.indexOf(e)):i}},t=!1,e}o.__dashjs_factory_name="Capabilities",t.a=i.a.getSingletonFactory(o)},function(e,t,n){"use strict";n.d(t,"a",(function(){return f}));var i=n(1),r=n(2),s=n(3);var a=class{constructor(){this.bitrate=0,this.width=0,this.height=0,this.tilesHor=0,this.tilesVert=0,this.widthPerTile=0,this.heightPerTile=0,this.startNumber=0,this.segmentDuration=0,this.timescale=0,this.templateUrl="",this.id=""}},o=n(11),l=n(9),u=n(0),c=n(15),d=n(23),h=n(38);const f=["http://dashif.org/thumbnail_tile","http://dashif.org/guidelines/thumbnail_tile"];function p(e){const t=this.context,n=e.adapter,s=e.baseURLController,p=e.streamInfo,g=e.timelineConverter,m=e.debug,_=e.eventBus,E=e.events,y=e.dashConstants,T=Object(o.a)(t).getInstance();let S,b,A,v,I,R,w;function C(){N(),R=Object(d.a)(t).create({}),w=Object(c.a)(t).getInstance(),A=Object(h.a)(t).create({streamInfo:p,timelineConverter:g,baseURLController:s,debug:m,eventBus:_,events:E,dashConstants:y,urlUtils:T}),A.initialize(!!n&&n.getIsDynamic()),function(){if(!p||!n)return;if(I=n.getMediaInfoForType(p,i.a.IMAGE),!I)return;const e=n.getVoRepresentations(I);e&&e.length>0&&e.forEach(e=>{(e.segmentInfoType===r.a.SEGMENT_TEMPLATE&&e.segmentDuration>0&&e.media||e.segmentInfoType===r.a.SEGMENT_TIMELINE)&&D(e),e.segmentInfoType===r.a.SEGMENT_BASE&&D(e,!0)});b.length>0&&(b.sort((e,t)=>e.bitrate-t.bitrate),v=b.length-1)}()}function D(e,t){const r=new a;r.id=e.id,r.bitrate=e.bandwidth,r.width=e.width,r.height=e.height,r.tilesHor=1,r.tilesVert=1,e.essentialProperties&&e.essentialProperties.forEach(e=>{if(f.indexOf(e.schemeIdUri)>=0&&e.value){const t=e.value.split("x");2!==t.length||isNaN(t[0])||isNaN(t[1])||(r.tilesHor=parseInt(t[0],10),r.tilesVert=parseInt(t[1],10))}}),t?_.trigger(u.a.SEGMENTBASE_SEGMENTSLIST_REQUEST_NEEDED,{streamId:p.id,mediaType:i.a.IMAGE,mimeType:I.mimeType,representation:e,callback:function(e,t,i,a){let o=[];i=function(e,t){const i=[];let r,s,a,o,u=0;for(r=0,s=e.length;r{if(t.start<=e&&t.end>e)return n=t.url,!0}),n?t(n):i.some(n=>{if(n.mediaStartTime<=e&&n.mediaStartTime+n.duration>e){const e=s.resolve(a.path);return R.load({method:"get",url:e.url,request:{range:n.mediaRange,responseType:"arraybuffer"},onload:function(e){let i=w.getSamplesInfo(e.target.response),r=new Blob([e.target.response.slice(i.sampleList[0].offset,i.sampleList[0].offset+i.sampleList[0].size)],{type:"image/jpeg"}),s=window.URL.createObjectURL(r);o.push({start:n.mediaStartTime,end:n.mediaStartTime+n.duration,url:s}),t&&t(s)}}),!0}})}}}):(r.startNumber=e.startNumber,r.segmentDuration=e.segmentDuration,r.timescale=e.timescale,r.templateUrl=function(e){const t=T.isRelative(e.media)?T.resolve(e.media,s.resolve(e.path).url):e.media;if(!t)return"";return Object(l.c)(t,e.id)}(e)),r.tilesHor>0&&r.tilesVert>0&&(r.widthPerTile=r.width/r.tilesHor,r.heightPerTile=r.height/r.tilesVert,b.push(r))}function N(){b=[],v=-1,I=null}return S={initialize:C,getTracks:function(){return b},reset:N,setTrackByIndex:function(e){b&&0!==b.length&&(e>=b.length&&(e=b.length-1),v=e)},getCurrentTrack:function(){return v<0?null:b[v]},getCurrentTrackIndex:function(){return v},getThumbnailRequestForTime:function(e){let t;const i=n.getVoRepresentations(I);for(let e=0;e=n&&console.log(this.time+" ["+e+"] "+t)}},u=function(e){for(var t=[],n=0;n32&&(l.log("ERROR","Too large cursor position "+this.pos),this.pos=32)},moveCursor:function(e){var t=this.pos+e;if(e>1)for(var n=this.pos+1;n=144&&this.backSpace();var t=n(e);this.pos>=32?l.log("ERROR","Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))},clearFromPos:function(e){var t;for(t=e;t<32;t++)this.chars[t].reset()},clear:function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},clearToEndOfRow:function(){this.clearFromPos(this.pos)},getTextString:function(){for(var e=[],t=!0,n=0;n<32;n++){var i=this.chars[n].uchar;" "!==i&&(t=!1),e.push(i)}return t?"":e.join("")},setPenStyles:function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}};var f=function(){this.rows=[];for(var e=0;e<15;e++)this.rows.push(new h);this.currRow=14,this.nrRollUpRows=null,this.reset()};f.prototype={reset:function(){for(var e=0;e<15;e++)this.rows[e].clear();this.currRow=14},equals:function(e){for(var t=!0,n=0;n<15;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t},copy:function(e){for(var t=0;t<15;t++)this.rows[t].copy(e.rows[t])},isEmpty:function(){for(var e=!0,t=0;t<15;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e},backSpace:function(){this.rows[this.currRow].backSpace()},clearToEndOfRow:function(){this.rows[this.currRow].clearToEndOfRow()},insertChar:function(e){this.rows[this.currRow].insertChar(e)},setPen:function(e){this.rows[this.currRow].setPenStyles(e)},moveCursor:function(e){this.rows[this.currRow].moveCursor(e)},setCursor:function(e){l.log("INFO","setCursor: "+e),this.rows[this.currRow].setCursor(e)},setPAC:function(e){l.log("INFO","pacData = "+JSON.stringify(e));var t=e.row-1;this.nrRollUpRows&&t0&&(n=e?"["+t.join(" | ")+"]":t.join("\n")),n},getTextAndFormat:function(){return this.rows}};var p=function(e,t){this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new f,this.nonDisplayedMemory=new f,this.lastOutputScreen=new f,this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null};p.prototype={modes:["MODE_ROLL-UP","MODE_POP-ON","MODE_PAINT-ON","MODE_TEXT"],reset:function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.lastCueEndTime=null},getHandler:function(){return this.outputFilter},setHandler:function(e){this.outputFilter=e},setPAC:function(e){this.writeScreen.setPAC(e)},setBkgData:function(e){this.writeScreen.setBkgData(e)},setMode:function(e){e!==this.mode&&(this.mode=e,l.log("INFO","MODE="+e),"MODE_POP-ON"==this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)},insertChars:function(e){for(var t=0;t=46,t.italics)t.foreground="white";else{var n=Math.floor(e/2)-16;t.foreground=["white","green","blue","cyan","red","yellow","magenta"][n]}l.log("INFO","MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},outputDataUpdate:function(){var e=l.time;null!==e&&this.outputFilter&&(this.outputFilter.updateData&&this.outputFilter.updateData(e,this.displayedMemory),null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen),this.cueStartTime=this.displayedMemory.isEmpty()?null:e):this.cueStartTime=e,this.lastOutputScreen.copy(this.displayedMemory))},cueSplitAtTime:function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}};var g=function(e,t,n){this.field=e||1,this.outputs=[t,n],this.channels=[new p(1,t),new p(2,n)],this.currChNr=-1,this.lastCmdA=null,this.lastCmdB=null,this.bufferedData=[],this.startTime=null,this.lastTime=null,this.dataCounters={padding:0,char:0,cmd:0,other:0}};g.prototype={getHandler:function(e){return this.channels[e].getHandler()},setHandler:function(e,t){this.channels[e].setHandler(t)},addData:function(e,t){var n,i,r,s=!1;this.lastTime=e,l.setTime(e);for(var a=0;a=16&&i<=31&&i===this.lastCmdA&&r===this.lastCmdB)this.lastCmdA=null,this.lastCmdB=null,l.log("DEBUG","Repeated command ("+u([i,r])+") is dropped");else if(0!==i||0!==r){if(l.log("DATA","["+u([t[a],t[a+1]])+"] -> ("+u([i,r])+")"),(n=this.parseCmd(i,r))||(n=this.parseMidrow(i,r)),n||(n=this.parsePAC(i,r)),n||(n=this.parseBackgroundAttributes(i,r)),!n)if(s=this.parseChars(i,r))if(this.currChNr&&this.currChNr>=0)this.channels[this.currChNr-1].insertChars(s);else l.log("WARNING","No channel found yet. TEXT-MODE?");n?this.dataCounters.cmd+=2:s?this.dataCounters.char+=2:(this.dataCounters.other+=2,l.log("WARNING","Couldn't parse cleaned data "+u([i,r])+" orig: "+u([t[a],t[a+1]])))}else this.dataCounters.padding+=2},parseCmd:function(e,t){var n=null;if(!((20===e||21===e||28===e||29===e)&&32<=t&&t<=47)&&!((23===e||31===e)&&33<=t&&t<=35))return!1;n=20===e||21===e||23===e?1:2;var i=this.channels[n-1];return 20===e||21===e||28===e||29===e?32===t?i.cc_RCL():33===t?i.cc_BS():34===t?i.cc_AOF():35===t?i.cc_AON():36===t?i.cc_DER():37===t?i.cc_RU(2):38===t?i.cc_RU(3):39===t?i.cc_RU(4):40===t?i.cc_FON():41===t?i.cc_RDC():42===t?i.cc_TR():43===t?i.cc_RTD():44===t?i.cc_EDM():45===t?i.cc_CR():46===t?i.cc_ENM():47===t&&i.cc_EOC():i.cc_TO(t-32),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=n,!0},parseMidrow:function(e,t){var n=null;if((17===e||25===e)&&32<=t&&t<=47){if((n=17===e?1:2)!==this.currChNr)return l.log("ERROR","Mismatch channel in midrow parsing"),!1;var i=this.channels[n-1];return i.insertChars([32]),i.cc_MIDROW(t),l.log("DEBUG","MIDROW ("+u([e,t])+")"),this.lastCmdA=e,this.lastCmdB=t,!0}return!1},parsePAC:function(e,t){var n,o=null;if(!((17<=e&&e<=23||25<=e&&e<=31)&&64<=t&&t<=127)&&!((16===e||24===e)&&64<=t&&t<=95))return!1;n=e<=23?1:2,o=64<=t&&t<=95?1===n?i[e]:s[e]:1===n?r[e]:a[e];var l=this.interpretPAC(o,t);return this.channels[n-1].setPAC(l),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=n,!0},interpretPAC:function(e,t){var n=t,i={color:null,italics:!1,indent:null,underline:!1,row:e};return n=t>95?t-96:t-64,i.underline=1==(1&n),n<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(i.italics=!0,i.color="white"):i.indent=4*Math.floor((n-16)/2),i},parseChars:function(e,t){var i=null,r=null,s=null;if(e>=25?(i=2,s=e-8):(i=1,s=e),17<=s&&s<=19){var a=t;a=17===s?t+80:18===s?t+112:t+144,l.log("INFO","Special char '"+n(a)+"' in channel "+i),r=[a],this.lastCmdA=e,this.lastCmdB=t}else 32<=e&&e<=127&&(r=0===t?[e]:[e,t],this.lastCmdA=null,this.lastCmdB=null);if(r){var o=u(r);l.log("DEBUG","Char codes = "+o.join(","))}return r},parseBackgroundAttributes:function(e,t){var n,i,r;return((16===e||24===e)&&32<=t&&t<=47||(23===e||31===e)&&45<=t&&t<=47)&&(n={},16===e||24===e?(i=Math.floor((t-32)/2),n.background=o[i],t%2==1&&(n.background=n.background+"_semi")):45===t?n.background="transparent":(n.foreground="black",47===t&&(n.underline=!0)),r=e<24?1:2,this.channels[r-1].setBkgData(n),this.lastCmdA=e,this.lastCmdB=t,!0)},reset:function(){for(var e=0;et&&(e-=t)}return e}function z(){return E&&h?h.getPlaybackRate():null}function H(){return E&&h?h.getEnded():null}function Y(){return y}function q(){if(!y||isNaN(A))return NaN;let e=G();if(isNaN(e)||0===e)return 0;const t=(new Date).getTime()+1e3*f.getClientTimeOffset();return Math.max(((t-A-1e3*e)/1e3).toFixed(3),0)}function j(){S=!1,p=!1,g=NaN,_=0,A=0,v=NaN,h&&(t.off(u.a.STREAM_INITIALIZED,M,this),t.off(u.a.DATA_UPDATE_COMPLETED,Q,this),t.off(u.a.BUFFER_LEVEL_STATE_CHANGED,_e,this),t.off(u.a.LOADING_PROGRESS,me,this),t.off(u.a.PLAYBACK_PROGRESS,de,this),t.off(u.a.PLAYBACK_TIME_UPDATED,de,this),t.off(u.a.PLAYBACK_ENDED,ue,this),t.off(u.a.STREAM_INITIALIZING,ye,this),W(),h.removeEventListener("canplay",$),h.removeEventListener("play",Z),h.removeEventListener("waiting",J),h.removeEventListener("playing",ee),h.removeEventListener("pause",te),h.removeEventListener("error",ce),h.removeEventListener("seeking",ne),h.removeEventListener("seeked",ie),h.removeEventListener("timeupdate",re),h.removeEventListener("progress",se),h.removeEventListener("ratechange",ae),h.removeEventListener("loadedmetadata",oe),h.removeEventListener("stalled",Ee),h.removeEventListener("ended",le)),m=null,h=null,E=null,y=null}function V(e){const t=D.getURIFragmentData();if(!t||!t.t)return NaN;const n=r.getStreams()[0].getStreamInfo().start;t.t=t.t.split(",")[0];const i=-1!==t.t.indexOf("posix:")?"now"===t.t.substring(6)?Date.now()/1e3:parseInt(t.t.substring(6)):NaN;return e&&!isNaN(i)?i-A/1e3:parseInt(t.t)+n}function K(){if(null!==m)return;m=setInterval((function(){t.trigger(u.a.WALLCLOCK_TIME_UPDATED,{isDynamic:y,time:new Date}),Y()&&P()&&function(){const e=Date.now();(!b||e>b+500)&&(b=e,re())}()}),N.get().streaming.wallclockTimeUpdateInterval)}function W(){clearInterval(m),m=null}function X(e){if(P()||!y||0===h.getReadyState())return;const t=G(),n=function(e,t){const n=a.getCurrentDVRInfo(t),r=n?n.range:null;let s;return r?(i.debug(`Checking DVR window for at ${e} with DVR window range ${r.start} - ${r.end}`),s=e>r.end?Math.max(r.end-_,r.start):e>0&&e+.250&&!P()&&!F()&&(function(){try{if(he()&&N.get().streaming.liveCatchup.playbackRate>0&&k()>0){const e=pe(),t=q(),n=T.getLiveDelay(),i=T.getLiveCatchupLatencyThreshold(),r=N.get().streaming.liveCatchup.minDrift;if(e===s.a.LIVE_CATCHUP_MODE_LOLP){const e=fe(),s=N.get().streaming.liveCatchup.playbackBufferMin;return function(e,t,n,i,r,s){try{const a=Math.abs(e-t);return(isNaN(s)||e<=s)&&(a>n||ii&&(isNaN(n)||e<=n)}catch(e){return!1}}(t,n,i,r)}}catch(e){return!1}}()?function(){if(h){let e;const t=h.getPlaybackRate(),n=N.get().streaming.liveCatchup.playbackRate,r=q(),o=T.getLiveDelay(),l=fe();if(pe()===s.a.LIVE_CATCHUP_MODE_LOLP){N.get().streaming.liveCatchup.minDrift;const s=N.get().streaming.liveCatchup.playbackBufferMin;e=function(e,t,n,r,s,a,o){const l=e;let u;if(an/2&&(w=!1);Math.abs(o-u)<=C&&(u=null);return{newRate:u}}(n,r,o,0,s,l,t)}else e=function(e,t,n,i,r){const s=e,a=t-n,o=5*a,l=2*s/(1+Math.pow(Math.E,-o));let u=1-s+l;w&&(i>n/2?w=!1:a>0&&(u=1));Math.abs(r-u)<=C&&(u=null);return{newRate:u}}(n,r,o,l,t);let u=e.newRate;u&&h.setPlaybackRate(u);const c=r-o;N.get().streaming.liveCatchup.maxDrift>0&&!R&&c>N.get().streaming.liveCatchup.maxDrift?(i.info("Low Latency catchup mechanism. Latency too high, doing a seek to live point"),R=!0,function(){const e=a.getCurrentDVRInfo();B((e?e.range:null).end-T.getLiveDelay(),!0,!1)}()):R=!1}}():ge())}function he(){return N.get().streaming.liveCatchup.enabled||N.get().streaming.lowLatencyEnabled}function fe(){let e=null;return r.getActiveStreamProcessors().forEach(t=>{const n=t.getBufferLevel();e=null===e?n:Math.min(e,n)}),e}function pe(){const e=N.get().streaming.liveCatchup.playbackBufferMin;return N.get().streaming.liveCatchup.mode!==s.a.LIVE_CATCHUP_MODE_LOLP||null===e||isNaN(e)?s.a.LIVE_CATCHUP_MODE_DEFAULT:s.a.LIVE_CATCHUP_MODE_LOLP}function ge(){h&&h.setPlaybackRate(1)}function me(e){if(!1===e.stream&&N.get().streaming.lowLatencyEnabled&&!isNaN(e.request.duration)){const t=1.2*e.request.duration;if(t>T.getLiveDelay()){i.warn("Browser does not support fetch API with StreamReader. Increasing live delay to be 20% higher than segment duration:",t.toFixed(2));const e={streaming:{liveDelay:t}};N.update(e)}}}function _e(e){e.streamId===E.id&&(he()?e.state!==o.BUFFER_EMPTY||F()||w||(w=!0,ge()):h.setStallState(e.mediaType,e.state===o.BUFFER_EMPTY))}function Ee(e){t.trigger(u.a.PLAYBACK_STALLED,{e:e})}function ye(e){!function(e,t){if(e&&e.manifestInfo&&e.manifestInfo.serviceDescriptions){let n;for(let t=0;t0&&(i.debug("Apply LL properties coming from service description. Target Latency (ms):",n.latency.target),N.update({streaming:{lowLatencyEnabled:!0,liveDelay:n.latency.target/1e3,liveCatchup:{minDrift:n.latency.max>n.latency.target?(n.latency.max-n.latency.target)/1e3:void 0}}})),n.playbackRate&&n.playbackRate.max>1&&(i.debug("Apply LL properties coming from service description. Max PlaybackRate:",n.playbackRate.max),N.update({streaming:{lowLatencyEnabled:!0,liveCatchup:{playbackRate:n.playbackRate.max-1}}})))}}(e.streamInfo,e.mediaInfo)}return n={initialize:function(e,n,i){E=e,h.addEventListener("canplay",$),h.addEventListener("play",Z),h.addEventListener("waiting",J),h.addEventListener("playing",ee),h.addEventListener("pause",te),h.addEventListener("error",ce),h.addEventListener("seeking",ne),h.addEventListener("seeked",ie),h.addEventListener("timeupdate",re),h.addEventListener("progress",se),h.addEventListener("ratechange",ae),h.addEventListener("loadedmetadata",oe),h.addEventListener("stalled",Ee),h.addEventListener("ended",le),y=E.manifestInfo.isDynamic,R=!1,w=!1,p=!0===n,g=i,I=!1;const r="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"",s=/safari/.test(r)&&!/chrome/.test(r);C=s?.25:.02,t.on(u.a.STREAM_INITIALIZED,M,this),t.on(u.a.DATA_UPDATE_COMPLETED,Q,this),t.on(u.a.LOADING_PROGRESS,me,this),t.on(u.a.BUFFER_LEVEL_STATE_CHANGED,_e,this),t.on(u.a.PLAYBACK_PROGRESS,de,this),t.on(u.a.PLAYBACK_TIME_UPDATED,de,this),t.on(u.a.PLAYBACK_ENDED,ue,this,{priority:l.a.EVENT_PRIORITY_HIGH}),t.on(u.a.STREAM_INITIALIZING,ye,this),S&&(S=!1,x())},setConfig:function(e){e&&(e.streamController&&(r=e.streamController),e.dashMetrics&&(a=e.dashMetrics),e.mediaPlayerModel&&(T=e.mediaPlayerModel),e.adapter&&(c=e.adapter),e.videoModel&&(h=e.videoModel),e.timelineConverter&&(f=e.timelineConverter),e.uriFragmentModel&&(D=e.uriFragmentModel),e.settings&&(N=e.settings))},getStartTimeFromUriParameters:V,getTimeToStreamEnd:L,getTime:k,getNormalizedTime:G,getPlaybackRate:z,getPlayedRanges:function(){return E&&h?h.getPlayedRanges():null},getEnded:H,getIsDynamic:Y,getStreamController:function(){return r},computeAndSetLiveDelay:function(e,t,n){let i,r,s;const a=!isNaN(e)&&isFinite(e)?e:NaN;let o=c.getSuggestedPresentationDelay();if(i=N.get().streaming.lowLatencyEnabled?0:T.getLiveDelay()?T.getLiveDelay():null===N.get().streaming.liveDelayFragmentCount||isNaN(N.get().streaming.liveDelayFragmentCount)||isNaN(a)?!0===N.get().streaming.useSuggestedPresentationDelay&&null!==o&&!isNaN(o)&&o>0?o:isNaN(a)?isNaN(n)?4*E.manifestInfo.minBufferTime:4*n:4*a:a*N.get().streaming.liveDelayFragmentCount,s=c.getAvailabilityStartTime(),null!==s&&(A=s),t>0){const e=Math.max(t-10,t/2);r=Math.min(i,e)}else r=i;return _=r,r},getLiveDelay:function(){return _},setLiveDelay:function(e,t=!1){t&&e<_||(_=e)},getCurrentLiveLatency:q,play:x,isPaused:P,pause:U,isSeeking:F,getStreamEndTime:O,seek:B,updateCurrentTime:X,reset:j},i=Object(d.a)(e).getInstance().getLogger(n),j(),n}h.__dashjs_factory_name="PlaybackController";var f=c.a.getSingletonFactory(h),p=n(12);function g(e){const t=(e=e||{}).eventBus,n=e.events,i=e.dashMetrics,r=e.fragmentLoader,s=e.debug,a=e.streamInfo,o=e.type;let l,u,c,d;function h(e){return!!e&&function(t){let n=!1;return t.some(t=>{if(i=e,r=t,!isNaN(i.index)&&i.startTime===r.startTime&&i.adaptationIndex===r.adaptationIndex&&i.type===r.type||function(e,t){return isNaN(e.index)&&isNaN(t.index)&&e.quality===t.quality}(e,t)||function(e,t){return e.action===p.a.ACTION_COMPLETE&&e.action===t.action}(e,t))return n=!0,n;var i,r}),n}(c)}function f(e){return isNaN(e.duration)?.25:Math.min(e.duration/8,.5)}function g(e){c=c.filter(t=>{const n=f(t);return isNaN(t.startTime)||void 0!==e&&t.startTime>=e-n})}function m(e,t){t<=e+.5||(c=c.filter(n=>{const i=f(n);return isNaN(n.startTime)||n.startTime>=t-i||isNaN(n.duration)||n.startTime+n.duration<=e+i}))}function _(e,t,n){for(let i=e.length-1;i>=0;i--){const r=e[i],s=r.startTime,a=s+r.duration;if(n=isNaN(n)?f(r):n,!isNaN(s)&&!isNaN(a)&&t+n>=s&&t-n{const i=function(e){let t;switch(e){case"loading":t=d;break;case"executed":t=c;break;default:t=[]}return t}(t);n=n.concat(function(e,t){if(t.hasOwnProperty("time"))return[_(e,t.time,t.threshold)];return e.filter(e=>{for(const n in t)if("state"!==n&&t.hasOwnProperty(n)&&e[n]!=t[n])return!1;return!0})}(i,e))}),n},isFragmentLoaded:h,isFragmentLoadedOrPending:function(e){let t,n=!1,i=0;if(n=h(e),!n)for(i=0;iisNaN(t.startTime)||void 0!==e&&t.startTime0&&m(n,t)},abortRequests:function(){u.debug("abort requests"),r.abort(),d=[]},executeRequest:function(e){switch(e.action){case p.a.ACTION_COMPLETE:c.push(e),E(e,"executed"),u.debug("STREAM_COMPLETED"),t.trigger(n.STREAM_COMPLETED,{request:e},{streamId:e.mediaInfo.streamInfo.id,mediaType:e.mediaType});break;case p.a.ACTION_DOWNLOAD:E(e,"loading"),d.push(e),function(e){t.trigger(n.FRAGMENT_LOADING_STARTED,{request:e},{streamId:a.id,mediaType:o}),r.load(e)}(e);break;default:u.warn("Unknown request action.")}},reset:function(){t.off(n.LOADING_COMPLETED,y,this),t.off(n.LOADING_DATA_PROGRESS,T,this),t.off(n.LOADING_ABANDONED,S,this),r&&r.reset(),b()},addExecutedRequest:function(e){c.push(e)}},u=s.getLogger(l),b(),t.on(n.LOADING_COMPLETED,y,l),t.on(n.LOADING_DATA_PROGRESS,T,l),t.on(n.LOADING_ABANDONED,S,l),l}g.__dashjs_factory_name="FragmentModel";const m=c.a.getClassFactory(g);m.FRAGMENT_MODEL_LOADING="loading",m.FRAGMENT_MODEL_EXECUTED="executed",m.FRAGMENT_MODEL_CANCELED="canceled",m.FRAGMENT_MODEL_FAILED="failed",c.a.updateClassFactory(g.__dashjs_factory_name,m);var _=m,E=n(7),y=n(6);var T=class{constructor(){this.captionData=null,this.label=null,this.lang=null,this.defaultTrack=!1,this.kind=null,this.isFragmented=!1,this.isEmbedded=!1}},S=n(15),b=n(35),A=n(29),v=n(10);function I(){const e=this.context,t=Object(l.a)(e).getInstance();let n,i,r,a,o,c,h,f,p,g,m,_,E,y,T,S,b,I;function R(e){const t=o[e].kind,n=void 0!==o[e].id?o[e].id:o[e].lang,i=o[e].lang,r=o[e].isTTML,s=o[e].isEmbedded;return a.addTextTrack(t,n,i,r,s)}function w(e,t,n,i,r,s){let a=0,o=0;e/t>n/i?(o=t,a=o/i*n):(a=e,o=a/n*i);let l=0,u=0,c=0,d=0;return a/o>r?(d=o,c=o*r):(c=a,d=a/r),l=(e-c)/2,u=(t-d)/2,s?{x:l+.1*c,y:u+.1*d,w:.8*c,h:.8*d}:{x:l,y:u,w:c,h:d}}function C(e,n){const i=a.getClientWidth(),r=a.getClientHeight(),s=a.getVideoWidth(),o=a.getVideoHeight(),l=a.getVideoRelativeOffsetTop(),c=a.getVideoRelativeOffsetLeft();if(0!==s&&0!==o){let a=s/o,d=!1;e.isFromCEA608&&(a=3.5/3,d=!0);const h=w.call(this,i,r,s,o,a,d),E=h.w,S=h.h,A=h.x,v=h.y;if(E!=g||S!=m||A!=f||v!=p||n){if(f=A+c,p=v+l,g=E,m=S,_){const e=_.style;e&&(e.left=f+"px",e.top=p+"px",e.width=g+"px",e.height=m+"px",e.zIndex=y&&document[y]||T?b:null,t.trigger(u.a.CAPTION_CONTAINER_RESIZE))}const n=e.activeCues;if(n){const e=n.length;for(let t=0;t=0&&o[e]?a.getTextTrack(o[e].kind,o[e].id,o[e].lang,o[e].isTTML,o[e].isEmbedded):null}function L(e){if(e===h)return;h=e;const t=M(h);O.call(this,t),E&&(clearInterval(E),E=null),t&&"html"===t.renderingType&&(C.call(this,t,!0),window.ResizeObserver?(I=new window.ResizeObserver(()=>{C.call(this,t,!0)}),I.observe(a.getElement())):E=setInterval(C.bind(this,t),500))}function O(e){B.call(this),e&&"html"===e.renderingType?U.call(this):F.call(this)}function x(e,t,n){return(isNaN(t)||e.startTime>=t)&&(isNaN(n)||e.endTime<=n)}function P(e,t,n){if(e.cues){const i=e.cues;for(let r=i.length-1;r>=0;r--)x(i[r],t,n)&&e.removeCue(i[r])}}function U(){let e=document.getElementById("native-cue-style");if(e)return;e=document.createElement("style"),e.id="native-cue-style",document.head.appendChild(e);const t=e.sheet,n=a.getElement();try{n&&(n.id?t.insertRule("#"+n.id+"::cue {background: transparent}",0):0!==n.classList.length?t.insertRule("."+n.className+"::cue {background: transparent}",0):t.insertRule("video::cue {background: transparent}",0))}catch(e){i.info(""+e.message)}}function F(){const e=document.getElementById("native-cue-style");e&&document.head.removeChild(e)}function B(){if(_)for(;_.firstChild;)_.removeChild(_.firstChild)}return n={initialize:function(){"undefined"!=typeof window&&"undefined"!=typeof navigator&&(r=window.VTTCue||window.TextTrackCue,o=[],c=[],h=-1,f=0,p=0,g=0,m=0,_=null,E=null,T=!1,b=2147483647,S=null,void 0!==document.fullscreenElement?y="fullscreenElement":void 0!==document.webkitIsFullScreen?y="webkitIsFullScreen":document.msFullscreenElement?y="msFullscreenElement":document.mozFullScreen&&(y="mozFullScreen"))},setDisplayCConTop:function(e){Object(v.b)(e,"boolean"),T=e,_&&!document[y]&&(_.style.zIndex=e?b:null)},addTextTrack:function(e,n){if(o.length!==n){if(o.push(e),o.length===n){o.sort((function(e,t){return e.index-t.index})),_=a.getTTMLRenderingDiv();let e=-1;for(let n=0;n=0){let n=function(){const i=M(e);i&&C.call(this,i,!0),t.off(u.a.PLAYBACK_METADATA_LOADED,n,this)};t.on(u.a.PLAYBACK_METADATA_LOADED,n,this);for(let t=0;t0&&(p.spans.push({name:g,line:t,row:y}),t="");let e="style_cea608_"+s.foreground+"_"+s.background;s.underline&&(e+="_underline"),s.italics&&(e+="_italics"),_.hasOwnProperty(e)||(_[e]=JSON.parse(JSON.stringify(s))),i=s,g=e}t+=r.uchar}t.trim().length>0&&p.spans.push({name:g,line:t,row:y}),h=!0,f=s}else h=!1,f=-1,c&&(c.p.push(p),p={start:r,end:l,spans:[]},c.y2=y,c.name="region_"+c.x+"_"+c.y1+"_"+c.y2,!1===m.hasOwnProperty(c.name)?(E.push(c),m[c.name]=c):(d=m[c.name],d.p.contat(c.p)),c=null)}c&&(c.p.push(p),c.y2=y+1,c.name="region_"+c.x+"_"+c.y1+"_"+c.y2,!1===m.hasOwnProperty(c.name)?(E.push(c),m[c.name]=c):(d=m[c.name],d.p.contat(c.p)),c=null);const S=[];for(y=0;y0){if(0!==T&&r!=t.row){const e=document.createElement("br");e.className="lineBreak",f.appendChild(e)}let n=!1;r===t.row&&(n=!0),r=t.row;const l=_[t.name],u=document.createElement("span");u.className="spanPadding "+t.name+" customSpanColor",u.style.cssText=s(e,l),0!==T&&n?T===i.spans.length-1?u.textContent=o(t.line):u.textContent=t.line:i.spans.length>1&&T=0&&(e=!0),t.mimeType&&t.mimeType.search(s.a.TTML)>=0&&(e=!0),e}(),n.defaultTrack=function(e){let t=!1;U.length>1&&e.isEmbedded?t=e.id&&e.id===s.a.CC1:1===U.length?e.id&&"string"==typeof e.id&&"CC"===e.id.substring(0,2)&&(t=!0):0===U.length&&(t=e.index===_[0].index);return t}(t),n.isFragmented=!c.getIsTextTrack(t.mimeType),n.isEmbedded=!!t.isEmbedded,n.kind=function(){let e=t.roles.length>0?i[t.roles[0]]:i.caption;return e=e===i.caption||e===i.subtitle?e:i.caption,e}(),n.roles=t.roles,n.accessibility=t.accessibility;const r=(_?_.length:0)+U.length;A.addTextTrack(n,r)}function X(e,t){let n,l,u,c,d,f,g;const m=t.mediaInfo,_=m.type,T=m.mimeType,S=m.codec||T;if(S){if(_===s.a.FRAGMENTED_TEXT)if(I||"InitializationSegment"!==t.segmentType){if(!I)return;if(f=a.getSamplesInfo(e),l=f.sampleList,null===x&&l.length>0&&(x=l[0].cts-t.start*w),S.search(s.a.STPP)>=0)for(p=null!==p?p:Q(S),u=0;u0&&A.addCaptions(P,0,t)}}else I=!0,w=a.getMediaTimescaleFromMoov(e);else if(_===s.a.TEXT){const t=new DataView(e,0,e.byteLength);g=N.a.Utils.dataViewToString(t,s.a.UTF8);try{n=Q(S).parse(g,0),A.addCaptions(A.getCurrentTrackIdx(),0,n)}catch(e){o.error(new E.a(O.TIMED_TEXT_ERROR_ID_PARSE_CODE,O.TIMED_TEXT_ERROR_MESSAGE_PARSE+e.message,g))}}else if(_===s.a.VIDEO)if(t.segmentType===y.a.INIT_SEGMENT_TYPE){if(0===F)for(F=a.getMediaTimescaleFromMoov(e),u=0;u0&&(s.cts!==o?l=0:l+=1,n.fields[e].push([s.cts+z*F,t[e],l]),o=s.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,f.sampleList);for(let e=0;e=0?t=g:(e.search(s.a.TTML)>=0||e.search(s.a.STPP)>=0)&&(t=m),t}function $(e){U.forEach((function(t){const n=A.getTrackIdxForId(t.id);n>=0&&A.deleteCuesFromTrackIdx(n,e.from,e.to)}))}return n={initialize:function(t,i,r,o){H||V(),A.setConfig({videoModel:M}),A.initialize(),a||(a=Object(S.a)(e).getInstance()),function(t,i,r,a){const o=!c.getIsTextTrack(t);if(_=_.concat(r),o){v=a,n.buffered=Object(b.a)(e).create(),D=f.getTracksFor(s.a.FRAGMENTED_TEXT,i);const t=f.getCurrentTrackFor(s.a.FRAGMENTED_TEXT,i);for(let e=0;e1){let 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){let n,i=t,s="",a="";for(;""!==e[i]&&i1)for(let i=0;i0&&"WEBVTT"!==a&&a.match(r)){const r=l(a),d=r.cuePoints,h=r.styles,f=c(e,i+1),p=o(d[0].replace(s,"")),g=o(d[1].replace(s,""));!isNaN(p)&&!isNaN(g)&&p>=u&&g>p?""!==f?(u=p,t.push({start:p,end:g,data:f,styles:h})):n.error("Skipping cue due to empty/malformed cue text"):n.error("Skipping cue due to incorrect cue timing")}}return t}},n=Object(d.a)(e).getInstance().getLogger(t),i=/(?:\r\n|\r|\n)/gm,r=/-->/,s=/(^[\s]+|[\s]+$)/g,a=/\s\b/g,t}U.__dashjs_factory_name="VTTParser";var F=c.a.getSingletonFactory(U),B=n(8),k={LEVELS:{SUGGESTION:"Suggestion",WARNING:"Warning",ERROR:"Error"},EVENTS:{NO_UTC_TIMING_ELEMENT:{key:"NO_UTC_TIMING_ELEMENT",message:"No UTCTiming element is present in the manifest. You may experience playback failures. For a detailed validation use https://conformance.dashif.org/"},NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE:{key:"NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE",message:'SMPTE 2052-1:2013 defines the attribute name as "imageType" and does not define "imagetype"'}}};function G(){const e=this.context,t=Object(l.a)(e).getInstance();let n,i,r=0;function s(){const e="cue_TTML_"+r;return r++,e}return n={parse:function(e,n,r,a,o){let l="";const c=[];let d,h,f;const p={},g={};let m="",_="",E={onOpenTag:function(e,n,r){if(r[" imagetype"]&&!r[" imageType"]&&(t.trigger(B.a.CONFORMANCE_VIOLATION,{level:k.LEVELS.ERROR,event:k.EVENTS.NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE}),r[" imageType"]=r[" 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(!r[" imageType"]||"PNG"!==r[" imageType"].value)return void i.warn("smpte-tt imageType != PNG. Discarded");m=r["http://www.w3.org/XML/1998/namespace id"].value}},onCloseTag:function(){m&&(g[m]=_.trim()),_="",m=""},onText:function(e){m&&(_+=e)}};if(!e)throw l="no ttml data to parse",new Error(l);p.data=e,t.trigger(u.a.TTML_TO_PARSE,p);const y=Object(A.fromXML)(p.data,(function(e){l=e}),E);t.trigger(u.a.TTML_PARSED,{ttmlString:p.data,ttmlDoc:y});const T=y.getMediaTimeEvents();for(f=0;fe.contents.length)&&(d=T[f]+na?a:T[f+1]+n,d{if(a.matchSettings(g,e))return this.setTextTrack(t),n=t,!0}),(!1===E||void 0===E&&!g||b)&&this.setTextTrack(-1),_=n,p.trigger(u.a.TEXT_TRACKS_ADDED,{enabled:L(),index:n,tracks:t}),S=!0}function M(e){if(!m&&e&&e.newMediaInfo){let t=e.newMediaInfo;t.type===s.a.FRAGMENTED_TEXT&&(g={lang:t.lang,role:t.roles[0],accessibility:t.accessibility[0]})}}function L(){let e=!0;return y&&!T&&(e=!1),e}function O(){y=!0,S=!1,b=!1}return e={setConfig:function(e){e&&(e.errHandler&&(n=e.errHandler),e.adapter&&(i=e.adapter),e.manifestModel&&(r=e.manifestModel),e.mediaController&&(a=e.mediaController),e.videoModel&&(o=e.videoModel),e.streamController&&(c=e.streamController),e.textTracks&&(d=e.textTracks),e.vttParser&&(h=e.vttParser),e.ttmlParser&&(f=e.ttmlParser),t.setConfig({errHandler:n,adapter:i,manifestModel:r,mediaController:a,videoModel:o,streamController:c,textTracks:d,vttParser:h,ttmlParser:f}))},getTextSourceBuffer:function(){return t},getAllTracksAreDisabled:function(){return y},addEmbeddedTrack:function(e){t.addEmbeddedTrack(e)},getTextDefaultLanguage:function(){return g&&g.lang||""},setTextDefaultLanguage:function(e){Object(v.b)(e,"string"),g||(g={}),g.lang=e,m=!0},setTextDefaultEnabled:function(e){Object(v.b)(e,"boolean"),E=e,E?y=!1:this.setTextTrack(-1)},getTextDefaultEnabled:function(){return void 0!==E&&E},setInitialSettings:function(e){g=e,m=!0},enableText:function(e){Object(v.b)(e,"boolean"),!E&&e&&(E=!0),L()!==e&&(e&&this.setTextTrack(_),e||(_=this.getCurrentTrackIdx(),S?this.setTextTrack(-1):b=!0))},isTextEnabled:L,setTextTrack:function(e){let n,i,r=t.getConfig(),o=r.fragmentModel,l=r.fragmentedTracks,u=r.videoModel;y=-1===e;let h=d.getCurrentTrackIdx();if(h!==e){y&&a&&a.saveTextSettingsDisabled(),d.setModeForTrackIdx(h,s.a.TEXT_HIDDEN),d.setCurrentTrackIdx(e),d.setModeForTrackIdx(e,s.a.TEXT_SHOWING);let r=d.getCurrentTrackInfo();if(r&&r.isFragmented&&!r.isEmbedded)for(let e=0;e{try{let n=e.duration,i=0;t&&!isNaN(t.start)&&!isNaN(t.duration)&&isFinite(t.duration)&&(n=t.start+t.duration),t&&!isNaN(t.start)&&(i=t.start),h.appendWindowStart=0,h.appendWindowEnd=n,h.appendWindowStart=i,c.debug(`Updated append window. Set start to ${h.appendWindowStart} and end to ${h.appendWindowEnd}`)}catch(e){c.warn("Failed to set append window")}})}function S(){const e=this;if(m.length>0){f=!0;const t=m[0];m.splice(0,1);let n=[];const i=function(){const i=y();!function(e,t,n,i){t&&t.length>0&&t.length=i&&t.end<=r)return!0}return!1}(t,i)&&s.trigger(u.a.SOURCEBUFFER_REMOVE_COMPLETED,{buffer:e,from:n.end(n.length-2),to:n.start(n.length-1),unintended:!0})}(e,n,i,t),m.length>0?S.call(this):(f=!1,_&&_({chunk:t}))};try{0===t.bytes.length?i.call(this):(n=y(),h.appendBuffer?h.appendBuffer(t.bytes):h.append(t.bytes,t),R(i.bind(this)))}catch(e){c.fatal('SourceBuffer append failed "'+e+'"'),m.length>0?S():f=!1,_&&_({chunk:t,error:new E.a(e.code,e.message)})}}}function b(){if(g.length>0){const e=g.shift();h.updating?R(e):(e(),b())}}function A(){h.updating||b()}function v(){h.updating||b()}function I(){c.error("SourceBufferSink error")}function R(e){g.push(e),h.updating||b()}return a={getType:function(){return o},getAllBufferRanges:y,getBuffer:function(){return h},append:function(e){e?(m.push(e),f||R(S.bind(this))):_({chunk:e,error:new E.a(O.APPEND_ERROR_CODE,O.APPEND_ERROR_MESSAGE)})},remove:function(t,n,i){const r=this;R((function(){try{t>=0&&n>t&&(i||"ended"!==e.readyState)&&h.remove(t,n),R((function(){s.trigger(u.a.SOURCEBUFFER_REMOVE_COMPLETED,{buffer:r,from:t,to:n,unintended:!1})}))}catch(e){s.trigger(u.a.SOURCEBUFFER_REMOVE_COMPLETED,{buffer:r,from:t,to:n,unintended:!1,error:new E.a(e.code,e.message)})}}))},abort:function(){try{("open"===e.readyState||h.setTextTrack&&"ended"===e.readyState)&&h.abort()}catch(e){c.error('SourceBuffer append abort failed: "'+e+'"')}m=[]},reset:function(t){if(h){if("function"==typeof h.removeEventListener&&(h.removeEventListener("updateend",v,!1),h.removeEventListener("error",I,!1),h.removeEventListener("abort",I,!1)),clearInterval(p),g=[],!t){try{h.getClassName&&"TextSourceBuffer"===h.getClassName()||(c.debug("Removing sourcebuffer from media source"),e.removeSourceBuffer(h))}catch(e){c.error("Failed to remove source buffer from media source.")}h=null}f=!1}m=[],_=null},updateTimestampOffset:function(e){h.timestampOffset===e||isNaN(e)||R(()=>{e<0&&(e+=.001),h.timestampOffset=e})},hasDiscontinuitiesAfter:function(e){try{const t=y();if(t&&t.length>1)for(let n=0,i=t.length;n0&&et.end(n-1)+.1)return!0}catch(e){c.error("hasDiscontinuities exception: "+e.message)}return!1},waitForUpdateEnd:R,updateAppendWindow:T},function(){c=Object(d.a)(r).getInstance().getLogger(a),f=!1,o=t.type;const n=t.codec;try{if(n.match(/application\/mp4;\s*codecs="(stpp|wvtt).*"/i))throw new Error("not really supported");h=i||e.addSourceBuffer(n),h.changeType&&i&&(c.debug("Doing period transition with changeType"),h.changeType(n)),T();const t=50;if("function"==typeof h.addEventListener)try{h.addEventListener("updateend",v,!1),h.addEventListener("error",I,!1),h.addEventListener("abort",I,!1)}catch(e){p=setInterval(A,t)}else p=setInterval(A,t)}catch(e){if(!t.isText&&-1===n.indexOf('codecs="stpp')&&-1===n.indexOf('codecs="wvtt'))throw e;{const e=Y(r).getInstance();h=e.getTextSourceBuffer()}}}(),a}q.__dashjs_factory_name="SourceBufferSink";var j=c.a.getClassFactory(q);function V(e){const t=this.context;let n,i,r,s=[],a=e;function o(e,t){s=s.filter(n=>!((isNaN(t)||n.starte)))}return n={getAllBufferRanges:function(){let e=[];for(let t=0;te[e.length-1].end?e.push({start:n.start,end:n.end}):e[e.length-1].end=n.end}const t={start:function(t){return e[t].start},end:function(t){return e[t].end}};return Object.defineProperty(t,"length",{get:function(){return e.length}}),t},append:function(e){"InitializationSegment"!==e.segmentType?(s.push(e),s.sort((function(e,t){return e.start-t.start})),r=null):r=e,i.debug("PreBufferSink appended chunk s: "+e.start+"; e: "+e.end),a&&a({chunk:e})},remove:o,abort:function(){},discharge:function(e,t){const n=function(e,t){return s.filter(n=>(isNaN(t)||n.starte))}(e,t);return r&&(n.push(r),r=null),o(e,t),n},reset:function(){s=[],r=null,a=null},updateTimestampOffset:function(){},hasDiscontinuitiesAfter:function(){return!1},waitForUpdateEnd:function(e){e()},getBuffer:function(){return this}},i=Object(d.a)(t).getInstance().getLogger(n),n}V.__dashjs_factory_name="PreBufferSink";var K=c.a.getClassFactory(V);const W={DEFAULT:.5,STRONG:1,WEAK:0};function X(e,t,n){let i,r,s,a;return r=void 0===e?-1:e,s=function(e){let t=W.DEFAULT;return e!==W.DEFAULT&&e!==W.STRONG&&e!==W.WEAK||(t=e),t}(n),a=void 0===t?null:t,i={quality:r,reason:a,priority:s},i}X.__dashjs_factory_name="SwitchRequest";const Q=c.a.getClassFactory(X);Q.NO_CHANGE=-1,Q.PRIORITY=W,c.a.updateClassFactory(X.__dashjs_factory_name,Q);var $=Q;function Z(e){e=e||{};const t=this.context,n=e.dashMetrics;let i,r;return i={getMaxIndex:function(e){const i=$(t).create();if(!(e&&e.hasOwnProperty("getMediaInfo")&&e.hasOwnProperty("getMediaType")&&e.hasOwnProperty("useBufferOccupancyABR")&&e.hasOwnProperty("getAbrController")&&e.hasOwnProperty("getScheduleController")))return i;!function(){if(!n||!n.hasOwnProperty("getCurrentBufferState"))throw new Error(s.a.MISSING_CONFIG_ERROR)}();const a=e.getMediaInfo(),l=e.getMediaType(),u=n.getCurrentBufferState(l),c=e.getScheduleController(),d=e.getAbrController(),h=e.getStreamInfo(),f=h&&h.manifestInfo?h.manifestInfo.isDynamic:null,p=d.getThroughputHistory(),g=p.getSafeAverageThroughput(l,f),m=p.getAverageLatency(l),_=e.useBufferOccupancyABR();return isNaN(g)||!u||_||d.getAbandonmentStateFor(l)!==o.ABANDON_LOAD&&(u.state===o.BUFFER_LOADED||f)&&(i.quality=d.getQualityForBitrate(a,g,m),c.setTimeToLoadDelay(0),r.debug("["+l+"] requesting switch to index: ",i.quality,"Average throughput",Math.round(g),"kbps"),i.reason={throughput:g,latency:m}),i},reset:function(){}},r=Object(d.a)(t).getInstance().getLogger(i),i}Z.__dashjs_factory_name="ThroughputRule";var J=c.a.getClassFactory(Z);function ee(e){e=e||{};const t=this.context,n=Object(l.a)(t).getInstance(),i=e.dashMetrics;let r,a,c;function h(){c={},c[s.a.VIDEO]={ignoreCount:2},c[s.a.AUDIO]={ignoreCount:2}}function f(){h()}function p(e){isNaN(e.startTime)||e.mediaType!==s.a.AUDIO&&e.mediaType!==s.a.VIDEO||c[e.mediaType].ignoreCount>0&&c[e.mediaType].ignoreCount--}return r={getMaxIndex:function(e){const n=$(t).create();if(!e||!e.hasOwnProperty("getMediaType"))return n;!function(){if(!i||!i.hasOwnProperty("getCurrentBufferLevel")||!i.hasOwnProperty("getCurrentBufferState"))throw new Error(s.a.MISSING_CONFIG_ERROR)}();const r=e.getMediaType(),l=i.getCurrentBufferState(r),u=e.getRepresentationInfo().fragmentDuration;if(function(e){return c[e].ignoreCount>0}(r)||!u)return n;if(l&&l.state===o.BUFFER_EMPTY)a.debug("["+r+"] Switch to index 0; buffer is empty."),n.quality=0,n.reason="InsufficientBufferRule: Buffer is empty";else{const t=e.getMediaInfo(),s=e.getAbrController(),a=s.getThroughputHistory(),o=i.getCurrentBufferLevel(r),l=a.getAverageThroughput(r),c=a.getAverageLatency(r),d=l*(o/u)*.5;n.quality=s.getQualityForBitrate(t,d,c),n.reason="InsufficientBufferRule: being conservative to avoid immediate rebuffering"}return n},reset:function(){h(),n.off(u.a.PLAYBACK_SEEKING,f,r),n.off(u.a.BYTES_APPENDED_END_FRAGMENT,p,r)}},a=Object(d.a)(t).getInstance().getLogger(r),h(),n.on(u.a.PLAYBACK_SEEKING,f,r),n.on(u.a.BYTES_APPENDED_END_FRAGMENT,p,r),r}ee.__dashjs_factory_name="InsufficientBufferRule";var te=c.a.getClassFactory(ee);function ne(e){e=e||{};const t=this.context,n=e.mediaPlayerModel,i=e.dashMetrics,r=e.settings;let s,a,o,l,u;function c(){o={},l={},u=[]}return s={shouldAbandon:function(e){const s=$(t).create($.NO_CHANGE,{name:ne.__dashjs_factory_name});if(!(e&&e.hasOwnProperty("getMediaInfo")&&e.hasOwnProperty("getMediaType")&&e.hasOwnProperty("getCurrentRequest")&&e.hasOwnProperty("getRepresentationInfo")&&e.hasOwnProperty("getAbrController")))return s;const c=e.getMediaInfo(),d=e.getMediaType(),h=e.getCurrentRequest();if(!isNaN(h.index)){f=d,p=h.index,o[f]=o[f]||{},o[f][p]=o[f][p]||{};const t=n.getStableBufferTime();if(i.getCurrentBufferLevel(d)>t)return s;const g=o[d][h.index];if(null===g||null===h.firstByteDate||l.hasOwnProperty(g.id))return s;if(void 0===g.firstByteTime&&(u[d]=[],g.firstByteTime=h.firstByteDate.getTime(),g.segmentDuration=h.duration,g.bytesTotal=h.bytesTotal,g.id=h.index),g.bytesLoaded=h.bytesLoaded,g.elapsedTime=(new Date).getTime()-g.firstByteTime,g.bytesLoaded>0&&g.elapsedTime>0&&function(e,t){u[e]=u[e]||[],u[e].push(t)}(d,Math.round(8*g.bytesLoaded/g.elapsedTime)),u[d].length>=5&&g.elapsedTime>500&&g.bytesLoadede+t,0);if(g.measuredBandwidthInKbps=Math.round(t/u[d].length),g.estimatedTimeOfDownload=+(8*g.bytesTotal/g.measuredBandwidthInKbps/1e3).toFixed(2),g.estimatedTimeOfDownload<1.8*g.segmentDuration||0===e.getRepresentationInfo().quality)return s;if(!l.hasOwnProperty(g.id)){const t=e.getAbrController(),n=g.bytesTotal-g.bytesLoaded,i=t.getBitrateList(c),u=t.getQualityForBitrate(c,g.measuredBandwidthInKbps*r.get().streaming.abr.bandwidthSafetyFactor),h=t.getMinAllowedIndexFor(d),f=void 0!==h?Math.max(h,u):u;n>g.bytesTotal*i[f].bitrate/i[t.getQualityFor(d)].bitrate&&(s.quality=f,s.reason.throughput=g.measuredBandwidthInKbps,s.reason.fragmentID=g.id,l[g.id]=g,a.debug("["+d+"] frag id",g.id," is asking to abandon and switch to quality to ",f," measured bandwidth was",g.measuredBandwidthInKbps),delete o[d][g.id])}}else g.bytesLoaded===g.bytesTotal&&delete o[d][g.id]}var f,p;return s},reset:c},a=Object(d.a)(t).getInstance().getLogger(s),c(),s}ne.__dashjs_factory_name="AbandonRequestsRule";var ie=c.a.getClassFactory(ne);function re(){const e=this.context;let t,n;return t={getMaxIndex:function(t){const i=$(e).create();if(!t||!t.hasOwnProperty("getDroppedFramesHistory"))return i;const r=t.getDroppedFramesHistory();if(r){const t=r.getFrameHistory();let i=0,s=0,a=$.NO_CHANGE;for(let e=1;e375&&i/s>.15)){a=e-1,n.debug("index: "+a+" Dropped Frames: "+i+" Total Frames: "+s);break}return $(e).create(a,{droppedFrames:i})}return i}},n=Object(d.a)(e).getInstance().getLogger(t),t}re.__dashjs_factory_name="DroppedFramesRule";var se=c.a.getClassFactory(re);function ae(){const e=this.context;let t,n;return t={getMaxIndex:function(t){const i=t?t.getSwitchHistory():null,r=i?i.getSwitchRequests():[];let s=0,a=0,o=0;const l=$(e).create();for(let e=0;e=6&&s/a>.075)){l.quality=e>0&&r[e].drops>0?e-1:e,l.reason={index:l.quality,drops:s,noDrops:a,dropSize:o},n.debug("Switch history rule index: "+l.quality+" samples: "+(s+a)+" drops: "+s);break}return l}},n=Object(d.a)(e).getInstance().getLogger(t),t}ae.__dashjs_factory_name="SwitchHistoryRule";var oe=c.a.getClassFactory(ae);function le(e){e=e||{};const t=this.context,n=e.dashMetrics,i=e.mediaPlayerModel,r=Object(l.a)(t).getInstance();let s,a,c;function h(e,t,n){const i=n.reduce((e,t,i)=>t>n[e]?i:e,0);if(0===i)return null;const r=Math.max(e,10+2*t.length),s=(n[i]-1)/(r/10-1);return{gp:s,Vp:10/s}}function f(e){const t={},n=e.getMediaInfo().bitrateList.map(e=>e.bandwidth);let r=function(e){return e.map(e=>Math.log(e))}(n);r=r.map(e=>e-r[0]+1);const s=i.getStableBufferTime(),a=h(s,n,r);return a?(t.state=1,t.bitrates=n,t.utilities=r,t.stableBufferTime=s,t.Vp=a.Vp,t.gp=a.gp,t.lastQuality=0,p(t)):t.state=0,t}function p(e){e.placeholderBuffer=0,e.mostAdvancedSegmentStart=NaN,e.lastSegmentWasReplacement=!1,e.lastSegmentStart=NaN,e.lastSegmentDurationS=NaN,e.lastSegmentRequestTimeMs=NaN,e.lastSegmentFinishTimeMs=NaN}function g(e,t){const r=i.getStableBufferTime();if(e.stableBufferTime!==r){const i=h(r,e.bitrates,e.utilities);if(i.Vp!==e.Vp||i.gp!==e.gp){const s=n.getCurrentBufferLevel(t);let a=s+e.placeholderBuffer;a-=10,a*=i.Vp/e.Vp,a+=10,e.stableBufferTime=r,e.Vp=i.Vp,e.gp=i.gp,e.placeholderBuffer=Math.max(0,a-s)}}}function m(e,t){return e.Vp*(e.utilities[t]+e.gp)}function _(e,t){const n=e.bitrates[t],i=e.utilities[t];let r=0;for(let s=t-1;s>=0;--s)if(e.utilities[s]t.mostAdvancedSegmentStart?(t.mostAdvancedSegmentStart=n,t.lastSegmentWasReplacement=!1):t.lastSegmentWasReplacement=!0,t.lastSegmentStart=n,t.lastSegmentDurationS=e.chunk.duration,t.lastQuality=e.chunk.quality,A(t,e.chunk.mediaInfo.type)}}}function b(e){if(e&&e.metric===o.HTTP_REQUEST&&e.value&&e.value.type===y.a.MEDIA_SEGMENT_TYPE&&e.value.trace&&e.value.trace.length){const t=c[e.mediaType];t&&0!==t.state&&(t.lastSegmentRequestTimeMs=e.value.trequest.getTime(),t.lastSegmentFinishTimeMs=e.value._tfinish.getTime(),A(t,e.mediaType))}}function A(e,t){if(!isNaN(e.lastSegmentStart)&&!isNaN(e.lastSegmentRequestTimeMs)&&!isNaN(e.placeholderBuffer)){if(e.placeholderBuffer*=.99,!isNaN(e.lastSegmentFinishTimeMs)){const i=n.getCurrentBufferLevel(t)+.001*(e.lastSegmentFinishTimeMs-e.lastSegmentRequestTimeMs),r=m(e,e.lastQuality),s=Math.max(0,r-i);e.placeholderBuffer=Math.min(s,e.placeholderBuffer)}e.lastSegmentWasReplacement&&!isNaN(e.lastSegmentDurationS)&&(e.placeholderBuffer+=e.lastSegmentDurationS),e.lastSegmentStart=NaN,e.lastSegmentRequestTimeMs=NaN}}function v(e){if(e){const t=c[e.mediaType];t&&0!==t.state&&(t.abrQuality=e.newQuality)}}function I(e){if(e){const t=c[e.mediaType];if(t&&0!==t.state){const i=n.getCurrentBufferLevel(e.mediaType);let r;r=t.abrQuality>0?_(t,t.abrQuality):10;const s=Math.max(0,r-i);t.placeholderBuffer=Math.min(t.placeholderBuffer,s)}}}function R(){c={}}return s={getMaxIndex:function(e){const i=$(t).create();if(!(e&&e.hasOwnProperty("getMediaInfo")&&e.hasOwnProperty("getMediaType")&&e.hasOwnProperty("getScheduleController")&&e.hasOwnProperty("getStreamInfo")&&e.hasOwnProperty("getAbrController")&&e.hasOwnProperty("useBufferOccupancyABR")))return i;const r=e.getMediaInfo(),s=e.getMediaType(),o=e.getScheduleController(),l=e.getStreamInfo(),u=e.getAbrController(),d=u.getThroughputHistory(),h=l?l.id:null,E=l&&l.manifestInfo&&l.manifestInfo.isDynamic,y=e.useBufferOccupancyABR();if(i.reason=i.reason||{},!y)return i;o.setTimeToLoadDelay(0);const T=function(e){const t=e.getMediaType();let n=c[t];return n?0!==n.state&&g(n,t):(n=f(e),c[t]=n),n}(e);if(0===T.state)return i;const S=n.getCurrentBufferLevel(s),b=d.getAverageThroughput(s,E),A=d.getSafeAverageThroughput(s,E),v=d.getAverageLatency(s);let I;if(i.reason.state=T.state,i.reason.throughput=b,i.reason.latency=v,isNaN(b))return i;switch(T.state){case 1:I=u.getQualityForBitrate(r,A,v),i.quality=I,i.reason.throughput=A,T.placeholderBuffer=Math.max(0,_(T,I)-S),T.lastQuality=I,!isNaN(T.lastSegmentDurationS)&&S>=T.lastSegmentDurationS&&(T.state=2);break;case 2:!function(e,t){const n=Date.now();if(isNaN(e.lastSegmentFinishTimeMs)){if(!isNaN(e.lastCallTimeMs)){const t=.001*(n-e.lastCallTimeMs);e.placeholderBuffer+=Math.max(0,t)}}else{const t=.001*(n-e.lastSegmentFinishTimeMs);e.placeholderBuffer+=Math.max(0,t)}e.lastCallTimeMs=n,e.lastSegmentStart=NaN,e.lastSegmentRequestTimeMs=NaN,e.lastSegmentFinishTimeMs=NaN,g(e,t)}(T,s),I=function(e,t){const n=e.bitrates.length;let i=NaN,r=NaN;for(let s=0;s=r)&&(r=n,i=s)}return i}(T,S+T.placeholderBuffer);const e=u.getQualityForBitrate(r,A,v);I>T.lastQuality&&I>e&&(I=Math.max(e,T.lastQuality));let t=Math.max(0,S+T.placeholderBuffer-m(T,I));t<=T.placeholderBuffer?(T.placeholderBuffer-=t,t=0):(t-=T.placeholderBuffer,T.placeholderBuffer=0,Ie.bandwidth/1e3);return t.state=1,t.bitrates=i,t.lastQuality=0,function(e){if(!e||!e.type)return;c[e.type]={},c[e.type].w=[],c[e.type].prev_w=[],c[e.type].Q=0,c[e.type].segment_request_start_s=0,c[e.type].segment_download_finish_s=0,c[e.type].B_target=1.5}(n),p(t),t}function p(e){e.placeholderBuffer=0,e.mostAdvancedSegmentStart=NaN,e.lastSegmentWasReplacement=!1,e.lastSegmentStart=NaN,e.lastSegmentDurationS=NaN,e.lastSegmentRequestTimeMs=NaN,e.lastSegmentFinishTimeMs=NaN}function g(){for(const e in a)if(a.hasOwnProperty(e)){const t=a[e];0!==t.state&&(t.state=1,p(t))}}function m(e){if(e&&e.chunk&&e.chunk.mediaInfo){const t=a[e.chunk.mediaInfo.type],n=c[e.chunk.mediaInfo.type];if(t&&0!==t.state){const i=e.chunk.start;isNaN(t.mostAdvancedSegmentStart)||i>t.mostAdvancedSegmentStart?(t.mostAdvancedSegmentStart=i,t.lastSegmentWasReplacement=!1):t.lastSegmentWasReplacement=!0,t.lastSegmentStart=i,t.lastSegmentDurationS=e.chunk.duration,t.lastQuality=e.chunk.quality,E(t,n)}}}function _(e){if(e&&e.metric===o.HTTP_REQUEST&&e.value&&e.value.type===y.a.MEDIA_SEGMENT_TYPE&&e.value.trace&&e.value.trace.length){const t=a[e.mediaType],n=c[e.mediaType];t&&0!==t.state&&(t.lastSegmentRequestTimeMs=e.value.trequest.getTime(),t.lastSegmentFinishTimeMs=e.value._tfinish.getTime(),E(t,n))}}function E(e,t){isNaN(e.lastSegmentStart)||isNaN(e.lastSegmentRequestTimeMs)||(t.segment_request_start_s=.001*e.lastSegmentRequestTimeMs,t.segment_download_finish_s=.001*e.lastSegmentFinishTimeMs,e.lastSegmentStart=NaN,e.lastSegmentRequestTimeMs=NaN)}function T(e){if(e&&e.mediaType){const t=a[e.mediaType];t&&0!==t.state&&(t.abrQuality=e.newQuality)}}function S(e,t){if(e.length!==t.length)return-1;let n=0;for(let i=0;ie.bandwidth),g=d.length,m=e.getScheduleController(),_=e.getStreamInfo(),E=e.getAbrController(),y=E.getThroughputHistory(),T=_&&_.manifestInfo&&_.manifestInfo.isDynamic,b=e.useL2AABR(),A=n.getCurrentBufferLevel(u,!0),v=y.getSafeAverageThroughput(u,T),I=y.getAverageThroughput(u,T),R=y.getAverageLatency(u);let w,C=e.getVideoModel().getPlaybackRate();if(!(e&&e.hasOwnProperty("getMediaInfo")&&e.hasOwnProperty("getMediaType")&&e.hasOwnProperty("getScheduleController")&&e.hasOwnProperty("getStreamInfo")&&e.hasOwnProperty("getAbrController")&&e.hasOwnProperty("useL2AABR")))return i;if(i.reason=i.reason||{},!b||u===s.a.AUDIO)return i;m.setTimeToLoadDelay(0);const D=function(e){const t=e.getMediaType();let n=a[t];return n||(n=f(e),a[t]=n),n}(e);if(0===D.state)return i;const N=c[u];if(!N)return i;if(i.reason.state=D.state,i.reason.throughput=I,i.reason.latency=R,isNaN(I))return i;switch(D.state){case 1:if(w=E.getQualityForBitrate(l,v,R),i.quality=w,i.reason.throughput=v,D.lastQuality=w,!isNaN(D.lastSegmentDurationS)&&A>=N.B_target){D.state=2,N.Q=r;for(let e=0;ee+t.d,0);const s=n.getCurrentHttpRequest(u).trace.reduce((e,t)=>e+t.b[0],0);let a=Math.round(8*s/t);a<1&&(a=1);let c=D.lastSegmentDurationS,f=1;for(let e=0;ea&&(f=-1),N.w[e]=N.prev_w[e]+f*(c/(2*o))*((N.Q+r)*(C*d[e]/a));N.w=function(e){const t=e.length;let n=!1,i=[];for(let n=0;n=r[e+1]){n=!0;break}n||(a=(s+r[t-1]-1)/t);for(let e=0;eD.lastQuality&&d[D.lastQuality+1]<=a&&(w=D.lastQuality+1),d[w]>=a&&(N.Q=2*Math.max(r,N.Q)),i.quality=w,i.reason.throughput=I,i.reason.latency=R,i.reason.bufferLevel=A,D.lastQuality=i.quality;break;default:h.debug("L2A ABR rule invoked in bad state."),i.quality=E.getQualityForBitrate(l,v,R),i.reason.state=D.state,i.reason.throughput=v,i.reason.latency=R,D.state=1,p(D)}return i},reset:function(){b(),i.off(u.a.PLAYBACK_SEEKING,g,r),i.off(u.a.MEDIA_FRAGMENT_LOADED,m,r),i.off(u.a.METRIC_ADDED,_,r),i.off(u.a.QUALITY_CHANGE_REQUESTED,T,r)}},h=Object(d.a)(t).getInstance().getLogger(r),b(),i.on(u.a.PLAYBACK_SEEKING,g,r),i.on(u.a.MEDIA_FRAGMENT_LOADED,m,r),i.on(u.a.METRIC_ADDED,_,r),i.on(u.a.QUALITY_CHANGE_REQUESTED,T,r),r}ce.__dashjs_factory_name="L2ARule";var de=c.a.getClassFactory(ce);const he="manual_weight_selection",fe="random_weight_selection",pe="dynamic_weight_selection";function ge(){const e=this.context;let t,n,i,r,s,a,o,l,u,c;function h(){i=null,r=1,s=100,a=0,o=null,l=null,u=null,c=pe}function f(){let e=0;if(i)for(let t=0;te&&(e=n.state.throughput)}return e}function p(e,t,n){let i=e.map((e,i)=>n[i]*Math.pow(e-t[i],2)).reduce((e,t)=>e+t);return(i<0?-1:1)*Math.sqrt(Math.abs(i))}function g(e,t){return p([e.state.throughput,e.state.latency,e.state.rebuffer,e.state.switch],[t.state.throughput,t.state.latency,t.state.rebuffer,t.state.switch],[1,1,1,1])}function m(e,t,n){for(let i=0;i{n.push(e.bandwidth),e.bandwidthMath.pow(e,2)).reduce((e,t)=>e+t);return Math.sqrt(t)}(n);for(let e=0;er)&&(e=a,r=o)}t.push(e)}let r=null,s=null;for(let e=0;er)&&(r=n,s=e)}let a=[];a.push(t[s]),t.splice(s,1);for(;t.length>0;){let e=null,n=null;for(let r=0;r1&&(v=f()),d/=s,n.debug(`getNextQuality called throughput:${v} latency:${d} bufferSize:${h} currentQualityIndex:${_} playbackRate:${g}`);let I=A[_],R=I.bitrate*y.getSegmentDuration()/b,w=Math.max(0,R-S);if(S-Rn&&t>a.bitrate&&(n=a.bitrate,r=a)}return r}(I,b).qualityIndex;switch(c){case he:l=[.4,.4,.4,.4];break;case fe:!function(e){l=function(e,t){let n=[],i=Math.sqrt(2/e);for(let e=0;et-1e4||c)&&i.bitrate!==a&&(o[0]=100);let d=p(s,[v,0,0,0],o);(null===C||dn?e-n:e+n-t,i}return t={getMinBuffer:function(){return o},getSegmentDuration:c,getNextBufferWithBitrate:function(e,t,n){return d(t,e*l/n)},getNextBuffer:d,findWeightVector:function(e,t,n,i,c,h){let f=null,p=null,g=null,m=Math.abs(t-s);return e.forEach(e=>{r.forEach(i=>{i[0];let r,s=i[1],_=i[2],E=(i[3],e.bitrate*l/c),y=d(n,E);r=0===_?10:1/_;let T=r*Math.max(1e-5,E-y);r=0===s?10:1/s;let S=r*e.state.latency,b=u.calculateSingleUseQoe(e.bitrate,T,S,h);(null===f||b>f)&&function(e,t,n){if(e>a+n)return!1;return t>=o}(t,y,m)&&(f=b,p=i,g=e.bitrate)})}),null===p&&null===g&&(p=-1),s=t,p}},n=[.2,.4,.6,.8,1],i=4,r=function(e,t){let n=e.map((function(e){return[e]})),i=function(t,n,r){if(r===n)return t;let s=t.length;for(let n=0;nI?I=t:tA?C-A:0;r.setupPerSegmentQoe(A,I,v),r.logSegmentMetrics(R,D,y,T);let N=Se(l).create({targetLatency:1.5,bufferMin:.3,segmentDuration:A,qoeEvaluator:r});return n.quality=i.getNextQuality(f,1e3*S,y,m,T,h,N),n.reason={throughput:S,latency:y},n.priority=$.PRIORITY.STRONG,g.setTimeToLoadDelay(0),n.quality!==h&&console.log("[TgcLearningRule]["+u+"] requesting switch to index: ",n.quality,"Average throughput",Math.round(S),"kbps"),n}catch(e){throw e}},reset:function(){i.reset(),r.reset()}},t=Object(d.a)(l).getInstance().getLogger(n),i=me(l).create(),r=ye(l).create(),n}be.__dashjs_factory_name="LoLPRule";var Ae=c.a.getClassFactory(be);function ve(e){e=e||{};const t=this.context,n=e.mediaPlayerModel,i=e.dashMetrics,r=e.settings;let a,o,l;function u(e){return e.filter(e=>e.quality>$.NO_CHANGE)}function c(e){const n={};let i,r,s,a,o,l=null;if(0!==e.length){for(n[$.PRIORITY.STRONG]={quality:$.NO_CHANGE,reason:null},n[$.PRIORITY.WEAK]={quality:$.NO_CHANGE,reason:null},n[$.PRIORITY.DEFAULT]={quality:$.NO_CHANGE,reason:null},i=0,r=e.length;is.quality)&&(n[s.priority].quality=s.quality,n[s.priority].reason=s.reason||null);return n[$.PRIORITY.WEAK].quality!==$.NO_CHANGE&&(l=n[$.PRIORITY.WEAK]),n[$.PRIORITY.DEFAULT].quality!==$.NO_CHANGE&&(l=n[$.PRIORITY.DEFAULT]),n[$.PRIORITY.STRONG].quality!==$.NO_CHANGE&&(l=n[$.PRIORITY.STRONG]),l&&(a=l.quality,o=l.reason),$(t).create(a,o)}}return a={initialize:function(){o=[],l=[],r.get().streaming.abr.useDefaultABRRules&&(r.get().streaming.abr.ABRStrategy===s.a.ABR_STRATEGY_L2A?o.push(de(t).create({dashMetrics:i,mediaPlayerModel:n,settings:r})):r.get().streaming.abr.ABRStrategy===s.a.ABR_STRATEGY_LoLP?o.push(Ae(t).create({dashMetrics:i})):(o.push(ue(t).create({dashMetrics:i,mediaPlayerModel:n,settings:r})),o.push(J(t).create({dashMetrics:i})),o.push(te(t).create({dashMetrics:i})),o.push(oe(t).create()),o.push(se(t).create()),l.push(ie(t).create({dashMetrics:i,mediaPlayerModel:n,settings:r})))),n.getABRCustomRules().forEach((function(e){"qualitySwitchRules"===e.type&&o.push(e.rule(t).create()),"abandonFragmentRules"===e.type&&l.push(e.rule(t).create())}))},reset:function(){[o,l].forEach(e=>{e&&e.length&&e.forEach(e=>e.reset&&e.reset())}),o=[],l=[]},getMaxQuality:function(e){return c(u(o.map(t=>t.getMaxIndex(e))))||$(t).create()},getMinSwitchRequest:c,shouldAbandonFragment:function(e){return c(u(l.map(t=>t.shouldAbandon(e))))||$(t).create()},getQualitySwitchRules:function(){return o}},a}ve.__dashjs_factory_name="ABRRulesCollection";const Ie=c.a.getClassFactory(ve);Ie.QUALITY_SWITCH_RULES="qualitySwitchRules",Ie.ABANDON_FRAGMENT_RULES="abandonFragmentRules",c.a.updateSingletonFactory(ve.__dashjs_factory_name,Ie);var Re=Ie;var we=class{constructor(){this.mediaType=null,this.bitrate=null,this.width=null,this.height=null,this.scanType=null,this.qualityIndex=NaN}};function Ce(e){let t;const n=(e=e||{}).abrController,i=e.switchHistory,r=e.droppedFramesHistory,s=e.currentRequest,a=e.useBufferOccupancyABR,o=e.useL2AABR,l=e.useLoLPABR,u=e.streamProcessor?e.streamProcessor.getScheduleController():null,c=e.streamProcessor?e.streamProcessor.getRepresentationInfo():null,d=e.videoModel?e.videoModel:null;function h(){return c?c.mediaInfo:null}return t={getMediaType:function(){const e=h();return e?e.type:null},getMediaInfo:h,getDroppedFramesHistory:function(){return r},getCurrentRequest:function(){return s},getSwitchHistory:function(){return i},getStreamInfo:function(){const e=h();return e?e.streamInfo:null},getScheduleController:function(){return u},getAbrController:function(){return n},getRepresentationInfo:function(){return c},useBufferOccupancyABR:function(){return a},useL2AABR:function(){return o},useLoLPABR:function(){return l},getVideoModel:function(){return d}},t}Ce.__dashjs_factory_name="RulesContext";var De=c.a.getClassFactory(Ce);function Ne(){let e=[],t=[];return{push:function(n){n.newValue===$.NO_CHANGE&&(n.newValue=n.oldValue),e[n.oldValue]||(e[n.oldValue]={noDrops:0,drops:0,dropSize:0});let i=n.newValue-n.oldValue,r=i<0?1:0,s=r?-i:0,a=r?0:1;if(e[n.oldValue].drops+=r,e[n.oldValue].dropSize+=s,e[n.oldValue].noDrops+=a,t.push({idx:n.oldValue,noDrop:a,drop:r,dropSize:s}),t.length>8){let n=t.shift();e[n.idx].drops-=n.drop,e[n.idx].dropSize-=n.dropSize,e[n.idx].noDrops-=n.noDrop}},getSwitchRequests:function(){return e},reset:function(){e=[],t=[]}}}Ne.__dashjs_factory_name="SwitchRequestHistory";var Me=c.a.getClassFactory(Ne);function Le(){let e=[],t=0,n=0;return{push:function(i,r){let s=r&&r.droppedVideoFrames?r.droppedVideoFrames:0,a=r&&r.totalVideoFrames?r.totalVideoFrames:0,o=s-t;t=s;let l=a-n;n=a,isNaN(i)||(e[i]?(e[i].droppedVideoFrames+=o,e[i].totalVideoFrames+=l):e[i]={droppedVideoFrames:o,totalVideoFrames:l})},getFrameHistory:function(){return e},reset:function(i){e=[],t=i.droppedVideoFrames,n=i.totalVideoFrames}}}Le.__dashjs_factory_name="DroppedFramesHistory";var Oe=c.a.getClassFactory(Le);function xe(e){const t=(e=e||{}).settings;let n,i,r,a,o;function l(e,t,n,i){const r=Math.pow(.5,n/i.fast);e.fastEstimate=(1-r)*t+r*e.fastEstimate;const s=Math.pow(.5,n/i.slow);e.slowEstimate=(1-s)*t+s*e.slowEstimate,e.totalWeight+=n}function u(e,l,u){return t.get().streaming.abr.movingAverageMethod!==s.a.MOVING_AVERAGE_SLIDING_WINDOW?function(e,t){const n=e?o.throughputHalfLife:o.latencyHalfLife,i=e?r[t]:a[t];if(!i||i.totalWeight<=0)return NaN;const s=i.fastEstimate/(1-Math.pow(.5,i.totalWeight/n.fast)),l=i.slowEstimate/(1-Math.pow(.5,i.totalWeight/n.slow));return e?Math.min(s,l):Math.max(s,l)}(e,l):function(e,t,r){const s=function(e,t,r){let s,a;if(e?(s=n[t],a=r?3:4):(s=i[t],a=4),s){if(a>=s.length)a=s.length;else if(e)for(let e=1;e=1.3||t<=1/1.3)&&(a+=1,a===s.length))break}}else a=0;return a}(e,t,r);let a=(e?n:i)[t];if(0===s||!a||0===a.length)return NaN;return a=a.slice(-s),a.reduce((e,t)=>e+t)/a.length}(e,l,u)}function c(e,t){return u(!0,e,t)}function d(e){n[e]=n[e]||[],i[e]=i[e]||[],r[e]=r[e]||{fastEstimate:0,slowEstimate:0,totalWeight:0},a[e]=a[e]||{fastEstimate:0,slowEstimate:0,totalWeight:0}}function h(){n={},i={},r={},a={}}const f={push:function(e,u,c){if(!u.trace||!u.trace.length)return;const h=u.tresponse.getTime()-u.trequest.getTime()||1,f=u._tfinish.getTime()-u.tresponse.getTime()||1,p=u.trace.reduce((e,t)=>e+t.b[0],0);let g;g=t.get().streaming.lowLatencyEnabled?u.trace.reduce((e,t)=>e+t.d,0):c?f:h+f;const m=Math.round(8*p/g);if(d(e),function(e,n,i){return e===s.a.VIDEO?i0&&!n[e].hasCachedEntries)return;n[e].hasCachedEntries=!0}else n[e]&&n[e].hasCachedEntries&&function(e){delete n[e],delete i[e],delete r[e],delete a[e],d(e)}(e);n[e].push(m),n[e].length>20&&n[e].shift(),i[e].push(h),i[e].length>20&&i[e].shift(),l(r[e],m,.001*f,o.throughputHalfLife),l(a[e],h,1,o.latencyHalfLife)},getAverageThroughput:c,getSafeAverageThroughput:function(e,n){let i=c(e,n);return isNaN(i)||(i*=t.get().streaming.abr.bandwidthSafetyFactor),i},getAverageLatency:function(e){return u(!1,e)},reset:h};return o={throughputHalfLife:{fast:3,slow:8},latencyHalfLife:{fast:1,slow:2}},h(),f}xe.__dashjs_factory_name="ThroughputHistory";var Pe=c.a.getClassFactory(xe);function Ue(){const e=this.context,t=Object(d.a)(e).getInstance(),n=Object(l.a)(e).getInstance();let i,r,a,c,h,f,p,g,m,E,T,S,b,A,I,R,w,C,D,N,M,L,O,x,P;function U(){a=Re(e).create({dashMetrics:x,mediaPlayerModel:I,settings:P}),a.initialize()}function F(){h={},f={},g={},p={},C={},M={},L={},O={},void 0===E&&(E=!1),w=void 0,D=void 0,N=void 0,clearTimeout(m),m=null}function B(e){e.mediaType===s.a.VIDEO&&(void 0!==w&&D.push(w,A.getPlaybackQuality()),w=e.newQuality)}function k(e){e.metric!==o.HTTP_REQUEST||!e.value||e.value.type!==y.a.MEDIA_SEGMENT_TYPE||e.mediaType!==s.a.AUDIO&&e.mediaType!==s.a.VIDEO||N.push(e.mediaType,e.value,P.get().streaming.abr.useDeadTimeLatency),e.metric!==o.BUFFER_LEVEL||e.mediaType!==s.a.AUDIO&&e.mediaType!==s.a.VIDEO||function(e,t){const n=P.get().streaming.abr.ABRStrategy;if(n===s.a.ABR_STRATEGY_L2A)return M[e]=!1,O[e]=!1,void(L[e]=!0);if(n===s.a.ABR_STRATEGY_LoLP)return M[e]=!1,O[e]=!0,void(L[e]=!1);if(n===s.a.ABR_STRATEGY_BOLA)return M[e]=!0,O[e]=!1,void(L[e]=!1);if(n===s.a.ABR_STRATEGY_THROUGHPUT)return M[e]=!1,O[e]=!1,void(L[e]=!1);!function(e,t){const n=I.getStableBufferTime(),i=n,s=.5*n,a=M[e],o=t>(a?s:i);M[e]=o,o!==a&&(o?r.info("["+e+"] switching from throughput to buffer occupancy ABR rule (buffer: "+t.toFixed(3)+")."):r.info("["+e+"] switching from buffer occupancy to throughput ABR rule (buffer: "+t.toFixed(3)+")."))}(e,t)}(e.mediaType,.001*e.value.level)}function G(e,t){let n;return h[t]=h[t]||{},h[t].hasOwnProperty(e)||(h[t][e]=0),n=function(e,t){let n=e;if(!p[t])return n;const i=H(t);void 0!==i&&(n=Math.max(e,i));const r=z(t);void 0!==r&&(n=Math.min(n,r));return n}(h[t][e],e),n=function(e,t,n){const i=P.get().streaming.abr.maxRepresentationRatio[t];if(isNaN(i)||i>=1||i<0)return e;return Math.min(e,Math.round(n*i))}(n,e,h[t][e]),n=function(e,t){if(t!==s.a.VIDEO||!P.get().streaming.abr.limitBitrateByPortal||!p[t])return e;E||J();const n=b.getAdaptationForType(0,t).Representation_asArray;let i=e;if(T>0&&S>0){for(;i>0&&n[i]&&T-1?V(p[e].getMediaInfo(),t):void 0}function H(e){const t=function(e){return P.get().streaming.abr.minBitrate[e]}(e);if(t>-1){const n=p[e].getMediaInfo(),i=K(n);let r=V(n,t);return i[r]&&r=0&&n<=a&&q(e,s,n,a,i)}function q(e,t,i,s,a){if(e&&p[e]){const o=p[e].getStreamInfo(),l=o?o.id:null;if(P.get().debug.logLevel===d.a.LOG_LEVEL_DEBUG){const n=x.getCurrentBufferLevel(e);r.info("["+e+"] switch from "+t+" to "+i+"/"+s+" (buffer: "+n+") "+(a?JSON.stringify(a):"."))}!function(e,t,n){f[t]=f[t]||{},f[t][e]=n}(e,l,i),n.trigger(u.a.QUALITY_CHANGE_REQUESTED,{oldQuality:t,newQuality:i,reason:a},{streamId:o.id,mediaType:e});const c=N.getAverageThroughput(e);isNaN(c)||R.setSavedBitrateSettings(e,c)}}function j(e,t){g[e].state=t}function V(e,t,n){const i=e&&e.type?p[e.type].getRepresentationInfo():null;if(P.get().streaming.abr.useDeadTimeLatency&&n&&i&&i.fragmentDuration){n/=1e3;const e=i.fragmentDuration;if(n>e)return 0;t*=1-n/e}const r=K(e);for(let e=r.length-1;e>=0;e--){if(1e3*t>=r[e].bitrate)return e}return 0}function K(e){const t=[];if(!e||!e.bitrateList)return t;const n=e.bitrateList,i=e.type;let r;for(let e=0,s=n.length;e$.NO_CHANGE){const e=r.getFragmentModel();e.getRequests({state:_.FRAGMENT_MODEL_LOADING,index:t.request.index})[0]&&(e.abortRequests(),j(n,o.ABANDON_LOAD),C[n].reset(),C[n].push({oldValue:Z(n),newValue:l.quality,confidence:1,reason:l.reason}),Y(n,c.getActiveStreamInfo(),l.quality,l.reason),clearTimeout(m),m=setTimeout(()=>{j(n,o.ALLOW_LOAD),m=null},P.get().streaming.abandonLoadTimeout))}}}return i={isPlayingAtTopQuality:function(e){const t=e?e.id:null,n=Z(s.a.AUDIO),i=Z(s.a.VIDEO);return n===G(s.a.AUDIO,t)&&i===G(s.a.VIDEO,t)},updateTopQualityIndex:function(e){const t=e.type,n=e.streamInfo.id,i=e.representationCount-1;return function(e,t,n){h[t]=h[t]||{},h[t][e]=n}(t,n,i),i},getThroughputHistory:function(){return N},getBitrateList:K,getQualityForBitrate:V,getTopBitrateInfoFor:function(e){if(e&&p&&p[e]){const t=p[e].getStreamInfo();if(t&&t.id){const n=G(e,t.id),i=K(p[e].getMediaInfo());return i[n]?i[n]:null}}return null},getMaxAllowedIndexFor:z,getMinAllowedIndexFor:H,getInitialBitrateFor:function(e){if(function(){if(!R||!R.hasOwnProperty("getSavedBitrateSettings"))throw new Error(s.a.MISSING_CONFIG_ERROR)}(),e===s.a.TEXT||e===s.a.FRAGMENTED_TEXT)return NaN;const t=R.getSavedBitrateSettings(e);let n=P.get().streaming.abr.initialBitrate[e],i=P.get().streaming.abr.initialRepresentationRatio[e];if(-1===n)if(i>-1){const t=b.getAdaptationForType(0,e).Representation_asArray;if(Array.isArray(t)){n=t[Math.max(Math.round(t.length*i)-1,0)].bandwidth}else n=0}else n=isNaN(t)?e===s.a.VIDEO?1e3:100:t;return n},getQualityFor:Z,getAbandonmentStateFor:function(e){return g[e]?g[e].state:null},setPlaybackQuality:Y,checkPlaybackQuality:function(t){if(t&&p&&p[t]){const n=p[t].getStreamInfo(),s=n?n.id:null,l=Z(t),u=De(e).create({abrController:i,streamProcessor:p[t],currentValue:l,switchHistory:C[t],droppedFramesHistory:D,useBufferOccupancyABR:W(t),useL2AABR:X(t),useLoLPABR:Q(t),videoModel:A});if(D){const e=A.getPlaybackQuality();e&&D.push(w,e)}if(P.get().streaming.abr.autoSwitchBitrate[t]){const e=H(t),n=G(t,s),i=a.getMaxQuality(u);let c=i.quality;if(void 0!==e&&(c>$.NO_CHANGE?c:l)n&&(c=n),C[t].push({oldValue:l,newValue:c}),c>$.NO_CHANGE&&c!=l)(g[t].state===o.ALLOW_LOAD||c>l)&&q(t,l,c,n,i.reason);else if(P.get().debug.logLevel===d.a.LOG_LEVEL_DEBUG){const e=x.getCurrentBufferLevel(t,!0);r.debug("["+t+"] stay on "+l+"/"+n+" (buffer: "+e+")")}}}},getTopQualityIndexFor:G,setElementSize:J,setWindowResizeEventCalled:function(e){E=e},createAbrRulesCollection:U,registerStreamType:function(t,r){C[t]=C[t]||Me(e).create(),p[t]=r,g[t]=g[t]||{},g[t].state=o.ALLOW_LOAD,M[t]=!1,L[t]=!1,O[t]=!1,n.on(u.a.LOADING_PROGRESS,ee,i),t===s.a.VIDEO&&(n.on(u.a.QUALITY_CHANGE_RENDERED,B,i),D=D||Oe(e).create(),J()),n.on(u.a.METRIC_ADDED,k,i),n.on(u.a.PERIOD_SWITCH_COMPLETED,U,i),N=N||Pe(e).create({settings:P})},unRegisterStreamType:function(e){delete p[e]},setConfig:function(e){e&&(e.streamController&&(c=e.streamController),e.domStorage&&(R=e.domStorage),e.mediaPlayerModel&&(I=e.mediaPlayerModel),e.dashMetrics&&(x=e.dashMetrics),e.adapter&&(b=e.adapter),e.videoModel&&(A=e.videoModel),e.settings&&(P=e.settings))},reset:function(){F(),n.off(u.a.LOADING_PROGRESS,ee,i),n.off(u.a.QUALITY_CHANGE_RENDERED,B,i),n.off(u.a.METRIC_ADDED,k,i),n.off(u.a.PERIOD_SWITCH_COMPLETED,U,i),a&&a.reset()}},r=t.getLogger(i),F(),i}Ue.__dashjs_factory_name="AbrController";const Fe=c.a.getSingletonFactory(Ue);Fe.QUALITY_DEFAULT=0,c.a.updateSingletonFactory(Ue.__dashjs_factory_name,Fe);var Be=Fe;function ke(){let e={};return{save:function(t){const n=t.streamId,i=t.representationId;e[n]=e[n]||{},e[n][i]=t},extract:function(t,n){return e&&e[t]&&e[t][n]?e[t][n]:null},reset:function(){e={}}}}ke.__dashjs_factory_name="InitCache";var Ge=c.a.getSingletonFactory(ke);function ze(e){e=e||{};const t=this.context,n=Object(l.a)(t).getInstance(),i=e.errHandler,r=e.fragmentModel,a=e.representationController,c=e.mediaController,h=e.adapter,f=e.textController,p=e.abrController,g=e.playbackController,m=e.streamInfo,T=e.type,S=e.settings;let b,A,v,I,R,w,C,D,N,M,L,x,P,U,F,B,k,G,z,H,Y,q,V;function W(e){return h.convertDataToRepresentationInfo(a.getRepresentationForQuality(e))}function X(e,n){if(!G||!e)return null;const s=e[0];if(C)try{M=n&&n[T]?j(t).create(C,s,ee.bind(this),n[T]):j(t).create(C,s,ee.bind(this),null),S.get().streaming.useAppendWindow&&M.updateAppendWindow(m),"function"==typeof M.getBuffer().initialize&&M.getBuffer().initialize(T,m,e,r)}catch(e){A.fatal("Caught error on create SourceBuffer: "+e),i.error(new E.a(O.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,O.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+T))}else M=K(t).create(ee.bind(this));return me(W(v)),M}function Q(e){A.info("Init fragment finished loading saving to",T+"'s init cache"),G.save(e.chunk),A.debug("Append Init fragment",T," with representationId:",e.chunk.representationId," and quality:",e.chunk.quality,", data size:",e.chunk.bytes.byteLength),Z(e.chunk)}function $(e){const t=e.chunk;if(q){V=t;const e=M&&M.getAllBufferRanges();e&&e.length>0&&g.getTimeToStreamEnd()>S.get().streaming.stallThreshold&&(A.debug("Clearing buffer because track changed - "+(e.end(e.length-1)+.5)),fe([{start:0,end:e.end(e.length-1)+.5,force:!0}]))}else Z(t)}function Z(e){M.append(e),e.mediaInfo.type===s.a.VIDEO&&Ie(u.a.VIDEO_CHUNK_RECEIVED,{chunk:e})}function J(e){if(e&&e.length>0)for(let t=0,n=e.length;t0)){const e=Math.max(.2*w,1),t=w-e,n=Math.min(S.get().streaming.bufferTimeAtTopQuality,.9*t),i=Math.min(S.get().streaming.bufferTimeAtTopQualityLongForm,.9*t),r={streaming:{bufferToKeep:parseFloat(e.toFixed(5)),bufferTimeAtTopQuality:parseFloat(n.toFixed(5)),bufferTimeAtTopQualityLongForm:parseFloat(i.toFixed(5))}};S.update(r)}return void(22!==e.error.code&&ve()||(A.warn("Clearing playback buffer to overcome quota exceed situation"),Ie(u.a.QUOTA_EXCEEDED,{criticalBufferLevel:w,quotaExceededTime:e.chunk.start}),fe(he())))}k=!1,U=e.chunk,U&&!isNaN(U.index)&&(D=Math.max(U.index,D),ue());const t=M.getAllBufferRanges();if(U.segmentType===y.a.MEDIA_SEGMENT_TYPE)J(t),re(),function(){if(T!==s.a.AUDIO&&T!==s.a.VIDEO)return;if(isNaN(z))return;const e=g.getTime();let t=oe(z,0);if(e===z&&t)return;const n=a.getCurrentRepresentation().segmentDuration;if(t=oe(z,n),!t)return;Math.abs(e-z)>n?z<=t.end&&(g.seek(Math.max(z,t.start),!1,!0),z=NaN):e0&&(n=!0),x=null),U&&!n&&Ie(U.endFragment?u.a.BYTES_APPENDED_END_FRAGMENT:u.a.BYTES_APPENDED,{quality:U.quality,startTime:U.start,index:U.index,bufferedRanges:t,mediaType:T})}function te(e){v!==e.newQuality&&(me(this.getRepresentationInfo(e.newQuality)),v=e.newQuality)}function ne(e){M&&(z=e.seekTime,I&&(H=!0,I=!1,N=Number.POSITIVE_INFINITY),T!==s.a.FRAGMENTED_TEXT?function(){if(!M)return;M.waitForUpdateEnd(()=>{const e=function(){if(!M)return;const e=[],t=M.getAllBufferRanges();if(!t||0===t.length)return e;const n=g.getTime(),i=t.end(t.length-1)+.5,s=r.getRequests({state:_.FRAGMENT_MODEL_EXECUTED,time:n,threshold:.01})[0];if(s){const n={start:0,end:s.startTime-S.get().streaming.stallThreshold},a=r.getRequests({state:_.FRAGMENT_MODEL_EXECUTED,time:s.startTime-s.duration/2,threshold:.01})[0];a&&a.startTime!=s.startTime&&(n.end=a.startTime),n.startt.start(0)&&e.push(n);const o={start:s.startTime+s.duration+S.get().streaming.stallThreshold,end:i},l=r.getRequests({state:_.FRAGMENT_MODEL_EXECUTED,time:s.startTime+s.duration+S.get().streaming.stallThreshold,threshold:.01})[0];l&&l.startTime!==s.startTime&&(o.start=l.startTime+l.duration+S.get().streaming.stallThreshold),o.start=s&&e=N-1&&!I&&void 0===M.discharge&&(I=!0,A.debug("checkIfBufferingCompleted trigger BUFFERING_COMPLETED for "+T),Ie(u.a.BUFFERING_COMPLETED))}function ce(){T!==s.a.AUDIO&&T!==s.a.VIDEO&&T!==s.a.MESH||(H&&!I&&R>0&&g&&g.getTimeToStreamEnd()-R<.1&&(H=!1,I=!0,A.debug("checkIfSufficientBuffer trigger BUFFERING_COMPLETED for type "+T),Ie(u.a.BUFFERING_COMPLETED)),(!S.get().streaming.lowLatencyEnabled&&R=m.manifestInfo.minBufferTime)&&de(o.BUFFER_LOADED))}function de(e){P===e||e===o.BUFFER_EMPTY&&0===g.getTime()||T===s.a.FRAGMENTED_TEXT&&!f.isTextEnabled()||(P=e,Ie(u.a.BUFFER_LEVEL_STATE_CHANGED,{state:e}),Ie(e===o.BUFFER_LOADED?u.a.BUFFER_LOADED:u.a.BUFFER_EMPTY),A.debug(e===o.BUFFER_LOADED?"Got enough buffer to start":"Waiting for more buffer before starting playback"))}function he(){const e=[],t=M.getAllBufferRanges();if(!t||0===t.length)return e;const n=g.getTime();let i=Math.max(0,n-S.get().streaming.bufferToKeep);const s=r.getRequests({state:_.FRAGMENT_MODEL_EXECUTED,time:n,threshold:.01})[0];if(s)i=Math.min(s.startTime,i);else if(0===n&&g.getIsDynamic())return[];if(t.start(0)<=i){const n={start:0,end:i};for(let e=0;e0&&g.getTimeToStreamEnd()>S.get().streaming.stallThreshold&&(I=!1,N=Number.POSITIVE_INFINITY))}function Te(){F++;F*(S.get().streaming.wallclockTimeUpdateInterval/1e3)>=S.get().streaming.bufferPruningInterval&&(F=0,M&&T!==s.a.FRAGMENTED_TEXT&&(I||fe(he())))}function Se(){ce()}function be(e,t){C=e,M&&t&&"function"==typeof M.discharge&&(L=M,X(t))}function Ae(){const e=M.getAllBufferRanges();let t,n,i=0;if(!e)return i;for(n=0,t=e.length;n0){let t="Beginning "+T+"PreBuffer discharge, adding buffer for:";for(let n=0;n=a.get().streaming.longFormContentDurationThreshold?a.get().streaming.bufferTimeAtTopQualityLongForm:a.get().streaming.bufferTimeAtTopQuality}else c=n.getStableBufferTime()}return c}return{execute:function(e,n,i){return!e||!n||t.getCurrentBufferLevel(e)=t&&r!==o.ABANDON_LOAD?(W(n),z=!0,A.debug("Reloading outdated fragment at index: ",n.index)):n.quality>P.quality&&!B&&ue(f.getTime()+i)}}();const e=U.length>0,t=P?P.quality:NaN;if(B||isNaN(t)||F||e||function(e,t){x[t]=x[t]||{};const n=h.getTopQualityIndexFor(e,t);return x[t][e]!=n&&(A.info("Top quality "+e+" index has changed from "+x[t][e]+" to "+n),x[t][e]=n,!0)}(g,b.id)||L.execute(g,v,M)){const i=function(){if(v.quality===t&&!F||B){const e=U.shift();e&&e.isInitializationRequest()?(n.trigger(u.a.INIT_FRAGMENT_NEEDED,{representationId:e.representationId,sender:S},{streamId:b.id,mediaType:g}),G=!1):(n.trigger(u.a.MEDIA_FRAGMENT_NEEDED,{seekTarget:N,replacement:e},{streamId:b.id,mediaType:g}),G=!0)}else F?(A.debug("Switch track for "+g+", representation id = "+v.id),B=E.getSwitchMode(g)===s.a.TRACK_SWITCH_MODE_ALWAYS_REPLACE,B&&y.replaceBuffer&&y.replaceBuffer(),F=!1):A.debug("Quality has changed, get init request for representationid = "+v.id),n.trigger(u.a.INIT_FRAGMENT_NEEDED,{representationId:v.id,sender:S},{streamId:b.id,mediaType:g}),G=!1};K(!0),!e&&G&&h.checkPlaybackQuality(g),i()}else V(500)}function V(e){clearTimeout(D),D=setTimeout(j,e)}function K(e){w!==e?w=e:A.debug("isFragmentProcessingInProgress is already equal to",e)}function W(e){U.push(e)}function X(e){if(f&&c){const t=c.getRequests({state:_.FRAGMENT_MODEL_EXECUTED,time:f.getTime(),threshold:0})[0];t&&f.getTime()>=t.startTime&&((!O.mediaInfo||t.mediaInfo.type===O.mediaInfo.type&&t.mediaInfo.id!==O.mediaInfo.id)&&e&&n.trigger(u.a.TRACK_CHANGE_RENDERED,{mediaType:g,oldMediaInfo:O.mediaInfo,newMediaInfo:t.mediaInfo}),t.quality===O.quality&&t.adaptationIndex===O.adaptationIndex||!e||n.trigger(u.a.QUALITY_CHANGE_RENDERED,{mediaType:g,oldQuality:O.quality,newQuality:t.quality}),O={mediaInfo:t.mediaInfo,quality:t.quality,adaptationIndex:t.adaptationIndex})}}function Q(){q(),K(!1),A.info(`Stream ${b.id} is complete`)}function $(e){e.request.mediaInfo.streamInfo.id===b.id&&e.request.mediaType===g&&(A.info("OnFragmentLoadingCompleted - Url:",e.request?e.request.url:"undefined",e.request.range?", Range:"+e.request.range:""),i.getIsTextTrack(m)&&K(!1),e.error&&e.request.serviceLocation&&!R&&(W(e.request),K(!1),V(0)),B&&(k=e.request))}function Z(){X(!0)}function J(e){if(B&&!isNaN(e.startTime)&&(B=!1,c.addExecutedRequest(k)),K(!1),isNaN(e.index)&&(P=y.getRepresentationInfo(e.quality),A.info("["+g+"] lastInitializedRepresentationInfo changed to "+e.quality)),z&&!isNaN(e.startTime)){const t=f.getTime(),n=e.startTime+v.fragmentDuration,i=1.5*v.fragmentDuration;V(t+i>=n?0:1e3*(n-(t+i))),z=!1}else V(0)}function ee(e){A.info("onFragmentLoadingAbandoned request: "+e.request.url+" has been aborted"),f.isSeeking()||F||(A.info("onFragmentLoadingAbandoned request: "+e.request.url+" has to be downloaded again, origin is not seeking process or switch track call"),W(e.request)),K(!1),V(0)}function te(){}function ne(){q()}function ie(e){B&&T.get().streaming.flushBufferAtTrackSwitch&&f.seek(f.getTime()+.001,!1,!0),e.hasEnoughSpaceToAppend&&e.quotaExceeded&&Y()}function re(){q(),K(!1)}function se(){c.abortRequests(),q()}function ae(){!R&&T.get().streaming.scheduleWhilePaused||Y()}function oe(e){if(!b)return;ue(e.seekTime),ce(0),R&&Y();const t=v&&v.DVRWindow&&f?v.DVRWindow.end-f.getTime():NaN;r.updateManifestUpdateInfo({latency:t}),w?c.abortRequests():V(0)}function le(e){r.updatePlayListTraceMetrics({playbackspeed:e.playbackRate.toString()})}function ue(e){N=e}function ce(e){C=e}function de(){G=!0,w=!1,C=0,N=NaN,I=!0,P=void 0,O={mediaInfo:void 0,quality:NaN,adaptationIndex:NaN},x={},U=[],R=!0,F=!1,B=!1,k=null,z=!1}return S={initialize:function(e){M=e,L=We(t).create({abrController:h,dashMetrics:r,mediaPlayerModel:a,textController:p,settings:T}),n.on(u.a.DATA_UPDATE_STARTED,te,this),n.on(u.a.FRAGMENT_LOADING_COMPLETED,$,this),n.on(u.a.STREAM_COMPLETED,Q,this),n.on(u.a.BUFFER_CLEARED,ie,this),n.on(u.a.BYTES_APPENDED_END_FRAGMENT,J,this),n.on(u.a.QUOTA_EXCEEDED,re,this),n.on(u.a.PLAYBACK_SEEKING,oe,this),n.on(u.a.PLAYBACK_STARTED,ae,this),n.on(u.a.PLAYBACK_RATE_CHANGED,le,this),n.on(u.a.PLAYBACK_TIME_UPDATED,Z,this),n.on(u.a.URL_RESOLUTION_FAILED,se,this),n.on(u.a.FRAGMENT_LOADING_ABANDONED,ee,this),n.on(u.a.BUFFERING_COMPLETED,ne,this)},getType:function(){return g},getStreamId:function(){return b.id},setCurrentRepresentation:function(e){v=e},setSeekTarget:ue,setTimeToLoadDelay:ce,getTimeToLoadDelay:function(){return C},switchTrackAsked:function(){F=!0},isStarted:H,start:Y,stop:q,reset:function(){n.off(u.a.DATA_UPDATE_STARTED,te,this),n.off(u.a.FRAGMENT_LOADING_COMPLETED,$,this),n.off(u.a.STREAM_COMPLETED,Q,this),n.off(u.a.BUFFER_CLEARED,ie,this),n.off(u.a.BYTES_APPENDED_END_FRAGMENT,J,this),n.off(u.a.QUOTA_EXCEEDED,re,this),n.off(u.a.PLAYBACK_SEEKING,oe,this),n.off(u.a.PLAYBACK_STARTED,ae,this),n.off(u.a.PLAYBACK_RATE_CHANGED,le,this),n.off(u.a.PLAYBACK_TIME_UPDATED,Z,this),n.off(u.a.URL_RESOLUTION_FAILED,se,this),n.off(u.a.FRAGMENT_LOADING_ABANDONED,ee,this),n.off(u.a.BUFFERING_COMPLETED,ne,this),q(),X(!1),de(),b=null},getBufferTarget:function(){return L.getBufferTarget(g,v,M)},processInitRequest:function(e){e&&(K(!0),c.executeRequest(e))},processMediaRequest:function(e){e?(A.debug("Next fragment request url is "+e.url),c.executeRequest(e)):(f.getIsDynamic()&&A.debug("Next fragment seems to be at the bleeding live edge and is not available yet. Rescheduling."),K(!1),V(T.get().streaming.lowLatencyEnabled?100:500))},getPlaybackController:function(){return f}},A=Object(d.a)(t).getInstance().getLogger(S),de(),b=e.streamInfo,S}Xe.__dashjs_factory_name="ScheduleController";var Qe=c.a.getClassFactory(Xe);function $e(e){const t=(e=e||{}).eventBus,n=e.events,i=e.errors,r=e.abrController,a=e.dashMetrics,o=e.playbackController,l=e.timelineConverter,u=e.type,c=e.streamInfo,d=e.dashConstants;let h,f,p,g,m;function _(){return u}function y(){if(!(r&&a&&o&&l))throw new Error(s.a.MISSING_CONFIG_ERROR)}function T(){return p}function S(){return m}function b(){f=null,p=!0,g=[]}function A(){y();const e=new Date,t=S(),n=1e3*o.getTime();t&&a.addRepresentationSwitch(t.adaptation.type,e,n,t.id)}function v(e){return null==e||e>=g.length?null:g[e]}function I(e,t){if(e.segmentAvailabilityRange=l.calcSegmentAvailabilityRange(e,t),e.segmentAvailabilityRange.end{e.segmentAvailabilityRange=null}),R(o.getIsDynamic(),!0))}),i)}function N(e){if(!T())return;if(e.error)return void C(e.error);let t,n,s,l=e.representation,u=a.getCurrentManifestUpdate(),h=!1,f=0;if(l.adaptation.period.mpd.manifest.type===d.DYNAMIC&&!l.adaptation.period.mpd.manifest.ignorePostponeTimePeriod&&o.getStreamController().getStreams().length<=1&&(f=function(e){try{const t=o.getStreamController().getActiveStreamInfo();let n=e.segmentAvailabilityRange.start;t&&t.id&&t.id!==c.id&&(n=Math.min(o.getTime(),n));let i=e.segmentAvailabilityRange.end-n;return 1e3*(o.getLiveDelay()-i)}catch(e){return 0}}(l)),f>0)return D(f),n=new E.a(i.SEGMENTS_UPDATE_FAILED_ERROR_CODE,i.SEGMENTS_UPDATE_FAILED_ERROR_MESSAGE),void C(n);if(u){for(let e=0;eF.getTime()&&(T=e.from,b=!0)}function Q(e){T=e.quotaExceededTime,b=!0}function $(){const e=R.manifestInfo,t=e.isDynamic,n=N.calcSegmentAvailabilityRange(g.getCurrentRepresentation(),t);G.addDVRInfo(Y(),F.getTime(),e,n)}function Z(){return h?h.getBuffer():null}function J(){return c}function ee(){return r}function te(e){let t;return void 0!==e?(Object(v.a)(e),t=g?g.getRepresentationForQuality(e):null):t=g?g.getCurrentRepresentation():null,M.convertDataToRepresentationInfo(t)}function ne(e){if(e.sender&&(!M.getIsTextTrack(D)||k.isTextEnabled())&&h&&e.representationId&&!h.appendInitSegment(e.representationId)){const e=y?y.getInitRequest(ee(),g.getCurrentRepresentation()):null;f.processInitRequest(e)}}function ie(e){let t;h.getIsPruningInProgress()||(t=function(e,t){const n=te(),i=!isNaN(e),r=F.getNormalizedTime();let a,o=i?e:T,l=!1;if(isNaN(o)||Y()===s.a.FRAGMENTED_TEXT&&!k.isTextEnabled())return null;if(h){let e=h.getRangeAt(o);const t=h.getRangeAt(r);if((null!==e||null!==t)&&!i&&(!e||t&&t.start!=e.start&&t.end!=e.end)){h.getBuffer().hasDiscontinuitiesAfter(r)&&Y()!==s.a.FRAGMENTED_TEXT&&(P.removeExecutedRequestsAfterTime(t.end),l=!0)}}if(t)o=t.startTime+t.duration/2,a=ae(n,o,{timeThreshold:0,ignoreIsFinished:!0});else{const e=i||b||l;for(a=ae(n,e?o:void 0,{keepIdx:!e}),b=!1;a&&a.action!==p.a.ACTION_COMPLETE&&P.isFragmentLoaded(a);)a=ae(n)}return a}(e.seekTarget,e.replacement),t&&(f.setSeekTarget(NaN),e.replacement||(isNaN(t.startTime+t.duration)||(T=t.startTime+t.duration),t.delayLoadingTime=(new Date).getTime()+f.getTimeToLoadDelay(),f.setTimeToLoadDelay(0)))),f.processMediaRequest(t)}function re(e){const t=e.chunk,n=t.bytes,i=t.quality,r=te(i),s=g&&r?g.getRepresentationForQuality(r.quality):null,a=M.getEventsFor(r.mediaInfo),o=M.getEventsFor(r,s);if(a&&a.length>0||o&&o.length>0){const e=function(e,t,n,i){try{const r={},s=[],a=n.concat(i);for(let e=0,t=a.length;ei&&(o=i),y.setMimeType(r?r.mimeType:null),g.updateData(t,n,w,o)}},addMediaInfo:function(e,t){-1===c.indexOf(e)&&c.push(e),t&&this.selectMediaInfo(e)},getLiveStartTime:function(){if(!i)return NaN;if(!m)return NaN;let e=NaN;const t=te(),r=m.getLiveEdge(t);if(isNaN(r))return NaN;const s=function(e,t){try{let i=null,r=F.getLiveDelay();const s=isNaN(R.manifestInfo.DVRWindowSize)?r:R.manifestInfo.DVRWindowSize,a=.1*s;let o;if(!isFinite(s)||ae(t,e-s+a,{ignoreIsFinished:!0}))for(;!i&&r<=s;)o=e-r,i=ae(t,o,{ignoreIsFinished:!0}),i||(r+=1);return i&&F.setLiveDelay(r,!0),n.debug("live edge: "+e+", live delay: "+r+", live target: "+o),i}catch(e){return null}}(r,t);return s&&(e=z.get().streaming.lowLatencyEnabled?s.durationn>0&&nn>0&&n1){for(let e=0;en.bytes>t/4/e.length)).length>1){let t=0;const n=(e[e.length-1].ts-e[0].ts)/e.length;return e.forEach((i,r)=>{const s=e[r+1];if(s){const e=s.ts-i.ts;t+=e0){if(d=function(e,t){if(0===e.length)return t;const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}(d,t),u+=t.length,f.push({ts:Date.now(),bytes:t.length}),_===s.a.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING&&m){i.findLastTopIsoBoxCompleted(["moof"],d,h).found&&(m=!1,p.push({ts:performance.now(),bytes:t.length}))}const n=i.findLastTopIsoBoxCompleted(["moov","mdat"],d,h);if(n.found){const t=n.lastCompletedOffset+n.size;let i;_===s.a.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING&&(m=!0,g.push({ts:performance.now(),bytes:d.length})),t===d.length?(i=d,d=new Uint8Array):(i=new Uint8Array(d.subarray(0,t)),d=d.subarray(t)),e.progress({data:i.buffer,lengthComputable:!1,noTrace:!0}),h=0}else h=n.lastCompletedOffset,c||(e.progress({lengthComputable:!1,noTrace:!0}),c=!0)}o(e,E)};o(e,E)})).catch((function(t){e.onerror&&e.onerror(t)}))},abort:function(e){if(e.abortController)e.abortController.abort();else if(e.reader)try{e.reader.cancel(),e.onabort()}catch(e){}},calculateDownloadedTime:l},a}pt.__dashjs_factory_name="FetchLoader";var gt=c.a.getClassFactory(pt),mt=n(14);var _t=class{constructor(){this.id=null,this.index=-1,this.adaptation=null,this.segmentInfoType=null,this.initialization=null,this.codecs=null,this.codecPrivateData=null,this.segmentDuration=NaN,this.timescale=1,this.startNumber=1,this.indexRange=null,this.range=null,this.presentationTimeOffset=0,this.MSETimeOffset=NaN,this.segmentAvailabilityRange=null,this.availableSegmentsNumber=0,this.bandwidth=NaN,this.width=NaN,this.height=NaN,this.scanType=null,this.maxPlayoutRate=NaN,this.availabilityTimeOffset=0,this.availabilityTimeComplete=!0}hasInitialization(){return null!==this.initialization||null!==this.range}hasSegments(){return this.segmentInfoType!==a.a.BASE_URL&&this.segmentInfoType!==a.a.SEGMENT_BASE&&!this.indexRange}};var Et=class{constructor(){this.period=null,this.index=-1,this.type=null}};class yt{constructor(){this.id=null,this.index=-1,this.duration=NaN,this.start=NaN,this.mpd=null}}yt.DEFAULT_ID="defaultId";var Tt=yt;var St=class{constructor(){this.manifest=null,this.suggestedPresentationDelay=0,this.availabilityStartTime=null,this.availabilityEndTime=Number.POSITIVE_INFINITY,this.timeShiftBufferDepth=Number.POSITIVE_INFINITY,this.maxSegmentDuration=Number.POSITIVE_INFINITY,this.publishTime=null,this.minimumUpdatePeriod=NaN,this.mediaPresentationDuration=NaN}};var bt=class{constructor(){this.schemeIdUri="",this.value=""}};var At=class{constructor(){this.duration=NaN,this.presentationTime=NaN,this.id=NaN,this.messageData="",this.eventStream=null,this.presentationTimeDelta=NaN}};class vt{constructor(e,t,n,i){this.url=e||"",this.serviceLocation=t||e||"",this.dvb_priority=n||1,this.dvb_weight=i||1,this.availabilityTimeOffset=0,this.availabilityTimeComplete=!0}}vt.DEFAULT_DVB_PRIORITY=1,vt.DEFAULT_DVB_WEIGHT=1;var It=vt;var Rt=class{constructor(){this.adaptionSet=null,this.representation=null,this.period=null,this.timescale=1,this.value="",this.schemeIdUri="",this.presentationTimeOffset=0}},wt=n(25);function Ct(){let e,t,n,i;const r=this.context,o=Object(rt.a)(r).getInstance(),l=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e};function u(e,t){let n,i,r,o,l,u,c=!1,d=!1;if(!e)throw new Error("adaptation is not defined");if(!t)throw new Error("type is not defined");if(e.hasOwnProperty("ContentComponent_asArray")&&(o=e.ContentComponent_asArray),l=t!==s.a.TEXT?new RegExp(t):new RegExp("(vtt|ttml)"),e.Representation_asArray&&e.Representation_asArray.length&&e.Representation_asArray.length>0){let n=A(e.Representation_asArray[0]);if(n&&n.length>0&&wt.a.indexOf(n[0].schemeIdUri)>=0)return t===s.a.IMAGE;if(e.Representation_asArray[0].hasOwnProperty(a.a.CODECS)&&(u=e.Representation_asArray[0].codecs,0===u.search(s.a.STPP)||0===u.search(s.a.WVTT)))return t===s.a.FRAGMENTED_TEXT}if(o){if(o.length>1)return t===s.a.MUXED;o[0]&&o[0].contentType===t&&(c=!0,d=!0)}if(e.hasOwnProperty(a.a.MIME_TYPE)&&(c=l.test(e.mimeType),d=!0),!d)for(n=0,i=e.Representation_asArray&&e.Representation_asArray.length?e.Representation_asArray.length:0;!d&&ne.bandwidth-t.bandwidth}function y(e){return e&&Array.isArray(e.Representation_asArray)&&e.Representation_asArray.sort((e,t)=>e.bandwidth-t.bandwidth),e}function T(e,t){return e&&e.Period_asArray&&l(t)&&e.Period_asArray[t]?e.Period_asArray[t].AdaptationSet_asArray:[]}function S(e){return e&&e.Period_asArray?e.Period_asArray:[]}function b(e){let t=!1;return e&&e.hasOwnProperty("type")&&(t=e.type===a.a.DYNAMIC),t}function A(e){return e&&e.EssentialProperty_asArray&&e.EssentialProperty_asArray.length?e.EssentialProperty_asArray.map(e=>({schemeIdUri:e.schemeIdUri,value:e.value})):null}function v(e){let t=e.S_asArray[0],n=e.S_asArray[1];return t.hasOwnProperty("d")?t.d:n.t-t.t}function I(e){const t=e.presentationTimeOffset;return e.adaptation.period.start-t}function R(e,t){if(!e)throw new Error("Period cannot be null or undefined");let n=Tt.DEFAULT_ID+"_"+t;return e.hasOwnProperty(a.a.ID)&&e.id.length>0&&"__proto__"!==e.id&&(n=e.id),n}function w(e,t){const n=[];let i;if(!e)return n;for(i=0;i{if(n){const r=new It;let s=n.__text||n;return o.isRelative(s)&&(i=!0,e.baseUri&&(s=o.resolve(s,e.baseUri))),r.url=s,n.hasOwnProperty(a.a.SERVICE_LOCATION)&&n.serviceLocation.length?r.serviceLocation=n.serviceLocation:r.serviceLocation=s,n.hasOwnProperty(a.a.DVB_PRIORITY)&&(r.dvb_priority=n[a.a.DVB_PRIORITY]),n.hasOwnProperty(a.a.DVB_WEIGHT)&&(r.dvb_weight=n[a.a.DVB_WEIGHT]),n.hasOwnProperty(a.a.AVAILABILITY_TIME_OFFSET)&&(r.availabilityTimeOffset=n[a.a.AVAILABILITY_TIME_OFFSET]),n.hasOwnProperty(a.a.AVAILABILITY_TIME_COMPLETE)&&(r.availabilityTimeComplete="false"!==n[a.a.AVAILABILITY_TIME_COMPLETE]),t.push(r),i}}),t}return e={getIsTypeOf:u,getIsTextTrack:g,getLanguageForAdaptation:function(e){let t="";return e&&e.hasOwnProperty(a.a.LANG)&&(t=e.lang.replace(/[^A-Za-z0-9-]/g,"")),t},getViewpointForAdaptation:function(e){return e&&e.hasOwnProperty(a.a.VIEWPOINT)?e.Viewpoint:null},getRolesForAdaptation:function(e){return e&&e.hasOwnProperty(a.a.ROLE_ASARRAY)?e.Role_asArray:[]},getAccessibilityForAdaptation:function(e){return e&&e.hasOwnProperty(a.a.ACCESSIBILITY_ASARRAY)?e.Accessibility_asArray:[]},getAudioChannelConfigurationForAdaptation:function(e){return e&&e.hasOwnProperty(a.a.AUDIOCHANNELCONFIGURATION_ASARRAY)?e.AudioChannelConfiguration_asArray:[]},getAudioChannelConfigurationForRepresentation:function(e){return e&&e.hasOwnProperty(a.a.AUDIOCHANNELCONFIGURATION_ASARRAY)?e.AudioChannelConfiguration_asArray:[]},getAdaptationForIndex:function(e,t,n){return T(t,n).find(t=>t.index==e)},getIndexForAdaptation:function(e){return e?e.index:-1},getAdaptationForId:function(e,t,n){const i=T(t,n);let r,s;for(r=0,s=i.length;r0&&l(e)?n[e]:null},getCodec:function(e,t,n){let i=null;if(e&&e.Representation_asArray&&e.Representation_asArray.length>0){const r=l(t)&&t>=0&&t0?e.Representation_asArray[0].mimeType:null},getKID:function(e){return e&&e.hasOwnProperty(a.a.CENC_DEFAULT_KID)?e[a.a.CENC_DEFAULT_KID]:null},getLabelsForAdaptation:function(e){if(!e||!Array.isArray(e.Label_asArray))return[];const t=[];for(let n=0;n0&&(n=-1!==e.profiles.indexOf(t)),n},getDuration:function(e){let t;return t=e&&e.hasOwnProperty(a.a.MEDIA_PRESENTATION_DURATION)?e.mediaPresentationDuration:e&&"dynamic"==e.type?Number.POSITIVE_INFINITY:Number.MAX_SAFE_INTEGER||Number.MAX_VALUE,t},getBandwidth:function(e){return e&&e.bandwidth?e.bandwidth:NaN},getManifestUpdatePeriod:function(e,t=0){let n=NaN;return e&&e.hasOwnProperty(a.a.MINIMUM_UPDATE_PERIOD)&&(n=e.minimumUpdatePeriod),isNaN(n)?n:Math.max(n-t,1)},getPublishTime:function(e){return e&&e.hasOwnProperty(a.a.PUBLISH_TIME)?new Date(e[a.a.PUBLISH_TIME]):null},getRepresentationCount:function(e){return e&&Array.isArray(e.Representation_asArray)?e.Representation_asArray.length:0},getBitrateListForAdaptation:function(e){const t=y(e);return(t&&Array.isArray(t.Representation_asArray)?t.Representation_asArray:[]).map(e=>({bandwidth:e.bandwidth,width:e.width||0,height:e.height||0,scanType:e.scanType||null,id:e.id||null}))},getRepresentationFor:function(e,t){return t&&t.Representation_asArray&&t.Representation_asArray.length>0&&l(e)?t.Representation_asArray[e]:null},getRepresentationsForAdaptation:function(e){const t=[],n=function(e){if(e&&e.period&&l(e.period.index)){const t=e.period.mpd.manifest.Period_asArray[e.period.index];if(t&&t.AdaptationSet_asArray&&l(e.index))return y(t.AdaptationSet.find(t=>t.index===e.index))}}(e);let i,r;if(n&&n.Representation_asArray){if(e&&e.period&&l(e.period.index)){const t=C(e.period.mpd.manifest);t&&(r=t[0])}for(let s=0,o=n.Representation_asArray.length;se.localeCompare(t)),n=t.length;let i=t.reduce((t,i,r)=>{if("v"===i&&1===e[i])return t;if("string"!=typeof e[i]||"ot"===i&&"sf"===i&&"st"===i)t+=`${i}=${e[i]}`;else{t+=`${i}="${e[i].replace(/"/g,'"')}"`}return r0){try{if(g.get().streaming.utcSynchronization.enableBackgroundSyncAfterSegmentDownloadError&&d.type===y.a.MEDIA_SEGMENT_TYPE){r.getRetryAttemptsForType(y.a.MEDIA_SEGMENT_TYPE)===l&&p.trigger(u.a.ATTEMPT_BACKGROUND_SYNC)}}catch(e){}l--;let t={config:e};S.push(t),t.timeout=setTimeout((function(){-1!==S.indexOf(t)&&(S.splice(S.indexOf(t),1),I(e,l))}),r.getRetryIntervalsForType(d.type))}else{if(d.type===y.a.MSS_FRAGMENT_INFO_SEGMENT_TYPE)return;n.error(new E.a(b[d.type],d.url+" is not available",{request:d,response:m.response})),e.error&&e.error(d,"error",m.response.statusText),e.complete&&e.complete(d,m.response.statusText)}};let O;O=c&&window.fetch&&"arraybuffer"===d.responseType&&d.type===y.a.MEDIA_SEGMENT_TYPE?gt(t).create({requestModifier:a,boxParser:o}):Object(ct.a)(t).create({requestModifier:a});let x=null,P=a.modifyRequestURL(d.url);if(g.get().streaming.cmcd&&g.get().streaming.cmcd.enabled){const e=g.get().streaming.cmcd.mode;if(e===s.a.CMCD_MODE_QUERY){const e=function(e){try{const t=[],n=A.getQueryParameter(e);return n&&t.push(n),t}catch(e){return[]}}(d);P=dt.a.addAditionalQueryParameterToUrl(P,e)}else e===s.a.CMCD_MODE_HEADER&&(x=A.getHeaderParameters(d))}const U=d.checkExistenceOnly?y.a.HEAD:y.a.GET,F=r.getXHRWithCredentialsForType(d.type);m={url:P,method:U,withCredentials:F,request:d,onload:function(){m.response.status>=200&&m.response.status<=299&&(M(!0),e.success&&e.success(m.response.response,m.response.statusText,m.response.responseURL),e.complete&&e.complete(d,m.response.statusText))},onend:L,onerror:L,progress:function(t){const n=new Date;R&&(R=!1,(!t.lengthComputable||t.lengthComputable&&t.total!==t.loaded)&&(d.firstByteDate=n)),t.lengthComputable&&(d.bytesLoaded=t.loaded,d.bytesTotal=t.total),t.noTrace||(h.push({s:D,d:t.time?t.time:n.getTime()-D.getTime(),b:[t.loaded?t.loaded-N:0]}),D=n,N=t.loaded),e.progress&&t&&e.progress(t)},onabort:function(){e.abort&&e.abort(d)},ontimeout:function(e){let t;if(e.lengthComputable){let n=e.loaded/e.total*100;t="Request timeout: loaded: "+e.loaded+", out of: "+e.total+" : "+n.toFixed(3)+"% Completed"}else t="Request timeout: non-computable download size";v.warn(t)},loader:O,timeout:f,headers:x};let B=(new Date).getTime();if(isNaN(d.delayLoadingTime)||B>=d.delayLoadingTime)_.push(m),O.load(m);else{let e={httpRequest:m};T.push(e),e.delayTimeout=setTimeout((function(){if(-1!==T.indexOf(e)){T.splice(T.indexOf(e),1);try{C=new Date,D=C,_.push(e.httpRequest),O.load(e.httpRequest)}catch(t){e.httpRequest.onerror()}}}),d.delayLoadingTime-B)}}return m={load:function(e){e.request?I(e,r.getRetryAttemptsForType(e.request.type)):e.error&&e.error(e.request,"error")},abort:function(){S.forEach(e=>{clearTimeout(e.timeout),e.config.request&&e.config.abort&&e.config.abort(e.config.request)}),S=[],T.forEach(e=>clearTimeout(e.delayTimeout)),T=[],_.forEach(e=>{e.request.type!==y.a.MSS_FRAGMENT_INFO_SEGMENT_TYPE&&(e.onloadend=e.onerror=e.onprogress=void 0,e.loader.abort(e))}),_=[]}},v=Object(d.a)(t).getInstance().getLogger(m),_=[],T=[],S=[],A=Yt(t).getInstance(),b={[y.a.MPD_TYPE]:h.DOWNLOAD_ERROR_ID_MANIFEST_CODE,[y.a.XLINK_EXPANSION_TYPE]:h.DOWNLOAD_ERROR_ID_XLINK_CODE,[y.a.INIT_SEGMENT_TYPE]:h.DOWNLOAD_ERROR_ID_INITIALIZATION_CODE,[y.a.MEDIA_SEGMENT_TYPE]:h.DOWNLOAD_ERROR_ID_CONTENT_CODE,[y.a.INDEX_SEGMENT_TYPE]:h.DOWNLOAD_ERROR_ID_CONTENT_CODE,[y.a.BITSTREAM_SWITCHING_SEGMENT_TYPE]:h.DOWNLOAD_ERROR_ID_CONTENT_CODE,[y.a.OTHER_TYPE]:h.DOWNLOAD_ERROR_ID_CONTENT_CODE},m}qt.__dashjs_factory_name="HTTPLoader";var jt=c.a.getClassFactory(qt);function Vt(){let e,t;function n(){t={}}function i(){n()}return i(),e={getLoader:function(e){for(var n in t)if(t.hasOwnProperty(n)&&e.startsWith(n))return t[n];return jt},registerLoader:function(e,n){t[e]=n},unregisterLoader:function(e){t[e]&&delete t[e]},unregisterAllLoader:n,reset:i},e}Vt.__dashjs_factory_name="SchemeLoaderFactory";var Kt=c.a.getSingletonFactory(Vt);function Wt(e){e=e||{};const t=this.context;let n,i,r;return i=Kt(t).getInstance(),n={load:function(n){let s=i.getLoader(n&&n.request?n.request.url:null);r=s(t).create({errHandler:e.errHandler,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,useFetch:e.useFetch||null,dashMetrics:e.dashMetrics,boxParser:e.boxParser?e.boxParser:null,constants:e.constants?e.constants:null,dashConstants:e.dashConstants?e.dashConstants:null,urlUtils:e.urlUtils?e.urlUtils:null,requestTimeout:isNaN(e.requestTimeout)?0:e.requestTimeout,errors:e.errors}),r.load(n)},abort:function(){r&&r.abort()}},n}Wt.__dashjs_factory_name="URLLoader";var Xt=c.a.getClassFactory(Wt);class Qt extends p.a{constructor(e){super(e),this.checkForExistenceOnly=!0}}var $t=Qt;function Zt(e){e=e||{};const t=this.context,n=e.eventBus,i=e.events,r=e.urlUtils,a=e.errors;let o,l;return o={checkForExistence:function(e){const t=function(t){n.trigger(i.CHECK_FOR_EXISTENCE_COMPLETED,{request:e,exists:t})};if(e){let n=new $t(e.url);l.load({request:n,success:function(){t(!0)},error:function(){t(!1)}})}else t(!1)},load:function(e){const t=function(t,r){n.trigger(i.LOADING_COMPLETED,{request:e,response:t||null,error:r||null,sender:o})};e?l.load({request:e,progress:function(t){n.trigger(i.LOADING_PROGRESS,{request:e,stream:t.stream}),t.data&&n.trigger(i.LOADING_DATA_PROGRESS,{request:e,response:t.data||null,error:null,sender:o})},success:function(e){t(e)},error:function(e,n,i){t(void 0,new E.a(a.FRAGMENT_LOADER_LOADING_FAILURE_ERROR_CODE,i,n))},abort:function(e){e&&n.trigger(i.LOADING_ABANDONED,{mediaType:e.mediaType,request:e,sender:o})}}):t(void 0,new E.a(a.FRAGMENT_LOADER_NULL_REQUEST_ERROR_CODE,a.FRAGMENT_LOADER_NULL_REQUEST_ERROR_MESSAGE))},abort:function(){l&&l.abort()},reset:function(){l&&(l.abort(),l=null)}},l=Xt(t).create({errHandler:e.errHandler,errors:a,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,useFetch:e.settings.get().streaming.lowLatencyEnabled,urlUtils:r,constants:s.a,boxParser:e.boxParser,dashConstants:e.dashConstants,requestTimeout:e.settings.get().streaming.fragmentRequestTimeout}),o}Zt.__dashjs_factory_name="FragmentLoader";var Jt=c.a.getClassFactory(Zt);function en(e){e=e||{};const t=this.context,n=Object(l.a)(t).getInstance(),i=e.errHandler,r=e.mediaPlayerModel,a=e.dashMetrics,o=Object(d.a)(t).getInstance(),c=e.streamInfo;let h,f,p;function g(){for(let e in p)p[e].reset();p={}}function m(e){if(!e.sender)return;const t=e.request,i=e.response,r=t.isInitializationRequest(),a=t.mediaInfo.streamInfo;if(e.error&&(t.mediaType!==s.a.AUDIO&&t.mediaType!==s.a.VIDEO&&t.mediaType!==s.a.FRAGMENTED_TEXT||n.trigger(u.a.SERVICE_LOCATION_BLACKLIST_ADD,{entry:e.request.serviceLocation})),!i||!a)return void f.warn("No "+t.mediaType+" bytes to push or stream is inactive.");const o=function(e,t,n,i){const r=new ut;return r.streamId=n,r.mediaInfo=t.mediaInfo,r.segmentType=t.type,r.start=t.startTime,r.duration=t.duration,r.end=r.start+r.duration,r.bytes=e,r.index=t.index,r.quality=t.quality,r.representationId=t.representationId,r.endFragment=i,r}(i,t,c.id,e.type!==u.a.FRAGMENT_LOADING_PROGRESS);n.trigger(r?u.a.INIT_FRAGMENT_LOADED:u.a.MEDIA_FRAGMENT_LOADED,{chunk:o,request:t},{streamId:a.id,mediaType:t.mediaType})}return h={getStreamId:function(){return c.id},getModel:function(s){let l=p[s];return l||(l=_(t).create({streamInfo:c,type:s,dashMetrics:a,fragmentLoader:Jt(t).create({dashMetrics:a,mediaPlayerModel:r,errHandler:i,requestModifier:it(t).getInstance(),settings:e.settings,boxParser:e.boxParser,eventBus:n,events:u.a,errors:O,dashConstants:e.dashConstants,urlUtils:e.urlUtils}),debug:o,eventBus:n,events:u.a}),p[s]=l),l},reset:function(){n.off(u.a.FRAGMENT_LOADING_COMPLETED,m,this),n.off(u.a.FRAGMENT_LOADING_PROGRESS,m,this),g()}},f=o.getLogger(h),g(),n.on(u.a.FRAGMENT_LOADING_COMPLETED,m,h),n.on(u.a.FRAGMENT_LOADING_PROGRESS,m,h),h}en.__dashjs_factory_name="FragmentController";var tn=c.a.getClassFactory(en);var nn=class{constructor(){this.url=null,this.width=null,this.height=null,this.x=null,this.y=null}},rn=n(9);function sn(e){const t=this.context,n=e.streamInfo;let i,r;function a(){r&&r.reset()}return i={getStreamId:function(){return n.id},provide:function(e,t){if("function"!=typeof t)return;const n=r.getCurrentTrack();let i,s;if(!n||n.segmentDuration<=0||null==e)return void t(null);isNaN(n.segmentDuration)&&(s=r.getThumbnailRequestForTime(e),s&&(n.segmentDuration=s.duration)),i=e%n.segmentDuration;const a=Math.floor(i*n.tilesHor*n.tilesVert/n.segmentDuration),o=new nn;if(o.width=Math.floor(n.widthPerTile),o.height=Math.floor(n.heightPerTile),o.x=Math.floor(a%n.tilesHor)*n.widthPerTile,o.y=Math.floor(a/n.tilesHor)*n.heightPerTile,"readThumbnail"in n)return n.readThumbnail(e,e=>{o.url=e,t(o)});if(s)o.url=s.url,n.segmentDuration=NaN;else{const t=Math.floor(e/n.segmentDuration);o.url=function(e,t){const n=t+e.startNumber;let i=Object(rn.d)(e.templateUrl,"Number",n);return i=Object(rn.d)(i,"Time",(n-1)*e.segmentDuration*e.timescale),i=Object(rn.d)(i,"Bandwidth",e.bandwidth),Object(rn.e)(i)}(n,t)}t(o)},setTrackByIndex:function(e){r.setTrackByIndex(e)},getCurrentTrackIndex:function(){return r.getCurrentTrackIndex()},getBitrateList:function(){const e=r.getTracks();let t=0;return e.map(e=>{const n=new we;return n.mediaType=s.a.IMAGE,n.qualityIndex=t++,n.bitrate=e.bitrate,n.width=e.width,n.height=e.height,n})},reset:a},a(),r=Object(wt.b)(t).create({streamInfo:n,adapter:e.adapter,baseURLController:e.baseURLController,timelineConverter:e.timelineConverter,debug:e.debug,eventBus:e.eventBus,events:e.events,dashConstants:e.dashConstants}),i}sn.__dashjs_factory_name="ThumbnailController";var an=c.a.getClassFactory(sn);function on(e){e=e||{};const t=this.context,n=Object(l.a)(t).getInstance(),i=Object(rt.a)(t).getInstance(),r=e.manifestModel,o=e.mediaPlayerModel,c=e.manifestUpdater,h=e.adapter,f=e.capabilities,p=e.capabilitiesFilter,g=e.errHandler,m=e.timelineConverter,_=e.dashMetrics,y=e.abrController,T=e.playbackController,b=e.eventController,A=e.mediaController,v=e.textController,I=e.protectionController,R=e.videoModel,w=e.settings;let C,D,N,M,L,x,P,U,F,B,k,G,z,H,Y,q,j,V,K=e.streamInfo;function W(e){let t=N?N.length:0;for(let n=0;n0&&e.Representation[0].ContentProtection)}function _e(e,t,n=null){if(!e||!e.hasOwnProperty("getStreamInfo"))return!1;const i=e.getStreamInfo(),r=n?n.getStreamInfo():te();if(!i||!r)return!1;const s=h.getAdaptationForType(i.index,t,i),a=h.getAdaptationForType(r.index,t,r);if(!s||!a)return!s&&!a;const o=s&&a&&s.mimeType===a.mimeType,l=a.Representation_asArray.map(e=>e.codecs),u=s.Representation_asArray.map(e=>e.codecs),c=u.some(e=>l.indexOf(e)>-1),d=u.some(e=>l.some(t=>f.codecRootCompatibleWithCodec(t,e)));return c||d&&o}function Ee(e){z=e}function ye(){return z}return C={initialize:function(){n.on(u.a.BUFFERING_COMPLETED,ce,C),n.on(u.a.DATA_UPDATE_COMPLETED,de,C),n.on(u.a.INBAND_EVENTS,he,C),I&&(n.on(u.a.KEY_ERROR,ie,C),n.on(u.a.SERVER_CERTIFICATE_UPDATED,ie,C),n.on(u.a.LICENSE_REQUEST_COMPLETE,ie,C),n.on(u.a.KEY_SYSTEM_SELECTED,ie,C),n.on(u.a.KEY_SESSION_CREATED,ie,C),n.on(u.a.KEY_STATUSES_CHANGED,ie,C)),n.trigger(u.a.STREAM_UPDATED,{streamInfo:K})},getStreamId:function(){return K?K.id:null},activate:function(e,t){if(!L){let i;return n.on(u.a.CURRENT_TRACK_CHANGED,se,C),ye()?(!function(){if(B=!0,ne(),p.filterUnsupportedFeaturesOfPeriod(K),x=!0,B=!1,0===N.length){const e="No streams to play.";g.error(new E.a(O.MANIFEST_ERROR_ID_NOSTREAMS_CODE,e,r.getValue())),D.debug(e)}else le()}(),i=t):i=function(e,t){ne();let n=R.getElement();oe(),B=!0,p.filterUnsupportedFeaturesOfPeriod(K),(!n||n&&/^VIDEO$/i.test(n.nodeName))&&ae(s.a.VIDEO,e);ae(s.a.AUDIO,e),ae(s.a.TEXT,e),ae(s.a.FRAGMENTED_TEXT,e),ae(s.a.EMBEDDED_TEXT,e),ae(s.a.MUXED,e),ae(s.a.IMAGE,e),ae(s.a.MESH,e);const i=ue(t);if(x=!0,B=!1,0===N.length){const e="No streams to play.";g.error(new E.a(O.MANIFEST_ERROR_ID_NOSTREAMS_CODE,e,r.getValue())),D.fatal(e)}else le();return i}(e,t),L=!0,i}return t},deactivate:W,isActive:function(){return L},getDuration:$,getStartTime:Z,getId:ee,getStreamInfo:te,getHasAudioTrack:function(){return U},getHasVideoTrack:function(){return P},preload:function(e,t){if(!ye()){oe(),ae(s.a.VIDEO,e),ae(s.a.AUDIO,e),ae(s.a.TEXT,e),ae(s.a.FRAGMENTED_TEXT,e),ae(s.a.EMBEDDED_TEXT,e),ae(s.a.MUXED,e),ae(s.a.IMAGE,e),ue(t),n.on(u.a.CURRENT_TRACK_CHANGED,se,C);for(let e=0;e2147483647&&(s=2147483.647),t.trigger(u.a.MANIFEST_UPDATED,{manifest:e}),r.info("Manifest has been refreshed at "+n+"["+n.getTime()/1e3+"] "),c||S()}function v(){c||(f?S(E.get().streaming.manifestUpdateRetryInterval):b())}function I(e){e.error?e.error.code===O.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE&&_.error(e.error):A(e.manifest)}function R(){c=!1,S()}function w(){c=!E.get().streaming.scheduleWhilePaused,c&&T()}function C(){f=!1}return i={initialize:function(){y(),t.on(u.a.STREAMS_COMPOSED,C,this),t.on(u.a.PLAYBACK_STARTED,R,this),t.on(u.a.PLAYBACK_PAUSED,w,this),t.on(u.a.INTERNAL_MANIFEST_LOADED,I,this)},setManifest:function(e){A(e)},refreshManifest:b,setConfig:function(e){e&&(e.manifestModel&&(g=e.manifestModel),e.adapter&&(m=e.adapter),e.manifestLoader&&(p=e.manifestLoader),e.errHandler&&(_=e.errHandler),e.settings&&(E=e.settings))},reset:function(){t.off(u.a.PLAYBACK_STARTED,R,this),t.off(u.a.PLAYBACK_PAUSED,w,this),t.off(u.a.STREAMS_COMPOSED,C,this),t.off(u.a.INTERNAL_MANIFEST_LOADED,I,this),y()}},r=Object(d.a)(e).getInstance().getLogger(i),i}un.__dashjs_factory_name="ManifestUpdater";var cn=c.a.getClassFactory(un);function dn(){const e=this.context,t=Object(l.a)(e).getInstance(),n=Object(rt.a)(e).getInstance();let i,r,s,a,o,c,h,f,p,g,m,_,T,S,b;function A(){f=[],p=[],g=null,m=null,T=null,_=NaN,s=!1,a=!1,S=o.get().streaming.utcSynchronization.timeBetweenSyncAttempts}function v(){if(s||a||!T||!T.value||!T.schemeIdUri||isNaN(_)||isNaN(o.get().streaming.utcSynchronization.backgroundAttempts))return;if(m&&(Date.now()-m)/1e3<30)return;f=[],a=!0;!function e(t){try{if(t<=0)return void U();const n=Date.now();c[T.schemeIdUri](T.value,(function(i){const r=Date.now(),s=I(n,r,i);f.push(s),e(t-1)}),(function(){U()}))}catch(e){U()}}(isNaN(o.get().streaming.utcSynchronization.backgroundAttempts)?2:o.get().streaming.utcSynchronization.backgroundAttempts)}function I(e,t,n){return n-(t-(t-e)/2)}function R(e=NaN){let t=isNaN(e);t&&o.get().streaming.useManifestDateHeaderTimeSource?function(){let e=h.getLatestMPDRequestHeaderValueByID("Date"),t=null!==e?new Date(e).getTime():Number.NaN;if(isNaN(t))P(!0);else{P(!1,t-Date.now())}}():P(t,e)}function w(e){let t=Date.parse(e);return isNaN(t)&&(t=function(e){let t,n,i=/^([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(i[1],10),parseInt(i[2],10)-1,parseInt(i[3],10),parseInt(i[4],10),parseInt(i[5],10),i[6]&&(parseInt(i[6],10)||0),i[7]&&1e3*parseFloat(i[7])||0),i[9]&&i[10]&&(n=60*parseInt(i[9],10)+parseInt(i[10],10),t+=("+"===i[8]?-1:1)*n*60*1e3),new Date(t).getTime()}(e)),t}function C(e){return Date.parse(e)}function D(e){return Date.parse(e)}function N(e,t,n){n()}function M(e,t,n){let i=w(e);isNaN(i)?n():t(i)}function L(e,t,i,r,s){let a,o,l=!1,u=new XMLHttpRequest,c=s?y.a.HEAD:y.a.GET,d=t.match(/\S+/g);if(t=d.shift(),a=function(){l||(l=!0,d.length?L(e,d.join(" "),i,r,s):r())},o=function(){let t,n;200===u.status&&(t=s?u.getResponseHeader("Date"):u.response,n=e(t),isNaN(n)||(i(n),l=!0))},n.isRelative(t)){const e=b.resolve();e&&(t=n.resolve(t,e.url))}u.open(c,t),u.timeout=5e3,u.onload=o,u.onloadend=a,u.send()}function x(e,t,n){L(D,e,t,n,!0)}function P(e,n){if(isNaN(_)||isNaN(n)||e||function(e){try{const t=F(e),n=isNaN(S)?30:S,i=isNaN(o.get().streaming.utcSynchronization.timeBetweenSyncAttemptsAdjustmentFactor)?2:o.get().streaming.utcSynchronization.timeBetweenSyncAttemptsAdjustmentFactor,s=isNaN(o.get().streaming.utcSynchronization.maximumTimeBetweenSyncAttempts)?600:o.get().streaming.utcSynchronization.maximumTimeBetweenSyncAttempts,a=isNaN(o.get().streaming.utcSynchronization.minimumTimeBetweenSyncAttempts)?2:o.get().streaming.utcSynchronization.minimumTimeBetweenSyncAttempts;let l;t?(l=Math.min(n*i,s),r.debug("Increasing timeBetweenSyncAttempts to "+l)):(l=Math.max(n/i,a),r.debug("Decreasing timeBetweenSyncAttempts to "+l)),S=l}catch(e){}}(n),!e&&!isNaN(n)){g=Date.now(),s=!1;const e=isNaN(_);_=n,e&&v(),r.debug("Completed UTC sync. Setting client - server offset to "+n)}e&&(T=null),t.trigger(u.a.UPDATE_TIME_SYNC_OFFSET,{offset:n,error:e?new E.a(O.TIME_SYNC_FAILED_ERROR_CODE,O.TIME_SYNC_FAILED_ERROR_MESSAGE):null}),t.trigger(u.a.TIME_SYNCHRONIZATION_COMPLETED)}function U(){if(!f||0===f.length)return;const e=f.reduce((e,t)=>e+t,0)/f.length;F(e)?r.debug("Completed background UTC sync. Offset is within allowed threshold and is not adjusted."):(r.debug("Completed background UTC sync. Setting client - server offset to "+e),_=e,t.trigger(u.a.UPDATE_TIME_SYNC_OFFSET,{offset:_})),a=!1,m=Date.now()}function F(e){try{if(isNaN(_))return!0;const t=o.get().streaming.utcSynchronization.maximumAllowedDrift&&!isNaN(o.get().streaming.utcSynchronization.maximumAllowedDrift)?o.get().streaming.utcSynchronization.maximumAllowedDrift:100,n=_+t;return e>=_-t&&e<=n}catch(e){return!0}}return i={initialize:function(){A(),c={"urn:mpeg:dash:utc:http-head:2014":x,"urn:mpeg:dash:utc:http-xsdate:2014":L.bind(null,w),"urn:mpeg:dash:utc:http-iso:2014":L.bind(null,C),"urn:mpeg:dash:utc:direct:2014":M,"urn:mpeg:dash:utc:http-head:2012":x,"urn:mpeg:dash:utc:http-xsdate:2012":L.bind(null,w),"urn:mpeg:dash:utc:http-iso:2012":L.bind(null,C),"urn:mpeg:dash:utc:direct:2012":M,"urn:mpeg:dash:utc:http-ntp:2014":N,"urn:mpeg:dash:utc:ntp:2014":N,"urn:mpeg:dash:utc:sntp:2014":N}},attemptSync:function(e){p=e,s||(!function(){try{const e=isNaN(S)?30:S;return!(g&&e&&!isNaN(e))||(Date.now()-g)/1e3>=e}catch(e){return!0}}()?t.trigger(u.a.TIME_SYNCHRONIZATION_COMPLETED):(s=!0,function e(t=null){let n=t||0;if(!p||0===p.length||n>=p.length)return void R();let i=p[n];if(i)if(c.hasOwnProperty(i.schemeIdUri)){const t=(new Date).getTime();c[i.schemeIdUri](i.value,(function(e){const n=(new Date).getTime(),r=I(t,n,e);T=i,R(r)}),(function(){e(n+1)}))}else e(n+1);else R()}()))},setConfig:function(e){e&&(e.dashMetrics&&(h=e.dashMetrics),e.baseURLController&&(b=e.baseURLController),e.settings&&(o=e.settings))},reset:function(){A(),t.off(u.a.ATTEMPT_BACKGROUND_SYNC,v,i)}},r=Object(d.a)(e).getInstance().getLogger(i),t.on(u.a.ATTEMPT_BACKGROUND_SYNC,v,i),i}dn.__dashjs_factory_name="TimeSyncController";const hn=c.a.getSingletonFactory(dn);hn.HTTP_TIMEOUT_MS=5e3,c.a.updateSingletonFactory(dn.__dashjs_factory_name,hn);var fn=hn;function pn(){let e,t;const n=this.context;return e={createMediaSource:function(){let e="WebKitMediaSource"in window;return"MediaSource"in window?new MediaSource:e?new WebKitMediaSource:null},attachMediaSource:function(e,t){let n=window.URL.createObjectURL(e);return t.setSource(n),n},detachMediaSource:function(e){e.setSource(null)},setDuration:function e(n,i){n&&"open"===n.readyState&&(null===i&&isNaN(i)||n.duration!==i&&(!function(e){let t=e.sourceBuffers;for(let e=0;e=0&&t(!o||e.eventStream.value&&e.eventStream.value===o)&&e.id===l);return-1===c?(r[a].push(i),u=n):s&&(r[a][c]=i,u=t),u}function b(e){try{if(1==e.eventStream.value){const t=e.calculatedPresentationTime;let n;n=4294967295==e.calculatedPresentationTime?NaN:e.calculatedPresentationTime+e.duration,r.trigger(B.a.MANIFEST_VALIDITY_CHANGED,{id:e.id,validUntil:t,newDuration:n,newManifestValidAfter:NaN},{mode:B.a.EVENT_MODE_ON_START})}}catch(e){}}function A(){try{if(!m){m=!0;const e=p.getTime();let t=e-h;t=h>0?Math.max(0,t):0,v(u,t,e),v(o,t,e),h=e,m=!1}}catch(e){m=!1}}function v(e,t,n){try{R(e,(function(i){if(void 0!==i){const r=isNaN(i.duration)?0:i.duration;i.calculatedPresentationTime<=n&&i.calculatedPresentationTime+t+r>=n?w(i,e,B.a.EVENT_MODE_ON_START):(function(e,t,n){try{return e-t>n}catch(e){return!1}}(n,r+t,i.calculatedPresentationTime)||function(e){try{const t=e.eventStream.period.start+e.eventStream.period.duration;return e.calculatedPresentationTime>t}catch(e){return!1}}(i))&&(a.debug(`Deleting event ${i.id} as it is expired or invalid`),C(e,i))}}))}catch(e){}}function I(e){try{const t=p.getTime();R(e,function(n){const i=n.eventStream&&n.eventStream.period&&!isNaN(n.eventStream.period.duration)?n.eventStream.period.duration:NaN,r=n.eventStream&&n.eventStream.period&&!isNaN(n.eventStream.period.start)?n.eventStream.period.start:NaN;if(isNaN(i)||isNaN(r))return;const s=n.calculatedPresentationTime;Math.abs(s-t)<300&&w(n,e,B.a.EVENT_MODE_ON_START)}())}catch(e){}}function R(e,t){try{if(e){const n=Object.keys(e);for(let i=0;i{void 0!==e&&t(e)})}}}catch(e){}}function w(e,t,n){try{const s=p.getTime(),o=e.id;if(n===B.a.EVENT_MODE_ON_RECEIVE)return a.debug("Received event "+o),void r.trigger(e.eventStream.schemeIdUri,{event:e},{mode:n});"urn:mpeg:dash:event:2012"===e.eventStream.schemeIdUri&&1===e.eventStream.value?0===e.duration&&0===e.presentationTimeDelta||(a.debug(`Starting manifest refresh event ${o} at ${s}`),C(t,e),function(){try{E(),f.refreshManifest()}catch(e){}}()):"urn:mpeg:dash:event:callback:2015"===e.eventStream.schemeIdUri&&1===e.eventStream.value?(a.debug(`Starting callback event ${o} at ${s}`),C(t,e),function(e){try{Object(ct.a)(i).create({}).load({method:"get",url:e,request:{responseType:"arraybuffer"}})}catch(e){throw e}}(e.messageData)):(a.debug(`Starting event ${o} at ${s}`),C(t,e),r.trigger(e.eventStream.schemeIdUri,{event:e},{mode:n}))}catch(e){}}function C(e,t){const n=t.eventStream.schemeIdUri,i=t.eventStream.value,r=t.id;e[n]=e[n].filter(e=>i&&e.eventStream.value&&e.eventStream.value!==i||e.id!==r),0===e[n].length&&delete e[n]}return s={addInlineEvents:function(e){try{if(E(),e)for(let i=0;i0&&X.forEach(e=>{e.deactivate(!0)}),t&&t!==D?(ve(at.END_OF_PERIOD_STOP_REASON),pe(t,D,e.seekTime)):ve(at.USER_REQUEST_STOP_REASON),Ie(st.SEEK_START_REASON)}function te(e){const t=fe();ve(at.END_OF_PERIOD_STOP_REASON),pe(t,D,e.seekTime),Ie(st.SEEK_START_REASON)}function ne(){i.debug("[onPlaybackStarted]"),q?(q=!1,Ie(st.INITIAL_PLAYOUT_START_REASON)):Y&&(Y=!1,Ie(st.RESUME_FROM_PAUSE_START_REASON))}function ie(e){i.debug("[onPlaybackPaused]"),e.ended||(Y=!0,ve(at.USER_REQUEST_STOP_REASON))}function re(){V&&(clearInterval(V),V=null)}function se(){K||(K=setInterval((function(){!function(){if(!D||!ae(D))return;const e=function(e){try{const t=e||(D||null);if(t){const e=t.getStreamInfo().start;return C.filter((function(t){return t.getStreamInfo().start>e}))}}catch(e){return[]}}(D);let t=0;for(;t{const i=p.getMediaInfoForType(n.getStreamInfo(),e);p.getVoRepresentations(i).forEach(e=>{const n=p.getIsDynamic(),i=w.calcSegmentAvailabilityRange(e,n);i.ende.getType()===s.a.AUDIO||e.getType()===s.a.VIDEO);if(!t||0===t.length)return!1;const n=t.filter(e=>!e.isBufferingCompleted());return n&&0===n.length}catch(e){return!1}}function oe(){const e=we().isLast;F&&e&&(i.info("[onStreamBufferingCompleted] calls signalEndOfStream of mediaSourceController."),m.signalEndOfStream(F))}function le(e,t){try{return $.get().streaming.reuseExistingSourceBuffers&&t.isProtectionCompatible(e,t)&&(Q||t.isMediaCodecCompatible(e,t))&&!function(e){try{const t=e.getStreamInfo(),n=p.getAdaptationForType(t.index,s.a.FRAGMENTED_TEXT,t);return!!n&&(-1!==n.codecs.indexOf("stpp")||-1!==n.codecs.indexOf("wvtt"))}catch(e){return!1}}(e)}catch(e){return!1}}function ue(e,t=null){if(F&&!e.getPreloaded()){le(e,t)&&(e.setPreloadingScheduled(!0),i.info("[onStreamCanLoadNext] Preloading next stream with id "+e.getId()),j=!0,e.preload(F,W),X.push(e),e.getProcessors().forEach(t=>{t.setBufferingTime(e.getStartTime())}))}}function ce(e){if(isNaN(e))return null;let t=0,n=null;const i=C.length;i>0&&(t+=C[0].getStartTime());for(let r=0;r=0&&(isNaN(a)||e=0?C[s]:null}return null}function pe(e,n,r){if(x||!e||n===e&&e.isActive())return;x=!0,t.trigger(u.a.PERIOD_SWITCH_STARTED,{fromStreamInfo:n?n.getStreamInfo():null,toStreamInfo:e.getStreamInfo()});let s=!1;n&&(s=le(e,n),n.deactivate(s)),r=isNaN(r)?!s&&n?e.getStreamInfo().start:NaN:r,i.info(`Switch to stream ${e.getId()}. Seektime is ${r}, current playback time is ${z.getTime()}`),i.info("Seamless period switch is set to "+s),D=e,X=X.filter(e=>e.getId()!==D.getId()),z.initialize(we(),!!n,r),G.getElement()?ge(r,null===n,!1,s):me(r,s),j=!1}function ge(e,n,r,s){let a;function o(){F&&"open"===F.readyState&&(i.debug("MediaSource is open!"),window.URL.revokeObjectURL(a),F.removeEventListener("sourceopen",o),F.removeEventListener("webkitsourceopen",o),_e(),n||t.trigger(u.a.SOURCE_INITIALIZED),r?D.setMediaSource(F):me(e,s))}F?s?(me(e,s),n||t.trigger(u.a.SOURCE_INITIALIZED)):(m.detachMediaSource(G),F.addEventListener("sourceopen",o,!1),F.addEventListener("webkitsourceopen",o,!1),a=m.attachMediaSource(F,G),i.debug("MediaSource attached to element. Waiting on open...")):(F=m.createMediaSource(),F.addEventListener("sourceopen",o,!1),F.addEventListener("webkitsourceopen",o,!1),a=m.attachMediaSource(F,G),i.debug("MediaSource attached to element. Waiting on open..."))}function me(e,n){if(W=D.activate(F,n?W:void 0),W){const e=Object.keys(W);e.length>0&&W[e[0]].changeType&&(Q=!0)}q||isNaN(e)||(e===z.getTime()?t.trigger(u.a.SEEK_TARGET,{time:e},{streamId:D.getId()}):z.seek(e)),!L&&q||z.play(),x=!1,t.trigger(u.a.PERIOD_SWITCH_COMPLETED,{toStreamInfo:we()})}function _e(e){const t=e||we().manifestInfo.duration;m.setDuration(F,t)}function Ee(e){for(let t=0,n=C.length;t0&&(C=C.filter(e=>{const t=n.filter(t=>t.id===e.getId()).length>0||e.getId()===D.getId();return t||i.debug("Removing stream "+e.getId()),t}));for(let t=0,i=n.length;t{const i=p.getMediaInfoForType(t,n);return i&&e.push(i),e},[]).reduce((e,t)=>{const n=p.getVoRepresentations(t);return n&&n.length>0&&n.forEach(t=>{t&&e.push(t)}),e},[]).reduce((e,t)=>{const n=p.convertDataToRepresentationInfo(t);return n&&n.fragmentDuration&&!isNaN(n.fragmentDuration)&&e.push(n.fragmentDuration),e},[]);n=Math.max(...i)}return isFinite(n)?n:NaN}catch(e){return NaN}}(n,e);z.computeAndSetLiveDelay(t,e.DVRWindowSize,e.minBufferTime)}let e=null;e=ce(z.getStartTimeFromUriParameters(p.getIsDynamic())),!e&&p.getIsDynamic()&&C.length&&(i.debug("Dynamic stream: Trying to find the correct starting period"),e=function(){try{const e=w.calcPresentationTimeFromWallTime(new Date,p.getRegularPeriods()[0]),t=z.getLiveDelay();return ce(e-t)}catch(e){return null}}());pe(null!==e?e:C[0],null,NaN),V||(V=setInterval((function(){!x&&z.getTimeToStreamEnd()<=0&&t.trigger(u.a.PLAYBACK_ENDED,{isLast:we().isLast})}),200)),se()}t.trigger(u.a.STREAMS_COMPOSED)}catch(e){R.error(new E.a(O.MANIFEST_ERROR_ID_NOSTREAMS_CODE,e.message+"nostreamscomposed",f.getValue())),U=!0,Me()}}function Te(){const e=f.getValue();N&&(t.trigger(u.a.PROTECTION_CREATED,{controller:N,manifest:e}),N.setMediaElement(G.getElement()),M&&N.setProtectionData(M)),ye()}function Se(e){if(e.error)U=!0,Me();else{const n=e.manifest;p.updatePeriods(n);let r=p.getUTCTimingSources();!p.getIsDynamic()||r&&0!==r.length||t.trigger(B.a.CONFORMANCE_VIOLATION,{level:k.LEVELS.WARNING,event:k.EVENTS.NO_UTC_TIMING_ELEMENT});let s=p.getIsDynamic()?r.concat(H.getUTCTimingSources()):r;const a=I.isHTTPS(e.manifest.url);s.forEach((function(e){e.value.replace(/.*?:\/\//g,"")===H.getDefaultUtcTimingSource().value.replace(/.*?:\/\//g,"")&&(e.value=e.value.replace(a?new RegExp(/^(http:)?\/\//i):new RegExp(/^(https:)?\/\//i),a?"https://":"http://"),i.debug("Matching default timing source protocol to manifest protocol: ",e.value))})),y.initialize(n),_.attemptSync(s)}}function be(){return!!D&&D.getHasVideoTrack()}function Ae(){return!!D&&D.getHasAudioTrack()}function ve(e,t){t=t||new Date,de().forEach(n=>{n.finalisePlayList(t,e)}),g.addPlayList()}function Ie(e){g.createPlaylistMetrics(1e3*z.getTime(),e)}function Re(e){if(!e.error)return;let t="";switch(e.error.code){case 1:t="MEDIA_ERR_ABORTED";break;case 2:t="MEDIA_ERR_NETWORK";break;case 3:t="MEDIA_ERR_DECODE";break;case 4:t="MEDIA_ERR_SRC_NOT_SUPPORTED";break;case 5:t="MEDIA_ERR_ENCRYPTED";break;default:t="UNKNOWN"}P=!0,e.error.message&&(t+=" ("+e.error.message+")"),e.error.msExtendedCode&&(t+=" (0x"+(e.error.msExtendedCode>>>0).toString(16).toUpperCase()+")"),i.fatal("Video Element Error: "+t),e.error&&i.fatal(e.error),R.error(new E.a(e.error.code,t)),Me()}function we(){return D?D.getStreamInfo():null}function Ce(){if(!(h&&h.hasOwnProperty("load")&&w&&w.hasOwnProperty("initialize")&&w.hasOwnProperty("reset")&&w.hasOwnProperty("getClientTimeOffset")&&f&&R&&g&&z))throw new Error(s.a.MISSING_CONFIG_ERROR)}function De(e){isNaN(e.newDuration)||_e(e.newDuration)}function Ne(){C=[],N=null,x=!1,D=null,P=!1,U=!1,q=!0,Y=!1,L=!0,V=null,j=!1,K=null,Z=!1,X=[]}function Me(){Ce(),_.reset(),ve(P||U?at.FAILURE_STOP_REASON:at.USER_REQUEST_STOP_REASON);for(let e=0,t=C?C.length:0;e{if(!b())return;A(c.getTime())},100))}catch(e){}}()}function T(){m&&(clearTimeout(m),m=null)}function S(){if(b()&&(s++,s>=30)){const e=c.getTime();i===e?A(e,!0):(i=e,o=NaN),s=0}}function b(){return r.get().streaming.jumpGaps&&h.getActiveStreamProcessors().length>0&&(!c.isSeeking()||h.hasStreamFinishedBuffering(h.getActiveStream()))&&!c.isPaused()&&!h.getIsStreamSwitchInProgress()&&!h.getHasMediaOrIntialisationError()}function A(e,n=!1){const i=r.get().streaming.smallGapLimit,s=r.get().streaming.jumpLargeGaps,a=f.getBufferRange();let l,d=NaN,h=!1;if(l=function(e,t){try{if(!e||e.length<=1&&t>0)return NaN;let n=NaN,i=0;for(;isNaN(n)&&i0?e.end(i-1):0;t0&&(n<=i||s)&&(d=t)}const p=c.getTimeToStreamEnd();if(isNaN(d)&&n&&isFinite(p)&&!isNaN(p)&&p0&&o!==d&&d>e&&!m){const n=d-e;if(h)_.warn(`Jumping to end of stream because of gap from ${e} to ${d}. Gap duration: ${n}`),t.trigger(u.a.GAP_CAUSED_SEEK_TO_PERIOD_END,{seekTime:d,duration:n});else{const i=c.getIsDynamic(),r=l>0?a.end(l-1):e,s=i?1e3*n:0;m=window.setTimeout(()=>{c.seek(d,!0,!0),_.warn(`Jumping gap starting at ${r} and ending at ${d}. Jumping by: ${n}`),t.trigger(u.a.GAP_CAUSED_INTERNAL_SEEK,{seekTime:d,duration:n}),m=null},s)}o=d}}return n={reset:E,setConfig:function(e){e&&(e.settings&&(r=e.settings),e.playbackController&&(c=e.playbackController),e.streamController&&(h=e.streamController),e.videoModel&&(f=e.videoModel),e.timelineConverter&&(p=e.timelineConverter),e.adapter&&(g=e.adapter))},initialize:function(){!function(){t.on(u.a.WALLCLOCK_TIME_UPDATED,S,this),t.on(u.a.PLAYBACK_SEEKING,T,this),t.on(u.a.BYTES_APPENDED_END_FRAGMENT,y,n)}()}},_=Object(d.a)(e).getInstance().getLogger(n),E(),n}Tn.__dashjs_factory_name="GapController";var Sn=c.a.getSingletonFactory(Tn);function bn(){const e=this.context,t=Object(l.a)(e).getInstance();let n,i,r,a,o,c;const h=[s.a.TRACK_SWITCH_MODE_ALWAYS_REPLACE,s.a.TRACK_SWITCH_MODE_NEVER_REPLACE],f=[s.a.TRACK_SELECTION_MODE_HIGHEST_BITRATE,s.a.TRACK_SELECTION_MODE_FIRST_TRACK,s.a.TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY,s.a.TRACK_SELECTION_MODE_WIDEST_RANGE];function p(e,t){if(!e||!t)return[];const n=t.id;return r[n]&&r[n][e]?r[n][e].list:[]}function g(e,t){return!e||!t||t&&!r[t.id]?null:r[t.id][e].current}function m(e,n){if(!e||!e.streamInfo)return;const i=e.type,a=e.streamInfo,o=a.id,l=g(i,a);if(r[o]&&r[o][i]&&!b(e,l)&&(r[o][i].current=e,!r[o][i].current||n&&i===s.a.FRAGMENTED_TEXT||t.trigger(u.a.CURRENT_TRACK_CHANGED,{oldMediaInfo:l,newMediaInfo:e,switchMode:y(i)}),!n)){let t=function(e){const 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}(e);if(!t||!r[o][i].storeLastSettings)return;t.roles&&(t.role=t.roles[0],delete t.roles),t.accessibility&&(t.accessibility=t.accessibility[0]),t.audioChannelConfiguration&&(t.audioChannelConfiguration=t.audioChannelConfiguration[0]),c.setSavedMediaSettings(i,t)}}function _(e,t){e&&t&&(o[e]=t)}function E(e){return e?o[e]:null}function y(e){return a.get().streaming.trackSwitchMode[e]}function T(){return a.get().streaming.selectionModeForInitialTrack}function S(e){return e===s.a.AUDIO||e===s.a.VIDEO||e===s.a.TEXT||e===s.a.FRAGMENTED_TEXT||e===s.a.IMAGE||e===s.a.MESH}function b(e,t){if(!e&&!t)return!0;if(!e||!t)return!1;const n=e.id===t.id,i=e.viewpoint===t.viewpoint,r=e.lang===t.lang,s=e.roles.toString()===t.roles.toString(),a=e.accessibility.toString()===t.accessibility.toString(),o=e.audioChannelConfiguration.toString()===t.audioChannelConfiguration.toString();return n&&i&&r&&s&&a&&o}function A(){r={},o={audio:null,video:null,fragmentedText:null}}function v(e,t){const n=!e.lang||t.lang.match(e.lang),i=void 0===e.index||null===e.index||t.index===e.index,r=!e.viewpoint||e.viewpoint===t.viewpoint,s=!e.role||!!t.roles.filter((function(t){return t===e.role}))[0];let a=!e.accessibility||!!t.accessibility.filter((function(t){return t===e.accessibility}))[0],o=!e.audioChannelConfiguration||!!t.audioChannelConfiguration.filter((function(t){return t===e.audioChannelConfiguration}))[0];return n&&i&&r&&s&&a&&o}function I(e){let t,n=0,i=[];return e.forEach((function(e){t=Math.max.apply(Math,e.bitrateList.map((function(e){return e.bandwidth}))),t>n?(n=t,i=[e]):t===n&&i.push(e)})),i}function R(e){let t,n=1/0,i=[];return e.forEach((function(e){const r=e.bitrateList.reduce((function(e,t){const n=Math.max(1,t.width*t.height);return e+t.bandwidth/n}),0);t=r/e.bitrateList.length,tn?(n=t,i=[e]):t===n&&i.push(e)})),i}return n={checkInitialMediaSettingsForType:function(e,t){let n=E(e);const i=p(e,t),r=[];n||(n=c.getSavedMediaSettings(e),_(e,n)),i&&0!==i.length&&(n&&i.forEach((function(e){v(n,e)&&r.push(e)})),0===r.length?m(this.selectInitialTrack(e,i),!0):r.length>1?m(this.selectInitialTrack(e,r)):m(r[0]))},addTrack:function(e){if(!e)return;const t=e.type;if(!S(t))return;let n=e.streamInfo.id;r[n]||(r[n]={audio:{list:[],storeLastSettings:!0,current:null},video:{list:[],storeLastSettings:!0,current:null},text:{list:[],storeLastSettings:!0,current:null},fragmentedText:{list:[],storeLastSettings:!0,current:null},image:{list:[],storeLastSettings:!0,current:null},mesh:{list:[],storeLastSettings:!0,current:null}});const i=r[n][t].list;for(let t=0,n=i.length;t1&&(r=w(r));break;case s.a.TRACK_SELECTION_MODE_FIRST_TRACK:r.push(t[0]);break;case s.a.TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY:r=R(t),r.length>1&&(r=I(r));break;case s.a.TRACK_SELECTION_MODE_WIDEST_RANGE:r=w(t),r.length>1&&(r=I(t));break;default:i.warn("Track selection mode is not supported: "+n)}return r[0]},getTracksWithHighestBitrate:I,getTracksWithHighestEfficiency:R,getTracksWithWidestRange:w,setSelectionModeForInitialTrack:function(e){i.warn("deprecated: Please use updateSettings({streaming: { selectionModeForInitialTrack: mode } }) instead"),-1!==f.indexOf(e)?a.update({streaming:{selectionModeForInitialTrack:e}}):i.warn("Track selection mode is not supported: "+e)},getSelectionModeForInitialTrack:T,isMultiTrackSupportedByType:S,isTracksEqual:b,matchSettings:v,saveTextSettingsDisabled:function(){c.setSavedMediaSettings(s.a.FRAGMENTED_TEXT,null)},setConfig:function(e){e&&(e.domStorage&&(c=e.domStorage),e.settings&&(a=e.settings))},reset:A},i=Object(d.a)(e).getInstance().getLogger(n),A(),n}bn.__dashjs_factory_name="MediaController";const An=c.a.getSingletonFactory(bn);c.a.updateSingletonFactory(bn.__dashjs_factory_name,An);var vn=An,In=n(53),Rn=n.n(In);function wn(){let e;return e={areEqual:function(e,t){return Rn()(e,t)}},e}wn.__dashjs_factory_name="ObjectUtils";var Cn=c.a.getSingletonFactory(wn);class Dn{constructor(e,t){this.data={baseUrls:e||null,selectedIdx:t||NaN},this.children=[]}}function Nn(){let e,t,n;const i=this.context,r=Cn(i).getInstance();function s(e,t,i){const s=n.getBaseURLsFromElement(i);e[t]?r.areEqual(s,e[t].data.baseUrls)||(e[t].data.baseUrls=s,e[t].data.selectedIdx=NaN):e[t]=new Dn(s)}function a(e){!function(){if(!n||!n.hasOwnProperty("getBaseURLsFromElement")||!n.hasOwnProperty("getRepresentationSortFunction"))throw new Error("setConfig function has to be called previously")}();const i=n.getBaseURLsFromElement(e);r.areEqual(i,t.data.baseUrls)||(t.data.baseUrls=i,t.data.selectedIdx=NaN),e&&e.Period_asArray&&e.Period_asArray.forEach((e,i)=>{s(t.children,i,e),e.AdaptationSet_asArray&&e.AdaptationSet_asArray.forEach((e,r)=>{e.index=r,s(t.children[i].children,r,e),e.Representation_asArray&&e.Representation_asArray.sort(n.getRepresentationSortFunction()).forEach((e,n)=>{e.index=n,s(t.children[i].children[r].children,n,e)})})})}function o(){t=new Dn}return e={reset:o,update:function(e){a(e)},getForPath:function(e){let n=t;const i=[n.data];return e&&e.forEach(e=>{n=n.children[e],n&&i.push(n.data)}),i.filter(e=>e.baseUrls.length)},invalidateSelectedIndexes:function(e){!function e(n,i){const r=i||t;n(r.data),r.children&&r.children.forEach(t=>e(n,t))}(t=>{isNaN(t.selectedIdx)||e===t.baseUrls[t.selectedIdx].serviceLocation&&(t.selectedIdx=NaN)})},setConfig:function(e){e.adapter&&(n=e.adapter)}},o(),e}Nn.__dashjs_factory_name="BaseURLTreeModel";var Mn=c.a.getClassFactory(Nn);function Ln(e){let t;e=e||{};let n=[];const i=Object(l.a)(this.context).getInstance(),r=e.updateEventName,s=e.addBlacklistEventName;function a(e){-1===n.indexOf(e)&&(n.push(e),i.trigger(r,{entry:e}))}function o(e){a(e.entry)}return t={add:a,contains:function(e){return!!(n.length&&e&&e.length)&&-1!==n.indexOf(e)},reset:function(){n=[]}},s&&i.on(s,o,t),t}Ln.__dashjs_factory_name="BlackListController";var On=c.a.getClassFactory(Ln);function xn(e){let t;const n=(e=e||{}).blacklistController;return t={select:function(e){return e&&function(e){let t,n,i=0,r=[],s=0;if(n=e.sort((function(e,t){let 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})),n.length)return n.length>1&&(n.forEach(e=>{i+=e.dvb_weight,r.push(i)}),t=Math.floor(Math.random()*(i-1)),r.every((e,n)=>(s=n,!(t(i=t,!n.contains(e.serviceLocation)))&&(t=e[i]),t}},t}Un.__dashjs_factory_name="BasicSelector";var Fn=c.a.getClassFactory(Un);function Bn(){const e=this.context,t=Object(l.a)(e).getInstance();let n,i,r,s,a;function o(){i.reset()}return n={chooseSelector:function(e){Object(v.b)(e,"boolean"),a=e?s:r},select:function(e){if(!e)return;const n=e.baseUrls,i=e.selectedIdx;if(!isNaN(i))return n[i];let s=a.select(n);return s?(e.selectedIdx=n.indexOf(s),s):(t.trigger(u.a.URL_RESOLUTION_FAILED,{error:new E.a(O.URL_RESOLUTION_FAILED_GENERIC_ERROR_CODE,O.URL_RESOLUTION_FAILED_GENERIC_ERROR_MESSAGE)}),void(a===r&&o()))},reset:o,setConfig:function(e){e.selector&&(a=e.selector)}},i=On(e).create({updateEventName:u.a.SERVICE_LOCATION_BLACKLIST_CHANGED,addBlacklistEventName:u.a.SERVICE_LOCATION_BLACKLIST_ADD}),r=Fn(e).create({blacklistController:i}),s=Pn(e).create({blacklistController:i}),a=r,n}Bn.__dashjs_factory_name="BaseURLSelector";var kn=c.a.getClassFactory(Bn);function Gn(){let e,t;const n=this.context,i=Object(l.a)(n).getInstance(),r=Object(rt.a)(n).getInstance();let s,a;function o(e){s.invalidateSelectedIndexes(e.entry)}return e={reset:function(){s.reset(),a.reset()},initialize:function(e){var n;s.setConfig({adapter:t}),n=e,s.update(n),a.chooseSelector(t.getIsDVB(n))},resolve:function(e){const t=s.getForPath(e).reduce((e,t)=>{const n=a.select(t);return n?(r.isRelative(n.url)?e.url=r.resolve(n.url,e.url):(e.url=n.url,e.serviceLocation=n.serviceLocation),e.availabilityTimeOffset=n.availabilityTimeOffset,e.availabilityTimeComplete=n.availabilityTimeComplete,e):new It},new It);if(!r.isRelative(t.url))return t},setConfig:function(e){e.baseURLTreeModel&&(s=e.baseURLTreeModel),e.baseURLSelector&&(a=e.baseURLSelector),e.adapter&&(t=e.adapter)}},s=Mn(n).create(),a=kn(n).create(),i.on(u.a.SERVICE_LOCATION_BLACKLIST_CHANGED,o,e),e}Gn.__dashjs_factory_name="BaseURLController";var zn=c.a.getClassFactory(Gn);class Hn extends p.a{constructor(e,t){super(),this.url=e||null,this.type=t||null,this.mediaType=s.a.STREAM,this.responseType=""}}var Yn=Hn;function qn(e){e=e||{};const t=this.context,n=Object(l.a)(t).getInstance();let i,r=Xt(t).create({errHandler:e.errHandler,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,useFetch:e.settings?e.settings.get().streaming.lowLatencyEnabled:null,errors:O});return i={load:function(e,t,i){const s=function(r,s){t.resolved=!0,t.resolvedContent=r||null,n.trigger(u.a.XLINK_ELEMENT_LOADED,{element:t,resolveObject:i,error:r||s?null:new E.a(O.XLINK_LOADER_LOADING_FAILURE_ERROR_CODE,O.XLINK_LOADER_LOADING_FAILURE_ERROR_MESSAGE+e)})};if("urn:mpeg:dash:resolve-to-zero:2013"===e)s(null,!0);else{const t=new Yn(e,y.a.XLINK_EXPANSION_TYPE);r.load({request:t,success:function(e){s(e)},error:function(){s(null)}})}},reset:function(){r&&(r.abort(),r=null)}},i}qn.__dashjs_factory_name="XlinkLoader";var jn=c.a.getClassFactory(qn);var Vn=function(e){e=e||{},function(){void 0===e.escapeMode&&(e.escapeMode=!0);void 0===e.attributePrefix&&(e.attributePrefix="_");e.arrayAccessForm=e.arrayAccessForm||"none",e.emptyNodeForm=e.emptyNodeForm||"text",void 0===e.enableToStringFunc&&(e.enableToStringFunc=!0);e.arrayAccessFormPaths=e.arrayAccessFormPaths||[],void 0===e.skipEmptyTextNodesForObj&&(e.skipEmptyTextNodesForObj=!0);void 0===e.stripWhitespaces&&(e.stripWhitespaces=!0);e.datetimeAccessFormPaths=e.datetimeAccessFormPaths||[],void 0===e.useDoubleQuotes&&(e.useDoubleQuotes=!1);e.xmlElementsFilter=e.xmlElementsFilter||[],e.jsonPropertiesFilter=e.jsonPropertiesFilter||[],void 0===e.keepCData&&(e.keepCData=!1);void 0===e.ignoreRoot&&(e.ignoreRoot=!1)}();var t=1,n=3,i=4,r=8,s=9;function a(e){var t=e.localName;return null==t&&(t=e.baseName),null!=t&&""!=t||(t=e.nodeName),t}function o(e){return"string"==typeof e?e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"):e}function l(e,t,n,i){for(var r=0;r0&&l(e.arrayAccessFormPaths,t,n,i)&&(t[n]=[t[n]])}function c(e){var t=e.split(/[-T:+Z]/g),n=new Date(t[0],t[1]-1,t[2]),i=t[5].split(".");if(n.setHours(t[3],t[4],i[0]),i.length>1&&n.setMilliseconds(i[1]),t[6]&&t[7]){var r=60*t[6]+Number(t[7]);r=0+("-"==(/\d\d-\d\d:\d\d$/.test(e)?"-":"+")?-1*r:r),n.setMinutes(n.getMinutes()-r-n.getTimezoneOffset())}else-1!==e.indexOf("Z",e.length-1)&&(n=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds())));return n}function d(n,i,r,s){return!(i==t&&e.xmlElementsFilter.length>0)||l(e.xmlElementsFilter,n,r,s)}function h(o,f){if(o.nodeType==s){for(var p=new Object,g=o.childNodes,m=0;m0){var r=i.split(".#")[0];return l(e.datetimeAccessFormPaths,t,n,r)?c(t):t}return t}(p.__text,y,f+"."+y)),null!=p["#cdata-section"]&&(p.__cdata=p["#cdata-section"],delete p["#cdata-section"],"property"==e.arrayAccessForm&&delete p["#cdata-section_asArray"]),0==p.__cnt&&"text"==e.emptyNodeForm?p="":1==p.__cnt&&null!=p.__text?p=p.__text:1!=p.__cnt||null==p.__cdata||e.keepCData?p.__cnt>1&&null!=p.__text&&e.skipEmptyTextNodesForObj&&(e.stripWhitespaces&&""==p.__text||""==p.__text.trim())&&delete p.__text:p=p.__cdata,delete p.__cnt,!e.enableToStringFunc||null==p.__text&&null==p.__cdata||(p.toString=function(){return(null!=this.__text?this.__text:"")+(null!=this.__cdata?this.__cdata:"")}),p}if(o.nodeType==n||o.nodeType==i)return o.nodeValue}function f(t,n,i,r){var s="<"+(null!=t&&null!=t.__prefix?t.__prefix+":":"")+n;if(null!=i)for(var a=0;a":">"}function p(e,t){return""}function g(t,n){return"property"==e.arrayAccessForm&&(i=n.toString(),r="_asArray",-1!==i.indexOf(r,i.length-r.length))||0==n.toString().indexOf(e.attributePrefix)||0==n.toString().indexOf("__")||t[n]instanceof Function;var i,r}function m(e){var t=0;if(e instanceof Object)for(var n in e)g(e,n)||t++;return t}function _(t,n,i){return 0==e.jsonPropertiesFilter.length||""==i||l(e.jsonPropertiesFilter,t,n,i)}function E(t){var n=[];if(t instanceof Object)for(var i in t)-1==i.toString().indexOf("__")&&0==i.toString().indexOf(e.attributePrefix)&&n.push(i);return n}function y(t){var n="";return t instanceof Object?n+=function(t){var n="";return null!=t.__cdata&&(n+=""),null!=t.__text&&(e.escapeMode?n+=o(t.__text):n+=t.__text),n}(t):null!=t&&(e.escapeMode?n+=o(t):n+=t),n}function T(e,t){return""===e?t:e+"."+t}function S(e,t,n,i){var r="";if(0==e.length)r+=f(e,t,n,!0);else for(var s=0;s0)for(var i in e)if(!g(e,i)&&(""==t||_(e,i,T(t,i)))){var r=e[i],s=E(r);if(null==r||null==r)n+=f(r,i,s,!0);else if(r instanceof Object)if(r instanceof Array)n+=S(r,i,s,t);else if(r instanceof Date)n+=f(r,i,s,!1),n+=r.toISOString(),n+=p(r,i);else{m(r)>0||null!=r.__text||null!=r.__cdata?(n+=f(r,i,s,!1),n+=b(r,T(t,i)),n+=p(r,i)):n+=f(r,i,s,!0)}else n+=f(r,i,s,!1),n+=y(r),n+=p(r,i)}return n+=y(e)}this.parseXmlString=function(e){var t;window.ActiveXObject||window;if(void 0===e)return null;if(window.DOMParser){var n=new window.DOMParser;try{(t=n.parseFromString(e,"text/xml")).getElementsByTagNameNS("*","parsererror").length>0&&(t=null)}catch(e){t=null}}else 0==e.indexOf("")+2)),(t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e);return t},this.asArray=function(e){return void 0===e||null==e?[]:e instanceof Array?e:[e]},this.toXmlDateTime=function(e){return e instanceof Date?e.toISOString():"number"==typeof e?new Date(e).toISOString():null},this.asDateTime=function(e){return"string"==typeof e?c(e):e},this.xml2json=function(e){return h(e)},this.xml_str2json=function(e){var t=this.parseXmlString(e);return null!=t?this.xml2json(t):null},this.json2xml_str=function(e){return b(e,"")},this.json2xml=function(e){var t=this.json2xml_str(e);return this.parseXmlString(t)},this.getVersion=function(){return"1.2.0"}};function Kn(e){e=e||{};let t=this.context,n=Object(l.a)(t).getInstance();const i=Object(rt.a)(t).getInstance();let r,s,o,c,d,h;function f(e,t,n){let r,s,a={};a.elements=e,a.type=t,a.resolveType=n,0===a.elements.length&&g(a);for(let e=0;e")+2),i=t.resolvedContent.substr(0,e)+""+t.resolvedContent.substr(e)+"",t.resolvedContent=d.xml_str2json(i)}(function(e){let t,n;for(t=0;t=0;r--){if(t=e.elements[r],n=t.type+"_asArray",t.resolvedContent){if(t.resolvedContent)for(s=0;s0&&o.run(c)}(e),"onActuate"===e.resolveType&&n.trigger(u.a.XLINK_READY,{manifest:c}),"onLoad"===e.resolveType)switch(e.type){case a.a.PERIOD:for(t=0;t=0;s--)r=e[s],r.hasOwnProperty("xlink:href")&&"urn:mpeg:dash:resolve-to-zero:2013"===r["xlink:href"]&&e.splice(s,1);for(s=0;s{const n={[a.a.MPD]:[a.a.ID,a.a.PROFILES],[a.a.PERIOD]:[a.a.ID],[a.a.BASE_URL]:[a.a.SERVICE_LOCATION,a.a.BYTE_RANGE],[a.a.SEGMENT_BASE]:[a.a.INDEX_RANGE],[a.a.INITIALIZATION]:[a.a.RANGE],[a.a.REPRESENTATION_INDEX]:[a.a.RANGE],[a.a.SEGMENT_LIST]:[a.a.INDEX_RANGE],[a.a.BITSTREAM_SWITCHING]:[a.a.RANGE],[a.a.SEGMENT_URL]:[a.a.MEDIA_RANGE,a.a.INDEX_RANGE],[a.a.SEGMENT_TEMPLATE]:[a.a.INDEX_RANGE,a.a.MEDIA,a.a.INDEX,a.a.INITIALIZATION_MINUS,a.a.BITSTREAM_SWITCHING_MINUS],[a.a.ASSET_IDENTIFIER]:[a.a.VALUE,a.a.ID],[a.a.EVENT_STREAM]:[a.a.VALUE],[a.a.ADAPTATION_SET]:[a.a.PROFILES,a.a.MIME_TYPE,a.a.SEGMENT_PROFILES,a.a.CODECS,a.a.CONTENT_TYPE],[a.a.FRAME_PACKING]:[a.a.VALUE,a.a.ID],[a.a.AUDIO_CHANNEL_CONFIGURATION]:[a.a.VALUE,a.a.ID],[a.a.CONTENT_PROTECTION]:[a.a.VALUE,a.a.ID],[a.a.ESSENTIAL_PROPERTY]:[a.a.VALUE,a.a.ID],[a.a.SUPPLEMENTAL_PROPERTY]:[a.a.VALUE,a.a.ID],[a.a.INBAND_EVENT_STREAM]:[a.a.VALUE,a.a.ID],[a.a.ACCESSIBILITY]:[a.a.VALUE,a.a.ID],[a.a.ROLE]:[a.a.VALUE,a.a.ID],[a.a.RATING]:[a.a.VALUE,a.a.ID],[a.a.VIEWPOINT]:[a.a.VALUE,a.a.ID],[a.a.CONTENT_COMPONENT]:[a.a.CONTENT_TYPE],[a.a.REPRESENTATION]:[a.a.ID,a.a.DEPENDENCY_ID,a.a.MEDIA_STREAM_STRUCTURE_ID],[a.a.SUBSET]:[a.a.ID],[a.a.METRICS]:[a.a.METRICS_MINUS],[a.a.REPORTING]:[a.a.VALUE,a.a.ID]};if(n.hasOwnProperty(t)){let i=n[t];return void 0!==i&&i.indexOf(e.name)>=0}return!1},e=>String(e))}};const Jn=/^([-])?P(([\d.]*)Y)?(([\d.]*)M)?(([\d.]*)D)?T?(([\d.]*)H)?(([\d.]*)M)?(([\d.]*)S)?/;var ei=class extends $n{constructor(){super(e=>{const t=[a.a.MIN_BUFFER_TIME,a.a.MEDIA_PRESENTATION_DURATION,a.a.MINIMUM_UPDATE_PERIOD,a.a.TIMESHIFT_BUFFER_DEPTH,a.a.MAX_SEGMENT_DURATION,a.a.MAX_SUBSEGMENT_DURATION,a.a.SUGGESTED_PRESENTATION_DELAY,a.a.START,s.a.START_TIME,a.a.DURATION],n=t.length;for(let i=0;i{const t=Jn.exec(e);let n=31536e3*parseFloat(t[3]||0)+2592e3*parseFloat(t[5]||0)+86400*parseFloat(t[7]||0)+3600*parseFloat(t[9]||0)+60*parseFloat(t[11]||0)+parseFloat(t[13]||0);return void 0!==t[1]&&(n=-n),n})}};const ti=/^([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}))?/;var ni=class extends $n{constructor(){super(e=>ti.test(e.value),e=>{const t=ti.exec(e);let n;if(n=Date.UTC(parseInt(t[1],10),parseInt(t[2],10)-1,parseInt(t[3],10),parseInt(t[4],10),parseInt(t[5],10),t[6]&&parseInt(t[6],10)||0,t[7]&&1e3*parseFloat(t[7])||0),t[9]&&t[10]){const e=60*parseInt(t[9],10)+parseInt(t[10],10);n+=("+"===t[8]?-1:1)*e*60*1e3}return new Date(n)})}};const ii=/^[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?$/;var ri=class extends $n{constructor(){super(e=>ii.test(e.value),e=>parseFloat(e))}};var si=class{constructor(e){var t;this._name=e,this._merge=(t=e)&&t.length&&t.charAt(0)===t.charAt(0).toUpperCase()}get name(){return this._name}get merge(){return this._merge}};var ai=class{constructor(e,t,n){this._name=e||"",this._properties=[],this._children=n||[],Array.isArray(t)&&t.forEach(e=>{this._properties.push(new si(e))})}get name(){return this._name}get children(){return this._children}get properties(){return this._properties}};var oi=class extends ai{constructor(){const e=[a.a.PROFILES,a.a.WIDTH,a.a.HEIGHT,a.a.SAR,a.a.FRAMERATE,a.a.AUDIO_SAMPLING_RATE,a.a.MIME_TYPE,a.a.SEGMENT_PROFILES,a.a.CODECS,a.a.MAXIMUM_SAP_PERIOD,a.a.START_WITH_SAP,a.a.MAX_PLAYOUT_RATE,a.a.CODING_DEPENDENCY,a.a.SCAN_TYPE,a.a.FRAME_PACKING,a.a.AUDIO_CHANNEL_CONFIGURATION,a.a.CONTENT_PROTECTION,a.a.ESSENTIAL_PROPERTY,a.a.SUPPLEMENTAL_PROPERTY,a.a.INBAND_EVENT_STREAM];super(a.a.ADAPTATION_SET,e,[new ai(a.a.REPRESENTATION,e,[new ai(a.a.SUB_REPRESENTATION,e)])])}};var li=class extends ai{constructor(){const e=[a.a.SEGMENT_BASE,a.a.SEGMENT_TEMPLATE,a.a.SEGMENT_LIST];super(a.a.PERIOD,e,[new ai(a.a.ADAPTATION_SET,e,[new ai(a.a.REPRESENTATION,e)])])}};function ui(e){e=e||{};const t=this.context,n=e.debug;let i,r,s,a,o;return i={parse:function(e){let t;const n=window.performance.now();if(t=a.xml_str2json(e),!t)throw new Error("parsing the manifest failed");const i=window.performance.now();t.Patch?(t=t.Patch,t.add_asArray&&t.add_asArray.forEach(e=>o.run(e)),t.replace_asArray&&t.replace_asArray.forEach(e=>o.run(e))):(t=t.MPD,o.run(t));const s=window.performance.now();return r.info("Parsing complete: ( xml2json: "+(i-n).toPrecision(3)+"ms, objectiron: "+(s-i).toPrecision(3)+"ms, total: "+((s-n)/1e3).toPrecision(3)+"s)"),t.protocol="DASH",t},getMatchers:function(){return s},getIron:function(){return o}},r=n.getLogger(i),s=[new ei,new ni,new ri,new Zn],a=new Vn({escapeMode:!1,attributePrefix:"",arrayAccessForm:"property",emptyNodeForm:"object",stripWhitespaces:!1,enableToStringFunc:!0,ignoreRoot:!1,matchers:s}),o=Qn(t).create({adaptationset:new oi,period:new li}),i}ui.__dashjs_factory_name="DashParser";var ci=c.a.getClassFactory(ui);function di(e){e=e||{};const t=this.context,n=e.debug,i=Object(l.a)(t).getInstance(),r=Object(rt.a)(t).getInstance();let o,c,d,h,f,p=e.mssHandler,g=e.errHandler;function m(e){i.trigger(u.a.INTERNAL_MANIFEST_LOADED,{manifest:e.manifest})}return o={load:function(e){const a=new Yn(e,y.a.MPD_TYPE);d.load({request:a,success:function(a,o,l){if(!h)return;let d,g,m;if(l&&l!==e?(g=r.parseBaseUrl(l),d=l):(r.isRelative(e)&&(e=r.resolve(e,window.location.href)),g=r.parseBaseUrl(e)),"No Content"!=o)if(null===f&&(f=function(e){let i=null;return e.indexOf("SmoothStreamingMedia")>-1?(p&&(i=p.createMssParser(),p.registerEvents()),i):e.indexOf("MPD")>-1||e.indexOf("Patch")>-1?ci(t).create({debug:n}):i}(a)),null!==f){h.setMatchers(f.getMatchers()),h.setIron(f.getIron());try{m=f.parse(a)}catch(t){return void i.trigger(u.a.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new E.a(O.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,O.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+""+e)})}m?(m.url=d||e,m.originalUrl||(m.originalUrl=m.url),m.hasOwnProperty(s.a.LOCATION)&&(g=r.parseBaseUrl(m.Location_asArray[0]),c.debug("BaseURI set by Location to: "+g)),m.baseUri=g,m.loadedTime=new Date,h.resolveManifestOnLoad(m),i.trigger(u.a.ORIGINAL_MANIFEST_LOADED,{originalManifest:a})):i.trigger(u.a.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new E.a(O.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,O.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+""+e)})}else i.trigger(u.a.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new E.a(O.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,O.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+""+e)});else i.trigger(u.a.INTERNAL_MANIFEST_LOADED,{manifest:null})},error:function(t,n,r){i.trigger(u.a.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new E.a(O.MANIFEST_LOADER_LOADING_FAILURE_ERROR_CODE,O.MANIFEST_LOADER_LOADING_FAILURE_ERROR_MESSAGE+`${e}, ${r}`)})}})},reset:function(){i.off(u.a.XLINK_READY,m,o),p&&p.reset(),h&&(h.reset(),h=null),d&&(d.abort(),d=null)}},c=n.getLogger(o),i.on(u.a.XLINK_READY,m,o),d=Xt(t).create({errHandler:e.errHandler,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,useFetch:e.settings.get().streaming.lowLatencyEnabled,urlUtils:r,constants:s.a,dashConstants:a.a,errors:O}),h=Wn(t).create({errHandler:g,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,settings:e.settings}),f=null,o}di.__dashjs_factory_name="ManifestLoader";var hi=c.a.getClassFactory(di);function fi(){let e;const t=this.context,n=Object(l.a)(t).getInstance();return e={error:function(e){n.trigger(u.a.ERROR,{error:e})}},e}fi.__dashjs_factory_name="ErrorHandler";var pi=c.a.getSingletonFactory(fi),gi=n(24);function mi(){const e=this.context;let t,n,i,r,a,o;function l(e,t){const r=n.getRealPeriodByIndex(t?t.index:null);r&&r.AdaptationSet_asArray&&0!==r.AdaptationSet_asArray.length&&(r.AdaptationSet_asArray=r.AdaptationSet_asArray.filter(t=>!t.Representation_asArray||0===t.Representation_asArray.length||!n.getIsTypeOf(t,e)||(t.Representation_asArray=t.Representation_asArray.filter((e,r)=>{const s=n.getCodec(t,r,!0);return!!i.supportsCodec(s)||(a.error("[Stream] codec not supported: "+s),!1)}),t.Representation_asArray&&t.Representation_asArray.length>0)))}return t={setConfig:function(e){e&&(e.adapter&&(n=e.adapter),e.capabilities&&(i=e.capabilities),e.settings&&(r=e.settings))},filterUnsupportedFeaturesOfPeriod:function(e){l(s.a.VIDEO,e),l(s.a.AUDIO,e),r.get().streaming.filterUnsupportedEssentialProperties&&function(e){const t=n.getRealPeriodByIndex(e?e.index:null);if(!t||!t.AdaptationSet_asArray||0===t.AdaptationSet_asArray.length)return;t.AdaptationSet_asArray=t.AdaptationSet_asArray.filter(e=>!e.Representation_asArray||0===e.Representation_asArray.length||(e.Representation_asArray=e.Representation_asArray.filter(e=>{const t=n.getEssentialPropertiesForRepresentation(e);if(t&&t.length>0){let e=0;for(;e0))}(e),function(e){if(!o||0===o.length)return;const t=n.getRealPeriodByIndex(e?e.index:null);if(!t||!t.AdaptationSet_asArray||0===t.AdaptationSet_asArray.length)return;t.AdaptationSet_asArray=t.AdaptationSet_asArray.filter(e=>!e.Representation_asArray||0===e.Representation_asArray.length||(e.Representation_asArray=e.Representation_asArray.filter(e=>!o.some(t=>!t(e))),e.Representation_asArray&&e.Representation_asArray.length>0))}(e)},setCustomCapabilitiesFilters:function(e){o=e}},a=Object(d.a)(e).getInstance().getLogger(t),t}mi.__dashjs_factory_name="CapabilitiesFilter";var _i=c.a.getSingletonFactory(mi);var Ei=class{constructor(){this.t=null,this.xywh=null,this.track=null,this.id=null,this.s=null,this.r=null}};function yi(){let e,t;return e={initialize:function(e){if(t=new Ei,!e)return null;const n=e.indexOf("#");if(-1!==n){const i=e.substr(n+1).split("&");for(let e=0,n=i.length;e-1?e:a.get().streaming.fastSwitchEnabled?20:12},getRetryAttemptsForType:function(e){const t=isNaN(a.get().streaming.retryAttempts.lowLatencyMultiplyFactor)?5:a.get().streaming.retryAttempts.lowLatencyMultiplyFactor;return a.get().streaming.lowLatencyEnabled?a.get().streaming.retryAttempts[e]*t:a.get().streaming.retryAttempts[e]},getRetryIntervalsForType:function(e){const t=isNaN(a.get().streaming.retryIntervals.lowLatencyReductionFactor)?10:a.get().streaming.retryIntervals.lowLatencyReductionFactor;return a.get().streaming.lowLatencyEnabled?a.get().streaming.retryIntervals[e]/t:a.get().streaming.retryIntervals[e]},getLiveDelay:l,getLiveCatchupLatencyThreshold:function(){try{const e=a.get().streaming.liveCatchup.latencyThreshold,t=l();if(null!==e&&!isNaN(e))return Math.max(e,t);const n=a.get().streaming.liveCatchup.minDrift,i=!isNaN(t)&&t?isNaN(n)?l():a.get().streaming.liveCatchup.minDrift+l():NaN;return i&&!isNaN(i)?Math.max(4*i,5):NaN}catch(e){return NaN}},addUTCTimingSource:u,removeUTCTimingSource:c,getUTCTimingSources:function(){return t},clearDefaultUTCTimingSources:function(){t=[]},restoreDefaultUTCTimingSources:function(){let e=a.get().streaming.utcSynchronization.defaultTimingSource;u(e.scheme,e.value)},setXHRWithCredentialsForType:function e(t,i){t?n[t]=!!i:Object.keys(n).forEach(t=>{e(t,i)})},getXHRWithCredentialsForType:function(e){const t=n[e];return void 0===t?n.default:t},getDefaultUtcTimingSource:function(){return a.get().streaming.utcSynchronization.defaultTimingSource},reset:function(){}},t=[],n={default:!1},i=[],e}Ai.__dashjs_factory_name="MediaPlayerModel";var vi=c.a.getSingletonFactory(Ai);function Ii(){let e,t,n,i,r;const s=this.context,a=Object(l.a)(s).getInstance(),o=[];function c(){n&&(n.playbackRate=r||1,n.removeEventListener("canplay",c))}function h(e){n&&(n.readyState<=2&&e>0?n.addEventListener("canplay",c):n.playbackRate=e)}function f(){return o.length>0}function p(e){let t,i=o.indexOf(e);null!==e&&(-1!==i&&o.splice(i,1),n&&!1===f()&&0===n.playbackRate&&(h(r||1),n.paused||(t=document.createEvent("Event"),t.initEvent("playing",!0,!1),n.dispatchEvent(t))))}function g(){if(n&&f()&&0===n.playbackRate){const e=document.createEvent("Event");e.initEvent("waiting",!0,!1),n.dispatchEvent(e)}}function m(){return n?n.buffered:null}function _(e,t,i,r,s){if(n)for(let a=0;a=s&&e<=a)return e;o{"NotAllowedError"===e.name&&a.trigger(u.a.PLAYBACK_NOT_ALLOWED),t.warn(`Caught pending play exception - continuing (${e})`)})}},isPaused:function(){return n?n.paused:null},pause:function(){n&&(n.pause(),n.autoplay=!1)},isStalled:f,isSeeking:function(){return n?n.seeking:null},getTime:function(){return n?n.currentTime:null},getPlaybackRate:function(){return n?n.playbackRate:null},setPlaybackRate:h,getPlayedRanges:function(){return n?n.played:null},getEnded:function(){return n?n.ended:null},setStallState:function(e,t){!function(e,t){t?function(e){let t;if(null===e||!n||n.seeking||-1!==o.indexOf(e))return;o.push(e),n&&1===o.length&&(t=document.createEvent("Event"),t.initEvent("waiting",!0,!1),r=n.playbackRate,h(0),n.dispatchEvent(t))}(e):p(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&&(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,i.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;let 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:function(e,t){n&&n.addEventListener(e,t)},removeEventListener:function(e,t){n&&n.removeEventListener(e,t)},getReadyState:function(){return n?n.readyState:NaN},getBufferRange:m,getClientWidth:function(){return n?n.clientWidth:NaN},getClientHeight:function(){return n?n.clientHeight:NaN},getTextTracks:function(){return n?n.textTracks:[]},getTextTrack:_,addTextTrack:function(e,t,i,r,s){if(!n)return null;let a=_(e,t,i,r,s);return a||(a=n.addTextTrack(e,t,i),a.isEmbedded=s,a.isTTML=r),a},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(){const e=n.parentNode.host||n.parentNode;return e?n.getBoundingClientRect().top-e.getBoundingClientRect().top:NaN},getVideoRelativeOffsetLeft:function(){const e=n.parentNode.host||n.parentNode;return e?n.getBoundingClientRect().left-e.getBoundingClientRect().left:NaN},reset:function(){a.off(u.a.PLAYBACK_PLAYING,g,this)}},t=Object(d.a)(s).getInstance().getLogger(e),e}Ii.__dashjs_factory_name="VideoModel";var Ri=c.a.getSingletonFactory(Ii);const wi=[{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 Ci(e){e=e||{};const t=this.context,n=e.settings;let i,r,a;function o(e){if(void 0!==a)return a;a=!1;let t;try{"undefined"!=typeof window&&(t=window[e])}catch(e){return r.warn("DOMStorage access denied: "+e.message),a}if(!t||"localStorage"!==e&&"sessionStorage"!==e)return a;try{t.setItem("1","1"),t.removeItem("1"),a=!0}catch(e){r.warn("DOMStorage is supported, but cannot be used: "+e.message)}return a}function l(){return 6e5*Math.round((new Date).getTime()/6e5)}function u(e,t){return o(e)&&n.get().streaming[t+"CachingInfo"].enabled}function c(){if(!n)throw new Error(s.a.MISSING_CONFIG_ERROR)}return i={getSavedBitrateSettings:function(e){let t=NaN;if(c(),u("localStorage","lastBitrate")){const i="dashjs_?_bitrate".replace(/\?/,e);try{const s=JSON.parse(localStorage.getItem(i))||{},a=(new Date).getTime()-parseInt(s.timestamp,10)>=n.get().streaming.lastBitrateCachingInfo.ttl||!1,o=parseFloat(s.bitrate);isNaN(o)||a?a&&localStorage.removeItem(i):(t=o,r.debug("Last saved bitrate for "+e+" was "+o))}catch(e){return null}}return t},setSavedBitrateSettings:function(e,t){if(u("localStorage","lastBitrate")&&t){const n="dashjs_?_bitrate".replace(/\?/,e);try{localStorage.setItem(n,JSON.stringify({bitrate:t.toFixed(3),timestamp:l()}))}catch(e){r.error(e.message)}}},getSavedMediaSettings:function(e){let t=null;if(c(),u("localStorage","lastMediaSettings")){const i="dashjs_?_settings".replace(/\?/,e);try{const e=JSON.parse(localStorage.getItem(i))||{},r=(new Date).getTime()-parseInt(e.timestamp,10)>=n.get().streaming.lastMediaSettingsCachingInfo.ttl||!1;t=e.settings,r&&(localStorage.removeItem(i),t=null)}catch(e){return null}}return t},setSavedMediaSettings:function(e,t){if(u("localStorage","lastMediaSettings")){const n="dashjs_?_settings".replace(/\?/,e);try{localStorage.setItem(n,JSON.stringify({settings:t,timestamp:l()}))}catch(e){r.error(e.message)}}}},r=Object(d.a)(t).getInstance().getLogger(i),o("localStorage")&&wi.forEach(e=>{const t=localStorage.getItem(e.oldKey);if(t){localStorage.removeItem(e.oldKey);try{localStorage.setItem(e.newKey,t)}catch(e){r.error(e.message)}}}),i}Ci.__dashjs_factory_name="DOMStorage";var Di=c.a.getSingletonFactory(Ci),Ni=n(37),Mi=n(22);function Li(){const e=this.context;let t,n,i,r,s,a,o,l,u,c,d,h,f,g,m,_;function y(){if(!_||!_.hasOwnProperty("resolve"))throw new Error("setConfig function has to be called previously")}function T(e){if(!e.url)return;const t=new p.a;return t.setInfo(e),t}function S(e,t,n,i){d.trigger(c.SEGMENTS_LOADED,{segments:n,representation:i,error:n?void 0:new E.a(h.SEGMENT_BASE_LOADER_ERROR_CODE,h.SEGMENT_BASE_LOADER_ERROR_MESSAGE)},{streamId:e,mediaType:t})}return t={setConfig:function(e){e.baseURLController&&(_=e.baseURLController),e.dashMetrics&&(a=e.dashMetrics),e.mediaPlayerModel&&(l=e.mediaPlayerModel),e.errHandler&&(i=e.errHandler),e.settings&&(o=e.settings),e.boxParser&&(r=e.boxParser),e.events&&(c=e.events),e.eventBus&&(d=e.eventBus),e.debug&&(n=e.debug.getLogger(t)),e.requestModifier&&(s=e.requestModifier),e.errors&&(h=e.errors),e.urlUtils&&(m=e.urlUtils),e.constants&&(f=e.constants),e.dashConstants&&(g=e.dashConstants)},initialize:function(){u=Xt(e).create({errHandler:i,dashMetrics:a,mediaPlayerModel:l,requestModifier:s,useFetch:o?o.get().streaming.lowLatencyEnabled:null,boxParser:r,errors:h,urlUtils:m,constants:f,dashConstants:g})},loadInitialization:function e(t,i,s,a){y();let o=null;const l=s?_.resolve(s.path):null,h=a||{init:!0,url:l?l.url:void 0,range:{start:0,end:1500},searching:!1,bytesLoaded:0,bytesToLoad:1500,mediaType:i};n.debug("Start searching for initialization.");const f=T(h);u.load({request:f,success:function(n){h.bytesLoaded=h.range.end,o=r.findInitRange(n),o?(s.range=o,d.trigger(c.INITIALIZATION_LOADED,{representation:s},{streamId:t,mediaType:i})):(h.range.end=h.bytesLoaded+h.bytesToLoad,e(t,i,s,h))},error:function(){d.trigger(c.INITIALIZATION_LOADED,{representation:s},{streamId:t,mediaType:i})}}),n.debug("Perform init search: "+h.url)},loadSegments:function e(t,i,s,a,o,l){if(y(),a&&(void 0===a.start||void 0===a.end)){const e=a?a.toString().split("-"):null;a=e?{start:parseFloat(e[0]),end:parseFloat(e[1])}:null}o=o||S;let c=null,d=null;const h=!!a,f=s?_.resolve(s.path):null,p={init:!1,url:f?f.url:void 0,range:h?a:{start:0,end:1500},searching:!h,bytesLoaded:l?l.bytesLoaded:0,bytesToLoad:1500,mediaType:i},g=T(p);u.load({request:g,success:function(a){const l=p.bytesToLoad,u=a.byteLength;if(p.bytesLoaded=p.range.end-p.range.start,c=r.parse(a),d=c.getBox("sidx"),d&&d.isComplete){const r=d.references;let a,l;if(null!=r&&r.length>0&&(a=1===r[0].reference_type),a){let a,l,u,c,h;n.debug("Initiate multiple SIDX load."),p.range.end=p.range.start+d.size;let f=[],g=0,m=(d.offset||p.range.start)+d.size;const _=function(e,t,n){n?(f=f.concat(n),g++,g>=l&&(f.sort((function(e,t){return e.startTime-t.startTime<0?-1:0})),o(e,t,f,s))):o(e,t,null,s)};for(a=0,l=r.length;a16777215?(n.getUint32(i)!==e.tag&&(a=!1),o=4):e.tag>65535?(r=n.getUint16(i),s=n.getUint8(i+2),256*r+s!==e.tag&&(a=!1),o=3):e.tag>255?(n.getUint16(i)!==e.tag&&(a=!1),o=2):(n.getUint8(i)!==e.tag&&(a=!1),o=1),!a&&e.required&&!t)throw new Error("required tag not found");return a&&(i+=o),a}function s(e){let t=1,r=128,s=-1,a=0,o=n.getUint8(i),l=0;for(l=0;l<8;l+=1){if((o&r)===r){a=void 0===e?o&~r:o,s=l;break}r>>=1}for(l=0;l0!==e.length).map(e=>{let t={name:e},n=e.indexOf("[");if(-1!=n){t.name=e.substring(0,n);let i=e.substring(n+1,e.length-1);this.valid=this.valid&&-1==i.indexOf("[");let r=i.indexOf("=");-1!=r?(t.attribute={name:i.substring(1,r),value:i.substring(r+1)},-1!=["'",'"'].indexOf(t.attribute.value[0])&&(t.attribute.value=t.attribute.value.substring(1,t.attribute.value.length-1))):t.position=parseInt(i,10)-1}return t})}isValid(){return this.valid}findsElement(){return!this.findsAttribute()}findsAttribute(){return this.path[this.path.length-1].name.startsWith("@")}getMpdTarget(e,t){let n=null,i=e,r=1,s="MPD";for(;re[n.name]==n.value)[0]||null}else i=t[0]||null}r++}return null===i?null:s.startsWith("@")?{name:s.substring(1),leaf:i,target:i}:{name:s,leaf:i,target:t?n:i}}};var ji=class{constructor(e,t,n){this.action=e,this.xpath=t,this.value=n,this.position=null}getMpdTarget(e){let t="remove"===this.action||"replace"===this.action||"before"===this.position||"after"===this.position;return this.xpath.getMpdTarget(e,t)}};function Vi(){let e,t;const n=this.context;return e={getIsPatch:function(e){return e&&e.hasOwnProperty(a.a.ORIGINAL_MPD_ID)||!1},getPublishTime:function(e){return e&&e.hasOwnProperty(a.a.PUBLISH_TIME)?new Date(e[a.a.PUBLISH_TIME]):null},getOriginalPublishTime:function(e){return e&&e.hasOwnProperty(a.a.ORIGINAL_PUBLISH_TIME)?new Date(e[a.a.ORIGINAL_PUBLISH_TIME]):null},getMpdId:function(e){return e&&e[a.a.ORIGINAL_MPD_ID]||null},getPatchOperations:function(e){return e?(e.__children||[]).map(e=>{let n=Object.keys(e)[0];if("add"!==n&&"remove"!==n&&"replace"!==n)return t.warn("Ignoring node of invalid action: "+n),null;let i=e[n],r=i.sel;if("add"===n&&i.type){if(!i.type.startsWith("@"))return t.warn(`Ignoring add action for prefixed namespace declaration: ${i.type}=${i.__text}`),null;r=`${r}/${i.type}`}let s=new qi(r);if(!s.isValid())return t.warn(`Ignoring action with invalid selector: ${n} - ${r}`),null;let a=null;s.findsAttribute()?a=i.__text||"":"remove"!==n&&(a=i.__children.reduce((e,t)=>{let n=Object.keys(t)[0];return"#text"!==n&&(e[n]=e[n]||[],e[n].push(t[n])),e},{}));let o=new ji(n,s,a);return"add"===n&&(o.position=i.pos),o}).filter(e=>!!e):[]}},t=Object(d.a)(n).getInstance().getLogger(e),e}Vi.__dashjs_factory_name="PatchManifestModel";var Ki=c.a.getSingletonFactory(Vi);function Wi(){let e,t,n,i,r,s,o,l;const u=this.context;function c(e,n,r){const o=t.getAdaptationsForType(i[0].mpd.manifest,e,n);if(!o||0===o.length)return null;if(o.length>1&&r){const e=h(r,n);if(s[r.id]&&s[r.id][n])for(let t=0,i=o.length;t0))return _;m=i[0].mpd.manifest}const S=E(e,g);S&&(p=S.id);const A=t.getAdaptationsForType(m,e?e.index:null,n!==o.EMBEDDED_TEXT?n:o.VIDEO);if(!A||0===A.length)return _;for(r[p]=r[p]||t.getAdaptationsForPeriod(S),c=0,h=A.length;ce.index===u)),n===o.EMBEDDED_TEXT){let e=l.accessibility.length;for(d=0;d0?i[0].mpd.manifest:null)}function _(e){return e&&e.streamInfo&&void 0!==e.streamInfo.id&&r[e.streamInfo.id]?r[e.streamInfo.id].find(t=>t.index==e.index):null}function E(e,t){const n=t.length;for(let i=0;it.index==e.index);let r;return n.id=e.id,n.index=e.index,n.type=e.type,n.streamInfo=S(e.period),n.representationCount=t.getRepresentationCount(i),n.labels=t.getLabelsForAdaptation(i),n.lang=t.getLanguageForAdaptation(i),r=t.getViewpointForAdaptation(i),n.viewpoint=r?r.value:void 0,n.accessibility=t.getAccessibilityForAdaptation(i).map((function(e){let t=e.value,i=t;return e.schemeIdUri&&e.schemeIdUri.search("cea-608")>=0&&void 0!==l&&(i=t?"cea-608:"+t:"cea-608",n.embeddedCaptions=!0),i})),n.audioChannelConfiguration=t.getAudioChannelConfigurationForAdaptation(i).map((function(e){return e.value})),0===n.audioChannelConfiguration.length&&Array.isArray(i.Representation_asArray)&&i.Representation_asArray.length>0&&(n.audioChannelConfiguration=t.getAudioChannelConfigurationForRepresentation(i.Representation_asArray[0]).map((function(e){return e.value}))),n.roles=t.getRolesForAdaptation(i).map((function(e){return e.value})),n.codec=t.getCodec(i),n.mimeType=t.getMimeType(i),n.contentProtection=t.getContentProtectionData(i),n.bitrateList=t.getBitrateListForAdaptation(i),n.contentProtection&&n.contentProtection.forEach((function(e){e.KID=t.getKID(e)})),n.isText=t.getIsTextTrack(n.mimeType),n.supplementalProperties=t.getSupplementalPropperties(i),n}function T(e,t,n){e.id=t,e.index=100+parseInt(t.substring(2,3)),e.type=o.EMBEDDED_TEXT,e.codec="cea-608-in-SEI",e.isText=!0,e.isEmbedded=!0,e.lang=n,e.roles=["caption"]}function S(e){let n=new Hi;return n.id=e.id,n.index=e.index,n.start=e.start,n.duration=e.duration,n.manifestInfo=function(e){let n=new Yi;return n.DVRWindowSize=e.timeShiftBufferDepth,n.loadedTime=e.manifest.loadedTime,n.availableFrom=e.availabilityStartTime,n.minBufferTime=e.manifest.minBufferTime,n.maxFragmentDuration=e.maxSegmentDuration,n.duration=t.getDuration(e.manifest),n.isDynamic=t.getIsDynamic(e.manifest),n.serviceDescriptions=t.getServiceDescriptions(e.manifest),n.protocol=e.manifest.protocol,n}(e.mpd),n.isLast=1===e.mpd.manifest.Period_asArray.length||Math.abs(n.start+n.duration-n.manifestInfo.duration)<1,n}function b(){if(!o)throw new Error("setConfig function has to be called previously")}function A(e){return i.length>0?i[0].mpd.manifest.Period_asArray[e]:null}function v(e,t,n){let i,r,s,a,o,l;if(e)for(r=e.AdaptationSet_asArray,o=0;ot.index==e.adaptation.index),r=t.getRepresentationFor(e.index,i);return n.id=e.id,n.quality=e.index,n.bandwidth=t.getBandwidth(r),n.DVRWindow=e.segmentAvailabilityRange,n.fragmentDuration=e.segmentDuration||(e.segments&&e.segments.length>0?e.segments[0].duration:NaN),n.MSETimeOffset=e.MSETimeOffset,n.mediaInfo=y(e.adaptation),n}return null},getDataForMedia:_,getStreamsInfo:function(e,t){const n=[];let r=i;if(e&&(b(),r=f(e)),r.length>0){(!t||t>r.length)&&(t=r.length);for(let e=0;e0&&s&&(r=t.getAdaptationForIndex(n?n.index:null,i[0].mpd.manifest,s.index)),r},getRealPeriodByIndex:function(e){return t.getRealPeriodForIndex(e,i[0].mpd.manifest)},getEssentialPropertiesForRepresentation:function(e){try{return t.getEssentialPropertiesForRepresentation(e)}catch(e){return[]}},getVoRepresentations:function(e){let n;const i=_(e);return n=t.getRepresentationsForAdaptation(i),n},getEventsFor:function(e,n){let r=[];if(i.length>0){const s=i[0].mpd.manifest;e instanceof Hi?r=t.getEventsForPeriod(E(e,i)):e instanceof zi?r=t.getEventStreamForAdaptationSet(s,_(e)):e instanceof Gi&&(r=t.getEventStreamForRepresentation(s,n))}return r},getEvent:function(e,t,n,i){try{if(!e||!t||isNaN(n)||!i)return null;const r=e.scheme_id_uri,s=e.value;if(!t[r+"/"+s])return null;const a=new At,o=e.timescale||1,l=i.adaptation.period.start,u=t[r+"/"+s],c=isNaN(i.presentationTimeOffset)?isNaN(u.presentationTimeOffset)?0:u.presentationTimeOffset:i.presentationTimeOffset;let d,h=e.presentation_time_delta/o;d=0===e.version?l+n-c+h:l-c+h;const f=e.event_duration,p=e.id,g=e.message_data;return a.eventStream=u,a.eventStream.value=s,a.eventStream.timescale=o,a.duration=f,a.id=p,a.calculatedPresentationTime=d,a.messageData=g,a.presentationTimeDelta=h,a}catch(e){return null}},getMpd:p,setConfig:function(e){e&&(e.constants&&(o=e.constants),e.cea608parser&&(l=e.cea608parser),e.errHandler&&t.setConfig({errHandler:e.errHandler}),e.BASE64&&t.setConfig({BASE64:e.BASE64}))},updatePeriods:function(e){if(!e)return null;b(),i=f(e),r={}},getIsTextTrack:function(e){return t.getIsTextTrack(e)},getUTCTimingSources:function(){const e=m();return t.getUTCTimingSources(e)},getSuggestedPresentationDelay:function(){const e=i.length>0?i[0].mpd:null;return t.getSuggestedPresentationDelay(e)},getAvailabilityStartTime:function(e){const n=p(e);return t.getAvailabilityStartTime(n)},getIsTypeOf:function(e,n){return t.getIsTypeOf(e,n)},getIsDynamic:function(e){const n=m(e);return t.getIsDynamic(n)},getDuration:function(e){const n=m(e);return t.getDuration(n)},getRegularPeriods:f,getLocation:function(e){return t.getLocation(e)},getPatchLocation:function(e){const n=t.getPatchLocation(e),i=t.getPublishTime(e);if(!n||!i)return null;if(n.hasOwnProperty("ttl")&&i){const e=1e3*parseFloat(n.ttl);if(i.getTime()+e<=(new Date).getTime())return null}return n.__text},getManifestUpdatePeriod:function(e,n=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,i){return t.getCodec(e,n,i)},getVoAdaptations:function(){return r},getVoPeriods:function(){return i},getPeriodById:function(e){if(!e||0===i.length)return null;const t=i.filter(t=>t.id===e);return t&&t.length>0?t[0]:null},setCurrentMediaInfo:function(e,t,n){s[e]=s[e]||{},s[e][t]=s[e][t]||{},s[e][t]=n},isPatchValid:function(e,i){let r=t.getId(e),s=n.getMpdId(i),a=t.getPublishTime(e),o=n.getPublishTime(i),l=n.getOriginalPublishTime(i);return!!(r&&s&&r==s&&a&&l&&a.getTime()==l.getTime()&&o&&a.getTime(){let n=t.getMpdTarget(e);if(null===n)return;let{name:i,target:r,leaf:s}=n;if(t.xpath.findsAttribute()){switch(t.action){case"add":case"replace":r[i]=t.value;break;case"remove":delete r[i]}return}let a=(r[i+"_asArray"]||[]).indexOf(s),o="prepend"===t.position||"before"===t.position;if(("remove"===t.action||"replace"===t.action)&&(delete r[i],-1!=a)){let e=r[i+"_asArray"];e.splice(a,1),e.length>1?r[i]=e:1==e.length?r[i]=e[0]:delete r[i+"_asArray"]}"add"!==t.action&&"replace"!==t.action||Object.keys(t.value).forEach(e=>{let n=t.value[e],s=r[e+"_asArray"]||[];if(0===s.length&&r[e]&&s.push(r[e]),0===s.length)s=n;else{let r=s.length;r=e==i&&-1!=a?a+(o?0:1)+("replace"==t.action?-1:0):o?0:s.length,s.splice.apply(s,[r,0].concat(n))}r[e+"_asArray"]=s,r[e]=1==s.length?s[0]:s})})},reset:g},t=Dt(u).getInstance(),n=Ki(u).getInstance(),g(),e}Wi.__dashjs_factory_name="DashAdapter";var Xi=c.a.getSingletonFactory(Wi);var Qi=class{constructor(){this.TcpList=[],this.HttpList=[],this.RepSwitchList=[],this.BufferLevel=[],this.BufferState=[],this.PlayList=[],this.DroppedFrames=[],this.SchedulingInfo=[],this.DVRInfo=[],this.ManifestUpdate=[],this.RequestsQueue=null,this.DVBErrors=[]}};var $i=class{constructor(){this.t=null,this.mt=null,this.to=null,this.lto=null}};var Zi=class{constructor(){this.t=null,this.level=null}};var Ji=class{constructor(){this.target=null,this.state=o.BUFFER_EMPTY}};var er=class{constructor(){this.time=null,this.range=null,this.manifestInfo=null}};var tr=class{constructor(){this.time=null,this.droppedFrames=null}};class nr{constructor(){this.mediaType=null,this.type=null,this.requestTime=null,this.fetchTime=null,this.availabilityStartTime=null,this.presentationStartTime=0,this.clientTimeOffset=0,this.currentTime=null,this.buffered=null,this.latency=0,this.streamInfo=[],this.representationInfo=[]}}class ir{constructor(){this.id=null,this.index=null,this.start=null,this.duration=null}}class rr{constructor(){this.id=null,this.index=null,this.mediaType=null,this.streamIndex=null,this.presentationTimeOffset=null,this.startNumber=null,this.fragmentInfoType=null}}var sr=class{constructor(){this.mediaType=null,this.t=null,this.type=null,this.startTime=null,this.availabilityStartTime=null,this.duration=null,this.quality=null,this.range=null,this.state=null}};var ar=class{constructor(){this.loadingRequests=[],this.executedRequests=[]}};function or(e){const t=(e=e||{}).settings;let n,i,r=this.context,a=Object(l.a)(r).getInstance();function c(){a.trigger(u.a.METRICS_CHANGED)}function d(e){a.trigger(u.a.METRIC_CHANGED,{mediaType:e}),c()}function h(e,t,n){a.trigger(u.a.METRIC_UPDATED,{mediaType:e,metric:t,value:n}),d(e)}function f(e,t,n){a.trigger(u.a.METRIC_ADDED,{mediaType:e,metric:t,value:n}),d(e)}function p(e,t){let n=null;return e?(i.hasOwnProperty(e)?n=i[e]:t||(n=new Qi,i[e]=n),n):n}function g(e,n,i){let r=p(e);null!==r&&(r[n].push(i),r[n].length>t.get().streaming.metricsMaxListDepth&&r[n].shift())}function m(e,t,n){g(e,t,n),f(e,t,n)}return n={clearCurrentMetricsForType:function(e){delete i[e],d(e)},clearAllCurrentMetrics:function(){i={},c()},getMetricsFor:p,addHttpRequest:function e(t,n,i,r,s,a,l,u,c,d,h,f,p,g,_){let E=new y.a;a&&a!==r&&(e(t,null,i,r,s,null,null,u,c,null,null,null,p,null,null),E.actualurl=a),E.tcpid=n,E.type=i,E.url=r,E.range=u,E.trequest=c,E.tresponse=d,E.responsecode=f,E._tfinish=h,E._stream=t,E._mediaduration=p,E._quality=s,E._responseHeaders=g,E._serviceLocation=l,_?_.forEach(e=>{!function(e,t,n,i){let r=new y.b;r.s=t,r.d=n,r.b=i,e.trace.push(r),e.interval||(e.interval=0),e.interval+=n}(E,e.s,e.d,e.b)}):(delete E.interval,delete E.trace),m(t,o.HTTP_REQUEST,E)},addRepresentationSwitch:function(e,t,n,i,r){let s=new $i;s.t=t,s.mt=n,s.to=i,r?s.lto=r:delete s.lto,m(e,o.TRACK_SWITCH,s)},addBufferLevel:function(e,t,n){let i=new Zi;i.t=t,i.level=n,m(e,o.BUFFER_LEVEL,i)},addBufferState:function(e,t,n){let i=new Ji;i.target=n,i.state=t,m(e,o.BUFFER_STATE,i)},addDVRInfo:function(e,t,n,i){let r=new er;r.time=t,r.range=i,r.manifestInfo=n,m(e,o.DVR_INFO,r)},addDroppedFrames:function(e,t){let n=new tr,i=p(e).DroppedFrames;t&&(n.time=t.creationTime,n.droppedFrames=t.droppedVideoFrames,i.length>0&&i[i.length-1]==n||m(e,o.DROPPED_FRAMES,n))},addSchedulingInfo:function(e,t,n,i,r,s,a,l,u){let c=new sr;c.mediaType=e,c.t=t,c.type=n,c.startTime=i,c.availabilityStartTime=r,c.duration=s,c.quality=a,c.range=l,c.state=u,m(e,o.SCHEDULING_INFO,c)},addRequestsQueue:function(e,t,n){let i=new ar;i.loadingRequests=t,i.executedRequests=n,p(e).RequestsQueue=i,f(e,o.REQUESTS_QUEUE,i)},addManifestUpdate:function(e,t,n,i,r,a,l,u,c,d){let h=new nr;h.mediaType=e,h.type=t,h.requestTime=n,h.fetchTime=i,h.availabilityStartTime=r,h.presentationStartTime=a,h.clientTimeOffset=l,h.currentTime=u,h.buffered=c,h.latency=d,g(s.a.STREAM,o.MANIFEST_UPDATE,h),f(e,o.MANIFEST_UPDATE,h)},updateManifestUpdateInfo:function(e,t){if(e){for(let n in t)e[n]=t[n];h(e.mediaType,o.MANIFEST_UPDATE,e)}},addManifestUpdateStreamInfo:function(e,t,n,i,r){if(e){let s=new ir;s.id=t,s.index=n,s.start=i,s.duration=r,e.streamInfo.push(s),h(e.mediaType,o.MANIFEST_UPDATE_STREAM_INFO,e)}},addManifestUpdateRepresentationInfo:function(e,t,n,i,r,s,a,l){if(e&&e.representationInfo){const u=new rr;u.id=t,u.index=n,u.streamIndex=i,u.mediaType=r,u.startNumber=a,u.fragmentInfoType=l,u.presentationTimeOffset=s,e.representationInfo.push(u),h(e.mediaType,o.MANIFEST_UPDATE_TRACK_INFO,e)}},addPlayList:function(e){e.trace&&Array.isArray(e.trace)?e.trace.forEach(e=>{e.hasOwnProperty("subreplevel")&&!e.subreplevel&&delete e.subreplevel}):delete e.trace,m(s.a.STREAM,o.PLAY_LIST,e)},addDVBErrors:function(e){m(s.a.STREAM,o.DVB_ERRORS,e)}},i={},n}or.__dashjs_factory_name="MetricsModel";var lr=c.a.getSingletonFactory(or);function ur(e){e=e||{};const t=this.context;let n,i,r,a,l=e.metricsModel;function u(e){const t=l.getMetricsFor(e,!0);if(!t)return null;const n=t.HttpList;let i,r=null;if(!n||n.length<=0)return null;for(i=n.length-1;i>=0;){if(n[i].responsecode){r=n[i];break}i--}return r}function c(e){const t=l.getMetricsFor(e,!0);return t&&t.HttpList?t.HttpList:[]}function d(e,t){if(!e)return null;const n=e[t];return n&&0!==n.length?n[n.length-1]:null}return n={getCurrentRepresentationSwitch:function(e){return d(l.getMetricsFor(e,!0),o.TRACK_SWITCH)},getCurrentBufferState:function(e){return d(l.getMetricsFor(e,!0),o.BUFFER_STATE)},getCurrentBufferLevel:function(e){const t=d(l.getMetricsFor(e,!0),o.BUFFER_LEVEL);return t?class{static round10(e,t){return function(e,t,n){if(void 0===n||0==+n)return Math[e](t);if(n=+n,null===(t=+t)||isNaN(t)||!("number"==typeof n&&n%1==0))return NaN;return t=t.toString().split("e"),+((t=(t=Math[e](+(t[0]+"e"+(t[1]?+t[1]-n:-n)))).toString().split("e"))[0]+"e"+(t[1]?+t[1]+n:n))}("round",e,t)}}.round10(t.level/1e3,-3):0},getCurrentHttpRequest:u,getHttpRequests:c,getCurrentDroppedFrames:function(){return d(l.getMetricsFor(s.a.VIDEO,!0),o.DROPPED_FRAMES)},getCurrentSchedulingInfo:function(e){return d(l.getMetricsFor(e,!0),o.SCHEDULING_INFO)},getCurrentDVRInfo:function(e){return d(e?l.getMetricsFor(e,!0):l.getMetricsFor(s.a.VIDEO,!0)||l.getMetricsFor(s.a.AUDIO,!0),o.DVR_INFO)},getCurrentManifestUpdate:function(){return d(l.getMetricsFor(s.a.STREAM),o.MANIFEST_UPDATE)},getLatestFragmentRequestHeaderValueByID:function(e,t){let n={},i=u(e);return i&&(n=dt.a.parseHttpHeaders(i._responseHeaders)),void 0===n[t]?null:n[t]},getLatestMPDRequestHeaderValueByID:function(e){let t,n,i,r={};for(t=c(s.a.STREAM),i=t.length-1;i>=0;i--)if(n=t[i],n.type===y.a.MPD_TYPE){r=dt.a.parseHttpHeaders(n._responseHeaders);break}return void 0===r[e]?null:r[e]},addRepresentationSwitch:function(e,t,n,i,r){l.addRepresentationSwitch(e,t,n,i,r)},addDVRInfo:function(e,t,n,i){l.addDVRInfo(e,t,n,i)},updateManifestUpdateInfo:function(e){const t=this.getCurrentManifestUpdate();l.updateManifestUpdateInfo(t,e)},addManifestUpdateStreamInfo:function(e){if(e){const t=this.getCurrentManifestUpdate();l.addManifestUpdateStreamInfo(t,e.id,e.index,e.start,e.duration)}},addManifestUpdateRepresentationInfo:function(e,t){if(e){const n=this.getCurrentManifestUpdate();l.addManifestUpdateRepresentationInfo(n,e.id,e.index,e.streamIndex,t,e.presentationTimeOffset,e.startNumber,e.fragmentInfoType)}},addManifestUpdate:function(e){l.addManifestUpdate(s.a.STREAM,e.type,e.requestStartDate,e.requestEndDate)},addHttpRequest:function(e,t,n,i,r){l.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,i,r)},addSchedulingInfo:function(e,t){l.addSchedulingInfo(e.mediaType,new Date,e.type,e.startTime,e.availabilityStartTime,e.duration,e.quality,e.range,t)},addRequestsQueue:function(e,t,n){l.addRequestsQueue(e,t,n)},addBufferLevel:function(e,t,n){l.addBufferLevel(e,t,n)},addBufferState:function(e,t,n){l.addBufferState(e,t,n)},addDroppedFrames:function(e){l.addDroppedFrames(s.a.VIDEO,e)},addPlayList:function(){a&&(l.addPlayList(a),a=null)},addDVBErrors:function(e){l.addDVBErrors(e)},createPlaylistMetrics:function(e,t){a=new st,a.start=new Date,a.mstart=e,a.starttype=t},createPlaylistTraceMetrics:function(e,t,n){!0===i&&(i=!1,r=new at,r.representationid=e,r.start=new Date,r.mstart=t,r.playbackspeed=null!==n?n.toString():null)},updatePlayListTraceMetrics:function(e){if(r)for(let t in r)r[t]=e[t]},pushPlayListTraceMetrics:function(e,t){if(!1===i&&a&&r&&r.start){const n=r.start,s=e.getTime()-n.getTime();r.duration=s,r.stopreason=t,a.trace.push(r),i=!0}},clearAllCurrentMetrics:function(){l.clearAllCurrentMetrics()}},l=l||lr(t).getInstance({settings:e.settings}),i=!0,r=null,a=null,n}ur.__dashjs_factory_name="DashMetrics";var cr=c.a.getSingletonFactory(ur);function dr(){const e=this.context,t=Object(l.a)(e).getInstance(),n=ft(e).getInstance();let i,r,s,o,c;function d(e){s=e}function h(e,t,n,i){let r=NaN;return r=i?n&&t.timeShiftBufferDepth!=Number.POSITIVE_INFINITY?new Date(t.availabilityStartTime.getTime()+1e3*(e+t.timeShiftBufferDepth)):t.availabilityEndTime:n?new Date(t.availabilityStartTime.getTime()+1e3*(e-s)):t.availabilityStartTime,r}function f(e,t){return(e.getTime()-t.mpd.availabilityStartTime.getTime()+1e3*s)/1e3}function p(e,t){return e+(t.adaptation.period.start-t.presentationTimeOffset)}function g(e){void 0!==e.offset&&(d(e.offset/1e3),o=!0)}function m(){s=0,o=!1,c=NaN}function _(){t.off(u.a.UPDATE_TIME_SYNC_OFFSET,g,this),m()}return i={initialize:function(){m(),t.on(u.a.UPDATE_TIME_SYNC_OFFSET,g,this)},getClientTimeOffset:function(){return s},setClientTimeOffset:d,getExpectedLiveEdge:function(){return c},setExpectedLiveEdge:function(e){c=e},calcAvailabilityStartTimeFromPresentationTime:function(e,t,n){return h.call(this,e,t,n)},calcAvailabilityEndTimeFromPresentationTime:function(e,t,n){return h.call(this,e,t,n,!0)},calcPresentationTimeFromWallTime:f,calcPresentationTimeFromMediaTime:p,calcPeriodRelativeTimeFromMpdRelativeTime:function(e,t){return t-e.adaptation.period.start},calcMediaTimeFromPresentationTime:function(e,t){return e-t.adaptation.period.start+t.presentationTimeOffset},calcSegmentAvailabilityRange:function(e,t){const i=e.adaptation.period,s={start:i.start,end:i.start+i.duration};if(!t)return s;if(!o&&e.segmentAvailabilityRange)return e.segmentAvailabilityRange;const l=e.segmentDuration||(e.segments&&e.segments.length?e.segments[e.segments.length-1].duration:0);if(e.segmentInfoType===a.a.SEGMENT_TIMELINE&&n.get().streaming.calcSegmentAvailabilityRangeFromTimeline)return function(e){const t=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index],n=r.getRepresentationFor(e.index,t),i=n.SegmentTemplate.SegmentTimeline,s=n.SegmentTemplate.timescale,a=i.S_asArray,o={start:0,end:0};let l,u,c,d,h=0;for(o.start=p(a[0].t/s,e),c=0,d=a.length;c=c&&u-dt.range.end-n&&(i=t.range.end-n),i}function fe(e){if(!C)throw t;let n=Ee().currentTime;if(void 0!==e)n=W.getTimeRelativeToStreamId(n,e);else if(Q.getIsDynamic()){let e=$.getCurrentDVRInfo();n=null===e||0===n?0:Math.max(0,n-e.range.start)}return n}function pe(){if(!C)throw t;let e=Ee().duration;if(Q.getIsDynamic()){let t=$.getCurrentDVRInfo();e=t?t.range.end-t.range.start:0}return e}function ge(e){Object(v.b)(e,"boolean"),D=e}function me(){H.restoreDefaultUTCTimingSources()}function _e(){return $}function Ee(){if(!ee.getElement())throw n;return ee.getElement()}function ye(e){if(!I)throw"MediaPlayer not initialized!";ee.setElement(e),e&&(Re(),function(){if(F)return;let e=dashjs.MetricsReporting;if("function"==typeof e){let t=e(h).create();F=t.createMetricsReporting({debug:m,eventBus:p,mediaElement:Ee(),adapter:z,dashMetrics:$,events:u.a,constants:s.a,metricsConstants:o})}}(),function(){if(k)return;let e=dashjs.MssHandler;"function"==typeof e&&(O.extend(e.errors),k=e(h).create({eventBus:p,mediaPlayerModel:H,dashMetrics:$,manifestModel:Z,playbackController:Q,streamController:W,protectionController:U,baseURLController:j,errHandler:q,events:u.a,constants:s.a,debug:m,initSegmentType:y.a.INIT_SEGMENT_TYPE,BASE64:pr.a,ISOBoxer:N.a,settings:g}))}(),W&&W.switchToVideoElement()),C&&ve(),De()}function Te(t){if(!w)throw e;let n=W.getActiveStreamInfo();return P.getTracksFor(t,n)}function Se(e,t){let n=-1;e.some((e,i)=>{if(e===t)return n=i,!0}),n<0||e.splice(n,1)}function be(e){if(!I)throw"MediaPlayer not initialized!";"string"==typeof e&&ne.initialize(e),b=e,(w||C)&&ve(),ue()&&De()}function Ae(){if(!w)throw e;let t=W.getActiveStreamInfo();return t?W.getStreamById(t.id):null}function ve(){C=!1,w=!1,z.reset(),W.reset(),X.reset(),Q.reset(),M.reset(),P.reset(),te.reset(),U&&(g.get().streaming.keepProtectionMediaKeys?U.stop():(U.reset(),U=null,Re())),J.reset()}function Ie(){return hi(h).create({debug:m,errHandler:q,dashMetrics:$,mediaPlayerModel:H,requestModifier:it(h).getInstance(),mssHandler:k,settings:g})}function Re(){if(U)return U;let e=dashjs.Protection;if("function"==typeof e){let t=e(h).create();return u.a.extend(e.events),B.a.extend(e.events,{publicOnly:!0}),O.extend(e.errors),V||(V=Object(gi.a)(h).getInstance()),U=t.createProtectionSystem({debug:m,errHandler:q,videoModel:ee,capabilities:V,eventBus:p,events:u.a,BASE64:pr.a,constants:s.a,cmcdModel:J,settings:g}),U&&(U.setLicenseRequestFilters(se),U.setLicenseResponseFilters(ae)),U}return null}function we(){if(!I)throw"MediaPlayer not initialized!";if(G)return G;let e=dashjs.OfflineController;if("function"==typeof e){u.a.extend(e.events),B.a.extend(e.events,{publicOnly:!0}),O.extend(e.errors);const t=Ie(),n=cn(h).create();return n.setConfig({manifestModel:Z,adapter:z,manifestLoader:t,errHandler:q}),G=e(h).create({debug:m,manifestUpdater:n,baseURLController:j,manifestLoader:t,manifestModel:Z,mediaPlayerModel:H,abrController:M,playbackController:Q,adapter:z,errHandler:q,dashMetrics:$,timelineConverter:x,schemeLoaderFactory:L,eventBus:p,events:u.a,errors:O,constants:s.a,settings:g,dashConstants:a.a,urlUtils:Object(rt.a)(h).getInstance()}),G}return null}function Ce(e){let t,n,i=$.getCurrentDVRInfo();return i?(t=i.manifestInfo.availableFrom.getTime()/1e3,n=e+(t+i.range.start),n):0}function De(){G&&G.resetRecords(),!w&&b&&(w=!0,T.info("Streaming Initialized"),function(){const e=Ie();W||(W=yn(h).getInstance()),K.setConfig({capabilities:V,adapter:z,settings:g}),K.setCustomCapabilitiesFilters(oe),W.setConfig({capabilities:V,capabilitiesFilter:K,manifestLoader:e,manifestModel:Z,mediaPlayerModel:H,protectionController:U,adapter:z,dashMetrics:$,errHandler:q,timelineConverter:x,videoModel:ee,playbackController:Q,abrController:M,mediaController:P,textController:te,settings:g,baseURLController:j}),X.setConfig({settings:g,playbackController:Q,streamController:W,videoModel:ee,timelineConverter:x,adapter:z}),Q.setConfig({streamController:W,dashMetrics:$,mediaPlayerModel:H,adapter:z,videoModel:ee,timelineConverter:x,uriFragmentModel:ne,settings:g}),M.setConfig({streamController:W,domStorage:ie,mediaPlayerModel:H,dashMetrics:$,adapter:z,videoModel:ee,settings:g}),te.setConfig({errHandler:q,manifestModel:Z,adapter:z,mediaController:P,streamController:W,videoModel:ee}),J.setConfig({abrController:M,dashMetrics:$,playbackController:Q}),W.initialize(D,A),X.initialize(),J.initialize()}(),"string"==typeof b?W.load(b):W.loadWithManifest(b)),!C&&ue()&&(C=!0,T.info("Playback Initialized"))}return _={initialize:function(e,t,n){V||(V=Object(gi.a)(h).getInstance()),q=pi(h).getInstance(),V.supportsMediaSource()?I||(I=!0,x=hr(h).getInstance(),M||(M=Be(h).getInstance(),M.setConfig({settings:g})),L||(L=Kt(h).getInstance()),Q||(Q=f(h).getInstance()),P||(P=vn(h).getInstance()),W||(W=yn(h).getInstance()),X||(X=Sn(h).getInstance()),K||(K=_i(h).getInstance()),z=Xi(h).getInstance(),Z=bi(h).getInstance(),J=Yt(h).getInstance(),$=cr(h).getInstance({settings:g}),te=Y(h).getInstance(),ie=Di(h).getInstance({settings:g}),z.setConfig({constants:s.a,cea608parser:r.a,errHandler:q,BASE64:pr.a}),j||(j=zn(h).create()),j.setConfig({adapter:z}),re=ki(h).getInstance({dashMetrics:$,mediaPlayerModel:H,errHandler:q,baseURLController:j,events:u.a,eventBus:p,debug:m,boxParser:Object(S.a)(h).getInstance(),requestModifier:it(h).getInstance(),errors:O}),re.initialize(),P.setConfig({domStorage:ie,settings:g}),me(),ge(void 0===n||n),we(),e&&ye(e),t&&be(t),T.info("[dash.js "+ce()+"] MediaPlayer has been initialized")):q.error(new E.a(O.CAPABILITY_MEDIASOURCE_ERROR_CODE,O.CAPABILITY_MEDIASOURCE_ERROR_MESSAGE))},setConfig:function(e){e&&(e.capabilities&&(V=e.capabilities),e.capabilitiesFilter&&(K=e.capabilitiesFilter),e.streamController&&(W=e.streamController),e.gapController&&(X=e.gapController),e.playbackController&&(Q=e.playbackController),e.mediaPlayerModel&&(H=e.mediaPlayerModel),e.abrController&&(M=e.abrController),e.schemeLoaderFactory&&(L=e.schemeLoaderFactory),e.mediaController&&(P=e.mediaController),e.settings&&(g=e.settings))},on:function(e,t,n,i){p.on(e,t,n,i)},off:function(e,t,n){p.off(e,t,n)},extend:function(e,t,n){c.a.extend(e,t,n,h)},attachView:ye,attachSource:be,isReady:ue,preload:function(){if(ee.getElement()||w)return!1;if(!b)throw i;De()},play:function(){if(!C)throw t;(!D||de()&&C)&&Q.play()},isPaused:de,pause:function(){if(!C)throw t;Q.pause()},isSeeking:function(){if(!C)throw t;return Q.isSeeking()},isDynamic:function(){if(!C)throw t;return Q.getIsDynamic()},seek:function(e){if(!C)throw t;if(Object(v.b)(e,"number"),isNaN(e))throw s.a.BAD_ARGUMENT_ERROR;let n=Q.getIsDynamic()?he(e):e;Q.seek(n)},setPlaybackRate:function(e){Ee().playbackRate=e},getPlaybackRate:function(){return Ee().playbackRate},setMute:function(e){Object(v.b)(e,"boolean"),Ee().muted=e},isMuted:function(){return Ee().muted},setVolume:function(e){if("number"!=typeof e||isNaN(e)||e<0||e>1)throw s.a.BAD_ARGUMENT_ERROR;Ee().volume=e},getVolume:function(){return Ee().volume},time:fe,duration:pe,timeAsUTC:function(){if(!C)throw t;return fe()<0?NaN:Ce(fe())},durationAsUTC:function(){if(!C)throw t;return Ce(pe())},getActiveStream:Ae,getDVRWindowSize:function(){let e=$.getCurrentDVRInfo();return e?e.manifestInfo.DVRWindowSize:0},getDVRSeekOffset:he,convertToTimeCode:function(e){e=Math.max(e,0);let t=Math.floor(e/3600),n=Math.floor(e%3600/60),i=Math.floor(e%3600%60);return(0===t?"":t<10?"0"+t.toString()+":":t.toString()+":")+(n<10?"0"+n.toString():n.toString())+":"+(i<10?"0"+i.toString():i.toString())},formatUTC:function(e,t,n,i=!1){const r=new Date(1e3*e),s=r.toLocaleDateString(t),a=r.toLocaleTimeString(t,{hour12:n});return i?a+" "+s:a},getVersion:ce,getDebug:function(){return m},getBufferLength:function(e){const t=[s.a.VIDEO,s.a.AUDIO,s.a.FRAGMENTED_TEXT];if(e){if(-1!==t.indexOf(e)){const t=_e().getCurrentBufferLevel(e);return t||NaN}return T.warn("getBufferLength requested for invalid type"),NaN}{const e=t.map(e=>Te(e).length>0?_e().getCurrentBufferLevel(e):Number.MAX_VALUE).reduce((e,t)=>Math.min(e,t));return e===Number.MAX_VALUE?NaN:e}},getTTMLRenderingDiv:function(){return ee?ee.getTTMLRenderingDiv():null},getVideoElement:Ee,getSource:function(){if(!b)throw i;return b},getCurrentLiveLatency:function(){if(!I)throw"MediaPlayer not initialized!";return C?Q.getCurrentLiveLatency():NaN},getTopBitrateInfoFor:function(t){if(!w)throw e;return M.getTopBitrateInfoFor(t)},setAutoPlay:ge,getAutoPlay:function(){return D},getDashMetrics:_e,getQualityFor:function(t){if(!w)throw e;if(t===s.a.IMAGE){const e=Ae();if(!e)return-1;const t=e.getThumbnailController();return t?t.getCurrentTrackIndex():-1}return M.getQualityFor(t)},setQualityFor:function(t,n){if(!w)throw e;if(t===s.a.IMAGE){const e=Ae();if(!e)return;const t=e.getThumbnailController();t&&t.setTrackByIndex(n)}M.setPlaybackQuality(t,W.getActiveStreamInfo(),n)},updatePortalSize:function(){M.setElementSize(),M.setWindowResizeEventCalled(!0)},setTextDefaultLanguage:function(e){T.warn('setTextDefaultLanguage is deprecated and will be removed in version 3.2.0. Please use setInitialMediaSettingsFor("fragmentedText", { lang: lang }) instead'),void 0===te&&(te=Y(h).getInstance()),te.setTextDefaultLanguage(e)},getTextDefaultLanguage:function(){return T.warn('getTextDefaultLanguage is deprecated and will be removed in version 3.2.0. Please use getInitialMediaSettingsFor("fragmentedText").lang instead'),void 0===te&&(te=Y(h).getInstance()),te.getTextDefaultLanguage()},setTextDefaultEnabled:function(e){void 0===te&&(te=Y(h).getInstance()),te.setTextDefaultEnabled(e)},getTextDefaultEnabled:function(){return void 0===te&&(te=Y(h).getInstance()),te.getTextDefaultEnabled()},enableText:function(e){void 0===te&&(te=Y(h).getInstance()),te.enableText(e)},enableForcedTextStreaming:function(e){void 0===te&&(te=Y(h).getInstance()),te.enableForcedTextStreaming(e)},isTextEnabled:function(){return void 0===te&&(te=Y(h).getInstance()),te.isTextEnabled()},setTextTrack:function(e){if(!C)throw t;void 0===te&&(te=Y(h).getInstance()),te.setTextTrack(e)},getBitrateInfoListFor:function(t){if(!w)throw e;let n=Ae();return n?n.getBitrateListFor(t):[]},getStreamsFromManifest:function(t){if(!w)throw e;return z.getStreamsInfo(t)},getTracksFor:Te,getTracksForTypeFromManifest:function(t,n,i){if(!w)throw e;return(i=i||z.getStreamsInfo(n,1)[0])?z.getAllMediaInfoForType(i,t,n):[]},getCurrentTrackFor:function(t){if(!w)throw e;let n=W.getActiveStreamInfo();return P.getCurrentTrackFor(t,n)},setInitialMediaSettingsFor:function(e,t){if(!I)throw"MediaPlayer not initialized!";P.setInitialSettings(e,t),e===s.a.FRAGMENTED_TEXT&&te.setInitialSettings(t)},getInitialMediaSettingsFor:function(e){if(!I)throw"MediaPlayer not initialized!";return P.getInitialSettings(e)},setCurrentTrack:function(t){if(!w)throw e;P.setTrack(t)},getTrackSwitchModeFor:function(e){if(!I)throw"MediaPlayer not initialized!";return P.getSwitchMode(e)},setTrackSwitchModeFor:function(e,t){if(!I)throw"MediaPlayer not initialized!";P.setSwitchMode(e,t)},setSelectionModeForInitialTrack:function(e){if(!I)throw"MediaPlayer not initialized!";P.setSelectionModeForInitialTrack(e)},getSelectionModeForInitialTrack:function(){if(!I)throw"MediaPlayer not initialized!";return P.getSelectionModeForInitialTrack()},addABRCustomRule:function(e,t,n){H.addABRCustomRule(e,t,n)},removeABRCustomRule:function(e){H.removeABRCustomRule(e)},removeAllABRCustomRule:function(){H.removeABRCustomRule()},getAverageThroughput:function(e){const t=M.getThroughputHistory();return t?t.getAverageThroughput(e):0},retrieveManifest:function(e,t){let n=Ie(),i=this;const r=function(e){e.error?t(null,e.error):t(e.manifest),p.off(u.a.INTERNAL_MANIFEST_LOADED,r,i),n.reset()};p.on(u.a.INTERNAL_MANIFEST_LOADED,r,i),ne.initialize(e),n.load(e)},addUTCTimingSource:function(e,t){H.addUTCTimingSource(e,t)},removeUTCTimingSource:function(e,t){H.removeUTCTimingSource(e,t)},clearDefaultUTCTimingSources:function(){H.clearDefaultUTCTimingSources()},restoreDefaultUTCTimingSources:me,setXHRWithCredentialsForType:function(e,t){H.setXHRWithCredentialsForType(e,t)},getXHRWithCredentialsForType:function(e){return H.getXHRWithCredentialsForType(e)},getProtectionController:function(){return Re()},attachProtectionController:function(e){U=e},setProtectionData:function(e){A=e,W&&W.setProtectionData(A)},registerLicenseRequestFilter:function(e){se.push(e),U&&U.setLicenseRequestFilters(se)},registerLicenseResponseFilter:function(e){ae.push(e),U&&U.setLicenseResponseFilters(ae)},unregisterLicenseRequestFilter:function(e){Se(se,e),U&&U.setLicenseRequestFilters(se)},unregisterLicenseResponseFilter:function(e){Se(ae,e),U&&U.setLicenseResponseFilters(ae)},registerCustomCapabilitiesFilter:function(e){oe.push(e),K&&K.setCustomCapabilitiesFilters(oe)},unregisterCustomCapabilitiesFilter:function(e){Se(oe,e),K&&K.setCustomCapabilitiesFilters(oe)},displayCaptionsOnTop:function(e){let t=R(h).getInstance();t.setConfig({videoModel:ee}),t.initialize(),t.setDisplayCConTop(e)},attachTTMLRenderingDiv:function(e){if(!ee.getElement())throw n;ee.setTTMLRenderingDiv(e)},getCurrentTextTrackIndex:function(){let e=NaN;return te&&(e=te.getCurrentTrackIdx()),e},provideThumbnail:function(e,t){if("function"!=typeof t)return;if(e<0)return void t(null);const n=Q.getIsDynamic()?he(e):e,i=W.getStreamForTime(n);if(null===i)return void t(null);const r=i.getThumbnailController();if(!r)return void t(null);const s=W.getTimeRelativeToStreamId(n,i.getId());return r.provide(s,t)},getDashAdapter:function(){return z},getOfflineController:function(){return we()},getSettings:function(){return g.get()},updateSettings:function(e){g.update(e)},resetSettings:function(){g.reset()},reset:le,destroy:function(){le(),se=[],ae=[],oe=[],c.a.deleteSingletonInstances(h)}},T=m.getLogger(_),I=!1,C=!1,w=!1,D=!0,U=null,G=null,A=null,z=null,re=null,u.a.extend(B.a),H=vi(h).getInstance(),ee=Ri(h).getInstance(),ne=Ti(h).getInstance(),se=[],ae=[],oe=[],_}gr.__dashjs_factory_name="MediaPlayer";const mr=c.a.getClassFactory(gr);mr.events=B.a,mr.errors=O,c.a.updateClassFactory(gr.__dashjs_factory_name,mr);t.a=mr},function(e,t,n){t.generateISD=n(67).generateISD,t.fromXML=n(68).fromXML,t.renderHTML=n(85).render},function(e,t,n){!function(e){e.ns_tt="http://www.w3.org/ns/ttml",e.ns_tts="http://www.w3.org/ns/ttml#styling",e.ns_ttp="http://www.w3.org/ns/ttml#parameter",e.ns_xml="http://www.w3.org/XML/1998/namespace",e.ns_itts="http://www.w3.org/ns/ttml/profile/imsc1#styling",e.ns_ittp="http://www.w3.org/ns/ttml/profile/imsc1#parameter",e.ns_smpte="http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt",e.ns_ebutts="urn:ebu:tt:style"}(t)},function(e,t,n){!function(e){var t=/#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?/,n=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,i=/rgba\(\s*(\d+),\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,r={transparent:[0,0,0,0],black:[0,0,0,255],silver:[192,192,192,255],gray:[128,128,128,255],white:[255,255,255,255],maroon:[128,0,0,255],red:[255,0,0,255],purple:[128,0,128,255],fuchsia:[255,0,255,255],magenta:[255,0,255,255],green:[0,128,0,255],lime:[0,255,0,255],olive:[128,128,0,255],yellow:[255,255,0,255],navy:[0,0,128,255],blue:[0,0,255,255],teal:[0,128,128,255],aqua:[0,255,255,255],cyan:[0,255,255,255]};e.parseColor=function(e){var s,a=null,o=r[e.toLowerCase()];return void 0!==o?a=o:null!==(s=t.exec(e))?a=[parseInt(s[1],16),parseInt(s[2],16),parseInt(s[3],16),void 0!==s[4]?parseInt(s[4],16):255]:null!==(s=n.exec(e))?a=[parseInt(s[1]),parseInt(s[2]),parseInt(s[3]),255]:null!==(s=i.exec(e))&&(a=[parseInt(s[1]),parseInt(s[2]),parseInt(s[3]),parseInt(s[4])]),a};var s=/^((?:\+|\-)?\d*(?:\.\d+)?)(px|em|c|%|rh|rw)$/;e.parseLength=function(e){var t,n=null;return null!==(t=s.exec(e))&&(n={value:parseFloat(t[1]),unit:t[2]}),n},e.parseTextShadow=function(t){var n=t.split(","),i=[];for(var r in n){var s=n[r].split(" ");if(1===s.length&&"none"===s[0])return"none";if(s.length>1&&s.length<5){var a=[null,null,null,null],o=e.parseLength(s.shift());if(null===o)return null;if(a[0]=o,null===(o=e.parseLength(s.shift())))return null;if(a[1]=o,0===s.length){i.push(a);continue}if(null!==(o=e.parseLength(s[0]))&&(a[2]=o,s.shift()),0===s.length){i.push(a);continue}var l=e.parseColor(s[0]);if(null===l)return null;a[3]=l,i.push(a)}}return i},e.parsePosition=function(t){var n=t.split(" "),i=function(e){return"center"===e||"left"===e||"top"===e||"bottom"===e||"right"===e};if(n.length>4)return null;for(var r in n)if(!i(n[r])){var s=e.parseLength(n[r]);if(null===s)return null;n[r]=s}for(var a={h:{edge:"left",offset:{value:50,unit:"%"}},v:{edge:"top",offset:{value:50,unit:"%"}}},o=0;o * @license MIT */ var i=n(70),r=n(71),s=n(47);function a(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function p(e,t){if(l.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 i=!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 z(e).length;default:if(i)return G(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,n){var i=!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 D(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 C(this,t,n);case"base64":return I(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function m(e,t,n){var i=e[t];e[t]=e[n],e[n]=i}function _(e,t,n,i,r){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof t&&(t=l.from(t,i)),l.isBuffer(t))return 0===t.length?-1:E(e,t,n,i,r);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):E(e,[t],n,i,r);throw new TypeError("val must be string, number or Buffer")}function E(e,t,n,i,r){var s,a=1,o=e.length,l=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;a=2,o/=2,l/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(r){var c=-1;for(s=n;so&&(n=o-l),s=n;s>=0;s--){for(var d=!0,h=0;hr&&(i=r):i=r;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");i>s/2&&(i=s/2);for(var a=0;a>8,r=n%256,s.push(r),s.push(i);return s}(t,e.length-n),e,n,i)}function I(e,t,n){return 0===t&&n===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,n))}function R(e,t,n){n=Math.min(e.length,n);for(var i=[],r=t;r239?4:u>223?3:u>191?2:1;if(r+d<=n)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(s=e[r+1]))&&(l=(31&u)<<6|63&s)>127&&(c=l);break;case 3:s=e[r+1],a=e[r+2],128==(192&s)&&128==(192&a)&&(l=(15&u)<<12|(63&s)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:s=e[r+1],a=e[r+2],o=e[r+3],128==(192&s)&&128==(192&a)&&128==(192&o)&&(l=(15&u)<<18|(63&s)<<12|(63&a)<<6|63&o)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,i.push(c>>>10&1023|55296),c=56320|1023&c),i.push(c),r+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",i=0;for(;i0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},l.prototype.compare=function(e,t,n,i,r){if(!l.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===i&&(i=0),void 0===r&&(r=this.length),t<0||n>e.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&t>=n)return 0;if(i>=r)return-1;if(t>=n)return 1;if(this===e)return 0;for(var s=(r>>>=0)-(i>>>=0),a=(n>>>=0)-(t>>>=0),o=Math.min(s,a),u=this.slice(i,r),c=e.slice(t,n),d=0;dr)&&(n=r),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return y(this,e,t,n);case"utf8":case"utf-8":return T(this,e,t,n);case"ascii":return S(this,e,t,n);case"latin1":case"binary":return b(this,e,t,n);case"base64":return A(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function w(e,t,n){var i="";n=Math.min(e.length,n);for(var r=t;ri)&&(n=i);for(var r="",s=t;sn)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,n,i,r,s){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||te.length)throw new RangeError("Index out of range")}function O(e,t,n,i){t<0&&(t=65535+t+1);for(var r=0,s=Math.min(e.length-n,2);r>>8*(i?r:1-r)}function x(e,t,n,i){t<0&&(t=4294967295+t+1);for(var r=0,s=Math.min(e.length-n,4);r>>8*(i?r:3-r)&255}function P(e,t,n,i,r,s){if(n+i>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function U(e,t,n,i,s){return s||P(e,0,n,4),r.write(e,t,n,i,23,4),n+4}function F(e,t,n,i,s){return s||P(e,0,n,8),r.write(e,t,n,i,52,8),n+8}l.prototype.slice=function(e,t){var n,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t0&&(r*=256);)i+=this[e+--t]*r;return i},l.prototype.readUInt8=function(e,t){return t||M(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||M(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||M(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||M(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||M(e,t,this.length);for(var i=this[e],r=1,s=0;++s=(r*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||M(e,t,this.length);for(var i=t,r=1,s=this[e+--i];i>0&&(r*=256);)s+=this[e+--i]*r;return s>=(r*=128)&&(s-=Math.pow(2,8*t)),s},l.prototype.readInt8=function(e,t){return t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||M(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){t||M(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||M(e,4,this.length),r.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||M(e,4,this.length),r.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||M(e,8,this.length),r.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||M(e,8,this.length),r.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,n,i){(e=+e,t|=0,n|=0,i)||L(this,e,t,n,Math.pow(2,8*n)-1,0);var r=1,s=0;for(this[t]=255&e;++s=0&&(s*=256);)this[t+r]=e/s&255;return t+n},l.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):O(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):O(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):x(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):x(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t|=0,!i){var r=Math.pow(2,8*n-1);L(this,e,t,n,r-1,-r)}var s=0,a=1,o=0;for(this[t]=255&e;++s>0)-o&255;return t+n},l.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t|=0,!i){var r=Math.pow(2,8*n-1);L(this,e,t,n,r-1,-r)}var s=n-1,a=1,o=0;for(this[t+s]=255&e;--s>=0&&(a*=256);)e<0&&0===o&&0!==this[t+s+1]&&(o=1),this[t+s]=(e/a>>0)-o&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):O(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):O(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):x(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):x(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,n){return U(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return U(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return F(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return F(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,i){if(n||(n=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t=0;--r)e[r+t]=this[r+n];else if(s<1e3||!l.TYPED_ARRAY_SUPPORT)for(r=0;r>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(s=t;s55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(a+1===i){(t-=3)>-1&&s.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(t-=3)>-1&&s.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.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;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function z(e){return i.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(B,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function H(e,t,n,i){for(var r=0;r=t.length||r>=e.length);++r)t[r+n]=e[r];return r}}).call(this,n(18))},function(e,t){var n,i,r=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(e){i=a}}();var l,u=[],c=!1,d=-1;function h(){c&&l&&(c=!1,l.length?u=l.concat(u):d=-1,u.length&&f())}function f(){if(!c){var e=o(h);c=!0;for(var t=u.length;t;){for(l=u,u=[];++d1)for(var n=1;nthis.customTimeRangeArray[n].start;n++);for(this.customTimeRangeArray.splice(n,0,{start:e,end:t}),n=0;n=this.customTimeRangeArray[n].end)this.customTimeRangeArray.splice(n,1),n--;else{if(e>this.customTimeRangeArray[n].start&&tthis.customTimeRangeArray[n].start&&ethis.customTimeRangeArray[n].start&&t=this.customTimeRangeArray.length||e<0?NaN:this.customTimeRangeArray[e].start},end:function(e){return Object(r.a)(e),e>=this.customTimeRangeArray.length||e<0?NaN:this.customTimeRangeArray[e].end}}}s.__dashjs_factory_name="CustomTimeRanges",t.a=i.a.getClassFactory(s)},function(e,t,n){"use strict";t.a=class{extend(e,t){if(!e)return;let n=!!t&&t.override,i=!!t&&t.publicOnly;for(const t in e)!e.hasOwnProperty(t)||this[t]&&!n||i&&-1===e[t].indexOf("public_")||(this[t]=e[t])}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));function i(){return"3.2.2"}},function(e,t,n){"use strict";var i=n(12),r=n(6),s=n(3),a=n(9),o=n(1);function l(e,t){const n=(e=e||{}).timelineConverter;let i;function r(){if(!n||!n.hasOwnProperty("calcMediaTimeFromPresentationTime")||!n.hasOwnProperty("calcSegmentAvailabilityRange"))throw new Error(o.a.MISSING_CONFIG_ERROR)}function s(e,i){const r=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.id].AdaptationSet_asArray.find(t=>t.index===e.adaptation.index).Representation_asArray.find(t=>t.id===e.id),s=r.SegmentTemplate||r.SegmentList,a=s.SegmentTimeline,o=s.SegmentURL_asArray;let l,u,c,d,h,f,p,g,m,_=0,E=0,y=-1;m=e.timescale,l=a.S_asArray;let T=!1;for(c=0,d=l.length;c=o-.5*d.d/h&&(u=!0),!1})),l},getSegmentByTime:function(e,i){if(r(),!e)return null;void 0===i&&(i=null);let o=null;const l=n.calcMediaTimeFromPresentationTime(i,e);return s(e,(function(i,r,s,u,c,d,h,f){if(l0)for(l=0;l=a&&t-re.index==s.adaptation.index).Representation_asArray.find(e=>e.id===s.id).bandwidth;let l=t.media;return l=Object(a.d)(l,"Number",t.replacementNumber),l=Object(a.d)(l,"Time",t.replacementTime),l=Object(a.d)(l,"Bandwidth",o),l=Object(a.c)(l,s.id),l=Object(a.e)(l),n.mediaType=I(),n.type=r.a.MEDIA_SEGMENT_TYPE,n.range=t.mediaRange,n.startTime=t.presentationStartTime,n.mediaStartTime=t.mediaStartTime,n.duration=t.duration,n.timescale=s.timescale,n.availabilityStartTime=t.availabilityStartTime,n.availabilityEndTime=t.availabilityEndTime,n.wallStartTime=t.wallStartTime,n.quality=s.index,n.index=t.availabilityIdx,n.mediaInfo=e,n.adaptationIndex=s.adaptation.index,n.representationId=s.id,C(n,l,s)?n:void 0}function M(e){let t=!1;if(!e)return t;if(S){if(b)t=!0;else if(y){const n=parseFloat((y.presentationStartTime-e.adaptation.period.start).toFixed(5));t=(y.duration>0?n+1.5*y.duration:n)>=e.adaptation.period.duration}}else E>=e.availableSegmentsNumber&&(t=!0);return t}function L(e){const t=e.representation;t.segments&&n.trigger(s.REPRESENTATION_UPDATE_COMPLETED,{representation:t},{streamId:d.id,mediaType:c})}function O(e){if(e.error)return;const t=e.segments,i=e.representation,r=[];let o,l,u,p,g=0;for(o=0,l=t?t.length:0;o0&&(i.segmentAvailabilityRange={start:r[0].presentationStartTime,end:r[r.length-1].presentationStartTime},i.availableSegmentsNumber=r.length,i.segments=r,S)){!function(e){h.setExpectedLiveEdge(e),f.updateManifestUpdateInfo({presentationStartTime:e})}(r[r.length-1].presentationStartTime-8)}i.hasInitialization()&&n.trigger(s.REPRESENTATION_UPDATE_COMPLETED,{representation:i},{streamId:d.id,mediaType:c})}function x(){m.debug("Dynamic stream complete"),b=!0}return g={initialize:function(e){S=e,b=!1,v.initialize(e)},getStreamId:function(){return d.id},getType:I,getStreamInfo:function(){return d},getInitRequest:function(e,t){return t?function(e,t,n){const s=new i.a,o=t.adaptation.period,l=o.start;if(s.mediaType=n,s.type=r.a.INIT_SEGMENT_TYPE,s.range=t.range,s.availabilityStartTime=h.calcAvailabilityStartTimeFromPresentationTime(l,o.mpd,S),s.availabilityEndTime=h.calcAvailabilityEndTimeFromPresentationTime(l+o.duration,o.mpd,S),s.quality=t.index,s.mediaInfo=e,s.representationId=t.id,C(s,t.initialization,t))return s.url=Object(a.d)(s.url,"Bandwidth",t.bandwidth),s}(e,t,I()):null},getRequestForSegment:N,getSegmentRequestForTime:function(e,t,n,r){let s=null;if(!t||!t.segmentInfoType)return s;const a=E,o=!!r&&r.keepIdx,u=!(!r||!r.ignoreIsFinished);T!==n&&(T=n,m.debug("Getting the request for time : "+n));const d=v.getSegmentByTime(t,n);if(d)E=d.availabilityIdx,y=d,m.debug("Index for time "+n+" is "+E),s=N(e,d);else{!u&&M(t)&&(s=new i.a,s.action=i.a.ACTION_COMPLETE,s.index=E-1,s.mediaType=c,s.mediaInfo=e,m.debug("Signal complete in getSegmentRequestForTime"))}return o&&a>=0&&(E=t.segmentInfoType===l.SEGMENT_TIMELINE&&S?E:a),s},getNextSegmentRequest:function(e,t){let n=null;if(!t||!t.segmentInfoType)return null;T=null;let r=E+1;m.debug("Getting the next request at index: "+r);const s=v.getSegmentByIndex(t,r,y?y.mediaStartTime:-1);if(!s&&function(e){return!isFinite(e.adaptation.period.duration)}(t)&&!b)return m.debug(I()+" No segment found at index: "+r+". Wait for next loop"),null;if(s?(n=N(e,s),E=s.availabilityIdx):E=S?r-1:r,s)y=s;else{M(t)&&(n=new i.a,n.action=i.a.ACTION_COMPLETE,n.index=E-1,n.mediaType=I(),n.mediaInfo=e,m.debug("Signal complete"))}return n},setCurrentIndex:function(e){E=e},getCurrentIndex:function(){return E},isMediaFinished:M,reset:function(){w(),n.off(s.INITIALIZATION_LOADED,L,g),n.off(s.SEGMENTS_LOADED,O,g),n.off(s.REPRESENTATION_UPDATE_STARTED,D,g),n.off(s.DYNAMIC_TO_STATIC,x,g)},resetIndex:R,setMimeType:function(e){A=e},getNextSegmentRequestIdempotent:function(e,t){let n=null,i=E+1;const r=v.getSegmentByIndex(t,i,y?y.mediaStartTime:-1);return r?(n=N(e,r),n):null}},m=o.getLogger(g),w(),v=_(t).create(e),n.on(s.INITIALIZATION_LOADED,L,g),n.on(s.SEGMENTS_LOADED,O,g),n.on(s.REPRESENTATION_UPDATE_STARTED,D,g),n.on(s.DYNAMIC_TO_STATIC,x,g),g}E.__dashjs_factory_name="DashHandler";t.a=s.a.getClassFactory(E)},function(e,t,n){var i,r,o,l,u,c={encode:function(e){for(var t=[],n=0;n>6),t.push(128|63&i)):i<65536?(t.push(224|i>>12),t.push(128|63&i>>6),t.push(128|63&i)):(t.push(240|i>>18),t.push(128|63&i>>12),t.push(128|63&i>>6),t.push(128|63&i))}return t},decode:function(e){for(var t=[],n=0;n>18)),n.push(i.charAt(63&s>>12)),n.push(i.charAt(63&s>>6)),n.push(i.charAt(63&s))}return 2==e.length-t?(s=(e[t]<<16)+(e[t+1]<<8),n.push(i.charAt(63&s>>18)),n.push(i.charAt(63&s>>12)),n.push(i.charAt(63&s>>6)),n.push("=")):1==e.length-t&&(s=e[t]<<16,n.push(i.charAt(63&s>>18)),n.push(i.charAt(63&s>>12)),n.push("==")),n.join("")},o=function(){for(var e=[],t=0;t100?100*Math.sign(i.value):i.value})),new i(t.ns_tts,"fontSize","1c",["span","p"],!0,!0,n.parseLength,(function(t,i,r,s,a){return n.toComputedLength(s.value,s.unit,null!==i?i.styleAttrs[e.byName.fontSize.qname]:t.cellLength.h,null!==i?i.styleAttrs[e.byName.fontSize.qname]:t.cellLength.h,t.cellLength.h,t.pxLength.h)})),new i(t.ns_tts,"fontStyle","normal",["span","p"],!0,!0,(function(e){return e}),null),new i(t.ns_tts,"fontWeight","normal",["span","p"],!0,!0,(function(e){return e}),null),new i(t.ns_tts,"lineHeight","normal",["p"],!0,!0,(function(e){return"normal"===e?e:n.parseLength(e)}),(function(t,i,r,s,a){var o;if("normal"===s)o=s;else if(null===(o=n.toComputedLength(s.value,s.unit,r.styleAttrs[e.byName.fontSize.qname],r.styleAttrs[e.byName.fontSize.qname],t.cellLength.h,t.pxLength.h)))return null;return o})),new i(t.ns_tts,"opacity",1,["region"],!1,!0,parseFloat,null),new i(t.ns_tts,"origin","auto",["region"],!1,!0,(function(e){if("auto"===e)return e;var t=e.split(" ");if(2!==t.length)return null;var i=n.parseLength(t[0]),r=n.parseLength(t[1]);return r&&i?{h:r,w:i}:null}),(function(e,t,i,r,s){var a,o;if("auto"===r)a=new n.ComputedLength(0,0);else if(null===(a=n.toComputedLength(r.h.value,r.h.unit,null,e.dimensions.h,null,e.pxLength.h)))return null;if("auto"===r)o=new n.ComputedLength(0,0);else if(null===(o=n.toComputedLength(r.w.value,r.w.unit,null,e.dimensions.w,null,e.pxLength.w)))return null;return{h:a,w:o}})),new i(t.ns_tts,"overflow","hidden",["region"],!1,!0,(function(e){return e}),null),new i(t.ns_tts,"padding","0px",["region"],!1,!0,(function(e){var t=e.split(" ");if(t.length>4)return null;var i=[];for(var r in t){var s=n.parseLength(t[r]);if(!s)return null;i.push(s)}return i}),(function(t,i,r,s,a){var o;if(1===s.length)o=[s[0],s[0],s[0],s[0]];else if(2===s.length)o=[s[0],s[1],s[0],s[1]];else if(3===s.length)o=[s[0],s[1],s[2],s[1]];else{if(4!==s.length)return null;o=[s[0],s[1],s[2],s[3]]}var l=r.styleAttrs[e.byName.writingMode.qname];if("lrtb"===l||"lr"===l)o=[o[0],o[3],o[2],o[1]];else if("rltb"===l||"rl"===l)o=[o[0],o[1],o[2],o[3]];else if("tblr"===l)o=[o[3],o[0],o[1],o[2]];else{if("tbrl"!==l&&"tb"!==l)return null;o=[o[3],o[2],o[1],o[0]]}var u=[];for(var c in o)if(0===o[c].value)u[c]=new n.ComputedLength(0,0);else if(u[c]=n.toComputedLength(o[c].value,o[c].unit,r.styleAttrs[e.byName.fontSize.qname],"0"===c||"2"===c?r.styleAttrs[e.byName.extent.qname].h:r.styleAttrs[e.byName.extent.qname].w,"0"===c||"2"===c?t.cellLength.h:t.cellLength.w,"0"===c||"2"===c?t.pxLength.h:t.pxLength.w),null===u[c])return null;return u})),new i(t.ns_tts,"position","top left",["region"],!1,!0,(function(e){return n.parsePosition(e)}),(function(t,i,r,s){var a,o;return null===(a=n.toComputedLength(s.v.offset.value,s.v.offset.unit,null,new n.ComputedLength(-r.styleAttrs[e.byName.extent.qname].h.rw,t.dimensions.h.rh-r.styleAttrs[e.byName.extent.qname].h.rh),null,t.pxLength.h))?null:("bottom"===s.v.edge&&(a=new n.ComputedLength(-a.rw-r.styleAttrs[e.byName.extent.qname].h.rw,t.dimensions.h.rh-a.rh-r.styleAttrs[e.byName.extent.qname].h.rh)),o=n.toComputedLength(s.h.offset.value,s.h.offset.unit,null,new n.ComputedLength(t.dimensions.w.rw-r.styleAttrs[e.byName.extent.qname].w.rw,-r.styleAttrs[e.byName.extent.qname].w.rh),null,t.pxLength.w),null===a?null:("right"===s.h.edge&&(o=new n.ComputedLength(t.dimensions.w.rw-o.rw-r.styleAttrs[e.byName.extent.qname].w.rw,-o.rh-r.styleAttrs[e.byName.extent.qname].w.rh)),{h:a,w:o}))})),new i(t.ns_tts,"ruby","none",["span"],!1,!0,(function(e){return e}),null),new i(t.ns_tts,"rubyAlign","center",["span"],!0,!0,(function(e){return"center"!==e&&"spaceAround"!==e?null:e}),null),new i(t.ns_tts,"rubyPosition","outside",["span"],!0,!0,(function(e){return e}),null),new i(t.ns_tts,"rubyReserve","none",["p"],!0,!0,(function(e){var t=e.split(" "),i=[null,null];if(0===t.length||t.length>2)return null;if("none"!==t[0]&&"both"!==t[0]&&"after"!==t[0]&&"before"!==t[0]&&"outside"!==t[0])return null;if(i[0]=t[0],2===t.length&&"none"!==t[0]){var r=n.parseLength(t[1]);if(!r)return null;i[1]=r}return i}),(function(t,i,r,s,a){if("none"===s[0])return s;var o=null;return null===(o=null===s[1]?new n.ComputedLength(.5*r.styleAttrs[e.byName.fontSize.qname].rw,.5*r.styleAttrs[e.byName.fontSize.qname].rh):n.toComputedLength(s[1].value,s[1].unit,r.styleAttrs[e.byName.fontSize.qname],r.styleAttrs[e.byName.fontSize.qname],t.cellLength.h,t.pxLength.h))?null:[s[0],o]})),new i(t.ns_tts,"showBackground","always",["region"],!1,!0,(function(e){return e}),null),new i(t.ns_tts,"textAlign","start",["p"],!0,!0,(function(e){return e}),(function(e,t,n,i,r){return"left"===i?"start":"right"===i?"end":i})),new i(t.ns_tts,"textCombine","none",["span"],!0,!0,(function(e){return"none"===e||"all"===e?e:null}),null),new i(t.ns_tts,"textDecoration","none",["span"],!0,!0,(function(e){return e.split(" ")}),null),new i(t.ns_tts,"textEmphasis","none",["span"],!0,!0,(function(e){var t=e.split(" "),i={style:null,symbol:null,color:null,position:null};for(var r in t)if("none"===t[r]||"auto"===t[r])i.style=t[r];else if("filled"===t[r]||"open"===t[r])i.style=t[r];else if("circle"===t[r]||"dot"===t[r]||"sesame"===t[r])i.symbol=t[r];else if("current"===t[r])i.color=t[r];else if("outside"===t[r]||"before"===t[r]||"after"===t[r])i.position=t[r];else if(i.color=n.parseColor(t[r]),null===i.color)return null;return null==i.style&&null==i.symbol?i.style="auto":(i.symbol=i.symbol||"circle",i.style=i.style||"filled"),i.position=i.position||"outside",i.color=i.color||"current",i}),null),new i(t.ns_tts,"textOutline","none",["span"],!0,!0,(function(e){if("none"===e)return e;var t={},i=e.split(" ");if(0===i.length||i.length>2)return null;var r=n.parseColor(i[0]);if(t.color=r,null!==r&&i.shift(),1!==i.length)return null;var s=n.parseLength(i[0]);return s?(t.thickness=s,t):null}),(function(t,i,r,s,a){if("none"===s)return s;var o={};return null===s.color?o.color=r.styleAttrs[e.byName.color.qname]:o.color=s.color,o.thickness=n.toComputedLength(s.thickness.value,s.thickness.unit,r.styleAttrs[e.byName.fontSize.qname],r.styleAttrs[e.byName.fontSize.qname],t.cellLength.h,t.pxLength.h),null===o.thickness?null:o})),new i(t.ns_tts,"textShadow","none",["span"],!0,!0,n.parseTextShadow,(function(t,i,r,s){if("none"===s)return s;var a=[];for(var o in s){var l={};if(l.x_off=n.toComputedLength(s[o][0].value,s[o][0].unit,null,r.styleAttrs[e.byName.fontSize.qname],null,t.pxLength.w),null===l.x_off)return null;if(l.y_off=n.toComputedLength(s[o][1].value,s[o][1].unit,null,r.styleAttrs[e.byName.fontSize.qname],null,t.pxLength.h),null===l.y_off)return null;if(null===s[o][2])l.b_radius=0;else if(l.b_radius=n.toComputedLength(s[o][2].value,s[o][2].unit,null,r.styleAttrs[e.byName.fontSize.qname],null,t.pxLength.h),null===l.b_radius)return null;null===s[o][3]?l.color=r.styleAttrs[e.byName.color.qname]:l.color=s[o][3],a.push(l)}return a})),new i(t.ns_tts,"unicodeBidi","normal",["span","p"],!1,!0,(function(e){return e}),null),new i(t.ns_tts,"visibility","visible",["body","div","p","region","span"],!0,!0,(function(e){return e}),null),new i(t.ns_tts,"wrapOption","wrap",["span"],!0,!0,(function(e){return e}),null),new i(t.ns_tts,"writingMode","lrtb",["region"],!1,!0,(function(e){return e}),null),new i(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 i(t.ns_ebutts,"linePadding","0c",["p"],!0,!1,n.parseLength,(function(e,t,i,r,s){return n.toComputedLength(r.value,r.unit,null,null,e.cellLength.w,null)})),new i(t.ns_ebutts,"multiRowAlign","auto",["p"],!0,!1,(function(e){return e}),null),new i(t.ns_smpte,"backgroundImage",null,["div"],!1,!1,(function(e){return e}),null),new i(t.ns_itts,"forcedDisplay","false",["body","div","p","region","span"],!0,!0,(function(e){return"true"===e}),null),new i(t.ns_itts,"fillLineGap","false",["p"],!0,!0,(function(e){return"true"===e}),null)],e.byQName={},e.all)e.byQName[e.all[r].qname]=e.all[r];for(var s in e.byName={},e.all)e.byName[e.all[s].name]=e.all[s]}(t,"undefined"==typeof imscNames?n(30):imscNames,"undefined"==typeof imscUtils?n(31):imscUtils)},function(e,t,n){"use strict";var i,r="object"==typeof Reflect?Reflect:null,s=r&&"function"==typeof r.apply?r.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};i=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(n,i){function r(n){e.removeListener(t,s),i(n)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}_(e,t,s,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&_(e,"error",t,n)}(e,r,{once:!0})}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var l=10;function u(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?o.defaultMaxListeners:e._maxListeners}function d(e,t,n,i){var r,s,a,o;if(u(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),a=s[t]),void 0===a)a=s[t]=n,++e._eventsCount;else if("function"==typeof a?a=s[t]=i?[n,a]:[a,n]:i?a.unshift(n):a.push(n),(r=c(e))>0&&a.length>r&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,o=l,console&&console.warn&&console.warn(o)}return e}function h(){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 f(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=h.bind(i);return r.listener=n,i.wrapFn=r,r}function p(e,t,n){var i=e._events;if(void 0===i)return[];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(a=t[0]),a instanceof Error)throw a;var o=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var l=r[e];if(void 0===l)return!1;if("function"==typeof l)s(l,this,t);else{var u=l.length,c=m(l,u);for(n=0;n=0;s--)if(n[s]===t||n[s].listener===t){a=n[s].listener,r=s;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1=0;i--)this.removeListener(e,t[i]);return this},o.prototype.listeners=function(e){return p(this,e,!0)},o.prototype.rawListeners=function(e){return p(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},o.prototype.listenerCount=g,o.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(e,t,n){(t=e.exports=n(48)).Stream=t,t.Readable=t,t.Writable=n(44),t.Duplex=n(19),t.Transform=n(51),t.PassThrough=n(80)},function(e,t,n){var i=n(32),r=i.Buffer;function s(e,t){for(var n in e)t[n]=e[n]}function a(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=i:(s(i,t),t.Buffer=a),s(r,a),a.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},function(e,t,n){"use strict";(function(t,i,r){var s=n(34);function a(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var i=e.entry;e.entry=null;for(;i;){var r=i.callback;t.pendingcb--,r(n),i=i.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=E;var o,l=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?i:s.nextTick;E.WritableState=_;var u=Object.create(n(27));u.inherits=n(20);var c={deprecate:n(78)},d=n(49),h=n(43).Buffer,f=r.Uint8Array||function(){};var p,g=n(50);function m(){}function _(e,t){o=o||n(19),e=e||{};var i=t instanceof o;this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var r=e.highWaterMark,u=e.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i&&(u||0===u)?u: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 d=!1===e.decodeStrings;this.decodeStrings=!d,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,i=n.sync,r=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,i,r){--t.pendingcb,n?(s.nextTick(r,i),s.nextTick(v,e,t),e._writableState.errorEmitted=!0,e.emit("error",i)):(r(i),e._writableState.errorEmitted=!0,e.emit("error",i),v(e,t))}(e,n,i,t,r);else{var a=b(n);a||n.corked||n.bufferProcessing||!n.bufferedRequest||S(e,n),i?l(T,e,n,a,r):T(e,n,a,r)}}(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 a(this)}function E(e){if(o=o||n(19),!(p.call(E,this)||this instanceof o))return new E(e);this._writableState=new _(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)),d.call(this)}function y(e,t,n,i,r,s,a){t.writelen=i,t.writecb=a,t.writing=!0,t.sync=!0,n?e._writev(r,t.onwrite):e._write(r,s,t.onwrite),t.sync=!1}function T(e,t,n,i){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,i(),v(e,t)}function S(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var i=t.bufferedRequestCount,r=new Array(i),s=t.corkedRequestsFree;s.entry=n;for(var o=0,l=!0;n;)r[o]=n,n.isBuf||(l=!1),n=n.next,o+=1;r.allBuffers=l,y(e,t,!0,t.length,r,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new a(t),t.bufferedRequestCount=0}else{for(;n;){var u=n.chunk,c=n.encoding,d=n.callback;if(y(e,t,!1,t.objectMode?1:u.length,u,c,d),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 A(e,t){e._final((function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),v(e,t)}))}function v(e,t){var n=b(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,s.nextTick(A,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}u.inherits(E,d),_.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(_.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]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(E,Symbol.hasInstance,{value:function(e){return!!p.call(this,e)||this===E&&(e&&e._writableState instanceof _)}})):p=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 i,r=this._writableState,a=!1,o=!r.objectMode&&(i=e,h.isBuffer(i)||i instanceof f);return o&&!h.isBuffer(e)&&(e=function(e){return h.from(e)}(e)),"function"==typeof t&&(n=t,t=null),o?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=m),r.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),s.nextTick(t,n)}(this,n):(o||function(e,t,n,i){var r=!0,a=!1;return null===n?a=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(e.emit("error",a),s.nextTick(i,a),r=!1),r}(this,r,e,n))&&(r.pendingcb++,a=function(e,t,n,i,r,s){if(!n){var a=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n));return t}(t,i,r);i!==a&&(n=!0,r="buffer",i=a)}var o=t.objectMode?1:i.length;t.length+=o;var l=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 i=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||function(e,t,n){t.ending=!0,v(e,t),n&&(t.finished?s.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,i,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=g.destroy,E.prototype._undestroy=g.undestroy,E.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(33),n(76).setImmediate,n(18))},function(e,t,n){"use strict";var i=n(79).Buffer,r=i.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 s(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&&(i.isEncoding===r||!r(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=l,this.end=u,t=4;break;case"utf8":this.fillLast=o,t=4;break;case"base64":this.text=c,this.end=d,t=3;break;default:return this.write=h,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function o(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 l(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var i=n.charCodeAt(n.length-1);if(i>=55296&&i<=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 u(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 d(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function f(e){return e&&e.length?this.write(e):""}t.StringDecoder=s,s.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 r>0&&(e.lastNeed=r-1),r;if(--i=0)return r>0&&(e.lastNeed=r-2),r;if(--i=0)return r>0&&(2===r?r=0:e.lastNeed=r-3),r;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},s.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";(function(e){var i=n(28);n.d(t,"a",(function(){return i.a}));var r=n(3),s=n(4),a=n(37),o="undefined"!=typeof window&&window||e,l=o.dashjs;l||(l=o.dashjs={}),l.MediaPlayer=i.a,l.FactoryMaker=r.a,l.Debug=s.a,l.Version=Object(a.a)()}).call(this,n(18))},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";(function(t,i){var r=n(34);e.exports=y;var s,a=n(47);y.ReadableState=E;n(41).EventEmitter;var o=function(e,t){return e.listeners(t).length},l=n(49),u=n(43).Buffer,c=t.Uint8Array||function(){};var d=Object.create(n(27));d.inherits=n(20);var h=n(73),f=void 0;f=h&&h.debuglog?h.debuglog("stream"):function(){};var p,g=n(74),m=n(50);d.inherits(y,l);var _=["error","close","destroy","pause","resume"];function E(e,t){e=e||{};var i=t instanceof(s=s||n(19));this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var r=e.highWaterMark,a=e.readableHighWaterMark,o=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i&&(a||0===a)?a:o,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(p||(p=n(45).StringDecoder),this.decoder=new p(e.encoding),this.encoding=e.encoding)}function y(e){if(s=s||n(19),!(this instanceof y))return new y(e);this._readableState=new E(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),l.call(this)}function T(e,t,n,i,r){var s,a=e._readableState;null===t?(a.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,A(e)}(e,a)):(r||(s=function(e,t){var n;i=t,u.isBuffer(i)||i instanceof c||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var i;return n}(a,t)),s?e.emit("error",s):a.objectMode||t&&t.length>0?("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=function(e){return u.from(e)}(t)),i?a.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):S(e,a,t,!0):a.ended?e.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!n?(t=a.decoder.write(t),a.objectMode||0!==t.length?S(e,a,t,!1):I(e,a)):S(e,a,t,!1))):i||(a.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 A(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(f("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?r.nextTick(v,e):v(e))}function v(e){f("emit readable"),e.emit("readable"),D(e)}function I(e,t){t.readingMore||(t.readingMore=!0,r.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 i;es.length?s.length:e;if(a===s.length?r+=s:r+=s.slice(0,e),0===(e-=a)){a===s.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=s.slice(a));break}++i}return t.length-=i,r}(e,t):function(e,t){var n=u.allocUnsafe(e),i=t.head,r=1;i.data.copy(n),e-=i.data.length;for(;i=i.next;){var s=i.data,a=e>s.length?s.length:e;if(s.copy(n,n.length-e,0,a),0===(e-=a)){a===s.length?(++r,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=s.slice(a));break}++r}return t.length-=r,n}(e,t);return i}(e,t.buffer,t.decoder),n);var n}function M(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,r.nextTick(L,t,e))}function L(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function O(e,t){for(var n=0,i=e.length;n=t.highWaterMark||t.ended))return f("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?M(this):A(this),null;if(0===(e=b(e,t))&&t.ended)return 0===t.length&&M(this),null;var i,r=t.needReadable;return f("need readable",r),(0===t.length||t.length-e0?N(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&M(this)),null!==i&&this.emit("data",i),i},y.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},y.prototype.pipe=function(e,t){var n=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=e;break;case 1:s.pipes=[s.pipes,e];break;default:s.pipes.push(e)}s.pipesCount+=1,f("pipe count=%d opts=%j",s.pipesCount,t);var l=(!t||!1!==t.end)&&e!==i.stdout&&e!==i.stderr?c:y;function u(t,i){f("onunpipe"),t===n&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,f("cleanup"),e.removeListener("close",_),e.removeListener("finish",E),e.removeListener("drain",d),e.removeListener("error",m),e.removeListener("unpipe",u),n.removeListener("end",c),n.removeListener("end",y),n.removeListener("data",g),h=!0,!s.awaitDrain||e._writableState&&!e._writableState.needDrain||d())}function c(){f("onend"),e.end()}s.endEmitted?r.nextTick(l):n.once("end",l),e.on("unpipe",u);var d=function(e){return function(){var t=e._readableState;f("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,D(e))}}(n);e.on("drain",d);var h=!1;var p=!1;function g(t){f("ondata"),p=!1,!1!==e.write(t)||p||((1===s.pipesCount&&s.pipes===e||s.pipesCount>1&&-1!==O(s.pipes,e))&&!h&&(f("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,p=!0),n.pause())}function m(t){f("onerror",t),y(),e.removeListener("error",m),0===o(e,"error")&&e.emit("error",t)}function _(){e.removeListener("finish",E),y()}function E(){f("onfinish"),e.removeListener("close",_),y()}function y(){f("unpipe"),n.unpipe(e)}return n.on("data",g),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?a(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",_),e.once("finish",E),e.emit("pipe",n),s.flowing||(f("pipe resume"),n.resume()),e},y.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 i=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s{this.el.sceneEl.is("ar-mode")&&this.el.setAttribute("visible",!1)}),this.el.sceneEl.addEventListener("exit-vr",e=>{this.el.setAttribute("visible",!0)})}}),AFRAME.registerComponent("eighti-ar-hit-test",{schema:{target:{type:"string",default:""}},init:function(){this.xrHitTestSource=null,this.viewerSpace=null,this.refSpace=null,this.el.sceneEl.renderer.xr.addEventListener("sessionend",e=>{this.viewerSpace=null,this.refSpace=null,this.xrHitTestSource=null;let t=this.initialPosition||"0 0 0";this.target.setAttribute("position",t),this.el.setAttribute("visible",!1)}),this.el.sceneEl.renderer.xr.addEventListener("sessionstart",e=>{let t=this.el.sceneEl.renderer.xr.getSession(),n=this.data;this.target=document.querySelector(n.target),this.initialPosition=this.target.getAttribute("position");let i=this.el;t.addEventListener("select",()=>{let e=i.getAttribute("position");this.target&&(this.target.setAttribute("position",e),this.target.setAttribute("visible",!0))}),t.requestReferenceSpace("viewer").then(e=>{this.viewerSpace=e,t.requestHitTestSource({space:this.viewerSpace}).then(e=>{this.xrHitTestSource=e}).catch(e=>{console.error("no hit-test support"),this.target.setAttribute("visible",!0)})}),t.requestReferenceSpace("local").then(e=>{this.refSpace=e})})},tick:function(){if(this.el.sceneEl.is("ar-mode")){if(!this.viewerSpace)return;let e=this.el.sceneEl.frame,t=e.getViewerPose(this.refSpace);if(this.xrHitTestSource&&t){let t=e.getHitTestResults(this.xrHitTestSource);if(t.length>0){this.el.setAttribute("visible",!0);let e=t[0].getPose(this.refSpace),n=new THREE.Matrix4;n.fromArray(e.transform.matrix);let i=new THREE.Vector3;return i.setFromMatrixPosition(n),void this.el.setAttribute("position",i)}}this.el.setAttribute("visible",!1)}}}))},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);var _helpers__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(21),_helpers__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_helpers__WEBPACK_IMPORTED_MODULE_0__),_arControls__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(52),_arControls__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(_arControls__WEBPACK_IMPORTED_MODULE_1__);const OrbitControls=__webpack_require__(57);class VolcapPlayer extends HTMLElement{static get observedAttributes(){return["floorimage","eqimage","backgroundcolor","hideallcontrols","hidecontrols","arKey"]}constructor(){super(),this._width=800,this._height=1200,this._canvas=null,this._renderer=null,this._camera=null,this._scene=null,this._clock=null,this._cameraControls=null,this._textureLoader=null,this._bounds=null,this._onLog=null,this._player=null,this._viewport=null,this._actorElement=null,this._fullscreenElement=null,this._previousTime=0,this._activePose=null,this._hidden=!1,this._isFullscreen=!1,this._isLooping=!1,this._resizeRequired=!1,this._autoplay=!1,this._muted=!1,this._onPlay=null,this._onEvent=null,this._floorImage="floor_default.jpg",this._floor=null,this._backgroundColor=0,this._transparentBackground=!1,this._backgroundIMG=null,this._eqImgAddress=null,this._hideAllControls=!1,this._hideControls=[],this._startupAR=!1,this._arEnabled=!1,this._arSupported=!1,this._arButton=null,this._vrButton=null,this._shadowRoot=this.attachShadow({mode:"open"});let e=document.createElement("style");e.type="text/css",e.rel="stylesheet",e.textContent="\n @font-face {\n font-family: 'Simple-Line-Icons';\n src:url('https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.5.5/fonts/Simple-Line-Icons.eot');\n src:url('https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.5.5/fonts/Simple-Line-Icons.eot?#iefix') format('embedded-opentype'),\n url('https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.5.5/fonts/Simple-Line-Icons.woff') format('woff'),\n url('https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.5.5/fonts/Simple-Line-Icons.ttf') format('truetype'),\n url('https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.5.5/fonts/Simple-Line-Icons.svg#Simple-Line-Icons') format('svg');\n font-weight: normal;\n font-style: normal;\n }",document.getElementsByTagName("head")[0].appendChild(e)}mutations(e,t){for(let t of e)"childList"===t.type?(t.removedNodes.forEach(e=>{"volcap-actor"===e.localName&&(this._actorElement=null)}),t.addedNodes.forEach(e=>{"volcap-actor"===e.localName&&(this._actorElement=e,this._actorElement.onplay=this._onPlayInternal.bind(this),this._actorElement.onpause=this._onPause.bind(this),this._scene&&this._renderer&&(this._startLoadingAnimation(),this._actorElement.onloadeddata=()=>{this._stopLoadingAnimation()},this._actorElement.initialise(this._scene,this._renderer,{fps:this._fps,muted:this._muted,autoplay:this._autoplay,loop:this._isLooping}),this._arControls.attach(this._actorElement._impl._mesh),this._arSupported&&(this._actorElement.arEnabled?(this._arButton.classList.remove("hide"),this._vrButton.classList.add("hide")):(this._arButton.classList.add("hide"),this._vrButton.classList.add("hide")))))})):"childList"===t.type&&"volcap-actor"===t.localName&&console.log("source removed")}connectedCallback(){if(this.hasAttribute("onlog")&&(this._onLog=this.getAttribute("onlog")),this.hasAttribute("autoplay")&&(this._autoplay="true"==this.getAttribute("autoplay")),this.hasAttribute("autoloop")&&(this._isLooping="true"==this.getAttribute("autoloop")),this.hasAttribute("onPlay")&&(this._onPlay=this.getAttribute("onPlay"),console.warn('"onPlay" is now depricated, please use "onEvent"')),this.hasAttribute("onEvent")){let e=this.getAttribute("onEvent");try{this._onEvent=Function("event","params","return "+e+"(event, params)")}catch(e){if(!(e instanceof SyntaxError))throw e;console.error('"onEvent" callback syntax error')}}this.hasAttribute("transparent")&&(this._transparentBackground="true"==this.getAttribute("transparent").toLowerCase()),this.hasAttribute("arKey")&&(this._arKey=this.getAttribute("arKey")),this.hasAttribute("startupAR")&&(this._startupAR="true"==this.getAttribute("startupAR"));new MutationObserver(this.mutations.bind(this)).observe(this,{childList:!0}),this._createDom()}attributeChangedCallback(e,t,n){var i=null,r=n=n.toLowerCase();t||(i="None"),""==n&&(r="emptyString"),console.log("Attribute Changed:",e,i,r),"floorimage"==e&&(this._floorImage=n,this._updateFloor()),"backgroundcolor"==e&&(this._backgroundColor=n,this._eqImgAddress="",this._updateEQIMGBackground(),this._updateBackgroundColor()),"eqimage"==e&&(this._eqImgAddress=n,this._updateEQIMGBackground()),"hideallcontrols"==e&&(this._hideAllControls="true"==n,this._updateControlVisibility()),"hidecontrols"==e&&(this._hideControls=n.split(","),this._updateControlVisibility()),"arKey"==e&&(this._arKey=n)}_restart(){let e=this._actorElement.paused;this._actorElement.destroy(),this._actorElement.initialise(this._scene,this._renderer,{fps:this._fps,muted:this._muted,autoplay:!e,loop:this._isLooping}),this._arControls.attach(this._actorElement._impl._mesh)}_onARSessionEnd(){this._arButton.classList.remove("hide"),this._vrButton.classList.add("hide"),this._arSession.removeEventListener("end",this._onARSessionEnd.bind(this)),this._renderer.xr.setSession(null),this._xrHitTestSource=null,this._xrRefSpace=null,this._xrViewerSpace=null,this._latestPosition=null,this._reticle.visible=!1,this._shadowFloor.visible=!1,this._hidden=!1,this._updateBackgroundColor(),this._arSession=null,this._arControls.enabled=!1,this._cameraControls.enabled=!0}_EighthWallPipelineModule(){return{name:"8i",onStart:({canvas:e,canvasWidth:t,canvasHeight:n,GLctx:i})=>{XR8.XrController.updateCameraProjectionMatrix({origin:this._camera.position,facing:this._camera.quaternion})},onUpdate:({processCpuResult:e})=>{let t=e.reality||e.facecontroller;if(t){for(let e=0;e<16;e++)this._camera.projectionMatrix.elements[e]=t.intrinsics[e];this._camera.projectionMatrixInverse.getInverse(this._camera.projectionMatrix),this._camera.setRotationFromQuaternion(t.rotation),this._camera.position.set(t.position.x,t.position.y,t.position.z),this._camera.updateMatrixWorld(),this._camera.matrixWorldInverse.getInverse(this._camera.matrixWorld)}this._renderer.clear(!0,!0,!0)},onRender:()=>{this._floor&&(this._floor.visible=!1),this._shadowFloor&&(this._shadowFloor.visible=!0),this._render()}}}_stop8thWallAR(){XR8.stop(),XR8.clearCameraPipelineModules(),this._arEnabled=!1,this._arControls.enabled=!1,this._arButton.classList.remove("hide"),this._vrButton.classList.add("hide"),this._renderer.setAnimationLoop(this._animate.bind(this))}_start8thWallAR(){this._arEnabled=!0,this._arControls.enabled=!0,this._vrButton.classList.remove("hide"),this._arButton.classList.add("hide"),this._renderer.setAnimationLoop(null),XR8.addCameraPipelineModules([XR8.GlTextureRenderer.pipelineModule(),XR8.XrController.pipelineModule(),this._EighthWallPipelineModule()]),XR8.run({canvas:this._canvas})}_on8thWallLoaded(){this._arSupported=!0,this._arButton=this._shadowRoot.querySelector(".ar"),this._arButton.onclick=()=>{this._start8thWallAR()},this._vrButton=this._shadowRoot.querySelector(".vr"),this._vrButton.onclick=()=>{this._stop8thWallAR()},this._arButton.classList.remove("hide"),this._vrButton.classList.add("hide"),this._initNativeRenderer(),this._startupAR&&this._start8thWallAR()}_detectARSupport(){if(this._arKey&&_helpers__WEBPACK_IMPORTED_MODULE_0___default.a.userAgentIs.mobile()){let e=document.createElement("script");e.src="//apps.8thwall.com/xrweb?appKey="+this._arKey,window.addEventListener("xrloaded",this._on8thWallLoaded.bind(this)),document.body.appendChild(e)}else this._arButton=this._shadowRoot.querySelector(".ar"),this._vrButton=this._shadowRoot.querySelector(".vr"),this._vrButton.onclick=()=>{this._arSession&&this._arSession.end()},this._arSession=null,!navigator.xr||document.featurePolicy&&!document.featurePolicy.allowsFeature("xr-spatial-tracking")?this._initNativeRenderer():navigator.xr.isSessionSupported("immersive-ar").then(e=>{e&&(this._arSupported=!0,document.addEventListener("beforexrselect",e=>{console.log("blocking XR controls"),e.preventDefault()}),this._arButton.onclick=()=>{if(null===this._arSession){let e=this._shadowRoot.querySelector(".eighti-container");navigator.xr.requestSession("immersive-ar",{requiredFeatures:["local","hit-test"],optionalFeatures:["dom-overlay","dom-overlay-for-handheld-ar"],domOverlay:{root:e}}).then(e=>{this._vrButton.classList.remove("hide"),this._arButton.classList.add("hide"),e.addEventListener("end",this._onARSessionEnd.bind(this)),this._renderer.xr.setReferenceSpaceType("local"),this._renderer.xr.setSession(e),this._arSession=e,this._hidden=!0,this._cameraControls.enabled=!1,this._arControls.enabled=!0,e.requestReferenceSpace("viewer").then(t=>{this._xrViewerSpace=t,e.requestHitTestSource({space:this._xrViewerSpace}).then(e=>{this._renderer.setClearColor(this._backgroundColor,0),this._xrHitTestSource=e})}),e.requestReferenceSpace("local").then(e=>{this._xrRefSpace=e})})}else this._arSession.end()},this._arButton.classList.remove("hide"))}).catch(e=>console.error("WebXR not supported",e)).finally(()=>this._initNativeRenderer())}_createDom(){const e=__webpack_require__(59).default,t=__webpack_require__(60).toString();let n=document.createElement("style");n.type="text/css",n.rel="stylesheet",n.textContent=e,this._shadowRoot.appendChild(n),this._shadowRoot.innerHTML+=t,this._canvas=this._shadowRoot.querySelector("#canvas"),this._progressBar=this._shadowRoot.querySelector(".progress"),this._progressBar.onclick=this._seek.bind(this),this._progressDownload=this._shadowRoot.querySelector(".download"),this._progressPlayed=this._shadowRoot.querySelector(".played"),this._playButton=this._shadowRoot.querySelector(".control-play"),this._playButton.onclick=this._play.bind(this),this._pauseButton=this._shadowRoot.querySelector(".control-pause"),this._autoplay?(this._muted=!0,this._playButton.classList.add("hide")):this._pauseButton.classList.add("hide"),this._pauseButton.onclick=this._pause.bind(this),this._loopButton=this._shadowRoot.querySelector(".control-loop"),this._isLooping?this._loopButton.classList.remove("inactive"):this._loopButton.classList.add("inactive"),this._loopButton.onclick=this._toggleLooping.bind(this),this._volumeUnmutedButton=this._shadowRoot.querySelector(".volume-unmuted"),this._volumeUnmutedButton.onclick=this._mute.bind(this),this._volumeMutedButton=this._shadowRoot.querySelector(".volume-muted"),this._volumeMutedButton.onclick=this._unmute.bind(this),this._muted?this._volumeUnmutedButton.classList.add("hide"):this._volumeMutedButton.classList.add("hide"),this._fullscreenButton=this._shadowRoot.querySelector(".size-fullscreen"),this._fullscreenButton.onclick=this._goFullscreen.bind(this,!0),this._actualButton=this._shadowRoot.querySelector(".size-actual"),this._actualButton.classList.add("hide"),this._actualButton.onclick=this._goFullscreen.bind(this,!1),this._fps=15;let i=this._shadowRoot.querySelector(".control-fps");if(i&&(i.classList.remove("hide"),i.addEventListener("click",e=>{console.log(e),i.classList.contains("inactive")?(console.log("enable super speed"),i.classList.remove("inactive"),this._fps=30,this._restart()):(console.log("disable super speed"),i.classList.add("inactive"),this._fps=15,this._restart())})),this._controlsContainer=this._shadowRoot.querySelector(".collapsing"),this._controlsContainer.addEventListener("beforexrselect",e=>{console.log("blocking XR controls"),e.preventDefault()}),this._updateControlVisibility(),this._setUpFullscreen(),!this._canvas)return void console.error("no canvas found");if(0==this._canvas.clientWidth)return console.log("canvas was sized at",this._width,this._height),console.log("canvas resizing to",this._canvas.clientWidth,this._canvas.clientHeight),void console.error("volcap-player should not be resized to 0 width");this._width=this._canvas.clientWidth,this._height=this._canvas.clientHeight,this._canvas.width=this._width,this._canvas.height=this._height,this._camera||(this._camera=new THREE.PerspectiveCamera(70,this._width/this._height,.01,50),this._camera.position.set(0,1.25,1.75)),this._scene||(this._scene=new THREE.Scene),this._reticle=new THREE.Mesh(new THREE.RingBufferGeometry(.15,.2,32).rotateX(-Math.PI/2),new THREE.MeshBasicMaterial),this._reticle.matrixAutoUpdate=!1,this._reticle.visible=!1,this._scene.add(this._reticle);let r=new THREE.SpotLight(16777215);r.position.set(3,10,5),this._scene.add(r),r.shadow.mapSize.width=2048,r.shadow.mapSize.height=2048,r.shadow.camera.near=.5,r.shadow.camera.far=500,r.shadow.focus=5;var s=r.clone();this._scene.add(s),r.castShadow=!0,s.castShadow=!1,r.intensity=.5,s.intensity=.5,this._detectARSupport()}_initNativeRenderer(){this._initScene(),this._renderer.setAnimationLoop(this._animate.bind(this))}_initScene(e){let t=new THREE.ShadowMaterial({opacity:.5}),n=new THREE.PlaneBufferGeometry(1,1),i=new THREE.Mesh(n,t);i.rotation.x=1.5*Math.PI,i.scale.set(10,10,10),i.receiveShadow=!0,i.visible=!1,this._shadowFloor=i,this._scene.add(i),this._renderer||(this._renderer=new THREE.WebGLRenderer({antialias:!1,canvas:this._canvas,alpha:!0,context:e}),this._renderer.autoClear=!1,this._renderer.getContext().getExtension("WEBGL_debug_renderer_info"),this._renderer.getPixelRatio()!=window.devicePixelRatio&&this._renderer.setPixelRatio(window.devicePixelRatio),this._renderer.setSize(this._width,this._height,!1),this._renderer.xr.enabled=!0,this._arControls=new _arControls__WEBPACK_IMPORTED_MODULE_1___default.a(this._renderer.domElement),this._renderer.domElement.addEventListener("select",this.onSelect.bind(this)),this._latestPosition=null,this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=THREE.PCFSoftShadowMap,this._updateBackgroundColor(),this._updateEQIMGBackground()),this._updateFloor(),this._clock||(this._clock=new THREE.Clock(!0)),this._cameraControls||(this._cameraControls=new OrbitControls(this._camera,this._renderer.domElement),this._cameraControls.target.set(0,1,0),this._cameraControls.minDistance=.5,this._cameraControls.maxDistance=10,this._cameraControls.update()),this._actorElement&&(this._actorElement.initialise(this._scene,this._renderer,{fps:this._fps,muted:this._muted,autoplay:this._autoplay,loop:this._isLooping}),this._actorElement.onloadeddata=()=>{this._stopLoadingAnimation()},this._arControls.attach(this._actorElement._impl._mesh),this._arSupported&&(this._actorElement.arEnabled?(this._arButton.classList.remove("hide"),this._vrButton.classList.add("hide")):(this._arButton.classList.add("hide"),this._vrButton.classList.add("hide"))))}onSelect(){this._reticle.visible&&(this._latestPosition=(new THREE.Vector3).fromArray(this._reticle.matrix.elements,12)),XR8&&XR8.XrController.recenter()}_updateControlVisibility(){if(this._controlsContainer)if(this._hideAllControls){if(this._controlsContainer.classList.add("hide"),_helpers__WEBPACK_IMPORTED_MODULE_0___default.a.userAgentIs.notMobile()){let e=this._shadowRoot.querySelector(".eighti-container");e.onmousemove=null,e.onclick=null}}else{this._controlsContainer.classList.remove("hide");let e=["progress","playpause","fullscreen","volume","arvr"];for(let t of e)this._hideControls.includes(t)?this._controlsContainer.querySelector("."+t).classList.add("hide"):this._controlsContainer.querySelector("."+t).classList.remove("hide");0}}_play(e=null){isNaN(e)&&(e=null),this._actorElement.play();let t=-1,n=-1;null==e&&!this._isLooping&&this._actorElement&&(t=this._actorElement.duration,n=this._actorElement.currentTime,n>=t&&(e=0)),null!=e&&this._actorElement.seek(e)}_onPlayInternal(){this._playButton.classList.add("hide"),this._pauseButton.classList.remove("hide"),eval(this._onPlay),this._triggerEvent("play",null)}_onPause(){this._pauseButton.classList.add("hide"),this._playButton.classList.remove("hide"),this._triggerEvent("pause",null)}_pause(){this._actorElement.pause()}_toggleLooping(){this._isLooping=!this._isLooping,this._isLooping?(this._loopButton.classList.remove("inactive"),this._triggerEvent("loop",!0)):(this._loopButton.classList.add("inactive"),this._triggerEvent("loop",!1)),this._updateLooping()}_startLoadingAnimation(){this._progressDownload.style.display="block"}_stopLoadingAnimation(){this._progressDownload.style.display="none"}_updateLooping(){this._actorElement&&(this._actorElement.loop=this._isLooping)}_mute(){this._muted=!0,this._volumeMutedButton.classList.remove("hide"),this._volumeUnmutedButton.classList.add("hide"),this._actorElement.muted=this._muted,this._triggerEvent("muted",!0)}_unmute(){this._muted=!1,this._volumeMutedButton.classList.add("hide"),this._volumeUnmutedButton.classList.remove("hide"),this._actorElement.muted=this._muted,this._triggerEvent("muted",!1)}_goFullscreen(e){e?(this._fullscreenButton.classList.add("hide"),this._actualButton.classList.remove("hide"),this._enterFullscreen(),this._triggerEvent("fullscreen",!0)):(this._actualButton.classList.add("hide"),this._fullscreenButton.classList.remove("hide"),this._exitFullscreen(),this._triggerEvent("fullscreen",!1))}_seek(e){let t=0;if(e.offsetX>5&&(t=e.offsetX/this._progressBar.clientWidth,t=t>1?1:t<0?0:t),this._actorElement){const e=t*this._actorElement.duration;this._actorElement.seek(e)}this._triggerEvent("seek",{percent:t})}_resize(){(this._resizeRequired||this._canvas.clientWidth!=this._width||this._canvas.clientHeight!=this._height)&&(0==this._canvas.clientWidth&&(console.log("canvas was sized at",this._width,this._height),console.log("canvas resizing to",this._canvas.clientWidth,this._canvas.clientHeight),console.error("volcap-player should not be resized to 0 width")),this._width=this._canvas.clientWidth,this._height=this._canvas.clientHeight,this._canvas.width=this._width,this._canvas.height=this._height,this._camera&&(this._camera.aspect=this._width/this._height,this._camera.updateProjectionMatrix()),this._renderer&&!this._renderer.xr.isPresenting&&(this._renderer.getPixelRatio()!=window.devicePixelRatio&&this._renderer.setPixelRatio(window.devicePixelRatio),this._renderer.setSize(this._width,this._height,!1)),this._resizeRequired=!1)}_triggerEvent(e,t){this._onEvent&&this._onEvent(e,t),this.dispatchEvent(new Event(e))}_updateEQIMGBackground(){if(this._scene&&(!this._backgroundIMG&&this._eqImgAddress||(this._scene.remove(this._backgroundIMG),this._eqImgAddress&&this._updateBackgroundColor()),this._eqImgAddress)){var e=new THREE.SphereGeometry(15,60,40);e.scale(-1,1,1),this._textureLoader||(this._textureLoader=new THREE.TextureLoader);var t=new THREE.MeshBasicMaterial({map:this._textureLoader.load(this._eqImgAddress)});this._backgroundIMG=new THREE.Mesh(e,t),this._scene.add(this._backgroundIMG)}}_updateFloor(){this._scene&&(this._floorImage?(this._textureLoader||(this._textureLoader=new THREE.TextureLoader),this._textureLoader.load(this._floorImage,function(e){e.minFilter=THREE.NearestFilter,e.magFilter=THREE.NearestFilter;var t=new THREE.MeshStandardMaterial({map:e}),n=new THREE.PlaneBufferGeometry(1,1),i=new THREE.Mesh(n,t);i.rotation.x=1.5*Math.PI,i.scale.set(10,10,10),this._floor&&this._scene.remove(this._floor),i.receiveShadow=!0,this._floor=i,this._scene.add(i)}.bind(this),(function(){}),(function(e){console.error("Error rendering Floor:"),console.error(e)}))):this._scene.remove(this._floor))}_updateBackgroundColor(){this._renderer&&this._renderer.setClearColor(this._backgroundColor,this._transparentBackground?0:1)}_onCameraChanged(e,t){this._triggerEvent("camera",{position:{x:e.x,y:e.y,z:e.z},rotation:{x:t.x,y:t.y,z:t.z,w:t.w}})}_animate(e,t){this._resize(),this._floor&&(this._floor.visible=!Boolean(t)),this._renderer.clear(!0,!0,!0),this._render(e,t)}_render(e,t){if(t){t.session;let e=t.getViewerPose(this._xrRefSpace);if(this._xrHitTestSource&&e){let e=t.getHitTestResults(this._xrHitTestSource);if(e.length){var n=e[0];this._reticle.visible,this._reticle.visible=!0,this._hidden=!1,this._shadowFloor.visible=!0,this._activePose=n.getPose(this._xrRefSpace).transform.matrix,this._reticle.matrix.fromArray(this._activePose)}else this._reticle.visible,this._reticle.visible=!1,this._activePose=null}}if(this._actorElement&&this._actorElement.ready){const e=this._actorElement.duration,n=this._clock.getElapsedTime(),i=this._actorElement.currentTime;this._previousTime=i,this._actorElement.update(n,i,e);const r=this._renderer.getContext();let s=t?t.session.renderState.baseLayer.framebuffer:null;r.bindFramebuffer(r.FRAMEBUFFER,s);let a=0;e>0&&(a=i/e,a=a>1?1:a<0?0:a),this._progressPlayed.style.width=100*a+"%";let o=new THREE.Vector3(0,0,0);this._latestPosition?o=this._latestPosition:this._reticle.visible&&o.fromArray(this._reticle.matrix.elements,12),this._shadowFloor.position.copy(o),this._cameraControls.update(),this._actorElement.render(this._width,this._height,this._camera,o,this._hidden),this._renderer.state.reset()}this._renderer.render(this._scene,this._camera)}_setUpFullscreen(){this._fullscreenElement=this._shadowRoot.querySelector(".eighti-container"),this._fullscreenElement.requestFullScreen=this._fullscreenElement.requestFullScreen||this._fullscreenElement.mozRequestFullScreen||this._fullscreenElement.msRequestFullscreen||(this._fullscreenElement.webkitRequestFullScreen?function(){this._fullscreenElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}.bind(this):null);var e=function(){this._isFullscreen=document.webkitIsFullScreen,this._isFullscreen|=document.mozFullScreen,this._isFullscreen|=document.msFullscreenElement,this._isFullscreen||(this._resizeRequired=!0)}.bind(this);document.addEventListener("webkitfullscreenchange",e),document.addEventListener("mozfullscreenchange",e),document.addEventListener("fullscreenchange",e),document.addEventListener("MSFullscreenChange",e),this._fullscreenElement.requestFullScreen||(this._fullscreenElement.requestFullScreen=function(){this._fullscreenElement.classList.add("fullscreen_hack"),this._isFullscreen=!0,this._resizeRequired=!0}.bind(this)),this._fullscreenElement.exitFullScreen=function(){this._fullscreenElement.classList.remove("fullscreen_hack"),this._isFullscreen=!1,this._resizeRequired=!0}.bind(this)}_enterFullscreen(){this._fullscreenElement.requestFullScreen(),this._isFullscreen=!0,this._resizeRequired=!0}_exitFullscreen(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():this._fullscreenElement.exitFullScreen(),this._isFullscreen=!1,this._resizeRequired=!0}}__webpack_exports__.default=VolcapPlayer},function(e,t,n){var i=n(58);i.OrbitControls=function(e,t){var n,r,s,a,o;void 0===t&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),t===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=t,this.enabled=!0,this.target=new i.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:i.MOUSE.ROTATE,MIDDLE:i.MOUSE.DOLLY,RIGHT:i.MOUSE.PAN},this.touches={ONE:i.TOUCH.ROTATE,TWO:i.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return g.phi},this.getAzimuthalAngle=function(){return g.theta},this.saveState=function(){l.target0.copy(l.target),l.position0.copy(l.object.position),l.zoom0=l.object.zoom},this.reset=function(){l.target.copy(l.target0),l.object.position.copy(l.position0),l.object.zoom=l.zoom0,l.object.updateProjectionMatrix(),l.dispatchEvent(u),l.update(),f=h.NONE},this.update=(n=new i.Vector3,r=(new i.Quaternion).setFromUnitVectors(e.up,new i.Vector3(0,1,0)),s=r.clone().inverse(),a=new i.Vector3,o=new i.Quaternion,function(){var e=l.object.position;return n.copy(e).sub(l.target),n.applyQuaternion(r),g.setFromVector3(n),l.autoRotate&&f===h.NONE&&N(2*Math.PI/60/60*l.autoRotateSpeed),l.enableDamping?(g.theta+=m.theta*l.dampingFactor,g.phi+=m.phi*l.dampingFactor):(g.theta+=m.theta,g.phi+=m.phi),g.theta=Math.max(l.minAzimuthAngle,Math.min(l.maxAzimuthAngle,g.theta)),g.phi=Math.max(l.minPolarAngle,Math.min(l.maxPolarAngle,g.phi)),g.makeSafe(),g.radius*=_,g.radius=Math.max(l.minDistance,Math.min(l.maxDistance,g.radius)),!0===l.enableDamping?l.target.addScaledVector(E,l.dampingFactor):l.target.add(E),n.setFromSpherical(g),n.applyQuaternion(s),e.copy(l.target).add(n),l.object.lookAt(l.target),!0===l.enableDamping?(m.theta*=1-l.dampingFactor,m.phi*=1-l.dampingFactor,E.multiplyScalar(1-l.dampingFactor)):(m.set(0,0,0),E.set(0,0,0)),_=1,!!(y||a.distanceToSquared(l.object.position)>p||8*(1-o.dot(l.object.quaternion))>p)&&(l.dispatchEvent(u),a.copy(l.object.position),o.copy(l.object.quaternion),y=!1,!0)}),this.dispose=function(){l.domElement.removeEventListener("contextmenu",ee,!1),l.domElement.removeEventListener("mousedown",V,!1),l.domElement.removeEventListener("wheel",X,!1),l.domElement.removeEventListener("touchstart",$,!1),l.domElement.removeEventListener("touchend",J,!1),l.domElement.removeEventListener("touchmove",Z,!1),document.removeEventListener("mousemove",K,!1),document.removeEventListener("mouseup",W,!1),l.domElement.removeEventListener("keydown",Q,!1)};var l=this,u={type:"change"},c={type:"start"},d={type:"end"},h={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},f=h.NONE,p=1e-6,g=new i.Spherical,m=new i.Spherical,_=1,E=new i.Vector3,y=!1,T=new i.Vector2,S=new i.Vector2,b=new i.Vector2,A=new i.Vector2,v=new i.Vector2,I=new i.Vector2,R=new i.Vector2,w=new i.Vector2,C=new i.Vector2;function D(){return Math.pow(.95,l.zoomSpeed)}function N(e){m.theta-=e}function M(e){m.phi-=e}var L,O=(L=new i.Vector3,function(e,t){L.setFromMatrixColumn(t,0),L.multiplyScalar(-e),E.add(L)}),x=function(){var e=new i.Vector3;return function(t,n){!0===l.screenSpacePanning?e.setFromMatrixColumn(n,1):(e.setFromMatrixColumn(n,0),e.crossVectors(l.object.up,e)),e.multiplyScalar(t),E.add(e)}}(),P=function(){var e=new i.Vector3;return function(t,n){var i=l.domElement;if(l.object.isPerspectiveCamera){var r=l.object.position;e.copy(r).sub(l.target);var s=e.length();s*=Math.tan(l.object.fov/2*Math.PI/180),O(2*t*s/i.clientHeight,l.object.matrix),x(2*n*s/i.clientHeight,l.object.matrix)}else l.object.isOrthographicCamera?(O(t*(l.object.right-l.object.left)/l.object.zoom/i.clientWidth,l.object.matrix),x(n*(l.object.top-l.object.bottom)/l.object.zoom/i.clientHeight,l.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),l.enablePan=!1)}}();function U(e){l.object.isPerspectiveCamera?_/=e:l.object.isOrthographicCamera?(l.object.zoom=Math.max(l.minZoom,Math.min(l.maxZoom,l.object.zoom*e)),l.object.updateProjectionMatrix(),y=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),l.enableZoom=!1)}function F(e){l.object.isPerspectiveCamera?_*=e:l.object.isOrthographicCamera?(l.object.zoom=Math.max(l.minZoom,Math.min(l.maxZoom,l.object.zoom/e)),l.object.updateProjectionMatrix(),y=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),l.enableZoom=!1)}function B(e){T.set(e.clientX,e.clientY)}function k(e){A.set(e.clientX,e.clientY)}function G(e){if(1==e.touches.length)T.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);T.set(t,n)}}function z(e){if(1==e.touches.length)A.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);A.set(t,n)}}function H(e){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,i=Math.sqrt(t*t+n*n);R.set(0,i)}function Y(e){if(1==e.touches.length)S.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);S.set(t,n)}b.subVectors(S,T).multiplyScalar(l.rotateSpeed);var i=l.domElement;N(2*Math.PI*b.x/i.clientHeight),M(2*Math.PI*b.y/i.clientHeight),T.copy(S)}function q(e){if(1==e.touches.length)v.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);v.set(t,n)}I.subVectors(v,A).multiplyScalar(l.panSpeed),P(I.x,I.y),A.copy(v)}function j(e){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,i=Math.sqrt(t*t+n*n);w.set(0,i),C.set(0,Math.pow(w.y/R.y,l.zoomSpeed)),U(C.y),R.copy(w)}function V(e){if(!1!==l.enabled){switch(e.preventDefault(),l.domElement.focus?l.domElement.focus():window.focus(),e.button){case 0:switch(l.mouseButtons.LEFT){case i.MOUSE.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===l.enablePan)return;k(e),f=h.PAN}else{if(!1===l.enableRotate)return;B(e),f=h.ROTATE}break;case i.MOUSE.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===l.enableRotate)return;B(e),f=h.ROTATE}else{if(!1===l.enablePan)return;k(e),f=h.PAN}break;default:f=h.NONE}break;case 1:switch(l.mouseButtons.MIDDLE){case i.MOUSE.DOLLY:if(!1===l.enableZoom)return;!function(e){R.set(e.clientX,e.clientY)}(e),f=h.DOLLY;break;default:f=h.NONE}break;case 2:switch(l.mouseButtons.RIGHT){case i.MOUSE.ROTATE:if(!1===l.enableRotate)return;B(e),f=h.ROTATE;break;case i.MOUSE.PAN:if(!1===l.enablePan)return;k(e),f=h.PAN;break;default:f=h.NONE}}f!==h.NONE&&(document.addEventListener("mousemove",K,!1),document.addEventListener("mouseup",W,!1),l.dispatchEvent(c))}}function K(e){if(!1!==l.enabled)switch(e.preventDefault(),f){case h.ROTATE:if(!1===l.enableRotate)return;!function(e){S.set(e.clientX,e.clientY),b.subVectors(S,T).multiplyScalar(l.rotateSpeed);var t=l.domElement;N(2*Math.PI*b.x/t.clientHeight),M(2*Math.PI*b.y/t.clientHeight),T.copy(S),l.update()}(e);break;case h.DOLLY:if(!1===l.enableZoom)return;!function(e){w.set(e.clientX,e.clientY),C.subVectors(w,R),C.y>0?U(D()):C.y<0&&F(D()),R.copy(w),l.update()}(e);break;case h.PAN:if(!1===l.enablePan)return;!function(e){v.set(e.clientX,e.clientY),I.subVectors(v,A).multiplyScalar(l.panSpeed),P(I.x,I.y),A.copy(v),l.update()}(e)}}function W(e){!1!==l.enabled&&(document.removeEventListener("mousemove",K,!1),document.removeEventListener("mouseup",W,!1),l.dispatchEvent(d),f=h.NONE)}function X(e){!1===l.enabled||!1===l.enableZoom||f!==h.NONE&&f!==h.ROTATE||(e.preventDefault(),e.stopPropagation(),l.dispatchEvent(c),function(e){e.deltaY<0?F(D()):e.deltaY>0&&U(D()),l.update()}(e),l.dispatchEvent(d))}function Q(e){!1!==l.enabled&&!1!==l.enableKeys&&!1!==l.enablePan&&function(e){var t=!1;switch(e.keyCode){case l.keys.UP:P(0,l.keyPanSpeed),t=!0;break;case l.keys.BOTTOM:P(0,-l.keyPanSpeed),t=!0;break;case l.keys.LEFT:P(l.keyPanSpeed,0),t=!0;break;case l.keys.RIGHT:P(-l.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),l.update())}(e)}function $(e){if(!1!==l.enabled){switch(e.preventDefault(),e.touches.length){case 1:switch(l.touches.ONE){case i.TOUCH.ROTATE:if(!1===l.enableRotate)return;G(e),f=h.TOUCH_ROTATE;break;case i.TOUCH.PAN:if(!1===l.enablePan)return;z(e),f=h.TOUCH_PAN;break;default:f=h.NONE}break;case 2:switch(l.touches.TWO){case i.TOUCH.DOLLY_PAN:if(!1===l.enableZoom&&!1===l.enablePan)return;!function(e){l.enableZoom&&H(e),l.enablePan&&z(e)}(e),f=h.TOUCH_DOLLY_PAN;break;case i.TOUCH.DOLLY_ROTATE:if(!1===l.enableZoom&&!1===l.enableRotate)return;!function(e){l.enableZoom&&H(e),l.enableRotate&&G(e)}(e),f=h.TOUCH_DOLLY_ROTATE;break;default:f=h.NONE}break;default:f=h.NONE}f!==h.NONE&&l.dispatchEvent(c)}}function Z(e){if(!1!==l.enabled)switch(e.preventDefault(),e.stopPropagation(),f){case h.TOUCH_ROTATE:if(!1===l.enableRotate)return;Y(e),l.update();break;case h.TOUCH_PAN:if(!1===l.enablePan)return;q(e),l.update();break;case h.TOUCH_DOLLY_PAN:if(!1===l.enableZoom&&!1===l.enablePan)return;!function(e){l.enableZoom&&j(e),l.enablePan&&q(e)}(e),l.update();break;case h.TOUCH_DOLLY_ROTATE:if(!1===l.enableZoom&&!1===l.enableRotate)return;!function(e){l.enableZoom&&j(e),l.enableRotate&&Y(e)}(e),l.update();break;default:f=h.NONE}}function J(e){!1!==l.enabled&&(l.dispatchEvent(d),f=h.NONE)}function ee(e){!1!==l.enabled&&e.preventDefault()}l.domElement.addEventListener("contextmenu",ee,!1),l.domElement.addEventListener("mousedown",V,!1),l.domElement.addEventListener("wheel",X,!1),l.domElement.addEventListener("touchstart",$,!1),l.domElement.addEventListener("touchend",J,!1),l.domElement.addEventListener("touchmove",Z,!1),l.domElement.addEventListener("keydown",Q,!1),-1===l.domElement.tabIndex&&(l.domElement.tabIndex=0),this.update()},i.OrbitControls.prototype=Object.create(i.EventDispatcher.prototype),i.OrbitControls.prototype.constructor=i.OrbitControls,i.MapControls=function(e,t){i.OrbitControls.call(this,e,t),this.mouseButtons.LEFT=i.MOUSE.PAN,this.mouseButtons.RIGHT=i.MOUSE.ROTATE,this.touches.ONE=i.TOUCH.PAN,this.touches.TWO=i.TOUCH.DOLLY_ROTATE},i.MapControls.prototype=Object.create(i.EventDispatcher.prototype),i.MapControls.prototype.constructor=i.MapControls,e.exports=t.default=i.OrbitControls},function(e,t){e.exports=THREE},function(e,t,n){"use strict";n.r(t),t.default=":host {\n all: initial;\n display: block;\n}\n\n.eighti-container {\n z-index: 10;\n box-shadow: 0px 0px 10px rgba(0,0,0,0.05);\n position: relative;\n overflow: hidden;\n width: 100%;\n height: 100%;\n -webkit-user-select: none; /* Chrome/Safari */\n -moz-user-select: none; /* Firefox */\n -ms-user-select: none; /* IE10+ */\n -o-user-select: none;\n user-select: none;\n}\n\n.player {\n width: 100%;\n height: 100%;\n}\n\n#canvas {\n cursor: -webkit-grab;\n cursor: -moz-grab;\n width: 100%;\n height: 100%;\n z-index: 1;\n}\n\n#canvas:active {\n cursor: -webkit-grabbing;\n cursor: -moz-grabbing;\n}\n\n/* Progress bar styles */\n.bar {\n position: relative;\n height: 5px;\n width: 96%;\n margin: 2px 2%;\n transition-duration: 0.3s;\n background-color: #DDD;\n overflow: hidden;\n}\n.bar:hover {\n height: 7px;\n margin: 1px 2%;\n}\n.bar .download {\n height: 100%;\n pointer-events: none;\n position: absolute;\n left: -200px;\n background-color: #fa9db5;\n animation: loading 2s linear reverse infinite;\n}\n@keyframes loading {\n from {left: -200px; width: 20%;}\n to {left: 96%; width: 20%}\n}\n.bar .played {\n height: 100%;\n position: absolute;\n background-color: #D43A65;\n pointer-events: none;\n}\n/* Gets clicked on to seek through the video */\n.bar .progress {\n position: absolute;\n height: 100%;\n width: 100%;\n}\n\n/* Collapsing panel for controls etc. */\n.collapsing {\n bottom: 0px;\n position: absolute;\n width: 100%;\n height: auto;\n transition-duration: 0.5s;\n}\n.collapsing.hidden {\n /* Move off the bottom of the player. Looks better? */\n bottom: -100px;\n}\n\n/* Control bar styles */\n.controls {\n color: white;\n bottom: 0;\n position: absolute;\n width: 100%;\n overflow: hidden;\n height: auto;\n text-shadow: 1px 1px 1px #232323;\n z-index: 5;\n}\n.controls .right {\n float: right;\n margin-right: 2%;\n}\n.controls .left {\n float: left;\n margin-left: 2%;\n}\n.controls .hidden {\n display:none;\n}\n.volume-unmuted:before {\n content: \"\\e0a0\";\n}\n.volume-muted:before {\n content: \"\\e0a1\";\n}\n.control-play:before {\n content: \"\\e071\";\n}\n.control-pause:before {\n content: \"\\e072\";\n}\n.control-forward:before {\n content: \"\\e073\";\n}\n.control-end:before {\n content: \"\\e074\";\n}\n.control-loop:before {\n content: \"\\e064\";\n}\n.control-settings:before {\n content: \"\\e09a\";\n}\n.size-fullscreen:before {\n content: \"\\e057\";\n}\n.size-actual:before {\n content: \"\\e058\";\n}\n.control-fps {\n width: 30px;\n height: 30px;\n padding: 10px;\n display:inline-block;\n}\n.control-fps:before {\n display: inline-block;\n content: \"\";\n padding: 0 0;\n background-repeat: no-repeat;\n background-size: 30px 30px;\n background-image: url(\"data:image/svg+xml,\");\n width: 30px;\n height: 30px;\n}\n.control-fps.inactive:before {\n display: inline-block;\n content: \"\";\n padding: 0 0;\n background-repeat: no-repeat;\n background-size: 30px 30px;\n background-image: url(\"data:image/svg+xml,\");\n width: 30px;\n height: 30px;\n}\n.icon {\n font-family: 'Simple-Line-Icons';\n speak: none;\n line-height: 1;\n -webkit-font-smoothing: antialiased;\n font-weight: bold;\n font-size: 30px;\n padding: 10px;\n display: inline-block;\n -webkit-user-select: none; /* Chrome/Safari */\n -moz-user-select: none; /* Firefox */\n -ms-user-select: none; /* IE10+ */\n -o-user-select: none;\n user-select: none;\n cursor: pointer;\n vertical-align: bottom;\n}\n\n@media only screen and (max-width: 220px) {\n .controls .right {\n float: left;\n }\n}\n\n.icon.inactive {\n color: rgba(255, 255, 255, 0.5);\n}\n\n.hide {\n display: none !important;\n}\n\n.fullscreen_hack {\n position: fixed;\n -webkit-transform: translate3d(0, 0, 0);\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 1000000;\n}\n.fps {\n height: 30px;\n font-size: 18px;\n vertical-align: middle;\n padding: 10px 0;\n}\n.arvr .icon {\n padding-bottom: 6px;\n line-height: normal;\n}"},function(e,t,n){var i=n(61);e.exports="string"==typeof i?i:i.toString()},function(e,t){e.exports='
AR
VR
'},function(e,t,n){n(21);const i=n(63),r=n(86);window.AFRAME&&window.AFRAME.registerComponent("hologram",{schema:{abr:{type:"boolean",default:!0},initialQualityRatio:{type:"number",default:0},src:{type:"string",default:""},autoplay:{type:"boolean",default:!0},loop:{type:"boolean",default:!1},muted:{type:"boolean",default:!0},fps:{type:"number",default:-1}},init:function(){let e=this.data,t=this.el,n=e.src,r=this.el.sceneEl.renderer;this._impl=new i(n,r,null,e),this._impl.onplay=e=>{this.el.emit("onplay",e)},this._impl.onpause=e=>{this.el.emit("onpause",e)},this._impl.onended=e=>{this.el.emit("onended",e)},this._impl.onbufferempty=()=>{this.el.emit("onbufferempty")},this._impl.onbufferloaded=()=>{this.el.emit("onbufferloaded")},this._impl.oncanplay=(e={})=>{this.el.emit("oncanplay",e)},t.setObject3D("mesh",this._impl._mesh),this._ready=!1,Object.defineProperty(this,"paused",{get(){return this._impl.paused}}),Object.defineProperty(this,"currentTime",{get(){return this._impl.currentTime}}),Object.defineProperty(this,"isPlaying",{get(){return!this._impl.paused}})},tick:function(e,t){this._impl&&this._impl.update(e);const n=this.el.sceneEl.renderer.getContext();if(this.el.sceneEl.frame){const e=this.el.sceneEl.frame;let t=e?e.session.renderState.baseLayer.framebuffer:null;n.bindFramebuffer(n.FRAMEBUFFER,t)}},update:function(e){let{data:t,el:n}=this;e.src&&e.src!=t.src&&console.error("Changing source not supported. Please destroy and re-create hologram"),e.fps&&e.fps!=t.fps&&console.error("Changing fps not supported. Please destroy and re-create hologram"),this._impl.muted=t.muted,this._impl.autoplay=t.autoplay,this._impl.loop=t.loop},remove:function(){this._impl.destroy(),this._impl=null,this.el.removeObject3D("mesh")},seek:function(e){this._impl.seek?this._impl.seek(e):console.error("Seek not supported.")},pause:function(){this._impl.pause()},play:function(){this._ready&&this._impl.play(),this._ready=!0}});class s extends HTMLElement{constructor(){super(),this._src=null,this._asset=null,this._onInitialised=null,this._onUpdate=null,this._audioSrc=null,this._arEnabled=!1}connectedCallback(){this.hasAttribute("src")&&(this._src=this.getAttribute("src")),this.hasAttribute("oninit")&&(this._onInitialised=this.getAttribute("oninit")),this.hasAttribute("onupdate")&&(this._onUpdate=this.getAttribute("onupdate")),this.hasAttribute("audio")&&(this._audioSrc=this.getAttribute("audio"))}disconnectedCallback(){this._impl.destroy(this._scene),this._impl=null}get src(){return this._src}set src(e){this._src=e}play(){console.log("play"),this._impl.play()}pause(){this._impl.pause()}seek(e){this._impl.seek(e)}set muted(e){this._impl.muted=e}get muted(){return this._impl.muted}get currentTime(){return this._impl.currentTime}get duration(){return this._impl.duration}set loop(e){this._impl.loop=e}get paused(){return this._impl.paused}get ready(){return!!this._impl&&this._impl.ready}initialise(e,t,n={}){this._scene=e,this._src?(-1!==this._src.indexOf("mpd")?(this._impl=new i(this._src,t,e,n),this._arEnabled=!0):this._impl=new r(this._src,this._audioSrc,t,e,n),this._impl.onended=e=>{this.onended&&this.onended(e)},this._impl.onplay=e=>{this.onplay&&this.onplay(e)},this._impl.onpause=e=>{this.onpause&&this.onpause(e)},this._impl.onloadeddata=e=>{this.onloadeddata&&this.onloadeddata(e)}):console.warn('No "src" specified for eighti actor')}destroy(){this._impl.destroy(this._scene),this._impl=null}get arEnabled(){return this._arEnabled}render(e,t,n,i,r){"render"in this._impl&&this._impl.render(e,t,n,i,r)}update(e,t,n){if(this._impl.update(e,t,n),this._callOnInit(),null!==this._onUpdate)if("function"==typeof this._onUpdate)this._onUpdate(this,t,n);else if(this._onUpdate in window){const e=window[this._onUpdate];"function"==typeof e?(this._onUpdate=e,this._onUpdate(this,t,n)):(console.error('"onupdate" is not a function'),this._onUpdate=null)}}_callOnInit(){if(this._onInitialised&&this._onInitialise in window){const e=window[this._onInitialised];"function"==typeof e?e(this):console.error('"oninit" is not a function'),this._onInitialise=null}}}e.exports=s},function(e,t,n){const i=n(64);n(88);e.exports=class{constructor(e,t,n,r={}){let{autoplay:s=!1,fps:a=-1,muted:o=!0,loop:l=!1,abr:u=!0,initialQualityRatio:c=0}=r;this._initialized=!1,this._ready=!1,this._src=e,this._video=document.createElement("video"),this._video.muted=o,this._video.loop=l,this._fps=a,this._video.onresize=()=>{this._video.videoWidth,this._video.videoHeight},this._video.onended=e=>{this.onended&&this.onended(e)},this._video.onplay=e=>{this.onplay&&this.onplay(e)},this._video.onpause=e=>{this.onpause&&this.onpause(e)},this._seeking=!1,this._video.onseeked=()=>{this._seeking=!1,this._lastFrame=-1},this._video.onloadeddata=e=>{this.onloadeddata&&this.onloadeddata(e)},this._lastFrame=-1,this._gl=t.getContext();const d=this._gl;this._stagingTexture=d.createTexture(),d.bindTexture(d.TEXTURE_2D,this._stagingTexture),d.pixelStorei(d.UNPACK_FLIP_Y_WEBGL,!1),d.texImage2D(d.TEXTURE_2D,0,d.RGBA,2048,2048,0,d.RGBA,d.UNSIGNED_BYTE,null),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.LINEAR),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.LINEAR),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.bindTexture(d.TEXTURE_2D,null),this._framebuffer=d.createFramebuffer(),d.bindFramebuffer(d.FRAMEBUFFER,this._framebuffer),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,this._stagingTexture,0),d.bindFramebuffer(d.FRAMEBUFFER,null),this._renderTexture=d.createTexture(),d.bindTexture(d.TEXTURE_2D,this._renderTexture),d.texImage2D(d.TEXTURE_2D,0,d.RGBA,2048,2048,0,d.RGBA,d.UNSIGNED_BYTE,null),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.LINEAR),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.LINEAR),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.bindTexture(d.TEXTURE_2D,null),this._texture=new THREE.Texture,this._texture.minFilter=THREE.LinearFilter,this._texture.magFilter=THREE.LinearFilter,this._texture.format=THREE.RGBFormat,this._texture.anisotropy=10;t.properties.get(this._texture).__webglTexture=this._renderTexture;let h=new THREE.MeshBasicMaterial({map:this._texture});h.side=THREE.DoubleSide,this._mesh=new THREE.Mesh(void 0,h),this._mesh.scale.set(.01,.01,.01),this._mesh.castShadow=!0,this._mesh.receiveShadow=!1,n&&n.add(this._mesh);const f=this._src.replace("manifest.mpd","fallback.mp4");this._availablilityStartTime=void 0,i.initialize("https://assets.8i.com/fallback.mp4",e=>{this._player=dashjs.MediaPlayer().create(),this._player.initialize(this._video,this._src,s);this._player.registerCustomCapabilitiesFilter(e=>!("framerate"in e)||-1===this._fps||e.framerate===this._fps+"/1"),this._player.on(dashjs.MediaPlayer.events.MANIFEST_LOADED,({data:t})=>{let n=Array.from(new Set(t.Period_asArray[0].AdaptationSet_asArray.find(e=>"video"===e.contentType).Representation_asArray.map(e=>e.framerate))).filter(e=>void 0!==e);if(n.length){let t=n.reduce((e,t)=>{let n=t;if("string"==typeof t){let e=t.match(/(?\d+)\/1/);e.groups&&e.groups.fps&&(n=parseInt(e.groups.fps))}return Math.min(n,e)},Number.MAX_VALUE);(e||!1===n.includes(this._fps+"/1"))&&(this._fps=t)}else this._fps=15}),this._player.on(dashjs.MediaPlayer.events.STREAM_INITIALIZED,({liveStartTime:e,streamInfo:t})=>{this._availablilityStartTime=t.manifestInfo.availableFrom}),this._player.on(dashjs.MediaPlayer.events.BUFFER_EMPTY,({mediaType:e})=>{"video"===e&&this.onbufferempty&&this.onbufferempty()}),this._player.on(dashjs.MediaPlayer.events.BUFFER_LOADED,({mediaType:e})=>{"video"===e&&this.onbufferloaded&&this.onbufferloaded()}),this._player.on(dashjs.MediaPlayer.events.CAN_PLAY,()=>{this.oncanplay&&this.oncanplay()}),this._player.updateSettings({debug:{logLevel:dashjs.Debug.LOG_LEVEL_NONE},streaming:{bufferPruningInterval:10,bufferToKeep:10,bufferTimeAtTopQuality:10,bufferTimeAtTopQualityLongForm:10,abr:{bandwidthSafetyFactor:.9,useDefaultABRRules:!0,useBufferOccupancyABR:!0,useDeadTimeLatency:!0,limitBitrateByPortal:!1,usePixelRatioInLimitBitrateByPortal:!1,maxBitrate:{audio:-1,video:-1,mesh:-1},minBitrate:{audio:-1,video:-1,mesh:-1},maxRepresentationRatio:{audio:-1,video:1,mesh:1},initialRepresentationRatio:{audio:-1,video:c,mesh:0},autoSwitchBitrate:{audio:!1,video:u,mesh:!1}},trackSwitchMode:{audio:"alwaysReplace",video:"alwaysReplace",mesh:"alwaysReplace"},retryIntervals:{MPD:1e3,XLinkExpansion:500,MediaSegment:500,InitializationSegment:500,BitstreamSwitchingSegment:1e3,IndexSegment:1e3,other:1e3},retryAttempts:{MPD:1e3,XLinkExpansion:1,MediaSegment:2,InitializationSegment:2,BitstreamSwitchingSegment:3,IndexSegment:3,other:3}}}),this._player.on(dashjs.MediaPlayer.events.QUALITY_CHANGE_REQUESTED,e=>{}),this._player.on(dashjs.MediaPlayer.events.QUALITY_CHANGE_RENDERED,e=>{}),this._video.onloadedmetadata=t=>{if(!this._initialized){if(e){console.log("onloadedmetadata","fallback"),this._video.crossOrigin="anonymous",this._video.setAttribute("playsinline","playsinline");let e=this._src.replace("manifest.mpd",`master_${this._fps}.m3u8`);fetch(e).then(t=>{t.ok&&""!==this._video.canPlayType("application/vnd.apple.mpegURL")?(console.log("HLS is available and playable"),this._video.src=e):(console.error("No HLS available, falling back to MP4"),this._video.src=f),this._video.load(),s&&this._video.play().then(console.log("playing fallback")).catch(e=>console.error("failed to play fallback",e))})}this._initialized=!0}},this._video.onprogress=e=>{0==e.target.buffered.length&&this._installTimeShim(this._availablilityStartTime)},this._video.onstalled=e=>{console.error("stalled",e)},this._video.onsuspend=e=>{console.error("suspend",e)},this._video.onerror=e=>{console.error("error",e)},this._video.onabort=e=>{console.error("abort",e)},this._ready=!0},e=>{this._meshSourceBuffer=e})}destroy(e){e&&e.remove(this._mesh),i.destroy(),this._meshSourceBuffer=void 0,this._video.pause(),this._video=null,this._player.destroy(),this._player=null}play(){this._video.play().catch(e=>console.log(e))}pause(){this._video.pause()}seek(e){this._seeking=!0,this._video.currentTime=e}set muted(e){this._video.muted=e}get muted(){return this._video.muted}set loop(e){this._video.loop=e}get currentTime(){return this._video.currentTime}get duration(){return this._video.duration}get paused(){return this._video.paused}get ready(){return this._ready}_installTimeShim(e){if(this._timeShimmed)return;let t=0;if("function"==typeof this._video.getStartDate){const n=this._video.getStartDate();console.log(`MPD start time: ${e} HLS start time: ${n}`);const i=n.getTime(),r=e.getTime();if(isNaN(i))return;{const e=i-r;console.log(i,r,e),t=e/1e3}}if(0===t)return;console.log("Using time offset: "+t);let n=this._video.__lookupGetter__("currentTime"),i=this._video.__lookupSetter__("currentTime"),r=this._video;Object.defineProperty(r,"currentTime",{get:function(){return n.call(r)+t},set:function(e){let t=e-getTimeOffset();i.call(r,t)}}),this._timeShimmed=!0}_getFrameDetails(){const e=new Uint8Array(8192),t=this._gl;t.bindFramebuffer(t.FRAMEBUFFER,this._framebuffer),t.checkFramebufferStatus(t.FRAMEBUFFER)==t.FRAMEBUFFER_COMPLETE&&t.readPixels(0,0,2048,1,t.RGBA,t.UNSIGNED_BYTE,e),t.bindFramebuffer(t.FRAMEBUFFER,null);let n=t=>255===e[4*t+3],i=2048;if(n(2047));else if(n(1023))i=1024;else{if(!n(511))return{width:-1,frameNum:-1};i=512}const r=4*i-32;let s=-1,a=0,o=[];for(let t=0;t<10;t++){let n=r-64*t,i=e[n]+e[n+1]+e[n+2];o.push(i),i>700&&(-1==s&&(s=0),s+=1<-1)if(o!=this._lastFrame){let e=this._meshSourceBuffer.getMeshByFrameId(o);if(e){this._mesh.geometry.dispose(),this._mesh.geometry=e;const t=a,n=this._gl;n.bindFramebuffer(n.FRAMEBUFFER,this._framebuffer),n.copyTexImage2D(n.TEXTURE_2D,0,n.RGBA,0,0,a,t,0),n.bindFramebuffer(n.FRAMEBUFFER,null),this._lastFrame=o}else console.warn("No mesh for "+o)}else this._lastFrame}else{const e=this._meshSourceBuffer.getFrameDuration(),t=9e4;if(e&&o>-1){let n=Math.round(i*t),r=Math.floor(n/e)*e/e,s=1024*Math.floor(r/1024)+o;if(s>this._lastFrame||1023==this._lastFrame){let t=s*e,n=this._meshSourceBuffer.getMesh(t);if(n){this._mesh.geometry.dispose(),this._mesh.geometry=n;const e=e=>{switch(e){case 2048:return 2080;case 1024:return 1040;case 512:return 520}},t=this._gl;t.bindFramebuffer(t.FRAMEBUFFER,this._framebuffer),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGBA,0,0,a,e(a),0),t.bindFramebuffer(t.FRAMEBUFFER,null),this._lastFrame=s}else console.warn("No mesh for "+t)}else this._lastFrame}}}render(e,t,n,i,r){this._mesh.visible=!r,this._mesh.position.copy(i)}}},function(e,t,n){const i=n(65);let r=new(n(66));r.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.4.1/");class s{constructor(e){this.buffer_=[],this.bufferSize_=0,this.basePtsOffset_=NaN,this.audioBufferEnd_=NaN,this.videoBufferEnd_=NaN,this.updating=!1,this.timestampOffset_=0,this.bytesReceived=0,this.ranges=[],this.samples=[],this.mp4Parser=i.createFile(),this.mp4Parser.onReady=e=>{this.mp4Parser.setExtractionOptions(e.tracks[0].id,null,{nbSamples:1}),this.mp4Parser.onSamples=this.onSamples.bind(this),this.mp4Parser.start()},this.mp4Parser.onError=e=>{console.error(e)},Object.defineProperty(this,"timestampOffset",{get(){return this.timestampOffset_},set(e){"number"==typeof e&&(this.timestampOffset_=e)}}),Object.defineProperty(this,"buffered",{get(){const e=[...this.ranges];return{length:e.length,start:function(t){return e[t].start},end:function(t){return e[t].end}}}})}async onSamples(e,t,[n]){const{duration:i,timescale:r}=n;this.timescale_=r;let s=await this.decodeData(n);this.samples.length>=2&&!this.frameDuration&&(this.frameDuration=this.samples[1].timestamp-this.samples[0].timestamp),this.samples.push(...s)}calculateRanges(){let e=[];for(let t of this.samples){let n=t.timestamp/this.timescale_+this.timestampOffset_,i=n+this.frameDuration/this.timescale_+this.timestampOffset_;if(0===e.length)e.push({start:n,end:i});else{let t=e.length-1;n>e[t].end+2*this._frameDuration?e.push({start:n,end:i}):e[t].end=i}}this.ranges=e}appendBuffer(e){let t;if(this.updating)throw t=new Error("SourceBuffer.append() cannot be called while an update is in progress"),t.name="InvalidStateError",t.code=11,t;e.fileStart=this.bytesReceived,this.bytesReceived=this.mp4Parser.appendBuffer(e),this.calculateRanges()}getFrameDuration(){return this.frameDuration}abort(){this.buffer_=[],this.bufferSize_=0,this.updating&&(this.updating=!1)}remove(e,t){const n=9e4*t,i=9e4*e;this.samples=this.samples.filter(e=>e.timestamp>n||e.timestampl[e].type="delta"),s.interpolatedFrames.forEach(e=>l[e].type="interpolated");let c=0;for(let e=0;e=0;t--)if("delta"===l[t].type||"full"===l[t].type){n=t;break}const i=e-n,r=t-n,s=i/r;if("full"===l[n].type){const i=l[n].geometry.attributes.position,r=l[t].geometry.attributes.delta;let{count:a,itemSize:o}=i;for(let t=0;tt.timestamp==e);if(t)return t.geometry}getMeshByFrameId(e){let t=this.samples.find(t=>t.frameId==e);if(t)return t.geometry}}let a,o=!1,l=!1,u=[];function c(e){const t=window.MediaSource.prototype.addSourceBuffer;window.MediaSource.prototype.addSourceBuffer=function(...e){if('mesh/fb;codecs="draco.514"'===e[0]){let t=new s(e);return"function"==typeof a&&a(t),u.push(t),t}return t.apply(this,e)};const n=window.MediaSource.prototype.removeSourceBuffer;window.MediaSource.prototype.removeSourceBuffer=function(...e){let t=e[0];if(!(t instanceof s))return n.apply(this,e);u=u.filter(e=>e!=t)};const i=window.MediaSource.isTypeSupported;window.MediaSource.isTypeSupported=function(e){return'mesh/fb;codecs="draco.514"'===e||i(e)}}e.exports={initialize:function(e,t,n){if(a=n,o)return t(l);void 0===window.MediaSource?(l=!0,fetch(e,{headers:{Range:"bytes=0-2686976"}}).then(e=>{if(e.ok)return e.blob();throw new Error("Failed to prime source")}).then(e=>{window.MediaSource=class t extends Blob{constructor(){super([e],{type:"video/mp4"}),Object.setPrototypeOf(this,t.prototype),console.log("Creating MediaSource fallback"),this._state="open"}get readyState(){return this._state}get duration(){return this._duration}set duration(e){this._duration=e}get sourceBuffers(){return new Array}addEventListener(e,t){switch(console.log("Adding fallback event: "+e),e){case"sourceopen":t();break;default:console.log("unhandled event listener: "+e)}}removeEventListener(e){console.log("removeEventListener: "+e)}addSourceBuffer(e){}static isTypeSupported(e){return!1}},c(),o=!0,t(l)}).catch(e=>console.error(e.message))):(c(),o=!0,t(l))},destroy:function(){a=void 0}}},function(e,t,n){var i,r,s=(i=new Date,r=4,{setLogLevel:function(e){r=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=r&&console.debug("["+s.getDurationString(new Date-i,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=r&&console.info("["+s.getDurationString(new Date-i,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=r&&console.warn("["+s.getDurationString(new Date-i,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=r&&console.error("["+s.getDurationString(new Date-i,1e3)+"]","["+e+"]",t)}});s.getDurationString=function(e,t){var n;function i(e,t){for(var n=(""+e).split(".");n[0].length0){for(var n="",i=0;i0&&(n+=","),n+="["+s.getDurationString(e.start(i))+","+s.getDurationString(e.end(i))+"]";return n}return"(empty)"},t.Log=s;var a=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};a.prototype.getPosition=function(){return this.position},a.prototype.getEndPosition=function(){return this.buffer.byteLength},a.prototype.getLength=function(){return this.buffer.byteLength},a.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},a.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},a.prototype.readAnyInt=function(e,t){var n=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:n=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:n=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";n=this.dataview.getUint8(this.position)<<16,n|=this.dataview.getUint8(this.position)<<8,n|=this.dataview.getUint8(this.position);break;case 4:n=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";n=this.dataview.getUint32(this.position)<<32,n|=this.dataview.getUint32(this.position);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,n}throw"Not enough bytes in buffer"},a.prototype.readUint8=function(){return this.readAnyInt(1,!1)},a.prototype.readUint16=function(){return this.readAnyInt(2,!1)},a.prototype.readUint24=function(){return this.readAnyInt(3,!1)},a.prototype.readUint32=function(){return this.readAnyInt(4,!1)},a.prototype.readUint64=function(){return this.readAnyInt(8,!1)},a.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",n=0;nthis._byteLength&&(this._byteLength=t);else{for(n<1&&(n=1);t>n;)n*=2;var i=new ArrayBuffer(n),r=new Uint8Array(this._buffer);new Uint8Array(i,0,r.length).set(r),this.buffer=i,this._byteLength=t}}},o.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),n=new Uint8Array(this._buffer,0,t.length);t.set(n),this.buffer=e}},o.BIG_ENDIAN=!1,o.LITTLE_ENDIAN=!0,o.prototype._byteLength=0,Object.defineProperty(o.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(o.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(o.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(o.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),o.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},o.prototype.isEof=function(){return this.position>=this._byteLength},o.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},o.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var n=new Int32Array(e);return o.memcpy(n.buffer,0,this.buffer,this.byteOffset+this.position,e*n.BYTES_PER_ELEMENT),o.arrayToNative(n,null==t?this.endianness:t),this.position+=n.byteLength,n},o.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var n=new Int16Array(e);return o.memcpy(n.buffer,0,this.buffer,this.byteOffset+this.position,e*n.BYTES_PER_ELEMENT),o.arrayToNative(n,null==t?this.endianness:t),this.position+=n.byteLength,n},o.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return o.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},o.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var n=new Uint32Array(e);return o.memcpy(n.buffer,0,this.buffer,this.byteOffset+this.position,e*n.BYTES_PER_ELEMENT),o.arrayToNative(n,null==t?this.endianness:t),this.position+=n.byteLength,n},o.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var n=new Uint16Array(e);return o.memcpy(n.buffer,0,this.buffer,this.byteOffset+this.position,e*n.BYTES_PER_ELEMENT),o.arrayToNative(n,null==t?this.endianness:t),this.position+=n.byteLength,n},o.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return o.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},o.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var n=new Float64Array(e);return o.memcpy(n.buffer,0,this.buffer,this.byteOffset+this.position,e*n.BYTES_PER_ELEMENT),o.arrayToNative(n,null==t?this.endianness:t),this.position+=n.byteLength,n},o.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var n=new Float32Array(e);return o.memcpy(n.buffer,0,this.buffer,this.byteOffset+this.position,e*n.BYTES_PER_ELEMENT),o.arrayToNative(n,null==t?this.endianness:t),this.position+=n.byteLength,n},o.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},o.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},o.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},o.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},o.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},o.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},o.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},o.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},o.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,o.memcpy=function(e,t,n,i,r){var s=new Uint8Array(e,t,r),a=new Uint8Array(n,i,r);s.set(a)},o.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},o.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},o.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n=0;nr;i--,r++){var s=t[r];t[r]=t[i],t[i]=s}return e},o.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],n=0;n>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},o.prototype.adjustUint32=function(e,t){var n=this.position;this.seek(e),this.writeUint32(t),this.seek(n)},o.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var n=new Int32Array(this._buffer,this.byteOffset+this.position,e);return o.arrayToNative(n,null==t?this.endianness:t),this.position+=4*e,n},o.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var n=new Int16Array(this._buffer,this.byteOffset+this.position,e);return o.arrayToNative(n,null==t?this.endianness:t),this.position+=2*e,n},o.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},o.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var n=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return o.arrayToNative(n,null==t?this.endianness:t),this.position+=4*e,n},o.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var n=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return o.arrayToNative(n,null==t?this.endianness:t),this.position+=2*e,n},o.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var n=new Float64Array(this._buffer,this.byteOffset+this.position,e);return o.arrayToNative(n,null==t?this.endianness:t),this.position+=8*e,n},o.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var n=new Float32Array(this._buffer,this.byteOffset+this.position,e);return o.arrayToNative(n,null==t?this.endianness:t),this.position+=4*e,n};var u=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(u.prototype=new o(new ArrayBuffer,0,o.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,s.debug("MultiBufferStream","Stream ready for parsing"),!0):(s.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(s.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){s.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var n=new Uint8Array(e.byteLength+t.byteLength);return n.set(new Uint8Array(e),0),n.set(new Uint8Array(t),e.byteLength),n.buffer},u.prototype.reduceBuffer=function(e,t,n){var i;return(i=new Uint8Array(n)).set(new Uint8Array(e,t,n)),i.buffer.fileStart=e.fileStart+t,i.buffer.usedBytes=0,i.buffer},u.prototype.insertBuffer=function(e){for(var t=!0,n=0;ni.byteLength){this.buffers.splice(n,1),n--;continue}s.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=i.fileStart||(e=this.reduceBuffer(e,0,i.fileStart-e.fileStart)),s.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(n,0,e),0===n&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,r,a)}}t&&(s.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===n&&(this.buffer=e))},u.prototype.logBufferLevel=function(e){var t,n,i,r,a,o=[],l="";for(i=0,r=0,t=0;t0&&(l+=a.end-1+"]");var u=e?s.info:s.debug;0===this.buffers.length?u("MultiBufferStream","No more buffer in memory"):u("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+i+"/"+r+" bytes): "+l)},u.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},u.prototype.findPosition=function(e,t,n){var i,r=null,a=-1;for(i=!0===e?0:this.bufferIndex;i=t?(s.debug("MultiBufferStream","Found position in existing buffer #"+a),a):-1},u.prototype.findEndContiguousBuf=function(e){var t,n,i,r=void 0!==e?e:this.bufferIndex;if(n=this.buffers[r],this.buffers.length>r+1)for(t=r+1;t>3;return 31===i&&n.data.length>=2&&(i=32+((7&n.data[0])<<3)+((224&n.data[1])>>5)),i}return null},n.DecoderConfigDescriptor=function(e){n.Descriptor.call(this,4,e)},n.DecoderConfigDescriptor.prototype=new n.Descriptor,n.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},n.DecoderSpecificInfo=function(e){n.Descriptor.call(this,5,e)},n.DecoderSpecificInfo.prototype=new n.Descriptor,n.SLConfigDescriptor=function(e){n.Descriptor.call(this,6,e)},n.SLConfigDescriptor.prototype=new n.Descriptor,this};t.MPEG4DescriptorParser=c;var d={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){d.FullBox.prototype=new d.Box,d.ContainerBox.prototype=new d.Box,d.SampleEntry.prototype=new d.Box,d.TrackGroupTypeBox.prototype=new d.FullBox,d.BASIC_BOXES.forEach((function(e){d.createBoxCtor(e)})),d.FULL_BOXES.forEach((function(e){d.createFullBoxCtor(e)})),d.CONTAINER_BOXES.forEach((function(e){d.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,n){this.type=e,this.size=t,this.uuid=n},FullBox:function(e,t,n){d.Box.call(this,e,t,n),this.flags=0,this.version=0},ContainerBox:function(e,t,n){d.Box.call(this,e,t,n),this.boxes=[]},SampleEntry:function(e,t,n,i){d.ContainerBox.call(this,e,t),this.hdr_size=n,this.start=i},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){d.FullBox.call(this,e,t)},createBoxCtor:function(e,t){d.boxCodes.push(e),d[e+"Box"]=function(t){d.Box.call(this,e,t)},d[e+"Box"].prototype=new d.Box,t&&(d[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){d[e+"Box"]=function(t){d.FullBox.call(this,e,t)},d[e+"Box"].prototype=new d.FullBox,d[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,n=0;nn?(s.error("BoxParser","Box of type '"+c+"' has a size "+u+" greater than its container size "+n),{code:d.ERR_NOT_ENOUGH_DATA,type:c,size:u,hdr_size:l,start:o}):o+u>e.getEndPosition()?(e.seek(o),s.info("BoxParser","Not enough data in stream to parse the entire '"+c+"' box"),{code:d.ERR_NOT_ENOUGH_DATA,type:c,size:u,hdr_size:l,start:o}):t?{code:d.OK,type:c,size:u,hdr_size:l,start:o}:(d[c+"Box"]?i=new d[c+"Box"](u):"uuid"!==c?(s.warn("BoxParser","Unknown box type: '"+c+"'"),(i=new d.Box(c,u)).has_unparsed_data=!0):d.UUIDBoxes[a]?i=new d.UUIDBoxes[a](u):(s.warn("BoxParser","Unknown uuid type: '"+a+"'"),(i=new d.Box(c,u)).uuid=a,i.has_unparsed_data=!0),i.hdr_size=l,i.start=o,i.write===d.Box.prototype.write&&"mdat"!==i.type&&(s.info("BoxParser","'"+h+"' box writing not yet implemented, keeping unparsed data in memory for later write"),i.parseDataAndRewind(e)),i.parse(e),(r=e.getPosition()-(i.start+i.size))<0?(s.warn("BoxParser","Parsing of box '"+h+"' did not read the entire indicated box data size (missing "+-r+" bytes), seeking forward"),e.seek(i.start+i.size)):r>0&&(s.error("BoxParser","Parsing of box '"+h+"' read "+r+" more bytes than the indicated box data size, seeking backwards"),e.seek(i.start+i.size)),{code:d.OK,box:i,size:i.size})},d.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},d.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},d.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},d.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},d.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},d.ContainerBox.prototype.parse=function(e){for(var t,n;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},d.SAMPLE_ENTRY_TYPE_VISUAL="Visual",d.SAMPLE_ENTRY_TYPE_AUDIO="Audio",d.SAMPLE_ENTRY_TYPE_HINT="Hint",d.SAMPLE_ENTRY_TYPE_METADATA="Metadata",d.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",d.SAMPLE_ENTRY_TYPE_SYSTEM="System",d.SAMPLE_ENTRY_TYPE_TEXT="Text",d.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},d.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},d.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},d.SampleEntry.prototype.parseFooter=function(e){d.ContainerBox.prototype.parse.call(this,e)},d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_HINT),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_METADATA),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SUBTITLE),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SYSTEM),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_TEXT),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),compressorname_length=Math.min(31,e.readUint8()),this.compressorname=e.readString(compressorname_length),compressorname_length<31&&e.readString(31-compressorname_length),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_TEXT,"enct"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_METADATA,"encm"),d.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)s.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void s.error("av1C reserved_2 parsing problem");var n=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(n)}else s.error("av1C reserved_1 parsing problem");else s.error("av1C version "+this.version+" not supported")})),d.createBoxCtor("avcC",(function(e){var t,n;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),n=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(n))})),d.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),d.createBoxCtor("clap",(function(e){this.cleanApertureWidthN=e.readUint32(),this.cleanApertureWidthD=e.readUint32(),this.cleanApertureHeightN=e.readUint32(),this.cleanApertureHeightD=e.readUint32(),this.horizOffN=e.readUint32(),this.horizOffD=e.readUint32(),this.vertOffN=e.readUint32(),this.vertOffD=e.readUint32()})),d.createBoxCtor("clli",(function(e){this.max_content_light_level=e.readUint16(),this.max_pic_average_light_level=e.readUint16()})),d.createFullBoxCtor("co64",(function(e){var t,n;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(n=0;n>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),d.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),d.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),d.createFullBoxCtor("ctts",(function(e){var t,n;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(n=0;n>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|n>>6&3,this.acmod=n>>3&7,this.lfeon=n>>2&1,this.bit_rate_code=3&n|i>>5&7})),d.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var n=0;n>6,i.bsid=r>>1&31,i.bsmod=(1&r)<<4|s>>4&15,i.acmod=s>>1&7,i.lfeon=1&s,i.num_dep_sub=a>>1&15,i.num_dep_sub>0&&(i.chan_loc=(1&a)<<8|e.readUint8())}})),d.createFullBoxCtor("dfLa",(function(e){var t=[],n=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var i=e.readUint8(),r=Math.min(127&i,n.length-1);if(r?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(n[r]),128&i)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),d.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),d.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),d.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),d.createFullBoxCtor("dref",(function(e){var t,n;this.entries=[];for(var i=e.readUint32(),r=0;r=4;)this.compatible_brands[n]=e.readString(4),t-=4,n++})),d.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),d.createBoxCtor("hvcC",(function(e){var t,n,i,r;this.configurationVersion=e.readUint8(),r=e.readUint8(),this.general_profile_space=r>>6,this.general_tier_flag=(32&r)>>5,this.general_profile_idc=31&r,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),r=e.readUint8(),this.constantFrameRate=r>>6,this.numTemporalLayers=(13&r)>>3,this.temporalIdNested=(4&r)>>2,this.lengthSizeMinusOne=3&r,this.nalu_arrays=[];var s=e.readUint8();for(t=0;t>7,a.nalu_type=63&r;var o=e.readUint16();for(n=0;n>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var n=0;if(this.version<2)n=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";n=e.readUint32()}for(var i=0;i=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),d.createFullBoxCtor("ipma",(function(e){var t,n;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?a.property_index=(127&s)<<8|e.readUint8():a.property_index=127&s}}})),d.createFullBoxCtor("iref",(function(e){var t,n;for(this.references=[];e.getPosition()>7,i.assignment_type=127&r,i.assignment_type){case 0:i.grouping_type=e.readString(4);break;case 1:i.grouping_type=e.readString(4),i.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:i.sub_track_id=e.readUint32();break;default:s.warn("BoxParser","Unknown leva assignement type")}}})),d.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),d.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]={},this.display_primaries[0].x=e.readUint16(),this.display_primaries[0].y=e.readUint16(),this.display_primaries[1]={},this.display_primaries[1].x=e.readUint16(),this.display_primaries[1].y=e.readUint16(),this.display_primaries[2]={},this.display_primaries[2].x=e.readUint16(),this.display_primaries[2].y=e.readUint16(),this.white_point={},this.white_point.x=e.readUint16(),this.white_point.y=e.readUint16(),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),d.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),d.createFullBoxCtor("mehd",(function(e){1&this.flags&&(s.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),d.createFullBoxCtor("meta",(function(e){this.boxes=[],d.ContainerBox.prototype.parse.call(this,e)})),d.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),d.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),d.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),d.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),d.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),d.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var n=0;n0){var t=e.readUint32();this.kid=[];for(var n=0;n0&&(this.data=e.readUint8Array(i))})),d.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),d.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),d.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),d.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),d.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),d.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var n=0;n>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var n=e.readUint8(),i=0;i>7,this.num_leading_samples=127&t})),d.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)s.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=d.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),d.createSampleGroupCtor("stsa",(function(e){s.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),d.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),d.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),d.createSampleGroupCtor("tsas",(function(e){s.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),d.createSampleGroupCtor("tscl",(function(e){s.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),d.createSampleGroupCtor("vipr",(function(e){s.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),d.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),n=0;n>6,this.sample_depends_on[i]=t>>4&3,this.sample_is_depended_on[i]=t>>2&3,this.sample_has_redundancy[i]=3&t})),d.createFullBoxCtor("senc"),d.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),s.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),n=0;n>31&1,i.referenced_size=2147483647&r,i.subsegment_duration=e.readUint32(),r=e.readUint32(),i.starts_with_SAP=r>>31&1,i.SAP_type=r>>28&7,i.SAP_delta_time=268435455&r}})),d.SingleItemTypeReferenceBox=function(e,t,n,i){d.Box.call(this,e,t),this.hdr_size=n,this.start=i},d.SingleItemTypeReferenceBox.prototype=new d.Box,d.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var n=0;n>4&15,this.sample_sizes[t+1]=15&i}else if(8===this.field_size)for(t=0;t0)for(n=0;n>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=d.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),d.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),d.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&d.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&d.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&d.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&d.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&d.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),d.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var n=e.readUint32(),i=0;i>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),d.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),d.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),d.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),d.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),d.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),d.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},d.createTrackGroupCtor("msrc"),d.TrackReferenceTypeBox=function(e,t,n,i){d.Box.call(this,e,t),this.hdr_size=n,this.start=i},d.TrackReferenceTypeBox.prototype=new d.Box,d.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},d.trefBox.prototype.parse=function(e){for(var t,n;e.getPosition()t&&this.flags&d.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&d.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var n=0;n0&&(this.location=e.readCString())})),d.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),d.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=d.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),d.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),d.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=d.parseHex16(e)})),d.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),d.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),d.SampleEntry.prototype.isVideo=function(){return!1},d.SampleEntry.prototype.isAudio=function(){return!1},d.SampleEntry.prototype.isSubtitle=function(){return!1},d.SampleEntry.prototype.isMetadata=function(){return!1},d.SampleEntry.prototype.isHint=function(){return!1},d.SampleEntry.prototype.getCodec=function(){return this.type.replace(".","")},d.SampleEntry.prototype.getWidth=function(){return""},d.SampleEntry.prototype.getHeight=function(){return""},d.SampleEntry.prototype.getChannelCount=function(){return""},d.SampleEntry.prototype.getSampleRate=function(){return""},d.SampleEntry.prototype.getSampleSize=function(){return""},d.VisualSampleEntry.prototype.isVideo=function(){return!0},d.VisualSampleEntry.prototype.getWidth=function(){return this.width},d.VisualSampleEntry.prototype.getHeight=function(){return this.height},d.AudioSampleEntry.prototype.isAudio=function(){return!0},d.AudioSampleEntry.prototype.getChannelCount=function(){return this.channel_count},d.AudioSampleEntry.prototype.getSampleRate=function(){return this.samplerate},d.AudioSampleEntry.prototype.getSampleSize=function(){return this.samplesize},d.SubtitleSampleEntry.prototype.isSubtitle=function(){return!0},d.MetadataSampleEntry.prototype.isMetadata=function(){return!0},d.decimalToHex=function(e,t){var n=Number(e).toString(16);for(t=null==t?t=2:t;n.length>=1;t+=d.decimalToHex(i,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var r=!1,s="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||r)&&(s="."+d.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+s,r=!0);t+=s}return t},d.mp4aSampleEntry.prototype.getCodec=function(){var e=d.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),n=this.esds.esd.getAudioConfig();return e+"."+d.decimalToHex(t)+(n?"."+n:"")}return e},d.stxtSampleEntry.prototype.getCodec=function(){var e=d.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},d.av01SampleEntry.prototype.getCodec=function(){var e,t=d.SampleEntry.prototype.getCodec.call(this);return 2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?12:10:this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?10:8),t+"."+this.av1C.seq_profile+"."+this.av1C.seq_level_idx_0+(this.av1C.seq_tier_0?"H":"M")+"."+e+"."+this.av1C.monochrome+"."+this.av1C.chroma_subsampling_x+this.av1C.chroma_subsampling_y+this.av1C.chroma_sample_position},d.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),s.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>l?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>l&&e.writeUint64(this.size)},d.FullBox.prototype.writeHeader=function(e){this.size+=4,d.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},d.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},d.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1-1||e[n]instanceof d.Box||t[n]instanceof d.Box||void 0===e[n]||void 0===t[n]||"function"==typeof e[n]||"function"==typeof t[n]||e.subBoxNames&&e.subBoxNames.indexOf(n.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(n.slice(0,4))>-1||"data"===n||"start"===n||"size"===n||"creation_time"===n||"modification_time"===n||d.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(n)>-1||e[n]===t[n]))return!1;return!0},d.boxEqual=function(e,t){if(!d.boxEqualFields(e,t))return!1;for(var n=0;n=t?e:new Array(t-e.length+1).join(n)+e}function r(e){var t=Math.floor(e/3600),n=Math.floor((e-3600*t)/60),r=Math.floor(e-3600*t-60*n),s=Math.floor(1e3*(e-3600*t-60*n-r));return i(t,2)+":"+i(n,2)+":"+i(r,2)+"."+i(s,3)}for(var s=this.parseSample(n),a="",o=0;o1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},g.prototype.setExtractionOptions=function(e,t,n){var i=this.getTrackById(e);if(i){var r={};this.extractedTracks.push(r),r.id=e,r.user=t,r.trak=i,i.nextSample=0,r.nb_samples=1e3,r.samples=[],n&&n.nbSamples&&(r.nb_samples=n.nbSamples)}},g.prototype.unsetExtractionOptions=function(e){for(var t=-1,n=0;n-1&&this.extractedTracks.splice(t,1)},g.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=d.parseOneBox(this.stream,!1)).code===d.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var n;switch(n="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),n){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[n]&&s.warn("ISOFile","Duplicate Box of type: "+n+", overriding previous occurrence"),this[n]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},g.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(s.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(s.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(s.warn("ISOFile","Not ready to start parsing"),!1))},g.prototype.appendBuffer=function(e,t){var n;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(n=this.nextSeekPosition,this.nextSeekPosition=void 0):n=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(n=this.stream.getEndFilePositionAfter(n))):n=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(s.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+n),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),s.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),n},g.prototype.getInfo=function(){var e,t,n,i,r,s={},a=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(s.hasMoov=!0,s.duration=this.moov.mvhd.duration,s.timescale=this.moov.mvhd.timescale,s.isFragmented=null!=this.moov.mvex,s.isFragmented&&this.moov.mvex.mehd&&(s.fragment_duration=this.moov.mvex.mehd.fragment_duration),s.isProgressive=this.isProgressive,s.hasIOD=null!=this.moov.iods,s.brands=[],s.brands.push(this.ftyp.major_brand),s.brands=s.brands.concat(this.ftyp.compatible_brands),s.created=new Date(a+1e3*this.moov.mvhd.creation_time),s.modified=new Date(a+1e3*this.moov.mvhd.modification_time),s.tracks=[],s.audioTracks=[],s.videoTracks=[],s.subtitleTracks=[],s.metadataTracks=[],s.hintTracks=[],s.otherTracks=[],e=0;e0?s.mime+='video/mp4; codecs="':s.audioTracks&&s.audioTracks.length>0?s.mime+='audio/mp4; codecs="':s.mime+='application/mp4; codecs="',e=0;e=n.samples.length)&&(s.info("ISOFile","Sending fragmented data on track #"+i.id+" for samples ["+Math.max(0,n.nextSample-i.nb_samples)+","+(n.nextSample-1)+"]"),s.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(i.id,i.user,i.segmentStream.buffer,n.nextSample,e&&n.nextSample>=n.samples.length),i.segmentStream=null,i!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=n.samples.length)&&(s.debug("ISOFile","Sending samples on track #"+a.id+" for sample "+n.nextSample),this.onSamples&&this.onSamples(a.id,a.user,a.samples),a.samples=[],a!==this.extractedTracks[t]))break}}}},g.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},g.prototype.getBoxes=function(e,t){var n=[];return g._sweep.call(this,e,n,t),n},g._sweep=function(e,t,n){for(var i in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&n)return;g._sweep.call(this.boxes[i],e,t,n)}},g.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},g.prototype.getTrackSample=function(e,t){var n=this.getTrackById(e);return this.getSample(n,t)},g.prototype.releaseUsedSamples=function(e,t){var n=0,i=this.getTrackById(e);i.lastValidSample||(i.lastValidSample=0);for(var r=i.lastValidSample;re*r.timescale){u=i-1;break}t&&r.is_sync&&(l=i)}for(t&&(u=l),e=n.samples[u].cts,n.nextSample=u;n.samples[u].alreadyRead===n.samples[u].size&&n.samples[u+1];)u++;return a=n.samples[u].offset+n.samples[u].alreadyRead,s.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+n.nextSample+" on track "+n.tkhd.track_id+", time "+s.getDurationString(e,o)+" and offset: "+a),{offset:a,time:e/o}},g.prototype.seek=function(e,t){var n,i,r,a=this.moov,o={offset:1/0,time:1/0};if(this.moov){for(r=0;r-1){a=o;break}switch(a){case"Visual":r.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),s.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24);break;case"Audio":r.add("smhd").set("balance",t.balance||0),s.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":r.add("hmhd");break;case"Subtitle":switch(r.add("sthd"),t.type){case"stpp":s.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"")}break;case"Metadata":case"System":default:r.add("nmhd")}t.description&&s.addBox(t.description),r.add("dinf").add("dref").addEntry((new d["url Box"]).set("flags",1));var c=r.add("stbl");return c.add("stsd").addEntry(s),c.add("stts").set("sample_counts",[]).set("sample_deltas",[]),c.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),c.add("stco").set("chunk_offsets",[]),c.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(n),t.id}},d.Box.prototype.computeSize=function(e){var t=e||new o;t.endianness=o.BIG_ENDIAN,this.write(t)},g.prototype.addSample=function(e,t,n){var i=n||{},r={},s=this.getTrackById(e);if(null!==s){r.number=s.samples.length,r.track_id=s.tkhd.track_id,r.timescale=s.mdia.mdhd.timescale,r.description_index=i.sample_description_index?i.sample_description_index-1:0,r.description=s.mdia.minf.stbl.stsd.entries[r.description_index],r.data=t,r.size=t.length,r.alreadyRead=r.size,r.duration=i.duration||1,r.cts=i.cts||0,r.dts=i.dts||0,r.is_sync=i.is_sync||!1,r.is_leading=i.is_leading||0,r.depends_on=i.depends_on||0,r.is_depended_on=i.is_depended_on||0,r.has_redundancy=i.has_redundancy||0,r.degradation_priority=i.degradation_priority||0,r.offset=0,r.subsamples=i.subsamples,s.samples.push(r),s.samples_size+=r.size,s.samples_duration+=r.duration,this.processSamples();var a=g.createSingleSampleMoof(r);return this.addBox(a),a.computeSize(),a.trafs[0].truns[0].data_offset=a.size+8,this.add("mdat").data=t,r}},g.createSingleSampleMoof=function(e){var t=new d.moofBox;t.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var n=t.add("traf");return n.add("tfhd").set("track_id",e.track_id).set("flags",d.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),n.add("tfdt").set("baseMediaDecodeTime",e.dts),n.add("trun").set("flags",d.TRUN_FLAGS_DATA_OFFSET|d.TRUN_FLAGS_DURATION|d.TRUN_FLAGS_SIZE|d.TRUN_FLAGS_FLAGS|d.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[0]).set("sample_composition_time_offset",[e.cts-e.dts]),t},g.prototype.lastMoofIndex=0,g.prototype.samplesDataSize=0,g.prototype.resetTables=function(){var e,t,n,i,r,s;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(l=r[a].grouping_type+"/0",(o=new u(r[a].grouping_type,0)).is_fragment=!0,t.sample_groups_info[l]||(t.sample_groups_info[l]=o))}else for(a=0;a=2&&(l=i[a].grouping_type+"/0",o=new u(i[a].grouping_type,0),e.sample_groups_info[l]||(e.sample_groups_info[l]=o))},g.setSampleGroupProperties=function(e,t,n,i){var r,s;for(r in t.sample_groups=[],i){var a;if(t.sample_groups[r]={},t.sample_groups[r].grouping_type=i[r].grouping_type,t.sample_groups[r].grouping_type_parameter=i[r].grouping_type_parameter,n>=i[r].last_sample_in_run&&(i[r].last_sample_in_run<0&&(i[r].last_sample_in_run=0),i[r].entry_index++,i[r].entry_index<=i[r].sbgp.entries.length-1&&(i[r].last_sample_in_run+=i[r].sbgp.entries[i[r].entry_index].sample_count)),i[r].entry_index<=i[r].sbgp.entries.length-1?t.sample_groups[r].group_description_index=i[r].sbgp.entries[i[r].entry_index].group_description_index:t.sample_groups[r].group_description_index=-1,0!==t.sample_groups[r].group_description_index)a=i[r].fragment_description?i[r].fragment_description:i[r].description,t.sample_groups[r].group_description_index>0?(s=t.sample_groups[r].group_description_index>65535?(t.sample_groups[r].group_description_index>>16)-1:t.sample_groups[r].group_description_index-1,a&&s>=0&&(t.sample_groups[r].description=a.entries[s])):a&&a.version>=2&&a.default_group_description_index>0&&(t.sample_groups[r].description=a.entries[a.default_group_description_index-1])}},g.process_sdtp=function(e,t,n){t&&(e?(t.is_leading=e.is_leading[n],t.depends_on=e.sample_depends_on[n],t.is_depended_on=e.sample_is_depended_on[n],t.has_redundancy=e.sample_has_redundancy[n]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},g.prototype.buildSampleLists=function(){var e;for(e=0;ey&&(T++,y<0&&(y=0),y+=s.sample_counts[T]),t>0?(e.samples[t-1].duration=s.sample_deltas[T],e.samples_duration+=e.samples[t-1].duration,R.dts=e.samples[t-1].dts+e.samples[t-1].duration):R.dts=0,a?(t>=S&&(b++,S<0&&(S=0),S+=a.sample_counts[b]),R.cts=e.samples[t].dts+a.sample_offsets[b]):R.cts=R.dts,o?(t==o.sample_numbers[A]-1?(R.is_sync=!0,A++):(R.is_sync=!1,R.degradation_priority=0),u&&u.entries[v].sample_delta+I==t+1&&(R.subsamples=u.entries[v].subsamples,I+=u.entries[v].sample_delta,v++)):R.is_sync=!0,g.process_sdtp(e.mdia.minf.stbl.sdtp,R,R.number),R.degradation_priority=h?h.priority[t]:0,u&&u.entries[v].sample_delta+I==t&&(R.subsamples=u.entries[v].subsamples,I+=u.entries[v].sample_delta),(c.length>0||d.length>0)&&g.setSampleGroupProperties(e,R,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},g.prototype.updateSampleLists=function(){var e,t,n,i,r,s,a,o,l,u,c,h,f,p,m;if(void 0!==this.moov)for(;this.lastMoofIndex0&&g.initSampleGroups(h,c,c.sbgps,h.mdia.minf.stbl.sgpds,c.sgpds),t=0;t0?p.dts=h.samples[h.samples.length-2].dts+h.samples[h.samples.length-2].duration:(c.tfdt?p.dts=c.tfdt.baseMediaDecodeTime:p.dts=0,h.first_traf_merged=!0),p.cts=p.dts,_.flags&d.TRUN_FLAGS_CTS_OFFSET&&(p.cts=p.dts+_.sample_composition_time_offset[n]),m=a,_.flags&d.TRUN_FLAGS_FLAGS?m=_.sample_flags[n]:0===n&&_.flags&d.TRUN_FLAGS_FIRST_FLAG&&(m=_.first_sample_flags),p.is_sync=!(m>>16&1),p.is_leading=m>>26&3,p.depends_on=m>>24&3,p.is_depended_on=m>>22&3,p.has_redundancy=m>>20&3,p.degradation_priority=65535&m;var E=!!(c.tfhd.flags&d.TFHD_FLAG_BASE_DATA_OFFSET),y=!!(c.tfhd.flags&d.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),T=!!(_.flags&d.TRUN_FLAGS_DATA_OFFSET),S=0;S=E?c.tfhd.base_data_offset:y||0===t?u.start:o,p.offset=0===t&&0===n?T?S+_.data_offset:S:o,o=p.offset+p.size,(c.sbgps.length>0||c.sgpds.length>0||h.mdia.minf.stbl.sbgps.length>0||h.mdia.minf.stbl.sgpds.length>0)&&g.setSampleGroupProperties(h,p,p.number_in_traf,c.sample_groups_info)}}if(c.subs){h.has_fragment_subsamples=!0;var b=c.first_sample_index;for(t=0;t-1){var a=(n=this.stream.buffers[r]).byteLength-(i.offset+i.alreadyRead-n.fileStart);return i.size-i.alreadyRead<=a?(s.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-n.fileStart)+" read size: "+(i.size-i.alreadyRead)+" full size: "+i.size+")"),o.memcpy(i.data.buffer,i.alreadyRead,n,i.offset+i.alreadyRead-n.fileStart,i.size-i.alreadyRead),n.usedBytes+=i.size-i.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead=i.size,i):(s.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-n.fileStart)+" read size: "+a+" full size: "+i.size+")"),o.memcpy(i.data.buffer,i.alreadyRead,n,i.offset+i.alreadyRead-n.fileStart,a),i.alreadyRead+=a,n.usedBytes+=a,this.stream.logBufferLevel(),null)}return null},g.prototype.releaseSample=function(e,t){var n=e.samples[t];return n.data?(this.samplesDataSize-=n.size,n.data=null,n.alreadyRead=0,n.size):0},g.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},g.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},g.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(n.protection=r.ipro.protections[r.iinf.item_infos[e].protection_index-1]),r.iinf.item_infos[e].item_type?n.type=r.iinf.item_infos[e].item_type:n.type="mime",n.content_type=r.iinf.item_infos[e].content_type,n.content_encoding=r.iinf.item_infos[e].content_encoding;if(r.iloc)for(e=0;e0){var h=r.iprp.ipco.boxes[d.property_index-1];n.properties[h.type]=h,n.properties.boxes.push(h)}}}}}},g.prototype.getItem=function(e){var t,n;if(!this.meta)return null;if(!(n=this.items[e]).data&&n.size)n.data=new Uint8Array(n.size),n.alreadyRead=0,this.itemsDataSize+=n.size,s.debug("ISOFile","Allocating item #"+e+" of size "+n.size+" (total: "+this.itemsDataSize+")");else if(n.alreadyRead===n.size)return n;for(var i=0;i-1))return null;var l=(t=this.stream.buffers[a]).byteLength-(r.offset+r.alreadyRead-t.fileStart);if(!(r.length-r.alreadyRead<=l))return s.debug("ISOFile","Getting item #"+e+" extent #"+i+" partial data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-t.fileStart)+" read size: "+l+" full extent size: "+r.length+" full item size: "+n.size+")"),o.memcpy(n.data.buffer,n.alreadyRead,t,r.offset+r.alreadyRead-t.fileStart,l),r.alreadyRead+=l,n.alreadyRead+=l,t.usedBytes+=l,this.stream.logBufferLevel(),null;s.debug("ISOFile","Getting item #"+e+" extent #"+i+" data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-t.fileStart)+" read size: "+(r.length-r.alreadyRead)+" full extent size: "+r.length+" full item size: "+n.size+")"),o.memcpy(n.data.buffer,n.alreadyRead,t,r.offset+r.alreadyRead-t.fileStart,r.length-r.alreadyRead),t.usedBytes+=r.length-r.alreadyRead,this.stream.logBufferLevel(),r.alreadyRead=r.length,n.alreadyRead+=r.length}}return n.alreadyRead===n.size?n:null},g.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var n=0;n0?this.moov.traks[e].samples[0].duration:0),t.push(i)}return t},d.Box.prototype.printHeader=function(e){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},d.FullBox.prototype.printHeader=function(e){this.size+=4,d.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},d.Box.prototype.print=function(e){this.printHeader(e)},d.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},d.tkhdBox.prototype.print=function(e){d.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var m={createFile:function(e,t){var n=void 0===e||e,i=new g(t);return i.discardMdatData=!n,i}};t.createFile=m.createFile},function(e,t){DRACOLoader=function(e){THREE.Loader.call(this,e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=1,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}},DRACOLoader.prototype=Object.assign(Object.create(THREE.Loader.prototype),{constructor:DRACOLoader,setDecoderPath:function(e){return this.decoderPath=e,this},setDecoderConfig:function(e){return this.decoderConfig=e,this},setWorkerLimit:function(e){return this.workerLimit=e,this},setVerbosity:function(){console.warn("DRACOLoader: The .setVerbosity() method has been removed.")},setDrawMode:function(){console.warn("DRACOLoader: The .setDrawMode() method has been removed.")},setSkipDequantization:function(){console.warn("DRACOLoader: The .setSkipDequantization() method has been removed.")},load:function(e,t,n,i){var r=new THREE.FileLoader(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),"use-credentials"===this.crossOrigin&&r.setWithCredentials(!0),r.load(e,e=>{var n={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,n).then(t).catch(i)},n,i)},decodeDracoFile:function(e,t,n,i){var r={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(e,r).then(t)},decodeGeometry:function(e,t){for(var n in t.attributeTypes){var i=t.attributeTypes[n];void 0!==i.BYTES_PER_ELEMENT&&(t.attributeTypes[n]=i.name)}JSON.stringify(t);var r,s=this.workerNextTaskID++,a=e.byteLength,o=this._getWorker(s,a).then(n=>(r=n,new Promise((n,i)=>{r._callbacks[s]={resolve:n,reject:i},r.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return o.finally(()=>{r&&s&&this._releaseTask(r,s)}),o},_createGeometry:function(e){var t=new THREE.BufferGeometry;e.index&&t.setIndex(new THREE.BufferAttribute(e.index.array,1));for(var n=0;n{n.load(e,t,void 0,i)})},preload:function(){return this._initDecoder(),this},_initDecoder:function(){if(this.decoderPending)return this.decoderPending;var e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{var n=t[0];e||(this.decoderConfig.wasmBinary=t[1]);var i=DRACOLoader.DRACOWorker.toString(),r=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r]))}),this.decoderPending},_getWorker:function(e,t){return this._initDecoder().then(()=>{var n;this.workerPool.lengtht._taskLoad?-1:1}));return(n=this.workerPool[this.workerPool.length-1])._taskCosts[e]=t,n._taskLoad+=t,n})},_releaseTask:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]},debug:function(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))},dispose:function(){for(var e=0;e{var t=e.draco,i=new t.Decoder,o=new t.DecoderBuffer;o.Init(new Int8Array(s),s.byteLength);try{var l=function(e,t,i,r){var s,a,o=r.attributeIDs,l=r.attributeTypes,u=r.metadataFields,c=t.GetEncodedGeometryType(i);if(c===e.TRIANGULAR_MESH)s=new e.Mesh,a=t.DecodeBufferToMesh(i,s);else{if(c!==e.POINT_CLOUD)throw new Error("DRACOLoader: Unexpected geometry type.");s=new e.PointCloud,a=t.DecodeBufferToPointCloud(i,s)}if(!a.ok()||0===s.ptr)throw new Error("DRACOLoader: Decoding failed: "+a.error_msg());var d={index:null,attributes:[],metadata:{}};for(var h in o){var f,p,g=self[l[h]];if(r.useUniqueIDs)p=o[h],f=t.GetAttributeByUniqueId(s,p);else{if(-1===(p=t.GetAttributeId(s,e[o[h]])))continue;f=t.GetAttribute(s,p)}d.attributes.push(n(e,t,s,h,g,f))}const m=t.GetMetadata(s),_=new e.MetadataQuerier;for(let t in u)if(_.HasEntry(m,t)){const n=u[t];let i;if("IntEntryArray"===n){let r=new e.DracoInt32Array;_["Get"+n](m,t,r);const s=r.size();i=new Int32Array(s);for(let e=0;ee.array.buffer);Object.values(l.metadata).forEach(e=>{e&&e.buffer&&u.push(e.buffer)}),l.index&&u.push(l.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:l},u)}catch(e){console.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{t.destroy(o),t.destroy(i)}})}}},DRACOLoader.setDecoderPath=function(){console.warn("DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.")},DRACOLoader.setDecoderConfig=function(){console.warn("DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.")},DRACOLoader.releaseDecoderModule=function(){console.warn("DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.")},DRACOLoader.getDecoderModule=function(){console.warn("DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.")},e.exports=DRACOLoader},function(e,t,n){!function(e,t,n,i){e.generateISD=function(e,t,n){var i=new a(e),r={};for(var o in e.head.layout.regions){var l=s(e,t,e.head.layout.regions[o],e.body,null,"",e.head.layout.regions[o],n,r);null!==l&&i.contents.push(l.element)}return i};var r=[n.byName.color.qname,n.byName.textCombine.qname,n.byName.textDecoration.qname,n.byName.textEmphasis.qname,n.byName.textOutline.qname,n.byName.textShadow.qname];function s(e,t,a,u,c,d,h,f,p){if(t=h.end)return null;var g="regionID"in h&&""!==h.regionID?h.regionID:d;if(null!==c&&g!==a.id&&(!("contents"in h)||"contents"in h&&0===h.contents.length||""!==g))return null;var m=new o(h);for(var _ in h.sets)t=h.sets[_].end||(m.styleAttrs[h.sets[_].qname]=h.sets[_].value);var E,y={};for(var T in m.styleAttrs)if(y[T]=!0,"region"===m.kind&&T===n.byName.writingMode.qname&&!(n.byName.direction.qname in m.styleAttrs)){var S=m.styleAttrs[T];"lrtb"===S||"lr"===S?m.styleAttrs[n.byName.direction.qname]="ltr":"rltb"!==S&&"rl"!==S||(m.styleAttrs[n.byName.direction.qname]="rtl")}if(null!==c)for(var b in n.all){var A=n.all[b];if(A.qname===n.byName.textDecoration.qname){var v=c.styleAttrs[A.qname],I=m.styleAttrs[A.qname],R=[];void 0===I?R=v:-1===I.indexOf("none")?((-1===I.indexOf("noUnderline")&&-1!==v.indexOf("underline")||-1!==I.indexOf("underline"))&&R.push("underline"),(-1===I.indexOf("noLineThrough")&&-1!==v.indexOf("lineThrough")||-1!==I.indexOf("lineThrough"))&&R.push("lineThrough"),(-1===I.indexOf("noOverline")&&-1!==v.indexOf("overline")||-1!==I.indexOf("overline"))&&R.push("overline")):R.push("none"),m.styleAttrs[A.qname]=R}else if(A.qname!==n.byName.fontSize.qname||A.qname in m.styleAttrs||"span"!==m.kind||"textContainer"!==m.styleAttrs[n.byName.ruby.qname])if(A.qname!==n.byName.fontSize.qname||A.qname in m.styleAttrs||"span"!==m.kind||"text"!==m.styleAttrs[n.byName.ruby.qname])A.inherit&&A.qname in c.styleAttrs&&!(A.qname in m.styleAttrs)&&(m.styleAttrs[A.qname]=c.styleAttrs[A.qname]);else{var w=c.styleAttrs[n.byName.fontSize.qname];"textContainer"===c.styleAttrs[n.byName.ruby.qname]?m.styleAttrs[A.qname]=w:m.styleAttrs[A.qname]=new i.ComputedLength(.5*w.rw,.5*w.rh)}else{var C=c.styleAttrs[n.byName.fontSize.qname];m.styleAttrs[A.qname]=new i.ComputedLength(.5*C.rw,.5*C.rh)}}for(var D in n.all){var N=n.all[D];if(!(N.qname in m.styleAttrs)&&!(N.qname===n.byName.position.qname&&n.byName.origin.qname in m.styleAttrs||N.qname===n.byName.origin.qname&&n.byName.position.qname in m.styleAttrs)){var M=e.head.styling.initials[N.qname]||N.initial;if(null!==M&&("region"===m.kind||!1===N.inherit&&null!==M)){var L=N.parse(M);null!==L?(m.styleAttrs[N.qname]=L,y[N.qname]=!0):l(f,"Invalid initial value for '"+N.qname+"' on element '"+m.kind)}}}for(var O in n.all){var x=n.all[O];if(x.qname in y&&null!==x.compute){var P=x.compute(e,c,m,m.styleAttrs[x.qname],p);null!==P?m.styleAttrs[x.qname]=P:(m.styleAttrs[x.qname]=x.compute(e,c,m,x.parse(x.initial),p),l(f,"Style '"+x.qname+"' on element '"+m.kind+"' cannot be computed"))}}if("none"===m.styleAttrs[n.byName.display.qname])return null;for(var U in null===c?E=null===u?[]:[u]:"contents"in h&&(E=h.contents),E){var F=s(e,t,a,u,m,g,E[U],f,p);null!==F&&m.contents.push(F.element)}for(var B in m.styleAttrs){var k=!1;if("span"===m.kind){var G=m.styleAttrs[n.byName.ruby.qname];(k=("container"===G||"textContainer"===G||"baseContainer"===G)&&-1!==r.indexOf(B))||(k="container"!==G&&B===n.byName.rubyAlign.qname),k||(k=!("textContainer"===G||"text"===G)&&B===n.byName.rubyPosition.qname)}if(!k)k=-1===n.byQName[B].applies.indexOf(m.kind);k&&delete m.styleAttrs[B]}var z=m.styleAttrs[n.byName.ruby.qname];if("p"===m.kind||"span"===m.kind&&("textContainer"===z||"text"===z)){var H=[];!function e(t,i){for(var r in t.contents){var s=t.contents[r],a=s.styleAttrs[n.byName.ruby.qname];("span"!==s.kind||"textContainer"!==a&&"text"!==a)&&("contents"in s?e(s,i):("span"===s.kind&&0!==s.text.length||"br"===s.kind)&&i.push(s))}}(m,H),function(e){for(var t,n=0;n0||"span"===m.kind&&null!==m.text||"region"===m.kind&&"always"===m.styleAttrs[n.byName.showBackground.qname]?{region_id:g,element:m}:null}function a(e){this.contents=[],this.aspectRatio=e.aspectRatio,this.lang=e.lang}function o(e){for(var t in this.kind=e.kind||"region",this.lang=e.lang,e.id&&(this.id=e.id),this.styleAttrs={},e.styleAttrs)this.styleAttrs[t]=e.styleAttrs[t];"src"in e&&(this.src=e.src),"type"in e&&(this.type=e.type),"text"in e?this.text=e.text:("region"===this.kind||"contents"in e)&&(this.contents=[]),"space"in e&&(this.space=e.space)}function l(e,t){if(e&&e.error&&e.error(t))throw t}}(t,"undefined"==typeof imscNames?n(30):imscNames,"undefined"==typeof imscStyles?n(40):imscStyles,"undefined"==typeof imscUtils?n(31):imscUtils)},function(e,t,n){!function(e,t,n,i,r){function s(e,t,n,i){var r=i&&"seq"===i.timeContainer,a=0;i&&(a=r&&n?n.end:i.begin),t.begin=t.explicit_begin?t.explicit_begin+a:a;var o=t.begin,l=null;for(var u in t.sets)s(e,t.sets[u],l,t),o="seq"===t.timeContainer?t.sets[u].end:Math.max(o,t.sets[u].end),l=t.sets[u];if("contents"in t)for(var c in t.contents)s(e,t.contents[c],l,t),o="seq"===t.timeContainer?t.contents[c].end:Math.max(o,t.contents[c].end),l=t.contents[c];else o=r?t.begin:Number.POSITIVE_INFINITY;null!==t.explicit_end&&null!==t.explicit_dur?t.end=Math.min(t.begin+t.explicit_dur,a+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=a+t.explicit_end:t.end=o,delete t.explicit_begin,delete t.explicit_dur,delete t.explicit_end,e._registerEvent(t)}function a(e){this.node=e}function o(){this.events=[],this.head=new l,this.body=null}function l(){this.styling=new u,this.layout=new h}function u(){this.styles={},this.initials={}}function c(){this.id=null,this.styleAttrs=null,this.styleRefs=null}function d(){this.styleAttrs=null}function h(){this.regions={}}function f(e,t){p.call(this,"image"),this.src=e,this.type=t}function p(e){this.kind=e}function g(e){this.id=e}function m(e){this.regionID=e}function _(e){this.styleAttrs=e}function E(e){this.sets=e}function y(e){this.contents=e}function T(e,t,n){this.explicit_begin=e,this.explicit_end=t,this.explicit_dur=n}function S(){p.call(this,"body")}function b(){p.call(this,"div")}function A(){p.call(this,"p")}function v(){p.call(this,"span")}function I(){p.call(this,"span")}function R(){p.call(this,"br")}function w(){}function C(){}function D(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 M(e,t){var n={};if(null!==e)for(var r in e.attributes){var s=e.attributes[r].uri+" "+e.attributes[r].local,a=i.byQName[s];if(void 0!==a){var o=a.parse(e.attributes[r].value);null!==o?(n[s]=o,a===i.byName.zIndex&&F(t,"zIndex attribute present but not used by IMSC1 since regions do not overlap")):B(t,"Cannot parse styling attribute "+s+" --\x3e "+e.attributes[r].value)}}return n}function L(e,t,n){for(var i in e.attributes)if(e.attributes[i].uri===t&&e.attributes[i].local===n)return e.attributes[i].value;return null}function O(e,t,n){var i,r=null;return null!==(i=/^(\d+(?:\.\d+)?)f$/.exec(n))?null!==t&&(r=parseFloat(i[1])/t):null!==(i=/^(\d+(?:\.\d+)?)t$/.exec(n))?null!==e&&(r=parseFloat(i[1])/e):null!==(i=/^(\d+(?:\.\d+)?)ms$/.exec(n))?r=parseFloat(i[1])/1e3:null!==(i=/^(\d+(?:\.\d+)?)s$/.exec(n))?r=parseFloat(i[1]):null!==(i=/^(\d+(?:\.\d+)?)h$/.exec(n))?r=3600*parseFloat(i[1]):null!==(i=/^(\d+(?:\.\d+)?)m$/.exec(n))?r=60*parseFloat(i[1]):null!==(i=/^(\d{2,}):(\d\d):(\d\d(?:\.\d+)?)$/.exec(n))?r=3600*parseInt(i[1])+60*parseInt(i[2])+parseFloat(i[3]):null!==(i=/^(\d{2,}):(\d\d):(\d\d)\:(\d{2,})$/.exec(n))&&null!==t&&(r=3600*parseInt(i[1])+60*parseInt(i[2])+parseInt(i[3])+(null===i[4]?0:parseInt(i[4])/t)),r}function x(e,t,n){for(;t.styleRefs.length>0;){var i=t.styleRefs.pop();i in e.styles?(x(e,e.styles[i],n),U(e.styles[i].styleAttrs,t.styleAttrs)):B(n,"Non-existant style id referenced")}}function P(e,t,n,i){for(var r=t.length-1;r>=0;r--){var s=t[r];s in e.styles?U(e.styles[s].styleAttrs,n):B(i,"Non-existant style id referenced")}}function U(e,t){for(var n in e)n in t||(t[n]=e[n])}function F(e,t){if(e&&e.warn&&e.warn(t))throw t}function B(e,t){if(e&&e.error&&e.error(t))throw t}function k(e,t){throw e&&e.fatal&&e.fatal(t),t}function G(e,t){for(var n,i=0,r=e.length-1;i<=r;){var s=e[n=Math.floor((i+r)/2)];if(st))return{found:!0,index:n};r=n-1}}return{found:!1,index:i}}e.fromXML=function(e,r,p){var g=t.parser(!0,{xmlns:!0}),m=[],_=[],E=[],y=0,T=null;g.onclosetag=function(e){if(m[0]instanceof w)null!==T.head&&null!==T.head.styling&&P(T.head.styling,m[0].styleRefs,m[0].styleAttrs,r),delete m[0].styleRefs;else if(m[0]instanceof u)for(var t in m[0].styles)x(m[0],m[0].styles[t],r);else if(m[0]instanceof A||m[0]instanceof v){if(m[0].contents.length>1){var i,s=[m[0].contents[0]];for(i=1;i0&&p&&"onCloseTag"in p&&p.onCloseTag());E.shift(),_.shift(),m.shift()},g.ontext=function(e){if(void 0===m[0]);else if(m[0]instanceof v||m[0]instanceof A){if(m[0]instanceof v){var t=m[0].styleAttrs[i.byName.ruby.qname];if("container"===t||"textContainer"===t||"baseContainer"===t)return}var n=new I;n.initFromText(T,m[0],e,_[0],E[0],r),m[0].contents.push(n)}else m[0]instanceof a&&y>0&&p&&"onText"in p&&p.onText(e)},g.onopentag=function(e){var t=e.attributes["xml:space"];t?E.unshift(t.value):0===E.length?E.unshift("default"):E.unshift(E[0]);var s=e.attributes["xml:lang"];if(s?_.unshift(s.value):0===_.length?_.unshift(""):_.unshift(_[0]),e.uri===n.ns_tt)if("tt"===e.local)null!==T&&k(r,"Two elements at ("+this.line+","+this.column+")"),(T=new o).initFromNode(e,_[0],r),m.unshift(T);else if("head"===e.local)m[0]instanceof o||k(r,"Parent of element is not at ("+this.line+","+this.column+")"),m.unshift(T.head);else if("styling"===e.local)m[0]instanceof l||k(r,"Parent of element is not at ("+this.line+","+this.column+")"),m.unshift(T.head.styling);else if("style"===e.local){var g;m[0]instanceof u?((g=new c).initFromNode(e,r),g.id?T.head.styling.styles[g.id]=g:B(r,"